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

Side by Side Diff: third_party/WebKit/Source/core/layout/ng/ng_block_node.cc

Issue 2709103010: Flip vertical-rl coordinates for Legacy compat (Closed)
Patch Set: Created 3 years, 9 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/layout/ng/ng_block_node.h" 5 #include "core/layout/ng/ng_block_node.h"
6 6
7 #include "core/layout/LayoutBlockFlow.h" 7 #include "core/layout/LayoutBlockFlow.h"
8 #include "core/layout/api/LineLayoutAPIShim.h" 8 #include "core/layout/api/LineLayoutAPIShim.h"
9 #include "core/layout/line/InlineIterator.h" 9 #include "core/layout/line/InlineIterator.h"
10 #include "core/layout/ng/layout_ng_block_flow.h" 10 #include "core/layout/ng/layout_ng_block_flow.h"
(...skipping 14 matching lines...) Expand all
25 namespace { 25 namespace {
26 26
27 // Copies data back to the legacy layout tree for a given child fragment. 27 // Copies data back to the legacy layout tree for a given child fragment.
28 void FragmentPositionUpdated(const NGPhysicalFragment& fragment) { 28 void FragmentPositionUpdated(const NGPhysicalFragment& fragment) {
29 LayoutBox* layout_box = toLayoutBox(fragment.GetLayoutObject()); 29 LayoutBox* layout_box = toLayoutBox(fragment.GetLayoutObject());
30 if (!layout_box) 30 if (!layout_box)
31 return; 31 return;
32 32
33 DCHECK(layout_box->parent()) << "Should be called on children only."; 33 DCHECK(layout_box->parent()) << "Should be called on children only.";
34 34
35 layout_box->setX(fragment.LeftOffset()); 35 // LegacyLayout flips vertical-rl horizontal coordinates before paint.
36 // NGLayout flips X location for LegacyLayout compatibility.
37 LayoutBlock* containing_block = layout_box->containingBlock();
38 if (containing_block->styleRef().isFlippedBlocksWritingMode()) {
39 LayoutUnit container_width = containing_block->logicalHeight();
cbiesinger 2017/02/24 21:48:10 I'd do size().width() instead of logicalHeight() s
atotic 2017/02/24 22:41:15 done
40 layout_box->setX(container_width - fragment.LeftOffset() -
41 fragment.Width());
42 } else {
43 layout_box->setX(fragment.LeftOffset());
44 }
36 layout_box->setY(fragment.TopOffset()); 45 layout_box->setY(fragment.TopOffset());
37 } 46 }
38 47
39 // Similar to FragmentPositionUpdated but for floats. 48 // Similar to FragmentPositionUpdated but for floats.
40 // - Updates layout object's geometric information. 49 // - Updates layout object's geometric information.
41 // - Creates legacy FloatingObject and attached it to the provided parent. 50 // - Creates legacy FloatingObject and attached it to the provided parent.
42 void FloatingObjectPositionedUpdated(NGFloatingObject* ng_floating_object, 51 void FloatingObjectPositionedUpdated(NGFloatingObject* ng_floating_object,
43 LayoutBox* parent) { 52 LayoutBox* parent) {
44 NGPhysicalBoxFragment* box_fragment = 53 NGPhysicalBoxFragment* box_fragment =
45 toNGPhysicalBoxFragment(ng_floating_object->fragment.get()); 54 toNGPhysicalBoxFragment(ng_floating_object->fragment.get());
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 // Save static position for legacy AbsPos layout. 369 // Save static position for legacy AbsPos layout.
361 void NGBlockNode::SaveStaticOffsetForLegacy(const NGLogicalOffset& offset) { 370 void NGBlockNode::SaveStaticOffsetForLegacy(const NGLogicalOffset& offset) {
362 DCHECK(layout_box_); 371 DCHECK(layout_box_);
363 DCHECK(layout_box_->isOutOfFlowPositioned()); 372 DCHECK(layout_box_->isOutOfFlowPositioned());
364 DCHECK(layout_box_->layer()); 373 DCHECK(layout_box_->layer());
365 layout_box_->layer()->setStaticBlockPosition(offset.block_offset); 374 layout_box_->layer()->setStaticBlockPosition(offset.block_offset);
366 layout_box_->layer()->setStaticInlinePosition(offset.inline_offset); 375 layout_box_->layer()->setStaticInlinePosition(offset.inline_offset);
367 } 376 }
368 377
369 } // namespace blink 378 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698