Bug 596765, patch 3: Skip chunk of nsLayoutUtils::PaintFrame that's intended for root frames but gets triggered for foreignObjects in SVG-as-an-image. r+a=roc
authorDaniel Holbert <dholbert@cs.stanford.edu>
Thu, 17 Feb 2011 16:33:31 -0800
changeset 62806 762e8424548c9940984797f2c1887d358d27a6ad
parent 62805 680f69bed54ddb46e3895815a361e13e17730876
child 62807 58cfb5629c44cdb4a83d16a5d82898d3becd335c
push id1
push userroot
push dateTue, 10 Dec 2013 15:46:25 +0000
bugs596765
milestone2.0b12pre
Bug 596765, patch 3: Skip chunk of nsLayoutUtils::PaintFrame that's intended for root frames but gets triggered for foreignObjects in SVG-as-an-image. r+a=roc
layout/base/nsLayoutUtils.cpp
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -1393,18 +1393,29 @@ nsLayoutUtils::PaintFrame(nsIRenderingCo
   if (aFlags & PAINT_IGNORE_SUPPRESSION) {
     builder.IgnorePaintSuppression();
   }
   if (aRenderingContext &&
       aRenderingContext->ThebesContext()->GetFlags() & gfxContext::FLAG_DISABLE_SNAPPING) {
     builder.SetSnappingEnabled(PR_FALSE);
   }
   nsRect canvasArea(nsPoint(0, 0), aFrame->GetSize());
+
+#ifdef DEBUG
   if (ignoreViewportScrolling) {
-    NS_ASSERTION(!aFrame->GetParent(), "must have root frame");
+    nsIDocument* doc = aFrame->GetContent() ?
+      aFrame->GetContent()->GetCurrentDoc() : nsnull;
+    NS_ASSERTION(!aFrame->GetParent() ||
+                 (doc && doc->IsBeingUsedAsImage()),
+                 "Only expecting ignoreViewportScrolling for root frames and "
+                 "for image documents.");
+  }
+#endif
+
+  if (ignoreViewportScrolling && !aFrame->GetParent()) {
     nsIFrame* rootScrollFrame = presShell->GetRootScrollFrame();
     if (rootScrollFrame) {
       nsIScrollableFrame* rootScrollableFrame =
         presShell->GetRootScrollFrameAsScrollable();
       if (aFlags & PAINT_DOCUMENT_RELATIVE) {
         // Make visibleRegion and aRenderingContext relative to the
         // scrolled frame instead of the root frame.
         nsPoint pos = rootScrollableFrame->GetScrollPosition();