OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2001 Dirk Mueller (mueller@kde.org) | 4 * (C) 2001 Dirk Mueller (mueller@kde.org) |
5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights
reserved. | 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights
reserved. |
6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) | 6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) |
7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) | 7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) |
8 * | 8 * |
9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
(...skipping 1174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1185 return false; | 1185 return false; |
1186 } | 1186 } |
1187 | 1187 |
1188 bool Node::contains(const Node* node) const | 1188 bool Node::contains(const Node* node) const |
1189 { | 1189 { |
1190 if (!node) | 1190 if (!node) |
1191 return false; | 1191 return false; |
1192 return this == node || node->isDescendantOf(this); | 1192 return this == node || node->isDescendantOf(this); |
1193 } | 1193 } |
1194 | 1194 |
| 1195 bool Node::containsIncludingShadowDOM(Node* node) |
| 1196 { |
| 1197 if (!node) |
| 1198 return false; |
| 1199 for (Node* n = node; n; n = n->parentOrHostNode()) { |
| 1200 if (n == this) |
| 1201 return true; |
| 1202 } |
| 1203 return false; |
| 1204 } |
| 1205 |
1195 void Node::attach() | 1206 void Node::attach() |
1196 { | 1207 { |
1197 ASSERT(!attached()); | 1208 ASSERT(!attached()); |
1198 ASSERT(!renderer() || (renderer()->style() && renderer()->parent())); | 1209 ASSERT(!renderer() || (renderer()->style() && renderer()->parent())); |
1199 | 1210 |
1200 // If this node got a renderer it may be the previousRenderer() of sibling t
ext nodes and thus affect the | 1211 // If this node got a renderer it may be the previousRenderer() of sibling t
ext nodes and thus affect the |
1201 // result of Text::rendererIsNeeded() for those nodes. | 1212 // result of Text::rendererIsNeeded() for those nodes. |
1202 if (renderer()) { | 1213 if (renderer()) { |
1203 for (Node* next = nextSibling(); next; next = next->nextSibling()) { | 1214 for (Node* next = nextSibling(); next; next = next->nextSibling()) { |
1204 if (next->renderer()) | 1215 if (next->renderer()) |
(...skipping 1422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2627 // Non-bubbling events call only one default event handler, the one for
the target. | 2638 // Non-bubbling events call only one default event handler, the one for
the target. |
2628 defaultEventHandler(event.get()); | 2639 defaultEventHandler(event.get()); |
2629 ASSERT(!event->defaultPrevented()); | 2640 ASSERT(!event->defaultPrevented()); |
2630 if (event->defaultHandled()) | 2641 if (event->defaultHandled()) |
2631 goto doneWithDefault; | 2642 goto doneWithDefault; |
2632 // For bubbling events, call default event handlers on the same targets
in the | 2643 // For bubbling events, call default event handlers on the same targets
in the |
2633 // same order as the bubbling phase. | 2644 // same order as the bubbling phase. |
2634 if (event->bubbles()) { | 2645 if (event->bubbles()) { |
2635 size_t size = ancestors.size(); | 2646 size_t size = ancestors.size(); |
2636 for (size_t i = 0; i < size; ++i) { | 2647 for (size_t i = 0; i < size; ++i) { |
2637 ancestors[i].defaultEventHandler(event.get()); | 2648 ancestors[i].node()->defaultEventHandler(event.get()); |
2638 ASSERT(!event->defaultPrevented()); | 2649 ASSERT(!event->defaultPrevented()); |
2639 if (event->defaultHandled()) | 2650 if (event->defaultHandled()) |
2640 goto doneWithDefault; | 2651 goto doneWithDefault; |
2641 } | 2652 } |
2642 } | 2653 } |
2643 } | 2654 } |
2644 | 2655 |
2645 doneWithDefault: | 2656 doneWithDefault: |
2646 | 2657 |
2647 // Ensure that after event dispatch, the event's target object is the | 2658 // Ensure that after event dispatch, the event's target object is the |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2948 | 2959 |
2949 #ifndef NDEBUG | 2960 #ifndef NDEBUG |
2950 | 2961 |
2951 void showTree(const WebCore::Node* node) | 2962 void showTree(const WebCore::Node* node) |
2952 { | 2963 { |
2953 if (node) | 2964 if (node) |
2954 node->showTreeForThis(); | 2965 node->showTreeForThis(); |
2955 } | 2966 } |
2956 | 2967 |
2957 #endif | 2968 #endif |
OLD | NEW |