Created attachment 281896 [details] [TEST] Reduction Test Page Summary: CSSComputedStyleDeclaration::length should recalculate styles if needed to provide the correct value. JavaScript access to the ComputedStyleDeclaration should always have the most accurate data. That should include accessing the length. Right now the length is out of date until a style recalculation or forced layout (such as accessing an item / propertyValue in the computed style). Test: <body> <script> var computedStyle = window.getComputedStyle(document.body); var defaultLength = computedStyle.length; document.documentElement.style.setProperty('--default-color', '#c80'); var newLength = computedStyle.length; document.body.offsetTop; var finalLength = computedStyle.length; console.log("default", defaultLength); console.log("new - with computed property", newLength); console.log("final - after forced layout", finalLength); </script> Results: Expect "new" and "final" to be equal, and both be 1 greater than "default". Safari: (bad) default – 331 new - with computed property – 331 final - after forced layout – 332 Firefox: (expected) default 263 new - with computed property 264 final - after forced layout 264 Chrome: Doesn't appear to include computed properties in Computed Style at all.
<rdar://problem/26638119>
Created attachment 281897 [details] [PATCH] Proposed Fix
Comment on attachment 281897 [details] [PATCH] Proposed Fix View in context: https://bugs.webkit.org/attachment.cgi?id=281897&action=review > LayoutTests/fast/css/variables/custom-property-computed-style-length-update-expected.html:2 > +<head> Err, I should clean up the test...
Created attachment 281898 [details] [PATCH] Proposed Fix
Comment on attachment 281898 [details] [PATCH] Proposed Fix View in context: https://bugs.webkit.org/attachment.cgi?id=281898&action=review > LayoutTests/fast/css/variables/custom-property-computed-style-length-update.html:12 > +document.write(success ? "PASS" : "FAIL"); This should be a dumpAsText(). There's no point using a ref test (two snapshots and hashing) for this.
Created attachment 281918 [details] [PATCH] For Landing
Comment on attachment 281918 [details] [PATCH] For Landing Clearing flags on attachment: 281918 Committed r202382: <http://trac.webkit.org/changeset/202382>