| 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 542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 553 | 553 |
| 554 return result.release(); | 554 return result.release(); |
| 555 } | 555 } |
| 556 | 556 |
| 557 PassRefPtr<TypeBuilder::Array<TypeBuilder::CSS::CSSComputedStyleProperty> > Insp
ectorStyle::buildArrayForComputedStyle() const | 557 PassRefPtr<TypeBuilder::Array<TypeBuilder::CSS::CSSComputedStyleProperty> > Insp
ectorStyle::buildArrayForComputedStyle() const |
| 558 { | 558 { |
| 559 RefPtr<TypeBuilder::Array<TypeBuilder::CSS::CSSComputedStyleProperty> > resu
lt = TypeBuilder::Array<TypeBuilder::CSS::CSSComputedStyleProperty>::create(); | 559 RefPtr<TypeBuilder::Array<TypeBuilder::CSS::CSSComputedStyleProperty> > resu
lt = TypeBuilder::Array<TypeBuilder::CSS::CSSComputedStyleProperty>::create(); |
| 560 WillBeHeapVector<InspectorStyleProperty> properties; | 560 WillBeHeapVector<InspectorStyleProperty> properties; |
| 561 populateAllProperties(properties); | 561 populateAllProperties(properties); |
| 562 | 562 |
| 563 for (WillBeHeapVector<InspectorStyleProperty>::iterator it = properties.begi
n(), itEnd = properties.end(); it != itEnd; ++it) { | 563 for (auto& property : properties) { |
| 564 const CSSPropertySourceData& propertyEntry = it->sourceData; | 564 const CSSPropertySourceData& propertyEntry = property.sourceData; |
| 565 RefPtr<TypeBuilder::CSS::CSSComputedStyleProperty> entry = TypeBuilder::
CSS::CSSComputedStyleProperty::create() | 565 RefPtr<TypeBuilder::CSS::CSSComputedStyleProperty> entry = TypeBuilder::
CSS::CSSComputedStyleProperty::create() |
| 566 .setName(propertyEntry.name) | 566 .setName(propertyEntry.name) |
| 567 .setValue(propertyEntry.value); | 567 .setValue(propertyEntry.value); |
| 568 result->addItem(entry); | 568 result->addItem(entry); |
| 569 } | 569 } |
| 570 | 570 |
| 571 return result.release(); | 571 return result.release(); |
| 572 } | 572 } |
| 573 | 573 |
| 574 bool InspectorStyle::verifyPropertyText(const String& propertyText, bool canOmit
Semicolon) | 574 bool InspectorStyle::verifyPropertyText(const String& propertyText, bool canOmit
Semicolon) |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 663 return true; | 663 return true; |
| 664 } | 664 } |
| 665 | 665 |
| 666 void InspectorStyle::populateAllProperties(WillBeHeapVector<InspectorStyleProper
ty>& result) const | 666 void InspectorStyle::populateAllProperties(WillBeHeapVector<InspectorStyleProper
ty>& result) const |
| 667 { | 667 { |
| 668 HashSet<String> sourcePropertyNames; | 668 HashSet<String> sourcePropertyNames; |
| 669 | 669 |
| 670 RefPtrWillBeRawPtr<CSSRuleSourceData> sourceData = extractSourceData(); | 670 RefPtrWillBeRawPtr<CSSRuleSourceData> sourceData = extractSourceData(); |
| 671 if (sourceData && sourceData->styleSourceData) { | 671 if (sourceData && sourceData->styleSourceData) { |
| 672 WillBeHeapVector<CSSPropertySourceData>& sourcePropertyData = sourceData
->styleSourceData->propertyData; | 672 WillBeHeapVector<CSSPropertySourceData>& sourcePropertyData = sourceData
->styleSourceData->propertyData; |
| 673 for (WillBeHeapVector<CSSPropertySourceData>::const_iterator it = source
PropertyData.begin(); it != sourcePropertyData.end(); ++it) { | 673 for (const auto& data : sourcePropertyData) { |
| 674 InspectorStyleProperty p(*it, true); | 674 InspectorStyleProperty p(data, true); |
| 675 bool isPropertyTextKnown = textForRange(p.sourceData.range, &p.rawTe
xt); | 675 bool isPropertyTextKnown = textForRange(p.sourceData.range, &p.rawTe
xt); |
| 676 ASSERT_UNUSED(isPropertyTextKnown, isPropertyTextKnown); | 676 ASSERT_UNUSED(isPropertyTextKnown, isPropertyTextKnown); |
| 677 result.append(p); | 677 result.append(p); |
| 678 sourcePropertyNames.add(it->name.lower()); | 678 sourcePropertyNames.add(data.name.lower()); |
| 679 } | 679 } |
| 680 } | 680 } |
| 681 | 681 |
| 682 for (int i = 0, size = m_style->length(); i < size; ++i) { | 682 for (int i = 0, size = m_style->length(); i < size; ++i) { |
| 683 String name = m_style->item(i); | 683 String name = m_style->item(i); |
| 684 if (!sourcePropertyNames.add(name.lower()).isNewEntry) | 684 if (!sourcePropertyNames.add(name.lower()).isNewEntry) |
| 685 continue; | 685 continue; |
| 686 | 686 |
| 687 String value = m_style->getPropertyValue(name); | 687 String value = m_style->getPropertyValue(name); |
| 688 if (value.isEmpty()) | 688 if (value.isEmpty()) |
| 689 continue; | 689 continue; |
| 690 result.append(InspectorStyleProperty(CSSPropertySourceData(name, value,
!m_style->getPropertyPriority(name).isEmpty(), false, true, SourceRange()), fals
e)); | 690 result.append(InspectorStyleProperty(CSSPropertySourceData(name, value,
!m_style->getPropertyPriority(name).isEmpty(), false, true, SourceRange()), fals
e)); |
| 691 } | 691 } |
| 692 } | 692 } |
| 693 | 693 |
| 694 PassRefPtr<TypeBuilder::CSS::CSSStyle> InspectorStyle::styleWithProperties() con
st | 694 PassRefPtr<TypeBuilder::CSS::CSSStyle> InspectorStyle::styleWithProperties() con
st |
| 695 { | 695 { |
| 696 RefPtr<Array<TypeBuilder::CSS::CSSProperty> > propertiesObject = Array<TypeB
uilder::CSS::CSSProperty>::create(); | 696 RefPtr<Array<TypeBuilder::CSS::CSSProperty> > propertiesObject = Array<TypeB
uilder::CSS::CSSProperty>::create(); |
| 697 RefPtr<Array<TypeBuilder::CSS::ShorthandEntry> > shorthandEntries = Array<Ty
peBuilder::CSS::ShorthandEntry>::create(); | 697 RefPtr<Array<TypeBuilder::CSS::ShorthandEntry> > shorthandEntries = Array<Ty
peBuilder::CSS::ShorthandEntry>::create(); |
| 698 HashSet<String> foundShorthands; | 698 HashSet<String> foundShorthands; |
| 699 RefPtrWillBeRawPtr<CSSRuleSourceData> sourceData = extractSourceData(); | 699 RefPtrWillBeRawPtr<CSSRuleSourceData> sourceData = extractSourceData(); |
| 700 | 700 |
| 701 WillBeHeapVector<InspectorStyleProperty> properties; | 701 WillBeHeapVector<InspectorStyleProperty> properties; |
| 702 populateAllProperties(properties); | 702 populateAllProperties(properties); |
| 703 | 703 |
| 704 for (WillBeHeapVector<InspectorStyleProperty>::iterator it = properties.begi
n(), itEnd = properties.end(); it != itEnd; ++it) { | 704 for (auto& styleProperty : properties) { |
| 705 const CSSPropertySourceData& propertyEntry = it->sourceData; | 705 const CSSPropertySourceData& propertyEntry = styleProperty.sourceData; |
| 706 const String& name = propertyEntry.name; | 706 const String& name = propertyEntry.name; |
| 707 | 707 |
| 708 RefPtr<TypeBuilder::CSS::CSSProperty> property = TypeBuilder::CSS::CSSPr
operty::create() | 708 RefPtr<TypeBuilder::CSS::CSSProperty> property = TypeBuilder::CSS::CSSPr
operty::create() |
| 709 .setName(name) | 709 .setName(name) |
| 710 .setValue(propertyEntry.value); | 710 .setValue(propertyEntry.value); |
| 711 propertiesObject->addItem(property); | 711 propertiesObject->addItem(property); |
| 712 | 712 |
| 713 // Default "parsedOk" == true. | 713 // Default "parsedOk" == true. |
| 714 if (!propertyEntry.parsedOk) | 714 if (!propertyEntry.parsedOk) |
| 715 property->setParsedOk(false); | 715 property->setParsedOk(false); |
| 716 if (it->hasRawText()) | 716 if (styleProperty.hasRawText()) |
| 717 property->setText(it->rawText); | 717 property->setText(styleProperty.rawText); |
| 718 | 718 |
| 719 if (propertyEntry.important) | 719 if (propertyEntry.important) |
| 720 property->setImportant(true); | 720 property->setImportant(true); |
| 721 if (it->hasSource) { | 721 if (styleProperty.hasSource) { |
| 722 property->setRange(buildSourceRangeObject(propertyEntry.range, m_par
entStyleSheet ? m_parentStyleSheet->lineEndings() : nullptr)); | 722 property->setRange(buildSourceRangeObject(propertyEntry.range, m_par
entStyleSheet ? m_parentStyleSheet->lineEndings() : nullptr)); |
| 723 if (!propertyEntry.disabled) { | 723 if (!propertyEntry.disabled) { |
| 724 ASSERT_UNUSED(sourceData, sourceData); | 724 ASSERT_UNUSED(sourceData, sourceData); |
| 725 property->setImplicit(false); | 725 property->setImplicit(false); |
| 726 } | 726 } |
| 727 property->setDisabled(propertyEntry.disabled); | 727 property->setDisabled(propertyEntry.disabled); |
| 728 } else if (!propertyEntry.disabled) { | 728 } else if (!propertyEntry.disabled) { |
| 729 bool implicit = m_style->isPropertyImplicit(name); | 729 bool implicit = m_style->isPropertyImplicit(name); |
| 730 // Default "implicit" == false. | 730 // Default "implicit" == false. |
| 731 if (implicit) | 731 if (implicit) |
| (...skipping 1257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1989 | 1989 |
| 1990 void InspectorStyleSheetForInlineStyle::trace(Visitor* visitor) | 1990 void InspectorStyleSheetForInlineStyle::trace(Visitor* visitor) |
| 1991 { | 1991 { |
| 1992 visitor->trace(m_element); | 1992 visitor->trace(m_element); |
| 1993 visitor->trace(m_ruleSourceData); | 1993 visitor->trace(m_ruleSourceData); |
| 1994 visitor->trace(m_inspectorStyle); | 1994 visitor->trace(m_inspectorStyle); |
| 1995 InspectorStyleSheetBase::trace(visitor); | 1995 InspectorStyleSheetBase::trace(visitor); |
| 1996 } | 1996 } |
| 1997 | 1997 |
| 1998 } // namespace blink | 1998 } // namespace blink |
| OLD | NEW |