| OLD | NEW |
| 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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 FrameViewBase* parentFrameViewBase, | 156 FrameViewBase* parent, |
| 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 (!parentFrameViewBase->isFrameView()) | 167 if (!parent->isFrameView()) |
| 168 return; | 168 return; |
| 169 | 169 |
| 170 FrameView* parentFrameView = toFrameView(parentFrameViewBase); | 170 FrameView* parentFrameView = toFrameView(parent); |
| 171 | 171 |
| 172 // Occlusions by iframes. | 172 // Occlusions by iframes. |
| 173 const FrameView::ChildrenWidgetSet* children = parentFrameView->children(); | 173 const FrameView::ChildrenSet* children = parentFrameView->children(); |
| 174 for (FrameView::ChildrenWidgetSet::const_iterator it = children->begin(); | 174 for (FrameView::ChildrenSet::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()); |
| 181 // Check to make sure we can get both the element and the LayoutObject | 181 // Check to make sure we can get both the element and the LayoutObject |
| 182 // for this FrameView, if we can't just move on to the next object. | 182 // for this FrameView, if we can't just move on to the next object. |
| 183 // FIXME: Plugin occlusion by remote frames is probably broken. | 183 // FIXME: Plugin occlusion by remote frames is probably broken. |
| 184 HTMLElement* element = frameView->frame().deprecatedLocalOwner(); | 184 HTMLElement* element = frameView->frame().deprecatedLocalOwner(); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 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 |
| OLD | NEW |