Changeset 232876 in webkit


Ignore:
Timestamp:
Jun 15, 2018 9:26:23 AM (6 years ago)
Author:
Alan Bujtas
Message:

[LFC] Fix static position left/top
https://bugs.webkit.org/show_bug.cgi?id=186640

Reviewed by Antti Koivisto.

In visual formatting model, we normally go like [top, left] while LayoutPoint takes [x, y]. Let's make this less error prone.

  • layout/FormattingContext.h:

(WebCore::Layout::FormattingContext::Geometry::Position::operator LayoutPoint const):

  • layout/blockformatting/BlockFormattingContext.h:
  • layout/blockformatting/BlockFormattingContextGeometry.cpp:

(WebCore::Layout::BlockFormattingContext::Geometry::staticPosition):
(WebCore::Layout::BlockFormattingContext::Geometry::inFlowPositionedPosition):

Location:
trunk/Source/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r232874 r232876  
     12018-06-15  Zalan Bujtas  <zalan@apple.com>
     2
     3        [LFC] Fix static position left/top
     4        https://bugs.webkit.org/show_bug.cgi?id=186640
     5
     6        Reviewed by Antti Koivisto.
     7
     8        In visual formatting model, we normally go like [top, left] while LayoutPoint takes [x, y]. Let's make this less error prone.
     9
     10        * layout/FormattingContext.h:
     11        (WebCore::Layout::FormattingContext::Geometry::Position::operator LayoutPoint const):
     12        * layout/blockformatting/BlockFormattingContext.h:
     13        * layout/blockformatting/BlockFormattingContextGeometry.cpp:
     14        (WebCore::Layout::BlockFormattingContext::Geometry::staticPosition):
     15        (WebCore::Layout::BlockFormattingContext::Geometry::inFlowPositionedPosition):
     16
    1172018-06-15  Chris Dumez  <cdumez@apple.com>
    218
  • trunk/Source/WebCore/layout/FormattingContext.h

    r232871 r232876  
    8282    class Geometry {
    8383    public:
     84        struct Position {
     85            // FIXME: Use LayoutUnit<Horizontal> to avoid top/left vs. x/y confusion.
     86            LayoutUnit x; // left
     87            LayoutUnit y; // top
     88            operator LayoutPoint() const { return { x, y }; }
     89        };
     90
    8491        struct WidthAndMargin {
    8592            LayoutUnit width;
  • trunk/Source/WebCore/layout/blockformatting/BlockFormattingContext.h

    r232661 r232876  
    6666        static FormattingContext::Geometry::WidthAndMargin inFlowWidthAndMargin(LayoutContext&, const Box&);
    6767
    68         static LayoutPoint staticPosition(LayoutContext&, const Box&);
    69         static LayoutPoint inFlowPositionedPosition(LayoutContext&, const Box&);
     68        static FormattingContext::Geometry::Position staticPosition(LayoutContext&, const Box&);
     69        static FormattingContext::Geometry::Position inFlowPositionedPosition(LayoutContext&, const Box&);
    7070
    7171    private:
  • trunk/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp

    r232871 r232876  
    263263}
    264264
    265 LayoutPoint BlockFormattingContext::Geometry::staticPosition(LayoutContext& layoutContext, const Box& layoutBox)
     265FormattingContext::Geometry::Position BlockFormattingContext::Geometry::staticPosition(LayoutContext& layoutContext, const Box& layoutBox)
    266266{
    267267    // https://www.w3.org/TR/CSS22/visuren.html#block-formatting
     
    280280    }
    281281    LOG_WITH_STREAM(FormattingContextLayout, stream << "[Position] -> static -> top(" << top << "px) left(" << left << "px) layoutBox(" << &layoutBox << ")");
    282     return { top, left };
    283 }
    284 
    285 LayoutPoint BlockFormattingContext::Geometry::inFlowPositionedPosition(LayoutContext& layoutContext, const Box& layoutBox)
     282    return { left, top };
     283}
     284
     285FormattingContext::Geometry::Position BlockFormattingContext::Geometry::inFlowPositionedPosition(LayoutContext& layoutContext, const Box& layoutBox)
    286286{
    287287    ASSERT(layoutBox.isInFlowPositioned());
     
    358358
    359359    LOG_WITH_STREAM(FormattingContextLayout, stream << "[Position] -> positioned inflow -> top(" << newTopPosition << "px) left(" << newLeftPosition << "px) layoutBox(" << &layoutBox << ")");
    360     return { newTopPosition, newLeftPosition };
     360    return { newLeftPosition, newTopPosition };
    361361}
    362362
Note: See TracChangeset for help on using the changeset viewer.