Bug 649849, part 1 - Make -moz-appearance:none on a combobox remove the dropdown button (for WebKit compat). r=roc
authorMats Palmgren <matspal@gmail.com>
Thu, 02 Oct 2014 13:05:15 +0000
changeset 208387 161e4dbfff7d
parent 208386 e845072de8df
child 208388 e2d1b98b34e6
push id27582
push userryanvm@gmail.com
push date2014-10-02 16:20 +0000
treeherdermozilla-central@5d6ec4dddf14 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs649849
milestone35.0a1
Bug 649849, part 1 - Make -moz-appearance:none on a combobox remove the dropdown button (for WebKit compat). r=roc
layout/forms/nsComboboxControlFrame.cpp
layout/reftests/native-theme/combobox-nonnative-when-styled-ref.html
layout/reftests/native-theme/combobox-nonnative-when-styled.html
layout/reftests/text-overflow/combobox-zoom-ref.html
layout/reftests/text-overflow/combobox-zoom.html
--- a/layout/forms/nsComboboxControlFrame.cpp
+++ b/layout/forms/nsComboboxControlFrame.cpp
@@ -26,16 +26,17 @@
 #include "nsListControlFrame.h"
 #include "nsAutoPtr.h"
 #include "nsStyleSet.h"
 #include "nsNodeInfoManager.h"
 #include "nsContentCreatorFunctions.h"
 #include "nsLayoutUtils.h"
 #include "nsDisplayList.h"
 #include "nsITheme.h"
+#include "nsThemeConstants.h"
 #include "nsRenderingContext.h"
 #include "mozilla/Likely.h"
 #include <algorithm>
 #include "nsTextNode.h"
 #include "mozilla/AsyncEventDispatcher.h"
 #include "mozilla/EventStates.h"
 #include "mozilla/LookAndFeel.h"
 #include "mozilla/MouseEvents.h"
@@ -729,18 +730,21 @@ nsComboboxControlFrame::GetIntrinsicISiz
     dropdownContentWidth = NSCoordSaturatingSubtract(dropdownContentWidth,
                                                      scrollbarWidth,
                                                      nscoord_MAX);
 
     displayWidth = std::max(dropdownContentWidth, displayWidth);
   }
 
   // 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;
 
 }
 
 nscoord
 nsComboboxControlFrame::GetMinISize(nsRenderingContext *aRenderingContext)
 {
@@ -808,17 +812,18 @@ nsComboboxControlFrame::Reflow(nsPresCon
     // it's released in its ReflowFinished / ReflowCallbackCanceled.
     unused << resize.forget();
   }
 
   // Get the width of the vertical scrollbar.  That will be the width of the
   // 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 {
     nsIScrollableFrame* scrollable = do_QueryFrame(mListControlFrame);
     NS_ASSERTION(scrollable, "List must be a scrollable frame");
     buttonWidth = scrollable->GetNondisappearingScrollbarWidth(
       PresContext(), aReflowState.rendContext);
     if (buttonWidth > aReflowState.ComputedWidth()) {
--- a/layout/reftests/native-theme/combobox-nonnative-when-styled-ref.html
+++ b/layout/reftests/native-theme/combobox-nonnative-when-styled-ref.html
@@ -1,17 +1,21 @@
 <!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>
 <select size="1"></select>
--- a/layout/reftests/native-theme/combobox-nonnative-when-styled.html
+++ b/layout/reftests/native-theme/combobox-nonnative-when-styled.html
@@ -1,17 +1,21 @@
 <!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>
 <select size="1" style="font-weight: normal"></select>
--- a/layout/reftests/text-overflow/combobox-zoom-ref.html
+++ b/layout/reftests/text-overflow/combobox-zoom-ref.html
@@ -14,21 +14,21 @@ html,body {
   color:black; background-color:white; padding:0; margin:0;
 }
 * {
   font-family:DejaVuSansMono!important;
   font-size:16px!important;
 }
 select {
   width: 200px;
-  padding-right: 7px;
+  padding-right: 8px;
 
   -moz-appearance: none;
 }
 </style>
 </head>
 <body>
 <select></select><br>
 
-<select><option>long string long </option></select>
+<select><option>long string long s</option></select>
 
 </body>
 </html>
--- a/layout/reftests/text-overflow/combobox-zoom.html
+++ b/layout/reftests/text-overflow/combobox-zoom.html
@@ -14,17 +14,17 @@ html,body {
   color:black; background-color:white; padding:0; margin:0;
 }
 * {
   font-family:DejaVuSansMono!important;
   font-size:16px!important;
 }
 select {
   width: 200px;
-  padding-right: 7px;
+  padding-right: 8px;
   text-overflow: " ";
   -moz-appearance: none;
 }
 </style>
 </head>
 <body>
 <select></select><br>