Bug 28274 - off-by-one typo in V8DOMWindowCustom.cpp
Summary: off-by-one typo in V8DOMWindowCustom.cpp
Status: RESOLVED INVALID
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore JavaScript (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P4 Trivial
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-08-13 12:26 PDT by John Gregg
Modified: 2014-12-16 00:52 PST (History)
1 user (show)

See Also:


Attachments
fix for off-by-one error (1.28 KB, patch)
2009-08-13 14:42 PDT, John Gregg
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description John Gregg 2009-08-13 12:26:36 PDT
Ran across this while investigating event-handler bindings.  Maybe I misunderstand the point of this function, but as best as I can tell it's just changing the capitalization of the various webkit* event names.  

If that's true and the 'a' is meant to catch the beginning of "animation", the [7] should really be a [6].

static String eventNameFromAttributeName(const String& name)
{
    ASSERT(name.startsWith("on"));
    String eventType = name.substring(2);

    if (eventType.startsWith("w")) {
        switch(eventType[eventType.length() - 1]) {
        case 't':
            eventType = "webkitAnimationStart";
            break;
        case 'n':
            eventType = "webkitAnimationIteration";
            break;
        case 'd':
            ASSERT(eventType.length() > 7);
            if (eventType[7] == 'a') 
                eventType = "webkitAnimationEnd";
            else
                eventType = "webkitTransitionEnd";
            break;
        }
    }

    return eventType;
}
Comment 1 John Gregg 2009-08-13 14:42:41 PDT
Created attachment 34790 [details]
fix for off-by-one error

Here's a fix if I interpreted this correctly.