| 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 class ImageResource; | 51 class ImageResource; |
| 52 class LocalFrame; | 52 class LocalFrame; |
| 53 class Node; | 53 class Node; |
| 54 class LayoutObject; | 54 class LayoutObject; |
| 55 class Resource; | 55 class Resource; |
| 56 class SharedBuffer; | 56 class SharedBuffer; |
| 57 class StylePropertySet; | 57 class StylePropertySet; |
| 58 | 58 |
| 59 struct SerializedResource; | 59 struct SerializedResource; |
| 60 | 60 |
| 61 // This class is used to serialize frame's contents back to text (typically HTML
). | 61 // This class is used to serialize frame's contents back to text (typically |
| 62 // It serializes frame's document and resources such as images and CSS styleshee
ts. | 62 // HTML). It serializes frame's document and resources such as images and CSS |
| 63 // stylesheets. |
| 63 class CORE_EXPORT FrameSerializer final { | 64 class CORE_EXPORT FrameSerializer final { |
| 64 STACK_ALLOCATED(); | 65 STACK_ALLOCATED(); |
| 65 | 66 |
| 66 public: | 67 public: |
| 67 class Delegate { | 68 class Delegate { |
| 68 public: | 69 public: |
| 69 // Controls whether HTML serialization should skip the given attribute. | 70 // Controls whether HTML serialization should skip the given attribute. |
| 70 virtual bool shouldIgnoreAttribute(const Attribute&) { return false; } | 71 virtual bool shouldIgnoreAttribute(const Attribute&) { return false; } |
| 71 | 72 |
| 72 // Method allowing the Delegate control which URLs are written into the | 73 // Method allowing the Delegate control which URLs are written into the |
| (...skipping 25 matching lines...) Expand all Loading... |
| 98 | 99 |
| 99 // Initiates the serialization of the frame. All serialized content and | 100 // Initiates the serialization of the frame. All serialized content and |
| 100 // retrieved resources are added to the Vector passed to the constructor. | 101 // retrieved resources are added to the Vector passed to the constructor. |
| 101 // The first resource in that vector is the frame's serialized content. | 102 // The first resource in that vector is the frame's serialized content. |
| 102 // Subsequent resources are images, css, etc. | 103 // Subsequent resources are images, css, etc. |
| 103 void serializeFrame(const LocalFrame&); | 104 void serializeFrame(const LocalFrame&); |
| 104 | 105 |
| 105 static String markOfTheWebDeclaration(const KURL&); | 106 static String markOfTheWebDeclaration(const KURL&); |
| 106 | 107 |
| 107 private: | 108 private: |
| 108 // Serializes the stylesheet back to text and adds it to the resources if URL
is not-empty. | 109 // Serializes the stylesheet back to text and adds it to the resources if URL |
| 109 // It also adds any resources included in that stylesheet (including any impor
ted stylesheets and their own resources). | 110 // is not-empty. It also adds any resources included in that stylesheet |
| 111 // (including any imported stylesheets and their own resources). |
| 110 void serializeCSSStyleSheet(CSSStyleSheet&, const KURL&); | 112 void serializeCSSStyleSheet(CSSStyleSheet&, const KURL&); |
| 111 | 113 |
| 112 // Serializes the css rule (including any imported stylesheets), adding refere
nced resources. | 114 // Serializes the css rule (including any imported stylesheets), adding |
| 115 // referenced resources. |
| 113 void serializeCSSRule(CSSRule*); | 116 void serializeCSSRule(CSSRule*); |
| 114 | 117 |
| 115 bool shouldAddURL(const KURL&); | 118 bool shouldAddURL(const KURL&); |
| 116 | 119 |
| 117 void addToResources(const Resource&, | 120 void addToResources(const Resource&, |
| 118 PassRefPtr<const SharedBuffer>, | 121 PassRefPtr<const SharedBuffer>, |
| 119 const KURL&); | 122 const KURL&); |
| 120 void addImageToResources(ImageResource*, const KURL&); | 123 void addImageToResources(ImageResource*, const KURL&); |
| 121 void addFontToResources(FontResource*); | 124 void addFontToResources(FontResource*); |
| 122 | 125 |
| 123 void retrieveResourcesForProperties(const StylePropertySet*, Document&); | 126 void retrieveResourcesForProperties(const StylePropertySet*, Document&); |
| 124 void retrieveResourcesForCSSValue(const CSSValue&, Document&); | 127 void retrieveResourcesForCSSValue(const CSSValue&, Document&); |
| 125 | 128 |
| 126 Vector<SerializedResource>* m_resources; | 129 Vector<SerializedResource>* m_resources; |
| 127 HashSet<KURL> m_resourceURLs; | 130 HashSet<KURL> m_resourceURLs; |
| 128 | 131 |
| 129 bool m_isSerializingCss; | 132 bool m_isSerializingCss; |
| 130 | 133 |
| 131 Delegate& m_delegate; | 134 Delegate& m_delegate; |
| 132 }; | 135 }; |
| 133 | 136 |
| 134 } // namespace blink | 137 } // namespace blink |
| 135 | 138 |
| 136 #endif // FrameSerializer_h | 139 #endif // FrameSerializer_h |
| OLD | NEW |