RESOLVED FIXED 209715
scrollIntoView() erroneously scrolls non-containing block scrollers
https://bugs.webkit.org/show_bug.cgi?id=209715
Summary scrollIntoView() erroneously scrolls non-containing block scrollers
Simon Fraser (smfr)
Reported 2020-03-28 20:41:28 PDT
Created attachment 394857 [details] Testcase RenderLayer::scrollRectToVisible() walks the parent chain and calls scrollIntoView() on each enclosing layer. But this is wrong, because not all parent layers are in the containing block chain. Attached testcase shows the bug.
Attachments
Testcase (1.50 KB, text/html)
2020-03-28 20:41 PDT, Simon Fraser (smfr)
no flags
Patch (14.95 KB, patch)
2020-03-30 11:46 PDT, Simon Fraser (smfr)
no flags
Patch (14.91 KB, patch)
2020-03-30 14:36 PDT, Simon Fraser (smfr)
no flags
Patch (14.86 KB, patch)
2020-03-30 14:38 PDT, Simon Fraser (smfr)
no flags
Patch (16.00 KB, patch)
2020-03-30 14:45 PDT, Simon Fraser (smfr)
zalan: review+
Patch (16.60 KB, patch)
2020-03-30 15:04 PDT, Simon Fraser (smfr)
no flags
Simon Fraser (smfr)
Comment 1 2020-03-28 20:43:28 PDT
Needs to share code with scroll latching ancestor finding.
Simon Fraser (smfr)
Comment 2 2020-03-30 11:46:33 PDT
Darin Adler
Comment 3 2020-03-30 13:47:32 PDT
Comment on attachment 394941 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=394941&action=review > Source/WebCore/rendering/RenderLayer.cpp:1922 > + for (RenderLayer* nextLayer = enclosingContainingBlockLayer(*this, crossFrameBoundaries);nextLayer; nextLayer = enclosingContainingBlockLayer(*nextLayer, crossFrameBoundaries)) { Missing space after semicolon. Also, why not use auto instead of type name here? > Source/WebCore/rendering/RenderLayer.cpp:2896 > + auto* enclosingLayer = ownerElement->renderer()->enclosingLayer(); > + if (enclosingLayer) Why not put this inside the if?
Simon Fraser (smfr)
Comment 4 2020-03-30 14:36:25 PDT
Simon Fraser (smfr)
Comment 5 2020-03-30 14:38:49 PDT
Simon Fraser (smfr)
Comment 6 2020-03-30 14:45:35 PDT
Darin Adler
Comment 7 2020-03-30 14:50:47 PDT
Comment on attachment 394966 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=394966&action=review > Source/WebKitLegacy/win/WebView.cpp:2041 > + if (m_gestureTargetNode && m_gestureTargetNode->renderer() && m_gestureTargetNode->renderer()->enclosingLayer()) { > + if (auto* layer = m_gestureTargetNode->renderer()->enclosingLayer()) Seems like a double null check on enclosingLayer.
Simon Fraser (smfr)
Comment 8 2020-03-30 14:59:46 PDT
(In reply to Darin Adler from comment #7) > Comment on attachment 394966 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=394966&action=review > > > Source/WebKitLegacy/win/WebView.cpp:2041 > > + if (m_gestureTargetNode && m_gestureTargetNode->renderer() && m_gestureTargetNode->renderer()->enclosingLayer()) { > > + if (auto* layer = m_gestureTargetNode->renderer()->enclosingLayer()) > > Seems like a double null check on enclosingLayer. Oops yeah. Will fix.
Simon Fraser (smfr)
Comment 9 2020-03-30 15:04:43 PDT
EWS
Comment 10 2020-03-30 17:03:30 PDT
Committed r259248: <https://trac.webkit.org/changeset/259248> All reviewed patches have been landed. Closing bug and clearing flags on attachment 394971 [details].
Radar WebKit Bug Importer
Comment 11 2020-03-30 17:08:33 PDT
Note You need to log in before you can comment on or make changes to this bug.