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

Side by Side Diff: third_party/WebKit/Source/core/html/HTMLElement.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 * Copyright (C) 2004-2008, 2013, 2014 Apple Inc. All rights reserved. 4 * Copyright (C) 2004-2008, 2013, 2014 Apple Inc. All rights reserved.
5 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 5 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
6 * Copyright (C) 2011 Motorola Mobility. All rights reserved. 6 * Copyright (C) 2011 Motorola Mobility. All rights reserved.
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 648 matching lines...) Expand 10 before | Expand all | Expand 10 after
659 { 659 {
660 setAttribute(translateAttr, enable ? "yes" : "no"); 660 setAttribute(translateAttr, enable ? "yes" : "no");
661 } 661 }
662 662
663 // Returns the conforming 'dir' value associated with the state the attribute is in (in its canonical case), if any, 663 // Returns the conforming 'dir' value associated with the state the attribute is in (in its canonical case), if any,
664 // or the empty string if the attribute is in a state that has no associated key word value or if the attribute is 664 // or the empty string if the attribute is in a state that has no associated key word value or if the attribute is
665 // not in a defined state (e.g. the attribute is missing and there is no missing value default). 665 // not in a defined state (e.g. the attribute is missing and there is no missing value default).
666 // http://www.whatwg.org/specs/web-apps/current-work/multipage/common-dom-interf aces.html#limited-to-only-known-values 666 // http://www.whatwg.org/specs/web-apps/current-work/multipage/common-dom-interf aces.html#limited-to-only-known-values
667 static inline const AtomicString& toValidDirValue(const AtomicString& value) 667 static inline const AtomicString& toValidDirValue(const AtomicString& value)
668 { 668 {
669 DEFINE_STATIC_LOCAL(const AtomicString, ltrValue, ("ltr", AtomicString::Cons tructFromLiteral)); 669 DEFINE_STATIC_LOCAL(const AtomicString, ltrValue, ("ltr"));
670 DEFINE_STATIC_LOCAL(const AtomicString, rtlValue, ("rtl", AtomicString::Cons tructFromLiteral)); 670 DEFINE_STATIC_LOCAL(const AtomicString, rtlValue, ("rtl"));
671 DEFINE_STATIC_LOCAL(const AtomicString, autoValue, ("auto", AtomicString::Co nstructFromLiteral)); 671 DEFINE_STATIC_LOCAL(const AtomicString, autoValue, ("auto"));
672 672
673 if (equalIgnoringCase(value, ltrValue)) 673 if (equalIgnoringCase(value, ltrValue))
674 return ltrValue; 674 return ltrValue;
675 if (equalIgnoringCase(value, rtlValue)) 675 if (equalIgnoringCase(value, rtlValue))
676 return rtlValue; 676 return rtlValue;
677 if (equalIgnoringCase(value, autoValue)) 677 if (equalIgnoringCase(value, autoValue))
678 return autoValue; 678 return autoValue;
679 return nullAtom; 679 return nullAtom;
680 } 680 }
681 681
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
1023 return; 1023 return;
1024 int charCode = event->charCode(); 1024 int charCode = event->charCode();
1025 if (charCode == '\r' || charCode == ' ') { 1025 if (charCode == '\r' || charCode == ' ') {
1026 dispatchSimulatedClick(event); 1026 dispatchSimulatedClick(event);
1027 event->setDefaultHandled(); 1027 event->setDefaultHandled();
1028 } 1028 }
1029 } 1029 }
1030 1030
1031 const AtomicString& HTMLElement::eventParameterName() 1031 const AtomicString& HTMLElement::eventParameterName()
1032 { 1032 {
1033 DEFINE_STATIC_LOCAL(const AtomicString, eventString, ("event", AtomicString: :ConstructFromLiteral)); 1033 DEFINE_STATIC_LOCAL(const AtomicString, eventString, ("event"));
1034 return eventString; 1034 return eventString;
1035 } 1035 }
1036 1036
1037 } // namespace blink 1037 } // namespace blink
1038 1038
1039 #ifndef NDEBUG 1039 #ifndef NDEBUG
1040 1040
1041 // For use in the debugger 1041 // For use in the debugger
1042 void dumpInnerHTML(blink::HTMLElement*); 1042 void dumpInnerHTML(blink::HTMLElement*);
1043 1043
1044 void dumpInnerHTML(blink::HTMLElement* element) 1044 void dumpInnerHTML(blink::HTMLElement* element)
1045 { 1045 {
1046 printf("%s\n", element->innerHTML().ascii().data()); 1046 printf("%s\n", element->innerHTML().ascii().data());
1047 } 1047 }
1048 #endif 1048 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698