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

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

Issue 1372963006: Devtools[LayoutEditor]: Always show medias in selector tooltip (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/inspector/LayoutEditor.cpp
diff --git a/third_party/WebKit/Source/core/inspector/LayoutEditor.cpp b/third_party/WebKit/Source/core/inspector/LayoutEditor.cpp
index 9608da9b64d15c5dd6c3ac467071078321b32ba2..9c4abd5c78527b009f281ea08feb103f1717db49 100644
--- a/third_party/WebKit/Source/core/inspector/LayoutEditor.cpp
+++ b/third_party/WebKit/Source/core/inspector/LayoutEditor.cpp
@@ -139,14 +139,6 @@ String truncateZeroes(const String& number)
return number.left(number.length() - removeCount);
}
-float toValidValue(CSSPropertyID propertyId, float newValue)
-{
- if (CSSPropertyPaddingBottom <= propertyId && propertyId <= CSSPropertyPaddingTop)
- return newValue >= 0 ? newValue : 0;
-
- return newValue;
-}
-
InspectorHighlightConfig affectedNodesHighlightConfig()
{
// TODO: find a better color
@@ -336,7 +328,8 @@ void LayoutEditor::overlayStartedPropertyChange(const String& anchorName)
void LayoutEditor::overlayPropertyChanged(float cssDelta)
{
if (m_changingProperty && m_factor) {
- float newValue = toValidValue(m_changingProperty, cssDelta / m_factor + m_propertyInitialValue);
+ float newValue = cssDelta / m_factor + m_propertyInitialValue;
+ newValue = newValue >= 0 ? newValue : 0;
m_isDirty |= setCSSPropertyValueInCurrentRule(truncateZeroes(String::format("%.2f", newValue)) + CSSPrimitiveValue::unitTypeToString(m_valueUnitType));
}
}
@@ -396,23 +389,13 @@ PassRefPtr<JSONObject> LayoutEditor::currentSelectorInfo() const
if (!ownerDocument->isActive() || currentStyleIsInline())
return object.release();
- bool hasSameSelectors = false;
- for (unsigned i = 0; i < m_matchedRules->length(); i++) {
- if (i != m_currentRuleIndex && toCSSStyleRule(m_matchedRules->item(i))->selectorText() == currentSelectorText) {
- hasSameSelectors = true;
- break;
- }
- }
+ Vector<String> medias;
+ buildMediaListChain(m_matchedRules->item(m_currentRuleIndex), medias);
+ RefPtr<JSONArray> mediasJSONArray = JSONArray::create();
+ for (size_t i = 0; i < medias.size(); ++i)
+ mediasJSONArray->pushString(medias[i]);
- if (hasSameSelectors) {
- Vector<String> medias;
- buildMediaListChain(m_matchedRules->item(m_currentRuleIndex), medias);
- RefPtr<JSONArray> mediasJSONArray = JSONArray::create();
- for (size_t i = 0; i < medias.size(); ++i)
- mediasJSONArray->pushString(medias[i]);
-
- object->setArray("medias", mediasJSONArray.release());
- }
+ object->setArray("medias", mediasJSONArray.release());
TrackExceptionState exceptionState;
RefPtrWillBeRawPtr<StaticElementList> elements = ownerDocument->querySelectorAll(AtomicString(currentSelectorText), exceptionState);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698