зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1172450 - Size and position the dropdown arrow properly in vertical writing modes. r=smontagu
This commit is contained in:
Родитель
0bdd67bdd0
Коммит
4d081f1ac4
|
@ -733,7 +733,7 @@ nsComboboxControlFrame::GetIntrinsicISize(nsRenderingContext* aRenderingContext,
|
||||||
nsIScrollableFrame* scrollable = do_QueryFrame(mListControlFrame);
|
nsIScrollableFrame* scrollable = do_QueryFrame(mListControlFrame);
|
||||||
NS_ASSERTION(scrollable, "List must be a scrollable frame");
|
NS_ASSERTION(scrollable, "List must be a scrollable frame");
|
||||||
scrollbarWidth = scrollable->GetNondisappearingScrollbarWidth(
|
scrollbarWidth = scrollable->GetNondisappearingScrollbarWidth(
|
||||||
presContext, aRenderingContext);
|
presContext, aRenderingContext, GetWritingMode());
|
||||||
}
|
}
|
||||||
|
|
||||||
nscoord displayISize = 0;
|
nscoord displayISize = 0;
|
||||||
|
@ -848,6 +848,7 @@ nsComboboxControlFrame::Reflow(nsPresContext* aPresContext,
|
||||||
|
|
||||||
// Get the width of the vertical scrollbar. That will be the inline
|
// Get the width of the vertical scrollbar. That will be the inline
|
||||||
// size of the dropdown button.
|
// size of the dropdown button.
|
||||||
|
WritingMode wm = aReflowState.GetWritingMode();
|
||||||
nscoord buttonISize;
|
nscoord buttonISize;
|
||||||
const nsStyleDisplay *disp = StyleDisplay();
|
const nsStyleDisplay *disp = StyleDisplay();
|
||||||
if ((IsThemed(disp) && !aPresContext->GetTheme()->ThemeNeedsComboboxDropmarker()) ||
|
if ((IsThemed(disp) && !aPresContext->GetTheme()->ThemeNeedsComboboxDropmarker()) ||
|
||||||
|
@ -858,7 +859,7 @@ nsComboboxControlFrame::Reflow(nsPresContext* aPresContext,
|
||||||
nsIScrollableFrame* scrollable = do_QueryFrame(mListControlFrame);
|
nsIScrollableFrame* scrollable = do_QueryFrame(mListControlFrame);
|
||||||
NS_ASSERTION(scrollable, "List must be a scrollable frame");
|
NS_ASSERTION(scrollable, "List must be a scrollable frame");
|
||||||
buttonISize = scrollable->GetNondisappearingScrollbarWidth(
|
buttonISize = scrollable->GetNondisappearingScrollbarWidth(
|
||||||
PresContext(), aReflowState.rendContext);
|
PresContext(), aReflowState.rendContext, wm);
|
||||||
if (buttonISize > aReflowState.ComputedISize()) {
|
if (buttonISize > aReflowState.ComputedISize()) {
|
||||||
buttonISize = 0;
|
buttonISize = 0;
|
||||||
}
|
}
|
||||||
|
@ -869,8 +870,7 @@ nsComboboxControlFrame::Reflow(nsPresContext* aPresContext,
|
||||||
nsBlockFrame::Reflow(aPresContext, aDesiredSize, aReflowState, aStatus);
|
nsBlockFrame::Reflow(aPresContext, aDesiredSize, aReflowState, aStatus);
|
||||||
|
|
||||||
// The button should occupy the same space as a scrollbar
|
// The button should occupy the same space as a scrollbar
|
||||||
WritingMode wm = aReflowState.GetWritingMode();
|
nsSize containerSize = aDesiredSize.PhysicalSize();
|
||||||
nsSize containerSize = aReflowState.ComputedSizeAsContainerIfConstrained();
|
|
||||||
LogicalRect buttonRect = mButtonFrame->GetLogicalRect(containerSize);
|
LogicalRect buttonRect = mButtonFrame->GetLogicalRect(containerSize);
|
||||||
|
|
||||||
buttonRect.IStart(wm) =
|
buttonRect.IStart(wm) =
|
||||||
|
|
|
@ -1042,34 +1042,38 @@ ScrollFrameHelper::GetDesiredScrollbarSizes(nsBoxLayoutState* aState)
|
||||||
}
|
}
|
||||||
|
|
||||||
nscoord
|
nscoord
|
||||||
ScrollFrameHelper::GetNondisappearingScrollbarWidth(nsBoxLayoutState* aState)
|
ScrollFrameHelper::GetNondisappearingScrollbarWidth(nsBoxLayoutState* aState,
|
||||||
|
WritingMode aWM)
|
||||||
{
|
{
|
||||||
NS_ASSERTION(aState && aState->GetRenderingContext(),
|
NS_ASSERTION(aState && aState->GetRenderingContext(),
|
||||||
"Must have rendering context in layout state for size "
|
"Must have rendering context in layout state for size "
|
||||||
"computations");
|
"computations");
|
||||||
|
|
||||||
|
bool verticalWM = aWM.IsVertical();
|
||||||
if (LookAndFeel::GetInt(LookAndFeel::eIntID_UseOverlayScrollbars) != 0) {
|
if (LookAndFeel::GetInt(LookAndFeel::eIntID_UseOverlayScrollbars) != 0) {
|
||||||
// We're using overlay scrollbars, so we need to get the width that
|
// We're using overlay scrollbars, so we need to get the width that
|
||||||
// non-disappearing scrollbars would have.
|
// non-disappearing scrollbars would have.
|
||||||
nsITheme* theme = aState->PresContext()->GetTheme();
|
nsITheme* theme = aState->PresContext()->GetTheme();
|
||||||
if (theme &&
|
if (theme &&
|
||||||
theme->ThemeSupportsWidget(aState->PresContext(),
|
theme->ThemeSupportsWidget(aState->PresContext(),
|
||||||
mVScrollbarBox,
|
verticalWM ? mHScrollbarBox
|
||||||
|
: mVScrollbarBox,
|
||||||
NS_THEME_SCROLLBAR_NON_DISAPPEARING)) {
|
NS_THEME_SCROLLBAR_NON_DISAPPEARING)) {
|
||||||
LayoutDeviceIntSize size;
|
LayoutDeviceIntSize size;
|
||||||
bool canOverride = true;
|
bool canOverride = true;
|
||||||
theme->GetMinimumWidgetSize(aState->PresContext(),
|
theme->GetMinimumWidgetSize(aState->PresContext(),
|
||||||
mVScrollbarBox,
|
verticalWM ? mHScrollbarBox
|
||||||
|
: mVScrollbarBox,
|
||||||
NS_THEME_SCROLLBAR_NON_DISAPPEARING,
|
NS_THEME_SCROLLBAR_NON_DISAPPEARING,
|
||||||
&size,
|
&size,
|
||||||
&canOverride);
|
&canOverride);
|
||||||
if (size.width) {
|
return aState->PresContext()->
|
||||||
return aState->PresContext()->DevPixelsToAppUnits(size.width);
|
DevPixelsToAppUnits(verticalWM ? size.height : size.width);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return GetDesiredScrollbarSizes(aState).LeftRight();
|
nsMargin sizes(GetDesiredScrollbarSizes(aState));
|
||||||
|
return verticalWM ? sizes.TopBottom() : sizes.LeftRight();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -304,7 +304,8 @@ public:
|
||||||
}
|
}
|
||||||
nsMargin GetActualScrollbarSizes() const;
|
nsMargin GetActualScrollbarSizes() const;
|
||||||
nsMargin GetDesiredScrollbarSizes(nsBoxLayoutState* aState);
|
nsMargin GetDesiredScrollbarSizes(nsBoxLayoutState* aState);
|
||||||
nscoord GetNondisappearingScrollbarWidth(nsBoxLayoutState* aState);
|
nscoord GetNondisappearingScrollbarWidth(nsBoxLayoutState* aState,
|
||||||
|
mozilla::WritingMode aVerticalWM);
|
||||||
bool IsLTR() const;
|
bool IsLTR() const;
|
||||||
bool IsScrollbarOnRight() const;
|
bool IsScrollbarOnRight() const;
|
||||||
bool IsScrollingActive(nsDisplayListBuilder* aBuilder) const;
|
bool IsScrollingActive(nsDisplayListBuilder* aBuilder) const;
|
||||||
|
@ -691,9 +692,9 @@ public:
|
||||||
return GetDesiredScrollbarSizes(&bls);
|
return GetDesiredScrollbarSizes(&bls);
|
||||||
}
|
}
|
||||||
virtual nscoord GetNondisappearingScrollbarWidth(nsPresContext* aPresContext,
|
virtual nscoord GetNondisappearingScrollbarWidth(nsPresContext* aPresContext,
|
||||||
nsRenderingContext* aRC) override {
|
nsRenderingContext* aRC, mozilla::WritingMode aWM) override {
|
||||||
nsBoxLayoutState bls(aPresContext, aRC, 0);
|
nsBoxLayoutState bls(aPresContext, aRC, 0);
|
||||||
return mHelper.GetNondisappearingScrollbarWidth(&bls);
|
return mHelper.GetNondisappearingScrollbarWidth(&bls, aWM);
|
||||||
}
|
}
|
||||||
virtual nsRect GetScrolledRect() const override {
|
virtual nsRect GetScrolledRect() const override {
|
||||||
return mHelper.GetScrolledRect();
|
return mHelper.GetScrolledRect();
|
||||||
|
@ -1095,9 +1096,9 @@ public:
|
||||||
return GetDesiredScrollbarSizes(&bls);
|
return GetDesiredScrollbarSizes(&bls);
|
||||||
}
|
}
|
||||||
virtual nscoord GetNondisappearingScrollbarWidth(nsPresContext* aPresContext,
|
virtual nscoord GetNondisappearingScrollbarWidth(nsPresContext* aPresContext,
|
||||||
nsRenderingContext* aRC) override {
|
nsRenderingContext* aRC, mozilla::WritingMode aWM) override {
|
||||||
nsBoxLayoutState bls(aPresContext, aRC, 0);
|
nsBoxLayoutState bls(aPresContext, aRC, 0);
|
||||||
return mHelper.GetNondisappearingScrollbarWidth(&bls);
|
return mHelper.GetNondisappearingScrollbarWidth(&bls, aWM);
|
||||||
}
|
}
|
||||||
virtual nsRect GetScrolledRect() const override {
|
virtual nsRect GetScrolledRect() const override {
|
||||||
return mHelper.GetScrolledRect();
|
return mHelper.GetScrolledRect();
|
||||||
|
|
|
@ -107,8 +107,10 @@ public:
|
||||||
/**
|
/**
|
||||||
* Return the width for non-disappearing scrollbars.
|
* Return the width for non-disappearing scrollbars.
|
||||||
*/
|
*/
|
||||||
virtual nscoord GetNondisappearingScrollbarWidth(nsPresContext* aPresContext,
|
virtual nscoord
|
||||||
nsRenderingContext* aRC) = 0;
|
GetNondisappearingScrollbarWidth(nsPresContext* aPresContext,
|
||||||
|
nsRenderingContext* aRC,
|
||||||
|
mozilla::WritingMode aWM) = 0;
|
||||||
/**
|
/**
|
||||||
* GetScrolledRect is designed to encapsulate deciding which
|
* GetScrolledRect is designed to encapsulate deciding which
|
||||||
* directions of overflow should be reachable by scrolling and which
|
* directions of overflow should be reachable by scrolling and which
|
||||||
|
|
Загрузка…
Ссылка в новой задаче