Bug 649849, part 1 - Make -moz-appearance:none on a combobox remove the dropdown button (for WebKit compat). r=roc

This commit is contained in:
Mats Palmgren 2014-10-02 13:05:15 +00:00
parent 2d856071d9
commit 07a9c2f713
5 changed files with 40 additions and 27 deletions

View File

@ -31,6 +31,7 @@
#include "nsLayoutUtils.h"
#include "nsDisplayList.h"
#include "nsITheme.h"
#include "nsThemeConstants.h"
#include "nsRenderingContext.h"
#include "mozilla/Likely.h"
#include <algorithm>
@ -734,8 +735,11 @@ nsComboboxControlFrame::GetIntrinsicISize(nsRenderingContext* aRenderingContext,
}
// add room for the dropmarker button if there is one
if (!IsThemed() || presContext->GetTheme()->ThemeNeedsComboboxDropmarker())
if ((!IsThemed() ||
presContext->GetTheme()->ThemeNeedsComboboxDropmarker()) &&
StyleDisplay()->mAppearance != NS_THEME_NONE) {
displayWidth += scrollbarWidth;
}
return displayWidth;
@ -813,7 +817,8 @@ nsComboboxControlFrame::Reflow(nsPresContext* aPresContext,
// dropdown button.
nscoord buttonWidth;
const nsStyleDisplay *disp = StyleDisplay();
if (IsThemed(disp) && !aPresContext->GetTheme()->ThemeNeedsComboboxDropmarker()) {
if ((IsThemed(disp) && !aPresContext->GetTheme()->ThemeNeedsComboboxDropmarker()) ||
StyleDisplay()->mAppearance == NS_THEME_NONE) {
buttonWidth = 0;
}
else {

View File

@ -1,16 +1,20 @@
<!DOCTYPE HTML>
<div style="position:relative">
<!-- mask the dropdown button -->
<div style="position:absolute; width:50px; left:7px; top:0; bottom:0; background:black;"></div>
<!-- these should make the select non-native -->
<select size="1" style="-moz-appearance: none; border-width: 0"></select>
<select size="1" style="-moz-appearance: none; border-width: 1px"></select>
<select size="1" style="-moz-appearance: none; border-width: 2px"></select>
<select size="1" style="-moz-appearance: none; border-width: 3px"></select>
<select size="1" style="-moz-appearance: none; border-width: 4px"></select>
<select size="1" style="-moz-appearance: none; border-width: 5px"></select>
<select size="1" style="-moz-appearance: none; border-width: 6px"></select>
<select size="1" style="-moz-appearance: none; border-style: dotted"></select>
<select size="1" style="-moz-appearance: none; border-color: green"></select>
<select size="1" style="-moz-appearance: none; background-color: transparent"></select>
<select size="1" style="-moz-appearance: none; background-color: white"></select>
<select size="1" style="-moz-appearance: none; border-width: 0"></select><br>
<select size="1" style="-moz-appearance: none; border-width: 1px"></select><br>
<select size="1" style="-moz-appearance: none; border-width: 2px"></select><br>
<select size="1" style="-moz-appearance: none; border-width: 3px"></select><br>
<select size="1" style="-moz-appearance: none; border-width: 4px"></select><br>
<select size="1" style="-moz-appearance: none; border-width: 5px"></select><br>
<select size="1" style="-moz-appearance: none; border-width: 6px"></select><br>
<select size="1" style="-moz-appearance: none; border-style: dotted"></select><br>
<select size="1" style="-moz-appearance: none; border-color: green"></select><br>
<select size="1" style="-moz-appearance: none; background-color: transparent"></select><br>
<select size="1" style="-moz-appearance: none; background-color: white"></select><br>
</div>
<!-- these should let it stay native -->
<select size="1"></select>

View File

@ -1,16 +1,20 @@
<!DOCTYPE HTML>
<div style="position:relative">
<!-- mask the dropdown button -->
<div style="position:absolute; width:50px; left:7px; top:0; bottom:0; background:black;"></div>
<!-- these should make the select non-native -->
<select size="1" style="border-width: 0"></select>
<select size="1" style="border-width: 1px"></select>
<select size="1" style="border-width: 2px"></select>
<select size="1" style="border-width: 3px"></select>
<select size="1" style="border-width: 4px"></select>
<select size="1" style="border-width: 5px"></select>
<select size="1" style="border-width: 6px"></select>
<select size="1" style="border-style: dotted"></select>
<select size="1" style="border-color: green"></select>
<select size="1" style="background-color: transparent"></select>
<select size="1" style="background-color: white"></select>
<select size="1" style="border-width: 0"></select><br>
<select size="1" style="border-width: 1px"></select><br>
<select size="1" style="border-width: 2px"></select><br>
<select size="1" style="border-width: 3px"></select><br>
<select size="1" style="border-width: 4px"></select><br>
<select size="1" style="border-width: 5px"></select><br>
<select size="1" style="border-width: 6px"></select><br>
<select size="1" style="border-style: dotted"></select><br>
<select size="1" style="border-color: green"></select><br>
<select size="1" style="background-color: transparent"></select><br>
<select size="1" style="background-color: white"></select><br>
</div>
<!-- these should let it stay native -->
<select size="1" style="color: black"></select>

View File

@ -19,7 +19,7 @@ html,body {
}
select {
width: 200px;
padding-right: 7px;
padding-right: 8px;
-moz-appearance: none;
}
@ -28,7 +28,7 @@ select {
<body>
<select></select><br>
<select><option>long string long </option></select>
<select><option>long string long s</option></select>
</body>
</html>

View File

@ -19,7 +19,7 @@ html,body {
}
select {
width: 200px;
padding-right: 7px;
padding-right: 8px;
text-overflow: " ";
-moz-appearance: none;
}