Bug 1443753: Tidy PresShell.h. r=dholbert

Summary:
 * Remove unnecessary virtual, since we also override.
 * Remove unnecessary mozilla:: qualification, since we are in the mozilla
   namespace already.
 * Avoid inconsistently-followed member-variable indentation.
 * Make the destructor not virtual, since it doesn't override anything and this
   is a final class (the destructor is called from the virtual Release()).

Reviewers: dholbert

Bug #: 1443753

Differential Revision: https://phabricator.services.mozilla.com/D690

MozReview-Commit-ID: Hy2aKuhoOKd
This commit is contained in:
Emilio Cobos Álvarez 2018-03-07 12:13:17 +01:00
Родитель 73a6a2096e
Коммит 00c01ddc68
1 изменённых файлов: 224 добавлений и 228 удалений

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

@ -60,7 +60,7 @@ typedef nsTHashtable<nsPtrHashKey<nsIFrame>> VisibleFrames;
// A hash table type for tracking visible regions, for use by the visibility // A hash table type for tracking visible regions, for use by the visibility
// code in PresShell. The mapping is from view IDs to regions in the // code in PresShell. The mapping is from view IDs to regions in the
// coordinate system of that view's scrolled frame. // coordinate system of that view's scrolled frame.
typedef nsClassHashtable<nsUint64HashKey, mozilla::CSSIntRegion> VisibleRegions; typedef nsClassHashtable<nsUint64HashKey, CSSIntRegion> VisibleRegions;
// This is actually pref-controlled, but we use this value if we fail // This is actually pref-controlled, but we use this value if we fail
// to get the pref for any reason. // to get the pref for any reason.
@ -75,8 +75,7 @@ class PresShell final : public nsIPresShell,
public nsIObserver, public nsIObserver,
public nsSupportsWeakReference public nsSupportsWeakReference
{ {
protected: typedef layers::FocusTarget FocusTarget;
typedef mozilla::layers::FocusTarget FocusTarget;
public: public:
PresShell(); PresShell();
@ -87,19 +86,20 @@ public:
static bool AccessibleCaretEnabled(nsIDocShell* aDocShell); static bool AccessibleCaretEnabled(nsIDocShell* aDocShell);
void Init(nsIDocument* aDocument, nsPresContext* aPresContext, void Init(nsIDocument* aDocument, nsPresContext* aPresContext,
nsViewManager* aViewManager, mozilla::StyleSetHandle aStyleSet); nsViewManager* aViewManager, StyleSetHandle aStyleSet);
virtual void Destroy() override; void Destroy() override;
virtual void UpdatePreferenceStyles() override; void UpdatePreferenceStyles() override;
NS_IMETHOD GetSelection(RawSelectionType aRawSelectionType, NS_IMETHOD GetSelection(RawSelectionType aRawSelectionType,
nsISelection** aSelection) override; nsISelection** aSelection) override;
dom::Selection* GetDOMSelection(RawSelectionType aRawSelectionType) override; dom::Selection* GetDOMSelection(RawSelectionType aRawSelectionType) override;
virtual mozilla::dom::Selection*
GetCurrentSelection(SelectionType aSelectionType) override; dom::Selection* GetCurrentSelection(SelectionType aSelectionType) override;
virtual already_AddRefed<nsISelectionController>
GetSelectionControllerForFocusedContent( already_AddRefed<nsISelectionController>
nsIContent** aFocusedContent = nullptr) override; GetSelectionControllerForFocusedContent(
nsIContent** aFocusedContent = nullptr) override;
NS_IMETHOD SetDisplaySelection(int16_t aToggle) override; NS_IMETHOD SetDisplaySelection(int16_t aToggle) override;
NS_IMETHOD GetDisplaySelection(int16_t *aToggle) override; NS_IMETHOD GetDisplaySelection(int16_t *aToggle) override;
@ -108,161 +108,160 @@ public:
int16_t aFlags) override; int16_t aFlags) override;
NS_IMETHOD RepaintSelection(RawSelectionType aRawSelectionType) override; NS_IMETHOD RepaintSelection(RawSelectionType aRawSelectionType) override;
virtual nsresult Initialize() override; nsresult Initialize() override;
virtual nsresult ResizeReflow(nscoord aWidth, nscoord aHeight, nsresult ResizeReflow(nscoord aWidth, nscoord aHeight,
nscoord aOldWidth = 0, nscoord aOldHeight = 0, nscoord aOldWidth = 0, nscoord aOldHeight = 0,
ResizeReflowOptions aOptions = ResizeReflowOptions aOptions =
ResizeReflowOptions::eBSizeExact) override; ResizeReflowOptions::eBSizeExact) override;
virtual nsresult ResizeReflowIgnoreOverride(nscoord aWidth, nscoord aHeight, nsresult ResizeReflowIgnoreOverride(nscoord aWidth, nscoord aHeight,
nscoord aOldWidth, nscoord aOldHeight, nscoord aOldWidth, nscoord aOldHeight,
ResizeReflowOptions aOptions = ResizeReflowOptions aOptions =
ResizeReflowOptions::eBSizeExact) override; ResizeReflowOptions::eBSizeExact) override;
virtual nsIPageSequenceFrame* GetPageSequenceFrame() const override; nsIPageSequenceFrame* GetPageSequenceFrame() const override;
virtual nsCanvasFrame* GetCanvasFrame() const override; nsCanvasFrame* GetCanvasFrame() const override;
virtual void FrameNeedsReflow(nsIFrame *aFrame, IntrinsicDirty aIntrinsicDirty, void FrameNeedsReflow(nsIFrame *aFrame, IntrinsicDirty aIntrinsicDirty,
nsFrameState aBitToAdd, nsFrameState aBitToAdd,
ReflowRootHandling aRootHandling = ReflowRootHandling aRootHandling =
eInferFromBitToAdd) override; eInferFromBitToAdd) override;
virtual void FrameNeedsToContinueReflow(nsIFrame *aFrame) override; void FrameNeedsToContinueReflow(nsIFrame *aFrame) override;
virtual void CancelAllPendingReflows() override; void CancelAllPendingReflows() override;
virtual void DoFlushPendingNotifications(mozilla::FlushType aType) override; void DoFlushPendingNotifications(FlushType aType) override;
virtual void DoFlushPendingNotifications(mozilla::ChangesToFlush aType) override; void DoFlushPendingNotifications(ChangesToFlush aType) override;
virtual void DestroyFramesForAndRestyle(mozilla::dom::Element* aElement) override; void DestroyFramesForAndRestyle(dom::Element* aElement) override;
/** /**
* Post a callback that should be handled after reflow has finished. * Post a callback that should be handled after reflow has finished.
*/ */
virtual nsresult PostReflowCallback(nsIReflowCallback* aCallback) override; nsresult PostReflowCallback(nsIReflowCallback* aCallback) override;
virtual void CancelReflowCallback(nsIReflowCallback* aCallback) override; void CancelReflowCallback(nsIReflowCallback* aCallback) override;
virtual void ClearFrameRefs(nsIFrame* aFrame) override; void ClearFrameRefs(nsIFrame* aFrame) override;
virtual already_AddRefed<gfxContext> CreateReferenceRenderingContext() override; already_AddRefed<gfxContext> CreateReferenceRenderingContext() override;
virtual nsresult GoToAnchor(const nsAString& aAnchorName, bool aScroll, nsresult GoToAnchor(const nsAString& aAnchorName, bool aScroll,
uint32_t aAdditionalScrollFlags = 0) override; uint32_t aAdditionalScrollFlags = 0) override;
virtual nsresult ScrollToAnchor() override; nsresult ScrollToAnchor() override;
virtual nsresult ScrollContentIntoView(nsIContent* aContent, nsresult ScrollContentIntoView(nsIContent* aContent,
ScrollAxis aVertical, ScrollAxis aVertical,
ScrollAxis aHorizontal, ScrollAxis aHorizontal,
uint32_t aFlags) override; uint32_t aFlags) override;
virtual bool ScrollFrameRectIntoView(nsIFrame* aFrame, bool ScrollFrameRectIntoView(nsIFrame* aFrame,
const nsRect& aRect, const nsRect& aRect,
ScrollAxis aVertical, ScrollAxis aVertical,
ScrollAxis aHorizontal, ScrollAxis aHorizontal,
uint32_t aFlags) override; uint32_t aFlags) override;
virtual nsRectVisibility GetRectVisibility(nsIFrame *aFrame, nsRectVisibility GetRectVisibility(nsIFrame *aFrame,
const nsRect &aRect, const nsRect &aRect,
nscoord aMinTwips) const override; nscoord aMinTwips) const override;
virtual void SetIgnoreFrameDestruction(bool aIgnore) override; void SetIgnoreFrameDestruction(bool aIgnore) override;
virtual void NotifyDestroyingFrame(nsIFrame* aFrame) override; void NotifyDestroyingFrame(nsIFrame* aFrame) override;
virtual nsresult CaptureHistoryState(nsILayoutHistoryState** aLayoutHistoryState) override; nsresult CaptureHistoryState(nsILayoutHistoryState** aLayoutHistoryState) override;
virtual void UnsuppressPainting() override; void UnsuppressPainting() override;
virtual nsresult GetAgentStyleSheets( nsresult GetAgentStyleSheets(
nsTArray<RefPtr<mozilla::StyleSheet>>& aSheets) override; nsTArray<RefPtr<StyleSheet>>& aSheets) override;
virtual nsresult SetAgentStyleSheets( nsresult SetAgentStyleSheets(
const nsTArray<RefPtr<mozilla::StyleSheet>>& aSheets) override; const nsTArray<RefPtr<StyleSheet>>& aSheets) override;
virtual nsresult AddOverrideStyleSheet(mozilla::StyleSheet* aSheet) override; nsresult AddOverrideStyleSheet(StyleSheet* aSheet) override;
virtual nsresult RemoveOverrideStyleSheet(mozilla::StyleSheet* aSheet) override; nsresult RemoveOverrideStyleSheet(StyleSheet* aSheet) override;
virtual nsresult HandleEventWithTarget( nsresult HandleEventWithTarget(WidgetEvent* aEvent,
mozilla::WidgetEvent* aEvent,
nsIFrame* aFrame, nsIFrame* aFrame,
nsIContent* aContent, nsIContent* aContent,
nsEventStatus* aStatus, nsEventStatus* aStatus,
bool aIsHandlingNativeEvent = false, bool aIsHandlingNativeEvent = false,
nsIContent** aTargetContent = nullptr) override; nsIContent** aTargetContent = nullptr) override;
virtual nsIFrame* GetEventTargetFrame() override; nsIFrame* GetEventTargetFrame() override;
virtual already_AddRefed<nsIContent> GetEventTargetContent( already_AddRefed<nsIContent>
mozilla::WidgetEvent* aEvent) override; GetEventTargetContent(WidgetEvent* aEvent) override;
virtual void NotifyCounterStylesAreDirty() override; void NotifyCounterStylesAreDirty() override;
virtual void ReconstructFrames(void) override; void ReconstructFrames(void) override;
virtual void Freeze() override; void Freeze() override;
virtual void Thaw() override; void Thaw() override;
virtual void FireOrClearDelayedEvents(bool aFireEvents) override; void FireOrClearDelayedEvents(bool aFireEvents) override;
virtual nsresult RenderDocument(const nsRect& aRect, uint32_t aFlags, nsresult RenderDocument(const nsRect& aRect,
nscolor aBackgroundColor, uint32_t aFlags,
gfxContext* aThebesContext) override; nscolor aBackgroundColor,
gfxContext* aThebesContext) override;
virtual already_AddRefed<SourceSurface> already_AddRefed<SourceSurface>
RenderNode(nsIDOMNode* aNode, RenderNode(nsIDOMNode* aNode,
nsIntRegion* aRegion, nsIntRegion* aRegion,
const mozilla::LayoutDeviceIntPoint aPoint, const LayoutDeviceIntPoint aPoint,
mozilla::LayoutDeviceIntRect* aScreenRect, LayoutDeviceIntRect* aScreenRect,
uint32_t aFlags) override; uint32_t aFlags) override;
virtual already_AddRefed<SourceSurface> already_AddRefed<SourceSurface>
RenderSelection(nsISelection* aSelection, RenderSelection(nsISelection* aSelection,
const mozilla::LayoutDeviceIntPoint aPoint, const LayoutDeviceIntPoint aPoint,
mozilla::LayoutDeviceIntRect* aScreenRect, LayoutDeviceIntRect* aScreenRect,
uint32_t aFlags) override; uint32_t aFlags) override;
virtual already_AddRefed<nsPIDOMWindowOuter> GetRootWindow() override; already_AddRefed<nsPIDOMWindowOuter> GetRootWindow() override;
virtual already_AddRefed<nsPIDOMWindowOuter> GetFocusedDOMWindowInOurWindow() override; already_AddRefed<nsPIDOMWindowOuter> GetFocusedDOMWindowInOurWindow() override;
virtual LayerManager* GetLayerManager() override; LayerManager* GetLayerManager() override;
virtual bool AsyncPanZoomEnabled() override; bool AsyncPanZoomEnabled() override;
virtual void SetIgnoreViewportScrolling(bool aIgnore) override; void SetIgnoreViewportScrolling(bool aIgnore) override;
virtual nsresult SetResolution(float aResolution) override { nsresult SetResolution(float aResolution) override {
return SetResolutionImpl(aResolution, /* aScaleToResolution = */ false); return SetResolutionImpl(aResolution, /* aScaleToResolution = */ false);
} }
virtual nsresult SetResolutionAndScaleTo(float aResolution) override { nsresult SetResolutionAndScaleTo(float aResolution) override {
return SetResolutionImpl(aResolution, /* aScaleToResolution = */ true); return SetResolutionImpl(aResolution, /* aScaleToResolution = */ true);
} }
virtual bool ScaleToResolution() const override; bool ScaleToResolution() const override;
virtual float GetCumulativeResolution() override; float GetCumulativeResolution() override;
virtual float GetCumulativeNonRootScaleResolution() override; float GetCumulativeNonRootScaleResolution() override;
virtual void SetRestoreResolution(float aResolution, void SetRestoreResolution(float aResolution,
mozilla::LayoutDeviceIntSize aDisplaySize) override; LayoutDeviceIntSize aDisplaySize) override;
//nsIViewObserver interface //nsIViewObserver interface
virtual void Paint(nsView* aViewToPaint, const nsRegion& aDirtyRegion, void Paint(nsView* aViewToPaint, const nsRegion& aDirtyRegion,
uint32_t aFlags) override; uint32_t aFlags) override;
virtual nsresult HandleEvent(nsIFrame* aFrame, nsresult HandleEvent(nsIFrame* aFrame,
mozilla::WidgetGUIEvent* aEvent, WidgetGUIEvent* aEvent,
bool aDontRetargetEvents, bool aDontRetargetEvents,
nsEventStatus* aEventStatus) override; nsEventStatus* aEventStatus) override;
virtual nsresult HandleDOMEventWithTarget( nsresult HandleDOMEventWithTarget(nsIContent* aTargetContent,
nsIContent* aTargetContent, WidgetEvent* aEvent,
mozilla::WidgetEvent* aEvent, nsEventStatus* aStatus) override;
nsEventStatus* aStatus) override; nsresult HandleDOMEventWithTarget(nsIContent* aTargetContent,
virtual nsresult HandleDOMEventWithTarget(nsIContent* aTargetContent, nsIDOMEvent* aEvent,
nsIDOMEvent* aEvent, nsEventStatus* aStatus) override;
nsEventStatus* aStatus) override; bool ShouldIgnoreInvalidation() override;
virtual bool ShouldIgnoreInvalidation() override; void WillPaint() override;
virtual void WillPaint() override; void WillPaintWindow() override;
virtual void WillPaintWindow() override; void DidPaintWindow() override;
virtual void DidPaintWindow() override; void ScheduleViewManagerFlush(PaintType aType = PAINT_DEFAULT) override;
virtual void ScheduleViewManagerFlush(PaintType aType = PAINT_DEFAULT) override; void DispatchSynthMouseMove(WidgetGUIEvent* aEvent,
virtual void DispatchSynthMouseMove(mozilla::WidgetGUIEvent* aEvent, bool aFlushOnHoverChange) override;
bool aFlushOnHoverChange) override; void ClearMouseCaptureOnView(nsView* aView) override;
virtual void ClearMouseCaptureOnView(nsView* aView) override; bool IsVisible() override;
virtual bool IsVisible() override;
virtual already_AddRefed<mozilla::AccessibleCaretEventHub> GetAccessibleCaretEventHub() const override; already_AddRefed<AccessibleCaretEventHub> GetAccessibleCaretEventHub() const override;
// caret handling // caret handling
virtual already_AddRefed<nsCaret> GetCaret() const override; already_AddRefed<nsCaret> GetCaret() const override;
NS_IMETHOD SetCaretEnabled(bool aInEnable) override; NS_IMETHOD SetCaretEnabled(bool aInEnable) override;
NS_IMETHOD SetCaretReadOnly(bool aReadOnly) override; NS_IMETHOD SetCaretReadOnly(bool aReadOnly) override;
NS_IMETHOD GetCaretEnabled(bool *aOutEnabled) override; NS_IMETHOD GetCaretEnabled(bool *aOutEnabled) override;
NS_IMETHOD SetCaretVisibilityDuringSelection(bool aVisibility) override; NS_IMETHOD SetCaretVisibilityDuringSelection(bool aVisibility) override;
NS_IMETHOD GetCaretVisible(bool *_retval) override; NS_IMETHOD GetCaretVisible(bool *_retval) override;
virtual void SetCaret(nsCaret *aNewCaret) override; void SetCaret(nsCaret *aNewCaret) override;
virtual void RestoreCaret() override; void RestoreCaret() override;
NS_IMETHOD SetSelectionFlags(int16_t aInEnable) override; NS_IMETHOD SetSelectionFlags(int16_t aInEnable) override;
NS_IMETHOD GetSelectionFlags(int16_t *aOutEnable) override; NS_IMETHOD GetSelectionFlags(int16_t *aOutEnable) override;
@ -285,8 +284,8 @@ public:
NS_IMETHOD CompleteMove(bool aForward, bool aExtend) override; NS_IMETHOD CompleteMove(bool aForward, bool aExtend) override;
NS_IMETHOD SelectAll() override; NS_IMETHOD SelectAll() override;
NS_IMETHOD CheckVisibility(nsIDOMNode *node, int16_t startOffset, int16_t EndOffset, bool *_retval) override; NS_IMETHOD CheckVisibility(nsIDOMNode *node, int16_t startOffset, int16_t EndOffset, bool *_retval) override;
virtual nsresult CheckVisibilityContent(nsIContent* aNode, int16_t aStartOffset, nsresult CheckVisibilityContent(nsIContent* aNode, int16_t aStartOffset,
int16_t aEndOffset, bool* aRetval) override; int16_t aEndOffset, bool* aRetval) override;
// nsIDocumentObserver // nsIDocumentObserver
NS_DECL_NSIDOCUMENTOBSERVER_BEGINUPDATE NS_DECL_NSIDOCUMENTOBSERVER_BEGINUPDATE
@ -310,62 +309,62 @@ public:
NS_DECL_NSIOBSERVER NS_DECL_NSIOBSERVER
#ifdef MOZ_REFLOW_PERF #ifdef MOZ_REFLOW_PERF
virtual void DumpReflows() override; void DumpReflows() override;
virtual void CountReflows(const char * aName, nsIFrame * aFrame) override; void CountReflows(const char * aName, nsIFrame * aFrame) override;
virtual void PaintCount(const char * aName, void PaintCount(const char * aName,
gfxContext* aRenderingContext, gfxContext* aRenderingContext,
nsPresContext* aPresContext, nsPresContext* aPresContext,
nsIFrame * aFrame, nsIFrame * aFrame,
const nsPoint& aOffset, const nsPoint& aOffset,
uint32_t aColor) override; uint32_t aColor) override;
virtual void SetPaintFrameCount(bool aOn) override; void SetPaintFrameCount(bool aOn) override;
virtual bool IsPaintingFrameCounts() override; bool IsPaintingFrameCounts() override;
#endif #endif
#ifdef DEBUG #ifdef DEBUG
virtual void ListStyleContexts(FILE *out, int32_t aIndent = 0) override; void ListStyleContexts(FILE *out, int32_t aIndent = 0) override;
virtual void ListStyleSheets(FILE *out, int32_t aIndent = 0) override; void ListStyleSheets(FILE *out, int32_t aIndent = 0) override;
virtual void VerifyStyleTree() override; void VerifyStyleTree() override;
#endif #endif
static mozilla::LazyLogModule gLog; static LazyLogModule gLog;
virtual void DisableNonTestMouseEvents(bool aDisable) override; void DisableNonTestMouseEvents(bool aDisable) override;
virtual void UpdateCanvasBackground() override; void UpdateCanvasBackground() override;
virtual void AddCanvasBackgroundColorItem(nsDisplayListBuilder& aBuilder, void AddCanvasBackgroundColorItem(nsDisplayListBuilder& aBuilder,
nsDisplayList& aList, nsDisplayList& aList,
nsIFrame* aFrame, nsIFrame* aFrame,
const nsRect& aBounds, const nsRect& aBounds,
nscolor aBackstopColor, nscolor aBackstopColor,
uint32_t aFlags) override; uint32_t aFlags) override;
virtual void AddPrintPreviewBackgroundItem(nsDisplayListBuilder& aBuilder, void AddPrintPreviewBackgroundItem(nsDisplayListBuilder& aBuilder,
nsDisplayList& aList, nsDisplayList& aList,
nsIFrame* aFrame, nsIFrame* aFrame,
const nsRect& aBounds) override; const nsRect& aBounds) override;
virtual nscolor ComputeBackstopColor(nsView* aDisplayRoot) override; nscolor ComputeBackstopColor(nsView* aDisplayRoot) override;
virtual nsresult SetIsActive(bool aIsActive) override; nsresult SetIsActive(bool aIsActive) override;
virtual bool GetIsViewportOverridden() override { bool GetIsViewportOverridden() override {
return (mMobileViewportManager != nullptr); return (mMobileViewportManager != nullptr);
} }
virtual bool IsLayoutFlushObserver() override bool IsLayoutFlushObserver() override
{ {
return GetPresContext()->RefreshDriver()-> return GetPresContext()->RefreshDriver()->
IsLayoutFlushObserver(this); IsLayoutFlushObserver(this);
} }
virtual void LoadComplete() override; void LoadComplete() override;
virtual void AddSizeOfIncludingThis(nsWindowSizes& aWindowSizes) void AddSizeOfIncludingThis(nsWindowSizes& aWindowSizes)
const override; const override;
size_t SizeOfTextRuns(mozilla::MallocSizeOf aMallocSizeOf) const; size_t SizeOfTextRuns(MallocSizeOf aMallocSizeOf) const;
// This data is stored as a content property (nsGkAtoms::scrolling) on // This data is stored as a content property (nsGkAtoms::scrolling) on
// mContentToScrollTo when we have a pending ScrollIntoView. // mContentToScrollTo when we have a pending ScrollIntoView.
@ -392,28 +391,27 @@ public:
bool AssumeAllFramesVisible() override; bool AssumeAllFramesVisible() override;
virtual bool CanDispatchEvent( bool CanDispatchEvent(const WidgetGUIEvent* aEvent = nullptr) const override;
const mozilla::WidgetGUIEvent* aEvent = nullptr) const override;
void SetNextPaintCompressed() { mNextPaintCompressed = true; } void SetNextPaintCompressed() { mNextPaintCompressed = true; }
void NotifyStyleSheetServiceSheetAdded(mozilla::StyleSheet* aSheet, void NotifyStyleSheetServiceSheetAdded(StyleSheet* aSheet,
uint32_t aSheetType) override; uint32_t aSheetType) override;
void NotifyStyleSheetServiceSheetRemoved(mozilla::StyleSheet* aSheet, void NotifyStyleSheetServiceSheetRemoved(StyleSheet* aSheet,
uint32_t aSheetType) override; uint32_t aSheetType) override;
virtual bool HasHandledUserInput() const override { bool HasHandledUserInput() const override {
return mHasHandledUserInput; return mHasHandledUserInput;
} }
virtual void FireResizeEvent() override; void FireResizeEvent() override;
static PresShell* GetShellForEventTarget(nsIFrame* aFrame, static PresShell* GetShellForEventTarget(nsIFrame* aFrame,
nsIContent* aContent); nsIContent* aContent);
static PresShell* GetShellForTouchEvent(WidgetGUIEvent* aEvent); static PresShell* GetShellForTouchEvent(WidgetGUIEvent* aEvent);
protected: private:
virtual ~PresShell(); ~PresShell();
void HandlePostedReflowCallbacks(bool aInterruptible); void HandlePostedReflowCallbacks(bool aInterruptible);
void CancelPostedReflowCallbacks(); void CancelPostedReflowCallbacks();
@ -429,10 +427,10 @@ protected:
friend class ::nsAutoCauseReflowNotifier; friend class ::nsAutoCauseReflowNotifier;
friend class ::AutoPointerEventTargetUpdater; friend class ::AutoPointerEventTargetUpdater;
nsresult DispatchEventToDOM(mozilla::WidgetEvent* aEvent, nsresult DispatchEventToDOM(WidgetEvent* aEvent,
nsEventStatus* aStatus, nsEventStatus* aStatus,
nsPresShellEventCB* aEventCB); nsPresShellEventCB* aEventCB);
void DispatchTouchEventToDOM(mozilla::WidgetEvent* aEvent, void DispatchTouchEventToDOM(WidgetEvent* aEvent,
nsEventStatus* aStatus, nsEventStatus* aStatus,
nsPresShellEventCB* aEventCB, nsPresShellEventCB* aEventCB,
bool aTouchIsNew); bool aTouchIsNew);
@ -524,8 +522,7 @@ protected:
void ShowEventTargetDebug(); void ShowEventTargetDebug();
#endif #endif
void RecordStyleSheetChange(mozilla::StyleSheet* aStyleSheet, void RecordStyleSheetChange(StyleSheet* aStyleSheet, StyleSheet::ChangeType);
StyleSheet::ChangeType);
void RemovePreferenceStyles(); void RemovePreferenceStyles();
@ -539,7 +536,7 @@ protected:
// create a RangePaintInfo for the range aRange containing the // create a RangePaintInfo for the range aRange containing the
// display list needed to paint the range to a surface // display list needed to paint the range to a surface
mozilla::UniquePtr<RangePaintInfo> UniquePtr<RangePaintInfo>
CreateRangePaintInfo(nsIDOMRange* aRange, CreateRangePaintInfo(nsIDOMRange* aRange,
nsRect& aSurfaceRect, nsRect& aSurfaceRect,
bool aForPrimarySelection); bool aForPrimarySelection);
@ -557,12 +554,12 @@ protected:
* be set if a custom image was specified * be set if a custom image was specified
*/ */
already_AddRefed<SourceSurface> already_AddRefed<SourceSurface>
PaintRangePaintInfo(const nsTArray<mozilla::UniquePtr<RangePaintInfo>>& aItems, PaintRangePaintInfo(const nsTArray<UniquePtr<RangePaintInfo>>& aItems,
nsISelection* aSelection, nsISelection* aSelection,
nsIntRegion* aRegion, nsIntRegion* aRegion,
nsRect aArea, nsRect aArea,
const mozilla::LayoutDeviceIntPoint aPoint, const LayoutDeviceIntPoint aPoint,
mozilla::LayoutDeviceIntRect* aScreenRect, LayoutDeviceIntRect* aScreenRect,
uint32_t aFlags); uint32_t aFlags);
/** /**
@ -572,7 +569,7 @@ protected:
void AddUserSheet(StyleSheet* aSheet); void AddUserSheet(StyleSheet* aSheet);
void AddAgentSheet(StyleSheet* aSheet); void AddAgentSheet(StyleSheet* aSheet);
void AddAuthorSheet(StyleSheet* aSheet); void AddAuthorSheet(StyleSheet* aSheet);
void RemoveSheet(mozilla::SheetType aType, StyleSheet* aSheet); void RemoveSheet(SheetType aType, StyleSheet* aSheet);
// Hide a view if it is a popup // Hide a view if it is a popup
void HideViewIfPopup(nsView* aView); void HideViewIfPopup(nsView* aView);
@ -582,7 +579,7 @@ protected:
void MaybeReleaseCapturingContent(); void MaybeReleaseCapturingContent();
nsresult HandleRetargetedEvent(mozilla::WidgetEvent* aEvent, nsresult HandleRetargetedEvent(WidgetEvent* aEvent,
nsEventStatus* aStatus, nsEventStatus* aStatus,
nsIContent* aTarget) nsIContent* aTarget)
{ {
@ -607,31 +604,31 @@ protected:
class DelayedInputEvent : public DelayedEvent class DelayedInputEvent : public DelayedEvent
{ {
public: public:
virtual void Dispatch() override; void Dispatch() override;
protected: protected:
DelayedInputEvent(); DelayedInputEvent();
virtual ~DelayedInputEvent(); ~DelayedInputEvent() override;
mozilla::WidgetInputEvent* mEvent; WidgetInputEvent* mEvent;
}; };
class DelayedMouseEvent : public DelayedInputEvent class DelayedMouseEvent : public DelayedInputEvent
{ {
public: public:
explicit DelayedMouseEvent(mozilla::WidgetMouseEvent* aEvent); explicit DelayedMouseEvent(WidgetMouseEvent* aEvent);
}; };
class DelayedKeyEvent : public DelayedInputEvent class DelayedKeyEvent : public DelayedInputEvent
{ {
public: public:
explicit DelayedKeyEvent(mozilla::WidgetKeyboardEvent* aEvent); explicit DelayedKeyEvent(WidgetKeyboardEvent* aEvent);
virtual bool IsKeyPressEvent() override; bool IsKeyPressEvent() override;
}; };
// Check if aEvent is a mouse event and record the mouse location for later // Check if aEvent is a mouse event and record the mouse location for later
// synth mouse moves. // synth mouse moves.
void RecordMouseLocation(mozilla::WidgetGUIEvent* aEvent); void RecordMouseLocation(WidgetGUIEvent* aEvent);
class nsSynthMouseMoveEvent final : public nsARefreshObserver { class nsSynthMouseMoveEvent final : public nsARefreshObserver {
public: public:
nsSynthMouseMoveEvent(PresShell* aPresShell, bool aFromScroll) nsSynthMouseMoveEvent(PresShell* aPresShell, bool aFromScroll)
@ -655,7 +652,7 @@ protected:
mPresShell = nullptr; mPresShell = nullptr;
} }
} }
virtual void WillRefresh(mozilla::TimeStamp aTime) override { void WillRefresh(TimeStamp aTime) override {
if (mPresShell) { if (mPresShell) {
RefPtr<PresShell> shell = mPresShell; RefPtr<PresShell> shell = mPresShell;
shell->ProcessSynthMouseMoveEvent(mFromScroll); shell->ProcessSynthMouseMoveEvent(mFromScroll);
@ -674,7 +671,7 @@ protected:
already_AddRefed<nsIPresShell> GetParentPresShellForEventHandling(); already_AddRefed<nsIPresShell> GetParentPresShellForEventHandling();
nsIContent* GetCurrentEventContent(); nsIContent* GetCurrentEventContent();
nsIFrame* GetCurrentEventFrame(); nsIFrame* GetCurrentEventFrame();
nsresult RetargetEventToParent(mozilla::WidgetGUIEvent* aEvent, nsresult RetargetEventToParent(WidgetGUIEvent* aEvent,
nsEventStatus* aEventStatus); nsEventStatus* aEventStatus);
void PushCurrentEventInfo(nsIFrame* aFrame, nsIContent* aContent); void PushCurrentEventInfo(nsIFrame* aFrame, nsIContent* aContent);
void PopCurrentEventInfo(); void PopCurrentEventInfo();
@ -683,7 +680,7 @@ protected:
* an event which is caused by native * an event which is caused by native
* event. Otherwise, false. * event. Otherwise, false.
*/ */
nsresult HandleEventInternal(mozilla::WidgetEvent* aEvent, nsresult HandleEventInternal(WidgetEvent* aEvent,
nsEventStatus* aStatus, nsEventStatus* aStatus,
bool aIsHandlingNativeEvent); bool aIsHandlingNativeEvent);
@ -702,20 +699,20 @@ protected:
* Returns true if the context menu event should fire and false if it should * Returns true if the context menu event should fire and false if it should
* not. * not.
*/ */
bool AdjustContextMenuKeyEvent(mozilla::WidgetMouseEvent* aEvent); bool AdjustContextMenuKeyEvent(WidgetMouseEvent* aEvent);
// //
bool PrepareToUseCaretPosition(nsIWidget* aEventWidget, bool PrepareToUseCaretPosition(nsIWidget* aEventWidget,
mozilla::LayoutDeviceIntPoint& aTargetPt); LayoutDeviceIntPoint& aTargetPt);
// Get the selected item and coordinates in device pixels relative to root // Get the selected item and coordinates in device pixels relative to root
// document's root view for element, first ensuring the element is onscreen // document's root view for element, first ensuring the element is onscreen
void GetCurrentItemAndPositionForElement(nsIDOMElement *aCurrentEl, void GetCurrentItemAndPositionForElement(nsIDOMElement *aCurrentEl,
nsIContent **aTargetToUse, nsIContent **aTargetToUse,
mozilla::LayoutDeviceIntPoint& aTargetPt, LayoutDeviceIntPoint& aTargetPt,
nsIWidget *aRootWidget); nsIWidget *aRootWidget);
virtual void SynthesizeMouseMove(bool aFromScroll) override; void SynthesizeMouseMove(bool aFromScroll) override;
PresShell* GetRootPresShell(); PresShell* GetRootPresShell();
@ -731,14 +728,14 @@ protected:
bool ScheduleReflowOffTimer(); bool ScheduleReflowOffTimer();
// Widget notificiations // Widget notificiations
virtual void WindowSizeMoveDone() override; void WindowSizeMoveDone() override;
virtual void SysColorChanged() override { mPresContext->SysColorChanged(); } void SysColorChanged() override { mPresContext->SysColorChanged(); }
virtual void ThemeChanged() override { mPresContext->ThemeChanged(); } void ThemeChanged() override { mPresContext->ThemeChanged(); }
virtual void BackingScaleFactorChanged() override { mPresContext->UIResolutionChanged(); } void BackingScaleFactorChanged() override { mPresContext->UIResolutionChanged(); }
virtual nsIDocument* GetPrimaryContentDocument() override; nsIDocument* GetPrimaryContentDocument() override;
virtual void PausePainting() override; void PausePainting() override;
virtual void ResumePainting() override; void ResumePainting() override;
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// Approximate frame visibility tracking implementation. // Approximate frame visibility tracking implementation.
@ -747,7 +744,7 @@ protected:
void UpdateApproximateFrameVisibility(); void UpdateApproximateFrameVisibility();
void DoUpdateApproximateFrameVisibility(bool aRemoveOnly); void DoUpdateApproximateFrameVisibility(bool aRemoveOnly);
void ClearApproximatelyVisibleFramesList(const Maybe<mozilla::OnNonvisible>& aNonvisibleAction void ClearApproximatelyVisibleFramesList(const Maybe<OnNonvisible>& aNonvisibleAction
= Nothing()); = Nothing());
static void ClearApproximateFrameVisibilityVisited(nsView* aView, bool aClear); static void ClearApproximateFrameVisibilityVisited(nsView* aView, bool aClear);
static void MarkFramesInListApproximatelyVisible(const nsDisplayList& aList, static void MarkFramesInListApproximatelyVisible(const nsDisplayList& aList,
@ -771,12 +768,12 @@ protected:
#ifdef DEBUG #ifdef DEBUG
// The reflow root under which we're currently reflowing. Null when // The reflow root under which we're currently reflowing. Null when
// not in reflow. // not in reflow.
nsIFrame* mCurrentReflowRoot; nsIFrame* mCurrentReflowRoot;
uint32_t mUpdateCount; uint32_t mUpdateCount;
#endif #endif
#ifdef MOZ_REFLOW_PERF #ifdef MOZ_REFLOW_PERF
ReflowCountMgr* mReflowCountMgr; ReflowCountMgr* mReflowCountMgr;
#endif #endif
// This is used for synthetic mouse events that are sent when what is under // This is used for synthetic mouse events that are sent when what is under
@ -787,117 +784,116 @@ protected:
// is set to (NS_UNCONSTRAINEDSIZE, NS_UNCONSTRAINEDSIZE) if the mouse isn't // 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 // over our window or there is no last observed mouse location for some
// reason. // reason.
nsPoint mMouseLocation; nsPoint mMouseLocation;
// This is an APZ state variable that tracks the target guid for the last // This is an APZ state variable that tracks the target guid for the last
// mouse event that was processed (corresponding to mMouseLocation). This is // mouse event that was processed (corresponding to mMouseLocation). This is
// needed for the synthetic mouse events. // needed for the synthetic mouse events.
mozilla::layers::ScrollableLayerGuid mMouseEventTargetGuid; layers::ScrollableLayerGuid mMouseEventTargetGuid;
// mStyleSet owns it but we maintain a ref, may be null // mStyleSet owns it but we maintain a ref, may be null
RefPtr<mozilla::StyleSheet> mPrefStyleSheet; RefPtr<StyleSheet> mPrefStyleSheet;
// Set of frames that we should mark with NS_FRAME_HAS_DIRTY_CHILDREN after // Set of frames that we should mark with NS_FRAME_HAS_DIRTY_CHILDREN after
// we finish reflowing mCurrentReflowRoot. // we finish reflowing mCurrentReflowRoot.
nsTHashtable<nsPtrHashKey<nsIFrame> > mFramesToDirty; nsTHashtable<nsPtrHashKey<nsIFrame> > mFramesToDirty;
// Reflow roots that need to be reflowed. // Reflow roots that need to be reflowed.
nsTArray<nsIFrame*> mDirtyRoots; nsTArray<nsIFrame*> mDirtyRoots;
nsTArray<nsAutoPtr<DelayedEvent> > mDelayedEvents; nsTArray<nsAutoPtr<DelayedEvent> > mDelayedEvents;
private: private:
nsIFrame* mCurrentEventFrame; nsIFrame* mCurrentEventFrame;
nsCOMPtr<nsIContent> mCurrentEventContent; nsCOMPtr<nsIContent> mCurrentEventContent;
nsTArray<nsIFrame*> mCurrentEventFrameStack; nsTArray<nsIFrame*> mCurrentEventFrameStack;
nsCOMArray<nsIContent> mCurrentEventContentStack; nsCOMArray<nsIContent> mCurrentEventContentStack;
protected:
nsRevocableEventPtr<nsSynthMouseMoveEvent> mSynthMouseMoveEvent; nsRevocableEventPtr<nsSynthMouseMoveEvent> mSynthMouseMoveEvent;
nsCOMPtr<nsIContent> mLastAnchorScrolledTo; nsCOMPtr<nsIContent> mLastAnchorScrolledTo;
RefPtr<nsCaret> mCaret; RefPtr<nsCaret> mCaret;
RefPtr<nsCaret> mOriginalCaret; RefPtr<nsCaret> mOriginalCaret;
nsCallbackEventRequest* mFirstCallbackEventRequest; nsCallbackEventRequest* mFirstCallbackEventRequest;
nsCallbackEventRequest* mLastCallbackEventRequest; nsCallbackEventRequest* mLastCallbackEventRequest;
mozilla::TouchManager mTouchManager; TouchManager mTouchManager;
RefPtr<ZoomConstraintsClient> mZoomConstraintsClient; RefPtr<ZoomConstraintsClient> mZoomConstraintsClient;
RefPtr<MobileViewportManager> mMobileViewportManager; RefPtr<MobileViewportManager> mMobileViewportManager;
RefPtr<mozilla::AccessibleCaretEventHub> mAccessibleCaretEventHub; RefPtr<AccessibleCaretEventHub> mAccessibleCaretEventHub;
// This timer controls painting suppression. Until it fires // This timer controls painting suppression. Until it fires
// or all frames are constructed, we won't paint anything but // or all frames are constructed, we won't paint anything but
// our <body> background and scrollbars. // our <body> background and scrollbars.
nsCOMPtr<nsITimer> mPaintSuppressionTimer; nsCOMPtr<nsITimer> mPaintSuppressionTimer;
nsCOMPtr<nsITimer> mDelayedPaintTimer; nsCOMPtr<nsITimer> mDelayedPaintTimer;
// The `performance.now()` value when we last started to process reflows. // The `performance.now()` value when we last started to process reflows.
DOMHighResTimeStamp mLastReflowStart; DOMHighResTimeStamp mLastReflowStart;
mozilla::TimeStamp mLoadBegin; // used to time loads TimeStamp mLoadBegin; // used to time loads
// Information needed to properly handle scrolling content into view if the // Information needed to properly handle scrolling content into view if the
// pre-scroll reflow flush can be interrupted. mContentToScrollTo is // pre-scroll reflow flush can be interrupted. mContentToScrollTo is
// non-null between the initial scroll attempt and the first time we finish // non-null between the initial scroll attempt and the first time we finish
// processing all our dirty roots. mContentToScrollTo has a content property // processing all our dirty roots. mContentToScrollTo has a content property
// storing the details for the scroll operation, see ScrollIntoViewData above. // storing the details for the scroll operation, see ScrollIntoViewData above.
nsCOMPtr<nsIContent> mContentToScrollTo; nsCOMPtr<nsIContent> mContentToScrollTo;
nscoord mLastAnchorScrollPositionY; nscoord mLastAnchorScrollPositionY;
// Information about live content (which still stay in DOM tree). // Information about live content (which still stay in DOM tree).
// Used in case we need re-dispatch event after sending pointer event, // Used in case we need re-dispatch event after sending pointer event,
// when target of pointer event was deleted during executing user handlers. // when target of pointer event was deleted during executing user handlers.
nsCOMPtr<nsIContent> mPointerEventTarget; nsCOMPtr<nsIContent> mPointerEventTarget;
// The focus sequence number of the last processed input event // The focus sequence number of the last processed input event
uint64_t mAPZFocusSequenceNumber; uint64_t mAPZFocusSequenceNumber;
// The focus information needed for async keyboard scrolling // The focus information needed for async keyboard scrolling
FocusTarget mAPZFocusTarget; FocusTarget mAPZFocusTarget;
bool mDocumentLoading : 1; bool mDocumentLoading : 1;
bool mIgnoreFrameDestruction : 1; bool mIgnoreFrameDestruction : 1;
bool mHaveShutDown : 1; bool mHaveShutDown : 1;
bool mLastRootReflowHadUnconstrainedBSize : 1; bool mLastRootReflowHadUnconstrainedBSize : 1;
bool mNoDelayedMouseEvents : 1; bool mNoDelayedMouseEvents : 1;
bool mNoDelayedKeyEvents : 1; bool mNoDelayedKeyEvents : 1;
// Indicates that it is safe to unlock painting once all pending reflows // Indicates that it is safe to unlock painting once all pending reflows
// have been processed. // have been processed.
bool mShouldUnsuppressPainting : 1; bool mShouldUnsuppressPainting : 1;
bool mResizeEventPending : 1; bool mResizeEventPending : 1;
bool mApproximateFrameVisibilityVisited : 1; bool mApproximateFrameVisibilityVisited : 1;
bool mNextPaintCompressed : 1; bool mNextPaintCompressed : 1;
bool mHasCSSBackgroundColor : 1; bool mHasCSSBackgroundColor : 1;
// Whether content should be scaled by the resolution amount. If this is // Whether content should be scaled by the resolution amount. If this is
// not set, a transform that scales by the inverse of the resolution is // not set, a transform that scales by the inverse of the resolution is
// applied to rendered layers. // applied to rendered layers.
bool mScaleToResolution : 1; bool mScaleToResolution : 1;
// Whether the last chrome-only escape key event is consumed. // Whether the last chrome-only escape key event is consumed.
bool mIsLastChromeOnlyEscapeKeyConsumed : 1; bool mIsLastChromeOnlyEscapeKeyConsumed : 1;
// Whether the widget has received a paint message yet. // Whether the widget has received a paint message yet.
bool mHasReceivedPaintMessage : 1; bool mHasReceivedPaintMessage : 1;
bool mIsLastKeyDownCanceled : 1; bool mIsLastKeyDownCanceled : 1;
// Whether we have ever handled a user input event // Whether we have ever handled a user input event
bool mHasHandledUserInput : 1; bool mHasHandledUserInput : 1;
static bool sDisableNonTestMouseEvents; static bool sDisableNonTestMouseEvents;
mozilla::TimeStamp mLastOSWake; TimeStamp mLastOSWake;
static mozilla::TimeStamp sLastInputCreated; static TimeStamp sLastInputCreated;
static mozilla::TimeStamp sLastInputProcessed; static TimeStamp sLastInputProcessed;
static bool sProcessInteractable; static bool sProcessInteractable;
}; };
} // namespace mozilla } // namespace mozilla