Title: [231292] trunk
Revision
231292
Author
[email protected]
Date
2018-05-02 18:17:55 -0700 (Wed, 02 May 2018)

Log Message

Hiding then showing an <object> of type image makes the underlaying image disappear
https://bugs.webkit.org/show_bug.cgi?id=185216
<rdar://problem/39055630>

Patch by Said Abou-Hallawa <[email protected]> on 2018-05-02
Reviewed by Youenn Fablet.

Source/WebCore:

Ensure the HTMLPlugInImageElement updates the RenderImageResource of its
RenderImage with the CachedImage of its ImageLoader when the RenderImage
is recreated.

Test: fast/images/object-image-hide-show.html

* html/HTMLPlugInImageElement.cpp:
(WebCore::HTMLPlugInImageElement::didAttachRenderers):
This is very similar to what we do in HTMLImageElement::didAttachRenderers().

LayoutTests:

* fast/images/object-image-hide-show-expected.html: Added.
* fast/images/object-image-hide-show.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (231291 => 231292)


--- trunk/LayoutTests/ChangeLog	2018-05-03 01:08:55 UTC (rev 231291)
+++ trunk/LayoutTests/ChangeLog	2018-05-03 01:17:55 UTC (rev 231292)
@@ -1,3 +1,14 @@
+2018-05-02  Said Abou-Hallawa  <[email protected]>
+
+        Hiding then showing an <object> of type image makes the underlaying image disappear
+        https://bugs.webkit.org/show_bug.cgi?id=185216
+        <rdar://problem/39055630>
+
+        Reviewed by Youenn Fablet.
+
+        * fast/images/object-image-hide-show-expected.html: Added.
+        * fast/images/object-image-hide-show.html: Added.
+
 2018-05-02  Brent Fulgham  <[email protected]>
 
         Use RetainPtr for form input type

Added: trunk/LayoutTests/fast/images/object-image-hide-show-expected.html (0 => 231292)


--- trunk/LayoutTests/fast/images/object-image-hide-show-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/images/object-image-hide-show-expected.html	2018-05-03 01:17:55 UTC (rev 231292)
@@ -0,0 +1,10 @@
+<style>
+    div {
+        width: 100px;
+        height: 100px;
+        background-color: lime;
+    }
+</style>
+<body>
+    <div></div>
+</body>

Added: trunk/LayoutTests/fast/images/object-image-hide-show.html (0 => 231292)


--- trunk/LayoutTests/fast/images/object-image-hide-show.html	                        (rev 0)
+++ trunk/LayoutTests/fast/images/object-image-hide-show.html	2018-05-03 01:17:55 UTC (rev 231292)
@@ -0,0 +1,33 @@
+<style>
+    object {
+        width: 100px;
+        height: 100px;  
+    }
+</style>
+<body>
+    <object data="" type="image/png" />
+    <script>
+        function toggleVisiblity(element, after) {
+            return new Promise((resolve) => {
+                setTimeout(() => {
+                    if (element.style.display === "none")
+                        element.style.display = "block";
+                    else
+                        element.style.display = "none";
+                    resolve();
+                }, after);
+            });
+        }
+
+        if (window.testRunner)
+            testRunner.waitUntilDone();
+
+        var element = document.querySelector("object");
+        toggleVisiblity(element, 50).then(() => {
+            return toggleVisiblity(element, 50);
+        }).then(() => {
+            if (window.testRunner)
+                testRunner.notifyDone();
+        });
+    </script>
+</body>

Modified: trunk/Source/WebCore/ChangeLog (231291 => 231292)


--- trunk/Source/WebCore/ChangeLog	2018-05-03 01:08:55 UTC (rev 231291)
+++ trunk/Source/WebCore/ChangeLog	2018-05-03 01:17:55 UTC (rev 231292)
@@ -1,3 +1,22 @@
+2018-05-02  Said Abou-Hallawa  <[email protected]>
+
+        Hiding then showing an <object> of type image makes the underlaying image disappear
+        https://bugs.webkit.org/show_bug.cgi?id=185216
+        <rdar://problem/39055630>
+
+        Reviewed by Youenn Fablet.
+
+        Ensure the HTMLPlugInImageElement updates the RenderImageResource of its
+        RenderImage with the CachedImage of its ImageLoader when the RenderImage
+        is recreated.
+
+        Test: fast/images/object-image-hide-show.html
+
+        * html/HTMLPlugInImageElement.cpp:
+        (WebCore::HTMLPlugInImageElement::didAttachRenderers):
+        This is very similar to what we do in HTMLImageElement::didAttachRenderers().
+
+
 2018-05-02  Brent Fulgham  <[email protected]>
 
         Use RetainPtr for form input type

Modified: trunk/Source/WebCore/html/HTMLPlugInImageElement.cpp (231291 => 231292)


--- trunk/Source/WebCore/html/HTMLPlugInImageElement.cpp	2018-05-03 01:08:55 UTC (rev 231291)
+++ trunk/Source/WebCore/html/HTMLPlugInImageElement.cpp	2018-05-03 01:17:55 UTC (rev 231292)
@@ -229,6 +229,13 @@
     m_needsWidgetUpdate = true;
     scheduleUpdateForAfterStyleResolution();
 
+    // Update the RenderImageResource of the associated RenderImage.
+    if (m_imageLoader && is<RenderImage>(renderer())) {
+        auto& renderImageResource = downcast<RenderImage>(*renderer()).imageResource();
+        if (!renderImageResource.cachedImage())
+            renderImageResource.setCachedImage(m_imageLoader->image());
+    }
+
     HTMLPlugInElement::didAttachRenderers();
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to