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

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 and oilpan feedback Created 5 years, 6 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
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 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 void PageSerializer::retrieveResourcesForProperties(const StylePropertySet* styl eDeclaration, Document& document) 368 void PageSerializer::retrieveResourcesForProperties(const StylePropertySet* styl eDeclaration, Document& document)
369 { 369 {
370 if (!styleDeclaration) 370 if (!styleDeclaration)
371 return; 371 return;
372 372
373 // The background-image and list-style-image (for ul or ol) are the CSS prop erties 373 // The background-image and list-style-image (for ul or ol) are the CSS prop erties
374 // that make use of images. We iterate to make sure we include any other 374 // that make use of images. We iterate to make sure we include any other
375 // image properties there might be. 375 // image properties there might be.
376 unsigned propertyCount = styleDeclaration->propertyCount(); 376 unsigned propertyCount = styleDeclaration->propertyCount();
377 for (unsigned i = 0; i < propertyCount; ++i) { 377 for (unsigned i = 0; i < propertyCount; ++i) {
378 RefPtrWillBeRawPtr<CSSValue> cssValue = styleDeclaration->propertyAt(i). value(); 378 CSSValue cssValue = styleDeclaration->propertyAt(i).value();
379 retrieveResourcesForCSSValue(cssValue.get(), document); 379 retrieveResourcesForCSSValue(cssValue, document);
380 } 380 }
381 } 381 }
382 382
383 void PageSerializer::retrieveResourcesForCSSValue(CSSValue* cssValue, Document& document) 383 void PageSerializer::retrieveResourcesForCSSValue(CSSValue cssValue, Document& d ocument)
384 { 384 {
385 if (cssValue->isImageValue()) { 385 if (cssValue.isImageValue()) {
386 CSSImageValue* imageValue = toCSSImageValue(cssValue); 386 CSSImageValue& imageValue = toCSSImageValue(cssValue);
387 StyleImage* styleImage = imageValue->cachedOrPendingImage(); 387 StyleImage* styleImage = imageValue.cachedOrPendingImage();
388 // Non cached-images are just place-holders and do not contain data. 388 // Non cached-images are just place-holders and do not contain data.
389 if (!styleImage || !styleImage->isImageResource()) 389 if (!styleImage || !styleImage->isImageResource())
390 return; 390 return;
391 391
392 addImageToResources(styleImage->cachedImage(), nullptr, styleImage->cach edImage()->url()); 392 addImageToResources(styleImage->cachedImage(), nullptr, styleImage->cach edImage()->url());
393 } else if (cssValue->isFontFaceSrcValue()) { 393 } else if (cssValue.isFontFaceSrcValue()) {
394 CSSFontFaceSrcValue* fontFaceSrcValue = toCSSFontFaceSrcValue(cssValue); 394 CSSFontFaceSrcValue& fontFaceSrcValue = toCSSFontFaceSrcValue(cssValue);
395 if (fontFaceSrcValue->isLocal()) { 395 if (fontFaceSrcValue.isLocal()) {
396 return; 396 return;
397 } 397 }
398 398
399 addFontToResources(fontFaceSrcValue->fetch(&document)); 399 addFontToResources(fontFaceSrcValue.fetch(&document));
400 } else if (cssValue->isValueList()) { 400 } else if (cssValue.isValueList()) {
401 CSSValueList* cssValueList = toCSSValueList(cssValue); 401 CSSValueList& cssValueList = toCSSValueList(cssValue);
402 for (unsigned i = 0; i < cssValueList->length(); i++) 402 for (unsigned i = 0; i < cssValueList.length(); i++)
403 retrieveResourcesForCSSValue(cssValueList->item(i), document); 403 retrieveResourcesForCSSValue(cssValueList.item(i), document);
404 } 404 }
405 } 405 }
406 406
407 KURL PageSerializer::urlForBlankFrame(LocalFrame* frame) 407 KURL PageSerializer::urlForBlankFrame(LocalFrame* frame)
408 { 408 {
409 BlankFrameURLMap::iterator iter = m_blankFrameURLs.find(frame); 409 BlankFrameURLMap::iterator iter = m_blankFrameURLs.find(frame);
410 if (iter != m_blankFrameURLs.end()) 410 if (iter != m_blankFrameURLs.end())
411 return iter->value; 411 return iter->value;
412 String url = "wyciwyg://frame/" + String::number(m_blankFrameCounter++); 412 String url = "wyciwyg://frame/" + String::number(m_blankFrameCounter++);
413 KURL fakeURL(ParsedURLString, url); 413 KURL fakeURL(ParsedURLString, url);
414 m_blankFrameURLs.add(frame, fakeURL); 414 m_blankFrameURLs.add(frame, fakeURL);
415 415
416 return fakeURL; 416 return fakeURL;
417 } 417 }
418 418
419 PageSerializer::Delegate* PageSerializer::delegate() 419 PageSerializer::Delegate* PageSerializer::delegate()
420 { 420 {
421 return m_delegate.get(); 421 return m_delegate.get();
422 } 422 }
423 423
424 } // namespace blink 424 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698