/* 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 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 "qwebsecurityorigin.h" #include "qwebsecurityorigin_p.h" #include "DocumentLoader.h" #include "FocusController.h" #include "FrameLoaderClientQt.h" #include "Frame.h" #include "FrameTree.h" #include "FrameView.h" #include "IconDatabase.h" #include "InspectorController.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 "CallFrame.h" #include "JSDOMBinding.h" #include "JSDOMWindow.h" #include "JSLock.h" #include "JSObject.h" #include "qt_instance.h" #include "qt_runtime.h" #include "runtime.h" #include "runtime_object.h" #include "runtime_root.h" #include "ScriptController.h" #include "ScriptSourceCode.h" #include "ScriptValue.h" #include "wtf/HashMap.h" #include #include #include #include #include #if QT_VERSION >= 0x040400 #include #else #include "qwebnetworkinterface.h" #endif #include #include #include "HTMLMetaElement.h" #include "NodeList.h" using namespace WebCore; // from text/qfont.cpp QT_BEGIN_NAMESPACE extern Q_GUI_EXPORT int qt_defaultDpi(); QT_END_NAMESPACE void QWEBKIT_EXPORT qt_drt_setJavaScriptProfilingEnabled(QWebFrame* qframe, bool enabled) { Frame* frame = QWebFramePrivate::core(qframe); InspectorController* controller = frame->page()->inspectorController(); if (!controller) return; if (enabled) controller->enableProfiler(); else controller->disableProfiler(); } 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(); frameLoaderClient->setFrame(qframe, frame); // FIXME: All of the below should probably be moved over into WebCore frame->tree()->setName(frameData->name); if (QWebFrame* _parentFrame = parentFrame()) QWebFramePrivate::core(_parentFrame)->tree()->appendChild(frame); // balanced by adoptRef in FrameLoaderClientQt::createFrame if (frameData->ownerElement) frame->ref(); 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(); } /*! \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{