Title: [233953] branches/safari-606-branch
Revision
233953
Author
[email protected]
Date
2018-07-18 18:59:51 -0700 (Wed, 18 Jul 2018)

Log Message

Cherry-pick r233872. rdar://problem/42345272

    Source/WebCore:
    [iOS] When bringing MobileSafari to the foreground, images, which are pending decoding, won't be drawn into the flush immediate transaction
    https://bugs.webkit.org/show_bug.cgi?id=187375

    Patch by Said Abou-Hallawa <[email protected]> on 2018-07-16
    Reviewed by Simon Fraser.

    An immediate-paint transaction should force all the images which are pending
    decoding to be repainted.

    To do that, FrameView::paintControlTints() will be re-factored to a new
    generic function such that it takes PaintInvalidationReasons. The new function
    which is named 'traverseForPaintInvalidation' will traverse the render tree
    for a specific PaintInvalidationReasons.

    invalidateImagesWithAsyncDecodes() will stop the asynchronous decoding for
    the underlying image and repaint all the clients which are waiting for the
    decoding to finish.

    * loader/cache/CachedImage.cpp:
    (WebCore::CachedImage::didRemoveClient):
    (WebCore::CachedImage::isClientWaitingForAsyncDecoding const):
    (WebCore::CachedImage::addClientWaitingForAsyncDecoding):
    (WebCore::CachedImage::removeAllClientsWaitingForAsyncDecoding):
    (WebCore::CachedImage::allClientsRemoved):
    (WebCore::CachedImage::clear):
    (WebCore::CachedImage::createImage):
    (WebCore::CachedImage::imageFrameAvailable):
    (WebCore::CachedImage::addPendingImageDrawingClient): Deleted.
    * loader/cache/CachedImage.h:
    * page/FrameView.cpp:
    (WebCore::FrameView::paintScrollCorner):
    (WebCore::FrameView::updateControlTints):
    (WebCore::FrameView::traverseForPaintInvalidation):
    (WebCore::FrameView::adjustPageHeightDeprecated):
    (WebCore::FrameView::paintControlTints): Deleted.
    * page/FrameView.h:
    * platform/ScrollView.cpp:
    (WebCore::ScrollView::paint):
    * platform/Scrollbar.cpp:
    (WebCore::Scrollbar::paint):
    * platform/graphics/BitmapImage.h:
    * platform/graphics/GraphicsContext.cpp:
    (WebCore::GraphicsContext::GraphicsContext):
    * platform/graphics/GraphicsContext.h:
    (WebCore::GraphicsContext::performingPaintInvalidation const):
    (WebCore::GraphicsContext::invalidatingControlTints const):
    (WebCore::GraphicsContext::invalidatingImagesWithAsyncDecodes const):
    (WebCore::GraphicsContext::updatingControlTints const): Deleted.
    * rendering/RenderBoxModelObject.cpp:
    (WebCore::RenderBoxModelObject::paintFillLayerExtended):
    * rendering/RenderImage.cpp:
    (WebCore::RenderImage::paintReplaced):
    (WebCore::RenderImage::paintAreaElementFocusRing):
    (WebCore::RenderImage::paintIntoRect):
    * rendering/RenderLayer.cpp:
    (WebCore::RenderLayer::paintScrollCorner):
    (WebCore::RenderLayer::paintResizer):
    (WebCore::RenderLayer::paintLayer):
    * rendering/RenderScrollbar.cpp:
    (WebCore::RenderScrollbar::paint):
    * rendering/RenderTheme.cpp:
    (WebCore::RenderTheme::paint):
    * testing/Internals.cpp:
    (WebCore::Internals::invalidateControlTints):
    (WebCore::Internals::paintControlTints): Deleted.
    * testing/Internals.h:
    * testing/Internals.idl:

    Source/WebKit:
    [iOS] When bringing MobileSafari to the foreground, images, which are pending decoding, won't be drawn into the immediate-paint transaction
    https://bugs.webkit.org/show_bug.cgi?id=187375

    Patch by Said Abou-Hallawa <[email protected]> on 2018-07-16
    Reviewed by Simon Fraser.

    For immediate-paint transaction, we should force all the images which are
    pending decoding to be repainted before building this transaction.

    * WebProcess/Plugins/PDF/PDFPlugin.mm:
    (WebKit::PDFPlugin::updateControlTints):
    * WebProcess/Plugins/PluginView.cpp:
    (WebKit::PluginView::paint):
    * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
    (WebKit::RemoteLayerTreeDrawingArea::flushLayers):

    LayoutTests:
    [iOS] When bringing MobileSafari to the foreground, images, which are pending decoding, won't be drawn into the immediate-paint transaction
    https://bugs.webkit.org/show_bug.cgi?id=187375

    Patch by Said Abou-Hallawa <[email protected]> on 2018-07-16
    Reviewed by Simon Fraser.

    The Internals API paintControlTints() is now renamed to invalidateControlTints()
    to be consistent with the new enum values and with the new name of the
    C++ function.

    * fast/css/webkit-mask-crash-fieldset-legend.html:
    * fast/css/webkit-mask-crash-figure.html:
    * fast/css/webkit-mask-crash-table.html:
    * fast/css/webkit-mask-crash-td-2.html:
    * fast/css/webkit-mask-crash-td.html:

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233872 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Diff

Modified: branches/safari-606-branch/LayoutTests/ChangeLog (233952 => 233953)


--- branches/safari-606-branch/LayoutTests/ChangeLog	2018-07-19 01:59:42 UTC (rev 233952)
+++ branches/safari-606-branch/LayoutTests/ChangeLog	2018-07-19 01:59:51 UTC (rev 233953)
@@ -1,5 +1,131 @@
 2018-07-18  Babak Shafiei  <[email protected]>
 
+        Cherry-pick r233872. rdar://problem/42345272
+
+    Source/WebCore:
+    [iOS] When bringing MobileSafari to the foreground, images, which are pending decoding, won't be drawn into the flush immediate transaction
+    https://bugs.webkit.org/show_bug.cgi?id=187375
+    
+    Patch by Said Abou-Hallawa <[email protected]> on 2018-07-16
+    Reviewed by Simon Fraser.
+    
+    An immediate-paint transaction should force all the images which are pending
+    decoding to be repainted.
+    
+    To do that, FrameView::paintControlTints() will be re-factored to a new
+    generic function such that it takes PaintInvalidationReasons. The new function
+    which is named 'traverseForPaintInvalidation' will traverse the render tree
+    for a specific PaintInvalidationReasons.
+    
+    invalidateImagesWithAsyncDecodes() will stop the asynchronous decoding for
+    the underlying image and repaint all the clients which are waiting for the
+    decoding to finish.
+    
+    * loader/cache/CachedImage.cpp:
+    (WebCore::CachedImage::didRemoveClient):
+    (WebCore::CachedImage::isClientWaitingForAsyncDecoding const):
+    (WebCore::CachedImage::addClientWaitingForAsyncDecoding):
+    (WebCore::CachedImage::removeAllClientsWaitingForAsyncDecoding):
+    (WebCore::CachedImage::allClientsRemoved):
+    (WebCore::CachedImage::clear):
+    (WebCore::CachedImage::createImage):
+    (WebCore::CachedImage::imageFrameAvailable):
+    (WebCore::CachedImage::addPendingImageDrawingClient): Deleted.
+    * loader/cache/CachedImage.h:
+    * page/FrameView.cpp:
+    (WebCore::FrameView::paintScrollCorner):
+    (WebCore::FrameView::updateControlTints):
+    (WebCore::FrameView::traverseForPaintInvalidation):
+    (WebCore::FrameView::adjustPageHeightDeprecated):
+    (WebCore::FrameView::paintControlTints): Deleted.
+    * page/FrameView.h:
+    * platform/ScrollView.cpp:
+    (WebCore::ScrollView::paint):
+    * platform/Scrollbar.cpp:
+    (WebCore::Scrollbar::paint):
+    * platform/graphics/BitmapImage.h:
+    * platform/graphics/GraphicsContext.cpp:
+    (WebCore::GraphicsContext::GraphicsContext):
+    * platform/graphics/GraphicsContext.h:
+    (WebCore::GraphicsContext::performingPaintInvalidation const):
+    (WebCore::GraphicsContext::invalidatingControlTints const):
+    (WebCore::GraphicsContext::invalidatingImagesWithAsyncDecodes const):
+    (WebCore::GraphicsContext::updatingControlTints const): Deleted.
+    * rendering/RenderBoxModelObject.cpp:
+    (WebCore::RenderBoxModelObject::paintFillLayerExtended):
+    * rendering/RenderImage.cpp:
+    (WebCore::RenderImage::paintReplaced):
+    (WebCore::RenderImage::paintAreaElementFocusRing):
+    (WebCore::RenderImage::paintIntoRect):
+    * rendering/RenderLayer.cpp:
+    (WebCore::RenderLayer::paintScrollCorner):
+    (WebCore::RenderLayer::paintResizer):
+    (WebCore::RenderLayer::paintLayer):
+    * rendering/RenderScrollbar.cpp:
+    (WebCore::RenderScrollbar::paint):
+    * rendering/RenderTheme.cpp:
+    (WebCore::RenderTheme::paint):
+    * testing/Internals.cpp:
+    (WebCore::Internals::invalidateControlTints):
+    (WebCore::Internals::paintControlTints): Deleted.
+    * testing/Internals.h:
+    * testing/Internals.idl:
+    
+    Source/WebKit:
+    [iOS] When bringing MobileSafari to the foreground, images, which are pending decoding, won't be drawn into the immediate-paint transaction
+    https://bugs.webkit.org/show_bug.cgi?id=187375
+    
+    Patch by Said Abou-Hallawa <[email protected]> on 2018-07-16
+    Reviewed by Simon Fraser.
+    
+    For immediate-paint transaction, we should force all the images which are
+    pending decoding to be repainted before building this transaction.
+    
+    * WebProcess/Plugins/PDF/PDFPlugin.mm:
+    (WebKit::PDFPlugin::updateControlTints):
+    * WebProcess/Plugins/PluginView.cpp:
+    (WebKit::PluginView::paint):
+    * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
+    (WebKit::RemoteLayerTreeDrawingArea::flushLayers):
+    
+    LayoutTests:
+    [iOS] When bringing MobileSafari to the foreground, images, which are pending decoding, won't be drawn into the immediate-paint transaction
+    https://bugs.webkit.org/show_bug.cgi?id=187375
+    
+    Patch by Said Abou-Hallawa <[email protected]> on 2018-07-16
+    Reviewed by Simon Fraser.
+    
+    The Internals API paintControlTints() is now renamed to invalidateControlTints()
+    to be consistent with the new enum values and with the new name of the
+    C++ function.
+    
+    * fast/css/webkit-mask-crash-fieldset-legend.html:
+    * fast/css/webkit-mask-crash-figure.html:
+    * fast/css/webkit-mask-crash-table.html:
+    * fast/css/webkit-mask-crash-td-2.html:
+    * fast/css/webkit-mask-crash-td.html:
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233872 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2018-07-16  Said Abou-Hallawa  <[email protected]>
+
+            [iOS] When bringing MobileSafari to the foreground, images, which are pending decoding, won't be drawn into the immediate-paint transaction
+            https://bugs.webkit.org/show_bug.cgi?id=187375
+
+            Reviewed by Simon Fraser.
+
+            The Internals API paintControlTints() is now renamed to invalidateControlTints()
+            to be consistent with the new enum values and with the new name of the
+            C++ function.
+
+            * fast/css/webkit-mask-crash-fieldset-legend.html:
+            * fast/css/webkit-mask-crash-figure.html:
+            * fast/css/webkit-mask-crash-table.html:
+            * fast/css/webkit-mask-crash-td-2.html:
+            * fast/css/webkit-mask-crash-td.html:
+
+2018-07-18  Babak Shafiei  <[email protected]>
+
         Cherry-pick r233865. rdar://problem/42343023
 
     Fullscreen requires active document.

Modified: branches/safari-606-branch/LayoutTests/fast/css/webkit-mask-crash-fieldset-legend.html (233952 => 233953)


--- branches/safari-606-branch/LayoutTests/fast/css/webkit-mask-crash-fieldset-legend.html	2018-07-19 01:59:42 UTC (rev 233952)
+++ branches/safari-606-branch/LayoutTests/fast/css/webkit-mask-crash-fieldset-legend.html	2018-07-19 01:59:51 UTC (rev 233953)
@@ -11,7 +11,7 @@
 <script>
     if (window.internals) {
         testRunner.dumpAsText();
-        internals.paintControlTints();
+        internals.invalidateControlTints();
     }
 </script>
 Test for <a href="" Crash in RenderBox::paintMaskImages when GraphicsContext's painting is disabled<br>

Modified: branches/safari-606-branch/LayoutTests/fast/css/webkit-mask-crash-figure.html (233952 => 233953)


--- branches/safari-606-branch/LayoutTests/fast/css/webkit-mask-crash-figure.html	2018-07-19 01:59:42 UTC (rev 233952)
+++ branches/safari-606-branch/LayoutTests/fast/css/webkit-mask-crash-figure.html	2018-07-19 01:59:51 UTC (rev 233953)
@@ -11,7 +11,7 @@
 <script>
     if (window.internals) {
         testRunner.dumpAsText();
-        internals.paintControlTints();
+        internals.invalidateControlTints();
     }
 </script>
 Test for <a href="" Crash in RenderBox::paintMaskImages when GraphicsContext's painting is disabled<br>

Modified: branches/safari-606-branch/LayoutTests/fast/css/webkit-mask-crash-table.html (233952 => 233953)


--- branches/safari-606-branch/LayoutTests/fast/css/webkit-mask-crash-table.html	2018-07-19 01:59:42 UTC (rev 233952)
+++ branches/safari-606-branch/LayoutTests/fast/css/webkit-mask-crash-table.html	2018-07-19 01:59:51 UTC (rev 233953)
@@ -11,7 +11,7 @@
 <script>
     if (window.internals) {
         testRunner.dumpAsText();
-        internals.paintControlTints();
+        internals.invalidateControlTints();
     }
 </script>
 Test for <a href="" Crash in RenderBox::paintMaskImages when GraphicsContext's painting is disabled<br>

Modified: branches/safari-606-branch/LayoutTests/fast/css/webkit-mask-crash-td-2.html (233952 => 233953)


--- branches/safari-606-branch/LayoutTests/fast/css/webkit-mask-crash-td-2.html	2018-07-19 01:59:42 UTC (rev 233952)
+++ branches/safari-606-branch/LayoutTests/fast/css/webkit-mask-crash-td-2.html	2018-07-19 01:59:51 UTC (rev 233953)
@@ -9,7 +9,7 @@
 <script>
     if (window.internals) {
         testRunner.dumpAsText();
-        internals.paintControlTints();
+        internals.invalidateControlTints();
     }
 </script>
 Test for <a href="" Crash in RenderBox::paintMaskImages when GraphicsContext's painting is disabled<br>

Modified: branches/safari-606-branch/LayoutTests/fast/css/webkit-mask-crash-td.html (233952 => 233953)


--- branches/safari-606-branch/LayoutTests/fast/css/webkit-mask-crash-td.html	2018-07-19 01:59:42 UTC (rev 233952)
+++ branches/safari-606-branch/LayoutTests/fast/css/webkit-mask-crash-td.html	2018-07-19 01:59:51 UTC (rev 233953)
@@ -13,7 +13,7 @@
 <script>
     if (window.internals) {
         testRunner.dumpAsText();
-        internals.paintControlTints();
+        internals.invalidateControlTints();
     }
 </script>
 Test for <a href="" Crash in RenderBox::paintMaskImages when GraphicsContext's painting is disabled<br>

Modified: branches/safari-606-branch/Source/WebCore/ChangeLog (233952 => 233953)


--- branches/safari-606-branch/Source/WebCore/ChangeLog	2018-07-19 01:59:42 UTC (rev 233952)
+++ branches/safari-606-branch/Source/WebCore/ChangeLog	2018-07-19 01:59:51 UTC (rev 233953)
@@ -1,5 +1,183 @@
 2018-07-18  Babak Shafiei  <[email protected]>
 
+        Cherry-pick r233872. rdar://problem/42345272
+
+    Source/WebCore:
+    [iOS] When bringing MobileSafari to the foreground, images, which are pending decoding, won't be drawn into the flush immediate transaction
+    https://bugs.webkit.org/show_bug.cgi?id=187375
+    
+    Patch by Said Abou-Hallawa <[email protected]> on 2018-07-16
+    Reviewed by Simon Fraser.
+    
+    An immediate-paint transaction should force all the images which are pending
+    decoding to be repainted.
+    
+    To do that, FrameView::paintControlTints() will be re-factored to a new
+    generic function such that it takes PaintInvalidationReasons. The new function
+    which is named 'traverseForPaintInvalidation' will traverse the render tree
+    for a specific PaintInvalidationReasons.
+    
+    invalidateImagesWithAsyncDecodes() will stop the asynchronous decoding for
+    the underlying image and repaint all the clients which are waiting for the
+    decoding to finish.
+    
+    * loader/cache/CachedImage.cpp:
+    (WebCore::CachedImage::didRemoveClient):
+    (WebCore::CachedImage::isClientWaitingForAsyncDecoding const):
+    (WebCore::CachedImage::addClientWaitingForAsyncDecoding):
+    (WebCore::CachedImage::removeAllClientsWaitingForAsyncDecoding):
+    (WebCore::CachedImage::allClientsRemoved):
+    (WebCore::CachedImage::clear):
+    (WebCore::CachedImage::createImage):
+    (WebCore::CachedImage::imageFrameAvailable):
+    (WebCore::CachedImage::addPendingImageDrawingClient): Deleted.
+    * loader/cache/CachedImage.h:
+    * page/FrameView.cpp:
+    (WebCore::FrameView::paintScrollCorner):
+    (WebCore::FrameView::updateControlTints):
+    (WebCore::FrameView::traverseForPaintInvalidation):
+    (WebCore::FrameView::adjustPageHeightDeprecated):
+    (WebCore::FrameView::paintControlTints): Deleted.
+    * page/FrameView.h:
+    * platform/ScrollView.cpp:
+    (WebCore::ScrollView::paint):
+    * platform/Scrollbar.cpp:
+    (WebCore::Scrollbar::paint):
+    * platform/graphics/BitmapImage.h:
+    * platform/graphics/GraphicsContext.cpp:
+    (WebCore::GraphicsContext::GraphicsContext):
+    * platform/graphics/GraphicsContext.h:
+    (WebCore::GraphicsContext::performingPaintInvalidation const):
+    (WebCore::GraphicsContext::invalidatingControlTints const):
+    (WebCore::GraphicsContext::invalidatingImagesWithAsyncDecodes const):
+    (WebCore::GraphicsContext::updatingControlTints const): Deleted.
+    * rendering/RenderBoxModelObject.cpp:
+    (WebCore::RenderBoxModelObject::paintFillLayerExtended):
+    * rendering/RenderImage.cpp:
+    (WebCore::RenderImage::paintReplaced):
+    (WebCore::RenderImage::paintAreaElementFocusRing):
+    (WebCore::RenderImage::paintIntoRect):
+    * rendering/RenderLayer.cpp:
+    (WebCore::RenderLayer::paintScrollCorner):
+    (WebCore::RenderLayer::paintResizer):
+    (WebCore::RenderLayer::paintLayer):
+    * rendering/RenderScrollbar.cpp:
+    (WebCore::RenderScrollbar::paint):
+    * rendering/RenderTheme.cpp:
+    (WebCore::RenderTheme::paint):
+    * testing/Internals.cpp:
+    (WebCore::Internals::invalidateControlTints):
+    (WebCore::Internals::paintControlTints): Deleted.
+    * testing/Internals.h:
+    * testing/Internals.idl:
+    
+    Source/WebKit:
+    [iOS] When bringing MobileSafari to the foreground, images, which are pending decoding, won't be drawn into the immediate-paint transaction
+    https://bugs.webkit.org/show_bug.cgi?id=187375
+    
+    Patch by Said Abou-Hallawa <[email protected]> on 2018-07-16
+    Reviewed by Simon Fraser.
+    
+    For immediate-paint transaction, we should force all the images which are
+    pending decoding to be repainted before building this transaction.
+    
+    * WebProcess/Plugins/PDF/PDFPlugin.mm:
+    (WebKit::PDFPlugin::updateControlTints):
+    * WebProcess/Plugins/PluginView.cpp:
+    (WebKit::PluginView::paint):
+    * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
+    (WebKit::RemoteLayerTreeDrawingArea::flushLayers):
+    
+    LayoutTests:
+    [iOS] When bringing MobileSafari to the foreground, images, which are pending decoding, won't be drawn into the immediate-paint transaction
+    https://bugs.webkit.org/show_bug.cgi?id=187375
+    
+    Patch by Said Abou-Hallawa <[email protected]> on 2018-07-16
+    Reviewed by Simon Fraser.
+    
+    The Internals API paintControlTints() is now renamed to invalidateControlTints()
+    to be consistent with the new enum values and with the new name of the
+    C++ function.
+    
+    * fast/css/webkit-mask-crash-fieldset-legend.html:
+    * fast/css/webkit-mask-crash-figure.html:
+    * fast/css/webkit-mask-crash-table.html:
+    * fast/css/webkit-mask-crash-td-2.html:
+    * fast/css/webkit-mask-crash-td.html:
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233872 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2018-07-16  Said Abou-Hallawa  <[email protected]>
+
+            [iOS] When bringing MobileSafari to the foreground, images, which are pending decoding, won't be drawn into the flush immediate transaction
+            https://bugs.webkit.org/show_bug.cgi?id=187375
+
+            Reviewed by Simon Fraser.
+
+            An immediate-paint transaction should force all the images which are pending
+            decoding to be repainted.
+
+            To do that, FrameView::paintControlTints() will be re-factored to a new
+            generic function such that it takes PaintInvalidationReasons. The new function
+            which is named 'traverseForPaintInvalidation' will traverse the render tree
+            for a specific PaintInvalidationReasons.
+
+            invalidateImagesWithAsyncDecodes() will stop the asynchronous decoding for
+            the underlying image and repaint all the clients which are waiting for the
+            decoding to finish.
+
+            * loader/cache/CachedImage.cpp:
+            (WebCore::CachedImage::didRemoveClient):
+            (WebCore::CachedImage::isClientWaitingForAsyncDecoding const):
+            (WebCore::CachedImage::addClientWaitingForAsyncDecoding):
+            (WebCore::CachedImage::removeAllClientsWaitingForAsyncDecoding):
+            (WebCore::CachedImage::allClientsRemoved):
+            (WebCore::CachedImage::clear):
+            (WebCore::CachedImage::createImage):
+            (WebCore::CachedImage::imageFrameAvailable):
+            (WebCore::CachedImage::addPendingImageDrawingClient): Deleted.
+            * loader/cache/CachedImage.h:
+            * page/FrameView.cpp:
+            (WebCore::FrameView::paintScrollCorner):
+            (WebCore::FrameView::updateControlTints):
+            (WebCore::FrameView::traverseForPaintInvalidation):
+            (WebCore::FrameView::adjustPageHeightDeprecated):
+            (WebCore::FrameView::paintControlTints): Deleted.
+            * page/FrameView.h:
+            * platform/ScrollView.cpp:
+            (WebCore::ScrollView::paint):
+            * platform/Scrollbar.cpp:
+            (WebCore::Scrollbar::paint):
+            * platform/graphics/BitmapImage.h:
+            * platform/graphics/GraphicsContext.cpp:
+            (WebCore::GraphicsContext::GraphicsContext):
+            * platform/graphics/GraphicsContext.h:
+            (WebCore::GraphicsContext::performingPaintInvalidation const):
+            (WebCore::GraphicsContext::invalidatingControlTints const):
+            (WebCore::GraphicsContext::invalidatingImagesWithAsyncDecodes const):
+            (WebCore::GraphicsContext::updatingControlTints const): Deleted.
+            * rendering/RenderBoxModelObject.cpp:
+            (WebCore::RenderBoxModelObject::paintFillLayerExtended):
+            * rendering/RenderImage.cpp:
+            (WebCore::RenderImage::paintReplaced):
+            (WebCore::RenderImage::paintAreaElementFocusRing):
+            (WebCore::RenderImage::paintIntoRect):
+            * rendering/RenderLayer.cpp:
+            (WebCore::RenderLayer::paintScrollCorner):
+            (WebCore::RenderLayer::paintResizer):
+            (WebCore::RenderLayer::paintLayer):
+            * rendering/RenderScrollbar.cpp:
+            (WebCore::RenderScrollbar::paint):
+            * rendering/RenderTheme.cpp:
+            (WebCore::RenderTheme::paint):
+            * testing/Internals.cpp:
+            (WebCore::Internals::invalidateControlTints):
+            (WebCore::Internals::paintControlTints): Deleted.
+            * testing/Internals.h:
+            * testing/Internals.idl:
+
+2018-07-18  Babak Shafiei  <[email protected]>
+
         Cherry-pick r233870. rdar://problem/42344023
 
     Unreviewed attempt to fix the build.

