Title: [113685] trunk/Source/WebCore
Revision
113685
Author
[email protected]
Date
2012-04-09 22:50:16 -0700 (Mon, 09 Apr 2012)

Log Message

combine two arrays in RangeException.cpp into one
https://bugs.webkit.org/show_bug.cgi?id=83450

Patch by Lu Guanqun <[email protected]> on 2012-04-09
Reviewed by Kentaro Hara.

No new tests required.

* dom/RangeException.cpp:
(RangeExceptionNameDescription):
(WebCore):
(WebCore::RangeException::initializeDescription):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (113684 => 113685)


--- trunk/Source/WebCore/ChangeLog	2012-04-10 05:47:33 UTC (rev 113684)
+++ trunk/Source/WebCore/ChangeLog	2012-04-10 05:50:16 UTC (rev 113685)
@@ -1,3 +1,17 @@
+2012-04-09  Lu Guanqun  <[email protected]>
+
+        combine two arrays in RangeException.cpp into one
+        https://bugs.webkit.org/show_bug.cgi?id=83450
+
+        Reviewed by Kentaro Hara.
+
+        No new tests required.
+
+        * dom/RangeException.cpp:
+        (RangeExceptionNameDescription):
+        (WebCore):
+        (WebCore::RangeException::initializeDescription):
+
 2012-04-09  No'am Rosenthal  <[email protected]>
 
         [Texmap] Improve TextureMapperGL readability

Modified: trunk/Source/WebCore/dom/RangeException.cpp (113684 => 113685)


--- trunk/Source/WebCore/dom/RangeException.cpp	2012-04-10 05:47:33 UTC (rev 113684)
+++ trunk/Source/WebCore/dom/RangeException.cpp	2012-04-10 05:50:16 UTC (rev 113685)
@@ -31,19 +31,14 @@
 
 namespace WebCore {
 
-// FIXME: This should be an array of structs to pair the names and descriptions.
-static const char* const rangeExceptionNames[] = {
-    "BAD_BOUNDARYPOINTS_ERR",
-    "INVALID_NODE_TYPE_ERR"
+static struct RangeExceptionNameDescription {
+    const char* const name;
+    const char* const description;
+} exceptions[] = {
+    { "BAD_BOUNDARYPOINTS_ERR", "The boundary-points of a Range did not meet specific requirements." },
+    { "INVALID_NODE_TYPE_ERR", "The container of an boundary-point of a Range was being set to either a node of an invalid type or a node with an ancestor of an invalid type." }
 };
 
-static const char* const rangeExceptionDescriptions[] = {
-    "The boundary-points of a Range did not meet specific requirements.",
-    "The container of an boundary-point of a Range was being set to either a node of an invalid type or a node with an ancestor of an invalid type."
-};
-
-COMPILE_ASSERT(WTF_ARRAY_LENGTH(rangeExceptionNames) == WTF_ARRAY_LENGTH(rangeExceptionDescriptions), RangeExceptionTablesMustMatch);
-
 bool RangeException::initializeDescription(ExceptionCode ec, ExceptionCodeDescription* description)
 {
     if (ec < RangeExceptionOffset || ec > RangeExceptionMax)
@@ -53,11 +48,11 @@
     description->code = ec - RangeExceptionOffset;
     description->type = RangeExceptionType;
 
-    size_t tableSize = WTF_ARRAY_LENGTH(rangeExceptionNames);
+    size_t tableSize = WTF_ARRAY_LENGTH(exceptions);
     size_t tableIndex = ec - BAD_BOUNDARYPOINTS_ERR;
 
-    description->name = tableIndex < tableSize ? rangeExceptionNames[tableIndex] : 0;
-    description->description = tableIndex < tableSize ? rangeExceptionDescriptions[tableIndex] : 0;
+    description->name = tableIndex < tableSize ? exceptions[tableIndex].name : 0;
+    description->description = tableIndex < tableSize ? exceptions[tableIndex].description : 0;
 
     return true;
 }
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to