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 #if ENABLE(ORIENTATION_EVENTS) && ENABLE(DEVICE_ORIENTATION)
     32 #include "qorientationsensor.h"
     33 #endif
     34 #include "qwebelement.h"
     35 #include "wtf/RefPtr.h"
     36 #include "Frame.h"
     37 #include "ViewportArguments.h"
     38 
     39 #if USE(ACCELERATED_COMPOSITING) && USE(TEXTURE_MAPPER)
     40 #include "texmap/TextureMapper.h"
     41 #endif
     42 
     43 
     44 namespace WebCore {
     45     class FrameLoaderClientQt;
     46     class FrameView;
     47     class HTMLFrameOwnerElement;
     48     class Scrollbar;
     49     class TextureMapperContentLayer;
     50 }
     51 class QWebPage;
     52 
     53 class QWebFrameData {
     54 public:
     55     QWebFrameData(WebCore::Page*, WebCore::Frame* parentFrame = 0,
     56                   WebCore::HTMLFrameOwnerElement* = 0,
     57                   const WTF::String& frameName = WTF::String());
     58 
     59     WebCore::KURL url;
     60     WTF::String name;
     61     WebCore::HTMLFrameOwnerElement* ownerElement;
     62     WebCore::Page* page;
     63     RefPtr<WebCore::Frame> frame;
     64     WebCore::FrameLoaderClientQt* frameLoaderClient;
     65 
     66     WTF::String referrer;
     67     bool allowsScrolling;
     68     int marginWidth;
     69     int marginHeight;
     70 };
     71 
     72 class QWebFramePrivate {
     73 public:
     74     QWebFramePrivate()
     75         : q(0)
     76         , horizontalScrollBarPolicy(Qt::ScrollBarAsNeeded)
     77         , verticalScrollBarPolicy(Qt::ScrollBarAsNeeded)
     78         , frameLoaderClient(0)
     79         , frame(0)
     80         , page(0)
     81         , allowsScrolling(true)
     82         , marginWidth(-1)
     83         , marginHeight(-1)
     84 #if USE(ACCELERATED_COMPOSITING) && USE(TEXTURE_MAPPER)
     85         , rootGraphicsLayer(0)
     86 #endif
     87         {}
     88     void init(QWebFrame* qframe, QWebFrameData* frameData);
     89     void setPage(QWebPage*);
     90 
     91     inline QWebFrame *parentFrame() { return qobject_cast<QWebFrame*>(q->parent()); }
     92 
     93     WebCore::Scrollbar* horizontalScrollBar() const;
     94     WebCore::Scrollbar* verticalScrollBar() const;
     95 
     96     static WebCore::Frame* core(const QWebFrame*);
     97     static QWebFrame* kit(const WebCore::Frame*);
     98 
     99     void renderRelativeCoords(WebCore::GraphicsContext*, QFlags<QWebFrame::RenderLayer>, const QRegion& clip);
    100 #if ENABLE(TILED_BACKING_STORE)
    101     void renderFromTiledBackingStore(WebCore::GraphicsContext*, const QRegion& clip);
    102 #endif
    103 
    104 #if USE(ACCELERATED_COMPOSITING) && USE(TEXTURE_MAPPER)
    105     void renderCompositedLayers(WebCore::GraphicsContext*, const WebCore::IntRect& clip);
    106 #endif
    107     void renderFrameExtras(WebCore::GraphicsContext*, QFlags<QWebFrame::RenderLayer>, const QRegion& clip);
    108     void emitUrlChanged();
    109     void _q_orientationChanged();
    110 
    111     QWebFrame *q;
    112     Qt::ScrollBarPolicy horizontalScrollBarPolicy;
    113     Qt::ScrollBarPolicy verticalScrollBarPolicy;
    114     WebCore::FrameLoaderClientQt *frameLoaderClient;
    115     WebCore::Frame *frame;
    116     QWebPage *page;
    117     WebCore::KURL url;
    118 
    119     bool allowsScrolling;
    120     int marginWidth;
    121     int marginHeight;
    122 #if USE(ACCELERATED_COMPOSITING) && USE(TEXTURE_MAPPER)
    123     WebCore::TextureMapperContentLayer* rootGraphicsLayer;
    124     OwnPtr<WebCore::TextureMapper> textureMapper;
    125 #endif
    126 
    127 #if ENABLE(ORIENTATION_EVENTS) && ENABLE(DEVICE_ORIENTATION)
    128     QtMobility::QOrientationSensor m_orientation;
    129 #endif
    130 };
    131 
    132 class QWebHitTestResultPrivate {
    133 public:
    134     QWebHitTestResultPrivate() : isContentEditable(false), isContentSelected(false), isScrollBar(false) {}
    135     QWebHitTestResultPrivate(const WebCore::HitTestResult &hitTest);
    136 
    137     QPoint pos;
    138     QRect boundingRect;
    139     QWebElement enclosingBlock;
    140     QString title;
    141     QString linkText;
    142     QUrl linkUrl;
    143     QString linkTitle;
    144     QPointer<QWebFrame> linkTargetFrame;
    145     QWebElement linkElement;
    146     QString alternateText;
    147     QUrl imageUrl;
    148     QPixmap pixmap;
    149     bool isContentEditable;
    150     bool isContentSelected;
    151     bool isScrollBar;
    152     QPointer<QWebFrame> frame;
    153     RefPtr<WebCore::Node> innerNode;
    154     RefPtr<WebCore::Node> innerNonSharedNode;
    155 };
    156 
    157 #endif
    158