Title: [191080] trunk/Source/WebCore
Revision
191080
Author
timothy_hor...@apple.com
Date
2015-10-14 18:21:19 -0700 (Wed, 14 Oct 2015)

Log Message

Move some EventHandler initialization to the header
https://bugs.webkit.org/show_bug.cgi?id=150139

Reviewed by Andreas Kling.

No new tests, just cleanup.

* page/EventHandler.cpp:
(WebCore::EventHandler::EventHandler): Deleted.
* page/EventHandler.h:
Also found one member which was unused, and a few that were uninitialized.
It's likely the uninitialized ones didn't actually cause any trouble because
they are reset in lots of places, but this seems better.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (191079 => 191080)


--- trunk/Source/WebCore/ChangeLog	2015-10-15 01:06:39 UTC (rev 191079)
+++ trunk/Source/WebCore/ChangeLog	2015-10-15 01:21:19 UTC (rev 191080)
@@ -1,3 +1,19 @@
+2015-10-14  Tim Horton  <timothy_hor...@apple.com>
+
+        Move some EventHandler initialization to the header
+        https://bugs.webkit.org/show_bug.cgi?id=150139
+
+        Reviewed by Andreas Kling.
+
+        No new tests, just cleanup.
+
+        * page/EventHandler.cpp:
+        (WebCore::EventHandler::EventHandler): Deleted.
+        * page/EventHandler.h:
+        Also found one member which was unused, and a few that were uninitialized.
+        It's likely the uninitialized ones didn't actually cause any trouble because
+        they are reset in lots of places, but this seems better.
+
 2015-10-14  Alex Christensen  <achristen...@webkit.org>
 
         [Content Extensions] Make blocked async XHR call onerror

Modified: trunk/Source/WebCore/page/EventHandler.cpp (191079 => 191080)


--- trunk/Source/WebCore/page/EventHandler.cpp	2015-10-15 01:06:39 UTC (rev 191079)
+++ trunk/Source/WebCore/page/EventHandler.cpp	2015-10-15 01:21:19 UTC (rev 191080)
@@ -373,62 +373,18 @@
 
 EventHandler::EventHandler(Frame& frame)
     : m_frame(frame)
-    , m_mousePressed(false)
-    , m_capturesDragging(false)
-    , m_mouseDownMayStartSelect(false)
-#if ENABLE(DRAG_SUPPORT)
-    , m_mouseDownMayStartDrag(false)
-    , m_dragMayStartSelectionInstead(false)
-#endif
-    , m_mouseDownWasSingleClickInSelection(false)
-    , m_selectionInitiationState(HaveNotStartedSelection)
     , m_hoverTimer(*this, &EventHandler::hoverTimerFired)
 #if ENABLE(CURSOR_SUPPORT)
     , m_cursorUpdateTimer(*this, &EventHandler::cursorUpdateTimerFired)
 #endif
     , m_longMousePressTimer(*this, &EventHandler::recognizeLongMousePress)
-    , m_didRecognizeLongMousePress(false)
     , m_autoscrollController(std::make_unique<AutoscrollController>())
-    , m_mouseDownMayStartAutoscroll(false)
-    , m_mouseDownWasInSubframe(false)
 #if !ENABLE(IOS_TOUCH_EVENTS)
     , m_fakeMouseMoveEventTimer(*this, &EventHandler::fakeMouseMoveEventTimerFired)
 #endif
-    , m_svgPan(false)
-    , m_resizeLayer(nullptr)
-    , m_eventHandlerWillResetCapturingMouseEventsElement(false)
-    , m_clickCount(0)
-#if ENABLE(IOS_GESTURE_EVENTS)
-    , m_gestureInitialDiameter(GestureUnknown)
-    , m_gestureLastDiameter(GestureUnknown)
-    , m_gestureInitialRotation(GestureUnknown)
-    , m_gestureLastRotation(GestureUnknown)
-#endif
-#if ENABLE(IOS_TOUCH_EVENTS)
-    , m_firstTouchID(InvalidTouchIdentifier)
-#endif
-    , m_mousePositionIsUnknown(true)
-    , m_mouseDownTimestamp(0)
-#if PLATFORM(COCOA)
-    , m_mouseDownView(nil)
-    , m_sendingEventToSubview(false)
-#if !PLATFORM(IOS)
-    , m_activationEventNumber(-1)
-#endif // !PLATFORM(IOS)
-#endif
-#if ENABLE(TOUCH_EVENTS) && !ENABLE(IOS_TOUCH_EVENTS)
-    , m_originatingTouchPointTargetKey(0)
-    , m_touchPressed(false)
-#endif
-    , m_maxMouseMovedDuration(0)
-    , m_baseEventType(PlatformEvent::NoType)
-    , m_didStartDrag(false)
-    , m_didLongPressInvokeContextMenu(false)
-    , m_isHandlingWheelEvent(false)
 #if ENABLE(CURSOR_VISIBILITY)
     , m_autoHideCursorTimer(*this, &EventHandler::autoHideCursorTimerFired)
 #endif
-    , m_immediateActionStage(ImmediateActionStage::None)
 {
 }
 

Modified: trunk/Source/WebCore/page/EventHandler.h (191079 => 191080)


--- trunk/Source/WebCore/page/EventHandler.h	2015-10-15 01:06:39 UTC (rev 191079)
+++ trunk/Source/WebCore/page/EventHandler.h	2015-10-15 01:21:19 UTC (rev 191080)
@@ -44,17 +44,15 @@
 #include <wtf/WeakPtr.h>
 
 #if PLATFORM(IOS)
+OBJC_CLASS WebEvent;
+OBJC_CLASS WAKView;
 #ifdef __OBJC__
-@class WebEvent;
-@class WAKView;
 #include "WAKAppKitStubs.h"
-#else
-class WebEvent;
 #endif
 #endif // PLATFORM(IOS)
 
-#if PLATFORM(COCOA) && !defined(__OBJC__)
-class NSView;
+#if PLATFORM(COCOA)
+OBJC_CLASS NSView;
 #endif
 
 #if ENABLE(TOUCH_EVENTS)
@@ -261,7 +259,7 @@
 
     void focusDocumentView();
     
-    WEBCORE_EXPORT void sendScrollEvent(); // Ditto
+    WEBCORE_EXPORT void sendScrollEvent();
 
 #if PLATFORM(COCOA) && defined(__OBJC__)
 #if !PLATFORM(IOS)
@@ -470,24 +468,24 @@
 
     Frame& m_frame;
 
-    bool m_mousePressed;
-    bool m_capturesDragging;
+    bool m_mousePressed { false };
+    bool m_capturesDragging { false };
     RefPtr<Node> m_mousePressNode;
 
-    bool m_mouseDownMayStartSelect;
+    bool m_mouseDownMayStartSelect { false };
 #if ENABLE(DRAG_SUPPORT)
-    bool m_mouseDownMayStartDrag;
-    bool m_dragMayStartSelectionInstead;
+    bool m_mouseDownMayStartDrag { false };
+    bool m_dragMayStartSelectionInstead { false };
 #endif
-    bool m_mouseDownWasSingleClickInSelection;
+    bool m_mouseDownWasSingleClickInSelection { false };
     enum SelectionInitiationState { HaveNotStartedSelection, PlacedCaret, ExtendedSelection };
-    SelectionInitiationState m_selectionInitiationState;
+    SelectionInitiationState m_selectionInitiationState { HaveNotStartedSelection };
 
 #if ENABLE(DRAG_SUPPORT)
     LayoutPoint m_dragStartPos;
 #endif
 
-    bool m_panScrollButtonPressed;
+    bool m_panScrollButtonPressed { false };
 
     Timer m_hoverTimer;
 #if ENABLE(CURSOR_SUPPORT)
@@ -495,22 +493,22 @@
 #endif
 
     Timer m_longMousePressTimer;
-    bool m_didRecognizeLongMousePress;
+    bool m_didRecognizeLongMousePress { false };
 
     std::unique_ptr<AutoscrollController> m_autoscrollController;
-    bool m_mouseDownMayStartAutoscroll;
-    bool m_mouseDownWasInSubframe;
+    bool m_mouseDownMayStartAutoscroll { false };
+    bool m_mouseDownWasInSubframe { false };
 
 #if !ENABLE(IOS_TOUCH_EVENTS)
     Timer m_fakeMouseMoveEventTimer;
 #endif
 
-    bool m_svgPan;
+    bool m_svgPan { false };
 
-    RenderLayer* m_resizeLayer;
+    RenderLayer* m_resizeLayer { nullptr };
 
     RefPtr<Element> m_capturingMouseEventsElement;
-    bool m_eventHandlerWillResetCapturingMouseEventsElement;
+    bool m_eventHandlerWillResetCapturingMouseEventsElement { false };
     
     RefPtr<Element> m_elementUnderMouse;
     RefPtr<Element> m_lastElementUnderMouse;
@@ -518,67 +516,66 @@
     WeakPtr<Scrollbar> m_lastScrollbarUnderMouse;
     Cursor m_currentMouseCursor;
 
-    int m_clickCount;
+    int m_clickCount { 0 };
     RefPtr<Node> m_clickNode;
 
 #if ENABLE(IOS_GESTURE_EVENTS)
-    float m_gestureInitialDiameter;
-    float m_gestureLastDiameter;
-    float m_gestureInitialRotation;
-    float m_gestureLastRotation;
+    float m_gestureInitialDiameter { GestureUnknown };
+    float m_gestureInitialRotation { GestureUnknown };
+    float m_gestureLastDiameter { GestureUnknown };
+    float m_gestureLastRotation { GestureUnknown };
+    EventTargetSet m_gestureTargets;
 #endif
 
 #if ENABLE(IOS_TOUCH_EVENTS)
-    unsigned m_firstTouchID;
+    unsigned m_firstTouchID { InvalidTouchIdentifier };
 
     TouchArray m_touches;
-    EventTargetSet m_gestureTargets;
     RefPtr<Frame> m_touchEventTargetSubframe;
 #endif
 
 #if ENABLE(DRAG_SUPPORT)
     RefPtr<Element> m_dragTarget;
-    bool m_shouldOnlyFireDragOverEvent;
+    bool m_shouldOnlyFireDragOverEvent { false };
 #endif
     
     RefPtr<HTMLFrameSetElement> m_frameSetBeingResized;
 
     LayoutSize m_offsetFromResizeCorner; // In the coords of m_resizeLayer.
     
-    bool m_mousePositionIsUnknown;
+    bool m_mousePositionIsUnknown { true };
     IntPoint m_lastKnownMousePosition;
     IntPoint m_lastKnownMouseGlobalPosition;
     IntPoint m_mouseDownPos; // In our view's coords.
-    double m_mouseDownTimestamp;
+    double m_mouseDownTimestamp { 0 };
     PlatformMouseEvent m_mouseDown;
 
 #if PLATFORM(COCOA)
-    NSView *m_mouseDownView;
-    bool m_sendingEventToSubview;
-    bool m_startedGestureAtScrollLimit;
+    NSView *m_mouseDownView { nullptr };
+    bool m_sendingEventToSubview { false };
 #if !PLATFORM(IOS)
-    int m_activationEventNumber;
+    int m_activationEventNumber { -1 };
 #endif
 #endif
 #if ENABLE(TOUCH_EVENTS) && !ENABLE(IOS_TOUCH_EVENTS)
     typedef HashMap<int, RefPtr<EventTarget>> TouchTargetMap;
     TouchTargetMap m_originatingTouchPointTargets;
     RefPtr<Document> m_originatingTouchPointDocument;
-    unsigned m_originatingTouchPointTargetKey;
-    bool m_touchPressed;
+    unsigned m_originatingTouchPointTargetKey { 0 };
+    bool m_touchPressed { false };
 #endif
 
-    double m_maxMouseMovedDuration;
-    PlatformEvent::Type m_baseEventType;
-    bool m_didStartDrag;
-    bool m_didLongPressInvokeContextMenu;
-    bool m_isHandlingWheelEvent;
+    double m_maxMouseMovedDuration { 0 };
+    PlatformEvent::Type m_baseEventType { PlatformEvent::NoType };
+    bool m_didStartDrag { false };
+    bool m_didLongPressInvokeContextMenu { false };
+    bool m_isHandlingWheelEvent { false };
 
 #if ENABLE(CURSOR_VISIBILITY)
     Timer m_autoHideCursorTimer;
 #endif
 
-    ImmediateActionStage m_immediateActionStage;
+    ImmediateActionStage m_immediateActionStage { ImmediateActionStage::None };
 };
 
 } // namespace WebCore
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to