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

Unified Diff: third_party/WebKit/Source/core/events/EventPath.cpp

Issue 2554953005: Avoid WTF::Vector::at() and operator[] in core/events. (Closed)
Patch Set: _ Created 4 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/events/EventSender.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/events/EventPath.cpp
diff --git a/third_party/WebKit/Source/core/events/EventPath.cpp b/third_party/WebKit/Source/core/events/EventPath.cpp
index 1c7c68962f1bdf3731c701952bb46d6264e98176..9b3ebc30682f9c41f645b6a979d281e7c7ebd933 100644
--- a/third_party/WebKit/Source/core/events/EventPath.cpp
+++ b/third_party/WebKit/Source/core/events/EventPath.cpp
@@ -238,15 +238,15 @@ void EventPath::calculateAdjustedTargets() {
TreeScopeEventContextMap treeScopeEventContextMap;
TreeScopeEventContext* lastTreeScopeEventContext = nullptr;
- for (size_t i = 0; i < size(); ++i) {
- Node* currentNode = at(i).node();
+ for (auto& context : m_nodeEventContexts) {
+ Node* currentNode = context.node();
TreeScope& currentTreeScope = currentNode->treeScope();
if (lastTreeScope != &currentTreeScope) {
lastTreeScopeEventContext = ensureTreeScopeEventContext(
currentNode, &currentTreeScope, treeScopeEventContextMap);
}
DCHECK(lastTreeScopeEventContext);
- at(i).setTreeScopeEventContext(lastTreeScopeEventContext);
+ context.setTreeScopeEventContext(lastTreeScopeEventContext);
lastTreeScope = &currentTreeScope;
}
m_treeScopeEventContexts.appendRange(
@@ -258,10 +258,8 @@ void EventPath::buildRelatedNodeMap(const Node& relatedNode,
RelatedTargetMap& relatedTargetMap) {
EventPath* relatedTargetEventPath =
new EventPath(const_cast<Node&>(relatedNode));
- for (size_t i = 0;
- i < relatedTargetEventPath->m_treeScopeEventContexts.size(); ++i) {
- TreeScopeEventContext* treeScopeEventContext =
- relatedTargetEventPath->m_treeScopeEventContexts[i].get();
+ for (const auto& treeScopeEventContext :
+ relatedTargetEventPath->m_treeScopeEventContexts) {
relatedTargetMap.add(&treeScopeEventContext->treeScope(),
treeScopeEventContext->target());
}
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/events/EventSender.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698