Bug 188148 - [LFC][Floating] Add basic left/right floating positioning.
Summary: [LFC][Floating] Add basic left/right floating positioning.
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: zalan
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2018-07-29 11:30 PDT by zalan
Modified: 2018-07-31 08:05 PDT (History)
5 users (show)

See Also:


Attachments
Patch (23.91 KB, patch)
2018-07-29 11:59 PDT, zalan
koivisto: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description zalan 2018-07-29 11:30:00 PDT
ssia
Comment 1 zalan 2018-07-29 11:59:30 PDT
Created attachment 346035 [details]
Patch
Comment 2 Antti Koivisto 2018-07-31 06:12:04 PDT
Comment on attachment 346035 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=346035&action=review

> Source/WebCore/layout/FloatingContext.cpp:92
> +class Iterator {
> +public:
> +    Iterator(const LayoutContext&, const FloatingState&);
> +
> +    void set(LayoutUnit verticalPosition);
> +    const FloatingPair& current() const { return m_current; }
> +    LayoutUnit verticalPosition() const { return m_verticalPosition; }
> +    Iterator& operator++();
> +
> +private:
> +    const LayoutContext& m_layoutContext;
> +    const FloatingState& m_floatingState;
> +    FloatingPair m_current;
> +    LayoutUnit m_verticalPosition;
> +};

It would be slightly nicer to give this the full iterator interface (basically add operator== and operator*) so it can be used in range-for loops etc.

> Source/WebCore/layout/FloatingContext.cpp:94
> +
> +

Extra empty line.

> Source/WebCore/layout/FloatingContext.cpp:121
> +    Iterator iterator(layoutContext(), m_floatingState);
> +    // Start with the inner-most floating pair for the initial vertical position.
> +    iterator.set(initialVerticalPosition);

These could be factored to a begin() style function that returns the iterator.
Comment 3 zalan 2018-07-31 08:02:26 PDT
Committed r234423: <https://trac.webkit.org/changeset/234423>
Comment 4 Radar WebKit Bug Importer 2018-07-31 08:03:26 PDT
<rdar://problem/42772230>
Comment 5 zalan 2018-07-31 08:05:02 PDT
(In reply to Antti Koivisto from comment #2)
> Comment on attachment 346035 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=346035&action=review
> 
> > Source/WebCore/layout/FloatingContext.cpp:92
> > +class Iterator {
> > +public:
> > +    Iterator(const LayoutContext&, const FloatingState&);
> > +
> > +    void set(LayoutUnit verticalPosition);
> > +    const FloatingPair& current() const { return m_current; }
> > +    LayoutUnit verticalPosition() const { return m_verticalPosition; }
> > +    Iterator& operator++();
> > +
> > +private:
> > +    const LayoutContext& m_layoutContext;
> > +    const FloatingState& m_floatingState;
> > +    FloatingPair m_current;
> > +    LayoutUnit m_verticalPosition;
> > +};
> 
> It would be slightly nicer to give this the full iterator interface
> (basically add operator== and operator*) so it can be used in range-for
> loops etc.
> 
> > Source/WebCore/layout/FloatingContext.cpp:94
> > +
> > +
> 
> Extra empty line.
> 
> > Source/WebCore/layout/FloatingContext.cpp:121
> > +    Iterator iterator(layoutContext(), m_floatingState);
> > +    // Start with the inner-most floating pair for the initial vertical position.
> > +    iterator.set(initialVerticalPosition);
> 
> These could be factored to a begin() style function that returns the
> iterator.
Good point.
This might get a bit more involved when the iterator gets persistent (to take advantage of the fact that (most of the time)we can just resume it as new floatings are coming in..but for now the simple iterator interface works.
Comment 6 Radar WebKit Bug Importer 2018-07-31 08:05:22 PDT
<rdar://problem/42772336>