Title: [124947] branches/safari-536.26-branch

Diff

Modified: branches/safari-536.26-branch/LayoutTests/ChangeLog (124946 => 124947)


--- branches/safari-536.26-branch/LayoutTests/ChangeLog	2012-08-07 23:54:25 UTC (rev 124946)
+++ branches/safari-536.26-branch/LayoutTests/ChangeLog	2012-08-07 23:58:37 UTC (rev 124947)
@@ -1,3 +1,17 @@
+2012-08-07  Lucas Forschler  <[email protected]>
+
+    Merge 124463
+
+    2012-08-02  Antti Koivisto  <[email protected]>
+
+            Inline stylesheets can confuse style sharing
+            https://bugs.webkit.org/show_bug.cgi?id=92970
+
+            Reviewed by Dan Bernstein.
+
+            * fast/css/style-sharing-inline-stylesheet-expected.txt: Added.
+            * fast/css/style-sharing-inline-stylesheet.html: Added.
+
 2012-08-06  Lucas Forschler  <[email protected]>
 
     Merge 118236

Copied: branches/safari-536.26-branch/LayoutTests/fast/css/style-sharing-inline-stylesheet-expected.txt (from rev 124463, trunk/LayoutTests/fast/css/style-sharing-inline-stylesheet-expected.txt) (0 => 124947)


--- branches/safari-536.26-branch/LayoutTests/fast/css/style-sharing-inline-stylesheet-expected.txt	                        (rev 0)
+++ branches/safari-536.26-branch/LayoutTests/fast/css/style-sharing-inline-stylesheet-expected.txt	2012-08-07 23:58:37 UTC (rev 124947)
@@ -0,0 +1,11 @@
+Test that inline stylesheet does not confuse style sharing.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS window.getComputedStyle(document.getElementsByClassName("testclass")[1]).backgroundColor is "rgb(0, 128, 0)"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+first div
+second div

Copied: branches/safari-536.26-branch/LayoutTests/fast/css/style-sharing-inline-stylesheet.html (from rev 124463, trunk/LayoutTests/fast/css/style-sharing-inline-stylesheet.html) (0 => 124947)


--- branches/safari-536.26-branch/LayoutTests/fast/css/style-sharing-inline-stylesheet.html	                        (rev 0)
+++ branches/safari-536.26-branch/LayoutTests/fast/css/style-sharing-inline-stylesheet.html	2012-08-07 23:58:37 UTC (rev 124947)
@@ -0,0 +1,20 @@
+<html lang=en>
+<head>
+<script src=""
+<style>
+.testclass { background-color: red; }
+</style>
+</head>
+<body>
+<div class=testclass>first div</div>
+<style>
+.testclass { background-color: green; }
+</style>
+<div class=testclass>second div</div>
+
+<script>
+description("Test that inline stylesheet does not confuse style sharing.");
+shouldBe('window.getComputedStyle(document.getElementsByClassName("testclass")[1]).backgroundColor','"rgb(0, 128, 0)"');
+</script>
+<script src=""
+</body>

Modified: branches/safari-536.26-branch/Source/WebCore/ChangeLog (124946 => 124947)


--- branches/safari-536.26-branch/Source/WebCore/ChangeLog	2012-08-07 23:54:25 UTC (rev 124946)
+++ branches/safari-536.26-branch/Source/WebCore/ChangeLog	2012-08-07 23:58:37 UTC (rev 124947)
@@ -1,3 +1,32 @@
+2012-08-07  Lucas Forschler  <[email protected]>
+
+    Merge 124463
+
+    2012-08-02  Antti Koivisto  <[email protected]>
+
+            Inline stylesheets can confuse style sharing
+            https://bugs.webkit.org/show_bug.cgi?id=92970
+
+            Reviewed by Dan Bernstein.
+
+            Consider document 
+
+            <div class="i30"></div>
+            <style>.i30 { background-color:green; }</style>
+            <div class="i30"></div>
+
+            When processing the <style> element the scope optimization marks the first div as needing style recalc. 
+            Next the parser adds the second div to the tree and immediately calculates its style. Since it looks exactly 
+            like the first div the style sharing optimization copies the style from there. The pending recalc of the
+            first div is resolved by a timer but the second div is left with the old style.
+
+            Fix by disallowing style sharing from elements with pending style recalc.
+
+            Test: fast/css/style-sharing-inline-stylesheet.html
+
+            * css/StyleResolver.cpp:
+            (WebCore::StyleResolver::canShareStyleWithElement):
+
 2012-08-06  Lucas Forschler  <[email protected]>
 
     Merge 123942

Modified: branches/safari-536.26-branch/Source/WebCore/css/StyleResolver.cpp (124946 => 124947)


--- branches/safari-536.26-branch/Source/WebCore/css/StyleResolver.cpp	2012-08-07 23:54:25 UTC (rev 124946)
+++ branches/safari-536.26-branch/Source/WebCore/css/StyleResolver.cpp	2012-08-07 23:58:37 UTC (rev 124947)
@@ -1313,6 +1313,8 @@
         return false;
     if (element->inlineStyle())
         return false;
+    if (element->needsStyleRecalc())
+        return false;
 #if ENABLE(SVG)
     if (element->isSVGElement() && static_cast<SVGElement*>(element)->animatedSMILStyleProperties())
         return false;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to