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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 // base tags and append new base tag after each old base tag because we do not | 71 // base tags and append new base tag after each old base tag because we do not |
72 // know those old base tags are original content or added by JavaScript. If | 72 // know those old base tags are original content or added by JavaScript. If |
73 // they are added by JavaScript, it means when loading saved page, the script(s) | 73 // they are added by JavaScript, it means when loading saved page, the script(s) |
74 // will still insert base tag(s) to DOM, so the new added base tag(s) can | 74 // will still insert base tag(s) to DOM, so the new added base tag(s) can |
75 // override the incorrect base URL and make sure we alway load correct local | 75 // override the incorrect base URL and make sure we alway load correct local |
76 // saved resource files. | 76 // saved resource files. |
77 | 77 |
78 #include "config.h" | 78 #include "config.h" |
79 #include "WebPageSerializerImpl.h" | 79 #include "WebPageSerializerImpl.h" |
80 | 80 |
81 #include "DOMUtilitiesPrivate.h" | |
82 #include "HTMLNames.h" | 81 #include "HTMLNames.h" |
83 #include "WebFrameImpl.h" | 82 #include "WebFrameImpl.h" |
84 #include "core/dom/Document.h" | 83 #include "core/dom/Document.h" |
85 #include "core/dom/DocumentType.h" | 84 #include "core/dom/DocumentType.h" |
86 #include "core/dom/Element.h" | 85 #include "core/dom/Element.h" |
87 #include "core/editing/markup.h" | 86 #include "core/editing/markup.h" |
88 #include "core/html/HTMLAllCollection.h" | 87 #include "core/html/HTMLAllCollection.h" |
89 #include "core/html/HTMLElement.h" | 88 #include "core/html/HTMLElement.h" |
90 #include "core/html/HTMLFormElement.h" | 89 #include "core/html/HTMLFormElement.h" |
91 #include "core/html/HTMLHtmlElement.h" | 90 #include "core/html/HTMLHtmlElement.h" |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 // Add attribute pair | 309 // Add attribute pair |
311 const Attribute& attribute = element->attributeItem(i); | 310 const Attribute& attribute = element->attributeItem(i); |
312 result.append(attribute.name().toString()); | 311 result.append(attribute.name().toString()); |
313 result.appendLiteral("=\""); | 312 result.appendLiteral("=\""); |
314 if (!attribute.value().isEmpty()) { | 313 if (!attribute.value().isEmpty()) { |
315 const String& attrValue = attribute.value(); | 314 const String& attrValue = attribute.value(); |
316 | 315 |
317 // Check whether we need to replace some resource links | 316 // Check whether we need to replace some resource links |
318 // with local resource paths. | 317 // with local resource paths. |
319 const QualifiedName& attrName = attribute.name(); | 318 const QualifiedName& attrName = attribute.name(); |
320 if (elementHasLegalLinkAttribute(element, attrName)) { | 319 if (element->hasLegalLinkAttribute(attrName)) { |
321 // For links start with "javascript:", we do not change it. | 320 // For links start with "javascript:", we do not change it. |
322 if (attrValue.startsWith("javascript:", false)) | 321 if (attrValue.startsWith("javascript:", false)) |
323 result.append(attrValue); | 322 result.append(attrValue); |
324 else { | 323 else { |
325 // Get the absolute link | 324 // Get the absolute link |
326 WebFrameImpl* subFrame = WebFrameImpl::fromFrameOwnerEle
ment(element); | 325 WebFrameImpl* subFrame = WebFrameImpl::fromFrameOwnerEle
ment(element); |
327 String completeURL = subFrame ? subFrame->frame()->docum
ent()->url() : | 326 String completeURL = subFrame ? subFrame->frame()->docum
ent()->url() : |
328 param->document->complet
eURL(attrValue); | 327 param->document->complet
eURL(attrValue); |
329 // Check whether we have local files for those link. | 328 // Check whether we have local files for those link. |
330 if (m_localLinks.contains(completeURL)) { | 329 if (m_localLinks.contains(completeURL)) { |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
516 | 515 |
517 encodeAndFlushBuffer(WebPageSerializerClient::CurrentFrameIsFinished, &p
aram, ForceFlush); | 516 encodeAndFlushBuffer(WebPageSerializerClient::CurrentFrameIsFinished, &p
aram, ForceFlush); |
518 } | 517 } |
519 | 518 |
520 ASSERT(m_dataBuffer.isEmpty()); | 519 ASSERT(m_dataBuffer.isEmpty()); |
521 m_client->didSerializeDataForFrame(KURL(), WebCString("", 0), WebPageSeriali
zerClient::AllFramesAreFinished); | 520 m_client->didSerializeDataForFrame(KURL(), WebCString("", 0), WebPageSeriali
zerClient::AllFramesAreFinished); |
522 return didSerialization; | 521 return didSerialization; |
523 } | 522 } |
524 | 523 |
525 } // namespace blink | 524 } // namespace blink |
OLD | NEW |