haikuwebkit/LayoutTests/fast/visual-viewport/zoomed-scroll-into-view-fix...

25 lines
673 B
Plaintext
Raw Permalink Normal View History

Improve the behavior of scroll-into-view when the target is inside position:fixed https://bugs.webkit.org/show_bug.cgi?id=165354 Reviewed by Zalan Bujtas. Source/WebCore: The existing RenderLayer::scrollRectToVisible() code paid no heed to whether the target was inside position:fixed, resulting in unwanted scrolls. Fix this by plumbing through from the call sites a "insideFixed" flag which we get when we call localToAbsolute(), and use this flag to avoid scrolling at all if unzoomed. If zoomed and we're focussing something inside position:fixed, and if visual viewports are enabled, we can compute the visual viewport required to reveal the target rect, which gives us the ideal scroll position. Fix a bug on non-iOS platforms when zoomed, which is to scale the viewRect since frameView.visibleContentRect() gives an unscaled rect on those platforms. Not all callers of scrollRectToVisible() are fixed, but those that are not will get the current behavior. Tests: fast/overflow/scroll-anchor-in-position-fixed.html fast/visual-viewport/zoomed-scroll-into-view-fixed.html fast/visual-viewport/zoomed-scroll-to-anchor-in-position-fixed.html * dom/Element.cpp: (WebCore::Element::scrollIntoView): (WebCore::Element::scrollIntoViewIfNeeded): (WebCore::Element::scrollIntoViewIfNotVisible): (WebCore::Element::updateFocusAppearance): * editing/FrameSelection.cpp: (WebCore::FrameSelection::FrameSelection): (WebCore::FrameSelection::absoluteCaretBounds): (WebCore::FrameSelection::recomputeCaretRect): (WebCore::FrameSelection::revealSelection): * editing/FrameSelection.h: * editing/VisiblePosition.cpp: (WebCore::VisiblePosition::absoluteCaretBounds): * editing/VisiblePosition.h: * editing/htmlediting.cpp: (WebCore::absoluteBoundsForLocalCaretRect): * editing/htmlediting.h: * page/FrameView.cpp: (WebCore::FrameView::scrollElementToRect): (WebCore::FrameView::scrollToAnchor): * page/PrintContext.cpp: (WebCore::PrintContext::outputLinkedDestinations): * rendering/RenderElement.cpp: (WebCore::RenderElement::getLeadingCorner): (WebCore::RenderElement::getTrailingCorner): (WebCore::RenderElement::absoluteAnchorRect): (WebCore::RenderElement::anchorRect): Deleted. * rendering/RenderElement.h: * rendering/RenderLayer.cpp: (WebCore::RenderLayer::scrollRectToVisible): (WebCore::RenderLayer::getRectToExpose): (WebCore::RenderLayer::autoscroll): * rendering/RenderLayer.h: * rendering/RenderObject.cpp: (WebCore::RenderObject::scrollRectToVisible): * rendering/RenderObject.h: Source/WebKit/mac: Plumb through 'insideFixed'. We don't get compute it, so behavior from these call sites won't change. * WebView/WebFrame.mm: (-[WebFrame _scrollDOMRangeToVisible:]): (-[WebFrame _scrollDOMRangeToVisible:withInset:]): LayoutTests: * fast/overflow/scroll-anchor-in-position-fixed-expected.txt: Added. * fast/overflow/scroll-anchor-in-position-fixed.html: Added. * fast/transforms/selection-bounds-in-transformed-view.html: * fast/visual-viewport/zoomed-scroll-into-view-fixed-expected.txt: Added. * fast/visual-viewport/zoomed-scroll-into-view-fixed.html: Added. * fast/visual-viewport/zoomed-scroll-to-anchor-in-position-fixed-expected.txt: Added. * fast/visual-viewport/zoomed-scroll-to-anchor-in-position-fixed.html: Added. * platform/ios-simulator/TestExpectations: Canonical link: https://commits.webkit.org/183078@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@209411 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-12-06 20:00:28 +00:00
Tests revealing elements inside position:fixed after zooming.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
Reveal "left-target"
PASS document.scrollingElement.scrollTop is 838
PASS document.scrollingElement.scrollLeft is 40
Reveal "bottom-target"
PASS document.scrollingElement.scrollTop is 1048
PASS document.scrollingElement.scrollLeft is 40
Reveal "right-target"
PASS document.scrollingElement.scrollTop is 1086
PASS document.scrollingElement.scrollLeft is 333
Reveal "top-target"
PASS document.scrollingElement.scrollTop is 834
PASS document.scrollingElement.scrollLeft is 230
PASS successfullyParsed is true
TEST COMPLETE