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

Side by Side Diff: Source/web/LinkHighlight.cpp

Issue 898783003: Move rendering/RenderLayer* to layout/ (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 10 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
« no previous file with comments | « Source/web/LinkHighlight.h ('k') | Source/web/PageWidgetDelegate.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
(...skipping 14 matching lines...) Expand all
25 25
26 #include "config.h" 26 #include "config.h"
27 27
28 #include "web/LinkHighlight.h" 28 #include "web/LinkHighlight.h"
29 29
30 #include "SkMatrix44.h" 30 #include "SkMatrix44.h"
31 #include "core/dom/Node.h" 31 #include "core/dom/Node.h"
32 #include "core/dom/NodeRenderingTraversal.h" 32 #include "core/dom/NodeRenderingTraversal.h"
33 #include "core/frame/FrameView.h" 33 #include "core/frame/FrameView.h"
34 #include "core/frame/LocalFrame.h" 34 #include "core/frame/LocalFrame.h"
35 #include "core/layout/Layer.h"
36 #include "core/layout/LayoutLayerModelObject.h"
35 #include "core/layout/compositing/CompositedLayerMapping.h" 37 #include "core/layout/compositing/CompositedLayerMapping.h"
36 #include "core/rendering/RenderLayer.h"
37 #include "core/rendering/RenderLayerModelObject.h"
38 #include "core/rendering/RenderObject.h" 38 #include "core/rendering/RenderObject.h"
39 #include "core/rendering/RenderPart.h" 39 #include "core/rendering/RenderPart.h"
40 #include "core/rendering/RenderView.h" 40 #include "core/rendering/RenderView.h"
41 #include "core/rendering/style/ShadowData.h" 41 #include "core/rendering/style/ShadowData.h"
42 #include "platform/graphics/Color.h" 42 #include "platform/graphics/Color.h"
43 #include "platform/graphics/paint/DisplayItemList.h" 43 #include "platform/graphics/paint/DisplayItemList.h"
44 #include "platform/graphics/paint/DrawingRecorder.h" 44 #include "platform/graphics/paint/DrawingRecorder.h"
45 #include "public/platform/Platform.h" 45 #include "public/platform/Platform.h"
46 #include "public/platform/WebCompositorAnimationCurve.h" 46 #include "public/platform/WebCompositorAnimationCurve.h"
47 #include "public/platform/WebCompositorSupport.h" 47 #include "public/platform/WebCompositorSupport.h"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 WebLayer* LinkHighlight::clipLayer() 100 WebLayer* LinkHighlight::clipLayer()
101 { 101 {
102 return m_clipLayer.get(); 102 return m_clipLayer.get();
103 } 103 }
104 104
105 void LinkHighlight::releaseResources() 105 void LinkHighlight::releaseResources()
106 { 106 {
107 m_node.clear(); 107 m_node.clear();
108 } 108 }
109 109
110 void LinkHighlight::attachLinkHighlightToCompositingLayer(const RenderLayerModel Object* paintInvalidationContainer) 110 void LinkHighlight::attachLinkHighlightToCompositingLayer(const LayoutLayerModel Object* paintInvalidationContainer)
111 { 111 {
112 GraphicsLayer* newGraphicsLayer = paintInvalidationContainer->layer()->graph icsLayerBacking(); 112 GraphicsLayer* newGraphicsLayer = paintInvalidationContainer->layer()->graph icsLayerBacking();
113 if (!newGraphicsLayer->drawsContent()) 113 if (!newGraphicsLayer->drawsContent())
114 newGraphicsLayer = paintInvalidationContainer->layer()->graphicsLayerBac kingForScrolling(); 114 newGraphicsLayer = paintInvalidationContainer->layer()->graphicsLayerBac kingForScrolling();
115 if (!newGraphicsLayer) 115 if (!newGraphicsLayer)
116 return; 116 return;
117 117
118 m_clipLayer->setTransform(SkMatrix44(SkMatrix44::kIdentity_Constructor)); 118 m_clipLayer->setTransform(SkMatrix44(SkMatrix44::kIdentity_Constructor));
119 119
120 if (m_currentGraphicsLayer != newGraphicsLayer) { 120 if (m_currentGraphicsLayer != newGraphicsLayer) {
121 if (m_currentGraphicsLayer) 121 if (m_currentGraphicsLayer)
122 clearGraphicsLayerLinkHighlightPointer(); 122 clearGraphicsLayerLinkHighlightPointer();
123 123
124 m_currentGraphicsLayer = newGraphicsLayer; 124 m_currentGraphicsLayer = newGraphicsLayer;
125 m_currentGraphicsLayer->addLinkHighlight(this); 125 m_currentGraphicsLayer->addLinkHighlight(this);
126 } 126 }
127 } 127 }
128 128
129 static void convertTargetSpaceQuadToCompositedLayer(const FloatQuad& targetSpace Quad, RenderObject* targetRenderer, const RenderLayerModelObject* paintInvalidat ionContainer, FloatQuad& compositedSpaceQuad) 129 static void convertTargetSpaceQuadToCompositedLayer(const FloatQuad& targetSpace Quad, RenderObject* targetRenderer, const LayoutLayerModelObject* paintInvalidat ionContainer, FloatQuad& compositedSpaceQuad)
130 { 130 {
131 ASSERT(targetRenderer); 131 ASSERT(targetRenderer);
132 ASSERT(paintInvalidationContainer); 132 ASSERT(paintInvalidationContainer);
133 for (unsigned i = 0; i < 4; ++i) { 133 for (unsigned i = 0; i < 4; ++i) {
134 IntPoint point; 134 IntPoint point;
135 switch (i) { 135 switch (i) {
136 case 0: point = roundedIntPoint(targetSpaceQuad.p1()); break; 136 case 0: point = roundedIntPoint(targetSpaceQuad.p1()); break;
137 case 1: point = roundedIntPoint(targetSpaceQuad.p2()); break; 137 case 1: point = roundedIntPoint(targetSpaceQuad.p2()); break;
138 case 2: point = roundedIntPoint(targetSpaceQuad.p3()); break; 138 case 2: point = roundedIntPoint(targetSpaceQuad.p3()); break;
139 case 3: point = roundedIntPoint(targetSpaceQuad.p4()); break; 139 case 3: point = roundedIntPoint(targetSpaceQuad.p4()); break;
140 } 140 }
141 141
142 // FIXME: this does not need to be absolute, just in the paint invalidat ion container's space. 142 // FIXME: this does not need to be absolute, just in the paint invalidat ion container's space.
143 point = targetRenderer->frame()->view()->contentsToWindow(point); 143 point = targetRenderer->frame()->view()->contentsToWindow(point);
144 point = paintInvalidationContainer->frame()->view()->windowToContents(po int); 144 point = paintInvalidationContainer->frame()->view()->windowToContents(po int);
145 FloatPoint floatPoint = paintInvalidationContainer->absoluteToLocal(poin t, UseTransforms); 145 FloatPoint floatPoint = paintInvalidationContainer->absoluteToLocal(poin t, UseTransforms);
146 RenderLayer::mapPointToPaintBackingCoordinates(paintInvalidationContaine r, floatPoint); 146 Layer::mapPointToPaintBackingCoordinates(paintInvalidationContainer, flo atPoint);
147 147
148 switch (i) { 148 switch (i) {
149 case 0: compositedSpaceQuad.setP1(floatPoint); break; 149 case 0: compositedSpaceQuad.setP1(floatPoint); break;
150 case 1: compositedSpaceQuad.setP2(floatPoint); break; 150 case 1: compositedSpaceQuad.setP2(floatPoint); break;
151 case 2: compositedSpaceQuad.setP3(floatPoint); break; 151 case 2: compositedSpaceQuad.setP3(floatPoint); break;
152 case 3: compositedSpaceQuad.setP4(floatPoint); break; 152 case 3: compositedSpaceQuad.setP4(floatPoint); break;
153 } 153 }
154 } 154 }
155 } 155 }
156 156
(...skipping 21 matching lines...) Expand all
178 // boxes. 178 // boxes.
179 if (renderer->isRenderInline()) { 179 if (renderer->isRenderInline()) {
180 for (Node* child = NodeRenderingTraversal::firstChild(node); child; chil d = NodeRenderingTraversal::nextSibling(*child)) 180 for (Node* child = NodeRenderingTraversal::firstChild(node); child; chil d = NodeRenderingTraversal::nextSibling(*child))
181 computeQuads(*child, outQuads); 181 computeQuads(*child, outQuads);
182 } else { 182 } else {
183 // FIXME: this does not need to be absolute, just in the paint invalidat ion container's space. 183 // FIXME: this does not need to be absolute, just in the paint invalidat ion container's space.
184 renderer->absoluteQuads(outQuads); 184 renderer->absoluteQuads(outQuads);
185 } 185 }
186 } 186 }
187 187
188 bool LinkHighlight::computeHighlightLayerPathAndPosition(const RenderLayerModelO bject* paintInvalidationContainer) 188 bool LinkHighlight::computeHighlightLayerPathAndPosition(const LayoutLayerModelO bject* paintInvalidationContainer)
189 { 189 {
190 if (!m_node || !m_node->renderer() || !m_currentGraphicsLayer) 190 if (!m_node || !m_node->renderer() || !m_currentGraphicsLayer)
191 return false; 191 return false;
192 ASSERT(paintInvalidationContainer); 192 ASSERT(paintInvalidationContainer);
193 193
194 // Get quads for node in absolute coordinates. 194 // Get quads for node in absolute coordinates.
195 Vector<FloatQuad> quads; 195 Vector<FloatQuad> quads;
196 computeQuads(*m_node, quads); 196 computeQuads(*m_node, quads);
197 ASSERT(quads.size()); 197 ASSERT(quads.size());
198 Path newPath; 198 Path newPath;
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 void LinkHighlight::updateGeometry() 327 void LinkHighlight::updateGeometry()
328 { 328 {
329 // To avoid unnecessary updates (e.g. other entities have requested animatio ns from our WebViewImpl), 329 // To avoid unnecessary updates (e.g. other entities have requested animatio ns from our WebViewImpl),
330 // only proceed if we actually requested an update. 330 // only proceed if we actually requested an update.
331 if (!m_geometryNeedsUpdate) 331 if (!m_geometryNeedsUpdate)
332 return; 332 return;
333 333
334 m_geometryNeedsUpdate = false; 334 m_geometryNeedsUpdate = false;
335 335
336 bool hasRenderer = m_node && m_node->renderer(); 336 bool hasRenderer = m_node && m_node->renderer();
337 const RenderLayerModelObject* paintInvalidationContainer = hasRenderer ? m_n ode->renderer()->containerForPaintInvalidation() : 0; 337 const LayoutLayerModelObject* paintInvalidationContainer = hasRenderer ? m_n ode->renderer()->containerForPaintInvalidation() : 0;
338 if (paintInvalidationContainer) 338 if (paintInvalidationContainer)
339 attachLinkHighlightToCompositingLayer(paintInvalidationContainer); 339 attachLinkHighlightToCompositingLayer(paintInvalidationContainer);
340 if (paintInvalidationContainer && computeHighlightLayerPathAndPosition(paint InvalidationContainer)) { 340 if (paintInvalidationContainer && computeHighlightLayerPathAndPosition(paint InvalidationContainer)) {
341 // We only need to invalidate the layer if the highlight size has change d, otherwise 341 // We only need to invalidate the layer if the highlight size has change d, otherwise
342 // we can just re-position the layer without needing to repaint. 342 // we can just re-position the layer without needing to repaint.
343 m_contentLayer->layer()->invalidate(); 343 m_contentLayer->layer()->invalidate();
344 344
345 if (m_currentGraphicsLayer) 345 if (m_currentGraphicsLayer)
346 m_currentGraphicsLayer->addRepaintRect(FloatRect(layer()->position() .x, layer()->position().y, layer()->bounds().width, layer()->bounds().height)); 346 m_currentGraphicsLayer->addRepaintRect(FloatRect(layer()->position() .x, layer()->position().y, layer()->bounds().width, layer()->bounds().height));
347 } else if (!hasRenderer) { 347 } else if (!hasRenderer) {
(...skipping 13 matching lines...) Expand all
361 // Make sure we update geometry on the next callback from WebViewImpl::layou t(). 361 // Make sure we update geometry on the next callback from WebViewImpl::layou t().
362 m_geometryNeedsUpdate = true; 362 m_geometryNeedsUpdate = true;
363 } 363 }
364 364
365 WebLayer* LinkHighlight::layer() 365 WebLayer* LinkHighlight::layer()
366 { 366 {
367 return clipLayer(); 367 return clipLayer();
368 } 368 }
369 369
370 } // namespace blink 370 } // namespace blink
OLDNEW
« no previous file with comments | « Source/web/LinkHighlight.h ('k') | Source/web/PageWidgetDelegate.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698