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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 private: | 89 private: |
90 WebFrameSerializer::MHTMLPartsGenerationDelegate& m_webDelegate; | 90 WebFrameSerializer::MHTMLPartsGenerationDelegate& m_webDelegate; |
91 }; | 91 }; |
92 | 92 |
93 MHTMLFrameSerializerDelegate::MHTMLFrameSerializerDelegate( | 93 MHTMLFrameSerializerDelegate::MHTMLFrameSerializerDelegate( |
94 WebFrameSerializer::MHTMLPartsGenerationDelegate& webDelegate) | 94 WebFrameSerializer::MHTMLPartsGenerationDelegate& webDelegate) |
95 : m_webDelegate(webDelegate) {} | 95 : m_webDelegate(webDelegate) {} |
96 | 96 |
97 bool MHTMLFrameSerializerDelegate::shouldIgnoreAttribute( | 97 bool MHTMLFrameSerializerDelegate::shouldIgnoreAttribute( |
98 const Attribute& attribute) { | 98 const Attribute& attribute) { |
99 // TODO(fgorski): Presence of srcset attribute causes MHTML to not display ima
ges, as only the value of src | 99 // TODO(fgorski): Presence of srcset attribute causes MHTML to not display |
100 // is pulled into the archive. Discarding srcset prevents the problem. Long te
rm we should make sure to MHTML | 100 // images, as only the value of src is pulled into the archive. Discarding |
101 // plays nicely with srcset. | 101 // srcset prevents the problem. Long term we should make sure to MHTML plays |
| 102 // nicely with srcset. |
102 return attribute.localName() == HTMLNames::srcsetAttr; | 103 return attribute.localName() == HTMLNames::srcsetAttr; |
103 } | 104 } |
104 | 105 |
105 bool MHTMLFrameSerializerDelegate::rewriteLink(const Element& element, | 106 bool MHTMLFrameSerializerDelegate::rewriteLink(const Element& element, |
106 String& rewrittenLink) { | 107 String& rewrittenLink) { |
107 if (!element.isFrameOwnerElement()) | 108 if (!element.isFrameOwnerElement()) |
108 return false; | 109 return false; |
109 | 110 |
110 auto* frameOwnerElement = toHTMLFrameOwnerElement(&element); | 111 auto* frameOwnerElement = toHTMLFrameOwnerElement(&element); |
111 Frame* frame = frameOwnerElement->contentFrame(); | 112 Frame* frame = frameOwnerElement->contentFrame(); |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 const WebString& baseTarget) { | 306 const WebString& baseTarget) { |
306 // TODO(yosin) We should call |FrameSerializer::baseTagDeclarationOf()|. | 307 // TODO(yosin) We should call |FrameSerializer::baseTagDeclarationOf()|. |
307 if (baseTarget.isEmpty()) | 308 if (baseTarget.isEmpty()) |
308 return String("<base href=\".\">"); | 309 return String("<base href=\".\">"); |
309 String baseString = "<base href=\".\" target=\"" + | 310 String baseString = "<base href=\".\" target=\"" + |
310 static_cast<const String&>(baseTarget) + "\">"; | 311 static_cast<const String&>(baseTarget) + "\">"; |
311 return baseString; | 312 return baseString; |
312 } | 313 } |
313 | 314 |
314 } // namespace blink | 315 } // namespace blink |
OLD | NEW |