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

Side by Side Diff: Source/core/html/forms/FormController.cpp

Issue 482753002: Use StringBuilder::appendLiteral() / StringBuilder::append(char) when possible (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/html/forms/EmailInputType.cpp ('k') | Source/core/html/forms/ImageInputType.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2008, 2009, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2008, 2009, 2010 Apple Inc. All rights reserved.
3 * Copyright (C) 2010, 2011, 2012 Google Inc. All rights reserved. 3 * Copyright (C) 2010, 2011, 2012 Google Inc. All rights reserved.
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 typedef HashMap<String, unsigned> FormSignatureToNextIndexMap; 310 typedef HashMap<String, unsigned> FormSignatureToNextIndexMap;
311 FormToKeyMap m_formToKeyMap; 311 FormToKeyMap m_formToKeyMap;
312 FormSignatureToNextIndexMap m_formSignatureToNextIndexMap; 312 FormSignatureToNextIndexMap m_formSignatureToNextIndexMap;
313 }; 313 };
314 314
315 static inline void recordFormStructure(const HTMLFormElement& form, StringBuilde r& builder) 315 static inline void recordFormStructure(const HTMLFormElement& form, StringBuilde r& builder)
316 { 316 {
317 // 2 is enough to distinguish forms in webkit.org/b/91209#c0 317 // 2 is enough to distinguish forms in webkit.org/b/91209#c0
318 const size_t namedControlsToBeRecorded = 2; 318 const size_t namedControlsToBeRecorded = 2;
319 const FormAssociatedElement::List& controls = form.associatedElements(); 319 const FormAssociatedElement::List& controls = form.associatedElements();
320 builder.append(" ["); 320 builder.appendLiteral(" [");
321 for (size_t i = 0, namedControls = 0; i < controls.size() && namedControls < namedControlsToBeRecorded; ++i) { 321 for (size_t i = 0, namedControls = 0; i < controls.size() && namedControls < namedControlsToBeRecorded; ++i) {
322 if (!controls[i]->isFormControlElementWithState()) 322 if (!controls[i]->isFormControlElementWithState())
323 continue; 323 continue;
324 HTMLFormControlElementWithState* control = toHTMLFormControlElementWithS tate(controls[i]); 324 HTMLFormControlElementWithState* control = toHTMLFormControlElementWithS tate(controls[i]);
325 if (!ownerFormForState(*control)) 325 if (!ownerFormForState(*control))
326 continue; 326 continue;
327 AtomicString name = control->name(); 327 AtomicString name = control->name();
328 if (name.isEmpty()) 328 if (name.isEmpty())
329 continue; 329 continue;
330 namedControls++; 330 namedControls++;
331 builder.append(name); 331 builder.append(name);
332 builder.append(" "); 332 builder.append(' ');
333 } 333 }
334 builder.append("]"); 334 builder.append(']');
335 } 335 }
336 336
337 static inline String formSignature(const HTMLFormElement& form) 337 static inline String formSignature(const HTMLFormElement& form)
338 { 338 {
339 KURL actionURL = form.getURLAttribute(actionAttr); 339 KURL actionURL = form.getURLAttribute(actionAttr);
340 // Remove the query part because it might contain volatile parameters such 340 // Remove the query part because it might contain volatile parameters such
341 // as a session key. 341 // as a session key.
342 if (!actionURL.isEmpty()) 342 if (!actionURL.isEmpty())
343 actionURL.setQuery(String()); 343 actionURL.setQuery(String());
344 344
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
560 { 560 {
561 m_documentState->addControl(&control); 561 m_documentState->addControl(&control);
562 } 562 }
563 563
564 void FormController::unregisterStatefulFormControl(HTMLFormControlElementWithSta te& control) 564 void FormController::unregisterStatefulFormControl(HTMLFormControlElementWithSta te& control)
565 { 565 {
566 m_documentState->removeControl(&control); 566 m_documentState->removeControl(&control);
567 } 567 }
568 568
569 } // namespace blink 569 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/html/forms/EmailInputType.cpp ('k') | Source/core/html/forms/ImageInputType.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698