| 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 23 matching lines...) Expand all Loading... |
| 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/Widget.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 a
bove plugins. | 44 // This file provides a utility function to support rendering certain elements |
| 45 // above plugins. |
| 45 | 46 |
| 46 namespace blink { | 47 namespace blink { |
| 47 | 48 |
| 48 static void getObjectStack(const LayoutObject* ro, | 49 static void getObjectStack(const LayoutObject* ro, |
| 49 Vector<const LayoutObject*>* roStack) { | 50 Vector<const LayoutObject*>* roStack) { |
| 50 roStack->clear(); | 51 roStack->clear(); |
| 51 while (ro) { | 52 while (ro) { |
| 52 roStack->append(ro); | 53 roStack->append(ro); |
| 53 ro = ro->parent(); | 54 ro = ro->parent(); |
| 54 } | 55 } |
| (...skipping 17 matching lines...) Expand all Loading... |
| 72 // See if z-index determines an order. | 73 // See if z-index determines an order. |
| 73 if (ro1->style() && ro2->style()) { | 74 if (ro1->style() && ro2->style()) { |
| 74 int z1 = ro1->style()->zIndex(); | 75 int z1 = ro1->style()->zIndex(); |
| 75 int z2 = ro2->style()->zIndex(); | 76 int z2 = ro2->style()->zIndex(); |
| 76 if (z1 > z2) | 77 if (z1 > z2) |
| 77 return true; | 78 return true; |
| 78 if (z1 < z2) | 79 if (z1 < z2) |
| 79 return false; | 80 return false; |
| 80 } | 81 } |
| 81 | 82 |
| 82 // If the plugin does not have an explicit z-index it stacks behind the if
rame. | 83 // If the plugin does not have an explicit z-index it stacks behind the |
| 83 // This is for maintaining compatibility with IE. | 84 // iframe. This is for maintaining compatibility with IE. |
| 84 if (!ro2->isPositioned()) { | 85 if (!ro2->isPositioned()) { |
| 85 // The 0'th elements of these LayoutObject arrays represent the plugin n
ode and | 86 // The 0'th elements of these LayoutObject arrays represent the plugin |
| 86 // the iframe. | 87 // node and the iframe. |
| 87 const LayoutObject* pluginLayoutObject = pluginZstack[0]; | 88 const LayoutObject* pluginLayoutObject = pluginZstack[0]; |
| 88 const LayoutObject* iframeLayoutObject = iframeZstack[0]; | 89 const LayoutObject* iframeLayoutObject = iframeZstack[0]; |
| 89 | 90 |
| 90 if (pluginLayoutObject->style() && iframeLayoutObject->style()) { | 91 if (pluginLayoutObject->style() && iframeLayoutObject->style()) { |
| 91 if (pluginLayoutObject->style()->zIndex() > | 92 if (pluginLayoutObject->style()->zIndex() > |
| 92 iframeLayoutObject->style()->zIndex()) | 93 iframeLayoutObject->style()->zIndex()) |
| 93 return false; | 94 return false; |
| 94 } | 95 } |
| 95 return true; | 96 return true; |
| 96 } | 97 } |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 // as being in the top layer. | 202 // as being in the top layer. |
| 202 const Element* ancestor = topLayerAncestor(element); | 203 const Element* ancestor = topLayerAncestor(element); |
| 203 Document* document = parentFrameView->frame().document(); | 204 Document* document = parentFrameView->frame().document(); |
| 204 const HeapVector<Member<Element>>& elements = document->topLayerElements(); | 205 const HeapVector<Member<Element>>& elements = document->topLayerElements(); |
| 205 size_t start = ancestor ? elements.find(ancestor) + 1 : 0; | 206 size_t start = ancestor ? elements.find(ancestor) + 1 : 0; |
| 206 for (size_t i = start; i < elements.size(); ++i) | 207 for (size_t i = start; i < elements.size(); ++i) |
| 207 addTreeToOcclusions(elements[i]->layoutObject(), frameRect, occlusions); | 208 addTreeToOcclusions(elements[i]->layoutObject(), frameRect, occlusions); |
| 208 } | 209 } |
| 209 | 210 |
| 210 } // namespace blink | 211 } // namespace blink |
| OLD | NEW |