WebKit Bugzilla
Attachment 356142 Details for
Bug 192217
: CSS Painting API should scale display list when drawing
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-192217-20181129223753.patch (text/plain), 3.82 KB, created by
Justin Michaud
on 2018-11-29 22:37:54 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Justin Michaud
Created:
2018-11-29 22:37:54 PST
Size:
3.82 KB
patch
obsolete
>Subversion Revision: 238725 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index b905292e27deb41144513652c4833266122fe0c9..609cdd5c61000e2ed24010578c8f668de984dd8d 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,19 @@ >+2018-11-29 Justin Michaud <justin_michaud@apple.com> >+ >+ CSS Painting API should scale display list when drawing >+ https://bugs.webkit.org/show_bug.cgi?id=192217 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ When we replay the display list, fix the scaling. The separate buffer is needed to make sure that globalCompositeOperation functions correctly. >+ There are no tests for this because I do not know how to make tests that would not be flaky. >+ >+ * html/CustomPaintCanvas.cpp: >+ (WebCore::CustomPaintCanvas::replayDisplayList const): >+ * html/CustomPaintCanvas.h: >+ * platform/graphics/CustomPaintImage.cpp: >+ (WebCore::CustomPaintImage::doCustomPaint): >+ > 2018-11-29 Simon Fraser <simon.fraser@apple.com> > > Overflow scrolling layers need to be self-painting >diff --git a/Source/WebCore/html/CustomPaintCanvas.cpp b/Source/WebCore/html/CustomPaintCanvas.cpp >index f93f909aab3bbcf8cd6118ce34b000e487aab631..6b25352530fcfbb41df149e4df31b942f84a9c2a 100644 >--- a/Source/WebCore/html/CustomPaintCanvas.cpp >+++ b/Source/WebCore/html/CustomPaintCanvas.cpp >@@ -93,6 +93,29 @@ ExceptionOr<RefPtr<PaintRenderingContext2D>> CustomPaintCanvas::getContext() > return { RefPtr<PaintRenderingContext2D> { &downcast<PaintRenderingContext2D>(*m_context) } }; > } > >+void CustomPaintCanvas::replayDisplayList(GraphicsContext* ctx) const >+{ >+ ASSERT(!m_destinationGraphicsContext); >+ if (!width() || !height()) >+ return; >+ >+ float scaleFactor = std::max(ctx->scaleFactor().width(), ctx->scaleFactor().height()); >+ >+ auto image = ImageBuffer::create(ctx->clipBounds().size(), Accelerated, scaleFactor); >+ if (!image) >+ image = ImageBuffer::create(ctx->clipBounds().size(), Unaccelerated, scaleFactor); >+ if (!image) >+ return; >+ >+ m_destinationGraphicsContext = &image->context(); >+ m_destinationGraphicsContext->translate(-ctx->clipBounds().location()); >+ if (m_context) >+ m_context->paintRenderingResultsToCanvas(); >+ m_destinationGraphicsContext = nullptr; >+ >+ ctx->drawImageBuffer(*image, ctx->clipBounds().location()); >+} >+ > Image* CustomPaintCanvas::copiedImage() const > { > ASSERT(!m_destinationGraphicsContext); >diff --git a/Source/WebCore/html/CustomPaintCanvas.h b/Source/WebCore/html/CustomPaintCanvas.h >index 99571fdf73b8268ee65d1def00aad4deecadd138..e1fa62b4db74079abb945d7bf3861ea3a68fbe91 100644 >--- a/Source/WebCore/html/CustomPaintCanvas.h >+++ b/Source/WebCore/html/CustomPaintCanvas.h >@@ -70,6 +70,7 @@ public: > > AffineTransform baseTransform() const final { ASSERT(m_destinationGraphicsContext && m_copiedBuffer); return m_copiedBuffer->baseTransform(); } > Image* copiedImage() const final; >+ void replayDisplayList(GraphicsContext*) const; > > using RefCounted::ref; > using RefCounted::deref; >diff --git a/Source/WebCore/platform/graphics/CustomPaintImage.cpp b/Source/WebCore/platform/graphics/CustomPaintImage.cpp >index 034da561fe6b282245c83091ac3de1e287f7833e..ec482265770d175efae8e9cd2db62d651453a27c 100644 >--- a/Source/WebCore/platform/graphics/CustomPaintImage.cpp >+++ b/Source/WebCore/platform/graphics/CustomPaintImage.cpp >@@ -129,11 +129,7 @@ ImageDrawResult CustomPaintImage::doCustomPaint(GraphicsContext& destContext, co > if (result.type() != CallbackResultType::Success) > return ImageDrawResult::DidNothing; > >- auto image = canvas->copiedImage(); >- if (!image) >- return ImageDrawResult::DidNothing; >- >- destContext.drawImage(*image, FloatPoint()); >+ canvas->replayDisplayList(&destContext); > > return ImageDrawResult::DidDraw; > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 192217
:
356142
|
356167
|
356243
|
356278