| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 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 are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 m_resourceURLs.add(url); | 333 m_resourceURLs.add(url); |
| 334 } | 334 } |
| 335 } | 335 } |
| 336 | 336 |
| 337 void FrameSerializer::serializeCSSRule(CSSRule* rule) | 337 void FrameSerializer::serializeCSSRule(CSSRule* rule) |
| 338 { | 338 { |
| 339 ASSERT(rule->parentStyleSheet()->ownerDocument()); | 339 ASSERT(rule->parentStyleSheet()->ownerDocument()); |
| 340 Document& document = *rule->parentStyleSheet()->ownerDocument(); | 340 Document& document = *rule->parentStyleSheet()->ownerDocument(); |
| 341 | 341 |
| 342 switch (rule->type()) { | 342 switch (rule->type()) { |
| 343 case CSSRule::STYLE_RULE: | 343 case CSSRule::kStyleRule: |
| 344 retrieveResourcesForProperties(&toCSSStyleRule(rule)->styleRule()->prope
rties(), document); | 344 retrieveResourcesForProperties(&toCSSStyleRule(rule)->styleRule()->prope
rties(), document); |
| 345 break; | 345 break; |
| 346 | 346 |
| 347 case CSSRule::IMPORT_RULE: { | 347 case CSSRule::kImportRule: { |
| 348 CSSImportRule* importRule = toCSSImportRule(rule); | 348 CSSImportRule* importRule = toCSSImportRule(rule); |
| 349 KURL sheetBaseURL = rule->parentStyleSheet()->baseURL(); | 349 KURL sheetBaseURL = rule->parentStyleSheet()->baseURL(); |
| 350 ASSERT(sheetBaseURL.isValid()); | 350 ASSERT(sheetBaseURL.isValid()); |
| 351 KURL importURL = KURL(sheetBaseURL, importRule->href()); | 351 KURL importURL = KURL(sheetBaseURL, importRule->href()); |
| 352 if (m_resourceURLs.contains(importURL)) | 352 if (m_resourceURLs.contains(importURL)) |
| 353 break; | 353 break; |
| 354 if (importRule->styleSheet()) | 354 if (importRule->styleSheet()) |
| 355 serializeCSSStyleSheet(*importRule->styleSheet(), importURL); | 355 serializeCSSStyleSheet(*importRule->styleSheet(), importURL); |
| 356 break; | 356 break; |
| 357 } | 357 } |
| 358 | 358 |
| 359 // Rules inheriting CSSGroupingRule | 359 // Rules inheriting CSSGroupingRule |
| 360 case CSSRule::MEDIA_RULE: | 360 case CSSRule::kMediaRule: |
| 361 case CSSRule::SUPPORTS_RULE: { | 361 case CSSRule::kSupportsRule: { |
| 362 CSSRuleList* ruleList = rule->cssRules(); | 362 CSSRuleList* ruleList = rule->cssRules(); |
| 363 for (unsigned i = 0; i < ruleList->length(); ++i) | 363 for (unsigned i = 0; i < ruleList->length(); ++i) |
| 364 serializeCSSRule(ruleList->item(i)); | 364 serializeCSSRule(ruleList->item(i)); |
| 365 break; | 365 break; |
| 366 } | 366 } |
| 367 | 367 |
| 368 case CSSRule::FONT_FACE_RULE: | 368 case CSSRule::kFontFaceRule: |
| 369 retrieveResourcesForProperties(&toCSSFontFaceRule(rule)->styleRule()->pr
operties(), document); | 369 retrieveResourcesForProperties(&toCSSFontFaceRule(rule)->styleRule()->pr
operties(), document); |
| 370 break; | 370 break; |
| 371 | 371 |
| 372 // Rules in which no external resources can be referenced | 372 // Rules in which no external resources can be referenced |
| 373 case CSSRule::CHARSET_RULE: | 373 case CSSRule::kCharsetRule: |
| 374 case CSSRule::PAGE_RULE: | 374 case CSSRule::kPageRule: |
| 375 case CSSRule::KEYFRAMES_RULE: | 375 case CSSRule::kKeyframesRule: |
| 376 case CSSRule::KEYFRAME_RULE: | 376 case CSSRule::kKeyframeRule: |
| 377 case CSSRule::NAMESPACE_RULE: | 377 case CSSRule::kNamespaceRule: |
| 378 case CSSRule::VIEWPORT_RULE: | 378 case CSSRule::kViewportRule: |
| 379 break; | 379 break; |
| 380 } | 380 } |
| 381 } | 381 } |
| 382 | 382 |
| 383 bool FrameSerializer::shouldAddURL(const KURL& url) | 383 bool FrameSerializer::shouldAddURL(const KURL& url) |
| 384 { | 384 { |
| 385 return url.isValid() && !m_resourceURLs.contains(url) && !url.protocolIsData
() | 385 return url.isValid() && !m_resourceURLs.contains(url) && !url.protocolIsData
() |
| 386 && !m_delegate.shouldSkipResourceWithURL(url); | 386 && !m_delegate.shouldSkipResourceWithURL(url); |
| 387 } | 387 } |
| 388 | 388 |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 476 continue; | 476 continue; |
| 477 } | 477 } |
| 478 emitsMinus = ch == '-'; | 478 emitsMinus = ch == '-'; |
| 479 builder.append(ch); | 479 builder.append(ch); |
| 480 } | 480 } |
| 481 CString escapedUrl = builder.toString().ascii(); | 481 CString escapedUrl = builder.toString().ascii(); |
| 482 return String::format("saved from url=(%04d)%s", static_cast<int>(escapedUrl
.length()), escapedUrl.data()); | 482 return String::format("saved from url=(%04d)%s", static_cast<int>(escapedUrl
.length()), escapedUrl.data()); |
| 483 } | 483 } |
| 484 | 484 |
| 485 } // namespace blink | 485 } // namespace blink |
| OLD | NEW |