mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 03:15:11 +00:00
Bug 1366097 - Part 8. Improve image memory reports to include SVG context information. r=tnikkel
This commit is contained in:
parent
2278b250dc
commit
19e321eb9e
@ -40,6 +40,7 @@
|
||||
#include "nsIFile.h"
|
||||
#include "nsCRT.h"
|
||||
#include "nsINetworkPredictor.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "mozilla/dom/ContentParent.h"
|
||||
#include "mozilla/dom/nsMixedContentBlocker.h"
|
||||
|
||||
@ -312,6 +313,48 @@ private:
|
||||
surfacePathPrefix.AppendInt(uint32_t(counter.Key().Flags()),
|
||||
/* aRadix = */ 16);
|
||||
}
|
||||
|
||||
if (counter.Key().SVGContext()) {
|
||||
const SVGImageContext& context = counter.Key().SVGContext().ref();
|
||||
surfacePathPrefix.AppendLiteral(", svgContext:[ ");
|
||||
if (context.GetViewportSize()) {
|
||||
const CSSIntSize& size = context.GetViewportSize().ref();
|
||||
surfacePathPrefix.AppendLiteral("viewport=(");
|
||||
surfacePathPrefix.AppendInt(size.width);
|
||||
surfacePathPrefix.AppendLiteral("x");
|
||||
surfacePathPrefix.AppendInt(size.height);
|
||||
surfacePathPrefix.AppendLiteral(") ");
|
||||
}
|
||||
if (context.GetPreserveAspectRatio()) {
|
||||
nsAutoString aspect;
|
||||
context.GetPreserveAspectRatio()->ToString(aspect);
|
||||
surfacePathPrefix.AppendLiteral("preserveAspectRatio=(");
|
||||
LossyAppendUTF16toASCII(aspect, surfacePathPrefix);
|
||||
surfacePathPrefix.AppendLiteral(") ");
|
||||
}
|
||||
if (context.GetContextPaint()) {
|
||||
const SVGEmbeddingContextPaint* paint = context.GetContextPaint();
|
||||
surfacePathPrefix.AppendLiteral("contextPaint=(");
|
||||
if (paint->GetFill()) {
|
||||
surfacePathPrefix.AppendLiteral(" fill=");
|
||||
surfacePathPrefix.AppendInt(paint->GetFill()->ToABGR(), 16);
|
||||
}
|
||||
if (paint->GetFillOpacity()) {
|
||||
surfacePathPrefix.AppendLiteral(" fillOpa=");
|
||||
surfacePathPrefix.AppendFloat(paint->GetFillOpacity());
|
||||
}
|
||||
if (paint->GetStroke()) {
|
||||
surfacePathPrefix.AppendLiteral(" stroke=");
|
||||
surfacePathPrefix.AppendInt(paint->GetStroke()->ToABGR(), 16);
|
||||
}
|
||||
if (paint->GetStrokeOpacity()) {
|
||||
surfacePathPrefix.AppendLiteral(" strokeOpa=");
|
||||
surfacePathPrefix.AppendFloat(paint->GetStrokeOpacity());
|
||||
}
|
||||
surfacePathPrefix.AppendLiteral(" ) ");
|
||||
}
|
||||
surfacePathPrefix.AppendLiteral("]");
|
||||
}
|
||||
} else if (counter.Type() == SurfaceMemoryCounterType::COMPOSITING) {
|
||||
surfacePathPrefix.AppendLiteral(", compositing frame");
|
||||
} else if (counter.Type() == SurfaceMemoryCounterType::COMPOSITING_PREV) {
|
||||
|
@ -272,9 +272,15 @@ public:
|
||||
void SetFill(nscolor aFill) {
|
||||
mFill.emplace(gfx::ToDeviceColor(aFill));
|
||||
}
|
||||
const Maybe<Color>& GetFill() const {
|
||||
return mFill;
|
||||
}
|
||||
void SetStroke(nscolor aStroke) {
|
||||
mStroke.emplace(gfx::ToDeviceColor(aStroke));
|
||||
}
|
||||
const Maybe<Color>& GetStroke() const {
|
||||
return mStroke;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a pattern of type PatternType::COLOR, or else nullptr.
|
||||
|
Loading…
Reference in New Issue
Block a user