RenderLayer* LinkHighlight::computeEnclosingCompositingLayer() { if (!m_node || !m_node->renderer()) return 0; // Find the nearest enclosing composited layer and attach to it. We may need to cross frame boundaries // to find a suitable layer. RenderLayerModelObject* renderer = toRenderLayerModelObject(m_node->renderer()); RenderLayerModelObject* repaintContainer; do { repaintContainer = renderer->containerForRepaint(); if (!repaintContainer) { renderer = renderer->frame()->ownerRenderer(); if (!renderer) return 0; } } while (!repaintContainer); RenderLayer* renderLayer = repaintContainer->layer(); if (!renderLayer || !renderLayer->isComposited()) return 0; GraphicsLayer* newGraphicsLayer = renderLayer->backing()->graphicsLayer(); m_clipLayer->setSublayerTransform(SkMatrix44()); if (!newGraphicsLayer->drawsContent()) { if (renderLayer->usesCompositedScrolling()) { ASSERT(renderLayer->backing() && renderLayer->backing()->scrollingContentsLayer()); newGraphicsLayer = renderLayer->backing()->scrollingContentsLayer(); } else ASSERT_NOT_REACHED(); } if (m_currentGraphicsLayer != newGraphicsLayer) { if (m_currentGraphicsLayer) clearGraphicsLayerLinkHighlightPointer(); m_currentGraphicsLayer = newGraphicsLayer; m_currentGraphicsLayer->setLinkHighlight(this); } return renderLayer; }
RenderLayer* LinkHighlight::computeEnclosingCompositingLayer() { if (!m_node || !m_node->renderer()) return 0; // Find the nearest enclosing composited layer and attach to it. We may need to cross frame boundaries // to find a suitable layer. RenderLayerModelObject* renderer = toRenderLayerModelObject(m_node->renderer()); RenderLayerModelObject* repaintContainer; do { repaintContainer = renderer->containerForRepaint(); if (!repaintContainer) { renderer = renderer->frame()->ownerRenderer(); if (!renderer) return 0; } } while (!repaintContainer); RenderLayer* renderLayer = repaintContainer->layer(); if (!renderLayer || !renderLayer->isComposited()) return 0; GraphicsLayerChromium* newGraphicsLayer = static_cast<GraphicsLayerChromium*>(renderLayer->backing()->graphicsLayer()); m_clipLayer->setSublayerTransform(SkMatrix44()); m_usingNonCompositedContentHost = !newGraphicsLayer->drawsContent(); if (m_usingNonCompositedContentHost ) { m_clipLayer->setSublayerTransform(newGraphicsLayer->platformLayer()->transform()); newGraphicsLayer = static_cast<GraphicsLayerChromium*>(m_owningWebViewImpl->nonCompositedContentHost()->topLevelRootLayer()); } if (m_currentGraphicsLayer != newGraphicsLayer) { if (m_currentGraphicsLayer) clearGraphicsLayerLinkHighlightPointer(); m_currentGraphicsLayer = newGraphicsLayer; m_currentGraphicsLayer->setLinkHighlight(this); } return renderLayer; }