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)
commit7cc95174b4180b721d735f7ea6e8a24fbf90d70a
tree149c17e1f6d8ace9ecea9ff2f5fe70f1ab7d450d
parent56bb2fe564bdad8b1b36f63d25598b4da8956360
Support break-after, break-before and break-inside.
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