[SCM] WebKit Debian packaging branch, debian/experimental, updated. debian/1.3.8-1-1049-g2e11a8e

simon.fraser at apple.com simon.fraser at apple.com
Fri Jan 21 15:13:02 UTC 2011


The following commit has been merged in the debian/experimental branch:
commit 5b0a15fef122c3d163eb2e34b13253e38202ffea
Author: simon.fraser at apple.com <simon.fraser at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Sun Jan 9 17:13:06 2011 +0000

    2011-01-08  Simon Fraser  <simon.fraser at apple.com>
    
            Reviewed by Alexey Proskuryakov.
    
            HTMLStyleElement.disabled doesn't work (affects jQuery)
            https://bugs.webkit.org/show_bug.cgi?id=25287
    
            Fix the disabled property of a HTMLStyleElement to reflect,
            and set the disabled state of its style sheet, as required
            by DOM1 etc.
    
            Based on initial patch by Tarun Nainani.
    
            Test: fast/html/disable-style-element.html
    
            * dom/StyleElement.h:
            (WebCore::StyleElement::sheet): Make const.
    
            * html/HTMLStyleElement.h:
            * html/HTMLStyleElement.idl:
            * html/HTMLStyleElement.cpp:
            (WebCore::HTMLStyleElement::disabled):
            (WebCore::HTMLStyleElement::setDisabled): Getter and setter for disabled
            call through to the sheet (if any).
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@75352 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index ee7d5a5..129bc70 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,18 @@
+2011-01-08  Simon Fraser  <simon.fraser at apple.com>
+
+        Reviewed by Alexey Proskuryakov.
+
+        HTMLStyleElement.disabled doesn't work (affects jQuery)
+        https://bugs.webkit.org/show_bug.cgi?id=25287
+
+        Test the disabled property of a style element.
+        
+        Based on initial patch by Tarun Nainani.
+
+        * fast/html/disable-style-element-expected.txt: Added.
+        * fast/html/disable-style-element.html: Added.
+        * fast/html/script-tests/disable-style-element.js: Added.
+
 2011-01-09  Dirk Schulze  <krit at webkit.org>
 
         Reviewed by Nikolas Zimmermann.
diff --git a/LayoutTests/fast/html/disable-style-element-expected.txt b/LayoutTests/fast/html/disable-style-element-expected.txt
new file mode 100644
index 0000000..a982b0a
--- /dev/null
+++ b/LayoutTests/fast/html/disable-style-element-expected.txt
@@ -0,0 +1,21 @@
+Test the disabled property on a style element.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS styleElement.disabled is false
+PASS window.getComputedStyle(testElement).color is "rgb(0, 128, 0)"
+PASS styleElement.disabled is true
+PASS window.getComputedStyle(testElement).color is "rgb(255, 0, 0)"
+PASS styleElement.sheet.disabled is true
+PASS styleElement.sheet.disabled is false
+PASS styleElement.disabled is false
+PASS window.getComputedStyle(testElement).color is "rgb(0, 128, 0)"
+PASS newStyleElement.disabled is false
+PASS newStyleElement.disabled is false
+PASS otherStyle.disabled is false
+PASS otherStyle.disabled is false
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/html/disable-style-element.html b/LayoutTests/fast/html/disable-style-element.html
new file mode 100644
index 0000000..fe84e88
--- /dev/null
+++ b/LayoutTests/fast/html/disable-style-element.html
@@ -0,0 +1,25 @@
+<!DOCTYPE html>
+<html>
+<head>
+<link rel="stylesheet" href="../../fast/js/resources/js-test-style.css">
+<script src="../../fast/js/resources/js-test-pre.js"></script>
+<style>
+.test {
+  color: red;
+}
+</style>
+<style id="non-css" type="foo/bar"></style>
+<style id="s">
+.test {
+  color: green;
+}
+</style>
+</head>
+<body>
+
+<p id="description"></p>
+<div id="console"></div>
+<script src="script-tests/disable-style-element.js"></script>
+<script src="../../fast/js/resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/fast/html/script-tests/disable-style-element.js b/LayoutTests/fast/html/script-tests/disable-style-element.js
new file mode 100644
index 0000000..218967c
--- /dev/null
+++ b/LayoutTests/fast/html/script-tests/disable-style-element.js
@@ -0,0 +1,39 @@
+description('Test the disabled property on a style element.');
+
+var styleElement = document.getElementById('s');
+var console = document.getElementById('console');
+var testElement = document.createElement('div');
+testElement.innerText = "Test element";
+testElement.className = 'test';
+document.body.appendChild(testElement);
+
+shouldBeFalse('styleElement.disabled');
+shouldBe('window.getComputedStyle(testElement).color', '"rgb(0, 128, 0)"');
+
+styleElement.disabled = true
+shouldBeTrue('styleElement.disabled');
+shouldBe('window.getComputedStyle(testElement).color', '"rgb(255, 0, 0)"');
+
+// Test reflection in the sheet.
+shouldBeTrue('styleElement.sheet.disabled');
+styleElement.sheet.disabled = false
+shouldBeFalse('styleElement.sheet.disabled');
+shouldBeFalse('styleElement.disabled');
+shouldBe('window.getComputedStyle(testElement).color', '"rgb(0, 128, 0)"');
+
+// Test disconnected element
+var newStyleElement = document.createElement('style');
+shouldBeFalse('newStyleElement.disabled');
+newStyleElement.disabled = true
+shouldBeFalse('newStyleElement.disabled');
+
+// Test non-CSS element
+var otherStyle = document.getElementById('non-css');
+shouldBeFalse('otherStyle.disabled');
+otherStyle.disabled = true
+shouldBeFalse('otherStyle.disabled');
+
+
+document.body.removeChild(testElement);
+
+successfullyParsed = true;
diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index 5e5d7e5..7dd0c7d 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,28 @@
+2011-01-08  Simon Fraser  <simon.fraser at apple.com>
+
+        Reviewed by Alexey Proskuryakov.
+
+        HTMLStyleElement.disabled doesn't work (affects jQuery)
+        https://bugs.webkit.org/show_bug.cgi?id=25287
+        
+        Fix the disabled property of a HTMLStyleElement to reflect,
+        and set the disabled state of its style sheet, as required
+        by DOM1 etc.
+
+        Based on initial patch by Tarun Nainani.
+
+        Test: fast/html/disable-style-element.html
+
+        * dom/StyleElement.h:
+        (WebCore::StyleElement::sheet): Make const.
+        
+        * html/HTMLStyleElement.h:
+        * html/HTMLStyleElement.idl:
+        * html/HTMLStyleElement.cpp:
+        (WebCore::HTMLStyleElement::disabled): 
+        (WebCore::HTMLStyleElement::setDisabled): Getter and setter for disabled
+        call through to the sheet (if any).
+
 2011-01-09  Dirk Schulze  <krit at webkit.org>
 
         Reviewed by Nikolas Zimmermann.
diff --git a/Source/WebCore/dom/StyleElement.h b/Source/WebCore/dom/StyleElement.h
index 05c07c5..4356c17 100644
--- a/Source/WebCore/dom/StyleElement.h
+++ b/Source/WebCore/dom/StyleElement.h
@@ -37,7 +37,7 @@ protected:
     virtual const AtomicString& type() const = 0;
     virtual const AtomicString& media() const = 0;
 
-    StyleSheet* sheet() { return m_sheet.get(); }
+    StyleSheet* sheet() const { return m_sheet.get(); }
 
     bool isLoading() const;
     bool sheetLoaded(Document*);
diff --git a/Source/WebCore/html/HTMLStyleElement.cpp b/Source/WebCore/html/HTMLStyleElement.cpp
index 7c2512b..0f256e1 100644
--- a/Source/WebCore/html/HTMLStyleElement.cpp
+++ b/Source/WebCore/html/HTMLStyleElement.cpp
@@ -27,8 +27,9 @@
 #include "Attribute.h"
 #include "Document.h"
 #include "HTMLNames.h"
-#include "ScriptableDocumentParser.h"
 #include "ScriptEventListener.h"
+#include "ScriptableDocumentParser.h"
+
 
 namespace WebCore {
 
@@ -104,4 +105,19 @@ void HTMLStyleElement::addSubresourceAttributeURLs(ListHashSet<KURL>& urls) cons
         styleSheet->addSubresourceStyleURLs(urls);
 }
 
+bool HTMLStyleElement::disabled() const
+{
+    StyleSheet* styleSheet = sheet();
+    if (!styleSheet)
+        return false;
+
+    return styleSheet->disabled();
+}
+
+void HTMLStyleElement::setDisabled(bool setDisabled)
+{
+    if (StyleSheet* styleSheet = sheet())
+        styleSheet->setDisabled(setDisabled);
+}
+
 }
diff --git a/Source/WebCore/html/HTMLStyleElement.h b/Source/WebCore/html/HTMLStyleElement.h
index 3d6958f..c9b5649 100644
--- a/Source/WebCore/html/HTMLStyleElement.h
+++ b/Source/WebCore/html/HTMLStyleElement.h
@@ -39,6 +39,9 @@ public:
 
     using StyleElement::sheet;
 
+    bool disabled() const;
+    void setDisabled(bool);
+
 private:
     HTMLStyleElement(const QualifiedName&, Document*, bool createdByParser);
 
diff --git a/Source/WebCore/html/HTMLStyleElement.idl b/Source/WebCore/html/HTMLStyleElement.idl
index d78e9d3..459801e 100644
--- a/Source/WebCore/html/HTMLStyleElement.idl
+++ b/Source/WebCore/html/HTMLStyleElement.idl
@@ -21,7 +21,7 @@
 module html {
 
     interface [CustomMarkFunction] HTMLStyleElement : HTMLElement {
-        attribute [Reflect] boolean disabled;
+        attribute boolean disabled;
         attribute [Reflect] DOMString media;
         attribute [Reflect] DOMString type;
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list