Bug 656284 - Fix clipped XUL progressmeter on Windows. r=roc
authorMounir Lamouri <mounir.lamouri@gmail.com>
Mon, 16 May 2011 12:19:27 +0200
changeset 69573 93656440018a325eb9e3467e3847b7e4e943a2ea
parent 69572 81bd19f483d04fc514a251d801974257b031ff8c
child 69574 357a308588cdf8382c03582e2cf38ac964eae979
push idunknown
push userunknown
push dateunknown
reviewersroc
bugs656284
milestone6.0a1
Bug 656284 - Fix clipped XUL progressmeter on Windows. r=roc
layout/reftests/forms/progress/style.css
layout/style/forms.css
widget/reftests/progressbar-fallback-default-style-ref.html
widget/src/windows/nsNativeThemeWin.cpp
--- a/layout/reftests/forms/progress/style.css
+++ b/layout/reftests/forms/progress/style.css
@@ -18,15 +18,17 @@ div.progress-bar {
   -moz-appearance: progresschunk;
   height: 100%;
   /*
    * We can't apply the following style to the reference because it will have
    * underisable effectes:
    * width: 100%;
    */
 
+  -moz-box-sizing: border-box;
+
   /* Default style in case of there is -moz-appearance: none; */
   background-color: ThreeDShadow;
 }
 
 progress, progress::-moz-progress-bar, div.progress-element, div.progress-bar {
   -moz-appearance: none;
 }
--- a/layout/style/forms.css
+++ b/layout/style/forms.css
@@ -674,16 +674,17 @@ progress {
 }
 
 ::-moz-progress-bar {
   /* Block styles that would change the type of frame we construct. */
   display: inline-block ! important;
   float: none ! important;
   position: static ! important;
   overflow: visible ! important;
+  -moz-box-sizing: border-box ! important;
 
   -moz-appearance: progresschunk;
   height: 100%;
   width: 100%;
 
   /* Default style in case of there is -moz-appearance: none; */
   background-color: ThreeDShadow;
 }
--- a/widget/reftests/progressbar-fallback-default-style-ref.html
+++ b/widget/reftests/progressbar-fallback-default-style-ref.html
@@ -24,16 +24,18 @@
       /**
        * The purpose of this test is to not show the native style.
        * -moz-appearance: progresschunk;
        */
 
       height: 100%;
       width: 100%;
 
+      -moz-box-sizing: border-box;
+
       /* Default style in case of there is -moz-appearance: none; */
       background-color: ThreeDShadow;
     }
 
     div.progress-element { padding: 5px; }
     body > div:nth-child(1)  { -moz-appearance: none; }
     body > div:nth-child(2) > .progress-bar { -moz-appearance: none; }
     body > div:nth-child(3)  { background-color: red; }
--- a/widget/src/windows/nsNativeThemeWin.cpp
+++ b/widget/src/windows/nsNativeThemeWin.cpp
@@ -344,24 +344,16 @@ static CaptionButtonPadding buttonData[3
   }
 };
 
 /**
  * Progress bar related constants.
  * These values are found by experimenting and comparing against native widgets
  * used by the system. They are very unlikely exact but try to not be too wrong.
  */
-// PP_CHUNK is overflowing on the bottom for no appearant reasons.
-// This is a fix around this issue.
-static const PRInt32 kProgressDeterminedXPOverflow = 11;
-// Same thing but for PP_FILL.
-static const PRInt32 kProgressDeterminedVistaOverflow = 4;
-// Same thing but for indeterminate progress bar.
-// The value is the same for PP_CHUNK and PP_MOVEOVERLAY in that case.
-static const PRInt32 kProgressIndeterminateOverflow = 2;
 // The width of the overlay used to animate the progress bar (Vista and later).
 static const PRInt32 kProgressVistaOverlayWidth = 120;
 // The width of the overlay used to for indeterminate progress bars on XP.
 static const PRInt32 kProgressXPOverlayWidth = 55;
 // Speed (px per ms) of the animation for determined Vista and later progress bars.
 static const double kProgressDeterminedVistaSpeed = 0.225;
 // Speed (px per ms) of the animation for indeterminate progress bars.
 static const double kProgressIndeterminateSpeed = 0.175;
@@ -1321,24 +1313,16 @@ RENDER_AGAIN:
     OffsetBackgroundRect(widgetRect, CAPTIONBUTTON_MINIMIZE);
   }
   else if (aWidgetType == NS_THEME_WINDOW_BUTTON_MAXIMIZE ||
            aWidgetType == NS_THEME_WINDOW_BUTTON_RESTORE) {
     OffsetBackgroundRect(widgetRect, CAPTIONBUTTON_RESTORE);
   }
   else if (aWidgetType == NS_THEME_WINDOW_BUTTON_CLOSE) {
     OffsetBackgroundRect(widgetRect, CAPTIONBUTTON_CLOSE);
-  } else if (aWidgetType == NS_THEME_PROGRESSBAR_CHUNK) {
-    nsIFrame* stateFrame = aFrame->GetParent();
-    nsEventStates eventStates = GetContentState(stateFrame, aWidgetType);
-    widgetRect.bottom -= IsIndeterminateProgress(stateFrame, eventStates)
-                           ? kProgressIndeterminateOverflow
-                           : nsUXThemeData::sIsVistaOrLater
-                             ? kProgressDeterminedVistaOverflow
-                             : kProgressDeterminedXPOverflow;
   }
 
   // widgetRect is the bounding box for a widget, yet the scale track is only
   // a small portion of this size, so the edges of the scale need to be
   // adjusted to the real size of the track.
   if (aWidgetType == NS_THEME_SCALE_HORIZONTAL ||
       aWidgetType == NS_THEME_SCALE_VERTICAL) {
     RECT contentRect;