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

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

Issue 317493002: Change FrameTree to return Frames instead of LocalFrames. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Clearing RemoteFrameView from FrameTree destructor Created 6 years, 6 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 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 { 368 {
369 IntRect oldRect = frameRect(); 369 IntRect oldRect = frameRect();
370 if (newRect == oldRect) 370 if (newRect == oldRect)
371 return; 371 return;
372 372
373 // Autosized font sizes depend on the width of the viewing area. 373 // Autosized font sizes depend on the width of the viewing area.
374 bool autosizerNeedsUpdating = false; 374 bool autosizerNeedsUpdating = false;
375 if (newRect.width() != oldRect.width()) { 375 if (newRect.width() != oldRect.width()) {
376 if (m_frame->isMainFrame() && m_frame->settings()->textAutosizingEnabled ()) { 376 if (m_frame->isMainFrame() && m_frame->settings()->textAutosizingEnabled ()) {
377 autosizerNeedsUpdating = true; 377 autosizerNeedsUpdating = true;
378 for (LocalFrame* frame = m_frame.get(); frame; frame = frame->tree() .traverseNext()) { 378 for (Frame* frame = m_frame.get(); frame; frame = frame->tree().trav erseNext()) {
379 if (TextAutosizer* textAutosizer = frame->document()->textAutosi zer()) 379 if (!frame->isLocalFrame())
380 continue;
381 if (TextAutosizer* textAutosizer = toLocalFrame(frame)->document ()->textAutosizer())
380 textAutosizer->recalculateMultipliers(); 382 textAutosizer->recalculateMultipliers();
381 } 383 }
382 } 384 }
383 } 385 }
384 386
385 ScrollView::setFrameRect(newRect); 387 ScrollView::setFrameRect(newRect);
386 388
387 updateScrollableAreaSet(); 389 updateScrollableAreaSet();
388 390
389 if (autosizerNeedsUpdating) { 391 if (autosizerNeedsUpdating) {
(...skipping 959 matching lines...) Expand 10 before | Expand all | Expand 10 after
1349 bool FrameView::shouldSetCursor() const 1351 bool FrameView::shouldSetCursor() const
1350 { 1352 {
1351 Page* page = frame().page(); 1353 Page* page = frame().page();
1352 return page && page->visibilityState() != PageVisibilityStateHidden && page- >focusController().isActive() && page->settings().deviceSupportsMouse(); 1354 return page && page->visibilityState() != PageVisibilityStateHidden && page- >focusController().isActive() && page->settings().deviceSupportsMouse();
1353 } 1355 }
1354 1356
1355 void FrameView::scrollContentsIfNeededRecursive() 1357 void FrameView::scrollContentsIfNeededRecursive()
1356 { 1358 {
1357 scrollContentsIfNeeded(); 1359 scrollContentsIfNeeded();
1358 1360
1359 for (LocalFrame* child = m_frame->tree().firstChild(); child; child = child- >tree().nextSibling()) { 1361 for (Frame* child = m_frame->tree().firstChild(); child; child = child->tree ().nextSibling()) {
1360 if (FrameView* view = child->view()) 1362 if (!child->isLocalFrame())
1363 continue;
1364 if (FrameView* view = toLocalFrame(child)->view())
1361 view->scrollContentsIfNeededRecursive(); 1365 view->scrollContentsIfNeededRecursive();
1362 } 1366 }
1363 } 1367 }
1364 1368
1365 void FrameView::scrollContentsIfNeeded() 1369 void FrameView::scrollContentsIfNeeded()
1366 { 1370 {
1367 bool didScroll = !pendingScrollDelta().isZero(); 1371 bool didScroll = !pendingScrollDelta().isZero();
1368 ScrollView::scrollContentsIfNeeded(); 1372 ScrollView::scrollContentsIfNeeded();
1369 if (didScroll) 1373 if (didScroll)
1370 updateFixedElementPaintInvalidationRectsAfterScroll(); 1374 updateFixedElementPaintInvalidationRectsAfterScroll();
(...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after
1949 CompositedLayerMappingPtr compositedLayerMapping = renderView()->layer() ->compositedLayerMapping(); 1953 CompositedLayerMappingPtr compositedLayerMapping = renderView()->layer() ->compositedLayerMapping();
1950 compositedLayerMapping->updateContentsOpaque(); 1954 compositedLayerMapping->updateContentsOpaque();
1951 if (compositedLayerMapping->mainGraphicsLayer()) 1955 if (compositedLayerMapping->mainGraphicsLayer())
1952 compositedLayerMapping->mainGraphicsLayer()->setNeedsDisplay(); 1956 compositedLayerMapping->mainGraphicsLayer()->setNeedsDisplay();
1953 } 1957 }
1954 recalculateScrollbarOverlayStyle(); 1958 recalculateScrollbarOverlayStyle();
1955 } 1959 }
1956 1960
1957 void FrameView::updateBackgroundRecursively(const Color& backgroundColor, bool t ransparent) 1961 void FrameView::updateBackgroundRecursively(const Color& backgroundColor, bool t ransparent)
1958 { 1962 {
1959 for (LocalFrame* frame = m_frame.get(); frame; frame = frame->tree().travers eNext(m_frame.get())) { 1963 for (Frame* frame = m_frame.get(); frame; frame = frame->tree().traverseNext (m_frame.get())) {
1960 if (FrameView* view = frame->view()) { 1964 if (!frame->isLocalFrame())
1965 continue;
1966 if (FrameView* view = toLocalFrame(frame)->view()) {
1961 view->setTransparent(transparent); 1967 view->setTransparent(transparent);
1962 view->setBaseBackgroundColor(backgroundColor); 1968 view->setBaseBackgroundColor(backgroundColor);
1963 } 1969 }
1964 } 1970 }
1965 } 1971 }
1966 1972
1967 void FrameView::scrollToAnchor() 1973 void FrameView::scrollToAnchor()
1968 { 1974 {
1969 RefPtrWillBeRawPtr<Node> anchorNode = m_maintainScrollPositionAnchor; 1975 RefPtrWillBeRawPtr<Node> anchorNode = m_maintainScrollPositionAnchor;
1970 if (!anchorNode) 1976 if (!anchorNode)
(...skipping 666 matching lines...) Expand 10 before | Expand all | Expand 10 after
2637 } 2643 }
2638 2644
2639 return false; 2645 return false;
2640 } 2646 }
2641 2647
2642 FrameView* FrameView::parentFrameView() const 2648 FrameView* FrameView::parentFrameView() const
2643 { 2649 {
2644 if (!parent()) 2650 if (!parent())
2645 return 0; 2651 return 0;
2646 2652
2647 if (LocalFrame* parentFrame = m_frame->tree().parent()) 2653 Frame* parentFrame = m_frame->tree().parent();
2648 return parentFrame->view(); 2654 if (parentFrame && parentFrame->isLocalFrame())
2655 return toLocalFrame(parentFrame)->view();
2649 2656
2650 return 0; 2657 return 0;
2651 } 2658 }
2652 2659
2653 void FrameView::updateControlTints() 2660 void FrameView::updateControlTints()
2654 { 2661 {
2655 // This is called when control tints are changed from aqua/graphite to clear and vice versa. 2662 // This is called when control tints are changed from aqua/graphite to clear and vice versa.
2656 // We do a "fake" paint, and when the theme gets a paint call, it can then d o an invalidate. 2663 // We do a "fake" paint, and when the theme gets a paint call, it can then d o an invalidate.
2657 // This is only done if the theme supports control tinting. It's up to the t heme and platform 2664 // This is only done if the theme supports control tinting. It's up to the t heme and platform
2658 // to define when controls get the tint and to call this function when that changes. 2665 // to define when controls get the tint and to call this function when that changes.
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
2845 // when it lays out. 2852 // when it lays out.
2846 2853
2847 m_frame->document()->updateRenderTreeIfNeeded(); 2854 m_frame->document()->updateRenderTreeIfNeeded();
2848 2855
2849 if (needsLayout()) 2856 if (needsLayout())
2850 layout(); 2857 layout();
2851 2858
2852 // FIXME: Calling layout() shouldn't trigger scripe execution or have any 2859 // FIXME: Calling layout() shouldn't trigger scripe execution or have any
2853 // observable effects on the frame tree but we're not quite there yet. 2860 // observable effects on the frame tree but we're not quite there yet.
2854 Vector<RefPtr<FrameView> > frameViews; 2861 Vector<RefPtr<FrameView> > frameViews;
2855 for (LocalFrame* child = m_frame->tree().firstChild(); child; child = child- >tree().nextSibling()) { 2862 for (Frame* child = m_frame->tree().firstChild(); child; child = child->tree ().nextSibling()) {
2856 if (FrameView* view = child->view()) 2863 if (!child->isLocalFrame())
2864 continue;
2865 if (FrameView* view = toLocalFrame(child)->view())
2857 frameViews.append(view); 2866 frameViews.append(view);
2858 } 2867 }
2859 2868
2860 const Vector<RefPtr<FrameView> >::iterator end = frameViews.end(); 2869 const Vector<RefPtr<FrameView> >::iterator end = frameViews.end();
2861 for (Vector<RefPtr<FrameView> >::iterator it = frameViews.begin(); it != end ; ++it) 2870 for (Vector<RefPtr<FrameView> >::iterator it = frameViews.begin(); it != end ; ++it)
2862 (*it)->updateLayoutAndStyleIfNeededRecursive(); 2871 (*it)->updateLayoutAndStyleIfNeededRecursive();
2863 2872
2864 // When an <iframe> gets composited, it triggers an extra style recalc in it s containing FrameView. 2873 // When an <iframe> gets composited, it triggers an extra style recalc in it s containing FrameView.
2865 // To avoid pushing an invalid tree for display, we have to check for this c ase and do another 2874 // To avoid pushing an invalid tree for display, we have to check for this c ase and do another
2866 // style recalc. The extra style recalc needs to happen after our child <ifr ames> were updated. 2875 // style recalc. The extra style recalc needs to happen after our child <ifr ames> were updated.
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
3103 } 3112 }
3104 3113
3105 return parentPoint; 3114 return parentPoint;
3106 } 3115 }
3107 3116
3108 void FrameView::setTracksPaintInvalidations(bool trackPaintInvalidations) 3117 void FrameView::setTracksPaintInvalidations(bool trackPaintInvalidations)
3109 { 3118 {
3110 if (trackPaintInvalidations == m_isTrackingPaintInvalidations) 3119 if (trackPaintInvalidations == m_isTrackingPaintInvalidations)
3111 return; 3120 return;
3112 3121
3113 for (LocalFrame* frame = m_frame->tree().top(); frame; frame = frame->tree() .traverseNext()) { 3122 for (Frame* frame = m_frame->tree().top(); frame; frame = frame->tree().trav erseNext()) {
3114 if (RenderView* renderView = frame->contentRenderer()) 3123 if (!frame->isLocalFrame())
3124 continue;
3125 if (RenderView* renderView = toLocalFrame(frame)->contentRenderer())
3115 renderView->compositor()->setTracksRepaints(trackPaintInvalidations) ; 3126 renderView->compositor()->setTracksRepaints(trackPaintInvalidations) ;
3116 } 3127 }
3117 3128
3118 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("blink.invalidation"), 3129 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("blink.invalidation"),
3119 "FrameView::setTracksPaintInvalidations", "enabled", trackPaintInvalidat ions); 3130 "FrameView::setTracksPaintInvalidations", "enabled", trackPaintInvalidat ions);
3120 3131
3121 resetTrackedPaintInvalidations(); 3132 resetTrackedPaintInvalidations();
3122 m_isTrackingPaintInvalidations = trackPaintInvalidations; 3133 m_isTrackingPaintInvalidations = trackPaintInvalidations;
3123 } 3134 }
3124 3135
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
3263 void FrameView::willRemoveScrollbar(Scrollbar* scrollbar, ScrollbarOrientation o rientation) 3274 void FrameView::willRemoveScrollbar(Scrollbar* scrollbar, ScrollbarOrientation o rientation)
3264 { 3275 {
3265 ScrollableArea::willRemoveScrollbar(scrollbar, orientation); 3276 ScrollableArea::willRemoveScrollbar(scrollbar, orientation);
3266 if (AXObjectCache* cache = axObjectCache()) { 3277 if (AXObjectCache* cache = axObjectCache()) {
3267 cache->remove(scrollbar); 3278 cache->remove(scrollbar);
3268 cache->handleScrollbarUpdate(this); 3279 cache->handleScrollbarUpdate(this);
3269 } 3280 }
3270 } 3281 }
3271 3282
3272 } // namespace WebCore 3283 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698