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 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 availableExtent -= isVertical ? thumb->height() : thumb->width(); | 179 availableExtent -= isVertical ? thumb->height() : thumb->width(); |
180 LayoutUnit offset = percentageOffset * availableExtent; | 180 LayoutUnit offset = percentageOffset * availableExtent; |
181 LayoutPoint thumbLocation = thumb->location(); | 181 LayoutPoint thumbLocation = thumb->location(); |
182 if (isVertical) | 182 if (isVertical) |
183 thumbLocation.setY(thumbLocation.y() + track->contentHeight() - thumb->h
eight() - offset); | 183 thumbLocation.setY(thumbLocation.y() + track->contentHeight() - thumb->h
eight() - offset); |
184 else if (style()->isLeftToRightDirection()) | 184 else if (style()->isLeftToRightDirection()) |
185 thumbLocation.setX(thumbLocation.x() + offset); | 185 thumbLocation.setX(thumbLocation.x() + offset); |
186 else | 186 else |
187 thumbLocation.setX(thumbLocation.x() - offset); | 187 thumbLocation.setX(thumbLocation.x() - offset); |
188 thumb->setLocation(thumbLocation); | 188 thumb->setLocation(thumbLocation); |
189 if (checkForRepaintDuringLayout() && parent() | 189 if (checkForPaintInvalidationDuringLayout() && parent() |
190 && (parent()->style()->appearance() == MediaVolumeSliderPart || parent()
->style()->appearance() == MediaSliderPart)) { | 190 && (parent()->style()->appearance() == MediaVolumeSliderPart || parent()
->style()->appearance() == MediaSliderPart)) { |
191 // This will sometimes repaint too much. However, it is necessary to | 191 // This will sometimes repaint too much. However, it is necessary to |
192 // correctly repaint media controls (volume and timeline sliders) - | 192 // correctly repaint media controls (volume and timeline sliders) - |
193 // they have special painting code in RenderMediaControls.cpp:paintMedia
VolumeSlider | 193 // they have special painting code in RenderMediaControls.cpp:paintMedia
VolumeSlider |
194 // and paintMediaSlider that gets called via -webkit-appearance and Rend
erTheme, | 194 // and paintMediaSlider that gets called via -webkit-appearance and Rend
erTheme, |
195 // so nothing else would otherwise invalidate the slider. | 195 // so nothing else would otherwise invalidate the slider. |
196 paintInvalidationForWholeRenderer(); | 196 paintInvalidationForWholeRenderer(); |
197 } | 197 } |
198 } | 198 } |
199 | 199 |
(...skipping 11 matching lines...) Expand all Loading... |
211 element->setAttribute(idAttr, ShadowElementNames::sliderThumb()); | 211 element->setAttribute(idAttr, ShadowElementNames::sliderThumb()); |
212 return element.release(); | 212 return element.release(); |
213 } | 213 } |
214 | 214 |
215 void SliderThumbElement::setPositionFromValue() | 215 void SliderThumbElement::setPositionFromValue() |
216 { | 216 { |
217 // Since the code to calculate position is in the RenderSliderThumb layout | 217 // Since the code to calculate position is in the RenderSliderThumb layout |
218 // path, we don't actually update the value here. Instead, we poke at the | 218 // path, we don't actually update the value here. Instead, we poke at the |
219 // renderer directly to trigger layout. | 219 // renderer directly to trigger layout. |
220 if (renderer()) | 220 if (renderer()) |
221 renderer()->setNeedsLayoutAndFullRepaint(); | 221 renderer()->setNeedsLayoutAndFullPaintInvalidation(); |
222 } | 222 } |
223 | 223 |
224 RenderObject* SliderThumbElement::createRenderer(RenderStyle*) | 224 RenderObject* SliderThumbElement::createRenderer(RenderStyle*) |
225 { | 225 { |
226 return new RenderSliderThumb(this); | 226 return new RenderSliderThumb(this); |
227 } | 227 } |
228 | 228 |
229 bool SliderThumbElement::isDisabledFormControl() const | 229 bool SliderThumbElement::isDisabledFormControl() const |
230 { | 230 { |
231 return hostInput() && hostInput()->isDisabledFormControl(); | 231 return hostInput() && hostInput()->isDisabledFormControl(); |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 value = closest; | 301 value = closest; |
302 } | 302 } |
303 | 303 |
304 String valueString = serializeForNumberType(value); | 304 String valueString = serializeForNumberType(value); |
305 if (valueString == input->value()) | 305 if (valueString == input->value()) |
306 return; | 306 return; |
307 | 307 |
308 // FIXME: This is no longer being set from renderer. Consider updating the m
ethod name. | 308 // FIXME: This is no longer being set from renderer. Consider updating the m
ethod name. |
309 input->setValueFromRenderer(valueString); | 309 input->setValueFromRenderer(valueString); |
310 if (renderer()) | 310 if (renderer()) |
311 renderer()->setNeedsLayoutAndFullRepaint(); | 311 renderer()->setNeedsLayoutAndFullPaintInvalidation(); |
312 } | 312 } |
313 | 313 |
314 void SliderThumbElement::startDragging() | 314 void SliderThumbElement::startDragging() |
315 { | 315 { |
316 if (LocalFrame* frame = document().frame()) { | 316 if (LocalFrame* frame = document().frame()) { |
317 frame->eventHandler().setCapturingMouseEventsNode(this); | 317 frame->eventHandler().setCapturingMouseEventsNode(this); |
318 m_inDragMode = true; | 318 m_inDragMode = true; |
319 } | 319 } |
320 } | 320 } |
321 | 321 |
322 void SliderThumbElement::stopDragging() | 322 void SliderThumbElement::stopDragging() |
323 { | 323 { |
324 if (!m_inDragMode) | 324 if (!m_inDragMode) |
325 return; | 325 return; |
326 | 326 |
327 if (LocalFrame* frame = document().frame()) | 327 if (LocalFrame* frame = document().frame()) |
328 frame->eventHandler().setCapturingMouseEventsNode(nullptr); | 328 frame->eventHandler().setCapturingMouseEventsNode(nullptr); |
329 m_inDragMode = false; | 329 m_inDragMode = false; |
330 if (renderer()) | 330 if (renderer()) |
331 renderer()->setNeedsLayoutAndFullRepaint(); | 331 renderer()->setNeedsLayoutAndFullPaintInvalidation(); |
332 if (hostInput()) | 332 if (hostInput()) |
333 hostInput()->dispatchFormControlChangeEvent(); | 333 hostInput()->dispatchFormControlChangeEvent(); |
334 } | 334 } |
335 | 335 |
336 void SliderThumbElement::defaultEventHandler(Event* event) | 336 void SliderThumbElement::defaultEventHandler(Event* event) |
337 { | 337 { |
338 if (!event->isMouseEvent()) { | 338 if (!event->isMouseEvent()) { |
339 HTMLDivElement::defaultEventHandler(event); | 339 HTMLDivElement::defaultEventHandler(event); |
340 return; | 340 return; |
341 } | 341 } |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
467 case MediaVolumeSliderThumbPart: | 467 case MediaVolumeSliderThumbPart: |
468 case MediaFullScreenVolumeSliderPart: | 468 case MediaFullScreenVolumeSliderPart: |
469 case MediaFullScreenVolumeSliderThumbPart: | 469 case MediaFullScreenVolumeSliderThumbPart: |
470 return mediaSliderContainer; | 470 return mediaSliderContainer; |
471 default: | 471 default: |
472 return sliderContainer; | 472 return sliderContainer; |
473 } | 473 } |
474 } | 474 } |
475 | 475 |
476 } | 476 } |
OLD | NEW |