[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-10851-g50815da

ap at apple.com ap at apple.com
Wed Dec 22 17:48:06 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit ffc6c12145e6b4296ccfef44cb39adf70a757e14
Author: ap at apple.com <ap at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Nov 30 17:54:26 2010 +0000

            Reviewed by Darin Adler and Geoff Garen.
    
            https://bugs.webkit.org/show_bug.cgi?id=44152
            <rdar://problem/8324423> CSSOM should match DOM in discarding wrapper-less parents.
    
            We have existing behaviors where parent objects in detached subtrees are not preserved:
            - if a root of a node tree doesn't have a wrapper, it's immediately destroyed, making
            its children parentNode attribute null;
            - relationship between a <style> or <link> node and its stylesheet is immediately broken
            when the node is removed from document (in this case, regardless of wrapper existence).
    
            Both match Firefox. For consistency, CSSOM should do the same. In fact, it already partially
            does - CSSRule.parentRule gets zeroed out when the parent rule is destroyed.
    
            Tests: fast/dom/StyleSheet/detached-parent-rule-without-wrapper.html
                   fast/dom/StyleSheet/detached-stylesheet-without-wrapper.html
    
            * css/StyleSheet.cpp: (WebCore::StyleSheet::~StyleSheet): Clear out child rule parent.
    
            * svg/SVGFontFaceElement.cpp: (WebCore::SVGFontFaceElement::insertedIntoDocument): Keep
            the new assertion from firing. This function was adding a rule to style sheet, without
            telling the rule about it.
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@72924 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index c6992c4..e2bdb2f 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,15 @@
+2010-11-30  Alexey Proskuryakov  <ap at apple.com>
+
+        Reviewed by Darin Adler and Geoff Garen.
+
+        https://bugs.webkit.org/show_bug.cgi?id=44152
+        <rdar://problem/8324423> CSSOM should match DOM in discarding wrapper-less parents.
+
+        * fast/dom/StyleSheet/detached-parent-rule-without-wrapper-expected.txt: Added.
+        * fast/dom/StyleSheet/detached-parent-rule-without-wrapper.html: Added.
+        * fast/dom/StyleSheet/detached-stylesheet-without-wrapper-expected.txt: Added.
+        * fast/dom/StyleSheet/detached-stylesheet-without-wrapper.html: Added.
+
 2010-11-30  Ojan Vafai  <ojan at chromium.org>
 
         [chromium] Rebaselines. Details below.
diff --git a/LayoutTests/fast/dom/StyleSheet/detached-parent-rule-without-wrapper-expected.txt b/LayoutTests/fast/dom/StyleSheet/detached-parent-rule-without-wrapper-expected.txt
new file mode 100644
index 0000000..cb261b0
--- /dev/null
+++ b/LayoutTests/fast/dom/StyleSheet/detached-parent-rule-without-wrapper-expected.txt
@@ -0,0 +1,13 @@
+Test that CSS stylesheets lacking wrappers are pruned from detached CSSOM subtrees. This is surprising behavior, but it's a very rare situation, and the behavior actually matches what both WebKit and Gecko do for DOM nodes in detached subtrees.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS getMatchedCSSRules(document.getElementById("test")).length is 1
+Removing <style>...
+PASS rule.parentRule is null
+PASS getMatchedCSSRules(document.getElementById("test")) is null
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/dom/StyleSheet/detached-parent-rule-without-wrapper.html b/LayoutTests/fast/dom/StyleSheet/detached-parent-rule-without-wrapper.html
new file mode 100644
index 0000000..290d071
--- /dev/null
+++ b/LayoutTests/fast/dom/StyleSheet/detached-parent-rule-without-wrapper.html
@@ -0,0 +1,29 @@
+<html>
+<head>
+<style>
+ at media all { #test { color: green; } }
+</style>
+<link rel="stylesheet" href="../../js/resources/js-test-style.css" type="text/css" title="js-test-style">
+<script src="../../js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<div id="test"></div>
+<script>
+description("Test that CSS stylesheets lacking wrappers are pruned from detached CSSOM subtrees. " + 
+"This is surprising behavior, but it's a very rare situation, and the behavior actually matches " +
+"what both WebKit and Gecko do for DOM nodes in detached subtrees.");
+
+shouldBe('getMatchedCSSRules(document.getElementById("test")).length', '1');
+rule = getMatchedCSSRules(document.getElementById("test")).item(0);
+debug("Removing &lt;style>...");
+document.head.removeChild(document.getElementsByTagName("style")[0]);
+shouldBe("rule.parentRule", "null");
+shouldBe('getMatchedCSSRules(document.getElementById("test"))', 'null');
+
+var successfullyParsed = true;
+</script>
+<script src="../../js/resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/fast/dom/StyleSheet/detached-stylesheet-without-wrapper-expected.txt b/LayoutTests/fast/dom/StyleSheet/detached-stylesheet-without-wrapper-expected.txt
new file mode 100644
index 0000000..7b5e7c5
--- /dev/null
+++ b/LayoutTests/fast/dom/StyleSheet/detached-stylesheet-without-wrapper-expected.txt
@@ -0,0 +1,10 @@
+Test that CSS stylesheets lacking wrappers are pruned from detached CSSOM subtrees. This is surprising behavior, but it's a very rare situation, and the behavior actually matches what both WebKit and Gecko do for DOM nodes in detached subtrees.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS rule.parentStyleSheet is null
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/dom/StyleSheet/detached-stylesheet-without-wrapper.html b/LayoutTests/fast/dom/StyleSheet/detached-stylesheet-without-wrapper.html
new file mode 100644
index 0000000..eadb46f
--- /dev/null
+++ b/LayoutTests/fast/dom/StyleSheet/detached-stylesheet-without-wrapper.html
@@ -0,0 +1,22 @@
+<html>
+<head>
+<link rel="stylesheet" href="../../js/resources/js-test-style.css" type="text/css" title="js-test-style">
+<script src="../../js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script>
+description("Test that CSS stylesheets lacking wrappers are pruned from detached CSSOM subtrees. " + 
+"This is surprising behavior, but it's a very rare situation, and the behavior actually matches " +
+"what both WebKit and Gecko do for DOM nodes in detached subtrees.");
+
+rule = getMatchedCSSRules(document.getElementsByTagName("div")[0]).item(0);
+document.documentElement.removeChild(document.head);
+shouldBe("rule.parentStyleSheet", "null");
+
+var successfullyParsed = true;
+</script>
+<script src="../../js/resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 2c8a894..684a48c 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,28 @@
+2010-11-30  Alexey Proskuryakov  <ap at apple.com>
+
+        Reviewed by Darin Adler and Geoff Garen.
+
+        https://bugs.webkit.org/show_bug.cgi?id=44152
+        <rdar://problem/8324423> CSSOM should match DOM in discarding wrapper-less parents.
+
+        We have existing behaviors where parent objects in detached subtrees are not preserved:
+        - if a root of a node tree doesn't have a wrapper, it's immediately destroyed, making
+        its children parentNode attribute null;
+        - relationship between a <style> or <link> node and its stylesheet is immediately broken
+        when the node is removed from document (in this case, regardless of wrapper existence).
+
+        Both match Firefox. For consistency, CSSOM should do the same. In fact, it already partially
+        does - CSSRule.parentRule gets zeroed out when the parent rule is destroyed.
+
+        Tests: fast/dom/StyleSheet/detached-parent-rule-without-wrapper.html
+               fast/dom/StyleSheet/detached-stylesheet-without-wrapper.html
+
+        * css/StyleSheet.cpp: (WebCore::StyleSheet::~StyleSheet): Clear out child rule parent.
+
+        * svg/SVGFontFaceElement.cpp: (WebCore::SVGFontFaceElement::insertedIntoDocument): Keep
+        the new assertion from firing. This function was adding a rule to style sheet, without
+        telling the rule about it.
+
 2010-11-30  Steve Falkenburg  <sfalken at apple.com>
 
         Reviewed by Adam Roben.
diff --git a/WebCore/css/StyleSheet.cpp b/WebCore/css/StyleSheet.cpp
index 0a719d1..68a0772 100644
--- a/WebCore/css/StyleSheet.cpp
+++ b/WebCore/css/StyleSheet.cpp
@@ -56,6 +56,14 @@ StyleSheet::~StyleSheet()
 {
     if (m_media)
         m_media->setParent(0);
+
+    // For style rules outside the document, .parentStyleSheet can become null even if the style rule
+    // is still observable from JavaScript. This matches the behavior of .parentNode for nodes, but
+    // it's not ideal because it makes the CSSOM's behavior depend on the timing of garbage collection.
+    for (unsigned i = 0; i < length(); ++i) {
+        ASSERT(item(i)->parent() == this);
+        item(i)->setParent(0);
+    }
 }
 
 StyleSheet* StyleSheet::parentStyleSheet() const
diff --git a/WebCore/svg/SVGFontFaceElement.cpp b/WebCore/svg/SVGFontFaceElement.cpp
index 0c74d08..515ce04 100644
--- a/WebCore/svg/SVGFontFaceElement.cpp
+++ b/WebCore/svg/SVGFontFaceElement.cpp
@@ -315,6 +315,7 @@ void SVGFontFaceElement::insertedIntoDocument()
 {
     SVGElement::insertedIntoDocument();
     document()->mappedElementSheet()->append(m_fontFaceRule);
+    m_fontFaceRule->setParent(document()->mappedElementSheet());
     rebuildFontFace();
 }
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list