diff --git a/layout/forms/nsMeterFrame.cpp b/layout/forms/nsMeterFrame.cpp index 629ae987e5df..553863fd9868 100644 --- a/layout/forms/nsMeterFrame.cpp +++ b/layout/forms/nsMeterFrame.cpp @@ -135,7 +135,7 @@ nsMeterFrame::ReflowBarFrame(nsIFrame* aBarFrame, const nsHTMLReflowState& aReflowState, nsReflowStatus& aStatus) { - bool vertical = StyleDisplay()->mOrient == NS_STYLE_ORIENT_VERTICAL; + bool vertical = ResolvedOrientationIsVertical(); WritingMode wm = aBarFrame->GetWritingMode(); LogicalSize availSize = aReflowState.ComputedSize(wm); availSize.BSize(wm) = NS_UNCONSTRAINEDSIZE; @@ -158,7 +158,7 @@ nsMeterFrame::ReflowBarFrame(nsIFrame* aBarFrame, size = NSToCoordRound(size * position); - if (!vertical && StyleVisibility()->mDirection == NS_STYLE_DIRECTION_RTL) { + if (!vertical && (wm.IsVertical() ? wm.IsVerticalRL() : !wm.IsBidiLTR())) { xoffset += aReflowState.ComputedWidth() - size; } @@ -230,7 +230,7 @@ nsMeterFrame::ComputeAutoSize(nsRenderingContext *aRenderingContext, LogicalSize autoSize(wm); autoSize.BSize(wm) = autoSize.ISize(wm) = fontMet->Font().size; // 1em - if (StyleDisplay()->mOrient == NS_STYLE_ORIENT_VERTICAL) { + if (ResolvedOrientationIsVertical()) { autoSize.Height(wm) *= 5; // 5em } else { autoSize.Width(wm) *= 5; // 5em @@ -246,14 +246,14 @@ nsMeterFrame::GetMinISize(nsRenderingContext *aRenderingContext) NS_ENSURE_SUCCESS( nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fontMet)), 0); - nscoord minWidth = fontMet->Font().size; // 1em + nscoord minISize = fontMet->Font().size; // 1em - if (StyleDisplay()->mOrient == NS_STYLE_ORIENT_HORIZONTAL) { - // The orientation is horizontal - minWidth *= 5; // 5em + if (ResolvedOrientationIsVertical() == GetWritingMode().IsVertical()) { + // The orientation is inline + minISize *= 5; // 5em } - return minWidth; + return minISize; } nscoord diff --git a/layout/forms/nsProgressFrame.cpp b/layout/forms/nsProgressFrame.cpp index 759a5ef6ff81..86b030707e62 100644 --- a/layout/forms/nsProgressFrame.cpp +++ b/layout/forms/nsProgressFrame.cpp @@ -139,7 +139,7 @@ nsProgressFrame::ReflowBarFrame(nsIFrame* aBarFrame, const nsHTMLReflowState& aReflowState, nsReflowStatus& aStatus) { - bool vertical = StyleDisplay()->mOrient == NS_STYLE_ORIENT_VERTICAL; + bool vertical = ResolvedOrientationIsVertical(); WritingMode wm = aBarFrame->GetWritingMode(); LogicalSize availSize = aReflowState.ComputedSize(wm); availSize.BSize(wm) = NS_UNCONSTRAINEDSIZE; @@ -158,7 +158,7 @@ nsProgressFrame::ReflowBarFrame(nsIFrame* aBarFrame, size *= position; } - if (!vertical && StyleVisibility()->mDirection == NS_STYLE_DIRECTION_RTL) { + if (!vertical && (wm.IsVertical() ? wm.IsVerticalRL() : !wm.IsBidiLTR())) { xoffset += aReflowState.ComputedWidth() - size; } @@ -236,7 +236,7 @@ nsProgressFrame::ComputeAutoSize(nsRenderingContext *aRenderingContext, NSToCoordRound(StyleFont()->mFont.size * nsLayoutUtils::FontSizeInflationFor(this)); // 1em - if (StyleDisplay()->mOrient == NS_STYLE_ORIENT_VERTICAL) { + if (ResolvedOrientationIsVertical()) { autoSize.Height(wm) *= 10; // 10em } else { autoSize.Width(wm) *= 10; // 10em @@ -252,14 +252,14 @@ nsProgressFrame::GetMinISize(nsRenderingContext *aRenderingContext) NS_ENSURE_SUCCESS( nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fontMet)), 0); - nscoord minWidth = fontMet->Font().size; // 1em + nscoord minISize = fontMet->Font().size; // 1em - if (StyleDisplay()->mOrient == NS_STYLE_ORIENT_HORIZONTAL) { - // The orientation is horizontal - minWidth *= 10; // 10em + if (ResolvedOrientationIsVertical() == GetWritingMode().IsVertical()) { + // The orientation is inline + minISize *= 10; // 10em } - return minWidth; + return minISize; } nscoord diff --git a/layout/generic/nsContainerFrame.cpp b/layout/generic/nsContainerFrame.cpp index 912f05b94603..dd8d1d35c112 100644 --- a/layout/generic/nsContainerFrame.cpp +++ b/layout/generic/nsContainerFrame.cpp @@ -1679,6 +1679,24 @@ nsContainerFrame::PullNextInFlowChild(ContinuationTraversingState& aState) return frame; } +bool +nsContainerFrame::ResolvedOrientationIsVertical() +{ + uint8_t orient = StyleDisplay()->mOrient; + switch (orient) { + case NS_STYLE_ORIENT_HORIZONTAL: + return false; + case NS_STYLE_ORIENT_VERTICAL: + return true; + case NS_STYLE_ORIENT_INLINE: + return GetWritingMode().IsVertical(); + case NS_STYLE_ORIENT_BLOCK: + return !GetWritingMode().IsVertical(); + } + NS_NOTREACHED("unexpected -moz-orient value"); + return false; +} + nsOverflowContinuationTracker::nsOverflowContinuationTracker(nsContainerFrame* aFrame, bool aWalkOOFFrames, bool aSkipOverflowContainerChildren) diff --git a/layout/generic/nsContainerFrame.h b/layout/generic/nsContainerFrame.h index a638c56ab09c..59bd5bb5335b 100644 --- a/layout/generic/nsContainerFrame.h +++ b/layout/generic/nsContainerFrame.h @@ -613,6 +613,12 @@ protected: // ========================================================================== + // Helper used by Progress and Meter frames. Returns true if the bar should + // be rendered vertically, based on writing-mode and -moz-orient properties. + bool ResolvedOrientationIsVertical(); + + // ========================================================================== + nsFrameList mFrames; };