Skip to content

Commit

Permalink
Unreviewed, reverting 265587@main.
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=258858

Broke PDF display in Mail (<rdar://111711710>)

Reverted changeset:

"Avoid evaluating layer backing store contents twice per update"
https://bugs.webkit.org/show_bug.cgi?id=258579
https://commits.webkit.org/265587@main

Canonical link: https://commits.webkit.org/265757@main
  • Loading branch information
webkit-commit-queue authored and smfr committed Jul 4, 2023
1 parent ee9d5f0 commit 0033183
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 31 deletions.
3 changes: 2 additions & 1 deletion Source/WebCore/rendering/RenderHTMLCanvas.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,10 @@ void RenderHTMLCanvas::paintReplaced(PaintInfo& paintInfo, const LayoutPoint& pa

canvasElement().setIsSnapshotting(paintInfo.paintBehavior.contains(PaintBehavior::Snapshotting));
CompositeOperator op = CompositeOperator::SourceOver;
#if ENABLE(CSS_COMPOSITING)
if (paintInfo.enclosingSelfPaintingLayer() && paintInfo.enclosingSelfPaintingLayer()->shouldPaintUsingCompositeCopy())
op = CompositeOperator::Copy;

#endif
canvasElement().paint(context, replacedContentRect, op);
canvasElement().setIsSnapshotting(false);
}
Expand Down
62 changes: 36 additions & 26 deletions Source/WebCore/rendering/RenderLayerBacking.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1116,9 +1116,34 @@ bool RenderLayerBacking::updateConfiguration(const RenderLayer* compositingAnces
} else
m_graphicsLayer->setReplicatedByLayer(nullptr);

if (m_owningLayer.isRenderViewLayer())
PaintedContentsInfo contentsInfo(*this);

// Requires layout.
if (!m_owningLayer.isRenderViewLayer()) {
bool didUpdateContentsRect = false;
updateDirectlyCompositedBoxDecorations(contentsInfo, didUpdateContentsRect);
} else
updateRootLayerConfiguration();

// Requires layout.
if (contentsInfo.isDirectlyCompositedImage())
updateImageContents(contentsInfo);

bool unscaledBitmap = contentsInfo.isUnscaledBitmapOnly();
if (unscaledBitmap == m_graphicsLayer->appliesDeviceScale()) {
m_graphicsLayer->setAppliesDeviceScale(!unscaledBitmap);
layerConfigChanged = true;
}

#if ENABLE(CSS_COMPOSITING)
bool shouldPaintUsingCompositeCopy = unscaledBitmap && is<RenderHTMLCanvas>(renderer());
if (shouldPaintUsingCompositeCopy != m_owningLayer.shouldPaintUsingCompositeCopy()) {
m_owningLayer.setShouldPaintUsingCompositeCopy(shouldPaintUsingCompositeCopy);
m_graphicsLayer->setShouldPaintUsingCompositeCopy(shouldPaintUsingCompositeCopy);
layerConfigChanged = true;
}
#endif

if (is<RenderEmbeddedObject>(renderer()) && downcast<RenderEmbeddedObject>(renderer()).allowsAcceleratedCompositing()) {
auto* pluginViewBase = downcast<PluginViewBase>(downcast<RenderWidget>(renderer()).widget());
#if PLATFORM(IOS_FAMILY)
Expand Down Expand Up @@ -1625,34 +1650,20 @@ void RenderLayerBacking::updateScrollOffset(ScrollOffset scrollOffset)
ASSERT(m_scrolledContentsLayer->position().isZero());
}

void RenderLayerBacking::updateAfterDescendants(bool reevaluateConfiguration)
void RenderLayerBacking::updateAfterDescendants()
{
if (reevaluateConfiguration || m_owningLayer.needsCompositingConfigurationUpdate()) {
PaintedContentsInfo contentsInfo(*this);

if (contentsInfo.isDirectlyCompositedImage())
updateImageContents(contentsInfo);

bool unscaledBitmap = contentsInfo.isUnscaledBitmapOnly();
if (unscaledBitmap == m_graphicsLayer->appliesDeviceScale())
m_graphicsLayer->setAppliesDeviceScale(!unscaledBitmap);

bool shouldPaintUsingCompositeCopy = unscaledBitmap && is<RenderHTMLCanvas>(renderer());
if (shouldPaintUsingCompositeCopy != m_owningLayer.shouldPaintUsingCompositeCopy()) {
m_owningLayer.setShouldPaintUsingCompositeCopy(shouldPaintUsingCompositeCopy);
m_graphicsLayer->setShouldPaintUsingCompositeCopy(shouldPaintUsingCompositeCopy);
}

if (!m_owningLayer.isRenderViewLayer()) {
bool didUpdateContentsRect = false;
updateDirectlyCompositedBoxDecorations(contentsInfo, didUpdateContentsRect);
if (!didUpdateContentsRect && m_graphicsLayer->usesContentsLayer())
resetContentsRect();
}
// FIXME: this potentially duplicates work we did in updateConfiguration().
PaintedContentsInfo contentsInfo(*this);

updateDrawsContent(contentsInfo);
if (!m_owningLayer.isRenderViewLayer()) {
bool didUpdateContentsRect = false;
updateDirectlyCompositedBoxDecorations(contentsInfo, didUpdateContentsRect);
if (!didUpdateContentsRect && m_graphicsLayer->usesContentsLayer())
resetContentsRect();
}

updateDrawsContent(contentsInfo);

if (!m_isMainFrameRenderViewLayer && !m_isFrameLayerWithTiledBacking && !m_requiresBackgroundLayer) {
// For non-root layers, background is always painted by the primary graphics layer.
ASSERT(!m_backgroundLayer);
Expand All @@ -1661,7 +1672,6 @@ void RenderLayerBacking::updateAfterDescendants(bool reevaluateConfiguration)

bool isSkippedContent = renderer().isSkippedContent();
m_graphicsLayer->setContentsVisible(!isSkippedContent && (m_owningLayer.hasVisibleContent() || hasVisibleNonCompositedDescendants()));

if (m_scrollContainerLayer) {
m_scrollContainerLayer->setContentsVisible(renderer().style().visibility() == Visibility::Visible);

Expand Down
2 changes: 1 addition & 1 deletion Source/WebCore/rendering/RenderLayerBacking.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ class RenderLayerBacking final : public GraphicsLayerClient {
void updateGeometry(const RenderLayer* compositingAncestor);

// Update state the requires that descendant layers have been updated.
void updateAfterDescendants(bool reevaluateConfiguration);
void updateAfterDescendants();

// Update contents and clipping structure.
void updateDrawsContent();
Expand Down
5 changes: 2 additions & 3 deletions Source/WebCore/rendering/RenderLayerCompositor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1444,7 +1444,7 @@ void RenderLayerCompositor::updateBackingAndHierarchy(RenderLayer& layer, Vector
if (auto* reflectionBacking = reflection->backing()) {
reflectionBacking->updateCompositedBounds();
reflectionBacking->updateGeometry(&layer);
reflectionBacking->updateAfterDescendants(layerNeedsUpdate);
reflectionBacking->updateAfterDescendants();
}
}

Expand Down Expand Up @@ -1537,7 +1537,7 @@ void RenderLayerCompositor::updateBackingAndHierarchy(RenderLayer& layer, Vector
if (layer.hasCompositedScrollableOverflow())
traversalState.overflowScrollLayers->append(&layer);

layerBacking->updateAfterDescendants(layerNeedsUpdate);
layerBacking->updateAfterDescendants();
}

layer.clearUpdateBackingOrHierarchyTraversalState();
Expand Down Expand Up @@ -2014,7 +2014,6 @@ bool RenderLayerCompositor::updateBacking(RenderLayer& layer, RequiresCompositin
return layerChanged;
}

// Only used for reflection layers.
bool RenderLayerCompositor::updateLayerCompositingState(RenderLayer& layer, const RenderLayer* compositingAncestor, RequiresCompositingData& queryData, BackingSharingState& backingSharingState)
{
bool layerChanged = updateBacking(layer, queryData, &backingSharingState);
Expand Down

0 comments on commit 0033183

Please sign in to comment.