| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 */ | 24 */ |
| 25 | 25 |
| 26 #include "config.h" | 26 #include "config.h" |
| 27 | 27 |
| 28 #include "LinkHighlight.h" | 28 #include "LinkHighlight.h" |
| 29 | 29 |
| 30 #include "Color.h" | 30 #include "Color.h" |
| 31 #include "Frame.h" | 31 #include "Frame.h" |
| 32 #include "FrameView.h" | 32 #include "FrameView.h" |
| 33 #include "Node.h" | 33 #include "Node.h" |
| 34 #include "NonCompositedContentHost.h" | |
| 35 #include "PlatformContextSkia.h" | 34 #include "PlatformContextSkia.h" |
| 36 #include "RenderLayer.h" | 35 #include "RenderLayer.h" |
| 37 #include "RenderLayerBacking.h" | 36 #include "RenderLayerBacking.h" |
| 38 #include "RenderLayerModelObject.h" | 37 #include "RenderLayerModelObject.h" |
| 39 #include "RenderObject.h" | 38 #include "RenderObject.h" |
| 40 #include "RenderView.h" | 39 #include "RenderView.h" |
| 41 #include "ShadowData.h" | 40 #include "ShadowData.h" |
| 42 #include "SkMatrix44.h" | 41 #include "SkMatrix44.h" |
| 43 #include "WebFrameImpl.h" | 42 #include "WebFrameImpl.h" |
| 44 #include "WebKit.h" | 43 #include "WebKit.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 60 | 59 |
| 61 PassOwnPtr<LinkHighlight> LinkHighlight::create(Node* node, WebViewImpl* owningW
ebViewImpl) | 60 PassOwnPtr<LinkHighlight> LinkHighlight::create(Node* node, WebViewImpl* owningW
ebViewImpl) |
| 62 { | 61 { |
| 63 return adoptPtr(new LinkHighlight(node, owningWebViewImpl)); | 62 return adoptPtr(new LinkHighlight(node, owningWebViewImpl)); |
| 64 } | 63 } |
| 65 | 64 |
| 66 LinkHighlight::LinkHighlight(Node* node, WebViewImpl* owningWebViewImpl) | 65 LinkHighlight::LinkHighlight(Node* node, WebViewImpl* owningWebViewImpl) |
| 67 : m_node(node) | 66 : m_node(node) |
| 68 , m_owningWebViewImpl(owningWebViewImpl) | 67 , m_owningWebViewImpl(owningWebViewImpl) |
| 69 , m_currentGraphicsLayer(0) | 68 , m_currentGraphicsLayer(0) |
| 70 , m_usingNonCompositedContentHost(false) | |
| 71 , m_geometryNeedsUpdate(false) | 69 , m_geometryNeedsUpdate(false) |
| 72 , m_isAnimating(false) | 70 , m_isAnimating(false) |
| 73 , m_startTime(monotonicallyIncreasingTime()) | 71 , m_startTime(monotonicallyIncreasingTime()) |
| 74 { | 72 { |
| 75 ASSERT(m_node); | 73 ASSERT(m_node); |
| 76 ASSERT(owningWebViewImpl); | 74 ASSERT(owningWebViewImpl); |
| 77 WebCompositorSupport* compositorSupport = Platform::current()->compositorSup
port(); | 75 WebCompositorSupport* compositorSupport = Platform::current()->compositorSup
port(); |
| 78 m_contentLayer = adoptPtr(compositorSupport->createContentLayer(this)); | 76 m_contentLayer = adoptPtr(compositorSupport->createContentLayer(this)); |
| 79 m_clipLayer = adoptPtr(compositorSupport->createLayer()); | 77 m_clipLayer = adoptPtr(compositorSupport->createLayer()); |
| 80 m_clipLayer->setAnchorPoint(WebFloatPoint()); | 78 m_clipLayer->setAnchorPoint(WebFloatPoint()); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 renderer = renderer->frame()->ownerRenderer(); | 120 renderer = renderer->frame()->ownerRenderer(); |
| 123 if (!renderer) | 121 if (!renderer) |
| 124 return 0; | 122 return 0; |
| 125 } | 123 } |
| 126 } while (!repaintContainer); | 124 } while (!repaintContainer); |
| 127 RenderLayer* renderLayer = repaintContainer->layer(); | 125 RenderLayer* renderLayer = repaintContainer->layer(); |
| 128 | 126 |
| 129 if (!renderLayer || !renderLayer->isComposited()) | 127 if (!renderLayer || !renderLayer->isComposited()) |
| 130 return 0; | 128 return 0; |
| 131 | 129 |
| 132 GraphicsLayerChromium* newGraphicsLayer = static_cast<GraphicsLayerChromium*
>(renderLayer->backing()->graphicsLayer()); | |
| 133 m_clipLayer->setSublayerTransform(SkMatrix44()); | |
| 134 m_usingNonCompositedContentHost = !newGraphicsLayer->drawsContent(); | |
| 135 if (m_usingNonCompositedContentHost ) { | |
| 136 m_clipLayer->setSublayerTransform(newGraphicsLayer->platformLayer()->tra
nsform()); | |
| 137 newGraphicsLayer = static_cast<GraphicsLayerChromium*>(m_owningWebViewIm
pl->nonCompositedContentHost()->topLevelRootLayer()); | |
| 138 } | |
| 139 | |
| 140 if (m_currentGraphicsLayer != newGraphicsLayer) { | |
| 141 if (m_currentGraphicsLayer) | |
| 142 clearGraphicsLayerLinkHighlightPointer(); | |
| 143 | |
| 144 m_currentGraphicsLayer = newGraphicsLayer; | |
| 145 m_currentGraphicsLayer->setLinkHighlight(this); | |
| 146 } | |
| 147 | |
| 148 return renderLayer; | 130 return renderLayer; |
| 149 } | 131 } |
| 150 | 132 |
| 151 static void convertTargetSpaceQuadToCompositedLayer(const FloatQuad& targetSpace
Quad, RenderObject* targetRenderer, RenderObject* compositedRenderer, FloatQuad&
compositedSpaceQuad) | 133 static void convertTargetSpaceQuadToCompositedLayer(const FloatQuad& targetSpace
Quad, RenderObject* targetRenderer, RenderObject* compositedRenderer, FloatQuad&
compositedSpaceQuad) |
| 152 { | 134 { |
| 153 ASSERT(targetRenderer); | 135 ASSERT(targetRenderer); |
| 154 ASSERT(compositedRenderer); | 136 ASSERT(compositedRenderer); |
| 155 | 137 |
| 156 for (unsigned i = 0; i < 4; ++i) { | 138 for (unsigned i = 0; i < 4; ++i) { |
| 157 IntPoint point; | 139 IntPoint point; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 return false; | 173 return false; |
| 192 | 174 |
| 193 ASSERT(compositingLayer); | 175 ASSERT(compositingLayer); |
| 194 | 176 |
| 195 // Get quads for node in absolute coordinates. | 177 // Get quads for node in absolute coordinates. |
| 196 Vector<FloatQuad> quads; | 178 Vector<FloatQuad> quads; |
| 197 m_node->renderer()->absoluteQuads(quads); | 179 m_node->renderer()->absoluteQuads(quads); |
| 198 ASSERT(quads.size()); | 180 ASSERT(quads.size()); |
| 199 | 181 |
| 200 FloatRect positionAdjust; | 182 FloatRect positionAdjust; |
| 201 if (!m_usingNonCompositedContentHost) { | 183 const RenderStyle* style = m_node->renderer()->style(); |
| 202 const RenderStyle* style = m_node->renderer()->style(); | 184 // If we have a box shadow, and are non-relative, then must manually adjust |
| 203 // If we have a box shadow, and are non-relative, then must manually adj
ust | 185 // for its size. |
| 204 // for its size. | 186 if (const ShadowData* shadow = style->boxShadow()) { |
| 205 if (const ShadowData* shadow = style->boxShadow()) { | 187 int outlineSize = m_node->renderer()->outlineStyleForRepaint()->outlineS
ize(); |
| 206 int outlineSize = m_node->renderer()->outlineStyleForRepaint()->outl
ineSize(); | 188 shadow->adjustRectForShadow(positionAdjust, outlineSize); |
| 207 shadow->adjustRectForShadow(positionAdjust, outlineSize); | 189 } |
| 208 } | |
| 209 | 190 |
| 210 // If absolute or fixed, need to subtract out our fixed positioning. | 191 // If absolute or fixed, need to subtract out our fixed positioning. |
| 211 // FIXME: should we use RenderLayer::staticBlockPosition() here instead? | 192 // FIXME: should we use RenderLayer::staticBlockPosition() here instead? |
| 212 // Perhaps consider this if out-of-flow elements cause further problems. | 193 // Perhaps consider this if out-of-flow elements cause further problems. |
| 213 if (m_node->renderer()->isOutOfFlowPositioned()) { | 194 if (m_node->renderer()->isOutOfFlowPositioned()) { |
| 214 FloatPoint delta(style->left().getFloatValue(), style->top().getFloa
tValue()); | 195 FloatPoint delta(style->left().getFloatValue(), style->top().getFloatVal
ue()); |
| 215 positionAdjust.moveBy(delta); | 196 positionAdjust.moveBy(delta); |
| 216 } | |
| 217 } | 197 } |
| 218 | 198 |
| 219 Path newPath; | 199 Path newPath; |
| 220 for (unsigned quadIndex = 0; quadIndex < quads.size(); ++quadIndex) { | 200 for (unsigned quadIndex = 0; quadIndex < quads.size(); ++quadIndex) { |
| 221 | 201 |
| 222 FloatQuad localQuad = m_node->renderer()->absoluteToLocalQuad(quads[quad
Index], UseTransforms); | 202 FloatQuad localQuad = m_node->renderer()->absoluteToLocalQuad(quads[quad
Index], UseTransforms); |
| 223 localQuad.move(-positionAdjust.location().x(), -positionAdjust.location(
).y()); | 203 localQuad.move(-positionAdjust.location().x(), -positionAdjust.location(
).y()); |
| 224 FloatQuad absoluteQuad = m_node->renderer()->localToAbsoluteQuad(localQu
ad, UseTransforms); | 204 FloatQuad absoluteQuad = m_node->renderer()->localToAbsoluteQuad(localQu
ad, UseTransforms); |
| 225 | 205 |
| 226 // Transform node quads in target absolute coords to local coordinates i
n the compositor layer. | 206 // Transform node quads in target absolute coords to local coordinates i
n the compositor layer. |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 350 // Make sure we update geometry on the next callback from WebViewImpl::layou
t(). | 330 // Make sure we update geometry on the next callback from WebViewImpl::layou
t(). |
| 351 m_geometryNeedsUpdate = true; | 331 m_geometryNeedsUpdate = true; |
| 352 } | 332 } |
| 353 | 333 |
| 354 WebLayer* LinkHighlight::layer() | 334 WebLayer* LinkHighlight::layer() |
| 355 { | 335 { |
| 356 return clipLayer(); | 336 return clipLayer(); |
| 357 } | 337 } |
| 358 | 338 |
| 359 } // namespace WeKit | 339 } // namespace WeKit |
| OLD | NEW |