| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 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 25 matching lines...) Expand all Loading... |
| 36 #include "WebFrameImpl.h" | 36 #include "WebFrameImpl.h" |
| 37 #include "WebPageSerializerClient.h" | 37 #include "WebPageSerializerClient.h" |
| 38 #include "WebPageSerializerImpl.h" | 38 #include "WebPageSerializerImpl.h" |
| 39 #include "WebView.h" | 39 #include "WebView.h" |
| 40 #include "WebViewImpl.h" | 40 #include "WebViewImpl.h" |
| 41 #include "core/dom/Document.h" | 41 #include "core/dom/Document.h" |
| 42 #include "core/dom/Element.h" | 42 #include "core/dom/Element.h" |
| 43 #include "core/html/HTMLAllCollection.h" | 43 #include "core/html/HTMLAllCollection.h" |
| 44 #include "core/html/HTMLFrameOwnerElement.h" | 44 #include "core/html/HTMLFrameOwnerElement.h" |
| 45 #include "core/html/HTMLInputElement.h" | 45 #include "core/html/HTMLInputElement.h" |
| 46 #include "core/html/HTMLTableElement.h" |
| 46 #include "core/loader/DocumentLoader.h" | 47 #include "core/loader/DocumentLoader.h" |
| 47 #include "core/loader/archive/MHTMLArchive.h" | 48 #include "core/loader/archive/MHTMLArchive.h" |
| 48 #include "core/page/Frame.h" | 49 #include "core/page/Frame.h" |
| 49 #include "core/page/PageSerializer.h" | 50 #include "core/page/PageSerializer.h" |
| 50 #include "core/platform/SerializedResource.h" | 51 #include "core/platform/SerializedResource.h" |
| 51 #include "public/platform/WebCString.h" | 52 #include "public/platform/WebCString.h" |
| 52 #include "public/platform/WebString.h" | 53 #include "public/platform/WebString.h" |
| 53 #include "public/platform/WebURL.h" | 54 #include "public/platform/WebURL.h" |
| 54 #include "public/platform/WebVector.h" | 55 #include "public/platform/WebVector.h" |
| 55 #include "weborigin/KURL.h" | 56 #include "weborigin/KURL.h" |
| 56 #include "wtf/Vector.h" | 57 #include "wtf/Vector.h" |
| 57 #include "wtf/text/StringConcatenate.h" | 58 #include "wtf/text/StringConcatenate.h" |
| 58 | 59 |
| 59 using namespace WebCore; | 60 using namespace WebCore; |
| 60 | 61 |
| 61 namespace { | 62 namespace { |
| 62 | 63 |
| 63 KURL getSubResourceURLFromElement(Element* element) | 64 KURL getSubResourceURLFromElement(Element* element) |
| 64 { | 65 { |
| 65 ASSERT(element); | 66 ASSERT(element); |
| 66 const QualifiedName* attributeName = 0; | 67 const QualifiedName* attributeName = 0; |
| 67 if (element->hasTagName(HTMLNames::imgTag) || element->hasTagName(HTMLNames:
:scriptTag)) | 68 if (element->hasTagName(HTMLNames::imgTag) || element->hasTagName(HTMLNames:
:scriptTag)) |
| 68 attributeName = &HTMLNames::srcAttr; | 69 attributeName = &HTMLNames::srcAttr; |
| 69 else if (element->hasTagName(HTMLNames::inputTag)) { | 70 else if (element->hasTagName(HTMLNames::inputTag)) { |
| 70 if (toHTMLInputElement(element)->isImageButton()) | 71 if (toHTMLInputElement(element)->isImageButton()) |
| 71 attributeName = &HTMLNames::srcAttr; | 72 attributeName = &HTMLNames::srcAttr; |
| 72 } else if (element->hasTagName(HTMLNames::bodyTag) | 73 } else if (element->hasTagName(HTMLNames::bodyTag) |
| 73 || element->hasTagName(HTMLNames::tableTag) | 74 || isHTMLTableElement(element) |
| 74 || element->hasTagName(HTMLNames::trTag) | 75 || element->hasTagName(HTMLNames::trTag) |
| 75 || element->hasTagName(HTMLNames::tdTag)) | 76 || element->hasTagName(HTMLNames::tdTag)) |
| 76 attributeName = &HTMLNames::backgroundAttr; | 77 attributeName = &HTMLNames::backgroundAttr; |
| 77 else if (element->hasTagName(HTMLNames::blockquoteTag) | 78 else if (element->hasTagName(HTMLNames::blockquoteTag) |
| 78 || element->hasTagName(HTMLNames::qTag) | 79 || element->hasTagName(HTMLNames::qTag) |
| 79 || element->hasTagName(HTMLNames::delTag) | 80 || element->hasTagName(HTMLNames::delTag) |
| 80 || element->hasTagName(HTMLNames::insTag)) | 81 || element->hasTagName(HTMLNames::insTag)) |
| 81 attributeName = &HTMLNames::citeAttr; | 82 attributeName = &HTMLNames::citeAttr; |
| 82 else if (element->hasTagName(HTMLNames::linkTag)) { | 83 else if (element->hasTagName(HTMLNames::linkTag)) { |
| 83 // If the link element is not css, ignore it. | 84 // If the link element is not css, ignore it. |
| 84 if (equalIgnoringCase(element->getAttribute(HTMLNames::typeAttr), "text/
css")) { | 85 if (equalIgnoringCase(element->getAttribute(HTMLNames::typeAttr), "text/
css")) { |
| 85 // FIXME: Add support for extracting links of sub-resources which | 86 // FIXME: Add support for extracting links of sub-resources which |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 | 293 |
| 293 WebString WebPageSerializer::generateBaseTagDeclaration(const WebString& baseTar
get) | 294 WebString WebPageSerializer::generateBaseTagDeclaration(const WebString& baseTar
get) |
| 294 { | 295 { |
| 295 if (baseTarget.isEmpty()) | 296 if (baseTarget.isEmpty()) |
| 296 return String(ASCIILiteral("<base href=\".\">")); | 297 return String(ASCIILiteral("<base href=\".\">")); |
| 297 String baseString = "<base href=\".\" target=\"" + static_cast<const String&
>(baseTarget) + "\">"; | 298 String baseString = "<base href=\".\" target=\"" + static_cast<const String&
>(baseTarget) + "\">"; |
| 298 return baseString; | 299 return baseString; |
| 299 } | 300 } |
| 300 | 301 |
| 301 } // namespace WebKit | 302 } // namespace WebKit |
| OLD | NEW |