[M108 Migration]Use container's height to calculate margin top/bottom 28/288428/4
authorBakka Uday Kiran <b.kiran@samsung.com>
Thu, 16 Feb 2023 07:55:09 +0000 (13:25 +0530)
committerBot Blink <blinkbot@samsung.com>
Fri, 17 Feb 2023 22:13:48 +0000 (22:13 +0000)
Some WebKit-based apps expect vertical margins to be calculated
using container's height rather than its width (as stated in
specification). To provide correct layout of those apps, we
allow for non-compliant calculations in compatibility
mode (to be implemented).

Reference: https://review.tizen.org/gerrit/c/282202

Change-Id: I5bffc230b821939c0e89bbb33c7758040ca7bfe9
Signed-off-by: Bakka Uday Kiran <b.kiran@samsung.com>
third_party/blink/renderer/core/layout/layout_box.cc

index f99abf7..25e6776 100644 (file)
@@ -5885,8 +5885,18 @@ void LayoutBox::ComputePositionedLogicalWidthUsing(
   LayoutUnit logical_right_value =
       MinimumValueForLength(logical_right, container_logical_width);
 
+#if BUILDFLAG(IS_TIZEN)
+  // Some apps expect margin top/bottom to be calculated based on container's
+  // height - not width. For compatibility reasons we allow for such behavior
+  // in compatibility mode.
+  const LayoutUnit container_relative_logical_width =
+      RuntimeEnabledFeatures::TizenCompatibilityModeEnabled()
+          ? ContainingBlockLogicalHeightForPositioned(container_block, false)
+          : ContainingBlockLogicalWidthForPositioned(container_block, false);
+#else
   const LayoutUnit container_relative_logical_width =
       ContainingBlockLogicalWidthForPositioned(container_block, false);
+#endif
 
   // If we are using aspect-ratio, the width is effectively not auto.
   bool logical_width_is_auto =
@@ -6307,8 +6317,18 @@ void LayoutBox::ComputePositionedLogicalHeightUsing(
   LayoutUnit logical_height_value;
   LayoutUnit content_logical_height = logical_height - borders_plus_padding;
 
+#if BUILDFLAG(IS_TIZEN)
+  // Some apps expect margin top/bottom to be calculated based on container's
+  // height - not width. For compatibility reasons we allow for such behavior
+  // in compatibility mode.
+  const LayoutUnit container_relative_logical_width =
+      RuntimeEnabledFeatures::TizenCompatibilityModeEnabled()
+          ? ContainingBlockLogicalHeightForPositioned(container_block, false)
+          : ContainingBlockLogicalWidthForPositioned(container_block, false);
+#else
   const LayoutUnit container_relative_logical_width =
       ContainingBlockLogicalWidthForPositioned(container_block, false);
+#endif
 
   LayoutUnit logical_top_value;