[prev in list] [next in list] [prev in thread] [next in thread]
List: kfm-devel
Subject: PATCH: don't allow @import after inlined declarations
From: Dawit Alemayehu <adawit () kde ! org>
Date: 2000-09-25 0:41:54
[Download RAW message or body]
Hello,
The patch below allows the CSS parser to ignore @import statements
that appear after inlined style declarations. This is for CSS-1 compliance
according to http://www.w3.org/TR/REC-CSS1#the-cascade (last paragraph in
section 3.0 Cascade). You can find a test case for this behavior here:
http://www.w3.org/Style/CSS/Test/current/sec11.htm.
Can I commit ?
Regards,
Dawit A.
["cssparser.diff" (text/x-c++)]
Index: cssparser.cpp
===================================================================
RCS file: /home/kde/kdelibs/khtml/css/cssparser.cpp,v
retrieving revision 1.58
diff -u -r1.58 cssparser.cpp
--- cssparser.cpp 2000/09/21 14:16:58 1.58
+++ cssparser.cpp 2000/09/22 07:59:10
@@ -1802,10 +1802,19 @@
kdDebug( 6080 ) << "parse rule: current = " << curP->latin1() << endl;
#endif
- if (*curP == '@')
- rule = parseAtRule(curP, endP);
+ if (*curP == '@' )
+ {
+ // Do not allow @import statements after explicit inline
+ // declarations. They should simply be ignored per CSS-1
+ // specification section 3.0.
+ if(!hasInlinedDecl)
+ rule = parseAtRule(curP, endP);
+ }
else
+ {
rule = parseStyleRule(curP, endP);
+ hasInlinedDecl = true;
+ }
if(curP) curP++;
return rule;
Index: cssparser.h
===================================================================
RCS file: /home/kde/kdelibs/khtml/css/cssparser.h,v
retrieving revision 1.14
diff -u -r1.14 cssparser.h
--- cssparser.h 2000/08/23 19:58:04 1.14
+++ cssparser.h 2000/09/22 07:59:12
@@ -48,7 +48,7 @@
{
public:
StyleBaseImpl() { m_parent = 0; }
- StyleBaseImpl(StyleBaseImpl *p) { m_parent = p; }
+ StyleBaseImpl(StyleBaseImpl *p) { m_parent = p; hasInlinedDecl = false; }
virtual ~StyleBaseImpl() {}
virtual bool deleteMe();
@@ -124,6 +124,8 @@
protected:
StyleBaseImpl *m_parent;
+ private:
+ bool hasInlinedDecl;
};
// a style class which has a list of children (StyleSheets for example)
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic