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

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

Issue 2703013002: Ignore the |readonly| attribute in <input type=range> (Closed)
Patch Set: Created 3 years, 10 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
« no previous file with comments | « third_party/WebKit/Source/core/html/forms/RangeInputType.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008, 2009 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 are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 void SliderThumbElement::defaultEventHandler(Event* event) { 199 void SliderThumbElement::defaultEventHandler(Event* event) {
200 if (!event->isMouseEvent()) { 200 if (!event->isMouseEvent()) {
201 HTMLDivElement::defaultEventHandler(event); 201 HTMLDivElement::defaultEventHandler(event);
202 return; 202 return;
203 } 203 }
204 204
205 // FIXME: Should handle this readonly/disabled check in more general way. 205 // FIXME: Should handle this readonly/disabled check in more general way.
206 // Missing this kind of check is likely to occur elsewhere if adding it in 206 // Missing this kind of check is likely to occur elsewhere if adding it in
207 // each shadow element. 207 // each shadow element.
208 HTMLInputElement* input = hostInput(); 208 HTMLInputElement* input = hostInput();
209 if (!input || input->isDisabledOrReadOnly()) { 209 if (!input || input->isDisabledFormControl()) {
210 stopDragging(); 210 stopDragging();
211 HTMLDivElement::defaultEventHandler(event); 211 HTMLDivElement::defaultEventHandler(event);
212 return; 212 return;
213 } 213 }
214 214
215 MouseEvent* mouseEvent = toMouseEvent(event); 215 MouseEvent* mouseEvent = toMouseEvent(event);
216 bool isLeftButton = mouseEvent->button() == 216 bool isLeftButton = mouseEvent->button() ==
217 static_cast<short>(WebPointerProperties::Button::Left); 217 static_cast<short>(WebPointerProperties::Button::Left);
218 const AtomicString& eventType = event->type(); 218 const AtomicString& eventType = event->type();
219 219
(...skipping 12 matching lines...) Expand all
232 if (m_inDragMode) 232 if (m_inDragMode)
233 setPositionFromPoint(LayoutPoint(mouseEvent->absoluteLocation())); 233 setPositionFromPoint(LayoutPoint(mouseEvent->absoluteLocation()));
234 return; 234 return;
235 } 235 }
236 236
237 HTMLDivElement::defaultEventHandler(event); 237 HTMLDivElement::defaultEventHandler(event);
238 } 238 }
239 239
240 bool SliderThumbElement::willRespondToMouseMoveEvents() { 240 bool SliderThumbElement::willRespondToMouseMoveEvents() {
241 const HTMLInputElement* input = hostInput(); 241 const HTMLInputElement* input = hostInput();
242 if (input && !input->isDisabledOrReadOnly() && m_inDragMode) 242 if (input && !input->isDisabledFormControl() && m_inDragMode)
243 return true; 243 return true;
244 244
245 return HTMLDivElement::willRespondToMouseMoveEvents(); 245 return HTMLDivElement::willRespondToMouseMoveEvents();
246 } 246 }
247 247
248 bool SliderThumbElement::willRespondToMouseClickEvents() { 248 bool SliderThumbElement::willRespondToMouseClickEvents() {
249 const HTMLInputElement* input = hostInput(); 249 const HTMLInputElement* input = hostInput();
250 if (input && !input->isDisabledOrReadOnly()) 250 if (input && !input->isDisabledFormControl())
251 return true; 251 return true;
252 252
253 return HTMLDivElement::willRespondToMouseClickEvents(); 253 return HTMLDivElement::willRespondToMouseClickEvents();
254 } 254 }
255 255
256 void SliderThumbElement::detachLayoutTree(const AttachContext& context) { 256 void SliderThumbElement::detachLayoutTree(const AttachContext& context) {
257 if (m_inDragMode) { 257 if (m_inDragMode) {
258 if (LocalFrame* frame = document().frame()) 258 if (LocalFrame* frame = document().frame())
259 frame->eventHandler().setCapturingMouseEventsNode(nullptr); 259 frame->eventHandler().setCapturingMouseEventsNode(nullptr);
260 } 260 }
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 320
321 void SliderContainerElement::defaultEventHandler(Event* event) { 321 void SliderContainerElement::defaultEventHandler(Event* event) {
322 if (event->isTouchEvent()) { 322 if (event->isTouchEvent()) {
323 handleTouchEvent(toTouchEvent(event)); 323 handleTouchEvent(toTouchEvent(event));
324 return; 324 return;
325 } 325 }
326 } 326 }
327 327
328 void SliderContainerElement::handleTouchEvent(TouchEvent* event) { 328 void SliderContainerElement::handleTouchEvent(TouchEvent* event) {
329 HTMLInputElement* input = hostInput(); 329 HTMLInputElement* input = hostInput();
330 if (input->isDisabledOrReadOnly()) 330 if (input->isDisabledFormControl())
331 return; 331 return;
332 332
333 if (event->type() == EventTypeNames::touchend) { 333 if (event->type() == EventTypeNames::touchend) {
334 input->dispatchFormControlChangeEvent(); 334 input->dispatchFormControlChangeEvent();
335 event->setDefaultHandled(); 335 event->setDefaultHandled();
336 m_slidingDirection = NoMove; 336 m_slidingDirection = NoMove;
337 m_touchStarted = false; 337 m_touchStarted = false;
338 return; 338 return;
339 } 339 }
340 340
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
448 updateTouchEventHandlerRegistry(); 448 updateTouchEventHandlerRegistry();
449 HTMLElement::didMoveToNewDocument(oldDocument); 449 HTMLElement::didMoveToNewDocument(oldDocument);
450 } 450 }
451 451
452 void SliderContainerElement::removeAllEventListeners() { 452 void SliderContainerElement::removeAllEventListeners() {
453 Node::removeAllEventListeners(); 453 Node::removeAllEventListeners();
454 m_hasTouchEventHandler = false; 454 m_hasTouchEventHandler = false;
455 } 455 }
456 456
457 } // namespace blink 457 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/forms/RangeInputType.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698