summaryrefslogtreecommitdiffstats
path: root/layout/forms/nsFieldSetFrame.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/nsFieldSetFrame.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/nsFieldSetFrame.cpp')
-rw-r--r--layout/forms/nsFieldSetFrame.cpp71
1 files changed, 54 insertions, 17 deletions
diff --git a/layout/forms/nsFieldSetFrame.cpp b/layout/forms/nsFieldSetFrame.cpp
index befd41ee2..fc9f0571b 100644
--- a/layout/forms/nsFieldSetFrame.cpp
+++ b/layout/forms/nsFieldSetFrame.cpp
@@ -5,26 +5,22 @@
#include "nsFieldSetFrame.h"
+#include <algorithm>
#include "mozilla/gfx/2D.h"
+#include "mozilla/Likely.h"
+#include "mozilla/Maybe.h"
#include "nsCSSAnonBoxes.h"
-#include "nsLayoutUtils.h"
-#include "nsLegendFrame.h"
#include "nsCSSRendering.h"
-#include <algorithm>
-#include "nsIFrame.h"
-#include "nsPresContext.h"
-#include "mozilla/RestyleManager.h"
-#include "nsGkAtoms.h"
-#include "nsStyleConsts.h"
#include "nsDisplayList.h"
+#include "nsGkAtoms.h"
+#include "nsIFrameInlines.h"
+#include "nsLayoutUtils.h"
+#include "nsLegendFrame.h"
#include "nsRenderingContext.h"
-#include "nsIScrollableFrame.h"
-#include "mozilla/Likely.h"
-#include "mozilla/Maybe.h"
+#include "nsStyleConsts.h"
using namespace mozilla;
using namespace mozilla::gfx;
-using namespace mozilla::image;
using namespace mozilla::layout;
nsContainerFrame*
@@ -126,7 +122,7 @@ void
nsDisplayFieldSetBorderBackground::Paint(nsDisplayListBuilder* aBuilder,
nsRenderingContext* aCtx)
{
- DrawResult result = static_cast<nsFieldSetFrame*>(mFrame)->
+ image::DrawResult result = static_cast<nsFieldSetFrame*>(mFrame)->
PaintBorder(aBuilder, *aCtx, ToReferenceFrame(), mVisibleRect);
nsDisplayItemGenericImageGeometry::UpdateDrawResult(this, result);
@@ -210,7 +206,7 @@ nsFieldSetFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
contentDisplayItems.MoveTo(aLists);
}
-DrawResult
+image::DrawResult
nsFieldSetFrame::PaintBorder(
nsDisplayListBuilder* aBuilder,
nsRenderingContext& aRenderingContext,
@@ -695,9 +691,50 @@ nsFieldSetFrame::AccessibleType()
#endif
nscoord
-nsFieldSetFrame::GetLogicalBaseline(WritingMode aWritingMode) const
+nsFieldSetFrame::GetLogicalBaseline(WritingMode aWM) const
+{
+ switch (StyleDisplay()->mDisplay) {
+ case mozilla::StyleDisplay::Grid:
+ case mozilla::StyleDisplay::InlineGrid:
+ case mozilla::StyleDisplay::Flex:
+ case mozilla::StyleDisplay::InlineFlex:
+ return BaselineBOffset(aWM, BaselineSharingGroup::eFirst,
+ AlignmentContext::eInline);
+ default:
+ return BSize(aWM) - BaselineBOffset(aWM, BaselineSharingGroup::eLast,
+ AlignmentContext::eInline);
+ }
+}
+
+bool
+nsFieldSetFrame::GetVerticalAlignBaseline(WritingMode aWM,
+ nscoord* aBaseline) const
{
nsIFrame* inner = GetInner();
- return inner->BStart(aWritingMode, GetParent()->GetSize()) +
- inner->GetLogicalBaseline(aWritingMode);
+ MOZ_ASSERT(!inner->GetWritingMode().IsOrthogonalTo(aWM));
+ if (!inner->GetVerticalAlignBaseline(aWM, aBaseline)) {
+ return false;
+ }
+ nscoord innerBStart = inner->BStart(aWM, GetSize());
+ *aBaseline += innerBStart;
+ return true;
+}
+
+bool
+nsFieldSetFrame::GetNaturalBaselineBOffset(WritingMode aWM,
+ BaselineSharingGroup aBaselineGroup,
+ nscoord* aBaseline) const
+{
+ nsIFrame* inner = GetInner();
+ MOZ_ASSERT(!inner->GetWritingMode().IsOrthogonalTo(aWM));
+ if (!inner->GetNaturalBaselineBOffset(aWM, aBaselineGroup, aBaseline)) {
+ return false;
+ }
+ nscoord innerBStart = inner->BStart(aWM, GetSize());
+ if (aBaselineGroup == BaselineSharingGroup::eFirst) {
+ *aBaseline += innerBStart;
+ } else {
+ *aBaseline += BSize(aWM) - (innerBStart + inner->BSize(aWM));
+ }
+ return true;
}