Changeset 200220 in webkit


Ignore:
Timestamp:
Apr 28, 2016 6:11:17 PM (8 years ago)
Author:
Alan Bujtas
Message:

Content disappears on mouse over.
https://bugs.webkit.org/show_bug.cgi?id=157073
<rdar://problem/24389168>

Reviewed by Simon Fraser.

When a redundant inlinebox is found after constructing the line, we remove it from the tree.
The remove operation marks the ancestor tree dirty (and this newly constructed line is supposed to be clean).
This patch resets this dirty flag on the boxes all the way up to the rootlinebox.
Previously we only cleared the rootinlinebox and we ended up with dirty inlineflowboxes.

Source/WebCore:

Test: fast/text/text-node-remains-dirty-after-calling-surroundContents.html

  • rendering/BidiRun.h:

(WebCore::BidiRun::setBox):

  • rendering/RenderBlockFlow.h:
  • rendering/RenderBlockLineLayout.cpp:

(WebCore::RenderBlockFlow::constructLine):
(WebCore::RenderBlockFlow::removeLineBoxIfNeeded):
(WebCore::RenderBlockFlow::computeBlockDirectionPositionsForLine):

  • rendering/RenderBox.cpp:

(WebCore::RenderBox::positionLineBox): Deleted.

  • rendering/RenderText.cpp:

(WebCore::RenderText::setText):
(WebCore::RenderText::positionLineBox): Deleted.

LayoutTests:

  • fast/text/text-node-remains-dirty-after-calling-surroundContents-expected.html: Added.
  • fast/text/text-node-remains-dirty-after-calling-surroundContents.html: Added.
Location:
trunk
Files:
2 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r200216 r200220  
     12016-04-28  Zalan Bujtas  <zalan@apple.com>
     2
     3        Content disappears on mouse over.
     4        https://bugs.webkit.org/show_bug.cgi?id=157073
     5        <rdar://problem/24389168>
     6
     7        Reviewed by Simon Fraser.
     8
     9        When a redundant inlinebox is found after constructing the line, we remove it from the tree.
     10        The remove operation marks the ancestor tree dirty (and this newly constructed line is supposed to be clean).
     11        This patch resets this dirty flag on the boxes all the way up to the rootlinebox.
     12        Previously we only cleared the rootinlinebox and we ended up with dirty inlineflowboxes.
     13
     14        * fast/text/text-node-remains-dirty-after-calling-surroundContents-expected.html: Added.
     15        * fast/text/text-node-remains-dirty-after-calling-surroundContents.html: Added.
     16
    1172016-04-27  Brent Fulgham  <bfulgham@apple.com>
    218
  • trunk/Source/WebCore/ChangeLog

    r200219 r200220  
     12016-04-28  Zalan Bujtas  <zalan@apple.com>
     2
     3        Content disappears on mouse over.
     4        https://bugs.webkit.org/show_bug.cgi?id=157073
     5        <rdar://problem/24389168>
     6
     7        Reviewed by Simon Fraser.
     8
     9        When a redundant inlinebox is found after constructing the line, we remove it from the tree.
     10        The remove operation marks the ancestor tree dirty (and this newly constructed line is supposed to be clean).
     11        This patch resets this dirty flag on the boxes all the way up to the rootlinebox.
     12        Previously we only cleared the rootinlinebox and we ended up with dirty inlineflowboxes.
     13
     14        Test: fast/text/text-node-remains-dirty-after-calling-surroundContents.html
     15
     16        * rendering/BidiRun.h:
     17        (WebCore::BidiRun::setBox):
     18        * rendering/RenderBlockFlow.h:
     19        * rendering/RenderBlockLineLayout.cpp:
     20        (WebCore::RenderBlockFlow::constructLine):
     21        (WebCore::RenderBlockFlow::removeLineBoxIfNeeded):
     22        (WebCore::RenderBlockFlow::computeBlockDirectionPositionsForLine):
     23        * rendering/RenderBox.cpp:
     24        (WebCore::RenderBox::positionLineBox): Deleted.
     25        * rendering/RenderText.cpp:
     26        (WebCore::RenderText::setText):
     27        (WebCore::RenderText::positionLineBox): Deleted.
     28
    1292016-04-28  John Wilander  <wilander@apple.com>
    230
  • trunk/Source/WebCore/rendering/BidiRun.h

    r198970 r200220  
    4242    RenderObject& renderer() { return m_renderer; }
    4343    InlineBox* box() { return m_box; }
    44     void setBox(InlineBox& box) { m_box = &box; }
     44    void setBox(InlineBox* box) { m_box = box; }
    4545
    4646private:
  • trunk/Source/WebCore/rendering/RenderBlockFlow.h

    r200162 r200220  
    605605    void setSelectionState(SelectionState) final;
    606606
     607    void removeInlineBox(BidiRun&, const RootInlineBox&) const;
     608
    607609public:
    608610    // FIXME-BLOCKFLOW: These can be made protected again once all callers have been moved here.
  • trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp

    r199149 r200220  
    294294
    295295        InlineBox* box = createInlineBoxForRenderer(&r->renderer(), false, isOnlyRun);
    296         r->setBox(*box);
     296        r->setBox(box);
    297297
    298298        if (!rootHasSelectedChildren && box->renderer().selectionState() != RenderObject::SelectionNone)
     
    951951}
    952952
     953void RenderBlockFlow::removeInlineBox(BidiRun& run, const RootInlineBox& rootLineBox) const
     954{
     955    auto* inlineBox = run.box();
     956#if !ASSERT_DISABLED
     957    auto* inlineParent = inlineBox->parent();
     958    while (inlineParent && inlineParent != &rootLineBox) {
     959        ASSERT(!inlineParent->isDirty());
     960        inlineParent = inlineParent->parent();
     961    }
     962    ASSERT(!rootLineBox.isDirty());
     963#endif
     964    auto* parent = inlineBox->parent();
     965    inlineBox->removeFromParent();
     966
     967    auto& renderer = run.renderer();
     968    if (is<RenderText>(renderer))
     969        downcast<RenderText>(renderer).removeTextBox(downcast<InlineTextBox>(*inlineBox));
     970    delete inlineBox;
     971    run.setBox(nullptr);
     972    // removeFromParent() unnecessarily dirties the ancestor subtree.
     973    auto* ancestor = parent;
     974    while (ancestor) {
     975        ancestor->markDirty(false);
     976        if (ancestor == &rootLineBox)
     977            break;
     978        ancestor = ancestor->parent();
     979    }
     980}
     981
    953982void RenderBlockFlow::computeBlockDirectionPositionsForLine(RootInlineBox* lineBox, BidiRun* firstRun, GlyphOverflowAndFallbackFontsMap& textBoxDataMap,
    954983                                                        VerticalPositionCache& verticalPositionCache)
     
    957986
    958987    // Now make sure we place replaced render objects correctly.
    959     for (BidiRun* run = firstRun; run; run = run->next()) {
     988    for (auto* run = firstRun; run; run = run->next()) {
    960989        ASSERT(run->box());
    961990        if (!run->box())
    962991            continue; // Skip runs with no line boxes.
    963992
    964         InlineBox& box = *run->box();
    965 
    966993        // Align positioned boxes with the top of the line box.  This is
    967994        // a reasonable approximation of an appropriate y position.
    968         if (run->renderer().isOutOfFlowPositioned())
    969             box.setLogicalTop(logicalHeight());
     995        auto& renderer = run->renderer();
     996        if (renderer.isOutOfFlowPositioned())
     997            run->box()->setLogicalTop(logicalHeight());
    970998
    971999        // Position is used to properly position both replaced elements and
    9721000        // to update the static normal flow x/y of positioned elements.
    973         if (is<RenderText>(run->renderer()))
    974             downcast<RenderText>(run->renderer()).positionLineBox(downcast<InlineTextBox>(box));
    975         else if (is<RenderBox>(run->renderer()))
    976             downcast<RenderBox>(run->renderer()).positionLineBox(downcast<InlineElementBox>(box));
    977         else if (is<RenderLineBreak>(run->renderer()))
    978             downcast<RenderLineBreak>(run->renderer()).replaceInlineBoxWrapper(downcast<InlineElementBox>(box));
    979     }
    980     // Positioned objects and zero-length text nodes destroy their boxes in
    981     // position(), which unnecessarily dirties the line.
    982     lineBox->markDirty(false);
     1001        bool inlineBoxIsRedundant = false;
     1002        if (is<RenderText>(renderer)) {
     1003            auto& inlineTextBox = downcast<InlineTextBox>(*run->box());
     1004            downcast<RenderText>(renderer).positionLineBox(inlineTextBox);
     1005            inlineBoxIsRedundant = !inlineTextBox.len();
     1006        } else if (is<RenderBox>(renderer)) {
     1007            downcast<RenderBox>(renderer).positionLineBox(downcast<InlineElementBox>(*run->box()));
     1008            inlineBoxIsRedundant = renderer.isOutOfFlowPositioned();
     1009        } else if (is<RenderLineBreak>(renderer))
     1010            downcast<RenderLineBreak>(renderer).replaceInlineBoxWrapper(downcast<InlineElementBox>(*run->box()));
     1011        // Check if we need to keep this box on the line at all.
     1012        if (inlineBoxIsRedundant)
     1013            removeInlineBox(*run, *lineBox);
     1014    }
    9831015}
    9841016
  • trunk/Source/WebCore/rendering/RenderBox.cpp

    r200116 r200220  
    21582158                setChildNeedsLayout(MarkOnlyThis); // Just mark the positioned object as needing layout, so it will update its position properly.
    21592159        }
    2160 
    2161         // Nuke the box.
    2162         box.removeFromParent();
    2163         delete &box;
    21642160        return;
    21652161    }
  • trunk/Source/WebCore/rendering/RenderText.cpp

    r199777 r200220  
    12691269void RenderText::positionLineBox(InlineTextBox& textBox)
    12701270{
    1271     // FIXME: should not be needed!!!
    1272     if (!textBox.len()) {
    1273         // We want the box to be destroyed.
    1274         textBox.removeFromParent();
    1275         m_lineBoxes.remove(textBox);
    1276         delete &textBox;
     1271    if (!textBox.len())
    12771272        return;
    1278     }
    1279 
    12801273    m_containsReversedText |= !textBox.isLeftToRightDirection();
    12811274}
Note: See TracChangeset for help on using the changeset viewer.