OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> | 2 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> |
3 * Copyright (C) 2004, 2005, 2007, 2008 Rob Buis <buis@kde.org> | 3 * Copyright (C) 2004, 2005, 2007, 2008 Rob Buis <buis@kde.org> |
4 * Copyright (C) 2007 Eric Seidel <eric@webkit.org> | 4 * Copyright (C) 2007 Eric Seidel <eric@webkit.org> |
5 * Copyright (C) 2009 Google, Inc. All rights reserved. | 5 * Copyright (C) 2009 Google, Inc. All rights reserved. |
6 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> | 6 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> |
7 * | 7 * |
8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 { | 110 { |
111 ANNOTATE_GRAPHICS_CONTEXT(paintInfo, this); | 111 ANNOTATE_GRAPHICS_CONTEXT(paintInfo, this); |
112 | 112 |
113 if (paintInfo.context->paintingDisabled()) | 113 if (paintInfo.context->paintingDisabled()) |
114 return; | 114 return; |
115 | 115 |
116 // Spec: groups w/o children still may render filter content. | 116 // Spec: groups w/o children still may render filter content. |
117 if (!firstChild() && !selfWillPaint()) | 117 if (!firstChild() && !selfWillPaint()) |
118 return; | 118 return; |
119 | 119 |
120 FloatRect repaintRect = repaintRectInLocalCoordinates(); | 120 FloatRect repaintRect = paintInvalidationRectInLocalCoordinates(); |
121 if (!SVGRenderSupport::paintInfoIntersectsRepaintRect(repaintRect, localToPa
rentTransform(), paintInfo)) | 121 if (!SVGRenderSupport::paintInfoIntersectsRepaintRect(repaintRect, localToPa
rentTransform(), paintInfo)) |
122 return; | 122 return; |
123 | 123 |
124 PaintInfo childPaintInfo(paintInfo); | 124 PaintInfo childPaintInfo(paintInfo); |
125 { | 125 { |
126 GraphicsContextStateSaver stateSaver(*childPaintInfo.context); | 126 GraphicsContextStateSaver stateSaver(*childPaintInfo.context); |
127 | 127 |
128 // Let the RenderSVGViewportContainer subclass clip if necessary | 128 // Let the RenderSVGViewportContainer subclass clip if necessary |
129 applyViewportClip(childPaintInfo); | 129 applyViewportClip(childPaintInfo); |
130 | 130 |
131 childPaintInfo.applyTransform(localToParentTransform()); | 131 childPaintInfo.applyTransform(localToParentTransform()); |
132 | 132 |
133 SVGRenderingContext renderingContext; | 133 SVGRenderingContext renderingContext; |
134 GraphicsContextCullSaver cullSaver(*childPaintInfo.context); | 134 GraphicsContextCullSaver cullSaver(*childPaintInfo.context); |
135 bool continueRendering = true; | 135 bool continueRendering = true; |
136 if (childPaintInfo.phase == PaintPhaseForeground) { | 136 if (childPaintInfo.phase == PaintPhaseForeground) { |
137 renderingContext.prepareToRenderSVGContent(this, childPaintInfo); | 137 renderingContext.prepareToRenderSVGContent(this, childPaintInfo); |
138 continueRendering = renderingContext.isRenderingPrepared(); | 138 continueRendering = renderingContext.isRenderingPrepared(); |
139 | 139 |
140 if (continueRendering && document().settings()->containerCullingEnab
led()) | 140 if (continueRendering && document().settings()->containerCullingEnab
led()) |
141 cullSaver.cull(repaintRectInLocalCoordinates()); | 141 cullSaver.cull(paintInvalidationRectInLocalCoordinates()); |
142 } | 142 } |
143 | 143 |
144 if (continueRendering) { | 144 if (continueRendering) { |
145 childPaintInfo.updatePaintingRootForChildren(this); | 145 childPaintInfo.updatePaintingRootForChildren(this); |
146 for (RenderObject* child = firstChild(); child; child = child->nextS
ibling()) | 146 for (RenderObject* child = firstChild(); child; child = child->nextS
ibling()) |
147 child->paint(childPaintInfo, IntPoint()); | 147 child->paint(childPaintInfo, IntPoint()); |
148 } | 148 } |
149 } | 149 } |
150 | 150 |
151 // FIXME: This really should be drawn from local coordinates, but currently
we hack it | 151 // FIXME: This really should be drawn from local coordinates, but currently
we hack it |
152 // to avoid our clip killing our outline rect. Thus we translate our | 152 // to avoid our clip killing our outline rect. Thus we translate our |
153 // outline rect into parent coords before drawing. | 153 // outline rect into parent coords before drawing. |
154 // FIXME: This means our focus ring won't share our rotation like it should. | 154 // FIXME: This means our focus ring won't share our rotation like it should. |
155 // We should instead disable our clip during PaintPhaseOutline | 155 // We should instead disable our clip during PaintPhaseOutline |
156 if (paintInfo.phase == PaintPhaseForeground && style()->outlineWidth() && st
yle()->visibility() == VISIBLE) { | 156 if (paintInfo.phase == PaintPhaseForeground && style()->outlineWidth() && st
yle()->visibility() == VISIBLE) { |
157 IntRect paintRectInParent = enclosingIntRect(localToParentTransform().ma
pRect(repaintRect)); | 157 IntRect paintRectInParent = enclosingIntRect(localToParentTransform().ma
pRect(repaintRect)); |
158 paintOutline(paintInfo, paintRectInParent); | 158 paintOutline(paintInfo, paintRectInParent); |
159 } | 159 } |
160 } | 160 } |
161 | 161 |
162 // addFocusRingRects is called from paintOutline and needs to be in the same coo
rdinates as the paintOuline call | 162 // addFocusRingRects is called from paintOutline and needs to be in the same coo
rdinates as the paintOuline call |
163 void RenderSVGContainer::addFocusRingRects(Vector<IntRect>& rects, const LayoutP
oint&, const RenderLayerModelObject*) | 163 void RenderSVGContainer::addFocusRingRects(Vector<IntRect>& rects, const LayoutP
oint&, const RenderLayerModelObject*) |
164 { | 164 { |
165 IntRect paintRectInParent = enclosingIntRect(localToParentTransform().mapRec
t(repaintRectInLocalCoordinates())); | 165 IntRect paintRectInParent = enclosingIntRect(localToParentTransform().mapRec
t(paintInvalidationRectInLocalCoordinates())); |
166 if (!paintRectInParent.isEmpty()) | 166 if (!paintRectInParent.isEmpty()) |
167 rects.append(paintRectInParent); | 167 rects.append(paintRectInParent); |
168 } | 168 } |
169 | 169 |
170 void RenderSVGContainer::updateCachedBoundaries() | 170 void RenderSVGContainer::updateCachedBoundaries() |
171 { | 171 { |
172 SVGRenderSupport::computeContainerBoundingBoxes(this, m_objectBoundingBox, m
_objectBoundingBoxValid, m_strokeBoundingBox, m_repaintBoundingBox); | 172 SVGRenderSupport::computeContainerBoundingBoxes(this, m_objectBoundingBox, m
_objectBoundingBoxValid, m_strokeBoundingBox, m_repaintBoundingBox); |
173 SVGRenderSupport::intersectRepaintRectWithResources(this, m_repaintBoundingB
ox); | 173 SVGRenderSupport::intersectRepaintRectWithResources(this, m_repaintBoundingB
ox); |
174 } | 174 } |
175 | 175 |
(...skipping 21 matching lines...) Expand all Loading... |
197 if (objectBoundingBox().contains(localPoint)) { | 197 if (objectBoundingBox().contains(localPoint)) { |
198 updateHitTestResult(result, roundedLayoutPoint(localPoint)); | 198 updateHitTestResult(result, roundedLayoutPoint(localPoint)); |
199 return true; | 199 return true; |
200 } | 200 } |
201 } | 201 } |
202 // 16.4: "If there are no graphics elements whose relevant graphics content
is under the pointer (i.e., there is no target element), the event is not dispat
ched." | 202 // 16.4: "If there are no graphics elements whose relevant graphics content
is under the pointer (i.e., there is no target element), the event is not dispat
ched." |
203 return false; | 203 return false; |
204 } | 204 } |
205 | 205 |
206 } | 206 } |
OLD | NEW |