Changeset 78219 in webkit
- Timestamp:
- Feb 10, 2011 6:47:26 AM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 24 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r78212 r78219 1 2011-02-10 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, button, datagrid, embed, frame, frameset, hr, img, input, 16 meter, object, output, progress, and select. 17 18 WML: br, do, img, input, and select. 19 20 No new tests are added since this change cannot be tested directly. 21 22 * dom/Document.h: 23 (WebCore::Document::canContainRangeEndPoint): Added; returns false. 24 * dom/DocumentFragment.h: 25 (WebCore::DocumentFragment::canContainRangeEndPoint): Added; returns true. 26 * dom/Element.h: 27 (WebCore::Element::canContainRangeEndPoint): Ditto. 28 * dom/Node.h: 29 (WebCore::Node::canContainRangeEndPoint): Added; returns false. 30 * dom/Text.h: 31 (WebCore::Text::canContainRangeEndPoint): Added; returns true. 32 * editing/htmlediting.cpp: Removed editingIgnoresContent and canHaveChildrenForEditing. 33 * editing/htmlediting.h: 34 (WebCore::editingIgnoresContent): Moved from htmlediting.cpp; made it inline. 35 (WebCore::canHaveChildrenForEditing): Ditto. 36 * html/HTMLBRElement.h: 37 (WebCore::HTMLBRElement::canContainRangeEndPoint): Added; returns false. 38 * html/HTMLButtonElement.h: 39 (WebCore::HTMLButtonElement::canContainRangeEndPoint): Ditto. 40 * html/HTMLDataGridElement.h: 41 (WebCore::HTMLDataGridElement::canContainRangeEndPoint): Ditto. 42 * html/HTMLFormControlElement.h: 43 (WebCore::HTMLFormControlElementWithState::canContainRangeEndPoint): Ditto. 44 * html/HTMLFrameElementBase.h: 45 (WebCore::HTMLFrameElementBase::canContainRangeEndPoint): Ditto. 46 * html/HTMLHRElement.h: 47 (WebCore::HTMLHRElement::canContainRangeEndPoint): Ditto. 48 * html/HTMLImageElement.h: 49 (WebCore::HTMLImageElement::canContainRangeEndPoint): Ditto. 50 * html/HTMLMeterElement.h: 51 (WebCore::HTMLMeterElement::canContainRangeEndPoint): Ditto. 52 * html/HTMLOutputElement.h: 53 (WebCore::HTMLOutputElement::canContainRangeEndPoint): Ditto. 54 * html/HTMLPlugInElement.h: 55 (WebCore::HTMLPlugInElement::canContainRangeEndPoint): Ditto. 56 * html/HTMLProgressElement.h: 57 (WebCore::HTMLProgressElement::canContainRangeEndPoint): Ditto. 58 * wml/WMLBRElement.h: 59 (WebCore::WMLBRElement::canContainRangeEndPoint): Ditto. 60 * wml/WMLDoElement.h: 61 (WebCore::WMLDoElement::canContainRangeEndPoint): Ditto. 62 * wml/WMLImageElement.h: 63 (WebCore::WMLImageElement::canContainRangeEndPoint): Ditto. 64 * wml/WMLInputElement.h: 65 (WebCore::WMLInputElement::canContainRangeEndPoint): Ditto. 66 * wml/WMLSelectElement.h: 67 (WebCore::WMLSelectElement::canContainRangeEndPoint): Ditto. 68 1 69 2011-02-10 Pavel Feldman <pfeldman@chromium.org> 2 70 -
trunk/Source/WebCore/dom/Document.h
r78147 r78219 439 439 } 440 440 441 virtual bool canContainRangeEndPoint() const { return true; } 442 441 443 Element* getElementByAccessKey(const String& key) const; 442 444 -
trunk/Source/WebCore/dom/DocumentFragment.h
r65978 r78219 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 private: -
trunk/Source/WebCore/dom/Element.h
r76727 r78219 314 314 virtual bool isOutOfRange() const { return false; } 315 315 316 virtual bool canContainRangeEndPoint() const { return true; } 317 316 318 virtual bool formControlValueMatchesRenderer() const { return false; } 317 319 virtual void setFormControlValueMatchesRenderer(bool) { } -
trunk/Source/WebCore/dom/Node.h
r76115 r78219 231 231 void setNextSibling(Node* next) { m_next = next; } 232 232 233 virtual bool canContainRangeEndPoint() const { return false; } 234 233 235 // FIXME: These two functions belong in editing -- "atomic node" is an editing concept. 234 236 Node* previousNodeConsideringAtomicNodes() const; -
trunk/Source/WebCore/dom/Text.h
r58914 r78219 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
r78150 r78219 65 65 } 66 66 67 // Returns true for nodes that either have no content, or have content that is ignored (skipped68 // over) while editing. There are no VisiblePositions inside these nodes.69 bool editingIgnoresContent(const Node* node)70 {71 return !canHaveChildrenForEditing(node) && !node->isTextNode();72 }73 74 bool canHaveChildrenForEditing(const Node* node)75 {76 return !node->hasTagName(hrTag) &&77 !node->hasTagName(brTag) &&78 !node->hasTagName(imgTag) &&79 !node->hasTagName(buttonTag) &&80 !node->hasTagName(inputTag) &&81 !node->hasTagName(textareaTag) &&82 !node->hasTagName(objectTag) &&83 !node->hasTagName(iframeTag) &&84 !node->hasTagName(embedTag) &&85 !node->hasTagName(appletTag) &&86 !node->hasTagName(selectTag) &&87 !node->hasTagName(datagridTag) &&88 #if ENABLE(WML)89 !node->hasTagName(WMLNames::doTag) &&90 #endif91 !node->isTextNode();92 }93 94 67 // Compare two positions, taking into account the possibility that one or both 95 68 // could be inside a shadow tree. Only works for non-null values. -
trunk/Source/WebCore/editing/htmlediting.h
r78150 r78219 78 78 // boolean functions on Node 79 79 80 bool editingIgnoresContent(const Node*); 81 bool canHaveChildrenForEditing(const Node*); 80 // FIXME: editingIgnoresContent, canHaveChildrenForEditing, and isAtomicNode 81 // should be renamed to reflect its usage. 82 83 // Returns true for nodes that either have no content, or have content that is ignored (skipped 84 // over) while editing. There are no VisiblePositions inside these nodes. 85 inline bool editingIgnoresContent(const Node* node) 86 { 87 return !node->canContainRangeEndPoint(); 88 } 89 90 inline bool canHaveChildrenForEditing(const Node* node) 91 { 92 return !node->isTextNode() && node->canContainRangeEndPoint(); 93 } 94 82 95 bool isAtomicNode(const Node*); 83 96 bool isBlock(const Node*); -
trunk/Source/WebCore/html/HTMLBRElement.h
r66057 r78219 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/HTMLButtonElement.h
r74841 r78219 35 35 String value() const; 36 36 37 virtual bool canContainRangeEndPoint() const { return false; } 38 37 39 private: 38 40 HTMLButtonElement(const QualifiedName& tagName, Document*, HTMLFormElement*); -
trunk/Source/WebCore/html/HTMLDataGridElement.h
r65986 r78219 54 54 DataGridColumnList* columns() const { return m_columns.get(); } 55 55 56 virtual bool canContainRangeEndPoint() const { return false; } 57 56 58 private: 57 59 HTMLDataGridElement(const QualifiedName&, Document*); -
trunk/Source/WebCore/html/HTMLFormControlElement.h
r77114 r78219 169 169 virtual ~HTMLFormControlElementWithState(); 170 170 171 virtual bool canContainRangeEndPoint() const { return false; } 172 171 173 protected: 172 174 HTMLFormControlElementWithState(const QualifiedName& tagName, Document*, HTMLFormElement*); -
trunk/Source/WebCore/html/HTMLFrameElementBase.h
r74700 r78219 44 44 45 45 void setRemainsAliveOnRemovalFromTree(bool); 46 47 virtual bool canContainRangeEndPoint() const { return false; } 46 48 47 49 protected: -
trunk/Source/WebCore/html/HTMLHRElement.h
r66057 r78219 33 33 static PassRefPtr<HTMLHRElement> create(const QualifiedName&, Document*); 34 34 35 virtual bool canContainRangeEndPoint() const { return false; } 36 35 37 private: 36 38 HTMLHRElement(const QualifiedName&, Document*); -
trunk/Source/WebCore/html/HTMLImageElement.h
r66057 r78219 75 75 bool haveFiredLoadEvent() const { return m_imageLoader.haveFiredLoadEvent(); } 76 76 77 virtual bool canContainRangeEndPoint() const { return false; } 78 77 79 protected: 78 80 HTMLImageElement(const QualifiedName&, Document*, HTMLFormElement* = 0); -
trunk/Source/WebCore/html/HTMLMeterElement.h
r73488 r78219 56 56 57 57 GaugeRegion gaugeRegion() const; 58 59 virtual bool canContainRangeEndPoint() const { return false; } 60 58 61 private: 59 62 HTMLMeterElement(const QualifiedName&, Document*, HTMLFormElement*); -
trunk/Source/WebCore/html/HTMLOutputElement.h
r76115 r78219 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
r69596 r78219 52 52 void setIsCapturingMouseEvents(bool capturing) { m_isCapturingMouseEvents = capturing; } 53 53 54 virtual bool canContainRangeEndPoint() const { return false; } 55 54 56 protected: 55 57 HTMLPlugInElement(const QualifiedName& tagName, Document*); -
trunk/Source/WebCore/html/HTMLProgressElement.h
r77578 r78219 39 39 double position() const; 40 40 41 virtual bool canContainPosition() const { return false; } 42 41 43 private: 42 44 HTMLProgressElement(const QualifiedName&, Document*, HTMLFormElement*); -
trunk/Source/WebCore/wml/WMLBRElement.h
r66362 r78219 41 41 42 42 virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); 43 44 virtual bool canContainRangeEndPoint() const { return false; } 43 45 }; 44 46 -
trunk/Source/WebCore/wml/WMLDoElement.h
r66362 r78219 54 54 void setNoop(bool noop) { m_isNoop = noop;} 55 55 56 virtual bool canContainRangeEndPoint() const { return false; } 57 56 58 private: 57 59 WMLTaskElement* m_task; -
trunk/Source/WebCore/wml/WMLImageElement.h
r66362 r78219 50 50 void setUseFallbackAttribute(bool value) { m_useFallbackAttribute = value; } 51 51 52 virtual bool canContainRangeEndPoint() const { return false; } 53 52 54 private: 53 55 WMLImageLoader m_imageLoader; -
trunk/Source/WebCore/wml/WMLInputElement.h
r76661 r78219 98 98 #endif 99 99 100 virtual bool canContainRangeEndPoint() const { return false; } 101 100 102 private: 101 103 friend class WMLCardElement; -
trunk/Source/WebCore/wml/WMLSelectElement.h
r73606 r78219 91 91 92 92 virtual void listBoxSelectItem(int listIndex, bool allowMultiplySelections, bool shift, bool fireOnChangeNow = true); 93 94 virtual bool canContainRangeEndPoint() const { return false; } 95 93 96 private: 94 97 virtual void insertedIntoTree(bool);
Note: See TracChangeset
for help on using the changeset viewer.