Bug 3692 - Word-spacing doesn't work as expected
Summary: Word-spacing doesn't work as expected
Status: CLOSED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: 412
Hardware: Mac OS X 10.4
: P2 Normal
Assignee: Oliver Hunt
URL: http://www.mvcounseling.nl
Keywords:
: 3793 (view as bug list)
Depends on:
Blocks:
 
Reported: 2005-06-24 01:29 PDT by Joost de Valk (AlthA)
Modified: 2005-08-28 03:09 PDT (History)
1 user (show)

See Also:


Attachments
Screenshot of safari behavior. (33.57 KB, image/tiff)
2005-06-24 01:30 PDT, Joost de Valk (AlthA)
no flags Details
Screenshot of mozilla behavior (29.34 KB, image/tiff)
2005-06-24 01:32 PDT, Joost de Valk (AlthA)
no flags Details
Testcase for word-spacing (258 bytes, text/html)
2005-06-24 01:33 PDT, Joost de Valk (AlthA)
no flags Details
tesctase in xhtml strict (370 bytes, application/xhtml+xml)
2005-06-24 01:35 PDT, Joost de Valk (AlthA)
no flags Details
fix for xhtml strict test. (327 bytes, application/xhtml+xml)
2005-06-24 01:37 PDT, Joost de Valk (AlthA)
no flags Details
better fix for xhtml test (366 bytes, application/xhtml+xml)
2005-06-24 01:41 PDT, Joost de Valk (AlthA)
no flags Details
More blatantly obvious breakge (276 bytes, text/html)
2005-07-01 05:34 PDT, Oliver Hunt
no flags Details
über-test-case (2.08 KB, text/html)
2005-07-01 12:26 PDT, Joost de Valk (AlthA)
no flags Details
Prelim Patch (11.53 KB, patch)
2005-07-05 04:55 PDT, Oliver Hunt
no flags Details | Formatted Diff | Diff
Corrected formatting (11.53 KB, patch)
2005-07-05 06:01 PDT, Oliver Hunt
no flags Details | Formatted Diff | Diff
Uber patch to fix all wordspacing issues (13.76 KB, patch)
2005-07-08 00:50 PDT, Oliver Hunt
no flags Details | Formatted Diff | Diff
Uber patch to fix all wordspace issues (13.51 KB, patch)
2005-07-08 03:14 PDT, Oliver Hunt
no flags Details | Formatted Diff | Diff
layout test input (11.50 KB, text/html)
2005-07-08 03:19 PDT, Oliver Hunt
no flags Details
expected output from wordspacing test (68.24 KB, text/plain)
2005-07-08 03:20 PDT, Oliver Hunt
no flags Details
Fixed and remerged patch (13.24 KB, patch)
2005-07-31 02:49 PDT, Oliver Hunt
no flags Details | Formatted Diff | Diff
reformatted patch (13.25 KB, patch)
2005-07-31 17:24 PDT, Oliver Hunt
no flags Details | Formatted Diff | Diff
Yet more reformatting (13.26 KB, patch)
2005-07-31 17:35 PDT, Oliver Hunt
no flags Details | Formatted Diff | Diff
layout test input (11.75 KB, text/html)
2005-08-01 22:23 PDT, Oliver Hunt
no flags Details
layout test expected (68.34 KB, text/plain)
2005-08-01 22:24 PDT, Oliver Hunt
no flags Details
More reformatting (13.26 KB, patch)
2005-08-01 23:05 PDT, Oliver Hunt
no flags Details | Formatted Diff | Diff
Wordspace patch with hopefully correct formatting (12.29 KB, patch)
2005-08-03 23:57 PDT, Oliver Hunt
mjs: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Joost de Valk (AlthA) 2005-06-24 01:29:21 PDT
Word-spacing works perfectly on plain text, but as soon as an other tag is placed around text, like span or 
an anchor, the word-spacing doesn't take place anymore. This behavior is different than behavior in IE 
5:mac and Firefox. Will attach a testcase and screenshots of safari and firefox behavior.

This actually breaks my mother's site in safari, please fit it ;).
Comment 1 Joost de Valk (AlthA) 2005-06-24 01:30:59 PDT
Created attachment 2617 [details]
Screenshot of safari behavior.
Comment 2 Joost de Valk (AlthA) 2005-06-24 01:32:46 PDT
Created attachment 2618 [details]
Screenshot of mozilla behavior

