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

Issue 1160623002: Avoid resetting the metrics-list/character offset for each text box (Closed)

Created:
5 years, 7 months ago by fs
Modified:
5 years, 6 months ago
Reviewers:
pdr., f(malita)
CC:
blink-reviews, blink-reviews-rendering, krit, eae+blinkwatch, f(malita), fs, gyuyoung2, jchaffraix+rendering, kouhei+svg_chromium.org, leviw+renderwatch, pdr+renderingwatchlist_chromium.org, pdr+svgwatchlist_chromium.org, rwlbuis, Stephen Chennney, szager+layoutwatch_chromium.org, zoltan1
Target Ref:
refs/heads/master
Project:
blink
Visibility:
Public.

Description

Avoid resetting the metrics-list/character offset for each text box SVGTextLayoutEngine::layoutTextOnLineOrPath needs to keep track of the SVGTextMetrics corresponding to each glyph it layouts. To do this, the members m_visual{Character,MetricsList}Offset are used. However, this state is reset for each invocation, which means that finding the starting metrics entry can yield O(N^2) behavior. For text nodes with many (logically consecutive) text boxes, this can become noticeable. Introduce a helper SVGTextMetricsIterator - replacing the m_visual* members - and let it persist across calls to layoutTextOnLineOrPath. This speeds up the case of many logically consecutive text boxes. Using the PerfTestRunner.measurePageLoadTime harness with separate-x.svg from the bug give the following results locally: Before: After: avg 101.5 ms -> 93.1 ms median 101.1 ms -> 93.1 ms stdev 2.8 ms -> 2.3 ms BUG=486669 Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=196054

Patch Set 1 #

Total comments: 16

Patch Set 2 : Shake, rattle and roll. #

Patch Set 3 : Rebase. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+77 lines, -66 lines) Patch
M Source/core/layout/svg/LayoutSVGInlineText.h View 1 1 chunk +51 lines, -0 lines 0 comments Download
M Source/core/layout/svg/SVGTextLayoutEngine.h View 1 2 4 chunks +3 lines, -7 lines 0 comments Download
M Source/core/layout/svg/SVGTextLayoutEngine.cpp View 1 2 13 chunks +23 lines, -59 lines 0 comments Download

Messages

Total messages: 10 (3 generated)
fs
5 years, 7 months ago (2015-05-26 14:28:20 UTC) #2
f(malita)
Nice, LGTM w/ nits. https://codereview.chromium.org/1160623002/diff/1/Source/core/layout/svg/SVGTextLayoutEngine.cpp File Source/core/layout/svg/SVGTextLayoutEngine.cpp (right): https://codereview.chromium.org/1160623002/diff/1/Source/core/layout/svg/SVGTextLayoutEngine.cpp#newcode338 Source/core/layout/svg/SVGTextLayoutEngine.cpp:338: const Vector<SVGTextMetrics>* metricsList = &textLayoutObject.layoutAttributes()->textMetricsValues(); ...
5 years, 7 months ago (2015-05-27 01:53:50 UTC) #3
pdr.
https://codereview.chromium.org/1160623002/diff/1/Source/core/layout/svg/SVGTextLayoutEngine.cpp File Source/core/layout/svg/SVGTextLayoutEngine.cpp (right): https://codereview.chromium.org/1160623002/diff/1/Source/core/layout/svg/SVGTextLayoutEngine.cpp#newcode310 Source/core/layout/svg/SVGTextLayoutEngine.cpp:310: void SVGTextLayoutEngine::finishLayout() m_metricsList feels like a use after free ...
5 years, 7 months ago (2015-05-27 03:11:18 UTC) #4
fs
Code-shuffled somewhat in accordance with suggestions. https://codereview.chromium.org/1160623002/diff/1/Source/core/layout/svg/SVGTextLayoutEngine.cpp File Source/core/layout/svg/SVGTextLayoutEngine.cpp (right): https://codereview.chromium.org/1160623002/diff/1/Source/core/layout/svg/SVGTextLayoutEngine.cpp#newcode310 Source/core/layout/svg/SVGTextLayoutEngine.cpp:310: void SVGTextLayoutEngine::finishLayout() On ...
5 years, 7 months ago (2015-05-27 12:53:14 UTC) #5
pdr.
LGTM
5 years, 7 months ago (2015-05-27 14:18:33 UTC) #6
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1160623002/40001
5 years, 6 months ago (2015-05-28 11:17:47 UTC) #9
commit-bot: I haz the power
5 years, 6 months ago (2015-05-28 11:21:22 UTC) #10
Message was sent while issue was closed.
Committed patchset #3 (id:40001) as
https://src.chromium.org/viewvc/blink?view=rev&revision=196054

Powered by Google App Engine
This is Rietveld 408576698