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

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

Powered by Google App Engine
This is Rietveld 408576698