Bug 749658 - Distinguish scrollable from visual bounds for nsTextBoxFrame. r=roc
authorJonathan Kew <jkew@mozilla.com>
Sun, 29 Apr 2012 20:34:09 -0400
changeset 92682 cfaf90b22fc3c05025890bd1acfab2c49ec77594
parent 92681 32a0e99932b293a9413c299ed3a616718d9c68c9
child 92720 0a796d07499adcd22fdbfc31950b56d5ecdfdd37
child 92744 fee74fe8354c552cbc852697f3517ca56ae8e780
child 93469 005a5bfe547406d6cb7d76b90dabd56ee65fc036
push id22550
push userryanvm@gmail.com
push dateMon, 30 Apr 2012 00:34:23 +0000
treeherdermozilla-central@cfaf90b22fc3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs749658
milestone15.0a1
first release with
nightly linux32
cfaf90b22fc3 / 15.0a1 / 20120430030504 / files
nightly linux64
cfaf90b22fc3 / 15.0a1 / 20120430030504 / files
nightly mac
cfaf90b22fc3 / 15.0a1 / 20120430030504 / files
nightly win32
cfaf90b22fc3 / 15.0a1 / 20120430030504 / files
nightly win64
cfaf90b22fc3 / 15.0a1 / 20120430030504 / files
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 749658 - Distinguish scrollable from visual bounds for nsTextBoxFrame. r=roc
layout/xul/base/src/nsTextBoxFrame.cpp
--- a/layout/xul/base/src/nsTextBoxFrame.cpp
+++ b/layout/xul/base/src/nsTextBoxFrame.cpp
@@ -926,37 +926,40 @@ nsTextBoxFrame::DoLayout(nsBoxLayoutStat
     }
 
     nsresult rv = nsLeafBoxFrame::DoLayout(aBoxLayoutState);
 
     CalcDrawRect(*aBoxLayoutState.GetRenderingContext());
 
     const nsStyleText* textStyle = GetStyleText();
     
-    nsRect bounds(nsPoint(0, 0), GetSize());
+    nsRect scrollBounds(nsPoint(0, 0), GetSize());
     nsRect textRect = mTextDrawRect;
     
     nsRefPtr<nsFontMetrics> fontMet;
     nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fontMet));
     nsBoundingMetrics metrics = 
-      fontMet->GetInkBoundsForVisualOverflow(mTitle.get(), mTitle.Length(),
+      fontMet->GetInkBoundsForVisualOverflow(mCroppedTitle.get(),
+                                             mCroppedTitle.Length(),
                                              aBoxLayoutState.GetRenderingContext());
 
     textRect.x -= metrics.leftBearing;
     textRect.width = metrics.width;
     // In DrawText() we always draw with the baseline at MaxAscent() (relative to mTextDrawRect), 
     textRect.y += fontMet->MaxAscent() - metrics.ascent;
     textRect.height = metrics.ascent + metrics.descent;
 
-    bounds.UnionRect(bounds, textRect);
-    nsOverflowAreas overflow(bounds, bounds);
+    // Our scrollable overflow is our bounds; our visual overflow may
+    // extend beyond that.
+    nsRect visualBounds;
+    visualBounds.UnionRect(scrollBounds, textRect);
+    nsOverflowAreas overflow(visualBounds, scrollBounds);
 
     if (textStyle->mTextShadow) {
-      // Our scrollable overflow is our bounds; our visual overflow may
-      // extend beyond that.
+      // text-shadow extends our visual but not scrollable bounds
       nsRect &vis = overflow.VisualOverflow();
       vis.UnionRect(vis, nsLayoutUtils::GetTextShadowRectsUnion(mTextDrawRect, this));
     }
     FinishAndStoreOverflow(overflow, GetSize());
 
     return rv;
 }