Closed
Bug 685154
Opened 13 years ago
Closed 13 years ago
Cleanup nsIFrame::GetParentStyleContextFrame and related code
Categories
(Core :: Layout, defect)
Core
Layout
Tracking
()
RESOLVED
FIXED
mozilla9
People
(Reporter: MatsPalmgren_bugz, Assigned: MatsPalmgren_bugz)
Details
Attachments
(4 files, 3 obsolete files)
10.61 KB,
patch
|
roc
:
review+
|
Details | Diff | Splinter Review |
28.77 KB,
patch
|
roc
:
review+
|
Details | Diff | Splinter Review |
18.38 KB,
patch
|
Details | Diff | Splinter Review | |
36.94 KB,
patch
|
Details | Diff | Splinter Review |
No description provided.
Assignee | ||
Comment 1•13 years ago
|
||
Essentially this change: - NS_IMETHOD GetParentStyleContextFrame(nsPresContext* aPresContext, - nsIFrame** aProviderFrame, - PRBool* aIsChild) = 0; + virtual nsIFrame* GetParentStyleContextFrame(PRBool* aIsChild) = 0;
Attachment #558804 -
Flags: review?(roc)
Shouldn't the failure nsresults at least be converted to assertions?
Assignee | ||
Comment 3•13 years ago
|
||
nsFrame::DoGetParentStyleContextFrame already has a NS_NOTREACHED. I can add one in nsTableOuterFrame::GetParentStyleContextFrame if you like, in this block: if (!mInnerTableFrame) { *aIsChild = PR_FALSE; return this; } OTOH, I think it would be better to remove all null checks of mInnerTableFrame and instead make nsCSSFrameConstructor::ConstructTable return a null (outer) table frame if its inner couldn't be created for some reason. nsCSSFrameConstructor::CreateContinuingOuterTableFrame already does that.
Comment 4•13 years ago
|
||
I would be fine with that.
Comment on attachment 558804 [details] [diff] [review] fix Review of attachment 558804 [details] [diff] [review]: ----------------------------------------------------------------- I guess we'll have a new patch here
Attachment #558804 -
Flags: review?(roc)
Assignee | ||
Updated•13 years ago
|
Summary: Outparamdel nsIFrame::GetParentStyleContextFrame → Cleanup nsIFrame::GetParentStyleContextFrame and related code
Assignee | ||
Comment 6•13 years ago
|
||
Attachment #558804 -
Attachment is obsolete: true
Attachment #559141 -
Flags: review?(roc)
Assignee | ||
Comment 7•13 years ago
|
||
Make nsCSSFrameConstructor::ConstructTable return a null frame if creating the inner table frame fails. Simplify some code since we can now depend on the invariant that a properly created outer table frame always has a non-null inner table frame.
Attachment #559142 -
Flags: review?(roc)
Assignee | ||
Comment 8•13 years ago
|
||
Here's the full patch in case you prefer it for review.
Assignee | ||
Comment 9•13 years ago
|
||
BTW, is the nsTableOuterFrame::mInnerTableFrame really worth the space? Wouldn't an accessor to mFrames.FirstChild() just as fast?
Comment 10•13 years ago
|
||
Do we guarantee that the first child is the inner? We didn't use to, but maybe we do now.
Assignee | ||
Comment 11•13 years ago
|
||
We assert that it is: http://mxr.mozilla.org/mozilla-central/source/layout/tables/nsTableOuterFrame.cpp#242 except for when the given child list is empty, which is the case I'm removing in part 2.
Comment 12•13 years ago
|
||
In that case, just nuke the member.
Comment on attachment 559141 [details] [diff] [review] part 1, outparamdel nsIFrame::GetParentStyleContextFrame Review of attachment 559141 [details] [diff] [review]: ----------------------------------------------------------------- Why even bother with the aIsChild parameter? Callers can easily check whether the returned frame's GetParent() is equal to the frame we asked about.
Comment on attachment 559142 [details] [diff] [review] part 2, Make nsCSSFrameConstructor::ConstructTable return a null frame if creating the inner table frame fails Review of attachment 559142 [details] [diff] [review]: ----------------------------------------------------------------- ::: layout/base/nsCSSFrameConstructor.cpp @@ +1911,5 @@ > innerFrame = NS_NewTableFrame(mPresShell, styleContext); > + > + if (!innerFrame) { > + newFrame->Destroy(); > + return NS_ERROR_OUT_OF_MEMORY; Shouldn't frame allocation just be infallible?
Comment 15•13 years ago
|
||
> Shouldn't frame allocation just be infallible?
Ideally, yes. But we're not there yet. I'd love for that to happen; if allocation from presshell arenas were infallible we could simplify a lot of code...
Attachment #559142 -
Flags: review?(roc) → review+
Assignee | ||
Comment 16•13 years ago
|
||
(In reply to Boris Zbarsky (:bz) from comment #12) > In that case, just nuke the member. Filed as bug 685901.
Assignee | ||
Comment 17•13 years ago
|
||
Remove the aIsChild parameter too.
Attachment #559141 -
Attachment is obsolete: true
Attachment #559143 -
Attachment is obsolete: true
Attachment #559141 -
Flags: review?(roc)
Attachment #559496 -
Flags: review?(roc)
Assignee | ||
Comment 18•13 years ago
|
||
Here's the addendum for removing aIsChild before folding it into part 1 - in case you want to review just that bit.
Assignee | ||
Comment 19•13 years ago
|
||
Assignee | ||
Comment 20•13 years ago
|
||
> Shouldn't frame allocation just be infallible?
As Boris said, let's attack OOM handling in the frame constructor systematically
in a specific bug for that purpose.
Attachment #559496 -
Flags: review?(roc) → review+
Assignee | ||
Comment 21•13 years ago
|
||
http://hg.mozilla.org/integration/mozilla-inbound/rev/38ff711d4369 http://hg.mozilla.org/integration/mozilla-inbound/rev/79890feb4abe
Whiteboard: [inbound]
Target Milestone: --- → mozilla9
Comment 22•13 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/79890feb4abe https://hg.mozilla.org/mozilla-central/rev/38ff711d4369
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Whiteboard: [inbound]
You need to log in
before you can comment on or make changes to this bug.
Description
•