2006-07-21 Anders Carlsson <acarlsson@apple.com>
authorandersca <andersca@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 21 Jul 2006 07:56:32 +0000 (07:56 +0000)
committerandersca <andersca@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 21 Jul 2006 07:56:32 +0000 (07:56 +0000)
        Reviewed by Geoff.

        * dom/Document.h:
        (WebCore::Document::):
        * dom/EventTargetNode.cpp:
        (WebCore::EventTargetNode::addEventListener):
        * page/FrameView.cpp:
        (WebCore::FrameView::layout):
        * rendering/RenderLayer.cpp:
        (WebCore::RenderLayer::updateScrollInfoAfterLayout):
        Only dispatch overflowchanged events if overflowchanged event listeners have been registered on the document.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@15553 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog
WebCore/dom/Document.h
WebCore/dom/EventTargetNode.cpp
WebCore/page/FrameView.cpp
WebCore/rendering/RenderLayer.cpp

index edaca43d1ec0be6a9c41036df581f604cb0db473..f8bb7d69bf58f7ec2ddaac26138a0522f030e012 100644 (file)
@@ -1,3 +1,17 @@
+2006-07-21  Anders Carlsson  <acarlsson@apple.com>
+
+        Reviewed by Geoff.
+
+        * dom/Document.h:
+        (WebCore::Document::):
+        * dom/EventTargetNode.cpp:
+        (WebCore::EventTargetNode::addEventListener):
+        * page/FrameView.cpp:
+        (WebCore::FrameView::layout):
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::updateScrollInfoAfterLayout):
+        Only dispatch overflowchanged events if overflowchanged event listeners have been registered on the document.
+
 2006-07-20  Anders Carlsson  <acarlsson@apple.com>
 
         Reviewed by Geoff.
index 06f58cfafff9e37428b2ad6515016616812b9fa1..4263cfa847622e8965b10705e0426a9a93901ebd 100644 (file)
@@ -428,7 +428,8 @@ public:
         DOMNODEREMOVEDFROMDOCUMENT_LISTENER  = 0x08,
         DOMNODEINSERTEDINTODOCUMENT_LISTENER = 0x10,
         DOMATTRMODIFIED_LISTENER             = 0x20,
-        DOMCHARACTERDATAMODIFIED_LISTENER    = 0x40
+        DOMCHARACTERDATAMODIFIED_LISTENER    = 0x40,
+        OVERFLOWCHANGED_LISTENER             = 0x80,
     };
 
     bool hasListenerType(ListenerType listenerType) const { return (m_listenerTypes & listenerType); }
index a2af079b5264b94d3b71df008d80d4c5783603e8..d0ffbca84b12c96fd0ad4602ab3392e894538441 100644 (file)
@@ -102,6 +102,9 @@ void EventTargetNode::addEventListener(const AtomicString &eventType, PassRefPtr
         type = Document::DOMATTRMODIFIED_LISTENER;
     else if (eventType == DOMCharacterDataModifiedEvent)
         type = Document::DOMCHARACTERDATAMODIFIED_LISTENER;
+    else if (eventType == overflowchangedEvent)
+        type = Document::OVERFLOWCHANGED_LISTENER;
+        
     if (type)
         document()->addListenerType(type);
     
index 64a6523c5b5a58e7f08c86021952af3095d98ba9..941cf2f3c2b29a6a782075f6f4b3ae5c56151c10 100644 (file)
@@ -514,8 +514,9 @@ void FrameView::layout(bool allowSubtree)
     if (didFirstLayout)
         m_frame->didFirstLayout();
     
-    updateOverflowStatus(visibleWidth() < contentsWidth(),
-                         visibleHeight() < contentsHeight());
+    if (document->hasListenerType(Document::OVERFLOWCHANGED_LISTENER))
+        updateOverflowStatus(visibleWidth() < contentsWidth(),
+                             visibleHeight() < contentsHeight());
 
     // Dispatch events scheduled during layout
     dispatchScheduledEvents();    
index e87083b56b2afd8263dd206a00725ee886ce28a9..861f88390f4db33870889eb81b4ecbd606e5726b 100644 (file)
@@ -1052,7 +1052,8 @@ RenderLayer::updateScrollInfoAfterLayout()
     computeScrollDimensions(&horizontalOverflow, &verticalOverflow);
 
     if (m_object->style()->overflowX() == OHIDDEN && m_object->style()->overflowY() == OHIDDEN) {
-        updateOverflowStatus(horizontalOverflow, verticalOverflow);
+        if (m_object->element()->document()->hasListenerType(Document::OVERFLOWCHANGED_LISTENER))
+            updateOverflowStatus(horizontalOverflow, verticalOverflow);
         return; // All we had to do was update the overflow status and dirty
     }
 
@@ -1133,7 +1134,9 @@ RenderLayer::updateScrollInfoAfterLayout()
         m_object->document()->setDashboardRegionsDirty(true);
 #endif
 
-    updateOverflowStatus(horizontalOverflow, verticalOverflow);
+    if (m_object->element()->document()->hasListenerType(Document::OVERFLOWCHANGED_LISTENER))
+        updateOverflowStatus(horizontalOverflow, verticalOverflow);
+    
     m_object->repaint();
 }