[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

tkent at chromium.org tkent at chromium.org
Wed Dec 22 12:33:25 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit d27d20b02a57682b4f67c7dddbf84f85583944e6
Author: tkent at chromium.org <tkent at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Aug 25 09:45:06 2010 +0000

    <input type=number>: Support auto-repeat by mouse press
    https://bugs.webkit.org/show_bug.cgi?id=44476
    
    Reviewed by Shinichiro Hamaji
    
    WebCore:
    
    Like arrow button of scrollbars, spinbuttons of <input
    type=number> should continue to increase/decrease their values
    while the mouse button is pressed.
    
    No new tests because the new behavior strongly depends on a timer.
    
    * rendering/TextControlInnerElements.cpp:
    (WebCore::SpinButtonElement::SpinButtonElement):
     Initializes the timer.
    (WebCore::SpinButtonElement::defaultEventHandler):
     Starts the timer by a mousedown event.
    (WebCore::SpinButtonElement::startRepeatingTimer):
    (WebCore::SpinButtonElement::stopRepeatingTimer):
    (WebCore::SpinButtonElement::repeatingTimerFired):
    * rendering/TextControlInnerElements.h:
    
    LayoutTests:
    
    Update existing tests.
    
    * fast/forms/script-tests/input-spinbutton-capturing.js:
    * platform/mac/fast/forms/input-appearance-spinbutton-up-expected.checksum:
    * platform/mac/fast/forms/input-appearance-spinbutton-up-expected.png:
    * platform/mac/fast/forms/input-appearance-spinbutton-up-expected.txt:
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@66001 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index bedcde8..c4e60f8 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,5 +1,19 @@
 2010-08-25  Kent Tamura  <tkent at chromium.org>
 
+        Reviewed by Shinichiro Hamaji
+
+        <input type=number>: Support auto-repeat by mouse press
+        https://bugs.webkit.org/show_bug.cgi?id=44476
+
+        Update existing tests.
+
+        * fast/forms/script-tests/input-spinbutton-capturing.js:
+        * platform/mac/fast/forms/input-appearance-spinbutton-up-expected.checksum:
+        * platform/mac/fast/forms/input-appearance-spinbutton-up-expected.png:
+        * platform/mac/fast/forms/input-appearance-spinbutton-up-expected.txt:
+
+2010-08-25  Kent Tamura  <tkent at chromium.org>
+
         Unreviewed, skip list update.
 
         input-spinbutton-capturing.html should be skipped in platforms
diff --git a/LayoutTests/fast/forms/script-tests/input-spinbutton-capturing.js b/LayoutTests/fast/forms/script-tests/input-spinbutton-capturing.js
index fc1ca9c..2c509a6 100644
--- a/LayoutTests/fast/forms/script-tests/input-spinbutton-capturing.js
+++ b/LayoutTests/fast/forms/script-tests/input-spinbutton-capturing.js
@@ -14,6 +14,7 @@ if (window.eventSender) {
     // There was a bug that a capturing flag of the first input field was not
     // clear and this click didn't work.
     eventSender.mouseMoveTo(anotherInput.offsetLeft + anotherInput.offsetWidth - 10, anotherInput.offsetTop + anotherInput.offsetHeight / 4);
+    eventSender.mouseMoveTo(anotherInput.offsetLeft + anotherInput.offsetWidth - 10, anotherInput.offsetTop + anotherInput.offsetHeight / 4 - 1);
     eventSender.mouseDown();
     eventSender.mouseUp();
     shouldBe('anotherInput.value', '"2"');
diff --git a/LayoutTests/platform/mac/fast/forms/input-appearance-spinbutton-up-expected.checksum b/LayoutTests/platform/mac/fast/forms/input-appearance-spinbutton-up-expected.checksum
index e524d20..a910f20 100644
--- a/LayoutTests/platform/mac/fast/forms/input-appearance-spinbutton-up-expected.checksum
+++ b/LayoutTests/platform/mac/fast/forms/input-appearance-spinbutton-up-expected.checksum
@@ -1 +1 @@
-5c1b34460d03938fffe006161914f725
\ No newline at end of file
+00e1de48e3e84449e88ede94e8e11b58
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/forms/input-appearance-spinbutton-up-expected.png b/LayoutTests/platform/mac/fast/forms/input-appearance-spinbutton-up-expected.png
index 92d6c46..eef391e 100644
Binary files a/LayoutTests/platform/mac/fast/forms/input-appearance-spinbutton-up-expected.png and b/LayoutTests/platform/mac/fast/forms/input-appearance-spinbutton-up-expected.png differ
diff --git a/LayoutTests/platform/mac/fast/forms/input-appearance-spinbutton-up-expected.txt b/LayoutTests/platform/mac/fast/forms/input-appearance-spinbutton-up-expected.txt
index 338365a..c529542 100644
--- a/LayoutTests/platform/mac/fast/forms/input-appearance-spinbutton-up-expected.txt
+++ b/LayoutTests/platform/mac/fast/forms/input-appearance-spinbutton-up-expected.txt
@@ -16,5 +16,5 @@ layer at (0,0) size 800x600
 layer at (13,47) size 165x21
   RenderBlock {DIV} at (3,3) size 165x21
     RenderText {#text} at (1,0) size 12x21
-      text run at (1,0) width 12: "0"
-caret: position 0 of child 0 {DIV} of child 5 {INPUT} of body
+      text run at (1,0) width 12: "1"
+caret: position 1 of child 0 {#text} of child 0 {DIV} of child 5 {INPUT} of body
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 0f156f4..cc335a3 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,26 @@
+2010-08-25  Kent Tamura  <tkent at chromium.org>
+
+        Reviewed by Shinichiro Hamaji
+
+        <input type=number>: Support auto-repeat by mouse press
+        https://bugs.webkit.org/show_bug.cgi?id=44476
+
+        Like arrow button of scrollbars, spinbuttons of <input
+        type=number> should continue to increase/decrease their values
+        while the mouse button is pressed.
+
+        No new tests because the new behavior strongly depends on a timer.
+
+        * rendering/TextControlInnerElements.cpp:
+        (WebCore::SpinButtonElement::SpinButtonElement):
+         Initializes the timer.
+        (WebCore::SpinButtonElement::defaultEventHandler):
+         Starts the timer by a mousedown event.
+        (WebCore::SpinButtonElement::startRepeatingTimer):
+        (WebCore::SpinButtonElement::stopRepeatingTimer):
+        (WebCore::SpinButtonElement::repeatingTimerFired):
+        * rendering/TextControlInnerElements.h:
+
 2010-08-25  Gabor Loki  <loki at webkit.org>
 
         Reviewed by Gavin Barraclough.
diff --git a/WebCore/rendering/TextControlInnerElements.cpp b/WebCore/rendering/TextControlInnerElements.cpp
index 5f1f099..1465580 100644
--- a/WebCore/rendering/TextControlInnerElements.cpp
+++ b/WebCore/rendering/TextControlInnerElements.cpp
@@ -39,6 +39,7 @@
 #include "Page.h"
 #include "RenderLayer.h"
 #include "RenderTextControlSingleLine.h"
+#include "ScrollbarTheme.h"
 #include "SpeechInput.h"
 
 namespace WebCore {
@@ -258,6 +259,8 @@ inline SpinButtonElement::SpinButtonElement(HTMLElement* shadowParent)
     : TextControlInnerElement(shadowParent->document(), shadowParent)
     , m_capturing(false)
     , m_upDownState(Indeterminate)
+    , m_pressStartingState(Indeterminate)
+    , m_repeatingTimer(this, &SpinButtonElement::repeatingTimerFired)
 {
 }
 
@@ -281,7 +284,6 @@ void SpinButtonElement::defaultEventHandler(Event* event)
         return;        
     }
     
-    MouseEvent* mouseEvent = static_cast<MouseEvent*>(event);
     HTMLInputElement* input = static_cast<HTMLInputElement*>(shadowAncestorNode());
     if (input->disabled() || input->isReadOnlyFormControl()) {
         if (!event->defaultHandled())
@@ -289,19 +291,20 @@ void SpinButtonElement::defaultEventHandler(Event* event)
         return;
     }
 
+    MouseEvent* mouseEvent = static_cast<MouseEvent*>(event);
     IntPoint local = roundedIntPoint(box->absoluteToLocal(mouseEvent->absoluteLocation(), false, true));
-    if (event->type() == eventNames().clickEvent && mouseEvent->button() == LeftButton) {
+    if (mouseEvent->type() == eventNames().mousedownEvent && mouseEvent->button() == LeftButton) {
         if (box->borderBoxRect().contains(local)) {
             RefPtr<Node> protector(input);
             input->focus();
             input->select();
-            if (local.y() < box->height() / 2)
-                input->stepUpFromRenderer(1);
-            else
-                input->stepUpFromRenderer(-1);
+            input->stepUpFromRenderer(m_upDownState == Up ? 1 : -1);
             event->setDefaultHandled();
+            startRepeatingTimer();
         }
-    } else if (event->type() == eventNames().mousemoveEvent) {
+    } else if (mouseEvent->type() == eventNames().mouseupEvent && mouseEvent->button() == LeftButton)
+        stopRepeatingTimer();
+    else if (event->type() == eventNames().mousemoveEvent) {
         if (box->borderBoxRect().contains(local)) {
             if (!m_capturing) {
                 if (Frame* frame = document()->frame()) {
@@ -315,6 +318,7 @@ void SpinButtonElement::defaultEventHandler(Event* event)
                 renderer()->repaint();
         } else {
             if (m_capturing) {
+                stopRepeatingTimer();
                 if (Frame* frame = document()->frame()) {
                     frame->eventHandler()->setCapturingMouseEventsNode(0);
                     m_capturing = false;
@@ -327,6 +331,33 @@ void SpinButtonElement::defaultEventHandler(Event* event)
         HTMLDivElement::defaultEventHandler(event);
 }
 
+void SpinButtonElement::startRepeatingTimer()
+{
+    m_pressStartingState = m_upDownState;
+    ScrollbarTheme* theme = ScrollbarTheme::nativeTheme();
+    m_repeatingTimer.start(theme->initialAutoscrollTimerDelay(), theme->autoscrollTimerDelay());
+}
+
+void SpinButtonElement::stopRepeatingTimer()
+{
+    m_repeatingTimer.stop();
+}
+
+void SpinButtonElement::repeatingTimerFired(Timer<SpinButtonElement>*)
+{
+    HTMLInputElement* input = static_cast<HTMLInputElement*>(shadowAncestorNode());
+    if (input->disabled() || input->isReadOnlyFormControl())
+        return;
+    // On Mac OS, NSStepper updates the value for the button under the mouse
+    // cursor regardless of the button pressed at the beginning. So the
+    // following check is not needed for Mac OS.
+#if !OS(MAC_OS_X)
+    if (m_upDownState != m_pressStartingState)
+        return;
+#endif
+    input->stepUpFromRenderer(m_upDownState == Up ? 1 : -1);
+}
+
 void SpinButtonElement::setHovered(bool flag)
 {
     if (!hovered() && flag)
diff --git a/WebCore/rendering/TextControlInnerElements.h b/WebCore/rendering/TextControlInnerElements.h
index 791d24d..c146a42 100644
--- a/WebCore/rendering/TextControlInnerElements.h
+++ b/WebCore/rendering/TextControlInnerElements.h
@@ -29,6 +29,7 @@
 
 #include "HTMLDivElement.h"
 #include "SpeechInputListener.h"
+#include "Timer.h"
 #include <wtf/Forward.h>
 
 namespace WebCore {
@@ -107,10 +108,15 @@ private:
     virtual bool isEnabledFormControl() const { return static_cast<Element*>(const_cast<SpinButtonElement*>(this)->shadowAncestorNode())->isEnabledFormControl(); }
     virtual bool isReadOnlyFormControl() const { return static_cast<Element*>(const_cast<SpinButtonElement*>(this)->shadowAncestorNode())->isReadOnlyFormControl(); }
     virtual void defaultEventHandler(Event*);
+    void startRepeatingTimer();
+    void stopRepeatingTimer();
+    void repeatingTimerFired(Timer<SpinButtonElement>*);
     virtual void setHovered(bool = true);
 
     bool m_capturing;
     UpDownState m_upDownState;
+    UpDownState m_pressStartingState;
+    Timer<SpinButtonElement> m_repeatingTimer;
 };
 
 #if ENABLE(INPUT_SPEECH)

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list