Bug 919355 - Part 2: Don't #include nsDeviceContext.h in Units.h; r=roc
authorEhsan Akhgari <ehsan@mozilla.com>
Mon, 23 Sep 2013 07:55:35 -0400
changeset 148314 172a383a56a71c2a2dc70273b42a7b398827d6e2
parent 148313 f9c12325fff6eb5007d0468b85751fa88e3122f4
child 148315 be8258aa51307ee604ef9c4dfe8de9297f3db5ab
push id2792
push userryanvm@gmail.com
push dateMon, 23 Sep 2013 21:12:51 +0000
treeherderfx-team@701f4afd17d5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs919355
milestone27.0a1
Bug 919355 - Part 2: Don't #include nsDeviceContext.h in Units.h; r=roc
accessible/src/base/TextAttrs.cpp
content/events/src/nsDOMEvent.cpp
content/events/src/nsDOMUIEvent.h
dom/base/nsScreen.cpp
gfx/src/AppUnits.h
layout/base/PositionedEventTargeting.cpp
layout/base/Units.h
layout/forms/nsFormControlFrame.cpp
layout/generic/nsIScrollableFrame.h
layout/style/nsCSSValue.cpp
layout/style/nsComputedDOMStyle.cpp
layout/style/nsMediaFeatures.cpp
layout/xul/base/src/nsPopupBoxObject.cpp
--- a/accessible/src/base/TextAttrs.cpp
+++ b/accessible/src/base/TextAttrs.cpp
@@ -9,16 +9,17 @@
 #include "nsAccUtils.h"
 #include "nsCoreUtils.h"
 #include "StyleInfo.h"
 
 #include "gfxFont.h"
 #include "nsFontMetrics.h"
 #include "nsLayoutUtils.h"
 #include "HyperTextAccessible.h"
+#include "mozilla/AppUnits.h"
 
 using namespace mozilla;
 using namespace mozilla::a11y;
 
 ////////////////////////////////////////////////////////////////////////////////
 // TextAttrsMgr
 ////////////////////////////////////////////////////////////////////////////////
 
@@ -499,17 +500,17 @@ TextAttrsMgr::FontSizeTextAttr::
   //
   // Note: according to IA2, "The conversion doesn't have to be exact.
   // The intent is to give the user a feel for the size of the text."
   //
   // ATK does not specify a unit and will likely follow IA2 here.
   //
   // XXX todo: consider sharing this code with layout module? (bug 474621)
   float px =
-    NSAppUnitsToFloatPixels(aValue, nsDeviceContext::AppUnitsPerCSSPixel());
+    NSAppUnitsToFloatPixels(aValue, mozilla::AppUnitsPerCSSPixel());
   // Each pt is 4/3 of a CSS pixel.
   int pts = NS_lround(px*3/4);
 
   nsAutoString value;
   value.AppendInt(pts);
   value.Append(NS_LITERAL_STRING("pt"));
 
   nsAccUtils::SetAccAttr(aAttributes, nsGkAtoms::font_size, value);
--- a/content/events/src/nsDOMEvent.cpp
+++ b/content/events/src/nsDOMEvent.cpp
@@ -18,16 +18,17 @@
 #include "nsContentUtils.h"
 #include "nsJSEnvironment.h"
 #include "mozilla/Preferences.h"
 #include "nsLayoutUtils.h"
 #include "nsIScrollableFrame.h"
 #include "nsDOMEventTargetHelper.h"
 #include "nsPIWindowRoot.h"
 #include "nsGlobalWindow.h"
