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

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: dcheng's comment addressed 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
« no previous file with comments | « Source/core/frame/DOMWindow.cpp ('k') | Source/core/frame/LocalFrame.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 958 matching lines...) Expand 10 before | Expand all | Expand 10 after
1348 bool FrameView::shouldSetCursor() const 1350 bool FrameView::shouldSetCursor() const
1349 { 1351 {
1350 Page* page = frame().page(); 1352 Page* page = frame().page();
1351 return page && page->visibilityState() != PageVisibilityStateHidden && page- >focusController().isActive() && page->settings().deviceSupportsMouse(); 1353 return page && page->visibilityState() != PageVisibilityStateHidden && page- >focusController().isActive() && page->settings().deviceSupportsMouse();
1352 } 1354 }
1353 1355
1354 void FrameView::scrollContentsIfNeededRecursive() 1356 void FrameView::scrollContentsIfNeededRecursive()
1355 { 1357 {
1356 scrollContentsIfNeeded(); 1358 scrollContentsIfNeeded();
1357 1359
1358 for (LocalFrame* child = m_frame->tree().firstChild(); child; child = child- >tree().nextSibling()) { 1360 for (Frame* child = m_frame->tree().firstChild(); child; child = child->tree ().nextSibling()) {
1359 if (FrameView* view = child->view()) 1361 if (!child->isLocalFrame())
1362 continue;
1363 if (FrameView* view = toLocalFrame(child)->view())
1360 view->scrollContentsIfNeededRecursive(); 1364 view->scrollContentsIfNeededRecursive();
1361 } 1365 }
1362 } 1366 }
1363 1367
1364 void FrameView::scrollContentsIfNeeded() 1368 void FrameView::scrollContentsIfNeeded()
1365 { 1369 {
1366 bool didScroll = !pendingScrollDelta().isZero(); 1370 bool didScroll = !pendingScrollDelta().isZero();
1367 ScrollView::scrollContentsIfNeeded(); 1371 ScrollView::scrollContentsIfNeeded();
1368 if (didScroll) 1372 if (didScroll)
1369 updateFixedElementPaintInvalidationRectsAfterScroll(); 1373 updateFixedElementPaintInvalidationRectsAfterScroll();
(...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after
1948 CompositedLayerMappingPtr compositedLayerMapping = renderView()->layer() ->compositedLayerMapping(); 1952 CompositedLayerMappingPtr compositedLayerMapping = renderView()->layer() ->compositedLayerMapping();
1949 compositedLayerMapping->updateContentsOpaque(); 1953 compositedLayerMapping->updateContentsOpaque();
1950 if (compositedLayerMapping->mainGraphicsLayer()) 1954 if (compositedLayerMapping->mainGraphicsLayer())
1951 compositedLayerMapping->mainGraphicsLayer()->setNeedsDisplay(); 1955 compositedLayerMapping->mainGraphicsLayer()->setNeedsDisplay();
1952 } 1956 }
1953 recalculateScrollbarOverlayStyle(); 1957 recalculateScrollbarOverlayStyle();
1954 } 1958 }
1955 1959
1956 void FrameView::updateBackgroundRecursively(const Color& backgroundColor, bool t ransparent) 1960 void FrameView::updateBackgroundRecursively(const Color& backgroundColor, bool t ransparent)
1957 { 1961 {
1958 for (LocalFrame* frame = m_frame.get(); frame; frame = frame->tree().travers eNext(m_frame.get())) { 1962 for (Frame* frame = m_frame.get(); frame; frame = frame->tree().traverseNext (m_frame.get())) {
1959 if (FrameView* view = frame->view()) { 1963 if (!frame->isLocalFrame())
1964 continue;
1965 if (FrameView* view = toLocalFrame(frame)->view()) {
1960 view->setTransparent(transparent); 1966 view->setTransparent(transparent);
1961 view->setBaseBackgroundColor(backgroundColor); 1967 view->setBaseBackgroundColor(backgroundColor);
1962 } 1968 }
1963 } 1969 }
1964 } 1970 }
1965 1971
1966 void FrameView::scrollToAnchor() 1972 void FrameView::scrollToAnchor()
1967 { 1973 {
1968 RefPtrWillBeRawPtr<Node> anchorNode = m_maintainScrollPositionAnchor; 1974 RefPtrWillBeRawPtr<Node> anchorNode = m_maintainScrollPositionAnchor;
1969 if (!anchorNode) 1975 if (!anchorNode)
(...skipping 666 matching lines...) Expand 10 before | Expand all | Expand 10 after
2636 } 2642 }
2637 2643
2638 return false; 2644 return false;
2639 } 2645 }
2640 2646
2641 FrameView* FrameView::parentFrameView() const 2647 FrameView* FrameView::parentFrameView() const
2642 { 2648 {
2643 if (!parent()) 2649 if (!parent())
2644 return 0; 2650 return 0;
2645 2651
2646 if (LocalFrame* parentFrame = m_frame->tree().parent()) 2652 Frame* parentFrame = m_frame->tree().parent();
2647 return parentFrame->view(); 2653 if (parentFrame && parentFrame->isLocalFrame())
2654 return toLocalFrame(parentFrame)->view();
2648 2655
2649 return 0; 2656 return 0;
2650 } 2657 }
2651 2658
2652 void FrameView::updateControlTints() 2659 void FrameView::updateControlTints()
2653 { 2660 {
2654 // This is called when control tints are changed from aqua/graphite to clear and vice versa. 2661 // This is called when control tints are changed from aqua/graphite to clear and vice versa.
2655 // We do a "fake" paint, and when the theme gets a paint call, it can then d o an invalidate. 2662 // We do a "fake" paint, and when the theme gets a paint call, it can then d o an invalidate.
2656 // This is only done if the theme supports control tinting. It's up to the t heme and platform 2663 // This is only done if the theme supports control tinting. It's up to the t heme and platform
2657 // to define when controls get the tint and to call this function when that changes. 2664 // 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
2844 // when it lays out. 2851 // when it lays out.
2845 2852
2846 m_frame->document()->updateRenderTreeIfNeeded(); 2853 m_frame->document()->updateRenderTreeIfNeeded();
2847 2854
2848 if (needsLayout()) 2855 if (needsLayout())
2849 layout(); 2856 layout();
2850 2857
2851 // FIXME: Calling layout() shouldn't trigger scripe execution or have any 2858 // FIXME: Calling layout() shouldn't trigger scripe execution or have any
2852 // observable effects on the frame tree but we're not quite there yet. 2859 // observable effects on the frame tree but we're not quite there yet.
2853 Vector<RefPtr<FrameView> > frameViews; 2860 Vector<RefPtr<FrameView> > frameViews;
2854 for (LocalFrame* child = m_frame->tree().firstChild(); child; child = child- >tree().nextSibling()) { 2861 for (Frame* child = m_frame->tree().firstChild(); child; child = child->tree ().nextSibling()) {
2855 if (FrameView* view = child->view()) 2862 if (!child->isLocalFrame())
2863 continue;
2864 if (FrameView* view = toLocalFrame(child)->view())
2856 frameViews.append(view); 2865 frameViews.append(view);
2857 } 2866 }
2858 2867
2859 const Vector<RefPtr<FrameView> >::iterator end = frameViews.end(); 2868 const Vector<RefPtr<FrameView> >::iterator end = frameViews.end();
2860 for (Vector<RefPtr<FrameView> >::iterator it = frameViews.begin(); it != end ; ++it) 2869 for (Vector<RefPtr<FrameView> >::iterator it = frameViews.begin(); it != end ; ++it)
2861 (*it)->updateLayoutAndStyleIfNeededRecursive(); 2870 (*it)->updateLayoutAndStyleIfNeededRecursive();
2862 2871
2863 // When an <iframe> gets composited, it triggers an extra style recalc in it s containing FrameView. 2872 // When an <iframe> gets composited, it triggers an extra style recalc in it s containing FrameView.
2864 // To avoid pushing an invalid tree for display, we have to check for this c ase and do another 2873 // To avoid pushing an invalid tree for display, we have to check for this c ase and do another
2865 // style recalc. The extra style recalc needs to happen after our child <ifr ames> were updated. 2874 // 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
3102 } 3111 }
3103 3112
3104 return parentPoint; 3113 return parentPoint;
3105 } 3114 }
3106 3115
3107 void FrameView::setTracksPaintInvalidations(bool trackPaintInvalidations) 3116 void FrameView::setTracksPaintInvalidations(bool trackPaintInvalidations)
3108 { 3117 {
3109 if (trackPaintInvalidations == m_isTrackingPaintInvalidations) 3118 if (trackPaintInvalidations == m_isTrackingPaintInvalidations)
3110 return; 3119 return;
3111 3120
3112 for (LocalFrame* frame = m_frame->tree().top(); frame; frame = frame->tree() .traverseNext()) { 3121 for (Frame* frame = m_frame->tree().top(); frame; frame = frame->tree().trav erseNext()) {
3113 if (RenderView* renderView = frame->contentRenderer()) 3122 if (!frame->isLocalFrame())
3123 continue;
3124 if (RenderView* renderView = toLocalFrame(frame)->contentRenderer())
3114 renderView->compositor()->setTracksRepaints(trackPaintInvalidations) ; 3125 renderView->compositor()->setTracksRepaints(trackPaintInvalidations) ;
3115 } 3126 }
3116 3127
3117 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("blink.invalidation"), 3128 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("blink.invalidation"),
3118 "FrameView::setTracksPaintInvalidations", "enabled", trackPaintInvalidat ions); 3129 "FrameView::setTracksPaintInvalidations", "enabled", trackPaintInvalidat ions);
3119 3130
3120 resetTrackedPaintInvalidations(); 3131 resetTrackedPaintInvalidations();
3121 m_isTrackingPaintInvalidations = trackPaintInvalidations; 3132 m_isTrackingPaintInvalidations = trackPaintInvalidations;
3122 } 3133 }
3123 3134
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
3262 void FrameView::willRemoveScrollbar(Scrollbar* scrollbar, ScrollbarOrientation o rientation) 3273 void FrameView::willRemoveScrollbar(Scrollbar* scrollbar, ScrollbarOrientation o rientation)
3263 { 3274 {
3264 ScrollableArea::willRemoveScrollbar(scrollbar, orientation); 3275 ScrollableArea::willRemoveScrollbar(scrollbar, orientation);
3265 if (AXObjectCache* cache = axObjectCache()) { 3276 if (AXObjectCache* cache = axObjectCache()) {
3266 cache->remove(scrollbar); 3277 cache->remove(scrollbar);
3267 cache->handleScrollbarUpdate(this); 3278 cache->handleScrollbarUpdate(this);
3268 } 3279 }
3269 } 3280 }
3270 3281
3271 } // namespace WebCore 3282 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/frame/DOMWindow.cpp ('k') | Source/core/frame/LocalFrame.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698