https://bugs.webkit.org/show_bug.cgi?id=94401
authorbdakin@apple.com <bdakin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 22 Aug 2012 20:20:14 +0000 (20:20 +0000)
committerbdakin@apple.com <bdakin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 22 Aug 2012 20:20:14 +0000 (20:20 +0000)
commitec18f5bb364a815e94441cbdec0ec5b11caf04ab
tree0e3b64e278b302cd2fc97d2f08c35b06288c4baa
parent2a81082c01e5c081f243d38dfd08ea853c86ae61
https://bugs.webkit.org/show_bug.cgi?id=94401
Add support for making a web site become paginated using overflow:
paged-x | paged-y
-and corresponding-
<rdar://problem/11831783>

Reviewed by Dave Hyatt.

.:

* Source/autotools/symbols.filter:

Source/WebCore:

This patch adds two new possible values for overflow-y. They are -
webkit-paged-x and -webkit-paged-y. When you set these as overflow-y
values on the html or body element, they make the RenderView
paginated, much like the API on Page.

-webkit-paged-x and -webkit-paged-y are only valid values for
overflow-y, NOT overflow-x. overflow-x defaults to a value of auto
(for now) unless it has been set to something else.
* css/CSSParser.cpp:
(WebCore::isValidKeywordPropertyAndValue):
(WebCore::CSSParser::parseValue):

Two new CSS value keywords.
* css/CSSValueKeywords.in:

EOverflow has two new values for pagination.
* rendering/style/RenderStyleConstants.h:
* css/CSSPrimitiveValueMappings.h:
(WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
(WebCore::CSSPrimitiveValue::operator EOverflow):

A bunch of existing code from StyleResolver::styleForDocument() is
moved into a helper function so that it can be called from two
places.
* css/StyleResolver.cpp:
(WebCore::StyleResolver::collectMatchingRulesForList):

Even though this pagination is very similar to Page::pagination(), it
is different in one critical way. Page::pagination() will apply to
all FrameViews, even those in the page cache. For this reason,
FrameView needs to keep its own Pagination value that just applies to
this FrameView.
* page/FrameView.cpp:
* page/FrameView.h:
(WebCore):
(FrameView):

Map RenderStyle values to a Pagination::Mode.
(WebCore::paginationModeForRenderStyle):
(WebCore):

Account for paged-x and paged-y here.
(WebCore::FrameView::applyOverflowToViewport):

As is explained in the header, FrameView::pagination() will return
m_pagination if it has been set. Otherwise, it will return
Page::pagination() since currently there are no callers that need to
distinguish between the two.
(WebCore::FrameView::pagination):
(WebCore::FrameView::setPagination):

Generally this means that everywhere in WebCore should ask FrameView
for the pagination(), not Page. These call sites all look to
FrameView now.
(WebCore::FrameView::paintContents):
* rendering/RenderView.cpp:
(WebCore::RenderView::requiresColumns):
(WebCore::RenderView::calcColumnWidth):
(WebCore::RenderView::paginationUnit):
(WebCore::RenderView::viewLogicalHeight):

Since we need to define Pagination in Page.h AND FrameView.h, it is
now in its own header, Pagination.h. And therefore it is no longer
WebCore::Page::Pagination, but rather it is just WebCore::Pagination.
* page/Page.h:
(Page):
* rendering/Pagination.h: Added.
(WebCore):
(WebCore::Pagination::Pagination):
(Pagination):
(WebCore::Pagination::operator==):
(WebCore::Pagination::operator!=):
* WebCore.exp.in:
* WebCore.xcodeproj/project.pbxproj:
* GNUmakefile.list.am:
* Target.pri:
* WebCore.exp.in:
* WebCore.gypi:

Certain ColumnInfo values are set based on the RenderStyle. So if
those RenderStyle values change, the ColumnInfo needs to be updated.
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::updateColumnInfoFromStyle):
(WebCore):
* rendering/RenderBlock.h:
(RenderBlock):

Factor in paged-x and paged-y when determining if a RenderBlock
requires columns.
(WebCore::RenderBlock::requiresColumns):

RenderStyle::specifiesColumns() is an odd and probably broken
function. At the very least, it should be re-named, if not removed
entirely. It does not accurately assess if columns have been
specified. I had to add this code here because specifiesColumns()
returns false for paged-x and true for paged-y. We were hitting a
number of crashes with paged-y because of this, so I chose for the
time being to limit this check to non-root layers.
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::shouldBeNormalFlowOnly):

It's just Pagination now, not Page::Pagination.
* testing/InternalSettings.cpp:
(WebCore::InternalSettings::reset):
(WebCore::InternalSettings::setPagination):

Source/WebKit/mac:

WebCore::Page::Pagination is now just WebCore::Pagination.
* WebView/WebView.mm:
(-[WebView _setPaginationMode:]):
(-[WebView _paginationMode]):
(-[WebView _setPaginationBehavesLikeColumns:]):
(-[WebView _setPageLength:]):
(-[WebView _setGapBetweenPages:]):

Source/WebKit2:

WebCore::Page::Pagination is now just WebCore::Pagination.
* Shared/WebPageCreationParameters.h:
(WebPageCreationParameters):
* UIProcess/API/C/WKPage.cpp:
(WKPageSetPaginationMode):
(WKPageGetPaginationMode):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::WebPageProxy):
(WebKit::WebPageProxy::setPaginationMode):
* UIProcess/WebPageProxy.h:
(WebPageProxy):
(WebKit::WebPageProxy::paginationMode):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::setPaginationMode):
(WebKit::WebPage::setPaginationBehavesLikeColumns):
(WebKit::WebPage::setPageLength):
(WebKit::WebPage::setGapBetweenPages):
* WebProcess/WebPage/WebPage.h:
(WebPage):

LayoutTests:

Test the parsing of the two new values.
* fast/css/overflow-property-expected.txt:
* fast/css/overflow-property.html:

New tests.
* fast/overflow/paged-x-div.html: Added.
* fast/overflow/paged-x-on-root.html: Added.
* fast/overflow/paged-y-div.html: Added.
* fast/overflow/paged-y-on-root.html: Added.
* platform/mac/fast/overflow/paged-x-div-expected.png: Added.
* platform/mac/fast/overflow/paged-x-div-expected.txt: Added.
* platform/mac/fast/overflow/paged-x-on-root-expected.png: Added.
* platform/mac/fast/overflow/paged-x-on-root-expected.txt: Added.
* platform/mac/fast/overflow/paged-y-div-expected.png: Added.
* platform/mac/fast/overflow/paged-y-div-expected.txt: Added.
* platform/mac/fast/overflow/paged-y-on-root-expected.png: Added.
* platform/mac/fast/overflow/paged-y-on-root-expected.txt: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@126343 268f45cc-cd09-0410-ab3c-d52691b4dbfc
48 files changed:
ChangeLog
LayoutTests/ChangeLog
LayoutTests/fast/css/overflow-property-expected.txt
LayoutTests/fast/css/overflow-property.html
LayoutTests/fast/overflow/paged-x-div.html [new file with mode: 0644]
LayoutTests/fast/overflow/paged-x-on-root.html [new file with mode: 0644]
LayoutTests/fast/overflow/paged-y-div.html [new file with mode: 0644]
LayoutTests/fast/overflow/paged-y-on-root.html [new file with mode: 0644]
LayoutTests/platform/mac/fast/overflow/paged-x-div-expected.png [new file with mode: 0644]
LayoutTests/platform/mac/fast/overflow/paged-x-div-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac/fast/overflow/paged-x-on-root-expected.png [new file with mode: 0644]
LayoutTests/platform/mac/fast/overflow/paged-x-on-root-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac/fast/overflow/paged-y-div-expected.png [new file with mode: 0644]
LayoutTests/platform/mac/fast/overflow/paged-y-div-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac/fast/overflow/paged-y-on-root-expected.png [new file with mode: 0644]
LayoutTests/platform/mac/fast/overflow/paged-y-on-root-expected.txt [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/GNUmakefile.list.am
Source/WebCore/Target.pri
Source/WebCore/WebCore.exp.in
Source/WebCore/WebCore.gypi
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/css/CSSParser.cpp
Source/WebCore/css/CSSPrimitiveValueMappings.h
Source/WebCore/css/CSSValueKeywords.in
Source/WebCore/css/StyleResolver.cpp
Source/WebCore/page/FrameView.cpp
Source/WebCore/page/FrameView.h
Source/WebCore/page/Page.h
Source/WebCore/rendering/Pagination.h [new file with mode: 0644]
Source/WebCore/rendering/RenderBlock.cpp
Source/WebCore/rendering/RenderBlock.h
Source/WebCore/rendering/RenderLayer.cpp
Source/WebCore/rendering/RenderView.cpp
Source/WebCore/rendering/style/RenderStyleConstants.h
Source/WebCore/testing/InternalSettings.cpp
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/WebView/WebView.mm
Source/WebKit2/ChangeLog
Source/WebKit2/Shared/WebPageCreationParameters.h
Source/WebKit2/UIProcess/API/C/WKPage.cpp
Source/WebKit2/UIProcess/WebPageProxy.cpp
Source/WebKit2/UIProcess/WebPageProxy.h
Source/WebKit2/WebProcess/WebPage/WebPage.cpp
Source/WebKit2/WebProcess/WebPage/WebPage.h
Source/WebKit2/win/WebKit2.def
Source/WebKit2/win/WebKit2CFLite.def
Source/autotools/symbols.filter