Backed out changeset df2290db92d0 (
bug 1117210) for breaking m5 tests on a CLOSED TREE
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -5094,29 +5094,16 @@ nsLayoutUtils::GetSnappedBaselineY(nsIFr
gfxFloat appUnitsPerDevUnit = aFrame->PresContext()->AppUnitsPerDevPixel();
gfxFloat baseline = gfxFloat(aY) + aAscent;
gfxRect putativeRect(0, baseline/appUnitsPerDevUnit, 1, 1);
if (!aContext->UserToDevicePixelSnapped(putativeRect, true))
return baseline;
return aContext->DeviceToUser(putativeRect.TopLeft()).y * appUnitsPerDevUnit;
}
-gfxFloat
-nsLayoutUtils::GetSnappedBaselineX(nsIFrame* aFrame, gfxContext* aContext,
- nscoord aX, nscoord aAscent)
-{
- gfxFloat appUnitsPerDevUnit = aFrame->PresContext()->AppUnitsPerDevPixel();
- gfxFloat baseline = gfxFloat(aX) + aAscent;
- gfxRect putativeRect(baseline / appUnitsPerDevUnit, 0, 1, 1);
- if (!aContext->UserToDevicePixelSnapped(putativeRect, true)) {
- return baseline;
- }
- return aContext->DeviceToUser(putativeRect.TopLeft()).x * appUnitsPerDevUnit;
-}
-
// Hard limit substring lengths to 8000 characters ... this lets us statically
// size the cluster buffer array in FindSafeLength
#define MAX_GFX_TEXT_BUF_SIZE 8000
static int32_t FindSafeLength(const char16_t *aString, uint32_t aLength,
uint32_t aMaxChunkLength)
{
if (aLength <= aMaxChunkLength)
--- a/layout/base/nsLayoutUtils.h
+++ b/layout/base/nsLayoutUtils.h
@@ -1471,20 +1471,16 @@ public:
nsRenderingContext* aRenderingContext);
// Get a suitable foreground color for painting aProperty for aFrame.
static nscolor GetColor(nsIFrame* aFrame, nsCSSProperty aProperty);
// Get a baseline y position in app units that is snapped to device pixels.
static gfxFloat GetSnappedBaselineY(nsIFrame* aFrame, gfxContext* aContext,
nscoord aY, nscoord aAscent);
- // Ditto for an x position (for vertical text). Note that for vertical-rl
- // writing mode, the ascent value should be negated by the caller.
- static gfxFloat GetSnappedBaselineX(nsIFrame* aFrame, gfxContext* aContext,
- nscoord aX, nscoord aAscent);
static nscoord AppUnitWidthOfString(char16_t aC,
nsFontMetrics& aFontMetrics,
nsRenderingContext& aContext) {
return AppUnitWidthOfString(&aC, 1, aFontMetrics, aContext);
}
static nscoord AppUnitWidthOfString(const nsString& aString,
nsFontMetrics& aFontMetrics,
--- a/layout/generic/nsBulletFrame.cpp
+++ b/layout/generic/nsBulletFrame.cpp
@@ -415,29 +415,23 @@ nsBulletFrame::PaintBullet(nsRenderingCo
nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm),
GetFontSizeInflation());
nsAutoString text;
GetListItemText(text);
WritingMode wm = GetWritingMode();
nscoord ascent = wm.IsLineInverted()
? fm->MaxDescent() : fm->MaxAscent();
aPt.MoveBy(padding.left, padding.top);
- gfxContext *ctx = aRenderingContext.ThebesContext();
if (wm.IsVertical()) {
- if (wm.IsVerticalLR()) {
- aPt.x = NSToCoordRound(nsLayoutUtils::GetSnappedBaselineX(
- this, ctx, aPt.x, ascent));
- } else {
- aPt.x = NSToCoordRound(nsLayoutUtils::GetSnappedBaselineX(
- this, ctx, aPt.x + mRect.width,
- -ascent));
- }
+ // XXX what about baseline snapping?
+ aPt.x += (wm.IsVerticalLR() ? ascent
+ : mRect.width - ascent);
} else {
aPt.y = NSToCoordRound(nsLayoutUtils::GetSnappedBaselineY(
- this, ctx, aPt.y, ascent));
+ this, aRenderingContext.ThebesContext(), aPt.y, ascent));
}
nsPresContext* presContext = PresContext();
if (!presContext->BidiEnabled() && HasRTLChars(text)) {
presContext->SetBidiEnabled();
}
nsLayoutUtils::DrawString(this, *fm, &aRenderingContext,
text.get(), text.Length(), aPt);
}
--- a/layout/generic/nsTextFrame.cpp
+++ b/layout/generic/nsTextFrame.cpp
@@ -6123,25 +6123,19 @@ nsTextFrame::PaintText(nsRenderingContex
gfxContext* ctx = aRenderingContext->ThebesContext();
const bool rtl = mTextRun->IsRightToLeft();
const bool verticalRun = mTextRun->IsVertical();
WritingMode wm = GetWritingMode();
const nscoord frameWidth = GetSize().width;
gfxPoint framePt(aPt.x, aPt.y);
gfxPoint textBaselinePt;
if (verticalRun) {
- if (wm.IsVerticalLR()) {
- textBaselinePt.x =
- nsLayoutUtils::GetSnappedBaselineX(this, ctx, aPt.x, mAscent);
- } else {
- textBaselinePt.x =
- nsLayoutUtils::GetSnappedBaselineX(this, ctx, aPt.x + frameWidth,
- -mAscent);
- }
- textBaselinePt.y = rtl ? aPt.y + GetSize().height : aPt.y;
+ textBaselinePt = // XXX sideways-left will need different handling here
+ gfxPoint(aPt.x + (wm.IsVerticalLR() ? mAscent : frameWidth - mAscent),
+ rtl ? aPt.y + GetSize().height : aPt.y);
} else {
textBaselinePt = gfxPoint(rtl ? gfxFloat(aPt.x + frameWidth) : framePt.x,
nsLayoutUtils::GetSnappedBaselineY(this, ctx, aPt.y, mAscent));
}
uint32_t startOffset = provider.GetStart().GetSkippedOffset();
uint32_t maxLength = ComputeTransformedLength(provider);
nscoord snappedLeftEdge, snappedRightEdge;
if (!MeasureCharClippedText(provider, aItem.mLeftEdge, aItem.mRightEdge,