Modified: branches/safari-606-branch/Source/WebCore/loader/cache/CachedImage.cpp (233952 => 233953)


--- branches/safari-606-branch/Source/WebCore/loader/cache/CachedImage.cpp	2018-07-19 01:59:42 UTC (rev 233952)
+++ branches/safari-606-branch/Source/WebCore/loader/cache/CachedImage.cpp	2018-07-19 01:59:51 UTC (rev 233953)
@@ -130,7 +130,7 @@
     ASSERT(client.resourceClientType() == CachedImageClient::expectedType());
 
     m_pendingContainerContextRequests.remove(&static_cast<CachedImageClient&>(client));
-    m_pendingImageDrawingClients.remove(&static_cast<CachedImageClient&>(client));
+    m_clienstWaitingForAsyncDecoding.remove(&static_cast<CachedImageClient&>(client));
 
     if (m_svgImageCache)
         m_svgImageCache->removeClientFromCache(&static_cast<CachedImageClient&>(client));
@@ -140,24 +140,39 @@
     static_cast<CachedImageClient&>(client).didRemoveCachedImageClient(*this);
 }
 
-void CachedImage::addPendingImageDrawingClient(CachedImageClient& client)
+bool CachedImage::isClientWaitingForAsyncDecoding(CachedImageClient& client) const
 {
+    return m_clienstWaitingForAsyncDecoding.contains(&client);
+}
+
+void CachedImage::addClientWaitingForAsyncDecoding(CachedImageClient& client)
+{
     ASSERT(client.resourceClientType() == CachedImageClient::expectedType());
-    if (m_pendingImageDrawingClients.contains(&client))
+    if (m_clienstWaitingForAsyncDecoding.contains(&client))
         return;
     if (!m_clients.contains(&client)) {
         // If the <html> element does not have its own background specified, painting the root box
         // renderer uses the style of the <body> element, see RenderView::rendererForRootBackground().
         // In this case, the client we are asked to add is the root box renderer. Since we can't add
-        // a client to m_pendingImageDrawingClients unless it is one of the m_clients, we are going
+        // a client to m_clienstWaitingForAsyncDecoding unless it is one of the m_clients, we are going
         // to cancel the repaint optimization we do in CachedImage::imageFrameAvailable() by adding
-        // all the m_clients to m_pendingImageDrawingClients.
+        // all the m_clients to m_clienstWaitingForAsyncDecoding.
         CachedResourceClientWalker<CachedImageClient> walker(m_clients);
         while (auto* client = walker.next())
-            m_pendingImageDrawingClients.add(client);
+            m_clienstWaitingForAsyncDecoding.add(client);
     } else
-        m_pendingImageDrawingClients.add(&client);
+        m_clienstWaitingForAsyncDecoding.add(&client);
 }
+    
+void CachedImage::removeAllClientsWaitingForAsyncDecoding()
+{
+    if (m_clienstWaitingForAsyncDecoding.isEmpty() || !hasImage() || !is<BitmapImage>(image()))
+        return;
+    downcast<BitmapImage>(image())->stopAsyncDecodingQueue();
+    for (auto* client : m_clienstWaitingForAsyncDecoding)
+        client->imageChanged(this);
+    m_clienstWaitingForAsyncDecoding.clear();
+}
 
 void CachedImage::switchClientsToRevalidatedResource()
 {
@@ -181,7 +196,7 @@
 void CachedImage::allClientsRemoved()
 {
     m_pendingContainerContextRequests.clear();
-    m_pendingImageDrawingClients.clear();
+    m_clienstWaitingForAsyncDecoding.clear();
     if (m_image && !errorOccurred())
         m_image->resetAnimation();
 }
@@ -323,7 +338,7 @@
     destroyDecodedData();
     clearImage();
     m_pendingContainerContextRequests.clear();
-    m_pendingImageDrawingClients.clear();
+    m_clienstWaitingForAsyncDecoding.clear();
     setEncodedSize(0);
 }
 
@@ -347,7 +362,7 @@
                 setContainerContextForClient(*request.key, request.value.containerSize, request.value.containerZoom, request.value.imageURL);
         }
         m_pendingContainerContextRequests.clear();
-        m_pendingImageDrawingClients.clear();
+        m_clienstWaitingForAsyncDecoding.clear();
     }
 }
 
@@ -612,7 +627,7 @@
 
     while (CachedImageClient* client = clientWalker.next()) {
         // All the clients of animated images have to be notified. The new frame has to be drawn in all of them.
-        if (animatingState == ImageAnimatingState::No && !m_pendingImageDrawingClients.contains(client))
+        if (animatingState == ImageAnimatingState::No && !m_clienstWaitingForAsyncDecoding.contains(client))
             continue;
         if (client->imageFrameAvailable(*this, animatingState, changeRect) == VisibleInViewportState::Yes)
             visibleState = VisibleInViewportState::Yes;
@@ -622,7 +637,7 @@
         m_image->stopAnimation();
 
     if (decodingStatus != DecodingStatus::Partial)
-        m_pendingImageDrawingClients.clear();
+        m_clienstWaitingForAsyncDecoding.clear();
 }
 
 void CachedImage::changedInRect(const Image& image, const IntRect* rect)

Modified: branches/safari-606-branch/Source/WebCore/loader/cache/CachedImage.h (233952 => 233953)


--- branches/safari-606-branch/Source/WebCore/loader/cache/CachedImage.h	2018-07-19 01:59:42 UTC (rev 233952)
+++ branches/safari-606-branch/Source/WebCore/loader/cache/CachedImage.h	2018-07-19 01:59:51 UTC (rev 233953)
@@ -85,7 +85,9 @@
 
     bool isOriginClean(SecurityOrigin*);
 
-    void addPendingImageDrawingClient(CachedImageClient&);
+    bool isClientWaitingForAsyncDecoding(CachedImageClient&) const;
+    void addClientWaitingForAsyncDecoding(CachedImageClient&);
+    void removeAllClientsWaitingForAsyncDecoding();
 
     void setForceUpdateImageDataEnabledForTesting(bool enabled) { m_forceUpdateImageDataEnabledForTesting =  enabled; }
     
@@ -170,7 +172,7 @@
     using ContainerContextRequests = HashMap<const CachedImageClient*, ContainerContext>;
     ContainerContextRequests m_pendingContainerContextRequests;
 
-    HashSet<CachedImageClient*> m_pendingImageDrawingClients;
+    HashSet<CachedImageClient*> m_clienstWaitingForAsyncDecoding;
 
     RefPtr<CachedImageObserver> m_imageObserver;
     RefPtr<Image> m_image;

Modified: branches/safari-606-branch/Source/WebCore/page/FrameView.cpp (233952 => 233953)


