-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[UnifiedPDF] PDF in style embed renders in the wrong place
https://bugs.webkit.org/show_bug.cgi?id=266750 rdar://119969233 Reviewed by Alan Baradlay. The UnifiedPDFPlugin's root layer has to be positioned relative to the compositing layer of the RenderEmbeddedObject, which can be inflated by borders, outlines, padding and shadows. RenderLayerBacking knows best how to compute the right offset, so let it position the plugin's root layer. * LayoutTests/compositing/plugins/pdf/pdf-in-styled-embed-expected.txt: Added. * LayoutTests/compositing/plugins/pdf/pdf-in-styled-embed.html: Added. * Source/WebCore/rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::updateAfterWidgetResize): * Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.mm: (WebKit::UnifiedPDFPlugin::updateLayerHierarchy): Canonical link: https://commits.webkit.org/272443@main
- Loading branch information
Showing
4 changed files
with
58 additions
and
2 deletions.
There are no files selected for viewing
20 changes: 20 additions & 0 deletions
20
LayoutTests/compositing/plugins/pdf/pdf-in-styled-embed-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
|
||
(GraphicsLayer | ||
(anchor 0.00 0.00) | ||
(bounds 788.00 805.00) | ||
(children 1 | ||
(GraphicsLayer | ||
(bounds 788.00 805.00) | ||
(contentsOpaque 1) | ||
(children 1 | ||
(GraphicsLayer | ||
(offsetFromRenderer width=-28 height=-28) | ||
(position 180.00 180.00) | ||
(bounds 436.00 436.00) | ||
(drawsContent 1) | ||
) | ||
) | ||
) | ||
) | ||
) | ||
|
34 changes: 34 additions & 0 deletions
34
LayoutTests/compositing/plugins/pdf/pdf-in-styled-embed.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<!DOCTYPE html> <!-- webkit-test-runner [ UnifiedPDFEnabled=true PDFPluginHUDEnabled=false ] --> | ||
<html> | ||
<head> | ||
<style> | ||
embed { | ||
margin: 200px; | ||
width: 300px; | ||
height: 300px; | ||
border: 20px solid silver; | ||
padding: 20px; | ||
box-shadow: 0 0 20px black; | ||
} | ||
</style> | ||
<script src="../../../resources/ui-helper.js"></script> | ||
<script> | ||
if (window.testRunner) { | ||
testRunner.waitUntilDone(); | ||
testRunner.dumpAsText(); | ||
} | ||
window.addEventListener('load', async () => { | ||
await UIHelper.renderingUpdate(); | ||
|
||
const layers = document.getElementById('layers'); | ||
layers.textContent = internals.layerTreeAsText(document); | ||
|
||
testRunner.notifyDone(); | ||
}, false); | ||
</script> | ||
</head> | ||
<body> | ||
<embed src="../../../fast/images/resources/green_rectangle.pdf"> | ||
<pre id="layers"></pre> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters