commit c7865f7f36aada8c1ebbfdab2b15bfbd382b4f17
parent 7dd78ad473f3d3c94a7c02cfec8d0bffa8d72e97
Author: Hiroyuki Ikezoe <hikezoe.birchill@mozilla.com>
Date: Thu, 4 Dec 2025 05:29:27 +0000
Bug 1993407 - Move mIsSoftwareKeyboardVisible and mInteractiveWidget from ScrollMetadata to FrameMetrics. r=botond
Differential Revision: https://phabricator.services.mozilla.com/D272984
Diffstat:
5 files changed, 46 insertions(+), 43 deletions(-)
diff --git a/gfx/layers/FrameMetrics.h b/gfx/layers/FrameMetrics.h
@@ -96,10 +96,13 @@ struct FrameMetrics {
mLayoutViewport(0, 0, 0, 0),
mVisualDestination(0, 0),
mVisualScrollUpdateType(eNone),
+ mInteractiveWidget(
+ dom::InteractiveWidgetUtils::DefaultInteractiveWidgetMode()),
mIsRootContent(false),
mIsScrollInfoLayer(false),
mHasNonZeroDisplayPortMargins(false),
- mMinimalDisplayPort(false) {}
+ mMinimalDisplayPort(false),
+ mIsSoftwareKeyboardVisible(false) {}
// Default copy ctor and operator= are fine
@@ -124,6 +127,7 @@ struct FrameMetrics {
mPaintRequestTime == aOther.mPaintRequestTime &&
mVisualDestination == aOther.mVisualDestination &&
mVisualScrollUpdateType == aOther.mVisualScrollUpdateType &&
+ mInteractiveWidget == aOther.mInteractiveWidget &&
mIsRootContent == aOther.mIsRootContent &&
mIsScrollInfoLayer == aOther.mIsScrollInfoLayer &&
mHasNonZeroDisplayPortMargins ==
@@ -131,7 +135,8 @@ struct FrameMetrics {
mMinimalDisplayPort == aOther.mMinimalDisplayPort &&
mFixedLayerMargins == aOther.mFixedLayerMargins &&
mCompositionSizeWithoutDynamicToolbar ==
- aOther.mCompositionSizeWithoutDynamicToolbar;
+ aOther.mCompositionSizeWithoutDynamicToolbar &&
+ mIsSoftwareKeyboardVisible == aOther.mIsSoftwareKeyboardVisible;
}
bool operator!=(const FrameMetrics& aOther) const {
@@ -438,6 +443,18 @@ struct FrameMetrics {
}
bool IsMinimalDisplayPort() const { return mMinimalDisplayPort; }
+ void SetIsSoftwareKeyboardVisible(bool aValue) {
+ mIsSoftwareKeyboardVisible = aValue;
+ }
+ bool IsSoftwareKeyboardVisible() const { return mIsSoftwareKeyboardVisible; }
+
+ void SetInteractiveWidget(dom::InteractiveWidget aInteractiveWidget) {
+ mInteractiveWidget = aInteractiveWidget;
+ }
+ dom::InteractiveWidget GetInteractiveWidget() const {
+ return mInteractiveWidget;
+ }
+
void SetVisualDestination(const CSSPoint& aVisualDestination) {
mVisualDestination = aVisualDestination;
}
@@ -668,6 +685,12 @@ struct FrameMetrics {
// mCompositionBounds.Size().
ParentLayerSize mCompositionSizeWithoutDynamicToolbar;
+ // The interactive-widget of the root-content document.
+ // This is only applicable to the root-content scroll frame, it's stored in
+ // APZTreeManager as APZTreeManager::mInteractiveWidget so that it should not
+ // be checked on AsyncPanZoomController::mScrollMetadata.
+ dom::InteractiveWidget mInteractiveWidget;
+
// Whether or not this is the root scroll frame for the root content document.
bool mIsRootContent : 1;
@@ -686,6 +709,12 @@ struct FrameMetrics {
// boundaries are used that could potentially expand the size.
bool mMinimalDisplayPort : 1;
+ // Whether the software keyboard is currently visible.
+ // This is only applicable to the root-content scroll frame, it's stored in
+ // APZTreeManager as APZTreeManager::mIsSoftwareKeyboardVisible so that it
+ // should not be checked on AsyncPanZoomController::mScrollMetadata.
+ bool mIsSoftwareKeyboardVisible : 1;
+
// WARNING!!!!
//
// When adding a new field:
@@ -763,8 +792,6 @@ struct ScrollMetadata {
: mScrollParentId(ScrollableLayerGuid::NULL_SCROLL_ID),
mLineScrollAmount(0, 0),
mPageScrollAmount(0, 0),
- mInteractiveWidget(
- dom::InteractiveWidgetUtils::DefaultInteractiveWidgetMode()),
mIsLayersIdRoot(false),
mIsAutoDirRootContentRTL(false),
mForceDisableApz(false),
@@ -773,8 +800,7 @@ struct ScrollMetadata {
mDidContentGetPainted(true),
mForceMousewheelAutodir(false),
mForceMousewheelAutodirHonourRoot(false),
- mIsPaginatedPresentation(false),
- mIsSoftwareKeyboardVisible(false) {}
+ mIsPaginatedPresentation(false) {}
bool operator==(const ScrollMetadata& aOther) const {
return mMetrics == aOther.mMetrics && mSnapInfo == aOther.mSnapInfo &&
@@ -782,7 +808,6 @@ struct ScrollMetadata {
// don't compare mContentDescription
mLineScrollAmount == aOther.mLineScrollAmount &&
mPageScrollAmount == aOther.mPageScrollAmount &&
- mInteractiveWidget == aOther.mInteractiveWidget &&
mIsLayersIdRoot == aOther.mIsLayersIdRoot &&
mIsAutoDirRootContentRTL == aOther.mIsAutoDirRootContentRTL &&
mForceDisableApz == aOther.mForceDisableApz &&
@@ -793,7 +818,6 @@ struct ScrollMetadata {
mForceMousewheelAutodirHonourRoot ==
aOther.mForceMousewheelAutodirHonourRoot &&
mIsPaginatedPresentation == aOther.mIsPaginatedPresentation &&
- mIsSoftwareKeyboardVisible == aOther.mIsSoftwareKeyboardVisible &&
mDisregardedDirection == aOther.mDisregardedDirection &&
mOverscrollBehavior == aOther.mOverscrollBehavior &&
mOverflow == aOther.mOverflow &&
@@ -875,18 +899,6 @@ struct ScrollMetadata {
}
bool IsPaginatedPresentation() const { return mIsPaginatedPresentation; }
- void SetIsSoftwareKeyboardVisible(bool aValue) {
- mIsSoftwareKeyboardVisible = aValue;
- }
- bool IsSoftwareKeyboardVisible() const { return mIsSoftwareKeyboardVisible; }
-
- void SetInteractiveWidget(dom::InteractiveWidget aInteractiveWidget) {
- mInteractiveWidget = aInteractiveWidget;
- }
- dom::InteractiveWidget GetInteractiveWidget() const {
- return mInteractiveWidget;
- }
-
bool DidContentGetPainted() const { return mDidContentGetPainted; }
private:
@@ -958,12 +970,6 @@ struct ScrollMetadata {
// The value of GetPageScrollAmount(), for scroll frames.
LayoutDeviceIntSize mPageScrollAmount;
- // The interactive-widget of the root-content document.
- // This is only applicable to the root-content scroll frame, it's stored in
- // APZTreeManager as APZTreeManager::mInteractiveWidget so that it should not
- // be checked on AsyncPanZoomController::mScrollMetadata.
- dom::InteractiveWidget mInteractiveWidget;
-
// Whether these framemetrics are for the root scroll frame (root element if
// we don't have a root scroll frame) for its layers id.
bool mIsLayersIdRoot : 1;
@@ -1013,12 +1019,6 @@ struct ScrollMetadata {
// to different transforms, which constrains the assumptions APZ can make.
bool mIsPaginatedPresentation : 1;
- // Whether the software keyboard is currently visible.
- // This is only applicable to the root-content scroll frame, it's stored in
- // APZTreeManager as APZTreeManager::mIsSoftwareKeyboardVisible so that it
- // should not be checked on AsyncPanZoomController::mScrollMetadata.
- bool mIsSoftwareKeyboardVisible : 1;
-
// The disregarded direction means the direction which is disregarded anyway,
// even if the scroll frame overflows in that direction and the direction is
// specified as scrollable. This could happen in some scenarios, for instance,
diff --git a/gfx/layers/apz/src/APZCTreeManager.cpp b/gfx/layers/apz/src/APZCTreeManager.cpp
@@ -519,9 +519,9 @@ std::vector<LayersId> APZCTreeManager::UpdateHitTestingTree(
mGeckoFixedLayerMargins =
aLayerMetrics.Metrics().GetFixedLayerMargins();
SetInteractiveWidgetMode(
- aLayerMetrics.Metadata().GetInteractiveWidget(), lock);
+ aLayerMetrics.Metrics().GetInteractiveWidget(), lock);
SetIsSoftwareKeyboardVisible(
- aLayerMetrics.Metadata().IsSoftwareKeyboardVisible(), lock);
+ aLayerMetrics.Metrics().IsSoftwareKeyboardVisible(), lock);
currentRootContentLayersId = layersId;
} else {
MOZ_ASSERT(aLayerMetrics.Metrics().GetFixedLayerMargins() ==
diff --git a/gfx/layers/apz/src/AsyncPanZoomController.cpp b/gfx/layers/apz/src/AsyncPanZoomController.cpp
@@ -5806,6 +5806,9 @@ void AsyncPanZoomController::NotifyLayersUpdated(
Metrics().SetHasNonZeroDisplayPortMargins(
aLayerMetrics.HasNonZeroDisplayPortMargins());
Metrics().SetMinimalDisplayPort(aLayerMetrics.IsMinimalDisplayPort());
+ Metrics().SetInteractiveWidget(aLayerMetrics.GetInteractiveWidget());
+ Metrics().SetIsSoftwareKeyboardVisible(
+ aLayerMetrics.IsSoftwareKeyboardVisible());
mScrollMetadata.SetForceDisableApz(aScrollMetadata.IsApzForceDisabled());
mScrollMetadata.SetIsRDMTouchSimulationActive(
aScrollMetadata.GetIsRDMTouchSimulationActive());
diff --git a/gfx/layers/ipc/LayersMessageUtils.h b/gfx/layers/ipc/LayersMessageUtils.h
@@ -302,10 +302,12 @@ struct ParamTraits<mozilla::layers::FrameMetrics>
WriteParam(aWriter, aParam.mVisualScrollUpdateType);
WriteParam(aWriter, aParam.mFixedLayerMargins);
WriteParam(aWriter, aParam.mCompositionSizeWithoutDynamicToolbar);
+ WriteParam(aWriter, aParam.mInteractiveWidget);
WriteParam(aWriter, aParam.mIsRootContent);
WriteParam(aWriter, aParam.mIsScrollInfoLayer);
WriteParam(aWriter, aParam.mHasNonZeroDisplayPortMargins);
WriteParam(aWriter, aParam.mMinimalDisplayPort);
+ WriteParam(aWriter, aParam.mIsSoftwareKeyboardVisible);
}
static bool Read(MessageReader* aReader, paramType* aResult) {
@@ -331,13 +333,16 @@ struct ParamTraits<mozilla::layers::FrameMetrics>
ReadParam(aReader, &aResult->mVisualScrollUpdateType) &&
ReadParam(aReader, &aResult->mFixedLayerMargins) &&
ReadParam(aReader, &aResult->mCompositionSizeWithoutDynamicToolbar) &&
+ ReadParam(aReader, &aResult->mInteractiveWidget) &&
ReadBoolForBitfield(aReader, aResult, ¶mType::SetIsRootContent) &&
ReadBoolForBitfield(aReader, aResult,
¶mType::SetIsScrollInfoLayer) &&
ReadBoolForBitfield(aReader, aResult,
¶mType::SetHasNonZeroDisplayPortMargins) &&
ReadBoolForBitfield(aReader, aResult,
- ¶mType::SetMinimalDisplayPort));
+ ¶mType::SetMinimalDisplayPort) &&
+ ReadBoolForBitfield(aReader, aResult,
+ ¶mType::SetIsSoftwareKeyboardVisible));
}
};
@@ -609,7 +614,6 @@ struct ParamTraits<mozilla::layers::ScrollMetadata>
WriteParam(aWriter, aParam.GetContentDescription());
WriteParam(aWriter, aParam.mLineScrollAmount);
WriteParam(aWriter, aParam.mPageScrollAmount);
- WriteParam(aWriter, aParam.mInteractiveWidget);
WriteParam(aWriter, aParam.mIsLayersIdRoot);
WriteParam(aWriter, aParam.mIsAutoDirRootContentRTL);
WriteParam(aWriter, aParam.mForceDisableApz);
@@ -619,7 +623,6 @@ struct ParamTraits<mozilla::layers::ScrollMetadata>
WriteParam(aWriter, aParam.mForceMousewheelAutodir);
WriteParam(aWriter, aParam.mForceMousewheelAutodirHonourRoot);
WriteParam(aWriter, aParam.mIsPaginatedPresentation);
- WriteParam(aWriter, aParam.mIsSoftwareKeyboardVisible);
WriteParam(aWriter, aParam.mDisregardedDirection);
WriteParam(aWriter, aParam.mOverscrollBehavior);
WriteParam(aWriter, aParam.mOverflow);
@@ -643,7 +646,6 @@ struct ParamTraits<mozilla::layers::ScrollMetadata>
ReadContentDescription(aReader, aResult) &&
ReadParam(aReader, &aResult->mLineScrollAmount) &&
ReadParam(aReader, &aResult->mPageScrollAmount) &&
- ReadParam(aReader, &aResult->mInteractiveWidget) &&
ReadBoolForBitfield(aReader, aResult,
¶mType::SetIsLayersIdRoot) &&
ReadBoolForBitfield(aReader, aResult,
@@ -663,8 +665,6 @@ struct ParamTraits<mozilla::layers::ScrollMetadata>
¶mType::SetForceMousewheelAutodirHonourRoot) &&
ReadBoolForBitfield(aReader, aResult,
¶mType::SetIsPaginatedPresentation) &&
- ReadBoolForBitfield(aReader, aResult,
- ¶mType::SetIsSoftwareKeyboardVisible) &&
ReadParam(aReader, &aResult->mDisregardedDirection) &&
ReadParam(aReader, &aResult->mOverscrollBehavior) &&
ReadParam(aReader, &aResult->mOverflow) &&
diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp
@@ -8759,9 +8759,9 @@ ScrollMetadata nsLayoutUtils::ComputeScrollMetadata(
}
}
- metadata.SetIsSoftwareKeyboardVisible(presContext->GetKeyboardHeight() >
- 0);
- metadata.SetInteractiveWidget(
+ metrics.SetIsSoftwareKeyboardVisible(presContext->GetKeyboardHeight() >
+ 0);
+ metrics.SetInteractiveWidget(
presContext->Document()->InteractiveWidget());
}