Title: [136039] trunk
- Revision
- 136039
- Author
- ach...@adobe.com
- Date
- 2012-11-28 12:05:47 -0800 (Wed, 28 Nov 2012)
Log Message
[CSS Regions] Auto-height regions will not calculate the height correctly when the content changes dynamically
https://bugs.webkit.org/show_bug.cgi?id=102954
Reviewed by David Hyatt.
Source/WebCore:
Whenever the flow changes, we need to reset the region computed auto-heights.
However, when we reset the region heights to "auto" or "un-computed", we also need to make
sure that all the region breaks are counted again, so that we split regions correctly during the new layout.
I've reused the m_regionsInvalidated property to force the flow do a complete layout.
Test: fast/regions/autoheight-dynamic-update.html
* rendering/RenderFlowThread.cpp:
(WebCore::RenderFlowThread::resetRegionsOverrideLogicalContentHeight):
LayoutTests:
Added test to check for auto-height region size update after an element is added to the flow.
In this case the first region will need to resize to accommodate the size of the added elements.
* fast/regions/autoheight-dynamic-update-expected.html: Added.
* fast/regions/autoheight-dynamic-update.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (136038 => 136039)
--- trunk/LayoutTests/ChangeLog 2012-11-28 20:00:19 UTC (rev 136038)
+++ trunk/LayoutTests/ChangeLog 2012-11-28 20:05:47 UTC (rev 136039)
@@ -1,3 +1,16 @@
+2012-11-28 Alexandru Chiculita <ach...@adobe.com>
+
+ [CSS Regions] Auto-height regions will not calculate the height correctly when the content changes dynamically
+ https://bugs.webkit.org/show_bug.cgi?id=102954
+
+ Reviewed by David Hyatt.
+
+ Added test to check for auto-height region size update after an element is added to the flow.
+ In this case the first region will need to resize to accommodate the size of the added elements.
+
+ * fast/regions/autoheight-dynamic-update-expected.html: Added.
+ * fast/regions/autoheight-dynamic-update.html: Added.
+
2012-11-28 Andrew Scherkus <scher...@chromium.org>
[Chromium] Unreviewed. Fixing lint errors introduced in r136030.
Added: trunk/LayoutTests/fast/regions/autoheight-dynamic-update-expected.html (0 => 136039)
--- trunk/LayoutTests/fast/regions/autoheight-dynamic-update-expected.html (rev 0)
+++ trunk/LayoutTests/fast/regions/autoheight-dynamic-update-expected.html 2012-11-28 20:05:47 UTC (rev 136039)
@@ -0,0 +1,36 @@
+<!doctype html>
+<html>
+ <head>
+ <style>
+ .flowContent { font-size: 50px; color: green; font-family: Ahem; }
+ .region {
+ width: 250px;
+ margin-top: 10px;
+ }
+ #p1 {
+ color: green;
+ }
+
+ #p2 {
+ color: blue;
+ }
+ </style>
+ </head>
+ </head>
+ <body _onload_="forceLayout();">
+ <p>Test for <a href="" 102954</a>.</p>
+ <p>Adding #line1 only after the first layout is done. That will force a second layout
+ and the first region needs to resize to accommodate the size of both lines.</p>
+ <p>You should see two boxes. The first box should have twice the height of the second one.
+ The first box should be all green and the second box should be all blue.</p>
+ <div class="region flowContent">
+ <div id="p1">
+ <div id="line1">aaaaa</div>
+ <div id="line2">aaaaa</div>
+ </div>
+ </div>
+ <div class="region flowContent">
+ <div id="p2">aaaaa</div>
+ </div>
+ </body>
+</html>
Added: trunk/LayoutTests/fast/regions/autoheight-dynamic-update.html (0 => 136039)
--- trunk/LayoutTests/fast/regions/autoheight-dynamic-update.html (rev 0)
+++ trunk/LayoutTests/fast/regions/autoheight-dynamic-update.html 2012-11-28 20:05:47 UTC (rev 136039)
@@ -0,0 +1,53 @@
+<!doctype html>
+<html>
+ <head>
+ <style>
+ .flowContent { font-size: 50px; font-family: Ahem; }
+ #article { -webkit-flow-into: flow; }
+
+ #p1 {
+ color: green;
+ }
+
+ #p2 {
+ color: blue;
+ -webkit-region-break-before: always;
+ }
+
+ .region {
+ width: 250px;
+ -webkit-flow-from: flow;
+ margin-top: 10px;
+ }
+
+ #line1 {
+ display: none;
+ }
+ </style>
+ </head>
+ <script>
+ function forceLayout()
+ {
+ document.body.offsetTop; // force a layout;
+ document.getElementById('line1').style.display = "block";
+ }
+ </script>
+ </head>
+ <body _onload_="forceLayout();">
+ <p>Test for <a href="" 102954</a>.</p>
+ <p>Adding #line1 only after the first layout is done. That will force a second layout
+ and the first region needs to resize to accommodate the size of both lines.</p>
+ <p>You should see two boxes. The first box should have twice the height of the second one.
+ The first box should be all green and the second box should be all blue.</p>
+ <div id="article" class="flowContent">
+ <div id="p1">
+ <div id="line1">aaaaa</div>
+ <div id="line2">aaaaa</div>
+ </div>
+ <div id="p2">aaaaa</div>
+ </div>
+
+ <div class="region"></div>
+ <div class="region"></div>
+ </body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (136038 => 136039)
--- trunk/Source/WebCore/ChangeLog 2012-11-28 20:00:19 UTC (rev 136038)
+++ trunk/Source/WebCore/ChangeLog 2012-11-28 20:05:47 UTC (rev 136039)
@@ -1,5 +1,22 @@
2012-11-28 Alexandru Chiculita <ach...@adobe.com>
+ [CSS Regions] Auto-height regions will not calculate the height correctly when the content changes dynamically
+ https://bugs.webkit.org/show_bug.cgi?id=102954
+
+ Reviewed by David Hyatt.
+
+ Whenever the flow changes, we need to reset the region computed auto-heights.
+ However, when we reset the region heights to "auto" or "un-computed", we also need to make
+ sure that all the region breaks are counted again, so that we split regions correctly during the new layout.
+ I've reused the m_regionsInvalidated property to force the flow do a complete layout.
+
+ Test: fast/regions/autoheight-dynamic-update.html
+
+ * rendering/RenderFlowThread.cpp:
+ (WebCore::RenderFlowThread::resetRegionsOverrideLogicalContentHeight):
+
+2012-11-28 Alexandru Chiculita <ach...@adobe.com>
+
[CSS Regions] InRenderFlowThread returns false in the first setStyle
https://bugs.webkit.org/show_bug.cgi?id=102839
Modified: trunk/Source/WebCore/rendering/RenderFlowThread.cpp (136038 => 136039)
--- trunk/Source/WebCore/rendering/RenderFlowThread.cpp 2012-11-28 20:00:19 UTC (rev 136038)
+++ trunk/Source/WebCore/rendering/RenderFlowThread.cpp 2012-11-28 20:05:47 UTC (rev 136039)
@@ -737,7 +737,7 @@
// We need to reset the override logical content height for regions with auto logical height
// only if the flow thread content needs layout.
- if (!selfNeedsLayout())
+ if (!needsLayout())
return;
// FIXME: optimize this to iterate the region chain only if the flow thread has auto logical height
@@ -753,6 +753,9 @@
// as we are already inside layout.
region->setNeedsLayout(true);
}
+ // Make sure we don't skip any region breaks when we do the layout again.
+ // Using m_regionsInvalidated to force all the RenderFlowThread children do the layout again.
+ m_regionsInvalidated = true;
}
void RenderFlowThread::markAutoLogicalHeightRegionsForLayout()
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes