Chromium Code Reviews| Index: Source/core/inspector/InspectorStyleSheet.cpp |
| diff --git a/Source/core/inspector/InspectorStyleSheet.cpp b/Source/core/inspector/InspectorStyleSheet.cpp |
| index c59bc46c1ff153ef27028f7fcb96ad2cecd7f74a..7f579714f707f21314191b76756cf9c1dcf2ff02 100644 |
| --- a/Source/core/inspector/InspectorStyleSheet.cpp |
| +++ b/Source/core/inspector/InspectorStyleSheet.cpp |
| @@ -472,13 +472,13 @@ static PassRefPtrWillBeRawPtr<CSSRuleList> asCSSRuleList(CSSRule* rule) |
| return nullptr; |
| } |
| -PassRefPtrWillBeRawPtr<InspectorStyle> InspectorStyle::create(const InspectorCSSId& styleId, PassRefPtrWillBeRawPtr<CSSStyleDeclaration> style, InspectorStyleSheetBase* parentStyleSheet) |
| +PassRefPtrWillBeRawPtr<InspectorStyle> InspectorStyle::create(unsigned ruleIndex, PassRefPtrWillBeRawPtr<CSSStyleDeclaration> style, InspectorStyleSheetBase* parentStyleSheet) |
| { |
| - return adoptRefWillBeNoop(new InspectorStyle(styleId, style, parentStyleSheet)); |
| + return adoptRefWillBeNoop(new InspectorStyle(ruleIndex, style, parentStyleSheet)); |
| } |
| -InspectorStyle::InspectorStyle(const InspectorCSSId& styleId, PassRefPtrWillBeRawPtr<CSSStyleDeclaration> style, InspectorStyleSheetBase* parentStyleSheet) |
| - : m_styleId(styleId) |
| +InspectorStyle::InspectorStyle(unsigned ruleIndex, PassRefPtrWillBeRawPtr<CSSStyleDeclaration> style, InspectorStyleSheetBase* parentStyleSheet) |
| + : m_ruleIndex(ruleIndex) |
| , m_style(style) |
| , m_parentStyleSheet(parentStyleSheet) |
| , m_formatAcquired(false) |
| @@ -489,8 +489,8 @@ InspectorStyle::InspectorStyle(const InspectorCSSId& styleId, PassRefPtrWillBeRa |
| PassRefPtr<TypeBuilder::CSS::CSSStyle> InspectorStyle::buildObjectForStyle() const |
| { |
| RefPtr<TypeBuilder::CSS::CSSStyle> result = styleWithProperties(); |
| - if (!m_styleId.isEmpty()) |
| - result->setStyleSheetId(m_styleId.styleSheetId()); |
| + if (m_parentStyleSheet && !m_parentStyleSheet->id().isEmpty()) |
| + result->setStyleSheetId(m_parentStyleSheet->id()); |
| RefPtrWillBeRawPtr<CSSRuleSourceData> sourceData = extractSourceData(); |
| if (sourceData) |
| @@ -581,7 +581,7 @@ bool InspectorStyle::setPropertyText(unsigned index, const String& propertyText, |
| editor.insertProperty(index, propertyText); |
| } |
| - return m_parentStyleSheet->setStyleText(m_styleId, editor.styleText()); |
| + return m_parentStyleSheet->setStyleText(m_ruleIndex, editor.styleText()); |
| } |
| bool InspectorStyle::styleText(String* result) const |
| @@ -697,7 +697,7 @@ PassRefPtrWillBeRawPtr<CSSRuleSourceData> InspectorStyle::extractSourceData() co |
| { |
| if (!m_parentStyleSheet || !m_parentStyleSheet->ensureParsedDataReady()) |
| return nullptr; |
| - return m_parentStyleSheet->ruleSourceDataAt(m_styleId.ordinal()); |
| + return m_parentStyleSheet->ruleSourceDataAt(m_ruleIndex); |
| } |
| String InspectorStyle::shorthandValue(const String& shorthandProperty) const |
| @@ -808,9 +808,9 @@ InspectorStyleSheetBase::InspectorStyleSheetBase(const String& id, Listener* lis |
| { |
| } |
| -bool InspectorStyleSheetBase::setPropertyText(const InspectorCSSId& id, unsigned propertyIndex, const String& text, bool overwrite, ExceptionState& exceptionState) |
| +bool InspectorStyleSheetBase::setPropertyText(unsigned ruleIndex, unsigned propertyIndex, const String& text, bool overwrite, ExceptionState& exceptionState) |
| { |
| - RefPtrWillBeRawPtr<InspectorStyle> inspectorStyle = inspectorStyleForId(id); |
| + RefPtrWillBeRawPtr<InspectorStyle> inspectorStyle = inspectorStyleAt(ruleIndex); |
| if (!inspectorStyle) { |
| exceptionState.throwDOMException(NotFoundError, "No property could be found for the given ID."); |
| return false; |
| @@ -818,9 +818,9 @@ bool InspectorStyleSheetBase::setPropertyText(const InspectorCSSId& id, unsigned |
| return inspectorStyle->setPropertyText(propertyIndex, text, overwrite, exceptionState); |
| } |
| -bool InspectorStyleSheetBase::getStyleText(const InspectorCSSId& id, String* text) |
| +bool InspectorStyleSheetBase::getStyleText(unsigned ruleIndex, String* text) |
| { |
| - RefPtrWillBeRawPtr<InspectorStyle> inspectorStyle = inspectorStyleForId(id); |
| + RefPtrWillBeRawPtr<InspectorStyle> inspectorStyle = inspectorStyleAt(ruleIndex); |
| if (!inspectorStyle) |
| return false; |
| return inspectorStyle->styleText(text); |
| @@ -837,16 +837,16 @@ PassRefPtr<TypeBuilder::CSS::CSSStyle> InspectorStyleSheetBase::buildObjectForSt |
| { |
| RefPtrWillBeRawPtr<CSSRuleSourceData> sourceData = nullptr; |
| if (ensureParsedDataReady()) |
| - sourceData = ruleSourceDataAt(styleId(style).ordinal()); |
| + sourceData = ruleSourceDataAt(indexOf(style)); |
| - InspectorCSSId id = styleId(style); |
| - if (id.isEmpty()) { |
| + unsigned ruleIndex = indexOf(style); |
| + if (id().isEmpty()) { |
| // Any rule coming from User Agent and not from DefaultStyleSheet will not have id. |
| // See InspectorCSSAgent::buildObjectForRule for details. |
| - RefPtrWillBeRawPtr<InspectorStyle> inspectorStyle = InspectorStyle::create(id, style, this); |
| + RefPtrWillBeRawPtr<InspectorStyle> inspectorStyle = InspectorStyle::create(ruleIndex, style, this); |
| return inspectorStyle->buildObjectForStyle(); |
| } |
| - RefPtrWillBeRawPtr<InspectorStyle> inspectorStyle = inspectorStyleForId(id); |
| + RefPtrWillBeRawPtr<InspectorStyle> inspectorStyle = inspectorStyleAt(ruleIndex); |
| RefPtr<TypeBuilder::CSS::CSSStyle> result = inspectorStyle->buildObjectForStyle(); |
| // Style text cannot be retrieved without stylesheet, so set cssText here. |
| @@ -885,7 +885,7 @@ bool InspectorStyleSheetBase::lineNumberAndColumnToOffset(unsigned lineNumber, u |
| return true; |
| } |
| -bool InspectorStyleSheetBase::findPropertyByRange(const SourceRange& sourceRange, InspectorCSSId* ruleId, unsigned* propertyIndex, bool* overwrite) |
| +bool InspectorStyleSheetBase::findPropertyByRange(const SourceRange& sourceRange, unsigned* ruleIndex, unsigned* propertyIndex, bool* overwrite) |
| { |
| if (!ensureParsedDataReady()) |
| return false; |
| @@ -901,20 +901,20 @@ bool InspectorStyleSheetBase::findPropertyByRange(const SourceRange& sourceRange |
| CSSPropertySourceData& property = propertyData.at(j); |
| unsigned styleStart = ruleSourceData->ruleBodyRange.start; |
| if (sourceRange.length() && property.range.start == sourceRange.start && property.range.end == sourceRange.end) { |
| - *ruleId = InspectorCSSId(id(), i); |
| + *ruleIndex = i; |
| *propertyIndex = j; |
| *overwrite = true; |
| return true; |
| } |
| if (!sourceRange.length() && styleStart <= sourceRange.start && sourceRange.start <= property.range.start) { |
| - *ruleId = InspectorCSSId(id(), i); |
| + *ruleIndex = i; |
| *propertyIndex = j; |
| *overwrite = false; |
| return true; |
| } |
| } |
| if (!sourceRange.length() && ruleSourceData->ruleBodyRange.start <= sourceRange.start && sourceRange.start <= ruleSourceData->ruleBodyRange.end) { |
| - *ruleId = InspectorCSSId(id(), i); |
| + *ruleIndex = i; |
| *propertyIndex = propertyData.size(); |
| *overwrite = false; |
| return true; |
| @@ -991,9 +991,9 @@ bool InspectorStyleSheet::setText(const String& text, ExceptionState& exceptionS |
| return true; |
| } |
| -String InspectorStyleSheet::ruleSelector(const InspectorCSSId& id, ExceptionState& exceptionState) |
| +String InspectorStyleSheet::ruleSelector(unsigned ruleIndex, ExceptionState& exceptionState) |
| { |
| - CSSStyleRule* rule = ruleForId(id); |
| + CSSStyleRule* rule = ruleAt(ruleIndex); |
| if (!rule) { |
| exceptionState.throwDOMException(NotFoundError, "No rule was found for the given ID."); |
| return ""; |
| @@ -1001,9 +1001,9 @@ String InspectorStyleSheet::ruleSelector(const InspectorCSSId& id, ExceptionStat |
| return rule->selectorText(); |
| } |
| -bool InspectorStyleSheet::setRuleSelector(const InspectorCSSId& id, const String& selector, ExceptionState& exceptionState) |
| +bool InspectorStyleSheet::setRuleSelector(unsigned ruleIndex, const String& selector, ExceptionState& exceptionState) |
| { |
| - CSSStyleRule* rule = ruleForId(id); |
| + CSSStyleRule* rule = ruleAt(ruleIndex); |
| if (!rule) { |
| exceptionState.throwDOMException(NotFoundError, "No rule was found for the given ID."); |
| return false; |
| @@ -1020,7 +1020,7 @@ bool InspectorStyleSheet::setRuleSelector(const InspectorCSSId& id, const String |
| } |
| rule->setSelectorText(selector); |
| - RefPtrWillBeRawPtr<CSSRuleSourceData> sourceData = ruleSourceDataAt(id.ordinal()); |
| + RefPtrWillBeRawPtr<CSSRuleSourceData> sourceData = ruleSourceDataAt(ruleIndex); |
| ASSERT(sourceData); |
| String sheetText = m_parsedStyleSheet->text(); |
| @@ -1030,9 +1030,9 @@ bool InspectorStyleSheet::setRuleSelector(const InspectorCSSId& id, const String |
| return true; |
| } |
| -String InspectorStyleSheet::mediaRuleText(const InspectorCSSId& id, ExceptionState& exceptionState) |
| +String InspectorStyleSheet::mediaRuleText(unsigned ruleIndex, ExceptionState& exceptionState) |
| { |
| - CSSMediaRule* rule = mediaRuleForId(id); |
| + CSSMediaRule* rule = mediaRuleAt(ruleIndex); |
| if (!rule) { |
| exceptionState.throwDOMException(NotFoundError, "No media rule was found for the given ID."); |
| return ""; |
| @@ -1040,9 +1040,9 @@ String InspectorStyleSheet::mediaRuleText(const InspectorCSSId& id, ExceptionSta |
| return rule->media()->mediaText(); |
| } |
| -bool InspectorStyleSheet::setMediaRuleText(const InspectorCSSId& id, const String& text, ExceptionState& exceptionState) |
| +bool InspectorStyleSheet::setMediaRuleText(unsigned ruleIndex, const String& text, ExceptionState& exceptionState) |
| { |
| - CSSMediaRule* rule = mediaRuleForId(id); |
| + CSSMediaRule* rule = mediaRuleAt(ruleIndex); |
| if (!rule) { |
| exceptionState.throwDOMException(NotFoundError, "No media rule was found for the given ID."); |
| return false; |
| @@ -1058,7 +1058,7 @@ bool InspectorStyleSheet::setMediaRuleText(const InspectorCSSId& id, const Strin |
| } |
| rule->media()->setMediaText(text); |
| - RefPtrWillBeRawPtr<CSSRuleSourceData> sourceData = ruleSourceDataAt(id.ordinal()); |
| + RefPtrWillBeRawPtr<CSSRuleSourceData> sourceData = ruleSourceDataAt(ruleIndex); |
| ASSERT(sourceData && sourceData->mediaSourceData); |
| String sheetText = m_parsedStyleSheet->text(); |
| @@ -1264,9 +1264,9 @@ CSSStyleRule* InspectorStyleSheet::addRule(const String& ruleText, const SourceR |
| return styleRule; |
| } |
| -bool InspectorStyleSheet::deleteRule(const InspectorCSSId& id, const String& oldText, ExceptionState& exceptionState) |
| +bool InspectorStyleSheet::deleteRule(unsigned ruleIndex, const String& oldText, ExceptionState& exceptionState) |
| { |
| - RefPtrWillBeRawPtr<CSSStyleRule> rule = ruleForId(id); |
| + RefPtrWillBeRawPtr<CSSStyleRule> rule = ruleAt(ruleIndex); |
| if (!rule) { |
| exceptionState.throwDOMException(NotFoundError, "No style rule could be found for the provided ID."); |
| return false; |
| @@ -1277,7 +1277,7 @@ bool InspectorStyleSheet::deleteRule(const InspectorCSSId& id, const String& old |
| return false; |
| } |
| - RefPtrWillBeRawPtr<CSSRuleSourceData> sourceData = ruleSourceDataAt(id.ordinal()); |
| + RefPtrWillBeRawPtr<CSSRuleSourceData> sourceData = ruleSourceDataAt(ruleIndex); |
| if (!sourceData) { |
| exceptionState.throwDOMException(NotFoundError, "No style rule could be found for the provided ID."); |
| return false; |
| @@ -1323,18 +1323,17 @@ void InspectorStyleSheet::updateText(const String& newText) |
| m_parsedStyleSheet->setText(newText); |
| } |
| -CSSStyleRule* InspectorStyleSheet::ruleForId(const InspectorCSSId& id) const |
| +CSSStyleRule* InspectorStyleSheet::ruleAt(unsigned ruleIndex) const |
| { |
| - ASSERT(!id.isEmpty()); |
| ensureFlatRules(); |
| - return InspectorCSSAgent::asCSSStyleRule(id.ordinal() >= m_flatRules.size() ? nullptr : m_flatRules.at(id.ordinal()).get()); |
| + return InspectorCSSAgent::asCSSStyleRule(ruleIndex >= m_flatRules.size() ? nullptr : m_flatRules.at(ruleIndex).get()); |
| } |
| -CSSMediaRule* InspectorStyleSheet::mediaRuleForId(const InspectorCSSId& id) const |
| +CSSMediaRule* InspectorStyleSheet::mediaRuleAt(unsigned ruleIndex) const |
| { |
| - ASSERT(!id.isEmpty()); |
| + ASSERT(!id().isEmpty()); |
| ensureFlatRules(); |
| - return InspectorCSSAgent::asCSSMediaRule(id.ordinal() >= m_flatRules.size() ? nullptr : m_flatRules.at(id.ordinal()).get()); |
| + return InspectorCSSAgent::asCSSMediaRule(ruleIndex >= m_flatRules.size() ? nullptr : m_flatRules.at(ruleIndex).get()); |
| } |
| PassRefPtr<TypeBuilder::CSS::CSSStyleSheetHeader> InspectorStyleSheet::buildObjectForStyleSheetInfo() const |
| @@ -1396,7 +1395,7 @@ PassRefPtr<TypeBuilder::CSS::SelectorList> InspectorStyleSheet::buildObjectForSe |
| { |
| RefPtrWillBeRawPtr<CSSRuleSourceData> sourceData = nullptr; |
| if (ensureParsedDataReady()) |
| - sourceData = ruleSourceDataAt(styleId(rule->style()).ordinal()); |
| + sourceData = ruleSourceDataAt(indexOf(rule->style())); |
| RefPtr<TypeBuilder::Array<TypeBuilder::CSS::Selector> > selectors; |
| // This intentionally does not rely on the source data to avoid catching the trailing comments (before the declaration starting '{'). |
| @@ -1434,9 +1433,8 @@ PassRefPtr<TypeBuilder::CSS::CSSRule> InspectorStyleSheet::buildObjectForRule(CS |
| .setStyle(buildObjectForStyle(rule->style())); |
| if (canBind(m_origin)) { |
| - InspectorCSSId id(ruleId(rule)); |
| - if (!id.isEmpty()) |
| - result->setStyleSheetId(id.styleSheetId()); |
| + if (!id().isEmpty()) |
| + result->setStyleSheetId(id()); |
| } |
| if (mediaStack) |
| @@ -1453,9 +1451,9 @@ bool InspectorStyleSheet::getText(String* result) const |
| return true; |
| } |
| -CSSStyleDeclaration* InspectorStyleSheet::styleForId(const InspectorCSSId& id) const |
| +CSSStyleDeclaration* InspectorStyleSheet::styleAt(unsigned ruleIndex) const |
| { |
| - CSSStyleRule* rule = ruleForId(id); |
| + CSSStyleRule* rule = ruleAt(ruleIndex); |
| if (!rule) |
| return nullptr; |
| @@ -1495,13 +1493,13 @@ PassRefPtr<TypeBuilder::CSS::SourceRange> InspectorStyleSheet::mediaQueryExpValu |
| return buildSourceRangeObject(mediaQueryData->expData.at(mediaQueryExpIndex).valueRange, lineEndings()); |
| } |
| -PassRefPtrWillBeRawPtr<InspectorStyle> InspectorStyleSheet::inspectorStyleForId(const InspectorCSSId& id) |
| +PassRefPtrWillBeRawPtr<InspectorStyle> InspectorStyleSheet::inspectorStyleAt(unsigned ruleIndex) |
| { |
| - CSSStyleDeclaration* style = styleForId(id); |
| + CSSStyleDeclaration* style = styleAt(ruleIndex); |
| if (!style) |
| return nullptr; |
| - return InspectorStyle::create(id, style, this); |
| + return InspectorStyle::create(ruleIndex, style, this); |
| } |
| unsigned InspectorStyleSheet::ruleCount() |
| @@ -1584,15 +1582,18 @@ String InspectorStyleSheet::sourceMapURL() const |
| return m_pageStyleSheet->contents()->sourceMapURL(); |
| } |
| -InspectorCSSId InspectorStyleSheet::styleId(CSSStyleDeclaration* style) const |
| +unsigned InspectorStyleSheet::indexOf(CSSStyleDeclaration* style) const |
| { |
| - unsigned index = ruleIndexByStyle(style); |
| - if (index != UINT_MAX) |
| - return InspectorCSSId(id(), index); |
| - return InspectorCSSId(); |
| + ensureFlatRules(); |
| + for (unsigned i = 0, size = m_flatRules.size(); i < size; ++i) { |
| + CSSStyleRule* styleRule = InspectorCSSAgent::asCSSStyleRule(m_flatRules.at(i).get()); |
| + if (styleRule && styleRule->style() == style) |
| + return i; |
| + } |
| + return 0; |
| } |
| -bool InspectorStyleSheet::findRuleBySelectorRange(const SourceRange& sourceRange, InspectorCSSId* ruleId) |
| +bool InspectorStyleSheet::findRuleBySelectorRange(const SourceRange& sourceRange, unsigned* ruleIndex) |
| { |
| if (!ensureParsedDataReady()) |
| return false; |
| @@ -1601,14 +1602,14 @@ bool InspectorStyleSheet::findRuleBySelectorRange(const SourceRange& sourceRange |
| if (!ruleSourceData->styleSourceData) |
| continue; |
| if (ruleSourceData->ruleHeaderRange.start == sourceRange.start && ruleSourceData->ruleHeaderRange.end == sourceRange.end) { |
| - *ruleId = InspectorCSSId(id(), i); |
| + *ruleIndex = i; |
| return true; |
| } |
| } |
| return false; |
| } |
| -bool InspectorStyleSheet::findMediaRuleByRange(const SourceRange& sourceRange, InspectorCSSId* ruleId) |
| +bool InspectorStyleSheet::findMediaRuleByRange(const SourceRange& sourceRange, unsigned* ruleIndex) |
| { |
| if (!ensureParsedDataReady()) |
| return false; |
| @@ -1617,7 +1618,7 @@ bool InspectorStyleSheet::findMediaRuleByRange(const SourceRange& sourceRange, I |
| if (!ruleSourceData->mediaSourceData) |
| continue; |
| if (ruleSourceData->ruleHeaderRange.start == sourceRange.start && ruleSourceData->ruleHeaderRange.end == sourceRange.end) { |
| - *ruleId = InspectorCSSId(id(), i); |
| + *ruleIndex = i; |
| return true; |
| } |
| } |
| @@ -1640,17 +1641,6 @@ PassRefPtrWillBeRawPtr<CSSRuleSourceData> InspectorStyleSheet::ruleSourceDataAt( |
| return m_parsedStyleSheet->ruleSourceDataAt(ruleIndex); |
| } |
| -unsigned InspectorStyleSheet::ruleIndexByStyle(CSSStyleDeclaration* pageStyle) const |
| -{ |
| - ensureFlatRules(); |
| - for (unsigned i = 0, size = m_flatRules.size(); i < size; ++i) { |
| - CSSStyleRule* styleRule = InspectorCSSAgent::asCSSStyleRule(m_flatRules.at(i).get()); |
| - if (styleRule && styleRule->style() == pageStyle) |
| - return i; |
| - } |
| - return UINT_MAX; |
| -} |
| - |
| bool InspectorStyleSheet::ensureParsedDataReady() |
| { |
| return ensureText() && m_parsedStyleSheet->ensureSourceData(); |
| @@ -1708,9 +1698,9 @@ void InspectorStyleSheet::ensureFlatRules() const |
| collectFlatRules(pageStyleSheet(), &m_flatRules); |
| } |
| -bool InspectorStyleSheet::setStyleText(const InspectorCSSId& id, const String& text) |
| +bool InspectorStyleSheet::setStyleText(unsigned ruleIndex, const String& text) |
| { |
| - CSSStyleDeclaration* style = styleForId(id); |
| + CSSStyleDeclaration* style = styleAt(ruleIndex); |
| if (!style) |
| return false; |
| @@ -1739,7 +1729,7 @@ bool InspectorStyleSheet::styleSheetTextWithChangedStyle(CSSStyleDeclaration* st |
| if (!ensureParsedDataReady()) |
| return false; |
| - RefPtrWillBeRawPtr<CSSRuleSourceData> sourceData = ruleSourceDataAt(styleId(style).ordinal()); |
| + RefPtrWillBeRawPtr<CSSRuleSourceData> sourceData = ruleSourceDataAt(indexOf(style)); |
| unsigned bodyStart = sourceData->ruleBodyRange.start; |
| unsigned bodyEnd = sourceData->ruleBodyRange.end; |
| ASSERT(bodyStart <= bodyEnd); |
| @@ -1752,9 +1742,9 @@ bool InspectorStyleSheet::styleSheetTextWithChangedStyle(CSSStyleDeclaration* st |
| return true; |
| } |
| -InspectorCSSId InspectorStyleSheet::ruleId(CSSStyleRule* rule) const |
| +unsigned InspectorStyleSheet::indexOf(CSSStyleRule* rule) const |
| { |
| - return styleId(rule->style()); |
| + return indexOf(rule->style()); |
| } |
| bool InspectorStyleSheet::originalStyleSheetText(String* result) const |
| @@ -1817,7 +1807,7 @@ InspectorStyleSheetForInlineStyle::InspectorStyleSheetForInlineStyle(const Strin |
| , m_isStyleTextValid(false) |
| { |
| ASSERT(m_element); |
| - m_inspectorStyle = InspectorStyle::create(InspectorCSSId(id, 0), inlineStyle(), this); |
| + m_inspectorStyle = InspectorStyle::create(0, inlineStyle(), this); |
| m_styleText = m_element->isStyledElement() ? m_element->getAttribute("style").string() : String(); |
| } |
| @@ -1825,13 +1815,13 @@ void InspectorStyleSheetForInlineStyle::didModifyElementAttribute() |
| { |
| m_isStyleTextValid = false; |
| if (m_element->isStyledElement() && m_element->style() != m_inspectorStyle->cssStyle()) |
| - m_inspectorStyle = InspectorStyle::create(InspectorCSSId(id(), 0), inlineStyle(), this); |
| + m_inspectorStyle = InspectorStyle::create(0, inlineStyle(), this); |
| m_ruleSourceData.clear(); |
| } |
| bool InspectorStyleSheetForInlineStyle::setText(const String& text, ExceptionState& exceptionState) |
| { |
| - bool success = setStyleText(InspectorCSSId(id(), 0), text); |
| + bool success = setStyleText(0, text); |
| if (!success) |
| exceptionState.throwDOMException(SyntaxError, "Style sheet text is invalid."); |
| return success; |
| @@ -1847,9 +1837,9 @@ bool InspectorStyleSheetForInlineStyle::getText(String* result) const |
| return true; |
| } |
| -bool InspectorStyleSheetForInlineStyle::setStyleText(const InspectorCSSId& id, const String& text) |
| +bool InspectorStyleSheetForInlineStyle::setStyleText(unsigned ruleIndex, const String& text) |
| { |
| - CSSStyleDeclaration* style = styleForId(id); |
| + CSSStyleDeclaration* style = styleAt(ruleIndex); |
| if (!style) |
| return false; |
| ASSERT_UNUSED(style, style == inlineStyle()); |
| @@ -1897,9 +1887,9 @@ bool InspectorStyleSheetForInlineStyle::ensureParsedDataReady() |
| return true; |
| } |
| -PassRefPtrWillBeRawPtr<InspectorStyle> InspectorStyleSheetForInlineStyle::inspectorStyleForId(const InspectorCSSId& id) |
| +PassRefPtrWillBeRawPtr<InspectorStyle> InspectorStyleSheetForInlineStyle::inspectorStyleAt(unsigned ruleIndex) |
| { |
| - ASSERT_UNUSED(id, !id.ordinal()); |
| + ASSERT_UNUSED(!ruleIndex, !ruleIndex); |
|
kozy
2015/06/15 09:49:28
ASSERT_UNUSED(ruleIndex, !ruleIndex)
|
| return m_inspectorStyle; |
| } |