-
Notifications
You must be signed in to change notification settings - Fork 63
Added the defintion for fxl viewports in xhtml #2341
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The CSS spec is a mapping from the Apple definition to the The Apple definition only allows a limited range of numeric values that are defined as being in pixels plus the device-width and device-height keywords, so I would take that as the formal definition we should use, and we should also account for the range restriction. If you look at the mapping for these properties in the CSS spec, it also only accounts for these values.
The fourth rule in the parsing section states:
Is a missing value an unknown value? There is a condition where you get an auto width defined further down, but that applies only if you parse the initial-zoom to something other than auto, but we don't account for that property. |
|
@mattgarrish I am not sure about all that you are saying.
I must admit that the CSS Device Adaptation module was unknown to me (I am unable to keep track of all the CSS specs) Personally, I would be happy to simplify the definition to rely on simply numbers... |
The assumption on the call last night (but others can correct me if I'm wrong here) was that other value declarations are allowed, but rereading the relevant documents this morning I can't find any evidence that's true. I don't think we should be creating a new definition of the viewport meta tag that allows any type of declaration, or that adds units (even for pixels). The Apple definition is the originator of this property, as the CSS spec mentions, and is what we based the original FXL requirement on. The CSS spec is trying to replace the meta tag with a CSS property, but even if that happens it'd be too late to change how we process FXLs. @bduga also mentioned last night that if someone tries to declare a unit they just strip it and use whatever numeric value was input as pixels. |
|
Or put another way, we need to be careful that our definition reproduces the viewport |
|
I think simplification helps here. They must be positive numbers, we were reluctant to say they must be pixels because there is potential for other values there and we didn't want to invalidate current content. I think the language around defaulting to pixels in the absence of any other value is ok. |
|
I think we should require a positive number only, no units or other text, and the implied unit is pixels. That, at least, is the Play behavior. I don't think CSS units in non-style attributes are common, and there is certainly no specification for this element that allows them here. I did mention that Play will just read the leading number, so "145", "145px", and "145em" will all be allowed and treated as 145 pixels. But that shouldn't go in the spec, that is just us trying to deal with silly things we get in practice as best we can. |
|
I have updated the viewport definition. It now says:
I have also added a paragraph to the reading system spec:
I think we should not mention the missing value in the core spec (let that be an error to be found by ebupcheck), but something has to be said on the RS as an error behaviour... |
I thought we were allowing for other values but not defining them ourselves? While I expect height/width will normally be paired, do we want to require it and allow other values? Will that confuse people? Doesn't this definition make whitespace illegal, too? That's likely to invalidate existing content. We could say in the RS spec to remove all whitespace from the meta tag's value before processing rather than put it on authors. Also, aren't we were allowing the The Apple definition also has a restriction similar to what @bduga has mentioned:
Should we formalize this in our definition? |
Personally, unless there is a deployment for more, I would keep it simple. These are the possible values and only these.
Yep, we should probably say that any number of spaces (or whitespaces) are allowed before and after the "," character.
Well, we should make clear the space to allow the content to be accepted by epubcheck.
No idea, to be honest. I mean: this is the first time I see these, I must admit, and what I do not know if there are fxl documents using these. If there are, we must allow for it (sigh. The definition becomes a bit more complicated...)
I would keep it simple: the content document should allow a positive number (with a possible device-height/width values), period. We can add, if we want, that type of sentence for the RS spec as a possible strategy for handling illegal values. But only as a SHOULD; RS may choose to simply ignore the values altogether. My 2 cents...
|
The spec has allowed whatever is valid per the Apple definition for going on 10 years now, so can you be sure this new definition won't invalidate existing content? Technically, it hasn't even been required to use a comma to separate the values, since that's valid per the definition, too. |
Sigh. Technically, this is true. Although I am almost sure that implementers did copy-paste starting with the examples in the spec, we cannot be sure of that. I have not enough experience with FXL documents to decide on that...
Sigh... Trying to summarize the changes that may cover current practice and may be enough:
This could cover the formal specification of the format. We can then add a set of advices to the RS what to do with missing or erroneous values, and numbers with some extra characters. To avoid epubcheck to throw out these types of values, we may also have to add some extra text whereby these types of extras MAY be used, but their usage is deprecated. Would that work? |
|
B.t.w., looking at https://www.w3.org/TR/css-device-adapt-1/#translate-meta-to-at-viewport it says:
Ie, I do not think a space is allowed as a separator; a semicolumn is. |
|
What about simplifying things, roughly, saying that
|
Ya, but the apple documentation says:
This is the nightmare of trying to make this our own! |
But, again, my problem with the CSS module is that it defines a translation, not a syntax. You can't read that document and get a syntax from it, only how to process what you might encounter in the meta tag into an @Viewport rule. It's more like the reading system side of the equation. I'd go dead simple in the authoring definition:
Whatever work there then is in splitting apart the properties shouldn't be that hard to implement on the reading system side, since it sounds like browsers already have to account for these variations. We then only need to say what to do when values are invalid (negative, have a unit) or not specified, and how to handle the device-* keywords. |
|
I have made an update that, hopefully, reflects a consensus.
Hopefully that covers it... While I am at it, I have also added a note on the SVG portion of the reading system side, reflecting to #2270, noting that a reading system should follow the SVG specification that involves the behaviour of |
|
Play supports comma and space as separators, but not semicolon though we could easily add it if we wanted to. An alternative to allowing all whitespace in sep would be to just define it as |
I am happy removing that if this is what we decide
Actually, I can imagine somebody doing, for the sake of code readability, something like <meta
content = "width = 300
height = 600"
>
This is not legal in the current EBNF, right? Honestly, it is so ugly, that I would prefer epubcheck yelling at me if I did that... |
Does that matter? Doesn't xml attribute normalization convert whitespace to spaces? I think even cdata will have them converted, though not collapsed.
Well, if we allow multiple spaces as a separator, I don't see why multiple commas are any worse. It's just a little odd for the matching, I think EBNF subrules are greedy so doesn't |
Neither am I. I guess we have to rely on @mattgarrish for this... You may be right about the XML normalization point, though, ie, it may be enough to set the |
https://www.w3.org/TR/2008/REC-xml-20081126/#AVNormalize Though I think that will just convert all the non-space characters to spaces. Basically I don't think we need to worry about whitespace generically, just space characters. |
|
Thanks @bduga. I have updated the EBNF, it may look a bit more readable. It now explicitly operate on the normalized attribute value, so one should only look at spaces. I have not changed the separator value alternatives. @mattgarrish I wonder whether we should do the same with the EPNF in D.1.4, ie, remove the whitespace reference and definition and use space only... |
I was hoping I wouldn't have to think about this one at all! (head's still pounding from the last week of headaches... I'll read over the changes in more detail on the weekend, but would be helpful if @danielweck can have a look, too. If memory serves, he wrote the original EBNFs in the spec. |
|
I'm a bit concerned that with EBNF we're trying to be too precise about the value. I thought we were allowing but not defining other properties that might appear in the tag, for example? The EBNF will make these an error. Even something like
|
| For XHTML [=fixed-layout documents=] the <a | ||
| href="https://www.w3.org/TR/CSS2/visudet.html#containing-block-details">initial | ||
| containing block</a> [[css2]] MUST be expressed using the [[html]] | ||
| <a data-cite="html#meta"><code>meta</code></a> element with the following attributes: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this disallow other attributes?
|
|
||
| <dl> | ||
| <dt>name</dt> | ||
| <dd>The attribute value MUST be <code>viewport</code>.</dd> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this value also be whitespace normalized if we're getting down to this level of detail?
|
|
||
| <tr> | ||
| <td id="viewport.ebnf.def"> | ||
| <a href="viewport.ebnf.def">viewport</a> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| <a href="viewport.ebnf.def">viewport</a> | |
| <a href="#viewport.ebnf.def">viewport</a> |
| Earlier iterations of EPUB referred to the | ||
| <a href="https://www.w3.org/TR/css-device-adapt-1/#viewport-meta"><code>meta</code> element syntax</a> [[css-device-adapt-1]] for the | ||
| the definition of the attribute value, which includes features that are not relevant for EPUB use. All aspects of that syntax that | ||
| is not defined by this section are <a href="#deprecated">deprecated</a>. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does it mean to deprecate in a note?
If it's not enforced, then why doesn't the ebnf allow the properties? And if it is enforced, then it's only a warning if you use the properties but, again, the ebnf makes anything else in the content attribute invalid.
|
This PR should be closed without further steps if and when #2350 is merged, because that one supersedes this one. |
Following the WG resolution of June 23.
Notes/questions
I have restricted the dimension value to be absolute <length> of CSS; I do not think we want relative values (at least in my reading of the minutes)
I have not found any explicit statement in the CSS specs whereby the value of "500" defaults to "500px". All definitions I have seen seem to indicate that a unit string is needed. I would be happy if someone proved me wrong and we could remove the last sentence on this.
It is not clear to me whether a value of
content="width=123"is valid or not. AFAIK, it is valid in CSS, in which case the missing dimension is set to the device's (or browser window's) own size. I do not know whether we do allow this in EPUB FXL. For the time being I did not include that possibility (and the definition will become a bit convoluted if we do...)Note, b.t.w., that if we allow some default value for width or height, this should be normatively added to the RS. Actually, we may want to define what happens in such a case in any case; input would be welcome...
Fix #2292
Preview | Diff