[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677
darin
darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 07:21:59 UTC 2009
The following commit has been merged in the debian/unstable branch:
commit e790c95a249c48161bae79eb54ac26bb7cede247
Author: darin <darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Mon Jan 27 07:33:59 2003 +0000
Reviewed by Maciej.
- fixed 3126431 -- failed assertion `!attached()' at silkair.net
* khtml/rendering/render_image.h: Fix isImage which for some strange reason was
returning false. Not important because no one calls it. Added dispatchLoadEvent
and detach member functions.
* khtml/rendering/render_image.cpp:
(RenderImage::notifyFinished): Instead of dispatching the load or error event
immediately, call dispatchImageLoadEventSoon on the document.
(RenderImage::dispatchLoadEvent): Added. Moved the code to do the actual
event dispatch in here.
(RenderImage::detach): Remove the image from the document in case it has a
pending event that was not delivered yet before calling the base class detach.
* khtml/xml/dom_docimpl.h: Add dispatchImageLoadEventSoon, dispatchImageLoadEventsNow,
removeImage, and an override of timerEvent. Moved APPLE_CHANGES code to a better place.
* khtml/xml/dom_docimpl.cpp: Moved APPLE_CHANGES code to a better place and made these changes:
(DocumentImpl::DocumentImpl): Initialize m_imageLoadEventTimer to 0.
(DocumentImpl::detach): Redo the APPLE_CHANGES to make them easier to read.
Empty out the m_imageLoadEventDispatchSoonList and the m_imageLoadEventDispatchingList
to avoid an O(n^2) operation as we detach each image and remove it from the list.
(DocumentImpl::dispatchImageLoadEventSoon): Added. Adds image to list and sets up timer.
(DocumentImpl::removeImage): Added. Removes image from lists, and cancels timer if needed.
(DocumentImpl::dispatchImageLoadEventsNow): Added. Copies list, and call images to dispatch load events.
(DocumentImpl::timerEvent): Added. Calls dispatchImageLoadEventsNow.
* khtml/html/html_documentimpl.cpp: (HTMLDocumentImpl::close):
Dispatch all pending image load events before dispatching the document load.
* force-clean-timestamp: Force rebuild because Project Builder doesn't do
header dependencies well enough to deal with changes to the document class.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@3459 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index 3ab683d..1507c7c 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,3 +1,38 @@
+2003-01-26 Darin Adler <darin at apple.com>
+
+ Reviewed by Maciej.
+
+ - fixed 3126431 -- failed assertion `!attached()' at silkair.net
+
+ * khtml/rendering/render_image.h: Fix isImage which for some strange reason was
+ returning false. Not important because no one calls it. Added dispatchLoadEvent
+ and detach member functions.
+ * khtml/rendering/render_image.cpp:
+ (RenderImage::notifyFinished): Instead of dispatching the load or error event
+ immediately, call dispatchImageLoadEventSoon on the document.
+ (RenderImage::dispatchLoadEvent): Added. Moved the code to do the actual
+ event dispatch in here.
+ (RenderImage::detach): Remove the image from the document in case it has a
+ pending event that was not delivered yet before calling the base class detach.
+
+ * khtml/xml/dom_docimpl.h: Add dispatchImageLoadEventSoon, dispatchImageLoadEventsNow,
+ removeImage, and an override of timerEvent. Moved APPLE_CHANGES code to a better place.
+ * khtml/xml/dom_docimpl.cpp: Moved APPLE_CHANGES code to a better place and made these changes:
+ (DocumentImpl::DocumentImpl): Initialize m_imageLoadEventTimer to 0.
+ (DocumentImpl::detach): Redo the APPLE_CHANGES to make them easier to read.
+ Empty out the m_imageLoadEventDispatchSoonList and the m_imageLoadEventDispatchingList
+ to avoid an O(n^2) operation as we detach each image and remove it from the list.
+ (DocumentImpl::dispatchImageLoadEventSoon): Added. Adds image to list and sets up timer.
+ (DocumentImpl::removeImage): Added. Removes image from lists, and cancels timer if needed.
+ (DocumentImpl::dispatchImageLoadEventsNow): Added. Copies list, and call images to dispatch load events.
+ (DocumentImpl::timerEvent): Added. Calls dispatchImageLoadEventsNow.
+
+ * khtml/html/html_documentimpl.cpp: (HTMLDocumentImpl::close):
+ Dispatch all pending image load events before dispatching the document load.
+
+ * force-clean-timestamp: Force rebuild because Project Builder doesn't do
+ header dependencies well enough to deal with changes to the document class.
+
2003-01-26 David Hyatt <hyatt at apple.com>
Fix :active to behave just like :hover. It was being
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 3ab683d..1507c7c 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,38 @@
+2003-01-26 Darin Adler <darin at apple.com>
+
+ Reviewed by Maciej.
+
+ - fixed 3126431 -- failed assertion `!attached()' at silkair.net
+
+ * khtml/rendering/render_image.h: Fix isImage which for some strange reason was
+ returning false. Not important because no one calls it. Added dispatchLoadEvent
+ and detach member functions.
+ * khtml/rendering/render_image.cpp:
+ (RenderImage::notifyFinished): Instead of dispatching the load or error event
+ immediately, call dispatchImageLoadEventSoon on the document.
+ (RenderImage::dispatchLoadEvent): Added. Moved the code to do the actual
+ event dispatch in here.
+ (RenderImage::detach): Remove the image from the document in case it has a
+ pending event that was not delivered yet before calling the base class detach.
+
+ * khtml/xml/dom_docimpl.h: Add dispatchImageLoadEventSoon, dispatchImageLoadEventsNow,
+ removeImage, and an override of timerEvent. Moved APPLE_CHANGES code to a better place.
+ * khtml/xml/dom_docimpl.cpp: Moved APPLE_CHANGES code to a better place and made these changes:
+ (DocumentImpl::DocumentImpl): Initialize m_imageLoadEventTimer to 0.
+ (DocumentImpl::detach): Redo the APPLE_CHANGES to make them easier to read.
+ Empty out the m_imageLoadEventDispatchSoonList and the m_imageLoadEventDispatchingList
+ to avoid an O(n^2) operation as we detach each image and remove it from the list.
+ (DocumentImpl::dispatchImageLoadEventSoon): Added. Adds image to list and sets up timer.
+ (DocumentImpl::removeImage): Added. Removes image from lists, and cancels timer if needed.
+ (DocumentImpl::dispatchImageLoadEventsNow): Added. Copies list, and call images to dispatch load events.
+ (DocumentImpl::timerEvent): Added. Calls dispatchImageLoadEventsNow.
+
+ * khtml/html/html_documentimpl.cpp: (HTMLDocumentImpl::close):
+ Dispatch all pending image load events before dispatching the document load.
+
+ * force-clean-timestamp: Force rebuild because Project Builder doesn't do
+ header dependencies well enough to deal with changes to the document class.
+
2003-01-26 David Hyatt <hyatt at apple.com>
Fix :active to behave just like :hover. It was being
diff --git a/WebCore/force-clean-timestamp b/WebCore/force-clean-timestamp
index 7771aeb..d2f107e 100644
--- a/WebCore/force-clean-timestamp
+++ b/WebCore/force-clean-timestamp
@@ -1 +1 @@
-New member vars in DocumentImpl 1/15/03
+added data members to DocumentImpl 1/26/03
\ No newline at end of file
diff --git a/WebCore/khtml/html/html_documentimpl.cpp b/WebCore/khtml/html/html_documentimpl.cpp
index 09d069d..74be914 100644
--- a/WebCore/khtml/html/html_documentimpl.cpp
+++ b/WebCore/khtml/html/html_documentimpl.cpp
@@ -310,8 +310,10 @@ void HTMLDocumentImpl::close()
bool wasNotRedirecting = !view() || view()->part()->d->m_redirectURL.isEmpty();
- if (body() && doload)
+ if (body() && doload) {
+ dispatchImageLoadEventsNow();
body()->dispatchWindowEvent(EventImpl::LOAD_EVENT, false, false);
+ }
// Make sure both the initial layout and reflow happen after the onload
// fires. This will improve onload scores, and other browsers do it.
diff --git a/WebCore/khtml/rendering/render_image.cpp b/WebCore/khtml/rendering/render_image.cpp
index b58778d..c541e6f 100644
--- a/WebCore/khtml/rendering/render_image.cpp
+++ b/WebCore/khtml/rendering/render_image.cpp
@@ -336,14 +336,42 @@ void RenderImage::layout()
void RenderImage::notifyFinished(CachedObject *finishedObj)
{
- if (image == finishedObj && !loadEventSent && element()) {
- loadEventSent = true;
- if (image->isErrorImage()) {
- element()->dispatchHTMLEvent(EventImpl::ERROR_EVENT,false,false);
- } else {
- element()->dispatchHTMLEvent(EventImpl::LOAD_EVENT,false,false);
- }
+ if (image == finishedObj) {
+ NodeImpl *node = element();
+ if (node) {
+ DocumentImpl *document = node->getDocument();
+ if (document) {
+ document->dispatchImageLoadEventSoon(this);
+ }
+ }
+ }
+}
+
+void RenderImage::dispatchLoadEvent()
+{
+ if (!loadEventSent) {
+ NodeImpl *node = element();
+ if (node) {
+ loadEventSent = true;
+ if (image->isErrorImage()) {
+ node->dispatchHTMLEvent(EventImpl::ERROR_EVENT, false, false);
+ } else {
+ node->dispatchHTMLEvent(EventImpl::LOAD_EVENT, false, false);
+ }
+ }
+ }
+}
+
+void RenderImage::detach(RenderArena *arena)
+{
+ NodeImpl *node = element();
+ if (node) {
+ DocumentImpl *document = node->getDocument();
+ if (document) {
+ document->removeImage(this);
+ }
}
+ RenderReplaced::detach(arena);
}
bool RenderImage::nodeAtPoint(NodeInfo& info, int _x, int _y, int _tx, int _ty, bool inside)
diff --git a/WebCore/khtml/rendering/render_image.h b/WebCore/khtml/rendering/render_image.h
index 1e6831e..1beb79f 100644
--- a/WebCore/khtml/rendering/render_image.h
+++ b/WebCore/khtml/rendering/render_image.h
@@ -44,7 +44,7 @@ public:
virtual const char *renderName() const { return "RenderImage"; }
virtual bool isRendered() const { return true; }
- virtual bool isImage() const { return false; }
+ virtual bool isImage() const { return true; }
virtual void paintObject( QPainter *p, int /*x*/, int /*y*/, int /*w*/, int /*h*/, int tx, int ty, PaintAction paintAction);
@@ -63,12 +63,15 @@ public:
virtual void updateFromElement();
virtual void notifyFinished(CachedObject *finishedObj);
+ void dispatchLoadEvent();
virtual bool nodeAtPoint(NodeInfo& info, int x, int y, int tx, int ty, bool inside=false);
virtual short calcReplacedWidth() const;
virtual int calcReplacedHeight() const;
+ virtual void detach(RenderArena *);
+
private:
bool isWidthSpecified() const;
bool isHeightSpecified() const;
diff --git a/WebCore/khtml/xml/dom_docimpl.cpp b/WebCore/khtml/xml/dom_docimpl.cpp
index c787e3f..c061e43 100644
--- a/WebCore/khtml/xml/dom_docimpl.cpp
+++ b/WebCore/khtml/xml/dom_docimpl.cpp
@@ -45,6 +45,7 @@
#include "rendering/render_root.h"
#include "rendering/render_replaced.h"
+#include "rendering/render_image.h"
#include "render_arena.h"
#include "khtmlview.h"
@@ -227,9 +228,9 @@ QPtrList<DocumentImpl> * DocumentImpl::changedDocuments = 0;
// KHTMLView might be 0
DocumentImpl::DocumentImpl(DOMImplementationImpl *_implementation, KHTMLView *v)
: NodeBaseImpl( new DocumentPtr() )
+ , m_imageLoadEventTimer(0)
#if APPLE_CHANGES
- , m_finishedParsing(this, SIGNAL(finishedParsing())), m_inPageCache(0),
- m_passwordFields(0), m_secureForms(0)
+ , m_finishedParsing(this, SIGNAL(finishedParsing())), m_inPageCache(0), m_passwordFields(0), m_secureForms(0)
#endif
{
document->doc = this;
@@ -1022,14 +1023,22 @@ void DocumentImpl::restoreRenderer(RenderObject* render)
void DocumentImpl::detach()
{
-#if APPLE_CHANGES
- if (!m_inPageCache){
- //printf ("detaching document\n");
-#endif
RenderObject* render = m_render;
// indicate destruction mode, i.e. attached() but m_render == 0
m_render = 0;
+
+#if APPLE_CHANGES
+ if (m_inPageCache) {
+ return;
+ }
+#endif
+
+ // Empty out these lists as a performance optimization, since detaching
+ // all the individual render objects will cause all the RenderImage
+ // objects to remove themselves from the lists.
+ m_imageLoadEventDispatchSoonList.clear();
+ m_imageLoadEventDispatchingList.clear();
NodeBaseImpl::detach();
@@ -1042,12 +1051,6 @@ void DocumentImpl::detach()
delete m_renderArena;
m_renderArena = 0;
}
-#if APPLE_CHANGES
- }
- else {
- m_render = 0;
- }
-#endif
}
void DocumentImpl::setVisuallyOrdered()
@@ -2130,6 +2133,96 @@ EventListener *DocumentImpl::createHTMLEventListener(QString code)
return view()->part()->createHTMLEventListener(code);
}
+void DocumentImpl::dispatchImageLoadEventSoon(RenderImage *image)
+{
+ m_imageLoadEventDispatchSoonList.append(image);
+ if (!m_imageLoadEventTimer) {
+ m_imageLoadEventTimer = startTimer(0);
+ }
+}
+
+void DocumentImpl::removeImage(RenderImage *image)
+{
+ m_imageLoadEventDispatchSoonList.remove(image);
+ m_imageLoadEventDispatchingList.remove(image);
+ if (m_imageLoadEventDispatchSoonList.isEmpty() && m_imageLoadEventTimer) {
+ killTimer(m_imageLoadEventTimer);
+ m_imageLoadEventTimer = 0;
+ }
+}
+
+void DocumentImpl::dispatchImageLoadEventsNow()
+{
+ if (m_imageLoadEventTimer) {
+ killTimer(m_imageLoadEventTimer);
+ m_imageLoadEventTimer = 0;
+ }
+
+ m_imageLoadEventDispatchingList = m_imageLoadEventDispatchSoonList;
+ m_imageLoadEventDispatchSoonList.clear();
+ for (QPtrListIterator<RenderImage> it(m_imageLoadEventDispatchingList); it.current(); ) {
+ RenderImage *image = it.current();
+ // Must advance iterator *before* dispatching call.
+ // Otherwise, it might be advanced automatically if dispatching the call had a side effect
+ // of destroying the current RenderImage, and then we would advance past the *next* item,
+ // missing one altogether.
+ ++it;
+ image->dispatchLoadEvent();
+ }
+ m_imageLoadEventDispatchingList.clear();
+}
+
+void DocumentImpl::timerEvent(QTimerEvent *)
+{
+ dispatchImageLoadEventsNow();
+}
+
+#if APPLE_CHANGES
+
+bool DocumentImpl::inPageCache()
+{
+ return m_inPageCache;
+}
+
+void DocumentImpl::setInPageCache(bool flag)
+{
+ m_inPageCache = flag;
+}
+
+void DocumentImpl::passwordFieldAdded()
+{
+ m_passwordFields++;
+}
+
+void DocumentImpl::passwordFieldRemoved()
+{
+ assert(m_passwordFields > 0);
+ m_passwordFields--;
+}
+
+bool DocumentImpl::hasPasswordField() const
+{
+ return m_passwordFields > 0;
+}
+
+void DocumentImpl::secureFormAdded()
+{
+ m_secureForms++;
+}
+
+void DocumentImpl::secureFormRemoved()
+{
+ assert(m_secureForms > 0);
+ m_secureForms--;
+}
+
+bool DocumentImpl::hasSecureForm() const
+{
+ return m_secureForms > 0;
+}
+
+#endif // APPLE_CHANGES
+
// ----------------------------------------------------------------------------
DocumentFragmentImpl::DocumentFragmentImpl(DocumentPtr *doc) : NodeBaseImpl(doc)
@@ -2234,49 +2327,4 @@ NodeImpl *DocumentTypeImpl::cloneNode ( bool /*deep*/ )
return 0;
}
-#if APPLE_CHANGES
-bool DocumentImpl::inPageCache()
-{
- return m_inPageCache;
-}
-
-void DocumentImpl::setInPageCache(bool flag)
-{
- m_inPageCache = flag;
-}
-
-void DocumentImpl::passwordFieldAdded()
-{
- m_passwordFields++;
-}
-
-void DocumentImpl::passwordFieldRemoved()
-{
- assert(m_passwordFields > 0);
- m_passwordFields--;
-}
-
-bool DocumentImpl::hasPasswordField() const
-{
- return m_passwordFields > 0;
-}
-
-void DocumentImpl::secureFormAdded()
-{
- m_secureForms++;
-}
-
-void DocumentImpl::secureFormRemoved()
-{
- assert(m_secureForms > 0);
- m_secureForms--;
-}
-
-bool DocumentImpl::hasSecureForm() const
-{
- return m_secureForms > 0;
-}
-
-#endif
-
#include "dom_docimpl.moc"
diff --git a/WebCore/khtml/xml/dom_docimpl.h b/WebCore/khtml/xml/dom_docimpl.h
index 5a5b804..7d2db0b 100644
--- a/WebCore/khtml/xml/dom_docimpl.h
+++ b/WebCore/khtml/xml/dom_docimpl.h
@@ -51,6 +51,7 @@ namespace khtml {
class CSSStyleSelector;
class DocLoader;
class CSSStyleSelectorList;
+ class RenderImage;
}
namespace DOM {
@@ -408,34 +409,15 @@ public:
* @param content The header value (value of the meta tag's "content" attribute)
*/
void processHttpEquiv(const DOMString &equiv, const DOMString &content);
+
+ void dispatchImageLoadEventSoon(khtml::RenderImage *);
+ void dispatchImageLoadEventsNow();
+ void removeImage(khtml::RenderImage *);
+ virtual void timerEvent(QTimerEvent *);
signals:
void finishedParsing();
-#if APPLE_CHANGES
-public:
- KWQSignal m_finishedParsing;
-
- static Document createInstance (DocumentImpl *impl);
-
- bool inPageCache();
- void setInPageCache (bool flag);
- void restoreRenderer(khtml::RenderObject* render);
-
- void passwordFieldAdded();
- void passwordFieldRemoved();
- bool hasPasswordField() const ;
-
- void secureFormAdded();
- void secureFormRemoved();
- bool hasSecureForm() const ;
-
-private:
- bool m_inPageCache;
- int m_passwordFields;
- int m_secureForms;
-#endif
-
protected:
khtml::CSSStyleSelector *m_styleSelector;
KHTMLView *m_view;
@@ -507,6 +489,34 @@ protected:
DOMString m_title;
RenderArena* m_renderArena;
+
+ QPtrList<khtml::RenderImage> m_imageLoadEventDispatchSoonList;
+ QPtrList<khtml::RenderImage> m_imageLoadEventDispatchingList;
+ int m_imageLoadEventTimer;
+
+#if APPLE_CHANGES
+public:
+ KWQSignal m_finishedParsing;
+
+ static Document createInstance (DocumentImpl *impl);
+
+ bool inPageCache();
+ void setInPageCache(bool flag);
+ void restoreRenderer(khtml::RenderObject* render);
+
+ void passwordFieldAdded();
+ void passwordFieldRemoved();
+ bool hasPasswordField() const;
+
+ void secureFormAdded();
+ void secureFormRemoved();
+ bool hasSecureForm() const;
+
+private:
+ bool m_inPageCache;
+ int m_passwordFields;
+ int m_secureForms;
+#endif
};
class DocumentFragmentImpl : public NodeBaseImpl
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list