Title: [197300] trunk
- Revision
- 197300
- Author
- [email protected]
- Date
- 2016-02-28 12:42:55 -0800 (Sun, 28 Feb 2016)
Log Message
Variables can resolve to the wrong value when elements differ in nothing but inherited variable value
https://bugs.webkit.org/show_bug.cgi?id=154785
Reviewed by Antti Koivisto.
Source/WebCore:
Test: fast/css/variables/avoid-matched-property-cache.html
* css/StyleResolver.cpp:
(WebCore::StyleResolver::MatchResult::addMatchedProperties):
Disable the matched property cache when a value is variable-dependent, because
they can resolve to inherited values, and the matched property cache could
end up copying the wrong value from another similarly-styled element.
LayoutTests:
* fast/css/variables/avoid-matched-property-cache-expected.html: Added.
* fast/css/variables/avoid-matched-property-cache.html: Added.
Add a test. The non-standard element is necessary because the resolved property
cache is already disabled when using the "simple" default style sheet, and
it seems better to use a totally non-standard element than one that might
end up in the "simple" default style sheet in the future and would silently
invalidate the test.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (197299 => 197300)
--- trunk/LayoutTests/ChangeLog 2016-02-28 20:34:03 UTC (rev 197299)
+++ trunk/LayoutTests/ChangeLog 2016-02-28 20:42:55 UTC (rev 197300)
@@ -1,3 +1,18 @@
+2016-02-28 Tim Horton <[email protected]>
+
+ Variables can resolve to the wrong value when elements differ in nothing but inherited variable value
+ https://bugs.webkit.org/show_bug.cgi?id=154785
+
+ Reviewed by Antti Koivisto.
+
+ * fast/css/variables/avoid-matched-property-cache-expected.html: Added.
+ * fast/css/variables/avoid-matched-property-cache.html: Added.
+ Add a test. The non-standard element is necessary because the resolved property
+ cache is already disabled when using the "simple" default style sheet, and
+ it seems better to use a totally non-standard element than one that might
+ end up in the "simple" default style sheet in the future and would silently
+ invalidate the test.
+
2016-02-28 Skachkov Oleksandr <[email protected]>
[ES6] Arrow function syntax. Emit loading&putting this/super only if they are used in arrow function
Added: trunk/LayoutTests/fast/css/variables/avoid-matched-property-cache-expected.html (0 => 197300)
--- trunk/LayoutTests/fast/css/variables/avoid-matched-property-cache-expected.html (rev 0)
+++ trunk/LayoutTests/fast/css/variables/avoid-matched-property-cache-expected.html 2016-02-28 20:42:55 UTC (rev 197300)
@@ -0,0 +1,10 @@
+<html>
+<style>
+body {
+ margin: 0;
+}
+</style>
+<body>
+<div style="background-color: green; width: 100px; height: 100px;"></div>
+</body>
+</html>
Added: trunk/LayoutTests/fast/css/variables/avoid-matched-property-cache.html (0 => 197300)
--- trunk/LayoutTests/fast/css/variables/avoid-matched-property-cache.html (rev 0)
+++ trunk/LayoutTests/fast/css/variables/avoid-matched-property-cache.html 2016-02-28 20:42:55 UTC (rev 197300)
@@ -0,0 +1,22 @@
+<html>
+<style>
+body {
+ margin: -100px 0 0 0;
+}
+
+.inner {
+ background-color: var(--backgroundColor);
+ height: 100px;
+ width: 100px;
+}
+</style>
+<body>
+<asdfasdf></asdfasdf>
+<div style="--backgroundColor: red;">
+ <div class="inner" id="a"></div>
+</div>
+<div style="--backgroundColor: green;">
+ <div class="inner" id="b"></div>
+</div>
+</body>
+</html>
\ No newline at end of file
Modified: trunk/Source/WebCore/ChangeLog (197299 => 197300)
--- trunk/Source/WebCore/ChangeLog 2016-02-28 20:34:03 UTC (rev 197299)
+++ trunk/Source/WebCore/ChangeLog 2016-02-28 20:42:55 UTC (rev 197300)
@@ -1,3 +1,18 @@
+2016-02-28 Tim Horton <[email protected]>
+
+ Variables can resolve to the wrong value when elements differ in nothing but inherited variable value
+ https://bugs.webkit.org/show_bug.cgi?id=154785
+
+ Reviewed by Antti Koivisto.
+
+ Test: fast/css/variables/avoid-matched-property-cache.html
+
+ * css/StyleResolver.cpp:
+ (WebCore::StyleResolver::MatchResult::addMatchedProperties):
+ Disable the matched property cache when a value is variable-dependent, because
+ they can resolve to inherited values, and the matched property cache could
+ end up copying the wrong value from another similarly-styled element.
+
2016-02-28 Konstantin Tokarev <[email protected]>
SVGToOTFFontConversion.cpp does not compile with libstdc++ 4.8
Modified: trunk/Source/WebCore/css/StyleResolver.cpp (197299 => 197300)
--- trunk/Source/WebCore/css/StyleResolver.cpp 2016-02-28 20:34:03 UTC (rev 197299)
+++ trunk/Source/WebCore/css/StyleResolver.cpp 2016-02-28 20:42:55 UTC (rev 197300)
@@ -225,11 +225,16 @@
}
// The value currentColor has implicitely the same side effect. It depends on the value of color,
- // which is an inherited value, making the non-inherited property implicitely inherited.
+ // which is an inherited value, making the non-inherited property implicitly inherited.
if (is<CSSPrimitiveValue>(value) && downcast<CSSPrimitiveValue>(value).getValueID() == CSSValueCurrentcolor) {
isCacheable = false;
break;
}
+
+ if (value.isVariableDependentValue()) {
+ isCacheable = false;
+ break;
+ }
}
}
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes