Bug 205706 - Enable the offset assertion in HTMLTextFormControlElement::indexForPosition
Summary: Enable the offset assertion in HTMLTextFormControlElement::indexForPosition
Status: REOPENED
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Ryosuke Niwa
URL:
Keywords: InRadar
Depends on: 207725
Blocks: 207724
  Show dependency treegraph
 
Reported: 2020-01-02 19:16 PST by Mark Lam
Modified: 2020-02-13 16:20 PST (History)
19 users (show)

See Also:


Attachments
proposed patch. (2.05 KB, patch)
2020-01-02 19:20 PST, Mark Lam
no flags Details | Formatted Diff | Diff
Enables the assertion (21.53 KB, patch)
2020-01-13 22:42 PST, Ryosuke Niwa
no flags Details | Formatted Diff | Diff
Fixed GTK+ builds (23.63 KB, patch)
2020-01-13 23:01 PST, Ryosuke Niwa
no flags Details | Formatted Diff | Diff
Updated (23.63 KB, patch)
2020-01-13 23:21 PST, Ryosuke Niwa
no flags Details | Formatted Diff | Diff
Patch for landing (23.90 KB, patch)
2020-01-14 19:34 PST, Ryosuke Niwa
no flags Details | Formatted Diff | Diff
Patch for landing (24.71 KB, patch)
2020-01-14 21:15 PST, Ryosuke Niwa
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Lam 2020-01-02 19:16:38 PST
The assertion was guarded by a #ifndef ASSERT_DISABLED.  ASSERT_DISABLED is always defined, either as 0 or 1.  Hence, this assertion code is never ever built.  Changing the #ifndef ASSERT_DISABLED to #if !ASSERT_DISABLED results in a build error.  We should either fix this assertion, or remove it.
Comment 1 Mark Lam 2020-01-02 19:20:14 PST
Created attachment 386653 [details]
proposed patch.
Comment 2 Darin Adler 2020-01-03 19:43:35 PST
Comment on attachment 386653 [details]
proposed patch.

I think this was valuable assertion code; too bad it was left turned off. I understand the code didn’t compile when enabled, but it shouldn’t be too hard to fix. I think it’s likely worth fixing rather than deleting.
Comment 3 Mark Lam 2020-01-03 19:50:04 PST
Comment on attachment 386653 [details]
proposed patch.

Let's fix the assertion instead of deleting it as Darin requested.
Comment 4 Darin Adler 2020-01-03 19:51:00 PST
By the way, there's a chance that when we turn on the assertion we'll see failures, which will mean we'll have to turn it back off again until someone can investigate!
Comment 5 Ryosuke Niwa 2020-01-13 22:42:02 PST
Created attachment 387618 [details]
Enables the assertion
Comment 6 Ryosuke Niwa 2020-01-13 23:01:31 PST
Created attachment 387621 [details]
Fixed GTK+ builds
Comment 7 Mark Lam 2020-01-13 23:04:21 PST
Comment on attachment 387621 [details]
Fixed GTK+ builds

View in context: https://bugs.webkit.org/attachment.cgi?id=387621&action=review

> Source/WebCore/html/HTMLTextFormControlElement.cpp:647
>      // https://bugs.webkit.org/show_bug.cgi?id=205706.

Please remove the above FIXME and bug url comment now that you’re fixing it.
Comment 8 Ryosuke Niwa 2020-01-13 23:09:27 PST
(In reply to Mark Lam from comment #7)
> Comment on attachment 387621 [details]
> Fixed GTK+ builds
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=387621&action=review
> 
> > Source/WebCore/html/HTMLTextFormControlElement.cpp:647
> >      // https://bugs.webkit.org/show_bug.cgi?id=205706.
> 
> Please remove the above FIXME and bug url comment now that you’re fixing it.

Oh oops, removed that.
Comment 9 Ryosuke Niwa 2020-01-13 23:21:58 PST
Created attachment 387625 [details]
Updated
Comment 10 Darin Adler 2020-01-14 09:07:37 PST
Comment on attachment 387625 [details]
Updated

View in context: https://bugs.webkit.org/attachment.cgi?id=387625&action=review

> Source/WebCore/accessibility/AccessibilityRenderObject.cpp:2035
> +    return WebCore::indexForVisiblePosition(*node, position, { TextIteratorLegnthOption::GenerateSpacesForReplacedElements });

Typo here: "legnth".

> Source/WebCore/editing/TextIteratorBehavior.h:64
>  typedef unsigned short TextIteratorBehavior;

Should move this one to OptionSet too later, right?
Comment 11 Ryosuke Niwa 2020-01-14 19:34:03 PST
Created attachment 387747 [details]
Patch for landing
Comment 12 Ryosuke Niwa 2020-01-14 19:34:28 PST
Comment on attachment 387747 [details]
Patch for landing

Wait for EWS.
Comment 13 Ryosuke Niwa 2020-01-14 21:07:21 PST
(In reply to Darin Adler from comment #10)
> Comment on attachment 387625 [details]
> Updated
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=387625&action=review
> 
> > Source/WebCore/accessibility/AccessibilityRenderObject.cpp:2035
> > +    return WebCore::indexForVisiblePosition(*node, position, { TextIteratorLegnthOption::GenerateSpacesForReplacedElements });
> 
> Typo here: "legnth".

Fixed.

> > Source/WebCore/editing/TextIteratorBehavior.h:64
> >  typedef unsigned short TextIteratorBehavior;
> 
> Should move this one to OptionSet too later, right?

Yes, but in a separate patch.
Comment 14 Ryosuke Niwa 2020-01-14 21:15:50 PST
Created attachment 387751 [details]
Patch for landing
Comment 15 Ryosuke Niwa 2020-01-14 21:16:07 PST
Comment on attachment 387751 [details]
Patch for landing

Wait for EWS again.
Comment 16 Ryosuke Niwa 2020-01-14 21:57:41 PST
Committed r254557: <https://trac.webkit.org/changeset/254557>
Comment 17 Radar WebKit Bug Importer 2020-01-14 21:58:13 PST
<rdar://problem/58595369>
Comment 18 WebKit Commit Bot 2020-02-13 15:17:21 PST
Re-opened since this is blocked by bug 207725