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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 SliderThumbElement* element = new SliderThumbElement(document); | 67 SliderThumbElement* element = new SliderThumbElement(document); |
68 element->setAttribute(idAttr, ShadowElementNames::sliderThumb()); | 68 element->setAttribute(idAttr, ShadowElementNames::sliderThumb()); |
69 return element; | 69 return element; |
70 } | 70 } |
71 | 71 |
72 void SliderThumbElement::setPositionFromValue() | 72 void SliderThumbElement::setPositionFromValue() |
73 { | 73 { |
74 // Since the code to calculate position is in the LayoutSliderThumb layout | 74 // Since the code to calculate position is in the LayoutSliderThumb layout |
75 // path, we don't actually update the value here. Instead, we poke at the | 75 // path, we don't actually update the value here. Instead, we poke at the |
76 // layoutObject directly to trigger layout. | 76 // layoutObject directly to trigger layout. |
77 if (layoutObject()) | 77 if (hasLayoutObject()) |
78 layoutObject()->setNeedsLayoutAndFullPaintInvalidation(LayoutInvalidatio
nReason::SliderValueChanged); | 78 layoutObject()->setNeedsLayoutAndFullPaintInvalidation(LayoutInvalidatio
nReason::SliderValueChanged); |
79 } | 79 } |
80 | 80 |
81 LayoutObject* SliderThumbElement::createLayoutObject(const ComputedStyle&) | 81 LayoutObject* SliderThumbElement::createLayoutObject(const ComputedStyle&) |
82 { | 82 { |
83 return new LayoutSliderThumb(this); | 83 return new LayoutSliderThumb(this); |
84 } | 84 } |
85 | 85 |
86 bool SliderThumbElement::isDisabledFormControl() const | 86 bool SliderThumbElement::isDisabledFormControl() const |
87 { | 87 { |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 if ((closestPosition - position).abs() <= snappingThreshold) | 156 if ((closestPosition - position).abs() <= snappingThreshold) |
157 value = closest; | 157 value = closest; |
158 } | 158 } |
159 | 159 |
160 String valueString = serializeForNumberType(value); | 160 String valueString = serializeForNumberType(value); |
161 if (valueString == input->value()) | 161 if (valueString == input->value()) |
162 return; | 162 return; |
163 | 163 |
164 // FIXME: This is no longer being set from renderer. Consider updating the m
ethod name. | 164 // FIXME: This is no longer being set from renderer. Consider updating the m
ethod name. |
165 input->setValueFromRenderer(valueString); | 165 input->setValueFromRenderer(valueString); |
166 if (layoutObject()) | 166 if (hasLayoutObject()) |
167 layoutObject()->setNeedsLayoutAndFullPaintInvalidation(LayoutInvalidatio
nReason::SliderValueChanged); | 167 layoutObject()->setNeedsLayoutAndFullPaintInvalidation(LayoutInvalidatio
nReason::SliderValueChanged); |
168 } | 168 } |
169 | 169 |
170 void SliderThumbElement::startDragging() | 170 void SliderThumbElement::startDragging() |
171 { | 171 { |
172 if (LocalFrame* frame = document().frame()) { | 172 if (LocalFrame* frame = document().frame()) { |
173 frame->eventHandler().setCapturingMouseEventsNode(this); | 173 frame->eventHandler().setCapturingMouseEventsNode(this); |
174 m_inDragMode = true; | 174 m_inDragMode = true; |
175 } | 175 } |
176 } | 176 } |
177 | 177 |
178 void SliderThumbElement::stopDragging() | 178 void SliderThumbElement::stopDragging() |
179 { | 179 { |
180 if (!m_inDragMode) | 180 if (!m_inDragMode) |
181 return; | 181 return; |
182 | 182 |
183 if (LocalFrame* frame = document().frame()) | 183 if (LocalFrame* frame = document().frame()) |
184 frame->eventHandler().setCapturingMouseEventsNode(nullptr); | 184 frame->eventHandler().setCapturingMouseEventsNode(nullptr); |
185 m_inDragMode = false; | 185 m_inDragMode = false; |
186 if (layoutObject()) | 186 if (hasLayoutObject()) |
187 layoutObject()->setNeedsLayoutAndFullPaintInvalidation(LayoutInvalidatio
nReason::SliderValueChanged); | 187 layoutObject()->setNeedsLayoutAndFullPaintInvalidation(LayoutInvalidatio
nReason::SliderValueChanged); |
188 if (hostInput()) | 188 if (hostInput()) |
189 hostInput()->dispatchFormControlChangeEvent(); | 189 hostInput()->dispatchFormControlChangeEvent(); |
190 } | 190 } |
191 | 191 |
192 void SliderThumbElement::defaultEventHandler(Event* event) | 192 void SliderThumbElement::defaultEventHandler(Event* event) |
193 { | 193 { |
194 if (!event->isMouseEvent()) { | 194 if (!event->isMouseEvent()) { |
195 HTMLDivElement::defaultEventHandler(event); | 195 HTMLDivElement::defaultEventHandler(event); |
196 return; | 196 return; |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 case MediaVolumeSliderThumbPart: | 323 case MediaVolumeSliderThumbPart: |
324 case MediaFullScreenVolumeSliderPart: | 324 case MediaFullScreenVolumeSliderPart: |
325 case MediaFullScreenVolumeSliderThumbPart: | 325 case MediaFullScreenVolumeSliderThumbPart: |
326 return mediaSliderContainer; | 326 return mediaSliderContainer; |
327 default: | 327 default: |
328 return sliderContainer; | 328 return sliderContainer; |
329 } | 329 } |
330 } | 330 } |
331 | 331 |
332 } // namespace blink | 332 } // namespace blink |
OLD | NEW |