Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1320)

Unified Diff: Source/core/platform/graphics/GraphicsLayer.cpp

Issue 16688004: Large canvas does not honor containing div's border radius (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/platform/graphics/GraphicsLayer.cpp
diff --git a/Source/core/platform/graphics/GraphicsLayer.cpp b/Source/core/platform/graphics/GraphicsLayer.cpp
index f7ecd9870041b38f723f51c3be37e46cfd088ae2..bcf6eacdcdbffe8255ca1ec1c5a3b8cd78c1243a 100644
--- a/Source/core/platform/graphics/GraphicsLayer.cpp
+++ b/Source/core/platform/graphics/GraphicsLayer.cpp
@@ -124,6 +124,7 @@ GraphicsLayer::GraphicsLayer(GraphicsLayerClient* client)
, m_contentsOrientation(CompositingCoordinatesTopDown)
, m_parent(0)
, m_maskLayer(0)
+ , m_borderRadiusLayer(0)
, m_replicaLayer(0)
, m_replicatedLayer(0)
, m_repaintCount(0)
@@ -620,6 +621,15 @@ void GraphicsLayer::updateContentsRect()
contentsLayer->setPosition(FloatPoint(m_contentsRect.x(), m_contentsRect.y()));
contentsLayer->setBounds(IntSize(m_contentsRect.width(), m_contentsRect.height()));
+
+ if (m_borderRadiusLayer) {
+ if (m_borderRadiusLayer->size() != m_contentsRect.size()) {
+ m_borderRadiusLayer->setSize(m_contentsRect.size());
+ m_borderRadiusLayer->setNeedsDisplay();
+ }
+ m_borderRadiusLayer->setPosition(FloatPoint());
+ m_borderRadiusLayer->setOffsetFromRenderer(offsetFromRenderer() + IntSize(m_contentsRect.location().x(), m_contentsRect.location().y()));
+ }
}
static HashSet<int>* s_registeredLayerSet;
@@ -683,6 +693,8 @@ void GraphicsLayer::setupContentsLayer(WebLayer* contentsLayer)
// Insert the content layer first. Video elements require this, because they have
// shadow content that must display in front of the video.
m_layer->layer()->insertChild(m_contentsLayer, 0);
+ WebLayer* borderWebLayer = m_borderRadiusLayer ? m_borderRadiusLayer->platformLayer() : 0;
+ m_contentsLayer->setMaskLayer(borderWebLayer);
}
updateNames();
}
@@ -892,6 +904,10 @@ void GraphicsLayer::dumpProperties(TextStream& ts, int indent, LayerTreeFlags fl
writeIndent(ts, indent + 2);
ts << "GraphicsLayerPaintMask\n";
}
+ if (paintingPhase() & GraphicsLayerPaintBorderRadiusMask) {
+ writeIndent(ts, indent + 2);
+ ts << "GraphicsLayerPaintBorderRadiusMask\n";
+ }
if (paintingPhase() & GraphicsLayerPaintOverflowContents) {
writeIndent(ts, indent + 2);
ts << "GraphicsLayerPaintOverflowContents\n";
@@ -932,6 +948,7 @@ void GraphicsLayer::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
info.addMember(m_children, "children");
info.addMember(m_parent, "parent");
info.addMember(m_maskLayer, "maskLayer");
+ info.addMember(m_borderRadiusLayer, "borderRadiusLayer");
info.addMember(m_replicaLayer, "replicaLayer");
info.addMember(m_replicatedLayer, "replicatedLayer");
info.ignoreMember(m_client);
@@ -1070,6 +1087,18 @@ void GraphicsLayer::setMaskLayer(GraphicsLayer* maskLayer)
m_layer->layer()->setMaskLayer(maskWebLayer);
}
+void GraphicsLayer::setBorderRadiusLayer(GraphicsLayer* borderRadiusLayer)
+{
+ if (borderRadiusLayer == m_borderRadiusLayer)
+ return;
+
+ m_borderRadiusLayer = borderRadiusLayer;
+ WebLayer* borderRadiusWebLayer = m_borderRadiusLayer ? m_borderRadiusLayer->platformLayer() : 0;
+ if (hasContentsLayer())
+ contentsLayer()->setMaskLayer(borderRadiusWebLayer);
+ updateContentsRect();
+}
+
void GraphicsLayer::setBackfaceVisibility(bool visible)
{
m_backfaceVisibility = visible;

Powered by Google App Engine
This is Rietveld 408576698