Skip to content

Commit

Permalink
FrameSet NG: Add three methods to LayoutNGFrameSet
Browse files Browse the repository at this point in the history
This CL adds:
 * IsChildAllowed()
 * UpdateBlockLayout()
 * GetCursor()

Implementations of IsChildAllowed() and GetCursor() are very similar to
ones of LayoutFrameSet. UpdateBlockLayout() implementation is same as
ones of LayoutNGGrid and LayoutNGFlexibleBox.

This CL has no behaivor changes due to a disabled runtime flag.

Bug: 1346221
Change-Id: Iad457b7c41ee78b559a17886a5df2efc4063781a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3828775
Commit-Queue: Koji Ishii <kojii@chromium.org>
Commit-Queue: Kent Tamura <tkent@chromium.org>
Auto-Submit: Kent Tamura <tkent@chromium.org>
Reviewed-by: Koji Ishii <kojii@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1034969}
  • Loading branch information
tkent-google authored and Chromium LUCI CQ committed Aug 15, 2022
1 parent 8d26dcf commit a2de1a7
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
31 changes: 31 additions & 0 deletions third_party/blink/renderer/core/layout/ng/layout_ng_frame_set.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
#include "third_party/blink/renderer/core/layout/ng/layout_ng_frame_set.h"

#include "third_party/blink/renderer/core/html/html_frame_set_element.h"
#include "third_party/blink/renderer/platform/cursors.h"
#include "ui/base/cursor/cursor.h"

namespace blink {

Expand All @@ -22,4 +24,33 @@ bool LayoutNGFrameSet::IsOfType(LayoutObjectType type) const {
return type == kLayoutObjectNGFrameSet || LayoutNGBlock::IsOfType(type);
}

bool LayoutNGFrameSet::IsChildAllowed(LayoutObject* child,
const ComputedStyle&) const {
NOT_DESTROYED();
return child->IsFrame() || child->IsLayoutNGFrameSet();
}

void LayoutNGFrameSet::UpdateBlockLayout(bool relayout_children) {
if (IsOutOfFlowPositioned())
UpdateOutOfFlowBlockLayout();
else
UpdateInFlowBlockLayout();
}

CursorDirective LayoutNGFrameSet::GetCursor(const PhysicalOffset& point,
ui::Cursor& cursor) const {
NOT_DESTROYED();
const auto& frame_set = *To<HTMLFrameSetElement>(GetNode());
gfx::Point rounded_point = ToRoundedPoint(point);
if (frame_set.CanResizeRow(rounded_point)) {
cursor = RowResizeCursor();
return kSetCursor;
}
if (frame_set.CanResizeColumn(rounded_point)) {
cursor = ColumnResizeCursor();
return kSetCursor;
}
return LayoutBox::GetCursor(point, cursor);
}

} // namespace blink
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ class LayoutNGFrameSet final : public LayoutNGBlock {
private:
const char* GetName() const override;
bool IsOfType(LayoutObjectType type) const override;
bool IsChildAllowed(LayoutObject* child, const ComputedStyle&) const override;
void UpdateBlockLayout(bool relayout_children) override;
CursorDirective GetCursor(const PhysicalOffset& point,
ui::Cursor& cursor) const override;
};

template <>
Expand Down

0 comments on commit a2de1a7

Please sign in to comment.