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

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

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