Fix max texture size handling in displayport clamping. (bug 1135907 follow-up, r=kats)
authorDavid Anderson <danderson@mozilla.com>
Mon, 23 Mar 2015 12:34:21 -0700
changeset 265445 1aa2afb3de8f616bbadc0539428b00c5649a613b
parent 265444 283cce9dbda09a6d67bd431bcfa299df0e213496
child 265446 8e5d8f34c53eecd8838576830403ef2ec7322245
push id830
push userraliiev@mozilla.com
push dateFri, 19 Jun 2015 19:24:37 +0000
treeherdermozilla-release@932614382a68 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskats
bugs1135907
milestone39.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
Fix max texture size handling in displayport clamping. (bug 1135907 follow-up, r=kats)
layout/base/nsLayoutUtils.cpp
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -843,17 +843,20 @@ GetMaxDisplayPortSize(nsIContent* aConte
     return nscoord_MAX;
   }
   LayerManager* lm = widget->GetLayerManager();
   if (!lm) {
     return nscoord_MAX;
   }
   nsPresContext* presContext = frame->PresContext();
 
-  uint32_t maxSizeInDevPixels = lm->GetMaxTextureSize();
+  int32_t maxSizeInDevPixels = lm->GetMaxTextureSize();
+  if (maxSizeInDevPixels < 0 || maxSizeInDevPixels == INT_MAX) {
+    return nscoord_MAX;
+  }
   return presContext->DevPixelsToAppUnits(maxSizeInDevPixels);
 }
 
 static nsRect
 GetDisplayPortFromRectData(nsIContent* aContent,
                            DisplayPortPropertyData* aRectData,
                            float aMultiplier)
 {
@@ -1048,21 +1051,19 @@ GetDisplayPortImpl(nsIContent* aContent,
     result = GetDisplayPortFromRectData(aContent, rectData, aMultiplier);
   } else {
     result = GetDisplayPortFromMarginsData(aContent, marginsData, aMultiplier);
   }
 
   if (!gfxPrefs::LayersTilesEnabled()) {
     // Either we should have gotten a valid rect directly from the displayport
     // base, or we should have computed a valid rect from the margins.
-    NS_ASSERTION(GetMaxDisplayPortSize(aContent) <= 0 ||
-                 result.width < GetMaxDisplayPortSize(aContent),
+    NS_ASSERTION(result.width <= GetMaxDisplayPortSize(aContent),
                  "Displayport must be a valid texture size");
-    NS_ASSERTION(GetMaxDisplayPortSize(aContent) <= 0 ||
-                 result.height < GetMaxDisplayPortSize(aContent),
+    NS_ASSERTION(result.height <= GetMaxDisplayPortSize(aContent),
                  "Displayport must be a valid texture size");
   }
 
   *aResult = result;
   return true;
 }
 
 bool