Title: [260989] trunk
Revision
260989
Author
grao...@webkit.org
Date
2020-05-01 01:32:10 -0700 (Fri, 01 May 2020)

Log Message

REGRESSION: MotionMark 1.1 regressed due to r260016
https://bugs.webkit.org/show_bug.cgi?id=211280
<rdar://problem/61898830>

Unreviewed.

Source/WebCore:

* html/canvas/CanvasRenderingContext2DBase.cpp:
(WebCore::CanvasRenderingContext2DBase::drawImage):
* platform/graphics/BitmapImage.cpp:
(WebCore::BitmapImage::draw):
* platform/graphics/GraphicsContext.cpp:
(WebCore::GraphicsContext::drawImage):

LayoutTests:

* fast/images/image-orientation-none-canvas.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (260988 => 260989)


--- trunk/LayoutTests/ChangeLog	2020-05-01 08:18:11 UTC (rev 260988)
+++ trunk/LayoutTests/ChangeLog	2020-05-01 08:32:10 UTC (rev 260989)
@@ -1,3 +1,13 @@
+2020-05-01  Antoine Quint  <grao...@apple.com>
+
+        REGRESSION: MotionMark 1.1 regressed due to r260016
+        https://bugs.webkit.org/show_bug.cgi?id=211280
+        <rdar://problem/61898830>
+
+        Unreviewed.
+
+        * fast/images/image-orientation-none-canvas.html:
+
 2020-04-30  Wenson Hsieh  <wenson_hs...@apple.com>
 
         REGRESSION: Double tap dispatches one click event on iOS 13.4 when it would dispatch two on iOS 13.3

Modified: trunk/LayoutTests/fast/images/image-orientation-none-canvas.html (260988 => 260989)


--- trunk/LayoutTests/fast/images/image-orientation-none-canvas.html	2020-05-01 08:18:11 UTC (rev 260988)
+++ trunk/LayoutTests/fast/images/image-orientation-none-canvas.html	2020-05-01 08:32:10 UTC (rev 260989)
@@ -11,13 +11,7 @@
         width: 102px;
         height: 52px;
     }
