Home | History | Annotate | Download | only in Api
      1 /*
      2     Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
      3     Copyright (C) 2007 Staikos Computing Services Inc.
      4 
      5     This library is free software; you can redistribute it and/or
      6     modify it under the terms of the GNU Library General Public
      7     License as published by the Free Software Foundation; either
      8     version 2 of the License, or (at your option) any later version.
      9 
     10     This library is distributed in the hope that it will be useful,
     11     but WITHOUT ANY WARRANTY; without even the implied warranty of
     12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     13     Library General Public License for more details.
     14 
     15     You should have received a copy of the GNU Library General Public License
     16     along with this library; see the file COPYING.LIB.  If not, write to
     17     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
     18     Boston, MA 02110-1301, USA.
     19 */
     20 
     21 #ifndef QWEBFRAME_P_H
     22 #define QWEBFRAME_P_H
     23 
     24 #include "qwebframe.h"
     25 #include "qwebpage_p.h"
     26 
     27 #include "EventHandler.h"
     28 #include "GraphicsContext.h"
     29 #include "KURL.h"
     30 #include "PlatformString.h"
     31 #include "qwebelement.h"
     32 #include "wtf/RefPtr.h"
     33 #include "Frame.h"
     34 
     35 namespace WebCore {
     36     class FrameLoaderClientQt;
     37     class FrameView;
     38     class HTMLFrameOwnerElement;
     39     class Scrollbar;
     40 }
     41 class QWebPage;
     42 
     43 class QWebFrameData {
     44 public:
     45     QWebFrameData(WebCore::Page*, WebCore::Frame* parentFrame = 0,
     46                   WebCore::HTMLFrameOwnerElement* = 0,
     47                   const WebCore::String& frameName = WebCore::String());
     48 
     49     WebCore::KURL url;
     50     WebCore::String name;
     51     WebCore::HTMLFrameOwnerElement* ownerElement;
     52     WebCore::Page* page;
     53     RefPtr<WebCore::Frame> frame;
     54     WebCore::FrameLoaderClientQt* frameLoaderClient;
     55 
     56     WebCore::String referrer;
     57     bool allowsScrolling;
     58     int marginWidth;
     59     int marginHeight;
     60 };
     61 
     62 class QWebFramePrivate {
     63 public:
     64     QWebFramePrivate()
     65         : q(0)
     66         , horizontalScrollBarPolicy(Qt::ScrollBarAsNeeded)
     67         , verticalScrollBarPolicy(Qt::ScrollBarAsNeeded)
     68         , frameLoaderClient(0)
     69         , frame(0)
     70         , page(0)
     71         , allowsScrolling(true)
     72         , marginWidth(-1)
     73         , marginHeight(-1)
     74         {}
     75     void init(QWebFrame* qframe, QWebFrameData* frameData);
     76 
     77     inline QWebFrame *parentFrame() { return qobject_cast<QWebFrame*>(q->parent()); }
     78 
     79     WebCore::Scrollbar* horizontalScrollBar() const;
     80     WebCore::Scrollbar* verticalScrollBar() const;
     81 
     82     static WebCore::Frame* core(QWebFrame*);
     83     static QWebFrame* kit(WebCore::Frame*);
     84 
     85     void renderRelativeCoords(WebCore::GraphicsContext*, QWebFrame::RenderLayer, const QRegion& clip);
     86     void renderContentsLayerAbsoluteCoords(WebCore::GraphicsContext*, const QRegion& clip);
     87 
     88     bool scrollOverflow(int dx, int dy);
     89 
     90     QWebFrame *q;
     91     Qt::ScrollBarPolicy horizontalScrollBarPolicy;
     92     Qt::ScrollBarPolicy verticalScrollBarPolicy;
     93     WebCore::FrameLoaderClientQt *frameLoaderClient;
     94     WebCore::Frame *frame;
     95     QWebPage *page;
     96 
     97     bool allowsScrolling;
     98     int marginWidth;
     99     int marginHeight;
    100 };
    101 
    102 class QWebHitTestResultPrivate {
    103 public:
    104     QWebHitTestResultPrivate() : isContentEditable(false), isContentSelected(false), isScrollBar(false) {}
    105     QWebHitTestResultPrivate(const WebCore::HitTestResult &hitTest);
    106 
    107     QPoint pos;
    108     QRect boundingRect;
    109     QWebElement enclosingBlock;
    110     QString title;
    111     QString linkText;
    112     QUrl linkUrl;
    113     QString linkTitle;
    114     QPointer<QWebFrame> linkTargetFrame;
    115     QWebElement linkElement;
    116     QString alternateText;
    117     QUrl imageUrl;
    118     QPixmap pixmap;
    119     bool isContentEditable;
    120     bool isContentSelected;
    121     bool isScrollBar;
    122     QPointer<QWebFrame> frame;
    123     RefPtr<WebCore::Node> innerNode;
    124     RefPtr<WebCore::Node> innerNonSharedNode;
    125 };
    126 
    127 #endif
    128