Title: [269155] trunk
Revision
269155
Author
[email protected]
Date
2020-10-29 10:53:22 -0700 (Thu, 29 Oct 2020)

Log Message

REGRESSION(r268249): image-orientation:none is broken for local (file://) urls
https://bugs.webkit.org/show_bug.cgi?id=217808
<rdar://problem/70603407>

Reviewed by Myles C. Maxfield.

Source/WebCore:

Use isCORSSameOrigin() instead of isOriginClean(), it's a more accureate method
for this purpose.
Allow image-orientation: none overriding when the image is local or a data-url.

Test: fast/images/image-orientation-none-local.html

* html/HTMLImageElement.cpp:
(WebCore::HTMLImageElement::allowsOrientationOverride const):

LayoutTests:

Added a tests that ensure image-orientation: none is supported in file and data URLs.

* fast/images/image-orientation-none-local-expected.txt: Added.
* fast/images/image-orientation-none-local.html: Added.
* fast/images/image-orientation-none-data-url-expected.txt: Added.
* fast/images/image-orientation-none-data-url.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (269154 => 269155)


--- trunk/LayoutTests/ChangeLog	2020-10-29 17:47:26 UTC (rev 269154)
+++ trunk/LayoutTests/ChangeLog	2020-10-29 17:53:22 UTC (rev 269155)
@@ -1,3 +1,18 @@
+2020-10-29  Noam Rosenthal  <[email protected]>
+
+        REGRESSION(r268249): image-orientation:none is broken for local (file://) urls
+        https://bugs.webkit.org/show_bug.cgi?id=217808
+        <rdar://problem/70603407>
+
+        Reviewed by Myles C. Maxfield.
+
+        Added a tests that ensure image-orientation: none is supported in file and data URLs.
+
+        * fast/images/image-orientation-none-local-expected.txt: Added.
+        * fast/images/image-orientation-none-local.html: Added.
+        * fast/images/image-orientation-none-data-url-expected.txt: Added.
+        * fast/images/image-orientation-none-data-url.html: Added.
+
 2020-10-29  Karl Rackler  <[email protected]>
 
         REGRESSION: [ Mojave+ ] inspector/dom-debugger/attribute-modified-style.html is a flaky timeout

Added: trunk/LayoutTests/fast/images/image-orientation-none-data-url-expected.txt (0 => 269155)


--- trunk/LayoutTests/fast/images/image-orientation-none-data-url-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/images/image-orientation-none-data-url-expected.txt	2020-10-29 17:53:22 UTC (rev 269155)
@@ -0,0 +1,6 @@
+PASS rotatedImage.offsetWidth is 1
+PASS nonRotatedImage.offsetWidth is 2
+The test should display two images, one rotated and one not.
+
+
+

Added: trunk/LayoutTests/fast/images/image-orientation-none-data-url.html (0 => 269155)


--- trunk/LayoutTests/fast/images/image-orientation-none-data-url.html	                        (rev 0)
+++ trunk/LayoutTests/fast/images/image-orientation-none-data-url.html	2020-10-29 17:53:22 UTC (rev 269155)
@@ -0,0 +1,24 @@
+<script src=""
+<p>The test should display two images, one rotated and one not.</p>
+<br/>
+<output id="log"></output>
+<script>        
+    const localImageLocation = "resources/exif-orientation-5-lu.jpg";
+    if (window.testRunner)
+        testRunner.dumpAsText(pixeltest = false);
+
+    // This is a 2x1 empty JPEG image.
+    const src = ''
+
+    window.rotatedImage = document.createElement("img");
+    rotatedImage.setAttribute("src", src);
+    window.nonRotatedImage = document.createElement("img");
+    nonRotatedImage.setAttribute("src", src);
+    nonRotatedImage.style.imageOrientation = 'none'
+    document.body.appendChild(rotatedImage);
+    document.body.appendChild(nonRotatedImage);
+    window._onload_ = () => {
+        shouldBe("rotatedImage.offsetWidth", "1")
+        shouldBe("nonRotatedImage.offsetWidth", "2")
+    }
+</script>

Added: trunk/LayoutTests/fast/images/image-orientation-none-local-expected.txt (0 => 269155)


--- trunk/LayoutTests/fast/images/image-orientation-none-local-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/images/image-orientation-none-local-expected.txt	2020-10-29 17:53:22 UTC (rev 269155)
@@ -0,0 +1,6 @@
+PASS rotatedImage.offsetWidth is 50
+PASS nonRotatedImage.offsetWidth is 100
+The test should display two images, one rotated and one not.
+
+
+

Added: trunk/LayoutTests/fast/images/image-orientation-none-local.html (0 => 269155)


--- trunk/LayoutTests/fast/images/image-orientation-none-local.html	                        (rev 0)
+++ trunk/LayoutTests/fast/images/image-orientation-none-local.html	2020-10-29 17:53:22 UTC (rev 269155)
@@ -0,0 +1,21 @@
+<script src=""
+<p>The test should display two images, one rotated and one not.</p>
+<br/>
+<output id="log"></output>
+<script>        
+    const localImageLocation = "resources/exif-orientation-5-lu.jpg";
+    if (window.testRunner)
+        testRunner.dumpAsText(pixeltest = false);
+
+    window.rotatedImage = document.createElement("img");
+    rotatedImage.setAttribute("src", localImageLocation);
+    window.nonRotatedImage = document.createElement("img");
+    nonRotatedImage.setAttribute("src", localImageLocation);
+    nonRotatedImage.style.imageOrientation = 'none'
+    document.body.appendChild(rotatedImage);
+    document.body.appendChild(nonRotatedImage);
+    window._onload_ = () => {
+        shouldBe("rotatedImage.offsetWidth", "50")
+        shouldBe("nonRotatedImage.offsetWidth", "100")
+    }
+</script>

Modified: trunk/Source/WebCore/ChangeLog (269154 => 269155)


--- trunk/Source/WebCore/ChangeLog	2020-10-29 17:47:26 UTC (rev 269154)
+++ trunk/Source/WebCore/ChangeLog	2020-10-29 17:53:22 UTC (rev 269155)
@@ -1,3 +1,20 @@
+2020-10-29  Noam Rosenthal  <[email protected]>
+
+        REGRESSION(r268249): image-orientation:none is broken for local (file://) urls
+        https://bugs.webkit.org/show_bug.cgi?id=217808
+        <rdar://problem/70603407>
+
+        Reviewed by Myles C. Maxfield.
+
+        Use isCORSSameOrigin() instead of isOriginClean(), it's a more accureate method
+        for this purpose.
+        Allow image-orientation: none overriding when the image is local or a data-url.
+
+        Test: fast/images/image-orientation-none-local.html
+
+        * html/HTMLImageElement.cpp:
+        (WebCore::HTMLImageElement::allowsOrientationOverride const):
+
 2020-10-29  Antti Koivisto  <[email protected]>
 
         [LFC][Integration] Rename text run localStart/EndOffset to start/end

Modified: trunk/Source/WebCore/html/HTMLImageElement.cpp (269154 => 269155)


--- trunk/Source/WebCore/html/HTMLImageElement.cpp	2020-10-29 17:47:26 UTC (rev 269154)
+++ trunk/Source/WebCore/html/HTMLImageElement.cpp	2020-10-29 17:53:22 UTC (rev 269155)
@@ -683,8 +683,12 @@
 
 bool HTMLImageElement::allowsOrientationOverride() const
 {
-    auto* image = cachedImage();
-    return !image || image->isOriginClean(&(document().securityOrigin()));
+    auto* cachedImage = this->cachedImage();
+    if (!cachedImage)
+        return true;
+
+    auto image = cachedImage->image();
+    return !image || image->sourceURL().protocolIsData() || cachedImage->isCORSSameOrigin();
 }
 
 #if ENABLE(ATTACHMENT_ELEMENT)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to