⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 276503 in webkit


Ignore:
Timestamp:
Apr 23, 2021, 10:04:53 AM (5 years ago)
Author:
Russell Epstein
Message:

Apply patch. rdar://problem/76963029

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/safari-611-branch/Source/WebCore/layout/inlineformatting/InlineContentBreaker.cpp

    r270878 r276503  
    8888}
    8989
    90 static inline bool isWrappingAllowed(const RenderStyle& style)
     90static inline bool isWrappingAllowed(const InlineItem& inlineItem)
    9191{
    9292    // Do not try to wrap overflown 'pre' and 'no-wrap' content to next line.
    93     return style.whiteSpace() != WhiteSpace::Pre && style.whiteSpace() != WhiteSpace::NoWrap;
     93    auto& styleToUse = inlineItem.isBox() ? inlineItem.layoutBox().parent().style() : inlineItem.layoutBox().style();
     94    return styleToUse.whiteSpace() != WhiteSpace::Pre && styleToUse.whiteSpace() != WhiteSpace::NoWrap;
    9495}
    9596
     
    103104    ASSERT(!runList.isEmpty());
    104105    auto lastItemIndex = runList.size() - 1;
    105     return isWrappingAllowed(runList[lastItemIndex].inlineItem.style()) ? makeOptional(lastItemIndex) : WTF::nullopt;
     106    return isWrappingAllowed(runList[lastItemIndex].inlineItem) ? makeOptional(lastItemIndex) : WTF::nullopt;
    106107}
    107108
     
    227228        // While the inline-block has pre-wrap which allows wrapping, the content lives in a nowrap context.
    228229        if (lastInlineItem.isBox() || lastInlineItem.isInlineBoxStart() || lastInlineItem.isInlineBoxEnd())
    229             return isWrappingAllowed(lastInlineItem.layoutBox().parent().style());
     230            return isWrappingAllowed(lastInlineItem);
    230231        if (lastInlineItem.isText()) {
    231232            if (runs.size() == 1) {
    232233                // Fast path for the most common case of an individual text item.
    233                 return isWrappingAllowed(lastInlineItem.layoutBox().style());
     234                return isWrappingAllowed(lastInlineItem);
    234235            }
    235236            for (auto& run : WTF::makeReversedRange(runs)) {
    236237                auto& inlineItem = run.inlineItem;
    237238                if (inlineItem.isInlineBoxStart() || inlineItem.isInlineBoxStart())
    238                     return isWrappingAllowed(inlineItem.layoutBox().parent().style());
     239                    return isWrappingAllowed(inlineItem);
    239240                ASSERT(!inlineItem.isBox());
    240241            }
    241242            // This must be a set of individual text runs. We could just check the last item.
    242             return isWrappingAllowed(lastInlineItem.layoutBox().style());
     243            return isWrappingAllowed(lastInlineItem);
    243244        }
    244245        ASSERT_NOT_REACHED();
     
    262263        }
    263264        // Check if this text run needs to stay on the current line. 
    264         return isWrappingAllowed(run.inlineItem.style());
     265        return isWrappingAllowed(run.inlineItem);
    265266    };
    266267
Note: See TracChangeset for help on using the changeset viewer.