Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(371)

Issue 1189403005: Make wavy underlines go all the way to the end of the inline. (Closed)

Created:
5 years, 6 months ago by Hixie
Modified:
5 years, 6 months ago
CC:
abarth-chromium, eae, gregsimon, jackson_old, mojo-reviews_chromium.org, ojan, qsr+mojo_chromium.org
Base URL:
https://github.com/domokit/mojo.git@master
Target Ref:
refs/heads/master
Project:
mojo
Visibility:
Public.

Description

Make wavy underlines go all the way to the end of the inline. Previously, the wavy underline code only knew how to draw a complete period. This change adds the ability to draw a partial period of the wave. Previously, the code tried, but failed, for reasons I cannot determine, to fit the width of the inline by extending the period to be an integral factor of the width. This is bad because as you type text, the underline wave of earlier characters would jiggle. This fixes that by not changing the period of the wave when the length changes. It's interesting to compare this to the previous code. Here's a test that shows this in Safari/Chrome: http://software.hixie.ch/utilities/js/live-dom-viewer/?saved=3543 Notice how as you type "i"s, the underline changes how far it extends (obviously a bug) but also what the period of the wave is (which looks especially ugly when typing). Firefox, on the other hand, renders something that isn't actually a wave; it's a saw-tooth pattern with straight lines between each direction change. This works for small font sizes at low densities, but is not great on modern screens. This CL addresses this issue by computing the bezier curve control points for the curve that consists of just the remaining fraction of the period. To do this, however, it allocates an object and solves a bezier for x (which includes a numerical integration), which is certainly a performance concern. Apps that try to wavy-underline an entire UI are going to maybe suffer. Since this is typically going to be used for spelling checkers, it means people who spell better will have better performance. (I haven't tested this to see what the perf impact actually is. If it's actually bad, we can probably cache the results of the integration pretty trivially.) R=eseidel@chromium.org Committed: https://chromium.googlesource.com/external/mojo/+/141b69fe583acb20592ec700c137578ca9f27438

Patch Set 1 #

Patch Set 2 : fix the math so it doesn't crash #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+28 lines, -21 lines) Patch
M sky/engine/core/rendering/InlineTextBox.cpp View 1 3 chunks +28 lines, -21 lines 2 comments Download

Messages

Total messages: 10 (2 generated)
abarth-chromium
Sorry, don't see anything obvious that might crash.
5 years, 6 months ago (2015-06-20 06:00:09 UTC) #2
Hixie
On 2015/06/20 at 06:00:09, abarth wrote: > Sorry, don't see anything obvious that might crash. ...
5 years, 6 months ago (2015-06-22 21:59:36 UTC) #3
eseidel
Ojan/eae FYI. https://codereview.chromium.org/1189403005/diff/20001/sky/engine/core/rendering/InlineTextBox.cpp File sky/engine/core/rendering/InlineTextBox.cpp (right): https://codereview.chromium.org/1189403005/diff/20001/sky/engine/core/rendering/InlineTextBox.cpp#newcode871 sky/engine/core/rendering/InlineTextBox.cpp:871: OwnPtr<UnitBezier> bezier = adoptPtr(new UnitBezier((Curve::x(controlPoint1) - x) ...
5 years, 6 months ago (2015-06-22 22:10:03 UTC) #5
eae
Thanks Eric!
5 years, 6 months ago (2015-06-22 22:15:44 UTC) #6
eseidel
We checked and Blink and Safari both have identical code here. It's guarded behind a ...
5 years, 6 months ago (2015-06-22 22:22:37 UTC) #7
eseidel
lgtm
5 years, 6 months ago (2015-06-22 22:36:51 UTC) #8
eseidel
Please update your lines to have spaces around your operators, but otherwise lgtm. Can we ...
5 years, 6 months ago (2015-06-22 22:37:25 UTC) #9
Hixie
5 years, 6 months ago (2015-06-22 22:43:10 UTC) #10
Message was sent while issue was closed.
Committed patchset #2 (id:20001) manually as
141b69fe583acb20592ec700c137578ca9f27438 (presubmit successful).

Powered by Google App Engine
This is Rietveld 408576698