summaryrefslogtreecommitdiffstats
path: root/layout/forms
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:34:42 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:34:42 +0000
commitda4c7e7ed675c3bf405668739c3012d140856109 (patch)
treecdd868dba063fecba609a1d819de271f0d51b23e /layout/forms
parentAdding upstream version 125.0.3. (diff)
downloadfirefox-da4c7e7ed675c3bf405668739c3012d140856109.tar.xz
firefox-da4c7e7ed675c3bf405668739c3012d140856109.zip
Adding upstream version 126.0.upstream/126.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'layout/forms')
-rw-r--r--layout/forms/nsCheckboxRadioFrame.cpp26
-rw-r--r--layout/forms/nsComboboxControlFrame.cpp2
-rw-r--r--layout/forms/nsDateTimeControlFrame.cpp29
-rw-r--r--layout/forms/nsFieldSetFrame.cpp15
-rw-r--r--layout/forms/nsHTMLButtonControlFrame.cpp26
-rw-r--r--layout/forms/nsImageControlFrame.cpp1
-rw-r--r--layout/forms/nsListControlFrame.cpp16
-rw-r--r--layout/forms/nsMeterFrame.cpp64
-rw-r--r--layout/forms/nsMeterFrame.h39
-rw-r--r--layout/forms/nsProgressFrame.cpp71
-rw-r--r--layout/forms/nsProgressFrame.h38
-rw-r--r--layout/forms/nsRangeFrame.cpp280
-rw-r--r--layout/forms/nsRangeFrame.h46
-rw-r--r--layout/forms/nsTextControlFrame.cpp104
-rw-r--r--layout/forms/nsTextControlFrame.h14
15 files changed, 262 insertions, 509 deletions
diff --git a/layout/forms/nsCheckboxRadioFrame.cpp b/layout/forms/nsCheckboxRadioFrame.cpp
index e2b8541613..4bf15099aa 100644
--- a/layout/forms/nsCheckboxRadioFrame.cpp
+++ b/layout/forms/nsCheckboxRadioFrame.cpp
@@ -52,18 +52,12 @@ void nsCheckboxRadioFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
/* virtual */
nscoord nsCheckboxRadioFrame::GetMinISize(gfxContext* aRenderingContext) {
- nscoord result;
- DISPLAY_MIN_INLINE_SIZE(this, result);
- result = StyleDisplay()->HasAppearance() ? DefaultSize() : 0;
- return result;
+ return StyleDisplay()->HasAppearance() ? DefaultSize() : 0;
}
/* virtual */
nscoord nsCheckboxRadioFrame::GetPrefISize(gfxContext* aRenderingContext) {
- nscoord result;
- DISPLAY_PREF_INLINE_SIZE(this, result);
- result = StyleDisplay()->HasAppearance() ? DefaultSize() : 0;
- return result;
+ return StyleDisplay()->HasAppearance() ? DefaultSize() : 0;
}
/* virtual */
@@ -76,13 +70,9 @@ LogicalSize nsCheckboxRadioFrame::ComputeAutoSize(
if (!StyleDisplay()->HasAppearance()) {
return size;
}
-
- // Note: this call always set the BSize to NS_UNCONSTRAINEDSIZE.
- size = nsAtomicContainerFrame::ComputeAutoSize(
+ return nsAtomicContainerFrame::ComputeAutoSize(
aRC, aWM, aCBSize, aAvailableISize, aMargin, aBorderPadding,
aSizeOverrides, aFlags);
- size.BSize(aWM) = DefaultSize();
- return size;
}
Maybe<nscoord> nsCheckboxRadioFrame::GetNaturalBaselineBOffset(
@@ -125,7 +115,6 @@ void nsCheckboxRadioFrame::Reflow(nsPresContext* aPresContext,
nsReflowStatus& aStatus) {
MarkInReflow();
DO_GLOBAL_REFLOW_COUNT("nsCheckboxRadioFrame");
- DISPLAY_REFLOW(aPresContext, this, aReflowInput, aDesiredSize, aStatus);
MOZ_ASSERT(aStatus.IsEmpty(), "Caller should pass a fresh reflow status!");
NS_FRAME_TRACE(
NS_FRAME_TRACE_CALLS,
@@ -133,10 +122,13 @@ void nsCheckboxRadioFrame::Reflow(nsPresContext* aPresContext,
aReflowInput.AvailableWidth(), aReflowInput.AvailableHeight()));
const auto wm = aReflowInput.GetWritingMode();
- aDesiredSize.SetSize(wm, aReflowInput.ComputedSizeWithBorderPadding(wm));
-
+ const auto contentBoxSize =
+ aReflowInput.ComputedSizeWithBSizeFallback([&] { return DefaultSize(); });
+ aDesiredSize.SetSize(
+ wm,
+ contentBoxSize + aReflowInput.ComputedLogicalBorderPadding(wm).Size(wm));
if (nsLayoutUtils::FontSizeInflationEnabled(aPresContext)) {
- float inflation = nsLayoutUtils::FontSizeInflationFor(this);
+ const float inflation = nsLayoutUtils::FontSizeInflationFor(this);
aDesiredSize.Width() *= inflation;
aDesiredSize.Height() *= inflation;
}
diff --git a/layout/forms/nsComboboxControlFrame.cpp b/layout/forms/nsComboboxControlFrame.cpp
index 1d4ff15b4f..98486255d0 100644
--- a/layout/forms/nsComboboxControlFrame.cpp
+++ b/layout/forms/nsComboboxControlFrame.cpp
@@ -190,14 +190,12 @@ nscoord nsComboboxControlFrame::GetIntrinsicISize(gfxContext* aRenderingContext,
nscoord nsComboboxControlFrame::GetMinISize(gfxContext* aRenderingContext) {
nscoord minISize;
- DISPLAY_MIN_INLINE_SIZE(this, minISize);
minISize = GetIntrinsicISize(aRenderingContext, IntrinsicISizeType::MinISize);
return minISize;
}
nscoord nsComboboxControlFrame::GetPrefISize(gfxContext* aRenderingContext) {
nscoord prefISize;
- DISPLAY_PREF_INLINE_SIZE(this, prefISize);
prefISize =
GetIntrinsicISize(aRenderingContext, IntrinsicISizeType::PrefISize);
return prefISize;
diff --git a/layout/forms/nsDateTimeControlFrame.cpp b/layout/forms/nsDateTimeControlFrame.cpp
index b19f787dbc..d8cdf5f277 100644
--- a/layout/forms/nsDateTimeControlFrame.cpp
+++ b/layout/forms/nsDateTimeControlFrame.cpp
@@ -35,33 +35,21 @@ nsDateTimeControlFrame::nsDateTimeControlFrame(ComputedStyle* aStyle,
: nsContainerFrame(aStyle, aPresContext, kClassID) {}
nscoord nsDateTimeControlFrame::GetMinISize(gfxContext* aRenderingContext) {
- nscoord result;
- DISPLAY_MIN_INLINE_SIZE(this, result);
-
nsIFrame* kid = mFrames.FirstChild();
- if (kid) { // display:none?
- result = nsLayoutUtils::IntrinsicForContainer(aRenderingContext, kid,
- IntrinsicISizeType::MinISize);
- } else {
- result = 0;
+ if (!kid) {
+ return 0;
}
-
- return result;
+ return nsLayoutUtils::IntrinsicForContainer(aRenderingContext, kid,
+ IntrinsicISizeType::MinISize);
}
nscoord nsDateTimeControlFrame::GetPrefISize(gfxContext* aRenderingContext) {
- nscoord result;
- DISPLAY_PREF_INLINE_SIZE(this, result);
-
nsIFrame* kid = mFrames.FirstChild();
- if (kid) { // display:none?
- result = nsLayoutUtils::IntrinsicForContainer(
- aRenderingContext, kid, IntrinsicISizeType::PrefISize);
- } else {
- result = 0;
+ if (!kid) {
+ return 0;
}
-
- return result;
+ return nsLayoutUtils::IntrinsicForContainer(aRenderingContext, kid,
+ IntrinsicISizeType::PrefISize);
}
Maybe<nscoord> nsDateTimeControlFrame::GetNaturalBaselineBOffset(
@@ -78,7 +66,6 @@ void nsDateTimeControlFrame::Reflow(nsPresContext* aPresContext,
MarkInReflow();
DO_GLOBAL_REFLOW_COUNT("nsDateTimeControlFrame");
- DISPLAY_REFLOW(aPresContext, this, aReflowInput, aDesiredSize, aStatus);
MOZ_ASSERT(aStatus.IsEmpty(), "Caller should pass a fresh reflow status!");
NS_FRAME_TRACE(
NS_FRAME_TRACE_CALLS,
diff --git a/layout/forms/nsFieldSetFrame.cpp b/layout/forms/nsFieldSetFrame.cpp
index c96b293e82..2648cb4dd3 100644
--- a/layout/forms/nsFieldSetFrame.cpp
+++ b/layout/forms/nsFieldSetFrame.cpp
@@ -58,7 +58,7 @@ nsRect nsFieldSetFrame::VisualBorderRectRelativeToSelf() const {
auto legendMargin = legend->GetLogicalUsedMargin(wm);
nscoord legendStartMargin = legendMargin.BStart(wm);
nscoord legendEndMargin = legendMargin.BEnd(wm);
- nscoord border = GetUsedBorder().Side(wm.PhysicalSide(eLogicalSideBStart));
+ nscoord border = GetUsedBorder().Side(wm.PhysicalSide(LogicalSide::BStart));
// Calculate the offset from the border area block-axis start edge needed to
// center-align our border with the legend's border-box (in the block-axis).
nscoord off = (legendStartMargin + legendSize / 2) - border / 2;
@@ -348,19 +348,11 @@ nscoord nsFieldSetFrame::GetIntrinsicISize(gfxContext* aRenderingContext,
}
nscoord nsFieldSetFrame::GetMinISize(gfxContext* aRenderingContext) {
- nscoord result = 0;
- DISPLAY_MIN_INLINE_SIZE(this, result);
-
- result = GetIntrinsicISize(aRenderingContext, IntrinsicISizeType::MinISize);
- return result;
+ return GetIntrinsicISize(aRenderingContext, IntrinsicISizeType::MinISize);
}
nscoord nsFieldSetFrame::GetPrefISize(gfxContext* aRenderingContext) {
- nscoord result = 0;
- DISPLAY_PREF_INLINE_SIZE(this, result);
-
- result = GetIntrinsicISize(aRenderingContext, IntrinsicISizeType::PrefISize);
- return result;
+ return GetIntrinsicISize(aRenderingContext, IntrinsicISizeType::PrefISize);
}
/* virtual */
@@ -372,7 +364,6 @@ void nsFieldSetFrame::Reflow(nsPresContext* aPresContext,
MarkInReflow();
DO_GLOBAL_REFLOW_COUNT("nsFieldSetFrame");
- DISPLAY_REFLOW(aPresContext, this, aReflowInput, aDesiredSize, aStatus);
MOZ_ASSERT(aStatus.IsEmpty(), "Caller should pass a fresh reflow status!");
NS_WARNING_ASSERTION(aReflowInput.ComputedISize() != NS_UNCONSTRAINEDSIZE,
"Should have a precomputed inline-size!");
diff --git a/layout/forms/nsHTMLButtonControlFrame.cpp b/layout/forms/nsHTMLButtonControlFrame.cpp
index cb24ccbfb9..5201e420e2 100644
--- a/layout/forms/nsHTMLButtonControlFrame.cpp
+++ b/layout/forms/nsHTMLButtonControlFrame.cpp
@@ -51,6 +51,7 @@ void nsHTMLButtonControlFrame::Init(nsIContent* aContent,
}
NS_QUERYFRAME_HEAD(nsHTMLButtonControlFrame)
+ NS_QUERYFRAME_ENTRY(nsHTMLButtonControlFrame)
NS_QUERYFRAME_ENTRY(nsIFormControlFrame)
NS_QUERYFRAME_TAIL_INHERITING(nsContainerFrame)
@@ -238,29 +239,21 @@ void nsHTMLButtonControlFrame::BuildDisplayList(
}
nscoord nsHTMLButtonControlFrame::GetMinISize(gfxContext* aRenderingContext) {
- nscoord result;
- DISPLAY_MIN_INLINE_SIZE(this, result);
if (Maybe<nscoord> containISize = ContainIntrinsicISize()) {
- result = *containISize;
- } else {
- nsIFrame* kid = mFrames.FirstChild();
- result = nsLayoutUtils::IntrinsicForContainer(aRenderingContext, kid,
- IntrinsicISizeType::MinISize);
+ return *containISize;
}
- return result;
+ nsIFrame* kid = mFrames.FirstChild();
+ return nsLayoutUtils::IntrinsicForContainer(aRenderingContext, kid,
+ IntrinsicISizeType::MinISize);
}
nscoord nsHTMLButtonControlFrame::GetPrefISize(gfxContext* aRenderingContext) {
- nscoord result;
- DISPLAY_PREF_INLINE_SIZE(this, result);
if (Maybe<nscoord> containISize = ContainIntrinsicISize()) {
- result = *containISize;
- } else {
- nsIFrame* kid = mFrames.FirstChild();
- result = nsLayoutUtils::IntrinsicForContainer(
- aRenderingContext, kid, IntrinsicISizeType::PrefISize);
+ return *containISize;
}
- return result;
+ nsIFrame* kid = mFrames.FirstChild();
+ return nsLayoutUtils::IntrinsicForContainer(aRenderingContext, kid,
+ IntrinsicISizeType::PrefISize);
}
void nsHTMLButtonControlFrame::Reflow(nsPresContext* aPresContext,
@@ -269,7 +262,6 @@ void nsHTMLButtonControlFrame::Reflow(nsPresContext* aPresContext,
nsReflowStatus& aStatus) {
MarkInReflow();
DO_GLOBAL_REFLOW_COUNT("nsHTMLButtonControlFrame");
- DISPLAY_REFLOW(aPresContext, this, aReflowInput, aDesiredSize, aStatus);
MOZ_ASSERT(aStatus.IsEmpty(), "Caller should pass a fresh reflow status!");
// Reflow the child
diff --git a/layout/forms/nsImageControlFrame.cpp b/layout/forms/nsImageControlFrame.cpp
index 17e3893a2f..8207a427f1 100644
--- a/layout/forms/nsImageControlFrame.cpp
+++ b/layout/forms/nsImageControlFrame.cpp
@@ -97,7 +97,6 @@ void nsImageControlFrame::Reflow(nsPresContext* aPresContext,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) {
DO_GLOBAL_REFLOW_COUNT("nsImageControlFrame");
- DISPLAY_REFLOW(aPresContext, this, aReflowInput, aDesiredSize, aStatus);
MOZ_ASSERT(aStatus.IsEmpty(), "Caller should pass a fresh reflow status!");
return nsImageFrame::Reflow(aPresContext, aDesiredSize, aReflowInput,
aStatus);
diff --git a/layout/forms/nsListControlFrame.cpp b/layout/forms/nsListControlFrame.cpp
index 44ce9fde13..3020e99888 100644
--- a/layout/forms/nsListControlFrame.cpp
+++ b/layout/forms/nsListControlFrame.cpp
@@ -230,34 +230,30 @@ nscoord nsListControlFrame::CalcBSizeOfARow() {
}
nscoord nsListControlFrame::GetPrefISize(gfxContext* aRenderingContext) {
- nscoord result;
- DISPLAY_PREF_INLINE_SIZE(this, result);
-
// Always add scrollbar inline sizes to the pref-inline-size of the
// scrolled content. Combobox frames depend on this happening in the
// dropdown, and standalone listboxes are overflow:scroll so they need
// it too.
WritingMode wm = GetWritingMode();
Maybe<nscoord> containISize = ContainIntrinsicISize();
- result = containISize ? *containISize
- : GetScrolledFrame()->GetPrefISize(aRenderingContext);
+ nscoord result = containISize
+ ? *containISize
+ : GetScrolledFrame()->GetPrefISize(aRenderingContext);
LogicalMargin scrollbarSize(wm, GetDesiredScrollbarSizes());
result = NSCoordSaturatingAdd(result, scrollbarSize.IStartEnd(wm));
return result;
}
nscoord nsListControlFrame::GetMinISize(gfxContext* aRenderingContext) {
- nscoord result;
- DISPLAY_MIN_INLINE_SIZE(this, result);
-
// Always add scrollbar inline sizes to the min-inline-size of the
// scrolled content. Combobox frames depend on this happening in the
// dropdown, and standalone listboxes are overflow:scroll so they need
// it too.
WritingMode wm = GetWritingMode();
Maybe<nscoord> containISize = ContainIntrinsicISize();
- result = containISize ? *containISize
- : GetScrolledFrame()->GetMinISize(aRenderingContext);
+ nscoord result = containISize
+ ? *containISize
+ : GetScrolledFrame()->GetMinISize(aRenderingContext);
LogicalMargin scrollbarSize(wm, GetDesiredScrollbarSizes());
result += scrollbarSize.IStartEnd(wm);
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;
}
diff --git a/layout/forms/nsMeterFrame.h b/layout/forms/nsMeterFrame.h
index 4aa82c1384..7a15878beb 100644
--- a/layout/forms/nsMeterFrame.h
+++ b/layout/forms/nsMeterFrame.h
@@ -7,17 +7,15 @@
#ifndef nsMeterFrame_h___
#define nsMeterFrame_h___
-#include "mozilla/Attributes.h"
#include "nsContainerFrame.h"
#include "nsIAnonymousContentCreator.h"
#include "nsCOMPtr.h"
-#include "nsCSSPseudoElements.h"
class nsMeterFrame final : public nsContainerFrame,
public nsIAnonymousContentCreator
{
- typedef mozilla::dom::Element Element;
+ using Element = mozilla::dom::Element;
public:
NS_DECL_QUERYFRAME
@@ -27,36 +25,25 @@ class nsMeterFrame final : public nsContainerFrame,
virtual ~nsMeterFrame();
void Destroy(DestroyContext&) override;
-
- virtual void Reflow(nsPresContext* aCX, ReflowOutput& aDesiredSize,
- const ReflowInput& aReflowInput,
- nsReflowStatus& aStatus) override;
+ void Reflow(nsPresContext*, ReflowOutput&, const ReflowInput&,
+ nsReflowStatus&) override;
#ifdef DEBUG_FRAME_DUMP
- virtual nsresult GetFrameName(nsAString& aResult) const override {
+ nsresult GetFrameName(nsAString& aResult) const override {
return MakeFrameName(u"Meter"_ns, aResult);
}
#endif
// nsIAnonymousContentCreator
- virtual nsresult CreateAnonymousContent(
- nsTArray<ContentInfo>& aElements) override;
- virtual void AppendAnonymousContentTo(nsTArray<nsIContent*>& aElements,
- uint32_t aFilter) override;
+ nsresult CreateAnonymousContent(nsTArray<ContentInfo>& aElements) override;
+ void AppendAnonymousContentTo(nsTArray<nsIContent*>& aElements,
+ uint32_t aFilter) override;
- virtual nsresult AttributeChanged(int32_t aNameSpaceID, nsAtom* aAttribute,
- int32_t aModType) override;
+ nsresult AttributeChanged(int32_t aNameSpaceID, nsAtom* aAttribute,
+ int32_t aModType) override;
- virtual mozilla::LogicalSize ComputeAutoSize(
- gfxContext* aRenderingContext, mozilla::WritingMode aWM,
- const mozilla::LogicalSize& aCBSize, nscoord aAvailableISize,
- const mozilla::LogicalSize& aMargin,
- const mozilla::LogicalSize& aBorderPadding,
- const mozilla::StyleSizeOverrides& aSizeOverrides,
- mozilla::ComputeSizeFlags aFlags) override;
-
- virtual nscoord GetMinISize(gfxContext* aRenderingContext) override;
- virtual nscoord GetPrefISize(gfxContext* aRenderingContext) override;
+ nscoord GetMinISize(gfxContext* aRenderingContext) override;
+ nscoord GetPrefISize(gfxContext* aRenderingContext) override;
/**
* Returns whether the frame and its child should use the native style.
@@ -66,7 +53,9 @@ class nsMeterFrame final : public nsContainerFrame,
protected:
// Helper function which reflow the anonymous div frame.
void ReflowBarFrame(nsIFrame* aBarFrame, nsPresContext* aPresContext,
- const ReflowInput& aReflowInput, nsReflowStatus& aStatus);
+ const ReflowInput& aReflowInput,
+ const mozilla::LogicalSize& aParentContentBoxSize,
+ nsReflowStatus& aStatus);
/**
* The div used to show the meter bar.
* @see nsMeterFrame::CreateAnonymousContent
diff --git a/layout/forms/nsProgressFrame.cpp b/layout/forms/nsProgressFrame.cpp
index 2f0d727473..1cf6bf1447 100644
--- a/layout/forms/nsProgressFrame.cpp
+++ b/layout/forms/nsProgressFrame.cpp
@@ -86,7 +86,6 @@ void nsProgressFrame::Reflow(nsPresContext* aPresContext,
nsReflowStatus& aStatus) {
MarkInReflow();
DO_GLOBAL_REFLOW_COUNT("nsProgressFrame");
- DISPLAY_REFLOW(aPresContext, this, aReflowInput, aDesiredSize, aStatus);
MOZ_ASSERT(aStatus.IsEmpty(), "Caller should pass a fresh reflow status!");
NS_ASSERTION(mBarDiv, "Progress bar div must exist!");
@@ -99,11 +98,18 @@ void nsProgressFrame::Reflow(nsPresContext* aPresContext,
"need to call RegUnregAccessKey only for the first.");
const auto wm = aReflowInput.GetWritingMode();
- aDesiredSize.SetSize(wm, aReflowInput.ComputedSizeWithBorderPadding(wm));
+ const auto contentBoxSize = aReflowInput.ComputedSizeWithBSizeFallback([&] {
+ nscoord em = OneEmInAppUnits();
+ return ResolvedOrientationIsVertical() == wm.IsVertical() ? em : 10 * em;
+ });
+ aDesiredSize.SetSize(
+ wm,
+ contentBoxSize + aReflowInput.ComputedLogicalBorderPadding(wm).Size(wm));
aDesiredSize.SetOverflowAreasToDesiredBounds();
- for (auto childFrame : PrincipalChildList()) {
- ReflowChildFrame(childFrame, aPresContext, aReflowInput, aStatus);
+ for (nsIFrame* childFrame : PrincipalChildList()) {
+ ReflowChildFrame(childFrame, aPresContext, aReflowInput, contentBoxSize,
+ aStatus);
ConsiderChildOverflow(aDesiredSize.mOverflowAreas, childFrame);
}
@@ -115,14 +121,19 @@ void nsProgressFrame::Reflow(nsPresContext* aPresContext,
void nsProgressFrame::ReflowChildFrame(nsIFrame* aChild,
nsPresContext* aPresContext,
const ReflowInput& aReflowInput,
+ const LogicalSize& aParentContentBoxSize,
nsReflowStatus& aStatus) {
bool vertical = ResolvedOrientationIsVertical();
- WritingMode wm = aChild->GetWritingMode();
- LogicalSize availSize = aReflowInput.ComputedSize(wm);
+ const WritingMode wm = aChild->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, aChild, availSize);
+ ReflowInput reflowInput(aPresContext, aReflowInput, aChild, 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;
@@ -135,7 +146,7 @@ void nsProgressFrame::ReflowChildFrame(nsIFrame* aChild,
}
if (!vertical && wm.IsPhysicalRTL()) {
- xoffset += aReflowInput.ComputedWidth() - size;
+ xoffset += parentPhysicalSize.Width() - size;
}
// The bar size is fixed in these cases:
@@ -148,8 +159,7 @@ void nsProgressFrame::ReflowChildFrame(nsIFrame* aChild,
if (position != -1 || ShouldUseNativeStyle()) {
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);
@@ -161,10 +171,12 @@ void nsProgressFrame::ReflowChildFrame(nsIFrame* aChild,
reflowInput.SetComputedWidth(size);
}
} else if (vertical) {
- // For vertical progress bars, we need to position the bar specificly when
+ // For vertical progress bars, we need to position the bar specifically when
// the width isn't constrained (position == -1 and !ShouldUseNativeStyle())
- // because aReflowInput.ComputedHeight() - size == 0.
- yoffset += aReflowInput.ComputedHeight() - reflowInput.ComputedHeight();
+ // because parentPhysiscalSize.Height() - size == 0.
+ // FIXME(emilio): This assumes that the bar's height is constrained, which
+ // seems like a wrong assumption?
+ yoffset += parentPhysicalSize.Height() - reflowInput.ComputedHeight();
}
xoffset += reflowInput.ComputedPhysicalMargin().left;
@@ -195,38 +207,11 @@ nsresult nsProgressFrame::AttributeChanged(int32_t aNameSpaceID,
return nsContainerFrame::AttributeChanged(aNameSpaceID, aAttribute, aModType);
}
-LogicalSize nsProgressFrame::ComputeAutoSize(
- gfxContext* aRenderingContext, WritingMode aWM, const LogicalSize& aCBSize,
- nscoord aAvailableISize, const LogicalSize& aMargin,
- const LogicalSize& aBorderPadding, const StyleSizeOverrides& aSizeOverrides,
- ComputeSizeFlags aFlags) {
- const WritingMode wm = GetWritingMode();
- LogicalSize autoSize(wm);
- autoSize.BSize(wm) = autoSize.ISize(wm) =
- StyleFont()
- ->mFont.size.ScaledBy(nsLayoutUtils::FontSizeInflationFor(this))
- .ToAppUnits(); // 1em
-
- if (ResolvedOrientationIsVertical() == wm.IsVertical()) {
- autoSize.ISize(wm) *= 10; // 10em
- } else {
- autoSize.BSize(wm) *= 10; // 10em
- }
-
- return autoSize.ConvertTo(aWM, wm);
-}
-
nscoord nsProgressFrame::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 *= 10; // 10em
+ minISize *= 10;
}
-
return minISize;
}
diff --git a/layout/forms/nsProgressFrame.h b/layout/forms/nsProgressFrame.h
index 7d3618ee96..f8917ba4f2 100644
--- a/layout/forms/nsProgressFrame.h
+++ b/layout/forms/nsProgressFrame.h
@@ -18,8 +18,7 @@ enum class PseudoStyleType : uint8_t;
class nsProgressFrame final : public nsContainerFrame,
public nsIAnonymousContentCreator {
- typedef mozilla::PseudoStyleType PseudoStyleType;
- typedef mozilla::dom::Element Element;
+ using Element = mozilla::dom::Element;
public:
NS_DECL_QUERYFRAME
@@ -30,38 +29,28 @@ class nsProgressFrame final : public nsContainerFrame,
void Destroy(DestroyContext&) override;
- virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
- const nsDisplayListSet& aLists) override;
+ void BuildDisplayList(nsDisplayListBuilder* aBuilder,
+ const nsDisplayListSet& aLists) override;
- virtual void Reflow(nsPresContext* aCX, ReflowOutput& aDesiredSize,
- const ReflowInput& aReflowInput,
- nsReflowStatus& aStatus) override;
+ void Reflow(nsPresContext*, ReflowOutput&, const ReflowInput&,
+ nsReflowStatus&) override;
#ifdef DEBUG_FRAME_DUMP
- virtual nsresult GetFrameName(nsAString& aResult) const override {
+ nsresult GetFrameName(nsAString& aResult) const override {
return MakeFrameName(u"Progress"_ns, aResult);
}
#endif
// nsIAnonymousContentCreator
- virtual nsresult CreateAnonymousContent(
- nsTArray<ContentInfo>& aElements) override;
- virtual void AppendAnonymousContentTo(nsTArray<nsIContent*>& aElements,
- uint32_t aFilter) override;
+ nsresult CreateAnonymousContent(nsTArray<ContentInfo>& aElements) override;
+ void AppendAnonymousContentTo(nsTArray<nsIContent*>& aElements,
+ uint32_t aFilter) override;
- virtual nsresult AttributeChanged(int32_t aNameSpaceID, nsAtom* aAttribute,
- int32_t aModType) override;
+ nsresult AttributeChanged(int32_t aNameSpaceID, nsAtom* aAttribute,
+ int32_t aModType) override;
- virtual mozilla::LogicalSize ComputeAutoSize(
- gfxContext* aRenderingContext, mozilla::WritingMode aWM,
- const mozilla::LogicalSize& aCBSize, nscoord aAvailableISize,
- const mozilla::LogicalSize& aMargin,
- const mozilla::LogicalSize& aBorderPadding,
- const mozilla::StyleSizeOverrides& aSizeOverrides,
- mozilla::ComputeSizeFlags aFlags) override;
-
- virtual nscoord GetMinISize(gfxContext* aRenderingContext) override;
- virtual nscoord GetPrefISize(gfxContext* aRenderingContext) override;
+ nscoord GetMinISize(gfxContext* aRenderingContext) override;
+ nscoord GetPrefISize(gfxContext* aRenderingContext) override;
/**
* Returns whether the frame and its child should use the native style.
@@ -72,6 +61,7 @@ class nsProgressFrame final : public nsContainerFrame,
// Helper function to reflow a child frame.
void ReflowChildFrame(nsIFrame* aChild, nsPresContext* aPresContext,
const ReflowInput& aReflowInput,
+ const mozilla::LogicalSize& aParentContentBoxSize,
nsReflowStatus& aStatus);
/**
diff --git a/layout/forms/nsRangeFrame.cpp b/layout/forms/nsRangeFrame.cpp
index 2cccff715a..3238d0372f 100644
--- a/layout/forms/nsRangeFrame.cpp
+++ b/layout/forms/nsRangeFrame.cpp
@@ -155,7 +155,6 @@ void nsRangeFrame::Reflow(nsPresContext* aPresContext,
nsReflowStatus& aStatus) {
MarkInReflow();
DO_GLOBAL_REFLOW_COUNT("nsRangeFrame");
- DISPLAY_REFLOW(aPresContext, this, aReflowInput, aDesiredSize, aStatus);
MOZ_ASSERT(aStatus.IsEmpty(), "Caller should pass a fresh reflow status!");
NS_ASSERTION(mTrackDiv, "::-moz-range-track div must exist!");
@@ -166,35 +165,17 @@ void nsRangeFrame::Reflow(nsPresContext* aPresContext,
"need to call RegUnregAccessKey only for the first.");
WritingMode wm = aReflowInput.GetWritingMode();
- nscoord computedBSize = aReflowInput.ComputedBSize();
- if (computedBSize == NS_UNCONSTRAINEDSIZE) {
- computedBSize = 0;
- }
- const auto borderPadding = aReflowInput.ComputedLogicalBorderPadding(wm);
- LogicalSize finalSize(
- wm, aReflowInput.ComputedISize() + borderPadding.IStartEnd(wm),
- computedBSize + borderPadding.BStartEnd(wm));
- aDesiredSize.SetSize(wm, finalSize);
-
- ReflowAnonymousContent(aPresContext, aDesiredSize, aReflowInput);
-
+ const auto contentBoxSize = aReflowInput.ComputedSizeWithBSizeFallback([&] {
+ return IsInlineOriented() ? AutoCrossSize()
+ : OneEmInAppUnits() * MAIN_AXIS_EM_SIZE;
+ });
+ aDesiredSize.SetSize(
+ wm,
+ contentBoxSize + aReflowInput.ComputedLogicalBorderPadding(wm).Size(wm));
aDesiredSize.SetOverflowAreasToDesiredBounds();
- nsIFrame* trackFrame = mTrackDiv->GetPrimaryFrame();
- if (trackFrame) {
- ConsiderChildOverflow(aDesiredSize.mOverflowAreas, trackFrame);
- }
-
- nsIFrame* rangeProgressFrame = mProgressDiv->GetPrimaryFrame();
- if (rangeProgressFrame) {
- ConsiderChildOverflow(aDesiredSize.mOverflowAreas, rangeProgressFrame);
- }
-
- nsIFrame* thumbFrame = mThumbDiv->GetPrimaryFrame();
- if (thumbFrame) {
- ConsiderChildOverflow(aDesiredSize.mOverflowAreas, thumbFrame);
- }
-
+ ReflowAnonymousContent(aPresContext, aDesiredSize, contentBoxSize,
+ aReflowInput);
FinishAndStoreOverflow(&aDesiredSize);
MOZ_ASSERT(aStatus.IsEmpty(), "This type of frame can't be split.");
@@ -202,111 +183,71 @@ void nsRangeFrame::Reflow(nsPresContext* aPresContext,
void nsRangeFrame::ReflowAnonymousContent(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
+ const LogicalSize& aContentBoxSize,
const ReflowInput& aReflowInput) {
+ const auto parentWM = aReflowInput.GetWritingMode();
// The width/height of our content box, which is the available width/height
- // for our anonymous content:
- nscoord rangeFrameContentBoxWidth = aReflowInput.ComputedWidth();
- nscoord rangeFrameContentBoxHeight = aReflowInput.ComputedHeight();
- if (rangeFrameContentBoxHeight == NS_UNCONSTRAINEDSIZE) {
- rangeFrameContentBoxHeight = 0;
- }
-
- nsIFrame* trackFrame = mTrackDiv->GetPrimaryFrame();
-
- if (trackFrame) { // display:none?
-
- // Position the track:
- // The idea here is that we allow content authors to style the width,
- // height, border and padding of the track, but we ignore margin and
- // positioning properties and do the positioning ourself to keep the center
- // of the track's border box on the center of the nsRangeFrame's content
- // box.
-
- WritingMode wm = trackFrame->GetWritingMode();
- LogicalSize availSize = aReflowInput.ComputedSize(wm);
- availSize.BSize(wm) = NS_UNCONSTRAINEDSIZE;
- ReflowInput trackReflowInput(aPresContext, aReflowInput, trackFrame,
- availSize);
-
- // Find the x/y position of the track frame such that it will be positioned
- // as described above. These coordinates are with respect to the
- // nsRangeFrame's border-box.
- nscoord trackX = rangeFrameContentBoxWidth / 2;
- nscoord trackY = rangeFrameContentBoxHeight / 2;
-
- // Account for the track's border and padding (we ignore its margin):
- trackX -= trackReflowInput.ComputedPhysicalBorderPadding().left +
- trackReflowInput.ComputedWidth() / 2;
- trackY -= trackReflowInput.ComputedPhysicalBorderPadding().top +
- trackReflowInput.ComputedHeight() / 2;
-
- // Make relative to our border box instead of our content box:
- trackX += aReflowInput.ComputedPhysicalBorderPadding().left;
- trackY += aReflowInput.ComputedPhysicalBorderPadding().top;
-
- nsReflowStatus frameStatus;
- ReflowOutput trackDesiredSize(aReflowInput);
- ReflowChild(trackFrame, aPresContext, trackDesiredSize, trackReflowInput,
- trackX, trackY, ReflowChildFlags::Default, frameStatus);
- MOZ_ASSERT(
- frameStatus.IsFullyComplete(),
- "We gave our child unconstrained height, so it should be complete");
- FinishReflowChild(trackFrame, aPresContext, trackDesiredSize,
- &trackReflowInput, trackX, trackY,
- ReflowChildFlags::Default);
- }
-
- nsIFrame* thumbFrame = mThumbDiv->GetPrimaryFrame();
-
- if (thumbFrame) { // display:none?
- WritingMode wm = thumbFrame->GetWritingMode();
- LogicalSize availSize = aReflowInput.ComputedSize(wm);
- availSize.BSize(wm) = NS_UNCONSTRAINEDSIZE;
- ReflowInput thumbReflowInput(aPresContext, aReflowInput, thumbFrame,
- availSize);
-
- // Where we position the thumb depends on its size, so we first reflow
- // the thumb at {0,0} to obtain its size, then position it afterwards.
-
- nsReflowStatus frameStatus;
- ReflowOutput thumbDesiredSize(aReflowInput);
- ReflowChild(thumbFrame, aPresContext, thumbDesiredSize, thumbReflowInput, 0,
- 0, ReflowChildFlags::Default, frameStatus);
- MOZ_ASSERT(
- frameStatus.IsFullyComplete(),
- "We gave our child unconstrained height, so it should be complete");
- FinishReflowChild(thumbFrame, aPresContext, thumbDesiredSize,
- &thumbReflowInput, 0, 0, ReflowChildFlags::Default);
- DoUpdateThumbPosition(thumbFrame,
- nsSize(aDesiredSize.Width(), aDesiredSize.Height()));
- }
-
- nsIFrame* rangeProgressFrame = mProgressDiv->GetPrimaryFrame();
-
- if (rangeProgressFrame) { // display:none?
- WritingMode wm = rangeProgressFrame->GetWritingMode();
- LogicalSize availSize = aReflowInput.ComputedSize(wm);
+ // for our anonymous content.
+ const nsSize rangeFrameContentBoxSize =
+ aContentBoxSize.GetPhysicalSize(parentWM);
+ for (auto* div : {mTrackDiv.get(), mThumbDiv.get(), mProgressDiv.get()}) {
+ nsIFrame* child = div->GetPrimaryFrame();
+ if (!child) {
+ continue;
+ }
+ const WritingMode wm = child->GetWritingMode();
+ const LogicalSize parentSizeInChildWM =
+ aContentBoxSize.ConvertTo(wm, parentWM);
+ LogicalSize availSize = parentSizeInChildWM;
availSize.BSize(wm) = NS_UNCONSTRAINEDSIZE;
- ReflowInput progressReflowInput(aPresContext, aReflowInput,
- rangeProgressFrame, availSize);
-
- // We first reflow the range-progress frame at {0,0} to obtain its
- // unadjusted dimensions, then we adjust it to so that the appropriate edge
- // ends at the thumb.
+ ReflowInput childReflowInput(aPresContext, aReflowInput, child, availSize,
+ Some(parentSizeInChildWM));
+
+ const nsPoint pos = [&] {
+ if (div != mTrackDiv) {
+ // Where we position the thumb and range-progress depends on its size,
+ // so we first reflow them at {0,0} to obtain the size, then position
+ // them afterwards.
+ return nsPoint();
+ }
+ // Find the x/y position of the track. The idea here is that we allow
+ // content authors to style the width, height, border and padding of the
+ // track, but we ignore margin and positioning properties and do the
+ // positioning ourself to keep the center of the track's border box on the
+ // center of the nsRangeFrame's content. These coordinates are with
+ // respect to the nsRangeFrame's border-box.
+ nscoord trackX = rangeFrameContentBoxSize.Width() / 2;
+ nscoord trackY = rangeFrameContentBoxSize.Height() / 2;
+
+ // Account for the track's border and padding (we ignore its margin):
+ // FIXME(emilio): Assumes the track height is constrained, which might not
+ // be true if authors override it.
+ trackX -= childReflowInput.ComputedPhysicalBorderPadding().left +
+ childReflowInput.ComputedWidth() / 2;
+ trackY -= childReflowInput.ComputedPhysicalBorderPadding().top +
+ childReflowInput.ComputedHeight() / 2;
+
+ // Make relative to our border box instead of our content box:
+ trackX += aReflowInput.ComputedPhysicalBorderPadding().left;
+ trackY += aReflowInput.ComputedPhysicalBorderPadding().top;
+ return nsPoint(trackX, trackY);
+ }();
nsReflowStatus frameStatus;
- ReflowOutput progressDesiredSize(aReflowInput);
- ReflowChild(rangeProgressFrame, aPresContext, progressDesiredSize,
- progressReflowInput, 0, 0, ReflowChildFlags::Default,
- frameStatus);
+ ReflowOutput childDesiredSize(aReflowInput);
+ ReflowChild(child, aPresContext, childDesiredSize, childReflowInput, pos.x,
+ pos.y, ReflowChildFlags::Default, frameStatus);
MOZ_ASSERT(
frameStatus.IsFullyComplete(),
"We gave our child unconstrained height, so it should be complete");
- FinishReflowChild(rangeProgressFrame, aPresContext, progressDesiredSize,
- &progressReflowInput, 0, 0, ReflowChildFlags::Default);
- DoUpdateRangeProgressFrame(
- rangeProgressFrame,
- nsSize(aDesiredSize.Width(), aDesiredSize.Height()));
+ FinishReflowChild(child, aPresContext, childDesiredSize, &childReflowInput,
+ pos.x, pos.y, ReflowChildFlags::Default);
+ if (div == mThumbDiv) {
+ DoUpdateThumbPosition(child, rangeFrameContentBoxSize);
+ } else if (div == mProgressDiv) {
+ DoUpdateRangeProgressFrame(child, rangeFrameContentBoxSize);
+ }
+ ConsiderChildOverflow(aDesiredSize.mOverflowAreas, child);
}
}
@@ -388,7 +329,7 @@ Decimal nsRangeFrame::GetValueAtEventPoint(WidgetGUIEvent* aEvent) {
->GetValueAsDecimal();
}
- nsRect rangeContentRect = GetContentRectRelativeToSelf();
+ const nsRect rangeContentRect = GetContentRectRelativeToSelf();
nsSize thumbSize;
if (IsThemed()) {
@@ -455,11 +396,12 @@ void nsRangeFrame::UpdateForValueChange() {
if (!rangeProgressFrame && !thumbFrame) {
return; // diplay:none?
}
+ const nsSize contentBoxSize = GetContentRect().Size();
if (rangeProgressFrame) {
- DoUpdateRangeProgressFrame(rangeProgressFrame, GetSize());
+ DoUpdateRangeProgressFrame(rangeProgressFrame, contentBoxSize);
}
if (thumbFrame) {
- DoUpdateThumbPosition(thumbFrame, GetSize());
+ DoUpdateThumbPosition(thumbFrame, contentBoxSize);
}
if (IsThemed()) {
// We don't know the exact dimensions or location of the thumb when native
@@ -539,7 +481,7 @@ mozilla::dom::HTMLInputElement& nsRangeFrame::InputElement() const {
}
void nsRangeFrame::DoUpdateThumbPosition(nsIFrame* aThumbFrame,
- const nsSize& aRangeSize) {
+ const nsSize& aRangeContentBoxSize) {
MOZ_ASSERT(aThumbFrame);
// The idea here is that we want to position the thumb so that the center
@@ -553,29 +495,26 @@ void nsRangeFrame::DoUpdateThumbPosition(nsIFrame* aThumbFrame,
nsMargin borderAndPadding = GetUsedBorderAndPadding();
nsPoint newPosition(borderAndPadding.left, borderAndPadding.top);
- nsSize rangeContentBoxSize(aRangeSize);
- rangeContentBoxSize.width -= borderAndPadding.LeftRight();
- rangeContentBoxSize.height -= borderAndPadding.TopBottom();
-
nsSize thumbSize = aThumbFrame->GetSize();
double fraction = GetValueAsFractionOfRange();
MOZ_ASSERT(fraction >= 0.0 && fraction <= 1.0);
if (IsHorizontal()) {
- if (thumbSize.width < rangeContentBoxSize.width) {
- nscoord traversableDistance = rangeContentBoxSize.width - thumbSize.width;
+ if (thumbSize.width < aRangeContentBoxSize.width) {
+ nscoord traversableDistance =
+ aRangeContentBoxSize.width - thumbSize.width;
if (IsRightToLeft()) {
newPosition.x += NSToCoordRound((1.0 - fraction) * traversableDistance);
} else {
newPosition.x += NSToCoordRound(fraction * traversableDistance);
}
- newPosition.y += (rangeContentBoxSize.height - thumbSize.height) / 2;
+ newPosition.y += (aRangeContentBoxSize.height - thumbSize.height) / 2;
}
} else {
- if (thumbSize.height < rangeContentBoxSize.height) {
+ if (thumbSize.height < aRangeContentBoxSize.height) {
nscoord traversableDistance =
- rangeContentBoxSize.height - thumbSize.height;
- newPosition.x += (rangeContentBoxSize.width - thumbSize.width) / 2;
+ aRangeContentBoxSize.height - thumbSize.height;
+ newPosition.x += (aRangeContentBoxSize.width - thumbSize.width) / 2;
if (IsUpwards()) {
newPosition.y += NSToCoordRound((1.0 - fraction) * traversableDistance);
} else {
@@ -586,9 +525,9 @@ void nsRangeFrame::DoUpdateThumbPosition(nsIFrame* aThumbFrame,
aThumbFrame->SetPosition(newPosition);
}
-void nsRangeFrame::DoUpdateRangeProgressFrame(nsIFrame* aRangeProgressFrame,
- const nsSize& aRangeSize) {
- MOZ_ASSERT(aRangeProgressFrame);
+void nsRangeFrame::DoUpdateRangeProgressFrame(
+ nsIFrame* aProgressFrame, const nsSize& aRangeContentBoxSize) {
+ MOZ_ASSERT(aProgressFrame);
// The idea here is that we want to position the ::-moz-range-progress
// pseudo-element so that the center line running along its length is on the
@@ -598,35 +537,30 @@ void nsRangeFrame::DoUpdateRangeProgressFrame(nsIFrame* aRangeProgressFrame,
// nsRangeFrame's content box, and we size the progress element's border-box
// to have a length of GetValueAsFractionOfRange() times the nsRangeFrame's
// content-box size.
-
nsMargin borderAndPadding = GetUsedBorderAndPadding();
- nsSize progSize = aRangeProgressFrame->GetSize();
+ nsSize progSize = aProgressFrame->GetSize();
nsRect progRect(borderAndPadding.left, borderAndPadding.top, progSize.width,
progSize.height);
- nsSize rangeContentBoxSize(aRangeSize);
- rangeContentBoxSize.width -= borderAndPadding.LeftRight();
- rangeContentBoxSize.height -= borderAndPadding.TopBottom();
-
double fraction = GetValueAsFractionOfRange();
MOZ_ASSERT(fraction >= 0.0 && fraction <= 1.0);
if (IsHorizontal()) {
- nscoord progLength = NSToCoordRound(fraction * rangeContentBoxSize.width);
+ nscoord progLength = NSToCoordRound(fraction * aRangeContentBoxSize.width);
if (IsRightToLeft()) {
- progRect.x += rangeContentBoxSize.width - progLength;
+ progRect.x += aRangeContentBoxSize.width - progLength;
}
- progRect.y += (rangeContentBoxSize.height - progSize.height) / 2;
+ progRect.y += (aRangeContentBoxSize.height - progSize.height) / 2;
progRect.width = progLength;
} else {
- nscoord progLength = NSToCoordRound(fraction * rangeContentBoxSize.height);
- progRect.x += (rangeContentBoxSize.width - progSize.width) / 2;
+ nscoord progLength = NSToCoordRound(fraction * aRangeContentBoxSize.height);
+ progRect.x += (aRangeContentBoxSize.width - progSize.width) / 2;
if (IsUpwards()) {
- progRect.y += rangeContentBoxSize.height - progLength;
+ progRect.y += aRangeContentBoxSize.height - progLength;
}
progRect.height = progLength;
}
- aRangeProgressFrame->SetRect(progRect);
+ aProgressFrame->SetRect(progRect);
}
nsresult nsRangeFrame::AttributeChanged(int32_t aNameSpaceID,
@@ -677,7 +611,7 @@ nsresult nsRangeFrame::AttributeChanged(int32_t aNameSpaceID,
return nsContainerFrame::AttributeChanged(aNameSpaceID, aAttribute, aModType);
}
-nscoord nsRangeFrame::AutoCrossSize(Length aEm) {
+nscoord nsRangeFrame::AutoCrossSize() {
nscoord minCrossSize(0);
if (IsThemed()) {
nsPresContext* pc = PresContext();
@@ -686,33 +620,8 @@ nscoord nsRangeFrame::AutoCrossSize(Length aEm) {
minCrossSize =
pc->DevPixelsToAppUnits(IsHorizontal() ? size.height : size.width);
}
- return std::max(minCrossSize, aEm.ScaledBy(CROSS_AXIS_EM_SIZE).ToAppUnits());
-}
-
-static mozilla::Length OneEm(nsRangeFrame* aFrame) {
- return aFrame->StyleFont()->mFont.size.ScaledBy(
- nsLayoutUtils::FontSizeInflationFor(aFrame));
-}
-
-LogicalSize nsRangeFrame::ComputeAutoSize(
- gfxContext* aRenderingContext, WritingMode aWM, const LogicalSize& aCBSize,
- nscoord aAvailableISize, const LogicalSize& aMargin,
- const LogicalSize& aBorderPadding, const StyleSizeOverrides& aSizeOverrides,
- ComputeSizeFlags aFlags) {
- bool isInlineOriented = IsInlineOriented();
- auto em = OneEm(this);
-
- const WritingMode wm = GetWritingMode();
- LogicalSize autoSize(wm);
- if (isInlineOriented) {
- autoSize.ISize(wm) = em.ScaledBy(MAIN_AXIS_EM_SIZE).ToAppUnits();
- autoSize.BSize(wm) = AutoCrossSize(em);
- } else {
- autoSize.ISize(wm) = AutoCrossSize(em);
- autoSize.BSize(wm) = em.ScaledBy(MAIN_AXIS_EM_SIZE).ToAppUnits();
- }
-
- return autoSize.ConvertTo(aWM, wm);
+ return std::max(minCrossSize,
+ NSToCoordRound(OneEmInAppUnits() * CROSS_AXIS_EM_SIZE));
}
nscoord nsRangeFrame::GetMinISize(gfxContext* aRenderingContext) {
@@ -728,11 +637,10 @@ nscoord nsRangeFrame::GetMinISize(gfxContext* aRenderingContext) {
}
nscoord nsRangeFrame::GetPrefISize(gfxContext* aRenderingContext) {
- auto em = OneEm(this);
if (IsInlineOriented()) {
- return em.ScaledBy(MAIN_AXIS_EM_SIZE).ToAppUnits();
+ return OneEmInAppUnits() * MAIN_AXIS_EM_SIZE;
}
- return AutoCrossSize(em);
+ return AutoCrossSize();
}
bool nsRangeFrame::IsHorizontal() const {
diff --git a/layout/forms/nsRangeFrame.h b/layout/forms/nsRangeFrame.h
index 4d2073aa50..10d0fc0095 100644
--- a/layout/forms/nsRangeFrame.h
+++ b/layout/forms/nsRangeFrame.h
@@ -7,12 +7,10 @@
#ifndef nsRangeFrame_h___
#define nsRangeFrame_h___
-#include "mozilla/Attributes.h"
#include "mozilla/Decimal.h"
#include "mozilla/EventForwards.h"
#include "nsContainerFrame.h"
#include "nsIAnonymousContentCreator.h"
-#include "nsIDOMEventListener.h"
#include "nsCOMPtr.h"
#include "nsTArray.h"
@@ -40,8 +38,7 @@ class nsRangeFrame final : public nsContainerFrame,
explicit nsRangeFrame(ComputedStyle* aStyle, nsPresContext* aPresContext);
virtual ~nsRangeFrame();
- typedef mozilla::PseudoStyleType PseudoStyleType;
- typedef mozilla::dom::Element Element;
+ using Element = mozilla::dom::Element;
public:
NS_DECL_QUERYFRAME
@@ -53,39 +50,30 @@ class nsRangeFrame final : public nsContainerFrame,
void BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsDisplayListSet& aLists) override;
- virtual void Reflow(nsPresContext* aPresContext, ReflowOutput& aDesiredSize,
- const ReflowInput& aReflowInput,
- nsReflowStatus& aStatus) override;
+ void Reflow(nsPresContext* aPresContext, ReflowOutput& aDesiredSize,
+ const ReflowInput& aReflowInput,
+ nsReflowStatus& aStatus) override;
#ifdef DEBUG_FRAME_DUMP
- virtual nsresult GetFrameName(nsAString& aResult) const override {
+ nsresult GetFrameName(nsAString& aResult) const override {
return MakeFrameName(u"Range"_ns, aResult);
}
#endif
#ifdef ACCESSIBILITY
- virtual mozilla::a11y::AccType AccessibleType() override;
+ mozilla::a11y::AccType AccessibleType() override;
#endif
// nsIAnonymousContentCreator
- virtual nsresult CreateAnonymousContent(
- nsTArray<ContentInfo>& aElements) override;
- virtual void AppendAnonymousContentTo(nsTArray<nsIContent*>& aElements,
- uint32_t aFilter) override;
+ nsresult CreateAnonymousContent(nsTArray<ContentInfo>& aElements) override;
+ void AppendAnonymousContentTo(nsTArray<nsIContent*>& aElements,
+ uint32_t aFilter) override;
- virtual nsresult AttributeChanged(int32_t aNameSpaceID, nsAtom* aAttribute,
- int32_t aModType) override;
+ nsresult AttributeChanged(int32_t aNameSpaceID, nsAtom* aAttribute,
+ int32_t aModType) override;
- mozilla::LogicalSize ComputeAutoSize(
- gfxContext* aRenderingContext, mozilla::WritingMode aWM,
- const mozilla::LogicalSize& aCBSize, nscoord aAvailableISize,
- const mozilla::LogicalSize& aMargin,
- const mozilla::LogicalSize& aBorderPadding,
- const mozilla::StyleSizeOverrides& aSizeOverrides,
- mozilla::ComputeSizeFlags aFlags) override;
-
- virtual nscoord GetMinISize(gfxContext* aRenderingContext) override;
- virtual nscoord GetPrefISize(gfxContext* aRenderingContext) override;
+ nscoord GetMinISize(gfxContext* aRenderingContext) override;
+ nscoord GetPrefISize(gfxContext* aRenderingContext) override;
/**
* Returns true if the slider's thumb moves horizontally, or else false if it
@@ -171,17 +159,19 @@ class nsRangeFrame final : public nsContainerFrame,
private:
// Return our preferred size in the cross-axis (the axis perpendicular
// to the direction of movement of the thumb).
- nscoord AutoCrossSize(mozilla::Length aEm);
+ nscoord AutoCrossSize();
// Helper function which reflows the anonymous div frames.
void ReflowAnonymousContent(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
+ const mozilla::LogicalSize& aContentBoxSize,
const ReflowInput& aReflowInput);
- void DoUpdateThumbPosition(nsIFrame* aThumbFrame, const nsSize& aRangeSize);
+ void DoUpdateThumbPosition(nsIFrame* aThumbFrame,
+ const nsSize& aRangeContentBoxSize);
void DoUpdateRangeProgressFrame(nsIFrame* aProgressFrame,
- const nsSize& aRangeSize);
+ const nsSize& aRangeContentBoxSize);
/**
* The div used to show the ::-moz-range-track pseudo-element.
diff --git a/layout/forms/nsTextControlFrame.cpp b/layout/forms/nsTextControlFrame.cpp
index c51b94c56a..32e817be8a 100644
--- a/layout/forms/nsTextControlFrame.cpp
+++ b/layout/forms/nsTextControlFrame.cpp
@@ -173,15 +173,14 @@ void nsTextControlFrame::Destroy(DestroyContext& aContext) {
nsContainerFrame::Destroy(aContext);
}
-LogicalSize nsTextControlFrame::CalcIntrinsicSize(
- gfxContext* aRenderingContext, WritingMode aWM,
- float aFontSizeInflation) const {
+LogicalSize nsTextControlFrame::CalcIntrinsicSize(gfxContext* aRenderingContext,
+ WritingMode aWM) const {
LogicalSize intrinsicSize(aWM);
+ const float inflation = nsLayoutUtils::FontSizeInflationFor(this);
RefPtr<nsFontMetrics> fontMet =
- nsLayoutUtils::GetFontMetricsForFrame(this, aFontSizeInflation);
- const nscoord lineHeight =
- ReflowInput::CalcLineHeight(*Style(), PresContext(), GetContent(),
- NS_UNCONSTRAINEDSIZE, aFontSizeInflation);
+ nsLayoutUtils::GetFontMetricsForFrame(this, inflation);
+ const nscoord lineHeight = ReflowInput::CalcLineHeight(
+ *Style(), PresContext(), GetContent(), NS_UNCONSTRAINEDSIZE, inflation);
// Use the larger of the font's "average" char width or the width of the
// zero glyph (if present) as the basis for resolving the size attribute.
const nscoord charWidth =
@@ -554,58 +553,14 @@ void nsTextControlFrame::AppendAnonymousContentTo(
}
nscoord nsTextControlFrame::GetPrefISize(gfxContext* aRenderingContext) {
- nscoord result = 0;
- DISPLAY_PREF_INLINE_SIZE(this, result);
- float inflation = nsLayoutUtils::FontSizeInflationFor(this);
WritingMode wm = GetWritingMode();
- result = CalcIntrinsicSize(aRenderingContext, wm, inflation).ISize(wm);
- return result;
+ return CalcIntrinsicSize(aRenderingContext, wm).ISize(wm);
}
nscoord nsTextControlFrame::GetMinISize(gfxContext* aRenderingContext) {
- // Our min inline size is just our preferred width if we have auto inline size
- nscoord result;
- DISPLAY_MIN_INLINE_SIZE(this, result);
- result = GetPrefISize(aRenderingContext);
- return result;
-}
-
-LogicalSize nsTextControlFrame::ComputeAutoSize(
- gfxContext* aRenderingContext, WritingMode aWM, const LogicalSize& aCBSize,
- nscoord aAvailableISize, const LogicalSize& aMargin,
- const LogicalSize& aBorderPadding, const StyleSizeOverrides& aSizeOverrides,
- ComputeSizeFlags aFlags) {
- float inflation = nsLayoutUtils::FontSizeInflationFor(this);
- LogicalSize autoSize = CalcIntrinsicSize(aRenderingContext, aWM, inflation);
-
- // Note: nsContainerFrame::ComputeAutoSize only computes the inline-size (and
- // only for 'auto'), the block-size it returns is always NS_UNCONSTRAINEDSIZE.
- const auto& styleISize = aSizeOverrides.mStyleISize
- ? *aSizeOverrides.mStyleISize
- : StylePosition()->ISize(aWM);
- if (styleISize.IsAuto()) {
- if (aFlags.contains(ComputeSizeFlag::IClampMarginBoxMinSize)) {
- // CalcIntrinsicSize isn't aware of grid-item margin-box clamping, so we
- // fall back to nsContainerFrame's ComputeAutoSize to handle that.
- // XXX maybe a font-inflation issue here? (per the assertion below).
- autoSize.ISize(aWM) =
- nsContainerFrame::ComputeAutoSize(
- aRenderingContext, aWM, aCBSize, aAvailableISize, aMargin,
- aBorderPadding, aSizeOverrides, aFlags)
- .ISize(aWM);
- }
-#ifdef DEBUG
- else {
- LogicalSize ancestorAutoSize = nsContainerFrame::ComputeAutoSize(
- aRenderingContext, aWM, aCBSize, aAvailableISize, aMargin,
- aBorderPadding, aSizeOverrides, aFlags);
- MOZ_ASSERT(inflation != 1.0f ||
- ancestorAutoSize.ISize(aWM) == autoSize.ISize(aWM),
- "Incorrect size computed by ComputeAutoSize?");
- }
-#endif
- }
- return autoSize;
+ // Our min inline size is just our preferred inline-size if we have auto
+ // inline size.
+ return GetPrefISize(aRenderingContext);
}
Maybe<nscoord> nsTextControlFrame::ComputeBaseline(
@@ -641,12 +596,16 @@ void nsTextControlFrame::Reflow(nsPresContext* aPresContext,
nsReflowStatus& aStatus) {
MarkInReflow();
DO_GLOBAL_REFLOW_COUNT("nsTextControlFrame");
- DISPLAY_REFLOW(aPresContext, this, aReflowInput, aDesiredSize, aStatus);
MOZ_ASSERT(aStatus.IsEmpty(), "Caller should pass a fresh reflow status!");
// set values of reflow's out parameters
WritingMode wm = aReflowInput.GetWritingMode();
- aDesiredSize.SetSize(wm, aReflowInput.ComputedSizeWithBorderPadding(wm));
+ const auto contentBoxSize = aReflowInput.ComputedSizeWithBSizeFallback([&] {
+ return CalcIntrinsicSize(aReflowInput.mRenderingContext, wm).BSize(wm);
+ });
+ aDesiredSize.SetSize(
+ wm,
+ contentBoxSize + aReflowInput.ComputedLogicalBorderPadding(wm).Size(wm));
{
// Calculate the baseline and store it in mFirstBaseline.
@@ -674,7 +633,7 @@ void nsTextControlFrame::Reflow(nsPresContext* aPresContext,
nscoord buttonBoxISize = 0;
if (buttonBox) {
ReflowTextControlChild(buttonBox, aPresContext, aReflowInput, aStatus,
- aDesiredSize, buttonBoxISize);
+ aDesiredSize, contentBoxSize, buttonBoxISize);
}
// perform reflow on all kids
@@ -684,7 +643,7 @@ void nsTextControlFrame::Reflow(nsPresContext* aPresContext,
MOZ_ASSERT(!IsButtonBox(kid),
"Should only have one button box, and should be last");
ReflowTextControlChild(kid, aPresContext, aReflowInput, aStatus,
- aDesiredSize, buttonBoxISize);
+ aDesiredSize, contentBoxSize, buttonBoxISize);
}
kid = kid->GetNextSibling();
}
@@ -698,22 +657,28 @@ void nsTextControlFrame::Reflow(nsPresContext* aPresContext,
void nsTextControlFrame::ReflowTextControlChild(
nsIFrame* aKid, nsPresContext* aPresContext,
const ReflowInput& aReflowInput, nsReflowStatus& aStatus,
- ReflowOutput& aParentDesiredSize, nscoord& aButtonBoxISize) {
+ ReflowOutput& aParentDesiredSize, const LogicalSize& aParentContentBoxSize,
+ nscoord& aButtonBoxISize) {
const WritingMode outerWM = aReflowInput.GetWritingMode();
// compute available size and frame offsets for child
const WritingMode wm = aKid->GetWritingMode();
- LogicalSize availSize = aReflowInput.ComputedSizeWithPadding(wm);
+ const auto parentPadding = aReflowInput.ComputedLogicalPadding(wm);
+ const LogicalSize contentBoxSize =
+ aParentContentBoxSize.ConvertTo(wm, outerWM);
+ const LogicalSize paddingBoxSize = contentBoxSize + parentPadding.Size(wm);
+ const LogicalSize borderBoxSize =
+ paddingBoxSize + aReflowInput.ComputedLogicalBorder(wm).Size(wm);
+ LogicalSize availSize = paddingBoxSize;
availSize.BSize(wm) = NS_UNCONSTRAINEDSIZE;
- bool isButtonBox = IsButtonBox(aKid);
+ const bool isButtonBox = IsButtonBox(aKid);
ReflowInput kidReflowInput(aPresContext, aReflowInput, aKid, availSize,
Nothing(), ReflowInput::InitFlag::CallerWillInit);
// Override padding with our computed padding in case we got it from theming
// or percentage, if we're not the button box.
- auto overridePadding =
- isButtonBox ? Nothing() : Some(aReflowInput.ComputedLogicalPadding(wm));
+ auto overridePadding = isButtonBox ? Nothing() : Some(parentPadding);
if (!isButtonBox && aButtonBoxISize) {
// Button box respects inline-end-padding, so we don't need to.
overridePadding->IEnd(outerWM) = 0;
@@ -722,8 +687,7 @@ void nsTextControlFrame::ReflowTextControlChild(
// We want to let our button box fill the frame in the block axis, up to the
// edge of the control's border. So, we use the control's padding-box as the
// containing block size for our button box.
- auto overrideCBSize =
- isButtonBox ? Some(aReflowInput.ComputedSizeWithPadding(wm)) : Nothing();
+ auto overrideCBSize = isButtonBox ? Some(paddingBoxSize) : Nothing();
kidReflowInput.Init(aPresContext, overrideCBSize, Nothing(), overridePadding);
LogicalPoint position(wm);
@@ -746,14 +710,12 @@ void nsTextControlFrame::ReflowTextControlChild(
// the only exception, which has an auto size).
kidReflowInput.SetComputedISize(
std::max(0, aReflowInput.ComputedISize() - aButtonBoxISize));
- kidReflowInput.SetComputedBSize(aReflowInput.ComputedBSize());
+ kidReflowInput.SetComputedBSize(contentBoxSize.BSize(wm));
}
// reflow the child
ReflowOutput desiredSize(aReflowInput);
- const nsSize containerSize =
- aReflowInput.ComputedSizeWithBorderPadding(outerWM).GetPhysicalSize(
- outerWM);
+ const nsSize containerSize = borderBoxSize.GetPhysicalSize(wm);
ReflowChild(aKid, aPresContext, desiredSize, kidReflowInput, wm, position,
containerSize, ReflowChildFlags::Default, aStatus);
@@ -767,7 +729,7 @@ void nsTextControlFrame::ReflowTextControlChild(
buttonRect.ISize(outerWM) = size.ISize(outerWM);
buttonRect.BStart(outerWM) =
bp.BStart(outerWM) +
- (aReflowInput.ComputedBSize() - size.BSize(outerWM)) / 2;
+ (aParentContentBoxSize.BSize(outerWM) - size.BSize(outerWM)) / 2;
// Align to the inline-end of the content box.
buttonRect.IStart(outerWM) =
bp.IStart(outerWM) + aReflowInput.ComputedISize() - size.ISize(outerWM);
diff --git a/layout/forms/nsTextControlFrame.h b/layout/forms/nsTextControlFrame.h
index 0d52e5849f..2eb6f18d15 100644
--- a/layout/forms/nsTextControlFrame.h
+++ b/layout/forms/nsTextControlFrame.h
@@ -63,14 +63,6 @@ class nsTextControlFrame : public nsContainerFrame,
nscoord GetMinISize(gfxContext* aRenderingContext) override;
nscoord GetPrefISize(gfxContext* aRenderingContext) override;
- mozilla::LogicalSize ComputeAutoSize(
- gfxContext* aRenderingContext, mozilla::WritingMode aWM,
- const mozilla::LogicalSize& aCBSize, nscoord aAvailableISize,
- const mozilla::LogicalSize& aMargin,
- const mozilla::LogicalSize& aBorderPadding,
- const mozilla::StyleSizeOverrides& aSizeOverrides,
- mozilla::ComputeSizeFlags aFlags) override;
-
void Reflow(nsPresContext* aPresContext, ReflowOutput& aDesiredSize,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
@@ -180,10 +172,11 @@ class nsTextControlFrame : public nsContainerFrame,
/**
* Launch the reflow on the child frames - see nsTextControlFrame::Reflow()
*/
- void ReflowTextControlChild(nsIFrame* aFrame, nsPresContext* aPresContext,
+ void ReflowTextControlChild(nsIFrame* aKid, nsPresContext* aPresContext,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus,
ReflowOutput& aParentDesiredSize,
+ const mozilla::LogicalSize& aParentContentBoxSize,
nscoord& aButtonBoxISize);
public:
@@ -278,8 +271,7 @@ class nsTextControlFrame : public nsContainerFrame,
// etc. Just the size of our actual area for the text (and the scrollbars,
// for <textarea>).
mozilla::LogicalSize CalcIntrinsicSize(gfxContext* aRenderingContext,
- mozilla::WritingMode aWM,
- float aFontSizeInflation) const;
+ mozilla::WritingMode aWM) const;
private:
// helper methods