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

Side by Side Diff: third_party/WebKit/Source/core/paint/BoxPaintInvalidator.cpp

Issue 2673543003: Migrate WTF::HashMap::remove() to ::erase() (Closed)
Patch Set: Created 3 years, 10 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 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/paint/BoxPaintInvalidator.h" 5 #include "core/paint/BoxPaintInvalidator.h"
6 6
7 #include "core/frame/Settings.h" 7 #include "core/frame/Settings.h"
8 #include "core/layout/LayoutView.h" 8 #include "core/layout/LayoutView.h"
9 #include "core/layout/compositing/CompositedLayerMapping.h" 9 #include "core/layout/compositing/CompositedLayerMapping.h"
10 #include "core/paint/ObjectPaintInvalidator.h" 10 #include "core/paint/ObjectPaintInvalidator.h"
(...skipping 14 matching lines...) Expand all
25 PreviousBoxGeometriesMap; 25 PreviousBoxGeometriesMap;
26 static PreviousBoxGeometriesMap& previousBoxGeometriesMap() { 26 static PreviousBoxGeometriesMap& previousBoxGeometriesMap() {
27 DEFINE_STATIC_LOCAL(PreviousBoxGeometriesMap, map, ()); 27 DEFINE_STATIC_LOCAL(PreviousBoxGeometriesMap, map, ());
28 return map; 28 return map;
29 } 29 }
30 30
31 void BoxPaintInvalidator::boxWillBeDestroyed(const LayoutBox& box) { 31 void BoxPaintInvalidator::boxWillBeDestroyed(const LayoutBox& box) {
32 DCHECK(box.hasPreviousBoxGeometries() == 32 DCHECK(box.hasPreviousBoxGeometries() ==
33 previousBoxGeometriesMap().contains(&box)); 33 previousBoxGeometriesMap().contains(&box));
34 if (box.hasPreviousBoxGeometries()) 34 if (box.hasPreviousBoxGeometries())
35 previousBoxGeometriesMap().remove(&box); 35 previousBoxGeometriesMap().erase(&box);
36 } 36 }
37 37
38 static LayoutRect computeRightDelta(const LayoutPoint& location, 38 static LayoutRect computeRightDelta(const LayoutPoint& location,
39 const LayoutSize& oldSize, 39 const LayoutSize& oldSize,
40 const LayoutSize& newSize, 40 const LayoutSize& newSize,
41 int extraWidth) { 41 int extraWidth) {
42 LayoutUnit delta = newSize.width() - oldSize.width(); 42 LayoutUnit delta = newSize.width() - oldSize.width();
43 if (delta > 0) { 43 if (delta > 0) {
44 return LayoutRect(location.x() + oldSize.width() - extraWidth, location.y(), 44 return LayoutRect(location.x() + oldSize.width() - extraWidth, location.y(),
45 delta + extraWidth, newSize.height()); 45 delta + extraWidth, newSize.height());
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 return true; 339 return true;
340 340
341 return false; 341 return false;
342 } 342 }
343 343
344 void BoxPaintInvalidator::savePreviousBoxGeometriesIfNeeded() { 344 void BoxPaintInvalidator::savePreviousBoxGeometriesIfNeeded() {
345 DCHECK(m_box.hasPreviousBoxGeometries() == 345 DCHECK(m_box.hasPreviousBoxGeometries() ==
346 previousBoxGeometriesMap().contains(&m_box)); 346 previousBoxGeometriesMap().contains(&m_box));
347 if (!needsToSavePreviousBoxGeometries()) { 347 if (!needsToSavePreviousBoxGeometries()) {
348 if (m_box.hasPreviousBoxGeometries()) { 348 if (m_box.hasPreviousBoxGeometries()) {
349 previousBoxGeometriesMap().remove(&m_box); 349 previousBoxGeometriesMap().erase(&m_box);
350 m_box.getMutableForPainting().setHasPreviousBoxGeometries(false); 350 m_box.getMutableForPainting().setHasPreviousBoxGeometries(false);
351 } 351 }
352 return; 352 return;
353 } 353 }
354 354
355 PreviousBoxGeometries geometries = {m_box.size(), m_box.contentBoxRect(), 355 PreviousBoxGeometries geometries = {m_box.size(), m_box.contentBoxRect(),
356 m_box.layoutOverflowRect()}; 356 m_box.layoutOverflowRect()};
357 previousBoxGeometriesMap().set(&m_box, geometries); 357 previousBoxGeometriesMap().set(&m_box, geometries);
358 m_box.getMutableForPainting().setHasPreviousBoxGeometries(true); 358 m_box.getMutableForPainting().setHasPreviousBoxGeometries(true);
359 } 359 }
(...skipping 19 matching lines...) Expand all
379 379
380 LayoutRect BoxPaintInvalidator::previousLayoutOverflowRect() { 380 LayoutRect BoxPaintInvalidator::previousLayoutOverflowRect() {
381 DCHECK(m_box.hasPreviousBoxGeometries() == 381 DCHECK(m_box.hasPreviousBoxGeometries() ==
382 previousBoxGeometriesMap().contains(&m_box)); 382 previousBoxGeometriesMap().contains(&m_box));
383 return m_box.hasPreviousBoxGeometries() 383 return m_box.hasPreviousBoxGeometries()
384 ? previousBoxGeometriesMap().get(&m_box).layoutOverflowRect 384 ? previousBoxGeometriesMap().get(&m_box).layoutOverflowRect
385 : LayoutRect(); 385 : LayoutRect();
386 } 386 }
387 387
388 } // namespace blink 388 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698