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

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

Issue 2635143002: Changed EBoxSizing to an enum class and renamed its members (Closed)
Patch Set: Aded k prefix 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 unified diff | Download patch
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_length_utils.h" 5 #include "core/layout/ng/ng_length_utils.h"
6 6
7 #include "core/layout/ng/ng_constraint_space.h" 7 #include "core/layout/ng/ng_constraint_space.h"
8 #include "core/layout/ng/ng_constraint_space_builder.h" 8 #include "core/layout/ng/ng_constraint_space_builder.h"
9 #include "core/layout/ng/ng_fragment.h" 9 #include "core/layout/ng/ng_fragment.h"
10 #include "core/style/ComputedStyle.h" 10 #include "core/style/ComputedStyle.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 FromPlatformWritingMode(style.getWritingMode()), style.direction()); 67 FromPlatformWritingMode(style.getWritingMode()), style.direction());
68 return std::max(border_and_padding.InlineSum(), 68 return std::max(border_and_padding.InlineSum(),
69 content_size - margins.InlineSum()); 69 content_size - margins.InlineSum());
70 } 70 }
71 case Percent: 71 case Percent:
72 case Fixed: 72 case Fixed:
73 case Calculated: { 73 case Calculated: {
74 LayoutUnit percentage_resolution_size = 74 LayoutUnit percentage_resolution_size =
75 constraint_space.PercentageResolutionSize().inline_size; 75 constraint_space.PercentageResolutionSize().inline_size;
76 LayoutUnit value = valueForLength(length, percentage_resolution_size); 76 LayoutUnit value = valueForLength(length, percentage_resolution_size);
77 if (style.boxSizing() == BoxSizingContentBox) { 77 if (style.boxSizing() == EBoxSizing::kContentBox) {
78 value += border_and_padding.InlineSum(); 78 value += border_and_padding.InlineSum();
79 } else { 79 } else {
80 value = std::max(border_and_padding.InlineSum(), value); 80 value = std::max(border_and_padding.InlineSum(), value);
81 } 81 }
82 return value; 82 return value;
83 } 83 }
84 case MinContent: 84 case MinContent:
85 case MaxContent: 85 case MaxContent:
86 case FitContent: { 86 case FitContent: {
87 DCHECK(min_and_max.has_value()); 87 DCHECK(min_and_max.has_value());
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 FromPlatformWritingMode(style.getWritingMode()), style.direction()); 148 FromPlatformWritingMode(style.getWritingMode()), style.direction());
149 return std::max(border_and_padding.BlockSum(), 149 return std::max(border_and_padding.BlockSum(),
150 content_size - margins.BlockSum()); 150 content_size - margins.BlockSum());
151 } 151 }
152 case Percent: 152 case Percent:
153 case Fixed: 153 case Fixed:
154 case Calculated: { 154 case Calculated: {
155 LayoutUnit percentage_resolution_size = 155 LayoutUnit percentage_resolution_size =
156 constraint_space.PercentageResolutionSize().block_size; 156 constraint_space.PercentageResolutionSize().block_size;
157 LayoutUnit value = valueForLength(length, percentage_resolution_size); 157 LayoutUnit value = valueForLength(length, percentage_resolution_size);
158 if (style.boxSizing() == BoxSizingContentBox) { 158 if (style.boxSizing() == EBoxSizing::kContentBox) {
159 value += border_and_padding.BlockSum(); 159 value += border_and_padding.BlockSum();
160 } else { 160 } else {
161 value = std::max(border_and_padding.BlockSum(), value); 161 value = std::max(border_and_padding.BlockSum(), value);
162 } 162 }
163 return value; 163 return value;
164 } 164 }
165 case Auto: 165 case Auto:
166 case MinContent: 166 case MinContent:
167 case MaxContent: 167 case MaxContent:
168 case FitContent: 168 case FitContent:
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 margins->inline_start = available_space / 2; 402 margins->inline_start = available_space / 2;
403 margins->inline_end = available_space - margins->inline_start; 403 margins->inline_end = available_space - margins->inline_start;
404 } else if (style.marginStart().isAuto()) { 404 } else if (style.marginStart().isAuto()) {
405 margins->inline_start = available_space; 405 margins->inline_start = available_space;
406 } else if (style.marginEnd().isAuto()) { 406 } else if (style.marginEnd().isAuto()) {
407 margins->inline_end = available_space; 407 margins->inline_end = available_space;
408 } 408 }
409 } 409 }
410 410
411 } // namespace blink 411 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698