safari patch splitup: add RenderStyle::isStyleAvailable
Alexander Kellett
lypanov at kde.org
Thu Jan 9 16:33:21 GMT 2003
(patch seven)
add isStyleAvailable support to CSSStyleSelector/RenderStyle
though the logic in isStyleAvailable
"this != CSSStyleSelector::styleNotYetAvailable"
does seem mighty strange to me :)
mvg,
Alex
--
"[...] Konqueror open source project. Weighing in at less than
one tenth the size of another open source renderer"
Apple, Jan 2003 (http://www.apple.com/safari/)
-------------- next part --------------
? Makefile.rules
Index: cssstyleselector.cpp
===================================================================
RCS file: /home/kde/kdelibs/khtml/css/cssstyleselector.cpp,v
retrieving revision 1.246
diff -u -p -B -w -r1.246 cssstyleselector.cpp
--- cssstyleselector.cpp 9 Jan 2003 07:14:24 -0000 1.246
+++ cssstyleselector.cpp 9 Jan 2003 16:29:40 -0000
@@ -73,6 +73,7 @@ CSSStyleSelectorList *CSSStyleSelector::
CSSStyleSelectorList *CSSStyleSelector::defaultQuirksStyle = 0;
CSSStyleSelectorList *CSSStyleSelector::defaultPrintStyle = 0;
CSSStyleSheetImpl *CSSStyleSelector::defaultSheet = 0;
+RenderStyle* CSSStyleSelector::styleNotYetAvailable = 0;
enum PseudoState { PseudoUnknown, PseudoNone, PseudoLink, PseudoVisited};
static PseudoState pseudoState;
@@ -220,10 +221,12 @@ void CSSStyleSelector::clear()
delete defaultQuirksStyle;
delete defaultPrintStyle;
delete defaultSheet;
+ delete styleNotYetAvailable;
defaultStyle = 0;
defaultQuirksStyle = 0;
defaultPrintStyle = 0;
defaultSheet = 0;
+ styleNotYetAvailable = 0;
}
#define MAXFONTSIZES 15
@@ -292,6 +295,15 @@ static inline void bubbleSort( CSSOrdere
RenderStyle *CSSStyleSelector::styleForElement(ElementImpl *e, int state)
{
+ if (!e->getDocument()->haveStylesheetsLoaded()) {
+ if (!styleNotYetAvailable) {
+ styleNotYetAvailable = new RenderStyle();
+ styleNotYetAvailable->setDisplay(NONE);
+ styleNotYetAvailable->ref();
+ }
+ return styleNotYetAvailable;
+ }
+
// set some variables we will need
dynamicState = state;
usedDynamicStates = StyleSelector::None;
Index: cssstyleselector.h
===================================================================
RCS file: /home/kde/kdelibs/khtml/css/cssstyleselector.h,v
retrieving revision 1.30
diff -u -p -B -w -r1.30 cssstyleselector.h
--- cssstyleselector.h 8 Jan 2003 18:15:50 -0000 1.30
+++ cssstyleselector.h 9 Jan 2003 16:29:40 -0000
@@ -162,6 +162,9 @@ namespace khtml
CSSStyleSelectorList *authorStyle;
CSSStyleSelectorList *userStyle;
DOM::CSSStyleSheetImpl *userSheet;
+ public:
+ static RenderStyle* styleNotYetAvailable;
+
public:
private:
-------------- next part --------------
? Makefile.rules
Index: render_style.cpp
===================================================================
RCS file: /home/kde/kdelibs/khtml/rendering/render_style.cpp,v
retrieving revision 1.55
diff -u -p -B -w -r1.55 render_style.cpp
--- render_style.cpp 8 Jan 2003 06:23:16 -0000 1.55
+++ render_style.cpp 9 Jan 2003 16:37:31 -0000
@@ -233,6 +233,11 @@ bool RenderStyle::operator==(const Rende
inherited == o.inherited);
}
+bool RenderStyle::isStyleAvailable() const
+{
+ return this != CSSStyleSelector::styleNotYetAvailable;
+}
+
RenderStyle* RenderStyle::getPseudoStyle(PseudoId pid)
{
RenderStyle *ps = 0;
Index: render_style.h
===================================================================
RCS file: /home/kde/kdelibs/khtml/rendering/render_style.h,v
retrieving revision 1.80
diff -u -p -B -w -r1.80 render_style.h
--- render_style.h 28 Dec 2002 14:05:05 -0000 1.80
+++ render_style.h 9 Jan 2003 16:37:31 -0000
@@ -640,6 +640,8 @@ public:
bool visuallyOrdered() const { return inherited_flags._visuallyOrdered; }
void setVisuallyOrdered(bool b) { inherited_flags._visuallyOrdered = b; }
+ bool isStyleAvailable() const;
+
// attribute getter methods
EDisplay display() const { return noninherited_flags._display; }
More information about the kfm-devel
mailing list