Index: third_party/WebKit/Source/core/layout/ng/inline/ng_inline_box_state.h |
diff --git a/third_party/WebKit/Source/core/layout/ng/inline/ng_inline_box_state.h b/third_party/WebKit/Source/core/layout/ng/inline/ng_inline_box_state.h |
index 96106abe612ef2777e8305b03bad9fd8e5eb5db0..5fcc3965dfa99454c662e3729255ee234a1d4b2f 100644 |
--- a/third_party/WebKit/Source/core/layout/ng/inline/ng_inline_box_state.h |
+++ b/third_party/WebKit/Source/core/layout/ng/inline/ng_inline_box_state.h |
@@ -6,6 +6,7 @@ |
#define NGInlineBoxState_h |
#include "core/CoreExport.h" |
+#include "core/layout/ng/geometry/ng_logical_size.h" |
#include "core/layout/ng/inline/ng_line_height_metrics.h" |
#include "core/style/ComputedStyleConstants.h" |
#include "platform/LayoutUnit.h" |
@@ -16,7 +17,6 @@ namespace blink { |
class NGInlineItem; |
class NGLineBoxFragmentBuilder; |
-class NGTextFragmentBuilder; |
// Fragments that require the layout position/size of ancestor are packed in |
// this struct. |
@@ -32,12 +32,21 @@ struct NGPendingPositions { |
// require ancestor position or size. |
struct NGInlineBoxState { |
unsigned fragment_start; |
+ const NGInlineItem* item; |
const ComputedStyle* style; |
NGLineHeightMetrics metrics; |
NGLineHeightMetrics text_metrics; |
LayoutUnit text_top; |
+ |
+ // These values are to create a box fragment. Set only when needs_box_fragment |
+ // is set. |
+ LayoutUnit line_left_position; |
+ LayoutUnit borders_paddings_block_start; |
+ LayoutUnit borders_paddings_block_height; |
+ |
Vector<NGPendingPositions> pending_descendants; |
bool include_used_fonts = false; |
+ bool needs_box_fragment = false; |
// Compute text metrics for a box. All text in a box share the same metrics. |
void ComputeTextMetrics(const ComputedStyle& style, FontBaseline); |
@@ -45,6 +54,11 @@ struct NGInlineBoxState { |
unsigned start, |
unsigned end, |
FontBaseline); |
+ |
+ // Create a box fragment for this box. |
+ void SetNeedsBoxFragment(LayoutUnit line_left_position, |
+ LayoutUnit borders_paddings_block_start, |
+ LayoutUnit borders_paddings_block_height); |
}; |
// Represents the inline tree structure. This class provides: |
@@ -61,23 +75,33 @@ class NGInlineLayoutStateStack { |
NGInlineBoxState* OnBeginPlaceItems(const ComputedStyle*, FontBaseline); |
// Push a box state stack. |
- NGInlineBoxState* OnOpenTag(const NGInlineItem&, |
- NGLineBoxFragmentBuilder*, |
- NGTextFragmentBuilder*); |
+ NGInlineBoxState* OnOpenTag(const NGInlineItem&, NGLineBoxFragmentBuilder*); |
// Pop a box state stack. |
NGInlineBoxState* OnCloseTag(const NGInlineItem&, |
NGLineBoxFragmentBuilder*, |
NGInlineBoxState*, |
- FontBaseline); |
+ FontBaseline, |
+ LayoutUnit position); |
// Compute all the pending positioning at the end of a line. |
- void OnEndPlaceItems(NGLineBoxFragmentBuilder*, FontBaseline); |
+ void OnEndPlaceItems(NGLineBoxFragmentBuilder*, |
+ FontBaseline, |
+ LayoutUnit position); |
private: |
// End of a box state, either explicitly by close tag, or implicitly at the |
// end of a line. |
- void EndBoxState(NGInlineBoxState*, NGLineBoxFragmentBuilder*, FontBaseline); |
+ void EndBoxState(NGInlineBoxState*, |
+ NGLineBoxFragmentBuilder*, |
+ FontBaseline, |
+ LayoutUnit position); |
+ |
+ void AddBoxFragmentPlaceholder(NGInlineBoxState*, |
+ NGLineBoxFragmentBuilder*, |
+ FontBaseline, |
+ LayoutUnit position); |
+ void CreateBoxFragments(NGLineBoxFragmentBuilder*); |
enum PositionPending { kPositionNotPending, kPositionPending }; |
@@ -91,7 +115,16 @@ class NGInlineLayoutStateStack { |
NGLineBoxFragmentBuilder*, |
FontBaseline); |
+ // Data for a box fragment placeholder. See AddBoxFragmentPlaceholder(). |
+ struct BoxFragmentPlaceholder { |
+ unsigned fragment_start; |
+ unsigned fragment_end; |
+ const NGInlineItem* item; |
+ NGLogicalSize size; |
+ }; |
+ |
Vector<NGInlineBoxState, 4> stack_; |
+ Vector<BoxFragmentPlaceholder, 4> box_placeholders_; |
}; |
} // namespace blink |