Diff
Added: trunk/LayoutTests/compositing/canvas/hidpi-canvas-backing-store-expected.txt (0 => 295718)
--- trunk/LayoutTests/compositing/canvas/hidpi-canvas-backing-store-expected.txt (rev 0)
+++ trunk/LayoutTests/compositing/canvas/hidpi-canvas-backing-store-expected.txt 2022-06-22 03:12:18 UTC (rev 295718)
@@ -0,0 +1,32 @@
+Tests whether a compositing layer containing only canvas uses a standard DPI backing store.
+
+ (GraphicsLayer
+ (anchor 0.00 0.00)
+ (bounds 1008.00 1095.00)
+ (device scale 2.00)
+ (children 1
+ (GraphicsLayer
+ (bounds 1008.00 1095.00)
+ (contentsOpaque 1)
+ (device scale 2.00)
+ (children 1
+ (GraphicsLayer
+ (position 8.00 50.00)
+ (bounds 1000.00 1004.00)
+ (opacity 0.50)
+ (device scale 2.00)
+ (children 1
+ (GraphicsLayer
+ (anchor 0.00 0.00)
+ (bounds 1000.00 1000.00)
+ (drawsContent 1)
+ (transform [0.50 0.00 0.00 0.00] [0.00 0.50 0.00 0.00] [0.00 0.00 1.00 0.00] [0.00 0.00 0.00 1.00])
+ (device scale 1.00)
+ )
+ )
+ )
+ )
+ )
+ )
+)
+
Added: trunk/LayoutTests/compositing/canvas/hidpi-canvas-backing-store-invalidation-expected.txt (0 => 295718)
--- trunk/LayoutTests/compositing/canvas/hidpi-canvas-backing-store-invalidation-expected.txt (rev 0)
+++ trunk/LayoutTests/compositing/canvas/hidpi-canvas-backing-store-invalidation-expected.txt 2022-06-22 03:12:18 UTC (rev 295718)
@@ -0,0 +1,34 @@
+Tests whether we switch back to a hidpi backing store when rasterized content is added to the canvas layer.
+
+ (GraphicsLayer
+ (anchor 0.00 0.00)
+ (bounds 1008.00 1095.00)
+ (device scale 2.00)
+ (children 1
+ (GraphicsLayer
+ (bounds 1008.00 1095.00)
+ (contentsOpaque 1)
+ (device scale 2.00)
+ (children 1
+ (GraphicsLayer
+ (offsetFromRenderer width=-3 height=-3)
+ (position 5.00 47.00)
+ (bounds 1003.00 1007.00)
+ (opacity 0.50)
+ (device scale 2.00)
+ (children 1
+ (GraphicsLayer
+ (offsetFromRenderer width=-3 height=-3)
+ (anchor 0.00 0.00)
+ (bounds 1006.00 1006.00)
+ (drawsContent 1)
+ (transform [0.50 0.00 0.00 0.00] [0.00 0.50 0.00 0.00] [0.00 0.00 1.00 0.00] [0.00 0.00 0.00 1.00])
+ (device scale 2.00)
+ )
+ )
+ )
+ )
+ )
+ )
+)
+
Added: trunk/LayoutTests/compositing/canvas/hidpi-canvas-backing-store-invalidation.html (0 => 295718)
--- trunk/LayoutTests/compositing/canvas/hidpi-canvas-backing-store-invalidation.html (rev 0)
+++ trunk/LayoutTests/compositing/canvas/hidpi-canvas-backing-store-invalidation.html 2022-06-22 03:12:18 UTC (rev 295718)
@@ -0,0 +1,48 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<meta name="viewport" content="width=device-width, initial-scale=1">
+<script>
+
+if (window.testRunner) {
+ testRunner.dumpAsText();
+ testRunner.waitUntilDone();
+}
+
+function doTest() {
+ var canvasElement = document.getElementById("canvas");
+ let dpr = window.devicePixelRatio || 1;
+
+ canvas.width *= dpr;
+ canvas.height *= dpr;
+
+ canvas.style.transform = "scale(" + 1/dpr + ", " + 1/dpr + ")";
+
+ let ctx = canvas.getContext('2d');
+ ctx.scale(dpr, dpr);
+
+ ctx.fillStyle = 'green';
+ ctx.fillRect(0, 0, 500, 500);
+
+ requestAnimationFrame(function() {
+ canvasElement.style.outline = "black solid 3px";
+ if (window.testRunner) {
+ document.getElementById('layers').innerText = internals.layerTreeAsText(document, internals.LAYER_TREE_INCLUDES_DEVICE_SCALE);
+ testRunner.notifyDone();
+ }
+ });
+}
+
+window.addEventListener('load', doTest, false);
+</script>
+</head>
+
+<body>
+<p> Tests whether we switch back to a hidpi backing store when rasterized content is added to the canvas layer.</p>
+<div style="opacity:0.5">
+<canvas id="canvas" width="500" height="500" style="transform-origin:top left"></canvas>
+</div>
+<pre id="layers">Layer tree goes here in DRT</pre>
+</body>
+
+</html>
Added: trunk/LayoutTests/compositing/canvas/hidpi-canvas-backing-store.html (0 => 295718)
--- trunk/LayoutTests/compositing/canvas/hidpi-canvas-backing-store.html (rev 0)
+++ trunk/LayoutTests/compositing/canvas/hidpi-canvas-backing-store.html 2022-06-22 03:12:18 UTC (rev 295718)
@@ -0,0 +1,45 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<meta name="viewport" content="width=device-width, initial-scale=1">
+<script>
+
+if (window.testRunner) {
+ testRunner.dumpAsText();
+ testRunner.waitUntilDone();
+}
+
+function doTest() {
+ var canvasElement = document.getElementById("canvas");
+ let dpr = window.devicePixelRatio || 1;
+
+ canvas.width *= dpr;
+ canvas.height *= dpr;
+
+ canvas.style.transform = "scale(" + 1/dpr + ", " + 1/dpr + ")";
+
+ let ctx = canvas.getContext('2d');
+ ctx.scale(dpr, dpr);
+
+ ctx.fillStyle = 'green';
+ ctx.fillRect(0, 0, 500, 500);
+
+ if (window.testRunner) {
+ document.getElementById('layers').innerText = internals.layerTreeAsText(document, internals.LAYER_TREE_INCLUDES_DEVICE_SCALE);
+ testRunner.notifyDone();
+ }
+}
+
+window.addEventListener('load', doTest, false);
+</script>
+</head>
+
+<body>
+<p> Tests whether a compositing layer containing only canvas uses a standard DPI backing store.</p>
+<div style="opacity:0.5">
+<canvas id="canvas" width="500" height="500" style="transform-origin:top left"></canvas>
+</div>
+<pre id="layers">Layer tree goes here in DRT</pre>
+</body>
+
+</html>
Added: trunk/LayoutTests/compositing/hidpi-image-backing-store-expected.txt (0 => 295718)
--- trunk/LayoutTests/compositing/hidpi-image-backing-store-expected.txt (rev 0)
+++ trunk/LayoutTests/compositing/hidpi-image-backing-store-expected.txt 2022-06-22 03:12:18 UTC (rev 295718)
@@ -0,0 +1,23 @@
+Tests whether a compositing layer containing only an image uses a standard DPI backing store.
+
+
+(GraphicsLayer
+ (anchor 0.00 0.00)
+ (bounds 800.00 600.00)
+ (device scale 2.00)
+ (children 1
+ (GraphicsLayer
+ (bounds 800.00 600.00)
+ (contentsOpaque 1)
+ (device scale 2.00)
+ (children 1
+ (GraphicsLayer
+ (position 8.00 50.00)
+ (bounds 150.00 150.00)
+ (device scale 2.00)
+ )
+ )
+ )
+ )
+)
+
Added: trunk/LayoutTests/compositing/hidpi-image-backing-store-scaled-expected.txt (0 => 295718)
--- trunk/LayoutTests/compositing/hidpi-image-backing-store-scaled-expected.txt (rev 0)
+++ trunk/LayoutTests/compositing/hidpi-image-backing-store-scaled-expected.txt 2022-06-22 03:12:18 UTC (rev 295718)
@@ -0,0 +1,23 @@
+Tests whether a compositing layer containing only an image uses a standard DPI backing store.
+
+
+(GraphicsLayer
+ (anchor 0.00 0.00)
+ (bounds 800.00 600.00)
+ (device scale 2.00)
+ (children 1
+ (GraphicsLayer
+ (bounds 800.00 600.00)
+ (contentsOpaque 1)
+ (device scale 2.00)
+ (children 1
+ (GraphicsLayer
+ (position 8.00 50.00)
+ (bounds 200.00 150.00)
+ (device scale 2.00)
+ )
+ )
+ )
+ )
+)
+
Added: trunk/LayoutTests/compositing/hidpi-image-backing-store-scaled.html (0 => 295718)
--- trunk/LayoutTests/compositing/hidpi-image-backing-store-scaled.html (rev 0)
+++ trunk/LayoutTests/compositing/hidpi-image-backing-store-scaled.html 2022-06-22 03:12:18 UTC (rev 295718)
@@ -0,0 +1,33 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<meta name="viewport" content="width=device-width, initial-scale=1">
+<script>
+
+if (window.testRunner) {
+ testRunner.dumpAsText();
+ testRunner.waitUntilDone();
+}
+
+function doTest() {
+ document.getElementById('layers').innerText = internals.layerTreeAsText(document, internals.LAYER_TREE_INCLUDES_DEVICE_SCALE);
+ testRunner.notifyDone();
+}
+
+function loadImage() {
+ let img = document.getElementById('image');
+ img._onload_ = doTest;
+ img.src = ""
+}
+
+window.addEventListener('load', loadImage, false);
+</script>
+</head>
+
+<body>
+<p> Tests whether a compositing layer containing only an image uses a standard DPI backing store.</p>
+<img id="image" style="transform: translateZ(0px); width: 200px; height: 150px"></img>
+<pre id="layers">Layer tree goes here in DRT</pre>
+</body>
+
+</html>
Added: trunk/LayoutTests/compositing/hidpi-image-backing-store.html (0 => 295718)
--- trunk/LayoutTests/compositing/hidpi-image-backing-store.html (rev 0)
+++ trunk/LayoutTests/compositing/hidpi-image-backing-store.html 2022-06-22 03:12:18 UTC (rev 295718)
@@ -0,0 +1,27 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+<meta name="viewport" content="width=device-width, initial-scale=1">
+<script>
+
+if (window.testRunner) {
+ testRunner.dumpAsText();
+ testRunner.waitUntilDone();
+}
+
+function doTest() {
+ document.getElementById('layers').innerText = internals.layerTreeAsText(document, internals.LAYER_TREE_INCLUDES_DEVICE_SCALE);
+ testRunner.notifyDone();
+}
+
+window.addEventListener('load', doTest, false);
+</script>
+</head>
+
+<body>
+<p> Tests whether a compositing layer containing only an image uses a standard DPI backing store.</p>
+<img src="" style="transform: translateZ(0px);"></img>
+<pre id="layers">Layer tree goes here in DRT</pre>
+</body>
+
+</html>
Added: trunk/LayoutTests/platform/gtk/compositing/canvas/hidpi-canvas-backing-store-expected.txt (0 => 295718)
--- trunk/LayoutTests/platform/gtk/compositing/canvas/hidpi-canvas-backing-store-expected.txt (rev 0)
+++ trunk/LayoutTests/platform/gtk/compositing/canvas/hidpi-canvas-backing-store-expected.txt 2022-06-22 03:12:18 UTC (rev 295718)
@@ -0,0 +1,3 @@
+Tests whether a compositing layer containing only canvas uses a standard DPI backing store.
+
+
Added: trunk/LayoutTests/platform/gtk/compositing/canvas/hidpi-canvas-backing-store-invalidation-expected.txt (0 => 295718)
--- trunk/LayoutTests/platform/gtk/compositing/canvas/hidpi-canvas-backing-store-invalidation-expected.txt (rev 0)
+++ trunk/LayoutTests/platform/gtk/compositing/canvas/hidpi-canvas-backing-store-invalidation-expected.txt 2022-06-22 03:12:18 UTC (rev 295718)
@@ -0,0 +1,3 @@
+Tests whether we switch back to a hidpi backing store when rasterized content is added to the canvas layer.
+
+
Added: trunk/LayoutTests/platform/gtk/compositing/hidpi-image-backing-store-expected.txt (0 => 295718)
--- trunk/LayoutTests/platform/gtk/compositing/hidpi-image-backing-store-expected.txt (rev 0)
+++ trunk/LayoutTests/platform/gtk/compositing/hidpi-image-backing-store-expected.txt 2022-06-22 03:12:18 UTC (rev 295718)
@@ -0,0 +1,20 @@
+Tests whether a compositing layer containing only an image uses a standard DPI backing store.
+
+
+(GraphicsLayer
+ (anchor 0.00 0.00)
+ (bounds 800.00 600.00)
+ (children 1
+ (GraphicsLayer
+ (bounds 800.00 600.00)
+ (contentsOpaque 1)
+ (children 1
+ (GraphicsLayer
+ (position 8.00 50.00)
+ (bounds 150.00 150.00)
+ )
+ )
+ )
+ )
+)
+
Added: trunk/LayoutTests/platform/gtk/compositing/hidpi-image-backing-store-scaled-expected.txt (0 => 295718)
--- trunk/LayoutTests/platform/gtk/compositing/hidpi-image-backing-store-scaled-expected.txt (rev 0)
+++ trunk/LayoutTests/platform/gtk/compositing/hidpi-image-backing-store-scaled-expected.txt 2022-06-22 03:12:18 UTC (rev 295718)
@@ -0,0 +1,20 @@
+Tests whether a compositing layer containing only an image uses a standard DPI backing store.
+
+
+(GraphicsLayer
+ (anchor 0.00 0.00)
+ (bounds 800.00 600.00)
+ (children 1
+ (GraphicsLayer
+ (bounds 800.00 600.00)
+ (contentsOpaque 1)
+ (children 1
+ (GraphicsLayer
+ (position 8.00 50.00)
+ (bounds 200.00 150.00)
+ )
+ )
+ )
+ )
+)
+
Modified: trunk/LayoutTests/platform/ios-wk2/TestExpectations (295717 => 295718)
--- trunk/LayoutTests/platform/ios-wk2/TestExpectations 2022-06-22 03:09:26 UTC (rev 295717)
+++ trunk/LayoutTests/platform/ios-wk2/TestExpectations 2022-06-22 03:12:18 UTC (rev 295718)
@@ -2230,3 +2230,11 @@
http/tests/workers/service/shownotification-allowed.html [ Skip ]
http/tests/workers/service/shownotification-denied.html [ Skip ]
http/tests/workers/service/shownotification-invalid-data.html [ Skip ]
+
+# Tests that fail due to antialiasing differences between scaling layers vs scaling during painting
+imported/w3c/web-platform-tests/html/canvas/element/manual/drawing-images-to-the-canvas/image-orientation/drawImage-from-bitmap-swap-width-height.tentative.html [ ImageOnlyFailure ]
+imported/w3c/web-platform-tests/html/canvas/element/manual/drawing-images-to-the-canvas/image-orientation/drawImage-from-bitmap.tentative.html [ ImageOnlyFailure ]
+imported/w3c/web-platform-tests/html/canvas/element/manual/drawing-images-to-the-canvas/image-orientation/drawImage-from-element-swap-width-height.tentative.html [ ImageOnlyFailure ]
+imported/w3c/web-platform-tests/html/canvas/element/manual/drawing-images-to-the-canvas/image-orientation/drawImage-from-element.tentative.html [ ImageOnlyFailure ]
+imported/w3c/web-platform-tests/html/canvas/element/manual/imagebitmap/imageBitmapRendering-transferFromImageBitmap-flipped.html [ ImageOnlyFailure ]
+imported/w3c/web-platform-tests/html/canvas/element/manual/imagebitmap/imageBitmapRendering-transferFromImageBitmap.html [ ImageOnlyFailure ]
Added: trunk/LayoutTests/platform/ios-wk2/compositing/canvas/hidpi-canvas-backing-store-expected.txt (0 => 295718)
--- trunk/LayoutTests/platform/ios-wk2/compositing/canvas/hidpi-canvas-backing-store-expected.txt (rev 0)
+++ trunk/LayoutTests/platform/ios-wk2/compositing/canvas/hidpi-canvas-backing-store-expected.txt 2022-06-22 03:12:18 UTC (rev 295718)
@@ -0,0 +1,32 @@
+Tests whether a compositing layer containing only canvas uses a standard DPI backing store.
+
+ (GraphicsLayer
+ (anchor 0.00 0.00)
+ (bounds 1008.00 1097.00)
+ (device scale 2.00)
+ (children 1
+ (GraphicsLayer
+ (bounds 1008.00 1097.00)
+ (contentsOpaque 1)
+ (device scale 2.00)
+ (children 1
+ (GraphicsLayer
+ (position 8.00 52.00)
+ (bounds 1000.00 1005.00)
+ (opacity 0.50)
+ (device scale 2.00)
+ (children 1
+ (GraphicsLayer
+ (anchor 0.00 0.00)
+ (bounds 1000.00 1000.00)
+ (drawsContent 1)
+ (transform [0.50 0.00 0.00 0.00] [0.00 0.50 0.00 0.00] [0.00 0.00 1.00 0.00] [0.00 0.00 0.00 1.00])
+ (device scale 1.00)
+ )
+ )
+ )
+ )
+ )
+ )
+)
+
Added: trunk/LayoutTests/platform/ios-wk2/compositing/canvas/hidpi-canvas-backing-store-invalidation-expected.txt (0 => 295718)
--- trunk/LayoutTests/platform/ios-wk2/compositing/canvas/hidpi-canvas-backing-store-invalidation-expected.txt (rev 0)
+++ trunk/LayoutTests/platform/ios-wk2/compositing/canvas/hidpi-canvas-backing-store-invalidation-expected.txt 2022-06-22 03:12:18 UTC (rev 295718)
@@ -0,0 +1,34 @@
+Tests whether we switch back to a hidpi backing store when rasterized content is added to the canvas layer.
+
+ (GraphicsLayer
+ (anchor 0.00 0.00)
+ (bounds 1008.00 1097.00)
+ (device scale 2.00)
+ (children 1
+ (GraphicsLayer
+ (bounds 1008.00 1097.00)
+ (contentsOpaque 1)
+ (device scale 2.00)
+ (children 1
+ (GraphicsLayer
+ (offsetFromRenderer width=-3 height=-3)
+ (position 5.00 49.00)
+ (bounds 1003.00 1008.00)
+ (opacity 0.50)
+ (device scale 2.00)
+ (children 1
+ (GraphicsLayer
+ (offsetFromRenderer width=-3 height=-3)
+ (anchor 0.00 0.00)
+ (bounds 1006.00 1006.00)
+ (drawsContent 1)
+ (transform [0.50 0.00 0.00 0.00] [0.00 0.50 0.00 0.00] [0.00 0.00 1.00 0.00] [0.00 0.00 0.00 1.00])
+ (device scale 2.00)
+ )
+ )
+ )
+ )
+ )
+ )
+)
+
Added: trunk/LayoutTests/platform/ios-wk2/compositing/hidpi-image-backing-store-expected.txt (0 => 295718)
--- trunk/LayoutTests/platform/ios-wk2/compositing/hidpi-image-backing-store-expected.txt (rev 0)
+++ trunk/LayoutTests/platform/ios-wk2/compositing/hidpi-image-backing-store-expected.txt 2022-06-22 03:12:18 UTC (rev 295718)
@@ -0,0 +1,24 @@
+Tests whether a compositing layer containing only an image uses a standard DPI backing store.
+
+
+(GraphicsLayer
+ (anchor 0.00 0.00)
+ (bounds 800.00 600.00)
+ (device scale 2.00)
+ (children 1
+ (GraphicsLayer
+ (bounds 800.00 600.00)
+ (contentsOpaque 1)
+ (device scale 2.00)
+ (children 1
+ (GraphicsLayer
+ (position 8.00 52.00)
+ (bounds 150.00 150.00)
+ (drawsContent 1)
+ (device scale 1.00)
+ )
+ )
+ )
+ )
+)
+
Added: trunk/LayoutTests/platform/ios-wk2/compositing/hidpi-image-backing-store-scaled-expected.txt (0 => 295718)
--- trunk/LayoutTests/platform/ios-wk2/compositing/hidpi-image-backing-store-scaled-expected.txt (rev 0)
+++ trunk/LayoutTests/platform/ios-wk2/compositing/hidpi-image-backing-store-scaled-expected.txt 2022-06-22 03:12:18 UTC (rev 295718)
@@ -0,0 +1,24 @@
+Tests whether a compositing layer containing only an image uses a standard DPI backing store.
+
+
+(GraphicsLayer
+ (anchor 0.00 0.00)
+ (bounds 800.00 600.00)
+ (device scale 2.00)
+ (children 1
+ (GraphicsLayer
+ (bounds 800.00 600.00)
+ (contentsOpaque 1)
+ (device scale 2.00)
+ (children 1
+ (GraphicsLayer
+ (position 8.00 52.00)
+ (bounds 200.00 150.00)
+ (drawsContent 1)
+ (device scale 2.00)
+ )
+ )
+ )
+ )
+)
+
Modified: trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp (295717 => 295718)
--- trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp 2022-06-22 03:09:26 UTC (rev 295717)
+++ trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp 2022-06-22 03:12:18 UTC (rev 295718)
@@ -145,6 +145,7 @@
, m_usesDisplayListDrawing(false)
, m_allowsTiling(true)
, m_appliesPageScale(false)
+ , m_appliesDeviceScale(true)
, m_showDebugBorder(false)
, m_showRepaintCounter(false)
, m_isMaskLayer(false)
Modified: trunk/Source/WebCore/platform/graphics/GraphicsLayer.h (295717 => 295718)
--- trunk/Source/WebCore/platform/graphics/GraphicsLayer.h 2022-06-22 03:09:26 UTC (rev 295717)
+++ trunk/Source/WebCore/platform/graphics/GraphicsLayer.h 2022-06-22 03:12:18 UTC (rev 295718)
@@ -581,8 +581,11 @@
virtual void setAppliesPageScale(bool appliesScale = true) { m_appliesPageScale = appliesScale; }
virtual bool appliesPageScale() const { return m_appliesPageScale; }
+ void setAppliesDeviceScale(bool appliesScale = true) { m_appliesDeviceScale = appliesScale; }
+ bool appliesDeviceScale() const { return m_appliesDeviceScale; }
+
float pageScaleFactor() const { return client().pageScaleFactor(); }
- float deviceScaleFactor() const { return client().deviceScaleFactor(); }
+ float deviceScaleFactor() const { return appliesDeviceScale() ? client().deviceScaleFactor() : 1.f; }
// Whether this layer can throw away backing store to save memory. False for layers that can be revealed by async scrolling.
virtual void setAllowsBackingStoreDetaching(bool) { }
@@ -742,6 +745,7 @@
bool m_usesDisplayListDrawing : 1;
bool m_allowsTiling : 1;
bool m_appliesPageScale : 1; // Set for the layer which has the page scale applied to it.
+ bool m_appliesDeviceScale : 1;
bool m_showDebugBorder : 1;
bool m_showRepaintCounter : 1;
bool m_isMaskLayer : 1;
Modified: trunk/Source/WebCore/platform/graphics/LayerTreeAsTextOptions.h (295717 => 295718)
--- trunk/Source/WebCore/platform/graphics/LayerTreeAsTextOptions.h 2022-06-22 03:09:26 UTC (rev 295717)
+++ trunk/Source/WebCore/platform/graphics/LayerTreeAsTextOptions.h 2022-06-22 03:12:18 UTC (rev 295718)
@@ -43,6 +43,7 @@
IncludeRootLayerProperties = 1 << 10,
IncludeEventRegion = 1 << 11,
IncludeDeepColor = 1 << 12,
+ IncludeDeviceScale = 1 << 13,
};
static constexpr OptionSet<LayerTreeAsTextOptions> AllLayerTreeAsTextOptions = {
Modified: trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp (295717 => 295718)
--- trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp 2022-06-22 03:09:26 UTC (rev 295717)
+++ trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp 2022-06-22 03:12:18 UTC (rev 295718)
@@ -4347,6 +4347,9 @@
textStream << indent << "(in window " << tiledBacking()->isInWindow() << ")\n";
}
+ if (options & LayerTreeAsTextOptions::IncludeDeviceScale)
+ textStream << indent << "(device scale " << deviceScaleFactor() << ")\n";
+
if ((options & LayerTreeAsTextOptions::IncludeDeepColor) && m_layer->wantsDeepColorBackingStore())
textStream << indent << "(deep color 1)\n";
Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.cpp (295717 => 295718)
--- trunk/Source/WebCore/rendering/RenderLayerBacking.cpp 2022-06-22 03:09:26 UTC (rev 295717)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.cpp 2022-06-22 03:12:18 UTC (rev 295718)
@@ -111,7 +111,8 @@
Unknown,
SimpleContainer,
DirectlyCompositedImage,
- Painted
+ UnscaledBitmapOnly,
+ Painted,
};
PaintedContentsInfo(RenderLayerBacking& inBacking)
@@ -156,6 +157,11 @@
return contentsTypeDetermination() == ContentsTypeDetermination::DirectlyCompositedImage;
}
+ bool isUnscaledBitmapOnly()
+ {
+ return contentsTypeDetermination() == ContentsTypeDetermination::UnscaledBitmapOnly;
+ }
+
RenderLayerBacking& m_backing;
RequestState m_boxDecorations { RequestState::Unknown };
RequestState m_content { RequestState::Unknown };
@@ -209,6 +215,8 @@
m_contentsType = ContentsTypeDetermination::SimpleContainer;
else if (m_backing.isDirectlyCompositedImage())
m_contentsType = ContentsTypeDetermination::DirectlyCompositedImage;
+ else if (m_backing.isUnscaledBitmapOnly())
+ m_contentsType = ContentsTypeDetermination::UnscaledBitmapOnly;
else
m_contentsType = ContentsTypeDetermination::Painted;
@@ -1068,6 +1076,12 @@
if (contentsInfo.isDirectlyCompositedImage())
updateImageContents(contentsInfo);
+ bool unscaledBitmap = contentsInfo.isUnscaledBitmapOnly();
+ if (unscaledBitmap == m_graphicsLayer->appliesDeviceScale()) {
+ m_graphicsLayer->setAppliesDeviceScale(!unscaledBitmap);
+ layerConfigChanged = true;
+ }
+
if (is<RenderEmbeddedObject>(renderer()) && downcast<RenderEmbeddedObject>(renderer()).allowsAcceleratedCompositing()) {
auto* pluginViewBase = downcast<PluginViewBase>(downcast<RenderWidget>(renderer()).widget());
#if PLATFORM(IOS_FAMILY)
@@ -2912,12 +2926,54 @@
return false;
}
+bool RenderLayerBacking::isUnscaledBitmapOnly() const
+{
+ if (!is<RenderImage>(renderer()) && !is<RenderHTMLCanvas>(renderer()))
+ return false;
+
+ if (m_owningLayer.hasVisibleBoxDecorationsOrBackground())
+ return false;
+
+ auto contents = contentsBox();
+ if (contents.location() != LayoutPoint(0, 0))
+ return false;
+
+ if (is<RenderImage>(renderer())) {
+ auto& imageRenderer = downcast<RenderImage>(renderer());
+ if (auto* cachedImage = imageRenderer.cachedImage()) {
+ if (!cachedImage->hasImage())
+ return false;
+
+ auto* image = cachedImage->imageForRenderer(&imageRenderer);
+ if (!is<BitmapImage>(image))
+ return false;
+
+ if (downcast<BitmapImage>(*image).orientationForCurrentFrame() != ImageOrientation::None)
+ return false;
+
+ return contents.size() == image->size();
+ }
+ return false;
+ }
+
+ auto& canvasRenderer = downcast<RenderHTMLCanvas>(renderer());
+ if (snappedIntRect(contents).size() == canvasRenderer.canvasElement().size())
+ return true;
+ return false;
+}
+
void RenderLayerBacking::contentChanged(ContentChangeType changeType)
{
PaintedContentsInfo contentsInfo(*this);
- if ((changeType == ImageChanged) && contentsInfo.isDirectlyCompositedImage()) {
- updateImageContents(contentsInfo);
- return;
+ if (changeType == ImageChanged) {
+ if (contentsInfo.isDirectlyCompositedImage()) {
+ updateImageContents(contentsInfo);
+ return;
+ }
+ if (contentsInfo.isUnscaledBitmapOnly()) {
+ compositor().scheduleCompositingLayerUpdate();
+ return;
+ }
}
if (changeType == VideoChanged) {
Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.h (295717 => 295718)
--- trunk/Source/WebCore/rendering/RenderLayerBacking.h 2022-06-22 03:09:26 UTC (rev 295717)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.h 2022-06-22 03:12:18 UTC (rev 295718)
@@ -371,6 +371,7 @@
// Returns true if the RenderLayer just contains an image that we can composite directly.
bool isDirectlyCompositedImage() const;
void updateImageContents(PaintedContentsInfo&);
+ bool isUnscaledBitmapOnly() const;
void updateDirectlyCompositedBoxDecorations(PaintedContentsInfo&, bool& didUpdateContentsRect);
void updateDirectlyCompositedBackgroundColor(PaintedContentsInfo&, bool& didUpdateContentsRect);
Modified: trunk/Source/WebCore/testing/Internals.cpp (295717 => 295718)
--- trunk/Source/WebCore/testing/Internals.cpp 2022-06-22 03:09:26 UTC (rev 295717)
+++ trunk/Source/WebCore/testing/Internals.cpp 2022-06-22 03:12:18 UTC (rev 295718)
@@ -2929,6 +2929,8 @@
layerTreeFlags.add(LayerTreeAsTextOptions::IncludeEventRegion);
if (flags & Internals::LAYER_TREE_INCLUDES_DEEP_COLOR)
layerTreeFlags.add(LayerTreeAsTextOptions::IncludeDeepColor);
+ if (flags & Internals::LAYER_TREE_INCLUDES_DEVICE_SCALE)
+ layerTreeFlags.add(LayerTreeAsTextOptions::IncludeDeviceScale);
return layerTreeFlags;
}
Modified: trunk/Source/WebCore/testing/Internals.h (295717 => 295718)
--- trunk/Source/WebCore/testing/Internals.h 2022-06-22 03:09:26 UTC (rev 295717)
+++ trunk/Source/WebCore/testing/Internals.h 2022-06-22 03:12:18 UTC (rev 295718)
@@ -447,6 +447,7 @@
LAYER_TREE_INCLUDES_ROOT_LAYER_PROPERTIES = 256,
LAYER_TREE_INCLUDES_EVENT_REGION = 512,
LAYER_TREE_INCLUDES_DEEP_COLOR = 1024,
+ LAYER_TREE_INCLUDES_DEVICE_SCALE = 2048,
};
ExceptionOr<String> layerTreeAsText(Document&, unsigned short flags) const;
ExceptionOr<uint64_t> layerIDForElement(Element&);
Modified: trunk/Source/WebCore/testing/Internals.idl (295717 => 295718)
--- trunk/Source/WebCore/testing/Internals.idl 2022-06-22 03:09:26 UTC (rev 295717)
+++ trunk/Source/WebCore/testing/Internals.idl 2022-06-22 03:12:18 UTC (rev 295718)
@@ -582,6 +582,7 @@
const unsigned short LAYER_TREE_INCLUDES_ROOT_LAYER_PROPERTIES = 256;
const unsigned short LAYER_TREE_INCLUDES_EVENT_REGION = 512;
const unsigned short LAYER_TREE_INCLUDES_DEEP_COLOR = 1024;
+ const unsigned short LAYER_TREE_INCLUDES_DEVICE_SCALE = 2048;
DOMString layerTreeAsText(Document document, optional unsigned short flags = 0);
unsigned long long layerIDForElement(Element element);