Support break-after, break-before and break-inside.
authorhyatt@apple.com <hyatt@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 30 Jan 2016 15:28:48 +0000 (15:28 +0000)
committerhyatt@apple.com <hyatt@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 30 Jan 2016 15:28:48 +0000 (15:28 +0000)
https://bugs.webkit.org/show_bug.cgi?id=148814

Reviewed by Dean Jackson.

Source/WebCore:

New tests added in printing/, fast/multicol/, and fast/regions.

* css/CSSComputedStyleDeclaration.cpp:
(WebCore::convertToPageBreak):
(WebCore::convertToColumnBreak):
(WebCore::convertToRegionBreak):
For backwards compatibility, keep support for all the old properties in
computed style. This means we have to convert the break-* property values
into keywords that make sense for the legacy properties. This mainly
involves mapping "page", "column", "region" to "always" (similar rule for
the avoid-* versions as well).

(WebCore::ComputedStyleExtractor::propertyValue):
Add support for the three new break-* properties.

* css/CSSParser.cpp:
(WebCore::isValidKeywordPropertyAndValue):
(WebCore::isKeywordPropertyID):
(WebCore::CSSParser::parseValue):
Add support for the new break properties.

* css/CSSPrimitiveValueMappings.h:
(WebCore::CSSPrimitiveValue::operator BreakBetween):
(WebCore::CSSPrimitiveValue::operator BreakInside):
Add converters for the new BreakBetween and BreakInside enums. Remove
the EPageBreak enum, since it is no longer used.

* css/CSSPropertyNames.in:
* css/CSSValueKeywords.in:
Add the new properties and the new values supported by the properties
to the keywords lists.

* css/StyleBuilderConverter.h:
(WebCore::StyleBuilderConverter::convertFontSynthesis):
(WebCore::StyleBuilderConverter::convertPageBreakBetween):
(WebCore::StyleBuilderConverter::convertPageBreakInside):
(WebCore::StyleBuilderConverter::convertColumnBreakBetween):
(WebCore::StyleBuilderConverter::convertColumnBreakInside):
(WebCore::StyleBuilderConverter::convertRegionBreakBetween):
(WebCore::StyleBuilderConverter::convertRegionBreakInside):
In order to map the legacy properties into the new break-* values
we have custom converter functions.

* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::paintChild):
(WebCore::RenderBlock::childBoxIsUnsplittableForFragmentation):
(WebCore::RenderBlock::computeRegionRangeForBoxChild):
* rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::applyBeforeBreak):
(WebCore::RenderBlockFlow::applyAfterBreak):
Patch the block code to check the correct new break-* constants. For
avoidance, this means checking both the general avoid value and the
specific value (e.g., avoid-page). In place of "always", we check
the specific value (e.g., column) and then for page specifically, we
also treat "left", "right", "recto" and "verso" as "always break" for now.

* rendering/style/RenderStyle.cpp:
(WebCore::RenderStyle::changeRequiresLayout):
Make sure changes to the break properties trigger relayout.

* rendering/style/RenderStyle.h:
Add getters and setters for the break-* properties and remove all
occurrences of the legacy page, column and region values from the RenderStyle.

* rendering/style/RenderStyleConstants.cpp:
(WebCore::alwaysPageBreak):
We have a helper function here for mapping several constant values to "page".

* rendering/style/RenderStyleConstants.h:
Definitions of the new BreakBetween and BreakInside enums.

* rendering/style/StyleMultiColData.cpp:
(WebCore::StyleMultiColData::StyleMultiColData):
(WebCore::StyleMultiColData::operator==):
* rendering/style/StyleMultiColData.h:
Remove the column-specific break data.

* rendering/style/StyleRareNonInheritedData.cpp:
(WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData):
(WebCore::StyleRareNonInheritedData::operator==):
* rendering/style/StyleRareNonInheritedData.h:
Remove the region-specific break data and replace it with generic break
data that is now used by all three pagination models.

LayoutTests:

* TestExpectations:
* fast/multicol/standardized-break-properties-expected.txt: Added.
* fast/multicol/standardized-break-properties.html: Added.
* fast/multicol/vertical-lr/standardized-break-properties-expected.txt: Added.
* fast/multicol/vertical-lr/standardized-break-properties.html: Added.
* fast/multicol/vertical-rl/standardized-break-properties-expected.txt: Added.
* fast/multicol/vertical-rl/standardized-break-properties.html: Added.
* fast/regions/text-break-properties-expected.txt: Added.
* fast/regions/text-break-properties.html: Added.
* printing/allowed-breaks-expected.txt: Added.
* printing/allowed-breaks.html: Added.
* printing/break-after-avoid-expected.txt: Added.
* printing/break-after-avoid-page-expected.txt: Added.
* printing/break-after-avoid-page.html: Added.
* printing/break-after-avoid.html: Added.
* printing/break-always-expected.txt: Added.
* printing/break-always.html: Added.
* printing/break-avoid-expected.txt: Added.
* printing/break-avoid-page-expected.txt: Added.
* printing/break-avoid-page.html: Added.
* printing/break-avoid.html: Added.
* printing/break-display-none-expected.txt: Added.
* printing/break-display-none.html: Added.
* printing/break-inside-avoid-expected.txt: Added.
* printing/break-inside-avoid-page-expected.txt: Added.
* printing/break-inside-avoid-page.html: Added.
* printing/break-inside-avoid.html: Added.
* printing/script-tests/allowed-breaks.js: Added.
(test):
* printing/script-tests/break-after-avoid-page.js: Added.
(test):
* printing/script-tests/break-after-avoid.js: Added.
(test):
* printing/script-tests/break-always.js: Added.
(test):
* printing/script-tests/break-avoid-page.js: Added.
(test):
* printing/script-tests/break-avoid.js: Added.
(test):
* printing/script-tests/break-display-none.js: Added.
(test):
* printing/script-tests/break-inside-avoid-page.js: Added.
(test):
* printing/script-tests/break-inside-avoid.js: Added.
(test):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@195892 268f45cc-cd09-0410-ab3c-d52691b4dbfc

55 files changed:
LayoutTests/ChangeLog
LayoutTests/TestExpectations
LayoutTests/fast/css/style-enumerate-properties.html
LayoutTests/fast/multicol/standardized-break-properties-expected.txt [new file with mode: 0644]
LayoutTests/fast/multicol/standardized-break-properties.html [new file with mode: 0644]
LayoutTests/fast/multicol/vertical-lr/standardized-break-properties-expected.txt [new file with mode: 0644]
LayoutTests/fast/multicol/vertical-lr/standardized-break-properties.html [new file with mode: 0644]
LayoutTests/fast/multicol/vertical-rl/standardized-break-properties-expected.txt [new file with mode: 0644]
LayoutTests/fast/multicol/vertical-rl/standardized-break-properties.html [new file with mode: 0644]
LayoutTests/fast/regions/text-break-properties-expected.txt [new file with mode: 0644]
LayoutTests/fast/regions/text-break-properties.html [new file with mode: 0644]
LayoutTests/printing/allowed-breaks-expected.txt [new file with mode: 0644]
LayoutTests/printing/allowed-breaks.html [new file with mode: 0644]
LayoutTests/printing/break-after-avoid-expected.txt [new file with mode: 0644]
LayoutTests/printing/break-after-avoid-page-expected.txt [new file with mode: 0644]
LayoutTests/printing/break-after-avoid-page.html [new file with mode: 0644]
LayoutTests/printing/break-after-avoid.html [new file with mode: 0644]
LayoutTests/printing/break-always-expected.txt [new file with mode: 0644]
LayoutTests/printing/break-always.html [new file with mode: 0644]
LayoutTests/printing/break-avoid-expected.txt [new file with mode: 0644]
LayoutTests/printing/break-avoid-page-expected.txt [new file with mode: 0644]
LayoutTests/printing/break-avoid-page.html [new file with mode: 0644]
LayoutTests/printing/break-avoid.html [new file with mode: 0644]
LayoutTests/printing/break-display-none-expected.txt [new file with mode: 0644]
LayoutTests/printing/break-display-none.html [new file with mode: 0644]
LayoutTests/printing/break-inside-avoid-expected.txt [new file with mode: 0644]
LayoutTests/printing/break-inside-avoid-page-expected.txt [new file with mode: 0644]
LayoutTests/printing/break-inside-avoid-page.html [new file with mode: 0644]
LayoutTests/printing/break-inside-avoid.html [new file with mode: 0644]
LayoutTests/printing/script-tests/allowed-breaks.js [new file with mode: 0644]
LayoutTests/printing/script-tests/break-after-avoid-page.js [new file with mode: 0644]
LayoutTests/printing/script-tests/break-after-avoid.js [new file with mode: 0644]
LayoutTests/printing/script-tests/break-always.js [new file with mode: 0644]
LayoutTests/printing/script-tests/break-avoid-page.js [new file with mode: 0644]
LayoutTests/printing/script-tests/break-avoid.js [new file with mode: 0644]
LayoutTests/printing/script-tests/break-display-none.js [new file with mode: 0644]
LayoutTests/printing/script-tests/break-inside-avoid-page.js [new file with mode: 0644]
LayoutTests/printing/script-tests/break-inside-avoid.js [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/css/CSSComputedStyleDeclaration.cpp
Source/WebCore/css/CSSParser.cpp
Source/WebCore/css/CSSPrimitiveValueMappings.h
Source/WebCore/css/CSSPropertyNames.in
Source/WebCore/css/CSSValueKeywords.in
Source/WebCore/css/StyleBuilderConverter.h
Source/WebCore/rendering/RenderBlock.cpp
Source/WebCore/rendering/RenderBlockFlow.cpp
Source/WebCore/rendering/style/RenderStyle.cpp
Source/WebCore/rendering/style/RenderStyle.h
Source/WebCore/rendering/style/RenderStyleConstants.cpp
Source/WebCore/rendering/style/RenderStyleConstants.h
Source/WebCore/rendering/style/StyleMultiColData.cpp
Source/WebCore/rendering/style/StyleMultiColData.h
Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp
Source/WebCore/rendering/style/StyleRareNonInheritedData.h

index 4c72b8f..701b914 100644 (file)
@@ -1,3 +1,56 @@
+2016-01-30  Dave Hyatt  <hyatt@apple.com>
+
+        Support break-after, break-before and break-inside.
+        https://bugs.webkit.org/show_bug.cgi?id=148814
+
+        Reviewed by Dean Jackson.
+
+        * TestExpectations:
+        * fast/multicol/standardized-break-properties-expected.txt: Added.
+        * fast/multicol/standardized-break-properties.html: Added.
+        * fast/multicol/vertical-lr/standardized-break-properties-expected.txt: Added.
+        * fast/multicol/vertical-lr/standardized-break-properties.html: Added.
+        * fast/multicol/vertical-rl/standardized-break-properties-expected.txt: Added.
+        * fast/multicol/vertical-rl/standardized-break-properties.html: Added.
+        * fast/regions/text-break-properties-expected.txt: Added.
+        * fast/regions/text-break-properties.html: Added.
+        * printing/allowed-breaks-expected.txt: Added.
+        * printing/allowed-breaks.html: Added.
+        * printing/break-after-avoid-expected.txt: Added.
+        * printing/break-after-avoid-page-expected.txt: Added.
+        * printing/break-after-avoid-page.html: Added.
+        * printing/break-after-avoid.html: Added.
+        * printing/break-always-expected.txt: Added.
+        * printing/break-always.html: Added.
+        * printing/break-avoid-expected.txt: Added.
+        * printing/break-avoid-page-expected.txt: Added.
+        * printing/break-avoid-page.html: Added.
+        * printing/break-avoid.html: Added.
+        * printing/break-display-none-expected.txt: Added.
+        * printing/break-display-none.html: Added.
+        * printing/break-inside-avoid-expected.txt: Added.
+        * printing/break-inside-avoid-page-expected.txt: Added.
+        * printing/break-inside-avoid-page.html: Added.
+        * printing/break-inside-avoid.html: Added.
+        * printing/script-tests/allowed-breaks.js: Added.
+        (test):
+        * printing/script-tests/break-after-avoid-page.js: Added.
+        (test):
+        * printing/script-tests/break-after-avoid.js: Added.
+        (test):
+        * printing/script-tests/break-always.js: Added.
+        (test):
+        * printing/script-tests/break-avoid-page.js: Added.
+        (test):
+        * printing/script-tests/break-avoid.js: Added.
+        (test):
+        * printing/script-tests/break-display-none.js: Added.
+        (test):
+        * printing/script-tests/break-inside-avoid-page.js: Added.
+        (test):
+        * printing/script-tests/break-inside-avoid.js: Added.
+        (test):
+
 2016-01-29  Michael Catanzaro  <mcatanzaro@igalia.com>
 
         [GTK] Mark two CSS multicolumn tests as failing
index 5cc9901..522e5a0 100644 (file)
@@ -712,7 +712,6 @@ webkit.org/b/148818 imported/w3c/css/css-multicol-1/multicol-fill-auto-block-chi
 webkit.org/b/148818 imported/w3c/css/css-multicol-1/multicol-nested-column-rule-001.xht [ ImageOnlyFailure ] # only scrollbar
 
 webkit.org/b/148812 imported/w3c/css/css-multicol-1/multicol-width-small-001.xht [ ImageOnlyFailure ]
-webkit.org/b/148814 imported/w3c/css/css-multicol-1/multicol-break-000.xht [ ImageOnlyFailure ]
 webkit.org/b/148814 imported/w3c/css/css-multicol-1/multicol-break-001.xht [ ImageOnlyFailure ]
 webkit.org/b/148816 imported/w3c/css/css-multicol-1/multicol-rule-004.xht [ ImageOnlyFailure ]
 webkit.org/b/148823 imported/w3c/css/css-multicol-1/multicol-span-all-margin-nested-003.xht [ ImageOnlyFailure ]
index 12cf09f..dbe1a59 100644 (file)
@@ -40,7 +40,7 @@
                 testFailed("Invalid CSS-mapped property order: '" + p + "' after '" + previous + "'");
                 break;
             }
