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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 CSSParser::parseSheet(CSSParserContext(*document, 0), styleSheetContents.get
(), text); | 87 CSSParser::parseSheet(CSSParserContext(*document, 0), styleSheetContents.get
(), text); |
88 | 88 |
89 RefPtrWillBeRawPtr<CSSStyleSheet> styleSheet = CSSStyleSheet::create(styleSh
eetContents); | 89 RefPtrWillBeRawPtr<CSSStyleSheet> styleSheet = CSSStyleSheet::create(styleSh
eetContents); |
90 CSSStyleRule* rule = toCSSStyleRule(styleSheet->item(0)); | 90 CSSStyleRule* rule = toCSSStyleRule(styleSheet->item(0)); |
91 CSSStyleDeclaration* style = rule->style(); | 91 CSSStyleDeclaration* style = rule->style(); |
92 TrackExceptionState exceptionState; | 92 TrackExceptionState exceptionState; |
93 style->setProperty(longhand, newValue, style->getPropertyPriority(longhand),
exceptionState); | 93 style->setProperty(longhand, newValue, style->getPropertyPriority(longhand),
exceptionState); |
94 return style->getPropertyValue(shorthand); | 94 return style->getPropertyValue(shorthand); |
95 } | 95 } |
96 | 96 |
| 97 PassRefPtrWillBeRawPtr<CSSRuleList> filterDuplicateRules(RefPtrWillBeRawPtr<CSSR
uleList> ruleList) |
| 98 { |
| 99 RefPtrWillBeRawPtr<StaticCSSRuleList> uniqRuleList = StaticCSSRuleList::crea
te(); |
| 100 if (!ruleList) |
| 101 return uniqRuleList.release(); |
| 102 |
| 103 HashSet<CSSStyleRule*> uniqRulesSet; |
| 104 |
| 105 Vector<RefPtrWillBeRawPtr<CSSRule>> uniqRules; |
| 106 for (unsigned i = ruleList->length(); i > 0; --i) { |
| 107 CSSRule* rule = ruleList->item(i - 1); |
| 108 if (!rule || rule->type() != CSSRule::STYLE_RULE) |
| 109 continue; |
| 110 |
| 111 CSSStyleRule* styleRule = toCSSStyleRule(rule); |
| 112 if (uniqRulesSet.contains(styleRule)) |
| 113 continue; |
| 114 uniqRulesSet.add(styleRule); |
| 115 uniqRules.append(styleRule); |
| 116 } |
| 117 |
| 118 for (unsigned i = uniqRules.size(); i > 0; --i) |
| 119 uniqRuleList->rules().append(uniqRules[i - 1]); |
| 120 return uniqRuleList.release(); |
| 121 } |
| 122 |
97 } // namespace | 123 } // namespace |
98 | 124 |
99 namespace CSSAgentState { | 125 namespace CSSAgentState { |
100 static const char cssAgentEnabled[] = "cssAgentEnabled"; | 126 static const char cssAgentEnabled[] = "cssAgentEnabled"; |
101 } | 127 } |
102 | 128 |
103 typedef blink::InspectorBackendDispatcher::CSSCommandHandler::EnableCallback Ena
bleCallback; | 129 typedef blink::InspectorBackendDispatcher::CSSCommandHandler::EnableCallback Ena
bleCallback; |
104 | 130 |
105 namespace blink { | 131 namespace blink { |
106 | 132 |
(...skipping 1279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1386 // We should come up with a solution for matching pseudo-element selectors a
gainst ordinary Elements, too. | 1412 // We should come up with a solution for matching pseudo-element selectors a
gainst ordinary Elements, too. |
1387 return selectorPseudoId == elementPseudoId; | 1413 return selectorPseudoId == elementPseudoId; |
1388 } | 1414 } |
1389 | 1415 |
1390 PassRefPtr<TypeBuilder::Array<TypeBuilder::CSS::RuleMatch> > InspectorCSSAgent::
buildArrayForMatchedRuleList(CSSRuleList* ruleList, Element* element, PseudoId m
atchesForPseudoId) | 1416 PassRefPtr<TypeBuilder::Array<TypeBuilder::CSS::RuleMatch> > InspectorCSSAgent::
buildArrayForMatchedRuleList(CSSRuleList* ruleList, Element* element, PseudoId m
atchesForPseudoId) |
1391 { | 1417 { |
1392 RefPtr<TypeBuilder::Array<TypeBuilder::CSS::RuleMatch> > result = TypeBuilde
r::Array<TypeBuilder::CSS::RuleMatch>::create(); | 1418 RefPtr<TypeBuilder::Array<TypeBuilder::CSS::RuleMatch> > result = TypeBuilde
r::Array<TypeBuilder::CSS::RuleMatch>::create(); |
1393 if (!ruleList) | 1419 if (!ruleList) |
1394 return result.release(); | 1420 return result.release(); |
1395 | 1421 |
1396 HashSet<CSSStyleRule*> uniqRulesSet; | 1422 RefPtrWillBeRawPtr<CSSRuleList> uniqRules = filterDuplicateRules(ruleList); |
1397 Vector<CSSStyleRule*> uniqRules; | |
1398 for (unsigned i = ruleList->length(); i > 0; --i) { | |
1399 CSSStyleRule* rule = asCSSStyleRule(ruleList->item(i - 1)); | |
1400 if (uniqRulesSet.contains(rule)) | |
1401 continue; | |
1402 uniqRulesSet.add(rule); | |
1403 uniqRules.append(rule); | |
1404 } | |
1405 | 1423 |
1406 for (unsigned i = uniqRules.size(); i > 0; --i) { | 1424 for (unsigned i = 0; i < uniqRules->length(); ++i) { |
1407 CSSStyleRule* rule = uniqRules.at(i - 1); | 1425 CSSStyleRule* rule = asCSSStyleRule(uniqRules->item(i)); |
1408 RefPtr<TypeBuilder::CSS::CSSRule> ruleObject = buildObjectForRule(rule); | 1426 RefPtr<TypeBuilder::CSS::CSSRule> ruleObject = buildObjectForRule(rule); |
1409 if (!ruleObject) | 1427 if (!ruleObject) |
1410 continue; | 1428 continue; |
1411 RefPtr<TypeBuilder::Array<int> > matchingSelectors = TypeBuilder::Array<
int>::create(); | 1429 RefPtr<TypeBuilder::Array<int> > matchingSelectors = TypeBuilder::Array<
int>::create(); |
1412 const CSSSelectorList& selectorList = rule->styleRule()->selectorList(); | 1430 const CSSSelectorList& selectorList = rule->styleRule()->selectorList(); |
1413 long index = 0; | 1431 long index = 0; |
1414 PseudoId elementPseudoId = matchesForPseudoId ? matchesForPseudoId : ele
ment->pseudoId(); | 1432 PseudoId elementPseudoId = matchesForPseudoId ? matchesForPseudoId : ele
ment->pseudoId(); |
1415 for (const CSSSelector* selector = selectorList.first(); selector; selec
tor = CSSSelectorList::next(*selector)) { | 1433 for (const CSSSelector* selector = selectorList.first(); selector; selec
tor = CSSSelectorList::next(*selector)) { |
1416 const CSSSelector* firstTagHistorySelector = selector; | 1434 const CSSSelector* firstTagHistorySelector = selector; |
1417 bool matched = false; | 1435 bool matched = false; |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1508 Element* element = toElement(m_domAgent->nodeForId(state.key)); | 1526 Element* element = toElement(m_domAgent->nodeForId(state.key)); |
1509 if (element && element->ownerDocument()) | 1527 if (element && element->ownerDocument()) |
1510 documentsToChange.add(element->ownerDocument()); | 1528 documentsToChange.add(element->ownerDocument()); |
1511 } | 1529 } |
1512 | 1530 |
1513 m_nodeIdToForcedPseudoState.clear(); | 1531 m_nodeIdToForcedPseudoState.clear(); |
1514 for (auto& document : documentsToChange) | 1532 for (auto& document : documentsToChange) |
1515 document->setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTr
acing::create(StyleChangeReason::Inspector)); | 1533 document->setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTr
acing::create(StyleChangeReason::Inspector)); |
1516 } | 1534 } |
1517 | 1535 |
1518 PassRefPtrWillBeRawPtr<CSSStyleDeclaration> InspectorCSSAgent::findEffectiveDecl
aration(Element* element, CSSPropertyID propertyId) | 1536 PassRefPtrWillBeRawPtr<CSSRuleList> InspectorCSSAgent::matchedRulesList(Element*
element) |
1519 { | 1537 { |
1520 PseudoId elementPseudoId = element->pseudoId(); | 1538 PseudoId elementPseudoId = element->pseudoId(); |
1521 CSSStyleDeclaration* inlineStyle = element->style(); | |
1522 | |
1523 if (elementPseudoId) { | 1539 if (elementPseudoId) { |
1524 element = element->parentOrShadowHostElement(); | 1540 element = element->parentOrShadowHostElement(); |
1525 if (!element) | 1541 if (!element) |
1526 return nullptr; | 1542 return nullptr; |
1527 } | 1543 } |
1528 | 1544 |
1529 Document* ownerDocument = element->ownerDocument(); | 1545 Document* ownerDocument = element->ownerDocument(); |
1530 // A non-active document has no styles. | 1546 // A non-active document has no styles. |
1531 if (!ownerDocument->isActive()) | 1547 if (!ownerDocument->isActive()) |
1532 return nullptr; | 1548 return nullptr; |
1533 | 1549 |
| 1550 StyleResolver& styleResolver = ownerDocument->ensureStyleResolver(); |
| 1551 element->updateDistribution(); |
| 1552 return filterDuplicateRules(styleResolver.pseudoCSSRulesForElement(element,
elementPseudoId, StyleResolver::AllCSSRules)); |
| 1553 } |
| 1554 |
| 1555 PassRefPtrWillBeRawPtr<CSSStyleDeclaration> InspectorCSSAgent::findEffectiveDecl
aration(CSSPropertyID propertyId, CSSRuleList* ruleList, CSSStyleDeclaration* in
lineStyle) |
| 1556 { |
| 1557 if (!ruleList && !inlineStyle) |
| 1558 return nullptr; |
| 1559 |
1534 String longhand = getPropertyNameString(propertyId); | 1560 String longhand = getPropertyNameString(propertyId); |
1535 | |
1536 RefPtrWillBeRawPtr<CSSStyleDeclaration> foundStyle = nullptr; | 1561 RefPtrWillBeRawPtr<CSSStyleDeclaration> foundStyle = nullptr; |
1537 bool isImportant = false; | 1562 bool isImportant = false; |
1538 | 1563 |
1539 if (inlineStyle && !inlineStyle->getPropertyValue(longhand).isEmpty()) { | 1564 if (inlineStyle && !inlineStyle->getPropertyValue(longhand).isEmpty()) { |
1540 foundStyle = inlineStyle; | 1565 foundStyle = inlineStyle; |
1541 isImportant = inlineStyle->getPropertyPriority(longhand) == "important"; | 1566 isImportant = inlineStyle->getPropertyPriority(longhand) == "important"; |
1542 } | 1567 } |
1543 | 1568 |
1544 StyleResolver& styleResolver = ownerDocument->ensureStyleResolver(); | |
1545 element->updateDistribution(); | |
1546 RefPtrWillBeRawPtr<CSSRuleList> ruleList = styleResolver.pseudoCSSRulesForEl
ement(element, elementPseudoId, StyleResolver::AllCSSRules); | |
1547 | |
1548 for (unsigned i = 0, size = ruleList ? ruleList->length() : 0; i < size; ++i
) { | 1569 for (unsigned i = 0, size = ruleList ? ruleList->length() : 0; i < size; ++i
) { |
1549 if (isImportant) | 1570 if (isImportant) |
1550 break; | 1571 break; |
1551 | 1572 |
1552 if (ruleList->item(size - i - 1)->type() != CSSRule::STYLE_RULE) | 1573 if (ruleList->item(size - i - 1)->type() != CSSRule::STYLE_RULE) |
1553 continue; | 1574 continue; |
1554 | 1575 |
1555 CSSStyleRule* rule = toCSSStyleRule(ruleList->item(size - i - 1)); | 1576 CSSStyleRule* rule = toCSSStyleRule(ruleList->item(size - i - 1)); |
1556 if (!rule) | 1577 if (!rule) |
1557 continue; | 1578 continue; |
1558 | 1579 |
1559 CSSStyleDeclaration* style = rule->style(); | 1580 CSSStyleDeclaration* style = rule->style(); |
1560 if (!style) | 1581 if (!style) |
1561 continue; | 1582 continue; |
1562 | 1583 |
1563 if (style->getPropertyValue(longhand).isEmpty()) | 1584 if (style->getPropertyValue(longhand).isEmpty()) |
1564 continue; | 1585 continue; |
1565 | 1586 |
1566 isImportant = style->getPropertyPriority(longhand) == "important"; | 1587 isImportant = style->getPropertyPriority(longhand) == "important"; |
1567 if (isImportant || !foundStyle) | 1588 if (isImportant || !foundStyle) |
1568 foundStyle = style; | 1589 foundStyle = style; |
1569 } | 1590 } |
1570 | 1591 |
1571 return foundStyle.release(); | 1592 return foundStyle.release(); |
1572 } | 1593 } |
1573 | 1594 |
1574 void InspectorCSSAgent::setCSSPropertyValue(ErrorString* errorString, Element* e
lement, CSSPropertyID propertyId, const String& value) | 1595 void InspectorCSSAgent::setCSSPropertyValue(ErrorString* errorString, Element* e
lement, RefPtrWillBeRawPtr<CSSStyleDeclaration> style, CSSPropertyID propertyId,
const String& value, bool forceImportant) |
1575 { | 1596 { |
1576 Document* ownerDocument = element->ownerDocument(); | |
1577 if (!ownerDocument->isActive()) { | |
1578 *errorString = "Can't edit a node from a non-active document"; | |
1579 return; | |
1580 } | |
1581 | |
1582 Vector<StylePropertyShorthand, 4> shorthands; | |
1583 getMatchingShorthandsForLonghand(propertyId, &shorthands); | |
1584 | |
1585 String shorthand = shorthands.size() > 0 ? getPropertyNameString(shorthands
[0].id()) : String(); | |
1586 String longhand = getPropertyNameString(propertyId); | |
1587 | |
1588 RefPtrWillBeRawPtr<CSSStyleDeclaration> foundStyle = findEffectiveDeclaratio
n(element, propertyId); | |
1589 CSSStyleDeclaration* inlineStyle = element->style(); | |
1590 if (!foundStyle || !foundStyle->parentStyleSheet()) | |
1591 foundStyle = inlineStyle; | |
1592 | |
1593 if (!foundStyle) { | |
1594 *errorString = "Can't find a style to edit"; | |
1595 return; | |
1596 } | |
1597 | |
1598 InspectorStyleSheetBase* inspectorStyleSheet = nullptr; | 1597 InspectorStyleSheetBase* inspectorStyleSheet = nullptr; |
1599 RefPtrWillBeRawPtr<CSSRuleSourceData> sourceData = nullptr; | 1598 RefPtrWillBeRawPtr<CSSRuleSourceData> sourceData = nullptr; |
1600 if (foundStyle != inlineStyle) { | 1599 // An absence of the parent rule means that given style is an inline style. |
1601 InspectorStyleSheet* styleSheet = bindStyleSheet(foundStyle->parentStyl
eSheet()); | 1600 if (style->parentRule()) { |
| 1601 InspectorStyleSheet* styleSheet = bindStyleSheet(style->parentStyleSheet
()); |
1602 inspectorStyleSheet = styleSheet; | 1602 inspectorStyleSheet = styleSheet; |
1603 sourceData = styleSheet->sourceDataForRule(foundStyle->parentRule()); | 1603 sourceData = styleSheet->sourceDataForRule(style->parentRule()); |
1604 } | 1604 } else { |
1605 | |
1606 if (!sourceData) { | |
1607 InspectorStyleSheetForInlineStyle* inlineStyleSheet = asInspectorStyleSh
eet(element); | 1605 InspectorStyleSheetForInlineStyle* inlineStyleSheet = asInspectorStyleSh
eet(element); |
1608 inspectorStyleSheet = inlineStyleSheet; | 1606 inspectorStyleSheet = inlineStyleSheet; |
1609 sourceData = inlineStyleSheet->ruleSourceData(); | 1607 sourceData = inlineStyleSheet->ruleSourceData(); |
1610 } | 1608 } |
1611 | 1609 |
1612 if (!sourceData) { | 1610 if (!sourceData) { |
1613 *errorString = "Can't find a source to edit"; | 1611 *errorString = "Can't find a source to edit"; |
1614 return; | 1612 return; |
1615 } | 1613 } |
1616 | 1614 |
| 1615 Vector<StylePropertyShorthand, 4> shorthands; |
| 1616 getMatchingShorthandsForLonghand(propertyId, &shorthands); |
| 1617 |
| 1618 String shorthand = shorthands.size() > 0 ? getPropertyNameString(shorthands
[0].id()) : String(); |
| 1619 String longhand = getPropertyNameString(propertyId); |
| 1620 |
1617 int foundIndex = -1; | 1621 int foundIndex = -1; |
1618 WillBeHeapVector<CSSPropertySourceData> properties = sourceData->styleSource
Data->propertyData; | 1622 WillBeHeapVector<CSSPropertySourceData> properties = sourceData->styleSource
Data->propertyData; |
1619 for (unsigned i = 0; i < properties.size(); ++i) { | 1623 for (unsigned i = 0; i < properties.size(); ++i) { |
1620 CSSPropertySourceData property = properties[properties.size() - i - 1]; | 1624 CSSPropertySourceData property = properties[properties.size() - i - 1]; |
1621 String name = property.name; | 1625 String name = property.name; |
1622 if (property.disabled) | 1626 if (property.disabled) |
1623 continue; | 1627 continue; |
1624 | 1628 |
1625 if (name != shorthand && name != longhand) | 1629 if (name != shorthand && name != longhand) |
1626 continue; | 1630 continue; |
1627 | 1631 |
1628 if (property.important || foundIndex == -1) | 1632 if (property.important || foundIndex == -1) |
1629 foundIndex = properties.size() - i - 1; | 1633 foundIndex = properties.size() - i - 1; |
1630 | 1634 |
1631 if (property.important) | 1635 if (property.important) |
1632 break; | 1636 break; |
1633 } | 1637 } |
1634 | 1638 |
1635 SourceRange bodyRange = sourceData->ruleBodyRange; | 1639 SourceRange bodyRange = sourceData->ruleBodyRange; |
1636 String styleSheetText; | 1640 String styleSheetText; |
1637 inspectorStyleSheet->getText(&styleSheetText); | 1641 inspectorStyleSheet->getText(&styleSheetText); |
1638 String styleText = styleSheetText.substring(bodyRange.start, bodyRange.lengt
h()); | 1642 String styleText = styleSheetText.substring(bodyRange.start, bodyRange.lengt
h()); |
1639 SourceRange changeRange; | 1643 SourceRange changeRange; |
1640 if (foundIndex == -1) { | 1644 if (foundIndex == -1) { |
1641 bool isImportant = inlineStyle->getPropertyPriority(longhand) == "import
ant"; | 1645 String newPropertyText = "\n" + longhand + ": " + value + (forceImportan
t ? " !important" : "") + ";"; |
1642 String newPropertyText = "\n" + longhand + ": " + value + (isImportant ?
" !important" : "") + ";"; | |
1643 if (!styleText.isEmpty() && !styleText.stripWhiteSpace().endsWith(';')) | 1646 if (!styleText.isEmpty() && !styleText.stripWhiteSpace().endsWith(';')) |
1644 newPropertyText = ";" + newPropertyText; | 1647 newPropertyText = ";" + newPropertyText; |
1645 styleText.append(newPropertyText); | 1648 styleText.append(newPropertyText); |
1646 changeRange.start = bodyRange.end; | 1649 changeRange.start = bodyRange.end; |
1647 changeRange.end = bodyRange.end + newPropertyText.length(); | 1650 changeRange.end = bodyRange.end + newPropertyText.length(); |
1648 } else { | 1651 } else { |
1649 CSSPropertySourceData declaration = properties[foundIndex]; | 1652 CSSPropertySourceData declaration = properties[foundIndex]; |
1650 String newValueText; | 1653 String newValueText; |
1651 if (declaration.name == shorthand) | 1654 if (declaration.name == shorthand) |
1652 newValueText = createShorthandValue(ownerDocument, shorthand, declar
ation.value, longhand, value); | 1655 newValueText = createShorthandValue(element->ownerDocument(), shorth
and, declaration.value, longhand, value); |
1653 else | 1656 else |
1654 newValueText = value; | 1657 newValueText = value; |
1655 | 1658 |
1656 String newPropertyText = declaration.name + ": " + newValueText + (decla
ration.important ? " !important" : "") + ";"; | 1659 String newPropertyText = declaration.name + ": " + newValueText + (decla
ration.important || forceImportant ? " !important" : "") + ";"; |
1657 styleText.replace(declaration.range.start - bodyRange.start, declaration
.range.length(), newPropertyText); | 1660 styleText.replace(declaration.range.start - bodyRange.start, declaration
.range.length(), newPropertyText); |
1658 changeRange.start = declaration.range.start; | 1661 changeRange.start = declaration.range.start; |
1659 changeRange.end = changeRange.start + newPropertyText.length(); | 1662 changeRange.end = changeRange.start + newPropertyText.length(); |
1660 } | 1663 } |
1661 CSSStyleDeclaration* resultStyle = setStyleText(errorString, inspectorStyleS
heet, bodyRange, styleText); | 1664 CSSStyleDeclaration* resultStyle = setStyleText(errorString, inspectorStyleS
heet, bodyRange, styleText); |
1662 if (resultStyle) { | 1665 if (resultStyle) { |
1663 frontend()->layoutEditorChange(inspectorStyleSheet->id(), inspectorStyle
Sheet->buildSourceRangeObject(changeRange)); | 1666 frontend()->layoutEditorChange(inspectorStyleSheet->id(), inspectorStyle
Sheet->buildSourceRangeObject(changeRange)); |
1664 frontend()->flush(); | 1667 frontend()->flush(); |
1665 } | 1668 } |
1666 } | 1669 } |
1667 | 1670 |
1668 void InspectorCSSAgent::setEffectivePropertyValueForNode(ErrorString* errorStrin
g, int nodeId, const String& propertyName, const String& value) | 1671 void InspectorCSSAgent::setEffectivePropertyValueForNode(ErrorString* errorStrin
g, int nodeId, const String& propertyName, const String& value) |
1669 { | 1672 { |
| 1673 // TODO: move testing from CSSAgent to layout editor. |
1670 Element* element = elementForId(errorString, nodeId); | 1674 Element* element = elementForId(errorString, nodeId); |
1671 if (!element) | 1675 if (!element) |
1672 return; | 1676 return; |
1673 | 1677 |
1674 CSSPropertyID property = cssPropertyID(propertyName); | 1678 CSSPropertyID property = cssPropertyID(propertyName); |
1675 if (!property) { | 1679 if (!property) { |
1676 *errorString = "Invalid property name"; | 1680 *errorString = "Invalid property name"; |
1677 return; | 1681 return; |
1678 } | 1682 } |
1679 setCSSPropertyValue(errorString, element, cssPropertyID(propertyName), value
); | 1683 |
| 1684 Document* ownerDocument = element->ownerDocument(); |
| 1685 if (!ownerDocument->isActive()) { |
| 1686 *errorString = "Can't edit a node from a non-active document"; |
| 1687 return; |
| 1688 } |
| 1689 |
| 1690 CSSPropertyID propertyId = cssPropertyID(propertyName); |
| 1691 CSSStyleDeclaration* inlineStyle = element->style(); |
| 1692 RefPtrWillBeRawPtr<CSSRuleList> ruleList = matchedRulesList(element); |
| 1693 RefPtrWillBeRawPtr<CSSStyleDeclaration> foundStyle = findEffectiveDeclaratio
n(propertyId, ruleList.get(), inlineStyle); |
| 1694 if (!foundStyle || !foundStyle->parentStyleSheet()) |
| 1695 foundStyle = inlineStyle; |
| 1696 |
| 1697 if (!foundStyle) { |
| 1698 *errorString = "Can't find a style to edit"; |
| 1699 return; |
| 1700 } |
| 1701 |
| 1702 setCSSPropertyValue(errorString, element, foundStyle.get(), propertyId, valu
e); |
1680 } | 1703 } |
1681 | 1704 |
1682 DEFINE_TRACE(InspectorCSSAgent) | 1705 DEFINE_TRACE(InspectorCSSAgent) |
1683 { | 1706 { |
1684 visitor->trace(m_domAgent); | 1707 visitor->trace(m_domAgent); |
1685 visitor->trace(m_pageAgent); | 1708 visitor->trace(m_pageAgent); |
1686 visitor->trace(m_resourceAgent); | 1709 visitor->trace(m_resourceAgent); |
1687 visitor->trace(m_resourceContentLoader); | 1710 visitor->trace(m_resourceContentLoader); |
1688 #if ENABLE(OILPAN) | 1711 #if ENABLE(OILPAN) |
1689 visitor->trace(m_idToInspectorStyleSheet); | 1712 visitor->trace(m_idToInspectorStyleSheet); |
1690 visitor->trace(m_idToInspectorStyleSheetForInlineStyle); | 1713 visitor->trace(m_idToInspectorStyleSheetForInlineStyle); |
1691 visitor->trace(m_cssStyleSheetToInspectorStyleSheet); | 1714 visitor->trace(m_cssStyleSheetToInspectorStyleSheet); |
1692 visitor->trace(m_documentToCSSStyleSheets); | 1715 visitor->trace(m_documentToCSSStyleSheets); |
1693 visitor->trace(m_invalidatedDocuments); | 1716 visitor->trace(m_invalidatedDocuments); |
1694 visitor->trace(m_nodeToInspectorStyleSheet); | 1717 visitor->trace(m_nodeToInspectorStyleSheet); |
1695 visitor->trace(m_documentToViaInspectorStyleSheet); | 1718 visitor->trace(m_documentToViaInspectorStyleSheet); |
1696 #endif | 1719 #endif |
1697 visitor->trace(m_inspectorUserAgentStyleSheet); | 1720 visitor->trace(m_inspectorUserAgentStyleSheet); |
1698 InspectorBaseAgent::trace(visitor); | 1721 InspectorBaseAgent::trace(visitor); |
1699 } | 1722 } |
1700 | 1723 |
1701 } // namespace blink | 1724 } // namespace blink |
OLD | NEW |