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

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

Issue 2728613002: Rename platform/Widget to platform/FrameViewBase in modules. (Closed)
Patch Set: Rename platform/Widget to platform/FrameViewBase in modules. Created 3 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
« no previous file with comments | « no previous file | no next file » | 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 20 matching lines...) Expand all
31 #include "modules/plugins/PluginOcclusionSupport.h" 31 #include "modules/plugins/PluginOcclusionSupport.h"
32 32
33 #include "core/HTMLNames.h" 33 #include "core/HTMLNames.h"
34 #include "core/dom/Element.h" 34 #include "core/dom/Element.h"
35 #include "core/frame/FrameView.h" 35 #include "core/frame/FrameView.h"
36 #include "core/frame/LocalFrame.h" 36 #include "core/frame/LocalFrame.h"
37 #include "core/html/HTMLElement.h" 37 #include "core/html/HTMLElement.h"
38 #include "core/html/HTMLFrameOwnerElement.h" 38 #include "core/html/HTMLFrameOwnerElement.h"
39 #include "core/layout/LayoutBox.h" 39 #include "core/layout/LayoutBox.h"
40 #include "core/layout/LayoutObject.h" 40 #include "core/layout/LayoutObject.h"
41 #include "platform/Widget.h" 41 #include "platform/FrameViewBase.h"
42 #include "wtf/HashSet.h" 42 #include "wtf/HashSet.h"
43 43
44 // This file provides a utility function to support rendering certain elements 44 // This file provides a utility function to support rendering certain elements
45 // above plugins. 45 // above plugins.
46 46
47 namespace blink { 47 namespace blink {
48 48
49 static void getObjectStack(const LayoutObject* ro, 49 static void getObjectStack(const LayoutObject* ro,
50 Vector<const LayoutObject*>* roStack) { 50 Vector<const LayoutObject*>* roStack) {
51 roStack->clear(); 51 roStack->clear();
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 element = element->parentOrShadowHostElement(); 146 element = element->parentOrShadowHostElement();
147 return element; 147 return element;
148 } 148 }
149 149
150 // Return a set of rectangles that should not be overdrawn by the 150 // Return a set of rectangles that should not be overdrawn by the
151 // plugin ("cutouts"). This helps implement the "iframe shim" 151 // plugin ("cutouts"). This helps implement the "iframe shim"
152 // technique of overlaying a windowed plugin with content from the 152 // technique of overlaying a windowed plugin with content from the
153 // page. In a nutshell, iframe elements should occlude plugins when 153 // page. In a nutshell, iframe elements should occlude plugins when
154 // they occur higher in the stacking order. 154 // they occur higher in the stacking order.
155 void getPluginOcclusions(Element* element, 155 void getPluginOcclusions(Element* element,
156 Widget* parentWidget, 156 FrameViewBase* parentFrameViewBase,
157 const IntRect& frameRect, 157 const IntRect& frameRect,
158 Vector<IntRect>& occlusions) { 158 Vector<IntRect>& occlusions) {
159 LayoutObject* pluginNode = element->layoutObject(); 159 LayoutObject* pluginNode = element->layoutObject();
160 ASSERT(pluginNode); 160 ASSERT(pluginNode);
161 if (!pluginNode->style()) 161 if (!pluginNode->style())
162 return; 162 return;
163 Vector<const LayoutObject*> pluginZstack; 163 Vector<const LayoutObject*> pluginZstack;
164 Vector<const LayoutObject*> iframeZstack; 164 Vector<const LayoutObject*> iframeZstack;
165 getObjectStack(pluginNode, &pluginZstack); 165 getObjectStack(pluginNode, &pluginZstack);
166 166
167 if (!parentWidget->isFrameView()) 167 if (!parentFrameViewBase->isFrameView())
168 return; 168 return;
169 169
170 FrameView* parentFrameView = toFrameView(parentWidget); 170 FrameView* parentFrameView = toFrameView(parentFrameViewBase);
171 171
172 // Occlusions by iframes. 172 // Occlusions by iframes.
173 const FrameView::ChildrenWidgetSet* children = parentFrameView->children(); 173 const FrameView::ChildrenWidgetSet* children = parentFrameView->children();
174 for (FrameView::ChildrenWidgetSet::const_iterator it = children->begin(); 174 for (FrameView::ChildrenWidgetSet::const_iterator it = children->begin();
175 it != children->end(); ++it) { 175 it != children->end(); ++it) {
176 // We only care about FrameView's because iframes show up as FrameViews. 176 // We only care about FrameView's because iframes show up as FrameViews.
177 if (!(*it)->isFrameView()) 177 if (!(*it)->isFrameView())
178 continue; 178 continue;
179 179
180 const FrameView* frameView = toFrameView(it->get()); 180 const FrameView* frameView = toFrameView(it->get());
(...skipping 21 matching lines...) Expand all
202 // as being in the top layer. 202 // as being in the top layer.
203 const Element* ancestor = topLayerAncestor(element); 203 const Element* ancestor = topLayerAncestor(element);
204 Document* document = parentFrameView->frame().document(); 204 Document* document = parentFrameView->frame().document();
205 const HeapVector<Member<Element>>& elements = document->topLayerElements(); 205 const HeapVector<Member<Element>>& elements = document->topLayerElements();
206 size_t start = ancestor ? elements.find(ancestor) + 1 : 0; 206 size_t start = ancestor ? elements.find(ancestor) + 1 : 0;
207 for (size_t i = start; i < elements.size(); ++i) 207 for (size_t i = start; i < elements.size(); ++i)
208 addTreeToOcclusions(elements[i]->layoutObject(), frameRect, occlusions); 208 addTreeToOcclusions(elements[i]->layoutObject(), frameRect, occlusions);
209 } 209 }
210 210
211 } // namespace blink 211 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698