Bug 655877 - Part 31c: Ensure SVG text with effects applied to them are in the right position. r=jwatt
authorCameron McCormack <cam@mcc.id.au>
Mon, 11 Feb 2013 17:22:17 +1100
changeset 131365 53005a0154076fbad15da799ebaafb6f1f5bc5ca
parent 131364 76dd3bdc30dfbb249c8d59fe694a2f64d76560cb
child 131366 0e81334f73d1137a7d412e5216d80888ba42d03f
push id2323
push userbbajaj@mozilla.com
push dateMon, 01 Apr 2013 19:47:02 +0000
treeherdermozilla-beta@7712be144d91 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjwatt
bugs655877
milestone21.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
Bug 655877 - Part 31c: Ensure SVG text with effects applied to them are in the right position. r=jwatt
layout/svg/nsSVGIntegrationUtils.cpp
layout/svg/nsSVGUtils.cpp
--- a/layout/svg/nsSVGIntegrationUtils.cpp
+++ b/layout/svg/nsSVGIntegrationUtils.cpp
@@ -460,17 +460,18 @@ nsSVGIntegrationUtils::PaintFramesWithEf
 
   gfxContext* gfx = aCtx->ThebesContext();
   gfxContextMatrixAutoSaveRestore matrixAutoSaveRestore(gfx);
 
   nsPoint firstFrameOffset = GetOffsetToUserSpace(firstFrame);
   nsPoint offset = aBuilder->ToReferenceFrame(firstFrame) - firstFrameOffset;
   nsPoint offsetWithoutSVGGeomFramePos = offset;
   nsPoint svgGeomFramePos;
-  if (aFrame->IsFrameOfType(nsIFrame::eSVGGeometry)) {
+  if (aFrame->IsFrameOfType(nsIFrame::eSVGGeometry) ||
+      aFrame->IsSVGText()) {
     // SVG leaf frames apply their offset themselves, we need to unapply it at
     // various points below to prevent it being double counted.
     svgGeomFramePos = aFrame->GetPosition();
     offsetWithoutSVGGeomFramePos -= svgGeomFramePos;
   }
 
   aCtx->Translate(offsetWithoutSVGGeomFramePos);
 
--- a/layout/svg/nsSVGUtils.cpp
+++ b/layout/svg/nsSVGUtils.cpp
@@ -790,17 +790,18 @@ nsSVGUtils::PaintFrameWithEffects(nsRend
 
   if (aDirtyRect &&
       !(aFrame->GetStateBits() & NS_STATE_SVG_NONDISPLAY_CHILD)) {
     // Here we convert aFrame's paint bounds to outer-<svg> device space,
     // compare it to aDirtyRect, and return early if they don't intersect.
     // We don't do this optimization for nondisplay SVG since nondisplay
     // SVG doesn't maintain bounds/overflow rects.
     nsRect overflowRect = aFrame->GetVisualOverflowRectRelativeToSelf();
-    if (aFrame->IsFrameOfType(nsIFrame::eSVGGeometry)) {
+    if (aFrame->IsFrameOfType(nsIFrame::eSVGGeometry) ||
+        aFrame->IsSVGText()) {
       // Unlike containers, leaf frames do not include GetPosition() in
       // GetCanvasTM().
       overflowRect = overflowRect + aFrame->GetPosition();
     }
     uint32_t appUnitsPerDevPx = aFrame->PresContext()->AppUnitsPerDevPixel();
     gfxMatrix tm = GetCanvasTM(aFrame, nsISVGChildFrame::FOR_PAINTING);
     if (aFrame->IsFrameOfType(nsIFrame::eSVG | nsIFrame::eSVGContainer)) {
       gfxMatrix childrenOnlyTM;
@@ -860,17 +861,18 @@ nsSVGUtils::PaintFrameWithEffects(nsRend
     complexEffects = true;
     gfx->Save();
     if (!(aFrame->GetStateBits() & NS_STATE_SVG_NONDISPLAY_CHILD)) {
       // aFrame has a valid visual overflow rect, so clip to it before calling
       // PushGroup() to minimize the size of the surfaces we'll composite:
       gfxContextMatrixAutoSaveRestore matrixAutoSaveRestore(gfx);
       gfx->Multiply(GetCanvasTM(aFrame, nsISVGChildFrame::FOR_PAINTING));
       nsRect overflowRect = aFrame->GetVisualOverflowRectRelativeToSelf();
-      if (aFrame->IsFrameOfType(nsIFrame::eSVGGeometry)) {
+      if (aFrame->IsFrameOfType(nsIFrame::eSVGGeometry) ||
+          aFrame->IsSVGText()) {
         // Unlike containers, leaf frames do not include GetPosition() in
         // GetCanvasTM().
         overflowRect = overflowRect + aFrame->GetPosition();
       }
       aContext->IntersectClip(overflowRect);
     }
     gfx->PushGroup(gfxASurface::CONTENT_COLOR_ALPHA);
   }