зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1674450 Part 7 - Store SizeComputationInput's computed margin, border/padding, and padding in logical coordinates. r=layout-reviewers,jfkthame
The one-argument SetComputedLogicalMargin(), SetComputedLogicalBorderPadding(), and SetComputedLogicalPadding() are not changed because the next part are going to delete them. Note that I'm deliberately not making ComputedLogicalMargin() and others to return `const LogicalMargin&` because the compilers can use RVO to eliminate unnecessary copy. If we'd like to convert them to accept all writing mode like `nsIFrame::GetLogicalUsedMargin(WritingMode)` so that the caller don't need to call `ConvertTo`, they can't return a const reference anyway. Differential Revision: https://phabricator.services.mozilla.com/D95370
This commit is contained in:
Родитель
8c17380539
Коммит
1531f4b093
|
@ -111,7 +111,10 @@ SizeComputationInput::SizeComputationInput(nsIFrame* aFrame,
|
|||
gfxContext* aRenderingContext)
|
||||
: mFrame(aFrame),
|
||||
mRenderingContext(aRenderingContext),
|
||||
mWritingMode(aFrame->GetWritingMode()) {}
|
||||
mWritingMode(aFrame->GetWritingMode()),
|
||||
mComputedMargin(mWritingMode),
|
||||
mComputedBorderPadding(mWritingMode),
|
||||
mComputedPadding(mWritingMode) {}
|
||||
|
||||
SizeComputationInput::SizeComputationInput(
|
||||
nsIFrame* aFrame, gfxContext* aRenderingContext,
|
||||
|
@ -2446,7 +2449,7 @@ void SizeComputationInput::InitOffsets(WritingMode aCBWM, nscoord aPercentBasis,
|
|||
side = MakeLogicalSide(aAxis, eLogicalEdgeEnd);
|
||||
val = -val;
|
||||
}
|
||||
mComputedPadding.Side(wm.PhysicalSide(side)) += val;
|
||||
mComputedPadding.Side(side, wm) += val;
|
||||
needPaddingProp = true;
|
||||
if (aAxis == eLogicalAxisBlock && val > 0) {
|
||||
// We have a baseline-adjusted block-axis start padding, so
|
||||
|
|
|
@ -117,41 +117,41 @@ struct SizeComputationInput {
|
|||
// Rendering context to use for measurement.
|
||||
gfxContext* mRenderingContext;
|
||||
|
||||
const nsMargin& ComputedPhysicalMargin() const { return mComputedMargin; }
|
||||
const nsMargin& ComputedPhysicalBorderPadding() const {
|
||||
nsMargin ComputedPhysicalMargin() const {
|
||||
return mComputedMargin.GetPhysicalMargin(mWritingMode);
|
||||
}
|
||||
nsMargin ComputedPhysicalBorderPadding() const {
|
||||
return mComputedBorderPadding.GetPhysicalMargin(mWritingMode);
|
||||
}
|
||||
nsMargin ComputedPhysicalPadding() const {
|
||||
return mComputedPadding.GetPhysicalMargin(mWritingMode);
|
||||
}
|
||||
|
||||
LogicalMargin ComputedLogicalMargin() const { return mComputedMargin; }
|
||||
LogicalMargin ComputedLogicalBorderPadding() const {
|
||||
return mComputedBorderPadding;
|
||||
}
|
||||
const nsMargin& ComputedPhysicalPadding() const { return mComputedPadding; }
|
||||
|
||||
LogicalMargin ComputedLogicalMargin() const {
|
||||
return LogicalMargin(mWritingMode, mComputedMargin);
|
||||
}
|
||||
LogicalMargin ComputedLogicalBorderPadding() const {
|
||||
return LogicalMargin(mWritingMode, mComputedBorderPadding);
|
||||
}
|
||||
LogicalMargin ComputedLogicalPadding() const {
|
||||
return LogicalMargin(mWritingMode, mComputedPadding);
|
||||
}
|
||||
LogicalMargin ComputedLogicalPadding() const { return mComputedPadding; }
|
||||
|
||||
void SetComputedLogicalMargin(mozilla::WritingMode aWM,
|
||||
const LogicalMargin& aMargin) {
|
||||
mComputedMargin = aMargin.GetPhysicalMargin(aWM);
|
||||
mComputedMargin = aMargin.ConvertTo(mWritingMode, aWM);
|
||||
}
|
||||
void SetComputedLogicalMargin(const LogicalMargin& aMargin) {
|
||||
SetComputedLogicalMargin(mWritingMode, aMargin);
|
||||
}
|
||||
|
||||
void SetComputedLogicalBorderPadding(mozilla::WritingMode aWM,
|
||||
const LogicalMargin& aMargin) {
|
||||
mComputedBorderPadding = aMargin.GetPhysicalMargin(aWM);
|
||||
const LogicalMargin& aBorderPadding) {
|
||||
mComputedBorderPadding = aBorderPadding.ConvertTo(mWritingMode, aWM);
|
||||
}
|
||||
void SetComputedLogicalBorderPadding(const LogicalMargin& aMargin) {
|
||||
SetComputedLogicalBorderPadding(mWritingMode, aMargin);
|
||||
}
|
||||
|
||||
void SetComputedLogicalPadding(mozilla::WritingMode aWM,
|
||||
const LogicalMargin& aMargin) {
|
||||
mComputedPadding = aMargin.GetPhysicalMargin(aWM);
|
||||
const LogicalMargin& aPadding) {
|
||||
mComputedPadding = aPadding.ConvertTo(mWritingMode, aWM);
|
||||
}
|
||||
void SetComputedLogicalPadding(const LogicalMargin& aMargin) {
|
||||
SetComputedLogicalPadding(mWritingMode, aMargin);
|
||||
|
@ -163,17 +163,14 @@ struct SizeComputationInput {
|
|||
// cached copy of the frame's writing-mode, for logical coordinates
|
||||
WritingMode mWritingMode;
|
||||
|
||||
// These are PHYSICAL coordinates (for now).
|
||||
// Will probably become logical in due course.
|
||||
|
||||
// Computed margin values
|
||||
nsMargin mComputedMargin;
|
||||
LogicalMargin mComputedMargin;
|
||||
|
||||
// Cached copy of the border + padding values
|
||||
nsMargin mComputedBorderPadding;
|
||||
LogicalMargin mComputedBorderPadding;
|
||||
|
||||
// Computed padding values
|
||||
nsMargin mComputedPadding;
|
||||
LogicalMargin mComputedPadding;
|
||||
|
||||
public:
|
||||
// Callers using this constructor must call InitOffsets on their own.
|
||||
|
|
|
@ -12353,9 +12353,12 @@ void SizeComputationInput::DisplayInitOffsetsExit(nsIFrame* aFrame,
|
|||
if (treeNode->mDisplay) {
|
||||
DR_state->DisplayFrameTypeInfo(aFrame, treeNode->mIndent);
|
||||
printf("InitOffsets=");
|
||||
DR_state->PrintMargin("m", &aState->ComputedPhysicalMargin());
|
||||
DR_state->PrintMargin("p", &aState->ComputedPhysicalPadding());
|
||||
DR_state->PrintMargin("p+b", &aState->ComputedPhysicalBorderPadding());
|
||||
const auto m = aState->ComputedPhysicalMargin();
|
||||
DR_state->PrintMargin("m", &m);
|
||||
const auto p = aState->ComputedPhysicalPadding();
|
||||
DR_state->PrintMargin("p", &p);
|
||||
const auto bp = aState->ComputedPhysicalBorderPadding();
|
||||
DR_state->PrintMargin("b+p", &bp);
|
||||
putchar('\n');
|
||||
}
|
||||
DR_state->DeleteTreeNode(*treeNode);
|
||||
|
|
Загрузка…
Ссылка в новой задаче