Closed Bug 303779 Opened 19 years ago Closed 19 years ago

PresShell::GetPrimaryFrameFor should return nsIFrame*

Categories

(Core :: Layout, defect)

x86
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: bastiaan, Assigned: bastiaan)

References

Details

Attachments

(1 file, 2 obsolete files)

Wallpapering patch for bug 302356 exposed that PresShell::GetPrimaryFrameFor()
always returns NS_OK. PresShell::GetPrimaryFrameFor() merely calls
nsFrameManager::GetPrimaryFrameFor(), so it might as well just return that.

Callers need to be updated, though; this should probably wait for 1.9 to go in.
I see only two similiar cases which might need wallpapered too.

http://lxr.mozilla.org/mozilla/source/content/events/src/nsEventStateManager.cpp#4637
http://lxr.mozilla.org/mozilla/source/toolkit/components/satchel/src/nsFormFillController.cpp#145

all other places that check for the return value check for frame non nullness too.
Attached patch fix (obsolete) — Splinter Review
This patch removes GetPrimaryFrameFor's second argument (out param) and changes
its return value to nsIFrame*. It also updates all the callers.
Attached patch whole fix (obsolete) — Splinter Review
Previous attachment got cut off.
Attachment #191989 - Attachment is obsolete: true
Attachment #191991 - Flags: review?(bzbarsky)
Comment on attachment 191991 [details] [diff] [review]
whole fix

>Index: content/events/src/nsEventStateManager.cpp
>@@ -4629,18 +4625,18 @@ nsEventStateManager::GetDocSelectionLoca

>+    if (isCollapsed /* XXX && startFrame do we care? */) {

I wouldn't bother with that XXX comment.

>Index: layout/base/nsCSSFrameConstructor.cpp
> nsCSSFrameConstructor::CaptureStateForFramesOf(nsIContent* aContent,
>+  if (!frame) {
>+    return NS_ERROR_FAILURE;

This used to return NS_OK in this case, and it should continue doing so.

r+sr=bzbarsky with those nits
Attachment #191991 - Flags: superreview+
Attachment #191991 - Flags: review?(bzbarsky)
Attachment #191991 - Flags: review+
Attachment #191991 - Attachment is obsolete: true
Oh, and the nsIPresShell IID needed changing.
Checked in (with the IID change).
Status: NEW → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
*** Bug 292002 has been marked as a duplicate of this bug. ***
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: