Closed
Bug 1053779
Opened 10 years ago
Closed 10 years ago
Clean up nsEditor::CreateHTMLContent, ReplaceContainer, CloneAttributes
Categories
(Core :: DOM: Editor, enhancement)
Core
DOM: Editor
Tracking
()
RESOLVED
FIXED
mozilla34
People
(Reporter: ayg, Assigned: ayg)
References
Details
Attachments
(3 files)
10.03 KB,
patch
|
ehsan.akhgari
:
review+
|
Details | Diff | Splinter Review |
20.66 KB,
patch
|
ehsan.akhgari
:
review+
|
Details | Diff | Splinter Review |
9.07 KB,
patch
|
ehsan.akhgari
:
review+
|
Details | Diff | Splinter Review |
No description provided.
Assignee | ||
Comment 1•10 years ago
|
||
Attachment #8473068 -
Flags: review?(ehsan)
Assignee | ||
Comment 2•10 years ago
|
||
Attachment #8473074 -
Flags: review?(ehsan)
Assignee | ||
Comment 3•10 years ago
|
||
Attachment #8473119 -
Flags: review?(ehsan)
Updated•10 years ago
|
Attachment #8473068 -
Flags: review?(ehsan) → review+
Comment 4•10 years ago
|
||
Comment on attachment 8473074 [details] [diff] [review]
Patch part 2 -- Clean up nsEditor::ReplaceContainer
Review of attachment 8473074 [details] [diff] [review]:
-----------------------------------------------------------------
::: editor/libeditor/html/nsTableEditor.cpp
@@ +1957,5 @@
> nsAutoSelectionReset selectionResetter(selection, this);
>
> // Set to the opposite of current type
> nsCOMPtr<nsIAtom> atom = nsEditor::GetTag(aSourceCell);
> + nsCOMPtr<nsIAtom> newCellType = atom == nsEditProperty::td
Nit: nsIAtom*.
Attachment #8473074 -
Flags: review?(ehsan) → review+
Comment 5•10 years ago
|
||
Comment on attachment 8473119 [details] [diff] [review]
Patch part 3 -- Clean up nsEditor::CloneAttributes
Review of attachment 8473119 [details] [diff] [review]:
-----------------------------------------------------------------
::: editor/libeditor/base/nsEditor.cpp
@@ +2245,5 @@
> + // Clear existing attributes
> + nsRefPtr<nsDOMAttributeMap> destAttributes = aDest->Attributes();
> + while (nsRefPtr<Attr> attr = destAttributes->Item(0)) {
> + if (destInBody) {
> + RemoveAttribute(static_cast<nsIDOMElement*>(GetAsDOMNode(aDest)),
These static casts are unfortunately not safe because nsIDOMElement is not builtinclass. Please QI instead.
Attachment #8473119 -
Flags: review?(ehsan) → review+
Assignee | ||
Comment 6•10 years ago
|
||
(In reply to :Ehsan Akhgari (not reading bugmail, needinfo? me!) from comment #5)
> These static casts are unfortunately not safe because nsIDOMElement is not
> builtinclass. Please QI instead.
Hrm? aDest is an Element, and every Element is an nsIDOMElement, isn't it? I understand why nsIDOMElement can't be cast to Element, because maybe someone passed in a weird made-up user class, but I thought the other way was safe, just like nsINode to nsIDOMNode is safe.
Flags: needinfo?(ehsan)
Comment 7•10 years ago
|
||
Hmm, I was worried about this function which is exposed to JS consumers: <http://mxr.mozilla.org/mozilla-central/source/editor/nsIEditor.idl#398> But on a second look, the other overload of CloneAttributes will return early if you pass it such made up JS objects. So, I guess this is actually fine. Sorry for the confusion, this stuff is hard to reason about. :/
Flags: needinfo?(ehsan)
Assignee | ||
Comment 8•10 years ago
|
||
Try: https://tbpl.mozilla.org/?tree=Try&rev=52ee018a8367
https://hg.mozilla.org/integration/mozilla-inbound/rev/ef56950fd9ae
https://hg.mozilla.org/integration/mozilla-inbound/rev/6a321b56d982
https://hg.mozilla.org/integration/mozilla-inbound/rev/d4f36554d461
Flags: in-testsuite-
Comment 9•10 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/ef56950fd9ae
https://hg.mozilla.org/mozilla-central/rev/6a321b56d982
https://hg.mozilla.org/mozilla-central/rev/d4f36554d461
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla34
Updated•10 years ago
|
Flags: qe-verify-
You need to log in
before you can comment on or make changes to this bug.
Description
•