Merge inbound to m-c a=merge

This commit is contained in:
Wes Kocher 2014-10-20 17:58:32 -07:00
commit 29123d72f1
48 changed files with 347 additions and 347 deletions

View File

@ -2184,6 +2184,12 @@ public:
*/
static uint64_t GetInnerWindowID(nsIRequest* aRequest);
/**
* If the hostname for aURI is an IPv6 it encloses it in brackets,
* otherwise it just outputs the hostname in aHost.
*/
static void GetHostOrIPv6WithBrackets(nsIURI* aURI, nsAString& aHost);
private:
static bool InitializeEventTable();

View File

@ -361,13 +361,7 @@ Link::GetHostname(nsAString &_hostname, ErrorResult& aError)
return;
}
nsAutoCString host;
nsresult rv = uri->GetHost(host);
// Note that failure to get the host from the URI is not necessarily a bad
// thing. Some URIs do not have a host.
if (NS_SUCCEEDED(rv)) {
CopyUTF8toUTF16(host, _hostname);
}
nsContentUtils::GetHostOrIPv6WithBrackets(uri, _hostname);
}
void

View File

@ -6998,3 +6998,23 @@ nsContentUtils::GetInnerWindowID(nsIRequest* aRequest)
return inner ? inner->WindowID() : 0;
}
void
nsContentUtils::GetHostOrIPv6WithBrackets(nsIURI* aURI, nsAString& aHost)
{
aHost.Truncate();
nsAutoCString hostname;
nsresult rv = aURI->GetHost(hostname);
if (NS_FAILED(rv)) { // Some URIs do not have a host
return;
}
if (hostname.FindChar(':') != -1) { // Escape IPv6 address
MOZ_ASSERT(!hostname.Length() ||
(hostname[0] !='[' && hostname[hostname.Length() - 1] != ']'));
hostname.Insert('[', 0);
hostname.Append(']');
}
CopyUTF8toUTF16(hostname, aHost);
}

View File

@ -382,17 +382,7 @@ void
URL::GetHostname(nsString& aHostname, ErrorResult& aRv) const
{
aHostname.Truncate();
nsAutoCString tmp;
nsresult rv = mURI->GetHost(tmp);
if (NS_SUCCEEDED(rv)) {
if (tmp.FindChar(':') != -1) { // Escape IPv6 address
MOZ_ASSERT(!tmp.Length() ||
(tmp[0] !='[' && tmp[tmp.Length() - 1] != ']'));
tmp.Insert('[', 0);
tmp.Append(']');
}
CopyUTF8toUTF16(tmp, aHostname);
}
nsContentUtils::GetHostOrIPv6WithBrackets(mURI, aHostname);
}
void

View File

@ -407,18 +407,9 @@ nsLocation::GetHostname(nsAString& aHostname)
aHostname.Truncate();
nsCOMPtr<nsIURI> uri;
nsresult result;
result = GetURI(getter_AddRefs(uri), true);
GetURI(getter_AddRefs(uri), true);
if (uri) {
nsAutoCString host;
result = uri->GetHost(host);
if (NS_SUCCEEDED(result)) {
AppendUTF8toUTF16(host, aHostname);
}
nsContentUtils::GetHostOrIPv6WithBrackets(uri, aHostname);
}
return NS_OK;

View File

