зеркало из https://github.com/mozilla/gecko-dev.git
Bug 651021 - Make nsRenderingContext a stack class. r=jrmuizel
This commit is contained in:
Родитель
3cacbfa9b0
Коммит
bf49eb7f25
|
@ -6,6 +6,7 @@
|
||||||
#include "nsDeviceContext.h"
|
#include "nsDeviceContext.h"
|
||||||
#include <algorithm> // for max
|
#include <algorithm> // for max
|
||||||
#include "gfxASurface.h" // for gfxASurface, etc
|
#include "gfxASurface.h" // for gfxASurface, etc
|
||||||
|
#include "gfxContext.h"
|
||||||
#include "gfxFont.h" // for gfxFontGroup
|
#include "gfxFont.h" // for gfxFontGroup
|
||||||
#include "gfxImageSurface.h" // for gfxImageSurface
|
#include "gfxImageSurface.h" // for gfxImageSurface
|
||||||
#include "gfxPoint.h" // for gfxSize
|
#include "gfxPoint.h" // for gfxSize
|
||||||
|
@ -385,7 +386,7 @@ nsDeviceContext::Init(nsIWidget *aWidget)
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
already_AddRefed<nsRenderingContext>
|
already_AddRefed<gfxContext>
|
||||||
nsDeviceContext::CreateRenderingContext()
|
nsDeviceContext::CreateRenderingContext()
|
||||||
{
|
{
|
||||||
nsRefPtr<gfxASurface> printingSurface = mPrintingSurface;
|
nsRefPtr<gfxASurface> printingSurface = mPrintingSurface;
|
||||||
|
@ -400,7 +401,6 @@ nsDeviceContext::CreateRenderingContext()
|
||||||
printingSurface = mCachedPrintingSurface;
|
printingSurface = mCachedPrintingSurface;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
nsRefPtr<nsRenderingContext> pContext = new nsRenderingContext();
|
|
||||||
|
|
||||||
RefPtr<gfx::DrawTarget> dt =
|
RefPtr<gfx::DrawTarget> dt =
|
||||||
gfxPlatform::GetPlatform()->CreateDrawTargetForSurface(printingSurface,
|
gfxPlatform::GetPlatform()->CreateDrawTargetForSurface(printingSurface,
|
||||||
|
@ -409,13 +409,10 @@ nsDeviceContext::CreateRenderingContext()
|
||||||
#ifdef XP_MACOSX
|
#ifdef XP_MACOSX
|
||||||
dt->AddUserData(&gfxContext::sDontUseAsSourceKey, dt, nullptr);
|
dt->AddUserData(&gfxContext::sDontUseAsSourceKey, dt, nullptr);
|
||||||
#endif
|
#endif
|
||||||
|
dt->AddUserData(&sDisablePixelSnapping, (void*)0x1, nullptr);
|
||||||
|
|
||||||
pContext->Init(dt);
|
nsRefPtr<gfxContext> pContext = new gfxContext(dt);
|
||||||
pContext->GetDrawTarget()->AddUserData(&sDisablePixelSnapping,
|
pContext->SetMatrix(gfxMatrix::Scaling(mPrintingScale, mPrintingScale));
|
||||||
(void*)0x1, nullptr);
|
|
||||||
pContext->ThebesContext()->SetMatrix(gfxMatrix::Scaling(mPrintingScale,
|
|
||||||
mPrintingScale));
|
|
||||||
|
|
||||||
return pContext.forget();
|
return pContext.forget();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
#include "mozilla/AppUnits.h" // for AppUnits
|
#include "mozilla/AppUnits.h" // for AppUnits
|
||||||
|
|
||||||
class gfxASurface;
|
class gfxASurface;
|
||||||
|
class gfxContext;
|
||||||
class gfxTextPerfMetrics;
|
class gfxTextPerfMetrics;
|
||||||
class gfxUserFontSet;
|
class gfxUserFontSet;
|
||||||
struct nsFont;
|
struct nsFont;
|
||||||
|
@ -32,7 +33,6 @@ class nsIScreen;
|
||||||
class nsIScreenManager;
|
class nsIScreenManager;
|
||||||
class nsIWidget;
|
class nsIWidget;
|
||||||
struct nsRect;
|
struct nsRect;
|
||||||
class nsRenderingContext;
|
|
||||||
|
|
||||||
class nsDeviceContext MOZ_FINAL
|
class nsDeviceContext MOZ_FINAL
|
||||||
{
|
{
|
||||||
|
@ -61,7 +61,7 @@ public:
|
||||||
*
|
*
|
||||||
* @return the new rendering context (guaranteed to be non-null)
|
* @return the new rendering context (guaranteed to be non-null)
|
||||||
*/
|
*/
|
||||||
already_AddRefed<nsRenderingContext> CreateRenderingContext();
|
already_AddRefed<gfxContext> CreateRenderingContext();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the number of app units in one CSS pixel; this number is global,
|
* Gets the number of app units in one CSS pixel; this number is global,
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
#include "gfxContext.h"
|
#include "gfxContext.h"
|
||||||
#include "mozilla/Attributes.h"
|
#include "mozilla/Attributes.h"
|
||||||
#include "nsISupportsImpl.h"
|
#include "nsCOMPtr.h"
|
||||||
#include "nsRefPtr.h"
|
#include "nsRefPtr.h"
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
|
@ -17,12 +17,24 @@ class DrawTarget;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class nsRenderingContext MOZ_FINAL
|
class MOZ_STACK_CLASS nsRenderingContext MOZ_FINAL
|
||||||
{
|
{
|
||||||
typedef mozilla::gfx::DrawTarget DrawTarget;
|
typedef mozilla::gfx::DrawTarget DrawTarget;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
NS_INLINE_DECL_REFCOUNTING(nsRenderingContext)
|
nsRenderingContext() {}
|
||||||
|
|
||||||
|
nsRenderingContext(gfxContext* aThebesContext)
|
||||||
|
: mThebes(aThebesContext)
|
||||||
|
{}
|
||||||
|
|
||||||
|
nsRenderingContext(already_AddRefed<gfxContext>&& aThebesContext)
|
||||||
|
: mThebes(aThebesContext)
|
||||||
|
{}
|
||||||
|
|
||||||
|
nsRenderingContext(DrawTarget* aDrawTarget) {
|
||||||
|
Init(aDrawTarget);
|
||||||
|
}
|
||||||
|
|
||||||
void Init(gfxContext* aThebesContext);
|
void Init(gfxContext* aThebesContext);
|
||||||
void Init(DrawTarget* aDrawTarget);
|
void Init(DrawTarget* aDrawTarget);
|
||||||
|
@ -32,9 +44,6 @@ public:
|
||||||
DrawTarget *GetDrawTarget() { return mThebes->GetDrawTarget(); }
|
DrawTarget *GetDrawTarget() { return mThebes->GetDrawTarget(); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Private destructor, to discourage deletion outside of Release():
|
|
||||||
~nsRenderingContext() {}
|
|
||||||
|
|
||||||
nsRefPtr<gfxContext> mThebes;
|
nsRefPtr<gfxContext> mThebes;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -4240,10 +4240,9 @@ static void DebugPaintItem(DrawTarget& aDrawTarget,
|
||||||
SurfaceFormat::B8G8R8A8);
|
SurfaceFormat::B8G8R8A8);
|
||||||
nsRefPtr<gfxContext> context = new gfxContext(tempDT);
|
nsRefPtr<gfxContext> context = new gfxContext(tempDT);
|
||||||
context->SetMatrix(gfxMatrix::Translation(-bounds.x, -bounds.y));
|
context->SetMatrix(gfxMatrix::Translation(-bounds.x, -bounds.y));
|
||||||
nsRefPtr<nsRenderingContext> ctx = new nsRenderingContext();
|
nsRenderingContext ctx(context);
|
||||||
ctx->Init(context);
|
|
||||||
|
|
||||||
aItem->Paint(aBuilder, ctx);
|
aItem->Paint(aBuilder, &ctx);
|
||||||
RefPtr<SourceSurface> surface = tempDT->Snapshot();
|
RefPtr<SourceSurface> surface = tempDT->Snapshot();
|
||||||
DumpPaintedImage(aItem, surface);
|
DumpPaintedImage(aItem, surface);
|
||||||
|
|
||||||
|
@ -4513,8 +4512,7 @@ FrameLayerBuilder::DrawPaintedLayer(PaintedLayer* aLayer,
|
||||||
userData->mXScale, userData->mYScale);
|
userData->mXScale, userData->mYScale);
|
||||||
}
|
}
|
||||||
|
|
||||||
nsRefPtr<nsRenderingContext> rc = new nsRenderingContext();
|
nsRenderingContext rc(aContext);
|
||||||
rc->Init(aContext);
|
|
||||||
|
|
||||||
if (shouldDrawRectsSeparately) {
|
if (shouldDrawRectsSeparately) {
|
||||||
nsIntRegionRectIterator it(aRegionToDraw);
|
nsIntRegionRectIterator it(aRegionToDraw);
|
||||||
|
@ -4533,7 +4531,7 @@ FrameLayerBuilder::DrawPaintedLayer(PaintedLayer* aLayer,
|
||||||
aContext->CurrentMatrix().Translate(aLayer->GetResidualTranslation() - gfxPoint(offset.x, offset.y)).
|
aContext->CurrentMatrix().Translate(aLayer->GetResidualTranslation() - gfxPoint(offset.x, offset.y)).
|
||||||
Scale(userData->mXScale, userData->mYScale));
|
Scale(userData->mXScale, userData->mYScale));
|
||||||
|
|
||||||
layerBuilder->PaintItems(entry->mItems, *iterRect, aContext, rc,
|
layerBuilder->PaintItems(entry->mItems, *iterRect, aContext, &rc,
|
||||||
builder, presContext,
|
builder, presContext,
|
||||||
offset, userData->mXScale, userData->mYScale,
|
offset, userData->mXScale, userData->mYScale,
|
||||||
entry->mCommonClipCount);
|
entry->mCommonClipCount);
|
||||||
|
@ -4546,7 +4544,7 @@ FrameLayerBuilder::DrawPaintedLayer(PaintedLayer* aLayer,
|
||||||
aContext->CurrentMatrix().Translate(aLayer->GetResidualTranslation() - gfxPoint(offset.x, offset.y)).
|
aContext->CurrentMatrix().Translate(aLayer->GetResidualTranslation() - gfxPoint(offset.x, offset.y)).
|
||||||
Scale(userData->mXScale,userData->mYScale));
|
Scale(userData->mXScale,userData->mYScale));
|
||||||
|
|
||||||
layerBuilder->PaintItems(entry->mItems, aRegionToDraw.GetBounds(), aContext, rc,
|
layerBuilder->PaintItems(entry->mItems, aRegionToDraw.GetBounds(), aContext, &rc,
|
||||||
builder, presContext,
|
builder, presContext,
|
||||||
offset, userData->mXScale, userData->mYScale,
|
offset, userData->mXScale, userData->mYScale,
|
||||||
entry->mCommonClipCount);
|
entry->mCommonClipCount);
|
||||||
|
|
|
@ -439,8 +439,8 @@ RestyleManager::RecomputePosition(nsIFrame* aFrame)
|
||||||
// the frame, and then get the offsets and size from it. If the frame's size
|
// the frame, and then get the offsets and size from it. If the frame's size
|
||||||
// doesn't need to change, we can simply update the frame position. Otherwise
|
// doesn't need to change, we can simply update the frame position. Otherwise
|
||||||
// we fall back to a reflow.
|
// we fall back to a reflow.
|
||||||
nsRefPtr<nsRenderingContext> rc =
|
nsRenderingContext rc(
|
||||||
aFrame->PresContext()->PresShell()->CreateReferenceRenderingContext();
|
aFrame->PresContext()->PresShell()->CreateReferenceRenderingContext());
|
||||||
|
|
||||||
// Construct a bogus parent reflow state so that there's a usable
|
// Construct a bogus parent reflow state so that there's a usable
|
||||||
// containing block reflow state.
|
// containing block reflow state.
|
||||||
|
@ -451,7 +451,7 @@ RestyleManager::RecomputePosition(nsIFrame* aFrame)
|
||||||
|
|
||||||
nsFrameState savedState = parentFrame->GetStateBits();
|
nsFrameState savedState = parentFrame->GetStateBits();
|
||||||
nsHTMLReflowState parentReflowState(aFrame->PresContext(), parentFrame,
|
nsHTMLReflowState parentReflowState(aFrame->PresContext(), parentFrame,
|
||||||
rc, parentSize);
|
&rc, parentSize);
|
||||||
parentFrame->RemoveStateBits(~nsFrameState(0));
|
parentFrame->RemoveStateBits(~nsFrameState(0));
|
||||||
parentFrame->AddStateBits(savedState);
|
parentFrame->AddStateBits(savedState);
|
||||||
|
|
||||||
|
|
|
@ -1346,18 +1346,17 @@ nsCSSRendering::PaintBoxShadowOuter(nsPresContext* aPresContext,
|
||||||
|
|
||||||
// Draw the widget shape
|
// Draw the widget shape
|
||||||
gfxContextMatrixAutoSaveRestore save(shadowContext);
|
gfxContextMatrixAutoSaveRestore save(shadowContext);
|
||||||
nsRefPtr<nsRenderingContext> wrapperCtx = new nsRenderingContext();
|
|
||||||
wrapperCtx->Init(shadowContext);
|
|
||||||
gfxPoint devPixelOffset =
|
gfxPoint devPixelOffset =
|
||||||
nsLayoutUtils::PointToGfxPoint(nsPoint(shadowItem->mXOffset,
|
nsLayoutUtils::PointToGfxPoint(nsPoint(shadowItem->mXOffset,
|
||||||
shadowItem->mYOffset),
|
shadowItem->mYOffset),
|
||||||
aPresContext->AppUnitsPerDevPixel());
|
aPresContext->AppUnitsPerDevPixel());
|
||||||
wrapperCtx->ThebesContext()->SetMatrix(
|
shadowContext->SetMatrix(
|
||||||
wrapperCtx->ThebesContext()->CurrentMatrix().Translate(devPixelOffset));
|
shadowContext->CurrentMatrix().Translate(devPixelOffset));
|
||||||
|
|
||||||
nsRect nativeRect;
|
nsRect nativeRect;
|
||||||
nativeRect.IntersectRect(frameRect, aDirtyRect);
|
nativeRect.IntersectRect(frameRect, aDirtyRect);
|
||||||
aPresContext->GetTheme()->DrawWidgetBackground(wrapperCtx, aForFrame,
|
nsRenderingContext wrapperCtx(shadowContext);
|
||||||
|
aPresContext->GetTheme()->DrawWidgetBackground(&wrapperCtx, aForFrame,
|
||||||
styleDisplay->mAppearance, aFrameArea, nativeRect);
|
styleDisplay->mAppearance, aFrameArea, nativeRect);
|
||||||
|
|
||||||
blurringArea.DoPaint();
|
blurringArea.DoPaint();
|
||||||
|
|
|
@ -3340,9 +3340,8 @@ nsDocumentViewer::GetContentSize(int32_t* aWidth, int32_t* aHeight)
|
||||||
|
|
||||||
nscoord prefWidth;
|
nscoord prefWidth;
|
||||||
{
|
{
|
||||||
nsRefPtr<nsRenderingContext> rcx =
|
nsRenderingContext rcx(presShell->CreateReferenceRenderingContext());
|
||||||
presShell->CreateReferenceRenderingContext();
|
prefWidth = root->GetPrefISize(&rcx);
|
||||||
prefWidth = root->GetPrefISize(rcx);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult rv = presShell->ResizeReflow(prefWidth, NS_UNCONSTRAINEDSIZE);
|
nsresult rv = presShell->ResizeReflow(prefWidth, NS_UNCONSTRAINEDSIZE);
|
||||||
|
|
|
@ -600,7 +600,7 @@ public:
|
||||||
* be rendered to, but is suitable for measuring text and performing
|
* be rendered to, but is suitable for measuring text and performing
|
||||||
* other non-rendering operations. Guaranteed to return non-null.
|
* other non-rendering operations. Guaranteed to return non-null.
|
||||||
*/
|
*/
|
||||||
virtual already_AddRefed<nsRenderingContext> CreateReferenceRenderingContext() = 0;
|
virtual already_AddRefed<gfxContext> CreateReferenceRenderingContext() = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Informs the pres shell that the document is now at the anchor with
|
* Informs the pres shell that the document is now at the anchor with
|
||||||
|
|
|
@ -4852,15 +4852,14 @@ nsLayoutUtils::PaintTextShadow(const nsIFrame* aFrame,
|
||||||
|
|
||||||
// Conjure an nsRenderingContext from a gfxContext for drawing the text
|
// Conjure an nsRenderingContext from a gfxContext for drawing the text
|
||||||
// to blur.
|
// to blur.
|
||||||
nsRefPtr<nsRenderingContext> renderingContext = new nsRenderingContext();
|
nsRenderingContext renderingContext(shadowContext);
|
||||||
renderingContext->Init(shadowContext);
|
|
||||||
|
|
||||||
aDestCtx->Save();
|
aDestCtx->Save();
|
||||||
aDestCtx->NewPath();
|
aDestCtx->NewPath();
|
||||||
aDestCtx->SetColor(gfxRGBA(shadowColor));
|
aDestCtx->SetColor(gfxRGBA(shadowColor));
|
||||||
|
|
||||||
// The callback will draw whatever we want to blur as a shadow.
|
// The callback will draw whatever we want to blur as a shadow.
|
||||||
aCallback(renderingContext, shadowOffset, shadowColor, aCallbackData);
|
aCallback(&renderingContext, shadowOffset, shadowColor, aCallbackData);
|
||||||
|
|
||||||
contextBoxBlur.DoPaint();
|
contextBoxBlur.DoPaint();
|
||||||
aDestCtx->Restore();
|
aDestCtx->Restore();
|
||||||
|
|
|
@ -3118,14 +3118,13 @@ PresShell::ClearFrameRefs(nsIFrame* aFrame)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
already_AddRefed<nsRenderingContext>
|
already_AddRefed<gfxContext>
|
||||||
PresShell::CreateReferenceRenderingContext()
|
PresShell::CreateReferenceRenderingContext()
|
||||||
{
|
{
|
||||||
nsDeviceContext* devCtx = mPresContext->DeviceContext();
|
nsDeviceContext* devCtx = mPresContext->DeviceContext();
|
||||||
nsRefPtr<nsRenderingContext> rc;
|
nsRefPtr<gfxContext> rc;
|
||||||
if (mPresContext->IsScreen()) {
|
if (mPresContext->IsScreen()) {
|
||||||
rc = new nsRenderingContext();
|
rc = new gfxContext(gfxPlatform::GetPlatform()->ScreenReferenceDrawTarget());
|
||||||
rc->Init(gfxPlatform::GetPlatform()->ScreenReferenceDrawTarget());
|
|
||||||
} else {
|
} else {
|
||||||
rc = devCtx->CreateRenderingContext();
|
rc = devCtx->CreateRenderingContext();
|
||||||
}
|
}
|
||||||
|
@ -4884,8 +4883,7 @@ PresShell::RenderDocument(const nsRect& aRect, uint32_t aFlags,
|
||||||
|
|
||||||
AutoSaveRestoreRenderingState _(this);
|
AutoSaveRestoreRenderingState _(this);
|
||||||
|
|
||||||
nsRefPtr<nsRenderingContext> rc = new nsRenderingContext();
|
nsRenderingContext rc(aThebesContext);
|
||||||
rc->Init(aThebesContext);
|
|
||||||
|
|
||||||
bool wouldFlushRetainedLayers = false;
|
bool wouldFlushRetainedLayers = false;
|
||||||
uint32_t flags = nsLayoutUtils::PAINT_IGNORE_SUPPRESSION;
|
uint32_t flags = nsLayoutUtils::PAINT_IGNORE_SUPPRESSION;
|
||||||
|
@ -4928,7 +4926,7 @@ PresShell::RenderDocument(const nsRect& aRect, uint32_t aFlags,
|
||||||
flags &= ~nsLayoutUtils::PAINT_WIDGET_LAYERS;
|
flags &= ~nsLayoutUtils::PAINT_WIDGET_LAYERS;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsLayoutUtils::PaintFrame(rc, rootFrame, nsRegion(aRect),
|
nsLayoutUtils::PaintFrame(&rc, rootFrame, nsRegion(aRect),
|
||||||
aBackgroundColor, flags);
|
aBackgroundColor, flags);
|
||||||
|
|
||||||
// if we had to use a group, paint it to the destination now
|
// if we had to use a group, paint it to the destination now
|
||||||
|
@ -5203,8 +5201,7 @@ PresShell::PaintRangePaintInfo(nsTArray<nsAutoPtr<RangePaintInfo> >* aItems,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
nsRefPtr<nsRenderingContext> rc = new nsRenderingContext();
|
nsRenderingContext rc(ctx);
|
||||||
rc->Init(ctx);
|
|
||||||
|
|
||||||
gfxMatrix initialTM = ctx->CurrentMatrix();
|
gfxMatrix initialTM = ctx->CurrentMatrix();
|
||||||
|
|
||||||
|
@ -5241,7 +5238,7 @@ PresShell::PaintRangePaintInfo(nsTArray<nsAutoPtr<RangePaintInfo> >* aItems,
|
||||||
ctx->SetMatrix(initialTM.Translate(rootOffset));
|
ctx->SetMatrix(initialTM.Translate(rootOffset));
|
||||||
aArea.MoveBy(-rangeInfo->mRootOffset.x, -rangeInfo->mRootOffset.y);
|
aArea.MoveBy(-rangeInfo->mRootOffset.x, -rangeInfo->mRootOffset.y);
|
||||||
nsRegion visible(aArea);
|
nsRegion visible(aArea);
|
||||||
rangeInfo->mList.PaintRoot(&rangeInfo->mBuilder, rc, nsDisplayList::PAINT_DEFAULT);
|
rangeInfo->mList.PaintRoot(&rangeInfo->mBuilder, &rc, nsDisplayList::PAINT_DEFAULT);
|
||||||
aArea.MoveBy(rangeInfo->mRootOffset.x, rangeInfo->mRootOffset.y);
|
aArea.MoveBy(rangeInfo->mRootOffset.x, rangeInfo->mRootOffset.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8930,7 +8927,7 @@ PresShell::DoReflow(nsIFrame* target, bool aInterruptible)
|
||||||
|
|
||||||
nsIFrame* rootFrame = mFrameConstructor->GetRootFrame();
|
nsIFrame* rootFrame = mFrameConstructor->GetRootFrame();
|
||||||
|
|
||||||
nsRefPtr<nsRenderingContext> rcx = CreateReferenceRenderingContext();
|
nsRenderingContext rcx(CreateReferenceRenderingContext());
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
mCurrentReflowRoot = target;
|
mCurrentReflowRoot = target;
|
||||||
|
@ -8955,7 +8952,7 @@ PresShell::DoReflow(nsIFrame* target, bool aInterruptible)
|
||||||
// Don't pass size directly to the reflow state, since a
|
// Don't pass size directly to the reflow state, since a
|
||||||
// constrained height implies page/column breaking.
|
// constrained height implies page/column breaking.
|
||||||
LogicalSize reflowSize(wm, size.ISize(wm), NS_UNCONSTRAINEDSIZE);
|
LogicalSize reflowSize(wm, size.ISize(wm), NS_UNCONSTRAINEDSIZE);
|
||||||
nsHTMLReflowState reflowState(mPresContext, target, rcx, reflowSize,
|
nsHTMLReflowState reflowState(mPresContext, target, &rcx, reflowSize,
|
||||||
nsHTMLReflowState::CALLER_WILL_INIT);
|
nsHTMLReflowState::CALLER_WILL_INIT);
|
||||||
reflowState.mOrthogonalLimit = size.BSize(wm);
|
reflowState.mOrthogonalLimit = size.BSize(wm);
|
||||||
|
|
||||||
|
@ -9036,7 +9033,7 @@ PresShell::DoReflow(nsIFrame* target, bool aInterruptible)
|
||||||
target->GetView(),
|
target->GetView(),
|
||||||
boundsRelativeToTarget);
|
boundsRelativeToTarget);
|
||||||
nsContainerFrame::SyncWindowProperties(mPresContext, target,
|
nsContainerFrame::SyncWindowProperties(mPresContext, target,
|
||||||
target->GetView(), rcx);
|
target->GetView(), &rcx);
|
||||||
|
|
||||||
target->DidReflow(mPresContext, nullptr, nsDidReflowStatus::FINISHED);
|
target->DidReflow(mPresContext, nullptr, nsDidReflowStatus::FINISHED);
|
||||||
if (target == rootFrame && size.BSize(wm) == NS_UNCONSTRAINEDSIZE) {
|
if (target == rootFrame && size.BSize(wm) == NS_UNCONSTRAINEDSIZE) {
|
||||||
|
|
|
@ -125,7 +125,7 @@ public:
|
||||||
virtual void CancelReflowCallback(nsIReflowCallback* aCallback) MOZ_OVERRIDE;
|
virtual void CancelReflowCallback(nsIReflowCallback* aCallback) MOZ_OVERRIDE;
|
||||||
|
|
||||||
virtual void ClearFrameRefs(nsIFrame* aFrame) MOZ_OVERRIDE;
|
virtual void ClearFrameRefs(nsIFrame* aFrame) MOZ_OVERRIDE;
|
||||||
virtual already_AddRefed<nsRenderingContext> CreateReferenceRenderingContext();
|
virtual already_AddRefed<gfxContext> CreateReferenceRenderingContext();
|
||||||
virtual nsresult GoToAnchor(const nsAString& aAnchorName, bool aScroll,
|
virtual nsresult GoToAnchor(const nsAString& aAnchorName, bool aScroll,
|
||||||
uint32_t aAdditionalScrollFlags = 0) MOZ_OVERRIDE;
|
uint32_t aAdditionalScrollFlags = 0) MOZ_OVERRIDE;
|
||||||
virtual nsresult ScrollToAnchor() MOZ_OVERRIDE;
|
virtual nsresult ScrollToAnchor() MOZ_OVERRIDE;
|
||||||
|
|
|
@ -35,10 +35,7 @@ public:
|
||||||
: mFrame(aFrame) {}
|
: mFrame(aFrame) {}
|
||||||
virtual already_AddRefed<gfxContext> GetRefContext() MOZ_OVERRIDE
|
virtual already_AddRefed<gfxContext> GetRefContext() MOZ_OVERRIDE
|
||||||
{
|
{
|
||||||
nsRefPtr<nsRenderingContext> rc =
|
return mFrame->PresContext()->PresShell()->CreateReferenceRenderingContext();
|
||||||
mFrame->PresContext()->PresShell()->CreateReferenceRenderingContext();
|
|
||||||
nsRefPtr<gfxContext> ctx = rc->ThebesContext();
|
|
||||||
return ctx.forget();
|
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
nsIFrame* mFrame;
|
nsIFrame* mFrame;
|
||||||
|
@ -758,13 +755,13 @@ TextOverflow::Marker::SetupString(nsIFrame* aFrame)
|
||||||
mWidth = 0;
|
mWidth = 0;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
nsRefPtr<nsRenderingContext> rc =
|
nsRenderingContext rc(
|
||||||
aFrame->PresContext()->PresShell()->CreateReferenceRenderingContext();
|
aFrame->PresContext()->PresShell()->CreateReferenceRenderingContext());
|
||||||
nsRefPtr<nsFontMetrics> fm;
|
nsRefPtr<nsFontMetrics> fm;
|
||||||
nsLayoutUtils::GetFontMetricsForFrame(aFrame, getter_AddRefs(fm),
|
nsLayoutUtils::GetFontMetricsForFrame(aFrame, getter_AddRefs(fm),
|
||||||
nsLayoutUtils::FontSizeInflationFor(aFrame));
|
nsLayoutUtils::FontSizeInflationFor(aFrame));
|
||||||
mWidth = nsLayoutUtils::AppUnitWidthOfStringBidi(mStyle->mString, aFrame,
|
mWidth = nsLayoutUtils::AppUnitWidthOfStringBidi(mStyle->mString, aFrame,
|
||||||
*fm, *rc);
|
*fm, rc);
|
||||||
}
|
}
|
||||||
mIntrinsicISize = mWidth;
|
mIntrinsicISize = mWidth;
|
||||||
mInitialized = true;
|
mInitialized = true;
|
||||||
|
|
|
@ -306,7 +306,7 @@ nsDisplayCanvasBackgroundImage::Paint(nsDisplayListBuilder* aBuilder,
|
||||||
nsPoint offset = ToReferenceFrame();
|
nsPoint offset = ToReferenceFrame();
|
||||||
nsRect bgClipRect = frame->CanvasArea() + offset;
|
nsRect bgClipRect = frame->CanvasArea() + offset;
|
||||||
|
|
||||||
nsRefPtr<nsRenderingContext> context;
|
nsRenderingContext context;
|
||||||
nsRefPtr<gfxContext> dest = aCtx->ThebesContext();
|
nsRefPtr<gfxContext> dest = aCtx->ThebesContext();
|
||||||
RefPtr<DrawTarget> dt;
|
RefPtr<DrawTarget> dt;
|
||||||
gfxRect destRect;
|
gfxRect destRect;
|
||||||
|
@ -328,14 +328,13 @@ nsDisplayCanvasBackgroundImage::Paint(nsDisplayListBuilder* aBuilder,
|
||||||
nsRefPtr<gfxContext> ctx = new gfxContext(dt);
|
nsRefPtr<gfxContext> ctx = new gfxContext(dt);
|
||||||
ctx->SetMatrix(
|
ctx->SetMatrix(
|
||||||
ctx->CurrentMatrix().Translate(-destRect.x, -destRect.y));
|
ctx->CurrentMatrix().Translate(-destRect.x, -destRect.y));
|
||||||
context = new nsRenderingContext();
|
context.Init(ctx);
|
||||||
context->Init(ctx);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
PaintInternal(aBuilder,
|
PaintInternal(aBuilder,
|
||||||
dt ? context.get() : aCtx,
|
dt ? &context : aCtx,
|
||||||
dt ? bgClipRect: mVisibleRect,
|
dt ? bgClipRect: mVisibleRect,
|
||||||
&bgClipRect);
|
&bgClipRect);
|
||||||
|
|
||||||
|
|
|
@ -1328,10 +1328,10 @@ nsFlexContainerFrame::
|
||||||
// Measure content, if needed (w/ intrinsic-width method or a reflow)
|
// Measure content, if needed (w/ intrinsic-width method or a reflow)
|
||||||
if (minSizeNeedsToMeasureContent || flexBasisNeedsToMeasureContent) {
|
if (minSizeNeedsToMeasureContent || flexBasisNeedsToMeasureContent) {
|
||||||
if (IsAxisHorizontal(aAxisTracker.GetMainAxis())) {
|
if (IsAxisHorizontal(aAxisTracker.GetMainAxis())) {
|
||||||
nsRefPtr<nsRenderingContext> rctx =
|
nsRenderingContext rctx(
|
||||||
aPresContext->PresShell()->CreateReferenceRenderingContext();
|
aPresContext->PresShell()->CreateReferenceRenderingContext());
|
||||||
if (minSizeNeedsToMeasureContent) {
|
if (minSizeNeedsToMeasureContent) {
|
||||||
resolvedMinSize = std::min(resolvedMinSize, aFlexItem.Frame()->GetMinISize(rctx));
|
resolvedMinSize = std::min(resolvedMinSize, aFlexItem.Frame()->GetMinISize(&rctx));
|
||||||
}
|
}
|
||||||
NS_ASSERTION(!flexBasisNeedsToMeasureContent,
|
NS_ASSERTION(!flexBasisNeedsToMeasureContent,
|
||||||
"flex-basis:auto should have been resolved in the "
|
"flex-basis:auto should have been resolved in the "
|
||||||
|
|
|
@ -647,11 +647,10 @@ nsSimplePageSequenceFrame::PrePrintNextPage(nsITimerCallback* aCallback, bool* a
|
||||||
|
|
||||||
mCalledBeginPage = true;
|
mCalledBeginPage = true;
|
||||||
|
|
||||||
nsRefPtr<nsRenderingContext> renderingContext =
|
nsRefPtr<gfxContext> renderingContext = dc->CreateRenderingContext();
|
||||||
dc->CreateRenderingContext();
|
|
||||||
|
|
||||||
nsRefPtr<gfxASurface> renderingSurface =
|
nsRefPtr<gfxASurface> renderingSurface =
|
||||||
renderingContext->ThebesContext()->CurrentSurface();
|
renderingContext->CurrentSurface();
|
||||||
NS_ENSURE_TRUE(renderingSurface, NS_ERROR_OUT_OF_MEMORY);
|
NS_ENSURE_TRUE(renderingSurface, NS_ERROR_OUT_OF_MEMORY);
|
||||||
|
|
||||||
for (int32_t i = mCurrentCanvasList.Length() - 1; i >= 0 ; i--) {
|
for (int32_t i = mCurrentCanvasList.Length() - 1; i >= 0 ; i--) {
|
||||||
|
@ -777,12 +776,11 @@ nsSimplePageSequenceFrame::PrintNextPage()
|
||||||
|
|
||||||
PR_PL(("SeqFr::PrintNextPage -> %p PageNo: %d", pf, mPageNum));
|
PR_PL(("SeqFr::PrintNextPage -> %p PageNo: %d", pf, mPageNum));
|
||||||
|
|
||||||
nsRefPtr<nsRenderingContext> renderingContext =
|
nsRenderingContext renderingContext(dc->CreateRenderingContext());
|
||||||
dc->CreateRenderingContext();
|
|
||||||
|
|
||||||
nsRect drawingRect(nsPoint(0, 0), currentPage->GetSize());
|
nsRect drawingRect(nsPoint(0, 0), currentPage->GetSize());
|
||||||
nsRegion drawingRegion(drawingRect);
|
nsRegion drawingRegion(drawingRect);
|
||||||
nsLayoutUtils::PaintFrame(renderingContext, currentPage,
|
nsLayoutUtils::PaintFrame(&renderingContext, currentPage,
|
||||||
drawingRegion, NS_RGBA(0,0,0,0),
|
drawingRegion, NS_RGBA(0,0,0,0),
|
||||||
nsLayoutUtils::PAINT_SYNC_DECODE_IMAGES);
|
nsLayoutUtils::PAINT_SYNC_DECODE_IMAGES);
|
||||||
|
|
||||||
|
|
|
@ -1769,11 +1769,7 @@ GetFontGroupForFrame(nsIFrame* aFrame, float aFontSizeInflation,
|
||||||
static already_AddRefed<gfxContext>
|
static already_AddRefed<gfxContext>
|
||||||
CreateReferenceThebesContext(nsTextFrame* aTextFrame)
|
CreateReferenceThebesContext(nsTextFrame* aTextFrame)
|
||||||
{
|
{
|
||||||
nsRefPtr<nsRenderingContext> tmp =
|
return aTextFrame->PresContext()->PresShell()->CreateReferenceRenderingContext();
|
||||||
aTextFrame->PresContext()->PresShell()->CreateReferenceRenderingContext();
|
|
||||||
|
|
||||||
nsRefPtr<gfxContext> ctx = tmp->ThebesContext();
|
|
||||||
return ctx.forget();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -2264,8 +2264,8 @@ nsPrintEngine::ReflowPrintObject(nsPrintObject * aPO)
|
||||||
fprintf(fd, "Title: %s\n", docStr.get());
|
fprintf(fd, "Title: %s\n", docStr.get());
|
||||||
fprintf(fd, "URL: %s\n", urlStr.get());
|
fprintf(fd, "URL: %s\n", urlStr.get());
|
||||||
fprintf(fd, "--------------- Frames ----------------\n");
|
fprintf(fd, "--------------- Frames ----------------\n");
|
||||||
nsRefPtr<nsRenderingContext> renderingContext =
|
//nsRefPtr<gfxContext> renderingContext =
|
||||||
mPrt->mPrintDocDC->CreateRenderingContext();
|
// mPrt->mPrintDocDC->CreateRenderingContext();
|
||||||
RootFrameList(aPO->mPresContext, fd, 0);
|
RootFrameList(aPO->mPresContext, fd, 0);
|
||||||
//DumpFrames(fd, aPO->mPresContext, renderingContext, theRootFrame, 0);
|
//DumpFrames(fd, aPO->mPresContext, renderingContext, theRootFrame, 0);
|
||||||
fprintf(fd, "---------------------------------------\n\n");
|
fprintf(fd, "---------------------------------------\n\n");
|
||||||
|
@ -2504,8 +2504,7 @@ nsPrintEngine::DoPrint(nsPrintObject * aPO)
|
||||||
poPresContext->SetIsRenderingOnlySelection(true);
|
poPresContext->SetIsRenderingOnlySelection(true);
|
||||||
// temporarily creating rendering context
|
// temporarily creating rendering context
|
||||||
// which is needed to find the selection frames
|
// which is needed to find the selection frames
|
||||||
nsRefPtr<nsRenderingContext> rc =
|
nsRenderingContext rc(mPrt->mPrintDC->CreateRenderingContext());
|
||||||
mPrt->mPrintDC->CreateRenderingContext();
|
|
||||||
|
|
||||||
// find the starting and ending page numbers
|
// find the starting and ending page numbers
|
||||||
// via the selection
|
// via the selection
|
||||||
|
@ -2519,7 +2518,7 @@ nsPrintEngine::DoPrint(nsPrintObject * aPO)
|
||||||
nsRefPtr<Selection> selectionPS =
|
nsRefPtr<Selection> selectionPS =
|
||||||
poPresShell->GetCurrentSelection(nsISelectionController::SELECTION_NORMAL);
|
poPresShell->GetCurrentSelection(nsISelectionController::SELECTION_NORMAL);
|
||||||
|
|
||||||
rv = GetPageRangeForSelection(poPresShell, poPresContext, *rc, selectionPS, pageSequence,
|
rv = GetPageRangeForSelection(poPresShell, poPresContext, rc, selectionPS, pageSequence,
|
||||||
&startFrame, startPageNum, startRect,
|
&startFrame, startPageNum, startRect,
|
||||||
&endFrame, endPageNum, endRect);
|
&endFrame, endPageNum, endRect);
|
||||||
if (NS_SUCCEEDED(rv)) {
|
if (NS_SUCCEEDED(rv)) {
|
||||||
|
@ -3810,8 +3809,8 @@ void DumpLayoutData(char* aTitleStr,
|
||||||
fprintf(fd, "URL: %s\n", aURLStr?aURLStr:"");
|
fprintf(fd, "URL: %s\n", aURLStr?aURLStr:"");
|
||||||
fprintf(fd, "--------------- Frames ----------------\n");
|
fprintf(fd, "--------------- Frames ----------------\n");
|
||||||
fprintf(fd, "--------------- Frames ----------------\n");
|
fprintf(fd, "--------------- Frames ----------------\n");
|
||||||
nsRefPtr<nsRenderingContext> renderingContext =
|
//nsRefPtr<gfxContext> renderingContext =
|
||||||
aDC->CreateRenderingContext();
|
// aDC->CreateRenderingContext();
|
||||||
RootFrameList(aPresContext, fd, 0);
|
RootFrameList(aPresContext, fd, 0);
|
||||||
//DumpFrames(fd, aPresContext, renderingContext, aRootFrame, 0);
|
//DumpFrames(fd, aPresContext, renderingContext, aRootFrame, 0);
|
||||||
fprintf(fd, "---------------------------------------\n\n");
|
fprintf(fd, "---------------------------------------\n\n");
|
||||||
|
|
|
@ -325,9 +325,9 @@ static nsSize CalcViewportUnitsScale(nsPresContext* aPresContext)
|
||||||
if (styles.mHorizontal == NS_STYLE_OVERFLOW_SCROLL ||
|
if (styles.mHorizontal == NS_STYLE_OVERFLOW_SCROLL ||
|
||||||
styles.mVertical == NS_STYLE_OVERFLOW_SCROLL) {
|
styles.mVertical == NS_STYLE_OVERFLOW_SCROLL) {
|
||||||
// Gather scrollbar size information.
|
// Gather scrollbar size information.
|
||||||
nsRefPtr<nsRenderingContext> context =
|
nsRenderingContext context(
|
||||||
aPresContext->PresShell()->CreateReferenceRenderingContext();
|
aPresContext->PresShell()->CreateReferenceRenderingContext());
|
||||||
nsMargin sizes(scrollFrame->GetDesiredScrollbarSizes(aPresContext, context));
|
nsMargin sizes(scrollFrame->GetDesiredScrollbarSizes(aPresContext, &context));
|
||||||
|
|
||||||
if (styles.mHorizontal == NS_STYLE_OVERFLOW_SCROLL) {
|
if (styles.mHorizontal == NS_STYLE_OVERFLOW_SCROLL) {
|
||||||
// 'overflow-x: scroll' means we must consider the horizontal scrollbar,
|
// 'overflow-x: scroll' means we must consider the horizontal scrollbar,
|
||||||
|
|
|
@ -5234,8 +5234,8 @@ SVGTextFrame::DoReflow()
|
||||||
if (!kid)
|
if (!kid)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
nsRefPtr<nsRenderingContext> renderingContext =
|
nsRenderingContext renderingContext(
|
||||||
presContext->PresShell()->CreateReferenceRenderingContext();
|
presContext->PresShell()->CreateReferenceRenderingContext());
|
||||||
|
|
||||||
if (UpdateFontSizeScaleFactor()) {
|
if (UpdateFontSizeScaleFactor()) {
|
||||||
// If the font size scale factor changed, we need the block to report
|
// If the font size scale factor changed, we need the block to report
|
||||||
|
@ -5245,10 +5245,10 @@ SVGTextFrame::DoReflow()
|
||||||
|
|
||||||
mState |= NS_STATE_SVG_TEXT_IN_REFLOW;
|
mState |= NS_STATE_SVG_TEXT_IN_REFLOW;
|
||||||
|
|
||||||
nscoord inlineSize = kid->GetPrefISize(renderingContext);
|
nscoord inlineSize = kid->GetPrefISize(&renderingContext);
|
||||||
WritingMode wm = kid->GetWritingMode();
|
WritingMode wm = kid->GetWritingMode();
|
||||||
nsHTMLReflowState reflowState(presContext, kid,
|
nsHTMLReflowState reflowState(presContext, kid,
|
||||||
renderingContext,
|
&renderingContext,
|
||||||
LogicalSize(wm, inlineSize,
|
LogicalSize(wm, inlineSize,
|
||||||
NS_UNCONSTRAINEDSIZE));
|
NS_UNCONSTRAINEDSIZE));
|
||||||
nsHTMLReflowMetrics desiredSize(reflowState);
|
nsHTMLReflowMetrics desiredSize(reflowState);
|
||||||
|
|
|
@ -448,9 +448,8 @@ nsFilterInstance::BuildSourceImage(DrawTarget* aTargetDT)
|
||||||
ctx->CurrentMatrix().Translate(-neededRect.TopLeft()).
|
ctx->CurrentMatrix().Translate(-neededRect.TopLeft()).
|
||||||
PreMultiply(deviceToFilterSpace));
|
PreMultiply(deviceToFilterSpace));
|
||||||
|
|
||||||
nsRefPtr<nsRenderingContext> tmpCtx(new nsRenderingContext());
|
nsRenderingContext tmpCtx(ctx);
|
||||||
tmpCtx->Init(ctx);
|
mPaintCallback->Paint(&tmpCtx, mTargetFrame, mPaintTransform, &dirty);
|
||||||
mPaintCallback->Paint(tmpCtx, mTargetFrame, mPaintTransform, &dirty);
|
|
||||||
|
|
||||||
mSourceGraphic.mSourceSurface = offscreenDT->Snapshot();
|
mSourceGraphic.mSourceSurface = offscreenDT->Snapshot();
|
||||||
mSourceGraphic.mSurfaceRect = ToIntRect(neededRect);
|
mSourceGraphic.mSurfaceRect = ToIntRect(neededRect);
|
||||||
|
|
|
@ -525,14 +525,14 @@ nsSVGForeignObjectFrame::DoReflow()
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// initiate a synchronous reflow here and now:
|
// initiate a synchronous reflow here and now:
|
||||||
nsRefPtr<nsRenderingContext> renderingContext =
|
nsRenderingContext renderingContext(
|
||||||
presContext->PresShell()->CreateReferenceRenderingContext();
|
presContext->PresShell()->CreateReferenceRenderingContext());
|
||||||
|
|
||||||
mInReflow = true;
|
mInReflow = true;
|
||||||
|
|
||||||
WritingMode wm = kid->GetWritingMode();
|
WritingMode wm = kid->GetWritingMode();
|
||||||
nsHTMLReflowState reflowState(presContext, kid,
|
nsHTMLReflowState reflowState(presContext, kid,
|
||||||
renderingContext,
|
&renderingContext,
|
||||||
LogicalSize(wm, GetLogicalSize(wm).ISize(wm),
|
LogicalSize(wm, GetLogicalSize(wm).ISize(wm),
|
||||||
NS_UNCONSTRAINEDSIZE));
|
NS_UNCONSTRAINEDSIZE));
|
||||||
nsHTMLReflowMetrics desiredSize(reflowState);
|
nsHTMLReflowMetrics desiredSize(reflowState);
|
||||||
|
|
|
@ -642,8 +642,6 @@ PaintFrameCallback::operator()(gfxContext* aContext,
|
||||||
|
|
||||||
mFrame->AddStateBits(NS_FRAME_DRAWING_AS_PAINTSERVER);
|
mFrame->AddStateBits(NS_FRAME_DRAWING_AS_PAINTSERVER);
|
||||||
|
|
||||||
nsRefPtr<nsRenderingContext> context(new nsRenderingContext());
|
|
||||||
context->Init(aContext);
|
|
||||||
aContext->Save();
|
aContext->Save();
|
||||||
|
|
||||||
// Clip to aFillRect so that we don't paint outside.
|
// Clip to aFillRect so that we don't paint outside.
|
||||||
|
@ -684,7 +682,8 @@ PaintFrameCallback::operator()(gfxContext* aContext,
|
||||||
if (mFlags & nsSVGIntegrationUtils::FLAG_SYNC_DECODE_IMAGES) {
|
if (mFlags & nsSVGIntegrationUtils::FLAG_SYNC_DECODE_IMAGES) {
|
||||||
flags |= nsLayoutUtils::PAINT_SYNC_DECODE_IMAGES;
|
flags |= nsLayoutUtils::PAINT_SYNC_DECODE_IMAGES;
|
||||||
}
|
}
|
||||||
nsLayoutUtils::PaintFrame(context, mFrame,
|
nsRenderingContext context(aContext);
|
||||||
|
nsLayoutUtils::PaintFrame(&context, mFrame,
|
||||||
dirty, NS_RGBA(0, 0, 0, 0),
|
dirty, NS_RGBA(0, 0, 0, 0),
|
||||||
flags);
|
flags);
|
||||||
|
|
||||||
|
|
|
@ -226,9 +226,8 @@ nsSVGMaskFrame::GetMaskForMaskedFrame(gfxContext* aContext,
|
||||||
gfxMatrix maskSurfaceMatrix =
|
gfxMatrix maskSurfaceMatrix =
|
||||||
aContext->CurrentMatrix() * gfxMatrix::Translation(-maskSurfaceRect.TopLeft());
|
aContext->CurrentMatrix() * gfxMatrix::Translation(-maskSurfaceRect.TopLeft());
|
||||||
|
|
||||||
nsRefPtr<nsRenderingContext> tmpCtx = new nsRenderingContext();
|
nsRenderingContext tmpCtx(maskDT);
|
||||||
tmpCtx->Init(maskDT);
|
tmpCtx.ThebesContext()->SetMatrix(maskSurfaceMatrix);
|
||||||
tmpCtx->ThebesContext()->SetMatrix(maskSurfaceMatrix);
|
|
||||||
|
|
||||||
mMatrixForChildren = GetMaskTransform(aMaskedFrame) * aMatrix;
|
mMatrixForChildren = GetMaskTransform(aMaskedFrame) * aMatrix;
|
||||||
|
|
||||||
|
@ -244,7 +243,7 @@ nsSVGMaskFrame::GetMaskForMaskedFrame(gfxContext* aContext,
|
||||||
m = static_cast<nsSVGElement*>(kid->GetContent())->
|
m = static_cast<nsSVGElement*>(kid->GetContent())->
|
||||||
PrependLocalTransformsTo(m);
|
PrependLocalTransformsTo(m);
|
||||||
}
|
}
|
||||||
nsSVGUtils::PaintFrameWithEffects(kid, tmpCtx, mMatrixForChildren);
|
nsSVGUtils::PaintFrameWithEffects(kid, &tmpCtx, mMatrixForChildren);
|
||||||
}
|
}
|
||||||
|
|
||||||
RefPtr<SourceSurface> maskSnapshot = maskDT->Snapshot();
|
RefPtr<SourceSurface> maskSnapshot = maskDT->Snapshot();
|
||||||
|
|
|
@ -378,9 +378,8 @@ nsSVGPatternFrame::PaintPattern(const DrawTarget* aDrawTarget,
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsRefPtr<nsRenderingContext> context(new nsRenderingContext());
|
nsRenderingContext context(dt);
|
||||||
context->Init(dt);
|
gfxContext* gfx = context.ThebesContext();
|
||||||
gfxContext* gfx = context->ThebesContext();
|
|
||||||
|
|
||||||
// Fill with transparent black
|
// Fill with transparent black
|
||||||
gfx->SetOperator(gfxContext::OPERATOR_CLEAR);
|
gfx->SetOperator(gfxContext::OPERATOR_CLEAR);
|
||||||
|
@ -417,7 +416,7 @@ nsSVGPatternFrame::PaintPattern(const DrawTarget* aDrawTarget,
|
||||||
tm = static_cast<nsSVGElement*>(kid->GetContent())->
|
tm = static_cast<nsSVGElement*>(kid->GetContent())->
|
||||||
PrependLocalTransformsTo(tm, nsSVGElement::eUserSpaceToParent);
|
PrependLocalTransformsTo(tm, nsSVGElement::eUserSpaceToParent);
|
||||||
}
|
}
|
||||||
nsSVGUtils::PaintFrameWithEffects(kid, context, tm);
|
nsSVGUtils::PaintFrameWithEffects(kid, &context, tm);
|
||||||
}
|
}
|
||||||
patternWithChildren->RemoveStateBits(NS_FRAME_DRAWING_AS_PAINTSERVER);
|
patternWithChildren->RemoveStateBits(NS_FRAME_DRAWING_AS_PAINTSERVER);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1589,8 +1589,7 @@ nsSVGUtils::PaintSVGGlyph(Element* aElement, gfxContext* aContext,
|
||||||
}
|
}
|
||||||
aContext->GetDrawTarget()->AddUserData(&gfxTextContextPaint::sUserDataKey,
|
aContext->GetDrawTarget()->AddUserData(&gfxTextContextPaint::sUserDataKey,
|
||||||
aContextPaint, nullptr);
|
aContextPaint, nullptr);
|
||||||
nsRefPtr<nsRenderingContext> context(new nsRenderingContext());
|
nsRenderingContext context(aContext);
|
||||||
context->Init(aContext);
|
|
||||||
svgFrame->NotifySVGChanged(nsISVGChildFrame::TRANSFORM_CHANGED);
|
svgFrame->NotifySVGChanged(nsISVGChildFrame::TRANSFORM_CHANGED);
|
||||||
gfxMatrix m;
|
gfxMatrix m;
|
||||||
if (frame->GetContent()->IsSVG()) {
|
if (frame->GetContent()->IsSVG()) {
|
||||||
|
@ -1599,7 +1598,7 @@ nsSVGUtils::PaintSVGGlyph(Element* aElement, gfxContext* aContext,
|
||||||
m = static_cast<nsSVGElement*>(frame->GetContent())->
|
m = static_cast<nsSVGElement*>(frame->GetContent())->
|
||||||
PrependLocalTransformsTo(gfxMatrix(), nsSVGElement::eUserSpaceToParent);
|
PrependLocalTransformsTo(gfxMatrix(), nsSVGElement::eUserSpaceToParent);
|
||||||
}
|
}
|
||||||
nsresult rv = svgFrame->PaintSVG(context, m);
|
nsresult rv = svgFrame->PaintSVG(&context, m);
|
||||||
return NS_SUCCEEDED(rv);
|
return NS_SUCCEEDED(rv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
|
|
||||||
#include "nsImageBoxFrame.h"
|
#include "nsImageBoxFrame.h"
|
||||||
#include "nsGkAtoms.h"
|
#include "nsGkAtoms.h"
|
||||||
|
#include "nsRenderingContext.h"
|
||||||
#include "nsStyleContext.h"
|
#include "nsStyleContext.h"
|
||||||
#include "nsStyleConsts.h"
|
#include "nsStyleConsts.h"
|
||||||
#include "nsCOMPtr.h"
|
#include "nsCOMPtr.h"
|
||||||
|
|
|
@ -634,9 +634,9 @@ nsSplitterFrameInner::MouseDown(nsIDOMEvent* aMouseEvent)
|
||||||
if (childIndex == childCount - 1 && GetResizeAfter() != Grow)
|
if (childIndex == childCount - 1 && GetResizeAfter() != Grow)
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
|
||||||
nsRefPtr<nsRenderingContext> rc =
|
nsRenderingContext rc(
|
||||||
outerPresContext->PresShell()->CreateReferenceRenderingContext();
|
outerPresContext->PresShell()->CreateReferenceRenderingContext());
|
||||||
nsBoxLayoutState state(outerPresContext, rc);
|
nsBoxLayoutState state(outerPresContext, &rc);
|
||||||
mCurrentPos = 0;
|
mCurrentPos = 0;
|
||||||
mPressed = true;
|
mPressed = true;
|
||||||
|
|
||||||
|
|
|
@ -501,10 +501,10 @@ nsTextBoxFrame::DrawText(nsRenderingContext& aRenderingContext,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
nsRefPtr<nsRenderingContext> refContext =
|
nsRenderingContext refContext(
|
||||||
PresContext()->PresShell()->CreateReferenceRenderingContext();
|
PresContext()->PresShell()->CreateReferenceRenderingContext());
|
||||||
|
|
||||||
CalculateUnderline(*refContext, *fontMet);
|
CalculateUnderline(refContext, *fontMet);
|
||||||
|
|
||||||
nscolor c = aOverrideColor ? *aOverrideColor : StyleColor()->mColor;
|
nscolor c = aOverrideColor ? *aOverrideColor : StyleColor()->mColor;
|
||||||
ColorPattern color(ToDeviceColor(c));
|
ColorPattern color(ToDeviceColor(c));
|
||||||
|
@ -522,7 +522,7 @@ nsTextBoxFrame::DrawText(nsRenderingContext& aRenderingContext,
|
||||||
posResolve.logicalIndex = mAccessKeyInfo->mAccesskeyIndex;
|
posResolve.logicalIndex = mAccessKeyInfo->mAccesskeyIndex;
|
||||||
rv = nsBidiPresUtils::RenderText(mCroppedTitle.get(), mCroppedTitle.Length(), level,
|
rv = nsBidiPresUtils::RenderText(mCroppedTitle.get(), mCroppedTitle.Length(), level,
|
||||||
presContext, aRenderingContext,
|
presContext, aRenderingContext,
|
||||||
*refContext, *fontMet,
|
refContext, *fontMet,
|
||||||
aTextRect.x, baseline,
|
aTextRect.x, baseline,
|
||||||
&posResolve,
|
&posResolve,
|
||||||
1);
|
1);
|
||||||
|
@ -533,7 +533,7 @@ nsTextBoxFrame::DrawText(nsRenderingContext& aRenderingContext,
|
||||||
{
|
{
|
||||||
rv = nsBidiPresUtils::RenderText(mCroppedTitle.get(), mCroppedTitle.Length(), level,
|
rv = nsBidiPresUtils::RenderText(mCroppedTitle.get(), mCroppedTitle.Length(), level,
|
||||||
presContext, aRenderingContext,
|
presContext, aRenderingContext,
|
||||||
*refContext, *fontMet,
|
refContext, *fontMet,
|
||||||
aTextRect.x, baseline);
|
aTextRect.x, baseline);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -548,14 +548,14 @@ nsTextBoxFrame::DrawText(nsRenderingContext& aRenderingContext,
|
||||||
mAccessKeyInfo->mBeforeWidth = nsLayoutUtils::
|
mAccessKeyInfo->mBeforeWidth = nsLayoutUtils::
|
||||||
AppUnitWidthOfString(mCroppedTitle.get(),
|
AppUnitWidthOfString(mCroppedTitle.get(),
|
||||||
mAccessKeyInfo->mAccesskeyIndex,
|
mAccessKeyInfo->mAccesskeyIndex,
|
||||||
*fontMet, *refContext);
|
*fontMet, refContext);
|
||||||
else
|
else
|
||||||
mAccessKeyInfo->mBeforeWidth = 0;
|
mAccessKeyInfo->mBeforeWidth = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
fontMet->DrawString(mCroppedTitle.get(), mCroppedTitle.Length(),
|
fontMet->DrawString(mCroppedTitle.get(), mCroppedTitle.Length(),
|
||||||
aTextRect.x, baseline, &aRenderingContext,
|
aTextRect.x, baseline, &aRenderingContext,
|
||||||
refContext.get());
|
&refContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mAccessKeyInfo && mAccessKeyInfo->mAccesskeyIndex != kNotFound) {
|
if (mAccessKeyInfo && mAccessKeyInfo->mAccesskeyIndex != kNotFound) {
|
||||||
|
|
|
@ -248,15 +248,15 @@ nsTreeBodyFrame::CalcMaxRowWidth()
|
||||||
nscoord rowWidth;
|
nscoord rowWidth;
|
||||||
nsTreeColumn* col;
|
nsTreeColumn* col;
|
||||||
|
|
||||||
nsRefPtr<nsRenderingContext> rc =
|
nsRenderingContext rc(
|
||||||
PresContext()->PresShell()->CreateReferenceRenderingContext();
|
PresContext()->PresShell()->CreateReferenceRenderingContext());
|
||||||
|
|
||||||
for (int32_t row = 0; row < mRowCount; ++row) {
|
for (int32_t row = 0; row < mRowCount; ++row) {
|
||||||
rowWidth = 0;
|
rowWidth = 0;
|
||||||
|
|
||||||
for (col = mColumns->GetFirstColumn(); col; col = col->GetNext()) {
|
for (col = mColumns->GetFirstColumn(); col; col = col->GetNext()) {
|
||||||
nscoord desiredWidth, currentWidth;
|
nscoord desiredWidth, currentWidth;
|
||||||
nsresult rv = GetCellWidth(row, col, rc, desiredWidth, currentWidth);
|
nsresult rv = GetCellWidth(row, col, &rc, desiredWidth, currentWidth);
|
||||||
if (NS_FAILED(rv)) {
|
if (NS_FAILED(rv)) {
|
||||||
NS_NOTREACHED("invalid column");
|
NS_NOTREACHED("invalid column");
|
||||||
continue;
|
continue;
|
||||||
|
@ -1166,8 +1166,8 @@ nsTreeBodyFrame::GetCoordsForCellItem(int32_t aRow, nsITreeColumn* aCol, const n
|
||||||
// interfere with our computations.
|
// interfere with our computations.
|
||||||
AdjustForBorderPadding(cellContext, cellRect);
|
AdjustForBorderPadding(cellContext, cellRect);
|
||||||
|
|
||||||
nsRefPtr<nsRenderingContext> rc =
|
nsRenderingContext rc(
|
||||||
presContext->PresShell()->CreateReferenceRenderingContext();
|
presContext->PresShell()->CreateReferenceRenderingContext());
|
||||||
|
|
||||||
// Now we'll start making our way across the cell, starting at the edge of
|
// Now we'll start making our way across the cell, starting at the edge of
|
||||||
// the cell and proceeding until we hit the right edge. |cellX| is the
|
// the cell and proceeding until we hit the right edge. |cellX| is the
|
||||||
|
@ -1191,7 +1191,7 @@ nsTreeBodyFrame::GetCoordsForCellItem(int32_t aRow, nsITreeColumn* aCol, const n
|
||||||
nsRect twistyRect(cellRect);
|
nsRect twistyRect(cellRect);
|
||||||
nsStyleContext* twistyContext = GetPseudoStyleContext(nsCSSAnonBoxes::moztreetwisty);
|
nsStyleContext* twistyContext = GetPseudoStyleContext(nsCSSAnonBoxes::moztreetwisty);
|
||||||
GetTwistyRect(aRow, currCol, imageRect, twistyRect, presContext,
|
GetTwistyRect(aRow, currCol, imageRect, twistyRect, presContext,
|
||||||
*rc, twistyContext);
|
rc, twistyContext);
|
||||||
|
|
||||||
if (NS_LITERAL_CSTRING("twisty").Equals(aElement)) {
|
if (NS_LITERAL_CSTRING("twisty").Equals(aElement)) {
|
||||||
// If we're looking for the twisty Rect, just return the size
|
// If we're looking for the twisty Rect, just return the size
|
||||||
|
@ -1269,7 +1269,7 @@ nsTreeBodyFrame::GetCoordsForCellItem(int32_t aRow, nsITreeColumn* aCol, const n
|
||||||
GetBorderPadding(textContext, bp);
|
GetBorderPadding(textContext, bp);
|
||||||
textRect.height += bp.top + bp.bottom;
|
textRect.height += bp.top + bp.bottom;
|
||||||
|
|
||||||
AdjustForCellText(cellText, aRow, currCol, *rc, *fm, textRect);
|
AdjustForCellText(cellText, aRow, currCol, rc, *fm, textRect);
|
||||||
|
|
||||||
theRect = textRect;
|
theRect = textRect;
|
||||||
}
|
}
|
||||||
|
@ -1515,8 +1515,8 @@ nsTreeBodyFrame::GetItemWithinCellAt(nscoord aX, const nsRect& aCellRect,
|
||||||
bool isRTL = StyleVisibility()->mDirection == NS_STYLE_DIRECTION_RTL;
|
bool isRTL = StyleVisibility()->mDirection == NS_STYLE_DIRECTION_RTL;
|
||||||
|
|
||||||
nsPresContext* presContext = PresContext();
|
nsPresContext* presContext = PresContext();
|
||||||
nsRefPtr<nsRenderingContext> rc =
|
nsRenderingContext rc(
|
||||||
presContext->PresShell()->CreateReferenceRenderingContext();
|
presContext->PresShell()->CreateReferenceRenderingContext());
|
||||||
|
|
||||||
if (aColumn->IsPrimary()) {
|
if (aColumn->IsPrimary()) {
|
||||||
// If we're the primary column, we have indentation and a twisty.
|
// If we're the primary column, we have indentation and a twisty.
|
||||||
|
@ -1550,7 +1550,7 @@ nsTreeBodyFrame::GetItemWithinCellAt(nscoord aX, const nsRect& aCellRect,
|
||||||
|
|
||||||
nsRect imageSize;
|
nsRect imageSize;
|
||||||
GetTwistyRect(aRowIndex, aColumn, imageSize, twistyRect, presContext,
|
GetTwistyRect(aRowIndex, aColumn, imageSize, twistyRect, presContext,
|
||||||
*rc, twistyContext);
|
rc, twistyContext);
|
||||||
|
|
||||||
// We will treat a click as hitting the twisty if it happens on the margins, borders, padding,
|
// We will treat a click as hitting the twisty if it happens on the margins, borders, padding,
|
||||||
// or content of the twisty object. By allowing a "slop" into the margin, we make it a little
|
// or content of the twisty object. By allowing a "slop" into the margin, we make it a little
|
||||||
|
@ -1618,7 +1618,7 @@ nsTreeBodyFrame::GetItemWithinCellAt(nscoord aX, const nsRect& aCellRect,
|
||||||
nsRefPtr<nsFontMetrics> fm;
|
nsRefPtr<nsFontMetrics> fm;
|
||||||
nsLayoutUtils::GetFontMetricsForStyleContext(textContext,
|
nsLayoutUtils::GetFontMetricsForStyleContext(textContext,
|
||||||
getter_AddRefs(fm));
|
getter_AddRefs(fm));
|
||||||
AdjustForCellText(cellText, aRowIndex, aColumn, *rc, *fm, textRect);
|
AdjustForCellText(cellText, aRowIndex, aColumn, rc, *fm, textRect);
|
||||||
|
|
||||||
if (aX >= textRect.x && aX < textRect.x + textRect.width)
|
if (aX >= textRect.x && aX < textRect.x + textRect.width)
|
||||||
return nsCSSAnonBoxes::moztreecelltext;
|
return nsCSSAnonBoxes::moztreecelltext;
|
||||||
|
@ -1764,10 +1764,10 @@ nsTreeBodyFrame::IsCellCropped(int32_t aRow, nsITreeColumn* aCol, bool *_retval)
|
||||||
if (!col)
|
if (!col)
|
||||||
return NS_ERROR_INVALID_ARG;
|
return NS_ERROR_INVALID_ARG;
|
||||||
|
|
||||||
nsRefPtr<nsRenderingContext> rc =
|
nsRenderingContext rc(
|
||||||
PresContext()->PresShell()->CreateReferenceRenderingContext();
|
PresContext()->PresShell()->CreateReferenceRenderingContext());
|
||||||
|
|
||||||
rv = GetCellWidth(aRow, col, rc, desiredSize, currentSize);
|
rv = GetCellWidth(aRow, col, &rc, desiredSize, currentSize);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
*_retval = desiredSize > currentSize;
|
*_retval = desiredSize > currentSize;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче