Changeset 81220 in webkit
- Timestamp:
- Mar 15, 2011 11:21:39 PM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r81218 r81220 1 2011-03-15 Ryosuke Niwa <rniwa@webkit.org> 2 3 Reviewed by Darin Adler. 4 5 Devirtualize isContentEditable and isRichlyContentEditable 6 https://bugs.webkit.org/show_bug.cgi?id=56421 7 8 Rewrote Node::isContentEditable as a non-recursive non-virtual function. 9 10 * dom/Document.cpp: Removed isContentEditable and isContentRichlyEditable. 11 * dom/Document.h: Ditto. 12 * dom/Node.cpp: 13 (WebCore::Node::isContentEditable): Rewritten. 14 * dom/Node.h: 15 (WebCore::Node::isContentEditable): Calls isContentEditable(Editable). 16 (WebCore::Node::isContentRichlyEditable): Calls isContentEditable(RichlyEditable). 17 * html/HTMLElement.cpp: Removed isContentEditable and isContentRichlyEditable. 18 * html/HTMLElement.h: Ditto. 19 1 20 2011-03-15 Adam Barth <abarth@webkit.org> 2 21 -
trunk/Source/WebCore/dom/Document.cpp
r81198 r81220 4118 4118 } 4119 4119 4120 bool Document::isContentEditable() const4121 {4122 if (inDesignMode())4123 return true;4124 4125 return renderer() && (renderer()->style()->userModify() == READ_WRITE || renderer()->style()->userModify() == READ_WRITE_PLAINTEXT_ONLY);4126 }4127 4128 bool Document::isContentRichlyEditable() const4129 {4130 if (inDesignMode())4131 return true;4132 4133 return renderer() && renderer()->style()->userModify() == READ_WRITE;4134 }4135 4136 4120 Document* Document::parentDocument() const 4137 4121 { -
trunk/Source/WebCore/dom/Document.h
r81198 r81220 895 895 InheritedBool getDesignMode() const; 896 896 bool inDesignMode() const; 897 virtual bool isContentEditable() const;898 virtual bool isContentRichlyEditable() const;899 897 900 898 Document* parentDocument() const; -
trunk/Source/WebCore/dom/Node.cpp
r80811 r81220 712 712 } 713 713 714 bool Node::isContentEditable() const 715 { 716 return parentOrHostNode() && parentOrHostNode()->isContentEditable(); 717 } 718 719 bool Node::isContentRichlyEditable() const 720 { 721 return parentOrHostNode() && parentOrHostNode()->isContentRichlyEditable(); 714 bool Node::isContentEditable(EditableLevel editableLevel) const 715 { 716 if (document()->inDesignMode()) 717 return true; 718 719 // Ideally we'd call ASSERT(!needsStyleRecalc()) here, but 720 // ContainerNode::setFocus() calls setNeedsStyleRecalc(), so the assertion 721 // would fire in the middle of Document::setFocusedNode(). 722 723 for (const Node* node = this; node; ) { 724 if (node->isHTMLElement() || node->isDocumentNode()) { 725 if (node->renderer()) { 726 if (editableLevel == RichlyEditable) 727 return node->renderer()->style()->userModify() == READ_WRITE; 728 729 EUserModify userModify = node->renderer()->style()->userModify(); 730 return userModify == READ_WRITE || userModify == READ_WRITE_PLAINTEXT_ONLY; 731 } 732 node = node->parentNode(); 733 } else { 734 // FIXME: Should this be parentNode() instead? 735 node = node->parentOrHostNode(); 736 } 737 } 738 739 return false; 722 740 } 723 741 -
trunk/Source/WebCore/dom/Node.h
r80811 r81220 328 328 virtual bool isMouseFocusable() const; 329 329 330 virtual bool isContentEditable() const;331 virtual bool isContentRichlyEditable() const;330 bool isContentEditable() const { return isContentEditable(Editable); } 331 bool isContentRichlyEditable() const { return isContentEditable(RichlyEditable); } 332 332 virtual bool shouldUseInputMethod() const; 333 333 virtual IntRect getRect() const; … … 660 660 #endif 661 661 662 enum EditableLevel { Editable, RichlyEditable }; 663 bool isContentEditable(EditableLevel) const; 664 662 665 void setStyleChange(StyleChangeType); 663 666 -
trunk/Source/WebCore/html/HTMLElement.cpp
r79953 r81220 658 658 } 659 659 660 bool HTMLElement::isContentEditable() const661 {662 if (document()->inDesignMode())663 return true;664 665 // Ideally we'd call ASSERT!needsStyleRecalc()) here, but666 // ContainerNode::setFocus() calls setNeedsStyleRecalc(), so the assertion667 // would fire in the middle of Document::setFocusedNode().668 669 if (!renderer()) {670 if (parentNode())671 return parentNode()->isContentEditable();672 else673 return false;674 }675 676 return renderer()->style()->userModify() == READ_WRITE || renderer()->style()->userModify() == READ_WRITE_PLAINTEXT_ONLY;677 }678 679 bool HTMLElement::isContentRichlyEditable() const680 {681 if (document()->inDesignMode())682 return true;683 684 if (!renderer()) {685 if (parentNode())686 return parentNode()->isContentEditable();687 else688 return false;689 }690 691 return renderer()->style()->userModify() == READ_WRITE;692 }693 694 660 String HTMLElement::contentEditable() const 695 661 { -
trunk/Source/WebCore/html/HTMLElement.h
r79024 r81220 57 57 58 58 virtual bool supportsFocus() const; 59 60 virtual bool isContentEditable() const;61 virtual bool isContentRichlyEditable() const;62 59 63 60 String contentEditable() const;
Note: See TracChangeset
for help on using the changeset viewer.