KDE/kdelibs/khtml/css
Nikolas Zimmermann
wildfox at kde.org
Tue Mar 21 11:07:22 GMT 2006
SVN commit 520948 by wildfox:
Committing my khtml-possible-css-fix.diff, fixing the @namespace collector
to not crash on every namespace != xhtml. This fixes at least my svg sheet
loading stuff. No new regressions introduced. Reviewed (at least) by Germain.
CCMAIL: kfm-devel at kde.org
M +8 -2 css_stylesheetimpl.cpp
M +7 -7 cssstyleselector.cpp
M +2 -2 cssstyleselector.h
--- trunk/KDE/kdelibs/khtml/css/css_stylesheetimpl.cpp #520947:520948
@@ -216,10 +216,13 @@
m_namespaces = new CSSNamespace(prefix, uri, m_namespaces);
- if (prefix.isEmpty())
+ if (prefix.isEmpty()) {
+ Q_ASSERT(m_doc != 0);
+
// Set the default namespace on the parser so that selectors that omit namespace info will
// be able to pick it up easily.
p->defaultNamespace = m_doc->getId(NodeImpl::NamespaceId, uri.implementation(), false, false, &exceptioncode);
+ }
}
void CSSStyleSheetImpl::determineNamespace(quint32& id, const DOM::DOMString& prefix)
@@ -236,9 +239,12 @@
else {
int exceptioncode = 0;
CSSNamespace* ns = m_namespaces->namespaceForPrefix(prefix);
- if (ns)
+ if (ns) {
+ Q_ASSERT(m_doc != 0);
+
// Look up the id for this namespace URI.
id = makeId(m_doc->getId(NodeImpl::NamespaceId, ns->uri().implementation(), false, false, &exceptioncode), localNamePart(id));
+ }
}
}
--- trunk/KDE/kdelibs/khtml/css/cssstyleselector.cpp #520947:520948
@@ -194,7 +194,7 @@
{
KHTMLView* view = doc->view();
- init(view ? view->part()->settings() : 0);
+ init(view ? view->part()->settings() : 0, doc);
strictParsing = _strictParsing;
m_medium = view ? view->mediaType() : QString("all");
@@ -252,7 +252,7 @@
CSSStyleSelector::CSSStyleSelector( CSSStyleSheetImpl *sheet )
{
- init(0L);
+ init(0L, 0L);
KHTMLView *view = sheet->doc()->view();
m_medium = view ? view->mediaType() : "screen";
@@ -261,7 +261,7 @@
authorStyle->append( sheet, m_medium );
}
-void CSSStyleSelector::init(const KHTMLSettings* _settings)
+void CSSStyleSelector::init(const KHTMLSettings* _settings, DocumentImpl* doc)
{
element = 0;
settings = _settings;
@@ -270,7 +270,7 @@
pseudoProps = (CSSOrderedProperty **)malloc(128*sizeof(CSSOrderedProperty *));
propsToApplySize = 128;
pseudoPropsSize = 128;
- if(!s_defaultStyle) loadDefaultStyle(settings);
+ if(!s_defaultStyle) loadDefaultStyle(settings, doc);
defaultStyle = s_defaultStyle;
defaultPrintStyle = s_defaultPrintStyle;
@@ -294,7 +294,7 @@
authorStyle->append( sheet, m_medium );
}
-void CSSStyleSelector::loadDefaultStyle(const KHTMLSettings *s)
+void CSSStyleSelector::loadDefaultStyle(const KHTMLSettings *s, DocumentImpl *doc)
{
if(s_defaultStyle) return;
@@ -313,7 +313,7 @@
style += s->settingsToCSS();
DOMString str(style);
- s_defaultSheet = new DOM::CSSStyleSheetImpl((DOM::CSSStyleSheetImpl * ) 0);
+ s_defaultSheet = new DOM::CSSStyleSheetImpl(doc);
s_defaultSheet->parseString( str );
// Collect only strict-mode rules.
@@ -336,7 +336,7 @@
QString style = QLatin1String( file.data() );
DOMString str(style);
- s_quirksSheet = new DOM::CSSStyleSheetImpl((DOM::CSSStyleSheetImpl * ) 0);
+ s_quirksSheet = new DOM::CSSStyleSheetImpl(doc);
s_quirksSheet->parseString( str );
// Collect only quirks-mode rules.
--- trunk/KDE/kdelibs/khtml/css/cssstyleselector.h #520947:520948
@@ -126,7 +126,7 @@
KHTML_EXPORT static void clear();
static void reparseConfiguration();
- static void loadDefaultStyle(const KHTMLSettings *s = 0);
+ static void loadDefaultStyle(const KHTMLSettings *s, DOM::DocumentImpl *doc);
RenderStyle *styleForElement(DOM::ElementImpl *e);
@@ -184,7 +184,7 @@
public:
private:
- void init(const KHTMLSettings* settings);
+ void init(const KHTMLSettings* settings, DOM::DocumentImpl* doc);
void mapBackgroundAttachment(BackgroundLayer* layer, DOM::CSSValueImpl* value);
void mapBackgroundImage(BackgroundLayer* layer, DOM::CSSValueImpl* value);
More information about the kfm-devel
mailing list