| 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 #include "platform/loader/fetch/ResourceRequest.h" | 54 #include "platform/loader/fetch/ResourceRequest.h" |
| 55 #include "platform/loader/fetch/ResourceResponse.h" | 55 #include "platform/loader/fetch/ResourceResponse.h" |
| 56 #include "platform/mhtml/MHTMLArchive.h" | 56 #include "platform/mhtml/MHTMLArchive.h" |
| 57 #include "platform/mhtml/MHTMLParser.h" | 57 #include "platform/mhtml/MHTMLParser.h" |
| 58 #include "platform/weborigin/KURL.h" | 58 #include "platform/weborigin/KURL.h" |
| 59 #include "platform/wtf/Assertions.h" | 59 #include "platform/wtf/Assertions.h" |
| 60 #include "platform/wtf/Deque.h" | 60 #include "platform/wtf/Deque.h" |
| 61 #include "platform/wtf/HashMap.h" | 61 #include "platform/wtf/HashMap.h" |
| 62 #include "platform/wtf/HashSet.h" | 62 #include "platform/wtf/HashSet.h" |
| 63 #include "platform/wtf/Noncopyable.h" | 63 #include "platform/wtf/Noncopyable.h" |
| 64 #include "platform/wtf/PtrUtil.h" |
| 64 #include "platform/wtf/Vector.h" | 65 #include "platform/wtf/Vector.h" |
| 65 #include "platform/wtf/text/StringConcatenate.h" | 66 #include "platform/wtf/text/StringConcatenate.h" |
| 66 #include "public/platform/WebString.h" | 67 #include "public/platform/WebString.h" |
| 67 #include "public/platform/WebURL.h" | 68 #include "public/platform/WebURL.h" |
| 68 #include "public/platform/WebURLResponse.h" | 69 #include "public/platform/WebURLResponse.h" |
| 69 #include "public/platform/WebVector.h" | 70 #include "public/platform/WebVector.h" |
| 70 #include "public/web/WebDataSource.h" | 71 #include "public/web/WebDataSource.h" |
| 71 #include "public/web/WebDocument.h" | 72 #include "public/web/WebDocument.h" |
| 72 #include "public/web/WebFrame.h" | 73 #include "public/web/WebFrame.h" |
| 73 #include "public/web/WebFrameSerializerCacheControlPolicy.h" | 74 #include "public/web/WebFrameSerializerCacheControlPolicy.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 88 explicit MHTMLFrameSerializerDelegate( | 89 explicit MHTMLFrameSerializerDelegate( |
| 89 WebFrameSerializer::MHTMLPartsGenerationDelegate&); | 90 WebFrameSerializer::MHTMLPartsGenerationDelegate&); |
| 90 ~MHTMLFrameSerializerDelegate() override; | 91 ~MHTMLFrameSerializerDelegate() override; |
| 91 bool ShouldIgnoreElement(const Element&) override; | 92 bool ShouldIgnoreElement(const Element&) override; |
| 92 bool ShouldIgnoreAttribute(const Element&, const Attribute&) override; | 93 bool ShouldIgnoreAttribute(const Element&, const Attribute&) override; |
| 93 bool RewriteLink(const Element&, String& rewritten_link) override; | 94 bool RewriteLink(const Element&, String& rewritten_link) override; |
| 94 bool ShouldSkipResourceWithURL(const KURL&) override; | 95 bool ShouldSkipResourceWithURL(const KURL&) override; |
| 95 bool ShouldSkipResource( | 96 bool ShouldSkipResource( |
| 96 FrameSerializer::ResourceHasCacheControlNoStoreHeader) override; | 97 FrameSerializer::ResourceHasCacheControlNoStoreHeader) override; |
| 97 Vector<Attribute> GetCustomAttributes(const Element&) override; | 98 Vector<Attribute> GetCustomAttributes(const Element&) override; |
| 99 bool ShouldCollectProblemMetric() override; |
| 98 | 100 |
| 99 private: | 101 private: |
| 100 bool ShouldIgnoreHiddenElement(const Element&); | 102 bool ShouldIgnoreHiddenElement(const Element&); |
| 101 bool ShouldIgnoreMetaElement(const Element&); | 103 bool ShouldIgnoreMetaElement(const Element&); |
| 102 bool ShouldIgnorePopupOverlayElement(const Element&); | 104 bool ShouldIgnorePopupOverlayElement(const Element&); |
| 103 void GetCustomAttributesForImageElement(const HTMLImageElement&, | 105 void GetCustomAttributesForImageElement(const HTMLImageElement&, |
| 104 Vector<Attribute>*); | 106 Vector<Attribute>*); |
| 105 void GetCustomAttributesForFormControlElement(const Element&, | 107 void GetCustomAttributesForFormControlElement(const Element&, |
| 106 Vector<Attribute>*); | 108 Vector<Attribute>*); |
| 107 | 109 |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 if (isHTMLImageElement(element)) { | 275 if (isHTMLImageElement(element)) { |
| 274 GetCustomAttributesForImageElement(toHTMLImageElement(element), | 276 GetCustomAttributesForImageElement(toHTMLImageElement(element), |
| 275 &attributes); | 277 &attributes); |
| 276 } else if (element.IsFormControlElement()) { | 278 } else if (element.IsFormControlElement()) { |
| 277 GetCustomAttributesForFormControlElement(element, &attributes); | 279 GetCustomAttributesForFormControlElement(element, &attributes); |
| 278 } | 280 } |
| 279 | 281 |
| 280 return attributes; | 282 return attributes; |
| 281 } | 283 } |
| 282 | 284 |
| 285 bool MHTMLFrameSerializerDelegate::ShouldCollectProblemMetric() { |
| 286 return web_delegate_.UsePageProblemDetectors(); |
| 287 } |
| 288 |
| 283 void MHTMLFrameSerializerDelegate::GetCustomAttributesForImageElement( | 289 void MHTMLFrameSerializerDelegate::GetCustomAttributesForImageElement( |
| 284 const HTMLImageElement& element, | 290 const HTMLImageElement& element, |
| 285 Vector<Attribute>* attributes) { | 291 Vector<Attribute>* attributes) { |
| 286 // Currently only the value of src is pulled into the archive and the srcset | 292 // Currently only the value of src is pulled into the archive and the srcset |
| 287 // attribute is ignored (see shouldIgnoreAttribute() above). If the device | 293 // attribute is ignored (see shouldIgnoreAttribute() above). If the device |
| 288 // has a higher DPR, a different image from srcset could be loaded instead. | 294 // has a higher DPR, a different image from srcset could be loaded instead. |
| 289 // When this occurs, we should provide the rendering width and height for | 295 // When this occurs, we should provide the rendering width and height for |
| 290 // <img> element if not set. | 296 // <img> element if not set. |
| 291 | 297 |
| 292 // The image should be loaded and participate the layout. | 298 // The image should be loaded and participate the layout. |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 479 const WebString& base_target) { | 485 const WebString& base_target) { |
| 480 // TODO(yosin) We should call |FrameSerializer::baseTagDeclarationOf()|. | 486 // TODO(yosin) We should call |FrameSerializer::baseTagDeclarationOf()|. |
| 481 if (base_target.IsEmpty()) | 487 if (base_target.IsEmpty()) |
| 482 return String("<base href=\".\">"); | 488 return String("<base href=\".\">"); |
| 483 String base_string = "<base href=\".\" target=\"" + | 489 String base_string = "<base href=\".\" target=\"" + |
| 484 static_cast<const String&>(base_target) + "\">"; | 490 static_cast<const String&>(base_target) + "\">"; |
| 485 return base_string; | 491 return base_string; |
| 486 } | 492 } |
| 487 | 493 |
| 488 } // namespace blink | 494 } // namespace blink |
| OLD | NEW |