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

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

Issue 15663005: Expand tap highlight to allow multiple highlights for touch disambiguation. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 3 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 3e2fe6ed9ed49f27ac5332b55738173b6c0ca605..10a3faf26f03b7932b2826e6ae6c129577c64ed1 100644
--- a/Source/core/platform/graphics/GraphicsLayer.cpp
+++ b/Source/core/platform/graphics/GraphicsLayer.cpp
@@ -124,7 +124,6 @@ GraphicsLayer::GraphicsLayer(GraphicsLayerClient* client)
, m_paintCount(0)
, m_contentsLayer(0)
, m_contentsLayerId(0)
- , m_linkHighlight(0)
, m_contentsLayerPurpose(NoContentsLayer)
, m_scrollableArea(0)
, m_compositingReasons(WebKit::CompositingReasonUnknown)
@@ -143,10 +142,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)
@@ -537,8 +535,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()
@@ -554,8 +552,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();
}
}
@@ -880,10 +878,18 @@ WebKit::WebString GraphicsLayer::debugName(WebKit::WebLayer* webLayer)
if (!m_client)
return name;
+ String highlightDebugName;
+ for (size_t i = 0; i < m_linkHighlights.size(); i++) {
+ if (webLayer == m_linkHighlights[i]->layer()) {
+ highlightDebugName = "LinkHighlight[" + String::number(i) + "] for " + m_client->debugName(this);
+ break;
+ }
+ }
+
if (webLayer == m_contentsLayer) {
name = "ContentsLayer for " + m_client->debugName(this);
- } else if (m_linkHighlight && webLayer == m_linkHighlight->layer()) {
- name = "LinkHighlight for " + m_client->debugName(this);
+ } else if (!highlightDebugName.isEmpty()) {
+ name = highlightDebugName;
} else if (webLayer == m_layer->layer()) {
name = m_client->debugName(this);
} else {
@@ -1030,8 +1036,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();
}
}
@@ -1040,8 +1046,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();
}
}
@@ -1282,11 +1288,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);
+ linkHighlight->layer()->setWebLayerClient(this);
+ updateChildList();
+}
+
+void GraphicsLayer::removeLinkHighlight(LinkHighlightClient* linkHighlight)
{
- m_linkHighlight = linkHighlight;
- if (m_linkHighlight)
- m_linkHighlight->layer()->setWebLayerClient(this);
+ m_linkHighlights.remove(m_linkHighlights.find(linkHighlight));
+ ASSERT(!m_linkHighlights.contains(linkHighlight));
updateChildList();
}

Powered by Google App Engine
This is Rietveld 408576698