[webkit-changes] cvs commit: WebCore/khtml/xml dom_elementimpl.cpp
dom_elementimpl.h
Vicki
vicki at opensource.apple.com
Wed Aug 3 18:58:22 PDT 2005
vicki 05/08/03 18:58:22
Modified: . Tag: Safari-2-0-branch ChangeLog
khtml/dom Tag: Safari-2-0-branch dom_element.cpp
dom_element.h
khtml/ecma Tag: Safari-2-0-branch kjs_dom.cpp kjs_dom.h
kjs_dom.lut.h
khtml/xml Tag: Safari-2-0-branch dom_elementimpl.cpp
dom_elementimpl.h
Log:
Merge this fix from TOT to Safari-2-0-branch
2005-07-19 Vicki Murley <vicki at apple.com>
Reviewed by Maciej.
- fixed <rdar://problem/3471901> support scrollIntoView method for DOM elements (3474)
Test cases added:
* manual-tests/scrollIntoView-horizontal.html: Added.
* manual-tests/scrollIntoView-vertical.html: Added.
* khtml/xml/dom_elementimpl.h:
* khtml/xml/dom_elementimpl.cpp:
(ElementImpl::scrollIntoView): Added.
* khtml/ecma/kjs_dom.h:
(KJS::DOMNode::):
(KJS::DOMElement::):
* khtml/ecma/kjs_dom.cpp:
(KJS::DOMElementProtoFunc::tryCall): glue for new scrollIntoView function
(these two files were modified on the branch only, not required in TOT fix)
* khtml/dom/dom_element.cpp:
(Element::scrollIntoView):
* khtml/dom/dom_element.h:
Revision Changes Path
No revision
No revision
1.4104.2.89 +28 -0 WebCore/ChangeLog
Index: ChangeLog
===================================================================
RCS file: /cvs/root/WebCore/ChangeLog,v
retrieving revision 1.4104.2.88
retrieving revision 1.4104.2.89
diff -u -r1.4104.2.88 -r1.4104.2.89
--- ChangeLog 3 Aug 2005 20:55:02 -0000 1.4104.2.88
+++ ChangeLog 4 Aug 2005 01:58:01 -0000 1.4104.2.89
@@ -1,3 +1,31 @@
+2005-08-03 Vicki Murley <vicki at apple.com>
+
+ Merge this fix from TOT to Safari-2-0-branch
+
+ 2005-07-19 Vicki Murley <vicki at apple.com>
+
+ Reviewed by Maciej.
+
+ - fixed <rdar://problem/3471901> support scrollIntoView method for DOM elements (3474)
+
+ Test cases added:
+ * manual-tests/scrollIntoView-horizontal.html: Added.
+ * manual-tests/scrollIntoView-vertical.html: Added.
+
+ * khtml/xml/dom_elementimpl.h:
+ * khtml/xml/dom_elementimpl.cpp:
+ (ElementImpl::scrollIntoView): Added.
+ * khtml/ecma/kjs_dom.h:
+ (KJS::DOMNode::):
+ (KJS::DOMElement::):
+ * khtml/ecma/kjs_dom.cpp:
+ (KJS::DOMElementProtoFunc::tryCall): glue for new scrollIntoView function
+
+ (these two files were modified on the branch only, not required in TOT fix)
+ * khtml/dom/dom_element.cpp:
+ (Element::scrollIntoView):
+ * khtml/dom/dom_element.h:
+
2005-08-03 Adele Peterson <adele at apple.com>
Merged fix from TOT to Safari-2-0-branch
No revision
No revision
1.9.18.1 +6 -0 WebCore/khtml/dom/Attic/dom_element.cpp
Index: dom_element.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/dom/Attic/dom_element.cpp,v
retrieving revision 1.9
retrieving revision 1.9.18.1
diff -u -r1.9 -r1.9.18.1
--- dom_element.cpp 10 Feb 2004 20:52:11 -0000 1.9
+++ dom_element.cpp 4 Aug 2005 01:58:18 -0000 1.9.18.1
@@ -288,6 +288,12 @@
return static_cast<ElementImpl*>(impl)->attributes(true)->getAttributeItem(id) != 0;
}
+void Element::scrollIntoView (bool alignToTop)
+{
+ if(!impl) return;
+ static_cast<ElementImpl*>(impl)->scrollIntoView(alignToTop);
+}
+
bool Element::isHTMLElement() const
{
if(!impl) return false;
1.6.80.1 +9 -0 WebCore/khtml/dom/Attic/dom_element.h
Index: dom_element.h
===================================================================
RCS file: /cvs/root/WebCore/khtml/dom/Attic/dom_element.h,v
retrieving revision 1.6
retrieving revision 1.6.80.1
diff -u -r1.6 -r1.6.80.1
--- dom_element.h 26 Oct 2002 23:21:42 -0000 1.6
+++ dom_element.h 4 Aug 2005 01:58:18 -0000 1.6.80.1
@@ -535,6 +535,15 @@
const DOMString &localName );
/**
+ * There is no public standard that applies to this method.
+ *
+ * @param alignToTop Optional. Boolean that specifies one of the following values:
+ true Default. Scrolls the object so that top of the object is visible at the top of the window.
+ false Scrolls the object so that the bottom of the object is visible at the bottom of the window.
+ **/
+ void scrollIntoView (bool alignToTop);
+
+ /**
* Introduced in DOM Level 2
* This method is from the CSSStyleDeclaration interface
*
No revision
No revision
1.66.6.10 +5 -0 WebCore/khtml/ecma/kjs_dom.cpp
Index: kjs_dom.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/ecma/kjs_dom.cpp,v
retrieving revision 1.66.6.9
retrieving revision 1.66.6.10
diff -u -r1.66.6.9 -r1.66.6.10
--- kjs_dom.cpp 2 Aug 2005 21:26:14 -0000 1.66.6.9
+++ kjs_dom.cpp 4 Aug 2005 01:58:19 -0000 1.66.6.10
@@ -1107,6 +1107,8 @@
setAttributeNodeNS DOMElement::SetAttributeNodeNS DontDelete|Function 1
getElementsByTagNameNS DOMElement::GetElementsByTagNameNS DontDelete|Function 2
hasAttributeNS DOMElement::HasAttributeNS DontDelete|Function 2
+ scrollIntoView DOMElement::ScrollIntoView DontDelete|Function 1
+
# extension for Safari RSS
scrollByLines DOMElement::ScrollByLines DontDelete|Function 1
scrollByPages DOMElement::ScrollByPages DontDelete|Function 1
@@ -1217,6 +1219,9 @@
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::ScrollIntoView:
+ (args[0].type() != UndefinedType && args[0].type() != NullType) ? element.scrollIntoView(args[0].toBoolean(exec)) : element.scrollIntoView(true);
+ return Undefined();
case DOMElement::ScrollByLines:
case DOMElement::ScrollByPages:
{
1.34.6.6 +2 -2 WebCore/khtml/ecma/kjs_dom.h
Index: kjs_dom.h
===================================================================
RCS file: /cvs/root/WebCore/khtml/ecma/kjs_dom.h,v
retrieving revision 1.34.6.5
retrieving revision 1.34.6.6
diff -u -r1.34.6.5 -r1.34.6.6
--- kjs_dom.h 2 Aug 2005 21:26:14 -0000 1.34.6.5
+++ kjs_dom.h 4 Aug 2005 01:58:19 -0000 1.34.6.6
@@ -69,7 +69,7 @@
OnMouseMove, OnMouseOut, OnMouseOver, OnMouseUp, OnMouseWheel, OnMove, OnReset,
OnResize, OnScroll, OnSearch, OnSelect, OnSubmit, OnUnload,
OffsetLeft, OffsetTop, OffsetWidth, OffsetHeight, OffsetParent,
- ClientWidth, ClientHeight, ScrollLeft, ScrollTop, ScrollWidth, ScrollHeight };
+ ClientWidth, ClientHeight, ScrollLeft, ScrollTop, ScrollWidth, ScrollHeight, ScrollIntoView };
protected:
DOM::Node node;
@@ -159,7 +159,7 @@
SetAttributeNode, RemoveAttributeNode, GetElementsByTagName,
GetAttributeNS, SetAttributeNS, RemoveAttributeNS, GetAttributeNodeNS,
SetAttributeNodeNS, GetElementsByTagNameNS, HasAttribute, HasAttributeNS,
- ScrollByLines, ScrollByPages};
+ ScrollByLines, ScrollByPages, ScrollIntoView};
};
class DOMDOMImplementation : public DOMObject {
1.16.8.3 +5 -4 WebCore/khtml/ecma/Attic/kjs_dom.lut.h
Index: kjs_dom.lut.h
===================================================================
RCS file: /cvs/root/WebCore/khtml/ecma/Attic/kjs_dom.lut.h,v
retrieving revision 1.16.8.2
retrieving revision 1.16.8.3
diff -u -r1.16.8.2 -r1.16.8.3
--- kjs_dom.lut.h 1 Jul 2005 22:36:03 -0000 1.16.8.2
+++ kjs_dom.lut.h 4 Aug 2005 01:58:19 -0000 1.16.8.3
@@ -213,7 +213,7 @@
{ "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, &DOMElementProtoTableEntries[19] },
+ { "hasAttribute", DOMElement::HasAttribute, DontDelete|Function, 1, &DOMElementProtoTableEntries[20] },
{ "getElementsByTagNameNS", DOMElement::GetElementsByTagNameNS, DontDelete|Function, 2, 0 },
{ 0, 0, 0, 0, 0 },
{ "getAttributeNode", DOMElement::GetAttributeNode, DontDelete|Function, 1, 0 },
@@ -221,16 +221,17 @@
{ 0, 0, 0, 0, 0 },
{ "removeAttributeNS", DOMElement::RemoveAttributeNS, DontDelete|Function, 2, &DOMElementProtoTableEntries[18] },
{ "setAttributeNS", DOMElement::SetAttributeNS, DontDelete|Function, 3, 0 },
- { "hasAttributeNS", DOMElement::HasAttributeNS, DontDelete|Function, 2, 0 },
+ { "hasAttributeNS", DOMElement::HasAttributeNS, DontDelete|Function, 2, &DOMElementProtoTableEntries[19] },
{ 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, &DOMElementProtoTableEntries[20] },
+ { "setAttributeNodeNS", DOMElement::SetAttributeNodeNS, DontDelete|Function, 1, &DOMElementProtoTableEntries[21] },
+ { "scrollIntoView", DOMElement::ScrollIntoView, DontDelete|Function, 1, 0 },
{ "scrollByLines", DOMElement::ScrollByLines, DontDelete|Function, 1, 0 },
{ "scrollByPages", DOMElement::ScrollByPages, DontDelete|Function, 1, 0 }
};
-const struct HashTable DOMElementProtoTable = { 2, 21, DOMElementProtoTableEntries, 17 };
+const struct HashTable DOMElementProtoTable = { 2, 22, DOMElementProtoTableEntries, 17 };
} // namespace
No revision
No revision
1.61.6.3 +17 -0 WebCore/khtml/xml/dom_elementimpl.cpp
Index: dom_elementimpl.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/xml/dom_elementimpl.cpp,v
retrieving revision 1.61.6.2
retrieving revision 1.61.6.3
diff -u -r1.61.6.2 -r1.61.6.3
--- dom_elementimpl.cpp 22 Jul 2005 03:09:51 -0000 1.61.6.2
+++ dom_elementimpl.cpp 4 Aug 2005 01:58:20 -0000 1.61.6.3
@@ -32,6 +32,7 @@
#include "xml/dom_elementimpl.h"
#include "khtml_part.h"
+#include "khtmlview.h"
#include "html/dtd.h"
#include "html/htmlparser.h"
@@ -258,6 +259,22 @@
return nullAtom;
}
+void ElementImpl::scrollIntoView(bool alignToTop)
+{
+ KHTMLView *v = getDocument()->view();
+ QRect bounds = this->getRect();
+ int x, y, xe, ye;
+ x = bounds.left();
+ y = bounds.top();
+ xe = bounds.right();
+ ye = bounds.bottom();
+
+ if (alignToTop)
+ v->setContentsPos(x, y);
+ else
+ v->ensureVisible(x, y, xe-x, ye-y);
+}
+
const AtomicString& ElementImpl::getAttributeNS(const DOMString &namespaceURI,
const DOMString &localName) const
{
1.35.8.3 +2 -0 WebCore/khtml/xml/dom_elementimpl.h
Index: dom_elementimpl.h
===================================================================
RCS file: /cvs/root/WebCore/khtml/xml/dom_elementimpl.h,v
retrieving revision 1.35.8.2
retrieving revision 1.35.8.3
diff -u -r1.35.8.2 -r1.35.8.3
--- dom_elementimpl.h 22 Jul 2005 03:09:51 -0000 1.35.8.2
+++ dom_elementimpl.h 4 Aug 2005 01:58:20 -0000 1.35.8.3
@@ -170,6 +170,8 @@
void removeAttribute( NodeImpl::Id id, int &exceptioncode );
bool hasAttributes() const;
+ void scrollIntoView (bool alignToTop);
+
DOMString prefix() const { return m_prefix; }
void setPrefix(const DOMString &_prefix, int &exceptioncode );
More information about the webkit-changes
mailing list