mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 13:51:41 +00:00
Backed out changeset 222723ab0b5b (bug 1615056) for bustages complaining about nsNativeThemeWin.cpp CLOSED TREE
This commit is contained in:
parent
a7a60ebe29
commit
d9d7ba1ba9
@ -10907,6 +10907,10 @@ exports.PREFERENCES = [
|
||||
"-moz-transform-origin",
|
||||
"layout.css.prefixes.transforms"
|
||||
],
|
||||
[
|
||||
"-webkit-appearance",
|
||||
"layout.css.webkit-appearance.enabled"
|
||||
],
|
||||
[
|
||||
"-moz-column-width",
|
||||
"layout.css.prefixes.columns"
|
||||
|
@ -384,6 +384,7 @@ skip-if = toolkit == 'android' # TIMED_OUT for android
|
||||
skip-if = toolkit == 'android' # TIMED_OUT for android
|
||||
[test_visited_reftests.html]
|
||||
skip-if = toolkit == 'android' # TIMED_OUT for android
|
||||
[test_webkit_appearance_basic.html]
|
||||
[test_webkit_device_pixel_ratio.html]
|
||||
[test_webkit_flex_display.html]
|
||||
[test_first_letter_restrictions.html]
|
||||
|
@ -1587,13 +1587,6 @@ var gCSSProperties = {
|
||||
other_values: ["radio", "menulist"],
|
||||
invalid_values: [],
|
||||
},
|
||||
"-webkit-appearance": {
|
||||
domProp: "webkitAppearance",
|
||||
inherited: false,
|
||||
type: CSS_TYPE_SHORTHAND_AND_LONGHAND,
|
||||
alias_for: "-moz-appearance",
|
||||
subproperties: ["-moz-appearance"],
|
||||
},
|
||||
"border-inline": {
|
||||
domProp: "borderInline",
|
||||
inherited: false,
|
||||
@ -12545,6 +12538,15 @@ if (IsCSSPropertyPrefEnabled("layout.css.overscroll-behavior.enabled")) {
|
||||
invalid_values: ["left", "1px", "contain auto none", "contain nonsense"],
|
||||
};
|
||||
}
|
||||
if (IsCSSPropertyPrefEnabled("layout.css.webkit-appearance.enabled")) {
|
||||
gCSSProperties["-webkit-appearance"] = {
|
||||
domProp: "webkitAppearance",
|
||||
inherited: false,
|
||||
type: CSS_TYPE_SHORTHAND_AND_LONGHAND,
|
||||
alias_for: "-moz-appearance",
|
||||
subproperties: ["-moz-appearance"],
|
||||
};
|
||||
}
|
||||
|
||||
if (IsCSSPropertyPrefEnabled("layout.css.offset-logical-properties.enabled")) {
|
||||
gCSSProperties["offset-block-start"] = {
|
||||
|
66
layout/style/test/test_webkit_appearance_basic.html
Normal file
66
layout/style/test/test_webkit_appearance_basic.html
Normal file
@ -0,0 +1,66 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=1429713
|
||||
-->
|
||||
<head>
|
||||
<title>Test pref layout.css.webkit-appearance.enabled</title>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1429713">Mozilla Bug 1429713</a>
|
||||
<div id="content" style="display: none">
|
||||
<iframe id="iframe"></iframe>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
</script>
|
||||
<pre id="test">
|
||||
<script class="testbody" type="application/javascript">
|
||||
|
||||
function iframe_reload() {
|
||||
return new Promise(resolve => {
|
||||
iframe.addEventListener("load", _ => resolve());
|
||||
iframe.contentWindow.location.reload();
|
||||
});
|
||||
}
|
||||
|
||||
add_task(async function runTests() {
|
||||
// Pref changes only take affect after a page is reloaded, which is why we
|
||||
// use an iframe here and reload it after the pref changes.
|
||||
|
||||
const iframe = document.getElementById("iframe");
|
||||
|
||||
// Test pref enabled:
|
||||
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
"set": [["layout.css.webkit-appearance.enabled", true]],
|
||||
});
|
||||
|
||||
await iframe_reload();
|
||||
|
||||
let win = iframe.contentWindow;
|
||||
let testElem = win.document.body;
|
||||
testElem.style["-webkit-appearance"] = "none";
|
||||
is(window.getComputedStyle(testElem)["-webkit-appearance"], "none",
|
||||
"Pref should enable -webkit-appearance support");
|
||||
|
||||
// Test pref disabled:
|
||||
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
"set": [["layout.css.webkit-appearance.enabled", false]],
|
||||
});
|
||||
|
||||
await iframe_reload();
|
||||
|
||||
win = iframe.contentWindow;
|
||||
testElem = win.document.body;
|
||||
testElem.style["-webkit-appearance"] = "none";
|
||||
is(window.getComputedStyle(testElem)["-webkit-appearance"], undefined,
|
||||
"Pref should disable -webkit-appearance support");
|
||||
});
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
@ -5530,6 +5530,12 @@
|
||||
value: true
|
||||
mirror: always
|
||||
|
||||
# Is the '-webkit-appearance' alias for '-moz-appearance' enabled?
|
||||
- name: layout.css.webkit-appearance.enabled
|
||||
type: bool
|
||||
value: true
|
||||
mirror: always
|
||||
|
||||
- name: layout.css.xul-display-values.content.enabled
|
||||
type: RelaxedAtomicBool
|
||||
value: false
|
||||
|
@ -635,7 +635,7 @@ ${helpers.predefined_type(
|
||||
"Appearance",
|
||||
"computed::Appearance::None",
|
||||
engines="gecko",
|
||||
alias="-webkit-appearance",
|
||||
alias="-webkit-appearance:layout.css.webkit-appearance.enabled",
|
||||
spec="Nonstandard (https://developer.mozilla.org/en-US/docs/Web/CSS/-moz-appearance)",
|
||||
animation_value_type="discrete",
|
||||
gecko_ffi_name="mAppearance",
|
||||
|
@ -2666,6 +2666,11 @@ Maybe<nsNativeThemeCocoa::WidgetInfo> nsNativeThemeCocoa::ComputeWidgetInfo(
|
||||
nsIFrame* aFrame, StyleAppearance aAppearance, const nsRect& aRect) {
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_RETURN;
|
||||
|
||||
if (aAppearance == StyleAppearance::MenulistButton &&
|
||||
StaticPrefs::layout_css_webkit_appearance_enabled()) {
|
||||
aAppearance = StyleAppearance::Menulist;
|
||||
}
|
||||
|
||||
// setup to draw into the correct port
|
||||
int32_t p2a = aFrame->PresContext()->AppUnitsPerDevPixel();
|
||||
|
||||
@ -2896,7 +2901,6 @@ Maybe<nsNativeThemeCocoa::WidgetInfo> nsNativeThemeCocoa::ComputeWidgetInfo(
|
||||
case StyleAppearance::Statusbar:
|
||||
return Some(WidgetInfo::StatusBar(IsActive(aFrame, YES)));
|
||||
|
||||
case StyleAppearance::MenulistButton:
|
||||
case StyleAppearance::Menulist: {
|
||||
ControlParams controlParams = ComputeControlParams(aFrame, eventState);
|
||||
controlParams.focused = controlParams.focused || IsFocused(aFrame);
|
||||
@ -2908,6 +2912,7 @@ Maybe<nsNativeThemeCocoa::WidgetInfo> nsNativeThemeCocoa::ComputeWidgetInfo(
|
||||
return Some(WidgetInfo::Dropdown(params));
|
||||
}
|
||||
|
||||
case StyleAppearance::MenulistButton:
|
||||
case StyleAppearance::MozMenulistButton:
|
||||
return Some(WidgetInfo::Button(
|
||||
ButtonParams{ComputeControlParams(aFrame, eventState), ButtonType::eArrowButton}));
|
||||
@ -3412,6 +3417,8 @@ bool nsNativeThemeCocoa::CreateWebRenderCommandsForWidget(
|
||||
case StyleAppearance::Toolbar:
|
||||
case StyleAppearance::MozWindowTitlebar:
|
||||
case StyleAppearance::Statusbar:
|
||||
// NOTE: if you change Menulist and MenulistButton to behave differently,
|
||||
// be sure to handle StaticPrefs::layout_css_webkit_appearance_enabled.
|
||||
case StyleAppearance::Menulist:
|
||||
case StyleAppearance::MenulistTextfield:
|
||||
case StyleAppearance::MenulistButton:
|
||||
@ -3557,6 +3564,8 @@ LayoutDeviceIntMargin nsNativeThemeCocoa::GetWidgetBorder(nsDeviceContext* aCont
|
||||
break;
|
||||
}
|
||||
|
||||
// NOTE: if you change Menulist and MenulistButton to behave differently,
|
||||
// be sure to handle StaticPrefs::layout_css_webkit_appearance_enabled.
|
||||
case StyleAppearance::Menulist:
|
||||
case StyleAppearance::MenulistButton:
|
||||
case StyleAppearance::MozMenulistButton:
|
||||
@ -3674,6 +3683,8 @@ bool nsNativeThemeCocoa::GetWidgetOverflow(nsDeviceContext* aContext, nsIFrame*
|
||||
case StyleAppearance::Textarea:
|
||||
case StyleAppearance::Searchfield:
|
||||
case StyleAppearance::Listbox:
|
||||
// NOTE: if you change Menulist and MenulistButton to behave differently,
|
||||
// be sure to handle StaticPrefs::layout_css_webkit_appearance_enabled.
|
||||
case StyleAppearance::Menulist:
|
||||
case StyleAppearance::MenulistButton:
|
||||
case StyleAppearance::MozMenulistButton:
|
||||
@ -3788,6 +3799,8 @@ nsNativeThemeCocoa::GetMinimumWidgetSize(nsPresContext* aPresContext, nsIFrame*
|
||||
break;
|
||||
}
|
||||
|
||||
// NOTE: if you change Menulist and MenulistButton to behave differently,
|
||||
// be sure to handle StaticPrefs::layout_css_webkit_appearance_enabled.
|
||||
case StyleAppearance::Menulist:
|
||||
case StyleAppearance::MenulistButton:
|
||||
case StyleAppearance::MozMenulistButton: {
|
||||
@ -4053,8 +4066,14 @@ nsNativeThemeCocoa::ThemeChanged() {
|
||||
|
||||
bool nsNativeThemeCocoa::ThemeSupportsWidget(nsPresContext* aPresContext, nsIFrame* aFrame,
|
||||
StyleAppearance aAppearance) {
|
||||
if (aAppearance == StyleAppearance::MenulistButton &&
|
||||
StaticPrefs::layout_css_webkit_appearance_enabled()) {
|
||||
aAppearance = StyleAppearance::Menulist;
|
||||
}
|
||||
|
||||
// if this is a dropdown button in a combobox the answer is always no
|
||||
if (aAppearance == StyleAppearance::MozMenulistButton) {
|
||||
if (aAppearance == StyleAppearance::MenulistButton ||
|
||||
aAppearance == StyleAppearance::MozMenulistButton) {
|
||||
nsIFrame* parentFrame = aFrame->GetParent();
|
||||
if (parentFrame && parentFrame->IsComboboxControlFrame()) return false;
|
||||
}
|
||||
@ -4071,6 +4090,7 @@ bool nsNativeThemeCocoa::ThemeSupportsWidget(nsPresContext* aPresContext, nsIFra
|
||||
[[fallthrough]];
|
||||
|
||||
case StyleAppearance::Listbox:
|
||||
|
||||
case StyleAppearance::Dialog:
|
||||
case StyleAppearance::Window:
|
||||
case StyleAppearance::MozWindowButtonBox:
|
||||
@ -4184,8 +4204,14 @@ bool nsNativeThemeCocoa::ThemeSupportsWidget(nsPresContext* aPresContext, nsIFra
|
||||
}
|
||||
|
||||
bool nsNativeThemeCocoa::WidgetIsContainer(StyleAppearance aAppearance) {
|
||||
if (aAppearance == StyleAppearance::MenulistButton &&
|
||||
StaticPrefs::layout_css_webkit_appearance_enabled()) {
|
||||
aAppearance = StyleAppearance::Menulist;
|
||||
}
|
||||
|
||||
// flesh this out at some point
|
||||
switch (aAppearance) {
|
||||
case StyleAppearance::MenulistButton:
|
||||
case StyleAppearance::MozMenulistButton:
|
||||
case StyleAppearance::Radio:
|
||||
case StyleAppearance::Checkbox:
|
||||
@ -4203,9 +4229,12 @@ bool nsNativeThemeCocoa::WidgetIsContainer(StyleAppearance aAppearance) {
|
||||
}
|
||||
|
||||
bool nsNativeThemeCocoa::ThemeDrawsFocusForWidget(StyleAppearance aAppearance) {
|
||||
if (aAppearance == StyleAppearance::MenulistButton &&
|
||||
StaticPrefs::layout_css_webkit_appearance_enabled()) {
|
||||
aAppearance = StyleAppearance::Menulist;
|
||||
}
|
||||
|
||||
if (aAppearance == StyleAppearance::MenulistButton ||
|
||||
aAppearance == StyleAppearance::Button ||
|
||||
if (aAppearance == StyleAppearance::Menulist || aAppearance == StyleAppearance::Button ||
|
||||
aAppearance == StyleAppearance::MozMacHelpButton ||
|
||||
aAppearance == StyleAppearance::MozMacDisclosureButtonOpen ||
|
||||
aAppearance == StyleAppearance::MozMacDisclosureButtonClosed ||
|
||||
|
@ -219,6 +219,11 @@ bool nsNativeThemeGTK::GetGtkWidgetAndState(StyleAppearance aAppearance,
|
||||
WidgetNodeType& aGtkWidgetType,
|
||||
GtkWidgetState* aState,
|
||||
gint* aWidgetFlags) {
|
||||
if (aAppearance == StyleAppearance::MenulistButton &&
|
||||
StaticPrefs::layout_css_webkit_appearance_enabled()) {
|
||||
aAppearance = StyleAppearance::Menulist;
|
||||
}
|
||||
|
||||
if (aState) {
|
||||
memset(aState, 0, sizeof(GtkWidgetState));
|
||||
|
||||
@ -621,7 +626,6 @@ bool nsNativeThemeGTK::GetGtkWidgetAndState(StyleAppearance aAppearance,
|
||||
aGtkWidgetType = MOZ_GTK_TREEVIEW_EXPANDER;
|
||||
if (aWidgetFlags) *aWidgetFlags = GTK_EXPANDER_EXPANDED;
|
||||
break;
|
||||
case StyleAppearance::MenulistButton:
|
||||
case StyleAppearance::Menulist:
|
||||
aGtkWidgetType = MOZ_GTK_DROPDOWN;
|
||||
if (aWidgetFlags)
|
||||
@ -633,6 +637,7 @@ bool nsNativeThemeGTK::GetGtkWidgetAndState(StyleAppearance aAppearance,
|
||||
case StyleAppearance::MenulistTextfield:
|
||||
aGtkWidgetType = MOZ_GTK_DROPDOWN_ENTRY;
|
||||
break;
|
||||
case StyleAppearance::MenulistButton:
|
||||
case StyleAppearance::MozMenulistButton:
|
||||
aGtkWidgetType = MOZ_GTK_DROPDOWN_ARROW;
|
||||
break;
|
||||
@ -1379,6 +1384,11 @@ bool nsNativeThemeGTK::GetWidgetPadding(nsDeviceContext* aContext,
|
||||
nsIFrame* aFrame,
|
||||
StyleAppearance aAppearance,
|
||||
LayoutDeviceIntMargin* aResult) {
|
||||
if (aAppearance == StyleAppearance::MenulistButton &&
|
||||
StaticPrefs::layout_css_webkit_appearance_enabled()) {
|
||||
aAppearance = StyleAppearance::Menulist;
|
||||
}
|
||||
|
||||
switch (aAppearance) {
|
||||
case StyleAppearance::ButtonFocus:
|
||||
case StyleAppearance::Toolbarbutton:
|
||||
@ -1390,6 +1400,7 @@ bool nsNativeThemeGTK::GetWidgetPadding(nsDeviceContext* aContext,
|
||||
case StyleAppearance::Dualbutton:
|
||||
case StyleAppearance::TabScrollArrowBack:
|
||||
case StyleAppearance::TabScrollArrowForward:
|
||||
case StyleAppearance::MenulistButton:
|
||||
case StyleAppearance::MozMenulistButton:
|
||||
case StyleAppearance::ToolbarbuttonDropdown:
|
||||
case StyleAppearance::ButtonArrowUp:
|
||||
@ -1463,6 +1474,11 @@ nsNativeThemeGTK::GetMinimumWidgetSize(nsPresContext* aPresContext,
|
||||
aResult->width = aResult->height = 0;
|
||||
*aIsOverridable = true;
|
||||
|
||||
if (aAppearance == StyleAppearance::MenulistButton &&
|
||||
StaticPrefs::layout_css_webkit_appearance_enabled()) {
|
||||
aAppearance = StyleAppearance::Menulist;
|
||||
}
|
||||
|
||||
switch (aAppearance) {
|
||||
case StyleAppearance::ScrollbarbuttonUp:
|
||||
case StyleAppearance::ScrollbarbuttonDown: {
|
||||
@ -1563,6 +1579,7 @@ nsNativeThemeGTK::GetMinimumWidgetSize(nsPresContext* aPresContext,
|
||||
moz_gtk_get_tab_scroll_arrow_size(&aResult->width, &aResult->height);
|
||||
*aIsOverridable = false;
|
||||
} break;
|
||||
case StyleAppearance::MenulistButton:
|
||||
case StyleAppearance::MozMenulistButton: {
|
||||
moz_gtk_get_combo_box_entry_button_size(&aResult->width,
|
||||
&aResult->height);
|
||||
@ -1621,11 +1638,9 @@ nsNativeThemeGTK::GetMinimumWidgetSize(nsPresContext* aPresContext,
|
||||
case StyleAppearance::RadioLabel:
|
||||
case StyleAppearance::Button:
|
||||
case StyleAppearance::Menulist:
|
||||
case StyleAppearance::MenulistButton:
|
||||
case StyleAppearance::Toolbarbutton:
|
||||
case StyleAppearance::Treeheadercell: {
|
||||
if (aAppearance == StyleAppearance::Menulist ||
|
||||
aAppearance == StyleAppearance::MenulistButton) {
|
||||
if (aAppearance == StyleAppearance::Menulist) {
|
||||
// Include the arrow size.
|
||||
moz_gtk_get_arrow_size(MOZ_GTK_DROPDOWN, &aResult->width,
|
||||
&aResult->height);
|
||||
@ -1805,10 +1820,14 @@ nsNativeThemeGTK::ThemeSupportsWidget(nsPresContext* aPresContext,
|
||||
}
|
||||
}
|
||||
|
||||
if (aAppearance == StyleAppearance::MenulistButton &&
|
||||
StaticPrefs::layout_css_webkit_appearance_enabled()) {
|
||||
aAppearance = StyleAppearance::Menulist;
|
||||
}
|
||||
|
||||
switch (aAppearance) {
|
||||
// Combobox dropdowns don't support native theming in vertical mode.
|
||||
case StyleAppearance::Menulist:
|
||||
case StyleAppearance::MenulistButton:
|
||||
case StyleAppearance::MenulistText:
|
||||
if (aFrame && aFrame->GetWritingMode().IsVertical()) {
|
||||
return false;
|
||||
@ -1914,6 +1933,7 @@ nsNativeThemeGTK::ThemeSupportsWidget(nsPresContext* aPresContext,
|
||||
return gtk_check_version(3, 10, 0) == nullptr &&
|
||||
!IsWidgetStyled(aPresContext, aFrame, aAppearance);
|
||||
|
||||
case StyleAppearance::MenulistButton:
|
||||
case StyleAppearance::MozMenulistButton:
|
||||
if (aFrame && aFrame->GetWritingMode().IsVertical()) {
|
||||
return false;
|
||||
@ -1935,8 +1955,14 @@ nsNativeThemeGTK::ThemeSupportsWidget(nsPresContext* aPresContext,
|
||||
|
||||
NS_IMETHODIMP_(bool)
|
||||
nsNativeThemeGTK::WidgetIsContainer(StyleAppearance aAppearance) {
|
||||
if (aAppearance == StyleAppearance::MenulistButton &&
|
||||
StaticPrefs::layout_css_webkit_appearance_enabled()) {
|
||||
aAppearance = StyleAppearance::Menulist;
|
||||
}
|
||||
|
||||
// XXXdwh At some point flesh all of this out.
|
||||
if (aAppearance == StyleAppearance::MozMenulistButton ||
|
||||
if (aAppearance == StyleAppearance::MenulistButton ||
|
||||
aAppearance == StyleAppearance::MozMenulistButton ||
|
||||
aAppearance == StyleAppearance::Radio ||
|
||||
aAppearance == StyleAppearance::RangeThumb ||
|
||||
aAppearance == StyleAppearance::Checkbox ||
|
||||
@ -1951,8 +1977,12 @@ nsNativeThemeGTK::WidgetIsContainer(StyleAppearance aAppearance) {
|
||||
}
|
||||
|
||||
bool nsNativeThemeGTK::ThemeDrawsFocusForWidget(StyleAppearance aAppearance) {
|
||||
if (aAppearance == StyleAppearance::MenulistButton &&
|
||||
StaticPrefs::layout_css_webkit_appearance_enabled()) {
|
||||
aAppearance = StyleAppearance::Menulist;
|
||||
}
|
||||
|
||||
if (aAppearance == StyleAppearance::Menulist ||
|
||||
aAppearance == StyleAppearance::MenulistButton ||
|
||||
aAppearance == StyleAppearance::Button ||
|
||||
aAppearance == StyleAppearance::Treeheadercell)
|
||||
return true;
|
||||
|
@ -24,6 +24,11 @@ HeadlessThemeGTK::DrawWidgetBackground(gfxContext* aContext, nsIFrame* aFrame,
|
||||
|
||||
LayoutDeviceIntMargin HeadlessThemeGTK::GetWidgetBorder(
|
||||
nsDeviceContext* aContext, nsIFrame* aFrame, StyleAppearance aAppearance) {
|
||||
if (aAppearance == StyleAppearance::MenulistButton &&
|
||||
StaticPrefs::layout_css_webkit_appearance_enabled()) {
|
||||
aAppearance = StyleAppearance::Menulist;
|
||||
}
|
||||
|
||||
LayoutDeviceIntMargin result;
|
||||
// The following values are generated from the Ubuntu GTK theme.
|
||||
switch (aAppearance) {
|
||||
@ -79,13 +84,13 @@ LayoutDeviceIntMargin HeadlessThemeGTK::GetWidgetBorder(
|
||||
result.bottom = 6;
|
||||
result.left = 6;
|
||||
break;
|
||||
case StyleAppearance::MenulistButton:
|
||||
case StyleAppearance::Menulist:
|
||||
result.top = 6;
|
||||
result.right = 22;
|
||||
result.bottom = 6;
|
||||
result.left = 7;
|
||||
break;
|
||||
case StyleAppearance::MenulistButton:
|
||||
case StyleAppearance::MozMenulistButton:
|
||||
result.top = 1;
|
||||
result.right = 1;
|
||||
@ -113,6 +118,11 @@ bool HeadlessThemeGTK::GetWidgetPadding(nsDeviceContext* aContext,
|
||||
nsIFrame* aFrame,
|
||||
StyleAppearance aAppearance,
|
||||
LayoutDeviceIntMargin* aResult) {
|
||||
if (aAppearance == StyleAppearance::MenulistButton &&
|
||||
StaticPrefs::layout_css_webkit_appearance_enabled()) {
|
||||
aAppearance = StyleAppearance::Menulist;
|
||||
}
|
||||
|
||||
// The following values are generated from the Ubuntu GTK theme.
|
||||
switch (aAppearance) {
|
||||
case StyleAppearance::Radio:
|
||||
@ -126,6 +136,7 @@ bool HeadlessThemeGTK::GetWidgetPadding(nsDeviceContext* aContext,
|
||||
case StyleAppearance::ButtonArrowPrevious:
|
||||
case StyleAppearance::TabScrollArrowBack:
|
||||
case StyleAppearance::TabScrollArrowForward:
|
||||
case StyleAppearance::MenulistButton:
|
||||
case StyleAppearance::MozMenulistButton:
|
||||
case StyleAppearance::RangeThumb:
|
||||
case StyleAppearance::ButtonFocus:
|
||||
@ -160,6 +171,11 @@ HeadlessThemeGTK::GetMinimumWidgetSize(nsPresContext* aPresContext,
|
||||
aResult->width = aResult->height = 0;
|
||||
*aIsOverridable = true;
|
||||
|
||||
if (aAppearance == StyleAppearance::MenulistButton &&
|
||||
StaticPrefs::layout_css_webkit_appearance_enabled()) {
|
||||
aAppearance = StyleAppearance::Menulist;
|
||||
}
|
||||
|
||||
// The following values are generated from the Ubuntu GTK theme.
|
||||
switch (aAppearance) {
|
||||
case StyleAppearance::Splitter:
|
||||
@ -259,11 +275,11 @@ HeadlessThemeGTK::GetMinimumWidgetSize(nsPresContext* aPresContext,
|
||||
aResult->height = 31;
|
||||
*aIsOverridable = false;
|
||||
break;
|
||||
case StyleAppearance::MenulistButton:
|
||||
case StyleAppearance::Menulist:
|
||||
aResult->width = 44;
|
||||
aResult->height = 27;
|
||||
break;
|
||||
case StyleAppearance::MenulistButton:
|
||||
case StyleAppearance::MozMenulistButton:
|
||||
aResult->width = 29;
|
||||
aResult->height = 28;
|
||||
@ -313,6 +329,11 @@ NS_IMETHODIMP_(bool)
|
||||
HeadlessThemeGTK::ThemeSupportsWidget(nsPresContext* aPresContext,
|
||||
nsIFrame* aFrame,
|
||||
StyleAppearance aAppearance) {
|
||||
if (aAppearance == StyleAppearance::MenulistButton &&
|
||||
StaticPrefs::layout_css_webkit_appearance_enabled()) {
|
||||
aAppearance = StyleAppearance::Menulist;
|
||||
}
|
||||
|
||||
switch (aAppearance) {
|
||||
case StyleAppearance::Button:
|
||||
case StyleAppearance::Radio:
|
||||
@ -367,7 +388,6 @@ HeadlessThemeGTK::ThemeSupportsWidget(nsPresContext* aPresContext,
|
||||
case StyleAppearance::Textfield:
|
||||
case StyleAppearance::Textarea:
|
||||
case StyleAppearance::Menulist:
|
||||
case StyleAppearance::MenulistButton:
|
||||
case StyleAppearance::MenulistText:
|
||||
case StyleAppearance::MenulistTextfield:
|
||||
case StyleAppearance::ScaleHorizontal:
|
||||
@ -392,6 +412,7 @@ HeadlessThemeGTK::ThemeSupportsWidget(nsPresContext* aPresContext,
|
||||
case StyleAppearance::Menuarrow:
|
||||
case StyleAppearance::MozGtkInfoBar:
|
||||
return !IsWidgetStyled(aPresContext, aFrame, aAppearance);
|
||||
case StyleAppearance::MenulistButton:
|
||||
case StyleAppearance::MozMenulistButton:
|
||||
return (!aFrame ||
|
||||
IsFrameContentNodeInNamespace(aFrame, kNameSpaceID_XUL)) &&
|
||||
@ -404,7 +425,13 @@ HeadlessThemeGTK::ThemeSupportsWidget(nsPresContext* aPresContext,
|
||||
|
||||
NS_IMETHODIMP_(bool)
|
||||
HeadlessThemeGTK::WidgetIsContainer(StyleAppearance aAppearance) {
|
||||
if (aAppearance == StyleAppearance::MozMenulistButton ||
|
||||
if (aAppearance == StyleAppearance::MenulistButton &&
|
||||
StaticPrefs::layout_css_webkit_appearance_enabled()) {
|
||||
aAppearance = StyleAppearance::Menulist;
|
||||
}
|
||||
|
||||
if (aAppearance == StyleAppearance::MenulistButton ||
|
||||
aAppearance == StyleAppearance::MozMenulistButton ||
|
||||
aAppearance == StyleAppearance::Radio ||
|
||||
aAppearance == StyleAppearance::RangeThumb ||
|
||||
aAppearance == StyleAppearance::Checkbox ||
|
||||
|
@ -699,6 +699,8 @@ bool nsNativeBasicTheme::GetWidgetOverflow(nsDeviceContext* aContext,
|
||||
case StyleAppearance::Textarea:
|
||||
case StyleAppearance::Searchfield:
|
||||
case StyleAppearance::Listbox:
|
||||
// NOTE: if you change Menulist and MenulistButton to behave differently,
|
||||
// be sure to handle StaticPrefs::layout_css_webkit_appearance_enabled.
|
||||
case StyleAppearance::Menulist:
|
||||
case StyleAppearance::MenulistButton:
|
||||
case StyleAppearance::MozMenulistButton:
|
||||
@ -839,6 +841,11 @@ nsITheme::ThemeGeometryType nsNativeBasicTheme::ThemeGeometryTypeForWidget(
|
||||
bool nsNativeBasicTheme::ThemeSupportsWidget(nsPresContext* aPresContext,
|
||||
nsIFrame* aFrame,
|
||||
StyleAppearance aAppearance) {
|
||||
if (aAppearance == StyleAppearance::MenulistButton &&
|
||||
StaticPrefs::layout_css_webkit_appearance_enabled()) {
|
||||
aAppearance = StyleAppearance::Menulist;
|
||||
}
|
||||
|
||||
if (IsWidgetScrollbarPart(aAppearance)) {
|
||||
const auto* style = nsLayoutUtils::StyleForScrollbar(aFrame);
|
||||
// We don't currently handle custom scrollbars on nsNativeBasicTheme. We
|
||||
@ -868,9 +875,9 @@ bool nsNativeBasicTheme::ThemeSupportsWidget(nsPresContext* aPresContext,
|
||||
case StyleAppearance::Button:
|
||||
case StyleAppearance::Listbox:
|
||||
case StyleAppearance::Menulist:
|
||||
case StyleAppearance::MenulistButton:
|
||||
case StyleAppearance::MenulistTextfield:
|
||||
case StyleAppearance::NumberInput:
|
||||
case StyleAppearance::MenulistButton:
|
||||
case StyleAppearance::MozMenulistButton:
|
||||
case StyleAppearance::SpinnerUpbutton:
|
||||
case StyleAppearance::SpinnerDownbutton:
|
||||
@ -881,7 +888,13 @@ bool nsNativeBasicTheme::ThemeSupportsWidget(nsPresContext* aPresContext,
|
||||
}
|
||||
|
||||
bool nsNativeBasicTheme::WidgetIsContainer(StyleAppearance aAppearance) {
|
||||
if (aAppearance == StyleAppearance::MenulistButton &&
|
||||
StaticPrefs::layout_css_webkit_appearance_enabled()) {
|
||||
aAppearance = StyleAppearance::Menulist;
|
||||
}
|
||||
|
||||
switch (aAppearance) {
|
||||
case StyleAppearance::MenulistButton:
|
||||
case StyleAppearance::MozMenulistButton:
|
||||
case StyleAppearance::Radio:
|
||||
case StyleAppearance::Checkbox:
|
||||
|
@ -289,7 +289,8 @@ bool nsNativeTheme::IsWidgetStyled(nsPresContext* aPresContext,
|
||||
aAppearance == StyleAppearance::Textarea ||
|
||||
aAppearance == StyleAppearance::Listbox ||
|
||||
aAppearance == StyleAppearance::Menulist ||
|
||||
aAppearance == StyleAppearance::MenulistButton) &&
|
||||
(aAppearance == StyleAppearance::MenulistButton &&
|
||||
StaticPrefs::layout_css_webkit_appearance_enabled())) &&
|
||||
aFrame->GetContent()->IsHTMLElement() &&
|
||||
aPresContext->HasAuthorSpecifiedRules(
|
||||
aFrame,
|
||||
|
@ -746,6 +746,8 @@ mozilla::Maybe<nsUXThemeClass> nsNativeThemeWin::GetThemeClass(
|
||||
case StyleAppearance::Resizerpanel:
|
||||
case StyleAppearance::Resizer:
|
||||
return Some(eUXStatus);
|
||||
// NOTE: if you change Menulist and MenulistButton to behave differently,
|
||||
// be sure to handle StaticPrefs::layout_css_webkit_appearance_enabled.
|
||||
case StyleAppearance::Menulist:
|
||||
case StyleAppearance::MenulistButton:
|
||||
case StyleAppearance::MozMenulistButton:
|
||||
@ -833,6 +835,11 @@ nsresult nsNativeThemeWin::GetThemePartAndState(nsIFrame* aFrame,
|
||||
StyleAppearance aAppearance,
|
||||
int32_t& aPart,
|
||||
int32_t& aState) {
|
||||
if (aAppearance == StyleAppearance::MenulistButton &&
|
||||
StaticPrefs::layout_css_webkit_appearance_enabled()) {
|
||||
aAppearance = StyleAppearance::Menulist;
|
||||
}
|
||||
|
||||
switch (aAppearance) {
|
||||
case StyleAppearance::Button: {
|
||||
aPart = BP_BUTTON;
|
||||
@ -1231,7 +1238,6 @@ nsresult nsNativeThemeWin::GetThemePartAndState(nsIFrame* aFrame,
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
case StyleAppearance::MenulistButton:
|
||||
case StyleAppearance::Menulist: {
|
||||
nsIContent* content = aFrame->GetContent();
|
||||
bool useDropBorder = content && content->IsHTMLElement();
|
||||
@ -1266,6 +1272,7 @@ nsresult nsNativeThemeWin::GetThemePartAndState(nsIFrame* aFrame,
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
case StyleAppearance::MenulistButton:
|
||||
case StyleAppearance::MozMenulistButton: {
|
||||
bool isHTML = IsHTMLContent(aFrame);
|
||||
nsIFrame* parentFrame = aFrame->GetParent();
|
||||
@ -1533,6 +1540,11 @@ nsNativeThemeWin::DrawWidgetBackground(gfxContext* aContext, nsIFrame* aFrame,
|
||||
StyleAppearance aAppearance,
|
||||
const nsRect& aRect,
|
||||
const nsRect& aDirtyRect) {
|
||||
if (aAppearance == StyleAppearance::MenulistButton &&
|
||||
StaticPrefs::layout_css_webkit_appearance_enabled()) {
|
||||
aAppearance = StyleAppearance::Menulist;
|
||||
}
|
||||
|
||||
if (IsWidgetScrollbarPart(aAppearance)) {
|
||||
if (MayDrawCustomScrollbarPart(aContext, aFrame, aAppearance, aRect,
|
||||
aDirtyRect)) {
|
||||
@ -1817,6 +1829,7 @@ RENDER_AGAIN:
|
||||
}
|
||||
// The following widgets need to be RTL-aware
|
||||
else if (aAppearance == StyleAppearance::Resizer ||
|
||||
aAppearance == StyleAppearance::MenulistButton ||
|
||||
aAppearance == StyleAppearance::MozMenulistButton) {
|
||||
DrawThemeBGRTLAware(theme, hdc, part, state, &widgetRect, &clipRect,
|
||||
IsFrameRTL(aFrame));
|
||||
@ -2042,6 +2055,11 @@ bool nsNativeThemeWin::GetWidgetPadding(nsDeviceContext* aContext,
|
||||
nsIFrame* aFrame,
|
||||
StyleAppearance aAppearance,
|
||||
LayoutDeviceIntMargin* aResult) {
|
||||
if (aAppearance == StyleAppearance::MenulistButton &&
|
||||
StaticPrefs::layout_css_webkit_appearance_enabled()) {
|
||||
aAppearance = StyleAppearance::Menulist;
|
||||
}
|
||||
|
||||
switch (aAppearance) {
|
||||
// Radios and checkboxes return a fixed size in GetMinimumWidgetSize
|
||||
// and have a meaningful baseline, so they can't have
|
||||
@ -2116,7 +2134,6 @@ bool nsNativeThemeWin::GetWidgetPadding(nsDeviceContext* aContext,
|
||||
aAppearance == StyleAppearance::NumberInput ||
|
||||
aAppearance == StyleAppearance::Textfield ||
|
||||
aAppearance == StyleAppearance::Textarea ||
|
||||
aAppearance == StyleAppearance::MenulistButton ||
|
||||
aAppearance == StyleAppearance::Menulist) {
|
||||
// If we have author-specified padding for these elements, don't do the
|
||||
// fixups below.
|
||||
@ -2140,8 +2157,7 @@ bool nsNativeThemeWin::GetWidgetPadding(nsDeviceContext* aContext,
|
||||
ScaleForFrameDPI(aResult, aFrame);
|
||||
return ok;
|
||||
} else if (IsHTMLContent(aFrame) &&
|
||||
(aAppearance == StyleAppearance::Menulist ||
|
||||
aAppearance == StyleAppearance::MenulistButton)) {
|
||||
aAppearance == StyleAppearance::Menulist) {
|
||||
/* For content menulist controls, we need an extra pixel so that we have
|
||||
* room to draw our focus rectangle stuff. Otherwise, the focus rect might
|
||||
* overlap the control's border.
|
||||
@ -2248,6 +2264,11 @@ nsNativeThemeWin::GetMinimumWidgetSize(nsPresContext* aPresContext,
|
||||
StyleAppearance aAppearance,
|
||||
LayoutDeviceIntSize* aResult,
|
||||
bool* aIsOverridable) {
|
||||
if (aAppearance == StyleAppearance::MenulistButton &&
|
||||
StaticPrefs::layout_css_webkit_appearance_enabled()) {
|
||||
aAppearance = StyleAppearance::Menulist;
|
||||
}
|
||||
|
||||
aResult->width = aResult->height = 0;
|
||||
*aIsOverridable = true;
|
||||
nsresult rv = NS_OK;
|
||||
@ -2305,6 +2326,7 @@ nsNativeThemeWin::GetMinimumWidgetSize(nsPresContext* aPresContext,
|
||||
case StyleAppearance::ScrollbarbuttonRight:
|
||||
case StyleAppearance::ScrollbarHorizontal:
|
||||
case StyleAppearance::ScrollbarVertical:
|
||||
case StyleAppearance::MenulistButton:
|
||||
case StyleAppearance::MozMenulistButton: {
|
||||
rv = ClassicGetMinimumWidgetSize(aFrame, aAppearance, aResult,
|
||||
aIsOverridable);
|
||||
@ -2489,6 +2511,11 @@ nsNativeThemeWin::WidgetStateChanged(nsIFrame* aFrame,
|
||||
StyleAppearance aAppearance,
|
||||
nsAtom* aAttribute, bool* aShouldRepaint,
|
||||
const nsAttrValue* aOldValue) {
|
||||
if (aAppearance == StyleAppearance::MenulistButton &&
|
||||
StaticPrefs::layout_css_webkit_appearance_enabled()) {
|
||||
aAppearance = StyleAppearance::Menulist;
|
||||
}
|
||||
|
||||
// Some widget types just never change state.
|
||||
if (aAppearance == StyleAppearance::Toolbox ||
|
||||
aAppearance == StyleAppearance::MozWinMediaToolbox ||
|
||||
@ -2526,6 +2553,9 @@ nsNativeThemeWin::WidgetStateChanged(nsIFrame* aFrame,
|
||||
|
||||
// We need to repaint the dropdown arrow in vista HTML combobox controls when
|
||||
// the control is closed to get rid of the hover effect.
|
||||
//
|
||||
// NOTE: if you change Menulist and MenulistButton to behave differently,
|
||||
// be sure to handle StaticPrefs::layout_css_webkit_appearance_enabled.
|
||||
if ((aAppearance == StyleAppearance::Menulist ||
|
||||
aAppearance == StyleAppearance::MenulistButton ||
|
||||
aAppearance == StyleAppearance::MozMenulistButton) &&
|
||||
@ -2592,8 +2622,14 @@ bool nsNativeThemeWin::ThemeSupportsWidget(nsPresContext* aPresContext,
|
||||
}
|
||||
|
||||
bool nsNativeThemeWin::WidgetIsContainer(StyleAppearance aAppearance) {
|
||||
if (aAppearance == StyleAppearance::MenulistButton &&
|
||||
StaticPrefs::layout_css_webkit_appearance_enabled()) {
|
||||
aAppearance = StyleAppearance::Menulist;
|
||||
}
|
||||
|
||||
// XXXdwh At some point flesh all of this out.
|
||||
if (aAppearance == StyleAppearance::MozMenulistButton ||
|
||||
if (aAppearance == StyleAppearance::MenulistButton ||
|
||||
aAppearance == StyleAppearance::MozMenulistButton ||
|
||||
aAppearance == StyleAppearance::Radio ||
|
||||
aAppearance == StyleAppearance::Checkbox)
|
||||
return false;
|
||||
@ -2750,9 +2786,11 @@ bool nsNativeThemeWin::ClassicThemeSupportsWidget(nsIFrame* aFrame,
|
||||
case StyleAppearance::ScaleVertical:
|
||||
case StyleAppearance::ScalethumbHorizontal:
|
||||
case StyleAppearance::ScalethumbVertical:
|
||||
// NOTE: if you change Menulist and MenulistButton to behave differently,
|
||||
// be sure to handle StaticPrefs::layout_css_webkit_appearance_enabled.
|
||||
case StyleAppearance::Menulist:
|
||||
case StyleAppearance::MenulistButton:
|
||||
case StyleAppearance::MenulistTextfield:
|
||||
case StyleAppearance::MenulistButton:
|
||||
case StyleAppearance::MozMenulistButton:
|
||||
case StyleAppearance::InnerSpinButton:
|
||||
case StyleAppearance::SpinnerUpbutton:
|
||||
@ -2796,6 +2834,11 @@ bool nsNativeThemeWin::ClassicThemeSupportsWidget(nsIFrame* aFrame,
|
||||
|
||||
LayoutDeviceIntMargin nsNativeThemeWin::ClassicGetWidgetBorder(
|
||||
nsDeviceContext* aContext, nsIFrame* aFrame, StyleAppearance aAppearance) {
|
||||
if (aAppearance == StyleAppearance::MenulistButton &&
|
||||
StaticPrefs::layout_css_webkit_appearance_enabled()) {
|
||||
aAppearance = StyleAppearance::Menulist;
|
||||
}
|
||||
|
||||
LayoutDeviceIntMargin result;
|
||||
switch (aAppearance) {
|
||||
case StyleAppearance::Groupbox:
|
||||
@ -2809,7 +2852,6 @@ LayoutDeviceIntMargin nsNativeThemeWin::ClassicGetWidgetBorder(
|
||||
case StyleAppearance::Listbox:
|
||||
case StyleAppearance::Treeview:
|
||||
case StyleAppearance::Menulist:
|
||||
case StyleAppearance::MenulistButton:
|
||||
case StyleAppearance::MenulistTextfield:
|
||||
case StyleAppearance::Tab:
|
||||
case StyleAppearance::NumberInput:
|
||||
@ -2889,6 +2931,11 @@ bool nsNativeThemeWin::ClassicGetWidgetPadding(nsDeviceContext* aContext,
|
||||
nsresult nsNativeThemeWin::ClassicGetMinimumWidgetSize(
|
||||
nsIFrame* aFrame, StyleAppearance aAppearance, LayoutDeviceIntSize* aResult,
|
||||
bool* aIsOverridable) {
|
||||
if (aAppearance == StyleAppearance::MenulistButton &&
|
||||
StaticPrefs::layout_css_webkit_appearance_enabled()) {
|
||||
aAppearance = StyleAppearance::Menulist;
|
||||
}
|
||||
|
||||
(*aResult).width = (*aResult).height = 0;
|
||||
*aIsOverridable = true;
|
||||
switch (aAppearance) {
|
||||
@ -2960,11 +3007,11 @@ nsresult nsNativeThemeWin::ClassicGetMinimumWidgetSize(
|
||||
(*aResult).height = 12;
|
||||
*aIsOverridable = false;
|
||||
break;
|
||||
case StyleAppearance::MenulistButton:
|
||||
case StyleAppearance::MozMenulistButton:
|
||||
(*aResult).width = ::GetSystemMetrics(SM_CXVSCROLL);
|
||||
break;
|
||||
case StyleAppearance::Menulist:
|
||||
case StyleAppearance::MenulistButton:
|
||||
case StyleAppearance::Button:
|
||||
case StyleAppearance::Groupbox:
|
||||
case StyleAppearance::Listbox:
|
||||
@ -3081,6 +3128,11 @@ nsresult nsNativeThemeWin::ClassicGetMinimumWidgetSize(
|
||||
nsresult nsNativeThemeWin::ClassicGetThemePartAndState(
|
||||
nsIFrame* aFrame, StyleAppearance aAppearance, int32_t& aPart,
|
||||
int32_t& aState, bool& aFocused) {
|
||||
if (aAppearance == StyleAppearance::MenulistButton &&
|
||||
StaticPrefs::layout_css_webkit_appearance_enabled()) {
|
||||
aAppearance = StyleAppearance::Menulist;
|
||||
}
|
||||
|
||||
aFocused = false;
|
||||
switch (aAppearance) {
|
||||
case StyleAppearance::Button: {
|
||||
@ -3215,7 +3267,6 @@ nsresult nsNativeThemeWin::ClassicGetThemePartAndState(
|
||||
case StyleAppearance::Textfield:
|
||||
case StyleAppearance::Textarea:
|
||||
case StyleAppearance::Menulist:
|
||||
case StyleAppearance::MenulistButton:
|
||||
case StyleAppearance::MenulistTextfield:
|
||||
case StyleAppearance::Range:
|
||||
case StyleAppearance::RangeThumb:
|
||||
@ -3243,6 +3294,7 @@ nsresult nsNativeThemeWin::ClassicGetThemePartAndState(
|
||||
case StyleAppearance::Groupbox:
|
||||
// these don't use DrawFrameControl
|
||||
return NS_OK;
|
||||
case StyleAppearance::MenulistButton:
|
||||
case StyleAppearance::MozMenulistButton: {
|
||||
aPart = DFC_SCROLL;
|
||||
aState = DFCS_SCROLLCOMBOBOX;
|
||||
@ -3635,7 +3687,6 @@ RENDER_AGAIN:
|
||||
case StyleAppearance::Textarea:
|
||||
case StyleAppearance::Listbox:
|
||||
case StyleAppearance::Menulist:
|
||||
case StyleAppearance::MenulistButton:
|
||||
case StyleAppearance::MenulistTextfield: {
|
||||
// Paint the border, except for 'menulist-textfield' that isn't focused:
|
||||
if (aAppearance != StyleAppearance::MenulistTextfield || focused) {
|
||||
@ -3992,8 +4043,8 @@ uint32_t nsNativeThemeWin::GetWidgetNativeDrawingFlags(
|
||||
case StyleAppearance::FocusOutline:
|
||||
case StyleAppearance::Textfield:
|
||||
case StyleAppearance::Textarea:
|
||||
|
||||
case StyleAppearance::Menulist:
|
||||
case StyleAppearance::MenulistButton:
|
||||
case StyleAppearance::MenulistTextfield:
|
||||
return gfxWindowsNativeDrawing::CANNOT_DRAW_TO_COLOR_ALPHA |
|
||||
gfxWindowsNativeDrawing::CAN_AXIS_ALIGNED_SCALE |
|
||||
@ -4002,6 +4053,7 @@ uint32_t nsNativeThemeWin::GetWidgetNativeDrawingFlags(
|
||||
// the dropdown button /almost/ renders correctly with scaling,
|
||||
// except that the graphic in the dropdown button (the downward arrow)
|
||||
// doesn't get scaled up.
|
||||
case StyleAppearance::MenulistButton:
|
||||
case StyleAppearance::MozMenulistButton:
|
||||
// these are definitely no; they're all graphics that don't get scaled up
|
||||
case StyleAppearance::Checkbox:
|
||||
|
Loading…
Reference in New Issue
Block a user