[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677

darin darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 08:26:50 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 91c3a8207c7732e5346dce6a5a689e1fea949bc6
Author: darin <darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Feb 16 18:18:17 2004 +0000

            Reviewed by Ken.
    
            - Fixed some dynamic casts that Dirk complained about to use virtual functions instead.
              Since the virtual functions were already there, this is faster and better in most
              ways anyway.
    
            * khtml/dom/dom2_events.cpp:
            (UIEvent::keyCode): Use virtual function instead of dynamic_cast.
            (UIEvent::charCode): Ditto.
            (UIEvent::pageX): Ditto.
            (UIEvent::pageY): Ditto.
            (UIEvent::layerX): Ditto.
            (UIEvent::layerY): Ditto.
            (UIEvent::which): Ditto.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@6093 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index fd39500..f788a73 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,20 @@
+2004-02-16  Darin Adler  <darin at apple.com>
+
+        Reviewed by Ken.
+
+        - Fixed some dynamic casts that Dirk complained about to use virtual functions instead.
+          Since the virtual functions were already there, this is faster and better in most
+          ways anyway.
+
+        * khtml/dom/dom2_events.cpp:
+        (UIEvent::keyCode): Use virtual function instead of dynamic_cast.
+        (UIEvent::charCode): Ditto.
+        (UIEvent::pageX): Ditto.
+        (UIEvent::pageY): Ditto.
+        (UIEvent::layerX): Ditto.
+        (UIEvent::layerY): Ditto.
+        (UIEvent::which): Ditto.
+
 2004-02-15  Darin Adler  <darin at apple.com>
 
         Reviewed by Dave.
@@ -159,7 +176,6 @@
         (KWQTextDecoder::convertLatin1):
 	Fix off by one error.
 
-
 2004-02-11  David Hyatt  <hyatt at apple.com>
 
 	Convert paint methods over to use a new PaintInfo struct.  Eliminate the paintObject method.
diff --git a/WebCore/khtml/dom/dom2_events.cpp b/WebCore/khtml/dom/dom2_events.cpp
index 7031450..468cf5f 100644
--- a/WebCore/khtml/dom/dom2_events.cpp
+++ b/WebCore/khtml/dom/dom2_events.cpp
@@ -285,9 +285,8 @@ int UIEvent::keyCode() const
     if (!impl)
 	throw DOMException(DOMException::INVALID_STATE_ERR);
     
-    KeyboardEventImpl *keyEvent = dynamic_cast<KeyboardEventImpl*>(impl);
-    if (keyEvent)
-        return keyEvent->keyCode();
+    if (impl->isKeyboardEvent())
+        return static_cast<KeyboardEventImpl*>(impl)->keyCode();
     else
         return 0;
 }
@@ -297,9 +296,8 @@ int UIEvent::charCode() const
     if (!impl)
 	throw DOMException(DOMException::INVALID_STATE_ERR);
     
-    KeyboardEventImpl *keyEvent = dynamic_cast<KeyboardEventImpl*>(impl);
-    if (keyEvent)
-        return keyEvent->charCode();
+    if (impl->isKeyboardEvent())
+        return static_cast<KeyboardEventImpl*>(impl)->charCode();
     else
         return 0;
 }
@@ -309,9 +307,8 @@ int UIEvent::pageX() const
     if (!impl)
 	throw DOMException(DOMException::INVALID_STATE_ERR);
     
-    MouseEventImpl *mouseEvent = dynamic_cast<MouseEventImpl*>(impl);
-    if (mouseEvent)
-        return mouseEvent->clientX();
+    if (impl->isMouseEvent())
+        return static_cast<MouseEventImpl*>(impl)->clientX();
     else
         return 0;
 }
@@ -321,9 +318,8 @@ int UIEvent::pageY() const
     if (!impl)
 	throw DOMException(DOMException::INVALID_STATE_ERR);
     
-    MouseEventImpl *mouseEvent = dynamic_cast<MouseEventImpl*>(impl);
-    if (mouseEvent)
-        return  mouseEvent->clientY();
+    if (impl->isMouseEvent())
+        return static_cast<MouseEventImpl*>(impl)->clientY();
     else
         return 0;
 }
@@ -333,9 +329,8 @@ int UIEvent::layerX() const
     if (!impl)
 	throw DOMException(DOMException::INVALID_STATE_ERR);
     
-    MouseEventImpl *mouseEvent = dynamic_cast<MouseEventImpl*>(impl);
-    if (mouseEvent)
-        return mouseEvent->layerX();
+    if (impl->isMouseEvent())
+        return static_cast<MouseEventImpl*>(impl)->layerX();
     else
         return 0;
 }
@@ -345,9 +340,8 @@ int UIEvent::layerY() const
     if (!impl)
 	throw DOMException(DOMException::INVALID_STATE_ERR);
     
-    MouseEventImpl *mouseEvent = dynamic_cast<MouseEventImpl*>(impl);
-    if (mouseEvent)
-        return  mouseEvent->layerY();
+    if (impl->isMouseEvent())
+        return static_cast<MouseEventImpl*>(impl)->layerY();
     else
         return 0;
 }
@@ -361,16 +355,14 @@ int UIEvent::which() const
 
     // Netscape's "which" returns a virtual key code for keydown and keyup, and a character code for keypress.
     // That's exactly what IE's "keyCode" returns.
-    KeyboardEventImpl *keyEvent = dynamic_cast<KeyboardEventImpl*>(impl);
-    if (keyEvent)
-        return keyEvent->keyCode();
+    if (impl->isKeyboardEvent())
+        return static_cast<KeyboardEventImpl*>(impl)->keyCode();
 
     // For khtml, the return values for left, middle and right mouse buttons are 0, 1, 2, respectively.
     // For the Netscape "which" property, the return values for left, middle and right mouse buttons are 1, 2, 3, respectively. 
     // So we can just add 1 to the value returned by calling button().
-    MouseEventImpl *mouseEvent = dynamic_cast<MouseEventImpl*>(impl);
-    if (mouseEvent)
-        return mouseEvent->button() + 1;
+    if (impl->isMouseEvent())
+        return static_cast<MouseEventImpl*>(impl)->button() + 1;
 
     return 0;
 }

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list