Changeset 89822 in webkit
- Timestamp:
- Jun 27, 2011 8:33:56 AM (13 years ago)
- Location:
- trunk
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r89816 r89822 1 2011-06-27 Alexander Pavlov <apavlov@chromium.org> 2 3 Reviewed by Pavel Feldman. 4 5 Web Inspector: Change the inspector model API and backend to allow CSS pseudoclass inspection 6 https://bugs.webkit.org/show_bug.cgi?id=63446 7 8 * inspector/styles/get-set-stylesheet-text.html: 9 * inspector/styles/styles-new-API.html: 10 * inspector/styles/styles-source-offsets.html: 11 1 12 2011-06-27 Pavel Feldman <pfeldman@google.com> 2 13 -
trunk/LayoutTests/inspector/styles/get-set-stylesheet-text.html
r83962 r89822 71 71 function nodeCallback(node) 72 72 { 73 CSSAgent.getStylesForNode(node.id, callback);73 CSSAgent.getStylesForNode(node.id, undefined, callback); 74 74 } 75 75 -
trunk/LayoutTests/inspector/styles/styles-new-API.html
r83962 r89822 55 55 { 56 56 bodyId = node.id; 57 CSSAgent.getStylesForNode(bodyId, callback);57 CSSAgent.getStylesForNode(bodyId, undefined, callback); 58 58 } 59 59 InspectorTest.selectNodeWithId("mainBody", nodeCallback); … … 80 80 function nodeCallback(node) 81 81 { 82 CSSAgent.getStylesForNode(node.id, callback);82 CSSAgent.getStylesForNode(node.id, undefined, callback); 83 83 } 84 84 InspectorTest.nodeWithId("thetable", nodeCallback); … … 175 175 return; 176 176 } 177 CSSAgent.getStylesForNode(bodyId, didGetStyles);177 CSSAgent.getStylesForNode(bodyId, undefined, didGetStyles); 178 178 } 179 179 … … 243 243 function nodeCallback(node) 244 244 { 245 CSSAgent.getStylesForNode(node.id, stylesCallback);245 CSSAgent.getStylesForNode(node.id, undefined, stylesCallback); 246 246 } 247 247 InspectorTest.nodeWithId("toggle", nodeCallback); -
trunk/LayoutTests/inspector/styles/styles-source-offsets.html
r84148 r89822 38 38 function step1(node) 39 39 { 40 CSSAgent.getStylesForNode(node.id, step2);40 CSSAgent.getStylesForNode(node.id, undefined, step2); 41 41 } 42 42 -
trunk/Source/WebCore/ChangeLog
r89815 r89822 1 2011-06-27 Alexander Pavlov <apavlov@chromium.org> 2 3 Reviewed by Pavel Feldman. 4 5 Web Inspector: Change the inspector model API and backend to allow CSS pseudoclass inspection 6 https://bugs.webkit.org/show_bug.cgi?id=63446 7 8 * inspector/Inspector.json: 9 * inspector/InspectorCSSAgent.cpp: 10 (WebCore::computePseudoClassMask): 11 (WebCore::InspectorCSSAgent::getStylesForNode): 12 * inspector/InspectorCSSAgent.h: 13 * inspector/front-end/AuditRules.js: 14 (WebInspector.AuditRules.ImageDimensionsRule.prototype.doRun.getStyles): 15 * inspector/front-end/CSSStyleModel.js: 16 (WebInspector.CSSStyleModel.prototype.getStylesAsync): 17 * inspector/front-end/StylesSidebarPane.js: 18 (WebInspector.StylesSidebarPane.prototype.update): 19 1 20 2011-06-27 Pavel Feldman <pfeldman@google.com> 2 21 -
trunk/Source/WebCore/inspector/Inspector.json
r89652 r89822 1224 1224 "name": "getStylesForNode", 1225 1225 "parameters": [ 1226 { "name": "nodeId", "type": "integer" } 1226 { "name": "nodeId", "type": "integer" }, 1227 { "name": "forcedPseudoClasses", "type": "array", "items": { "type": "string", "enum": ["active", "focus", "hover", "visited"] }, "optional": true, "description": "Element pseudo classes to force when computing applicable style rules." } 1227 1228 ], 1228 1229 "returns": [ -
trunk/Source/WebCore/inspector/InspectorCSSAgent.cpp
r89224 r89822 131 131 namespace WebCore { 132 132 133 static unsigned computePseudoClassMask(InspectorArray* pseudoClassArray) 134 { 135 DEFINE_STATIC_LOCAL(String, active, ("active")); 136 DEFINE_STATIC_LOCAL(String, hover, ("hover")); 137 DEFINE_STATIC_LOCAL(String, focus, ("focus")); 138 DEFINE_STATIC_LOCAL(String, visited, ("visited")); 139 if (!pseudoClassArray || !pseudoClassArray->length()) 140 return CSSStyleSelector::DoNotForcePseudoClassMask; 141 142 unsigned result = CSSStyleSelector::ForceNone; 143 for (size_t i = 0; i < pseudoClassArray->length(); ++i) { 144 RefPtr<InspectorValue> pseudoClassValue = pseudoClassArray->get(i); 145 String pseudoClass; 146 bool success = pseudoClassValue->asString(&pseudoClass); 147 if (!success) 148 continue; 149 if (pseudoClass == active) 150 result |= CSSStyleSelector::ForceActive; 151 else if (pseudoClass == hover) 152 result |= CSSStyleSelector::ForceHover; 153 else if (pseudoClass == focus) 154 result |= CSSStyleSelector::ForceFocus; 155 else if (pseudoClass == visited) 156 result |= CSSStyleSelector::ForceVisited; 157 } 158 159 return result; 160 } 161 133 162 // static 134 163 CSSStyleSheet* InspectorCSSAgent::parentStyleSheet(StyleBase* styleBase) … … 183 212 } 184 213 185 void InspectorCSSAgent::getStylesForNode(ErrorString* errorString, int nodeId, RefPtr<InspectorObject>* result)214 void InspectorCSSAgent::getStylesForNode(ErrorString* errorString, int nodeId, const PassRefPtr<InspectorArray>* forcedPseudoClasses, PassRefPtr<InspectorObject>* result) 186 215 { 187 216 Element* element = elementForId(errorString, nodeId); … … 199 228 resultObject->setObject("computedStyle", computedInspectorStyle->buildObjectForStyle()); 200 229 230 unsigned forcePseudoClassMask = computePseudoClassMask(forcedPseudoClasses->get()); 201 231 CSSStyleSelector* selector = element->ownerDocument()->styleSelector(); 202 RefPtr<CSSRuleList> matchedRules = selector->styleRulesForElement(element, CSSStyleSelector::AllCSSRules );232 RefPtr<CSSRuleList> matchedRules = selector->styleRulesForElement(element, CSSStyleSelector::AllCSSRules, forcePseudoClassMask); 203 233 resultObject->setArray("matchedCSSRules", buildArrayForRuleList(matchedRules.get())); 204 234 … … 207 237 RefPtr<InspectorArray> pseudoElements = InspectorArray::create(); 208 238 for (PseudoId pseudoId = FIRST_PUBLIC_PSEUDOID; pseudoId < AFTER_LAST_INTERNAL_PSEUDOID; pseudoId = static_cast<PseudoId>(pseudoId + 1)) { 209 RefPtr<CSSRuleList> matchedRules = selector->pseudoStyleRulesForElement(element, pseudoId, CSSStyleSelector::AllCSSRules );239 RefPtr<CSSRuleList> matchedRules = selector->pseudoStyleRulesForElement(element, pseudoId, CSSStyleSelector::AllCSSRules, forcePseudoClassMask); 210 240 if (matchedRules && matchedRules->length()) { 211 241 RefPtr<InspectorObject> pseudoStyles = InspectorObject::create(); -
trunk/Source/WebCore/inspector/InspectorCSSAgent.h
r89224 r89822 62 62 63 63 void reset(); 64 void getStylesForNode(ErrorString*, int nodeId, RefPtr<InspectorObject>* result);64 void getStylesForNode(ErrorString*, int nodeId, const PassRefPtr<InspectorArray>* forcedPseudoClasses, PassRefPtr<InspectorObject>* result); 65 65 void getInlineStyleForNode(ErrorString*, int nodeId, RefPtr<InspectorObject>* style); 66 66 void getComputedStyleForNode(ErrorString*, int nodeId, RefPtr<InspectorObject>* style); -
trunk/Source/WebCore/inspector/front-end/AuditRules.js
r84909 r89822 713 713 { 714 714 for (var i = 0; nodeIds && i < nodeIds.length; ++i) 715 WebInspector.cssModel.getStylesAsync(nodeIds[i], imageStylesReady.bind(this, nodeIds[i], i === nodeIds.length - 1));715 WebInspector.cssModel.getStylesAsync(nodeIds[i], undefined, imageStylesReady.bind(this, nodeIds[i], i === nodeIds.length - 1)); 716 716 } 717 717 -
trunk/Source/WebCore/inspector/front-end/CSSStyleModel.js
r85324 r89822 47 47 48 48 WebInspector.CSSStyleModel.prototype = { 49 getStylesAsync: function(nodeId, userCallback)49 getStylesAsync: function(nodeId, forcedPseudoClasses, userCallback) 50 50 { 51 51 function callback(userCallback, error, payload) … … 92 92 } 93 93 94 CSSAgent.getStylesForNode(nodeId, callback.bind(null, userCallback));94 CSSAgent.getStylesForNode(nodeId, forcedPseudoClasses || [], callback.bind(null, userCallback)); 95 95 }, 96 96 -
trunk/Source/WebCore/inspector/front-end/StylesSidebarPane.js
r89806 r89822 245 245 WebInspector.cssModel.getComputedStyleAsync(node.id, computedStyleCallback.bind(this)); 246 246 else 247 WebInspector.cssModel.getStylesAsync(node.id, stylesCallback.bind(this));247 WebInspector.cssModel.getStylesAsync(node.id, undefined, stylesCallback.bind(this)); 248 248 }, 249 249
Note: See TracChangeset
for help on using the changeset viewer.