Closed Bug 1455674 Opened 8 years ago Closed 8 years ago

Remove nsIDOMElement

Categories

(Core :: DOM: Core & HTML, enhancement, P2)

enhancement

Tracking

()

RESOLVED FIXED
mozilla61
Tracking Status
firefox61 --- fixed

People

(Reporter: bzbarsky, Assigned: bzbarsky)

References

(Blocks 1 open bug)

Details

Attachments

(20 files, 2 obsolete files)

14.15 KB, patch
masayuki
: review+
Details | Diff | Splinter Review
27.00 KB, patch
masayuki
: review+
Details | Diff | Splinter Review
110.87 KB, patch
masayuki
: review+
Details | Diff | Splinter Review
5.42 KB, patch
masayuki
: review+
Details | Diff | Splinter Review
5.57 KB, patch
masayuki
: review+
Details | Diff | Splinter Review
8.28 KB, patch
masayuki
: review+
Details | Diff | Splinter Review
1.21 KB, patch
masayuki
: review+
Details | Diff | Splinter Review
44.20 KB, patch
qdot
: review+
Details | Diff | Splinter Review
24.87 KB, patch
qdot
: review+
Details | Diff | Splinter Review
23.31 KB, patch
qdot
: review+
Details | Diff | Splinter Review
10.48 KB, patch
mossop
: review+
Details | Diff | Splinter Review
53.41 KB, patch
mossop
: review+
Details | Diff | Splinter Review
35.79 KB, patch
qdot
: review+
Details | Diff | Splinter Review
26.78 KB, patch
qdot
: review+
Details | Diff | Splinter Review
5.81 KB, patch
qdot
: review+
Details | Diff | Splinter Review
57.71 KB, patch
qdot
: review+
Details | Diff | Splinter Review
16.19 KB, patch
qdot
: review+
Details | Diff | Splinter Review
3.07 KB, patch
qdot
: review+
Details | Diff | Splinter Review
38.54 KB, patch
qdot
: review+
Details | Diff | Splinter Review
25.54 KB, patch
qdot
: review+
Details | Diff | Splinter Review
No description provided.
Blocks: 1455676
Depends on: 1456169
MozReview-Commit-ID: FcVbeHEwkMz
Attachment #8970242 - Flags: review?(emilio)
Assignee: nobody → bzbarsky
Status: NEW → ASSIGNED
MozReview-Commit-ID: 3goF5VXvQap
Attachment #8970243 - Flags: review?(emilio)
Attachment #8970242 - Attachment is obsolete: true
Attachment #8970242 - Flags: review?(emilio)
Attachment #8970243 - Attachment is obsolete: true
Attachment #8970243 - Flags: review?(emilio)
Depends on: 1456588
Depends on: 1456682
Priority: -- → P2
Attachment #8971115 - Flags: review?(masayuki)
MozReview-Commit-ID: Koxv2qS2gft
Attachment #8971116 - Flags: review?(masayuki)
The patch is a bit large because all these methods except SswitchTableCellHeaderType call each other; doing it piecemeal would have required introducing, then removing, a bunch of QIs.
Attachment #8971117 - Flags: review?(masayuki)
Attachment #8971120 - Flags: review?(masayuki)
Attachment #8971121 - Flags: review?(masayuki)
Attachment #8971125 - Flags: review?(dtownsend)
Attachment #8971126 - Flags: review?(dtownsend)
Attachment #8971128 - Flags: review?(kyle)
Attachment #8971130 - Flags: review?(kyle)
Attachment #8971132 - Flags: review?(kyle)
In nsBlocklistService.js we know we're dealing with actual nodes, so .nodeType checks should be fine.
Attachment #8971133 - Flags: review?(kyle)
Attachment #8971134 - Flags: review?(kyle)
Comment on attachment 8971115 [details] [diff] [review] part 1. Stop using nsIDOMElement in nsIEditor Review of attachment 8971115 [details] [diff] [review]: ----------------------------------------------------------------- ::: toolkit/components/find/nsFind.cpp @@ +393,1 @@ > textEditor->GetRootElement(getter_AddRefs(rootElement)); textEditor is mozilla::TextEditor. So, you must be able to write this as: RefPtr<dom::Element> rootElement = textEditor->GetRoot(); (Perhaps, |Element*| is fine since innerRange isn't associated with Selection. So, its change won't cause destroying root element of textEditor. But up to you.)
Attachment #8971115 - Flags: review?(masayuki) → review+
Comment on attachment 8971116 [details] [diff] [review] part 2. Mostly stop using nsIDOMElement in nsIHTMLEditor Review of attachment 8971116 [details] [diff] [review]: ----------------------------------------------------------------- ::: editor/composer/nsComposerCommands.cpp @@ +1454,5 @@ > if (NS_WARN_IF(!htmlEditor)) { > return NS_ERROR_FAILURE; > } > > + RefPtr<Element> domElem; Could you rename domElem to newElement or something? We use "dom" prefix for nsIDOM* variables. ::: editor/libeditor/HTMLEditor.cpp @@ +1583,5 @@ > } > > EditorDOMPoint insertedPoint = > InsertNodeIntoProperAncestorWithTransaction( > + *aElement, pointToInsert, SplitAtEdges::eAllowToCreateEmptyContainer); Although, aElement is not grabbed with local variable in this method but must be fine since all callers of this method grabs aElement before calling this. @@ +3630,4 @@ > { > + if (!aElement || !aElement->IsHTMLElement() || > + !HTMLEditUtils::IsTableElement(aElement) || > + !IsDescendantOfEditorRoot(aElement)) { Selection::Collapse() will grab given node before changing selection actually. So, not grabbing aElement is safe.
Attachment #8971116 - Flags: review?(masayuki) → review+
Comment on attachment 8971117 [details] [diff] [review] part 3. Stop using nsIDOMElement in nsITableEditor Review of attachment 8971117 [details] [diff] [review]: ----------------------------------------------------------------- ::: editor/libeditor/HTMLTableEditor.cpp @@ +86,5 @@ > } > }; > > nsresult > +HTMLEditor::InsertCell(Element* aDOMCell, Could you rename this to aCell or aCellElement? @@ +91,5 @@ > int32_t aRowSpan, > int32_t aColSpan, > bool aAfter, > bool aIsHeader, > + Element** aNewDOMCell) And also rename this to aNewCell or aNewCellElement.
Attachment #8971117 - Flags: review?(masayuki) → review+
Comment on attachment 8971118 [details] [diff] [review] part 4. Stop using nsIDOMElement in nsIHTMLEditor::GetElementOrParentByTagName Review of attachment 8971118 [details] [diff] [review]: ----------------------------------------------------------------- ::: editor/libeditor/HTMLEditor.cpp @@ +2444,5 @@ > { > NS_ENSURE_TRUE(!aTagName.IsEmpty(), NS_ERROR_NULL_POINTER); > NS_ENSURE_TRUE(aReturn, NS_ERROR_NULL_POINTER); > > + nsCOMPtr<Element> parent = GetElementOrParentByTagName(aTagName, aNode); RefPtr<Element>?
Attachment #8971118 - Flags: review?(masayuki) → review+
Comment on attachment 8971119 [details] [diff] [review] part 5. Remove remaining IDL use of nsIDOMElement in editor Review of attachment 8971119 [details] [diff] [review]: ----------------------------------------------------------------- ::: editor/libeditor/HTMLEditorObjectResizer.cpp @@ +934,2 @@ > { > + nsCOMPtr<Element> ret = mResizedObject; RefPtr<Element>?
Attachment #8971119 - Flags: review?(masayuki) → review+
Attachment #8971125 - Flags: review?(dtownsend) → review+
Attachment #8971126 - Flags: review?(dtownsend) → review+
> RefPtr<dom::Element> rootElement = textEditor->GetRoot(); Done. > Could you rename domElem to newElement or something? We use "dom" prefix for nsIDOM* variables. Done. > Could you rename this to aCell or aCellElement? > And also rename this to aNewCell or aNewCellElement. Done, with aCell/aNewCell. > RefPtr<Element>? Done. > RefPtr<Element>? Done. I had to make mResizedObject a RefPtr too, to get things to compile without the code being too ugly.
Attachment #8971122 - Flags: review?(kyle) → review+
Attachment #8971123 - Flags: review?(kyle) → review+
Comment on attachment 8971124 [details] [diff] [review] part 10. Remove nsIDOMElement use from remaining dom/ xpidl files Review of attachment 8971124 [details] [diff] [review]: ----------------------------------------------------------------- ::: dom/base/nsContentPermissionHelper.cpp @@ +645,5 @@ > return NS_OK; > } > > NS_IMETHODIMP > +nsContentPermissionRequestProxy::GetElement(Element * *aRequestingElement) nit: Might fix the weird space between **'s while this is happening? ::: dom/geolocation/nsGeolocation.cpp @@ +395,5 @@ > return NS_OK; > } > > NS_IMETHODIMP > +nsGeolocationRequest::GetElement(Element * *aRequestingElement) nit: Might fix the weird space between **'s while this is happening?
Attachment #8971124 - Flags: review?(kyle) → review+
Comment on attachment 8971127 [details] [diff] [review] part 13. Remove remaining xpidl uses of nsIDOMElement Review of attachment 8971127 [details] [diff] [review]: ----------------------------------------------------------------- ::: widget/cocoa/nsStandaloneNativeMenu.mm @@ +34,5 @@ > { > NS_ASSERTION(mMenu == nullptr, "nsNativeMenu::Init - mMenu not null!"); > > + NS_ENSURE_ARG(aElement); > + nit: extra whitespace
Attachment #8971127 - Flags: review?(kyle) → review+
Attachment #8971128 - Flags: review?(kyle) → review+
Attachment #8971129 - Flags: review?(kyle) → review+
Attachment #8971130 - Flags: review?(kyle) → review+
Attachment #8971131 - Flags: review?(kyle) → review+
Attachment #8971132 - Flags: review?(kyle) → review+
Attachment #8971133 - Flags: review?(kyle) → review+
Attachment #8971134 - Flags: review?(kyle) → review+
> nit: Might fix the weird space between **'s while this is happening? Done, both places. > nit: extra whitespace Fixed.
Pushed by bzbarsky@mozilla.com: https://hg.mozilla.org/integration/mozilla-inbound/rev/ec41eab9c159 part 1. Stop using nsIDOMElement in nsIEditor. r=masayuki https://hg.mozilla.org/integration/mozilla-inbound/rev/52e2af8c5e62 part 2. Mostly stop using nsIDOMElement in nsIHTMLEditor. r=masayuki https://hg.mozilla.org/integration/mozilla-inbound/rev/667c981474f8 part 3. Stop using nsIDOMElement in nsITableEditor. r=masayuki https://hg.mozilla.org/integration/mozilla-inbound/rev/15071a2629d9 part 4. Stop using nsIDOMElement in nsIHTMLEditor::GetElementOrParentByTagName. r=masayuki https://hg.mozilla.org/integration/mozilla-inbound/rev/f283a9ca271b part 5. Remove remaining IDL use of nsIDOMElement in editor. r=masayuki https://hg.mozilla.org/integration/mozilla-inbound/rev/ae8e688883d5 part 6. Mostly remove use of nsIDOMElement in editor. r=masayuki https://hg.mozilla.org/integration/mozilla-inbound/rev/36a91270aaf8 part 7. Simplify HTMLEditor::GetFocusedNode. r=masayuki https://hg.mozilla.org/integration/mozilla-inbound/rev/d6865d4b5520 part 8. Remove nsIDOMElement use from nsIDOMWindowUtils. r=qdot https://hg.mozilla.org/integration/mozilla-inbound/rev/8311c9e2e414 part 9. Remove nsIDOMElement use from nsIFocusManager. r=qdot https://hg.mozilla.org/integration/mozilla-inbound/rev/67be83ace312 part 10. Remove nsIDOMElement use from remaining dom/ xpidl files. r=qdot https://hg.mozilla.org/integration/mozilla-inbound/rev/a19af55d0bd2 part 11. Remove nsIDOMElement use from xpidl in toolkit. r=mossop https://hg.mozilla.org/integration/mozilla-inbound/rev/5add57b9a0cc part 12. Remove nsIDOMElement use from xpidl in layout. r=mossop https://hg.mozilla.org/integration/mozilla-inbound/rev/7f3223b376bb part 13. Remove remaining xpidl uses of nsIDOMElement. r=qdot https://hg.mozilla.org/integration/mozilla-inbound/rev/995b14b30559 part 14. Remove use of nsIDOMElement in layout. r=qdot https://hg.mozilla.org/integration/mozilla-inbound/rev/e165e82a8e85 part 15. Remove use of nsIDOMElement in accessible. r=qdot https://hg.mozilla.org/integration/mozilla-inbound/rev/c7b96bb087f0 part 16. Remove most use of nsIDOMElement in dom. r=qdot https://hg.mozilla.org/integration/mozilla-inbound/rev/f4428b451bba part 17. Remove use of nsIDOMElement in non-dom non-JS code. r=qdot https://hg.mozilla.org/integration/mozilla-inbound/rev/c29505c32af1 part 18. Add Element to importGlobalProperties. r=qdot https://hg.mozilla.org/integration/mozilla-inbound/rev/c75434fd5100 part 19. Get rid of JS uses of nsIDOMElement. r=qdot https://hg.mozilla.org/integration/mozilla-inbound/rev/2d80f0cc731f part 20. Get rid of nsIDOMElement. r=qdot
Depends on: 1457862
Component: DOM → DOM: Core & HTML
See Also: → 1803918
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: