| Index: third_party/WebKit/Source/core/inspector/InspectorStyleSheet.cpp
|
| diff --git a/third_party/WebKit/Source/core/inspector/InspectorStyleSheet.cpp b/third_party/WebKit/Source/core/inspector/InspectorStyleSheet.cpp
|
| index 8fb9bb27dd6e1be705fdd8b64235c79fb4758100..df32b3d75d3d3c5ddcba11d530a364990408f525 100644
|
| --- a/third_party/WebKit/Source/core/inspector/InspectorStyleSheet.cpp
|
| +++ b/third_party/WebKit/Source/core/inspector/InspectorStyleSheet.cpp
|
| @@ -58,7 +58,7 @@
|
| #include "wtf/text/TextPosition.h"
|
| #include <algorithm>
|
|
|
| -using blink::protocol::TypeBuilder::Array;
|
| +using blink::protocol::Array;
|
| using blink::RuleSourceDataList;
|
| using blink::CSSRuleSourceData;
|
| using blink::CSSStyleSheet;
|
| @@ -673,7 +673,7 @@ enum MediaListSource {
|
| MediaListSourceImportRule
|
| };
|
|
|
| -PassRefPtr<protocol::TypeBuilder::CSS::SourceRange> InspectorStyleSheetBase::buildSourceRangeObject(const SourceRange& range)
|
| +PassOwnPtr<protocol::CSS::SourceRange> InspectorStyleSheetBase::buildSourceRangeObject(const SourceRange& range)
|
| {
|
| const LineEndings* lineEndings = this->lineEndings();
|
| if (!lineEndings)
|
| @@ -681,11 +681,11 @@ PassRefPtr<protocol::TypeBuilder::CSS::SourceRange> InspectorStyleSheetBase::bui
|
| TextPosition start = TextPosition::fromOffsetAndLineEndings(range.start, *lineEndings);
|
| TextPosition end = TextPosition::fromOffsetAndLineEndings(range.end, *lineEndings);
|
|
|
| - RefPtr<protocol::TypeBuilder::CSS::SourceRange> result = protocol::TypeBuilder::CSS::SourceRange::create()
|
| + OwnPtr<protocol::CSS::SourceRange> result = protocol::CSS::SourceRange::create()
|
| .setStartLine(start.m_line.zeroBasedInt())
|
| .setStartColumn(start.m_column.zeroBasedInt())
|
| .setEndLine(end.m_line.zeroBasedInt())
|
| - .setEndColumn(end.m_column.zeroBasedInt());
|
| + .setEndColumn(end.m_column.zeroBasedInt()).build();
|
| return result.release();
|
| }
|
|
|
| @@ -702,9 +702,9 @@ InspectorStyle::InspectorStyle(PassRefPtrWillBeRawPtr<CSSStyleDeclaration> style
|
| ASSERT(m_style);
|
| }
|
|
|
| -PassRefPtr<protocol::TypeBuilder::CSS::CSSStyle> InspectorStyle::buildObjectForStyle()
|
| +PassOwnPtr<protocol::CSS::CSSStyle> InspectorStyle::buildObjectForStyle()
|
| {
|
| - RefPtr<protocol::TypeBuilder::CSS::CSSStyle> result = styleWithProperties();
|
| + OwnPtr<protocol::CSS::CSSStyle> result = styleWithProperties();
|
| if (m_sourceData) {
|
| if (m_parentStyleSheet && !m_parentStyleSheet->id().isEmpty())
|
| result->setStyleSheetId(m_parentStyleSheet->id());
|
| @@ -720,17 +720,17 @@ PassRefPtr<protocol::TypeBuilder::CSS::CSSStyle> InspectorStyle::buildObjectForS
|
| return result.release();
|
| }
|
|
|
| -PassRefPtr<protocol::TypeBuilder::Array<protocol::TypeBuilder::CSS::CSSComputedStyleProperty>> InspectorStyle::buildArrayForComputedStyle()
|
| +PassOwnPtr<protocol::Array<protocol::CSS::CSSComputedStyleProperty>> InspectorStyle::buildArrayForComputedStyle()
|
| {
|
| - RefPtr<protocol::TypeBuilder::Array<protocol::TypeBuilder::CSS::CSSComputedStyleProperty>> result = protocol::TypeBuilder::Array<protocol::TypeBuilder::CSS::CSSComputedStyleProperty>::create();
|
| + OwnPtr<protocol::Array<protocol::CSS::CSSComputedStyleProperty>> result = protocol::Array<protocol::CSS::CSSComputedStyleProperty>::create();
|
| WillBeHeapVector<CSSPropertySourceData> properties;
|
| populateAllProperties(properties);
|
|
|
| for (auto& property : properties) {
|
| - RefPtr<protocol::TypeBuilder::CSS::CSSComputedStyleProperty> entry = protocol::TypeBuilder::CSS::CSSComputedStyleProperty::create()
|
| + OwnPtr<protocol::CSS::CSSComputedStyleProperty> entry = protocol::CSS::CSSComputedStyleProperty::create()
|
| .setName(property.name)
|
| - .setValue(property.value);
|
| - result->addItem(entry);
|
| + .setValue(property.value).build();
|
| + result->addItem(entry.release());
|
| }
|
|
|
| return result.release();
|
| @@ -782,10 +782,10 @@ void InspectorStyle::populateAllProperties(WillBeHeapVector<CSSPropertySourceDat
|
| }
|
| }
|
|
|
| -PassRefPtr<protocol::TypeBuilder::CSS::CSSStyle> InspectorStyle::styleWithProperties()
|
| +PassOwnPtr<protocol::CSS::CSSStyle> InspectorStyle::styleWithProperties()
|
| {
|
| - RefPtr<Array<protocol::TypeBuilder::CSS::CSSProperty>> propertiesObject = Array<protocol::TypeBuilder::CSS::CSSProperty>::create();
|
| - RefPtr<Array<protocol::TypeBuilder::CSS::ShorthandEntry>> shorthandEntries = Array<protocol::TypeBuilder::CSS::ShorthandEntry>::create();
|
| + OwnPtr<Array<protocol::CSS::CSSProperty>> propertiesObject = Array<protocol::CSS::CSSProperty>::create();
|
| + OwnPtr<Array<protocol::CSS::ShorthandEntry>> shorthandEntries = Array<protocol::CSS::ShorthandEntry>::create();
|
| HashSet<String> foundShorthands;
|
|
|
| WillBeHeapVector<CSSPropertySourceData> properties;
|
| @@ -795,10 +795,9 @@ PassRefPtr<protocol::TypeBuilder::CSS::CSSStyle> InspectorStyle::styleWithProper
|
| const CSSPropertySourceData& propertyEntry = styleProperty;
|
| const String& name = propertyEntry.name;
|
|
|
| - RefPtr<protocol::TypeBuilder::CSS::CSSProperty> property = protocol::TypeBuilder::CSS::CSSProperty::create()
|
| + OwnPtr<protocol::CSS::CSSProperty> property = protocol::CSS::CSSProperty::create()
|
| .setName(name)
|
| - .setValue(propertyEntry.value);
|
| - propertiesObject->addItem(property);
|
| + .setValue(propertyEntry.value).build();
|
|
|
| // Default "parsedOk" == true.
|
| if (!propertyEntry.parsedOk)
|
| @@ -823,20 +822,21 @@ PassRefPtr<protocol::TypeBuilder::CSS::CSSStyle> InspectorStyle::styleWithProper
|
| String shorthand = m_style->getPropertyShorthand(name);
|
| if (!shorthand.isEmpty()) {
|
| if (foundShorthands.add(shorthand).isNewEntry) {
|
| - RefPtr<protocol::TypeBuilder::CSS::ShorthandEntry> entry = protocol::TypeBuilder::CSS::ShorthandEntry::create()
|
| + OwnPtr<protocol::CSS::ShorthandEntry> entry = protocol::CSS::ShorthandEntry::create()
|
| .setName(shorthand)
|
| - .setValue(shorthandValue(shorthand));
|
| + .setValue(shorthandValue(shorthand)).build();
|
| if (!m_style->getPropertyPriority(name).isEmpty())
|
| entry->setImportant(true);
|
| - shorthandEntries->addItem(entry);
|
| + shorthandEntries->addItem(entry.release());
|
| }
|
| }
|
| }
|
| + propertiesObject->addItem(property.release());
|
| }
|
|
|
| - RefPtr<protocol::TypeBuilder::CSS::CSSStyle> result = protocol::TypeBuilder::CSS::CSSStyle::create()
|
| - .setCssProperties(propertiesObject)
|
| - .setShorthandEntries(shorthandEntries);
|
| + OwnPtr<protocol::CSS::CSSStyle> result = protocol::CSS::CSSStyle::create()
|
| + .setCssProperties(propertiesObject.release())
|
| + .setShorthandEntries(shorthandEntries.release()).build();
|
| return result.release();
|
| }
|
|
|
| @@ -889,7 +889,7 @@ void InspectorStyleSheetBase::onStyleSheetTextChanged()
|
| listener()->styleSheetChanged(this);
|
| }
|
|
|
| -PassRefPtr<protocol::TypeBuilder::CSS::CSSStyle> InspectorStyleSheetBase::buildObjectForStyle(CSSStyleDeclaration* style)
|
| +PassOwnPtr<protocol::CSS::CSSStyle> InspectorStyleSheetBase::buildObjectForStyle(CSSStyleDeclaration* style)
|
| {
|
| return inspectorStyle(style)->buildObjectForStyle();
|
| }
|
| @@ -917,12 +917,12 @@ bool InspectorStyleSheetBase::lineNumberAndColumnToOffset(unsigned lineNumber, u
|
| return true;
|
| }
|
|
|
| -PassRefPtrWillBeRawPtr<InspectorStyleSheet> InspectorStyleSheet::create(InspectorResourceAgent* resourceAgent, PassRefPtrWillBeRawPtr<CSSStyleSheet> pageStyleSheet, protocol::TypeBuilder::CSS::StyleSheetOrigin::Enum origin, const String& documentURL, InspectorCSSAgent* cssAgent)
|
| +PassRefPtrWillBeRawPtr<InspectorStyleSheet> InspectorStyleSheet::create(InspectorResourceAgent* resourceAgent, PassRefPtrWillBeRawPtr<CSSStyleSheet> pageStyleSheet, const String& origin, const String& documentURL, InspectorCSSAgent* cssAgent)
|
| {
|
| return adoptRefWillBeNoop(new InspectorStyleSheet(resourceAgent, pageStyleSheet, origin, documentURL, cssAgent));
|
| }
|
|
|
| -InspectorStyleSheet::InspectorStyleSheet(InspectorResourceAgent* resourceAgent, PassRefPtrWillBeRawPtr<CSSStyleSheet> pageStyleSheet, protocol::TypeBuilder::CSS::StyleSheetOrigin::Enum origin, const String& documentURL, InspectorCSSAgent* cssAgent)
|
| +InspectorStyleSheet::InspectorStyleSheet(InspectorResourceAgent* resourceAgent, PassRefPtrWillBeRawPtr<CSSStyleSheet> pageStyleSheet, const String& origin, const String& documentURL, InspectorCSSAgent* cssAgent)
|
| : InspectorStyleSheetBase(cssAgent)
|
| , m_cssAgent(cssAgent)
|
| , m_resourceAgent(resourceAgent)
|
| @@ -1319,7 +1319,7 @@ void InspectorStyleSheet::innerSetText(const String& text, bool markAsLocallyMod
|
| }
|
| }
|
|
|
| -PassRefPtr<protocol::TypeBuilder::CSS::CSSStyleSheetHeader> InspectorStyleSheet::buildObjectForStyleSheetInfo()
|
| +PassOwnPtr<protocol::CSS::CSSStyleSheetHeader> InspectorStyleSheet::buildObjectForStyleSheetInfo()
|
| {
|
| CSSStyleSheet* styleSheet = pageStyleSheet();
|
| if (!styleSheet)
|
| @@ -1328,7 +1328,7 @@ PassRefPtr<protocol::TypeBuilder::CSS::CSSStyleSheetHeader> InspectorStyleSheet:
|
| Document* document = styleSheet->ownerDocument();
|
| LocalFrame* frame = document ? document->frame() : nullptr;
|
|
|
| - RefPtr<protocol::TypeBuilder::CSS::CSSStyleSheetHeader> result = protocol::TypeBuilder::CSS::CSSStyleSheetHeader::create()
|
| + OwnPtr<protocol::CSS::CSSStyleSheetHeader> result = protocol::CSS::CSSStyleSheetHeader::create()
|
| .setStyleSheetId(id())
|
| .setOrigin(m_origin)
|
| .setDisabled(styleSheet->disabled())
|
| @@ -1337,7 +1337,7 @@ PassRefPtr<protocol::TypeBuilder::CSS::CSSStyleSheetHeader> InspectorStyleSheet:
|
| .setFrameId(frame ? IdentifiersFactory::frameId(frame) : "")
|
| .setIsInline(styleSheet->isInline() && !startsAtZero())
|
| .setStartLine(styleSheet->startPositionInSource().m_line.zeroBasedInt())
|
| - .setStartColumn(styleSheet->startPositionInSource().m_column.zeroBasedInt());
|
| + .setStartColumn(styleSheet->startPositionInSource().m_column.zeroBasedInt()).build();
|
|
|
| if (hasSourceURL())
|
| result->setHasSourceURL(true);
|
| @@ -1351,10 +1351,10 @@ PassRefPtr<protocol::TypeBuilder::CSS::CSSStyleSheetHeader> InspectorStyleSheet:
|
| return result.release();
|
| }
|
|
|
| -PassRefPtr<protocol::TypeBuilder::Array<protocol::TypeBuilder::CSS::Value>> InspectorStyleSheet::selectorsFromSource(CSSRuleSourceData* sourceData, const String& sheetText)
|
| +PassOwnPtr<protocol::Array<protocol::CSS::Value>> InspectorStyleSheet::selectorsFromSource(CSSRuleSourceData* sourceData, const String& sheetText)
|
| {
|
| ScriptRegexp comment("/\\*[^]*?\\*/", TextCaseSensitive, MultilineEnabled);
|
| - RefPtr<protocol::TypeBuilder::Array<protocol::TypeBuilder::CSS::Value>> result = protocol::TypeBuilder::Array<protocol::TypeBuilder::CSS::Value>::create();
|
| + OwnPtr<protocol::Array<protocol::CSS::Value>> result = protocol::Array<protocol::CSS::Value>::create();
|
| const SelectorRangeList& ranges = sourceData->selectorRanges;
|
| for (size_t i = 0, size = ranges.size(); i < size; ++i) {
|
| const SourceRange& range = ranges.at(i);
|
| @@ -1366,18 +1366,18 @@ PassRefPtr<protocol::TypeBuilder::Array<protocol::TypeBuilder::CSS::Value>> Insp
|
| while ((offset = comment.match(selector, offset, &matchLength)) >= 0)
|
| selector.replace(offset, matchLength, "");
|
|
|
| - RefPtr<protocol::TypeBuilder::CSS::Value> simpleSelector = protocol::TypeBuilder::CSS::Value::create()
|
| - .setText(selector.stripWhiteSpace());
|
| + OwnPtr<protocol::CSS::Value> simpleSelector = protocol::CSS::Value::create()
|
| + .setText(selector.stripWhiteSpace()).build();
|
| simpleSelector->setRange(buildSourceRangeObject(range));
|
| result->addItem(simpleSelector.release());
|
| }
|
| return result.release();
|
| }
|
|
|
| -PassRefPtr<protocol::TypeBuilder::CSS::SelectorList> InspectorStyleSheet::buildObjectForSelectorList(CSSStyleRule* rule)
|
| +PassOwnPtr<protocol::CSS::SelectorList> InspectorStyleSheet::buildObjectForSelectorList(CSSStyleRule* rule)
|
| {
|
| RefPtrWillBeRawPtr<CSSRuleSourceData> sourceData = sourceDataForRule(rule);
|
| - RefPtr<protocol::TypeBuilder::Array<protocol::TypeBuilder::CSS::Value>> selectors;
|
| + OwnPtr<protocol::Array<protocol::CSS::Value>> selectors;
|
|
|
| // This intentionally does not rely on the source data to avoid catching the trailing comments (before the declaration starting '{').
|
| String selectorText = rule->selectorText();
|
| @@ -1385,33 +1385,31 @@ PassRefPtr<protocol::TypeBuilder::CSS::SelectorList> InspectorStyleSheet::buildO
|
| if (sourceData) {
|
| selectors = selectorsFromSource(sourceData.get(), m_text);
|
| } else {
|
| - selectors = protocol::TypeBuilder::Array<protocol::TypeBuilder::CSS::Value>::create();
|
| + selectors = protocol::Array<protocol::CSS::Value>::create();
|
| const CSSSelectorList& selectorList = rule->styleRule()->selectorList();
|
| for (const CSSSelector* selector = selectorList.first(); selector; selector = CSSSelectorList::next(*selector))
|
| - selectors->addItem(protocol::TypeBuilder::CSS::Value::create().setText(selector->selectorText()).release());
|
| + selectors->addItem(protocol::CSS::Value::create().setText(selector->selectorText()).build());
|
| }
|
| - RefPtr<protocol::TypeBuilder::CSS::SelectorList> result = protocol::TypeBuilder::CSS::SelectorList::create()
|
| - .setSelectors(selectors)
|
| - .setText(selectorText)
|
| - .release();
|
| - return result.release();
|
| + return protocol::CSS::SelectorList::create()
|
| + .setSelectors(selectors.release())
|
| + .setText(selectorText).build();
|
| }
|
|
|
| -static bool canBind(protocol::TypeBuilder::CSS::StyleSheetOrigin::Enum origin)
|
| +static bool canBind(const String& origin)
|
| {
|
| - return origin != protocol::TypeBuilder::CSS::StyleSheetOrigin::User_agent && origin != protocol::TypeBuilder::CSS::StyleSheetOrigin::Injected;
|
| + return origin != protocol::CSS::StyleSheetOriginEnum::UserAgent && origin != protocol::CSS::StyleSheetOriginEnum::Injected;
|
| }
|
|
|
| -PassRefPtr<protocol::TypeBuilder::CSS::CSSRule> InspectorStyleSheet::buildObjectForRuleWithoutMedia(CSSStyleRule* rule)
|
| +PassOwnPtr<protocol::CSS::CSSRule> InspectorStyleSheet::buildObjectForRuleWithoutMedia(CSSStyleRule* rule)
|
| {
|
| CSSStyleSheet* styleSheet = pageStyleSheet();
|
| if (!styleSheet)
|
| return nullptr;
|
|
|
| - RefPtr<protocol::TypeBuilder::CSS::CSSRule> result = protocol::TypeBuilder::CSS::CSSRule::create()
|
| + OwnPtr<protocol::CSS::CSSRule> result = protocol::CSS::CSSRule::create()
|
| .setSelectorList(buildObjectForSelectorList(rule))
|
| .setOrigin(m_origin)
|
| - .setStyle(buildObjectForStyle(rule->style()));
|
| + .setStyle(buildObjectForStyle(rule->style())).build();
|
|
|
| if (canBind(m_origin)) {
|
| if (!id().isEmpty())
|
| @@ -1421,21 +1419,21 @@ PassRefPtr<protocol::TypeBuilder::CSS::CSSRule> InspectorStyleSheet::buildObject
|
| return result.release();
|
| }
|
|
|
| -PassRefPtr<protocol::TypeBuilder::CSS::CSSKeyframeRule> InspectorStyleSheet::buildObjectForKeyframeRule(CSSKeyframeRule* keyframeRule)
|
| +PassOwnPtr<protocol::CSS::CSSKeyframeRule> InspectorStyleSheet::buildObjectForKeyframeRule(CSSKeyframeRule* keyframeRule)
|
| {
|
| CSSStyleSheet* styleSheet = pageStyleSheet();
|
| if (!styleSheet)
|
| return nullptr;
|
|
|
| - RefPtr<protocol::TypeBuilder::CSS::Value> keyText = protocol::TypeBuilder::CSS::Value::create().setText(keyframeRule->keyText());
|
| + OwnPtr<protocol::CSS::Value> keyText = protocol::CSS::Value::create().setText(keyframeRule->keyText()).build();
|
| RefPtrWillBeRawPtr<CSSRuleSourceData> sourceData = sourceDataForRule(keyframeRule);
|
| if (sourceData)
|
| keyText->setRange(buildSourceRangeObject(sourceData->ruleHeaderRange));
|
| - RefPtr<protocol::TypeBuilder::CSS::CSSKeyframeRule> result = protocol::TypeBuilder::CSS::CSSKeyframeRule::create()
|
| + OwnPtr<protocol::CSS::CSSKeyframeRule> result = protocol::CSS::CSSKeyframeRule::create()
|
| // TODO(samli): keyText() normalises 'from' and 'to' keyword values.
|
| - .setKeyText(keyText)
|
| + .setKeyText(keyText.release())
|
| .setOrigin(m_origin)
|
| - .setStyle(buildObjectForStyle(keyframeRule->style()));
|
| + .setStyle(buildObjectForStyle(keyframeRule->style())).build();
|
| if (canBind(m_origin) && !id().isEmpty())
|
| result->setStyleSheetId(id());
|
| return result.release();
|
| @@ -1450,7 +1448,7 @@ bool InspectorStyleSheet::getText(String* result)
|
| return false;
|
| }
|
|
|
| -PassRefPtr<protocol::TypeBuilder::CSS::SourceRange> InspectorStyleSheet::ruleHeaderSourceRange(CSSRule* rule)
|
| +PassOwnPtr<protocol::CSS::SourceRange> InspectorStyleSheet::ruleHeaderSourceRange(CSSRule* rule)
|
| {
|
| if (!m_sourceData)
|
| return nullptr;
|
| @@ -1460,7 +1458,7 @@ PassRefPtr<protocol::TypeBuilder::CSS::SourceRange> InspectorStyleSheet::ruleHea
|
| return buildSourceRangeObject(sourceData->ruleHeaderRange);
|
| }
|
|
|
| -PassRefPtr<protocol::TypeBuilder::CSS::SourceRange> InspectorStyleSheet::mediaQueryExpValueSourceRange(CSSRule* rule, size_t mediaQueryIndex, size_t mediaQueryExpIndex)
|
| +PassOwnPtr<protocol::CSS::SourceRange> InspectorStyleSheet::mediaQueryExpValueSourceRange(CSSRule* rule, size_t mediaQueryIndex, size_t mediaQueryExpIndex)
|
| {
|
| if (!m_sourceData)
|
| return nullptr;
|
| @@ -1482,7 +1480,7 @@ String InspectorStyleSheet::sourceURL()
|
| {
|
| if (!m_sourceURL.isNull())
|
| return m_sourceURL;
|
| - if (m_origin != protocol::TypeBuilder::CSS::StyleSheetOrigin::Regular) {
|
| + if (m_origin != protocol::CSS::StyleSheetOriginEnum::Regular) {
|
| m_sourceURL = "";
|
| return m_sourceURL;
|
| }
|
| @@ -1504,7 +1502,7 @@ String InspectorStyleSheet::sourceURL()
|
| String InspectorStyleSheet::url()
|
| {
|
| // "sourceURL" is present only for regular rules, otherwise "origin" should be used in the frontend.
|
| - if (m_origin != protocol::TypeBuilder::CSS::StyleSheetOrigin::Regular)
|
| + if (m_origin != protocol::CSS::StyleSheetOriginEnum::Regular)
|
| return String();
|
|
|
| CSSStyleSheet* styleSheet = pageStyleSheet();
|
| @@ -1536,7 +1534,7 @@ bool InspectorStyleSheet::startsAtZero()
|
|
|
| String InspectorStyleSheet::sourceMapURL()
|
| {
|
| - if (m_origin != protocol::TypeBuilder::CSS::StyleSheetOrigin::Regular)
|
| + if (m_origin != protocol::CSS::StyleSheetOriginEnum::Regular)
|
| return String();
|
|
|
| String styleSheetText;
|
| @@ -1675,7 +1673,7 @@ const CSSRuleVector& InspectorStyleSheet::flatRules()
|
|
|
| bool InspectorStyleSheet::resourceStyleSheetText(String* result)
|
| {
|
| - if (m_origin == protocol::TypeBuilder::CSS::StyleSheetOrigin::Injected || m_origin == protocol::TypeBuilder::CSS::StyleSheetOrigin::User_agent)
|
| + if (m_origin == protocol::CSS::StyleSheetOriginEnum::Injected || m_origin == protocol::CSS::StyleSheetOriginEnum::UserAgent)
|
| return false;
|
|
|
| if (!m_pageStyleSheet->ownerDocument())
|
|
|