All pastes #1424063 Raw Edit

Miscellany

public text v1 · immutable
#1424063 ·published 2009-05-15 20:42 UTC
rendered paste body
diff --git a/WebCore/page/Frame.cpp b/WebCore/page/Frame.cpp
index e1b78af..55d31a4 100644
--- a/WebCore/page/Frame.cpp
+++ b/WebCore/page/Frame.cpp
@@ -1594,6 +1594,12 @@ void Frame::pageDestroyed()
 void Frame::disconnectOwnerElement()
 {
     if (m_ownerElement) {
+#if PLATFORM(QT)
+        if (view() && view()->parent()) {
+            int count = view()->preventBlittingCount();
+            view()->parent()->decrementPreventBlittingCount(count);
+        }
+#endif
         if (Document* doc = document())
             doc->clearAXObjectCache();
         m_ownerElement->m_contentFrame = 0;
diff --git a/WebCore/platform/ScrollView.h b/WebCore/platform/ScrollView.h
index 782c544..a602a9e 100644
--- a/WebCore/platform/ScrollView.h
+++ b/WebCore/platform/ScrollView.h
@@ -295,6 +295,10 @@ private:
 #endif
 
 #if PLATFORM(QT)
+public:
+    int preventBlittingCount() const;
+    void incrementPreventBlittingCount(int);
+    void decrementPreventBlittingCount(int);
 private:
     bool rootPreventsBlitting() const { return root()->m_widgetsThatPreventBlitting > 0; }
     unsigned m_widgetsThatPreventBlitting;
diff --git a/WebCore/platform/qt/ScrollViewQt.cpp b/WebCore/platform/qt/ScrollViewQt.cpp
index 76d9f01..caec0b8 100644
--- a/WebCore/platform/qt/ScrollViewQt.cpp
+++ b/WebCore/platform/qt/ScrollViewQt.cpp
@@ -43,20 +43,39 @@ void ScrollView::platformDestroy()
 {
 }
 
-void ScrollView::platformAddChild(Widget* child)
+int ScrollView::preventBlittingCount() const
+{
+    return m_widgetsThatPreventBlitting;
+}
+
+void ScrollView::incrementPreventBlittingCount(int count)
+{
+    m_widgetsThatPreventBlitting += count;
+    // propagate the increment
+    if (parent())
+        parent()->incrementPreventBlittingCount(count);
+}
+
+void ScrollView::decrementPreventBlittingCount(int count)
 {
-    root()->m_widgetsThatPreventBlitting++;
+    ASSERT(m_widgetsThatPreventBlitting);
+
+    m_widgetsThatPreventBlitting -= count;
+    // propagate the decrement
     if (parent())
-        parent()->platformAddChild(child);
+        parent()->decrementPreventBlittingCount(count);
+}
+
+void ScrollView::platformAddChild(Widget* child)
+{
+    incrementPreventBlittingCount(1);
 }
 
 void ScrollView::platformRemoveChild(Widget* child)
 {
-    ASSERT(root()->m_widgetsThatPreventBlitting);
-    root()->m_widgetsThatPreventBlitting--;
     child->hide();
+    decrementPreventBlittingCount(1);
 }
 
 }
-
 // vim: ts=4 sw=4 et