Title: [125697] trunk/Source/WebCore
Revision
125697
Author
[email protected]
Date
2012-08-15 12:38:35 -0700 (Wed, 15 Aug 2012)

Log Message

Use literal initialization for CSS's pseudo types
https://bugs.webkit.org/show_bug.cgi?id=94066

Patch by Benjamin Poulain <[email protected]> on 2012-08-15
Reviewed by Kenneth Rohde Christiansen.

Initialize CSS pseudo type strings with the new initialization from literal.

The first invocation of nameToPseudoTypeMap() becomes 20% faster and we use
less memory to store the strings.

* css/CSSSelector.cpp:
(WebCore::nameToPseudoTypeMap):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (125696 => 125697)


--- trunk/Source/WebCore/ChangeLog	2012-08-15 19:36:46 UTC (rev 125696)
+++ trunk/Source/WebCore/ChangeLog	2012-08-15 19:38:35 UTC (rev 125697)
@@ -1,3 +1,18 @@
+2012-08-15  Benjamin Poulain  <[email protected]>
+
+        Use literal initialization for CSS's pseudo types
+        https://bugs.webkit.org/show_bug.cgi?id=94066
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        Initialize CSS pseudo type strings with the new initialization from literal.
+
+        The first invocation of nameToPseudoTypeMap() becomes 20% faster and we use
+        less memory to store the strings.
+
+        * css/CSSSelector.cpp:
+        (WebCore::nameToPseudoTypeMap):
+
 2012-08-15  Brady Eidson  <[email protected]>
 
         Removing a plug-in element from a page opened in a background tab in Safari crashes

Modified: trunk/Source/WebCore/css/CSSSelector.cpp (125696 => 125697)


--- trunk/Source/WebCore/css/CSSSelector.cpp	2012-08-15 19:36:46 UTC (rev 125696)
+++ trunk/Source/WebCore/css/CSSSelector.cpp	2012-08-15 19:38:35 UTC (rev 125697)
@@ -217,79 +217,79 @@
 
 static HashMap<AtomicStringImpl*, CSSSelector::PseudoType>* nameToPseudoTypeMap()
 {
-    DEFINE_STATIC_LOCAL(AtomicString, active, ("active"));
-    DEFINE_STATIC_LOCAL(AtomicString, after, ("after"));
-    DEFINE_STATIC_LOCAL(AtomicString, any, ("-webkit-any("));
-    DEFINE_STATIC_LOCAL(AtomicString, anyLink, ("-webkit-any-link"));
-    DEFINE_STATIC_LOCAL(AtomicString, autofill, ("-webkit-autofill"));
-    DEFINE_STATIC_LOCAL(AtomicString, before, ("before"));
-    DEFINE_STATIC_LOCAL(AtomicString, checked, ("checked"));
-    DEFINE_STATIC_LOCAL(AtomicString, defaultString, ("default"));
-    DEFINE_STATIC_LOCAL(AtomicString, disabled, ("disabled"));
-    DEFINE_STATIC_LOCAL(AtomicString, readOnly, ("read-only"));
-    DEFINE_STATIC_LOCAL(AtomicString, readWrite, ("read-write"));
-    DEFINE_STATIC_LOCAL(AtomicString, valid, ("valid"));
-    DEFINE_STATIC_LOCAL(AtomicString, invalid, ("invalid"));
-    DEFINE_STATIC_LOCAL(AtomicString, drag, ("-webkit-drag"));
-    DEFINE_STATIC_LOCAL(AtomicString, dragAlias, ("-khtml-drag")); // was documented with this name in Apple documentation, so keep an alia
-    DEFINE_STATIC_LOCAL(AtomicString, empty, ("empty"));
-    DEFINE_STATIC_LOCAL(AtomicString, enabled, ("enabled"));
-    DEFINE_STATIC_LOCAL(AtomicString, firstChild, ("first-child"));
-    DEFINE_STATIC_LOCAL(AtomicString, firstLetter, ("first-letter"));
-    DEFINE_STATIC_LOCAL(AtomicString, firstLine, ("first-line"));
-    DEFINE_STATIC_LOCAL(AtomicString, firstOfType, ("first-of-type"));
-    DEFINE_STATIC_LOCAL(AtomicString, fullPageMedia, ("-webkit-full-page-media"));
-    DEFINE_STATIC_LOCAL(AtomicString, nthChild, ("nth-child("));
-    DEFINE_STATIC_LOCAL(AtomicString, nthOfType, ("nth-of-type("));
-    DEFINE_STATIC_LOCAL(AtomicString, nthLastChild, ("nth-last-child("));
-    DEFINE_STATIC_LOCAL(AtomicString, nthLastOfType, ("nth-last-of-type("));
-    DEFINE_STATIC_LOCAL(AtomicString, focus, ("focus"));
-    DEFINE_STATIC_LOCAL(AtomicString, hover, ("hover"));
-    DEFINE_STATIC_LOCAL(AtomicString, indeterminate, ("indeterminate"));
-    DEFINE_STATIC_LOCAL(AtomicString, lastChild, ("last-child"));
-    DEFINE_STATIC_LOCAL(AtomicString, lastOfType, ("last-of-type"));
-    DEFINE_STATIC_LOCAL(AtomicString, link, ("link"));
-    DEFINE_STATIC_LOCAL(AtomicString, lang, ("lang("));
-    DEFINE_STATIC_LOCAL(AtomicString, notStr, ("not("));
-    DEFINE_STATIC_LOCAL(AtomicString, onlyChild, ("only-child"));
-    DEFINE_STATIC_LOCAL(AtomicString, onlyOfType, ("only-of-type"));
-    DEFINE_STATIC_LOCAL(AtomicString, optional, ("optional"));
-    DEFINE_STATIC_LOCAL(AtomicString, required, ("required"));
-    DEFINE_STATIC_LOCAL(AtomicString, resizer, ("-webkit-resizer"));
-    DEFINE_STATIC_LOCAL(AtomicString, root, ("root"));
-    DEFINE_STATIC_LOCAL(AtomicString, scrollbar, ("-webkit-scrollbar"));
-    DEFINE_STATIC_LOCAL(AtomicString, scrollbarButton, ("-webkit-scrollbar-button"));
-    DEFINE_STATIC_LOCAL(AtomicString, scrollbarCorner, ("-webkit-scrollbar-corner"));
-    DEFINE_STATIC_LOCAL(AtomicString, scrollbarThumb, ("-webkit-scrollbar-thumb"));
-    DEFINE_STATIC_LOCAL(AtomicString, scrollbarTrack, ("-webkit-scrollbar-track"));
-    DEFINE_STATIC_LOCAL(AtomicString, scrollbarTrackPiece, ("-webkit-scrollbar-track-piece"));
-    DEFINE_STATIC_LOCAL(AtomicString, selection, ("selection"));
-    DEFINE_STATIC_LOCAL(AtomicString, scope, ("scope"));
-    DEFINE_STATIC_LOCAL(AtomicString, target, ("target"));
-    DEFINE_STATIC_LOCAL(AtomicString, visited, ("visited"));
-    DEFINE_STATIC_LOCAL(AtomicString, windowInactive, ("window-inactive"));
-    DEFINE_STATIC_LOCAL(AtomicString, decrement, ("decrement"));
-    DEFINE_STATIC_LOCAL(AtomicString, increment, ("increment"));
-    DEFINE_STATIC_LOCAL(AtomicString, start, ("start"));
-    DEFINE_STATIC_LOCAL(AtomicString, end, ("end"));
-    DEFINE_STATIC_LOCAL(AtomicString, horizontal, ("horizontal"));
-    DEFINE_STATIC_LOCAL(AtomicString, vertical, ("vertical"));
-    DEFINE_STATIC_LOCAL(AtomicString, doubleButton, ("double-button"));
-    DEFINE_STATIC_LOCAL(AtomicString, singleButton, ("single-button"));
-    DEFINE_STATIC_LOCAL(AtomicString, noButton, ("no-button"));
-    DEFINE_STATIC_LOCAL(AtomicString, cornerPresent, ("corner-present"));
+    DEFINE_STATIC_LOCAL(AtomicString, active, ("active", AtomicString::ConstructFromLiteral));
+    DEFINE_STATIC_LOCAL(AtomicString, after, ("after", AtomicString::ConstructFromLiteral));
+    DEFINE_STATIC_LOCAL(AtomicString, any, ("-webkit-any(", AtomicString::ConstructFromLiteral));
+    DEFINE_STATIC_LOCAL(AtomicString, anyLink, ("-webkit-any-link", AtomicString::ConstructFromLiteral));
+    DEFINE_STATIC_LOCAL(AtomicString, autofill, ("-webkit-autofill", AtomicString::ConstructFromLiteral));
+    DEFINE_STATIC_LOCAL(AtomicString, before, ("before", AtomicString::ConstructFromLiteral));
+    DEFINE_STATIC_LOCAL(AtomicString, checked, ("checked", AtomicString::ConstructFromLiteral));
+    DEFINE_STATIC_LOCAL(AtomicString, defaultString, ("default", AtomicString::ConstructFromLiteral));
+    DEFINE_STATIC_LOCAL(AtomicString, disabled, ("disabled", AtomicString::ConstructFromLiteral));
+    DEFINE_STATIC_LOCAL(AtomicString, readOnly, ("read-only", AtomicString::ConstructFromLiteral));
+    DEFINE_STATIC_LOCAL(AtomicString, readWrite, ("read-write", AtomicString::ConstructFromLiteral));
+    DEFINE_STATIC_LOCAL(AtomicString, valid, ("valid", AtomicString::ConstructFromLiteral));
+    DEFINE_STATIC_LOCAL(AtomicString, invalid, ("invalid", AtomicString::ConstructFromLiteral));
+    DEFINE_STATIC_LOCAL(AtomicString, drag, ("-webkit-drag", AtomicString::ConstructFromLiteral));
+    DEFINE_STATIC_LOCAL(AtomicString, dragAlias, ("-khtml-drag", AtomicString::ConstructFromLiteral)); // was documented with this name in Apple documentation, so keep an alia
+    DEFINE_STATIC_LOCAL(AtomicString, empty, ("empty", AtomicString::ConstructFromLiteral));
+    DEFINE_STATIC_LOCAL(AtomicString, enabled, ("enabled", AtomicString::ConstructFromLiteral));
+    DEFINE_STATIC_LOCAL(AtomicString, firstChild, ("first-child", AtomicString::ConstructFromLiteral));
+    DEFINE_STATIC_LOCAL(AtomicString, firstLetter, ("first-letter", AtomicString::ConstructFromLiteral));
+    DEFINE_STATIC_LOCAL(AtomicString, firstLine, ("first-line", AtomicString::ConstructFromLiteral));
+    DEFINE_STATIC_LOCAL(AtomicString, firstOfType, ("first-of-type", AtomicString::ConstructFromLiteral));
+    DEFINE_STATIC_LOCAL(AtomicString, fullPageMedia, ("-webkit-full-page-media", AtomicString::ConstructFromLiteral));
+    DEFINE_STATIC_LOCAL(AtomicString, nthChild, ("nth-child(", AtomicString::ConstructFromLiteral));
+    DEFINE_STATIC_LOCAL(AtomicString, nthOfType, ("nth-of-type(", AtomicString::ConstructFromLiteral));
+    DEFINE_STATIC_LOCAL(AtomicString, nthLastChild, ("nth-last-child(", AtomicString::ConstructFromLiteral));
+    DEFINE_STATIC_LOCAL(AtomicString, nthLastOfType, ("nth-last-of-type(", AtomicString::ConstructFromLiteral));
+    DEFINE_STATIC_LOCAL(AtomicString, focus, ("focus", AtomicString::ConstructFromLiteral));
+    DEFINE_STATIC_LOCAL(AtomicString, hover, ("hover", AtomicString::ConstructFromLiteral));
+    DEFINE_STATIC_LOCAL(AtomicString, indeterminate, ("indeterminate", AtomicString::ConstructFromLiteral));
+    DEFINE_STATIC_LOCAL(AtomicString, lastChild, ("last-child", AtomicString::ConstructFromLiteral));
+    DEFINE_STATIC_LOCAL(AtomicString, lastOfType, ("last-of-type", AtomicString::ConstructFromLiteral));
+    DEFINE_STATIC_LOCAL(AtomicString, link, ("link", AtomicString::ConstructFromLiteral));
+    DEFINE_STATIC_LOCAL(AtomicString, lang, ("lang(", AtomicString::ConstructFromLiteral));
+    DEFINE_STATIC_LOCAL(AtomicString, notStr, ("not(", AtomicString::ConstructFromLiteral));
+    DEFINE_STATIC_LOCAL(AtomicString, onlyChild, ("only-child", AtomicString::ConstructFromLiteral));
+    DEFINE_STATIC_LOCAL(AtomicString, onlyOfType, ("only-of-type", AtomicString::ConstructFromLiteral));
+    DEFINE_STATIC_LOCAL(AtomicString, optional, ("optional", AtomicString::ConstructFromLiteral));
+    DEFINE_STATIC_LOCAL(AtomicString, required, ("required", AtomicString::ConstructFromLiteral));
+    DEFINE_STATIC_LOCAL(AtomicString, resizer, ("-webkit-resizer", AtomicString::ConstructFromLiteral));
+    DEFINE_STATIC_LOCAL(AtomicString, root, ("root", AtomicString::ConstructFromLiteral));
+    DEFINE_STATIC_LOCAL(AtomicString, scrollbar, ("-webkit-scrollbar", AtomicString::ConstructFromLiteral));
+    DEFINE_STATIC_LOCAL(AtomicString, scrollbarButton, ("-webkit-scrollbar-button", AtomicString::ConstructFromLiteral));
+    DEFINE_STATIC_LOCAL(AtomicString, scrollbarCorner, ("-webkit-scrollbar-corner", AtomicString::ConstructFromLiteral));
+    DEFINE_STATIC_LOCAL(AtomicString, scrollbarThumb, ("-webkit-scrollbar-thumb", AtomicString::ConstructFromLiteral));
+    DEFINE_STATIC_LOCAL(AtomicString, scrollbarTrack, ("-webkit-scrollbar-track", AtomicString::ConstructFromLiteral));
+    DEFINE_STATIC_LOCAL(AtomicString, scrollbarTrackPiece, ("-webkit-scrollbar-track-piece", AtomicString::ConstructFromLiteral));
+    DEFINE_STATIC_LOCAL(AtomicString, selection, ("selection", AtomicString::ConstructFromLiteral));
+    DEFINE_STATIC_LOCAL(AtomicString, scope, ("scope", AtomicString::ConstructFromLiteral));
+    DEFINE_STATIC_LOCAL(AtomicString, target, ("target", AtomicString::ConstructFromLiteral));
+    DEFINE_STATIC_LOCAL(AtomicString, visited, ("visited", AtomicString::ConstructFromLiteral));
+    DEFINE_STATIC_LOCAL(AtomicString, windowInactive, ("window-inactive", AtomicString::ConstructFromLiteral));
+    DEFINE_STATIC_LOCAL(AtomicString, decrement, ("decrement", AtomicString::ConstructFromLiteral));
+    DEFINE_STATIC_LOCAL(AtomicString, increment, ("increment", AtomicString::ConstructFromLiteral));
+    DEFINE_STATIC_LOCAL(AtomicString, start, ("start", AtomicString::ConstructFromLiteral));
+    DEFINE_STATIC_LOCAL(AtomicString, end, ("end", AtomicString::ConstructFromLiteral));
+    DEFINE_STATIC_LOCAL(AtomicString, horizontal, ("horizontal", AtomicString::ConstructFromLiteral));
+    DEFINE_STATIC_LOCAL(AtomicString, vertical, ("vertical", AtomicString::ConstructFromLiteral));
+    DEFINE_STATIC_LOCAL(AtomicString, doubleButton, ("double-button", AtomicString::ConstructFromLiteral));
+    DEFINE_STATIC_LOCAL(AtomicString, singleButton, ("single-button", AtomicString::ConstructFromLiteral));
+    DEFINE_STATIC_LOCAL(AtomicString, noButton, ("no-button", AtomicString::ConstructFromLiteral));
+    DEFINE_STATIC_LOCAL(AtomicString, cornerPresent, ("corner-present", AtomicString::ConstructFromLiteral));
     // Paged Media pseudo-classes
-    DEFINE_STATIC_LOCAL(AtomicString, firstPage, ("first"));
-    DEFINE_STATIC_LOCAL(AtomicString, leftPage, ("left"));
-    DEFINE_STATIC_LOCAL(AtomicString, rightPage, ("right"));
+    DEFINE_STATIC_LOCAL(AtomicString, firstPage, ("first", AtomicString::ConstructFromLiteral));
+    DEFINE_STATIC_LOCAL(AtomicString, leftPage, ("left", AtomicString::ConstructFromLiteral));
+    DEFINE_STATIC_LOCAL(AtomicString, rightPage, ("right", AtomicString::ConstructFromLiteral));
 #if ENABLE(FULLSCREEN_API)
-    DEFINE_STATIC_LOCAL(AtomicString, fullScreen, ("-webkit-full-screen"));
-    DEFINE_STATIC_LOCAL(AtomicString, fullScreenDocument, ("-webkit-full-screen-document"));
-    DEFINE_STATIC_LOCAL(AtomicString, fullScreenAncestor, ("-webkit-full-screen-ancestor"));
-    DEFINE_STATIC_LOCAL(AtomicString, animatingFullScreenTransition, ("-webkit-animating-full-screen-transition"));
+    DEFINE_STATIC_LOCAL(AtomicString, fullScreen, ("-webkit-full-screen", AtomicString::ConstructFromLiteral));
+    DEFINE_STATIC_LOCAL(AtomicString, fullScreenDocument, ("-webkit-full-screen-document", AtomicString::ConstructFromLiteral));
+    DEFINE_STATIC_LOCAL(AtomicString, fullScreenAncestor, ("-webkit-full-screen-ancestor", AtomicString::ConstructFromLiteral));
+    DEFINE_STATIC_LOCAL(AtomicString, animatingFullScreenTransition, ("-webkit-animating-full-screen-transition", AtomicString::ConstructFromLiteral));
 #endif
-    DEFINE_STATIC_LOCAL(AtomicString, inRange, ("in-range"));
-    DEFINE_STATIC_LOCAL(AtomicString, outOfRange, ("out-of-range"));
+    DEFINE_STATIC_LOCAL(AtomicString, inRange, ("in-range", AtomicString::ConstructFromLiteral));
+    DEFINE_STATIC_LOCAL(AtomicString, outOfRange, ("out-of-range", AtomicString::ConstructFromLiteral));
 
     static HashMap<AtomicStringImpl*, CSSSelector::PseudoType>* nameToPseudoType = 0;
     if (!nameToPseudoType) {
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to