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 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
514 void PageSerializer::retrieveResourcesForProperties(const StylePropertySet* styl
eDeclaration, Document& document) | 514 void PageSerializer::retrieveResourcesForProperties(const StylePropertySet* styl
eDeclaration, Document& document) |
515 { | 515 { |
516 if (!styleDeclaration) | 516 if (!styleDeclaration) |
517 return; | 517 return; |
518 | 518 |
519 // The background-image and list-style-image (for ul or ol) are the CSS prop
erties | 519 // The background-image and list-style-image (for ul or ol) are the CSS prop
erties |
520 // that make use of images. We iterate to make sure we include any other | 520 // that make use of images. We iterate to make sure we include any other |
521 // image properties there might be. | 521 // image properties there might be. |
522 unsigned propertyCount = styleDeclaration->propertyCount(); | 522 unsigned propertyCount = styleDeclaration->propertyCount(); |
523 for (unsigned i = 0; i < propertyCount; ++i) { | 523 for (unsigned i = 0; i < propertyCount; ++i) { |
524 RefPtrWillBeRawPtr<CSSValue> cssValue = styleDeclaration->propertyAt(i).
value(); | 524 CSSValue cssValue = styleDeclaration->propertyAt(i).value(); |
525 retrieveResourcesForCSSValue(cssValue.get(), document); | 525 retrieveResourcesForCSSValue(cssValue, document); |
526 } | 526 } |
527 } | 527 } |
528 | 528 |
529 void PageSerializer::retrieveResourcesForCSSValue(CSSValue* cssValue, Document&
document) | 529 void PageSerializer::retrieveResourcesForCSSValue(CSSValue cssValue, Document& d
ocument) |
530 { | 530 { |
531 if (cssValue->isImageValue()) { | 531 if (cssValue.isImageValue()) { |
532 CSSImageValue* imageValue = toCSSImageValue(cssValue); | 532 CSSImageValue& imageValue = toCSSImageValue(cssValue); |
533 StyleImage* styleImage = imageValue->cachedOrPendingImage(); | 533 StyleImage* styleImage = imageValue.cachedOrPendingImage(); |
534 // Non cached-images are just place-holders and do not contain data. | 534 // Non cached-images are just place-holders and do not contain data. |
535 if (!styleImage || !styleImage->isImageResource()) | 535 if (!styleImage || !styleImage->isImageResource()) |
536 return; | 536 return; |
537 | 537 |
538 addImageToResources(styleImage->cachedImage(), nullptr, styleImage->cach
edImage()->url()); | 538 addImageToResources(styleImage->cachedImage(), nullptr, styleImage->cach
edImage()->url()); |
539 } else if (cssValue->isFontFaceSrcValue()) { | 539 } else if (cssValue.isFontFaceSrcValue()) { |
540 CSSFontFaceSrcValue* fontFaceSrcValue = toCSSFontFaceSrcValue(cssValue); | 540 CSSFontFaceSrcValue& fontFaceSrcValue = toCSSFontFaceSrcValue(cssValue); |
541 if (fontFaceSrcValue->isLocal()) { | 541 if (fontFaceSrcValue.isLocal()) { |
542 return; | 542 return; |
543 } | 543 } |
544 | 544 |
545 addFontToResources(fontFaceSrcValue->fetch(&document)); | 545 addFontToResources(fontFaceSrcValue.fetch(&document)); |
546 } else if (cssValue->isValueList()) { | 546 } else if (cssValue.isValueList()) { |
547 CSSValueList* cssValueList = toCSSValueList(cssValue); | 547 CSSValueList& cssValueList = toCSSValueList(cssValue); |
548 for (unsigned i = 0; i < cssValueList->length(); i++) | 548 for (unsigned i = 0; i < cssValueList.length(); i++) |
549 retrieveResourcesForCSSValue(cssValueList->item(i), document); | 549 retrieveResourcesForCSSValue(cssValueList.item(i), document); |
550 } | 550 } |
551 } | 551 } |
552 | 552 |
553 void PageSerializer::registerRewriteURL(const String& from, const String& to) | 553 void PageSerializer::registerRewriteURL(const String& from, const String& to) |
554 { | 554 { |
555 m_rewriteURLs.set(from, to); | 555 m_rewriteURLs.set(from, to); |
556 } | 556 } |
557 | 557 |
558 void PageSerializer::setRewriteURLFolder(const String& rewriteFolder) | 558 void PageSerializer::setRewriteURLFolder(const String& rewriteFolder) |
559 { | 559 { |
(...skipping 11 matching lines...) Expand all Loading... |
571 | 571 |
572 return fakeURL; | 572 return fakeURL; |
573 } | 573 } |
574 | 574 |
575 PageSerializer::Delegate* PageSerializer::delegate() | 575 PageSerializer::Delegate* PageSerializer::delegate() |
576 { | 576 { |
577 return m_delegate.get(); | 577 return m_delegate.get(); |
578 } | 578 } |
579 | 579 |
580 } // namespace blink | 580 } // namespace blink |
OLD | NEW |