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

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

Issue 1767883002: DevTools: generate string16-based handlers for v8_inspector. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 1090 matching lines...) Expand 10 before | Expand all | Expand 10 after
1101 return; 1101 return;
1102 1102
1103 inspectorStyleSheet->getText(result); 1103 inspectorStyleSheet->getText(result);
1104 } 1104 }
1105 1105
1106 void InspectorCSSAgent::setStyleSheetText(ErrorString* errorString, const String & styleSheetId, const String& text, protocol::Maybe<String>* sourceMapURL) 1106 void InspectorCSSAgent::setStyleSheetText(ErrorString* errorString, const String & styleSheetId, const String& text, protocol::Maybe<String>* sourceMapURL)
1107 { 1107 {
1108 FrontendOperationScope scope; 1108 FrontendOperationScope scope;
1109 InspectorStyleSheetBase* inspectorStyleSheet = assertStyleSheetForId(errorSt ring, styleSheetId); 1109 InspectorStyleSheetBase* inspectorStyleSheet = assertStyleSheetForId(errorSt ring, styleSheetId);
1110 if (!inspectorStyleSheet) { 1110 if (!inspectorStyleSheet) {
1111 *errorString = "Style sheet with id " + styleSheetId + " not found"; 1111 *errorString = String("Style sheet with id " + styleSheetId + " not foun d");
dgozman 2016/03/08 01:35:12 template consturctor
1112 return; 1112 return;
1113 } 1113 }
1114 1114
1115 TrackExceptionState exceptionState; 1115 TrackExceptionState exceptionState;
1116 m_domAgent->history()->perform(adoptRefWillBeNoop(new SetStyleSheetTextActio n(inspectorStyleSheet, text)), exceptionState); 1116 m_domAgent->history()->perform(adoptRefWillBeNoop(new SetStyleSheetTextActio n(inspectorStyleSheet, text)), exceptionState);
1117 *errorString = InspectorDOMAgent::toErrorString(exceptionState); 1117 *errorString = InspectorDOMAgent::toErrorString(exceptionState);
1118 if (!inspectorStyleSheet->sourceMapURL().isEmpty()) 1118 if (!inspectorStyleSheet->sourceMapURL().isEmpty())
1119 *sourceMapURL = inspectorStyleSheet->sourceMapURL(); 1119 *sourceMapURL = inspectorStyleSheet->sourceMapURL();
1120 } 1120 }
1121 1121
1122 static bool verifyRangeComponent(ErrorString* errorString, bool valid, const Str ing& component) 1122 static bool verifyRangeComponent(ErrorString* errorString, bool valid, const Str ing& component)
1123 { 1123 {
1124 if (!valid) 1124 if (!valid)
1125 *errorString = "range." + component + " must be a non-negative integer"; 1125 *errorString = String("range." + component + " must be a non-negative in teger");
1126 return valid; 1126 return valid;
1127 } 1127 }
1128 1128
1129 static bool jsonRangeToSourceRange(ErrorString* errorString, InspectorStyleSheet Base* inspectorStyleSheet, protocol::CSS::SourceRange* range, SourceRange* sourc eRange) 1129 static bool jsonRangeToSourceRange(ErrorString* errorString, InspectorStyleSheet Base* inspectorStyleSheet, protocol::CSS::SourceRange* range, SourceRange* sourc eRange)
1130 { 1130 {
1131 if (!verifyRangeComponent(errorString, range->getStartLine() >= 0, "startLin e") 1131 if (!verifyRangeComponent(errorString, range->getStartLine() >= 0, "startLin e")
1132 || !verifyRangeComponent(errorString, range->getStartColumn() >= 0, "sta rtColumn") 1132 || !verifyRangeComponent(errorString, range->getStartColumn() >= 0, "sta rtColumn")
1133 || !verifyRangeComponent(errorString, range->getEndLine() >= 0, "endLine ") 1133 || !verifyRangeComponent(errorString, range->getEndLine() >= 0, "endLine ")
1134 || !verifyRangeComponent(errorString, range->getEndColumn() >= 0, "endCo lumn")) 1134 || !verifyRangeComponent(errorString, range->getEndColumn() >= 0, "endCo lumn"))
1135 return false; 1135 return false;
(...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after
1697 IdToInspectorStyleSheet::iterator it = m_idToInspectorStyleSheet.find(styleS heetId); 1697 IdToInspectorStyleSheet::iterator it = m_idToInspectorStyleSheet.find(styleS heetId);
1698 if (it == m_idToInspectorStyleSheet.end()) { 1698 if (it == m_idToInspectorStyleSheet.end()) {
1699 *errorString = "No style sheet with given id found"; 1699 *errorString = "No style sheet with given id found";
1700 return nullptr; 1700 return nullptr;
1701 } 1701 }
1702 return it->value.get(); 1702 return it->value.get();
1703 } 1703 }
1704 1704
1705 InspectorStyleSheetBase* InspectorCSSAgent::assertStyleSheetForId(ErrorString* e rrorString, const String& styleSheetId) 1705 InspectorStyleSheetBase* InspectorCSSAgent::assertStyleSheetForId(ErrorString* e rrorString, const String& styleSheetId)
1706 { 1706 {
1707 String placeholder; 1707 ErrorString placeholder;
1708 InspectorStyleSheetBase* result = assertInspectorStyleSheetForId(&placeholde r, styleSheetId); 1708 InspectorStyleSheetBase* result = assertInspectorStyleSheetForId(&placeholde r, styleSheetId);
1709 if (result) 1709 if (result)
1710 return result; 1710 return result;
1711 IdToInspectorStyleSheetForInlineStyle::iterator it = m_idToInspectorStyleShe etForInlineStyle.find(styleSheetId); 1711 IdToInspectorStyleSheetForInlineStyle::iterator it = m_idToInspectorStyleShe etForInlineStyle.find(styleSheetId);
1712 if (it == m_idToInspectorStyleSheetForInlineStyle.end()) { 1712 if (it == m_idToInspectorStyleSheetForInlineStyle.end()) {
1713 *errorString = "No style sheet with given id found"; 1713 *errorString = "No style sheet with given id found";
1714 return nullptr; 1714 return nullptr;
1715 } 1715 }
1716 return it->value.get(); 1716 return it->value.get();
1717 } 1717 }
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
2106 visitor->trace(m_documentToCSSStyleSheets); 2106 visitor->trace(m_documentToCSSStyleSheets);
2107 visitor->trace(m_invalidatedDocuments); 2107 visitor->trace(m_invalidatedDocuments);
2108 visitor->trace(m_nodeToInspectorStyleSheet); 2108 visitor->trace(m_nodeToInspectorStyleSheet);
2109 visitor->trace(m_documentToViaInspectorStyleSheet); 2109 visitor->trace(m_documentToViaInspectorStyleSheet);
2110 #endif 2110 #endif
2111 visitor->trace(m_inspectorUserAgentStyleSheet); 2111 visitor->trace(m_inspectorUserAgentStyleSheet);
2112 InspectorBaseAgent::trace(visitor); 2112 InspectorBaseAgent::trace(visitor);
2113 } 2113 }
2114 2114
2115 } // namespace blink 2115 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698