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

Side by Side Diff: third_party/WebKit/Source/core/html/parser/TextDocumentParser.cpp

Issue 2583233002: Migrate WTF::Vector::append() to ::push_back() [part 7 of N] (Closed)
Patch Set: Created 4 years 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) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 HTMLDocumentParser::appendBytes(data, length); 45 HTMLDocumentParser::appendBytes(data, length);
46 } 46 }
47 47
48 void TextDocumentParser::insertFakePreElement() { 48 void TextDocumentParser::insertFakePreElement() {
49 // In principle, we should create a specialized tree builder for 49 // In principle, we should create a specialized tree builder for
50 // TextDocuments, but instead we re-use the existing HTMLTreeBuilder. We 50 // TextDocuments, but instead we re-use the existing HTMLTreeBuilder. We
51 // create a fake token and give it to the tree builder rather than sending 51 // create a fake token and give it to the tree builder rather than sending
52 // fake bytes through the front-end of the parser to avoid distrubing the 52 // fake bytes through the front-end of the parser to avoid distrubing the
53 // line/column number calculations. 53 // line/column number calculations.
54 Vector<Attribute> attributes; 54 Vector<Attribute> attributes;
55 attributes.append( 55 attributes.push_back(
56 Attribute(styleAttr, "word-wrap: break-word; white-space: pre-wrap;")); 56 Attribute(styleAttr, "word-wrap: break-word; white-space: pre-wrap;"));
57 AtomicHTMLToken fakePre(HTMLToken::StartTag, preTag.localName(), attributes); 57 AtomicHTMLToken fakePre(HTMLToken::StartTag, preTag.localName(), attributes);
58 treeBuilder()->constructTree(&fakePre); 58 treeBuilder()->constructTree(&fakePre);
59 59
60 // The document could have been detached by an extension while the 60 // The document could have been detached by an extension while the
61 // tree was being constructed. 61 // tree was being constructed.
62 if (isStopped()) 62 if (isStopped())
63 return; 63 return;
64 64
65 // Normally we would skip the first \n after a <pre> element, but we don't 65 // Normally we would skip the first \n after a <pre> element, but we don't
66 // want to skip the first \n for text documents! 66 // want to skip the first \n for text documents!
67 treeBuilder()->setShouldSkipLeadingNewline(false); 67 treeBuilder()->setShouldSkipLeadingNewline(false);
68 68
69 // Although Text Documents expose a "pre" element in their DOM, they 69 // Although Text Documents expose a "pre" element in their DOM, they
70 // act like a <plaintext> tag, so we have to force plaintext mode. 70 // act like a <plaintext> tag, so we have to force plaintext mode.
71 forcePlaintextForTextDocument(); 71 forcePlaintextForTextDocument();
72 72
73 m_haveInsertedFakePreElement = true; 73 m_haveInsertedFakePreElement = true;
74 } 74 }
75 75
76 } // namespace blink 76 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698