| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2014 Google Inc. All Rights Reserved. | 2 * Copyright (C) 2014 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 | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 #include "core/dom/StaticNodeList.h" | 29 #include "core/dom/StaticNodeList.h" |
| 30 #include "core/dom/shadow/ShadowRoot.h" | 30 #include "core/dom/shadow/ShadowRoot.h" |
| 31 #include "core/events/EventPath.h" | 31 #include "core/events/EventPath.h" |
| 32 #include "core/events/TouchEventContext.h" | 32 #include "core/events/TouchEventContext.h" |
| 33 | 33 |
| 34 namespace blink { | 34 namespace blink { |
| 35 | 35 |
| 36 bool TreeScopeEventContext::isUnclosedTreeOf( | 36 bool TreeScopeEventContext::isUnclosedTreeOf( |
| 37 const TreeScopeEventContext& other) { | 37 const TreeScopeEventContext& other) { |
| 38 // Exclude closed nodes if necessary. | 38 // Exclude closed nodes if necessary. |
| 39 // If a node is in a closed shadow root, or in a tree whose ancestor has a clo
sed shadow root, | 39 // If a node is in a closed shadow root, or in a tree whose ancestor has a |
| 40 // it should not be visible to nodes above the closed shadow root. | 40 // closed shadow root, it should not be visible to nodes above the closed |
| 41 // shadow root. |
| 41 | 42 |
| 42 // (1) If |this| is an ancestor of |other| in tree-of-trees, include it. | 43 // (1) If |this| is an ancestor of |other| in tree-of-trees, include it. |
| 43 if (isInclusiveAncestorOf(other)) | 44 if (isInclusiveAncestorOf(other)) |
| 44 return true; | 45 return true; |
| 45 | 46 |
| 46 // (2) If no closed shadow root in ancestors of this, include it. | 47 // (2) If no closed shadow root in ancestors of this, include it. |
| 47 if (!containingClosedShadowTree()) | 48 if (!containingClosedShadowTree()) |
| 48 return true; | 49 return true; |
| 49 | 50 |
| 50 // (3) If |this| is descendent of |other|, exclude if any closed shadow root i
n between. | 51 // (3) If |this| is descendent of |other|, exclude if any closed shadow root |
| 52 // in between. |
| 51 if (isDescendantOf(other)) | 53 if (isDescendantOf(other)) |
| 52 return !containingClosedShadowTree()->isDescendantOf(other); | 54 return !containingClosedShadowTree()->isDescendantOf(other); |
| 53 | 55 |
| 54 // (4) |this| and |other| must be in exclusive branches. | 56 // (4) |this| and |other| must be in exclusive branches. |
| 55 #if DCHECK_IS_ON() | 57 #if DCHECK_IS_ON() |
| 56 DCHECK(other.isExclusivePartOf(*this)); | 58 DCHECK(other.isExclusivePartOf(*this)); |
| 57 #endif | 59 #endif |
| 58 return false; | 60 return false; |
| 59 } | 61 } |
| 60 | 62 |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 for (size_t i = 0; i < m_children.size(); ++i) | 117 for (size_t i = 0; i < m_children.size(); ++i) |
| 116 orderNumber = | 118 orderNumber = |
| 117 m_children[i]->calculateTreeOrderAndSetNearestAncestorClosedTree( | 119 m_children[i]->calculateTreeOrderAndSetNearestAncestorClosedTree( |
| 118 orderNumber + 1, containingClosedShadowTree()); | 120 orderNumber + 1, containingClosedShadowTree()); |
| 119 m_postOrder = orderNumber + 1; | 121 m_postOrder = orderNumber + 1; |
| 120 | 122 |
| 121 return orderNumber + 1; | 123 return orderNumber + 1; |
| 122 } | 124 } |
| 123 | 125 |
| 124 } // namespace blink | 126 } // namespace blink |
| OLD | NEW |