The style resolution cache applies properties incorrectly whenever direction != ltr
https://bugs.webkit.org/show_bug.cgi?id=137052
Patch by Benjamin Poulain <bpoulain@apple.com> on 2014-09-23
Reviewed by Andreas Kling.
Source/WebCore:
The optimization r135021 introduced a bug whenever the direction of subtree is not
uniform in the whole page.
When StyleResolver::applyMatchedProperties() resolves the style, some properties are
resolved differently based on the writing-mode and the direction.
In isCacheableInMatchedPropertiesCache(), the cases for writing-mode are already handled
by not caching any style with anything else than the default.
The direction was ignored, causing the bugs solved here.
Tests: css3/flexbox/flex-flow-2.html
fast/css/style-resolver-cache-direction-1.html
fast/css/style-resolver-cache-direction-2.html
fast/css/style-resolver-cache-direction-3.html
* css/StyleResolver.cpp:
(WebCore::isCacheableInMatchedPropertiesCache):
LayoutTests:
* css3/flexbox/flex-flow-2-expected.txt: Added.
* css3/flexbox/flex-flow-2.html: Added.
The test flex-flow.html should have uncovered the bug. It did not because it uses
:nth-child(), which disable style optimizations.
flex-flow-2.html is a copy of flex-flow.html using classes instead of :nth-child().
This would have caught the bug.
* fast/css/style-resolver-cache-direction-1-expected.html: Added.
* fast/css/style-resolver-cache-direction-1.html: Added.
* fast/css/style-resolver-cache-direction-2-expected.html: Added.
* fast/css/style-resolver-cache-direction-2.html: Added.
* fast/css/style-resolver-cache-direction-3-expected.html: Added.
* fast/css/style-resolver-cache-direction-3.html: Added.
New basic tests for the fix.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@173906 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/fast/css/style-resolver-cache-direction-2-expected.html b/LayoutTests/fast/css/style-resolver-cache-direction-2-expected.html
new file mode 100644
index 0000000..9e54e85
--- /dev/null
+++ b/LayoutTests/fast/css/style-resolver-cache-direction-2-expected.html
@@ -0,0 +1,43 @@
+<!doctype html>
+<html>
+<head>
+<style>
+.root {
+ background-color: lime;
+ margin: 5px;
+}
+.testcase {
+ height: 25px;
+ width: 50px;
+ background-color: red;
+}
+.left {
+ margin-left: 200px;
+}
+.right {
+ margin-left: calc(100% - 250px);
+}
+</style>
+</head>
+<body>
+ <p>This test the style is not copied from the wrong source when the direction is defined.</p>
+ <div class="root">
+ <div class="right testcase"></div>
+ <div>
+ <div class="right testcase"></div>
+ </div>
+ </div>
+ <div class="root">
+ <div class="left testcase"></div>
+ <div>
+ <div class="left testcase"></div>
+ </div>
+ </div>
+ <div class="root">
+ <div class="left testcase"></div>
+ <div>
+ <div class="left testcase"></div>
+ </div>
+ </div>
+</body>
+</html>