mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1079154 patch 4: Logical versions of ReflowChild and FinishReflowChild, r=jfkthame
This commit is contained in:
parent
16d0d92ccc
commit
941f71e622
@ -944,6 +944,56 @@ nsContainerFrame::ComputeAutoSize(nsRenderingContext* aRenderingContext,
|
||||
* frame is complete, deletes any next-in-flows using DeleteNextInFlowChild()
|
||||
*/
|
||||
void
|
||||
nsContainerFrame::ReflowChild(nsIFrame* aKidFrame,
|
||||
nsPresContext* aPresContext,
|
||||
nsHTMLReflowMetrics& aDesiredSize,
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
const WritingMode& aWM,
|
||||
const LogicalPoint& aPos,
|
||||
nscoord aContainerWidth,
|
||||
uint32_t aFlags,
|
||||
nsReflowStatus& aStatus,
|
||||
nsOverflowContinuationTracker* aTracker)
|
||||
{
|
||||
NS_PRECONDITION(aReflowState.frame == aKidFrame, "bad reflow state");
|
||||
if (aWM.IsVerticalRL() || (!aWM.IsVertical() && !aWM.IsBidiLTR())) {
|
||||
NS_ASSERTION(aContainerWidth != NS_UNCONSTRAINEDSIZE,
|
||||
"FinishReflowChild with unconstrained container width!");
|
||||
}
|
||||
|
||||
// Send the WillReflow() notification, and position the child frame
|
||||
// and its view if requested
|
||||
aKidFrame->WillReflow(aPresContext);
|
||||
|
||||
if (NS_FRAME_NO_MOVE_FRAME != (aFlags & NS_FRAME_NO_MOVE_FRAME)) {
|
||||
aKidFrame->SetPosition(aWM, aPos, aContainerWidth);
|
||||
}
|
||||
|
||||
if (0 == (aFlags & NS_FRAME_NO_MOVE_VIEW)) {
|
||||
PositionFrameView(aKidFrame);
|
||||
}
|
||||
|
||||
// Reflow the child frame
|
||||
aKidFrame->Reflow(aPresContext, aDesiredSize, aReflowState, aStatus);
|
||||
|
||||
// If the child frame is complete, delete any next-in-flows,
|
||||
// but only if the NO_DELETE_NEXT_IN_FLOW flag isn't set.
|
||||
if (NS_FRAME_IS_FULLY_COMPLETE(aStatus) &&
|
||||
!(aFlags & NS_FRAME_NO_DELETE_NEXT_IN_FLOW_CHILD)) {
|
||||
nsIFrame* kidNextInFlow = aKidFrame->GetNextInFlow();
|
||||
if (kidNextInFlow) {
|
||||
// Remove all of the childs next-in-flows. Make sure that we ask
|
||||
// the right parent to do the removal (it's possible that the
|
||||
// parent is not this because we are executing pullup code)
|
||||
nsOverflowContinuationTracker::AutoFinish fini(aTracker, aKidFrame);
|
||||
kidNextInFlow->GetParent()->DeleteNextInFlowChild(kidNextInFlow, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//XXX temporary: hold on to a copy of the old physical version of
|
||||
// ReflowChild so that we can convert callers incrementally.
|
||||
void
|
||||
nsContainerFrame::ReflowChild(nsIFrame* aKidFrame,
|
||||
nsPresContext* aPresContext,
|
||||
nsHTMLReflowMetrics& aDesiredSize,
|
||||
@ -1040,6 +1090,55 @@ nsContainerFrame::PositionChildViews(nsIFrame* aFrame)
|
||||
* NS_FRAME_NO_SIZE_VIEW - don't size the frame's view
|
||||
*/
|
||||
void
|
||||
nsContainerFrame::FinishReflowChild(nsIFrame* aKidFrame,
|
||||
nsPresContext* aPresContext,
|
||||
const nsHTMLReflowMetrics& aDesiredSize,
|
||||
const nsHTMLReflowState* aReflowState,
|
||||
const WritingMode& aWM,
|
||||
const LogicalPoint& aPos,
|
||||
nscoord aContainerWidth,
|
||||
uint32_t aFlags)
|
||||
{
|
||||
if (aWM.IsVerticalRL() || (!aWM.IsVertical() && !aWM.IsBidiLTR())) {
|
||||
NS_ASSERTION(aContainerWidth != NS_UNCONSTRAINEDSIZE,
|
||||
"FinishReflowChild with unconstrained container width!");
|
||||
}
|
||||
|
||||
nsPoint curOrigin = aKidFrame->GetPosition();
|
||||
WritingMode outerWM = aDesiredSize.GetWritingMode();
|
||||
LogicalSize convertedSize = aDesiredSize.Size(outerWM).ConvertTo(aWM,
|
||||
outerWM);
|
||||
|
||||
if (NS_FRAME_NO_MOVE_FRAME != (aFlags & NS_FRAME_NO_MOVE_FRAME)) {
|
||||
aKidFrame->SetRect(aWM, LogicalRect(aWM, aPos, convertedSize),
|
||||
aContainerWidth);
|
||||
} else {
|
||||
aKidFrame->SetSize(aWM, convertedSize);
|
||||
}
|
||||
|
||||
if (aKidFrame->HasView()) {
|
||||
nsView* view = aKidFrame->GetView();
|
||||
// Make sure the frame's view is properly sized and positioned and has
|
||||
// things like opacity correct
|
||||
SyncFrameViewAfterReflow(aPresContext, aKidFrame, view,
|
||||
aDesiredSize.VisualOverflow(), aFlags);
|
||||
}
|
||||
|
||||
nsPoint newOrigin = aKidFrame->GetPosition();
|
||||
if (!(aFlags & NS_FRAME_NO_MOVE_VIEW) && curOrigin != newOrigin) {
|
||||
if (!aKidFrame->HasView()) {
|
||||
// If the frame has moved, then we need to make sure any child views are
|
||||
// correctly positioned
|
||||
PositionChildViews(aKidFrame);
|
||||
}
|
||||
}
|
||||
|
||||
aKidFrame->DidReflow(aPresContext, aReflowState, nsDidReflowStatus::FINISHED);
|
||||
}
|
||||
|
||||
//XXX temporary: hold on to a copy of the old physical version of
|
||||
// FinishReflowChild so that we can convert callers incrementally.
|
||||
void
|
||||
nsContainerFrame::FinishReflowChild(nsIFrame* aKidFrame,
|
||||
nsPresContext* aPresContext,
|
||||
const nsHTMLReflowMetrics& aDesiredSize,
|
||||
|
@ -245,8 +245,9 @@ public:
|
||||
nsPresContext* aPresContext,
|
||||
nsHTMLReflowMetrics& aDesiredSize,
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
nscoord aX,
|
||||
nscoord aY,
|
||||
const mozilla::WritingMode& aWM,
|
||||
const mozilla::LogicalPoint& aPos,
|
||||
nscoord aContainerWidth,
|
||||
uint32_t aFlags,
|
||||
nsReflowStatus& aStatus,
|
||||
nsOverflowContinuationTracker* aTracker = nullptr);
|
||||
@ -268,6 +269,28 @@ public:
|
||||
* don't want to automatically sync the frame and view
|
||||
* NS_FRAME_NO_SIZE_VIEW - don't size the frame's view
|
||||
*/
|
||||
static void FinishReflowChild(nsIFrame* aKidFrame,
|
||||
nsPresContext* aPresContext,
|
||||
const nsHTMLReflowMetrics& aDesiredSize,
|
||||
const nsHTMLReflowState* aReflowState,
|
||||
const mozilla::WritingMode& aWM,
|
||||
const mozilla::LogicalPoint& aPos,
|
||||
nscoord aContainerWidth,
|
||||
uint32_t aFlags);
|
||||
|
||||
//XXX temporary: hold on to a copy of the old physical versions of
|
||||
// ReflowChild and FinishReflowChild so that we can convert callers
|
||||
// incrementally.
|
||||
void ReflowChild(nsIFrame* aKidFrame,
|
||||
nsPresContext* aPresContext,
|
||||
nsHTMLReflowMetrics& aDesiredSize,
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
nscoord aX,
|
||||
nscoord aY,
|
||||
uint32_t aFlags,
|
||||
nsReflowStatus& aStatus,
|
||||
nsOverflowContinuationTracker* aTracker = nullptr);
|
||||
|
||||
static void FinishReflowChild(nsIFrame* aKidFrame,
|
||||
nsPresContext* aPresContext,
|
||||
const nsHTMLReflowMetrics& aDesiredSize,
|
||||
@ -276,7 +299,6 @@ public:
|
||||
nscoord aY,
|
||||
uint32_t aFlags);
|
||||
|
||||
|
||||
static void PositionChildViews(nsIFrame* aFrame);
|
||||
|
||||
// ==========================================================================
|
||||
|
Loading…
Reference in New Issue
Block a user