https://bugs.webkit.org/show_bug.cgi?id=77505
Reviewed by Darin Adler.
* page/Page.h:
(WebCore::Page::Pagination::Pagination): Added initializer for the behavesLikeColumns member
variable.
(WebCore::Page::Pagination::operator==): Added comparison of behavesLikeColumns values.
(Pagination): Added behavesLikeColumns member variable. When set to false (the default),
paginated display respects the page-break-{before,after} properties rather than the
column-break-{before,after} ones.
* rendering/ColumnInfo.h:
(WebCore::ColumnInfo::ColumnInfo): Added initializer for the m_paginationUnit member.
(WebCore::ColumnInfo::paginationUnit): Added this getter.
(WebCore::ColumnInfo::setPaginationUnit): Added this setter.
(ColumnInfo): Added m_paginationUnit member. It defaults to Column.
* rendering/LayoutState.h:
(WebCore::LayoutState::isPaginatingColumns): Changed to check the pagination unit.
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::layoutBlock): Added code to set the pagination unit in the ColumnInfo.
(WebCore::RenderBlock::paginationUnit): Added. The base class implementation returns Column.
* rendering/RenderBlock.h:
* rendering/RenderView.cpp:
(WebCore::RenderView::paginationUnit): Added this override that returns Page, unless
this is the RenderView for the main frame and pagination is set to behave like columns.
* rendering/RenderView.h:
Source/WebKit/mac: WebKit/mac part of <rdar://problem/
10442663> Paginated display does not respect page-break-{before,after}
https://bugs.webkit.org/show_bug.cgi?id=77505
Reviewed by Darin Adler.
* WebView/WebView.mm:
(-[WebView _setPaginationBehavesLikeColumns:]): Added this setter.
(-[WebView _paginationBehavesLikeColumns]): Added this getter.
* WebView/WebViewPrivate.h:
Source/WebKit2: WebKit2 part of <rdar://problem/
10442663> Paginated display does not respect page-break-{before,after}
https://bugs.webkit.org/show_bug.cgi?id=77505
Reviewed by Darin Adler.
* Shared/WebPageCreationParameters.cpp:
(WebKit::WebPageCreationParameters::encode): Encode paginationBehavesLikeColumns.
(WebKit::WebPageCreationParameters::decode): Decode paginationBehavesLikeColumns.
* Shared/WebPageCreationParameters.h:
(WebPageCreationParameters): Added paginationBehavesLikeColumns boolean.
* UIProcess/API/C/WKPage.cpp:
(WKPageSetPaginationBehavesLikeColumns): Added this setter.
(WKPageGetPaginationBehavesLikeColumns): Added this getter.
* UIProcess/API/C/WKPagePrivate.h:
* UIProcess/API/mac/WKBrowsingContextController.mm:
(-[WKBrowsingContextController setPaginationBehavesLikeColumns:]): Added this Objective-C
wrapper around WKPageSetPaginationBehavesLikeColumns.
(-[WKBrowsingContextController paginationBehavesLikeColumns]): Added this Objective-C wrapper
around WKPageGetPaginationBehavesLikeColumns.
* UIProcess/API/mac/WKBrowsingContextControllerPrivate.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::WebPageProxy): Added call to setPaginationBehavesLikeColumns() with
the value from the creation parameters.
(WebKit::WebPageProxy::setPaginationBehavesLikeColumns): Added this setter.
(WebKit::WebPageProxy::creationParameters): Populate paginationBehavesLikeColumns.
* UIProcess/WebPageProxy.h:
(WebKit::WebPageProxy::paginationBehavesLikeColumns): Added this getter.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::setPaginationBehavesLikeColumns): Added this setter.
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in: Added SetPaginationBehavesLikeColumns message.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@106511
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2012-02-01 Dan Bernstein <mitz@apple.com>
+
+ WebCore part of <rdar://problem/10442663> Paginated display does not respect page-break-{before,after}
+ https://bugs.webkit.org/show_bug.cgi?id=77505
+
+ Reviewed by Darin Adler.
+
+ * page/Page.h:
+ (WebCore::Page::Pagination::Pagination): Added initializer for the behavesLikeColumns member
+ variable.
+ (WebCore::Page::Pagination::operator==): Added comparison of behavesLikeColumns values.
+ (Pagination): Added behavesLikeColumns member variable. When set to false (the default),
+ paginated display respects the page-break-{before,after} properties rather than the
+ column-break-{before,after} ones.
+ * rendering/ColumnInfo.h:
+ (WebCore::ColumnInfo::ColumnInfo): Added initializer for the m_paginationUnit member.
+ (WebCore::ColumnInfo::paginationUnit): Added this getter.
+ (WebCore::ColumnInfo::setPaginationUnit): Added this setter.
+ (ColumnInfo): Added m_paginationUnit member. It defaults to Column.
+ * rendering/LayoutState.h:
+ (WebCore::LayoutState::isPaginatingColumns): Changed to check the pagination unit.
+ * rendering/RenderBlock.cpp:
+ (WebCore::RenderBlock::layoutBlock): Added code to set the pagination unit in the ColumnInfo.
+ (WebCore::RenderBlock::paginationUnit): Added. The base class implementation returns Column.
+ * rendering/RenderBlock.h:
+ * rendering/RenderView.cpp:
+ (WebCore::RenderView::paginationUnit): Added this override that returns Page, unless
+ this is the RenderView for the main frame and pagination is set to behave like columns.
+ * rendering/RenderView.h:
+
2012-02-01 Florin Malita <fmalita@google.com>
Backgrounds in HTML inside foreignObject don't draw
Pagination()
: mode(Unpaginated)
+ , behavesLikeColumns(false)
, pageLength(0)
, gap(0)
{
bool operator==(const Pagination& other) const
{
- return mode == other.mode && pageLength == other.pageLength && gap == other.gap;
+ return mode == other.mode && behavesLikeColumns == other.behavesLikeColumns && pageLength == other.pageLength && gap == other.gap;
}
Mode mode;
+ bool behavesLikeColumns;
unsigned pageLength;
unsigned gap;
};
, m_forcedBreaks(0)
, m_maximumDistanceBetweenForcedBreaks(0)
, m_forcedBreakOffset(0)
+ , m_paginationUnit(Column)
{
}
m_forcedBreakOffset = offsetFromFirstPage;
}
+ enum PaginationUnit { Column, Page };
+ PaginationUnit paginationUnit() const { return m_paginationUnit; }
+ void setPaginationUnit(PaginationUnit paginationUnit) { m_paginationUnit = paginationUnit; }
+
private:
LayoutUnit m_desiredColumnWidth;
unsigned m_desiredColumnCount;
int m_forcedBreaks; // FIXME: We will ultimately need to cache more information to balance around forced breaks properly.
int m_maximumDistanceBetweenForcedBreaks;
int m_forcedBreakOffset;
+ PaginationUnit m_paginationUnit;
};
}
#ifndef LayoutState_h
#define LayoutState_h
+#include "ColumnInfo.h"
#include "LayoutTypes.h"
#include <wtf/HashMap.h>
#include <wtf/Noncopyable.h>
namespace WebCore {
-class ColumnInfo;
class RenderArena;
class RenderBlock;
class RenderBox;
void operator delete(void*, size_t);
void clearPaginationInformation();
- bool isPaginatingColumns() const { return m_columnInfo; }
+ bool isPaginatingColumns() const { return m_columnInfo && m_columnInfo->paginationUnit() == ColumnInfo::Column; }
bool isPaginated() const { return m_isPaginated; }
// The page logical offset is the object's offset from the top of the page in the page progression
if (!hasSpecifiedPageLogicalHeight && !pageLogicalHeight)
colInfo->clearForcedBreaks();
+
+ colInfo->setPaginationUnit(paginationUnit());
}
RenderView* renderView = view();
return true;
}
+ColumnInfo::PaginationUnit RenderBlock::paginationUnit() const
+{
+ return ColumnInfo::Column;
+}
+
LayoutUnit RenderBlock::applyBeforeBreak(RenderBox* child, LayoutUnit logicalOffset)
{
// FIXME: Add page break checking here when we support printing.
#ifndef RenderBlock_h
#define RenderBlock_h
+#include "ColumnInfo.h"
#include "GapRects.h"
#include "PODIntervalTree.h"
#include "RenderBox.h"
namespace WebCore {
class BidiContext;
-class ColumnInfo;
class InlineIterator;
class LayoutStateMaintainer;
class LazyLineBreakIterator;
LayoutUnit nextPageLogicalTop(LayoutUnit logicalOffset, PageBoundaryRule = ExcludePageBoundary) const;
bool hasNextPage(LayoutUnit logicalOffset, PageBoundaryRule = ExcludePageBoundary) const;
+ virtual ColumnInfo::PaginationUnit paginationUnit() const;
+
LayoutUnit applyBeforeBreak(RenderBox* child, LayoutUnit logicalOffset); // If the child has a before break, then return a new yPos that shifts to the top of the next page/column.
LayoutUnit applyAfterBreak(RenderBox* child, LayoutUnit logicalOffset, MarginInfo&); // If the child has an after break, then return a new offset that shifts to the top of the next page/column.
setDesiredColumnCountAndWidth(1, columnWidth);
}
+ColumnInfo::PaginationUnit RenderView::paginationUnit() const
+{
+ if (m_frameView) {
+ if (Frame* frame = m_frameView->frame()) {
+ if (Page* page = frame->page())
+ return (frame == page->mainFrame() && page->pagination().behavesLikeColumns) ? ColumnInfo::Column : ColumnInfo::Page;
+ }
+ }
+ return ColumnInfo::Page;
+}
+
void RenderView::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
{
// If we ever require layout but receive a paint anyway, something has gone horribly wrong.
private:
virtual void calcColumnWidth() OVERRIDE;
+ virtual ColumnInfo::PaginationUnit paginationUnit() const OVERRIDE;
bool shouldRepaint(const IntRect& r) const;
+2012-02-01 Dan Bernstein <mitz@apple.com>
+
+ WebKit/mac part of <rdar://problem/10442663> Paginated display does not respect page-break-{before,after}
+ https://bugs.webkit.org/show_bug.cgi?id=77505
+
+ Reviewed by Darin Adler.
+
+ * WebView/WebView.mm:
+ (-[WebView _setPaginationBehavesLikeColumns:]): Added this setter.
+ (-[WebView _paginationBehavesLikeColumns]): Added this getter.
+ * WebView/WebViewPrivate.h:
+
2012-01-25 Eric Seidel <eric@webkit.org>
HTMLIsIndexElement should not expose HTMLInputElement properties
return WebPaginationModeUnpaginated;
}
+- (void)_setPaginationBehavesLikeColumns:(BOOL)behavesLikeColumns
+{
+ Page* page = core(self);
+ if (!page)
+ return;
+
+ Page::Pagination pagination = page->pagination();
+ pagination.behavesLikeColumns = behavesLikeColumns;
+}
+
+- (BOOL)_paginationBehavesLikeColumns
+{
+ Page* page = core(self);
+ if (!page)
+ return NO;
+
+ return page->pagination().behavesLikeColumns;
+}
+
- (void)_setPageLength:(CGFloat)pageLength
{
Page* page = core(self);
- (void)_setPaginationMode:(WebPaginationMode)paginationMode;
- (WebPaginationMode)_paginationMode;
+
+// Whether the column-break-{before,after} properties are respected instead of the
+// page-break-{before,after} properties.
+- (void)_setPaginationBehavesLikeColumns:(BOOL)behavesLikeColumns;
+- (BOOL)_paginationBehavesLikeColumns;
+
// Set to 0 to have the page length equal the view length.
- (void)_setPageLength:(CGFloat)pageLength;
- (CGFloat)_pageLength;
+2012-02-01 Dan Bernstein <mitz@apple.com>
+
+ WebKit2 part of <rdar://problem/10442663> Paginated display does not respect page-break-{before,after}
+ https://bugs.webkit.org/show_bug.cgi?id=77505
+
+ Reviewed by Darin Adler.
+
+ * Shared/WebPageCreationParameters.cpp:
+ (WebKit::WebPageCreationParameters::encode): Encode paginationBehavesLikeColumns.
+ (WebKit::WebPageCreationParameters::decode): Decode paginationBehavesLikeColumns.
+ * Shared/WebPageCreationParameters.h:
+ (WebPageCreationParameters): Added paginationBehavesLikeColumns boolean.
+ * UIProcess/API/C/WKPage.cpp:
+ (WKPageSetPaginationBehavesLikeColumns): Added this setter.
+ (WKPageGetPaginationBehavesLikeColumns): Added this getter.
+ * UIProcess/API/C/WKPagePrivate.h:
+ * UIProcess/API/mac/WKBrowsingContextController.mm:
+ (-[WKBrowsingContextController setPaginationBehavesLikeColumns:]): Added this Objective-C
+ wrapper around WKPageSetPaginationBehavesLikeColumns.
+ (-[WKBrowsingContextController paginationBehavesLikeColumns]): Added this Objective-C wrapper
+ around WKPageGetPaginationBehavesLikeColumns.
+ * UIProcess/API/mac/WKBrowsingContextControllerPrivate.h:
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::WebPageProxy): Added call to setPaginationBehavesLikeColumns() with
+ the value from the creation parameters.
+ (WebKit::WebPageProxy::setPaginationBehavesLikeColumns): Added this setter.
+ (WebKit::WebPageProxy::creationParameters): Populate paginationBehavesLikeColumns.
+ * UIProcess/WebPageProxy.h:
+ (WebKit::WebPageProxy::paginationBehavesLikeColumns): Added this getter.
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::WebPage::setPaginationBehavesLikeColumns): Added this setter.
+ * WebProcess/WebPage/WebPage.h:
+ * WebProcess/WebPage/WebPage.messages.in: Added SetPaginationBehavesLikeColumns message.
+
2012-02-01 Anders Carlsson <andersca@apple.com>
REGRESSION (r104727): Strange graphics corruption opening a new tab in Safari
encoder->encode(useFixedLayout);
encoder->encode(fixedLayoutSize);
encoder->encodeEnum(paginationMode);
+ encoder->encode(paginationBehavesLikeColumns);
encoder->encode(pageLength);
encoder->encode(gapBetweenPages);
encoder->encode(userAgent);
return false;
if (!decoder->decodeEnum(parameters.paginationMode))
return false;
+ if (!decoder->decode(parameters.paginationBehavesLikeColumns))
+ return false;
if (!decoder->decode(parameters.pageLength))
return false;
if (!decoder->decode(parameters.gapBetweenPages))
WebCore::IntSize fixedLayoutSize;
WebCore::Page::Pagination::Mode paginationMode;
+ bool paginationBehavesLikeColumns;
double pageLength;
double gapBetweenPages;
return kWKPaginationModeUnpaginated;
}
+void WKPageSetPaginationBehavesLikeColumns(WKPageRef pageRef, bool behavesLikeColumns)
+{
+ toImpl(pageRef)->setPaginationBehavesLikeColumns(behavesLikeColumns);
+}
+
+bool WKPageGetPaginationBehavesLikeColumns(WKPageRef pageRef)
+{
+ return toImpl(pageRef)->paginationBehavesLikeColumns();
+}
+
void WKPageSetPageLength(WKPageRef pageRef, double pageLength)
{
toImpl(pageRef)->setPageLength(pageLength);
WK_EXPORT void WKPageSetPaginationMode(WKPageRef page, WKPaginationMode paginationMode);
WK_EXPORT WKPaginationMode WKPageGetPaginationMode(WKPageRef page);
+WK_EXPORT void WKPageSetPaginationBehavesLikeColumns(WKPageRef page, bool behavesLikeColumns);
+WK_EXPORT bool WKPageGetPaginationBehavesLikeColumns(WKPageRef page);
WK_EXPORT void WKPageSetPageLength(WKPageRef page, double pagesPerView);
WK_EXPORT double WKPageGetPageLength(WKPageRef page);
WK_EXPORT void WKPageSetGapBetweenPages(WKPageRef page, double gap);
return WKPaginationModeUnpaginated;
}
+- (void)setPaginationBehavesLikeColumns:(BOOL)behavesLikeColumns
+{
+ WKPageSetPaginationBehavesLikeColumns(self._pageRef, behavesLikeColumns);
+}
+
+- (BOOL)paginationBehavesLikeColumns
+{
+ return WKPageGetPaginationBehavesLikeColumns(self._pageRef);
+}
+
- (void)setPageLength:(CGFloat)pageLength
{
WKPageSetPageLength(self._pageRef, pageLength);
@interface WKBrowsingContextController (Private)
@property WKBrowsingContextPaginationMode paginationMode;
+// Whether the column-break-{before,after} properties are respected instead of the
+// page-break-{before,after} properties.
+@property BOOL paginationBehavesLikeColumns;
// Set to 0 to have the page length equal the view length.
@property CGFloat pageLength;
@property CGFloat gapBetweenPages;
, m_areMemoryCacheClientCallsEnabled(true)
, m_useFixedLayout(false)
, m_paginationMode(Page::Pagination::Unpaginated)
+ , m_paginationBehavesLikeColumns(false)
, m_pageLength(0)
, m_gapBetweenPages(0)
, m_isValid(true)
process()->send(Messages::WebPage::SetPaginationMode(mode), m_pageID);
}
+void WebPageProxy::setPaginationBehavesLikeColumns(bool behavesLikeColumns)
+{
+ if (behavesLikeColumns == m_paginationBehavesLikeColumns)
+ return;
+
+ m_paginationBehavesLikeColumns = behavesLikeColumns;
+
+ if (!isValid())
+ return;
+ process()->send(Messages::WebPage::SetPaginationBehavesLikeColumns(behavesLikeColumns), m_pageID);
+}
+
void WebPageProxy::setPageLength(double pageLength)
{
if (pageLength == m_pageLength)
parameters.useFixedLayout = m_useFixedLayout;
parameters.fixedLayoutSize = m_fixedLayoutSize;
parameters.paginationMode = m_paginationMode;
+ parameters.paginationBehavesLikeColumns = m_paginationBehavesLikeColumns;
parameters.pageLength = m_pageLength;
parameters.gapBetweenPages = m_gapBetweenPages;
parameters.userAgent = userAgent();
void setPaginationMode(WebCore::Page::Pagination::Mode);
WebCore::Page::Pagination::Mode paginationMode() const { return m_paginationMode; }
+ void setPaginationBehavesLikeColumns(bool);
+ bool paginationBehavesLikeColumns() const { return m_paginationBehavesLikeColumns; }
void setPageLength(double);
double pageLength() const { return m_pageLength; }
void setGapBetweenPages(double);
WebCore::IntSize m_fixedLayoutSize;
WebCore::Page::Pagination::Mode m_paginationMode;
+ bool m_paginationBehavesLikeColumns;
double m_pageLength;
double m_gapBetweenPages;
setDrawsTransparentBackground(parameters.drawsTransparentBackground);
setPaginationMode(parameters.paginationMode);
+ setPaginationBehavesLikeColumns(parameters.paginationBehavesLikeColumns);
setPageLength(parameters.pageLength);
setGapBetweenPages(parameters.gapBetweenPages);
m_page->setPagination(pagination);
}
+void WebPage::setPaginationBehavesLikeColumns(bool behavesLikeColumns)
+{
+ Page::Pagination pagination = m_page->pagination();
+ pagination.behavesLikeColumns = behavesLikeColumns;
+ m_page->setPagination(pagination);
+}
+
void WebPage::setPageLength(double pageLength)
{
Page::Pagination pagination = m_page->pagination();
void setFixedLayoutSize(const WebCore::IntSize&);
void setPaginationMode(uint32_t /* WebCore::Page::Pagination::Mode */);
+ void setPaginationBehavesLikeColumns(bool);
void setPageLength(double);
void setGapBetweenPages(double);
SetFixedLayoutSize(WebCore::IntSize size)
SetPaginationMode(uint32_t mode);
+ SetPaginationBehavesLikeColumns(bool behavesLikeColumns);
SetPageLength(double pageLength);
SetGapBetweenPages(double gap);