- Revision
- 194477
- Author
- [email protected]
- Date
- 2015-12-31 19:17:31 -0800 (Thu, 31 Dec 2015)
Log Message
Rename documentScrollOffsetRelativeTo* functions
https://bugs.webkit.org/show_bug.cgi?id=152632
Reviewed by Zalan Bujtas.
ScrollView::documentScrollOffsetRelativeTo* functions return scroll positions,
not offsets, so rename them and fix their return types, and fix callers. Make
their code more similar.
Source/WebCore:
* platform/ScrollView.cpp:
(WebCore::ScrollView::documentScrollPositionRelativeToViewOrigin):
(WebCore::ScrollView::documentScrollPositionRelativeToScrollableAreaOrigin):
(WebCore::ScrollView::viewToContents):
(WebCore::ScrollView::contentsToView):
(WebCore::ScrollView::documentScrollOffsetRelativeToViewOrigin): Deleted.
(WebCore::ScrollView::documentScrollOffsetRelativeToScrollableAreaOrigin): Deleted.
* platform/ScrollView.h:
* rendering/RenderBoxModelObject.cpp:
(WebCore::RenderBoxModelObject::calculateBackgroundImageGeometry):
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::scrollRectToVisible):
Source/WebKit2:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::determinePrimarySnapshottedPlugIn):
(WebKit::WebPage::plugInIntersectsSearchRect):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (194476 => 194477)
--- trunk/Source/WebCore/ChangeLog 2016-01-01 03:16:11 UTC (rev 194476)
+++ trunk/Source/WebCore/ChangeLog 2016-01-01 03:17:31 UTC (rev 194477)
@@ -1,5 +1,29 @@
2015-12-31 Simon Fraser <[email protected]>
+ Rename documentScrollOffsetRelativeTo* functions
+ https://bugs.webkit.org/show_bug.cgi?id=152632
+
+ Reviewed by Zalan Bujtas.
+
+ ScrollView::documentScrollOffsetRelativeTo* functions return scroll positions,
+ not offsets, so rename them and fix their return types, and fix callers. Make
+ their code more similar.
+
+ * platform/ScrollView.cpp:
+ (WebCore::ScrollView::documentScrollPositionRelativeToViewOrigin):
+ (WebCore::ScrollView::documentScrollPositionRelativeToScrollableAreaOrigin):
+ (WebCore::ScrollView::viewToContents):
+ (WebCore::ScrollView::contentsToView):
+ (WebCore::ScrollView::documentScrollOffsetRelativeToViewOrigin): Deleted.
+ (WebCore::ScrollView::documentScrollOffsetRelativeToScrollableAreaOrigin): Deleted.
+ * platform/ScrollView.h:
+ * rendering/RenderBoxModelObject.cpp:
+ (WebCore::RenderBoxModelObject::calculateBackgroundImageGeometry):
+ * rendering/RenderLayer.cpp:
+ (WebCore::RenderLayer::scrollRectToVisible):
+
+2015-12-31 Simon Fraser <[email protected]>
+
[iOS WK2] Fix incorrect scrollPosition handling
https://bugs.webkit.org/show_bug.cgi?id=152630
Modified: trunk/Source/WebCore/platform/ScrollView.cpp (194476 => 194477)
--- trunk/Source/WebCore/platform/ScrollView.cpp 2016-01-01 03:16:11 UTC (rev 194476)
+++ trunk/Source/WebCore/platform/ScrollView.cpp 2016-01-01 03:17:31 UTC (rev 194477)
@@ -402,22 +402,16 @@
return scrollPoint.constrainedBetween(minimumScrollPosition(), maximumScrollPosition());
}
-IntSize ScrollView::documentScrollOffsetRelativeToViewOrigin() const
+ScrollPosition ScrollView::documentScrollPositionRelativeToViewOrigin() const
{
- return toIntSize(scrollPosition()) - IntSize(0, headerHeight() + topContentInset(TopContentInsetType::WebCoreOrPlatformContentInset));
+ return scrollPosition() - IntSize(0, headerHeight() + topContentInset(TopContentInsetType::WebCoreOrPlatformContentInset));
}
-IntPoint ScrollView::documentScrollPositionRelativeToViewOrigin() const
+ScrollPosition ScrollView::documentScrollPositionRelativeToScrollableAreaOrigin() const
{
- IntPoint scrollPosition = this->scrollPosition();
- return IntPoint(scrollPosition.x(), scrollPosition.y() - headerHeight() - topContentInset(TopContentInsetType::WebCoreOrPlatformContentInset));
+ return scrollPosition() - IntSize(0, headerHeight());
}
-IntSize ScrollView::documentScrollOffsetRelativeToScrollableAreaOrigin() const
-{
- return toIntSize(scrollPosition()) - IntSize(0, headerHeight());
-}
-
int ScrollView::scrollSize(ScrollbarOrientation orientation) const
{
// If no scrollbars are present, it does not indicate content is not be scrollable.
@@ -841,23 +835,23 @@
IntPoint ScrollView::viewToContents(const IntPoint& point) const
{
- return point + documentScrollOffsetRelativeToViewOrigin();
+ return point + toIntSize(documentScrollPositionRelativeToViewOrigin());
}
IntPoint ScrollView::contentsToView(const IntPoint& point) const
{
- return point - documentScrollOffsetRelativeToViewOrigin();
+ return point - toIntSize(documentScrollPositionRelativeToViewOrigin());
}
IntRect ScrollView::viewToContents(IntRect rect) const
{
- rect.move(documentScrollOffsetRelativeToViewOrigin());
+ rect.moveBy(documentScrollPositionRelativeToViewOrigin());
return rect;
}
IntRect ScrollView::contentsToView(IntRect rect) const
{
- rect.move(-documentScrollOffsetRelativeToViewOrigin());
+ rect.moveBy(-documentScrollPositionRelativeToViewOrigin());
return rect;
}
Modified: trunk/Source/WebCore/platform/ScrollView.h (194476 => 194477)
--- trunk/Source/WebCore/platform/ScrollView.h 2016-01-01 03:16:11 UTC (rev 194476)
+++ trunk/Source/WebCore/platform/ScrollView.h 2016-01-01 03:17:31 UTC (rev 194477)
@@ -248,18 +248,17 @@
// scrollOffset() anchors its (0,0) point at the ScrollableArea's origin. When the Page has a
// header, the header is positioned at (0,0), ABOVE the start of the Document. So when a page with
// a header is pinned to the top, the scrollOffset() is (0,0), but the Document is actually at
- // (0, -headerHeight()). documentScrollOffsetRelativeToScrollableAreaOrigin() will return this
+ // (0, -headerHeight()). documentScrollPositionRelativeToScrollableAreaOrigin() will return this
// version of the offset, which tracks the top of Document relative to where scrolling was achored.
- IntSize documentScrollOffsetRelativeToScrollableAreaOrigin() const;
+ ScrollPosition documentScrollPositionRelativeToScrollableAreaOrigin() const;
- // scrollOffset() anchors its (0,0) point at the ScrollableArea's origin. The top of the scrolling
+ // scrollPostion() anchors its (0,0) point at the ScrollableArea's origin. The top of the scrolling
// layer does not represent the top of the view when there is a topContentInset. Additionally, as
// detailed above, the origin of the scrolling layer also does not necessarily correspond with the
- // top of the document anyway, since there could also be header. documentScrollOffsetRelativeToViewOrigin()
+ // top of the document anyway, since there could also be header. documentScrollPositionRelativeToViewOrigin()
// will return a version of the current scroll offset which tracks the top of the Document
// relative to the very top of the view.
- WEBCORE_EXPORT IntSize documentScrollOffsetRelativeToViewOrigin() const;
- IntPoint documentScrollPositionRelativeToViewOrigin() const;
+ WEBCORE_EXPORT ScrollPosition documentScrollPositionRelativeToViewOrigin() const;
virtual IntSize overhangAmount() const override;
Modified: trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp (194476 => 194477)
--- trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp 2016-01-01 03:16:11 UTC (rev 194476)
+++ trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp 2016-01-01 03:17:31 UTC (rev 194477)
@@ -1115,10 +1115,10 @@
// topContentInset so do not add it to the calculation below.
viewportRect.setLocation(frameView.scrollPositionForFixedPosition());
} else {
- // documentScrollOffsetRelativeToViewOrigin() includes -topContentInset in its height
+ // documentScrollPositionRelativeToViewOrigin() includes -topContentInset in its height
// so we need to account for that in calculating the phase size
topContentInset = frameView.topContentInset(ScrollView::TopContentInsetType::WebCoreOrPlatformContentInset);
- viewportRect.setLocation(toLayoutPoint(frameView.documentScrollOffsetRelativeToViewOrigin()));
+ viewportRect.setLocation(frameView.documentScrollPositionRelativeToViewOrigin());
}
top += topContentInset;
Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (194476 => 194477)
--- trunk/Source/WebCore/rendering/RenderLayer.cpp 2016-01-01 03:16:11 UTC (rev 194476)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp 2016-01-01 03:17:31 UTC (rev 194477)
@@ -2524,8 +2524,7 @@
#if !PLATFORM(IOS)
LayoutRect viewRect = frameView.visibleContentRect();
LayoutRect visibleRectRelativeToDocument = viewRect;
- IntSize documentScrollOffsetRelativeToScrollableAreaOrigin = frameView.documentScrollOffsetRelativeToScrollableAreaOrigin();
- visibleRectRelativeToDocument.setLocation(IntPoint(documentScrollOffsetRelativeToScrollableAreaOrigin.width(), documentScrollOffsetRelativeToScrollableAreaOrigin.height()));
+ visibleRectRelativeToDocument.setLocation(frameView.documentScrollPositionRelativeToScrollableAreaOrigin());
#else
LayoutRect viewRect = frameView.unobscuredContentRect();
LayoutRect visibleRectRelativeToDocument = viewRect;
Modified: trunk/Source/WebKit2/ChangeLog (194476 => 194477)
--- trunk/Source/WebKit2/ChangeLog 2016-01-01 03:16:11 UTC (rev 194476)
+++ trunk/Source/WebKit2/ChangeLog 2016-01-01 03:17:31 UTC (rev 194477)
@@ -1,5 +1,20 @@
2015-12-31 Simon Fraser <[email protected]>
+ Rename documentScrollOffsetRelativeTo* functions
+ https://bugs.webkit.org/show_bug.cgi?id=152632
+
+ Reviewed by Zalan Bujtas.
+
+ ScrollView::documentScrollOffsetRelativeTo* functions return scroll positions,
+ not offsets, so rename them and fix their return types, and fix callers. Make
+ their code more similar.
+
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::WebPage::determinePrimarySnapshottedPlugIn):
+ (WebKit::WebPage::plugInIntersectsSearchRect):
+
+2015-12-31 Simon Fraser <[email protected]>
+
[iOS WK2] Fix incorrect scrollPosition handling
https://bugs.webkit.org/show_bug.cgi?id=152630
Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (194476 => 194477)
--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp 2016-01-01 03:16:11 UTC (rev 194476)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp 2016-01-01 03:17:31 UTC (rev 194477)
@@ -4799,8 +4799,8 @@
continue;
IntRect plugInRectRelativeToView = plugInImageElement.clientRect();
- IntSize scrollOffset = mainFrame.view()->documentScrollOffsetRelativeToViewOrigin();
- IntRect plugInRectRelativeToTopDocument(plugInRectRelativeToView.location() + scrollOffset, plugInRectRelativeToView.size());
+ ScrollPosition scrollPosition = mainFrame.view()->documentScrollPositionRelativeToViewOrigin();
+ IntRect plugInRectRelativeToTopDocument(plugInRectRelativeToView.location() + scrollPosition, plugInRectRelativeToView.size());
HitTestResult hitTestResult(plugInRectRelativeToTopDocument.center());
mainRenderView.hitTest(request, hitTestResult);
@@ -4809,7 +4809,7 @@
continue;
IntRect elementRectRelativeToView = element->clientRect();
- IntRect elementRectRelativeToTopDocument(elementRectRelativeToView.location() + scrollOffset, elementRectRelativeToView.size());
+ IntRect elementRectRelativeToTopDocument(elementRectRelativeToView.location() + scrollPosition, elementRectRelativeToView.size());
LayoutRect inflatedPluginRect = plugInRectRelativeToTopDocument;
LayoutUnit xOffset = (inflatedPluginRect.width() * overlappingImageBoundsScale - inflatedPluginRect.width()) / 2;
LayoutUnit yOffset = (inflatedPluginRect.height() * overlappingImageBoundsScale - inflatedPluginRect.height()) / 2;
@@ -4878,8 +4878,8 @@
IntRect plugInRectRelativeToView = plugInImageElement.clientRect();
if (plugInRectRelativeToView.isEmpty())
return false;
- IntSize scrollOffset = mainFrame.view()->documentScrollOffsetRelativeToViewOrigin();
- IntRect plugInRectRelativeToTopDocument(plugInRectRelativeToView.location() + scrollOffset, plugInRectRelativeToView.size());
+ ScrollPosition scrollPosition = mainFrame.view()->documentScrollPositionRelativeToViewOrigin();
+ IntRect plugInRectRelativeToTopDocument(plugInRectRelativeToView.location() + toIntSize(scrollPosition), plugInRectRelativeToView.size());
return plugInRectRelativeToTopDocument.intersects(searchRect);
}