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

Side by Side Diff: Source/core/dom/shadow/ContentDistribution.cpp

Issue 277213004: Oilpan: add transition types to shadow DOM supporting objects. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Use DISALLOW_ALLOCATION() instead Created 6 years, 7 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) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Neither the name of Google Inc. nor the names of its 10 * * Neither the name of Google Inc. nor the names of its
(...skipping 19 matching lines...) Expand all
30 #include "core/dom/shadow/InsertionPoint.h" 30 #include "core/dom/shadow/InsertionPoint.h"
31 31
32 namespace WebCore { 32 namespace WebCore {
33 33
34 void ContentDistribution::swap(ContentDistribution& other) 34 void ContentDistribution::swap(ContentDistribution& other)
35 { 35 {
36 m_nodes.swap(other.m_nodes); 36 m_nodes.swap(other.m_nodes);
37 m_indices.swap(other.m_indices); 37 m_indices.swap(other.m_indices);
38 } 38 }
39 39
40 void ContentDistribution::append(PassRefPtr<Node> node) 40 void ContentDistribution::append(PassRefPtrWillBeRawPtr<Node> node)
41 { 41 {
42 ASSERT(node); 42 ASSERT(node);
43 ASSERT(!isActiveInsertionPoint(*node)); 43 ASSERT(!isActiveInsertionPoint(*node));
44 size_t size = m_nodes.size(); 44 size_t size = m_nodes.size();
45 m_indices.set(node.get(), size); 45 m_indices.set(node.get(), size);
46 m_nodes.append(node); 46 m_nodes.append(node);
47 } 47 }
48 48
49 size_t ContentDistribution::find(const Node* node) const 49 size_t ContentDistribution::find(const Node* node) const
50 { 50 {
51 HashMap<const Node*, size_t>::const_iterator it = m_indices.find(node); 51 WillBeHeapHashMap<RawPtrWillBeMember<Node>, size_t>::const_iterator it = m_i ndices.find(const_cast<Node*>(node));
haraken 2014/05/12 13:38:35 It would be great if we don't need const_cast.
52 if (it == m_indices.end()) 52 if (it == m_indices.end())
53 return kNotFound; 53 return kNotFound;
54 54
55 return it.get()->value; 55 return it.get()->value;
56 } 56 }
57 57
58 Node* ContentDistribution::nextTo(const Node* node) const 58 Node* ContentDistribution::nextTo(const Node* node) const
59 { 59 {
60 size_t index = find(node); 60 size_t index = find(const_cast<Node*>(node));
61 if (index == kNotFound || index + 1 == size()) 61 if (index == kNotFound || index + 1 == size())
62 return 0; 62 return 0;
63 return at(index + 1).get(); 63 return at(index + 1).get();
64 } 64 }
65 65
66 Node* ContentDistribution::previousTo(const Node* node) const 66 Node* ContentDistribution::previousTo(const Node* node) const
67 { 67 {
68 size_t index = find(node); 68 size_t index = find(const_cast<Node*>(node));
69 if (index == kNotFound || !index) 69 if (index == kNotFound || !index)
70 return 0; 70 return 0;
71 return at(index - 1).get(); 71 return at(index - 1).get();
72 } 72 }
73 73
74 void ContentDistribution::trace(Visitor* visitor)
75 {
76 visitor->trace(m_nodes);
77 visitor->trace(m_indices);
78 }
79
74 } // namespace WebCore 80 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698