Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(885)

Unified Diff: third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2D.cpp

Issue 1694263003: Add Image::updateConcreteSize() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@refactor-size-calculation-in
Patch Set: Pull test for now, needs changes in upcoming CL to pass. Address nits. Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2D.cpp
diff --git a/third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2D.cpp b/third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2D.cpp
index fdcfd12a44b4b55eb6ac77b05aa4155e49ea5428..ecb58ef86d6ff9e10daf234b3bf0629acaec1f4a 100644
--- a/third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2D.cpp
+++ b/third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2D.cpp
@@ -1267,6 +1267,7 @@ static inline CanvasImageSource* toImageSourceInternal(const CanvasImageSourceUn
void CanvasRenderingContext2D::drawImage(const CanvasImageSourceUnion& imageSource, double x, double y, ExceptionState& exceptionState)
{
CanvasImageSource* imageSourceInternal = toImageSourceInternal(imageSource);
+ imageSourceInternal->updateConcreteObjectSize(FloatSize(canvas()->width(), canvas()->height()));
Justin Novosad 2016/02/23 15:53:04 I did some spec analysis on this. The spec for dra
davve 2016/02/23 18:40:31 The contain constraint is actually not added yet,
FloatSize sourceRectSize = imageSourceInternal->elementSize();
FloatSize destRectSize = imageSourceInternal->defaultDestinationSize();
drawImage(imageSourceInternal, 0, 0, sourceRectSize.width(), sourceRectSize.height(), x, y, destRectSize.width(), destRectSize.height(), exceptionState);
@@ -1276,6 +1277,7 @@ void CanvasRenderingContext2D::drawImage(const CanvasImageSourceUnion& imageSour
double x, double y, double width, double height, ExceptionState& exceptionState)
{
CanvasImageSource* imageSourceInternal = toImageSourceInternal(imageSource);
+ imageSourceInternal->updateConcreteObjectSize(FloatSize(canvas()->width(), canvas()->height()));
Justin Novosad 2016/02/23 15:53:04 In this case, the change also seem to comply with
davve 2016/02/23 18:40:31 As I said above, this patch is mostly plumbing and
FloatSize sourceRectSize = imageSourceInternal->elementSize();
drawImage(imageSourceInternal, 0, 0, sourceRectSize.width(), sourceRectSize.height(), x, y, width, height, exceptionState);
}

Powered by Google App Engine
This is Rietveld 408576698