Closed
Bug 893962
Opened 11 years ago
Closed 11 years ago
Refactor the application of relative positioning
Categories
(Core :: Layout: Positioned, defect)
Core
Layout: Positioned
Tracking
()
RESOLVED
FIXED
mozilla25
People
(Reporter: coyotebush, Assigned: coyotebush)
References
Details
Attachments
(1 file, 4 obsolete files)
(deleted),
patch
|
coyotebush
:
review+
|
Details | Diff | Splinter Review |
(Previous discussion in bug 886646 comment 9 and following)
CSS relative positioning is applied separately in several places: nsBlockReflowContext, nsCanvasFrame, nsFlexContainerFrame, and nsLineLayout.
This should be factored out to a separate method, and sticky positioning can later be added there.
Implementing this in a non-static method on nsHTMLReflowState works well except for the case of nsLineLayout. Using a static method and carrying along necessary bits of state works, but seems a bit messy.
Assignee | ||
Comment 1•11 years ago
|
||
Assignee: nobody → cford
Attachment #775840 -
Attachment is obsolete: true
Status: NEW → ASSIGNED
Attachment #775841 -
Flags: review?(dbaron)
Comment 2•11 years ago
|
||
Comment on attachment 775841 [details] [diff] [review]
Refactor the application of relative positioning (v2, static method)
>- nsContainerFrame::FinishReflowChild(mFrame, mPresContext, &aReflowState, mMetrics, x, y, 0);
>+ nsContainerFrame::FinishReflowChild(mFrame, mPresContext, &aReflowState, mMetrics, position.x, position.y, 0);
This line should get wrapped at slightly under 80 characters.
What I realized I should have suggested is that you could have two methods, a static method and a non-static method, where the non-static method is just an inline function that calls the static one with the right parameters. That would be slightly preferable, if you don't mind -- it means changing a bit of stuff back to the way it was in the old patch. Sorry I wasn't clear about that the last time around.
Also, in nsLineLayout, don't add an mStyleDisplay; instead, just use pfd->mFrame->StyleDisplay().
Attachment #775841 -
Flags: review?(dbaron) → review-
Assignee | ||
Comment 3•11 years ago
|
||
Yeah, that looks nicer.
try push: https://tbpl.mozilla.org/?tree=Try&rev=11b2cf5448fd
Attachment #776014 -
Flags: review?(dbaron)
Assignee | ||
Updated•11 years ago
|
Attachment #775841 -
Attachment is obsolete: true
Comment 4•11 years ago
|
||
Comment on attachment 776014 [details] [diff] [review]
Refactor the application of relative positioning.
>+ nsContainerFrame::FinishReflowChild(mFrame, mPresContext, &aReflowState,
>+ mMetrics, position.x, position.y, 0);
Line up mMetrics with mFrame on the previous line.
>+ // If a relatively positioned element, adjust the position appropriately.
>+ static void ApplyRelativePositioning(nsPoint *aPosition,
>+ const nsStyleDisplay* aDisplay,
>+ const nsMargin& aComputedOffsets);
I might slightly prefer putting aPosition as the last parameter rather than the first, just because we have a tendency towards putting things that are output parameters (or in this case, in-out params) later in the parameter list (as a result of the XPCOM->C++ convention of having the return value, and thus out-param, as the last C++ argument).
It's ok to leave that as-is, though.
(Neither change should require a new try run; just check that it still compiles.)
r=dbaron
Attachment #776014 -
Flags: review?(dbaron) → review+
Assignee | ||
Comment 5•11 years ago
|
||
Done.
Assignee | ||
Updated•11 years ago
|
Attachment #776014 -
Attachment is obsolete: true
Assignee | ||
Updated•11 years ago
|
Attachment #776043 -
Flags: review+
Assignee | ||
Comment 6•11 years ago
|
||
Assignee | ||
Updated•11 years ago
|
Attachment #776043 -
Attachment is obsolete: true
Assignee | ||
Comment 7•11 years ago
|
||
Comment on attachment 776061 [details] [diff] [review]
Refactor the application of relative positioning.
Fixed some pointer stars.
Attachment #776061 -
Flags: review+
Comment 9•11 years ago
|
||
Keywords: checkin-needed
Comment 10•11 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla25
Assignee | ||
Comment 11•11 years ago
|
||
Hmm, we also make various use of the computed offsets via nsIFrame::GetRelativeOffset after storing them in ComputedOffsetProperty.
You need to log in
before you can comment on or make changes to this bug.
Description
•