summaryrefslogtreecommitdiffstats
path: root/layout/forms/nsMeterFrame.cpp
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:34:50 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:34:50 +0000
commitdef92d1b8e9d373e2f6f27c366d578d97d8960c6 (patch)
tree2ef34b9ad8bb9a9220e05d60352558b15f513894 /layout/forms/nsMeterFrame.cpp
parentAdding debian version 125.0.3-1. (diff)
downloadfirefox-def92d1b8e9d373e2f6f27c366d578d97d8960c6.tar.xz
firefox-def92d1b8e9d373e2f6f27c366d578d97d8960c6.zip
Merging upstream version 126.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'layout/forms/nsMeterFrame.cpp')
-rw-r--r--layout/forms/nsMeterFrame.cpp64
1 files changed, 23 insertions, 41 deletions
diff --git a/layout/forms/nsMeterFrame.cpp b/layout/forms/nsMeterFrame.cpp
index a72a6816d5..31ef52a000 100644
--- a/layout/forms/nsMeterFrame.cpp
+++ b/layout/forms/nsMeterFrame.cpp
@@ -82,7 +82,6 @@ void nsMeterFrame::Reflow(nsPresContext* aPresContext,
nsReflowStatus& aStatus) {
MarkInReflow();
DO_GLOBAL_REFLOW_COUNT("nsMeterFrame");
- DISPLAY_REFLOW(aPresContext, this, aReflowInput, aDesiredSize, aStatus);
MOZ_ASSERT(aStatus.IsEmpty(), "Caller should pass a fresh reflow status!");
NS_ASSERTION(mBarDiv, "Meter bar div must exist!");
@@ -93,13 +92,19 @@ void nsMeterFrame::Reflow(nsPresContext* aPresContext,
nsIFrame* barFrame = mBarDiv->GetPrimaryFrame();
NS_ASSERTION(barFrame, "The meter frame should have a child with a frame!");
- ReflowBarFrame(barFrame, aPresContext, aReflowInput, aStatus);
-
const auto wm = aReflowInput.GetWritingMode();
- aDesiredSize.SetSize(wm, aReflowInput.ComputedSizeWithBorderPadding(wm));
-
+ const auto contentBoxSize = aReflowInput.ComputedSizeWithBSizeFallback([&] {
+ nscoord em = OneEmInAppUnits();
+ return ResolvedOrientationIsVertical() == wm.IsVertical() ? em : 5 * em;
+ });
+ aDesiredSize.SetSize(
+ wm,
+ contentBoxSize + aReflowInput.ComputedLogicalBorderPadding(wm).Size(wm));
aDesiredSize.SetOverflowAreasToDesiredBounds();
+
+ ReflowBarFrame(barFrame, aPresContext, aReflowInput, contentBoxSize, aStatus);
ConsiderChildOverflow(aDesiredSize.mOverflowAreas, barFrame);
+
FinishAndStoreOverflow(&aDesiredSize);
aStatus.Reset(); // This type of frame can't be split.
@@ -108,14 +113,19 @@ void nsMeterFrame::Reflow(nsPresContext* aPresContext,
void nsMeterFrame::ReflowBarFrame(nsIFrame* aBarFrame,
nsPresContext* aPresContext,
const ReflowInput& aReflowInput,
+ const LogicalSize& aParentContentBoxSize,
nsReflowStatus& aStatus) {
bool vertical = ResolvedOrientationIsVertical();
- WritingMode wm = aBarFrame->GetWritingMode();
- LogicalSize availSize = aReflowInput.ComputedSize(wm);
+ const WritingMode wm = aBarFrame->GetWritingMode();
+ const LogicalSize parentSizeInChildWM =
+ aParentContentBoxSize.ConvertTo(wm, aReflowInput.GetWritingMode());
+ const nsSize parentPhysicalSize = parentSizeInChildWM.GetPhysicalSize(wm);
+ LogicalSize availSize = parentSizeInChildWM;
availSize.BSize(wm) = NS_UNCONSTRAINEDSIZE;
- ReflowInput reflowInput(aPresContext, aReflowInput, aBarFrame, availSize);
+ ReflowInput reflowInput(aPresContext, aReflowInput, aBarFrame, availSize,
+ Some(parentSizeInChildWM));
nscoord size =
- vertical ? aReflowInput.ComputedHeight() : aReflowInput.ComputedWidth();
+ vertical ? parentPhysicalSize.Height() : parentPhysicalSize.Width();
nscoord xoffset = aReflowInput.ComputedPhysicalBorderPadding().left;
nscoord yoffset = aReflowInput.ComputedPhysicalBorderPadding().top;
@@ -123,14 +133,13 @@ void nsMeterFrame::ReflowBarFrame(nsIFrame* aBarFrame,
size = NSToCoordRound(size * meterElement->Position());
if (!vertical && wm.IsPhysicalRTL()) {
- xoffset += aReflowInput.ComputedWidth() - size;
+ xoffset += parentPhysicalSize.Width() - size;
}
// The bar position is *always* constrained.
if (vertical) {
// We want the bar to begin at the bottom.
- yoffset += aReflowInput.ComputedHeight() - size;
-
+ yoffset += parentPhysicalSize.Height() - size;
size -= reflowInput.ComputedPhysicalMargin().TopBottom() +
reflowInput.ComputedPhysicalBorderPadding().TopBottom();
size = std::max(size, 0);
@@ -169,39 +178,12 @@ nsresult nsMeterFrame::AttributeChanged(int32_t aNameSpaceID,
return nsContainerFrame::AttributeChanged(aNameSpaceID, aAttribute, aModType);
}
-LogicalSize nsMeterFrame::ComputeAutoSize(
- gfxContext* aRenderingContext, WritingMode aWM, const LogicalSize& aCBSize,
- nscoord aAvailableISize, const LogicalSize& aMargin,
- const LogicalSize& aBorderPadding, const StyleSizeOverrides& aSizeOverrides,
- ComputeSizeFlags aFlags) {
- RefPtr<nsFontMetrics> fontMet =
- nsLayoutUtils::GetFontMetricsForFrame(this, 1.0f);
-
- const WritingMode wm = GetWritingMode();
- LogicalSize autoSize(wm);
- autoSize.BSize(wm) = autoSize.ISize(wm) =
- fontMet->Font().size.ToAppUnits(); // 1em
-
- if (ResolvedOrientationIsVertical() == wm.IsVertical()) {
- autoSize.ISize(wm) *= 5; // 5em
- } else {
- autoSize.BSize(wm) *= 5; // 5em
- }
-
- return autoSize.ConvertTo(aWM, wm);
-}
-
nscoord nsMeterFrame::GetMinISize(gfxContext* aRenderingContext) {
- RefPtr<nsFontMetrics> fontMet =
- nsLayoutUtils::GetFontMetricsForFrame(this, 1.0f);
-
- nscoord minISize = fontMet->Font().size.ToAppUnits(); // 1em
-
+ nscoord minISize = OneEmInAppUnits();
if (ResolvedOrientationIsVertical() == GetWritingMode().IsVertical()) {
// The orientation is inline
- minISize *= 5; // 5em
+ minISize *= 5;
}
-
return minISize;
}