[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
hamaji at chromium.org
hamaji at chromium.org
Wed Dec 22 15:47:01 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit 6b206300eaa7ef64249204b08cbceec81e38f86e
Author: hamaji at chromium.org <hamaji at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Fri Nov 12 06:51:46 2010 +0000
2010-11-11 Shinichiro Hamaji <hamaji at chromium.org>
Reviewed by Darin Adler.
REGRESSION: window.print in onload doesn't fire if there's an img
https://bugs.webkit.org/show_bug.cgi?id=48195
This issue was introduced in
https://bugs.webkit.org/show_bug.cgi?id=43658
This happens because FrameLoader::isLoading() is false while an
image is still loading. Now, window.print() happens after all
resources are loaded.
Also changed the name of a member variable as Darin suggested in Bug 43658.
Added a manual test as DRT doesn't support window.print() yet.
* loader/DocumentLoader.cpp:
(WebCore::DocumentLoader::DocumentLoader):
(WebCore::DocumentLoader::updateLoading):
* loader/DocumentLoader.h:
* page/DOMWindow.cpp:
(WebCore::DOMWindow::DOMWindow):
(WebCore::DOMWindow::print):
(WebCore::DOMWindow::finishedLoading):
* page/DOMWindow.h:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@71892 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 622f6a9..c303c31 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,30 @@
+2010-11-11 Shinichiro Hamaji <hamaji at chromium.org>
+
+ Reviewed by Darin Adler.
+
+ REGRESSION: window.print in onload doesn't fire if there's an img
+ https://bugs.webkit.org/show_bug.cgi?id=48195
+
+ This issue was introduced in
+ https://bugs.webkit.org/show_bug.cgi?id=43658
+ This happens because FrameLoader::isLoading() is false while an
+ image is still loading. Now, window.print() happens after all
+ resources are loaded.
+
+ Also changed the name of a member variable as Darin suggested in Bug 43658.
+
+ Added a manual test as DRT doesn't support window.print() yet.
+
+ * loader/DocumentLoader.cpp:
+ (WebCore::DocumentLoader::DocumentLoader):
+ (WebCore::DocumentLoader::updateLoading):
+ * loader/DocumentLoader.h:
+ * page/DOMWindow.cpp:
+ (WebCore::DOMWindow::DOMWindow):
+ (WebCore::DOMWindow::print):
+ (WebCore::DOMWindow::finishedLoading):
+ * page/DOMWindow.h:
+
2010-11-11 James Simonsen <simonjam at chromium.org>
Reviewed by Tony Chang.
diff --git a/WebCore/loader/DocumentLoader.cpp b/WebCore/loader/DocumentLoader.cpp
index 7e4b1d9..cc46113 100644
--- a/WebCore/loader/DocumentLoader.cpp
+++ b/WebCore/loader/DocumentLoader.cpp
@@ -34,6 +34,7 @@
#include "ArchiveResourceCollection.h"
#include "CachedPage.h"
#include "CachedResourceLoader.h"
+#include "DOMWindow.h"
#include "Document.h"
#include "DocumentParser.h"
#include "Event.h"
@@ -356,7 +357,13 @@ void DocumentLoader::updateLoading()
return;
}
ASSERT(this == frameLoader()->activeDocumentLoader());
+ bool wasLoading = m_loading;
setLoading(frameLoader()->isLoading());
+
+ if (wasLoading && !m_loading) {
+ if (DOMWindow* window = m_frame->existingDOMWindow())
+ window->finishedLoading();
+ }
}
void DocumentLoader::setFrame(Frame* frame)
diff --git a/WebCore/loader/FrameLoader.cpp b/WebCore/loader/FrameLoader.cpp
index c48ca30..1f6b604 100644
--- a/WebCore/loader/FrameLoader.cpp
+++ b/WebCore/loader/FrameLoader.cpp
@@ -2176,10 +2176,6 @@ void FrameLoader::finishedLoading()
dl->setPrimaryLoadComplete(true);
m_client->dispatchDidLoadMainResource(dl.get());
checkLoadComplete();
-
- DOMWindow* window = m_frame->existingDOMWindow();
- if (window && window->printDeferred())
- window->print();
}
bool FrameLoader::isHostedByObjectElement() const
diff --git a/WebCore/manual-tests/print-onload-with-image.html b/WebCore/manual-tests/print-onload-with-image.html
new file mode 100644
index 0000000..4d34a11
--- /dev/null
+++ b/WebCore/manual-tests/print-onload-with-image.html
@@ -0,0 +1,13 @@
+<html>
+<head>
+<meta http-equiv=Content-Type content="text/html; charset=UTF-8">
+<title>Print Test</title>
+</head>
+<body onload="window.print()">
+<img src="http://code.google.com/p/chromium/logo?cct=1287781185">
+<H1>Hello, world.</h1>
+<p>
+This webpage should pop up a print dialog.
+</p>
+</body>
+</html>
diff --git a/WebCore/page/DOMWindow.cpp b/WebCore/page/DOMWindow.cpp
index 8779aaa..1cf2a3a 100644
--- a/WebCore/page/DOMWindow.cpp
+++ b/WebCore/page/DOMWindow.cpp
@@ -392,8 +392,8 @@ bool DOMWindow::canShowModalDialogNow(const Frame* frame)
}
DOMWindow::DOMWindow(Frame* frame)
- : m_printDeferred(false),
- m_frame(frame)
+ : m_shouldPrintWhenFinishedLoading(false)
+ , m_frame(frame)
{
}
@@ -892,11 +892,11 @@ void DOMWindow::print()
if (!page)
return;
- if (m_frame->loader()->isLoading()) {
- m_printDeferred = true;
+ if (m_frame->loader()->activeDocumentLoader()->isLoading()) {
+ m_shouldPrintWhenFinishedLoading = true;
return;
}
- m_printDeferred = false;
+ m_shouldPrintWhenFinishedLoading = false;
page->chrome()->print(m_frame);
}
@@ -1567,6 +1567,14 @@ void DOMWindow::releaseEvents()
// Not implemented.
}
+void DOMWindow::finishedLoading()
+{
+ if (m_shouldPrintWhenFinishedLoading) {
+ m_shouldPrintWhenFinishedLoading = false;
+ print();
+ }
+}
+
EventTargetData* DOMWindow::eventTargetData()
{
return &m_eventTargetData;
diff --git a/WebCore/page/DOMWindow.h b/WebCore/page/DOMWindow.h
index 2156791..d87a386 100644
--- a/WebCore/page/DOMWindow.h
+++ b/WebCore/page/DOMWindow.h
@@ -91,7 +91,6 @@ namespace WebCore {
virtual DOMWindow* toDOMWindow() { return this; }
virtual ScriptExecutionContext* scriptExecutionContext() const;
- bool printDeferred() const { return m_printDeferred; }
Frame* frame() const { return m_frame; }
void disconnectFrame();
@@ -366,6 +365,8 @@ namespace WebCore {
void captureEvents();
void releaseEvents();
+ void finishedLoading();
+
// These methods are used for GC marking. See JSDOMWindow::markChildren(MarkStack&) in
// JSDOMWindowCustom.cpp.
Screen* optionalScreen() const { return m_screen.get(); }
@@ -410,7 +411,7 @@ namespace WebCore {
RefPtr<SecurityOrigin> m_securityOrigin;
KURL m_url;
- bool m_printDeferred;
+ bool m_shouldPrintWhenFinishedLoading;
Frame* m_frame;
mutable RefPtr<Screen> m_screen;
mutable RefPtr<DOMSelection> m_selection;
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list