Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(594)

Side by Side Diff: Source/core/rendering/RenderLayerScrollableArea.cpp

Issue 603193005: Move the Widget hierarchy to the Oilpan heap. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add ~Scrollbar assert Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved.
3 * 3 *
4 * Portions are Copyright (C) 1998 Netscape Communications Corporation. 4 * Portions are Copyright (C) 1998 Netscape Communications Corporation.
5 * 5 *
6 * Other contributors: 6 * Other contributors:
7 * Robert O'Callahan <roc+@cs.cmu.edu> 7 * Robert O'Callahan <roc+@cs.cmu.edu>
8 * David Baron <dbaron@fas.harvard.edu> 8 * David Baron <dbaron@fas.harvard.edu>
9 * Christian Biesinger <cbiesinger@web.de> 9 * Christian Biesinger <cbiesinger@web.de>
10 * Randall Jesup <rjesup@wgate.com> 10 * Randall Jesup <rjesup@wgate.com>
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 } 350 }
351 351
352 if (scrollOffset() == toIntSize(newScrollOffset)) 352 if (scrollOffset() == toIntSize(newScrollOffset))
353 return; 353 return;
354 354
355 setScrollOffset(toIntSize(newScrollOffset)); 355 setScrollOffset(toIntSize(newScrollOffset));
356 356
357 LocalFrame* frame = box().frame(); 357 LocalFrame* frame = box().frame();
358 ASSERT(frame); 358 ASSERT(frame);
359 359
360 RefPtr<FrameView> frameView = box().frameView(); 360 RefPtrWillBeRawPtr<FrameView> frameView = box().frameView();
361 361
362 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "ScrollLayer", "data", InspectorScrollLayerEvent::data(&box())); 362 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "ScrollLayer", "data", InspectorScrollLayerEvent::data(&box()));
363 // FIXME(361045): remove InspectorInstrumentation calls once DevTools Timeli ne migrates to tracing. 363 // FIXME(361045): remove InspectorInstrumentation calls once DevTools Timeli ne migrates to tracing.
364 InspectorInstrumentation::willScrollLayer(&box()); 364 InspectorInstrumentation::willScrollLayer(&box());
365 365
366 const RenderLayerModelObject* paintInvalidationContainer = box().containerFo rPaintInvalidation(); 366 const RenderLayerModelObject* paintInvalidationContainer = box().containerFo rPaintInvalidation();
367 367
368 // Update the positions of our child layers (if needed as only fixed layers should be impacted by a scroll). 368 // Update the positions of our child layers (if needed as only fixed layers should be impacted by a scroll).
369 // We don't update compositing layers, because we need to do a deep update f rom the compositing ancestor. 369 // We don't update compositing layers, because we need to do a deep update f rom the compositing ancestor.
370 if (!frameView->isInPerformLayout()) { 370 if (!frameView->isInPerformLayout()) {
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after
842 if (Node* node = renderer.node()) { 842 if (Node* node = renderer.node()) {
843 if (ShadowRoot* shadowRoot = node->containingShadowRoot()) { 843 if (ShadowRoot* shadowRoot = node->containingShadowRoot()) {
844 if (shadowRoot->type() == ShadowRoot::UserAgentShadowRoot) 844 if (shadowRoot->type() == ShadowRoot::UserAgentShadowRoot)
845 return shadowRoot->host()->renderer(); 845 return shadowRoot->host()->renderer();
846 } 846 }
847 } 847 }
848 848
849 return &renderer; 849 return &renderer;
850 } 850 }
851 851
852 PassRefPtr<Scrollbar> RenderLayerScrollableArea::createScrollbar(ScrollbarOrient ation orientation) 852 PassRefPtrWillBeRawPtr<Scrollbar> RenderLayerScrollableArea::createScrollbar(Scr ollbarOrientation orientation)
853 { 853 {
854 RefPtr<Scrollbar> widget; 854 RefPtrWillBeRawPtr<Scrollbar> widget = nullptr;
855 RenderObject* actualRenderer = rendererForScrollbar(box()); 855 RenderObject* actualRenderer = rendererForScrollbar(box());
856 bool hasCustomScrollbarStyle = actualRenderer->isBox() && actualRenderer->st yle()->hasPseudoStyle(SCROLLBAR); 856 bool hasCustomScrollbarStyle = actualRenderer->isBox() && actualRenderer->st yle()->hasPseudoStyle(SCROLLBAR);
857 if (hasCustomScrollbarStyle) { 857 if (hasCustomScrollbarStyle) {
858 widget = RenderScrollbar::createCustomScrollbar(this, orientation, actua lRenderer->node()); 858 widget = RenderScrollbar::createCustomScrollbar(this, orientation, actua lRenderer->node());
859 } else { 859 } else {
860 ScrollbarControlSize scrollbarSize = RegularScrollbar; 860 ScrollbarControlSize scrollbarSize = RegularScrollbar;
861 if (actualRenderer->style()->hasAppearance()) 861 if (actualRenderer->style()->hasAppearance())
862 scrollbarSize = RenderTheme::theme().scrollbarControlSizeForPart(act ualRenderer->style()->appearance()); 862 scrollbarSize = RenderTheme::theme().scrollbarControlSizeForPart(act ualRenderer->style()->appearance());
863 widget = Scrollbar::create(this, orientation, scrollbarSize); 863 widget = Scrollbar::create(this, orientation, scrollbarSize);
864 if (orientation == HorizontalScrollbar) 864 if (orientation == HorizontalScrollbar)
865 didAddScrollbar(widget.get(), HorizontalScrollbar); 865 didAddScrollbar(widget.get(), HorizontalScrollbar);
866 else 866 else
867 didAddScrollbar(widget.get(), VerticalScrollbar); 867 didAddScrollbar(widget.get(), VerticalScrollbar);
868 } 868 }
869 box().document().view()->addChild(widget.get()); 869 box().document().view()->addChild(widget.get());
870 return widget.release(); 870 return widget.release();
871 } 871 }
872 872
873 void RenderLayerScrollableArea::destroyScrollbar(ScrollbarOrientation orientatio n) 873 void RenderLayerScrollableArea::destroyScrollbar(ScrollbarOrientation orientatio n)
874 { 874 {
875 RefPtr<Scrollbar>& scrollbar = orientation == HorizontalScrollbar ? m_hBar : m_vBar; 875 RefPtrWillBePersistent<Scrollbar>& scrollbar = orientation == HorizontalScro llbar ? m_hBar : m_vBar;
876 if (!scrollbar) 876 if (!scrollbar)
877 return; 877 return;
878 878
879 if (!scrollbar->isCustomScrollbar()) 879 if (!scrollbar->isCustomScrollbar())
880 willRemoveScrollbar(scrollbar.get(), orientation); 880 willRemoveScrollbar(scrollbar.get(), orientation);
881 881
882 scrollbar->removeFromParent(); 882 scrollbar->removeFromParent();
883 scrollbar->disconnectFromScrollableArea(); 883 scrollbar->disconnectFromScrollableArea();
884 scrollbar = nullptr; 884 scrollbar = nullptr;
885 } 885 }
(...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after
1469 void RenderLayerScrollableArea::setTopmostScrollChild(RenderLayer* scrollChild) 1469 void RenderLayerScrollableArea::setTopmostScrollChild(RenderLayer* scrollChild)
1470 { 1470 {
1471 // We only want to track the topmost scroll child for scrollable areas with 1471 // We only want to track the topmost scroll child for scrollable areas with
1472 // overlay scrollbars. 1472 // overlay scrollbars.
1473 if (!hasOverlayScrollbars()) 1473 if (!hasOverlayScrollbars())
1474 return; 1474 return;
1475 m_nextTopmostScrollChild = scrollChild; 1475 m_nextTopmostScrollChild = scrollChild;
1476 } 1476 }
1477 1477
1478 } // namespace blink 1478 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698