WebKit Bugzilla
Attachment 346396 Details for
Bug 188264
: [LFC][Floating] Containing block of a float could push the candidate position beyond the current float.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-188264-20180802112447.patch (text/plain), 3.38 KB, created by
zalan
on 2018-08-02 11:24:48 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
zalan
Created:
2018-08-02 11:24:48 PDT
Size:
3.38 KB
patch
obsolete
>Subversion Revision: 234500 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 0786b04ccc25130daf8c6eadd3016dd7954c2aef..74446726a15e2b7898ae4b9e71ae1e18e2e83ce1 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,23 @@ >+2018-08-02 Zalan Bujtas <zalan@apple.com> >+ >+ [LFC][Floating] Containing block of a float could push the candidate position beyond the current float. >+ https://bugs.webkit.org/show_bug.cgi?id=188264 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ <div id=first style="float: left; width: 100px; height: 10px;"></div> >+ <div id=second style="float: left; width: 10px; height: 10px;"></div> >+ <div style="width: 50px; height: 50px;> >+ <div id=third style="float: left; width: 10px; height: 10px;"></div> >+ </div> >+ In the example above by the time the "third" float comes in, we are already at 110px horizontally. However the containing block of the "third" float forces >+ the candidate position at 0px. In such cases intersecting won't work since the candidate position is beyond the last(second) float (horizontally). >+ We could either keep going back to the previous floats on this vertical position and eventually intersect with "first" or just compare the horizontal >+ positions and ensure that the left/right float is not going to be placed to the left/right of the last float on the current vertical position. >+ >+ * layout/FloatingContext.cpp: >+ (WebCore::Layout::FloatingPair::intersects const): >+ > 2018-08-02 Zalan Bujtas <zalan@apple.com> > > [LFC][Floating] Do not pass formatting root to FloatingContext >diff --git a/Source/WebCore/layout/FloatingContext.cpp b/Source/WebCore/layout/FloatingContext.cpp >index d257aed6192c17a15d77656748db6ebc9874ea6d..036cc1bd200762db7119c1bdd83cc01b9e42f586 100644 >--- a/Source/WebCore/layout/FloatingContext.cpp >+++ b/Source/WebCore/layout/FloatingContext.cpp >@@ -257,13 +257,19 @@ const Display::Box* FloatingPair::right() const > return &m_floats[*m_rightIndex].displayBox(); > } > >-bool FloatingPair::intersects(const Display::Box::Rect& rect) const >+bool FloatingPair::intersects(const Display::Box::Rect& candidateRect) const > { >- auto intersects = [&](const Display::Box* floating, const Display::Box::Rect& rect) { >+ auto intersects = [&](const Display::Box* floating, Float floatingType) { > if (!floating) > return false; > >- return floating->rectWithMargin().intersects(rect); >+ auto marginRect = floating->rectWithMargin(); >+ // Before intersecting, check if the candidate position is too far to the left/right. >+ // The new float's containing block could push the candidate position beyond the current float horizontally. >+ if ((floatingType == Float::Left && candidateRect.left() < marginRect.right()) >+ || (floatingType == Float::Right && candidateRect.right() > marginRect.left())) >+ return true; >+ return marginRect.intersects(candidateRect); > }; > > if (!m_leftIndex && !m_rightIndex) { >@@ -271,10 +277,10 @@ bool FloatingPair::intersects(const Display::Box::Rect& rect) const > return false; > } > >- if (intersects(left(), rect)) >+ if (intersects(left(), Float::Left)) > return true; > >- if (intersects(right(), rect)) >+ if (intersects(right(), Float::Right)) > return true; > > return false;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
koivisto
:
review+
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 188264
: 346396