Bug 1587953 - Improve Gtk theme handling for some widgets in vertical writing-modes. r=jmathies

Differential Revision: https://phabricator.services.mozilla.com/D67289

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Jonathan Kew 2020-03-19 19:29:55 +00:00
parent ce0d9c74e7
commit f2b9997dda
2 changed files with 20 additions and 2 deletions

View File

@ -17,7 +17,7 @@ load 1469472.html
load 1477831-1.html
load 1504033.html
load 1514544-1.html
asserts(4-8) load 1547420-1.html
asserts(4-9) load 1547420-1.html
load 1549909.html
asserts(6) asserts-if(Android,9) load 1551389-1.html # bug 847368
asserts(0-2) load 1555819-1.html

View File

@ -1267,6 +1267,21 @@ WidgetNodeType nsNativeThemeGTK::NativeThemeToGtkTheme(
return gtkWidgetType;
}
static void FixupForVerticalWritingMode(WritingMode aWritingMode,
LayoutDeviceIntMargin* aResult) {
if (aWritingMode.IsVertical()) {
bool rtl = aWritingMode.IsBidiRTL();
LogicalMargin logical(aWritingMode, aResult->top,
rtl ? aResult->left : aResult->right, aResult->bottom,
rtl ? aResult->right : aResult->left);
nsMargin physical = logical.GetPhysicalMargin(aWritingMode);
aResult->top = physical.top;
aResult->right = physical.right;
aResult->bottom = physical.bottom;
aResult->left = physical.left;
}
}
void nsNativeThemeGTK::GetCachedWidgetBorder(nsIFrame* aFrame,
StyleAppearance aAppearance,
GtkTextDirection aDirection,
@ -1292,6 +1307,7 @@ void nsNativeThemeGTK::GetCachedWidgetBorder(nsIFrame* aFrame,
}
}
}
FixupForVerticalWritingMode(aFrame->GetWritingMode(), aResult);
}
LayoutDeviceIntMargin nsNativeThemeGTK::GetWidgetBorder(
@ -1644,7 +1660,9 @@ nsNativeThemeGTK::GetMinimumWidgetSize(nsPresContext* aPresContext,
case StyleAppearance::MenulistTextfield:
case StyleAppearance::NumberInput:
case StyleAppearance::Textfield: {
moz_gtk_get_entry_min_height(&aResult->height);
moz_gtk_get_entry_min_height(aFrame->GetWritingMode().IsVertical()
? &aResult->width
: &aResult->height);
} break;
#endif
case StyleAppearance::Separator: {