зеркало из https://github.com/mozilla/gecko-dev.git
Bug 641426. Part 3: Convert gfxRect::pos/size to x/y/width/height. r=joe,sr=cjones
This commit is contained in:
Родитель
8498002a49
Коммит
1c5c997eb5
|
@ -2769,7 +2769,7 @@ nsCanvasRenderingContext2D::DrawOrMeasureText(const nsAString& aRawText,
|
|||
processor.mPt.y += anchorY;
|
||||
|
||||
// correct bounding box to get it to be the correct size/position
|
||||
processor.mBoundingBox.size.width = totalWidth;
|
||||
processor.mBoundingBox.width = totalWidth;
|
||||
processor.mBoundingBox.MoveBy(processor.mPt);
|
||||
|
||||
processor.mPt.x *= processor.mAppUnitsPerDevPixel;
|
||||
|
|
|
@ -344,7 +344,7 @@ public:
|
|||
gfxRect snap(0, 0, 0, 0);
|
||||
if (mContainer) {
|
||||
gfxIntSize size = mContainer->GetCurrentSize();
|
||||
snap.size = gfxSize(size.width, size.height);
|
||||
snap.SizeTo(gfxSize(size.width, size.height));
|
||||
}
|
||||
// Snap our local transform first, and snap the inherited transform as well.
|
||||
// This makes our snapping equivalent to what would happen if our content
|
||||
|
|
|
@ -308,26 +308,26 @@ ConditionRect(gfxRect& r) {
|
|||
return PR_FALSE;
|
||||
|
||||
if (r.X() < 0.0) {
|
||||
r.size.width += r.X();
|
||||
if (r.size.width < 0.0)
|
||||
r.width += r.X();
|
||||
if (r.width < 0.0)
|
||||
return PR_FALSE;
|
||||
r.pos.x = 0.0;
|
||||
r.x = 0.0;
|
||||
}
|
||||
|
||||
if (r.XMost() > CAIRO_COORD_MAX) {
|
||||
r.size.width = CAIRO_COORD_MAX - r.X();
|
||||
r.width = CAIRO_COORD_MAX - r.X();
|
||||
}
|
||||
|
||||
if (r.Y() < 0.0) {
|
||||
r.size.height += r.Y();
|
||||
r.height += r.Y();
|
||||
if (r.Height() < 0.0)
|
||||
return PR_FALSE;
|
||||
|
||||
r.pos.y = 0.0;
|
||||
r.y = 0.0;
|
||||
}
|
||||
|
||||
if (r.YMost() > CAIRO_COORD_MAX) {
|
||||
r.size.height = CAIRO_COORD_MAX - r.Y();
|
||||
r.height = CAIRO_COORD_MAX - r.Y();
|
||||
}
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
|
|
@ -362,8 +362,8 @@ gfxRect
|
|||
gfxContext::DeviceToUser(const gfxRect& rect) const
|
||||
{
|
||||
gfxRect ret = rect;
|
||||
cairo_device_to_user(mCairo, &ret.pos.x, &ret.pos.y);
|
||||
cairo_device_to_user_distance(mCairo, &ret.size.width, &ret.size.height);
|
||||
cairo_device_to_user(mCairo, &ret.x, &ret.y);
|
||||
cairo_device_to_user_distance(mCairo, &ret.width, &ret.height);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
@ -3624,12 +3624,12 @@ gfxTextRun::AccumulatePartialLigatureMetrics(gfxFont *aFont,
|
|||
// Where we are going to start "drawing" relative to our left baseline origin
|
||||
gfxFloat origin = IsRightToLeft() ? metrics.mAdvanceWidth - data.mPartAdvance : 0;
|
||||
ClipPartialLigature(this, &bboxLeft, &bboxRight, origin, &data);
|
||||
metrics.mBoundingBox.pos.x = bboxLeft;
|
||||
metrics.mBoundingBox.size.width = bboxRight - bboxLeft;
|
||||
metrics.mBoundingBox.x = bboxLeft;
|
||||
metrics.mBoundingBox.width = bboxRight - bboxLeft;
|
||||
|
||||
// mBoundingBox is now relative to the left baseline origin for the entire
|
||||
// ligature. Shift it left.
|
||||
metrics.mBoundingBox.pos.x -=
|
||||
metrics.mBoundingBox.x -=
|
||||
IsRightToLeft() ? metrics.mAdvanceWidth - (data.mPartAdvance + data.mPartWidth)
|
||||
: data.mPartAdvance;
|
||||
metrics.mAdvanceWidth = data.mPartWidth;
|
||||
|
|
|
@ -97,10 +97,10 @@ PRBool
|
|||
gfxRect::WithinEpsilonOfIntegerPixels(gfxFloat aEpsilon) const
|
||||
{
|
||||
NS_ASSERTION(-0.5 < aEpsilon && aEpsilon < 0.5, "Nonsense epsilon value");
|
||||
return (WithinEpsilonOfInteger(pos.x, aEpsilon) &&
|
||||
WithinEpsilonOfInteger(pos.y, aEpsilon) &&
|
||||
WithinEpsilonOfInteger(size.width, aEpsilon) &&
|
||||
WithinEpsilonOfInteger(size.height, aEpsilon));
|
||||
return (WithinEpsilonOfInteger(x, aEpsilon) &&
|
||||
WithinEpsilonOfInteger(y, aEpsilon) &&
|
||||
WithinEpsilonOfInteger(width, aEpsilon) &&
|
||||
WithinEpsilonOfInteger(height, aEpsilon));
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -112,11 +112,11 @@ gfxRect::Round()
|
|||
gfxFloat x1 = NS_floor(XMost() + 0.5);
|
||||
gfxFloat y1 = NS_floor(YMost() + 0.5);
|
||||
|
||||
pos.x = x0;
|
||||
pos.y = y0;
|
||||
x = x0;
|
||||
y = y0;
|
||||
|
||||
size.width = x1 - x0;
|
||||
size.height = y1 - y0;
|
||||
width = x1 - x0;
|
||||
height = y1 - y0;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -127,11 +127,11 @@ gfxRect::RoundIn()
|
|||
gfxFloat x1 = NS_floor(XMost());
|
||||
gfxFloat y1 = NS_floor(YMost());
|
||||
|
||||
pos.x = x0;
|
||||
pos.y = y0;
|
||||
x = x0;
|
||||
y = y0;
|
||||
|
||||
size.width = x1 - x0;
|
||||
size.height = y1 - y0;
|
||||
width = x1 - x0;
|
||||
height = y1 - y0;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -142,11 +142,11 @@ gfxRect::RoundOut()
|
|||
gfxFloat x1 = NS_ceil(XMost());
|
||||
gfxFloat y1 = NS_ceil(YMost());
|
||||
|
||||
pos.x = x0;
|
||||
pos.y = y0;
|
||||
x = x0;
|
||||
y = y0;
|
||||
|
||||
size.width = x1 - x0;
|
||||
size.height = y1 - y0;
|
||||
width = x1 - x0;
|
||||
height = y1 - y0;
|
||||
}
|
||||
|
||||
/* Clamp r to CAIRO_COORD_MIN .. CAIRO_COORD_MAX
|
||||
|
@ -164,35 +164,35 @@ gfxRect::Condition()
|
|||
{
|
||||
// if either x or y is way out of bounds;
|
||||
// note that we don't handle negative w/h here
|
||||
if (pos.x > CAIRO_COORD_MAX) {
|
||||
pos.x = CAIRO_COORD_MAX;
|
||||
size.width = 0.0;
|
||||
if (x > CAIRO_COORD_MAX) {
|
||||
x = CAIRO_COORD_MAX;
|
||||
width = 0.0;
|
||||
}
|
||||
|
||||
if (pos.y > CAIRO_COORD_MAX) {
|
||||
pos.y = CAIRO_COORD_MAX;
|
||||
size.height = 0.0;
|
||||
if (y > CAIRO_COORD_MAX) {
|
||||
y = CAIRO_COORD_MAX;
|
||||
height = 0.0;
|
||||
}
|
||||
|
||||
if (pos.x < CAIRO_COORD_MIN) {
|
||||
size.width += pos.x - CAIRO_COORD_MIN;
|
||||
if (size.width < 0.0)
|
||||
size.width = 0.0;
|
||||
pos.x = CAIRO_COORD_MIN;
|
||||
if (x < CAIRO_COORD_MIN) {
|
||||
width += x - CAIRO_COORD_MIN;
|
||||
if (width < 0.0)
|
||||
width = 0.0;
|
||||
x = CAIRO_COORD_MIN;
|
||||
}
|
||||
|
||||
if (pos.y < CAIRO_COORD_MIN) {
|
||||
size.height += pos.y - CAIRO_COORD_MIN;
|
||||
if (size.height < 0.0)
|
||||
size.height = 0.0;
|
||||
pos.y = CAIRO_COORD_MIN;
|
||||
if (y < CAIRO_COORD_MIN) {
|
||||
height += y - CAIRO_COORD_MIN;
|
||||
if (height < 0.0)
|
||||
height = 0.0;
|
||||
y = CAIRO_COORD_MIN;
|
||||
}
|
||||
|
||||
if (pos.x + size.width > CAIRO_COORD_MAX) {
|
||||
size.width = CAIRO_COORD_MAX - pos.x;
|
||||
if (x + width > CAIRO_COORD_MAX) {
|
||||
width = CAIRO_COORD_MAX - x;
|
||||
}
|
||||
|
||||
if (pos.y + size.height > CAIRO_COORD_MAX) {
|
||||
size.height = CAIRO_COORD_MAX - pos.y;
|
||||
if (y + height > CAIRO_COORD_MAX) {
|
||||
height = CAIRO_COORD_MAX - y;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -73,71 +73,67 @@ static inline mozilla::css::Corner operator++(mozilla::css::Corner& corner, int)
|
|||
return corner;
|
||||
}
|
||||
|
||||
struct THEBES_API gfxRect {
|
||||
// pt? point?
|
||||
gfxPoint pos;
|
||||
gfxSize size;
|
||||
struct THEBES_API gfxRect
|
||||
{
|
||||
gfxFloat x, y;
|
||||
gfxFloat width, height;
|
||||
|
||||
gfxRect() {}
|
||||
gfxRect(const gfxPoint& _pos, const gfxSize& _size) : pos(_pos), size(_size) {}
|
||||
gfxRect(const gfxPoint& _pos, const gfxSize& _size) :
|
||||
x(_pos.x), y(_pos.y), width(_size.width), height(_size.height) {}
|
||||
gfxRect(gfxFloat _x, gfxFloat _y, gfxFloat _width, gfxFloat _height) :
|
||||
pos(_x, _y), size(_width, _height) {}
|
||||
x(_x), y(_y), width(_width), height(_height) {}
|
||||
|
||||
int operator==(const gfxRect& s) const {
|
||||
return (pos == s.pos) && (size == s.size);
|
||||
return x == s.x && y == s.y && width == s.width && height == s.height;
|
||||
}
|
||||
int operator!=(const gfxRect& s) const {
|
||||
return (pos != s.pos) || (size != s.size);
|
||||
return !(*this == s);
|
||||
}
|
||||
|
||||
void MoveTo(const gfxPoint& aPt) { pos = aPt; }
|
||||
void MoveTo(const gfxPoint& aPt) { x = aPt.x; y = aPt.y; }
|
||||
const gfxRect& MoveBy(const gfxPoint& aPt) {
|
||||
pos = pos + aPt;
|
||||
x += aPt.x;
|
||||
y += aPt.y;
|
||||
return *this;
|
||||
}
|
||||
void SizeTo(const gfxSize& aSize) { size = aSize; }
|
||||
void SizeTo(const gfxSize& aSize) { width = aSize.width; height = aSize.height; }
|
||||
|
||||
gfxRect operator+(const gfxPoint& aPt) const {
|
||||
return gfxRect(pos + aPt, size);
|
||||
return gfxRect(x + aPt.x, y + aPt.y, width, height);
|
||||
}
|
||||
gfxRect operator-(const gfxPoint& aPt) const {
|
||||
return gfxRect(pos - aPt, size);
|
||||
return gfxRect(x - aPt.x, y - aPt.y, width, height);
|
||||
}
|
||||
gfxRect operator+(const gfxSize& aSize) const {
|
||||
return gfxRect(pos + gfxPoint(aSize.width, aSize.height), size);
|
||||
return gfxRect(x + aSize.width, y + aSize.height, width, height);
|
||||
}
|
||||
gfxRect operator-(const gfxSize& aSize) const {
|
||||
return gfxRect(pos - gfxPoint(aSize.width, aSize.height), size);
|
||||
return gfxRect(x - aSize.width, y - aSize.height, width, height);
|
||||
}
|
||||
gfxRect operator*(const gfxFloat aScale) const {
|
||||
return gfxRect(pos * aScale, size * aScale);
|
||||
return gfxRect(x * aScale, y * aScale, width * aScale, height * aScale);
|
||||
}
|
||||
|
||||
const gfxRect& operator+=(const gfxPoint& aPt) {
|
||||
pos += aPt;
|
||||
x += aPt.x;
|
||||
y += aPt.y;
|
||||
return *this;
|
||||
}
|
||||
const gfxRect& operator-=(const gfxPoint& aPt) {
|
||||
pos -= aPt;
|
||||
return *this;
|
||||
}
|
||||
const gfxRect& operator+=(const gfxSize& aSize) {
|
||||
pos += gfxPoint(aSize.width, aSize.height);
|
||||
return *this;
|
||||
}
|
||||
const gfxRect& operator-=(const gfxSize& aSize) {
|
||||
pos -= gfxPoint(aSize.width, aSize.height);
|
||||
x -= aPt.x;
|
||||
y -= aPt.y;
|
||||
return *this;
|
||||
}
|
||||
|
||||
gfxFloat Width() const { return size.width; }
|
||||
gfxFloat Height() const { return size.height; }
|
||||
gfxFloat X() const { return pos.x; }
|
||||
gfxFloat Y() const { return pos.y; }
|
||||
gfxFloat XMost() const { return pos.x + size.width; }
|
||||
gfxFloat YMost() const { return pos.y + size.height; }
|
||||
gfxFloat Width() const { return width; }
|
||||
gfxFloat Height() const { return height; }
|
||||
gfxFloat X() const { return x; }
|
||||
gfxFloat Y() const { return y; }
|
||||
gfxFloat XMost() const { return x + width; }
|
||||
gfxFloat YMost() const { return y + height; }
|
||||
|
||||
PRBool IsEmpty() const { return size.width <= 0 || size.height <= 0; }
|
||||
PRBool IsEmpty() const { return width <= 0 || height <= 0; }
|
||||
gfxRect Intersect(const gfxRect& aRect) const;
|
||||
gfxRect Union(const gfxRect& aRect) const;
|
||||
PRBool Contains(const gfxRect& aRect) const;
|
||||
|
@ -151,20 +147,20 @@ struct THEBES_API gfxRect {
|
|||
*/
|
||||
PRBool WithinEpsilonOfIntegerPixels(gfxFloat aEpsilon) const;
|
||||
|
||||
gfxSize Size() const { return size; }
|
||||
gfxSize Size() const { return gfxSize(width, height); }
|
||||
|
||||
void Inset(gfxFloat k) {
|
||||
pos.x += k;
|
||||
pos.y += k;
|
||||
size.width = PR_MAX(0.0, size.width - k * 2.0);
|
||||
size.height = PR_MAX(0.0, size.height - k * 2.0);
|
||||
x += k;
|
||||
y += k;
|
||||
width = PR_MAX(0.0, width - k * 2.0);
|
||||
height = PR_MAX(0.0, height - k * 2.0);
|
||||
}
|
||||
|
||||
void Inset(gfxFloat top, gfxFloat right, gfxFloat bottom, gfxFloat left) {
|
||||
pos.x += left;
|
||||
pos.y += top;
|
||||
size.width = PR_MAX(0.0, size.width - (right+left));
|
||||
size.height = PR_MAX(0.0, size.height - (bottom+top));
|
||||
x += left;
|
||||
y += top;
|
||||
width = PR_MAX(0.0, width - (right+left));
|
||||
height = PR_MAX(0.0, height - (bottom+top));
|
||||
}
|
||||
|
||||
void Inset(const gfxFloat *sides) {
|
||||
|
@ -176,17 +172,17 @@ struct THEBES_API gfxRect {
|
|||
}
|
||||
|
||||
void Outset(gfxFloat k) {
|
||||
pos.x -= k;
|
||||
pos.y -= k;
|
||||
size.width = PR_MAX(0.0, size.width + k * 2.0);
|
||||
size.height = PR_MAX(0.0, size.height + k * 2.0);
|
||||
x -= k;
|
||||
y -= k;
|
||||
width = PR_MAX(0.0, width + k * 2.0);
|
||||
height = PR_MAX(0.0, height + k * 2.0);
|
||||
}
|
||||
|
||||
void Outset(gfxFloat top, gfxFloat right, gfxFloat bottom, gfxFloat left) {
|
||||
pos.x -= left;
|
||||
pos.y -= top;
|
||||
size.width = PR_MAX(0.0, size.width + (right+left));
|
||||
size.height = PR_MAX(0.0, size.height + (bottom+top));
|
||||
x -= left;
|
||||
y -= top;
|
||||
width = PR_MAX(0.0, width + (right+left));
|
||||
height = PR_MAX(0.0, height + (bottom+top));
|
||||
}
|
||||
|
||||
void Outset(const gfxFloat *sides) {
|
||||
|
@ -219,11 +215,11 @@ struct THEBES_API gfxRect {
|
|||
void RoundOut();
|
||||
|
||||
// grabbing specific points
|
||||
gfxPoint TopLeft() const { return gfxPoint(pos); }
|
||||
gfxPoint TopRight() const { return pos + gfxPoint(size.width, 0.0); }
|
||||
gfxPoint BottomLeft() const { return pos + gfxPoint(0.0, size.height); }
|
||||
gfxPoint BottomRight() const { return pos + gfxPoint(size.width, size.height); }
|
||||
gfxPoint Center() const { return pos + gfxPoint(size.width, size.height)/2.0; }
|
||||
gfxPoint TopLeft() const { return gfxPoint(x, y); }
|
||||
gfxPoint TopRight() const { return gfxPoint(x, y) + gfxPoint(width, 0.0); }
|
||||
gfxPoint BottomLeft() const { return gfxPoint(x, y) + gfxPoint(0.0, height); }
|
||||
gfxPoint BottomRight() const { return gfxPoint(x, y) + gfxPoint(width, height); }
|
||||
gfxPoint Center() const { return gfxPoint(x, y) + gfxPoint(width, height)/2.0; }
|
||||
|
||||
gfxPoint AtCorner(mozilla::css::Corner corner) const {
|
||||
switch (corner) {
|
||||
|
@ -272,27 +268,27 @@ struct THEBES_API gfxRect {
|
|||
|
||||
void Scale(gfxFloat k) {
|
||||
NS_ASSERTION(k >= 0.0, "Invalid (negative) scale factor");
|
||||
pos.x *= k;
|
||||
pos.y *= k;
|
||||
size.width *= k;
|
||||
size.height *= k;
|
||||
x *= k;
|
||||
y *= k;
|
||||
width *= k;
|
||||
height *= k;
|
||||
}
|
||||
|
||||
void Scale(gfxFloat sx, gfxFloat sy) {
|
||||
NS_ASSERTION(sx >= 0.0, "Invalid (negative) scale factor");
|
||||
NS_ASSERTION(sy >= 0.0, "Invalid (negative) scale factor");
|
||||
pos.x *= sx;
|
||||
pos.y *= sy;
|
||||
size.width *= sx;
|
||||
size.height *= sy;
|
||||
x *= sx;
|
||||
y *= sy;
|
||||
width *= sx;
|
||||
height *= sy;
|
||||
}
|
||||
|
||||
void ScaleInverse(gfxFloat k) {
|
||||
NS_ASSERTION(k > 0.0, "Invalid (negative) scale factor");
|
||||
pos.x /= k;
|
||||
pos.y /= k;
|
||||
size.width /= k;
|
||||
size.height /= k;
|
||||
x /= k;
|
||||
y /= k;
|
||||
width /= k;
|
||||
height /= k;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -3445,7 +3445,7 @@ nsCSSRendering::PaintDecorationLine(gfxContext* aGfxContext,
|
|||
aGfxContext->SetLineCap(gfxContext::LINE_CAP_BUTT);
|
||||
aGfxContext->SetDash(dash, 2, 0.0);
|
||||
// We should continue to draw the last dash even if it is not in the rect.
|
||||
rect.size.width += dashWidth;
|
||||
rect.width += dashWidth;
|
||||
break;
|
||||
}
|
||||
case NS_STYLE_TEXT_DECORATION_STYLE_DOTTED: {
|
||||
|
@ -3464,7 +3464,7 @@ nsCSSRendering::PaintDecorationLine(gfxContext* aGfxContext,
|
|||
}
|
||||
aGfxContext->SetDash(dash, 2, 0.0);
|
||||
// We should continue to draw the last dot even if it is not in the rect.
|
||||
rect.size.width += dashWidth;
|
||||
rect.width += dashWidth;
|
||||
break;
|
||||
}
|
||||
case NS_STYLE_TEXT_DECORATION_STYLE_WAVY:
|
||||
|
@ -3486,7 +3486,7 @@ nsCSSRendering::PaintDecorationLine(gfxContext* aGfxContext,
|
|||
}
|
||||
|
||||
// The y position should be set to the middle of the line.
|
||||
rect.pos.y += lineHeight / 2;
|
||||
rect.y += lineHeight / 2;
|
||||
|
||||
aGfxContext->SetColor(gfxRGBA(aColor));
|
||||
aGfxContext->SetLineWidth(lineHeight);
|
||||
|
@ -3515,7 +3515,7 @@ nsCSSRendering::PaintDecorationLine(gfxContext* aGfxContext,
|
|||
aGfxContext->NewPath();
|
||||
aGfxContext->MoveTo(rect.TopLeft());
|
||||
aGfxContext->LineTo(rect.TopRight());
|
||||
rect.size.height -= lineHeight;
|
||||
rect.height -= lineHeight;
|
||||
aGfxContext->MoveTo(rect.BottomLeft());
|
||||
aGfxContext->LineTo(rect.BottomRight());
|
||||
aGfxContext->Stroke();
|
||||
|
@ -3557,7 +3557,7 @@ nsCSSRendering::PaintDecorationLine(gfxContext* aGfxContext,
|
|||
* 7. Repeat from 2 until reached to right-most edge of the area.
|
||||
*/
|
||||
|
||||
rect.pos.x += lineHeight / 2.0;
|
||||
rect.x += lineHeight / 2.0;
|
||||
aGfxContext->NewPath();
|
||||
|
||||
gfxPoint pt(rect.TopLeft());
|
||||
|
@ -3649,7 +3649,7 @@ nsCSSRendering::GetTextDecorationRectInternal(const gfxPoint& aPt,
|
|||
gfxFloat descentLimit = NS_floor(aDescentLimit);
|
||||
|
||||
gfxFloat suggestedMaxRectHeight = NS_MAX(NS_MIN(ascent, descentLimit), 1.0);
|
||||
r.size.height = lineHeight;
|
||||
r.height = lineHeight;
|
||||
if (aStyle == NS_STYLE_TEXT_DECORATION_STYLE_DOUBLE) {
|
||||
/**
|
||||
* We will draw double line as:
|
||||
|
@ -3668,12 +3668,12 @@ nsCSSRendering::GetTextDecorationRectInternal(const gfxPoint& aPt,
|
|||
*/
|
||||
gfxFloat gap = NS_round(lineHeight / 2.0);
|
||||
gap = NS_MAX(gap, 1.0);
|
||||
r.size.height = lineHeight * 2.0 + gap;
|
||||
r.height = lineHeight * 2.0 + gap;
|
||||
if (canLiftUnderline) {
|
||||
if (r.Height() > suggestedMaxRectHeight) {
|
||||
// Don't shrink the line height, because the thickness has some meaning.
|
||||
// We can just shrink the gap at this time.
|
||||
r.size.height = NS_MAX(suggestedMaxRectHeight, lineHeight * 2.0 + 1.0);
|
||||
r.height = NS_MAX(suggestedMaxRectHeight, lineHeight * 2.0 + 1.0);
|
||||
}
|
||||
}
|
||||
} else if (aStyle == NS_STYLE_TEXT_DECORATION_STYLE_WAVY) {
|
||||
|
@ -3690,14 +3690,14 @@ nsCSSRendering::GetTextDecorationRectInternal(const gfxPoint& aPt,
|
|||
* | XXXXXX XXXXXX |
|
||||
* +-------------------------------------------+
|
||||
*/
|
||||
r.size.height = lineHeight > 2.0 ? lineHeight * 4.0 : lineHeight * 3.0;
|
||||
r.height = lineHeight > 2.0 ? lineHeight * 4.0 : lineHeight * 3.0;
|
||||
if (canLiftUnderline) {
|
||||
if (r.Height() > suggestedMaxRectHeight) {
|
||||
// Don't shrink the line height even if there is not enough space,
|
||||
// because the thickness has some meaning. E.g., the 1px wavy line and
|
||||
// 2px wavy line can be used for different meaning in IME selections
|
||||
// at same time.
|
||||
r.size.height = NS_MAX(suggestedMaxRectHeight, lineHeight * 2.0);
|
||||
r.height = NS_MAX(suggestedMaxRectHeight, lineHeight * 2.0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3731,7 +3731,7 @@ nsCSSRendering::GetTextDecorationRectInternal(const gfxPoint& aPt,
|
|||
default:
|
||||
NS_ERROR("Invalid decoration value!");
|
||||
}
|
||||
r.pos.y = baseline - NS_floor(offset + 0.5);
|
||||
r.y = baseline - NS_floor(offset + 0.5);
|
||||
return r;
|
||||
}
|
||||
|
||||
|
|
|
@ -394,9 +394,9 @@ nsCSSBorderRenderer::DoSideClipWithoutCornersSubPath(mozilla::css::Side aSide)
|
|||
mOuterRect.Size() - sideCornerSum);
|
||||
|
||||
if (aSide == NS_SIDE_TOP || aSide == NS_SIDE_BOTTOM)
|
||||
rect.size.height = mBorderWidths[aSide];
|
||||
rect.height = mBorderWidths[aSide];
|
||||
else
|
||||
rect.size.width = mBorderWidths[aSide];
|
||||
rect.width = mBorderWidths[aSide];
|
||||
|
||||
mContext->Rectangle(rect);
|
||||
}
|
||||
|
@ -611,24 +611,24 @@ nsCSSBorderRenderer::FillSolidBorder(const gfxRect& aOuterRect,
|
|||
|
||||
if ((aSides & (SIDE_BIT_TOP | SIDE_BIT_LEFT)) == (SIDE_BIT_TOP | SIDE_BIT_LEFT)) {
|
||||
// adjust the left's top down a bit
|
||||
r[NS_SIDE_LEFT].pos.y += aBorderSizes[NS_SIDE_TOP];
|
||||
r[NS_SIDE_LEFT].size.height -= aBorderSizes[NS_SIDE_TOP];
|
||||
r[NS_SIDE_LEFT].y += aBorderSizes[NS_SIDE_TOP];
|
||||
r[NS_SIDE_LEFT].height -= aBorderSizes[NS_SIDE_TOP];
|
||||
}
|
||||
|
||||
if ((aSides & (SIDE_BIT_TOP | SIDE_BIT_RIGHT)) == (SIDE_BIT_TOP | SIDE_BIT_RIGHT)) {
|
||||
// adjust the top's left a bit
|
||||
r[NS_SIDE_TOP].size.width -= aBorderSizes[NS_SIDE_RIGHT];
|
||||
r[NS_SIDE_TOP].width -= aBorderSizes[NS_SIDE_RIGHT];
|
||||
}
|
||||
|
||||
if ((aSides & (SIDE_BIT_BOTTOM | SIDE_BIT_RIGHT)) == (SIDE_BIT_BOTTOM | SIDE_BIT_RIGHT)) {
|
||||
// adjust the right's bottom a bit
|
||||
r[NS_SIDE_RIGHT].size.height -= aBorderSizes[NS_SIDE_BOTTOM];
|
||||
r[NS_SIDE_RIGHT].height -= aBorderSizes[NS_SIDE_BOTTOM];
|
||||
}
|
||||
|
||||
if ((aSides & (SIDE_BIT_BOTTOM | SIDE_BIT_LEFT)) == (SIDE_BIT_BOTTOM | SIDE_BIT_LEFT)) {
|
||||
// adjust the bottom's left a bit
|
||||
r[NS_SIDE_BOTTOM].pos.x += aBorderSizes[NS_SIDE_LEFT];
|
||||
r[NS_SIDE_BOTTOM].size.width -= aBorderSizes[NS_SIDE_LEFT];
|
||||
r[NS_SIDE_BOTTOM].x += aBorderSizes[NS_SIDE_LEFT];
|
||||
r[NS_SIDE_BOTTOM].width -= aBorderSizes[NS_SIDE_LEFT];
|
||||
}
|
||||
|
||||
// Filling these one by one is faster than filling them all at once.
|
||||
|
|
|
@ -1015,10 +1015,10 @@ nsLayoutUtils::RoundGfxRectToAppRect(const gfxRect &aRect, float aFactor)
|
|||
scaledRect.RoundOut();
|
||||
|
||||
/* We now need to constrain our results to the max and min values for coords. */
|
||||
ConstrainToCoordValues(scaledRect.pos.x);
|
||||
ConstrainToCoordValues(scaledRect.pos.y);
|
||||
ConstrainToCoordValues(scaledRect.size.width);
|
||||
ConstrainToCoordValues(scaledRect.size.height);
|
||||
ConstrainToCoordValues(scaledRect.x);
|
||||
ConstrainToCoordValues(scaledRect.y);
|
||||
ConstrainToCoordValues(scaledRect.width);
|
||||
ConstrainToCoordValues(scaledRect.height);
|
||||
|
||||
/* Now typecast everything back. This is guaranteed to be safe. */
|
||||
return nsRect(nscoord(scaledRect.X()), nscoord(scaledRect.Y()),
|
||||
|
|
|
@ -6000,7 +6000,7 @@ void nsPluginInstanceOwner::Paint(gfxContext* aContext,
|
|||
|
||||
// Round out the dirty rect to plugin pixels to ensure the plugin draws
|
||||
// enough pixels for interpolation to device pixels.
|
||||
gfxRect dirtyRect = aDirtyRect + -pluginRect.pos;
|
||||
gfxRect dirtyRect = aDirtyRect - pluginRect.TopLeft();
|
||||
dirtyRect.RoundOut();
|
||||
|
||||
// Plugins can only draw an integer number of pixels.
|
||||
|
@ -6013,14 +6013,14 @@ void nsPluginInstanceOwner::Paint(gfxContext* aContext,
|
|||
// draw a suitable number of pixels for interpolation to device pixels in
|
||||
// Renderer::Draw, but such cases are not common enough to warrant the
|
||||
// effort now.
|
||||
nsIntSize pluginSize(NS_lround(pluginRect.size.width),
|
||||
NS_lround(pluginRect.size.height));
|
||||
nsIntSize pluginSize(NS_lround(pluginRect.width),
|
||||
NS_lround(pluginRect.height));
|
||||
|
||||
// Determine what the plugin needs to draw.
|
||||
nsIntRect pluginDirtyRect(PRInt32(dirtyRect.pos.x),
|
||||
PRInt32(dirtyRect.pos.y),
|
||||
PRInt32(dirtyRect.size.width),
|
||||
PRInt32(dirtyRect.size.height));
|
||||
nsIntRect pluginDirtyRect(PRInt32(dirtyRect.x),
|
||||
PRInt32(dirtyRect.y),
|
||||
PRInt32(dirtyRect.width),
|
||||
PRInt32(dirtyRect.height));
|
||||
if (!pluginDirtyRect.
|
||||
IntersectRect(nsIntRect(0, 0, pluginSize.width, pluginSize.height),
|
||||
pluginDirtyRect))
|
||||
|
@ -6043,7 +6043,7 @@ void nsPluginInstanceOwner::Paint(gfxContext* aContext,
|
|||
|
||||
// Renderer::Draw() draws a rectangle with top-left at the aContext origin.
|
||||
gfxContextAutoSaveRestore autoSR(aContext);
|
||||
aContext->Translate(pluginRect.pos);
|
||||
aContext->Translate(pluginRect.TopLeft());
|
||||
|
||||
Renderer renderer(window, this, pluginSize, pluginDirtyRect);
|
||||
#ifdef MOZ_WIDGET_GTK2
|
||||
|
|
|
@ -784,7 +784,7 @@ void nsDisplayNotation::Paint(nsDisplayListBuilder* aBuilder,
|
|||
switch(mType)
|
||||
{
|
||||
case NOTATION_CIRCLE:
|
||||
gfxCtx->Ellipse(rect.Center(), rect.size);
|
||||
gfxCtx->Ellipse(rect.Center(), rect.Size());
|
||||
break;
|
||||
|
||||
case NOTATION_ROUNDEDBOX:
|
||||
|
|
|
@ -140,13 +140,13 @@ nsSVGFilterInstance::ComputeFilterPrimitiveSubregion(PrimitiveInfo* aPrimitive)
|
|||
gfxRect region = UserSpaceToFilterSpace(feArea);
|
||||
|
||||
if (!fE->HasAttr(kNameSpaceID_None, nsGkAtoms::x))
|
||||
region.pos.x = defaultFilterSubregion.X();
|
||||
region.x = defaultFilterSubregion.X();
|
||||
if (!fE->HasAttr(kNameSpaceID_None, nsGkAtoms::y))
|
||||
region.pos.y = defaultFilterSubregion.Y();
|
||||
region.y = defaultFilterSubregion.Y();
|
||||
if (!fE->HasAttr(kNameSpaceID_None, nsGkAtoms::width))
|
||||
region.size.width = defaultFilterSubregion.Width();
|
||||
region.width = defaultFilterSubregion.Width();
|
||||
if (!fE->HasAttr(kNameSpaceID_None, nsGkAtoms::height))
|
||||
region.size.height = defaultFilterSubregion.Height();
|
||||
region.height = defaultFilterSubregion.Height();
|
||||
|
||||
// We currently require filter primitive subregions to be pixel-aligned.
|
||||
// Following the spec, any pixel partially in the region is included
|
||||
|
|
|
@ -275,7 +275,7 @@ nsSVGPathGeometryFrame::UpdateCoveredRegion()
|
|||
// GetUserStrokeExtent gets the extents wrong we can still use it
|
||||
// to get the device space position of zero length stroked paths.
|
||||
extent = context->GetUserStrokeExtent();
|
||||
extent += extent.Size()/2;
|
||||
extent += gfxPoint(extent.width, extent.height)/2;
|
||||
extent.SizeTo(gfxSize(0, 0));
|
||||
}
|
||||
extent = nsSVGUtils::PathExtentsToMaxStrokeExtents(extent, this);
|
||||
|
|
|
@ -1193,19 +1193,19 @@ nsSVGUtils::GetClipRectForFrame(nsIFrame *aFrame,
|
|||
gfxRect(clipPxRect.x, clipPxRect.y, clipPxRect.width, clipPxRect.height);
|
||||
|
||||
if (NS_STYLE_CLIP_RIGHT_AUTO & disp->mClipFlags) {
|
||||
clipRect.size.width = aWidth - clipRect.X();
|
||||
clipRect.width = aWidth - clipRect.X();
|
||||
}
|
||||
if (NS_STYLE_CLIP_BOTTOM_AUTO & disp->mClipFlags) {
|
||||
clipRect.size.height = aHeight - clipRect.Y();
|
||||
clipRect.height = aHeight - clipRect.Y();
|
||||
}
|
||||
|
||||
if (disp->mOverflowX != NS_STYLE_OVERFLOW_HIDDEN) {
|
||||
clipRect.pos.x = aX;
|
||||
clipRect.size.width = aWidth;
|
||||
clipRect.x = aX;
|
||||
clipRect.width = aWidth;
|
||||
}
|
||||
if (disp->mOverflowY != NS_STYLE_OVERFLOW_HIDDEN) {
|
||||
clipRect.pos.y = aY;
|
||||
clipRect.size.height = aHeight;
|
||||
clipRect.y = aY;
|
||||
clipRect.height = aHeight;
|
||||
}
|
||||
|
||||
return clipRect;
|
||||
|
|
|
@ -1259,13 +1259,13 @@ nsNativeThemeWin::DrawWidgetBackground(nsRenderingContext* aContext,
|
|||
if (aWidgetType == NS_THEME_DROPDOWN_BUTTON &&
|
||||
part == CBP_DROPMARKER_VISTA && IsHTMLContent(aFrame))
|
||||
{
|
||||
tr.pos.y -= 1.0;
|
||||
tr.size.width += 1.0;
|
||||
tr.size.height += 2.0;
|
||||
tr.y -= 1.0;
|
||||
tr.width += 1.0;
|
||||
tr.height += 2.0;
|
||||
|
||||
dr.pos.y -= 1.0;
|
||||
dr.size.width += 1.0;
|
||||
dr.size.height += 2.0;
|
||||
dr.y -= 1.0;
|
||||
dr.width += 1.0;
|
||||
dr.height += 2.0;
|
||||
}
|
||||
|
||||
nsRefPtr<gfxContext> ctx = aContext->ThebesContext();
|
||||
|
|
Загрузка…
Ссылка в новой задаче