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

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

Issue 1844223002: Literal AtomicString construction can rely on strlen optimization. (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) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. 5 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
6 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) 6 * (C) 2006 Alexey Proskuryakov (ap@nypop.com)
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after
449 ASSERT(isTextFormControl()); 449 ASSERT(isTextFormControl());
450 LocalFrame* frame = document().frame(); 450 LocalFrame* frame = document().frame();
451 if (!frame) 451 if (!frame)
452 return 0; 452 return 0;
453 453
454 return indexForPosition(innerEditorElement(), frame->selection().end()); 454 return indexForPosition(innerEditorElement(), frame->selection().end());
455 } 455 }
456 456
457 static const AtomicString& directionString(TextFieldSelectionDirection direction ) 457 static const AtomicString& directionString(TextFieldSelectionDirection direction )
458 { 458 {
459 DEFINE_STATIC_LOCAL(const AtomicString, none, ("none", AtomicString::Constru ctFromLiteral)); 459 DEFINE_STATIC_LOCAL(const AtomicString, none, ("none"));
460 DEFINE_STATIC_LOCAL(const AtomicString, forward, ("forward", AtomicString::C onstructFromLiteral)); 460 DEFINE_STATIC_LOCAL(const AtomicString, forward, ("forward"));
461 DEFINE_STATIC_LOCAL(const AtomicString, backward, ("backward", AtomicString: :ConstructFromLiteral)); 461 DEFINE_STATIC_LOCAL(const AtomicString, backward, ("backward"));
462 462
463 switch (direction) { 463 switch (direction) {
464 case SelectionHasNoDirection: 464 case SelectionHasNoDirection:
465 return none; 465 return none;
466 case SelectionHasForwardDirection: 466 case SelectionHasForwardDirection:
467 return forward; 467 return forward;
468 case SelectionHasBackwardDirection: 468 case SelectionHasBackwardDirection:
469 return backward; 469 return backward;
470 } 470 }
471 471
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
541 } 541 }
542 542
543 if (!startNode || !endNode) 543 if (!startNode || !endNode)
544 return nullptr; 544 return nullptr;
545 545
546 return Range::create(document(), startNode, start, endNode, end); 546 return Range::create(document(), startNode, start, endNode, end);
547 } 547 }
548 548
549 const AtomicString& HTMLTextFormControlElement::autocapitalize() const 549 const AtomicString& HTMLTextFormControlElement::autocapitalize() const
550 { 550 {
551 DEFINE_STATIC_LOCAL(const AtomicString, off, ("off", AtomicString::Construct FromLiteral)); 551 DEFINE_STATIC_LOCAL(const AtomicString, off, ("off"));
552 DEFINE_STATIC_LOCAL(const AtomicString, none, ("none", AtomicString::Constru ctFromLiteral)); 552 DEFINE_STATIC_LOCAL(const AtomicString, none, ("none"));
553 DEFINE_STATIC_LOCAL(const AtomicString, characters, ("characters", AtomicStr ing::ConstructFromLiteral)); 553 DEFINE_STATIC_LOCAL(const AtomicString, characters, ("characters"));
554 DEFINE_STATIC_LOCAL(const AtomicString, words, ("words", AtomicString::Const ructFromLiteral)); 554 DEFINE_STATIC_LOCAL(const AtomicString, words, ("words"));
555 DEFINE_STATIC_LOCAL(const AtomicString, sentences, ("sentences", AtomicStrin g::ConstructFromLiteral)); 555 DEFINE_STATIC_LOCAL(const AtomicString, sentences, ("sentences"));
556 556
557 const AtomicString& value = fastGetAttribute(autocapitalizeAttr); 557 const AtomicString& value = fastGetAttribute(autocapitalizeAttr);
558 if (equalIgnoringCase(value, none) || equalIgnoringCase(value, off)) 558 if (equalIgnoringCase(value, none) || equalIgnoringCase(value, off))
559 return none; 559 return none;
560 if (equalIgnoringCase(value, characters)) 560 if (equalIgnoringCase(value, characters))
561 return characters; 561 return characters;
562 if (equalIgnoringCase(value, words)) 562 if (equalIgnoringCase(value, words))
563 return words; 563 return words;
564 if (equalIgnoringCase(value, sentences)) 564 if (equalIgnoringCase(value, sentences))
565 return sentences; 565 return sentences;
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after
1028 } 1028 }
1029 1029
1030 void HTMLTextFormControlElement::copyNonAttributePropertiesFromElement(const Ele ment& source) 1030 void HTMLTextFormControlElement::copyNonAttributePropertiesFromElement(const Ele ment& source)
1031 { 1031 {
1032 const HTMLTextFormControlElement& sourceElement = static_cast<const HTMLText FormControlElement&>(source); 1032 const HTMLTextFormControlElement& sourceElement = static_cast<const HTMLText FormControlElement&>(source);
1033 m_lastChangeWasUserEdit = sourceElement.m_lastChangeWasUserEdit; 1033 m_lastChangeWasUserEdit = sourceElement.m_lastChangeWasUserEdit;
1034 HTMLFormControlElement::copyNonAttributePropertiesFromElement(source); 1034 HTMLFormControlElement::copyNonAttributePropertiesFromElement(source);
1035 } 1035 }
1036 1036
1037 } // namespace blink 1037 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698