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

Side by Side Diff: Source/core/page/scrolling/ScrollingCoordinator.cpp

Issue 33353003: Have Frame::tree() return a reference (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase on master Created 7 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/page/SpatialNavigation.cpp ('k') | Source/core/rendering/HitTestResult.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) 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2011 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 } 341 }
342 342
343 // In order to do a DFS cross-frame walk of the RenderLayer tree, we need to kno w which 343 // In order to do a DFS cross-frame walk of the RenderLayer tree, we need to kno w which
344 // RenderLayers have child frames inside of them. This computes a mapping for th e 344 // RenderLayers have child frames inside of them. This computes a mapping for th e
345 // current frame which we can consult while walking the layers of that frame. 345 // current frame which we can consult while walking the layers of that frame.
346 // Whenever we descend into a new frame, a new map will be created. 346 // Whenever we descend into a new frame, a new map will be created.
347 typedef HashMap<const RenderLayer*, Vector<const Frame*> > LayerFrameMap; 347 typedef HashMap<const RenderLayer*, Vector<const Frame*> > LayerFrameMap;
348 static void makeLayerChildFrameMap(const Frame* currentFrame, LayerFrameMap* map ) 348 static void makeLayerChildFrameMap(const Frame* currentFrame, LayerFrameMap* map )
349 { 349 {
350 map->clear(); 350 map->clear();
351 const FrameTree* tree = currentFrame->tree(); 351 const FrameTree& tree = currentFrame->tree();
352 for (const Frame* child = tree->firstChild(); child; child = child->tree()-> nextSibling()) { 352 for (const Frame* child = tree.firstChild(); child; child = child->tree().ne xtSibling()) {
353 const RenderLayer* containingLayer = child->ownerRenderer()->enclosingLa yer(); 353 const RenderLayer* containingLayer = child->ownerRenderer()->enclosingLa yer();
354 LayerFrameMap::iterator iter = map->find(containingLayer); 354 LayerFrameMap::iterator iter = map->find(containingLayer);
355 if (iter == map->end()) 355 if (iter == map->end())
356 iter = map->add(containingLayer, Vector<const Frame*>()).iterator; 356 iter = map->add(containingLayer, Vector<const Frame*>()).iterator;
357 iter->value.append(child); 357 iter->value.append(child);
358 } 358 }
359 } 359 }
360 360
361 static void convertLayerRectsToEnclosingCompositedLayerRecursive( 361 static void convertLayerRectsToEnclosingCompositedLayerRecursive(
362 const RenderLayer* curLayer, 362 const RenderLayer* curLayer,
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
625 for (HashSet<RefPtr<Widget> >::const_iterator it = children->begin(), en d = children->end(); it != end; ++it) { 625 for (HashSet<RefPtr<Widget> >::const_iterator it = children->begin(), en d = children->end(); it != end; ++it) {
626 if (!(*it)->isPluginView()) 626 if (!(*it)->isPluginView())
627 continue; 627 continue;
628 628
629 PluginView* pluginView = toPluginView((*it).get()); 629 PluginView* pluginView = toPluginView((*it).get());
630 if (pluginView->wantsWheelEvents()) 630 if (pluginView->wantsWheelEvents())
631 shouldHandleScrollGestureOnMainThreadRegion.unite(pluginView->fr ameRect()); 631 shouldHandleScrollGestureOnMainThreadRegion.unite(pluginView->fr ameRect());
632 } 632 }
633 } 633 }
634 634
635 FrameTree* tree = frame->tree(); 635 const FrameTree& tree = frame->tree();
636 for (Frame* subFrame = tree->firstChild(); subFrame; subFrame = subFrame->tr ee()->nextSibling()) 636 for (Frame* subFrame = tree.firstChild(); subFrame; subFrame = subFrame->tre e().nextSibling())
637 shouldHandleScrollGestureOnMainThreadRegion.unite(computeShouldHandleScr ollGestureOnMainThreadRegion(subFrame, offset)); 637 shouldHandleScrollGestureOnMainThreadRegion.unite(computeShouldHandleScr ollGestureOnMainThreadRegion(subFrame, offset));
638 638
639 return shouldHandleScrollGestureOnMainThreadRegion; 639 return shouldHandleScrollGestureOnMainThreadRegion;
640 } 640 }
641 641
642 static void accumulateDocumentTouchEventTargetRects(LayerHitTestRects& rects, co nst Document* document) 642 static void accumulateDocumentTouchEventTargetRects(LayerHitTestRects& rects, co nst Document* document)
643 { 643 {
644 ASSERT(document); 644 ASSERT(document);
645 if (!document->touchEventTargets()) 645 if (!document->touchEventTargets())
646 return; 646 return;
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
693 if (!document || !document->view()) 693 if (!document || !document->view())
694 return; 694 return;
695 695
696 accumulateDocumentTouchEventTargetRects(rects, document); 696 accumulateDocumentTouchEventTargetRects(rects, document);
697 } 697 }
698 698
699 unsigned ScrollingCoordinator::computeCurrentWheelEventHandlerCount() 699 unsigned ScrollingCoordinator::computeCurrentWheelEventHandlerCount()
700 { 700 {
701 unsigned wheelEventHandlerCount = 0; 701 unsigned wheelEventHandlerCount = 0;
702 702
703 for (Frame* frame = m_page->mainFrame(); frame; frame = frame->tree()->trave rseNext()) { 703 for (Frame* frame = m_page->mainFrame(); frame; frame = frame->tree().traver seNext()) {
704 if (frame->document()) 704 if (frame->document())
705 wheelEventHandlerCount += WheelController::from(frame->document())-> wheelEventHandlerCount(); 705 wheelEventHandlerCount += WheelController::from(frame->document())-> wheelEventHandlerCount();
706 } 706 }
707 707
708 return wheelEventHandlerCount; 708 return wheelEventHandlerCount;
709 } 709 }
710 710
711 void ScrollingCoordinator::frameViewWheelEventHandlerCountChanged(FrameView* fra meView) 711 void ScrollingCoordinator::frameViewWheelEventHandlerCountChanged(FrameView* fra meView)
712 { 712 {
713 ASSERT(isMainThread()); 713 ASSERT(isMainThread());
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
862 stringBuilder.resize(stringBuilder.length() - 2); 862 stringBuilder.resize(stringBuilder.length() - 2);
863 return stringBuilder.toString(); 863 return stringBuilder.toString();
864 } 864 }
865 865
866 String ScrollingCoordinator::mainThreadScrollingReasonsAsText() const 866 String ScrollingCoordinator::mainThreadScrollingReasonsAsText() const
867 { 867 {
868 return mainThreadScrollingReasonsAsText(mainThreadScrollingReasons()); 868 return mainThreadScrollingReasonsAsText(mainThreadScrollingReasons());
869 } 869 }
870 870
871 } // namespace WebCore 871 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/page/SpatialNavigation.cpp ('k') | Source/core/rendering/HitTestResult.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698