| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010, Google Inc. All rights reserved. | 2 * Copyright (C) 2010, Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 368 bool hasSourceData() const { return m_sourceData; } | 368 bool hasSourceData() const { return m_sourceData; } |
| 369 PassRefPtr<WebCore::CSSRuleSourceData> ruleSourceDataAt(unsigned) const; | 369 PassRefPtr<WebCore::CSSRuleSourceData> ruleSourceDataAt(unsigned) const; |
| 370 | 370 |
| 371 private: | 371 private: |
| 372 void flattenSourceData(RuleSourceDataList*); | 372 void flattenSourceData(RuleSourceDataList*); |
| 373 void setSourceData(PassOwnPtr<RuleSourceDataList>); | 373 void setSourceData(PassOwnPtr<RuleSourceDataList>); |
| 374 | 374 |
| 375 String m_text; | 375 String m_text; |
| 376 bool m_hasText; | 376 bool m_hasText; |
| 377 OwnPtr<RuleSourceDataList> m_sourceData; | 377 OwnPtr<RuleSourceDataList> m_sourceData; |
| 378 RefPtr<CSSStyleSheet> m_pageStyleSheet; | 378 RefPtrWillBePersistent<CSSStyleSheet> m_pageStyleSheet; |
| 379 }; | 379 }; |
| 380 | 380 |
| 381 ParsedStyleSheet::ParsedStyleSheet(CSSStyleSheet* pageStyleSheet) | 381 ParsedStyleSheet::ParsedStyleSheet(CSSStyleSheet* pageStyleSheet) |
| 382 : m_hasText(false) | 382 : m_hasText(false) |
| 383 , m_pageStyleSheet(pageStyleSheet) | 383 , m_pageStyleSheet(pageStyleSheet) |
| 384 { | 384 { |
| 385 } | 385 } |
| 386 | 386 |
| 387 void ParsedStyleSheet::setText(const String& text) | 387 void ParsedStyleSheet::setText(const String& text) |
| 388 { | 388 { |
| (...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 826 m_format.first = formatLineFeed.toString(); | 826 m_format.first = formatLineFeed.toString(); |
| 827 m_format.second = isFullPrefixScanned ? prefix.toString() : candidatePrefix; | 827 m_format.second = isFullPrefixScanned ? prefix.toString() : candidatePrefix; |
| 828 return m_format; | 828 return m_format; |
| 829 } | 829 } |
| 830 | 830 |
| 831 Document* InspectorStyle::ownerDocument() const | 831 Document* InspectorStyle::ownerDocument() const |
| 832 { | 832 { |
| 833 return m_parentStyleSheet->pageStyleSheet() ? m_parentStyleSheet->pageStyleS
heet()->ownerDocument() : 0; | 833 return m_parentStyleSheet->pageStyleSheet() ? m_parentStyleSheet->pageStyleS
heet()->ownerDocument() : 0; |
| 834 } | 834 } |
| 835 | 835 |
| 836 PassRefPtr<InspectorStyleSheet> InspectorStyleSheet::create(InspectorPageAgent*
pageAgent, InspectorResourceAgent* resourceAgent, const String& id, PassRefPtr<C
SSStyleSheet> pageStyleSheet, TypeBuilder::CSS::StyleSheetOrigin::Enum origin, c
onst String& documentURL, Listener* listener) | 836 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) |
| 837 { | 837 { |
| 838 return adoptRef(new InspectorStyleSheet(pageAgent, resourceAgent, id, pageSt
yleSheet, origin, documentURL, listener)); | 838 return adoptRef(new InspectorStyleSheet(pageAgent, resourceAgent, id, pageSt
yleSheet, origin, documentURL, listener)); |
| 839 } | 839 } |
| 840 | 840 |
| 841 // static | 841 // static |
| 842 String InspectorStyleSheet::styleSheetURL(CSSStyleSheet* pageStyleSheet) | 842 String InspectorStyleSheet::styleSheetURL(CSSStyleSheet* pageStyleSheet) |
| 843 { | 843 { |
| 844 if (pageStyleSheet && !pageStyleSheet->contents()->baseURL().isEmpty()) | 844 if (pageStyleSheet && !pageStyleSheet->contents()->baseURL().isEmpty()) |
| 845 return pageStyleSheet->contents()->baseURL().string(); | 845 return pageStyleSheet->contents()->baseURL().string(); |
| 846 return emptyString(); | 846 return emptyString(); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 866 break; | 866 break; |
| 867 default: | 867 default: |
| 868 break; | 868 break; |
| 869 } | 869 } |
| 870 RefPtrWillBeRawPtr<CSSRuleList> childRuleList = asCSSRuleList(rule); | 870 RefPtrWillBeRawPtr<CSSRuleList> childRuleList = asCSSRuleList(rule); |
| 871 if (childRuleList) | 871 if (childRuleList) |
| 872 collectFlatRules(childRuleList, result); | 872 collectFlatRules(childRuleList, result); |
| 873 } | 873 } |
| 874 } | 874 } |
| 875 | 875 |
| 876 InspectorStyleSheet::InspectorStyleSheet(InspectorPageAgent* pageAgent, Inspecto
rResourceAgent* resourceAgent, const String& id, PassRefPtr<CSSStyleSheet> pageS
tyleSheet, TypeBuilder::CSS::StyleSheetOrigin::Enum origin, const String& docume
ntURL, Listener* listener) | 876 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) |
| 877 : m_pageAgent(pageAgent) | 877 : m_pageAgent(pageAgent) |
| 878 , m_resourceAgent(resourceAgent) | 878 , m_resourceAgent(resourceAgent) |
| 879 , m_id(id) | 879 , m_id(id) |
| 880 , m_pageStyleSheet(pageStyleSheet) | 880 , m_pageStyleSheet(pageStyleSheet) |
| 881 , m_origin(origin) | 881 , m_origin(origin) |
| 882 , m_documentURL(documentURL) | 882 , m_documentURL(documentURL) |
| 883 , m_listener(listener) | 883 , m_listener(listener) |
| 884 { | 884 { |
| 885 m_parsedStyleSheet = new ParsedStyleSheet(m_pageStyleSheet.get()); | 885 m_parsedStyleSheet = new ParsedStyleSheet(m_pageStyleSheet.get()); |
| 886 } | 886 } |
| (...skipping 763 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1650 | 1650 |
| 1651 RefPtr<MutableStylePropertySet> tempDeclaration = MutableStylePropertySet::c
reate(); | 1651 RefPtr<MutableStylePropertySet> tempDeclaration = MutableStylePropertySet::c
reate(); |
| 1652 RuleSourceDataList ruleSourceDataResult; | 1652 RuleSourceDataList ruleSourceDataResult; |
| 1653 StyleSheetHandler handler(m_styleText, &m_element->document(), m_element->do
cument().elementSheet().contents(), &ruleSourceDataResult); | 1653 StyleSheetHandler handler(m_styleText, &m_element->document(), m_element->do
cument().elementSheet().contents(), &ruleSourceDataResult); |
| 1654 createCSSParser(&m_element->document())->parseDeclaration(tempDeclaration.ge
t(), m_styleText, &handler, m_element->document().elementSheet().contents()); | 1654 createCSSParser(&m_element->document())->parseDeclaration(tempDeclaration.ge
t(), m_styleText, &handler, m_element->document().elementSheet().contents()); |
| 1655 return ruleSourceDataResult.first().release(); | 1655 return ruleSourceDataResult.first().release(); |
| 1656 } | 1656 } |
| 1657 | 1657 |
| 1658 } // namespace WebCore | 1658 } // namespace WebCore |
| 1659 | 1659 |
| OLD | NEW |