Bug 1028716 part 3 - Widget updates to support the extended set of -moz-orient values. r=roc
authorJonathan Kew <jkew@mozilla.com>
Tue, 24 Jun 2014 19:26:13 +0100
changeset 240542 f9810c65cd6979f6624b39b6c0afbbef6b3eaf7a
parent 240541 7a39e04e9ab173781b721f5a7818df73683dde35
child 240543 03da3b6d21b959dfd20ac08f29bc337c0eab27bd
push id28636
push userkwierso@gmail.com
push dateThu, 23 Apr 2015 00:16:12 +0000
treeherdermozilla-central@a5af73b32ac8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs1028716
milestone40.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 1028716 part 3 - Widget updates to support the extended set of -moz-orient values. r=roc
widget/cocoa/nsNativeThemeCocoa.mm
widget/gtk/nsNativeThemeGTK.cpp
widget/nsNativeTheme.cpp
--- a/widget/cocoa/nsNativeThemeCocoa.mm
+++ b/widget/cocoa/nsNativeThemeCocoa.mm
@@ -2667,17 +2667,17 @@ nsNativeThemeCocoa::DrawWidgetBackground
       double maxValue = GetProgressMaxValue(aFrame);
       // Don't request repaints for scrollbars at 100% because those don't animate.
       if (value < maxValue) {
         if (!QueueAnimatedContentForRefresh(aFrame->GetContent(), 30)) {
           NS_WARNING("Unable to animate progressbar!");
         }
       }
       DrawProgress(cgContext, macRect, IsIndeterminateProgress(aFrame, eventState),
-                   aFrame->StyleDisplay()->mOrient != NS_STYLE_ORIENT_VERTICAL,
+                   !IsVerticalProgress(aFrame),
                    value, maxValue, aFrame);
       break;
     }
 
     case NS_THEME_PROGRESSBAR_VERTICAL:
       DrawProgress(cgContext, macRect, IsIndeterminateProgress(aFrame, eventState),
                    false, GetProgressValue(aFrame),
                    GetProgressMaxValue(aFrame), aFrame);
--- a/widget/gtk/nsNativeThemeGTK.cpp
+++ b/widget/gtk/nsNativeThemeGTK.cpp
@@ -592,17 +592,17 @@ nsNativeThemeGTK::GetGtkWidgetAndState(u
     break;
   case NS_THEME_PROGRESSBAR_CHUNK:
   case NS_THEME_PROGRESSBAR_CHUNK_VERTICAL:
     {
       nsIFrame* stateFrame = aFrame->GetParent();
       EventStates eventStates = GetContentState(stateFrame, aWidgetType);
 
       aGtkWidgetType = IsIndeterminateProgress(stateFrame, eventStates)
-                         ? (stateFrame->StyleDisplay()->mOrient == NS_STYLE_ORIENT_VERTICAL)
+                         ? IsVerticalProgress(stateFrame)
                            ? MOZ_GTK_PROGRESS_CHUNK_VERTICAL_INDETERMINATE
                            : MOZ_GTK_PROGRESS_CHUNK_INDETERMINATE
                          : MOZ_GTK_PROGRESS_CHUNK;
     }
     break;
   case NS_THEME_TAB_SCROLLARROW_BACK:
   case NS_THEME_TAB_SCROLLARROW_FORWARD:
     if (aWidgetFlags)
--- a/widget/nsNativeTheme.cpp
+++ b/widget/nsNativeTheme.cpp
@@ -552,25 +552,38 @@ nsNativeTheme::IsIndeterminateProgress(n
   return aFrame->GetContent()->AttrValueIs(kNameSpaceID_None, nsGkAtoms::mode,
                                            NS_LITERAL_STRING("undetermined"),
                                            eCaseMatters);
 }
 
 bool
 nsNativeTheme::IsVerticalProgress(nsIFrame* aFrame)
 {
-  return aFrame &&
-         aFrame->StyleDisplay()->mOrient == NS_STYLE_ORIENT_VERTICAL;
+  if (!aFrame) {
+    return false;
+  }
+  return IsVerticalMeter(aFrame);
 }
 
 bool
 nsNativeTheme::IsVerticalMeter(nsIFrame* aFrame)
 {
   NS_PRECONDITION(aFrame, "You have to pass a non-null aFrame");
-  return aFrame->StyleDisplay()->mOrient == NS_STYLE_ORIENT_VERTICAL;
+  switch (aFrame->StyleDisplay()->mOrient) {
+    case NS_STYLE_ORIENT_HORIZONTAL:
+      return false;
+    case NS_STYLE_ORIENT_VERTICAL:
+      return true;
+    case NS_STYLE_ORIENT_INLINE:
+      return aFrame->GetWritingMode().IsVertical();
+    case NS_STYLE_ORIENT_BLOCK:
+      return !aFrame->GetWritingMode().IsVertical();
+  }
+  NS_NOTREACHED("unexpected -moz-orient value");
+  return false;
 }
 
 // menupopup:
 bool
 nsNativeTheme::IsSubmenu(nsIFrame* aFrame, bool* aLeftOfParent)
 {
   if (!aFrame)
     return false;