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

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

Issue 2797053002: Remove redundant casts, use NGLayoutInputNode base functions everywhere (Closed)
Patch Set: Created 3 years, 8 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_block_layout_algorithm.cc
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm.cc b/third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm.cc
index b4ae58f43bc67c83e86fbb1f6772918f155dc0d8..0fa47fe1a670b598eea30e486fbd51bb6a7112b6 100644
--- a/third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm.cc
+++ b/third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm.cc
@@ -77,23 +77,22 @@ Optional<MinMaxContentSize> NGBlockLayoutAlgorithm::ComputeMinMaxContentSize()
for (NGLayoutInputNode* node = Node()->FirstChild(); node;
node = node->NextSibling()) {
MinMaxContentSize child_sizes;
- if (node->Type() == NGLayoutInputNode::kLegacyInline) {
+ if (node->IsInline()) {
// From |NGBlockLayoutAlgorithm| perspective, we can handle |NGInlineNode|
// almost the same as |NGBlockNode|, because an |NGInlineNode| includes
// all inline nodes following |node| and their descendants, and produces
// an anonymous box that contains all line boxes.
// |NextSibling| returns the next block sibling, or nullptr, skipping all
// following inline siblings and descendants.
- child_sizes = toNGInlineNode(node)->ComputeMinMaxContentSize();
+ child_sizes = node->ComputeMinMaxContentSize();
} else {
Optional<MinMaxContentSize> child_minmax;
- NGBlockNode* block_child = toNGBlockNode(node);
- if (NeedMinMaxContentSizeForContentContribution(block_child->Style())) {
- child_minmax = block_child->ComputeMinMaxContentSize();
+ if (NeedMinMaxContentSizeForContentContribution(node->Style())) {
+ child_minmax = node->ComputeMinMaxContentSize();
}
- child_sizes = ComputeMinAndMaxContentContribution(block_child->Style(),
- child_minmax);
+ child_sizes =
+ ComputeMinAndMaxContentContribution(node->Style(), child_minmax);
}
sizes.min_content = std::max(sizes.min_content, child_sizes.min_content);
@@ -196,13 +195,12 @@ RefPtr<NGLayoutResult> NGBlockLayoutAlgorithm::Layout() {
curr_bfc_offset_.block_offset += content_size_;
while (child) {
- if (child->Type() == NGLayoutInputNode::kLegacyBlock) {
- NGBlockNode* current_block_child = toNGBlockNode(child);
- EPosition position = current_block_child->Style().position();
+ if (child->IsBlock()) {
+ EPosition position = child->Style().position();
if (position == EPosition::kAbsolute || position == EPosition::kFixed) {
NGLogicalOffset offset = {border_and_padding_.inline_start,
content_size_ + curr_margin_strut_.Sum()};
- builder_.AddOutOfFlowChildCandidate(current_block_child, offset);
+ builder_.AddOutOfFlowChildCandidate(toNGBlockNode(child), offset);
NGBlockChildIterator::Entry entry = child_iterator.NextChild();
child = entry.node;
child_break_token = entry.token;

Powered by Google App Engine
This is Rietveld 408576698