Group options of scrollRectToVisible into a struct
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 6 Sep 2018 19:48:08 +0000 (19:48 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 6 Sep 2018 19:48:08 +0000 (19:48 +0000)
commit21c04125f19e1fd28f81d4ae27d5c1a335164ab1
treeec447a4e43fd02aa15b6acfd3e6074eb41ad7d2f
parent1a6425c8ae135517968ee3989a23f2e1551b112d
Group options of scrollRectToVisible into a struct
https://bugs.webkit.org/show_bug.cgi?id=189352

Patch by Frederic Wang <fwang@igalia.com> on 2018-09-06
Reviewed by Simon Fraser.

Source/WebCore:

RenderLayer::scrollRectToVisible and RenderObject::scrollRectToVisible have several
parameters to configure the type of scrolling. This patch groups the const options into a
single struct to make easier to handle them in the future. For example, an #ifdefed scroll
behavior option will be added in bug 188043. This refactoring can maybe help too for other
scroll extensions (e.g. bug 176454 and bug 161611).

No new tests, behavior unchanged.

* accessibility/AccessibilityObject.cpp:
(WebCore::AccessibilityObject::scrollToMakeVisible const): Pass options via a struct.
* dom/Element.cpp:
(WebCore::Element::scrollIntoView): Ditto.
(WebCore::Element::scrollIntoViewIfNeeded): Ditto.
(WebCore::Element::scrollIntoViewIfNotVisible): Ditto.
* editing/FrameSelection.cpp: Include RenderLayer.h in all WebKit ports in order to define
ScrollRectToVisibleOptions.
(WebCore::FrameSelection::revealSelection): Pass options via a struct.
* page/FrameView.cpp:
(WebCore::FrameView::scrollToFocusedElementInternal): Ditto.
(WebCore::FrameView::scrollToAnchor): Ditto.
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::scrollRectToVisible): Pass options via a struct. Note that
absoluteRect and insideFixed are modified in this function.
(WebCore::RenderLayer::autoscroll): Pass options via a struct.
* rendering/RenderLayer.h: Add ScrollRectToVisibleOptions and use it in order to pass
scrollRectToVisible options.
* rendering/RenderObject.cpp:
(WebCore::RenderObject::scrollRectToVisible): Pass options via a struct
* rendering/RenderObject.h: Forward-declare ScrollRectToVisibleOptions and use in order to
pass scrollRectToVisible options.

Source/WebKitLegacy/mac:

* WebView/WebFrame.mm: Add header to use ScrollRectToVisibleOptions.
(-[WebFrame _scrollDOMRangeToVisible:]): Pass options via a struct.
(-[WebFrame _scrollDOMRangeToVisible:withInset:]): Ditto.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@235749 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/accessibility/AccessibilityObject.cpp
Source/WebCore/dom/Element.cpp
Source/WebCore/editing/FrameSelection.cpp
Source/WebCore/page/FrameView.cpp
Source/WebCore/rendering/RenderLayer.cpp
Source/WebCore/rendering/RenderLayer.h
Source/WebCore/rendering/RenderObject.cpp
Source/WebCore/rendering/RenderObject.h
Source/WebKitLegacy/mac/ChangeLog
Source/WebKitLegacy/mac/WebView/WebFrame.mm