Make visibleContentRect() return actualVisibleContentRect() on iOS most of the time
authorsimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 24 Jan 2014 00:39:46 +0000 (00:39 +0000)
committersimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 24 Jan 2014 00:39:46 +0000 (00:39 +0000)
commit5cae0ac5d5b08e0b0ade7a5a574bcc1cf4a2afdc
tree8b1d140930b3851f5ae1e75859481589ca10b165
parent71ad6cd112c84d1b4be765c12f10951de69ec36c
Make visibleContentRect() return actualVisibleContentRect() on iOS most of the time
https://bugs.webkit.org/show_bug.cgi?id=127456

Reviewed by Antti Koivisto.

On iOS, visibleContentRect() returns the entire document rect for historical
reasons, and actualVisibleContentRect() returns what visibleContentRect()
returns on other platforms.

In addition, actualVisibleContentRect() was returning an empty rect in WK2.

Reduce the confusion of #ifdefs by making visibleContentRect() behave like
actualVisibleContentRect() by default on iOS. Where it needs the old behavior,
an optional parameter, LegacyIOSDocumentVisibleRect, provides this.

Achieve this by having the virtual ScrollableArea::visibleContentRectInternal(),
which is called by non-virtual visibleContentRect() and visibleContentRectIncludingScrollbars().

Similarly clean up visibleHeight/visibleWidth functions by having visibleSize() be virtual,
with non-virtual visibleHeight() and visibleWidth().

ScrollableArea subclasses override visibleContentRectInternal() and visibleSize() where necessary.

Mechanically change all the call sites of actualVisibleContentRect() to
use visibleContentRect(), and the call sites of visibleContentRect()
to visibleContentRect(..., LegacyIOSDocumentVisibleRect), adding comments
where this may not be appropriate.

Change callers of visibleContentRect(IncludeScrollbars...) to visibleContentRectIncludingScrollbars().

Also add actualScrollPosition(), and clean up some actualScroll* call sites.

No behavior change.

Source/WebCore:

* WebCore.exp.in:
* accessibility/AccessibilityObject.cpp:
(WebCore::AccessibilityObject::isOnscreen):
(WebCore::AccessibilityObject::scrollToMakeVisibleWithSubFocus):
* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::isOffScreen):
* dom/Document.cpp:
(WebCore::Document::adjustFloatQuadsForScrollAndAbsoluteZoomAndFrameScale):
(WebCore::Document::adjustFloatRectForScrollAndAbsoluteZoomAndFrameScale):
* dom/MouseRelatedEvent.cpp:
(WebCore::MouseRelatedEvent::MouseRelatedEvent):
* editing/Editor.cpp:
(WebCore::Editor::countMatchesForText):
* editing/FrameSelection.cpp:
(WebCore::FrameSelection::bounds):
(WebCore::FrameSelection::getClippedVisibleTextRectangles):
* html/HTMLBodyElement.cpp:
(WebCore::HTMLBodyElement::scrollLeft):
(WebCore::HTMLBodyElement::scrollTop):
* html/ImageDocument.cpp:
(WebCore::ImageDocument::imageFitsInWindow):
(WebCore::ImageDocument::windowSizeChanged):
* inspector/InspectorOverlay.cpp:
(WebCore::InspectorOverlay::update):
* page/DOMWindow.cpp:
(WebCore::DOMWindow::innerHeight):
(WebCore::DOMWindow::innerWidth):
(WebCore::DOMWindow::scrollX):
(WebCore::DOMWindow::scrollY):
(WebCore::DOMWindow::scrollBy):
* page/FrameView.cpp:
(WebCore::FrameView::calculateScrollbarModesForLayout):
(WebCore::FrameView::layout):
(WebCore::FrameView::scrollContentsSlowPath):
(WebCore::FrameView::repaintContentRectangle):
(WebCore::FrameView::sendResizeEventIfNeeded):
(WebCore::FrameView::windowClipRect):
(WebCore::FrameView::isScrollable):
(WebCore::FrameView::paintControlTints):
* page/SpatialNavigation.cpp:
(WebCore::canScrollInDirection):
* platform/ScrollView.cpp:
(WebCore::ScrollView::unscaledVisibleContentSize):
(WebCore::ScrollView::visibleContentRectInternal):
(WebCore::ScrollView::updateScrollbars):
(WebCore::ScrollView::paint):
* platform/ScrollView.h:
(WebCore::ScrollView::scrollOffset):
(WebCore::ScrollView::actualScrollX):
(WebCore::ScrollView::actualScrollY):
(WebCore::ScrollView::actualScrollPosition):
* platform/ScrollableArea.cpp:
(WebCore::ScrollableArea::visibleContentRect):
(WebCore::ScrollableArea::visibleContentRectIncludingScrollbars):
(WebCore::ScrollableArea::visibleContentRectInternal):
* platform/ScrollableArea.h:
(WebCore::ScrollableArea::visibleWidth):
(WebCore::ScrollableArea::visibleHeight):
* platform/graphics/IntSize.h:
(WebCore::IntSize::expandedTo): Drive-by cleanup.
(WebCore::IntSize::shrunkTo):
* platform/gtk/ScrollViewGtk.cpp:
(WebCore::ScrollView::visibleContentRect):
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::scrollRectToVisible):
(WebCore::RenderLayer::maximumScrollPosition):
(WebCore::RenderLayer::visibleContentRectInternal):
(WebCore::RenderLayer::hitTest):
* rendering/RenderLayer.h:
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::updateCompositedBounds):
* rendering/RenderListBox.cpp:
* rendering/RenderListBox.h:
* rendering/RenderView.cpp:
(WebCore::RenderView::viewRect):
(WebCore::RenderView::viewportSize):

Source/WebKit:

* WebKit.vcxproj/WebKitExportGenerator/WebKitExports.def.in:

Source/WebKit2:

* WebProcess/Plugins/PDF/PDFPlugin.h:
* WebProcess/WebPage/ViewGestureGeometryCollector.cpp:
(WebKit::ViewGestureGeometryCollector::collectGeometryForMagnificationGesture):
(WebKit::ViewGestureGeometryCollector::collectGeometryForSmartMagnificationGesture):
* WebProcess/WebPage/WebFrame.cpp:
(WebKit::WebFrame::visibleContentBounds):
* WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
(WebKit::TiledCoreAnimationDrawingArea::commitTransientZoom):
(WebKit::TiledCoreAnimationDrawingArea::applyTransientZoomToPage):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@162663 268f45cc-cd09-0410-ab3c-d52691b4dbfc
33 files changed:
Source/WebCore/ChangeLog
Source/WebCore/WebCore.exp.in
Source/WebCore/accessibility/AccessibilityObject.cpp
Source/WebCore/accessibility/AccessibilityRenderObject.cpp
Source/WebCore/dom/Document.cpp
Source/WebCore/dom/MouseRelatedEvent.cpp
Source/WebCore/editing/Editor.cpp
Source/WebCore/editing/FrameSelection.cpp
Source/WebCore/html/HTMLBodyElement.cpp
Source/WebCore/html/ImageDocument.cpp
Source/WebCore/inspector/InspectorOverlay.cpp
Source/WebCore/page/DOMWindow.cpp
Source/WebCore/page/FrameView.cpp
Source/WebCore/page/SpatialNavigation.cpp
Source/WebCore/platform/ScrollView.cpp
Source/WebCore/platform/ScrollView.h
Source/WebCore/platform/ScrollableArea.cpp
Source/WebCore/platform/ScrollableArea.h
Source/WebCore/platform/graphics/IntSize.h
Source/WebCore/platform/gtk/ScrollViewGtk.cpp
Source/WebCore/rendering/RenderLayer.cpp
Source/WebCore/rendering/RenderLayer.h
Source/WebCore/rendering/RenderLayerBacking.cpp
Source/WebCore/rendering/RenderListBox.cpp
Source/WebCore/rendering/RenderListBox.h
Source/WebCore/rendering/RenderView.cpp
Source/WebKit/ChangeLog
Source/WebKit/WebKit.vcxproj/WebKitExportGenerator/WebKitExports.def.in
Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/Plugins/PDF/PDFPlugin.h
Source/WebKit2/WebProcess/WebPage/ViewGestureGeometryCollector.cpp
Source/WebKit2/WebProcess/WebPage/WebFrame.cpp
Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm