[webkit-changes] [WebKit/WebKit] 05fc19: iOS: Duplicate WebGL content after switching away ...

Kimmo Kinnunen noreply at github.com
Mon May 8 10:32:10 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 05fc19839037c4e09946ed54a19b4a1ea5820d9b
      https://github.com/WebKit/WebKit/commit/05fc19839037c4e09946ed54a19b4a1ea5820d9b
  Author: Kimmo Kinnunen <kkinnunen at apple.com>
  Date:   2023-05-08 (Mon, 08 May 2023)

  Changed paths:
    M Source/WebCore/page/LocalFrameView.cpp
    M Source/WebCore/platform/graphics/GraphicsLayerClient.h
    M Source/WebCore/platform/graphics/ca/TileGrid.cpp
    M Source/WebCore/platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm
    M Source/WebCore/platform/graphics/mac/WebLayer.mm
    M Source/WebCore/rendering/PaintPhase.h
    M Source/WebCore/rendering/RenderBoxModelObject.cpp
    M Source/WebCore/rendering/RenderLayer.cpp
    M Source/WebCore/rendering/RenderLayerBacking.cpp
    M Source/WebCore/rendering/RenderWidget.cpp
    M Source/WebKit/Shared/RemoteLayerTree/RemoteLayerBackingStore.mm
    M Source/WebKitLegacy/mac/WebView/WebFrame.mm

  Log Message:
  -----------
  iOS: Duplicate WebGL content after switching away from Safari and coming back
https://bugs.webkit.org/show_bug.cgi?id=256039
rdar://87609216

Reviewed by Simon Fraser.

Minimizing to Dock (macOS) or going to home screen (iOS) would suspend
the page and discard decoded images. After coming back to the view,
the view compositing context would be marked as
nextRenderingUpdateRequiresSynchronousImageDecoding. This is done
in order to obtain full image of the loaded page with images.

This "paint images with synchronous image decode" would be implemented
with GraphicsLayerPaintBehavior::Snapshot. This would trigger
WebCore::PaintBehavior::Snapshotting. However, in painting,
Snapshotting would serve two purposes:
  1) Draw composited content for snapshot-like behavior
  2) Force the synchronous image decode.

This would mean that WebGL or Video would be painted to the background
layer, since the element would think the paint would be in snapshot-like
state whenever the intention is to force the synchronous image decoding.

Snapshot-like behavior is following:
 - The whole render tree is painted from root down, visiting all content
   in all render layers, including those typically painted to compositing
   layers
 - The paint is intended for external use, so it is "one shot only".
   This means the content, including the images, must be painted.
 - The paint should not modify the paint state related to the real
   compositing paint state.

Instead:
Remove GraphicsLayerPaintBehavior::Snapshot, GraphicsLayers are never
drawn in snapshot-like manner. GraphicsLayers are painted per graphics
layer, even in renderInContext case. Use
GraphicsLayerPaintBehavior::ForceSynchronousImageDecode to signify that
the image content has to end up painted by the paint

Rename GraphicsLayerPaintBehaviorFirstTilePaint to
GraphicsLayerPaintBehavior::DefaultAsynchronousImageDecode.
"FirstTilePaint" is not a "paint behavior". This was used to signify
"paint fast since this is first paint, do not decode images even if
they are in the viewport unless they're marked as sync decode".

Add corresponding WebCore::PaintBehavior flags, with corresponding
rationale. WebCore::PaintBehavior::Snapshotting is preserved for now.
This also should be removed, as it is not "paint behavior", it is "paint
reason". In future patches it should possibly be defined in terms of
real paint behaviors, namely FlattenCompositingLayers,
ForceSynchronousImageDecode.

* Source/WebCore/display/compositing/DisplayLayerController.cpp:
(WebCore::Display::LayerController::RootLayerClient::paintContents):
* Source/WebCore/display/compositing/DisplayLayerController.h:
* Source/WebCore/page/LocalFrameView.cpp:
(WebCore::LocalFrameView::willPaintContents):
* Source/WebCore/page/PageOverlayController.cpp:
(WebCore::PageOverlayController::paintContents):
* Source/WebCore/page/PageOverlayController.h:
* Source/WebCore/page/linux/ResourceUsageOverlayLinux.cpp:
* Source/WebCore/platform/graphics/GraphicsLayer.cpp:
(WebCore::GraphicsLayer::paintGraphicsLayerContents):
* Source/WebCore/platform/graphics/GraphicsLayer.h:
(WebCore::GraphicsLayer::paintGraphicsLayerContents):
* Source/WebCore/platform/graphics/GraphicsLayerClient.h:
(WebCore::GraphicsLayerClient::paintContents):
(): Deleted.
* Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayerCA::platformCALayerPaintContents):
* Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h:
* Source/WebCore/platform/graphics/ca/PlatformCALayer.h:
* Source/WebCore/platform/graphics/ca/PlatformCALayerClient.h:
* Source/WebCore/platform/graphics/ca/TileCoverageMap.cpp:
(WebCore::TileCoverageMap::platformCALayerPaintContents):
* Source/WebCore/platform/graphics/ca/TileCoverageMap.h:
* Source/WebCore/platform/graphics/ca/TileGrid.cpp:
(WebCore::TileGrid::platformCALayerPaintContents):
* Source/WebCore/platform/graphics/ca/TileGrid.h:
* Source/WebCore/platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
(WebCore::PlatformCALayer::drawLayerContents):
* Source/WebCore/platform/graphics/mac/WebLayer.mm:
(-[WebLayer drawInContext:]):
(-[WebSimpleLayer drawInContext:]):
* Source/WebCore/platform/mac/DataDetectorHighlight.h:
* Source/WebCore/platform/mac/DataDetectorHighlight.mm:
(WebCore::DataDetectorHighlight::paintContents):
* Source/WebCore/rendering/PaintPhase.h:
* Source/WebCore/rendering/RenderBoxModelObject.cpp:
(WebCore::RenderBoxModelObject::decodingModeForImageDraw const):
* Source/WebCore/rendering/RenderLayer.cpp:
(WebCore::RenderLayer::paintLayerContents):
(WebCore::RenderLayer::paintForegroundForFragments):
(WebCore::RenderLayer::calculateClipRects const):
* Source/WebCore/rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::paintContents):
* Source/WebCore/rendering/RenderLayerBacking.h:
* Source/WebCore/rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::paintContents):
* Source/WebCore/rendering/RenderLayerCompositor.h:
* Source/WebCore/rendering/RenderWidget.cpp:
(WebCore::RenderWidget::paintContents):
* Source/WebKit/Shared/RemoteLayerTree/RemoteLayerBackingStore.mm:
(WebKit::RemoteLayerBackingStore::drawInContext):
* Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/LayerTreeHostTextureMapper.cpp:
(WebKit::LayerTreeHost::paintContents):
* Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/LayerTreeHostTextureMapper.h:
* Source/WebKitLegacy/mac/WebView/WebFrame.mm:
(-[WebFrame _drawRect:contentsOnly:]):

Canonical link: https://commits.webkit.org/263803@main




More information about the webkit-changes mailing list