This commit is contained in:
Ted Mielczarek 2008-12-19 14:20:24 -05:00
Родитель 6e2aad61e3 6c8601ac15
Коммит b0728526c3
3 изменённых файлов: 27 добавлений и 19 удалений

Просмотреть файл

@ -3400,8 +3400,11 @@ nsCanvasRenderingContext2D::DrawWindow(nsIDOMWindow* aWindow, PRInt32 aX, PRInt3
nsPresContext::CSSPixelsToAppUnits(aY),
nsPresContext::CSSPixelsToAppUnits(aW),
nsPresContext::CSSPixelsToAppUnits(aH));
presShell->RenderDocument(r, PR_FALSE, PR_TRUE, bgColor,
mThebes);
PRUint32 renderDocFlags = nsIPresShell::RENDER_IGNORE_VIEWPORT_SCROLLING;
if (flags & nsIDOMCanvasRenderingContext2D::DRAWWINDOW_DRAW_CARET) {
renderDocFlags |= nsIPresShell::RENDER_CARET;
}
presShell->RenderDocument(r, renderDocFlags, bgColor, mThebes);
// get rid of the pattern surface ref, just in case
mThebes->SetColor(gfxRGBA(1,1,1,1));

Просмотреть файл

@ -102,10 +102,10 @@ class gfxContext;
typedef short SelectionType;
typedef PRUint32 nsFrameState;
// 5c103bc2-788e-4bbe-b82e-635bea34e78f
// 23439d06-4642-4c4e-b60b-d84ad9bd8897
#define NS_IPRESSHELL_IID \
{ 0x5c103bc2, 0x788e, 0x4bbe, \
{ 0xb8, 0x2e, 0x63, 0x5b, 0xea, 0x34, 0xe7, 0x8f } }
{ 0x23439d06, 0x4642, 0x4c4e, \
{ 0xb6, 0x0b, 0xd8, 0x4a, 0xd9, 0xbd, 0x88, 0x97 } }
// Constants for ScrollContentIntoView() function
#define NS_PRESSHELL_SCROLL_TOP 0
@ -716,19 +716,26 @@ public:
* root frame's coordinate system (if aIgnoreViewportScrolling is false)
* or in the root scrolled frame's coordinate system
* (if aIgnoreViewportScrolling is true). The coordinates are in appunits.
* @param aUntrusted set to PR_TRUE if the contents may be passed to malicious
* @param aFlags see below;
* set RENDER_IS_UNTRUSTED if the contents may be passed to malicious
* agents. E.g. we might choose not to paint the contents of sensitive widgets
* such as the file name in a file upload widget, and we might choose not
* to paint themes.
* @param aIgnoreViewportScrolling ignore clipping/scrolling/scrollbar painting
* due to scrolling in the viewport
* set RENDER_IGNORE_VIEWPORT_SCROLLING to ignore
* clipping/scrolling/scrollbar painting due to scrolling in the viewport
* set RENDER_CARET to draw the caret if one would be visible
* (by default the caret is never drawn)
* @param aBackgroundColor a background color to render onto
* @param aRenderedContext the gfxContext to render to. We render so that
* one CSS pixel in the source document is rendered to one unit in the current
* transform.
*/
NS_IMETHOD RenderDocument(const nsRect& aRect, PRBool aUntrusted,
PRBool aIgnoreViewportScrolling,
enum {
RENDER_IS_UNTRUSTED = 0x01,
RENDER_IGNORE_VIEWPORT_SCROLLING = 0x02,
RENDER_CARET = 0x04
};
NS_IMETHOD RenderDocument(const nsRect& aRect, PRUint32 aFlags,
nscolor aBackgroundColor,
gfxContext* aRenderedContext) = 0;

Просмотреть файл

@ -879,8 +879,7 @@ public:
virtual nsIFrame* GetFrameForPoint(nsIFrame* aFrame, nsPoint aPt);
NS_IMETHOD RenderDocument(const nsRect& aRect, PRBool aUntrusted,
PRBool aIgnoreViewportScrolling,
NS_IMETHOD RenderDocument(const nsRect& aRect, PRUint32 aFlags,
nscolor aBackgroundColor,
gfxContext* aThebesContext);
@ -4935,12 +4934,11 @@ PresShell::ComputeRepaintRegionForCopy(nsIView* aRootView,
}
NS_IMETHODIMP
PresShell::RenderDocument(const nsRect& aRect, PRBool aUntrusted,
PRBool aIgnoreViewportScrolling,
PresShell::RenderDocument(const nsRect& aRect, PRUint32 aFlags,
nscolor aBackgroundColor,
gfxContext* aThebesContext)
{
NS_ENSURE_TRUE(!aUntrusted, NS_ERROR_NOT_IMPLEMENTED);
NS_ENSURE_TRUE(!(aFlags & RENDER_IS_UNTRUSTED), NS_ERROR_NOT_IMPLEMENTED);
gfxRect r(0, 0,
nsPresContext::AppUnitsToFloatCSSPixels(aRect.width),
@ -4986,12 +4984,13 @@ PresShell::RenderDocument(const nsRect& aRect, PRBool aUntrusted,
nsIFrame* rootFrame = FrameManager()->GetRootFrame();
if (rootFrame) {
nsDisplayListBuilder builder(rootFrame, PR_FALSE, PR_FALSE);
nsDisplayListBuilder builder(rootFrame, PR_FALSE,
(aFlags & RENDER_CARET) != 0);
nsDisplayList list;
nsRect rect(aRect);
nsIFrame* rootScrollFrame = GetRootScrollFrame();
if (aIgnoreViewportScrolling && rootScrollFrame) {
if ((aFlags & RENDER_IGNORE_VIEWPORT_SCROLLING) && rootScrollFrame) {
nsPoint pos = GetRootScrollFrameAsScrollable()->GetScrollPosition();
rect.MoveBy(-pos);
builder.SetIgnoreScrollFrame(rootScrollFrame);
@ -7118,8 +7117,7 @@ DumpToPNG(nsIPresShell* shell, nsAString& name) {
nsRefPtr<gfxContext> context = new gfxContext(surface);
NS_ENSURE_TRUE(context, NS_ERROR_OUT_OF_MEMORY);
nsresult rv = shell->RenderDocument(r, PR_FALSE, PR_FALSE,
NS_RGB(255, 255, 0), context);
nsresult rv = shell->RenderDocument(r, 0, NS_RGB(255, 255, 0), context);
NS_ENSURE_SUCCESS(rv, rv);
imgContext->DrawSurface(surface, gfxSize(width, height));