Commit 7b99c273 authored by Rob Buis's avatar Rob Buis Committed by Commit Bot

[mathml] Implement baseline adjustment logic

Implement baseline adjustment calculation for the children
in the row algorithm as well as calculating the baseline
adjustment of the row itself.

Bug: 6606
Change-Id: If8ec5f8fed28c6008c23284184e3c7e5bd7cc0e1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2003137
Commit-Queue: Rob Buis <rbuis@igalia.com>
Reviewed-by: default avatarIan Kilpatrick <ikilpatrick@chromium.org>
Cr-Commit-Position: refs/heads/master@{#736163}
parent e74720b3
...@@ -7,9 +7,10 @@ ...@@ -7,9 +7,10 @@
#include "third_party/blink/renderer/core/layout/ng/inline/ng_inline_child_layout_context.h" #include "third_party/blink/renderer/core/layout/ng/inline/ng_inline_child_layout_context.h"
#include "third_party/blink/renderer/core/layout/ng/mathml/ng_math_layout_utils.h" #include "third_party/blink/renderer/core/layout/ng/mathml/ng_math_layout_utils.h"
#include "third_party/blink/renderer/core/layout/ng/ng_block_break_token.h" #include "third_party/blink/renderer/core/layout/ng/ng_block_break_token.h"
#include "third_party/blink/renderer/core/layout/ng/ng_fragment.h" #include "third_party/blink/renderer/core/layout/ng/ng_box_fragment.h"
#include "third_party/blink/renderer/core/layout/ng/ng_length_utils.h" #include "third_party/blink/renderer/core/layout/ng/ng_length_utils.h"
#include "third_party/blink/renderer/core/layout/ng/ng_out_of_flow_layout_part.h" #include "third_party/blink/renderer/core/layout/ng/ng_out_of_flow_layout_part.h"
#include "third_party/blink/renderer/core/layout/ng/ng_physical_box_fragment.h"
#include "third_party/blink/renderer/core/mathml/mathml_element.h" #include "third_party/blink/renderer/core/mathml/mathml_element.h"
namespace blink { namespace blink {
...@@ -63,15 +64,16 @@ void NGMathRowLayoutAlgorithm::LayoutRowItems( ...@@ -63,15 +64,16 @@ void NGMathRowLayoutAlgorithm::LayoutRowItems(
To<NGBlockNode>(child).Layout(child_space, nullptr /* break token */); To<NGBlockNode>(child).Layout(child_space, nullptr /* break token */);
const NGPhysicalContainerFragment& physical_fragment = const NGPhysicalContainerFragment& physical_fragment =
result->PhysicalFragment(); result->PhysicalFragment();
NGFragment fragment(ConstraintSpace().GetWritingMode(), physical_fragment); NGBoxFragment fragment(ConstraintSpace().GetWritingMode(),
ConstraintSpace().Direction(),
To<NGPhysicalBoxFragment>(physical_fragment));
NGBoxStrut margins = NGBoxStrut margins =
ComputeMarginsFor(child_space, child_style, ConstraintSpace()); ComputeMarginsFor(child_space, child_style, ConstraintSpace());
inline_offset += margins.inline_start; inline_offset += margins.inline_start;
// TODO(rbuis): get ascent from physical fragment. Take into account writing LayoutUnit ascent = margins.block_start +
// mode. fragment.Baseline().value_or(fragment.BlockSize());
LayoutUnit ascent;
*max_row_block_baseline = std::max(*max_row_block_baseline, ascent); *max_row_block_baseline = std::max(*max_row_block_baseline, ascent);
// TODO(rbuis): Operators can add lspace and rspace. // TODO(rbuis): Operators can add lspace and rspace.
...@@ -120,7 +122,8 @@ scoped_refptr<const NGLayoutResult> NGMathRowLayoutAlgorithm::Layout() { ...@@ -120,7 +122,8 @@ scoped_refptr<const NGLayoutResult> NGMathRowLayoutAlgorithm::Layout() {
To<NGPhysicalContainerFragment>(*child.fragment), child.offset); To<NGPhysicalContainerFragment>(*child.fragment), child.offset);
} }
// TODO(rbuis): handle baselines. container_builder_.SetBaseline(border_scrollbar_padding_.block_start +
max_row_block_baseline);
auto block_size = ComputeBlockSizeForFragment( auto block_size = ComputeBlockSizeForFragment(
ConstraintSpace(), Style(), border_padding_, ConstraintSpace(), Style(), border_padding_,
......
...@@ -42,8 +42,7 @@ void MathMLSpaceElement::CollectStyleForPresentationAttribute( ...@@ -42,8 +42,7 @@ void MathMLSpaceElement::CollectStyleForPresentationAttribute(
value); value);
} }
if (name == mathml_names::kHeightAttr) { if (name == mathml_names::kHeightAttr) {
AddPropertyToPresentationAttributeStyle( SetInlineStyleProperty(CSSPropertyID::kVerticalAlign, value, false);
style, CSSPropertyID::kVerticalAlign, value);
} }
} else { } else {
MathMLElement::CollectStyleForPresentationAttribute(name, value, style); MathMLElement::CollectStyleForPresentationAttribute(name, value, style);
......
...@@ -1517,7 +1517,6 @@ crbug.com/6606 external/wpt/mathml/presentation-markup/fractions/frac-parameters ...@@ -1517,7 +1517,6 @@ crbug.com/6606 external/wpt/mathml/presentation-markup/fractions/frac-parameters
crbug.com/6606 external/wpt/mathml/presentation-markup/fractions/frac-parameters-gap-004.html [ Failure ] crbug.com/6606 external/wpt/mathml/presentation-markup/fractions/frac-parameters-gap-004.html [ Failure ]
crbug.com/6606 external/wpt/mathml/presentation-markup/fractions/frac-parameters-gap-005.html [ Failure ] crbug.com/6606 external/wpt/mathml/presentation-markup/fractions/frac-parameters-gap-005.html [ Failure ]
crbug.com/6606 external/wpt/mathml/presentation-markup/fractions/frac-parameters-gap-006.html [ Failure ] crbug.com/6606 external/wpt/mathml/presentation-markup/fractions/frac-parameters-gap-006.html [ Failure ]
crbug.com/6606 external/wpt/mathml/presentation-markup/mrow/inferred-mrow-baseline.html [ Failure ]
crbug.com/6606 external/wpt/mathml/presentation-markup/mrow/inferred-mrow-stretchy.html [ Failure ] crbug.com/6606 external/wpt/mathml/presentation-markup/mrow/inferred-mrow-stretchy.html [ Failure ]
crbug.com/6606 external/wpt/mathml/presentation-markup/mrow/legacy-mfenced-element-001.html [ Failure ] crbug.com/6606 external/wpt/mathml/presentation-markup/mrow/legacy-mfenced-element-001.html [ Failure ]
crbug.com/6606 external/wpt/mathml/presentation-markup/mrow/legacy-mrow-like-elements-001.html [ Failure ] crbug.com/6606 external/wpt/mathml/presentation-markup/mrow/legacy-mrow-like-elements-001.html [ Failure ]
...@@ -1533,7 +1532,6 @@ crbug.com/6606 external/wpt/mathml/presentation-markup/radicals/root-parameters- ...@@ -1533,7 +1532,6 @@ crbug.com/6606 external/wpt/mathml/presentation-markup/radicals/root-parameters-
crbug.com/6606 external/wpt/mathml/presentation-markup/scripts/subsup-1.html [ Failure ] crbug.com/6606 external/wpt/mathml/presentation-markup/scripts/subsup-1.html [ Failure ]
crbug.com/6606 external/wpt/mathml/presentation-markup/scripts/subsup-2.html [ Failure ] crbug.com/6606 external/wpt/mathml/presentation-markup/scripts/subsup-2.html [ Failure ]
crbug.com/6606 external/wpt/mathml/presentation-markup/scripts/subsup-3.html [ Failure ] crbug.com/6606 external/wpt/mathml/presentation-markup/scripts/subsup-3.html [ Failure ]
crbug.com/6606 external/wpt/mathml/presentation-markup/scripts/subsup-4.html [ Failure ]
crbug.com/6606 external/wpt/mathml/presentation-markup/scripts/subsup-5.html [ Failure ] crbug.com/6606 external/wpt/mathml/presentation-markup/scripts/subsup-5.html [ Failure ]
crbug.com/6606 external/wpt/mathml/presentation-markup/scripts/subsup-parameters-1.html [ Failure ] crbug.com/6606 external/wpt/mathml/presentation-markup/scripts/subsup-parameters-1.html [ Failure ]
crbug.com/6606 external/wpt/mathml/presentation-markup/scripts/subsup-parameters-2.html [ Failure ] crbug.com/6606 external/wpt/mathml/presentation-markup/scripts/subsup-parameters-2.html [ Failure ]
...@@ -1543,7 +1541,6 @@ crbug.com/6606 external/wpt/mathml/presentation-markup/scripts/underover-paramet ...@@ -1543,7 +1541,6 @@ crbug.com/6606 external/wpt/mathml/presentation-markup/scripts/underover-paramet
crbug.com/6606 external/wpt/mathml/presentation-markup/scripts/underover-parameters-3.html [ Failure ] crbug.com/6606 external/wpt/mathml/presentation-markup/scripts/underover-parameters-3.html [ Failure ]
crbug.com/6606 external/wpt/mathml/presentation-markup/scripts/underover-parameters-4.html [ Failure ] crbug.com/6606 external/wpt/mathml/presentation-markup/scripts/underover-parameters-4.html [ Failure ]
crbug.com/6606 external/wpt/mathml/presentation-markup/spaces/space-1.html [ Failure ] crbug.com/6606 external/wpt/mathml/presentation-markup/spaces/space-1.html [ Failure ]
crbug.com/6606 external/wpt/mathml/presentation-markup/spaces/space-2.html [ Failure ]
crbug.com/6606 external/wpt/mathml/presentation-markup/spaces/space-like-001.html [ Failure ] crbug.com/6606 external/wpt/mathml/presentation-markup/spaces/space-like-001.html [ Failure ]
crbug.com/6606 external/wpt/mathml/presentation-markup/spaces/space-like-002.html [ Failure ] crbug.com/6606 external/wpt/mathml/presentation-markup/spaces/space-like-002.html [ Failure ]
crbug.com/6606 external/wpt/mathml/presentation-markup/spaces/space-like-003.html [ Failure ] crbug.com/6606 external/wpt/mathml/presentation-markup/spaces/space-like-003.html [ Failure ]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment