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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp

Issue 2867293002: [LayoutNG] Compute baseline from fragment tree (Closed)
Patch Set: Cleanup Created 3 years, 5 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 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 2588 matching lines...) Expand 10 before | Expand all | Expand 10 after
2599 } 2599 }
2600 return (FirstLineBox()->LogicalTop() + 2600 return (FirstLineBox()->LogicalTop() +
2601 font_data->GetFontMetrics().Ascent(FirstRootBox()->BaselineType())) 2601 font_data->GetFontMetrics().Ascent(FirstRootBox()->BaselineType()))
2602 .ToInt(); 2602 .ToInt();
2603 } 2603 }
2604 return -1; 2604 return -1;
2605 } 2605 }
2606 2606
2607 int LayoutBlockFlow::InlineBlockBaseline( 2607 int LayoutBlockFlow::InlineBlockBaseline(
2608 LineDirectionMode line_direction) const { 2608 LineDirectionMode line_direction) const {
2609 // CSS2.1 states that the baseline of an 'inline-block' is: 2609 if (UseLogicalBottomMarginEdgeForInlineBlockBaseline()) {
2610 // the baseline of the last line box in the normal flow, unless it has
2611 // either no in-flow line boxes or if its 'overflow' property has a computed
2612 // value other than 'visible', in which case the baseline is the bottom
2613 // margin edge.
2614 // We likewise avoid using the last line box in the case of size containment,
2615 // where the block's contents shouldn't be considered when laying out its
2616 // ancestors or siblings.
2617
2618 if ((!Style()->IsOverflowVisible() &&
2619 !ShouldIgnoreOverflowPropertyForInlineBlockBaseline()) ||
2620 Style()->ContainsSize()) {
2621 // We are not calling baselinePosition here because the caller should add 2610 // We are not calling baselinePosition here because the caller should add
2622 // the margin-top/margin-right, not us. 2611 // the margin-top/margin-right, not us.
2623 return (line_direction == kHorizontalLine ? Size().Height() + MarginBottom() 2612 return (line_direction == kHorizontalLine ? Size().Height() + MarginBottom()
2624 : Size().Width() + MarginLeft()) 2613 : Size().Width() + MarginLeft())
2625 .ToInt(); 2614 .ToInt();
2626 } 2615 }
2627 if (IsWritingModeRoot() && !IsRubyRun()) 2616 if (IsWritingModeRoot() && !IsRubyRun())
2628 return -1; 2617 return -1;
2629 if (!ChildrenInline()) 2618 if (!ChildrenInline())
2630 return LayoutBlock::InlineBlockBaseline(line_direction); 2619 return LayoutBlock::InlineBlockBaseline(line_direction);
(...skipping 2112 matching lines...) Expand 10 before | Expand all | Expand 10 after
4743 include_block_overflows); 4732 include_block_overflows);
4744 } 4733 }
4745 4734
4746 void LayoutBlockFlow::InvalidateDisplayItemClients( 4735 void LayoutBlockFlow::InvalidateDisplayItemClients(
4747 PaintInvalidationReason invalidation_reason) const { 4736 PaintInvalidationReason invalidation_reason) const {
4748 BlockFlowPaintInvalidator(*this).InvalidateDisplayItemClients( 4737 BlockFlowPaintInvalidator(*this).InvalidateDisplayItemClients(
4749 invalidation_reason); 4738 invalidation_reason);
4750 } 4739 }
4751 4740
4752 } // namespace blink 4741 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698