Summary: | Crash in ReplaceSelectionCommand::doApply when inserting a node under a document node | ||||||||
---|---|---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Berend-Jan Wever <skylined> | ||||||
Component: | HTML Editing | Assignee: | Ryosuke Niwa <rniwa> | ||||||
Status: | RESOLVED FIXED | ||||||||
Severity: | Normal | CC: | darin, eric, ojan, rniwa, tkent, tony | ||||||
Priority: | P1 | ||||||||
Version: | 528+ (Nightly build) | ||||||||
Hardware: | All | ||||||||
OS: | All | ||||||||
Bug Depends on: | |||||||||
Bug Blocks: | 56421 | ||||||||
Attachments: |
|
Description
Berend-Jan Wever
2011-03-15 06:48:57 PDT
Created attachment 85844 [details]
fixes the crash
Comment on attachment 85844 [details] fixes the crash View in context: https://bugs.webkit.org/attachment.cgi?id=85844&action=review > Source/WebCore/dom/Document.cpp:4134 > +bool Document::isContentEditable() const > +{ > + if (document()->inDesignMode()) > + return true; > + > + return renderer() && (renderer()->style()->userModify() == READ_WRITE || renderer()->style()->userModify() == READ_WRITE_PLAINTEXT_ONLY); > +} > + > +bool Document::isContentRichlyEditable() const > +{ > + if (document()->inDesignMode()) > + return true; > + > + return renderer() && renderer()->style()->userModify() == READ_WRITE; > +} Is there a way we can share code with the HTMLElement functions? It’s not good to have a near exact copy of those functions in the document class. Also, it’s strange to call document() in a function on Document. > Source/WebCore/dom/Document.h:898 > + virtual bool isContentEditable() const; > + virtual bool isContentRichlyEditable() const; We often make this sort of function private, because if it’s going to be called in performance-critical code and you have a Document*, then it would be better to have a non-virtual version of the function. I think that makes sense in this case. Nobody needs to call isContentEditable on a Document* yet. If they did we could provide something slightly faster. Comment on attachment 85844 [details]
fixes the crash
The review tool changed this back to review? But I don’t want to change it to review+ because then it will look like I reviewed it. Can someone help me fix this?
(In reply to comment #3) > The review tool changed this back to review? But I don’t want to change it to review+ because then it will look like I reviewed it. Can someone help me fix this? I didn’t intentionally remove the review flag. Tony, you could resolve this by setting review+ again. Thanks for the review, Tony. (In reply to comment #2) > Is there a way we can share code with the HTMLElement functions? It’s not good to have a near exact copy of those functions in the document class. I thought about it too but isContentEditable is in a really hot path, and I can't increase any latency there. > Also, it’s strange to call document() in a function on Document. Oops, will fix. > We often make this sort of function private, because if it’s going to be called in performance-critical code and you have a Document*, then it would be better to have a non-virtual version of the function. I think that makes sense in this case. Nobody needs to call isContentEditable on a Document* yet. If they did we could provide something slightly faster. We could make them non-virtual function of Node. Okay, let's land this patch as is (Reviewed by Tony) and then refactor these functions in a separate patch. Committed r81185: <http://trac.webkit.org/changeset/81185> Comment on attachment 85844 [details]
fixes the crash
Clearing r? from landed patch. (It was given a r+ also.)
|