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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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(); |
52 while (ro) { | 52 while (ro) { |
53 roStack->append(ro); | 53 roStack->push_back(ro); |
54 ro = ro->parent(); | 54 ro = ro->parent(); |
55 } | 55 } |
56 } | 56 } |
57 | 57 |
58 // Returns true if stack1 is at or above stack2 | 58 // Returns true if stack1 is at or above stack2 |
59 static bool iframeIsAbovePlugin( | 59 static bool iframeIsAbovePlugin( |
60 const Vector<const LayoutObject*>& iframeZstack, | 60 const Vector<const LayoutObject*>& iframeZstack, |
61 const Vector<const LayoutObject*>& pluginZstack) { | 61 const Vector<const LayoutObject*>& pluginZstack) { |
62 for (size_t i = 0; i < iframeZstack.size() && i < pluginZstack.size(); i++) { | 62 for (size_t i = 0; i < iframeZstack.size() && i < pluginZstack.size(); i++) { |
63 // The root is at the end of these stacks. We want to iterate | 63 // The root is at the end of these stacks. We want to iterate |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 | 118 |
119 static bool intersectsRect(const LayoutObject* renderer, const IntRect& rect) { | 119 static bool intersectsRect(const LayoutObject* renderer, const IntRect& rect) { |
120 return renderer->absoluteBoundingBoxRectIgnoringTransforms().intersects( | 120 return renderer->absoluteBoundingBoxRectIgnoringTransforms().intersects( |
121 rect) && | 121 rect) && |
122 (!renderer->style() || | 122 (!renderer->style() || |
123 renderer->style()->visibility() == EVisibility::Visible); | 123 renderer->style()->visibility() == EVisibility::Visible); |
124 } | 124 } |
125 | 125 |
126 static void addToOcclusions(const LayoutBox* renderer, | 126 static void addToOcclusions(const LayoutBox* renderer, |
127 Vector<IntRect>& occlusions) { | 127 Vector<IntRect>& occlusions) { |
128 occlusions.append(IntRect(roundedIntPoint(renderer->localToAbsolute()), | 128 occlusions.push_back(IntRect(roundedIntPoint(renderer->localToAbsolute()), |
129 flooredIntSize(renderer->size()))); | 129 flooredIntSize(renderer->size()))); |
130 } | 130 } |
131 | 131 |
132 static void addTreeToOcclusions(const LayoutObject* renderer, | 132 static void addTreeToOcclusions(const LayoutObject* renderer, |
133 const IntRect& frameRect, | 133 const IntRect& frameRect, |
134 Vector<IntRect>& occlusions) { | 134 Vector<IntRect>& occlusions) { |
135 if (!renderer) | 135 if (!renderer) |
136 return; | 136 return; |
137 if (renderer->isBox() && intersectsRect(renderer, frameRect)) | 137 if (renderer->isBox() && intersectsRect(renderer, frameRect)) |
138 addToOcclusions(toLayoutBox(renderer), occlusions); | 138 addToOcclusions(toLayoutBox(renderer), occlusions); |
139 for (LayoutObject* child = renderer->slowFirstChild(); child; | 139 for (LayoutObject* child = renderer->slowFirstChild(); child; |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after 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 |