-    img {
-        position: fixed;
-        image-orientation: none;
-        visibility: hidden;
-    }
     canvas {
-        position: fixed;
         border: 1px solid black;
         width: 100px;
         height: 50px;
@@ -29,29 +23,25 @@
     <br>
     <div class ="container">
         <div class ="box">
-            <img src=""
-            <canvas></canvas>
+            <canvas id="canvas1"></canvas>
         </div>
         <br>Normal
     </div>
     <div class ="container">
         <div class ="box">
-            <img src=""
-            <canvas></canvas>
+            <canvas id="canvas2"></canvas>
         </div>
         <br>Flipped horizontally
     </div>
     <div class ="container">
         <div class ="box">
-            <img src=""
-            <canvas></canvas>
+            <canvas id="canvas3"></canvas>
         </div>
         <br>Rotated 180&deg;
     </div>
     <div class ="container">
         <div class ="box">
-            <img src=""
-            <canvas></canvas>
+            <canvas id="canvas4"></canvas>
         </div>
         <br>Flipped vertically
     </div>
@@ -58,29 +48,25 @@
     <br>
     <div class ="container">
         <div class ="box">
-            <img src=""
-            <canvas></canvas>
+            <canvas id="canvas5"></canvas>
         </div>
         <br>Rotated 90&deg; CCW and flipped vertically
     </div>
     <div class ="container">
         <div class ="box">
-            <img src=""
-            <canvas></canvas>
+            <canvas id="canvas6"></canvas>
         </div>
         <br>Rotated 90&deg; CCW
     </div>
     <div class ="container">
         <div class ="box">
-            <img src=""
-            <canvas></canvas>
+            <canvas id="canvas7"></canvas>
         </div>
         <br>Rotated 90&deg; CW and flipped vertically
     </div>
     <div class ="container">
         <div class ="box">
-            <img src=""
-            <canvas></canvas>
+            <canvas id="canvas8"></canvas>
         </div>
         <br>Rotated 90&deg; CW
     </div>
@@ -87,8 +73,7 @@
     <br>
     <div class ="container">
         <div class ="box">
-            <img src=""
-            <canvas></canvas>
+            <canvas id="canvas9"></canvas>
         </div>
         <br>Undefined (invalid value)
     </div>
@@ -97,18 +82,38 @@
             window.testRunner.waitUntilDone();
 
         window._onload_ = function() {
-            var boxes = document.querySelectorAll(".box");
+            var names = [
+                { resource: "resources/exif-orientation-1-ul.jpg",  id : "canvas1" },
+                { resource: "resources/exif-orientation-2-ur.jpg",  id : "canvas2" },
+                { resource: "resources/exif-orientation-3-lr.jpg",  id : "canvas3" },
+                { resource: "resources/exif-orientation-4-lol.jpg", id : "canvas4" },
+                { resource: "resources/exif-orientation-5-lu.jpg",  id : "canvas5" },
+                { resource: "resources/exif-orientation-6-ru.jpg",  id : "canvas6" },
+                { resource: "resources/exif-orientation-7-rl.jpg",  id : "canvas7" },
+                { resource: "resources/exif-orientation-8-llo.jpg", id : "canvas8" },
+                { resource: "resources/exif-orientation-9-u.jpg",   id : "canvas9" }
+            ];
 
-            boxes.forEach(function(box) {
-                let image = box.querySelector("img");
-                let canvas = box.querySelector("canvas");
-                canvas.width = canvas.clientWidth;
-                canvas.height = canvas.clientHeight;
-                let context = canvas.getContext("2d");
-                context.drawImage(image, 0, 0, canvas.width, canvas.height);
+            var drawCount = 0;
+
+            names.forEach(function(name) {
+                var image = new Image;
+                image.style.imageOrientation = "none";
+                image.style.display = "none";
+                image.src = ""
+                document.body.appendChild(image);
+                image.decode().then(() => {
+                    let canvas = document.getElementById(name.id);
+                    canvas.width = canvas.offsetWidth - 2;
+                    canvas.height = canvas.offsetHeight - 2;
+                    let context = canvas.getContext("2d");
+                    context.drawImage(image, 0, 0, canvas.width, canvas.height);
+                    if (++drawCount == names.length) {
+                        if (window.testRunner)
+                            window.testRunner.notifyDone();
+                    }
+                });
             });
-
-            window.testRunner.notifyDone();
         }
     </script>
 </body>

Modified: trunk/Source/WebCore/ChangeLog (260988 => 260989)


--- trunk/Source/WebCore/ChangeLog	2020-05-01 08:18:11 UTC (rev 260988)
+++ trunk/Source/WebCore/ChangeLog	2020-05-01 08:32:10 UTC (rev 260989)
@@ -1,3 +1,18 @@
+2020-05-01  Antoine Quint  <grao...@apple.com>
+
+        REGRESSION: MotionMark 1.1 regressed due to r260016
+        https://bugs.webkit.org/show_bug.cgi?id=211280
+        <rdar://problem/61898830>
+
+        Unreviewed.
+
+        * html/canvas/CanvasRenderingContext2DBase.cpp:
+        (WebCore::CanvasRenderingContext2DBase::drawImage):
+        * platform/graphics/BitmapImage.cpp:
+        (WebCore::BitmapImage::draw):
+        * platform/graphics/GraphicsContext.cpp:
+        (WebCore::GraphicsContext::drawImage):
+
 2020-05-01  Philippe Normand  <pnorm...@igalia.com>
 
         [GStreamer] Move video frame holder to its own file

Modified: trunk/Source/WebCore/html/canvas/CanvasRenderingContext2DBase.cpp (260988 => 260989)


--- trunk/Source/WebCore/html/canvas/CanvasRenderingContext2DBase.cpp	2020-05-01 08:18:11 UTC (rev 260988)
+++ trunk/Source/WebCore/html/canvas/CanvasRenderingContext2DBase.cpp	2020-05-01 08:32:10 UTC (rev 260989)
@@ -1466,9 +1466,7 @@
     FloatRect imageRect = FloatRect(FloatPoint(), size(imageElement, ImageSizeType::BeforeDevicePixelRatio));
 
     auto orientation = ImageOrientation::FromImage;
-    if (auto* renderer = imageElement.renderer())
-        orientation = renderer->style().imageOrientation();
-    else if (auto* computedStyle = imageElement.computedStyle())
+    if (auto* computedStyle = imageElement.computedStyle())
         orientation = computedStyle->imageOrientation();
 
     auto result = drawImage(imageElement.document(), imageElement.cachedImage(), imageElement.renderer(), imageRect, srcRect, dstRect, op, blendMode, orientation);

Modified: trunk/Source/WebCore/platform/graphics/BitmapImage.cpp (260988 => 260989)


--- trunk/Source/WebCore/platform/graphics/BitmapImage.cpp	2020-05-01 08:18:11 UTC (rev 260988)
+++ trunk/Source/WebCore/platform/graphics/BitmapImage.cpp	2020-05-01 08:32:10 UTC (rev 260989)
@@ -210,7 +210,7 @@
         return ImageDrawResult::DidNothing;
 
     FloatSize scaleFactorForDrawing = context.scaleFactorForDrawing(destRect, srcRect);
-    IntSize sizeForDrawing = expandedIntSize(size(ImageOrientation::None) * scaleFactorForDrawing);
+    IntSize sizeForDrawing = expandedIntSize(size() * scaleFactorForDrawing);
     ImageDrawResult result = ImageDrawResult::DidDraw;
 
     m_currentSubsamplingLevel = m_allowSubsampling ? subsamplingLevelForScaleFactor(context, scaleFactorForDrawing) : SubsamplingLevel::Default;
@@ -289,12 +289,10 @@
         return result;
     }
 
-    auto orientation = options.orientation();
-    if (orientation == ImageOrientation::FromImage) {
-        orientation = frameOrientationAtIndex(m_currentFrame);
-        drawNativeImage(image, context, destRect, srcRect, IntSize(size(orientation)), { options, orientation });
-    } else
-        drawNativeImage(image, context, destRect, srcRect, IntSize(size(orientation)), options);
+    if (options.orientation() == ImageOrientation::FromImage)
+        drawNativeImage(image, context, destRect, srcRect, IntSize(size()), { options, frameOrientationAtIndex(m_currentFrame) });
+    else
+        drawNativeImage(image, context, destRect, srcRect, IntSize(size()), options);
 
     m_currentFrameDecodingStatus = frameDecodingStatusAtIndex(m_currentFrame);
 

Modified: trunk/Source/WebCore/platform/graphics/GraphicsContext.cpp (260988 => 260989)


--- trunk/Source/WebCore/platform/graphics/GraphicsContext.cpp	2020-05-01 08:18:11 UTC (rev 260988)
+++ trunk/Source/WebCore/platform/graphics/GraphicsContext.cpp	2020-05-01 08:32:10 UTC (rev 260989)
@@ -711,7 +711,7 @@
 
 ImageDrawResult GraphicsContext::drawImage(Image& image, const FloatRect& destination, const ImagePaintingOptions& imagePaintingOptions)
 {
-    FloatRect srcRect(FloatPoint(), image.size(imagePaintingOptions.orientation()));
+    FloatRect srcRect(FloatPoint(), image.size());
     return drawImage(image, destination, srcRect, imagePaintingOptions);
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to