Changeset 102081 in webkit
- Timestamp:
- Dec 5, 2011, 6:04:16 PM (15 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 5 edited
-
ChangeLog (modified) (1 diff)
-
dom/ContainerNode.cpp (modified) (1 diff)
-
dom/ContainerNode.h (modified) (6 diffs)
-
dom/Element.h (modified) (1 diff)
-
dom/Node.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r102080 r102081 1 2011-12-05 Darin Adler <darin@apple.com> 2 3 Some small improvements to ContainerNode.h 4 https://bugs.webkit.org/show_bug.cgi?id=73786 5 6 Reviewed by Alexey Proskuryakov. 7 8 * dom/ContainerNode.cpp: 9 (WebCore::ContainerNode::suspendPostAttachCallbacks): Added a FIXME comment about the 10 peculiar behavior of this function. Somehow the post-attach suspend state is both 11 global and specific to a certain Page object. That can't be right. If it was truly 12 global then this would be a static member function. If it was truly per-page, then 13 the related functions could not be static. 14 15 * dom/ContainerNode.h: Removed some unneeded argument names. Moved the hasChildNodes 16 function up with the other basic getters. Put the other getters, childNodeCount and 17 childNode, right after the basic getters. Used ASSERT_NO_EXCEPTION in all the basic 18 mutation functions so they can be used in a cleaner fashion in C++ code where we have 19 some reason to know an exception won't occur. Grouped all the overrides of functions 20 from Node into a single paragraph and used the OVERRIDE macro on all of them. Made the 21 queuePostAttachCallback and postAttachCallbacksAreSuspended functions protected. 22 23 * dom/Element.h: Moved the include of ExceptionCodePlaceholder.h into ContainerNode.h. 24 25 * dom/Node.cpp: 26 (WebCore::Node::lazyAttach): Use hasChildNodes instead of firstChild for clarity. 27 (WebCore::Node::isDescendantOf): Ditto. 28 1 29 2011-12-05 Benjamin Poulain <benjamin@webkit.org> 2 30 -
trunk/Source/WebCore/dom/ContainerNode.cpp
r99305 r102081 714 714 ASSERT(!s_shouldReEnableMemoryCacheCallsAfterAttach); 715 715 if (Page* page = document()->page()) { 716 // FIXME: How can this call be specific to one Page, while the 717 // s_attachDepth is a global? Doesn't make sense. 716 718 if (page->areMemoryCacheClientCallsEnabled()) { 717 719 page->setMemoryCacheClientCallsEnabled(false); -
trunk/Source/WebCore/dom/ContainerNode.h
r93071 r102081 3 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 4 4 * (C) 2001 Dirk Mueller (mueller@kde.org) 5 * Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010 Apple Inc. All rights reserved.5 * Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010, 2011 Apple Inc. All rights reserved. 6 6 * 7 7 * This library is free software; you can redistribute it and/or … … 25 25 #define ContainerNode_h 26 26 27 #include "ExceptionCodePlaceholder.h" 27 28 #include "Node.h" 28 29 … … 35 36 namespace Private { 36 37 template<class GenericNode, class GenericNodeContainer> 37 void addChildNodesToDeletionQueue(GenericNode*& head, GenericNode*& tail, GenericNodeContainer* container);38 void addChildNodesToDeletionQueue(GenericNode*& head, GenericNode*& tail, GenericNodeContainer*); 38 39 }; 39 40 … … 44 45 Node* firstChild() const { return m_firstChild; } 45 46 Node* lastChild() const { return m_lastChild; } 47 bool hasChildNodes() const { return m_firstChild; } 46 48 47 bool insertBefore(PassRefPtr<Node> newChild, Node* refChild, ExceptionCode&, bool shouldLazyAttach = false); 48 bool replaceChild(PassRefPtr<Node> newChild, Node* oldChild, ExceptionCode&, bool shouldLazyAttach = false); 49 bool removeChild(Node* child, ExceptionCode&); 50 bool appendChild(PassRefPtr<Node> newChild, ExceptionCode&, bool shouldLazyAttach = false); 49 unsigned childNodeCount() const; 50 Node* childNode(unsigned index) const; 51 52 bool insertBefore(PassRefPtr<Node> newChild, Node* refChild, ExceptionCode& = ASSERT_NO_EXCEPTION, bool shouldLazyAttach = false); 53 bool replaceChild(PassRefPtr<Node> newChild, Node* oldChild, ExceptionCode& = ASSERT_NO_EXCEPTION, bool shouldLazyAttach = false); 54 bool removeChild(Node* child, ExceptionCode& = ASSERT_NO_EXCEPTION); 55 bool appendChild(PassRefPtr<Node> newChild, ExceptionCode& = ASSERT_NO_EXCEPTION, bool shouldLazyAttach = false); 51 56 52 57 // These methods are only used during parsing. … … 57 62 void parserInsertBefore(PassRefPtr<Node> newChild, Node* refChild); 58 63 59 bool hasChildNodes() const { return m_firstChild; }60 virtual void attach();61 virtual void detach();62 virtual void willRemove();63 virtual LayoutRect getRect() const;64 virtual void setFocus(bool = true);65 virtual void setActive(bool active = true, bool pause = false);66 virtual void setHovered(bool = true);67 unsigned childNodeCount() const;68 Node* childNode(unsigned index) const;69 70 virtual void insertedIntoDocument();71 virtual void removedFromDocument();72 virtual void insertedIntoTree(bool deep);73 virtual void removedFromTree(bool deep);74 virtual void childrenChanged(bool createdByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);75 76 64 // FIXME: It's not good to have two functions with such similar names, especially public functions. 77 65 // How do removeChildren and removeAllChildren differ? 78 66 void removeChildren(); 79 67 void removeAllChildren(); 68 80 69 void takeAllChildrenFrom(ContainerNode*); 81 70 … … 83 72 84 73 bool dispatchBeforeLoadEvent(const String& sourceURL); 74 75 virtual void attach() OVERRIDE; 76 virtual void detach() OVERRIDE; 77 virtual void willRemove() OVERRIDE; 78 virtual LayoutRect getRect() const OVERRIDE; 79 virtual void setFocus(bool = true) OVERRIDE; 80 virtual void setActive(bool active = true, bool pause = false) OVERRIDE; 81 virtual void setHovered(bool = true) OVERRIDE; 82 virtual void insertedIntoDocument() OVERRIDE; 83 virtual void removedFromDocument() OVERRIDE; 84 virtual void insertedIntoTree(bool deep) OVERRIDE; 85 virtual void removedFromTree(bool deep) OVERRIDE; 86 virtual void childrenChanged(bool createdByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0) OVERRIDE; 87 virtual void scheduleSetNeedsStyleRecalc(StyleChangeType = FullStyleChange) OVERRIDE; 85 88 86 virtual void scheduleSetNeedsStyleRecalc(StyleChangeType = FullStyleChange); 89 protected: 90 ContainerNode(Document*, ConstructionType = CreateContainer); 87 91 88 92 static void queuePostAttachCallback(NodeCallback, Node*, unsigned = 0); 89 93 static bool postAttachCallbacksAreSuspended(); 90 91 protected:92 ContainerNode(Document*, ConstructionType = CreateContainer);93 94 94 void suspendPostAttachCallbacks(); 95 95 void resumePostAttachCallbacks(); 96 96 97 97 template<class GenericNode, class GenericNodeContainer> 98 friend void appendChildToContainer(GenericNode* child, GenericNodeContainer* container);98 friend void appendChildToContainer(GenericNode* child, GenericNodeContainer*); 99 99 100 100 template<class GenericNode, class GenericNodeContainer> 101 friend void Private::addChildNodesToDeletionQueue(GenericNode*& head, GenericNode*& tail, GenericNodeContainer* container);101 friend void Private::addChildNodesToDeletionQueue(GenericNode*& head, GenericNode*& tail, GenericNodeContainer*); 102 102 103 103 void setFirstChild(Node* child) { m_firstChild = child; } -
trunk/Source/WebCore/dom/Element.h
r99778 r102081 27 27 28 28 #include "Document.h" 29 #include "ExceptionCodePlaceholder.h"30 29 #include "FragmentScriptingPermission.h" 31 30 #include "NamedNodeMap.h" -
trunk/Source/WebCore/dom/Node.cpp
r101995 r102081 932 932 { 933 933 for (Node* n = this; n; n = n->traverseNextNode(this)) { 934 if (n-> firstChild())934 if (n->hasChildNodes()) 935 935 n->setChildNeedsStyleRecalc(); 936 936 n->setStyleChange(FullStyleChange); … … 1349 1349 { 1350 1350 // Return true if other is an ancestor of this, otherwise false 1351 if (!other || !other-> firstChild() || inDocument() != other->inDocument())1351 if (!other || !other->hasChildNodes() || inDocument() != other->inDocument()) 1352 1352 return false; 1353 1353 if (other == other->document())
Note:
See TracChangeset
for help on using the changeset viewer.