зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1230686 - use RefPtr<DrawTarget>& instead of DrawTarget* to track changes in SurfaceFromElement. r=jmuizelaar
This commit is contained in:
Родитель
dbf3dec4da
Коммит
9a71f879e0
|
@ -1311,7 +1311,7 @@ public:
|
||||||
if (!mPixelStore_PremultiplyAlpha)
|
if (!mPixelStore_PremultiplyAlpha)
|
||||||
flags |= nsLayoutUtils::SFE_PREFER_NO_PREMULTIPLY_ALPHA;
|
flags |= nsLayoutUtils::SFE_PREFER_NO_PREMULTIPLY_ALPHA;
|
||||||
|
|
||||||
gfx::DrawTarget* idealDrawTarget = nullptr; // Don't care for now.
|
RefPtr<gfx::DrawTarget> idealDrawTarget = nullptr; // Don't care for now.
|
||||||
return nsLayoutUtils::SurfaceFromElement(elem, flags, idealDrawTarget);
|
return nsLayoutUtils::SurfaceFromElement(elem, flags, idealDrawTarget);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6889,7 +6889,7 @@ nsLayoutUtils::IsReallyFixedPos(nsIFrame* aFrame)
|
||||||
nsLayoutUtils::SurfaceFromElementResult
|
nsLayoutUtils::SurfaceFromElementResult
|
||||||
nsLayoutUtils::SurfaceFromOffscreenCanvas(OffscreenCanvas* aOffscreenCanvas,
|
nsLayoutUtils::SurfaceFromOffscreenCanvas(OffscreenCanvas* aOffscreenCanvas,
|
||||||
uint32_t aSurfaceFlags,
|
uint32_t aSurfaceFlags,
|
||||||
DrawTarget* aTarget)
|
RefPtr<DrawTarget>& aTarget)
|
||||||
{
|
{
|
||||||
SurfaceFromElementResult result;
|
SurfaceFromElementResult result;
|
||||||
|
|
||||||
|
@ -6904,7 +6904,7 @@ nsLayoutUtils::SurfaceFromOffscreenCanvas(OffscreenCanvas* aOffscreenCanvas,
|
||||||
if (!result.mSourceSurface) {
|
if (!result.mSourceSurface) {
|
||||||
// If the element doesn't have a context then we won't get a snapshot. The canvas spec wants us to not error and just
|
// If the element doesn't have a context then we won't get a snapshot. The canvas spec wants us to not error and just
|
||||||
// draw nothing, so return an empty surface.
|
// draw nothing, so return an empty surface.
|
||||||
DrawTarget *ref = aTarget ? aTarget : gfxPlatform::GetPlatform()->ScreenReferenceDrawTarget();
|
DrawTarget *ref = aTarget ? aTarget.get() : gfxPlatform::GetPlatform()->ScreenReferenceDrawTarget();
|
||||||
RefPtr<DrawTarget> dt = ref->CreateSimilarDrawTarget(IntSize(size.width, size.height),
|
RefPtr<DrawTarget> dt = ref->CreateSimilarDrawTarget(IntSize(size.width, size.height),
|
||||||
SurfaceFormat::B8G8R8A8);
|
SurfaceFormat::B8G8R8A8);
|
||||||
if (dt) {
|
if (dt) {
|
||||||
|
@ -6927,7 +6927,7 @@ nsLayoutUtils::SurfaceFromOffscreenCanvas(OffscreenCanvas* aOffscreenCanvas,
|
||||||
nsLayoutUtils::SurfaceFromElementResult
|
nsLayoutUtils::SurfaceFromElementResult
|
||||||
nsLayoutUtils::SurfaceFromElement(nsIImageLoadingContent* aElement,
|
nsLayoutUtils::SurfaceFromElement(nsIImageLoadingContent* aElement,
|
||||||
uint32_t aSurfaceFlags,
|
uint32_t aSurfaceFlags,
|
||||||
DrawTarget* aTarget)
|
RefPtr<DrawTarget>& aTarget)
|
||||||
{
|
{
|
||||||
SurfaceFromElementResult result;
|
SurfaceFromElementResult result;
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
|
@ -7020,7 +7020,7 @@ nsLayoutUtils::SurfaceFromElement(nsIImageLoadingContent* aElement,
|
||||||
nsLayoutUtils::SurfaceFromElementResult
|
nsLayoutUtils::SurfaceFromElementResult
|
||||||
nsLayoutUtils::SurfaceFromElement(HTMLImageElement *aElement,
|
nsLayoutUtils::SurfaceFromElement(HTMLImageElement *aElement,
|
||||||
uint32_t aSurfaceFlags,
|
uint32_t aSurfaceFlags,
|
||||||
DrawTarget* aTarget)
|
RefPtr<DrawTarget>& aTarget)
|
||||||
{
|
{
|
||||||
return SurfaceFromElement(static_cast<nsIImageLoadingContent*>(aElement),
|
return SurfaceFromElement(static_cast<nsIImageLoadingContent*>(aElement),
|
||||||
aSurfaceFlags, aTarget);
|
aSurfaceFlags, aTarget);
|
||||||
|
@ -7029,7 +7029,7 @@ nsLayoutUtils::SurfaceFromElement(HTMLImageElement *aElement,
|
||||||
nsLayoutUtils::SurfaceFromElementResult
|
nsLayoutUtils::SurfaceFromElementResult
|
||||||
nsLayoutUtils::SurfaceFromElement(HTMLCanvasElement* aElement,
|
nsLayoutUtils::SurfaceFromElement(HTMLCanvasElement* aElement,
|
||||||
uint32_t aSurfaceFlags,
|
uint32_t aSurfaceFlags,
|
||||||
DrawTarget* aTarget)
|
RefPtr<DrawTarget>& aTarget)
|
||||||
{
|
{
|
||||||
SurfaceFromElementResult result;
|
SurfaceFromElementResult result;
|
||||||
|
|
||||||
|
@ -7044,7 +7044,7 @@ nsLayoutUtils::SurfaceFromElement(HTMLCanvasElement* aElement,
|
||||||
if (!result.mSourceSurface) {
|
if (!result.mSourceSurface) {
|
||||||
// If the element doesn't have a context then we won't get a snapshot. The canvas spec wants us to not error and just
|
// If the element doesn't have a context then we won't get a snapshot. The canvas spec wants us to not error and just
|
||||||
// draw nothing, so return an empty surface.
|
// draw nothing, so return an empty surface.
|
||||||
DrawTarget *ref = aTarget ? aTarget : gfxPlatform::GetPlatform()->ScreenReferenceDrawTarget();
|
DrawTarget *ref = aTarget ? aTarget.get() : gfxPlatform::GetPlatform()->ScreenReferenceDrawTarget();
|
||||||
RefPtr<DrawTarget> dt = ref->CreateSimilarDrawTarget(IntSize(size.width, size.height),
|
RefPtr<DrawTarget> dt = ref->CreateSimilarDrawTarget(IntSize(size.width, size.height),
|
||||||
SurfaceFormat::B8G8R8A8);
|
SurfaceFormat::B8G8R8A8);
|
||||||
if (dt) {
|
if (dt) {
|
||||||
|
@ -7072,7 +7072,7 @@ nsLayoutUtils::SurfaceFromElement(HTMLCanvasElement* aElement,
|
||||||
nsLayoutUtils::SurfaceFromElementResult
|
nsLayoutUtils::SurfaceFromElementResult
|
||||||
nsLayoutUtils::SurfaceFromElement(HTMLVideoElement* aElement,
|
nsLayoutUtils::SurfaceFromElement(HTMLVideoElement* aElement,
|
||||||
uint32_t aSurfaceFlags,
|
uint32_t aSurfaceFlags,
|
||||||
DrawTarget* aTarget)
|
RefPtr<DrawTarget>& aTarget)
|
||||||
{
|
{
|
||||||
SurfaceFromElementResult result;
|
SurfaceFromElementResult result;
|
||||||
|
|
||||||
|
@ -7132,7 +7132,7 @@ nsLayoutUtils::SurfaceFromElement(HTMLVideoElement* aElement,
|
||||||
nsLayoutUtils::SurfaceFromElementResult
|
nsLayoutUtils::SurfaceFromElementResult
|
||||||
nsLayoutUtils::SurfaceFromElement(dom::Element* aElement,
|
nsLayoutUtils::SurfaceFromElement(dom::Element* aElement,
|
||||||
uint32_t aSurfaceFlags,
|
uint32_t aSurfaceFlags,
|
||||||
DrawTarget* aTarget)
|
RefPtr<DrawTarget>& aTarget)
|
||||||
{
|
{
|
||||||
// If it's a <canvas>, we may be able to just grab its internal surface
|
// If it's a <canvas>, we may be able to just grab its internal surface
|
||||||
if (HTMLCanvasElement* canvas =
|
if (HTMLCanvasElement* canvas =
|
||||||
|
|
|
@ -2119,26 +2119,39 @@ public:
|
||||||
// This function can be called on any thread.
|
// This function can be called on any thread.
|
||||||
static SurfaceFromElementResult
|
static SurfaceFromElementResult
|
||||||
SurfaceFromOffscreenCanvas(mozilla::dom::OffscreenCanvas *aOffscreenCanvas,
|
SurfaceFromOffscreenCanvas(mozilla::dom::OffscreenCanvas *aOffscreenCanvas,
|
||||||
uint32_t aSurfaceFlags = 0,
|
uint32_t aSurfaceFlags,
|
||||||
DrawTarget *aTarget = nullptr);
|
RefPtr<DrawTarget>& aTarget);
|
||||||
|
static SurfaceFromElementResult
|
||||||
|
SurfaceFromOffscreenCanvas(mozilla::dom::OffscreenCanvas *aOffscreenCanvas,
|
||||||
|
uint32_t aSurfaceFlags = 0) {
|
||||||
|
RefPtr<DrawTarget> target = nullptr;
|
||||||
|
return SurfaceFromOffscreenCanvas(aOffscreenCanvas, aSurfaceFlags, target);
|
||||||
|
}
|
||||||
|
|
||||||
static SurfaceFromElementResult SurfaceFromElement(mozilla::dom::Element *aElement,
|
static SurfaceFromElementResult SurfaceFromElement(mozilla::dom::Element *aElement,
|
||||||
uint32_t aSurfaceFlags = 0,
|
uint32_t aSurfaceFlags,
|
||||||
DrawTarget *aTarget = nullptr);
|
RefPtr<DrawTarget>& aTarget);
|
||||||
|
static SurfaceFromElementResult SurfaceFromElement(mozilla::dom::Element *aElement,
|
||||||
|
uint32_t aSurfaceFlags = 0) {
|
||||||
|
RefPtr<DrawTarget> target = nullptr;
|
||||||
|
return SurfaceFromElement(aElement, aSurfaceFlags, target);
|
||||||
|
}
|
||||||
|
|
||||||
static SurfaceFromElementResult SurfaceFromElement(nsIImageLoadingContent *aElement,
|
static SurfaceFromElementResult SurfaceFromElement(nsIImageLoadingContent *aElement,
|
||||||
uint32_t aSurfaceFlags = 0,
|
uint32_t aSurfaceFlags,
|
||||||
DrawTarget *aTarget = nullptr);
|
RefPtr<DrawTarget>& aTarget);
|
||||||
// Need an HTMLImageElement overload, because otherwise the
|
// Need an HTMLImageElement overload, because otherwise the
|
||||||
// nsIImageLoadingContent and mozilla::dom::Element overloads are ambiguous
|
// nsIImageLoadingContent and mozilla::dom::Element overloads are ambiguous
|
||||||
// for HTMLImageElement.
|
// for HTMLImageElement.
|
||||||
static SurfaceFromElementResult SurfaceFromElement(mozilla::dom::HTMLImageElement *aElement,
|
static SurfaceFromElementResult SurfaceFromElement(mozilla::dom::HTMLImageElement *aElement,
|
||||||
uint32_t aSurfaceFlags = 0,
|
uint32_t aSurfaceFlags,
|
||||||
DrawTarget *aTarget = nullptr);
|
RefPtr<DrawTarget>& aTarget);
|
||||||
static SurfaceFromElementResult SurfaceFromElement(mozilla::dom::HTMLCanvasElement *aElement,
|
static SurfaceFromElementResult SurfaceFromElement(mozilla::dom::HTMLCanvasElement *aElement,
|
||||||
uint32_t aSurfaceFlags = 0,
|
uint32_t aSurfaceFlags,
|
||||||
DrawTarget *aTarget = nullptr);
|
RefPtr<DrawTarget>& aTarget);
|
||||||
static SurfaceFromElementResult SurfaceFromElement(mozilla::dom::HTMLVideoElement *aElement,
|
static SurfaceFromElementResult SurfaceFromElement(mozilla::dom::HTMLVideoElement *aElement,
|
||||||
uint32_t aSurfaceFlags = 0,
|
uint32_t aSurfaceFlags,
|
||||||
DrawTarget *aTarget = nullptr);
|
RefPtr<DrawTarget>& aTarget);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* When the document is editable by contenteditable attribute of its root
|
* When the document is editable by contenteditable attribute of its root
|
||||||
|
|
Загрузка…
Ссылка в новой задаче