| 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 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 m_currentRuleDataStack.last()->mediaSourceData->queryData.append(data); | 328 m_currentRuleDataStack.last()->mediaSourceData->queryData.append(data); |
| 329 } | 329 } |
| 330 | 330 |
| 331 void StyleSheetHandler::endMediaQuery() | 331 void StyleSheetHandler::endMediaQuery() |
| 332 { | 332 { |
| 333 m_currentMediaQueryData.clear(); | 333 m_currentMediaQueryData.clear(); |
| 334 } | 334 } |
| 335 | 335 |
| 336 } // namespace | 336 } // namespace |
| 337 | 337 |
| 338 class ParsedStyleSheet { | 338 class ParsedStyleSheet : public NoBaseWillBeGarbageCollectedFinalized<ParsedStyl
eSheet> { |
| 339 WTF_MAKE_FAST_ALLOCATED(ParsedStyleSheet); | |
| 340 public: | 339 public: |
| 341 ParsedStyleSheet(CSSStyleSheet* pageStyleSheet); | 340 ParsedStyleSheet(CSSStyleSheet* pageStyleSheet); |
| 342 | 341 |
| 343 const String& text() const { ASSERT(m_hasText); return m_text; } | 342 const String& text() const { ASSERT(m_hasText); return m_text; } |
| 344 void setText(const String&); | 343 void setText(const String&); |
| 345 bool hasText() const { return m_hasText; } | 344 bool hasText() const { return m_hasText; } |
| 346 bool ensureSourceData(); | 345 bool ensureSourceData(); |
| 347 bool hasSourceData() const { return m_sourceData; } | 346 bool hasSourceData() const { return m_sourceData; } |
| 348 PassRefPtrWillBeRawPtr<blink::CSSRuleSourceData> ruleSourceDataAt(unsigned)
const; | 347 PassRefPtrWillBeRawPtr<blink::CSSRuleSourceData> ruleSourceDataAt(unsigned)
const; |
| 349 unsigned ruleCount() { return m_sourceData->size(); } | 348 unsigned ruleCount() { return m_sourceData->size(); } |
| 350 | 349 |
| 350 DECLARE_TRACE(); |
| 351 |
| 351 private: | 352 private: |
| 352 void flattenSourceData(RuleSourceDataList*); | 353 void flattenSourceData(RuleSourceDataList*); |
| 353 void setSourceData(PassOwnPtrWillBeRawPtr<RuleSourceDataList>); | 354 void setSourceData(PassOwnPtrWillBeRawPtr<RuleSourceDataList>); |
| 354 | 355 |
| 355 String m_text; | 356 String m_text; |
| 356 bool m_hasText; | 357 bool m_hasText; |
| 357 OwnPtrWillBePersistent<RuleSourceDataList> m_sourceData; | 358 OwnPtrWillBeMember<RuleSourceDataList> m_sourceData; |
| 358 RefPtrWillBePersistent<CSSStyleSheet> m_pageStyleSheet; | 359 RefPtrWillBeMember<CSSStyleSheet> m_pageStyleSheet; |
| 359 }; | 360 }; |
| 360 | 361 |
| 361 ParsedStyleSheet::ParsedStyleSheet(CSSStyleSheet* pageStyleSheet) | 362 ParsedStyleSheet::ParsedStyleSheet(CSSStyleSheet* pageStyleSheet) |
| 362 : m_hasText(false) | 363 : m_hasText(false) |
| 363 , m_pageStyleSheet(pageStyleSheet) | 364 , m_pageStyleSheet(pageStyleSheet) |
| 364 { | 365 { |
| 365 } | 366 } |
| 366 | 367 |
| 367 void ParsedStyleSheet::setText(const String& text) | 368 void ParsedStyleSheet::setText(const String& text) |
| 368 { | 369 { |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 427 } | 428 } |
| 428 | 429 |
| 429 PassRefPtrWillBeRawPtr<blink::CSSRuleSourceData> ParsedStyleSheet::ruleSourceDat
aAt(unsigned index) const | 430 PassRefPtrWillBeRawPtr<blink::CSSRuleSourceData> ParsedStyleSheet::ruleSourceDat
aAt(unsigned index) const |
| 430 { | 431 { |
| 431 if (!hasSourceData() || index >= m_sourceData->size()) | 432 if (!hasSourceData() || index >= m_sourceData->size()) |
| 432 return nullptr; | 433 return nullptr; |
| 433 | 434 |
| 434 return m_sourceData->at(index); | 435 return m_sourceData->at(index); |
| 435 } | 436 } |
| 436 | 437 |
| 438 DEFINE_TRACE(ParsedStyleSheet) |
| 439 { |
| 440 visitor->trace(m_sourceData); |
| 441 visitor->trace(m_pageStyleSheet); |
| 442 } |
| 443 |
| 437 namespace blink { | 444 namespace blink { |
| 438 | 445 |
| 439 enum MediaListSource { | 446 enum MediaListSource { |
| 440 MediaListSourceLinkedSheet, | 447 MediaListSourceLinkedSheet, |
| 441 MediaListSourceInlineSheet, | 448 MediaListSourceInlineSheet, |
| 442 MediaListSourceMediaRule, | 449 MediaListSourceMediaRule, |
| 443 MediaListSourceImportRule | 450 MediaListSourceImportRule |
| 444 }; | 451 }; |
| 445 | 452 |
| 446 static PassRefPtr<TypeBuilder::CSS::SourceRange> buildSourceRangeObject(const So
urceRange& range, const LineEndings* lineEndings) | 453 static PassRefPtr<TypeBuilder::CSS::SourceRange> buildSourceRangeObject(const So
urceRange& range, const LineEndings* lineEndings) |
| (...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 946 | 953 |
| 947 InspectorStyleSheet::~InspectorStyleSheet() | 954 InspectorStyleSheet::~InspectorStyleSheet() |
| 948 { | 955 { |
| 949 } | 956 } |
| 950 | 957 |
| 951 DEFINE_TRACE(InspectorStyleSheet) | 958 DEFINE_TRACE(InspectorStyleSheet) |
| 952 { | 959 { |
| 953 visitor->trace(m_cssAgent); | 960 visitor->trace(m_cssAgent); |
| 954 visitor->trace(m_resourceAgent); | 961 visitor->trace(m_resourceAgent); |
| 955 visitor->trace(m_pageStyleSheet); | 962 visitor->trace(m_pageStyleSheet); |
| 963 visitor->trace(m_parsedStyleSheet); |
| 956 visitor->trace(m_flatRules); | 964 visitor->trace(m_flatRules); |
| 957 InspectorStyleSheetBase::trace(visitor); | 965 InspectorStyleSheetBase::trace(visitor); |
| 958 } | 966 } |
| 959 | 967 |
| 960 static String styleSheetURL(CSSStyleSheet* pageStyleSheet) | 968 static String styleSheetURL(CSSStyleSheet* pageStyleSheet) |
| 961 { | 969 { |
| 962 if (pageStyleSheet && !pageStyleSheet->contents()->baseURL().isEmpty()) | 970 if (pageStyleSheet && !pageStyleSheet->contents()->baseURL().isEmpty()) |
| 963 return pageStyleSheet->contents()->baseURL().string(); | 971 return pageStyleSheet->contents()->baseURL().string(); |
| 964 return emptyString(); | 972 return emptyString(); |
| 965 } | 973 } |
| (...skipping 966 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1932 | 1940 |
| 1933 DEFINE_TRACE(InspectorStyleSheetForInlineStyle) | 1941 DEFINE_TRACE(InspectorStyleSheetForInlineStyle) |
| 1934 { | 1942 { |
| 1935 visitor->trace(m_element); | 1943 visitor->trace(m_element); |
| 1936 visitor->trace(m_ruleSourceData); | 1944 visitor->trace(m_ruleSourceData); |
| 1937 visitor->trace(m_inspectorStyle); | 1945 visitor->trace(m_inspectorStyle); |
| 1938 InspectorStyleSheetBase::trace(visitor); | 1946 InspectorStyleSheetBase::trace(visitor); |
| 1939 } | 1947 } |
| 1940 | 1948 |
| 1941 } // namespace blink | 1949 } // namespace blink |
| OLD | NEW |