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