[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677
hyatt
hyatt at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 06:51:59 UTC 2009
The following commit has been merged in the debian/unstable branch:
commit 8c9b24375c8c29e6cab772db444c0bc96c996283
Author: hyatt <hyatt at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Mon Oct 21 22:41:51 2002 +0000
Implement support for a new @-rule called @konq-quirks. This
will allow us to put style rules into html4.css that only
apply for pages in quirks mode.
* khtml/css/css_ruleimpl.cpp:
(CSSQuirksRuleImpl::CSSQuirksRuleImpl):
(CSSQuirksRuleImpl::~CSSQuirksRuleImpl):
(CSSQuirksRuleImpl::cssRules):
(CSSQuirksRuleImpl::appendRule):
(CSSQuirksRuleImpl::insertRule):
(CSSQuirksRuleImpl::deleteRule):
* khtml/css/css_ruleimpl.h:
* khtml/css/cssparser.cpp:
(StyleBaseImpl::parseAtRule):
* khtml/css/cssparser.h:
* khtml/css/cssstyleselector.cpp:
* khtml/css/cssstyleselector.h:
* khtml/dom/css_rule.h:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@2401 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog-2002-12-03 b/WebCore/ChangeLog-2002-12-03
index 6a16434..6e03e1a 100644
--- a/WebCore/ChangeLog-2002-12-03
+++ b/WebCore/ChangeLog-2002-12-03
@@ -1,3 +1,24 @@
+2002-10-21 David Hyatt <hyatt at apple.com>
+
+ Implement support for a new @-rule called @konq-quirks. This
+ will allow us to put style rules into html4.css that only
+ apply for pages in quirks mode.
+
+ * khtml/css/css_ruleimpl.cpp:
+ (CSSQuirksRuleImpl::CSSQuirksRuleImpl):
+ (CSSQuirksRuleImpl::~CSSQuirksRuleImpl):
+ (CSSQuirksRuleImpl::cssRules):
+ (CSSQuirksRuleImpl::appendRule):
+ (CSSQuirksRuleImpl::insertRule):
+ (CSSQuirksRuleImpl::deleteRule):
+ * khtml/css/css_ruleimpl.h:
+ * khtml/css/cssparser.cpp:
+ (StyleBaseImpl::parseAtRule):
+ * khtml/css/cssparser.h:
+ * khtml/css/cssstyleselector.cpp:
+ * khtml/css/cssstyleselector.h:
+ * khtml/dom/css_rule.h:
+
2002-10-21 Darin Adler <darin at apple.com>
Remove closeEntireTree now that deferred close takes care of that case.
diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index 6a16434..6e03e1a 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,3 +1,24 @@
+2002-10-21 David Hyatt <hyatt at apple.com>
+
+ Implement support for a new @-rule called @konq-quirks. This
+ will allow us to put style rules into html4.css that only
+ apply for pages in quirks mode.
+
+ * khtml/css/css_ruleimpl.cpp:
+ (CSSQuirksRuleImpl::CSSQuirksRuleImpl):
+ (CSSQuirksRuleImpl::~CSSQuirksRuleImpl):
+ (CSSQuirksRuleImpl::cssRules):
+ (CSSQuirksRuleImpl::appendRule):
+ (CSSQuirksRuleImpl::insertRule):
+ (CSSQuirksRuleImpl::deleteRule):
+ * khtml/css/css_ruleimpl.h:
+ * khtml/css/cssparser.cpp:
+ (StyleBaseImpl::parseAtRule):
+ * khtml/css/cssparser.h:
+ * khtml/css/cssstyleselector.cpp:
+ * khtml/css/cssstyleselector.h:
+ * khtml/dom/css_rule.h:
+
2002-10-21 Darin Adler <darin at apple.com>
Remove closeEntireTree now that deferred close takes care of that case.
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 6a16434..6e03e1a 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,24 @@
+2002-10-21 David Hyatt <hyatt at apple.com>
+
+ Implement support for a new @-rule called @konq-quirks. This
+ will allow us to put style rules into html4.css that only
+ apply for pages in quirks mode.
+
+ * khtml/css/css_ruleimpl.cpp:
+ (CSSQuirksRuleImpl::CSSQuirksRuleImpl):
+ (CSSQuirksRuleImpl::~CSSQuirksRuleImpl):
+ (CSSQuirksRuleImpl::cssRules):
+ (CSSQuirksRuleImpl::appendRule):
+ (CSSQuirksRuleImpl::insertRule):
+ (CSSQuirksRuleImpl::deleteRule):
+ * khtml/css/css_ruleimpl.h:
+ * khtml/css/cssparser.cpp:
+ (StyleBaseImpl::parseAtRule):
+ * khtml/css/cssparser.h:
+ * khtml/css/cssstyleselector.cpp:
+ * khtml/css/cssstyleselector.h:
+ * khtml/dom/css_rule.h:
+
2002-10-21 Darin Adler <darin at apple.com>
Remove closeEntireTree now that deferred close takes care of that case.
diff --git a/WebCore/khtml/css/css_ruleimpl.cpp b/WebCore/khtml/css/css_ruleimpl.cpp
index 40ec883..2abb8e8 100644
--- a/WebCore/khtml/css/css_ruleimpl.cpp
+++ b/WebCore/khtml/css/css_ruleimpl.cpp
@@ -217,6 +217,70 @@ void CSSImportRuleImpl::init()
// --------------------------------------------------------------------------
+CSSQuirksRuleImpl::CSSQuirksRuleImpl(StyleBaseImpl *parent)
+ : CSSRuleImpl( parent )
+{
+ m_type = CSSRule::QUIRKS_RULE;
+ m_lstCSSRules = new CSSRuleListImpl();
+ m_lstCSSRules->ref();
+}
+
+CSSQuirksRuleImpl::CSSQuirksRuleImpl( StyleBaseImpl *parent, const QChar *&curP,
+ const QChar *endP )
+: CSSRuleImpl( parent )
+{
+ m_type = CSSRule::QUIRKS_RULE;
+ m_lstCSSRules = new CSSRuleListImpl();
+ m_lstCSSRules->ref();
+
+ // Parse CSS data
+ while( curP < endP )
+ {
+// kdDebug( 6080 ) << "Style rule: '" << QString( curP, endP - curP )
+// << "'" << endl;
+ CSSRuleImpl *rule = parseStyleRule( curP, endP );
+ if ( rule ) {
+ rule->ref();
+ appendRule( rule );
+ }
+ if (!curP) break;
+ while( curP < endP && *curP == QChar( ' ' ) )
+ curP++;
+ }
+}
+
+CSSQuirksRuleImpl::~CSSQuirksRuleImpl()
+{
+ m_lstCSSRules->deref();
+}
+
+CSSRuleListImpl *CSSQuirksRuleImpl::cssRules()
+{
+ return m_lstCSSRules;
+}
+
+unsigned long CSSQuirksRuleImpl::appendRule( CSSRuleImpl *rule )
+{
+ return rule ? m_lstCSSRules->insertRule( rule, m_lstCSSRules->length() ) : 0;
+}
+
+unsigned long CSSQuirksRuleImpl::insertRule( const DOMString &rule,
+ unsigned long index )
+{
+ const QChar *curP = rule.unicode();
+ CSSRuleImpl *newRule = parseRule( curP, curP + rule.length() );
+
+ return newRule ? m_lstCSSRules->insertRule( newRule, index ) : 0;
+}
+
+void CSSQuirksRuleImpl::deleteRule( unsigned long index )
+{
+ m_lstCSSRules->deleteRule( index );
+}
+
+// --------------------------------------------------------------------------
+
+
CSSMediaRuleImpl::CSSMediaRuleImpl(StyleBaseImpl *parent)
: CSSRuleImpl( parent )
{
diff --git a/WebCore/khtml/css/css_ruleimpl.h b/WebCore/khtml/css/css_ruleimpl.h
index cecb47a..2f7db6c 100644
--- a/WebCore/khtml/css/css_ruleimpl.h
+++ b/WebCore/khtml/css/css_ruleimpl.h
@@ -123,9 +123,31 @@ protected:
bool m_loading;
};
+class CSSRuleList;
+
+class CSSQuirksRuleImpl : public CSSRuleImpl
+{
+public:
+ CSSQuirksRuleImpl( StyleBaseImpl *parent );
+ CSSQuirksRuleImpl( StyleBaseImpl *parent, const QChar *&curP,
+ const QChar * endP );
+
+ virtual ~CSSQuirksRuleImpl();
+
+ CSSRuleListImpl *cssRules();
+ unsigned long insertRule ( const DOM::DOMString &rule, unsigned long index );
+ void deleteRule ( unsigned long index );
+
+ virtual bool isQuirksRule() { return true; }
+
+protected:
+ CSSRuleListImpl *m_lstCSSRules;
+
+ /* Not part of the DOM */
+ unsigned long appendRule( CSSRuleImpl *rule );
+};
class MediaList;
-class CSSRuleList;
class CSSMediaRuleImpl : public CSSRuleImpl
{
diff --git a/WebCore/khtml/css/cssparser.cpp b/WebCore/khtml/css/cssparser.cpp
index 29f7e11..01576b7 100644
--- a/WebCore/khtml/css/cssparser.cpp
+++ b/WebCore/khtml/css/cssparser.cpp
@@ -276,6 +276,17 @@ StyleBaseImpl::parseAtRule(const QChar *&curP, const QChar *endP)
kdDebug( 6080 ) << "font rule = " << QString(startP, curP - startP) << endl;
#endif
}
+ else if (rule == "konq-quirks") {
+ startP = curP++;
+ curP = parseToChar(startP, endP, '{', false);
+ curP++;
+ startP = curP;
+ if (curP >= endP) return 0;
+ curP = parseToChar(curP, endP, '}', false);
+ if (!curP || startP >= curP)
+ return 0;
+ return new CSSQuirksRuleImpl(this, startP, curP);
+ }
else if(rule == "media")
{
startP = curP++;
diff --git a/WebCore/khtml/css/cssparser.h b/WebCore/khtml/css/cssparser.h
index 24fb714..d0d05c4 100644
--- a/WebCore/khtml/css/cssparser.h
+++ b/WebCore/khtml/css/cssparser.h
@@ -133,6 +133,7 @@ public:
virtual bool isCharetRule() { return false; }
virtual bool isImportRule() { return false; }
virtual bool isMediaRule() { return false; }
+ virtual bool isQuirksRule() { return false; }
virtual bool isFontFaceRule() { return false; }
virtual bool isPageRule() { return false; }
virtual bool isUnknownRule() { return false; }
diff --git a/WebCore/khtml/css/cssstyleselector.cpp b/WebCore/khtml/css/cssstyleselector.cpp
index d8e805a..20490da 100644
--- a/WebCore/khtml/css/cssstyleselector.cpp
+++ b/WebCore/khtml/css/cssstyleselector.cpp
@@ -68,6 +68,7 @@ using namespace DOM;
namespace khtml {
CSSStyleSelectorList *CSSStyleSelector::defaultStyle = 0;
+CSSStyleSelectorList *CSSStyleSelector::defaultQuirksStyle = 0;
CSSStyleSelectorList *CSSStyleSelector::defaultPrintStyle = 0;
CSSStyleSheetImpl *CSSStyleSelector::defaultSheet = 0;
RenderStyle* CSSStyleSelector::displayNoneStyle = 0;
@@ -98,13 +99,13 @@ CSSStyleSelector::CSSStyleSelector( DocumentImpl* doc, QString userStyleSheet, S
if(paintDeviceMetrics) // this may be null, not everyone uses khtmlview (Niko)
computeFontSizes(paintDeviceMetrics, view ? view->part()->zoomFactor() : 100);
-
+
if ( !userStyleSheet.isEmpty() ) {
userSheet = new DOM::CSSStyleSheetImpl(doc);
userSheet->parseString( DOMString( userStyleSheet ) );
userStyle = new CSSStyleSelectorList();
- userStyle->append( userSheet, m_medium );
+ userStyle->append( userSheet, m_medium, strictParsing );
}
// add stylesheets from document
@@ -115,7 +116,7 @@ CSSStyleSelector::CSSStyleSelector( DocumentImpl* doc, QString userStyleSheet, S
for ( ; it.current(); ++it ) {
if ( it.current()->isCSSStyleSheet() ) {
authorStyle->append( static_cast<CSSStyleSheetImpl*>( it.current() ),
- m_medium );
+ m_medium, strictParsing );
}
}
@@ -149,7 +150,7 @@ CSSStyleSelector::CSSStyleSelector( CSSStyleSheetImpl *sheet )
m_medium = sheet->doc()->view()->mediaType();
authorStyle = new CSSStyleSelectorList();
- authorStyle->append( sheet, m_medium );
+ authorStyle->append( sheet, m_medium, strictParsing );
}
void CSSStyleSelector::init()
@@ -176,7 +177,7 @@ CSSStyleSelector::~CSSStyleSelector()
void CSSStyleSelector::addSheet( CSSStyleSheetImpl *sheet )
{
m_medium = sheet->doc()->view()->mediaType();
- authorStyle->append( sheet, m_medium );
+ authorStyle->append( sheet, m_medium, strictParsing );
}
void CSSStyleSelector::loadDefaultStyle(const KHTMLSettings *s)
@@ -200,9 +201,14 @@ void CSSStyleSelector::loadDefaultStyle(const KHTMLSettings *s)
defaultSheet = new DOM::CSSStyleSheetImpl((DOM::CSSStyleSheetImpl * ) 0);
defaultSheet->parseString( str );
+ // Collect only strict-mode rules.
defaultStyle = new CSSStyleSelectorList();
- defaultStyle->append( defaultSheet );
+ defaultStyle->append( defaultSheet, "screen", 1 );
+ // Collect only quirks-mode rules.
+ defaultQuirksStyle = new CSSStyleSelectorList();
+ defaultQuirksStyle->append( defaultSheet, "screen", 2 );
+
defaultPrintStyle = new CSSStyleSelectorList();
defaultPrintStyle->append( defaultSheet, "print" );
//kdDebug() << "CSSStyleSelector: default style has " << defaultStyle->count() << " elements"<< endl;
@@ -211,10 +217,12 @@ void CSSStyleSelector::loadDefaultStyle(const KHTMLSettings *s)
void CSSStyleSelector::clear()
{
delete defaultStyle;
+ delete defaultQuirksStyle;
delete defaultPrintStyle;
delete defaultSheet;
delete displayNoneStyle;
defaultStyle = 0;
+ defaultQuirksStyle = 0;
defaultPrintStyle = 0;
defaultSheet = 0;
displayNoneStyle = 0;
@@ -842,6 +850,10 @@ void CSSStyleSelector::buildLists()
Default );
else if(defaultStyle) defaultStyle->collect( &selectorList, &propertyList,
Default, Default );
+
+ if (!strictParsing && defaultQuirksStyle)
+ defaultQuirksStyle->collect( &selectorList, &propertyList, Default, Default );
+
if(userStyle) userStyle->collect(&selectorList, &propertyList, User, UserImportant );
if(authorStyle) authorStyle->collect(&selectorList, &propertyList, Author, AuthorImportant );
@@ -961,7 +973,8 @@ CSSStyleSelectorList::~CSSStyleSelectorList()
}
void CSSStyleSelectorList::append( CSSStyleSheetImpl *sheet,
- const DOMString &medium )
+ const DOMString &medium,
+ int quirksMode )
{
if(!sheet || !sheet->isCSSStyleSheet()) return;
@@ -975,7 +988,7 @@ void CSSStyleSelectorList::append( CSSStyleSheetImpl *sheet,
for(int i = 0; i< len; i++)
{
StyleBaseImpl *item = sheet->item(i);
- if(item->isStyleRule())
+ if(item->isStyleRule() && quirksMode != 2)
{
CSSStyleRuleImpl *r = static_cast<CSSStyleRuleImpl *>(item);
QPtrList<CSSSelector> *s = r->selector();
@@ -999,6 +1012,31 @@ void CSSStyleSelectorList::append( CSSStyleSheetImpl *sheet,
append( importedSheet, medium );
}
}
+ else if (item->isQuirksRule() && quirksMode != 1) {
+ CSSQuirksRuleImpl *r = static_cast<CSSQuirksRuleImpl *>( item );
+ CSSRuleListImpl *rules = r->cssRules();
+
+ for( unsigned j = 0; j < rules->length(); j++ )
+ {
+ //kdDebug( 6080 ) << "*** Rule #" << j << endl;
+
+ CSSRuleImpl *childItem = rules->item( j );
+ if( childItem->isStyleRule() )
+ {
+ // It is a StyleRule, so append it to our list
+ CSSStyleRuleImpl *styleRule =
+ static_cast<CSSStyleRuleImpl *>( childItem );
+
+ QPtrList<CSSSelector> *s = styleRule->selector();
+ for( int j = 0; j < ( int ) s->count(); j++ )
+ {
+ CSSOrderedRule *orderedRule = new CSSOrderedRule(
+ styleRule, s->at( j ), count() );
+ QPtrList<CSSOrderedRule>::append( orderedRule );
+ }
+ }
+ } // for rules
+ }
else if( item->isMediaRule() )
{
CSSMediaRuleImpl *r = static_cast<CSSMediaRuleImpl *>( item );
diff --git a/WebCore/khtml/css/cssstyleselector.h b/WebCore/khtml/css/cssstyleselector.h
index 533d335..b72b140 100644
--- a/WebCore/khtml/css/cssstyleselector.h
+++ b/WebCore/khtml/css/cssstyleselector.h
@@ -159,6 +159,7 @@ namespace khtml
static DOM::CSSStyleSheetImpl *defaultSheet;
static CSSStyleSelectorList *defaultStyle;
+ static CSSStyleSelectorList *defaultQuirksStyle;
static CSSStyleSelectorList *defaultPrintStyle;
CSSStyleSelectorList *authorStyle;
CSSStyleSelectorList *userStyle;
@@ -296,7 +297,8 @@ namespace khtml
virtual ~CSSStyleSelectorList();
void append( DOM::CSSStyleSheetImpl *sheet,
- const DOM::DOMString &medium = "screen" );
+ const DOM::DOMString &medium = "screen",
+ int quirksMode = 0 );
void collect( QPtrList<DOM::CSSSelector> *selectorList, CSSOrderedPropertyList *propList,
Source regular, Source important );
diff --git a/WebCore/khtml/dom/css_rule.h b/WebCore/khtml/dom/css_rule.h
index d550240..6d05802 100644
--- a/WebCore/khtml/dom/css_rule.h
+++ b/WebCore/khtml/dom/css_rule.h
@@ -71,7 +71,8 @@ public:
IMPORT_RULE = 3,
MEDIA_RULE = 4,
FONT_FACE_RULE = 5,
- PAGE_RULE = 6
+ PAGE_RULE = 6,
+ QUIRKS_RULE = 100 // Not part of the official DOM
};
/**
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list