| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010, Google Inc. All rights reserved. | 2 * Copyright (C) 2010, Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 if (!element) | 179 if (!element) |
| 180 return; | 180 return; |
| 181 | 181 |
| 182 RefPtr<InspectorObject> resultObject = InspectorObject::create(); | 182 RefPtr<InspectorObject> resultObject = InspectorObject::create(); |
| 183 | 183 |
| 184 InspectorStyleSheetForInlineStyle* styleSheet = asInspectorStyleSheet(elemen
t); | 184 InspectorStyleSheetForInlineStyle* styleSheet = asInspectorStyleSheet(elemen
t); |
| 185 if (styleSheet) | 185 if (styleSheet) |
| 186 resultObject->setObject("inlineStyle", styleSheet->buildObjectForStyle(e
lement->style())); | 186 resultObject->setObject("inlineStyle", styleSheet->buildObjectForStyle(e
lement->style())); |
| 187 | 187 |
| 188 RefPtr<CSSComputedStyleDeclaration> computedStyleInfo = computedStyle(elemen
t, true); // Support the viewing of :visited information in computed style. | 188 RefPtr<CSSComputedStyleDeclaration> computedStyleInfo = computedStyle(elemen
t, true); // Support the viewing of :visited information in computed style. |
| 189 RefPtr<InspectorStyle> computedInspectorStyle = InspectorStyle::create(Inspe
ctorCSSId(), computedStyleInfo.get(), 0); | 189 RefPtr<InspectorStyle> computedInspectorStyle = InspectorStyle::create(Inspe
ctorCSSId(), computedStyleInfo, 0); |
| 190 resultObject->setObject("computedStyle", computedInspectorStyle->buildObject
ForStyle()); | 190 resultObject->setObject("computedStyle", computedInspectorStyle->buildObject
ForStyle()); |
| 191 | 191 |
| 192 CSSStyleSelector* selector = element->ownerDocument()->styleSelector(); | 192 CSSStyleSelector* selector = element->ownerDocument()->styleSelector(); |
| 193 RefPtr<CSSRuleList> matchedRules = selector->styleRulesForElement(element, f
alse, true); | 193 RefPtr<CSSRuleList> matchedRules = selector->styleRulesForElement(element, f
alse, true); |
| 194 resultObject->setArray("matchedCSSRules", buildArrayForRuleList(matchedRules
.get())); | 194 resultObject->setArray("matchedCSSRules", buildArrayForRuleList(matchedRules
.get())); |
| 195 | 195 |
| 196 resultObject->setObject("styleAttributes", buildObjectForAttributeStyles(ele
ment)); | 196 resultObject->setObject("styleAttributes", buildObjectForAttributeStyles(ele
ment)); |
| 197 | 197 |
| 198 RefPtr<InspectorArray> pseudoElements = InspectorArray::create(); | 198 RefPtr<InspectorArray> pseudoElements = InspectorArray::create(); |
| 199 for (PseudoId pseudoId = FIRST_PUBLIC_PSEUDOID; pseudoId < AFTER_LAST_INTERN
AL_PSEUDOID; pseudoId = static_cast<PseudoId>(pseudoId + 1)) { | 199 for (PseudoId pseudoId = FIRST_PUBLIC_PSEUDOID; pseudoId < AFTER_LAST_INTERN
AL_PSEUDOID; pseudoId = static_cast<PseudoId>(pseudoId + 1)) { |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 *style = styleSheet->buildObjectForStyle(element->style()); | 241 *style = styleSheet->buildObjectForStyle(element->style()); |
| 242 } | 242 } |
| 243 | 243 |
| 244 void InspectorCSSAgent::getComputedStyleForNode2(long nodeId, RefPtr<InspectorVa
lue>* style) | 244 void InspectorCSSAgent::getComputedStyleForNode2(long nodeId, RefPtr<InspectorVa
lue>* style) |
| 245 { | 245 { |
| 246 Element* element = elementForId(nodeId); | 246 Element* element = elementForId(nodeId); |
| 247 if (!element) | 247 if (!element) |
| 248 return; | 248 return; |
| 249 | 249 |
| 250 RefPtr<CSSComputedStyleDeclaration> computedStyleInfo = computedStyle(elemen
t, true); | 250 RefPtr<CSSComputedStyleDeclaration> computedStyleInfo = computedStyle(elemen
t, true); |
| 251 RefPtr<InspectorStyle> inspectorStyle = InspectorStyle::create(InspectorCSSI
d(), computedStyleInfo.get(), 0); | 251 RefPtr<InspectorStyle> inspectorStyle = InspectorStyle::create(InspectorCSSI
d(), computedStyleInfo, 0); |
| 252 *style = inspectorStyle->buildObjectForStyle(); | 252 *style = inspectorStyle->buildObjectForStyle(); |
| 253 } | 253 } |
| 254 | 254 |
| 255 void InspectorCSSAgent::getAllStyles2(RefPtr<InspectorArray>* styles) | 255 void InspectorCSSAgent::getAllStyles2(RefPtr<InspectorArray>* styles) |
| 256 { | 256 { |
| 257 const ListHashSet<RefPtr<Document> >& documents = m_domAgent->documents(); | 257 const ListHashSet<RefPtr<Document> >& documents = m_domAgent->documents(); |
| 258 for (ListHashSet<RefPtr<Document> >::const_iterator it = documents.begin();
it != documents.end(); ++it) { | 258 for (ListHashSet<RefPtr<Document> >::const_iterator it = documents.begin();
it != documents.end(); ++it) { |
| 259 StyleSheetList* list = (*it)->styleSheets(); | 259 StyleSheetList* list = (*it)->styleSheets(); |
| 260 for (unsigned i = 0; i < list->length(); ++i) { | 260 for (unsigned i = 0; i < list->length(); ++i) { |
| 261 StyleSheet* styleSheet = list->item(i); | 261 StyleSheet* styleSheet = list->item(i); |
| (...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 538 if (it == m_nodeToInspectorStyleSheet.end()) | 538 if (it == m_nodeToInspectorStyleSheet.end()) |
| 539 return; | 539 return; |
| 540 | 540 |
| 541 m_idToInspectorStyleSheet.remove(it->second->id()); | 541 m_idToInspectorStyleSheet.remove(it->second->id()); |
| 542 m_nodeToInspectorStyleSheet.remove(node); | 542 m_nodeToInspectorStyleSheet.remove(node); |
| 543 } | 543 } |
| 544 | 544 |
| 545 } // namespace WebCore | 545 } // namespace WebCore |
| 546 | 546 |
| 547 #endif // ENABLE(INSPECTOR) | 547 #endif // ENABLE(INSPECTOR) |
| OLD | NEW |