Correct behavior in my opinion.
Comment 3 Joost de Valk (AlthA) 2005-06-24 01:33:23 PDT
Created attachment 2619 [details]
Testcase for word-spacing
Comment 4 Joost de Valk (AlthA) 2005-06-24 01:35:48 PDT
Created attachment 2621 [details]
tesctase in xhtml strict
Comment 5 Joost de Valk (AlthA) 2005-06-24 01:37:44 PDT
Created attachment 2622 [details]
fix for xhtml strict test.
Comment 6 Joost de Valk (AlthA) 2005-06-24 01:41:19 PDT
Created attachment 2623 [details]
better fix for xhtml test
Comment 7 Joost de Valk (AlthA) 2005-06-24 01:48:52 PDT
in xhtml, it doesn't seem to work at all in this test. it seems as tho the inline style information is 
completely ignored.
Comment 8 Oliver Hunt 2005-07-01 05:34:21 PDT
Created attachment 2728 [details]
More blatantly obvious breakge

This test case uses the same word, and monospace for the font family, in order
to make or easier to work out what is going on...
Comment 9 Joost de Valk (AlthA) 2005-07-01 12:26:15 PDT
Created attachment 2734 [details]
über-test-case
Comment 10 Oliver Hunt 2005-07-05 04:55:41 PDT
Created attachment 2810 [details]
Prelim Patch

Okay, this patch is far from tidy, and currently conflicts with the current
patch for bug 3793 (which it will either replace or depend on :) )
Comment 11 Oliver Hunt 2005-07-05 06:01:26 PDT
Created attachment 2812 [details]
Corrected formatting
Comment 12 Oliver Hunt 2005-07-06 01:25:04 PDT
Comment on attachment 2812 [details]
Corrected formatting

Removing review request as patch no longer applies to ToT
Comment 13 Oliver Hunt 2005-07-08 00:50:44 PDT
Created attachment 2862 [details]
Uber patch to fix all wordspacing issues

This will probably need to be tested for performance related badness
Comment 14 Oliver Hunt 2005-07-08 00:52:09 PDT
Comment on attachment 2862 [details]
Uber patch to fix all wordspacing issues

Among other things this will definitely need a performance review of some kind
Comment 15 Oliver Hunt 2005-07-08 03:14:12 PDT
Created attachment 2863 [details]
Uber patch to fix all wordspace issues
Comment 16 Oliver Hunt 2005-07-08 03:19:10 PDT
Created attachment 2864 [details]
layout test input

Testcase to match soon to be attached dumprendertree output
Comment 17 Oliver Hunt 2005-07-08 03:20:23 PDT
Created attachment 2865 [details]
expected output from wordspacing test
Comment 18 Darin Adler 2005-07-25 11:55:07 PDT
Comment on attachment 2864 [details]
layout test input

Looks like a good layout test.
Comment 19 Darin Adler 2005-07-25 11:55:36 PDT
Comment on attachment 2865 [details]
expected output from wordspacing test

We don't really need to do the patch review process on the expected output, so
I'm removing the flag.
Comment 20 Oliver Hunt 2005-07-31 02:49:44 PDT
Created attachment 3171 [details]
Fixed and remerged patch

Okay this fixes the word-spacing patch to work with current ToT
Comment 21 Darin Adler 2005-07-31 15:53:02 PDT
Comment on attachment 3171 [details]
Fixed and remerged patch

There are some minor formatting issues with the patch, for example:

+	     if(r->box->isInlineTextBox()){
+	       InlineTextBox * text=static_cast<InlineTextBox*>(r->box);

should instead be:

	    if (r->box->isInlineTextBox()) {
	      InlineTextBox *text = static_cast<InlineTextBox *>(r->box);

I think Dave Hyatt should be the one to do a real review of this.
Comment 22 Oliver Hunt 2005-07-31 17:24:57 PDT
Created attachment 3185 [details]
reformatted patch

Reformatted to (hopefully) match coding guidelines
Comment 23 Oliver Hunt 2005-07-31 17:35:24 PDT
Created attachment 3186 [details]
Yet more reformatting
Comment 24 Darin Adler 2005-07-31 17:43:04 PDT
Comment on attachment 3186 [details]
Yet more reformatting

Formatting looks pretty good now.

Could still use a little tweaking to make spaces match how we usually do them.
For example:

+    void setStart(uint start) {m_start=start;}

would normally be:

    void setStart(uint start) { m_start=start; }

But the more important issue here than formatting is getting a conceptual
review from Dave Hyatt and some performance testing. I'd love to see this patch
land soon, but both of those have to happen first.
Comment 25 Eric Seidel (no email) 2005-08-01 21:47:00 PDT
Ran autovicki per olliej's request.  AV showed no regression:

Before:
TestSuite: PageLoadTest
TestType: cvs-base
OSVersion: 8C46
SafariVersion: (v412+)
Machine Model: PowerBook G4 12"
Number Of CPUs: 1
CPU Speed: 1.33 GHz
Memory: 1.25 GB
Date: Mon Aug  1 21:32:36 PDT 2005
==================================

cvs-base Cold:      	0.418
cvs-base Uncached:      0.225
cvs-base AvgCached:     0.158
cvs-base Cached 1:  0.159
cvs-base Cached 2:  0.158
cvs-base Cached 3:  0.158
cvs-base Cached 4:  0.159
cvs-base Cached 5:  0.157



After:
TestSuite: PageLoadTest
TestType: cvs-base
OSVersion: 8C46
SafariVersion: (v412+)
Machine Model: PowerBook G4 12"
Number Of CPUs: 1
CPU Speed: 1.33 GHz
Memory: 1.25 GB
Date: Mon Aug  1 21:39:23 PDT 2005
==================================

cvs-base Cold:      	0.430
cvs-base Uncached:      0.226
cvs-base AvgCached:     0.158
cvs-base Cached 1:  0.160
cvs-base Cached 2:  0.159
cvs-base Cached 3:  0.158
cvs-base Cached 4:  0.159
cvs-base Cached 5:  0.158
Comment 26 Oliver Hunt 2005-08-01 22:23:59 PDT
Created attachment 3205 [details]
layout test input

Fixed misleading text
Comment 27 Oliver Hunt 2005-08-01 22:24:56 PDT
Created attachment 3206 [details]
layout test expected
Comment 28 Oliver Hunt 2005-08-01 23:05:16 PDT
Created attachment 3207 [details]
More reformatting

Hopefully this should be the last of the reformatting
Comment 29 Dave Hyatt 2005-08-02 00:00:51 PDT
Comment on attachment 3207 [details]
More reformatting

Patch seems ok conceptually.  Just needs some clean-up in terms of formatting. 
Some comments:

(1) There's a lot of 2-space indentation being used.  Our standard is 4-space
indentation, so go over the patch and make sure the indentation is correct.

(2) You patched some dead code (slated for removal) in font.cpp.  I don't see
any reason to update that code path.  You can just leave those changes out of
the patch.

(3) Make sure to match our coding conventions.	I know a lot of the surrounding
code does not, but make sure new code does.  For example, this line:

+	     if ( (r->start == 0) && needsWordSpacing &&
(rt->text()[r->start].isSpace()) ) {
+	       effectiveWidth += rt->htmlFont(m_firstLine)->getWordSpacing();
+	     }

Get rid of the extra spaces after the opening of the if ( and before the ). 
Also get rid of the unnecessary braces.

(5) For this line:

+    if (needsWordSpacing && len>1) 


len > 1 rather than len>1.  Yes, I know a lot of the surrounding code doesn't
obey current conventions, but it's all due for a big cleanup soon. :)

Logically everything looks great.  Let's just get all the formatting nitpicks
out of the way and then we can get this landed.

I do think (since compacts have been touched a bit) that the word-spacing uber
test should test display: compact to make sure word-spacing is properly
factoring in to the calculations for whether or not they can fit in the block's
margin.
Comment 30 Oliver Hunt 2005-08-03 23:57:38 PDT
Created attachment 3221 [details]
Wordspace patch with hopefully correct formatting
Comment 31 Darin Adler 2005-08-04 11:27:23 PDT
Comment on attachment 2864 [details]
layout test input

Just clearing the review flag from this layout test because otherwise this
shows up in "reviewed patches that need to be committed" queries.
Comment 32 Maciej Stachowiak 2005-08-14 03:54:15 PDT
Comment on attachment 3221 [details]
Wordspace patch with hopefully correct formatting

This does still have one minor coding style issue:

+		 if ((r->start == 0) && needsWordSpacing &&
(rt->text()[r->start].isSpace())) {
+		     effectiveWidth +=
rt->htmlFont(m_firstLine)->getWordSpacing();
+		 }


shouldn't be braces here. But let's say review+ anyway.
Comment 33 Oliver Hunt 2005-08-17 02:58:10 PDT
*** Bug 3793 has been marked as a duplicate of this bug. ***