2017-10-27 20:33:53 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
2012-05-21 15:12:37 +04:00
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
2017-08-17 00:10:56 +03:00
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2011-09-09 23:50:21 +04:00
|
|
|
|
|
|
|
/* a presentation of a document, part 2 */
|
|
|
|
|
2016-11-30 06:14:28 +03:00
|
|
|
#ifndef mozilla_PresShell_h
|
|
|
|
#define mozilla_PresShell_h
|
2011-09-09 23:50:21 +04:00
|
|
|
|
2012-06-19 07:26:34 +04:00
|
|
|
#include "mozilla/Attributes.h"
|
2013-10-22 17:27:34 +04:00
|
|
|
#include "mozilla/EventForwards.h"
|
Bug 1514940 - part 1: Forcibly disable new keyCode/charCode value of keypress events if the document is Confluence r=smaug,Ehsan,kmag
Old Confluence does not aware of conflated model keypress event (see UI Events
spec, https://w3c.github.io/uievents/#determine-keypress-keyCode).
Additionally, Confluence can be hosted with any domains. Therefore, we cannot
use blacklist to disable the conflated model keypress event only on it.
This patch checks whether current or parent document is Confluence with JS
module, called KeyPressEventModelCheckerChild. For kicking this module,
nsHTMLDocument dispatches an custom event, CheckKeyPressEventModel, when it
becomes editable only first time. Finally, if it's a Confluence instance, the
module let PresShell know that we need to use split model keypress event in it.
Differential Revision: https://phabricator.services.mozilla.com/D17907
--HG--
extra : moz-landing-system : lando
2019-02-05 14:35:43 +03:00
|
|
|
#include "mozilla/dom/HTMLDocumentBinding.h"
|
2017-07-13 21:00:21 +03:00
|
|
|
#include "mozilla/layers/FocusTarget.h"
|
2013-06-23 16:03:39 +04:00
|
|
|
#include "mozilla/MemoryReporting.h"
|
2019-03-26 02:17:20 +03:00
|
|
|
#include "mozilla/ScrollTypes.h"
|
2018-03-29 14:15:46 +03:00
|
|
|
#include "mozilla/ServoStyleSet.h"
|
2019-03-04 09:11:41 +03:00
|
|
|
#include "mozilla/StaticPtr.h"
|
2016-01-21 00:24:28 +03:00
|
|
|
#include "mozilla/UniquePtr.h"
|
2016-11-30 06:14:28 +03:00
|
|
|
#include "nsContentUtils.h" // For AddScriptBlocker().
|
|
|
|
#include "nsCRT.h"
|
|
|
|
#include "nsIObserver.h"
|
|
|
|
#include "nsIPresShell.h"
|
|
|
|
#include "nsISelectionController.h"
|
|
|
|
#include "nsIWidget.h"
|
|
|
|
#include "nsPresContext.h"
|
|
|
|
#include "nsRefreshDriver.h"
|
|
|
|
#include "nsStubDocumentObserver.h"
|
|
|
|
#include "nsThreadUtils.h"
|
|
|
|
#include "nsWeakReference.h"
|
|
|
|
#include "TouchManager.h"
|
2015-06-17 19:32:42 +03:00
|
|
|
#include "ZoomConstraintsClient.h"
|
2011-09-09 23:50:21 +04:00
|
|
|
|
2016-08-03 19:00:22 +03:00
|
|
|
class nsIDocShell;
|
2012-01-10 18:19:54 +04:00
|
|
|
class nsRange;
|
2011-09-09 23:50:21 +04:00
|
|
|
|
|
|
|
struct RangePaintInfo;
|
|
|
|
|
|
|
|
class nsPresShellEventCB;
|
2017-11-26 16:38:55 +03:00
|
|
|
class AutoPointerEventTargetUpdater;
|
2019-04-05 01:09:55 +03:00
|
|
|
class MobileViewportManager;
|
2011-09-09 23:50:21 +04:00
|
|
|
|
2014-06-20 14:32:49 +04:00
|
|
|
namespace mozilla {
|
2016-03-19 04:38:57 +03:00
|
|
|
|
2017-04-17 19:01:37 +03:00
|
|
|
namespace dom {
|
|
|
|
class Element;
|
2017-08-02 02:50:50 +03:00
|
|
|
class Selection;
|
2017-04-17 19:01:37 +03:00
|
|
|
} // namespace dom
|
|
|
|
|
2014-11-03 10:05:38 +03:00
|
|
|
class EventDispatchingCallback;
|
2019-04-05 01:11:40 +03:00
|
|
|
class GeckoMVMContext;
|
2018-12-11 23:31:09 +03:00
|
|
|
class OverflowChangedTracker;
|
2016-03-19 04:38:57 +03:00
|
|
|
|
2016-03-26 00:49:43 +03:00
|
|
|
// A set type for tracking visible frames, for use by the visibility code in
|
|
|
|
// PresShell. The set contains nsIFrame* pointers.
|
|
|
|
typedef nsTHashtable<nsPtrHashKey<nsIFrame>> VisibleFrames;
|
|
|
|
|
2016-11-23 00:54:40 +03:00
|
|
|
// This is actually pref-controlled, but we use this value if we fail
|
2012-05-16 21:32:40 +04:00
|
|
|
// to get the pref for any reason.
|
2019-03-25 15:44:56 +03:00
|
|
|
#define PAINTLOCK_EVENT_DELAY 5
|
2012-05-16 21:32:40 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
class PresShell final : public nsIPresShell,
|
2015-03-27 21:52:19 +03:00
|
|
|
public nsISelectionController,
|
|
|
|
public nsIObserver,
|
|
|
|
public nsSupportsWeakReference {
|
2018-03-07 14:13:17 +03:00
|
|
|
typedef layers::FocusTarget FocusTarget;
|
2019-04-03 10:02:00 +03:00
|
|
|
typedef dom::Element Element;
|
2017-07-13 21:00:21 +03:00
|
|
|
|
2011-09-09 23:50:21 +04:00
|
|
|
public:
|
|
|
|
PresShell();
|
|
|
|
|
|
|
|
// nsISupports
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
|
2016-08-03 19:00:22 +03:00
|
|
|
static bool AccessibleCaretEnabled(nsIDocShell* aDocShell);
|
2015-04-24 03:08:00 +03:00
|
|
|
|
2019-04-03 10:02:00 +03:00
|
|
|
void Init(Document*, nsPresContext*, nsViewManager*);
|
2018-03-07 14:13:17 +03:00
|
|
|
void Destroy() override;
|
2011-09-09 23:50:21 +04:00
|
|
|
|
2018-05-08 20:52:36 +03:00
|
|
|
NS_IMETHOD GetSelectionFromScript(RawSelectionType aRawSelectionType,
|
|
|
|
dom::Selection** aSelection) override;
|
|
|
|
dom::Selection* GetSelection(RawSelectionType aRawSelectionType) override;
|
2018-03-07 14:13:17 +03:00
|
|
|
|
|
|
|
dom::Selection* GetCurrentSelection(SelectionType aSelectionType) override;
|
|
|
|
|
|
|
|
already_AddRefed<nsISelectionController>
|
|
|
|
GetSelectionControllerForFocusedContent(
|
|
|
|
nsIContent** aFocusedContent = nullptr) override;
|
2011-09-09 23:50:21 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
NS_IMETHOD SetDisplaySelection(int16_t aToggle) override;
|
|
|
|
NS_IMETHOD GetDisplaySelection(int16_t* aToggle) override;
|
2016-06-07 16:42:06 +03:00
|
|
|
NS_IMETHOD ScrollSelectionIntoView(RawSelectionType aRawSelectionType,
|
|
|
|
SelectionRegion aRegion,
|
2015-03-21 19:28:04 +03:00
|
|
|
int16_t aFlags) override;
|
2016-06-07 16:42:06 +03:00
|
|
|
NS_IMETHOD RepaintSelection(RawSelectionType aRawSelectionType) override;
|
2015-03-21 19:28:04 +03:00
|
|
|
|
2018-03-07 14:13:17 +03:00
|
|
|
nsresult Initialize() override;
|
|
|
|
nsresult ResizeReflow(
|
|
|
|
nscoord aWidth, nscoord aHeight, nscoord aOldWidth = 0,
|
|
|
|
nscoord aOldHeight = 0,
|
|
|
|
ResizeReflowOptions aOptions = ResizeReflowOptions::eBSizeExact) override;
|
|
|
|
nsresult ResizeReflowIgnoreOverride(
|
|
|
|
nscoord aWidth, nscoord aHeight, nscoord aOldWidth, nscoord aOldHeight,
|
|
|
|
ResizeReflowOptions aOptions = ResizeReflowOptions::eBSizeExact) override;
|
2019-01-26 08:27:09 +03:00
|
|
|
|
2018-03-07 14:13:17 +03:00
|
|
|
void DoFlushPendingNotifications(FlushType aType) override;
|
|
|
|
void DoFlushPendingNotifications(ChangesToFlush aType) override;
|
2011-09-09 23:50:21 +04:00
|
|
|
|
2018-03-07 14:13:17 +03:00
|
|
|
nsRectVisibility GetRectVisibility(nsIFrame* aFrame, const nsRect& aRect,
|
2015-03-21 19:28:04 +03:00
|
|
|
nscoord aMinTwips) const override;
|
2011-09-09 23:50:21 +04:00
|
|
|
|
2018-03-07 14:13:17 +03:00
|
|
|
nsresult CaptureHistoryState(
|
|
|
|
nsILayoutHistoryState** aLayoutHistoryState) override;
|
2011-09-09 23:50:21 +04:00
|
|
|
|
2018-03-07 14:13:17 +03:00
|
|
|
void UnsuppressPainting() override;
|
2011-09-09 23:50:21 +04:00
|
|
|
|
2018-04-30 18:50:03 +03:00
|
|
|
nsresult GetAgentStyleSheets(nsTArray<RefPtr<StyleSheet>>& aSheets) override;
|
2018-03-07 14:13:17 +03:00
|
|
|
nsresult SetAgentStyleSheets(
|
2018-04-30 18:50:03 +03:00
|
|
|
const nsTArray<RefPtr<StyleSheet>>& aSheets) override;
|
2011-09-09 23:50:21 +04:00
|
|
|
|
2018-03-07 14:13:17 +03:00
|
|
|
nsresult AddOverrideStyleSheet(StyleSheet* aSheet) override;
|
|
|
|
nsresult RemoveOverrideStyleSheet(StyleSheet* aSheet) override;
|
2011-09-09 23:50:21 +04:00
|
|
|
|
Bug 1466208 - part 1: Create stack class to handle events in PresShell r=smaug
PresShell::HandleEvent() and PresShell::HandleEventInternal() are too big.
Additionally, we have a lot of methods used only by them. So, if we'll
split those big methods, PresShell will have a lot of small methods which
are not grouped as a part of event handling. That's too bad because some
of them may depend on the calling order, etc.
So, for grouping them, PresShell should create a stack class instance to handle
each event. Then, we can store shared information in it only while we're
handling an event.
This patch creates PresShell::EventHandler and PresShell methods become
wrappers of the stack class, but this patch does not change any logic in the
code, i.e., just reorganizing existing methods.
Note that HandleEventWithTarget() and HandleEventInternal() need to take
WidgetEvent rather than WidgetGUIEvent. Additionally, some other methods
require WidgetGUIEvent to refer WidgetGUIEvent::mWidget. Therefore, this
patch does not make the new class store the event as a member.
Differential Revision: https://phabricator.services.mozilla.com/D16951
--HG--
extra : moz-landing-system : lando
2019-01-29 09:04:05 +03:00
|
|
|
MOZ_CAN_RUN_SCRIPT_BOUNDARY
|
2018-03-07 14:13:17 +03:00
|
|
|
nsresult HandleEventWithTarget(
|
2013-10-02 07:46:04 +04:00
|
|
|
WidgetEvent* aEvent, nsIFrame* aFrame, nsIContent* aContent,
|
Bug 1466208 - part 1: Create stack class to handle events in PresShell r=smaug
PresShell::HandleEvent() and PresShell::HandleEventInternal() are too big.
Additionally, we have a lot of methods used only by them. So, if we'll
split those big methods, PresShell will have a lot of small methods which
are not grouped as a part of event handling. That's too bad because some
of them may depend on the calling order, etc.
So, for grouping them, PresShell should create a stack class instance to handle
each event. Then, we can store shared information in it only while we're
handling an event.
This patch creates PresShell::EventHandler and PresShell methods become
wrappers of the stack class, but this patch does not change any logic in the
code, i.e., just reorganizing existing methods.
Note that HandleEventWithTarget() and HandleEventInternal() need to take
WidgetEvent rather than WidgetGUIEvent. Additionally, some other methods
require WidgetGUIEvent to refer WidgetGUIEvent::mWidget. Therefore, this
patch does not make the new class store the event as a member.
Differential Revision: https://phabricator.services.mozilla.com/D16951
--HG--
extra : moz-landing-system : lando
2019-01-29 09:04:05 +03:00
|
|
|
nsEventStatus* aEventStatus, bool aIsHandlingNativeEvent = false,
|
2018-03-29 19:22:59 +03:00
|
|
|
nsIContent** aTargetContent = nullptr,
|
Bug 1466208 - part 1: Create stack class to handle events in PresShell r=smaug
PresShell::HandleEvent() and PresShell::HandleEventInternal() are too big.
Additionally, we have a lot of methods used only by them. So, if we'll
split those big methods, PresShell will have a lot of small methods which
are not grouped as a part of event handling. That's too bad because some
of them may depend on the calling order, etc.
So, for grouping them, PresShell should create a stack class instance to handle
each event. Then, we can store shared information in it only while we're
handling an event.
This patch creates PresShell::EventHandler and PresShell methods become
wrappers of the stack class, but this patch does not change any logic in the
code, i.e., just reorganizing existing methods.
Note that HandleEventWithTarget() and HandleEventInternal() need to take
WidgetEvent rather than WidgetGUIEvent. Additionally, some other methods
require WidgetGUIEvent to refer WidgetGUIEvent::mWidget. Therefore, this
patch does not make the new class store the event as a member.
Differential Revision: https://phabricator.services.mozilla.com/D16951
--HG--
extra : moz-landing-system : lando
2019-01-29 09:04:05 +03:00
|
|
|
nsIContent* aOverrideClickTarget = nullptr) override {
|
|
|
|
MOZ_ASSERT(aEvent);
|
|
|
|
EventHandler eventHandler(*this);
|
|
|
|
return eventHandler.HandleEventWithTarget(
|
|
|
|
aEvent, aFrame, aContent, aEventStatus, aIsHandlingNativeEvent,
|
|
|
|
aTargetContent, aOverrideClickTarget);
|
|
|
|
}
|
2011-09-09 23:50:21 +04:00
|
|
|
|
2018-03-07 14:13:17 +03:00
|
|
|
void ReconstructFrames(void) override;
|
|
|
|
void Freeze() override;
|
|
|
|
void Thaw() override;
|
|
|
|
void FireOrClearDelayedEvents(bool aFireEvents) override;
|
2011-09-09 23:50:21 +04:00
|
|
|
|
2018-03-07 14:13:17 +03:00
|
|
|
nsresult RenderDocument(const nsRect& aRect, uint32_t aFlags,
|
|
|
|
nscolor aBackgroundColor,
|
|
|
|
gfxContext* aThebesContext) override;
|
2011-09-09 23:50:21 +04:00
|
|
|
|
2018-03-07 14:13:17 +03:00
|
|
|
already_AddRefed<SourceSurface> RenderNode(nsINode* aNode,
|
2018-08-07 16:32:08 +03:00
|
|
|
const Maybe<CSSIntRegion>& aRegion,
|
2018-03-07 14:13:17 +03:00
|
|
|
const LayoutDeviceIntPoint aPoint,
|
|
|
|
LayoutDeviceIntRect* aScreenRect,
|
2015-07-11 19:15:19 +03:00
|
|
|
uint32_t aFlags) override;
|
2011-09-09 23:50:21 +04:00
|
|
|
|
2018-03-07 14:13:17 +03:00
|
|
|
already_AddRefed<SourceSurface> RenderSelection(
|
|
|
|
dom::Selection* aSelection, const LayoutDeviceIntPoint aPoint,
|
|
|
|
LayoutDeviceIntRect* aScreenRect, uint32_t aFlags) override;
|
2011-09-09 23:50:21 +04:00
|
|
|
|
2018-03-07 14:13:17 +03:00
|
|
|
already_AddRefed<nsPIDOMWindowOuter> GetRootWindow() override;
|
2011-09-09 23:50:21 +04:00
|
|
|
|
2018-03-07 14:13:17 +03:00
|
|
|
already_AddRefed<nsPIDOMWindowOuter> GetFocusedDOMWindowInOurWindow()
|
|
|
|
override;
|
2017-06-06 03:12:22 +03:00
|
|
|
|
2018-03-07 14:13:17 +03:00
|
|
|
LayerManager* GetLayerManager() override;
|
2011-09-09 23:50:21 +04:00
|
|
|
|
2018-03-07 14:13:17 +03:00
|
|
|
bool AsyncPanZoomEnabled() override;
|
2015-06-04 23:51:10 +03:00
|
|
|
|
2018-03-07 14:13:17 +03:00
|
|
|
void SetIgnoreViewportScrolling(bool aIgnore) override;
|
2011-09-09 23:50:21 +04:00
|
|
|
|
2018-12-30 05:16:42 +03:00
|
|
|
nsresult SetResolutionAndScaleTo(float aResolution,
|
|
|
|
ChangeOrigin aOrigin) override;
|
2018-03-07 14:13:17 +03:00
|
|
|
float GetCumulativeResolution() override;
|
|
|
|
float GetCumulativeNonRootScaleResolution() override;
|
|
|
|
void SetRestoreResolution(float aResolution,
|
|
|
|
LayoutDeviceIntSize aDisplaySize) override;
|
2011-09-09 23:50:21 +04:00
|
|
|
|
2019-03-29 18:12:47 +03:00
|
|
|
// Widget notificiations
|
|
|
|
void WindowSizeMoveDone() override;
|
|
|
|
void SysColorChanged() override { mPresContext->SysColorChanged(); }
|
|
|
|
void ThemeChanged() override { mPresContext->ThemeChanged(); }
|
|
|
|
void BackingScaleFactorChanged() override {
|
|
|
|
mPresContext->UIResolutionChangedSync();
|
|
|
|
}
|
|
|
|
|
2019-04-03 15:40:26 +03:00
|
|
|
void SynthesizeMouseMove(bool aFromScroll) override;
|
|
|
|
|
2019-04-06 09:02:28 +03:00
|
|
|
Document* GetPrimaryContentDocument() override;
|
|
|
|
|
2011-09-09 23:50:21 +04:00
|
|
|
// nsIViewObserver interface
|
|
|
|
|
2018-03-07 14:13:17 +03:00
|
|
|
void Paint(nsView* aViewToPaint, const nsRegion& aDirtyRegion,
|
|
|
|
uint32_t aFlags) override;
|
2019-03-13 13:32:36 +03:00
|
|
|
MOZ_CAN_RUN_SCRIPT nsresult HandleEvent(nsIFrame* aFrameForPresShell,
|
2018-01-29 22:35:17 +03:00
|
|
|
WidgetGUIEvent* aEvent,
|
|
|
|
bool aDontRetargetEvents,
|
|
|
|
nsEventStatus* aEventStatus) override;
|
2018-03-07 14:13:17 +03:00
|
|
|
nsresult HandleDOMEventWithTarget(nsIContent* aTargetContent,
|
|
|
|
WidgetEvent* aEvent,
|
|
|
|
nsEventStatus* aStatus) override;
|
|
|
|
nsresult HandleDOMEventWithTarget(nsIContent* aTargetContent,
|
2018-04-20 19:53:16 +03:00
|
|
|
dom::Event* aEvent,
|
2018-03-07 14:13:17 +03:00
|
|
|
nsEventStatus* aStatus) override;
|
|
|
|
bool ShouldIgnoreInvalidation() override;
|
|
|
|
void WillPaint() override;
|
|
|
|
void WillPaintWindow() override;
|
|
|
|
void DidPaintWindow() override;
|
|
|
|
void ScheduleViewManagerFlush(PaintType aType = PAINT_DEFAULT) override;
|
|
|
|
void ClearMouseCaptureOnView(nsView* aView) override;
|
|
|
|
bool IsVisible() override;
|
2018-06-26 00:42:25 +03:00
|
|
|
void SuppressDisplayport(bool aEnabled) override;
|
|
|
|
void RespectDisplayportSuppression(bool aEnabled) override;
|
|
|
|
bool IsDisplayportSuppressed() override;
|
2018-03-07 14:13:17 +03:00
|
|
|
|
2011-09-09 23:50:21 +04:00
|
|
|
// caret handling
|
2015-03-21 19:28:04 +03:00
|
|
|
NS_IMETHOD SetCaretEnabled(bool aInEnable) override;
|
|
|
|
NS_IMETHOD SetCaretReadOnly(bool aReadOnly) override;
|
|
|
|
NS_IMETHOD GetCaretEnabled(bool* aOutEnabled) override;
|
|
|
|
NS_IMETHOD SetCaretVisibilityDuringSelection(bool aVisibility) override;
|
|
|
|
NS_IMETHOD GetCaretVisible(bool* _retval) override;
|
|
|
|
|
|
|
|
NS_IMETHOD SetSelectionFlags(int16_t aInEnable) override;
|
|
|
|
NS_IMETHOD GetSelectionFlags(int16_t* aOutEnable) override;
|
2011-09-09 23:50:21 +04:00
|
|
|
|
2019-04-03 15:40:26 +03:00
|
|
|
using nsIPresShell::GetSelectionFlags;
|
|
|
|
|
2011-09-09 23:50:21 +04:00
|
|
|
// nsISelectionController
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
NS_IMETHOD PhysicalMove(int16_t aDirection, int16_t aAmount,
|
|
|
|
bool aExtend) override;
|
|
|
|
NS_IMETHOD CharacterMove(bool aForward, bool aExtend) override;
|
|
|
|
NS_IMETHOD CharacterExtendForDelete() override;
|
|
|
|
NS_IMETHOD CharacterExtendForBackspace() override;
|
|
|
|
NS_IMETHOD WordMove(bool aForward, bool aExtend) override;
|
|
|
|
NS_IMETHOD WordExtendForDelete(bool aForward) override;
|
|
|
|
NS_IMETHOD LineMove(bool aForward, bool aExtend) override;
|
|
|
|
NS_IMETHOD IntraLineMove(bool aForward, bool aExtend) override;
|
Bug 1482425 - PresShell::PageMove() should use different rules to look for a container element for aExtend value r=smaug
PresShell::PageMove() climbs up to parent document when there is no scrollable
parent in current document. However, if aExtend is true, it should expand
Selection in the document itself. Therefore, it needs different rules to
look for container of expanding Selection from scrollable element to scroll.
Additionally, old rules (i.e., before the fix of bug 1369072 which caused
this regression) were also buggy. It used parent scrollable element or
root scrollable element simply. Therefore, if found scrollable element is
ancestor of selection limiter, it didn't work as expected.
This patch creates nsFrameSelection::GetFrameToPageSelect() to retrieve
per-page selection container element with the following rules:
- look for a scrollable element in selection limiter.
- if there is no scrollable element, use selection limiter.
- if there is no selection limiter, use the root frame.
So, nsFrameSelection::CommonPageMove() should take nsIFrame rather than
nsIScrollableFrame since container of per-page selection may be used in
non-scrollable contenteditable element. If it's called with non-scrollable
frame, it needs to compute the expanding range with the frame size.
Differential Revision: https://phabricator.services.mozilla.com/D8954
--HG--
extra : moz-landing-system : lando
2018-10-18 07:42:53 +03:00
|
|
|
MOZ_CAN_RUN_SCRIPT
|
2015-03-21 19:28:04 +03:00
|
|
|
NS_IMETHOD PageMove(bool aForward, bool aExtend) override;
|
|
|
|
NS_IMETHOD ScrollPage(bool aForward) override;
|
|
|
|
NS_IMETHOD ScrollLine(bool aForward) override;
|
|
|
|
NS_IMETHOD ScrollCharacter(bool aRight) override;
|
|
|
|
NS_IMETHOD CompleteScroll(bool aForward) override;
|
|
|
|
NS_IMETHOD CompleteMove(bool aForward, bool aExtend) override;
|
|
|
|
NS_IMETHOD SelectAll() override;
|
2018-05-30 05:58:48 +03:00
|
|
|
NS_IMETHOD CheckVisibility(nsINode* node, int16_t startOffset,
|
|
|
|
int16_t EndOffset, bool* _retval) override;
|
2018-03-07 14:13:17 +03:00
|
|
|
nsresult CheckVisibilityContent(nsIContent* aNode, int16_t aStartOffset,
|
|
|
|
int16_t aEndOffset, bool* aRetval) override;
|
2011-09-09 23:50:21 +04:00
|
|
|
|
|
|
|
// nsIDocumentObserver
|
|
|
|
NS_DECL_NSIDOCUMENTOBSERVER_BEGINLOAD
|
|
|
|
NS_DECL_NSIDOCUMENTOBSERVER_ENDLOAD
|
|
|
|
NS_DECL_NSIDOCUMENTOBSERVER_CONTENTSTATECHANGED
|
|
|
|
NS_DECL_NSIDOCUMENTOBSERVER_DOCUMENTSTATESCHANGED
|
|
|
|
|
|
|
|
// nsIMutationObserver
|
|
|
|
NS_DECL_NSIMUTATIONOBSERVER_CHARACTERDATACHANGED
|
|
|
|
NS_DECL_NSIMUTATIONOBSERVER_ATTRIBUTEWILLCHANGE
|
|
|
|
NS_DECL_NSIMUTATIONOBSERVER_ATTRIBUTECHANGED
|
|
|
|
NS_DECL_NSIMUTATIONOBSERVER_CONTENTAPPENDED
|
|
|
|
NS_DECL_NSIMUTATIONOBSERVER_CONTENTINSERTED
|
|
|
|
NS_DECL_NSIMUTATIONOBSERVER_CONTENTREMOVED
|
|
|
|
|
|
|
|
NS_DECL_NSIOBSERVER
|
|
|
|
|
|
|
|
#ifdef MOZ_REFLOW_PERF
|
2018-03-07 14:13:17 +03:00
|
|
|
void DumpReflows() override;
|
|
|
|
void CountReflows(const char* aName, nsIFrame* aFrame) override;
|
|
|
|
void PaintCount(const char* aName, gfxContext* aRenderingContext,
|
|
|
|
nsPresContext* aPresContext, nsIFrame* aFrame,
|
|
|
|
const nsPoint& aOffset, uint32_t aColor) override;
|
|
|
|
void SetPaintFrameCount(bool aOn) override;
|
|
|
|
bool IsPaintingFrameCounts() override;
|
2011-09-09 23:50:21 +04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef DEBUG
|
2018-03-22 21:20:41 +03:00
|
|
|
void ListComputedStyles(FILE* out, int32_t aIndent = 0) override;
|
2011-09-09 23:50:21 +04:00
|
|
|
|
2018-03-07 14:13:17 +03:00
|
|
|
void ListStyleSheets(FILE* out, int32_t aIndent = 0) override;
|
2011-09-09 23:50:21 +04:00
|
|
|
#endif
|
|
|
|
|
2018-03-07 14:13:17 +03:00
|
|
|
void DisableNonTestMouseEvents(bool aDisable) override;
|
2011-09-09 23:50:21 +04:00
|
|
|
|
2018-03-07 14:13:17 +03:00
|
|
|
void UpdateCanvasBackground() override;
|
2011-09-09 23:50:21 +04:00
|
|
|
|
2019-04-03 15:40:26 +03:00
|
|
|
void AddCanvasBackgroundColorItem(
|
|
|
|
nsDisplayListBuilder& aBuilder, nsDisplayList& aList, nsIFrame* aFrame,
|
|
|
|
const nsRect& aBounds, nscolor aBackstopColor = NS_RGBA(0, 0, 0, 0),
|
|
|
|
uint32_t aFlags = 0) override;
|
2013-02-14 15:12:27 +04:00
|
|
|
|
2018-03-07 14:13:17 +03:00
|
|
|
void AddPrintPreviewBackgroundItem(nsDisplayListBuilder& aBuilder,
|
|
|
|
nsDisplayList& aList, nsIFrame* aFrame,
|
|
|
|
const nsRect& aBounds) override;
|
2011-09-09 23:50:21 +04:00
|
|
|
|
2018-03-07 14:13:17 +03:00
|
|
|
nscolor ComputeBackstopColor(nsView* aDisplayRoot) override;
|
2011-09-09 23:50:21 +04:00
|
|
|
|
2018-03-07 14:13:17 +03:00
|
|
|
nsresult SetIsActive(bool aIsActive) override;
|
2011-09-09 23:50:21 +04:00
|
|
|
|
2018-03-07 14:13:17 +03:00
|
|
|
bool GetIsViewportOverridden() override {
|
2015-09-01 23:47:52 +03:00
|
|
|
return (mMobileViewportManager != nullptr);
|
2015-07-21 17:51:55 +03:00
|
|
|
}
|
2011-09-09 23:50:21 +04:00
|
|
|
|
2019-04-05 01:09:55 +03:00
|
|
|
RefPtr<MobileViewportManager> GetMobileViewportManager() const override;
|
2018-11-03 00:18:42 +03:00
|
|
|
|
2018-10-04 06:28:40 +03:00
|
|
|
void UpdateViewportOverridden(bool aAfterInitialization) override;
|
|
|
|
|
2018-03-07 14:13:17 +03:00
|
|
|
bool IsLayoutFlushObserver() override {
|
2011-09-09 23:50:21 +04:00
|
|
|
return GetPresContext()->RefreshDriver()->IsLayoutFlushObserver(this);
|
|
|
|
}
|
|
|
|
|
2018-03-07 14:13:17 +03:00
|
|
|
void LoadComplete() override;
|
2013-11-25 09:00:00 +04:00
|
|
|
|
2018-03-07 14:13:17 +03:00
|
|
|
void AddSizeOfIncludingThis(nsWindowSizes& aWindowSizes) const override;
|
|
|
|
size_t SizeOfTextRuns(MallocSizeOf aMallocSizeOf) const;
|
2012-05-16 21:32:40 +04:00
|
|
|
|
2016-03-26 00:49:43 +03:00
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Approximate frame visibility tracking public API.
|
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
void ScheduleApproximateFrameVisibilityUpdateSoon() override;
|
|
|
|
void ScheduleApproximateFrameVisibilityUpdateNow() override;
|
2013-02-25 04:59:22 +04:00
|
|
|
|
2016-03-26 00:49:43 +03:00
|
|
|
void RebuildApproximateFrameVisibilityDisplayList(
|
|
|
|
const nsDisplayList& aList) override;
|
|
|
|
void RebuildApproximateFrameVisibility(nsRect* aRect = nullptr,
|
|
|
|
bool aRemoveOnly = false) override;
|
2013-02-25 04:59:22 +04:00
|
|
|
|
2016-09-12 08:19:08 +03:00
|
|
|
void EnsureFrameInApproximatelyVisibleList(nsIFrame* aFrame) override;
|
|
|
|
void RemoveFrameFromApproximatelyVisibleList(nsIFrame* aFrame) override;
|
2016-03-26 00:49:43 +03:00
|
|
|
|
|
|
|
bool AssumeAllFramesVisible() override;
|
2013-09-15 04:05:04 +04:00
|
|
|
|
2018-03-07 14:13:17 +03:00
|
|
|
bool CanDispatchEvent(const WidgetGUIEvent* aEvent = nullptr) const override;
|
2016-03-21 09:20:59 +03:00
|
|
|
|
2014-08-08 20:05:40 +04:00
|
|
|
void SetNextPaintCompressed() { mNextPaintCompressed = true; }
|
|
|
|
|
2018-03-07 14:13:17 +03:00
|
|
|
bool HasHandledUserInput() const override { return mHasHandledUserInput; }
|
2017-11-22 01:25:09 +03:00
|
|
|
|
2018-03-07 14:13:17 +03:00
|
|
|
void FireResizeEvent() override;
|
2015-05-05 17:56:01 +03:00
|
|
|
|
Bug 1514940 - part 1: Forcibly disable new keyCode/charCode value of keypress events if the document is Confluence r=smaug,Ehsan,kmag
Old Confluence does not aware of conflated model keypress event (see UI Events
spec, https://w3c.github.io/uievents/#determine-keypress-keyCode).
Additionally, Confluence can be hosted with any domains. Therefore, we cannot
use blacklist to disable the conflated model keypress event only on it.
This patch checks whether current or parent document is Confluence with JS
module, called KeyPressEventModelCheckerChild. For kicking this module,
nsHTMLDocument dispatches an custom event, CheckKeyPressEventModel, when it
becomes editable only first time. Finally, if it's a Confluence instance, the
module let PresShell know that we need to use split model keypress event in it.
Differential Revision: https://phabricator.services.mozilla.com/D17907
--HG--
extra : moz-landing-system : lando
2019-02-05 14:35:43 +03:00
|
|
|
void SetKeyPressEventModel(uint16_t aKeyPressEventModel) override {
|
|
|
|
mForceUseLegacyKeyCodeAndCharCodeValues |=
|
|
|
|
aKeyPressEventModel ==
|
|
|
|
dom::HTMLDocument_Binding::KEYPRESS_EVENT_MODEL_SPLIT;
|
|
|
|
}
|
|
|
|
|
2017-11-26 16:54:07 +03:00
|
|
|
static PresShell* GetShellForEventTarget(nsIFrame* aFrame,
|
|
|
|
nsIContent* aContent);
|
2017-12-09 04:11:10 +03:00
|
|
|
static PresShell* GetShellForTouchEvent(WidgetGUIEvent* aEvent);
|
|
|
|
|
2018-03-07 14:13:17 +03:00
|
|
|
private:
|
|
|
|
~PresShell();
|
2011-09-09 23:50:21 +04:00
|
|
|
|
2017-11-26 16:38:55 +03:00
|
|
|
friend class ::AutoPointerEventTargetUpdater;
|
2011-09-09 23:50:21 +04:00
|
|
|
|
2012-06-06 07:47:33 +04:00
|
|
|
/**
|
2013-05-16 19:06:03 +04:00
|
|
|
* Initialize cached font inflation preference values and do an initial
|
|
|
|
* computation to determine if font inflation is enabled.
|
2012-06-06 07:47:33 +04:00
|
|
|
*
|
|
|
|
* @see nsLayoutUtils::sFontSizeInflationEmPerLine
|
|
|
|
* @see nsLayoutUtils::sFontSizeInflationMinTwips
|
|
|
|
* @see nsLayoutUtils::sFontSizeInflationLineThreshold
|
|
|
|
*/
|
|
|
|
void SetupFontInflation();
|
|
|
|
|
2011-09-09 23:50:21 +04:00
|
|
|
struct RenderingState {
|
2014-09-01 07:36:37 +04:00
|
|
|
explicit RenderingState(PresShell* aPresShell)
|
2015-03-07 02:07:59 +03:00
|
|
|
: mResolution(aPresShell->mResolution),
|
2012-05-16 21:32:40 +04:00
|
|
|
mRenderFlags(aPresShell->mRenderFlags) {}
|
2016-03-19 04:38:57 +03:00
|
|
|
Maybe<float> mResolution;
|
2012-05-16 21:32:40 +04:00
|
|
|
RenderFlags mRenderFlags;
|
2011-09-09 23:50:21 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
struct AutoSaveRestoreRenderingState {
|
2014-09-01 07:36:37 +04:00
|
|
|
explicit AutoSaveRestoreRenderingState(PresShell* aPresShell)
|
2011-09-09 23:50:21 +04:00
|
|
|
: mPresShell(aPresShell), mOldState(aPresShell) {}
|
|
|
|
|
|
|
|
~AutoSaveRestoreRenderingState() {
|
|
|
|
mPresShell->mRenderFlags = mOldState.mRenderFlags;
|
2015-03-07 02:07:59 +03:00
|
|
|
mPresShell->mResolution = mOldState.mResolution;
|
2011-09-09 23:50:21 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
PresShell* mPresShell;
|
|
|
|
RenderingState mOldState;
|
|
|
|
};
|
2012-05-16 21:32:40 +04:00
|
|
|
static RenderFlags ChangeFlag(RenderFlags aFlags, bool aOnOff,
|
|
|
|
eRenderFlag aFlag) {
|
|
|
|
return aOnOff ? (aFlags | aFlag) : (aFlag & ~aFlag);
|
|
|
|
}
|
|
|
|
|
2011-09-09 23:50:21 +04:00
|
|
|
void SetRenderingState(const RenderingState& aState);
|
|
|
|
|
2016-11-30 06:14:27 +03:00
|
|
|
friend class ::nsPresShellEventCB;
|
2011-09-09 23:50:21 +04:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mCaretEnabled;
|
2016-01-14 01:00:15 +03:00
|
|
|
|
2011-09-09 23:50:21 +04:00
|
|
|
// methods for painting a range to an offscreen buffer
|
|
|
|
|
|
|
|
// given a display list, clip the items within the list to
|
|
|
|
// the range
|
|
|
|
nsRect ClipListToRange(nsDisplayListBuilder* aBuilder, nsDisplayList* aList,
|
2012-01-10 18:19:54 +04:00
|
|
|
nsRange* aRange);
|
2011-09-09 23:50:21 +04:00
|
|
|
|
|
|
|
// create a RangePaintInfo for the range aRange containing the
|
|
|
|
// display list needed to paint the range to a surface
|
2018-03-27 07:35:22 +03:00
|
|
|
UniquePtr<RangePaintInfo> CreateRangePaintInfo(nsRange* aRange,
|
2016-01-21 00:24:28 +03:00
|
|
|
nsRect& aSurfaceRect,
|
|
|
|
bool aForPrimarySelection);
|
2011-09-09 23:50:21 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Paint the items to a new surface and return it.
|
|
|
|
*
|
|
|
|
* aSelection - selection being painted, if any
|
|
|
|
* aRegion - clip region, if any
|
|
|
|
* aArea - area that the surface occupies, relative to the root frame
|
|
|
|
* aPoint - reference point, typically the mouse position
|
|
|
|
* aScreenRect - [out] set to the area of the screen the painted area should
|
|
|
|
* be displayed at
|
2015-07-11 19:15:19 +03:00
|
|
|
* aFlags - set RENDER_AUTO_SCALE to scale down large images, but it must not
|
|
|
|
* be set if a custom image was specified
|
2011-09-09 23:50:21 +04:00
|
|
|
*/
|
2015-06-17 17:00:52 +03:00
|
|
|
already_AddRefed<SourceSurface> PaintRangePaintInfo(
|
2018-03-07 14:13:17 +03:00
|
|
|
const nsTArray<UniquePtr<RangePaintInfo>>& aItems,
|
2018-08-07 16:32:08 +03:00
|
|
|
dom::Selection* aSelection, const Maybe<CSSIntRegion>& aRegion,
|
2018-03-07 14:13:17 +03:00
|
|
|
nsRect aArea, const LayoutDeviceIntPoint aPoint,
|
|
|
|
LayoutDeviceIntRect* aScreenRect, uint32_t aFlags);
|
2011-09-09 23:50:21 +04:00
|
|
|
|
|
|
|
// Hide a view if it is a popup
|
2013-01-03 17:23:11 +04:00
|
|
|
void HideViewIfPopup(nsView* aView);
|
2011-09-09 23:50:21 +04:00
|
|
|
|
|
|
|
// Utility method to restore the root scrollframe state
|
|
|
|
void RestoreRootScrollPosition();
|
|
|
|
|
2014-08-06 09:19:27 +04:00
|
|
|
void MaybeReleaseCapturingContent();
|
2011-09-09 23:50:21 +04:00
|
|
|
|
2013-10-22 17:27:34 +04:00
|
|
|
class DelayedEvent {
|
2011-09-09 23:50:21 +04:00
|
|
|
public:
|
2013-10-22 17:27:34 +04:00
|
|
|
virtual ~DelayedEvent() {}
|
|
|
|
virtual void Dispatch() {}
|
2017-02-03 13:16:00 +03:00
|
|
|
virtual bool IsKeyPressEvent() { return false; }
|
2011-09-09 23:50:21 +04:00
|
|
|
};
|
|
|
|
|
2013-10-22 17:27:34 +04:00
|
|
|
class DelayedInputEvent : public DelayedEvent {
|
2011-09-09 23:50:21 +04:00
|
|
|
public:
|
2018-03-07 14:13:17 +03:00
|
|
|
void Dispatch() override;
|
2011-09-09 23:50:21 +04:00
|
|
|
|
|
|
|
protected:
|
2013-10-22 17:27:34 +04:00
|
|
|
DelayedInputEvent();
|
2018-03-07 14:13:17 +03:00
|
|
|
~DelayedInputEvent() override;
|
2013-10-18 10:10:21 +04:00
|
|
|
|
2018-03-07 14:13:17 +03:00
|
|
|
WidgetInputEvent* mEvent;
|
2011-09-09 23:50:21 +04:00
|
|
|
};
|
|
|
|
|
2013-10-22 17:27:34 +04:00
|
|
|
class DelayedMouseEvent : public DelayedInputEvent {
|
2011-09-09 23:50:21 +04:00
|
|
|
public:
|
2018-03-07 14:13:17 +03:00
|
|
|
explicit DelayedMouseEvent(WidgetMouseEvent* aEvent);
|
2011-09-09 23:50:21 +04:00
|
|
|
};
|
|
|
|
|
2013-10-22 17:27:34 +04:00
|
|
|
class DelayedKeyEvent : public DelayedInputEvent {
|
2011-09-09 23:50:21 +04:00
|
|
|
public:
|
2018-03-07 14:13:17 +03:00
|
|
|
explicit DelayedKeyEvent(WidgetKeyboardEvent* aEvent);
|
|
|
|
bool IsKeyPressEvent() override;
|
2011-09-09 23:50:21 +04:00
|
|
|
};
|
|
|
|
|
2012-05-16 21:32:40 +04:00
|
|
|
// Check if aEvent is a mouse event and record the mouse location for later
|
|
|
|
// synth mouse moves.
|
2018-03-07 14:13:17 +03:00
|
|
|
void RecordMouseLocation(WidgetGUIEvent* aEvent);
|
2015-03-21 19:28:04 +03:00
|
|
|
class nsSynthMouseMoveEvent final : public nsARefreshObserver {
|
2012-05-16 21:32:40 +04:00
|
|
|
public:
|
2015-04-06 18:22:00 +03:00
|
|
|
nsSynthMouseMoveEvent(PresShell* aPresShell, bool aFromScroll)
|
|
|
|
: mPresShell(aPresShell), mFromScroll(aFromScroll) {
|
2012-05-16 21:32:40 +04:00
|
|
|
NS_ASSERTION(mPresShell, "null parameter");
|
|
|
|
}
|
2014-03-21 05:16:20 +04:00
|
|
|
|
|
|
|
private:
|
|
|
|
// Private destructor, to discourage deletion outside of Release():
|
2012-05-16 21:32:40 +04:00
|
|
|
~nsSynthMouseMoveEvent() { Revoke(); }
|
2011-09-09 23:50:21 +04:00
|
|
|
|
2014-03-21 05:16:20 +04:00
|
|
|
public:
|
2015-03-21 19:28:04 +03:00
|
|
|
NS_INLINE_DECL_REFCOUNTING(nsSynthMouseMoveEvent, override)
|
2014-03-20 10:49:25 +04:00
|
|
|
|
2012-05-16 21:32:40 +04:00
|
|
|
void Revoke() {
|
|
|
|
if (mPresShell) {
|
|
|
|
mPresShell->GetPresContext()->RefreshDriver()->RemoveRefreshObserver(
|
2017-01-05 10:31:56 +03:00
|
|
|
this, FlushType::Display);
|
2012-07-30 18:20:58 +04:00
|
|
|
mPresShell = nullptr;
|
2012-05-16 21:32:40 +04:00
|
|
|
}
|
|
|
|
}
|
2019-03-11 17:58:04 +03:00
|
|
|
MOZ_CAN_RUN_SCRIPT
|
2018-03-07 14:13:17 +03:00
|
|
|
void WillRefresh(TimeStamp aTime) override {
|
2013-11-12 16:54:10 +04:00
|
|
|
if (mPresShell) {
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<PresShell> shell = mPresShell;
|
2015-04-06 18:22:00 +03:00
|
|
|
shell->ProcessSynthMouseMoveEvent(mFromScroll);
|
2013-11-12 16:54:10 +04:00
|
|
|
}
|
2012-05-16 21:32:40 +04:00
|
|
|
}
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2012-05-16 21:32:40 +04:00
|
|
|
private:
|
|
|
|
PresShell* mPresShell;
|
|
|
|
bool mFromScroll;
|
|
|
|
};
|
2019-03-11 17:58:04 +03:00
|
|
|
MOZ_CAN_RUN_SCRIPT void ProcessSynthMouseMoveEvent(bool aFromScroll);
|
2011-09-09 23:50:21 +04:00
|
|
|
|
2012-05-16 21:32:40 +04:00
|
|
|
void QueryIsActive();
|
2016-07-26 21:48:00 +03:00
|
|
|
nsresult UpdateImageLockingState();
|
2012-04-27 01:40:05 +04:00
|
|
|
|
2019-04-13 04:03:13 +03:00
|
|
|
already_AddRefed<PresShell> GetParentPresShellForEventHandling();
|
2018-10-09 12:47:58 +03:00
|
|
|
|
2015-11-10 05:49:05 +03:00
|
|
|
/**
|
Bug 1466208 - part 1: Create stack class to handle events in PresShell r=smaug
PresShell::HandleEvent() and PresShell::HandleEventInternal() are too big.
Additionally, we have a lot of methods used only by them. So, if we'll
split those big methods, PresShell will have a lot of small methods which
are not grouped as a part of event handling. That's too bad because some
of them may depend on the calling order, etc.
So, for grouping them, PresShell should create a stack class instance to handle
each event. Then, we can store shared information in it only while we're
handling an event.
This patch creates PresShell::EventHandler and PresShell methods become
wrappers of the stack class, but this patch does not change any logic in the
code, i.e., just reorganizing existing methods.
Note that HandleEventWithTarget() and HandleEventInternal() need to take
WidgetEvent rather than WidgetGUIEvent. Additionally, some other methods
require WidgetGUIEvent to refer WidgetGUIEvent::mWidget. Therefore, this
patch does not make the new class store the event as a member.
Differential Revision: https://phabricator.services.mozilla.com/D16951
--HG--
extra : moz-landing-system : lando
2019-01-29 09:04:05 +03:00
|
|
|
* EventHandler is implementation of nsIPresShell::HandleEvent().
|
2015-11-10 05:49:05 +03:00
|
|
|
*/
|
Bug 1466208 - part 1: Create stack class to handle events in PresShell r=smaug
PresShell::HandleEvent() and PresShell::HandleEventInternal() are too big.
Additionally, we have a lot of methods used only by them. So, if we'll
split those big methods, PresShell will have a lot of small methods which
are not grouped as a part of event handling. That's too bad because some
of them may depend on the calling order, etc.
So, for grouping them, PresShell should create a stack class instance to handle
each event. Then, we can store shared information in it only while we're
handling an event.
This patch creates PresShell::EventHandler and PresShell methods become
wrappers of the stack class, but this patch does not change any logic in the
code, i.e., just reorganizing existing methods.
Note that HandleEventWithTarget() and HandleEventInternal() need to take
WidgetEvent rather than WidgetGUIEvent. Additionally, some other methods
require WidgetGUIEvent to refer WidgetGUIEvent::mWidget. Therefore, this
patch does not make the new class store the event as a member.
Differential Revision: https://phabricator.services.mozilla.com/D16951
--HG--
extra : moz-landing-system : lando
2019-01-29 09:04:05 +03:00
|
|
|
class MOZ_STACK_CLASS EventHandler final {
|
|
|
|
public:
|
|
|
|
EventHandler() = delete;
|
|
|
|
EventHandler(const EventHandler& aOther) = delete;
|
2019-03-04 09:12:22 +03:00
|
|
|
explicit EventHandler(PresShell& aPresShell)
|
|
|
|
: mPresShell(aPresShell), mCurrentEventInfoSetter(nullptr) {}
|
2019-02-12 07:10:33 +03:00
|
|
|
explicit EventHandler(RefPtr<PresShell>&& aPresShell)
|
2019-03-04 09:12:22 +03:00
|
|
|
: mPresShell(aPresShell.forget()), mCurrentEventInfoSetter(nullptr) {}
|
Bug 1466208 - part 1: Create stack class to handle events in PresShell r=smaug
PresShell::HandleEvent() and PresShell::HandleEventInternal() are too big.
Additionally, we have a lot of methods used only by them. So, if we'll
split those big methods, PresShell will have a lot of small methods which
are not grouped as a part of event handling. That's too bad because some
of them may depend on the calling order, etc.
So, for grouping them, PresShell should create a stack class instance to handle
each event. Then, we can store shared information in it only while we're
handling an event.
This patch creates PresShell::EventHandler and PresShell methods become
wrappers of the stack class, but this patch does not change any logic in the
code, i.e., just reorganizing existing methods.
Note that HandleEventWithTarget() and HandleEventInternal() need to take
WidgetEvent rather than WidgetGUIEvent. Additionally, some other methods
require WidgetGUIEvent to refer WidgetGUIEvent::mWidget. Therefore, this
patch does not make the new class store the event as a member.
Differential Revision: https://phabricator.services.mozilla.com/D16951
--HG--
extra : moz-landing-system : lando
2019-01-29 09:04:05 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* HandleEvent() may dispatch aGUIEvent. This may redirect the event to
|
|
|
|
* another PresShell, or the event may be handled by other classes like
|
Bug 1466208 - part 44: Rename PresShell::EventHandler::HandleEventInternal() to HandleEventWithCurrentEventInfo() r=smaug
In my understanding, `PresShell::EventHandler::HandleEvent()` may redirect
the event to another class or PresShell first. Otherwise, it computes
event target and sets current event info of mPresShell to it. Then, calls
`HandleEventInternal()` to dispatch the event. Then, `HandleEventInternal()`
may handle the event before dispatch, and/or prepare to dispatch, then,
finally dispatches the event and finalize the state of mPresShell and the
event. Therefore, `HandleEventInternal()` actually handles the event, but
the word, "internal" is not explicitly explain its different points from
`HandleEvent()`. Therefore, I think that `HandleEventWithCurrentEventInfo()`
is better name since `HandleEvent()` considers the current event info.
Differential Revision: https://phabricator.services.mozilla.com/D22462
--HG--
extra : moz-landing-system : lando
2019-03-12 07:25:13 +03:00
|
|
|
* AccessibleCaretEventHub, or discarded. Otherwise, this sets current
|
|
|
|
* event info of mPresShell and calls HandleEventWithCurrentEventInfo()
|
|
|
|
* to dispatch the event into the DOM tree.
|
Bug 1466208 - part 1: Create stack class to handle events in PresShell r=smaug
PresShell::HandleEvent() and PresShell::HandleEventInternal() are too big.
Additionally, we have a lot of methods used only by them. So, if we'll
split those big methods, PresShell will have a lot of small methods which
are not grouped as a part of event handling. That's too bad because some
of them may depend on the calling order, etc.
So, for grouping them, PresShell should create a stack class instance to handle
each event. Then, we can store shared information in it only while we're
handling an event.
This patch creates PresShell::EventHandler and PresShell methods become
wrappers of the stack class, but this patch does not change any logic in the
code, i.e., just reorganizing existing methods.
Note that HandleEventWithTarget() and HandleEventInternal() need to take
WidgetEvent rather than WidgetGUIEvent. Additionally, some other methods
require WidgetGUIEvent to refer WidgetGUIEvent::mWidget. Therefore, this
patch does not make the new class store the event as a member.
Differential Revision: https://phabricator.services.mozilla.com/D16951
--HG--
extra : moz-landing-system : lando
2019-01-29 09:04:05 +03:00
|
|
|
*
|
2019-03-13 13:32:36 +03:00
|
|
|
* @param aFrameForPresShell The frame for PresShell. If PresShell
|
|
|
|
* has root frame, it should be set.
|
|
|
|
* Otherwise, a frame which contains the
|
|
|
|
* PresShell should be set instead. I.e.,
|
|
|
|
* in the latter case, the frame is in
|
|
|
|
* a parent document.
|
2019-03-26 13:02:06 +03:00
|
|
|
* @param aGUIEvent Event to be handled. Must be a trusted
|
|
|
|
* event.
|
Bug 1466208 - part 1: Create stack class to handle events in PresShell r=smaug
PresShell::HandleEvent() and PresShell::HandleEventInternal() are too big.
Additionally, we have a lot of methods used only by them. So, if we'll
split those big methods, PresShell will have a lot of small methods which
are not grouped as a part of event handling. That's too bad because some
of them may depend on the calling order, etc.
So, for grouping them, PresShell should create a stack class instance to handle
each event. Then, we can store shared information in it only while we're
handling an event.
This patch creates PresShell::EventHandler and PresShell methods become
wrappers of the stack class, but this patch does not change any logic in the
code, i.e., just reorganizing existing methods.
Note that HandleEventWithTarget() and HandleEventInternal() need to take
WidgetEvent rather than WidgetGUIEvent. Additionally, some other methods
require WidgetGUIEvent to refer WidgetGUIEvent::mWidget. Therefore, this
patch does not make the new class store the event as a member.
Differential Revision: https://phabricator.services.mozilla.com/D16951
--HG--
extra : moz-landing-system : lando
2019-01-29 09:04:05 +03:00
|
|
|
* @param aDontRetargetEvents true if this shouldn't redirect the
|
|
|
|
* event to different PresShell.
|
|
|
|
* false if this can redirect the event to
|
|
|
|
* different PresShell.
|
|
|
|
* @param aEventStatus [in/out] EventStatus of aGUIEvent.
|
|
|
|
*/
|
|
|
|
MOZ_CAN_RUN_SCRIPT
|
2019-03-13 13:32:36 +03:00
|
|
|
nsresult HandleEvent(nsIFrame* aFrameForPresShell,
|
|
|
|
WidgetGUIEvent* aGUIEvent, bool aDontRetargetEvents,
|
|
|
|
nsEventStatus* aEventStatus);
|
Bug 1466208 - part 1: Create stack class to handle events in PresShell r=smaug
PresShell::HandleEvent() and PresShell::HandleEventInternal() are too big.
Additionally, we have a lot of methods used only by them. So, if we'll
split those big methods, PresShell will have a lot of small methods which
are not grouped as a part of event handling. That's too bad because some
of them may depend on the calling order, etc.
So, for grouping them, PresShell should create a stack class instance to handle
each event. Then, we can store shared information in it only while we're
handling an event.
This patch creates PresShell::EventHandler and PresShell methods become
wrappers of the stack class, but this patch does not change any logic in the
code, i.e., just reorganizing existing methods.
Note that HandleEventWithTarget() and HandleEventInternal() need to take
WidgetEvent rather than WidgetGUIEvent. Additionally, some other methods
require WidgetGUIEvent to refer WidgetGUIEvent::mWidget. Therefore, this
patch does not make the new class store the event as a member.
Differential Revision: https://phabricator.services.mozilla.com/D16951
--HG--
extra : moz-landing-system : lando
2019-01-29 09:04:05 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* HandleEventWithTarget() tries to dispatch aEvent on aContent after
|
|
|
|
* setting current event target content to aNewEventContent and current
|
|
|
|
* event frame to aNewEventFrame temporarily. Note that this supports
|
|
|
|
* WidgetEvent, not WidgetGUIEvent. So, you can dispatch a simple event
|
|
|
|
* with this.
|
|
|
|
*
|
2019-03-26 13:02:06 +03:00
|
|
|
* @param aEvent Event to be dispatched. Must be a
|
|
|
|
* trusted event.
|
Bug 1466208 - part 1: Create stack class to handle events in PresShell r=smaug
PresShell::HandleEvent() and PresShell::HandleEventInternal() are too big.
Additionally, we have a lot of methods used only by them. So, if we'll
split those big methods, PresShell will have a lot of small methods which
are not grouped as a part of event handling. That's too bad because some
of them may depend on the calling order, etc.
So, for grouping them, PresShell should create a stack class instance to handle
each event. Then, we can store shared information in it only while we're
handling an event.
This patch creates PresShell::EventHandler and PresShell methods become
wrappers of the stack class, but this patch does not change any logic in the
code, i.e., just reorganizing existing methods.
Note that HandleEventWithTarget() and HandleEventInternal() need to take
WidgetEvent rather than WidgetGUIEvent. Additionally, some other methods
require WidgetGUIEvent to refer WidgetGUIEvent::mWidget. Therefore, this
patch does not make the new class store the event as a member.
Differential Revision: https://phabricator.services.mozilla.com/D16951
--HG--
extra : moz-landing-system : lando
2019-01-29 09:04:05 +03:00
|
|
|
* @param aNewEventFrame Temporal new event frame.
|
|
|
|
* @param aNewEventContent Temporal new event content.
|
|
|
|
* @param aEventStatus [in/out] EventStuatus of aEvent.
|
|
|
|
* @param aIsHandlingNativeEvent true if aEvent represents a native
|
|
|
|
* event.
|
|
|
|
* @param aTargetContent This is used only when aEvent is a
|
|
|
|
* pointer event. If
|
|
|
|
* PresShell::mPointerEventTarget is
|
|
|
|
* changed during dispatching aEvent,
|
|
|
|
* this is set to the new target.
|
|
|
|
* @param aOverrideClickTarget Override click event target.
|
|
|
|
*/
|
|
|
|
MOZ_CAN_RUN_SCRIPT
|
|
|
|
nsresult HandleEventWithTarget(WidgetEvent* aEvent,
|
|
|
|
nsIFrame* aNewEventFrame,
|
|
|
|
nsIContent* aNewEventContent,
|
|
|
|
nsEventStatus* aEventStatus,
|
|
|
|
bool aIsHandlingNativeEvent,
|
|
|
|
nsIContent** aTargetContent,
|
|
|
|
nsIContent* aOverrideClickTarget);
|
2011-09-09 23:50:21 +04:00
|
|
|
|
2019-03-04 09:11:41 +03:00
|
|
|
/**
|
|
|
|
* OnPresShellDestroy() is called when every PresShell instance is being
|
|
|
|
* destroyed.
|
|
|
|
*/
|
2019-03-29 18:11:22 +03:00
|
|
|
static inline void OnPresShellDestroy(Document* aDocument);
|
2019-03-04 09:11:41 +03:00
|
|
|
|
Bug 1466208 - part 1: Create stack class to handle events in PresShell r=smaug
PresShell::HandleEvent() and PresShell::HandleEventInternal() are too big.
Additionally, we have a lot of methods used only by them. So, if we'll
split those big methods, PresShell will have a lot of small methods which
are not grouped as a part of event handling. That's too bad because some
of them may depend on the calling order, etc.
So, for grouping them, PresShell should create a stack class instance to handle
each event. Then, we can store shared information in it only while we're
handling an event.
This patch creates PresShell::EventHandler and PresShell methods become
wrappers of the stack class, but this patch does not change any logic in the
code, i.e., just reorganizing existing methods.
Note that HandleEventWithTarget() and HandleEventInternal() need to take
WidgetEvent rather than WidgetGUIEvent. Additionally, some other methods
require WidgetGUIEvent to refer WidgetGUIEvent::mWidget. Therefore, this
patch does not make the new class store the event as a member.
Differential Revision: https://phabricator.services.mozilla.com/D16951
--HG--
extra : moz-landing-system : lando
2019-01-29 09:04:05 +03:00
|
|
|
private:
|
|
|
|
static bool InZombieDocument(nsIContent* aContent);
|
|
|
|
static nsIFrame* GetNearestFrameContainingPresShell(
|
|
|
|
nsIPresShell* aPresShell);
|
|
|
|
static already_AddRefed<nsIURI> GetDocumentURIToCompareWithBlacklist(
|
|
|
|
PresShell& aPresShell);
|
|
|
|
|
2019-03-02 03:03:01 +03:00
|
|
|
/**
|
|
|
|
* HandleEventUsingCoordinates() handles aGUIEvent whose
|
|
|
|
* IsUsingCoordinates() returns true with the following helper methods.
|
|
|
|
*
|
2019-03-13 13:32:36 +03:00
|
|
|
* @param aFrameForPresShell The frame for PresShell. See
|
|
|
|
* explanation of HandleEvent() for the
|
|
|
|
* details.
|
2019-03-02 03:03:01 +03:00
|
|
|
* @param aGUIEvent The handling event. Make sure that
|
|
|
|
* its IsUsingCoordinates() returns true.
|
|
|
|
* @param aEventStatus The status of aGUIEvent.
|
|
|
|
* @param aDontRetargetEvents true if we've already retarget document.
|
|
|
|
* Otherwise, false.
|
|
|
|
*/
|
|
|
|
MOZ_CAN_RUN_SCRIPT
|
|
|
|
nsresult HandleEventUsingCoordinates(nsIFrame* aFrameForPresShell,
|
|
|
|
WidgetGUIEvent* aGUIEvent,
|
|
|
|
nsEventStatus* aEventStatus,
|
|
|
|
bool aDontRetargetEvents);
|
|
|
|
|
2019-02-13 02:23:27 +03:00
|
|
|
/**
|
|
|
|
* EventTargetData struct stores a set of a PresShell (event handler),
|
|
|
|
* a frame (to handle the event) and a content (event target for the frame).
|
|
|
|
*/
|
|
|
|
struct MOZ_STACK_CLASS EventTargetData final {
|
|
|
|
EventTargetData() = delete;
|
|
|
|
EventTargetData(const EventTargetData& aOther) = delete;
|
|
|
|
EventTargetData(PresShell* aPresShell, nsIFrame* aFrameToHandleEvent)
|
|
|
|
: mPresShell(aPresShell), mFrame(aFrameToHandleEvent) {}
|
|
|
|
|
|
|
|
void SetPresShellAndFrame(PresShell* aPresShell,
|
|
|
|
nsIFrame* aFrameToHandleEvent) {
|
|
|
|
mPresShell = aPresShell;
|
|
|
|
mFrame = aFrameToHandleEvent;
|
|
|
|
mContent = nullptr;
|
|
|
|
}
|
|
|
|
void SetFrameAndComputePresShell(nsIFrame* aFrameToHandleEvent);
|
|
|
|
void SetFrameAndComputePresShellAndContent(nsIFrame* aFrameToHandleEvent,
|
|
|
|
WidgetGUIEvent* aGUIEvent);
|
|
|
|
void SetContentForEventFromFrame(WidgetGUIEvent* aGUIEvent);
|
|
|
|
|
|
|
|
nsPresContext* GetPresContext() const {
|
|
|
|
return mPresShell ? mPresShell->GetPresContext() : nullptr;
|
|
|
|
};
|
|
|
|
EventStateManager* GetEventStateManager() const {
|
|
|
|
nsPresContext* presContext = GetPresContext();
|
|
|
|
return presContext ? presContext->EventStateManager() : nullptr;
|
|
|
|
}
|
|
|
|
Document* GetDocument() const {
|
|
|
|
return mPresShell ? mPresShell->GetDocument() : nullptr;
|
|
|
|
}
|
|
|
|
nsIContent* GetFrameContent() const;
|
|
|
|
|
2019-02-15 05:06:31 +03:00
|
|
|
/**
|
|
|
|
* MaybeRetargetToActiveDocument() tries retarget aGUIEvent into
|
|
|
|
* active document if there is. Note that this does not support to
|
|
|
|
* retarget mContent. Make sure it is nullptr before calling this.
|
|
|
|
*
|
|
|
|
* @param aGUIEvent The handling event.
|
|
|
|
* @return true if retargetted.
|
|
|
|
*/
|
|
|
|
bool MaybeRetargetToActiveDocument(WidgetGUIEvent* aGUIEvent);
|
|
|
|
|
2019-02-18 07:33:06 +03:00
|
|
|
/**
|
|
|
|
* ComputeElementFromFrame() computes mContent for aGUIEvent. If
|
|
|
|
* mContent is set by this method, mContent is always nullptr or an
|
|
|
|
* Element.
|
|
|
|
*
|
|
|
|
* @param aGUIEvent The handling event.
|
|
|
|
* @return true if caller can keep handling the event.
|
|
|
|
* Otherwise, false.
|
|
|
|
* Note that even if this returns true, mContent
|
|
|
|
* may be nullptr.
|
|
|
|
*/
|
|
|
|
bool ComputeElementFromFrame(WidgetGUIEvent* aGUIEvent);
|
|
|
|
|
2019-03-02 03:02:10 +03:00
|
|
|
/**
|
|
|
|
* UpdateTouchEventTarget() updates mFrame, mPresShell and mContent if
|
|
|
|
* aGUIEvent is a touch event and there is new proper target.
|
|
|
|
*
|
|
|
|
* @param aGUIEvent The handled event. If it's not a touch event,
|
|
|
|
* this method does nothing.
|
|
|
|
*/
|
|
|
|
void UpdateTouchEventTarget(WidgetGUIEvent* aGUIEvent);
|
|
|
|
|
2019-02-13 02:23:27 +03:00
|
|
|
RefPtr<PresShell> mPresShell;
|
|
|
|
nsIFrame* mFrame;
|
|
|
|
nsCOMPtr<nsIContent> mContent;
|
2019-03-01 04:58:02 +03:00
|
|
|
nsCOMPtr<nsIContent> mOverrideClickTarget;
|
2019-02-13 02:23:27 +03:00
|
|
|
};
|
|
|
|
|
Bug 1506508 - Make PresShell::EventHandler::HandleEvent() flush any dirty region before deciding to event target of eMouseDown and eMouseUp r=smaug
When preceding mouse event is handled, that may cause changing style of the
target. Therefore, when an eMouseDown or eMouseUp event is handled, handlers
require the latest layout. Currently, nsViewManager::DispatchEvent() tries
to guarantee that with calling nsIPresShell::FlushPendingNotifications()
with FlushType::Layout. However, this just flushes the pending layout in
the PresShell associated with the nsViewManager instance. I.e., if the
target is in a child PresShell, its layout hasn't been flushed.
This patch makes PresShell::EventHandler::HandleEvent() flush pending
notifications at first of handling events using coordinates (only when
eMouseDown or eMouseUp, though). Then, when it realizes that the event
should be handled in a child PresShell, makes it flush its pending
notifications and then, recompute event target with the latest layout if
the layout is actually changed.
Differential Revision: https://phabricator.services.mozilla.com/D13720
--HG--
extra : moz-landing-system : lando
2019-02-12 02:25:45 +03:00
|
|
|
/**
|
|
|
|
* MaybeFlushPendingNotifications() maybe flush pending notifications if
|
|
|
|
* aGUIEvent should be handled with the latest layout.
|
|
|
|
*
|
|
|
|
* @param aGUIEvent The handling event.
|
|
|
|
* @return true if this actually flushes pending
|
|
|
|
* layout and that has caused changing the
|
|
|
|
* layout.
|
|
|
|
*/
|
|
|
|
MOZ_CAN_RUN_SCRIPT
|
|
|
|
bool MaybeFlushPendingNotifications(WidgetGUIEvent* aGUIEvent);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* GetFrameToHandleNonTouchEvent() returns a frame to handle the event.
|
|
|
|
* This may flush pending layout if the target is in child PresShell.
|
|
|
|
*
|
|
|
|
* @param aRootFrameToHandleEvent The root frame to handle the event.
|
|
|
|
* @param aGUIEvent The handling event.
|
|
|
|
* @return The frame which should handle the
|
|
|
|
* event. nullptr if the caller should
|
|
|
|
* stop handling the event.
|
|
|
|
*/
|
|
|
|
MOZ_CAN_RUN_SCRIPT
|
|
|
|
nsIFrame* GetFrameToHandleNonTouchEvent(nsIFrame* aRootFrameToHandleEvent,
|
|
|
|
WidgetGUIEvent* aGUIEvent);
|
|
|
|
|
2019-02-27 16:59:30 +03:00
|
|
|
/**
|
|
|
|
* ComputeEventTargetFrameAndPresShellAtEventPoint() computes event
|
|
|
|
* target frame at the event point of aGUIEvent and set it to
|
|
|
|
* aEventTargetData.
|
|
|
|
*
|
|
|
|
* @param aRootFrameToHandleEvent The root frame to handle aGUIEvent.
|
|
|
|
* @param aGUIEvent The handling event.
|
|
|
|
* @param aEventTargetData [out] Its frame and PresShell will
|
|
|
|
* be set.
|
|
|
|
* @return true if the caller can handle the
|
|
|
|
* event. Otherwise, false.
|
|
|
|
*/
|
|
|
|
MOZ_CAN_RUN_SCRIPT
|
|
|
|
bool ComputeEventTargetFrameAndPresShellAtEventPoint(
|
|
|
|
nsIFrame* aRootFrameToHandleEvent, WidgetGUIEvent* aGUIEvent,
|
|
|
|
EventTargetData* aEventTargetData);
|
|
|
|
|
2019-03-01 05:02:31 +03:00
|
|
|
/**
|
|
|
|
* DispatchPrecedingPointerEvent() dispatches preceding pointer event for
|
|
|
|
* aGUIEvent if Pointer Events is enabled.
|
|
|
|
*
|
2019-03-13 13:32:36 +03:00
|
|
|
* @param aFrameForPresShell The frame for PresShell. See
|
|
|
|
* explanation of HandleEvent() for the
|
|
|
|
* details.
|
2019-03-01 05:02:31 +03:00
|
|
|
* @param aGUIEvent The handled event.
|
|
|
|
* @param aPointerCapturingContent The content which is capturing pointer
|
|
|
|
* events if there is. Otherwise, nullptr.
|
|
|
|
* @param aDontRetargetEvents Set aDontRetargetEvents of
|
|
|
|
* HandleEvent() which called this method.
|
|
|
|
* @param aEventTargetData [in/out] Event target data of
|
|
|
|
* aGUIEvent. If pointer event listeners
|
|
|
|
* change the DOM tree or reframe the
|
|
|
|
* target, updated by this method.
|
|
|
|
* @param aEventStatus [in/out] The event status of aGUIEvent.
|
|
|
|
* @return true if the caller can handle the
|
|
|
|
* event. Otherwise, false.
|
|
|
|
*/
|
|
|
|
MOZ_CAN_RUN_SCRIPT
|
|
|
|
bool DispatchPrecedingPointerEvent(nsIFrame* aFrameForPresShell,
|
|
|
|
WidgetGUIEvent* aGUIEvent,
|
|
|
|
nsIContent* aPointerCapturingContent,
|
|
|
|
bool aDontRetargetEvents,
|
|
|
|
EventTargetData* aEventTargetData,
|
|
|
|
nsEventStatus* aEventStatus);
|
|
|
|
|
2019-02-02 05:20:28 +03:00
|
|
|
/**
|
|
|
|
* MaybeDiscardEvent() checks whether it's safe to handle aGUIEvent right
|
|
|
|
* now. If it's not safe, this may notify somebody of discarding event if
|
|
|
|
* necessary.
|
|
|
|
*
|
|
|
|
* @param aGUIEvent Handling event.
|
|
|
|
* @return true if it's not safe to handle the event.
|
|
|
|
*/
|
|
|
|
bool MaybeDiscardEvent(WidgetGUIEvent* aGUIEvent);
|
|
|
|
|
2019-01-30 10:17:43 +03:00
|
|
|
/**
|
|
|
|
* GetCapturingContentFor() returns capturing content for aGUIEvent.
|
|
|
|
* If aGUIEvent is not related to capturing, this returns nullptr.
|
|
|
|
*/
|
|
|
|
static nsIContent* GetCapturingContentFor(WidgetGUIEvent* aGUIEvent);
|
|
|
|
|
2019-01-31 05:24:51 +03:00
|
|
|
/**
|
|
|
|
* GetRetargetEventDocument() returns a document if aGUIEvent should be
|
|
|
|
* handled in another document.
|
|
|
|
*
|
|
|
|
* @param aGUIEvent Handling event.
|
|
|
|
* @param aRetargetEventDocument Document which should handle aGUIEvent.
|
|
|
|
* @return true if caller can keep handling
|
|
|
|
* aGUIEvent.
|
|
|
|
*/
|
|
|
|
bool GetRetargetEventDocument(WidgetGUIEvent* aGUIEvent,
|
|
|
|
Document** aRetargetEventDocument);
|
|
|
|
|
2019-02-01 05:15:54 +03:00
|
|
|
/**
|
|
|
|
* GetFrameForHandlingEventWith() returns a frame which should be used as
|
2019-03-13 13:32:36 +03:00
|
|
|
* aFrameForPresShell of HandleEvent(). See @return for the details.
|
2019-02-01 05:15:54 +03:00
|
|
|
*
|
|
|
|
* @param aGUIEvent Handling event.
|
|
|
|
* @param aRetargetDocument Document which aGUIEvent should be
|
|
|
|
* fired on. Typically, should be result
|
|
|
|
* of GetRetargetEventDocument().
|
2019-03-13 13:32:36 +03:00
|
|
|
* @param aFrameForPresShell The frame for PresShell. See
|
|
|
|
* explanation of HandleEvent() for the
|
|
|
|
* details.
|
2019-02-01 05:15:54 +03:00
|
|
|
* @return nullptr if caller should stop handling
|
|
|
|
* the event.
|
|
|
|
* aFrameForPresShell if caller should
|
|
|
|
* keep handling the event by itself.
|
|
|
|
* Otherwise, caller should handle it with
|
|
|
|
* another PresShell which is result of
|
|
|
|
* nsIFrame::PresContext()->GetPresShell().
|
|
|
|
*/
|
|
|
|
nsIFrame* GetFrameForHandlingEventWith(WidgetGUIEvent* aGUIEvent,
|
|
|
|
Document* aRetargetDocument,
|
|
|
|
nsIFrame* aFrameForPresShell);
|
|
|
|
|
2019-02-02 05:20:25 +03:00
|
|
|
/**
|
|
|
|
* MaybeHandleEventWithAnotherPresShell() may handle aGUIEvent with another
|
|
|
|
* PresShell.
|
|
|
|
*
|
2019-03-13 13:32:36 +03:00
|
|
|
* @param aFrameForPresShell The frame for PresShell. See
|
|
|
|
* explanation of HandleEvent() for the
|
|
|
|
* details.
|
2019-02-02 05:20:25 +03:00
|
|
|
* @param aGUIEvent Handling event.
|
|
|
|
* @param aEventStatus [in/out] EventStatus of aGUIEvent.
|
|
|
|
* @param aRv [out] Returns error if this gets an
|
|
|
|
* error handling the event.
|
|
|
|
* @return false if caller needs to keep handling
|
|
|
|
* the event by itself.
|
|
|
|
* true if caller shouldn't keep handling
|
|
|
|
* the event. Note that when no PresShell
|
|
|
|
* can handle the event, this returns true.
|
|
|
|
*/
|
|
|
|
MOZ_CAN_RUN_SCRIPT
|
|
|
|
bool MaybeHandleEventWithAnotherPresShell(nsIFrame* aFrameForPresShell,
|
|
|
|
WidgetGUIEvent* aGUIEvent,
|
|
|
|
nsEventStatus* aEventStatus,
|
|
|
|
nsresult* aRv);
|
|
|
|
|
Bug 1466208 - part 1: Create stack class to handle events in PresShell r=smaug
PresShell::HandleEvent() and PresShell::HandleEventInternal() are too big.
Additionally, we have a lot of methods used only by them. So, if we'll
split those big methods, PresShell will have a lot of small methods which
are not grouped as a part of event handling. That's too bad because some
of them may depend on the calling order, etc.
So, for grouping them, PresShell should create a stack class instance to handle
each event. Then, we can store shared information in it only while we're
handling an event.
This patch creates PresShell::EventHandler and PresShell methods become
wrappers of the stack class, but this patch does not change any logic in the
code, i.e., just reorganizing existing methods.
Note that HandleEventWithTarget() and HandleEventInternal() need to take
WidgetEvent rather than WidgetGUIEvent. Additionally, some other methods
require WidgetGUIEvent to refer WidgetGUIEvent::mWidget. Therefore, this
patch does not make the new class store the event as a member.
Differential Revision: https://phabricator.services.mozilla.com/D16951
--HG--
extra : moz-landing-system : lando
2019-01-29 09:04:05 +03:00
|
|
|
MOZ_CAN_RUN_SCRIPT
|
|
|
|
nsresult RetargetEventToParent(WidgetGUIEvent* aGUIEvent,
|
|
|
|
nsEventStatus* aEventStatus);
|
|
|
|
|
2019-01-29 13:30:35 +03:00
|
|
|
/**
|
|
|
|
* MaybeHandleEventWithAccessibleCaret() may handle aGUIEvent with
|
|
|
|
* AccessibleCaretEventHub if it's necessary.
|
|
|
|
*
|
|
|
|
* @param aGUIEvent Event may be handled by AccessibleCaretEventHub.
|
|
|
|
* @param aEventStatus [in/out] EventStatus of aGUIEvent.
|
|
|
|
* @return true if AccessibleCaretEventHub handled the
|
|
|
|
* event and caller shouldn't keep handling it.
|
|
|
|
*/
|
|
|
|
MOZ_CAN_RUN_SCRIPT
|
|
|
|
bool MaybeHandleEventWithAccessibleCaret(WidgetGUIEvent* aGUIEvent,
|
|
|
|
nsEventStatus* aEventStatus);
|
|
|
|
|
2019-02-07 04:49:31 +03:00
|
|
|
/**
|
|
|
|
* MaybeDiscardOrDelayKeyboardEvent() may discared or put aGUIEvent into
|
|
|
|
* the delayed event queue if it's a keyboard event and if we should do so.
|
|
|
|
* If aGUIEvent is not a keyboard event, this does nothing.
|
|
|
|
*
|
|
|
|
* @param aGUIEvent The handling event.
|
|
|
|
* @return true if this method discard the event or
|
|
|
|
* put it into the delayed event queue.
|
|
|
|
*/
|
|
|
|
bool MaybeDiscardOrDelayKeyboardEvent(WidgetGUIEvent* aGUIEvent);
|
|
|
|
|
2019-02-12 07:12:20 +03:00
|
|
|
/**
|
|
|
|
* MaybeDiscardOrDelayMouseEvent() may discard or put aGUIEvent into the
|
|
|
|
* delayed event queue if it's a mouse event and if we should do so.
|
|
|
|
* If aGUIEvent is not a mouse event, this does nothing.
|
|
|
|
* If there is suppressed event listener like debugger of devtools, this
|
|
|
|
* notifies it of the event after discard or put it into the delayed
|
|
|
|
* event queue.
|
|
|
|
*
|
|
|
|
* @param aFrameToHandleEvent The frame to handle aGUIEvent.
|
|
|
|
* @param aGUIEvent The handling event.
|
|
|
|
* @return true if this method discard the event
|
|
|
|
* or put it into the delayed event queue.
|
|
|
|
*/
|
|
|
|
bool MaybeDiscardOrDelayMouseEvent(nsIFrame* aFrameToHandleEvent,
|
|
|
|
WidgetGUIEvent* aGUIEvent);
|
|
|
|
|
2019-02-08 08:05:45 +03:00
|
|
|
/**
|
|
|
|
* MaybeFlushThrottledStyles() tries to flush pending animation. If it's
|
|
|
|
* flushed and then aFrameForPresShell is destroyed, returns new frame
|
|
|
|
* which contains mPresShell.
|
|
|
|
*
|
2019-03-13 13:32:36 +03:00
|
|
|
* @param aFrameForPresShell The frame for PresShell. See
|
|
|
|
* explanation of HandleEvent() for the
|
|
|
|
* details. This can be nullptr.
|
2019-02-08 08:05:45 +03:00
|
|
|
* @return Maybe new frame for mPresShell.
|
|
|
|
* If aFrameForPresShell is not nullptr
|
|
|
|
* and hasn't been destroyed, returns
|
|
|
|
* aFrameForPresShell as-is.
|
|
|
|
*/
|
|
|
|
MOZ_CAN_RUN_SCRIPT
|
|
|
|
nsIFrame* MaybeFlushThrottledStyles(nsIFrame* aFrameForPresShell);
|
|
|
|
|
2019-02-08 10:11:01 +03:00
|
|
|
/**
|
|
|
|
* ComputeRootFrameToHandleEvent() returns root frame to handle the event.
|
|
|
|
* For example, if there is a popup, this returns the popup frame.
|
|
|
|
* If there is capturing content and it's in a scrolled frame, returns
|
|
|
|
* the scrolled frame.
|
|
|
|
*
|
2019-03-13 13:32:36 +03:00
|
|
|
* @param aFrameForPresShell The frame for PresShell. See
|
|
|
|
* explanation of HandleEvent() for
|
|
|
|
* the details.
|
2019-02-08 10:11:01 +03:00
|
|
|
* @param aGUIEvent The handling event.
|
|
|
|
* @param aCapturingContent Capturing content if there is.
|
|
|
|
* nullptr, otherwise.
|
|
|
|
* @param aIsCapturingContentIgnored [out] true if aCapturingContent
|
|
|
|
* is not nullptr but it should be
|
|
|
|
* ignored to handle the event.
|
|
|
|
* @param aIsCaptureRetargeted [out] true if aCapturingContent
|
|
|
|
* is not nullptr but it's
|
|
|
|
* retargeted.
|
|
|
|
* @return Root frame to handle the event.
|
|
|
|
*/
|
|
|
|
nsIFrame* ComputeRootFrameToHandleEvent(nsIFrame* aFrameForPresShell,
|
|
|
|
WidgetGUIEvent* aGUIEvent,
|
|
|
|
nsIContent* aCapturingContent,
|
|
|
|
bool* aIsCapturingContentIgnored,
|
|
|
|
bool* aIsCaptureRetargeted);
|
|
|
|
|
2019-02-09 02:10:13 +03:00
|
|
|
/**
|
|
|
|
* ComputeRootFrameToHandleEventWithPopup() returns popup frame if there
|
|
|
|
* is a popup and we should handle the event in it. Otherwise, returns
|
|
|
|
* aRootFrameToHandleEvent.
|
|
|
|
*
|
|
|
|
* @param aRootFrameToHandleEvent Candidate root frame to handle
|
|
|
|
* the event.
|
|
|
|
* @param aGUIEvent The handling event.
|
|
|
|
* @param aCapturingContent Capturing content if there is.
|
|
|
|
* nullptr, otherwise.
|
|
|
|
* @param aIsCapturingContentIgnored [out] true if aCapturingContent
|
|
|
|
* is not nullptr but it should be
|
|
|
|
* ignored to handle the event.
|
|
|
|
* @return A popup frame if there is a
|
|
|
|
* popup and we should handle the
|
|
|
|
* event in it. Otherwise,
|
|
|
|
* aRootFrameToHandleEvent.
|
|
|
|
* I.e., never returns nullptr.
|
|
|
|
*/
|
|
|
|
nsIFrame* ComputeRootFrameToHandleEventWithPopup(
|
|
|
|
nsIFrame* aRootFrameToHandleEvent, WidgetGUIEvent* aGUIEvent,
|
|
|
|
nsIContent* aCapturingContent, bool* aIsCapturingContentIgnored);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* ComputeRootFrameToHandleEventWithCapturingContent() returns root frame
|
|
|
|
* to handle event for the capturing content, or aRootFrameToHandleEvent
|
|
|
|
* if it should be ignored.
|
|
|
|
*
|
|
|
|
* @param aRootFrameToHandleEvent Candidate root frame to handle
|
|
|
|
* the event.
|
|
|
|
* @param aCapturingContent Capturing content. nullptr is
|
|
|
|
* not allowed.
|
|
|
|
* @param aIsCapturingContentIgnored [out] true if aCapturingContent
|
|
|
|
* is not nullptr but it should be
|
|
|
|
* ignored to handle the event.
|
|
|
|
* @param aIsCaptureRetargeted [out] true if aCapturingContent
|
|
|
|
* is not nullptr but it's
|
|
|
|
* retargeted.
|
|
|
|
* @return A popup frame if there is a
|
|
|
|
* popup and we should handle the
|
|
|
|
* event in it. Otherwise,
|
|
|
|
* aRootFrameToHandleEvent.
|
|
|
|
* I.e., never returns nullptr.
|
|
|
|
*/
|
|
|
|
nsIFrame* ComputeRootFrameToHandleEventWithCapturingContent(
|
|
|
|
nsIFrame* aRootFrameToHandleEvent, nsIContent* aCapturingContent,
|
|
|
|
bool* aIsCapturingContentIgnored, bool* aIsCaptureRetargeted);
|
|
|
|
|
2019-02-12 07:10:33 +03:00
|
|
|
/**
|
|
|
|
* HandleEventWithPointerCapturingContentWithoutItsFrame() handles
|
|
|
|
* aGUIEvent with aPointerCapturingContent when it does not have primary
|
|
|
|
* frame.
|
|
|
|
*
|
2019-03-13 13:32:36 +03:00
|
|
|
* @param aFrameForPresShell The frame for PresShell. See
|
|
|
|
* explanation of HandleEvent() for the
|
|
|
|
* details.
|
2019-02-12 07:10:33 +03:00
|
|
|
* @param aGUIEvent The handling event.
|
|
|
|
* @param aPointerCapturingContent Current pointer capturing content.
|
|
|
|
* Must not be nullptr.
|
|
|
|
* @param aEventStatus [in/out] The event status of aGUIEvent.
|
|
|
|
* @return Basically, result of
|
|
|
|
* HandeEventWithTraget().
|
|
|
|
*/
|
|
|
|
MOZ_CAN_RUN_SCRIPT
|
|
|
|
nsresult HandleEventWithPointerCapturingContentWithoutItsFrame(
|
|
|
|
nsIFrame* aFrameForPresShell, WidgetGUIEvent* aGUIEvent,
|
|
|
|
nsIContent* aPointerCapturingContent, nsEventStatus* aEventStatus);
|
|
|
|
|
2019-03-06 09:03:31 +03:00
|
|
|
/**
|
|
|
|
* HandleEventAtFocusedContent() handles aGUIEvent at focused content.
|
|
|
|
*
|
|
|
|
* @param aGUIEvent The handling event which should be handled at
|
|
|
|
* focused content.
|
|
|
|
* @param aEventStatus [in/out] The event status of aGUIEvent.
|
|
|
|
*/
|
|
|
|
MOZ_CAN_RUN_SCRIPT
|
|
|
|
nsresult HandleEventAtFocusedContent(WidgetGUIEvent* aGUIEvent,
|
|
|
|
nsEventStatus* aEventStatus);
|
|
|
|
|
2019-03-04 09:11:41 +03:00
|
|
|
/**
|
|
|
|
* ComputeFocusedEventTargetElement() returns event target element for
|
|
|
|
* aGUIEvent which should be handled with focused content.
|
|
|
|
* This may set/unset sLastKeyDownEventTarget if necessary.
|
|
|
|
*
|
|
|
|
* @param aGUIEvent The handling event.
|
|
|
|
* @return The element which should be the event
|
|
|
|
* target of aGUIEvent.
|
|
|
|
*/
|
2019-03-29 18:11:22 +03:00
|
|
|
dom::Element* ComputeFocusedEventTargetElement(WidgetGUIEvent* aGUIEvent);
|
2019-03-04 09:11:41 +03:00
|
|
|
|
2019-03-05 09:09:02 +03:00
|
|
|
/**
|
|
|
|
* MaybeHandleEventWithAnotherPresShell() may handle aGUIEvent with another
|
|
|
|
* PresShell.
|
|
|
|
*
|
|
|
|
* @param aEventTargetElement The event target element of aGUIEvent.
|
|
|
|
* @param aGUIEvent Handling event.
|
|
|
|
* @param aEventStatus [in/out] EventStatus of aGUIEvent.
|
|
|
|
* @param aRv [out] Returns error if this gets an
|
|
|
|
* error handling the event.
|
|
|
|
* @return false if caller needs to keep handling
|
|
|
|
* the event by itself.
|
|
|
|
* true if caller shouldn't keep handling
|
|
|
|
* the event. Note that when no PresShell
|
|
|
|
* can handle the event, this returns true.
|
|
|
|
*/
|
|
|
|
MOZ_CAN_RUN_SCRIPT
|
2019-03-29 18:11:22 +03:00
|
|
|
bool MaybeHandleEventWithAnotherPresShell(dom::Element* aEventTargetElement,
|
2019-03-05 09:09:02 +03:00
|
|
|
WidgetGUIEvent* aGUIEvent,
|
|
|
|
nsEventStatus* aEventStatus,
|
|
|
|
nsresult* aRv);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* HandleRetargetedEvent() dispatches aGUIEvent on the PresShell without
|
|
|
|
* retargetting. This should be used only when caller computes final
|
|
|
|
* target of aGUIEvent.
|
|
|
|
*
|
|
|
|
* @param aGUIEvent Event to be dispatched.
|
|
|
|
* @param aEventStatus [in/out] EventStatus of aGUIEvent.
|
|
|
|
* @param aTarget The final target of aGUIEvent.
|
|
|
|
*/
|
|
|
|
MOZ_CAN_RUN_SCRIPT
|
|
|
|
nsresult HandleRetargetedEvent(WidgetGUIEvent* aGUIEvent,
|
|
|
|
nsEventStatus* aEventStatus,
|
|
|
|
nsIContent* aTarget) {
|
|
|
|
AutoCurrentEventInfoSetter eventInfoSetter(*this, nullptr, aTarget);
|
|
|
|
if (!mPresShell->GetCurrentEventFrame()) {
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
nsCOMPtr<nsIContent> overrideClickTarget;
|
Bug 1466208 - part 44: Rename PresShell::EventHandler::HandleEventInternal() to HandleEventWithCurrentEventInfo() r=smaug
In my understanding, `PresShell::EventHandler::HandleEvent()` may redirect
the event to another class or PresShell first. Otherwise, it computes
event target and sets current event info of mPresShell to it. Then, calls
`HandleEventInternal()` to dispatch the event. Then, `HandleEventInternal()`
may handle the event before dispatch, and/or prepare to dispatch, then,
finally dispatches the event and finalize the state of mPresShell and the
event. Therefore, `HandleEventInternal()` actually handles the event, but
the word, "internal" is not explicitly explain its different points from
`HandleEvent()`. Therefore, I think that `HandleEventWithCurrentEventInfo()`
is better name since `HandleEvent()` considers the current event info.
Differential Revision: https://phabricator.services.mozilla.com/D22462
--HG--
extra : moz-landing-system : lando
2019-03-12 07:25:13 +03:00
|
|
|
return HandleEventWithCurrentEventInfo(aGUIEvent, aEventStatus, true,
|
|
|
|
overrideClickTarget);
|
2019-03-05 09:09:02 +03:00
|
|
|
}
|
|
|
|
|
2019-03-06 09:03:31 +03:00
|
|
|
/**
|
|
|
|
* HandleEventWithFrameForPresShell() handles aGUIEvent with the frame
|
|
|
|
* for mPresShell.
|
|
|
|
*
|
|
|
|
* @param aFrameForPresShell The frame for mPresShell.
|
|
|
|
* @param aGUIEvent The handling event. It shouldn't be
|
|
|
|
* handled with using coordinates nor
|
|
|
|
* handled at focused content.
|
|
|
|
* @param aEventStatus [in/out] The status of aGUIEvent.
|
|
|
|
*/
|
|
|
|
MOZ_CAN_RUN_SCRIPT
|
|
|
|
nsresult HandleEventWithFrameForPresShell(nsIFrame* aFrameForPresShell,
|
|
|
|
WidgetGUIEvent* aGUIEvent,
|
|
|
|
nsEventStatus* aEventStatus);
|
|
|
|
|
Bug 1466208 - part 1: Create stack class to handle events in PresShell r=smaug
PresShell::HandleEvent() and PresShell::HandleEventInternal() are too big.
Additionally, we have a lot of methods used only by them. So, if we'll
split those big methods, PresShell will have a lot of small methods which
are not grouped as a part of event handling. That's too bad because some
of them may depend on the calling order, etc.
So, for grouping them, PresShell should create a stack class instance to handle
each event. Then, we can store shared information in it only while we're
handling an event.
This patch creates PresShell::EventHandler and PresShell methods become
wrappers of the stack class, but this patch does not change any logic in the
code, i.e., just reorganizing existing methods.
Note that HandleEventWithTarget() and HandleEventInternal() need to take
WidgetEvent rather than WidgetGUIEvent. Additionally, some other methods
require WidgetGUIEvent to refer WidgetGUIEvent::mWidget. Therefore, this
patch does not make the new class store the event as a member.
Differential Revision: https://phabricator.services.mozilla.com/D16951
--HG--
extra : moz-landing-system : lando
2019-01-29 09:04:05 +03:00
|
|
|
/**
|
Bug 1466208 - part 44: Rename PresShell::EventHandler::HandleEventInternal() to HandleEventWithCurrentEventInfo() r=smaug
In my understanding, `PresShell::EventHandler::HandleEvent()` may redirect
the event to another class or PresShell first. Otherwise, it computes
event target and sets current event info of mPresShell to it. Then, calls
`HandleEventInternal()` to dispatch the event. Then, `HandleEventInternal()`
may handle the event before dispatch, and/or prepare to dispatch, then,
finally dispatches the event and finalize the state of mPresShell and the
event. Therefore, `HandleEventInternal()` actually handles the event, but
the word, "internal" is not explicitly explain its different points from
`HandleEvent()`. Therefore, I think that `HandleEventWithCurrentEventInfo()`
is better name since `HandleEvent()` considers the current event info.
Differential Revision: https://phabricator.services.mozilla.com/D22462
--HG--
extra : moz-landing-system : lando
2019-03-12 07:25:13 +03:00
|
|
|
* HandleEventWithCurrentEventInfo() prepares to dispatch aEvent into the
|
|
|
|
* DOM, dispatches aEvent into the DOM with using current event info of
|
|
|
|
* mPresShell and notifies EventStateManager of that.
|
Bug 1466208 - part 1: Create stack class to handle events in PresShell r=smaug
PresShell::HandleEvent() and PresShell::HandleEventInternal() are too big.
Additionally, we have a lot of methods used only by them. So, if we'll
split those big methods, PresShell will have a lot of small methods which
are not grouped as a part of event handling. That's too bad because some
of them may depend on the calling order, etc.
So, for grouping them, PresShell should create a stack class instance to handle
each event. Then, we can store shared information in it only while we're
handling an event.
This patch creates PresShell::EventHandler and PresShell methods become
wrappers of the stack class, but this patch does not change any logic in the
code, i.e., just reorganizing existing methods.
Note that HandleEventWithTarget() and HandleEventInternal() need to take
WidgetEvent rather than WidgetGUIEvent. Additionally, some other methods
require WidgetGUIEvent to refer WidgetGUIEvent::mWidget. Therefore, this
patch does not make the new class store the event as a member.
Differential Revision: https://phabricator.services.mozilla.com/D16951
--HG--
extra : moz-landing-system : lando
2019-01-29 09:04:05 +03:00
|
|
|
*
|
|
|
|
* @param aEvent Event to be dispatched.
|
|
|
|
* @param aEventStatus [in/out] EventStatus of aEvent.
|
|
|
|
* @param aIsHandlingNativeEvent true if aGUIEvent represents a native
|
|
|
|
* event.
|
|
|
|
* @param aOverrideClickTarget Override click event target.
|
|
|
|
*/
|
|
|
|
MOZ_CAN_RUN_SCRIPT
|
Bug 1466208 - part 44: Rename PresShell::EventHandler::HandleEventInternal() to HandleEventWithCurrentEventInfo() r=smaug
In my understanding, `PresShell::EventHandler::HandleEvent()` may redirect
the event to another class or PresShell first. Otherwise, it computes
event target and sets current event info of mPresShell to it. Then, calls
`HandleEventInternal()` to dispatch the event. Then, `HandleEventInternal()`
may handle the event before dispatch, and/or prepare to dispatch, then,
finally dispatches the event and finalize the state of mPresShell and the
event. Therefore, `HandleEventInternal()` actually handles the event, but
the word, "internal" is not explicitly explain its different points from
`HandleEvent()`. Therefore, I think that `HandleEventWithCurrentEventInfo()`
is better name since `HandleEvent()` considers the current event info.
Differential Revision: https://phabricator.services.mozilla.com/D22462
--HG--
extra : moz-landing-system : lando
2019-03-12 07:25:13 +03:00
|
|
|
nsresult HandleEventWithCurrentEventInfo(WidgetEvent* aEvent,
|
|
|
|
nsEventStatus* aEventStatus,
|
|
|
|
bool aIsHandlingNativeEvent,
|
|
|
|
nsIContent* aOverrideClickTarget);
|
Bug 1466208 - part 1: Create stack class to handle events in PresShell r=smaug
PresShell::HandleEvent() and PresShell::HandleEventInternal() are too big.
Additionally, we have a lot of methods used only by them. So, if we'll
split those big methods, PresShell will have a lot of small methods which
are not grouped as a part of event handling. That's too bad because some
of them may depend on the calling order, etc.
So, for grouping them, PresShell should create a stack class instance to handle
each event. Then, we can store shared information in it only while we're
handling an event.
This patch creates PresShell::EventHandler and PresShell methods become
wrappers of the stack class, but this patch does not change any logic in the
code, i.e., just reorganizing existing methods.
Note that HandleEventWithTarget() and HandleEventInternal() need to take
WidgetEvent rather than WidgetGUIEvent. Additionally, some other methods
require WidgetGUIEvent to refer WidgetGUIEvent::mWidget. Therefore, this
patch does not make the new class store the event as a member.
Differential Revision: https://phabricator.services.mozilla.com/D16951
--HG--
extra : moz-landing-system : lando
2019-01-29 09:04:05 +03:00
|
|
|
|
2019-03-07 09:30:08 +03:00
|
|
|
/**
|
|
|
|
* HandlingTimeAccumulator() may accumulate handling time of telemetry
|
|
|
|
* for each type of events.
|
|
|
|
*/
|
|
|
|
class MOZ_STACK_CLASS HandlingTimeAccumulator final {
|
|
|
|
public:
|
|
|
|
HandlingTimeAccumulator() = delete;
|
|
|
|
HandlingTimeAccumulator(const HandlingTimeAccumulator& aOther) = delete;
|
|
|
|
HandlingTimeAccumulator(const EventHandler& aEventHandler,
|
|
|
|
const WidgetEvent* aEvent);
|
|
|
|
~HandlingTimeAccumulator();
|
|
|
|
|
|
|
|
private:
|
|
|
|
const EventHandler& mEventHandler;
|
|
|
|
const WidgetEvent* mEvent;
|
|
|
|
TimeStamp mHandlingStartTime;
|
|
|
|
};
|
|
|
|
|
2019-03-09 02:41:30 +03:00
|
|
|
/**
|
|
|
|
* RecordEventPreparationPerformance() records event preparation performance
|
2019-03-10 02:38:38 +03:00
|
|
|
* with telemetry only when aEvent is a trusted event.
|
2019-03-09 02:41:30 +03:00
|
|
|
*
|
|
|
|
* @param aEvent The handling event which we've finished
|
|
|
|
* preparing something to dispatch.
|
|
|
|
*/
|
|
|
|
void RecordEventPreparationPerformance(const WidgetEvent* aEvent);
|
|
|
|
|
2019-03-06 09:03:54 +03:00
|
|
|
/**
|
|
|
|
* RecordEventHandlingResponsePerformance() records event handling response
|
|
|
|
* performance with telemetry.
|
|
|
|
*
|
|
|
|
* @param aEvent The handled event.
|
|
|
|
*/
|
|
|
|
void RecordEventHandlingResponsePerformance(const WidgetEvent* aEvent);
|
|
|
|
|
2019-03-10 02:38:38 +03:00
|
|
|
/**
|
|
|
|
* PrepareToDispatchEvent() prepares to dispatch aEvent.
|
|
|
|
*
|
2019-03-26 13:04:43 +03:00
|
|
|
* @param aEvent The handling event.
|
2019-03-27 04:08:23 +03:00
|
|
|
* @param aEventStatus [in/out] The status of aEvent.
|
2019-03-26 13:04:43 +03:00
|
|
|
* @param aIsUserInteraction [out] Set to true if the event is user
|
|
|
|
* interaction. I.e., enough obvious input
|
|
|
|
* to allow to open popup, etc. Otherwise,
|
|
|
|
* set to false.
|
2019-03-27 04:08:23 +03:00
|
|
|
* @param aTouchIsNew [out] Set to true if the event is an
|
|
|
|
* eTouchMove event and it represents new
|
|
|
|
* touch. Otherwise, set to false.
|
2019-03-26 13:04:43 +03:00
|
|
|
* @return true if the caller can dispatch the
|
|
|
|
* event into the DOM.
|
2019-03-10 02:38:38 +03:00
|
|
|
*/
|
|
|
|
MOZ_CAN_RUN_SCRIPT
|
2019-03-27 04:08:23 +03:00
|
|
|
bool PrepareToDispatchEvent(WidgetEvent* aEvent,
|
|
|
|
nsEventStatus* aEventStatus,
|
|
|
|
bool* aIsUserInteraction, bool* aTouchIsNew);
|
2019-03-10 02:38:38 +03:00
|
|
|
|
2019-03-08 15:46:17 +03:00
|
|
|
/**
|
|
|
|
* MaybeHandleKeyboardEventBeforeDispatch() may handle aKeyboardEvent
|
|
|
|
* if it should do something before dispatched into the DOM.
|
|
|
|
*
|
|
|
|
* @param aKeyboardEvent The handling keyboard event.
|
|
|
|
*/
|
|
|
|
MOZ_CAN_RUN_SCRIPT
|
|
|
|
void MaybeHandleKeyboardEventBeforeDispatch(
|
|
|
|
WidgetKeyboardEvent* aKeyboardEvent);
|
|
|
|
|
Bug 1466208 - part 1: Create stack class to handle events in PresShell r=smaug
PresShell::HandleEvent() and PresShell::HandleEventInternal() are too big.
Additionally, we have a lot of methods used only by them. So, if we'll
split those big methods, PresShell will have a lot of small methods which
are not grouped as a part of event handling. That's too bad because some
of them may depend on the calling order, etc.
So, for grouping them, PresShell should create a stack class instance to handle
each event. Then, we can store shared information in it only while we're
handling an event.
This patch creates PresShell::EventHandler and PresShell methods become
wrappers of the stack class, but this patch does not change any logic in the
code, i.e., just reorganizing existing methods.
Note that HandleEventWithTarget() and HandleEventInternal() need to take
WidgetEvent rather than WidgetGUIEvent. Additionally, some other methods
require WidgetGUIEvent to refer WidgetGUIEvent::mWidget. Therefore, this
patch does not make the new class store the event as a member.
Differential Revision: https://phabricator.services.mozilla.com/D16951
--HG--
extra : moz-landing-system : lando
2019-01-29 09:04:05 +03:00
|
|
|
/**
|
|
|
|
* This and the next two helper methods are used to target and position the
|
|
|
|
* context menu when the keyboard shortcut is used to open it.
|
|
|
|
*
|
|
|
|
* If another menu is open, the context menu is opened relative to the
|
|
|
|
* active menuitem within the menu, or the menu itself if no item is active.
|
|
|
|
* Otherwise, if the caret is visible, the menu is opened near the caret.
|
|
|
|
* Otherwise, if a selectable list such as a listbox is focused, the
|
|
|
|
* current item within the menu is opened relative to this item.
|
|
|
|
* Otherwise, the context menu is opened at the topleft corner of the
|
|
|
|
* view.
|
|
|
|
*
|
|
|
|
* Returns true if the context menu event should fire and false if it should
|
|
|
|
* not.
|
|
|
|
*/
|
|
|
|
bool AdjustContextMenuKeyEvent(WidgetMouseEvent* aMouseEvent);
|
|
|
|
|
|
|
|
bool PrepareToUseCaretPosition(nsIWidget* aEventWidget,
|
|
|
|
LayoutDeviceIntPoint& aTargetPt);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the selected item and coordinates in device pixels relative to root
|
|
|
|
* document's root view for element, first ensuring the element is onscreen.
|
|
|
|
*/
|
|
|
|
void GetCurrentItemAndPositionForElement(dom::Element* aFocusedElement,
|
|
|
|
nsIContent** aTargetToUse,
|
|
|
|
LayoutDeviceIntPoint& aTargetPt,
|
|
|
|
nsIWidget* aRootWidget);
|
|
|
|
|
|
|
|
nsIContent* GetOverrideClickTarget(WidgetGUIEvent* aGUIEvent,
|
|
|
|
nsIFrame* aFrame);
|
|
|
|
|
2019-03-10 02:39:16 +03:00
|
|
|
/**
|
|
|
|
* DispatchEvent() tries to dispatch aEvent and notifies aEventStateManager
|
|
|
|
* of doing it.
|
|
|
|
*
|
|
|
|
* @param aEventStateManager EventStateManager which should handle
|
|
|
|
* the event before/after dispatching
|
|
|
|
* aEvent into the DOM.
|
|
|
|
* @param aEvent The handling event.
|
|
|
|
* @param aTouchIsNew Set this to true when the message is
|
|
|
|
* eTouchMove and it's newly touched.
|
|
|
|
* Then, the "touchmove" event becomes
|
|
|
|
* cancelable.
|
|
|
|
* @param aEventStatus [in/out] The status of aEvent.
|
|
|
|
* @param aOverrideClickTarget Override click event target.
|
|
|
|
*/
|
|
|
|
MOZ_CAN_RUN_SCRIPT
|
|
|
|
nsresult DispatchEvent(EventStateManager* aEventStateManager,
|
|
|
|
WidgetEvent* aEvent, bool aTouchIsNew,
|
|
|
|
nsEventStatus* aEventStatus,
|
|
|
|
nsIContent* aOverrideClickTarget);
|
|
|
|
|
Bug 1466208 - part 1: Create stack class to handle events in PresShell r=smaug
PresShell::HandleEvent() and PresShell::HandleEventInternal() are too big.
Additionally, we have a lot of methods used only by them. So, if we'll
split those big methods, PresShell will have a lot of small methods which
are not grouped as a part of event handling. That's too bad because some
of them may depend on the calling order, etc.
So, for grouping them, PresShell should create a stack class instance to handle
each event. Then, we can store shared information in it only while we're
handling an event.
This patch creates PresShell::EventHandler and PresShell methods become
wrappers of the stack class, but this patch does not change any logic in the
code, i.e., just reorganizing existing methods.
Note that HandleEventWithTarget() and HandleEventInternal() need to take
WidgetEvent rather than WidgetGUIEvent. Additionally, some other methods
require WidgetGUIEvent to refer WidgetGUIEvent::mWidget. Therefore, this
patch does not make the new class store the event as a member.
Differential Revision: https://phabricator.services.mozilla.com/D16951
--HG--
extra : moz-landing-system : lando
2019-01-29 09:04:05 +03:00
|
|
|
/**
|
|
|
|
* DispatchEventToDOM() actually dispatches aEvent into the DOM tree.
|
|
|
|
*
|
|
|
|
* @param aEvent Event to be dispatched into the DOM tree.
|
|
|
|
* @param aEventStatus [in/out] EventStatus of aEvent.
|
|
|
|
* @param aEventCB The callback kicked when the event moves
|
|
|
|
* from the default group to the system group.
|
|
|
|
*/
|
|
|
|
nsresult DispatchEventToDOM(WidgetEvent* aEvent,
|
|
|
|
nsEventStatus* aEventStatus,
|
|
|
|
nsPresShellEventCB* aEventCB);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* DispatchTouchEventToDOM() dispatches touch events into the DOM tree.
|
|
|
|
*
|
|
|
|
* @param aEvent The source of events to be dispatched into the
|
|
|
|
* DOM tree.
|
|
|
|
* @param aEventStatus [in/out] EventStatus of aEvent.
|
|
|
|
* @param aEventCB The callback kicked when the events move
|
|
|
|
* from the default group to the system group.
|
|
|
|
* @param aTouchIsNew Set this to true when the message is eTouchMove
|
|
|
|
* and it's newly touched. Then, the "touchmove"
|
|
|
|
* event becomes cancelable.
|
|
|
|
*/
|
|
|
|
void DispatchTouchEventToDOM(WidgetEvent* aEvent,
|
|
|
|
nsEventStatus* aEventStatus,
|
|
|
|
nsPresShellEventCB* aEventCB,
|
|
|
|
bool aTouchIsNew);
|
|
|
|
|
2019-03-11 04:52:40 +03:00
|
|
|
/**
|
|
|
|
* FinalizeHandlingEvent() should be called after calling DispatchEvent()
|
|
|
|
* and then, this cleans up the state of mPresShell and aEvent.
|
|
|
|
*
|
|
|
|
* @param aEvent The handled event.
|
|
|
|
*/
|
|
|
|
void FinalizeHandlingEvent(WidgetEvent* aEvent);
|
|
|
|
|
2019-03-04 09:12:22 +03:00
|
|
|
/**
|
|
|
|
* AutoCurrentEventInfoSetter() pushes and pops current event info of
|
|
|
|
* aEventHandler.mPresShell.
|
|
|
|
*/
|
|
|
|
struct MOZ_STACK_CLASS AutoCurrentEventInfoSetter final {
|
|
|
|
explicit AutoCurrentEventInfoSetter(EventHandler& aEventHandler)
|
|
|
|
: mEventHandler(aEventHandler) {
|
|
|
|
MOZ_DIAGNOSTIC_ASSERT(!mEventHandler.mCurrentEventInfoSetter);
|
|
|
|
mEventHandler.mCurrentEventInfoSetter = this;
|
|
|
|
mEventHandler.mPresShell->PushCurrentEventInfo(nullptr, nullptr);
|
|
|
|
}
|
|
|
|
AutoCurrentEventInfoSetter(EventHandler& aEventHandler, nsIFrame* aFrame,
|
|
|
|
nsIContent* aContent)
|
|
|
|
: mEventHandler(aEventHandler) {
|
|
|
|
MOZ_DIAGNOSTIC_ASSERT(!mEventHandler.mCurrentEventInfoSetter);
|
|
|
|
mEventHandler.mCurrentEventInfoSetter = this;
|
|
|
|
mEventHandler.mPresShell->PushCurrentEventInfo(aFrame, aContent);
|
|
|
|
}
|
|
|
|
AutoCurrentEventInfoSetter(EventHandler& aEventHandler,
|
|
|
|
EventTargetData& aEventTargetData)
|
|
|
|
: mEventHandler(aEventHandler) {
|
|
|
|
MOZ_DIAGNOSTIC_ASSERT(!mEventHandler.mCurrentEventInfoSetter);
|
|
|
|
mEventHandler.mCurrentEventInfoSetter = this;
|
|
|
|
mEventHandler.mPresShell->PushCurrentEventInfo(
|
|
|
|
aEventTargetData.mFrame, aEventTargetData.mContent);
|
|
|
|
}
|
|
|
|
~AutoCurrentEventInfoSetter() {
|
|
|
|
mEventHandler.mPresShell->PopCurrentEventInfo();
|
|
|
|
mEventHandler.mCurrentEventInfoSetter = nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
EventHandler& mEventHandler;
|
|
|
|
};
|
|
|
|
|
Bug 1466208 - part 1: Create stack class to handle events in PresShell r=smaug
PresShell::HandleEvent() and PresShell::HandleEventInternal() are too big.
Additionally, we have a lot of methods used only by them. So, if we'll
split those big methods, PresShell will have a lot of small methods which
are not grouped as a part of event handling. That's too bad because some
of them may depend on the calling order, etc.
So, for grouping them, PresShell should create a stack class instance to handle
each event. Then, we can store shared information in it only while we're
handling an event.
This patch creates PresShell::EventHandler and PresShell methods become
wrappers of the stack class, but this patch does not change any logic in the
code, i.e., just reorganizing existing methods.
Note that HandleEventWithTarget() and HandleEventInternal() need to take
WidgetEvent rather than WidgetGUIEvent. Additionally, some other methods
require WidgetGUIEvent to refer WidgetGUIEvent::mWidget. Therefore, this
patch does not make the new class store the event as a member.
Differential Revision: https://phabricator.services.mozilla.com/D16951
--HG--
extra : moz-landing-system : lando
2019-01-29 09:04:05 +03:00
|
|
|
/**
|
|
|
|
* Wrapper methods to access methods of mPresShell.
|
|
|
|
*/
|
|
|
|
nsPresContext* GetPresContext() const {
|
|
|
|
return mPresShell->GetPresContext();
|
|
|
|
}
|
|
|
|
Document* GetDocument() const { return mPresShell->GetDocument(); }
|
|
|
|
nsCSSFrameConstructor* FrameConstructor() const {
|
|
|
|
return mPresShell->FrameConstructor();
|
|
|
|
}
|
|
|
|
already_AddRefed<nsPIDOMWindowOuter> GetFocusedDOMWindowInOurWindow() {
|
|
|
|
return mPresShell->GetFocusedDOMWindowInOurWindow();
|
|
|
|
}
|
2019-04-13 04:03:13 +03:00
|
|
|
already_AddRefed<PresShell> GetParentPresShellForEventHandling() {
|
Bug 1466208 - part 1: Create stack class to handle events in PresShell r=smaug
PresShell::HandleEvent() and PresShell::HandleEventInternal() are too big.
Additionally, we have a lot of methods used only by them. So, if we'll
split those big methods, PresShell will have a lot of small methods which
are not grouped as a part of event handling. That's too bad because some
of them may depend on the calling order, etc.
So, for grouping them, PresShell should create a stack class instance to handle
each event. Then, we can store shared information in it only while we're
handling an event.
This patch creates PresShell::EventHandler and PresShell methods become
wrappers of the stack class, but this patch does not change any logic in the
code, i.e., just reorganizing existing methods.
Note that HandleEventWithTarget() and HandleEventInternal() need to take
WidgetEvent rather than WidgetGUIEvent. Additionally, some other methods
require WidgetGUIEvent to refer WidgetGUIEvent::mWidget. Therefore, this
patch does not make the new class store the event as a member.
Differential Revision: https://phabricator.services.mozilla.com/D16951
--HG--
extra : moz-landing-system : lando
2019-01-29 09:04:05 +03:00
|
|
|
return mPresShell->GetParentPresShellForEventHandling();
|
|
|
|
}
|
|
|
|
void PushDelayedEventIntoQueue(UniquePtr<DelayedEvent>&& aDelayedEvent) {
|
|
|
|
mPresShell->mDelayedEvents.AppendElement(std::move(aDelayedEvent));
|
|
|
|
}
|
|
|
|
|
|
|
|
OwningNonNull<PresShell> mPresShell;
|
2019-03-04 09:12:22 +03:00
|
|
|
AutoCurrentEventInfoSetter* mCurrentEventInfoSetter;
|
Bug 1466208 - part 1: Create stack class to handle events in PresShell r=smaug
PresShell::HandleEvent() and PresShell::HandleEventInternal() are too big.
Additionally, we have a lot of methods used only by them. So, if we'll
split those big methods, PresShell will have a lot of small methods which
are not grouped as a part of event handling. That's too bad because some
of them may depend on the calling order, etc.
So, for grouping them, PresShell should create a stack class instance to handle
each event. Then, we can store shared information in it only while we're
handling an event.
This patch creates PresShell::EventHandler and PresShell methods become
wrappers of the stack class, but this patch does not change any logic in the
code, i.e., just reorganizing existing methods.
Note that HandleEventWithTarget() and HandleEventInternal() need to take
WidgetEvent rather than WidgetGUIEvent. Additionally, some other methods
require WidgetGUIEvent to refer WidgetGUIEvent::mWidget. Therefore, this
patch does not make the new class store the event as a member.
Differential Revision: https://phabricator.services.mozilla.com/D16951
--HG--
extra : moz-landing-system : lando
2019-01-29 09:04:05 +03:00
|
|
|
static TimeStamp sLastInputCreated;
|
|
|
|
static TimeStamp sLastInputProcessed;
|
2019-03-29 18:11:22 +03:00
|
|
|
static StaticRefPtr<dom::Element> sLastKeyDownEventTargetElement;
|
Bug 1466208 - part 1: Create stack class to handle events in PresShell r=smaug
PresShell::HandleEvent() and PresShell::HandleEventInternal() are too big.
Additionally, we have a lot of methods used only by them. So, if we'll
split those big methods, PresShell will have a lot of small methods which
are not grouped as a part of event handling. That's too bad because some
of them may depend on the calling order, etc.
So, for grouping them, PresShell should create a stack class instance to handle
each event. Then, we can store shared information in it only while we're
handling an event.
This patch creates PresShell::EventHandler and PresShell methods become
wrappers of the stack class, but this patch does not change any logic in the
code, i.e., just reorganizing existing methods.
Note that HandleEventWithTarget() and HandleEventInternal() need to take
WidgetEvent rather than WidgetGUIEvent. Additionally, some other methods
require WidgetGUIEvent to refer WidgetGUIEvent::mWidget. Therefore, this
patch does not make the new class store the event as a member.
Differential Revision: https://phabricator.services.mozilla.com/D16951
--HG--
extra : moz-landing-system : lando
2019-01-29 09:04:05 +03:00
|
|
|
};
|
2011-09-09 23:50:21 +04:00
|
|
|
|
2012-05-16 21:32:40 +04:00
|
|
|
PresShell* GetRootPresShell();
|
|
|
|
|
|
|
|
nscolor GetDefaultBackgroundColorToDraw();
|
|
|
|
|
|
|
|
// The callback for the mPaintSuppressionTimer timer.
|
|
|
|
static void sPaintSuppressionCallback(nsITimer* aTimer, void* aPresShell);
|
|
|
|
|
2018-03-07 14:13:17 +03:00
|
|
|
void PausePainting() override;
|
|
|
|
void ResumePainting() override;
|
2016-01-21 09:55:37 +03:00
|
|
|
|
2016-03-26 00:49:43 +03:00
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Approximate frame visibility tracking implementation.
|
|
|
|
//////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
void UpdateApproximateFrameVisibility();
|
|
|
|
void DoUpdateApproximateFrameVisibility(bool aRemoveOnly);
|
|
|
|
|
2018-03-07 14:13:17 +03:00
|
|
|
void ClearApproximatelyVisibleFramesList(
|
|
|
|
const Maybe<OnNonvisible>& aNonvisibleAction = Nothing());
|
2016-09-12 08:19:08 +03:00
|
|
|
static void ClearApproximateFrameVisibilityVisited(nsView* aView,
|
|
|
|
bool aClear);
|
2018-03-12 21:17:34 +03:00
|
|
|
static void MarkFramesInListApproximatelyVisible(const nsDisplayList& aList);
|
2016-03-26 00:49:43 +03:00
|
|
|
void MarkFramesInSubtreeApproximatelyVisible(nsIFrame* aFrame,
|
|
|
|
const nsRect& aRect,
|
|
|
|
bool aRemoveOnly = false);
|
2013-02-25 04:59:22 +04:00
|
|
|
|
2016-09-12 08:19:08 +03:00
|
|
|
void DecApproximateVisibleCount(
|
|
|
|
VisibleFrames& aFrames,
|
2017-02-13 20:07:40 +03:00
|
|
|
const Maybe<OnNonvisible>& aNonvisibleAction = Nothing());
|
2016-04-21 11:21:58 +03:00
|
|
|
|
2016-03-26 00:49:43 +03:00
|
|
|
nsRevocableEventPtr<nsRunnableMethod<PresShell>>
|
|
|
|
mUpdateApproximateFrameVisibilityEvent;
|
|
|
|
|
2016-07-26 21:48:00 +03:00
|
|
|
// A set of frames that were visible or could be visible soon at the time
|
|
|
|
// that we last did an approximate frame visibility update.
|
|
|
|
VisibleFrames mApproximatelyVisibleFrames;
|
2016-03-26 00:49:43 +03:00
|
|
|
|
2018-12-05 19:29:18 +03:00
|
|
|
nsresult SetResolutionImpl(float aResolution, bool aScaleToResolution,
|
|
|
|
nsAtom* aOrigin);
|
2015-01-03 04:06:14 +03:00
|
|
|
|
2011-09-09 23:50:21 +04:00
|
|
|
// This is used for synthetic mouse events that are sent when what is under
|
|
|
|
// the mouse pointer may have changed without the mouse moving (eg scrolling,
|
|
|
|
// change to the document contents).
|
|
|
|
// It is set only on a presshell for a root document, this value represents
|
|
|
|
// the last observed location of the mouse relative to that root document. It
|
|
|
|
// is set to (NS_UNCONSTRAINEDSIZE, NS_UNCONSTRAINEDSIZE) if the mouse isn't
|
|
|
|
// over our window or there is no last observed mouse location for some
|
|
|
|
// reason.
|
2018-03-07 14:13:17 +03:00
|
|
|
nsPoint mMouseLocation;
|
2016-03-11 02:25:49 +03:00
|
|
|
// This is an APZ state variable that tracks the target guid for the last
|
|
|
|
// mouse event that was processed (corresponding to mMouseLocation). This is
|
|
|
|
// needed for the synthetic mouse events.
|
2018-03-07 14:13:17 +03:00
|
|
|
layers::ScrollableLayerGuid mMouseEventTargetGuid;
|
2012-01-10 09:23:29 +04:00
|
|
|
|
2018-11-15 10:40:52 +03:00
|
|
|
nsTArray<UniquePtr<DelayedEvent>> mDelayedEvents;
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2013-03-08 15:04:53 +04:00
|
|
|
private:
|
2011-09-09 23:50:21 +04:00
|
|
|
nsRevocableEventPtr<nsSynthMouseMoveEvent> mSynthMouseMoveEvent;
|
|
|
|
|
2018-03-07 14:13:17 +03:00
|
|
|
TouchManager mTouchManager;
|
2015-02-20 10:12:00 +03:00
|
|
|
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<ZoomConstraintsClient> mZoomConstraintsClient;
|
2019-04-05 01:11:40 +03:00
|
|
|
RefPtr<GeckoMVMContext> mMVMContext;
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<MobileViewportManager> mMobileViewportManager;
|
2015-06-17 19:32:42 +03:00
|
|
|
|
2012-05-16 21:32:40 +04:00
|
|
|
// This timer controls painting suppression. Until it fires
|
|
|
|
// or all frames are constructed, we won't paint anything but
|
|
|
|
// our <body> background and scrollbars.
|
2018-03-07 14:13:17 +03:00
|
|
|
nsCOMPtr<nsITimer> mPaintSuppressionTimer;
|
2011-09-09 23:50:21 +04:00
|
|
|
|
2018-03-07 14:13:17 +03:00
|
|
|
nsCOMPtr<nsITimer> mDelayedPaintTimer;
|
2014-01-30 09:41:17 +04:00
|
|
|
|
2018-03-07 14:13:17 +03:00
|
|
|
TimeStamp mLoadBegin; // used to time loads
|
2013-11-05 05:03:22 +04:00
|
|
|
|
2015-04-14 18:46:39 +03:00
|
|
|
// Information about live content (which still stay in DOM tree).
|
|
|
|
// Used in case we need re-dispatch event after sending pointer event,
|
|
|
|
// when target of pointer event was deleted during executing user handlers.
|
2018-03-07 14:13:17 +03:00
|
|
|
nsCOMPtr<nsIContent> mPointerEventTarget;
|
2015-04-14 18:46:39 +03:00
|
|
|
|
2018-06-26 00:42:25 +03:00
|
|
|
int32_t mActiveSuppressDisplayport;
|
|
|
|
|
2017-06-28 22:11:04 +03:00
|
|
|
// The focus sequence number of the last processed input event
|
2018-03-07 14:13:17 +03:00
|
|
|
uint64_t mAPZFocusSequenceNumber;
|
2017-06-28 22:11:04 +03:00
|
|
|
// The focus information needed for async keyboard scrolling
|
2018-03-07 14:13:17 +03:00
|
|
|
FocusTarget mAPZFocusTarget;
|
2017-06-28 22:11:04 +03:00
|
|
|
|
2018-03-07 14:13:17 +03:00
|
|
|
bool mDocumentLoading : 1;
|
|
|
|
bool mNoDelayedMouseEvents : 1;
|
|
|
|
bool mNoDelayedKeyEvents : 1;
|
2012-05-16 21:32:40 +04:00
|
|
|
|
2018-03-07 14:13:17 +03:00
|
|
|
bool mApproximateFrameVisibilityVisited : 1;
|
2013-02-25 04:59:22 +04:00
|
|
|
|
2018-03-07 14:13:17 +03:00
|
|
|
bool mNextPaintCompressed : 1;
|
2014-01-30 09:41:17 +04:00
|
|
|
|
2018-03-07 14:13:17 +03:00
|
|
|
bool mHasCSSBackgroundColor : 1;
|
2014-09-23 21:50:00 +04:00
|
|
|
|
2015-01-21 04:16:04 +03:00
|
|
|
// Whether the last chrome-only escape key event is consumed.
|
2018-03-07 14:13:17 +03:00
|
|
|
bool mIsLastChromeOnlyEscapeKeyConsumed : 1;
|
2015-01-21 04:16:04 +03:00
|
|
|
|
2015-06-18 23:42:39 +03:00
|
|
|
// Whether the widget has received a paint message yet.
|
2018-03-07 14:13:17 +03:00
|
|
|
bool mHasReceivedPaintMessage : 1;
|
2015-06-18 23:42:39 +03:00
|
|
|
|
2018-03-07 14:13:17 +03:00
|
|
|
bool mIsLastKeyDownCanceled : 1;
|
2017-02-03 13:16:00 +03:00
|
|
|
|
2017-11-22 01:25:09 +03:00
|
|
|
// Whether we have ever handled a user input event
|
2018-03-07 14:13:17 +03:00
|
|
|
bool mHasHandledUserInput : 1;
|
2017-11-22 01:25:09 +03:00
|
|
|
|
2018-03-23 06:06:55 +03:00
|
|
|
// Whether we should dispatch keypress events even for non-printable keys
|
|
|
|
// for keeping backward compatibility.
|
|
|
|
bool mForceDispatchKeyPressEventsForNonPrintableKeys : 1;
|
2018-11-07 09:39:10 +03:00
|
|
|
// Whether we should set keyCode or charCode value of keypress events whose
|
|
|
|
// value is zero to the other value or not. When this is set to true, we
|
|
|
|
// should keep using legacy keyCode and charCode values (i.e., one of them
|
|
|
|
// is always 0).
|
|
|
|
bool mForceUseLegacyKeyCodeAndCharCodeValues : 1;
|
|
|
|
// Whether mForceDispatchKeyPressEventsForNonPrintableKeys and
|
|
|
|
// mForceUseLegacyKeyCodeAndCharCodeValues are initialized.
|
|
|
|
bool mInitializedWithKeyPressEventDispatchingBlacklist : 1;
|
2018-03-23 06:06:55 +03:00
|
|
|
|
2018-03-07 14:13:17 +03:00
|
|
|
static bool sDisableNonTestMouseEvents;
|
2017-04-19 18:17:20 +03:00
|
|
|
|
2018-03-07 14:13:17 +03:00
|
|
|
TimeStamp mLastOSWake;
|
2017-04-19 22:53:30 +03:00
|
|
|
|
2018-03-07 14:13:17 +03:00
|
|
|
static bool sProcessInteractable;
|
2011-09-09 23:50:21 +04:00
|
|
|
};
|
|
|
|
|
2016-11-30 06:14:27 +03:00
|
|
|
} // namespace mozilla
|
|
|
|
|
2016-11-30 06:14:28 +03:00
|
|
|
#endif // mozilla_PresShell_h
|