QtWebKitTodo: api_changes.txt

File api_changes.txt, 5.1 KB (added by Simon Hausmann, 11 years ago)

Diff of the suggested API changes after another round of review

Line 
1diff --git a/WebKit/qt/Api/qwebelement.h b/WebKit/qt/Api/qwebelement.h
2index 0feeb5f..5580ab7 100644
3--- a/WebKit/qt/Api/qwebelement.h
4+++ b/WebKit/qt/Api/qwebelement.h
5@@ -47,19 +47,19 @@ public:
6 
7     bool isNull() const;
8 
9-    QWebElementCollection findAll(const QString &query) const;
10-    QWebElement findFirst(const QString &query) const;
11+    QWebElementCollection findAll(const QString &selectorQuery) const;
12+    // document that it's an optimization
13+    QWebElement findFirst(const QString &selectorQuery) const;
14 
15     void setPlainText(const QString &text);
16     QString toPlainText() const;
17 
18-    enum XmlScope {
19-        InnerXml,
20-        OuterXml
21-    };
22+    void setOuterXml(const QString &markup);
23+    QString toOuterXml() const;
24 
25-    void setXml(XmlScope scope, const QString &markup);
26-    QString toXml(XmlScope scope) const;
27+    void setInnerXml(const QString &markup);
28+    void setInnerXml(const QWebElement &element);
29+    QString toInnerXml() const;
30 
31     void setAttribute(const QString &name, const QString &value);
32     void setAttributeNS(const QString &namespaceUri, const QString &name, const QString &value);
33@@ -76,52 +76,76 @@ public:
34     void addClass(const QString &name);
35     void removeClass(const QString &name);
36     void toggleClass(const QString &name);
37-    void toggleClass(const QString &name, bool enabled);
38 
39     QRect geometry() const;
40 
41+    // ### compare to QXmlStreamReader, aim for consistency
42     QString tagName() const;
43     QString prefix() const;
44     QString localName() const;
45-    QString namespaceURI() const;
46+    QString namespaceUri() const;
47+
48+    // ### docs need to mention that iteration might be
49+    // faster
50+    QWebElementCollection children() const;
51+    bool hasChildren() const;
52 
53     QWebElement parent() const;
54-    QWebElement firstChild(const QString &tagName = QString()) const;
55-    QWebElement lastChild(const QString &tagName = QString()) const;
56-    QWebElement nextSibling(const QString &tagName = QString()) const;
57-    QWebElement previousSibling(const QString &tagName = QString()) const;
58+    QWebElement firstChild() const;
59+    QWebElement lastChild() const;
60+    QWebElement nextSibling() const;
61+    QWebElement previousSibling() const;
62     QWebElement document() const;
63     QWebFrame *webFrame() const;
64 
65     // TODO: Add QWebElementCollection overloads
66-    void append(const QString &markup);
67-    void append(QWebElement element);
68+    // docs need example snippet
69+    void appendInside(const QString &markup);
70+    void appendInside(QWebElement element);
71 
72-    void prepend(const QString &markup);
73-    void prepend(QWebElement element);
74+    // docs need example snippet
75+    void prependInside(const QString &markup);
76+    void prependInside(QWebElement element);
77 
78-    void insertBefore(const QString &markup);
79-    void insertBefore(QWebElement element);
80+    // docs need example snippet
81+    void appendOutside(const QString &markup);
82+    void appendOutside(const QWebElement &element);
83 
84-    void insertAfter(const QString &markup);
85-    void insertAfter(QWebElement element);
86+    // docs need example snippet
87+    void prependOutside(const QString &markup);
88+    void prependOutside(const QWebElement &element);
89 
90+    // docs need example snippet
91+    void wrapContents(const QString &markup);
92+    void wrapContents(const QWebElement &element);
93+
94+    // docs need example snippet
95     void wrap(const QString &markup);
96-    void wrap(QWebElement element);
97+    void wrap(const QWebElement &element);
98+
99+    void replace(const QString &markup);
100+    void replace(const QWebElement &element);
101 
102-    void replaceWith(const QString &markup);
103-    void replaceWith(QWebElement element);
104+    QWebElement clone() const;
105+    QWebElement &takeFromDocument();
106+    void removeFromDocument();
107+    void removeChildren();
108 
109-    QWebElement clone();
110-    QWebElement &remove();
111-    void clear();
112+    // when we integrate with QtScript we have to change
113+    // these functions to use QScriptValue
114+    QVariant evaluateScript(const QString &script,... args);
115 
116-    QVariant callScriptFunction(const QString &name, const QVariantList &arguments = QVariantList());
117-    QStringList scriptFunctions() const;
118+    // QScriptValue scriptValue() const
119 
120-    QVariant scriptProperty(const QString &name) const;
121-    void setScriptProperty(const QString &name, const QVariant &value);
122-    QStringList scriptProperties() const;
123+    // element.scriptValue().property("submit").call();
124+    // element.callFunction("submit");
125+
126+    QVariant callFunction(const QString &functionName, const QVariantList &arguments = QVariantList());
127+    QStringList functions() const;
128+
129+    QVariant scriptableProperty(const QString &name) const;
130+    void setScriptableProperty(const QString &name, const QVariant &value);
131+    QStringList scriptableProperties() const;
132 
133     QString styleProperty(const QString &name) const;
134     void setStyleProperty(const QString &name, const QString &value);
135@@ -157,6 +181,9 @@ public:
136     }
137 
138     void append(const QWebElementCollection &collection);
139+    void append(const QWebElement &element);
140+
141+    bool isEmpty() const;
142 
143     int count() const;
144     QWebElement at(int i) const;