Diff
Modified: trunk/Source/WebCore/ChangeLog (101573 => 101574)
--- trunk/Source/WebCore/ChangeLog 2011-12-01 01:08:55 UTC (rev 101573)
+++ trunk/Source/WebCore/ChangeLog 2011-12-01 01:14:25 UTC (rev 101574)
@@ -1,3 +1,26 @@
+2011-11-30 Dan Bernstein <m...@apple.com>
+
+ WebCore part of: Allow the length of a page along the pagination axis to differ from the length of the view
+ https://bugs.webkit.org/show_bug.cgi?id=73476
+
+ Reviewed by Anders Carlsson.
+
+ * page/Page.cpp:
+ (WebCore::Page::setPagination): Changed to use Pagination::operator==.
+ * page/Page.h:
+ (WebCore::Page::Pagination::Pagination): Added initializer for the new pageLength member variable.
+ (WebCore::Page::Pagination::operator==): Added.
+ * rendering/RenderBlock.cpp:
+ (WebCore::RenderBlock::layoutColumns): Narrowed the scope of a local variable.
+ * rendering/RenderBlock.h: Promoted setDesiredColumnCountAndWidth() from private to protected,
+ allowing its use from RenderView::calcColumnWidth(). Made calcColumnWidth() virtual.
+ * rendering/RenderView.cpp:
+ (WebCore::RenderView::calcColumnWidth): Added. Uses the page length specified in the pagination
+ parameters to set the column width, if pages are to be laid out one next to the other.
+ (WebCore::RenderView::viewLogicalHeight): Added. Uses the page length specified in the pagination
+ parameters as the height, if pages are to be laid out one after the other.
+ * rendering/RenderView.h:
+
2011-11-30 Chris Fleizach <cfleiz...@apple.com>
AX: Nodes are reporting that focus can be set when they really can't
Modified: trunk/Source/WebCore/page/Page.cpp (101573 => 101574)
--- trunk/Source/WebCore/page/Page.cpp 2011-12-01 01:08:55 UTC (rev 101573)
+++ trunk/Source/WebCore/page/Page.cpp 2011-12-01 01:14:25 UTC (rev 101574)
@@ -677,7 +677,7 @@
void Page::setPagination(const Pagination& pagination)
{
- if (m_pagination.mode == pagination.mode && m_pagination.gap == pagination.gap)
+ if (m_pagination == pagination)
return;
m_pagination = pagination;
Modified: trunk/Source/WebCore/page/Page.h (101573 => 101574)
--- trunk/Source/WebCore/page/Page.h 2011-12-01 01:08:55 UTC (rev 101573)
+++ trunk/Source/WebCore/page/Page.h 2011-12-01 01:14:25 UTC (rev 101574)
@@ -261,11 +261,18 @@
Pagination()
: mode(Unpaginated)
+ , pageLength(0)
, gap(0)
{
};
+ bool operator==(const Pagination& other) const
+ {
+ return mode == other.mode && pageLength == other.pageLength && gap == other.gap;
+ }
+
Mode mode;
+ unsigned pageLength;
unsigned gap;
};
Modified: trunk/Source/WebCore/rendering/RenderBlock.cpp (101573 => 101574)
--- trunk/Source/WebCore/rendering/RenderBlock.cpp 2011-12-01 01:08:55 UTC (rev 101573)
+++ trunk/Source/WebCore/rendering/RenderBlock.cpp 2011-12-01 01:14:25 UTC (rev 101574)
@@ -4619,10 +4619,10 @@
// FIXME: We don't balance properly at all in the presence of forced page breaks. We need to understand what
// the distance between forced page breaks is so that we can avoid making the minimum column height too tall.
ColumnInfo* colInfo = columnInfo();
- int desiredColumnCount = colInfo->desiredColumnCount();
if (!hasSpecifiedPageLogicalHeight) {
LayoutUnit columnHeight = pageLogicalHeight;
int minColumnCount = colInfo->forcedBreaks() + 1;
+ int desiredColumnCount = colInfo->desiredColumnCount();
if (minColumnCount >= desiredColumnCount) {
// The forced page breaks are in control of the balancing. Just set the column height to the
// maximum page break distance.
Modified: trunk/Source/WebCore/rendering/RenderBlock.h (101573 => 101574)
--- trunk/Source/WebCore/rendering/RenderBlock.h 2011-12-01 01:08:55 UTC (rev 101573)
+++ trunk/Source/WebCore/rendering/RenderBlock.h 2011-12-01 01:14:25 UTC (rev 101574)
@@ -414,6 +414,8 @@
bool simplifiedLayout();
void simplifiedNormalFlowLayout();
+ void setDesiredColumnCountAndWidth(int, LayoutUnit);
+
void computeOverflow(LayoutUnit oldClientAfterEdge, bool recomputeFloats = false);
virtual void addOverflowFromChildren();
void addOverflowFromFloats();
@@ -750,7 +752,6 @@
LayoutUnit desiredColumnWidth() const;
unsigned desiredColumnCount() const;
- void setDesiredColumnCountAndWidth(int count, LayoutUnit width);
void paintContinuationOutlines(PaintInfo&, const LayoutPoint&);
@@ -769,7 +770,7 @@
// Adjust from painting offsets to the local coords of this renderer
void offsetForContents(LayoutPoint&) const;
- void calcColumnWidth();
+ virtual void calcColumnWidth();
bool layoutColumns(bool hasSpecifiedPageLogicalHeight, LayoutUnit pageLogicalHeight, LayoutStateMaintainer&);
void makeChildrenAnonymousColumnBlocks(RenderObject* beforeChild, RenderBlock* newBlockBox, RenderObject* newChild);
Modified: trunk/Source/WebCore/rendering/RenderView.cpp (101573 => 101574)
--- trunk/Source/WebCore/rendering/RenderView.cpp 2011-12-01 01:08:55 UTC (rev 101573)
+++ trunk/Source/WebCore/rendering/RenderView.cpp 2011-12-01 01:14:25 UTC (rev 101574)
@@ -185,6 +185,20 @@
return RenderBlock::requiresColumns(desiredColumnCount);
}
+void RenderView::calcColumnWidth()
+{
+ int columnWidth = contentLogicalWidth();
+ if (m_frameView && style()->hasInlineColumnAxis()) {
+ if (Frame* frame = m_frameView->frame()) {
+ if (Page* page = frame->page()) {
+ if (int pageLength = page->pagination().pageLength)
+ columnWidth = pageLength;
+ }
+ }
+ }
+ setDesiredColumnCountAndWidth(1, columnWidth);
+}
+
void RenderView::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
{
// If we ever require layout but receive a paint anyway, something has gone horribly wrong.
@@ -734,6 +748,24 @@
return width;
}
+int RenderView::viewLogicalHeight() const
+{
+ int height = style()->isHorizontalWritingMode() ? viewHeight() : viewWidth();
+
+ if (hasColumns() && !style()->hasInlineColumnAxis()) {
+ if (Frame* frame = m_frameView->frame()) {
+ if (Page* page = frame->page()) {
+ if (frame == page->mainFrame()) {
+ if (int pageLength = page->pagination().pageLength)
+ height = pageLength;
+ }
+ }
+ }
+ }
+
+ return height;
+}
+
float RenderView::zoomFactor() const
{
Frame* frame = m_frameView->frame();
Modified: trunk/Source/WebCore/rendering/RenderView.h (101573 => 101574)
--- trunk/Source/WebCore/rendering/RenderView.h 2011-12-01 01:08:55 UTC (rev 101573)
+++ trunk/Source/WebCore/rendering/RenderView.h 2011-12-01 01:14:25 UTC (rev 101574)
@@ -61,7 +61,7 @@
int viewHeight() const;
int viewWidth() const;
int viewLogicalWidth() const { return style()->isHorizontalWritingMode() ? viewWidth() : viewHeight(); }
- int viewLogicalHeight() const { return style()->isHorizontalWritingMode() ? viewHeight() : viewWidth(); }
+ int viewLogicalHeight() const;
float zoomFactor() const;
@@ -194,6 +194,8 @@
virtual bool requiresColumns(int desiredColumnCount) const OVERRIDE;
private:
+ virtual void calcColumnWidth() OVERRIDE;
+
bool shouldRepaint(const IntRect& r) const;
// These functions may only be accessed by LayoutStateMaintainer.
Modified: trunk/Source/WebKit/mac/ChangeLog (101573 => 101574)
--- trunk/Source/WebKit/mac/ChangeLog 2011-12-01 01:08:55 UTC (rev 101573)
+++ trunk/Source/WebKit/mac/ChangeLog 2011-12-01 01:14:25 UTC (rev 101574)
@@ -1,3 +1,15 @@
+2011-11-30 Dan Bernstein <m...@apple.com>
+
+ WebKit/mac part of: Allow the length of a page along the pagination axis to differ from the length of the view
+ https://bugs.webkit.org/show_bug.cgi?id=73476
+
+ Reviewed by Anders Carlsson.
+
+ * WebView/WebView.mm:
+ (-[WebView _setPageLength:]): Added this accessor.
+ (-[WebView _pageLength]): Ditto.
+ * WebView/WebViewPrivate.h:
+
2011-11-30 Alexey Proskuryakov <a...@apple.com>
Download page URL should be set by WebCore
Modified: trunk/Source/WebKit/mac/WebView/WebView.mm (101573 => 101574)
--- trunk/Source/WebKit/mac/WebView/WebView.mm 2011-12-01 01:08:55 UTC (rev 101573)
+++ trunk/Source/WebKit/mac/WebView/WebView.mm 2011-12-01 01:14:25 UTC (rev 101574)
@@ -2778,6 +2778,27 @@
return WebPaginationModeUnpaginated;
}
+- (void)_setPageLength:(CGFloat)pageLength
+{
+ Page* page = core(self);
+ if (!page)
+ return;
+
+ Page::Pagination pagination = page->pagination();
+ pagination.pageLength = pageLength;
+
+ page->setPagination(pagination);
+}
+
+- (CGFloat)_pageLength
+{
+ Page* page = core(self);
+ if (!page)
+ return 1;
+
+ return page->pagination().pageLength;
+}
+
- (void)_setGapBetweenPages:(CGFloat)pageGap
{
Page* page = core(self);
Modified: trunk/Source/WebKit/mac/WebView/WebViewPrivate.h (101573 => 101574)
--- trunk/Source/WebKit/mac/WebView/WebViewPrivate.h 2011-12-01 01:08:55 UTC (rev 101573)
+++ trunk/Source/WebKit/mac/WebView/WebViewPrivate.h 2011-12-01 01:14:25 UTC (rev 101574)
@@ -563,6 +563,9 @@
- (void)_setPaginationMode:(WebPaginationMode)paginationMode;
- (WebPaginationMode)_paginationMode;
+// Set to 0 to have the page length equal the view length.
+- (void)_setPageLength:(CGFloat)pageLength;
+- (CGFloat)_pageLength;
- (void)_setGapBetweenPages:(CGFloat)pageGap;
- (CGFloat)_gapBetweenPages;
- (NSUInteger)_pageCount;
Modified: trunk/Source/WebKit2/ChangeLog (101573 => 101574)
--- trunk/Source/WebKit2/ChangeLog 2011-12-01 01:08:55 UTC (rev 101573)
+++ trunk/Source/WebKit2/ChangeLog 2011-12-01 01:14:25 UTC (rev 101574)
@@ -1,3 +1,34 @@
+2011-11-30 Dan Bernstein <m...@apple.com>
+
+ WebKit2 part of: Allow the length of a page along the pagination axis to differ from the length of the view
+ https://bugs.webkit.org/show_bug.cgi?id=73476
+
+ Reviewed by Anders Carlsson.
+
+ * Shared/WebPageCreationParameters.cpp:
+ (WebKit::WebPageCreationParameters::encode): Encode pageLength.
+ (WebKit::WebPageCreationParameters::decode): Decode pageLength.
+ * Shared/WebPageCreationParameters.h: Added pageLength.
+ * UIProcess/API/C/WKPage.cpp:
+ (WKPageSetPageLength): Added this accessor.
+ (WKPageGetPageLength): Ditto.
+ * UIProcess/API/C/WKPagePrivate.h:
+ * UIProcess/API/mac/WKBrowsingContextController.mm:
+ (-[WKBrowsingContextController setPageLength:]): Ditto.
+ (-[WKBrowsingContextController pageLength]): Ditto.
+ * UIProcess/API/mac/WKBrowsingContextControllerPrivate.h:
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::WebPageProxy): Added initializer for m_pageLength.
+ (WebKit::WebPageProxy::setPageLength): Added.
+ (WebKit::WebPageProxy::creationParameters): Initialize pageLength.
+ * UIProcess/WebPageProxy.h:
+ (WebKit::WebPageProxy::pageLength): Added.
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::WebPage::WebPage): Set the page length based on the creation parameters.
+ (WebKit::WebPage::setPageLength): Added.
+ * WebProcess/WebPage/WebPage.h:
+ * WebProcess/WebPage/WebPage.messages.in: Added SetPageLength.
+
2011-11-30 Alejandro G. Castro <a...@igalia.com>
[GTK] Add accelerated compositing compilation option
Modified: trunk/Source/WebKit2/Shared/WebPageCreationParameters.cpp (101573 => 101574)
--- trunk/Source/WebKit2/Shared/WebPageCreationParameters.cpp 2011-12-01 01:08:55 UTC (rev 101573)
+++ trunk/Source/WebKit2/Shared/WebPageCreationParameters.cpp 2011-12-01 01:14:25 UTC (rev 101574)
@@ -47,6 +47,7 @@
encoder->encode(useFixedLayout);
encoder->encode(fixedLayoutSize);
encoder->encodeEnum(paginationMode);
+ encoder->encode(pageLength);
encoder->encode(gapBetweenPages);
encoder->encode(userAgent);
encoder->encode(sessionState);
@@ -94,6 +95,8 @@
return false;
if (!decoder->decodeEnum(parameters.paginationMode))
return false;
+ if (!decoder->decode(parameters.pageLength))
+ return false;
if (!decoder->decode(parameters.gapBetweenPages))
return false;
if (!decoder->decode(parameters.userAgent))
Modified: trunk/Source/WebKit2/Shared/WebPageCreationParameters.h (101573 => 101574)
--- trunk/Source/WebKit2/Shared/WebPageCreationParameters.h 2011-12-01 01:08:55 UTC (rev 101573)
+++ trunk/Source/WebKit2/Shared/WebPageCreationParameters.h 2011-12-01 01:14:25 UTC (rev 101574)
@@ -64,6 +64,7 @@
WebCore::IntSize fixedLayoutSize;
WebCore::Page::Pagination::Mode paginationMode;
+ double pageLength;
double gapBetweenPages;
String userAgent;
Modified: trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp (101573 => 101574)
--- trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp 2011-12-01 01:08:55 UTC (rev 101573)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp 2011-12-01 01:14:25 UTC (rev 101574)
@@ -379,6 +379,16 @@
return kWKPaginationModeUnpaginated;
}
+void WKPageSetPageLength(WKPageRef pageRef, double pageLength)
+{
+ toImpl(pageRef)->setPageLength(pageLength);
+}
+
+double WKPageGetPageLength(WKPageRef pageRef)
+{
+ return toImpl(pageRef)->pageLength();
+}
+
void WKPageSetGapBetweenPages(WKPageRef pageRef, double gap)
{
toImpl(pageRef)->setGapBetweenPages(gap);
Modified: trunk/Source/WebKit2/UIProcess/API/C/WKPagePrivate.h (101573 => 101574)
--- trunk/Source/WebKit2/UIProcess/API/C/WKPagePrivate.h 2011-12-01 01:08:55 UTC (rev 101573)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKPagePrivate.h 2011-12-01 01:14:25 UTC (rev 101574)
@@ -61,6 +61,8 @@
WK_EXPORT void WKPageSetPaginationMode(WKPageRef page, WKPaginationMode paginationMode);
WK_EXPORT WKPaginationMode WKPageGetPaginationMode(WKPageRef page);
+WK_EXPORT void WKPageSetPageLength(WKPageRef page, double pagesPerView);
+WK_EXPORT double WKPageGetPageLength(WKPageRef page);
WK_EXPORT void WKPageSetGapBetweenPages(WKPageRef page, double gap);
WK_EXPORT double WKPageGetGapBetweenPages(WKPageRef page);
Modified: trunk/Source/WebKit2/UIProcess/API/mac/WKBrowsingContextController.mm (101573 => 101574)
--- trunk/Source/WebKit2/UIProcess/API/mac/WKBrowsingContextController.mm 2011-12-01 01:08:55 UTC (rev 101573)
+++ trunk/Source/WebKit2/UIProcess/API/mac/WKBrowsingContextController.mm 2011-12-01 01:14:25 UTC (rev 101574)
@@ -234,6 +234,16 @@
return WKPaginationModeUnpaginated;
}
+- (void)setPageLength:(CGFloat)pageLength
+{
+ WKPageSetPageLength(self.pageRef, pageLength);
+}
+
+- (CGFloat)pageLength
+{
+ return WKPageGetPageLength(self.pageRef);
+}
+
- (void)setGapBetweenPages:(CGFloat)gapBetweenPages
{
WKPageSetGapBetweenPages(self.pageRef, gapBetweenPages);
Modified: trunk/Source/WebKit2/UIProcess/API/mac/WKBrowsingContextControllerPrivate.h (101573 => 101574)
--- trunk/Source/WebKit2/UIProcess/API/mac/WKBrowsingContextControllerPrivate.h 2011-12-01 01:08:55 UTC (rev 101573)
+++ trunk/Source/WebKit2/UIProcess/API/mac/WKBrowsingContextControllerPrivate.h 2011-12-01 01:14:25 UTC (rev 101574)
@@ -35,6 +35,8 @@
@interface WKBrowsingContextController (Private)
@property WKBrowsingContextPaginationMode paginationMode;
+// Set to 0 to have the page length equal the view length.
+@property CGFloat pageLength;
@property CGFloat gapBetweenPages;
@property(readonly) NSUInteger pageCount;
Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (101573 => 101574)
--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp 2011-12-01 01:08:55 UTC (rev 101573)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp 2011-12-01 01:14:25 UTC (rev 101574)
@@ -161,6 +161,7 @@
, m_areMemoryCacheClientCallsEnabled(true)
, m_useFixedLayout(false)
, m_paginationMode(Page::Pagination::Unpaginated)
+ , m_pageLength(0)
, m_gapBetweenPages(0)
, m_isValid(true)
, m_isClosed(false)
@@ -1296,6 +1297,18 @@
process()->send(Messages::WebPage::SetPaginationMode(mode), m_pageID);
}
+void WebPageProxy::setPageLength(double pageLength)
+{
+ if (pageLength == m_pageLength)
+ return;
+
+ m_pageLength = pageLength;
+
+ if (!isValid())
+ return;
+ process()->send(Messages::WebPage::SetPageLength(pageLength), m_pageID);
+}
+
void WebPageProxy::setGapBetweenPages(double gap)
{
if (gap == m_gapBetweenPages)
@@ -3191,6 +3204,7 @@
parameters.useFixedLayout = m_useFixedLayout;
parameters.fixedLayoutSize = m_fixedLayoutSize;
parameters.paginationMode = m_paginationMode;
+ parameters.pageLength = m_pageLength;
parameters.gapBetweenPages = m_gapBetweenPages;
parameters.userAgent = userAgent();
parameters.sessionState = SessionState(m_backForwardList->entries(), m_backForwardList->currentIndex());
Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (101573 => 101574)
--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h 2011-12-01 01:08:55 UTC (rev 101573)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h 2011-12-01 01:14:25 UTC (rev 101574)
@@ -415,6 +415,8 @@
void setPaginationMode(WebCore::Page::Pagination::Mode);
WebCore::Page::Pagination::Mode paginationMode() const { return m_paginationMode; }
+ void setPageLength(double);
+ double pageLength() const { return m_pageLength; }
void setGapBetweenPages(double);
double gapBetweenPages() const { return m_gapBetweenPages; }
unsigned pageCount() const { return m_pageCount; }
@@ -900,6 +902,7 @@
WebCore::IntSize m_fixedLayoutSize;
WebCore::Page::Pagination::Mode m_paginationMode;
+ double m_pageLength;
double m_gapBetweenPages;
// If the process backing the web page is alive and kicking.
Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (101573 => 101574)
--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp 2011-12-01 01:08:55 UTC (rev 101573)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp 2011-12-01 01:14:25 UTC (rev 101574)
@@ -249,6 +249,7 @@
setDrawsTransparentBackground(parameters.drawsTransparentBackground);
setPaginationMode(parameters.paginationMode);
+ setPageLength(parameters.pageLength);
setGapBetweenPages(parameters.gapBetweenPages);
setMemoryCacheMessagesEnabled(parameters.areMemoryCacheClientCallsEnabled);
@@ -934,6 +935,13 @@
m_page->setPagination(pagination);
}
+void WebPage::setPageLength(double pageLength)
+{
+ Page::Pagination pagination = m_page->pagination();
+ pagination.pageLength = pageLength;
+ m_page->setPagination(pagination);
+}
+
void WebPage::setGapBetweenPages(double gap)
{
Page::Pagination pagination = m_page->pagination();
Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h (101573 => 101574)
--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h 2011-12-01 01:08:55 UTC (rev 101573)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h 2011-12-01 01:14:25 UTC (rev 101574)
@@ -268,6 +268,7 @@
void setFixedLayoutSize(const WebCore::IntSize&);
void setPaginationMode(uint32_t /* WebCore::Page::Pagination::Mode */);
+ void setPageLength(double);
void setGapBetweenPages(double);
bool drawsBackground() const { return m_drawsBackground; }
Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in (101573 => 101574)
--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in 2011-12-01 01:08:55 UTC (rev 101573)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in 2011-12-01 01:14:25 UTC (rev 101574)
@@ -122,6 +122,7 @@
SetFixedLayoutSize(WebCore::IntSize size)
SetPaginationMode(uint32_t mode);
+ SetPageLength(double pageLength);
SetGapBetweenPages(double gap);
# Find.