Index: Source/core/dom/Document.cpp |
diff --git a/Source/core/dom/Document.cpp b/Source/core/dom/Document.cpp |
index 88434192920c790fc09c45864ec8c670fcc7c8e6..112120d829f68ed6986e248ccbe49beea5b7e8b7 100644 |
--- a/Source/core/dom/Document.cpp |
+++ b/Source/core/dom/Document.cpp |
@@ -5222,14 +5222,33 @@ void Document::serviceScriptedAnimations(double monotonicAnimationStartTime) |
m_scriptedAnimationController->serviceScriptedAnimations(monotonicAnimationStartTime); |
} |
-PassRefPtrWillBeRawPtr<Touch> Document::createTouch(DOMWindow* window, EventTarget* target, int identifier, int pageX, int pageY, int screenX, int screenY, int radiusX, int radiusY, float rotationAngle, float force) const |
-{ |
+PassRefPtrWillBeRawPtr<Touch> Document::createTouch(DOMWindow* window, EventTarget* target, int identifier, double pageX, double pageY, double screenX, double screenY, double radiusX, double radiusY, float rotationAngle, float force) const |
+{ |
+ // Match behavior from when these types were integers, and avoid surprises from someone explicitly |
+ // passing Infinity/NaN. |
+ if (!std::isfinite(pageX)) |
+ pageX = 0; |
+ if (!std::isfinite(pageY)) |
+ pageY = 0; |
+ if (!std::isfinite(screenX)) |
+ screenX = 0; |
+ if (!std::isfinite(screenY)) |
+ screenY = 0; |
+ if (!std::isfinite(radiusX)) |
+ radiusX = 0; |
+ if (!std::isfinite(radiusY)) |
+ radiusY = 0; |
+ if (!std::isfinite(rotationAngle)) |
+ rotationAngle = 0; |
+ if (!std::isfinite(force)) |
+ force = 0; |
+ |
// FIXME: It's not clear from the documentation at |
// http://developer.apple.com/library/safari/#documentation/UserExperience/Reference/DocumentAdditionsReference/DocumentAdditions/DocumentAdditions.html |
// when this method should throw and nor is it by inspection of iOS behavior. It would be nice to verify any cases where it throws under iOS |
// and implement them here. See https://bugs.webkit.org/show_bug.cgi?id=47819 |
LocalFrame* frame = window ? window->frame() : this->frame(); |
- return Touch::create(frame, target, identifier, screenX, screenY, pageX, pageY, radiusX, radiusY, rotationAngle, force); |
+ return Touch::create(frame, target, identifier, FloatPoint(screenX, screenY), FloatPoint(pageX, pageY), FloatSize(radiusX, radiusY), rotationAngle, force); |
} |
PassRefPtrWillBeRawPtr<TouchList> Document::createTouchList(WillBeHeapVector<RefPtrWillBeMember<Touch> >& touches) const |