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

Side by Side Diff: third_party/WebKit/Source/core/inspector/InspectorCSSAgent.cpp

Issue 2759703002: Migrate WTF::HashMap::remove() to ::erase() (Closed)
Patch Set: rebase, fix one platform-specific reference Created 3 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010, Google Inc. All rights reserved. 2 * Copyright (C) 2010, 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 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 809 matching lines...) Expand 10 before | Expand all | Expand 10 after
820 for (CSSStyleSheet* cssStyleSheet : addedSheets) { 820 for (CSSStyleSheet* cssStyleSheet : addedSheets) {
821 InspectorStyleSheet* newStyleSheet = bindStyleSheet(cssStyleSheet); 821 InspectorStyleSheet* newStyleSheet = bindStyleSheet(cssStyleSheet);
822 documentCSSStyleSheets->insert(cssStyleSheet); 822 documentCSSStyleSheets->insert(cssStyleSheet);
823 if (frontend()) { 823 if (frontend()) {
824 frontend()->styleSheetAdded( 824 frontend()->styleSheetAdded(
825 newStyleSheet->buildObjectForStyleSheetInfo()); 825 newStyleSheet->buildObjectForStyleSheetInfo());
826 } 826 }
827 } 827 }
828 828
829 if (documentCSSStyleSheets->isEmpty()) 829 if (documentCSSStyleSheets->isEmpty())
830 m_documentToCSSStyleSheets.remove(document); 830 m_documentToCSSStyleSheets.erase(document);
831 } 831 }
832 832
833 void InspectorCSSAgent::documentDetached(Document* document) { 833 void InspectorCSSAgent::documentDetached(Document* document) {
834 m_invalidatedDocuments.erase(document); 834 m_invalidatedDocuments.erase(document);
835 setActiveStyleSheets(document, HeapVector<Member<CSSStyleSheet>>()); 835 setActiveStyleSheets(document, HeapVector<Member<CSSStyleSheet>>());
836 } 836 }
837 837
838 bool InspectorCSSAgent::forcePseudoState(Element* element, 838 bool InspectorCSSAgent::forcePseudoState(Element* element,
839 CSSSelector::PseudoType pseudoType) { 839 CSSSelector::PseudoType pseudoType) {
840 if (m_nodeIdToForcedPseudoState.isEmpty()) 840 if (m_nodeIdToForcedPseudoState.isEmpty())
(...skipping 704 matching lines...) Expand 10 before | Expand all | Expand 10 after
1545 m_nodeIdToForcedPseudoState.find(nodeId); 1545 m_nodeIdToForcedPseudoState.find(nodeId);
1546 unsigned currentForcedPseudoState = 1546 unsigned currentForcedPseudoState =
1547 it == m_nodeIdToForcedPseudoState.end() ? 0 : it->value; 1547 it == m_nodeIdToForcedPseudoState.end() ? 0 : it->value;
1548 bool needStyleRecalc = forcedPseudoState != currentForcedPseudoState; 1548 bool needStyleRecalc = forcedPseudoState != currentForcedPseudoState;
1549 if (!needStyleRecalc) 1549 if (!needStyleRecalc)
1550 return Response::OK(); 1550 return Response::OK();
1551 1551
1552 if (forcedPseudoState) 1552 if (forcedPseudoState)
1553 m_nodeIdToForcedPseudoState.set(nodeId, forcedPseudoState); 1553 m_nodeIdToForcedPseudoState.set(nodeId, forcedPseudoState);
1554 else 1554 else
1555 m_nodeIdToForcedPseudoState.remove(nodeId); 1555 m_nodeIdToForcedPseudoState.erase(nodeId);
1556 element->ownerDocument()->setNeedsStyleRecalc( 1556 element->ownerDocument()->setNeedsStyleRecalc(
1557 SubtreeStyleChange, 1557 SubtreeStyleChange,
1558 StyleChangeReasonForTracing::create(StyleChangeReason::Inspector)); 1558 StyleChangeReasonForTracing::create(StyleChangeReason::Inspector));
1559 return Response::OK(); 1559 return Response::OK();
1560 } 1560 }
1561 1561
1562 std::unique_ptr<protocol::CSS::CSSMedia> InspectorCSSAgent::buildMediaObject( 1562 std::unique_ptr<protocol::CSS::CSSMedia> InspectorCSSAgent::buildMediaObject(
1563 const MediaList* media, 1563 const MediaList* media,
1564 MediaListSource mediaListSource, 1564 MediaListSource mediaListSource,
1565 const String& sourceURL, 1565 const String& sourceURL,
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
1809 return inspectorStyleSheet; 1809 return inspectorStyleSheet;
1810 } 1810 }
1811 1811
1812 String InspectorCSSAgent::styleSheetId(CSSStyleSheet* styleSheet) { 1812 String InspectorCSSAgent::styleSheetId(CSSStyleSheet* styleSheet) {
1813 return bindStyleSheet(styleSheet)->id(); 1813 return bindStyleSheet(styleSheet)->id();
1814 } 1814 }
1815 1815
1816 String InspectorCSSAgent::unbindStyleSheet( 1816 String InspectorCSSAgent::unbindStyleSheet(
1817 InspectorStyleSheet* inspectorStyleSheet) { 1817 InspectorStyleSheet* inspectorStyleSheet) {
1818 String id = inspectorStyleSheet->id(); 1818 String id = inspectorStyleSheet->id();
1819 m_idToInspectorStyleSheet.remove(id); 1819 m_idToInspectorStyleSheet.erase(id);
1820 if (inspectorStyleSheet->pageStyleSheet()) 1820 if (inspectorStyleSheet->pageStyleSheet())
1821 m_cssStyleSheetToInspectorStyleSheet.erase( 1821 m_cssStyleSheetToInspectorStyleSheet.erase(
1822 inspectorStyleSheet->pageStyleSheet()); 1822 inspectorStyleSheet->pageStyleSheet());
1823 return id; 1823 return id;
1824 } 1824 }
1825 1825
1826 InspectorStyleSheet* InspectorCSSAgent::inspectorStyleSheetForRule( 1826 InspectorStyleSheet* InspectorCSSAgent::inspectorStyleSheetForRule(
1827 CSSStyleRule* rule) { 1827 CSSStyleRule* rule) {
1828 if (!rule) 1828 if (!rule)
1829 return nullptr; 1829 return nullptr;
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
2003 } 2003 }
2004 2004
2005 void InspectorCSSAgent::didRemoveDocument(Document* document) {} 2005 void InspectorCSSAgent::didRemoveDocument(Document* document) {}
2006 2006
2007 void InspectorCSSAgent::didRemoveDOMNode(Node* node) { 2007 void InspectorCSSAgent::didRemoveDOMNode(Node* node) {
2008 if (!node) 2008 if (!node)
2009 return; 2009 return;
2010 2010
2011 int nodeId = m_domAgent->boundNodeId(node); 2011 int nodeId = m_domAgent->boundNodeId(node);
2012 if (nodeId) 2012 if (nodeId)
2013 m_nodeIdToForcedPseudoState.remove(nodeId); 2013 m_nodeIdToForcedPseudoState.erase(nodeId);
2014 2014
2015 NodeToInspectorStyleSheet::iterator it = 2015 NodeToInspectorStyleSheet::iterator it =
2016 m_nodeToInspectorStyleSheet.find(node); 2016 m_nodeToInspectorStyleSheet.find(node);
2017 if (it == m_nodeToInspectorStyleSheet.end()) 2017 if (it == m_nodeToInspectorStyleSheet.end())
2018 return; 2018 return;
2019 2019
2020 m_idToInspectorStyleSheetForInlineStyle.remove(it->value->id()); 2020 m_idToInspectorStyleSheetForInlineStyle.erase(it->value->id());
2021 m_nodeToInspectorStyleSheet.remove(node); 2021 m_nodeToInspectorStyleSheet.erase(node);
2022 } 2022 }
2023 2023
2024 void InspectorCSSAgent::didModifyDOMAttr(Element* element) { 2024 void InspectorCSSAgent::didModifyDOMAttr(Element* element) {
2025 if (!element) 2025 if (!element)
2026 return; 2026 return;
2027 2027
2028 NodeToInspectorStyleSheet::iterator it = 2028 NodeToInspectorStyleSheet::iterator it =
2029 m_nodeToInspectorStyleSheet.find(element); 2029 m_nodeToInspectorStyleSheet.find(element);
2030 if (it == m_nodeToInspectorStyleSheet.end()) 2030 if (it == m_nodeToInspectorStyleSheet.end())
2031 return; 2031 return;
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after
2503 visitor->trace(m_cssStyleSheetToInspectorStyleSheet); 2503 visitor->trace(m_cssStyleSheetToInspectorStyleSheet);
2504 visitor->trace(m_documentToCSSStyleSheets); 2504 visitor->trace(m_documentToCSSStyleSheets);
2505 visitor->trace(m_invalidatedDocuments); 2505 visitor->trace(m_invalidatedDocuments);
2506 visitor->trace(m_nodeToInspectorStyleSheet); 2506 visitor->trace(m_nodeToInspectorStyleSheet);
2507 visitor->trace(m_inspectorUserAgentStyleSheet); 2507 visitor->trace(m_inspectorUserAgentStyleSheet);
2508 visitor->trace(m_tracker); 2508 visitor->trace(m_tracker);
2509 InspectorBaseAgent::trace(visitor); 2509 InspectorBaseAgent::trace(visitor);
2510 } 2510 }
2511 2511
2512 } // namespace blink 2512 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698