Bug 144693 - Measuring the width of a space character is redundant
Summary: Measuring the width of a space character is redundant
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Myles C. Maxfield
URL:
Keywords:
Depends on: 143402
Blocks:
  Show dependency treegraph
 
Reported: 2015-05-06 09:56 PDT by Myles C. Maxfield
Modified: 2015-05-06 20:13 PDT (History)
11 users (show)

See Also:


Attachments
Patch (6.84 KB, patch)
2015-05-06 09:57 PDT, Myles C. Maxfield
zalan: review+
Details | Formatted Diff | Diff
Patch for landing (8.09 KB, patch)
2015-05-06 11:26 PDT, Myles C. Maxfield
buildbot: commit-queue-
Details | Formatted Diff | Diff
Archive of layout-test-results from ews102 for mac-mavericks (1.02 MB, application/zip)
2015-05-06 12:01 PDT, Build Bot
no flags Details
Archive of layout-test-results from ews107 for mac-mavericks-wk2 (1.08 MB, application/zip)
2015-05-06 12:24 PDT, Build Bot
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Myles C. Maxfield 2015-05-06 09:56:31 PDT
Measuring the width of a space character is redundant
Comment 1 Myles C. Maxfield 2015-05-06 09:57:38 PDT
Created attachment 252486 [details]
Patch
Comment 2 Myles C. Maxfield 2015-05-06 10:07:16 PDT
Comment on attachment 252486 [details]
Patch

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

> Source/WebCore/rendering/RenderBlockFlow.cpp:3994
>          const UChar space = ' ';

Unused.
Comment 3 Myles C. Maxfield 2015-05-06 11:26:34 PDT
Created attachment 252497 [details]
Patch for landing
Comment 4 Build Bot 2015-05-06 12:01:31 PDT
Comment on attachment 252497 [details]
Patch for landing

Attachment 252497 [details] did not pass mac-ews (mac):
Output: http://webkit-queues.appspot.com/results/5588724582711296

New failing tests:
fast/ruby/ruby-expansion-cjk-3.html
fast/ruby/ruby-expansion-cjk.html
http/tests/webfont/fallback-font-while-loading.html
fast/ruby/ruby-expansion-cjk-5.html
platform/mac/svg/fonts/svg-font-general.html
platform/mac/fast/text/rounding-hacks.html
fast/ruby/ruby-expansion-cjk-2.html
fast/ruby/ruby-expansion-cjk-4.html
fast/writing-mode/vertical-font-vmtx-units-per-em.html
fast/text/text-combine-different-fonts.html
fast/writing-mode/text-orientation-basic.html
Comment 5 Build Bot 2015-05-06 12:01:35 PDT
Created attachment 252503 [details]
Archive of layout-test-results from ews102 for mac-mavericks

The attached test failures were seen while running run-webkit-tests on the mac-ews.
Bot: ews102  Port: mac-mavericks  Platform: Mac OS X 10.9.5
Comment 6 Build Bot 2015-05-06 12:24:36 PDT
Comment on attachment 252497 [details]
Patch for landing

Attachment 252497 [details] did not pass mac-wk2-ews (mac-wk2):
Output: http://webkit-queues.appspot.com/results/5326887270219776

New failing tests:
fast/ruby/ruby-expansion-cjk-3.html
fast/ruby/ruby-expansion-cjk.html
http/tests/webfont/fallback-font-while-loading.html
fast/ruby/ruby-expansion-cjk-5.html
platform/mac/svg/fonts/svg-font-general.html
platform/mac/fast/text/rounding-hacks.html
fast/ruby/ruby-expansion-cjk-2.html
fast/ruby/ruby-expansion-cjk-4.html
fast/writing-mode/vertical-font-vmtx-units-per-em.html
fast/text/text-combine-different-fonts.html
fast/writing-mode/text-orientation-basic.html
Comment 7 Build Bot 2015-05-06 12:24:39 PDT
Created attachment 252507 [details]
Archive of layout-test-results from ews107 for mac-mavericks-wk2

The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews.
Bot: ews107  Port: mac-mavericks-wk2  Platform: Mac OS X 10.9.5
Comment 8 Myles C. Maxfield 2015-05-06 16:06:51 PDT
Comment on attachment 252497 [details]
Patch for landing

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

> Source/WebCore/rendering/RenderText.cpp:549
> +            maxW -= font.spaceWidth();

This caused this test to fail:

fast/writing-mode/vertical-font-vmtx-units-per-em.html

> Source/WebCore/rendering/RenderText.cpp:715
> +    float wordTrailingSpaceWidth = font.typesettingFeatures() & Kerning ? font.spaceWidth() + wordSpacing : 0;

This caused this test to fail:

fast/writing-mode/text-orientation-basic.html

> Source/WebCore/rendering/SimpleLineLayoutTextFragmentIterator.cpp:184
> +        width = m_style.font.spaceWidth();

This caused this test to fail:

platform/mac/fast/text/rounding-hacks.html

> Source/WebCore/rendering/line/BreakingContext.h:743
> +    float wordTrailingSpaceWidth = (font.typesettingFeatures() & Kerning) && !textLayout ? font.spaceWidth() + wordSpacing : 0;

This caused these tests to fail:

fast/ruby/ruby-expansion-cjk-2.html
fast/ruby/ruby-expansion-cjk-3.html
fast/ruby/ruby-expansion-cjk-4.html
fast/ruby/ruby-expansion-cjk-5.html
fast/ruby/ruby-expansion-cjk.html
fast/text/text-combine-different-fonts.html
http/tests/webfont/fallback-font-while-loading.html
platform/mac/svg/fonts/svg-font-general.html
Comment 9 Myles C. Maxfield 2015-05-06 16:14:11 PDT
http/tests/webfont/fallback-font-while-loading.html shows that this patch is fundamentally incorrect. In particular, the implementation of FontCacade::spaceWidth() is this:

float spaceWidth() const { return primaryFont().spaceWidth() + m_letterSpacing; }

The fact that this disregards fallback fonts means that this function really shouldn't be used as-is. Instead, this functions should have the behavior of the replaced code in this patch.
Comment 10 Myles C. Maxfield 2015-05-06 16:20:46 PDT
(In reply to comment #9)
> http/tests/webfont/fallback-font-while-loading.html shows that this patch is
> fundamentally incorrect. In particular, the implementation of
> FontCacade::spaceWidth() is this:
> 
> float spaceWidth() const { return primaryFont().spaceWidth() +
> m_letterSpacing; }
> 
> The fact that this disregards fallback fonts means that this function really
> shouldn't be used as-is. Instead, this functions should have the behavior of
> the replaced code in this patch.

...Aaaaand we can't use this approach in FontCascade because SVG fonts require a RenderObject for context. This requirements goes away as soon as SVG fonts move entirely to the SVG -> OTF Font Converter.
Comment 11 Myles C. Maxfield 2015-05-06 16:23:20 PDT
Blocked by https://bugs.webkit.org/show_bug.cgi?id=143402