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

Unified Diff: Source/web/LinkHighlight.cpp

Issue 302993003: Route selection bounds updates through WebLayerTreeView (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 6 years, 5 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
« no previous file with comments | « Source/web/ChromeClientImpl.cpp ('k') | Source/web/WebRuntimeFeatures.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/web/LinkHighlight.cpp
diff --git a/Source/web/LinkHighlight.cpp b/Source/web/LinkHighlight.cpp
index e20c72f98d0b3a39357dd21c9caa9b05ebf010ba..733d34705c97cfa3aac980240c977182f6c03cde 100644
--- a/Source/web/LinkHighlight.cpp
+++ b/Source/web/LinkHighlight.cpp
@@ -37,6 +37,7 @@
#include "core/rendering/RenderPart.h"
#include "core/rendering/RenderView.h"
#include "core/rendering/compositing/CompositedLayerMapping.h"
+#include "core/rendering/compositing/RenderLayerCompositor.h"
#include "core/rendering/style/ShadowData.h"
#include "platform/graphics/Color.h"
#include "public/platform/Platform.h"
@@ -107,29 +108,11 @@ void LinkHighlight::releaseResources()
RenderLayer* LinkHighlight::computeEnclosingCompositingLayer()
{
- if (!m_node || !m_node->renderer())
+ RenderLayer* newRenderLayer;
+ GraphicsLayer* newGraphicsLayer;
+ if (!RenderLayerCompositor::computeEnclosingCompositingLayer(m_node.get(), newRenderLayer, newGraphicsLayer))
return 0;
- // Find the nearest enclosing composited layer and attach to it. We may need to cross frame boundaries
- // to find a suitable layer.
- RenderObject* renderer = m_node->renderer();
- RenderLayer* renderLayer;
- do {
- renderLayer = renderer->enclosingLayer()->enclosingLayerForPaintInvalidation();
- if (!renderLayer) {
- renderer = renderer->frame()->ownerRenderer();
- if (!renderer)
- return 0;
- }
- } while (!renderLayer);
-
- ASSERT(renderLayer->compositingState() != NotComposited);
-
- GraphicsLayer* newGraphicsLayer = renderLayer->graphicsLayerBacking();
- if (!newGraphicsLayer->drawsContent()) {
- newGraphicsLayer = renderLayer->graphicsLayerBackingForScrolling();
- }
-
m_clipLayer->setTransform(SkMatrix44(SkMatrix44::kIdentity_Constructor));
if (m_currentGraphicsLayer != newGraphicsLayer) {
@@ -140,34 +123,7 @@ RenderLayer* LinkHighlight::computeEnclosingCompositingLayer()
m_currentGraphicsLayer->addLinkHighlight(this);
}
- return renderLayer;
-}
-
-static void convertTargetSpaceQuadToCompositedLayer(const FloatQuad& targetSpaceQuad, RenderObject* targetRenderer, RenderObject* compositedRenderer, FloatQuad& compositedSpaceQuad)
-{
- ASSERT(targetRenderer);
- ASSERT(compositedRenderer);
-
- for (unsigned i = 0; i < 4; ++i) {
- IntPoint point;
- switch (i) {
- case 0: point = roundedIntPoint(targetSpaceQuad.p1()); break;
- case 1: point = roundedIntPoint(targetSpaceQuad.p2()); break;
- case 2: point = roundedIntPoint(targetSpaceQuad.p3()); break;
- case 3: point = roundedIntPoint(targetSpaceQuad.p4()); break;
- }
-
- point = targetRenderer->frame()->view()->contentsToWindow(point);
- point = compositedRenderer->frame()->view()->windowToContents(point);
- FloatPoint floatPoint = compositedRenderer->absoluteToLocal(point, UseTransforms);
-
- switch (i) {
- case 0: compositedSpaceQuad.setP1(floatPoint); break;
- case 1: compositedSpaceQuad.setP2(floatPoint); break;
- case 2: compositedSpaceQuad.setP3(floatPoint); break;
- case 3: compositedSpaceQuad.setP4(floatPoint); break;
- }
- }
+ return newRenderLayer;
}
static void addQuadToPath(const FloatQuad& quad, Path& path)
@@ -223,7 +179,7 @@ bool LinkHighlight::computeHighlightLayerPathAndPosition(RenderLayer* compositin
// Transform node quads in target absolute coords to local coordinates in the compositor layer.
FloatQuad transformedQuad;
- convertTargetSpaceQuadToCompositedLayer(absoluteQuad, m_node->renderer(), compositingLayer->renderer(), transformedQuad);
+ RenderLayerCompositor::convertTargetSpaceQuadToCompositedLayer(absoluteQuad, m_node->renderer(), compositingLayer->renderer(), transformedQuad);
// FIXME: for now, we'll only use rounded paths if we have a single node quad. The reason for this is that
// we may sometimes get a chain of adjacent boxes (e.g. for text nodes) which end up looking like sausage
« no previous file with comments | « Source/web/ChromeClientImpl.cpp ('k') | Source/web/WebRuntimeFeatures.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698