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: http://svn.webkit.org/repository/webkit/trunk@195892 268f45cc-cd09-0410-ab3c-d52691b4dbfc
55 files changed