input type=range element should only fire change events after committing a  value
https://bugs.webkit.org/show_bug.cgi?id=134545

Patch by Julien Quint <pom@graougraou.com> on 2014-07-04
Reviewed by Dean Jackson.

Source/WebCore:
A "change" event was fired every time the slider thumb element was dragged
by the user. The "change" event is now fired only after the thumb
element has stopped moving; previously, both "input" and "change" events
where dispatched while changes were being made. This new behavior is
consistent with the specification (cf.
http://www.whatwg.org/specs/web-apps/current-work/multipage/common-input-element-attributes.html#event-input-change),
as well as other implementations such as Firefox and Chrome.

* Modules/mediacontrols/mediaControlsApple.js:
(Controller.prototype.createControls): Listen to the "input" event
rather than the "change" event for the timeline control in order to
keep track of value changes when the user is dragging the thumb.
* accessibility/AccessibilitySlider.cpp:
(WebCore::AccessibilitySlider::setValue): Dispatch "change" event while
setting the new value rather than dispatching later, since setting the
value now clears the change flag.
* html/RangeInputType.cpp:
(WebCore::RangeInputType::setValue): Update the text value of the
control in the case when no event is to be dispatched, so that this
value can be checked the next time a "change" event dispatch is
requested.
* html/shadow/SliderThumbElement.cpp:
(WebCore::SliderThumbElement::setPositionFromPoint): Removed the
dispatch of the "change" event, and no longer track the text value of
the element as a result of dispatching a "change" event.
(WebCore::SliderThumbElement::stopDragging): Dispatch the "change" event
on completing the drag.

LayoutTests:
Two existing tests are updated to count "input" events as well as
"change" events. The tests now verify that "change" is only fired once
after every slider drag completes, whereas "input" may be fired more
than once.

* fast/forms/range/range-drag-expected.txt:
* fast/forms/range/range-drag-when-toggled-disabled-expected.txt:
* fast/forms/range/range-drag-when-toggled-disabled.html:
* fast/forms/range/range-drag.html:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@170808 268f45cc-cd09-0410-ab3c-d52691b4dbfc
CTTE: ScriptElement always has a HTTPScriptElement or SVGScriptElement.
<https://webkit.org/b/134637>

Have ScriptElement store the pointer to the more specific subclass
element as a reference. Also made the constructor protected since
nobody should instantiate ScriptElement directly.

Reviewed by Antti Koivisto.

* dom/ScriptElement.cpp:
(WebCore::ScriptElement::ScriptElement):
(WebCore::ScriptElement::childrenChanged):
(WebCore::ScriptElement::dispatchErrorEvent):
(WebCore::ScriptElement::prepareScript):
(WebCore::ScriptElement::requestScript):
(WebCore::ScriptElement::executeScript):
(WebCore::ScriptElement::notifyFinished):
(WebCore::ScriptElement::ignoresLoadRequest):
(WebCore::ScriptElement::scriptContent):
* dom/ScriptElement.h:
(WebCore::ScriptElement::element):
* dom/ScriptRunner.cpp:
(WebCore::ScriptRunner::queueScriptForExecution):
* html/HTMLScriptElement.cpp:
(WebCore::HTMLScriptElement::HTMLScriptElement):
* svg/SVGScriptElement.cpp:
(WebCore::SVGScriptElement::SVGScriptElement):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@170809 268f45cc-cd09-0410-ab3c-d52691b4dbfc