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

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

Issue 2597823004: WIP version of new margin collapsing logic + support of empty blocks with floats
Patch Set: update Created 3 years, 11 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 f2a5972ad045506ea1c6e327c37fc7f977d8f66c..a12e20fffbc787965c1556614dcfc6573f0605d0 100644
--- a/third_party/WebKit/Source/core/layout/ng/ng_units.h
+++ b/third_party/WebKit/Source/core/layout/ng/ng_units.h
@@ -32,6 +32,10 @@ inline std::ostream& operator<<(std::ostream& stream,
struct NGLogicalSize {
NGLogicalSize() {}
+ NGLogicalSize(int inline_size, int block_size)
+ : inline_size(LayoutUnit(inline_size)),
+ block_size(LayoutUnit(block_size)) {}
+
NGLogicalSize(LayoutUnit inline_size, LayoutUnit block_size)
: inline_size(inline_size), block_size(block_size) {}
@@ -153,7 +157,7 @@ struct NGPhysicalRect {
// TODO(glebl): move to a separate file in layout/ng/units.
struct CORE_EXPORT NGLogicalRect {
NGLogicalRect() {}
- NGLogicalRect(const NGLogicalOffset& offset, const NGLogicalSize& size)
+ NGLogicalRect(NGLogicalOffset offset, NGLogicalSize size)
: offset(offset), size(size) {}
NGLogicalRect(LayoutUnit inline_offset,
LayoutUnit block_offset,
@@ -303,39 +307,18 @@ inline std::ostream& operator<<(std::ostream& stream, const NGBoxStrut& value) {
}
// This struct is used for the margin collapsing calculation.
-// TODO(glebl): Deprecated. It's being replaced by NGMarginStrut
-struct CORE_EXPORT NGDeprecatedMarginStrut {
- LayoutUnit margin_block_start;
- LayoutUnit margin_block_end;
-
- LayoutUnit negative_margin_block_start;
- LayoutUnit negative_margin_block_end;
-
- LayoutUnit BlockEndSum() const;
-
- void AppendMarginBlockStart(const LayoutUnit& value);
- void AppendMarginBlockEnd(const LayoutUnit& value);
- void SetMarginBlockStart(const LayoutUnit& value);
- void SetMarginBlockEnd(const LayoutUnit& value);
-
- bool IsEmpty() const;
-
- String ToString() const;
-
- bool operator==(const NGDeprecatedMarginStrut& other) const;
-};
-
-// This struct is used for the margin collapsing calculation.
struct CORE_EXPORT NGMarginStrut {
LayoutUnit margin;
LayoutUnit negative_margin;
- bool operator==(const NGMarginStrut& other) const;
-
+ // Appends negative or positive value to the margin.
void Append(const LayoutUnit& value);
+ // Collapses positive and negative margins producing a sum of them.
LayoutUnit Collapse() const;
+ bool operator==(const NGMarginStrut& other) const;
+
String ToString() const;
};
« no previous file with comments | « third_party/WebKit/Source/core/layout/ng/ng_physical_fragment.h ('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