Diff
Modified: trunk/LayoutTests/ChangeLog (121351 => 121352)
--- trunk/LayoutTests/ChangeLog 2012-06-27 18:23:09 UTC (rev 121351)
+++ trunk/LayoutTests/ChangeLog 2012-06-27 18:25:16 UTC (rev 121352)
@@ -1,3 +1,20 @@
+2012-06-27 Andrei Onea <[email protected]>
+
+ [CSSRegions]Change display values that allow regions
+ https://bugs.webkit.org/show_bug.cgi?id=89759
+
+ Reviewed by Tony Chang.
+
+ Added checks for more display values, and modified results to reflect proper values that can become
+ regions. Also created new test for dynamically changing display values, making sure regions are
+ created or destroyed correctly.
+ * fast/regions/region-element-display-change-expected.txt: Added.
+ * fast/regions/region-element-display-change.html: Added.
+ * fast/regions/region-element-display-restriction-expected.txt:
+ * fast/regions/script-tests/region-element-display-change.js: Added.
+ (testElement):
+ * fast/regions/script-tests/region-element-display-restriction.js:
+
2012-06-27 Mike Lawther <[email protected]>
CSS3 calc: blending involving expressions
Added: trunk/LayoutTests/fast/regions/region-element-display-change-expected.txt (0 => 121352)
--- trunk/LayoutTests/fast/regions/region-element-display-change-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/regions/region-element-display-change-expected.txt 2012-06-27 18:25:16 UTC (rev 121352)
@@ -0,0 +1,24 @@
+Test that RenderObject is recreated correctly after changing display type.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS testElement(element, "none") is false
+PASS testElement(element, "block") is true
+PASS testElement(element, "inline-block") is true
+PASS testElement(element, "run-in") is false
+PASS testElement(element, "compact") is false
+PASS testElement(element, "inline") is false
+PASS testElement(element, "table") is false
+PASS testElement(element, "inline-table") is false
+PASS testElement(element, "table-cell") is true
+PASS testElement(element, "table-caption") is true
+PASS testElement(element, "list-item") is true
+PASS testElement(element, "-webkit-box") is false
+PASS testElement(element, "-webkit-inline-box") is false
+PASS testElement(element, "-webkit-flex") is false
+PASS testElement(element, "-webkit-inline-flex") is false
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/regions/region-element-display-change.html (0 => 121352)
--- trunk/LayoutTests/fast/regions/region-element-display-change.html (rev 0)
+++ trunk/LayoutTests/fast/regions/region-element-display-change.html 2012-06-27 18:25:16 UTC (rev 121352)
@@ -0,0 +1,10 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<script src=""
+<script src=""
+</body>
+</html>
Modified: trunk/LayoutTests/fast/regions/region-element-display-restriction-expected.txt (121351 => 121352)
--- trunk/LayoutTests/fast/regions/region-element-display-restriction-expected.txt 2012-06-27 18:23:09 UTC (rev 121351)
+++ trunk/LayoutTests/fast/regions/region-element-display-restriction-expected.txt 2012-06-27 18:25:16 UTC (rev 121352)
@@ -6,11 +6,18 @@
PASS createRegionElement("div", "none") is false
PASS createRegionElement("div", "block") is true
PASS createRegionElement("div", "inline-block") is true
-PASS createRegionElement("div", "run-in") is true
-PASS createRegionElement("div", "compact") is true
+PASS createRegionElement("div", "run-in") is false
+PASS createRegionElement("div", "compact") is false
PASS createRegionElement("div", "inline") is false
PASS createRegionElement("div", "table") is false
PASS createRegionElement("div", "inline-table") is false
+PASS createRegionElement("div", "table-cell") is true
+PASS createRegionElement("div", "table-caption") is true
+PASS createRegionElement("div", "list-item") is true
+PASS createRegionElement("div", "-webkit-box") is false
+PASS createRegionElement("div", "-webkit-inline-box") is false
+PASS createRegionElement("div", "-webkit-flex") is false
+PASS createRegionElement("div", "-webkit-inline-flex") is false
PASS successfullyParsed is true
TEST COMPLETE
Added: trunk/LayoutTests/fast/regions/script-tests/region-element-display-change.js (0 => 121352)
--- trunk/LayoutTests/fast/regions/script-tests/region-element-display-change.js (rev 0)
+++ trunk/LayoutTests/fast/regions/script-tests/region-element-display-change.js 2012-06-27 18:25:16 UTC (rev 121352)
@@ -0,0 +1,32 @@
+description("Test that RenderObject is recreated correctly after changing display type.");
+
+function testElement(element, displayType)
+{
+ element.style.setProperty("display", displayType);
+ // The region element was created if the length of inner text is 0.
+ var regionCreated = element.innerText.length == 0;
+ return regionCreated;
+}
+
+var element = document.createElement("div");
+var textElement = document.createTextNode("inside element");
+element.appendChild(textElement);
+element.style.setProperty("-webkit-flow-from", "flow");
+document.body.appendChild(element);
+shouldBeFalse('testElement(element, "none")');
+shouldBeTrue('testElement(element, "block")');
+shouldBeTrue('testElement(element, "inline-block")');
+shouldBeFalse('testElement(element, "run-in")');
+shouldBeFalse('testElement(element, "compact")');
+shouldBeFalse('testElement(element, "inline")');
+shouldBeFalse('testElement(element, "table")');
+shouldBeFalse('testElement(element, "inline-table")');
+shouldBeTrue('testElement(element, "table-cell")');
+shouldBeTrue('testElement(element, "table-caption")');
+shouldBeTrue('testElement(element, "list-item")');
+shouldBeFalse('testElement(element, "-webkit-box")');
+shouldBeFalse('testElement(element, "-webkit-inline-box")');
+shouldBeFalse('testElement(element, "-webkit-flex")');
+shouldBeFalse('testElement(element, "-webkit-inline-flex")');
+// FIXME: Also add grid and inline grid when it is enabled by default
+document.body.removeChild(element);
Modified: trunk/LayoutTests/fast/regions/script-tests/region-element-display-restriction.js (121351 => 121352)
--- trunk/LayoutTests/fast/regions/script-tests/region-element-display-restriction.js 2012-06-27 18:23:09 UTC (rev 121351)
+++ trunk/LayoutTests/fast/regions/script-tests/region-element-display-restriction.js 2012-06-27 18:25:16 UTC (rev 121352)
@@ -22,8 +22,16 @@
shouldBeFalse('createRegionElement("div", "none")');
shouldBeTrue('createRegionElement("div", "block")');
shouldBeTrue('createRegionElement("div", "inline-block")');
-shouldBeTrue('createRegionElement("div", "run-in")');
-shouldBeTrue('createRegionElement("div", "compact")');
+shouldBeFalse('createRegionElement("div", "run-in")');
+shouldBeFalse('createRegionElement("div", "compact")');
shouldBeFalse('createRegionElement("div", "inline")');
shouldBeFalse('createRegionElement("div", "table")');
shouldBeFalse('createRegionElement("div", "inline-table")');
+shouldBeTrue('createRegionElement("div", "table-cell")');
+shouldBeTrue('createRegionElement("div", "table-caption")');
+shouldBeTrue('createRegionElement("div", "list-item")');
+shouldBeFalse('createRegionElement("div", "-webkit-box")');
+shouldBeFalse('createRegionElement("div", "-webkit-inline-box")');
+shouldBeFalse('createRegionElement("div", "-webkit-flex")');
+shouldBeFalse('createRegionElement("div", "-webkit-inline-flex")');
+// FIXME: Also add grid and inline grid when it is enabled by default
Modified: trunk/Source/WebCore/ChangeLog (121351 => 121352)
--- trunk/Source/WebCore/ChangeLog 2012-06-27 18:23:09 UTC (rev 121351)
+++ trunk/Source/WebCore/ChangeLog 2012-06-27 18:25:16 UTC (rev 121352)
@@ -1,3 +1,22 @@
+2012-06-27 Andrei Onea <[email protected]>
+
+ [CSSRegions]Change display values that allow regions
+ https://bugs.webkit.org/show_bug.cgi?id=89759
+
+ Reviewed by Tony Chang.
+
+ Allow only elements with display values of block, inline-block,
+ table-cell, table-caption and list-item to become regions, as per
+ CSSRegions spec: http://dev.w3.org/csswg/css3-regions .
+ Also added test for checking whether regions are destroyed and/or created
+ when changing display value.
+
+ Test: fast/regions/region-element-display-change.html
+
+ * rendering/RenderObject.cpp:
+ (WebCore::RenderObject::createObject):
+ * rendering/style/RenderStyle.h:
+
2012-06-27 Mike Lawther <[email protected]>
CSS3 calc: blending involving expressions
Modified: trunk/Source/WebCore/rendering/RenderObject.cpp (121351 => 121352)
--- trunk/Source/WebCore/rendering/RenderObject.cpp 2012-06-27 18:23:09 UTC (rev 121351)
+++ trunk/Source/WebCore/rendering/RenderObject.cpp 2012-06-27 18:25:16 UTC (rev 121352)
@@ -150,7 +150,8 @@
// treat <rt> as ruby text ONLY if it still has its default treatment of block
if (node->hasTagName(rtTag) && style->display() == BLOCK)
return new (arena) RenderRubyText(node);
-
+ if (doc->cssRegionsEnabled() && style->isDisplayRegionType() && !style->regionThread().isEmpty() && doc->renderView())
+ return new (arena) RenderRegion(node, doc->renderView()->flowThreadController()->ensureRenderFlowThreadWithName(style->regionThread()));
switch (style->display()) {
case NONE:
return 0;
@@ -160,9 +161,6 @@
case INLINE_BLOCK:
case RUN_IN:
case COMPACT:
- // Only non-replaced block elements can become a region.
- if (doc->cssRegionsEnabled() && !style->regionThread().isEmpty() && doc->renderView())
- return new (arena) RenderRegion(node, doc->renderView()->flowThreadController()->ensureRenderFlowThreadWithName(style->regionThread()));
if ((!style->hasAutoColumnCount() || !style->hasAutoColumnWidth()) && doc->regionBasedColumnsEnabled())
return new (arena) RenderMultiColumnBlock(node);
return new (arena) RenderBlock(node);
Modified: trunk/Source/WebCore/rendering/style/RenderStyle.h (121351 => 121352)
--- trunk/Source/WebCore/rendering/style/RenderStyle.h 2012-06-27 18:23:09 UTC (rev 121351)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.h 2012-06-27 18:25:16 UTC (rev 121352)
@@ -1506,6 +1506,13 @@
|| originalDisplay() == INLINE_BOX || originalDisplay() == INLINE_TABLE || originalDisplay() == INLINE_GRID;
}
+ bool isDisplayRegionType() const
+ {
+ return display() == BLOCK || display() == INLINE_BLOCK
+ || display() == TABLE_CELL || display() == TABLE_CAPTION
+ || display() == LIST_ITEM;
+ }
+
void setWritingMode(WritingMode v) { inherited_flags.m_writingMode = v; }
// To tell if this style matched attribute selectors. This makes it impossible to share.