Bug 1501483 - Add -webkit-appearance:meter and make that the default for <meter> for compatibility with other UAs. r=jwatt
authorMats Palmgren <mats@mozilla.com>
Fri, 09 Nov 2018 04:25:56 +0100
changeset 445263 06421db62f786b842ff8b739d61a7e883dafd2c3
parent 445262 fa47f2e5c1fbcf2917560713728da87c7c095967
child 445264 55a4f0f8ceaa91b22d1f9698e3f06328d199c2fb
push id109715
push usermpalmgren@mozilla.com
push dateFri, 09 Nov 2018 03:26:09 +0000
treeherdermozilla-inbound@55a4f0f8ceaa [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjwatt
bugs1501483
milestone65.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1501483 - Add -webkit-appearance:meter and make that the default for <meter> for compatibility with other UAs. r=jwatt Keep our old value 'meterbar' as an alias for now, but unship 'meterchunk' by restricting it to UA/chrome sheets only.
devtools/shared/css/generated/properties-db.js
layout/forms/nsMeterFrame.cpp
layout/style/res/forms.css
servo/components/style/values/specified/box.rs
widget/cocoa/nsNativeThemeCocoa.mm
widget/nsNativeTheme.cpp
--- a/devtools/shared/css/generated/properties-db.js
+++ b/devtools/shared/css/generated/properties-db.js
@@ -240,16 +240,17 @@ exports.CSS_PROPERTIES = {
       "menuitemtext",
       "menulist",
       "menulist-button",
       "menulist-text",
       "menulist-textfield",
       "menupopup",
       "menuradio",
       "menuseparator",
+      "meter",
       "meterbar",
       "meterchunk",
       "none",
       "number-input",
       "progressbar",
       "progressbar-vertical",
       "progresschunk",
       "progresschunk-vertical",
@@ -1691,16 +1692,17 @@ exports.CSS_PROPERTIES = {
       "menuitemtext",
       "menulist",
       "menulist-button",
       "menulist-text",
       "menulist-textfield",
       "menupopup",
       "menuradio",
       "menuseparator",
+      "meter",
       "meterbar",
       "meterchunk",
       "none",
       "number-input",
       "progressbar",
       "progressbar-vertical",
       "progresschunk",
       "progresschunk-vertical",
--- a/layout/forms/nsMeterFrame.cpp
+++ b/layout/forms/nsMeterFrame.cpp
@@ -257,16 +257,16 @@ bool
 nsMeterFrame::ShouldUseNativeStyle() const
 {
   nsIFrame* barFrame = mBarDiv->GetPrimaryFrame();
 
   // Use the native style if these conditions are satisfied:
   // - both frames use the native appearance;
   // - neither frame has author specified rules setting the border or the
   //   background.
-  return StyleDisplay()->mAppearance == StyleAppearance::Meterbar &&
+  return StyleDisplay()->mAppearance == StyleAppearance::Meter &&
          !PresContext()->HasAuthorSpecifiedRules(this,
                                                  NS_AUTHOR_SPECIFIED_BORDER | NS_AUTHOR_SPECIFIED_BACKGROUND) &&
          barFrame &&
          barFrame->StyleDisplay()->mAppearance == StyleAppearance::Meterchunk &&
          !PresContext()->HasAuthorSpecifiedRules(barFrame,
                                                  NS_AUTHOR_SPECIFIED_BORDER | NS_AUTHOR_SPECIFIED_BACKGROUND);
 }
--- a/layout/style/res/forms.css
+++ b/layout/style/res/forms.css
@@ -837,17 +837,17 @@ progress {
   height: 100%;
   width: 100%;
 
   /* Default style in case of there is -moz-appearance: none; */
   background-color: #0064b4; /* blue */
 }
 
 meter {
-  -moz-appearance: meterbar;
+  -moz-appearance: meter;
   display: inline-block;
   vertical-align: -0.2em;
 
   background: linear-gradient(#e6e6e6, #e6e6e6, #eeeeee 20%, #cccccc 45%, #cccccc 55%);
 }
 
 ::-moz-meter-bar {
   /* Block styles that would change the type of frame we construct. */
--- a/servo/components/style/values/specified/box.rs
+++ b/servo/components/style/values/specified/box.rs
@@ -1027,18 +1027,20 @@ pub enum Appearance {
     #[parse(condition = "in_ua_or_chrome_sheet")]
     Menuseparator,
     #[parse(condition = "in_ua_or_chrome_sheet")]
     Menuarrow,
     /// An image in the menu gutter, like in bookmarks or history.
     #[parse(condition = "in_ua_or_chrome_sheet")]
     Menuimage,
     /// A horizontal meter bar.
-    Meterbar,
+    #[parse(aliases = "meterbar")]
+    Meter,
     /// The meter bar's meter indicator.
+    #[parse(condition = "in_ua_or_chrome_sheet")]
     Meterchunk,
     /// The "arrowed" part of the dropdown button that open up a dropdown list.
     #[parse(condition = "in_ua_or_chrome_sheet")]
     MozMenulistButton,
     /// For HTML's <input type=number>
     NumberInput,
     /// A horizontal progress bar.
     Progressbar,
--- a/widget/cocoa/nsNativeThemeCocoa.mm
+++ b/widget/cocoa/nsNativeThemeCocoa.mm
@@ -3378,17 +3378,17 @@ nsNativeThemeCocoa::ComputeWidgetInfo(ns
         ComputeProgressParams(aFrame, eventState,
                               !IsVerticalProgress(aFrame))));
     }
 
     case StyleAppearance::ProgressbarVertical:
       return Some(WidgetInfo::ProgressBar(
         ComputeProgressParams(aFrame, eventState, false)));
 
-    case StyleAppearance::Meterbar:
+    case StyleAppearance::Meter:
       return Some(WidgetInfo::Meter(ComputeMeterParams(aFrame)));
 
     case StyleAppearance::Progresschunk:
     case StyleAppearance::ProgresschunkVertical:
     case StyleAppearance::Meterchunk:
       // Do nothing: progress and meter bars cases will draw chunks.
       break;
 
@@ -3884,17 +3884,17 @@ nsNativeThemeCocoa::CreateWebRenderComma
     case StyleAppearance::MenulistButton:
     case StyleAppearance::MozMenulistButton:
     case StyleAppearance::Groupbox:
     case StyleAppearance::Textfield:
     case StyleAppearance::NumberInput:
     case StyleAppearance::Searchfield:
     case StyleAppearance::Progressbar:
     case StyleAppearance::ProgressbarVertical:
-    case StyleAppearance::Meterbar:
+    case StyleAppearance::Meter:
     case StyleAppearance::Treetwisty:
     case StyleAppearance::Treetwistyopen:
     case StyleAppearance::Treeheadercell:
     case StyleAppearance::Treeitem:
     case StyleAppearance::Treeview:
     case StyleAppearance::ScaleHorizontal:
     case StyleAppearance::ScaleVertical:
     case StyleAppearance::Range:
@@ -4193,17 +4193,17 @@ nsNativeThemeCocoa::GetWidgetOverflow(ns
       break;
     }
     case StyleAppearance::Progressbar:
     {
       // Progress bars draw a 2 pixel white shadow under their progress indicators.
       overflow.bottom = 2;
       break;
     }
-    case StyleAppearance::Meterbar:
+    case StyleAppearance::Meter:
     {
       // Meter bars overflow their boxes by about 2 pixels.
       overflow.SizeTo(2, 2, 2, 2);
       break;
     }
     default:
       break;
   }
@@ -4564,17 +4564,17 @@ nsNativeThemeCocoa::WidgetStateChanged(n
     case StyleAppearance::Tabpanel:
     case StyleAppearance::Dialog:
     case StyleAppearance::Menupopup:
     case StyleAppearance::Groupbox:
     case StyleAppearance::Progresschunk:
     case StyleAppearance::ProgresschunkVertical:
     case StyleAppearance::Progressbar:
     case StyleAppearance::ProgressbarVertical:
-    case StyleAppearance::Meterbar:
+    case StyleAppearance::Meter:
     case StyleAppearance::Meterchunk:
     case StyleAppearance::MozMacVibrancyLight:
     case StyleAppearance::MozMacVibrancyDark:
     case StyleAppearance::MozMacVibrantTitlebarLight:
     case StyleAppearance::MozMacVibrantTitlebarDark:
       *aShouldRepaint = false;
       return NS_OK;
     default:
@@ -4682,17 +4682,17 @@ nsNativeThemeCocoa::ThemeSupportsWidget(
     case StyleAppearance::TextfieldMultiline:
     case StyleAppearance::Searchfield:
     case StyleAppearance::Toolbox:
     //case StyleAppearance::Toolbarbutton:
     case StyleAppearance::Progressbar:
     case StyleAppearance::ProgressbarVertical:
     case StyleAppearance::Progresschunk:
     case StyleAppearance::ProgresschunkVertical:
-    case StyleAppearance::Meterbar:
+    case StyleAppearance::Meter:
     case StyleAppearance::Meterchunk:
     case StyleAppearance::Separator:
 
     case StyleAppearance::Tabpanels:
     case StyleAppearance::Tab:
 
     case StyleAppearance::Treetwisty:
     case StyleAppearance::Treetwistyopen:
@@ -4771,17 +4771,17 @@ nsNativeThemeCocoa::WidgetIsContainer(St
 
   // flesh this out at some point
   switch (aAppearance) {
    case StyleAppearance::MenulistButton:
    case StyleAppearance::MozMenulistButton:
    case StyleAppearance::Radio:
    case StyleAppearance::Checkbox:
    case StyleAppearance::Progressbar:
-   case StyleAppearance::Meterbar:
+   case StyleAppearance::Meter:
    case StyleAppearance::Range:
    case StyleAppearance::MozMacHelpButton:
    case StyleAppearance::MozMacDisclosureButtonOpen:
    case StyleAppearance::MozMacDisclosureButtonClosed:
     return false;
    default:
     break;
   }
--- a/widget/nsNativeTheme.cpp
+++ b/widget/nsNativeTheme.cpp
@@ -310,17 +310,17 @@ nsNativeTheme::IsWidgetStyled(nsPresCont
     }
   }
 
   /**
    * Meter bar appearance should be the same for the bar and the container
    * frame. nsMeterFrame owns the logic and will tell us what we should do.
    */
   if (aAppearance == StyleAppearance::Meterchunk ||
-      aAppearance == StyleAppearance::Meterbar) {
+      aAppearance == StyleAppearance::Meter) {
     nsMeterFrame* meterFrame =
       do_QueryFrame(aAppearance == StyleAppearance::Meterchunk
                       ? aFrame->GetParent() : aFrame);
     if (meterFrame) {
       return !meterFrame->ShouldUseNativeStyle();
     }
   }