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

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

Issue 323043002: Oilpan: Prepare moving InspectorAgent related classes to oilpan (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 4 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
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 927 matching lines...) Expand 10 before | Expand all | Expand 10 after
938 if (!sourceRange.length() && ruleSourceData->ruleBodyRange.start <= sour ceRange.start && sourceRange.start <= ruleSourceData->ruleBodyRange.end) { 938 if (!sourceRange.length() && ruleSourceData->ruleBodyRange.start <= sour ceRange.start && sourceRange.start <= ruleSourceData->ruleBodyRange.end) {
939 *ruleId = InspectorCSSId(id(), i); 939 *ruleId = InspectorCSSId(id(), i);
940 *propertyIndex = propertyData.size(); 940 *propertyIndex = propertyData.size();
941 *overwrite = false; 941 *overwrite = false;
942 return true; 942 return true;
943 } 943 }
944 } 944 }
945 return false; 945 return false;
946 } 946 }
947 947
948 PassRefPtr<InspectorStyleSheet> InspectorStyleSheet::create(InspectorPageAgent* pageAgent, InspectorResourceAgent* resourceAgent, const String& id, PassRefPtrWi llBeRawPtr<CSSStyleSheet> pageStyleSheet, TypeBuilder::CSS::StyleSheetOrigin::En um origin, const String& documentURL, Listener* listener) 948 PassRefPtrWillBeRawPtr<InspectorStyleSheet> InspectorStyleSheet::create(Inspecto rPageAgent* pageAgent, InspectorResourceAgent* resourceAgent, const String& id, PassRefPtrWillBeRawPtr<CSSStyleSheet> pageStyleSheet, TypeBuilder::CSS::StyleShe etOrigin::Enum origin, const String& documentURL, Listener* listener)
949 { 949 {
950 return adoptRef(new InspectorStyleSheet(pageAgent, resourceAgent, id, pageSt yleSheet, origin, documentURL, listener)); 950 return adoptRefWillBeNoop(new InspectorStyleSheet(pageAgent, resourceAgent, id, pageStyleSheet, origin, documentURL, listener));
951 } 951 }
952 952
953 InspectorStyleSheet::InspectorStyleSheet(InspectorPageAgent* pageAgent, Inspecto rResourceAgent* resourceAgent, const String& id, PassRefPtrWillBeRawPtr<CSSStyle Sheet> pageStyleSheet, TypeBuilder::CSS::StyleSheetOrigin::Enum origin, const St ring& documentURL, Listener* listener) 953 InspectorStyleSheet::InspectorStyleSheet(InspectorPageAgent* pageAgent, Inspecto rResourceAgent* resourceAgent, const String& id, PassRefPtrWillBeRawPtr<CSSStyle Sheet> pageStyleSheet, TypeBuilder::CSS::StyleSheetOrigin::Enum origin, const St ring& documentURL, Listener* listener)
954 : InspectorStyleSheetBase(id, listener) 954 : InspectorStyleSheetBase(id, listener)
955 , m_pageAgent(pageAgent) 955 , m_pageAgent(pageAgent)
956 , m_resourceAgent(resourceAgent) 956 , m_resourceAgent(resourceAgent)
957 , m_pageStyleSheet(pageStyleSheet) 957 , m_pageStyleSheet(pageStyleSheet)
958 , m_origin(origin) 958 , m_origin(origin)
959 , m_documentURL(documentURL) 959 , m_documentURL(documentURL)
960 { 960 {
961 m_parsedStyleSheet = adoptPtr(new ParsedStyleSheet(m_pageStyleSheet.get())); 961 m_parsedStyleSheet = adoptPtr(new ParsedStyleSheet(m_pageStyleSheet.get()));
962 } 962 }
963 963
964 InspectorStyleSheet::~InspectorStyleSheet() 964 InspectorStyleSheet::~InspectorStyleSheet()
965 { 965 {
966 } 966 }
967 967
968 void InspectorStyleSheet::trace(Visitor* visitor)
969 {
970 visitor->trace(m_pageAgent);
971 visitor->trace(m_resourceAgent);
972 visitor->trace(m_pageStyleSheet);
973 visitor->trace(m_flatRules);
974 InspectorStyleSheetBase::trace(visitor);
975 }
976
968 static String styleSheetURL(CSSStyleSheet* pageStyleSheet) 977 static String styleSheetURL(CSSStyleSheet* pageStyleSheet)
969 { 978 {
970 if (pageStyleSheet && !pageStyleSheet->contents()->baseURL().isEmpty()) 979 if (pageStyleSheet && !pageStyleSheet->contents()->baseURL().isEmpty())
971 return pageStyleSheet->contents()->baseURL().string(); 980 return pageStyleSheet->contents()->baseURL().string();
972 return emptyString(); 981 return emptyString();
973 } 982 }
974 983
975 String InspectorStyleSheet::finalURL() const 984 String InspectorStyleSheet::finalURL() const
976 { 985 {
977 String url = styleSheetURL(m_pageStyleSheet.get()); 986 String url = styleSheetURL(m_pageStyleSheet.get());
(...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after
1557 1566
1558 bool InspectorStyleSheet::inlineStyleSheetText(String* result) const 1567 bool InspectorStyleSheet::inlineStyleSheetText(String* result) const
1559 { 1568 {
1560 Element* ownerElement = ownerStyleElement(); 1569 Element* ownerElement = ownerStyleElement();
1561 if (!ownerElement) 1570 if (!ownerElement)
1562 return false; 1571 return false;
1563 *result = ownerElement->textContent(); 1572 *result = ownerElement->textContent();
1564 return true; 1573 return true;
1565 } 1574 }
1566 1575
1567 PassRefPtr<InspectorStyleSheetForInlineStyle> InspectorStyleSheetForInlineStyle: :create(const String& id, PassRefPtrWillBeRawPtr<Element> element, Listener* lis tener) 1576 PassRefPtrWillBeRawPtr<InspectorStyleSheetForInlineStyle> InspectorStyleSheetFor InlineStyle::create(const String& id, PassRefPtrWillBeRawPtr<Element> element, L istener* listener)
1568 { 1577 {
1569 return adoptRef(new InspectorStyleSheetForInlineStyle(id, element, listener) ); 1578 return adoptRefWillBeNoop(new InspectorStyleSheetForInlineStyle(id, element, listener));
1570 } 1579 }
1571 1580
1572 InspectorStyleSheetForInlineStyle::InspectorStyleSheetForInlineStyle(const Strin g& id, PassRefPtrWillBeRawPtr<Element> element, Listener* listener) 1581 InspectorStyleSheetForInlineStyle::InspectorStyleSheetForInlineStyle(const Strin g& id, PassRefPtrWillBeRawPtr<Element> element, Listener* listener)
1573 : InspectorStyleSheetBase(id, listener) 1582 : InspectorStyleSheetBase(id, listener)
1574 , m_element(element) 1583 , m_element(element)
1575 , m_ruleSourceData(nullptr) 1584 , m_ruleSourceData(nullptr)
1576 , m_isStyleTextValid(false) 1585 , m_isStyleTextValid(false)
1577 { 1586 {
1578 ASSERT(m_element); 1587 ASSERT(m_element);
1579 m_inspectorStyle = InspectorStyle::create(InspectorCSSId(id, 0), inlineStyle (), this); 1588 m_inspectorStyle = InspectorStyle::create(InspectorCSSId(id, 0), inlineStyle (), this);
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
1686 return result.release(); 1695 return result.release();
1687 } 1696 }
1688 1697
1689 RefPtrWillBeRawPtr<MutableStylePropertySet> tempDeclaration = MutableStylePr opertySet::create(); 1698 RefPtrWillBeRawPtr<MutableStylePropertySet> tempDeclaration = MutableStylePr opertySet::create();
1690 RuleSourceDataList ruleSourceDataResult; 1699 RuleSourceDataList ruleSourceDataResult;
1691 StyleSheetHandler handler(m_styleText, &m_element->document(), m_element->do cument().elementSheet().contents(), &ruleSourceDataResult); 1700 StyleSheetHandler handler(m_styleText, &m_element->document(), m_element->do cument().elementSheet().contents(), &ruleSourceDataResult);
1692 BisonCSSParser(parserContextForDocument(&m_element->document())).parseDeclar ation(tempDeclaration.get(), m_styleText, &handler, m_element->document().elemen tSheet().contents()); 1701 BisonCSSParser(parserContextForDocument(&m_element->document())).parseDeclar ation(tempDeclaration.get(), m_styleText, &handler, m_element->document().elemen tSheet().contents());
1693 return ruleSourceDataResult.first().release(); 1702 return ruleSourceDataResult.first().release();
1694 } 1703 }
1695 1704
1705 void InspectorStyleSheetForInlineStyle::trace(Visitor* visitor)
1706 {
1707 visitor->trace(m_element);
1708 visitor->trace(m_ruleSourceData);
1709 InspectorStyleSheetBase::trace(visitor);
1710 }
1711
1696 } // namespace blink 1712 } // namespace blink
1697 1713
OLDNEW
« no previous file with comments | « Source/core/inspector/InspectorStyleSheet.h ('k') | Source/core/inspector/InspectorTimelineAgent.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698