summaryrefslogtreecommitdiffstats
path: root/Source/WebCore/html/RangeInputType.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebCore/html/RangeInputType.cpp')
-rw-r--r--Source/WebCore/html/RangeInputType.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/Source/WebCore/html/RangeInputType.cpp b/Source/WebCore/html/RangeInputType.cpp
index cbec740..22e7f8e 100644
--- a/Source/WebCore/html/RangeInputType.cpp
+++ b/Source/WebCore/html/RangeInputType.cpp
@@ -39,6 +39,7 @@
#include "MouseEvent.h"
#include "PlatformMouseEvent.h"
#include "RenderSlider.h"
+#include "ShadowRoot.h"
#include "SliderThumbElement.h"
#include "StepRange.h"
#include <limits>
@@ -152,7 +153,7 @@ void RangeInputType::handleMouseDownEvent(MouseEvent* event)
if (event->button() != LeftButton || event->target() != element())
return;
- if (SliderThumbElement* thumb = toSliderThumbElement(element()->shadowRoot()))
+ if (SliderThumbElement* thumb = shadowSliderThumb())
thumb->dragFrom(event->absoluteLocation());
}
@@ -216,7 +217,8 @@ void RangeInputType::handleTouchStartEvent(TouchEvent* touchEvent)
void RangeInputType::createShadowSubtree()
{
- element()->setShadowRoot(SliderThumbElement::create(element()->document()));
+ ExceptionCode ec = 0;
+ element()->ensureShadowRoot()->appendChild(SliderThumbElement::create(element()->document()), ec);
}
RenderObject* RangeInputType::createRenderer(RenderArena* arena, RenderStyle*) const
@@ -261,7 +263,7 @@ void RangeInputType::minOrMaxAttributeChanged()
void RangeInputType::valueChanged()
{
- toSliderThumbElement(element()->shadowRoot())->setPositionFromValue();
+ shadowSliderThumb()->setPositionFromValue();
}
String RangeInputType::fallbackValue()
@@ -285,4 +287,10 @@ bool RangeInputType::shouldRespectListAttribute()
return true;
}
+SliderThumbElement* RangeInputType::shadowSliderThumb() const
+{
+ Node* shadow = element()->shadowRoot();
+ return shadow ? toSliderThumbElement(shadow->firstChild()) : 0;
+}
+
} // namespace WebCore