Changeset 127514 in webkit


Ignore:
Timestamp:
Sep 4, 2012 3:22:40 PM (12 years ago)
Author:
commit-queue@webkit.org
Message:

Fix style for Event.h
https://bugs.webkit.org/show_bug.cgi?id=95779

Patch by Nikhil Bhargava <nbhargava@google.com> on 2012-09-04
Reviewed by Eric Seidel.

Changes indenting for Event.h to match style guidelines for namespaces

  • dom/Event.h:
Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r127513 r127514  
     12012-09-04  Nikhil Bhargava  <nbhargava@google.com>
     2
     3        Fix style for Event.h
     4        https://bugs.webkit.org/show_bug.cgi?id=95779
     5
     6        Reviewed by Eric Seidel.
     7
     8        Changes indenting for Event.h to match style guidelines for namespaces
     9
     10        * dom/Event.h:
     11
    1122012-09-04  Jeffrey Pfau  <jpfau@apple.com>
    213
  • trunk/Source/WebCore/dom/Event.h

    r126256 r127514  
    3232namespace WebCore {
    3333
    34     class EventTarget;
    35     class EventDispatcher;
    36     class HTMLIFrameElement;
    37     class MemoryInstrumentation;
     34class EventTarget;
     35class EventDispatcher;
     36class HTMLIFrameElement;
     37class MemoryInstrumentation;
    3838
    39     struct EventInit {
    40         EventInit();
    41        
    42         bool bubbles;
    43         bool cancelable;
     39struct EventInit {
     40    EventInit();
     41     
     42    bool bubbles;
     43    bool cancelable;
     44};
     45
     46class Event : public RefCounted<Event> {
     47public:
     48    enum PhaseType {
     49        NONE                = 0,
     50        CAPTURING_PHASE     = 1,
     51        AT_TARGET           = 2,
     52        BUBBLING_PHASE      = 3
    4453    };
    4554
    46     class Event : public RefCounted<Event> {
    47     public:
    48         enum PhaseType {
    49             NONE                = 0,
    50             CAPTURING_PHASE     = 1,
    51             AT_TARGET           = 2,
    52             BUBBLING_PHASE      = 3
    53         };
     55    enum EventType {
     56        MOUSEDOWN           = 1,
     57        MOUSEUP             = 2,
     58        MOUSEOVER           = 4,
     59        MOUSEOUT            = 8,
     60        MOUSEMOVE           = 16,
     61        MOUSEDRAG           = 32,
     62        CLICK               = 64,
     63        DBLCLICK            = 128,
     64        KEYDOWN             = 256,
     65        KEYUP               = 512,
     66        KEYPRESS            = 1024,
     67        DRAGDROP            = 2048,
     68        FOCUS               = 4096,
     69        BLUR                = 8192,
     70        SELECT              = 16384,
     71        CHANGE              = 32768
     72    };
    5473
    55         enum EventType {
    56             MOUSEDOWN           = 1,
    57             MOUSEUP             = 2,
    58             MOUSEOVER           = 4,
    59             MOUSEOUT            = 8,
    60             MOUSEMOVE           = 16,
    61             MOUSEDRAG           = 32,
    62             CLICK               = 64,
    63             DBLCLICK            = 128,
    64             KEYDOWN             = 256,
    65             KEYUP               = 512,
    66             KEYPRESS            = 1024,
    67             DRAGDROP            = 2048,
    68             FOCUS               = 4096,
    69             BLUR                = 8192,
    70             SELECT              = 16384,
    71             CHANGE              = 32768
    72         };
     74    static PassRefPtr<Event> create()
     75    {
     76        return adoptRef(new Event);
     77    }
     78    static PassRefPtr<Event> create(const AtomicString& type, bool canBubble, bool cancelable)
     79    {
     80        return adoptRef(new Event(type, canBubble, cancelable));
     81    }
    7382
    74         static PassRefPtr<Event> create()
    75         {
    76             return adoptRef(new Event);
    77         }
    78         static PassRefPtr<Event> create(const AtomicString& type, bool canBubble, bool cancelable)
    79         {
    80             return adoptRef(new Event(type, canBubble, cancelable));
    81         }
     83    static PassRefPtr<Event> create(const AtomicString& type, const EventInit& initializer)
     84    {
     85        return adoptRef(new Event(type, initializer));
     86    }
    8287
    83         static PassRefPtr<Event> create(const AtomicString& type, const EventInit& initializer)
    84         {
    85             return adoptRef(new Event(type, initializer));
    86         }
     88    virtual ~Event();
    8789
    88         virtual ~Event();
     90    void initEvent(const AtomicString& type, bool canBubble, bool cancelable);
    8991
    90         void initEvent(const AtomicString& type, bool canBubble, bool cancelable);
     92    const AtomicString& type() const { return m_type; }
     93   
     94    EventTarget* target() const { return m_target.get(); }
     95    void setTarget(PassRefPtr<EventTarget>);
    9196
    92         const AtomicString& type() const { return m_type; }
    93        
    94         EventTarget* target() const { return m_target.get(); }
    95         void setTarget(PassRefPtr<EventTarget>);
     97    EventTarget* currentTarget() const { return m_currentTarget; }
     98    void setCurrentTarget(EventTarget* currentTarget) { m_currentTarget = currentTarget; }
    9699
    97         EventTarget* currentTarget() const { return m_currentTarget; }
    98         void setCurrentTarget(EventTarget* currentTarget) { m_currentTarget = currentTarget; }
     100    unsigned short eventPhase() const { return m_eventPhase; }
     101    void setEventPhase(unsigned short eventPhase) { m_eventPhase = eventPhase; }
    99102
    100         unsigned short eventPhase() const { return m_eventPhase; }
    101         void setEventPhase(unsigned short eventPhase) { m_eventPhase = eventPhase; }
     103    bool bubbles() const { return m_canBubble; }
     104    bool cancelable() const { return m_cancelable; }
     105    DOMTimeStamp timeStamp() const { return m_createTime; }
    102106
    103         bool bubbles() const { return m_canBubble; }
    104         bool cancelable() const { return m_cancelable; }
    105         DOMTimeStamp timeStamp() const { return m_createTime; }
     107    void stopPropagation() { m_propagationStopped = true; }
     108    void stopImmediatePropagation() { m_immediatePropagationStopped = true; }
     109   
     110    // IE Extensions
     111    EventTarget* srcElement() const { return target(); } // MSIE extension - "the object that fired the event"
    106112
    107         void stopPropagation() { m_propagationStopped = true; }
    108         void stopImmediatePropagation() { m_immediatePropagationStopped = true; }
    109        
    110         // IE Extensions
    111         EventTarget* srcElement() const { return target(); } // MSIE extension - "the object that fired the event"
     113    bool returnValue() const { return !defaultPrevented(); }
     114    void setReturnValue(bool returnValue) { setDefaultPrevented(!returnValue); }
    112115
    113         bool returnValue() const { return !defaultPrevented(); }
    114         void setReturnValue(bool returnValue) { setDefaultPrevented(!returnValue); }
     116    Clipboard* clipboardData() const { return isClipboardEvent() ? clipboard() : 0; }
    115117
    116         Clipboard* clipboardData() const { return isClipboardEvent() ? clipboard() : 0; }
     118    virtual const AtomicString& interfaceName() const;
     119    bool hasInterface(const AtomicString&) const;
    117120
    118         virtual const AtomicString& interfaceName() const;
    119         bool hasInterface(const AtomicString&) const;
     121    // These events are general classes of events.
     122    virtual bool isUIEvent() const;
     123    virtual bool isMouseEvent() const;
     124    virtual bool isKeyboardEvent() const;
     125    virtual bool isTouchEvent() const;
    120126
    121         // These events are general classes of events.
    122         virtual bool isUIEvent() const;
    123         virtual bool isMouseEvent() const;
    124         virtual bool isKeyboardEvent() const;
    125         virtual bool isTouchEvent() const;
     127    // Drag events are a subset of mouse events.
     128    virtual bool isDragEvent() const;
    126129
    127         // Drag events are a subset of mouse events.
    128         virtual bool isDragEvent() const;
     130    // These events lack a DOM interface.
     131    virtual bool isClipboardEvent() const;
     132    virtual bool isBeforeTextInsertedEvent() const;
    129133
    130         // These events lack a DOM interface.
    131         virtual bool isClipboardEvent() const;
    132         virtual bool isBeforeTextInsertedEvent() const;
     134    bool propagationStopped() const { return m_propagationStopped || m_immediatePropagationStopped; }
     135    bool immediatePropagationStopped() const { return m_immediatePropagationStopped; }
    133136
    134         bool propagationStopped() const { return m_propagationStopped || m_immediatePropagationStopped; }
    135         bool immediatePropagationStopped() const { return m_immediatePropagationStopped; }
     137    bool defaultPrevented() const { return m_defaultPrevented; }
     138    void preventDefault()
     139    {
     140        if (m_cancelable)
     141            m_defaultPrevented = true;
     142    }
     143    void setDefaultPrevented(bool defaultPrevented) { m_defaultPrevented = defaultPrevented; }
    136144
    137         bool defaultPrevented() const { return m_defaultPrevented; }
    138         void preventDefault() { if (m_cancelable) m_defaultPrevented = true; }
    139         void setDefaultPrevented(bool defaultPrevented) { m_defaultPrevented = defaultPrevented; }
     145    bool defaultHandled() const { return m_defaultHandled; }
     146    void setDefaultHandled() { m_defaultHandled = true; }
    140147
    141         bool defaultHandled() const { return m_defaultHandled; }
    142         void setDefaultHandled() { m_defaultHandled = true; }
     148    bool cancelBubble() const { return m_cancelBubble; }
     149    void setCancelBubble(bool cancel) { m_cancelBubble = cancel; }
    143150
    144         bool cancelBubble() const { return m_cancelBubble; }
    145         void setCancelBubble(bool cancel) { m_cancelBubble = cancel; }
     151    Event* underlyingEvent() const { return m_underlyingEvent.get(); }
     152    void setUnderlyingEvent(PassRefPtr<Event>);
    146153
    147         Event* underlyingEvent() const { return m_underlyingEvent.get(); }
    148         void setUnderlyingEvent(PassRefPtr<Event>);
     154    virtual bool storesResultAsString() const;
     155    virtual void storeResult(const String&);
    149156
    150         virtual bool storesResultAsString() const;
    151         virtual void storeResult(const String&);
     157    virtual Clipboard* clipboard() const { return 0; }
    152158
    153         virtual Clipboard* clipboard() const { return 0; }
     159    bool isBeingDispatched() const { return eventPhase(); }
    154160
    155         bool isBeingDispatched() const { return eventPhase(); }
     161    virtual void reportMemoryUsage(MemoryObjectInfo*) const;
    156162
    157         virtual void reportMemoryUsage(MemoryObjectInfo*) const;
     163    virtual PassRefPtr<Event> cloneFor(HTMLIFrameElement*) const;
    158164
    159         virtual PassRefPtr<Event> cloneFor(HTMLIFrameElement*) const;
     165protected:
     166    Event();
     167    Event(const AtomicString& type, bool canBubble, bool cancelable);
     168    Event(const AtomicString& type, const EventInit&);
    160169
    161     protected:
    162         Event();
    163         Event(const AtomicString& type, bool canBubble, bool cancelable);
    164         Event(const AtomicString& type, const EventInit&);
     170    virtual void receivedTarget();
     171    bool dispatched() const { return m_target; }
    165172
    166         virtual void receivedTarget();
    167         bool dispatched() const { return m_target; }
     173private:
     174    AtomicString m_type;
     175    bool m_canBubble;
     176    bool m_cancelable;
    168177
    169     private:
    170         AtomicString m_type;
    171         bool m_canBubble;
    172         bool m_cancelable;
     178    bool m_propagationStopped;
     179    bool m_immediatePropagationStopped;
     180    bool m_defaultPrevented;
     181    bool m_defaultHandled;
     182    bool m_cancelBubble;
    173183
    174         bool m_propagationStopped;
    175         bool m_immediatePropagationStopped;
    176         bool m_defaultPrevented;
    177         bool m_defaultHandled;
    178         bool m_cancelBubble;
     184    unsigned short m_eventPhase;
     185    EventTarget* m_currentTarget;
     186    RefPtr<EventTarget> m_target;
     187    DOMTimeStamp m_createTime;
    179188
    180         unsigned short m_eventPhase;
    181         EventTarget* m_currentTarget;
    182         RefPtr<EventTarget> m_target;
    183         DOMTimeStamp m_createTime;
    184 
    185         RefPtr<Event> m_underlyingEvent;
    186     };
     189    RefPtr<Event> m_underlyingEvent;
     190};
    187191
    188192} // namespace WebCore
Note: See TracChangeset for help on using the changeset viewer.