WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
86217
Add helper function for node()->rootEditableElement() == node()
https://bugs.webkit.org/show_bug.cgi?id=86217
Summary
Add helper function for node()->rootEditableElement() == node()
Shezan Baig
Reported
2012-05-11 07:35:47 PDT
Per
bug 85385, comment 5
, this statement can be optimized as: node()->rendererIsEditable() && (!node()->parentNode() || !node()->parentNode()->rendererIsEditable() || node()->hasTagName(bodyTag))
Attachments
Patch
(9.53 KB, patch)
2012-05-11 09:22 PDT
,
Shezan Baig
no flags
Details
Formatted Diff
Diff
Patch (added isElementNode to the condition)
(9.55 KB, patch)
2012-05-11 11:33 PDT
,
Shezan Baig
no flags
Details
Formatted Diff
Diff
Show Obsolete
(1)
View All
Add attachment
proposed patch, testcase, etc.
Shezan Baig
Comment 1
2012-05-11 09:22:26 PDT
Created
attachment 141429
[details]
Patch
Shezan Baig
Comment 2
2012-05-11 09:34:12 PDT
I also see a bunch of places where rootEditableElement() is used to determine whether the element is editable, for example editing/FrameSelection.cpp@1788: if (!rootEditableElement()) return; Couldn't these statements also be replaced with a simple rendererIsEditable()?
Ryosuke Niwa
Comment 3
2012-05-11 10:03:56 PDT
Comment on
attachment 141429
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=141429&action=review
The change looks reasonable.
> Source/WebCore/dom/Node.cpp:1572 > + return rendererIsEditable() && (!parentNode() || !parentNode()->rendererIsEditable() || hasTagName(bodyTag));
Actually, you can remove hasTagName(bodyTag) here. I wasn't thinking straight about this.
Shezan Baig
Comment 4
2012-05-11 10:17:42 PDT
Hmm, so presumably the body tag check can also be removed from Node::rootEditableElement?
Ryosuke Niwa
Comment 5
2012-05-11 10:36:52 PDT
(In reply to
comment #4
)
> Hmm, so presumably the body tag check can also be removed from Node::rootEditableElement?
Oh oops, I didn't see that. Okay, I was right. We do need this bodyTag check.
Shezan Baig
Comment 6
2012-05-11 11:33:00 PDT
Created
attachment 141459
[details]
Patch (added isElementNode to the condition)
Ryosuke Niwa
Comment 7
2012-05-11 11:38:52 PDT
Comment on
attachment 141459
[details]
Patch (added isElementNode to the condition) Thank you for the refactoring! I've always wanted to do this :)
Ryosuke Niwa
Comment 8
2012-05-11 11:50:09 PDT
(In reply to
comment #2
)
> I also see a bunch of places where rootEditableElement() is used to determine whether the element is editable, for example editing/FrameSelection.cpp@1788: > > if (!rootEditableElement()) > return; > > Couldn't these statements also be replaced with a simple rendererIsEditable()?
There is a possibility that we're also checking that there is an element somewhere up in the ancestor chain (as supposed to a document) but I bet most of those places can just be calling rendererIsEditable.
WebKit Review Bot
Comment 9
2012-05-11 13:08:27 PDT
Comment on
attachment 141459
[details]
Patch (added isElementNode to the condition) Clearing flags on attachment: 141459 Committed
r116798
: <
http://trac.webkit.org/changeset/116798
>
WebKit Review Bot
Comment 10
2012-05-11 13:08:36 PDT
All reviewed patches have been landed. Closing bug.
Ryosuke Niwa
Comment 11
2012-05-11 15:37:57 PDT
Fixed a regression in
http://trac.webkit.org/changeset/116814
.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug