WebKit Bugzilla
Attachment 349030 Details for
Bug 189352
: Group options of scrollRectToVisible into a struct
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
0001-Bug-189352-Group-options-of-scrollRectToVisible-into.patch (text/plain), 25.23 KB, created by
Frédéric Wang (:fredw)
on 2018-09-06 09:15:21 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Frédéric Wang (:fredw)
Created:
2018-09-06 09:15:21 PDT
Size:
25.23 KB
patch
obsolete
>From 302f7808c4297f344eb45737ef666f5ab9bfe59b Mon Sep 17 00:00:00 2001 >From: Frederic Wang <fwang@igalia.com> >Date: Thu, 6 Sep 2018 17:27:13 +0200 >Subject: [PATCH xserver 1/2] Bug 189352 - Group options of scrollRectToVisible > into a struct > >--- > Source/WebCore/ChangeLog | 38 +++++++++++++++++++ > .../accessibility/AccessibilityObject.cpp | 2 +- > Source/WebCore/dom/Element.cpp | 14 +++---- > Source/WebCore/editing/FrameSelection.cpp | 6 +-- > Source/WebCore/page/FrameView.cpp | 8 ++-- > Source/WebCore/rendering/RenderLayer.cpp | 16 ++++---- > Source/WebCore/rendering/RenderLayer.h | 9 ++++- > Source/WebCore/rendering/RenderObject.cpp | 6 +-- > Source/WebCore/rendering/RenderObject.h | 4 +- > Source/WebKitLegacy/mac/ChangeLog | 11 ++++++ > Source/WebKitLegacy/mac/WebView/WebFrame.mm | 7 ++-- > 11 files changed, 90 insertions(+), 31 deletions(-) > >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 225cb67172d..c3bc80392e8 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,41 @@ >+2018-09-06 Frederic Wang <fwang@igalia.com> >+ >+ Group options of scrollRectToVisible into a struct >+ https://bugs.webkit.org/show_bug.cgi?id=189352 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ 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. >+ > 2018-09-04 Frederic Wang <fwang@igalia.com> > > Add basic support for ScrollIntoViewOptions >diff --git a/Source/WebCore/accessibility/AccessibilityObject.cpp b/Source/WebCore/accessibility/AccessibilityObject.cpp >index 62fb92071b2..61be5d41b2c 100644 >--- a/Source/WebCore/accessibility/AccessibilityObject.cpp >+++ b/Source/WebCore/accessibility/AccessibilityObject.cpp >@@ -2992,7 +2992,7 @@ void AccessibilityObject::scrollToMakeVisible() const > parentObject()->scrollToMakeVisible(); > > if (auto* renderer = this->renderer()) >- renderer->scrollRectToVisible(SelectionRevealMode::Reveal, boundingBoxRect(), false, ScrollAlignment::alignCenterIfNeeded, ScrollAlignment::alignCenterIfNeeded, ShouldAllowCrossOriginScrolling::Yes); >+ renderer->scrollRectToVisible(boundingBoxRect(), false, { SelectionRevealMode::Reveal, ScrollAlignment::alignCenterIfNeeded, ScrollAlignment::alignCenterIfNeeded, ShouldAllowCrossOriginScrolling::Yes }); > } > > void AccessibilityObject::scrollToMakeVisibleWithSubFocus(const IntRect& subfocus) const >diff --git a/Source/WebCore/dom/Element.cpp b/Source/WebCore/dom/Element.cpp >index 6fa86b1a63c..439d92ef24d 100644 >--- a/Source/WebCore/dom/Element.cpp >+++ b/Source/WebCore/dom/Element.cpp >@@ -692,7 +692,7 @@ void Element::scrollIntoView(std::optional<Variant<bool, ScrollIntoViewOptions>> > > ScrollAlignment alignX = toScrollAlignment(options.inlinePosition, false); > ScrollAlignment alignY = toScrollAlignment(options.blockPosition, true); >- renderer()->scrollRectToVisible(SelectionRevealMode::Reveal, absoluteBounds, insideFixed, alignX, alignY, ShouldAllowCrossOriginScrolling::No); >+ renderer()->scrollRectToVisible(absoluteBounds, insideFixed, { SelectionRevealMode::Reveal, alignX, alignY, ShouldAllowCrossOriginScrolling::No }); > } > > void Element::scrollIntoView(bool alignToTop) >@@ -706,9 +706,9 @@ void Element::scrollIntoView(bool alignToTop) > LayoutRect absoluteBounds = renderer()->absoluteAnchorRect(&insideFixed); > // Align to the top / bottom and to the closest edge. > if (alignToTop) >- renderer()->scrollRectToVisible(SelectionRevealMode::Reveal, absoluteBounds, insideFixed, ScrollAlignment::alignToEdgeIfNeeded, ScrollAlignment::alignTopAlways, ShouldAllowCrossOriginScrolling::No); >+ renderer()->scrollRectToVisible(absoluteBounds, insideFixed, { SelectionRevealMode::Reveal, ScrollAlignment::alignToEdgeIfNeeded, ScrollAlignment::alignTopAlways, ShouldAllowCrossOriginScrolling::No }); > else >- renderer()->scrollRectToVisible(SelectionRevealMode::Reveal, absoluteBounds, insideFixed, ScrollAlignment::alignToEdgeIfNeeded, ScrollAlignment::alignBottomAlways, ShouldAllowCrossOriginScrolling::No); >+ renderer()->scrollRectToVisible(absoluteBounds, insideFixed, { SelectionRevealMode::Reveal, ScrollAlignment::alignToEdgeIfNeeded, ScrollAlignment::alignBottomAlways, ShouldAllowCrossOriginScrolling::No }); > } > > void Element::scrollIntoViewIfNeeded(bool centerIfNeeded) >@@ -721,9 +721,9 @@ void Element::scrollIntoViewIfNeeded(bool centerIfNeeded) > bool insideFixed; > LayoutRect absoluteBounds = renderer()->absoluteAnchorRect(&insideFixed); > if (centerIfNeeded) >- renderer()->scrollRectToVisible(SelectionRevealMode::Reveal, absoluteBounds, insideFixed, ScrollAlignment::alignCenterIfNeeded, ScrollAlignment::alignCenterIfNeeded, ShouldAllowCrossOriginScrolling::No); >+ renderer()->scrollRectToVisible(absoluteBounds, insideFixed, { SelectionRevealMode::Reveal, ScrollAlignment::alignCenterIfNeeded, ScrollAlignment::alignCenterIfNeeded, ShouldAllowCrossOriginScrolling::No }); > else >- renderer()->scrollRectToVisible(SelectionRevealMode::Reveal, absoluteBounds, insideFixed, ScrollAlignment::alignToEdgeIfNeeded, ScrollAlignment::alignToEdgeIfNeeded, ShouldAllowCrossOriginScrolling::No); >+ renderer()->scrollRectToVisible(absoluteBounds, insideFixed, { SelectionRevealMode::Reveal, ScrollAlignment::alignToEdgeIfNeeded, ScrollAlignment::alignToEdgeIfNeeded, ShouldAllowCrossOriginScrolling::No }); > } > > void Element::scrollIntoViewIfNotVisible(bool centerIfNotVisible) >@@ -736,9 +736,9 @@ void Element::scrollIntoViewIfNotVisible(bool centerIfNotVisible) > bool insideFixed; > LayoutRect absoluteBounds = renderer()->absoluteAnchorRect(&insideFixed); > if (centerIfNotVisible) >- renderer()->scrollRectToVisible(SelectionRevealMode::Reveal, absoluteBounds, insideFixed, ScrollAlignment::alignCenterIfNotVisible, ScrollAlignment::alignCenterIfNotVisible, ShouldAllowCrossOriginScrolling::No); >+ renderer()->scrollRectToVisible(absoluteBounds, insideFixed, { SelectionRevealMode::Reveal, ScrollAlignment::alignCenterIfNotVisible, ScrollAlignment::alignCenterIfNotVisible, ShouldAllowCrossOriginScrolling::No }); > else >- renderer()->scrollRectToVisible(SelectionRevealMode::Reveal, absoluteBounds, insideFixed, ScrollAlignment::alignToEdgeIfNotVisible, ScrollAlignment::alignToEdgeIfNotVisible, ShouldAllowCrossOriginScrolling::No); >+ renderer()->scrollRectToVisible(absoluteBounds, insideFixed, { SelectionRevealMode::Reveal, ScrollAlignment::alignToEdgeIfNotVisible, ScrollAlignment::alignToEdgeIfNotVisible, ShouldAllowCrossOriginScrolling::No }); > } > > void Element::scrollBy(const ScrollToOptions& options) >diff --git a/Source/WebCore/editing/FrameSelection.cpp b/Source/WebCore/editing/FrameSelection.cpp >index 768c44bb6ba..1c5bd06fd86 100644 >--- a/Source/WebCore/editing/FrameSelection.cpp >+++ b/Source/WebCore/editing/FrameSelection.cpp >@@ -53,6 +53,7 @@ > #include "HitTestResult.h" > #include "InlineTextBox.h" > #include "Page.h" >+#include "RenderLayer.h" > #include "RenderText.h" > #include "RenderTextControl.h" > #include "RenderTheme.h" >@@ -71,7 +72,6 @@ > #include "Chrome.h" > #include "ChromeClient.h" > #include "Color.h" >-#include "RenderLayer.h" > #include "RenderObject.h" > #include "RenderStyle.h" > #endif >@@ -2374,7 +2374,7 @@ void FrameSelection::revealSelection(SelectionRevealMode revealMode, const Scrol > if (RenderLayer* layer = start.deprecatedNode()->renderer()->enclosingLayer()) { > if (!m_scrollingSuppressCount) { > layer->setAdjustForIOSCaretWhenScrolling(true); >- layer->scrollRectToVisible(revealMode, rect, insideFixed, alignment, alignment, ShouldAllowCrossOriginScrolling::Yes); >+ layer->scrollRectToVisible(rect, insideFixed, { revealMode, alignment, alignment, ShouldAllowCrossOriginScrolling::Yes }); > layer->setAdjustForIOSCaretWhenScrolling(false); > updateAppearance(); > if (m_frame->page()) >@@ -2385,7 +2385,7 @@ void FrameSelection::revealSelection(SelectionRevealMode revealMode, const Scrol > // FIXME: This code only handles scrolling the startContainer's layer, but > // the selection rect could intersect more than just that. > // See <rdar://problem/4799899>. >- if (start.deprecatedNode()->renderer()->scrollRectToVisible(revealMode, rect, insideFixed, alignment, alignment, ShouldAllowCrossOriginScrolling::Yes)) >+ if (start.deprecatedNode()->renderer()->scrollRectToVisible(rect, insideFixed, { revealMode, alignment, alignment, ShouldAllowCrossOriginScrolling::Yes })) > updateAppearance(); > #endif > } >diff --git a/Source/WebCore/page/FrameView.cpp b/Source/WebCore/page/FrameView.cpp >index 18c54774443..99489ef371e 100644 >--- a/Source/WebCore/page/FrameView.cpp >+++ b/Source/WebCore/page/FrameView.cpp >@@ -2336,7 +2336,7 @@ void FrameView::scrollToFocusedElementInternal() > > bool insideFixed; > LayoutRect absoluteBounds = renderer->absoluteAnchorRect(&insideFixed); >- renderer->scrollRectToVisible(m_selectionRevealModeForFocusedElement, absoluteBounds, insideFixed, ScrollAlignment::alignCenterIfNeeded, ScrollAlignment::alignCenterIfNeeded, ShouldAllowCrossOriginScrolling::No); >+ renderer->scrollRectToVisible(absoluteBounds, insideFixed, { m_selectionRevealModeForFocusedElement, ScrollAlignment::alignCenterIfNeeded, ScrollAlignment::alignCenterIfNeeded, ShouldAllowCrossOriginScrolling::No }); > } > > void FrameView::contentsResized() >@@ -3110,11 +3110,11 @@ void FrameView::scrollToAnchor() > // Scroll nested layers and frames to reveal the anchor. > // Align to the top and to the closest side (this matches other browsers). > if (anchorNode->renderer()->style().isHorizontalWritingMode()) >- anchorNode->renderer()->scrollRectToVisible(SelectionRevealMode::Reveal, rect, insideFixed, ScrollAlignment::alignToEdgeIfNeeded, ScrollAlignment::alignTopAlways, ShouldAllowCrossOriginScrolling::No); >+ anchorNode->renderer()->scrollRectToVisible(rect, insideFixed, { SelectionRevealMode::Reveal, ScrollAlignment::alignToEdgeIfNeeded, ScrollAlignment::alignTopAlways, ShouldAllowCrossOriginScrolling::No }); > else if (anchorNode->renderer()->style().isFlippedBlocksWritingMode()) >- anchorNode->renderer()->scrollRectToVisible(SelectionRevealMode::Reveal, rect, insideFixed, ScrollAlignment::alignRightAlways, ScrollAlignment::alignToEdgeIfNeeded, ShouldAllowCrossOriginScrolling::No); >+ anchorNode->renderer()->scrollRectToVisible(rect, insideFixed, { SelectionRevealMode::Reveal, ScrollAlignment::alignRightAlways, ScrollAlignment::alignToEdgeIfNeeded, ShouldAllowCrossOriginScrolling::No }); > else >- anchorNode->renderer()->scrollRectToVisible(SelectionRevealMode::Reveal, rect, insideFixed, ScrollAlignment::alignLeftAlways, ScrollAlignment::alignToEdgeIfNeeded, ShouldAllowCrossOriginScrolling::No); >+ anchorNode->renderer()->scrollRectToVisible(rect, insideFixed, { SelectionRevealMode::Reveal, ScrollAlignment::alignLeftAlways, ScrollAlignment::alignToEdgeIfNeeded, ShouldAllowCrossOriginScrolling::No }); > > if (AXObjectCache* cache = frame().document()->existingAXObjectCache()) > cache->handleScrolledToAnchor(anchorNode.get()); >diff --git a/Source/WebCore/rendering/RenderLayer.cpp b/Source/WebCore/rendering/RenderLayer.cpp >index d390c139b3d..46b3a4622b5 100644 >--- a/Source/WebCore/rendering/RenderLayer.cpp >+++ b/Source/WebCore/rendering/RenderLayer.cpp >@@ -2502,7 +2502,7 @@ bool RenderLayer::allowsCurrentScroll() const > return box->hasHorizontalOverflow() || box->hasVerticalOverflow(); > } > >-void RenderLayer::scrollRectToVisible(SelectionRevealMode revealMode, const LayoutRect& absoluteRect, bool insideFixed, const ScrollAlignment& alignX, const ScrollAlignment& alignY, ShouldAllowCrossOriginScrolling shouldAllowCrossOriginScrolling) >+void RenderLayer::scrollRectToVisible(const LayoutRect& absoluteRect, bool insideFixed, const ScrollRectToVisibleOptions& options) > { > LOG_WITH_STREAM(Scrolling, stream << "Layer " << this << " scrollRectToVisible " << absoluteRect); > >@@ -2523,7 +2523,7 @@ void RenderLayer::scrollRectToVisible(SelectionRevealMode revealMode, const Layo > ASSERT(box); > LayoutRect localExposeRect(box->absoluteToLocalQuad(FloatQuad(FloatRect(absoluteRect))).boundingBox()); > LayoutRect layerBounds(0, 0, box->clientWidth(), box->clientHeight()); >- LayoutRect revealRect = getRectToExpose(layerBounds, localExposeRect, insideFixed, alignX, alignY); >+ LayoutRect revealRect = getRectToExpose(layerBounds, localExposeRect, insideFixed, options.alignX, options.alignY); > > ScrollOffset clampedScrollOffset = clampScrollOffset(scrollOffset() + toIntSize(roundedIntRect(revealRect).location())); > if (clampedScrollOffset != scrollOffset()) { >@@ -2547,14 +2547,14 @@ void RenderLayer::scrollRectToVisible(SelectionRevealMode revealMode, const Layo > ScriptDisallowedScope::InMainThread scriptDisallowedScope; > > LayoutRect viewRect = frameView.visibleContentRect(LegacyIOSDocumentVisibleRect); >- LayoutRect exposeRect = getRectToExpose(viewRect, absoluteRect, insideFixed, alignX, alignY); >+ LayoutRect exposeRect = getRectToExpose(viewRect, absoluteRect, insideFixed, options.alignX, options.alignY); > > IntPoint scrollOffset(roundedIntPoint(exposeRect.location())); > // Adjust offsets if they're outside of the allowable range. > scrollOffset = scrollOffset.constrainedBetween(IntPoint(), IntPoint(frameView.contentsSize())); > frameView.setScrollPosition(scrollOffset); > >- if (shouldAllowCrossOriginScrolling == ShouldAllowCrossOriginScrolling::Yes || frameView.safeToPropagateScrollToParent()) { >+ if (options.shouldAllowCrossOriginScrolling == ShouldAllowCrossOriginScrolling::Yes || frameView.safeToPropagateScrollToParent()) { > parentLayer = ownerElement->renderer()->enclosingLayer(); > // Convert the rect into the coordinate space of the parent frame's document. > newRect = frameView.contentsToContainingViewContents(enclosingIntRect(newRect)); >@@ -2563,7 +2563,7 @@ void RenderLayer::scrollRectToVisible(SelectionRevealMode revealMode, const Layo > parentLayer = nullptr; > } > } else { >- if (revealMode == SelectionRevealMode::RevealUpToMainFrame && frameView.frame().isMainFrame()) >+ if (options.revealMode == SelectionRevealMode::RevealUpToMainFrame && frameView.frame().isMainFrame()) > return; > > #if !PLATFORM(IOS) >@@ -2575,7 +2575,7 @@ void RenderLayer::scrollRectToVisible(SelectionRevealMode revealMode, const Layo > LayoutRect targetRect = absoluteRect; > targetRect.move(0, frameView.headerHeight()); > >- LayoutRect revealRect = getRectToExpose(viewRect, targetRect, insideFixed, alignX, alignY); >+ LayoutRect revealRect = getRectToExpose(viewRect, targetRect, insideFixed, options.alignX, options.alignY); > > frameView.setScrollPosition(roundedIntPoint(revealRect.location())); > >@@ -2589,7 +2589,7 @@ void RenderLayer::scrollRectToVisible(SelectionRevealMode revealMode, const Layo > } > > if (parentLayer) >- parentLayer->scrollRectToVisible(revealMode, newRect, insideFixed, alignX, alignY, shouldAllowCrossOriginScrolling); >+ parentLayer->scrollRectToVisible(newRect, insideFixed, options); > } > > void RenderLayer::updateCompositingLayersAfterScroll() >@@ -2712,7 +2712,7 @@ LayoutRect RenderLayer::getRectToExpose(const LayoutRect &visibleRect, const Lay > void RenderLayer::autoscroll(const IntPoint& positionInWindow) > { > IntPoint currentDocumentPosition = renderer().view().frameView().windowToContents(positionInWindow); >- scrollRectToVisible(SelectionRevealMode::Reveal, LayoutRect(currentDocumentPosition, LayoutSize(1, 1)), false, ScrollAlignment::alignToEdgeIfNeeded, ScrollAlignment::alignToEdgeIfNeeded, ShouldAllowCrossOriginScrolling::Yes); >+ scrollRectToVisible(LayoutRect(currentDocumentPosition, LayoutSize(1, 1)), false, { SelectionRevealMode::Reveal, ScrollAlignment::alignToEdgeIfNeeded, ScrollAlignment::alignToEdgeIfNeeded, ShouldAllowCrossOriginScrolling::Yes }); > } > > bool RenderLayer::canResize() const >diff --git a/Source/WebCore/rendering/RenderLayer.h b/Source/WebCore/rendering/RenderLayer.h >index eb683ccce2e..90eb3a6a575 100644 >--- a/Source/WebCore/rendering/RenderLayer.h >+++ b/Source/WebCore/rendering/RenderLayer.h >@@ -120,6 +120,13 @@ enum class RequestState { > Undetermined > }; > >+struct ScrollRectToVisibleOptions { >+ SelectionRevealMode revealMode { SelectionRevealMode::Reveal }; >+ const ScrollAlignment& alignX { ScrollAlignment::alignCenterIfNeeded }; >+ const ScrollAlignment& alignY { ScrollAlignment::alignCenterIfNeeded }; >+ ShouldAllowCrossOriginScrolling shouldAllowCrossOriginScrolling { ShouldAllowCrossOriginScrolling::No }; >+}; >+ > class RenderLayer final : public ScrollableArea { > WTF_MAKE_FAST_ALLOCATED; > public: >@@ -218,7 +225,7 @@ public: > void availableContentSizeChanged(AvailableSizeChangeReason) override; > > // "absoluteRect" is in scaled document coordinates. >- void scrollRectToVisible(SelectionRevealMode, const LayoutRect& absoluteRect, bool insideFixed, const ScrollAlignment& alignX, const ScrollAlignment& alignY, ShouldAllowCrossOriginScrolling); >+ void scrollRectToVisible(const LayoutRect& absoluteRect, bool insideFixed, const ScrollRectToVisibleOptions&); > > bool scrollsOverflow() const; > bool hasScrollbars() const { return m_hBar || m_vBar; } >diff --git a/Source/WebCore/rendering/RenderObject.cpp b/Source/WebCore/rendering/RenderObject.cpp >index cdb0262053b..fa7ab44cd32 100644 >--- a/Source/WebCore/rendering/RenderObject.cpp >+++ b/Source/WebCore/rendering/RenderObject.cpp >@@ -414,16 +414,16 @@ RenderLayer* RenderObject::enclosingLayer() const > return nullptr; > } > >-bool RenderObject::scrollRectToVisible(SelectionRevealMode revealMode, const LayoutRect& absoluteRect, bool insideFixed, const ScrollAlignment& alignX, const ScrollAlignment& alignY, ShouldAllowCrossOriginScrolling shouldAllowCrossOriginScrolling) >+bool RenderObject::scrollRectToVisible(const LayoutRect& absoluteRect, bool insideFixed, const ScrollRectToVisibleOptions& options) > { >- if (revealMode == SelectionRevealMode::DoNotReveal) >+ if (options.revealMode == SelectionRevealMode::DoNotReveal) > return false; > > RenderLayer* enclosingLayer = this->enclosingLayer(); > if (!enclosingLayer) > return false; > >- enclosingLayer->scrollRectToVisible(revealMode, absoluteRect, insideFixed, alignX, alignY, shouldAllowCrossOriginScrolling); >+ enclosingLayer->scrollRectToVisible(absoluteRect, insideFixed, options); > return true; > } > >diff --git a/Source/WebCore/rendering/RenderObject.h b/Source/WebCore/rendering/RenderObject.h >index 25162583d56..7642f5846d7 100644 >--- a/Source/WebCore/rendering/RenderObject.h >+++ b/Source/WebCore/rendering/RenderObject.h >@@ -83,6 +83,8 @@ const int caretWidth = 1; > > enum class ShouldAllowCrossOriginScrolling { No, Yes }; > >+struct ScrollRectToVisibleOptions; >+ > #if ENABLE(DASHBOARD_SUPPORT) > struct AnnotatedRegionValue { > bool operator==(const AnnotatedRegionValue& o) const >@@ -158,7 +160,7 @@ public: > WEBCORE_EXPORT RenderLayer* enclosingLayer() const; > > // Scrolling is a RenderBox concept, however some code just cares about recursively scrolling our enclosing ScrollableArea(s). >- WEBCORE_EXPORT bool scrollRectToVisible(SelectionRevealMode, const LayoutRect& absoluteRect, bool insideFixed, const ScrollAlignment& alignX = ScrollAlignment::alignCenterIfNeeded, const ScrollAlignment& alignY = ScrollAlignment::alignCenterIfNeeded, ShouldAllowCrossOriginScrolling = ShouldAllowCrossOriginScrolling::No); >+ WEBCORE_EXPORT bool scrollRectToVisible(const LayoutRect& absoluteRect, bool insideFixed, const ScrollRectToVisibleOptions&); > > // Convenience function for getting to the nearest enclosing box of a RenderObject. > WEBCORE_EXPORT RenderBox& enclosingBox() const; >diff --git a/Source/WebKitLegacy/mac/ChangeLog b/Source/WebKitLegacy/mac/ChangeLog >index 98813e4e337..60bf97e9afe 100644 >--- a/Source/WebKitLegacy/mac/ChangeLog >+++ b/Source/WebKitLegacy/mac/ChangeLog >@@ -1,3 +1,14 @@ >+2018-09-06 Frederic Wang <fwang@igalia.com> >+ >+ Group options of scrollRectToVisible into a struct >+ https://bugs.webkit.org/show_bug.cgi?id=189352 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * WebView/WebFrame.mm: Add header to use ScrollRectToVisibleOptions. >+ (-[WebFrame _scrollDOMRangeToVisible:]): Pass options via a struct. >+ (-[WebFrame _scrollDOMRangeToVisible:withInset:]): Ditto. >+ > 2018-09-04 Frederic Wang <fwang@igalia.com> > > Add basic support for ScrollIntoViewOptions >diff --git a/Source/WebKitLegacy/mac/WebView/WebFrame.mm b/Source/WebKitLegacy/mac/WebView/WebFrame.mm >index 860db290e10..c5c25de5f8c 100644 >--- a/Source/WebKitLegacy/mac/WebView/WebFrame.mm >+++ b/Source/WebKitLegacy/mac/WebView/WebFrame.mm >@@ -89,6 +89,7 @@ > #import <WebCore/PlatformEventFactoryMac.h> > #import <WebCore/PluginData.h> > #import <WebCore/PrintContext.h> >+#import <WebCore/RenderLayer.h> > #import <WebCore/RenderView.h> > #import <WebCore/RenderWidget.h> > #import <WebCore/RenderedDocumentMarker.h> >@@ -741,12 +742,12 @@ static inline WebDataSource *dataSource(DocumentLoader* loader) > > if (startNode && startNode->renderer()) { > #if !PLATFORM(IOS) >- startNode->renderer()->scrollRectToVisible(SelectionRevealMode::Reveal, enclosingIntRect(rangeRect), insideFixed, ScrollAlignment::alignToEdgeIfNeeded, ScrollAlignment::alignToEdgeIfNeeded, ShouldAllowCrossOriginScrolling::Yes); >+ startNode->renderer()->scrollRectToVisible(enclosingIntRect(rangeRect), insideFixed, { SelectionRevealMode::Reveal, ScrollAlignment::alignToEdgeIfNeeded, ScrollAlignment::alignToEdgeIfNeeded, ShouldAllowCrossOriginScrolling::Yes }); > #else > RenderLayer* layer = startNode->renderer()->enclosingLayer(); > if (layer) { > layer->setAdjustForIOSCaretWhenScrolling(true); >- startNode->renderer()->scrollRectToVisible(SelectionRevealMode::Reveal, enclosingIntRect(rangeRect), insideFixed, ScrollAlignment::alignToEdgeIfNeeded, ScrollAlignment::alignToEdgeIfNeeded, ShouldAllowCrossOriginScrolling::Yes); >+ startNode->renderer()->scrollRectToVisible(enclosingIntRect(rangeRect), insideFixed, { SelectionRevealMode::Reveal, ScrollAlignment::alignToEdgeIfNeeded, ScrollAlignment::alignToEdgeIfNeeded, ShouldAllowCrossOriginScrolling::Yes }); > layer->setAdjustForIOSCaretWhenScrolling(false); > _private->coreFrame->selection().setCaretRectNeedsUpdate(); > _private->coreFrame->selection().updateAppearance(); >@@ -766,7 +767,7 @@ static inline WebDataSource *dataSource(DocumentLoader* loader) > RenderLayer* layer = startNode->renderer()->enclosingLayer(); > if (layer) { > layer->setAdjustForIOSCaretWhenScrolling(true); >- startNode->renderer()->scrollRectToVisible(SelectionRevealMode::Reveal, enclosingIntRect(rangeRect), insideFixed, ScrollAlignment::alignToEdgeIfNeeded, ScrollAlignment::alignToEdgeIfNeeded, ShouldAllowCrossOriginScrolling::Yes); >+ startNode->renderer()->scrollRectToVisible(enclosingIntRect(rangeRect), insideFixed, { SelectionRevealMode::Reveal, ScrollAlignment::alignToEdgeIfNeeded, ScrollAlignment::alignToEdgeIfNeeded, ShouldAllowCrossOriginScrolling::Yes}); > layer->setAdjustForIOSCaretWhenScrolling(false); > > Frame *coreFrame = core(self); >-- >2.18.0 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 189352
:
349027
| 349030