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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 bool RenderSVGContainer::selfWillPaint() | 100 bool RenderSVGContainer::selfWillPaint() |
101 { | 101 { |
102 SVGResources* resources = SVGResourcesCache::cachedResourcesForRenderObject(
this); | 102 SVGResources* resources = SVGResourcesCache::cachedResourcesForRenderObject(
this); |
103 return resources && resources->filter(); | 103 return resources && resources->filter(); |
104 } | 104 } |
105 | 105 |
106 void RenderSVGContainer::paint(PaintInfo& paintInfo, const LayoutPoint&) | 106 void RenderSVGContainer::paint(PaintInfo& paintInfo, const LayoutPoint&) |
107 { | 107 { |
108 ANNOTATE_GRAPHICS_CONTEXT(paintInfo, this); | 108 ANNOTATE_GRAPHICS_CONTEXT(paintInfo, this); |
109 | 109 |
110 if (paintInfo.context->paintingDisabled()) | 110 if (paintInfo.getContext()->paintingDisabled()) |
111 return; | 111 return; |
112 | 112 |
113 // Spec: groups w/o children still may render filter content. | 113 // Spec: groups w/o children still may render filter content. |
114 if (!firstChild() && !selfWillPaint()) | 114 if (!firstChild() && !selfWillPaint()) |
115 return; | 115 return; |
116 | 116 |
117 FloatRect repaintRect = repaintRectInLocalCoordinates(); | 117 FloatRect repaintRect = repaintRectInLocalCoordinates(); |
118 if (!SVGRenderSupport::paintInfoIntersectsRepaintRect(repaintRect, localToPa
rentTransform(), paintInfo)) | 118 if (!SVGRenderSupport::paintInfoIntersectsRepaintRect(repaintRect, localToPa
rentTransform(), paintInfo)) |
119 return; | 119 return; |
120 | 120 |
121 PaintInfo childPaintInfo(paintInfo); | 121 PaintInfo childPaintInfo(paintInfo); |
122 { | 122 { |
123 GraphicsContextStateSaver stateSaver(*childPaintInfo.context); | 123 GraphicsContextStateSaver stateSaver(*(childPaintInfo.getContext())); |
124 | 124 |
125 // Let the RenderSVGViewportContainer subclass clip if necessary | 125 // Let the RenderSVGViewportContainer subclass clip if necessary |
126 applyViewportClip(childPaintInfo); | 126 applyViewportClip(childPaintInfo); |
127 | 127 |
128 childPaintInfo.applyTransform(localToParentTransform()); | 128 childPaintInfo.applyTransform(localToParentTransform()); |
129 | 129 |
130 SVGRenderingContext renderingContext; | 130 SVGRenderingContext renderingContext; |
131 bool continueRendering = true; | 131 bool continueRendering = true; |
132 if (childPaintInfo.phase == PaintPhaseForeground) { | 132 if (childPaintInfo.getPhase() == PaintPhaseForeground) { |
133 renderingContext.prepareToRenderSVGContent(this, childPaintInfo); | 133 renderingContext.prepareToRenderSVGContent(this, childPaintInfo); |
134 continueRendering = renderingContext.isRenderingPrepared(); | 134 continueRendering = renderingContext.isRenderingPrepared(); |
135 } | 135 } |
136 | 136 |
137 if (continueRendering) { | 137 if (continueRendering) { |
138 childPaintInfo.updatePaintingRootForChildren(this); | 138 childPaintInfo.updatePaintingRootForChildren(this); |
139 for (RenderObject* child = firstChild(); child; child = child->nextS
ibling()) | 139 for (RenderObject* child = firstChild(); child; child = child->nextS
ibling()) |
140 child->paint(childPaintInfo, IntPoint()); | 140 child->paint(childPaintInfo, IntPoint()); |
141 } | 141 } |
142 } | 142 } |
143 | 143 |
144 // FIXME: This really should be drawn from local coordinates, but currently
we hack it | 144 // FIXME: This really should be drawn from local coordinates, but currently
we hack it |
145 // to avoid our clip killing our outline rect. Thus we translate our | 145 // to avoid our clip killing our outline rect. Thus we translate our |
146 // outline rect into parent coords before drawing. | 146 // outline rect into parent coords before drawing. |
147 // FIXME: This means our focus ring won't share our rotation like it should. | 147 // FIXME: This means our focus ring won't share our rotation like it should. |
148 // We should instead disable our clip during PaintPhaseOutline | 148 // We should instead disable our clip during PaintPhaseOutline |
149 if ((paintInfo.phase == PaintPhaseOutline || paintInfo.phase == PaintPhaseSe
lfOutline) && style()->outlineWidth() && style()->visibility() == VISIBLE) { | 149 if ((paintInfo.getPhase() == PaintPhaseOutline || paintInfo.getPhase() == Pa
intPhaseSelfOutline) && style()->outlineWidth() && style()->visibility() == VISI
BLE) { |
150 IntRect paintRectInParent = enclosingIntRect(localToParentTransform().ma
pRect(repaintRect)); | 150 IntRect paintRectInParent = enclosingIntRect(localToParentTransform().ma
pRect(repaintRect)); |
151 paintOutline(paintInfo, paintRectInParent); | 151 paintOutline(paintInfo, paintRectInParent); |
152 } | 152 } |
153 } | 153 } |
154 | 154 |
155 // addFocusRingRects is called from paintOutline and needs to be in the same coo
rdinates as the paintOuline call | 155 // addFocusRingRects is called from paintOutline and needs to be in the same coo
rdinates as the paintOuline call |
156 void RenderSVGContainer::addFocusRingRects(Vector<IntRect>& rects, const LayoutP
oint&, const RenderLayerModelObject*) | 156 void RenderSVGContainer::addFocusRingRects(Vector<IntRect>& rects, const LayoutP
oint&, const RenderLayerModelObject*) |
157 { | 157 { |
158 IntRect paintRectInParent = enclosingIntRect(localToParentTransform().mapRec
t(repaintRectInLocalCoordinates())); | 158 IntRect paintRectInParent = enclosingIntRect(localToParentTransform().mapRec
t(repaintRectInLocalCoordinates())); |
159 if (!paintRectInParent.isEmpty()) | 159 if (!paintRectInParent.isEmpty()) |
(...skipping 23 matching lines...) Expand all Loading... |
183 return true; | 183 return true; |
184 } | 184 } |
185 } | 185 } |
186 | 186 |
187 // Spec: Only graphical elements can be targeted by the mouse, period. | 187 // Spec: Only graphical elements can be targeted by the mouse, period. |
188 // 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." | 188 // 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." |
189 return false; | 189 return false; |
190 } | 190 } |
191 | 191 |
192 } | 192 } |
OLD | NEW |