Changeset 99040 in webkit
- Timestamp:
- Nov 1, 2011 11:26:16 PM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r99039 r99040 1 2011-11-01 Levi Weintraub <leviw@chromium.org> 2 3 Fix uses of LayoutUnit in Frame-, Scroll-, and RenderView 4 https://bugs.webkit.org/show_bug.cgi?id=71321 5 6 Reviewed by Darin Adler. 7 8 Updating the usage of LayoutUnits in the *View classes to mirror the proper use 9 as derived in the subpixellayout branch. 10 11 This entails scrolling only with integers (and rounding once we've made the switch) 12 and using integers for window coordinates, with LayoutUnits for content coordinates. 13 14 No new tests -- no change in behavior. 15 16 * page/FrameView.cpp: 17 (WebCore::FrameView::invalidateRect): 18 (WebCore::FrameView::setFrameRect): 19 (WebCore::FrameView::zoomAnimatorTransformChanged): 20 (WebCore::FrameView::scrollContentsFastPath): 21 (WebCore::FrameView::scrollContentsSlowPath): 22 (WebCore::FrameView::scrollElementToRect): 23 (WebCore::FrameView::setScrollPosition): 24 (WebCore::FrameView::repaintContentRectangle): 25 (WebCore::FrameView::scrollTo): 26 (WebCore::FrameView::updateScrollCorner): 27 * page/FrameView.h: 28 (WebCore::FrameView::trackedRepaintRects): 29 * platform/ScrollView.cpp: 30 (WebCore::ScrollView::visibleContentRect): 31 (WebCore::ScrollView::layoutWidth): 32 (WebCore::ScrollView::layoutHeight): 33 (WebCore::ScrollView::fixedLayoutSize): 34 (WebCore::ScrollView::setFixedLayoutSize): 35 (WebCore::ScrollView::contentsSize): 36 (WebCore::ScrollView::setContentsSize): 37 (WebCore::ScrollView::overhangAmount): 38 (WebCore::ScrollView::updateScrollbars): 39 (WebCore::ScrollView::rectToCopyOnScroll): 40 (WebCore::ScrollView::scrollContents): 41 (WebCore::ScrollView::windowToContents): 42 (WebCore::ScrollView::screenToContents): 43 (WebCore::ScrollView::scrollbarAtPoint): 44 (WebCore::ScrollView::wheelEvent): 45 * platform/ScrollView.h: 46 (WebCore::ScrollView::visibleWidth): 47 (WebCore::ScrollView::visibleHeight): 48 (WebCore::ScrollView::contentsWidth): 49 (WebCore::ScrollView::contentsHeight): 50 (WebCore::ScrollView::adjustScrollPositionWithinRange): 51 * rendering/RenderView.cpp: 52 (WebCore::RenderView::paint): 53 (WebCore::RenderView::shouldRepaint): 54 (WebCore::RenderView::repaintViewRectangle): 55 (WebCore::RenderView::repaintRectangleInViewAndCompositedLayers): 56 (WebCore::RenderView::computeRectForRepaint): 57 (WebCore::RenderView::selectionBounds): 58 (WebCore::RenderView::viewRect): 59 (WebCore::RenderView::unscaledDocumentRect): 60 (WebCore::RenderView::documentRect): 61 * rendering/RenderView.h: 62 (WebCore::RenderView::printRect): 63 (WebCore::RenderView::setPrintRect): 64 1 65 2011-11-01 Anna Cavender <annacc@chromium.org> 2 66 -
trunk/Source/WebCore/page/FrameView.cpp
r99002 r99040 377 377 } 378 378 379 void FrameView::invalidateRect(const IntRect& rect)379 void FrameView::invalidateRect(const LayoutRect& rect) 380 380 { 381 381 if (!parent()) { … … 398 398 } 399 399 400 void FrameView::setFrameRect(const IntRect& newRect)401 { 402 IntRect oldRect = frameRect();400 void FrameView::setFrameRect(const LayoutRect& newRect) 401 { 402 LayoutRect oldRect = frameRect(); 403 403 if (newRect == oldRect) 404 404 return; … … 1228 1228 if (state == ZoomAnimationFinishing) { 1229 1229 m_page->setPageScaleFactor(m_page->pageScaleFactor() * scale, 1230 LayoutPoint(scale * scrollX() - x, scale * scrollY() - y));1230 IntPoint(scale * scrollX() - x, scale * scrollY() - y)); 1231 1231 scrollAnimator()->resetZoom(); 1232 1232 } … … 1434 1434 } 1435 1435 1436 bool FrameView::scrollContentsFastPath(const IntSize& scrollDelta, const LayoutRect& rectToScroll, const LayoutRect& clipRect)1436 bool FrameView::scrollContentsFastPath(const IntSize& scrollDelta, const IntRect& rectToScroll, const IntRect& clipRect) 1437 1437 { 1438 1438 const size_t fixedObjectThreshold = 5; … … 1450 1450 1451 1451 // Get the rects of the fixed objects visible in the rectToScroll 1452 Vector< LayoutRect, fixedObjectThreshold> subRectToUpdate;1452 Vector<IntRect, fixedObjectThreshold> subRectToUpdate; 1453 1453 bool updateInvalidatedSubRect = true; 1454 1454 RenderBlock::PositionedObjectsListHashSet::const_iterator end = positionedObjects->end(); … … 1457 1457 if (renderBox->style()->position() != FixedPosition) 1458 1458 continue; 1459 LayoutRect updateRect = renderBox->layer()->repaintRectIncludingDescendants();1459 IntRect updateRect = renderBox->layer()->repaintRectIncludingDescendants(); 1460 1460 updateRect = contentsToWindow(updateRect); 1461 1461 if (!isCompositedContentLayer && clipsRepaints()) … … 1478 1478 size_t fixObjectsCount = subRectToUpdate.size(); 1479 1479 for (size_t i = 0; i < fixObjectsCount; ++i) { 1480 LayoutRect updateRect = subRectToUpdate[i];1481 LayoutRect scrolledRect = updateRect;1480 IntRect updateRect = subRectToUpdate[i]; 1481 IntRect scrolledRect = updateRect; 1482 1482 scrolledRect.move(scrollDelta); 1483 1483 updateRect.unite(scrolledRect); … … 1502 1502 } 1503 1503 1504 void FrameView::scrollContentsSlowPath(const LayoutRect& updateRect)1504 void FrameView::scrollContentsSlowPath(const IntRect& updateRect) 1505 1505 { 1506 1506 #if USE(ACCELERATED_COMPOSITING) … … 1665 1665 int centeringOffsetX = (rect.width() - bounds.width()) / 2; 1666 1666 int centeringOffsetY = (rect.height() - bounds.height()) / 2; 1667 setScrollPosition( LayoutPoint(bounds.x() - centeringOffsetX - rect.x(), bounds.y() - centeringOffsetY - rect.y()));1668 } 1669 1670 void FrameView::setScrollPosition(const LayoutPoint& scrollPoint)1667 setScrollPosition(IntPoint(bounds.x() - centeringOffsetX - rect.x(), bounds.y() - centeringOffsetY - rect.y())); 1668 } 1669 1670 void FrameView::setScrollPosition(const IntPoint& scrollPoint) 1671 1671 { 1672 1672 bool wasInProgrammaticScroll = m_inProgrammaticScroll; … … 1742 1742 1743 1743 if (m_isTrackingRepaints) { 1744 IntRect repaintRect = r;1744 LayoutRect repaintRect = r; 1745 1745 repaintRect.move(-scrollOffset()); 1746 1746 m_trackedRepaintRects.append(repaintRect); … … 2356 2356 } 2357 2357 2358 void FrameView::scrollTo(const LayoutSize& newOffset)2358 void FrameView::scrollTo(const IntSize& newOffset) 2359 2359 { 2360 2360 LayoutSize offset = scrollOffset(); … … 2512 2512 RenderObject* renderer = 0; 2513 2513 RefPtr<RenderStyle> cornerStyle; 2514 IntRect cornerRect = scrollCornerRect();2514 LayoutRect cornerRect = scrollCornerRect(); 2515 2515 2516 2516 if (!cornerRect.isEmpty()) { -
trunk/Source/WebCore/page/FrameView.h
r98883 r99040 65 65 virtual HostWindow* hostWindow() const; 66 66 67 virtual void invalidateRect(const IntRect&);68 virtual void setFrameRect(const IntRect&);67 virtual void invalidateRect(const LayoutRect&); 68 virtual void setFrameRect(const LayoutRect&); 69 69 70 70 #if ENABLE(REQUEST_ANIMATION_FRAME) … … 302 302 bool isTrackingRepaints() const { return m_isTrackingRepaints; } 303 303 void resetTrackedRepaints() { m_trackedRepaintRects.clear(); } 304 const Vector< IntRect>& trackedRepaintRects() const { return m_trackedRepaintRects; }304 const Vector<LayoutRect>& trackedRepaintRects() const { return m_trackedRepaintRects; } 305 305 306 306 protected: 307 virtual bool scrollContentsFastPath(const IntSize& scrollDelta, const LayoutRect& rectToScroll, const LayoutRect& clipRect);308 virtual void scrollContentsSlowPath(const LayoutRect& updateRect);307 virtual bool scrollContentsFastPath(const IntSize& scrollDelta, const IntRect& rectToScroll, const IntRect& clipRect); 308 virtual void scrollContentsSlowPath(const IntRect& updateRect); 309 309 310 310 virtual bool isVerticalDocument() const; … … 351 351 virtual bool isActive() const; 352 352 virtual void getTickmarks(Vector<LayoutRect>&) const; 353 virtual void scrollTo(const LayoutSize&);353 virtual void scrollTo(const IntSize&); 354 354 virtual void didStartRubberBand(const IntSize&) const; 355 355 virtual void didCompleteRubberBand(const IntSize&) const; … … 457 457 458 458 bool m_isTrackingRepaints; // Used for testing. 459 Vector< IntRect> m_trackedRepaintRects;459 Vector<LayoutRect> m_trackedRepaintRects; 460 460 461 461 bool m_shouldUpdateWhileOffscreen; -
trunk/Source/WebCore/platform/ScrollView.cpp
r99002 r99040 232 232 return m_fixedVisibleContentRect; 233 233 234 int verticalScrollbarWidth = verticalScrollbar() && !verticalScrollbar()->isOverlayScrollbar()234 LayoutUnit verticalScrollbarWidth = verticalScrollbar() && !verticalScrollbar()->isOverlayScrollbar() 235 235 && !includeScrollbars ? verticalScrollbar()->width() : 0; 236 int horizontalScrollbarHeight = horizontalScrollbar() && !horizontalScrollbar()->isOverlayScrollbar()236 LayoutUnit horizontalScrollbarHeight = horizontalScrollbar() && !horizontalScrollbar()->isOverlayScrollbar() 237 237 && !includeScrollbars ? horizontalScrollbar()->height() : 0; 238 238 239 return IntRect(IntPoint(m_scrollOffset.width(), m_scrollOffset.height()), 240 IntSize(max(0, width() - verticalScrollbarWidth), 241 max(0, height() - horizontalScrollbarHeight))); 242 } 243 #endif 244 245 int ScrollView::layoutWidth() const 239 return LayoutRect(LayoutPoint(m_scrollOffset.width(), m_scrollOffset.height()), 240 LayoutSize(max<LayoutUnit>(0, width() - verticalScrollbarWidth), 241 max<LayoutUnit>(0, height() - horizontalScrollbarHeight))); 242 243 } 244 #endif 245 246 LayoutUnit ScrollView::layoutWidth() const 246 247 { 247 248 return m_fixedLayoutSize.isEmpty() || !m_useFixedLayout ? visibleWidth() : m_fixedLayoutSize.width(); 248 249 } 249 250 250 int ScrollView::layoutHeight() const251 LayoutUnit ScrollView::layoutHeight() const 251 252 { 252 253 return m_fixedLayoutSize.isEmpty() || !m_useFixedLayout ? visibleHeight() : m_fixedLayoutSize.height(); 253 254 } 254 255 255 IntSize ScrollView::fixedLayoutSize() const256 LayoutSize ScrollView::fixedLayoutSize() const 256 257 { 257 258 return m_fixedLayoutSize; 258 259 } 259 260 260 void ScrollView::setFixedLayoutSize(const IntSize& newSize)261 void ScrollView::setFixedLayoutSize(const LayoutSize& newSize) 261 262 { 262 263 if (fixedLayoutSize() == newSize) … … 279 280 } 280 281 281 IntSize ScrollView::contentsSize() const282 LayoutSize ScrollView::contentsSize() const 282 283 { 283 284 return m_contentsSize; 284 285 } 285 286 286 void ScrollView::setContentsSize(const IntSize& newSize)287 void ScrollView::setContentsSize(const LayoutSize& newSize) 287 288 { 288 289 if (contentsSize() == newSize) … … 405 406 } 406 407 407 IntSize ScrollView::overhangAmount() const408 { 409 IntSize stretch;410 411 int physicalScrollY = scrollPosition().y() + scrollOrigin().y();408 LayoutSize ScrollView::overhangAmount() const 409 { 410 LayoutSize stretch; 411 412 LayoutUnit physicalScrollY = scrollPosition().y() + scrollOrigin().y(); 412 413 if (physicalScrollY < 0) 413 414 stretch.setHeight(physicalScrollY); … … 415 416 stretch.setHeight(physicalScrollY - (contentsHeight() - visibleHeight())); 416 417 417 int physicalScrollX = scrollPosition().x() + scrollOrigin().x();418 LayoutUnit physicalScrollX = scrollPosition().x() + scrollOrigin().x(); 418 419 if (physicalScrollX < 0) 419 420 stretch.setWidth(physicalScrollX); … … 448 449 } 449 450 450 IntRect oldScrollCornerRect = scrollCornerRect();451 LayoutRect oldScrollCornerRect = scrollCornerRect(); 451 452 452 453 bool hasHorizontalScrollbar = m_horizontalScrollbar; … … 472 473 bool sendContentResizedNotification = false; 473 474 474 IntSize docSize = contentsSize();475 IntSize frameSize = frameRect().size();475 LayoutSize docSize = contentsSize(); 476 LayoutSize frameSize = frameRect().size(); 476 477 477 478 if (hScroll == ScrollbarAuto) { … … 515 516 contentsResized(); 516 517 visibleContentsResized(); 517 IntSize newDocSize = contentsSize();518 LayoutSize newDocSize = contentsSize(); 518 519 if (newDocSize == docSize) { 519 520 // The layout with the new scroll state had no impact on … … 535 536 if (m_horizontalScrollbar) { 536 537 int clientWidth = visibleWidth(); 537 int pageStep = max(max<int>(clientWidth * Scrollbar::minFractionToStepWhenPaging(), clientWidth - Scrollbar::maxOverlapBetweenPages()), 1);538 IntRect oldRect(m_horizontalScrollbar->frameRect());539 IntRect hBarRect = IntRect(0,540 height() - m_horizontalScrollbar->height(),541 width() - (m_verticalScrollbar ? m_verticalScrollbar->width() : 0),542 m_horizontalScrollbar->height());538 LayoutUnit pageStep = max<LayoutUnit>(max<LayoutUnit>(clientWidth * Scrollbar::minFractionToStepWhenPaging(), clientWidth - Scrollbar::maxOverlapBetweenPages()), 1); 539 LayoutRect oldRect(m_horizontalScrollbar->frameRect()); 540 LayoutRect hBarRect = LayoutRect(0, 541 height() - m_horizontalScrollbar->height(), 542 width() - (m_verticalScrollbar ? m_verticalScrollbar->width() : 0), 543 m_horizontalScrollbar->height()); 543 544 m_horizontalScrollbar->setFrameRect(hBarRect); 544 545 if (!m_scrollbarsSuppressed && oldRect != m_horizontalScrollbar->frameRect()) … … 556 557 if (m_verticalScrollbar) { 557 558 int clientHeight = visibleHeight(); 558 int pageStep = max(max<int>(clientHeight * Scrollbar::minFractionToStepWhenPaging(), clientHeight - Scrollbar::maxOverlapBetweenPages()), 1);559 IntRect oldRect(m_verticalScrollbar->frameRect());560 IntRect vBarRect = IntRect(width() - m_verticalScrollbar->width(),561 562 563 559 LayoutUnit pageStep = max<LayoutUnit>(max<LayoutUnit>(clientHeight * Scrollbar::minFractionToStepWhenPaging(), clientHeight - Scrollbar::maxOverlapBetweenPages()), 1); 560 LayoutRect oldRect(m_verticalScrollbar->frameRect()); 561 LayoutRect vBarRect = LayoutRect(width() - m_verticalScrollbar->width(), 562 0, 563 m_verticalScrollbar->width(), 564 height() - (m_horizontalScrollbar ? m_horizontalScrollbar->height() : 0)); 564 565 m_verticalScrollbar->setFrameRect(vBarRect); 565 566 if (!m_scrollbarsSuppressed && oldRect != m_verticalScrollbar->frameRect()) … … 603 604 IntRect scrollViewRect = convertToContainingWindow(IntRect(0, 0, visibleWidth(), visibleHeight())); 604 605 if (hasOverlayScrollbars()) { 605 int verticalScrollbarWidth = (verticalScrollbar() && !hasLayerForVerticalScrollbar()) ? verticalScrollbar()->width() : 0;606 int horizontalScrollbarHeight = (horizontalScrollbar() && !hasLayerForHorizontalScrollbar()) ? horizontalScrollbar()->height() : 0;606 LayoutUnit verticalScrollbarWidth = (verticalScrollbar() && !hasLayerForVerticalScrollbar()) ? verticalScrollbar()->width() : 0; 607 LayoutUnit horizontalScrollbarHeight = (horizontalScrollbar() && !hasLayerForHorizontalScrollbar()) ? horizontalScrollbar()->height() : 0; 607 608 608 609 scrollViewRect.setWidth(scrollViewRect.width() - verticalScrollbarWidth); … … 630 631 // FIXME: the pan icon is broken when accelerated compositing is on, since it will draw under the compositing layers. 631 632 // https://bugs.webkit.org/show_bug.cgi?id=47837 632 int panIconDirtySquareSizeLength = 2 * (panIconSizeLength + max(abs(scrollDelta.width()), abs(scrollDelta.height()))); // We only want to repaint what's necessary633 IntPoint panIconDirtySquareLocation = IntPoint(m_panScrollIconPoint.x() - (panIconDirtySquareSizeLength / 2), m_panScrollIconPoint.y() - (panIconDirtySquareSizeLength / 2));634 IntRect panScrollIconDirtyRect = IntRect(panIconDirtySquareLocation , IntSize(panIconDirtySquareSizeLength, panIconDirtySquareSizeLength));633 LayoutUnit panIconDirtySquareSizeLength = 2 * (panIconSizeLength + max(abs(scrollDelta.width()), abs(scrollDelta.height()))); // We only want to repaint what's necessary 634 LayoutPoint panIconDirtySquareLocation = LayoutPoint(m_panScrollIconPoint.x() - (panIconDirtySquareSizeLength / 2), m_panScrollIconPoint.y() - (panIconDirtySquareSizeLength / 2)); 635 LayoutRect panScrollIconDirtyRect = LayoutRect(panIconDirtySquareLocation , LayoutSize(panIconDirtySquareSizeLength, panIconDirtySquareSizeLength)); 635 636 panScrollIconDirtyRect.intersect(clipRect); 636 637 hostWindow()->invalidateContentsAndWindow(panScrollIconDirtyRect, false /*immediate*/); … … 648 649 649 650 // Invalidate the overhang areas if they are visible. 650 IntRect horizontalOverhangRect;651 IntRect verticalOverhangRect;651 LayoutRect horizontalOverhangRect; 652 LayoutRect verticalOverhangRect; 652 653 calculateOverhangAreasForPainting(horizontalOverhangRect, verticalOverhangRect); 653 654 #if USE(ACCELERATED_COMPOSITING) && PLATFORM(CHROMIUM) && ENABLE(RUBBER_BANDING) … … 722 723 IntRect ScrollView::windowToContents(const IntRect& windowRect) const 723 724 { 724 IntRect viewRect = convertFromContainingWindow(windowRect);725 LayoutRect viewRect = convertFromContainingWindow(windowRect); 725 726 viewRect.move(scrollOffset()); 726 727 return viewRect; … … 743 744 } 744 745 745 IntPoint ScrollView::screenToContents(const IntPoint& point) const746 LayoutPoint ScrollView::screenToContents(const IntPoint& point) const 746 747 { 747 748 if (platformWidget()) 748 749 return platformScreenToContents(point); 749 750 if (!hostWindow()) 750 return IntPoint();751 return LayoutPoint(); 751 752 return windowToContents(hostWindow()->screenToWindow(point)); 752 753 } … … 812 813 return 0; 813 814 814 IntPoint viewPoint = convertFromContainingWindow(windowPoint);815 LayoutPoint viewPoint = convertFromContainingWindow(windowPoint); 815 816 if (m_horizontalScrollbar && m_horizontalScrollbar->frameRect().contains(viewPoint)) 816 817 return m_horizontalScrollbar.get(); … … 850 851 #endif 851 852 852 void ScrollView::setFrameRect(const IntRect& newRect)853 { 854 IntRect oldRect = frameRect();853 void ScrollView::setFrameRect(const LayoutRect& newRect) 854 { 855 LayoutRect oldRect = frameRect(); 855 856 856 857 if (newRect == oldRect) … … 883 884 return; 884 885 graphicsLayer->setDrawsContent(true); 885 IntRect scrollbarRect = scrollbar->frameRect();886 LayoutRect scrollbarRect = scrollbar->frameRect(); 886 887 graphicsLayer->setPosition(scrollbarRect.location()); 887 888 if (scrollbarRect.size() != graphicsLayer->size()) … … 890 891 } 891 892 892 static void positionScrollCornerLayer(GraphicsLayer* graphicsLayer, const IntRect& cornerRect)893 static void positionScrollCornerLayer(GraphicsLayer* graphicsLayer, const LayoutRect& cornerRect) 893 894 { 894 895 if (!graphicsLayer) … … 912 913 } 913 914 914 void ScrollView::repaintContentRectangle(const IntRect& rect, bool now)915 { 916 IntRect paintRect = rect;915 void ScrollView::repaintContentRectangle(const LayoutRect& rect, bool now) 916 { 917 LayoutRect paintRect = rect; 917 918 if (clipsRepaints() && !paintsEntireContents()) 918 919 paintRect.intersect(visibleContentRect()); … … 969 970 } 970 971 971 void ScrollView::paintScrollCorner(GraphicsContext* context, const IntRect& cornerRect)972 void ScrollView::paintScrollCorner(GraphicsContext* context, const LayoutRect& cornerRect) 972 973 { 973 974 ScrollbarTheme::theme()->paintScrollCorner(this, context, cornerRect); 974 975 } 975 976 976 void ScrollView::invalidateScrollCornerRect(const IntRect& rect)977 void ScrollView::invalidateScrollCornerRect(const LayoutRect& rect) 977 978 { 978 979 invalidateRect(rect); 979 980 } 980 981 981 void ScrollView::paintScrollbars(GraphicsContext* context, const IntRect& rect)982 void ScrollView::paintScrollbars(GraphicsContext* context, const LayoutRect& rect) 982 983 { 983 984 if (m_horizontalScrollbar … … 1007 1008 } 1008 1009 1009 void ScrollView::paint(GraphicsContext* context, const IntRect& rect)1010 void ScrollView::paint(GraphicsContext* context, const LayoutRect& rect) 1010 1011 { 1011 1012 if (platformWidget()) { … … 1022 1023 m_containsScrollableAreaWithOverlayScrollbars = false; 1023 1024 1024 IntRect clipRect = frameRect();1025 LayoutRect clipRect = frameRect(); 1025 1026 if (verticalScrollbar() && !verticalScrollbar()->isOverlayScrollbar()) 1026 1027 clipRect.setWidth(clipRect.width() - verticalScrollbar()->width()); … … 1028 1029 clipRect.setHeight(clipRect.height() - horizontalScrollbar()->height()); 1029 1030 1030 IntRect documentDirtyRect = rect;1031 LayoutRect documentDirtyRect = rect; 1031 1032 documentDirtyRect.intersect(clipRect); 1032 1033 … … 1057 1058 if (!m_scrollbarsSuppressed && (m_horizontalScrollbar || m_verticalScrollbar)) { 1058 1059 GraphicsContextStateSaver stateSaver(*context); 1059 IntRect scrollViewDirtyRect = rect;1060 LayoutRect scrollViewDirtyRect = rect; 1060 1061 scrollViewDirtyRect.intersect(frameRect()); 1061 1062 context->translate(x(), y()); … … 1070 1071 } 1071 1072 1072 void ScrollView::calculateOverhangAreasForPainting( IntRect& horizontalOverhangRect, IntRect& verticalOverhangRect)1073 { 1074 int verticalScrollbarWidth = (verticalScrollbar() && !verticalScrollbar()->isOverlayScrollbar())1073 void ScrollView::calculateOverhangAreasForPainting(LayoutRect& horizontalOverhangRect, LayoutRect& verticalOverhangRect) 1074 { 1075 LayoutUnit verticalScrollbarWidth = (verticalScrollbar() && !verticalScrollbar()->isOverlayScrollbar()) 1075 1076 ? verticalScrollbar()->width() : 0; 1076 int horizontalScrollbarHeight = (horizontalScrollbar() && !horizontalScrollbar()->isOverlayScrollbar())1077 LayoutUnit horizontalScrollbarHeight = (horizontalScrollbar() && !horizontalScrollbar()->isOverlayScrollbar()) 1077 1078 ? horizontalScrollbar()->height() : 0; 1078 1079 1079 int physicalScrollY = scrollPosition().y() + scrollOrigin().y();1080 LayoutUnit physicalScrollY = scrollPosition().y() + scrollOrigin().y(); 1080 1081 if (physicalScrollY < 0) { 1081 1082 horizontalOverhangRect = frameRect(); 1082 1083 horizontalOverhangRect.setHeight(-physicalScrollY); 1083 1084 } else if (contentsHeight() && physicalScrollY > contentsHeight() - visibleHeight()) { 1084 int height = physicalScrollY - (contentsHeight() - visibleHeight());1085 LayoutUnit height = physicalScrollY - (contentsHeight() - visibleHeight()); 1085 1086 horizontalOverhangRect = frameRect(); 1086 1087 horizontalOverhangRect.setY(frameRect().maxY() - height - horizontalScrollbarHeight); … … 1088 1089 } 1089 1090 1090 int physicalScrollX = scrollPosition().x() + scrollOrigin().x();1091 LayoutUnit physicalScrollX = scrollPosition().x() + scrollOrigin().x(); 1091 1092 if (physicalScrollX < 0) { 1092 1093 verticalOverhangRect.setWidth(-physicalScrollX); … … 1098 1099 verticalOverhangRect.setY(frameRect().y()); 1099 1100 } else if (contentsWidth() && physicalScrollX > contentsWidth() - visibleWidth()) { 1100 int width = physicalScrollX - (contentsWidth() - visibleWidth());1101 LayoutUnit width = physicalScrollX - (contentsWidth() - visibleWidth()); 1101 1102 verticalOverhangRect.setWidth(width); 1102 1103 verticalOverhangRect.setHeight(frameRect().height() - horizontalOverhangRect.height()); … … 1109 1110 } 1110 1111 1111 void ScrollView::paintOverhangAreas(GraphicsContext* context, const IntRect& horizontalOverhangRect, const IntRect& verticalOverhangRect, const IntRect& dirtyRect)1112 void ScrollView::paintOverhangAreas(GraphicsContext* context, const LayoutRect& horizontalOverhangRect, const LayoutRect& verticalOverhangRect, const LayoutRect& dirtyRect) 1112 1113 { 1113 1114 ScrollbarTheme::theme()->paintOverhangAreas(this, context, horizontalOverhangRect, verticalOverhangRect, dirtyRect); 1114 1115 } 1115 1116 1116 void ScrollView::calculateAndPaintOverhangAreas(GraphicsContext* context, const IntRect& dirtyRect)1117 { 1118 IntRect horizontalOverhangRect;1119 IntRect verticalOverhangRect;1117 void ScrollView::calculateAndPaintOverhangAreas(GraphicsContext* context, const LayoutRect& dirtyRect) 1118 { 1119 LayoutRect horizontalOverhangRect; 1120 LayoutRect verticalOverhangRect; 1120 1121 calculateOverhangAreasForPainting(horizontalOverhangRect, verticalOverhangRect); 1121 1122 … … 1129 1130 return false; 1130 1131 1131 IntPoint viewPoint = convertFromContainingWindow(windowPoint);1132 LayoutPoint viewPoint = convertFromContainingWindow(windowPoint); 1132 1133 1133 1134 if (m_horizontalScrollbar) { 1134 int horizontalScrollbarYMin = m_horizontalScrollbar->frameRect().y();1135 int horizontalScrollbarYMax = m_horizontalScrollbar->frameRect().y() + m_horizontalScrollbar->frameRect().height();1136 int horizontalScrollbarXMin = m_horizontalScrollbar->frameRect().x() + m_horizontalScrollbar->frameRect().width();1135 LayoutUnit horizontalScrollbarYMin = m_horizontalScrollbar->frameRect().y(); 1136 LayoutUnit horizontalScrollbarYMax = m_horizontalScrollbar->frameRect().y() + m_horizontalScrollbar->frameRect().height(); 1137 LayoutUnit horizontalScrollbarXMin = m_horizontalScrollbar->frameRect().x() + m_horizontalScrollbar->frameRect().width(); 1137 1138 1138 1139 return viewPoint.y() > horizontalScrollbarYMin && viewPoint.y() < horizontalScrollbarYMax && viewPoint.x() > horizontalScrollbarXMin; 1139 1140 } 1140 1141 1141 int verticalScrollbarXMin = m_verticalScrollbar->frameRect().x();1142 int verticalScrollbarXMax = m_verticalScrollbar->frameRect().x() + m_verticalScrollbar->frameRect().width();1143 int verticalScrollbarYMin = m_verticalScrollbar->frameRect().y() + m_verticalScrollbar->frameRect().height();1142 LayoutUnit verticalScrollbarXMin = m_verticalScrollbar->frameRect().x(); 1143 LayoutUnit verticalScrollbarXMax = m_verticalScrollbar->frameRect().x() + m_verticalScrollbar->frameRect().width(); 1144 LayoutUnit verticalScrollbarYMin = m_verticalScrollbar->frameRect().y() + m_verticalScrollbar->frameRect().height(); 1144 1145 1145 1146 return viewPoint.x() > verticalScrollbarXMin && viewPoint.x() < verticalScrollbarXMax && viewPoint.y() > verticalScrollbarYMin; … … 1152 1153 } 1153 1154 1154 IntRect ScrollView::convertFromScrollbarToContainingView(const Scrollbar* scrollbar, const IntRect& localRect) const1155 LayoutRect ScrollView::convertFromScrollbarToContainingView(const Scrollbar* scrollbar, const LayoutRect& localRect) const 1155 1156 { 1156 1157 // Scrollbars won't be transformed within us 1157 IntRect newRect = localRect;1158 LayoutRect newRect = localRect; 1158 1159 newRect.moveBy(scrollbar->location()); 1159 1160 return newRect; 1160 1161 } 1161 1162 1162 IntRect ScrollView::convertFromContainingViewToScrollbar(const Scrollbar* scrollbar, const IntRect& parentRect) const1163 { 1164 IntRect newRect = parentRect;1163 LayoutRect ScrollView::convertFromContainingViewToScrollbar(const Scrollbar* scrollbar, const LayoutRect& parentRect) const 1164 { 1165 LayoutRect newRect = parentRect; 1165 1166 // Scrollbars won't be transformed within us 1166 1167 newRect.moveBy(-scrollbar->location()); … … 1169 1170 1170 1171 // FIXME: test these on windows 1171 IntPoint ScrollView::convertFromScrollbarToContainingView(const Scrollbar* scrollbar, const IntPoint& localPoint) const1172 LayoutPoint ScrollView::convertFromScrollbarToContainingView(const Scrollbar* scrollbar, const LayoutPoint& localPoint) const 1172 1173 { 1173 1174 // Scrollbars won't be transformed within us 1174 IntPoint newPoint = localPoint;1175 LayoutPoint newPoint = localPoint; 1175 1176 newPoint.moveBy(scrollbar->location()); 1176 1177 return newPoint; 1177 1178 } 1178 1179 1179 IntPoint ScrollView::convertFromContainingViewToScrollbar(const Scrollbar* scrollbar, const IntPoint& parentPoint) const1180 { 1181 IntPoint newPoint = parentPoint;1180 LayoutPoint ScrollView::convertFromContainingViewToScrollbar(const Scrollbar* scrollbar, const LayoutPoint& parentPoint) const 1181 { 1182 LayoutPoint newPoint = parentPoint; 1182 1183 // Scrollbars won't be transformed within us 1183 1184 newPoint.moveBy(-scrollbar->location()); … … 1242 1243 1243 1244 1244 void ScrollView::addPanScrollIcon(const IntPoint& iconPosition)1245 void ScrollView::addPanScrollIcon(const LayoutPoint& iconPosition) 1245 1246 { 1246 1247 if (!hostWindow()) … … 1346 1347 } 1347 1348 1348 IntRect ScrollView::platformContentsToScreen(const IntRect& rect) const1349 IntRect ScrollView::platformContentsToScreen(const LayoutRect& rect) const 1349 1350 { 1350 1351 return rect; 1351 1352 } 1352 1353 1353 IntPoint ScrollView::platformScreenToContents(const IntPoint& point) const1354 LayoutPoint ScrollView::platformScreenToContents(const IntPoint& point) const 1354 1355 { 1355 1356 return point; … … 1365 1366 } 1366 1367 1367 void ScrollView::platformRepaintContentRectangle(const IntRect&, bool /*now*/)1368 void ScrollView::platformRepaintContentRectangle(const LayoutRect&, bool /*now*/) 1368 1369 { 1369 1370 }
Note: See TracChangeset
for help on using the changeset viewer.