Changeset 240842 in webkit


Ignore:
Timestamp:
Feb 1, 2019 6:15:09 AM (5 years ago)
Author:
Alan Bujtas
Message:

[LFC] Set intrinsic size on Layout::Replaced
https://bugs.webkit.org/show_bug.cgi?id=194139

Reviewed by Antti Koivisto.

Source/WebCore:

Eventually Layout::Replaced will track intrinsic size internally until then let's query the RenderReplaced.

  • layout/layouttree/LayoutBox.h:

(WebCore::Layout::Box::replaced):

  • layout/layouttree/LayoutReplaced.cpp:

(WebCore::Layout::Replaced::hasIntrinsicWidth const):
(WebCore::Layout::Replaced::hasIntrinsicHeight const):
(WebCore::Layout::Replaced::intrinsicWidth const):
(WebCore::Layout::Replaced::intrinsicHeight const):

  • layout/layouttree/LayoutReplaced.h:

(WebCore::Layout::Replaced::setIntrinsicSize):
(WebCore::Layout::Replaced::setIntrinsicRatio):

  • layout/layouttree/LayoutTreeBuilder.cpp:

(WebCore::Layout::TreeBuilder::createSubTree):

  • rendering/RenderReplaced.h:

Tools:

744

  • LayoutReloaded/misc/LFC-passing-tests.txt:
