Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(433)

Side by Side Diff: Source/core/dom/ContainerNode.cpp

Issue 15077006: Implement ParentNode IDL interface (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Remove include Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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/html/shadow/InsertionPoint.h" 38 #include "core/html/shadow/InsertionPoint.h"
37 #include "core/inspector/InspectorInstrumentation.h" 39 #include "core/inspector/InspectorInstrumentation.h"
38 #include "core/loader/cache/MemoryCache.h" 40 #include "core/loader/cache/MemoryCache.h"
39 #include "core/page/Chrome.h" 41 #include "core/page/Chrome.h"
40 #include "core/page/ChromeClient.h" 42 #include "core/page/ChromeClient.h"
41 #include "core/page/Frame.h" 43 #include "core/page/Frame.h"
42 #include "core/page/FrameView.h" 44 #include "core/page/FrameView.h"
43 #include "core/page/Page.h" 45 #include "core/page/Page.h"
44 #include "core/platform/graphics/FloatRect.h" 46 #include "core/platform/graphics/FloatRect.h"
45 #include "core/rendering/InlineTextBox.h" 47 #include "core/rendering/InlineTextBox.h"
(...skipping 772 matching lines...) Expand 10 before | Expand all | Expand 10 after
818 // note that we need to recalc the style 820 // note that we need to recalc the style
819 // FIXME: Move to Element 821 // FIXME: Move to Element
820 if (renderer()) { 822 if (renderer()) {
821 if (renderStyle()->affectedByHover() || (isElementNode() && toElement(th is)->childrenAffectedByHover())) 823 if (renderStyle()->affectedByHover() || (isElementNode() && toElement(th is)->childrenAffectedByHover()))
822 setNeedsStyleRecalc(); 824 setNeedsStyleRecalc();
823 if (renderer() && renderer()->style()->hasAppearance()) 825 if (renderer() && renderer()->style()->hasAppearance())
824 renderer()->theme()->stateChanged(renderer(), HoverState); 826 renderer()->theme()->stateChanged(renderer(), HoverState);
825 } 827 }
826 } 828 }
827 829
830 PassRefPtr<HTMLCollection> ContainerNode::children()
831 {
832 return ensureRareData()->ensureNodeLists()->addCacheWithAtomicName<HTMLColle ction>(this, NodeChildren);
833 }
834
835 Element* ContainerNode::firstElementChild() const
836 {
837 return ElementTraversal::firstWithin(this);
838 }
839
840 Element* ContainerNode::lastElementChild() const
841 {
842 Node* n = lastChild();
843 while (n && !n->isElementNode())
844 n = n->previousSibling();
845 return toElement(n);
846 }
847
848 unsigned ContainerNode::childElementCount() const
849 {
850 unsigned count = 0;
851 Node* n = firstChild();
852 while (n) {
853 count += n->isElementNode();
854 n = n->nextSibling();
855 }
856 return count;
857 }
858
828 unsigned ContainerNode::childNodeCount() const 859 unsigned ContainerNode::childNodeCount() const
829 { 860 {
830 unsigned count = 0; 861 unsigned count = 0;
831 Node *n; 862 Node *n;
832 for (n = firstChild(); n; n = n->nextSibling()) 863 for (n = firstChild(); n; n = n->nextSibling())
833 count++; 864 count++;
834 return count; 865 return count;
835 } 866 }
836 867
837 Node *ContainerNode::childNode(unsigned index) const 868 Node *ContainerNode::childNode(unsigned index) const
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
935 return true; 966 return true;
936 967
937 if (node->isElementNode() && toElement(node)->shadow()) 968 if (node->isElementNode() && toElement(node)->shadow())
938 return true; 969 return true;
939 970
940 return false; 971 return false;
941 } 972 }
942 #endif 973 #endif
943 974
944 } // namespace WebCore 975 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698