Changeset 86491 in webkit
- Timestamp:
- May 14, 2011 11:10:14 AM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r86488 r86491 1 2011-05-14 Ryosuke Niwa <rniwa@webkit.org> 2 3 Reviewed by Eric Seidel. 4 5 Make canHaveChildrenForEditing more efficient 6 https://bugs.webkit.org/show_bug.cgi?id=53564 7 8 Improved the performance (1-2% in release and 20% in debug) by adding virtual member function 9 canContainRangeEndPoint to Node. It returns true whenever the associated node can have be a container 10 node for a position. 11 12 As of this revision, canContainRangeEndPoint returns true on Document, DocumentFragment, Text nodes 13 and any elements except: 14 15 HTML: applet, br, embed, frame, frameset, hr (unless has children), img, input, keygen, 16 meter, object (unless uses fallback content), output, progress, select, and textarea. 17 18 No new tests are added since this change cannot be tested directly. 19 20 * dom/Document.h: 21 (WebCore::Document::canContainRangeEndPoint): Added; returns false. 22 * dom/DocumentFragment.h: 23 (WebCore::DocumentFragment::canContainRangeEndPoint): Added; returns true. 24 * dom/Element.h: 25 (WebCore::Element::canContainRangeEndPoint): Ditto. 26 * dom/Node.h: 27 (WebCore::Node::canContainRangeEndPoint): Added; returns false. 28 * dom/Text.h: 29 (WebCore::Text::canContainRangeEndPoint): Added; returns true. 30 * editing/htmlediting.cpp: Removed editingIgnoresContent and canHaveChildrenForEditing. 31 * editing/htmlediting.h: 32 (WebCore::editingIgnoresContent): Moved from htmlediting.cpp; made it inline. 33 (WebCore::canHaveChildrenForEditing): Ditto. 34 * html/HTMLBRElement.h: 35 (WebCore::HTMLBRElement::canContainRangeEndPoint): Added; returns false. 36 * html/HTMLButtonElement.h: 37 (WebCore::HTMLDataGridElement::canContainRangeEndPoint): Ditto. 38 * html/HTMLFormControlElement.h: 39 (WebCore::HTMLFormControlElementWithState::canContainRangeEndPoint): Ditto. 40 * html/HTMLFrameElementBase.h: 41 (WebCore::HTMLFrameElementBase::canContainRangeEndPoint): Ditto. 42 * html/HTMLImageElement.h: 43 (WebCore::HTMLImageElement::canContainRangeEndPoint): Ditto. 44 * html/HTMLMeterElement.h: 45 (WebCore::HTMLMeterElement::canContainRangeEndPoint): Ditto. 46 * html/HTMLOutputElement.h: 47 (WebCore::HTMLOutputElement::canContainRangeEndPoint): Ditto. 48 * html/HTMLPlugInElement.h: 49 (WebCore::HTMLPlugInElement::canContainRangeEndPoint): Ditto. 50 * html/HTMLProgressElement.h: 51 (WebCore::HTMLProgressElement::canContainRangeEndPoint): Ditto. 52 * html/HTMLHRElement.h: 53 (WebCore::HTMLHRElement::canContainRangeEndPoint): Added; returns true iff it has children. 54 * html/HTMLObjectElement.h: 55 (WebCore::HTMLObjectElement::canContainRangeEndPoint): Added; returns true iff it uses fallback 56 content. 57 1 58 2011-05-14 Jeremy Noble <jer.noble@apple.com> 2 59 -
trunk/Source/WebCore/dom/Document.h
r86488 r86491 249 249 Element* getElementById(const AtomicString& id) const; 250 250 251 virtual bool canContainRangeEndPoint() const { return true; } 252 251 253 Element* getElementByAccessKey(const String& key); 252 254 void invalidateAccessKeyMap(); -
trunk/Source/WebCore/dom/DocumentFragment.h
r83816 r86491 36 36 void parseHTML(const String&, Element* contextElement, FragmentScriptingPermission = FragmentScriptingAllowed); 37 37 bool parseXML(const String&, Element* contextElement, FragmentScriptingPermission = FragmentScriptingAllowed); 38 39 virtual bool canContainRangeEndPoint() const { return true; } 38 40 39 41 protected: -
trunk/Source/WebCore/dom/Element.h
r85811 r86491 327 327 virtual bool isFrameElementBase() const { return false; } 328 328 329 virtual bool canContainRangeEndPoint() const { return true; } 330 329 331 virtual bool formControlValueMatchesRenderer() const { return false; } 330 332 virtual void setFormControlValueMatchesRenderer(bool) { } -
trunk/Source/WebCore/dom/Node.h
r86248 r86491 238 238 void setNextSibling(Node* next) { m_next = next; } 239 239 240 virtual bool canContainRangeEndPoint() const { return false; } 241 240 242 // FIXME: These two functions belong in editing -- "atomic node" is an editing concept. 241 243 Node* previousNodeConsideringAtomicNodes() const; -
trunk/Source/WebCore/dom/Text.h
r83816 r86491 43 43 44 44 virtual void attach(); 45 46 virtual bool canContainRangeEndPoint() const { return true; } 45 47 46 48 protected: -
trunk/Source/WebCore/editing/htmlediting.cpp
r85256 r86491 62 62 } 63 63 64 // Returns true for nodes that either have no content, or have content that is ignored (skipped65 // over) while editing. There are no VisiblePositions inside these nodes.66 bool editingIgnoresContent(const Node* node)67 {68 return !canHaveChildrenForEditing(node) && !node->isTextNode();69 }70 71 bool canHaveChildrenForEditing(const Node* node)72 {73 return !node->isTextNode()74 && !node->hasTagName(brTag)75 && !node->hasTagName(imgTag)76 && !node->hasTagName(inputTag)77 && !node->hasTagName(textareaTag)78 && (!node->hasTagName(objectTag) || static_cast<const HTMLObjectElement*>(node)->useFallbackContent())79 && !node->hasTagName(iframeTag)80 && !node->hasTagName(embedTag)81 && !node->hasTagName(appletTag)82 && !node->hasTagName(selectTag)83 && (!node->hasTagName(hrTag) || node->hasChildNodes());84 }85 86 64 // Compare two positions, taking into account the possibility that one or both 87 65 // could be inside a shadow tree. Only works for non-null values. -
trunk/Source/WebCore/editing/htmlediting.h
r86325 r86491 77 77 // boolean functions on Node 78 78 79 bool editingIgnoresContent(const Node*); 80 bool canHaveChildrenForEditing(const Node*); 79 // FIXME: editingIgnoresContent, canHaveChildrenForEditing, and isAtomicNode 80 // should be renamed to reflect its usage. 81 82 // Returns true for nodes that either have no content, or have content that is ignored (skipped over) while editing. 83 // There are no VisiblePositions inside these nodes. 84 inline bool editingIgnoresContent(const Node* node) 85 { 86 return !node->canContainRangeEndPoint(); 87 } 88 89 inline bool canHaveChildrenForEditing(const Node* node) 90 { 91 return !node->isTextNode() && node->canContainRangeEndPoint(); 92 } 93 81 94 bool isAtomicNode(const Node*); 82 95 bool isBlock(const Node*); -
trunk/Source/WebCore/html/HTMLBRElement.h
r78232 r86491 34 34 static PassRefPtr<HTMLBRElement> create(const QualifiedName&, Document*); 35 35 36 virtual bool canContainRangeEndPoint() const { return false; } 37 36 38 private: 37 39 HTMLBRElement(const QualifiedName&, Document*); -
trunk/Source/WebCore/html/HTMLFormControlElement.h
r82925 r86491 173 173 virtual ~HTMLFormControlElementWithState(); 174 174 175 virtual bool canContainRangeEndPoint() const { return false; } 176 175 177 protected: 176 178 HTMLFormControlElementWithState(const QualifiedName& tagName, Document*, HTMLFormElement*); -
trunk/Source/WebCore/html/HTMLFrameElementBase.h
r84706 r86491 49 49 virtual bool containsFullScreenElement() const { return m_containsFullScreenElement; }; 50 50 #endif 51 52 virtual bool canContainRangeEndPoint() const { return false; } 51 53 52 54 protected: -
trunk/Source/WebCore/html/HTMLHRElement.h
r78232 r86491 33 33 static PassRefPtr<HTMLHRElement> create(const QualifiedName&, Document*); 34 34 35 virtual bool canContainRangeEndPoint() const { return hasChildNodes(); } 36 35 37 private: 36 38 HTMLHRElement(const QualifiedName&, Document*); -
trunk/Source/WebCore/html/HTMLImageElement.h
r85375 r86491 76 76 bool hasPendingActivity(); 77 77 78 virtual bool canContainRangeEndPoint() const { return false; } 79 78 80 protected: 79 81 HTMLImageElement(const QualifiedName&, Document*, HTMLFormElement* = 0); -
trunk/Source/WebCore/html/HTMLMeterElement.h
r82899 r86491 60 60 GaugeRegion gaugeRegion() const; 61 61 62 bool canContainRangeEndPoint() const { return false; } 63 62 64 private: 63 65 HTMLMeterElement(const QualifiedName&, Document*, HTMLFormElement*); -
trunk/Source/WebCore/html/HTMLObjectElement.h
r82925 r86491 64 64 using TreeShared<ContainerNode>::deref; 65 65 66 virtual bool canContainRangeEndPoint() const { return useFallbackContent(); } 67 66 68 private: 67 69 HTMLObjectElement(const QualifiedName&, Document*, HTMLFormElement*, bool createdByParser); -
trunk/Source/WebCore/html/HTMLOutputElement.h
r82925 r86491 50 50 void setFor(const String&); 51 51 DOMSettableTokenList* htmlFor() const; 52 53 virtual bool canContainRangeEndPoint() const { return false; } 52 54 53 55 private: -
trunk/Source/WebCore/html/HTMLPlugInElement.h
r78232 r86491 52 52 void setIsCapturingMouseEvents(bool capturing) { m_isCapturingMouseEvents = capturing; } 53 53 54 bool canContainRangeEndPoint() const { return false; } 55 54 56 protected: 55 57 HTMLPlugInElement(const QualifiedName& tagName, Document*); -
trunk/Source/WebCore/html/HTMLProgressElement.h
r84156 r86491 44 44 double position() const; 45 45 46 virtual bool canContainRangeEndPoint() const { return false; } 47 46 48 private: 47 49 HTMLProgressElement(const QualifiedName&, Document*, HTMLFormElement*);
Note: See TracChangeset
for help on using the changeset viewer.