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

Unified Diff: third_party/WebKit/Source/core/layout/ng/ng_units.h

Issue 2282213002: [LayoutNG] Introduce NGPhysicalFragment and make NGFragment a 'view' (Closed)
Patch Set: address comments. Created 4 years, 4 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_units.h
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_units.h b/third_party/WebKit/Source/core/layout/ng/ng_units.h
index c691ad23eefb67ee4706d541621281da9ff4b1ea..4ecabde71b3ca51008aa33f7f120e96c38f1609a 100644
--- a/third_party/WebKit/Source/core/layout/ng/ng_units.h
+++ b/third_party/WebKit/Source/core/layout/ng/ng_units.h
@@ -5,11 +5,16 @@
#ifndef NGUnits_h
#define NGUnits_h
+#include "core/CoreExport.h"
+#include "core/layout/ng/ng_direction.h"
+#include "core/layout/ng/ng_writing_mode.h"
#include "platform/LayoutUnit.h"
namespace blink {
class LayoutUnit;
+struct NGPhysicalOffset;
+struct NGPhysicalSize;
struct NGLogicalSize {
NGLogicalSize() {}
@@ -18,11 +23,39 @@ struct NGLogicalSize {
LayoutUnit inline_size;
LayoutUnit block_size;
+
+ NGPhysicalSize ConvertToPhysical(NGWritingMode mode) const;
};
+// NGLogicalOffset is the position of a rect (typically a fragment) relative to
+// its parent rect in the logical coordinate system.
struct NGLogicalOffset {
+ NGLogicalOffset() {}
+ NGLogicalOffset(LayoutUnit inline_offset, LayoutUnit block_offset)
+ : inline_offset(inline_offset), block_offset(block_offset) {}
+
LayoutUnit inline_offset;
LayoutUnit block_offset;
+
+ // Converts a logical offset to a physical offset. See:
+ // https://drafts.csswg.org/css-writing-modes-3/#logical-to-physical
+ // @param container_size the size of the rect (typically a fragment).
+ // @param inner_size the size of the inner rect (typically a child fragment).
+ CORE_EXPORT NGPhysicalOffset
+ ConvertToPhysical(NGWritingMode mode,
+ NGDirection direction,
+ NGPhysicalSize container_size,
+ NGPhysicalSize inner_size) const;
+};
+
+// NGPhysicalOffset is the position of a rect (typically a fragment) relative to
+// its parent rect in the physical coordinate system.
+struct NGPhysicalOffset {
+ NGPhysicalOffset() {}
+ NGPhysicalOffset(LayoutUnit left, LayoutUnit top) : left(left), top(top) {}
+
+ LayoutUnit left;
+ LayoutUnit top;
};
struct NGPhysicalSize {
@@ -32,11 +65,15 @@ struct NGPhysicalSize {
LayoutUnit width;
LayoutUnit height;
+
+ NGLogicalSize ConvertToLogical(NGWritingMode mode) const;
};
+// NGPhysicalLocation is the position of a rect (typically a fragment) relative
+// to the root document.
struct NGPhysicalLocation {
- LayoutUnit top;
LayoutUnit left;
+ LayoutUnit top;
};
struct NGPhysicalRect {
« no previous file with comments | « third_party/WebKit/Source/core/layout/ng/ng_text_fragment.cc ('k') | third_party/WebKit/Source/core/layout/ng/ng_units.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698