Changeset 73584 in webkit


Ignore:
Timestamp:
Dec 8, 2010 7:10:51 PM (13 years ago)
Author:
commit-queue@webkit.org
Message:

2010-12-08 Qi Zhang <qi.2.zhang@nokia.com>

Reviewed by Kenneth Rohde Christiansen.

[Qt] Support OrientationChange event
https://bugs.webkit.org/show_bug.cgi?id=50685

Get OrientationChange event from qtmobility then send to webkit.

  • Api/qwebframe.cpp: (QWebFrame::orientationChanged): (QWebFrame::QWebFrame):
  • Api/qwebframe.h:
  • Api/qwebframe_p.h:
Location:
trunk/WebKit/qt
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKit/qt/Api/qwebframe.cpp

    r73436 r73584  
    410410}
    411411
     412void QWebFrame::orientationChanged()
     413{
     414#if ENABLE(ORIENTATION_EVENTS) && ENABLE(DEVICE_ORIENTATION)
     415    int orientation;
     416    WebCore::Frame* frame = QWebFramePrivate::core(this);
     417
     418    switch (d->m_orientation.reading()->orientation()) {
     419    case QtMobility::QOrientationReading::TopUp:
     420        orientation = 0;
     421        break;
     422    case QtMobility::QOrientationReading::TopDown:
     423        orientation = 180;
     424        break;
     425    case QtMobility::QOrientationReading::LeftUp:
     426        orientation = -90;
     427        break;
     428    case QtMobility::QOrientationReading::RightUp:
     429        orientation = 90;
     430        break;
     431    case QtMobility::QOrientationReading::FaceUp:
     432    case QtMobility::QOrientationReading::FaceDown:
     433        // WebCore unable to handle it
     434    default:
     435        return;
     436    }
     437    frame->sendOrientationChangeEvent(orientation);
     438#endif
     439}
    412440/*!
    413441    \class QWebFrame
     
    484512        d->frame->loader()->load(request, frameData->name, false);
    485513    }
     514#if ENABLE(ORIENTATION_EVENTS) && ENABLE(DEVICE_ORIENTATION)
     515    connect(&d->m_orientation, SIGNAL(readingChanged()), this, SLOT(orientationChanged()));
     516    d->m_orientation.start();
     517#endif
    486518}
    487519
     
    492524    d->page = parent->d->page;
    493525    d->init(this, frameData);
     526#if ENABLE(ORIENTATION_EVENTS) && ENABLE(DEVICE_ORIENTATION)
     527    connect(&d->m_orientation, SIGNAL(readingChanged()), this, SLOT(orientationChanged()));
     528    d->m_orientation.start();
     529#endif
    494530}
    495531
  • trunk/WebKit/qt/Api/qwebframe.h

    r70487 r73584  
    206206#endif
    207207
     208private Q_SLOTS:
     209    void orientationChanged();
     210
    208211Q_SIGNALS:
    209212    void javaScriptWindowObjectCleared();
  • trunk/WebKit/qt/Api/qwebframe_p.h

    r72055 r73584  
    2929#include "KURL.h"
    3030#include "PlatformString.h"
     31#if ENABLE(ORIENTATION_EVENTS) && ENABLE(DEVICE_ORIENTATION)
     32#include "qorientationsensor.h"
     33#endif
    3134#include "qwebelement.h"
    3235#include "wtf/RefPtr.h"
     
    3740#include "texmap/TextureMapper.h"
    3841#endif
     42
    3943
    4044namespace WebCore {
     
    115119    OwnPtr<WebCore::TextureMapper> textureMapper;
    116120#endif
     121
     122#if ENABLE(ORIENTATION_EVENTS) && ENABLE(DEVICE_ORIENTATION)
     123    QtMobility::QOrientationSensor m_orientation;
     124#endif
    117125};
    118126
  • trunk/WebKit/qt/ChangeLog

    r73535 r73584  
     12010-12-08  Qi Zhang  <qi.2.zhang@nokia.com>
     2
     3        Reviewed by Kenneth Rohde Christiansen.
     4
     5        [Qt] Support OrientationChange event
     6        https://bugs.webkit.org/show_bug.cgi?id=50685
     7
     8        Get OrientationChange event from qtmobility then send to webkit.
     9
     10        * Api/qwebframe.cpp:
     11        (QWebFrame::orientationChanged):
     12        (QWebFrame::QWebFrame):
     13        * Api/qwebframe.h:
     14        * Api/qwebframe_p.h:
     15
    1162010-12-07  Brian Weinstein  <bweinstein@apple.com>
    217
Note: See TracChangeset for help on using the changeset viewer.