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

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

Issue 1310923003: Devtools [LayoutEditor]: Patch values in the selected rule (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@medias
Patch Set: Rebase Created 5 years, 3 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/LayoutEditor.cpp
diff --git a/Source/core/inspector/LayoutEditor.cpp b/Source/core/inspector/LayoutEditor.cpp
index 25436dfb84399b523879286ca3d570fd0ad49501..863b45c4b4e0dea980a77cc9df8436ba8831d093 100644
--- a/Source/core/inspector/LayoutEditor.cpp
+++ b/Source/core/inspector/LayoutEditor.cpp
@@ -293,7 +293,7 @@ void LayoutEditor::overlayPropertyChanged(float cssDelta)
if (m_changingProperty && m_factor) {
String errorString;
float newValue = toValidValue(m_changingProperty, cssDelta / m_factor + m_propertyInitialValue);
- m_cssAgent->setCSSPropertyValue(&errorString, m_element.get(), m_changingProperty, truncateZeroes(String::format("%.2f", newValue)) + CSSPrimitiveValue::unitTypeToString(m_valueUnitType));
+ m_cssAgent->setCSSPropertyValueInRule(&errorString, m_element.get(), m_currentRuleIndex == -1 ? nullptr : m_matchedRules[m_currentRuleIndex].get(), m_changingProperty, truncateZeroes(String::format("%.2f", newValue)) + CSSPrimitiveValue::unitTypeToString(m_valueUnitType));
dgozman 2015/09/02 22:26:17 I don't like nullptr as an indicator of inline sty
sergeyv 2015/09/03 00:52:28 Done.
if (!errorString)
m_isDirty = true;
}
@@ -327,16 +327,7 @@ void LayoutEditor::initializeCSSRules()
if (!m_element)
return;
- Document* ownerDocument = m_element->ownerDocument();
- // A non-active document has no styles.
- if (!ownerDocument->isActive())
- return;
-
- // Matched rules.
- StyleResolver& styleResolver = ownerDocument->ensureStyleResolver();
- PseudoId elementPseudoId = m_element->pseudoId();
- m_element->updateDistribution();
- RefPtrWillBeRawPtr<CSSRuleList> matchedRules = styleResolver.pseudoCSSRulesForElement(m_element.get(), elementPseudoId, StyleResolver::AllCSSRules);
+ RefPtrWillBeRawPtr<CSSRuleList> matchedRules = m_cssAgent->matchedRulesList(m_element.get());
if (!matchedRules)
return;
@@ -357,7 +348,7 @@ void LayoutEditor::initializeCSSRules()
Vector<std::pair<unsigned, CSSStyleRule*>> selectors;
for (unsigned i = 0; i < uniqRules.size(); ++i) {
TrackExceptionState exceptionState;
- RefPtrWillBeRawPtr<StaticElementList> elements = ownerDocument->querySelectorAll(AtomicString(uniqRules[i]->selectorText()), exceptionState);
+ RefPtrWillBeRawPtr<StaticElementList> elements = m_element->ownerDocument()->querySelectorAll(AtomicString(uniqRules[i]->selectorText()), exceptionState);
unsigned length = exceptionState.hadException() ? 0: elements->length();
selectors.append(std::make_pair(length, uniqRules[i]));
}
« Source/core/inspector/InspectorCSSAgent.cpp ('K') | « Source/core/inspector/InspectorCSSAgent.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698