mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 11:25:00 +00:00
Bug 1113774 - Transitioned FrameMetric mDisplayPort accesses to Get/Set method calls. r=kats
This commit is contained in:
parent
91cb86ec1b
commit
0e7074b2bd
@ -40,10 +40,10 @@ public:
|
||||
|
||||
FrameMetrics()
|
||||
: mCompositionBounds(0, 0, 0, 0)
|
||||
, mDisplayPort(0, 0, 0, 0)
|
||||
, mCriticalDisplayPort(0, 0, 0, 0)
|
||||
, mScrollableRect(0, 0, 0, 0)
|
||||
, mPresShellResolution(1)
|
||||
, mDisplayPort(0, 0, 0, 0)
|
||||
, mCumulativeResolution(1)
|
||||
, mDevPixelsPerCSSPixel(1)
|
||||
, mMayHaveTouchListeners(false)
|
||||
@ -256,19 +256,6 @@ public:
|
||||
// space, so each is explained separately.
|
||||
//
|
||||
|
||||
// The area of a frame's contents that has been painted, relative to
|
||||
// mCompositionBounds.
|
||||
//
|
||||
// Note that this is structured in such a way that it doesn't depend on the
|
||||
// method layout uses to scroll content.
|
||||
//
|
||||
// May be larger or smaller than |mScrollableRect|.
|
||||
//
|
||||
// To pre-render a margin of 100 CSS pixels around the window,
|
||||
// { x = -100, y = - 100,
|
||||
// width = window.innerWidth + 200, height = window.innerHeight + 200 }
|
||||
CSSRect mDisplayPort;
|
||||
|
||||
// If non-empty, the area of a frame's contents that is considered critical
|
||||
// to paint. Area outside of this area (i.e. area inside mDisplayPort, but
|
||||
// outside of mCriticalDisplayPort) is considered low-priority, and may be
|
||||
@ -304,6 +291,16 @@ public:
|
||||
float mPresShellResolution;
|
||||
|
||||
public:
|
||||
void SetDisplayPort(const CSSRect& aDisplayPort)
|
||||
{
|
||||
mDisplayPort = aDisplayPort;
|
||||
}
|
||||
|
||||
CSSRect GetDisplayPort() const
|
||||
{
|
||||
return mDisplayPort;
|
||||
}
|
||||
|
||||
void SetCumulativeResolution(const LayoutDeviceToLayerScale& aCumulativeResolution)
|
||||
{
|
||||
mCumulativeResolution = aCumulativeResolution;
|
||||
@ -532,6 +529,19 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
// The area of a frame's contents that has been painted, relative to
|
||||
// mCompositionBounds.
|
||||
//
|
||||
// Note that this is structured in such a way that it doesn't depend on the
|
||||
// method layout uses to scroll content.
|
||||
//
|
||||
// May be larger or smaller than |mScrollableRect|.
|
||||
//
|
||||
// To pre-render a margin of 100 CSS pixels around the window,
|
||||
// { x = -100, y = - 100,
|
||||
// width = window.innerWidth + 200, height = window.innerHeight + 200 }
|
||||
CSSRect mDisplayPort;
|
||||
|
||||
// The cumulative resolution that the current frame has been painted at.
|
||||
// This is the product of the pres-shell resolutions of the document
|
||||
// containing this scroll frame and its ancestors, and any css-driven
|
||||
|
@ -175,7 +175,7 @@ AppendToString(std::stringstream& aStream, const FrameMetrics& m,
|
||||
if (m.GetDoSmoothScroll()) {
|
||||
AppendToString(aStream, m.GetSmoothScrollOffset(), "] [ss=");
|
||||
}
|
||||
AppendToString(aStream, m.mDisplayPort, "] [dp=");
|
||||
AppendToString(aStream, m.GetDisplayPort(), "] [dp=");
|
||||
AppendToString(aStream, m.mCriticalDisplayPort, "] [cdp=");
|
||||
AppendToString(aStream, m.GetBackgroundColor(), "] [color=");
|
||||
if (!detailed) {
|
||||
|
@ -2620,12 +2620,12 @@ ViewTransform AsyncPanZoomController::GetCurrentAsyncTransform() const {
|
||||
// If checkerboarding has been disallowed, clamp the scroll position to stay
|
||||
// within rendered content.
|
||||
if (!gfxPrefs::APZAllowCheckerboarding() &&
|
||||
!mLastContentPaintMetrics.mDisplayPort.IsEmpty()) {
|
||||
!mLastContentPaintMetrics.GetDisplayPort().IsEmpty()) {
|
||||
CSSSize compositedSize = mLastContentPaintMetrics.CalculateCompositedSizeInCssPixels();
|
||||
CSSPoint maxScrollOffset = lastPaintScrollOffset +
|
||||
CSSPoint(mLastContentPaintMetrics.mDisplayPort.XMost() - compositedSize.width,
|
||||
mLastContentPaintMetrics.mDisplayPort.YMost() - compositedSize.height);
|
||||
CSSPoint minScrollOffset = lastPaintScrollOffset + mLastContentPaintMetrics.mDisplayPort.TopLeft();
|
||||
CSSPoint(mLastContentPaintMetrics.GetDisplayPort().XMost() - compositedSize.width,
|
||||
mLastContentPaintMetrics.GetDisplayPort().YMost() - compositedSize.height);
|
||||
CSSPoint minScrollOffset = lastPaintScrollOffset + mLastContentPaintMetrics.GetDisplayPort().TopLeft();
|
||||
|
||||
if (minScrollOffset.x < maxScrollOffset.x) {
|
||||
currentScrollOffset.x = clamped(currentScrollOffset.x, minScrollOffset.x, maxScrollOffset.x);
|
||||
@ -2681,7 +2681,7 @@ bool AsyncPanZoomController::IsCurrentlyCheckerboarding() const {
|
||||
}
|
||||
|
||||
CSSPoint currentScrollOffset = mFrameMetrics.GetScrollOffset() + mTestAsyncScrollOffset;
|
||||
CSSRect painted = mLastContentPaintMetrics.mDisplayPort + mLastContentPaintMetrics.GetScrollOffset();
|
||||
CSSRect painted = mLastContentPaintMetrics.GetDisplayPort() + mLastContentPaintMetrics.GetScrollOffset();
|
||||
painted.Inflate(CSSMargin::FromAppUnits(nsMargin(1, 1, 1, 1))); // fuzz for rounding error
|
||||
CSSRect visible = CSSRect(currentScrollOffset, mFrameMetrics.CalculateCompositedSizeInCssPixels());
|
||||
return !painted.Contains(visible);
|
||||
@ -2702,7 +2702,7 @@ void AsyncPanZoomController::NotifyLayersUpdated(const FrameMetrics& aLayerMetri
|
||||
|
||||
LogRendertraceRect(GetGuid(), "page", "brown", aLayerMetrics.mScrollableRect);
|
||||
LogRendertraceRect(GetGuid(), "painted displayport", "lightgreen",
|
||||
aLayerMetrics.mDisplayPort + aLayerMetrics.GetScrollOffset());
|
||||
aLayerMetrics.GetDisplayPort() + aLayerMetrics.GetScrollOffset());
|
||||
if (!aLayerMetrics.mCriticalDisplayPort.IsEmpty()) {
|
||||
LogRendertraceRect(GetGuid(), "painted critical displayport", "darkgreen",
|
||||
aLayerMetrics.mCriticalDisplayPort + aLayerMetrics.GetScrollOffset());
|
||||
|
@ -753,7 +753,7 @@ ClientLayerManager::ProgressiveUpdateCallback(bool aHasPendingNewThebesContent,
|
||||
CSSToLayerScale paintScale = aMetrics.LayersPixelsPerCSSPixel();
|
||||
const CSSRect& metricsDisplayPort =
|
||||
(aDrawingCritical && !aMetrics.mCriticalDisplayPort.IsEmpty()) ?
|
||||
aMetrics.mCriticalDisplayPort : aMetrics.mDisplayPort;
|
||||
aMetrics.mCriticalDisplayPort : aMetrics.GetDisplayPort();
|
||||
LayerRect displayPort = (metricsDisplayPort + aMetrics.GetScrollOffset()) * paintScale;
|
||||
|
||||
ParentLayerPoint scrollOffset;
|
||||
|
@ -91,7 +91,7 @@ ClientTiledPaintedLayer::GetAncestorLayers(LayerMetricsWrapper* aOutScrollAncest
|
||||
if (!scrollAncestor && metrics.GetScrollId() != FrameMetrics::NULL_SCROLL_ID) {
|
||||
scrollAncestor = ancestor;
|
||||
}
|
||||
if (!metrics.mDisplayPort.IsEmpty()) {
|
||||
if (!metrics.GetDisplayPort().IsEmpty()) {
|
||||
displayPortAncestor = ancestor;
|
||||
// Any layer that has a displayport must be scrollable, so we can break
|
||||
// here.
|
||||
@ -191,7 +191,7 @@ ClientTiledPaintedLayer::UseFastPath()
|
||||
|| gfxPrefs::UseLowPrecisionBuffer()
|
||||
|| !parentMetrics.mCriticalDisplayPort.IsEmpty();
|
||||
bool isFixed = GetIsFixedPosition() || GetParent()->GetIsFixedPosition();
|
||||
return !multipleTransactionsNeeded || isFixed || parentMetrics.mDisplayPort.IsEmpty();
|
||||
return !multipleTransactionsNeeded || isFixed || parentMetrics.GetDisplayPort().IsEmpty();
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -213,10 +213,10 @@ SharedFrameMetricsHelper::UpdateFromCompositorFrameMetrics(
|
||||
// an endless updating cycle.
|
||||
if (fabsf(contentMetrics.GetScrollOffset().x - compositorMetrics.GetScrollOffset().x) <= 2 &&
|
||||
fabsf(contentMetrics.GetScrollOffset().y - compositorMetrics.GetScrollOffset().y) <= 2 &&
|
||||
fabsf(contentMetrics.mDisplayPort.x - compositorMetrics.mDisplayPort.x) <= 2 &&
|
||||
fabsf(contentMetrics.mDisplayPort.y - compositorMetrics.mDisplayPort.y) <= 2 &&
|
||||
fabsf(contentMetrics.mDisplayPort.width - compositorMetrics.mDisplayPort.width) <= 2 &&
|
||||
fabsf(contentMetrics.mDisplayPort.height - compositorMetrics.mDisplayPort.height) <= 2) {
|
||||
fabsf(contentMetrics.GetDisplayPort().x - compositorMetrics.GetDisplayPort().x) <= 2 &&
|
||||
fabsf(contentMetrics.GetDisplayPort().y - compositorMetrics.GetDisplayPort().y) <= 2 &&
|
||||
fabsf(contentMetrics.GetDisplayPort().width - compositorMetrics.GetDisplayPort().width) <= 2 &&
|
||||
fabsf(contentMetrics.GetDisplayPort().height - compositorMetrics.GetDisplayPort().height) <= 2) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -258,7 +258,7 @@ SharedFrameMetricsHelper::AboutToCheckerboard(const FrameMetrics& aContentMetric
|
||||
// This process can introduce some rounding error, so we inflate the rect by one app unit
|
||||
// to account for that.
|
||||
CSSRect painted = (aContentMetrics.mCriticalDisplayPort.IsEmpty()
|
||||
? aContentMetrics.mDisplayPort
|
||||
? aContentMetrics.GetDisplayPort()
|
||||
: aContentMetrics.mCriticalDisplayPort)
|
||||
+ aContentMetrics.GetScrollOffset();
|
||||
painted.Inflate(CSSMargin::FromAppUnits(nsMargin(1, 1, 1, 1)));
|
||||
|
@ -605,7 +605,7 @@ AsyncCompositionManager::ApplyAsyncContentTransformToTree(Layer *aLayer)
|
||||
const FrameMetrics& metrics = aLayer->GetFrameMetrics(i);
|
||||
CSSToLayerScale paintScale = metrics.LayersPixelsPerCSSPixel();
|
||||
CSSRect displayPort(metrics.mCriticalDisplayPort.IsEmpty() ?
|
||||
metrics.mDisplayPort : metrics.mCriticalDisplayPort);
|
||||
metrics.GetDisplayPort() : metrics.mCriticalDisplayPort);
|
||||
ScreenPoint offset(0, 0);
|
||||
// XXX this call to SyncFrameMetrics is not currently being used. It will be cleaned
|
||||
// up as part of bug 776030 or one of its dependencies.
|
||||
@ -860,7 +860,7 @@ AsyncCompositionManager::TransformScrollableLayer(Layer* aLayer)
|
||||
// Calculate the absolute display port to send to Java
|
||||
LayerIntRect displayPort = RoundedToInt(
|
||||
(metrics.mCriticalDisplayPort.IsEmpty()
|
||||
? metrics.mDisplayPort
|
||||
? metrics.GetDisplayPort()
|
||||
: metrics.mCriticalDisplayPort
|
||||
) * geckoZoom);
|
||||
displayPort += scrollOffsetLayerPixels;
|
||||
|
@ -935,13 +935,13 @@ LayerManagerComposite::ComputeRenderIntegrity()
|
||||
}
|
||||
|
||||
// Work out how much of the display-port covers the screen
|
||||
if (!metrics.mDisplayPort.IsEmpty()) {
|
||||
if (!metrics.GetDisplayPort().IsEmpty()) {
|
||||
if (hasLowPrecision) {
|
||||
lowPrecisionMultiplier =
|
||||
GetDisplayportCoverage(metrics.mDisplayPort, transform, screenRect);
|
||||
GetDisplayportCoverage(metrics.GetDisplayPort(), transform, screenRect);
|
||||
} else {
|
||||
lowPrecisionMultiplier = highPrecisionMultiplier =
|
||||
GetDisplayportCoverage(metrics.mDisplayPort, transform, screenRect);
|
||||
GetDisplayportCoverage(metrics.GetDisplayPort(), transform, screenRect);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -223,7 +223,7 @@ TestFrameMetrics()
|
||||
{
|
||||
FrameMetrics fm;
|
||||
|
||||
fm.mDisplayPort = CSSRect(0, 0, 10, 10);
|
||||
fm.SetDisplayPort(CSSRect(0, 0, 10, 10));
|
||||
fm.mCompositionBounds = ParentLayerRect(0, 0, 10, 10);
|
||||
fm.mCriticalDisplayPort = CSSRect(0, 0, 10, 10);
|
||||
fm.mScrollableRect = CSSRect(0, 0, 100, 100);
|
||||
@ -816,7 +816,7 @@ TEST_F(APZCBasicTester, ComplexTransform) {
|
||||
|
||||
FrameMetrics metrics;
|
||||
metrics.mCompositionBounds = ParentLayerRect(0, 0, 24, 24);
|
||||
metrics.mDisplayPort = CSSRect(-1, -1, 6, 6);
|
||||
metrics.SetDisplayPort(CSSRect(-1, -1, 6, 6));
|
||||
metrics.SetScrollOffset(CSSPoint(10, 10));
|
||||
metrics.mScrollableRect = CSSRect(0, 0, 50, 50);
|
||||
metrics.SetCumulativeResolution(LayoutDeviceToLayerScale(2));
|
||||
|
@ -716,9 +716,9 @@ nsDisplayScrollLayer::ComputeFrameMetrics(nsIFrame* aForFrame,
|
||||
}
|
||||
nsRect dp;
|
||||
if (nsLayoutUtils::GetDisplayPort(content, &dp)) {
|
||||
metrics.mDisplayPort = CSSRect::FromAppUnits(dp);
|
||||
metrics.SetDisplayPort(CSSRect::FromAppUnits(dp));
|
||||
nsLayoutUtils::LogTestDataForPaint(aLayer->Manager(), scrollId, "displayport",
|
||||
metrics.mDisplayPort);
|
||||
metrics.GetDisplayPort());
|
||||
}
|
||||
if (nsLayoutUtils::GetCriticalDisplayPort(content, &dp)) {
|
||||
metrics.mCriticalDisplayPort = CSSRect::FromAppUnits(dp);
|
||||
|
Loading…
Reference in New Issue
Block a user