Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(472)

Side by Side Diff: third_party/WebKit/Source/core/frame/FrameSerializer.cpp

Issue 1854543002: Oilpan: Remove WillBe types (part 7) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 if (isHTMLScriptElement(element)) 76 if (isHTMLScriptElement(element))
77 return true; 77 return true;
78 if (isHTMLNoScriptElement(element)) 78 if (isHTMLNoScriptElement(element))
79 return true; 79 return true;
80 return isHTMLMetaElement(element) && toHTMLMetaElement(element).computeEncod ing().isValid(); 80 return isHTMLMetaElement(element) && toHTMLMetaElement(element).computeEncod ing().isValid();
81 } 81 }
82 82
83 class SerializerMarkupAccumulator : public MarkupAccumulator { 83 class SerializerMarkupAccumulator : public MarkupAccumulator {
84 STACK_ALLOCATED(); 84 STACK_ALLOCATED();
85 public: 85 public:
86 SerializerMarkupAccumulator(FrameSerializer::Delegate&, const Document&, Wil lBeHeapVector<RawPtrWillBeMember<Node>>&); 86 SerializerMarkupAccumulator(FrameSerializer::Delegate&, const Document&, Hea pVector<Member<Node>>&);
87 ~SerializerMarkupAccumulator() override; 87 ~SerializerMarkupAccumulator() override;
88 88
89 protected: 89 protected:
90 void appendText(StringBuilder& out, Text&) override; 90 void appendText(StringBuilder& out, Text&) override;
91 bool shouldIgnoreAttribute(const Attribute&) override; 91 bool shouldIgnoreAttribute(const Attribute&) override;
92 void appendElement(StringBuilder& out, Element&, Namespaces*) override; 92 void appendElement(StringBuilder& out, Element&, Namespaces*) override;
93 void appendAttribute(StringBuilder& out, const Element&, const Attribute&, N amespaces*) override; 93 void appendAttribute(StringBuilder& out, const Element&, const Attribute&, N amespaces*) override;
94 void appendStartTag(Node&, Namespaces* = nullptr) override; 94 void appendStartTag(Node&, Namespaces* = nullptr) override;
95 void appendEndTag(const Element&) override; 95 void appendEndTag(const Element&) override;
96 96
97 private: 97 private:
98 void appendAttributeValue(StringBuilder& out, const String& attributeValue); 98 void appendAttributeValue(StringBuilder& out, const String& attributeValue);
99 void appendRewrittenAttribute( 99 void appendRewrittenAttribute(
100 StringBuilder& out, 100 StringBuilder& out,
101 const Element&, 101 const Element&,
102 const String& attributeName, 102 const String& attributeName,
103 const String& attributeValue); 103 const String& attributeValue);
104 104
105 FrameSerializer::Delegate& m_delegate; 105 FrameSerializer::Delegate& m_delegate;
106 RawPtrWillBeMember<const Document> m_document; 106 Member<const Document> m_document;
107 107
108 // FIXME: |FrameSerializer| uses |m_nodes| for collecting nodes in document 108 // FIXME: |FrameSerializer| uses |m_nodes| for collecting nodes in document
109 // included into serialized text then extracts image, object, etc. The size 109 // included into serialized text then extracts image, object, etc. The size
110 // of this vector isn't small for large document. It is better to use 110 // of this vector isn't small for large document. It is better to use
111 // callback like functionality. 111 // callback like functionality.
112 WillBeHeapVector<RawPtrWillBeMember<Node>>& m_nodes; 112 HeapVector<Member<Node>>& m_nodes;
113 113
114 // Elements with links rewritten via appendAttribute method. 114 // Elements with links rewritten via appendAttribute method.
115 WillBeHeapHashSet<RawPtrWillBeMember<const Element>> m_elementsWithRewritten Links; 115 HeapHashSet<Member<const Element>> m_elementsWithRewrittenLinks;
116 }; 116 };
117 117
118 SerializerMarkupAccumulator::SerializerMarkupAccumulator(FrameSerializer::Delega te& delegate, const Document& document, WillBeHeapVector<RawPtrWillBeMember<Node >>& nodes) 118 SerializerMarkupAccumulator::SerializerMarkupAccumulator(FrameSerializer::Delega te& delegate, const Document& document, HeapVector<Member<Node>>& nodes)
119 : MarkupAccumulator(ResolveAllURLs) 119 : MarkupAccumulator(ResolveAllURLs)
120 , m_delegate(delegate) 120 , m_delegate(delegate)
121 , m_document(&document) 121 , m_document(&document)
122 , m_nodes(nodes) 122 , m_nodes(nodes)
123 { 123 {
124 } 124 }
125 125
126 SerializerMarkupAccumulator::~SerializerMarkupAccumulator() 126 SerializerMarkupAccumulator::~SerializerMarkupAccumulator()
127 { 127 {
128 } 128 }
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 Document& document = *frame.document(); 253 Document& document = *frame.document();
254 KURL url = document.url(); 254 KURL url = document.url();
255 255
256 // If frame is an image document, add the image and don't continue 256 // If frame is an image document, add the image and don't continue
257 if (document.isImageDocument()) { 257 if (document.isImageDocument()) {
258 ImageDocument& imageDocument = toImageDocument(document); 258 ImageDocument& imageDocument = toImageDocument(document);
259 addImageToResources(imageDocument.cachedImage(), url); 259 addImageToResources(imageDocument.cachedImage(), url);
260 return; 260 return;
261 } 261 }
262 262
263 WillBeHeapVector<RawPtrWillBeMember<Node>> serializedNodes; 263 HeapVector<Member<Node>> serializedNodes;
264 SerializerMarkupAccumulator accumulator(m_delegate, document, serializedNode s); 264 SerializerMarkupAccumulator accumulator(m_delegate, document, serializedNode s);
265 String text = serializeNodes<EditingStrategy>(accumulator, document, Include Node); 265 String text = serializeNodes<EditingStrategy>(accumulator, document, Include Node);
266 266
267 CString frameHTML = document.encoding().encode(text, WTF::EntitiesForUnencod ables); 267 CString frameHTML = document.encoding().encode(text, WTF::EntitiesForUnencod ables);
268 m_resources->append(SerializedResource(url, document.suggestedMIMEType(), Sh aredBuffer::create(frameHTML.data(), frameHTML.length()))); 268 m_resources->append(SerializedResource(url, document.suggestedMIMEType(), Sh aredBuffer::create(frameHTML.data(), frameHTML.length())));
269 269
270 for (Node* node: serializedNodes) { 270 for (Node* node: serializedNodes) {
271 ASSERT(node); 271 ASSERT(node);
272 if (!node->isElementNode()) 272 if (!node->isElementNode())
273 continue; 273 continue;
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 void FrameSerializer::retrieveResourcesForProperties(const StylePropertySet* sty leDeclaration, Document& document) 423 void FrameSerializer::retrieveResourcesForProperties(const StylePropertySet* sty leDeclaration, Document& document)
424 { 424 {
425 if (!styleDeclaration) 425 if (!styleDeclaration)
426 return; 426 return;
427 427
428 // The background-image and list-style-image (for ul or ol) are the CSS prop erties 428 // The background-image and list-style-image (for ul or ol) are the CSS prop erties
429 // that make use of images. We iterate to make sure we include any other 429 // that make use of images. We iterate to make sure we include any other
430 // image properties there might be. 430 // image properties there might be.
431 unsigned propertyCount = styleDeclaration->propertyCount(); 431 unsigned propertyCount = styleDeclaration->propertyCount();
432 for (unsigned i = 0; i < propertyCount; ++i) { 432 for (unsigned i = 0; i < propertyCount; ++i) {
433 RefPtrWillBeRawPtr<CSSValue> cssValue = styleDeclaration->propertyAt(i). value(); 433 RawPtr<CSSValue> cssValue = styleDeclaration->propertyAt(i).value();
434 retrieveResourcesForCSSValue(cssValue.get(), document); 434 retrieveResourcesForCSSValue(cssValue.get(), document);
435 } 435 }
436 } 436 }
437 437
438 void FrameSerializer::retrieveResourcesForCSSValue(CSSValue* cssValue, Document& document) 438 void FrameSerializer::retrieveResourcesForCSSValue(CSSValue* cssValue, Document& document)
439 { 439 {
440 if (cssValue->isImageValue()) { 440 if (cssValue->isImageValue()) {
441 CSSImageValue* imageValue = toCSSImageValue(cssValue); 441 CSSImageValue* imageValue = toCSSImageValue(cssValue);
442 if (imageValue->isCachePending()) 442 if (imageValue->isCachePending())
443 return; 443 return;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 continue; 476 continue;
477 } 477 }
478 emitsMinus = ch == '-'; 478 emitsMinus = ch == '-';
479 builder.append(ch); 479 builder.append(ch);
480 } 480 }
481 CString escapedUrl = builder.toString().ascii(); 481 CString escapedUrl = builder.toString().ascii();
482 return String::format("saved from url=(%04d)%s", static_cast<int>(escapedUrl .length()), escapedUrl.data()); 482 return String::format("saved from url=(%04d)%s", static_cast<int>(escapedUrl .length()), escapedUrl.data());
483 } 483 }
484 484
485 } // namespace blink 485 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/frame/FrameOwner.h ('k') | third_party/WebKit/Source/core/frame/FrameView.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698