@ -410,7 +410,7 @@ nsDeviceContext::CreateRenderingContext()
dt->AddUserData(&gfxContext::sDontUseAsSourceKey, dt, nullptr);
#endif
pContext->Init(this, dt);
pContext->Init(dt);
pContext->GetDrawTarget()->AddUserData(&sDisablePixelSnapping,
(void*)0x1, nullptr);
pContext->ThebesContext()->SetMatrix(gfxMatrix::Scaling(mPrintingScale,

View File

@ -20,12 +20,6 @@
#include "nsRect.h" // for nsRect, nsIntRect
#include "nsRegion.h" // for nsIntRegionRectIterator, etc
// XXXTodo: rename FORM_TWIPS to FROM_APPUNITS
#define FROM_TWIPS(_x) ((gfxFloat)((_x)/(mP2A)))
#define FROM_TWIPS_INT(_x) (NSToIntRound((gfxFloat)((_x)/(mP2A))))
#define TO_TWIPS(_x) ((nscoord)((_x)*(mP2A)))
#define GFX_RECT_FROM_TWIPS_RECT(_r) (gfxRect(FROM_TWIPS((_r).x), FROM_TWIPS((_r).y), FROM_TWIPS((_r).width), FROM_TWIPS((_r).height)))
// 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
@ -64,103 +58,16 @@ static int32_t FindSafeLength(const char *aString, uint32_t aLength,
//// nsRenderingContext
void
nsRenderingContext::Init(nsDeviceContext* aContext,
gfxContext *aThebesContext)
nsRenderingContext::Init(gfxContext *aThebesContext)
{
mDeviceContext = aContext;
mThebes = aThebesContext;
mThebes->SetLineWidth(1.0);
mP2A = mDeviceContext->AppUnitsPerDevPixel();
}
void
nsRenderingContext::Init(nsDeviceContext* aContext,
DrawTarget *aDrawTarget)
nsRenderingContext::Init(DrawTarget *aDrawTarget)
{
Init(aContext, new gfxContext(aDrawTarget));
}
//
// graphics state
//
void
nsRenderingContext::IntersectClip(const nsRect& aRect)
{
mThebes->NewPath();
gfxRect clipRect(GFX_RECT_FROM_TWIPS_RECT(aRect));
if (mThebes->UserToDevicePixelSnapped(clipRect, true)) {
gfxMatrix mat(mThebes->CurrentMatrix());
mat.Invert();
clipRect = mat.Transform(clipRect);
mThebes->Rectangle(clipRect);
} else {
mThebes->Rectangle(clipRect);
}
mThebes->Clip();
}
void
nsRenderingContext::SetColor(nscolor aColor)
{
/* This sets the color assuming the sRGB color space, since that's
* what all CSS colors are defined to be in by the spec.
*/
mThebes->SetColor(gfxRGBA(aColor));
}
//
// shapes
//
void
nsRenderingContext::DrawLine(const nsPoint& aStartPt, const nsPoint& aEndPt)
{
DrawLine(aStartPt.x, aStartPt.y, aEndPt.x, aEndPt.y);
}
void
nsRenderingContext::DrawLine(nscoord aX0, nscoord aY0,
nscoord aX1, nscoord aY1)
{
gfxPoint p0 = gfxPoint(FROM_TWIPS(aX0), FROM_TWIPS(aY0));
gfxPoint p1 = gfxPoint(FROM_TWIPS(aX1), FROM_TWIPS(aY1));
// we can't draw thick lines with gfx, so we always assume we want
// pixel-aligned lines if the rendering context is at 1.0 scale
gfxMatrix savedMatrix = mThebes->CurrentMatrix();
if (!savedMatrix.HasNonTranslation()) {
p0 = mThebes->UserToDevice(p0);
p1 = mThebes->UserToDevice(p1);
p0.Round();
p1.Round();
mThebes->SetMatrix(gfxMatrix());
mThebes->NewPath();
// snap straight lines
if (p0.x == p1.x) {
mThebes->Line(p0 + gfxPoint(0.5, 0),
p1 + gfxPoint(0.5, 0));
} else if (p0.y == p1.y) {
mThebes->Line(p0 + gfxPoint(0, 0.5),
p1 + gfxPoint(0, 0.5));
} else {
mThebes->Line(p0, p1);
}
mThebes->Stroke();
mThebes->SetMatrix(savedMatrix);
} else {
mThebes->NewPath();
mThebes->Line(p0, p1);
mThebes->Stroke();
}
Init(new gfxContext(aDrawTarget));
}

View File

@ -15,7 +15,6 @@
#include "nsBoundingMetrics.h" // for nsBoundingMetrics
#include "nsColor.h" // for nscolor
#include "nsCoord.h" // for nscoord, NSToIntRound
#include "nsDeviceContext.h" // for nsDeviceContext
#include "nsFontMetrics.h" // for nsFontMetrics
#include "nsISupports.h" // for NS_INLINE_DECL_REFCOUNTING, etc
#include "nsString.h" // for nsString
@ -30,32 +29,16 @@ class nsRenderingContext MOZ_FINAL
typedef mozilla::gfx::DrawTarget DrawTarget;
public:
nsRenderingContext() : mP2A(0.) {}
nsRenderingContext() {}
NS_INLINE_DECL_REFCOUNTING(nsRenderingContext)
void Init(nsDeviceContext* aContext, gfxContext* aThebesContext);
void Init(nsDeviceContext* aContext, DrawTarget* aDrawTarget);
void Init(gfxContext* aThebesContext);
void Init(DrawTarget* aDrawTarget);
// These accessors will never return null.
gfxContext *ThebesContext() { return mThebes; }
DrawTarget *GetDrawTarget() { return mThebes->GetDrawTarget(); }
nsDeviceContext *DeviceContext() { return mDeviceContext; }
int32_t AppUnitsPerDevPixel() const {
// we know this is an int (it's stored as a double for convenience)
return int32_t(mP2A);
}
// Graphics state
void IntersectClip(const nsRect& aRect);
void SetColor(nscolor aColor);
// Shapes
void DrawLine(const nsPoint& aStartPt, const nsPoint& aEndPt);
void DrawLine(nscoord aX0, nscoord aY0, nscoord aX1, nscoord aY1);
// Text
@ -89,10 +72,7 @@ private:
int32_t GetMaxChunkLength();
nsRefPtr<gfxContext> mThebes;
nsRefPtr<nsDeviceContext> mDeviceContext;
nsRefPtr<nsFontMetrics> mFontMetrics;
double mP2A; // cached app units per device pixel value
};
#endif // NSRENDERINGCONTEXT__H__

View File

@ -721,13 +721,19 @@ gfxContext::CurrentFillRule() const
}
// clipping
void
gfxContext::Clip(const Rect& rect)
{
AzureState::PushedClip clip = { nullptr, rect, mTransform };
CurrentState().pushedClips.AppendElement(clip);
mDT->PushClipRect(rect);
NewPath();
}
void
gfxContext::Clip(const gfxRect& rect)
{
AzureState::PushedClip clip = { nullptr, ToRect(rect), mTransform };
CurrentState().pushedClips.AppendElement(clip);
mDT->PushClipRect(ToRect(rect));
NewPath();
Clip(ToRect(rect));
}
void

View File

@ -40,6 +40,7 @@ class gfxContext MOZ_FINAL {
typedef mozilla::gfx::FillRule FillRule;
typedef mozilla::gfx::Path Path;
typedef mozilla::gfx::Pattern Pattern;
typedef mozilla::gfx::Rect Rect;
NS_INLINE_DECL_REFCOUNTING(gfxContext)
@ -531,6 +532,7 @@ public:
* Helper functions that will create a rect path and call Clip().
* Any current path will be destroyed by these functions!
*/
void Clip(const Rect& rect);
void Clip(const gfxRect& rect); // will clip to a rect
/**
@ -613,7 +615,6 @@ private:
typedef mozilla::gfx::Color Color;
typedef mozilla::gfx::StrokeOptions StrokeOptions;
typedef mozilla::gfx::Float Float;
typedef mozilla::gfx::Rect Rect;
typedef mozilla::gfx::CompositionOp CompositionOp;
typedef mozilla::gfx::PathBuilder PathBuilder;
typedef mozilla::gfx::SourceSurface SourceSurface;

View File

@ -4212,7 +4212,7 @@ static void DebugPaintItem(nsRenderingContext* aDest,
nsRefPtr<gfxContext> context = new gfxContext(tempDT);
context->SetMatrix(gfxMatrix::Translation(-gfxPoint(bounds.x, bounds.y)));
nsRefPtr<nsRenderingContext> ctx = new nsRenderingContext();
ctx->Init(aDest->DeviceContext(), context);
ctx->Init(context);
aItem->Paint(aBuilder, ctx);
RefPtr<SourceSurface> surface = tempDT->Snapshot();
@ -4479,7 +4479,7 @@ FrameLayerBuilder::DrawPaintedLayer(PaintedLayer* aLayer,
}
nsRefPtr<nsRenderingContext> rc = new nsRenderingContext();
rc->Init(presContext->DeviceContext(), aContext);
rc->Init(aContext);
if (shouldDrawRectsSeparately) {
nsIntRegionRectIterator it(aRegionToDraw);

View File

@ -683,7 +683,10 @@ nsCSSRendering::PaintBorderWithStyleBorder(nsPresContext* aPresContext,
} else {
// We're drawing borders around the joined continuation boxes so we need
// to clip that to the slice that we want for this frame.
aRenderingContext.IntersectClip(aBorderArea);
aRenderingContext.ThebesContext()->
Clip(NSRectToRect(aBorderArea,
aForFrame->PresContext()->AppUnitsPerDevPixel(),
*aRenderingContext.GetDrawTarget()));
}
} else {
MOZ_ASSERT(joinedBorderArea.IsEqualEdges(aBorderArea),
@ -1310,7 +1313,7 @@ nsCSSRendering::PaintBoxShadowOuter(nsPresContext* aPresContext,
// Draw the widget shape
gfxContextMatrixAutoSaveRestore save(shadowContext);
nsRefPtr<nsRenderingContext> wrapperCtx = new nsRenderingContext();
wrapperCtx->Init(aPresContext->DeviceContext(), shadowContext);
wrapperCtx->Init(shadowContext);
gfxPoint devPixelOffset =
nsLayoutUtils::PointToGfxPoint(nsPoint(shadowItem->mXOffset,
shadowItem->mYOffset),
@ -1368,7 +1371,10 @@ nsCSSRendering::PaintBoxShadowOuter(nsPresContext* aPresContext,
}
}
}
aRenderingContext.IntersectClip(fragmentClip);
aRenderingContext.ThebesContext()->
Clip(NSRectToRect(fragmentClip,
aForFrame->PresContext()->AppUnitsPerDevPixel(),
*aRenderingContext.GetDrawTarget()));
gfxCornerSizes clipRectRadii;
if (hasBorderRadius) {
@ -3207,7 +3213,9 @@ DrawBorderImage(nsPresContext* aPresContext,
nsRect clip = aBorderArea;
clip.Inflate(imageOutset);
autoSR.EnsureSaved(aRenderingContext.ThebesContext());
aRenderingContext.IntersectClip(clip);
aRenderingContext.ThebesContext()->
Clip(NSRectToRect(clip, aForFrame->PresContext()->AppUnitsPerDevPixel(),
*aRenderingContext.GetDrawTarget()));
}
} else {
borderImgArea = aBorderArea;
@ -3490,6 +3498,7 @@ static void
DrawSolidBorderSegment(nsRenderingContext& aContext,
nsRect aRect,
nscolor aColor,
int32_t aAppUnitsPerDevPixel,
nscoord aTwipsPerPixel,
uint8_t aStartBevelSide = 0,
nscoord aStartBevelOffset = 0,
@ -3497,7 +3506,6 @@ DrawSolidBorderSegment(nsRenderingContext& aContext,
nscoord aEndBevelOffset = 0)
{
DrawTarget* drawTarget = aContext.GetDrawTarget();
int32_t appUnitsPerDevPixel = aContext.AppUnitsPerDevPixel();
ColorPattern color(ToDeviceColor(aColor));
DrawOptions drawOptions(1.f, CompositionOp::OP_OVER, AntialiasMode::NONE);
@ -3507,26 +3515,30 @@ DrawSolidBorderSegment(nsRenderingContext& aContext,
// simple line or rectangle
if ((NS_SIDE_TOP == aStartBevelSide) || (NS_SIDE_BOTTOM == aStartBevelSide)) {
if (1 == aRect.height)
aContext.DrawLine(aRect.TopLeft(), aRect.BottomLeft());
StrokeLineWithSnapping(aRect.TopLeft(), aRect.BottomLeft(),
aAppUnitsPerDevPixel, *drawTarget,
color, StrokeOptions(), drawOptions);
else
drawTarget->FillRect(NSRectToRect(aRect, appUnitsPerDevPixel, *drawTarget),
drawTarget->FillRect(NSRectToRect(aRect, aAppUnitsPerDevPixel, *drawTarget),
color, drawOptions);
}
else {
if (1 == aRect.width)
aContext.DrawLine(aRect.TopLeft(), aRect.TopRight());
StrokeLineWithSnapping(aRect.TopLeft(), aRect.TopRight(),
aAppUnitsPerDevPixel, *drawTarget,
color, StrokeOptions(), drawOptions);
else
drawTarget->FillRect(NSRectToRect(aRect, appUnitsPerDevPixel, *drawTarget),
drawTarget->FillRect(NSRectToRect(aRect, aAppUnitsPerDevPixel, *drawTarget),
color, drawOptions);
}
}
else {
// polygon with beveling
Point poly[4];
SetPoly(NSRectToRect(aRect, appUnitsPerDevPixel), poly);
SetPoly(NSRectToRect(aRect, aAppUnitsPerDevPixel), poly);
Float startBevelOffset =
NSAppUnitsToFloatPixels(aStartBevelOffset, appUnitsPerDevPixel);
NSAppUnitsToFloatPixels(aStartBevelOffset, aAppUnitsPerDevPixel);
switch(aStartBevelSide) {
case NS_SIDE_TOP:
poly[0].x += startBevelOffset;
@ -3542,7 +3554,7 @@ DrawSolidBorderSegment(nsRenderingContext& aContext,
}
Float endBevelOffset =
NSAppUnitsToFloatPixels(aEndBevelOffset, appUnitsPerDevPixel);
NSAppUnitsToFloatPixels(aEndBevelOffset, aAppUnitsPerDevPixel);
switch(aEndBevelSide) {
case NS_SIDE_TOP:
poly[1].x -= endBevelOffset;
@ -3598,14 +3610,13 @@ nsCSSRendering::DrawTableBorderSegment(nsRenderingContext& aContext,
nscolor aBorderColor,
const nsStyleBackground* aBGColor,
const nsRect& aBorder,
int32_t aAppUnitsPerDevPixel,
int32_t aAppUnitsPerCSSPixel,
uint8_t aStartBevelSide,
nscoord aStartBevelOffset,
uint8_t aEndBevelSide,
nscoord aEndBevelOffset)
{
aContext.SetColor (aBorderColor);
bool horizontal = ((NS_SIDE_TOP == aStartBevelSide) || (NS_SIDE_BOTTOM == aStartBevelSide));
nscoord twipsPerPixel = NSIntPixelsToAppUnits(1, aAppUnitsPerCSSPixel);
uint8_t ridgeGroove = NS_STYLE_BORDER_STYLE_RIDGE;
@ -3621,6 +3632,8 @@ nsCSSRendering::DrawTableBorderSegment(nsRenderingContext& aContext,
AntialiasMode oldMode = ctx->CurrentAntialiasMode();
ctx->SetAntialiasMode(AntialiasMode::NONE);
ctx->SetColor(aBorderColor);
switch (aBorderStyle) {
case NS_STYLE_BORDER_STYLE_NONE:
case NS_STYLE_BORDER_STYLE_HIDDEN:
@ -3642,21 +3655,21 @@ nsCSSRendering::DrawTableBorderSegment(nsRenderingContext& aContext,
if (horizontal) {
GetDashInfo(aBorder.width, dashLength, twipsPerPixel, numDashSpaces, startDashLength, endDashLength);
nsRect rect(aBorder.x, aBorder.y, startDashLength, aBorder.height);
DrawSolidBorderSegment(aContext, rect, aBorderColor, twipsPerPixel);
DrawSolidBorderSegment(aContext, rect, aBorderColor, aAppUnitsPerDevPixel, twipsPerPixel);
for (int32_t spaceX = 0; spaceX < numDashSpaces; spaceX++) {
rect.x += rect.width + dashLength;
rect.width = (spaceX == (numDashSpaces - 1)) ? endDashLength : dashLength;
DrawSolidBorderSegment(aContext, rect, aBorderColor, twipsPerPixel);
DrawSolidBorderSegment(aContext, rect, aBorderColor, aAppUnitsPerDevPixel, twipsPerPixel);
}
}
else {
GetDashInfo(aBorder.height, dashLength, twipsPerPixel, numDashSpaces, startDashLength, endDashLength);
nsRect rect(aBorder.x, aBorder.y, aBorder.width, startDashLength);
DrawSolidBorderSegment(aContext, rect, aBorderColor, twipsPerPixel);
DrawSolidBorderSegment(aContext, rect, aBorderColor, aAppUnitsPerDevPixel, twipsPerPixel);
for (int32_t spaceY = 0; spaceY < numDashSpaces; spaceY++) {
rect.y += rect.height + dashLength;
rect.height = (spaceY == (numDashSpaces - 1)) ? endDashLength : dashLength;
DrawSolidBorderSegment(aContext, rect, aBorderColor, twipsPerPixel);
DrawSolidBorderSegment(aContext, rect, aBorderColor, aAppUnitsPerDevPixel, twipsPerPixel);
}
}
}
@ -3667,7 +3680,7 @@ nsCSSRendering::DrawTableBorderSegment(nsRenderingContext& aContext,
if ((horizontal && (twipsPerPixel >= aBorder.height)) ||
(!horizontal && (twipsPerPixel >= aBorder.width))) {
// a one pixel border
DrawSolidBorderSegment(aContext, aBorder, aBorderColor, twipsPerPixel,
DrawSolidBorderSegment(aContext, aBorder, aBorderColor, aAppUnitsPerDevPixel, twipsPerPixel,
aStartBevelSide, aStartBevelOffset,
aEndBevelSide, aEndBevelOffset);
}
@ -3679,7 +3692,7 @@ nsCSSRendering::DrawTableBorderSegment(nsRenderingContext& aContext,
mozilla::css::Side ridgeGrooveSide = (horizontal) ? NS_SIDE_TOP : NS_SIDE_LEFT;
// FIXME: In theory, this should use the visited-dependent
// background color, but I don't care.
aContext.SetColor (
ctx->SetColor(
MakeBevelColor(ridgeGrooveSide, ridgeGroove, aBGColor->mBackgroundColor, aBorderColor));
nsRect rect(aBorder);
nscoord half;
@ -3693,7 +3706,7 @@ nsCSSRendering::DrawTableBorderSegment(nsRenderingContext& aContext,
if (NS_SIDE_TOP == aEndBevelSide) {
rect.width -= endBevel;
}
DrawSolidBorderSegment(aContext, rect, aBorderColor, twipsPerPixel, aStartBevelSide,
DrawSolidBorderSegment(aContext, rect, aBorderColor, aAppUnitsPerDevPixel, twipsPerPixel, aStartBevelSide,
startBevel, aEndBevelSide, endBevel);
}
else { // left, right
@ -3706,7 +3719,7 @@ nsCSSRendering::DrawTableBorderSegment(nsRenderingContext& aContext,
if (NS_SIDE_LEFT == aEndBevelSide) {
rect.height -= endBevel;
}
DrawSolidBorderSegment(aContext, rect, aBorderColor, twipsPerPixel, aStartBevelSide,
DrawSolidBorderSegment(aContext, rect, aBorderColor, aAppUnitsPerDevPixel, twipsPerPixel, aStartBevelSide,
startBevel, aEndBevelSide, endBevel);
}
@ -3714,7 +3727,7 @@ nsCSSRendering::DrawTableBorderSegment(nsRenderingContext& aContext,
ridgeGrooveSide = (NS_SIDE_TOP == ridgeGrooveSide) ? NS_SIDE_BOTTOM : NS_SIDE_RIGHT;
// FIXME: In theory, this should use the visited-dependent
// background color, but I don't care.
aContext.SetColor (
ctx->SetColor(
MakeBevelColor(ridgeGrooveSide, ridgeGroove, aBGColor->mBackgroundColor, aBorderColor));
if (horizontal) {
rect.y = rect.y + half;
@ -3726,7 +3739,7 @@ nsCSSRendering::DrawTableBorderSegment(nsRenderingContext& aContext,
if (NS_SIDE_BOTTOM == aEndBevelSide) {
rect.width -= endBevel;
}
DrawSolidBorderSegment(aContext, rect, aBorderColor, twipsPerPixel, aStartBevelSide,
DrawSolidBorderSegment(aContext, rect, aBorderColor, aAppUnitsPerDevPixel, twipsPerPixel, aStartBevelSide,
startBevel, aEndBevelSide, endBevel);
}
else {
@ -3739,7 +3752,7 @@ nsCSSRendering::DrawTableBorderSegment(nsRenderingContext& aContext,
if (NS_SIDE_RIGHT == aEndBevelSide) {
rect.height -= endBevel;
}
DrawSolidBorderSegment(aContext, rect, aBorderColor, twipsPerPixel, aStartBevelSide,
DrawSolidBorderSegment(aContext, rect, aBorderColor, aAppUnitsPerDevPixel, twipsPerPixel, aStartBevelSide,
startBevel, aEndBevelSide, endBevel);
}
}
@ -3766,7 +3779,7 @@ nsCSSRendering::DrawTableBorderSegment(nsRenderingContext& aContext,
if (NS_SIDE_TOP == aEndBevelSide) {
topRect.width -= aEndBevelOffset - endBevel;
}
DrawSolidBorderSegment(aContext, topRect, aBorderColor, twipsPerPixel, aStartBevelSide,
DrawSolidBorderSegment(aContext, topRect, aBorderColor, aAppUnitsPerDevPixel, twipsPerPixel, aStartBevelSide,
startBevel, aEndBevelSide, endBevel);
// draw the botom line or rect
@ -3779,7 +3792,7 @@ nsCSSRendering::DrawTableBorderSegment(nsRenderingContext& aContext,
if (NS_SIDE_BOTTOM == aEndBevelSide) {
bottomRect.width -= aEndBevelOffset - endBevel;
}
DrawSolidBorderSegment(aContext, bottomRect, aBorderColor, twipsPerPixel, aStartBevelSide,
DrawSolidBorderSegment(aContext, bottomRect, aBorderColor, aAppUnitsPerDevPixel, twipsPerPixel, aStartBevelSide,
startBevel, aEndBevelSide, endBevel);
}
else { // left, right
@ -3793,7 +3806,7 @@ nsCSSRendering::DrawTableBorderSegment(nsRenderingContext& aContext,
if (NS_SIDE_LEFT == aEndBevelSide) {
leftRect.height -= aEndBevelOffset - endBevel;
}
DrawSolidBorderSegment(aContext, leftRect, aBorderColor, twipsPerPixel, aStartBevelSide,
DrawSolidBorderSegment(aContext, leftRect, aBorderColor, aAppUnitsPerDevPixel, twipsPerPixel, aStartBevelSide,
startBevel, aEndBevelSide, endBevel);
nscoord widthOffset = aBorder.width - thirdWidth;
@ -3805,14 +3818,14 @@ nsCSSRendering::DrawTableBorderSegment(nsRenderingContext& aContext,
if (NS_SIDE_RIGHT == aEndBevelSide) {
rightRect.height -= aEndBevelOffset - endBevel;
}
DrawSolidBorderSegment(aContext, rightRect, aBorderColor, twipsPerPixel, aStartBevelSide,
DrawSolidBorderSegment(aContext, rightRect, aBorderColor, aAppUnitsPerDevPixel, twipsPerPixel, aStartBevelSide,
startBevel, aEndBevelSide, endBevel);
}
break;
}
// else fall through to solid
case NS_STYLE_BORDER_STYLE_SOLID:
DrawSolidBorderSegment(aContext, aBorder, aBorderColor, twipsPerPixel, aStartBevelSide,
DrawSolidBorderSegment(aContext, aBorder, aBorderColor, aAppUnitsPerDevPixel, twipsPerPixel, aStartBevelSide,
aStartBevelOffset, aEndBevelSide, aEndBevelOffset);
break;
case NS_STYLE_BORDER_STYLE_OUTSET:

View File

@ -589,6 +589,7 @@ struct nsCSSRendering {
nscolor aBorderColor,
const nsStyleBackground* aBGColor,
const nsRect& aBorderRect,
int32_t aAppUnitsPerDevPixel,
int32_t aAppUnitsPerCSSPixel,
uint8_t aStartBevelSide = 0,
nscoord aStartBevelOffset = 0,

View File

@ -3062,12 +3062,16 @@ nsDisplayBoxShadowInner::Paint(nsDisplayListBuilder* aBuilder,
PROFILER_LABEL("nsDisplayBoxShadowInner", "Paint",
js::ProfileEntry::Category::GRAPHICS);
DrawTarget* drawTarget = aCtx->GetDrawTarget();
gfxContext* gfx = aCtx->ThebesContext();
int32_t appUnitsPerDevPixel = mFrame->PresContext()->AppUnitsPerDevPixel();
for (uint32_t i = 0; i < rects.Length(); ++i) {
aCtx->ThebesContext()->Save();
aCtx->IntersectClip(rects[i]);
gfx->Save();
gfx->Clip(NSRectToRect(rects[i], appUnitsPerDevPixel, *drawTarget));
nsCSSRendering::PaintBoxShadowInner(presContext, *aCtx, mFrame,
borderRect, rects[i]);
aCtx->ThebesContext()->Restore();
gfx->Restore();
}
}

View File

@ -4710,7 +4710,7 @@ nsLayoutUtils::PaintTextShadow(const nsIFrame* aFrame,
// Conjure an nsRenderingContext from a gfxContext for drawing the text
// to blur.
nsRefPtr<nsRenderingContext> renderingContext = new nsRenderingContext();
renderingContext->Init(presCtx->DeviceContext(), shadowContext);
renderingContext->Init(shadowContext);
aDestCtx->Save();
aDestCtx->NewPath();
@ -7060,6 +7060,19 @@ Rect NSRectToRect(const nsRect& aRect, double aAppUnitsPerPixel,
return rect;
}
void StrokeLineWithSnapping(const nsPoint& aP1, const nsPoint& aP2,
int32_t aAppUnitsPerDevPixel,
DrawTarget& aDrawTarget,
const Pattern& aPattern,
const StrokeOptions& aStrokeOptions,
const DrawOptions& aDrawOptions)
{
Point p1 = NSPointToPoint(aP1, aAppUnitsPerDevPixel);
Point p2 = NSPointToPoint(aP2, aAppUnitsPerDevPixel);
SnapLineToDevicePixelsForStroking(p1, p2, aDrawTarget);
aDrawTarget.StrokeLine(p1, p2, aPattern, aStrokeOptions, aDrawOptions);
}
namespace layout {

View File

@ -2425,6 +2425,13 @@ gfx::Rect NSRectToRect(const nsRect& aRect, double aAppUnitsPerPixel);
gfx::Rect NSRectToRect(const nsRect& aRect, double aAppUnitsPerPixel,
const gfx::DrawTarget& aSnapDT);
void StrokeLineWithSnapping(const nsPoint& aP1, const nsPoint& aP2,
int32_t aAppUnitsPerDevPixel,
gfx::DrawTarget& aDrawTarget,
const gfx::Pattern& aPattern,
const gfx::StrokeOptions& aStrokeOptions = gfx::StrokeOptions(),
const gfx::DrawOptions& aDrawOptions = gfx::DrawOptions());
namespace layout {
/**

View File

@ -3071,7 +3071,7 @@ PresShell::CreateReferenceRenderingContext()
nsRefPtr<nsRenderingContext> rc;
if (mPresContext->IsScreen()) {
rc = new nsRenderingContext();
rc->Init(devCtx, gfxPlatform::GetPlatform()->ScreenReferenceDrawTarget());
rc->Init(gfxPlatform::GetPlatform()->ScreenReferenceDrawTarget());
} else {
rc = devCtx->CreateRenderingContext();
}
@ -4807,7 +4807,7 @@ PresShell::RenderDocument(const nsRect& aRect, uint32_t aFlags,
AutoSaveRestoreRenderingState _(this);
nsRefPtr<nsRenderingContext> rc = new nsRenderingContext();
rc->Init(devCtx, aThebesContext);
rc->Init(aThebesContext);
bool wouldFlushRetainedLayers = false;
uint32_t flags = nsLayoutUtils::PAINT_IGNORE_SUPPRESSION;
@ -5061,8 +5061,6 @@ PresShell::PaintRangePaintInfo(nsTArray<nsAutoPtr<RangePaintInfo> >* aItems,
if (!pc || aArea.width == 0 || aArea.height == 0)
return nullptr;
nsDeviceContext* deviceContext = pc->DeviceContext();
// use the rectangle to create the surface
nsIntRect pixelArea = aArea.ToOutsidePixels(pc->AppUnitsPerDevPixel());
@ -5075,7 +5073,7 @@ PresShell::PaintRangePaintInfo(nsTArray<nsAutoPtr<RangePaintInfo> >* aItems,
// if the image is larger in one or both directions than half the size of
// the available screen area, scale the image down to that size.
nsRect maxSize;
deviceContext->GetClientRect(maxSize);
pc->DeviceContext()->GetClientRect(maxSize);
nscoord maxWidth = pc->AppUnitsToDevPixels(maxSize.width >> 1);
nscoord maxHeight = pc->AppUnitsToDevPixels(maxSize.height >> 1);
bool resize = (pixelArea.width > maxWidth || pixelArea.height > maxHeight);
@ -5128,7 +5126,7 @@ PresShell::PaintRangePaintInfo(nsTArray<nsAutoPtr<RangePaintInfo> >* aItems,
}
nsRefPtr<nsRenderingContext> rc = new nsRenderingContext();
rc->Init(deviceContext, ctx);
rc->Init(ctx);
gfxMatrix initialTM = ctx->CurrentMatrix();
@ -10109,9 +10107,9 @@ void ReflowCountMgr::PaintCount(const char* aName,
ColorPattern black(ToDeviceColor(Color(0.f, 0.f, 0.f, 1.f)));
drawTarget->FillRect(devPxRect, black);
aRenderingContext->SetColor(color2);
aRenderingContext->ThebesContext()->SetColor(color2);
aRenderingContext->DrawString(buf, strlen(buf), x+15,y+15);
aRenderingContext->SetColor(color);
aRenderingContext->ThebesContext()->SetColor(color);
aRenderingContext->DrawString(buf, strlen(buf), x,y);
aRenderingContext->ThebesContext()->Restore();

View File

@ -1505,9 +1505,13 @@ void nsComboboxControlFrame::PaintFocus(nsRenderingContext& aRenderingContext,
if (eventStates.HasState(NS_EVENT_STATE_DISABLED) || sFocused != this)
return;
aRenderingContext.ThebesContext()->Save();
gfxContext* gfx = aRenderingContext.ThebesContext();
gfx->Save();
nsRect clipRect = mDisplayFrame->GetRect() + aPt;
aRenderingContext.IntersectClip(clipRect);
gfx->Clip(NSRectToRect(clipRect,
PresContext()->AppUnitsPerDevPixel(),
*aRenderingContext.GetDrawTarget()));
// REVIEW: Why does the old code paint mDisplayFrame again? We've
// already painted it in the children above. So clipping it here won't do
@ -1527,7 +1531,7 @@ void nsComboboxControlFrame::PaintFocus(nsRenderingContext& aRenderingContext,
StrokeSnappedEdgesOfRect(r, *aRenderingContext.GetDrawTarget(),
color, strokeOptions);
aRenderingContext.ThebesContext()->Restore();
gfx->Restore();
}
//---------------------------------------------------------

View File

@ -5,7 +5,9 @@
#include "nsFieldSetFrame.h"
#include "mozilla/gfx/2D.h"
#include "nsCSSAnonBoxes.h"
#include "nsLayoutUtils.h"
#include "nsLegendFrame.h"
#include "nsCSSRendering.h"
#include <algorithm>
@ -21,6 +23,7 @@
#include "mozilla/Maybe.h"
using namespace mozilla;
using namespace mozilla::gfx;
using namespace mozilla::layout;
nsContainerFrame*
@ -219,12 +222,15 @@ nsFieldSetFrame::PaintBorderBackground(nsRenderingContext& aRenderingContext,
clipRect.width = legendRect.x - rect.x;
clipRect.height = topBorder;
aRenderingContext.ThebesContext()->Save();
aRenderingContext.IntersectClip(clipRect);
DrawTarget* drawTarget = aRenderingContext.GetDrawTarget();
gfxContext* gfx = aRenderingContext.ThebesContext();
int32_t appUnitsPerDevPixel = presContext->AppUnitsPerDevPixel();
gfx->Save();
gfx->Clip(NSRectToRect(clipRect, appUnitsPerDevPixel, *drawTarget));
nsCSSRendering::PaintBorder(presContext, aRenderingContext, this,
aDirtyRect, rect, mStyleContext);
aRenderingContext.ThebesContext()->Restore();
gfx->Restore();
// draw right side
@ -233,12 +239,11 @@ nsFieldSetFrame::PaintBorderBackground(nsRenderingContext& aRenderingContext,
clipRect.width = rect.XMost() - legendRect.XMost();
clipRect.height = topBorder;
aRenderingContext.ThebesContext()->Save();
aRenderingContext.IntersectClip(clipRect);
gfx->Save();
gfx->Clip(NSRectToRect(clipRect, appUnitsPerDevPixel, *drawTarget));
nsCSSRendering::PaintBorder(presContext, aRenderingContext, this,
aDirtyRect, rect, mStyleContext);
aRenderingContext.ThebesContext()->Restore();
gfx->Restore();
// draw bottom
@ -246,12 +251,11 @@ nsFieldSetFrame::PaintBorderBackground(nsRenderingContext& aRenderingContext,
clipRect.y += topBorder;
clipRect.height = mRect.height - (yoff + topBorder);
aRenderingContext.ThebesContext()->Save();
aRenderingContext.IntersectClip(clipRect);
gfx->Save();
gfx->Clip(NSRectToRect(clipRect, appUnitsPerDevPixel, *drawTarget));
nsCSSRendering::PaintBorder(presContext, aRenderingContext, this,
aDirtyRect, rect, mStyleContext);
aRenderingContext.ThebesContext()->Restore();
gfx->Restore();
} else {
nsCSSRendering::PaintBorder(presContext, aRenderingContext, this,

View File

@ -212,7 +212,7 @@ nsDisplayTextOverflowMarker::Paint(nsDisplayListBuilder* aBuilder,
nsLayoutUtils::PaintTextShadow(mFrame, aCtx, mRect, mVisibleRect,
foregroundColor, PaintTextShadowCallback,
(void*)this);
aCtx->SetColor(foregroundColor);
aCtx->ThebesContext()->SetColor(foregroundColor);
PaintTextToContext(aCtx, nsPoint(0, 0));
}

View File

@ -319,7 +319,6 @@ nsBulletFrame::PaintBullet(nsRenderingContext& aRenderingContext, nsPoint aPt,
nsRefPtr<nsFontMetrics> fm;
ColorPattern color(ToDeviceColor(
nsLayoutUtils::GetColor(this, eCSSProperty_color)));
aRenderingContext.SetColor(nsLayoutUtils::GetColor(this, eCSSProperty_color));
DrawTarget* drawTarget = aRenderingContext.GetDrawTarget();
int32_t appUnitsPerDevPixel = PresContext()->AppUnitsPerDevPixel();
@ -421,6 +420,9 @@ nsBulletFrame::PaintBullet(nsRenderingContext& aRenderingContext, nsPoint aPt,
break;
default:
aRenderingContext.ThebesContext()->SetColor(
nsLayoutUtils::GetColor(this, eCSSProperty_color));
nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm),
GetFontSizeInflation());
GetListItemText(text);

View File

@ -300,7 +300,7 @@ nsDisplayCanvasBackgroundImage::Paint(nsDisplayListBuilder* aBuilder,
ctx->SetMatrix(
ctx->CurrentMatrix().Translate(-destRect.x, -destRect.y));
context = new nsRenderingContext();
context->Init(aCtx->DeviceContext(), ctx);
context->Init(ctx);
}
}
#endif

View File

@ -11,6 +11,7 @@
#include "gfxUtils.h"
#include "mozilla/DebugOnly.h"
#include "mozilla/gfx/2D.h"
#include "mozilla/gfx/Helpers.h"
#include "mozilla/Likely.h"
#include "nsGenericHTMLElement.h"
@ -111,7 +112,7 @@ public:
void SetVisibility(bool aVisibility);
void SetColor(nscolor aColor);
void PaintBorder(nsRenderingContext& aRenderingContext, nsPoint aPt);
void PaintBorder(DrawTarget* aDrawTarget, nsPoint aPt);
protected:
nsHTMLFramesetBorderFrame(nsStyleContext* aContext, int32_t aWidth, bool aVertical, bool aVisible);
@ -1491,7 +1492,7 @@ void nsDisplayFramesetBorder::Paint(nsDisplayListBuilder* aBuilder,
nsRenderingContext* aCtx)
{
static_cast<nsHTMLFramesetBorderFrame*>(mFrame)->
PaintBorder(*aCtx, ToReferenceFrame());
PaintBorder(aCtx->GetDrawTarget(), ToReferenceFrame());
}
void
@ -1503,49 +1504,52 @@ nsHTMLFramesetBorderFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
new (aBuilder) nsDisplayFramesetBorder(aBuilder, this));
}
void nsHTMLFramesetBorderFrame::PaintBorder(nsRenderingContext& aRenderingContext,
void nsHTMLFramesetBorderFrame::PaintBorder(DrawTarget* aDrawTarget,
nsPoint aPt)
{
nscolor WHITE = NS_RGB(255, 255, 255);
nscolor bgColor =
LookAndFeel::GetColor(LookAndFeel::eColorID_WidgetBackground,
NS_RGB(200,200,200));
nscolor fgColor =
LookAndFeel::GetColor(LookAndFeel::eColorID_WidgetForeground,
NS_RGB(0,0,0));
nscolor hltColor =
LookAndFeel::GetColor(LookAndFeel::eColorID_Widget3DHighlight,
NS_RGB(255,255,255));
nscolor sdwColor =
LookAndFeel::GetColor(LookAndFeel::eColorID_Widget3DShadow,
NS_RGB(128,128,128));
gfxContext* ctx = aRenderingContext.ThebesContext();
gfxPoint toRefFrame =
nsLayoutUtils::PointToGfxPoint(aPt, PresContext()->AppUnitsPerDevPixel());
gfxContextMatrixAutoSaveRestore autoSR(ctx);
ctx->SetMatrix(ctx->CurrentMatrix().Translate(toRefFrame));
nscoord widthInPixels = nsPresContext::AppUnitsToIntCSSPixels(mWidth);
nscoord pixelWidth = nsPresContext::CSSPixelsToAppUnits(1);
if (widthInPixels <= 0)
return;
nsPoint start(0,0);
nsPoint end((mVertical) ? 0 : mRect.width, (mVertical) ? mRect.height : 0);
ColorPattern bgColor(ToDeviceColor(
LookAndFeel::GetColor(LookAndFeel::eColorID_WidgetBackground,
NS_RGB(200, 200, 200))));
nscolor color = WHITE;
ColorPattern fgColor(ToDeviceColor(
LookAndFeel::GetColor(LookAndFeel::eColorID_WidgetForeground,
NS_RGB(0, 0, 0))));
ColorPattern hltColor(ToDeviceColor(
LookAndFeel::GetColor(LookAndFeel::eColorID_Widget3DHighlight,
NS_RGB(255, 255, 255))));
ColorPattern sdwColor(ToDeviceColor(
LookAndFeel::GetColor(LookAndFeel::eColorID_Widget3DShadow,
NS_RGB(128, 128, 128))));
ColorPattern color(ToDeviceColor(NS_RGB(255, 255, 255))); // default to white
if (mVisibility || mVisibilityOverride) {
color = (NO_COLOR == mColor) ? bgColor : mColor;
color = (NO_COLOR == mColor) ? bgColor :
ColorPattern(ToDeviceColor(mColor));
}
aRenderingContext.SetColor(color);
int32_t appUnitsPerDevPixel = PresContext()->AppUnitsPerDevPixel();
Point toRefFrame = NSPointToPoint(aPt, appUnitsPerDevPixel);
AutoRestoreTransform autoRestoreTransform(aDrawTarget);
aDrawTarget->SetTransform(
aDrawTarget->GetTransform().PreTranslate(toRefFrame));
nsPoint start(0, 0);
nsPoint end = mVertical ? nsPoint(0, mRect.height) : nsPoint(mRect.width, 0);
// draw grey or white first
for (int i = 0; i < widthInPixels; i++) {
aRenderingContext.DrawLine (start, end);
StrokeLineWithSnapping(start, end, appUnitsPerDevPixel, *aDrawTarget,
color);
if (mVertical) {
start.x += pixelWidth;
end.x = start.x;
@ -1559,30 +1563,30 @@ void nsHTMLFramesetBorderFrame::PaintBorder(nsRenderingContext& aRenderingContex
return;
if (widthInPixels >= 5) {
aRenderingContext.SetColor(hltColor);
start.x = (mVertical) ? pixelWidth : 0;
start.y = (mVertical) ? 0 : pixelWidth;
end.x = (mVertical) ? start.x : mRect.width;
end.y = (mVertical) ? mRect.height : start.y;
aRenderingContext.DrawLine(start, end);
StrokeLineWithSnapping(start, end, appUnitsPerDevPixel, *aDrawTarget,
hltColor);
}
if (widthInPixels >= 2) {
aRenderingContext.SetColor(sdwColor);
start.x = (mVertical) ? mRect.width - (2 * pixelWidth) : 0;
start.y = (mVertical) ? 0 : mRect.height - (2 * pixelWidth);
end.x = (mVertical) ? start.x : mRect.width;
end.y = (mVertical) ? mRect.height : start.y;
aRenderingContext.DrawLine(start, end);
StrokeLineWithSnapping(start, end, appUnitsPerDevPixel, *aDrawTarget,
sdwColor);
}
if (widthInPixels >= 1) {
aRenderingContext.SetColor(fgColor);
start.x = (mVertical) ? mRect.width - pixelWidth : 0;
start.y = (mVertical) ? 0 : mRect.height - pixelWidth;
end.x = (mVertical) ? start.x : mRect.width;
end.y = (mVertical) ? mRect.height : start.y;
aRenderingContext.DrawLine(start, end);
StrokeLineWithSnapping(start, end, appUnitsPerDevPixel, *aDrawTarget,
fgColor);
}
}

View File

@ -1076,7 +1076,7 @@ nsImageFrame::DisplayAltText(nsPresContext* aPresContext,
const nsRect& aRect)
{
// Set font and color
aRenderingContext.SetColor(StyleColor()->mColor);
aRenderingContext.ThebesContext()->SetColor(StyleColor()->mColor);
nsRefPtr<nsFontMetrics> fm;
nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm),
nsLayoutUtils::FontSizeInflationFor(this));
@ -1220,9 +1220,13 @@ nsImageFrame::DisplayAltFeedback(nsRenderingContext& aRenderingContext,
return;
}
DrawTarget* drawTarget = aRenderingContext.GetDrawTarget();
gfxContext* gfx = aRenderingContext.ThebesContext();
// Clip so we don't render outside the inner rect
aRenderingContext.ThebesContext()->Save();
aRenderingContext.IntersectClip(inner);
gfx->Save();
gfx->Clip(NSRectToRect(inner, PresContext()->AppUnitsPerDevPixel(),
*drawTarget));
// Check if we should display image placeholders
if (gIconLoad->mPrefShowPlaceholders) {
@ -1261,7 +1265,6 @@ nsImageFrame::DisplayAltFeedback(nsRenderingContext& aRenderingContext,
// just draw some graffiti in the mean time
if (!iconUsed) {
ColorPattern color(ToDeviceColor(Color(1.f, 0.f, 0.f, 1.f)));
DrawTarget* drawTarget = aRenderingContext.GetDrawTarget();
nscoord iconXPos = (vis->mDirection == NS_STYLE_DIRECTION_RTL) ?
inner.XMost() - size : inner.x;

View File

@ -4,6 +4,10 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsPageFrame.h"
#include "mozilla/gfx/2D.h"
#include "nsDeviceContext.h"
#include "nsLayoutUtils.h"
#include "nsPresContext.h"
#include "nsRenderingContext.h"
#include "nsGkAtoms.h"
@ -25,6 +29,7 @@ extern PRLogModuleInfo *GetLayoutPrintingLog();
#endif
using namespace mozilla;
using namespace mozilla::gfx;
nsPageFrame*
NS_NewPageFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
@ -372,12 +377,16 @@ nsPageFrame::DrawHeaderFooter(nsRenderingContext& aRenderingContext,
y = aRect.YMost() - aHeight - mPD->mEdgePaperMargin.bottom;
}
DrawTarget* drawTarget = aRenderingContext.GetDrawTarget();
gfxContext* gfx = aRenderingContext.ThebesContext();
// set up new clip and draw the text
aRenderingContext.ThebesContext()->Save();
aRenderingContext.SetColor(NS_RGB(0,0,0));
aRenderingContext.IntersectClip(aRect);
gfx->Save();
gfx->Clip(NSRectToRect(aRect, PresContext()->AppUnitsPerDevPixel(),
*drawTarget));
aRenderingContext.ThebesContext()->SetColor(NS_RGB(0,0,0));
nsLayoutUtils::DrawString(this, &aRenderingContext, str.get(), str.Length(), nsPoint(x, y + aAscent));
aRenderingContext.ThebesContext()->Restore();
gfx->Restore();
}
}
@ -578,7 +587,7 @@ nsPageFrame::PaintHeaderFooter(nsRenderingContext& aRenderingContext,
}
nsRect rect(aPt, mRect.Size());
aRenderingContext.SetColor(NS_RGB(0,0,0));
aRenderingContext.ThebesContext()->SetColor(NS_RGB(0,0,0));
// Get the FontMetrics to determine width.height of strings
nsRefPtr<nsFontMetrics> fontMet;

View File

@ -6,6 +6,7 @@
#include "nsSimplePageSequenceFrame.h"
#include "nsCOMPtr.h"
#include "nsDeviceContext.h"
#include "nsPresContext.h"
#include "gfxContext.h"
#include "nsRenderingContext.h"

View File

@ -10,6 +10,7 @@
#include "mozilla/MathAlgorithms.h"
#include "nsCOMPtr.h"
#include "nsDeviceContext.h"
#include "nsIFrame.h"
#include "nsLayoutUtils.h"
#include "nsPresContext.h"

View File

@ -106,7 +106,7 @@ void nsDisplayMathMLError::Paint(nsDisplayListBuilder* aBuilder,
ColorPattern red(ToDeviceColor(Color(1.f, 0.f, 0.f, 1.f)));
drawTarget->FillRect(rect, red);
aCtx->SetColor(NS_RGB(255,255,255));
aCtx->ThebesContext()->SetColor(NS_RGB(255,255,255));
nscoord ascent = aCtx->FontMetrics()->MaxAscent();
NS_NAMED_LITERAL_STRING(errorMsg, "invalid-markup");
aCtx->DrawString(errorMsg.get(), uint32_t(errorMsg.Length()),

View File

@ -774,7 +774,8 @@ void nsDisplayNotation::Paint(nsDisplayListBuilder* aBuilder,
// paint the frame with the current text color
ColorPattern color(ToDeviceColor(
mFrame->GetVisitedDependentColor(eCSSProperty_color)));
aCtx->SetColor(mFrame->GetVisitedDependentColor(eCSSProperty_color));
aCtx->ThebesContext()->SetColor(
mFrame->GetVisitedDependentColor(eCSSProperty_color));
DrawTarget* drawTarget = aCtx->GetDrawTarget();

View File

@ -604,7 +604,7 @@ void nsDisplayMathMLSlash::Paint(nsDisplayListBuilder* aBuilder,
gfxRect rect = presContext->AppUnitsToGfxUnits(mRect + ToReferenceFrame());
// paint with the current text color
aCtx->SetColor(mFrame->GetVisitedDependentColor(eCSSProperty_color));
aCtx->ThebesContext()->SetColor(mFrame->GetVisitedDependentColor(eCSSProperty_color));
// draw the slash as a parallelogram
gfxContext *gfxCtx = aCtx->ThebesContext();

View File

@ -17,6 +17,7 @@
#include "mozilla/Likely.h"
#include "mozilla/LookAndFeel.h"
#include "nsDeviceContext.h"
#include "nsRuleNode.h"
#include "nscore.h"
#include "nsIWidget.h"

View File

@ -449,7 +449,7 @@ nsFilterInstance::BuildSourceImage(DrawTarget* aTargetDT)
PreMultiply(deviceToFilterSpace));
nsRefPtr<nsRenderingContext> tmpCtx(new nsRenderingContext());
tmpCtx->Init(mTargetFrame->PresContext()->DeviceContext(), ctx);
tmpCtx->Init(ctx);
mPaintCallback->Paint(tmpCtx, mTargetFrame, mPaintTransform, &dirty);
mSourceGraphic.mSourceSurface = offscreenDT->Snapshot();

View File

@ -473,6 +473,7 @@ nsSVGIntegrationUtils::PaintFramesWithEffects(nsRenderingContext* aCtx,
bool isTrivialClip = clipPathFrame ? clipPathFrame->IsTrivial() : true;
DrawTarget* drawTarget = aCtx->GetDrawTarget();
gfxContext* gfx = aCtx->ThebesContext();
gfxContextMatrixAutoSaveRestore matrixAutoSaveRestore(gfx);
@ -519,8 +520,11 @@ nsSVGIntegrationUtils::PaintFramesWithEffects(nsRenderingContext* aCtx,
|| aFrame->StyleDisplay()->mMixBlendMode != NS_STYLE_BLEND_NORMAL) {
complexEffects = true;
gfx->Save();
aCtx->IntersectClip(aFrame->GetVisualOverflowRectRelativeToSelf() +
toUserSpace);
nsRect clipRect =
aFrame->GetVisualOverflowRectRelativeToSelf() + toUserSpace;
gfx->Clip(NSRectToRect(clipRect,
aFrame->PresContext()->AppUnitsPerDevPixel(),
*drawTarget));
gfx->PushGroup(gfxContentType::COLOR_ALPHA);
}
@ -638,7 +642,7 @@ PaintFrameCallback::operator()(gfxContext* aContext,
mFrame->AddStateBits(NS_FRAME_DRAWING_AS_PAINTSERVER);
nsRefPtr<nsRenderingContext> context(new nsRenderingContext());
context->Init(mFrame->PresContext()->DeviceContext(), aContext);
context->Init(aContext);
aContext->Save();
// Clip to aFillRect so that we don't paint outside.

View File

@ -227,7 +227,7 @@ nsSVGMaskFrame::GetMaskForMaskedFrame(gfxContext* aContext,
aContext->CurrentMatrix() * gfxMatrix::Translation(-maskSurfaceRect.TopLeft());
nsRefPtr<nsRenderingContext> tmpCtx = new nsRenderingContext();
tmpCtx->Init(this->PresContext()->DeviceContext(), maskDT);
tmpCtx->Init(maskDT);
tmpCtx->ThebesContext()->SetMatrix(maskSurfaceMatrix);
mMatrixForChildren = GetMaskTransform(aMaskedFrame) * aMatrix;

View File

@ -379,7 +379,7 @@ nsSVGPatternFrame::PaintPattern(const DrawTarget* aDrawTarget,
}
nsRefPtr<nsRenderingContext> context(new nsRenderingContext());
context->Init(aSource->PresContext()->DeviceContext(), dt);
context->Init(dt);
gfxContext* gfx = context->ThebesContext();
// Fill with transparent black

View File

@ -28,6 +28,7 @@
#include "nsIFrame.h"
#include "nsIPresShell.h"
#include "nsISVGChildFrame.h"
#include "nsLayoutUtils.h"
#include "nsPresContext.h"
#include "nsRenderingContext.h"
#include "nsStyleCoord.h"
@ -556,6 +557,7 @@ nsSVGUtils::PaintFrameWithEffects(nsIFrame *aFrame,
if (opacity != 1.0f && CanOptimizeOpacity(aFrame))
opacity = 1.0f;
DrawTarget* drawTarget = aContext->GetDrawTarget();
gfxContext *gfx = aContext->ThebesContext();
bool complexEffects = false;
@ -587,7 +589,9 @@ nsSVGUtils::PaintFrameWithEffects(nsIFrame *aFrame,
// GetCanvasTM().
overflowRect = overflowRect + aFrame->GetPosition();
}
aContext->IntersectClip(overflowRect);
gfx->Clip(NSRectToRect(overflowRect,
aFrame->PresContext()->AppUnitsPerDevPixel(),
*drawTarget));
}
gfx->PushGroup(gfxContentType::COLOR_ALPHA);
}
@ -1585,7 +1589,7 @@ nsSVGUtils::PaintSVGGlyph(Element* aElement, gfxContext* aContext,
aContext->GetDrawTarget()->AddUserData(&gfxTextContextPaint::sUserDataKey,
aContextPaint, nullptr);
nsRefPtr<nsRenderingContext> context(new nsRenderingContext());
context->Init(frame->PresContext()->DeviceContext(), aContext);
context->Init(aContext);
svgFrame->NotifySVGChanged(nsISVGChildFrame::TRANSFORM_CHANGED);
gfxMatrix m;
if (frame->GetContent()->IsSVG()) {

View File

@ -335,21 +335,28 @@ nsTableCellFrame::DecorateForSelection(nsRenderingContext& aRenderingContext,
nscoord onePixel = nsPresContext::CSSPixelsToAppUnits(1);
aRenderingContext.SetColor(bordercolor);
aRenderingContext.DrawLine(onePixel, 0, mRect.width, 0);
aRenderingContext.DrawLine(0, onePixel, 0, mRect.height);
aRenderingContext.DrawLine(onePixel, mRect.height, mRect.width, mRect.height);
aRenderingContext.DrawLine(mRect.width, onePixel, mRect.width, mRect.height);
StrokeLineWithSnapping(nsPoint(onePixel, 0), nsPoint(mRect.width, 0),
appUnitsPerDevPixel, *drawTarget, color);
StrokeLineWithSnapping(nsPoint(0, onePixel), nsPoint(0, mRect.height),
appUnitsPerDevPixel, *drawTarget, color);
StrokeLineWithSnapping(nsPoint(onePixel, mRect.height),
nsPoint(mRect.width, mRect.height),
appUnitsPerDevPixel, *drawTarget, color);
StrokeLineWithSnapping(nsPoint(mRect.width, onePixel),
nsPoint(mRect.width, mRect.height),
appUnitsPerDevPixel, *drawTarget, color);
//middle
nsRect r(onePixel, onePixel,
mRect.width - onePixel, mRect.height - onePixel);
Rect devPixelRect = NSRectToRect(r, appUnitsPerDevPixel, *drawTarget);
drawTarget->StrokeRect(devPixelRect, color);
//shading
aRenderingContext.DrawLine(2*onePixel, mRect.height-2*onePixel,
mRect.width-onePixel, mRect.height- (2*onePixel));
aRenderingContext.DrawLine(mRect.width - (2*onePixel), 2*onePixel,
mRect.width - (2*onePixel), mRect.height-onePixel);
StrokeLineWithSnapping(nsPoint(2*onePixel, mRect.height-2*onePixel),
nsPoint(mRect.width-onePixel, mRect.height- (2*onePixel)),
appUnitsPerDevPixel, *drawTarget, color);
StrokeLineWithSnapping(nsPoint(mRect.width - (2*onePixel), 2*onePixel),
nsPoint(mRect.width - (2*onePixel), mRect.height-onePixel),
appUnitsPerDevPixel, *drawTarget, color);
}
}
}

View File

@ -6929,6 +6929,10 @@ BCVerticalSeg::Paint(BCPaintBorderIterator& aIter,
uint8_t style = NS_STYLE_BORDER_STYLE_SOLID;
nscolor color = 0xFFFFFFFF;
// All the tables frames have the same presContext, so we just use any one
// that exists here:
int32_t appUnitsPerDevPixel = col->PresContext()->AppUnitsPerDevPixel();
switch (mOwner) {
case eTableOwner:
owner = aIter.mTable;
@ -6989,6 +6993,7 @@ BCVerticalSeg::Paint(BCPaintBorderIterator& aIter,
NS_SIDE_RIGHT : NS_SIDE_LEFT;
nsCSSRendering::DrawTableBorderSegment(aRenderingContext, style, color,
aIter.mTableBgColor, segRect,
appUnitsPerDevPixel,
nsPresContext::AppUnitsPerCSSPixel(),
topBevelSide, mTopBevelOffset,
bottomBevelSide, bottomBevelOffset);
@ -7109,6 +7114,10 @@ BCHorizontalSeg::Paint(BCPaintBorderIterator& aIter,
nsIFrame* col;
nsIFrame* owner = nullptr;
// All the tables frames have the same presContext, so we just use any one
// that exists here:
int32_t appUnitsPerDevPixel = row->PresContext()->AppUnitsPerDevPixel();
uint8_t style = NS_STYLE_BORDER_STYLE_SOLID;
nscolor color = 0xFFFFFFFF;
@ -7171,6 +7180,7 @@ BCHorizontalSeg::Paint(BCPaintBorderIterator& aIter,
if (aIter.mTableIsLTR) {
nsCSSRendering::DrawTableBorderSegment(aRenderingContext, style, color,
aIter.mTableBgColor, segRect,
appUnitsPerDevPixel,
nsPresContext::AppUnitsPerCSSPixel(),
mLeftBevelSide,
nsPresContext::CSSPixelsToAppUnits(mLeftBevelOffset),
@ -7180,6 +7190,7 @@ BCHorizontalSeg::Paint(BCPaintBorderIterator& aIter,
segRect.x -= segRect.width;
nsCSSRendering::DrawTableBorderSegment(aRenderingContext, style, color,
aIter.mTableBgColor, segRect,
appUnitsPerDevPixel,
nsPresContext::AppUnitsPerCSSPixel(),
mRightBevelSide, mRightBevelOffset,
mLeftBevelSide,

View File

@ -37,6 +37,7 @@
#include "mozilla/gfx/2D.h"
#include "nsBoxLayoutState.h"
#include "mozilla/dom/Touch.h"
#include "mozilla/Move.h"
#include "nsStyleContext.h"
#include "nsPlaceholderFrame.h"
#include "nsPresContext.h"
@ -1292,7 +1293,7 @@ nsDisplayXULDebug::Paint(nsDisplayListBuilder* aBuilder,
nsRenderingContext* aCtx)
{
static_cast<nsBoxFrame*>(mFrame)->
PaintXULDebugOverlay(*aCtx, ToReferenceFrame());
PaintXULDebugOverlay(*aCtx->GetDrawTarget(), ToReferenceFrame());
}
static void
@ -1472,8 +1473,7 @@ nsBoxFrame::PaintXULDebugBackground(nsRenderingContext& aRenderingContext,
}
void
nsBoxFrame::PaintXULDebugOverlay(nsRenderingContext& aRenderingContext,
nsPoint aPt)
nsBoxFrame::PaintXULDebugOverlay(DrawTarget& aDrawTarget, nsPoint aPt)
nsMargin border;
GetBorder(border);
@ -1516,14 +1516,12 @@ nsBoxFrame::PaintXULDebugOverlay(nsRenderingContext& aRenderingContext,
nscoord flex = kid->GetFlex(state);
if (!kid->IsCollapsed()) {
aRenderingContext.SetColor(NS_RGB(255,255,255));
if (isHorizontal)
borderSize = cr.width;
else
borderSize = cr.height;
DrawSpacer(GetPresContext(), aRenderingContext, isHorizontal, flex, x, y, borderSize, spacerSize);
DrawSpacer(GetPresContext(), aDrawTarget, isHorizontal, flex, x, y, borderSize, spacerSize);
}
kid = GetNextBox(kid);
@ -1598,28 +1596,34 @@ nsBoxFrame::GetDebug(bool& aDebug)
#ifdef DEBUG_LAYOUT
void
nsBoxFrame::DrawLine(nsRenderingContext& aRenderingContext, bool aHorizontal, nscoord x1, nscoord y1, nscoord x2, nscoord y2)
nsBoxFrame::DrawLine(DrawTarget& aDrawTarget, bool aHorizontal, nscoord x1, nscoord y1, nscoord x2, nscoord y2)
{
if (aHorizontal)
aRenderingContext.DrawLine(x1,y1,x2,y2);
else
aRenderingContext.DrawLine(y1,x1,y2,x2);
nsPoint p1(x1, y1);
nsPoint p2(x2, y2);
if (!aHorizontal) {
Swap(p1.x, p1.y);
Swap(p2.x, p2.y);
}
ColorPattern white(ToDeviceColor(Color(1.f, 1.f, 1.f, 1.f)));
StrokeLineWithSnapping(p1, p2, PresContext()->AppUnitsPerDevPixel(),
aDrawTarget, color);
}
void
nsBoxFrame::FillRect(nsRenderingContext& aRenderingContext, bool aHorizontal, nscoord x, nscoord y, nscoord width, nscoord height)
nsBoxFrame::FillRect(DrawTarget& aDrawTarget, bool aHorizontal, nscoord x, nscoord y, nscoord width, nscoord height)
{
DrawTarget* drawTarget = aRenderingContext->GetDrawTarget();
Rect rect = NSRectToRect(aHorizontal ? nsRect(x, y, width, height) :
nsRect(y, x, height, width),
PresContext()->AppUnitsPerDevPixel(),
*drawTarget);
aDrawTarget);
ColorPattern white(ToDeviceColor(Color(1.f, 1.f, 1.f, 1.f)));
drawTarget->FillRect(rect, white);
aDrawTarget.FillRect(rect, white);
}
void
nsBoxFrame::DrawSpacer(nsPresContext* aPresContext, nsRenderingContext& aRenderingContext, bool aHorizontal, int32_t flex, nscoord x, nscoord y, nscoord size, nscoord spacerSize)
nsBoxFrame::DrawSpacer(nsPresContext* aPresContext, DrawTarget& aDrawTarget,
bool aHorizontal, int32_t flex, nscoord x, nscoord y,
nscoord size, nscoord spacerSize)
{
nscoord onePixel = aPresContext->IntScaledPixelsToTwips(1);
@ -1639,21 +1643,19 @@ nsBoxFrame::DrawSpacer(nsPresContext* aPresContext, nsRenderingContext& aRenderi
int halfCoilSize = coilSize/2;
if (flex == 0) {
DrawLine(aRenderingContext, aHorizontal, x,y + spacerSize/2, x + size, y + spacerSize/2);
DrawLine(aDrawTarget, aHorizontal, x,y + spacerSize/2, x + size, y + spacerSize/2);
} else {
for (int i=0; i < coils; i++)
{
DrawLine(aRenderingContext, aHorizontal, offset, center+halfSpacer, offset+halfCoilSize, center-halfSpacer);
DrawLine(aRenderingContext, aHorizontal, offset+halfCoilSize, center-halfSpacer, offset+coilSize, center+halfSpacer);
DrawLine(aDrawTarget, aHorizontal, offset, center+halfSpacer, offset+halfCoilSize, center-halfSpacer);
DrawLine(aDrawTarget, aHorizontal, offset+halfCoilSize, center-halfSpacer, offset+coilSize, center+halfSpacer);
offset += coilSize;
}
}
FillRect(aRenderingContext, aHorizontal, x + size - spacerSize/2, y, spacerSize/2, spacerSize);
FillRect(aRenderingContext, aHorizontal, x, y, spacerSize/2, spacerSize);
//DrawKnob(aPresContext, aRenderingContext, x + size - spacerSize, y, spacerSize);
FillRect(aDrawTarget, aHorizontal, x + size - spacerSize/2, y, spacerSize/2, spacerSize);
FillRect(aDrawTarget, aHorizontal, x, y, spacerSize/2, spacerSize);
}
void

View File

@ -21,6 +21,12 @@
class nsBoxLayoutState;
namespace mozilla {
namespace gfx {
class DrawTarget;
}
}
nsIFrame* NS_NewBoxFrame(nsIPresShell* aPresShell,
nsStyleContext* aContext,
bool aIsRoot,
@ -30,6 +36,9 @@ nsIFrame* NS_NewBoxFrame(nsIPresShell* aPresShell,
class nsBoxFrame : public nsContainerFrame
{
protected:
typedef mozilla::gfx::DrawTarget DrawTarget;
public:
NS_DECL_FRAMEARENA_HELPERS
#ifdef DEBUG
@ -174,7 +183,7 @@ protected:
virtual void GetBoxName(nsAutoString& aName) MOZ_OVERRIDE;
void PaintXULDebugBackground(nsRenderingContext& aRenderingContext,
nsPoint aPt);
void PaintXULDebugOverlay(nsRenderingContext& aRenderingContext,
void PaintXULDebugOverlay(DrawTarget& aRenderingContext,
nsPoint aPt);
#endif
@ -224,9 +233,9 @@ private:
void GetValue(nsPresContext* aPresContext, const nsSize& a, const nsSize& b, char* value);
void GetValue(nsPresContext* aPresContext, int32_t a, int32_t b, char* value);
void DrawSpacer(nsPresContext* aPresContext, nsRenderingContext& aRenderingContext, bool aHorizontal, int32_t flex, nscoord x, nscoord y, nscoord size, nscoord spacerSize);
void DrawLine(nsRenderingContext& aRenderingContext, bool aHorizontal, nscoord x1, nscoord y1, nscoord x2, nscoord y2);
void FillRect(nsRenderingContext& aRenderingContext, bool aHorizontal, nscoord x, nscoord y, nscoord width, nscoord height);
void DrawSpacer(nsPresContext* aPresContext, DrawTarget& aDrawTarget, bool aHorizontal, int32_t flex, nscoord x, nscoord y, nscoord size, nscoord spacerSize);
void DrawLine(DrawTarget& aDrawTarget, bool aHorizontal, nscoord x1, nscoord y1, nscoord x2, nscoord y2);
void FillRect(DrawTarget& aDrawTarget, bool aHorizontal, nscoord x, nscoord y, nscoord width, nscoord height);
#endif
virtual void UpdateMouseThrough();

View File

@ -6,11 +6,17 @@
// YY need to pass isMultiple before create called
#include "nsBoxFrame.h"
#include "mozilla/gfx/2D.h"
#include "nsCSSRendering.h"
#include "nsLayoutUtils.h"
#include "nsRenderingContext.h"
#include "nsStyleContext.h"
#include "nsDisplayList.h"
using namespace mozilla;
using namespace mozilla::gfx;
class nsGroupBoxFrame : public nsBoxFrame {
public:
NS_DECL_FRAMEARENA_HELPERS
@ -123,6 +129,10 @@ nsGroupBoxFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
void
nsGroupBoxFrame::PaintBorderBackground(nsRenderingContext& aRenderingContext,
nsPoint aPt, const nsRect& aDirtyRect) {
DrawTarget* drawTarget = aRenderingContext.GetDrawTarget();
gfxContext* gfx = aRenderingContext.ThebesContext();
Sides skipSides;
const nsStyleBorder* borderStyleData = StyleBorder();
const nsMargin& border = borderStyleData->GetComputedBorder();
@ -152,6 +162,7 @@ nsGroupBoxFrame::PaintBorderBackground(nsRenderingContext& aRenderingContext,
nsCSSRendering::PAINTBG_SYNC_DECODE_IMAGES);
if (groupBox) {
int32_t appUnitsPerDevPixel = PresContext()->AppUnitsPerDevPixel();
// we should probably use PaintBorderEdges to do this but for now just use clipping
// to achieve the same effect.
@ -161,13 +172,11 @@ nsGroupBoxFrame::PaintBorderBackground(nsRenderingContext& aRenderingContext,
clipRect.width = groupRect.x - rect.x;
clipRect.height = border.top;
aRenderingContext.ThebesContext()->Save();
aRenderingContext.IntersectClip(clipRect);
gfx->Save();
gfx->Clip(NSRectToRect(clipRect, appUnitsPerDevPixel, *drawTarget));
nsCSSRendering::PaintBorder(presContext, aRenderingContext, this,
aDirtyRect, rect, mStyleContext, skipSides);
aRenderingContext.ThebesContext()->Restore();
gfx->Restore();
// draw right side
clipRect = rect;
@ -175,14 +184,11 @@ nsGroupBoxFrame::PaintBorderBackground(nsRenderingContext& aRenderingContext,
clipRect.width = rect.XMost() - groupRect.XMost();
clipRect.height = border.top;
aRenderingContext.ThebesContext()->Save();
aRenderingContext.IntersectClip(clipRect);
gfx->Save();
gfx->Clip(NSRectToRect(clipRect, appUnitsPerDevPixel, *drawTarget));
nsCSSRendering::PaintBorder(presContext, aRenderingContext, this,
aDirtyRect, rect, mStyleContext, skipSides);
aRenderingContext.ThebesContext()->Restore();
gfx->Restore();
// draw bottom
@ -190,12 +196,11 @@ nsGroupBoxFrame::PaintBorderBackground(nsRenderingContext& aRenderingContext,
clipRect.y += border.top;
clipRect.height = mRect.height - (yoff + border.top);
aRenderingContext.ThebesContext()->Save();
aRenderingContext.IntersectClip(clipRect);
gfx->Save();
gfx->Clip(NSRectToRect(clipRect, appUnitsPerDevPixel, *drawTarget));
nsCSSRendering::PaintBorder(presContext, aRenderingContext, this,
aDirtyRect, rect, mStyleContext, skipSides);
aRenderingContext.ThebesContext()->Restore();
gfx->Restore();
} else {
nsCSSRendering::PaintBorder(presContext, aRenderingContext, this,

View File

@ -507,7 +507,7 @@ nsTextBoxFrame::DrawText(nsRenderingContext& aRenderingContext,
nscolor c = aOverrideColor ? *aOverrideColor : StyleColor()->mColor;
ColorPattern color(ToDeviceColor(c));
aRenderingContext.SetColor(c);
aRenderingContext.ThebesContext()->SetColor(c);
nsresult rv = NS_ERROR_FAILURE;

View File

@ -2797,8 +2797,13 @@ nsTreeBodyFrame::PaintTreeBody(nsRenderingContext& aRenderingContext,
{
// Update our available height and our page count.
CalcInnerBox();
aRenderingContext.ThebesContext()->Save();
aRenderingContext.IntersectClip(mInnerBox + aPt);
DrawTarget* drawTarget = aRenderingContext.GetDrawTarget();
gfxContext* gfx = aRenderingContext.ThebesContext();
gfx->Save();
gfx->Clip(NSRectToRect(mInnerBox + aPt, PresContext()->AppUnitsPerDevPixel(),
*drawTarget));
int32_t oldPageCount = mPageLength;
if (!mHasFixedRowCount)
mPageLength = mInnerBox.height/mRowHeight;
@ -2856,7 +2861,7 @@ nsTreeBodyFrame::PaintTreeBody(nsRenderingContext& aRenderingContext,
PaintDropFeedback(feedbackRect, PresContext(), aRenderingContext, aDirtyRect, aPt);
}
}
aRenderingContext.ThebesContext()->Restore();
gfx->Restore();
}
@ -3613,7 +3618,6 @@ nsTreeBodyFrame::PaintText(int32_t aRowIndex,
// Set our color.
ColorPattern color(ToDeviceColor(textContext->StyleColor()->mColor));
aRenderingContext.SetColor(textContext->StyleColor()->mColor);
// Draw decorations.
uint8_t decorations = textContext->StyleTextReset()->mTextDecorationLine;
@ -3647,6 +3651,7 @@ nsTreeBodyFrame::PaintText(int32_t aRowIndex,
ctx->PushGroup(gfxContentType::COLOR_ALPHA);
}
ctx->SetColor(textContext->StyleColor()->mColor);
nsLayoutUtils::DrawString(this, &aRenderingContext, text.get(), text.Length(),
textRect.TopLeft() + nsPoint(0, baseline), cellContext);
@ -3752,9 +3757,6 @@ nsTreeBodyFrame::PaintProgressMeter(int32_t aRowIndex,
// Adjust the rect for its border and padding.
AdjustForBorderPadding(meterContext, meterRect);
// Set our color.
aRenderingContext.SetColor(meterContext->StyleColor()->mColor);
// Now obtain the value for our cell.
nsAutoString value;
mView->GetCellValue(aRowIndex, aColumn, value);

View File

@ -4857,10 +4857,13 @@ nsHttpChannel::BeginConnect()
if (mLoadFlags & VALIDATE_ALWAYS || BYPASS_LOCAL_CACHE(mLoadFlags))
mCaps |= NS_HTTP_REFRESH_DNS;
if (!mConnectionInfo->UsingHttpProxy()) {
if (!mConnectionInfo->UsingHttpProxy() &&
!(mLoadFlags & (LOAD_NO_NETWORK_IO | LOAD_ONLY_FROM_CACHE))) {
// Start a DNS lookup very early in case the real open is queued the DNS can
// happen in parallel. Do not do so in the presence of an HTTP proxy as
// all lookups other than for the proxy itself are done by the proxy.
// Also we don't do a lookup if the LOAD_NO_NETWORK_IO or
// LOAD_ONLY_FROM_CACHE flags are set.
//
// We keep the DNS prefetch object around so that we can retrieve
// timing information from it. There is no guarantee that we actually

View File

@ -84,12 +84,6 @@
[Parsing: <http://2001::1\]:80> against <http://example.org/foo/bar>]
expected: FAIL
[Parsing: <http://[2001::1\]> against <http://example.org/foo/bar>]
expected: FAIL
[Parsing: <http://[2001::1\]:80> against <http://example.org/foo/bar>]
expected: FAIL
[Parsing: <madeupscheme:/example.com/> against <http://example.org/foo/bar>]
expected: FAIL

View File

@ -84,12 +84,6 @@
[Parsing: <http://2001::1\]:80> against <http://example.org/foo/bar>]
expected: FAIL
[Parsing: <http://[2001::1\]> against <http://example.org/foo/bar>]
expected: FAIL
[Parsing: <http://[2001::1\]:80> against <http://example.org/foo/bar>]
expected: FAIL
[Parsing: <madeupscheme:/example.com/> against <http://example.org/foo/bar>]
expected: FAIL

View File

@ -4,6 +4,8 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsNativeThemeCocoa.h"
#include "nsDeviceContext.h"
#include "nsObjCExceptions.h"
#include "nsNumberControlFrame.h"
#include "nsRangeFrame.h"

View File

@ -4,8 +4,10 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsNativeThemeWin.h"
#include "mozilla/EventStates.h"
#include "mozilla/WindowsVersion.h"
#include "nsDeviceContext.h"
#include "nsRenderingContext.h"
#include "nsRect.h"
#include "nsSize.h"