Index: Source/core/platform/graphics/GraphicsLayer.cpp |
diff --git a/Source/core/platform/graphics/GraphicsLayer.cpp b/Source/core/platform/graphics/GraphicsLayer.cpp |
index 461c2547c35e2854a9e7975e4a4a4fab0de097d9..5f80db3e44f940a183e6c5d5d024af1e897a6111 100644 |
--- a/Source/core/platform/graphics/GraphicsLayer.cpp |
+++ b/Source/core/platform/graphics/GraphicsLayer.cpp |
@@ -131,7 +131,6 @@ GraphicsLayer::GraphicsLayer(GraphicsLayerClient* client) |
, m_repaintCount(0) |
, m_contentsLayer(0) |
, m_contentsLayerId(0) |
- , m_linkHighlight(0) |
, m_contentsLayerPurpose(NoContentsLayer) |
, m_scrollableArea(0) |
{ |
@@ -149,10 +148,9 @@ GraphicsLayer::GraphicsLayer(GraphicsLayerClient* client) |
GraphicsLayer::~GraphicsLayer() |
{ |
- if (m_linkHighlight) { |
- m_linkHighlight->clearCurrentGraphicsLayer(); |
- m_linkHighlight = 0; |
- } |
+ for (size_t i = 0; i < m_linkHighlights.size(); i++) |
+ m_linkHighlights[i]->clearCurrentGraphicsLayer(); |
+ m_linkHighlights.clear(); |
#ifndef NDEBUG |
if (m_client) |
@@ -564,9 +562,9 @@ void GraphicsLayer::updateNames() |
String debugName = "ContentsLayer for " + m_nameBase; |
contentsLayer->setDebugName(debugName); |
} |
- if (m_linkHighlight) { |
+ for (size_t i = 0; i < m_linkHighlights.size(); i++) { |
String debugName = "LinkHighlight for " + m_nameBase; |
- m_linkHighlight->layer()->setDebugName(debugName); |
+ m_linkHighlights[i]->layer()->setDebugName(debugName); |
wjmaclean
2013/06/12 15:09:06
It may be slightly confusing having multiple link
|
} |
} |
@@ -592,8 +590,8 @@ void GraphicsLayer::updateChildList() |
childHost->addChild(curChild->platformLayer()); |
} |
- if (m_linkHighlight) |
- childHost->addChild(m_linkHighlight->layer()); |
+ for (size_t i = 0; i < m_linkHighlights.size(); i++) |
+ childHost->addChild(m_linkHighlights[i]->layer()); |
} |
void GraphicsLayer::updateLayerIsDrawable() |
@@ -609,8 +607,8 @@ void GraphicsLayer::updateLayerIsDrawable() |
if (m_drawsContent) { |
m_layer->layer()->invalidate(); |
- if (m_linkHighlight) |
- m_linkHighlight->invalidate(); |
+ for (size_t i = 0; i < m_linkHighlights.size(); i++) |
+ m_linkHighlights[i]->invalidate(); |
} |
} |
@@ -942,7 +940,9 @@ void GraphicsLayer::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const |
info.addMember(m_layer, "layer"); |
info.addMember(m_imageLayer, "imageLayer"); |
info.addMember(m_contentsLayer, "contentsLayer"); |
- info.addMember(m_linkHighlight, "linkHighlight"); |
+ for (size_t i = 0; i < m_linkHighlights.size(); i++) { |
+ info.addMember(m_linkHighlights[i], "linkHighlights"); |
+ } |
info.addMember(m_opaqueRectTrackingContentLayerDelegate, "opaqueRectTrackingContentLayerDelegate"); |
info.addMember(m_animationIdMap, "animationIdMap"); |
info.addMember(m_scrollableArea, "scrollableArea"); |
@@ -1098,8 +1098,8 @@ void GraphicsLayer::setNeedsDisplay() |
if (drawsContent()) { |
m_layer->layer()->invalidate(); |
addRepaintRect(FloatRect(FloatPoint(), m_size)); |
- if (m_linkHighlight) |
- m_linkHighlight->invalidate(); |
+ for (size_t i = 0; i < m_linkHighlights.size(); i++) |
+ m_linkHighlights[i]->invalidate(); |
} |
} |
@@ -1108,8 +1108,8 @@ void GraphicsLayer::setNeedsDisplayInRect(const FloatRect& rect) |
if (drawsContent()) { |
m_layer->layer()->invalidateRect(rect); |
addRepaintRect(rect); |
- if (m_linkHighlight) |
- m_linkHighlight->invalidate(); |
+ for (size_t i = 0; i < m_linkHighlights.size(); i++) |
+ m_linkHighlights[i]->invalidate(); |
} |
} |
@@ -1331,9 +1331,18 @@ void GraphicsLayer::setBackgroundFilters(const FilterOperations& filters) |
m_layer->layer()->setBackgroundFilters(webFilters); |
} |
-void GraphicsLayer::setLinkHighlight(LinkHighlightClient* linkHighlight) |
+void GraphicsLayer::addLinkHighlight(LinkHighlightClient* linkHighlight) |
+{ |
+ ASSERT(linkHighlight); |
+ m_linkHighlights.append(linkHighlight); |
+ updateChildList(); |
+} |
+ |
+void GraphicsLayer::removeLinkHighlight( |
+ LinkHighlightClient* linkHighlight) |
{ |
- m_linkHighlight = linkHighlight; |
+ m_linkHighlights.remove(m_linkHighlights.find(linkHighlight)); |
+ ASSERT(!m_linkHighlights.contains(linkHighlight)); |
updateChildList(); |
} |