Title: [270051] trunk/Source/WebCore
Revision
270051
Author
wenson_hs...@apple.com
Date
2020-11-19 14:11:45 -0800 (Thu, 19 Nov 2020)

Log Message

ASSERT NOT REACHED in WebCore::DisplayList::DrawImageBuffer::apply seen with TestWebKitAPI.DisplayListTests.ReplayWithMissingResource
https://bugs.webkit.org/show_bug.cgi?id=219175

Reviewed by Tim Horton.

We're currently hitting debug assertions when applying native image and image buffer display list items after
r270002, due to the fact that `applyImageBufferItem` and `applyNativeImageItem` return `WTF::nullopt` in the
case where the image resources are present, so we proceed by attempting to apply the item with only the graphics
context.

Fix this by checking the item type and always return early after calling either `applyImageBufferItem` or
`applyNativeImageItem`.

* platform/graphics/displaylists/DisplayListReplayer.cpp:
(WebCore::DisplayList::applyImageBufferItem):
(WebCore::DisplayList::applyNativeImageItem):
(WebCore::DisplayList::Replayer::applyItem):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (270050 => 270051)


--- trunk/Source/WebCore/ChangeLog	2020-11-19 22:08:57 UTC (rev 270050)
+++ trunk/Source/WebCore/ChangeLog	2020-11-19 22:11:45 UTC (rev 270051)
@@ -1,3 +1,23 @@
+2020-11-19  Wenson Hsieh  <wenson_hs...@apple.com>
+
+        ASSERT NOT REACHED in WebCore::DisplayList::DrawImageBuffer::apply seen with TestWebKitAPI.DisplayListTests.ReplayWithMissingResource
+        https://bugs.webkit.org/show_bug.cgi?id=219175
+
+        Reviewed by Tim Horton.
+
+        We're currently hitting debug assertions when applying native image and image buffer display list items after
+        r270002, due to the fact that `applyImageBufferItem` and `applyNativeImageItem` return `WTF::nullopt` in the
+        case where the image resources are present, so we proceed by attempting to apply the item with only the graphics
+        context.
+
+        Fix this by checking the item type and always return early after calling either `applyImageBufferItem` or
+        `applyNativeImageItem`.
+
+        * platform/graphics/displaylists/DisplayListReplayer.cpp:
+        (WebCore::DisplayList::applyImageBufferItem):
+        (WebCore::DisplayList::applyNativeImageItem):
+        (WebCore::DisplayList::Replayer::applyItem):
+
 2020-11-19  Zalan Bujtas  <za...@apple.com>
 
         [LFC][Integration] Do not stretch the border box with the scrollbars

Modified: trunk/Source/WebCore/platform/graphics/displaylists/DisplayListReplayer.cpp (270050 => 270051)


--- trunk/Source/WebCore/platform/graphics/displaylists/DisplayListReplayer.cpp	2020-11-19 22:08:57 UTC (rev 270050)
+++ trunk/Source/WebCore/platform/graphics/displaylists/DisplayListReplayer.cpp	2020-11-19 22:11:45 UTC (rev 270051)
@@ -48,8 +48,6 @@
 template<class T>
 inline static Optional<StopReplayReason> applyImageBufferItem(GraphicsContext& context, const ImageBufferHashMap& imageBuffers, ItemHandle item)
 {
-    if (!item.is<T>())
-        return WTF::nullopt;
     auto& imageBufferItem = item.get<T>();
     if (auto* imageBuffer = imageBuffers.get(imageBufferItem.imageBufferIdentifier())) {
         imageBufferItem.apply(context, *imageBuffer);
@@ -61,8 +59,6 @@
 template<class T>
 inline static Optional<StopReplayReason> applyNativeImageItem(GraphicsContext& context, const NativeImageHashMap& nativeImages, ItemHandle item)
 {
-    if (!item.is<T>())
-        return WTF::nullopt;
     auto& nativeImageItem = item.get<T>();
     if (auto* image = nativeImages.get(nativeImageItem.imageIdentifier())) {
         nativeImageItem.apply(context, *image);
@@ -76,17 +72,17 @@
     if (m_delegate && m_delegate->apply(item, m_context))
         return WTF::nullopt;
 
-    if (auto reasonForStopping = applyImageBufferItem<DrawImageBuffer>(m_context, m_imageBuffers, item))
-        return reasonForStopping;
+    if (item.is<DrawImageBuffer>())
+        return applyImageBufferItem<DrawImageBuffer>(m_context, m_imageBuffers, item);
 
-    if (auto reasonForStopping = applyImageBufferItem<ClipToImageBuffer>(m_context, m_imageBuffers, item))
-        return reasonForStopping;
+    if (item.is<ClipToImageBuffer>())
+        return applyImageBufferItem<ClipToImageBuffer>(m_context, m_imageBuffers, item);
 
-    if (auto reasonForStopping = applyNativeImageItem<DrawNativeImage>(m_context, m_nativeImages, item))
-        return reasonForStopping;
+    if (item.is<DrawNativeImage>())
+        return applyNativeImageItem<DrawNativeImage>(m_context, m_nativeImages, item);
 
-    if (auto reasonForStopping = applyNativeImageItem<DrawPattern>(m_context, m_nativeImages, item))
-        return reasonForStopping;
+    if (item.is<DrawPattern>())
+        return applyNativeImageItem<DrawPattern>(m_context, m_nativeImages, item);
 
     item.apply(m_context);
     return WTF::nullopt;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to