зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1090611 - Make nsCaret::PaintCaret take a Moz2D DrawTarget instead of nsRenderingContext. r=Bas
This commit is contained in:
Родитель
8603fdbcd4
Коммит
bfe784d925
|
@ -18,7 +18,6 @@
|
|||
#include "nsIContent.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsCanvasFrame.h"
|
||||
#include "nsRenderingContext.h"
|
||||
#include "nsPresContext.h"
|
||||
#include "nsBlockFrame.h"
|
||||
#include "nsISelectionController.h"
|
||||
|
|
|
@ -24,7 +24,6 @@
|
|||
#include "nsIContent.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsLayoutUtils.h"
|
||||
#include "nsRenderingContext.h"
|
||||
#include "nsPresContext.h"
|
||||
#include "nsBlockFrame.h"
|
||||
#include "nsISelectionController.h"
|
||||
|
@ -513,7 +512,7 @@ nsCaret::GetPaintGeometry(nsRect* aRect)
|
|||
}
|
||||
|
||||
void nsCaret::PaintCaret(nsDisplayListBuilder *aBuilder,
|
||||
nsRenderingContext *aCtx,
|
||||
DrawTarget& aDrawTarget,
|
||||
nsIFrame* aForFrame,
|
||||
const nsPoint &aOffset)
|
||||
{
|
||||
|
@ -525,7 +524,6 @@ void nsCaret::PaintCaret(nsDisplayListBuilder *aBuilder,
|
|||
}
|
||||
NS_ASSERTION(frame == aForFrame, "We're referring different frame");
|
||||
|
||||
DrawTarget* drawTarget = aCtx->GetDrawTarget();
|
||||
int32_t appUnitsPerDevPixel = frame->PresContext()->AppUnitsPerDevPixel();
|
||||
|
||||
nsRect caretRect;
|
||||
|
@ -533,14 +531,14 @@ void nsCaret::PaintCaret(nsDisplayListBuilder *aBuilder,
|
|||
ComputeCaretRects(frame, contentOffset, &caretRect, &hookRect);
|
||||
|
||||
Rect devPxCaretRect =
|
||||
NSRectToSnappedRect(caretRect + aOffset, appUnitsPerDevPixel, *drawTarget);
|
||||
NSRectToSnappedRect(caretRect + aOffset, appUnitsPerDevPixel, aDrawTarget);
|
||||
Rect devPxHookRect =
|
||||
NSRectToSnappedRect(hookRect + aOffset, appUnitsPerDevPixel, *drawTarget);
|
||||
NSRectToSnappedRect(hookRect + aOffset, appUnitsPerDevPixel, aDrawTarget);
|
||||
ColorPattern color(ToDeviceColor(frame->GetCaretColorAt(contentOffset)));
|
||||
|
||||
drawTarget->FillRect(devPxCaretRect, color);
|
||||
aDrawTarget.FillRect(devPxCaretRect, color);
|
||||
if (!hookRect.IsEmpty()) {
|
||||
drawTarget->FillRect(devPxHookRect, color);
|
||||
aDrawTarget.FillRect(devPxHookRect, color);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -25,17 +25,21 @@ class nsIFrame;
|
|||
class nsINode;
|
||||
class nsIPresShell;
|
||||
class nsITimer;
|
||||
class nsRenderingContext;
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
class Selection;
|
||||
}
|
||||
namespace gfx {
|
||||
class DrawTarget;
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
class nsCaret MOZ_FINAL : public nsISelectionListener
|
||||
{
|
||||
typedef mozilla::gfx::DrawTarget DrawTarget;
|
||||
|
||||
public:
|
||||
nsCaret();
|
||||
|
||||
|
@ -119,7 +123,7 @@ class nsCaret MOZ_FINAL : public nsISelectionListener
|
|||
* Actually paint the caret onto the given rendering context.
|
||||
*/
|
||||
void PaintCaret(nsDisplayListBuilder *aBuilder,
|
||||
nsRenderingContext *aCtx,
|
||||
DrawTarget& aDrawTarget,
|
||||
nsIFrame *aForFrame,
|
||||
const nsPoint &aOffset);
|
||||
|
||||
|
|
|
@ -2900,7 +2900,7 @@ nsDisplayCaret::Paint(nsDisplayListBuilder* aBuilder,
|
|||
nsRenderingContext* aCtx) {
|
||||
// Note: Because we exist, we know that the caret is visible, so we don't
|
||||
// need to check for the caret's visibility.
|
||||
mCaret->PaintCaret(aBuilder, aCtx, mFrame, ToReferenceFrame());
|
||||
mCaret->PaintCaret(aBuilder, *aCtx->GetDrawTarget(), mFrame, ToReferenceFrame());
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
|
@ -3724,7 +3724,7 @@ SVGTextFrame::PaintSVG(nsRenderingContext* aContext,
|
|||
if (frame == caretFrame && ShouldPaintCaret(run, caret)) {
|
||||
// XXX Should we be looking at the fill/stroke colours to paint the
|
||||
// caret with, rather than using the color property?
|
||||
caret->PaintCaret(nullptr, aContext, frame, nsPoint());
|
||||
caret->PaintCaret(nullptr, *aContext->GetDrawTarget(), frame, nsPoint());
|
||||
gfx->NewPath();
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче