Changeset 101574 in webkit
- Timestamp:
- Nov 30, 2011 5:14:25 PM (12 years ago)
- Location:
- trunk/Source
- Files:
-
- 22 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r101573 r101574 1 2011-11-30 Dan Bernstein <mitz@apple.com> 2 3 WebCore part of: Allow the length of a page along the pagination axis to differ from the length of the view 4 https://bugs.webkit.org/show_bug.cgi?id=73476 5 6 Reviewed by Anders Carlsson. 7 8 * page/Page.cpp: 9 (WebCore::Page::setPagination): Changed to use Pagination::operator==. 10 * page/Page.h: 11 (WebCore::Page::Pagination::Pagination): Added initializer for the new pageLength member variable. 12 (WebCore::Page::Pagination::operator==): Added. 13 * rendering/RenderBlock.cpp: 14 (WebCore::RenderBlock::layoutColumns): Narrowed the scope of a local variable. 15 * rendering/RenderBlock.h: Promoted setDesiredColumnCountAndWidth() from private to protected, 16 allowing its use from RenderView::calcColumnWidth(). Made calcColumnWidth() virtual. 17 * rendering/RenderView.cpp: 18 (WebCore::RenderView::calcColumnWidth): Added. Uses the page length specified in the pagination 19 parameters to set the column width, if pages are to be laid out one next to the other. 20 (WebCore::RenderView::viewLogicalHeight): Added. Uses the page length specified in the pagination 21 parameters as the height, if pages are to be laid out one after the other. 22 * rendering/RenderView.h: 23 1 24 2011-11-30 Chris Fleizach <cfleizach@apple.com> 2 25 -
trunk/Source/WebCore/page/Page.cpp
r101345 r101574 678 678 void Page::setPagination(const Pagination& pagination) 679 679 { 680 if (m_pagination .mode == pagination.mode && m_pagination.gap == pagination.gap)680 if (m_pagination == pagination) 681 681 return; 682 682 -
trunk/Source/WebCore/page/Page.h
r101307 r101574 262 262 Pagination() 263 263 : mode(Unpaginated) 264 , pageLength(0) 264 265 , gap(0) 265 266 { 266 267 }; 267 268 269 bool operator==(const Pagination& other) const 270 { 271 return mode == other.mode && pageLength == other.pageLength && gap == other.gap; 272 } 273 268 274 Mode mode; 275 unsigned pageLength; 269 276 unsigned gap; 270 277 }; -
trunk/Source/WebCore/rendering/RenderBlock.cpp
r101411 r101574 4620 4620 // the distance between forced page breaks is so that we can avoid making the minimum column height too tall. 4621 4621 ColumnInfo* colInfo = columnInfo(); 4622 int desiredColumnCount = colInfo->desiredColumnCount();4623 4622 if (!hasSpecifiedPageLogicalHeight) { 4624 4623 LayoutUnit columnHeight = pageLogicalHeight; 4625 4624 int minColumnCount = colInfo->forcedBreaks() + 1; 4625 int desiredColumnCount = colInfo->desiredColumnCount(); 4626 4626 if (minColumnCount >= desiredColumnCount) { 4627 4627 // The forced page breaks are in control of the balancing. Just set the column height to the -
trunk/Source/WebCore/rendering/RenderBlock.h
r99613 r101574 415 415 void simplifiedNormalFlowLayout(); 416 416 417 void setDesiredColumnCountAndWidth(int, LayoutUnit); 418 417 419 void computeOverflow(LayoutUnit oldClientAfterEdge, bool recomputeFloats = false); 418 420 virtual void addOverflowFromChildren(); … … 751 753 LayoutUnit desiredColumnWidth() const; 752 754 unsigned desiredColumnCount() const; 753 void setDesiredColumnCountAndWidth(int count, LayoutUnit width);754 755 755 756 void paintContinuationOutlines(PaintInfo&, const LayoutPoint&); … … 770 771 void offsetForContents(LayoutPoint&) const; 771 772 772 v oid calcColumnWidth();773 virtual void calcColumnWidth(); 773 774 bool layoutColumns(bool hasSpecifiedPageLogicalHeight, LayoutUnit pageLogicalHeight, LayoutStateMaintainer&); 774 775 void makeChildrenAnonymousColumnBlocks(RenderObject* beforeChild, RenderBlock* newBlockBox, RenderObject* newChild); -
trunk/Source/WebCore/rendering/RenderView.cpp
r99630 r101574 186 186 } 187 187 188 void RenderView::calcColumnWidth() 189 { 190 int columnWidth = contentLogicalWidth(); 191 if (m_frameView && style()->hasInlineColumnAxis()) { 192 if (Frame* frame = m_frameView->frame()) { 193 if (Page* page = frame->page()) { 194 if (int pageLength = page->pagination().pageLength) 195 columnWidth = pageLength; 196 } 197 } 198 } 199 setDesiredColumnCountAndWidth(1, columnWidth); 200 } 201 188 202 void RenderView::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset) 189 203 { … … 735 749 } 736 750 751 int RenderView::viewLogicalHeight() const 752 { 753 int height = style()->isHorizontalWritingMode() ? viewHeight() : viewWidth(); 754 755 if (hasColumns() && !style()->hasInlineColumnAxis()) { 756 if (Frame* frame = m_frameView->frame()) { 757 if (Page* page = frame->page()) { 758 if (frame == page->mainFrame()) { 759 if (int pageLength = page->pagination().pageLength) 760 height = pageLength; 761 } 762 } 763 } 764 } 765 766 return height; 767 } 768 737 769 float RenderView::zoomFactor() const 738 770 { -
trunk/Source/WebCore/rendering/RenderView.h
r99630 r101574 62 62 int viewWidth() const; 63 63 int viewLogicalWidth() const { return style()->isHorizontalWritingMode() ? viewWidth() : viewHeight(); } 64 int viewLogicalHeight() const { return style()->isHorizontalWritingMode() ? viewHeight() : viewWidth(); }64 int viewLogicalHeight() const; 65 65 66 66 float zoomFactor() const; … … 195 195 196 196 private: 197 virtual void calcColumnWidth() OVERRIDE; 198 197 199 bool shouldRepaint(const IntRect& r) const; 198 200 -
trunk/Source/WebKit/mac/ChangeLog
r101486 r101574 1 2011-11-30 Dan Bernstein <mitz@apple.com> 2 3 WebKit/mac part of: Allow the length of a page along the pagination axis to differ from the length of the view 4 https://bugs.webkit.org/show_bug.cgi?id=73476 5 6 Reviewed by Anders Carlsson. 7 8 * WebView/WebView.mm: 9 (-[WebView _setPageLength:]): Added this accessor. 10 (-[WebView _pageLength]): Ditto. 11 * WebView/WebViewPrivate.h: 12 1 13 2011-11-30 Alexey Proskuryakov <ap@apple.com> 2 14 -
trunk/Source/WebKit/mac/WebView/WebView.mm
r101413 r101574 2779 2779 } 2780 2780 2781 - (void)_setPageLength:(CGFloat)pageLength 2782 { 2783 Page* page = core(self); 2784 if (!page) 2785 return; 2786 2787 Page::Pagination pagination = page->pagination(); 2788 pagination.pageLength = pageLength; 2789 2790 page->setPagination(pagination); 2791 } 2792 2793 - (CGFloat)_pageLength 2794 { 2795 Page* page = core(self); 2796 if (!page) 2797 return 1; 2798 2799 return page->pagination().pageLength; 2800 } 2801 2781 2802 - (void)_setGapBetweenPages:(CGFloat)pageGap 2782 2803 { -
trunk/Source/WebKit/mac/WebView/WebViewPrivate.h
r100534 r101574 564 564 - (void)_setPaginationMode:(WebPaginationMode)paginationMode; 565 565 - (WebPaginationMode)_paginationMode; 566 // Set to 0 to have the page length equal the view length. 567 - (void)_setPageLength:(CGFloat)pageLength; 568 - (CGFloat)_pageLength; 566 569 - (void)_setGapBetweenPages:(CGFloat)pageGap; 567 570 - (CGFloat)_gapBetweenPages; -
trunk/Source/WebKit2/ChangeLog
r101547 r101574 1 2011-11-30 Dan Bernstein <mitz@apple.com> 2 3 WebKit2 part of: Allow the length of a page along the pagination axis to differ from the length of the view 4 https://bugs.webkit.org/show_bug.cgi?id=73476 5 6 Reviewed by Anders Carlsson. 7 8 * Shared/WebPageCreationParameters.cpp: 9 (WebKit::WebPageCreationParameters::encode): Encode pageLength. 10 (WebKit::WebPageCreationParameters::decode): Decode pageLength. 11 * Shared/WebPageCreationParameters.h: Added pageLength. 12 * UIProcess/API/C/WKPage.cpp: 13 (WKPageSetPageLength): Added this accessor. 14 (WKPageGetPageLength): Ditto. 15 * UIProcess/API/C/WKPagePrivate.h: 16 * UIProcess/API/mac/WKBrowsingContextController.mm: 17 (-[WKBrowsingContextController setPageLength:]): Ditto. 18 (-[WKBrowsingContextController pageLength]): Ditto. 19 * UIProcess/API/mac/WKBrowsingContextControllerPrivate.h: 20 * UIProcess/WebPageProxy.cpp: 21 (WebKit::WebPageProxy::WebPageProxy): Added initializer for m_pageLength. 22 (WebKit::WebPageProxy::setPageLength): Added. 23 (WebKit::WebPageProxy::creationParameters): Initialize pageLength. 24 * UIProcess/WebPageProxy.h: 25 (WebKit::WebPageProxy::pageLength): Added. 26 * WebProcess/WebPage/WebPage.cpp: 27 (WebKit::WebPage::WebPage): Set the page length based on the creation parameters. 28 (WebKit::WebPage::setPageLength): Added. 29 * WebProcess/WebPage/WebPage.h: 30 * WebProcess/WebPage/WebPage.messages.in: Added SetPageLength. 31 1 32 2011-11-30 Alejandro G. Castro <alex@igalia.com> 2 33 -
trunk/Source/WebKit2/Shared/WebPageCreationParameters.cpp
r100534 r101574 48 48 encoder->encode(fixedLayoutSize); 49 49 encoder->encodeEnum(paginationMode); 50 encoder->encode(pageLength); 50 51 encoder->encode(gapBetweenPages); 51 52 encoder->encode(userAgent); … … 95 96 if (!decoder->decodeEnum(parameters.paginationMode)) 96 97 return false; 98 if (!decoder->decode(parameters.pageLength)) 99 return false; 97 100 if (!decoder->decode(parameters.gapBetweenPages)) 98 101 return false; -
trunk/Source/WebKit2/Shared/WebPageCreationParameters.h
r100534 r101574 65 65 66 66 WebCore::Page::Pagination::Mode paginationMode; 67 double pageLength; 67 68 double gapBetweenPages; 68 69 -
trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp
r100534 r101574 380 380 } 381 381 382 void WKPageSetPageLength(WKPageRef pageRef, double pageLength) 383 { 384 toImpl(pageRef)->setPageLength(pageLength); 385 } 386 387 double WKPageGetPageLength(WKPageRef pageRef) 388 { 389 return toImpl(pageRef)->pageLength(); 390 } 391 382 392 void WKPageSetGapBetweenPages(WKPageRef pageRef, double gap) 383 393 { -
trunk/Source/WebKit2/UIProcess/API/C/WKPagePrivate.h
r100534 r101574 62 62 WK_EXPORT void WKPageSetPaginationMode(WKPageRef page, WKPaginationMode paginationMode); 63 63 WK_EXPORT WKPaginationMode WKPageGetPaginationMode(WKPageRef page); 64 WK_EXPORT void WKPageSetPageLength(WKPageRef page, double pagesPerView); 65 WK_EXPORT double WKPageGetPageLength(WKPageRef page); 64 66 WK_EXPORT void WKPageSetGapBetweenPages(WKPageRef page, double gap); 65 67 WK_EXPORT double WKPageGetGapBetweenPages(WKPageRef page); -
trunk/Source/WebKit2/UIProcess/API/mac/WKBrowsingContextController.mm
r100534 r101574 235 235 } 236 236 237 - (void)setPageLength:(CGFloat)pageLength 238 { 239 WKPageSetPageLength(self.pageRef, pageLength); 240 } 241 242 - (CGFloat)pageLength 243 { 244 return WKPageGetPageLength(self.pageRef); 245 } 246 237 247 - (void)setGapBetweenPages:(CGFloat)gapBetweenPages 238 248 { -
trunk/Source/WebKit2/UIProcess/API/mac/WKBrowsingContextControllerPrivate.h
r100534 r101574 36 36 37 37 @property WKBrowsingContextPaginationMode paginationMode; 38 // Set to 0 to have the page length equal the view length. 39 @property CGFloat pageLength; 38 40 @property CGFloat gapBetweenPages; 39 41 -
trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp
r101290 r101574 162 162 , m_useFixedLayout(false) 163 163 , m_paginationMode(Page::Pagination::Unpaginated) 164 , m_pageLength(0) 164 165 , m_gapBetweenPages(0) 165 166 , m_isValid(true) … … 1297 1298 } 1298 1299 1300 void WebPageProxy::setPageLength(double pageLength) 1301 { 1302 if (pageLength == m_pageLength) 1303 return; 1304 1305 m_pageLength = pageLength; 1306 1307 if (!isValid()) 1308 return; 1309 process()->send(Messages::WebPage::SetPageLength(pageLength), m_pageID); 1310 } 1311 1299 1312 void WebPageProxy::setGapBetweenPages(double gap) 1300 1313 { … … 3192 3205 parameters.fixedLayoutSize = m_fixedLayoutSize; 3193 3206 parameters.paginationMode = m_paginationMode; 3207 parameters.pageLength = m_pageLength; 3194 3208 parameters.gapBetweenPages = m_gapBetweenPages; 3195 3209 parameters.userAgent = userAgent(); -
trunk/Source/WebKit2/UIProcess/WebPageProxy.h
r101290 r101574 416 416 void setPaginationMode(WebCore::Page::Pagination::Mode); 417 417 WebCore::Page::Pagination::Mode paginationMode() const { return m_paginationMode; } 418 void setPageLength(double); 419 double pageLength() const { return m_pageLength; } 418 420 void setGapBetweenPages(double); 419 421 double gapBetweenPages() const { return m_gapBetweenPages; } … … 901 903 902 904 WebCore::Page::Pagination::Mode m_paginationMode; 905 double m_pageLength; 903 906 double m_gapBetweenPages; 904 907 -
trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp
r101532 r101574 250 250 251 251 setPaginationMode(parameters.paginationMode); 252 setPageLength(parameters.pageLength); 252 253 setGapBetweenPages(parameters.gapBetweenPages); 253 254 … … 932 933 Page::Pagination pagination = m_page->pagination(); 933 934 pagination.mode = static_cast<Page::Pagination::Mode>(mode); 935 m_page->setPagination(pagination); 936 } 937 938 void WebPage::setPageLength(double pageLength) 939 { 940 Page::Pagination pagination = m_page->pagination(); 941 pagination.pageLength = pageLength; 934 942 m_page->setPagination(pagination); 935 943 } -
trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h
r101307 r101574 269 269 270 270 void setPaginationMode(uint32_t /* WebCore::Page::Pagination::Mode */); 271 void setPageLength(double); 271 272 void setGapBetweenPages(double); 272 273 -
trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in
r100534 r101574 123 123 124 124 SetPaginationMode(uint32_t mode); 125 SetPageLength(double pageLength); 125 126 SetGapBetweenPages(double gap); 126 127
Note: See TracChangeset
for help on using the changeset viewer.