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

Side by Side Diff: sky/engine/core/rendering/RenderLayerClipper.cpp

Issue 878023002: Merge outline paint phases into the foreground phase. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: rebase Created 5 years, 11 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved.
3 * 3 *
4 * Portions are Copyright (C) 1998 Netscape Communications Corporation. 4 * Portions are Copyright (C) 1998 Netscape Communications Corporation.
5 * 5 *
6 * Other contributors: 6 * Other contributors:
7 * Robert O'Callahan <roc+@cs.cmu.edu> 7 * Robert O'Callahan <roc+@cs.cmu.edu>
8 * David Baron <dbaron@fas.harvard.edu> 8 * David Baron <dbaron@fas.harvard.edu>
9 * Christian Biesinger <cbiesinger@web.de> 9 * Christian Biesinger <cbiesinger@web.de>
10 * Randall Jesup <rjesup@wgate.com> 10 * Randall Jesup <rjesup@wgate.com>
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 for (RenderLayer* layer = m_renderer.layer()->firstChild(); layer; layer = l ayer->nextSibling()) 157 for (RenderLayer* layer = m_renderer.layer()->firstChild(); layer; layer = l ayer->nextSibling())
158 layer->clipper().clearClipRectsIncludingDescendants(cacheSlot); 158 layer->clipper().clearClipRectsIncludingDescendants(cacheSlot);
159 } 159 }
160 160
161 LayoutRect RenderLayerClipper::childrenClipRect() const 161 LayoutRect RenderLayerClipper::childrenClipRect() const
162 { 162 {
163 // FIXME: border-radius not accounted for. 163 // FIXME: border-radius not accounted for.
164 // FIXME: Regions not accounted for. 164 // FIXME: Regions not accounted for.
165 RenderLayer* clippingRootLayer = clippingRootForPainting(); 165 RenderLayer* clippingRootLayer = clippingRootForPainting();
166 LayoutRect layerBounds; 166 LayoutRect layerBounds;
167 ClipRect backgroundRect, foregroundRect, outlineRect; 167 ClipRect backgroundRect, foregroundRect;
168 // Need to use uncached clip rects, because the value of 'dontClipToOverflow ' may be different from the painting path (<rdar://problem/11844909>). 168 // Need to use uncached clip rects, because the value of 'dontClipToOverflow ' may be different from the painting path (<rdar://problem/11844909>).
169 ClipRectsContext context(clippingRootLayer, UncachedClipRects); 169 ClipRectsContext context(clippingRootLayer, UncachedClipRects);
170 calculateRects(context, m_renderer.view()->unscaledDocumentRect(), layerBoun ds, backgroundRect, foregroundRect, outlineRect); 170 calculateRects(context, m_renderer.view()->unscaledDocumentRect(), layerBoun ds, backgroundRect, foregroundRect);
171 return clippingRootLayer->renderer()->localToAbsoluteQuad(FloatQuad(foregrou ndRect.rect())).enclosingBoundingBox(); 171 return clippingRootLayer->renderer()->localToAbsoluteQuad(FloatQuad(foregrou ndRect.rect())).enclosingBoundingBox();
172 } 172 }
173 173
174 LayoutRect RenderLayerClipper::localClipRect() const 174 LayoutRect RenderLayerClipper::localClipRect() const
175 { 175 {
176 // FIXME: border-radius not accounted for. 176 // FIXME: border-radius not accounted for.
177 RenderLayer* clippingRootLayer = clippingRootForPainting(); 177 RenderLayer* clippingRootLayer = clippingRootForPainting();
178 LayoutRect layerBounds; 178 LayoutRect layerBounds;
179 ClipRect backgroundRect, foregroundRect, outlineRect; 179 ClipRect backgroundRect, foregroundRect;
180 ClipRectsContext context(clippingRootLayer, PaintingClipRects); 180 ClipRectsContext context(clippingRootLayer, PaintingClipRects);
181 calculateRects(context, PaintInfo::infiniteRect(), layerBounds, backgroundRe ct, foregroundRect, outlineRect); 181 calculateRects(context, PaintInfo::infiniteRect(), layerBounds, backgroundRe ct, foregroundRect);
182 182
183 LayoutRect clipRect = backgroundRect.rect(); 183 LayoutRect clipRect = backgroundRect.rect();
184 if (clipRect == PaintInfo::infiniteRect()) 184 if (clipRect == PaintInfo::infiniteRect())
185 return clipRect; 185 return clipRect;
186 186
187 LayoutPoint clippingRootOffset; 187 LayoutPoint clippingRootOffset;
188 m_renderer.layer()->convertToLayerCoords(clippingRootLayer, clippingRootOffs et); 188 m_renderer.layer()->convertToLayerCoords(clippingRootLayer, clippingRootOffs et);
189 clipRect.moveBy(-clippingRootOffset); 189 clipRect.moveBy(-clippingRootOffset);
190 190
191 return clipRect; 191 return clipRect;
192 } 192 }
193 193
194 void RenderLayerClipper::calculateRects(const ClipRectsContext& context, const L ayoutRect& paintDirtyRect, LayoutRect& layerBounds, 194 void RenderLayerClipper::calculateRects(const ClipRectsContext& context, const L ayoutRect& paintDirtyRect, LayoutRect& layerBounds,
195 ClipRect& backgroundRect, ClipRect& foregroundRect, ClipRect& outlineRect, c onst LayoutPoint* offsetFromRoot) const 195 ClipRect& backgroundRect, ClipRect& foregroundRect, const LayoutPoint* offse tFromRoot) const
196 { 196 {
197 bool isClippingRoot = m_renderer.layer() == context.rootLayer; 197 bool isClippingRoot = m_renderer.layer() == context.rootLayer;
198 198
199 if (!isClippingRoot && m_renderer.layer()->parent()) { 199 if (!isClippingRoot && m_renderer.layer()->parent()) {
200 backgroundRect = backgroundClipRect(context); 200 backgroundRect = backgroundClipRect(context);
201 backgroundRect.move(roundedIntSize(context.subPixelAccumulation)); 201 backgroundRect.move(roundedIntSize(context.subPixelAccumulation));
202 backgroundRect.intersect(paintDirtyRect); 202 backgroundRect.intersect(paintDirtyRect);
203 } else { 203 } else {
204 backgroundRect = paintDirtyRect; 204 backgroundRect = paintDirtyRect;
205 } 205 }
206 206
207 foregroundRect = backgroundRect; 207 foregroundRect = backgroundRect;
208 outlineRect = backgroundRect;
209 208
210 LayoutPoint offset; 209 LayoutPoint offset;
211 if (offsetFromRoot) 210 if (offsetFromRoot)
212 offset = *offsetFromRoot; 211 offset = *offsetFromRoot;
213 else 212 else
214 m_renderer.layer()->convertToLayerCoords(context.rootLayer, offset); 213 m_renderer.layer()->convertToLayerCoords(context.rootLayer, offset);
215 layerBounds = LayoutRect(offset, m_renderer.layer()->size()); 214 layerBounds = LayoutRect(offset, m_renderer.layer()->size());
216 215
217 // Update the clip rects that will be passed to child layers. 216 // Update the clip rects that will be passed to child layers.
218 if (m_renderer.hasOverflowClip()) { 217 if (m_renderer.hasOverflowClip()) {
(...skipping 18 matching lines...) Expand all
237 backgroundRect.intersect(bounds); 236 backgroundRect.intersect(bounds);
238 } 237 }
239 } 238 }
240 239
241 // CSS clip (different than clipping due to overflow) can clip to any box, e ven if it falls outside of the border box. 240 // CSS clip (different than clipping due to overflow) can clip to any box, e ven if it falls outside of the border box.
242 if (m_renderer.hasClip()) { 241 if (m_renderer.hasClip()) {
243 // Clip applies to *us* as well, so go ahead and update the damageRect. 242 // Clip applies to *us* as well, so go ahead and update the damageRect.
244 LayoutRect newPosClip = toRenderBox(m_renderer).clipRect(offset); 243 LayoutRect newPosClip = toRenderBox(m_renderer).clipRect(offset);
245 backgroundRect.intersect(newPosClip); 244 backgroundRect.intersect(newPosClip);
246 foregroundRect.intersect(newPosClip); 245 foregroundRect.intersect(newPosClip);
247 outlineRect.intersect(newPosClip);
248 } 246 }
249 } 247 }
250 248
251 void RenderLayerClipper::calculateClipRects(const ClipRectsContext& context, Cli pRects& clipRects) const 249 void RenderLayerClipper::calculateClipRects(const ClipRectsContext& context, Cli pRects& clipRects) const
252 { 250 {
253 if (!m_renderer.layer()->parent()) { 251 if (!m_renderer.layer()->parent()) {
254 // The root layer's clip rect is always infinite. 252 // The root layer's clip rect is always infinite.
255 clipRects.reset(PaintInfo::infiniteRect()); 253 clipRects.reset(PaintInfo::infiniteRect());
256 return; 254 return;
257 } 255 }
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 ASSERT(current); 322 ASSERT(current);
325 if (current->transform()) 323 if (current->transform())
326 return const_cast<RenderLayer*>(current); 324 return const_cast<RenderLayer*>(current);
327 } 325 }
328 326
329 ASSERT_NOT_REACHED(); 327 ASSERT_NOT_REACHED();
330 return 0; 328 return 0;
331 } 329 }
332 330
333 } // namespace blink 331 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698