summaryrefslogtreecommitdiffstats
path: root/layout/forms/nsTextControlFrame.cpp
diff options
context:
space:
mode:
authorjanekptacijarabaci <janekptacijarabaci@seznam.cz>2017-08-17 21:08:44 +0200
committerwolfbeast <mcwerewolf@gmail.com>2018-03-12 09:50:12 +0100
commit092c61f6e68971a62822532e12dc45ba54c9a713 (patch)
treeb3e1aa03886aded4e908c834caf69bba13b507e7 /layout/forms/nsTextControlFrame.cpp
parent76e1c016a32cb8cee6f5a0a0012fe512570da1eb (diff)
downloadUXP-092c61f6e68971a62822532e12dc45ba54c9a713.tar
UXP-092c61f6e68971a62822532e12dc45ba54c9a713.tar.gz
UXP-092c61f6e68971a62822532e12dc45ba54c9a713.tar.lz
UXP-092c61f6e68971a62822532e12dc45ba54c9a713.tar.xz
UXP-092c61f6e68971a62822532e12dc45ba54c9a713.zip
CSS: inline-block with a display:block <input> child element has a wrong baseline (HTML forms)
Diffstat (limited to 'layout/forms/nsTextControlFrame.cpp')
-rw-r--r--layout/forms/nsTextControlFrame.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/layout/forms/nsTextControlFrame.cpp b/layout/forms/nsTextControlFrame.cpp
index f85bc2a80..a7f7d40a8 100644
--- a/layout/forms/nsTextControlFrame.cpp
+++ b/layout/forms/nsTextControlFrame.cpp
@@ -106,6 +106,7 @@ private:
nsTextControlFrame::nsTextControlFrame(nsStyleContext* aContext)
: nsContainerFrame(aContext)
+ , mFirstBaseline(NS_INTRINSIC_WIDTH_UNKNOWN)
, mEditorHasBeenInitialized(false)
, mIsProcessing(false)
#ifdef DEBUG
@@ -538,20 +539,20 @@ nsTextControlFrame::Reflow(nsPresContext* aPresContext,
aReflowInput.ComputedLogicalBorderPadding().BStartEnd(wm));
aDesiredSize.SetSize(wm, finalSize);
- // computation of the ascent wrt the input height
+ // Calculate the baseline and store it in mFirstBaseline.
nscoord lineHeight = aReflowInput.ComputedBSize();
float inflation = nsLayoutUtils::FontSizeInflationFor(this);
if (!IsSingleLineTextControl()) {
lineHeight = ReflowInput::CalcLineHeight(GetContent(), StyleContext(),
- NS_AUTOHEIGHT, inflation);
+ NS_AUTOHEIGHT, inflation);
}
RefPtr<nsFontMetrics> fontMet =
nsLayoutUtils::GetFontMetricsForFrame(this, inflation);
- // now adjust for our borders and padding
- aDesiredSize.SetBlockStartAscent(
+ mFirstBaseline =
nsLayoutUtils::GetCenteredFontBaseline(fontMet, lineHeight,
wm.IsLineInverted()) +
- aReflowInput.ComputedLogicalBorderPadding().BStart(wm));
+ aReflowInput.ComputedLogicalBorderPadding().BStart(wm);
+ aDesiredSize.SetBlockStartAscent(mFirstBaseline);
// overflow handling
aDesiredSize.SetOverflowAreasToDesiredBounds();