Bug 959847. Part 3. Make zoom items be contained in resolution items for subdocuments if they occur together. r=roc
authorTimothy Nikkel <tnikkel@gmail.com>
Thu, 27 Feb 2014 16:01:52 -0600
changeset 171555 522ba2d5437b8866ce6bbd3582c1eae3cb400404
parent 171554 ffb2d1363821b26766c088adefa48c17a9b0ecdd
child 171556 95590431aebb015eb2f2e6c9e00c7e2a39bdfb16
push id270
push userpvanderbeken@mozilla.com
push dateThu, 06 Mar 2014 09:24:21 +0000
reviewersroc
bugs959847
milestone30.0a1
Bug 959847. Part 3. Make zoom items be contained in resolution items for subdocuments if they occur together. r=roc Wrap the zoom item in the resolution item if we have both because we want the resolution scale applied on top of the app units per dev pixel conversion. Resolution is just a scale transform and app units per dev pixel affect layout, so conceptually the resolution gets applied after.
layout/generic/nsSubDocumentFrame.cpp
--- a/layout/generic/nsSubDocumentFrame.cpp
+++ b/layout/generic/nsSubDocumentFrame.cpp
@@ -458,31 +458,33 @@ nsSubDocumentFrame::BuildDisplayList(nsD
           bounds, NS_RGBA(0,0,0,0), flags);
       }
     }
   }
 
   // Generate a resolution and/or zoom item if needed. If one or both of those is
   // created, we don't need to create a separate nsDisplayOwnLayer.
 
-  if (constructResolutionItem) {
-    nsDisplayResolution* resolutionItem =
-      new (aBuilder) nsDisplayResolution(aBuilder, subdocRootFrame, &childItems,
-                                         nsDisplayOwnLayer::GENERATE_SUBDOC_INVALIDATIONS);
-    childItems.AppendToTop(resolutionItem);
-    needsOwnLayer = false;
-  }
   if (constructZoomItem) {
     nsDisplayZoom* zoomItem =
       new (aBuilder) nsDisplayZoom(aBuilder, subdocRootFrame, &childItems,
                                    subdocAPD, parentAPD,
                                    nsDisplayOwnLayer::GENERATE_SUBDOC_INVALIDATIONS);
     childItems.AppendToTop(zoomItem);
     needsOwnLayer = false;
   }
+  // Wrap the zoom item in the resolution item if we have both because we want the
+  // resolution scale applied on top of the app units per dev pixel conversion.
+  if (constructResolutionItem) {
+    nsDisplayResolution* resolutionItem =
+      new (aBuilder) nsDisplayResolution(aBuilder, subdocRootFrame, &childItems,
+                                         nsDisplayOwnLayer::GENERATE_SUBDOC_INVALIDATIONS);
+    childItems.AppendToTop(resolutionItem);
+    needsOwnLayer = false;
+  }
   if (needsOwnLayer) {
     // We always want top level content documents to be in their own layer.
     nsDisplayOwnLayer* layerItem = new (aBuilder) nsDisplayOwnLayer(
       aBuilder, subdocRootFrame ? subdocRootFrame : this,
       &childItems, nsDisplayOwnLayer::GENERATE_SUBDOC_INVALIDATIONS);
     childItems.AppendToTop(layerItem);
   }