Location:
trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r240841 r240842  
     12019-02-01  Zalan Bujtas  <zalan@apple.com>
     2
     3        [LFC] Set intrinsic size on Layout::Replaced
     4        https://bugs.webkit.org/show_bug.cgi?id=194139
     5
     6        Reviewed by Antti Koivisto.
     7
     8        Eventually Layout::Replaced will track intrinsic size internally until then let's query the RenderReplaced.
     9
     10        * layout/layouttree/LayoutBox.h:
     11        (WebCore::Layout::Box::replaced):
     12        * layout/layouttree/LayoutReplaced.cpp:
     13        (WebCore::Layout::Replaced::hasIntrinsicWidth const):
     14        (WebCore::Layout::Replaced::hasIntrinsicHeight const):
     15        (WebCore::Layout::Replaced::intrinsicWidth const):
     16        (WebCore::Layout::Replaced::intrinsicHeight const):
     17        * layout/layouttree/LayoutReplaced.h:
     18        (WebCore::Layout::Replaced::setIntrinsicSize):
     19        (WebCore::Layout::Replaced::setIntrinsicRatio):
     20        * layout/layouttree/LayoutTreeBuilder.cpp:
     21        (WebCore::Layout::TreeBuilder::createSubTree):
     22        * rendering/RenderReplaced.h:
     23
    1242019-02-01  Claudio Saavedra  <csaavedra@igalia.com>
    225
  • trunk/Source/WebCore/layout/layouttree/LayoutBox.h

    r240779 r240842  
    132132
    133133    const Replaced* replaced() const { return m_replaced.get(); }
     134    // FIXME: Temporary until after intrinsic size change is tracked by Replaced.
     135    Replaced* replaced() { return m_replaced.get(); }
    134136
    135137    void setParent(Container& parent) { m_parent = &parent; }
     
    148150    Box* m_nextSibling { nullptr };
    149151
    150     std::unique_ptr<const Replaced> m_replaced;
     152    std::unique_ptr<Replaced> m_replaced;
    151153
    152154    unsigned m_baseTypeFlags : 4;
  • trunk/Source/WebCore/layout/layouttree/LayoutReplaced.cpp

    r237321 r240842  
    4545bool Replaced::hasIntrinsicWidth() const
    4646{
    47     return m_layoutBox->style().logicalWidth().isIntrinsic();
     47    return m_intrinsicSize || m_layoutBox->style().logicalWidth().isIntrinsic();
    4848}
    4949
    5050bool Replaced::hasIntrinsicHeight() const
    5151{
    52     return m_layoutBox->style().logicalHeight().isIntrinsic();
     52    return m_intrinsicSize || m_layoutBox->style().logicalHeight().isIntrinsic();
    5353}
    5454
     
    6161{
    6262    ASSERT(hasIntrinsicWidth());
     63    if (m_intrinsicSize)
     64        return m_intrinsicSize->width();
    6365    return m_layoutBox->style().logicalWidth().value();
    6466}
     
    6769{
    6870    ASSERT(hasIntrinsicHeight());
     71    if (m_intrinsicSize)
     72        return m_intrinsicSize->height();
    6973    return m_layoutBox->style().logicalHeight().value();
    7074}
  • trunk/Source/WebCore/layout/layouttree/LayoutReplaced.h

    r237321 r240842  
    2828#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
    2929
     30#include "LayoutSize.h"
    3031#include "LayoutUnit.h"
    3132#include <wtf/IsoMalloc.h>
     
    4445    ~Replaced() = default;
    4546
     47    // FIXME: Temporary until after intrinsic size change is tracked internallys.
     48    void setIntrinsicSize(LayoutSize size) { m_intrinsicSize = size; }
     49    void setIntrinsicRatio(LayoutUnit ratio) { m_intrinsicRatio = ratio; };
     50
    4651    bool hasIntrinsicWidth() const;
    4752    bool hasIntrinsicHeight() const;
     
    5358private:
    5459    WeakPtr<const Box> m_layoutBox;
     60    Optional<LayoutSize> m_intrinsicSize;
     61    Optional<LayoutUnit> m_intrinsicRatio;
    5562};
    5663
  • trunk/Source/WebCore/layout/layouttree/LayoutTreeBuilder.cpp

    r240779 r240842  
    9898            else
    9999                box = std::make_unique<InlineBox>(elementAttributes(renderer), RenderStyle::clone(renderer.style()));
     100            // FIXME: We don't yet support all replaced elements.
     101            if (box->replaced())
     102                box->replaced()->setIntrinsicSize(renderer.intrinsicSize());
    100103        } else if (is<RenderElement>(child)) {
    101104            auto& renderer = downcast<RenderElement>(child);
  • trunk/Source/WebCore/rendering/RenderReplaced.h

    r239427 r240842  
    4141    bool setNeedsLayoutIfNeededAfterIntrinsicSizeChange();
    4242
     43    LayoutSize intrinsicSize() const final { return m_intrinsicSize; }
     44
    4345protected:
    4446    RenderReplaced(Element&, RenderStyle&&);
     
    4850    void layout() override;
    4951
    50     LayoutSize intrinsicSize() const final { return m_intrinsicSize; }
    5152    void computeIntrinsicRatioInformation(FloatSize& intrinsicSize, double& intrinsicRatio) const override;
    5253
  • trunk/Tools/ChangeLog

    r240840 r240842  
     12019-02-01  Zalan Bujtas  <zalan@apple.com>
     2
     3        [LFC] Set intrinsic size on Layout::Replaced
     4        https://bugs.webkit.org/show_bug.cgi?id=194139
     5
     6        Reviewed by Antti Koivisto.
     7
     8        744
     9
     10        * LayoutReloaded/misc/LFC-passing-tests.txt:
     11
    1122019-02-01  Carlos Garcia Campos  <cgarcia@igalia.com>
    213
  • trunk/Tools/LayoutReloaded/misc/LFC-passing-tests.txt

    r240781 r240842  
    416416css2.1/20110323/absolute-non-replaced-width-015.htm
    417417css2.1/20110323/absolute-non-replaced-width-016.htm
    418 css2.1/20110323/absolute-replaced-height-004.htm
    419 css2.1/20110323/absolute-replaced-height-005.htm
    420 css2.1/20110323/absolute-replaced-height-007.htm
    421 css2.1/20110323/absolute-replaced-height-011.htm
    422 css2.1/20110323/absolute-replaced-height-012.htm
    423 css2.1/20110323/absolute-replaced-height-014.htm
    424 css2.1/20110323/absolute-replaced-height-018.htm
    425 css2.1/20110323/absolute-replaced-height-019.htm
    426 css2.1/20110323/absolute-replaced-height-021.htm
    427 css2.1/20110323/absolute-replaced-height-025.htm
    428 css2.1/20110323/absolute-replaced-height-026.htm
    429 css2.1/20110323/block-replaced-height-004.htm
    430 css2.1/20110323/block-replaced-height-005.htm
    431 css2.1/20110323/block-replaced-height-007.htm
    432418css2.1/t0402-c71-fwd-parsing-00-f.html
    433419css2.1/t0402-c71-fwd-parsing-01-f.html
     
    450436css2.1/t0511-c21-pseud-link-03-e.html
    451437css2.1/t0602-c13-inh-underlin-00-e.html
     438css2.1/20110323/absolute-replaced-height-001.htm
     439css2.1/20110323/absolute-replaced-height-002.htm
    452440css2.1/t0603-c11-import-00-b.html
     441css2.1/20110323/absolute-replaced-height-004.htm
     442css2.1/20110323/absolute-replaced-height-005.htm
     443css2.1/20110323/absolute-replaced-height-007.htm
     444css2.1/20110323/absolute-replaced-height-008.htm
     445css2.1/20110323/absolute-replaced-height-009.htm
     446css2.1/20110323/absolute-replaced-height-011.htm
     447css2.1/20110323/absolute-replaced-height-012.htm
     448css2.1/20110323/absolute-replaced-height-014.htm
     449css2.1/20110323/absolute-replaced-height-016.htm
    453450css2.1/t0803-c5502-imrgn-r-00-b-ag.html
     451css2.1/20110323/absolute-replaced-height-018.htm
     452css2.1/20110323/absolute-replaced-height-019.htm
     453css2.1/20110323/absolute-replaced-height-021.htm
     454css2.1/20110323/absolute-replaced-height-022.htm
     455css2.1/20110323/absolute-replaced-height-023.htm
     456css2.1/20110323/absolute-replaced-height-025.htm
     457css2.1/20110323/absolute-replaced-height-026.htm
     458css2.1/20110323/absolute-replaced-height-028.htm
     459css2.1/20110323/absolute-replaced-height-029.htm
     460css2.1/20110323/absolute-replaced-height-030.htm
     461css2.1/20110323/absolute-replaced-height-032.htm
     462css2.1/20110323/absolute-replaced-height-033.htm
     463css2.1/20110323/absolute-replaced-height-035.htm
     464css2.1/20110323/absolute-replaced-height-036.htm
     465css2.1/20110323/absolute-replaced-width-001.htm
     466css2.1/20110323/absolute-replaced-width-008.htm
    454467css2.1/t0803-c5502-mrgn-r-02-c.html
    455468css2.1/t0803-c5502-mrgn-r-03-c.html
     
    464477css2.1/t0804-c5506-ipadn-t-02-b-a.html
    465478css2.1/t0804-c5507-ipadn-r-00-b-ag.html
     479css2.1/20110323/abspos-containing-block-initial-001.htm
     480css2.1/20110323/abspos-containing-block-initial-004a.htm
     481css2.1/20110323/abspos-containing-block-initial-004b.htm
    466482css2.1/t0804-c5507-padn-r-00-c-ag.html
    467483css2.1/t0804-c5507-padn-r-02-f.html
     
    470486css2.1/t0804-c5508-ipadn-b-01-f-a.html
    471487css2.1/t0804-c5508-ipadn-b-02-b-a.html
     488css2.1/20110323/abspos-containing-block-initial-005a.htm
    472489css2.1/t0804-c5509-ipadn-l-00-b-ag.html
     490css2.1/20110323/abspos-containing-block-initial-005c.htm
     491css2.1/20110323/abspos-containing-block-initial-007.htm
     492css2.1/20110323/abspos-containing-block-initial-009b.htm
     493css2.1/20110323/abspos-containing-block-initial-009e.htm
    473494css2.1/t0804-c5509-padn-l-00-b-ag.html
    474495css2.1/t0804-c5509-padn-l-02-f.html
     496css2.1/20110323/at-import-001.htm
     497css2.1/20110323/at-import-002.htm
     498css2.1/20110323/at-import-003.htm
     499css2.1/20110323/at-import-004.htm
     500css2.1/20110323/at-import-005.htm
     501css2.1/20110323/at-import-006.htm
     502css2.1/20110323/at-import-007.htm
     503css2.1/20110323/at-import-009.htm
     504css2.1/20110323/at-import-010.htm
     505css2.1/20110323/at-import-011.htm
    475506css2.1/t0804-c5510-padn-00-b-ag.html
     507css2.1/20110323/background-intrinsic-003.htm
    476508css2.1/t0804-c5510-padn-02-f.html
    477509css2.1/t0805-c5511-brdr-tw-01-b-g.html
     
    482514css2.1/t0805-c5512-brdr-rw-02-b.html
    483515css2.1/t0805-c5512-brdr-rw-03-b.html
     516css2.1/20110323/background-intrinsic-008.htm
     517css2.1/20110323/background-intrinsic-009.htm
     518css2.1/20110323/block-non-replaced-height-001.htm
    484519css2.1/t0805-c5513-brdr-bw-01-b-g.html
    485520css2.1/t0805-c5513-brdr-bw-02-b.html
    486521css2.1/t0805-c5513-brdr-bw-03-b.html
     522css2.1/20110323/block-non-replaced-height-003.htm
    487523css2.1/t0805-c5514-brdr-lw-00-b.html
    488524css2.1/t0805-c5514-brdr-lw-01-b-g.html
     
    497533css2.1/t0805-c5517-ibrdr-s-00-a.html
    498534css2.1/t0805-c5518-brdr-t-00-a.html
     535css2.1/20110323/block-non-replaced-height-007.htm
    499536css2.1/t0805-c5518-ibrdr-t-00-a.html
    500 css2.1/t0805-c5520-brdr-b-00-a.html
    501 css2.1/t0805-c5520-ibrdr-b-00-a.html
    502 css2.1/20110323/abspos-containing-block-initial-001.htm
    503 css2.1/20110323/abspos-containing-block-initial-004a.htm
    504 css2.1/20110323/abspos-containing-block-initial-004b.htm
    505 css2.1/t0805-c5522-brdr-00-b.html
    506 css2.1/20110323/abspos-containing-block-initial-005a.htm
    507 css2.1/20110323/abspos-containing-block-initial-005c.htm
    508 css2.1/20110323/abspos-containing-block-initial-007.htm
    509 css2.1/t0905-c414-flt-00-d.html
    510 css2.1/t0905-c414-flt-01-d-g.html
    511 css2.1/20110323/abspos-containing-block-initial-009b.htm
    512 css2.1/20110323/abspos-containing-block-initial-009e.htm
    513 css2.1/20110323/at-import-001.htm
    514 css2.1/20110323/at-import-002.htm
    515 css2.1/20110323/at-import-003.htm
    516 css2.1/20110323/at-import-004.htm
    517 css2.1/20110323/at-import-005.htm
    518 css2.1/20110323/at-import-006.htm
    519 css2.1/20110323/at-import-007.htm
    520 css2.1/20110323/at-import-009.htm
    521 css2.1/20110323/at-import-010.htm
    522 css2.1/20110323/at-import-011.htm
    523 css2.1/20110323/background-intrinsic-003.htm
    524 css2.1/20110323/background-intrinsic-008.htm
    525 css2.1/20110323/background-intrinsic-009.htm
    526 css2.1/20110323/block-non-replaced-height-001.htm
    527 css2.1/20110323/block-non-replaced-height-003.htm
    528 css2.1/t0905-c5525-fltinln-00-c-ag.html
    529 css2.1/20110323/block-non-replaced-height-007.htm
    530537css2.1/20110323/block-non-replaced-height-009.htm
    531538css2.1/20110323/block-non-replaced-height-011.htm
    532539css2.1/20110323/block-non-replaced-height-013.htm
    533540css2.1/20110323/block-non-replaced-height-015.htm
     541css2.1/t0805-c5520-brdr-b-00-a.html
     542css2.1/t0805-c5520-ibrdr-b-00-a.html
    534543css2.1/20110323/block-non-replaced-width-003.htm
    535544css2.1/20110323/block-non-replaced-width-004.htm
     
    538547css2.1/20110323/block-non-replaced-width-007.htm
    539548css2.1/20110323/block-non-replaced-width-008.htm
     549css2.1/20110323/block-replaced-height-001.htm
     550css2.1/20110323/block-replaced-height-004.htm
     551css2.1/20110323/block-replaced-height-005.htm
     552css2.1/20110323/block-replaced-height-007.htm
     553css2.1/20110323/block-replaced-width-001.htm
     554css2.1/t0805-c5522-brdr-00-b.html
     555css2.1/t0905-c414-flt-00-d.html
     556css2.1/t0905-c414-flt-01-d-g.html
     557css2.1/t0905-c5525-fltinln-00-c-ag.html
    540558css2.1/t1001-abs-pos-cb-01-b.html
    541559css2.1/t1001-abs-pos-cb-02-b.html
     
    647665css2.1/t060403-c21-pseu-id-00-e-i.html
    648666css2.1/t090501-c414-flt-00-d.html
    649 css2.1/t100303-c412-blockw-00-d-ag.html
    650 css2.1/t100801-c548-ln-ht-01-b-ag.html
    651 css2.1/t100801-c548-ln-ht-02-b-ag.html
    652 css2.1/t100801-c548-ln-ht-03-d-ag.html
    653 css2.1/t100801-c548-ln-ht-04-d-ag.html
    654 css2.1/t120401-scope-00-b.html
    655 css2.1/t120401-scope-04-d.html
    656 css2.1/t120403-content-none-00-c.html
    657 css2.1/t120403-display-none-00-c.html
    658 css2.1/t120403-visibility-00-c.html
    659 css2.1/t140201-c532-bgcolor-01-b.html
    660 css2.1/t140201-c533-bgimage-01-b-g.html
    661 css2.1/t140201-c534-bgre-00-b-ag.html
    662 css2.1/t140201-c534-bgre-01-b-ag.html
    663 css2.1/t140201-c534-bgreps-00-c-ag.html
    664 css2.1/t140201-c534-bgreps-01-c-ag.html
    665 css2.1/t140201-c534-bgreps-02-c-ag.html
    666 css2.1/t140201-c534-bgreps-03-c-ag.html
    667 css2.1/t140201-c534-bgreps-04-c-ag.html
    668 css2.1/t140201-c534-bgreps-05-c-ag.html
    669 css2.1/t140201-c535-bg-fixd-00-b-g.html
    670 css2.1/t140201-c536-bgpos-00-b-ag.html
    671 css2.1/t140201-c536-bgpos-01-b-ag.html
    672 css2.1/t140201-c537-bgfxps-00-c-ag.html
    673667css2.1/20110323/clip-001.html
    674668css2.1/20110323/dynamic-top-change-001.htm
    675669css2.1/20110323/dynamic-top-change-004.htm
     670css2.1/t100303-c412-blockw-00-d-ag.html
    676671css2.1/20110323/empty-inline-001.htm
    677672css2.1/20110323/eof-001.htm
     
    689684css2.1/20110323/float-non-replaced-width-005.htm
    690685css2.1/20110323/float-non-replaced-width-006.htm
     686css2.1/t100801-c548-ln-ht-01-b-ag.html
     687css2.1/t100801-c548-ln-ht-02-b-ag.html
     688css2.1/t100801-c548-ln-ht-03-d-ag.html
     689css2.1/t100801-c548-ln-ht-04-d-ag.html
     690css2.1/t120401-scope-00-b.html
    691691css2.1/20110323/float-non-replaced-width-010.htm
     692css2.1/t120401-scope-04-d.html
     693css2.1/t120403-content-none-00-c.html
     694css2.1/t120403-display-none-00-c.html
     695css2.1/t120403-visibility-00-c.html
    692696css2.1/20110323/float-non-replaced-width-012.htm
     697css2.1/20110323/float-replaced-height-001.htm
     698css2.1/t140201-c532-bgcolor-01-b.html
     699css2.1/t140201-c533-bgimage-01-b-g.html
     700css2.1/t140201-c534-bgre-00-b-ag.html
     701css2.1/t140201-c534-bgre-01-b-ag.html
     702css2.1/t140201-c534-bgreps-00-c-ag.html
     703css2.1/t140201-c534-bgreps-01-c-ag.html
     704css2.1/t140201-c534-bgreps-02-c-ag.html
     705css2.1/t140201-c534-bgreps-03-c-ag.html
     706css2.1/t140201-c534-bgreps-04-c-ag.html
     707css2.1/t140201-c534-bgreps-05-c-ag.html
     708css2.1/t140201-c535-bg-fixd-00-b-g.html
     709css2.1/t140201-c536-bgpos-00-b-ag.html
     710css2.1/t140201-c536-bgpos-01-b-ag.html
     711css2.1/t140201-c537-bgfxps-00-c-ag.html
     712css2.1/20110323/float-replaced-height-004.htm
     713css2.1/20110323/float-replaced-height-005.htm
     714css2.1/20110323/float-replaced-height-007.htm
    693715css2.1/20110323/float-replaced-width-001.htm
    694716css2.1/20110323/float-replaced-width-002.htm
     
    696718css2.1/20110323/float-replaced-width-004.htm
    697719css2.1/20110323/float-replaced-width-005.htm
     720css2.1/20110323/float-replaced-width-006.htm
    698721css2.1/20110323/floats-001.html
    699722css2.1/20110323/inline-block-non-replaced-width-001.htm
    700723css2.1/20110323/inline-block-non-replaced-width-002.htm
     724css2.1/20110323/inline-block-replaced-height-001.htm
     725css2.1/20110323/inline-block-replaced-height-002.htm
     726css2.1/20110323/inline-block-replaced-height-004.htm
     727css2.1/20110323/inline-block-replaced-height-005.htm
     728css2.1/20110323/inline-block-replaced-height-007.htm
     729css2.1/20110323/inline-block-replaced-width-001.htm
    701730css2.1/20110323/inline-box-002.htm
     731css2.1/20110323/inline-replaced-height-001.htm
     732css2.1/20110323/inline-replaced-height-002.htm
     733css2.1/20110323/inline-replaced-height-004.htm
     734css2.1/20110323/inline-replaced-height-005.htm
     735css2.1/20110323/inline-replaced-height-007.htm
    702736css2.1/20110323/inline-replaced-width-011.htm
    703737css2.1/20110323/inline-replaced-width-014.htm
Note: See TracChangeset for help on using the changeset viewer.