-
Notifications
You must be signed in to change notification settings - Fork 167
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
Escape list prefix, suffix and bullet chars in the CSS rules #550
Conversation
Build succeeded. |
@@ -0,0 +1,674 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> |
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.
visual-tests.odt -> visual-tests.fodt, as fodt is the usual suffix for flat ODT files
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.
Done.
Build succeeded. |
// Content needs to be on a new line if it contains slashes due to a bug in older versions of webkit | ||
// E.g., the one used in the qt runtime tests - https://bugs.webkit.org/show_bug.cgi?id=35010 | ||
content = '"' + escapeCSSString(prefix) + '"\n'; | ||
} | ||
|
||
if (stylemap.hasOwnProperty(style)) { | ||
content += " counter(list, " + stylemap[style] + ")"; | ||
} else if (style) { | ||
content += "'" + style + "';"; |
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.
"'"
-> '"'
here as well, no?
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.
These are unimportant. The specs allow both double and single quoted strings.. the main reason I changed the others to double-quoted was so I only had to escape a single type of quote. I couldn't think of any harm caused by leaving this alone.
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.
Sure. But in the PR text you say "Consistently use double-quotes to quote strings" :) So it is rather "More consistenly" ? Also is not consistent with the copy in ListStylesToCss.
Hm. How quick will #565 be done?
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.
Hmm. Good points. Am I still allowed to land this PR if it is only "more" consistent? ^_^.
#565 is @satsuper's primary goal. The code is ready, and he's just fighting with creating some decent unit tests for it. So I expect it to land within the next week or two (assuming you have the spare bandwidth to review of course!).
This directory has never been used, even within the commit that added it
These effectively act as slightly expensive no-ops. There is no need for them to be present.
Various browser cope differently with unescaped characters in a CSS content block, though all browsers agree it is a bad thing. WebKit will throw an error, Chrome & FF will "guess" where the rule ends (and usually get it wrong). This patch does 2 things to fix this: - Consistently use double-quotes to quote strings - Escape backspace and double-quote chars in the CSS-related content The vast amount of testing code is primarily creating a string tokenizer able to parse out the displayed text across Chrome/WebKit + FF. As there is no simple way to get the "rendered text" from a pseudo-element, a lot of code is required to compute this. There are tests included for the hand-rolled tokenizer as well to ensure proper function. No tests have been added for OdfCanvas, as the existing list logic in here is destined (sooner rather than later) to be merged into the newer list CSS translation class.
Content needs to be on a new line if it contains slashes due to a bug in older versions of webkit. E.g., the one used in the qt runtime tests. See https://bugs.webkit.org/show_bug.cgi?id=35010 In addition, asking for the value of a content block that contains a counter returns a strange counter string such as "counter(-879878e564)". I can't find a bug report for this, but it only occurs inside the qt runtime tests.
Build succeeded. |
* | ||
* 2. joining commas (i.e., commas between strings) are removed completely (some browsers separate content parts with commas) | ||
* 3. no whitespace trimming or normalization is performed | ||
* 4. replace counter(.*) with the text "counter(...)". It seems qtruntimetests fail as the counters don't survive |
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.
Curious: Which version of Qt and which platform? Here for me (Qt 4.8.5 on OpenSuse) qtruntimetests passes if I go to variant with original counter content. It is just dropping the ,
between identifier and list-style-type (e.g. counter(list, decimal)
becomes counter(list decimal)
), which BTW also Firefox (28.0) and Chromium (33.0.1750.152) (both OpenSUSE) do.
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.
http://www.w3.org/TR/CSS21/syndata.html#counter actually specifies counter(<identifier>, <'list-style-type'>)
, strange that all drop the ,
.
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.
The version used on the build server, and one I had on OSX (not sure the exact version). You can see the logs on the CI here: http://ci.kogmbh.com/jenkins/job/WebODF-PullReq/1499/consoleFull by searching for: counter(
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.
(Just for simplicity)
<span>Running <span style='color:blue;cursor:pointer' onclick='runTest("ListStyleToCssTests","numberedListPrefixes")'>numberedListPrefixes</span></span>
t.actualContent should be [a b] counter(list, decimal) []. Was [a b] counter(2.33059e-310) [].
t.actualContent should be ['] counter(list, decimal) []. Was ['] counter(2.33059e-310) [].
t.actualContent should be ["] counter(list, decimal) []. Was ["] counter(2.33059e-310) [].
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.
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.
Ah, CI might only have QtWebKit of Qt 4.8.5 (due to being self-compiled there and not from packages if I saw correcty), and not the newer https://gitorious.org/webkit/qtwebkit-23 (like most Linux distris now do). And same for the OSX version. And our build requirements do not check fo that. I see.
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.
Hm, if those fixes are only done due to a pretty old webkit in normal Qt installations, which is nowhere else used in what we support, I propose to require the newer QtWebKit 2.3...
But that can/should be done in a separate PR.
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.
It's my own hacked-up parsing logic doing that :).
"that" is what? That the ,
disappears? Cannot yet see where that would be done...
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.
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.
Ah, in the test only. Hm, why do I continue to ignore the nice description in the API dox there :(
Okay.
In general seems fine and improves things without regression, good work, so can be merged. Please ship :) |
Escape list prefix, suffix and bullet chars in the CSS rules
As per usual, thanks for the careful oversight :) |
Various browser cope differently with unescaped characters in a CSS content block, though all browsers agree it is a bad thing. WebKit will throw an error, Chrome & FF will "guess" where the rule ends (and usually get it wrong).
This patch does 2 things to fix this:
The vast amount of testing code is primarily creating a string tokenizer able to parse out the displayed text across Chrome/WebKit + FF. As there is no simple way to get the "rendered text" from a pseudo-element, a lot of code is required to compute this. There are tests included for the hand-rolled tokenizer as well to ensure proper function.
No tests have been added for OdfCanvas, as the existing list logic in here is destined (sooner rather than later) to be merged into the newer list CSS translation class.
2 Additional tweaks included in this patch