summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/webkit/WebKit/qt
diff options
context:
space:
mode:
Diffstat (limited to 'src/3rdparty/webkit/WebKit/qt')
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Api/headers.pri3
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Api/qwebdatabase.cpp20
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Api/qwebelement.cpp1603
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Api/qwebelement.h153
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Api/qwebframe.cpp284
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Api/qwebframe.h17
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Api/qwebframe_p.h10
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Api/qwebkitglobal.h22
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp177
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Api/qwebpage.h30
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Api/qwebpage_p.h5
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Api/qwebsecurityorigin.cpp23
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.cpp96
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.h8
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp121
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Api/qwebview.h9
-rw-r--r--src/3rdparty/webkit/WebKit/qt/ChangeLog1448
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Plugins/ICOHandler.cpp1
-rw-r--r--src/3rdparty/webkit/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp25
-rw-r--r--src/3rdparty/webkit/WebKit/qt/WebCoreSupport/ChromeClientQt.h16
-rw-r--r--src/3rdparty/webkit/WebKit/qt/WebCoreSupport/DragClientQt.cpp1
-rw-r--r--src/3rdparty/webkit/WebKit/qt/WebCoreSupport/EditCommandQt.cpp1
-rw-r--r--src/3rdparty/webkit/WebKit/qt/WebCoreSupport/EditorClientQt.cpp15
-rw-r--r--src/3rdparty/webkit/WebKit/qt/WebCoreSupport/EditorClientQt.h1
-rw-r--r--src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp59
-rw-r--r--src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h11
-rw-r--r--src/3rdparty/webkit/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp6
-rw-r--r--src/3rdparty/webkit/WebKit/qt/WebCoreSupport/InspectorClientQt.h2
-rw-r--r--src/3rdparty/webkit/WebKit/qt/docs/qtwebkit.qdoc3
-rw-r--r--src/3rdparty/webkit/WebKit/qt/docs/webkitsnippets/webelement/main.cpp69
-rw-r--r--src/3rdparty/webkit/WebKit/qt/docs/webkitsnippets/webelement/webelement.pro5
-rw-r--r--src/3rdparty/webkit/WebKit/qt/tests/qwebelement/qwebelement.pro7
-rw-r--r--src/3rdparty/webkit/WebKit/qt/tests/qwebelement/qwebelement.qrc6
-rw-r--r--src/3rdparty/webkit/WebKit/qt/tests/qwebelement/style.css1
-rw-r--r--src/3rdparty/webkit/WebKit/qt/tests/qwebelement/style2.css1
-rw-r--r--src/3rdparty/webkit/WebKit/qt/tests/qwebelement/tst_qwebelement.cpp882
-rw-r--r--src/3rdparty/webkit/WebKit/qt/tests/qwebframe/qwebframe.qrc1
-rw-r--r--src/3rdparty/webkit/WebKit/qt/tests/qwebframe/style.css1
-rw-r--r--src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp63
-rw-r--r--src/3rdparty/webkit/WebKit/qt/tests/qwebpage/frametest/frame_a.html2
-rw-r--r--src/3rdparty/webkit/WebKit/qt/tests/qwebpage/frametest/index.html4
-rw-r--r--src/3rdparty/webkit/WebKit/qt/tests/qwebpage/qwebpage.pro1
-rw-r--r--src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp99
-rw-r--r--src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.qrc7
-rw-r--r--src/3rdparty/webkit/WebKit/qt/tests/qwebview/.gitignore1
-rw-r--r--src/3rdparty/webkit/WebKit/qt/tests/qwebview/qwebview.pro6
-rw-r--r--src/3rdparty/webkit/WebKit/qt/tests/qwebview/tst_qwebview.cpp165
-rw-r--r--src/3rdparty/webkit/WebKit/qt/tests/tests.pro2
48 files changed, 5273 insertions, 220 deletions
diff --git a/src/3rdparty/webkit/WebKit/qt/Api/headers.pri b/src/3rdparty/webkit/WebKit/qt/Api/headers.pri
index 2b3c940..e4bb618 100644
--- a/src/3rdparty/webkit/WebKit/qt/Api/headers.pri
+++ b/src/3rdparty/webkit/WebKit/qt/Api/headers.pri
@@ -5,4 +5,5 @@ WEBKIT_API_HEADERS = $$PWD/qwebframe.h \
$$PWD/qwebsettings.h \
$$PWD/qwebhistoryinterface.h \
$$PWD/qwebdatabase.h \
- $$PWD/qwebsecurityorigin.h
+ $$PWD/qwebsecurityorigin.h \
+ $$PWD/qwebelement.h
diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebdatabase.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebdatabase.cpp
index 489ab17..2db9cd0 100644
--- a/src/3rdparty/webkit/WebKit/qt/Api/qwebdatabase.cpp
+++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebdatabase.cpp
@@ -19,6 +19,7 @@
#include "config.h"
#include "qwebdatabase.h"
+
#include "qwebdatabase_p.h"
#include "qwebsecurityorigin.h"
#include "qwebsecurityorigin_p.h"
@@ -69,8 +70,12 @@ QString QWebDatabase::name() const
*/
QString QWebDatabase::displayName() const
{
+#if ENABLE(DATABASE)
DatabaseDetails details = DatabaseTracker::tracker().detailsForNameAndOrigin(d->name, d->origin.get());
return details.displayName();
+#else
+ return QString();
+#endif
}
/*!
@@ -78,8 +83,12 @@ QString QWebDatabase::displayName() const
*/
qint64 QWebDatabase::expectedSize() const
{
+#if ENABLE(DATABASE)
DatabaseDetails details = DatabaseTracker::tracker().detailsForNameAndOrigin(d->name, d->origin.get());
return details.expectedUsage();
+#else
+ return 0;
+#endif
}
/*!
@@ -87,8 +96,12 @@ qint64 QWebDatabase::expectedSize() const
*/
qint64 QWebDatabase::size() const
{
+#if ENABLE(DATABASE)
DatabaseDetails details = DatabaseTracker::tracker().detailsForNameAndOrigin(d->name, d->origin.get());
return details.currentUsage();
+#else
+ return 0;
+#endif
}
/*!
@@ -118,7 +131,11 @@ QWebDatabase::QWebDatabase(QWebDatabasePrivate* priv)
*/
QString QWebDatabase::fileName() const
{
+#if ENABLE(DATABASE)
return DatabaseTracker::tracker().fullPathForDatabase(d->origin.get(), d->name, false);
+#else
+ return QString();
+#endif
}
/*!
@@ -137,7 +154,9 @@ QWebSecurityOrigin QWebDatabase::origin() const
*/
void QWebDatabase::removeDatabase(const QWebDatabase &db)
{
+#if ENABLE(DATABASE)
DatabaseTracker::tracker().deleteDatabase(db.d->origin.get(), db.d->name);
+#endif
}
/*!
@@ -146,3 +165,4 @@ void QWebDatabase::removeDatabase(const QWebDatabase &db)
QWebDatabase::~QWebDatabase()
{
}
+
diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebelement.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebelement.cpp
new file mode 100644
index 0000000..ff0463b
--- /dev/null
+++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebelement.cpp
@@ -0,0 +1,1603 @@
+/*
+ Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies)
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#include "config.h"
+#include "qwebelement.h"
+
+#include "CSSComputedStyleDeclaration.h"
+#include "CSSMutableStyleDeclaration.h"
+#include "CSSParser.h"
+#include "CSSRuleList.h"
+#include "CSSRule.h"
+#include "CSSStyleRule.h"
+#include "CString.h"
+#include "Document.h"
+#include "DocumentFragment.h"
+#include "FrameView.h"
+#include "HTMLElement.h"
+#include "JSGlobalObject.h"
+#include "JSHTMLElement.h"
+#include "JSObject.h"
+#include "NodeList.h"
+#include "PropertyNameArray.h"
+#include "ScriptFunctionCall.h"
+#include "StaticNodeList.h"
+#include "qt_runtime.h"
+#include "qwebframe.h"
+#include "qwebframe_p.h"
+#include "runtime_root.h"
+#include <wtf/Vector.h>
+
+using namespace WebCore;
+
+class QWebElementPrivate
+{
+public:
+};
+
+/*!
+ \class QWebElement
+ \since 4.6
+ \brief The QWebElement class provides convenience access to DOM elements in a QWebFrame.
+ \preliminary
+
+ QWebElement is the main class to provide easy access to the document model.
+ The document model is represented by a tree-like structure of DOM elements.
+ The root of the tree is called the document element and can be accessed using QWebFrame::documentElement().
+
+ You can reach specific elements by using the findAll() and findFirst() functions, which
+ allow the use of CSS selectors to identify elements.
+
+ \snippet webkitsnippets/webelement/main.cpp FindAll
+
+ The first list contains all span elements in the document. The second list contains
+ only the span elements that are children of the paragraph that is classified
+ as "intro" paragraph.
+
+ Alternatively you can manually traverse the document using firstChild() and nextSibling():
+
+ \snippet webkitsnippets/webelement/main.cpp Traversing with QWebElement
+
+ The underlying content of QWebElement is explicitly shared. Creating a copy of a QWebElement
+ does not create a copy of the content, both instances point to the same underlying element.
+
+ The element's attributes can be read using attribute() and changed using setAttribute().
+
+ The content of the child elements can be converted to plain text using toPlainText() and to
+ x(html) using toXml(), and it is possible to replace the content using setPlainText() and setXml().
+
+ Depending on the type of the underlying element there may be extra functionality available, not
+ covered through QWebElement's API. For example a HTML form element can be triggered to submit the
+ entire form. These list of these functions is available through functions() and they can be called
+ directly using callFunction().
+*/
+
+/*!
+ Constructs a null web element.
+*/
+QWebElement::QWebElement()
+ : d(0)
+ , m_element(0)
+{
+}
+
+/*!
+ \internal
+*/
+QWebElement::QWebElement(WebCore::Element* domElement)
+ : d(0)
+ , m_element(domElement)
+{
+ if (m_element)
+ m_element->ref();
+}
+
+/*!
+ \internal
+*/
+QWebElement::QWebElement(WebCore::Node* node)
+ : d(0)
+ , m_element(0)
+{
+ if (node && node->isHTMLElement()) {
+ m_element = static_cast<HTMLElement*>(node);
+ m_element->ref();
+ }
+}
+
+/*!
+ Constructs a copy of \a other.
+*/
+QWebElement::QWebElement(const QWebElement &other)
+ : d(0)
+ , m_element(other.m_element)
+{
+ if (m_element)
+ m_element->ref();
+}
+
+/*!
+ Assigns \a other to this element and returns a reference to this element.
+*/
+QWebElement &QWebElement::operator=(const QWebElement &other)
+{
+ // ### handle "d" assignment
+ if (this != &other) {
+ Element *otherElement = other.m_element;
+ if (otherElement)
+ otherElement->ref();
+ if (m_element)
+ m_element->deref();
+ m_element = otherElement;
+ }
+ return *this;
+}
+
+/*!
+ Destroys the element. The underlying DOM element is not destroyed.
+*/
+QWebElement::~QWebElement()
+{
+ delete d;
+ if (m_element)
+ m_element->deref();
+}
+
+bool QWebElement::operator==(const QWebElement& o) const
+{
+ return m_element == o.m_element;
+}
+
+bool QWebElement::operator!=(const QWebElement& o) const
+{
+ return m_element != o.m_element;
+}
+
+/*!
+ Returns true if the element is a null element; false otherwise.
+*/
+bool QWebElement::isNull() const
+{
+ return !m_element;
+}
+
+/*!
+ Returns a new collection of elements that are children of this element
+ and that match the given CSS selector \a selectorQuery.
+
+ The query is specified using \l{http://www.w3.org/TR/REC-CSS2/selector.html#q1}{standard CSS2 selectors}.
+*/
+QList<QWebElement> QWebElement::findAll(const QString &selectorQuery) const
+{
+ QList<QWebElement> elements;
+ if (!m_element)
+ return elements;
+
+ ExceptionCode exception = 0; // ###
+ RefPtr<NodeList> nodes = m_element->querySelectorAll(selectorQuery, exception);
+ if (!nodes)
+ return elements;
+
+ for (int i = 0; i < nodes->length(); ++i) {
+ WebCore::Node* n = nodes->item(i);
+ elements.append(QWebElement(static_cast<Element*>(n)));
+ }
+
+ return elements;
+}
+
+/*!
+ Returns the first child element that matches the given CSS selector \a selectorQuery.
+
+ This function is equivalent to calling findAll() and taking only the
+ first element in the returned collection of elements. However calling
+ this function is more efficient.
+*/
+QWebElement QWebElement::findFirst(const QString &selectorQuery) const
+{
+ if (!m_element)
+ return QWebElement();
+ ExceptionCode exception = 0; // ###
+ return QWebElement(m_element->querySelector(selectorQuery, exception).get());
+}
+
+/*!
+ Replaces the existing content of this element with \a text.
+
+ This is equivalent to setting the HTML innerText property.
+*/
+void QWebElement::setPlainText(const QString &text)
+{
+ if (!m_element || !m_element->isHTMLElement())
+ return;
+ ExceptionCode exception = 0;
+ static_cast<HTMLElement*>(m_element)->setInnerText(text, exception);
+}
+
+/*!
+ Returns the text between the start and the end tag of this
+ element.
+
+ This is equivalent to reading the HTML innerText property.
+*/
+QString QWebElement::toPlainText() const
+{
+ if (!m_element || !m_element->isHTMLElement())
+ return QString();
+ return static_cast<HTMLElement*>(m_element)->innerText();
+}
+
+/*!
+ Replaces the contents of this element as well as its own tag with \a markup.
+ The string may contain HTML or XML tags, which is parsed and formatted
+ before insertion into the document.
+
+ \note This is currently only implemented for (X)HTML elements.
+*/
+void QWebElement::setOuterXml(const QString &markup)
+{
+ if (!m_element || !m_element->isHTMLElement())
+ return;
+
+ ExceptionCode exception = 0;
+
+ static_cast<HTMLElement*>(m_element)->setOuterHTML(markup, exception);
+}
+
+/*!
+ Returns this element converted to XML, including the start and the end
+ tag of this element and its attributes.
+
+ \note This is currently only implemented for (X)HTML elements.
+*/
+QString QWebElement::toOuterXml() const
+{
+ if (!m_element || !m_element->isHTMLElement())
+ return QString();
+
+ return static_cast<HTMLElement*>(m_element)->outerHTML();
+}
+
+/*!
+ Replaces the content of this element with \a markup.
+ The string may contain HTML or XML tags, which is parsed and formatted
+ before insertion into the document.
+
+ \note This is currently only implemented for (X)HTML elements.
+*/
+void QWebElement::setInnerXml(const QString &markup)
+{
+ if (!m_element || !m_element->isHTMLElement())
+ return;
+
+ ExceptionCode exception = 0;
+
+ static_cast<HTMLElement*>(m_element)->setInnerHTML(markup, exception);
+}
+
+/*!
+ Returns the XML between the start and the end tag of this
+ element.
+
+ \note This is currently only implemented for (X)HTML elements.
+*/
+QString QWebElement::toInnerXml() const
+{
+ if (!m_element || !m_element->isHTMLElement())
+ return QString();
+
+ return static_cast<HTMLElement*>(m_element)->innerHTML();
+}
+
+/*!
+ Adds an attribute called \a name with the value \a value. If an attribute
+ with the same name exists, its value is replaced by \a value.
+*/
+void QWebElement::setAttribute(const QString &name, const QString &value)
+{
+ if (!m_element)
+ return;
+ ExceptionCode exception = 0;
+ m_element->setAttribute(name, value, exception);
+}
+
+/*!
+ Adds an attribute called \a name in the namespace described with \a namespaceUri
+ with the value \a value. If an attribute with the same name exists, its value is
+ replaced by \a value.
+*/
+void QWebElement::setAttributeNS(const QString &namespaceUri, const QString &name, const QString &value)
+{
+ if (!m_element)
+ return;
+ WebCore::ExceptionCode exception = 0;
+ m_element->setAttributeNS(namespaceUri, name, value, exception);
+}
+
+/*!
+ Returns the attributed called \a name. If the attribute does not exist \a defaultValue is
+ returned.
+*/
+QString QWebElement::attribute(const QString &name, const QString &defaultValue) const
+{
+ if (!m_element)
+ return QString();
+ if (m_element->hasAttribute(name))
+ return m_element->getAttribute(name);
+ else
+ return defaultValue;
+}
+
+/*!
+ Returns the attributed called \a name in the namespace described with \a namespaceUri.
+ If the attribute does not exist \a defaultValue is returned.
+*/
+QString QWebElement::attributeNS(const QString &namespaceUri, const QString &name, const QString &defaultValue) const
+{
+ if (!m_element)
+ return QString();
+ if (m_element->hasAttributeNS(namespaceUri, name))
+ return m_element->getAttributeNS(namespaceUri, name);
+ else
+ return defaultValue;
+}
+
+/*!
+ Returns true if this element has an attribute called \a name; otherwise returns false.
+*/
+bool QWebElement::hasAttribute(const QString &name) const
+{
+ if (!m_element)
+ return false;
+ return m_element->hasAttribute(name);
+}
+
+/*!
+ Returns true if this element has an attribute called \a name in the namespace described
+ with \a namespaceUri; otherwise returns false.
+*/
+bool QWebElement::hasAttributeNS(const QString &namespaceUri, const QString &name) const
+{
+ if (!m_element)
+ return false;
+ return m_element->hasAttributeNS(namespaceUri, name);
+}
+
+/*!
+ Removes the attribute called \a name from this element.
+*/
+void QWebElement::removeAttribute(const QString &name)
+{
+ if (!m_element)
+ return;
+ ExceptionCode exception = 0;
+ m_element->removeAttribute(name, exception);
+}
+
+/*!
+ Removes the attribute called \a name in the namespace described with \a namespaceUri
+ from this element.
+*/
+void QWebElement::removeAttributeNS(const QString &namespaceUri, const QString &name)
+{
+ if (!m_element)
+ return;
+ WebCore::ExceptionCode exception = 0;
+ m_element->removeAttributeNS(namespaceUri, name, exception);
+}
+
+/*!
+ Returns true if the element has any attributes defined; otherwise returns false;
+*/
+bool QWebElement::hasAttributes() const
+{
+ if (!m_element)
+ return false;
+ return m_element->hasAttributes();
+}
+
+/*!
+ Returns the geometry of this element, relative to its containing frame.
+*/
+QRect QWebElement::geometry() const
+{
+ if (!m_element)
+ return QRect();
+ return m_element->getRect();
+}
+
+/*!
+ Returns the tag name of this element.
+*/
+QString QWebElement::tagName() const
+{
+ if (!m_element)
+ return QString();
+ return m_element->tagName();
+}
+
+/*!
+ Returns the namespace prefix of the element or an empty string if the element has no namespace prefix.
+*/
+QString QWebElement::prefix() const
+{
+ if (!m_element)
+ return QString();
+ return m_element->prefix();
+}
+
+/*!
+ If the element uses namespaces, this function returns the local name of the element;
+ otherwise it returns an empty string.
+*/
+QString QWebElement::localName() const
+{
+ if (!m_element)
+ return QString();
+ return m_element->localName();
+}
+
+/*!
+ Returns the namespace URI of this element or an empty string if the element has no namespace URI.
+*/
+QString QWebElement::namespaceUri() const
+{
+ if (!m_element)
+ return QString();
+ return m_element->namespaceURI();
+}
+
+/*!
+ Returns the parent element of this element or a null element if this element
+ is the root document element.
+*/
+QWebElement QWebElement::parent() const
+{
+ if (m_element)
+ return QWebElement(m_element->parentElement());
+ return QWebElement();
+}
+
+/*!
+ Returns the first child element of this element.
+
+ \sa lastChild() previousSibling() nextSibling()
+*/
+QWebElement QWebElement::firstChild() const
+{
+ if (!m_element)
+ return QWebElement();
+ for (Node* child = m_element->firstChild(); child; child = child->nextSibling()) {
+ if (!child->isElementNode())
+ continue;
+ Element* e = static_cast<Element*>(child);
+ return QWebElement(e);
+ }
+ return QWebElement();
+}
+
+/*!
+ Returns the last child element of this element.
+
+ \sa firstChild() previousSibling() nextSibling()
+*/
+QWebElement QWebElement::lastChild() const
+{
+ if (!m_element)
+ return QWebElement();
+ for (Node* child = m_element->lastChild(); child; child = child->previousSibling()) {
+ if (!child->isElementNode())
+ continue;
+ Element* e = static_cast<Element*>(child);
+ return QWebElement(e);
+ }
+ return QWebElement();
+}
+
+/*!
+ Returns the next sibling element of this element.
+
+ \sa firstChild() previousSibling() lastChild()
+*/
+QWebElement QWebElement::nextSibling() const
+{
+ if (!m_element)
+ return QWebElement();
+ for (Node* sib = m_element->nextSibling(); sib; sib = sib->nextSibling()) {
+ if (!sib->isElementNode())
+ continue;
+ Element* e = static_cast<Element*>(sib);
+ return QWebElement(e);
+ }
+ return QWebElement();
+}
+
+/*!
+ Returns the previous sibling element of this element.
+
+ \sa firstChild() nextSibling() lastChild()
+*/
+QWebElement QWebElement::previousSibling() const
+{
+ if (!m_element)
+ return QWebElement();
+ for (Node* sib = m_element->previousSibling(); sib; sib = sib->previousSibling()) {
+ if (!sib->isElementNode())
+ continue;
+ Element* e = static_cast<Element*>(sib);
+ return QWebElement(e);
+ }
+ return QWebElement();
+}
+
+/*!
+ Returns the document this element belongs to.
+*/
+QWebElement QWebElement::document() const
+{
+ if (!m_element)
+ return QWebElement();
+ Document* document = m_element->document();
+ if (!document)
+ return QWebElement();
+ return QWebElement(document->documentElement());
+}
+
+/*!
+ Returns the web frame this elements is a part of. If the element is
+ a null element null is returned.
+*/
+QWebFrame *QWebElement::webFrame() const
+{
+ if (!m_element)
+ return 0;
+
+ Document* document = m_element->document();
+ if (!document)
+ return 0;
+
+ Frame* frame = document->frame();
+ if (!frame)
+ return 0;
+ return QWebFramePrivate::kit(frame);
+}
+
+static bool setupScriptContext(WebCore::Element* element, JSC::JSValue& thisValue, ScriptState*& state, ScriptController*& scriptController)
+{
+ if (!element)
+ return false;
+
+ Document* document = element->document();
+ if (!document)
+ return false;
+
+ Frame* frame = document->frame();
+ if (!frame)
+ return false;
+
+ scriptController = frame->script();
+ if (!scriptController)
+ return false;
+
+ state = scriptController->globalObject()->globalExec();
+ if (!state)
+ return false;
+
+ thisValue = toJS(state, element);
+ if (!thisValue)
+ return false;
+
+ return true;
+}
+
+
+static bool setupScriptObject(WebCore::Element* element, ScriptObject& object, ScriptState*& state, ScriptController*& scriptController)
+{
+ if (!element)
+ return false;
+
+ Document* document = element->document();
+ if (!document)
+ return false;
+
+ Frame* frame = document->frame();
+ if (!frame)
+ return false;
+
+ scriptController = frame->script();
+
+ state = scriptController->globalObject()->globalExec();
+
+ JSC::JSValue thisValue = toJS(state, element);
+ if (!thisValue)
+ return false;
+
+ JSC::JSObject* thisObject = thisValue.toObject(state);
+ if (!thisObject)
+ return false;
+
+ object = ScriptObject(thisObject);
+ return true;
+}
+
+/*!
+ Executes the \a scriptSource with this element as the `this' object.
+
+ \sa callFunction()
+*/
+QVariant QWebElement::evaluateScript(const QString& scriptSource)
+{
+ if (scriptSource.isEmpty())
+ return QVariant();
+
+ ScriptState* state = 0;
+ JSC::JSValue thisValue;
+ ScriptController* scriptController = 0;
+
+ if (!setupScriptContext(m_element, thisValue, state, scriptController))
+ return QVariant();
+
+ JSC::ScopeChain& scopeChain = state->dynamicGlobalObject()->globalScopeChain();
+ JSC::UString script((const ushort*)scriptSource.data(), scriptSource.length());
+ JSC::Completion completion = JSC::evaluate(state, scopeChain, JSC::makeSource(script), thisValue);
+ if ((completion.complType() != JSC::ReturnValue) && (completion.complType() != JSC::Normal))
+ return QVariant();
+
+ JSC::JSValue result = completion.value();
+ if (!result)
+ return QVariant();
+
+ int distance = 0;
+ return JSC::Bindings::convertValueToQVariant(state, result, QMetaType::Void, &distance);
+}
+
+/*!
+ Calls the function with the given \a name and \a arguments.
+
+ The underlying DOM element that QWebElement wraps may have dedicated functions depending
+ on its type. For example a form element can have the "submit" function, that would submit
+ the form to the destination specified in the HTML.
+
+ \sa functions()
+*/
+QVariant QWebElement::callFunction(const QString &name, const QVariantList &arguments)
+{
+ ScriptState* state = 0;
+ ScriptObject thisObject;
+ ScriptController* scriptController = 0;
+
+ if (!setupScriptObject(m_element, thisObject, state, scriptController))
+ return QVariant();
+
+ ScriptFunctionCall functionCall(state, thisObject, name);
+
+ for (QVariantList::ConstIterator it = arguments.constBegin(), end = arguments.constEnd();
+ it != end; ++it)
+ functionCall.appendArgument(JSC::Bindings::convertQVariantToValue(state, scriptController->bindingRootObject(), *it));
+
+ bool hadException = false;
+ ScriptValue result = functionCall.call(hadException);
+ if (hadException)
+ return QVariant();
+
+ int distance = 0;
+ return JSC::Bindings::convertValueToQVariant(state, result.jsValue(), QMetaType::Void, &distance);
+}
+
+/*!
+ Returns a list of function names this element supports.
+
+ The function names returned are the same functions that are callable from the DOM
+ element's JavaScript binding.
+
+ \sa callFunction()
+*/
+QStringList QWebElement::functions() const
+{
+ ScriptState* state = 0;
+ ScriptObject thisObject;
+ ScriptController* scriptController = 0;
+
+ if (!setupScriptObject(m_element, thisObject, state, scriptController))
+ return QStringList();
+
+ JSC::JSObject* object = thisObject.jsObject();
+ if (!object)
+ return QStringList();
+
+ QStringList names;
+
+ // Enumerate the contents of the object
+ JSC::PropertyNameArray properties(state);
+ object->getPropertyNames(state, properties);
+ for (JSC::PropertyNameArray::const_iterator it = properties.begin();
+ it != properties.end(); ++it) {
+
+ JSC::JSValue property = object->get(state, *it);
+ if (!property)
+ continue;
+
+ JSC::JSObject* function = property.toObject(state);
+ if (!function)
+ continue;
+
+ JSC::CallData callData;
+ JSC::CallType callType = function->getCallData(callData);
+ if (callType == JSC::CallTypeNone)
+ continue;
+
+ JSC::UString ustring = (*it).ustring();
+ names << QString::fromUtf16((const ushort*)ustring.rep()->data(),ustring.size());
+ }
+
+ if (state->hadException())
+ state->clearException();
+
+ return names;
+}
+
+/*!
+ Returns the value of the element's \a name property.
+
+ If no such property exists, the returned variant is invalid.
+
+ The return property has the same value as the corresponding property
+ in the element's JavaScript binding with the same name.
+
+ Information about all available properties is provided through scriptProperties().
+
+ \sa setScriptableProperty(), scriptableProperties()
+*/
+QVariant QWebElement::scriptableProperty(const QString &name) const
+{
+ ScriptState* state = 0;
+ ScriptObject thisObject;
+ ScriptController *scriptController = 0;
+
+ if (!setupScriptObject(m_element, thisObject, state, scriptController))
+ return QVariant();
+
+ String wcName(name);
+ JSC::JSValue property = thisObject.jsObject()->get(state, JSC::Identifier(state, wcName));
+
+ // ###
+ if (state->hadException())
+ state->clearException();
+
+ int distance = 0;
+ return JSC::Bindings::convertValueToQVariant(state, property, QMetaType::Void, &distance);
+}
+
+/*!
+ Sets the value of the element's \a name property to \a value.
+
+ Information about all available properties is provided through scriptProperties().
+
+ Setting the property will affect the corresponding property
+ in the element's JavaScript binding with the same name.
+
+ \sa scriptableProperty(), scriptableProperties()
+*/
+void QWebElement::setScriptableProperty(const QString &name, const QVariant &value)
+{
+ ScriptState* state = 0;
+ ScriptObject thisObject;
+ ScriptController* scriptController = 0;
+
+ if (!setupScriptObject(m_element, thisObject, state, scriptController))
+ return;
+
+ JSC::JSValue jsValue = JSC::Bindings::convertQVariantToValue(state, scriptController->bindingRootObject(), value);
+ if (!jsValue)
+ return;
+
+ String wcName(name);
+ JSC::PutPropertySlot slot;
+ thisObject.jsObject()->put(state, JSC::Identifier(state, wcName), jsValue, slot);
+ if (state->hadException())
+ state->clearException();
+}
+
+/*!
+ Returns a list of property names this element supports.
+
+ The function names returned are the same properties that are accessible from the DOM
+ element's JavaScript binding.
+
+ \sa setScriptableProperty(), scriptableProperty()
+*/
+QStringList QWebElement::scriptableProperties() const
+{
+ if (!m_element)
+ return QStringList();
+
+ Document* document = m_element->document();
+ if (!document)
+ return QStringList();
+
+ Frame* frame = document->frame();
+ if (!frame)
+ return QStringList();
+
+ ScriptController* script = frame->script();
+ JSC::ExecState* exec = script->globalObject()->globalExec();
+
+ JSC::JSValue thisValue = toJS(exec, m_element);
+ if (!thisValue)
+ return QStringList();
+
+ JSC::JSObject* object = thisValue.toObject(exec);
+ if (!object)
+ return QStringList();
+
+ QStringList names;
+
+ // Enumerate the contents of the object
+ JSC::PropertyNameArray properties(exec);
+ object->getPropertyNames(exec, properties);
+ for (JSC::PropertyNameArray::const_iterator it = properties.begin();
+ it != properties.end(); ++it) {
+
+ JSC::JSValue property = object->get(exec, *it);
+ if (!property)
+ continue;
+
+ JSC::JSObject* function = property.toObject(exec);
+ if (!function)
+ continue;
+
+ JSC::CallData callData;
+ JSC::CallType callType = function->getCallData(callData);
+ if (callType != JSC::CallTypeNone)
+ continue;
+
+ JSC::UString ustring = (*it).ustring();
+ names << QString::fromUtf16((const ushort*)ustring.rep()->data(),ustring.size());
+ }
+
+ if (exec->hadException())
+ exec->clearException();
+
+ return names;
+}
+
+/*!
+ \enum QWebElement::ResolveRule
+ \since 4.6
+
+ This enum describes how QWebElement's styleProperty resolves the given
+ property name.
+
+ \value IgnoreCascadingStyles Return the property value as it is defined
+ in the element, without respecting style inheritance and other CSS rules.
+ \value RespectCascadingStyles The property's value is determined using
+ the inheritance and importance rules defined in the document's stylesheet.
+*/
+
+/*!
+ \enum QWebElement::StylePriority
+ \since 4.6
+
+ This enum describes the priority newly set CSS properties should have when
+ set using QWebElement::setStyleProperty().
+
+ \value NormalStylePriority Define the property without important
+ priority even if "!important" is explicitly set in \a value.
+ \value DeclaredStylePriority Define the property respecting the
+ priority specified in \a value.
+ \value ImportantStylePriority Define the property to have
+ an important priority, this is equal to appending "!important" to the value.
+*/
+
+/*!
+ Returns the value of the style named \a name or an empty string if such one
+ does not exist.
+
+ If \a rule is IgnoreCascadingStyles, the value defined inside the element
+ (inline in CSS terminology) is returned.
+
+ if \a rule is RespectCascadingStyles, the actual style applied to the
+ element is returned.
+
+ In CSS, the cascading part has to do with which CSS rule has priority and
+ is thus applied. Generally speaking, the last defined rule has priority,
+ thus an inline style rule has priority over an embedded block style rule,
+ which in return has priority over an external style rule.
+
+ If the !important declaration is set on one of those, the declaration gets
+ highest priority, unless other declarations also use the !important
+ declaration, in which the last !important declaration takes predecence.
+*/
+QString QWebElement::styleProperty(const QString &name, ResolveRule rule) const
+{
+ if (!m_element || !m_element->isStyledElement())
+ return QString();
+
+ int propID = cssPropertyID(name);
+
+ if (!propID)
+ return QString();
+
+ CSSStyleDeclaration* style = static_cast<StyledElement*>(m_element)->style();
+
+ if (rule == IgnoreCascadingStyles)
+ return style->getPropertyValue(propID);
+
+ if (rule == RespectCascadingStyles) {
+ if (style->getPropertyPriority(propID))
+ return style->getPropertyValue(propID);
+
+ // We are going to resolve the style property by walking through the
+ // list of non-inline matched CSS rules for the element, looking for
+ // the highest priority definition.
+
+ // Get an array of matched CSS rules for the given element sorted
+ // by importance and inheritance order. This include external CSS
+ // declarations, as well as embedded and inline style declarations.
+
+ DOMWindow* domWindow = m_element->document()->frame()->domWindow();
+ if (RefPtr<CSSRuleList> rules = domWindow->getMatchedCSSRules(m_element, "")) {
+ for (int i = rules->length(); i > 0; --i) {
+ CSSStyleRule* rule = static_cast<CSSStyleRule*>(rules->item(i - 1));
+
+ if (rule->style()->getPropertyPriority(propID))
+ return rule->style()->getPropertyValue(propID);
+
+ if (style->getPropertyValue(propID).isEmpty())
+ style = rule->style();
+ }
+ }
+
+ return style->getPropertyValue(propID);
+ }
+
+ return QString();
+}
+
+/*!
+ Sets the value of the style named \a name to \a value.
+
+ Setting a value, doesn't necessarily mean that it will become the applied
+ value, due to the fact that the style property's value might have been set
+ earlier with priority in external or embedded style declarations.
+
+ In order to ensure that the value will be applied, ImportantStylePriority
+ should be used as \a priority.
+
+ Following the CSS syntax for property values, this is equal to appending
+ "!important" to the value.
+
+ This syntax is supported when using DeclaredStylePriority as \a priority.
+
+ Using NormalStylePriority as \a priority, the property will have normal
+ priority, and any "!important" declaration will be ignored. On the other
+ hand, using ImportantStylePriority sets the important priority even when
+ not explicit passed in \a value.
+ By using DeclaredStylePriority as \a priority the property will respect the
+ priority specified in \a value.
+*/
+void QWebElement::setStyleProperty(const QString &name, const QString &value, StylePriority priority)
+{
+ if (!m_element || !m_element->isStyledElement())
+ return;
+
+ int propID = cssPropertyID(name);
+ CSSStyleDeclaration* style = static_cast<StyledElement*>(m_element)->style();
+ if (!propID || !style)
+ return;
+
+ ExceptionCode exception = 0;
+
+ const QRegExp hasImportantTest(QLatin1String("!\\s*important"));
+ int index = value.indexOf(hasImportantTest);
+
+ QString newValue = (index != -1) ? value.left(index - 1) : value;
+
+ switch (priority) {
+ case NormalStylePriority:
+ style->setProperty(name, newValue, "", exception);
+ break;
+ case DeclaredStylePriority:
+ style->setProperty(name, newValue, (index != -1) ? "important" : "", exception);
+ break;
+ case ImportantStylePriority:
+ style->setProperty(name, newValue, "important", exception);
+ break;
+ default:
+ break;
+ }
+}
+
+/*!
+ Returns the computed value for style named \a name or an empty string if the style has no such name.
+*/
+QString QWebElement::computedStyleProperty(const QString &name) const
+{
+ if (!m_element || !m_element->isStyledElement())
+ return QString();
+
+ int propID = cssPropertyID(name);
+
+ RefPtr<CSSComputedStyleDeclaration> style = computedStyle(m_element);
+ if (!propID || !style)
+ return QString();
+
+ return style->getPropertyValue(propID);
+}
+
+/*!
+ Returns the list of classes of this element.
+*/
+QStringList QWebElement::classes() const
+{
+ if (!hasAttribute("class"))
+ return QStringList();
+
+ QStringList classes = attribute("class").simplified().split(' ', QString::SkipEmptyParts);
+#if QT_VERSION >= 0x040500
+ classes.removeDuplicates();
+#else
+ int n = classes.size();
+ int j = 0;
+ QSet<QString> seen;
+ seen.reserve(n);
+ for (int i = 0; i < n; ++i) {
+ const QString& s = classes.at(i);
+ if (seen.contains(s))
+ continue;
+ seen.insert(s);
+ if (j != i)
+ classes[j] = s;
+ ++j;
+ }
+ if (n != j)
+ classes.erase(classes.begin() + j, classes.end());
+#endif
+ return classes;
+}
+
+/*!
+ Returns true if this element has a class called \a name; otherwise returns false.
+*/
+bool QWebElement::hasClass(const QString &name) const
+{
+ QStringList list = classes();
+ return list.contains(name);
+}
+
+/*!
+ Adds the specified class \a name to the element.
+*/
+void QWebElement::addClass(const QString &name)
+{
+ QStringList list = classes();
+ if (!list.contains(name)) {
+ list.append(name);
+ QString value = list.join(" ");
+ setAttribute("class", value);
+ }
+}
+
+/*!
+ Removes the specified class \a name from the element.
+*/
+void QWebElement::removeClass(const QString &name)
+{
+ QStringList list = classes();
+ if (list.contains(name)) {
+ list.removeAll(name);
+ QString value = list.join(" ");
+ setAttribute("class", value);
+ }
+}
+
+/*!
+ Adds the specified class \a name if it is not present,
+ removes it if it is already present.
+*/
+void QWebElement::toggleClass(const QString &name)
+{
+ QStringList list = classes();
+ if (list.contains(name))
+ list.removeAll(name);
+ else
+ list.append(name);
+
+ QString value = list.join(" ");
+ setAttribute("class", value);
+}
+
+/*!
+ Appends \a element as the element's last child.
+
+ If \a element is the child of another element, it is re-parented
+ to this element. If \a element is a child of this element, then
+ its position in the list of children is changed.
+
+ Calling this function on a null element does nothing.
+
+ \sa prependInside(), prependOutside(), appendOutside()
+*/
+void QWebElement::appendInside(const QWebElement &element)
+{
+ if (!m_element || element.isNull())
+ return;
+
+ ExceptionCode exception = 0;
+ m_element->appendChild(element.m_element, exception);
+}
+
+/*!
+ Appends the result of parsing \a markup as the element's last child.
+
+ Calling this function on a null element does nothing.
+
+ \sa prependInside(), prependOutside(), appendOutside()
+*/
+void QWebElement::appendInside(const QString &markup)
+{
+ if (!m_element)
+ return;
+
+ if (!m_element->isHTMLElement())
+ return;
+
+ HTMLElement* htmlElement = static_cast<HTMLElement*>(m_element);
+ RefPtr<DocumentFragment> fragment = htmlElement->createContextualFragment(markup);
+
+ ExceptionCode exception = 0;
+ m_element->appendChild(fragment, exception);
+}
+
+/*!
+ Prepends \a element as the element's first child.
+
+ If \a element is the child of another element, it is re-parented
+ to this element. If \a element is a child of this element, then
+ its position in the list of children is changed.
+
+ Calling this function on a null element does nothing.
+
+ \sa appendInside(), prependOutside(), appendOutside()
+*/
+void QWebElement::prependInside(const QWebElement &element)
+{
+ if (!m_element || element.isNull())
+ return;
+
+ ExceptionCode exception = 0;
+
+ if (m_element->hasChildNodes())
+ m_element->insertBefore(element.m_element, m_element->firstChild(), exception);
+ else
+ m_element->appendChild(element.m_element, exception);
+}
+
+/*!
+ Prepends the result of parsing \a markup as the element's first child.
+
+ Calling this function on a null element does nothing.
+
+ \sa appendInside(), prependOutside(), appendOutside()
+*/
+void QWebElement::prependInside(const QString &markup)
+{
+ if (!m_element)
+ return;
+
+ if (!m_element->isHTMLElement())
+ return;
+
+ HTMLElement* htmlElement = static_cast<HTMLElement*>(m_element);
+ RefPtr<DocumentFragment> fragment = htmlElement->createContextualFragment(markup);
+
+ ExceptionCode exception = 0;
+
+ if (m_element->hasChildNodes())
+ m_element->insertBefore(fragment, m_element->firstChild(), exception);
+ else
+ m_element->appendChild(fragment, exception);
+}
+
+
+/*!
+ Inserts \a element before this element.
+
+ If \a element is the child of another element, it is re-parented
+ to the parent of this element.
+
+ Calling this function on a null element does nothing.
+
+ \sa appendInside(), prependInside(), appendOutside()
+*/
+void QWebElement::prependOutside(const QWebElement &element)
+{
+ if (!m_element || element.isNull())
+ return;
+
+ if (!m_element->parent())
+ return;
+
+ ExceptionCode exception = 0;
+ m_element->parent()->insertBefore(element.m_element, m_element, exception);
+}
+
+/*!
+ Inserts the result of parsing \a markup before this element.
+
+ Calling this function on a null element does nothing.
+
+ \sa appendInside(), prependInside(), appendOutside()
+*/
+void QWebElement::prependOutside(const QString &markup)
+{
+ if (!m_element)
+ return;
+
+ if (!m_element->parent())
+ return;
+
+ if (!m_element->isHTMLElement())
+ return;
+
+ HTMLElement* htmlElement = static_cast<HTMLElement*>(m_element);
+ RefPtr<DocumentFragment> fragment = htmlElement->createContextualFragment(markup);
+
+ ExceptionCode exception = 0;
+ m_element->parent()->insertBefore(fragment, m_element, exception);
+}
+
+/*!
+ Inserts \a element after this element.
+
+ If \a element is the child of another element, it is re-parented
+ to the parent of this element.
+
+ Calling this function on a null element does nothing.
+
+ \sa appendInside(), prependInside(), prependOutside()
+*/
+void QWebElement::appendOutside(const QWebElement &element)
+{
+ if (!m_element || element.isNull())
+ return;
+
+ if (!m_element->parent())
+ return;
+
+ ExceptionCode exception = 0;
+ if (!m_element->nextSibling())
+ m_element->parent()->appendChild(element.m_element, exception);
+ else
+ m_element->parent()->insertBefore(element.m_element, m_element->nextSibling(), exception);
+}
+
+/*!
+ Inserts the result of parsing \a markup after this element.
+
+ Calling this function on a null element does nothing.
+
+ \sa appendInside(), prependInside(), prependOutside()
+*/
+void QWebElement::appendOutside(const QString &markup)
+{
+ if (!m_element)
+ return;
+
+ if (!m_element->parent())
+ return;
+
+ if (!m_element->isHTMLElement())
+ return;
+
+ HTMLElement* htmlElement = static_cast<HTMLElement*>(m_element);
+ RefPtr<DocumentFragment> fragment = htmlElement->createContextualFragment(markup);
+
+ ExceptionCode exception = 0;
+ if (!m_element->nextSibling())
+ m_element->parent()->appendChild(fragment, exception);
+ else
+ m_element->parent()->insertBefore(fragment, m_element->nextSibling(), exception);
+}
+
+/*!
+ Returns a clone of this element.
+
+ The clone may be inserted at any point in the document.
+
+ \sa appendInside(), prependInside(), prependOutside(), appendOutside()
+*/
+QWebElement QWebElement::clone() const
+{
+ if (!m_element)
+ return QWebElement();
+
+ return QWebElement(m_element->cloneElementWithChildren().get());
+}
+
+/*!
+ Removes this element from the document and returns a reference
+ to this.
+
+ The element is still valid after removal, and can be inserted into
+ other parts of the document.
+
+ \sa removeChildren(), removeFromDocument()
+*/
+QWebElement &QWebElement::takeFromDocument()
+{
+ if (!m_element)
+ return *this;
+
+ ExceptionCode exception = 0;
+ m_element->remove(exception);
+
+ return *this;
+}
+
+/*!
+ Removes this element from the document and makes this
+ a null element.
+
+ \sa removeChildren(), takeFromDocument()
+*/
+void QWebElement::removeFromDocument()
+{
+ if (!m_element)
+ return;
+
+ ExceptionCode exception = 0;
+ m_element->remove(exception);
+ m_element->deref();
+ m_element = 0;
+}
+
+/*!
+ Removes all children from this element.
+
+ \sa removeFromDocument(), takeFromDocument()
+*/
+void QWebElement::removeChildren()
+{
+ if (!m_element)
+ return;
+
+ m_element->removeAllChildren();
+}
+
+static RefPtr<Node> findInsertionPoint(PassRefPtr<Node> root)
+{
+ RefPtr<Node> node = root;
+
+ // Go as far down the tree as possible.
+ while (node->hasChildNodes() && node->firstChild()->isElementNode())
+ node = node->firstChild();
+
+ // TODO: Implement SVG support
+ if (node->isHTMLElement()) {
+ HTMLElement* element = static_cast<HTMLElement*>(node.get());
+
+ // The insert point could be a non-enclosable tag and it can thus
+ // never have children, so go one up. Get the parent element, and not
+ // note as a root note will always exist.
+ if (element->endTagRequirement() == TagStatusForbidden)
+ node = node->parentElement();
+ }
+
+ return node;
+}
+
+/*!
+ Enclose the contents of this element in \a element as the child
+ of the deepest descendant element within the structure of the
+ first element provided.
+
+ \sa encloseWith()
+*/
+void QWebElement::encloseContentsWith(const QWebElement &element)
+{
+ if (!m_element || element.isNull())
+ return;
+
+ RefPtr<Node> insertionPoint = findInsertionPoint(element.m_element);
+
+ if (!insertionPoint)
+ return;
+
+ ExceptionCode exception = 0;
+
+ // reparent children
+ for (RefPtr<Node> child = m_element->firstChild(); child;) {
+ RefPtr<Node> next = child->nextSibling();
+ insertionPoint->appendChild(child, exception);
+ child = next;
+ }
+
+ if (m_element->hasChildNodes())
+ m_element->insertBefore(element.m_element, m_element->firstChild(), exception);
+ else
+ m_element->appendChild(element.m_element, exception);
+}
+
+/*!
+ Enclose the contents of this element in the result of parsing
+ \a markup as the child of the deepest descendant element within
+ the structure of the first element provided.
+
+ \sa encloseWith()
+*/
+void QWebElement::encloseContentsWith(const QString &markup)
+{
+ if (!m_element)
+ return;
+
+ if (!m_element->parent())
+ return;
+
+ if (!m_element->isHTMLElement())
+ return;
+
+ HTMLElement* htmlElement = static_cast<HTMLElement*>(m_element);
+ RefPtr<DocumentFragment> fragment = htmlElement->createContextualFragment(markup);
+
+ if (!fragment || !fragment->firstChild())
+ return;
+
+ RefPtr<Node> insertionPoint = findInsertionPoint(fragment->firstChild());
+
+ if (!insertionPoint)
+ return;
+
+ ExceptionCode exception = 0;
+
+ // reparent children
+ for (RefPtr<Node> child = m_element->firstChild(); child;) {
+ RefPtr<Node> next = child->nextSibling();
+ insertionPoint->appendChild(child, exception);
+ child = next;
+ }
+
+ if (m_element->hasChildNodes())
+ m_element->insertBefore(fragment, m_element->firstChild(), exception);
+ else
+ m_element->appendChild(fragment, exception);
+}
+
+/*!
+ Enclose this element in \a element as the child of the deepest
+ descendant element within the structure of the first element
+ provided.
+
+ \sa replace()
+*/
+void QWebElement::encloseWith(const QWebElement &element)
+{
+ if (!m_element || element.isNull())
+ return;
+
+ RefPtr<Node> insertionPoint = findInsertionPoint(element.m_element);
+
+ if (!insertionPoint)
+ return;
+
+ // Keep reference to these two nodes before pulling out this element and
+ // wrapping it in the fragment. The reason for doing it in this order is
+ // that once the fragment has been added to the document it is empty, so
+ // we no longer have access to the nodes it contained.
+ Node* parentNode = m_element->parent();
+ Node* siblingNode = m_element->nextSibling();
+
+ ExceptionCode exception = 0;
+ insertionPoint->appendChild(m_element, exception);
+
+ if (!siblingNode)
+ parentNode->appendChild(element.m_element, exception);
+ else
+ parentNode->insertBefore(element.m_element, siblingNode, exception);
+}
+
+/*!
+ Enclose this element in the result of parsing \a markup,
+ as the last child.
+
+ \sa replace()
+*/
+void QWebElement::encloseWith(const QString &markup)
+{
+ if (!m_element)
+ return;
+
+ if (!m_element->parent())
+ return;
+
+ if (!m_element->isHTMLElement())
+ return;
+
+ HTMLElement* htmlElement = static_cast<HTMLElement*>(m_element);
+ RefPtr<DocumentFragment> fragment = htmlElement->createContextualFragment(markup);
+
+ if (!fragment || !fragment->firstChild())
+ return;
+
+ RefPtr<Node> insertionPoint = findInsertionPoint(fragment->firstChild());
+
+ if (!insertionPoint)
+ return;
+
+ // Keep reference to these two nodes before pulling out this element and
+ // wrapping it in the fragment. The reason for doing it in this order is
+ // that once the fragment has been added to the document it is empty, so
+ // we no longer have access to the nodes it contained.
+ Node* parentNode = m_element->parent();
+ Node* siblingNode = m_element->nextSibling();
+
+ ExceptionCode exception = 0;
+ insertionPoint->appendChild(m_element, exception);
+
+ if (!siblingNode)
+ parentNode->appendChild(fragment, exception);
+ else
+ parentNode->insertBefore(fragment, siblingNode, exception);
+}
+
+/*!
+ Replaces this element with \a element.
+
+ It is not possible to replace the <html>, <head>, or <body>
+ elements using this method.
+
+ \sa encloseWith()
+*/
+void QWebElement::replace(const QWebElement &element)
+{
+ if (!m_element || element.isNull())
+ return;
+
+ appendOutside(element);
+ takeFromDocument();
+}
+
+/*!
+ Replaces this element with the result of parsing \a markup.
+
+ It is not possible to replace the <html>, <head>, or <body>
+ elements using this method.
+
+ \sa encloseWith()
+*/
+void QWebElement::replace(const QString &markup)
+{
+ if (!m_element)
+ return;
+
+ appendOutside(markup);
+ takeFromDocument();
+}
+
+/*!
+ \fn inline bool QWebElement::operator==(const QWebElement& o) const;
+
+ Returns true if this element points to the same underlying DOM object than \a o; otherwise returns false.
+*/
+
+/*!
+ \fn inline bool QWebElement::operator!=(const QWebElement& o) const;
+
+ Returns true if this element points to a different underlying DOM object than \a o; otherwise returns false.
+*/
diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebelement.h b/src/3rdparty/webkit/WebKit/qt/Api/qwebelement.h
new file mode 100644
index 0000000..7e56d0f
--- /dev/null
+++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebelement.h
@@ -0,0 +1,153 @@
+/*
+ Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies)
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef QWEBELEMENT_H
+#define QWEBELEMENT_H
+
+#include <QString>
+#include <QRect>
+#include <QVariant>
+#include <QExplicitlySharedDataPointer>
+
+#include "qwebkitglobal.h"
+namespace WebCore {
+ class Element;
+ class Node;
+}
+
+class QWebFrame;
+class QWebElementPrivate;
+
+class QWEBKIT_EXPORT QWebElement
+{
+public:
+ QWebElement();
+ QWebElement(const QWebElement &);
+ QWebElement &operator=(const QWebElement &);
+ ~QWebElement();
+
+ bool operator==(const QWebElement& o) const;
+ bool operator!=(const QWebElement& o) const;
+
+ bool isNull() const;
+
+ QList<QWebElement> findAll(const QString &selectorQuery) const;
+ QWebElement findFirst(const QString &selectorQuery) const;
+
+ void setPlainText(const QString &text);
+ QString toPlainText() const;
+
+ void setOuterXml(const QString &markup);
+ QString toOuterXml() const;
+
+ void setInnerXml(const QString &markup);
+ QString toInnerXml() const;
+
+ void setAttribute(const QString &name, const QString &value);
+ void setAttributeNS(const QString &namespaceUri, const QString &name, const QString &value);
+ QString attribute(const QString &name, const QString &defaultValue = QString()) const;
+ QString attributeNS(const QString &namespaceUri, const QString &name, const QString &defaultValue = QString()) const;
+ bool hasAttribute(const QString &name) const;
+ bool hasAttributeNS(const QString &namespaceUri, const QString &name) const;
+ void removeAttribute(const QString &name);
+ void removeAttributeNS(const QString &namespaceUri, const QString &name);
+ bool hasAttributes() const;
+
+ QStringList classes() const;
+ bool hasClass(const QString &name) const;
+ void addClass(const QString &name);
+ void removeClass(const QString &name);
+ void toggleClass(const QString &name);
+
+ QRect geometry() const;
+
+ QString tagName() const;
+ QString prefix() const;
+ QString localName() const;
+ QString namespaceUri() const;
+
+ QWebElement parent() const;
+ QWebElement firstChild() const;
+ QWebElement lastChild() const;
+ QWebElement nextSibling() const;
+ QWebElement previousSibling() const;
+ QWebElement document() const;
+ QWebFrame *webFrame() const;
+
+ // TODO: Add QList<QWebElement> overloads
+ // docs need example snippet
+ void appendInside(const QString &markup);
+ void appendInside(const QWebElement &element);
+
+ // docs need example snippet
+ void prependInside(const QString &markup);
+ void prependInside(const QWebElement &element);
+
+ // docs need example snippet
+ void appendOutside(const QString &markup);
+ void appendOutside(const QWebElement &element);
+
+ // docs need example snippet
+ void prependOutside(const QString &markup);
+ void prependOutside(const QWebElement &element);
+
+ // docs need example snippet
+ void encloseContentsWith(const QWebElement &element);
+ void encloseContentsWith(const QString &markup);
+ void encloseWith(const QString &markup);
+ void encloseWith(const QWebElement &element);
+
+ void replace(const QString &markup);
+ void replace(const QWebElement &element);
+
+ QWebElement clone() const;
+ QWebElement &takeFromDocument();
+ void removeFromDocument();
+ void removeChildren();
+
+ QVariant evaluateScript(const QString& scriptSource);
+
+ QVariant callFunction(const QString &functionName, const QVariantList &arguments = QVariantList());
+ QStringList functions() const;
+
+ QVariant scriptableProperty(const QString &name) const;
+ void setScriptableProperty(const QString &name, const QVariant &value);
+ QStringList scriptableProperties() const;
+
+ enum ResolveRule { IgnoreCascadingStyles, RespectCascadingStyles };
+ QString styleProperty(const QString &name, ResolveRule = IgnoreCascadingStyles) const;
+
+ enum StylePriority { NormalStylePriority, DeclaredStylePriority, ImportantStylePriority };
+ void setStyleProperty(const QString &name, const QString &value, StylePriority = DeclaredStylePriority);
+
+ QString computedStyleProperty(const QString &name) const;
+
+private:
+ explicit QWebElement(WebCore::Element *domElement);
+ explicit QWebElement(WebCore::Node *node);
+
+ friend class QWebFrame;
+ friend class QWebHitTestResult;
+ friend class QWebHitTestResultPrivate;
+
+ QWebElementPrivate *d;
+ WebCore::Element *m_element;
+};
+
+#endif // QWEBELEMENT_H
diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebframe.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebframe.cpp
index e565476..db4bfec 100644
--- a/src/3rdparty/webkit/WebKit/qt/Api/qwebframe.cpp
+++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebframe.cpp
@@ -25,6 +25,7 @@
#include "qwebframe_p.h"
#include "qwebsecurityorigin.h"
#include "qwebsecurityorigin_p.h"
+#include "qwebelement.h"
#include "DocumentLoader.h"
#include "FocusController.h"
@@ -44,6 +45,7 @@
#include "SubstituteData.h"
#include "markup.h"
+#include "htmlediting.h"
#include "RenderTreeAsText.h"
#include "Element.h"
#include "Document.h"
@@ -95,6 +97,7 @@ QT_END_NAMESPACE
void QWEBKIT_EXPORT qt_drt_setJavaScriptProfilingEnabled(QWebFrame* qframe, bool enabled)
{
+#if ENABLE(JAVASCRIPT_DEBUGGER)
Frame* frame = QWebFramePrivate::core(qframe);
InspectorController* controller = frame->page()->inspectorController();
if (!controller)
@@ -103,6 +106,64 @@ void QWEBKIT_EXPORT qt_drt_setJavaScriptProfilingEnabled(QWebFrame* qframe, bool
controller->enableProfiler();
else
controller->disableProfiler();
+#endif
+}
+
+// Pause a given CSS animation or transition on the target node at a specific time.
+// If the animation or transition is already paused, it will update its pause time.
+// This method is only intended to be used for testing the CSS animation and transition system.
+bool QWEBKIT_EXPORT qt_drt_pauseAnimation(QWebFrame *qframe, const QString &animationName, double time, const QString &elementId)
+{
+ Frame* frame = QWebFramePrivate::core(qframe);
+ if (!frame)
+ return false;
+
+ AnimationController* controller = frame->animation();
+ if (!controller)
+ return false;
+
+ Document* doc = frame->document();
+ Q_ASSERT(doc);
+
+ Node* coreNode = doc->getElementById(elementId);
+ if (!coreNode || !coreNode->renderer())
+ return false;
+
+ return controller->pauseAnimationAtTime(coreNode->renderer(), animationName, time);
+}
+
+bool QWEBKIT_EXPORT qt_drt_pauseTransitionOfProperty(QWebFrame *qframe, const QString &propertyName, double time, const QString &elementId)
+{
+ Frame* frame = QWebFramePrivate::core(qframe);
+ if (!frame)
+ return false;
+
+ AnimationController* controller = frame->animation();
+ if (!controller)
+ return false;
+
+ Document* doc = frame->document();
+ Q_ASSERT(doc);
+
+ Node* coreNode = doc->getElementById(elementId);
+ if (!coreNode || !coreNode->renderer())
+ return false;
+
+ return controller->pauseTransitionAtTime(coreNode->renderer(), propertyName, time);
+}
+
+// Returns the total number of currently running animations (includes both CSS transitions and CSS animations).
+int QWEBKIT_EXPORT qt_drt_numberOfActiveAnimations(QWebFrame *qframe)
+{
+ Frame* frame = QWebFramePrivate::core(qframe);
+ if (!frame)
+ return false;
+
+ AnimationController* controller = frame->animation();
+ if (!controller)
+ return false;
+
+ return controller->numberOfActiveAnimations();
}
void QWebFramePrivate::init(QWebFrame *qframe, WebCore::Page *webcorePage, QWebFrameData *frameData)
@@ -144,6 +205,37 @@ WebCore::Scrollbar* QWebFramePrivate::verticalScrollBar() const
return frame->view()->verticalScrollbar();
}
+void QWebFramePrivate::renderPrivate(QPainter *painter, const QRegion &clip, bool contents)
+{
+ if (!frame->view() || !frame->contentRenderer())
+ return;
+
+ QVector<QRect> vector = clip.rects();
+ if (vector.isEmpty())
+ return;
+
+ WebCore::FrameView* view = frame->view();
+ view->layoutIfNeededRecursive();
+
+ GraphicsContext context(painter);
+
+ if (!contents)
+ view->paint(&context, vector.first());
+ else
+ view->paintContents(&context, vector.first());
+
+ for (int i = 1; i < vector.size(); ++i) {
+ const QRect& clipRect = vector.at(i);
+ painter->save();
+ painter->setClipRect(clipRect, Qt::IntersectClip);
+ if (!contents)
+ view->paint(&context, clipRect);
+ else
+ view->paintContents(&context, clipRect);
+ painter->restore();
+ }
+}
+
/*!
\class QWebFrame
\since 4.4
@@ -192,7 +284,7 @@ QWebFrame::QWebFrame(QWebPage *parent, QWebFrameData *frameData)
if (!frameData->url.isEmpty()) {
WebCore::ResourceRequest request(frameData->url, frameData->referrer);
- d->frame->loader()->load(request, frameData->name);
+ d->frame->loader()->load(request, frameData->name, false);
}
}
@@ -260,15 +352,15 @@ void QWebFrame::addToJavaScriptWindowObject(const QString &name, QObject *object
JSC::ExecState* exec = window->globalExec();
- JSC::JSObject*runtimeObject =
- JSC::Bindings::Instance::createRuntimeObject(exec, JSC::Bindings::QtInstance::getQtInstance(object, root, ownership));
+ JSC::JSObject* runtimeObject =
+ JSC::Bindings::QtInstance::getQtInstance(object, root, ownership)->createRuntimeObject(exec);
JSC::PutPropertySlot slot;
window->put(exec, JSC::Identifier(exec, (const UChar *) name.constData(), name.length()), runtimeObject, slot);
}
/*!
- Returns the frame's content as HTML, enclosed in HTML and BODY tags.
+ Returns the frame's content, converted to HTML.
\sa setHtml(), toPlainText()
*/
@@ -280,8 +372,7 @@ QString QWebFrame::toHtml() const
}
/*!
- Returns the content of this frame converted to plain text, completely
- stripped of all HTML formatting.
+ Returns the content of this frame converted to plain text.
\sa toHtml()
*/
@@ -468,7 +559,7 @@ void QWebFrame::load(const QWebNetworkRequest &req)
if (!postData.isEmpty())
request.setHTTPBody(WebCore::FormData::create(postData.constData(), postData.size()));
- d->frame->loader()->load(request);
+ d->frame->loader()->load(request, false);
if (d->parentFrame())
d->page->d->insideOpenCall = false;
@@ -524,7 +615,7 @@ void QWebFrame::load(const QNetworkRequest &req,
if (!body.isEmpty())
request.setHTTPBody(WebCore::FormData::create(body.constData(), body.size()));
- d->frame->loader()->load(request);
+ d->frame->loader()->load(request, false);
if (d->parentFrame())
d->page->d->insideOpenCall = false;
@@ -551,7 +642,7 @@ void QWebFrame::setHtml(const QString &html, const QUrl &baseUrl)
const QByteArray utf8 = html.toUtf8();
WTF::RefPtr<WebCore::SharedBuffer> data = WebCore::SharedBuffer::create(utf8.constData(), utf8.length());
WebCore::SubstituteData substituteData(data, WebCore::String("text/html"), WebCore::String("utf-8"), kurl);
- d->frame->loader()->load(request, substituteData);
+ d->frame->loader()->load(request, substituteData, false);
}
/*!
@@ -574,7 +665,7 @@ void QWebFrame::setContent(const QByteArray &data, const QString &mimeType, cons
if (actualMimeType.isEmpty())
actualMimeType = QLatin1String("text/html");
WebCore::SubstituteData substituteData(buffer, WebCore::String(actualMimeType), WebCore::String(), kurl);
- d->frame->loader()->load(request, substituteData);
+ d->frame->loader()->load(request, substituteData, false);
}
@@ -712,6 +803,21 @@ int QWebFrame::scrollBarMinimum(Qt::Orientation orientation) const
}
/*!
+ \since 4.6
+ Returns the geometry for the scrollbar with orientation \a orientation.
+
+ If the scrollbar does not exist an empty rect is returned.
+*/
+QRect QWebFrame::scrollBarGeometry(Qt::Orientation orientation) const
+{
+ Scrollbar *sb;
+ sb = (orientation == Qt::Horizontal) ? d->horizontalScrollBar() : d->verticalScrollBar();
+ if (sb)
+ return sb->frameRect();
+ return QRect();
+}
+
+/*!
\since 4.5
Scrolls the frame \a dx pixels to the right and \a dy pixels downward. Both
\a dx and \a dy may be negative.
@@ -757,25 +863,7 @@ void QWebFrame::setScrollPosition(const QPoint &pos)
*/
void QWebFrame::render(QPainter *painter, const QRegion &clip)
{
- if (!d->frame->view() || !d->frame->contentRenderer())
- return;
-
- d->frame->view()->layoutIfNeededRecursive();
-
- GraphicsContext ctx(painter);
- QVector<QRect> vector = clip.rects();
- WebCore::FrameView* view = d->frame->view();
- for (int i = 0; i < vector.size(); ++i) {
- if (i > 0) {
- painter->save();
- painter->setClipRect(vector.at(i), Qt::IntersectClip);
- }
-
- view->paint(&ctx, vector.at(i));
-
- if (i > 0)
- painter->restore();
- }
+ d->renderPrivate(painter, clip);
}
/*!
@@ -783,14 +871,19 @@ void QWebFrame::render(QPainter *painter, const QRegion &clip)
*/
void QWebFrame::render(QPainter *painter)
{
- if (!d->frame->view() || !d->frame->contentRenderer())
+ if (!d->frame->view())
return;
- d->frame->view()->layoutIfNeededRecursive();
+ d->renderPrivate(painter, QRegion(d->frame->view()->frameRect()));
+}
- GraphicsContext ctx(painter);
- WebCore::FrameView* view = d->frame->view();
- view->paint(&ctx, view->frameRect());
+/*!
+ \since 4.6
+ Render the frame's \a contents into \a painter while clipping to \a contents.
+*/
+void QWebFrame::renderContents(QPainter *painter, const QRegion &contents)
+{
+ d->renderPrivate(painter, contents, true);
}
/*!
@@ -862,6 +955,8 @@ QRect QWebFrame::geometry() const
/*!
\property QWebFrame::contentsSize
\brief the size of the contents in this frame
+
+ \sa contentsSizeChanged()
*/
QSize QWebFrame::contentsSize() const
{
@@ -872,6 +967,47 @@ QSize QWebFrame::contentsSize() const
}
/*!
+ \since 4.6
+
+ Returns the document element of this frame.
+
+ The document element provides access to the entire structured
+ content of the frame.
+*/
+QWebElement QWebFrame::documentElement() const
+{
+ WebCore::Document *doc = d->frame->document();
+ if (!doc)
+ return QWebElement();
+ return QWebElement(doc->documentElement());
+}
+
+/*!
+ \since 4.6
+ Returns a new collection of elements that are children of the frame's
+ document element and that match the given CSS selector \a selectorQuery.
+
+ \sa QWebElement::findAll()
+*/
+QList<QWebElement> QWebFrame::findAllElements(const QString &selectorQuery) const
+{
+ return documentElement().findAll(selectorQuery);
+}
+
+/*!
+ \since 4.6
+ Returns the first element in the frame's document that matches the
+ given CSS selector \a selectorQuery. Returns a null element if there is no
+ match.
+
+ \sa QWebElement::findFirst()
+*/
+QWebElement QWebFrame::findFirstElement(const QString &selectorQuery) const
+{
+ return documentElement().findFirst(selectorQuery);
+}
+
+/*!
Performs a hit test on the frame contents at the given position \a pos and returns the hit test result.
*/
QWebHitTestResult QWebFrame::hitTestContent(const QPoint &pos) const
@@ -879,7 +1015,7 @@ QWebHitTestResult QWebFrame::hitTestContent(const QPoint &pos) const
if (!d->frame->view() || !d->frame->contentRenderer())
return QWebHitTestResult();
- HitTestResult result = d->frame->eventHandler()->hitTestResultAtPoint(d->frame->view()->windowToContents(pos), /*allowShadowContent*/ false);
+ HitTestResult result = d->frame->eventHandler()->hitTestResultAtPoint(d->frame->view()->windowToContents(pos), /*allowShadowContent*/ false, /*ignoreClipping*/ true);
return QWebHitTestResult(new QWebHitTestResultPrivate(result));
}
@@ -994,11 +1130,9 @@ QVariant QWebFrame::evaluateJavaScript(const QString& scriptSource)
ScriptController *proxy = d->frame->script();
QVariant rc;
if (proxy) {
- JSC::JSValuePtr v = proxy->evaluate(ScriptSourceCode(scriptSource)).jsValue();
- if (v) {
- int distance = 0;
- rc = JSC::Bindings::convertValueToQVariant(proxy->globalObject()->globalExec(), v, QMetaType::Void, &distance);
- }
+ JSC::JSValue v = proxy->evaluate(ScriptSourceCode(scriptSource)).jsValue();
+ int distance = 0;
+ rc = JSC::Bindings::convertValueToQVariant(proxy->globalObject()->globalExec(), v, QMetaType::Void, &distance);
}
return rc;
}
@@ -1080,6 +1214,16 @@ QWebFrame* QWebFramePrivate::kit(WebCore::Frame* coreFrame)
*/
/*!
+ \fn void QWebFrame::contentsSizeChanged(const QSize &size)
+ \since 4.6
+
+ This signal is emitted when the frame's contents size changes
+ to \a size.
+
+ \sa contentsSize()
+*/
+
+/*!
\class QWebHitTestResult
\since 4.4
\brief The QWebHitTestResult class provides information about the web
@@ -1100,6 +1244,7 @@ QWebHitTestResult::QWebHitTestResult(QWebHitTestResultPrivate *priv)
QWebHitTestResultPrivate::QWebHitTestResultPrivate(const WebCore::HitTestResult &hitTest)
: isContentEditable(false)
, isContentSelected(false)
+ , isScrollBar(false)
{
if (!hitTest.innerNode())
return;
@@ -1111,6 +1256,7 @@ QWebHitTestResultPrivate::QWebHitTestResultPrivate(const WebCore::HitTestResult
linkTitle = hitTest.titleDisplayString();
alternateText = hitTest.altDisplayString();
imageUrl = hitTest.absoluteImageURL();
+ innerNode = hitTest.innerNode();
innerNonSharedNode = hitTest.innerNonSharedNode();
WebCore::Image *img = hitTest.image();
if (img) {
@@ -1121,13 +1267,19 @@ QWebHitTestResultPrivate::QWebHitTestResultPrivate(const WebCore::HitTestResult
WebCore::Frame *wframe = hitTest.targetFrame();
if (wframe)
linkTargetFrame = QWebFramePrivate::kit(wframe);
+ Element* urlElement = hitTest.URLElement();
+ if (urlElement)
+ linkTarget = urlElement->target();
isContentEditable = hitTest.isContentEditable();
isContentSelected = hitTest.isSelected();
+ isScrollBar = hitTest.scrollbar();
if (innerNonSharedNode && innerNonSharedNode->document()
&& innerNonSharedNode->document()->frame())
frame = QWebFramePrivate::kit(innerNonSharedNode->document()->frame());
+
+ enclosingBlock = QWebElement(WebCore::enclosingBlock(innerNode.get()));
}
/*!
@@ -1204,6 +1356,21 @@ QRect QWebHitTestResult::boundingRect() const
}
/*!
+ \since 4.6
+ Returns the block element that encloses the element hit.
+
+ A block element is an element that is rendered using the
+ CSS "block" style. This includes for example text
+ paragraphs.
+*/
+QWebElement QWebHitTestResult::enclosingBlockElement() const
+{
+ if (!d)
+ return QWebElement();
+ return d->enclosingBlock;
+}
+
+/*!
Returns the title of the nearest enclosing HTML element.
*/
QString QWebHitTestResult::title() const
@@ -1244,7 +1411,22 @@ QUrl QWebHitTestResult::linkTitle() const
}
/*!
+ \since 4.6
+ Returns the name of the target frame that will load the link if it is activated.
+
+ \sa linkTargetFrame()
+*/
+QString QWebHitTestResult::linkTarget() const
+{
+ if (!d)
+ return 0;
+ return d->linkTarget;
+}
+
+/*!
Returns the frame that will load the link if it is activated.
+
+ \sa linkTarget()
*/
QWebFrame *QWebHitTestResult::linkTargetFrame() const
{
@@ -1305,6 +1487,18 @@ bool QWebHitTestResult::isContentSelected() const
}
/*!
+ \since 4.6
+ Returns the underlying DOM element as QWebElement.
+*/
+QWebElement QWebHitTestResult::element() const
+{
+ if (!d || !d->innerNonSharedNode || !d->innerNonSharedNode->isElementNode())
+ return QWebElement();
+
+ return QWebElement(static_cast<WebCore::Element*>(d->innerNonSharedNode.get()));
+}
+
+/*!
Returns the frame the hit test was executed in.
*/
QWebFrame *QWebHitTestResult::frame() const
@@ -1314,3 +1508,13 @@ QWebFrame *QWebHitTestResult::frame() const
return d->frame;
}
+/*!
+ \since 4.6
+ Returns true if the test includes a scrollbar.
+*/
+bool QWebHitTestResult::isScrollBar() const
+{
+ if (!d)
+ return false;
+ return d->isScrollBar;
+}
diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebframe.h b/src/3rdparty/webkit/WebKit/qt/Api/qwebframe.h
index 18ae697..ebc22fe 100644
--- a/src/3rdparty/webkit/WebKit/qt/Api/qwebframe.h
+++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebframe.h
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
+ Copyright (C) 2008,2009 Nokia Corporation and/or its subsidiary(-ies)
Copyright (C) 2007 Staikos Computing Services Inc.
This library is free software; you can redistribute it and/or
@@ -49,6 +49,7 @@ class QWebPage;
class QWebHitTestResult;
class QWebHistoryItem;
class QWebSecurityOrigin;
+class QWebElement;
namespace WebCore {
class WidgetPrivate;
@@ -71,12 +72,14 @@ public:
QPoint pos() const;
QRect boundingRect() const;
+ QWebElement enclosingBlockElement() const;
QString title() const;
QString linkText() const;
QUrl linkUrl() const;
QUrl linkTitle() const;
QWebFrame *linkTargetFrame() const;
+ QString linkTarget() const;
QString alternateText() const; // for img, area, input and applet
@@ -86,8 +89,12 @@ public:
bool isContentEditable() const;
bool isContentSelected() const;
+ QWebElement element() const;
+
QWebFrame *frame() const;
+ bool isScrollBar() const;
+
private:
QWebHitTestResult(QWebHitTestResultPrivate *priv);
QWebHitTestResultPrivate *d;
@@ -150,6 +157,7 @@ public:
int scrollBarValue(Qt::Orientation orientation) const;
int scrollBarMinimum(Qt::Orientation orientation) const;
int scrollBarMaximum(Qt::Orientation orientation) const;
+ QRect scrollBarGeometry(Qt::Orientation orientation) const;
void scroll(int, int);
QPoint scrollPosition() const;
@@ -157,6 +165,7 @@ public:
void render(QPainter *painter, const QRegion &clip);
void render(QPainter *painter);
+ void renderContents(QPainter *painter, const QRegion &contents);
void setTextSizeMultiplier(qreal factor);
qreal textSizeMultiplier() const;
@@ -168,6 +177,10 @@ public:
QRect geometry() const;
QSize contentsSize() const;
+ QWebElement documentElement() const;
+ QList<QWebElement> findAllElements(const QString &selectorQuery) const;
+ QWebElement findFirstElement(const QString &selectorQuery) const;
+
QWebHitTestResult hitTestContent(const QPoint &pos) const;
virtual bool event(QEvent *);
@@ -191,6 +204,8 @@ Q_SIGNALS:
void iconChanged();
+ void contentsSizeChanged(const QSize &size);
+
private:
friend class QWebPage;
friend class QWebPagePrivate;
diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebframe_p.h b/src/3rdparty/webkit/WebKit/qt/Api/qwebframe_p.h
index 14f69cd..325e6e0 100644
--- a/src/3rdparty/webkit/WebKit/qt/Api/qwebframe_p.h
+++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebframe_p.h
@@ -27,6 +27,7 @@
#include "EventHandler.h"
#include "KURL.h"
#include "PlatformString.h"
+#include "qwebelement.h"
#include "wtf/RefPtr.h"
#include "Frame.h"
@@ -39,7 +40,6 @@ namespace WebCore
}
class QWebPage;
-
class QWebFrameData
{
public:
@@ -81,6 +81,8 @@ public:
static WebCore::Frame* core(QWebFrame*);
static QWebFrame* kit(WebCore::Frame*);
+ void renderPrivate(QPainter *painter, const QRegion &clip, bool contents = false);
+
QWebFrame *q;
WebCore::FrameLoaderClientQt *frameLoaderClient;
WebCore::Frame *frame;
@@ -94,22 +96,26 @@ public:
class QWebHitTestResultPrivate
{
public:
- QWebHitTestResultPrivate() : isContentEditable(false), isContentSelected(false) {}
+ QWebHitTestResultPrivate() : isContentEditable(false), isContentSelected(false), isScrollBar(false) {}
QWebHitTestResultPrivate(const WebCore::HitTestResult &hitTest);
QPoint pos;
QRect boundingRect;
+ QWebElement enclosingBlock;
QString title;
QString linkText;
QUrl linkUrl;
QString linkTitle;
QPointer<QWebFrame> linkTargetFrame;
+ QString linkTarget;
QString alternateText;
QUrl imageUrl;
QPixmap pixmap;
bool isContentEditable;
bool isContentSelected;
+ bool isScrollBar;
QPointer<QWebFrame> frame;
+ RefPtr<WebCore::Node> innerNode;
RefPtr<WebCore::Node> innerNonSharedNode;
};
diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebkitglobal.h b/src/3rdparty/webkit/WebKit/qt/Api/qwebkitglobal.h
index 19d9218..0885bdc 100644
--- a/src/3rdparty/webkit/WebKit/qt/Api/qwebkitglobal.h
+++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebkitglobal.h
@@ -22,22 +22,14 @@
#include <QtCore/qglobal.h>
-#if defined(Q_OS_WIN)
-# if defined(QT_NODLL)
-# undef QT_MAKEDLL
-# undef QT_DLL
-# elif defined(QT_MAKEDLL) /* create a Qt DLL library */
-# if defined(QT_DLL)
-# undef QT_DLL
-# endif
-# if defined(BUILD_WEBKIT)
-# define QWEBKIT_EXPORT Q_DECL_EXPORT
-# else
-# define QWEBKIT_EXPORT Q_DECL_IMPORT
-# endif
-# elif defined(QT_DLL) /* use a Qt DLL library */
-# define QWEBKIT_EXPORT Q_DECL_IMPORT
+#if defined(QT_MAKEDLL) /* create a Qt DLL library */
+# if defined(BUILD_WEBKIT)
+# define QWEBKIT_EXPORT Q_DECL_EXPORT
+# else
+# define QWEBKIT_EXPORT Q_DECL_IMPORT
# endif
+#elif defined(QT_DLL) /* use a Qt DLL library */
+# define QWEBKIT_EXPORT Q_DECL_IMPORT
#endif
#if !defined(QWEBKIT_EXPORT)
diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp
index 77add54..ee64cad 100644
--- a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp
+++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp
@@ -34,6 +34,7 @@
#include "FrameLoader.h"
#include "FrameLoaderClientQt.h"
#include "FrameView.h"
+#include "FormState.h"
#include "ChromeClientQt.h"
#include "ContextMenu.h"
#include "ContextMenuClientQt.h"
@@ -60,9 +61,11 @@
#include "ProgressTracker.h"
#include "RefPtr.h"
#include "HashMap.h"
+#include "HTMLFormElement.h"
#include "HitTestResult.h"
#include "WindowFeatures.h"
#include "LocalizedStrings.h"
+#include "Cache.h"
#include "runtime/InitializeThreading.h"
#include <QApplication>
@@ -179,6 +182,21 @@ static const char* editorCommandWebActions[] =
"SelectAll", // SelectAll
+ "PasteAndMatchStyle", // PasteAndMatchStyle
+ "RemoveFormat", // RemoveFormat
+ "Strikethrough", // ToggleStrikethrough,
+ "Subscript", // ToggleSubscript
+ "Superscript", // ToggleSuperscript
+ "InsertUnorderedList", // InsertUnorderedList
+ "InsertOrderedList", // InsertOrderedList
+ "Indent", // Indent
+ "Outdent", // Outdent,
+
+ "AlignCenter", // AlignCenter,
+ "AlignJustified", // AlignJustified,
+ "AlignLeft", // AlignLeft,
+ "AlignRight", // AlignRight,
+
0 // WebActionCount
};
@@ -263,6 +281,7 @@ QWebPagePrivate::QWebPagePrivate(QWebPage *qq)
insideOpenCall = false;
forwardUnsupportedContent = false;
editable = false;
+ useFixedLayout = false;
linkPolicy = QWebPage::DontDelegateLinks;
#ifndef QT_NO_CONTEXTMENU
currentContextMenu = 0;
@@ -426,6 +445,14 @@ void QWebPagePrivate::_q_webActionTriggered(bool checked)
q->triggerAction(action, checked);
}
+#ifndef NDEBUG
+void QWebPagePrivate::_q_cleanupLeakMessages()
+{
+ // Need this to make leak messages accurate.
+ cache()->setCapacities(0, 0, 0);
+}
+#endif
+
void QWebPagePrivate::updateAction(QWebPage::WebAction action)
{
QAction *a = actions[action];
@@ -535,6 +562,19 @@ void QWebPagePrivate::updateEditorActions()
updateAction(QWebPage::ToggleUnderline);
updateAction(QWebPage::InsertParagraphSeparator);
updateAction(QWebPage::InsertLineSeparator);
+ updateAction(QWebPage::PasteAndMatchStyle);
+ updateAction(QWebPage::RemoveFormat);
+ updateAction(QWebPage::ToggleStrikethrough);
+ updateAction(QWebPage::ToggleSubscript);
+ updateAction(QWebPage::ToggleSuperscript);
+ updateAction(QWebPage::InsertUnorderedList);
+ updateAction(QWebPage::InsertOrderedList);
+ updateAction(QWebPage::Indent);
+ updateAction(QWebPage::Outdent);
+ updateAction(QWebPage::AlignCenter);
+ updateAction(QWebPage::AlignJustified);
+ updateAction(QWebPage::AlignLeft);
+ updateAction(QWebPage::AlignRight);
}
void QWebPagePrivate::timerEvent(QTimerEvent *ev)
@@ -1026,9 +1066,9 @@ QVariant QWebPage::inputMethodQuery(Qt::InputMethodQuery property) const
case Qt::ImCursorPosition: {
Frame *frame = d->page->focusController()->focusedFrame();
if (frame) {
- Selection selection = frame->selection()->selection();
+ VisibleSelection selection = frame->selection()->selection();
if (selection.isCaret()) {
- return QVariant(selection.start().offset());
+ return QVariant(selection.start().deprecatedEditingOffset());
}
}
return QVariant();
@@ -1155,6 +1195,21 @@ QVariant QWebPage::inputMethodQuery(Qt::InputMethodQuery property) const
\value InsertParagraphSeparator Insert a new paragraph.
\value InsertLineSeparator Insert a new line.
\value SelectAll Selects all content.
+ \value PasteAndMatchStyle Paste content from the clipboard with current style.
+ \value RemoveFormat Removes formatting and style.
+ \value ToggleStrikethrough Toggle the formatting between strikethrough and normal style.
+ \value ToggleSubscript Toggle the formatting between subscript and baseline.
+ \value ToggleSuperscript Toggle the formatting between supercript and baseline.
+ \value InsertUnorderedList Toggles the selection between an ordered list and a normal block.
+ \value InsertOrderedList Toggles the selection between an ordered list and a normal block.
+ \value Indent Increases the indentation of the currently selected format block by one increment.
+ \value Outdent Decreases the indentation of the currently selected format block by one increment.
+ \value AlignCenter Applies center alignment to content.
+ \value AlignJustified Applies full justification to content.
+ \value AlignLeft Applies left justification to content.
+ \value AlignRight Applies right justification to content.
+
+
\omitvalue WebActionCount
*/
@@ -1230,6 +1285,9 @@ QWebPage::QWebPage(QObject *parent)
setView(qobject_cast<QWidget *>(parent));
connect(this, SIGNAL(loadProgress(int)), this, SLOT(_q_onLoadProgressChanged(int)));
+#ifndef NDEBUG
+ connect(QCoreApplication::instance(), SIGNAL(aboutToQuit()), this, SLOT(_q_cleanupLeakMessages()));
+#endif
}
/*!
@@ -1433,10 +1491,9 @@ void QWebPage::triggerAction(WebAction action, bool checked)
case OpenLink:
if (QWebFrame *targetFrame = d->hitTestResult.linkTargetFrame()) {
WTF::RefPtr<WebCore::Frame> wcFrame = targetFrame->d->frame;
- targetFrame->d->frame->loader()->loadFrameRequestWithFormAndValues(frameLoadRequest(d->hitTestResult.linkUrl(), wcFrame.get()),
- /*lockHistory*/ false, /*event*/ 0,
- /*HTMLFormElement*/ 0, /*formValues*/
- WTF::HashMap<String, String>());
+ targetFrame->d->frame->loader()->loadFrameRequest(frameLoadRequest(d->hitTestResult.linkUrl(), wcFrame.get()),
+ /*lockHistory*/ false, /*lockBackForwardList*/ false, /*event*/ 0,
+ /*FormState*/ 0);
break;
}
// fall through
@@ -1536,11 +1593,61 @@ void QWebPage::setViewportSize(const QSize &size) const
if (frame->d->frame && frame->d->frame->view()) {
WebCore::FrameView* view = frame->d->frame->view();
view->setFrameRect(QRect(QPoint(0, 0), size));
- frame->d->frame->forceLayout();
+ view->forceLayout();
view->adjustViewSize();
}
}
+QSize QWebPage::fixedLayoutSize() const
+{
+ if (d->mainFrame && d->mainFrame->d->frame->view())
+ return d->mainFrame->d->frame->view()->fixedLayoutSize();
+
+ return d->fixedLayoutSize;
+}
+
+/*!
+ \property QWebPage::fixedLayoutSize
+ \since 4.6
+ \brief the size of the fixed layout
+
+ The size affects the layout of the page in the viewport. If set to a fixed size of
+ 1024x768 for example then webkit will layout the page as if the viewport were that size
+ rather than something different.
+*/
+void QWebPage::setFixedLayoutSize(const QSize &size) const
+{
+ d->fixedLayoutSize = size;
+
+ QWebFrame *frame = mainFrame();
+ if (frame->d->frame && frame->d->frame->view()) {
+ WebCore::FrameView* view = frame->d->frame->view();
+ view->setFixedLayoutSize(size);
+ view->forceLayout();
+ }
+}
+
+bool QWebPage::useFixedLayout() const
+{
+ return d->useFixedLayout;
+}
+
+/*!
+ \property QWebPage::useFixedLayout
+ \since 4.6
+ \brief whether to use a fixed layout size
+*/
+void QWebPage::setUseFixedLayout(bool useFixedLayout)
+{
+ d->useFixedLayout = useFixedLayout;
+
+ QWebFrame *frame = mainFrame();
+ if (frame->d->frame && frame->d->frame->view()) {
+ WebCore::FrameView* view = frame->d->frame->view();
+ view->setUseFixedLayout(useFixedLayout);
+ view->forceLayout();
+ }
+}
/*!
\fn bool QWebPage::acceptNavigationRequest(QWebFrame *frame, const QNetworkRequest &request, QWebPage::NavigationType type)
@@ -1568,7 +1675,7 @@ bool QWebPage::acceptNavigationRequest(QWebFrame *frame, const QWebNetworkReques
return true;
case DelegateExternalLinks:
- if (WebCore::FrameLoader::shouldTreatSchemeAsLocal(request.url().scheme()))
+ if (WebCore::FrameLoader::shouldTreatURLSchemeAsLocal(request.url().scheme()))
return true;
emit linkClicked(request.url());
return false;
@@ -1808,6 +1915,52 @@ QAction *QWebPage::action(WebAction action) const
text = tr("Insert a new line");
break;
+ case PasteAndMatchStyle:
+ text = tr("Paste and Match Style");
+ break;
+ case RemoveFormat:
+ text = tr("Remove formatting");
+ break;
+
+ case ToggleStrikethrough:
+ text = tr("Strikethrough");
+ checkable = true;
+ break;
+ case ToggleSubscript:
+ text = tr("Subscript");
+ checkable = true;
+ break;
+ case ToggleSuperscript:
+ text = tr("Superscript");
+ checkable = true;
+ break;
+ case InsertUnorderedList:
+ text = tr("Insert Bulleted List");
+ checkable = true;
+ break;
+ case InsertOrderedList:
+ text = tr("Insert Numbered List");
+ checkable = true;
+ break;
+ case Indent:
+ text = tr("Indent");
+ break;
+ case Outdent:
+ text = tr("Outdent");
+ break;
+ case AlignCenter:
+ text = tr("Center");
+ break;
+ case AlignJustified:
+ text = tr("Justify");
+ break;
+ case AlignLeft:
+ text = tr("Align Left");
+ break;
+ case AlignRight:
+ text = tr("Align Right");
+ break;
+
case NoWebAction:
return 0;
}
@@ -1986,12 +2139,10 @@ bool QWebPage::isContentEditable() const
/*!
\property QWebPage::forwardUnsupportedContent
- \brief whether QWebPage should forward unsupported content
-
- If enabled, the unsupportedContent() signal is emitted with a network reply that
- can be used to read the content.
+ \brief whether QWebPage should forward unsupported content through the
+ unsupportedContent signal
- If disabled, the download of such content is aborted immediately.
+ If disabled the download of such content is aborted immediately.
By default unsupported content is not forwarded.
*/
diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.h b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.h
index 7253cee..2152865 100644
--- a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.h
+++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.h
@@ -52,10 +52,11 @@ namespace WebCore {
class ChromeClientQt;
class EditorClientQt;
class FrameLoaderClientQt;
- class FrameLoadRequest;
class InspectorClientQt;
class ResourceHandle;
class HitTestResult;
+
+ struct FrameLoadRequest;
}
class QWEBKIT_EXPORT QWebPage : public QObject
@@ -65,6 +66,8 @@ class QWEBKIT_EXPORT QWebPage : public QObject
Q_PROPERTY(bool modified READ isModified)
Q_PROPERTY(QString selectedText READ selectedText)
Q_PROPERTY(QSize viewportSize READ viewportSize WRITE setViewportSize)
+ Q_PROPERTY(QSize fixedLayoutSize READ fixedLayoutSize WRITE setFixedLayoutSize)
+ Q_PROPERTY(bool useFixedLayout READ useFixedLayout WRITE setUseFixedLayout)
Q_PROPERTY(bool forwardUnsupportedContent READ forwardUnsupportedContent WRITE setForwardUnsupportedContent)
Q_PROPERTY(LinkDelegationPolicy linkDelegationPolicy READ linkDelegationPolicy WRITE setLinkDelegationPolicy)
Q_PROPERTY(QPalette palette READ palette WRITE setPalette)
@@ -148,6 +151,22 @@ public:
SelectAll,
+ PasteAndMatchStyle,
+ RemoveFormat,
+
+ ToggleStrikethrough,
+ ToggleSubscript,
+ ToggleSuperscript,
+ InsertUnorderedList,
+ InsertOrderedList,
+ Indent,
+ Outdent,
+
+ AlignCenter,
+ AlignJustified,
+ AlignLeft,
+ AlignRight,
+
WebActionCount
};
@@ -215,6 +234,12 @@ public:
QSize viewportSize() const;
void setViewportSize(const QSize &size) const;
+ QSize fixedLayoutSize() const;
+ void setFixedLayoutSize(const QSize &size) const;
+
+ bool useFixedLayout() const;
+ void setUseFixedLayout(bool useFixedLayout);
+
virtual bool event(QEvent*);
bool focusNextPrevChild(bool next);
@@ -317,6 +342,9 @@ protected:
private:
Q_PRIVATE_SLOT(d, void _q_onLoadProgressChanged(int))
Q_PRIVATE_SLOT(d, void _q_webActionTriggered(bool checked))
+#ifndef NDEBUG
+ Q_PRIVATE_SLOT(d, void _q_cleanupLeakMessages())
+#endif
QWebPagePrivate *d;
friend class QWebFrame;
diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage_p.h b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage_p.h
index a1f33ab..a897bf1 100644
--- a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage_p.h
+++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage_p.h
@@ -79,6 +79,9 @@ public:
void _q_onLoadProgressChanged(int);
void _q_webActionTriggered(bool checked);
+#ifndef NDEBUG
+ void _q_cleanupLeakMessages();
+#endif
void updateAction(QWebPage::WebAction action);
void updateNavigationActions();
void updateEditorActions();
@@ -154,6 +157,7 @@ public:
QWebPage::LinkDelegationPolicy linkPolicy;
QSize viewportSize;
+ QSize fixedLayoutSize;
QWebHistory history;
QWebHitTestResult hitTestResult;
#ifndef QT_NO_CONTEXTMENU
@@ -162,6 +166,7 @@ public:
QWebSettings *settings;
QPalette palette;
bool editable;
+ bool useFixedLayout;
QAction *actions[QWebPage::WebActionCount];
diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebsecurityorigin.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebsecurityorigin.cpp
index 5217362..da9278c 100644
--- a/src/3rdparty/webkit/WebKit/qt/Api/qwebsecurityorigin.cpp
+++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebsecurityorigin.cpp
@@ -101,7 +101,11 @@ int QWebSecurityOrigin::port() const
*/
qint64 QWebSecurityOrigin::databaseUsage() const
{
+#if ENABLE(DATABASE)
return DatabaseTracker::tracker().usageForOrigin(d->origin.get());
+#else
+ return 0;
+#endif
}
/*!
@@ -109,7 +113,11 @@ qint64 QWebSecurityOrigin::databaseUsage() const
*/
qint64 QWebSecurityOrigin::databaseQuota() const
{
+#if ENABLE(DATABASE)
return DatabaseTracker::tracker().quotaForOrigin(d->origin.get());
+#else
+ return 0;
+#endif
}
/*!
@@ -121,7 +129,9 @@ qint64 QWebSecurityOrigin::databaseQuota() const
*/
void QWebSecurityOrigin::setDatabaseQuota(qint64 quota)
{
+#if ENABLE(DATABASE)
DatabaseTracker::tracker().setQuota(d->origin.get(), quota);
+#endif
}
/*!
@@ -144,14 +154,18 @@ QWebSecurityOrigin::QWebSecurityOrigin(QWebSecurityOriginPrivate* priv)
*/
QList<QWebSecurityOrigin> QWebSecurityOrigin::allOrigins()
{
+ QList<QWebSecurityOrigin> webOrigins;
+
+#if ENABLE(DATABASE)
Vector<RefPtr<SecurityOrigin> > coreOrigins;
DatabaseTracker::tracker().origins(coreOrigins);
- QList<QWebSecurityOrigin> webOrigins;
for (unsigned i = 0; i < coreOrigins.size(); ++i) {
QWebSecurityOriginPrivate* priv = new QWebSecurityOriginPrivate(coreOrigins[i].get());
webOrigins.append(priv);
}
+#endif
+
return webOrigins;
}
@@ -160,8 +174,11 @@ QList<QWebSecurityOrigin> QWebSecurityOrigin::allOrigins()
*/
QList<QWebDatabase> QWebSecurityOrigin::databases() const
{
- Vector<String> nameVector;
QList<QWebDatabase> databases;
+
+#if ENABLE(DATABASE)
+ Vector<String> nameVector;
+
if (!DatabaseTracker::tracker().databaseNamesForOrigin(d->origin.get(), nameVector))
return databases;
for (unsigned i = 0; i < nameVector.size(); ++i) {
@@ -171,6 +188,8 @@ QList<QWebDatabase> QWebSecurityOrigin::databases() const
QWebDatabase webDatabase(priv);
databases.append(webDatabase);
}
+#endif
+
return databases;
}
diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.cpp
index b516263..8192e68 100644
--- a/src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.cpp
+++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.cpp
@@ -24,6 +24,8 @@
#include "qwebpage_p.h"
#include "Cache.h"
+#include "CrossOriginPreflightResultCache.h"
+#include "FontCache.h"
#include "Page.h"
#include "PageCache.h"
#include "Settings.h"
@@ -52,6 +54,7 @@ public:
QHash<int, int> fontSizes;
QHash<int, bool> attributes;
QUrl userStyleSheetLocation;
+ QString defaultTextEncoding;
QString localStorageDatabasePath;
QString offlineWebApplicationCachePath;
qint64 offlineStorageDefaultQuota;
@@ -161,6 +164,9 @@ void QWebSettingsPrivate::apply()
QUrl location = !userStyleSheetLocation.isEmpty() ? userStyleSheetLocation : global->userStyleSheetLocation;
settings->setUserStyleSheetLocation(WebCore::KURL(location));
+ QString encoding = !defaultTextEncoding.isEmpty() ? defaultTextEncoding: global->defaultTextEncoding;
+ settings->setDefaultTextEncodingName(encoding);
+
QString localStoragePath = !localStorageDatabasePath.isEmpty() ? localStorageDatabasePath : global->localStorageDatabasePath;
settings->setLocalStorageDatabasePath(localStoragePath);
@@ -183,6 +189,10 @@ void QWebSettingsPrivate::apply()
value = attributes.value(QWebSettings::LocalStorageDatabaseEnabled,
global->attributes.value(QWebSettings::LocalStorageDatabaseEnabled));
settings->setLocalStorageEnabled(value);
+
+ value = attributes.value(QWebSettings::AllowUniversalAccessFromFileUrls,
+ global->attributes.value(QWebSettings::AllowUniversalAccessFromFileUrls));
+ settings->setAllowUniversalAccessFromFileURLs(value);
} else {
QList<QWebSettingsPrivate *> settings = *::allSettings();
for (int i = 0; i < settings.count(); ++i)
@@ -213,25 +223,17 @@ QWebSettings *QWebSettings::globalSettings()
Each QWebPage object has its own QWebSettings object, which configures the
settings for that page. If a setting is not configured, then it is looked
up in the global settings object, which can be accessed using
- globalSettings().
+ QWebSettings::globalSettings().
- QWebSettings allows configuration of browser properties, such as font sizes and
- families, the location of a custom style sheet, and generic attributes like
- JavaScript and plugins. Individual attributes are set using the setAttribute()
- function. The \l{QWebSettings::WebAttribute}{WebAttribute} enum further describes
- each attribute.
+ QWebSettings allows configuring font properties such as font size and font
+ family, the location of a custom stylesheet, and generic attributes like java
+ script, plugins, etc. The \l{QWebSettings::WebAttribute}{WebAttribute}
+ enum further describes this.
- QWebSettings also configures global properties such as the Web page memory
- cache and the Web page icon database, local database storage and offline
+ QWebSettings also configures global properties such as the web page memory
+ cache and the web page icon database, local database storage and offline
applications storage.
- \section1 Enabling Plugins
-
- Support for browser plugins can enabled by setting the
- \l{QWebSettings::PluginsEnabled}{PluginsEnabled} attribute. For many applications,
- this attribute is enabled for all pages by setting it on the
- \l{globalSettings()}{global settings object}.
-
\section1 Web Application Support
WebKit provides support for features specified in \l{HTML 5} that improve the
@@ -318,6 +320,8 @@ QWebSettings *QWebSettings::globalSettings()
web application cache feature is enabled or not.
\value LocalStorageDatabaseEnabled Specifies whether support for the HTML 5
local storage feature is enabled or not.
+ \value AllowUniversalAccessFromFileUrls Specifies whether documents from file
+ Urls should be granted universal access (e.g., to HTTP and HTTPS documents).
*/
/*!
@@ -346,6 +350,7 @@ QWebSettings::QWebSettings()
d->attributes.insert(QWebSettings::OfflineStorageDatabaseEnabled, true);
d->attributes.insert(QWebSettings::OfflineWebApplicationCacheEnabled, true);
d->attributes.insert(QWebSettings::LocalStorageDatabaseEnabled, true);
+ d->attributes.insert(QWebSettings::AllowUniversalAccessFromFileUrls, true);
d->offlineStorageDefaultQuota = 5 * 1024 * 1024;
}
@@ -432,6 +437,33 @@ QUrl QWebSettings::userStyleSheetUrl() const
}
/*!
+ \since 4.6
+ Specifies the default text encoding system.
+
+ The \a encoding, must be a string describing an encoding such as "utf-8",
+ "iso-8859-1", etc. If left empty a default value will be used. For a more
+ extensive list of encoding names see \l{QTextCodec}
+
+ \sa defaultTextEncoding()
+*/
+void QWebSettings::setDefaultTextEncoding(const QString &encoding)
+{
+ d->defaultTextEncoding = encoding;
+ d->apply();
+}
+
+/*!
+ \since 4.6
+ Returns the default text encoding.
+
+ \sa setDefaultTextEncoding()
+*/
+QString QWebSettings::defaultTextEncoding() const
+{
+ return d->defaultTextEncoding;
+}
+
+/*!
Sets the path of the icon database to \a path. The icon database is used
to store "favicons" associated with web sites.
@@ -535,6 +567,40 @@ QPixmap QWebSettings::webGraphic(WebGraphic type)
}
/*!
+ Frees up as much memory as possible by cleaning all memory caches such
+ as page, object and font cache.
+
+ \since 4.6
+ */
+void QWebSettings::clearMemoryCaches()
+{
+ // Turn the cache on and off. Disabling the object cache will remove all
+ // resources from the cache. They may still live on if they are referenced
+ // by some Web page though.
+ if (!WebCore::cache()->disabled()) {
+ WebCore::cache()->setDisabled(true);
+ WebCore::cache()->setDisabled(false);
+ }
+
+ int pageCapacity = WebCore::pageCache()->capacity();
+ // Setting size to 0, makes all pages be released.
+ WebCore::pageCache()->setCapacity(0);
+ WebCore::pageCache()->releaseAutoreleasedPagesNow();
+ WebCore::pageCache()->setCapacity(pageCapacity);
+
+ // Invalidating the font cache and freeing all inactive font data.
+ WebCore::fontCache()->invalidate();
+
+#if ENABLE(OFFLINE_WEB_APPLICATIONS)
+ // Empty the application cache.
+ WebCore::cacheStorage().empty();
+#endif
+
+ // Empty the Cross-Origin Preflight cache
+ WebCore::CrossOriginPreflightResultCache::shared().empty();
+}
+
+/*!
Sets the maximum number of pages to hold in the memory cache to \a pages.
*/
void QWebSettings::setMaximumPagesInCache(int pages)
diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.h b/src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.h
index 3d0660b..da0c9f2 100644
--- a/src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.h
+++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.h
@@ -63,7 +63,8 @@ public:
PrintElementBackgrounds,
OfflineStorageDatabaseEnabled,
OfflineWebApplicationCacheEnabled,
- LocalStorageDatabaseEnabled
+ LocalStorageDatabaseEnabled,
+ AllowUniversalAccessFromFileUrls
};
enum WebGraphic {
MissingImageGraphic,
@@ -95,6 +96,9 @@ public:
void setUserStyleSheetUrl(const QUrl &location);
QUrl userStyleSheetUrl() const;
+ void setDefaultTextEncoding(const QString &encoding);
+ QString defaultTextEncoding() const;
+
static void setIconDatabasePath(const QString &location);
static QString iconDatabasePath();
static void clearIconDatabase();
@@ -112,6 +116,8 @@ public:
static void setOfflineStorageDefaultQuota(qint64 maximumSize);
static qint64 offlineStorageDefaultQuota();
+ static void clearMemoryCaches();
+
inline QWebSettingsPrivate* handle() const { return d; }
private:
diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp
index 9753f4f..3c56b93 100644
--- a/src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp
+++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp
@@ -27,6 +27,8 @@
#include "qevent.h"
#include "qpainter.h"
#include "qprinter.h"
+#include "qdir.h"
+#include "qfile.h"
class QWebViewPrivate
{
@@ -34,6 +36,7 @@ public:
QWebViewPrivate(QWebView *view)
: view(view)
, page(0)
+ , renderHints(QPainter::TextAntialiasing)
#ifndef QT_NO_CURSOR
, cursorSetByWebCore(false)
, usesWebCoreCursor(true)
@@ -43,6 +46,7 @@ public:
QWebView *view;
QWebPage *page;
+ QPainter::RenderHints renderHints;
#ifndef QT_NO_CURSOR
/*
@@ -245,11 +249,79 @@ void QWebView::setPage(QWebPage *page)
}
/*!
+ Returns a valid URL from a user supplied \a string if one can be deducted.
+ In the case that is not possible, an invalid QUrl() is returned.
+
+ \since 4.6
+
+ Most applications that can browse the web, allow the user to input a URL
+ in the form of a plain string. This string can be manually typed into
+ a location bar, obtained from the clipboard, or passed in via command
+ line arguments.
+
+ When the string is not already a valid URL, a best guess is performed,
+ making various web related assumptions.
+
+ In the case the string corresponds to a valid file path on the system,
+ a file:// URL is constructed, using QUrl::fromLocalFile().
+
+ If that is not the case, an attempt is made to turn the string into a
+ http:// or ftp:// URL. The latter in the case the string starts with
+ 'ftp'. The result is then passed through QUrl's tolerant parser, and
+ in the case or success, a valid QUrl is returned, or else a QUrl().
+
+ Examples
+ - webkit.org becomes http://webkit.org
+ - ftp.webkit.org becomes ftp://ftp.webkit.org
+ - localhost becomes http://localhost
+ - /home/user/test.html becomes file:///home/user/test.html (if exists)
+
+ Tips when dealing with URLs and strings
+ - When creating a QString from a QByteArray or a char*, always use
+ QString::fromUtf8().
+ - Do not use QUrl(string), nor QUrl::toString() anywhere where the URL might
+ be used, such as in the location bar, as those functions loose data.
+ Instead use QUrl::fromEncoded() and QUrl::toEncoded(), respectively.
+
+ */
+QUrl QWebView::guessUrlFromString(const QString &string)
+{
+ QString trimmedString = string.trimmed();
+
+ // Check the most common case of a valid url with scheme and host first
+ QUrl url = QUrl::fromEncoded(trimmedString.toUtf8(), QUrl::TolerantMode);
+ if (url.isValid() && !url.scheme().isEmpty() && !url.host().isEmpty())
+ return url;
+
+ // Absolute files that exists
+ if (QDir::isAbsolutePath(trimmedString) && QFile::exists(trimmedString))
+ return QUrl::fromLocalFile(trimmedString);
+
+ // If the string is missing the scheme or the scheme is not valid prepend a scheme
+ QString scheme = url.scheme();
+ if (scheme.isEmpty() || scheme.contains(QLatin1Char('.')) || scheme == QLatin1String("localhost")) {
+ // Do not do anything for strings such as "foo", only "foo.com"
+ int dotIndex = trimmedString.indexOf(QLatin1Char('.'));
+ if (dotIndex != -1 || trimmedString.startsWith(QLatin1String("localhost"))) {
+ const QString hostscheme = trimmedString.left(dotIndex).toLower();
+ QByteArray scheme = (hostscheme == QLatin1String("ftp")) ? "ftp" : "http";
+ trimmedString = QLatin1String(scheme) + QLatin1String("://") + trimmedString;
+ }
+ url = QUrl::fromEncoded(trimmedString.toUtf8(), QUrl::TolerantMode);
+ }
+
+ if (url.isValid())
+ return url;
+
+ return QUrl();
+}
+
+/*!
Loads the specified \a url and displays it.
\note The view remains the same until enough data has arrived to display the new \a url.
- \sa setUrl(), url(), urlChanged()
+ \sa setUrl(), url(), urlChanged(), guessUrlFromString()
*/
void QWebView::load(const QUrl &url)
{
@@ -533,6 +605,47 @@ qreal QWebView::textSizeMultiplier() const
}
/*!
+ \property QWebView::renderHints
+ \since 4.6
+ \brief the default render hints for the view
+
+ These hints are used to initialize QPainter before painting the web page.
+
+ QPainter::TextAntialiasing is enabled by default.
+*/
+QPainter::RenderHints QWebView::renderHints() const
+{
+ return d->renderHints;
+}
+
+void QWebView::setRenderHints(QPainter::RenderHints hints)
+{
+ if (hints == d->renderHints)
+ return;
+ d->renderHints = hints;
+ update();
+}
+
+/*!
+ If \a enabled is true, the render hint \a hint is enabled; otherwise it
+ is disabled.
+
+ \since 4.6
+ \sa renderHints
+*/
+void QWebView::setRenderHint(QPainter::RenderHint hint, bool enabled)
+{
+ QPainter::RenderHints oldHints = d->renderHints;
+ if (enabled)
+ d->renderHints |= hint;
+ else
+ d->renderHints &= ~hint;
+ if (oldHints != d->renderHints)
+ update();
+}
+
+
+/*!
Finds the next occurrence of the string, \a subString, in the page, using
the given \a options. Returns true of \a subString was found and selects
the match visually; otherwise returns false.
@@ -680,6 +793,7 @@ void QWebView::paintEvent(QPaintEvent *ev)
QWebFrame *frame = d->page->mainFrame();
QPainter p(this);
+ p.setRenderHints(d->renderHints);
frame->render(&p, ev->region());
@@ -914,7 +1028,10 @@ void QWebView::changeEvent(QEvent *e)
This signal is emitted whenever the icon of the page is loaded or changes.
- \sa icon()
+ In order for icons to be loaded, you will need to set an icon database path
+ using QWebSettings::setIconDatabasePath().
+
+ \sa icon(), QWebSettings::setIconDatabasePath()
*/
/*!
diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebview.h b/src/3rdparty/webkit/WebKit/qt/Api/qwebview.h
index 1172f39..5c2c7a0 100644
--- a/src/3rdparty/webkit/WebKit/qt/Api/qwebview.h
+++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebview.h
@@ -25,6 +25,7 @@
#include "qwebpage.h"
#include <QtGui/qwidget.h>
#include <QtGui/qicon.h>
+#include <QtGui/qpainter.h>
#include <QtCore/qurl.h>
#if QT_VERSION >= 0x040400
#include <QtNetwork/qnetworkaccessmanager.h>
@@ -50,6 +51,8 @@ class QWEBKIT_EXPORT QWebView : public QWidget
//Q_PROPERTY(Qt::TextInteractionFlags textInteractionFlags READ textInteractionFlags WRITE setTextInteractionFlags)
Q_PROPERTY(qreal textSizeMultiplier READ textSizeMultiplier WRITE setTextSizeMultiplier DESIGNABLE false)
Q_PROPERTY(qreal zoomFactor READ zoomFactor WRITE setZoomFactor)
+ Q_PROPERTY(QPainter::RenderHints renderHints READ renderHints WRITE setRenderHints)
+ Q_FLAGS(QPainter::RenderHints)
public:
explicit QWebView(QWidget *parent = 0);
virtual ~QWebView();
@@ -57,6 +60,8 @@ public:
QWebPage *page() const;
void setPage(QWebPage *page);
+ static QUrl guessUrlFromString(const QString &string);
+
void load(const QUrl &url);
#if QT_VERSION < 0x040400 && !defined(qdoc)
void load(const QWebNetworkRequest &request);
@@ -99,6 +104,10 @@ public:
void setTextSizeMultiplier(qreal factor);
qreal textSizeMultiplier() const;
+ QPainter::RenderHints renderHints() const;
+ void setRenderHints(QPainter::RenderHints hints);
+ void setRenderHint(QPainter::RenderHint hint, bool enabled);
+
bool findText(const QString &subString, QWebPage::FindFlags options = 0);
virtual bool event(QEvent *);
diff --git a/src/3rdparty/webkit/WebKit/qt/ChangeLog b/src/3rdparty/webkit/WebKit/qt/ChangeLog
index d9f925a..f3bac73 100644
--- a/src/3rdparty/webkit/WebKit/qt/ChangeLog
+++ b/src/3rdparty/webkit/WebKit/qt/ChangeLog
@@ -1,3 +1,223 @@
+2009-06-10 Antonio Gomes <antonio.gomes@openbossa.org>
+
+ Reviewed by Ariya Hidayat.
+
+ Documented ResolveRule and StylePriority enum values as well as their use in
+ QWebElement::styleProperty and QWebElement::setStyleProperty methods.
+
+ Based on the work of Simon Hausmann.
+
+ * Api/qwebelement.cpp:
+ (QWebElement::styleProperty):
+ (QWebElement::setStyleProperty):
+ * Api/qwebelement.h:
+
+2009-06-09 Ariya Hidayat <ariya.hidayat@nokia.com>
+
+ Rubber-stamped by Tor Arne Vestbø.
+
+ Fix qdoc warning, function parameter string must be referred.
+
+ * Api/qwebview.cpp:
+
+2009-06-08 Simon Hausmann <simon.hausmann@nokia.com>
+
+ Reviewed by Holger Freyther.
+
+ Renamed QWebElement::enclosingBlock to enclosingBlockElement
+ and changed the return type to QWebElement, as discussed in
+ the API review. This API is more generic and through
+ QWebElement's geometry() it is possible to retrieve the
+ same information.
+
+ * Api/qwebelement.cpp:
+ (QWebElement::QWebElement):
+ * Api/qwebelement.h:
+ * Api/qwebframe.cpp:
+ (QWebHitTestResultPrivate::QWebHitTestResultPrivate):
+ (QWebHitTestResult::enclosingBlockElement):
+ * Api/qwebframe.h:
+ * Api/qwebframe_p.h:
+
+2009-06-05 Tor Arne Vestbø <tor.arne.vestbo@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ [Qt] Add missing includes of config.h
+
+ * Api/qcookiejar.cpp:
+ * Api/qwebnetworkinterface.cpp:
+ * Plugins/ICOHandler.cpp:
+ * WebCoreSupport/DragClientQt.cpp:
+ * WebCoreSupport/EditCommandQt.cpp:
+
+2009-06-03 Kenneth Rohde Christiansen <kenneth.christiansen@openbossa.org>
+
+ Reviewed by Simon Hausmann.
+
+ Add API to make it possible to clear all memory caches used by
+ QtWebKit.
+
+ * Api/qwebsettings.cpp:
+ (QWebSettings::clearMemoryCaches):
+ * Api/qwebsettings.h:
+
+2009-06-01 Benjamin C Meyer <benjamin.meyer@torchmobile.com>
+
+ Rubber-stamped by Gustavo Noronha.
+
+ Before guessing the url trim the string to remove whitespace added to the start/end by the user.
+
+ * Api/qwebview.cpp:
+ (QWebView::guessUrlFromString):
+ * tests/qwebview/tst_qwebview.cpp:
+ (tst_QWebView::guessUrlFromString_data):
+
+2009-06-01 Benjamin C Meyer <benjamin.meyer@torchmobile.com>
+
+ Rubber-stamped by Gustavo Noronha.
+
+ Use QLatin1Char() to compile when QT_NO_CAST_FROM_ASCII and QT_NO_CAST_TO_ASCII is defined
+
+ * Api/qwebview.cpp:
+ (QWebView::guessUrlFromString):
+
+2009-06-01 Benjamin C Meyer <benjamin.meyer@torchmobile.com>
+
+ Rubber-stamped by Gustavo Noronha.
+
+ Cleanup autotest file
+ - use proper includes
+ - remove useless constructor and destructor
+ - add missing newline at the end of the file
+
+ * tests/qwebview/tst_qwebview.cpp:
+
+2009-06-01 Benjamin C Meyer <benjamin.meyer@torchmobile.com>
+
+ Rubber-stamped by Gustavo Noronha.
+
+ Add a missing space between two words in the documentation.
+
+ * Api/qwebview.cpp:
+
+2009-05-26 Benjamin C Meyer <benjamin.meyer@torchmobile.com>
+
+ Reviewed by Holger Freyther.
+
+ https://bugs.webkit.org/show_bug.cgi?id=25823
+
+ Add an API to generate a QUrl out of a string correcting for errors and missing information.
+ See the API documentation for more details about the function.
+
+ Autotests: included
+
+ * Api/qwebview.cpp:
+ (QWebView::guessUrlFromString):
+ * Api/qwebview.h:
+ * QtLauncher/main.cpp:
+ (MainWindow::MainWindow):
+ (MainWindow::changeLocation):
+ * tests/qwebview/.gitignore: Added.
+ * tests/qwebview/qwebview.pro:
+ (tst_QWebView::initTestCase):
+ (tst_QWebView::cleanupTestCase):
+ (tst_QWebView::init):
+ (tst_QWebView::cleanup):
+ (tst_QWebView::guessUrlFromString_data):
+ (tst_QWebView::guessUrlFromString):
+
+2009-05-23 David Kilzer <ddkilzer@apple.com>
+
+ Part 2 of 2: Bug 25495: Implement PassOwnPtr and replace uses of std::auto_ptr
+
+ <https://bugs.webkit.org/show_bug.cgi?id=25495>
+
+ Reviewed by Oliver Hunt.
+
+ * WebCoreSupport/ChromeClientQt.h:
+ (WebCore::ChromeClientQt::createHTMLParserQuirks): Return a
+ PassOwnPtr<> instead of a raw HTMLParserQuirks pointer.
+
+2009-05-23 Jakob Truelsen <antialize@gmail.com>
+
+ Reviewed by Holger Freyther.
+
+ https://bugs.webkit.org/show_bug.cgi?id=25863
+
+ Expose the default text encoding property to Qt.
+
+ * Api/qwebsettings.cpp:
+ (QWebSettingsPrivate::apply):
+ (QWebSettings::setDefaultTextEncoding):
+ (QWebSettings::defaultTextEncoding):
+ * Api/qwebsettings.h:
+
+2009-05-21 Antonio Gomes <antonio.gomes@openbossa.org>
+
+ Reviewed by Simon Hausmann.
+
+ [Qt] Additional test for resource load (CSS file) for QWebFrame.
+
+ * tests/qwebframe/qwebframe.qrc:
+ * tests/qwebframe/style.css: Added.
+ * tests/qwebframe/tst_qwebframe.cpp:
+
+2009-05-22 Simon Hausmann <simon.hausmann@nokia.com>
+
+ Unreviewed Qt build fix.
+
+ Provide dummy implementation of pure virtual EditorClient method.
+
+ * WebCoreSupport/EditorClientQt.cpp:
+ (WebCore::EditorClientQt::getAutoCorrectSuggestionForMisspelledWord):
+ * WebCoreSupport/EditorClientQt.h:
+
+2009-05-20 Ariya Hidayat <ariya.hidayat@nokia.com>
+
+ Reviewed by Simon Hausmann and Holger Freyther.
+
+ [Qt] Add renderHints property to QWebView.
+
+ * Api/qwebview.cpp:
+ (QWebViewPrivate::QWebViewPrivate):
+ (QWebView::renderHints):
+ (QWebView::setRenderHints):
+ (QWebView::setRenderHint):
+ (QWebView::paintEvent):
+ * Api/qwebview.h:
+ * tests/qwebview/qwebview.pro: Added.
+ * tests/qwebview/tst_qwebview.cpp: Added.
+ (tst_QWebView::tst_QWebView):
+ (tst_QWebView::~tst_QWebView):
+ (tst_QWebView::init):
+ (tst_QWebView::cleanup):
+ (tst_QWebView::renderHints):
+ * tests/tests.pro:
+
+2009-05-20 Holger Hans Peter Freyther <zecke@selfish.org>
+
+ Reviewed by Darin Adler.
+
+ https://bugs.webkit.org/show_bug.cgi?id=25834
+
+ Make ChromeClient a interface again
+
+ With recent additions to ChromeClient.h empty defaults were
+ added. This is bad for porters as these changes go unnoticed
+ and at runtime no notImplemented warning is logged and grepping
+ for notImplemented will not show anything. Change this Client
+ to be like the other Clients again and always have pure virtuals
+ (but for stuff inside #ifdef PLATFORM(MAC)).
+
+ Update the various WebKit/* implementations to compile again.
+
+ * WebCoreSupport/ChromeClientQt.cpp:
+ (WebCore::ChromeClientQt::setCursor):
+ (WebCore::ChromeClientQt::requestGeolocationPermissionForFrame):
+ * WebCoreSupport/ChromeClientQt.h:
+ (WebCore::ChromeClientQt::scrollRectIntoView):
+
2009-05-19 Kenneth Rohde Christiansen <kenneth.christiansen@openbossa.org>
Reviewed by Simon Hausmann.
@@ -12,16 +232,472 @@
* WebCoreSupport/FrameLoaderClientQt.cpp:
(WebCore::):
-2009-03-27 Erik L. Bunce <elbunce@xendom.com>
+2009-05-18 Zoltan Horvath <horvath.zoltan.6@stud.u-szeged.hu>
+
+ Reviewed by Ariya Hidayat.
+
+ Makes QtLauncher to accept multiple urls in command line and opens these in separate windows.
+
+ * QtLauncher/main.cpp:
+ (MainWindow::newWindow):
+ (main):
+
+2009-05-14 Kenneth Rohde Christiansen <kenneth.christiansen@openbossa.org>
+
+ Reviewed by Ariya Hidayat.
+
+ Add a comment to QWebView::iconChanged(), mentioning that you will
+ need to set the icon database path for icons to be loaded, and thus
+ receive the signal.
+
+ * Api/qwebview.cpp:
+
+2009-05-14 Yael Aharon <yael.aharon@nokia.com>
+
+ Reviewed by Ariya Hidayat.
+
+ Fix setHtml test case by adding <head> tag to the expected result. This tag is automatically added by WebKit.
+
+ * tests/qwebframe/tst_qwebframe.cpp:
+
+2009-05-14 Yael Aharon <yael.aharon@nokia.com>
+
+ Reviewed by Ariya Hidayat.
+
+ Add a test case for the signal urlChanged().
+ * tests/qwebframe/tst_qwebframe.cpp:
+
+2009-05-13 Yael Aharon <yael.aharon@nokia.com>
+
+ Reviewed by Ariya Hidayat.
+
+ Move emitting the signal QWebFrame::urlChanged to FrameLoaderClientQt::dispatchDidCommitLoad().
+ This is to ensure that urlChanged() is emitted even if the frame has no title.
+
+ * WebCoreSupport/FrameLoaderClientQt.cpp:
+ (WebCore::FrameLoaderClientQt::dispatchDidReceiveTitle):
+ (WebCore::FrameLoaderClientQt::dispatchDidCommitLoad):
+
+2009-05-13 Kenneth Rohde Christiansen <kenneth.christiansen@openbossa.org>
+
+ Rubberstamped by Ariya Hidayat.
+
+ Fix coding style: Add {} to contents of if, containing a for loop.
+
+ * Api/qwebelement.cpp:
+ (QWebElement::styleProperty):
+
+2009-05-12 Antonio Gomes <antonio.gomes@openbossa.org>
+
+ Reviewed by Ariya Hidayat.
+
+ Fixed a possible crash @styleProperty when there is no embedded/external CSS set.
+
+ * Api/qwebelement.cpp:
+ (QWebElement::styleProperty):
+ * tests/qwebelement/tst_qwebelement.cpp:
+ (tst_QWebElement::style):
+
+2009-05-12 Antonio Gomes <antonio.gomes@openbossa.org>
+
+ Reviewed by Ariya Hidayat.
+
+ Added external CSS test cases to QWebElement::styleProperty() method.
+
+ Also some ::styleProperty() tests cleanup.
+
+ * tests/qwebelement/tst_qwebelement.cpp:
+ (tst_QWebElement::style):
+
+2009-05-12 Kenneth Rohde Christiansen <kenneth.christiansen@openbossa.org>
+
+ Reviewed by Ariya Hidayat.
+
+ Many methods were not considering the case of the element not having
+ siblings or children when inserting nodes, and thus broke in some
+ situations. This patch fixes that.
+
+ * Api/qwebelement.cpp:
+ (QWebElement::prependInside):
+ (QWebElement::appendOutside):
+ (QWebElement::encloseWith):
+
+2009-05-08 Kenneth Rohde Christiansen <kenneth.christiansen@openbossa.org>
+
+ Reviewed by Ariya Hidayat.
+
+ Make is possible to mark a style property as important while setting
+ it. Also support the normal CSS property syntax "!important", while
+ accepting spaces between the ! and the important keyword.
+
+ * Api/qwebelement.cpp:
+ (QWebElement::setStyleProperty):
+ * Api/qwebelement.h:
+ * tests/qwebelement/tst_qwebelement.cpp:
+ (tst_QWebElement::style):
+
+2009-05-08 Kenneth Rohde Christiansen <kenneth.christiansen@openbossa.org>
+
+ Reviewed by Ariya Hidayat.
+
+ Working with Antonio Gomes.
+
+ Add support for finding the style property actually applied to the element.
+
+ * Api/qwebelement.cpp:
+ (QWebElement::styleProperty):
+ * Api/qwebelement.h:
+ * tests/qwebelement/tst_qwebelement.cpp:
+ (tst_QWebElement::style):
+
+2009-05-11 Norbert Leser <norbert.leser@nokia.com>
+
+ Reviewed by Darin Adler.
+
+ Bug 24538: class/struct mixup in forward declarations
+ https://bugs.webkit.org/show_bug.cgi?id=24538
+
+ * Api/qwebpage.h:
+
+2009-05-11 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+
+ Reviewed by Holger Freyther.
+
+ Fix Qt build when ENABLE_DATABASE is turned off
+
+ https://bugs.webkit.org/show_bug.cgi?id=25587
+
+ * Api/qwebdatabase.cpp:
+ (QWebDatabase::displayName):
+ (QWebDatabase::expectedSize):
+ (QWebDatabase::size):
+ (QWebDatabase::fileName):
+ (QWebDatabase::removeDatabase):
+ * Api/qwebdatabase_p.h:
+ * Api/qwebsecurityorigin.cpp:
+ (QWebSecurityOrigin::allOrigins):
+ (QWebSecurityOrigin::databases):
+
+2009-05-05 Kenneth Rohde Christiansen <kenneth.christiansen@openbossa.org>
Reviewed by Simon Hausmann.
- https://bugs.webkit.org/show_bug.cgi?id=24746
+ Improve behaviour of the QWebElement enclose* functions, to work
+ similar to the jQuery wrap functions. We now enclose the contents
+ of the element in the child of the deepest descendant element
+ within the structure of the enclose element structure given.
+
+ * Api/qwebelement.cpp:
+ (findInsertionPoint):
+ (QWebElement::encloseContentsWith):
+ (QWebElement::encloseWith):
+ (QWebElement::replace):
+ * tests/qwebelement/tst_qwebelement.cpp:
+ (tst_QWebElement::encloseContentsWith):
+ (tst_QWebElement::encloseWith):
+
+2009-05-06 Kenneth Rohde Christiansen <kenneth.christiansen@openbossa.org>
+
+ Reviewed by Simon Hausmann.
+
+ After commit rev @43215, setHtml() without a <head> tag,
+ automatically adds it, so update our test case to respect this.
+
+ * tests/qwebelement/tst_qwebelement.cpp:
+ (tst_QWebElement::textHtml):
+
+2009-05-06 Simon Hausmann <simon.hausmann@nokia.com>
+
+ Unreviewed Qt build fix.
+
+ Dont' use ENABLE() in Qt API headers, as they are not available when building
+ against the API.
+
+ * Api/qwebdatabase.h:
+ * Api/qwebsecurityorigin.h:
+
+2009-05-05 Ben Murdoch <benm@google.com>
+
+ Reviewed by Eric Seidel.
+
+ Add #if ENABLE(DATABASE) guards around database code so toggling ENABLE_DATABASE off does not break builds.
+ https://bugs.webkit.org/show_bug.cgi?id=24776
+
+ * Api/qwebdatabase.cpp:
+ * Api/qwebdatabase.h:
+ * Api/qwebdatabase_p.h:
+ * Api/qwebsecurityorigin.cpp:
+ (QWebSecurityOrigin::databaseUsage):
+ (QWebSecurityOrigin::databaseQuota):
+ (QWebSecurityOrigin::setDatabaseQuota):
+ * Api/qwebsecurityorigin.h:
+ * WebCoreSupport/ChromeClientQt.cpp:
+ (WebCore::ChromeClientQt::exceededDatabaseQuota):
+ * WebCoreSupport/ChromeClientQt.h:
+
+2009-05-05 Simon Hausmann <simon.hausmann@nokia.com>
+
+ Reviewed by Tor Arne Vestbø.
+
+ Various improvements to the class documentation, including a simple snippet for QWebElement.
+
+ * Api/qwebelement.cpp:
+ * Api/qwebframe.cpp:
+ * docs/webkitsnippets/webelement/main.cpp: Added.
+ * docs/webkitsnippets/webelement/webelement.pro: Added.
+
+2009-05-05 Simon Hausmann <simon.hausmann@nokia.com>
+
+ Reviewed by Ariya Hidayat.
+
+ Simplify variant conversion by moving the null check into
+ convertValueToQVariant.
+
+ * Api/qwebframe.cpp:
+ (QWebFrame::evaluateJavaScript): Moved null check into conversion function.
+ * tests/qwebframe/tst_qwebframe.cpp:
+ Added test to verify the correct conversion of null values to QVariant.
+
+2009-05-01 Geoffrey Garen <ggaren@apple.com>
+
+ Rubber Stamped by Sam Weinig.
+
+ Renamed JSValuePtr => JSValue.
+
+ * Api/qwebelement.cpp:
+ (setupScriptContext):
+ (setupScriptObject):
+ (QWebElement::evaluateScript):
+ (QWebElement::functions):
+ (QWebElement::scriptableProperty):
+ (QWebElement::setScriptableProperty):
+ (QWebElement::scriptableProperties):
+
+2009-05-01 Pavel Feldman <pfeldman@chromium.org>
+
+ Reviewed by Timothy Hatcher.
+
+ Add a FrameLoaderClient callback for the ResourceRetrievedByXMLHttpRequest.
+
+ https://bugs.webkit.org/show_bug.cgi?id=25347
+
+ * WebCoreSupport/FrameLoaderClientQt.cpp:
+ (WebCore::FrameLoaderClientQt::dispatchDidLoadResourceByXMLHttpRequest):
+ * WebCoreSupport/FrameLoaderClientQt.h:
+
+2009-04-30 David Kilzer <ddkilzer@apple.com>
+
+ Provide a mechanism to create a quirks delegate for HTMLParser
+
+ Reviewed by David Hyatt.
+
+ * WebCoreSupport/ChromeClientQt.h:
+ (WebCore::ChromeClientQt::createHTMLParserQuirks): Added. The
+ default implementation of this factory method returns 0.
+
+2009-04-30 Ariya Hidayat <ariya.hidayat@nokia.com>
+
+ Unreviewed build fix after r43072.
+
+ * Api/qwebframe.cpp:
+ (qt_drt_setJavaScriptProfilingEnabled): Enclose with JAVASCRIPT_DEBUGGER.
+
+2009-04-30 Ariya Hidayat <ariya.hidayat@nokia.com>
+
+ Unreviewed build fix after r43063.
- Improved selection tests.
+ * WebCoreSupport/ChromeClientQt.cpp:
+ (WebCore::ChromeClientQt::addMessageToConsole):
+ * WebCoreSupport/ChromeClientQt.h:
+
+2009-04-30 Kenneth Rohde Christiansen <kenneth.christiansen@openbossa.org>
+
+ Reviewed by Simon Hausmann.
+
+ Implement encloseContentsWith and rename wrap to encloseWith.
+ Also in encloseWith, make sure that you cannot enclose with
+ non-enclosable elements.
+
+ * Api/qwebelement.cpp:
+ (QWebElement::encloseContentsWith):
+ (QWebElement::encloseWith):
+ * Api/qwebelement.h:
+ * tests/qwebelement/tst_qwebelement.cpp:
+ (tst_QWebElement::encloseContentsWith):
+ (tst_QWebElement::encloseWith):
+
+2009-04-30 Holger Hans Peter Freyther <zecke@selfish.org>
+
+ Reviewed by Darin Adler.
+
+ The Qt API exposes a global history patch CSSStyleSelector to make API consumers work again
+
+ https://bugs.webkit.org/show_bug.cgi?id=20952
+
+ The QtWebKit port made the mistake of exposing a global history. This broke
+ with the addition of PageGroup and LinkHash. This needs to be repaired
+ for Qt4.5.
+
+ Add a function to LinkHash.cpp that is resolving a URL. Use this
+ function from within CSSStyleSelector to forward the url to the
+ QWebHistoryInterface API.
+
+ It is sad that there is a path within visitedLinkHash which is now
+ doing a memcpy, it is sad to add a PLATFORM(QT) define to CSSStyleSelector
+ and using QtWebKit types within WebCore is a layering violation as well.
+
+ PageGroup::setShouldTrackVisitedLinks is currently not enabled. For
+ Qt4.6 a second version of the QWebHistoryInterface is going to be
+ added which will fix things up.
+
+ * Api/qwebhistoryinterface.cpp:
+ (QWebHistoryInterface::setDefaultInterface): Add note for Qt4.6
+ * Api/qwebpage.cpp: Remove PageGroup::setShouldTrackVisitedLinks(true)
+ (QWebPagePrivate::QWebPagePrivate):
+ * tests/qwebhistoryinterface/qwebhistoryinterface.pro: Added unit test.
+ * tests/qwebhistoryinterface/tst_qwebhistoryinterface.cpp: Added unit test.
+ (tst_QWebHistoryInterface::tst_QWebHistoryInterface):
+ (tst_QWebHistoryInterface::~tst_QWebHistoryInterface):
+ (tst_QWebHistoryInterface::init):
+ (tst_QWebHistoryInterface::cleanup):
+ (FakeHistoryImplementation::addHistoryEntry):
+ (FakeHistoryImplementation::historyContains):
+ (tst_QWebHistoryInterface::visitedLinks): Check the Qt4.4 behaviour.
+ * tests/tests.pro:
+
+2009-04-30 Ariya Hidayat <ariya.hidayat@nokia.com>
+
+ Unreviewed build fix, after r43035.
+
+ Temporarily use Position::deprecatedEditingOffset().
+
+ * Api/qwebpage.cpp:
+ (QWebPage::inputMethodQuery):
+
+2009-03-27 Benjamin C Meyer <benjamin.meyer@torchmobile.com>
+
+ Reviewed by Simon Hausmann.
+
+ Update the page actions when a finishing loading even if the frame is
+ not the top frame such as when browsing inside of a website with frames.
+ https://bugs.webkit.org/show_bug.cgi?id=24890
+
+ * WebCoreSupport/FrameLoaderClientQt.cpp:
+ (WebCore::FrameLoaderClientQt::dispatchDidFinishLoad):
+ * tests/qwebpage/frametest/frame_a.html: Added.
+ * tests/qwebpage/frametest/index.html: Added.
* tests/qwebpage/tst_qwebpage.cpp:
- (tst_QWebPage::textSelection):
+ (tst_QWebPage::backActionUpdate):
+
+2009-04-29 Ariya Hidayat <ariya.hidayat@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ Implement QWebElement::evaluateScript.
+
+ * Api/qwebelement.cpp:
+ (setupScriptContext):
+ (QWebElement::evaluateScript):
+ * Api/qwebelement.h:
+ * tests/qwebelement/tst_qwebelement.cpp:
+ (tst_QWebElement::evaluateScript):
+
+2009-04-29 Simon Hausmann <simon.hausmann@nokia.com>
+
+ Reviewed by Ariya Hidayat.
+
+ Replaced QWebElementCollection with QList<QWebElement>.
+
+ * Api/qwebelement.cpp:
+ (QWebElement::findAll):
+ * Api/qwebelement.h:
+ * Api/qwebframe.cpp:
+ (QWebFrame::findAllElements):
+ * Api/qwebframe.h:
+ * QtLauncher/main.cpp:
+ (MainWindow::selectElements):
+ * tests/qwebelement/tst_qwebelement.cpp:
+ (tst_QWebElement::simpleCollection):
+ (tst_QWebElement::namespaceURI):
+ (tst_QWebElement::nullSelect):
+
+2009-04-28 Simon Hausmann <simon.hausmann@nokia.com>
+
+ Reviewed by Tor Arne Vestbø.
+
+ QWebElement API changes after another round of API review:
+
+ * Fix argument names of findAll/findFirst
+ * Split up toXml into innerXml and outerXml
+ * Removed confusing toggleClass overload
+ * Fixed casing of namespaceUri to follow QXmlStreamReader
+ * Removed tagName from firstChild/nextSibling/etc.
+ * Renamed append/prepend/insertAfter/insertBefore to [append|prepend][Inside|Outside]
+ * Renamed wrapWith() back to wrap()
+ * Made clone() const
+ * Renamed remove() to takeFromDocument(), added removeFromDocument()
+ * Renamed clear() to removeChildren()
+ * Renamed scriptsFunctions/callScriptFunction to functions()/callFunction()
+ * Renamed scriptProperty to scriptableProperty
+
+ * Api/qwebelement.cpp:
+ (QWebElement::findAll):
+ (QWebElement::findFirst):
+ (QWebElement::setOuterXml):
+ (QWebElement::toOuterXml):
+ (QWebElement::setInnerXml):
+ (QWebElement::toInnerXml):
+ (QWebElement::namespaceUri):
+ (QWebElement::firstChild):
+ (QWebElement::lastChild):
+ (QWebElement::nextSibling):
+ (QWebElement::previousSibling):
+ (QWebElement::callFunction):
+ (QWebElement::functions):
+ (QWebElement::scriptableProperty):
+ (QWebElement::setScriptableProperty):
+ (QWebElement::scriptableProperties):
+ (QWebElement::appendInside):
+ (QWebElement::prependInside):
+ (QWebElement::prependOutside):
+ (QWebElement::appendOutside):
+ (QWebElement::clone):
+ (QWebElement::takeFromDocument):
+ (QWebElement::removeFromDocument):
+ (QWebElement::removeChildren):
+ (QWebElement::wrap):
+ (QWebElement::replace):
+ * Api/qwebelement.h:
+ * Api/qwebframe.cpp:
+ (QWebFrame::findAllElements):
+ (QWebFrame::findFirstElement):
+ * Api/qwebframe.h:
+ * tests/qwebelement/tst_qwebelement.cpp:
+ (tst_QWebElement::textHtml):
+ (tst_QWebElement::classes):
+ (tst_QWebElement::namespaceURI):
+ (tst_QWebElement::foreachManipulation):
+ (tst_QWebElement::callFunction):
+ (tst_QWebElement::callFunctionSubmitForm):
+ (tst_QWebElement::functionNames):
+ (tst_QWebElement::properties):
+ (tst_QWebElement::appendAndPrepend):
+ (tst_QWebElement::insertBeforeAndAfter):
+ (tst_QWebElement::remove):
+ (tst_QWebElement::clear):
+ (tst_QWebElement::replaceWith):
+
+2009-04-28 Simon Hausmann <simon.hausmann@nokia.com>
+
+ Reviewed by Tor Arne Vestbø.
+
+ Fix some qdoc warnings.
+
+ * Api/qwebframe.cpp: Fix links.
+ * Api/qwebnetworkinterface.cpp: Make docs internal.
+ * Api/qwebnetworkinterface.h: Ditto.
+ * Api/qwebpage.cpp: Fix property name in \property.
2009-04-24 Simon Hausmann <simon.hausmann@nokia.com>
@@ -51,27 +727,223 @@
* docs/webkitsnippets/webpage/main.cpp: Added.
* docs/webkitsnippets/webpage/webpage.pro: Added.
-2009-03-02 Benjamin C Meyer <benjamin.meyer@torchmobile.com>
+2009-04-23 Antonio Gomes <antonio.gomes@openbossa.org>
- Reviewed by George Staikos.
+ Reviewed by Ariya Hidayat.
- https://bugs.webkit.org/show_bug.cgi?id=21230
- On X11 match the behavior of Firefox and also copy the url to the
- clipboard selection when the action Copy Link Location is executed.
+ [Qt] Added QWebElement::computedStyleProperty method.
- * Api/qwebpage.cpp:
- (QWebPage::triggerAction):
+ * Api/qwebelement.cpp:
+ (QWebElement::computedStyleProperty):
+ * Api/qwebelement.h:
+ * tests/qwebelement/tst_qwebelement.cpp:
+ (tst_QWebElement::computedStyle):
-2009-03-07 Adam Treat <adam.treat@torchmobile.com>
+2009-04-23 Tor Arne Vestbø <tor.arne.vestbo@nokia.com>
- Reviewed by Cameron Zwarich.
+ Rubber-stamped by Ariya Hidayat.
- These methods are clearly returning the wrong values as the two were
- returning swapped information.
+ [Qt] Rename QWebElement arguments from html to markup
+
+ * Api/qwebelement.cpp:
+ (QWebElement::append):
+ (QWebElement::prepend):
+ (QWebElement::insertBefore):
+ (QWebElement::insertAfter):
+ * Api/qwebelement.h:
+
+2009-04-21 Antonio Gomes <antonio.gomes@openbossa.org>
+
+ Reviewed by Ariya Hidayat.
+
+ QWebElementSelection renamed to QWebElementCollection.
+
+ * Api/qwebelement.cpp:
+ (QWebElement::findAll):
+ (QWebElementCollectionPrivate::QWebElementCollectionPrivate):
+ (QWebElementCollectionPrivate::create):
+ (QWebElementCollection::QWebElementCollection):
+ (QWebElementCollection::operator=):
+ (QWebElementCollection::~QWebElementCollection):
+ (QWebElementCollection::operator+):
+ (QWebElementCollection::append):
+ (QWebElementCollection::count):
+ (QWebElementCollection::at):
+ (QWebElementCollection::toList):
+ * Api/qwebelement.h:
+ * Api/qwebframe.cpp:
+ (QWebFrame::findAllElements):
+ * Api/qwebframe.h:
+ * QtLauncher/main.cpp:
+ (MainWindow::selectElements):
+ * tests/qwebelement/tst_qwebelement.cpp:
+ (tst_QWebElement::simpleCollection):
+ (tst_QWebElement::iteration):
+ (tst_QWebElement::emptyCollection):
+ (tst_QWebElement::appendCollection):
+ (tst_QWebElement::nullSelect):
+
+2009-04-17 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ https://bugs.webkit.org/show_bug.cgi?id=25242
+
+ Remove QtCore 4.5 dependency from QWebElement test
+
+ * tests/qwebelement/tst_qwebelement.cpp:
+ (tst_QWebElement::iteration): Use QList::count() instead of QList::length()
+
+2009-04-16 Holger Hans Peter Freyther <zecke@selfish.org>
+
+ Rubber-stamped by Simon Hausmann.
+
+ Make the operator== and operator!= non inline to
+ allow looking at the d-pointer in the future.
+
+ * Api/qwebelement.cpp:
+ (QWebElement::operator==):
+ (QWebElement::operator!=):
+ * Api/qwebelement.h:
+
+2009-04-15 Antonio Gomes <antonio.gomes@openbossa.org>
+
+ Reviewed by Ariya Hidayat.
+
+ Rename extend() method in QWebElementSelection to append().
+
+ * Api/qwebelement.cpp:
+ (QWebElementSelection::append):
+ * Api/qwebelement.h:
+ * tests/qwebelement/tst_qwebelement.cpp:
+ (tst_QWebElement::appendSelection):
+
+2009-04-15 Antonio Gomes <antonio.gomes@openbossa.org>
+
+ Reviewed by Simon Hausmann.
+
+ Fixed nit/typo in QWebElement documentation.
+
+ * Api/qwebelement.cpp:
+
+2009-04-14 Laszlo Gombos <laszlo.1.gombos@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ https://bugs.webkit.org/show_bug.cgi?id=24841
+
+ Fix linking against QtWebKit for Symbian and other platforms
+ where the OS ABI distinguishes between an import or an export situation.
+
+ * Api/qwebkitglobal.h: Instead of white-listing Win, remove the test.
+
+2009-04-14 Kenneth Rohde Christiansen <kenneth.christiansen@openbossa.org>
+
+ Reviewed by Tor Arne Vestbø.
+
+ Rename QWebElement::setHtml and html to setXml and toXml respectivily.
+
+ Also add a mean to define the scope (inner or other).
+
+ * Api/qwebelement.cpp:
+ (QWebElement::setXml):
+ (QWebElement::toXml):
+ * Api/qwebelement.h:
+ * tests/qwebelement/tst_qwebelement.cpp:
+ (tst_QWebElement::textHtml):
+ (tst_QWebElement::foreachManipulation):
+
+2009-04-14 Kenneth Rohde Christiansen <kenneth.christiansen@openbossa.org>
+
+ Reviewed by Tor Arne Vestbø.
+
+ Rename QWebElement::setText() and text() to ::setPlainText and
+ ::toPlainText, respectively.
+
+ * Api/qwebelement.cpp:
+ (QWebElement::setPlainText):
+ (QWebElement::toPlainText):
+ * Api/qwebelement.h:
+ * tests/qwebelement/tst_qwebelement.cpp:
+ (tst_QWebElement::textHtml):
+ (tst_QWebElement::simpleSelection):
+ (tst_QWebElement::appendAndPrepend):
+ (tst_QWebElement::insertBeforeAndAfter):
+ (tst_QWebElement::replaceWith):
+ (tst_QWebElement::wrap):
+ (tst_QWebElement::firstChildNextSiblingWithTag):
+ (tst_QWebElement::lastChildPreviousSiblingWithTag):
+
+2009-04-06 Tor Arne Vestbø <tor.arne.vestbo@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ [Qt] Rename DOM API select function to findFirst, findAll, etc.
+
+ * Api/qwebelement.cpp:
+ (QWebElement::findAll):
+ (QWebElement::findFirst):
+ * Api/qwebelement.h:
+ * Api/qwebframe.cpp:
+ (QWebFrame::findAllElements):
+ (QWebFrame::findFirstElement):
+ * Api/qwebframe.h:
+ * QtLauncher/main.cpp:
+ (MainWindow::selectElements):
+ * tests/qwebelement/tst_qwebelement.cpp:
+ (tst_QWebElement::simpleSelection):
+ (tst_QWebElement::attributesNS):
+ (tst_QWebElement::classes):
+ (tst_QWebElement::namespaceURI):
+ (tst_QWebElement::iteration):
+ (tst_QWebElement::foreachManipulation):
+ (tst_QWebElement::callFunctionSubmitForm):
+ (tst_QWebElement::documentElement):
+ (tst_QWebElement::frame):
+ (tst_QWebElement::style):
+ (tst_QWebElement::extendSelection):
+ (tst_QWebElement::properties):
+ (tst_QWebElement::appendAndPrepend):
+ (tst_QWebElement::insertBeforeAndAfter):
+ (tst_QWebElement::remove):
+ (tst_QWebElement::clear):
+ (tst_QWebElement::replaceWith):
+ (tst_QWebElement::wrap):
+ (tst_QWebElement::nullSelect):
+ (tst_QWebElement::firstChildNextSibling):
+ (tst_QWebElement::firstChildNextSiblingWithTag):
+ (tst_QWebElement::lastChildPreviousSibling):
+ (tst_QWebElement::lastChildPreviousSiblingWithTag):
+
+2009-04-06 Simon Hausmann <simon.hausmann@nokia.com>
+ Ariya Hidayat <ariya.hidayat@nokia.com>
+ Tor Arne Vestbø <tor.arne.vestbo@nokia.com>
+ Genevieve Mak <gen@staikos.net>
+
+ Reviewed by Tor Arne Vestbø, Simon Hausmann
+
+ First revision of new API in the Qt port to access the DOM.
+
+ * Api/headers.pri: Added qwebelement.h to the API headers.
+ * Api/qwebelement.cpp: Added.
+ * Api/qwebelement.h: Added.
+ * Api/qwebframe.cpp:
+ (QWebFrame::documentElement): Added accessor for the document element.
+ (QWebFrame::selectElements): Added convenienc query method.
+ (QWebFrame::selectElement): Ditto.
+ (QWebHitTestResult::element): Added accessor for underlying DOM element.
+ * Api/qwebframe.h:
+ * QtLauncher/main.cpp: Simple test gui for element selections.
+ * tests/qwebelement/qwebelement.pro: Added.
+ * tests/qwebelement/tst_qwebelement.cpp: Added.
+ * tests/tests.pro: Added QWebElement & QWebElementSelection unit tests.
+
+2009-04-02 Simon Hausmann <simon.hausmann@nokia.com>
+
+ Fix the Qt build.
* Api/qwebpage.cpp:
- (QWebPage::totalBytes):
- (QWebPage::bytesReceived):
+ (QWebPage::triggerAction): Adapted code to renamed loadFrameRequest function.
2009-04-02 Takumi Asaki <takumi.asaki@nokia.com>
@@ -95,6 +967,53 @@
* Api/qwebframe.cpp:
* Api/qwebview.cpp:
+2009-03-29 Darin Adler <darin@apple.com>
+
+ Try to fix Qt build.
+
+ * WebCoreSupport/EditorClientQt.cpp: Added include of HTMLElement.h.
+
+ * WebCoreSupport/FrameLoaderClientQt.cpp: Added include of FormState.h.
+ (WebCore::FrameLoaderClientQt::prepareForDataSourceReplacement):
+ Removed unneeded call to detachChildren, which is called by FrameLoader
+ right after this.
+ (WebCore::FrameLoaderClientQt::createFrame): Use loadURLIntoChildFrame
+ as other platforms do in the corresponding functions.
+
+2009-03-27 Erik L. Bunce <elbunce@xendom.com>
+
+ Reviewed by Simon Hausmann.
+
+ https://bugs.webkit.org/show_bug.cgi?id=24869
+
+ Fixes an incorrect case in tst_qwebpage.
+
+ * tests/qwebpage/tst_qwebpage.cpp:
+ (tst_QWebPage::cursorMovements):
+
+2009-03-27 Erik L. Bunce <elbunce@xendom.com>
+
+ Reviewed by Simon Hausmann.
+
+ https://bugs.webkit.org/show_bug.cgi?id=24746
+
+ Add new editing related QWebPage::WebActions
+ * Clipboard: PasteAndMatchStyle
+ * Formatting: RemoveFormat, ToggleStrikethrough, ToggleSubscript, and
+ ToggleSuperscript
+ * List Editing: InsertUnorderedList, InsertOrderedList, Indent, Outdent
+ * Paragraph Justification: AlignCenter, AlignJustified, AlignLeft, AlignRight
+
+ Improved selection and editing tests.
+
+ * Api/qwebpage.cpp:
+ (QWebPagePrivate::updateEditorActions):
+ (QWebPage::action):
+ * Api/qwebpage.h:
+ * tests/qwebpage/tst_qwebpage.cpp:
+ (tst_QWebPage::textSelection):
+ (tst_QWebPage::textEditing):
+
2009-03-26 Simon Hausmann <simon.hausmann@nokia.com>
Rubber-stamped by Tor Arne Vestbø.
@@ -168,6 +1087,63 @@
* WebCoreSupport/ChromeClientQt.cpp:
(WebCore::ChromeClientQt::setToolTip):
+2009-03-10 Adam Treat <adam.treat@torchmobile.com>
+
+ Build fix for Qt after r41555.
+
+ * Api/qwebpage.cpp:
+ (QWebPage::acceptNavigationRequest):
+
+2009-03-10 Xan Lopez <xlopez@igalia.com>
+
+ Build fix, no review.
+
+ * Api/qwebpage.cpp:
+ (QWebPage::inputMethodQuery):
+
+2009-03-07 Adam Treat <adam.treat@torchmobile.com>
+
+ Reviewed by Cameron Zwarich.
+
+ These methods are clearly returning the wrong values as the two were
+ returning swapped information.
+
+ * Api/qwebpage.cpp:
+ (QWebPage::totalBytes):
+ (QWebPage::bytesReceived):
+
+2009-03-05 Ariya Hidayat <ariya.hidayat@nokia.com>
+
+ Rubber-stamped by Simon Hausmann.
+
+ [Qt] NPAPI plugins are supported, adjust the API documentation.
+
+ * Api/qwebsettings.cpp:
+
+2009-03-04 Adam Barth <abath@webkit.org>
+
+ Reviewed by Alexey Proskuryakov.
+
+ https://bugs.webkit.org/show_bug.cgi?id=24356
+
+ Fix WebKit style for allowUniversalAccessFromFileURLs.
+
+ * Api/qwebsettings.cpp:
+ (QWebSettingsPrivate::apply):
+
+2009-03-03 Adam Barth <abarth@webkit.org>
+
+ Reviewed by Alexey Proskuryakov.
+
+ https://bugs.webkit.org/show_bug.cgi?id=24340
+
+ Expose AllowUniversalAccessFromFileUrls to Qt clients.
+
+ * Api/qwebsettings.cpp:
+ (QWebSettingsPrivate::apply):
+ (QWebSettings::QWebSettings):
+ * Api/qwebsettings.h:
+
2009-03-03 Ariya Hidayat <ariya.hidayat@trolltech.com>
Rubber-stamped by Simon Hausmann.
@@ -181,60 +1157,60 @@
* tests/qwebpage/tst_qwebpage.cpp:
(tst_QWebPage::textSelection):
-2009-02-25 Kavindra Palaraja <kavindra.palaraja@nokia.com>
+2009-03-02 Adam Treat <adam.treat@torchmobile.com>
- Reviewed by Simon Hausmann.
+ Reviewed by Eric Seidel.
- Fix the documentation for the linkHovered signal.
+ Add three new drt helper functions that enable all of the tests in
+ LayoutTests/animation/* and LayoutTests/transitions/* to now pass.
+
+ * Api/qwebframe.cpp:
+ (qt_drt_pauseAnimation):
+ (qt_drt_pauseTransitionOfProperty):
+ (qt_drt_numberOfActiveAnimations):
+
+2009-03-02 Benjamin C Meyer <benjamin.meyer@torchmobile.com>
+
+ Reviewed by George Staikos.
+
+ https://bugs.webkit.org/show_bug.cgi?id=21230
+ On X11 match the behavior of Firefox and also copy the url to the
+ clipboard selection when the action Copy Link Location is executed.
* Api/qwebpage.cpp:
+ (QWebPage::triggerAction):
-2009-02-23 Thiago Macieira <thiago.macieira@nokia.com>
+2009-02-25 Kavindra Palaraja <kavindra.palaraja@nokia.com>
Reviewed by Simon Hausmann.
- Fix the Copyright notices in a few files
-
- * WebKit_pch.h:
+ Fix the documentation for the linkHovered signal.
-2008-12-13 Holger Hans Peter Freyther <zecke@selfish.org>
+ * Api/qwebpage.cpp:
- Reviewed by NOBODY (OOPS!).
+2009-02-23 Adam Treat <adam.treat@torchmobile.com>
- The Qt API exposes a global history patch CSSStyleSelector to make API consumers work again
+ Reviewed by Darin Adler.
- https://bugs.webkit.org/show_bug.cgi?id=20952
+ https://bugs.webkit.org/show_bug.cgi?id=24094
+ Make sure to empty the cache on exit to get rid of superfluous leak messages
+ for CachedResource's in order to keep the leak messages accurate. This
+ is analagous to what the Mac port is doing on application exit when all
+ WebView's have been closed.
- The QtWebKit port made the mistake of exposing a global history. This broke
- with the addition of PageGroup and LinkHash. This needs to be repaired
- for Qt4.5.
+ * Api/qwebpage.cpp:
+ (QWebPagePrivate::_q_cleanupLeakMessages):
+ (QWebPage::QWebPage):
+ * Api/qwebpage.h:
+ * Api/qwebpage_p.h:
- Add a function to LinkHash.cpp that is resolving a URL. Use this
- function from within CSSStyleSelector to forward the url to the
- QWebHistoryInterface API.
+2009-02-23 Thiago Macieira <thiago.macieira@nokia.com>
- It is sad that there is a path within visitedLinkHash which is now
- doing a memcpy, it is sad to add a PLATFORM(QT) define to CSSStyleSelector
- and using QtWebKit types within WebCore is a layering violation as well.
+ Reviewed by Simon Hausmann.
- PageGroup::setShouldTrackVisitedLinks is currently not enabled. For
- Qt4.6 a second version of the QWebHistoryInterface is going to be
- added which will fix things up.
+ Fix the Copyright notices in a few files
- * Api/qwebhistoryinterface.cpp:
- (QWebHistoryInterface::setDefaultInterface): Add note for Qt4.6
- * Api/qwebpage.cpp: Remove PageGroup::setShouldTrackVisitedLinks(true)
- (QWebPagePrivate::QWebPagePrivate):
- * tests/qwebhistoryinterface/qwebhistoryinterface.pro: Added unit test.
- * tests/qwebhistoryinterface/tst_qwebhistoryinterface.cpp: Added unit test.
- (tst_QWebHistoryInterface::tst_QWebHistoryInterface):
- (tst_QWebHistoryInterface::~tst_QWebHistoryInterface):
- (tst_QWebHistoryInterface::init):
- (tst_QWebHistoryInterface::cleanup):
- (FakeHistoryImplementation::addHistoryEntry):
- (FakeHistoryImplementation::historyContains):
- (tst_QWebHistoryInterface::visitedLinks): Check the Qt4.4 behaviour.
- * tests/tests.pro:
+ * WebKit_pch.h:
2009-02-16 Simon Hausmann <simon.hausmann@nokia.com>
@@ -246,6 +1222,22 @@
(WebCore::FrameLoaderClientQt::canShowMIMEType): Don't call into the
PluginDatabase if plugins are disabled in the settings.
+2009-02-13 Benjamin C Meyer <benjamin.meyer@torchmobile.com>
+
+ Reviewed by Nikolas Zimmermann.
+
+ https://bugs.webkit.org/show_bug.cgi?id=23738
+ Expose the url elements target frame string. This is the sister function
+ to the existing linkTargetFrame which returns the QWebFrame*. When the
+ linkTargetFrame is 0 it is useful to know what the target was to be.
+
+ * Api/qwebframe.cpp:
+ (QWebHitTestResultPrivate::QWebHitTestResultPrivate):
+ (QWebHitTestResult::linkTarget):
+ * Api/qwebframe.h:
+ * Api/qwebframe_p.h:
+ * tests/qwebframe/tst_qwebframe.cpp:
+
2009-02-13 David Boddie <dboddie@trolltech.com>
Reviewed by Simon Hausmann.
@@ -262,6 +1254,16 @@
* Api/qwebsettings.cpp:
+2009-02-11 Dimitri Dupuis-latour <dupuislatour@apple.com>
+
+ Stub out InspectorClientQt::hiddenPanels.
+
+ Reviewed by Timothy Hatcher.
+
+ * WebCoreSupport/InspectorClientQt.cpp:
+ (WebCore::InspectorClientQt::hiddenPanels):
+ * WebCoreSupport/InspectorClientQt.h:
+
2009-02-10 Karsten Heimrich <kheimric@trolltech.com>
Reviewed by Simon Hausmann.
@@ -273,6 +1275,21 @@
(WebCore::FrameLoaderClientQt::dispatchDidChangeLocationWithinPage):
update and emit in case we navigate inside a webpage
+2009-02-10 Adam Treat <adam.treat@torchmobile.com>
+
+ Fix the Qt build as class Selection is now VisibleSelection.
+
+ * Api/qwebpage.cpp:
+ (QWebPage::inputMethodQuery):
+
+2009-02-06 Geoffrey Garen <ggaren@apple.com>
+
+ Build fix.
+
+ * WebCoreSupport/FrameLoaderClientQt.cpp:
+ (WebCore::FrameLoaderClientQt::updateGlobalHistoryRedirectLinks):
+ * WebCoreSupport/FrameLoaderClientQt.h:
+
2009-02-06 Kavindra Palaraja <kavindra.palaraja@nokia.com>
Reviewed by Simon Hausmann.
@@ -293,6 +1310,27 @@
* tests/qwebframe/tst_qwebframe.cpp: Added unit tests for ownership
models.
+2009-02-06 Aaron Boodman <aa@chromium.org>
+
+ Reviewed by Holger Freyther.
+
+ * WebCoreSupport/FrameLoaderClientQt.cpp:
+ (WebCore::FrameLoaderClientQt::documentElementAvailable):)
+ Fix compile error in Qt build introduced by the below change (r40694).
+
+2009-02-05 Aaron Boodman <aa@chromium.org>
+
+ Reviewed by Dave Hyatt.
+
+ https://bugs.webkit.org/show_bug.cgi?id=23708
+ Adds documentElementAvailable() callback to FrameLoaderClient.
+
+ * WebCoreSupport/FrameLoaderClientQt.cpp:
+ (WebCore::FrameLoaderClient::documentElementAvailable):
+ Stub out documentElementAvailable().
+ * WebCoreSupport/FrameLoaderClientQt.h:
+ Ditto.
+
2009-02-04 David Boddie <dboddie@trolltech.com>
Reviewed by Simon Hausmann.
@@ -310,6 +1348,126 @@
* tests/qwebframe/tst_qwebframe.cpp:
+2009-02-02 Geoffrey Garen <ggaren@apple.com>
+
+ Build fix.
+
+ * Api/qwebframe.cpp:
+ (QWebFrame::QWebFrame):
+ (QWebFrame::load):
+ (QWebFrame::setHtml):
+ (QWebFrame::setContent):
+
+2009-02-02 Geoffrey Garen <ggaren@apple.com>
+
+ Build fix.
+
+ * WebCoreSupport/FrameLoaderClientQt.cpp:
+ (WebCore::FrameLoaderClientQt::createFrame):
+
+2009-02-02 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Track redirects in global history.
+
+ Keep Qt building.
+
+ * WebCoreSupport/FrameLoaderClientQt.cpp:
+ (WebCore::FrameLoaderClientQt::updateGlobalHistoryForRedirectWithoutHistoryItem):
+ (WebCore::FrameLoaderClientQt::createFrame):
+ * WebCoreSupport/FrameLoaderClientQt.h:
+
+2009-02-02 Anders Carlsson <andersca@apple.com>
+
+ Reviewed by Dan Bernstein.
+
+ Update for changes to WebCore.
+
+ * WebCoreSupport/FrameLoaderClientQt.cpp:
+ (WebCore::FrameLoaderClientQt::createPlugin):
+ (WebCore::FrameLoaderClientQt::createJavaAppletWidget):
+ * WebCoreSupport/FrameLoaderClientQt.h:
+
+2009-02-02 Adam Treat <adam.treat@torchmobile.com>
+
+ Reviewed by Nikolas Zimmermann.
+
+ https://bugs.webkit.org/show_bug.cgi?id=23587
+ Refactor HitTestRequest to eliminate all the ugly boolean arguments and
+ use an enum bitflag instead. Cleanup all the code that constructs the
+ various HitTestRequests to make the code more readable.
+
+ * Api/qwebframe.cpp:
+ (QWebFrame::hitTestContent):
+
+2009-02-02 Adam Treat <adam.treat@torchmobile.com>
+
+ Fix the Qt build to call forceLayout on the view instead.
+
+ * Api/qwebpage.cpp:
+ (QWebPage::setFixedLayoutSize):
+ (QWebPage::setUseFixedLayout):
+
+2009-02-02 Holger Hans Peter Freyther <zecke@selfish.org>
+
+ Reviewed by Darin Adler.
+
+ Move Frame::forceLayout, Frame::adjustPageHeight and Frame::forceLayoutWithPageWidthRange to FrameView
+
+ https://bugs.webkit.org/show_bug.cgi?id=23428
+
+ FrameView::forceLayout could be killed but the comment might
+ contain a value over the the plain FrameView::layout...
+
+ Adjust the WebCore/WebKit consumers of these methods.
+
+ * Api/qwebpage.cpp:
+ (QWebPage::setViewportSize):
+ * WebCoreSupport/FrameLoaderClientQt.cpp:
+ (WebCore::FrameLoaderClientQt::forceLayout):
+
+2009-01-30 Geoffrey Garen <ggaren@apple.com>
+
+ Build fix.
+
+ * WebCoreSupport/FrameLoaderClientQt.cpp:
+ (WebCore::FrameLoaderClientQt::createFrame):
+
+2009-01-30 Holger Hans Peter Freyther <zecke@selfish.org>
+
+ Reviewed by Simon Hausmann.
+
+ https://bugs.webkit.org/show_bug.cgi?id=22056
+
+ Kill FrameLoaderClient.cpp, move the code over to Frame::createView
+
+ FrameLoaderClient is supposed to be an interface, move the
+ to be shared code to Frame which is a controller and is
+ allowed to create a FrameView.
+
+ * WebCoreSupport/FrameLoaderClientQt.cpp:
+ (WebCore::FrameLoaderClientQt::transitionToCommittedForNewPage):
+
+2009-01-30 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Sam Weinig.
+
+ Split "lockHistory" into "lockHistory" and "lockBackForwardList" in
+ preparation for setting them differently during a redirect.
+
+ * Api/qwebpage.cpp:
+ (QWebPage::triggerAction):
+
+2009-01-30 Brady Eidson <beidson@apple.com>
+
+ Reviewed by Sam Weinig
+
+ Remove FrameLoaderClient code that is now handled by FrameLoader itself
+
+ * WebCoreSupport/FrameLoaderClientQt.cpp:
+ (WebCore::FrameLoaderClientQt::frameLoadCompleted):
+
2009-01-30 Simon Hausmann <simon.hausmann@nokia.com>
Reviewed by Tor Arne Vestbø.
@@ -322,6 +1480,18 @@
(qt_websettings_offlineWebApplicationCachePath):
* Api/qwebsettings.h:
+2009-01-28 Adam Treat <adam.treat@torchmobile.com>
+
+ Reviewed by Nikolas Zimmermann and George Staikos.
+
+ https://bugs.webkit.org/show_bug.cgi?id=23557
+ Do not clip the QWebFrame::hitTestContent method to the visible viewport
+ and add a regression test to make sure it works.
+
+ * Api/qwebframe.cpp:
+ (QWebFrame::hitTestContent):
+ * tests/qwebframe/tst_qwebframe.cpp:
+
2009-01-28 Ariya Hidayat <ariya.hidayat@trolltech.com>
Rubber-stamped by Simon Hausmann.
@@ -347,6 +1517,37 @@
* Api/qwebframe.cpp:
(QWebFrame::print):
+2009-01-27 Brady Eidson <beidson@apple.com>
+
+ Reviewed by Dan Bernstein
+
+ Rework FrameLoaderClient to work on a CachedFrame basis instead of CachedPage
+
+ * WebCoreSupport/FrameLoaderClientQt.cpp:
+ (WebCore::FrameLoaderClientQt::savePlatformDataToCachedFrame):
+ (WebCore::FrameLoaderClientQt::transitionToCommittedFromCachedFrame):
+ * WebCoreSupport/FrameLoaderClientQt.h:
+
+2009-01-26 Simon Fraser <simon.fraser@apple.com>
+
+ Reviewed by David Hyatt
+
+ Back out r40285, because it was checked in with no bug number, no
+ testcase, is rendering change that did not get thorough review,
+ and broke the Mac build.
+
+ * Api/qwebframe.cpp:
+ (QWebFrame::hitTestContent):
+
+2009-01-26 Adam Treat <adam.treat@torchmobile.com>
+
+ Reviewed by Nikolas Zimmermann.
+
+ Do not clip the QWebFrame::hitTestContent method to the visible viewport.
+
+ * Api/qwebframe.cpp:
+ (QWebFrame::hitTestContent):
+
2009-01-26 David Boddie <dboddie@trolltech.com>
Reviewed by Simon Hausmann.
@@ -409,6 +1610,25 @@
* Api/qwebhistory.h:
+2009-01-24 Adam Treat <adam.treat@torchmobile.com>
+
+ Oops, fix the Qt build.
+
+ * Api/qwebframe.cpp:
+ (QWebFrame::render):
+
+2009-01-24 Adam Treat <adam.treat@torchmobile.com>
+
+ Reviewed by Nikolas Zimmermann.
+
+ Add QWebFrame::renderContents() method which allows arbitary rendering
+ of any content region within the QWebFrame. It also does not draw any
+ scrollbars.
+
+ * Api/qwebframe.cpp:
+ (QWebFrame::renderContents):
+ * Api/qwebframe.h:
+
2009-01-23 Ariya Hidayat <ariya.hidayat@trolltech.com>
Reviewed by Simon Hausmann.
@@ -488,6 +1708,13 @@
* Api/qwebpage.cpp:
+2009-01-16 Ariya Hidayat <ariya.hidayat@trolltech.com>
+
+ Another attempt at fixing the Qt build.
+
+ * Api/qwebframe.cpp:
+ (QWebFrame::addToJavaScriptWindowObject):
+
2009-01-14 Ariya Hidayat <ariya.hidayat@trolltech.com>
Reviewed by Tor Arne Vestbø.
@@ -558,6 +1785,25 @@
(CursorTrackedPage::isSelectionCollapsed):
(tst_QWebPage::cursorMovements):
+2009-01-08 Yongjun Zhang <yongjun.zhang@nokia.com>
+
+ Reviewed by Simon Hausmann.
+
+ https://bugs.webkit.org/show_bug.cgi?id=23187
+
+ Update webview with the intersected rect.
+
+ In ChromeClientQt::repaint, view should be updated with the
+ intersected rect, not the whole windowRect;
+
+ This generally is not a problem for normal viewport setup where
+ viewport size is the same as the qwebview widget size. However, if we
+ set the viewport size smaller than qwebkit widget, we will see
+ unwanted painting outside the viewport.
+
+ * WebCoreSupport/ChromeClientQt.cpp:
+ (WebCore::ChromeClientQt::repaint):
+
2009-01-13 Ariya Hidayat <ariya.hidayat@trolltech.com>
Rubber-stamped by Tor Arne Vestbø.
@@ -580,25 +1826,6 @@
(QWebPagePrivate::updateAction):
(QWebPage::action):
-2009-01-08 Yongjun Zhang <yongjun.zhang@nokia.com>
-
- Reviewed by Simon Hausmann.
-
- https://bugs.webkit.org/show_bug.cgi?id=23187
-
- Update webview with the intersected rect.
-
- In ChromeClientQt::repaint, view should be updated with the
- intersected rect, not the whole windowRect;
-
- This generally is not a problem for normal viewport setup where
- viewport size is the same as the qwebview widget size. However, if we
- set the viewport size smaller than qwebkit widget, we will see
- unwanted painting outside the viewport.
-
- * WebCoreSupport/ChromeClientQt.cpp:
- (WebCore::ChromeClientQt::repaint):
-
2009-01-13 Simon Hausmann <simon.hausmann@nokia.com>
Reviewed by Tor Arne Vestbø.
@@ -756,6 +1983,29 @@
Reviewed by George Staikos.
+ Add Qt API to QWebHitTestResult::isScrollBar method
+
+ * Api/qwebframe.cpp:
+ (QWebHitTestResultPrivate::QWebHitTestResultPrivate):
+ (QWebHitTestResult::isScrollBar):
+ * Api/qwebframe.h:
+ * Api/qwebframe_p.h:
+ (QWebHitTestResultPrivate::QWebHitTestResultPrivate):
+
+2009-01-07 Adam Treat <adam.treat@torchmobile.com>
+
+ Reviewed by George Staikos.
+
+ Add Qt API for QWebFrame::scrollBarGeometry method
+
+ * Api/qwebframe.cpp:
+ (QWebFrame::scrollBarGeometry):
+ * Api/qwebframe.h:
+
+2009-01-07 Adam Treat <adam.treat@torchmobile.com>
+
+ Reviewed by George Staikos.
+
Fix unused variable warnings
* tests/qwebpage/tst_qwebpage.cpp:
@@ -780,6 +2030,28 @@
* Api/qwebkitglobal.h:
+2009-01-06 Adam Treat <adam.treat@torchmobile.com>
+
+ Reviewed by Simon Hausmann.
+
+ Update the documentation to reflect when these API changes will land in
+ upstream Qt
+
+ * Api/qwebframe.cpp:
+ * Api/qwebpage.cpp:
+
+2009-01-05 Adam Treat <adam.treat@torchmobile.com>
+
+ Reviewed by George Staikos.
+
+ Add Qt API for QWebFrame::contentsSizeChanged signal
+
+ * Api/qwebframe.cpp:
+ * Api/qwebframe.h:
+ * WebCoreSupport/ChromeClientQt.cpp:
+ (WebCore::ChromeClientQt::contentsSizeChanged):
+ * WebCoreSupport/ChromeClientQt.h:
+
2009-01-05 Adam Treat <adam.treat@torchmobile.com>
Reviewed by George Staikos.
@@ -792,6 +2064,36 @@
* WebCoreSupport/FrameLoaderClientQt.cpp:
(WebCore::FrameLoaderClientQt::transitionToCommittedForNewPage):
+2009-01-04 Adam Treat <adam.treat@torchmobile.com>
+
+ Reviewed by George Staikos.
+
+ Add new API to QWebHitTestResult to return a rect for the smallest enclosing
+ block element of the hit test
+
+ * Api/qwebframe.cpp:
+ (QWebHitTestResultPrivate::QWebHitTestResultPrivate):
+ (QWebHitTestResult::enclosingBlock):
+ * Api/qwebframe.h:
+ * Api/qwebframe_p.h:
+
+2008-12-30 Adam Treat <adam.treat@torchmobile.com>
+
+ Reviewed by George Staikos.
+
+ Make the qt port build and work with the new fixedLayoutSize feature
+
+ * Api/qwebpage.cpp:
+ (QWebPagePrivate::QWebPagePrivate):
+ (QWebPage::fixedLayoutSize):
+ (QWebPage::setFixedLayoutSize):
+ (QWebPage::useFixedLayout):
+ (QWebPage::setUseFixedLayout):
+ * Api/qwebpage.h:
+ * Api/qwebpage_p.h:
+ * WebCoreSupport/FrameLoaderClientQt.cpp:
+ (WebCore::FrameLoaderClientQt::transitionToCommittedForNewPage):
+
2008-12-19 Jade Han <jade.han@nokia.com>
Reviewed by Tor Arne Vestbø.
diff --git a/src/3rdparty/webkit/WebKit/qt/Plugins/ICOHandler.cpp b/src/3rdparty/webkit/WebKit/qt/Plugins/ICOHandler.cpp
index 44f3d44..d7fae07 100644
--- a/src/3rdparty/webkit/WebKit/qt/Plugins/ICOHandler.cpp
+++ b/src/3rdparty/webkit/WebKit/qt/Plugins/ICOHandler.cpp
@@ -6,6 +6,7 @@
*
*/
+#include "config.h"
#include "ICOHandler.h"
#include <cstring>
diff --git a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp
index 19b629d..d001035 100644
--- a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp
+++ b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp
@@ -228,8 +228,8 @@ void ChromeClientQt::setResizable(bool)
notImplemented();
}
-void ChromeClientQt::addMessageToConsole(const String& message, unsigned int lineNumber,
- const String& sourceID)
+void ChromeClientQt::addMessageToConsole(MessageSource, MessageLevel, const String& message,
+ unsigned int lineNumber, const String& sourceID)
{
QString x = message;
QString y = sourceID;
@@ -345,8 +345,9 @@ PlatformWidget ChromeClientQt::platformWindow() const
return m_webPage->view();
}
-void ChromeClientQt::contentsSizeChanged(Frame*, const IntSize&) const
+void ChromeClientQt::contentsSizeChanged(Frame* frame, const IntSize& size) const
{
+ emit QWebFramePrivate::kit(frame)->contentsSizeChanged(size);
}
void ChromeClientQt::mouseDidMoveOverElement(const HitTestResult& result, unsigned modifierFlags)
@@ -386,15 +387,17 @@ void ChromeClientQt::print(Frame *frame)
emit m_webPage->printRequested(QWebFramePrivate::kit(frame));
}
+#if ENABLE(DATABASE)
void ChromeClientQt::exceededDatabaseQuota(Frame* frame, const String& databaseName)
{
quint64 quota = QWebSettings::offlineStorageDefaultQuota();
-#if ENABLE(DATABASE)
+
if (!DatabaseTracker::tracker().hasEntryForOrigin(frame->document()->securityOrigin()))
DatabaseTracker::tracker().setQuota(frame->document()->securityOrigin(), quota);
-#endif
+
emit m_webPage->databaseQuotaExceeded(QWebFramePrivate::kit(frame), databaseName);
}
+#endif
void ChromeClientQt::runOpenPanel(Frame* frame, PassRefPtr<FileChooser> prpFileChooser)
{
@@ -428,4 +431,16 @@ void ChromeClientQt::runOpenPanel(Frame* frame, PassRefPtr<FileChooser> prpFileC
}
}
+bool ChromeClientQt::setCursor(PlatformCursorHandle)
+{
+ notImplemented();
+ return false;
+}
+
+void ChromeClientQt::requestGeolocationPermissionForFrame(Frame*, Geolocation*)
+{
+ // See the comment in WebCore/page/ChromeClient.h
+ notImplemented();
+}
+
}
diff --git a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/ChromeClientQt.h b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/ChromeClientQt.h
index a13bb7c..9f2c1b5 100644
--- a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/ChromeClientQt.h
+++ b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/ChromeClientQt.h
@@ -83,8 +83,8 @@ namespace WebCore {
virtual void setResizable(bool);
- virtual void addMessageToConsole(const String& message, unsigned int lineNumber,
- const String& sourceID);
+ virtual void addMessageToConsole(MessageSource, MessageLevel, const String& message,
+ unsigned int lineNumber, const String& sourceID);
virtual bool canRunBeforeUnloadConfirmPanel();
virtual bool runBeforeUnloadConfirmPanel(const String& message, Frame* frame);
@@ -113,13 +113,21 @@ namespace WebCore {
virtual void setToolTip(const String&);
virtual void print(Frame*);
-
+#if ENABLE(DATABASE)
virtual void exceededDatabaseQuota(Frame*, const String&);
-
+#endif
virtual void runOpenPanel(Frame*, PassRefPtr<FileChooser>);
virtual void formStateDidChange(const Node*) { }
+ virtual PassOwnPtr<HTMLParserQuirks> createHTMLParserQuirks() { return 0; }
+
+ virtual bool setCursor(PlatformCursorHandle);
+
+ virtual void scrollRectIntoView(const IntRect&, const ScrollView*) const {}
+
+ virtual void requestGeolocationPermissionForFrame(Frame*, Geolocation*);
+
QWebPage* m_webPage;
WebCore::KURL lastHoverURL;
WebCore::String lastHoverTitle;
diff --git a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/DragClientQt.cpp b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/DragClientQt.cpp
index b719868..0df0768 100644
--- a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/DragClientQt.cpp
+++ b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/DragClientQt.cpp
@@ -23,6 +23,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
#include "DragClientQt.h"
#include "ClipboardQt.h"
diff --git a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/EditCommandQt.cpp b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/EditCommandQt.cpp
index 1532388..a166840 100644
--- a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/EditCommandQt.cpp
+++ b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/EditCommandQt.cpp
@@ -17,6 +17,7 @@
Boston, MA 02110-1301, USA.
*/
+#include "config.h"
#include <wtf/Platform.h>
#include "EditCommandQt.h"
diff --git a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/EditorClientQt.cpp b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/EditorClientQt.cpp
index a688779..6c31bd8 100644
--- a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/EditorClientQt.cpp
+++ b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/EditorClientQt.cpp
@@ -1,7 +1,7 @@
/*
* Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org>
* Copyright (C) 2006 Zack Rusin <zack@kde.org>
- * Copyright (C) 2006, 2008 Apple Computer, Inc.
+ * Copyright (C) 2006, 2008 Apple Inc. All rights reserved.
* Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies)
*
* All rights reserved.
@@ -34,18 +34,19 @@
#include "qwebpage.h"
#include "qwebpage_p.h"
+#include "CSSStyleDeclaration.h"
#include "Document.h"
#include "EditCommandQt.h"
-#include "Page.h"
#include "Editor.h"
#include "FocusController.h"
#include "Frame.h"
+#include "HTMLElement.h"
#include "KeyboardCodes.h"
#include "KeyboardEvent.h"
+#include "NotImplemented.h"
+#include "Page.h"
#include "Page.h"
#include "PlatformKeyboardEvent.h"
-#include "NotImplemented.h"
-#include "Node.h"
#include "Range.h"
#include <stdio.h>
@@ -546,6 +547,12 @@ void EditorClientQt::checkSpellingOfString(const UChar*, int, int*, int*)
notImplemented();
}
+String EditorClientQt::getAutoCorrectSuggestionForMisspelledWord(const String&)
+{
+ notImplemented();
+ return String();
+}
+
void EditorClientQt::checkGrammarOfString(const UChar*, int, Vector<GrammarDetail>&, int*, int*)
{
notImplemented();
diff --git a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/EditorClientQt.h b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/EditorClientQt.h
index b39f02b..42a402f 100644
--- a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/EditorClientQt.h
+++ b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/EditorClientQt.h
@@ -98,6 +98,7 @@ public:
virtual void ignoreWordInSpellDocument(const String&);
virtual void learnWord(const String&);
virtual void checkSpellingOfString(const UChar*, int length, int* misspellingLocation, int* misspellingLength);
+ virtual String getAutoCorrectSuggestionForMisspelledWord(const String& misspelledWord);
virtual void checkGrammarOfString(const UChar*, int length, Vector<GrammarDetail>&, int* badGrammarLocation, int* badGrammarLength);
virtual void updateSpellingUIWithGrammarString(const String&, const GrammarDetail&);
virtual void updateSpellingUIWithMisspelledWord(const String&);
diff --git a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp
index a2b33c0..8f29523 100644
--- a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp
+++ b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp
@@ -32,6 +32,7 @@
#include "config.h"
#include "CSSComputedStyleDeclaration.h"
#include "CSSPropertyNames.h"
+#include "FormState.h"
#include "FrameLoaderClientQt.h"
#include "FrameTree.h"
#include "FrameView.h"
@@ -45,12 +46,15 @@
#include "RenderPart.h"
#include "ResourceRequest.h"
#include "HistoryItem.h"
+#include "HTMLAppletElement.h"
#include "HTMLFormElement.h"
+#include "HTMLPlugInElement.h"
#include "NotImplemented.h"
#include "QNetworkReplyHandler.h"
#include "ResourceHandleInternal.h"
#include "ResourceHandle.h"
#include "Settings.h"
+#include "ScriptString.h"
#include "qwebpage.h"
#include "qwebframe.h"
@@ -199,12 +203,12 @@ bool FrameLoaderClientQt::hasWebView() const
return true;
}
-void FrameLoaderClientQt::savePlatformDataToCachedPage(CachedPage*)
+void FrameLoaderClientQt::savePlatformDataToCachedFrame(CachedFrame*)
{
notImplemented();
}
-void FrameLoaderClientQt::transitionToCommittedFromCachedPage(CachedPage*)
+void FrameLoaderClientQt::transitionToCommittedFromCachedFrame(CachedFrame*)
{
}
@@ -215,12 +219,12 @@ void FrameLoaderClientQt::transitionToCommittedForNewPage()
QBrush brush = m_webFrame->page()->palette().brush(QPalette::Base);
QColor backgroundColor = brush.style() == Qt::SolidPattern ? brush.color() : QColor();
- WebCore::FrameLoaderClient::transitionToCommittedForNewPage(m_frame, m_webFrame->page()->viewportSize(),
- backgroundColor, !backgroundColor.alpha(),
- /*fixedLayoutSize*/ IntSize(),
- /*useFixedLayout*/ false,
- (ScrollbarMode)m_webFrame->scrollBarPolicy(Qt::Horizontal),
- (ScrollbarMode)m_webFrame->scrollBarPolicy(Qt::Vertical));
+ m_frame->createView(m_webFrame->page()->viewportSize(),
+ backgroundColor, !backgroundColor.alpha(),
+ m_webFrame->page()->fixedLayoutSize(),
+ m_webFrame->page()->useFixedLayout(),
+ (ScrollbarMode)m_webFrame->scrollBarPolicy(Qt::Horizontal),
+ (ScrollbarMode)m_webFrame->scrollBarPolicy(Qt::Vertical));
}
@@ -232,7 +236,9 @@ void FrameLoaderClientQt::makeRepresentation(DocumentLoader*)
void FrameLoaderClientQt::forceLayout()
{
- m_frame->forceLayout(true);
+ FrameView* view = m_frame->view();
+ if (view)
+ view->forceLayout(true);
}
@@ -332,10 +338,6 @@ void FrameLoaderClientQt::dispatchDidReceiveTitle(const String& title)
if (!m_webFrame)
return;
-
-
- // ### hack
- emit m_webFrame->urlChanged(m_webFrame->url());
emit titleChanged(title);
}
@@ -348,6 +350,7 @@ void FrameLoaderClientQt::dispatchDidCommitLoad()
if (m_frame->tree()->parent() || !m_webFrame)
return;
+ emit m_webFrame->urlChanged(m_webFrame->url());
m_webFrame->page()->d->updateNavigationActions();
// We should assume first the frame has no title. If it has, then the above dispatchDidReceiveTitle()
@@ -363,7 +366,7 @@ void FrameLoaderClientQt::dispatchDidFinishDocumentLoad()
printf("%s - didFinishDocumentLoadForFrame\n", qPrintable(drtDescriptionSuitableForTestResult(m_frame)));
if (QWebPagePrivate::drtRun) {
- int unloadEventCount = m_frame->eventHandler()->pendingFrameUnloadEventCount();
+ int unloadEventCount = m_frame->domWindow()->pendingUnloadEventListeners();
if (unloadEventCount)
printf("%s - has %u onunload handler(s)\n", qPrintable(drtDescriptionSuitableForTestResult(m_frame)), unloadEventCount);
}
@@ -382,7 +385,7 @@ void FrameLoaderClientQt::dispatchDidFinishLoad()
m_loadSucceeded = true;
- if (m_frame->tree()->parent() || !m_webFrame)
+ if (!m_webFrame)
return;
m_webFrame->page()->d->updateNavigationActions();
}
@@ -536,9 +539,6 @@ String FrameLoaderClientQt::generatedMIMETypeForURLScheme(const String& URLSchem
void FrameLoaderClientQt::frameLoadCompleted()
{
// Note: Can be called multiple times.
- // Even if already complete, we might have set a previous item on a frame that
- // didn't do any data loading on the past transaction. Make sure to clear these out.
- m_frame->loader()->setPreviousHistoryItem(0);
}
@@ -564,7 +564,6 @@ void FrameLoaderClientQt::didFinishLoad()
void FrameLoaderClientQt::prepareForDataSourceReplacement()
{
- m_frame->loader()->detachChildren();
}
void FrameLoaderClientQt::setTitle(const String&, const KURL&)
@@ -614,6 +613,11 @@ void FrameLoaderClientQt::windowObjectCleared()
emit m_webFrame->javaScriptWindowObjectCleared();
}
+void FrameLoaderClientQt::documentElementAvailable()
+{
+ return;
+}
+
void FrameLoaderClientQt::didPerformFirstNavigation() const
{
if (m_frame->tree()->parent() || !m_webFrame)
@@ -633,6 +637,10 @@ void FrameLoaderClientQt::updateGlobalHistory()
history->addHistoryEntry(m_frame->loader()->documentLoader()->urlForHistory().prettyURL());
}
+void FrameLoaderClientQt::updateGlobalHistoryRedirectLinks()
+{
+}
+
bool FrameLoaderClientQt::shouldGoToHistoryItem(WebCore::HistoryItem *item) const
{
return true;
@@ -841,6 +849,11 @@ bool FrameLoaderClientQt::dispatchDidLoadResourceFromMemoryCache(WebCore::Docume
return false;
}
+void FrameLoaderClientQt::dispatchDidLoadResourceByXMLHttpRequest(unsigned long, const WebCore::ScriptString&)
+{
+ notImplemented();
+}
+
void FrameLoaderClientQt::dispatchDidFailProvisionalLoad(const WebCore::ResourceError&)
{
if (dumpFrameLoaderCallbacks)
@@ -971,9 +984,9 @@ PassRefPtr<Frame> FrameLoaderClientQt::createFrame(const KURL& url, const String
// ### set override encoding if we have one
FrameLoadType loadType = m_frame->loader()->loadType();
- FrameLoadType childLoadType = FrameLoadTypeRedirectWithLockedHistory;
+ FrameLoadType childLoadType = FrameLoadTypeRedirectWithLockedBackForwardList;
- childFrame->loader()->loadURL(frameData.url, frameData.referrer, String(), childLoadType, 0, 0);
+ childFrame->loader()->loadURLIntoChildFrame(frameData.url, frameData.referrer, childFrame.get());
// The frame's onload handler may have removed it from the document.
if (!childFrame->tree()->parent())
@@ -1068,7 +1081,7 @@ public:
}
};
-Widget* FrameLoaderClientQt::createPlugin(const IntSize& pluginSize, Element* element, const KURL& url, const Vector<String>& paramNames,
+Widget* FrameLoaderClientQt::createPlugin(const IntSize& pluginSize, HTMLPlugInElement* element, const KURL& url, const Vector<String>& paramNames,
const Vector<String>& paramValues, const String& mimeType, bool loadManually)
{
// qDebug()<<"------ Creating plugin in FrameLoaderClientQt::createPlugin for "<<url.prettyURL() << mimeType;
@@ -1156,7 +1169,7 @@ void FrameLoaderClientQt::redirectDataToPlugin(Widget* pluginWidget)
m_hasSentResponseToPlugin = false;
}
-Widget* FrameLoaderClientQt::createJavaAppletWidget(const IntSize&, Element*, const KURL& baseURL,
+Widget* FrameLoaderClientQt::createJavaAppletWidget(const IntSize&, HTMLAppletElement*, const KURL& baseURL,
const Vector<String>& paramNames, const Vector<String>& paramValues)
{
notImplemented();
diff --git a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h
index c743c23..4d2dcbc 100644
--- a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h
+++ b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h
@@ -98,6 +98,7 @@ namespace WebCore {
virtual void dispatchDidFinishLoading(WebCore::DocumentLoader*, unsigned long);
virtual void dispatchDidFailLoading(WebCore::DocumentLoader*, unsigned long, const WebCore::ResourceError&);
virtual bool dispatchDidLoadResourceFromMemoryCache(WebCore::DocumentLoader*, const WebCore::ResourceRequest&, const WebCore::ResourceResponse&, int);
+ virtual void dispatchDidLoadResourceByXMLHttpRequest(unsigned long identifier, const WebCore::ScriptString& sourceString);
virtual void dispatchDidHandleOnloadEvents();
virtual void dispatchDidReceiveServerRedirectForProvisionalLoad();
@@ -147,6 +148,7 @@ namespace WebCore {
virtual void finishedLoading(DocumentLoader*);
virtual void updateGlobalHistory();
+ virtual void updateGlobalHistoryRedirectLinks();
virtual bool shouldGoToHistoryItem(HistoryItem*) const;
virtual ResourceError cancelledError(const ResourceRequest&);
@@ -177,8 +179,8 @@ namespace WebCore {
virtual String userAgent(const WebCore::KURL&);
- virtual void savePlatformDataToCachedPage(WebCore::CachedPage*);
- virtual void transitionToCommittedFromCachedPage(WebCore::CachedPage*);
+ virtual void savePlatformDataToCachedFrame(WebCore::CachedFrame*);
+ virtual void transitionToCommittedFromCachedFrame(WebCore::CachedFrame*);
virtual void transitionToCommittedForNewPage();
virtual bool canCachePage() const;
@@ -186,15 +188,16 @@ namespace WebCore {
virtual PassRefPtr<Frame> createFrame(const KURL& url, const String& name, HTMLFrameOwnerElement* ownerElement,
const String& referrer, bool allowsScrolling, int marginWidth, int marginHeight) ;
- virtual Widget* createPlugin(const IntSize&, Element*, const KURL&, const Vector<String>&, const Vector<String>&, const String&, bool);
+ virtual Widget* createPlugin(const IntSize&, HTMLPlugInElement*, const KURL&, const Vector<String>&, const Vector<String>&, const String&, bool);
virtual void redirectDataToPlugin(Widget* pluginWidget);
- virtual Widget* createJavaAppletWidget(const IntSize&, Element*, const KURL& baseURL, const Vector<String>& paramNames, const Vector<String>& paramValues);
+ virtual Widget* createJavaAppletWidget(const IntSize&, HTMLAppletElement*, const KURL& baseURL, const Vector<String>& paramNames, const Vector<String>& paramValues);
virtual ObjectContentType objectContentType(const KURL& url, const String& mimeType);
virtual String overrideMediaType() const;
virtual void windowObjectCleared();
+ virtual void documentElementAvailable();
virtual void didPerformFirstNavigation() const;
virtual void registerForIconNotification(bool);
diff --git a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp
index 7335280..fe4d43a 100644
--- a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp
+++ b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp
@@ -114,6 +114,12 @@ String InspectorClientQt::localizedStringsURL()
return String();
}
+String InspectorClientQt::hiddenPanels()
+{
+ notImplemented();
+ return String();
+}
+
void InspectorClientQt::showWindow()
{
if (!m_webPage)
diff --git a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/InspectorClientQt.h b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/InspectorClientQt.h
index 49c2d56..60ed77a 100644
--- a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/InspectorClientQt.h
+++ b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/InspectorClientQt.h
@@ -52,6 +52,8 @@ namespace WebCore {
virtual String localizedStringsURL();
+ virtual String hiddenPanels();
+
virtual void showWindow();
virtual void closeWindow();
virtual bool windowVisible();
diff --git a/src/3rdparty/webkit/WebKit/qt/docs/qtwebkit.qdoc b/src/3rdparty/webkit/WebKit/qt/docs/qtwebkit.qdoc
index 119c126..06305e0 100644
--- a/src/3rdparty/webkit/WebKit/qt/docs/qtwebkit.qdoc
+++ b/src/3rdparty/webkit/WebKit/qt/docs/qtwebkit.qdoc
@@ -96,8 +96,7 @@
Since WebKit supports the Netscape Plugin API, Qt applications can display
Web pages that embed common plugins, as long as the user has the appropriate
- binary files for those plugins installed and the \l{QWebSettings::PluginsEnabled}
- attribute is set for the application.
+ binary files for those plugins installed.
The following locations are searched for plugins:
diff --git a/src/3rdparty/webkit/WebKit/qt/docs/webkitsnippets/webelement/main.cpp b/src/3rdparty/webkit/WebKit/qt/docs/webkitsnippets/webelement/main.cpp
new file mode 100644
index 0000000..d437a6f
--- /dev/null
+++ b/src/3rdparty/webkit/WebKit/qt/docs/webkitsnippets/webelement/main.cpp
@@ -0,0 +1,69 @@
+/*
+ Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies)
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#include <QApplication>
+#include <QUrl>
+#include <qwebview.h>
+#include <qwebframe.h>
+#include <qwebelement.h>
+#include <qdebug.h>
+
+static QWebFrame *frame;
+
+static void traverse()
+{
+//! [Traversing with QWebElement]
+ frame->setHtml("<html><body><p>First Paragraph</p><p>Second Paragraph</p></body></html>");
+ QWebElement doc = frame->documentElement();
+ QWebElement body = doc.firstChild();
+ QWebElement firstParagraph = body.firstChild();
+ QWebElement secondParagraph = firstParagraph.nextSibling();
+//! [Traversing with QWebElement]
+}
+
+static void findAll()
+{
+//! [FindAll]
+ QWebElement document = frame->documentElement();
+ /* Assume the document has the following structure:
+
+ <p class=intro>
+ <span>Intro</span>
+ <span>Snippets</span>
+ </p>
+ <p>
+ <span>Content</span>
+ <span>Here</span>
+ </p>
+ */
+
+ QList<QWebElement> allSpans = document.findAll("span");
+ QList<QWebElement> introSpans = document.findAll("p.intro span");
+//! [FindAll]
+}
+
+int main(int argc, char *argv[])
+{
+ QApplication app(argc, argv);
+ QWebView *view = new QWebView(0);
+ frame = view->page()->mainFrame();
+ traverse();
+ findAll();
+ return 0;
+}
diff --git a/src/3rdparty/webkit/WebKit/qt/docs/webkitsnippets/webelement/webelement.pro b/src/3rdparty/webkit/WebKit/qt/docs/webkitsnippets/webelement/webelement.pro
new file mode 100644
index 0000000..f9b403b
--- /dev/null
+++ b/src/3rdparty/webkit/WebKit/qt/docs/webkitsnippets/webelement/webelement.pro
@@ -0,0 +1,5 @@
+TEMPLATE = app
+CONFIG -= app_bundle
+SOURCES = main.cpp
+include(../../../../../WebKit.pri)
+QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR
diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebelement/qwebelement.pro b/src/3rdparty/webkit/WebKit/qt/tests/qwebelement/qwebelement.pro
new file mode 100644
index 0000000..dd0b88a
--- /dev/null
+++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebelement/qwebelement.pro
@@ -0,0 +1,7 @@
+TEMPLATE = app
+TARGET = tst_qwebelement
+include(../../../../WebKit.pri)
+SOURCES += tst_qwebelement.cpp
+RESOURCES += qwebelement.qrc
+QT += testlib network
+QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR
diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebelement/qwebelement.qrc b/src/3rdparty/webkit/WebKit/qt/tests/qwebelement/qwebelement.qrc
new file mode 100644
index 0000000..ed01440
--- /dev/null
+++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebelement/qwebelement.qrc
@@ -0,0 +1,6 @@
+<!DOCTYPE RCC><RCC version="1.0">
+<qresource prefix="/">
+<file>style.css</file>
+<file>style2.css</file>
+</qresource>
+</RCC>
diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebelement/style.css b/src/3rdparty/webkit/WebKit/qt/tests/qwebelement/style.css
new file mode 100644
index 0000000..2713dfd
--- /dev/null
+++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebelement/style.css
@@ -0,0 +1 @@
+#idP {color: black !important}
diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebelement/style2.css b/src/3rdparty/webkit/WebKit/qt/tests/qwebelement/style2.css
new file mode 100644
index 0000000..6575dcb
--- /dev/null
+++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebelement/style2.css
@@ -0,0 +1 @@
+#idP {color: green ! important}
diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebelement/tst_qwebelement.cpp b/src/3rdparty/webkit/WebKit/qt/tests/qwebelement/tst_qwebelement.cpp
new file mode 100644
index 0000000..0819a3a
--- /dev/null
+++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebelement/tst_qwebelement.cpp
@@ -0,0 +1,882 @@
+/*
+ Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+
+#include <QtTest/QtTest>
+
+#include <qwebpage.h>
+#include <qwidget.h>
+#include <qwebview.h>
+#include <qwebframe.h>
+#include <qwebelement.h>
+//TESTED_CLASS=
+//TESTED_FILES=
+
+/**
+ * Starts an event loop that runs until the given signal is received.
+ Optionally the event loop
+ * can return earlier on a timeout.
+ *
+ * \return \p true if the requested signal was received
+ * \p false on timeout
+ */
+static bool waitForSignal(QObject* obj, const char* signal, int timeout = 0)
+{
+ QEventLoop loop;
+ QObject::connect(obj, signal, &loop, SLOT(quit()));
+ QTimer timer;
+ QSignalSpy timeoutSpy(&timer, SIGNAL(timeout()));
+ if (timeout > 0) {
+ QObject::connect(&timer, SIGNAL(timeout()), &loop, SLOT(quit()));
+ timer.setSingleShot(true);
+ timer.start(timeout);
+ }
+ loop.exec();
+ return timeoutSpy.isEmpty();
+}
+
+class tst_QWebElement : public QObject
+{
+ Q_OBJECT
+
+public:
+ tst_QWebElement();
+ virtual ~tst_QWebElement();
+
+public slots:
+ void init();
+ void cleanup();
+
+private slots:
+ void textHtml();
+ void simpleCollection();
+ void attributes();
+ void attributesNS();
+ void classes();
+ void namespaceURI();
+ void foreachManipulation();
+ void evaluateScript();
+ void callFunction();
+ void callFunctionSubmitForm();
+ void functionNames();
+ void documentElement();
+ void frame();
+ void style();
+ void computedStyle();
+ void properties();
+ void appendAndPrepend();
+ void insertBeforeAndAfter();
+ void remove();
+ void clear();
+ void replaceWith();
+ void encloseWith();
+ void encloseContentsWith();
+ void nullSelect();
+ void firstChildNextSibling();
+ void lastChildPreviousSibling();
+
+private:
+ QWebView* m_view;
+ QWebPage* m_page;
+ QWebFrame* m_mainFrame;
+};
+
+tst_QWebElement::tst_QWebElement()
+{
+}
+
+tst_QWebElement::~tst_QWebElement()
+{
+}
+
+void tst_QWebElement::init()
+{
+ m_view = new QWebView();
+ m_page = m_view->page();
+ m_mainFrame = m_page->mainFrame();
+}
+
+void tst_QWebElement::cleanup()
+{
+ delete m_view;
+}
+
+void tst_QWebElement::textHtml()
+{
+ QString html = "<head></head><body><p>test</p></body>";
+ m_mainFrame->setHtml(html);
+ QWebElement body = m_mainFrame->documentElement();
+ QVERIFY(!body.isNull());
+
+ QCOMPARE(body.toPlainText(), QString("test"));
+ QCOMPARE(body.toPlainText(), m_mainFrame->toPlainText());
+
+ QCOMPARE(body.toInnerXml(), html);
+}
+
+void tst_QWebElement::simpleCollection()
+{
+ QString html = "<body><p>first para</p><p>second para</p></body>";
+ m_mainFrame->setHtml(html);
+ QWebElement body = m_mainFrame->documentElement();
+
+ QList<QWebElement> list = body.findAll("p");
+ QCOMPARE(list.count(), 2);
+ QCOMPARE(list.at(0).toPlainText(), QString("first para"));
+ QCOMPARE(list.at(1).toPlainText(), QString("second para"));
+}
+
+void tst_QWebElement::attributes()
+{
+ m_mainFrame->setHtml("<body><p>Test");
+ QWebElement body = m_mainFrame->documentElement();
+
+ QVERIFY(!body.hasAttribute("title"));
+ QVERIFY(!body.hasAttributes());
+
+ body.setAttribute("title", "test title");
+
+ QVERIFY(body.hasAttributes());
+ QVERIFY(body.hasAttribute("title"));
+
+ QCOMPARE(body.attribute("title"), QString("test title"));
+
+ body.removeAttribute("title");
+
+ QVERIFY(!body.hasAttribute("title"));
+ QVERIFY(!body.hasAttributes());
+
+ QCOMPARE(body.attribute("does-not-exist", "testvalue"), QString("testvalue"));
+}
+
+void tst_QWebElement::attributesNS()
+{
+ QString content = "<html xmlns=\"http://www.w3.org/1999/xhtml\" "
+ "xmlns:svg=\"http://www.w3.org/2000/svg\">"
+ "<body><svg:svg id=\"foobar\" width=\"400px\" height=\"300px\">"
+ "</svg:svg></body></html>";
+
+ m_mainFrame->setContent(content.toUtf8(), "application/xhtml+xml");
+
+ QWebElement svg = m_mainFrame->findFirstElement("svg");
+ QVERIFY(!svg.isNull());
+
+ QVERIFY(!svg.hasAttributeNS("http://www.w3.org/2000/svg", "foobar"));
+ QCOMPARE(svg.attributeNS("http://www.w3.org/2000/svg", "foobar", "defaultblah"), QString("defaultblah"));
+ svg.setAttributeNS("http://www.w3.org/2000/svg", "svg:foobar", "true");
+ QVERIFY(svg.hasAttributeNS("http://www.w3.org/2000/svg", "foobar"));
+ QCOMPARE(svg.attributeNS("http://www.w3.org/2000/svg", "foobar", "defaultblah"), QString("true"));
+}
+
+void tst_QWebElement::classes()
+{
+ m_mainFrame->setHtml("<body><p class=\"a b c d a c\">Test");
+
+ QWebElement body = m_mainFrame->documentElement();
+ QCOMPARE(body.classes().count(), 0);
+
+ QWebElement p = m_mainFrame->documentElement().findAll("p").at(0);
+ QStringList classes = p.classes();
+ QCOMPARE(classes.count(), 4);
+ QCOMPARE(classes[0], QLatin1String("a"));
+ QCOMPARE(classes[1], QLatin1String("b"));
+ QCOMPARE(classes[2], QLatin1String("c"));
+ QCOMPARE(classes[3], QLatin1String("d"));
+ QVERIFY(p.hasClass("a"));
+ QVERIFY(p.hasClass("b"));
+ QVERIFY(p.hasClass("c"));
+ QVERIFY(p.hasClass("d"));
+ QVERIFY(!p.hasClass("e"));
+
+ p.addClass("f");
+ QVERIFY(p.hasClass("f"));
+ p.addClass("a");
+ QCOMPARE(p.classes().count(), 5);
+ QVERIFY(p.hasClass("a"));
+ QVERIFY(p.hasClass("b"));
+ QVERIFY(p.hasClass("c"));
+ QVERIFY(p.hasClass("d"));
+
+ p.toggleClass("a");
+ QVERIFY(!p.hasClass("a"));
+ QVERIFY(p.hasClass("b"));
+ QVERIFY(p.hasClass("c"));
+ QVERIFY(p.hasClass("d"));
+ QVERIFY(p.hasClass("f"));
+ QCOMPARE(p.classes().count(), 4);
+ p.toggleClass("f");
+ QVERIFY(!p.hasClass("f"));
+ QCOMPARE(p.classes().count(), 3);
+ p.toggleClass("a");
+ p.toggleClass("f");
+ QVERIFY(p.hasClass("a"));
+ QVERIFY(p.hasClass("f"));
+ QCOMPARE(p.classes().count(), 5);
+
+ p.removeClass("f");
+ QVERIFY(!p.hasClass("f"));
+ QCOMPARE(p.classes().count(), 4);
+ p.removeClass("d");
+ QVERIFY(!p.hasClass("d"));
+ QCOMPARE(p.classes().count(), 3);
+ p.removeClass("not-exist");
+ QCOMPARE(p.classes().count(), 3);
+ p.removeClass("c");
+ QVERIFY(!p.hasClass("c"));
+ QCOMPARE(p.classes().count(), 2);
+ p.removeClass("b");
+ QVERIFY(!p.hasClass("b"));
+ QCOMPARE(p.classes().count(), 1);
+ p.removeClass("a");
+ QVERIFY(!p.hasClass("a"));
+ QCOMPARE(p.classes().count(), 0);
+ p.removeClass("foobar");
+ QCOMPARE(p.classes().count(), 0);
+}
+
+void tst_QWebElement::namespaceURI()
+{
+ QString content = "<html xmlns=\"http://www.w3.org/1999/xhtml\" "
+ "xmlns:svg=\"http://www.w3.org/2000/svg\">"
+ "<body><svg:svg id=\"foobar\" width=\"400px\" height=\"300px\">"
+ "</svg:svg></body></html>";
+
+ m_mainFrame->setContent(content.toUtf8(), "application/xhtml+xml");
+ QWebElement body = m_mainFrame->documentElement();
+ QCOMPARE(body.namespaceUri(), QLatin1String("http://www.w3.org/1999/xhtml"));
+
+ QWebElement svg = body.findAll("*#foobar").at(0);
+ QCOMPARE(svg.prefix(), QLatin1String("svg"));
+ QCOMPARE(svg.localName(), QLatin1String("svg"));
+ QCOMPARE(svg.tagName(), QLatin1String("svg:svg"));
+ QCOMPARE(svg.namespaceUri(), QLatin1String("http://www.w3.org/2000/svg"));
+
+}
+
+void tst_QWebElement::foreachManipulation()
+{
+ QString html = "<body><p>first para</p><p>second para</p></body>";
+ m_mainFrame->setHtml(html);
+ QWebElement body = m_mainFrame->documentElement();
+
+ foreach(QWebElement p, body.findAll("p")) {
+ p.setInnerXml("<div>foo</div><div>bar</div>");
+ }
+
+ QCOMPARE(body.findAll("div").count(), 4);
+}
+
+void tst_QWebElement::evaluateScript()
+{
+ QVariant result;
+ m_mainFrame->setHtml("<body><p>test");
+ QWebElement para = m_mainFrame->findFirstElement("p");
+
+ result = para.evaluateScript("this.tagName");
+ QVERIFY(result.isValid());
+ QVERIFY(result.type() == QVariant::String);
+ QCOMPARE(result.toString(), QLatin1String("P"));
+
+ QVERIFY(para.functions().contains("hasAttributes"));
+ result = para.evaluateScript("this.hasAttributes()");
+ QVERIFY(result.isValid());
+ QVERIFY(result.type() == QVariant::Bool);
+ QVERIFY(!result.toBool());
+
+ para.evaluateScript("this.setAttribute('align', 'left');");
+ QCOMPARE(para.attribute("align"), QLatin1String("left"));
+
+ result = para.evaluateScript("this.hasAttributes()");
+ QVERIFY(result.isValid());
+ QVERIFY(result.type() == QVariant::Bool);
+ QVERIFY(result.toBool());
+}
+
+void tst_QWebElement::callFunction()
+{
+ m_mainFrame->setHtml("<body><p>test");
+ QWebElement body = m_mainFrame->documentElement();
+ QVERIFY(body.functions().contains("hasChildNodes"));
+ QVariant result = body.callFunction("hasChildNodes");
+ QVERIFY(result.isValid());
+ QVERIFY(result.type() == QVariant::Bool);
+ QVERIFY(result.toBool());
+
+ body.callFunction("setAttribute", QVariantList() << "foo" << "bar");
+ QCOMPARE(body.attribute("foo"), QString("bar"));
+}
+
+void tst_QWebElement::callFunctionSubmitForm()
+{
+ m_mainFrame->setHtml(QString("<html><body><form name='tstform' action='data:text/html,foo'method='get'>"
+ "<input type='text'><input type='submit'></form></body></html>"), QUrl());
+
+ QWebElement form = m_mainFrame->documentElement().findAll("form").at(0);
+ QVERIFY(form.functions().contains("submit"));
+ QVERIFY(!form.isNull());
+ form.callFunction("submit");
+
+ waitForSignal(m_page, SIGNAL(loadFinished(bool)));
+ QCOMPARE(m_mainFrame->url().toString(), QString("data:text/html,foo?"));
+}
+
+void tst_QWebElement::functionNames()
+{
+ m_mainFrame->setHtml("<body><p>Test");
+
+ QWebElement body = m_mainFrame->documentElement();
+
+ QVERIFY(body.functions().contains("setAttribute"));
+}
+
+void tst_QWebElement::documentElement()
+{
+ m_mainFrame->setHtml("<body><p>Test");
+
+ QWebElement para = m_mainFrame->documentElement().findAll("p").at(0);
+ QVERIFY(para.parent().parent() == m_mainFrame->documentElement());
+ QVERIFY(para.document() == m_mainFrame->documentElement());
+}
+
+void tst_QWebElement::frame()
+{
+ m_mainFrame->setHtml("<body><p>test");
+
+ QWebElement doc = m_mainFrame->documentElement();
+ QVERIFY(doc.webFrame() == m_mainFrame);
+
+ m_view->setHtml(QString("data:text/html,<frameset cols=\"25%,75%\"><frame src=\"data:text/html,"
+ "<p>frame1\">"
+ "<frame src=\"data:text/html,<p>frame2\"></frameset>"), QUrl());
+
+ waitForSignal(m_page, SIGNAL(loadFinished(bool)));
+
+ QCOMPARE(m_mainFrame->childFrames().count(), 2);
+
+ QWebFrame* firstFrame = m_mainFrame->childFrames().at(0);
+ QWebFrame* secondFrame = m_mainFrame->childFrames().at(1);
+
+ QCOMPARE(firstFrame->toPlainText(), QString("frame1"));
+ QCOMPARE(secondFrame->toPlainText(), QString("frame2"));
+
+ QWebElement firstPara = firstFrame->documentElement().findAll("p").at(0);
+ QWebElement secondPara = secondFrame->documentElement().findAll("p").at(0);
+
+ QVERIFY(firstPara.webFrame() == firstFrame);
+ QVERIFY(secondPara.webFrame() == secondFrame);
+}
+
+void tst_QWebElement::style()
+{
+ QString html = "<head>"
+ "<style type='text/css'>"
+ "p { color: green !important }"
+ "#idP { color: red }"
+ ".classP { color : yellow ! important }"
+ "</style>"
+ "</head>"
+ "<body>"
+ "<p id='idP' class='classP' style='color: blue;'>some text</p>"
+ "</body>";
+
+ m_mainFrame->setHtml(html);
+
+ QWebElement p = m_mainFrame->documentElement().findAll("p").at(0);
+ QCOMPARE(p.styleProperty("color"), QLatin1String("blue"));
+ QVERIFY(p.styleProperty("cursor").isEmpty());
+
+ p.setStyleProperty("color", "red");
+ p.setStyleProperty("cursor", "auto");
+
+ QCOMPARE(p.styleProperty("color"), QLatin1String("red"));
+ QCOMPARE(p.styleProperty("color", QWebElement::RespectCascadingStyles), QLatin1String("yellow"));
+ QCOMPARE(p.styleProperty("cursor"), QLatin1String("auto"));
+
+ p.setStyleProperty("color", "green !important");
+ QCOMPARE(p.styleProperty("color"), QLatin1String("green"));
+ QCOMPARE(p.styleProperty("color", QWebElement::RespectCascadingStyles), QLatin1String("green"));
+
+ p.setStyleProperty("color", "blue");
+ QCOMPARE(p.styleProperty("color"), QLatin1String("green"));
+ QCOMPARE(p.styleProperty("color", QWebElement::RespectCascadingStyles), QLatin1String("green"));
+
+ p.setStyleProperty("color", "blue", QWebElement::ImportantStylePriority);
+ QCOMPARE(p.styleProperty("color"), QLatin1String("blue"));
+ QCOMPARE(p.styleProperty("color", QWebElement::RespectCascadingStyles), QLatin1String("blue"));
+
+ QString html2 = "<head>"
+ "<style type='text/css'>"
+ "p { color: green }"
+ "#idP { color: red }"
+ ".classP { color: yellow }"
+ "</style>"
+ "</head>"
+ "<body>"
+ "<p id='idP' class='classP' style='color: blue;'>some text</p>"
+ "</body>";
+
+ m_mainFrame->setHtml(html2);
+ p = m_mainFrame->documentElement().findAll("p").at(0);
+
+ QCOMPARE(p.styleProperty("color"), QLatin1String("blue"));
+ QCOMPARE(p.styleProperty("color", QWebElement::RespectCascadingStyles), QLatin1String("blue"));
+
+ QString html3 = "<head>"
+ "<style type='text/css'>"
+ "p { color: green !important }"
+ "#idP { color: red !important}"
+ ".classP { color: yellow !important}"
+ "</style>"
+ "</head>"
+ "<body>"
+ "<p id='idP' class='classP' style='color: blue !important;'>some text</p>"
+ "</body>";
+
+ m_mainFrame->setHtml(html3);
+ p = m_mainFrame->documentElement().findAll("p").at(0);
+
+ QCOMPARE(p.styleProperty("color"), QLatin1String("blue"));
+ QCOMPARE(p.styleProperty("color", QWebElement::RespectCascadingStyles), QLatin1String("blue"));
+
+ QString html5 = "<head>"
+ "<style type='text/css'>"
+ "p { color: green }"
+ "#idP { color: red }"
+ ".classP { color: yellow }"
+ "</style>"
+ "</head>"
+ "<body>"
+ "<p id='idP' class='classP'>some text</p>"
+ "</body>";
+
+ m_mainFrame->setHtml(html5);
+ p = m_mainFrame->documentElement().findAll("p").at(0);
+
+ QCOMPARE(p.styleProperty("color"), QLatin1String(""));
+ QCOMPARE(p.styleProperty("color", QWebElement::RespectCascadingStyles), QLatin1String("red"));
+
+ QString html6 = "<head>"
+ "<link rel='stylesheet' href='qrc:/style.css' type='text/css' />"
+ "<style type='text/css'>"
+ "p { color: green }"
+ "#idP { color: red }"
+ ".classP { color: yellow ! important}"
+ "</style>"
+ "</head>"
+ "<body>"
+ "<p id='idP' class='classP' style='color: blue;'>some text</p>"
+ "</body>";
+
+ // in few seconds, the CSS should be completey loaded
+ QSignalSpy spy(m_page, SIGNAL(loadFinished(bool)));
+ m_mainFrame->setHtml(html6);
+ QTest::qWait(200);
+
+ p = m_mainFrame->documentElement().findAll("p").at(0);
+ QCOMPARE(p.styleProperty("color"), QLatin1String("blue"));
+ QCOMPARE(p.styleProperty("color", QWebElement::RespectCascadingStyles), QLatin1String("black"));
+
+ QString html7 = "<head>"
+ "<style type='text/css'>"
+ "@import url(qrc:/style2.css);"
+ "</style>"
+ "<link rel='stylesheet' href='qrc:/style.css' type='text/css' />"
+ "</head>"
+ "<body>"
+ "<p id='idP' style='color: blue;'>some text</p>"
+ "</body>";
+
+ // in few seconds, the style should be completey loaded
+ m_mainFrame->setHtml(html7);
+ QTest::qWait(200);
+
+ p = m_mainFrame->documentElement().findAll("p").at(0);
+ QCOMPARE(p.styleProperty("color", QWebElement::RespectCascadingStyles), QLatin1String("black"));
+
+ QString html8 = "<body><p>some text</p></body>";
+
+ m_mainFrame->setHtml(html8);
+ p = m_mainFrame->documentElement().findAll("p").at(0);
+
+ QCOMPARE(p.styleProperty("color"), QLatin1String(""));
+ QCOMPARE(p.styleProperty("color", QWebElement::RespectCascadingStyles), QLatin1String(""));
+}
+
+void tst_QWebElement::computedStyle()
+{
+ QString html = "<body><p>some text</p></body>";
+ m_mainFrame->setHtml(html);
+
+ QWebElement p = m_mainFrame->documentElement().findAll("p").at(0);
+ QCOMPARE(p.computedStyleProperty("cursor"), QLatin1String("auto"));
+ QVERIFY(!p.computedStyleProperty("cursor").isEmpty());
+ QVERIFY(p.styleProperty("cursor").isEmpty());
+
+ p.setStyleProperty("cursor", "text");
+ p.setStyleProperty("color", "red");
+
+ QCOMPARE(p.computedStyleProperty("cursor"), QLatin1String("text"));
+ QCOMPARE(p.computedStyleProperty("color"), QLatin1String("rgb(255, 0, 0)"));
+ QCOMPARE(p.styleProperty("color"), QLatin1String("red"));
+}
+
+void tst_QWebElement::properties()
+{
+ m_mainFrame->setHtml("<body><form><input type=checkbox id=ourcheckbox checked=true>");
+
+ QWebElement checkBox = m_mainFrame->findFirstElement("#ourcheckbox");
+ QVERIFY(!checkBox.isNull());
+
+ QVERIFY(checkBox.scriptableProperties().contains("checked"));
+
+ QCOMPARE(checkBox.scriptableProperty("checked"), QVariant(true));
+ checkBox.setScriptableProperty("checked", false);
+ QCOMPARE(checkBox.scriptableProperty("checked"), QVariant(false));
+
+ QVERIFY(!checkBox.scriptableProperties().contains("non_existant"));
+ QCOMPARE(checkBox.scriptableProperty("non_existant"), QVariant());
+
+ checkBox.setScriptableProperty("non_existant", "test");
+
+ QCOMPARE(checkBox.scriptableProperty("non_existant"), QVariant("test"));
+ QVERIFY(checkBox.scriptableProperties().contains("non_existant"));
+
+ // removing scriptableProperties is currently not supported. We should look into this
+ // and consider the option of just allowing through the QtScript API only.
+#if 0
+ checkBox.setScriptableProperty("non_existant", QVariant());
+
+ QCOMPARE(checkBox.scriptableProperty("non_existant"), QVariant());
+ QVERIFY(!checkBox.scriptableProperties().contains("non_existant"));
+#endif
+}
+
+void tst_QWebElement::appendAndPrepend()
+{
+ QString html = "<body>"
+ "<p>"
+ "foo"
+ "</p>"
+ "<p>"
+ "bar"
+ "</p>"
+ "</body>";
+
+ m_mainFrame->setHtml(html);
+ QWebElement body = m_mainFrame->documentElement().findFirst("body");
+
+ QCOMPARE(body.findAll("p").count(), 2);
+ body.appendInside(body.findFirst("p"));
+ QCOMPARE(body.findAll("p").count(), 2);
+ QCOMPARE(body.findFirst("p").toPlainText(), QString("bar"));
+ QCOMPARE(body.findAll("p").last().toPlainText(), QString("foo"));
+
+ body.appendInside(body.findFirst("p").clone());
+ QCOMPARE(body.findAll("p").count(), 3);
+ QCOMPARE(body.findFirst("p").toPlainText(), QString("bar"));
+ QCOMPARE(body.findAll("p").last().toPlainText(), QString("bar"));
+
+ body.prependInside(body.findAll("p").at(1).clone());
+ QCOMPARE(body.findAll("p").count(), 4);
+ QCOMPARE(body.findFirst("p").toPlainText(), QString("foo"));
+
+ body.findFirst("p").appendInside("<div>booyakasha</div>");
+ QCOMPARE(body.findAll("p div").count(), 1);
+ QCOMPARE(body.findFirst("p div").toPlainText(), QString("booyakasha"));
+
+ body.findFirst("div").prependInside("<code>yepp</code>");
+ QCOMPARE(body.findAll("p div code").count(), 1);
+ QCOMPARE(body.findFirst("p div code").toPlainText(), QString("yepp"));
+}
+
+void tst_QWebElement::insertBeforeAndAfter()
+{
+ QString html = "<body>"
+ "<p>"
+ "foo"
+ "</p>"
+ "<div>"
+ "yeah"
+ "</div>"
+ "<p>"
+ "bar"
+ "</p>"
+ "</body>";
+
+ m_mainFrame->setHtml(html);
+ QWebElement body = m_mainFrame->documentElement().findFirst("body");
+ QWebElement div = body.findFirst("div");
+
+ QCOMPARE(body.findAll("p").count(), 2);
+ QCOMPARE(body.findAll("div").count(), 1);
+
+ div.prependOutside(body.findAll("p").last().clone());
+ QCOMPARE(body.findAll("p").count(), 3);
+ QCOMPARE(body.findAll("p").at(0).toPlainText(), QString("foo"));
+ QCOMPARE(body.findAll("p").at(1).toPlainText(), QString("bar"));
+ QCOMPARE(body.findAll("p").at(2).toPlainText(), QString("bar"));
+
+ div.appendOutside(body.findFirst("p").clone());
+ QCOMPARE(body.findAll("p").count(), 4);
+ QCOMPARE(body.findAll("p").at(0).toPlainText(), QString("foo"));
+ QCOMPARE(body.findAll("p").at(1).toPlainText(), QString("bar"));
+ QCOMPARE(body.findAll("p").at(2).toPlainText(), QString("foo"));
+ QCOMPARE(body.findAll("p").at(3).toPlainText(), QString("bar"));
+
+ div.prependOutside("<span>hey</span>");
+ QCOMPARE(body.findAll("span").count(), 1);
+
+ div.appendOutside("<span>there</span>");
+ QCOMPARE(body.findAll("span").count(), 2);
+ QCOMPARE(body.findAll("span").at(0).toPlainText(), QString("hey"));
+ QCOMPARE(body.findAll("span").at(1).toPlainText(), QString("there"));
+}
+
+void tst_QWebElement::remove()
+{
+ QString html = "<body>"
+ "<p>"
+ "foo"
+ "</p>"
+ "<div>"
+ "<p>yeah</p>"
+ "</div>"
+ "<p>"
+ "bar"
+ "</p>"
+ "</body>";
+
+ m_mainFrame->setHtml(html);
+ QWebElement body = m_mainFrame->documentElement().findFirst("body");
+
+ QCOMPARE(body.findAll("div").count(), 1);
+ QCOMPARE(body.findAll("p").count(), 3);
+
+ QWebElement div = body.findFirst("div");
+ div.takeFromDocument();
+
+ QCOMPARE(div.isNull(), false);
+ QCOMPARE(body.findAll("div").count(), 0);
+ QCOMPARE(body.findAll("p").count(), 2);
+
+ body.appendInside(div);
+
+ QCOMPARE(body.findAll("div").count(), 1);
+ QCOMPARE(body.findAll("p").count(), 3);
+}
+
+void tst_QWebElement::clear()
+{
+ QString html = "<body>"
+ "<p>"
+ "foo"
+ "</p>"
+ "<div>"
+ "<p>yeah</p>"
+ "</div>"
+ "<p>"
+ "bar"
+ "</p>"
+ "</body>";
+
+ m_mainFrame->setHtml(html);
+ QWebElement body = m_mainFrame->documentElement().findFirst("body");
+
+ QCOMPARE(body.findAll("div").count(), 1);
+ QCOMPARE(body.findAll("p").count(), 3);
+ body.findFirst("div").removeChildren();
+ QCOMPARE(body.findAll("div").count(), 1);
+ QCOMPARE(body.findAll("p").count(), 2);
+}
+
+
+void tst_QWebElement::replaceWith()
+{
+ QString html = "<body>"
+ "<p>"
+ "foo"
+ "</p>"
+ "<div>"
+ "yeah"
+ "</div>"
+ "<p>"
+ "<span>haba</span>"
+ "</p>"
+ "</body>";
+
+ m_mainFrame->setHtml(html);
+ QWebElement body = m_mainFrame->documentElement().findFirst("body");
+
+ QCOMPARE(body.findAll("div").count(), 1);
+ QCOMPARE(body.findAll("span").count(), 1);
+ body.findFirst("div").replace(body.findFirst("span").clone());
+ QCOMPARE(body.findAll("div").count(), 0);
+ QCOMPARE(body.findAll("span").count(), 2);
+ QCOMPARE(body.findAll("p").count(), 2);
+
+ body.findFirst("span").replace("<p><code>wow</code></p>");
+ QCOMPARE(body.findAll("p").count(), 3);
+ QCOMPARE(body.findAll("p code").count(), 1);
+ QCOMPARE(body.findFirst("p code").toPlainText(), QString("wow"));
+}
+
+void tst_QWebElement::encloseContentsWith()
+{
+ QString html = "<body>"
+ "<div>"
+ "<i>"
+ "yeah"
+ "</i>"
+ "<i>"
+ "hello"
+ "</i>"
+ "</div>"
+ "<p>"
+ "<span>foo</span>"
+ "<span>bar</span>"
+ "</p>"
+ "<u></u>"
+ "<b></b>"
+ "<em>hey</em>"
+ "</body>";
+
+ m_mainFrame->setHtml(html);
+ QWebElement body = m_mainFrame->documentElement().findFirst("body");
+
+ body.findFirst("p").encloseContentsWith(body.findFirst("b"));
+ QCOMPARE(body.findAll("p b span").count(), 2);
+ QCOMPARE(body.findFirst("p b span").toPlainText(), QString("foo"));
+
+ body.findFirst("u").encloseContentsWith("<i></i>");
+ QCOMPARE(body.findAll("u i").count(), 1);
+ QCOMPARE(body.findFirst("u i").toPlainText(), QString());
+
+ body.findFirst("div").encloseContentsWith("<span></span>");
+ QCOMPARE(body.findAll("div span i").count(), 2);
+ QCOMPARE(body.findFirst("div span i").toPlainText(), QString("yeah"));
+
+ QString snippet = ""
+ "<table>"
+ "<tbody>"
+ "<tr>"
+ "<td></td>"
+ "<td></td>"
+ "</tr>"
+ "<tr>"
+ "<td></td>"
+ "<td></td>"
+ "<tr>"
+ "</tbody>"
+ "</table>";
+
+ body.findFirst("em").encloseContentsWith(snippet);
+ QCOMPARE(body.findFirst("em table tbody tr td").toPlainText(), QString("hey"));
+}
+
+void tst_QWebElement::encloseWith()
+{
+ QString html = "<body>"
+ "<p>"
+ "foo"
+ "</p>"
+ "<div>"
+ "yeah"
+ "</div>"
+ "<p>"
+ "<span>bar</span>"
+ "</p>"
+ "<em>hey</em>"
+ "<h1>hello</h1>"
+ "</body>";
+
+ m_mainFrame->setHtml(html);
+ QWebElement body = m_mainFrame->documentElement().findFirst("body");
+
+ body.findFirst("p").encloseWith("<br>");
+ QCOMPARE(body.findAll("br").count(), 0);
+
+ QCOMPARE(body.findAll("div").count(), 1);
+ body.findFirst("div").encloseWith(body.findFirst("span").clone());
+ QCOMPARE(body.findAll("div").count(), 1);
+ QCOMPARE(body.findAll("span").count(), 2);
+ QCOMPARE(body.findAll("p").count(), 2);
+
+ body.findFirst("div").encloseWith("<code></code>");
+ QCOMPARE(body.findAll("code").count(), 1);
+ QCOMPARE(body.findAll("code div").count(), 1);
+ QCOMPARE(body.findFirst("code div").toPlainText(), QString("yeah"));
+
+ QString snippet = ""
+ "<table>"
+ "<tbody>"
+ "<tr>"
+ "<td></td>"
+ "<td></td>"
+ "</tr>"
+ "<tr>"
+ "<td></td>"
+ "<td></td>"
+ "<tr>"
+ "</tbody>"
+ "</table>";
+
+ body.findFirst("em").encloseWith(snippet);
+ QCOMPARE(body.findFirst("table tbody tr td em").toPlainText(), QString("hey"));
+}
+
+void tst_QWebElement::nullSelect()
+{
+ m_mainFrame->setHtml("<body><p>Test");
+
+ QList<QWebElement> collection = m_mainFrame->findAllElements("invalid{syn(tax;;%#$f223e>>");
+ QVERIFY(collection.count() == 0);
+}
+
+void tst_QWebElement::firstChildNextSibling()
+{
+ m_mainFrame->setHtml("<body><!--comment--><p>Test</p><!--another commend><table>");
+
+ QWebElement body = m_mainFrame->findFirstElement("body");
+ QVERIFY(!body.isNull());
+ QWebElement p = body.firstChild();
+ QVERIFY(!p.isNull());
+ QCOMPARE(p.tagName(), QString("P"));
+ QWebElement table = p.nextSibling();
+ QVERIFY(!table.isNull());
+ QCOMPARE(table.tagName(), QString("TABLE"));
+ QVERIFY(table.nextSibling().isNull());
+}
+
+void tst_QWebElement::lastChildPreviousSibling()
+{
+ m_mainFrame->setHtml("<body><!--comment--><p>Test</p><!--another commend><table>");
+
+ QWebElement body = m_mainFrame->findFirstElement("body");
+ QVERIFY(!body.isNull());
+ QWebElement table = body.lastChild();
+ QVERIFY(!table.isNull());
+ QCOMPARE(table.tagName(), QString("TABLE"));
+ QWebElement p = table.previousSibling();
+ QVERIFY(!p.isNull());
+ QCOMPARE(p.tagName(), QString("P"));
+ QVERIFY(p.previousSibling().isNull());
+}
+
+QTEST_MAIN(tst_QWebElement)
+#include "tst_qwebelement.moc"
diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/qwebframe.qrc b/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/qwebframe.qrc
index 69e62d9..266cdce 100644
--- a/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/qwebframe.qrc
+++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/qwebframe.qrc
@@ -1,5 +1,6 @@
<!DOCTYPE RCC><RCC version="1.0">
<qresource prefix="/">
<file>image.png</file>
+<file>style.css</file>
</qresource>
</RCC>
diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/style.css b/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/style.css
new file mode 100644
index 0000000..c05b747
--- /dev/null
+++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/style.css
@@ -0,0 +1 @@
+#idP {color: red !important}
diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp b/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp
index 36660a3..30e3364 100644
--- a/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp
+++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp
@@ -21,6 +21,7 @@
#include <QtTest/QtTest>
#include <qwebpage.h>
+#include <qwebelement.h>
#include <qwidget.h>
#include <qwebview.h>
#include <qwebframe.h>
@@ -570,14 +571,17 @@ private slots:
void typeConversion();
void symmetricUrl();
void progressSignal();
+ void urlChange();
void domCycles();
void setHtml();
void setHtmlWithResource();
void ipv6HostEncoding();
void metaData();
void popupFocus();
+ void hitTestContent();
void jsByteArray();
void ownership();
+ void nullValue();
private:
QString evalJS(const QString&s) {
// Convert an undefined return variant to the string "undefined"
@@ -2124,6 +2128,26 @@ void tst_QWebFrame::progressSignal()
QCOMPARE(progressSpy.last().first().toInt(), 100);
}
+void tst_QWebFrame::urlChange()
+{
+ QSignalSpy urlSpy(m_page->mainFrame(), SIGNAL(urlChanged(QUrl)));
+
+ QUrl dataUrl("data:text/html,<h1>Test");
+ m_view->setUrl(dataUrl);
+
+ ::waitForSignal(m_page->mainFrame(), SIGNAL(urlChanged(QUrl)));
+
+ QCOMPARE(urlSpy.size(), 1);
+
+ QUrl dataUrl2("data:text/html,<html><head><title>title</title></head><body><h1>Test</body></html>");
+ m_view->setUrl(dataUrl2);
+
+ ::waitForSignal(m_page->mainFrame(), SIGNAL(urlChanged(QUrl)));
+
+ QCOMPARE(urlSpy.size(), 2);
+}
+
+
void tst_QWebFrame::domCycles()
{
m_view->setHtml("<html><body>");
@@ -2133,7 +2157,7 @@ void tst_QWebFrame::domCycles()
void tst_QWebFrame::setHtml()
{
- QString html("<html><body><p>hello world</p></body></html>");
+ QString html("<html><head></head><body><p>hello world</p></body></html>");
m_view->page()->mainFrame()->setHtml(html);
QCOMPARE(m_view->page()->mainFrame()->toHtml(), html);
}
@@ -2154,6 +2178,24 @@ void tst_QWebFrame::setHtmlWithResource()
QCOMPARE(frame->evaluateJavaScript("document.images.length").toInt(), 1);
QCOMPARE(frame->evaluateJavaScript("document.images[0].width").toInt(), 128);
QCOMPARE(frame->evaluateJavaScript("document.images[0].height").toInt(), 128);
+
+ QString html2 =
+ "<html>"
+ "<head>"
+ "<link rel='stylesheet' href='qrc:/style.css' type='text/css' />"
+ "</head>"
+ "<body>"
+ "<p id='idP'>some text</p>"
+ "</body>"
+ "</html>";
+
+ // in few seconds, the CSS should be completey loaded
+ frame->setHtml(html2);
+ QTest::qWait(200);
+ QCOMPARE(spy.size(), 2);
+
+ QWebElement p = frame->documentElement().findAll("p").at(0);
+ QCOMPARE(p.styleProperty("color", QWebElement::RespectCascadingStyles), QLatin1String("red"));
}
class TestNetworkManager : public QNetworkAccessManager
@@ -2274,6 +2316,19 @@ void tst_QWebFrame::popupFocus()
"The input field should have a blinking caret");
}
+void tst_QWebFrame::hitTestContent()
+{
+ QString html("<html><body><p>A paragraph</p><br/><br/><br/><a href=\"about:blank\" target=\"_foo\">link text</a></body></html>");
+
+ QWebPage page;
+ QWebFrame* frame = page.mainFrame();
+ frame->setHtml(html);
+ page.setViewportSize(QSize(200, 0)); //no height so link is not visible
+ QWebHitTestResult result = frame->hitTestContent(QPoint(10, 100));
+ QCOMPARE(result.linkText(), QString("link text"));
+ QCOMPARE(result.linkTarget(), QString("_foo"));
+}
+
void tst_QWebFrame::jsByteArray()
{
QByteArray ba("hello world");
@@ -2351,5 +2406,11 @@ void tst_QWebFrame::ownership()
}
}
+void tst_QWebFrame::nullValue()
+{
+ QVariant v = m_view->page()->mainFrame()->evaluateJavaScript("null");
+ QVERIFY(v.isNull());
+}
+
QTEST_MAIN(tst_QWebFrame)
#include "tst_qwebframe.moc"
diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/frametest/frame_a.html b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/frametest/frame_a.html
new file mode 100644
index 0000000..9ff68f1
--- /dev/null
+++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/frametest/frame_a.html
@@ -0,0 +1,2 @@
+<a href="http://google.com" target="frame_b"><img src="" width=100 height=100 alt="Google"></a>
+<a href="http://yahoo.com" target="frame_b"><img src="" width=100 height=100 alt="Yahoo"></a>
diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/frametest/index.html b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/frametest/index.html
new file mode 100644
index 0000000..c53ad09
--- /dev/null
+++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/frametest/index.html
@@ -0,0 +1,4 @@
+<frameset cols="25%,75%">
+ <frame src="frame_a.html" name="frame_a">
+ <frame src="frame_b.html" name="frame_b">
+</frameset>
diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/qwebpage.pro b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/qwebpage.pro
index bbd98c6..2f3a108 100644
--- a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/qwebpage.pro
+++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/qwebpage.pro
@@ -2,5 +2,6 @@ TEMPLATE = app
TARGET = tst_qwebpage
include(../../../../WebKit.pri)
SOURCES += tst_qwebpage.cpp
+RESOURCES += tst_qwebpage.qrc
QT += testlib network
QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR
diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp
index 620aa31..1d6a48e 100644
--- a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp
+++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp
@@ -105,6 +105,7 @@ private slots:
void cursorMovements();
void textSelection();
void textEditing();
+ void backActionUpdate();
void requestCache();
@@ -834,7 +835,7 @@ void tst_QWebPage::cursorMovements()
// cursor will be before the word "be"
page->triggerAction(QWebPage::MoveToStartOfBlock);
QVERIFY(page->isSelectionCollapsed());
- QCOMPARE(page->selectionStartOffset(), 2);
+ QCOMPARE(page->selectionStartOffset(), 0);
// cursor will be after the word "you!"
page->triggerAction(QWebPage::MoveToEndOfBlock);
@@ -887,7 +888,7 @@ void tst_QWebPage::textSelection()
QVERIFY(page->action(QWebPage::SelectStartOfDocument) != 0);
QVERIFY(page->action(QWebPage::SelectEndOfDocument) != 0);
- // right now they are disabled because contentEditable is false and
+ // right now they are disabled because contentEditable is false and
// there isn't an existing selection to modify
QCOMPARE(page->action(QWebPage::SelectNextChar)->isEnabled(), false);
QCOMPARE(page->action(QWebPage::SelectPreviousChar)->isEnabled(), false);
@@ -960,15 +961,10 @@ void tst_QWebPage::textEditing()
"<p>May the source<br/>be with you!</p></body></html>");
page->mainFrame()->setHtml(content);
- // this will select the first paragraph
- QString script = "var range = document.createRange(); " \
- "var node = document.getElementById(\"one\"); " \
- "range.selectNode(node); " \
- "getSelection().addRange(range);";
- page->mainFrame()->evaluateJavaScript(script);
- QCOMPARE(page->selectedText().trimmed(), QString::fromLatin1("The quick brown fox"));
-
// these actions must exist
+ QVERIFY(page->action(QWebPage::Cut) != 0);
+ QVERIFY(page->action(QWebPage::Copy) != 0);
+ QVERIFY(page->action(QWebPage::Paste) != 0);
QVERIFY(page->action(QWebPage::DeleteStartOfWord) != 0);
QVERIFY(page->action(QWebPage::DeleteEndOfWord) != 0);
QVERIFY(page->action(QWebPage::SetTextDirectionDefault) != 0);
@@ -979,8 +975,23 @@ void tst_QWebPage::textEditing()
QVERIFY(page->action(QWebPage::ToggleUnderline) != 0);
QVERIFY(page->action(QWebPage::InsertParagraphSeparator) != 0);
QVERIFY(page->action(QWebPage::InsertLineSeparator) != 0);
+ QVERIFY(page->action(QWebPage::PasteAndMatchStyle) != 0);
+ QVERIFY(page->action(QWebPage::RemoveFormat) != 0);
+ QVERIFY(page->action(QWebPage::ToggleStrikethrough) != 0);
+ QVERIFY(page->action(QWebPage::ToggleSubscript) != 0);
+ QVERIFY(page->action(QWebPage::ToggleSuperscript) != 0);
+ QVERIFY(page->action(QWebPage::InsertUnorderedList) != 0);
+ QVERIFY(page->action(QWebPage::InsertOrderedList) != 0);
+ QVERIFY(page->action(QWebPage::Indent) != 0);
+ QVERIFY(page->action(QWebPage::Outdent) != 0);
+ QVERIFY(page->action(QWebPage::AlignCenter) != 0);
+ QVERIFY(page->action(QWebPage::AlignJustified) != 0);
+ QVERIFY(page->action(QWebPage::AlignLeft) != 0);
+ QVERIFY(page->action(QWebPage::AlignRight) != 0);
// right now they are disabled because contentEditable is false
+ QCOMPARE(page->action(QWebPage::Cut)->isEnabled(), false);
+ QCOMPARE(page->action(QWebPage::Paste)->isEnabled(), false);
QCOMPARE(page->action(QWebPage::DeleteStartOfWord)->isEnabled(), false);
QCOMPARE(page->action(QWebPage::DeleteEndOfWord)->isEnabled(), false);
QCOMPARE(page->action(QWebPage::SetTextDirectionDefault)->isEnabled(), false);
@@ -991,11 +1002,39 @@ void tst_QWebPage::textEditing()
QCOMPARE(page->action(QWebPage::ToggleUnderline)->isEnabled(), false);
QCOMPARE(page->action(QWebPage::InsertParagraphSeparator)->isEnabled(), false);
QCOMPARE(page->action(QWebPage::InsertLineSeparator)->isEnabled(), false);
+ QCOMPARE(page->action(QWebPage::PasteAndMatchStyle)->isEnabled(), false);
+ QCOMPARE(page->action(QWebPage::RemoveFormat)->isEnabled(), false);
+ QCOMPARE(page->action(QWebPage::ToggleStrikethrough)->isEnabled(), false);
+ QCOMPARE(page->action(QWebPage::ToggleSubscript)->isEnabled(), false);
+ QCOMPARE(page->action(QWebPage::ToggleSuperscript)->isEnabled(), false);
+ QCOMPARE(page->action(QWebPage::InsertUnorderedList)->isEnabled(), false);
+ QCOMPARE(page->action(QWebPage::InsertOrderedList)->isEnabled(), false);
+ QCOMPARE(page->action(QWebPage::Indent)->isEnabled(), false);
+ QCOMPARE(page->action(QWebPage::Outdent)->isEnabled(), false);
+ QCOMPARE(page->action(QWebPage::AlignCenter)->isEnabled(), false);
+ QCOMPARE(page->action(QWebPage::AlignJustified)->isEnabled(), false);
+ QCOMPARE(page->action(QWebPage::AlignLeft)->isEnabled(), false);
+ QCOMPARE(page->action(QWebPage::AlignRight)->isEnabled(), false);
+
+ // Select everything
+ page->triggerAction(QWebPage::SelectAll);
+
+ // make sure it is enabled since there is a selection
+ QCOMPARE(page->action(QWebPage::Copy)->isEnabled(), true);
// make it editable before navigating the cursor
page->setContentEditable(true);
+ // clear the selection
+ page->triggerAction(QWebPage::MoveToStartOfDocument);
+ QVERIFY(page->isSelectionCollapsed());
+ QCOMPARE(page->selectionStartOffset(), 0);
+
+ // make sure it is disabled since there isn't a selection
+ QCOMPARE(page->action(QWebPage::Copy)->isEnabled(), false);
+
// here the actions are enabled after contentEditable is true
+ QCOMPARE(page->action(QWebPage::Paste)->isEnabled(), true);
QCOMPARE(page->action(QWebPage::DeleteStartOfWord)->isEnabled(), true);
QCOMPARE(page->action(QWebPage::DeleteEndOfWord)->isEnabled(), true);
QCOMPARE(page->action(QWebPage::SetTextDirectionDefault)->isEnabled(), true);
@@ -1006,6 +1045,29 @@ void tst_QWebPage::textEditing()
QCOMPARE(page->action(QWebPage::ToggleUnderline)->isEnabled(), true);
QCOMPARE(page->action(QWebPage::InsertParagraphSeparator)->isEnabled(), true);
QCOMPARE(page->action(QWebPage::InsertLineSeparator)->isEnabled(), true);
+ QCOMPARE(page->action(QWebPage::PasteAndMatchStyle)->isEnabled(), true);
+ QCOMPARE(page->action(QWebPage::ToggleStrikethrough)->isEnabled(), true);
+ QCOMPARE(page->action(QWebPage::ToggleSubscript)->isEnabled(), true);
+ QCOMPARE(page->action(QWebPage::ToggleSuperscript)->isEnabled(), true);
+ QCOMPARE(page->action(QWebPage::InsertUnorderedList)->isEnabled(), true);
+ QCOMPARE(page->action(QWebPage::InsertOrderedList)->isEnabled(), true);
+ QCOMPARE(page->action(QWebPage::Indent)->isEnabled(), true);
+ QCOMPARE(page->action(QWebPage::Outdent)->isEnabled(), true);
+ QCOMPARE(page->action(QWebPage::AlignCenter)->isEnabled(), true);
+ QCOMPARE(page->action(QWebPage::AlignJustified)->isEnabled(), true);
+ QCOMPARE(page->action(QWebPage::AlignLeft)->isEnabled(), true);
+ QCOMPARE(page->action(QWebPage::AlignRight)->isEnabled(), true);
+
+ // make sure these are disabled since there isn't a selection
+ QCOMPARE(page->action(QWebPage::Cut)->isEnabled(), false);
+ QCOMPARE(page->action(QWebPage::RemoveFormat)->isEnabled(), false);
+
+ // make sure everything is selected
+ page->triggerAction(QWebPage::SelectAll);
+
+ // this is only true if there is an editable selection
+ QCOMPARE(page->action(QWebPage::Cut)->isEnabled(), true);
+ QCOMPARE(page->action(QWebPage::RemoveFormat)->isEnabled(), true);
delete page;
}
@@ -1037,5 +1099,22 @@ void tst_QWebPage::requestCache()
(int)QNetworkRequest::PreferCache);
}
+void tst_QWebPage::backActionUpdate()
+{
+ QWebView view;
+ QWebPage *page = view.page();
+ QAction *action = page->action(QWebPage::Back);
+ QVERIFY(!action->isEnabled());
+ QSignalSpy loadSpy(page, SIGNAL(loadFinished(bool)));
+ QUrl url = QUrl("qrc:///frametest/index.html");
+ page->mainFrame()->load(url);
+ QTRY_COMPARE(loadSpy.count(), 1);
+ QVERIFY(!action->isEnabled());
+ QTest::mouseClick(&view, Qt::LeftButton, 0, QPoint(10, 10));
+ QTRY_COMPARE(loadSpy.count(), 2);
+
+ QVERIFY(action->isEnabled());
+}
+
QTEST_MAIN(tst_QWebPage)
#include "tst_qwebpage.moc"
diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.qrc b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.qrc
new file mode 100644
index 0000000..38c5232
--- /dev/null
+++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.qrc
@@ -0,0 +1,7 @@
+<!DOCTYPE RCC><RCC version="1.0">
+<qresource>
+ <file>frametest/index.html</file>
+ <file>frametest/frame_a.html</file>
+</qresource>
+</RCC>
+
diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebview/.gitignore b/src/3rdparty/webkit/WebKit/qt/tests/qwebview/.gitignore
new file mode 100644
index 0000000..444afe6
--- /dev/null
+++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebview/.gitignore
@@ -0,0 +1 @@
+qwebview
diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebview/qwebview.pro b/src/3rdparty/webkit/WebKit/qt/tests/qwebview/qwebview.pro
new file mode 100644
index 0000000..799ccfb
--- /dev/null
+++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebview/qwebview.pro
@@ -0,0 +1,6 @@
+TEMPLATE = app
+TARGET = tst_qwebview
+include(../../../../WebKit.pri)
+SOURCES += tst_qwebview.cpp
+QT += testlib network
+QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR
diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebview/tst_qwebview.cpp b/src/3rdparty/webkit/WebKit/qt/tests/qwebview/tst_qwebview.cpp
new file mode 100644
index 0000000..6501bfc
--- /dev/null
+++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebview/tst_qwebview.cpp
@@ -0,0 +1,165 @@
+/*
+ Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies)
+ Copyright (C) 2009 Torch Mobile Inc.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#include <qtest.h>
+
+#include <qpainter.h>
+#include <qwebview.h>
+#include <qwebpage.h>
+#include <qnetworkrequest.h>
+#include <qdiriterator.h>
+
+class tst_QWebView : public QObject
+{
+ Q_OBJECT
+
+public slots:
+ void initTestCase();
+ void cleanupTestCase();
+ void init();
+ void cleanup();
+
+private slots:
+ void renderHints();
+ void guessUrlFromString_data();
+ void guessUrlFromString();
+};
+
+// This will be called before the first test function is executed.
+// It is only called once.
+void tst_QWebView::initTestCase()
+{
+}
+
+// This will be called after the last test function is executed.
+// It is only called once.
+void tst_QWebView::cleanupTestCase()
+{
+}
+
+// This will be called before each test function is executed.
+void tst_QWebView::init()
+{
+}
+
+// This will be called after every test function.
+void tst_QWebView::cleanup()
+{
+}
+
+void tst_QWebView::renderHints()
+{
+ QWebView webView;
+
+ // default is only text antialiasing
+ QVERIFY(!(webView.renderHints() & QPainter::Antialiasing));
+ QVERIFY(webView.renderHints() & QPainter::TextAntialiasing);
+ QVERIFY(!(webView.renderHints() & QPainter::SmoothPixmapTransform));
+ QVERIFY(!(webView.renderHints() & QPainter::HighQualityAntialiasing));
+
+ webView.setRenderHint(QPainter::Antialiasing, true);
+ QVERIFY(webView.renderHints() & QPainter::Antialiasing);
+ QVERIFY(webView.renderHints() & QPainter::TextAntialiasing);
+ QVERIFY(!(webView.renderHints() & QPainter::SmoothPixmapTransform));
+ QVERIFY(!(webView.renderHints() & QPainter::HighQualityAntialiasing));
+
+ webView.setRenderHint(QPainter::Antialiasing, false);
+ QVERIFY(!(webView.renderHints() & QPainter::Antialiasing));
+ QVERIFY(webView.renderHints() & QPainter::TextAntialiasing);
+ QVERIFY(!(webView.renderHints() & QPainter::SmoothPixmapTransform));
+ QVERIFY(!(webView.renderHints() & QPainter::HighQualityAntialiasing));
+
+ webView.setRenderHint(QPainter::SmoothPixmapTransform, true);
+ QVERIFY(!(webView.renderHints() & QPainter::Antialiasing));
+ QVERIFY(webView.renderHints() & QPainter::TextAntialiasing);
+ QVERIFY(webView.renderHints() & QPainter::SmoothPixmapTransform);
+ QVERIFY(!(webView.renderHints() & QPainter::HighQualityAntialiasing));
+
+ webView.setRenderHint(QPainter::SmoothPixmapTransform, false);
+ QVERIFY(webView.renderHints() & QPainter::TextAntialiasing);
+ QVERIFY(!(webView.renderHints() & QPainter::SmoothPixmapTransform));
+ QVERIFY(!(webView.renderHints() & QPainter::HighQualityAntialiasing));
+}
+
+void tst_QWebView::guessUrlFromString_data()
+{
+ QTest::addColumn<QString>("string");
+ QTest::addColumn<QUrl>("guessUrlFromString");
+
+ // Null
+ QTest::newRow("null") << QString() << QUrl();
+
+ // File
+ QDirIterator it(QDir::homePath());
+ QString fileString;
+ int c = 0;
+ while (it.hasNext()) {
+ it.next();
+ QTest::newRow(QString("file-%1").arg(c++).toLatin1()) << it.filePath() << QUrl::fromLocalFile(it.filePath());
+ }
+
+ // basic latin1
+ QTest::newRow("unicode-0") << QString::fromUtf8("å.com/") << QUrl::fromEncoded(QString::fromUtf8("http://å.com/").toUtf8(), QUrl::TolerantMode);
+ // unicode
+ QTest::newRow("unicode-1") << QString::fromUtf8("λ.com/") << QUrl::fromEncoded(QString::fromUtf8("http://λ.com/").toUtf8(), QUrl::TolerantMode);
+
+ // no scheme
+ QTest::newRow("add scheme-0") << "webkit.org" << QUrl("http://webkit.org");
+ QTest::newRow("add scheme-1") << "www.webkit.org" << QUrl("http://www.webkit.org");
+ QTest::newRow("add scheme-2") << "ftp.webkit.org" << QUrl("ftp://ftp.webkit.org");
+ QTest::newRow("add scheme-3") << "webkit" << QUrl("webkit");
+
+ // QUrl's tolerant parser should already handle this
+ QTest::newRow("not-encoded-0") << "http://webkit.org/test page.html" << QUrl("http://webkit.org/test%20page.html");
+
+ // Make sure the :80, i.e. port doesn't screw anything up
+ QUrl portUrl("http://webkit.org");
+ portUrl.setPort(80);
+ QTest::newRow("port-0") << "webkit.org:80" << portUrl;
+ QTest::newRow("port-1") << "http://webkit.org:80" << portUrl;
+
+ // mailto doesn't have a ://, but is valid
+ QUrl mailto("ben@meyerhome.net");
+ mailto.setScheme("mailto");
+ QTest::newRow("mailto") << "mailto:ben@meyerhome.net" << mailto;
+
+ // misc
+ QTest::newRow("localhost-0") << "localhost" << QUrl("http://localhost");
+ QTest::newRow("localhost-1") << "localhost:80" << QUrl("http://localhost:80");
+ QTest::newRow("spaces-0") << " http://webkit.org/test page.html " << QUrl("http://webkit.org/test%20page.html");
+
+ // FYI: The scheme in the resulting url user
+ QUrl authUrl("user:pass@domain.com");
+ QTest::newRow("misc-1") << "user:pass@domain.com" << authUrl;
+}
+
+// public static QUrl guessUrlFromString(QString const& string)
+void tst_QWebView::guessUrlFromString()
+{
+ QFETCH(QString, string);
+ QFETCH(QUrl, guessUrlFromString);
+
+ QUrl url = QWebView::guessUrlFromString(string);
+ QCOMPARE(url, guessUrlFromString);
+}
+
+QTEST_MAIN(tst_QWebView)
+#include "tst_qwebview.moc"
+
diff --git a/src/3rdparty/webkit/WebKit/qt/tests/tests.pro b/src/3rdparty/webkit/WebKit/qt/tests/tests.pro
index 16cb457..e898ca0 100644
--- a/src/3rdparty/webkit/WebKit/qt/tests/tests.pro
+++ b/src/3rdparty/webkit/WebKit/qt/tests/tests.pro
@@ -1,3 +1,3 @@
TEMPLATE = subdirs
-SUBDIRS = qwebframe qwebpage qwebhistoryinterface
+SUBDIRS = qwebframe qwebpage qwebelement qwebhistoryinterface qwebview