Title: [112099] trunk
Revision
112099
Author
[email protected]
Date
2012-03-26 08:16:38 -0700 (Mon, 26 Mar 2012)

Log Message

[CSS Regions] In region styling (@-webkit-region) the position for CSS rules is incorrectly computed
https://bugs.webkit.org/show_bug.cgi?id=81901

Patch by Mihai Balan <[email protected]> on 2012-03-26
Reviewed by Antti Koivisto.

Source/WebCore:

Right now CSS rules position does not take into account rules that are inside a @-webkit-region
declaration, leading to buggy behavior where rules that appear later in the document are superseded
by rules that appear earlier in the document (opposite as how things should be). The fix updates
the "global" rules counter once the rules in a @-webkit-region declaration have been added.

Tests: fast/regions/region-style-rule-position-expected.html
       fast/regions/region-style-rule-position.html

* css/CSSStyleSelector.cpp:
(WebCore::CSSStyleSelector::collectMatchingRulesForList):

LayoutTests:

Ref tests for bug #81901. Testing that CSS rules position is properly computed when having multiple
@-webkit-region declarations.

* fast/regions/region-style-rule-position-expected.html: Added.
* fast/regions/region-style-rule-position.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (112098 => 112099)


--- trunk/LayoutTests/ChangeLog	2012-03-26 15:14:57 UTC (rev 112098)
+++ trunk/LayoutTests/ChangeLog	2012-03-26 15:16:38 UTC (rev 112099)
@@ -1,3 +1,16 @@
+2012-03-26  Mihai Balan  <[email protected]>
+
+        [CSS Regions] In region styling (@-webkit-region) the position for CSS rules is incorrectly computed
+        https://bugs.webkit.org/show_bug.cgi?id=81901
+
+        Reviewed by Antti Koivisto.
+
+        Ref tests for bug #81901. Testing that CSS rules position is properly computed when having multiple
+        @-webkit-region declarations.
+
+        * fast/regions/region-style-rule-position-expected.html: Added.
+        * fast/regions/region-style-rule-position.html: Added.
+
 2012-03-26  Csaba Osztrogonác  <[email protected]>
 
         [Qt] Unreviewed gardening. Remove tests, because the original change was rolled out.

Added: trunk/LayoutTests/fast/regions/region-style-rule-position-expected.html (0 => 112099)


--- trunk/LayoutTests/fast/regions/region-style-rule-position-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/regions/region-style-rule-position-expected.html	2012-03-26 15:16:38 UTC (rev 112099)
@@ -0,0 +1,26 @@
+<!doctype html>
+<html>
+	<head>
+		<style>
+		p {
+			margin: 0;
+		}
+		.lime {
+			background-color: lime;
+		}
+		.content {
+			margin-top: 1em;
+			width: 10em;
+			height: 10em;
+			background-color: lightgray;
+		}
+		</style>
+	</head>
+	<body>
+		<p class='lime'>Text that is not flowed - should be green</p>
+		<div class='content'>
+			<p class='lime'>Paragraph that *is* flowed - should be green, too</p>
+			<p class='lime'>Paragraph that *is* flowed - should be green, too</p>
+		</div>
+	</body>
+</html>
\ No newline at end of file

Added: trunk/LayoutTests/fast/regions/region-style-rule-position.html (0 => 112099)


--- trunk/LayoutTests/fast/regions/region-style-rule-position.html	                        (rev 0)
+++ trunk/LayoutTests/fast/regions/region-style-rule-position.html	2012-03-26 15:16:38 UTC (rev 112099)
@@ -0,0 +1,53 @@
+<!doctype html>
+<html>
+	<head>
+		<style>
+		p {
+			margin: 0;
+		}
+		p.body {
+			background-color: red;
+		}
+		p.body {
+			background-color: lime;
+		}
+
+		.content {
+			-webkit-flow-into: f;
+		}
+		#r {
+			-webkit-flow-from: f;
+			margin-top: 1em;
+			width: 10em;
+			height: 10em;
+			background-color: lightgray;
+		}
+
+		@-webkit-region #r {
+			* {
+				background-color: blue;
+			}
+			p.region, #para {
+				background-color: red;
+			}
+			#para {
+				background-color: red;
+			}
+		}
+		@-webkit-region #r {
+			p.region, #para {
+				background-color: lime;
+			}
+		}
+		</style>
+	</head>
+	<body>
+		<p class='body'>Text that is not flowed - should be green</p>
+		<div class='content'>
+			<p class='region'>Paragraph that *is* flowed - should be green, too</p>
+			<p id='para'>Paragraph that *is* flowed - should be green, too</p>
+		</div>
+
+		<div id='r'/></div>
+	</body>
+</html>
\ No newline at end of file

Modified: trunk/Source/WebCore/ChangeLog (112098 => 112099)


--- trunk/Source/WebCore/ChangeLog	2012-03-26 15:14:57 UTC (rev 112098)
+++ trunk/Source/WebCore/ChangeLog	2012-03-26 15:16:38 UTC (rev 112099)
@@ -1,3 +1,21 @@
+2012-03-26  Mihai Balan  <[email protected]>
+
+        [CSS Regions] In region styling (@-webkit-region) the position for CSS rules is incorrectly computed
+        https://bugs.webkit.org/show_bug.cgi?id=81901
+
+        Reviewed by Antti Koivisto.
+
+        Right now CSS rules position does not take into account rules that are inside a @-webkit-region
+        declaration, leading to buggy behavior where rules that appear later in the document are superseded
+        by rules that appear earlier in the document (opposite as how things should be). The fix updates
+        the "global" rules counter once the rules in a @-webkit-region declaration have been added.
+
+        Tests: fast/regions/region-style-rule-position-expected.html
+               fast/regions/region-style-rule-position.html
+
+        * css/CSSStyleSelector.cpp:
+        (WebCore::CSSStyleSelector::collectMatchingRulesForList):
+
 2012-03-26  Pierre Rossi  <[email protected]>
 
         [Qt] Disable focus ring in the mobile theme.

Modified: trunk/Source/WebCore/css/CSSStyleSelector.cpp (112098 => 112099)


--- trunk/Source/WebCore/css/CSSStyleSelector.cpp	2012-03-26 15:14:57 UTC (rev 112098)
+++ trunk/Source/WebCore/css/CSSStyleSelector.cpp	2012-03-26 15:16:38 UTC (rev 112099)
@@ -2437,6 +2437,8 @@
         if (regionStylingRule->isStyleRule())
             regionRuleSet->addStyleRule(static_cast<CSSStyleRule*>(regionStylingRule)->styleRule(), true, true);
     }
+    // Update the "global" rule count so that proper order is maintained
+    m_ruleCount = regionRuleSet->m_ruleCount;
 
     m_regionSelectorsAndRuleSets.append(RuleSetSelectorPair(regionRule->selectorList().first(), regionRuleSet));
 }
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to