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

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

Issue 212813004: HashMap misuse in ScrollingCoordinator (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 9 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 | « no previous file | no next file » | 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 374 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 // In order to do a DFS cross-frame walk of the RenderLayer tree, we need to kno w which 385 // In order to do a DFS cross-frame walk of the RenderLayer tree, we need to kno w which
386 // RenderLayers have child frames inside of them. This computes a mapping for th e 386 // RenderLayers have child frames inside of them. This computes a mapping for th e
387 // current frame which we can consult while walking the layers of that frame. 387 // current frame which we can consult while walking the layers of that frame.
388 // Whenever we descend into a new frame, a new map will be created. 388 // Whenever we descend into a new frame, a new map will be created.
389 typedef HashMap<const RenderLayer*, Vector<const LocalFrame*> > LayerFrameMap; 389 typedef HashMap<const RenderLayer*, Vector<const LocalFrame*> > LayerFrameMap;
390 static void makeLayerChildFrameMap(const LocalFrame* currentFrame, LayerFrameMap * map) 390 static void makeLayerChildFrameMap(const LocalFrame* currentFrame, LayerFrameMap * map)
391 { 391 {
392 map->clear(); 392 map->clear();
393 const FrameTree& tree = currentFrame->tree(); 393 const FrameTree& tree = currentFrame->tree();
394 for (const LocalFrame* child = tree.firstChild(); child; child = child->tree ().nextSibling()) { 394 for (const LocalFrame* child = tree.firstChild(); child; child = child->tree ().nextSibling()) {
395 const RenderLayer* containingLayer = child->ownerRenderer()->enclosingLa yer(); 395 if (const RenderLayer* containingLayer = child->ownerRenderer()->enclosi ngLayer()) {
396 LayerFrameMap::iterator iter = map->find(containingLayer); 396 LayerFrameMap::iterator iter = map->find(containingLayer);
397 if (iter == map->end()) 397 if (iter == map->end())
398 map->add(containingLayer, Vector<const LocalFrame*>()).storedValue-> value.append(child); 398 map->add(containingLayer, Vector<const LocalFrame*>()).storedVal ue->value.append(child);
Nico 2014/03/26 15:48:15 Should add() ASSERT that the key is non-NULL then?
399 else 399 else
400 iter->value.append(child); 400 iter->value.append(child);
401 }
401 } 402 }
402 } 403 }
403 404
404 static void convertLayerRectsToEnclosingCompositedLayerRecursive( 405 static void convertLayerRectsToEnclosingCompositedLayerRecursive(
405 const RenderLayer* curLayer, 406 const RenderLayer* curLayer,
406 const LayerHitTestRects& layerRects, 407 const LayerHitTestRects& layerRects,
407 LayerHitTestRects& compositorRects, 408 LayerHitTestRects& compositorRects,
408 RenderGeometryMap& geometryMap, 409 RenderGeometryMap& geometryMap,
409 HashSet<const RenderLayer*>& layersWithRects, 410 HashSet<const RenderLayer*>& layersWithRects,
410 LayerFrameMap& layerChildFrameMap) 411 LayerFrameMap& layerChildFrameMap)
(...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after
951 bool frameIsScrollable = frameView && frameView->isScrollable(); 952 bool frameIsScrollable = frameView && frameView->isScrollable();
952 if (frameIsScrollable != m_wasFrameScrollable) 953 if (frameIsScrollable != m_wasFrameScrollable)
953 return true; 954 return true;
954 955
955 if (WebLayer* scrollLayer = frameView ? toWebLayer(frameView->layerForScroll ing()) : 0) 956 if (WebLayer* scrollLayer = frameView ? toWebLayer(frameView->layerForScroll ing()) : 0)
956 return blink::WebSize(frameView->contentsSize()) != scrollLayer->bounds( ); 957 return blink::WebSize(frameView->contentsSize()) != scrollLayer->bounds( );
957 return false; 958 return false;
958 } 959 }
959 960
960 } // namespace WebCore 961 } // namespace WebCore
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698