[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.19-706-ge5415e9

adele at apple.com adele at apple.com
Thu Feb 4 21:28:34 UTC 2010


The following commit has been merged in the webkit-1.1 branch:
commit 8843d8006e18c17104a034f7aec2073c00bec3ee
Author: adele at apple.com <adele at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Jan 27 01:35:51 2010 +0000

    WebCore: Fix for <rdar://problem/7169464> REGRESSION (r47444): PLT is 1% slower due to implementation of :valid and :invalid CSS selectors
    https://bugs.webkit.org/show_bug.cgi?id=34029
    
    Reviewed by Darin Adler.
    
    If we never hit the valid or invalid selectors for a particular document,
    then we'll skip the validity checks when deciding about style sharing.
    
    * css/CSSStyleSelector.cpp:
    (WebCore::CSSStyleSelector::canShareStyleWithElement):
    (WebCore::CSSStyleSelector::SelectorChecker::checkOneSelector):
    
    * dom/Document.cpp: (WebCore::Document::Document):
    * dom/Document.h:
    (WebCore::Document::considerValidity):
    (WebCore::Document::setConsiderValidity):
    
    LayoutTests: Test for <rdar://problem/7169464> REGRESSION (r47444): PLT is 1% slower due to implementation of :valid and :invalid CSS selectors
    https://bugs.webkit.org/show_bug.cgi?id=34029
    
    Reviewed by Darin Adler.
    
    * fast/css/pseudo-valid-dynamic-expected.txt: Added.
    * fast/css/pseudo-valid-dynamic.html: Added.
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@53878 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 35b648b..88eaefb 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,13 @@
+2010-01-26  Adele Peterson  <adele at apple.com>
+
+        Reviewed by Darin Adler.
+
+        Test for <rdar://problem/7169464> REGRESSION (r47444): PLT is 1% slower due to implementation of :valid and :invalid CSS selectors
+        https://bugs.webkit.org/show_bug.cgi?id=34029
+
+        * fast/css/pseudo-valid-dynamic-expected.txt: Added.
+        * fast/css/pseudo-valid-dynamic.html: Added.
+
 2010-01-26  Fumitoshi Ukai  <ukai at chromium.org>
 
         Reviewed by Alexey Proskuryakov.
diff --git a/LayoutTests/fast/css/pseudo-valid-dynamic-expected.txt b/LayoutTests/fast/css/pseudo-valid-dynamic-expected.txt
new file mode 100644
index 0000000..937f25d
--- /dev/null
+++ b/LayoutTests/fast/css/pseudo-valid-dynamic-expected.txt
@@ -0,0 +1,12 @@
+This test checks that input element that share style, no longer share style after validity rules are dynamically added.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+ 
+PASS document.defaultView.getComputedStyle(v[0], null).getPropertyValue('background-color') is 'rgb(0, 255, 0)'
+PASS document.defaultView.getComputedStyle(v[1], null).getPropertyValue('background-color') is 'rgb(0, 0, 255)'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/css/pseudo-valid-dynamic.html b/LayoutTests/fast/css/pseudo-valid-dynamic.html
new file mode 100644
index 0000000..fb0f1d1
--- /dev/null
+++ b/LayoutTests/fast/css/pseudo-valid-dynamic.html
@@ -0,0 +1,32 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="../js/resources/js-test-style.css">
+<script src="../js/resources/js-test-pre.js"></script>
+<style id="sty">
+    input { background: blue; }
+</style>
+</head>
+<body>
+<p id="description"></p>
+<form method="get">
+<input name="victim" type="text"/>
+<input name="victim" type="text" value="Loremipsum" pattern="Lorem ipsum"/>
+</form>
+<div id="console"></div>
+<script>
+description("This test checks that input element that share style, no longer share style after validity rules are dynamically added.");
+
+var s1 = document.getElementById('sty').sheet;
+s1.insertRule(':valid { background: lime; }', s1.cssRules.length);
+
+v = document.getElementsByTagName("input");
+
+shouldBe("document.defaultView.getComputedStyle(v[0], null).getPropertyValue('background-color')", "'rgb(0, 255, 0)'");
+shouldBe("document.defaultView.getComputedStyle(v[1], null).getPropertyValue('background-color')", "'rgb(0, 0, 255)'");
+
+var successfullyParsed = true;
+</script>
+<script src="../js/resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 814c849..12a48f4 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,22 @@
+2010-01-26  Adele Peterson  <adele at apple.com>
+
+        Reviewed by Darin Adler.
+
+        Fix for <rdar://problem/7169464> REGRESSION (r47444): PLT is 1% slower due to implementation of :valid and :invalid CSS selectors
+        https://bugs.webkit.org/show_bug.cgi?id=34029
+
+        If we never hit the valid or invalid selectors for a particular document, 
+        then we'll skip the validity checks when deciding about style sharing.
+
+        * css/CSSStyleSelector.cpp:
+        (WebCore::CSSStyleSelector::canShareStyleWithElement):
+        (WebCore::CSSStyleSelector::SelectorChecker::checkOneSelector):
+        
+        * dom/Document.cpp: (WebCore::Document::Document):
+        * dom/Document.h:
+        (WebCore::Document::considerValidity):
+        (WebCore::Document::setConsiderValidity):
+
 2010-01-26  Jeremy Orlow  <jorlow at chromium.org>
 
         Reviewed by Simon Fraser.
diff --git a/WebCore/css/CSSStyleSelector.cpp b/WebCore/css/CSSStyleSelector.cpp
index d3ea8bb..5054754 100644
--- a/WebCore/css/CSSStyleSelector.cpp
+++ b/WebCore/css/CSSStyleSelector.cpp
@@ -1002,6 +1002,9 @@ bool CSSStyleSelector::canShareStyleWithElement(Node* n)
                 if (s->isDefaultButtonForForm() != m_element->isDefaultButtonForForm())
                     return false;
                 
+                if (!m_element->document()->containsValidityStyleRules())
+                    return false;
+                
                 bool willValidate = s->willValidate();
                 if (willValidate != m_element->willValidate())
                     return false;
@@ -2410,11 +2413,17 @@ bool CSSStyleSelector::SelectorChecker::checkOneSelector(CSSSelector* sel, Eleme
                 return e && e->isOptionalFormControl();
             case CSSSelector::PseudoRequired:
                 return e && e->isRequiredFormControl();
-            case CSSSelector::PseudoValid:
-                return e && e->willValidate() && e->isValidFormControlElement();
-            case CSSSelector::PseudoInvalid:
-                return e && e->willValidate() && !e->isValidFormControlElement();
-            case CSSSelector::PseudoChecked: {
+            case CSSSelector::PseudoValid: {
+                if (!e)
+                    return false;
+                e->document()->setContainsValidityStyleRules();
+                return e->willValidate() && e->isValidFormControlElement();
+            } case CSSSelector::PseudoInvalid: {
+                if (!e)
+                    return false;
+                e->document()->setContainsValidityStyleRules();
+                return e->willValidate() && !e->isValidFormControlElement();
+            } case CSSSelector::PseudoChecked: {
                 if (!e || !e->isFormControlElement())
                     break;
                 // Even though WinIE allows checked and indeterminate to co-exist, the CSS selector spec says that
diff --git a/WebCore/dom/Document.cpp b/WebCore/dom/Document.cpp
index 571210d..ff47099 100644
--- a/WebCore/dom/Document.cpp
+++ b/WebCore/dom/Document.cpp
@@ -354,6 +354,7 @@ Document::Document(Frame* frame, bool isXHTML, bool isHTML)
     , m_styleSheets(StyleSheetList::create(this))
     , m_styleRecalcTimer(this, &Document::styleRecalcTimerFired)
     , m_frameElementsShouldIgnoreScrolling(false)
+    , m_containsValidityStyleRules(false)
     , m_title("")
     , m_rawTitle("")
     , m_titleSetExplicitly(false)
diff --git a/WebCore/dom/Document.h b/WebCore/dom/Document.h
index 265b351..2070aa9 100644
--- a/WebCore/dom/Document.h
+++ b/WebCore/dom/Document.h
@@ -931,6 +931,9 @@ public:
     void resetWMLPageState();
     void initializeWMLPageState();
 #endif
+    
+    bool containsValidityStyleRules() const { return m_containsValidityStyleRules; }
+    void setContainsValidityStyleRules() { m_containsValidityStyleRules = true; }
 
 protected:
     Document(Frame*, bool isXHTML, bool isHTML);
@@ -1070,6 +1073,7 @@ private:
     bool m_isDNSPrefetchEnabled;
     bool m_haveExplicitlyDisabledDNSPrefetch;
     bool m_frameElementsShouldIgnoreScrolling;
+    bool m_containsValidityStyleRules;
 
     String m_title;
     String m_rawTitle;

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list