Title: [113686] trunk/Source/WebCore
- Revision
- 113686
- Author
- [email protected]
- Date
- 2012-04-09 22:51:40 -0700 (Mon, 09 Apr 2012)
Log Message
combine two arrays in EventException.cpp into one
https://bugs.webkit.org/show_bug.cgi?id=83451
Patch by Lu Guanqun <[email protected]> on 2012-04-09
Reviewed by Kentaro Hara.
No new tests required.
* dom/EventException.cpp:
(EventExceptionNameDescription):
(WebCore):
(WebCore::EventException::initializeDescription):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (113685 => 113686)
--- trunk/Source/WebCore/ChangeLog 2012-04-10 05:50:16 UTC (rev 113685)
+++ trunk/Source/WebCore/ChangeLog 2012-04-10 05:51:40 UTC (rev 113686)
@@ -1,5 +1,19 @@
2012-04-09 Lu Guanqun <[email protected]>
+ combine two arrays in EventException.cpp into one
+ https://bugs.webkit.org/show_bug.cgi?id=83451
+
+ Reviewed by Kentaro Hara.
+
+ No new tests required.
+
+ * dom/EventException.cpp:
+ (EventExceptionNameDescription):
+ (WebCore):
+ (WebCore::EventException::initializeDescription):
+
+2012-04-09 Lu Guanqun <[email protected]>
+
combine two arrays in RangeException.cpp into one
https://bugs.webkit.org/show_bug.cgi?id=83450
Modified: trunk/Source/WebCore/dom/EventException.cpp (113685 => 113686)
--- trunk/Source/WebCore/dom/EventException.cpp 2012-04-10 05:50:16 UTC (rev 113685)
+++ trunk/Source/WebCore/dom/EventException.cpp 2012-04-10 05:51:40 UTC (rev 113686)
@@ -31,19 +31,14 @@
namespace WebCore {
-// FIXME: This should be an array of structs to pair the names and descriptions.
-static const char* const eventExceptionNames[] = {
- "UNSPECIFIED_EVENT_TYPE_ERR",
- "DISPATCH_REQUEST_ERR"
+static struct EventExceptionNameDescription {
+ const char* const name;
+ const char* const description;
+} exceptions[] = {
+ { "UNSPECIFIED_EVENT_TYPE_ERR", "The Event's type was not specified by initializing the event before the method was called." },
+ { "DISPATCH_REQUEST_ERR", "The Event object is already being dispatched." }
};
-static const char* const eventExceptionDescriptions[] = {
- "The Event's type was not specified by initializing the event before the method was called.",
- "The Event object is already being dispatched."
-};
-
-COMPILE_ASSERT(WTF_ARRAY_LENGTH(eventExceptionNames) == WTF_ARRAY_LENGTH(eventExceptionDescriptions), EventExceptionTablesMustMatch);
-
bool EventException::initializeDescription(ExceptionCode ec, ExceptionCodeDescription* description)
{
if (ec < EventExceptionOffset || ec > EventExceptionMax)
@@ -53,11 +48,11 @@
description->code = ec - EventExceptionOffset;
description->type = EventExceptionType;
- size_t tableSize = WTF_ARRAY_LENGTH(eventExceptionNames);
+ size_t tableSize = WTF_ARRAY_LENGTH(exceptions);
size_t tableIndex = ec - UNSPECIFIED_EVENT_TYPE_ERR;
- description->name = tableIndex < tableSize ? eventExceptionNames[tableIndex] : 0;
- description->description = tableIndex < tableSize ? eventExceptionDescriptions[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