+#include "nsDeviceContext.h"
 
 using namespace mozilla;
 using namespace mozilla::dom;
 
 static char *sPopupAllowedEvents;
 
 
 nsDOMEvent::nsDOMEvent(mozilla::dom::EventTarget* aOwner,
--- a/content/events/src/nsDOMUIEvent.h
+++ b/content/events/src/nsDOMUIEvent.h
@@ -7,17 +7,18 @@
 #define nsDOMUIEvent_h
 
 #include "mozilla/Attributes.h"
 #include "nsIDOMUIEvent.h"
 #include "nsDOMEvent.h"
 #include "nsLayoutUtils.h"
 #include "nsEvent.h"
 #include "mozilla/dom/UIEventBinding.h"
-#include "Units.h"
+#include "nsPresContext.h"
+#include "nsDeviceContext.h"
 
 class nsDOMUIEvent : public nsDOMEvent,
                      public nsIDOMUIEvent
 {
   typedef mozilla::CSSIntPoint CSSIntPoint;
 public:
   nsDOMUIEvent(mozilla::dom::EventTarget* aOwner,
                nsPresContext* aPresContext, nsGUIEvent* aEvent);
--- a/dom/base/nsScreen.cpp
+++ b/dom/base/nsScreen.cpp
@@ -8,16 +8,17 @@
 #include "nsIDocShell.h"
 #include "nsPresContext.h"
 #include "nsCOMPtr.h"
 #include "nsIDocShellTreeItem.h"
 #include "nsLayoutUtils.h"
 #include "nsDOMEvent.h"
 #include "nsJSUtils.h"
 #include "mozilla/dom/ScreenBinding.h"
+#include "nsDeviceContext.h"
 
 using namespace mozilla;
 using namespace mozilla::dom;
 
 namespace {
 
 bool
 IsChromeType(nsIDocShell *aDocShell)
--- a/gfx/src/AppUnits.h
+++ b/gfx/src/AppUnits.h
@@ -4,12 +4,12 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef mozilla_AppUnits_h
 #define mozilla_AppUnits_h
 
 #include <stdint.h>
 
 namespace mozilla {
-static int32_t AppUnitsPerCSSPixel() { return 60; }
-static int32_t AppUnitsPerCSSInch() { return 96 * AppUnitsPerCSSPixel(); }
+inline int32_t AppUnitsPerCSSPixel() { return 60; }
+inline int32_t AppUnitsPerCSSInch() { return 96 * AppUnitsPerCSSPixel(); }
 }
 #endif /* _NS_APPUNITS_H_ */
--- a/layout/base/PositionedEventTargeting.cpp
+++ b/layout/base/PositionedEventTargeting.cpp
@@ -7,16 +7,17 @@
 #include "mozilla/Preferences.h"
 #include "nsGUIEvent.h"
 #include "nsLayoutUtils.h"
 #include "nsGkAtoms.h"
 #include "nsEventListenerManager.h"
 #include "nsPrintfCString.h"
 #include "mozilla/dom/Element.h"
 #include "nsRegion.h"
+#include "nsDeviceContext.h"
 #include <algorithm>
 
 namespace mozilla {
 
 /*
  * The basic goal of FindFrameTargetedByInputEvent() is to find a good
  * target element that can respond to mouse events. Both mouse events and touch
  * events are targeted at this element. Note that even for touch events, we
--- a/layout/base/Units.h
+++ b/layout/base/Units.h
@@ -5,17 +5,16 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef MOZ_UNITS_H_
 #define MOZ_UNITS_H_
 
 #include "mozilla/gfx/Point.h"
 #include "mozilla/gfx/Rect.h"
 #include "mozilla/gfx/ScaleFactor.h"
-#include "nsDeviceContext.h"
 #include "nsRect.h"
 #include "nsMargin.h"
 #include "mozilla/AppUnits.h"
 
 namespace mozilla {
 
 struct CSSPixel;
 struct LayoutDevicePixel;
--- a/layout/forms/nsFormControlFrame.cpp
+++ b/layout/forms/nsFormControlFrame.cpp
@@ -4,16 +4,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsFormControlFrame.h"
 #include "nsGkAtoms.h"
 #include "nsLayoutUtils.h"
 #include "nsIDOMHTMLInputElement.h"
 #include "nsEventStateManager.h"
 #include "mozilla/LookAndFeel.h"
+#include "nsDeviceContext.h"
 
 using namespace mozilla;
 
 //#define FCF_NOISY
 
 nsFormControlFrame::nsFormControlFrame(nsStyleContext* aContext) :
   nsLeafFrame(aContext)
 {
--- a/layout/generic/nsIScrollableFrame.h
+++ b/layout/generic/nsIScrollableFrame.h
@@ -19,16 +19,17 @@
 #define NS_DEFAULT_VERTICAL_SCROLL_DISTANCE   3
 #define NS_DEFAULT_HORIZONTAL_SCROLL_DISTANCE 5
 
 class nsBoxLayoutState;
 class nsIScrollPositionListener;
 class nsIFrame;
 class nsPresContext;
 class nsIContent;
+class nsRenderingContext;
 
 /**
  * Interface for frames that are scrollable. This interface exposes
  * APIs for examining scroll state, observing changes to scroll state,
  * and triggering scrolling.
  */
 class nsIScrollableFrame : public nsIScrollbarOwner {
 public:
--- a/layout/style/nsCSSValue.cpp
+++ b/layout/style/nsCSSValue.cpp
@@ -16,16 +16,17 @@
 #include "CSSCalc.h"
 #include "nsNetUtil.h"
 #include "mozilla/MemoryReporting.h"
 #include "mozilla/css/ImageLoader.h"
 #include "mozilla/Likely.h"
 #include "gfxFontConstants.h"
 #include "nsPresContext.h"
 #include "imgRequestProxy.h"
+#include "nsDeviceContext.h"
 
 namespace css = mozilla::css;
 
 nsCSSValue::nsCSSValue(int32_t aValue, nsCSSUnit aUnit)
   : mUnit(aUnit)
 {
   NS_ABORT_IF_FALSE(aUnit == eCSSUnit_Integer || aUnit == eCSSUnit_Enumerated ||
                     aUnit == eCSSUnit_EnumColor, "not an int value");
--- a/layout/style/nsComputedDOMStyle.cpp
+++ b/layout/style/nsComputedDOMStyle.cpp
@@ -38,16 +38,17 @@
 #include "nsCSSKeywords.h"
 #include "nsStyleCoord.h"
 #include "nsDisplayList.h"
 #include "nsDOMCSSDeclaration.h"
 #include "nsStyleTransformMatrix.h"
 #include "mozilla/dom/Element.h"
 #include "prtime.h"
 #include "nsWrapperCacheInlines.h"
+#include "mozilla/AppUnits.h"
 #include <algorithm>
 
 using namespace mozilla;
 using namespace mozilla::dom;
 
 #if defined(DEBUG_bzbarsky) || defined(DEBUG_caillon)
 #define DEBUG_ComputedDOMStyle
 #endif
@@ -1089,17 +1090,17 @@ nsComputedDOMStyle::DoGetTransform()
 
    bool dummy;
    gfx3DMatrix matrix =
      nsStyleTransformMatrix::ReadTransforms(display->mSpecifiedTransform,
                                             mStyleContextHolder,
                                             mStyleContextHolder->PresContext(),
                                             dummy,
                                             bounds,
-                                            float(nsDeviceContext::AppUnitsPerCSSPixel()));
+                                            float(mozilla::AppUnitsPerCSSPixel()));
 
   return MatrixToCSSValue(matrix);
 }
 
 /* static */ nsROCSSPrimitiveValue*
 nsComputedDOMStyle::MatrixToCSSValue(gfx3DMatrix& matrix)
 {
   bool is3D = !matrix.Is2D();
--- a/layout/style/nsMediaFeatures.cpp
+++ b/layout/style/nsMediaFeatures.cpp
@@ -10,16 +10,17 @@
 #include "nsCSSKeywords.h"
 #include "nsStyleConsts.h"
 #include "nsPresContext.h"
 #include "nsCSSValue.h"
 #ifdef XP_WIN
 #include "mozilla/LookAndFeel.h"
 #endif
 #include "nsCSSRuleProcessor.h"
+#include "nsDeviceContext.h"
 
 using namespace mozilla;
 
 static const int32_t kOrientationKeywords[] = {
   eCSSKeyword_portrait,                 NS_STYLE_ORIENTATION_PORTRAIT,
   eCSSKeyword_landscape,                NS_STYLE_ORIENTATION_LANDSCAPE,
   eCSSKeyword_UNKNOWN,                  -1
 };
--- a/layout/xul/base/src/nsPopupBoxObject.cpp
+++ b/layout/xul/base/src/nsPopupBoxObject.cpp
@@ -10,16 +10,17 @@
 #include "nsFrameManager.h"
 #include "nsIContent.h"
 #include "nsIDOMElement.h"
 #include "nsINameSpaceManager.h"
 #include "nsGkAtoms.h"
 #include "nsMenuPopupFrame.h"
 #include "nsClientRect.h"
 #include "nsView.h"
+#include "mozilla/AppUnits.h"
 
 class nsPopupBoxObject : public nsBoxObject,
                          public nsIPopupBoxObject
 {
 public:
   NS_DECL_ISUPPORTS_INHERITED
   NS_DECL_NSIPOPUPBOXOBJECT
 
@@ -358,17 +359,17 @@ nsPopupBoxObject::GetAlignmentPosition(n
 
 NS_IMETHODIMP
 nsPopupBoxObject::GetAlignmentOffset(int32_t *aAlignmentOffset)
 {
   nsMenuPopupFrame *menuPopupFrame = do_QueryFrame(GetFrame(false));
   if (!menuPopupFrame)
     return NS_OK;
 
-  int32_t pp = nsDeviceContext::AppUnitsPerCSSPixel();
+  int32_t pp = mozilla::AppUnitsPerCSSPixel();
   // Note that the offset might be along either the X or Y axis, but for the
   // sake of simplicity we use a point with only the X axis set so we can
   // use ToNearestPixels().
   nsPoint appOffset(menuPopupFrame->GetAlignmentOffset(), 0);
   nsIntPoint popupOffset = appOffset.ToNearestPixels(pp);
   *aAlignmentOffset = popupOffset.x;
   return NS_OK;
 }