[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
apavlov at chromium.org
apavlov at chromium.org
Wed Dec 22 15:08:43 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit efb5bcc0c592c7fb1010232ba1bf8822ea7c04a4
Author: apavlov at chromium.org <apavlov at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Thu Oct 28 13:27:08 2010 +0000
2010-10-28 Alexander Pavlov <apavlov at chromium.org>
Reviewed by Pavel Feldman.
Web Inspector: Bring backend-frontend message format to follow the protocol specification
https://bugs.webkit.org/show_bug.cgi?id=48406
WebCore:
* inspector/InspectorDOMAgent.cpp:
(WebCore::InspectorDOMAgent::getStyles):
(WebCore::InspectorDOMAgent::applyStyleText):
(WebCore::InspectorDOMAgent::buildObjectForStyle):
(WebCore::InspectorDOMAgent::populateObjectWithStyleProperties):
(WebCore::InspectorDOMAgent::buildObjectForStyleSheet):
(WebCore::InspectorDOMAgent::buildObjectForRule):
* inspector/InspectorDOMAgent.h:
* inspector/front-end/AuditRules.js:
(WebInspector.AuditRules.UnusedCssRule.prototype.doRun.evalCallback.selectorsCallback):
(WebInspector.AuditRules.ImageDimensionsRule.prototype.doRun):
* inspector/front-end/CSSStyleModel.js:
(WebInspector.CSSStyleModel.parseRuleArrayPayload):
(WebInspector.CSSStyleModel.prototype.getStylesAsync):
(WebInspector.CSSStyleModel.prototype.getComputedStyleAsync):
(WebInspector.CSSStyleModel.prototype.getInlineStyleAsync):
(WebInspector.CSSStyleModel.prototype.setCSSText):
* inspector/front-end/DOMAgent.js:
(WebInspector.CSSStyleDeclaration):
(WebInspector.CSSStyleDeclaration.parsePayload):
(WebInspector.CSSStyleDeclaration.prototype.get allProperties):
(WebInspector.CSSStyleDeclaration.prototype.getLiveProperty):
(WebInspector.CSSStyleDeclaration.prototype.getPropertyValue):
(WebInspector.CSSStyleDeclaration.prototype.getPropertyPriority):
(WebInspector.CSSStyleDeclaration.prototype.getPropertyShorthand):
(WebInspector.CSSStyleDeclaration.prototype.isPropertyImplicit):
(WebInspector.CSSStyleDeclaration.prototype.getShorthandValue):
(WebInspector.CSSStyleDeclaration.prototype.getShorthandPriority):
(WebInspector.CSSStyleDeclaration.prototype.appendProperty):
(WebInspector.CSSStyleDeclaration.prototype.propertyAt):
(WebInspector.CSSRule):
(WebInspector.CSSRule.parsePayload):
(WebInspector.CSSRule.prototype.get isUserAgent):
(WebInspector.CSSRule.prototype.get isUser):
(WebInspector.CSSRule.prototype.get isViaInspector):
(WebInspector.CSSRule.prototype.get isRegular):
(WebInspector.CSSProperty):
(WebInspector.CSSProperty.parsePayload):
(WebInspector.CSSProperty.prototype.get propertyText):
(WebInspector.CSSProperty.prototype.get isLive):
(WebInspector.CSSProperty.prototype.get active):
(WebInspector.CSSProperty.prototype.get styleBased):
(WebInspector.CSSProperty.prototype.get inactive):
(WebInspector.CSSProperty.prototype.get disabled):
(WebInspector.CSSProperty.prototype.setText):
(WebInspector.CSSProperty.prototype.setValue):
(WebInspector.CSSProperty.prototype.setDisabled.callback):
(WebInspector.CSSProperty.prototype.setDisabled):
* inspector/front-end/MetricsSidebarPane.js:
(WebInspector.MetricsSidebarPane.prototype.update.callback):
(WebInspector.MetricsSidebarPane.prototype.update.inlineStyleCallback):
(WebInspector.MetricsSidebarPane.prototype.update):
(WebInspector.MetricsSidebarPane.prototype._update):
(WebInspector.MetricsSidebarPane.prototype.editingCommitted.callback):
(WebInspector.MetricsSidebarPane.prototype.editingCommitted.setEnabledValueCallback):
(WebInspector.MetricsSidebarPane.prototype.editingCommitted):
* inspector/front-end/StylesSidebarPane.js:
(WebInspector.StylesSidebarPane.prototype.update):
(WebInspector.StylesSidebarPane.prototype._rebuildUpdate):
(WebInspector.StylesSidebarPane.prototype._refreshStyleRules):
(WebInspector.StylesSidebarPane.prototype._rebuildStyleRules):
(WebInspector.StylesSidebarPane.prototype._markUsedProperties):
(WebInspector.StylesSidebarPane.prototype._containsInherited):
(WebInspector.StylePropertiesSection):
(WebInspector.StylePropertiesSection.prototype.isPropertyInherited):
(WebInspector.StylePropertiesSection.prototype.isPropertyOverloaded):
(WebInspector.StylePropertiesSection.prototype.onpopulate):
(WebInspector.StylePropertiesSection.prototype.addNewBlankProperty):
(WebInspector.StylePropertiesSection.prototype.editingSelectorCommitted.successCallback):
(WebInspector.StylePropertiesSection.prototype.editingSelectorCommitted):
(WebInspector.ComputedStylePropertiesSection.prototype._isPropertyInherited):
(WebInspector.ComputedStylePropertiesSection.prototype.onpopulate):
(WebInspector.ComputedStylePropertiesSection.prototype.rebuildComputedTrace):
(WebInspector.StylePropertyTreeElement):
(WebInspector.StylePropertyTreeElement.prototype.get disabled):
(WebInspector.StylePropertyTreeElement.prototype.get name):
(WebInspector.StylePropertyTreeElement.prototype.get priority):
(WebInspector.StylePropertyTreeElement.prototype.get value):
(WebInspector.StylePropertyTreeElement.prototype.get parsedOk):
(WebInspector.StylePropertyTreeElement.prototype):
(WebInspector.StylePropertyTreeElement.prototype.):
LayoutTests:
* http/tests/inspector/inspect-iframe-from-different-domain.html:
* inspector/styles-source-offsets.html:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@70772 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index b3da768..1b3e026 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,13 @@
+2010-10-28 Alexander Pavlov <apavlov at chromium.org>
+
+ Reviewed by Pavel Feldman.
+
+ Web Inspector: Bring backend-frontend message format to follow the protocol specification
+ https://bugs.webkit.org/show_bug.cgi?id=48406
+
+ * http/tests/inspector/inspect-iframe-from-different-domain.html:
+ * inspector/styles-source-offsets.html:
+
2010-10-28 Mikhail Naganov <mnaganov at chromium.org>
[Chromium] Unreviewed test expectations update.
diff --git a/LayoutTests/http/tests/inspector/inspect-iframe-from-different-domain.html b/LayoutTests/http/tests/inspector/inspect-iframe-from-different-domain.html
index 128b48f..46d5e0e 100644
--- a/LayoutTests/http/tests/inspector/inspect-iframe-from-different-domain.html
+++ b/LayoutTests/http/tests/inspector/inspect-iframe-from-different-domain.html
@@ -77,7 +77,7 @@ function frontend_dumpIFrameBackground(testController)
}
for (var i = styles.matchedCSSRules.length - 1; i >= 0; --i) {
- var rule = WebInspector.CSSStyleDeclaration.parseRule(styles.matchedCSSRules[i]);
+ var rule = WebInspector.CSSRule.parsePayload(styles.matchedCSSRules[i]);
if (rule.isUser || rule.isUserAgent)
continue;
var bg = rule.style.getShorthandValue("background");
diff --git a/LayoutTests/inspector/styles-source-offsets.html b/LayoutTests/inspector/styles-source-offsets.html
index 02c7929..746e7e8 100644
--- a/LayoutTests/inspector/styles-source-offsets.html
+++ b/LayoutTests/inspector/styles-source-offsets.html
@@ -37,9 +37,9 @@ function frontend_runTest(testController)
var matchedCSSRules = styles.matchedCSSRules;
for (var i = 0; i < matchedCSSRules.length; ++i) {
var rule = matchedCSSRules[i];
- InspectorBackend.getStyleSourceData(rule.style.id, frontend_styleDataReceived.bind(null, testController, rule, false));
+ InspectorBackend.getStyleSourceData(rule.style.styleId, frontend_styleDataReceived.bind(null, testController, rule, false));
}
- InspectorBackend.getStyleSourceData(styles.inlineStyle.id, frontend_styleDataReceived.bind(null, testController, styles.inlineStyle, true));
+ InspectorBackend.getStyleSourceData(styles.inlineStyle.styleId, frontend_styleDataReceived.bind(null, testController, styles.inlineStyle, true));
}
InspectorBackend.getStyles(WebInspector.domAgent.document.body.id, true, stylesCallback.bind(null, testController));
});
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 894b832..430223b 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,92 @@
+2010-10-28 Alexander Pavlov <apavlov at chromium.org>
+
+ Reviewed by Pavel Feldman.
+
+ Web Inspector: Bring backend-frontend message format to follow the protocol specification
+ https://bugs.webkit.org/show_bug.cgi?id=48406
+
+ * inspector/InspectorDOMAgent.cpp:
+ (WebCore::InspectorDOMAgent::getStyles):
+ (WebCore::InspectorDOMAgent::applyStyleText):
+ (WebCore::InspectorDOMAgent::buildObjectForStyle):
+ (WebCore::InspectorDOMAgent::populateObjectWithStyleProperties):
+ (WebCore::InspectorDOMAgent::buildObjectForStyleSheet):
+ (WebCore::InspectorDOMAgent::buildObjectForRule):
+ * inspector/InspectorDOMAgent.h:
+ * inspector/front-end/AuditRules.js:
+ (WebInspector.AuditRules.UnusedCssRule.prototype.doRun.evalCallback.selectorsCallback):
+ (WebInspector.AuditRules.ImageDimensionsRule.prototype.doRun):
+ * inspector/front-end/CSSStyleModel.js:
+ (WebInspector.CSSStyleModel.parseRuleArrayPayload):
+ (WebInspector.CSSStyleModel.prototype.getStylesAsync):
+ (WebInspector.CSSStyleModel.prototype.getComputedStyleAsync):
+ (WebInspector.CSSStyleModel.prototype.getInlineStyleAsync):
+ (WebInspector.CSSStyleModel.prototype.setCSSText):
+ * inspector/front-end/DOMAgent.js:
+ (WebInspector.CSSStyleDeclaration):
+ (WebInspector.CSSStyleDeclaration.parsePayload):
+ (WebInspector.CSSStyleDeclaration.prototype.get allProperties):
+ (WebInspector.CSSStyleDeclaration.prototype.getLiveProperty):
+ (WebInspector.CSSStyleDeclaration.prototype.getPropertyValue):
+ (WebInspector.CSSStyleDeclaration.prototype.getPropertyPriority):
+ (WebInspector.CSSStyleDeclaration.prototype.getPropertyShorthand):
+ (WebInspector.CSSStyleDeclaration.prototype.isPropertyImplicit):
+ (WebInspector.CSSStyleDeclaration.prototype.getShorthandValue):
+ (WebInspector.CSSStyleDeclaration.prototype.getShorthandPriority):
+ (WebInspector.CSSStyleDeclaration.prototype.appendProperty):
+ (WebInspector.CSSStyleDeclaration.prototype.propertyAt):
+ (WebInspector.CSSRule):
+ (WebInspector.CSSRule.parsePayload):
+ (WebInspector.CSSRule.prototype.get isUserAgent):
+ (WebInspector.CSSRule.prototype.get isUser):
+ (WebInspector.CSSRule.prototype.get isViaInspector):
+ (WebInspector.CSSRule.prototype.get isRegular):
+ (WebInspector.CSSProperty):
+ (WebInspector.CSSProperty.parsePayload):
+ (WebInspector.CSSProperty.prototype.get propertyText):
+ (WebInspector.CSSProperty.prototype.get isLive):
+ (WebInspector.CSSProperty.prototype.get active):
+ (WebInspector.CSSProperty.prototype.get styleBased):
+ (WebInspector.CSSProperty.prototype.get inactive):
+ (WebInspector.CSSProperty.prototype.get disabled):
+ (WebInspector.CSSProperty.prototype.setText):
+ (WebInspector.CSSProperty.prototype.setValue):
+ (WebInspector.CSSProperty.prototype.setDisabled.callback):
+ (WebInspector.CSSProperty.prototype.setDisabled):
+ * inspector/front-end/MetricsSidebarPane.js:
+ (WebInspector.MetricsSidebarPane.prototype.update.callback):
+ (WebInspector.MetricsSidebarPane.prototype.update.inlineStyleCallback):
+ (WebInspector.MetricsSidebarPane.prototype.update):
+ (WebInspector.MetricsSidebarPane.prototype._update):
+ (WebInspector.MetricsSidebarPane.prototype.editingCommitted.callback):
+ (WebInspector.MetricsSidebarPane.prototype.editingCommitted.setEnabledValueCallback):
+ (WebInspector.MetricsSidebarPane.prototype.editingCommitted):
+ * inspector/front-end/StylesSidebarPane.js:
+ (WebInspector.StylesSidebarPane.prototype.update):
+ (WebInspector.StylesSidebarPane.prototype._rebuildUpdate):
+ (WebInspector.StylesSidebarPane.prototype._refreshStyleRules):
+ (WebInspector.StylesSidebarPane.prototype._rebuildStyleRules):
+ (WebInspector.StylesSidebarPane.prototype._markUsedProperties):
+ (WebInspector.StylesSidebarPane.prototype._containsInherited):
+ (WebInspector.StylePropertiesSection):
+ (WebInspector.StylePropertiesSection.prototype.isPropertyInherited):
+ (WebInspector.StylePropertiesSection.prototype.isPropertyOverloaded):
+ (WebInspector.StylePropertiesSection.prototype.onpopulate):
+ (WebInspector.StylePropertiesSection.prototype.addNewBlankProperty):
+ (WebInspector.StylePropertiesSection.prototype.editingSelectorCommitted.successCallback):
+ (WebInspector.StylePropertiesSection.prototype.editingSelectorCommitted):
+ (WebInspector.ComputedStylePropertiesSection.prototype._isPropertyInherited):
+ (WebInspector.ComputedStylePropertiesSection.prototype.onpopulate):
+ (WebInspector.ComputedStylePropertiesSection.prototype.rebuildComputedTrace):
+ (WebInspector.StylePropertyTreeElement):
+ (WebInspector.StylePropertyTreeElement.prototype.get disabled):
+ (WebInspector.StylePropertyTreeElement.prototype.get name):
+ (WebInspector.StylePropertyTreeElement.prototype.get priority):
+ (WebInspector.StylePropertyTreeElement.prototype.get value):
+ (WebInspector.StylePropertyTreeElement.prototype.get parsedOk):
+ (WebInspector.StylePropertyTreeElement.prototype):
+ (WebInspector.StylePropertyTreeElement.prototype.):
+
2010-10-27 MORITA Hajime <morrita at google.com>
Reviewed by Kent Tamura.
diff --git a/WebCore/inspector/InspectorDOMAgent.cpp b/WebCore/inspector/InspectorDOMAgent.cpp
index f5c5f8b..cfb55fc 100644
--- a/WebCore/inspector/InspectorDOMAgent.cpp
+++ b/WebCore/inspector/InspectorDOMAgent.cpp
@@ -1219,11 +1219,11 @@ void InspectorDOMAgent::getStyles(long nodeId, bool authorOnly, RefPtr<Inspector
result->setObject("styleAttributes", buildObjectForAttributeStyles(element));
result->setArray("pseudoElements", buildArrayForPseudoElements(element, authorOnly));
- RefPtr<InspectorObject> currentStyle = result;
+ RefPtr<InspectorArray> inheritedStyles = InspectorArray::create();
Element* parentElement = element->parentElement();
while (parentElement) {
RefPtr<InspectorObject> parentStyle = InspectorObject::create();
- currentStyle->setObject("parent", parentStyle);
+ inheritedStyles->pushObject(parentStyle);
if (parentElement->style() && parentElement->style()->length())
parentStyle->setObject("inlineStyle", buildObjectForStyle(parentElement->style(), true));
@@ -1232,8 +1232,8 @@ void InspectorDOMAgent::getStyles(long nodeId, bool authorOnly, RefPtr<Inspector
parentStyle->setArray("matchedCSSRules", buildArrayForCSSRules(parentElement->ownerDocument(), parentMatchedRules.get()));
parentElement = parentElement->parentElement();
- currentStyle = parentStyle;
}
+ result->setArray("inherited", inheritedStyles);
*styles = result.release();
}
@@ -1396,6 +1396,7 @@ void InspectorDOMAgent::applyStyleText(long styleId, const String& styleText, co
// Notify caller that the property was successfully deleted.
if (!styleTextLength) {
*success = true;
+ *styleObject = buildObjectForStyle(style, true);
return;
}
@@ -1544,18 +1545,15 @@ PassRefPtr<InspectorObject> InspectorDOMAgent::buildObjectForStyle(CSSStyleDecla
{
RefPtr<InspectorObject> result = InspectorObject::create();
if (bind) {
- long styleId = cssStore()->bindStyle(style);
- result->setNumber("id", styleId);
- CSSStyleSheet* parentStyleSheet = InspectorCSSStore::getParentStyleSheet(style);
- if (parentStyleSheet)
- result->setNumber("parentStyleSheetId", cssStore()->bindStyleSheet(parentStyleSheet));
-
- DisabledStyleDeclaration* disabledStyle = cssStore()->disabledStyleForId(styleId, false);
- if (disabledStyle)
- result->setArray("disabled", buildArrayForDisabledStyleProperties(disabledStyle));
+ result->setNumber("styleId", cssStore()->bindStyle(style));
+ CSSStyleSheet* styleSheet = InspectorCSSStore::getParentStyleSheet(style);
+ if (styleSheet)
+ result->setNumber("styleSheetId", cssStore()->bindStyleSheet(styleSheet));
}
- result->setString("width", style->getPropertyValue("width"));
- result->setString("height", style->getPropertyValue("height"));
+ RefPtr<InspectorObject> properties = InspectorObject::create();
+ properties->setString("width", style->getPropertyValue("width"));
+ properties->setString("height", style->getPropertyValue("height"));
+ result->setObject("properties", properties);
populateObjectWithStyleProperties(style, result.get());
return result.release();
}
@@ -1569,44 +1567,55 @@ void InspectorDOMAgent::populateObjectWithStyleProperties(CSSStyleDeclaration* s
for (unsigned i = 0; i < style->length(); ++i) {
RefPtr<InspectorObject> property = InspectorObject::create();
String name = style->item(i);
+ String value = style->getPropertyValue(name);
+ String priority = style->getPropertyPriority(name);
property->setString("name", name);
- property->setString("priority", style->getPropertyPriority(name));
+ property->setString("value", value);
+ property->setString("priority", priority);
+ property->setString("text", name + ": " + value + (priority.length() ? " !" + priority : "") + ";");
property->setBoolean("implicit", style->isPropertyImplicit(name));
+ property->setBoolean("parsedOk", true);
+ property->setString("status", "style");
String shorthand = style->getPropertyShorthand(name);
- property->setString("shorthand", shorthand);
+ property->setString("shorthandName", shorthand);
if (!shorthand.isEmpty() && !foundShorthands.contains(shorthand)) {
foundShorthands.add(shorthand);
shorthandValues->setString(shorthand, shorthandValue(style, shorthand));
}
- property->setString("value", style->getPropertyValue(name));
properties->pushObject(property.release());
}
- result->setArray("properties", properties);
+ result->setArray("cssProperties", properties);
+ result->setString("cssText", style->cssText());
result->setObject("shorthandValues", shorthandValues);
-}
-PassRefPtr<InspectorArray> InspectorDOMAgent::buildArrayForDisabledStyleProperties(DisabledStyleDeclaration* declaration)
-{
- RefPtr<InspectorArray> properties = InspectorArray::create();
- for (DisabledStyleDeclaration::iterator it = declaration->begin(); it != declaration->end(); ++it) {
+ DisabledStyleDeclaration* disabledStyle = cssStore()->disabledStyleForId(cssStore()->bindStyle(style), false);
+ if (!disabledStyle)
+ return;
+
+ for (DisabledStyleDeclaration::iterator it = disabledStyle->begin(); it != disabledStyle->end(); ++it) {
RefPtr<InspectorObject> property = InspectorObject::create();
- property->setString("name", it->first);
- property->setString("value", it->second.first);
- property->setString("priority", it->second.second);
+ String name = it->first;
+ String value = it->second.first;
+ String priority = it->second.second;
+ property->setString("name", name);
+ property->setString("value", value);
+ property->setString("priority", priority);
+ property->setString("text", name + ": " + value + (priority.length() ? " !" + priority : "") + ";");
+ property->setBoolean("implicit", false);
+ property->setBoolean("parsedOk", true);
+ property->setString("status", "disabled");
properties->pushObject(property.release());
}
- return properties.release();
}
PassRefPtr<InspectorObject> InspectorDOMAgent::buildObjectForStyleSheet(Document* ownerDocument, CSSStyleSheet* styleSheet)
{
RefPtr<InspectorObject> result = InspectorObject::create();
long id = cssStore()->bindStyleSheet(styleSheet);
- result->setNumber("id", id);
- result->setBoolean("disabled", styleSheet->disabled());
- result->setString("href", styleSheet->href());
+ result->setNumber("styleSheetId", id);
+ result->setString("sourceURL", styleSheet->href());
result->setString("title", styleSheet->title());
- result->setNumber("documentElementId", m_documentNodeToIdMap.get(styleSheet->document()));
+ result->setBoolean("disabled", styleSheet->disabled());
RefPtr<InspectorArray> cssRules = InspectorArray::create();
PassRefPtr<CSSRuleList> cssRuleList = CSSRuleList::create(styleSheet, true);
if (cssRuleList) {
@@ -1616,7 +1625,7 @@ PassRefPtr<InspectorObject> InspectorDOMAgent::buildObjectForStyleSheet(Document
cssRules->pushObject(buildObjectForRule(ownerDocument, static_cast<CSSStyleRule*>(rule)));
}
}
- result->setArray("cssRules", cssRules.release());
+ result->setArray("rules", cssRules.release());
return result.release();
}
@@ -1626,27 +1635,28 @@ PassRefPtr<InspectorObject> InspectorDOMAgent::buildObjectForRule(Document* owne
RefPtr<InspectorObject> result = InspectorObject::create();
result->setString("selectorText", rule->selectorText());
- result->setString("cssText", rule->cssText());
result->setNumber("sourceLine", rule->sourceLine());
- result->setString("documentURL", documentURLString(ownerDocument));
- if (parentStyleSheet) {
- RefPtr<InspectorObject> parentStyleSheetValue = InspectorObject::create();
- parentStyleSheetValue->setString("href", parentStyleSheet->href());
- parentStyleSheetValue->setNumber("id", cssStore()->bindStyleSheet(parentStyleSheet));
- result->setObject("parentStyleSheet", parentStyleSheetValue.release());
- }
- bool isUserAgent = parentStyleSheet && !parentStyleSheet->ownerNode() && parentStyleSheet->href().isEmpty();
- bool isUser = parentStyleSheet && parentStyleSheet->ownerNode() && parentStyleSheet->ownerNode()->nodeName() == "#document";
- result->setBoolean("isUserAgent", isUserAgent);
- result->setBoolean("isUser", isUser);
- result->setBoolean("isViaInspector", rule->parentStyleSheet() == cssStore()->inspectorStyleSheet(ownerDocument, false));
+
+ String origin;
+ bool canBind = true;
+ if (parentStyleSheet && !parentStyleSheet->ownerNode() && parentStyleSheet->href().isEmpty()) {
+ origin = "user-agent";
+ canBind = false;
+ } else if (parentStyleSheet && parentStyleSheet->ownerNode() && parentStyleSheet->ownerNode()->nodeName() == "#document") {
+ origin = "user";
+ canBind = false;
+ } else if (rule->parentStyleSheet() == cssStore()->inspectorStyleSheet(ownerDocument, false))
+ origin = "inspector";
+ result->setString("origin", origin);
+
+ if (origin.isEmpty())
+ result->setString("sourceURL", parentStyleSheet && !parentStyleSheet->href().isEmpty() ? parentStyleSheet->href() : (ownerDocument ? ownerDocument->url().string() : ""));
// Bind editable scripts only.
- bool bind = !isUserAgent && !isUser;
- result->setObject("style", buildObjectForStyle(rule->style(), bind));
+ result->setObject("style", buildObjectForStyle(rule->style(), canBind));
- if (bind)
- result->setNumber("id", cssStore()->bindRule(rule));
+ if (canBind)
+ result->setNumber("ruleId", cssStore()->bindRule(rule));
return result.release();
}
diff --git a/WebCore/inspector/InspectorDOMAgent.h b/WebCore/inspector/InspectorDOMAgent.h
index 03e4d8d..6c5fd4b 100644
--- a/WebCore/inspector/InspectorDOMAgent.h
+++ b/WebCore/inspector/InspectorDOMAgent.h
@@ -207,7 +207,6 @@ namespace WebCore {
PassRefPtr<InspectorObject> buildObjectForStyle(CSSStyleDeclaration*, bool bind);
void populateObjectWithStyleProperties(CSSStyleDeclaration*, InspectorObject* result);
- PassRefPtr<InspectorArray> buildArrayForDisabledStyleProperties(DisabledStyleDeclaration*);
PassRefPtr<InspectorObject> buildObjectForRule(Document* ownerDocument, CSSStyleRule*);
PassRefPtr<InspectorObject> buildObjectForStyleSheet(Document* ownerDocument, CSSStyleSheet*);
Vector<String> longhandProperties(CSSStyleDeclaration*, const String& shorthandProperty);
diff --git a/WebCore/inspector/front-end/AuditRules.js b/WebCore/inspector/front-end/AuditRules.js
index cd9f13e..515ce8e 100644
--- a/WebCore/inspector/front-end/AuditRules.js
+++ b/WebCore/inspector/front-end/AuditRules.js
@@ -286,8 +286,8 @@ WebInspector.AuditRules.UnusedCssRule.prototype = {
var testedSelectors = {};
for (var i = 0; i < styleSheets.length; ++i) {
var styleSheet = styleSheets[i];
- for (var curRule = 0; curRule < styleSheet.cssRules.length; ++curRule) {
- var rule = styleSheet.cssRules[curRule];
+ for (var curRule = 0; curRule < styleSheet.rules.length; ++curRule) {
+ var rule = styleSheet.rules[curRule];
if (rule.selectorText.match(pseudoSelectorRegexp))
continue;
selectors.push(rule.selectorText);
@@ -307,9 +307,10 @@ WebInspector.AuditRules.UnusedCssRule.prototype = {
var stylesheetSize = 0;
var unusedStylesheetSize = 0;
var unusedRules = [];
- for (var curRule = 0; curRule < styleSheet.cssRules.length; ++curRule) {
- var rule = styleSheet.cssRules[curRule];
- var textLength = rule.cssText ? rule.cssText.length : 0;
+ for (var curRule = 0; curRule < styleSheet.rules.length; ++curRule) {
+ var rule = styleSheet.rules[curRule];
+ // FIXME: replace this by an exact computation once source ranges are available
+ var textLength = rule.style.cssText ? rule.style.cssText.length + rule.selectorText.length : 0;
stylesheetSize += textLength;
if (!testedSelectors[rule.selectorText] || foundSelectors[rule.selectorText])
continue;
@@ -322,7 +323,7 @@ WebInspector.AuditRules.UnusedCssRule.prototype = {
if (!unusedRules.length)
continue;
- var url = styleSheet.href ? WebInspector.AuditRuleResult.linkifyDisplayName(styleSheet.href) : String.sprintf("Inline block #%d", ++inlineBlockOrdinal);
+ var url = styleSheet.sourceURL ? WebInspector.AuditRuleResult.linkifyDisplayName(styleSheet.sourceURL) : String.sprintf("Inline block #%d", ++inlineBlockOrdinal);
var pctUnused = Math.round(100 * unusedStylesheetSize / stylesheetSize);
if (!summary)
summary = result.addChild("", true);
@@ -657,7 +658,7 @@ WebInspector.AuditRules.ImageDimensionsRule.prototype = {
if (completeSrc)
src = completeSrc;
- const computedStyle = new WebInspector.CSSStyleDeclaration(styles.computedStyle);
+ const computedStyle = WebInspector.CSSStyleDeclaration.parsePayload(styles.computedStyle);
if (computedStyle.getPropertyValue("position") === "absolute") {
if (!context.imagesLeft)
doneCallback(context);
@@ -668,7 +669,7 @@ WebInspector.AuditRules.ImageDimensionsRule.prototype = {
var heightFound = "height" in styles.styleAttributes;
for (var i = styles.matchedCSSRules.length - 1; i >= 0 && !(widthFound && heightFound); --i) {
- var style = WebInspector.CSSStyleDeclaration.parseRule(styles.matchedCSSRules[i]).style;
+ var style = WebInspector.CSSRule.parsePayload(styles.matchedCSSRules[i]).style;
if (style.getPropertyValue("width") !== "")
widthFound = true;
if (style.getPropertyValue("height") !== "")
diff --git a/WebCore/inspector/front-end/CSSStyleModel.js b/WebCore/inspector/front-end/CSSStyleModel.js
index e3e9b4f..702c923 100644
--- a/WebCore/inspector/front-end/CSSStyleModel.js
+++ b/WebCore/inspector/front-end/CSSStyleModel.js
@@ -32,15 +32,84 @@ WebInspector.CSSStyleModel = function()
{
}
+WebInspector.CSSStyleModel.parseRuleArrayPayload = function(ruleArray)
+{
+ var result = [];
+ for (var i = 0; i < ruleArray.length; ++i)
+ result.push(WebInspector.CSSRule.parsePayload(ruleArray[i]));
+ return result;
+}
+
WebInspector.CSSStyleModel.prototype = {
- getStylesAsync: function(nodeId, authOnly, userCallback)
+ getStylesAsync: function(nodeId, userCallback)
{
- InspectorBackend.getStyles(nodeId, authOnly, userCallback);
+ function callback(userCallback, payload)
+ {
+ if (!payload) {
+ if (userCallback)
+ userCallback(null);
+ return;
+ }
+
+ var result = {};
+ if ("inlineStyle" in payload)
+ result.inlineStyle = WebInspector.CSSStyleDeclaration.parsePayload(payload.inlineStyle);
+
+ result.computedStyle = WebInspector.CSSStyleDeclaration.parsePayload(payload.computedStyle);
+ result.matchedCSSRules = WebInspector.CSSStyleModel.parseRuleArrayPayload(payload.matchedCSSRules);
+
+ result.styleAttributes = {};
+ for (var name in payload.styleAttributes)
+ result.styleAttributes[name] = WebInspector.CSSStyleDeclaration.parsePayload(payload.styleAttributes[name]);
+
+ result.pseudoElements = [];
+ for (var i = 0; i < payload.pseudoElements.length; ++i) {
+ var entryPayload = payload.pseudoElements[i];
+ result.pseudoElements.push({ pseudoId: entryPayload.pseudoId, rules: WebInspector.CSSStyleModel.parseRuleArrayPayload(entryPayload.rules) });
+ }
+
+ result.inherited = [];
+ for (var i = 0; i < payload.inherited.length; ++i) {
+ var entryPayload = payload.inherited[i];
+ var entry = {};
+ if ("inlineStyle" in entryPayload)
+ entry.inlineStyle = WebInspector.CSSStyleDeclaration.parsePayload(entryPayload.inlineStyle);
+ if ("matchedCSSRules" in entryPayload)
+ entry.matchedCSSRules = WebInspector.CSSStyleModel.parseRuleArrayPayload(entryPayload.matchedCSSRules);
+ result.inherited.push(entry);
+ }
+
+ if (userCallback)
+ userCallback(result);
+ }
+
+ InspectorBackend.getStyles(nodeId, false, callback.bind(null, userCallback));
},
getComputedStyleAsync: function(nodeId, userCallback)
{
- InspectorBackend.getComputedStyle(nodeId, userCallback);
+ function callback(userCallback, stylePayload)
+ {
+ if (!stylePayload)
+ userCallback(null);
+ else
+ userCallback(WebInspector.CSSStyleDeclaration.parsePayload(stylePayload));
+ }
+
+ InspectorBackend.getComputedStyle(nodeId, callback.bind(null, userCallback));
+ },
+
+ getInlineStyleAsync: function(nodeId, userCallback)
+ {
+ function callback(userCallback, stylePayload)
+ {
+ if (!stylePayload)
+ userCallback(null);
+ else
+ userCallback(WebInspector.CSSStyleDeclaration.parsePayload(stylePayload));
+ }
+
+ InspectorBackend.getInlineStyle(nodeId, callback.bind(null, userCallback));
},
setRuleSelector: function(ruleId, newContent, nodeId, successCallback, failureCallback)
@@ -73,39 +142,8 @@ WebInspector.CSSStyleModel.prototype = {
InspectorBackend.addRule(newContent, nodeId, callback);
},
- toggleStyleEnabled: function(styleId, propertyName, disabled, userCallback)
- {
- function callback(newPayload)
- {
- if (!newPayload) {
- userCallback(null);
- return;
- }
-
- var newStyle = WebInspector.CSSStyleDeclaration.parseStyle(newPayload);
- userCallback(newStyle);
- }
-
- InspectorBackend.toggleStyleEnabled(styleId, propertyName, disabled, callback);
- },
-
setCSSText: function(styleId, cssText)
{
InspectorBackend.setStyleText(styleId, cssText);
- },
-
- applyStyleText: function(styleId, styleText, propertyName, successCallback, failureCallback)
- {
- function callback(success, newPayload)
- {
- if (!success)
- failureCallback();
- else {
- var newStyle = newPayload ? WebInspector.CSSStyleDeclaration.parseStyle(newPayload) : null;
- successCallback(newStyle);
- }
- }
-
- InspectorBackend.applyStyleText(styleId, styleText, propertyName, callback);
}
}
diff --git a/WebCore/inspector/front-end/DOMAgent.js b/WebCore/inspector/front-end/DOMAgent.js
index 5153fb1..470e775 100644
--- a/WebCore/inspector/front-end/DOMAgent.js
+++ b/WebCore/inspector/front-end/DOMAgent.js
@@ -526,90 +526,78 @@ WebInspector.EventListeners.getEventListenersForNodeAsync = function(node, callb
WebInspector.CSSStyleDeclaration = function(payload)
{
- this.id = payload.id;
- this.parentStyleSheetId = payload.parentStyleSheetId;
- this.width = payload.width;
- this.height = payload.height;
- this.__disabledProperties = {};
- this.__disabledPropertyValues = {};
- this.__disabledPropertyPriorities = {};
- if (payload.disabled) {
- for (var i = 0; i < payload.disabled.length; ++i) {
- var property = payload.disabled[i];
- this.__disabledProperties[property.name] = true;
- this.__disabledPropertyValues[property.name] = property.value;
- this.__disabledPropertyPriorities[property.name] = property.priority;
- }
- }
-
+ this.id = payload.styleId;
+ this.properties = payload.properties;
this._shorthandValues = payload.shorthandValues;
- this._propertyMap = {};
- this._longhandProperties = {};
- this.length = payload.properties.length;
-
- for (var i = 0; i < this.length; ++i) {
- var property = payload.properties[i];
+ this._livePropertyMap = {}; // LIVE properties (source-based or style-based) : { name -> CSSProperty }
+ this._allProperties = []; // ALL properties: [ CSSProperty ]
+ this._longhandProperties = {}; // shorthandName -> [ CSSProperty ]
+ this.__disabledProperties = {}; // DISABLED properties: { index -> CSSProperty }
+ var payloadPropertyCount = payload.cssProperties.length;
+
+ var propertyIndex = 0;
+ for (var i = 0; i < payloadPropertyCount; ++i) {
+ var property = new WebInspector.CSSProperty.parsePayload(this, i, payload.cssProperties[i]);
+ this._allProperties.push(property);
+ if (property.disabled)
+ this.__disabledProperties[i] = property;
+ if (!property.active && !property.styleBased)
+ continue;
var name = property.name;
- this[i] = name;
- this._propertyMap[name] = property;
+ this[propertyIndex] = name;
+ this._livePropertyMap[name] = property;
// Index longhand properties.
- if (property.shorthand) {
+ if (property.shorthand) { // only for parsed
var longhands = this._longhandProperties[property.shorthand];
if (!longhands) {
longhands = [];
this._longhandProperties[property.shorthand] = longhands;
}
- longhands.push(name);
+ longhands.push(property);
}
+ ++propertyIndex;
}
+ this.length = propertyIndex;
}
-WebInspector.CSSStyleDeclaration.parseStyle = function(payload)
+WebInspector.CSSStyleDeclaration.parsePayload = function(payload)
{
return new WebInspector.CSSStyleDeclaration(payload);
}
-WebInspector.CSSStyleDeclaration.parseRule = function(payload)
-{
- var rule = {};
- rule.id = payload.id;
- rule.selectorText = payload.selectorText;
- rule.style = new WebInspector.CSSStyleDeclaration(payload.style);
- rule.style.parentRule = rule;
- rule.isUserAgent = payload.isUserAgent;
- rule.isUser = payload.isUser;
- rule.isViaInspector = payload.isViaInspector;
- rule.sourceLine = payload.sourceLine;
- rule.documentURL = payload.documentURL;
- if (payload.parentStyleSheet)
- rule.parentStyleSheet = { href: payload.parentStyleSheet.href };
-
- return rule;
-}
-
WebInspector.CSSStyleDeclaration.prototype = {
+ get allProperties()
+ {
+ return this._allProperties;
+ },
+
+ getLiveProperty: function(name)
+ {
+ return this._livePropertyMap[name];
+ },
+
getPropertyValue: function(name)
{
- var property = this._propertyMap[name];
+ var property = this._livePropertyMap[name];
return property ? property.value : "";
},
getPropertyPriority: function(name)
{
- var property = this._propertyMap[name];
+ var property = this._livePropertyMap[name];
return property ? property.priority : "";
},
getPropertyShorthand: function(name)
{
- var property = this._propertyMap[name];
+ var property = this._livePropertyMap[name];
return property ? property.shorthand : "";
},
isPropertyImplicit: function(name)
{
- var property = this._propertyMap[name];
+ var property = this._livePropertyMap[name];
return property ? property.implicit : "";
},
@@ -651,7 +639,8 @@ WebInspector.CSSStyleDeclaration.prototype = {
getShorthandValue: function(shorthandProperty)
{
- return this._shorthandValues[shorthandProperty];
+ var property = this.getLiveProperty(shorthandProperty);
+ return property ? property.value : this._shorthandValues[shorthandProperty];
},
getShorthandPriority: function(shorthandProperty)
@@ -662,6 +651,166 @@ WebInspector.CSSStyleDeclaration.prototype = {
var longhands = this._longhandProperties[shorthandProperty];
return longhands ? this.getPropertyPriority(longhands[0]) : null;
+ },
+
+ appendProperty: function(propertyName, propertyValue, userCallback)
+ {
+ function setPropertyCallback(userCallback, success, stylePayload)
+ {
+ if (!success)
+ userCallback(null);
+ else
+ userCallback(WebInspector.CSSStyleDeclaration.parsePayload(stylePayload));
+ }
+
+ // FIXME(apavlov): this should be migrated to the new InspectorCSSAgent API once it is enabled.
+ InspectorBackend.applyStyleText(this.id, propertyName + ": " + propertyValue + ";", propertyName, setPropertyCallback.bind(this, userCallback));
+ },
+
+ propertyAt: function(index)
+ {
+ return (index < this.allProperties.length) ? this.allProperties[index] : null;
+ }
+}
+
+WebInspector.CSSRule = function(payload)
+{
+ this.id = payload.ruleId;
+ this.selectorText = payload.selectorText;
+ this.sourceLine = payload.sourceLine;
+ this.sourceURL = payload.sourceURL;
+ this.origin = payload.origin;
+ this.style = WebInspector.CSSStyleDeclaration.parsePayload(payload.style);
+ this.style.parentRule = this;
+}
+
+WebInspector.CSSRule.parsePayload = function(payload)
+{
+ return new WebInspector.CSSRule(payload);
+}
+
+WebInspector.CSSRule.prototype = {
+ get isUserAgent()
+ {
+ return this.origin === "user-agent";
+ },
+
+ get isUser()
+ {
+ return this.origin === "user";
+ },
+
+ get isViaInspector()
+ {
+ return this.origin === "inspector";
+ },
+
+ get isRegular()
+ {
+ return this.origin === "";
+ }
+}
+
+WebInspector.CSSProperty = function(ownerStyle, index, name, value, priority, status, parsedOk, implicit, shorthand, text)
+{
+ this.ownerStyle = ownerStyle;
+ this.index = index;
+ this.name = name;
+ this.value = value;
+ this.priority = priority;
+ this.status = status;
+ this.parsedOk = parsedOk;
+ this.implicit = implicit;
+ this.shorthand = shorthand;
+ this.text = text;
+}
+
+WebInspector.CSSProperty.parsePayload = function(ownerStyle, index, payload)
+{
+ var result = new WebInspector.CSSProperty(
+ ownerStyle, index, payload.name, payload.value, payload.priority, payload.status, payload.parsedOk, payload.implicit, payload.shorthandName, payload.text);
+ return result;
+}
+
+WebInspector.CSSProperty.prototype = {
+ get propertyText()
+ {
+ if (this.text !== undefined)
+ return this.text;
+
+ return this.name + ": " + this.value + (this.priority ? " !" + this.priority : "") + ";";
+ },
+
+ get isLive()
+ {
+ return this.active || this.styleBased;
+ },
+
+ get active()
+ {
+ return this.status === "active";
+ },
+
+ get styleBased()
+ {
+ return this.status === "style";
+ },
+
+ get inactive()
+ {
+ return this.status === "inactive";
+ },
+
+ get disabled()
+ {
+ return this.status === "disabled";
+ },
+
+ // Replaces "propertyName: propertyValue [!important];" in the stylesheet by an arbitrary propertyText.
+ setText: function(propertyText, userCallback)
+ {
+ function callback(userCallback, success, stylePayload)
+ {
+ if (!userCallback)
+ return;
+ if (!success)
+ userCallback(null);
+ else {
+ var style = WebInspector.CSSStyleDeclaration.parsePayload(stylePayload);
+ userCallback(style);
+ }
+ }
+
+ if (!this.ownerStyle)
+ throw "No ownerStyle for property";
+ InspectorBackend.applyStyleText(this.ownerStyle.id, propertyText, this.name, callback.bind(this, userCallback));
+ },
+
+ setValue: function(newValue, userCallback)
+ {
+ var text = this.name + ": " + newValue + (this.priority ? " !" + this.priority : "") + ";"
+ this.setText(text, userCallback);
+ },
+
+ setDisabled: function(disabled, userCallback)
+ {
+ if (!this.ownerStyle && userCallback)
+ userCallback(null);
+ if (disabled === this.disabled && userCallback)
+ userCallback(this.ownerStyle);
+
+ function callback(userCallback, stylePayload)
+ {
+ if (!userCallback)
+ return;
+ if (!stylePayload)
+ userCallback(null);
+ else {
+ var style = WebInspector.CSSStyleDeclaration.parsePayload(stylePayload);
+ userCallback(style);
+ }
+ }
+ InspectorBackend.toggleStyleEnabled(this.ownerStyle.id, this.name, disabled, callback.bind(this, userCallback));
}
}
diff --git a/WebCore/inspector/front-end/MetricsSidebarPane.js b/WebCore/inspector/front-end/MetricsSidebarPane.js
index 18bc240..3784ce8 100644
--- a/WebCore/inspector/front-end/MetricsSidebarPane.js
+++ b/WebCore/inspector/front-end/MetricsSidebarPane.js
@@ -46,24 +46,24 @@ WebInspector.MetricsSidebarPane.prototype = {
}
var self = this;
- var callback = function(stylePayload) {
- if (!stylePayload)
+ var callback = function(style) {
+ if (!style)
return;
- var style = WebInspector.CSSStyleDeclaration.parseStyle(stylePayload);
self._update(style);
};
- InspectorBackend.getComputedStyle(node.id, callback);
+ WebInspector.cssModel.getComputedStyleAsync(node.id, callback);
- var inlineStyleCallback = function(stylePayload) {
- if (!stylePayload)
+ var inlineStyleCallback = function(style) {
+ if (!style)
return;
- self._inlineStyleId = stylePayload.id;
+ self.inlineStyle = style;
};
- InspectorBackend.getInlineStyle(node.id, inlineStyleCallback);
+ WebInspector.cssModel.getInlineStyleAsync(node.id, inlineStyleCallback);
},
_update: function(style)
{
+ // Updating with computed style.
var metricsElement = document.createElement("div");
metricsElement.className = "metrics";
@@ -116,23 +116,23 @@ WebInspector.MetricsSidebarPane.prototype = {
for (var i = 0; i < boxes.length; ++i) {
var name = boxes[i];
- if (name === "margin" && noMarginDisplayType[style.display])
+ if (name === "margin" && noMarginDisplayType[style.getPropertyValue("display")])
continue;
- if (name === "padding" && noPaddingDisplayType[style.display])
+ if (name === "padding" && noPaddingDisplayType[style.getPropertyValue("display")])
continue;
- if (name === "position" && noPositionType[style.position])
+ if (name === "position" && noPositionType[style.getPropertyValue("position")])
continue;
var boxElement = document.createElement("div");
boxElement.className = name;
if (name === "content") {
- var width = style.width.replace(/px$/, "");
+ var width = style.getPropertyValue("width").replace(/px$/, "");
var widthElement = document.createElement("span");
widthElement.textContent = width;
widthElement.addEventListener("dblclick", this.startEditing.bind(this, widthElement, "width", "width"), false);
- var height = style.height.replace(/px$/, "");
+ var height = style.getPropertyValue("height").replace(/px$/, "");
var heightElement = document.createElement("span");
heightElement.textContent = height;
heightElement.addEventListener("dblclick", this.startEditing.bind(this, heightElement, "height", "height"), false);
@@ -185,7 +185,7 @@ WebInspector.MetricsSidebarPane.prototype = {
editingCommitted: function(element, userInput, previousContent, context)
{
- if (!this._inlineStyleId) {
+ if (!this.inlineStyle) {
// Element has no renderer.
return this.editingCancelled(element, context); // nothing changed, so cancel
}
@@ -203,14 +203,36 @@ WebInspector.MetricsSidebarPane.prototype = {
userInput += "px";
var self = this;
- var callback = function(success) {
- if (!success)
+ var callback = function(style) {
+ if (!style)
return;
+ self.inlineStyle = style;
self.dispatchEventToListeners("metrics edited");
self.update();
};
- InspectorBackend.setStyleProperty(this._inlineStyleId, context.styleProperty, userInput, callback);
+ function setEnabledValueCallback(context, style)
+ {
+ var property = style.getLiveProperty(context.styleProperty);
+ if (!property)
+ style.appendProperty(context.styleProperty, userInput, callback);
+ else
+ property.setValue(userInput, callback);
+ }
+
+ var allProperties = this.inlineStyle.allProperties;
+ for (var i = 0; i < allProperties.length; ++i) {
+ var property = allProperties[i];
+ if (property.name !== context.styleProperty || property.inactive)
+ continue;
+ if (property.disabled)
+ property.setDisabled(false, setEnabledValueCallback.bind(null, context));
+ else
+ property.setValue(userInput, callback);
+ return;
+ }
+
+ this.inlineStyle.appendProperty(context.styleProperty, userInput, callback);
}
}
diff --git a/WebCore/inspector/front-end/StylesSidebarPane.js b/WebCore/inspector/front-end/StylesSidebarPane.js
index d556e68..75c6688 100644
--- a/WebCore/inspector/front-end/StylesSidebarPane.js
+++ b/WebCore/inspector/front-end/StylesSidebarPane.js
@@ -155,7 +155,7 @@ WebInspector.StylesSidebarPane.prototype = {
if (refresh)
WebInspector.cssModel.getComputedStyleAsync(node.id, computedStyleCallback.bind(this));
else
- WebInspector.cssModel.getStylesAsync(node.id, !WebInspector.applicationSettings.showUserAgentStyles, stylesCallback.bind(this));
+ WebInspector.cssModel.getStylesAsync(node.id, stylesCallback.bind(this));
},
_refreshUpdate: function(node, computedStyle, editedSection)
@@ -196,8 +196,8 @@ WebInspector.StylesSidebarPane.prototype = {
// Add rules in reverse order to match the cascade order.
for (var j = pseudoElementCSSRules.rules.length - 1; j >= 0; --j) {
- var rule = WebInspector.CSSStyleDeclaration.parseRule(pseudoElementCSSRules.rules[j]);
- styleRules.push({ style: rule.style, selectorText: rule.selectorText, parentStyleSheet: rule.parentStyleSheet, rule: rule });
+ var rule = pseudoElementCSSRules.rules[j];
+ styleRules.push({ style: rule.style, selectorText: rule.selectorText, sourceURL: rule.sourceURL, rule: rule });
}
usedProperties = {};
disabledComputedProperties = {};
@@ -208,7 +208,7 @@ WebInspector.StylesSidebarPane.prototype = {
_refreshStyleRules: function(sections, computedStyle)
{
- var nodeComputedStyle = new WebInspector.CSSStyleDeclaration(computedStyle);
+ var nodeComputedStyle = computedStyle;
var styleRules = [];
for (var i = 0; sections && i < sections.length; ++i) {
var section = sections[i];
@@ -224,7 +224,7 @@ WebInspector.StylesSidebarPane.prototype = {
_rebuildStyleRules: function(node, styles)
{
- var nodeComputedStyle = new WebInspector.CSSStyleDeclaration(styles.computedStyle);
+ var nodeComputedStyle = styles.computedStyle;
this.sections = {};
var styleRules = [];
@@ -233,7 +233,7 @@ WebInspector.StylesSidebarPane.prototype = {
var styleAttributes = {};
for (var name in styles.styleAttributes) {
- var attrStyle = { style: new WebInspector.CSSStyleDeclaration(styles.styleAttributes[name]), editable: false };
+ var attrStyle = { style: styles.styleAttributes[name], editable: false };
attrStyle.selectorText = WebInspector.panels.elements.treeOutline.nodeNameToCorrectCase(node.nodeName) + "[" + name;
if (node.getAttribute(name))
attrStyle.selectorText += "=" + node.getAttribute(name);
@@ -243,7 +243,7 @@ WebInspector.StylesSidebarPane.prototype = {
// Show element's Style Attributes
if (styles.inlineStyle && node.nodeType === Node.ELEMENT_NODE) {
- var inlineStyle = { selectorText: "element.style", style: new WebInspector.CSSStyleDeclaration(styles.inlineStyle), isAttribute: true };
+ var inlineStyle = { selectorText: "element.style", style: styles.inlineStyle, isAttribute: true };
styleRules.push(inlineStyle);
}
@@ -251,12 +251,11 @@ WebInspector.StylesSidebarPane.prototype = {
if (styles.matchedCSSRules.length)
styleRules.push({ isStyleSeparator: true, text: WebInspector.UIString("Matched CSS Rules") });
for (var i = styles.matchedCSSRules.length - 1; i >= 0; --i) {
- var rule = WebInspector.CSSStyleDeclaration.parseRule(styles.matchedCSSRules[i]);
- styleRules.push({ style: rule.style, selectorText: rule.selectorText, parentStyleSheet: rule.parentStyleSheet, rule: rule });
+ var rule = styles.matchedCSSRules[i];
+ styleRules.push({ style: rule.style, selectorText: rule.selectorText, sourceURL: rule.sourceURL, rule: rule });
}
// Walk the node structure and identify styles with inherited properties.
- var parentStyles = styles.parent;
var parentNode = node.parentNode;
function insertInheritedNodeSeparator(node)
{
@@ -266,11 +265,12 @@ WebInspector.StylesSidebarPane.prototype = {
styleRules.push(entry);
}
- while (parentStyles) {
+ for (var parentOrdinal = 0; parentOrdinal < styles.inherited.length; ++parentOrdinal) {
+ var parentStyles = styles.inherited[parentOrdinal];
var separatorInserted = false;
if (parentStyles.inlineStyle) {
if (this._containsInherited(parentStyles.inlineStyle)) {
- var inlineStyle = { selectorText: WebInspector.UIString("Style Attribute"), style: new WebInspector.CSSStyleDeclaration(parentStyles.inlineStyle), isAttribute: true, isInherited: true };
+ var inlineStyle = { selectorText: WebInspector.UIString("Style Attribute"), style: parentStyles.inlineStyle, isAttribute: true, isInherited: true };
if (!separatorInserted) {
insertInheritedNodeSeparator(parentNode);
separatorInserted = true;
@@ -283,14 +283,13 @@ WebInspector.StylesSidebarPane.prototype = {
var rulePayload = parentStyles.matchedCSSRules[i];
if (!this._containsInherited(rulePayload.style))
continue;
- var rule = WebInspector.CSSStyleDeclaration.parseRule(rulePayload);
+ var rule = rulePayload;
if (!separatorInserted) {
insertInheritedNodeSeparator(parentNode);
separatorInserted = true;
}
- styleRules.push({ style: rule.style, selectorText: rule.selectorText, parentStyleSheet: rule.parentStyleSheet, rule: rule, isInherited: true });
+ styleRules.push({ style: rule.style, selectorText: rule.selectorText, sourceURL: rule.sourceURL, rule: rule, isInherited: true });
}
- parentStyles = parentStyles.parent;
parentNode = parentNode.parentNode;
}
return styleRules;
@@ -298,18 +297,6 @@ WebInspector.StylesSidebarPane.prototype = {
_markUsedProperties: function(styleRules, usedProperties, disabledComputedProperties)
{
- function deleteDisabledProperty(style, name)
- {
- if (!style || !name)
- return;
- if (style.__disabledPropertyValues)
- delete style.__disabledPropertyValues[name];
- if (style.__disabledPropertyPriorities)
- delete style.__disabledPropertyPriorities[name];
- if (style.__disabledProperties)
- delete style.__disabledProperties[name];
- }
-
var priorityUsed = false;
// Walk the style rules and make a list of all used and overloaded properties.
@@ -323,10 +310,14 @@ WebInspector.StylesSidebarPane.prototype = {
styleRule.usedProperties = {};
var style = styleRule.style;
- for (var j = 0; j < style.length; ++j) {
- var name = style[j];
+ var allProperties = style.allProperties;
+ for (var j = 0; j < allProperties.length; ++j) {
+ var property = allProperties[j];
+ if (!property.isLive)
+ continue;
+ var name = property.name;
- if (!priorityUsed && style.getPropertyPriority(name).length)
+ if (!priorityUsed && property.priority.length)
priorityUsed = true;
// If the property name is already used by another rule then this rule's
@@ -345,22 +336,12 @@ WebInspector.StylesSidebarPane.prototype = {
styleRule.usedProperties["font-weight"] = true;
styleRule.usedProperties["line-height"] = true;
}
-
- // Delete any disabled properties, since the property does exist.
- // This prevents it from showing twice.
- deleteDisabledProperty(style, name);
- deleteDisabledProperty(style, style.getPropertyShorthand(name));
}
// Add all the properties found in this style to the used properties list.
// Do this here so only future rules are affect by properties used in this rule.
for (var name in styleRules[i].usedProperties)
usedProperties[name] = true;
-
- // Remember all disabled properties so they show up in computed style.
- if (style.__disabledProperties)
- for (var name in style.__disabledProperties)
- disabledComputedProperties[name] = true;
}
if (priorityUsed) {
@@ -373,9 +354,13 @@ WebInspector.StylesSidebarPane.prototype = {
continue;
var style = styleRules[i].style;
- for (var j = 0; j < style.length; ++j) {
- var name = style[j];
- if (style.getPropertyPriority(name).length) {
+ var allProperties = style.allProperties;
+ for (var j = 0; j < allProperties.length; ++j) {
+ var property = allProperties[j];
+ if (!property.isLive)
+ continue;
+ var name = property.name;
+ if (property.priority.length) {
if (!(name in foundPriorityProperties))
styleRules[i].usedProperties[name] = true;
else
@@ -459,21 +444,13 @@ WebInspector.StylesSidebarPane.prototype = {
return sections;
},
- _containsInherited: function(payload)
- {
- if (this._arrayContainsInheritedProperty(payload.properties))
- return true;
- if (payload.disabled && this._arrayContainsInheritedProperty(payload.disabled))
- return true;
- return false;
- },
-
- _arrayContainsInheritedProperty: function(properties)
+ _containsInherited: function(style)
{
+ var properties = style.allProperties;
for (var i = 0; i < properties.length; ++i) {
var property = properties[i];
// Does this style contain non-overridden inherited property?
- if (property.name in WebInspector.StylesSidebarPane.InheritedProperties)
+ if (property.isLive && property.name in WebInspector.StylesSidebarPane.InheritedProperties)
return true;
}
return false;
@@ -651,16 +628,16 @@ WebInspector.StylePropertiesSection = function(styleRule, editable, isInherited,
}
var subtitle = "";
- if (this.styleRule.parentStyleSheet && this.styleRule.parentStyleSheet.href)
- this.subtitleElement.appendChild(linkifyUncopyable(this.styleRule.parentStyleSheet.href, this.rule.sourceLine));
+ if (this.styleRule.sourceURL)
+ this.subtitleElement.appendChild(linkifyUncopyable(this.styleRule.sourceURL, this.rule.sourceLine));
else if (isUserAgent)
subtitle = WebInspector.UIString("user agent stylesheet");
else if (isUser)
subtitle = WebInspector.UIString("user stylesheet");
else if (isViaInspector)
subtitle = WebInspector.UIString("via inspector");
- else if (this.rule && this.rule.documentURL)
- this.subtitleElement.appendChild(linkifyUncopyable(this.rule.documentURL, this.rule.sourceLine));
+ else if (this.rule && this.rule.sourceURL)
+ this.subtitleElement.appendChild(linkifyUncopyable(this.rule.sourceURL, this.rule.sourceLine));
if (isInherited)
this.element.addStyleClass("show-inherited"); // This one is related to inherited rules, not compted style.
@@ -681,49 +658,42 @@ WebInspector.StylePropertiesSection.prototype = {
// Overriding with empty body.
},
- isPropertyInherited: function(property)
+ isPropertyInherited: function(propertyName)
{
if (this.isInherited) {
// While rendering inherited stylesheet, reverse meaning of this property.
// Render truly inherited properties with black, i.e. return them as non-inherited.
- return !(property in WebInspector.StylesSidebarPane.InheritedProperties);
+ return !(propertyName in WebInspector.StylesSidebarPane.InheritedProperties);
}
return false;
},
- isPropertyOverloaded: function(property, shorthand)
+ isPropertyOverloaded: function(propertyName, shorthand)
{
if (!this._usedProperties || this.noAffect)
return false;
- if (this.isInherited && !(property in WebInspector.StylesSidebarPane.InheritedProperties)) {
+ if (this.isInherited && !(propertyName in WebInspector.StylesSidebarPane.InheritedProperties)) {
// In the inherited sections, only show overrides for the potentially inherited properties.
return false;
}
- var used = (property in this._usedProperties);
+ var used = (propertyName in this._usedProperties);
if (used || !shorthand)
return !used;
// Find out if any of the individual longhand properties of the shorthand
// are used, if none are then the shorthand is overloaded too.
- var longhandProperties = this.styleRule.style.getLonghandProperties(property);
+ var longhandProperties = this.styleRule.style.getLonghandProperties(propertyName);
for (var j = 0; j < longhandProperties.length; ++j) {
var individualProperty = longhandProperties[j];
- if (individualProperty in this._usedProperties)
+ if (individualProperty.name in this._usedProperties)
return false;
}
return true;
},
- isPropertyDisabled: function(property)
- {
- if (!this.styleRule.style.__disabledPropertyValues)
- return false;
- return property in this.styleRule.style.__disabledPropertyValues;
- },
-
update: function(full)
{
if (full) {
@@ -749,39 +719,56 @@ WebInspector.StylePropertiesSection.prototype = {
onpopulate: function()
{
+ function sorter(a, b)
+ {
+ return a.name.localeCompare(b.name);
+ }
+
var style = this.styleRule.style;
- var foundShorthands = {};
- var disabledProperties = style.__disabledPropertyValues || {};
+ var handledProperties = {};
+ var shorthandNames = {};
this.uniqueProperties = [];
- for (var i = 0; i < style.length; ++i)
- this.uniqueProperties.push(style[i]);
+ var allProperties = style.allProperties;
+ for (var i = 0; i < allProperties.length; ++i)
+ this.uniqueProperties.push(allProperties[i]);
- for (var name in disabledProperties)
- this.uniqueProperties.push(name);
+ this.uniqueProperties.sort(sorter);
- this.uniqueProperties.sort();
+ // Collect all shorthand names.
+ for (var i = 0; i < this.uniqueProperties.length; ++i) {
+ var property = this.uniqueProperties[i];
+ if (property.disabled)
+ continue;
+ if (property.shorthand)
+ shorthandNames[property.shorthand] = true;
+ }
for (var i = 0; i < this.uniqueProperties.length; ++i) {
- var name = this.uniqueProperties[i];
- var disabled = name in disabledProperties;
- var shorthand = !disabled ? style.getPropertyShorthand(name) : null;
+ var property = this.uniqueProperties[i];
+ var disabled = property.disabled;
+ if (!disabled && this.disabledComputedProperties && !(property.name in this.usedProperties) && property.name in this.disabledComputedProperties)
+ disabled = true;
- if (shorthand && shorthand in foundShorthands)
+ var shorthand = !disabled ? property.shorthand : null;
+
+ if (shorthand && shorthand in handledProperties)
continue;
if (shorthand) {
- foundShorthands[shorthand] = true;
- name = shorthand;
+ property = style.getLiveProperty(shorthand);
+ if (!property)
+ property = new WebInspector.CSSProperty(style, style.allProperties.length, shorthand, style.getShorthandValue(shorthand), style.getShorthandPriority(shorthand), "style", true, true, "");
}
- var isShorthand = (shorthand ? true : false);
- var inherited = this.isPropertyInherited(name);
- var overloaded = this.isPropertyOverloaded(name, isShorthand);
+ var isShorthand = !!(property.isLive && (shorthand || shorthandNames[property.name]));
+ var inherited = this.isPropertyInherited(property.name);
+ var overloaded = this.isPropertyOverloaded(property.name, isShorthand);
- var item = new WebInspector.StylePropertyTreeElement(this.styleRule, style, name, isShorthand, inherited, overloaded, disabled);
+ var item = new WebInspector.StylePropertyTreeElement(this.styleRule, style, property, isShorthand, inherited, overloaded);
this.propertiesTreeOutline.appendChild(item);
+ handledProperties[property.name] = property;
}
},
@@ -798,7 +785,9 @@ WebInspector.StylePropertiesSection.prototype = {
addNewBlankProperty: function()
{
- var item = new WebInspector.StylePropertyTreeElement(this.styleRule, this.styleRule.style, "", false, false, false, false);
+ var style = this.styleRule.style;
+ var property = new WebInspector.CSSProperty(style, style.allProperties.length, "", "", "", "style", true, false, false, undefined);
+ var item = new WebInspector.StylePropertyTreeElement(this.styleRule, style, "", false, false, false, false);
this.propertiesTreeOutline.appendChild(item);
item.listItemElement.textContent = "";
item._newProperty = true;
@@ -884,7 +873,7 @@ WebInspector.StylePropertiesSection.prototype = {
}
self.rule = newRule;
- self.styleRule = { section: self, style: newRule.style, selectorText: newRule.selectorText, parentStyleSheet: newRule.parentStyleSheet, rule: newRule };
+ self.styleRule = { section: self, style: newRule.style, selectorText: newRule.selectorText, sourceURL: newRule.sourceURL, rule: newRule };
var oldIdentifier = this.identifier;
self.identifier = newRule.selectorText + ":" + self.subtitleElement.textContent;
@@ -927,9 +916,9 @@ WebInspector.ComputedStylePropertiesSection.prototype = {
// Overriding with empty body.
},
- _isPropertyInherited: function(property)
+ _isPropertyInherited: function(propertyName)
{
- return !(property in this._usedProperties) && !(property in this._alwaysShowComputedProperties) && !(property in this._disabledComputedProperties);
+ return !(propertyName in this._usedProperties) && !(propertyName in this._alwaysShowComputedProperties) && !(propertyName in this._disabledComputedProperties);
},
update: function()
@@ -946,19 +935,25 @@ WebInspector.ComputedStylePropertiesSection.prototype = {
onpopulate: function()
{
+ function sorter(a, b)
+ {
+ return a.name.localeCompare(b.name);
+ }
+
var style = this.styleRule.style;
var uniqueProperties = [];
- for (var i = 0; i < style.length; ++i)
- uniqueProperties.push(style[i]);
- uniqueProperties.sort();
+ var allProperties = style.allProperties;
+ for (var i = 0; i < allProperties.length; ++i)
+ uniqueProperties.push(allProperties[i]);
+ uniqueProperties.sort(sorter);
this._propertyTreeElements = {};
for (var i = 0; i < uniqueProperties.length; ++i) {
- var name = uniqueProperties[i];
- var inherited = this._isPropertyInherited(name);
- var item = new WebInspector.StylePropertyTreeElement(this.styleRule, style, name, false, inherited, false, false);
+ var property = uniqueProperties[i];
+ var inherited = this._isPropertyInherited(property.name);
+ var item = new WebInspector.StylePropertyTreeElement(this.styleRule, style, property, false, inherited, false, false);
this.propertiesTreeOutline.appendChild(item);
- this._propertyTreeElements[name] = item;
+ this._propertyTreeElements[property.name] = item;
}
},
@@ -970,21 +965,21 @@ WebInspector.ComputedStylePropertiesSection.prototype = {
continue;
for (var j = 0; j < section.uniqueProperties.length; ++j) {
- var name = section.uniqueProperties[j];
- if (section.isPropertyDisabled(name))
+ var property = section.uniqueProperties[j];
+ if (property.disabled)
continue;
- if (section.isInherited && !(name in WebInspector.StylesSidebarPane.InheritedProperties))
+ if (section.isInherited && !(property.name in WebInspector.StylesSidebarPane.InheritedProperties))
continue;
- var treeElement = this._propertyTreeElements[name];
+ var treeElement = this._propertyTreeElements[property.name];
if (treeElement) {
var selectorText = section.styleRule.selectorText;
- var value = section.styleRule.style.getPropertyValue(name);
+ var value = property.value;
var title = "<span style='color: gray'>" + selectorText + "</span> - " + value;
var subtitle = " <span style='float:right'>" + section.subtitleElement.innerHTML + "</span>";
var childElement = new TreeElement(title + subtitle, null, false);
treeElement.appendChild(childElement);
- if (section.isPropertyOverloaded(name))
+ if (section.isPropertyOverloaded(property.name))
childElement.listItemElement.addStyleClass("overloaded");
}
}
@@ -1050,15 +1045,14 @@ WebInspector.BlankStylePropertiesSection.prototype = {
WebInspector.BlankStylePropertiesSection.prototype.__proto__ = WebInspector.StylePropertiesSection.prototype;
-WebInspector.StylePropertyTreeElement = function(styleRule, style, name, shorthand, inherited, overloaded, disabled)
+WebInspector.StylePropertyTreeElement = function(styleRule, style, property, shorthand, inherited, overloaded)
{
this._styleRule = styleRule;
this.style = style;
- this.name = name;
+ this.property = property;
this.shorthand = shorthand;
this._inherited = inherited;
this._overloaded = overloaded;
- this._disabled = disabled;
// Pass an empty title, the title gets made later in onattach.
TreeElement.call(this, "", null, shorthand);
@@ -1093,29 +1087,31 @@ WebInspector.StylePropertyTreeElement.prototype = {
get disabled()
{
- return this._disabled;
+ return this.property.disabled;
},
- set disabled(x)
+ get name()
{
- if (x === this._disabled)
- return;
- this._disabled = x;
- this.updateState();
+ return this.property.name;
},
get priority()
{
- if (this.disabled && this.style.__disabledPropertyPriorities && this.name in this.style.__disabledPropertyPriorities)
- return this.style.__disabledPropertyPriorities[this.name];
- return (this.shorthand ? this.style.getShorthandPriority(this.name) : this.style.getPropertyPriority(this.name));
+ if (this.disabled)
+ return this.property.priority;
+ return (this.shorthand ? this.style.getShorthandPriority(this.name) : this.property.priority);
},
get value()
{
- if (this.disabled && this.style.__disabledPropertyValues && this.name in this.style.__disabledPropertyValues)
- return this.style.__disabledPropertyValues[this.name];
- return (this.shorthand ? this.style.getShorthandValue(this.name) : this.style.getPropertyValue(this.name));
+ if (this.disabled)
+ return this.property.value;
+ return (this.shorthand ? this.style.getShorthandValue(this.name) : this.property.value);
+ },
+
+ get parsedOk()
+ {
+ return this.property.parsedOk;
},
onattach: function()
@@ -1135,11 +1131,14 @@ WebInspector.StylePropertyTreeElement.prototype = {
this.updateState();
- var enabledCheckboxElement = document.createElement("input");
- enabledCheckboxElement.className = "enabled-button";
- enabledCheckboxElement.type = "checkbox";
- enabledCheckboxElement.checked = !this.disabled;
- enabledCheckboxElement.addEventListener("change", this.toggleEnabled.bind(this), false);
+ var enabledCheckboxElement;
+ if (this.parsedOk) {
+ enabledCheckboxElement = document.createElement("input");
+ enabledCheckboxElement.className = "enabled-button";
+ enabledCheckboxElement.type = "checkbox";
+ enabledCheckboxElement.checked = !this.disabled;
+ enabledCheckboxElement.addEventListener("change", this.toggleEnabled.bind(this), false);
+ }
var nameElement = document.createElement("span");
nameElement.className = "webkit-css-property";
@@ -1288,7 +1287,7 @@ WebInspector.StylePropertyTreeElement.prototype = {
return;
// Append the checkbox for root elements of an editable section.
- if (this.treeOutline.section && this.treeOutline.section.editable && this.parent.root)
+ if (enabledCheckboxElement && this.treeOutline.section && this.treeOutline.section.editable && this.parent.root)
this.listItemElement.appendChild(enabledCheckboxElement);
this.listItemElement.appendChild(nameElement);
this.listItemElement.appendChild(document.createTextNode(": "));
@@ -1301,7 +1300,7 @@ WebInspector.StylePropertyTreeElement.prototype = {
this.listItemElement.appendChild(document.createTextNode(";"));
- this.tooltip = this.name + ": " + valueElement.textContent + (priority ? " " + priority : "");
+ this.tooltip = this.property.propertyText;
},
updateAll: function(updateAllRules)
@@ -1313,33 +1312,28 @@ WebInspector.StylePropertyTreeElement.prototype = {
else if (this.treeOutline.section)
this.treeOutline.section.update(true);
else
- this.updateTitle(); // FIXME: this will not show new properties. But we don't hit his case yet.
+ this.updateTitle(); // FIXME: this will not show new properties. But we don't hit this case yet.
},
toggleEnabled: function(event)
{
var disabled = !event.target.checked;
- var self = this;
function callback(newStyle)
{
if (!newStyle)
return;
- self.style = newStyle;
- self._styleRule.style = self.style;
-
- // Set the disabled property here, since the code above replies on it not changing
- // until after the value and priority are retrieved.
- self.disabled = disabled;
+ this.style = newStyle;
+ this._styleRule.style = newStyle;
- if (self.treeOutline.section && self.treeOutline.section.pane)
- self.treeOutline.section.pane.dispatchEventToListeners("style property toggled");
+ if (this.treeOutline.section && this.treeOutline.section.pane)
+ this.treeOutline.section.pane.dispatchEventToListeners("style property toggled");
- self.updateAll(true);
+ this.updateAll(true);
}
- WebInspector.cssModel.toggleStyleEnabled(this.style.id, this.name, disabled, callback);
+ this.property.setDisabled(disabled, callback.bind(this));
},
updateState: function()
@@ -1376,14 +1370,16 @@ WebInspector.StylePropertyTreeElement.prototype = {
var longhandProperties = this.style.getLonghandProperties(this.name);
for (var i = 0; i < longhandProperties.length; ++i) {
- var name = longhandProperties[i];
+ var name = longhandProperties[i].name;
+
if (this.treeOutline.section) {
var inherited = this.treeOutline.section.isPropertyInherited(name);
var overloaded = this.treeOutline.section.isPropertyOverloaded(name);
}
- var item = new WebInspector.StylePropertyTreeElement(this._styleRule, this.style, name, false, inherited, overloaded);
+ var liveProperty = this.style.getLiveProperty(name);
+ var item = new WebInspector.StylePropertyTreeElement(this._styleRule, this.style, liveProperty, false, inherited, overloaded);
this.appendChild(item);
}
},
@@ -1671,39 +1667,37 @@ WebInspector.StylePropertyTreeElement.prototype = {
}
}
- var self = this;
-
- function failureCallback()
+ function callback(newStyle)
{
- // The user typed something, but it didn't parse. Just abort and restore
- // the original title for this property. If this was a new attribute and
- // we couldn't parse, then just remove it.
- if (self._newProperty) {
- self.parent.removeChild(self);
+ if (!newStyle) {
+ // The user typed something, but it didn't parse. Just abort and restore
+ // the original title for this property. If this was a new attribute and
+ // we couldn't parse, then just remove it.
+ if (this._newProperty) {
+ this.parent.removeChild(this);
+ return;
+ }
+ if (updateInterface)
+ this.updateTitle();
return;
}
- if (updateInterface)
- self.updateTitle();
- }
- function successCallback(newStyle)
- {
if (!styleTextLength) {
// Do remove ourselves from UI when the property removal is confirmed.
- self.parent.removeChild(self);
+ this.parent.removeChild(this);
} else {
- self.style = newStyle;
- self._styleRule.style = self.style;
+ this.style = newStyle;
+ this._styleRule.style = this.style;
}
if (section && section.pane)
section.pane.dispatchEventToListeners("style edited");
if (updateInterface)
- self.updateAll(true);
+ this.updateAll(true);
}
- WebInspector.cssModel.applyStyleText(this.style.id, styleText, this.name, successCallback, failureCallback);
+ this.property.setText(styleText, callback.bind(this));
}
}
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list