diff options
author | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-16 23:33:24 +0000 |
---|---|---|
committer | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-16 23:33:24 +0000 |
commit | 80cc00a3acaee44c537d72c8ccd9f0ad1103df3a (patch) | |
tree | 296c4c223c9ab13a19f2621be9de2cdf63c20ce5 | |
parent | 48c8fa63122510b2c51c6608a93b30e94192e679 (diff) | |
download | chromium_src-80cc00a3acaee44c537d72c8ccd9f0ad1103df3a.zip chromium_src-80cc00a3acaee44c537d72c8ccd9f0ad1103df3a.tar.gz chromium_src-80cc00a3acaee44c537d72c8ccd9f0ad1103df3a.tar.bz2 |
DOM wheel scroll delta fix, Chromium side. This depends on the WebKit side changes and can't be committed without first landing them and adding DEPS to this.
Review URL: http://codereview.chromium.org/48037
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@11801 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | DEPS | 2 | ||||
-rw-r--r-- | webkit/glue/event_conversion.cc | 2 | ||||
-rw-r--r-- | webkit/glue/webinputevent.h | 2 | ||||
-rw-r--r-- | webkit/glue/webinputevent_linux.cc | 6 | ||||
-rw-r--r-- | webkit/glue/webinputevent_mac.mm | 24 | ||||
-rw-r--r-- | webkit/glue/webinputevent_win.cc | 7 |
6 files changed, 31 insertions, 12 deletions
@@ -19,7 +19,7 @@ deps = { "http://googletest.googlecode.com/svn/trunk@167", "src/third_party/WebKit": - "/trunk/deps/third_party/WebKit@11758", + "/trunk/deps/third_party/WebKit@11800", "src/third_party/icu38": "/trunk/deps/third_party/icu38@11496", diff --git a/webkit/glue/event_conversion.cc b/webkit/glue/event_conversion.cc index a54f908..27125f2 100644 --- a/webkit/glue/event_conversion.cc +++ b/webkit/glue/event_conversion.cc @@ -125,6 +125,8 @@ MakePlatformWheelEvent::MakePlatformWheelEvent(Widget* widget, m_globalPosition = IntPoint(e.global_x, e.global_y); m_deltaX = e.delta_x; m_deltaY = e.delta_y; + m_wheelTicksX = e.wheel_ticks_x; + m_wheelTicksY = e.wheel_ticks_y; m_isAccepted = false; m_granularity = e.scroll_by_page ? ScrollByPageWheelEvent : ScrollByPixelWheelEvent; diff --git a/webkit/glue/webinputevent.h b/webkit/glue/webinputevent.h index b4d2279..351da4b 100644 --- a/webkit/glue/webinputevent.h +++ b/webkit/glue/webinputevent.h @@ -133,6 +133,8 @@ class WebMouseWheelEvent : public WebMouseEvent { public: float delta_x; float delta_y; + float wheel_ticks_x; + float wheel_ticks_y; bool scroll_by_page; WebMouseWheelEvent() {} diff --git a/webkit/glue/webinputevent_linux.cc b/webkit/glue/webinputevent_linux.cc index 799bbb2..8d81966 100644 --- a/webkit/glue/webinputevent_linux.cc +++ b/webkit/glue/webinputevent_linux.cc @@ -127,18 +127,24 @@ WebMouseWheelEvent::WebMouseWheelEvent(const GdkEventScroll* event) { delta_x = 0; delta_y = 0; + wheel_ticks_x = 0; + wheel_ticks_y = 0; switch (event->direction) { case GDK_SCROLL_UP: delta_y = kScrollbarPixelsPerTick; + wheel_ticks_y = 1; break; case GDK_SCROLL_DOWN: delta_y = -kScrollbarPixelsPerTick; + wheel_ticks_y = -1; break; case GDK_SCROLL_LEFT: delta_x = kScrollbarPixelsPerTick; + wheel_ticks_x = -1; // Match Windows positive/negative orientation break; case GDK_SCROLL_RIGHT: delta_x = -kScrollbarPixelsPerTick; + wheel_ticks_x = 1; break; default: break; diff --git a/webkit/glue/webinputevent_mac.mm b/webkit/glue/webinputevent_mac.mm index bcf9c5f..07e2b3a 100644 --- a/webkit/glue/webinputevent_mac.mm +++ b/webkit/glue/webinputevent_mac.mm @@ -21,7 +21,7 @@ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import <Cocoa/Cocoa.h> @@ -143,9 +143,13 @@ WebMouseWheelEvent::WebMouseWheelEvent(NSEvent *event, NSView* view) { if ([event modifierFlags] & NSShiftKeyMask) { delta_x = delta_lines; delta_y = 0; + wheel_ticks_x = wheel_delta; + wheel_ticks_y = 0; } else { delta_x = 0; delta_y = delta_lines; + wheel_ticks_x = 0; + wheel_ticks_y = wheel_delta; } scroll_by_page = false; } @@ -968,19 +972,19 @@ WebKeyboardEvent::WebKeyboardEvent(NSEvent *event) { NSString* text_str = WebCore::textFromEvent(event); NSString* unmodified_str = WebCore::unmodifiedTextFromEvent(event); NSString* identifier_str = WebCore::keyIdentifierForKeyEvent(event); - + // Begin Apple code, copied from KeyEventMac.mm - - // Always use 13 for Enter/Return -- we don't want to use AppKit's + + // Always use 13 for Enter/Return -- we don't want to use AppKit's // different character for Enter. if (windows_key_code == '\r') { text_str = @"\r"; unmodified_str = @"\r"; } - - // The adjustments below are only needed in backward compatibility mode, + + // The adjustments below are only needed in backward compatibility mode, // but we cannot tell what mode we are in from here. - + // Turn 0x7F into 8, because backspace needs to always be 8. if ([text_str isEqualToString:@"\x7F"]) text_str = @"\x8"; @@ -992,13 +996,13 @@ WebKeyboardEvent::WebKeyboardEvent(NSEvent *event) { text_str = @"\x9"; unmodified_str = @"\x9"; } - + // End Apple code. - + memset(&text, 0, sizeof(text)); memset(&unmodified_text, 0, sizeof(unmodified_text)); memset(&key_identifier, 0, sizeof(key_identifier)); - + if ([text_str length] < kTextLengthCap && [unmodified_str length] < kTextLengthCap) { [text_str getCharacters:&text[0]]; diff --git a/webkit/glue/webinputevent_win.cc b/webkit/glue/webinputevent_win.cc index b66f170..9dd4d85 100644 --- a/webkit/glue/webinputevent_win.cc +++ b/webkit/glue/webinputevent_win.cc @@ -206,7 +206,8 @@ WebMouseWheelEvent::WebMouseWheelEvent(HWND hwnd, // without feeling jerky. Here we use 100 px per three lines (the default // scroll amount is three lines per wheel tick). static const float kScrollbarPixelsPerLine = 100.0f / 3.0f; - float scroll_delta = wheel_delta / WHEEL_DELTA; + wheel_delta /= WHEEL_DELTA; + float scroll_delta = wheel_delta; if (horizontal_scroll) { unsigned long scroll_chars = kDefaultScrollCharsPerWheelDelta; SystemParametersInfo(SPI_GETWHEELSCROLLCHARS, 0, &scroll_chars, 0); @@ -229,9 +230,13 @@ WebMouseWheelEvent::WebMouseWheelEvent(HWND hwnd, if (horizontal_scroll) { delta_x = scroll_delta; delta_y = 0; + wheel_ticks_x = wheel_delta; + wheel_ticks_y = 0; } else { delta_x = 0; delta_y = scroll_delta; + wheel_ticks_x = 0; + wheel_ticks_y = wheel_delta; } } |