haikuwebkit/LayoutTests/fast/css/style-resolver-cache-direct...

44 lines
1.5 KiB
HTML
Raw Permalink Normal View History

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. Canonical link: https://commits.webkit.org/154879@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@173906 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2014-09-24 03:17:44 +00:00
<!doctype html>
<html>
<head>
<style>
.default {
background-color: lime;
margin: 5px;
}
.ltr {
direction: ltr;
background-color: lime;
margin: 5px;
}
.rtl {
direction: rtl;
background-color: lime;
margin: 5px;
}
</style>
</head>
<body>
<p>This test the style is not copied from the wrong source when the direction is defined.</p>
<!-- The inline style strings must be strictly equal. Each tested div must also match the exact same set of rules. -->
<div class="ltr">
<div style="height: 25px; width: 50px; background-color: red; -webkit-margin-start: 200px; -moz-margin-start: 200px;"></div>
<div>
<div style="height: 25px; width: 50px; background-color: red; -webkit-margin-start: 200px; -moz-margin-start: 200px;"></div>
</div>
</div>
<div class="rtl">
<div style="height: 25px; width: 50px; background-color: red; -webkit-margin-start: 200px; -moz-margin-start: 200px;"></div>
<div>
<div style="height: 25px; width: 50px; background-color: red; -webkit-margin-start: 200px; -moz-margin-start: 200px;"></div>
</div>
</div>
<div class="default">
<div style="height: 25px; width: 50px; background-color: red; -webkit-margin-start: 200px; -moz-margin-start: 200px;"></div>
<div>
<div style="height: 25px; width: 50px; background-color: red; -webkit-margin-start: 200px; -moz-margin-start: 200px;"></div>
</div>
</div>
</body>
</html>