--- branches/safari-606-branch/Source/WebCore/page/FrameView.cpp	2018-07-19 01:59:42 UTC (rev 233952)
+++ branches/safari-606-branch/Source/WebCore/page/FrameView.cpp	2018-07-19 01:59:51 UTC (rev 233953)
@@ -3869,7 +3869,7 @@
 
 void FrameView::paintScrollCorner(GraphicsContext& context, const IntRect& cornerRect)
 {
-    if (context.updatingControlTints()) {
+    if (context.invalidatingControlTints()) {
         updateScrollCorner();
         return;
     }
@@ -4006,18 +4006,18 @@
 
     RenderView* renderView = this->renderView();
     if ((renderView && renderView->theme().supportsControlTints()) || hasCustomScrollbars())
-        paintControlTints();
+        invalidateControlTints();
 
     if (page)
         page->setIsCountingRelevantRepaintedObjects(isCurrentlyCountingRelevantRepaintedObject);
 }
 
-void FrameView::paintControlTints()
+void FrameView::traverseForPaintInvalidation(GraphicsContext::PaintInvalidationReasons paintInvalidationReasons)
 {
     if (needsLayout())
         layoutContext().layout();
 
-    GraphicsContext context(GraphicsContext::NonPaintingReasons::UpdatingControlTints);
+    GraphicsContext context(paintInvalidationReasons);
     if (platformWidget()) {
         // FIXME: consult paintsEntireContents().
         paintContents(context, visibleContentRect(LegacyIOSDocumentVisibleRect));
@@ -4486,7 +4486,7 @@
 
     }
     // Use a context with painting disabled.
-    GraphicsContext context(GraphicsContext::NonPaintingReasons::NoReasons);
+    GraphicsContext context(GraphicsContext::PaintInvalidationReasons::None);
     renderView->setTruncatedAt(static_cast<int>(floorf(oldBottom)));
     IntRect dirtyRect(0, static_cast<int>(floorf(oldTop)), renderView->layoutOverflowRect().maxX(), static_cast<int>(ceilf(oldBottom - oldTop)));
     renderView->setPrintRect(dirtyRect);

Modified: branches/safari-606-branch/Source/WebCore/page/FrameView.h (233952 => 233953)


--- branches/safari-606-branch/Source/WebCore/page/FrameView.h	2018-07-19 01:59:42 UTC (rev 233952)
+++ branches/safari-606-branch/Source/WebCore/page/FrameView.h	2018-07-19 01:59:51 UTC (rev 233953)
@@ -28,6 +28,7 @@
 #include "Color.h"
 #include "ContainerNode.h"
 #include "FrameViewLayoutContext.h"
+#include "GraphicsContext.h"
 #include "LayoutMilestones.h"
 #include "LayoutRect.h"
 #include "Pagination.h"
@@ -639,6 +640,10 @@
 
     WEBCORE_EXPORT FrameFlattening effectiveFrameFlattening() const;
 
+    WEBCORE_EXPORT void traverseForPaintInvalidation(GraphicsContext::PaintInvalidationReasons);
+    void invalidateControlTints() { traverseForPaintInvalidation(GraphicsContext::PaintInvalidationReasons::InvalidatingControlTints); }
+    void invalidateImagesWithAsyncDecodes() { traverseForPaintInvalidation(GraphicsContext::PaintInvalidationReasons::InvalidatingImagesWithAsyncDecodes); }
+
 protected:
     bool scrollContentsFastPath(const IntSize& scrollDelta, const IntRect& rectToScroll, const IntRect& clipRect) final;
     void scrollContentsSlowPath(const IntRect& updateRect) final;
@@ -682,8 +687,6 @@
 
     void updateOverflowStatus(bool horizontalOverflow, bool verticalOverflow);
 
-    WEBCORE_EXPORT void paintControlTints();
-
     void forceLayoutParentViewIfNeeded();
     void flushPostLayoutTasksQueue();
     void performPostLayoutTasks();

Modified: branches/safari-606-branch/Source/WebCore/platform/ScrollView.cpp (233952 => 233953)


--- branches/safari-606-branch/Source/WebCore/platform/ScrollView.cpp	2018-07-19 01:59:42 UTC (rev 233952)
+++ branches/safari-606-branch/Source/WebCore/platform/ScrollView.cpp	2018-07-19 01:59:51 UTC (rev 233953)
@@ -1167,7 +1167,7 @@
         return;
     }
 
-    if (context.paintingDisabled() && !context.updatingControlTints())
+    if (context.paintingDisabled() && !context.performingPaintInvalidation())
         return;
 
     notifyPageThatContentAreaWillPaint();

Modified: branches/safari-606-branch/Source/WebCore/platform/Scrollbar.cpp (233952 => 233953)


--- branches/safari-606-branch/Source/WebCore/platform/Scrollbar.cpp	2018-07-19 01:59:42 UTC (rev 233952)
+++ branches/safari-606-branch/Source/WebCore/platform/Scrollbar.cpp	2018-07-19 01:59:51 UTC (rev 233953)
@@ -158,7 +158,7 @@
 
 void Scrollbar::paint(GraphicsContext& context, const IntRect& damageRect, Widget::SecurityOriginPaintPolicy)
 {
-    if (context.updatingControlTints() && theme().supportsControlTints()) {
+    if (context.invalidatingControlTints() && theme().supportsControlTints()) {
         invalidate();
         return;
     }

Modified: branches/safari-606-branch/Source/WebCore/platform/graphics/BitmapImage.h (233952 => 233953)


--- branches/safari-606-branch/Source/WebCore/platform/graphics/BitmapImage.h	2018-07-19 01:59:42 UTC (rev 233952)
+++ branches/safari-606-branch/Source/WebCore/platform/graphics/BitmapImage.h	2018-07-19 01:59:51 UTC (rev 233953)
@@ -109,6 +109,7 @@
     void setClearDecoderAfterAsyncFrameRequestForTesting(bool value) { m_clearDecoderAfterAsyncFrameRequestForTesting = value; }
     void setLargeImageAsyncDecodingEnabledForTesting(bool enabled) { m_largeImageAsyncDecodingEnabledForTesting = enabled; }
     bool isLargeImageAsyncDecodingEnabledForTesting() const { return m_largeImageAsyncDecodingEnabledForTesting; }
+    void stopAsyncDecodingQueue() { m_source->stopAsyncDecodingQueue(); }
 
     WEBCORE_EXPORT unsigned decodeCountForTesting() const;
 

Modified: branches/safari-606-branch/Source/WebCore/platform/graphics/GraphicsContext.cpp (233952 => 233953)


--- branches/safari-606-branch/Source/WebCore/platform/graphics/GraphicsContext.cpp	2018-07-19 01:59:42 UTC (rev 233952)
+++ branches/safari-606-branch/Source/WebCore/platform/graphics/GraphicsContext.cpp	2018-07-19 01:59:51 UTC (rev 233953)
@@ -326,8 +326,8 @@
     return ts;
 }
 
-GraphicsContext::GraphicsContext(NonPaintingReasons nonPaintingReasons)
-    : m_nonPaintingReasons(nonPaintingReasons)
+GraphicsContext::GraphicsContext(PaintInvalidationReasons paintInvalidationReasons)
+    : m_paintInvalidationReasons(paintInvalidationReasons)
 {
 }
 

Modified: branches/safari-606-branch/Source/WebCore/platform/graphics/GraphicsContext.h (233952 => 233953)


--- branches/safari-606-branch/Source/WebCore/platform/graphics/GraphicsContext.h	2018-07-19 01:59:42 UTC (rev 233952)
+++ branches/safari-606-branch/Source/WebCore/platform/graphics/GraphicsContext.h	2018-07-19 01:59:51 UTC (rev 233953)
@@ -267,17 +267,20 @@
     GraphicsContext() = default;
     WEBCORE_EXPORT ~GraphicsContext();
     
-    enum class NonPaintingReasons {
-        NoReasons,
-        UpdatingControlTints
+    enum class PaintInvalidationReasons : uint8_t {
+        None,
+        InvalidatingControlTints,
+        InvalidatingImagesWithAsyncDecodes
     };
-    GraphicsContext(NonPaintingReasons);
+    GraphicsContext(PaintInvalidationReasons);
 
     WEBCORE_EXPORT bool hasPlatformContext() const;
     WEBCORE_EXPORT PlatformGraphicsContext* platformContext() const;
 
     bool paintingDisabled() const { return !m_data && !m_impl; }
-    bool updatingControlTints() const { return m_nonPaintingReasons == NonPaintingReasons::UpdatingControlTints; }
+    bool performingPaintInvalidation() const { return m_paintInvalidationReasons != PaintInvalidationReasons::None; }
+    bool invalidatingControlTints() const { return m_paintInvalidationReasons == PaintInvalidationReasons::InvalidatingControlTints; }
+    bool invalidatingImagesWithAsyncDecodes() const { return m_paintInvalidationReasons == PaintInvalidationReasons::InvalidatingImagesWithAsyncDecodes; }
 
     void setStrokeThickness(float);
     float strokeThickness() const { return m_state.strokeThickness; }
@@ -638,7 +641,7 @@
     GraphicsContextState m_state;
     Vector<GraphicsContextState, 1> m_stack;
 
-    const NonPaintingReasons m_nonPaintingReasons { NonPaintingReasons::NoReasons };
+    const PaintInvalidationReasons m_paintInvalidationReasons { PaintInvalidationReasons::None };
     unsigned m_transparencyCount { 0 };
 };
 

Modified: branches/safari-606-branch/Source/WebCore/rendering/RenderBoxModelObject.cpp (233952 => 233953)


--- branches/safari-606-branch/Source/WebCore/rendering/RenderBoxModelObject.cpp	2018-07-19 01:59:42 UTC (rev 233952)
+++ branches/safari-606-branch/Source/WebCore/rendering/RenderBoxModelObject.cpp	2018-07-19 01:59:51 UTC (rev 233953)
@@ -757,6 +757,12 @@
     StyleImage* bgImage = bgLayer.image();
     bool shouldPaintBackgroundImage = bgImage && bgImage->canRender(this, style().effectiveZoom());
     
+    if (context.invalidatingImagesWithAsyncDecodes()) {
+        if (shouldPaintBackgroundImage && bgImage->cachedImage()->isClientWaitingForAsyncDecoding(*this))
+            bgImage->cachedImage()->removeAllClientsWaitingForAsyncDecoding();
+        return;
+    }
+    
     bool forceBackgroundToWhite = false;
     if (document().printing()) {
         if (style().printColorAdjust() == PrintColorAdjust::Economy)
@@ -978,7 +984,7 @@
             auto drawResult = context.drawTiledImage(*image, geometry.destRect(), toLayoutPoint(geometry.relativePhase()), geometry.tileSize(), geometry.spaceSize(), ImagePaintingOptions(compositeOp, bgLayer.blendMode(), decodingMode, ImageOrientationDescription(), interpolation));
             if (drawResult == ImageDrawResult::DidRequestDecoding) {
                 ASSERT(bgImage->isCachedImage());
-                bgImage->cachedImage()->addPendingImageDrawingClient(*this);
+                bgImage->cachedImage()->addClientWaitingForAsyncDecoding(*this);
             }
         }
     }

Modified: branches/safari-606-branch/Source/WebCore/rendering/RenderImage.cpp (233952 => 233953)


--- branches/safari-606-branch/Source/WebCore/rendering/RenderImage.cpp	2018-07-19 01:59:42 UTC (rev 233952)
+++ branches/safari-606-branch/Source/WebCore/rendering/RenderImage.cpp	2018-07-19 01:59:51 UTC (rev 233953)
@@ -400,9 +400,14 @@
 
 void RenderImage::paintReplaced(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
 {
+    GraphicsContext& context = paintInfo.context();
+    if (context.invalidatingImagesWithAsyncDecodes()) {
+        if (cachedImage() && cachedImage()->isClientWaitingForAsyncDecoding(*this))
+            cachedImage()->removeAllClientsWaitingForAsyncDecoding();
+        return;
+    }
+
     auto contentSize = this->contentSize();
-
-    GraphicsContext& context = paintInfo.context();
     float deviceScaleFactor = document().deviceScaleFactor();
     LayoutUnit missingImageBorderWidth(1 / deviceScaleFactor);
 
@@ -532,7 +537,7 @@
     if (document().printing() || !frame().selection().isFocusedAndActive())
         return;
     
-    if (paintInfo.context().paintingDisabled() && !paintInfo.context().updatingControlTints())
+    if (paintInfo.context().paintingDisabled() && !paintInfo.context().performingPaintInvalidation())
         return;
 
     Element* focusedElement = document().focusedElement();
@@ -614,7 +619,7 @@
     auto decodingMode = decodingModeForImageDraw(*image, paintInfo);
     auto drawResult = paintInfo.context().drawImage(*img, rect, ImagePaintingOptions(compositeOperator, BlendModeNormal, decodingMode, orientationDescription, interpolation));
     if (drawResult == ImageDrawResult::DidRequestDecoding)
-        imageResource().cachedImage()->addPendingImageDrawingClient(*this);
+        imageResource().cachedImage()->addClientWaitingForAsyncDecoding(*this);
 
 #if USE(SYSTEM_PREVIEW)
     if (imageElement && imageElement->isSystemPreviewImage() && drawResult == ImageDrawResult::DidDraw && RuntimeEnabledFeatures::sharedFeatures().systemPreviewEnabled())

Modified: branches/safari-606-branch/Source/WebCore/rendering/RenderLayer.cpp (233952 => 233953)


--- branches/safari-606-branch/Source/WebCore/rendering/RenderLayer.cpp	2018-07-19 01:59:42 UTC (rev 233952)
+++ branches/safari-606-branch/Source/WebCore/rendering/RenderLayer.cpp	2018-07-19 01:59:51 UTC (rev 233953)
@@ -3700,7 +3700,7 @@
     if (!absRect.intersects(damageRect))
         return;
 
-    if (context.updatingControlTints()) {
+    if (context.invalidatingControlTints()) {
         updateScrollCornerStyle();
         return;
     }
@@ -3760,7 +3760,7 @@
     if (!absRect.intersects(damageRect))
         return;
 
-    if (context.updatingControlTints()) {
+    if (context.invalidatingControlTints()) {
         updateResizerStyle();
         return;
     }
@@ -3965,9 +3965,9 @@
 void RenderLayer::paintLayer(GraphicsContext& context, const LayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags)
 {
     if (isComposited()) {
-        // The updatingControlTints() painting pass goes through compositing layers,
+        // The performingPaintInvalidation() painting pass goes through compositing layers,
         // but we need to ensure that we don't cache clip rects computed with the wrong root in this case.
-        if (context.updatingControlTints() || (paintingInfo.paintBehavior & PaintBehaviorFlattenCompositingLayers))
+        if (context.performingPaintInvalidation() || (paintingInfo.paintBehavior & PaintBehaviorFlattenCompositingLayers))
             paintFlags |= PaintLayerTemporaryClipRects;
         else if (!backing()->paintsIntoWindow()
             && !backing()->paintsIntoCompositedAncestor()

Modified: branches/safari-606-branch/Source/WebCore/rendering/RenderScrollbar.cpp (233952 => 233953)


--- branches/safari-606-branch/Source/WebCore/rendering/RenderScrollbar.cpp	2018-07-19 01:59:42 UTC (rev 233952)
+++ branches/safari-606-branch/Source/WebCore/rendering/RenderScrollbar.cpp	2018-07-19 01:59:51 UTC (rev 233953)
@@ -102,7 +102,7 @@
 
 void RenderScrollbar::paint(GraphicsContext& context, const IntRect& damageRect, Widget::SecurityOriginPaintPolicy)
 {
-    if (context.updatingControlTints()) {
+    if (context.invalidatingControlTints()) {
         updateScrollbarParts();
         return;
     }

Modified: branches/safari-606-branch/Source/WebCore/rendering/RenderTheme.cpp (233952 => 233953)


--- branches/safari-606-branch/Source/WebCore/rendering/RenderTheme.cpp	2018-07-19 01:59:42 UTC (rev 233952)
+++ branches/safari-606-branch/Source/WebCore/rendering/RenderTheme.cpp	2018-07-19 01:59:51 UTC (rev 233953)
@@ -275,7 +275,7 @@
     // If painting is disabled, but we aren't updating control tints, then just bail.
     // If we are updating control tints, just schedule a repaint if the theme supports tinting
     // for that control.
-    if (paintInfo.context().updatingControlTints()) {
+    if (paintInfo.context().invalidatingControlTints()) {
         if (controlSupportsTints(box))
             box.repaint();
         return false;

Modified: branches/safari-606-branch/Source/WebCore/testing/Internals.cpp (233952 => 233953)


--- branches/safari-606-branch/Source/WebCore/testing/Internals.cpp	2018-07-19 01:59:42 UTC (rev 233952)
+++ branches/safari-606-branch/Source/WebCore/testing/Internals.cpp	2018-07-19 01:59:51 UTC (rev 233953)
@@ -1810,13 +1810,13 @@
     return String { downcast<HTMLFormControlElement>(element).autofillData().fieldName };
 }
 
-ExceptionOr<void> Internals::paintControlTints()
+ExceptionOr<void> Internals::invalidateControlTints()
 {
     Document* document = contextDocument();
     if (!document || !document->view())
         return Exception { InvalidAccessError };
 
-    document->view()->paintControlTints();
+    document->view()->invalidateControlTints();
     return { };
 }
 

Modified: branches/safari-606-branch/Source/WebCore/testing/Internals.h (233952 => 233953)


--- branches/safari-606-branch/Source/WebCore/testing/Internals.h	2018-07-19 01:59:42 UTC (rev 233952)
+++ branches/safari-606-branch/Source/WebCore/testing/Internals.h	2018-07-19 01:59:51 UTC (rev 233953)
@@ -253,7 +253,7 @@
 
     ExceptionOr<String> autofillFieldName(Element&);
 
-    ExceptionOr<void> paintControlTints();
+    ExceptionOr<void> invalidateControlTints();
 
     RefPtr<Range> rangeFromLocationAndLength(Element& scope, int rangeLocation, int rangeLength);
     unsigned locationFromRange(Element& scope, const Range&);

Modified: branches/safari-606-branch/Source/WebCore/testing/Internals.idl (233952 => 233953)


--- branches/safari-606-branch/Source/WebCore/testing/Internals.idl	2018-07-19 01:59:42 UTC (rev 233952)
+++ branches/safari-606-branch/Source/WebCore/testing/Internals.idl	2018-07-19 01:59:51 UTC (rev 233953)
@@ -237,7 +237,7 @@
 
     [MayThrowException] DOMString autofillFieldName(Element formControlElement);
 
-    [MayThrowException] void paintControlTints();
+    [MayThrowException] void invalidateControlTints();
 
     [MayThrowException] void scrollElementToRect(Element element, long x, long y, long w, long h);
 

Modified: branches/safari-606-branch/Source/WebKit/ChangeLog (233952 => 233953)


--- branches/safari-606-branch/Source/WebKit/ChangeLog	2018-07-19 01:59:42 UTC (rev 233952)
+++ branches/safari-606-branch/Source/WebKit/ChangeLog	2018-07-19 01:59:51 UTC (rev 233953)
@@ -1,5 +1,131 @@
 2018-07-18  Babak Shafiei  <[email protected]>
 
+        Cherry-pick r233872. rdar://problem/42345272
+
+    Source/WebCore:
+    [iOS] When bringing MobileSafari to the foreground, images, which are pending decoding, won't be drawn into the flush immediate transaction
+    https://bugs.webkit.org/show_bug.cgi?id=187375
+    
+    Patch by Said Abou-Hallawa <[email protected]> on 2018-07-16
+    Reviewed by Simon Fraser.
+    
+    An immediate-paint transaction should force all the images which are pending
+    decoding to be repainted.
+    
+    To do that, FrameView::paintControlTints() will be re-factored to a new
+    generic function such that it takes PaintInvalidationReasons. The new function
+    which is named 'traverseForPaintInvalidation' will traverse the render tree
+    for a specific PaintInvalidationReasons.
+    
+    invalidateImagesWithAsyncDecodes() will stop the asynchronous decoding for
+    the underlying image and repaint all the clients which are waiting for the
+    decoding to finish.
+    
+    * loader/cache/CachedImage.cpp:
+    (WebCore::CachedImage::didRemoveClient):
+    (WebCore::CachedImage::isClientWaitingForAsyncDecoding const):
+    (WebCore::CachedImage::addClientWaitingForAsyncDecoding):
+    (WebCore::CachedImage::removeAllClientsWaitingForAsyncDecoding):
+    (WebCore::CachedImage::allClientsRemoved):
+    (WebCore::CachedImage::clear):
+    (WebCore::CachedImage::createImage):
+    (WebCore::CachedImage::imageFrameAvailable):
+    (WebCore::CachedImage::addPendingImageDrawingClient): Deleted.
+    * loader/cache/CachedImage.h:
+    * page/FrameView.cpp:
+    (WebCore::FrameView::paintScrollCorner):
+    (WebCore::FrameView::updateControlTints):
+    (WebCore::FrameView::traverseForPaintInvalidation):
+    (WebCore::FrameView::adjustPageHeightDeprecated):
+    (WebCore::FrameView::paintControlTints): Deleted.
+    * page/FrameView.h:
+    * platform/ScrollView.cpp:
+    (WebCore::ScrollView::paint):
+    * platform/Scrollbar.cpp:
+    (WebCore::Scrollbar::paint):
+    * platform/graphics/BitmapImage.h:
+    * platform/graphics/GraphicsContext.cpp:
+    (WebCore::GraphicsContext::GraphicsContext):
+    * platform/graphics/GraphicsContext.h:
+    (WebCore::GraphicsContext::performingPaintInvalidation const):
+    (WebCore::GraphicsContext::invalidatingControlTints const):
+    (WebCore::GraphicsContext::invalidatingImagesWithAsyncDecodes const):
+    (WebCore::GraphicsContext::updatingControlTints const): Deleted.
+    * rendering/RenderBoxModelObject.cpp:
+    (WebCore::RenderBoxModelObject::paintFillLayerExtended):
+    * rendering/RenderImage.cpp:
+    (WebCore::RenderImage::paintReplaced):
+    (WebCore::RenderImage::paintAreaElementFocusRing):
+    (WebCore::RenderImage::paintIntoRect):
+    * rendering/RenderLayer.cpp:
+    (WebCore::RenderLayer::paintScrollCorner):
+    (WebCore::RenderLayer::paintResizer):
+    (WebCore::RenderLayer::paintLayer):
+    * rendering/RenderScrollbar.cpp:
+    (WebCore::RenderScrollbar::paint):
+    * rendering/RenderTheme.cpp:
+    (WebCore::RenderTheme::paint):
+    * testing/Internals.cpp:
+    (WebCore::Internals::invalidateControlTints):
+    (WebCore::Internals::paintControlTints): Deleted.
+    * testing/Internals.h:
+    * testing/Internals.idl:
+    
+    Source/WebKit:
+    [iOS] When bringing MobileSafari to the foreground, images, which are pending decoding, won't be drawn into the immediate-paint transaction
+    https://bugs.webkit.org/show_bug.cgi?id=187375
+    
+    Patch by Said Abou-Hallawa <[email protected]> on 2018-07-16
+    Reviewed by Simon Fraser.
+    
+    For immediate-paint transaction, we should force all the images which are
+    pending decoding to be repainted before building this transaction.
+    
+    * WebProcess/Plugins/PDF/PDFPlugin.mm:
+    (WebKit::PDFPlugin::updateControlTints):
+    * WebProcess/Plugins/PluginView.cpp:
+    (WebKit::PluginView::paint):
+    * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
+    (WebKit::RemoteLayerTreeDrawingArea::flushLayers):
+    
+    LayoutTests:
+    [iOS] When bringing MobileSafari to the foreground, images, which are pending decoding, won't be drawn into the immediate-paint transaction
+    https://bugs.webkit.org/show_bug.cgi?id=187375
+    
+    Patch by Said Abou-Hallawa <[email protected]> on 2018-07-16
+    Reviewed by Simon Fraser.
+    
+    The Internals API paintControlTints() is now renamed to invalidateControlTints()
+    to be consistent with the new enum values and with the new name of the
+    C++ function.
+    
+    * fast/css/webkit-mask-crash-fieldset-legend.html:
+    * fast/css/webkit-mask-crash-figure.html:
+    * fast/css/webkit-mask-crash-table.html:
+    * fast/css/webkit-mask-crash-td-2.html:
+    * fast/css/webkit-mask-crash-td.html:
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233872 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2018-07-16  Said Abou-Hallawa  <[email protected]>
+
+            [iOS] When bringing MobileSafari to the foreground, images, which are pending decoding, won't be drawn into the immediate-paint transaction
+            https://bugs.webkit.org/show_bug.cgi?id=187375
+
+            Reviewed by Simon Fraser.
+
+            For immediate-paint transaction, we should force all the images which are
+            pending decoding to be repainted before building this transaction.
+
+            * WebProcess/Plugins/PDF/PDFPlugin.mm:
+            (WebKit::PDFPlugin::updateControlTints):
+            * WebProcess/Plugins/PluginView.cpp:
+            (WebKit::PluginView::paint):
+            * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
+            (WebKit::RemoteLayerTreeDrawingArea::flushLayers):
+
+2018-07-18  Babak Shafiei  <[email protected]>
+
         Cherry-pick r233869. rdar://problem/42344023
 
     Allow removal of white backgrounds

Modified: branches/safari-606-branch/Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.mm (233952 => 233953)


--- branches/safari-606-branch/Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.mm	2018-07-19 01:59:42 UTC (rev 233952)
+++ branches/safari-606-branch/Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.mm	2018-07-19 01:59:51 UTC (rev 233953)
@@ -1202,7 +1202,7 @@
 
 void PDFPlugin::updateControlTints(GraphicsContext& graphicsContext)
 {
-    ASSERT(graphicsContext.updatingControlTints());
+    ASSERT(graphicsContext.invalidatingControlTints());
 
     if (m_horizontalScrollbar)
         m_horizontalScrollbar->invalidate();

Modified: branches/safari-606-branch/Source/WebKit/WebProcess/Plugins/PluginView.cpp (233952 => 233953)


--- branches/safari-606-branch/Source/WebKit/WebProcess/Plugins/PluginView.cpp	2018-07-19 01:59:42 UTC (rev 233952)
+++ branches/safari-606-branch/Source/WebKit/WebProcess/Plugins/PluginView.cpp	2018-07-19 01:59:51 UTC (rev 233953)
@@ -788,7 +788,7 @@
         return;
 
     if (context.paintingDisabled()) {
-        if (context.updatingControlTints())
+        if (context.invalidatingControlTints())
             m_plugin->updateControlTints(context);
         return;
     }

Modified: branches/safari-606-branch/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm (233952 => 233953)


--- branches/safari-606-branch/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm	2018-07-19 01:59:42 UTC (rev 233952)
+++ branches/safari-606-branch/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm	2018-07-19 01:59:51 UTC (rev 233953)
@@ -351,6 +351,9 @@
         }
     } forPhase:kCATransactionPhasePostCommit];
 
+    if (m_nextFlushIsForImmediatePaint)
+        m_webPage.mainFrameView()->invalidateImagesWithAsyncDecodes();
+
     m_webPage.mainFrameView()->flushCompositingStateIncludingSubframes();
 
     // Because our view-relative overlay root layer is not attached to the FrameView's GraphicsLayer tree, we need to flush it manually.
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to