Changeset 168598 in webkit


Ignore:
Timestamp:
May 11, 2014 2:42:47 AM (10 years ago)
Author:
Antti Koivisto
Message:

Text with simple line layout not getting pushed below float when there is not enough space for it
https://bugs.webkit.org/show_bug.cgi?id=126991

Reviewed by Andreas Kling.

Source/WebCore:
Tests: fast/text/simple-lines-intruding-wide-float-dynamic.html

fast/text/simple-lines-intruding-wide-float.html

  • rendering/RenderBlockFlow.cpp:

(WebCore::RenderBlockFlow::markLinesDirtyInBlockRange):

Invalidate the line layout path when floats change. We need to check SimpleLineLayout::canUseFor again as
intruding floats may make this flow ineligible to use the path.

  • rendering/RenderBlockFlow.h:

(WebCore::RenderBlockFlow::floatingObjectSet):

  • rendering/SimpleLineLayout.cpp:

(WebCore::SimpleLineLayout::canUseFor):

Test the top positions of all floats for case that would push text below the float instead of just testing
the first line. We may have floats in the middle of the paragraph too.

LayoutTests:

  • fast/text/simple-lines-intruding-wide-float-dynamic-expected.html: Added.
  • fast/text/simple-lines-intruding-wide-float-dynamic.html: Added.
  • fast/text/simple-lines-intruding-wide-float-expected.html: Added.
  • fast/text/simple-lines-intruding-wide-float.html: Added.
Location:
trunk
Files:
4 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r168587 r168598  
     12014-05-11  Antti Koivisto  <antti@apple.com>
     2
     3        Text with simple line layout not getting pushed below float when there is not enough space for it
     4        https://bugs.webkit.org/show_bug.cgi?id=126991
     5
     6        Reviewed by Andreas Kling.
     7
     8        * fast/text/simple-lines-intruding-wide-float-dynamic-expected.html: Added.
     9        * fast/text/simple-lines-intruding-wide-float-dynamic.html: Added.
     10        * fast/text/simple-lines-intruding-wide-float-expected.html: Added.
     11        * fast/text/simple-lines-intruding-wide-float.html: Added.
     12
    1132014-05-10  Alexey Proskuryakov  <ap@apple.com>
    214
  • trunk/Source/WebCore/ChangeLog

    r168596 r168598  
     12014-05-11  Antti Koivisto  <antti@apple.com>
     2
     3        Text with simple line layout not getting pushed below float when there is not enough space for it
     4        https://bugs.webkit.org/show_bug.cgi?id=126991
     5
     6        Reviewed by Andreas Kling.
     7
     8        Tests: fast/text/simple-lines-intruding-wide-float-dynamic.html
     9               fast/text/simple-lines-intruding-wide-float.html
     10
     11        * rendering/RenderBlockFlow.cpp:
     12        (WebCore::RenderBlockFlow::markLinesDirtyInBlockRange):
     13       
     14            Invalidate the line layout path when floats change. We need to check SimpleLineLayout::canUseFor again as
     15            intruding floats may make this flow ineligible to use the path.
     16
     17        * rendering/RenderBlockFlow.h:
     18        (WebCore::RenderBlockFlow::floatingObjectSet):
     19        * rendering/SimpleLineLayout.cpp:
     20        (WebCore::SimpleLineLayout::canUseFor):
     21       
     22            Test the top positions of all floats for case that would push text below the float instead of just testing
     23            the first line. We may have floats in the middle of the paragraph too.
     24
    1252014-05-11  peavo@outlook.com  <peavo@outlook.com>
    226
  • trunk/Source/WebCore/rendering/RenderBlockFlow.cpp

    r168380 r168598  
    28732873        return;
    28742874
     2875    // Floats currently affect the choice whether to use simple line layout path.
     2876    if (m_simpleLineLayout) {
     2877        invalidateLineLayoutPath();
     2878        return;
     2879    }
     2880
    28752881    RootInlineBox* lowestDirtyLine = lastRootBox();
    28762882    RootInlineBox* afterLowest = lowestDirtyLine;
  • trunk/Source/WebCore/rendering/RenderBlockFlow.h

    r168380 r168598  
    291291    void markAllDescendantsWithFloatsForLayout(RenderBox* floatToRemove = nullptr, bool inLayout = true);
    292292    void markSiblingsWithFloatsForLayout(RenderBox* floatToRemove = nullptr);
     293
     294    const FloatingObjectSet* floatingObjectSet() const { return m_floatingObjects ? &m_floatingObjects->set() : nullptr; }
    293295
    294296    LayoutUnit logicalTopForFloat(const FloatingObject* floatingObject) const { return isHorizontalWritingMode() ? floatingObject->y() : floatingObject->x(); }
  • trunk/Source/WebCore/rendering/SimpleLineLayout.cpp

    r168380 r168598  
    163163    if (flow.containsFloats()) {
    164164        // We can't use the code path if any lines would need to be shifted below floats. This is because we don't keep per-line y coordinates.
    165         // It is enough to test the first line width only as currently all floats must be overhanging.
    166         if (textRenderer.minLogicalWidth() > LineWidth(const_cast<RenderBlockFlow&>(flow), false, DoNotIndentText).availableWidth())
    167             return false;
     165        float minimumWidthNeeded = textRenderer.minLogicalWidth();
     166        for (auto& floatRenderer : *flow.floatingObjectSet()) {
     167            ASSERT(floatRenderer);
     168            float availableWidth = flow.availableLogicalWidthForLine(floatRenderer->y(), false);
     169            if (availableWidth < minimumWidthNeeded)
     170                return false;
     171        }
    168172    }
    169173    if (textRenderer.isCombineText() || textRenderer.isCounter() || textRenderer.isQuote() || textRenderer.isTextFragment()
Note: See TracChangeset for help on using the changeset viewer.