Changeset 137368 in webkit
- Timestamp:
- Dec 11, 2012 3:22:05 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r137366 r137368 1 2012-12-11 Xianzhu Wang <wangxianzhu@chromium.org> 2 3 Incorrect position of layers for fixed position elements when page is scaled smaller than viewport 4 https://bugs.webkit.org/show_bug.cgi?id=104294 5 6 Reviewed by James Robinson. 7 8 Test the case that a page containing a composited fixed position element originally bigger than the viewport 9 is scaled down to be smaller than the viewport. 10 11 * compositing/geometry/fixed-position-composited-page-scale-smaller-than-viewport.html: Added. 12 * compositing/geometry/fixed-position-composited-page-scale-smaller-than-viewport-expected.html: Added. 13 1 14 2012-12-11 Adam Klein <adamk@chromium.org> 2 15 -
trunk/Source/WebCore/ChangeLog
r137367 r137368 1 2012-12-11 Xianzhu Wang <wangxianzhu@chromium.org> 2 3 Incorrect position of layers for fixed position elements when page is scaled smaller than viewport 4 https://bugs.webkit.org/show_bug.cgi?id=104294 5 6 Reviewed by James Robinson. 7 8 Fixed issue in scrollOffsetForFixedPosition when contentRect is smaller than visibleContentRect. 9 This happens when a page originally bigger than viewport is scaled down to smaller than the viewport. 10 11 Test: compositing/geometry/fixed-position-composited-page-scale-smaller-than-viewport.html 12 13 * page/scrolling/ScrollingCoordinator.cpp: 14 (WebCore::fixedPositionScrollOffset): Moved common code in scrollOffsetForFixedPosition here. Fixed issue when contentsSize < visibleContentSize. 15 (WebCore::scrollOffsetForFixedPosition): 16 1 17 2012-12-11 Beth Dakin <bdakin@apple.com> 2 18 -
trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp
r135360 r137368 66 66 } 67 67 68 static int fixedPositionScrollOffset(int scrollPosition, int maxValue, int scrollOrigin, float dragFactor) 69 { 70 if (!maxValue) 68 static int fixedPositionScrollOffset(int visibleContentSize, int contentsSize, int scrollPosition, int scrollOrigin, float frameScaleFactor, bool fixedElementsLayoutRelativeToFrame) 69 { 70 int maxValue = contentsSize - visibleContentSize; 71 if (maxValue <= 0) 71 72 return 0; 72 73 73 74 if (!scrollOrigin) { 74 if (scrollPosition < 0)75 scrollPosition =0;76 elseif (scrollPosition > maxValue)75 if (scrollPosition <= 0) 76 return 0; 77 if (scrollPosition > maxValue) 77 78 scrollPosition = maxValue; 78 79 } else { 79 if (scrollPosition > 0)80 scrollPosition =0;81 elseif (scrollPosition < -maxValue)80 if (scrollPosition >= 0) 81 return 0; 82 if (scrollPosition < -maxValue) 82 83 scrollPosition = -maxValue; 83 84 } 84 85 return scrollPosition * dragFactor; 85 86 float dragFactor = fixedElementsLayoutRelativeToFrame ? 1 : (contentsSize - visibleContentSize * frameScaleFactor) / maxValue; 87 return scrollPosition * dragFactor / frameScaleFactor; 86 88 } 87 89 88 90 IntSize scrollOffsetForFixedPosition(const IntRect& visibleContentRect, const IntSize& contentsSize, const IntPoint& scrollPosition, const IntPoint& scrollOrigin, float frameScaleFactor, bool fixedElementsLayoutRelativeToFrame) 89 91 { 90 IntSize maxOffset(contentsSize.width() - visibleContentRect.width(), contentsSize.height() - visibleContentRect.height()); 91 92 FloatSize dragFactor = fixedElementsLayoutRelativeToFrame ? FloatSize(1, 1) : FloatSize( 93 (contentsSize.width() - visibleContentRect.width() * frameScaleFactor) / maxOffset.width(), 94 (contentsSize.height() - visibleContentRect.height() * frameScaleFactor) / maxOffset.height()); 95 96 int x = fixedPositionScrollOffset(scrollPosition.x(), maxOffset.width(), scrollOrigin.x(), dragFactor.width() / frameScaleFactor); 97 int y = fixedPositionScrollOffset(scrollPosition.y(), maxOffset.height(), scrollOrigin.y(), dragFactor.height() / frameScaleFactor); 98 92 int x = fixedPositionScrollOffset(visibleContentRect.width(), contentsSize.width(), scrollPosition.x(), scrollOrigin.x(), frameScaleFactor, fixedElementsLayoutRelativeToFrame); 93 int y = fixedPositionScrollOffset(visibleContentRect.height(), contentsSize.height(), scrollPosition.y(), scrollOrigin.y(), frameScaleFactor, fixedElementsLayoutRelativeToFrame); 99 94 return IntSize(x, y); 100 95 }
Note: See TracChangeset
for help on using the changeset viewer.