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

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

Issue 715453002: Remove OverlayScrollbarSizeRelevancy. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 } else if (position == AbsolutePosition) { 57 } else if (position == AbsolutePosition) {
58 clipRects.setOverflowClipRect(clipRects.posClipRect()); 58 clipRects.setOverflowClipRect(clipRects.posClipRect());
59 } 59 }
60 } 60 }
61 61
62 static void applyClipRects(const ClipRectsContext& context, RenderObject& render er, LayoutPoint offset, ClipRects& clipRects) 62 static void applyClipRects(const ClipRectsContext& context, RenderObject& render er, LayoutPoint offset, ClipRects& clipRects)
63 { 63 {
64 ASSERT(renderer.hasOverflowClip() || renderer.hasClip()); 64 ASSERT(renderer.hasOverflowClip() || renderer.hasClip());
65 65
66 if (renderer.hasOverflowClip()) { 66 if (renderer.hasOverflowClip()) {
67 ClipRect newOverflowClip = toRenderBox(renderer).overflowClipRect(offset , context.scrollbarRelevancy); 67 ClipRect newOverflowClip = toRenderBox(renderer).overflowClipRect(offset );
68 newOverflowClip.setHasRadius(renderer.style()->hasBorderRadius()); 68 newOverflowClip.setHasRadius(renderer.style()->hasBorderRadius());
69 clipRects.setOverflowClipRect(intersection(newOverflowClip, clipRects.ov erflowClipRect())); 69 clipRects.setOverflowClipRect(intersection(newOverflowClip, clipRects.ov erflowClipRect()));
70 if (renderer.isPositioned()) 70 if (renderer.isPositioned())
71 clipRects.setPosClipRect(intersection(newOverflowClip, clipRects.pos ClipRect())); 71 clipRects.setPosClipRect(intersection(newOverflowClip, clipRects.pos ClipRect()));
72 } 72 }
73 73
74 if (renderer.hasClip()) { 74 if (renderer.hasClip()) {
75 LayoutRect newClip = toRenderBox(renderer).clipRect(offset); 75 LayoutRect newClip = toRenderBox(renderer).clipRect(offset);
76 clipRects.setPosClipRect(intersection(newClip, clipRects.posClipRect())) ; 76 clipRects.setPosClipRect(intersection(newClip, clipRects.posClipRect())) ;
77 clipRects.setOverflowClipRect(intersection(newClip, clipRects.overflowCl ipRect())); 77 clipRects.setOverflowClipRect(intersection(newClip, clipRects.overflowCl ipRect()));
78 } 78 }
79 } 79 }
80 80
81 RenderLayerClipper::RenderLayerClipper(RenderLayerModelObject& renderer) 81 RenderLayerClipper::RenderLayerClipper(RenderLayerModelObject& renderer)
82 : m_renderer(renderer) 82 : m_renderer(renderer)
83 { 83 {
84 } 84 }
85 85
86 ClipRects* RenderLayerClipper::clipRectsIfCached(const ClipRectsContext& context ) const 86 ClipRects* RenderLayerClipper::clipRectsIfCached(const ClipRectsContext& context ) const
87 { 87 {
88 ASSERT(context.usesCache()); 88 ASSERT(context.usesCache());
89 if (!m_cache) 89 if (!m_cache)
90 return 0; 90 return 0;
91 ClipRectsCache::Entry& entry = m_cache->get(context.cacheSlot); 91 ClipRectsCache::Entry& entry = m_cache->get(context.cacheSlot);
92 // FIXME: We used to ASSERT that we always got a consistent root layer. 92 // FIXME: We used to ASSERT that we always got a consistent root layer.
93 // We should add a test that has an inconsistent root. See 93 // We should add a test that has an inconsistent root. See
94 // http://crbug.com/366118 for an example. 94 // http://crbug.com/366118 for an example.
95 if (context.rootLayer != entry.root) 95 if (context.rootLayer != entry.root)
96 return 0; 96 return 0;
97 ASSERT(entry.scrollbarRelevancy == context.scrollbarRelevancy);
98 97
99 #ifdef CHECK_CACHED_CLIP_RECTS 98 #ifdef CHECK_CACHED_CLIP_RECTS
100 // This code is useful to check cached clip rects, but is too expensive to l eave enabled in debug builds by default. 99 // This code is useful to check cached clip rects, but is too expensive to l eave enabled in debug builds by default.
101 ClipRectsContext tempContext(context); 100 ClipRectsContext tempContext(context);
102 tempContext.cacheSlot = UncachedClipRects; 101 tempContext.cacheSlot = UncachedClipRects;
103 ClipRects clipRects; 102 ClipRects clipRects;
104 calculateClipRects(tempContext, clipRects); 103 calculateClipRects(tempContext, clipRects);
105 ASSERT(clipRects == *entry.clipRects); 104 ASSERT(clipRects == *entry.clipRects);
106 #endif 105 #endif
107 106
108 return entry.clipRects.get(); 107 return entry.clipRects.get();
109 } 108 }
110 109
111 ClipRects* RenderLayerClipper::storeClipRectsInCache(const ClipRectsContext& con text, ClipRects* parentClipRects, const ClipRects& clipRects) const 110 ClipRects* RenderLayerClipper::storeClipRectsInCache(const ClipRectsContext& con text, ClipRects* parentClipRects, const ClipRects& clipRects) const
112 { 111 {
113 ClipRectsCache::Entry& entry = cache().get(context.cacheSlot); 112 ClipRectsCache::Entry& entry = cache().get(context.cacheSlot);
114 entry.root = context.rootLayer; 113 entry.root = context.rootLayer;
115 #if ENABLE(ASSERT)
116 entry.scrollbarRelevancy = context.scrollbarRelevancy;
117 #endif
118 114
119 if (parentClipRects) { 115 if (parentClipRects) {
120 // If our clip rects match the clip rects of our parent, we share storag e. 116 // If our clip rects match the clip rects of our parent, we share storag e.
121 if (clipRects == *parentClipRects) { 117 if (clipRects == *parentClipRects) {
122 entry.clipRects = parentClipRects; 118 entry.clipRects = parentClipRects;
123 return parentClipRects; 119 return parentClipRects;
124 } 120 }
125 } 121 }
126 122
127 entry.clipRects = ClipRects::create(clipRects); 123 entry.clipRects = ClipRects::create(clipRects);
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 if (offsetFromRoot) 211 if (offsetFromRoot)
216 offset = *offsetFromRoot; 212 offset = *offsetFromRoot;
217 else 213 else
218 m_renderer.layer()->convertToLayerCoords(context.rootLayer, offset); 214 m_renderer.layer()->convertToLayerCoords(context.rootLayer, offset);
219 layerBounds = LayoutRect(offset, m_renderer.layer()->size()); 215 layerBounds = LayoutRect(offset, m_renderer.layer()->size());
220 216
221 // Update the clip rects that will be passed to child layers. 217 // Update the clip rects that will be passed to child layers.
222 if (m_renderer.hasOverflowClip()) { 218 if (m_renderer.hasOverflowClip()) {
223 // This layer establishes a clip of some kind. 219 // This layer establishes a clip of some kind.
224 if (!isClippingRoot || context.respectOverflowClip == RespectOverflowCli p) { 220 if (!isClippingRoot || context.respectOverflowClip == RespectOverflowCli p) {
225 foregroundRect.intersect(toRenderBox(m_renderer).overflowClipRect(of fset, context.scrollbarRelevancy)); 221 foregroundRect.intersect(toRenderBox(m_renderer).overflowClipRect(of fset));
226 if (m_renderer.style()->hasBorderRadius()) 222 if (m_renderer.style()->hasBorderRadius())
227 foregroundRect.setHasRadius(true); 223 foregroundRect.setHasRadius(true);
228 } 224 }
229 225
230 // If we establish an overflow clip at all, then go ahead and make sure our background 226 // If we establish an overflow clip at all, then go ahead and make sure our background
231 // rect is intersected with our layer's bounds including our visual over flow, 227 // rect is intersected with our layer's bounds including our visual over flow,
232 // since any visual overflow like box-shadow or border-outset is not cli pped by overflow:auto/hidden. 228 // since any visual overflow like box-shadow or border-outset is not cli pped by overflow:auto/hidden.
233 if (toRenderBox(m_renderer).hasVisualOverflow()) { 229 if (toRenderBox(m_renderer).hasVisualOverflow()) {
234 // FIXME: Perhaps we should be propagating the borderbox as the clip rect for children, even though 230 // FIXME: Perhaps we should be propagating the borderbox as the clip rect for children, even though
235 // we may need to inflate our clip specifically for shadows o r outsets. 231 // we may need to inflate our clip specifically for shadows o r outsets.
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 ASSERT(current); 337 ASSERT(current);
342 if (current->transform() || current->isPaintInvalidationContainer()) 338 if (current->transform() || current->isPaintInvalidationContainer())
343 return const_cast<RenderLayer*>(current); 339 return const_cast<RenderLayer*>(current);
344 } 340 }
345 341
346 ASSERT_NOT_REACHED(); 342 ASSERT_NOT_REACHED();
347 return 0; 343 return 0;
348 } 344 }
349 345
350 } // namespace blink 346 } // namespace blink
OLDNEW
« no previous file with comments | « sky/engine/core/rendering/RenderLayerClipper.h ('k') | sky/engine/core/rendering/compositing/CompositedLayerMapping.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698