зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1330962 part 2 - Add baseline methods to nsHTMLButtonControlFrame. r=dholbert
This commit is contained in:
Родитель
4d79cc0b8c
Коммит
a44216adfb
|
@ -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) {
|
||||
|
|
|
@ -39,6 +39,13 @@ public:
|
|||
const ReflowInput& aReflowInput,
|
||||
nsReflowStatus& aStatus) override;
|
||||
|
||||
bool GetVerticalAlignBaseline(mozilla::WritingMode aWM,
|
||||
nscoord* aBaseline) const override;
|
||||
|
||||
bool GetNaturalBaselineBOffset(mozilla::WritingMode aWM,
|
||||
BaselineSharingGroup aBaselineGroup,
|
||||
nscoord* aBaseline) const override;
|
||||
|
||||
virtual nsresult HandleEvent(nsPresContext* aPresContext,
|
||||
mozilla::WidgetGUIEvent* aEvent,
|
||||
nsEventStatus* aEventStatus) override;
|
||||
|
|
Загрузка…
Ссылка в новой задаче