Changeset 56697 in webkit
- Timestamp:
- Mar 28, 2010 10:41:20 AM (14 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r56696 r56697 1 2010-03-28 Pavel Feldman <pfeldman@chromium.org> 2 3 Reviewed by Timothy Hatcher. 4 5 Web Inspector: Toggling style properties on/off does not always work. 6 7 https://bugs.webkit.org/show_bug.cgi?id=36720 8 9 * inspector/InspectorController.cpp: 10 * inspector/InspectorDOMAgent.cpp: 11 (WebCore::InspectorDOMAgent::toggleStyleEnabled): 12 (WebCore::InspectorDOMAgent::buildObjectForStyle): 13 (WebCore::InspectorDOMAgent::buildArrayForDisabledStyleProperties): 14 * inspector/InspectorDOMAgent.h: 15 * inspector/front-end/DOMAgent.js: 16 (WebInspector.CSSStyleDeclaration): 17 1 18 2010-03-28 Pavel Feldman <pfeldman@chromium.org> 2 19 -
trunk/WebCore/inspector/InspectorController.cpp
r56670 r56697 59 59 #include "InspectorClient.h" 60 60 #include "InspectorFrontendClient.h" 61 #include "InspectorDOMAgent.h"62 61 #include "InspectorDOMStorageResource.h" 63 62 #include "InspectorDatabaseResource.h" -
trunk/WebCore/inspector/InspectorDOMAgent.cpp
r56683 r56697 1002 1002 CSSStyleDeclaration* style = it->second.get(); 1003 1003 1004 IdTo StyleMap::iterator disabledIt = m_idToDisabledStyle.find(styleId);1004 IdToDisabledStyleMap::iterator disabledIt = m_idToDisabledStyle.find(styleId); 1005 1005 if (disabledIt == m_idToDisabledStyle.end()) 1006 disabledIt = m_idToDisabledStyle.set(styleId, CSSMutableStyleDeclaration::create()).first; 1007 CSSStyleDeclaration* disabledStyle = disabledIt->second.get(); 1006 disabledIt = m_idToDisabledStyle.set(styleId, DisabledStyleDeclaration()).first; 1008 1007 1009 1008 // TODO: make sure this works with shorthands right. 1010 1009 ExceptionCode ec = 0; 1011 1010 if (disabled) { 1012 disabled Style->setProperty(propertyName, style->getPropertyValue(propertyName), style->getPropertyPriority(propertyName), ec);1011 disabledIt->second.set(propertyName, std::make_pair(style->getPropertyValue(propertyName), style->getPropertyPriority(propertyName))); 1013 1012 if (!ec) 1014 1013 style->removeProperty(propertyName, ec); 1015 } else { 1016 style->setProperty(propertyName, disabledStyle->getPropertyValue(propertyName), disabledStyle->getPropertyPriority(propertyName), ec); 1014 } else if (disabledIt->second.contains(propertyName)) { 1015 PropertyValueAndPriority valueAndPriority = disabledIt->second.get(propertyName); 1016 style->setProperty(propertyName, valueAndPriority.first, valueAndPriority.second, ec); 1017 1017 if (!ec) 1018 disabled Style->removeProperty(propertyName, ec);1018 disabledIt->second.remove(propertyName); 1019 1019 } 1020 1020 if (ec) { … … 1129 1129 result.set("id", styleId); 1130 1130 1131 IdToStyleMap::iterator disabledIt = m_idToDisabledStyle.find(styleId); 1132 if (disabledIt != m_idToDisabledStyle.end()) { 1133 ScriptObject disabledStyle = m_frontend->newScriptObject(); 1134 populateObjectWithStyleProperties(disabledIt->second.get(), disabledStyle); 1135 result.set("disabled", disabledStyle); 1136 } 1131 IdToDisabledStyleMap::iterator disabledIt = m_idToDisabledStyle.find(styleId); 1132 if (disabledIt != m_idToDisabledStyle.end()) 1133 result.set("disabled", buildArrayForDisabledStyleProperties(disabledIt->second)); 1137 1134 } 1138 1135 result.set("width", style->getPropertyValue("width")); … … 1165 1162 properties.set(i, property); 1166 1163 } 1164 } 1165 1166 ScriptArray InspectorDOMAgent::buildArrayForDisabledStyleProperties(DisabledStyleDeclaration& declaration) 1167 { 1168 int counter = 0; 1169 ScriptArray properties = m_frontend->newScriptArray(); 1170 for (DisabledStyleDeclaration::iterator it = declaration.begin(); it != declaration.end(); ++it) { 1171 ScriptObject property = m_frontend->newScriptObject(); 1172 property.set("name", it->first); 1173 property.set("value", it->second.first); 1174 property.set("priority", it->second.second); 1175 properties.set(counter++, property); 1176 } 1177 return properties; 1167 1178 } 1168 1179 -
trunk/WebCore/inspector/InspectorDOMAgent.h
r56683 r56697 127 127 void pushChildNodesToFrontend(long nodeId); 128 128 129 private: 129 private: 130 typedef std::pair<String, String> PropertyValueAndPriority; 131 typedef HashMap<String, PropertyValueAndPriority> DisabledStyleDeclaration; 132 130 133 void startListening(Document* document); 131 134 void stopListening(Document* document); … … 165 168 ScriptObject buildObjectForStyle(CSSStyleDeclaration*, bool bind); 166 169 void populateObjectWithStyleProperties(CSSStyleDeclaration*, ScriptObject& result); 170 ScriptArray buildArrayForDisabledStyleProperties(DisabledStyleDeclaration&); 167 171 ScriptObject buildObjectForRule(CSSStyleRule*); 168 172 ScriptObject buildObjectForStyleSheet(CSSStyleSheet*); … … 192 196 RuleToIdMap m_ruleToId; 193 197 IdToRuleMap m_idToRule; 194 IdToStyleMap m_idToDisabledStyle; 198 typedef HashMap<long, DisabledStyleDeclaration> IdToDisabledStyleMap; 199 IdToDisabledStyleMap m_idToDisabledStyle; 195 200 RefPtr<CSSStyleSheet> m_inspectorStyleSheet; 196 201 -
trunk/WebCore/inspector/front-end/DOMAgent.js
r56683 r56697 496 496 this.__disabledPropertyPriorities = {}; 497 497 if (payload.disabled) { 498 var disabledProperties = payload.disabled.properties; 499 var shorthandValues = payload.disabled.shorthandValues; 500 for (var name in shorthandValues) { 501 this.__disabledProperties[name] = true; 502 this.__disabledPropertyValues[name] = shorthandValues[name]; 503 } 504 for (var i = 0; i < disabledProperties.length; ++i) { 505 var disabledProperty = disabledProperties[i]; 506 if (disabledProperty.shorthand) 507 continue; 508 var name = disabledProperty.name; 509 this.__disabledProperties[name] = true; 510 this.__disabledPropertyValues[name] = disabledProperty.value; 511 this.__disabledPropertyPriorities[name] = disabledProperty.priority; 512 } 513 } 514 498 for (var i = 0; i < payload.disabled.length; ++i) { 499 var property = payload.disabled[i]; 500 this.__disabledProperties[property.name] = true; 501 this.__disabledPropertyValues[property.name] = property.value; 502 this.__disabledPropertyPriorities[property.name] = property.priority; 503 } 504 } 505 515 506 this._shorthandValues = payload.shorthandValues; 516 507 this._propertyMap = {}; -
trunk/WebCore/inspector/front-end/StylesSidebarPane.js
r56608 r56697 213 213 var attrStyle = { style: new WebInspector.CSSStyleDeclaration(styles.styleAttributes[name]), editable: false }; 214 214 attrStyle.subtitle = WebInspector.UIString("element’s “%s” attribute", name); 215 attrStyle.selectorText = node.nodeName+ "[" + name;215 attrStyle.selectorText = WebInspector.panels.elements.treeOutline.nodeNameToCorrectCase(node.nodeName) + "[" + name; 216 216 if (node.getAttribute(name)) 217 217 attrStyle.selectorText += "=" + node.getAttribute(name);
Note: See TracChangeset
for help on using the changeset viewer.