Changeset 86632 in webkit
- Timestamp:
- May 16, 2011 4:33:51 PM (13 years ago)
- Location:
- trunk/Source
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r86631 r86632 1 2011-05-16 Emil A Eklund <eae@chromium.org> 2 3 Reviewed by Eric Seidel. 4 5 Replace docTop/Right/Bottom/Left/Width/Height with documentRect 6 https://bugs.webkit.org/show_bug.cgi?id=60743 7 8 Change RenderView::documentRect to compute rect once rather than four times. 9 Replace all uses of docTop/Right/Bottom/Left/Width/Height with documentRect to 10 simplify the code and reduce complexity. 11 12 Covered by existing tests. 13 14 * WebCore.exp.in: 15 * page/FrameView.cpp: 16 (WebCore::FrameView::adjustViewSize): 17 (WebCore::FrameView::forceLayoutForPagination): 18 * page/PrintContext.cpp: 19 (WebCore::PrintContext::computePageRects): 20 * rendering/RenderBox.cpp: 21 (WebCore::RenderBox::paintRootBoxFillLayers): 22 * rendering/RenderLayerCompositor.cpp: 23 (WebCore::RenderLayerCompositor::updateRootLayerPosition): 24 * rendering/RenderView.cpp: 25 (WebCore::RenderView::documentRect): 26 * rendering/RenderView.h: 27 1 28 2011-05-16 Tony Chang <tony@chromium.org> 2 29 -
trunk/Source/WebCore/WebCore.exp.in
r86451 r86632 1027 1027 __ZNK7WebCore10RenderText9firstRunXEv 1028 1028 __ZNK7WebCore10RenderText9firstRunYEv 1029 __ZNK7WebCore10RenderView6docTopEv 1030 __ZNK7WebCore10RenderView7docLeftEv 1031 __ZNK7WebCore10RenderView8docRightEv 1032 __ZNK7WebCore10RenderView9docBottomEv 1029 __ZNK7WebCore10RenderView12documentRectEv 1033 1030 __ZNK7WebCore10ScrollView12contentsSizeEv 1034 1031 __ZNK7WebCore10ScrollView12documentViewEv -
trunk/Source/WebCore/page/FrameView.cpp
r86597 r86632 503 503 return; 504 504 505 IntSize size = IntSize(root->docWidth(), root->docHeight());506 507 ScrollView::setScrollOrigin(IntPoint(-r oot->docLeft(), -root->docTop()), !m_frame->document()->printing(), size == contentsSize());505 const IntRect& rect = root->documentRect(); 506 const IntSize& size = rect.size(); 507 ScrollView::setScrollOrigin(IntPoint(-rect.x(), -rect.y()), !m_frame->document()->printing(), size == contentsSize()); 508 508 509 509 setContentsSize(size); … … 2553 2553 // FIXME: We are assuming a shrink-to-fit printing implementation. A cropping 2554 2554 // implementation should not do this! 2555 int docLogicalWidth = root->style()->isHorizontalWritingMode() ? root->docWidth() : root->docHeight(); 2555 const IntRect& documentRect = root->documentRect(); 2556 bool horizontalWritingMode = root->style()->isHorizontalWritingMode(); 2557 int docLogicalWidth = horizontalWritingMode ? documentRect.width() : documentRect.height(); 2556 2558 if (docLogicalWidth > pageLogicalWidth) { 2557 2559 flooredPageLogicalWidth = std::min<int>(docLogicalWidth, pageLogicalWidth * maximumShrinkFactor); … … 2561 2563 root->setNeedsLayoutAndPrefWidthsRecalc(); 2562 2564 forceLayout(); 2563 int docLogicalHeight = root->style()->isHorizontalWritingMode() ? root->docHeight() : root->docWidth();2564 int docLogicalTop = root->style()->isHorizontalWritingMode() ? root->docTop() : root->docLeft();2565 int docLogicalRight = root->style()->isHorizontalWritingMode() ? root->docRight() : root->docBottom();2565 int docLogicalHeight = horizontalWritingMode ? documentRect.height() : documentRect.width(); 2566 int docLogicalTop = horizontalWritingMode ? documentRect.y() : documentRect.x(); 2567 int docLogicalRight = horizontalWritingMode ? documentRect.maxX() : documentRect.maxY(); 2566 2568 int clippedLogicalLeft = 0; 2567 2569 if (!root->style()->isLeftToRightDirection()) 2568 2570 clippedLogicalLeft = docLogicalRight - flooredPageLogicalWidth; 2569 2571 IntRect overflow(clippedLogicalLeft, docLogicalTop, flooredPageLogicalWidth, docLogicalHeight); 2570 if (! root->style()->isHorizontalWritingMode())2572 if (!horizontalWritingMode) 2571 2573 overflow = overflow.transposedRect(); 2572 2574 root->clearLayoutOverflow(); -
trunk/Source/WebCore/page/PrintContext.cpp
r86542 r86632 75 75 float pageWidth; 76 76 float pageHeight; 77 const IntRect& documentRect = view->documentRect(); 77 78 if (isHorizontal) { 78 79 float ratio = printRect.height() / printRect.width(); 79 pageWidth = view->docWidth();80 pageWidth = documentRect.width(); 80 81 pageHeight = floorf(pageWidth * ratio); 81 82 } else { 82 83 float ratio = printRect.width() / printRect.height(); 83 pageHeight = view->docHeight();84 pageHeight = documentRect.height(); 84 85 pageWidth = floorf(pageHeight * ratio); 85 86 } -
trunk/Source/WebCore/rendering/RenderBox.cpp
r86448 r86632 799 799 800 800 // The background of the box generated by the root element covers the entire canvas, so just use 801 // the RenderView's doc Top/Left/Width/Height accessors.801 // the RenderView's documentRect accessor. 802 802 paintFillLayers(paintInfo, bgColor, bgLayer, view()->documentRect(), BackgroundBleedNone, CompositeSourceOver, bodyObject); 803 803 } -
trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp
r85094 r86632 1140 1140 { 1141 1141 if (m_rootPlatformLayer) { 1142 m_rootPlatformLayer->setSize(FloatSize(m_renderView->docWidth(), m_renderView->docHeight())); 1143 m_rootPlatformLayer->setPosition(FloatPoint(m_renderView->docLeft(), m_renderView->docTop())); 1142 const IntRect& documentRect = m_renderView->documentRect(); 1143 m_rootPlatformLayer->setSize(documentRect.size()); 1144 m_rootPlatformLayer->setPosition(documentRect.location()); 1144 1145 } 1145 1146 if (m_clipLayer) { -
trunk/Source/WebCore/rendering/RenderView.cpp
r84815 r86632 654 654 } 655 655 656 int RenderView::docTop() const 657 { 658 IntRect overflowRect(0, minYLayoutOverflow(), 0, maxYLayoutOverflow() - minYLayoutOverflow()); 659 flipForWritingMode(overflowRect); 660 if (hasTransform()) 661 overflowRect = layer()->currentTransform().mapRect(overflowRect); 662 return overflowRect.y(); 663 } 664 665 int RenderView::docBottom() const 656 IntRect RenderView::documentRect() const 666 657 { 667 658 IntRect overflowRect(layoutOverflowRect()); … … 669 660 if (hasTransform()) 670 661 overflowRect = layer()->currentTransform().mapRect(overflowRect); 671 return overflowRect.maxY(); 672 } 673 674 int RenderView::docLeft() const 675 { 676 IntRect overflowRect(layoutOverflowRect()); 677 flipForWritingMode(overflowRect); 678 if (hasTransform()) 679 overflowRect = layer()->currentTransform().mapRect(overflowRect); 680 return overflowRect.x(); 681 } 682 683 int RenderView::docRight() const 684 { 685 IntRect overflowRect(layoutOverflowRect()); 686 flipForWritingMode(overflowRect); 687 if (hasTransform()) 688 overflowRect = layer()->currentTransform().mapRect(overflowRect); 689 return overflowRect.maxX(); 662 return overflowRect; 690 663 } 691 664 -
trunk/Source/WebCore/rendering/RenderView.h
r76248 r86632 169 169 #endif 170 170 171 int docTop() const; 172 int docBottom() const; 173 int docHeight() const { return docBottom() - docTop(); } 174 int docLeft() const; 175 int docRight() const; 176 int docWidth() const { return docRight() - docLeft(); } 177 IntRect documentRect() const { return IntRect(docLeft(), docTop(), docWidth(), docHeight()); } 171 IntRect documentRect() const; 178 172 179 173 protected: -
trunk/Source/WebKit/mac/ChangeLog
r86601 r86632 1 2011-05-16 Emil A Eklund <eae@chromium.org> 2 3 Reviewed by Eric Seidel. 4 5 Replace docTop/Right/Bottom/Left/Width/Height with documentRect 6 https://bugs.webkit.org/show_bug.cgi?id=60743 7 8 Replace uses of docWidth/Height with documentRect. 9 10 * WebView/WebFrame.mm: 11 (-[WebFrame _computePageRectsWithPrintScaleFactor:pageSize:]): 12 1 13 2011-05-16 Yuzo Fujishima <yuzo@google.com> 2 14 -
trunk/Source/WebKit/mac/WebView/WebFrame.mm
r86330 r86632 1344 1344 return [NSArray array]; 1345 1345 1346 float printWidth = root->style()->isHorizontalWritingMode() ? root->docWidth() / printScaleFactor : pageSize.width; 1347 float printHeight = root->style()->isHorizontalWritingMode() ? pageSize.height : root->docHeight() / printScaleFactor; 1346 const IntRect& documentRect = root->documentRect(); 1347 float printWidth = root->style()->isHorizontalWritingMode() ? documentRect.width() / printScaleFactor : pageSize.width; 1348 float printHeight = root->style()->isHorizontalWritingMode() ? pageSize.height : documentRect.height() / printScaleFactor; 1348 1349 1349 1350 PrintContext printContext(_private->coreFrame);
Note: See TracChangeset
for help on using the changeset viewer.