Fixed: <rdar://problem/3774243> page up/down, arrow up/down, etc in Safari RSS shoul...
authorcblu <cblu@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 26 Oct 2004 22:13:02 +0000 (22:13 +0000)
committercblu <cblu@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 26 Oct 2004 22:13:02 +0000 (22:13 +0000)
        Reviewed by dave.

        * khtml/ecma/kjs_dom.cpp:
        (DOMElementProtoFunc::tryCall): added scrollByLines and scrollByPages to HTML element for Safari RSS
        * khtml/ecma/kjs_dom.h:
        (KJS::DOMElement::):
        * khtml/ecma/kjs_dom.lut.h:
        (KJS::):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@7901 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog-2005-08-23
WebCore/khtml/ecma/kjs_dom.cpp
WebCore/khtml/ecma/kjs_dom.h
WebCore/khtml/ecma/kjs_dom.lut.h

index a652a1581ec1bb70a984518ec29b13cfb19138b8..ae8b88eddd59db47abb4d579818a50da5d51d782 100644 (file)
@@ -1,3 +1,16 @@
+2004-10-26  Chris Blumenberg  <cblu@apple.com>
+
+       Fixed: <rdar://problem/3774243> page up/down, arrow up/down, etc in Safari RSS should scroll main content
+
+        Reviewed by dave.
+
+        * khtml/ecma/kjs_dom.cpp:
+        (DOMElementProtoFunc::tryCall): added scrollByLines and scrollByPages to HTML element for Safari RSS
+        * khtml/ecma/kjs_dom.h:
+        (KJS::DOMElement::):
+        * khtml/ecma/kjs_dom.lut.h:
+        (KJS::):
+
 2004-10-26  David Hyatt  <hyatt@apple.com>
 
        Fix for 3848214, deleting a partial word left a repaint artifact if the partial word was pulled back onto
index 12e97b5bac9c8948d3eef35b28442c6da2aadb7d..b44070c435dd10e071ed05646b281b590faba4d7 100644 (file)
@@ -1034,6 +1034,10 @@ Value DOMDocumentProtoFunc::tryCall(ExecState *exec, Object &thisObj, const List
   setAttributeNodeNS   DOMElement::SetAttributeNodeNS  DontDelete|Function 1
   getElementsByTagNameNS DOMElement::GetElementsByTagNameNS    DontDelete|Function 2
   hasAttributeNS       DOMElement::HasAttributeNS      DontDelete|Function 2
+# extension for Safari RSS
+  scrollByLines         DOMElement::ScrollByLines       DontDelete|Function 1
+  scrollByPages         DOMElement::ScrollByPages       DontDelete|Function 1
+
 @end
 */
 DEFINE_PROTOTYPE("DOMElement",DOMElementProto)
@@ -1134,6 +1138,27 @@ Value DOMElementProtoFunc::tryCall(ExecState *exec, Object &thisObj, const List
       return getDOMNodeList(exec,element.getElementsByTagNameNS(args[0].toString(exec).string(),args[1].toString(exec).string()));
     case DOMElement::HasAttributeNS: // DOM2
       return Boolean(element.hasAttributeNS(args[0].toString(exec).string(),args[1].toString(exec).string()));
+    case DOMElement::ScrollByLines:
+    case DOMElement::ScrollByPages:
+    {
+        DOM::DocumentImpl* docimpl = node.handle()->getDocument();
+        if (docimpl) {
+            docimpl->updateLayoutIgnorePendingStylesheets();
+        }            
+        khtml::RenderObject *rend = node.handle() ? node.handle()->renderer() : 0L;
+        if (rend && rend->hasOverflowClip()) {
+            KWQScrollDirection direction = KWQScrollDown;
+            int multiplier = args[0].toInt32(exec);
+            if (multiplier < 0) {
+                direction = KWQScrollUp;
+                multiplier = -multiplier;
+            }
+            KWQScrollGranularity granularity = id == DOMElement::ScrollByLines ? KWQScrollLine : KWQScrollPage;
+            rend->layer()->scroll(direction, granularity, multiplier);
+        }
+        return Undefined();
+        
+    }
   default:
     return Undefined();
   }
index c789d44a4d6fe7c0f9938dfaec2056b371fcf558..343c67e382669c7e778690bc120bfc1f27cedb6a 100644 (file)
@@ -157,7 +157,8 @@ namespace KJS {
            GetAttribute, SetAttribute, RemoveAttribute, GetAttributeNode,
            SetAttributeNode, RemoveAttributeNode, GetElementsByTagName,
            GetAttributeNS, SetAttributeNS, RemoveAttributeNS, GetAttributeNodeNS,
-           SetAttributeNodeNS, GetElementsByTagNameNS, HasAttribute, HasAttributeNS };
+           SetAttributeNodeNS, GetElementsByTagNameNS, HasAttribute, HasAttributeNS,
+           ScrollByLines, ScrollByPages};
   };
 
   class DOMDOMImplementation : public DOMObject {
index 48c72359fae2e43d7b2fcda7f1505262a38500d6..8dcc4d5da53cdf96dcd0081875023e03fc7f1745 100644 (file)
@@ -211,7 +211,7 @@ const struct HashEntry DOMElementProtoTableEntries[] = {
    { "removeAttributeNode", DOMElement::RemoveAttributeNode, DontDelete|Function, 1, 0 },
    { "removeAttribute", DOMElement::RemoveAttribute, DontDelete|Function, 1, &DOMElementProtoTableEntries[17] },
    { "setAttribute", DOMElement::SetAttribute, DontDelete|Function, 2, 0 },
-   { "hasAttribute", DOMElement::HasAttribute, DontDelete|Function, 1, 0 },
+   { "hasAttribute", DOMElement::HasAttribute, DontDelete|Function, 1, &DOMElementProtoTableEntries[19] },
    { "getElementsByTagNameNS", DOMElement::GetElementsByTagNameNS, DontDelete|Function, 2, 0 },
    { 0, 0, 0, 0, 0 },
    { "getAttributeNode", DOMElement::GetAttributeNode, DontDelete|Function, 1, 0 },
@@ -223,10 +223,12 @@ const struct HashEntry DOMElementProtoTableEntries[] = {
    { 0, 0, 0, 0, 0 },
    { "getElementsByTagName", DOMElement::GetElementsByTagName, DontDelete|Function, 1, 0 },
    { "setAttributeNode", DOMElement::SetAttributeNode, DontDelete|Function, 2, 0 },
-   { "setAttributeNodeNS", DOMElement::SetAttributeNodeNS, DontDelete|Function, 1, 0 }
+   { "setAttributeNodeNS", DOMElement::SetAttributeNodeNS, DontDelete|Function, 1, &DOMElementProtoTableEntries[20] },
+   { "scrollByLines", DOMElement::ScrollByLines, DontDelete|Function, 1, 0 },
+   { "scrollByPages", DOMElement::ScrollByPages, DontDelete|Function, 1, 0 }
 };
 
-const struct HashTable DOMElementProtoTable = { 2, 19, DOMElementProtoTableEntries, 17 };
+const struct HashTable DOMElementProtoTable = { 2, 21, DOMElementProtoTableEntries, 17 };
 
 } // namespace