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 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 if (!node->isElementNode()) | 217 if (!node->isElementNode()) |
218 continue; | 218 continue; |
219 | 219 |
220 Element* element = toElement(node); | 220 Element* element = toElement(node); |
221 // We have to process in-line style as it might contain some resources (
typically background images). | 221 // We have to process in-line style as it might contain some resources (
typically background images). |
222 if (element->isStyledElement()) | 222 if (element->isStyledElement()) |
223 retrieveResourcesForProperties(element->inlineStyle(), document); | 223 retrieveResourcesForProperties(element->inlineStyle(), document); |
224 | 224 |
225 if (element->hasTagName(HTMLNames::imgTag)) { | 225 if (element->hasTagName(HTMLNames::imgTag)) { |
226 HTMLImageElement* imageElement = toHTMLImageElement(element); | 226 HTMLImageElement* imageElement = toHTMLImageElement(element); |
227 KURL url = document->completeURL(imageElement->getAttribute(HTMLName
s::srcAttr)); | 227 KURL url = imageElement->treeScope().completeURL(imageElement->getAt
tribute(HTMLNames::srcAttr)); |
228 ImageResource* cachedImage = imageElement->cachedImage(); | 228 ImageResource* cachedImage = imageElement->cachedImage(); |
229 addImageToResources(cachedImage, imageElement->renderer(), url); | 229 addImageToResources(cachedImage, imageElement->renderer(), url); |
230 } else if (element->hasTagName(HTMLNames::inputTag)) { | 230 } else if (element->hasTagName(HTMLNames::inputTag)) { |
231 HTMLInputElement* inputElement = toHTMLInputElement(element); | 231 HTMLInputElement* inputElement = toHTMLInputElement(element); |
232 if (inputElement->isImageButton() && inputElement->hasImageLoader())
{ | 232 if (inputElement->isImageButton() && inputElement->hasImageLoader())
{ |
233 KURL url = inputElement->src(); | 233 KURL url = inputElement->src(); |
234 ImageResource* cachedImage = inputElement->imageLoader()->image(
); | 234 ImageResource* cachedImage = inputElement->imageLoader()->image(
); |
235 addImageToResources(cachedImage, inputElement->renderer(), url); | 235 addImageToResources(cachedImage, inputElement->renderer(), url); |
236 } | 236 } |
237 } else if (element->hasTagName(HTMLNames::linkTag)) { | 237 } else if (element->hasTagName(HTMLNames::linkTag)) { |
238 HTMLLinkElement* linkElement = toHTMLLinkElement(element); | 238 HTMLLinkElement* linkElement = toHTMLLinkElement(element); |
239 if (CSSStyleSheet* sheet = linkElement->sheet()) { | 239 if (CSSStyleSheet* sheet = linkElement->sheet()) { |
240 KURL url = document->completeURL(linkElement->getAttribute(HTMLN
ames::hrefAttr)); | 240 KURL url = linkElement->treeScope().completeURL(linkElement->get
Attribute(HTMLNames::hrefAttr)); |
241 serializeCSSStyleSheet(sheet, url); | 241 serializeCSSStyleSheet(sheet, url); |
242 ASSERT(m_resourceURLs.contains(url)); | 242 ASSERT(m_resourceURLs.contains(url)); |
243 } | 243 } |
244 } else if (element->hasTagName(HTMLNames::styleTag)) { | 244 } else if (element->hasTagName(HTMLNames::styleTag)) { |
245 HTMLStyleElement* styleElement = toHTMLStyleElement(element); | 245 HTMLStyleElement* styleElement = toHTMLStyleElement(element); |
246 if (CSSStyleSheet* sheet = styleElement->sheet()) | 246 if (CSSStyleSheet* sheet = styleElement->sheet()) |
247 serializeCSSStyleSheet(sheet, KURL()); | 247 serializeCSSStyleSheet(sheet, KURL()); |
248 } | 248 } |
249 } | 249 } |
250 | 250 |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 if (iter != m_blankFrameURLs.end()) | 376 if (iter != m_blankFrameURLs.end()) |
377 return iter->value; | 377 return iter->value; |
378 String url = "wyciwyg://frame/" + String::number(m_blankFrameCounter++); | 378 String url = "wyciwyg://frame/" + String::number(m_blankFrameCounter++); |
379 KURL fakeURL(ParsedURLString, url); | 379 KURL fakeURL(ParsedURLString, url); |
380 m_blankFrameURLs.add(frame, fakeURL); | 380 m_blankFrameURLs.add(frame, fakeURL); |
381 | 381 |
382 return fakeURL; | 382 return fakeURL; |
383 } | 383 } |
384 | 384 |
385 } | 385 } |
OLD | NEW |