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

Side by Side Diff: Source/core/css/resolver/ScopedStyleTree.cpp

Issue 138643003: Simpler return value of HashTable::add/HashMap:add and others (Closed)
Patch Set: Daily master update (now with base url?) Created 6 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 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. 3 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
4 * Copyright (C) 2012 Google Inc. All rights reserved. 4 * Copyright (C) 2012 Google Inc. All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 && !scopingNode.isShadowRoot()) 51 && !scopingNode.isShadowRoot())
52 return 0; 52 return 0;
53 return lookupScopedStyleResolverFor(&scopingNode); 53 return lookupScopedStyleResolverFor(&scopingNode);
54 } 54 }
55 55
56 ScopedStyleResolver* ScopedStyleTree::addScopedStyleResolver(ContainerNode& scop ingNode, bool& isNewEntry) 56 ScopedStyleResolver* ScopedStyleTree::addScopedStyleResolver(ContainerNode& scop ingNode, bool& isNewEntry)
57 { 57 {
58 HashMap<const ContainerNode*, OwnPtr<ScopedStyleResolver> >::AddResult addRe sult = m_authorStyles.add(&scopingNode, nullptr); 58 HashMap<const ContainerNode*, OwnPtr<ScopedStyleResolver> >::AddResult addRe sult = m_authorStyles.add(&scopingNode, nullptr);
59 59
60 if (addResult.isNewEntry) { 60 if (addResult.isNewEntry) {
61 addResult.iterator->value = ScopedStyleResolver::create(scopingNode); 61 addResult.storedValue->value = ScopedStyleResolver::create(scopingNode);
62 if (scopingNode.isDocumentNode()) 62 if (scopingNode.isDocumentNode())
63 m_scopedResolverForDocument = addResult.iterator->value.get(); 63 m_scopedResolverForDocument = addResult.storedValue->value.get();
64 } 64 }
65 isNewEntry = addResult.isNewEntry; 65 isNewEntry = addResult.isNewEntry;
66 return addResult.iterator->value.get(); 66 return addResult.storedValue->value.get();
67 } 67 }
68 68
69 void ScopedStyleTree::setupScopedStylesTree(ScopedStyleResolver* target) 69 void ScopedStyleTree::setupScopedStylesTree(ScopedStyleResolver* target)
70 { 70 {
71 ASSERT(target); 71 ASSERT(target);
72 72
73 const ContainerNode& scopingNode = target->scopingNode(); 73 const ContainerNode& scopingNode = target->scopingNode();
74 74
75 // Since StyleResolver creates RuleSets according to styles' document 75 // Since StyleResolver creates RuleSets according to styles' document
76 // order, a parent of the given ScopedRuleData has been already 76 // order, a parent of the given ScopedRuleData has been already
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 return; 214 return;
215 215
216 reparentNodes(resolverRemoved, resolverRemoved->parent()); 216 reparentNodes(resolverRemoved, resolverRemoved->parent());
217 if (m_cache.scopedResolver == resolverRemoved) 217 if (m_cache.scopedResolver == resolverRemoved)
218 m_cache.clear(); 218 m_cache.clear();
219 219
220 m_authorStyles.remove(scopingNode); 220 m_authorStyles.remove(scopingNode);
221 } 221 }
222 222
223 } // namespace WebCore 223 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/css/resolver/MatchedPropertiesCache.cpp ('k') | Source/core/css/resolver/StyleBuilderCustom.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698