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