Changeset 116767 in webkit


Ignore:
Timestamp:
May 11, 2012 7:11:26 AM (12 years ago)
Author:
commit-queue@webkit.org
Message:

Qt support for new layout types.
https://bugs.webkit.org/show_bug.cgi?id=85607

Patch by Allan Sandfeld Jensen <allan.jensen@nokia.com> on 2012-05-11
Reviewed by Simon Hausmann.

Adds similar Qt support to FractionalLayout classes as Qt has for
FloatSomething and IntSomething classes. This means Qt code can stay
unchanged from after the redefinition of Layout classes.

No new functionality. No new tests.

  • Target.pri:
  • platform/FractionalLayoutUnit.h:

(WebCore::operator<<):
(WebCore::operator>>):

  • platform/graphics/FractionalLayoutPoint.h:

(FractionalLayoutPoint):

  • platform/graphics/FractionalLayoutRect.h:

(FractionalLayoutRect):

  • platform/graphics/FractionalLayoutSize.h:

(FractionalLayoutSize):

  • platform/graphics/qt/FractionalLayoutPointQt.cpp: Added.

(WebCore::FractionalLayoutPoint::FractionalLayoutPoint):
(WebCore::FractionalLayoutPoint::operator QPointF):

  • platform/graphics/qt/FractionalLayoutRectQt.cpp: Added.

(WebCore::FractionalLayoutRect::FractionalLayoutRect):
(WebCore::FractionalLayoutRect::operator QRectF):

  • platform/graphics/qt/FractionalLayoutSizeQt.cpp: Added.

(WebCore::FractionalLayoutSize::FractionalLayoutSize):
(WebCore::FractionalLayoutSize::operator QSizeF):

Location:
trunk/Source/WebCore
Files:
3 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r116766 r116767  
     12012-05-11  Allan Sandfeld Jensen  <allan.jensen@nokia.com>
     2
     3        Qt support for new layout types.
     4        https://bugs.webkit.org/show_bug.cgi?id=85607
     5
     6        Reviewed by Simon Hausmann.
     7
     8        Adds similar Qt support to FractionalLayout classes as Qt has for
     9        FloatSomething and IntSomething classes. This means Qt code can stay
     10        unchanged from after the redefinition of Layout classes.
     11
     12        No new functionality. No new tests.
     13
     14        * Target.pri:
     15        * platform/FractionalLayoutUnit.h:
     16        (WebCore::operator<<):
     17        (WebCore::operator>>):
     18        * platform/graphics/FractionalLayoutPoint.h:
     19        (FractionalLayoutPoint):
     20        * platform/graphics/FractionalLayoutRect.h:
     21        (FractionalLayoutRect):
     22        * platform/graphics/FractionalLayoutSize.h:
     23        (FractionalLayoutSize):
     24        * platform/graphics/qt/FractionalLayoutPointQt.cpp: Added.
     25        (WebCore::FractionalLayoutPoint::FractionalLayoutPoint):
     26        (WebCore::FractionalLayoutPoint::operator QPointF):
     27        * platform/graphics/qt/FractionalLayoutRectQt.cpp: Added.
     28        (WebCore::FractionalLayoutRect::FractionalLayoutRect):
     29        (WebCore::FractionalLayoutRect::operator QRectF):
     30        * platform/graphics/qt/FractionalLayoutSizeQt.cpp: Added.
     31        (WebCore::FractionalLayoutSize::FractionalLayoutSize):
     32        (WebCore::FractionalLayoutSize::operator QSizeF):
     33
    1342012-05-11  Allan Sandfeld Jensen  <allan.jensen@nokia.com>
    235
  • trunk/Source/WebCore/Target.pri

    r116690 r116767  
    28572857    platform/graphics/qt/FloatPointQt.cpp \
    28582858    platform/graphics/qt/FloatRectQt.cpp \
     2859    platform/graphics/qt/FractionalLayoutPointQt.cpp \
     2860    platform/graphics/qt/FractionalLayoutRectQt.cpp \
     2861    platform/graphics/qt/FractionalLayoutSizeQt.cpp \
    28592862    platform/graphics/qt/GradientQt.cpp \
    28602863    platform/graphics/qt/GraphicsContextQt.cpp \
  • trunk/Source/WebCore/platform/FractionalLayoutUnit.h

    r116549 r116767  
    3737#include <stdlib.h>
    3838
     39#if PLATFORM(QT)
     40#include <QDataStream>
     41#endif
     42
    3943namespace WebCore {
    4044
     
    591595}
    592596
     597#if PLATFORM(QT)
     598inline QDataStream& operator<<(QDataStream& stream, const FractionalLayoutUnit& value)
     599{
     600    if (kFixedPointDenominator == 1)
     601        stream << value.rawValue();
     602    else
     603        stream << QString::fromLatin1("%1").arg(value.toFloat(), 0, 'f', 2);
     604
     605    return stream;
     606}
     607
     608inline QDataStream& operator>>(QDataStream& stream, FractionalLayoutUnit& value)
     609{
     610    float v;
     611    stream >> v;
     612    value = v;
     613    return stream;
     614}
     615#endif
     616
    593617} // namespace WebCore
    594618
  • trunk/Source/WebCore/platform/graphics/FractionalLayoutPoint.h

    r114470 r116767  
    3535#include "FractionalLayoutSize.h"
    3636#include <wtf/MathExtras.h>
     37
     38#if PLATFORM(QT)
     39#include <qglobal.h>
     40QT_BEGIN_NAMESPACE
     41class QPoint;
     42class QPointF;
     43QT_END_NAMESPACE
     44#endif
    3745
    3846namespace WebCore {
     
    8290        return FractionalLayoutPoint(m_y, m_x);
    8391    }
     92
     93#if PLATFORM(QT)
     94    explicit FractionalLayoutPoint(const QPoint&);
     95    explicit FractionalLayoutPoint(const QPointF&);
     96    operator QPointF() const;
     97#endif
    8498
    8599private:
     
    159173}
    160174
    161 
    162175} // namespace WebCore
    163176
  • trunk/Source/WebCore/platform/graphics/FractionalLayoutRect.h

    r116549 r116767  
    3636#include <wtf/Vector.h>
    3737
     38#if PLATFORM(QT)
     39#include <qglobal.h>
     40QT_BEGIN_NAMESPACE
     41class QRect;
     42class QRectF;
     43QT_END_NAMESPACE
     44#endif
     45
    3846namespace WebCore {
    3947
     
    154162    static FractionalLayoutRect infiniteRect() {return FractionalLayoutRect(FractionalLayoutUnit::min() / 2, FractionalLayoutUnit::min() / 2, FractionalLayoutUnit::max(), FractionalLayoutUnit::max()); }
    155163
     164#if PLATFORM(QT)
     165    explicit FractionalLayoutRect(const QRect&);
     166    explicit FractionalLayoutRect(const QRectF&);
     167    operator QRectF() const;
     168#endif
     169
    156170private:
    157171    FractionalLayoutPoint m_location;
  • trunk/Source/WebCore/platform/graphics/FractionalLayoutSize.h

    r116549 r116767  
    3535#include "FractionalLayoutUnit.h"
    3636#include "IntSize.h"
     37
     38#if PLATFORM(QT)
     39#include <qglobal.h>
     40QT_BEGIN_NAMESPACE
     41class QSize;
     42class QSizeF;
     43QT_END_NAMESPACE
     44#endif
    3745
    3846namespace WebCore {
     
    93101    }
    94102
     103#if PLATFORM(QT)
     104    explicit FractionalLayoutSize(const QSize&);
     105    explicit FractionalLayoutSize(const QSizeF&);
     106    operator QSizeF() const;
     107#endif
     108
    95109private:
    96110    FractionalLayoutUnit m_width, m_height;
Note: See TracChangeset for help on using the changeset viewer.