Title: [202382] trunk
Revision
202382
Author
[email protected]
Date
2016-06-23 11:43:43 -0700 (Thu, 23 Jun 2016)

Log Message

CSSComputedStyleDeclaration::length should recalculate styles if needed to provide the correct value
https://bugs.webkit.org/show_bug.cgi?id=159053
<rdar://problem/26638119>

Patch by Joseph Pecoraro <[email protected]> on 2016-06-23
Reviewed by Simon Fraser.

Source/WebCore:

Test: fast/css/variables/custom-property-computed-style-length-update.html

* css/CSSComputedStyleDeclaration.cpp:
(WebCore::CSSComputedStyleDeclaration::length):

LayoutTests:

* fast/css/variables/custom-property-computed-style-length-update-expected.txt: Added.
* fast/css/variables/custom-property-computed-style-length-update.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (202381 => 202382)


--- trunk/LayoutTests/ChangeLog	2016-06-23 16:56:48 UTC (rev 202381)
+++ trunk/LayoutTests/ChangeLog	2016-06-23 18:43:43 UTC (rev 202382)
@@ -1,3 +1,14 @@
+2016-06-23  Joseph Pecoraro  <[email protected]>
+
+        CSSComputedStyleDeclaration::length should recalculate styles if needed to provide the correct value
+        https://bugs.webkit.org/show_bug.cgi?id=159053
+        <rdar://problem/26638119>
+
+        Reviewed by Simon Fraser.
+
+        * fast/css/variables/custom-property-computed-style-length-update-expected.txt: Added.
+        * fast/css/variables/custom-property-computed-style-length-update.html: Added.
+
 2016-06-23  Adam Bergkvist  <[email protected]>
 
         WebRTC: Add support for RTCPeerConnection legacy MediaStream-based API

Added: trunk/LayoutTests/fast/css/variables/custom-property-computed-style-length-update-expected.txt (0 => 202382)


--- trunk/LayoutTests/fast/css/variables/custom-property-computed-style-length-update-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/css/variables/custom-property-computed-style-length-update-expected.txt	2016-06-23 18:43:43 UTC (rev 202382)
@@ -0,0 +1,8 @@
+Check that CSSStyleDeclaration.length is accurate after custom property modifications.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS afterAddingComputedPropertyLength > initialLength is true
+PASS afterAddingComputedPropertyLength === afterForcedLayoutLength is true
+

Added: trunk/LayoutTests/fast/css/variables/custom-property-computed-style-length-update.html (0 => 202382)


--- trunk/LayoutTests/fast/css/variables/custom-property-computed-style-length-update.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css/variables/custom-property-computed-style-length-update.html	2016-06-23 18:43:43 UTC (rev 202382)
@@ -0,0 +1,19 @@
+<html>
+<body>
+<script src=""
+<script>
+description("Check that CSSStyleDeclaration.length is accurate after custom property modifications.");
+
+var computedStyle = window.getComputedStyle(document.body);
+var initialLength = computedStyle.length;
+document.documentElement.style.setProperty('--computed', '#abc');
+var afterAddingComputedPropertyLength = computedStyle.length;
+document.body.offsetTop;
+var afterForcedLayoutLength = computedStyle.length;
+
+shouldBeTrue("afterAddingComputedPropertyLength > initialLength");
+shouldBeTrue("afterAddingComputedPropertyLength === afterForcedLayoutLength");
+</script>
+<script src=""
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (202381 => 202382)


--- trunk/Source/WebCore/ChangeLog	2016-06-23 16:56:48 UTC (rev 202381)
+++ trunk/Source/WebCore/ChangeLog	2016-06-23 18:43:43 UTC (rev 202382)
@@ -1,3 +1,16 @@
+2016-06-23  Joseph Pecoraro  <[email protected]>
+
+        CSSComputedStyleDeclaration::length should recalculate styles if needed to provide the correct value
+        https://bugs.webkit.org/show_bug.cgi?id=159053
+        <rdar://problem/26638119>
+
+        Reviewed by Simon Fraser.
+
+        Test: fast/css/variables/custom-property-computed-style-length-update.html
+
+        * css/CSSComputedStyleDeclaration.cpp:
+        (WebCore::CSSComputedStyleDeclaration::length):
+
 2016-06-23  John Wilander  <[email protected]>
 
         Enable window.open() for existing versions of Secret Society

Modified: trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp (202381 => 202382)


--- trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp	2016-06-23 16:56:48 UTC (rev 202381)
+++ trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp	2016-06-23 18:43:43 UTC (rev 202382)
@@ -3948,6 +3948,8 @@
     if (!node)
         return 0;
 
+    updateStyleIfNeededForNode(*node);
+
     auto* style = node->computedStyle(m_pseudoElementSpecifier);
     if (!style)
         return 0;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to