-            if (++cssPropertyCount <= 100)
+            if (++cssPropertyCount <= 103)
                 previous = p;
             else {
                 if (seenFilter)
diff --git a/LayoutTests/fast/multicol/standardized-break-properties-expected.txt b/LayoutTests/fast/multicol/standardized-break-properties-expected.txt
new file mode 100644 (file)
index 0000000..0aa4a6a
--- /dev/null
@@ -0,0 +1,4 @@
+PASS: 'break-before' is at (220, 8)
+PASS: 'after-break' is at (431, 8)
+PASS: 'no-break' is at (537, 8)
+
diff --git a/LayoutTests/fast/multicol/standardized-break-properties.html b/LayoutTests/fast/multicol/standardized-break-properties.html
new file mode 100644 (file)
index 0000000..270916f
--- /dev/null
@@ -0,0 +1,40 @@
+<style>
+    div.box { -webkit-box-sizing: border; border: solid blue; }
+    div.shorter { height: 54px; }
+    div.taller { height: 72px; }
+</style>
+<div style="height: 100px; width: 630; -webkit-columns:6; -webkit-column-gap:5px; columns:6; column-gap:5px;">
+    <div class="taller box"></div>
+    <div class="taller box"></div>
+    <div id="break-before" class="shorter box" style="break-before: column;"></div>
+    <div class="shorter box" style="break-after: column;"></div>
+    <div id="after-break" class="shorter box"></div>
+    <div id="no-break" class="shorter box" style="break-inside: avoid-column;"></div>
+    <div id="subPixelTest" style="width:10.5px"></div>
+</div>
+<pre id="console"></pre>
+<script>
+    if (window.testRunner)
+        testRunner.dumpAsText();
+
+    function log(message)
+    {
+        document.getElementById("console").appendChild(document.createTextNode(message + "\n"));
+    }
+
+    function testBoxPosition(id, expectedLeft, expectedTop)
+    {
+        var rect = document.getElementById(id).getBoundingClientRect();
+        if (Math.round(rect.left) === expectedLeft && Math.round(rect.top) === expectedTop)
+            log("PASS: '" + id + "' is at (" + expectedLeft + ", " + expectedTop + ")");
+        else
+            log("FAIL: '" + id + "' is at (" + Math.round(rect.left) + ", " + Math.round(rect.top) + ") instead of (" + expectedLeft + " ," + expectedTop + ")");
+    }
+
+    var rect = document.getElementById('subPixelTest').getBoundingClientRect();
+    var hasSubpixelSupport = Math.round(rect.right) != rect.right;
+
+    testBoxPosition("break-before", hasSubpixelSupport ? 220 : 218, 8);
+    testBoxPosition("after-break", hasSubpixelSupport ? 431 : 428, 8);
+    testBoxPosition("no-break", hasSubpixelSupport ? 537 : 533, 8);
+</script>
diff --git a/LayoutTests/fast/multicol/vertical-lr/standardized-break-properties-expected.txt b/LayoutTests/fast/multicol/vertical-lr/standardized-break-properties-expected.txt
new file mode 100644 (file)
index 0000000..0e312f2
--- /dev/null
@@ -0,0 +1,3 @@
+PASS: 'break-before' is at (8, 220)
+PASS: 'after-break' is at (8, 431)
+
diff --git a/LayoutTests/fast/multicol/vertical-lr/standardized-break-properties.html b/LayoutTests/fast/multicol/vertical-lr/standardized-break-properties.html
new file mode 100644 (file)
index 0000000..fe7db26
--- /dev/null
@@ -0,0 +1,40 @@
+<style>
+    div.box { -webkit-box-sizing: border; border: solid blue; }
+    div.shorter { width: 54px; }
+    div.taller { width: 72px; }
+</style>
+<body style="-webkit-writing-mode:vertical-lr">
+<div style="width:100px; height:630px; -webkit-columns:6; -webkit-column-gap:5px; -webkit-column-fill:auto; columns:6; column-gap:5px; column-fill:auto;">
+    <div class="taller box"></div>
+    <div class="taller box"></div>
+    <div id="break-before" class="shorter box" style="break-before: column;"></div>
+    <div class="shorter box" style="break-after: column;"></div>
+    <div id="after-break" class="shorter box"></div>
+    <div id="no-break" class="shorter box" style="break-inside: avoid;"></div>
+    <div id="subPixelTest" style="width:10.5px"></div>
+</div>
+<pre id="console"></pre>
+<script>
+    if (window.testRunner)
+        testRunner.dumpAsText();
+
+    function log(message)
+    {
+        document.getElementById("console").appendChild(document.createTextNode(message + "\n"));
+    }
+
+    function testBoxPosition(id, expectedLeft, expectedTop)
+    {
+        var rect = document.getElementById(id).getBoundingClientRect();
+        if (Math.round(rect.left) === expectedLeft && Math.round(rect.top) === expectedTop)
+            log("PASS: '" + id + "' is at (" + expectedLeft + ", " + expectedTop + ")");
+        else
+            log("FAIL: '" + id + "' is at (" + Math.round(rect.left) + ", " + Math.round(rect.top) + ") instead of (" + expectedLeft + " ," + expectedTop + ")");
+    }
+
+    var rect = document.getElementById('subPixelTest').getBoundingClientRect();
+    var hasSubpixelSupport = Math.round(rect.bottom) != rect.bottom;
+
+    testBoxPosition("break-before", 8, hasSubpixelSupport ? 220 : 218);
+    testBoxPosition("after-break", 8, hasSubpixelSupport ? 431 : 428);
+</script>
diff --git a/LayoutTests/fast/multicol/vertical-rl/standardized-break-properties-expected.txt b/LayoutTests/fast/multicol/vertical-rl/standardized-break-properties-expected.txt
new file mode 100644 (file)
index 0000000..b1a7068
--- /dev/null
@@ -0,0 +1,3 @@
+PASS: 'break-before' is at (748, 220)
+PASS: 'after-break' is at (748, 431)
+
diff --git a/LayoutTests/fast/multicol/vertical-rl/standardized-break-properties.html b/LayoutTests/fast/multicol/vertical-rl/standardized-break-properties.html
new file mode 100644 (file)
index 0000000..f014bbc
--- /dev/null
@@ -0,0 +1,43 @@
+<html style="-webkit-writing-mode:horizontal-tb">
+<head>
+<style>
+    div.box { -webkit-box-sizing: border; border: solid blue; }
+    div.shorter { width: 54px; }
+    div.taller { width: 72px; }
+</style>
+</head>
+<body style="-webkit-writing-mode:vertical-rl; width:800px;">
+<div style="width: 100px; height: 630px; -webkit-columns:6; -webkit-column-gap:5px; -webkit-column-fill:auto; columns:6; column-gap:5px; column-fill:auto;">
+    <div class="taller box"></div>
+    <div class="taller box"></div>
+    <div id="break-before" class="shorter box" style="break-before: column;"></div>
+    <div class="shorter box" style="break-after: column;"></div>
+    <div id="after-break" class="shorter box"></div>
+    <div id="no-break" class="shorter box" style="break-inside: avoid;"></div>
+    <div id="subPixelTest" style="width:10.5px"></div>
+</div>
+<pre id="console"></pre>
+<script>
+    if (window.testRunner)
+        testRunner.dumpAsText();
+
+    function log(message)
+    {
+        document.getElementById("console").appendChild(document.createTextNode(message + "\n"));
+    }
+
+    function testBoxPosition(id, expectedLeft, expectedTop)
+    {
+        var rect = document.getElementById(id).getBoundingClientRect();
+        if (Math.round(rect.left) === expectedLeft && Math.round(rect.top) === expectedTop)
+            log("PASS: '" + id + "' is at (" + expectedLeft + ", " + expectedTop + ")");
+        else
+            log("FAIL: '" + id + "' is at (" + Math.round(rect.left) + ", " + Math.round(rect.top) + ") instead of (" + expectedLeft + " ," + expectedTop + ")");
+    }
+
+    var rect = document.getElementById('subPixelTest').getBoundingClientRect();
+    var hasSubpixelSupport = Math.round(rect.bottom) != rect.bottom;
+
+    testBoxPosition("break-before", 748, hasSubpixelSupport ? 220 : 218);
+    testBoxPosition("after-break", 748, hasSubpixelSupport ? 431 : 428);
+</script>
diff --git a/LayoutTests/fast/regions/text-break-properties-expected.txt b/LayoutTests/fast/regions/text-break-properties-expected.txt
new file mode 100644 (file)
index 0000000..7ef22e9
--- /dev/null
@@ -0,0 +1 @@
+PASS
diff --git a/LayoutTests/fast/regions/text-break-properties.html b/LayoutTests/fast/regions/text-break-properties.html
new file mode 100644 (file)
index 0000000..0ff6751
--- /dev/null
@@ -0,0 +1,50 @@
+<!DOCTYPE html>
+
+<style>
+    #content { -webkit-flow-into: flow; }
+    .region { -webkit-flow-from: flow; }
+    .finished #content, .finished .region { display: none; }
+
+    #region1 { width: 70px; height: 60px; }
+    #region2 { width: 200px; height: 100px; }
+    #region3 { width: 110px; height: 120px; }
+    #region4 { width: 220px; height: 100px; }
+    #region5 { width: 200px; height: 140px; }
+</style>
+
+<div id="content">
+    <div style="break-after: region"><b class="check region1">Region 1</b></div>
+    
+    <div>
+        <div>
+            <div style="break-after: region">
+                <div>
+                    <b class="check region2">Region 2</b>
+                    <div style="break-before: region; margin-top:35px;"><b class="check region3">Region 3</b></div>
+                </div>
+            </div>
+        </div>
+    </div>
+    
+    <div><b class="check region4">Region 4</b></div>
+    
+    
+    <div style="break-inside: avoid-region;">
+        <b class="check region5 start">Start of region 5.</b> Do not split these lines. Do not split these lines. Do not split these lines. Do not split these lines. Do not split these lines. Do not split these lines. Do not split these lines. <b class="check region5 end">End of region 5.</b>
+    </div>
+    
+</div>
+
+<div id="region1" class="region"></div>
+<div id="region2" class="region"></div>
+<div id="region3" class="region"></div>
+<div id="region4" class="region"></div>
+<div id="region5" class="region"></div>
+
+<script src="resources/helper.js"></script>
+<script>
+    if (window.testRunner)
+        testRunner.dumpAsText();
+    if (testContentToRegionsMapping())
+        document.body.className = "finished";
+</script>
\ No newline at end of file
diff --git a/LayoutTests/printing/allowed-breaks-expected.txt b/LayoutTests/printing/allowed-breaks-expected.txt
new file mode 100644 (file)
index 0000000..5130e9c
--- /dev/null
@@ -0,0 +1,15 @@
+Test for allowed page breaks
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+
+PASS: page number of "page1" is 1
+FAIL: expected page number of "page2" is 2. Was 1
+PASS: page number of "page3-1" is 3
+PASS: page number of "page3-2" is 3
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/printing/allowed-breaks.html b/LayoutTests/printing/allowed-breaks.html
new file mode 100644 (file)
index 0000000..1e6e291
--- /dev/null
@@ -0,0 +1,15 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src="../resources/js-test-pre.js"></script>
+<script src="resources/paged-media-test-utils.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<div id="sandbox"></div>
+<script src="script-tests/allowed-breaks.js"></script>
+<script>runPrintingTest(test);</script>
+<script src="../resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/printing/break-after-avoid-expected.txt b/LayoutTests/printing/break-after-avoid-expected.txt
new file mode 100644 (file)
index 0000000..aa4b681
--- /dev/null
@@ -0,0 +1,20 @@
+Test for page-break-after:avoid
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+
+PASS: page number of "page1" is 1
+FAIL: expected page number of "page2-1" is 2. Was 1
+FAIL: expected page number of "page2-2" is 2. Was 1
+PASS: page number of "page3-1" is 3
+PASS: page number of "page3-2" is 3
+PASS: page number of "page3-3" is 3
+PASS: page number of "page5" is 5
+FAIL: expected page number of "page6-1" is 6. Was 5
+PASS: page number of "page6-7" is 6
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/printing/break-after-avoid-page-expected.txt b/LayoutTests/printing/break-after-avoid-page-expected.txt
new file mode 100644 (file)
index 0000000..aa4b681
--- /dev/null
@@ -0,0 +1,20 @@
+Test for page-break-after:avoid
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+
+PASS: page number of "page1" is 1
+FAIL: expected page number of "page2-1" is 2. Was 1
+FAIL: expected page number of "page2-2" is 2. Was 1
+PASS: page number of "page3-1" is 3
+PASS: page number of "page3-2" is 3
+PASS: page number of "page3-3" is 3
+PASS: page number of "page5" is 5
+FAIL: expected page number of "page6-1" is 6. Was 5
+PASS: page number of "page6-7" is 6
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/printing/break-after-avoid-page.html b/LayoutTests/printing/break-after-avoid-page.html
new file mode 100644 (file)
index 0000000..5883533
--- /dev/null
@@ -0,0 +1,15 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src="../resources/js-test-pre.js"></script>
+<script src="resources/paged-media-test-utils.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<div id="sandbox"></div>
+<script src="script-tests/break-after-avoid.js"></script>
+<script>runPrintingTest(test);</script>
+<script src="../resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/printing/break-after-avoid.html b/LayoutTests/printing/break-after-avoid.html
new file mode 100644 (file)
index 0000000..d5439e1
--- /dev/null
@@ -0,0 +1,15 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src="../resources/js-test-pre.js"></script>
+<script src="resources/paged-media-test-utils.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<div id="sandbox"></div>
+<script src="script-tests/page-break-after-avoid.js"></script>
+<script>runPrintingTest(test);</script>
+<script src="../resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/printing/break-always-expected.txt b/LayoutTests/printing/break-always-expected.txt
new file mode 100644 (file)
index 0000000..ef1246e
--- /dev/null
@@ -0,0 +1,16 @@
+Test for page-break-before:always and page-break-after:always
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+
+PASS: page number of "firstPage" is 0
+PASS: page number of "secondPage1" is 1
+PASS: page number of "secondPage2" is 1
+PASS: page number of "thirdPage" is 2
+All tests passed
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/printing/break-always.html b/LayoutTests/printing/break-always.html
new file mode 100644 (file)
index 0000000..885c659
--- /dev/null
@@ -0,0 +1,15 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src="../resources/js-test-pre.js"></script>
+<script src="resources/paged-media-test-utils.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<div id="sandbox"></div>
+<script src="script-tests/break-always.js"></script>
+<script>runPrintingTest(test);</script>
+<script src="../resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/printing/break-avoid-expected.txt b/LayoutTests/printing/break-avoid-expected.txt
new file mode 100644 (file)
index 0000000..115fae2
--- /dev/null
@@ -0,0 +1,14 @@
+Test for combined page-break-{before,after,inside}:avoid
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+
+PASS: page number of "page1-1" is 1
+FAIL: expected page number of "page2-1" is 2. Was 1
+PASS: page number of "page2-8" is 2
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/printing/break-avoid-page-expected.txt b/LayoutTests/printing/break-avoid-page-expected.txt
new file mode 100644 (file)
index 0000000..115fae2
--- /dev/null
@@ -0,0 +1,14 @@
+Test for combined page-break-{before,after,inside}:avoid
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+
+PASS: page number of "page1-1" is 1
+FAIL: expected page number of "page2-1" is 2. Was 1
+PASS: page number of "page2-8" is 2
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/printing/break-avoid-page.html b/LayoutTests/printing/break-avoid-page.html
new file mode 100644 (file)
index 0000000..e1ea2a5
--- /dev/null
@@ -0,0 +1,15 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src="../resources/js-test-pre.js"></script>
+<script src="resources/paged-media-test-utils.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<div id="sandbox"></div>
+<script src="script-tests/break-avoid-page.js"></script>
+<script>runPrintingTest(test);</script>
+<script src="../resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/printing/break-avoid.html b/LayoutTests/printing/break-avoid.html
new file mode 100644 (file)
index 0000000..dd29ab7
--- /dev/null
@@ -0,0 +1,15 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src="../resources/js-test-pre.js"></script>
+<script src="resources/paged-media-test-utils.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<div id="sandbox"></div>
+<script src="script-tests/break-avoid.js"></script>
+<script>runPrintingTest(test);</script>
+<script src="../resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/printing/break-display-none-expected.txt b/LayoutTests/printing/break-display-none-expected.txt
new file mode 100644 (file)
index 0000000..13a44bc
--- /dev/null
@@ -0,0 +1,15 @@
+Test for page-break with 'display:none'
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+
+PASS: page number of "page1-1" is 1
+PASS: page number of "displaynone" is -1
+PASS: page number of "page1-2" is 1
+All tests passed
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/printing/break-display-none.html b/LayoutTests/printing/break-display-none.html
new file mode 100644 (file)
index 0000000..05549ae
--- /dev/null
@@ -0,0 +1,15 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src="../resources/js-test-pre.js"></script>
+<script src="resources/paged-media-test-utils.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<div id="sandbox"></div>
+<script src="script-tests/break-display-none.js"></script>
+<script>runPrintingTest(test);</script>
+<script src="../resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/printing/break-inside-avoid-expected.txt b/LayoutTests/printing/break-inside-avoid-expected.txt
new file mode 100644 (file)
index 0000000..cebbc85
--- /dev/null
@@ -0,0 +1,22 @@
+Test for page-break-inside:avoid
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+
+PASS: page number of "page1-1" is 1
+PASS: page number of "page1-2" is 1
+PASS: page number of "page2" is 2
+PASS: page number of "page3" is 3
+PASS: page number of "page4" is 4
+PASS: page number of "page5" is 5
+PASS: page number of "page8" is 8
+PASS: page number of "page9-1" is 9
+PASS: page number of "page9-2" is 9
+PASS: page number of "page10" is 10
+All tests passed
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/printing/break-inside-avoid-page-expected.txt b/LayoutTests/printing/break-inside-avoid-page-expected.txt
new file mode 100644 (file)
index 0000000..cebbc85
--- /dev/null
@@ -0,0 +1,22 @@
+Test for page-break-inside:avoid
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+
+PASS: page number of "page1-1" is 1
+PASS: page number of "page1-2" is 1
+PASS: page number of "page2" is 2
+PASS: page number of "page3" is 3
+PASS: page number of "page4" is 4
+PASS: page number of "page5" is 5
+PASS: page number of "page8" is 8
+PASS: page number of "page9-1" is 9
+PASS: page number of "page9-2" is 9
+PASS: page number of "page10" is 10
+All tests passed
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/printing/break-inside-avoid-page.html b/LayoutTests/printing/break-inside-avoid-page.html
new file mode 100644 (file)
index 0000000..c88ec26
--- /dev/null
@@ -0,0 +1,15 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src="../resources/js-test-pre.js"></script>
+<script src="resources/paged-media-test-utils.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<div id="sandbox"></div>
+<script src="script-tests/break-inside-avoid-page.js"></script>
+<script>runPrintingTest(test);</script>
+<script src="../resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/printing/break-inside-avoid.html b/LayoutTests/printing/break-inside-avoid.html
new file mode 100644 (file)
index 0000000..53f90c7
--- /dev/null
@@ -0,0 +1,15 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src="../resources/js-test-pre.js"></script>
+<script src="resources/paged-media-test-utils.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<div id="sandbox"></div>
+<script src="script-tests/break-inside-avoid.js"></script>
+<script>runPrintingTest(test);</script>
+<script src="../resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/printing/script-tests/allowed-breaks.js b/LayoutTests/printing/script-tests/allowed-breaks.js
new file mode 100644 (file)
index 0000000..d1a07b4
--- /dev/null
@@ -0,0 +1,26 @@
+description("Test for allowed page breaks");
+
+function test()
+{
+    // See CSS3: Paged Media 9.4. Allowed page breaks.
+    // http://dev.w3.org/csswg/css3-page/#allowed-pg-brk
+    createBlockWithRatioToPageHeight("page1", 0.8).style.breakBefore = "page";
+    // We shoud break a page between block 'page1' and block 'page2' instead of
+    // breaking inside block 'page2' because there is no allowed page break points
+    // inside block 'page2'. Breaking at non-allowed position should be a last resort.
+    createBlockWithRatioToPageHeight("page2", 0.8);
+
+    createBlockWithRatioToPageHeight("page3-1", 0.6).style.breakBefore = "page";
+    // We can break inside block 'page3-2' because page breaks may occur between
+    // line boxes inside a block box.
+    createBlockWithNumberOfLines("page3-2", 20);
+
+    pageNumberForElementShouldBe("page1", 1);
+    pageNumberForElementShouldBe("page2", 2);
+    pageNumberForElementShouldBe("page3-1", 3);
+    pageNumberForElementShouldBe("page3-2", 3);
+
+    document.body.removeChild(document.getElementById("sandbox"));
+}
+
+var successfullyParsed = true;
diff --git a/LayoutTests/printing/script-tests/break-after-avoid-page.js b/LayoutTests/printing/script-tests/break-after-avoid-page.js
new file mode 100644 (file)
index 0000000..12c98c8
--- /dev/null
@@ -0,0 +1,43 @@
+description("Test for page-break-after:avoid");
+
+function test()
+{
+    createBlockWithRatioToPageHeight("page1", 0.5).style.breakBefore = "page";
+    // A block 'page2-1' must move to the next page because it has 'page-break-after:avoid'
+    // and both 'page2-1' and 'page2-2' cannot be placed in the current page at the same time.
+    createBlockWithRatioToPageHeight("page2-1", 0.3).style.breakAfter = "avoid-page";
+    createBlockWithRatioToPageHeight("page2-2", 0.3);
+
+    createBlockWithRatioToPageHeight("page3-1", 0.5).style.breakBefore = "page";
+    // A page break can occur inside of 'page3-3' block because it has child elements.
+    createBlockWithRatioToPageHeight("page3-2", 0.3).style.breakAfter = "avoid-page";
+    createBlockWithNumberOfLines("page3-3", 10);
+
+    createBlockWithRatioToPageHeight("page5", 0.5).style.breakBefore = "page";
+    // It seems unrealistic, but block 'page6-1' must move to the next page.
+    createBlockWithRatioToPageHeight("page6-1", 0.1).style.breakAfter = "avoid-page";
+    createBlockWithRatioToPageHeight("page6-2", 0.1).style.breakAfter = "avoid-page";
+    createBlockWithRatioToPageHeight("page6-3", 0.1).style.breakAfter = "avoid-page";
+    createBlockWithRatioToPageHeight("page6-4", 0.1).style.breakAfter = "avoid-page";
+    createBlockWithRatioToPageHeight("page6-5", 0.1).style.breakAfter = "avoid-page";
+    createBlockWithRatioToPageHeight("page6-6", 0.1).style.breakAfter = "avoid-page";
+    createBlockWithRatioToPageHeight("page6-7", 0.1);
+
+
+    pageNumberForElementShouldBe("page1", 1);
+    pageNumberForElementShouldBe("page2-1", 2);
+    pageNumberForElementShouldBe("page2-2", 2);
+
+    pageNumberForElementShouldBe("page3-1", 3);
+    pageNumberForElementShouldBe("page3-2", 3);
+    pageNumberForElementShouldBe("page3-3", 3);
+
+    pageNumberForElementShouldBe("page5", 5);
+    pageNumberForElementShouldBe("page6-1", 6);
+    // Omit tests for intermediate blocks.
+    pageNumberForElementShouldBe("page6-7", 6);
+
+    document.body.removeChild(document.getElementById("sandbox"));
+}
+
+var successfullyParsed = true;
diff --git a/LayoutTests/printing/script-tests/break-after-avoid.js b/LayoutTests/printing/script-tests/break-after-avoid.js
new file mode 100644 (file)
index 0000000..3e694bd
--- /dev/null
@@ -0,0 +1,43 @@
+description("Test for page-break-after:avoid");
+
+function test()
+{
+    createBlockWithRatioToPageHeight("page1", 0.5).style.breakBefore = "page";
+    // A block 'page2-1' must move to the next page because it has 'page-break-after:avoid'
+    // and both 'page2-1' and 'page2-2' cannot be placed in the current page at the same time.
+    createBlockWithRatioToPageHeight("page2-1", 0.3).style.breakAfter = "avoid";
+    createBlockWithRatioToPageHeight("page2-2", 0.3);
+
+    createBlockWithRatioToPageHeight("page3-1", 0.5).style.breakBefore = "page";
+    // A page break can occur inside of 'page3-3' block because it has child elements.
+    createBlockWithRatioToPageHeight("page3-2", 0.3).style.breakAfter = "avoid";
+    createBlockWithNumberOfLines("page3-3", 10);
+
+    createBlockWithRatioToPageHeight("page5", 0.5).style.breakBefore = "page";
+    // It seems unrealistic, but block 'page6-1' must move to the next page.
+    createBlockWithRatioToPageHeight("page6-1", 0.1).style.breakAfter = "avoid";
+    createBlockWithRatioToPageHeight("page6-2", 0.1).style.breakAfter = "avoid";
+    createBlockWithRatioToPageHeight("page6-3", 0.1).style.breakAfter = "avoid";
+    createBlockWithRatioToPageHeight("page6-4", 0.1).style.breakAfter = "avoid";
+    createBlockWithRatioToPageHeight("page6-5", 0.1).style.breakAfter = "avoid";
+    createBlockWithRatioToPageHeight("page6-6", 0.1).style.breakAfter = "avoid";
+    createBlockWithRatioToPageHeight("page6-7", 0.1);
+
+
+    pageNumberForElementShouldBe("page1", 1);
+    pageNumberForElementShouldBe("page2-1", 2);
+    pageNumberForElementShouldBe("page2-2", 2);
+
+    pageNumberForElementShouldBe("page3-1", 3);
+    pageNumberForElementShouldBe("page3-2", 3);
+    pageNumberForElementShouldBe("page3-3", 3);
+
+    pageNumberForElementShouldBe("page5", 5);
+    pageNumberForElementShouldBe("page6-1", 6);
+    // Omit tests for intermediate blocks.
+    pageNumberForElementShouldBe("page6-7", 6);
+
+    document.body.removeChild(document.getElementById("sandbox"));
+}
+
+var successfullyParsed = true;
diff --git a/LayoutTests/printing/script-tests/break-always.js b/LayoutTests/printing/script-tests/break-always.js
new file mode 100644 (file)
index 0000000..cd0fa70
--- /dev/null
@@ -0,0 +1,19 @@
+description("Test for page-break-before:always and page-break-after:always");
+
+function test()
+{
+    createBlockWithRatioToPageHeight("firstPage", 0.1);
+    createBlockWithRatioToPageHeight("secondPage1", 0.1).style.breakBefore = "page";
+    createBlockWithRatioToPageHeight("secondPage2", 0.1).style.breakAfter = "page";
+    createBlockWithRatioToPageHeight("thirdPage", 0.1).style.breakBefore = "page";
+
+    pageNumberForElementShouldBe('firstPage', 0);
+    pageNumberForElementShouldBe('secondPage1', 1);
+    pageNumberForElementShouldBe('secondPage2', 1);
+    // There must be only one page break between 'page-break-after: always' and 'page-break-before: always'
+    pageNumberForElementShouldBe('thirdPage', 2);
+
+    document.body.removeChild(document.getElementById("sandbox"));
+}
+
+var successfullyParsed = true;
diff --git a/LayoutTests/printing/script-tests/break-avoid-page.js b/LayoutTests/printing/script-tests/break-avoid-page.js
new file mode 100644 (file)
index 0000000..ff923e8
--- /dev/null
@@ -0,0 +1,35 @@
+description("Test for combined page-break-{before,after,inside}:avoid");
+
+function test()
+{
+    var block;
+    createBlockWithRatioToPageHeight("page1-1", 0.4).style.breakBefore = "page";
+    // A block 'page2-1' must move to the next page because we cannot find any
+    // allowed page breaks till the end of block page2-8.
+    createBlockWithRatioToPageHeight("page2-1", 0.1).style.breakAfter = "avoid-page";
+    createBlockWithRatioToPageHeight("page2-2", 0.1);
+    createBlockWithRatioToPageHeight("page2-3", 0.1).style.breakBefore = "avoid-page";
+    createBlockWithRatioToPageHeight("page2-4", 0.1).style.breakBefore = "avoid-page";
+
+    block = createBlockWithRatioToPageHeight("page2-5", 0.1);
+    block.style.breakBefore = "avoid-page";
+    block.style.breakAfter = "avoid-page";
+
+    createBlockWithRatioToPageHeight("page2-6", 0.1);
+
+    block = createBlockWithNumberOfLines("page2-7", 4);
+    block.style.breakBefore = "avoid-page";
+    block.style.breakAfter = "avoid-page";
+    block.style.breakInside = "avoid-page";
+
+    createBlockWithRatioToPageHeight("page2-8", 0.1).style.breakBefore = "avoid-page";
+
+    pageNumberForElementShouldBe("page1-1", 1);
+    pageNumberForElementShouldBe("page2-1", 2);
+    // Omit tests for intermediate blocks.
+    pageNumberForElementShouldBe("page2-8", 2);
+
+    document.body.removeChild(document.getElementById("sandbox"));
+}
+
+var successfullyParsed = true;
diff --git a/LayoutTests/printing/script-tests/break-avoid.js b/LayoutTests/printing/script-tests/break-avoid.js
new file mode 100644 (file)
index 0000000..8a8b9cc
--- /dev/null
@@ -0,0 +1,35 @@
+description("Test for combined page-break-{before,after,inside}:avoid");
+
+function test()
+{
+    var block;
+    createBlockWithRatioToPageHeight("page1-1", 0.4).style.breakBefore = "page";
+    // A block 'page2-1' must move to the next page because we cannot find any
+    // allowed page breaks till the end of block page2-8.
+    createBlockWithRatioToPageHeight("page2-1", 0.1).style.breakAfter = "avoid";
+    createBlockWithRatioToPageHeight("page2-2", 0.1);
+    createBlockWithRatioToPageHeight("page2-3", 0.1).style.breakBefore = "avoid";
+    createBlockWithRatioToPageHeight("page2-4", 0.1).style.breakBefore = "avoid";
+
+    block = createBlockWithRatioToPageHeight("page2-5", 0.1);
+    block.style.breakBefore = "avoid";
+    block.style.breakAfter = "avoid";
+
+    createBlockWithRatioToPageHeight("page2-6", 0.1);
+
+    block = createBlockWithNumberOfLines("page2-7", 4);
+    block.style.breakBefore = "avoid";
+    block.style.breakAfter = "avoid";
+    block.style.breakInside = "avoid";
+
+    createBlockWithRatioToPageHeight("page2-8", 0.1).style.breakBefore = "avoid";
+
+    pageNumberForElementShouldBe("page1-1", 1);
+    pageNumberForElementShouldBe("page2-1", 2);
+    // Omit tests for intermediate blocks.
+    pageNumberForElementShouldBe("page2-8", 2);
+
+    document.body.removeChild(document.getElementById("sandbox"));
+}
+
+var successfullyParsed = true;
diff --git a/LayoutTests/printing/script-tests/break-display-none.js b/LayoutTests/printing/script-tests/break-display-none.js
new file mode 100644 (file)
index 0000000..39fe32c
--- /dev/null
@@ -0,0 +1,21 @@
+description("Test for page-break with 'display:none'");
+
+function test()
+{
+    createBlockWithRatioToPageHeight("page1-1", 0.1).style.breakBefore = "page";
+
+    // if 'display' is 'none', page break property should not have any effect.
+    var block = createBlockWithRatioToPageHeight("displaynone", 0.1);
+    block.style.breakBefore = "page";
+    block.style.display = "none";
+
+    createBlockWithRatioToPageHeight("page1-2", 0.1);
+
+    pageNumberForElementShouldBe("page1-1", 1);
+    pageNumberForElementShouldBe("displaynone", -1);
+    pageNumberForElementShouldBe("page1-2", 1);
+
+    document.body.removeChild(document.getElementById("sandbox"));
+}
+
+var successfullyParsed = true;
diff --git a/LayoutTests/printing/script-tests/break-inside-avoid-page.js b/LayoutTests/printing/script-tests/break-inside-avoid-page.js
new file mode 100644 (file)
index 0000000..10b6972
--- /dev/null
@@ -0,0 +1,42 @@
+description("Test for page-break-inside:avoid");
+
+function test()
+{
+    createBlockWithRatioToPageHeight("page1-1", 0.5).style.breakBefore = "page";
+    // block 'page1-2' should be splitted.
+    createBlockWithNumberOfLines("page1-2", 20);
+    createBlockWithRatioToPageHeight("page2", 0.1);
+
+    createBlockWithRatioToPageHeight("page3", 0.5).style.breakBefore = "page";
+    // We should place block 'page4' in the next page because of 'page-break-inside: avoid'.
+    createBlockWithNumberOfLines("page4", 20).style.breakInside = "avoid-page";
+
+    createBlockWithRatioToPageHeight("page5", 0.8).style.breakBefore = "page";
+    // block 'page5-2' is a very large block, occupying more than 2 pages.
+    // We don't define from where this large block starts. Maybe from the next page.
+    createBlockWithNumberOfLines("page5or6", 20 * 2 + 10).style.breakInside = "avoid-page";
+    createBlockWithRatioToPageHeight("page8", 0.1);
+
+    createBlockWithRatioToPageHeight("page9-1", 0.1).style.breakBefore = "page";
+    createBlockWithRatioToPageHeight("page9-2", 0.1).style.breakAfter = "page";
+    // Make sure page-break only happens once, not twice.
+    createBlockWithNumberOfLines("page10", 20).style.breakInside = "avoid-page";
+
+    pageNumberForElementShouldBe('page1-1', 1);
+    pageNumberForElementShouldBe('page1-2', 1);
+    pageNumberForElementShouldBe('page2', 2);
+
+    pageNumberForElementShouldBe('page3', 3);
+    pageNumberForElementShouldBe('page4', 4);
+
+    pageNumberForElementShouldBe('page5', 5);
+    pageNumberForElementShouldBe('page8', 8);
+
+    pageNumberForElementShouldBe('page9-1', 9);
+    pageNumberForElementShouldBe('page9-2', 9);
+    pageNumberForElementShouldBe('page10', 10);
+
+    document.body.removeChild(document.getElementById("sandbox"));
+}
+
+var successfullyParsed = true;
diff --git a/LayoutTests/printing/script-tests/break-inside-avoid.js b/LayoutTests/printing/script-tests/break-inside-avoid.js
new file mode 100644 (file)
index 0000000..0182723
--- /dev/null
@@ -0,0 +1,42 @@
+description("Test for page-break-inside:avoid");
+
+function test()
+{
+    createBlockWithRatioToPageHeight("page1-1", 0.5).style.breakBefore = "page";
+    // block 'page1-2' should be splitted.
+    createBlockWithNumberOfLines("page1-2", 20);
+    createBlockWithRatioToPageHeight("page2", 0.1);
+
+    createBlockWithRatioToPageHeight("page3", 0.5).style.breakBefore = "page";
+    // We should place block 'page4' in the next page because of 'page-break-inside: avoid'.
+    createBlockWithNumberOfLines("page4", 20).style.breakInside = "avoid";
+
+    createBlockWithRatioToPageHeight("page5", 0.8).style.breakBefore = "page";
+    // block 'page5-2' is a very large block, occupying more than 2 pages.
+    // We don't define from where this large block starts. Maybe from the next page.
+    createBlockWithNumberOfLines("page5or6", 20 * 2 + 10).style.breakInside = "avoid";
+    createBlockWithRatioToPageHeight("page8", 0.1);
+
+    createBlockWithRatioToPageHeight("page9-1", 0.1).style.breakBefore = "page";
+    createBlockWithRatioToPageHeight("page9-2", 0.1).style.breakAfter = "page";
+    // Make sure page-break only happens once, not twice.
+    createBlockWithNumberOfLines("page10", 20).style.breakInside = "avoid";
+
+    pageNumberForElementShouldBe('page1-1', 1);
+    pageNumberForElementShouldBe('page1-2', 1);
+    pageNumberForElementShouldBe('page2', 2);
+
+    pageNumberForElementShouldBe('page3', 3);
+    pageNumberForElementShouldBe('page4', 4);
+
+    pageNumberForElementShouldBe('page5', 5);
+    pageNumberForElementShouldBe('page8', 8);
+
+    pageNumberForElementShouldBe('page9-1', 9);
+    pageNumberForElementShouldBe('page9-2', 9);
+    pageNumberForElementShouldBe('page10', 10);
+
+    document.body.removeChild(document.getElementById("sandbox"));
+}
+
+var successfullyParsed = true;
index 8c93e7f..b910cbc 100644 (file)
@@ -1,3 +1,94 @@
+2016-01-30 Dave Hyatt  <hyatt@apple.com>
+
+        Support break-after, break-before and break-inside.
+        https://bugs.webkit.org/show_bug.cgi?id=148814
+
+        Reviewed by Dean Jackson.
+
+        New tests added in printing/, fast/multicol/, and fast/regions.
+
+        * css/CSSComputedStyleDeclaration.cpp:
+        (WebCore::convertToPageBreak):
+        (WebCore::convertToColumnBreak):
+        (WebCore::convertToRegionBreak):
+        For backwards compatibility, keep support for all the old properties in
+        computed style. This means we have to convert the break-* property values
+        into keywords that make sense for the legacy properties. This mainly
+        involves mapping "page", "column", "region" to "always" (similar rule for
+        the avoid-* versions as well).
+
+        (WebCore::ComputedStyleExtractor::propertyValue):
+        Add support for the three new break-* properties.
+
+        * css/CSSParser.cpp:
+        (WebCore::isValidKeywordPropertyAndValue):
+        (WebCore::isKeywordPropertyID):
+        (WebCore::CSSParser::parseValue):
+        Add support for the new break properties.
+
+        * css/CSSPrimitiveValueMappings.h:
+        (WebCore::CSSPrimitiveValue::operator BreakBetween):
+        (WebCore::CSSPrimitiveValue::operator BreakInside):
+        Add converters for the new BreakBetween and BreakInside enums. Remove
+        the EPageBreak enum, since it is no longer used.
+
+        * css/CSSPropertyNames.in:
+        * css/CSSValueKeywords.in:
+        Add the new properties and the new values supported by the properties
+        to the keywords lists.
+
+        * css/StyleBuilderConverter.h:
+        (WebCore::StyleBuilderConverter::convertFontSynthesis):
+        (WebCore::StyleBuilderConverter::convertPageBreakBetween):
+        (WebCore::StyleBuilderConverter::convertPageBreakInside):
+        (WebCore::StyleBuilderConverter::convertColumnBreakBetween):
+        (WebCore::StyleBuilderConverter::convertColumnBreakInside):
+        (WebCore::StyleBuilderConverter::convertRegionBreakBetween):
+        (WebCore::StyleBuilderConverter::convertRegionBreakInside):
+        In order to map the legacy properties into the new break-* values
+        we have custom converter functions.
+
+        * rendering/RenderBlock.cpp:
+        (WebCore::RenderBlock::paintChild):
+        (WebCore::RenderBlock::childBoxIsUnsplittableForFragmentation):
+        (WebCore::RenderBlock::computeRegionRangeForBoxChild):
+        * rendering/RenderBlockFlow.cpp:
+        (WebCore::RenderBlockFlow::applyBeforeBreak):
+        (WebCore::RenderBlockFlow::applyAfterBreak):
+        Patch the block code to check the correct new break-* constants. For
+        avoidance, this means checking both the general avoid value and the
+        specific value (e.g., avoid-page). In place of "always", we check
+        the specific value (e.g., column) and then for page specifically, we
+        also treat "left", "right", "recto" and "verso" as "always break" for now.
+
+        * rendering/style/RenderStyle.cpp:
+        (WebCore::RenderStyle::changeRequiresLayout):
+        Make sure changes to the break properties trigger relayout.
+
+        * rendering/style/RenderStyle.h:
+        Add getters and setters for the break-* properties and remove all
+        occurrences of the legacy page, column and region values from the RenderStyle.
+
+        * rendering/style/RenderStyleConstants.cpp:
+        (WebCore::alwaysPageBreak):
+        We have a helper function here for mapping several constant values to "page".
+
+        * rendering/style/RenderStyleConstants.h:
+        Definitions of the new BreakBetween and BreakInside enums.
+
+        * rendering/style/StyleMultiColData.cpp:
+        (WebCore::StyleMultiColData::StyleMultiColData):
+        (WebCore::StyleMultiColData::operator==):
+        * rendering/style/StyleMultiColData.h:
+        Remove the column-specific break data.
+
+        * rendering/style/StyleRareNonInheritedData.cpp:
+        (WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData):
+        (WebCore::StyleRareNonInheritedData::operator==):
+        * rendering/style/StyleRareNonInheritedData.h:
+        Remove the region-specific break data and replace it with generic break
+        data that is now used by all three pagination models.
+
 2016-01-29  Per Arne Vollan  <peavo@outlook.com>
 
         [Win] Fix compile error.
index 6b1da99..111b147 100644 (file)
@@ -2069,6 +2069,57 @@ inline bool paddingOrMarginIsRendererDependent(RenderStyle* style, RenderObject*
     return !(style && (style->*lengthGetter)().isFixed());
 }
 
+static CSSValueID convertToPageBreak(BreakBetween value)
+{
+    if (value == PageBreakBetween || value == LeftPageBreakBetween || value == RightPageBreakBetween
+        || value == RectoPageBreakBetween || value == VersoPageBreakBetween)
+        return CSSValueAlways; // CSS 2.1 allows us to map these to always.
+    if (value == AvoidBreakBetween || value == AvoidPageBreakBetween)
+        return CSSValueAvoid;
+    return CSSValueAuto;
+}
+
+static CSSValueID convertToColumnBreak(BreakBetween value)
+{
+    if (value == ColumnBreakBetween)
+        return CSSValueAlways;
+    if (value == AvoidBreakBetween || value == AvoidColumnBreakBetween)
+        return CSSValueAvoid;
+    return CSSValueAuto;
+}
+
+static CSSValueID convertToPageBreak(BreakInside value)
+{
+    if (value == AvoidBreakInside || value == AvoidPageBreakInside)
+        return CSSValueAvoid;
+    return CSSValueAuto;
+}
+
+static CSSValueID convertToColumnBreak(BreakInside value)
+{
+    if (value == AvoidBreakInside || value == AvoidColumnBreakInside)
+        return CSSValueAvoid;
+    return CSSValueAuto;
+}
+
+#if ENABLE(CSS_REGIONS)
+static CSSValueID convertToRegionBreak(BreakBetween value)
+{
+    if (value == RegionBreakBetween)
+        return CSSValueAlways;
+    if (value == AvoidBreakBetween || value == AvoidRegionBreakBetween)
+        return CSSValueAvoid;
+    return CSSValueAuto;
+}
+    
+static CSSValueID convertToRegionBreak(BreakInside value)
+{
+    if (value == AvoidBreakInside || value == AvoidRegionBreakInside)
+        return CSSValueAvoid;
+    return CSSValueAuto;
+}
+#endif
+    
 static bool isLayoutDependent(CSSPropertyID propertyID, RenderStyle* style, RenderObject* renderer)
 {
     switch (propertyID) {
@@ -2604,11 +2655,11 @@ RefPtr<CSSValue> ComputedStyleExtractor::propertyValue(CSSPropertyID propertyID,
         case CSSPropertyColumnSpan:
             return cssValuePool.createIdentifierValue(style->columnSpan() ? CSSValueAll : CSSValueNone);
         case CSSPropertyWebkitColumnBreakAfter:
-            return cssValuePool.createValue(style->columnBreakAfter());
+            return cssValuePool.createValue(convertToColumnBreak(style->breakAfter()));
         case CSSPropertyWebkitColumnBreakBefore:
-            return cssValuePool.createValue(style->columnBreakBefore());
+            return cssValuePool.createValue(convertToColumnBreak(style->breakBefore()));
         case CSSPropertyWebkitColumnBreakInside:
-            return cssValuePool.createValue(style->columnBreakInside());
+            return cssValuePool.createValue(convertToColumnBreak(style->breakInside()));
         case CSSPropertyColumnWidth:
             if (style->hasAutoColumnWidth())
                 return cssValuePool.createIdentifierValue(CSSValueAuto);
@@ -2617,11 +2668,11 @@ RefPtr<CSSValue> ComputedStyleExtractor::propertyValue(CSSPropertyID propertyID,
             return cssValuePool.createValue(style->tabSize(), CSSPrimitiveValue::CSS_NUMBER);
 #if ENABLE(CSS_REGIONS)
         case CSSPropertyWebkitRegionBreakAfter:
-            return cssValuePool.createValue(style->regionBreakAfter());
+            return cssValuePool.createValue(convertToRegionBreak(style->breakAfter()));
         case CSSPropertyWebkitRegionBreakBefore:
-            return cssValuePool.createValue(style->regionBreakBefore());
+            return cssValuePool.createValue(convertToRegionBreak(style->breakBefore()));
         case CSSPropertyWebkitRegionBreakInside:
-            return cssValuePool.createValue(style->regionBreakInside());
+            return cssValuePool.createValue(convertToRegionBreak(style->breakInside()));
 #endif
         case CSSPropertyCursor: {
             RefPtr<CSSValueList> list;
@@ -2956,16 +3007,17 @@ RefPtr<CSSValue> ComputedStyleExtractor::propertyValue(CSSPropertyID propertyID,
         case CSSPropertyPaddingLeft:
             return zoomAdjustedPaddingOrMarginPixelValue<&RenderStyle::paddingLeft, &RenderBoxModelObject::computedCSSPaddingLeft>(*style, renderer);
         case CSSPropertyPageBreakAfter:
-            return cssValuePool.createValue(style->pageBreakAfter());
+            return cssValuePool.createValue(convertToPageBreak(style->breakAfter()));
         case CSSPropertyPageBreakBefore:
-            return cssValuePool.createValue(style->pageBreakBefore());
-        case CSSPropertyPageBreakInside: {
-            EPageBreak pageBreak = style->pageBreakInside();
-            ASSERT(pageBreak != PBALWAYS);
-            if (pageBreak == PBALWAYS)
-                return nullptr;
-            return cssValuePool.createValue(style->pageBreakInside());
-        }
+            return cssValuePool.createValue(convertToPageBreak(style->breakBefore()));
+        case CSSPropertyPageBreakInside:
+            return cssValuePool.createValue(convertToPageBreak(style->breakInside()));
+        case CSSPropertyBreakAfter:
+            return cssValuePool.createValue(style->breakAfter());
+        case CSSPropertyBreakBefore:
+            return cssValuePool.createValue(style->breakBefore());
+        case CSSPropertyBreakInside:
+            return cssValuePool.createValue(style->breakInside());
         case CSSPropertyPosition:
             return cssValuePool.createValue(style->position());
         case CSSPropertyRight:
index 6cdb944..daeb1d1 100644 (file)
@@ -1043,6 +1043,20 @@ static inline bool isValidKeywordPropertyAndValue(CSSPropertyID propertyId, int
         if (valueID == CSSValueNormal || valueID == CSSValueHistoricalForms)
             return true;
         break;
+            
+    case CSSPropertyBreakAfter:
+    case CSSPropertyBreakBefore:
+        // auto | avoid | left | right | recto | verso | column | page | region | avoid-page | avoid-column | avoid-region
+        if (valueID == CSSValueAuto || valueID == CSSValueAvoid || valueID == CSSValueLeft || valueID == CSSValueRight
+            || valueID == CSSValueRecto || valueID == CSSValueVerso || valueID == CSSValueColumn || valueID == CSSValuePage
+            || valueID == CSSValueRegion || valueID == CSSValueAvoidColumn || valueID == CSSValueAvoidPage || valueID == CSSValueAvoidRegion)
+            return true;
+        break;
+    case CSSPropertyBreakInside:
+        // auto | avoid | avoid-page | avoid-column | avoid-region
+        if (valueID == CSSValueAuto || valueID == CSSValueAvoid || valueID == CSSValueAvoidColumn || valueID == CSSValueAvoidPage || valueID == CSSValueAvoidRegion)
+            return true;
+        break;
     default:
         ASSERT_NOT_REACHED();
         return false;
@@ -1062,6 +1076,9 @@ static inline bool isKeywordPropertyID(CSSPropertyID propertyId)
     case CSSPropertyBorderRightStyle:
     case CSSPropertyBorderTopStyle:
     case CSSPropertyBoxSizing:
+    case CSSPropertyBreakAfter:
+    case CSSPropertyBreakBefore:
+    case CSSPropertyBreakInside:
     case CSSPropertyCaptionSide:
     case CSSPropertyClear:
     case CSSPropertyDirection:
@@ -3165,6 +3182,9 @@ bool CSSParser::parseValue(CSSPropertyID propId, bool important)
     case CSSPropertyBorderRightStyle:
     case CSSPropertyBorderTopStyle:
     case CSSPropertyBoxSizing:
+    case CSSPropertyBreakAfter:
+    case CSSPropertyBreakBefore:
+    case CSSPropertyBreakInside:
     case CSSPropertyCaptionSide:
     case CSSPropertyClear:
     case CSSPropertyDirection:
index 67aad2b..b4d43ae 100644 (file)
@@ -2201,42 +2201,131 @@ template<> inline CSSPrimitiveValue::operator EOverflow() const
     return OVISIBLE;
 }
 
-template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EPageBreak e)
+template<> inline CSSPrimitiveValue::CSSPrimitiveValue(BreakBetween e)
     : CSSValue(PrimitiveClass)
 {
     m_primitiveUnitType = CSS_VALUE_ID;
     switch (e) {
-    case PBAUTO:
+    case AutoBreakBetween:
         m_value.valueID = CSSValueAuto;
         break;
-    case PBALWAYS:
-        m_value.valueID = CSSValueAlways;
-        break;
-    case PBAVOID:
+    case AvoidBreakBetween:
         m_value.valueID = CSSValueAvoid;
         break;
+    case AvoidColumnBreakBetween:
+        m_value.valueID = CSSValueAvoidColumn;
+        break;
+    case AvoidPageBreakBetween:
+        m_value.valueID = CSSValueAvoidPage;
+        break;
+    case AvoidRegionBreakBetween:
+        m_value.valueID = CSSValueAvoidRegion;
+        break;
+    case ColumnBreakBetween:
+        m_value.valueID = CSSValueColumn;
+        break;
+    case PageBreakBetween:
+        m_value.valueID = CSSValuePage;
+        break;
+    case RegionBreakBetween:
+        m_value.valueID = CSSValueRegion;
+        break;
+    case LeftPageBreakBetween:
+        m_value.valueID = CSSValueLeft;
+        break;
+    case RightPageBreakBetween:
+        m_value.valueID = CSSValueRight;
+        break;
+    case RectoPageBreakBetween:
+        m_value.valueID = CSSValueRecto;
+        break;
+    case VersoPageBreakBetween:
+        m_value.valueID = CSSValueVerso;
+        break;
     }
 }
 
-template<> inline CSSPrimitiveValue::operator EPageBreak() const
+template<> inline CSSPrimitiveValue::operator BreakBetween() const
 {
     ASSERT(isValueID());
 
     switch (m_value.valueID) {
     case CSSValueAuto:
-        return PBAUTO;
+        return AutoBreakBetween;
+    case CSSValueAvoid:
+        return AvoidBreakBetween;
+    case CSSValueAvoidColumn:
+        return AvoidColumnBreakBetween;
+    case CSSValueAvoidPage:
+        return AvoidPageBreakBetween;
+    case CSSValueAvoidRegion:
+        return AvoidRegionBreakBetween;
+    case CSSValueColumn:
+        return ColumnBreakBetween;
+    case CSSValuePage:
+        return PageBreakBetween;
+    case CSSValueRegion:
+        return RegionBreakBetween;
     case CSSValueLeft:
+        return LeftPageBreakBetween;
     case CSSValueRight:
-    case CSSValueAlways:
-        return PBALWAYS; // CSS2.1: "Conforming user agents may map left/right to always."
+        return RightPageBreakBetween;
+    case CSSValueRecto:
+        return RectoPageBreakBetween;
+    case CSSValueVerso:
+        return VersoPageBreakBetween;
+    default:
+        break;
+    }
+
+    ASSERT_NOT_REACHED();
+    return AutoBreakBetween;
+}
+
+template<> inline CSSPrimitiveValue::CSSPrimitiveValue(BreakInside e)
+    : CSSValue(PrimitiveClass)
+{
+    m_primitiveUnitType = CSS_VALUE_ID;
+    switch (e) {
+    case AutoBreakInside:
+        m_value.valueID = CSSValueAuto;
+        break;
+    case AvoidBreakInside:
+        m_value.valueID = CSSValueAvoid;
+        break;
+    case AvoidColumnBreakInside:
+        m_value.valueID = CSSValueAvoidColumn;
+        break;
+    case AvoidPageBreakInside:
+        m_value.valueID = CSSValueAvoidPage;
+        break;
+    case AvoidRegionBreakInside:
+        m_value.valueID = CSSValueAvoidRegion;
+        break;
+    }
+}
+
+template<> inline CSSPrimitiveValue::operator BreakInside() const
+{
+    ASSERT(isValueID());
+    
+    switch (m_value.valueID) {
+    case CSSValueAuto:
+        return AutoBreakInside;
     case CSSValueAvoid:
-        return PBAVOID;
+        return AvoidBreakInside;
+    case CSSValueAvoidColumn:
+        return AvoidColumnBreakInside;
+    case CSSValueAvoidPage:
+        return AvoidPageBreakInside;
+    case CSSValueAvoidRegion:
+        return AvoidRegionBreakInside;
     default:
         break;
     }
 
     ASSERT_NOT_REACHED();
-    return PBAUTO;
+    return AutoBreakInside;
 }
 
 template<> inline CSSPrimitiveValue::CSSPrimitiveValue(EPosition e)
index 8fbda41..1f6a704 100644 (file)
@@ -196,6 +196,9 @@ border-width [Longhands=border-top-width|border-right-width|border-bottom-width|
 bottom [Initial=initialOffset, Converter=LengthOrAuto]
 box-shadow [Custom=All]
 box-sizing
+break-after [Initial=initialBreakBetween]
+break-before [Initial=initialBreakBetween]
+break-inside [Initial=initialBreakInside]
 buffered-rendering [SVG]
 // -webkit-box-sizing worked in Safari 4 and earlier.
 -webkit-box-sizing = box-sizing
@@ -290,9 +293,9 @@ padding-left [Initial=initialPadding, Converter=Length]
 padding-right [Initial=initialPadding, Converter=Length]
 padding-top [Initial=initialPadding, Converter=Length]
 page [SkipBuilder]
-page-break-after [Initial=initialPageBreak]
-page-break-before [Initial=initialPageBreak]
-page-break-inside [Initial=initialPageBreak]
+page-break-after [Initial=initialBreakBetween, NameForMethods=BreakAfter, Converter=PageBreakBetween]
+page-break-before [Initial=initialBreakBetween, NameForMethods=BreakBefore, Converter=PageBreakBetween]
+page-break-inside [Initial=initialBreakInside, NameForMethods=BreakInside, Converter=PageBreakInside]
 paint-order [SVG, Converter=PaintOrder]
 pointer-events [Inherited]
 position
@@ -427,9 +430,9 @@ alt [NameForMethods=ContentAltText, Custom=Value]
 // w_r > 8px, b_r = 8 + 4 * sqrt((w_r - 8) / 2).
 -webkit-box-shadow [Custom=All]
 -webkit-column-axis
--webkit-column-break-after [Initial=initialPageBreak]
--webkit-column-break-before [Initial=initialPageBreak]
--webkit-column-break-inside [Initial=initialPageBreak]
+-webkit-column-break-after [Initial=initialBreakBetween, NameForMethods=BreakAfter, Converter=ColumnBreakBetween]
+-webkit-column-break-before [Initial=initialBreakBetween, NameForMethods=BreakBefore, Converter=ColumnBreakBetween]
+-webkit-column-break-inside [Initial=initialBreakInside, NameForMethods=BreakInside, Converter=ColumnBreakInside]
 column-count [AutoFunctions]
 -webkit-column-count = column-count
 column-fill
@@ -642,9 +645,9 @@ transform-style [NameForMethods=TransformStyle3D]
 -webkit-flow-into [NameForMethods=FlowThread, Converter=StringOrNone]
 -webkit-flow-from [NameForMethods=RegionThread, Converter=StringOrNone]
 -webkit-region-fragment
--webkit-region-break-after [Initial=initialPageBreak]
--webkit-region-break-before [Initial=initialPageBreak]
--webkit-region-break-inside [Initial=initialPageBreak]
+-webkit-region-break-after [Initial=initialBreakBetween, NameForMethods=BreakAfter, Converter=RegionBreakBetween]
+-webkit-region-break-before [Initial=initialBreakBetween, NameForMethods=BreakBefore, Converter=RegionBreakBetween]
+-webkit-region-break-inside [Initial=initialBreakInside, NameForMethods=BreakInside, Converter=RegionBreakInside]
 #endif
 #if defined(ENABLE_CSS_SHAPES) && ENABLE_CSS_SHAPES
 -webkit-shape-outside [Converter=ShapeValue]
index ae5ec2c..4f4e84d 100644 (file)
@@ -832,6 +832,17 @@ content-box
 padding
 padding-box
 
+//
+// CSS_PROP_BREAK_BEFORE/AFTER/INSIDE
+//
+avoid-column
+avoid-page
+avoid-region
+page
+recto
+region
+verso
+
 // CSS_SHAPES
 margin-box
 
index 9e21e38..20cb520 100644 (file)
@@ -126,6 +126,15 @@ public:
     static EGlyphOrientation convertGlyphOrientationOrAuto(StyleResolver&, CSSValue&);
     static Optional<Length> convertLineHeight(StyleResolver&, CSSValue&, float multiplier = 1.f);
     static FontSynthesis convertFontSynthesis(StyleResolver&, CSSValue&);
+    
+    static BreakBetween convertPageBreakBetween(StyleResolver&, CSSValue&);
+    static BreakInside convertPageBreakInside(StyleResolver&, CSSValue&);
+    static BreakBetween convertColumnBreakBetween(StyleResolver&, CSSValue&);
+    static BreakInside convertColumnBreakInside(StyleResolver&, CSSValue&);
+#if ENABLE(CSS_REGIONS)
+    static BreakBetween convertRegionBreakBetween(StyleResolver&, CSSValue&);
+    static BreakInside convertRegionBreakInside(StyleResolver&, CSSValue&);
+#endif
 
 private:
     friend class StyleBuilderCustom;
@@ -1214,6 +1223,62 @@ FontSynthesis StyleBuilderConverter::convertFontSynthesis(StyleResolver&, CSSVal
     return result;
 }
 
+inline BreakBetween StyleBuilderConverter::convertPageBreakBetween(StyleResolver&, CSSValue& value)
+{
+    auto& primitiveValue = downcast<CSSPrimitiveValue>(value);
+    if (primitiveValue.getValueID() == CSSValueAlways)
+        return PageBreakBetween;
+    if (primitiveValue.getValueID() == CSSValueAvoid)
+        return AvoidPageBreakBetween;
+    return primitiveValue;
+}
+
+inline BreakInside StyleBuilderConverter::convertPageBreakInside(StyleResolver&, CSSValue& value)
+{
+    auto& primitiveValue = downcast<CSSPrimitiveValue>(value);
+    if (primitiveValue.getValueID() == CSSValueAvoid)
+        return AvoidPageBreakInside;
+    return primitiveValue;
+}
+
+inline BreakBetween StyleBuilderConverter::convertColumnBreakBetween(StyleResolver&, CSSValue& value)
+{
+    auto& primitiveValue = downcast<CSSPrimitiveValue>(value);
+    if (primitiveValue.getValueID() == CSSValueAlways)
+        return ColumnBreakBetween;
+    if (primitiveValue.getValueID() == CSSValueAvoid)
+        return AvoidColumnBreakBetween;
+    return primitiveValue;
+}
+
+inline BreakInside StyleBuilderConverter::convertColumnBreakInside(StyleResolver&, CSSValue& value)
+{
+    auto& primitiveValue = downcast<CSSPrimitiveValue>(value);
+    if (primitiveValue.getValueID() == CSSValueAvoid)
+        return AvoidColumnBreakInside;
+    return primitiveValue;
+}
+
+#if ENABLE(CSS_REGIONS)
+inline BreakBetween StyleBuilderConverter::convertRegionBreakBetween(StyleResolver&, CSSValue& value)
+{
+    auto& primitiveValue = downcast<CSSPrimitiveValue>(value);
+    if (primitiveValue.getValueID() == CSSValueAlways)
+        return RegionBreakBetween;
+    if (primitiveValue.getValueID() == CSSValueAvoid)
+        return AvoidRegionBreakBetween;
+    return primitiveValue;
+}
+
+inline BreakInside StyleBuilderConverter::convertRegionBreakInside(StyleResolver&, CSSValue& value)
+{
+    auto& primitiveValue = downcast<CSSPrimitiveValue>(value);
+    if (primitiveValue.getValueID() == CSSValueAvoid)
+        return AvoidRegionBreakInside;
+    return primitiveValue;
+}
+#endif
+
 } // namespace WebCore
 
 #endif // StyleBuilderConverter_h
index c4065cb..72bfdf0 100644 (file)
@@ -1470,7 +1470,7 @@ void RenderBlock::paintChildren(PaintInfo& paintInfo, const LayoutPoint& paintOf
 bool RenderBlock::paintChild(RenderBox& child, PaintInfo& paintInfo, const LayoutPoint& paintOffset, PaintInfo& paintInfoForChild, bool usePrintRect, PaintBlockType paintType)
 {
     // Check for page-break-before: always, and if it's set, break and bail.
-    bool checkBeforeAlways = !childrenInline() && (usePrintRect && child.style().pageBreakBefore() == PBALWAYS);
+    bool checkBeforeAlways = !childrenInline() && (usePrintRect && alwaysPageBreak(child.style().breakBefore()));
     LayoutUnit absoluteChildY = paintOffset.y() + child.y();
     if (checkBeforeAlways
         && absoluteChildY > paintInfo.rect.y()
@@ -1499,7 +1499,7 @@ bool RenderBlock::paintChild(RenderBox& child, PaintInfo& paintInfo, const Layou
     }
 
     // Check for page-break-after: always, and if it's set, break and bail.
-    bool checkAfterAlways = !childrenInline() && (usePrintRect && child.style().pageBreakAfter() == PBALWAYS);
+    bool checkAfterAlways = !childrenInline() && (usePrintRect && alwaysPageBreak(child.style().breakAfter()));
     if (checkAfterAlways
         && (absoluteChildY + child.height()) > paintInfo.rect.y()
         && (absoluteChildY + child.height()) < paintInfo.rect.maxY()) {
@@ -3533,9 +3533,10 @@ bool RenderBlock::childBoxIsUnsplittableForFragmentation(const RenderBox& child)
     bool checkColumnBreaks = flowThread && flowThread->shouldCheckColumnBreaks();
     bool checkPageBreaks = !checkColumnBreaks && view().layoutState()->m_pageLogicalHeight;
     bool checkRegionBreaks = flowThread && flowThread->isRenderNamedFlowThread();
-    return child.isUnsplittableForPagination() || (checkColumnBreaks && child.style().columnBreakInside() == PBAVOID)
-        || (checkPageBreaks && child.style().pageBreakInside() == PBAVOID)
-        || (checkRegionBreaks && child.style().regionBreakInside() == PBAVOID);
+    return child.isUnsplittableForPagination() || child.style().breakInside() == AvoidBreakInside
+        || (checkColumnBreaks && child.style().breakInside() == AvoidColumnBreakInside)
+        || (checkPageBreaks && child.style().breakInside() == AvoidPageBreakInside)
+        || (checkRegionBreaks && child.style().breakInside() == AvoidRegionBreakInside);
 }
 
 void RenderBlock::computeRegionRangeForBoxChild(const RenderBox& box) const
index cdf85de..95bc9e7 100644 (file)
@@ -1490,9 +1490,9 @@ LayoutUnit RenderBlockFlow::applyBeforeBreak(RenderBox& child, LayoutUnit logica
     bool checkColumnBreaks = flowThread && flowThread->shouldCheckColumnBreaks();
     bool checkPageBreaks = !checkColumnBreaks && view().layoutState()->m_pageLogicalHeight; // FIXME: Once columns can print we have to check this.
     bool checkRegionBreaks = flowThread && flowThread->isRenderNamedFlowThread();
-    bool checkBeforeAlways = (checkColumnBreaks && child.style().columnBreakBefore() == PBALWAYS)
-        || (checkPageBreaks && child.style().pageBreakBefore() == PBALWAYS)
-        || (checkRegionBreaks && child.style().regionBreakBefore() == PBALWAYS);
+    bool checkBeforeAlways = (checkColumnBreaks && child.style().breakBefore() == ColumnBreakBetween)
+        || (checkPageBreaks && alwaysPageBreak(child.style().breakBefore()))
+        || (checkRegionBreaks && child.style().breakBefore() == RegionBreakBetween);
     if (checkBeforeAlways && inNormalFlow(child) && hasNextPage(logicalOffset, IncludePageBoundary)) {
         if (checkColumnBreaks) {
             if (isInsideMulticolFlowThread)
@@ -1516,9 +1516,9 @@ LayoutUnit RenderBlockFlow::applyAfterBreak(RenderBox& child, LayoutUnit logical
     bool checkColumnBreaks = flowThread && flowThread->shouldCheckColumnBreaks();
     bool checkPageBreaks = !checkColumnBreaks && view().layoutState()->m_pageLogicalHeight; // FIXME: Once columns can print we have to check this.
     bool checkRegionBreaks = flowThread && flowThread->isRenderNamedFlowThread();
-    bool checkAfterAlways = (checkColumnBreaks && child.style().columnBreakAfter() == PBALWAYS)
-        || (checkPageBreaks && child.style().pageBreakAfter() == PBALWAYS)
-        || (checkRegionBreaks && child.style().regionBreakAfter() == PBALWAYS);
+    bool checkAfterAlways = (checkColumnBreaks && child.style().breakAfter() == ColumnBreakBetween)
+        || (checkPageBreaks && alwaysPageBreak(child.style().breakAfter()))
+        || (checkRegionBreaks && child.style().breakAfter() == RegionBreakBetween);
     if (checkAfterAlways && inNormalFlow(child) && hasNextPage(logicalOffset, IncludePageBoundary)) {
         LayoutUnit marginOffset = marginInfo.canCollapseWithMarginBefore() ? LayoutUnit() : marginInfo.margin();
 
index 0bd9a89..0728422 100644 (file)
@@ -686,6 +686,12 @@ bool RenderStyle::changeRequiresLayout(const RenderStyle& other, unsigned& chang
     if (rareNonInheritedData->m_textCombine != other.rareNonInheritedData->m_textCombine)
         return true;
 
+    // Check breaks.
+    if (rareNonInheritedData->m_breakBefore != other.rareNonInheritedData->m_breakBefore
+        || rareNonInheritedData->m_breakAfter != other.rareNonInheritedData->m_breakAfter
+        || rareNonInheritedData->m_breakInside != other.rareNonInheritedData->m_breakInside)
+        return true;
+
     // Overflow returns a layout hint.
     if (noninherited_flags.overflowX() != other.noninherited_flags.overflowX()
         || noninherited_flags.overflowY() != other.noninherited_flags.overflowY())
index adf105d..fff3409 100644 (file)
@@ -169,9 +169,6 @@ public:
                 | unicodeBidiMask << unicodeBidiOffset
                 | verticalAlignMask << verticalAlignOffset
                 | floatingMask << floatingOffset
-                | pageBreakMask << pageBreakInsideOffset
-                | pageBreakMask << pageBreakBeforeOffset
-                | pageBreakMask << pageBreakAfterOffset
                 | oneBitMask << explicitInheritanceOffset
                 | tableLayoutBitMask << tableLayoutOffset
                 | hasViewportUnitsBitMask << hasViewportUnitsOffset;
@@ -213,16 +210,6 @@ public:
         EFloat floating() const { return static_cast<EFloat>(getValue(floatingMask, floatingOffset)); }
         void setFloating(EFloat floating) { updateValue(floating, floatingMask, floatingOffset); }
 
-        // For valid values of page-break-inside see http://www.w3.org/TR/CSS21/page.html#page-break-props
-        EPageBreak pageBreakInside() const { return static_cast<EPageBreak>(getValue(pageBreakMask, pageBreakInsideOffset)); }
-        void setPageBreakInside(EPageBreak pageBreakInside) { ASSERT(pageBreakInside == PBAUTO || pageBreakInside == PBAVOID); updateValue(pageBreakInside, pageBreakMask, pageBreakInsideOffset); }
-
-        EPageBreak pageBreakBefore() const { return static_cast<EPageBreak>(getValue(pageBreakMask, pageBreakBeforeOffset)); }
-        void setPageBreakBefore(EPageBreak pageBreakBefore) { updateValue(pageBreakBefore, pageBreakMask, pageBreakBeforeOffset); }
-
-        EPageBreak pageBreakAfter() const { return static_cast<EPageBreak>(getValue(pageBreakMask, pageBreakAfterOffset)); }
-        void setPageBreakAfter(EPageBreak pageBreakAfter) { updateValue(pageBreakAfter, pageBreakMask, pageBreakAfterOffset); }
-
         bool hasAnyPublicPseudoStyles() const { return PUBLIC_PSEUDOID_MASK & getValue(pseudoBitsMask, pseudoBitsOffset); }
         bool hasPseudoStyle(PseudoId pseudo) const
         {
@@ -347,30 +334,27 @@ public:
         static const unsigned floatingBitCount = 2;
         static const uint64_t floatingMask = (oneBitMask << floatingBitCount) - 1;
         static const unsigned floatingOffset = unicodeBidiOffset + unicodeBidiBitCount;
-        static const unsigned pageBreakBitCount = 2;
-        static const uint64_t pageBreakMask = (oneBitMask << pageBreakBitCount) - 1;
-        static const unsigned pageBreakInsideOffset = floatingOffset + floatingBitCount;
-        static const unsigned pageBreakBeforeOffset = pageBreakInsideOffset + pageBreakBitCount;
-        static const unsigned pageBreakAfterOffset = pageBreakBeforeOffset + pageBreakBitCount;
+        static const unsigned hasExplicitlySetDirectionBitcount = 1;
+        static const unsigned hasExplicitlySetDirectionOffset = floatingOffset + floatingBitCount;
+        static const unsigned hasExplicitlySetWritingModeBitcount = 1;
+        static const unsigned hasExplicitlySetWritingModeOffset = hasExplicitlySetDirectionOffset + hasExplicitlySetDirectionBitcount;
 
         // Byte 5.
         static const unsigned explicitInheritanceBitCount = 1;
-        static const unsigned explicitInheritanceOffset = pageBreakAfterOffset + pageBreakBitCount;
+        static const unsigned explicitInheritanceOffset = hasExplicitlySetWritingModeOffset + hasExplicitlySetWritingModeBitcount;
         static const unsigned tableLayoutBitCount = 1;
         static const uint64_t tableLayoutBitMask = oneBitMask;
         static const unsigned tableLayoutOffset = explicitInheritanceOffset + explicitInheritanceBitCount;
         static const unsigned verticalAlignBitCount = 4;
+        static const unsigned verticalAlignPadding = 2;
+        static const unsigned verticalAlignAndPaddingBitCount = verticalAlignBitCount + verticalAlignPadding;
         static const uint64_t verticalAlignMask = (oneBitMask << verticalAlignBitCount) - 1;
         static const unsigned verticalAlignOffset = tableLayoutOffset + tableLayoutBitCount;
-        static const unsigned hasExplicitlySetDirectionBitcount = 1;
-        static const unsigned hasExplicitlySetDirectionOffset = verticalAlignOffset + verticalAlignBitCount;
-        static const unsigned hasExplicitlySetWritingModeBitcount = 1;
-        static const unsigned hasExplicitlySetWritingModeOffset = hasExplicitlySetDirectionOffset + hasExplicitlySetDirectionBitcount;
 
         // Byte 6.
         static const unsigned pseudoBitsBitCount = 7;
         static const uint64_t pseudoBitsMask = (oneBitMask << pseudoBitsBitCount) - 1;
-        static const unsigned pseudoBitsOffset = hasExplicitlySetWritingModeOffset + hasExplicitlySetWritingModeBitcount;
+        static const unsigned pseudoBitsOffset = verticalAlignOffset + verticalAlignBitCount;
 
         static const unsigned hasViewportUnitsBitCount = 1;
         static const uint64_t hasViewportUnitsBitMask = (oneBitMask << hasViewportUnitsBitCount) - 1;
@@ -393,8 +377,7 @@ public:
         static const unsigned affectedByDragOffset = affectedByActiveOffset + 1;
         static const unsigned isLinkOffset = affectedByDragOffset + 1;
 
-
-        // 62 bits are assigned. There are 2 bits available currently used as padding to improve code generation.
+        // 60 bits are assigned. There are 4 bits available currently used as padding to improve code generation.
         // If you add more style bits here, you will also need to update RenderStyle::copyNonInheritedFrom().
         uint64_t m_flags;
     };
@@ -891,11 +874,11 @@ public:
     short orphans() const { return rareInheritedData->orphans; }
     bool hasAutoWidows() const { return rareInheritedData->m_hasAutoWidows; }
     bool hasAutoOrphans() const { return rareInheritedData->m_hasAutoOrphans; }
-    EPageBreak pageBreakInside() const { return noninherited_flags.pageBreakInside(); }
-    EPageBreak pageBreakBefore() const { return noninherited_flags.pageBreakBefore(); }
-    EPageBreak pageBreakAfter() const { return noninherited_flags.pageBreakAfter(); }
 
     // CSS3 Getter Methods
+    BreakInside breakInside() const { return static_cast<BreakInside>(rareNonInheritedData->m_breakInside); }
+    BreakBetween breakBefore() const { return static_cast<BreakBetween>(rareNonInheritedData->m_breakBefore); }
+    BreakBetween breakAfter() const { return static_cast<BreakBetween>(rareNonInheritedData->m_breakAfter); }
 
     float outlineOffset() const
     {
@@ -1038,12 +1021,7 @@ public:
     unsigned short columnRuleWidth() const { return rareNonInheritedData->m_multiCol->ruleWidth(); }
     bool columnRuleIsTransparent() const { return rareNonInheritedData->m_multiCol->m_rule.isTransparent(); }
     ColumnSpan columnSpan() const { return static_cast<ColumnSpan>(rareNonInheritedData->m_multiCol->m_columnSpan); }
-    EPageBreak columnBreakBefore() const { return static_cast<EPageBreak>(rareNonInheritedData->m_multiCol->m_breakBefore); }
-    EPageBreak columnBreakInside() const { return static_cast<EPageBreak>(rareNonInheritedData->m_multiCol->m_breakInside); }
-    EPageBreak columnBreakAfter() const { return static_cast<EPageBreak>(rareNonInheritedData->m_multiCol->m_breakAfter); }
-    EPageBreak regionBreakBefore() const { return static_cast<EPageBreak>(rareNonInheritedData->m_regionBreakBefore); }
-    EPageBreak regionBreakInside() const { return static_cast<EPageBreak>(rareNonInheritedData->m_regionBreakInside); }
-    EPageBreak regionBreakAfter() const { return static_cast<EPageBreak>(rareNonInheritedData->m_regionBreakAfter); }
+
     const TransformOperations& transform() const { return rareNonInheritedData->m_transform->m_operations; }
     const Length& transformOriginX() const { return rareNonInheritedData->m_transform->m_x; }
     const Length& transformOriginY() const { return rareNonInheritedData->m_transform->m_y; }
@@ -1509,11 +1487,6 @@ public:
     void setHasAutoOrphans() { SET_VAR(rareInheritedData, m_hasAutoOrphans, true); SET_VAR(rareInheritedData, orphans, initialOrphans()); }
     void setOrphans(short o) { SET_VAR(rareInheritedData, m_hasAutoOrphans, false); SET_VAR(rareInheritedData, orphans, o); }
 
-    // For valid values of page-break-inside see http://www.w3.org/TR/CSS21/page.html#page-break-props
-    void setPageBreakInside(EPageBreak b) { noninherited_flags.setPageBreakInside(b); }
-    void setPageBreakBefore(EPageBreak b) { noninherited_flags.setPageBreakBefore(b); }
-    void setPageBreakAfter(EPageBreak b) { noninherited_flags.setPageBreakAfter(b); }
-
     // CSS3 Setters
     void setOutlineOffset(float v) { SET_VAR(m_background, m_outline.m_offset, v); }
     void setTextShadow(std::unique_ptr<ShadowData>, bool add = false);
@@ -1620,13 +1593,6 @@ public:
     void setColumnRuleWidth(unsigned short w) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_rule.m_width, w); }
     void resetColumnRule() { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_rule, BorderValue()); }
     void setColumnSpan(ColumnSpan columnSpan) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_columnSpan, columnSpan); }
-    void setColumnBreakBefore(EPageBreak p) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_breakBefore, p); }
-    // For valid values of column-break-inside see http://www.w3.org/TR/css3-multicol/#break-before-break-after-break-inside
-    void setColumnBreakInside(EPageBreak p) { ASSERT(p == PBAUTO || p == PBAVOID); SET_VAR(rareNonInheritedData.access()->m_multiCol, m_breakInside, p); }
-    void setColumnBreakAfter(EPageBreak p) { SET_VAR(rareNonInheritedData.access()->m_multiCol, m_breakAfter, p); }
-    void setRegionBreakBefore(EPageBreak p) { SET_VAR(rareNonInheritedData, m_regionBreakBefore, p); }
-    void setRegionBreakInside(EPageBreak p) { ASSERT(p == PBAUTO || p == PBAVOID); SET_VAR(rareNonInheritedData, m_regionBreakInside, p); }
-    void setRegionBreakAfter(EPageBreak p) { SET_VAR(rareNonInheritedData, m_regionBreakAfter, p); }
     void inheritColumnPropertiesFrom(RenderStyle* parent) { rareNonInheritedData.access()->m_multiCol = parent->rareNonInheritedData->m_multiCol; }
     void setTransform(const TransformOperations& ops) { SET_VAR(rareNonInheritedData.access()->m_transform, m_operations, ops); }
     void setTransformOriginX(Length length) { SET_VAR(rareNonInheritedData.access()->m_transform, m_x, WTFMove(length)); }
@@ -1653,6 +1619,10 @@ public:
 
     void setTabSize(unsigned size) { SET_VAR(rareInheritedData, m_tabSize, size); }
 
+    void setBreakBefore(BreakBetween breakBehavior) { SET_VAR(rareNonInheritedData, m_breakBefore, breakBehavior); }
+    void setBreakAfter(BreakBetween breakBehavior) { SET_VAR(rareNonInheritedData, m_breakAfter, breakBehavior); }
+    void setBreakInside(BreakInside breakBehavior) { SET_VAR(rareNonInheritedData, m_breakInside, breakBehavior); }
+
     // End CSS3 Setters
 
     void setLineGrid(const AtomicString& lineGrid) { SET_VAR(rareInheritedData, m_lineGrid, lineGrid); }
@@ -1909,7 +1879,8 @@ public:
     static EPosition initialPosition() { return StaticPosition; }
     static EVerticalAlign initialVerticalAlign() { return BASELINE; }
     static EFloat initialFloating() { return NoFloat; }
-    static EPageBreak initialPageBreak() { return PBAUTO; }
+    static BreakBetween initialBreakBetween() { return AutoBreakBetween; }
+    static BreakInside initialBreakInside() { return AutoBreakInside; }
     static ETableLayout initialTableLayout() { return TAUTO; }
     static EBorderCollapse initialBorderCollapse() { return BSEPARATE; }
     static EBorderStyle initialBorderStyle() { return BNONE; }
index 358e160..831d179 100644 (file)
@@ -96,4 +96,9 @@ TextStream& operator<<(TextStream& ts, BackgroundEdgeOrigin edge)
     return ts;
 }
 
+bool alwaysPageBreak(BreakBetween between)
+{
+    return between >= PageBreakBetween;
+}
+
 } // namespace WebCore
index 4bbb008..187140e 100644 (file)
@@ -475,10 +475,15 @@ enum TextZoom {
     TextZoomNormal, TextZoomReset
 };
 
-enum EPageBreak {
-    PBAUTO, PBALWAYS, PBAVOID
+enum BreakBetween {
+    AutoBreakBetween, AvoidBreakBetween, AvoidColumnBreakBetween, AvoidPageBreakBetween, AvoidRegionBreakBetween, ColumnBreakBetween, RegionBreakBetween, PageBreakBetween, LeftPageBreakBetween, RightPageBreakBetween, RectoPageBreakBetween, VersoPageBreakBetween
 };
-
+bool alwaysPageBreak(BreakBetween);
+    
+enum BreakInside {
+    AutoBreakInside, AvoidBreakInside, AvoidColumnBreakInside, AvoidPageBreakInside, AvoidRegionBreakInside
+};
+    
 enum EEmptyCell {
     SHOW, HIDE
 };
index 3f7728b..5c90e20 100644 (file)
@@ -35,9 +35,6 @@ StyleMultiColData::StyleMultiColData()
     , m_normalGap(true)
     , m_fill(RenderStyle::initialColumnFill())
     , m_columnSpan(false)
-    , m_breakBefore(RenderStyle::initialPageBreak())
-    , m_breakAfter(RenderStyle::initialPageBreak())
-    , m_breakInside(RenderStyle::initialPageBreak())
     , m_axis(RenderStyle::initialColumnAxis())
     , m_progression(RenderStyle::initialColumnProgression())
 {
@@ -55,9 +52,6 @@ inline StyleMultiColData::StyleMultiColData(const StyleMultiColData& o)
     , m_normalGap(o.m_normalGap)
     , m_fill(o.m_fill)
     , m_columnSpan(o.m_columnSpan)
-    , m_breakBefore(o.m_breakBefore)
-    , m_breakAfter(o.m_breakAfter)
-    , m_breakInside(o.m_breakInside)
     , m_axis(o.m_axis)
     , m_progression(o.m_progression)
 {
@@ -71,10 +65,9 @@ Ref<StyleMultiColData> StyleMultiColData::copy() const
 bool StyleMultiColData::operator==(const StyleMultiColData& o) const
 {
     return m_width == o.m_width && m_count == o.m_count && m_gap == o.m_gap
-        && m_rule == o.m_rule && m_visitedLinkColumnRuleColor == o.m_visitedLinkColumnRuleColor && m_breakBefore == o.m_breakBefore
+        && m_rule == o.m_rule && m_visitedLinkColumnRuleColor == o.m_visitedLinkColumnRuleColor
         && m_autoWidth == o.m_autoWidth && m_autoCount == o.m_autoCount && m_normalGap == o.m_normalGap
         && m_fill == o.m_fill && m_columnSpan == o.m_columnSpan
-        && m_breakAfter == o.m_breakAfter && m_breakInside == o.m_breakInside
         && m_axis == o.m_axis && m_progression == o.m_progression;
 }
 
index f375621..f16ea5f 100644 (file)
@@ -64,9 +64,6 @@ public:
     bool m_normalGap : 1;
     unsigned m_fill : 1; // ColumnFill
     unsigned m_columnSpan : 1;
-    unsigned m_breakBefore : 2; // EPageBreak
-    unsigned m_breakAfter : 2; // EPageBreak
-    unsigned m_breakInside : 2; // EPageBreak
     unsigned m_axis : 2; // ColumnAxis
     unsigned m_progression : 2; // ColumnProgression
 
index 6ebbdba..4af6b93 100644 (file)
@@ -86,9 +86,6 @@ StyleRareNonInheritedData::StyleRareNonInheritedData()
     , m_scrollSnapType(static_cast<unsigned>(RenderStyle::initialScrollSnapType()))
 #endif
     , m_regionFragment(RenderStyle::initialRegionFragment())
-    , m_regionBreakAfter(RenderStyle::initialPageBreak())
-    , m_regionBreakBefore(RenderStyle::initialPageBreak())
-    , m_regionBreakInside(RenderStyle::initialPageBreak())
     , m_pageSizeType(PAGE_SIZE_AUTO)
     , m_transformStyle3D(RenderStyle::initialTransformStyle3D())
     , m_backfaceVisibility(RenderStyle::initialBackfaceVisibility())
@@ -107,6 +104,9 @@ StyleRareNonInheritedData::StyleRareNonInheritedData()
     , m_isolation(RenderStyle::initialIsolation())
 #endif
     , m_objectFit(RenderStyle::initialObjectFit())
+    , m_breakBefore(RenderStyle::initialBreakBetween())
+    , m_breakAfter(RenderStyle::initialBreakBetween())
+    , m_breakInside(RenderStyle::initialBreakInside())
 {
     m_maskBoxImage.setMaskDefaults();
 }
@@ -178,9 +178,6 @@ inline StyleRareNonInheritedData::StyleRareNonInheritedData(const StyleRareNonIn
     , m_scrollSnapType(o.m_scrollSnapType)
 #endif
     , m_regionFragment(o.m_regionFragment)
-    , m_regionBreakAfter(o.m_regionBreakAfter)
-    , m_regionBreakBefore(o.m_regionBreakBefore)
-    , m_regionBreakInside(o.m_regionBreakInside)
     , m_pageSizeType(o.m_pageSizeType)
     , m_transformStyle3D(o.m_transformStyle3D)
     , m_backfaceVisibility(o.m_backfaceVisibility)
@@ -199,6 +196,9 @@ inline StyleRareNonInheritedData::StyleRareNonInheritedData(const StyleRareNonIn
     , m_isolation(o.m_isolation)
 #endif
     , m_objectFit(o.m_objectFit)
+    , m_breakBefore(o.m_breakBefore)
+    , m_breakAfter(o.m_breakAfter)
+    , m_breakInside(o.m_breakInside)
 {
 }
 
@@ -274,9 +274,6 @@ bool StyleRareNonInheritedData::operator==(const StyleRareNonInheritedData& o) c
         && m_justifySelf == o.m_justifySelf
         && m_regionThread == o.m_regionThread
         && m_regionFragment == o.m_regionFragment
-        && m_regionBreakAfter == o.m_regionBreakAfter
-        && m_regionBreakBefore == o.m_regionBreakBefore
-        && m_regionBreakInside == o.m_regionBreakInside
         && m_pageSizeType == o.m_pageSizeType
         && m_transformStyle3D == o.m_transformStyle3D
         && m_backfaceVisibility == o.m_backfaceVisibility
@@ -300,7 +297,10 @@ bool StyleRareNonInheritedData::operator==(const StyleRareNonInheritedData& o) c
         && m_isolation == o.m_isolation
 #endif
         && m_aspectRatioType == o.m_aspectRatioType
-        && m_objectFit == o.m_objectFit;
+        && m_objectFit == o.m_objectFit
+        && m_breakAfter == o.m_breakAfter
+        && m_breakBefore == o.m_breakBefore
+        && m_breakInside == o.m_breakInside;
 }
 
 bool StyleRareNonInheritedData::contentDataEquivalent(const StyleRareNonInheritedData& o) const
index 126aec6..183cbe3 100644 (file)
@@ -194,10 +194,6 @@ public:
 
     unsigned m_regionFragment : 1; // RegionFragment
 
-    unsigned m_regionBreakAfter : 2; // EPageBreak
-    unsigned m_regionBreakBefore : 2; // EPageBreak
-    unsigned m_regionBreakInside : 2; // EPageBreak
-
     unsigned m_pageSizeType : 2; // PageSizeType
     unsigned m_transformStyle3D : 1; // ETransformStyle3D
     unsigned m_backfaceVisibility : 1; // EBackfaceVisibility
@@ -223,6 +219,10 @@ public:
 #endif
 
     unsigned m_objectFit : 3; // ObjectFit
+    
+    unsigned m_breakBefore : 4; // BreakBetween
+    unsigned m_breakAfter : 4;
+    unsigned m_breakInside : 3; // BreakInside
 
 private:
     StyleRareNonInheritedData();