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

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

Issue 2865903002: [LayoutNG] Inline margin/border/padding, inter-item breaking, and tests (Closed)
Patch Set: ikilpatrick review Created 3 years, 6 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 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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/inline/ng_inline_item.h" 5 #include "core/layout/ng/inline/ng_inline_item.h"
6 6
7 #include "core/layout/LayoutInline.h"
7 #include "core/layout/LayoutObject.h" 8 #include "core/layout/LayoutObject.h"
8 #include "platform/fonts/CharacterRange.h" 9 #include "platform/fonts/CharacterRange.h"
9 #include "platform/fonts/shaping/ShapeResultBuffer.h" 10 #include "platform/fonts/shaping/ShapeResultBuffer.h"
10 11
11 namespace blink { 12 namespace blink {
12 namespace { 13 namespace {
13 14
14 const char* kNGInlineItemTypeStrings[] = { 15 const char* kNGInlineItemTypeStrings[] = {
15 "Text", "Control", "AtomicInline", "OpenTag", 16 "Text", "Control", "AtomicInline", "OpenTag",
16 "CloseTag", "Floating", "OutOfFlowPositioned", "BidiControl"}; 17 "CloseTag", "Floating", "OutOfFlowPositioned", "BidiControl"};
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 unsigned start, 117 unsigned start,
117 unsigned end) const { 118 unsigned end) const {
118 DCHECK_GE(start, StartOffset()); 119 DCHECK_GE(start, StartOffset());
119 DCHECK_LE(start, end); 120 DCHECK_LE(start, end);
120 DCHECK_LE(end, EndOffset()); 121 DCHECK_LE(end, EndOffset());
121 122
122 // TODO(kojii): Implement |start| and |end|. 123 // TODO(kojii): Implement |start| and |end|.
123 shape_result_->FallbackFonts(fallback_fonts); 124 shape_result_->FallbackFonts(fallback_fonts);
124 } 125 }
125 126
127 bool NGInlineItem::HasStartEdge() const {
128 DCHECK(Type() == kOpenTag || Type() == kCloseTag);
129 // TODO(kojii): Should use break token when NG has its own tree building.
130 return !GetLayoutObject()->IsInlineElementContinuation();
131 }
132
133 bool NGInlineItem::HasEndEdge() const {
134 DCHECK(Type() == kOpenTag || Type() == kCloseTag);
135 // TODO(kojii): Should use break token when NG has its own tree building.
136 return !ToLayoutInline(GetLayoutObject())->Continuation();
137 }
138
126 NGInlineItemRange::NGInlineItemRange(Vector<NGInlineItem>* items, 139 NGInlineItemRange::NGInlineItemRange(Vector<NGInlineItem>* items,
127 unsigned start_index, 140 unsigned start_index,
128 unsigned end_index) 141 unsigned end_index)
129 : start_item_(&(*items)[start_index]), 142 : start_item_(&(*items)[start_index]),
130 size_(end_index - start_index), 143 size_(end_index - start_index),
131 start_index_(start_index) { 144 start_index_(start_index) {
132 CHECK_LE(start_index, end_index); 145 CHECK_LE(start_index, end_index);
133 CHECK_LE(end_index, items->size()); 146 CHECK_LE(end_index, items->size());
134 } 147 }
135 148
136 } // namespace blink 149 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698