зеркало из https://github.com/mozilla/gecko-dev.git
Bug 575647 - [e10s] Move FlushLayoutForTree to nsContentUtils r=jonas, a=approval2.0
This commit is contained in:
Родитель
e2bbe9dc14
Коммит
110eddecd7
|
@ -1700,6 +1700,14 @@ public:
|
|||
*/
|
||||
static bool IsSubDocumentTabbable(nsIContent* aContent);
|
||||
|
||||
/**
|
||||
* Flushes the layout tree (recursively)
|
||||
*
|
||||
* @param aWindow the window the flush should start at
|
||||
*
|
||||
*/
|
||||
static void FlushLayoutForTree(nsIDOMWindow* aWindow);
|
||||
|
||||
private:
|
||||
|
||||
static PRBool InitializeEventTable();
|
||||
|
|
|
@ -6303,6 +6303,40 @@ nsContentUtils::IsSubDocumentTabbable(nsIContent* aContent)
|
|||
return !zombieViewer;
|
||||
}
|
||||
|
||||
void
|
||||
nsContentUtils::FlushLayoutForTree(nsIDOMWindow* aWindow)
|
||||
{
|
||||
nsCOMPtr<nsPIDOMWindow> piWin = do_QueryInterface(aWindow);
|
||||
if (!piWin)
|
||||
return;
|
||||
|
||||
// Note that because FlushPendingNotifications flushes parents, this
|
||||
// is O(N^2) in docshell tree depth. However, the docshell tree is
|
||||
// usually pretty shallow.
|
||||
|
||||
nsCOMPtr<nsIDOMDocument> domDoc;
|
||||
aWindow->GetDocument(getter_AddRefs(domDoc));
|
||||
nsCOMPtr<nsIDocument> doc = do_QueryInterface(domDoc);
|
||||
if (doc) {
|
||||
doc->FlushPendingNotifications(Flush_Layout);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDocShellTreeNode> node =
|
||||
do_QueryInterface(piWin->GetDocShell());
|
||||
if (node) {
|
||||
PRInt32 i = 0, i_end;
|
||||
node->GetChildCount(&i_end);
|
||||
for (; i < i_end; ++i) {
|
||||
nsCOMPtr<nsIDocShellTreeItem> item;
|
||||
node->GetChildAt(i, getter_AddRefs(item));
|
||||
nsCOMPtr<nsIDOMWindow> win = do_GetInterface(item);
|
||||
if (win) {
|
||||
FlushLayoutForTree(win);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void nsContentUtils::RemoveNewlines(nsString &aString)
|
||||
{
|
||||
// strip CR/LF and null
|
||||
|
|
|
@ -64,40 +64,6 @@ DocumentRendererChild::DocumentRendererChild()
|
|||
DocumentRendererChild::~DocumentRendererChild()
|
||||
{}
|
||||
|
||||
static void
|
||||
FlushLayoutForTree(nsIDOMWindow* aWindow)
|
||||
{
|
||||
nsCOMPtr<nsPIDOMWindow> piWin = do_QueryInterface(aWindow);
|
||||
if (!piWin)
|
||||
return;
|
||||
|
||||
// Note that because FlushPendingNotifications flushes parents, this
|
||||
// is O(N^2) in docshell tree depth. However, the docshell tree is
|
||||
// usually pretty shallow.
|
||||
|
||||
nsCOMPtr<nsIDOMDocument> domDoc;
|
||||
aWindow->GetDocument(getter_AddRefs(domDoc));
|
||||
nsCOMPtr<nsIDocument> doc = do_QueryInterface(domDoc);
|
||||
if (doc) {
|
||||
doc->FlushPendingNotifications(Flush_Layout);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDocShellTreeNode> node =
|
||||
do_QueryInterface(piWin->GetDocShell());
|
||||
if (node) {
|
||||
PRInt32 i = 0, i_end;
|
||||
node->GetChildCount(&i_end);
|
||||
for (; i < i_end; ++i) {
|
||||
nsCOMPtr<nsIDocShellTreeItem> item;
|
||||
node->GetChildAt(i, getter_AddRefs(item));
|
||||
nsCOMPtr<nsIDOMWindow> win = do_GetInterface(item);
|
||||
if (win) {
|
||||
FlushLayoutForTree(win);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
DocumentRendererChild::RenderDocument(nsIDOMWindow *window,
|
||||
const nsRect& documentRect,
|
||||
|
@ -109,7 +75,7 @@ DocumentRendererChild::RenderDocument(nsIDOMWindow *window,
|
|||
nsCString& data)
|
||||
{
|
||||
if (flushLayout)
|
||||
FlushLayoutForTree(window);
|
||||
nsContentUtils::FlushLayoutForTree(window);
|
||||
|
||||
nsCOMPtr<nsPresContext> presContext;
|
||||
nsCOMPtr<nsPIDOMWindow> win = do_QueryInterface(window);
|
||||
|
|
|
@ -3562,41 +3562,6 @@ nsCanvasRenderingContext2D::GetGlobalCompositeOperation(nsAString& op)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
FlushLayoutForTree(nsIDOMWindow* aWindow)
|
||||
{
|
||||
nsCOMPtr<nsPIDOMWindow> piWin = do_QueryInterface(aWindow);
|
||||
if (!piWin)
|
||||
return;
|
||||
|
||||
// Note that because FlushPendingNotifications flushes parents, this
|
||||
// is O(N^2) in docshell tree depth. However, the docshell tree is
|
||||
// usually pretty shallow.
|
||||
|
||||
nsCOMPtr<nsIDOMDocument> domDoc;
|
||||
aWindow->GetDocument(getter_AddRefs(domDoc));
|
||||
nsCOMPtr<nsIDocument> doc = do_QueryInterface(domDoc);
|
||||
if (doc) {
|
||||
doc->FlushPendingNotifications(Flush_Layout);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDocShellTreeNode> node =
|
||||
do_QueryInterface(piWin->GetDocShell());
|
||||
if (node) {
|
||||
PRInt32 i = 0, i_end;
|
||||
node->GetChildCount(&i_end);
|
||||
for (; i < i_end; ++i) {
|
||||
nsCOMPtr<nsIDocShellTreeItem> item;
|
||||
node->GetChildAt(i, getter_AddRefs(item));
|
||||
nsCOMPtr<nsIDOMWindow> win = do_GetInterface(item);
|
||||
if (win) {
|
||||
FlushLayoutForTree(win);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsCanvasRenderingContext2D::DrawWindow(nsIDOMWindow* aWindow, float aX, float aY,
|
||||
float aW, float aH,
|
||||
|
@ -3625,7 +3590,7 @@ nsCanvasRenderingContext2D::DrawWindow(nsIDOMWindow* aWindow, float aX, float aY
|
|||
|
||||
// Flush layout updates
|
||||
if (!(flags & nsIDOMCanvasRenderingContext2D::DRAWWINDOW_DO_NOT_FLUSH))
|
||||
FlushLayoutForTree(aWindow);
|
||||
nsContentUtils::FlushLayoutForTree(aWindow);
|
||||
|
||||
nsRefPtr<nsPresContext> presContext;
|
||||
nsCOMPtr<nsPIDOMWindow> win = do_QueryInterface(aWindow);
|
||||
|
|
Загрузка…
Ссылка в новой задаче