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

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

Issue 1211813002: DevTools: allow injecting CSS rules without breaking styles sidebar. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: review comments addressed. 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 11 matching lines...) Expand all
22 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 22 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 */ 23 */
24 24
25 #include "config.h" 25 #include "config.h"
26 #include "core/inspector/InspectorStyleSheet.h" 26 #include "core/inspector/InspectorStyleSheet.h"
27 27
28 #include "bindings/core/v8/ExceptionState.h" 28 #include "bindings/core/v8/ExceptionState.h"
29 #include "bindings/core/v8/ExceptionStatePlaceholder.h" 29 #include "bindings/core/v8/ExceptionStatePlaceholder.h"
30 #include "bindings/core/v8/ScriptRegexp.h" 30 #include "bindings/core/v8/ScriptRegexp.h"
31 #include "core/CSSPropertyNames.h" 31 #include "core/CSSPropertyNames.h"
32 #include "core/css/CSSImportRule.h"
32 #include "core/css/CSSKeyframesRule.h" 33 #include "core/css/CSSKeyframesRule.h"
33 #include "core/css/CSSMediaRule.h" 34 #include "core/css/CSSMediaRule.h"
34 #include "core/css/CSSRuleList.h" 35 #include "core/css/CSSRuleList.h"
35 #include "core/css/CSSStyleRule.h" 36 #include "core/css/CSSStyleRule.h"
36 #include "core/css/CSSStyleSheet.h" 37 #include "core/css/CSSStyleSheet.h"
37 #include "core/css/CSSSupportsRule.h" 38 #include "core/css/CSSSupportsRule.h"
38 #include "core/css/StylePropertySet.h" 39 #include "core/css/StylePropertySet.h"
39 #include "core/css/StyleRule.h" 40 #include "core/css/StyleRule.h"
40 #include "core/css/StyleSheetContents.h" 41 #include "core/css/StyleSheetContents.h"
41 #include "core/css/parser/CSSParser.h" 42 #include "core/css/parser/CSSParser.h"
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 } 329 }
329 330
330 void StyleSheetHandler::endMediaQuery() 331 void StyleSheetHandler::endMediaQuery()
331 { 332 {
332 m_currentMediaQueryData.clear(); 333 m_currentMediaQueryData.clear();
333 } 334 }
334 335
335 bool verifyRuleText(Document* document, const String& ruleText) 336 bool verifyRuleText(Document* document, const String& ruleText)
336 { 337 {
337 DEFINE_STATIC_LOCAL(String, bogusPropertyName, ("-webkit-boguz-propertee")); 338 DEFINE_STATIC_LOCAL(String, bogusPropertyName, ("-webkit-boguz-propertee"));
339 RefPtrWillBeRawPtr<StyleSheetContents> styleSheet = StyleSheetContents::crea te(strictCSSParserContext());
338 RuleSourceDataList sourceData; 340 RuleSourceDataList sourceData;
339 String text = ruleText + " div { " + bogusPropertyName + ": none; }"; 341 String text = ruleText + " div { " + bogusPropertyName + ": none; }";
340 StyleSheetHandler handler(text, document, &sourceData); 342 StyleSheetHandler handler(text, document, &sourceData);
341 CSSParser::parseSheetForInspector(parserContextForDocument(document), text, handler); 343 CSSParser::parseSheetForInspector(parserContextForDocument(document), styleS heet.get(), text, handler);
342 unsigned ruleCount = sourceData.size(); 344 unsigned ruleCount = sourceData.size();
343 345
344 // Exactly two rules should be parsed. 346 // Exactly two rules should be parsed.
345 if (ruleCount != 2) 347 if (ruleCount != 2)
346 return false; 348 return false;
347 349
348 // Added rule must be style rule. 350 // Added rule must be style rule.
349 if (!sourceData.at(0)->styleSourceData) 351 if (!sourceData.at(0)->styleSourceData)
350 return false; 352 return false;
351 353
(...skipping 12 matching lines...) Expand all
364 } 366 }
365 367
366 bool verifyStyleText(Document* document, const String& text) 368 bool verifyStyleText(Document* document, const String& text)
367 { 369 {
368 return verifyRuleText(document, "div {" + text + "}"); 370 return verifyRuleText(document, "div {" + text + "}");
369 } 371 }
370 372
371 bool verifySelectorText(Document* document, const String& selectorText) 373 bool verifySelectorText(Document* document, const String& selectorText)
372 { 374 {
373 DEFINE_STATIC_LOCAL(String, bogusPropertyName, ("-webkit-boguz-propertee")); 375 DEFINE_STATIC_LOCAL(String, bogusPropertyName, ("-webkit-boguz-propertee"));
376 RefPtrWillBeRawPtr<StyleSheetContents> styleSheet = StyleSheetContents::crea te(strictCSSParserContext());
374 RuleSourceDataList sourceData; 377 RuleSourceDataList sourceData;
375 String text = selectorText + " { " + bogusPropertyName + ": none; }"; 378 String text = selectorText + " { " + bogusPropertyName + ": none; }";
376 StyleSheetHandler handler(text, document, &sourceData); 379 StyleSheetHandler handler(text, document, &sourceData);
377 CSSParser::parseSheetForInspector(parserContextForDocument(document), text, handler); 380 CSSParser::parseSheetForInspector(parserContextForDocument(document), styleS heet.get(), text, handler);
378 381
379 // Exactly one rule should be parsed. 382 // Exactly one rule should be parsed.
380 unsigned ruleCount = sourceData.size(); 383 unsigned ruleCount = sourceData.size();
381 if (ruleCount != 1 || sourceData.at(0)->type != StyleRule::Style) 384 if (ruleCount != 1 || sourceData.at(0)->type != StyleRule::Style)
382 return false; 385 return false;
383 386
384 // Exactly one property should be in style rule. 387 // Exactly one property should be in style rule.
385 WillBeHeapVector<CSSPropertySourceData>& propertyData = sourceData.at(0)->st yleSourceData->propertyData; 388 WillBeHeapVector<CSSPropertySourceData>& propertyData = sourceData.at(0)->st yleSourceData->propertyData;
386 unsigned propertyCount = propertyData.size(); 389 unsigned propertyCount = propertyData.size();
387 if (propertyCount != 1) 390 if (propertyCount != 1)
388 return false; 391 return false;
389 392
390 // Check for the property name. 393 // Check for the property name.
391 if (propertyData.at(0).name != bogusPropertyName) 394 if (propertyData.at(0).name != bogusPropertyName)
392 return false; 395 return false;
393 396
394 return true; 397 return true;
395 } 398 }
396 399
397 bool verifyMediaText(Document* document, const String& mediaText) 400 bool verifyMediaText(Document* document, const String& mediaText)
398 { 401 {
399 DEFINE_STATIC_LOCAL(String, bogusPropertyName, ("-webkit-boguz-propertee")); 402 DEFINE_STATIC_LOCAL(String, bogusPropertyName, ("-webkit-boguz-propertee"));
403 RefPtrWillBeRawPtr<StyleSheetContents> styleSheet = StyleSheetContents::crea te(strictCSSParserContext());
400 RuleSourceDataList sourceData; 404 RuleSourceDataList sourceData;
401 String text = "@media " + mediaText + " { div { " + bogusPropertyName + ": n one; } }"; 405 String text = "@media " + mediaText + " { div { " + bogusPropertyName + ": n one; } }";
402 StyleSheetHandler handler(text, document, &sourceData); 406 StyleSheetHandler handler(text, document, &sourceData);
403 CSSParser::parseSheetForInspector(parserContextForDocument(document), text, handler); 407 CSSParser::parseSheetForInspector(parserContextForDocument(document), styleS heet.get(), text, handler);
404 408
405 // Exactly one media rule should be parsed. 409 // Exactly one media rule should be parsed.
406 unsigned ruleCount = sourceData.size(); 410 unsigned ruleCount = sourceData.size();
407 if (ruleCount != 1 || sourceData.at(0)->type != StyleRule::Media) 411 if (ruleCount != 1 || sourceData.at(0)->type != StyleRule::Media)
408 return false; 412 return false;
409 413
410 // Media rule should have exactly one style rule child. 414 // Media rule should have exactly one style rule child.
411 RuleSourceDataList& childSourceData = sourceData.at(0)->childRules; 415 RuleSourceDataList& childSourceData = sourceData.at(0)->childRules;
412 ruleCount = childSourceData.size(); 416 ruleCount = childSourceData.size();
413 if (ruleCount != 1 || !childSourceData.at(0)->styleSourceData) 417 if (ruleCount != 1 || !childSourceData.at(0)->styleSourceData)
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
490 case CSSRule::SUPPORTS_RULE: 494 case CSSRule::SUPPORTS_RULE:
491 result->append(rule); 495 result->append(rule);
492 collectFlatRules(asCSSRuleList(rule), result); 496 collectFlatRules(asCSSRuleList(rule), result);
493 break; 497 break;
494 default: 498 default:
495 break; 499 break;
496 } 500 }
497 } 501 }
498 } 502 }
499 503
504 typedef HashMap<unsigned, unsigned, WTF::IntHash<unsigned>, WTF::UnsignedWithZer oKeyHashTraits<unsigned>> IndexMap;
505
506 void diff(const Vector<String>& listA, const Vector<String>& listB, IndexMap* aT oB, IndexMap* bToA)
507 {
508 // Cut of common prefix.
509 size_t startOffset = 0;
510 while (startOffset < listA.size() && startOffset < listB.size()) {
511 if (listA.at(startOffset) != listB.at(startOffset))
512 break;
513 aToB->set(startOffset, startOffset);
514 bToA->set(startOffset, startOffset);
515 ++startOffset;
516 }
517
518 // Cut of common suffix.
519 size_t endOffset = 0;
520 while (endOffset < listA.size() - startOffset && endOffset < listB.size() - startOffset) {
521 size_t indexA = listA.size() - endOffset - 1;
522 size_t indexB = listB.size() - endOffset - 1;
523 if (listA.at(indexA) != listB.at(indexB))
524 break;
525 aToB->set(indexA, indexB);
526 bToA->set(indexB, indexA);
527 ++endOffset;
528 }
529
530 int n = listA.size() - startOffset - endOffset;
531 int m = listB.size() - startOffset - endOffset;
532
533 // If we mapped either of arrays, we have no more work to do.
534 if (n == 0 || m == 0)
535 return;
536
537 int** diff = new int*[n];
538 int** backtrack = new int*[n];
539 for (int i = 0; i < n; ++i) {
540 diff[i] = new int[m];
541 backtrack[i] = new int[m];
542 }
543
544 // Compute longest common subsequence of two cssom models.
545 for (int i = 0; i < n; ++i) {
546 for (int j = 0; j < m; ++j) {
547 int max = 0;
548 int track = 0;
549
550 if (i > 0 && diff[i - 1][j] > max) {
551 max = diff[i - 1][j];
552 track = 1;
553 }
554
555 if (j > 0 && diff[i][j - 1] > max) {
556 max = diff[i][j - 1];
557 track = 2;
558 }
559
560 if (listA.at(i + startOffset) == listB.at(j + startOffset)) {
561 int value = i > 0 && j > 0 ? diff[i - 1][j - 1] + 1 : 1;
562 if (value > max) {
563 max = value;
564 track = 3;
565 }
566 }
567
568 diff[i][j] = max;
569 backtrack[i][j] = track;
570 }
571 }
572
573 // Backtrack and add missing mapping.
574 int i = n - 1, j = m - 1;
575 while (i >= 0 && j >= 0 && backtrack[i][j]) {
576 switch (backtrack[i][j]) {
577 case 1:
578 i -= 1;
579 break;
580 case 2:
581 j -= 1;
582 break;
583 case 3:
584 aToB->set(i + startOffset, j + startOffset);
585 bToA->set(j + startOffset, i + startOffset);
586 i -= 1;
587 j -= 1;
588 break;
589 default:
590 ASSERT_NOT_REACHED();
591 }
592 }
593
594 for (int i = 0; i < n; ++i) {
595 delete [] diff[i];
596 delete [] backtrack[i];
597 }
598 delete [] diff;
599 delete [] backtrack;
600 }
601
500 } // namespace 602 } // namespace
501 603
502 namespace blink { 604 namespace blink {
503 605
504 enum MediaListSource { 606 enum MediaListSource {
505 MediaListSourceLinkedSheet, 607 MediaListSourceLinkedSheet,
506 MediaListSourceInlineSheet, 608 MediaListSourceInlineSheet,
507 MediaListSourceMediaRule, 609 MediaListSourceMediaRule,
508 MediaListSourceImportRule 610 MediaListSourceImportRule
509 }; 611 };
(...skipping 22 matching lines...) Expand all
532 : m_style(style) 634 : m_style(style)
533 , m_sourceData(sourceData) 635 , m_sourceData(sourceData)
534 , m_parentStyleSheet(parentStyleSheet) 636 , m_parentStyleSheet(parentStyleSheet)
535 { 637 {
536 ASSERT(m_style); 638 ASSERT(m_style);
537 } 639 }
538 640
539 PassRefPtr<TypeBuilder::CSS::CSSStyle> InspectorStyle::buildObjectForStyle() 641 PassRefPtr<TypeBuilder::CSS::CSSStyle> InspectorStyle::buildObjectForStyle()
540 { 642 {
541 RefPtr<TypeBuilder::CSS::CSSStyle> result = styleWithProperties(); 643 RefPtr<TypeBuilder::CSS::CSSStyle> result = styleWithProperties();
542 if (m_parentStyleSheet && !m_parentStyleSheet->id().isEmpty())
543 result->setStyleSheetId(m_parentStyleSheet->id());
544
545 if (m_sourceData) { 644 if (m_sourceData) {
645 if (m_parentStyleSheet && !m_parentStyleSheet->id().isEmpty())
646 result->setStyleSheetId(m_parentStyleSheet->id());
546 result->setRange(buildSourceRangeObject(m_sourceData->ruleBodyRange, m_p arentStyleSheet->lineEndings())); 647 result->setRange(buildSourceRangeObject(m_sourceData->ruleBodyRange, m_p arentStyleSheet->lineEndings()));
547 String sheetText; 648 String sheetText;
548 bool success = m_parentStyleSheet->getText(&sheetText); 649 bool success = m_parentStyleSheet->getText(&sheetText);
549 if (success) { 650 if (success) {
550 const SourceRange& bodyRange = m_sourceData->ruleBodyRange; 651 const SourceRange& bodyRange = m_sourceData->ruleBodyRange;
551 result->setCssText(sheetText.substring(bodyRange.start, bodyRange.en d - bodyRange.start)); 652 result->setCssText(sheetText.substring(bodyRange.start, bodyRange.en d - bodyRange.start));
552 } 653 }
553 } 654 }
554 655
555 return result.release(); 656 return result.release();
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
759 , m_pageStyleSheet(pageStyleSheet) 860 , m_pageStyleSheet(pageStyleSheet)
760 , m_origin(origin) 861 , m_origin(origin)
761 , m_documentURL(documentURL) 862 , m_documentURL(documentURL)
762 { 863 {
763 String text; 864 String text;
764 bool success = inlineStyleSheetText(&text); 865 bool success = inlineStyleSheetText(&text);
765 if (!success) 866 if (!success)
766 success = resourceStyleSheetText(&text); 867 success = resourceStyleSheetText(&text);
767 if (success) 868 if (success)
768 innerSetText(text, false); 869 innerSetText(text, false);
769 collectFlatRules();
770 } 870 }
771 871
772 InspectorStyleSheet::~InspectorStyleSheet() 872 InspectorStyleSheet::~InspectorStyleSheet()
773 { 873 {
774 } 874 }
775 875
776 DEFINE_TRACE(InspectorStyleSheet) 876 DEFINE_TRACE(InspectorStyleSheet)
777 { 877 {
778 visitor->trace(m_cssAgent); 878 visitor->trace(m_cssAgent);
779 visitor->trace(m_resourceAgent); 879 visitor->trace(m_resourceAgent);
780 visitor->trace(m_pageStyleSheet); 880 visitor->trace(m_pageStyleSheet);
781 visitor->trace(m_sourceData); 881 visitor->trace(m_sourceData);
782 visitor->trace(m_flatRules); 882 visitor->trace(m_cssomFlatRules);
883 visitor->trace(m_parsedFlatRules);
783 InspectorStyleSheetBase::trace(visitor); 884 InspectorStyleSheetBase::trace(visitor);
784 } 885 }
785 886
786 static String styleSheetURL(CSSStyleSheet* pageStyleSheet) 887 static String styleSheetURL(CSSStyleSheet* pageStyleSheet)
787 { 888 {
788 if (pageStyleSheet && !pageStyleSheet->contents()->baseURL().isEmpty()) 889 if (pageStyleSheet && !pageStyleSheet->contents()->baseURL().isEmpty())
789 return pageStyleSheet->contents()->baseURL().string(); 890 return pageStyleSheet->contents()->baseURL().string();
790 return emptyString(); 891 return emptyString();
791 } 892 }
792 893
(...skipping 18 matching lines...) Expand all
811 } 912 }
812 { 913 {
813 CSSStyleSheet::RuleMutationScope mutationScope(m_pageStyleSheet.get()); 914 CSSStyleSheet::RuleMutationScope mutationScope(m_pageStyleSheet.get());
814 m_pageStyleSheet->contents()->parseString(text); 915 m_pageStyleSheet->contents()->parseString(text);
815 } 916 }
816 917
817 if (listener()) 918 if (listener())
818 listener()->didReparseStyleSheet(); 919 listener()->didReparseStyleSheet();
819 onStyleSheetTextChanged(); 920 onStyleSheetTextChanged();
820 m_pageStyleSheet->ownerDocument()->styleResolverChanged(FullStyleUpdate); 921 m_pageStyleSheet->ownerDocument()->styleResolverChanged(FullStyleUpdate);
821
822 collectFlatRules();
823 return true; 922 return true;
824 } 923 }
825 924
826 RefPtrWillBeRawPtr<CSSStyleRule> InspectorStyleSheet::setRuleSelector(const Sour ceRange& range, const String& text, SourceRange* newRange, String* oldText, Exce ptionState& exceptionState) 925 RefPtrWillBeRawPtr<CSSStyleRule> InspectorStyleSheet::setRuleSelector(const Sour ceRange& range, const String& text, SourceRange* newRange, String* oldText, Exce ptionState& exceptionState)
827 { 926 {
828 if (!verifySelectorText(m_pageStyleSheet->ownerDocument(), text)) { 927 if (!verifySelectorText(m_pageStyleSheet->ownerDocument(), text)) {
829 exceptionState.throwDOMException(SyntaxError, "Selector or media text is not valid."); 928 exceptionState.throwDOMException(SyntaxError, "Selector or media text is not valid.");
830 return nullptr; 929 return nullptr;
831 } 930 }
832 931
833 RefPtrWillBeRawPtr<CSSRuleSourceData> sourceData = findRuleByHeaderRange(ran ge); 932 RefPtrWillBeRawPtr<CSSRuleSourceData> sourceData = findRuleByHeaderRange(ran ge);
834 if (!sourceData || !sourceData->styleSourceData) { 933 if (!sourceData || !sourceData->styleSourceData) {
835 exceptionState.throwDOMException(NotFoundError, "Source range didn't mat ch existing source range"); 934 exceptionState.throwDOMException(NotFoundError, "Source range didn't mat ch existing source range");
836 return nullptr; 935 return nullptr;
837 } 936 }
838 937
839 RefPtrWillBeRawPtr<CSSRule> rule = ruleForSourceData(sourceData.get()); 938 RefPtrWillBeRawPtr<CSSRule> rule = ruleForSourceData(sourceData);
840 if (!rule || !rule->parentStyleSheet() || rule->type() != CSSRule::STYLE_RUL E) { 939 if (!rule || !rule->parentStyleSheet() || rule->type() != CSSRule::STYLE_RUL E) {
841 exceptionState.throwDOMException(NotFoundError, "Source range didn't mat ch existing style source range"); 940 exceptionState.throwDOMException(NotFoundError, "Source range didn't mat ch existing style source range");
842 return nullptr; 941 return nullptr;
843 } 942 }
844 943
845 RefPtrWillBeRawPtr<CSSStyleRule> styleRule = InspectorCSSAgent::asCSSStyleRu le(rule.get()); 944 RefPtrWillBeRawPtr<CSSStyleRule> styleRule = InspectorCSSAgent::asCSSStyleRu le(rule.get());
846 styleRule->setSelectorText(text); 945 styleRule->setSelectorText(text);
847 946
848 replaceText(sourceData->ruleHeaderRange, text, newRange, oldText); 947 replaceText(sourceData->ruleHeaderRange, text, newRange, oldText);
849 onStyleSheetTextChanged(); 948 onStyleSheetTextChanged();
850 949
851 return styleRule; 950 return styleRule;
852 } 951 }
853 952
854 RefPtrWillBeRawPtr<CSSStyleRule> InspectorStyleSheet::setStyleText(const SourceR ange& range, const String& text, SourceRange* newRange, String* oldText, Excepti onState& exceptionState) 953 RefPtrWillBeRawPtr<CSSStyleRule> InspectorStyleSheet::setStyleText(const SourceR ange& range, const String& text, SourceRange* newRange, String* oldText, Excepti onState& exceptionState)
855 { 954 {
856 if (!verifyStyleText(m_pageStyleSheet->ownerDocument(), text)) { 955 if (!verifyStyleText(m_pageStyleSheet->ownerDocument(), text)) {
857 exceptionState.throwDOMException(SyntaxError, "Style text is not valid." ); 956 exceptionState.throwDOMException(SyntaxError, "Style text is not valid." );
858 return nullptr; 957 return nullptr;
859 } 958 }
860 959
861 RefPtrWillBeRawPtr<CSSRuleSourceData> sourceData = findRuleByBodyRange(range ); 960 RefPtrWillBeRawPtr<CSSRuleSourceData> sourceData = findRuleByBodyRange(range );
862 if (!sourceData || !sourceData->styleSourceData) { 961 if (!sourceData || !sourceData->styleSourceData) {
863 exceptionState.throwDOMException(NotFoundError, "Source range didn't mat ch existing style source range"); 962 exceptionState.throwDOMException(NotFoundError, "Source range didn't mat ch existing style source range");
864 return nullptr; 963 return nullptr;
865 } 964 }
866 965
867 RefPtrWillBeRawPtr<CSSRule> rule = ruleForSourceData(sourceData.get()); 966 RefPtrWillBeRawPtr<CSSRule> rule = ruleForSourceData(sourceData);
868 if (!rule || !rule->parentStyleSheet() || rule->type() != CSSRule::STYLE_RUL E) { 967 if (!rule || !rule->parentStyleSheet() || rule->type() != CSSRule::STYLE_RUL E) {
869 exceptionState.throwDOMException(NotFoundError, "Source range didn't mat ch existing style source range"); 968 exceptionState.throwDOMException(NotFoundError, "Source range didn't mat ch existing style source range");
870 return nullptr; 969 return nullptr;
871 } 970 }
872 971
873 RefPtrWillBeRawPtr<CSSStyleRule> styleRule = InspectorCSSAgent::asCSSStyleRu le(rule.get()); 972 RefPtrWillBeRawPtr<CSSStyleRule> styleRule = InspectorCSSAgent::asCSSStyleRu le(rule.get());
874 styleRule->style()->setCSSText(text, exceptionState); 973 styleRule->style()->setCSSText(text, exceptionState);
875 974
876 replaceText(sourceData->ruleBodyRange, text, newRange, oldText); 975 replaceText(sourceData->ruleBodyRange, text, newRange, oldText);
877 onStyleSheetTextChanged(); 976 onStyleSheetTextChanged();
878 977
879 return styleRule; 978 return styleRule;
880 } 979 }
881 980
882 RefPtrWillBeRawPtr<CSSMediaRule> InspectorStyleSheet::setMediaRuleText(const Sou rceRange& range, const String& text, SourceRange* newRange, String* oldText, Exc eptionState& exceptionState) 981 RefPtrWillBeRawPtr<CSSMediaRule> InspectorStyleSheet::setMediaRuleText(const Sou rceRange& range, const String& text, SourceRange* newRange, String* oldText, Exc eptionState& exceptionState)
883 { 982 {
884 if (!verifyMediaText(m_pageStyleSheet->ownerDocument(), text)) { 983 if (!verifyMediaText(m_pageStyleSheet->ownerDocument(), text)) {
885 exceptionState.throwDOMException(SyntaxError, "Selector or media text is not valid."); 984 exceptionState.throwDOMException(SyntaxError, "Selector or media text is not valid.");
886 return nullptr; 985 return nullptr;
887 } 986 }
888 987
889 RefPtrWillBeRawPtr<CSSRuleSourceData> sourceData = findRuleByHeaderRange(ran ge); 988 RefPtrWillBeRawPtr<CSSRuleSourceData> sourceData = findRuleByHeaderRange(ran ge);
890 if (!sourceData || !sourceData->mediaSourceData) { 989 if (!sourceData || !sourceData->mediaSourceData) {
891 exceptionState.throwDOMException(NotFoundError, "Source range didn't mat ch existing source range"); 990 exceptionState.throwDOMException(NotFoundError, "Source range didn't mat ch existing source range");
892 return nullptr; 991 return nullptr;
893 } 992 }
894 993
895 RefPtrWillBeRawPtr<CSSRule> rule = ruleForSourceData(sourceData.get()); 994 RefPtrWillBeRawPtr<CSSRule> rule = ruleForSourceData(sourceData);
896 if (!rule || !rule->parentStyleSheet() || rule->type() != CSSRule::MEDIA_RUL E) { 995 if (!rule || !rule->parentStyleSheet() || rule->type() != CSSRule::MEDIA_RUL E) {
897 exceptionState.throwDOMException(NotFoundError, "Source range didn't mat ch existing style source range"); 996 exceptionState.throwDOMException(NotFoundError, "Source range didn't mat ch existing style source range");
898 return nullptr; 997 return nullptr;
899 } 998 }
900 999
901 RefPtrWillBeRawPtr<CSSMediaRule> mediaRule = InspectorCSSAgent::asCSSMediaR ule(rule.get()); 1000 RefPtrWillBeRawPtr<CSSMediaRule> mediaRule = InspectorCSSAgent::asCSSMediaR ule(rule.get());
902 mediaRule->media()->setMediaText(text); 1001 mediaRule->media()->setMediaText(text);
903 1002
904 replaceText(sourceData->ruleHeaderRange, text, newRange, oldText); 1003 replaceText(sourceData->ruleHeaderRange, text, newRange, oldText);
905 onStyleSheetTextChanged(); 1004 onStyleSheetTextChanged();
906 1005
907 return mediaRule; 1006 return mediaRule;
908 } 1007 }
909 1008
910 RefPtrWillBeRawPtr<CSSRuleSourceData> InspectorStyleSheet::ruleAfterSourceRange( const SourceRange& sourceRange) 1009 RefPtrWillBeRawPtr<CSSRuleSourceData> InspectorStyleSheet::ruleSourceDataAfterSo urceRange(const SourceRange& sourceRange)
911 { 1010 {
912 ASSERT(m_sourceData); 1011 ASSERT(m_sourceData);
913 unsigned index = 0; 1012 unsigned index = 0;
914 for (; index < m_sourceData->size(); ++index) { 1013 for (; index < m_sourceData->size(); ++index) {
915 RefPtrWillBeRawPtr<CSSRuleSourceData> sd = m_sourceData->at(index); 1014 RefPtrWillBeRawPtr<CSSRuleSourceData> sd = m_sourceData->at(index);
916 if (sd->ruleHeaderRange.start >= sourceRange.end) 1015 if (sd->ruleHeaderRange.start >= sourceRange.end)
917 break; 1016 break;
918 } 1017 }
919 return index < m_sourceData->size() ? m_sourceData->at(index) : nullptr; 1018 return index < m_sourceData->size() ? m_sourceData->at(index) : nullptr;
920 } 1019 }
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
969 if (ruleSourceData->ruleHeaderRange.start < sourceRange.start && sourceR ange.start < ruleSourceData->ruleBodyRange.start) { 1068 if (ruleSourceData->ruleHeaderRange.start < sourceRange.start && sourceR ange.start < ruleSourceData->ruleBodyRange.start) {
970 exceptionState.throwDOMException(NotFoundError, "Cannot insert rule inside rule selector."); 1069 exceptionState.throwDOMException(NotFoundError, "Cannot insert rule inside rule selector.");
971 return nullptr; 1070 return nullptr;
972 } 1071 }
973 if (sourceRange.start < ruleSourceData->ruleBodyRange.start || ruleSourc eData->ruleBodyRange.end < sourceRange.start) 1072 if (sourceRange.start < ruleSourceData->ruleBodyRange.start || ruleSourc eData->ruleBodyRange.end < sourceRange.start)
974 continue; 1073 continue;
975 if (!containingRuleSourceData || containingRuleSourceData->ruleBodyRange .length() > ruleSourceData->ruleBodyRange.length()) 1074 if (!containingRuleSourceData || containingRuleSourceData->ruleBodyRange .length() > ruleSourceData->ruleBodyRange.length())
976 containingRuleSourceData = ruleSourceData; 1075 containingRuleSourceData = ruleSourceData;
977 } 1076 }
978 1077
979 RefPtrWillBeRawPtr<CSSRuleSourceData> insertBefore = ruleAfterSourceRange(so urceRange); 1078 RefPtrWillBeRawPtr<CSSRuleSourceData> insertBefore = ruleSourceDataAfterSour ceRange(sourceRange);
980 RefPtrWillBeRawPtr<CSSRule> insertBeforeRule = ruleForSourceData(insertBefor e.get()); 1079 RefPtrWillBeRawPtr<CSSRule> insertBeforeRule = ruleForSourceData(insertBefor e);
981 1080
982 if (!containingRuleSourceData) 1081 if (!containingRuleSourceData)
983 return insertCSSOMRuleInStyleSheet(insertBeforeRule.get(), ruleText, exc eptionState); 1082 return insertCSSOMRuleInStyleSheet(insertBeforeRule.get(), ruleText, exc eptionState);
984 1083
985 RefPtrWillBeRawPtr<CSSRule> rule = ruleForSourceData(containingRuleSourceDat a.get()); 1084 RefPtrWillBeRawPtr<CSSRule> rule = ruleForSourceData(containingRuleSourceDat a);
986 if (!rule || rule->type() != CSSRule::MEDIA_RULE) { 1085 if (!rule || rule->type() != CSSRule::MEDIA_RULE) {
987 exceptionState.throwDOMException(NotFoundError, "Cannot insert rule in n on-media rule."); 1086 exceptionState.throwDOMException(NotFoundError, "Cannot insert rule in n on-media rule.");
988 return nullptr; 1087 return nullptr;
989 } 1088 }
990 1089
991 return insertCSSOMRuleInMediaRule(toCSSMediaRule(rule.get()), insertBeforeRu le.get(), ruleText, exceptionState); 1090 return insertCSSOMRuleInMediaRule(toCSSMediaRule(rule.get()), insertBeforeRu le.get(), ruleText, exceptionState);
992 } 1091 }
993 1092
994 RefPtrWillBeRawPtr<CSSStyleRule> InspectorStyleSheet::addRule(const String& rule Text, const SourceRange& location, SourceRange* addedRange, ExceptionState& exce ptionState) 1093 RefPtrWillBeRawPtr<CSSStyleRule> InspectorStyleSheet::addRule(const String& rule Text, const SourceRange& location, SourceRange* addedRange, ExceptionState& exce ptionState)
995 { 1094 {
(...skipping 10 matching lines...) Expand all
1006 if (!m_sourceData) { 1105 if (!m_sourceData) {
1007 exceptionState.throwDOMException(NotFoundError, "Style is read-only."); 1106 exceptionState.throwDOMException(NotFoundError, "Style is read-only.");
1008 return nullptr; 1107 return nullptr;
1009 } 1108 }
1010 1109
1011 RefPtrWillBeRawPtr<CSSStyleRule> styleRule = insertCSSOMRuleBySourceRange(lo cation, ruleText, exceptionState); 1110 RefPtrWillBeRawPtr<CSSStyleRule> styleRule = insertCSSOMRuleBySourceRange(lo cation, ruleText, exceptionState);
1012 if (exceptionState.hadException()) 1111 if (exceptionState.hadException())
1013 return nullptr; 1112 return nullptr;
1014 1113
1015 replaceText(location, ruleText, addedRange, nullptr); 1114 replaceText(location, ruleText, addedRange, nullptr);
1016 collectFlatRules();
1017
1018 onStyleSheetTextChanged(); 1115 onStyleSheetTextChanged();
1019 return styleRule; 1116 return styleRule;
1020 } 1117 }
1021 1118
1022 bool InspectorStyleSheet::deleteRule(const SourceRange& range, ExceptionState& e xceptionState) 1119 bool InspectorStyleSheet::deleteRule(const SourceRange& range, ExceptionState& e xceptionState)
1023 { 1120 {
1024 if (!m_sourceData) { 1121 if (!m_sourceData) {
1025 exceptionState.throwDOMException(NotFoundError, "Style is read-only."); 1122 exceptionState.throwDOMException(NotFoundError, "Style is read-only.");
1026 return false; 1123 return false;
1027 } 1124 }
1028 1125
1029 // Find index of CSSRule that entirely belongs to the range. 1126 // Find index of CSSRule that entirely belongs to the range.
1030 RefPtrWillBeRawPtr<CSSRuleSourceData> foundData = nullptr; 1127 RefPtrWillBeRawPtr<CSSRuleSourceData> foundData = nullptr;
1031 1128
1032 for (size_t i = 0; i < m_sourceData->size(); ++i) { 1129 for (size_t i = 0; i < m_sourceData->size(); ++i) {
1033 RefPtrWillBeRawPtr<CSSRuleSourceData> ruleSourceData = m_sourceData->at( i); 1130 RefPtrWillBeRawPtr<CSSRuleSourceData> ruleSourceData = m_sourceData->at( i);
1034 unsigned ruleStart = ruleSourceData->ruleHeaderRange.start; 1131 unsigned ruleStart = ruleSourceData->ruleHeaderRange.start;
1035 unsigned ruleEnd = ruleSourceData->ruleBodyRange.end + 1; 1132 unsigned ruleEnd = ruleSourceData->ruleBodyRange.end + 1;
1036 bool startBelongs = ruleStart >= range.start && ruleStart < range.end; 1133 bool startBelongs = ruleStart >= range.start && ruleStart < range.end;
1037 bool endBelongs = ruleEnd > range.start && ruleEnd <= range.end; 1134 bool endBelongs = ruleEnd > range.start && ruleEnd <= range.end;
1038 1135
1039 if (startBelongs != endBelongs) 1136 if (startBelongs != endBelongs)
1040 break; 1137 break;
1041 if (!startBelongs) 1138 if (!startBelongs)
1042 continue; 1139 continue;
1043 if (!foundData || foundData->ruleBodyRange.length() > ruleSourceData->ru leBodyRange.length()) 1140 if (!foundData || foundData->ruleBodyRange.length() > ruleSourceData->ru leBodyRange.length())
1044 foundData = ruleSourceData; 1141 foundData = ruleSourceData;
1045 } 1142 }
1046 RefPtrWillBeRawPtr<CSSRule> rule = ruleForSourceData(foundData.get()); 1143 RefPtrWillBeRawPtr<CSSRule> rule = ruleForSourceData(foundData);
1047 if (!rule) { 1144 if (!rule) {
1048 exceptionState.throwDOMException(NotFoundError, "No style rule could be found in given range."); 1145 exceptionState.throwDOMException(NotFoundError, "No style rule could be found in given range.");
1049 return false; 1146 return false;
1050 } 1147 }
1051 CSSStyleSheet* styleSheet = rule->parentStyleSheet(); 1148 CSSStyleSheet* styleSheet = rule->parentStyleSheet();
1052 if (!styleSheet) { 1149 if (!styleSheet) {
1053 exceptionState.throwDOMException(NotFoundError, "No parent stylesheet co uld be found."); 1150 exceptionState.throwDOMException(NotFoundError, "No parent stylesheet co uld be found.");
1054 return false; 1151 return false;
1055 } 1152 }
1056 CSSRule* parentRule = rule->parentRule(); 1153 CSSRule* parentRule = rule->parentRule();
(...skipping 14 matching lines...) Expand all
1071 ++index; 1168 ++index;
1072 ASSERT(index < styleSheet->length()); 1169 ASSERT(index < styleSheet->length());
1073 styleSheet->deleteRule(index, exceptionState); 1170 styleSheet->deleteRule(index, exceptionState);
1074 } 1171 }
1075 // |rule| MAY NOT be addressed after this line! 1172 // |rule| MAY NOT be addressed after this line!
1076 1173
1077 if (exceptionState.hadException()) 1174 if (exceptionState.hadException())
1078 return false; 1175 return false;
1079 1176
1080 replaceText(range, "", nullptr, nullptr); 1177 replaceText(range, "", nullptr, nullptr);
1081 collectFlatRules();
1082
1083 onStyleSheetTextChanged(); 1178 onStyleSheetTextChanged();
1084 return true; 1179 return true;
1085 } 1180 }
1086 1181
1087 void InspectorStyleSheet::replaceText(const SourceRange& range, const String& te xt, SourceRange* newRange, String* oldText) 1182 void InspectorStyleSheet::replaceText(const SourceRange& range, const String& te xt, SourceRange* newRange, String* oldText)
1088 { 1183 {
1089 String sheetText = m_text; 1184 String sheetText = m_text;
1090 if (oldText) 1185 if (oldText)
1091 *oldText = sheetText.substring(range.start, range.length()); 1186 *oldText = sheetText.substring(range.start, range.length());
1092 sheetText.replace(range.start, range.length(), text); 1187 sheetText.replace(range.start, range.length(), text);
1093 if (newRange) 1188 if (newRange)
1094 *newRange = SourceRange(range.start, range.start + text.length()); 1189 *newRange = SourceRange(range.start, range.start + text.length());
1095 innerSetText(sheetText, true); 1190 innerSetText(sheetText, true);
1096 } 1191 }
1097 1192
1098 void InspectorStyleSheet::innerSetText(const String& text, bool markAsLocallyMod ified) 1193 void InspectorStyleSheet::innerSetText(const String& text, bool markAsLocallyMod ified)
1099 { 1194 {
1100 OwnPtrWillBeRawPtr<RuleSourceDataList> ruleTree = adoptPtrWillBeNoop(new Rul eSourceDataList()); 1195 OwnPtrWillBeRawPtr<RuleSourceDataList> ruleTree = adoptPtrWillBeNoop(new Rul eSourceDataList());
1196 RefPtrWillBeRawPtr<StyleSheetContents> styleSheet = StyleSheetContents::crea te(m_pageStyleSheet->contents()->parserContext());
1101 StyleSheetHandler handler(text, m_pageStyleSheet->ownerDocument(), ruleTree. get()); 1197 StyleSheetHandler handler(text, m_pageStyleSheet->ownerDocument(), ruleTree. get());
1102 CSSParser::parseSheetForInspector(parserContextForDocument(m_pageStyleSheet- >ownerDocument()), text, handler); 1198 CSSParser::parseSheetForInspector(m_pageStyleSheet->contents()->parserContex t(), styleSheet.get(), text, handler);
1199 RefPtrWillBeRawPtr<CSSStyleSheet> sourceDataSheet;
1200 if (toCSSImportRule(m_pageStyleSheet->ownerRule()))
1201 sourceDataSheet = CSSStyleSheet::create(styleSheet, toCSSImportRule(m_pa geStyleSheet->ownerRule()));
1202 else
1203 sourceDataSheet = CSSStyleSheet::create(styleSheet, m_pageStyleSheet->ow nerNode());
1204
1205 m_parsedFlatRules.clear();
1206 collectFlatRules(sourceDataSheet.get(), &m_parsedFlatRules);
1207
1103 m_sourceData = adoptPtrWillBeNoop(new RuleSourceDataList()); 1208 m_sourceData = adoptPtrWillBeNoop(new RuleSourceDataList());
1104 flattenSourceData(ruleTree.get(), m_sourceData.get()); 1209 flattenSourceData(ruleTree.get(), m_sourceData.get());
1105 m_text = text; 1210 m_text = text;
1106 1211
1107 if (markAsLocallyModified) { 1212 if (markAsLocallyModified) {
1108 Element* element = ownerStyleElement(); 1213 Element* element = ownerStyleElement();
1109 if (element) 1214 if (element)
1110 m_cssAgent->addEditedStyleElement(DOMNodeIds::idForNode(element), te xt); 1215 m_cssAgent->addEditedStyleElement(DOMNodeIds::idForNode(element), te xt);
1111 else 1216 else
1112 m_cssAgent->addEditedStyleSheet(finalURL(), text); 1217 m_cssAgent->addEditedStyleSheet(finalURL(), text);
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
1351 1456
1352 for (size_t i = 0; i < m_sourceData->size(); ++i) { 1457 for (size_t i = 0; i < m_sourceData->size(); ++i) {
1353 RefPtrWillBeRawPtr<CSSRuleSourceData> ruleSourceData = m_sourceData->at( i); 1458 RefPtrWillBeRawPtr<CSSRuleSourceData> ruleSourceData = m_sourceData->at( i);
1354 if (ruleSourceData->ruleBodyRange.start == sourceRange.start && ruleSour ceData->ruleBodyRange.end == sourceRange.end) { 1459 if (ruleSourceData->ruleBodyRange.start == sourceRange.start && ruleSour ceData->ruleBodyRange.end == sourceRange.end) {
1355 return ruleSourceData; 1460 return ruleSourceData;
1356 } 1461 }
1357 } 1462 }
1358 return nullptr; 1463 return nullptr;
1359 } 1464 }
1360 1465
1361 RefPtrWillBeRawPtr<CSSRule> InspectorStyleSheet::ruleForSourceData(CSSRuleSource Data* sourceData) 1466 RefPtrWillBeRawPtr<CSSRule> InspectorStyleSheet::ruleForSourceData(RefPtrWillBeR awPtr<CSSRuleSourceData> sourceData)
1362 { 1467 {
1363 if (!m_sourceData || !sourceData) 1468 if (!m_sourceData || !sourceData)
1364 return nullptr; 1469 return nullptr;
1365 for (size_t i = 0; i < m_sourceData->size(); ++i) { 1470
1366 if (m_sourceData->at(i).get() == sourceData) 1471 remapSourceDataToCSSOMIfNecessary();
1367 return i < m_flatRules.size() ? m_flatRules.at(i) : nullptr; 1472
1368 } 1473 size_t index = m_sourceData->find(sourceData.get());
1369 return nullptr; 1474 if (index == kNotFound)
1475 return nullptr;
1476 IndexMap::iterator it = m_sourceDataToRule.find(index);
1477 if (it == m_sourceDataToRule.end())
1478 return nullptr;
1479
1480 ASSERT(it->value < m_cssomFlatRules.size());
1481
1482 // Check that CSSOM did not mutate this rule.
1483 RefPtrWillBeRawPtr<CSSRule> result = m_cssomFlatRules.at(it->value);
1484 if (m_parsedFlatRules.at(index)->cssText() != result->cssText())
1485 return nullptr;
1486 return result;
1370 } 1487 }
1371 1488
1372 RefPtrWillBeRawPtr<CSSRuleSourceData> InspectorStyleSheet::sourceDataForRule(CSS Rule* rule) 1489 RefPtrWillBeRawPtr<CSSRuleSourceData> InspectorStyleSheet::sourceDataForRule(Ref PtrWillBeRawPtr<CSSRule> rule)
1373 { 1490 {
1374 if (!m_sourceData || !rule) 1491 if (!m_sourceData || !rule)
1375 return nullptr; 1492 return nullptr;
1376 1493
1377 size_t index = m_flatRules.find(rule); 1494 remapSourceDataToCSSOMIfNecessary();
1378 return index < m_sourceData->size() ? m_sourceData->at(index) : nullptr; 1495
1496 size_t index = m_cssomFlatRules.find(rule.get());
1497 if (index == kNotFound)
1498 return nullptr;
1499 IndexMap::iterator it = m_ruleToSourceData.find(index);
1500 if (it == m_ruleToSourceData.end())
1501 return nullptr;
1502
1503 ASSERT(it->value < m_sourceData->size());
1504
1505 // Check that CSSOM did not mutate this rule.
1506 RefPtrWillBeRawPtr<CSSRule> parsedRule = m_parsedFlatRules.at(it->value);
1507 if (rule->cssText() != parsedRule->cssText())
1508 return nullptr;
1509
1510 return m_sourceData->at(it->value);
1379 } 1511 }
1380 1512
1381 void InspectorStyleSheet::collectFlatRules() 1513 void InspectorStyleSheet::remapSourceDataToCSSOMIfNecessary()
1382 { 1514 {
1383 m_flatRules.clear(); 1515 CSSRuleVector cssomRules;
1384 ::collectFlatRules(m_pageStyleSheet.get(), &m_flatRules); 1516 collectFlatRules(m_pageStyleSheet.get(), &cssomRules);
1517
1518 if (cssomRules.size() != m_cssomFlatRules.size()) {
1519 mapSourceDataToCSSOM();
1520 return;
1521 }
1522
1523 for (size_t i = 0; i < m_cssomFlatRules.size(); ++i) {
1524 if (m_cssomFlatRules.at(i) != cssomRules.at(i)) {
1525 mapSourceDataToCSSOM();
1526 return;
1527 }
1528 }
1529 }
1530
1531 void InspectorStyleSheet::mapSourceDataToCSSOM()
1532 {
1533 m_ruleToSourceData.clear();
1534 m_sourceDataToRule.clear();
1535
1536 m_cssomFlatRules.clear();
1537 CSSRuleVector& cssomRules = m_cssomFlatRules;
1538 collectFlatRules(m_pageStyleSheet.get(), &cssomRules);
1539
1540 if (!m_sourceData)
1541 return;
1542
1543 CSSRuleVector& parsedRules = m_parsedFlatRules;
1544
1545 Vector<String> cssomRulesText = Vector<String>();
1546 Vector<String> parsedRulesText = Vector<String>();
1547 for (size_t i = 0; i < cssomRules.size(); ++i)
1548 cssomRulesText.append(cssomRules.at(i)->cssText());
1549 for (size_t j = 0; j < parsedRules.size(); ++j)
1550 parsedRulesText.append(parsedRules.at(j)->cssText());
1551
1552 diff(cssomRulesText, parsedRulesText, &m_ruleToSourceData, &m_sourceDataToRu le);
1385 } 1553 }
1386 1554
1387 const CSSRuleVector& InspectorStyleSheet::flatRules() 1555 const CSSRuleVector& InspectorStyleSheet::flatRules()
1388 { 1556 {
1389 return m_flatRules; 1557 remapSourceDataToCSSOMIfNecessary();
1558 return m_cssomFlatRules;
1390 } 1559 }
1391 1560
1392 bool InspectorStyleSheet::resourceStyleSheetText(String* result) 1561 bool InspectorStyleSheet::resourceStyleSheetText(String* result)
1393 { 1562 {
1394 if (m_origin == TypeBuilder::CSS::StyleSheetOrigin::Injected || m_origin == TypeBuilder::CSS::StyleSheetOrigin::User_agent) 1563 if (m_origin == TypeBuilder::CSS::StyleSheetOrigin::Injected || m_origin == TypeBuilder::CSS::StyleSheetOrigin::User_agent)
1395 return false; 1564 return false;
1396 1565
1397 if (!m_pageStyleSheet->ownerDocument()) 1566 if (!m_pageStyleSheet->ownerDocument())
1398 return false; 1567 return false;
1399 1568
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
1499 } 1668 }
1500 1669
1501 DEFINE_TRACE(InspectorStyleSheetForInlineStyle) 1670 DEFINE_TRACE(InspectorStyleSheetForInlineStyle)
1502 { 1671 {
1503 visitor->trace(m_element); 1672 visitor->trace(m_element);
1504 visitor->trace(m_inspectorStyle); 1673 visitor->trace(m_inspectorStyle);
1505 InspectorStyleSheetBase::trace(visitor); 1674 InspectorStyleSheetBase::trace(visitor);
1506 } 1675 }
1507 1676
1508 } // namespace blink 1677 } // 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