Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(139)

Side by Side Diff: third_party/WebKit/Source/core/html/shadow/SpinButtonElement.cpp

Issue 2227563003: Refactoring button field and its type (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix new instances Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2008, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2008, 2010 Apple Inc. All rights reserved.
3 * Copyright (C) 2010 Google Inc. All rights reserved. 3 * Copyright (C) 2010 Google Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 } 81 }
82 82
83 if (!shouldRespondToMouseEvents()) { 83 if (!shouldRespondToMouseEvents()) {
84 if (!event->defaultHandled()) 84 if (!event->defaultHandled())
85 HTMLDivElement::defaultEventHandler(event); 85 HTMLDivElement::defaultEventHandler(event);
86 return; 86 return;
87 } 87 }
88 88
89 MouseEvent* mouseEvent = toMouseEvent(event); 89 MouseEvent* mouseEvent = toMouseEvent(event);
90 IntPoint local = roundedIntPoint(box->absoluteToLocal(FloatPoint(mouseEvent- >absoluteLocation()), UseTransforms)); 90 IntPoint local = roundedIntPoint(box->absoluteToLocal(FloatPoint(mouseEvent- >absoluteLocation()), UseTransforms));
91 if (mouseEvent->type() == EventTypeNames::mousedown && mouseEvent->button() == LeftButton) { 91 if (mouseEvent->type() == EventTypeNames::mousedown && mouseEvent->button() == static_cast<short>(WebPointerProperties::Button::Left)) {
92 if (box->pixelSnappedBorderBoxRect().contains(local)) { 92 if (box->pixelSnappedBorderBoxRect().contains(local)) {
93 if (m_spinButtonOwner) 93 if (m_spinButtonOwner)
94 m_spinButtonOwner->focusAndSelectSpinButtonOwner(); 94 m_spinButtonOwner->focusAndSelectSpinButtonOwner();
95 if (layoutObject()) { 95 if (layoutObject()) {
96 if (m_upDownState != Indeterminate) { 96 if (m_upDownState != Indeterminate) {
97 // A JavaScript event handler called in doStepAction() below 97 // A JavaScript event handler called in doStepAction() below
98 // might change the element state and we might need to 98 // might change the element state and we might need to
99 // cancel the repeating timer by the state change. If we 99 // cancel the repeating timer by the state change. If we
100 // started the timer after doStepAction(), we would have no 100 // started the timer after doStepAction(), we would have no
101 // chance to cancel the timer. 101 // chance to cancel the timer.
102 startRepeatingTimer(); 102 startRepeatingTimer();
103 doStepAction(m_upDownState == Up ? 1 : -1); 103 doStepAction(m_upDownState == Up ? 1 : -1);
104 } 104 }
105 } 105 }
106 event->setDefaultHandled(); 106 event->setDefaultHandled();
107 } 107 }
108 } else if (mouseEvent->type() == EventTypeNames::mouseup && mouseEvent->butt on() == LeftButton) { 108 } else if (mouseEvent->type() == EventTypeNames::mouseup && mouseEvent->butt on() == static_cast<short>(WebPointerProperties::Button::Left)) {
109 releaseCapture(); 109 releaseCapture();
110 } else if (event->type() == EventTypeNames::mousemove) { 110 } else if (event->type() == EventTypeNames::mousemove) {
111 if (box->pixelSnappedBorderBoxRect().contains(local)) { 111 if (box->pixelSnappedBorderBoxRect().contains(local)) {
112 if (!m_capturing) { 112 if (!m_capturing) {
113 if (LocalFrame* frame = document().frame()) { 113 if (LocalFrame* frame = document().frame()) {
114 frame->eventHandler().setCapturingMouseEventsNode(this); 114 frame->eventHandler().setCapturingMouseEventsNode(this);
115 m_capturing = true; 115 m_capturing = true;
116 if (Page* page = document().page()) 116 if (Page* page = document().page())
117 page->chromeClient().registerPopupOpeningObserver(this); 117 page->chromeClient().registerPopupOpeningObserver(this);
118 } 118 }
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 return !m_spinButtonOwner || m_spinButtonOwner->shouldSpinButtonRespondToMou seEvents(); 252 return !m_spinButtonOwner || m_spinButtonOwner->shouldSpinButtonRespondToMou seEvents();
253 } 253 }
254 254
255 DEFINE_TRACE(SpinButtonElement) 255 DEFINE_TRACE(SpinButtonElement)
256 { 256 {
257 visitor->trace(m_spinButtonOwner); 257 visitor->trace(m_spinButtonOwner);
258 HTMLDivElement::trace(visitor); 258 HTMLDivElement::trace(visitor);
259 } 259 }
260 260
261 } // namespace blink 261 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698