зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1740289 - Notify onShowDynamicToolbar on overflow: hidden case. r=geckoview-reviewers,agi,emilio
The reason why we don't change GetOverflowState is that GetOverflowState is also used for overflow/underflow event firing and our frontend code expects both the events are fired on overflow:hidden elements [1]. And it looks like it's by design as per one of test cases for overflow events has `overflow:hidden` style in the first place. [1] https://searchfox.org/mozilla-central/rev/df6434d2ebfdf2b5f89f205fc81d60d64a774fe1/devtools/client/shared/components/tabs/Tabs.css#38-39 [2] https://searchfox.org/mozilla-central/rev/df6434d2ebfdf2b5f89f205fc81d60d64a774fe1/layout/generic/test/test_overflow_event.html#46 Differential Revision: https://phabricator.services.mozilla.com/D131103
This commit is contained in:
Родитель
0b48a2d1e1
Коммит
29ec3a9389
|
@ -2271,6 +2271,9 @@ ScrollFrameHelper::ScrollFrameHelper(nsContainerFrame* aOuter, bool aIsRoot)
|
|||
mApzAnimationRequested(false),
|
||||
mReclampVVOffsetInReflowFinished(false),
|
||||
mMayScheduleScrollAnimations(false),
|
||||
#ifdef MOZ_WIDGET_ANDROID
|
||||
mHasVerticalOverflowForDynamicToolbar(false),
|
||||
#endif
|
||||
mVelocityQueue(aOuter->PresContext()) {
|
||||
AppendScrollUpdate(ScrollPositionUpdate::NewScrollframe(nsPoint()));
|
||||
|
||||
|
@ -6447,9 +6450,14 @@ bool ScrollFrameHelper::ReflowFinished() {
|
|||
}
|
||||
|
||||
#if defined(MOZ_WIDGET_ANDROID)
|
||||
if (mIsRoot && !(GetOverflowState() & OverflowState::Vertical)) {
|
||||
const bool hasVerticalOverflow =
|
||||
GetOverflowState() & OverflowState::Vertical &&
|
||||
GetScrollStylesFromFrame().mVertical != StyleOverflow::Hidden;
|
||||
if (!mFirstReflow && mHasVerticalOverflowForDynamicToolbar &&
|
||||
!hasVerticalOverflow) {
|
||||
mOuter->PresShell()->MaybeNotifyShowDynamicToolbar();
|
||||
}
|
||||
mHasVerticalOverflowForDynamicToolbar = hasVerticalOverflow;
|
||||
#endif // defined(MOZ_WIDGET_ANDROID)
|
||||
}
|
||||
|
||||
|
|
|
@ -766,6 +766,11 @@ class ScrollFrameHelper : public nsIReflowCallback {
|
|||
// Whether we need to schedule the scroll-linked animations.
|
||||
bool mMayScheduleScrollAnimations : 1;
|
||||
|
||||
#ifdef MOZ_WIDGET_ANDROID
|
||||
// True if this scrollable frame was vertically overflowed on the last reflow.
|
||||
bool mHasVerticalOverflowForDynamicToolbar : 1;
|
||||
#endif
|
||||
|
||||
mozilla::layout::ScrollVelocityQueue mVelocityQueue;
|
||||
|
||||
protected:
|
||||
|
|
|
@ -342,6 +342,34 @@ class DynamicToolbarTest : BaseSessionTest() {
|
|||
override fun onShowDynamicToolbar(session: GeckoSession) {
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@WithDisplay(height = SCREEN_HEIGHT, width = SCREEN_WIDTH)
|
||||
@Test fun showDynamicToolbarOnOverflowHidden() {
|
||||
val dynamicToolbarMaxHeight = SCREEN_HEIGHT / 2
|
||||
sessionRule.display?.run { setDynamicToolbarMaxHeight(dynamicToolbarMaxHeight) }
|
||||
|
||||
// Set active since setVerticalClipping call affects only for forground tab.
|
||||
mainSession.setActive(true)
|
||||
|
||||
mainSession.loadTestPath(SHOW_DYNAMIC_TOOLBAR_HTML_PATH)
|
||||
mainSession.waitForPageStop()
|
||||
mainSession.evaluateJS("window.scrollTo(0, " + dynamicToolbarMaxHeight + ")")
|
||||
mainSession.waitUntilCalled(object : ScrollDelegate {
|
||||
@AssertCalled(count = 1)
|
||||
override fun onScrollChanged(session: GeckoSession, scrollX: Int, scrollY: Int) {
|
||||
}
|
||||
})
|
||||
|
||||
// Simulate the dynamic toolbar being hidden by the scroll
|
||||
sessionRule.display?.run { setVerticalClipping(-dynamicToolbarMaxHeight) }
|
||||
|
||||
mainSession.evaluateJS("document.documentElement.style.overflow = 'hidden'")
|
||||
|
||||
mainSession.waitUntilCalled(object : ContentDelegate {
|
||||
@AssertCalled(count = 1)
|
||||
override fun onShowDynamicToolbar(session: GeckoSession) {
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче