Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(635)

Unified Diff: third_party/WebKit/Source/core/layout/ng/ng_constraint_space.cc

Issue 2691093004: Fix orthogonal mode legacy mismatch (Closed)
Patch Set: CR fixes, removed odd IsParallelWritingMode Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/layout/ng/ng_constraint_space.cc
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_constraint_space.cc b/third_party/WebKit/Source/core/layout/ng/ng_constraint_space.cc
index 1e653fc86dbfbda45a474d086023d56cbe90ea6c..40b7ad094bd356e9d6d0583f92d3535c465be507 100644
--- a/third_party/WebKit/Source/core/layout/ng/ng_constraint_space.cc
+++ b/third_party/WebKit/Source/core/layout/ng/ng_constraint_space.cc
@@ -49,16 +49,31 @@ NGConstraintSpace::NGConstraintSpace(
NGConstraintSpace* NGConstraintSpace::CreateFromLayoutObject(
const LayoutBox& box) {
+ auto writing_mode = FromPlatformWritingMode(box.styleRef().getWritingMode());
+ bool parallel_containing_block = IsParallelWritingMode(
+ FromPlatformWritingMode(
+ box.containingBlock()->styleRef().getWritingMode()),
+ writing_mode);
bool fixed_inline = false, fixed_block = false;
- // XXX for orthogonal writing mode this is not right
- LayoutUnit available_logical_width =
- std::max(LayoutUnit(), box.containingBlockLogicalWidthForContent());
+
+ LayoutUnit available_logical_width;
+ if (parallel_containing_block)
+ available_logical_width = box.containingBlockLogicalWidthForContent();
+ else
+ available_logical_width = box.perpendicularContainingBlockLogicalHeight();
+ available_logical_width = std::max(LayoutUnit(), available_logical_width);
+
LayoutUnit available_logical_height;
if (!box.parent()) {
available_logical_height = box.view()->viewLogicalHeightForPercentages();
} else if (box.containingBlock()) {
- available_logical_height =
- box.containingBlock()->availableLogicalHeightForPercentageComputation();
+ if (parallel_containing_block) {
+ available_logical_height =
+ box.containingBlock()
+ ->availableLogicalHeightForPercentageComputation();
+ } else {
+ available_logical_height = box.containingBlockLogicalWidthForContent();
+ }
}
NGLogicalSize percentage_size = {available_logical_width,
available_logical_height};
@@ -80,8 +95,6 @@ NGConstraintSpace* NGConstraintSpace::CreateFromLayoutObject(
bool is_new_fc =
box.isLayoutBlock() && toLayoutBlock(box).createsNewFormattingContext();
- auto writing_mode = FromPlatformWritingMode(box.styleRef().getWritingMode());
-
FloatSize icb_float_size = box.view()->viewportSizeForViewportUnits();
NGPhysicalSize initial_containing_block_size{
LayoutUnit(icb_float_size.width()), LayoutUnit(icb_float_size.height())};

Powered by Google App Engine
This is Rietveld 408576698