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

Side by Side Diff: Source/core/plugins/PluginOcclusionSupport.cpp

Issue 977113003: Rename renderer() to layoutObject(). (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/paint/ViewPainter.cpp ('k') | Source/core/svg/SVGAnimateMotionElement.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 return element; 143 return element;
144 } 144 }
145 145
146 // Return a set of rectangles that should not be overdrawn by the 146 // Return a set of rectangles that should not be overdrawn by the
147 // plugin ("cutouts"). This helps implement the "iframe shim" 147 // plugin ("cutouts"). This helps implement the "iframe shim"
148 // technique of overlaying a windowed plugin with content from the 148 // technique of overlaying a windowed plugin with content from the
149 // page. In a nutshell, iframe elements should occlude plugins when 149 // page. In a nutshell, iframe elements should occlude plugins when
150 // they occur higher in the stacking order. 150 // they occur higher in the stacking order.
151 void getPluginOcclusions(Element* element, Widget* parentWidget, const IntRect& frameRect, Vector<IntRect>& occlusions) 151 void getPluginOcclusions(Element* element, Widget* parentWidget, const IntRect& frameRect, Vector<IntRect>& occlusions)
152 { 152 {
153 LayoutObject* pluginNode = element->renderer(); 153 LayoutObject* pluginNode = element->layoutObject();
154 ASSERT(pluginNode); 154 ASSERT(pluginNode);
155 if (!pluginNode->style()) 155 if (!pluginNode->style())
156 return; 156 return;
157 Vector<const LayoutObject*> pluginZstack; 157 Vector<const LayoutObject*> pluginZstack;
158 Vector<const LayoutObject*> iframeZstack; 158 Vector<const LayoutObject*> iframeZstack;
159 getObjectStack(pluginNode, &pluginZstack); 159 getObjectStack(pluginNode, &pluginZstack);
160 160
161 if (!parentWidget->isFrameView()) 161 if (!parentWidget->isFrameView())
162 return; 162 return;
163 163
164 FrameView* parentFrameView = toFrameView(parentWidget); 164 FrameView* parentFrameView = toFrameView(parentWidget);
165 165
166 // Occlusions by iframes. 166 // Occlusions by iframes.
167 const FrameView::ChildrenWidgetSet* children = parentFrameView->children(); 167 const FrameView::ChildrenWidgetSet* children = parentFrameView->children();
168 for (FrameView::ChildrenWidgetSet::const_iterator it = children->begin(); it != children->end(); ++it) { 168 for (FrameView::ChildrenWidgetSet::const_iterator it = children->begin(); it != children->end(); ++it) {
169 // We only care about FrameView's because iframes show up as FrameViews. 169 // We only care about FrameView's because iframes show up as FrameViews.
170 if (!(*it)->isFrameView()) 170 if (!(*it)->isFrameView())
171 continue; 171 continue;
172 172
173 const FrameView* frameView = toFrameView(it->get()); 173 const FrameView* frameView = toFrameView(it->get());
174 // Check to make sure we can get both the element and the LayoutObject 174 // Check to make sure we can get both the element and the LayoutObject
175 // for this FrameView, if we can't just move on to the next object. 175 // for this FrameView, if we can't just move on to the next object.
176 // FIXME: Plugin occlusion by remote frames is probably broken. 176 // FIXME: Plugin occlusion by remote frames is probably broken.
177 HTMLElement* element = frameView->frame().deprecatedLocalOwner(); 177 HTMLElement* element = frameView->frame().deprecatedLocalOwner();
178 if (!element || !element->renderer()) 178 if (!element || !element->layoutObject())
179 continue; 179 continue;
180 180
181 LayoutObject* iframeRenderer = element->renderer(); 181 LayoutObject* iframeRenderer = element->layoutObject();
182 182
183 if (isHTMLIFrameElement(*element) && intersectsRect(iframeRenderer, fram eRect)) { 183 if (isHTMLIFrameElement(*element) && intersectsRect(iframeRenderer, fram eRect)) {
184 getObjectStack(iframeRenderer, &iframeZstack); 184 getObjectStack(iframeRenderer, &iframeZstack);
185 if (iframeIsAbovePlugin(iframeZstack, pluginZstack)) 185 if (iframeIsAbovePlugin(iframeZstack, pluginZstack))
186 addToOcclusions(toLayoutBox(iframeRenderer), occlusions); 186 addToOcclusions(toLayoutBox(iframeRenderer), occlusions);
187 } 187 }
188 } 188 }
189 189
190 // Occlusions by top layer elements. 190 // Occlusions by top layer elements.
191 // FIXME: There's no handling yet for the interaction between top layer and 191 // FIXME: There's no handling yet for the interaction between top layer and
192 // iframes. For example, a plugin in the top layer will be occluded by an 192 // iframes. For example, a plugin in the top layer will be occluded by an
193 // iframe. And a plugin inside an iframe in the top layer won't be respected 193 // iframe. And a plugin inside an iframe in the top layer won't be respected
194 // as being in the top layer. 194 // as being in the top layer.
195 const Element* ancestor = topLayerAncestor(element); 195 const Element* ancestor = topLayerAncestor(element);
196 Document* document = parentFrameView->frame().document(); 196 Document* document = parentFrameView->frame().document();
197 const WillBeHeapVector<RefPtrWillBeMember<Element> >& elements = document->t opLayerElements(); 197 const WillBeHeapVector<RefPtrWillBeMember<Element> >& elements = document->t opLayerElements();
198 size_t start = ancestor ? elements.find(ancestor) + 1 : 0; 198 size_t start = ancestor ? elements.find(ancestor) + 1 : 0;
199 for (size_t i = start; i < elements.size(); ++i) 199 for (size_t i = start; i < elements.size(); ++i)
200 addTreeToOcclusions(elements[i]->renderer(), frameRect, occlusions); 200 addTreeToOcclusions(elements[i]->layoutObject(), frameRect, occlusions);
201 } 201 }
202 202
203 } // namespace blink 203 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/paint/ViewPainter.cpp ('k') | Source/core/svg/SVGAnimateMotionElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698