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

Unified Diff: Source/core/inspector/InspectorCSSAgent.cpp

Issue 1310433002: Devtools: [LayoutEditor] highlight changed value in the SSP (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: Source/core/inspector/InspectorCSSAgent.cpp
diff --git a/Source/core/inspector/InspectorCSSAgent.cpp b/Source/core/inspector/InspectorCSSAgent.cpp
index c7fc11293f1f8b7a567a60f917e4a14cebb4ae54..71c4c382415a39d243e0a5923b4ca9ab95a4a0d1 100644
--- a/Source/core/inspector/InspectorCSSAgent.cpp
+++ b/Source/core/inspector/InspectorCSSAgent.cpp
@@ -1636,13 +1636,15 @@ void InspectorCSSAgent::setCSSPropertyValue(ErrorString* errorString, Element* e
String styleSheetText;
inspectorStyleSheet->getText(&styleSheetText);
String styleText = styleSheetText.substring(bodyRange.start, bodyRange.length());
-
+ SourceRange changeRange;
if (foundIndex == -1) {
bool isImportant = inlineStyle->getPropertyPriority(longhand) == "important";
String newPropertyText = "\n" + longhand + ": " + value + (isImportant ? " !important" : "") + ";";
- if (!styleText.stripWhiteSpace().endsWith(';'))
+ if (!styleText.isEmpty() && !styleText.stripWhiteSpace().endsWith(';'))
newPropertyText = ";" + newPropertyText;
styleText.append(newPropertyText);
+ changeRange.start = bodyRange.end;
+ changeRange.end = bodyRange.end + newPropertyText.length();
} else {
CSSPropertySourceData declaration = properties[foundIndex];
String newValueText;
@@ -1653,8 +1655,12 @@ void InspectorCSSAgent::setCSSPropertyValue(ErrorString* errorString, Element* e
String newPropertyText = declaration.name + ": " + newValueText + (declaration.important ? " !important" : "") + ";";
styleText.replace(declaration.range.start - bodyRange.start, declaration.range.length(), newPropertyText);
+ changeRange.start = declaration.range.start;
+ changeRange.end = changeRange.start + newPropertyText.length();
}
- setStyleText(errorString, inspectorStyleSheet, bodyRange, styleText);
+ CSSStyleDeclaration* resultStyle = setStyleText(errorString, inspectorStyleSheet, bodyRange, styleText);
+ if (resultStyle)
+ frontend()->layoutEditorChange(inspectorStyleSheet->id(), inspectorStyleSheet->buildSourceRangeObject(changeRange));
pfeldman 2015/08/21 01:43:00 You might need to flush stylesheetadded events.
sergeyv 2015/08/21 04:05:42 Done.
}
void InspectorCSSAgent::setEffectivePropertyValueForNode(ErrorString* errorString, int nodeId, const String& propertyName, const String& value)

Powered by Google App Engine
This is Rietveld 408576698