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 16 matching lines...) Expand all Loading... |
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" | 35 #include "core/layout/Layer.h" |
36 #include "core/layout/LayoutLayerModelObject.h" | 36 #include "core/layout/LayoutLayerModelObject.h" |
| 37 #include "core/layout/LayoutObject.h" |
37 #include "core/layout/compositing/CompositedLayerMapping.h" | 38 #include "core/layout/compositing/CompositedLayerMapping.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" |
48 #include "public/platform/WebFloatAnimationCurve.h" | 48 #include "public/platform/WebFloatAnimationCurve.h" |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 LayoutLayerModelObject* paintInvalidat
ionContainer, FloatQuad& compositedSpaceQuad) | 129 static void convertTargetSpaceQuadToCompositedLayer(const FloatQuad& targetSpace
Quad, LayoutObject* 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; |
(...skipping 22 matching lines...) Expand all Loading... |
162 path.addLineTo(quad.p3()); | 162 path.addLineTo(quad.p3()); |
163 path.addLineTo(quad.p4()); | 163 path.addLineTo(quad.p4()); |
164 path.closeSubpath(); | 164 path.closeSubpath(); |
165 } | 165 } |
166 | 166 |
167 void LinkHighlight::computeQuads(const Node& node, Vector<FloatQuad>& outQuads)
const | 167 void LinkHighlight::computeQuads(const Node& node, Vector<FloatQuad>& outQuads)
const |
168 { | 168 { |
169 if (!node.renderer()) | 169 if (!node.renderer()) |
170 return; | 170 return; |
171 | 171 |
172 RenderObject* renderer = node.renderer(); | 172 LayoutObject* renderer = node.renderer(); |
173 | 173 |
174 // For inline elements, absoluteQuads will return a line box based on the li
ne-height | 174 // For inline elements, absoluteQuads will return a line box based on the li
ne-height |
175 // and font metrics, which is technically incorrect as replaced elements lik
e images | 175 // and font metrics, which is technically incorrect as replaced elements lik
e images |
176 // should use their intristic height and expand the linebox as needed. To g
et an | 176 // should use their intristic height and expand the linebox as needed. To g
et an |
177 // appropriately sized highlight we descend into the children and have them
add their | 177 // appropriately sized highlight we descend into the children and have them
add their |
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 { |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 |
OLD | NEW |