Skip to content

[css-text-3] break spaces - #111

Merged
kojiishi merged 6 commits into
w3c:masterfrom
frivoal:florian/break-spaces
Sep 20, 2016
Merged

[css-text-3] break spaces#111
kojiishi merged 6 commits into
w3c:masterfrom
frivoal:florian/break-spaces

Conversation

@frivoal

@frivoal frivoal commented May 13, 2016

Copy link
Copy Markdown
Collaborator

No description provided.

frivoal added 2 commits May 13, 2016 00:21
Based on resolutions from the 2016 San Francisco and Sydney Face-to-face
meetigns.
As resolved at the 2016 Sydney face-to-face meeting.
This 'pre-wrap-auto' had already been removed from Level 3,
but was still in level 4.
Comment thread css-text/Overview.bs
the UA must either <a>hang</a> the <a>white space</a>
or visually collapse their character advance widths
such that they don't take up space in the line.
However, if 'overflow-wrap' is set to ''break-spaces'',

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When ''break-spaces'', spaces breaks, so it no longer be "at the end of a line". I think I understand your intention but it can confuse rather than help. Maybe you could add such note that this will not happen if ''break-spaces'' if you think having text here is important?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When 'break-spaces' is specified, spaces should break. But this would not happen if they have already been collapsed, so I am trying to (normatively) make it explicit that you cannot do that. I thought this text was easier to understand here than in the definition of the break-spaces value. Do you think it should be moved? Do you have a suggestion of a better way to phrase it?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By re-reading this, you're modifying an item that I don't understand, so it's not your problem, but you'd have to ask fantasai to review.

This item starts with:

If spaces or tabs at the end of a line are non-collapsible but have 'white-space' set to ''pre-wrap''

but I can't interpret this part. Does this "but" mean "except"? Maybe clear to native speakers but this is beyond my English capability, sorry.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this "but" could just as easily be replaced with "and". We're talking about a subset of of the non-collapsible spaces. "If there are non-collapsible spaces and when 'white-space' is set to ''pre-wrap''" is the same as "if there are non-collapsible spaces, but [only in the case when] 'white-space' set to ''pre-wrap''"

@frivoal frivoal assigned kojiishi and unassigned fantasai May 25, 2016
@frivoal

frivoal commented Jun 16, 2016

Copy link
Copy Markdown
Collaborator Author

@kojiishi @fantasai Ping. Can you either merge this or tell me what's wrong with it?

Comment thread css-text/Overview.bs Outdated
<dd>Line breaks are handled identically to ''overflow-wrap/normal'',
except that any sequence of <a>preserved</a> white space
that would otherwise overflow the line under these rules
must be broken after the last white space character that would fit the line.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So when you say

sequence of preserved white space...must be broken

you want to break between preserved white spaces but not before/after? Can you try to clarify?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would this be clearer?

Line breaks are handled identically to ''overflow-wrap/normal'',
except that if a sequence of preserved white space
would otherwise overflow the line under these rules,
the line must be broken after the last white space character of that sequence
that would fit the line.

This is meant to be the same behavior, but should be more explicit. Break in places unrelated to the white space sequence are allowed as usual; it allows the break to happen after the last character in the sequence. It does not create a break opportunity between the first white space character in the sequence and whatever comes before it, to avoid wrapping a single space to the next line (I think you were the first to suggest that that would be a bad idea).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As a member, I still don't understand why one would want this, but as an editor, I can review PRs according to resolutions. That makes me a good reviewer though. Since I don't understand how it's used, I can review how the text reads to implementors without any background ;-)

What will happen if there are no spaces that can fit?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the delayed answer.

If there is no spaces that would fit, you deal with it the way you would otherwise: break the line somewhere earlier if you can, or overflow if you cannot.

I don't actually have a strong opinion whether we should allow a break before the first space in a sequence of not, but I believe you were the one who expressed a preference for disallowing it.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please make a call, as I said, I don't understand how it's used.

So from what I understand, when all of the following condition met:

  • If white-space: pre-wrap and
  • if a non-breakable word and at least one trailing space fit within the line, and
  • If subsequent spaces follow, and
  • If those subsequent spaces do not fit within the line

You want to break between spaces, but not before/after?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very sorry for the slow answer.

You want to break between spaces

correct, if overflow-wrap is break-spaces. you break and wrap in the middle of the space sequence instead of letting it overflow.

but not before

Not before the first space if overflow-wrap is only break-spaces. If it is overflow-wrap:break-word | break-spaces, you can also break before the first space, since overflow-wrap: break-word allows for breaks anywhere.

I think this is the best behavior, but I am not very strongly attached to this nuance, so if the rest of the proposal is OK and this is blocking, I am open to changing this part.

or after?

I don't think there's anything in the wording I proposed that prohibits breaking after spaces. If the end of the line falls earlier than the last space, you should break at that earlier point, but if it falls right after that space, breaking there is the normal thing to do.


2 questions:

  • Are you OK with the behavior?
  • Do you think the proposed text (a) correctly and (b) understandably describes this behavior?

@frivoal frivoal added the css-text-3 Current Work label Jun 26, 2016
@frivoal frivoal changed the title break spaces [css-text-3] break spaces Jun 26, 2016
@frivoal

frivoal commented Sep 12, 2016

Copy link
Copy Markdown
Collaborator Author

@kojiishi @fantasai this PR has been open for pretty long now, and I'd like to wrap it up. In light of my answer to Koji's question, can you either merge it, or tell me if you either want more clarification or some change to the proposed text?

If there is anything left to be tweaked, I'd like to make sure that we get it done before the end of TPAC, so if you'd like me to prepare something before then, let me know what.

@kojiishi

Copy link
Copy Markdown
Contributor

Sorry for my slow response too but the PR doesn't look to address a case when it says:

after the last white space character that would fit the line.

it doesn't define the behavior when there's no white space that would fit the line, correct?

Also I prefer it be effective only when white space is preserved by the white-space property, rather than making the preservation automatically activated by the overflow-wrap, unless it was discussed and resolved (sorry if it did, in that case, I'm ok.)

This does not change the intended behavior, but the previous
phrasing was ambiguous about some situations, and this should clarify.
@frivoal

frivoal commented Sep 13, 2016

Copy link
Copy Markdown
Collaborator Author

@kojiishi

doesn't look to address a case when it says:

after the last white space character that would fit the line.

it doesn't define the behavior when there's no white space that would fit the line, correct?

Hmmm. I thought the sentence was clear, but having re-read it a couple times, I see what you mean. I've pushed a rewording with a couple of clarifying notes. I think this now defines all cases. Let me know if you think it doesn't.

Also I prefer it be effective only when white space is preserved by the white-space property

Since this value only affects what happens in runs of preserved white space, in most cases, it will not do anything if the white-space property is not preserving the white spaces. The difference with what you are suggesting is that as currently specified, it would also call for breaks in overflowing runs of &nbsp;. I'd rather keep it that way: I'd find it pretty counter intuitive if a value called break-spaces did not do that.

If you agree, great. If you don't (and there's no other issue left), can we get this merged, and open a separate issue to discuss this point?

Comment thread css-text/Overview.bs Outdated
<dt><dfn>break-spaces</dfn></dt>
<dd>Line breaks are handled as usual,
except that any sequence of <a>preserved</a> white space
that would otherwise overflow the line and <a>hang</a> as per <a href="white-space-phase-2">Trimming and Positioning</a>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isn't "#" needed for "white-space-phase-2"?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right. Fixed.

@kojiishi

Copy link
Copy Markdown
Contributor

Thanks for the update, that part looks good, except one possible nit I put as an inline comment. Please check.

If you agree, great. If you don't (and there's no other issue left), can we get this merged, and open a separate issue to discuss this point?

I feel sorry for taking long on this small PR but I prefer to split it out to another PR, discuss and resolve before the merge. I suspect our code reviewers will ask for a spec change if someone tries to contribute to Blink, so I'd like not to take that long path.

  • We need to check whether white spaces collapses or not on every page, so adding this condition will add slight cost for the additional if statement on every page on every user. It is a very hot code path we try hard to optimize, and I don't think this property is worth the cost for everyone.
  • This property is only effective when white-space allows wrapping. break-space being only effective when white-space does not collapse looks more consistent to me. There are other such example, such as text-orientation, which is only effective in vertical flow. That way, we pay the cost to check the property only in vertical flow.
  • I understand how you feel it more intuitive, but from another perspective, it's unintuitive to break consecutive white spaces when there are no such white spaces. I feel more intuitive for authors to create consecutive white spaces first before s/he allows them to break.

This PR looks good to me if this part was separated.

@kojiishi

Copy link
Copy Markdown
Contributor

Discussed offline to resolve misunderstandings, lgtm.

@kojiishi
kojiishi merged commit 995a077 into w3c:master Sep 20, 2016
birtles pushed a commit to birtles/csswg-drafts that referenced this pull request Sep 20, 2016
* [css-text] Add 'break-spaces'

Based on resolutions from the 2016 San Francisco and Sydney Face-to-face
meetigns.

* [css-text-4] Remove 'pre-wrap-auto' from Level 4

As resolved at the 2016 Sydney face-to-face meeting.
This 'pre-wrap-auto' had already been removed from Level 3,
but was still in level 4.

* [css-text] Rephrase 'break-spaces' description

This does not change the intended behavior, but the previous
phrasing was ambiguous about some situations, and this should clarify.

* [css-text] Fix typo in markup
birtles added a commit to birtles/csswg-drafts that referenced this pull request Dec 4, 2017
frivoal pushed a commit to frivoal/csswg-drafts that referenced this pull request Nov 15, 2018
@frivoal frivoal added the Tested Memory aid - issue has WPT tests label Apr 25, 2019
@frivoal
frivoal deleted the florian/break-spaces branch June 5, 2020 01:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

css-text-3 Current Work Tested Memory aid - issue has WPT tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants