Bug 590294, part 4: IGNORE_VIEWPORT_SCROLLING currently implies interpreting the visible region as being relative to document space. Displayport rendering wants everything IGNORE_VIEWPORT_SCROLLING implies, except it wants the visible region to be relative to the viewport. So, split the coordinate-space interpretation into a new flag DOCUMENT_RELATIVE, which interprets the visible region as document-relative. r=tn sr=roc

This commit is contained in:
Chris Jones 2010-09-03 15:10:46 -05:00
Родитель 0c28df6c86
Коммит d579eff180
5 изменённых файлов: 25 добавлений и 11 удалений

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

@ -3730,12 +3730,14 @@ nsCanvasRenderingContext2D::DrawWindow(nsIDOMWindow* aWindow, float aX, float aY
nsPresContext::CSSPixelsToAppUnits(aY),
nsPresContext::CSSPixelsToAppUnits(aW),
nsPresContext::CSSPixelsToAppUnits(aH));
PRUint32 renderDocFlags = nsIPresShell::RENDER_IGNORE_VIEWPORT_SCROLLING;
PRUint32 renderDocFlags = (nsIPresShell::RENDER_IGNORE_VIEWPORT_SCROLLING |
nsIPresShell::RENDER_DOCUMENT_RELATIVE);
if (flags & nsIDOMCanvasRenderingContext2D::DRAWWINDOW_DRAW_CARET) {
renderDocFlags |= nsIPresShell::RENDER_CARET;
}
if (flags & nsIDOMCanvasRenderingContext2D::DRAWWINDOW_DRAW_VIEW) {
renderDocFlags &= ~nsIPresShell::RENDER_IGNORE_VIEWPORT_SCROLLING;
renderDocFlags &= ~(nsIPresShell::RENDER_IGNORE_VIEWPORT_SCROLLING |
nsIPresShell::RENDER_DOCUMENT_RELATIVE);
}
if (flags & nsIDOMCanvasRenderingContext2D::DRAWWINDOW_USE_WIDGET_LAYERS) {
renderDocFlags |= nsIPresShell::RENDER_USE_WIDGET_LAYERS;

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

@ -841,6 +841,8 @@ public:
* set RENDER_ASYNC_DECODE_IMAGES to avoid having images synchronously
* decoded during rendering.
* (by default images decode synchronously with RenderDocument)
* set RENDER_DOCUMENT_RELATIVE to interpret |aRect| relative to the
* document instead of the CSS viewport
* @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
@ -851,7 +853,8 @@ public:
RENDER_IGNORE_VIEWPORT_SCROLLING = 0x02,
RENDER_CARET = 0x04,
RENDER_USE_WIDGET_LAYERS = 0x08,
RENDER_ASYNC_DECODE_IMAGES = 0x10
RENDER_ASYNC_DECODE_IMAGES = 0x10,
RENDER_DOCUMENT_RELATIVE = 0x20
};
virtual NS_HIDDEN_(nsresult) RenderDocument(const nsRect& aRect, PRUint32 aFlags,
nscolor aBackgroundColor,

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

@ -1267,11 +1267,13 @@ nsLayoutUtils::PaintFrame(nsIRenderingContext* aRenderingContext, nsIFrame* aFra
if (rootScrollFrame) {
nsIScrollableFrame* rootScrollableFrame =
presShell->GetRootScrollFrameAsScrollable();
// Make visibleRegion and aRenderingContext relative to the
// scrolled frame instead of the root frame.
nsPoint pos = rootScrollableFrame->GetScrollPosition();
visibleRegion.MoveBy(-pos);
aRenderingContext->Translate(pos.x, pos.y);
if (aFlags & PAINT_DOCUMENT_RELATIVE) {
// Make visibleRegion and aRenderingContext relative to the
// scrolled frame instead of the root frame.
nsPoint pos = rootScrollableFrame->GetScrollPosition();
visibleRegion.MoveBy(-pos);
aRenderingContext->Translate(pos.x, pos.y);
}
builder.SetIgnoreScrollFrame(rootScrollFrame);
nsCanvasFrame* canvasFrame =
@ -1402,7 +1404,7 @@ nsLayoutUtils::PaintFrame(nsIRenderingContext* aRenderingContext, nsIFrame* aFra
// paint in a window, so make sure we flush out any retained layer
// trees before *and after* we draw
flags |= nsDisplayList::PAINT_FLUSH_LAYERS;
} else if (widget) {
} else if (widget && !(aFlags & PAINT_DOCUMENT_RELATIVE)) {
// XXX we should simplify this API now that dirtyWindowRegion always
// covers the entire window
widget->UpdatePossiblyTransparentRegion(dirtyWindowRegion, visibleWindowRegion);

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

@ -517,9 +517,10 @@ public:
PAINT_SYNC_DECODE_IMAGES = 0x02,
PAINT_WIDGET_LAYERS = 0x04,
PAINT_IGNORE_SUPPRESSION = 0x08,
PAINT_IGNORE_VIEWPORT_SCROLLING = 0x10,
PAINT_DOCUMENT_RELATIVE = 0x10,
PAINT_HIDE_CARET = 0x20,
PAINT_ALL_CONTINUATIONS = 0x40
PAINT_ALL_CONTINUATIONS = 0x40,
PAINT_IGNORE_VIEWPORT_SCROLLING = 0x80
};
/**
@ -543,6 +544,9 @@ public:
* even if aRenderingContext is non-null. This is useful if you want
* to force rendering to use the widget's layer manager for testing
* or speed. PAINT_WIDGET_LAYERS must be set if aRenderingContext is null.
* If PAINT_DOCUMENT_RELATIVE is used, the visible region is interpreted
* as being relative to the document. (Normally it's relative to the CSS
* viewport.)
*
* So there are three possible behaviours:
* 1) PAINT_WIDGET_LAYERS is set and aRenderingContext is null; we paint

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

@ -5294,6 +5294,9 @@ PresShell::RenderDocument(const nsRect& aRect, PRUint32 aFlags,
if (aFlags & RENDER_IGNORE_VIEWPORT_SCROLLING) {
flags |= nsLayoutUtils::PAINT_IGNORE_VIEWPORT_SCROLLING;
}
if (aFlags & RENDER_DOCUMENT_RELATIVE) {
flags |= nsLayoutUtils::PAINT_DOCUMENT_RELATIVE;
}
nsLayoutUtils::PaintFrame(rc, rootFrame, nsRegion(aRect),
aBackgroundColor, flags);