Changeset 165484 in webkit
- Timestamp:
- Mar 12, 2014, 11:15:06 AM (11 years ago)
- Location:
- trunk
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r165482 r165484 1 2014-03-12 Simon Fraser <simon.fraser@apple.com> 2 3 Change scrollOffsetForFixedPosition() to do LayoutUnit math 4 https://bugs.webkit.org/show_bug.cgi?id=129981 5 6 Reviewed by Beth Dakin. 7 8 FrameView::scrollOffsetForFixedPosition() returned an IntSize, 9 but to allow subpixel scroll offsets, we need it to return a LayoutSize. 10 11 Update test results for the progression. 12 13 * platform/mac-wk2/tiled-drawing/fixed-background/fixed-body-background-zoomed-expected.png: 14 * platform/mac-wk2/tiled-drawing/fixed-background/fixed-body-background-zoomed-expected.txt: 15 1 16 2014-03-12 Gavin Barraclough <barraclough@apple.com> 2 17 -
trunk/LayoutTests/platform/mac-wk2/tiled-drawing/fixed-background/fixed-body-background-zoomed-expected.txt
r156749 r165484 8 8 (children 2 9 9 (GraphicsLayer 10 (position 0.00 154. 00)10 (position 0.00 154.25) 11 11 (anchor 0.00 0.00) 12 12 (bounds 785.00 585.00) -
trunk/Source/WebCore/ChangeLog
r165482 r165484 1 2014-03-12 Simon Fraser <simon.fraser@apple.com> 2 3 Change scrollOffsetForFixedPosition() to do LayoutUnit math 4 https://bugs.webkit.org/show_bug.cgi?id=129981 5 6 Reviewed by Beth Dakin. 7 8 FrameView::scrollOffsetForFixedPosition() returned an IntSize, 9 but to allow subpixel scroll offsets, we need it to return a LayoutSize. 10 11 Fix code that calls this to use more LayoutUnit math. 12 13 This progresses fixed background images on zoom, which cam now be subpixel 14 positioned. 15 16 * WebCore.exp.in: 17 * page/FrameView.cpp: 18 (WebCore::FrameView::viewportConstrainedVisibleContentRect): 19 (WebCore::FrameView::scrollOffsetForFixedPosition): 20 * page/FrameView.h: 21 * page/scrolling/AsyncScrollingCoordinator.cpp: 22 (WebCore::AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScroll): 23 * platform/ScrollableArea.cpp: 24 (WebCore::ScrollableArea::constrainScrollPositionForOverhang): 25 * platform/ScrollableArea.h: 26 * rendering/RenderBoxModelObject.cpp: 27 (WebCore::RenderBoxModelObject::calculateBackgroundImageGeometry): 28 * rendering/RenderLayer.cpp: 29 (WebCore::RenderLayer::calculateClipRects): 30 * rendering/RenderLayerBacking.cpp: 31 (WebCore::RenderLayerBacking::updateGraphicsLayerGeometry): 32 * rendering/RenderLayerCompositor.cpp: 33 (WebCore::RenderLayerCompositor::updateScrollLayerPosition): 34 1 35 2014-03-12 Gavin Barraclough <barraclough@apple.com> 2 36 -
trunk/Source/WebCore/WebCore.exp.in
r165479 r165484 406 406 __ZN7WebCore14ScrollableArea28setScrollOffsetFromInternalsERKNS_8IntPointE 407 407 __ZN7WebCore14ScrollableArea30scrollToOffsetWithoutAnimationERKNS_10FloatPointE 408 __ZN7WebCore14ScrollableArea34constrainScrollPositionForOverhangERKNS_ 7IntRectERKNS_7IntSizeERKNS_8IntPointES9_ii408 __ZN7WebCore14ScrollableArea34constrainScrollPositionForOverhangERKNS_10LayoutRectERKNS_10LayoutSizeERKNS_11LayoutPointES9_ii 409 409 __ZN7WebCore14ScrollableArea6scrollENS_15ScrollDirectionENS_17ScrollGranularityEf 410 410 __ZN7WebCore14ScrollableAreaC2Ev -
trunk/Source/WebCore/page/FrameView.cpp
r165396 r165484 1539 1539 #endif 1540 1540 LayoutRect viewportRect = visibleContentRect(); 1541 1541 1542 viewportRect.setLocation(toLayoutPoint(scrollOffsetForFixedPosition())); 1542 1543 return viewportRect; … … 1555 1556 } 1556 1557 1557 IntSize FrameView::scrollOffsetForFixedPosition(const IntRect& visibleContentRect, const IntSize& totalContentsSize, const IntPoint& scrollPosition, const IntPoint& scrollOrigin, float frameScaleFactor, bool fixedElementsLayoutRelativeToFrame, ScrollBehaviorForFixedElements behaviorForFixed, int headerHeight, int footerHeight)1558 { 1559 IntPoint position;1558 LayoutSize FrameView::scrollOffsetForFixedPosition(const LayoutRect& visibleContentRect, const LayoutSize& totalContentsSize, const LayoutPoint& scrollPosition, const LayoutPoint& scrollOrigin, float frameScaleFactor, bool fixedElementsLayoutRelativeToFrame, ScrollBehaviorForFixedElements behaviorForFixed, int headerHeight, int footerHeight) 1559 { 1560 LayoutPoint position; 1560 1561 if (behaviorForFixed == StickToDocumentBounds) 1561 1562 position = ScrollableArea::constrainScrollPositionForOverhang(visibleContentRect, totalContentsSize, scrollPosition, scrollOrigin, headerHeight, footerHeight); … … 1565 1566 } 1566 1567 1567 IntSize maxSize = totalContentsSize - visibleContentRect.size();1568 LayoutSize maxSize = totalContentsSize - visibleContentRect.size(); 1568 1569 1569 1570 float dragFactorX = (fixedElementsLayoutRelativeToFrame || !maxSize.width()) ? 1 : (totalContentsSize.width() - visibleContentRect.width() * frameScaleFactor) / maxSize.width(); 1570 1571 float dragFactorY = (fixedElementsLayoutRelativeToFrame || !maxSize.height()) ? 1 : (totalContentsSize.height() - visibleContentRect.height() * frameScaleFactor) / maxSize.height(); 1571 1572 1572 return IntSize(position.x() * dragFactorX / frameScaleFactor, position.y() * dragFactorY / frameScaleFactor);1573 } 1574 1575 IntSize FrameView::scrollOffsetForFixedPosition() const1573 return LayoutSize(position.x() * dragFactorX / frameScaleFactor, position.y() * dragFactorY / frameScaleFactor); 1574 } 1575 1576 LayoutSize FrameView::scrollOffsetForFixedPosition() const 1576 1577 { 1577 1578 IntRect visibleContentRect = this->visibleContentRect(); -
trunk/Source/WebCore/page/FrameView.h
r165094 r165484 263 263 // Functions for querying the current scrolled position, negating the effects of overhang 264 264 // and adjusting for page scale. 265 IntSize scrollOffsetForFixedPosition() const;265 LayoutSize scrollOffsetForFixedPosition() const; 266 266 // Static function can be called from another thread. 267 static IntSize scrollOffsetForFixedPosition(const IntRect& visibleContentRect, const IntSize& totalContentsSize, const IntPoint& scrollPosition, const IntPoint& scrollOrigin, float frameScaleFactor, bool fixedElementsLayoutRelativeToFrame, ScrollBehaviorForFixedElements, int headerHeight, int footerHeight);267 static LayoutSize scrollOffsetForFixedPosition(const LayoutRect& visibleContentRect, const LayoutSize& totalContentsSize, const LayoutPoint& scrollPosition, const LayoutPoint& scrollOrigin, float frameScaleFactor, bool fixedElementsLayoutRelativeToFrame, ScrollBehaviorForFixedElements, int headerHeight, int footerHeight); 268 268 269 269 bool fixedElementsLayoutRelativeToFrame() const; -
trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp
r165349 r165484 213 213 GraphicsLayer* headerLayer = headerLayerForFrameView(frameView); 214 214 GraphicsLayer* footerLayer = footerLayerForFrameView(frameView); 215 IntSize scrollOffsetForFixed = frameView->scrollOffsetForFixedPosition();215 LayoutSize scrollOffsetForFixed = frameView->scrollOffsetForFixedPosition(); 216 216 217 217 if (programmaticScroll || scrollingLayerPositionAction == SetScrollingLayerPosition) { 218 218 scrollLayer->setPosition(-frameView->scrollPosition()); 219 219 if (counterScrollingLayer) 220 counterScrollingLayer->setPosition( IntPoint(scrollOffsetForFixed));220 counterScrollingLayer->setPosition(toLayoutPoint(scrollOffsetForFixed)); 221 221 if (headerLayer) 222 222 headerLayer->setPosition(FloatPoint(scrollOffsetForFixed.width(), 0)); … … 226 226 scrollLayer->syncPosition(-frameView->scrollPosition()); 227 227 if (counterScrollingLayer) 228 counterScrollingLayer->syncPosition( IntPoint(scrollOffsetForFixed));228 counterScrollingLayer->syncPosition(toLayoutPoint(scrollOffsetForFixed)); 229 229 if (headerLayer) 230 230 headerLayer->syncPosition(FloatPoint(scrollOffsetForFixed.width(), 0)); -
trunk/Source/WebCore/page/scrolling/ios/ScrollingTreeScrollingNodeIOS.mm
r165348 r165484 137 137 ScrollBehaviorForFixedElements behaviorForFixed = scrollBehaviorForFixedElements(); 138 138 FloatPoint scrollOffset = position - toIntSize(scrollOrigin()); 139 // FIXME: scrollOffsetForFixedPosition() needs to do float math. 139 140 140 FloatSize scrollOffsetForFixedChildren = FrameView::scrollOffsetForFixedPosition(enclosingIntRect(viewportConstrainedObjectRect()), totalContentsSize(), flooredIntPoint(scrollOffset), scrollOrigin(), frameScaleFactor(), false, behaviorForFixed, headerHeight(), footerHeight()); 141 141 if (m_counterScrollingLayer) -
trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeMac.mm
r165233 r165484 344 344 ScrollBehaviorForFixedElements behaviorForFixed = scrollBehaviorForFixedElements(); 345 345 FloatPoint scrollOffset = position - toFloatSize(scrollOrigin()); 346 // FIXME: scrollOffsetForFixedPosition() needs to do float math. 346 347 347 FloatSize scrollOffsetForFixedChildren = FrameView::scrollOffsetForFixedPosition(enclosingIntRect(viewportConstrainedObjectRect()), totalContentsSize(), flooredIntPoint(scrollOffset), scrollOrigin(), frameScaleFactor(), false, behaviorForFixed, headerHeight(), footerHeight()); 348 348 if (m_counterScrollingLayer) -
trunk/Source/WebCore/platform/ScrollableArea.cpp
r163975 r165484 36 36 #include "GraphicsLayer.h" 37 37 #include "FloatPoint.h" 38 #include "LayoutRect.h" 38 39 #include "PlatformWheelEvent.h" 39 40 #include "ScrollAnimator.h" … … 478 479 } 479 480 480 IntPoint ScrollableArea::constrainScrollPositionForOverhang(const IntRect& visibleContentRect, const IntSize& totalContentsSize, const IntPoint& scrollPosition, const IntPoint& scrollOrigin, int headerHeight, int footerHeight)481 LayoutPoint ScrollableArea::constrainScrollPositionForOverhang(const LayoutRect& visibleContentRect, const LayoutSize& totalContentsSize, const LayoutPoint& scrollPosition, const LayoutPoint& scrollOrigin, int headerHeight, int footerHeight) 481 482 { 482 483 // The viewport rect that we're scrolling shouldn't be larger than our document. 483 IntSize idealScrollRectSize(std::min(visibleContentRect.width(), totalContentsSize.width()), std::min(visibleContentRect.height(), totalContentsSize.height()));484 LayoutSize idealScrollRectSize(std::min(visibleContentRect.width(), totalContentsSize.width()), std::min(visibleContentRect.height(), totalContentsSize.height())); 484 485 485 IntRect scrollRect(scrollPosition + scrollOrigin - IntSize(0, headerHeight), idealScrollRectSize);486 IntRect documentRect(IntPoint(), IntSize(totalContentsSize.width(), totalContentsSize.height() - headerHeight - footerHeight));486 LayoutRect scrollRect(scrollPosition + scrollOrigin - LayoutSize(0, headerHeight), idealScrollRectSize); 487 LayoutRect documentRect(LayoutPoint(), LayoutSize(totalContentsSize.width(), totalContentsSize.height() - headerHeight - footerHeight)); 487 488 488 489 // Use intersection to constrain our ideal scroll rect by the document rect. … … 501 502 } 502 503 503 return scrollRect.location() - to IntSize(scrollOrigin);504 } 505 506 IntPoint ScrollableArea::constrainScrollPositionForOverhang(const IntPoint& scrollPosition)504 return scrollRect.location() - toLayoutSize(scrollOrigin); 505 } 506 507 LayoutPoint ScrollableArea::constrainScrollPositionForOverhang(const LayoutPoint& scrollPosition) 507 508 { 508 509 return constrainScrollPositionForOverhang(visibleContentRect(), totalContentsSize(), scrollPosition, scrollOrigin(), headerHeight(), footerHeight()); -
trunk/Source/WebCore/platform/ScrollableArea.h
r163975 r165484 34 34 class FloatPoint; 35 35 class GraphicsContext; 36 class LayoutPoint; 37 class LayoutSize; 36 38 class PlatformTouchEvent; 37 39 class PlatformWheelEvent; … … 201 203 void setScrollOffsetFromInternals(const IntPoint&); 202 204 203 static IntPoint constrainScrollPositionForOverhang(const IntRect& visibleContentRect, const IntSize& totalContentsSize, const IntPoint& scrollPosition, const IntPoint& scrollOrigin, int headerHeight, int footetHeight);204 IntPoint constrainScrollPositionForOverhang(const IntPoint& scrollPosition);205 static LayoutPoint constrainScrollPositionForOverhang(const LayoutRect& visibleContentRect, const LayoutSize& totalContentsSize, const LayoutPoint& scrollPosition, const LayoutPoint& scrollOrigin, int headerHeight, int footetHeight); 206 LayoutPoint constrainScrollPositionForOverhang(const LayoutPoint& scrollPosition); 205 207 206 208 // Computes the double value for the scrollbar's current position and the current overhang amount. -
trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp
r165065 r165484 1112 1112 geometry.setHasNonLocalGeometry(); 1113 1113 1114 IntRect viewportRect = pixelSnappedIntRect(view().viewRect());1114 LayoutRect viewportRect = view().viewRect(); 1115 1115 if (fixedBackgroundPaintsInLocalCoordinates()) 1116 viewportRect.setLocation( IntPoint());1116 viewportRect.setLocation(LayoutPoint()); 1117 1117 else 1118 viewportRect.setLocation( IntPoint(view().frameView().scrollOffsetForFixedPosition()));1118 viewportRect.setLocation(toLayoutPoint(view().frameView().scrollOffsetForFixedPosition())); 1119 1119 1120 1120 if (paintContainer) { 1121 IntPoint absoluteContainerOffset = roundedIntPoint(paintContainer->localToAbsolute(FloatPoint()));1121 LayoutPoint absoluteContainerOffset = roundedLayoutPoint(paintContainer->localToAbsolute(FloatPoint())); 1122 1122 viewportRect.moveBy(-absoluteContainerOffset); 1123 1123 } -
trunk/Source/WebCore/rendering/RenderLayerBacking.cpp
r165354 r165484 900 900 if (backgroundLayerPaintsFixedRootBackground()) { 901 901 const FrameView& frameView = renderer().view().frameView(); 902 backgroundPosition = IntPoint(frameView.scrollOffsetForFixedPosition());902 backgroundPosition = toLayoutPoint(frameView.scrollOffsetForFixedPosition()); 903 903 backgroundSize = frameView.visibleContentRect().size(); 904 904 } -
trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp
r165124 r165484 1511 1511 1512 1512 if (GraphicsLayer* fixedBackgroundLayer = fixedRootBackgroundLayer()) 1513 fixedBackgroundLayer->setPosition( IntPoint(frameView.scrollOffsetForFixedPosition()));1513 fixedBackgroundLayer->setPosition(toLayoutPoint(frameView.scrollOffsetForFixedPosition())); 1514 1514 } 1515 1515
Note:
See TracChangeset
for help on using the changeset viewer.