Bug 1116008 - Make FrameMetrics::mCriticalDisplayPort private. r=kats

This commit is contained in:
Kushan Joshi 2014-12-30 14:07:57 -05:00
parent 804e0488af
commit ad4eb3f1df
10 changed files with 36 additions and 31 deletions

View File

@ -40,9 +40,9 @@ public:
FrameMetrics()
: mCompositionBounds(0, 0, 0, 0)
, mCriticalDisplayPort(0, 0, 0, 0)
, mPresShellResolution(1)
, mDisplayPort(0, 0, 0, 0)
, mCriticalDisplayPort(0, 0, 0, 0)
, mScrollableRect(0, 0, 0, 0)
, mCumulativeResolution(1)
, mDevPixelsPerCSSPixel(1)
@ -251,19 +251,6 @@ public:
// layout/paint time.
ParentLayerRect mCompositionBounds;
// ---------------------------------------------------------------------------
// The following metrics are all in CSS pixels. They are not in any uniform
// space, so each is explained separately.
//
// 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
// painted with lower precision, or not painted at all.
//
// The same restrictions for mDisplayPort apply here.
CSSRect mCriticalDisplayPort;
// ---------------------------------------------------------------------------
// The following metrics are dimensionless.
//
@ -288,6 +275,16 @@ public:
return mDisplayPort;
}
void SetCriticalDisplayPort(const CSSRect& aCriticalDisplayPort)
{
mCriticalDisplayPort = aCriticalDisplayPort;
}
CSSRect GetCriticalDisplayPort() const
{
return mCriticalDisplayPort;
}
void SetCumulativeResolution(const LayoutDeviceToLayerScale& aCumulativeResolution)
{
mCumulativeResolution = aCumulativeResolution;
@ -539,6 +536,14 @@ private:
// 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
// painted with lower precision, or not painted at all.
//
// The same restrictions for mDisplayPort apply here.
CSSRect mCriticalDisplayPort;
// The scrollable bounds of a frame. This is determined by reflow.
// Ordinarily the x and y will be 0 and the width and height will be the
// size of the element being scrolled. However for RTL pages or elements

View File

@ -176,7 +176,7 @@ AppendToString(std::stringstream& aStream, const FrameMetrics& m,
AppendToString(aStream, m.GetSmoothScrollOffset(), "] [ss=");
}
AppendToString(aStream, m.GetDisplayPort(), "] [dp=");
AppendToString(aStream, m.mCriticalDisplayPort, "] [cdp=");
AppendToString(aStream, m.GetCriticalDisplayPort(), "] [cdp=");
AppendToString(aStream, m.GetBackgroundColor(), "] [color=");
if (!detailed) {
AppendToString(aStream, m.GetScrollId(), "] [scrollId=");

View File

@ -2707,9 +2707,9 @@ void AsyncPanZoomController::NotifyLayersUpdated(const FrameMetrics& aLayerMetri
LogRendertraceRect(GetGuid(), "page", "brown", aLayerMetrics.GetScrollableRect());
LogRendertraceRect(GetGuid(), "painted displayport", "lightgreen",
aLayerMetrics.GetDisplayPort() + aLayerMetrics.GetScrollOffset());
if (!aLayerMetrics.mCriticalDisplayPort.IsEmpty()) {
if (!aLayerMetrics.GetCriticalDisplayPort().IsEmpty()) {
LogRendertraceRect(GetGuid(), "painted critical displayport", "darkgreen",
aLayerMetrics.mCriticalDisplayPort + aLayerMetrics.GetScrollOffset());
aLayerMetrics.GetCriticalDisplayPort() + aLayerMetrics.GetScrollOffset());
}
mPaintThrottler.TaskComplete(GetFrameTime());

View File

@ -752,8 +752,8 @@ ClientLayerManager::ProgressiveUpdateCallback(bool aHasPendingNewThebesContent,
// gfx/layers/ipc/CompositorParent.cpp::TransformShadowTree.
CSSToLayerScale paintScale = aMetrics.LayersPixelsPerCSSPixel();
const CSSRect& metricsDisplayPort =
(aDrawingCritical && !aMetrics.mCriticalDisplayPort.IsEmpty()) ?
aMetrics.mCriticalDisplayPort : aMetrics.GetDisplayPort();
(aDrawingCritical && !aMetrics.GetCriticalDisplayPort().IsEmpty()) ?
aMetrics.GetCriticalDisplayPort() : aMetrics.GetDisplayPort();
LayerRect displayPort = (metricsDisplayPort + aMetrics.GetScrollOffset()) * paintScale;
ParentLayerPoint scrollOffset;

View File

@ -152,7 +152,7 @@ ClientTiledPaintedLayer::BeginPaint()
// Compute the critical display port that applies to this layer in the
// LayoutDevice space of this layer.
ParentLayerRect criticalDisplayPort =
(displayportMetrics.mCriticalDisplayPort * displayportMetrics.GetZoom())
(displayportMetrics.GetCriticalDisplayPort() * displayportMetrics.GetZoom())
+ displayportMetrics.mCompositionBounds.TopLeft();
mPaintData.mCriticalDisplayPort = RoundedOut(
ApplyParentLayerToLayerTransform(transformDisplayPortToLayer, criticalDisplayPort));
@ -189,7 +189,7 @@ ClientTiledPaintedLayer::UseFastPath()
bool multipleTransactionsNeeded = gfxPlatform::GetPlatform()->UseProgressivePaint()
|| gfxPrefs::UseLowPrecisionBuffer()
|| !parentMetrics.mCriticalDisplayPort.IsEmpty();
|| !parentMetrics.GetCriticalDisplayPort().IsEmpty();
bool isFixed = GetIsFixedPosition() || GetParent()->GetIsFixedPosition();
return !multipleTransactionsNeeded || isFixed || parentMetrics.GetDisplayPort().IsEmpty();
}

View File

@ -257,9 +257,9 @@ SharedFrameMetricsHelper::AboutToCheckerboard(const FrameMetrics& aContentMetric
// converted to app units and then back to CSS pixels before being put in the FrameMetrics.
// 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()
CSSRect painted = (aContentMetrics.GetCriticalDisplayPort().IsEmpty()
? aContentMetrics.GetDisplayPort()
: aContentMetrics.mCriticalDisplayPort)
: aContentMetrics.GetCriticalDisplayPort())
+ aContentMetrics.GetScrollOffset();
painted.Inflate(CSSMargin::FromAppUnits(nsMargin(1, 1, 1, 1)));

View File

@ -604,8 +604,8 @@ AsyncCompositionManager::ApplyAsyncContentTransformToTree(Layer *aLayer)
const FrameMetrics& metrics = aLayer->GetFrameMetrics(i);
CSSToLayerScale paintScale = metrics.LayersPixelsPerCSSPixel();
CSSRect displayPort(metrics.mCriticalDisplayPort.IsEmpty() ?
metrics.GetDisplayPort() : metrics.mCriticalDisplayPort);
CSSRect displayPort(metrics.GetCriticalDisplayPort().IsEmpty() ?
metrics.GetDisplayPort() : metrics.GetCriticalDisplayPort());
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.
@ -859,9 +859,9 @@ AsyncCompositionManager::TransformScrollableLayer(Layer* aLayer)
// notifications, so that Java can take these into account in its response.
// Calculate the absolute display port to send to Java
LayerIntRect displayPort = RoundedToInt(
(metrics.mCriticalDisplayPort.IsEmpty()
(metrics.GetCriticalDisplayPort().IsEmpty()
? metrics.GetDisplayPort()
: metrics.mCriticalDisplayPort
: metrics.GetCriticalDisplayPort()
) * geckoZoom);
displayPort += scrollOffsetLayerPixels;

View File

@ -928,10 +928,10 @@ LayerManagerComposite::ComputeRenderIntegrity()
// Work out how much of the critical display-port covers the screen
bool hasLowPrecision = false;
if (!metrics.mCriticalDisplayPort.IsEmpty()) {
if (!metrics.GetCriticalDisplayPort().IsEmpty()) {
hasLowPrecision = true;
highPrecisionMultiplier =
GetDisplayportCoverage(metrics.mCriticalDisplayPort, transform, screenRect);
GetDisplayportCoverage(metrics.GetCriticalDisplayPort(), transform, screenRect);
}
// Work out how much of the display-port covers the screen

View File

@ -225,7 +225,7 @@ TestFrameMetrics()
fm.SetDisplayPort(CSSRect(0, 0, 10, 10));
fm.mCompositionBounds = ParentLayerRect(0, 0, 10, 10);
fm.mCriticalDisplayPort = CSSRect(0, 0, 10, 10);
fm.SetCriticalDisplayPort(CSSRect(0, 0, 10, 10));
fm.SetScrollableRect(CSSRect(0, 0, 100, 100));
return fm;

View File

@ -721,7 +721,7 @@ nsDisplayScrollLayer::ComputeFrameMetrics(nsIFrame* aForFrame,
metrics.GetDisplayPort());
}
if (nsLayoutUtils::GetCriticalDisplayPort(content, &dp)) {
metrics.mCriticalDisplayPort = CSSRect::FromAppUnits(dp);
metrics.SetCriticalDisplayPort(CSSRect::FromAppUnits(dp));
}
DisplayPortMarginsPropertyData* marginsData =
static_cast<DisplayPortMarginsPropertyData*>(content->GetProperty(nsGkAtoms::DisplayPortMargins));