/* Copyright (C) 2008 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 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 "qwebframe.h" #include "qwebpage.h" #include "qwebpage_p.h" #include "qwebframe_p.h" #include "DocumentLoader.h" #include "FocusController.h" #include "FrameLoaderClientQt.h" #include "Frame.h" #include "FrameTree.h" #include "FrameView.h" #include "IconDatabase.h" #include "Page.h" #include "PutPropertySlot.h" #include "ResourceRequest.h" #include "RenderView.h" #include "SelectionController.h" #include "Scrollbar.h" #include "PrintContext.h" #include "SubstituteData.h" #include "markup.h" #include "RenderTreeAsText.h" #include "Element.h" #include "Document.h" #include "DragData.h" #include "RenderView.h" #include "GraphicsContext.h" #include "PlatformMouseEvent.h" #include "PlatformWheelEvent.h" #include "GraphicsContext.h" #include "HitTestResult.h" #include "runtime.h" #include "runtime_object.h" #include "runtime_root.h" #include "JSDOMWindow.h" #include "qt_instance.h" #include "ScriptController.h" #include "JSDOMBinding.h" #include "ExecState.h" #include "JSLock.h" #include "JSObject.h" #include "qt_runtime.h" #include "wtf/HashMap.h" #include #include #include #include #if QT_VERSION >= 0x040400 #include #else #include "qwebnetworkinterface.h" #endif #include #include using namespace WebCore; // from text/qfont.cpp QT_BEGIN_NAMESPACE extern Q_GUI_EXPORT int qt_defaultDpi(); QT_END_NAMESPACE void QWebFramePrivate::init(QWebFrame *qframe, WebCore::Page *webcorePage, QWebFrameData *frameData) { q = qframe; allowsScrolling = frameData->allowsScrolling; marginWidth = frameData->marginWidth; marginHeight = frameData->marginHeight; frameLoaderClient = new FrameLoaderClientQt(); RefPtr newFrame = Frame::create(webcorePage, frameData->ownerElement, frameLoaderClient); frame = newFrame.get(); if (frameData->ownerElement) frame->ref(); // balanced by adoptRef in FrameLoaderClientQt::createFrame frameLoaderClient->setFrame(qframe, frame); frame->init(); } WebCore::Scrollbar* QWebFramePrivate::horizontalScrollBar() const { if (!frame->view()) return 0; return frame->view()->horizontalScrollbar(); } WebCore::Scrollbar* QWebFramePrivate::verticalScrollBar() const { if (!frame->view()) return 0; return frame->view()->verticalScrollbar(); } void QWebFramePrivate::updateBackground() { WebCore::FrameView *view = frame->view(); if (!view) return; QBrush brush = page->palette().brush(QPalette::Background); if (brush.style() == Qt::SolidPattern) { view->setBaseBackgroundColor(brush.color()); if (!brush.color().alpha()) view->setTransparent(true); } } /*! \class QWebFrame \since 4.4 \brief The QWebFrame class represents a frame in a web page. QWebFrame represents a frame inside a web page. Each QWebPage object contains at least one frame, the main frame, obtained using QWebPage::mainFrame(). Additional frames will be created for HTML \c{} or \c{