Index: Source/core/frame/FrameView.cpp |
diff --git a/Source/core/frame/FrameView.cpp b/Source/core/frame/FrameView.cpp |
index 3a1981bc031046ce0b6779f4b965aa3e0eb6b868..40b9d61616ef0fd15de70b9562194b94b88cafc8 100644 |
--- a/Source/core/frame/FrameView.cpp |
+++ b/Source/core/frame/FrameView.cpp |
@@ -133,16 +133,16 @@ FrameView::FrameView(LocalFrame* frame) |
ScrollableArea::setHorizontalScrollElasticity(ScrollElasticityAllowed); |
} |
-PassRefPtr<FrameView> FrameView::create(LocalFrame* frame) |
+PassRefPtrWillBeRawPtr<FrameView> FrameView::create(LocalFrame* frame) |
{ |
- RefPtr<FrameView> view = adoptRef(new FrameView(frame)); |
+ RefPtrWillBeRawPtr<FrameView> view = adoptRefWillBeNoop(new FrameView(frame)); |
view->show(); |
return view.release(); |
} |
-PassRefPtr<FrameView> FrameView::create(LocalFrame* frame, const IntSize& initialSize) |
+PassRefPtrWillBeRawPtr<FrameView> FrameView::create(LocalFrame* frame, const IntSize& initialSize) |
{ |
- RefPtr<FrameView> view = adoptRef(new FrameView(frame)); |
+ RefPtrWillBeRawPtr<FrameView> view = adoptRefWillBeNoop(new FrameView(frame)); |
view->Widget::setFrameRect(IntRect(view->location(), initialSize)); |
view->setLayoutSizeInternal(initialSize); |
@@ -152,6 +152,13 @@ PassRefPtr<FrameView> FrameView::create(LocalFrame* frame, const IntSize& initia |
FrameView::~FrameView() |
{ |
+#if !ENABLE(OILPAN) |
haraken
2014/09/29 14:16:35
Can we add an assertion to oilpan builds to verify
sof
2014/10/07 11:03:36
Done.
|
+ dispose(); |
+#endif |
+} |
+ |
+void FrameView::dispose() |
+{ |
if (m_postLayoutTasksTimer.isActive()) |
m_postLayoutTasksTimer.stop(); |
@@ -175,6 +182,22 @@ FrameView::~FrameView() |
HTMLFrameOwnerElement* ownerElement = m_frame->deprecatedLocalOwner(); |
if (ownerElement && ownerElement->ownedWidget() == this) |
ownerElement->setWidget(nullptr); |
+ |
+ disposeAutoSizeInfo(); |
+} |
+ |
+void FrameView::trace(Visitor* visitor) |
+{ |
+#if ENABLE(OILPAN) |
+ visitor->trace(m_widgetUpdateSet); |
+ visitor->trace(m_widgets); |
+ visitor->trace(m_frame); |
+ visitor->trace(m_nodeToDraw); |
+ visitor->trace(m_maintainScrollPositionAnchor); |
+ visitor->trace(m_scrollCorner); |
+ visitor->trace(m_autoSizeInfo); |
+#endif |
+ ScrollView::trace(visitor); |
} |
void FrameView::reset() |
@@ -405,7 +428,7 @@ bool FrameView::shouldUseCustomScrollbars(Element*& customScrollbarElement, Loca |
return false; |
} |
-PassRefPtr<Scrollbar> FrameView::createScrollbar(ScrollbarOrientation orientation) |
+PassRefPtrWillBeRawPtr<Scrollbar> FrameView::createScrollbar(ScrollbarOrientation orientation) |
{ |
Element* customScrollbarElement = 0; |
LocalFrame* customScrollbarFrame = 0; |
@@ -676,7 +699,7 @@ inline void FrameView::forceLayoutParentViewIfNeeded() |
// FrameView for a layout. After that the RenderEmbeddedObject (ownerRenderer) carries the |
// correct size, which RenderSVGRoot::computeReplacedLogicalWidth/Height rely on, when laying |
// out for the first time, or when the RenderSVGRoot size has changed dynamically (eg. via <script>). |
- RefPtr<FrameView> frameView = ownerRenderer->frame()->view(); |
+ RefPtrWillBeRawPtr<FrameView> frameView = ownerRenderer->frame()->view(); |
// Mark the owner renderer as needing layout. |
ownerRenderer->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(); |
@@ -788,7 +811,7 @@ void FrameView::layout(bool allowSubtree) |
TRACE_EVENT_SCOPED_SAMPLING_STATE("blink", "Layout"); |
// Protect the view from being deleted during layout (in recalcStyle) |
- RefPtr<FrameView> protector(this); |
+ RefPtrWillBeRawPtr<FrameView> protector(this); |
// Every scroll that happens during layout is programmatic. |
TemporaryChange<bool> changeInProgrammaticScroll(m_inProgrammaticScroll, true); |
@@ -813,10 +836,12 @@ void FrameView::layout(bool allowSubtree) |
performPreLayoutTasks(); |
+#if !ENABLE(OILPAN) |
// If there is only one ref to this view left, then its going to be destroyed as soon as we exit, |
// so there's no point to continuing to layout |
if (protector->hasOneRef()) |
return; |
+#endif |
Document* document = m_frame->document(); |
bool inSubtreeLayout = isSubtreeLayout(); |
@@ -1498,7 +1523,7 @@ void FrameView::updateLayersAndCompositingAfterScrollIfNeeded() |
if (!hasViewportConstrainedObjects()) |
return; |
- RefPtr<FrameView> protect(this); |
+ RefPtrWillBeMember<FrameView> protect(this); |
haraken
2014/09/29 14:16:36
RefPtrWillBeRawPtr
|
// If there fixed position elements, scrolling may cause compositing layers to change. |
// Update widget and layer positions after scrolling, but only if we're not inside of |
@@ -1867,7 +1892,7 @@ bool FrameView::updateWidgets() |
void FrameView::updateWidgetsTimerFired(Timer<FrameView>*) |
{ |
ASSERT(!isInPerformLayout()); |
- RefPtr<FrameView> protect(this); |
+ RefPtrWillBeRawPtr<FrameView> protect(this); |
m_updateWidgetsTimer.stop(); |
for (unsigned i = 0; i < maxUpdateWidgetsIterations; ++i) { |
if (updateWidgets()) |
@@ -1900,7 +1925,7 @@ void FrameView::performPostLayoutTasks() |
// We should ASSERT(isActive()); or at least return early if we can! |
ASSERT(!isInPerformLayout()); // Always before or after performLayout(), part of the highest-level layout() call. |
TRACE_EVENT0("blink", "FrameView::performPostLayoutTasks"); |
- RefPtr<FrameView> protect(this); |
+ RefPtrWillBeRawPtr<FrameView> protect(this); |
m_postLayoutTasksTimer.stop(); |
@@ -2347,9 +2372,9 @@ Color FrameView::documentBackgroundColor() const |
bool FrameView::hasCustomScrollbars() const |
{ |
- const HashSet<RefPtr<Widget> >* viewChildren = children(); |
- HashSet<RefPtr<Widget> >::const_iterator end = viewChildren->end(); |
- for (HashSet<RefPtr<Widget> >::const_iterator current = viewChildren->begin(); current != end; ++current) { |
+ const WillBeHeapHashSet<RefPtrWillBeMember<Widget> >* viewChildren = children(); |
+ WillBeHeapHashSet<RefPtrWillBeMember<Widget> >::const_iterator end = viewChildren->end(); |
+ for (WillBeHeapHashSet<RefPtrWillBeMember<Widget> >::const_iterator current = viewChildren->begin(); current != end; ++current) { |
Widget* widget = current->get(); |
if (widget->isFrameView()) { |
if (toFrameView(widget)->hasCustomScrollbars()) |
@@ -2526,7 +2551,7 @@ void FrameView::updateWidgetPositionsIfNeeded() |
void FrameView::updateLayoutAndStyleForPainting() |
{ |
// Updating layout can run script, which can tear down the FrameView. |
- RefPtr<FrameView> protector(this); |
+ RefPtrWillBeRawPtr<FrameView> protector(this); |
updateLayoutAndStyleIfNeededRecursive(); |
@@ -2574,7 +2599,7 @@ void FrameView::updateLayoutAndStyleIfNeededRecursive() |
// FIXME: Calling layout() shouldn't trigger scripe execution or have any |
// observable effects on the frame tree but we're not quite there yet. |
- Vector<RefPtr<FrameView> > frameViews; |
+ WillBeHeapVector<RefPtrWillBeMember<FrameView> > frameViews; |
for (Frame* child = m_frame->tree().firstChild(); child; child = child->tree().nextSibling()) { |
if (!child->isLocalFrame()) |
continue; |
@@ -2582,8 +2607,8 @@ void FrameView::updateLayoutAndStyleIfNeededRecursive() |
frameViews.append(view); |
} |
- const Vector<RefPtr<FrameView> >::iterator end = frameViews.end(); |
- for (Vector<RefPtr<FrameView> >::iterator it = frameViews.begin(); it != end; ++it) |
+ const WillBeHeapVector<RefPtrWillBeMember<FrameView> >::iterator end = frameViews.end(); |
+ for (WillBeHeapVector<RefPtrWillBeMember<FrameView> >::iterator it = frameViews.begin(); it != end; ++it) |
(*it)->updateLayoutAndStyleIfNeededRecursive(); |
// When an <iframe> gets composited, it triggers an extra style recalc in its containing FrameView. |
@@ -2621,12 +2646,34 @@ void FrameView::invalidateTreeIfNeededRecursive() |
} |
} |
+void FrameView::setLayoutSizeFixedToFrameSizeAndInvalidate(bool isFixed) |
haraken
2014/09/29 14:16:35
Sorry, I now understand that adding this helper fu
|
+{ |
+ setLayoutSizeFixedToFrameSize(isFixed); |
+ setNeedsLayout(); |
+ scheduleRelayout(); |
+} |
+ |
void FrameView::enableAutoSizeMode(const IntSize& minSize, const IntSize& maxSize) |
{ |
if (!m_autoSizeInfo) |
- m_autoSizeInfo = adoptPtr(new FrameViewAutoSizeInfo(this)); |
+ m_autoSizeInfo = FrameViewAutoSizeInfo::create(this); |
m_autoSizeInfo->configureAutoSizeMode(minSize, maxSize); |
+ setLayoutSizeFixedToFrameSizeAndInvalidate(true); |
+} |
+ |
+void FrameView::disposeAutoSizeInfo() |
+{ |
+ if (!m_autoSizeInfo) |
+ return; |
+ |
+ setLayoutSizeFixedToFrameSizeAndInvalidate(false); |
+ |
+ // Since autosize mode forces the scrollbar mode, change them to being auto. |
+ setVerticalScrollbarLock(false); |
+ setHorizontalScrollbarLock(false); |
+ setScrollbarModes(ScrollbarAuto, ScrollbarAuto); |
+ m_autoSizeInfo.clear(); |
} |
void FrameView::forceLayout(bool allowSubtree) |