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

Side by Side Diff: Source/core/frame/FrameView.cpp

Issue 603193005: Move the Widget hierarchy to the Oilpan heap. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase upto and resolve r182737 conflict. 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) 1998, 1999 Torben Weis <weis@kde.org> 2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
3 * 1999 Lars Knoll <knoll@kde.org> 3 * 1999 Lars Knoll <knoll@kde.org>
4 * 1999 Antti Koivisto <koivisto@kde.org> 4 * 1999 Antti Koivisto <koivisto@kde.org>
5 * 2000 Dirk Mueller <mueller@kde.org> 5 * 2000 Dirk Mueller <mueller@kde.org>
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
7 * (C) 2006 Graham Dennis (graham.dennis@gmail.com) 7 * (C) 2006 Graham Dennis (graham.dennis@gmail.com)
8 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) 8 * (C) 2006 Alexey Proskuryakov (ap@nypop.com)
9 * Copyright (C) 2009 Google Inc. All rights reserved. 9 * Copyright (C) 2009 Google Inc. All rights reserved.
10 * 10 *
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 ASSERT(m_frame); 126 ASSERT(m_frame);
127 init(); 127 init();
128 128
129 if (!m_frame->isMainFrame()) 129 if (!m_frame->isMainFrame())
130 return; 130 return;
131 131
132 ScrollableArea::setVerticalScrollElasticity(ScrollElasticityAllowed); 132 ScrollableArea::setVerticalScrollElasticity(ScrollElasticityAllowed);
133 ScrollableArea::setHorizontalScrollElasticity(ScrollElasticityAllowed); 133 ScrollableArea::setHorizontalScrollElasticity(ScrollElasticityAllowed);
134 } 134 }
135 135
136 PassRefPtr<FrameView> FrameView::create(LocalFrame* frame) 136 PassRefPtrWillBeRawPtr<FrameView> FrameView::create(LocalFrame* frame)
137 { 137 {
138 RefPtr<FrameView> view = adoptRef(new FrameView(frame)); 138 RefPtrWillBeRawPtr<FrameView> view = adoptRefWillBeNoop(new FrameView(frame) );
139 view->show(); 139 view->show();
140 return view.release(); 140 return view.release();
141 } 141 }
142 142
143 PassRefPtr<FrameView> FrameView::create(LocalFrame* frame, const IntSize& initia lSize) 143 PassRefPtrWillBeRawPtr<FrameView> FrameView::create(LocalFrame* frame, const Int Size& initialSize)
144 { 144 {
145 RefPtr<FrameView> view = adoptRef(new FrameView(frame)); 145 RefPtrWillBeRawPtr<FrameView> view = adoptRefWillBeNoop(new FrameView(frame) );
146 view->Widget::setFrameRect(IntRect(view->location(), initialSize)); 146 view->Widget::setFrameRect(IntRect(view->location(), initialSize));
147 view->setLayoutSizeInternal(initialSize); 147 view->setLayoutSizeInternal(initialSize);
148 148
149 view->show(); 149 view->show();
150 return view.release(); 150 return view.release();
151 } 151 }
152 152
153 FrameView::~FrameView() 153 FrameView::~FrameView()
154 { 154 {
155 #if !ENABLE(OILPAN)
156 dispose();
157 #endif
158 }
159
160 void FrameView::dispose()
161 {
155 if (m_postLayoutTasksTimer.isActive()) 162 if (m_postLayoutTasksTimer.isActive())
156 m_postLayoutTasksTimer.stop(); 163 m_postLayoutTasksTimer.stop();
157 164
158 if (m_didScrollTimer.isActive()) 165 if (m_didScrollTimer.isActive())
159 m_didScrollTimer.stop(); 166 m_didScrollTimer.stop();
160 167
161 removeFromAXObjectCache(); 168 removeFromAXObjectCache();
162 169
163 // Custom scrollbars should already be destroyed at this point 170 // Custom scrollbars should already be destroyed at this point
164 ASSERT(!horizontalScrollbar() || !horizontalScrollbar()->isCustomScrollbar() ); 171 ASSERT(!horizontalScrollbar() || !horizontalScrollbar()->isCustomScrollbar() );
165 ASSERT(!verticalScrollbar() || !verticalScrollbar()->isCustomScrollbar()); 172 ASSERT(!verticalScrollbar() || !verticalScrollbar()->isCustomScrollbar());
166 173
167 setHasHorizontalScrollbar(false); // Remove native scrollbars now before we lose the connection to the HostWindow. 174 setHasHorizontalScrollbar(false); // Remove native scrollbars now before we lose the connection to the HostWindow.
168 setHasVerticalScrollbar(false); 175 setHasVerticalScrollbar(false);
haraken 2014/09/26 09:19:25 Would you elaborate on why it's OK to remove setHa
sof 2014/09/28 08:05:52 It is not OK to have those scrollbars not do the e
169 176
170 ASSERT(!m_scrollCorner); 177 ASSERT(!m_scrollCorner);
171 178
179 // Oilpan: LocalFrame, FrameView, and HTMLFrameOwnerElement die together.
172 ASSERT(m_frame); 180 ASSERT(m_frame);
173 ASSERT(m_frame->view() != this || !m_frame->contentRenderer()); 181 ASSERT(m_frame->view() != this || !m_frame->contentRenderer());
174 // FIXME: Do we need to do something here for OOPI? 182 // FIXME: Do we need to do something here for OOPI?
175 HTMLFrameOwnerElement* ownerElement = m_frame->deprecatedLocalOwner(); 183 HTMLFrameOwnerElement* ownerElement = m_frame->deprecatedLocalOwner();
176 if (ownerElement && ownerElement->ownedWidget() == this) 184 if (ownerElement && ownerElement->ownedWidget() == this)
177 ownerElement->setWidget(nullptr); 185 ownerElement->setWidget(nullptr);
186
187 disposeAutoSizeInfo();
188 }
189
190 void FrameView::trace(Visitor* visitor)
191 {
192 #if ENABLE(OILPAN)
193 visitor->trace(m_widgetUpdateSet);
194 visitor->trace(m_widgets);
195 visitor->trace(m_frame);
196 visitor->trace(m_nodeToDraw);
197 visitor->trace(m_maintainScrollPositionAnchor);
198 visitor->trace(m_scrollCorner);
199 visitor->trace(m_autoSizeInfo);
200 #endif
201 ScrollView::trace(visitor);
178 } 202 }
179 203
180 void FrameView::reset() 204 void FrameView::reset()
181 { 205 {
182 m_hasPendingLayout = false; 206 m_hasPendingLayout = false;
183 m_layoutSubtreeRoot = 0; 207 m_layoutSubtreeRoot = 0;
184 m_doFullPaintInvalidation = false; 208 m_doFullPaintInvalidation = false;
185 m_layoutSchedulingEnabled = true; 209 m_layoutSchedulingEnabled = true;
186 m_inPerformLayout = false; 210 m_inPerformLayout = false;
187 m_canInvalidatePaintDuringPerformLayout = false; 211 m_canInvalidatePaintDuringPerformLayout = false;
(...skipping 22 matching lines...) Expand all
210 } 234 }
211 235
212 void FrameView::removeFromAXObjectCache() 236 void FrameView::removeFromAXObjectCache()
213 { 237 {
214 if (AXObjectCache* cache = axObjectCache()) { 238 if (AXObjectCache* cache = axObjectCache()) {
215 cache->remove(this); 239 cache->remove(this);
216 cache->childrenChanged(m_frame->pagePopupOwner()); 240 cache->childrenChanged(m_frame->pagePopupOwner());
217 } 241 }
218 } 242 }
219 243
244 void FrameView::disposeAutoSizeInfo()
245 {
246 if (!m_autoSizeInfo)
247 return;
248
249 setLayoutSizeFixedToFrameSize(false);
250 setNeedsLayout();
251 scheduleRelayout();
252
253 // Since autosize mode forces the scrollbar mode, change them to being auto.
254 setVerticalScrollbarLock(false);
255 setHorizontalScrollbarLock(false);
256 setScrollbarModes(ScrollbarAuto, ScrollbarAuto);
haraken 2014/09/26 09:19:25 Can we share this code with enabledAutoSizeMode()
sof 2014/09/28 15:11:25 Not sure I fully understand the suggestion, but sh
257 m_autoSizeInfo.clear();
258 }
259
220 void FrameView::init() 260 void FrameView::init()
221 { 261 {
222 reset(); 262 reset();
223 263
224 m_size = LayoutSize(); 264 m_size = LayoutSize();
225 265
226 // Propagate the marginwidth/height and scrolling modes to the view. 266 // Propagate the marginwidth/height and scrolling modes to the view.
227 // FIXME: Do we need to do this for OOPI? 267 // FIXME: Do we need to do this for OOPI?
228 Element* ownerElement = m_frame->deprecatedLocalOwner(); 268 Element* ownerElement = m_frame->deprecatedLocalOwner();
229 if (ownerElement && (isHTMLFrameElement(*ownerElement) || isHTMLIFrameElemen t(*ownerElement))) { 269 if (ownerElement && (isHTMLFrameElement(*ownerElement) || isHTMLIFrameElemen t(*ownerElement))) {
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 // If we have an owning ipage/LocalFrame element, then it can set the custom scrollbar also. 438 // If we have an owning ipage/LocalFrame element, then it can set the custom scrollbar also.
399 RenderPart* frameRenderer = m_frame->ownerRenderer(); 439 RenderPart* frameRenderer = m_frame->ownerRenderer();
400 if (frameRenderer && frameRenderer->style()->hasPseudoStyle(SCROLLBAR)) { 440 if (frameRenderer && frameRenderer->style()->hasPseudoStyle(SCROLLBAR)) {
401 customScrollbarFrame = m_frame.get(); 441 customScrollbarFrame = m_frame.get();
402 return true; 442 return true;
403 } 443 }
404 444
405 return false; 445 return false;
406 } 446 }
407 447
408 PassRefPtr<Scrollbar> FrameView::createScrollbar(ScrollbarOrientation orientatio n) 448 PassRefPtrWillBeRawPtr<Scrollbar> FrameView::createScrollbar(ScrollbarOrientatio n orientation)
409 { 449 {
410 Element* customScrollbarElement = 0; 450 Element* customScrollbarElement = 0;
411 LocalFrame* customScrollbarFrame = 0; 451 LocalFrame* customScrollbarFrame = 0;
412 if (shouldUseCustomScrollbars(customScrollbarElement, customScrollbarFrame)) 452 if (shouldUseCustomScrollbars(customScrollbarElement, customScrollbarFrame))
413 return RenderScrollbar::createCustomScrollbar(this, orientation, customS crollbarElement, customScrollbarFrame); 453 return RenderScrollbar::createCustomScrollbar(this, orientation, customS crollbarElement, customScrollbarFrame);
414 454
415 // Nobody set a custom style, so we just use a native scrollbar. 455 // Nobody set a custom style, so we just use a native scrollbar.
416 return ScrollView::createScrollbar(orientation); 456 return ScrollView::createScrollbar(orientation);
417 } 457 }
418 458
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
669 if (svgRoot->everHadLayout() && !svgRoot->needsLayout()) 709 if (svgRoot->everHadLayout() && !svgRoot->needsLayout())
670 return; 710 return;
671 711
672 // If the embedded SVG document appears the first time, the ownerRenderer ha s already finished 712 // If the embedded SVG document appears the first time, the ownerRenderer ha s already finished
673 // layout without knowing about the existence of the embedded SVG document, because RenderReplaced 713 // layout without knowing about the existence of the embedded SVG document, because RenderReplaced
674 // embeddedContentBox() returns 0, as long as the embedded document isn't lo aded yet. Before 714 // embeddedContentBox() returns 0, as long as the embedded document isn't lo aded yet. Before
675 // bothering to lay out the SVG document, mark the ownerRenderer needing lay out and ask its 715 // bothering to lay out the SVG document, mark the ownerRenderer needing lay out and ask its
676 // FrameView for a layout. After that the RenderEmbeddedObject (ownerRendere r) carries the 716 // FrameView for a layout. After that the RenderEmbeddedObject (ownerRendere r) carries the
677 // correct size, which RenderSVGRoot::computeReplacedLogicalWidth/Height rel y on, when laying 717 // correct size, which RenderSVGRoot::computeReplacedLogicalWidth/Height rel y on, when laying
678 // out for the first time, or when the RenderSVGRoot size has changed dynami cally (eg. via <script>). 718 // out for the first time, or when the RenderSVGRoot size has changed dynami cally (eg. via <script>).
679 RefPtr<FrameView> frameView = ownerRenderer->frame()->view(); 719 RefPtrWillBeRawPtr<FrameView> frameView = ownerRenderer->frame()->view();
680 720
681 // Mark the owner renderer as needing layout. 721 // Mark the owner renderer as needing layout.
682 ownerRenderer->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(); 722 ownerRenderer->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation();
683 723
684 // Synchronously enter layout, to layout the view containing the host object /embed/iframe. 724 // Synchronously enter layout, to layout the view containing the host object /embed/iframe.
685 ASSERT(frameView); 725 ASSERT(frameView);
686 frameView->layout(); 726 frameView->layout();
687 } 727 }
688 728
689 void FrameView::performPreLayoutTasks() 729 void FrameView::performPreLayoutTasks()
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
781 821
782 ScriptForbiddenScope forbidScript; 822 ScriptForbiddenScope forbidScript;
783 823
784 if (isInPerformLayout() || !m_frame->document()->isActive()) 824 if (isInPerformLayout() || !m_frame->document()->isActive())
785 return; 825 return;
786 826
787 TRACE_EVENT0("blink", "FrameView::layout"); 827 TRACE_EVENT0("blink", "FrameView::layout");
788 TRACE_EVENT_SCOPED_SAMPLING_STATE("blink", "Layout"); 828 TRACE_EVENT_SCOPED_SAMPLING_STATE("blink", "Layout");
789 829
790 // Protect the view from being deleted during layout (in recalcStyle) 830 // Protect the view from being deleted during layout (in recalcStyle)
791 RefPtr<FrameView> protector(this); 831 RefPtrWillBeRawPtr<FrameView> protector(this);
792 832
793 // Every scroll that happens during layout is programmatic. 833 // Every scroll that happens during layout is programmatic.
794 TemporaryChange<bool> changeInProgrammaticScroll(m_inProgrammaticScroll, tru e); 834 TemporaryChange<bool> changeInProgrammaticScroll(m_inProgrammaticScroll, tru e);
795 835
796 if (m_autoSizeInfo) 836 if (m_autoSizeInfo)
797 m_autoSizeInfo->autoSizeIfNeeded(); 837 m_autoSizeInfo->autoSizeIfNeeded();
798 838
799 m_hasPendingLayout = false; 839 m_hasPendingLayout = false;
800 DocumentLifecycle::Scope lifecycleScope(lifecycle(), DocumentLifecycle::Layo utClean); 840 DocumentLifecycle::Scope lifecycleScope(lifecycle(), DocumentLifecycle::Layo utClean);
801 841
802 RELEASE_ASSERT(!isPainting()); 842 RELEASE_ASSERT(!isPainting());
803 843
804 TRACE_EVENT_BEGIN1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Layout", "beginData", InspectorLayoutEvent::beginData(this)); 844 TRACE_EVENT_BEGIN1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Layout", "beginData", InspectorLayoutEvent::beginData(this));
805 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.stack"), " CallStack", "stack", InspectorCallStackEvent::currentCallStack()); 845 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.stack"), " CallStack", "stack", InspectorCallStackEvent::currentCallStack());
806 // FIXME(361045): remove InspectorInstrumentation calls once DevTools Timeli ne migrates to tracing. 846 // FIXME(361045): remove InspectorInstrumentation calls once DevTools Timeli ne migrates to tracing.
807 InspectorInstrumentationCookie cookie = InspectorInstrumentation::willLayout (m_frame.get()); 847 InspectorInstrumentationCookie cookie = InspectorInstrumentation::willLayout (m_frame.get());
808 848
809 if (!allowSubtree && isSubtreeLayout()) { 849 if (!allowSubtree && isSubtreeLayout()) {
810 m_layoutSubtreeRoot->markContainingBlocksForLayout(false); 850 m_layoutSubtreeRoot->markContainingBlocksForLayout(false);
811 m_layoutSubtreeRoot = 0; 851 m_layoutSubtreeRoot = 0;
812 } 852 }
813 853
814 performPreLayoutTasks(); 854 performPreLayoutTasks();
815 855
856 #if !ENABLE(OILPAN)
816 // If there is only one ref to this view left, then its going to be destroye d as soon as we exit, 857 // If there is only one ref to this view left, then its going to be destroye d as soon as we exit,
817 // so there's no point to continuing to layout 858 // so there's no point to continuing to layout
818 if (protector->hasOneRef()) 859 if (protector->hasOneRef())
819 return; 860 return;
861 #endif
820 862
821 Document* document = m_frame->document(); 863 Document* document = m_frame->document();
822 bool inSubtreeLayout = isSubtreeLayout(); 864 bool inSubtreeLayout = isSubtreeLayout();
823 RenderObject* rootForThisLayout = inSubtreeLayout ? m_layoutSubtreeRoot : do cument->renderView(); 865 RenderObject* rootForThisLayout = inSubtreeLayout ? m_layoutSubtreeRoot : do cument->renderView();
824 if (!rootForThisLayout) { 866 if (!rootForThisLayout) {
825 // FIXME: Do we need to set m_size here? 867 // FIXME: Do we need to set m_size here?
826 ASSERT_NOT_REACHED(); 868 ASSERT_NOT_REACHED();
827 return; 869 return;
828 } 870 }
829 871
(...skipping 661 matching lines...) Expand 10 before | Expand all | Expand 10 after
1491 ResourceLoadPriorityOptimizer::resourceLoadPriorityOptimizer()->updateAl lImageResourcePriorities(); 1533 ResourceLoadPriorityOptimizer::resourceLoadPriorityOptimizer()->updateAl lImageResourcePriorities();
1492 } 1534 }
1493 } 1535 }
1494 1536
1495 void FrameView::updateLayersAndCompositingAfterScrollIfNeeded() 1537 void FrameView::updateLayersAndCompositingAfterScrollIfNeeded()
1496 { 1538 {
1497 // Nothing to do after scrolling if there are no fixed position elements. 1539 // Nothing to do after scrolling if there are no fixed position elements.
1498 if (!hasViewportConstrainedObjects()) 1540 if (!hasViewportConstrainedObjects())
1499 return; 1541 return;
1500 1542
1501 RefPtr<FrameView> protect(this); 1543 RefPtrWillBeMember<FrameView> protect(this);
1502 1544
1503 // If there fixed position elements, scrolling may cause compositing layers to change. 1545 // If there fixed position elements, scrolling may cause compositing layers to change.
1504 // Update widget and layer positions after scrolling, but only if we're not inside of 1546 // Update widget and layer positions after scrolling, but only if we're not inside of
1505 // layout. 1547 // layout.
1506 if (!m_nestedLayoutCount) { 1548 if (!m_nestedLayoutCount) {
1507 updateWidgetPositions(); 1549 updateWidgetPositions();
1508 if (RenderView* renderView = this->renderView()) 1550 if (RenderView* renderView = this->renderView())
1509 renderView->layer()->setNeedsCompositingInputsUpdate(); 1551 renderView->layer()->setNeedsCompositingInputsUpdate();
1510 } 1552 }
1511 } 1553 }
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
1860 // FIXME: Do we really need to prevent this? 1902 // FIXME: Do we really need to prevent this?
1861 m_widgetUpdateSet.remove(&object); 1903 m_widgetUpdateSet.remove(&object);
1862 } 1904 }
1863 1905
1864 return m_widgetUpdateSet.isEmpty(); 1906 return m_widgetUpdateSet.isEmpty();
1865 } 1907 }
1866 1908
1867 void FrameView::updateWidgetsTimerFired(Timer<FrameView>*) 1909 void FrameView::updateWidgetsTimerFired(Timer<FrameView>*)
1868 { 1910 {
1869 ASSERT(!isInPerformLayout()); 1911 ASSERT(!isInPerformLayout());
1870 RefPtr<FrameView> protect(this); 1912 RefPtrWillBeRawPtr<FrameView> protect(this);
1871 m_updateWidgetsTimer.stop(); 1913 m_updateWidgetsTimer.stop();
1872 for (unsigned i = 0; i < maxUpdateWidgetsIterations; ++i) { 1914 for (unsigned i = 0; i < maxUpdateWidgetsIterations; ++i) {
1873 if (updateWidgets()) 1915 if (updateWidgets())
1874 return; 1916 return;
1875 } 1917 }
1876 } 1918 }
1877 1919
1878 void FrameView::flushAnyPendingPostLayoutTasks() 1920 void FrameView::flushAnyPendingPostLayoutTasks()
1879 { 1921 {
1880 ASSERT(!isInPerformLayout()); 1922 ASSERT(!isInPerformLayout());
(...skipping 12 matching lines...) Expand all
1893 } 1935 }
1894 1936
1895 void FrameView::performPostLayoutTasks() 1937 void FrameView::performPostLayoutTasks()
1896 { 1938 {
1897 // FIXME: We can reach here, even when the page is not active! 1939 // FIXME: We can reach here, even when the page is not active!
1898 // http/tests/inspector/elements/html-link-import.html and many other 1940 // http/tests/inspector/elements/html-link-import.html and many other
1899 // tests hit that case. 1941 // tests hit that case.
1900 // We should ASSERT(isActive()); or at least return early if we can! 1942 // We should ASSERT(isActive()); or at least return early if we can!
1901 ASSERT(!isInPerformLayout()); // Always before or after performLayout(), par t of the highest-level layout() call. 1943 ASSERT(!isInPerformLayout()); // Always before or after performLayout(), par t of the highest-level layout() call.
1902 TRACE_EVENT0("blink", "FrameView::performPostLayoutTasks"); 1944 TRACE_EVENT0("blink", "FrameView::performPostLayoutTasks");
1903 RefPtr<FrameView> protect(this); 1945 RefPtrWillBeRawPtr<FrameView> protect(this);
1904 1946
1905 m_postLayoutTasksTimer.stop(); 1947 m_postLayoutTasksTimer.stop();
1906 1948
1907 m_frame->selection().setCaretRectNeedsUpdate(); 1949 m_frame->selection().setCaretRectNeedsUpdate();
1908 1950
1909 { 1951 {
1910 // Hits in compositing/overflow/do-not-repaint-if-scrolling-composited-l ayers.html 1952 // Hits in compositing/overflow/do-not-repaint-if-scrolling-composited-l ayers.html
1911 DisableCompositingQueryAsserts disabler; 1953 DisableCompositingQueryAsserts disabler;
1912 m_frame->selection().updateAppearance(); 1954 m_frame->selection().updateAppearance();
1913 } 1955 }
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after
2340 if (htmlElement && htmlElement->renderer()) 2382 if (htmlElement && htmlElement->renderer())
2341 result = result.blend(htmlElement->renderer()->style()->visitedDependent Color(CSSPropertyBackgroundColor)); 2383 result = result.blend(htmlElement->renderer()->style()->visitedDependent Color(CSSPropertyBackgroundColor));
2342 if (bodyElement && bodyElement->renderer()) 2384 if (bodyElement && bodyElement->renderer())
2343 result = result.blend(bodyElement->renderer()->style()->visitedDependent Color(CSSPropertyBackgroundColor)); 2385 result = result.blend(bodyElement->renderer()->style()->visitedDependent Color(CSSPropertyBackgroundColor));
2344 2386
2345 return result; 2387 return result;
2346 } 2388 }
2347 2389
2348 bool FrameView::hasCustomScrollbars() const 2390 bool FrameView::hasCustomScrollbars() const
2349 { 2391 {
2350 const HashSet<RefPtr<Widget> >* viewChildren = children(); 2392 const WillBeHeapHashSet<RefPtrWillBeMember<Widget> >* viewChildren = childre n();
2351 HashSet<RefPtr<Widget> >::const_iterator end = viewChildren->end(); 2393 WillBeHeapHashSet<RefPtrWillBeMember<Widget> >::const_iterator end = viewChi ldren->end();
2352 for (HashSet<RefPtr<Widget> >::const_iterator current = viewChildren->begin( ); current != end; ++current) { 2394 for (WillBeHeapHashSet<RefPtrWillBeMember<Widget> >::const_iterator current = viewChildren->begin(); current != end; ++current) {
2353 Widget* widget = current->get(); 2395 Widget* widget = current->get();
2354 if (widget->isFrameView()) { 2396 if (widget->isFrameView()) {
2355 if (toFrameView(widget)->hasCustomScrollbars()) 2397 if (toFrameView(widget)->hasCustomScrollbars())
2356 return true; 2398 return true;
2357 } else if (widget->isScrollbar()) { 2399 } else if (widget->isScrollbar()) {
2358 Scrollbar* scrollbar = static_cast<Scrollbar*>(widget); 2400 Scrollbar* scrollbar = static_cast<Scrollbar*>(widget);
2359 if (scrollbar->isCustomScrollbar()) 2401 if (scrollbar->isCustomScrollbar())
2360 return true; 2402 return true;
2361 } 2403 }
2362 } 2404 }
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
2519 return; 2561 return;
2520 2562
2521 m_needsUpdateWidgetPositions = false; 2563 m_needsUpdateWidgetPositions = false;
2522 2564
2523 updateWidgetPositions(); 2565 updateWidgetPositions();
2524 } 2566 }
2525 2567
2526 void FrameView::updateLayoutAndStyleForPainting() 2568 void FrameView::updateLayoutAndStyleForPainting()
2527 { 2569 {
2528 // Updating layout can run script, which can tear down the FrameView. 2570 // Updating layout can run script, which can tear down the FrameView.
2529 RefPtr<FrameView> protector(this); 2571 RefPtrWillBeRawPtr<FrameView> protector(this);
2530 2572
2531 updateLayoutAndStyleIfNeededRecursive(); 2573 updateLayoutAndStyleIfNeededRecursive();
2532 2574
2533 updateWidgetPositionsIfNeeded(); 2575 updateWidgetPositionsIfNeeded();
2534 2576
2535 RenderView* view = renderView(); 2577 RenderView* view = renderView();
2536 if (view) { 2578 if (view) {
2537 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Up dateLayerTree", "frame", m_frame.get()); 2579 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Up dateLayerTree", "frame", m_frame.get());
2538 // FIXME(361045): remove InspectorInstrumentation calls once DevTools Ti meline migrates to tracing. 2580 // FIXME(361045): remove InspectorInstrumentation calls once DevTools Ti meline migrates to tracing.
2539 InspectorInstrumentation::willUpdateLayerTree(m_frame.get()); 2581 InspectorInstrumentation::willUpdateLayerTree(m_frame.get());
(...skipping 27 matching lines...) Expand all
2567 // region but then become included later by the second frame adding rects to the dirty region 2609 // region but then become included later by the second frame adding rects to the dirty region
2568 // when it lays out. 2610 // when it lays out.
2569 2611
2570 m_frame->document()->updateRenderTreeIfNeeded(); 2612 m_frame->document()->updateRenderTreeIfNeeded();
2571 2613
2572 if (needsLayout()) 2614 if (needsLayout())
2573 layout(); 2615 layout();
2574 2616
2575 // FIXME: Calling layout() shouldn't trigger scripe execution or have any 2617 // FIXME: Calling layout() shouldn't trigger scripe execution or have any
2576 // observable effects on the frame tree but we're not quite there yet. 2618 // observable effects on the frame tree but we're not quite there yet.
2577 Vector<RefPtr<FrameView> > frameViews; 2619 WillBeHeapVector<RefPtrWillBeMember<FrameView> > frameViews;
2578 for (Frame* child = m_frame->tree().firstChild(); child; child = child->tree ().nextSibling()) { 2620 for (Frame* child = m_frame->tree().firstChild(); child; child = child->tree ().nextSibling()) {
2579 if (!child->isLocalFrame()) 2621 if (!child->isLocalFrame())
2580 continue; 2622 continue;
2581 if (FrameView* view = toLocalFrame(child)->view()) 2623 if (FrameView* view = toLocalFrame(child)->view())
2582 frameViews.append(view); 2624 frameViews.append(view);
2583 } 2625 }
2584 2626
2585 const Vector<RefPtr<FrameView> >::iterator end = frameViews.end(); 2627 const WillBeHeapVector<RefPtrWillBeMember<FrameView> >::iterator end = frame Views.end();
2586 for (Vector<RefPtr<FrameView> >::iterator it = frameViews.begin(); it != end ; ++it) 2628 for (WillBeHeapVector<RefPtrWillBeMember<FrameView> >::iterator it = frameVi ews.begin(); it != end; ++it)
2587 (*it)->updateLayoutAndStyleIfNeededRecursive(); 2629 (*it)->updateLayoutAndStyleIfNeededRecursive();
2588 2630
2589 // When an <iframe> gets composited, it triggers an extra style recalc in it s containing FrameView. 2631 // When an <iframe> gets composited, it triggers an extra style recalc in it s containing FrameView.
2590 // To avoid pushing an invalid tree for display, we have to check for this c ase and do another 2632 // To avoid pushing an invalid tree for display, we have to check for this c ase and do another
2591 // style recalc. The extra style recalc needs to happen after our child <ifr ames> were updated. 2633 // style recalc. The extra style recalc needs to happen after our child <ifr ames> were updated.
2592 // FIXME: We shouldn't be triggering an extra style recalc in the first plac e. 2634 // FIXME: We shouldn't be triggering an extra style recalc in the first plac e.
2593 if (m_frame->document()->hasSVGFilterElementsRequiringLayerUpdate()) { 2635 if (m_frame->document()->hasSVGFilterElementsRequiringLayerUpdate()) {
2594 m_frame->document()->updateRenderTreeIfNeeded(); 2636 m_frame->document()->updateRenderTreeIfNeeded();
2595 2637
2596 if (needsLayout()) 2638 if (needsLayout())
(...skipping 20 matching lines...) Expand all
2617 if (!child->isLocalFrame()) 2659 if (!child->isLocalFrame())
2618 continue; 2660 continue;
2619 2661
2620 toLocalFrame(child)->view()->invalidateTreeIfNeededRecursive(); 2662 toLocalFrame(child)->view()->invalidateTreeIfNeededRecursive();
2621 } 2663 }
2622 } 2664 }
2623 2665
2624 void FrameView::enableAutoSizeMode(const IntSize& minSize, const IntSize& maxSiz e) 2666 void FrameView::enableAutoSizeMode(const IntSize& minSize, const IntSize& maxSiz e)
2625 { 2667 {
2626 if (!m_autoSizeInfo) 2668 if (!m_autoSizeInfo)
2627 m_autoSizeInfo = adoptPtr(new FrameViewAutoSizeInfo(this)); 2669 m_autoSizeInfo = FrameViewAutoSizeInfo::create(this);
2628 2670
2629 m_autoSizeInfo->configureAutoSizeMode(minSize, maxSize); 2671 m_autoSizeInfo->configureAutoSizeMode(minSize, maxSize);
2630 } 2672 }
2631 2673
2632 void FrameView::forceLayout(bool allowSubtree) 2674 void FrameView::forceLayout(bool allowSubtree)
2633 { 2675 {
2634 layout(allowSubtree); 2676 layout(allowSubtree);
2635 } 2677 }
2636 2678
2637 void FrameView::forceLayoutForPagination(const FloatSize& pageSize, const FloatS ize& originalPageSize, float maximumShrinkFactor) 2679 void FrameView::forceLayoutForPagination(const FloatSize& pageSize, const FloatS ize& originalPageSize, float maximumShrinkFactor)
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after
3019 IntSize visibleSize = expandedIntSize(visibleContentSizeF); 3061 IntSize visibleSize = expandedIntSize(visibleContentSizeF);
3020 3062
3021 IntPoint maximumOffset( 3063 IntPoint maximumOffset(
3022 contentsWidth() - visibleSize.width() - scrollOrigin().x(), 3064 contentsWidth() - visibleSize.width() - scrollOrigin().x(),
3023 contentsHeight() - visibleSize.height() - scrollOrigin().y()); 3065 contentsHeight() - visibleSize.height() - scrollOrigin().y());
3024 maximumOffset.clampNegativeToZero(); 3066 maximumOffset.clampNegativeToZero();
3025 return maximumOffset; 3067 return maximumOffset;
3026 } 3068 }
3027 3069
3028 } // namespace blink 3070 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698