Bug 1878976 - Remove plugin-related code in EventStateManager; r=emilio

`nsIFrame::GetCursor()` can never return `Nothing()` after bug 1687239, which
removes `nsPluginFrame`. Therefore `mLastFrameConsumedSetCursor` in
`EventStateManager` can never be true.

Differential Revision: https://phabricator.services.mozilla.com/D200890
This commit is contained in:
Edgar Chen 2024-02-07 12:35:27 +00:00
Родитель 76733658aa
Коммит c185ccc69a
13 изменённых файлов: 24 добавлений и 40 удалений

Просмотреть файл

@ -4348,23 +4348,9 @@ void EventStateManager::UpdateCursor(nsPresContext* aPresContext,
// If not locked, look for correct cursor
nsPoint pt = nsLayoutUtils::GetEventCoordinatesRelativeTo(
aEvent, RelativeTo{aTargetFrame});
Maybe<nsIFrame::Cursor> framecursor = aTargetFrame->GetCursor(pt);
// Avoid setting cursor when the mouse is over a windowless plugin.
if (!framecursor) {
if (XRE_IsContentProcess()) {
mLastFrameConsumedSetCursor = true;
}
return;
}
// Make sure cursors get reset after the mouse leaves a
// windowless plugin frame.
if (mLastFrameConsumedSetCursor) {
ClearCachedWidgetCursor(aTargetFrame);
mLastFrameConsumedSetCursor = false;
}
const nsIFrame::Cursor framecursor = aTargetFrame->GetCursor(pt);
const CursorImage customCursor =
ComputeCustomCursor(aPresContext, aEvent, *aTargetFrame, *framecursor);
ComputeCustomCursor(aPresContext, aEvent, *aTargetFrame, framecursor);
// If the current cursor is from the same frame, and it is now
// loading some new image for the cursor, we should wait for a
@ -4375,7 +4361,7 @@ void EventStateManager::UpdateCursor(nsPresContext* aPresContext,
TimeDuration::FromMilliseconds(kCursorLoadingTimeout)) {
return;
}
cursor = framecursor->mCursor;
cursor = framecursor.mCursor;
container = std::move(customCursor.mContainer);
resolution = customCursor.mResolution;
hotspot = Some(customCursor.mHotspot);

Просмотреть файл

@ -1233,7 +1233,6 @@ class EventStateManager : public nsSupportsWeakReference, public nsIObserver {
// These variables are only relevant if we're the cursor-setting manager.
StyleCursorKind mLockCursor;
bool mLastFrameConsumedSetCursor = false;
bool mHidingCursorWhileTyping = false;
// Last mouse event screen point (in device pixel) when mouse was locked, used

Просмотреть файл

@ -45,7 +45,7 @@ class nsImageControlFrame final : public nsImageFrame,
}
#endif
Maybe<Cursor> GetCursor(const nsPoint&) final;
Cursor GetCursor(const nsPoint&) final;
// nsIFormContromFrame
void SetFocus(bool aOn, bool aRepaint) final;
@ -137,12 +137,12 @@ nsresult nsImageControlFrame::HandleEvent(nsPresContext* aPresContext,
void nsImageControlFrame::SetFocus(bool aOn, bool aRepaint) {}
Maybe<nsIFrame::Cursor> nsImageControlFrame::GetCursor(const nsPoint&) {
nsIFrame::Cursor nsImageControlFrame::GetCursor(const nsPoint&) {
StyleCursorKind kind = StyleUI()->Cursor().keyword;
if (kind == StyleCursorKind::Auto) {
kind = StyleCursorKind::Pointer;
}
return Some(Cursor{kind, AllowCustomCursorImage::Yes});
return Cursor{kind, AllowCustomCursorImage::Yes};
}
nsresult nsImageControlFrame::SetFormProperty(nsAtom* aName,

Просмотреть файл

@ -89,7 +89,7 @@ class nsHTMLFramesetBorderFrame final : public nsLeafFrame {
WidgetGUIEvent* aEvent,
nsEventStatus* aEventStatus) override;
Maybe<Cursor> GetCursor(const nsPoint&) override;
Cursor GetCursor(const nsPoint&) override;
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsDisplayListSet& aLists) override;
@ -630,13 +630,13 @@ nsresult nsHTMLFramesetFrame::HandleEvent(nsPresContext* aPresContext,
return NS_OK;
}
Maybe<nsIFrame::Cursor> nsHTMLFramesetFrame::GetCursor(const nsPoint&) {
nsIFrame::Cursor nsHTMLFramesetFrame::GetCursor(const nsPoint&) {
auto kind = StyleCursorKind::Default;
if (mDragger) {
kind = mDragger->mVertical ? StyleCursorKind::EwResize
: StyleCursorKind::NsResize;
}
return Some(Cursor{kind, AllowCustomCursorImage::No});
return Cursor{kind, AllowCustomCursorImage::No};
}
void nsHTMLFramesetFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
@ -1454,12 +1454,12 @@ nsresult nsHTMLFramesetBorderFrame::HandleEvent(nsPresContext* aPresContext,
return NS_OK;
}
Maybe<nsIFrame::Cursor> nsHTMLFramesetBorderFrame::GetCursor(const nsPoint&) {
nsIFrame::Cursor nsHTMLFramesetBorderFrame::GetCursor(const nsPoint&) {
auto kind = StyleCursorKind::Default;
if (mCanResize) {
kind = mVertical ? StyleCursorKind::EwResize : StyleCursorKind::NsResize;
}
return Some(Cursor{kind, AllowCustomCursorImage::No});
return Cursor{kind, AllowCustomCursorImage::No};
}
#ifdef DEBUG_FRAME_DUMP

Просмотреть файл

@ -88,7 +88,7 @@ class nsHTMLFramesetFrame final : public nsContainerFrame {
mozilla::WidgetGUIEvent* aEvent,
nsEventStatus* aEventStatus) override;
mozilla::Maybe<Cursor> GetCursor(const nsPoint&) override;
Cursor GetCursor(const nsPoint&) override;
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsDisplayListSet& aLists) override;

Просмотреть файл

@ -5890,7 +5890,7 @@ StyleTouchAction nsIFrame::UsedTouchAction() const {
return disp.mTouchAction;
}
Maybe<nsIFrame::Cursor> nsIFrame::GetCursor(const nsPoint&) {
nsIFrame::Cursor nsIFrame::GetCursor(const nsPoint&) {
StyleCursorKind kind = StyleUI()->Cursor().keyword;
if (kind == StyleCursorKind::Auto) {
// If this is editable, I-beam cursor is better for most elements.
@ -5903,7 +5903,7 @@ Maybe<nsIFrame::Cursor> nsIFrame::GetCursor(const nsPoint&) {
kind = StyleCursorKind::VerticalText;
}
return Some(Cursor{kind, AllowCustomCursorImage::Yes});
return Cursor{kind, AllowCustomCursorImage::Yes};
}
// Resize and incremental reflow

Просмотреть файл

@ -2338,7 +2338,7 @@ class nsIFrame : public nsQueryFrame {
/**
* Get the cursor for a given frame.
*/
virtual Maybe<Cursor> GetCursor(const nsPoint&);
virtual Cursor GetCursor(const nsPoint&);
/**
* Get a point (in the frame's coordinate space) given an offset into

Просмотреть файл

@ -2773,7 +2773,7 @@ nsresult nsImageFrame::HandleEvent(nsPresContext* aPresContext,
aEventStatus);
}
Maybe<nsIFrame::Cursor> nsImageFrame::GetCursor(const nsPoint& aPoint) {
nsIFrame::Cursor nsImageFrame::GetCursor(const nsPoint& aPoint) {
nsImageMap* map = GetImageMap();
if (!map) {
return nsIFrame::GetCursor(aPoint);
@ -2796,7 +2796,7 @@ Maybe<nsIFrame::Cursor> nsImageFrame::GetCursor(const nsPoint& aPoint) {
if (kind == StyleCursorKind::Auto) {
kind = StyleCursorKind::Default;
}
return Some(Cursor{kind, AllowCustomCursorImage::Yes, std::move(areaStyle)});
return Cursor{kind, AllowCustomCursorImage::Yes, std::move(areaStyle)};
}
nsresult nsImageFrame::AttributeChanged(int32_t aNameSpaceID,

Просмотреть файл

@ -90,7 +90,7 @@ class nsImageFrame : public nsAtomicContainerFrame, public nsIReflowCallback {
nsIContent** aContent) final;
nsresult HandleEvent(nsPresContext*, mozilla::WidgetGUIEvent*,
nsEventStatus*) override;
mozilla::Maybe<Cursor> GetCursor(const nsPoint&) override;
Cursor GetCursor(const nsPoint&) override;
nsresult AttributeChanged(int32_t aNameSpaceID, nsAtom* aAttribute,
int32_t aModType) final;

Просмотреть файл

@ -4368,7 +4368,7 @@ NS_IMPL_FRAMEARENA_HELPERS(nsContinuingTextFrame)
nsTextFrame::~nsTextFrame() = default;
Maybe<nsIFrame::Cursor> nsTextFrame::GetCursor(const nsPoint& aPoint) {
nsIFrame::Cursor nsTextFrame::GetCursor(const nsPoint& aPoint) {
StyleCursorKind kind = StyleUI()->Cursor().keyword;
if (kind == StyleCursorKind::Auto) {
if (!IsSelectable(nullptr)) {
@ -4378,7 +4378,7 @@ Maybe<nsIFrame::Cursor> nsTextFrame::GetCursor(const nsPoint& aPoint) {
: StyleCursorKind::Text;
}
}
return Some(Cursor{kind, AllowCustomCursorImage::Yes});
return Cursor{kind, AllowCustomCursorImage::Yes};
}
nsTextFrame* nsTextFrame::LastInFlow() const {

Просмотреть файл

@ -219,7 +219,7 @@ class nsTextFrame : public nsIFrame {
void Destroy(DestroyContext&) override;
mozilla::Maybe<Cursor> GetCursor(const nsPoint&) final;
Cursor GetCursor(const nsPoint&) final;
nsresult CharacterDataChanged(const CharacterDataChangeInfo&) final;

Просмотреть файл

@ -2220,7 +2220,7 @@ nscoord nsTreeBodyFrame::CalcHorzWidth(const ScrollParts& aParts) {
return width;
}
Maybe<nsIFrame::Cursor> nsTreeBodyFrame::GetCursor(const nsPoint& aPoint) {
nsIFrame::Cursor nsTreeBodyFrame::GetCursor(const nsPoint& aPoint) {
// Check the GetScriptHandlingObject so we don't end up running code when
// the document is a zombie.
bool dummy;
@ -2237,8 +2237,7 @@ Maybe<nsIFrame::Cursor> nsTreeBodyFrame::GetCursor(const nsPoint& aPoint) {
if (kind == StyleCursorKind::Auto) {
kind = StyleCursorKind::Default;
}
return Some(
Cursor{kind, AllowCustomCursorImage::Yes, std::move(childContext)});
return Cursor{kind, AllowCustomCursorImage::Yes, std::move(childContext)};
}
}
return SimpleXULLeafFrame::GetCursor(aPoint);

Просмотреть файл

@ -159,7 +159,7 @@ class nsTreeBodyFrame final : public mozilla::SimpleXULLeafFrame,
nsIFrame* aPrevInFlow) override;
void Destroy(DestroyContext&) override;
mozilla::Maybe<Cursor> GetCursor(const nsPoint&) override;
Cursor GetCursor(const nsPoint&) override;
nsresult HandleEvent(nsPresContext* aPresContext,
mozilla::WidgetGUIEvent* aEvent,