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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 } | 93 } |
94 return true; | 94 return true; |
95 } | 95 } |
96 | 96 |
97 // Inspect the document order. Later order means higher stacking. | 97 // Inspect the document order. Later order means higher stacking. |
98 const RenderObject* parent = ro1->parent(); | 98 const RenderObject* parent = ro1->parent(); |
99 if (!parent) | 99 if (!parent) |
100 return false; | 100 return false; |
101 ASSERT(parent == ro2->parent()); | 101 ASSERT(parent == ro2->parent()); |
102 | 102 |
103 for (const RenderObject* ro = parent->firstChild(); ro; ro = ro->nex
tSibling()) { | 103 for (const RenderObject* ro = parent->slowFirstChild(); ro; ro = ro-
>nextSibling()) { |
104 if (ro == ro1) | 104 if (ro == ro1) |
105 return false; | 105 return false; |
106 if (ro == ro2) | 106 if (ro == ro2) |
107 return true; | 107 return true; |
108 } | 108 } |
109 ASSERT(false); // We should have seen ro1 and ro2 by now. | 109 ASSERT(false); // We should have seen ro1 and ro2 by now. |
110 return false; | 110 return false; |
111 } | 111 } |
112 } | 112 } |
113 return true; | 113 return true; |
(...skipping 11 matching lines...) Expand all Loading... |
125 IntSize size(renderer->width(), renderer->height()); | 125 IntSize size(renderer->width(), renderer->height()); |
126 occlusions.append(IntRect(point, size)); | 126 occlusions.append(IntRect(point, size)); |
127 } | 127 } |
128 | 128 |
129 static void addTreeToOcclusions(const RenderObject* renderer, const IntRect& fra
meRect, Vector<IntRect>& occlusions) | 129 static void addTreeToOcclusions(const RenderObject* renderer, const IntRect& fra
meRect, Vector<IntRect>& occlusions) |
130 { | 130 { |
131 if (!renderer) | 131 if (!renderer) |
132 return; | 132 return; |
133 if (renderer->isBox() && intersectsRect(renderer, frameRect)) | 133 if (renderer->isBox() && intersectsRect(renderer, frameRect)) |
134 addToOcclusions(toRenderBox(renderer), occlusions); | 134 addToOcclusions(toRenderBox(renderer), occlusions); |
135 for (RenderObject* child = renderer->firstChild(); child; child = child->nex
tSibling()) | 135 for (RenderObject* child = renderer->slowFirstChild(); child; child = child-
>nextSibling()) |
136 addTreeToOcclusions(child, frameRect, occlusions); | 136 addTreeToOcclusions(child, frameRect, occlusions); |
137 } | 137 } |
138 | 138 |
139 static const Element* topLayerAncestor(const Element* element) | 139 static const Element* topLayerAncestor(const Element* element) |
140 { | 140 { |
141 while (element && !element->isInTopLayer()) | 141 while (element && !element->isInTopLayer()) |
142 element = element->parentOrShadowHostElement(); | 142 element = element->parentOrShadowHostElement(); |
143 return element; | 143 return element; |
144 } | 144 } |
145 | 145 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 // as being in the top layer. | 193 // as being in the top layer. |
194 const Element* ancestor = topLayerAncestor(element); | 194 const Element* ancestor = topLayerAncestor(element); |
195 Document* document = parentFrameView->frame().document(); | 195 Document* document = parentFrameView->frame().document(); |
196 const WillBeHeapVector<RefPtrWillBeMember<Element> >& elements = document->t
opLayerElements(); | 196 const WillBeHeapVector<RefPtrWillBeMember<Element> >& elements = document->t
opLayerElements(); |
197 size_t start = ancestor ? elements.find(ancestor) + 1 : 0; | 197 size_t start = ancestor ? elements.find(ancestor) + 1 : 0; |
198 for (size_t i = start; i < elements.size(); ++i) | 198 for (size_t i = start; i < elements.size(); ++i) |
199 addTreeToOcclusions(elements[i]->renderer(), frameRect, occlusions); | 199 addTreeToOcclusions(elements[i]->renderer(), frameRect, occlusions); |
200 } | 200 } |
201 | 201 |
202 } // namespace WebCore | 202 } // namespace WebCore |
OLD | NEW |