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

Side by Side Diff: third_party/WebKit/Source/modules/plugins/PluginOcclusionSupport.cpp

Issue 2862963003: Replace ASSERT with DCHECK in modules/ (Closed)
Patch Set: NOTREACHED instead of DCHECK(false) Created 3 years, 7 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) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 return false; 103 return false;
104 ASSERT(parent == ro2->Parent()); 104 ASSERT(parent == ro2->Parent());
105 105
106 for (const LayoutObject* ro = parent->SlowFirstChild(); ro; 106 for (const LayoutObject* ro = parent->SlowFirstChild(); ro;
107 ro = ro->NextSibling()) { 107 ro = ro->NextSibling()) {
108 if (ro == ro1) 108 if (ro == ro1)
109 return false; 109 return false;
110 if (ro == ro2) 110 if (ro == ro2)
111 return true; 111 return true;
112 } 112 }
113 ASSERT(false); // We should have seen ro1 and ro2 by now. 113 NOTREACHED(); // We should have seen ro1 and ro2 by now.
114 return false; 114 return false;
115 } 115 }
116 } 116 }
117 return true; 117 return true;
118 } 118 }
119 119
120 static bool IntersectsRect(const LayoutObject* renderer, const IntRect& rect) { 120 static bool IntersectsRect(const LayoutObject* renderer, const IntRect& rect) {
121 return renderer->AbsoluteBoundingBoxRectIgnoringTransforms().Intersects( 121 return renderer->AbsoluteBoundingBoxRectIgnoringTransforms().Intersects(
122 rect) && 122 rect) &&
123 (!renderer->Style() || 123 (!renderer->Style() ||
(...skipping 27 matching lines...) Expand all
151 // Return a set of rectangles that should not be overdrawn by the 151 // Return a set of rectangles that should not be overdrawn by the
152 // plugin ("cutouts"). This helps implement the "iframe shim" 152 // plugin ("cutouts"). This helps implement the "iframe shim"
153 // technique of overlaying a windowed plugin with content from the 153 // technique of overlaying a windowed plugin with content from the
154 // page. In a nutshell, iframe elements should occlude plugins when 154 // page. In a nutshell, iframe elements should occlude plugins when
155 // they occur higher in the stacking order. 155 // they occur higher in the stacking order.
156 void GetPluginOcclusions(Element* element, 156 void GetPluginOcclusions(Element* element,
157 FrameViewBase* parent, 157 FrameViewBase* parent,
158 const IntRect& frame_rect, 158 const IntRect& frame_rect,
159 Vector<IntRect>& occlusions) { 159 Vector<IntRect>& occlusions) {
160 LayoutObject* plugin_node = element->GetLayoutObject(); 160 LayoutObject* plugin_node = element->GetLayoutObject();
161 ASSERT(plugin_node); 161 DCHECK(plugin_node);
162 if (!plugin_node->Style()) 162 if (!plugin_node->Style())
163 return; 163 return;
164 Vector<const LayoutObject*> plugin_zstack; 164 Vector<const LayoutObject*> plugin_zstack;
165 Vector<const LayoutObject*> iframe_zstack; 165 Vector<const LayoutObject*> iframe_zstack;
166 GetObjectStack(plugin_node, &plugin_zstack); 166 GetObjectStack(plugin_node, &plugin_zstack);
167 167
168 if (!parent->IsFrameView()) 168 if (!parent->IsFrameView())
169 return; 169 return;
170 170
171 FrameView* parent_frame_view = ToFrameView(parent); 171 FrameView* parent_frame_view = ToFrameView(parent);
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 // as being in the top layer. 203 // as being in the top layer.
204 const Element* ancestor = TopLayerAncestor(element); 204 const Element* ancestor = TopLayerAncestor(element);
205 Document* document = parent_frame_view->GetFrame().GetDocument(); 205 Document* document = parent_frame_view->GetFrame().GetDocument();
206 const HeapVector<Member<Element>>& elements = document->TopLayerElements(); 206 const HeapVector<Member<Element>>& elements = document->TopLayerElements();
207 size_t start = ancestor ? elements.Find(ancestor) + 1 : 0; 207 size_t start = ancestor ? elements.Find(ancestor) + 1 : 0;
208 for (size_t i = start; i < elements.size(); ++i) 208 for (size_t i = start; i < elements.size(); ++i)
209 AddTreeToOcclusions(elements[i]->GetLayoutObject(), frame_rect, occlusions); 209 AddTreeToOcclusions(elements[i]->GetLayoutObject(), frame_rect, occlusions);
210 } 210 }
211 211
212 } // namespace blink 212 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698