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

Side by Side Diff: Source/core/page/PageSerializer.cpp

Issue 1164573002: CSSValue Immediates: Change CSSValue to an object instead of a pointer (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 5 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
« no previous file with comments | « Source/core/page/PageSerializer.h ('k') | Source/core/style/StyleFetchedImage.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « Source/core/page/PageSerializer.h ('k') | Source/core/style/StyleFetchedImage.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698