mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 380438: Black lines appearing on the Opera Desktop Team Blog comments. r+sr=roc
This commit is contained in:
parent
7645978be1
commit
795d602599
@ -159,8 +159,15 @@ struct NS_GFX nsRect {
|
|||||||
height = NSToCoordRound(height * aScale);
|
height = NSToCoordRound(height * aScale);
|
||||||
return *this;}
|
return *this;}
|
||||||
|
|
||||||
nsRect& ScaleRoundOut(const float aScale);
|
// Scale by aScale, converting coordinates to integers so that the result
|
||||||
nsRect& ScaleRoundIn(const float aScale);
|
// is the smallest integer-coordinate rectangle containing the unrounded result
|
||||||
|
nsRect& ScaleRoundOut(float aScale);
|
||||||
|
// Scale by aScale, converting coordinates to integers so that the result
|
||||||
|
// is the larges integer-coordinate rectangle contained in the unrounded result
|
||||||
|
nsRect& ScaleRoundIn(float aScale);
|
||||||
|
// Scale by aScale, converting coordinates to integers so that the result
|
||||||
|
// contains the same pixel centers as the unrounded result
|
||||||
|
nsRect& ScaleRoundPreservingCenters(float aScale);
|
||||||
|
|
||||||
// Helpers for accessing the vertices
|
// Helpers for accessing the vertices
|
||||||
nsPoint TopLeft() const { return nsPoint(x, y); }
|
nsPoint TopLeft() const { return nsPoint(x, y); }
|
||||||
|
@ -181,10 +181,10 @@ void nsRect::Deflate(const nsMargin &aMargin)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// scale the rect but round to smallest containing rect
|
// scale the rect but round to smallest containing rect
|
||||||
nsRect& nsRect::ScaleRoundOut(const float aScale)
|
nsRect& nsRect::ScaleRoundOut(float aScale)
|
||||||
{
|
{
|
||||||
nscoord right = NSToCoordCeil(float(x + width) * aScale);
|
nscoord right = NSToCoordCeil(float(XMost()) * aScale);
|
||||||
nscoord bottom = NSToCoordCeil(float(y + height) * aScale);
|
nscoord bottom = NSToCoordCeil(float(YMost()) * aScale);
|
||||||
x = NSToCoordFloor(float(x) * aScale);
|
x = NSToCoordFloor(float(x) * aScale);
|
||||||
y = NSToCoordFloor(float(y) * aScale);
|
y = NSToCoordFloor(float(y) * aScale);
|
||||||
width = (right - x);
|
width = (right - x);
|
||||||
@ -193,10 +193,10 @@ nsRect& nsRect::ScaleRoundOut(const float aScale)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// scale the rect but round to largest contained rect
|
// scale the rect but round to largest contained rect
|
||||||
nsRect& nsRect::ScaleRoundIn(const float aScale)
|
nsRect& nsRect::ScaleRoundIn(float aScale)
|
||||||
{
|
{
|
||||||
nscoord right = NSToCoordFloor(float(x + width) * aScale);
|
nscoord right = NSToCoordFloor(float(XMost()) * aScale);
|
||||||
nscoord bottom = NSToCoordFloor(float(y + height) * aScale);
|
nscoord bottom = NSToCoordFloor(float(YMost()) * aScale);
|
||||||
x = NSToCoordCeil(float(x) * aScale);
|
x = NSToCoordCeil(float(x) * aScale);
|
||||||
y = NSToCoordCeil(float(y) * aScale);
|
y = NSToCoordCeil(float(y) * aScale);
|
||||||
width = (right - x);
|
width = (right - x);
|
||||||
@ -204,6 +204,17 @@ nsRect& nsRect::ScaleRoundIn(const float aScale)
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nsRect& nsRect::ScaleRoundPreservingCenters(float aScale)
|
||||||
|
{
|
||||||
|
nscoord right = NSToCoordRound(float(XMost()) * aScale);
|
||||||
|
nscoord bottom = NSToCoordRound(float(YMost()) * aScale);
|
||||||
|
x = NSToCoordRound(float(x) * aScale);
|
||||||
|
y = NSToCoordRound(float(y) * aScale);
|
||||||
|
width = (right - x);
|
||||||
|
height = (bottom - y);
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
// Diagnostics
|
// Diagnostics
|
||||||
|
|
||||||
|
@ -386,11 +386,11 @@ void nsView::DoResetWidgetBounds(PRBool aMoveOnly,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
nsRect newBounds(NSAppUnitsToIntPixels((mDimBounds.x + offset.x), p2a),
|
nsRect viewBounds(mDimBounds + offset);
|
||||||
NSAppUnitsToIntPixels((mDimBounds.y + offset.y), p2a),
|
|
||||||
NSAppUnitsToIntPixels(mDimBounds.width, p2a),
|
nsRect newBounds(viewBounds);
|
||||||
NSAppUnitsToIntPixels(mDimBounds.height, p2a));
|
newBounds.ScaleRoundPreservingCenters(1.0f / p2a);
|
||||||
|
|
||||||
PRBool changedPos = PR_TRUE;
|
PRBool changedPos = PR_TRUE;
|
||||||
PRBool changedSize = PR_TRUE;
|
PRBool changedSize = PR_TRUE;
|
||||||
if (!(mVFlags & NS_VIEW_FLAG_HAS_POSITIONED_WIDGET)) {
|
if (!(mVFlags & NS_VIEW_FLAG_HAS_POSITIONED_WIDGET)) {
|
||||||
@ -412,6 +412,10 @@ void nsView::DoResetWidgetBounds(PRBool aMoveOnly,
|
|||||||
mWindow->Resize(newBounds.width, newBounds.height, aInvalidateChangedSize);
|
mWindow->Resize(newBounds.width, newBounds.height, aInvalidateChangedSize);
|
||||||
} // else do nothing!
|
} // else do nothing!
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nsPoint roundedOffset(NSIntPixelsToAppUnits(newBounds.x, p2a),
|
||||||
|
NSIntPixelsToAppUnits(newBounds.y, p2a));
|
||||||
|
mViewToWidgetOffset = viewBounds.TopLeft() - roundedOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nsView::SetDimensions(const nsRect& aRect, PRBool aPaint, PRBool aResizeWidget)
|
void nsView::SetDimensions(const nsRect& aRect, PRBool aPaint, PRBool aResizeWidget)
|
||||||
@ -858,7 +862,8 @@ nsIWidget* nsIView::GetNearestWidget(nsPoint* aOffset) const
|
|||||||
// not coincide with v's origin
|
// not coincide with v's origin
|
||||||
if (aOffset) {
|
if (aOffset) {
|
||||||
nsRect vBounds = v->GetBounds();
|
nsRect vBounds = v->GetBounds();
|
||||||
*aOffset = pt + v->GetPosition() - nsPoint(vBounds.x, vBounds.y);
|
*aOffset = pt + v->GetPosition() - nsPoint(vBounds.x, vBounds.y) -
|
||||||
|
v->ViewToWidgetOffset();
|
||||||
}
|
}
|
||||||
return v->GetWidget();
|
return v->GetWidget();
|
||||||
}
|
}
|
||||||
|
@ -218,6 +218,10 @@ public:
|
|||||||
|
|
||||||
virtual ~nsView();
|
virtual ~nsView();
|
||||||
|
|
||||||
|
nsPoint ViewToWidgetOffset() const {
|
||||||
|
return mViewToWidgetOffset;
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Do the actual work of ResetWidgetBounds, unconditionally. Don't
|
// Do the actual work of ResetWidgetBounds, unconditionally. Don't
|
||||||
// call this method if we have no widget.
|
// call this method if we have no widget.
|
||||||
@ -228,6 +232,7 @@ protected:
|
|||||||
// mClipRect is relative to the view's origin.
|
// mClipRect is relative to the view's origin.
|
||||||
nsRect* mClipRect;
|
nsRect* mClipRect;
|
||||||
nsRegion* mDirtyRegion;
|
nsRegion* mDirtyRegion;
|
||||||
|
nsPoint mViewToWidgetOffset;
|
||||||
PRPackedBool mChildRemoved;
|
PRPackedBool mChildRemoved;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -483,8 +483,13 @@ void nsViewManager::Refresh(nsView *aView, nsIRenderingContext *aContext,
|
|||||||
|
|
||||||
ctx->Save();
|
ctx->Save();
|
||||||
|
|
||||||
ctx->Translate(gfxPoint(NSAppUnitsToIntPixels(viewRect.x, p2a),
|
nsPoint vtowoffset = aView->ViewToWidgetOffset();
|
||||||
NSAppUnitsToIntPixels(viewRect.y, p2a)));
|
ctx->Translate(gfxPoint(gfxFloat(vtowoffset.x) / p2a,
|
||||||
|
gfxFloat(vtowoffset.y) / p2a));
|
||||||
|
|
||||||
|
NS_ASSERTION(!viewRect.x && !viewRect.y, "When exactly is this supposed to be non-zero?");
|
||||||
|
ctx->Translate(gfxPoint(gfxFloat(viewRect.x) / p2a,
|
||||||
|
gfxFloat(viewRect.y) / p2a));
|
||||||
|
|
||||||
nsRegion opaqueRegion;
|
nsRegion opaqueRegion;
|
||||||
AddCoveringWidgetsToOpaqueRegion(opaqueRegion, mContext, aView);
|
AddCoveringWidgetsToOpaqueRegion(opaqueRegion, mContext, aView);
|
||||||
|
Loading…
Reference in New Issue
Block a user