haikuwebkit/LayoutTests/printing/page-break-orphans-expected...

19 lines
382 B
Plaintext
Raw Permalink Normal View History

Test for orphans
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 "page3" is 3
Support for CSS widows and orphans https://bugs.webkit.org/show_bug.cgi?id=9410 Reviewed by Darin Adler. Source/WebCore: The CSS 'widow' and 'orphan' properties were supported by the parser and style system, but were not actually doing anything in layout. Now they do! In order to not break existing content, I unfortunately had to go against the specification and change our default value from 2 to auto. A value of auto means that widows and orphans will not cause any page/column breaks. Supporting orphans was a small change. During line layout, if we realise we need to move to a new page in a situation that would create an orphan, move the entire block to the new page. There was already code to do this. Support for widows was trickier. When we finish laying out a block, count the number of hanging lines. If we've created a widow, and there are enough available lines on the previous page, then steal some and remember the line to break at. Trigger a relayout. Then notice the line that was marked for breaking and avoid the widow. This means some blocks go through layout twice, but as long as the widow value is small it shouldn't be a huge penalty. Tests: fast/multicol/widows-and-orphans.html (new test) printing/page-break-orphans.html printing/page-break-orphans-and-widows.html printing/page-break-widows.html * css/CSSComputedStyleDeclaration.cpp: (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue): Return CSSValueAuto for widows and orphans if necessary. * css/CSSParser.cpp: (WebCore::CSSParser::parseValue): Support "auto" in widow and orphan property parsing. * css/StyleBuilder.cpp: (WebCore::StyleBuilder::StyleBuilder): Change property handler to something that supports auto. * page/animation/CSSPropertyAnimation.cpp: (WebCore::CSSPropertyAnimation::ensurePropertyMap): Add widows and orphans to the animation map. * rendering/RenderBlock.cpp: (WebCore::RenderBlock::layoutBlockChild): Detect if we've caused a widow-fixing break, and request relayout evaluation. (WebCore::RenderBlock::markForPaginationRelayoutIfNeeded): Test for a widow-fixing line. (WebCore::RenderBlock::setBreakAtLineToAvoidWidow): New function to remember where we should break on next layout. (WebCore::RenderBlock::adjustLinePositionForPagination): Move the entire block to a new page if this would create an orphan. * rendering/RenderBlock.h: (WebCore::RenderBlock::shouldBreakAtLineToAvoidWidow): New function to indicate if we are remembering a widow. (WebCore::RenderBlock::clearShouldBreakAtLineToAvoidWidow): Reset the line breaks. (WebCore::RenderBlock::lineBreakToAvoidWidow): (WebCore::RenderBlock::RenderBlockRareData::RenderBlockRareData): Add a flag for indicating if we are remembering a line, and the actual line itself. * rendering/RenderBlockLineLayout.cpp: (WebCore::RenderBlock::layoutRunsAndFloatsInRange): The code to detect and fix widows. Explained above. * rendering/style/RenderStyle.h: New methods for indicating if widows and orphans are non-default values. * rendering/style/StyleRareInheritedData.cpp: Ditto. * rendering/style/StyleRareInheritedData.h: Ditto. LayoutTests: A new, slightly more comprehensive, test for widows and orphans. We also now pass the existing widows and orphans tests from printing. And since the default value of the properties changed, update the computed style test as well. * fast/css/getComputedStyle/computed-style-expected.txt: New auto value. * fast/css/getComputedStyle/computed-style-without-renderer-expected.txt: New auto value. * fast/multicol/widows-and-orphans-expected.txt: Added. * fast/multicol/widows-and-orphans.html: Added. * printing/page-break-orphans-and-widows-expected.txt: * printing/page-break-orphans-expected.txt: * printing/page-break-widows-expected.txt: * svg/css/getComputedStyle-basic-expected.txt: New auto value. Canonical link: https://commits.webkit.org/122756@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@137200 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-12-10 21:22:44 +00:00
PASS: page number of "page4" is 4
PASS: page number of "page5-1" is 5
PASS: page number of "page5-2" is 5
Support for CSS widows and orphans https://bugs.webkit.org/show_bug.cgi?id=9410 Reviewed by Darin Adler. Source/WebCore: The CSS 'widow' and 'orphan' properties were supported by the parser and style system, but were not actually doing anything in layout. Now they do! In order to not break existing content, I unfortunately had to go against the specification and change our default value from 2 to auto. A value of auto means that widows and orphans will not cause any page/column breaks. Supporting orphans was a small change. During line layout, if we realise we need to move to a new page in a situation that would create an orphan, move the entire block to the new page. There was already code to do this. Support for widows was trickier. When we finish laying out a block, count the number of hanging lines. If we've created a widow, and there are enough available lines on the previous page, then steal some and remember the line to break at. Trigger a relayout. Then notice the line that was marked for breaking and avoid the widow. This means some blocks go through layout twice, but as long as the widow value is small it shouldn't be a huge penalty. Tests: fast/multicol/widows-and-orphans.html (new test) printing/page-break-orphans.html printing/page-break-orphans-and-widows.html printing/page-break-widows.html * css/CSSComputedStyleDeclaration.cpp: (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue): Return CSSValueAuto for widows and orphans if necessary. * css/CSSParser.cpp: (WebCore::CSSParser::parseValue): Support "auto" in widow and orphan property parsing. * css/StyleBuilder.cpp: (WebCore::StyleBuilder::StyleBuilder): Change property handler to something that supports auto. * page/animation/CSSPropertyAnimation.cpp: (WebCore::CSSPropertyAnimation::ensurePropertyMap): Add widows and orphans to the animation map. * rendering/RenderBlock.cpp: (WebCore::RenderBlock::layoutBlockChild): Detect if we've caused a widow-fixing break, and request relayout evaluation. (WebCore::RenderBlock::markForPaginationRelayoutIfNeeded): Test for a widow-fixing line. (WebCore::RenderBlock::setBreakAtLineToAvoidWidow): New function to remember where we should break on next layout. (WebCore::RenderBlock::adjustLinePositionForPagination): Move the entire block to a new page if this would create an orphan. * rendering/RenderBlock.h: (WebCore::RenderBlock::shouldBreakAtLineToAvoidWidow): New function to indicate if we are remembering a widow. (WebCore::RenderBlock::clearShouldBreakAtLineToAvoidWidow): Reset the line breaks. (WebCore::RenderBlock::lineBreakToAvoidWidow): (WebCore::RenderBlock::RenderBlockRareData::RenderBlockRareData): Add a flag for indicating if we are remembering a line, and the actual line itself. * rendering/RenderBlockLineLayout.cpp: (WebCore::RenderBlock::layoutRunsAndFloatsInRange): The code to detect and fix widows. Explained above. * rendering/style/RenderStyle.h: New methods for indicating if widows and orphans are non-default values. * rendering/style/StyleRareInheritedData.cpp: Ditto. * rendering/style/StyleRareInheritedData.h: Ditto. LayoutTests: A new, slightly more comprehensive, test for widows and orphans. We also now pass the existing widows and orphans tests from printing. And since the default value of the properties changed, update the computed style test as well. * fast/css/getComputedStyle/computed-style-expected.txt: New auto value. * fast/css/getComputedStyle/computed-style-without-renderer-expected.txt: New auto value. * fast/multicol/widows-and-orphans-expected.txt: Added. * fast/multicol/widows-and-orphans.html: Added. * printing/page-break-orphans-and-widows-expected.txt: * printing/page-break-orphans-expected.txt: * printing/page-break-widows-expected.txt: * svg/css/getComputedStyle-basic-expected.txt: New auto value. Canonical link: https://commits.webkit.org/122756@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@137200 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2012-12-10 21:22:44 +00:00
All tests passed
PASS successfullyParsed is true
TEST COMPLETE