Changeset 89945 in webkit


Ignore:
Timestamp:
Jun 28, 2011 11:31:19 AM (13 years ago)
Author:
leviw@chromium.org
Message:

2011-06-28 Levi Weintraub <leviw@chromium.org>

Reviewed by Darin Adler.

Create intermediate classes as a path towards getting off of pixel offsets
https://bugs.webkit.org/show_bug.cgi?id=61896

Creating three intermediate typedefs to aid in moving layout and hit testing from integers
to floats. We'll transition the render tree over to these intermediate types and add
infrastructure to support the new types behind USE(FLOAT_LAYOUT_OFFSETS). This allows the ultimate
changeover to be easier.

Switching LayoutState over to this abstraction to verify it works correctly.

No new tests since this is creating a new abstraction, not changing current behavior.

  • GNUmakefile.list.am:
  • WebCore.gypi:
  • WebCore.pro:
  • WebCore.vcproj/WebCore.vcproj:
  • WebCore.xcodeproj/project.pbxproj:
  • rendering/LayoutState.cpp: (WebCore::LayoutState::LayoutState): (WebCore::LayoutState::pageLogicalOffset): (WebCore::LayoutState::addForcedColumnBreak):
  • rendering/LayoutState.h:
  • rendering/LayoutTypes.h: Added.
Location:
trunk/Source/WebCore
Files:
1 added
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r89942 r89945  
     12011-06-28  Levi Weintraub  <leviw@chromium.org>
     2
     3        Reviewed by Darin Adler.
     4
     5        Create intermediate classes as a path towards getting off of pixel offsets
     6        https://bugs.webkit.org/show_bug.cgi?id=61896
     7
     8        Creating three intermediate typedefs to aid in moving layout and hit testing from integers
     9        to floats. We'll transition the render tree over to these intermediate types and add
     10        infrastructure to support the new types behind USE(FLOAT_LAYOUT_OFFSETS). This allows the ultimate
     11        changeover to be easier.
     12
     13        Switching LayoutState over to this abstraction to verify it works correctly.
     14
     15        No new tests since this is creating a new abstraction, not changing current behavior.
     16
     17        * GNUmakefile.list.am:
     18        * WebCore.gypi:
     19        * WebCore.pro:
     20        * WebCore.vcproj/WebCore.vcproj:
     21        * WebCore.xcodeproj/project.pbxproj:
     22        * rendering/LayoutState.cpp:
     23        (WebCore::LayoutState::LayoutState):
     24        (WebCore::LayoutState::pageLogicalOffset):
     25        (WebCore::LayoutState::addForcedColumnBreak):
     26        * rendering/LayoutState.h:
     27        * rendering/LayoutTypes.h: Added.
     28
    1292011-06-28  Jeff Miller  <jeffm@apple.com>
    230
  • trunk/Source/WebCore/GNUmakefile.list.am

    r89937 r89945  
    29082908        Source/WebCore/rendering/LayoutState.cpp \
    29092909        Source/WebCore/rendering/LayoutState.h \
     2910        Source/WebCore/rendering/LayoutTypes.h \
    29102911        Source/WebCore/rendering/OverlapTestRequestClient.h \
    29112912        Source/WebCore/rendering/PaintInfo.h \
  • trunk/Source/WebCore/WebCore.gypi

    r89851 r89945  
    967967            'rendering/InlineTextBox.h',
    968968            'rendering/LayoutState.h',
     969            'rendering/LayoutTypes.h',
    969970            'rendering/OverlapTestRequestClient.h',
    970971            'rendering/PaintInfo.h',
  • trunk/Source/WebCore/WebCore.pro

    r89833 r89945  
    21332133    rendering/InlineTextBox.h \
    21342134    rendering/LayoutState.h \
     2135    rendering/LayoutTypes.h \
    21352136    rendering/mathml/RenderMathMLBlock.h \
    21362137    rendering/mathml/RenderMathMLFenced.h \
  • trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj

    r89942 r89945  
    3361933619                        </File>
    3362033620                        <File
     33621                                RelativePath="..\rendering\LayoutTypes.h"
     33622                                >
     33623                        </File>
     33624                        <File
    3362133625                                RelativePath="..\rendering\PaintInfo.h"
    3362233626                                >
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r89851 r89945  
    47734773                B8DBDB4D130B0F8A00F5CDB1 /* SpellingCorrectionCommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B8DBDB49130B0F8A00F5CDB1 /* SpellingCorrectionCommand.cpp */; };
    47744774                B8DBDB4E130B0F8A00F5CDB1 /* SpellingCorrectionCommand.h in Headers */ = {isa = PBXBuildFile; fileRef = B8DBDB4A130B0F8A00F5CDB1 /* SpellingCorrectionCommand.h */; };
     4775                BACF290113B2A0D500781F90 /* LayoutTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = BACF290013B2A0D500781F90 /* LayoutTypes.h */; settings = {ATTRIBUTES = (Private, ); }; };
    47754776                BC00F0040E0A185500FD04E3 /* DOMFile.h in Headers */ = {isa = PBXBuildFile; fileRef = BC00EFFE0E0A185500FD04E3 /* DOMFile.h */; };
    47764777                BC00F0050E0A185500FD04E3 /* DOMFile.mm in Sources */ = {isa = PBXBuildFile; fileRef = BC00EFFF0E0A185500FD04E3 /* DOMFile.mm */; };
     
    1137611377                B8DBDB49130B0F8A00F5CDB1 /* SpellingCorrectionCommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SpellingCorrectionCommand.cpp; sourceTree = "<group>"; };
    1137711378                B8DBDB4A130B0F8A00F5CDB1 /* SpellingCorrectionCommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SpellingCorrectionCommand.h; sourceTree = "<group>"; };
     11379                BACF290013B2A0D500781F90 /* LayoutTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LayoutTypes.h; sourceTree = "<group>"; };
    1137811380                BC00EFFE0E0A185500FD04E3 /* DOMFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMFile.h; sourceTree = "<group>"; };
    1137911381                BC00EFFF0E0A185500FD04E3 /* DOMFile.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DOMFile.mm; sourceTree = "<group>"; };
     
    1930819310                                2D9066040BE141D400956998 /* LayoutState.cpp */,
    1930919311                                2D9066050BE141D400956998 /* LayoutState.h */,
     19312                                BACF290013B2A0D500781F90 /* LayoutTypes.h */,
    1931019313                                3774ABA30FA21EB400AD7DE9 /* OverlapTestRequestClient.h */,
    1931119314                                0885067D11DA045B00182B98 /* PaintInfo.h */,
     
    2307823081                                B1AD4E7D13A12A7200846B27 /* CueParserPrivate.h in Headers */,
    2307923082                                97B1F02F13B025D200F5103F /* SharedBufferChunkReader.h in Headers */,
     23083                                BACF290113B2A0D500781F90 /* LayoutTypes.h in Headers */,
    2308023084                                43B9336913B261B1004584BF /* SVGAnimatedPointList.h in Headers */,
    2308123085                                43A625F813B3304000AC94B8 /* SVGAnimatedColor.h in Headers */,
  • trunk/Source/WebCore/rendering/LayoutState.cpp

    r76726 r89945  
    3535namespace WebCore {
    3636
    37 LayoutState::LayoutState(LayoutState* prev, RenderBox* renderer, const IntSize& offset, int pageLogicalHeight, bool pageLogicalHeightChanged, ColumnInfo* columnInfo)
     37LayoutState::LayoutState(LayoutState* prev, RenderBox* renderer, const LayoutSize& offset, LayoutUnit pageLogicalHeight, bool pageLogicalHeightChanged, ColumnInfo* columnInfo)
    3838    : m_columnInfo(columnInfo)
    3939    , m_next(prev)
     
    4848        // FIXME: This doesn't work correctly with transforms.
    4949        FloatPoint fixedOffset = renderer->view()->localToAbsolute(FloatPoint(), true);
    50         m_paintOffset = IntSize(fixedOffset.x(), fixedOffset.y()) + offset;
     50        m_paintOffset = LayoutSize(fixedOffset.x(), fixedOffset.y()) + offset;
    5151    } else
    5252        m_paintOffset = prev->m_paintOffset + offset;
     
    7070    if (renderer->hasOverflowClip()) {
    7171        RenderLayer* layer = renderer->layer();
    72         IntRect clipRect(toPoint(m_paintOffset) + renderer->view()->layoutDelta(), layer->size());
     72        LayoutRect clipRect(toPoint(m_paintOffset) + renderer->view()->layoutDelta(), layer->size());
    7373        if (m_clipped)
    7474            m_clipRect.intersect(clipRect);
     
    8585    if (pageLogicalHeight || m_columnInfo) {
    8686        m_pageLogicalHeight = pageLogicalHeight;
    87         m_pageOffset = IntSize(m_layoutOffset.width() + renderer->borderLeft() + renderer->paddingLeft(),
     87        m_pageOffset = LayoutSize(m_layoutOffset.width() + renderer->borderLeft() + renderer->paddingLeft(),
    8888                               m_layoutOffset.height() + renderer->borderTop() + renderer->paddingTop());
    8989        m_pageLogicalHeightChanged = pageLogicalHeightChanged;
     
    119119    RenderObject* container = root->container();
    120120    FloatPoint absContentPoint = container->localToAbsolute(FloatPoint(), false, true);
    121     m_paintOffset = IntSize(absContentPoint.x(), absContentPoint.y());
     121    m_paintOffset = LayoutSize(absContentPoint.x(), absContentPoint.y());
    122122
    123123    if (container->hasOverflowClip()) {
    124124        RenderLayer* layer = toRenderBoxModelObject(container)->layer();
    125125        m_clipped = true;
    126         m_clipRect = IntRect(toPoint(m_paintOffset), layer->size());
     126        m_clipRect = LayoutRect(toPoint(m_paintOffset), layer->size());
    127127        m_paintOffset -= layer->scrolledContentOffset();
    128128    }
     
    163163}
    164164
    165 int LayoutState::pageLogicalOffset(int childLogicalOffset) const
     165LayoutUnit LayoutState::pageLogicalOffset(LayoutUnit childLogicalOffset) const
    166166{
    167167    return m_layoutOffset.height() + childLogicalOffset - m_pageOffset.height();
    168168}
    169169
    170 void LayoutState::addForcedColumnBreak(int childLogicalOffset)
     170void LayoutState::addForcedColumnBreak(LayoutUnit childLogicalOffset)
    171171{
    172172    if (!m_columnInfo || m_columnInfo->columnHeight())
  • trunk/Source/WebCore/rendering/LayoutState.h

    r76726 r89945  
    2727#define LayoutState_h
    2828
    29 #include "IntRect.h"
    30 #include "IntSize.h"
     29#include "LayoutTypes.h"
    3130#include <wtf/Noncopyable.h>
    3231
     
    5352    }
    5453
    55     LayoutState(LayoutState*, RenderBox*, const IntSize& offset, int pageHeight, bool pageHeightChanged, ColumnInfo*);
     54    LayoutState(LayoutState*, RenderBox*, const LayoutSize& offset, LayoutUnit pageHeight, bool pageHeightChanged, ColumnInfo*);
    5655    LayoutState(RenderObject*);
    5756
     
    7069    // The page logical offset is the object's offset from the top of the page in the page progression
    7170    // direction (so an x-offset in vertical text and a y-offset for horizontal text).
    72     int pageLogicalOffset(int childLogicalOffset) const;
     71    LayoutUnit pageLogicalOffset(LayoutUnit childLogicalOffset) const;
    7372
    74     void addForcedColumnBreak(int childLogicalOffset);
     73    void addForcedColumnBreak(LayoutUnit childLogicalOffset);
    7574   
    7675    bool pageLogicalHeight() const { return m_pageLogicalHeight; }
     
    8382public:
    8483    bool m_clipped;
    85     IntRect m_clipRect;
    86     IntSize m_paintOffset; // x/y offset from container.  Includes relative positioning and scroll offsets.
    87     IntSize m_layoutOffset; // x/y offset from container.  Does not include relative positioning or scroll offsets.
    88     IntSize m_layoutDelta; // Transient offset from the final position of the object
    89                            // used to ensure that repaints happen in the correct place.
    90                            // This is a total delta accumulated from the root.
     84    LayoutRect m_clipRect;
     85   
     86    // x/y offset from container. Includes relative positioning and scroll offsets.
     87    LayoutSize m_paintOffset;
     88    // x/y offset from container. Does not include relative positioning or scroll offsets.
     89    LayoutSize m_layoutOffset;
     90    // Transient offset from the final position of the object
     91    // used to ensure that repaints happen in the correct place.
     92    // This is a total delta accumulated from the root.
     93    LayoutSize m_layoutDelta;
    9194
    92     int m_pageLogicalHeight; // The current page height for the pagination model that encloses us.
    93     bool m_pageLogicalHeightChanged; // If our page height has changed, this will force all blocks to relayout.
    94     IntSize m_pageOffset; // The offset of the start of the first page in the nearest enclosing pagination model.
    95     ColumnInfo* m_columnInfo; // If the enclosing pagination model is a column model, then this will store column information for easy retrieval/manipulation.
     95    // The current page height for the pagination model that encloses us.
     96    LayoutUnit m_pageLogicalHeight;
     97    // If our page height has changed, this will force all blocks to relayout.
     98    bool m_pageLogicalHeightChanged;
     99    // The offset of the start of the first page in the nearest enclosing pagination model.
     100    LayoutSize m_pageOffset;
     101    // If the enclosing pagination model is a column model, then this will store column information for easy retrieval/manipulation.
     102    ColumnInfo* m_columnInfo;
    96103
    97104    LayoutState* m_next;
Note: See TracChangeset for help on using the changeset viewer.