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 Apple Inc. All rights reserv
ed. | 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv
ed. |
6 * | 6 * |
7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
(...skipping 12 matching lines...) Expand all Loading... |
23 #include "config.h" | 23 #include "config.h" |
24 #include "core/dom/ContainerNode.h" | 24 #include "core/dom/ContainerNode.h" |
25 | 25 |
26 #include "HTMLNames.h" | 26 #include "HTMLNames.h" |
27 #include "core/accessibility/AXObjectCache.h" | 27 #include "core/accessibility/AXObjectCache.h" |
28 #include "core/dom/ChildListMutationScope.h" | 28 #include "core/dom/ChildListMutationScope.h" |
29 #include "core/dom/ContainerNodeAlgorithms.h" | 29 #include "core/dom/ContainerNodeAlgorithms.h" |
30 #include "core/dom/EventNames.h" | 30 #include "core/dom/EventNames.h" |
31 #include "core/dom/ExceptionCode.h" | 31 #include "core/dom/ExceptionCode.h" |
32 #include "core/dom/MutationEvent.h" | 32 #include "core/dom/MutationEvent.h" |
| 33 #include "core/dom/NodeRareData.h" |
33 #include "core/dom/NodeRenderStyle.h" | 34 #include "core/dom/NodeRenderStyle.h" |
34 #include "core/dom/NodeTraversal.h" | 35 #include "core/dom/NodeTraversal.h" |
35 #include "core/dom/TemplateContentDocumentFragment.h" | 36 #include "core/dom/TemplateContentDocumentFragment.h" |
| 37 #include "core/html/HTMLCollection.h" |
36 #include "core/inspector/InspectorInstrumentation.h" | 38 #include "core/inspector/InspectorInstrumentation.h" |
37 #include "core/loader/cache/MemoryCache.h" | 39 #include "core/loader/cache/MemoryCache.h" |
38 #include "core/page/Chrome.h" | 40 #include "core/page/Chrome.h" |
39 #include "core/page/ChromeClient.h" | 41 #include "core/page/ChromeClient.h" |
40 #include "core/page/Frame.h" | 42 #include "core/page/Frame.h" |
41 #include "core/page/FrameView.h" | 43 #include "core/page/FrameView.h" |
42 #include "core/page/Page.h" | 44 #include "core/page/Page.h" |
43 #include "core/platform/graphics/FloatRect.h" | 45 #include "core/platform/graphics/FloatRect.h" |
44 #include "core/rendering/InlineTextBox.h" | 46 #include "core/rendering/InlineTextBox.h" |
45 #include "core/rendering/RenderBox.h" | 47 #include "core/rendering/RenderBox.h" |
(...skipping 771 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
817 // note that we need to recalc the style | 819 // note that we need to recalc the style |
818 // FIXME: Move to Element | 820 // FIXME: Move to Element |
819 if (renderer()) { | 821 if (renderer()) { |
820 if (renderStyle()->affectedByHover() || (isElementNode() && toElement(th
is)->childrenAffectedByHover())) | 822 if (renderStyle()->affectedByHover() || (isElementNode() && toElement(th
is)->childrenAffectedByHover())) |
821 setNeedsStyleRecalc(); | 823 setNeedsStyleRecalc(); |
822 if (renderer() && renderer()->style()->hasAppearance()) | 824 if (renderer() && renderer()->style()->hasAppearance()) |
823 renderer()->theme()->stateChanged(renderer(), HoverState); | 825 renderer()->theme()->stateChanged(renderer(), HoverState); |
824 } | 826 } |
825 } | 827 } |
826 | 828 |
| 829 PassRefPtr<HTMLCollection> ContainerNode::children() |
| 830 { |
| 831 return ensureRareData()->ensureNodeLists()->addCacheWithAtomicName<HTMLColle
ction>(this, NodeChildren); |
| 832 } |
| 833 |
| 834 Element* ContainerNode::firstElementChild() const |
| 835 { |
| 836 return ElementTraversal::firstWithin(this); |
| 837 } |
| 838 |
| 839 Element* ContainerNode::lastElementChild() const |
| 840 { |
| 841 Node* n = lastChild(); |
| 842 while (n && !n->isElementNode()) |
| 843 n = n->previousSibling(); |
| 844 return toElement(n); |
| 845 } |
| 846 |
| 847 unsigned ContainerNode::childElementCount() const |
| 848 { |
| 849 unsigned count = 0; |
| 850 Node* n = firstChild(); |
| 851 while (n) { |
| 852 count += n->isElementNode(); |
| 853 n = n->nextSibling(); |
| 854 } |
| 855 return count; |
| 856 } |
| 857 |
827 unsigned ContainerNode::childNodeCount() const | 858 unsigned ContainerNode::childNodeCount() const |
828 { | 859 { |
829 unsigned count = 0; | 860 unsigned count = 0; |
830 Node *n; | 861 Node *n; |
831 for (n = firstChild(); n; n = n->nextSibling()) | 862 for (n = firstChild(); n; n = n->nextSibling()) |
832 count++; | 863 count++; |
833 return count; | 864 return count; |
834 } | 865 } |
835 | 866 |
836 Node *ContainerNode::childNode(unsigned index) const | 867 Node *ContainerNode::childNode(unsigned index) const |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
934 return true; | 965 return true; |
935 | 966 |
936 if (node->isElementNode() && toElement(node)->shadow()) | 967 if (node->isElementNode() && toElement(node)->shadow()) |
937 return true; | 968 return true; |
938 | 969 |
939 return false; | 970 return false; |
940 } | 971 } |
941 #endif | 972 #endif |
942 | 973 |
943 } // namespace WebCore | 974 } // namespace WebCore |
OLD | NEW |