summaryrefslogtreecommitdiffstats
path: root/layout/forms/nsHTMLButtonControlFrame.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/nsHTMLButtonControlFrame.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/nsHTMLButtonControlFrame.cpp')
-rw-r--r--layout/forms/nsHTMLButtonControlFrame.cpp41
1 files changed, 41 insertions, 0 deletions
diff --git a/layout/forms/nsHTMLButtonControlFrame.cpp b/layout/forms/nsHTMLButtonControlFrame.cpp
index ef9459ef2..2e4fa9f67 100644
--- a/layout/forms/nsHTMLButtonControlFrame.cpp
+++ b/layout/forms/nsHTMLButtonControlFrame.cpp
@@ -418,6 +418,47 @@ nsHTMLButtonControlFrame::ReflowButtonContents(nsPresContext* aPresContext,
aButtonDesiredSize.SetOverflowAreasToDesiredBounds();
}
+bool
+nsHTMLButtonControlFrame::GetVerticalAlignBaseline(mozilla::WritingMode aWM,
+ nscoord* aBaseline) const
+{
+ nsIFrame* inner = mFrames.FirstChild();
+ if (MOZ_UNLIKELY(inner->GetWritingMode().IsOrthogonalTo(aWM))) {
+ return false;
+ }
+ if (!inner->GetVerticalAlignBaseline(aWM, aBaseline)) {
+ // <input type=color> has an empty block frame as inner frame
+ *aBaseline = inner->
+ SynthesizeBaselineBOffsetFromBorderBox(aWM, BaselineSharingGroup::eFirst);
+ }
+ nscoord innerBStart = inner->BStart(aWM, GetSize());
+ *aBaseline += innerBStart;
+ return true;
+}
+
+bool
+nsHTMLButtonControlFrame::GetNaturalBaselineBOffset(mozilla::WritingMode aWM,
+ BaselineSharingGroup aBaselineGroup,
+ nscoord* aBaseline) const
+{
+ nsIFrame* inner = mFrames.FirstChild();
+ if (MOZ_UNLIKELY(inner->GetWritingMode().IsOrthogonalTo(aWM))) {
+ return false;
+ }
+ if (!inner->GetNaturalBaselineBOffset(aWM, aBaselineGroup, aBaseline)) {
+ // <input type=color> has an empty block frame as inner frame
+ *aBaseline = inner->
+ SynthesizeBaselineBOffsetFromBorderBox(aWM, aBaselineGroup);
+ }
+ nscoord innerBStart = inner->BStart(aWM, GetSize());
+ if (aBaselineGroup == BaselineSharingGroup::eFirst) {
+ *aBaseline += innerBStart;
+ } else {
+ *aBaseline += BSize(aWM) - (innerBStart + inner->BSize(aWM));
+ }
+ return true;
+}
+
nsresult nsHTMLButtonControlFrame::SetFormProperty(nsIAtom* aName, const nsAString& aValue)
{
if (nsGkAtoms::value == aName) {