OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2009, Google Inc. All rights reserved. | 2 * Copyright (c) 2009, 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 are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * 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 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 17 matching lines...) Expand all Loading... |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #include "config.h" | 31 #include "config.h" |
32 | 32 |
33 #include "core/rendering/svg/RenderSVGModelObject.h" | 33 #include "core/rendering/svg/RenderSVGModelObject.h" |
34 | 34 |
35 #include "SVGNames.h" | 35 #include "SVGNames.h" |
36 #include "core/rendering/svg/RenderSVGRoot.h" | 36 #include "core/rendering/svg/RenderSVGRoot.h" |
37 #include "core/rendering/svg/SVGResourcesCache.h" | 37 #include "core/rendering/svg/SVGResourcesCache.h" |
38 #include "core/svg/SVGElement.h" | 38 #include "core/svg/SVGGraphicsElement.h" |
39 | 39 |
40 namespace WebCore { | 40 namespace WebCore { |
41 | 41 |
42 RenderSVGModelObject::RenderSVGModelObject(SVGElement* node) | 42 RenderSVGModelObject::RenderSVGModelObject(SVGElement* node) |
43 : RenderObject(node) | 43 : RenderObject(node) |
44 { | 44 { |
45 } | 45 } |
46 | 46 |
47 LayoutRect RenderSVGModelObject::clippedOverflowRectForRepaint(const RenderLayer
ModelObject* repaintContainer) const | 47 LayoutRect RenderSVGModelObject::clippedOverflowRectForRepaint(const RenderLayer
ModelObject* repaintContainer) const |
48 { | 48 { |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 RenderObject::styleDidChange(diff, oldStyle); | 116 RenderObject::styleDidChange(diff, oldStyle); |
117 SVGResourcesCache::clientStyleChanged(this, diff, style()); | 117 SVGResourcesCache::clientStyleChanged(this, diff, style()); |
118 } | 118 } |
119 | 119 |
120 bool RenderSVGModelObject::nodeAtPoint(const HitTestRequest&, HitTestResult&, co
nst HitTestLocation&, const LayoutPoint&, HitTestAction) | 120 bool RenderSVGModelObject::nodeAtPoint(const HitTestRequest&, HitTestResult&, co
nst HitTestLocation&, const LayoutPoint&, HitTestAction) |
121 { | 121 { |
122 ASSERT_NOT_REACHED(); | 122 ASSERT_NOT_REACHED(); |
123 return false; | 123 return false; |
124 } | 124 } |
125 | 125 |
126 static void getElementCTM(SVGElement* element, AffineTransform& transform) | 126 static void getElementCTM(SVGGraphicsElement* element, AffineTransform& transfor
m) |
127 { | 127 { |
128 ASSERT(element); | 128 ASSERT(element); |
129 element->document().updateLayoutIgnorePendingStylesheets(); | 129 element->document().updateLayoutIgnorePendingStylesheets(); |
130 | 130 |
131 SVGElement* stopAtElement = SVGLocatable::nearestViewportElement(element); | 131 SVGElement* stopAtElement = element->nearestViewportElement(); |
132 ASSERT(stopAtElement); | 132 ASSERT(stopAtElement); |
133 | 133 |
134 AffineTransform localTransform; | 134 AffineTransform localTransform; |
135 Node* current = element; | 135 Node* current = element; |
136 | 136 |
137 while (current && current->isSVGElement()) { | 137 while (current && current->isSVGElement()) { |
138 SVGElement* currentElement = toSVGElement(current); | 138 SVGElement* currentElement = toSVGElement(current); |
139 localTransform = currentElement->renderer()->localToParentTransform(); | 139 localTransform = currentElement->renderer()->localToParentTransform(); |
140 transform = localTransform.multiply(transform); | 140 transform = localTransform.multiply(transform); |
141 // For getCTM() computation, stop at the nearest viewport element | 141 // For getCTM() computation, stop at the nearest viewport element |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 quads.append(localToAbsoluteQuad(FloatQuad(repaintRectInLocalCoordinates()))
); | 175 quads.append(localToAbsoluteQuad(FloatQuad(repaintRectInLocalCoordinates()))
); |
176 } | 176 } |
177 | 177 |
178 bool RenderSVGModelObject::checkIntersection(RenderObject* renderer, const SVGRe
ct& rect) | 178 bool RenderSVGModelObject::checkIntersection(RenderObject* renderer, const SVGRe
ct& rect) |
179 { | 179 { |
180 if (!renderer || renderer->style()->pointerEvents() == PE_NONE) | 180 if (!renderer || renderer->style()->pointerEvents() == PE_NONE) |
181 return false; | 181 return false; |
182 if (!isGraphicsElement(renderer)) | 182 if (!isGraphicsElement(renderer)) |
183 return false; | 183 return false; |
184 AffineTransform ctm; | 184 AffineTransform ctm; |
185 SVGElement* svgElement = toSVGElement(renderer->node()); | 185 SVGGraphicsElement* svgElement = toSVGGraphicsElement(renderer->node()); |
186 getElementCTM(svgElement, ctm); | 186 getElementCTM(svgElement, ctm); |
187 ASSERT(svgElement->renderer()); | 187 ASSERT(svgElement->renderer()); |
188 return intersectsAllowingEmpty(rect, ctm.mapRect(svgElement->renderer()->rep
aintRectInLocalCoordinates())); | 188 return intersectsAllowingEmpty(rect, ctm.mapRect(svgElement->renderer()->rep
aintRectInLocalCoordinates())); |
189 } | 189 } |
190 | 190 |
191 bool RenderSVGModelObject::checkEnclosure(RenderObject* renderer, const SVGRect&
rect) | 191 bool RenderSVGModelObject::checkEnclosure(RenderObject* renderer, const SVGRect&
rect) |
192 { | 192 { |
193 if (!renderer || renderer->style()->pointerEvents() == PE_NONE) | 193 if (!renderer || renderer->style()->pointerEvents() == PE_NONE) |
194 return false; | 194 return false; |
195 if (!isGraphicsElement(renderer)) | 195 if (!isGraphicsElement(renderer)) |
196 return false; | 196 return false; |
197 AffineTransform ctm; | 197 AffineTransform ctm; |
198 SVGElement* svgElement = toSVGElement(renderer->node()); | 198 SVGGraphicsElement* svgElement = toSVGGraphicsElement(renderer->node()); |
199 getElementCTM(svgElement, ctm); | 199 getElementCTM(svgElement, ctm); |
200 ASSERT(svgElement->renderer()); | 200 ASSERT(svgElement->renderer()); |
201 return rect.contains(ctm.mapRect(svgElement->renderer()->repaintRectInLocalC
oordinates())); | 201 return rect.contains(ctm.mapRect(svgElement->renderer()->repaintRectInLocalC
oordinates())); |
202 } | 202 } |
203 | 203 |
204 } // namespace WebCore | 204 } // namespace WebCore |
OLD | NEW |