[FormControlRange] Live updates for user typing [chromium/src : main]

0 views
Skip to first unread message

Stephanie Zhang (Gerrit)

unread,
Oct 1, 2025, 10:03:49 AMOct 1
to chromium...@chromium.org, blink-re...@chromium.org, blink-rev...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org

Message from Stephanie Zhang

Set Ready For Review

Open in Gerrit

Related details

Attention set is empty
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Ic59fced46837275408fb90d601506306a3ef6771
Gerrit-Change-Number: 7001481
Gerrit-PatchSet: 6
Gerrit-Owner: Stephanie Zhang <stephan...@microsoft.com>
Gerrit-Comment-Date: Wed, 01 Oct 2025 14:03:37 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Mason Freed (Gerrit)

unread,
Oct 9, 2025, 6:32:28 PM (10 days ago) Oct 9
to Stephanie Zhang, Dan Clark, Chromium LUCI CQ, chromium...@chromium.org, blink-re...@chromium.org, blink-rev...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org
Attention needed from Stephanie Zhang

Mason Freed added 8 comments

Patchset-level comments
File-level comment, Patchset 8 (Latest):
Mason Freed . resolved

Sorry for the delay reviewing this! This looks pretty good - just some small things.

File third_party/blink/renderer/core/dom/form_control_range.cc
Line 125, Patchset 8 (Latest): if (!form_control_ || (deleted_count == 0 && inserted_count == 0)) {
Mason Freed . unresolved

nit: maybe add

```
DCHECK(RuntimeEnabledFeatures::FormControlRangeEnabled());
```

Line 134, Patchset 8 (Latest): // Deletion step: remove text from change_offset to change_end .
// Endpoints that fall within the removed text (including exactly at its start
// or end) move to |change_offset|. Endpoints after the removed text shift
// left by |deleted_count|. Endpoints before the removed text are unchanged.
auto apply_delete = [&](unsigned pos) -> unsigned {
if (deleted_count == 0 || pos < change_offset) {
return pos;
}
return (pos <= change_end) ? change_offset : pos - deleted_count;
};

// Insertion step: insert |inserted_count| units at |change_offset|.
// Endpoints strictly after |change_offset| shift right by |inserted_count|.
// Endpoints at or before |change_offset| are unchanged.
auto apply_insert = [&](unsigned pos) -> unsigned {
if (inserted_count == 0 || pos <= change_offset) {
return pos;
}
return pos + inserted_count;
};

unsigned new_start = apply_insert(apply_delete(pre_start));
unsigned new_end = apply_insert(apply_delete(pre_end));
Mason Freed . unresolved

nit, I find this a little easier to read, and I believe it does the same thing:

```
auto calculate_new_offset = [&](unsigned pos) -> unsigned {
const unsigned change_end = change_offset + deleted_count;
// 1. Position is before the change; it's unaffected.
if (pos < change_offset) {
return pos;
}
// 2. Position is inside the deleted region; snap to the start.
if (pos <= change_end) {
return change_offset;
}
// 3. Position is after the change; shift by the net difference.
return pos - deleted_count + inserted_count;
};

unsigned new_start = calculate_new_offset(pre_start);
unsigned new_end = calculate_new_offset(pre_end);
```

File third_party/blink/renderer/core/html/forms/text_control_element.cc
Line 191, Patchset 8 (Latest): CaptureFormControlRangePreEdit(static_cast<InputEvent&>(event));
Mason Freed . unresolved

Perhaps prefer `To<InputEvent>()` over static_cast.

Line 1344, Patchset 8 (Latest): if (RuntimeEnabledFeatures::FormControlRangeEnabled()) {
Mason Freed . unresolved

I think you always want to trace, not just when the feature is enabled.

Line 1372, Patchset 8 (Latest): for (wtf_size_t i = 0; i < form_control_ranges_.size(); ++i) {
if (form_control_ranges_[i] == range) {
form_control_ranges_.EraseAt(i);
break;
}
}
Mason Freed . unresolved

Perhaps

```
auto iter = std::ranges::find(form_control_ranges_, range);
if (iter != form_control_ranges_.end()) {
form_control_ranges_.erase(iter);
}
```
Line 1397, Patchset 8 (Latest): input_event.defaultPrevented() || form_control_ranges_.empty()) {
Mason Freed . unresolved

Does this ever get called if `defaultPrevented`? Seems like the only caller is in `DefaultEventHandler`, which shouldn't happen if the default was prevented. Perhaps you can just DCHECK?

Line 1448, Patchset 8 (Latest): const unsigned max_by_sel = old_length - selection_end;
Mason Freed . unresolved

Hmm, `max_by_sel` is a little hard to parse. Maybe `maximum_suffix_length`?

Open in Gerrit

Related details

Attention is currently required from:
  • Stephanie Zhang
Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: Ic59fced46837275408fb90d601506306a3ef6771
    Gerrit-Change-Number: 7001481
    Gerrit-PatchSet: 8
    Gerrit-Owner: Stephanie Zhang <stephan...@microsoft.com>
    Gerrit-Reviewer: Mason Freed <mas...@chromium.org>
    Gerrit-Reviewer: Stephanie Zhang <stephan...@microsoft.com>
    Gerrit-CC: Dan Clark <dan...@microsoft.com>
    Gerrit-Attention: Stephanie Zhang <stephan...@microsoft.com>
    Gerrit-Comment-Date: Thu, 09 Oct 2025 22:32:05 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Stephanie Zhang (Gerrit)

    unread,
    Oct 10, 2025, 4:23:54 PM (9 days ago) Oct 10
    to Ana Sollano Kim, Leo Lee, Dan Clark, Mason Freed, Chromium LUCI CQ, chromium...@chromium.org, blink-re...@chromium.org, blink-rev...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org
    Attention needed from Ana Sollano Kim and Mason Freed

    Stephanie Zhang added 8 comments

    Patchset-level comments
    File-level comment, Patchset 8:
    Stephanie Zhang . resolved

    PTAL - thanks!

    File third_party/blink/renderer/core/dom/form_control_range.cc
    Line 125, Patchset 8: if (!form_control_ || (deleted_count == 0 && inserted_count == 0)) {
    Mason Freed . resolved

    nit: maybe add

    ```
    DCHECK(RuntimeEnabledFeatures::FormControlRangeEnabled());
    ```

    Stephanie Zhang

    Done

    Line 134, Patchset 8: // Deletion step: remove text from change_offset to change_end .

    // Endpoints that fall within the removed text (including exactly at its start
    // or end) move to |change_offset|. Endpoints after the removed text shift
    // left by |deleted_count|. Endpoints before the removed text are unchanged.
    auto apply_delete = [&](unsigned pos) -> unsigned {
    if (deleted_count == 0 || pos < change_offset) {
    return pos;
    }
    return (pos <= change_end) ? change_offset : pos - deleted_count;
    };

    // Insertion step: insert |inserted_count| units at |change_offset|.
    // Endpoints strictly after |change_offset| shift right by |inserted_count|.
    // Endpoints at or before |change_offset| are unchanged.
    auto apply_insert = [&](unsigned pos) -> unsigned {
    if (inserted_count == 0 || pos <= change_offset) {
    return pos;
    }
    return pos + inserted_count;
    };

    unsigned new_start = apply_insert(apply_delete(pre_start));
    unsigned new_end = apply_insert(apply_delete(pre_end));
    Mason Freed . resolved

    nit, I find this a little easier to read, and I believe it does the same thing:

    ```
    auto calculate_new_offset = [&](unsigned pos) -> unsigned {
    const unsigned change_end = change_offset + deleted_count;
    // 1. Position is before the change; it's unaffected.
    if (pos < change_offset) {
    return pos;
    }
    // 2. Position is inside the deleted region; snap to the start.
    if (pos <= change_end) {
    return change_offset;
    }
    // 3. Position is after the change; shift by the net difference.
    return pos - deleted_count + inserted_count;
    };

    unsigned new_start = calculate_new_offset(pre_start);
    unsigned new_end = calculate_new_offset(pre_end);
    ```

    Stephanie Zhang

    Thank you - that's so much better!

    File third_party/blink/renderer/core/html/forms/text_control_element.cc
    Line 191, Patchset 8: CaptureFormControlRangePreEdit(static_cast<InputEvent&>(event));
    Mason Freed . resolved

    Perhaps prefer `To<InputEvent>()` over static_cast.

    Stephanie Zhang

    Ended up removing it since it's no longer needed in `CaptureFormControlRangePreEdit()`

    Line 1344, Patchset 8: if (RuntimeEnabledFeatures::FormControlRangeEnabled()) {
    Mason Freed . resolved

    I think you always want to trace, not just when the feature is enabled.

    Stephanie Zhang

    Done

    Line 1372, Patchset 8: for (wtf_size_t i = 0; i < form_control_ranges_.size(); ++i) {

    if (form_control_ranges_[i] == range) {
    form_control_ranges_.EraseAt(i);
    break;
    }
    }
    Mason Freed . resolved

    Perhaps

    ```
    auto iter = std::ranges::find(form_control_ranges_, range);
    if (iter != form_control_ranges_.end()) {
    form_control_ranges_.erase(iter);
    }
    ```
    Stephanie Zhang

    Done

    Line 1397, Patchset 8: input_event.defaultPrevented() || form_control_ranges_.empty()) {
    Mason Freed . resolved

    Does this ever get called if `defaultPrevented`? Seems like the only caller is in `DefaultEventHandler`, which shouldn't happen if the default was prevented. Perhaps you can just DCHECK?

    Stephanie Zhang

    Ended up removing `|input_event|` since it's only used for this check.

    Line 1448, Patchset 8: const unsigned max_by_sel = old_length - selection_end;
    Mason Freed . resolved

    Hmm, `max_by_sel` is a little hard to parse. Maybe `maximum_suffix_length`?

    Stephanie Zhang

    Done

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Ana Sollano Kim
    • Mason Freed
    Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement is not satisfiedCode-Owners
      • requirement is not satisfiedCode-Review
      • requirement is not satisfiedReview-Enforcement
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: Ic59fced46837275408fb90d601506306a3ef6771
      Gerrit-Change-Number: 7001481
      Gerrit-PatchSet: 9
      Gerrit-Owner: Stephanie Zhang <stephan...@microsoft.com>
      Gerrit-Reviewer: Ana Sollano Kim <anso...@microsoft.com>
      Gerrit-Reviewer: Mason Freed <mas...@chromium.org>
      Gerrit-Reviewer: Stephanie Zhang <stephan...@microsoft.com>
      Gerrit-CC: Dan Clark <dan...@microsoft.com>
      Gerrit-CC: Leo Lee <leo...@microsoft.com>
      Gerrit-Attention: Mason Freed <mas...@chromium.org>
      Gerrit-Attention: Ana Sollano Kim <anso...@microsoft.com>
      Gerrit-Comment-Date: Fri, 10 Oct 2025 20:23:48 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Comment-In-Reply-To: Mason Freed <mas...@chromium.org>
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Ana Sollano Kim (Gerrit)

      unread,
      Oct 10, 2025, 5:45:20 PM (9 days ago) Oct 10
      to Stephanie Zhang, Leo Lee, Dan Clark, Mason Freed, Chromium LUCI CQ, chromium...@chromium.org, blink-re...@chromium.org, blink-rev...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org
      Attention needed from Mason Freed and Stephanie Zhang

      Ana Sollano Kim added 6 comments

      File third_party/blink/renderer/core/dom/form_control_range.h
      Line 58, Patchset 9 (Latest): // Update |form_control_| after a text replacement at `change_offset`: removes
      Ana Sollano Kim . unresolved

      nit: I believe these should also be backticks. Same throughout the paragraph.

      File third_party/blink/renderer/core/dom/form_control_range.cc
      Line 95, Patchset 9 (Latest): if (form_control_ != text_control) {
      Ana Sollano Kim . unresolved

      Should this have a comment like the blocks above?

      Line 125, Patchset 9 (Latest): DCHECK(RuntimeEnabledFeatures::FormControlRangeEnabled());
      Ana Sollano Kim . unresolved

      `CHECK` here instead? Since it's a `CHECK` above?

      Line 145, Patchset 9 (Latest):
      Ana Sollano Kim . unresolved

      nit: extra line

      File third_party/blink/renderer/core/html/forms/text_control_element.cc
      Line 1379, Patchset 9 (Latest): if (!RuntimeEnabledFeatures::FormControlRangeEnabled() ||
      Ana Sollano Kim . unresolved
      Should this also be:
      ```
      CHECK(RuntimeEnabledFeatures::FormControlRangeEnabled());
      if (form_control_ranges_.empty()) {
      return;
      }
      ```
      ? Or maybe `NotifyFormControlRangesOfTextChange` should just be in line since it appears to only be called once?
      Line 1402, Patchset 9 (Latest): if (!RuntimeEnabledFeatures::FormControlRangeEnabled() ||
      Ana Sollano Kim . unresolved

      `CHECK` here instead?

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Mason Freed
      • Stephanie Zhang
      Submit Requirements:
        • requirement satisfiedCode-Coverage
        • requirement is not satisfiedCode-Owners
        • requirement is not satisfiedCode-Review
        • requirement is not satisfiedNo-Unresolved-Comments
        • requirement is not satisfiedReview-Enforcement
        Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
        Gerrit-MessageType: comment
        Gerrit-Project: chromium/src
        Gerrit-Branch: main
        Gerrit-Change-Id: Ic59fced46837275408fb90d601506306a3ef6771
        Gerrit-Change-Number: 7001481
        Gerrit-PatchSet: 9
        Gerrit-Owner: Stephanie Zhang <stephan...@microsoft.com>
        Gerrit-Reviewer: Ana Sollano Kim <anso...@microsoft.com>
        Gerrit-Reviewer: Mason Freed <mas...@chromium.org>
        Gerrit-Reviewer: Stephanie Zhang <stephan...@microsoft.com>
        Gerrit-CC: Dan Clark <dan...@microsoft.com>
        Gerrit-CC: Leo Lee <leo...@microsoft.com>
        Gerrit-Attention: Mason Freed <mas...@chromium.org>
        Gerrit-Attention: Stephanie Zhang <stephan...@microsoft.com>
        Gerrit-Comment-Date: Fri, 10 Oct 2025 21:44:57 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: No
        satisfied_requirement
        unsatisfied_requirement
        open
        diffy

        Mason Freed (Gerrit)

        unread,
        Oct 13, 2025, 3:04:00 PM (6 days ago) Oct 13
        to Stephanie Zhang, Ana Sollano Kim, Leo Lee, Dan Clark, Chromium LUCI CQ, chromium...@chromium.org, blink-re...@chromium.org, blink-rev...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org
        Attention needed from Stephanie Zhang

        Mason Freed voted and added 2 comments

        Votes added by Mason Freed

        Code-Review+1

        2 comments

        Patchset-level comments
        File-level comment, Patchset 9 (Latest):
        Mason Freed . resolved

        Thanks for the changes! This looks pretty good to me.

        File third_party/blink/renderer/core/dom/form_control_range.cc
        Line 134, Patchset 9 (Latest): // Pure insertion handling (no deletions), matching DOM Range behavior.
        if (deleted_count == 0 && inserted_count > 0) {
        // Collapsed insertion: caret remains before new text.
        if (pre_start == pre_end && change_offset == pre_start) {
        return;
        }
        // Insertion at range start: extend the end to include the new text.
        if (pre_start != pre_end && change_offset == pre_start) {
        end_offset_in_value_ = pre_end + inserted_count;
        return;
        }

        // Insertion at range end: leave the range unchanged.
        if (pre_start != pre_end && change_offset == pre_end) {
        return;
        }
        }
        Mason Freed . unresolved

        Is this chunk just an optimization for this special case? (It seems like the logic below would handle this case correctly.) If so, at least let's add that to the comment.

        Open in Gerrit

        Related details

        Attention is currently required from:
        • Stephanie Zhang
        Submit Requirements:
        • requirement satisfiedCode-Coverage
        • requirement satisfiedCode-Owners
        • requirement is not satisfiedCode-Review
        • requirement is not satisfiedNo-Unresolved-Comments
        • requirement is not satisfiedReview-Enforcement
        Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
        Gerrit-MessageType: comment
        Gerrit-Project: chromium/src
        Gerrit-Branch: main
        Gerrit-Change-Id: Ic59fced46837275408fb90d601506306a3ef6771
        Gerrit-Change-Number: 7001481
        Gerrit-PatchSet: 9
        Gerrit-Owner: Stephanie Zhang <stephan...@microsoft.com>
        Gerrit-Reviewer: Ana Sollano Kim <anso...@microsoft.com>
        Gerrit-Reviewer: Mason Freed <mas...@chromium.org>
        Gerrit-Reviewer: Stephanie Zhang <stephan...@microsoft.com>
        Gerrit-CC: Dan Clark <dan...@microsoft.com>
        Gerrit-CC: Leo Lee <leo...@microsoft.com>
        Gerrit-Attention: Stephanie Zhang <stephan...@microsoft.com>
        Gerrit-Comment-Date: Mon, 13 Oct 2025 19:03:22 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: Yes
        satisfied_requirement
        unsatisfied_requirement
        open
        diffy

        Stephanie Zhang (Gerrit)

        unread,
        Oct 16, 2025, 3:11:59 PM (3 days ago) Oct 16
        to Mason Freed, Ana Sollano Kim, Leo Lee, Dan Clark, Chromium LUCI CQ, chromium...@chromium.org, blink-re...@chromium.org, blink-rev...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org
        Attention needed from Ana Sollano Kim and Mason Freed

        Stephanie Zhang voted and added 7 comments

        Votes added by Stephanie Zhang

        Commit-Queue+1

        7 comments

        File third_party/blink/renderer/core/dom/form_control_range.h
        Line 58, Patchset 9: // Update |form_control_| after a text replacement at `change_offset`: removes
        Ana Sollano Kim . resolved

        nit: I believe these should also be backticks. Same throughout the paragraph.

        Stephanie Zhang

        Done

        File third_party/blink/renderer/core/dom/form_control_range.cc
        Line 95, Patchset 9: if (form_control_ != text_control) {
        Ana Sollano Kim . resolved

        Should this have a comment like the blocks above?

        Stephanie Zhang

        Good idea - added.

        Line 125, Patchset 9: DCHECK(RuntimeEnabledFeatures::FormControlRangeEnabled());
        Ana Sollano Kim . resolved

        `CHECK` here instead? Since it's a `CHECK` above?

        Stephanie Zhang

        I’ve kept the `DCHECK` here to avoid unnecessary crashes. The constructor `CHECK` already ensures the feature is enabled at creation, so I think `DCHECK` should be sufficient.

        Line 145, Patchset 9:
        Ana Sollano Kim . resolved

        nit: extra line

        Stephanie Zhang

        Done

        Line 134, Patchset 9: // Pure insertion handling (no deletions), matching DOM Range behavior.

        if (deleted_count == 0 && inserted_count > 0) {
        // Collapsed insertion: caret remains before new text.
        if (pre_start == pre_end && change_offset == pre_start) {
        return;
        }
        // Insertion at range start: extend the end to include the new text.
        if (pre_start != pre_end && change_offset == pre_start) {
        end_offset_in_value_ = pre_end + inserted_count;
        return;
        }

        // Insertion at range end: leave the range unchanged.
        if (pre_start != pre_end && change_offset == pre_end) {
        return;
        }
        }
        Mason Freed . resolved

        Is this chunk just an optimization for this special case? (It seems like the logic below would handle this case correctly.) If so, at least let's add that to the comment.

        Stephanie Zhang

        Clarified in the comment: this is a special case to match DOM Range insertion behavior. The generic path mishandles caret/boundary cases. For example, a collapsed range at `[4,4]` with an insert at 4 should stay `[4,4]`, whereas the logic below moves it to `[7,7]`.

        File third_party/blink/renderer/core/html/forms/text_control_element.cc
        Line 1379, Patchset 9: if (!RuntimeEnabledFeatures::FormControlRangeEnabled() ||
        Ana Sollano Kim . resolved
        Should this also be:
        ```
        CHECK(RuntimeEnabledFeatures::FormControlRangeEnabled());
        if (form_control_ranges_.empty()) {
        return;
        }
        ```
        ? Or maybe `NotifyFormControlRangesOfTextChange` should just be in line since it appears to only be called once?
        Stephanie Zhang

        Added the DCHECK - thanks!

        I've kept `NotifyFormControlRangesOfTextChange` for now just in case I need it later. But will definitely in-line it during later cleanup if it's not used anywhere else.

        Line 1402, Patchset 9: if (!RuntimeEnabledFeatures::FormControlRangeEnabled() ||
        Ana Sollano Kim . resolved

        `CHECK` here instead?

        Stephanie Zhang

        Changed to a DCHECK - thanks!

        Open in Gerrit

        Related details

        Attention is currently required from:
        • Ana Sollano Kim
        • Mason Freed
        Submit Requirements:
          • requirement satisfiedCode-Coverage
          • requirement satisfiedCode-Owners
          • requirement is not satisfiedCode-Review
          • requirement is not satisfiedReview-Enforcement
          Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
          Gerrit-MessageType: comment
          Gerrit-Project: chromium/src
          Gerrit-Branch: main
          Gerrit-Change-Id: Ic59fced46837275408fb90d601506306a3ef6771
          Gerrit-Change-Number: 7001481
          Gerrit-PatchSet: 10
          Gerrit-Owner: Stephanie Zhang <stephan...@microsoft.com>
          Gerrit-Reviewer: Ana Sollano Kim <anso...@microsoft.com>
          Gerrit-Reviewer: Mason Freed <mas...@chromium.org>
          Gerrit-Reviewer: Stephanie Zhang <stephan...@microsoft.com>
          Gerrit-CC: Dan Clark <dan...@microsoft.com>
          Gerrit-CC: Leo Lee <leo...@microsoft.com>
          Gerrit-Attention: Ana Sollano Kim <anso...@microsoft.com>
          Gerrit-Attention: Mason Freed <mas...@chromium.org>
          Gerrit-Comment-Date: Thu, 16 Oct 2025 19:11:47 +0000
          Gerrit-HasComments: Yes
          Gerrit-Has-Labels: Yes
          Comment-In-Reply-To: Ana Sollano Kim <anso...@microsoft.com>
          Comment-In-Reply-To: Mason Freed <mas...@chromium.org>
          satisfied_requirement
          unsatisfied_requirement
          open
          diffy

          Ana Sollano Kim (Gerrit)

          unread,
          Oct 16, 2025, 3:51:41 PM (3 days ago) Oct 16
          to Stephanie Zhang, Mason Freed, Leo Lee, Dan Clark, Chromium LUCI CQ, chromium...@chromium.org, blink-re...@chromium.org, blink-rev...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org
          Attention needed from Mason Freed and Stephanie Zhang

          Ana Sollano Kim voted Code-Review+1

          Code-Review+1
          Open in Gerrit

          Related details

          Attention is currently required from:
          • Mason Freed
          • Stephanie Zhang
          Submit Requirements:
          • requirement satisfiedCode-Coverage
          • requirement satisfiedCode-Owners
          • requirement is not satisfiedCode-Review
          • requirement is not satisfiedReview-Enforcement
          Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
          Gerrit-MessageType: comment
          Gerrit-Project: chromium/src
          Gerrit-Branch: main
          Gerrit-Change-Id: Ic59fced46837275408fb90d601506306a3ef6771
          Gerrit-Change-Number: 7001481
          Gerrit-PatchSet: 10
          Gerrit-Owner: Stephanie Zhang <stephan...@microsoft.com>
          Gerrit-Reviewer: Ana Sollano Kim <anso...@microsoft.com>
          Gerrit-Reviewer: Mason Freed <mas...@chromium.org>
          Gerrit-Reviewer: Stephanie Zhang <stephan...@microsoft.com>
          Gerrit-CC: Dan Clark <dan...@microsoft.com>
          Gerrit-CC: Leo Lee <leo...@microsoft.com>
          Gerrit-Attention: Mason Freed <mas...@chromium.org>
          Gerrit-Attention: Stephanie Zhang <stephan...@microsoft.com>
          Gerrit-Comment-Date: Thu, 16 Oct 2025 19:51:31 +0000
          Gerrit-HasComments: No
          Gerrit-Has-Labels: Yes
          satisfied_requirement
          unsatisfied_requirement
          open
          diffy

          Mason Freed (Gerrit)

          unread,
          Oct 17, 2025, 7:28:29 PM (2 days ago) Oct 17
          to Stephanie Zhang, Ana Sollano Kim, Leo Lee, Dan Clark, Chromium LUCI CQ, chromium...@chromium.org, blink-re...@chromium.org, blink-rev...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org
          Attention needed from Stephanie Zhang

          Mason Freed voted and added 2 comments

          Votes added by Mason Freed

          Code-Review+1

          2 comments

          Patchset-level comments
          File-level comment, Patchset 10 (Latest):
          Mason Freed . resolved

          Looks good!

          File third_party/blink/renderer/core/dom/form_control_range.cc
          Line 134, Patchset 9: // Pure insertion handling (no deletions), matching DOM Range behavior.
          if (deleted_count == 0 && inserted_count > 0) {
          // Collapsed insertion: caret remains before new text.
          if (pre_start == pre_end && change_offset == pre_start) {
          return;
          }
          // Insertion at range start: extend the end to include the new text.
          if (pre_start != pre_end && change_offset == pre_start) {
          end_offset_in_value_ = pre_end + inserted_count;
          return;
          }

          // Insertion at range end: leave the range unchanged.
          if (pre_start != pre_end && change_offset == pre_end) {
          return;
          }
          }
          Mason Freed . resolved

          Is this chunk just an optimization for this special case? (It seems like the logic below would handle this case correctly.) If so, at least let's add that to the comment.

          Stephanie Zhang

          Clarified in the comment: this is a special case to match DOM Range insertion behavior. The generic path mishandles caret/boundary cases. For example, a collapsed range at `[4,4]` with an insert at 4 should stay `[4,4]`, whereas the logic below moves it to `[7,7]`.

          Mason Freed

          Ahh, thanks!

          Open in Gerrit

          Related details

          Attention is currently required from:
          • Stephanie Zhang
          Submit Requirements:
            • requirement satisfiedCode-Coverage
            • requirement satisfiedCode-Owners
            • requirement satisfiedCode-Review
            • requirement satisfiedReview-Enforcement
            Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
            Gerrit-MessageType: comment
            Gerrit-Project: chromium/src
            Gerrit-Branch: main
            Gerrit-Change-Id: Ic59fced46837275408fb90d601506306a3ef6771
            Gerrit-Change-Number: 7001481
            Gerrit-PatchSet: 10
            Gerrit-Owner: Stephanie Zhang <stephan...@microsoft.com>
            Gerrit-Reviewer: Ana Sollano Kim <anso...@microsoft.com>
            Gerrit-Reviewer: Mason Freed <mas...@chromium.org>
            Gerrit-Reviewer: Stephanie Zhang <stephan...@microsoft.com>
            Gerrit-CC: Dan Clark <dan...@microsoft.com>
            Gerrit-CC: Leo Lee <leo...@microsoft.com>
            Gerrit-Attention: Stephanie Zhang <stephan...@microsoft.com>
            Gerrit-Comment-Date: Fri, 17 Oct 2025 23:28:19 +0000
            Gerrit-HasComments: Yes
            Gerrit-Has-Labels: Yes
            Comment-In-Reply-To: Mason Freed <mas...@chromium.org>
            Comment-In-Reply-To: Stephanie Zhang <stephan...@microsoft.com>
            satisfied_requirement
            open
            diffy

            Blink W3C Test Autoroller (Gerrit)

            unread,
            Oct 17, 2025, 7:35:27 PM (2 days ago) Oct 17
            to Stephanie Zhang, Mason Freed, Ana Sollano Kim, Leo Lee, Dan Clark, Chromium LUCI CQ, chromium...@chromium.org, blink-re...@chromium.org, blink-rev...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org
            Attention needed from Stephanie Zhang

            Message from Blink W3C Test Autoroller

            Exportable changes to web-platform-tests were detected in this CL and a pull request in the upstream repo has been made: https://github.com/web-platform-tests/wpt/pull/55522.

            When this CL lands, the bot will automatically merge the PR on GitHub if the required GitHub checks pass; otherwise, ecosystem-infra@ team will triage the failures and may contact you.

            WPT Export docs:
            https://chromium.googlesource.com/chromium/src/+/main/docs/testing/web_platform_tests.md#Automatic-export-process

            Open in Gerrit

            Related details

            Attention is currently required from:
            • Stephanie Zhang
            Submit Requirements:
            • requirement satisfiedCode-Coverage
            • requirement satisfiedCode-Owners
            • requirement satisfiedCode-Review
            • requirement satisfiedReview-Enforcement
            Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
            Gerrit-MessageType: comment
            Gerrit-Project: chromium/src
            Gerrit-Branch: main
            Gerrit-Change-Id: Ic59fced46837275408fb90d601506306a3ef6771
            Gerrit-Change-Number: 7001481
            Gerrit-PatchSet: 10
            Gerrit-Owner: Stephanie Zhang <stephan...@microsoft.com>
            Gerrit-Reviewer: Ana Sollano Kim <anso...@microsoft.com>
            Gerrit-Reviewer: Mason Freed <mas...@chromium.org>
            Gerrit-Reviewer: Stephanie Zhang <stephan...@microsoft.com>
            Gerrit-CC: Blink W3C Test Autoroller <blink-w3c-te...@chromium.org>
            Gerrit-CC: Dan Clark <dan...@microsoft.com>
            Gerrit-CC: Leo Lee <leo...@microsoft.com>
            Gerrit-Attention: Stephanie Zhang <stephan...@microsoft.com>
            Gerrit-Comment-Date: Fri, 17 Oct 2025 23:35:20 +0000
            Gerrit-HasComments: No
            Gerrit-Has-Labels: No
            satisfied_requirement
            open
            diffy

            Stephanie Zhang (Gerrit)

            unread,
            Oct 17, 2025, 8:33:42 PM (2 days ago) Oct 17
            to Blink W3C Test Autoroller, Mason Freed, Ana Sollano Kim, Leo Lee, Dan Clark, Chromium LUCI CQ, chromium...@chromium.org, blink-re...@chromium.org, blink-rev...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org

            Stephanie Zhang voted Commit-Queue+2

            Commit-Queue+2
            Open in Gerrit

            Related details

            Attention set is empty
            Submit Requirements:
            • requirement satisfiedCode-Coverage
            • requirement satisfiedCode-Owners
            • requirement satisfiedCode-Review
            • requirement satisfiedReview-Enforcement
            Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
            Gerrit-MessageType: comment
            Gerrit-Project: chromium/src
            Gerrit-Branch: main
            Gerrit-Change-Id: Ic59fced46837275408fb90d601506306a3ef6771
            Gerrit-Change-Number: 7001481
            Gerrit-PatchSet: 10
            Gerrit-Owner: Stephanie Zhang <stephan...@microsoft.com>
            Gerrit-Reviewer: Ana Sollano Kim <anso...@microsoft.com>
            Gerrit-Reviewer: Mason Freed <mas...@chromium.org>
            Gerrit-Reviewer: Stephanie Zhang <stephan...@microsoft.com>
            Gerrit-CC: Blink W3C Test Autoroller <blink-w3c-te...@chromium.org>
            Gerrit-CC: Dan Clark <dan...@microsoft.com>
            Gerrit-CC: Leo Lee <leo...@microsoft.com>
            Gerrit-Comment-Date: Sat, 18 Oct 2025 00:33:32 +0000
            Gerrit-HasComments: No
            Gerrit-Has-Labels: Yes
            satisfied_requirement
            open
            diffy

            Chromium LUCI CQ (Gerrit)

            unread,
            Oct 17, 2025, 11:52:57 PM (2 days ago) Oct 17
            to Stephanie Zhang, Blink W3C Test Autoroller, Mason Freed, Ana Sollano Kim, Leo Lee, Dan Clark, chromium...@chromium.org, blink-re...@chromium.org, blink-rev...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org

            Chromium LUCI CQ submitted the change

            Change information

            Commit message:
            [FormControlRange] Live updates for user typing

            Implement live offset updates for FormControlRange during user-initiated
            edits (typing, backspace/delete, selection replacement). Like DOM Range,
            updates are applied after the observable value mutation and before
            'input' event listeners run. This ensures ranges reflect the new text
            state within the same task in which the edit is observed.

            Ranges shift, contract, or collapse to preserve coverage of the original
            logical substring. A cancelled beforeinput leaves ranges unchanged. A
            pre-edit snapshot taken at beforeinput is committed on the first
            observable value change as a single replace span for stability.

            Follow-up CL(s) for live updates will extend support to programmatic
            edits and richer scenarios (e.g. drag/drop, IME).

            Explainer: github.com/MicrosoftEdge/MSEdgeExplainers/blob/main/FormControlRange/explainer.md
            Low-Coverage-Reason: COVERAGE_UNDERREPORTED
            Bug: 421421332
            Change-Id: Ic59fced46837275408fb90d601506306a3ef6771
            Commit-Queue: Stephanie Zhang <stephan...@microsoft.com>
            Reviewed-by: Ana Sollano Kim <anso...@microsoft.com>
            Reviewed-by: Mason Freed <mas...@chromium.org>
            Cr-Commit-Position: refs/heads/main@{#1531733}
            Files:
            • M third_party/blink/renderer/core/dom/form_control_range.cc
            • M third_party/blink/renderer/core/dom/form_control_range.h
            • M third_party/blink/renderer/core/html/forms/html_text_area_element.cc
            • M third_party/blink/renderer/core/html/forms/text_control_element.cc
            • M third_party/blink/renderer/core/html/forms/text_control_element.h
            • M third_party/blink/renderer/core/html/forms/text_field_input_type.cc
            • A third_party/blink/web_tests/external/wpt/dom/ranges/tentative/FormControlRange-interactive-basic.html
            • A third_party/blink/web_tests/external/wpt/dom/ranges/tentative/FormControlRange-interactive-overlap-and-selection.html
            • A third_party/blink/web_tests/external/wpt/dom/ranges/tentative/FormControlRange-update-event-order.html
            Change size: L
            Delta: 9 files changed, 551 insertions(+), 3 deletions(-)
            Branch: refs/heads/main
            Submit Requirements:
            • requirement satisfiedCode-Review: +1 by Mason Freed, +1 by Ana Sollano Kim
            Open in Gerrit
            Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
            Gerrit-MessageType: merged
            Gerrit-Project: chromium/src
            Gerrit-Branch: main
            Gerrit-Change-Id: Ic59fced46837275408fb90d601506306a3ef6771
            Gerrit-Change-Number: 7001481
            Gerrit-PatchSet: 11
            Gerrit-Owner: Stephanie Zhang <stephan...@microsoft.com>
            Gerrit-Reviewer: Ana Sollano Kim <anso...@microsoft.com>
            Gerrit-Reviewer: Chromium LUCI CQ <chromiu...@luci-project-accounts.iam.gserviceaccount.com>
            Gerrit-Reviewer: Mason Freed <mas...@chromium.org>
            Gerrit-Reviewer: Stephanie Zhang <stephan...@microsoft.com>
            Gerrit-CC: Blink W3C Test Autoroller <blink-w3c-te...@chromium.org>
            open
            diffy
            satisfied_requirement

            Blink W3C Test Autoroller (Gerrit)

            unread,
            Oct 18, 2025, 12:18:07 AM (yesterday) Oct 18
            to Chromium LUCI CQ, Stephanie Zhang, Mason Freed, Ana Sollano Kim, Leo Lee, Dan Clark, chromium...@chromium.org, blink-re...@chromium.org, blink-rev...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org

            Message from Blink W3C Test Autoroller

            The WPT PR for this CL has been merged upstream! https://github.com/web-platform-tests/wpt/pull/55522

            Open in Gerrit

            Related details

            Attention set is empty
            Submit Requirements:
            • requirement satisfiedCode-Coverage
            • requirement satisfiedCode-Owners
            • requirement satisfiedCode-Review
            • requirement satisfiedReview-Enforcement
            Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
            Gerrit-MessageType: comment
            Gerrit-Project: chromium/src
            Gerrit-Branch: main
            Gerrit-Change-Id: Ic59fced46837275408fb90d601506306a3ef6771
            Gerrit-Change-Number: 7001481
            Gerrit-PatchSet: 11
            Gerrit-Owner: Stephanie Zhang <stephan...@microsoft.com>
            Gerrit-Reviewer: Ana Sollano Kim <anso...@microsoft.com>
            Gerrit-Reviewer: Chromium LUCI CQ <chromiu...@luci-project-accounts.iam.gserviceaccount.com>
            Gerrit-Reviewer: Mason Freed <mas...@chromium.org>
            Gerrit-Reviewer: Stephanie Zhang <stephan...@microsoft.com>
            Gerrit-CC: Blink W3C Test Autoroller <blink-w3c-te...@chromium.org>
            Gerrit-CC: Dan Clark <dan...@microsoft.com>
            Gerrit-CC: Leo Lee <leo...@microsoft.com>
            Gerrit-Comment-Date: Sat, 18 Oct 2025 04:18:01 +0000
            Gerrit-HasComments: No
            Gerrit-Has-Labels: No
            satisfied_requirement
            open
            diffy
            Reply all
            Reply to author
            Forward
            0 new messages