Commit df208483 authored by Yoshifumi Inoue's avatar Yoshifumi Inoue Committed by Commit Bot

[LayoutNG] Instroduce const version of NGPaintFragment::LastForSameLayoutObject()

This patch introduces const version of |NGPaintFragment::
LastForSameLayoutObject()| to avoid callers to use |const_cast| for improving
code health.

This patch is a preparation of the patch[1].

[1] http://crrev.com/c/1341776 [LayoutNG] Implement LayoutNG version of
{First,Last}CharacterAfterWhitespaceCollapsing()

Change-Id: I2dfad3861db1e93b89f5ca2441c2e222bee0181d
Reviewed-on: https://chromium-review.googlesource.com/c/1341775
Commit-Queue: Koji Ishii <kojii@chromium.org>
Reviewed-by: default avatarKoji Ishii <kojii@chromium.org>
Cr-Commit-Position: refs/heads/master@{#609261}
parent 974c5e4a
......@@ -501,6 +501,10 @@ NGPaintFragment::FragmentRange NGPaintFragment::InlineFragmentsFor(
return FragmentRange(nullptr, false);
}
const NGPaintFragment* NGPaintFragment::LastForSameLayoutObject() const {
return const_cast<NGPaintFragment*>(this)->LastForSameLayoutObject();
}
NGPaintFragment* NGPaintFragment::LastForSameLayoutObject() {
NGPaintFragment* fragment = this;
while (fragment->next_for_same_layout_object_)
......
......@@ -272,6 +272,7 @@ class CORE_EXPORT NGPaintFragment : public RefCounted<NGPaintFragment>,
// for a LayoutObject.
static FragmentRange InlineFragmentsFor(const LayoutObject*);
const NGPaintFragment* LastForSameLayoutObject() const;
NGPaintFragment* LastForSameLayoutObject();
// Called when lines containing |child| is dirty.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment