Bug 1330962 part 2 - Add baseline methods to nsHTMLButtonControlFrame. r=dholbert

This commit is contained in:
Mats Palmgren
2017-01-28 02:34:13 +01:00
parent 1c65043efe
commit 2d8ae3fa9e
2 changed files with 48 additions and 0 deletions

View File

@@ -337,6 +337,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) {