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

Side by Side Diff: Source/WebKit/chromium/src/LinkHighlight.cpp

Issue 13959008: Remove NonCompositedContentHost (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: one more Created 7 years, 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
11 * notice, this list of conditions and the following disclaimer in the 11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution. 12 * documentation and/or other materials provided with the distribution.
13 * 13 *
14 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY 14 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
15 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 15 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
16 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 16 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
17 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY 17 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
18 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 18 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
19 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 19 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
20 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 20 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
21 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 21 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
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 "NonCompositedContentHost.h"
31 #include "SkMatrix44.h" 30 #include "SkMatrix44.h"
32 #include "WebFrameImpl.h" 31 #include "WebFrameImpl.h"
33 #include "WebKit.h" 32 #include "WebKit.h"
34 #include "WebViewImpl.h" 33 #include "WebViewImpl.h"
35 #include "core/dom/Node.h" 34 #include "core/dom/Node.h"
36 #include "core/page/Frame.h" 35 #include "core/page/Frame.h"
37 #include "core/page/FrameView.h" 36 #include "core/page/FrameView.h"
38 #include "core/platform/graphics/Color.h" 37 #include "core/platform/graphics/Color.h"
39 #include "core/rendering/RenderLayer.h" 38 #include "core/rendering/RenderLayer.h"
40 #include "core/rendering/RenderLayerBacking.h" 39 #include "core/rendering/RenderLayerBacking.h"
(...skipping 18 matching lines...) Expand all
59 58
60 PassOwnPtr<LinkHighlight> LinkHighlight::create(Node* node, WebViewImpl* owningW ebViewImpl) 59 PassOwnPtr<LinkHighlight> LinkHighlight::create(Node* node, WebViewImpl* owningW ebViewImpl)
61 { 60 {
62 return adoptPtr(new LinkHighlight(node, owningWebViewImpl)); 61 return adoptPtr(new LinkHighlight(node, owningWebViewImpl));
63 } 62 }
64 63
65 LinkHighlight::LinkHighlight(Node* node, WebViewImpl* owningWebViewImpl) 64 LinkHighlight::LinkHighlight(Node* node, WebViewImpl* owningWebViewImpl)
66 : m_node(node) 65 : m_node(node)
67 , m_owningWebViewImpl(owningWebViewImpl) 66 , m_owningWebViewImpl(owningWebViewImpl)
68 , m_currentGraphicsLayer(0) 67 , m_currentGraphicsLayer(0)
69 , m_usingNonCompositedContentHost(false)
70 , m_geometryNeedsUpdate(false) 68 , m_geometryNeedsUpdate(false)
71 , m_isAnimating(false) 69 , m_isAnimating(false)
72 , m_startTime(monotonicallyIncreasingTime()) 70 , m_startTime(monotonicallyIncreasingTime())
73 { 71 {
74 ASSERT(m_node); 72 ASSERT(m_node);
75 ASSERT(owningWebViewImpl); 73 ASSERT(owningWebViewImpl);
76 WebCompositorSupport* compositorSupport = Platform::current()->compositorSup port(); 74 WebCompositorSupport* compositorSupport = Platform::current()->compositorSup port();
77 m_contentLayer = adoptPtr(compositorSupport->createContentLayer(this)); 75 m_contentLayer = adoptPtr(compositorSupport->createContentLayer(this));
78 m_clipLayer = adoptPtr(compositorSupport->createLayer()); 76 m_clipLayer = adoptPtr(compositorSupport->createLayer());
79 m_clipLayer->setAnchorPoint(WebFloatPoint()); 77 m_clipLayer->setAnchorPoint(WebFloatPoint());
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 if (!renderer) 120 if (!renderer)
123 return 0; 121 return 0;
124 } 122 }
125 } while (!repaintContainer); 123 } while (!repaintContainer);
126 RenderLayer* renderLayer = repaintContainer->layer(); 124 RenderLayer* renderLayer = repaintContainer->layer();
127 125
128 if (!renderLayer || !renderLayer->isComposited()) 126 if (!renderLayer || !renderLayer->isComposited())
129 return 0; 127 return 0;
130 128
131 GraphicsLayerChromium* newGraphicsLayer = static_cast<GraphicsLayerChromium* >(renderLayer->backing()->graphicsLayer()); 129 GraphicsLayerChromium* newGraphicsLayer = static_cast<GraphicsLayerChromium* >(renderLayer->backing()->graphicsLayer());
132 m_clipLayer->setSublayerTransform(SkMatrix44());
133 m_usingNonCompositedContentHost = !newGraphicsLayer->drawsContent();
134 if (m_usingNonCompositedContentHost ) {
135 m_clipLayer->setSublayerTransform(newGraphicsLayer->platformLayer()->tra nsform());
136 newGraphicsLayer = static_cast<GraphicsLayerChromium*>(m_owningWebViewIm pl->nonCompositedContentHost()->topLevelRootLayer());
137 }
138
139 if (m_currentGraphicsLayer != newGraphicsLayer) { 130 if (m_currentGraphicsLayer != newGraphicsLayer) {
140 if (m_currentGraphicsLayer) 131 if (m_currentGraphicsLayer)
141 clearGraphicsLayerLinkHighlightPointer(); 132 clearGraphicsLayerLinkHighlightPointer();
142 133
143 m_currentGraphicsLayer = newGraphicsLayer; 134 m_currentGraphicsLayer = newGraphicsLayer;
144 m_currentGraphicsLayer->setLinkHighlight(this); 135 m_currentGraphicsLayer->setLinkHighlight(this);
145 } 136 }
146 137
147 return renderLayer; 138 return renderLayer;
148 } 139 }
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 return false; 181 return false;
191 182
192 ASSERT(compositingLayer); 183 ASSERT(compositingLayer);
193 184
194 // Get quads for node in absolute coordinates. 185 // Get quads for node in absolute coordinates.
195 Vector<FloatQuad> quads; 186 Vector<FloatQuad> quads;
196 m_node->renderer()->absoluteQuads(quads); 187 m_node->renderer()->absoluteQuads(quads);
197 ASSERT(quads.size()); 188 ASSERT(quads.size());
198 189
199 FloatRect positionAdjust; 190 FloatRect positionAdjust;
200 if (!m_usingNonCompositedContentHost) { 191 const RenderStyle* style = m_node->renderer()->style();
201 const RenderStyle* style = m_node->renderer()->style(); 192 // If we have a box shadow, and are non-relative, then must manually adjust
202 // If we have a box shadow, and are non-relative, then must manually adj ust 193 // for its size.
203 // for its size. 194 if (const ShadowData* shadow = style->boxShadow()) {
204 if (const ShadowData* shadow = style->boxShadow()) { 195 int outlineSize = m_node->renderer()->outlineStyleForRepaint()->outlineS ize();
205 int outlineSize = m_node->renderer()->outlineStyleForRepaint()->outl ineSize(); 196 shadow->adjustRectForShadow(positionAdjust, outlineSize);
206 shadow->adjustRectForShadow(positionAdjust, outlineSize); 197 }
207 }
208 198
209 // If absolute or fixed, need to subtract out our fixed positioning. 199 // If absolute or fixed, need to subtract out our fixed positioning.
210 // FIXME: should we use RenderLayer::staticBlockPosition() here instead? 200 // FIXME: should we use RenderLayer::staticBlockPosition() here instead?
211 // Perhaps consider this if out-of-flow elements cause further problems. 201 // Perhaps consider this if out-of-flow elements cause further problems.
212 if (m_node->renderer()->isOutOfFlowPositioned()) { 202 if (m_node->renderer()->isOutOfFlowPositioned()) {
213 FloatPoint delta(style->left().getFloatValue(), style->top().getFloa tValue()); 203 FloatPoint delta(style->left().getFloatValue(), style->top().getFloatVal ue());
214 positionAdjust.moveBy(delta); 204 positionAdjust.moveBy(delta);
215 }
216 } 205 }
217 206
218 Path newPath; 207 Path newPath;
219 for (unsigned quadIndex = 0; quadIndex < quads.size(); ++quadIndex) { 208 for (unsigned quadIndex = 0; quadIndex < quads.size(); ++quadIndex) {
220 209
221 FloatQuad localQuad = m_node->renderer()->absoluteToLocalQuad(quads[quad Index], UseTransforms); 210 FloatQuad localQuad = m_node->renderer()->absoluteToLocalQuad(quads[quad Index], UseTransforms);
222 localQuad.move(-positionAdjust.location().x(), -positionAdjust.location( ).y()); 211 localQuad.move(-positionAdjust.location().x(), -positionAdjust.location( ).y());
223 FloatQuad absoluteQuad = m_node->renderer()->localToAbsoluteQuad(localQu ad, UseTransforms); 212 FloatQuad absoluteQuad = m_node->renderer()->localToAbsoluteQuad(localQu ad, UseTransforms);
224 213
225 // Transform node quads in target absolute coords to local coordinates i n the compositor layer. 214 // Transform node quads in target absolute coords to local coordinates i n the compositor layer.
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 // Make sure we update geometry on the next callback from WebViewImpl::layou t(). 340 // Make sure we update geometry on the next callback from WebViewImpl::layou t().
352 m_geometryNeedsUpdate = true; 341 m_geometryNeedsUpdate = true;
353 } 342 }
354 343
355 WebLayer* LinkHighlight::layer() 344 WebLayer* LinkHighlight::layer()
356 { 345 {
357 return clipLayer(); 346 return clipLayer();
358 } 347 }
359 348
360 } // namespace WeKit 349 } // namespace WeKit
OLDNEW
« no previous file with comments | « Source/WebKit/chromium/src/LinkHighlight.h ('k') | Source/WebKit/chromium/src/NonCompositedContentHost.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698