merge backout
authorJim Mathies <jmathies@mozilla.com>
Sat, 02 Nov 2013 16:42:10 -0500
changeset 153220 47c8e9b1691836988fa0bfd91af4cc3f3d1083a4
parent 153218 d8fd5706493e19bcb85443316a4c180849f5d247 (current diff)
parent 153219 cfbb290b559381b2c8f308eab313e196aade9a21 (diff)
child 153284 fc3414dda7558dd2aebacbf7df28aad95474fa96
push id25577
push userjmathies@mozilla.com
push dateSat, 02 Nov 2013 23:05:52 +0000
treeherdermozilla-central@47c8e9b16918 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
milestone28.0a1
first release with
nightly linux32
47c8e9b16918 / 28.0a1 / 20131103030204 / files
nightly linux64
47c8e9b16918 / 28.0a1 / 20131103030204 / files
nightly mac
47c8e9b16918 / 28.0a1 / 20131103030204 / files
nightly win32
47c8e9b16918 / 28.0a1 / 20131103030204 / files
nightly win64
47c8e9b16918 / 28.0a1 / 20131103030204 / files
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
merge backout
--- a/widget/windows/winrt/FrameworkView.cpp
+++ b/widget/windows/winrt/FrameworkView.cpp
@@ -253,17 +253,16 @@ void
 FrameworkView::UpdateWidgetSizeAndPosition()
 {
   if (mShuttingDown)
     return;
 
   NS_ASSERTION(mWindow, "SetWindow must be called before UpdateWidgetSizeAndPosition!");
   NS_ASSERTION(mWidget, "SetWidget must be called before UpdateWidgetSizeAndPosition!");
 
-  UpdateBounds();
   mWidget->Move(0, 0);
   mWidget->Resize(0, 0, mWindowBounds.width, mWindowBounds.height, true);
   mWidget->SizeModeChanged();
 }
 
 bool
 FrameworkView::IsEnabled() const
 {
@@ -280,53 +279,39 @@ FrameworkView::IsVisible() const
 }
 
 void FrameworkView::SetDpi(float aDpi)
 {
   if (aDpi != mDPI) {
     LogFunction();
 
     mDPI = aDpi;
+    // Often a DPI change implies a window size change.
+    NS_ASSERTION(mWindow, "SetWindow must be called before SetDpi!");
+    Rect logicalBounds;
+    mWindow->get_Bounds(&logicalBounds);
+
+    // convert to physical (device) pixels
+    mWindowBounds = MetroUtils::LogToPhys(logicalBounds);
 
     // notify the widget that dpi has changed
     if (mWidget) {
       mWidget->ChangedDPI();
-      UpdateBounds();
     }
   }
 }
 
 void
-FrameworkView::UpdateBounds()
-{
-  if (!mWidget)
-    return;
-
-  RECT winRect;
-  GetClientRect(mWidget->GetICoreWindowHWND(), &winRect);
-
-  Rect logicalBounds;
-  logicalBounds.X = winRect.left;
-  logicalBounds.Y = winRect.top;
-  logicalBounds.Width = winRect.right - winRect.left; 
-  logicalBounds.Height = winRect.bottom - winRect.top;
-
-  // convert to physical (device) pixels
-  mWindowBounds = MetroUtils::LogToPhys(logicalBounds);
-}
-
-void
 FrameworkView::SetWidget(MetroWidget* aWidget)
 {
   NS_ASSERTION(!mWidget, "Attempting to set a widget for a view that already has a widget!");
   NS_ASSERTION(aWidget, "Attempting to set a null widget for a view!");
   LogFunction();
   mWidget = aWidget;
   mWidget->FindMetroWindow();
-  UpdateBounds();
 }
 
 ////////////////////////////////////////////////////
 // Event handlers
 
 void
 FrameworkView::SendActivationEvent() 
 {
@@ -404,16 +389,21 @@ HRESULT
 FrameworkView::OnWindowSizeChanged(ICoreWindow* aSender, IWindowSizeChangedEventArgs* aArgs)
 {
   LogFunction();
 
   if (mShuttingDown) {
     return S_OK;
   }
 
+  NS_ASSERTION(mWindow, "SetWindow must be called before OnWindowSizeChanged!");
+  Rect logicalBounds;
+  mWindow->get_Bounds(&logicalBounds);
+  mWindowBounds = MetroUtils::LogToPhys(logicalBounds);
+
   UpdateWidgetSizeAndPosition();
   return S_OK;
 }
 
 HRESULT
 FrameworkView::OnWindowActivated(ICoreWindow* aSender, IWindowActivatedEventArgs* aArgs)
 {
   LogFunction();
--- a/widget/windows/winrt/FrameworkView.h
+++ b/widget/windows/winrt/FrameworkView.h
@@ -145,17 +145,16 @@ protected:
   void FileActivated(Microsoft::WRL::ComPtr<IFileActivatedEventArgs>& aArgs, bool aStartup);
   void LaunchActivated(Microsoft::WRL::ComPtr<ILaunchActivatedEventArgs>& aArgs, bool aStartup);
   void ProcessActivationArgs(IActivatedEventArgs* aArgs, bool aStartup);
   void UpdateForWindowSizeChange();
   void SendActivationEvent();
   void UpdateLogicalDPI();
   void FireViewStateObservers();
   void ProcessLaunchArguments();
-  void UpdateBounds();
 
   // Printing and preview
   void CreatePrintControl(IPrintDocumentPackageTarget* aDocPackageTarget, 
                           D2D1_PRINT_CONTROL_PROPERTIES* aPrintControlProperties);
   HRESULT ClosePrintControl();
   void PrintPage(uint32_t aPageNumber, D2D1_RECT_F aImageableArea,
                  D2D1_SIZE_F aPageSize, IStream* aPagePrintTicketStream);
   void AddEventHandlers();