[webkit-changes] [WebKit/WebKit] 97d4de: Refactor MathML padding/border handling

Frédéric Wang noreply at github.com
Tue Oct 8 02:04:46 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 97d4de776b5b9d02ab766ef3df769127c4b1c810
      https://github.com/WebKit/WebKit/commit/97d4de776b5b9d02ab766ef3df769127c4b1c810
  Author: Frédéric Wang <fwang at igalia.com>
  Date:   2024-10-08 (Tue, 08 Oct 2024)

  Changed paths:
    M Source/WebCore/rendering/mathml/RenderMathMLBlock.cpp
    M Source/WebCore/rendering/mathml/RenderMathMLBlock.h
    M Source/WebCore/rendering/mathml/RenderMathMLFraction.cpp
    M Source/WebCore/rendering/mathml/RenderMathMLMath.cpp
    M Source/WebCore/rendering/mathml/RenderMathMLMenclose.cpp
    M Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp
    M Source/WebCore/rendering/mathml/RenderMathMLPadded.cpp
    M Source/WebCore/rendering/mathml/RenderMathMLRoot.cpp
    M Source/WebCore/rendering/mathml/RenderMathMLRow.cpp
    M Source/WebCore/rendering/mathml/RenderMathMLRow.h
    M Source/WebCore/rendering/mathml/RenderMathMLScripts.cpp
    M Source/WebCore/rendering/mathml/RenderMathMLSpace.cpp
    M Source/WebCore/rendering/mathml/RenderMathMLToken.cpp
    M Source/WebCore/rendering/mathml/RenderMathMLUnderOver.cpp

  Log Message:
  -----------
  Refactor MathML padding/border handling
https://bugs.webkit.org/show_bug.cgi?id=280261

Reviewed by Rob Buis.

MathML width/height is applied after the math layout to obtain the
content box and before the inclusion of border/padding. In order to
facilitate the implementation of width/height on MathML elements, this
patch moves the incluson of padding/border at the end of math layout.
In addition, the helper function RenderMathMLRow::shiftRowItems() is
moved to the parent class RenderMathMLBlock and renamed
shiftInFlowChildren() so that it can be used in various places,
including for taking into account padding/border. There should be no
behavior changes.

    * Source/WebCore/rendering/mathml/RenderMathMLBlock.cpp:
    (WebCore::RenderMathMLBlock::shiftInFlowChildren): Renamed from RenderMathMLRow::shiftRowItems().
    (WebCore::RenderMathMLBlock::adjustPreferredLogicalWidthsForBorderAndPadding): New method to add border/padding to preferred widths.
    (WebCore::RenderMathMLBlock::adjustLayoutForBorderAndPadding): Ditto for layout.
    * Source/WebCore/rendering/mathml/RenderMathMLBlock.h: Declare new methods.
    * Source/WebCore/rendering/mathml/RenderMathMLFraction.cpp:
    (WebCore::RenderMathMLFraction::computePreferredLogicalWidths): Only consider border/padding at the end.
    (WebCore::RenderMathMLFraction::horizontalOffset const): Don't consider border/padding in this method.
    (WebCore::RenderMathMLFraction::fractionAscent const): Ditto.
    (WebCore::RenderMathMLFraction::layoutBlock): Only consider border/padding at the end.
    (WebCore::RenderMathMLFraction::paint): Add border/padding removed from fractionAscent().
    (WebCore::RenderMathMLFraction::firstLineBaseline const):
    * Source/WebCore/rendering/mathml/RenderMathMLMath.cpp:
    (WebCore::RenderMathMLMath::layoutBlock): s/shiftRowItems/shiftInFlowChildren/
    * Source/WebCore/rendering/mathml/RenderMathMLMenclose.cpp:
    (WebCore::RenderMathMLMenclose::computePreferredLogicalWidths): Only consider border/padding at the end.
    (WebCore::RenderMathMLMenclose::layoutBlock): Ditto and also s/shiftRowItems/shiftInFlowChildren/
    * Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp:
    (WebCore::RenderMathMLOperator::layoutBlock): Directly new shiftInFlowChildren method.
    * Source/WebCore/rendering/mathml/RenderMathMLPadded.cpp:
    (WebCore::RenderMathMLPadded::computePreferredLogicalWidths): Only consider border/padding at the end.
    (WebCore::RenderMathMLPadded::layoutBlock): Ditto and also s/shiftRowItems/shiftInFlowChildren/
    * Source/WebCore/rendering/mathml/RenderMathMLRoot.cpp:
    (WebCore::RenderMathMLRoot::computePreferredLogicalWidths): Only consider border/padding at the end.
    (WebCore::RenderMathMLRoot::layoutBlock): Ditto.
    * Source/WebCore/rendering/mathml/RenderMathMLRow.cpp:
    (WebCore::RenderMathMLRow::computePreferredLogicalWidths): Ditto.
    (WebCore::RenderMathMLRow::layoutBlock): Ditto and also s/shiftRowItems/shiftInFlowChildren/
    (WebCore::RenderMathMLRow::shiftRowItems): Deleted.
    * Source/WebCore/rendering/mathml/RenderMathMLRow.h: Remove declaration.
    * Source/WebCore/rendering/mathml/RenderMathMLScripts.cpp:
    (WebCore::RenderMathMLScripts::computePreferredLogicalWidths): Only consider border/padding at the end.
    (WebCore::RenderMathMLScripts::layoutBlock): Ditto.
    * Source/WebCore/rendering/mathml/RenderMathMLSpace.cpp:
    (WebCore::RenderMathMLSpace::computePreferredLogicalWidths): Ditto.
    * Source/WebCore/rendering/mathml/RenderMathMLToken.cpp:
    (WebCore::RenderMathMLToken::computePreferredLogicalWidths): Ditto.
    (WebCore::RenderMathMLToken::layoutBlock): Ditto.
    * Source/WebCore/rendering/mathml/RenderMathMLUnderOver.cpp:
    (WebCore::RenderMathMLUnderOver::computePreferredLogicalWidths): Ditto.
    (WebCore::RenderMathMLUnderOver::horizontalOffset const): Don't consider border/padding in this method.
    (WebCore::RenderMathMLUnderOver::layoutBlock): Only consider border/padding at the end.

Canonical link: https://commits.webkit.org/284819@main



To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications


More information about the webkit-changes mailing list