| OLD | NEW |
| 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 13 matching lines...) Expand all Loading... |
| 24 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 24 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 30 */ | 30 */ |
| 31 | 31 |
| 32 #include "core/html/shadow/SliderThumbElement.h" | 32 #include "core/html/shadow/SliderThumbElement.h" |
| 33 | 33 |
| 34 #include "core/dom/shadow/ShadowRoot.h" |
| 34 #include "core/events/Event.h" | 35 #include "core/events/Event.h" |
| 35 #include "core/events/MouseEvent.h" | 36 #include "core/events/MouseEvent.h" |
| 36 #include "core/dom/shadow/ShadowRoot.h" | |
| 37 #include "core/frame/LocalFrame.h" | 37 #include "core/frame/LocalFrame.h" |
| 38 #include "core/html/HTMLInputElement.h" | 38 #include "core/html/HTMLInputElement.h" |
| 39 #include "core/html/forms/StepRange.h" | 39 #include "core/html/forms/StepRange.h" |
| 40 #include "core/html/parser/HTMLParserIdioms.h" | 40 #include "core/html/parser/HTMLParserIdioms.h" |
| 41 #include "core/html/shadow/ShadowElementNames.h" | 41 #include "core/html/shadow/ShadowElementNames.h" |
| 42 #include "core/input/EventHandler.h" | 42 #include "core/input/EventHandler.h" |
| 43 #include "core/layout/LayoutSliderContainer.h" | 43 #include "core/layout/LayoutSliderContainer.h" |
| 44 #include "core/layout/LayoutSliderThumb.h" | 44 #include "core/layout/LayoutSliderThumb.h" |
| 45 #include "core/layout/LayoutTheme.h" | 45 #include "core/layout/LayoutTheme.h" |
| 46 | 46 |
| 47 namespace blink { | 47 namespace blink { |
| 48 | 48 |
| 49 using namespace HTMLNames; | 49 using namespace HTMLNames; |
| 50 | 50 |
| 51 inline static bool hasVerticalAppearance(HTMLInputElement* input) | 51 inline static bool hasVerticalAppearance(HTMLInputElement* input) |
| 52 { | 52 { |
| 53 ASSERT(input->layoutObject()); | 53 DCHECK(input->layoutObject()); |
| 54 const ComputedStyle& sliderStyle = input->layoutObject()->styleRef(); | 54 const ComputedStyle& sliderStyle = input->layoutObject()->styleRef(); |
| 55 | 55 |
| 56 return sliderStyle.appearance() == SliderVerticalPart; | 56 return sliderStyle.appearance() == SliderVerticalPart; |
| 57 } | 57 } |
| 58 | 58 |
| 59 inline SliderThumbElement::SliderThumbElement(Document& document) | 59 inline SliderThumbElement::SliderThumbElement(Document& document) |
| 60 : HTMLDivElement(document) | 60 : HTMLDivElement(document) |
| 61 , m_inDragMode(false) | 61 , m_inDragMode(false) |
| 62 { | 62 { |
| 63 } | 63 } |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 MouseEvent* mouseEvent = toMouseEvent(event); | 208 MouseEvent* mouseEvent = toMouseEvent(event); |
| 209 bool isLeftButton = mouseEvent->button() == LeftButton; | 209 bool isLeftButton = mouseEvent->button() == LeftButton; |
| 210 const AtomicString& eventType = event->type(); | 210 const AtomicString& eventType = event->type(); |
| 211 | 211 |
| 212 // We intentionally do not call event->setDefaultHandled() here because | 212 // We intentionally do not call event->setDefaultHandled() here because |
| 213 // MediaControlTimelineElement::defaultEventHandler() wants to handle these | 213 // MediaControlTimelineElement::defaultEventHandler() wants to handle these |
| 214 // mouse events. | 214 // mouse events. |
| 215 if (eventType == EventTypeNames::mousedown && isLeftButton) { | 215 if (eventType == EventTypeNames::mousedown && isLeftButton) { |
| 216 startDragging(); | 216 startDragging(); |
| 217 return; | 217 return; |
| 218 } else if (eventType == EventTypeNames::mouseup && isLeftButton) { | 218 } |
| 219 if (eventType == EventTypeNames::mouseup && isLeftButton) { |
| 219 stopDragging(); | 220 stopDragging(); |
| 220 return; | 221 return; |
| 221 } else if (eventType == EventTypeNames::mousemove) { | 222 } |
| 223 if (eventType == EventTypeNames::mousemove) { |
| 222 if (m_inDragMode) | 224 if (m_inDragMode) |
| 223 setPositionFromPoint(mouseEvent->absoluteLocation()); | 225 setPositionFromPoint(mouseEvent->absoluteLocation()); |
| 224 return; | 226 return; |
| 225 } | 227 } |
| 226 | 228 |
| 227 HTMLDivElement::defaultEventHandler(event); | 229 HTMLDivElement::defaultEventHandler(event); |
| 228 } | 230 } |
| 229 | 231 |
| 230 bool SliderThumbElement::willRespondToMouseMoveEvents() | 232 bool SliderThumbElement::willRespondToMouseMoveEvents() |
| 231 { | 233 { |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 323 case MediaVolumeSliderThumbPart: | 325 case MediaVolumeSliderThumbPart: |
| 324 case MediaFullScreenVolumeSliderPart: | 326 case MediaFullScreenVolumeSliderPart: |
| 325 case MediaFullScreenVolumeSliderThumbPart: | 327 case MediaFullScreenVolumeSliderThumbPart: |
| 326 return mediaSliderContainer; | 328 return mediaSliderContainer; |
| 327 default: | 329 default: |
| 328 return sliderContainer; | 330 return sliderContainer; |
| 329 } | 331 } |
| 330 } | 332 } |
| 331 | 333 |
| 332 } // namespace blink | 334 } // namespace blink |
| OLD | NEW |