OLD | NEW |
---|---|
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_physical_fragment.h" | 5 #include "core/layout/ng/ng_physical_fragment.h" |
6 | 6 |
7 #include "core/layout/ng/inline/ng_physical_line_box_fragment.h" | 7 #include "core/layout/ng/inline/ng_physical_line_box_fragment.h" |
8 #include "core/layout/ng/inline/ng_physical_text_fragment.h" | 8 #include "core/layout/ng/inline/ng_physical_text_fragment.h" |
9 #include "core/layout/ng/ng_break_token.h" | 9 #include "core/layout/ng/ng_break_token.h" |
10 #include "core/layout/ng/ng_physical_box_fragment.h" | 10 #include "core/layout/ng/ng_physical_box_fragment.h" |
(...skipping 28 matching lines...) Expand all Loading... | |
39 } | 39 } |
40 | 40 |
41 const ComputedStyle& NGPhysicalFragment::Style() const { | 41 const ComputedStyle& NGPhysicalFragment::Style() const { |
42 DCHECK(layout_object_); | 42 DCHECK(layout_object_); |
43 return layout_object_->StyleRef(); | 43 return layout_object_->StyleRef(); |
44 } | 44 } |
45 | 45 |
46 NGPixelSnappedPhysicalBoxStrut NGPhysicalFragment::BorderWidths() const { | 46 NGPixelSnappedPhysicalBoxStrut NGPhysicalFragment::BorderWidths() const { |
47 unsigned edges = BorderEdges(); | 47 unsigned edges = BorderEdges(); |
48 NGPhysicalBoxStrut box_strut( | 48 NGPhysicalBoxStrut box_strut( |
49 LayoutUnit((edges & kTopBorder) ? Style().BorderTopWidth() : .0f), | 49 LayoutUnit((edges & NGBorderEdges::kTop) ? Style().BorderTopWidth() |
50 LayoutUnit((edges & kRightBorder) ? Style().BorderRightWidth() : .0f), | 50 : .0f), |
51 LayoutUnit((edges & kBottomBorder) ? Style().BorderBottomWidth() : .0f), | 51 LayoutUnit((edges & NGBorderEdges::kRight) ? Style().BorderRightWidth() |
52 LayoutUnit((edges & kLeftBorder) ? Style().BorderLeftWidth() : .0f)); | 52 : .0f), |
53 LayoutUnit((edges & NGBorderEdges::kBottom) ? Style().BorderBottomWidth() | |
54 : .0f), | |
55 LayoutUnit((edges & NGBorderEdges::kLeft) ? Style().BorderLeftWidth() | |
56 : .0f)); | |
kojii
2017/05/31 04:41:25
Can move to ng_border_edges.cc to avoid wrapping?
| |
53 return box_strut.SnapToDevicePixels(); | 57 return box_strut.SnapToDevicePixels(); |
54 } | 58 } |
55 | 59 |
56 String NGPhysicalFragment::ToString() const { | 60 String NGPhysicalFragment::ToString() const { |
57 return String::Format("Type: '%d' Size: '%s' Offset: '%s' Placed: '%d'", | 61 return String::Format("Type: '%d' Size: '%s' Offset: '%s' Placed: '%d'", |
58 Type(), Size().ToString().Ascii().data(), | 62 Type(), Size().ToString().Ascii().data(), |
59 Offset().ToString().Ascii().data(), IsPlaced()); | 63 Offset().ToString().Ascii().data(), IsPlaced()); |
60 } | 64 } |
61 | 65 |
62 } // namespace blink | 66 } // namespace blink |
OLD | NEW |