FrameView: Store scroll corner renderer in a RenderPtr.
authorakling@apple.com <akling@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 1 Jan 2014 23:18:46 +0000 (23:18 +0000)
committerakling@apple.com <akling@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 1 Jan 2014 23:18:46 +0000 (23:18 +0000)
<https://webkit.org/b/126364>

Make FrameView::m_scrollCorner a RenderPtr<RenderScrollbarPart> and
remove two manual destroy() calls.

Reviewed by Antti Koivisto.

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

Source/WebCore/ChangeLog
Source/WebCore/page/FrameView.cpp
Source/WebCore/page/FrameView.h

index c08eac42c74bebfac5c814ef3ec676b4ea963820..cee714e9e8f05c73bf3763c38ca04e5fcf676a5b 100644 (file)
@@ -1,3 +1,13 @@
+2014-01-01  Andreas Kling  <akling@apple.com>
+
+        FrameView: Store scroll corner renderer in a RenderPtr.
+        <https://webkit.org/b/126364>
+
+        Make FrameView::m_scrollCorner a RenderPtr<RenderScrollbarPart> and
+        remove two manual destroy() calls.
+
+        Reviewed by Antti Koivisto.
+
 2014-01-01  Antti Koivisto  <antti@apple.com>
 
         Remove elementChildren/elementDescendants shorthands
index bdcaa757981f498dcfae78fca99a61028e284a9a..f1d8d26aba1f917c533d06646a39ecdcb94da489 100644 (file)
@@ -203,7 +203,6 @@ FrameView::FrameView(Frame& frame)
     , m_shouldUpdateWhileOffscreen(true)
     , m_deferSetNeedsLayouts(0)
     , m_setNeedsLayoutWasDeferred(false)
-    , m_scrollCorner(0)
 #if PLATFORM(IOS)
     , m_useCustomFixedPositionLayoutRect(false)
 #endif
@@ -376,10 +375,7 @@ void FrameView::detachCustomScrollbars()
     if (verticalBar && verticalBar->isCustomScrollbar())
         setHasVerticalScrollbar(false);
 
-    if (m_scrollCorner) {
-        m_scrollCorner->destroy();
-        m_scrollCorner = 0;
-    }
+    m_scrollCorner = nullptr;
 }
 
 void FrameView::recalculateScrollbarOverlayStyle()
@@ -3320,16 +3316,15 @@ void FrameView::updateScrollCorner()
         }
     }
 
-    if (cornerStyle) {
+    if (!cornerStyle)
+        m_scrollCorner = nullptr;
+    else {
         if (!m_scrollCorner) {
-            m_scrollCorner = new RenderScrollbarPart(renderer->document(), cornerStyle.releaseNonNull());
+            m_scrollCorner = createRenderer<RenderScrollbarPart>(renderer->document(), cornerStyle.releaseNonNull());
             m_scrollCorner->initializeStyle();
         } else
             m_scrollCorner->setStyle(cornerStyle.releaseNonNull());
         invalidateScrollCorner(cornerRect);
-    } else if (m_scrollCorner) {
-        m_scrollCorner->destroy();
-        m_scrollCorner = 0;
     }
 
     ScrollView::updateScrollCorner();
index b320f9c9c6769a2db766d9b20b0a04c7ac35c2f1..1f454b45261f9bef43f20684dd919e460efe7202 100644 (file)
@@ -31,6 +31,7 @@
 #include "LayoutRect.h"
 #include "Pagination.h"
 #include "PaintPhase.h"
+#include "RenderPtr.h"
 #include "ScrollView.h"
 #include <wtf/Forward.h>
 #include <wtf/ListHashSet.h>
@@ -644,7 +645,7 @@ private:
     RefPtr<Node> m_maintainScrollPositionAnchor;
 
     // Renderer to hold our custom scroll corner.
-    RenderScrollbarPart* m_scrollCorner;
+    RenderPtr<RenderScrollbarPart> m_scrollCorner;
 
 #if PLATFORM(IOS)
     bool m_useCustomFixedPositionLayoutRect;