diff options
author | Ben Murdoch <benm@google.com> | 2011-05-24 11:24:40 +0100 |
---|---|---|
committer | Ben Murdoch <benm@google.com> | 2011-06-02 09:53:15 +0100 |
commit | 81bc750723a18f21cd17d1b173cd2a4dda9cea6e (patch) | |
tree | 7a9e5ed86ff429fd347a25153107221543909b19 /Source/WebKit/qt/Api/qwebelement.cpp | |
parent | 94088a6d336c1dd80a1e734af51e96abcbb689a7 (diff) | |
download | external_webkit-81bc750723a18f21cd17d1b173cd2a4dda9cea6e.zip external_webkit-81bc750723a18f21cd17d1b173cd2a4dda9cea6e.tar.gz external_webkit-81bc750723a18f21cd17d1b173cd2a4dda9cea6e.tar.bz2 |
Merge WebKit at r80534: Intial merge by Git
Change-Id: Ia7a83357124c9e1cdb1debf55d9661ec0bd09a61
Diffstat (limited to 'Source/WebKit/qt/Api/qwebelement.cpp')
-rw-r--r-- | Source/WebKit/qt/Api/qwebelement.cpp | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/Source/WebKit/qt/Api/qwebelement.cpp b/Source/WebKit/qt/Api/qwebelement.cpp index 60ae3a0..b0b1b92 100644 --- a/Source/WebKit/qt/Api/qwebelement.cpp +++ b/Source/WebKit/qt/Api/qwebelement.cpp @@ -49,7 +49,9 @@ #include "StaticNodeList.h" #include "qwebframe.h" #include "qwebframe_p.h" +#if USE(JSC) #include "runtime_root.h" +#endif #include <wtf/Vector.h> #include <wtf/text/CString.h> @@ -784,7 +786,7 @@ QVariant QWebElement::evaluateJavaScript(const QString& scriptSource) if (!setupScriptContext(m_element, thisValue, state, scriptController)) return QVariant(); #if USE(JSC) - JSC::ScopeChain& scopeChain = state->dynamicGlobalObject()->globalScopeChain(); + JSC::ScopeChainNode* scopeChain = state->dynamicGlobalObject()->globalScopeChain(); JSC::UString script(reinterpret_cast_ptr<const UChar*>(scriptSource.data()), scriptSource.length()); JSC::Completion completion = JSC::evaluate(state, scopeChain, JSC::makeSource(script), thisValue); if ((completion.complType() != JSC::ReturnValue) && (completion.complType() != JSC::Normal)) @@ -1485,6 +1487,14 @@ QWebElement QWebElement::enclosingElement(WebCore::Node* node) */ void QWebElement::render(QPainter* painter) { + render(painter, QRect()); +} + +/*! + Render the element into \a painter clipping to \a clip. +*/ +void QWebElement::render(QPainter* painter, const QRect& clip) +{ WebCore::Element* e = m_element; Document* doc = e ? e->document() : 0; if (!doc) @@ -1503,12 +1513,17 @@ void QWebElement::render(QPainter* painter) if (rect.size().isEmpty()) return; + QRect finalClipRect = rect; + if (!clip.isEmpty()) + rect.intersect(clip.translated(rect.location())); + GraphicsContext context(painter); context.save(); context.translate(-rect.x(), -rect.y()); + painter->setClipRect(finalClipRect, Qt::IntersectClip); view->setNodeToDraw(e); - view->paintContents(&context, rect); + view->paintContents(&context, finalClipRect); view->setNodeToDraw(0); context.restore(); } |