summaryrefslogtreecommitdiffstats
path: root/layout/base/nsDisplayList.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'layout/base/nsDisplayList.cpp')
-rw-r--r--layout/base/nsDisplayList.cpp121
1 files changed, 11 insertions, 110 deletions
diff --git a/layout/base/nsDisplayList.cpp b/layout/base/nsDisplayList.cpp
index 2bf20144a..d619576ba 100644
--- a/layout/base/nsDisplayList.cpp
+++ b/layout/base/nsDisplayList.cpp
@@ -61,7 +61,6 @@
#include "mozilla/OperatorNewExtensions.h"
#include "mozilla/PendingAnimationTracker.h"
#include "mozilla/Preferences.h"
-#include "mozilla/Telemetry.h"
#include "mozilla/UniquePtr.h"
#include "mozilla/Unused.h"
#include "mozilla/gfx/gfxVars.h"
@@ -1857,7 +1856,6 @@ already_AddRefed<LayerManager> nsDisplayList::PaintRoot(nsDisplayListBuilder* aB
RefPtr<ContainerLayer> root;
{
- PaintTelemetry::AutoRecord record(PaintTelemetry::Metric::Layerization);
root = layerBuilder->
BuildContainerLayerFor(aBuilder, layerManager, frame, nullptr, this,
containerParameters, nullptr);
@@ -3016,7 +3014,7 @@ nsDisplayBackgroundImage::ComputeVisibility(nsDisplayListBuilder* aBuilder,
/* static */ nsRegion
nsDisplayBackgroundImage::GetInsideClipRegion(nsDisplayItem* aItem,
- uint8_t aClip,
+ StyleGeometryBox aClip,
const nsRect& aRect,
const nsRect& aBackgroundRect)
{
@@ -3030,10 +3028,10 @@ nsDisplayBackgroundImage::GetInsideClipRegion(nsDisplayItem* aItem,
if (frame->GetType() == nsGkAtoms::canvasFrame) {
nsCanvasFrame* canvasFrame = static_cast<nsCanvasFrame*>(frame);
clipRect = canvasFrame->CanvasArea() + aItem->ToReferenceFrame();
- } else if (aClip == NS_STYLE_IMAGELAYER_CLIP_PADDING ||
- aClip == NS_STYLE_IMAGELAYER_CLIP_CONTENT) {
+ } else if (aClip == StyleGeometryBox::Padding ||
+ aClip == StyleGeometryBox::Content) {
nsMargin border = frame->GetUsedBorder();
- if (aClip == NS_STYLE_IMAGELAYER_CLIP_CONTENT) {
+ if (aClip == StyleGeometryBox::Content) {
border += frame->GetUsedPadding();
}
border.ApplySkipSides(frame->GetSkipSides());
@@ -3066,7 +3064,7 @@ nsDisplayBackgroundImage::GetOpaqueRegion(nsDisplayListBuilder* aBuilder,
if (layer.mImage.IsOpaque() && layer.mBlendMode == NS_STYLE_BLEND_NORMAL &&
layer.mRepeat.mXRepeat != NS_STYLE_IMAGELAYER_REPEAT_SPACE &&
layer.mRepeat.mYRepeat != NS_STYLE_IMAGELAYER_REPEAT_SPACE &&
- layer.mClip != NS_STYLE_IMAGELAYER_CLIP_TEXT) {
+ layer.mClip != StyleGeometryBox::Text) {
result = GetInsideClipRegion(this, layer.mClip, mBounds, mBackgroundRect);
}
}
@@ -3145,9 +3143,9 @@ nsDisplayBackgroundImage::PaintInternal(nsDisplayListBuilder* aBuilder,
CheckForBorderItem(this, flags);
gfxContext* ctx = aCtx->ThebesContext();
- uint8_t clip = mBackgroundStyle->mImage.mLayers[mLayer].mClip;
+ StyleGeometryBox clip = mBackgroundStyle->mImage.mLayers[mLayer].mClip;
- if (clip == NS_STYLE_IMAGELAYER_CLIP_TEXT) {
+ if (clip == StyleGeometryBox::Text) {
if (!GenerateAndPushTextMask(mFrame, aCtx, mBackgroundRect, aBuilder)) {
return;
}
@@ -3163,7 +3161,7 @@ nsDisplayBackgroundImage::PaintInternal(nsDisplayListBuilder* aBuilder,
image::DrawResult result =
nsCSSRendering::PaintBackground(params);
- if (clip == NS_STYLE_IMAGELAYER_CLIP_TEXT) {
+ if (clip == StyleGeometryBox::Text) {
ctx->PopGroupAndBlend();
}
@@ -3585,8 +3583,8 @@ nsDisplayBackgroundColor::Paint(nsDisplayListBuilder* aBuilder,
nsLayoutUtils::RectToGfxRect(mBackgroundRect,
mFrame->PresContext()->AppUnitsPerDevPixel());
- uint8_t clip = mBackgroundStyle->mImage.mLayers[0].mClip;
- if (clip == NS_STYLE_IMAGELAYER_CLIP_TEXT) {
+ StyleGeometryBox clip = mBackgroundStyle->mImage.mLayers[0].mClip;
+ if (clip == StyleGeometryBox::Text) {
if (!GenerateAndPushTextMask(mFrame, aCtx, mBackgroundRect, aBuilder)) {
return;
}
@@ -3620,7 +3618,7 @@ nsDisplayBackgroundColor::GetOpaqueRegion(nsDisplayListBuilder* aBuilder,
const nsStyleImageLayers::Layer& bottomLayer = mBackgroundStyle->BottomLayer();
- if (bottomLayer.mClip == NS_STYLE_IMAGELAYER_CLIP_TEXT) {
+ if (bottomLayer.mClip == StyleGeometryBox::Text) {
return nsRegion();
}
@@ -7453,100 +7451,3 @@ nsDisplayFilter::PrintEffects(nsACString& aTo)
aTo += ")";
}
#endif
-
-namespace mozilla {
-
-uint32_t PaintTelemetry::sPaintLevel = 0;
-uint32_t PaintTelemetry::sMetricLevel = 0;
-EnumeratedArray<PaintTelemetry::Metric,
- PaintTelemetry::Metric::COUNT,
- double> PaintTelemetry::sMetrics;
-
-PaintTelemetry::AutoRecordPaint::AutoRecordPaint()
-{
- // Don't record nested paints.
- if (sPaintLevel++ > 0) {
- return;
- }
-
- // Reset metrics for a new paint.
- for (auto& metric : sMetrics) {
- metric = 0.0;
- }
- mStart = TimeStamp::Now();
-}
-
-PaintTelemetry::AutoRecordPaint::~AutoRecordPaint()
-{
- MOZ_ASSERT(sPaintLevel != 0);
- if (--sPaintLevel > 0) {
- return;
- }
-
- // If we're in multi-process mode, don't include paint times for the parent
- // process.
- if (gfxVars::BrowserTabsRemoteAutostart() && XRE_IsParentProcess()) {
- return;
- }
-
- double totalMs = (TimeStamp::Now() - mStart).ToMilliseconds();
-
- // If the total time was >= 16ms, then it's likely we missed a frame due to
- // painting. In this case we'll gather some detailed metrics below.
- if (totalMs <= 16.0) {
- return;
- }
-
- auto record = [=](const char* aKey, double aDurationMs) -> void {
- MOZ_ASSERT(aDurationMs <= totalMs);
-
- uint32_t amount = static_cast<int32_t>((aDurationMs / totalMs) * 100.0);
- };
-
- double dlMs = sMetrics[Metric::DisplayList];
- double flbMs = sMetrics[Metric::Layerization];
- double rMs = sMetrics[Metric::Rasterization];
-
- // Record all permutations since aggregation makes it difficult to
- // correlate. For example we can't derive "flb+r" from "dl" because we
- // don't know the total time associated with a bucket entry. So we just
- // play it safe and include everything. We can however derive "other" time
- // from the final permutation.
- record("dl", dlMs);
- record("flb", flbMs);
- record("r", rMs);
- record("dl,flb", dlMs + flbMs);
- record("dl,r", dlMs + rMs);
- record("flb,r", flbMs + rMs);
- record("dl,flb,r", dlMs + flbMs + rMs);
-}
-
-PaintTelemetry::AutoRecord::AutoRecord(Metric aMetric)
- : mMetric(aMetric)
-{
- // Don't double-record anything nested.
- if (sMetricLevel++ > 0) {
- return;
- }
-
- // Don't record inside nested paints, or outside of paints.
- if (sPaintLevel != 1) {
- return;
- }
-
- mStart = TimeStamp::Now();
-}
-
-PaintTelemetry::AutoRecord::~AutoRecord()
-{
- MOZ_ASSERT(sMetricLevel != 0);
-
- sMetricLevel--;
- if (mStart.IsNull()) {
- return;
- }
-
- sMetrics[mMetric] += (TimeStamp::Now() - mStart).ToMilliseconds();
-}
-
-} // namespace mozilla