summaryrefslogtreecommitdiff
path: root/chromium/third_party/blink/renderer/core/layout/ng/ng_physical_box_fragment.h
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/third_party/blink/renderer/core/layout/ng/ng_physical_box_fragment.h')
-rw-r--r--chromium/third_party/blink/renderer/core/layout/ng/ng_physical_box_fragment.h79
1 files changed, 64 insertions, 15 deletions
diff --git a/chromium/third_party/blink/renderer/core/layout/ng/ng_physical_box_fragment.h b/chromium/third_party/blink/renderer/core/layout/ng/ng_physical_box_fragment.h
index 5fdc31c023e..21527728c01 100644
--- a/chromium/third_party/blink/renderer/core/layout/ng/ng_physical_box_fragment.h
+++ b/chromium/third_party/blink/renderer/core/layout/ng/ng_physical_box_fragment.h
@@ -7,7 +7,6 @@
#include "third_party/blink/renderer/core/core_export.h"
#include "third_party/blink/renderer/core/layout/ng/geometry/ng_box_strut.h"
-#include "third_party/blink/renderer/core/layout/ng/inline/ng_baseline.h"
#include "third_party/blink/renderer/core/layout/ng/inline/ng_fragment_items.h"
#include "third_party/blink/renderer/core/layout/ng/ng_physical_container_fragment.h"
#include "third_party/blink/renderer/platform/graphics/scroll_types.h"
@@ -25,6 +24,13 @@ class CORE_EXPORT NGPhysicalBoxFragment final
NGBoxFragmentBuilder* builder,
WritingMode block_or_line_writing_mode);
+ using PassKey = util::PassKey<NGPhysicalBoxFragment>;
+ NGPhysicalBoxFragment(PassKey,
+ NGBoxFragmentBuilder* builder,
+ const NGPhysicalBoxStrut& borders,
+ const NGPhysicalBoxStrut& padding,
+ WritingMode block_or_line_writing_mode);
+
scoped_refptr<const NGLayoutResult> CloneAsHiddenForPaint() const;
~NGPhysicalBoxFragment() {
@@ -40,8 +46,16 @@ class CORE_EXPORT NGPhysicalBoxFragment final
return has_fragment_items_ ? ComputeItemsAddress() : nullptr;
}
- base::Optional<LayoutUnit> Baseline(const NGBaselineRequest& request) const {
- return baselines_.Offset(request);
+ base::Optional<LayoutUnit> Baseline() const {
+ if (has_baseline_)
+ return baseline_;
+ return base::nullopt;
+ }
+
+ base::Optional<LayoutUnit> LastBaseline() const {
+ if (has_last_baseline_)
+ return last_baseline_;
+ return base::nullopt;
}
const NGPhysicalBoxStrut Borders() const {
@@ -63,9 +77,40 @@ class CORE_EXPORT NGPhysicalBoxFragment final
}
bool HasSelfPaintingLayer() const;
- bool ChildrenInline() const { return children_inline_; }
+
+ // Return true if this is either a container that establishes an inline
+ // formatting context, or if it's non-atomic inline content participating in
+ // one. Empty blocks don't establish an inline formatting context.
+ //
+ // The return value from this method is undefined and irrelevant if the object
+ // establishes a different type of formatting context than block/inline, such
+ // as table or flexbox.
+ //
+ // Example:
+ // <div> <!-- false -->
+ // <div> <!-- true -->
+ // <div style="float:left;"></div> <!-- false -->
+ // <div style="float:left;"> <!-- true -->
+ // xxx <!-- true -->
+ // </div>
+ // <div style="float:left;"> <!-- false -->
+ // <div style="float:left;"></div> <!-- false -->
+ // </div>
+ // <span> <!-- true -->
+ // xxx <!-- true -->
+ // <span style="display:inline-block;"> <!-- false -->
+ // <div></div> <!-- false -->
+ // </span>
+ // <span style="display:inline-block;"> <!-- true -->
+ // xxx <!-- true -->
+ // </span>
+ // <span style="display:inline-flex;"> <!-- N/A -->
+ bool IsInlineFormattingContext() const {
+ return is_inline_formatting_context_;
+ }
PhysicalRect ScrollableOverflow() const;
+ PhysicalRect ScrollableOverflowFromChildren() const;
// TODO(layout-dev): These three methods delegate to legacy layout for now,
// update them to use LayoutNG based overflow information from the fragment
@@ -79,6 +124,14 @@ class CORE_EXPORT NGPhysicalBoxFragment final
// Compute visual overflow of this box in the local coordinate.
PhysicalRect ComputeSelfInkOverflow() const;
+ // Contents ink overflow includes anything that would bleed out of the box and
+ // would be clipped by the overflow clip ('overflow' != visible). This
+ // corresponds to children that overflows their parent.
+ PhysicalRect ContentsInkOverflow() const {
+ // TODO(layout-dev): Implement box fragment overflow.
+ return LocalRect();
+ }
+
// Fragment offset is this fragment's offset from parent.
// Needed to compensate for LayoutInline Legacy code offsets.
void AddSelfOutlineRects(const PhysicalOffset& additional_offset,
@@ -91,20 +144,12 @@ class CORE_EXPORT NGPhysicalBoxFragment final
unsigned BorderEdges() const { return border_edge_; }
NGPixelSnappedPhysicalBoxStrut BorderWidths() const;
- // Return true if this is the first fragment generated from a node.
- bool IsFirstForNode() const { return is_first_for_node_; }
-
#if DCHECK_IS_ON()
void CheckSameForSimplifiedLayout(const NGPhysicalBoxFragment&,
bool check_same_block_size) const;
#endif
private:
- NGPhysicalBoxFragment(NGBoxFragmentBuilder* builder,
- const NGPhysicalBoxStrut& borders,
- const NGPhysicalBoxStrut& padding,
- WritingMode block_or_line_writing_mode);
-
const NGFragmentItems* ComputeItemsAddress() const {
DCHECK(has_fragment_items_ || has_borders_ || has_padding_);
const NGLink* children_end = children_ + Children().size();
@@ -125,7 +170,12 @@ class CORE_EXPORT NGPhysicalBoxFragment final
return has_borders_ ? address + 1 : address;
}
- NGBaselineList baselines_;
+#if DCHECK_IS_ON()
+ void CheckIntegrity() const;
+#endif
+
+ LayoutUnit baseline_;
+ LayoutUnit last_baseline_;
NGLink children_[];
// borders and padding come from after |children_| if they are not zero.
};
@@ -133,8 +183,7 @@ class CORE_EXPORT NGPhysicalBoxFragment final
template <>
struct DowncastTraits<NGPhysicalBoxFragment> {
static bool AllowFrom(const NGPhysicalFragment& fragment) {
- return fragment.Type() == NGPhysicalFragment::kFragmentBox ||
- fragment.Type() == NGPhysicalFragment::kFragmentRenderedLegend;
+ return fragment.Type() == NGPhysicalFragment::kFragmentBox;
}
};