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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 #include "core/layout/LayoutTheme.h" | 47 #include "core/layout/LayoutTheme.h" |
48 #include "core/page/EventHandler.h" | 48 #include "core/page/EventHandler.h" |
49 | 49 |
50 namespace blink { | 50 namespace blink { |
51 | 51 |
52 using namespace HTMLNames; | 52 using namespace HTMLNames; |
53 | 53 |
54 inline static bool hasVerticalAppearance(HTMLInputElement* input) | 54 inline static bool hasVerticalAppearance(HTMLInputElement* input) |
55 { | 55 { |
56 ASSERT(input->layoutObject()); | 56 ASSERT(input->layoutObject()); |
57 const LayoutStyle& sliderStyle = input->layoutObject()->styleRef(); | 57 const ComputedStyle& sliderStyle = input->layoutObject()->styleRef(); |
58 | 58 |
59 return sliderStyle.appearance() == SliderVerticalPart; | 59 return sliderStyle.appearance() == SliderVerticalPart; |
60 } | 60 } |
61 | 61 |
62 inline SliderThumbElement::SliderThumbElement(Document& document) | 62 inline SliderThumbElement::SliderThumbElement(Document& document) |
63 : HTMLDivElement(document) | 63 : HTMLDivElement(document) |
64 , m_inDragMode(false) | 64 , m_inDragMode(false) |
65 { | 65 { |
66 } | 66 } |
67 | 67 |
68 PassRefPtrWillBeRawPtr<SliderThumbElement> SliderThumbElement::create(Document&
document) | 68 PassRefPtrWillBeRawPtr<SliderThumbElement> SliderThumbElement::create(Document&
document) |
69 { | 69 { |
70 RefPtrWillBeRawPtr<SliderThumbElement> element = adoptRefWillBeNoop(new Slid
erThumbElement(document)); | 70 RefPtrWillBeRawPtr<SliderThumbElement> element = adoptRefWillBeNoop(new Slid
erThumbElement(document)); |
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(); |
82 } | 82 } |
83 | 83 |
84 LayoutObject* SliderThumbElement::createLayoutObject(const LayoutStyle&) | 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(); |
92 } | 92 } |
93 | 93 |
94 bool SliderThumbElement::matchesReadOnlyPseudoClass() const | 94 bool SliderThumbElement::matchesReadOnlyPseudoClass() const |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 DEFINE_STATIC_LOCAL(const AtomicString, mediaSliderThumb, ("-webkit-media-sl
ider-thumb", AtomicString::ConstructFromLiteral)); | 276 DEFINE_STATIC_LOCAL(const AtomicString, mediaSliderThumb, ("-webkit-media-sl
ider-thumb", AtomicString::ConstructFromLiteral)); |
277 return mediaSliderThumb; | 277 return mediaSliderThumb; |
278 } | 278 } |
279 | 279 |
280 const AtomicString& SliderThumbElement::shadowPseudoId() const | 280 const AtomicString& SliderThumbElement::shadowPseudoId() const |
281 { | 281 { |
282 HTMLInputElement* input = hostInput(); | 282 HTMLInputElement* input = hostInput(); |
283 if (!input || !input->layoutObject()) | 283 if (!input || !input->layoutObject()) |
284 return sliderThumbShadowPartId(); | 284 return sliderThumbShadowPartId(); |
285 | 285 |
286 const LayoutStyle& sliderStyle = input->layoutObject()->styleRef(); | 286 const ComputedStyle& sliderStyle = input->layoutObject()->styleRef(); |
287 switch (sliderStyle.appearance()) { | 287 switch (sliderStyle.appearance()) { |
288 case MediaSliderPart: | 288 case MediaSliderPart: |
289 case MediaSliderThumbPart: | 289 case MediaSliderThumbPart: |
290 case MediaVolumeSliderPart: | 290 case MediaVolumeSliderPart: |
291 case MediaVolumeSliderThumbPart: | 291 case MediaVolumeSliderThumbPart: |
292 case MediaFullScreenVolumeSliderPart: | 292 case MediaFullScreenVolumeSliderPart: |
293 case MediaFullScreenVolumeSliderThumbPart: | 293 case MediaFullScreenVolumeSliderThumbPart: |
294 return mediaSliderThumbShadowPartId(); | 294 return mediaSliderThumbShadowPartId(); |
295 default: | 295 default: |
296 return sliderThumbShadowPartId(); | 296 return sliderThumbShadowPartId(); |
297 } | 297 } |
298 } | 298 } |
299 | 299 |
300 // -------------------------------- | 300 // -------------------------------- |
301 | 301 |
302 inline SliderContainerElement::SliderContainerElement(Document& document) | 302 inline SliderContainerElement::SliderContainerElement(Document& document) |
303 : HTMLDivElement(document) | 303 : HTMLDivElement(document) |
304 { | 304 { |
305 } | 305 } |
306 | 306 |
307 DEFINE_NODE_FACTORY(SliderContainerElement) | 307 DEFINE_NODE_FACTORY(SliderContainerElement) |
308 | 308 |
309 LayoutObject* SliderContainerElement::createLayoutObject(const LayoutStyle&) | 309 LayoutObject* SliderContainerElement::createLayoutObject(const ComputedStyle&) |
310 { | 310 { |
311 return new LayoutSliderContainer(this); | 311 return new LayoutSliderContainer(this); |
312 } | 312 } |
313 | 313 |
314 const AtomicString& SliderContainerElement::shadowPseudoId() const | 314 const AtomicString& SliderContainerElement::shadowPseudoId() const |
315 { | 315 { |
316 DEFINE_STATIC_LOCAL(const AtomicString, mediaSliderContainer, ("-webkit-medi
a-slider-container", AtomicString::ConstructFromLiteral)); | 316 DEFINE_STATIC_LOCAL(const AtomicString, mediaSliderContainer, ("-webkit-medi
a-slider-container", AtomicString::ConstructFromLiteral)); |
317 DEFINE_STATIC_LOCAL(const AtomicString, sliderContainer, ("-webkit-slider-co
ntainer", AtomicString::ConstructFromLiteral)); | 317 DEFINE_STATIC_LOCAL(const AtomicString, sliderContainer, ("-webkit-slider-co
ntainer", AtomicString::ConstructFromLiteral)); |
318 | 318 |
319 if (!shadowHost() || !shadowHost()->layoutObject()) | 319 if (!shadowHost() || !shadowHost()->layoutObject()) |
320 return sliderContainer; | 320 return sliderContainer; |
321 | 321 |
322 const LayoutStyle& sliderStyle = shadowHost()->layoutObject()->styleRef(); | 322 const ComputedStyle& sliderStyle = shadowHost()->layoutObject()->styleRef(); |
323 switch (sliderStyle.appearance()) { | 323 switch (sliderStyle.appearance()) { |
324 case MediaSliderPart: | 324 case MediaSliderPart: |
325 case MediaSliderThumbPart: | 325 case MediaSliderThumbPart: |
326 case MediaVolumeSliderPart: | 326 case MediaVolumeSliderPart: |
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 |