зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1667475
- Moved displayport-related functions from nsLayoutUtils to a new DisplayPortUtils class. r=kats
Differential Revision: https://phabricator.services.mozilla.com/D92006
This commit is contained in:
Родитель
0f1dc946a1
Коммит
5d6a075ae9
|
@ -120,6 +120,7 @@
|
|||
#include "mozilla/PreloadedStyleSheet.h"
|
||||
#include "mozilla/layers/WebRenderBridgeChild.h"
|
||||
#include "mozilla/layers/WebRenderLayerManager.h"
|
||||
#include "mozilla/DisplayPortUtils.h"
|
||||
#include "mozilla/ResultExtensions.h"
|
||||
#include "mozilla/ViewportUtils.h"
|
||||
|
||||
|
@ -476,8 +477,8 @@ nsDOMWindowUtils::SetDisplayPortForElement(float aXPx, float aYPx,
|
|||
new DisplayPortPropertyData(displayport, aPriority, wasPainted),
|
||||
nsINode::DeleteProperty<DisplayPortPropertyData>);
|
||||
|
||||
nsLayoutUtils::InvalidateForDisplayPortChange(aElement, hadDisplayPort,
|
||||
oldDisplayPort, displayport);
|
||||
DisplayPortUtils::InvalidateForDisplayPortChange(aElement, hadDisplayPort,
|
||||
oldDisplayPort, displayport);
|
||||
|
||||
nsIFrame* rootFrame = presShell->GetRootFrame();
|
||||
if (rootFrame) {
|
||||
|
@ -527,8 +528,8 @@ nsDOMWindowUtils::SetDisplayPortMarginsForElement(
|
|||
ScreenMargin displayportMargins(aTopMargin, aRightMargin, aBottomMargin,
|
||||
aLeftMargin);
|
||||
|
||||
nsLayoutUtils::SetDisplayPortMargins(aElement, presShell, displayportMargins,
|
||||
aPriority);
|
||||
DisplayPortUtils::SetDisplayPortMargins(aElement, presShell,
|
||||
displayportMargins, aPriority);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -550,7 +551,8 @@ nsDOMWindowUtils::SetDisplayPortBaseForElement(int32_t aX, int32_t aY,
|
|||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
nsLayoutUtils::SetDisplayPortBase(aElement, nsRect(aX, aY, aWidth, aHeight));
|
||||
DisplayPortUtils::SetDisplayPortBase(aElement,
|
||||
nsRect(aX, aY, aWidth, aHeight));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -3928,7 +3928,7 @@ static CSSRect GetDisplayPortRect(const FrameMetrics& aFrameMetrics,
|
|||
// scroll offset. It's adjusted to be relative to the layout scroll offset
|
||||
// when the main thread processes a repaint request (in
|
||||
// APZCCallbackHelper::AdjustDisplayPortForScrollDelta()) and ultimately
|
||||
// applied (in nsLayoutUtils::GetDisplayPort()) in this adjusted form.
|
||||
// applied (in DisplayPortUtils::GetDisplayPort()) in this adjusted form.
|
||||
CSSRect baseRect(aFrameMetrics.GetVisualScrollOffset(),
|
||||
aFrameMetrics.CalculateBoundedCompositedSizeInCssPixels());
|
||||
baseRect.Inflate(aDisplayportMargins /
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#include "mozilla/layers/ShadowLayers.h"
|
||||
#include "mozilla/layers/WebRenderLayerManager.h"
|
||||
#include "mozilla/layers/WebRenderBridgeChild.h"
|
||||
#include "mozilla/DisplayPortUtils.h"
|
||||
#include "mozilla/PresShell.h"
|
||||
#include "mozilla/TouchEvents.h"
|
||||
#include "mozilla/ToString.h"
|
||||
|
@ -255,7 +256,7 @@ static void SetDisplayPortMargins(PresShell* aPresShell, nsIContent* aContent,
|
|||
return;
|
||||
}
|
||||
|
||||
bool hadDisplayPort = nsLayoutUtils::HasDisplayPort(aContent);
|
||||
bool hadDisplayPort = DisplayPortUtils::HasDisplayPort(aContent);
|
||||
if (MOZ_LOG_TEST(sDisplayportLog, LogLevel::Debug)) {
|
||||
if (!hadDisplayPort) {
|
||||
mozilla::layers::ScrollableLayerGuid::ViewID viewID =
|
||||
|
@ -267,16 +268,16 @@ static void SetDisplayPortMargins(PresShell* aPresShell, nsIContent* aContent,
|
|||
ToString(aDisplayPortMargins).c_str(), viewID));
|
||||
}
|
||||
}
|
||||
nsLayoutUtils::SetDisplayPortMargins(aContent, aPresShell,
|
||||
aDisplayPortMargins, 0);
|
||||
DisplayPortUtils::SetDisplayPortMargins(aContent, aPresShell,
|
||||
aDisplayPortMargins, 0);
|
||||
if (!hadDisplayPort) {
|
||||
nsLayoutUtils::SetZeroMarginDisplayPortOnAsyncScrollableAncestors(
|
||||
DisplayPortUtils::SetZeroMarginDisplayPortOnAsyncScrollableAncestors(
|
||||
aContent->GetPrimaryFrame());
|
||||
}
|
||||
|
||||
nsRect base(0, 0, aDisplayPortBase.width * AppUnitsPerCSSPixel(),
|
||||
aDisplayPortBase.height * AppUnitsPerCSSPixel());
|
||||
nsLayoutUtils::SetDisplayPortBaseIfNotSet(aContent, base);
|
||||
DisplayPortUtils::SetDisplayPortBaseIfNotSet(aContent, base);
|
||||
}
|
||||
|
||||
static void SetPaintRequestTime(nsIContent* aContent,
|
||||
|
@ -431,12 +432,12 @@ void APZCCallbackHelper::InitializeRootDisplayport(PresShell* aPresShell) {
|
|||
MOZ_LOG(
|
||||
sDisplayportLog, LogLevel::Debug,
|
||||
("Initializing root displayport on scrollId=%" PRIu64 "\n", viewId));
|
||||
nsLayoutUtils::SetDisplayPortBaseIfNotSet(content, baseRect);
|
||||
DisplayPortUtils::SetDisplayPortBaseIfNotSet(content, baseRect);
|
||||
// Note that we also set the base rect that goes with these margins in
|
||||
// nsRootBoxFrame::BuildDisplayList.
|
||||
nsLayoutUtils::SetDisplayPortMargins(content, aPresShell, ScreenMargin(),
|
||||
0);
|
||||
nsLayoutUtils::SetZeroMarginDisplayPortOnAsyncScrollableAncestors(
|
||||
DisplayPortUtils::SetDisplayPortMargins(content, aPresShell, ScreenMargin(),
|
||||
0);
|
||||
DisplayPortUtils::SetZeroMarginDisplayPortOnAsyncScrollableAncestors(
|
||||
content->GetPrimaryFrame());
|
||||
}
|
||||
}
|
||||
|
@ -609,11 +610,11 @@ static bool PrepareForSetTargetAPZCNotification(
|
|||
if (!guidIsValid) {
|
||||
return false;
|
||||
}
|
||||
if (nsLayoutUtils::HasDisplayPort(dpElement)) {
|
||||
if (DisplayPortUtils::HasDisplayPort(dpElement)) {
|
||||
// If the element has a displayport but it hasn't been painted yet,
|
||||
// we want the caller to wait for the paint to happen, but we don't
|
||||
// need to set the displayport here since it's already been set.
|
||||
return !nsLayoutUtils::HasPaintedDisplayPort(dpElement);
|
||||
return !DisplayPortUtils::HasPaintedDisplayPort(dpElement);
|
||||
}
|
||||
|
||||
if (!scrollAncestor) {
|
||||
|
@ -631,14 +632,14 @@ static bool PrepareForSetTargetAPZCNotification(
|
|||
MOZ_LOG(sDisplayportLog, LogLevel::Debug,
|
||||
("Activating displayport on scrollId=%" PRIu64 " for SetTargetAPZC\n",
|
||||
guid.mScrollId));
|
||||
bool activated = nsLayoutUtils::CalculateAndSetDisplayPortMargins(
|
||||
scrollAncestor, nsLayoutUtils::RepaintMode::Repaint);
|
||||
bool activated = DisplayPortUtils::CalculateAndSetDisplayPortMargins(
|
||||
scrollAncestor, DisplayPortUtils::RepaintMode::Repaint);
|
||||
if (!activated) {
|
||||
return false;
|
||||
}
|
||||
|
||||
nsIFrame* frame = do_QueryFrame(scrollAncestor);
|
||||
nsLayoutUtils::SetZeroMarginDisplayPortOnAsyncScrollableAncestors(frame);
|
||||
DisplayPortUtils::SetZeroMarginDisplayPortOnAsyncScrollableAncestors(frame);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -0,0 +1,231 @@
|
|||
/* -*- 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
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef mozilla_DisplayPortUtils_h__
|
||||
#define mozilla_DisplayPortUtils_h__
|
||||
|
||||
#include "Units.h"
|
||||
#include "nsDisplayList.h"
|
||||
#include "nsRect.h"
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
class nsIContent;
|
||||
class nsIFrame;
|
||||
class nsDisplayListBuilder;
|
||||
class nsPresContext;
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
class PresShell;
|
||||
|
||||
struct DisplayPortPropertyData {
|
||||
DisplayPortPropertyData(const nsRect& aRect, uint32_t aPriority,
|
||||
bool aPainted)
|
||||
: mRect(aRect), mPriority(aPriority), mPainted(aPainted) {}
|
||||
nsRect mRect;
|
||||
uint32_t mPriority;
|
||||
bool mPainted;
|
||||
};
|
||||
|
||||
struct DisplayPortMarginsPropertyData {
|
||||
DisplayPortMarginsPropertyData(const ScreenMargin& aMargins,
|
||||
uint32_t aPriority, bool aPainted)
|
||||
: mMargins(aMargins), mPriority(aPriority), mPainted(aPainted) {}
|
||||
ScreenMargin mMargins;
|
||||
uint32_t mPriority;
|
||||
bool mPainted;
|
||||
};
|
||||
|
||||
// For GetDisplayPort
|
||||
enum class DisplayportRelativeTo { ScrollPort, ScrollFrame };
|
||||
|
||||
class DisplayPortUtils {
|
||||
public:
|
||||
/**
|
||||
* Get display port for the given element, relative to the specified entity,
|
||||
* defaulting to the scrollport.
|
||||
*/
|
||||
static bool GetDisplayPort(
|
||||
nsIContent* aContent, nsRect* aResult,
|
||||
DisplayportRelativeTo aRelativeTo = DisplayportRelativeTo::ScrollPort,
|
||||
bool* aOutPainted = nullptr);
|
||||
|
||||
/**
|
||||
* Check whether the given element has a displayport.
|
||||
*/
|
||||
static bool HasDisplayPort(nsIContent* aContent);
|
||||
|
||||
/**
|
||||
* Check whether the given element has a displayport that has already
|
||||
* been sent to the compositor via a layers or WR transaction.
|
||||
*/
|
||||
static bool HasPaintedDisplayPort(nsIContent* aContent);
|
||||
|
||||
/**
|
||||
* Mark the displayport of a given element as having been sent to
|
||||
* the compositor via a layers or WR transaction.
|
||||
*/
|
||||
static void MarkDisplayPortAsPainted(nsIContent* aContent);
|
||||
|
||||
/**
|
||||
* Check whether the given frame has a displayport. It returns false
|
||||
* for scrolled frames and true for the corresponding scroll frame.
|
||||
* Optionally pass the child, and it only returns true if the child is the
|
||||
* scrolled frame for the displayport.
|
||||
*/
|
||||
static bool FrameHasDisplayPort(nsIFrame* aFrame,
|
||||
const nsIFrame* aScrolledFrame = nullptr);
|
||||
|
||||
/**
|
||||
* Check if the given element has a margins based displayport but is missing a
|
||||
* displayport base rect that it needs to properly compute a displayport rect.
|
||||
*/
|
||||
static bool IsMissingDisplayPortBaseRect(nsIContent* aContent);
|
||||
|
||||
/**
|
||||
* Go through the IPC Channel and update displayport margins for content
|
||||
* elements based on UpdateFrame messages. The messages are left in the
|
||||
* queue and will be fully processed when dequeued. The aim is to paint
|
||||
* the most up-to-date displayport without waiting for these message to
|
||||
* go through the message queue.
|
||||
*/
|
||||
static void UpdateDisplayPortMarginsFromPendingMessages();
|
||||
|
||||
/**
|
||||
* @return the display port for the given element which should be used for
|
||||
* visibility testing purposes.
|
||||
*
|
||||
* If low-precision buffers are enabled, this is the critical display port;
|
||||
* otherwise, it's the same display port returned by GetDisplayPort().
|
||||
*/
|
||||
static bool GetDisplayPortForVisibilityTesting(
|
||||
nsIContent* aContent, nsRect* aResult,
|
||||
DisplayportRelativeTo aRelativeTo = DisplayportRelativeTo::ScrollPort);
|
||||
|
||||
enum class RepaintMode : uint8_t { Repaint, DoNotRepaint };
|
||||
|
||||
/**
|
||||
* Invalidate for displayport change.
|
||||
*/
|
||||
static void InvalidateForDisplayPortChange(
|
||||
nsIContent* aContent, bool aHadDisplayPort, const nsRect& aOldDisplayPort,
|
||||
const nsRect& aNewDisplayPort,
|
||||
RepaintMode aRepaintMode = RepaintMode::Repaint);
|
||||
|
||||
/**
|
||||
* Set the display port margins for a content element to be used with a
|
||||
* display port base (see SetDisplayPortBase()).
|
||||
* See also nsIDOMWindowUtils.setDisplayPortMargins.
|
||||
* @param aContent the content element for which to set the margins
|
||||
* @param aPresShell the pres shell for the document containing the element
|
||||
* @param aMargins the margins to set
|
||||
* @param aAlignmentX, alignmentY the amount of pixels to which to align the
|
||||
* displayport built by combining the base
|
||||
* rect with the margins, in either direction
|
||||
* @param aPriority a priority value to determine which margins take effect
|
||||
* when multiple callers specify margins
|
||||
* @param aRepaintMode whether to schedule a paint after setting the margins
|
||||
* @return true if the new margins were applied.
|
||||
*/
|
||||
static bool SetDisplayPortMargins(
|
||||
nsIContent* aContent, PresShell* aPresShell, const ScreenMargin& aMargins,
|
||||
uint32_t aPriority = 0, RepaintMode aRepaintMode = RepaintMode::Repaint);
|
||||
|
||||
/**
|
||||
* Set the display port base rect for given element to be used with display
|
||||
* port margins.
|
||||
* SetDisplayPortBaseIfNotSet is like SetDisplayPortBase except it only sets
|
||||
* the display port base to aBase if no display port base is currently set.
|
||||
*/
|
||||
static void SetDisplayPortBase(nsIContent* aContent, const nsRect& aBase);
|
||||
static void SetDisplayPortBaseIfNotSet(nsIContent* aContent,
|
||||
const nsRect& aBase);
|
||||
|
||||
/**
|
||||
* Get the critical display port for the given element.
|
||||
*/
|
||||
static bool GetCriticalDisplayPort(nsIContent* aContent, nsRect* aResult,
|
||||
bool* aOutPainted = nullptr);
|
||||
|
||||
/**
|
||||
* Check whether the given element has a critical display port.
|
||||
*/
|
||||
static bool HasCriticalDisplayPort(nsIContent* aContent);
|
||||
|
||||
/**
|
||||
* If low-precision painting is turned on, delegates to
|
||||
* GetCriticalDisplayPort. Otherwise, delegates to GetDisplayPort.
|
||||
*/
|
||||
static bool GetHighResolutionDisplayPort(nsIContent* aContent,
|
||||
nsRect* aResult,
|
||||
bool* aOutPainted = nullptr);
|
||||
|
||||
/**
|
||||
* Remove the displayport for the given element.
|
||||
*/
|
||||
static void RemoveDisplayPort(nsIContent* aContent);
|
||||
|
||||
/**
|
||||
* Return true if aPresContext's viewport has a displayport.
|
||||
*/
|
||||
static bool ViewportHasDisplayPort(nsPresContext* aPresContext);
|
||||
|
||||
/**
|
||||
* Return true if aFrame is a fixed-pos frame and is a child of a viewport
|
||||
* which has a displayport. These frames get special treatment from the
|
||||
* compositor. aDisplayPort, if non-null, is set to the display port rectangle
|
||||
* (relative to the viewport).
|
||||
*/
|
||||
static bool IsFixedPosFrameInDisplayPort(const nsIFrame* aFrame);
|
||||
|
||||
static bool MaybeCreateDisplayPortInFirstScrollFrameEncountered(
|
||||
nsIFrame* aFrame, nsDisplayListBuilder* aBuilder);
|
||||
|
||||
/**
|
||||
* Calculate a default set of displayport margins for the given scrollframe
|
||||
* and set them on the scrollframe's content element. The margins are set with
|
||||
* the default priority, which may clobber previously set margins. The repaint
|
||||
* mode provided is passed through to the call to SetDisplayPortMargins.
|
||||
* The |aScrollFrame| parameter must be non-null and queryable to an nsIFrame.
|
||||
* @return true iff the call to SetDisplayPortMargins returned true.
|
||||
*/
|
||||
static bool CalculateAndSetDisplayPortMargins(
|
||||
nsIScrollableFrame* aScrollFrame, RepaintMode aRepaintMode);
|
||||
|
||||
/**
|
||||
* If |aScrollFrame| WantsAsyncScroll() and we don't have a scrollable
|
||||
* displayport yet (as tracked by |aBuilder|), calculate and set a
|
||||
* displayport.
|
||||
*
|
||||
* If this is called during display list building pass DoNotRepaint in
|
||||
* aRepaintMode.
|
||||
*
|
||||
* Returns true if there is a displayport on an async scrollable scrollframe
|
||||
* after this call, either because one was just added or it already existed.
|
||||
*/
|
||||
static bool MaybeCreateDisplayPort(nsDisplayListBuilder* aBuilder,
|
||||
nsIFrame* aScrollFrame,
|
||||
RepaintMode aRepaintMode);
|
||||
|
||||
/**
|
||||
* Sets a zero margin display port on all proper ancestors of aFrame that
|
||||
* are async scrollable.
|
||||
*/
|
||||
static void SetZeroMarginDisplayPortOnAsyncScrollableAncestors(
|
||||
nsIFrame* aFrame);
|
||||
|
||||
/**
|
||||
* Finds the closest ancestor async scrollable frame from aFrame that has a
|
||||
* displayport and attempts to trigger the displayport expiry on that
|
||||
* ancestor.
|
||||
*/
|
||||
static void ExpireDisplayPortOnAsyncScrollableAncestor(nsIFrame* aFrame);
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // mozilla_DisplayPortUtils_h__
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
#include "GeckoMVMContext.h"
|
||||
|
||||
#include "mozilla/DisplayPortUtils.h"
|
||||
#include "mozilla/PresShell.h"
|
||||
#include "mozilla/Services.h"
|
||||
#include "mozilla/dom/Document.h"
|
||||
|
@ -168,7 +169,7 @@ void GeckoMVMContext::PostVisualViewportResizeEventByDynamicToolbar() {
|
|||
void GeckoMVMContext::UpdateDisplayPortMargins() {
|
||||
MOZ_ASSERT(mPresShell);
|
||||
if (nsIFrame* root = mPresShell->GetRootScrollFrame()) {
|
||||
bool hasDisplayPort = nsLayoutUtils::HasDisplayPort(root->GetContent());
|
||||
bool hasDisplayPort = DisplayPortUtils::HasDisplayPort(root->GetContent());
|
||||
bool hasResolution = mPresShell->GetResolution() != 1.0f;
|
||||
if (!hasDisplayPort && !hasResolution) {
|
||||
// We only want to update the displayport if there is one already, or
|
||||
|
@ -183,11 +184,11 @@ void GeckoMVMContext::UpdateDisplayPortMargins() {
|
|||
// because non-toplevel documents have no limit on their size.
|
||||
MOZ_ASSERT(
|
||||
mPresShell->GetPresContext()->IsRootContentDocumentCrossProcess());
|
||||
nsLayoutUtils::SetDisplayPortBaseIfNotSet(root->GetContent(),
|
||||
displayportBase);
|
||||
DisplayPortUtils::SetDisplayPortBaseIfNotSet(root->GetContent(),
|
||||
displayportBase);
|
||||
nsIScrollableFrame* scrollable = do_QueryFrame(root);
|
||||
nsLayoutUtils::CalculateAndSetDisplayPortMargins(
|
||||
scrollable, nsLayoutUtils::RepaintMode::Repaint);
|
||||
DisplayPortUtils::CalculateAndSetDisplayPortMargins(
|
||||
scrollable, DisplayPortUtils::RepaintMode::Repaint);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/AutoRestore.h"
|
||||
#include "mozilla/ContentIterator.h"
|
||||
#include "mozilla/DisplayPortUtils.h"
|
||||
#include "mozilla/EventDispatcher.h"
|
||||
#include "mozilla/EventStateManager.h"
|
||||
#include "mozilla/EventStates.h"
|
||||
|
@ -5869,7 +5870,7 @@ void PresShell::MarkFramesInSubtreeApproximatelyVisible(
|
|||
nsIScrollableFrame* scrollFrame = do_QueryFrame(aFrame);
|
||||
if (scrollFrame) {
|
||||
bool ignoreDisplayPort = false;
|
||||
if (nsLayoutUtils::IsMissingDisplayPortBaseRect(aFrame->GetContent())) {
|
||||
if (DisplayPortUtils::IsMissingDisplayPortBaseRect(aFrame->GetContent())) {
|
||||
// We can properly set the base rect for root scroll frames on top level
|
||||
// and root content documents. Otherwise the base rect we compute might
|
||||
// be way too big without the limiting that
|
||||
|
@ -5881,7 +5882,7 @@ void PresShell::MarkFramesInSubtreeApproximatelyVisible(
|
|||
nsRect baseRect =
|
||||
nsRect(nsPoint(0, 0),
|
||||
nsLayoutUtils::CalculateCompositionSizeForFrame(aFrame));
|
||||
nsLayoutUtils::SetDisplayPortBase(aFrame->GetContent(), baseRect);
|
||||
DisplayPortUtils::SetDisplayPortBase(aFrame->GetContent(), baseRect);
|
||||
} else {
|
||||
ignoreDisplayPort = true;
|
||||
}
|
||||
|
@ -5889,9 +5890,10 @@ void PresShell::MarkFramesInSubtreeApproximatelyVisible(
|
|||
|
||||
nsRect displayPort;
|
||||
bool usingDisplayport =
|
||||
!ignoreDisplayPort && nsLayoutUtils::GetDisplayPortForVisibilityTesting(
|
||||
aFrame->GetContent(), &displayPort,
|
||||
DisplayportRelativeTo::ScrollFrame);
|
||||
!ignoreDisplayPort &&
|
||||
DisplayPortUtils::GetDisplayPortForVisibilityTesting(
|
||||
aFrame->GetContent(), &displayPort,
|
||||
DisplayportRelativeTo::ScrollFrame);
|
||||
|
||||
scrollFrame->NotifyApproximateFrameVisibilityUpdate(!usingDisplayport);
|
||||
|
||||
|
|
|
@ -73,6 +73,7 @@ EXPORTS += [
|
|||
EXPORTS.mozilla += [
|
||||
'AccessibleCaretEventHub.h',
|
||||
'ArenaObjectID.h',
|
||||
'DisplayPortUtils.h',
|
||||
'GeckoMVMContext.h',
|
||||
'GeometryUtils.h',
|
||||
'MediaEmulationData.h',
|
||||
|
@ -101,6 +102,7 @@ UNIFIED_SOURCES += [
|
|||
'AccessibleCaret.cpp',
|
||||
'AccessibleCaretEventHub.cpp',
|
||||
'AccessibleCaretManager.cpp',
|
||||
'DisplayPortUtils.cpp',
|
||||
'GeckoMVMContext.cpp',
|
||||
'GeometryUtils.cpp',
|
||||
'LayoutLogging.cpp',
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -72,6 +72,7 @@ struct nsOverflowAreas;
|
|||
namespace mozilla {
|
||||
struct AspectRatio;
|
||||
class ComputedStyle;
|
||||
class DisplayPortUtils;
|
||||
class PresShell;
|
||||
enum class PseudoStyleType : uint8_t;
|
||||
class EventListenerManager;
|
||||
|
@ -110,31 +111,6 @@ class Layer;
|
|||
} // namespace layers
|
||||
} // namespace mozilla
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
struct DisplayPortPropertyData {
|
||||
DisplayPortPropertyData(const nsRect& aRect, uint32_t aPriority,
|
||||
bool aPainted)
|
||||
: mRect(aRect), mPriority(aPriority), mPainted(aPainted) {}
|
||||
nsRect mRect;
|
||||
uint32_t mPriority;
|
||||
bool mPainted;
|
||||
};
|
||||
|
||||
struct DisplayPortMarginsPropertyData {
|
||||
DisplayPortMarginsPropertyData(const ScreenMargin& aMargins,
|
||||
uint32_t aPriority, bool aPainted)
|
||||
: mMargins(aMargins), mPriority(aPriority), mPainted(aPainted) {}
|
||||
ScreenMargin mMargins;
|
||||
uint32_t mPriority;
|
||||
bool mPainted;
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
|
||||
// For GetDisplayPort
|
||||
enum class DisplayportRelativeTo { ScrollPort, ScrollFrame };
|
||||
|
||||
// Flags to customize the behavior of nsLayoutUtils::DrawString.
|
||||
enum class DrawStringFlags {
|
||||
Default = 0x0,
|
||||
|
@ -230,135 +206,17 @@ class nsLayoutUtils {
|
|||
*/
|
||||
static nsIScrollableFrame* FindScrollableFrameFor(ViewID aId);
|
||||
|
||||
/**
|
||||
* Helper for FindScrollableFrameFor(), also used in DisplayPortUtils.
|
||||
* Most clients should use FindScrollableFrameFor().
|
||||
*/
|
||||
static nsIFrame* GetScrollFrameFromContent(nsIContent* aContent);
|
||||
|
||||
/**
|
||||
* Find the ID for a given scrollable frame.
|
||||
*/
|
||||
static ViewID FindIDForScrollableFrame(nsIScrollableFrame* aScrollable);
|
||||
|
||||
/**
|
||||
* Get display port for the given element, relative to the specified entity,
|
||||
* defaulting to the scrollport.
|
||||
*/
|
||||
static bool GetDisplayPort(
|
||||
nsIContent* aContent, nsRect* aResult,
|
||||
DisplayportRelativeTo aRelativeTo = DisplayportRelativeTo::ScrollPort,
|
||||
bool* aOutPainted = nullptr);
|
||||
|
||||
/**
|
||||
* Check whether the given element has a displayport.
|
||||
*/
|
||||
static bool HasDisplayPort(nsIContent* aContent);
|
||||
|
||||
/**
|
||||
* Check whether the given element has a displayport that has already
|
||||
* been sent to the compositor via a layers or WR transaction.
|
||||
*/
|
||||
static bool HasPaintedDisplayPort(nsIContent* aContent);
|
||||
|
||||
/**
|
||||
* Mark the displayport of a given element as having been sent to
|
||||
* the compositor via a layers or WR transaction.
|
||||
*/
|
||||
static void MarkDisplayPortAsPainted(nsIContent* aContent);
|
||||
|
||||
/**
|
||||
* Check whether the given frame has a displayport. It returns false
|
||||
* for scrolled frames and true for the corresponding scroll frame.
|
||||
* Optionally pass the child, and it only returns true if the child is the
|
||||
* scrolled frame for the displayport.
|
||||
*/
|
||||
static bool FrameHasDisplayPort(nsIFrame* aFrame,
|
||||
const nsIFrame* aScrolledFrame = nullptr);
|
||||
|
||||
/**
|
||||
* Check if the given element has a margins based displayport but is missing a
|
||||
* displayport base rect that it needs to properly compute a displayport rect.
|
||||
*/
|
||||
static bool IsMissingDisplayPortBaseRect(nsIContent* aContent);
|
||||
|
||||
/**
|
||||
* Go through the IPC Channel and update displayport margins for content
|
||||
* elements based on UpdateFrame messages. The messages are left in the
|
||||
* queue and will be fully processed when dequeued. The aim is to paint
|
||||
* the most up-to-date displayport without waiting for these message to
|
||||
* go through the message queue.
|
||||
*/
|
||||
static void UpdateDisplayPortMarginsFromPendingMessages();
|
||||
|
||||
/**
|
||||
* @return the display port for the given element which should be used for
|
||||
* visibility testing purposes.
|
||||
*
|
||||
* If low-precision buffers are enabled, this is the critical display port;
|
||||
* otherwise, it's the same display port returned by GetDisplayPort().
|
||||
*/
|
||||
static bool GetDisplayPortForVisibilityTesting(
|
||||
nsIContent* aContent, nsRect* aResult,
|
||||
DisplayportRelativeTo aRelativeTo = DisplayportRelativeTo::ScrollPort);
|
||||
|
||||
enum class RepaintMode : uint8_t { Repaint, DoNotRepaint };
|
||||
|
||||
/**
|
||||
* Invalidate for displayport change.
|
||||
*/
|
||||
static void InvalidateForDisplayPortChange(
|
||||
nsIContent* aContent, bool aHadDisplayPort, const nsRect& aOldDisplayPort,
|
||||
const nsRect& aNewDisplayPort,
|
||||
RepaintMode aRepaintMode = RepaintMode::Repaint);
|
||||
|
||||
/**
|
||||
* Set the display port margins for a content element to be used with a
|
||||
* display port base (see SetDisplayPortBase()).
|
||||
* See also nsIDOMWindowUtils.setDisplayPortMargins.
|
||||
* @param aContent the content element for which to set the margins
|
||||
* @param aPresShell the pres shell for the document containing the element
|
||||
* @param aMargins the margins to set
|
||||
* @param aAlignmentX, alignmentY the amount of pixels to which to align the
|
||||
* displayport built by combining the base
|
||||
* rect with the margins, in either direction
|
||||
* @param aPriority a priority value to determine which margins take effect
|
||||
* when multiple callers specify margins
|
||||
* @param aRepaintMode whether to schedule a paint after setting the margins
|
||||
* @return true if the new margins were applied.
|
||||
*/
|
||||
static bool SetDisplayPortMargins(
|
||||
nsIContent* aContent, PresShell* aPresShell, const ScreenMargin& aMargins,
|
||||
uint32_t aPriority = 0, RepaintMode aRepaintMode = RepaintMode::Repaint);
|
||||
|
||||
/**
|
||||
* Set the display port base rect for given element to be used with display
|
||||
* port margins.
|
||||
* SetDisplayPortBaseIfNotSet is like SetDisplayPortBase except it only sets
|
||||
* the display port base to aBase if no display port base is currently set.
|
||||
*/
|
||||
static void SetDisplayPortBase(nsIContent* aContent, const nsRect& aBase);
|
||||
static void SetDisplayPortBaseIfNotSet(nsIContent* aContent,
|
||||
const nsRect& aBase);
|
||||
|
||||
/**
|
||||
* Get the critical display port for the given element.
|
||||
*/
|
||||
static bool GetCriticalDisplayPort(nsIContent* aContent, nsRect* aResult,
|
||||
bool* aOutPainted = nullptr);
|
||||
|
||||
/**
|
||||
* Check whether the given element has a critical display port.
|
||||
*/
|
||||
static bool HasCriticalDisplayPort(nsIContent* aContent);
|
||||
|
||||
/**
|
||||
* If low-precision painting is turned on, delegates to
|
||||
* GetCriticalDisplayPort. Otherwise, delegates to GetDisplayPort.
|
||||
*/
|
||||
static bool GetHighResolutionDisplayPort(nsIContent* aContent,
|
||||
nsRect* aResult,
|
||||
bool* aOutPainted = nullptr);
|
||||
|
||||
/**
|
||||
* Remove the displayport for the given element.
|
||||
*/
|
||||
static void RemoveDisplayPort(nsIContent* aContent);
|
||||
|
||||
/**
|
||||
* Notify the scroll frame with the given scroll id that its scroll offset
|
||||
* is being sent to APZ as part of a paint-skip transaction.
|
||||
|
@ -654,19 +512,6 @@ class nsLayoutUtils {
|
|||
*/
|
||||
static ViewID ScrollIdForRootScrollFrame(nsPresContext* aPresContext);
|
||||
|
||||
/**
|
||||
* Return true if aPresContext's viewport has a displayport.
|
||||
*/
|
||||
static bool ViewportHasDisplayPort(nsPresContext* aPresContext);
|
||||
|
||||
/**
|
||||
* Return true if aFrame is a fixed-pos frame and is a child of a viewport
|
||||
* which has a displayport. These frames get special treatment from the
|
||||
* compositor. aDisplayPort, if non-null, is set to the display port rectangle
|
||||
* (relative to the viewport).
|
||||
*/
|
||||
static bool IsFixedPosFrameInDisplayPort(const nsIFrame* aFrame);
|
||||
|
||||
/**
|
||||
* GetScrollableFrameFor returns the scrollable frame for a scrolled frame
|
||||
*/
|
||||
|
@ -1205,9 +1050,6 @@ class nsLayoutUtils {
|
|||
const nscoord aRadii[8],
|
||||
const nsRect& aTestRect);
|
||||
|
||||
static bool MaybeCreateDisplayPortInFirstScrollFrameEncountered(
|
||||
nsIFrame* aFrame, nsDisplayListBuilder* aBuilder);
|
||||
|
||||
enum class PaintFrameFlags : uint32_t {
|
||||
InTransform = 0x01,
|
||||
SyncDecodeImages = 0x02,
|
||||
|
@ -2784,47 +2626,8 @@ class nsLayoutUtils {
|
|||
static FrameMetrics CalculateBasicFrameMetrics(
|
||||
nsIScrollableFrame* aScrollFrame);
|
||||
|
||||
/**
|
||||
* Calculate a default set of displayport margins for the given scrollframe
|
||||
* and set them on the scrollframe's content element. The margins are set with
|
||||
* the default priority, which may clobber previously set margins. The repaint
|
||||
* mode provided is passed through to the call to SetDisplayPortMargins.
|
||||
* The |aScrollFrame| parameter must be non-null and queryable to an nsIFrame.
|
||||
* @return true iff the call to SetDisplayPortMargins returned true.
|
||||
*/
|
||||
static bool CalculateAndSetDisplayPortMargins(
|
||||
nsIScrollableFrame* aScrollFrame, RepaintMode aRepaintMode);
|
||||
|
||||
/**
|
||||
* If |aScrollFrame| WantsAsyncScroll() and we don't have a scrollable
|
||||
* displayport yet (as tracked by |aBuilder|), calculate and set a
|
||||
* displayport.
|
||||
*
|
||||
* If this is called during display list building pass DoNotRepaint in
|
||||
* aRepaintMode.
|
||||
*
|
||||
* Returns true if there is a displayport on an async scrollable scrollframe
|
||||
* after this call, either because one was just added or it already existed.
|
||||
*/
|
||||
static bool MaybeCreateDisplayPort(nsDisplayListBuilder* aBuilder,
|
||||
nsIFrame* aScrollFrame,
|
||||
RepaintMode aRepaintMode);
|
||||
|
||||
static nsIScrollableFrame* GetAsyncScrollableAncestorFrame(nsIFrame* aTarget);
|
||||
|
||||
/**
|
||||
* Sets a zero margin display port on all proper ancestors of aFrame that
|
||||
* are async scrollable.
|
||||
*/
|
||||
static void SetZeroMarginDisplayPortOnAsyncScrollableAncestors(
|
||||
nsIFrame* aFrame);
|
||||
/**
|
||||
* Finds the closest ancestor async scrollable frame from aFrame that has a
|
||||
* displayport and attempts to trigger the displayport expiry on that
|
||||
* ancestor.
|
||||
*/
|
||||
static void ExpireDisplayPortOnAsyncScrollableAncestor(nsIFrame* aFrame);
|
||||
|
||||
static void SetBSizeFromFontMetrics(
|
||||
const nsIFrame* aFrame, mozilla::ReflowOutput& aMetrics,
|
||||
const mozilla::LogicalMargin& aFramePadding, mozilla::WritingMode aLineWM,
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#include "mozilla/AutoRestore.h"
|
||||
#include "mozilla/BasePrincipal.h"
|
||||
#include "mozilla/DebugOnly.h"
|
||||
#include "mozilla/DisplayPortUtils.h"
|
||||
#include "mozilla/InputTaskManager.h"
|
||||
#include "mozilla/IntegerRange.h"
|
||||
#include "mozilla/PresShell.h"
|
||||
|
@ -2092,7 +2093,7 @@ void nsRefreshDriver::Tick(VsyncId aId, TimeStamp aNowTime) {
|
|||
// in the queue. This will prevent us from spending precious time
|
||||
// painting a stale displayport.
|
||||
if (StaticPrefs::apz_peek_messages_enabled()) {
|
||||
nsLayoutUtils::UpdateDisplayPortMarginsFromPendingMessages();
|
||||
DisplayPortUtils::UpdateDisplayPortMarginsFromPendingMessages();
|
||||
}
|
||||
|
||||
AutoTArray<nsCOMPtr<nsIRunnable>, 16> earlyRunners = std::move(mEarlyRunners);
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
#include "nsBidiUtils.h"
|
||||
#include "nsDocShell.h"
|
||||
#include "mozilla/ContentEvents.h"
|
||||
#include "mozilla/DisplayPortUtils.h"
|
||||
#include "mozilla/EventDispatcher.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/PresShell.h"
|
||||
|
@ -2245,9 +2246,10 @@ ScrollFrameHelper::ScrollFrameHelper(nsContainerFrame* aOuter, bool aIsRoot)
|
|||
// If we have tiling but no APZ, then set a 0-margin display port on
|
||||
// active scroll containers so that we paint by whole tile increments
|
||||
// when scrolling.
|
||||
nsLayoutUtils::SetDisplayPortMargins(
|
||||
DisplayPortUtils::SetDisplayPortMargins(
|
||||
mOuter->GetContent(), mOuter->PresShell(), ScreenMargin(), 0);
|
||||
nsLayoutUtils::SetZeroMarginDisplayPortOnAsyncScrollableAncestors(mOuter);
|
||||
DisplayPortUtils::SetZeroMarginDisplayPortOnAsyncScrollableAncestors(
|
||||
mOuter);
|
||||
}
|
||||
|
||||
if (mIsRoot) {
|
||||
|
@ -2624,8 +2626,8 @@ static void RemoveDisplayPortCallback(nsITimer* aTimer, void* aClosure) {
|
|||
// happens between actual painting. If the displayport is reset to a
|
||||
// different position that's ok; this scrollframe hasn't been scrolled
|
||||
// recently and so the reset should be correct.
|
||||
nsLayoutUtils::RemoveDisplayPort(helper->mOuter->GetContent());
|
||||
nsLayoutUtils::ExpireDisplayPortOnAsyncScrollableAncestor(helper->mOuter);
|
||||
DisplayPortUtils::RemoveDisplayPort(helper->mOuter->GetContent());
|
||||
DisplayPortUtils::ExpireDisplayPortOnAsyncScrollableAncestor(helper->mOuter);
|
||||
helper->mOuter->SchedulePaint();
|
||||
// Be conservative and unflag this this scrollframe as being scrollable by
|
||||
// APZ. If it is still scrollable this will get flipped back soon enough.
|
||||
|
@ -2828,7 +2830,7 @@ void ScrollFrameHelper::NotifyApproximateFrameVisibilityUpdate(
|
|||
mHadDisplayPortAtLastFrameUpdate = false;
|
||||
mDisplayPortAtLastFrameUpdate = nsRect();
|
||||
} else {
|
||||
mHadDisplayPortAtLastFrameUpdate = nsLayoutUtils::GetDisplayPort(
|
||||
mHadDisplayPortAtLastFrameUpdate = DisplayPortUtils::GetDisplayPort(
|
||||
mOuter->GetContent(), &mDisplayPortAtLastFrameUpdate);
|
||||
}
|
||||
}
|
||||
|
@ -2985,7 +2987,7 @@ void ScrollFrameHelper::ScrollToImpl(nsPoint aPt, const nsRect& aRange,
|
|||
|
||||
nsRect oldDisplayPort;
|
||||
nsIContent* content = mOuter->GetContent();
|
||||
nsLayoutUtils::GetHighResolutionDisplayPort(content, &oldDisplayPort);
|
||||
DisplayPortUtils::GetHighResolutionDisplayPort(content, &oldDisplayPort);
|
||||
oldDisplayPort.MoveBy(-mScrolledFrame->GetPosition());
|
||||
|
||||
// Update frame position for scrolling
|
||||
|
@ -3045,7 +3047,7 @@ void ScrollFrameHelper::ScrollToImpl(nsPoint aPt, const nsRect& aRange,
|
|||
// fixing this properly.
|
||||
nsRect displayPort;
|
||||
bool usingDisplayPort =
|
||||
nsLayoutUtils::GetHighResolutionDisplayPort(content, &displayPort);
|
||||
DisplayPortUtils::GetHighResolutionDisplayPort(content, &displayPort);
|
||||
displayPort.MoveBy(-mScrolledFrame->GetPosition());
|
||||
|
||||
PAINT_SKIP_LOG(
|
||||
|
@ -3933,9 +3935,9 @@ void ScrollFrameHelper::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|||
// detected earlier. We also won't confuse RetainedDisplayLists
|
||||
// with the silent change, since we explicitly request partial updates
|
||||
// to be disabled on the next paint.
|
||||
nsLayoutUtils::SetDisplayPortMargins(
|
||||
DisplayPortUtils::SetDisplayPortMargins(
|
||||
mOuter->GetContent(), mOuter->PresShell(), ScreenMargin(), 0,
|
||||
nsLayoutUtils::RepaintMode::DoNotRepaint);
|
||||
DisplayPortUtils::RepaintMode::DoNotRepaint);
|
||||
// Call DecideScrollableLayer to recompute mWillBuildScrollableLayer
|
||||
// and recompute the current animated geometry root if needed. It's
|
||||
// too late to change the dirty rect so pass a copy.
|
||||
|
@ -4108,8 +4110,8 @@ nsRect ScrollFrameHelper::RestrictToRootDisplayPort(
|
|||
|
||||
nsRect rootDisplayPort;
|
||||
bool hasDisplayPort =
|
||||
rootFrame->GetContent() &&
|
||||
nsLayoutUtils::GetDisplayPort(rootFrame->GetContent(), &rootDisplayPort);
|
||||
rootFrame->GetContent() && DisplayPortUtils::GetDisplayPort(
|
||||
rootFrame->GetContent(), &rootDisplayPort);
|
||||
if (hasDisplayPort) {
|
||||
// The display port of the root frame already factors in it's callback
|
||||
// transform, so subtract it out here, the GetCumulativeApzCallbackTransform
|
||||
|
@ -4221,7 +4223,7 @@ bool ScrollFrameHelper::DecideScrollableLayer(
|
|||
bool oldWillBuildScrollableLayer = mWillBuildScrollableLayer;
|
||||
|
||||
nsIContent* content = mOuter->GetContent();
|
||||
bool usingDisplayPort = nsLayoutUtils::HasDisplayPort(content);
|
||||
bool usingDisplayPort = DisplayPortUtils::HasDisplayPort(content);
|
||||
if (aBuilder->IsPaintingToWindow()) {
|
||||
if (aSetBase) {
|
||||
nsRect displayportBase = *aVisibleRect;
|
||||
|
@ -4263,7 +4265,8 @@ bool ScrollFrameHelper::DecideScrollableLayer(
|
|||
displayportBase -= mScrollPort.TopLeft();
|
||||
}
|
||||
|
||||
nsLayoutUtils::SetDisplayPortBase(mOuter->GetContent(), displayportBase);
|
||||
DisplayPortUtils::SetDisplayPortBase(mOuter->GetContent(),
|
||||
displayportBase);
|
||||
}
|
||||
|
||||
// If we don't have aSetBase == true then should have already
|
||||
|
@ -4271,7 +4274,7 @@ bool ScrollFrameHelper::DecideScrollableLayer(
|
|||
// displayport base.
|
||||
MOZ_ASSERT(content->GetProperty(nsGkAtoms::DisplayPortBase));
|
||||
nsRect displayPort;
|
||||
usingDisplayPort = nsLayoutUtils::GetDisplayPort(
|
||||
usingDisplayPort = DisplayPortUtils::GetDisplayPort(
|
||||
content, &displayPort, DisplayportRelativeTo::ScrollFrame);
|
||||
|
||||
if (usingDisplayPort) {
|
||||
|
@ -4391,7 +4394,7 @@ void ScrollFrameHelper::ClipLayerToDisplayPort(
|
|||
bool ScrollFrameHelper::IsRectNearlyVisible(const nsRect& aRect) const {
|
||||
// Use the right rect depending on if a display port is set.
|
||||
nsRect displayPort;
|
||||
bool usingDisplayport = nsLayoutUtils::GetDisplayPort(
|
||||
bool usingDisplayport = DisplayPortUtils::GetDisplayPort(
|
||||
mOuter->GetContent(), &displayPort, DisplayportRelativeTo::ScrollFrame);
|
||||
return aRect.Intersects(
|
||||
ExpandRectToNearlyVisible(usingDisplayport ? displayPort : mScrollPort));
|
||||
|
@ -4626,7 +4629,7 @@ void ScrollFrameHelper::ScrollBy(nsIntPoint aDelta, ScrollUnit aUnit,
|
|||
mScrollUpdates.AppendElement(ScrollPositionUpdate::NewPureRelativeScroll(
|
||||
mScrollGeneration, aOrigin, aMode, delta));
|
||||
|
||||
if (!nsLayoutUtils::HasDisplayPort(mOuter->GetContent())) {
|
||||
if (!DisplayPortUtils::HasDisplayPort(mOuter->GetContent())) {
|
||||
if (MOZ_LOG_TEST(sDisplayportLog, LogLevel::Debug)) {
|
||||
mozilla::layers::ScrollableLayerGuid::ViewID viewID =
|
||||
mozilla::layers::ScrollableLayerGuid::NULL_SCROLL_ID;
|
||||
|
@ -4636,10 +4639,12 @@ void ScrollFrameHelper::ScrollBy(nsIntPoint aDelta, ScrollUnit aUnit,
|
|||
("ScrollBy setting displayport on scrollId=%" PRIu64 "\n", viewID));
|
||||
}
|
||||
|
||||
nsLayoutUtils::CalculateAndSetDisplayPortMargins(
|
||||
mOuter->GetScrollTargetFrame(), nsLayoutUtils::RepaintMode::Repaint);
|
||||
DisplayPortUtils::CalculateAndSetDisplayPortMargins(
|
||||
mOuter->GetScrollTargetFrame(),
|
||||
DisplayPortUtils::RepaintMode::Repaint);
|
||||
nsIFrame* frame = do_QueryFrame(mOuter->GetScrollTargetFrame());
|
||||
nsLayoutUtils::SetZeroMarginDisplayPortOnAsyncScrollableAncestors(frame);
|
||||
DisplayPortUtils::SetZeroMarginDisplayPortOnAsyncScrollableAncestors(
|
||||
frame);
|
||||
}
|
||||
|
||||
mOuter->SchedulePaint();
|
||||
|
@ -5878,7 +5883,7 @@ bool ScrollFrameHelper::IsMaybeScrollingActive() const {
|
|||
|
||||
nsIContent* content = mOuter->GetContent();
|
||||
return mHasBeenScrolledRecently || IsAlwaysActive() ||
|
||||
nsLayoutUtils::HasDisplayPort(content) ||
|
||||
DisplayPortUtils::HasDisplayPort(content) ||
|
||||
nsContentUtils::HasScrollgrab(content);
|
||||
}
|
||||
|
||||
|
@ -5892,7 +5897,7 @@ bool ScrollFrameHelper::IsScrollingActive(
|
|||
|
||||
nsIContent* content = mOuter->GetContent();
|
||||
return mHasBeenScrolledRecently || IsAlwaysActive() ||
|
||||
nsLayoutUtils::HasDisplayPort(content) ||
|
||||
DisplayPortUtils::HasDisplayPort(content) ||
|
||||
nsContentUtils::HasScrollgrab(content);
|
||||
}
|
||||
|
||||
|
@ -7703,7 +7708,7 @@ void ScrollFrameHelper::ApzSmoothScrollTo(const nsPoint& aDestination,
|
|||
mScrollUpdates.AppendElement(ScrollPositionUpdate::NewSmoothScroll(
|
||||
mScrollGeneration, aOrigin, aDestination));
|
||||
|
||||
if (!nsLayoutUtils::HasDisplayPort(mOuter->GetContent())) {
|
||||
if (!DisplayPortUtils::HasDisplayPort(mOuter->GetContent())) {
|
||||
// If this frame doesn't have a displayport then there won't be an
|
||||
// APZC instance for it and so there won't be anything to process
|
||||
// this smooth scroll request. We should set a displayport on this
|
||||
|
@ -7718,10 +7723,10 @@ void ScrollFrameHelper::ApzSmoothScrollTo(const nsPoint& aDestination,
|
|||
viewID));
|
||||
}
|
||||
|
||||
nsLayoutUtils::CalculateAndSetDisplayPortMargins(
|
||||
mOuter->GetScrollTargetFrame(), nsLayoutUtils::RepaintMode::Repaint);
|
||||
DisplayPortUtils::CalculateAndSetDisplayPortMargins(
|
||||
mOuter->GetScrollTargetFrame(), DisplayPortUtils::RepaintMode::Repaint);
|
||||
nsIFrame* frame = do_QueryFrame(mOuter->GetScrollTargetFrame());
|
||||
nsLayoutUtils::SetZeroMarginDisplayPortOnAsyncScrollableAncestors(frame);
|
||||
DisplayPortUtils::SetZeroMarginDisplayPortOnAsyncScrollableAncestors(frame);
|
||||
}
|
||||
|
||||
// Schedule a paint to ensure that the frame metrics get updated on
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/ComputedStyle.h"
|
||||
#include "mozilla/DebugOnly.h"
|
||||
#include "mozilla/DisplayPortUtils.h"
|
||||
#include "mozilla/dom/ElementInlines.h"
|
||||
#include "mozilla/dom/ImageTracker.h"
|
||||
#include "mozilla/dom/Selection.h"
|
||||
|
@ -3270,9 +3271,10 @@ void nsIFrame::BuildDisplayListForStackingContext(
|
|||
nsLayoutUtils::GetNearestScrollableFrame(
|
||||
GetParent(), nsLayoutUtils::SCROLLABLE_SAME_DOC |
|
||||
nsLayoutUtils::SCROLLABLE_INCLUDE_HIDDEN));
|
||||
bool useFixedPosition = disp->mPosition == StylePositionProperty::Fixed &&
|
||||
(nsLayoutUtils::IsFixedPosFrameInDisplayPort(this) ||
|
||||
BuilderHasScrolledClip(aBuilder));
|
||||
bool useFixedPosition =
|
||||
disp->mPosition == StylePositionProperty::Fixed &&
|
||||
(DisplayPortUtils::IsFixedPosFrameInDisplayPort(this) ||
|
||||
BuilderHasScrolledClip(aBuilder));
|
||||
|
||||
nsDisplayListBuilder::AutoBuildingDisplayList buildingDisplayList(
|
||||
aBuilder, this, visibleRect, dirtyRect, isTransformed);
|
||||
|
@ -6968,7 +6970,7 @@ Matrix4x4Flagged nsIFrame::GetTransformMatrix(ViewportType aViewportType,
|
|||
ViewportUtils::IsZoomedContentRoot(aAncestor) ||
|
||||
((aFlags & STOP_AT_STACKING_CONTEXT_AND_DISPLAY_PORT) &&
|
||||
(aAncestor->IsStackingContext() ||
|
||||
nsLayoutUtils::FrameHasDisplayPort(aAncestor, aCurrent)));
|
||||
DisplayPortUtils::FrameHasDisplayPort(aAncestor, aCurrent)));
|
||||
};
|
||||
while (*aOutAncestor != aStopAtAncestor.mFrame &&
|
||||
!shouldStopAt(current, *aOutAncestor, aFlags)) {
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include "gfxEnv.h"
|
||||
#include "gfxUtils.h"
|
||||
#include "mozilla/DebugOnly.h"
|
||||
#include "mozilla/DisplayPortUtils.h"
|
||||
#include "mozilla/EffectCompositor.h"
|
||||
#include "mozilla/LayerAnimationInfo.h"
|
||||
#include "mozilla/LayerTimelineMarker.h"
|
||||
|
@ -4253,7 +4254,7 @@ nsRect ContainerState::GetDisplayPortForAnimatedGeometryRoot(
|
|||
return mLastDisplayPortRect;
|
||||
}
|
||||
|
||||
bool usingDisplayport = nsLayoutUtils::GetDisplayPort(
|
||||
bool usingDisplayport = DisplayPortUtils::GetDisplayPort(
|
||||
(*aAnimatedGeometryRoot)->GetContent(), &mLastDisplayPortRect,
|
||||
DisplayportRelativeTo::ScrollFrame);
|
||||
if (!usingDisplayport) {
|
||||
|
|
|
@ -11,11 +11,13 @@
|
|||
#include "mozilla/StaticPrefs_layout.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsIFrameInlines.h"
|
||||
#include "nsIScrollableFrame.h"
|
||||
#include "nsPlaceholderFrame.h"
|
||||
#include "nsSubDocumentFrame.h"
|
||||
#include "nsViewManager.h"
|
||||
#include "nsCanvasFrame.h"
|
||||
#include "mozilla/AutoRestore.h"
|
||||
#include "mozilla/DisplayPortUtils.h"
|
||||
#include "mozilla/PresShell.h"
|
||||
|
||||
/**
|
||||
|
@ -1031,7 +1033,7 @@ static bool ProcessFrameInternal(nsIFrame* aFrame,
|
|||
nsIScrollableFrame* sf = do_QueryFrame(currentFrame);
|
||||
nsIContent* content = sf ? currentFrame->GetContent() : nullptr;
|
||||
|
||||
if (content && nsLayoutUtils::GetDisplayPort(content, &displayPort)) {
|
||||
if (content && DisplayPortUtils::GetDisplayPort(content, &displayPort)) {
|
||||
CRR_LOG("Frame belongs to displayport frame %p\n", currentFrame);
|
||||
|
||||
// Get overflow relative to the scrollport (from the scrollframe)
|
||||
|
@ -1412,8 +1414,8 @@ PartialUpdateResult RetainedDisplayListBuilder::AttemptPartialUpdate(
|
|||
mBuilder.EnterPresShell(mBuilder.RootReferenceFrame());
|
||||
|
||||
// We set the override dirty regions during ComputeRebuildRegion or in
|
||||
// nsLayoutUtils::InvalidateForDisplayPortChange. The display port change also
|
||||
// marks the frame modified, so those regions are cleared here as well.
|
||||
// DisplayPortUtils::InvalidateForDisplayPortChange. The display port change
|
||||
// also marks the frame modified, so those regions are cleared here as well.
|
||||
AutoClearFramePropsArray modifiedFrames(64);
|
||||
AutoClearFramePropsArray framesWithProps;
|
||||
GetModifiedAndFramesWithProps(&mBuilder, &modifiedFrames.Frames(),
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
|
||||
#include "gfxContext.h"
|
||||
#include "gfxUtils.h"
|
||||
#include "mozilla/DisplayPortUtils.h"
|
||||
#include "mozilla/dom/BrowserChild.h"
|
||||
#include "mozilla/dom/HTMLCanvasElement.h"
|
||||
#include "mozilla/dom/Selection.h"
|
||||
|
@ -487,7 +488,7 @@ nsRect nsDisplayListBuilder::OutOfFlowDisplayData::ComputeVisibleRectForFrame(
|
|||
bool inPartialUpdate =
|
||||
aBuilder->IsRetainingDisplayList() && aBuilder->IsPartialUpdate();
|
||||
if (StaticPrefs::apz_allow_zooming() &&
|
||||
nsLayoutUtils::IsFixedPosFrameInDisplayPort(aFrame) &&
|
||||
DisplayPortUtils::IsFixedPosFrameInDisplayPort(aFrame) &&
|
||||
aBuilder->IsPaintingToWindow() && !inPartialUpdate) {
|
||||
dirtyRectRelativeToDirtyFrame =
|
||||
nsRect(nsPoint(0, 0), aFrame->GetParent()->GetSize());
|
||||
|
@ -511,7 +512,7 @@ nsRect nsDisplayListBuilder::OutOfFlowDisplayData::ComputeVisibleRectForFrame(
|
|||
// space: it's relative to the scroll port (= layout viewport), but
|
||||
// covers the visual viewport with some margins around it, which is
|
||||
// exactly what we want.
|
||||
if (nsLayoutUtils::GetHighResolutionDisplayPort(
|
||||
if (DisplayPortUtils::GetHighResolutionDisplayPort(
|
||||
rootScrollFrame->GetContent(), &displayport)) {
|
||||
dirtyRectRelativeToDirtyFrame = displayport;
|
||||
}
|
||||
|
@ -1570,14 +1571,14 @@ nsDisplayListBuilder::AGRState nsDisplayListBuilder::IsAnimatedGeometryRoot(
|
|||
}
|
||||
|
||||
if (!aFrame->GetParent() &&
|
||||
nsLayoutUtils::ViewportHasDisplayPort(aFrame->PresContext())) {
|
||||
DisplayPortUtils::ViewportHasDisplayPort(aFrame->PresContext())) {
|
||||
// Viewport frames in a display port need to be animated geometry roots
|
||||
// for background-attachment:fixed elements.
|
||||
return AGR_YES;
|
||||
}
|
||||
|
||||
// Fixed-pos frames are parented by the viewport frame, which has no parent.
|
||||
if (nsLayoutUtils::IsFixedPosFrameInDisplayPort(aFrame)) {
|
||||
if (DisplayPortUtils::IsFixedPosFrameInDisplayPort(aFrame)) {
|
||||
return AGR_YES;
|
||||
}
|
||||
|
||||
|
@ -2351,7 +2352,7 @@ FrameLayerBuilder* nsDisplayList::BuildLayers(nsDisplayListBuilder* aBuilder,
|
|||
if (nsIFrame* rootScrollFrame = presShell->GetRootScrollFrame()) {
|
||||
nsIContent* content = rootScrollFrame->GetContent();
|
||||
if (content) {
|
||||
usingDisplayport = nsLayoutUtils::HasDisplayPort(content);
|
||||
usingDisplayport = DisplayPortUtils::HasDisplayPort(content);
|
||||
}
|
||||
}
|
||||
if (usingDisplayport &&
|
||||
|
@ -6493,7 +6494,7 @@ void nsDisplaySubDocument::Disown() {
|
|||
static bool UseDisplayPortForViewport(nsDisplayListBuilder* aBuilder,
|
||||
nsIFrame* aFrame) {
|
||||
return aBuilder->IsPaintingToWindow() &&
|
||||
nsLayoutUtils::ViewportHasDisplayPort(aFrame->PresContext());
|
||||
DisplayPortUtils::ViewportHasDisplayPort(aFrame->PresContext());
|
||||
}
|
||||
|
||||
nsRect nsDisplaySubDocument::GetBounds(nsDisplayListBuilder* aBuilder,
|
||||
|
@ -6521,9 +6522,9 @@ bool nsDisplaySubDocument::ComputeVisibility(nsDisplayListBuilder* aBuilder,
|
|||
nsRect displayport;
|
||||
nsIFrame* rootScrollFrame = mFrame->PresShell()->GetRootScrollFrame();
|
||||
MOZ_ASSERT(rootScrollFrame);
|
||||
Unused << nsLayoutUtils::GetDisplayPort(rootScrollFrame->GetContent(),
|
||||
&displayport,
|
||||
DisplayportRelativeTo::ScrollFrame);
|
||||
Unused << DisplayPortUtils::GetDisplayPort(
|
||||
rootScrollFrame->GetContent(), &displayport,
|
||||
DisplayportRelativeTo::ScrollFrame);
|
||||
|
||||
nsRegion childVisibleRegion;
|
||||
// The visible region for the children may be much bigger than the hole we
|
||||
|
@ -7379,7 +7380,7 @@ void nsDisplayTransform::SetReferenceFrameToAncestor(
|
|||
nsIFrame* outerFrame = nsLayoutUtils::GetCrossDocParentFrame(mFrame);
|
||||
mReferenceFrame = aBuilder->FindReferenceFrameFor(outerFrame);
|
||||
mToReferenceFrame = mFrame->GetOffsetToCrossDoc(mReferenceFrame);
|
||||
if (nsLayoutUtils::IsFixedPosFrameInDisplayPort(mFrame)) {
|
||||
if (DisplayPortUtils::IsFixedPosFrameInDisplayPort(mFrame)) {
|
||||
// This is an odd special case. If we are both IsFixedPosFrameInDisplayPort
|
||||
// and transformed that we are our own AGR parent.
|
||||
// We want our frame to be our AGR because FrameLayerBuilder uses our AGR to
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include "nsFrameManager.h"
|
||||
#include "nsLayoutUtils.h"
|
||||
#include "mozilla/BasicEvents.h"
|
||||
#include "mozilla/DisplayPortUtils.h"
|
||||
#include "mozilla/PresShell.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
@ -169,7 +170,7 @@ void nsRootBoxFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|||
// base rect.
|
||||
nsRect displayPortBase =
|
||||
aBuilder->GetVisibleRect().Intersect(nsRect(nsPoint(0, 0), GetSize()));
|
||||
nsLayoutUtils::SetDisplayPortBase(mContent, displayPortBase);
|
||||
DisplayPortUtils::SetDisplayPortBase(mContent, displayPortBase);
|
||||
}
|
||||
|
||||
// root boxes don't need a debug border/outline or a selection overlay...
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
#include "nsDisplayList.h"
|
||||
#include "nsRefreshDriver.h" // for nsAPostRefreshObserver
|
||||
#include "mozilla/Assertions.h" // for MOZ_ASSERT
|
||||
#include "mozilla/DisplayPortUtils.h"
|
||||
#include "mozilla/LookAndFeel.h"
|
||||
#include "mozilla/MouseEvents.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
|
@ -996,7 +997,7 @@ void nsSliderFrame::StartAPZDrag(WidgetGUIEvent* aEvent) {
|
|||
return;
|
||||
}
|
||||
|
||||
if (!nsLayoutUtils::HasDisplayPort(scrollableContent)) {
|
||||
if (!DisplayPortUtils::HasDisplayPort(scrollableContent)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче