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

Changeset 268806 in webkit


Ignore:
Timestamp:
Oct 21, 2020, 11:07:09 AM (6 years ago)
Author:
Antti Koivisto
Message:

[LFC][Integration] Use LineLayout::containing() in more places
https://bugs.webkit.org/show_bug.cgi?id=218029

Reviewed by Zalan Bujtas.

  • layout/integration/LayoutIntegrationRunIterator.cpp:

(WebCore::LayoutIntegration::firstTextRunFor):
(WebCore::LayoutIntegration::runFor):
(WebCore::LayoutIntegration::lineLayoutSystemFlowForRenderer): Deleted.

  • rendering/RenderText.cpp:

(WebCore::RenderText::usesComplexLineLayoutPath const):
(WebCore::RenderText::layoutFormattingContextLineLayout const): Deleted.

  • rendering/RenderText.h:
Location:
trunk/Source/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r268805 r268806  
     12020-10-21  Antti Koivisto  <antti@apple.com>
     2
     3        [LFC][Integration] Use LineLayout::containing() in more places
     4        https://bugs.webkit.org/show_bug.cgi?id=218029
     5
     6        Reviewed by Zalan Bujtas.
     7
     8        * layout/integration/LayoutIntegrationRunIterator.cpp:
     9        (WebCore::LayoutIntegration::firstTextRunFor):
     10        (WebCore::LayoutIntegration::runFor):
     11        (WebCore::LayoutIntegration::lineLayoutSystemFlowForRenderer): Deleted.
     12        * rendering/RenderText.cpp:
     13        (WebCore::RenderText::usesComplexLineLayoutPath const):
     14        (WebCore::RenderText::layoutFormattingContextLineLayout const): Deleted.
     15        * rendering/RenderText.h:
     16
    1172020-10-21  Youenn Fablet  <youenn@apple.com>
    218
  • trunk/Source/WebCore/layout/integration/LayoutIntegrationRunIterator.cpp

    r268329 r268806  
    161161}
    162162
    163 #if ENABLE(LAYOUT_FORMATTING_CONTEXT)
    164 static const RenderBlockFlow* lineLayoutSystemFlowForRenderer(const RenderObject& renderer)
    165 {
    166     // In currently supported cases the renderer is always direct child of the flow.
    167     if (!is<RenderBlockFlow>(renderer.parent()))
    168         return nullptr;
    169     return downcast<RenderBlockFlow>(renderer.parent());
    170 }
    171 #endif
    172 
    173163TextRunIterator firstTextRunFor(const RenderText& text)
    174164{
    175165#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
    176     if (auto* flow = lineLayoutSystemFlowForRenderer(text)) {
    177         if (auto* layoutFormattingContextLineLayout = flow->layoutFormattingContextLineLayout())
    178             return layoutFormattingContextLineLayout->textRunsFor(text);
    179     }
     166    if (auto* lineLayout = LineLayout::containing(text))
     167        return lineLayout->textRunsFor(text);
    180168#endif
    181169
     
    202190}
    203191
    204 RunIterator runFor(const RenderLineBreak& renderElement)
    205 {
    206 #if ENABLE(LAYOUT_FORMATTING_CONTEXT)
    207     if (auto* flow = lineLayoutSystemFlowForRenderer(renderElement)) {
    208         if (auto* layoutFormattingContextLineLayout = flow->layoutFormattingContextLineLayout())
    209             return layoutFormattingContextLineLayout->runFor(renderElement);
    210     }
    211 #endif
    212     return { RunIteratorLegacyPath(renderElement.inlineBoxWrapper()) };
    213 }
    214 
    215 RunIterator runFor(const RenderBox& renderElement)
    216 {
    217 #if ENABLE(LAYOUT_FORMATTING_CONTEXT)
    218     if (auto* flow = lineLayoutSystemFlowForRenderer(renderElement)) {
    219         if (auto* layoutFormattingContextLineLayout = flow->layoutFormattingContextLineLayout())
    220             return layoutFormattingContextLineLayout->runFor(renderElement);
    221     }
    222 #endif
    223     return { RunIteratorLegacyPath(renderElement.inlineBoxWrapper()) };
     192RunIterator runFor(const RenderLineBreak& renderer)
     193{
     194#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
     195    if (auto* lineLayout = LineLayout::containing(renderer))
     196        return lineLayout->runFor(renderer);
     197#endif
     198    return { RunIteratorLegacyPath(renderer.inlineBoxWrapper()) };
     199}
     200
     201RunIterator runFor(const RenderBox& renderer)
     202{
     203#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
     204    if (auto* lineLayout = LineLayout::containing(renderer))
     205        return lineLayout->runFor(renderer);
     206#endif
     207    return { RunIteratorLegacyPath(renderer.inlineBoxWrapper()) };
    224208}
    225209
  • trunk/Source/WebCore/rendering/RenderText.cpp

    r268195 r268806  
    3939#include "InlineTextBox.h"
    4040#include "LayoutIntegrationLineIterator.h"
     41#include "LayoutIntegrationLineLayout.h"
    4142#include "LayoutIntegrationRunIterator.h"
    4243#include "Range.h"
     
    14651466}
    14661467
     1468bool RenderText::usesComplexLineLayoutPath() const
     1469{
    14671470#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
    1468 const LayoutIntegration::LineLayout* RenderText::layoutFormattingContextLineLayout() const
    1469 {
    1470     if (!is<RenderBlockFlow>(*parent()))
    1471         return nullptr;
    1472     return downcast<RenderBlockFlow>(*parent()).layoutFormattingContextLineLayout();
    1473 }
     1471    return !LayoutIntegration::LineLayout::containing(*this);
     1472#else
     1473    return true;
    14741474#endif
    1475 
    1476 bool RenderText::usesComplexLineLayoutPath() const
    1477 {
    1478 #if ENABLE(LAYOUT_FORMATTING_CONTEXT)
    1479     if (layoutFormattingContextLineLayout())
    1480         return false;
    1481 #endif
    1482     return true;
    14831475}
    14841476
  • trunk/Source/WebCore/rendering/RenderText.h

    r267565 r268806  
    169169
    170170    void ensureLineBoxes();
    171 #if ENABLE(LAYOUT_FORMATTING_CONTEXT)
    172     const LayoutIntegration::LineLayout* layoutFormattingContextLineLayout() const;
    173 #endif
    174171    bool usesComplexLineLayoutPath() const;
    175172
Note: See TracChangeset for help on using the changeset viewer.