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

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: Fixed conflicts 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 967 matching lines...) Expand 10 before | Expand all | Expand 10 after
1357 bool FrameView::shouldSetCursor() const 1359 bool FrameView::shouldSetCursor() const
1358 { 1360 {
1359 Page* page = frame().page(); 1361 Page* page = frame().page();
1360 return page && page->visibilityState() != PageVisibilityStateHidden && page- >focusController().isActive() && page->settings().deviceSupportsMouse(); 1362 return page && page->visibilityState() != PageVisibilityStateHidden && page- >focusController().isActive() && page->settings().deviceSupportsMouse();
1361 } 1363 }
1362 1364
1363 void FrameView::scrollContentsIfNeededRecursive() 1365 void FrameView::scrollContentsIfNeededRecursive()
1364 { 1366 {
1365 scrollContentsIfNeeded(); 1367 scrollContentsIfNeeded();
1366 1368
1367 for (LocalFrame* child = m_frame->tree().firstChild(); child; child = child- >tree().nextSibling()) { 1369 for (Frame* child = m_frame->tree().firstChild(); child; child = child->tree ().nextSibling()) {
1368 if (FrameView* view = child->view()) 1370 if (!child->isLocalFrame())
1371 continue;
1372 if (FrameView* view = toLocalFrame(child)->view())
1369 view->scrollContentsIfNeededRecursive(); 1373 view->scrollContentsIfNeededRecursive();
1370 } 1374 }
1371 } 1375 }
1372 1376
1373 void FrameView::scrollContentsIfNeeded() 1377 void FrameView::scrollContentsIfNeeded()
1374 { 1378 {
1375 bool didScroll = !pendingScrollDelta().isZero(); 1379 bool didScroll = !pendingScrollDelta().isZero();
1376 ScrollView::scrollContentsIfNeeded(); 1380 ScrollView::scrollContentsIfNeeded();
1377 if (didScroll) 1381 if (didScroll)
1378 updateFixedElementPaintInvalidationRectsAfterScroll(); 1382 updateFixedElementPaintInvalidationRectsAfterScroll();
(...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after
1959 CompositedLayerMappingPtr compositedLayerMapping = renderView()->layer() ->compositedLayerMapping(); 1963 CompositedLayerMappingPtr compositedLayerMapping = renderView()->layer() ->compositedLayerMapping();
1960 compositedLayerMapping->updateContentsOpaque(); 1964 compositedLayerMapping->updateContentsOpaque();
1961 if (compositedLayerMapping->mainGraphicsLayer()) 1965 if (compositedLayerMapping->mainGraphicsLayer())
1962 compositedLayerMapping->mainGraphicsLayer()->setNeedsDisplay(); 1966 compositedLayerMapping->mainGraphicsLayer()->setNeedsDisplay();
1963 } 1967 }
1964 recalculateScrollbarOverlayStyle(); 1968 recalculateScrollbarOverlayStyle();
1965 } 1969 }
1966 1970
1967 void FrameView::updateBackgroundRecursively(const Color& backgroundColor, bool t ransparent) 1971 void FrameView::updateBackgroundRecursively(const Color& backgroundColor, bool t ransparent)
1968 { 1972 {
1969 for (LocalFrame* frame = m_frame.get(); frame; frame = frame->tree().travers eNext(m_frame.get())) { 1973 for (Frame* frame = m_frame.get(); frame; frame = frame->tree().traverseNext (m_frame.get())) {
1970 if (FrameView* view = frame->view()) { 1974 if (!frame->isLocalFrame())
1975 continue;
1976 if (FrameView* view = toLocalFrame(frame)->view()) {
1971 view->setTransparent(transparent); 1977 view->setTransparent(transparent);
1972 view->setBaseBackgroundColor(backgroundColor); 1978 view->setBaseBackgroundColor(backgroundColor);
1973 } 1979 }
1974 } 1980 }
1975 } 1981 }
1976 1982
1977 void FrameView::scrollToAnchor() 1983 void FrameView::scrollToAnchor()
1978 { 1984 {
1979 RefPtrWillBeRawPtr<Node> anchorNode = m_maintainScrollPositionAnchor; 1985 RefPtrWillBeRawPtr<Node> anchorNode = m_maintainScrollPositionAnchor;
1980 if (!anchorNode) 1986 if (!anchorNode)
(...skipping 666 matching lines...) Expand 10 before | Expand all | Expand 10 after
2647 } 2653 }
2648 2654
2649 return false; 2655 return false;
2650 } 2656 }
2651 2657
2652 FrameView* FrameView::parentFrameView() const 2658 FrameView* FrameView::parentFrameView() const
2653 { 2659 {
2654 if (!parent()) 2660 if (!parent())
2655 return 0; 2661 return 0;
2656 2662
2657 if (LocalFrame* parentFrame = m_frame->tree().parent()) 2663 Frame* parentFrame = m_frame->tree().parent();
2658 return parentFrame->view(); 2664 if (parentFrame && parentFrame->isLocalFrame())
2665 return toLocalFrame(parentFrame)->view();
2659 2666
2660 return 0; 2667 return 0;
2661 } 2668 }
2662 2669
2663 void FrameView::updateControlTints() 2670 void FrameView::updateControlTints()
2664 { 2671 {
2665 // This is called when control tints are changed from aqua/graphite to clear and vice versa. 2672 // This is called when control tints are changed from aqua/graphite to clear and vice versa.
2666 // We do a "fake" paint, and when the theme gets a paint call, it can then d o an invalidate. 2673 // We do a "fake" paint, and when the theme gets a paint call, it can then d o an invalidate.
2667 // This is only done if the theme supports control tinting. It's up to the t heme and platform 2674 // This is only done if the theme supports control tinting. It's up to the t heme and platform
2668 // to define when controls get the tint and to call this function when that changes. 2675 // 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
2855 // when it lays out. 2862 // when it lays out.
2856 2863
2857 m_frame->document()->updateRenderTreeIfNeeded(); 2864 m_frame->document()->updateRenderTreeIfNeeded();
2858 2865
2859 if (needsLayout()) 2866 if (needsLayout())
2860 layout(); 2867 layout();
2861 2868
2862 // FIXME: Calling layout() shouldn't trigger scripe execution or have any 2869 // FIXME: Calling layout() shouldn't trigger scripe execution or have any
2863 // observable effects on the frame tree but we're not quite there yet. 2870 // observable effects on the frame tree but we're not quite there yet.
2864 Vector<RefPtr<FrameView> > frameViews; 2871 Vector<RefPtr<FrameView> > frameViews;
2865 for (LocalFrame* child = m_frame->tree().firstChild(); child; child = child- >tree().nextSibling()) { 2872 for (Frame* child = m_frame->tree().firstChild(); child; child = child->tree ().nextSibling()) {
2866 if (FrameView* view = child->view()) 2873 if (!child->isLocalFrame())
2874 continue;
2875 if (FrameView* view = toLocalFrame(child)->view())
2867 frameViews.append(view); 2876 frameViews.append(view);
2868 } 2877 }
2869 2878
2870 const Vector<RefPtr<FrameView> >::iterator end = frameViews.end(); 2879 const Vector<RefPtr<FrameView> >::iterator end = frameViews.end();
2871 for (Vector<RefPtr<FrameView> >::iterator it = frameViews.begin(); it != end ; ++it) 2880 for (Vector<RefPtr<FrameView> >::iterator it = frameViews.begin(); it != end ; ++it)
2872 (*it)->updateLayoutAndStyleIfNeededRecursive(); 2881 (*it)->updateLayoutAndStyleIfNeededRecursive();
2873 2882
2874 // When an <iframe> gets composited, it triggers an extra style recalc in it s containing FrameView. 2883 // When an <iframe> gets composited, it triggers an extra style recalc in it s containing FrameView.
2875 // To avoid pushing an invalid tree for display, we have to check for this c ase and do another 2884 // To avoid pushing an invalid tree for display, we have to check for this c ase and do another
2876 // style recalc. The extra style recalc needs to happen after our child <ifr ames> were updated. 2885 // 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
3113 } 3122 }
3114 3123
3115 return parentPoint; 3124 return parentPoint;
3116 } 3125 }
3117 3126
3118 void FrameView::setTracksPaintInvalidations(bool trackPaintInvalidations) 3127 void FrameView::setTracksPaintInvalidations(bool trackPaintInvalidations)
3119 { 3128 {
3120 if (trackPaintInvalidations == m_isTrackingPaintInvalidations) 3129 if (trackPaintInvalidations == m_isTrackingPaintInvalidations)
3121 return; 3130 return;
3122 3131
3123 for (LocalFrame* frame = m_frame->tree().top(); frame; frame = frame->tree() .traverseNext()) { 3132 for (Frame* frame = m_frame->tree().top(); frame; frame = frame->tree().trav erseNext()) {
3124 if (RenderView* renderView = frame->contentRenderer()) 3133 if (!frame->isLocalFrame())
3134 continue;
3135 if (RenderView* renderView = toLocalFrame(frame)->contentRenderer())
3125 renderView->compositor()->setTracksRepaints(trackPaintInvalidations) ; 3136 renderView->compositor()->setTracksRepaints(trackPaintInvalidations) ;
3126 } 3137 }
3127 3138
3128 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("blink.invalidation"), 3139 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("blink.invalidation"),
3129 "FrameView::setTracksPaintInvalidations", "enabled", trackPaintInvalidat ions); 3140 "FrameView::setTracksPaintInvalidations", "enabled", trackPaintInvalidat ions);
3130 3141
3131 resetTrackedPaintInvalidations(); 3142 resetTrackedPaintInvalidations();
3132 m_isTrackingPaintInvalidations = trackPaintInvalidations; 3143 m_isTrackingPaintInvalidations = trackPaintInvalidations;
3133 } 3144 }
3134 3145
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
3273 void FrameView::willRemoveScrollbar(Scrollbar* scrollbar, ScrollbarOrientation o rientation) 3284 void FrameView::willRemoveScrollbar(Scrollbar* scrollbar, ScrollbarOrientation o rientation)
3274 { 3285 {
3275 ScrollableArea::willRemoveScrollbar(scrollbar, orientation); 3286 ScrollableArea::willRemoveScrollbar(scrollbar, orientation);
3276 if (AXObjectCache* cache = axObjectCache()) { 3287 if (AXObjectCache* cache = axObjectCache()) {
3277 cache->remove(scrollbar); 3288 cache->remove(scrollbar);
3278 cache->handleScrollbarUpdate(this); 3289 cache->handleScrollbarUpdate(this);
3279 } 3290 }
3280 } 3291 }
3281 3292
3282 } // namespace WebCore 3293 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698