| 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 | 57 |
| 58 return sliderStyle.appearance() == SliderVerticalPart; | 58 return sliderStyle.appearance() == SliderVerticalPart; |
| 59 } | 59 } |
| 60 | 60 |
| 61 inline SliderThumbElement::SliderThumbElement(Document& document) | 61 inline SliderThumbElement::SliderThumbElement(Document& document) |
| 62 : HTMLDivElement(document) | 62 : HTMLDivElement(document) |
| 63 , m_inDragMode(false) | 63 , m_inDragMode(false) |
| 64 { | 64 { |
| 65 } | 65 } |
| 66 | 66 |
| 67 PassRefPtrWillBeRawPtr<SliderThumbElement> SliderThumbElement::create(Document&
document) | 67 RawPtr<SliderThumbElement> SliderThumbElement::create(Document& document) |
| 68 { | 68 { |
| 69 RefPtrWillBeRawPtr<SliderThumbElement> element = adoptRefWillBeNoop(new Slid
erThumbElement(document)); | 69 RawPtr<SliderThumbElement> element = (new SliderThumbElement(document)); |
| 70 element->setAttribute(idAttr, ShadowElementNames::sliderThumb()); | 70 element->setAttribute(idAttr, ShadowElementNames::sliderThumb()); |
| 71 return element.release(); | 71 return element.release(); |
| 72 } | 72 } |
| 73 | 73 |
| 74 void SliderThumbElement::setPositionFromValue() | 74 void SliderThumbElement::setPositionFromValue() |
| 75 { | 75 { |
| 76 // Since the code to calculate position is in the LayoutSliderThumb layout | 76 // Since the code to calculate position is in the LayoutSliderThumb layout |
| 77 // path, we don't actually update the value here. Instead, we poke at the | 77 // path, we don't actually update the value here. Instead, we poke at the |
| 78 // layoutObject directly to trigger layout. | 78 // layoutObject directly to trigger layout. |
| 79 if (layoutObject()) | 79 if (layoutObject()) |
| (...skipping 20 matching lines...) Expand all Loading... |
| 100 return hostInput() && hostInput()->matchesReadWritePseudoClass(); | 100 return hostInput() && hostInput()->matchesReadWritePseudoClass(); |
| 101 } | 101 } |
| 102 | 102 |
| 103 Node* SliderThumbElement::focusDelegate() | 103 Node* SliderThumbElement::focusDelegate() |
| 104 { | 104 { |
| 105 return hostInput(); | 105 return hostInput(); |
| 106 } | 106 } |
| 107 | 107 |
| 108 void SliderThumbElement::dragFrom(const LayoutPoint& point) | 108 void SliderThumbElement::dragFrom(const LayoutPoint& point) |
| 109 { | 109 { |
| 110 RefPtrWillBeRawPtr<SliderThumbElement> protector(this); | 110 RawPtr<SliderThumbElement> protector(this); |
| 111 startDragging(); | 111 startDragging(); |
| 112 setPositionFromPoint(point); | 112 setPositionFromPoint(point); |
| 113 } | 113 } |
| 114 | 114 |
| 115 void SliderThumbElement::setPositionFromPoint(const LayoutPoint& point) | 115 void SliderThumbElement::setPositionFromPoint(const LayoutPoint& point) |
| 116 { | 116 { |
| 117 RefPtrWillBeRawPtr<HTMLInputElement> input(hostInput()); | 117 RawPtr<HTMLInputElement> input(hostInput()); |
| 118 Element* trackElement = input->userAgentShadowRoot()->getElementById(ShadowE
lementNames::sliderTrack()); | 118 Element* trackElement = input->userAgentShadowRoot()->getElementById(ShadowE
lementNames::sliderTrack()); |
| 119 | 119 |
| 120 if (!input->layoutObject() || !layoutBox() || !trackElement->layoutBox()) | 120 if (!input->layoutObject() || !layoutBox() || !trackElement->layoutBox()) |
| 121 return; | 121 return; |
| 122 | 122 |
| 123 LayoutPoint offset = roundedLayoutPoint(input->layoutObject()->absoluteToLoc
al(FloatPoint(point), UseTransforms)); | 123 LayoutPoint offset = roundedLayoutPoint(input->layoutObject()->absoluteToLoc
al(FloatPoint(point), UseTransforms)); |
| 124 bool isVertical = hasVerticalAppearance(input.get()); | 124 bool isVertical = hasVerticalAppearance(input.get()); |
| 125 bool isLeftToRightDirection = layoutBox()->style()->isLeftToRightDirection()
; | 125 bool isLeftToRightDirection = layoutBox()->style()->isLeftToRightDirection()
; |
| 126 LayoutUnit trackSize; | 126 LayoutUnit trackSize; |
| 127 LayoutUnit position; | 127 LayoutUnit position; |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 326 case MediaVolumeSliderThumbPart: | 326 case MediaVolumeSliderThumbPart: |
| 327 case MediaFullScreenVolumeSliderPart: | 327 case MediaFullScreenVolumeSliderPart: |
| 328 case MediaFullScreenVolumeSliderThumbPart: | 328 case MediaFullScreenVolumeSliderThumbPart: |
| 329 return mediaSliderContainer; | 329 return mediaSliderContainer; |
| 330 default: | 330 default: |
| 331 return sliderContainer; | 331 return sliderContainer; |
| 332 } | 332 } |
| 333 } | 333 } |
| 334 | 334 |
| 335 } // namespace blink | 335 } // namespace blink |
| OLD | NEW |