Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(361)

Side by Side Diff: Source/core/inspector/InspectorStyleSheet.cpp

Issue 1204473006: DevTools: explicitly map CSSOM rules to source ranges. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: for landing Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/inspector/InspectorStyleSheet.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 434 matching lines...) Expand 10 before | Expand all | Expand 10 after
445 case StyleRule::Supports: 445 case StyleRule::Supports:
446 result->append(data); 446 result->append(data);
447 flattenSourceData(&data->childRules, result); 447 flattenSourceData(&data->childRules, result);
448 break; 448 break;
449 default: 449 default:
450 break; 450 break;
451 } 451 }
452 } 452 }
453 } 453 }
454 454
455 PassRefPtrWillBeRawPtr<CSSRuleList> asCSSRuleList(CSSRule* rule)
456 {
457 if (!rule)
458 return nullptr;
459
460 if (rule->type() == CSSRule::MEDIA_RULE)
461 return toCSSMediaRule(rule)->cssRules();
462
463 if (rule->type() == CSSRule::SUPPORTS_RULE)
464 return toCSSSupportsRule(rule)->cssRules();
465
466 return nullptr;
467 }
468
469 template <typename RuleList>
470 void collectFlatRules(RuleList ruleList, CSSRuleVector* result)
471 {
472 if (!ruleList)
473 return;
474
475 for (unsigned i = 0, size = ruleList->length(); i < size; ++i) {
476 CSSRule* rule = ruleList->item(i);
477
478 // The result->append()'ed types should be exactly the same as in flatte nSourceData().
479 switch (rule->type()) {
480 case CSSRule::STYLE_RULE:
481 case CSSRule::IMPORT_RULE:
482 case CSSRule::CHARSET_RULE:
483 case CSSRule::PAGE_RULE:
484 case CSSRule::FONT_FACE_RULE:
485 case CSSRule::VIEWPORT_RULE:
486 case CSSRule::KEYFRAMES_RULE:
487 result->append(rule);
488 break;
489 case CSSRule::MEDIA_RULE:
490 case CSSRule::SUPPORTS_RULE:
491 result->append(rule);
492 collectFlatRules(asCSSRuleList(rule), result);
493 break;
494 default:
495 break;
496 }
497 }
498 }
499
455 } // namespace 500 } // namespace
456 501
457 namespace blink { 502 namespace blink {
458 503
459 enum MediaListSource { 504 enum MediaListSource {
460 MediaListSourceLinkedSheet, 505 MediaListSourceLinkedSheet,
461 MediaListSourceInlineSheet, 506 MediaListSourceInlineSheet,
462 MediaListSourceMediaRule, 507 MediaListSourceMediaRule,
463 MediaListSourceImportRule 508 MediaListSourceImportRule
464 }; 509 };
465 510
466 static PassRefPtr<TypeBuilder::CSS::SourceRange> buildSourceRangeObject(const So urceRange& range, const LineEndings* lineEndings) 511 static PassRefPtr<TypeBuilder::CSS::SourceRange> buildSourceRangeObject(const So urceRange& range, const LineEndings* lineEndings)
467 { 512 {
468 if (!lineEndings) 513 if (!lineEndings)
469 return nullptr; 514 return nullptr;
470 TextPosition start = TextPosition::fromOffsetAndLineEndings(range.start, *li neEndings); 515 TextPosition start = TextPosition::fromOffsetAndLineEndings(range.start, *li neEndings);
471 TextPosition end = TextPosition::fromOffsetAndLineEndings(range.end, *lineEn dings); 516 TextPosition end = TextPosition::fromOffsetAndLineEndings(range.end, *lineEn dings);
472 517
473 RefPtr<TypeBuilder::CSS::SourceRange> result = TypeBuilder::CSS::SourceRange ::create() 518 RefPtr<TypeBuilder::CSS::SourceRange> result = TypeBuilder::CSS::SourceRange ::create()
474 .setStartLine(start.m_line.zeroBasedInt()) 519 .setStartLine(start.m_line.zeroBasedInt())
475 .setStartColumn(start.m_column.zeroBasedInt()) 520 .setStartColumn(start.m_column.zeroBasedInt())
476 .setEndLine(end.m_line.zeroBasedInt()) 521 .setEndLine(end.m_line.zeroBasedInt())
477 .setEndColumn(end.m_column.zeroBasedInt()); 522 .setEndColumn(end.m_column.zeroBasedInt());
478 return result.release(); 523 return result.release();
479 } 524 }
480 525
481 static PassRefPtrWillBeRawPtr<CSSRuleList> asCSSRuleList(CSSRule* rule)
482 {
483 if (!rule)
484 return nullptr;
485
486 if (rule->type() == CSSRule::MEDIA_RULE)
487 return toCSSMediaRule(rule)->cssRules();
488
489 if (rule->type() == CSSRule::SUPPORTS_RULE)
490 return toCSSSupportsRule(rule)->cssRules();
491
492 return nullptr;
493 }
494
495 PassRefPtrWillBeRawPtr<InspectorStyle> InspectorStyle::create(PassRefPtrWillBeRa wPtr<CSSStyleDeclaration> style, PassRefPtrWillBeRawPtr<CSSRuleSourceData> sourc eData, InspectorStyleSheetBase* parentStyleSheet) 526 PassRefPtrWillBeRawPtr<InspectorStyle> InspectorStyle::create(PassRefPtrWillBeRa wPtr<CSSStyleDeclaration> style, PassRefPtrWillBeRawPtr<CSSRuleSourceData> sourc eData, InspectorStyleSheetBase* parentStyleSheet)
496 { 527 {
497 return adoptRefWillBeNoop(new InspectorStyle(style, sourceData, parentStyleS heet)); 528 return adoptRefWillBeNoop(new InspectorStyle(style, sourceData, parentStyleS heet));
498 } 529 }
499 530
500 InspectorStyle::InspectorStyle(PassRefPtrWillBeRawPtr<CSSStyleDeclaration> style , PassRefPtrWillBeRawPtr<CSSRuleSourceData> sourceData, InspectorStyleSheetBase* parentStyleSheet) 531 InspectorStyle::InspectorStyle(PassRefPtrWillBeRawPtr<CSSStyleDeclaration> style , PassRefPtrWillBeRawPtr<CSSRuleSourceData> sourceData, InspectorStyleSheetBase* parentStyleSheet)
501 : m_style(style) 532 : m_style(style)
502 , m_sourceData(sourceData) 533 , m_sourceData(sourceData)
503 , m_parentStyleSheet(parentStyleSheet) 534 , m_parentStyleSheet(parentStyleSheet)
504 { 535 {
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
683 714
684 void InspectorStyleSheetBase::onStyleSheetTextChanged() 715 void InspectorStyleSheetBase::onStyleSheetTextChanged()
685 { 716 {
686 m_lineEndings = adoptPtr(new LineEndings()); 717 m_lineEndings = adoptPtr(new LineEndings());
687 if (listener()) 718 if (listener())
688 listener()->styleSheetChanged(this); 719 listener()->styleSheetChanged(this);
689 } 720 }
690 721
691 PassRefPtr<TypeBuilder::CSS::CSSStyle> InspectorStyleSheetBase::buildObjectForSt yle(CSSStyleDeclaration* style) 722 PassRefPtr<TypeBuilder::CSS::CSSStyle> InspectorStyleSheetBase::buildObjectForSt yle(CSSStyleDeclaration* style)
692 { 723 {
693 RefPtrWillBeRawPtr<InspectorStyle> is = inspectorStyle(style); 724 return inspectorStyle(style)->buildObjectForStyle();
694 return is->buildObjectForStyle();
695 } 725 }
696 726
697 const LineEndings* InspectorStyleSheetBase::lineEndings() 727 const LineEndings* InspectorStyleSheetBase::lineEndings()
698 { 728 {
699 if (m_lineEndings->size() > 0) 729 if (m_lineEndings->size() > 0)
700 return m_lineEndings.get(); 730 return m_lineEndings.get();
701 String text; 731 String text;
702 if (getText(&text)) 732 if (getText(&text))
703 m_lineEndings = WTF::lineEndings(text); 733 m_lineEndings = WTF::lineEndings(text);
704 return m_lineEndings.get(); 734 return m_lineEndings.get();
(...skipping 24 matching lines...) Expand all
729 , m_pageStyleSheet(pageStyleSheet) 759 , m_pageStyleSheet(pageStyleSheet)
730 , m_origin(origin) 760 , m_origin(origin)
731 , m_documentURL(documentURL) 761 , m_documentURL(documentURL)
732 { 762 {
733 String text; 763 String text;
734 bool success = inlineStyleSheetText(&text); 764 bool success = inlineStyleSheetText(&text);
735 if (!success) 765 if (!success)
736 success = resourceStyleSheetText(&text); 766 success = resourceStyleSheetText(&text);
737 if (success) 767 if (success)
738 innerSetText(text, false); 768 innerSetText(text, false);
769 collectFlatRules();
739 } 770 }
740 771
741 InspectorStyleSheet::~InspectorStyleSheet() 772 InspectorStyleSheet::~InspectorStyleSheet()
742 { 773 {
743 } 774 }
744 775
745 DEFINE_TRACE(InspectorStyleSheet) 776 DEFINE_TRACE(InspectorStyleSheet)
746 { 777 {
747 visitor->trace(m_cssAgent); 778 visitor->trace(m_cssAgent);
748 visitor->trace(m_resourceAgent); 779 visitor->trace(m_resourceAgent);
(...skipping 12 matching lines...) Expand all
761 792
762 String InspectorStyleSheet::finalURL() 793 String InspectorStyleSheet::finalURL()
763 { 794 {
764 String url = styleSheetURL(m_pageStyleSheet.get()); 795 String url = styleSheetURL(m_pageStyleSheet.get());
765 return url.isEmpty() ? m_documentURL : url; 796 return url.isEmpty() ? m_documentURL : url;
766 } 797 }
767 798
768 bool InspectorStyleSheet::setText(const String& text, ExceptionState& exceptionS tate) 799 bool InspectorStyleSheet::setText(const String& text, ExceptionState& exceptionS tate)
769 { 800 {
770 innerSetText(text, true); 801 innerSetText(text, true);
771 m_flatRules.clear();
772 802
773 if (listener()) 803 if (listener())
774 listener()->willReparseStyleSheet(); 804 listener()->willReparseStyleSheet();
775 805
776 { 806 {
777 // Have a separate scope for clearRules() (bug 95324). 807 // Have a separate scope for clearRules() (bug 95324).
778 CSSStyleSheet::RuleMutationScope mutationScope(m_pageStyleSheet.get()); 808 CSSStyleSheet::RuleMutationScope mutationScope(m_pageStyleSheet.get());
779 m_pageStyleSheet->contents()->clearRules(); 809 m_pageStyleSheet->contents()->clearRules();
780 m_pageStyleSheet->clearChildRuleCSSOMWrappers(); 810 m_pageStyleSheet->clearChildRuleCSSOMWrappers();
781 } 811 }
782 { 812 {
783 CSSStyleSheet::RuleMutationScope mutationScope(m_pageStyleSheet.get()); 813 CSSStyleSheet::RuleMutationScope mutationScope(m_pageStyleSheet.get());
784 m_pageStyleSheet->contents()->parseString(text); 814 m_pageStyleSheet->contents()->parseString(text);
785 } 815 }
786 816
787 if (listener()) 817 if (listener())
788 listener()->didReparseStyleSheet(); 818 listener()->didReparseStyleSheet();
789 onStyleSheetTextChanged(); 819 onStyleSheetTextChanged();
790 m_pageStyleSheet->ownerDocument()->styleResolverChanged(FullStyleUpdate); 820 m_pageStyleSheet->ownerDocument()->styleResolverChanged(FullStyleUpdate);
821
822 collectFlatRules();
791 return true; 823 return true;
792 } 824 }
793 825
794 RefPtrWillBeRawPtr<CSSStyleRule> InspectorStyleSheet::setRuleSelector(const Sour ceRange& range, const String& text, SourceRange* newRange, String* oldText, Exce ptionState& exceptionState) 826 RefPtrWillBeRawPtr<CSSStyleRule> InspectorStyleSheet::setRuleSelector(const Sour ceRange& range, const String& text, SourceRange* newRange, String* oldText, Exce ptionState& exceptionState)
795 { 827 {
796 if (!verifySelectorText(m_pageStyleSheet->ownerDocument(), text)) { 828 if (!verifySelectorText(m_pageStyleSheet->ownerDocument(), text)) {
797 exceptionState.throwDOMException(SyntaxError, "Selector or media text is not valid."); 829 exceptionState.throwDOMException(SyntaxError, "Selector or media text is not valid.");
798 return nullptr; 830 return nullptr;
799 } 831 }
800 832
801 CSSRule* rule = nullptr; 833 RefPtrWillBeRawPtr<CSSRuleSourceData> sourceData = findRuleByHeaderRange(ran ge);
802 CSSRuleSourceData* sourceData = nullptr; 834 if (!sourceData || !sourceData->styleSourceData) {
803 if (!findRuleByHeaderRange(range, &rule, &sourceData) || !sourceData->styleS ourceData || rule->type() != CSSRule::STYLE_RULE) {
804 exceptionState.throwDOMException(NotFoundError, "Source range didn't mat ch existing source range"); 835 exceptionState.throwDOMException(NotFoundError, "Source range didn't mat ch existing source range");
805 return nullptr; 836 return nullptr;
806 } 837 }
807 838
808 RefPtrWillBeRawPtr<CSSStyleRule> styleRule = InspectorCSSAgent::asCSSStyleR ule(rule); 839 RefPtrWillBeRawPtr<CSSRule> rule = ruleForSourceData(sourceData.get());
840 if (!rule || !rule->parentStyleSheet() || rule->type() != CSSRule::STYLE_RUL E) {
841 exceptionState.throwDOMException(NotFoundError, "Source range didn't mat ch existing style source range");
842 return nullptr;
843 }
844
845 RefPtrWillBeRawPtr<CSSStyleRule> styleRule = InspectorCSSAgent::asCSSStyleRu le(rule.get());
809 styleRule->setSelectorText(text); 846 styleRule->setSelectorText(text);
810 847
811 replaceText(sourceData->ruleHeaderRange, text, newRange, oldText); 848 replaceText(sourceData->ruleHeaderRange, text, newRange, oldText);
812 onStyleSheetTextChanged(); 849 onStyleSheetTextChanged();
813 850
814 return styleRule; 851 return styleRule;
815 } 852 }
816 853
817 RefPtrWillBeRawPtr<CSSStyleRule> InspectorStyleSheet::setStyleText(const SourceR ange& range, const String& text, SourceRange* newRange, String* oldText, Excepti onState& exceptionState) 854 RefPtrWillBeRawPtr<CSSStyleRule> InspectorStyleSheet::setStyleText(const SourceR ange& range, const String& text, SourceRange* newRange, String* oldText, Excepti onState& exceptionState)
818 { 855 {
819 if (!verifyStyleText(m_pageStyleSheet->ownerDocument(), text)) { 856 if (!verifyStyleText(m_pageStyleSheet->ownerDocument(), text)) {
820 exceptionState.throwDOMException(SyntaxError, "Style text is not valid." ); 857 exceptionState.throwDOMException(SyntaxError, "Style text is not valid." );
821 return nullptr; 858 return nullptr;
822 } 859 }
823 860
824 CSSRule* rule = nullptr; 861 RefPtrWillBeRawPtr<CSSRuleSourceData> sourceData = findRuleByBodyRange(range );
825 CSSRuleSourceData* sourceData = nullptr; 862 if (!sourceData || !sourceData->styleSourceData) {
826 if (!findRuleByBodyRange(range, &rule, &sourceData) || !sourceData->styleSou rceData || rule->type() != CSSRule::STYLE_RULE) {
827 exceptionState.throwDOMException(NotFoundError, "Source range didn't mat ch existing style source range"); 863 exceptionState.throwDOMException(NotFoundError, "Source range didn't mat ch existing style source range");
828 return nullptr; 864 return nullptr;
829 } 865 }
830 866
831 RefPtrWillBeRawPtr<CSSStyleRule> styleRule = InspectorCSSAgent::asCSSStyleRu le(rule); 867 RefPtrWillBeRawPtr<CSSRule> rule = ruleForSourceData(sourceData.get());
868 if (!rule || !rule->parentStyleSheet() || rule->type() != CSSRule::STYLE_RUL E) {
869 exceptionState.throwDOMException(NotFoundError, "Source range didn't mat ch existing style source range");
870 return nullptr;
871 }
872
873 RefPtrWillBeRawPtr<CSSStyleRule> styleRule = InspectorCSSAgent::asCSSStyleRu le(rule.get());
832 styleRule->style()->setCSSText(text, exceptionState); 874 styleRule->style()->setCSSText(text, exceptionState);
833 875
834 replaceText(sourceData->ruleBodyRange, text, newRange, oldText); 876 replaceText(sourceData->ruleBodyRange, text, newRange, oldText);
835 onStyleSheetTextChanged(); 877 onStyleSheetTextChanged();
836 878
837 return styleRule; 879 return styleRule;
838 } 880 }
839 881
840 RefPtrWillBeRawPtr<CSSMediaRule> InspectorStyleSheet::setMediaRuleText(const Sou rceRange& range, const String& text, SourceRange* newRange, String* oldText, Exc eptionState& exceptionState) 882 RefPtrWillBeRawPtr<CSSMediaRule> InspectorStyleSheet::setMediaRuleText(const Sou rceRange& range, const String& text, SourceRange* newRange, String* oldText, Exc eptionState& exceptionState)
841 { 883 {
842 if (!verifyMediaText(m_pageStyleSheet->ownerDocument(), text)) { 884 if (!verifyMediaText(m_pageStyleSheet->ownerDocument(), text)) {
843 exceptionState.throwDOMException(SyntaxError, "Selector or media text is not valid."); 885 exceptionState.throwDOMException(SyntaxError, "Selector or media text is not valid.");
844 return nullptr; 886 return nullptr;
845 } 887 }
846 888
847 CSSRule* rule = nullptr; 889 RefPtrWillBeRawPtr<CSSRuleSourceData> sourceData = findRuleByHeaderRange(ran ge);
848 CSSRuleSourceData* sourceData = nullptr; 890 if (!sourceData || !sourceData->mediaSourceData) {
849 if (!findRuleByHeaderRange(range, &rule, &sourceData) || !sourceData->mediaS ourceData || rule->type() != CSSRule::MEDIA_RULE) {
850 exceptionState.throwDOMException(NotFoundError, "Source range didn't mat ch existing source range"); 891 exceptionState.throwDOMException(NotFoundError, "Source range didn't mat ch existing source range");
851 return nullptr; 892 return nullptr;
852 } 893 }
853 894
854 RefPtrWillBeRawPtr<CSSMediaRule> mediaRule = InspectorCSSAgent::asCSSMediaR ule(rule); 895 RefPtrWillBeRawPtr<CSSRule> rule = ruleForSourceData(sourceData.get());
896 if (!rule || !rule->parentStyleSheet() || rule->type() != CSSRule::MEDIA_RUL E) {
897 exceptionState.throwDOMException(NotFoundError, "Source range didn't mat ch existing style source range");
898 return nullptr;
899 }
900
901 RefPtrWillBeRawPtr<CSSMediaRule> mediaRule = InspectorCSSAgent::asCSSMediaR ule(rule.get());
855 mediaRule->media()->setMediaText(text); 902 mediaRule->media()->setMediaText(text);
856 903
857 replaceText(sourceData->ruleHeaderRange, text, newRange, oldText); 904 replaceText(sourceData->ruleHeaderRange, text, newRange, oldText);
858 onStyleSheetTextChanged(); 905 onStyleSheetTextChanged();
859 906
860 return mediaRule; 907 return mediaRule;
861 } 908 }
862 909
863 unsigned InspectorStyleSheet::ruleIndexBySourceRange(const CSSMediaRule* parentM ediaRule, const SourceRange& sourceRange) 910 unsigned InspectorStyleSheet::ruleIndexBySourceRange(CSSMediaRule* parentMediaRu le, const SourceRange& sourceRange)
864 { 911 {
865 ASSERT(m_sourceData); 912 ASSERT(m_sourceData);
866 unsigned index = 0; 913 unsigned index = 0;
867 for (size_t i = 0; i < m_flatRules.size() && i < m_sourceData->size(); ++i) { 914 for (size_t i = 0; i < m_flatRules.size() && i < m_sourceData->size(); ++i) {
868 RefPtrWillBeRawPtr<CSSRule> rule = m_flatRules.at(i); 915 RefPtrWillBeRawPtr<CSSRule> rule = m_flatRules.at(i);
869 if (rule->parentRule() != parentMediaRule) 916 if (rule->parentRule() != parentMediaRule)
870 continue; 917 continue;
871 RefPtrWillBeRawPtr<CSSRuleSourceData> ruleSourceData = m_sourceData->at( i); 918 RefPtrWillBeRawPtr<CSSRuleSourceData> ruleSourceData = m_sourceData->at( i);
872 if (ruleSourceData->ruleBodyRange.end < sourceRange.start) 919 if (ruleSourceData->ruleBodyRange.end < sourceRange.start)
873 ++index; 920 ++index;
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
918 if (sourceRange.start < ruleSourceData->ruleBodyRange.start || ruleSourc eData->ruleBodyRange.end < sourceRange.start) 965 if (sourceRange.start < ruleSourceData->ruleBodyRange.start || ruleSourc eData->ruleBodyRange.end < sourceRange.start)
919 continue; 966 continue;
920 if (containingRuleIndex == -1 || containingRuleLength > ruleSourceData-> ruleBodyRange.length()) { 967 if (containingRuleIndex == -1 || containingRuleLength > ruleSourceData-> ruleBodyRange.length()) {
921 containingRuleIndex = i; 968 containingRuleIndex = i;
922 containingRuleLength = ruleSourceData->ruleBodyRange.length(); 969 containingRuleLength = ruleSourceData->ruleBodyRange.length();
923 } 970 }
924 } 971 }
925 if (containingRuleIndex == -1) 972 if (containingRuleIndex == -1)
926 return insertCSSOMRuleInStyleSheet(sourceRange, ruleText, exceptionState ); 973 return insertCSSOMRuleInStyleSheet(sourceRange, ruleText, exceptionState );
927 974
928 RefPtrWillBeRawPtr<CSSRule> rule = m_flatRules.at(containingRuleIndex); 975 RefPtrWillBeRawPtr<CSSRule> rule = containingRuleIndex < static_cast<int>(m_ flatRules.size()) ? m_flatRules.at(containingRuleIndex) : nullptr;
929 if (rule->type() != CSSRule::MEDIA_RULE) { 976 if (!rule || rule->type() != CSSRule::MEDIA_RULE) {
930 exceptionState.throwDOMException(NotFoundError, "Cannot insert rule in n on-media rule."); 977 exceptionState.throwDOMException(NotFoundError, "Cannot insert rule in n on-media rule.");
931 return nullptr; 978 return nullptr;
932 } 979 }
980
933 return insertCSSOMRuleInMediaRule(toCSSMediaRule(rule.get()), sourceRange, r uleText, exceptionState); 981 return insertCSSOMRuleInMediaRule(toCSSMediaRule(rule.get()), sourceRange, r uleText, exceptionState);
934 } 982 }
935 983
936 RefPtrWillBeRawPtr<CSSStyleRule> InspectorStyleSheet::addRule(const String& rule Text, const SourceRange& location, SourceRange* addedRange, ExceptionState& exce ptionState) 984 RefPtrWillBeRawPtr<CSSStyleRule> InspectorStyleSheet::addRule(const String& rule Text, const SourceRange& location, SourceRange* addedRange, ExceptionState& exce ptionState)
937 { 985 {
938 if (location.start != location.end) { 986 if (location.start != location.end) {
939 exceptionState.throwDOMException(NotFoundError, "Source range must be co llapsed."); 987 exceptionState.throwDOMException(NotFoundError, "Source range must be co llapsed.");
940 return nullptr; 988 return nullptr;
941 } 989 }
942 990
943 if (!verifyRuleText(m_pageStyleSheet->ownerDocument(), ruleText)) { 991 if (!verifyRuleText(m_pageStyleSheet->ownerDocument(), ruleText)) {
944 exceptionState.throwDOMException(SyntaxError, "Rule text is not valid.") ; 992 exceptionState.throwDOMException(SyntaxError, "Rule text is not valid.") ;
945 return nullptr; 993 return nullptr;
946 } 994 }
947 995
948 if (!m_sourceData) { 996 if (!m_sourceData) {
949 exceptionState.throwDOMException(NotFoundError, "Style is read-only."); 997 exceptionState.throwDOMException(NotFoundError, "Style is read-only.");
950 return nullptr; 998 return nullptr;
951 } 999 }
952 ensureFlatRules();
953 1000
954 RefPtrWillBeRawPtr<CSSStyleRule> styleRule = insertCSSOMRuleBySourceRange(lo cation, ruleText, exceptionState); 1001 RefPtrWillBeRawPtr<CSSStyleRule> styleRule = insertCSSOMRuleBySourceRange(lo cation, ruleText, exceptionState);
955 if (exceptionState.hadException()) 1002 if (exceptionState.hadException())
956 return nullptr; 1003 return nullptr;
957 1004
958 replaceText(location, ruleText, addedRange, nullptr); 1005 replaceText(location, ruleText, addedRange, nullptr);
959 m_flatRules.clear(); 1006 collectFlatRules();
960 1007
961 onStyleSheetTextChanged(); 1008 onStyleSheetTextChanged();
962 return styleRule; 1009 return styleRule;
963 } 1010 }
964 1011
965 bool InspectorStyleSheet::deleteRule(const SourceRange& range, ExceptionState& e xceptionState) 1012 bool InspectorStyleSheet::deleteRule(const SourceRange& range, ExceptionState& e xceptionState)
966 { 1013 {
967 if (!m_sourceData) { 1014 if (!m_sourceData) {
968 exceptionState.throwDOMException(NotFoundError, "Style is read-only."); 1015 exceptionState.throwDOMException(NotFoundError, "Style is read-only.");
969 return false; 1016 return false;
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
1016 ++index; 1063 ++index;
1017 ASSERT(index < styleSheet->length()); 1064 ASSERT(index < styleSheet->length());
1018 styleSheet->deleteRule(index, exceptionState); 1065 styleSheet->deleteRule(index, exceptionState);
1019 } 1066 }
1020 // |rule| MAY NOT be addressed after this line! 1067 // |rule| MAY NOT be addressed after this line!
1021 1068
1022 if (exceptionState.hadException()) 1069 if (exceptionState.hadException())
1023 return false; 1070 return false;
1024 1071
1025 replaceText(range, "", nullptr, nullptr); 1072 replaceText(range, "", nullptr, nullptr);
1026 m_flatRules.clear(); 1073 collectFlatRules();
1074
1027 onStyleSheetTextChanged(); 1075 onStyleSheetTextChanged();
1028 return true; 1076 return true;
1029 } 1077 }
1030 1078
1031 void InspectorStyleSheet::replaceText(const SourceRange& range, const String& te xt, SourceRange* newRange, String* oldText) 1079 void InspectorStyleSheet::replaceText(const SourceRange& range, const String& te xt, SourceRange* newRange, String* oldText)
1032 { 1080 {
1033 String sheetText = m_text; 1081 String sheetText = m_text;
1034 if (oldText) 1082 if (oldText)
1035 *oldText = sheetText.substring(range.start, range.length()); 1083 *oldText = sheetText.substring(range.start, range.length());
1036 sheetText.replace(range.start, range.length(), text); 1084 sheetText.replace(range.start, range.length(), text);
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
1082 1130
1083 if (styleSheet->ownerNode()) 1131 if (styleSheet->ownerNode())
1084 result->setOwnerNode(DOMNodeIds::idForNode(styleSheet->ownerNode())); 1132 result->setOwnerNode(DOMNodeIds::idForNode(styleSheet->ownerNode()));
1085 1133
1086 String sourceMapURLValue = sourceMapURL(); 1134 String sourceMapURLValue = sourceMapURL();
1087 if (!sourceMapURLValue.isEmpty()) 1135 if (!sourceMapURLValue.isEmpty())
1088 result->setSourceMapURL(sourceMapURLValue); 1136 result->setSourceMapURL(sourceMapURLValue);
1089 return result.release(); 1137 return result.release();
1090 } 1138 }
1091 1139
1092 PassRefPtr<TypeBuilder::Array<TypeBuilder::CSS::Selector> > InspectorStyleSheet: :selectorsFromSource(const CSSRuleSourceData* sourceData, const String& sheetTex t) 1140 PassRefPtr<TypeBuilder::Array<TypeBuilder::CSS::Selector>> InspectorStyleSheet:: selectorsFromSource(CSSRuleSourceData* sourceData, const String& sheetText)
1093 { 1141 {
1094 ScriptRegexp comment("/\\*[^]*?\\*/", TextCaseSensitive, MultilineEnabled); 1142 ScriptRegexp comment("/\\*[^]*?\\*/", TextCaseSensitive, MultilineEnabled);
1095 RefPtr<TypeBuilder::Array<TypeBuilder::CSS::Selector> > result = TypeBuilder ::Array<TypeBuilder::CSS::Selector>::create(); 1143 RefPtr<TypeBuilder::Array<TypeBuilder::CSS::Selector> > result = TypeBuilder ::Array<TypeBuilder::CSS::Selector>::create();
1096 const SelectorRangeList& ranges = sourceData->selectorRanges; 1144 const SelectorRangeList& ranges = sourceData->selectorRanges;
1097 for (size_t i = 0, size = ranges.size(); i < size; ++i) { 1145 for (size_t i = 0, size = ranges.size(); i < size; ++i) {
1098 const SourceRange& range = ranges.at(i); 1146 const SourceRange& range = ranges.at(i);
1099 String selector = sheetText.substring(range.start, range.length()); 1147 String selector = sheetText.substring(range.start, range.length());
1100 1148
1101 // We don't want to see any comments in the selector components, only th e meaningful parts. 1149 // We don't want to see any comments in the selector components, only th e meaningful parts.
1102 int matchLength; 1150 int matchLength;
1103 int offset = 0; 1151 int offset = 0;
1104 while ((offset = comment.match(selector, offset, &matchLength)) >= 0) 1152 while ((offset = comment.match(selector, offset, &matchLength)) >= 0)
1105 selector.replace(offset, matchLength, ""); 1153 selector.replace(offset, matchLength, "");
1106 1154
1107 RefPtr<TypeBuilder::CSS::Selector> simpleSelector = TypeBuilder::CSS::Se lector::create() 1155 RefPtr<TypeBuilder::CSS::Selector> simpleSelector = TypeBuilder::CSS::Se lector::create()
1108 .setValue(selector.stripWhiteSpace()); 1156 .setValue(selector.stripWhiteSpace());
1109 simpleSelector->setRange(buildSourceRangeObject(range, lineEndings())); 1157 simpleSelector->setRange(buildSourceRangeObject(range, lineEndings()));
1110 result->addItem(simpleSelector.release()); 1158 result->addItem(simpleSelector.release());
1111 } 1159 }
1112 return result.release(); 1160 return result.release();
1113 } 1161 }
1114 1162
1115 PassRefPtr<TypeBuilder::CSS::SelectorList> InspectorStyleSheet::buildObjectForSe lectorList(CSSStyleRule* rule) 1163 PassRefPtr<TypeBuilder::CSS::SelectorList> InspectorStyleSheet::buildObjectForSe lectorList(CSSStyleRule* rule)
1116 { 1164 {
1117 RefPtrWillBeRawPtr<CSSRuleSourceData> sourceData = nullptr; 1165 RefPtrWillBeRawPtr<CSSRuleSourceData> sourceData = sourceDataForRule(rule);
1118 unsigned ruleIndex = indexOf(rule->style());
1119 if (ruleIndex != UINT_MAX && m_sourceData && ruleIndex < m_sourceData->size( ))
1120 sourceData = m_sourceData->at(ruleIndex);
1121 RefPtr<TypeBuilder::Array<TypeBuilder::CSS::Selector> > selectors; 1166 RefPtr<TypeBuilder::Array<TypeBuilder::CSS::Selector> > selectors;
1122 1167
1123 // This intentionally does not rely on the source data to avoid catching the trailing comments (before the declaration starting '{'). 1168 // This intentionally does not rely on the source data to avoid catching the trailing comments (before the declaration starting '{').
1124 String selectorText = rule->selectorText(); 1169 String selectorText = rule->selectorText();
1125 1170
1126 if (sourceData) 1171 if (sourceData) {
1127 selectors = selectorsFromSource(sourceData.get(), m_text); 1172 selectors = selectorsFromSource(sourceData.get(), m_text);
1128 else { 1173 } else {
1129 selectors = TypeBuilder::Array<TypeBuilder::CSS::Selector>::create(); 1174 selectors = TypeBuilder::Array<TypeBuilder::CSS::Selector>::create();
1130 const CSSSelectorList& selectorList = rule->styleRule()->selectorList(); 1175 const CSSSelectorList& selectorList = rule->styleRule()->selectorList();
1131 for (const CSSSelector* selector = selectorList.first(); selector; selec tor = CSSSelectorList::next(*selector)) 1176 for (const CSSSelector* selector = selectorList.first(); selector; selec tor = CSSSelectorList::next(*selector))
1132 selectors->addItem(TypeBuilder::CSS::Selector::create().setValue(sel ector->selectorText()).release()); 1177 selectors->addItem(TypeBuilder::CSS::Selector::create().setValue(sel ector->selectorText()).release());
1133 } 1178 }
1134 RefPtr<TypeBuilder::CSS::SelectorList> result = TypeBuilder::CSS::SelectorLi st::create() 1179 RefPtr<TypeBuilder::CSS::SelectorList> result = TypeBuilder::CSS::SelectorLi st::create()
1135 .setSelectors(selectors) 1180 .setSelectors(selectors)
1136 .setText(selectorText) 1181 .setText(selectorText)
1137 .release(); 1182 .release();
1138 return result.release(); 1183 return result.release();
(...skipping 28 matching lines...) Expand all
1167 1212
1168 bool InspectorStyleSheet::getText(String* result) 1213 bool InspectorStyleSheet::getText(String* result)
1169 { 1214 {
1170 if (m_sourceData) { 1215 if (m_sourceData) {
1171 *result = m_text; 1216 *result = m_text;
1172 return true; 1217 return true;
1173 } 1218 }
1174 return false; 1219 return false;
1175 } 1220 }
1176 1221
1177 PassRefPtr<TypeBuilder::CSS::SourceRange> InspectorStyleSheet::ruleHeaderSourceR ange(const CSSRule* rule) 1222 PassRefPtr<TypeBuilder::CSS::SourceRange> InspectorStyleSheet::ruleHeaderSourceR ange(CSSRule* rule)
1178 { 1223 {
1179 if (!m_sourceData) 1224 if (!m_sourceData)
1180 return nullptr; 1225 return nullptr;
1181 1226 RefPtrWillBeRawPtr<CSSRuleSourceData> sourceData = sourceDataForRule(rule);
1182 ensureFlatRules(); 1227 if (!sourceData)
1183 size_t index = m_flatRules.find(rule);
1184 // FIXME(lusnikov): m_flatRules are not always aligned with the m_sourceData rule source
1185 // datas due to the CSSOM operations that add/remove rules without changing source.
1186 // This is a design issue. See crbug.com/178410
1187 if (index == kNotFound || index >= m_sourceData->size())
1188 return nullptr; 1228 return nullptr;
1189 RefPtrWillBeRawPtr<CSSRuleSourceData> sourceData = m_sourceData->at(static_c ast<unsigned>(index));
1190 return buildSourceRangeObject(sourceData->ruleHeaderRange, lineEndings()); 1229 return buildSourceRangeObject(sourceData->ruleHeaderRange, lineEndings());
1191 } 1230 }
1192 1231
1193 PassRefPtr<TypeBuilder::CSS::SourceRange> InspectorStyleSheet::mediaQueryExpValu eSourceRange(const CSSRule* rule, size_t mediaQueryIndex, size_t mediaQueryExpIn dex) 1232 PassRefPtr<TypeBuilder::CSS::SourceRange> InspectorStyleSheet::mediaQueryExpValu eSourceRange(CSSRule* rule, size_t mediaQueryIndex, size_t mediaQueryExpIndex)
1194 { 1233 {
1195 if (!m_sourceData) 1234 if (!m_sourceData)
1196 return nullptr; 1235 return nullptr;
1197 ensureFlatRules(); 1236 RefPtrWillBeRawPtr<CSSRuleSourceData> sourceData = sourceDataForRule(rule);
1198 size_t index = m_flatRules.find(rule); 1237 if (!sourceData || !sourceData->mediaSourceData || mediaQueryIndex >= source Data->mediaSourceData->queryData.size())
1199 if (index == kNotFound || index >= m_sourceData->size())
1200 return nullptr;
1201 RefPtrWillBeRawPtr<CSSRuleSourceData> sourceData = m_sourceData->at(static_c ast<unsigned>(index));
1202 if (!sourceData->mediaSourceData || mediaQueryIndex >= sourceData->mediaSour ceData->queryData.size())
1203 return nullptr; 1238 return nullptr;
1204 RefPtrWillBeRawPtr<CSSMediaQuerySourceData> mediaQueryData = sourceData->med iaSourceData->queryData.at(mediaQueryIndex); 1239 RefPtrWillBeRawPtr<CSSMediaQuerySourceData> mediaQueryData = sourceData->med iaSourceData->queryData.at(mediaQueryIndex);
1205 if (mediaQueryExpIndex >= mediaQueryData->expData.size()) 1240 if (mediaQueryExpIndex >= mediaQueryData->expData.size())
1206 return nullptr; 1241 return nullptr;
1207 return buildSourceRangeObject(mediaQueryData->expData.at(mediaQueryExpIndex) .valueRange, lineEndings()); 1242 return buildSourceRangeObject(mediaQueryData->expData.at(mediaQueryExpIndex) .valueRange, lineEndings());
1208 } 1243 }
1209 1244
1210 PassRefPtrWillBeRawPtr<InspectorStyle> InspectorStyleSheet::inspectorStyle(RefPt rWillBeRawPtr<CSSStyleDeclaration> style) 1245 PassRefPtrWillBeRawPtr<InspectorStyle> InspectorStyleSheet::inspectorStyle(RefPt rWillBeRawPtr<CSSStyleDeclaration> style)
1211 { 1246 {
1212 if (!style) 1247 return style ? InspectorStyle::create(style, sourceDataForRule(style->parent Rule()), this) : nullptr;
1213 return nullptr;
1214
1215 RefPtrWillBeRawPtr<CSSRuleSourceData> sourceData = nullptr;
1216 unsigned ruleIndex = indexOf(style.get());
1217 if (ruleIndex != UINT_MAX && m_sourceData && ruleIndex < m_sourceData->size( ))
1218 sourceData = m_sourceData->at(ruleIndex);
1219
1220 if (ruleIndex == UINT_MAX) {
1221 // Any rule coming from User Agent and not from DefaultStyleSheet will n ot have id.
1222 // See InspectorCSSAgent::buildObjectForRule for details.
1223 return InspectorStyle::create(style, nullptr, this);
1224 }
1225
1226 return InspectorStyle::create(style, sourceData, this);
1227 } 1248 }
1228 1249
1229 String InspectorStyleSheet::sourceURL() 1250 String InspectorStyleSheet::sourceURL()
1230 { 1251 {
1231 if (!m_sourceURL.isNull()) 1252 if (!m_sourceURL.isNull())
1232 return m_sourceURL; 1253 return m_sourceURL;
1233 if (m_origin != TypeBuilder::CSS::StyleSheetOrigin::Regular) { 1254 if (m_origin != TypeBuilder::CSS::StyleSheetOrigin::Regular) {
1234 m_sourceURL = ""; 1255 m_sourceURL = "";
1235 return m_sourceURL; 1256 return m_sourceURL;
1236 } 1257 }
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
1294 bool deprecated; 1315 bool deprecated;
1295 String commentValue = ContentSearchUtils::findSourceMapURL(styleSheetTex t, ContentSearchUtils::CSSMagicComment, &deprecated); 1316 String commentValue = ContentSearchUtils::findSourceMapURL(styleSheetTex t, ContentSearchUtils::CSSMagicComment, &deprecated);
1296 if (!commentValue.isEmpty()) { 1317 if (!commentValue.isEmpty()) {
1297 // FIXME: add deprecated console message here. 1318 // FIXME: add deprecated console message here.
1298 return commentValue; 1319 return commentValue;
1299 } 1320 }
1300 } 1321 }
1301 return m_pageStyleSheet->contents()->sourceMapURL(); 1322 return m_pageStyleSheet->contents()->sourceMapURL();
1302 } 1323 }
1303 1324
1304 unsigned InspectorStyleSheet::indexOf(CSSStyleDeclaration* style) 1325 RefPtrWillBeRawPtr<CSSRuleSourceData> InspectorStyleSheet::findRuleByHeaderRange (const SourceRange& sourceRange)
1305 { 1326 {
1306 ensureFlatRules(); 1327 if (!m_sourceData)
1307 for (unsigned i = 0, size = m_flatRules.size(); i < size; ++i) { 1328 return nullptr;
1308 CSSStyleRule* styleRule = InspectorCSSAgent::asCSSStyleRule(m_flatRules. at(i).get()); 1329
1309 if (styleRule && styleRule->style() == style) 1330 for (size_t i = 0; i < m_sourceData->size(); ++i) {
1310 return i; 1331 RefPtrWillBeRawPtr<CSSRuleSourceData> ruleSourceData = m_sourceData->at( i);
1332 if (ruleSourceData->ruleHeaderRange.start == sourceRange.start && ruleSo urceData->ruleHeaderRange.end == sourceRange.end) {
1333 return ruleSourceData;
1334 }
1311 } 1335 }
1312 return UINT_MAX; 1336 return nullptr;
1313 } 1337 }
1314 1338
1315 bool InspectorStyleSheet::findRuleByHeaderRange(const SourceRange& sourceRange, CSSRule** pRule, CSSRuleSourceData** pSourceData) 1339 RefPtrWillBeRawPtr<CSSRuleSourceData> InspectorStyleSheet::findRuleByBodyRange(c onst SourceRange& sourceRange)
1316 { 1340 {
1317 if (!m_sourceData) 1341 if (!m_sourceData)
1318 return false; 1342 return nullptr;
1319 ensureFlatRules();
1320 1343
1321 for (size_t i = 0; i < m_sourceData->size() && i < m_flatRules.size(); ++i) { 1344 for (size_t i = 0; i < m_sourceData->size(); ++i) {
1322 RefPtrWillBeRawPtr<CSSRuleSourceData> ruleSourceData = m_sourceData->at( i); 1345 RefPtrWillBeRawPtr<CSSRuleSourceData> ruleSourceData = m_sourceData->at( i);
1323 if (ruleSourceData->ruleHeaderRange.start == sourceRange.start && ruleSo urceData->ruleHeaderRange.end == sourceRange.end) { 1346 if (ruleSourceData->ruleBodyRange.start == sourceRange.start && ruleSour ceData->ruleBodyRange.end == sourceRange.end) {
1324 *pRule = m_flatRules.at(i).get(); 1347 return ruleSourceData;
1325 if (!(*pRule)->parentStyleSheet())
1326 return false;
1327 *pSourceData = ruleSourceData.get();
1328 return true;
1329 } 1348 }
1330 } 1349 }
1331 return false; 1350 return nullptr;
1332 } 1351 }
1333 1352
1334 bool InspectorStyleSheet::findRuleByBodyRange(const SourceRange& sourceRange, CS SRule** pRule, CSSRuleSourceData** pSourceData) 1353 RefPtrWillBeRawPtr<CSSRule> InspectorStyleSheet::ruleForSourceData(CSSRuleSource Data* sourceData)
1335 { 1354 {
1336 if (!m_sourceData) 1355 if (!m_sourceData)
1337 return false; 1356 return nullptr;
1338 ensureFlatRules(); 1357 for (size_t i = 0; i < m_sourceData->size(); ++i) {
1358 if (m_sourceData->at(i).get() == sourceData)
1359 return i < m_flatRules.size() ? m_flatRules.at(i) : nullptr;
1360 }
1361 return nullptr;
1362 }
1339 1363
1340 for (size_t i = 0; i < m_sourceData->size() && i < m_flatRules.size(); ++i) { 1364 RefPtrWillBeRawPtr<CSSRuleSourceData> InspectorStyleSheet::sourceDataForRule(CSS Rule* rule)
1341 RefPtrWillBeRawPtr<CSSRuleSourceData> ruleSourceData = m_sourceData->at( i); 1365 {
1342 if (ruleSourceData->ruleBodyRange.start == sourceRange.start && ruleSour ceData->ruleBodyRange.end == sourceRange.end) { 1366 if (!m_sourceData || !rule)
1343 *pRule = m_flatRules.at(i).get(); 1367 return nullptr;
1344 if (!(*pRule)->parentStyleSheet()) 1368
1345 return false; 1369 size_t index = m_flatRules.find(rule);
1346 *pSourceData = ruleSourceData.get(); 1370 return index < m_sourceData->size() ? m_sourceData->at(index) : nullptr;
1347 return true; 1371 }
1348 } 1372
1349 } 1373 void InspectorStyleSheet::collectFlatRules()
1350 return false; 1374 {
1375 m_flatRules.clear();
1376 ::collectFlatRules(m_pageStyleSheet.get(), &m_flatRules);
1351 } 1377 }
1352 1378
1353 const CSSRuleVector& InspectorStyleSheet::flatRules() 1379 const CSSRuleVector& InspectorStyleSheet::flatRules()
1354 { 1380 {
1355 ensureFlatRules();
1356 return m_flatRules; 1381 return m_flatRules;
1357 } 1382 }
1358 1383
1359 template <typename RuleList>
1360 static void collectFlatRules(RuleList ruleList, CSSRuleVector* result)
1361 {
1362 if (!ruleList)
1363 return;
1364
1365 for (unsigned i = 0, size = ruleList->length(); i < size; ++i) {
1366 CSSRule* rule = ruleList->item(i);
1367
1368 // The result->append()'ed types should be exactly the same as in flatte nSourceData().
1369 switch (rule->type()) {
1370 case CSSRule::STYLE_RULE:
1371 case CSSRule::IMPORT_RULE:
1372 case CSSRule::CHARSET_RULE:
1373 case CSSRule::PAGE_RULE:
1374 case CSSRule::FONT_FACE_RULE:
1375 case CSSRule::VIEWPORT_RULE:
1376 case CSSRule::KEYFRAMES_RULE:
1377 result->append(rule);
1378 break;
1379 case CSSRule::MEDIA_RULE:
1380 case CSSRule::SUPPORTS_RULE:
1381 result->append(rule);
1382 collectFlatRules(asCSSRuleList(rule), result);
1383 break;
1384 default:
1385 break;
1386 }
1387 }
1388 }
1389
1390 void InspectorStyleSheet::ensureFlatRules()
1391 {
1392 // We are fine with redoing this for empty stylesheets as this will run fast .
1393 if (m_flatRules.isEmpty())
1394 collectFlatRules(pageStyleSheet(), &m_flatRules);
1395 }
1396
1397 bool InspectorStyleSheet::resourceStyleSheetText(String* result) 1384 bool InspectorStyleSheet::resourceStyleSheetText(String* result)
1398 { 1385 {
1399 if (m_origin == TypeBuilder::CSS::StyleSheetOrigin::Injected || m_origin == TypeBuilder::CSS::StyleSheetOrigin::User_agent) 1386 if (m_origin == TypeBuilder::CSS::StyleSheetOrigin::Injected || m_origin == TypeBuilder::CSS::StyleSheetOrigin::User_agent)
1400 return false; 1387 return false;
1401 1388
1402 if (!m_pageStyleSheet->ownerDocument()) 1389 if (!m_pageStyleSheet->ownerDocument())
1403 return false; 1390 return false;
1404 1391
1405 KURL url(ParsedURLString, m_pageStyleSheet->href()); 1392 KURL url(ParsedURLString, m_pageStyleSheet->href());
1406 if (m_cssAgent->getEditedStyleSheet(url, result)) 1393 if (m_cssAgent->getEditedStyleSheet(url, result))
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
1504 } 1491 }
1505 1492
1506 DEFINE_TRACE(InspectorStyleSheetForInlineStyle) 1493 DEFINE_TRACE(InspectorStyleSheetForInlineStyle)
1507 { 1494 {
1508 visitor->trace(m_element); 1495 visitor->trace(m_element);
1509 visitor->trace(m_inspectorStyle); 1496 visitor->trace(m_inspectorStyle);
1510 InspectorStyleSheetBase::trace(visitor); 1497 InspectorStyleSheetBase::trace(visitor);
1511 } 1498 }
1512 1499
1513 } // namespace blink 1500 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/inspector/InspectorStyleSheet.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698