Title: [151822] trunk
- Revision
- 151822
- Author
- [email protected]
- Date
- 2013-06-20 20:52:46 -0700 (Thu, 20 Jun 2013)
Log Message
REGRESSION(r145788): mouse drag on canvas shouldn't start selection
https://bugs.webkit.org/show_bug.cgi?id=117860
Reviewed by Benjamin Poulain.
Source/WebCore:
Like HTMLImageElement, HTMLCanvasElement shouldn't start selection.
Also uninline some virtual function overrides.
Test: fast/events/mosuedrag-on-canvas-should-not-start-selection.html
* html/HTMLCanvasElement.cpp:
(WebCore::HTMLCanvasElement::areAuthorShadowsAllowed):
(WebCore::HTMLCanvasElement::canContainRangeEndPoint):
(WebCore::HTMLCanvasElement::canStartSelection):
* html/HTMLCanvasElement.h:
LayoutTests:
Add a regression test for dragging mouse inside a canvas.
The canvas should not be selected and mouseup event should fire.
* fast/events/mosuedrag-on-canvas-should-not-start-selection-expected.txt: Added.
* fast/events/mosuedrag-on-canvas-should-not-start-selection.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (151821 => 151822)
--- trunk/LayoutTests/ChangeLog 2013-06-21 03:50:47 UTC (rev 151821)
+++ trunk/LayoutTests/ChangeLog 2013-06-21 03:52:46 UTC (rev 151822)
@@ -1,5 +1,18 @@
2013-06-20 Ryosuke Niwa <[email protected]>
+ REGRESSION(r145788): mouse drag on canvas shouldn't start selection
+ https://bugs.webkit.org/show_bug.cgi?id=117860
+
+ Reviewed by Benjamin Poulain.
+
+ Add a regression test for dragging mouse inside a canvas.
+ The canvas should not be selected and mouseup event should fire.
+
+ * fast/events/mosuedrag-on-canvas-should-not-start-selection-expected.txt: Added.
+ * fast/events/mosuedrag-on-canvas-should-not-start-selection.html: Added.
+
+2013-06-20 Ryosuke Niwa <[email protected]>
+
REGRESSION(r149652): accessing items in .children via id doesn't work when element is not rooted in DOM tree
https://bugs.webkit.org/show_bug.cgi?id=117836
Added: trunk/LayoutTests/fast/events/mosuedrag-on-canvas-should-not-start-selection-expected.txt (0 => 151822)
--- trunk/LayoutTests/fast/events/mosuedrag-on-canvas-should-not-start-selection-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/events/mosuedrag-on-canvas-should-not-start-selection-expected.txt 2013-06-21 03:52:46 UTC (rev 151822)
@@ -0,0 +1,10 @@
+This tests initiating a mouse drag on a canvas element doesn't start selection. To manually test, drag mouse on the canvas below. WebKit shouldn't select the canvas.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+getSelection().removeAllRanges(); mouseDown = false; mouseUp = false
+PASS eventSender.mouseMoveTo(canvas.offsetLeft + 10, canvas.offsetTop + 10); eventSender.mouseDown(); mouseDown is true
+PASS eventSender.mouseMoveTo(canvas.offsetLeft + 100, canvas.offsetTop + 100); eventSender.mouseUp(); mouseUp is true
+PASS getSelection().isCollapsed is true
+
Added: trunk/LayoutTests/fast/events/mosuedrag-on-canvas-should-not-start-selection.html (0 => 151822)
--- trunk/LayoutTests/fast/events/mosuedrag-on-canvas-should-not-start-selection.html (rev 0)
+++ trunk/LayoutTests/fast/events/mosuedrag-on-canvas-should-not-start-selection.html 2013-06-21 03:52:46 UTC (rev 151822)
@@ -0,0 +1,25 @@
+<!DOCTYPE html>
+<html>
+<body>
+<div id="editor" contenteditable>
+<canvas width="100" height="100" style="border: 1px solid black" _onmousedown_="mouseDown=true;" _onmouseup_="mouseUp=true;"></canvas>
+</div>
+<script src=""
+<script>
+
+description("This tests initiating a mouse drag on a canvas element doesn't start selection."
+ + " To manually test, drag mouse on the canvas below. WebKit shouldn't select the canvas.")
+
+if (window.eventSender) {
+ var canvas = document.querySelector('canvas');
+
+ evalAndLog('getSelection().removeAllRanges(); mouseDown = false; mouseUp = false');
+ shouldBeTrue("eventSender.mouseMoveTo(canvas.offsetLeft + 10, canvas.offsetTop + 10); eventSender.mouseDown(); mouseDown");
+ eventSender.leapForward(200);
+ shouldBeTrue("eventSender.mouseMoveTo(canvas.offsetLeft + 100, canvas.offsetTop + 100); eventSender.mouseUp(); mouseUp");
+ shouldBeTrue("getSelection().isCollapsed");
+}
+
+</script>
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (151821 => 151822)
--- trunk/Source/WebCore/ChangeLog 2013-06-21 03:50:47 UTC (rev 151821)
+++ trunk/Source/WebCore/ChangeLog 2013-06-21 03:52:46 UTC (rev 151822)
@@ -1,5 +1,24 @@
2013-06-20 Ryosuke Niwa <[email protected]>
+ REGRESSION(r145788): mouse drag on canvas shouldn't start selection
+ https://bugs.webkit.org/show_bug.cgi?id=117860
+
+ Reviewed by Benjamin Poulain.
+
+ Like HTMLImageElement, HTMLCanvasElement shouldn't start selection.
+
+ Also uninline some virtual function overrides.
+
+ Test: fast/events/mosuedrag-on-canvas-should-not-start-selection.html
+
+ * html/HTMLCanvasElement.cpp:
+ (WebCore::HTMLCanvasElement::areAuthorShadowsAllowed):
+ (WebCore::HTMLCanvasElement::canContainRangeEndPoint):
+ (WebCore::HTMLCanvasElement::canStartSelection):
+ * html/HTMLCanvasElement.h:
+
+2013-06-20 Ryosuke Niwa <[email protected]>
+
REGRESSION(r149652): accessing items in .children via id doesn't work when element is not rooted in DOM tree
https://bugs.webkit.org/show_bug.cgi?id=117836
Modified: trunk/Source/WebCore/html/HTMLCanvasElement.cpp (151821 => 151822)
--- trunk/Source/WebCore/html/HTMLCanvasElement.cpp 2013-06-21 03:50:47 UTC (rev 151821)
+++ trunk/Source/WebCore/html/HTMLCanvasElement.cpp 2013-06-21 03:52:46 UTC (rev 151822)
@@ -127,6 +127,21 @@
HTMLElement::attach(context);
}
+bool HTMLCanvasElement::areAuthorShadowsAllowed() const
+{
+ return false;
+}
+
+bool HTMLCanvasElement::canContainRangeEndPoint() const
+{
+ return false;
+}
+
+bool HTMLCanvasElement::canStartSelection() const
+{
+ return false;
+}
+
void HTMLCanvasElement::addObserver(CanvasObserver* observer)
{
m_observers.add(observer);
Modified: trunk/Source/WebCore/html/HTMLCanvasElement.h (151821 => 151822)
--- trunk/Source/WebCore/html/HTMLCanvasElement.h 2013-06-21 03:50:47 UTC (rev 151821)
+++ trunk/Source/WebCore/html/HTMLCanvasElement.h 2013-06-21 03:52:46 UTC (rev 151822)
@@ -142,16 +142,17 @@
float deviceScaleFactor() const { return m_deviceScaleFactor; }
- virtual bool canContainRangeEndPoint() const { return false; }
-
private:
HTMLCanvasElement(const QualifiedName&, Document*);
virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERRIDE;
virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
virtual void attach(const AttachContext& = AttachContext()) OVERRIDE;
- virtual bool areAuthorShadowsAllowed() const OVERRIDE { return false; }
+ virtual bool areAuthorShadowsAllowed() const OVERRIDE;
+ virtual bool canContainRangeEndPoint() const OVERRIDE;
+ virtual bool canStartSelection() const OVERRIDE;
+
void reset();
float targetDeviceScaleFactor() const;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes