WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
Bug 92918
Built in quotes don't use lang attribute
https://bugs.webkit.org/show_bug.cgi?id=92918
Summary
Built in quotes don't use lang attribute
Elliott Sprehn
Reported
2012-08-01 15:53:58 PDT
<q lang="ru"></q> should use Russian quotes since there's a table of quotes in RenderQuote, but we always render " and '. Custom languages do work though which is weird: <style>:lang(ru) { quotes: "A" "B"; }</style> <q lang="ru">This works.</q>
Attachments
Patch
(19.56 KB, patch)
2012-08-01 17:03 PDT
,
Elliott Sprehn
no flags
Details
Formatted Diff
Diff
Archive of layout-test-results from gce-cr-linux-02
(446.67 KB, application/zip)
2012-08-01 19:13 PDT
,
WebKit Review Bot
no flags
Details
Archive of layout-test-results from gce-cr-linux-04
(325.56 KB, application/zip)
2012-08-01 19:40 PDT
,
WebKit Review Bot
no flags
Details
Patch
(9.42 KB, patch)
2012-08-02 12:37 PDT
,
Elliott Sprehn
no flags
Details
Formatted Diff
Diff
Patch
(9.50 KB, patch)
2012-08-02 14:38 PDT
,
Elliott Sprehn
no flags
Details
Formatted Diff
Diff
Patch
(9.45 KB, patch)
2012-08-02 15:03 PDT
,
Elliott Sprehn
no flags
Details
Formatted Diff
Diff
Show Obsolete
(3)
View All
Add attachment
proposed patch, testcase, etc.
Elliott Sprehn
Comment 1
2012-08-01 17:03:22 PDT
Created
attachment 155927
[details]
Patch Use the built in Element::computeInheritedLanguage and add tests that we actually pick quotes from the hashmap in RenderQuote.
Julien Chaffraix
Comment 2
2012-08-01 18:48:22 PDT
Comment on
attachment 155927
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=155927&action=review
The code change is fine, I would like to see a revised test though.
> Source/WebCore/rendering/RenderQuote.cpp:194 > + if (style()->quotes()) > + return style()->quotes();
Better way: if (QuoteData* styleQuotes = style()->quotes()) return styleQuotes;
> LayoutTests/ChangeLog:13 > + * platform/chromium-mac/fast/css-generated-content/quotes-lang-expected.txt: Added.
Couldn't this test be a ref-test instead of a pixel-test? It looks like the output is super easy to reproduce without using <q> or some RenderQuote.
> LayoutTests/fast/css-generated-content/quotes-lang.html:10 > +
Please, let's add some explanation as to what is expected along with what you test!
> LayoutTests/fast/css-generated-content/quotes-lang.html:15 > +<q lang="ru"><q>ru</q></q>
Adding <br> would make the output easier to read.
> LayoutTests/fast/css-generated-content/quotes-lang.html:22 > +</div>
I think you are fixing another bug with respect to lang vs xml:lang here: <q lang="no" xml:lang="en">en</q> (before xml:lang would have been ignored AFAICT)
WebKit Review Bot
Comment 3
2012-08-01 19:13:15 PDT
Comment on
attachment 155927
[details]
Patch
Attachment 155927
[details]
did not pass chromium-ews (chromium-xvfb): Output:
http://queues.webkit.org/results/13415411
New failing tests: fast/css-generated-content/quotes-lang.html
WebKit Review Bot
Comment 4
2012-08-01 19:13:18 PDT
Created
attachment 155951
[details]
Archive of layout-test-results from gce-cr-linux-02 The attached test failures were seen while running run-webkit-tests on the chromium-ews. Bot: gce-cr-linux-02 Port: <class 'webkitpy.common.config.ports.ChromiumXVFBPort'> Platform: Linux-2.6.39-gcg-201203291735-x86_64-with-Ubuntu-10.04-lucid
WebKit Review Bot
Comment 5
2012-08-01 19:40:30 PDT
Comment on
attachment 155927
[details]
Patch
Attachment 155927
[details]
did not pass chromium-ews (chromium-xvfb): Output:
http://queues.webkit.org/results/13415424
New failing tests: fast/css-generated-content/quotes-lang.html
WebKit Review Bot
Comment 6
2012-08-01 19:40:34 PDT
Created
attachment 155954
[details]
Archive of layout-test-results from gce-cr-linux-04 The attached test failures were seen while running run-webkit-tests on the chromium-ews. Bot: gce-cr-linux-04 Port: <class 'webkitpy.common.config.ports.ChromiumXVFBPort'> Platform: Linux-2.6.39-gcg-201203291735-x86_64-with-Ubuntu-10.04-lucid
Elliott Sprehn
Comment 7
2012-08-02 11:53:04 PDT
(In reply to
comment #2
)
> (From update of
attachment 155927
[details]
) > View in context:
https://bugs.webkit.org/attachment.cgi?id=155927&action=review
> ... > I think you are fixing another bug with respect to lang vs xml:lang here: > > <q lang="no" xml:lang="en">en</q> > > (before xml:lang would have been ignored AFAICT)
In XHTML mode yeah, but how do I write a test for that with DRT? With the HTML5 parser xml:lang is entirely ignored because you get an attribute called "xml:lang" without a namespace so fastGetAttribute(XMLNames::langAttr) returns null.
Elliott Sprehn
Comment 8
2012-08-02 12:37:21 PDT
Created
attachment 156141
[details]
Patch Updated to use a ref test and added new test for xml:lang.
Eric Seidel (no email)
Comment 9
2012-08-02 14:08:40 PDT
Comment on
attachment 156141
[details]
Patch Do we have any performanc metrics for quotes? My impression was computeInheritedLanguage was expensive (not that the previou tree-walking wasnt!)
Elliott Sprehn
Comment 10
2012-08-02 14:11:56 PDT
(In reply to
comment #9
)
> (From update of
attachment 156141
[details]
) > Do we have any performanc metrics for quotes? My impression was computeInheritedLanguage was expensive (not that the previou tree-walking wasnt!)
I don't think there's any performance tests for this. Is there a better way to figure out the language? It might be good to write a perf test since the final patch is the rewritten placeQuote() algorithm, but I don't know how to do that.
Alexey Proskuryakov
Comment 11
2012-08-02 14:12:13 PDT
This sounds like #2 in
bug 3234
, adding dependency. Element::computeInheritedLanguage() is slow, as it performs a walk of all ancestors. I don't think that it's OK to use it in rendering. The same performance problem existed for language-based font selection. Perhaps the same solution can be used here?
Alexey Proskuryakov
Comment 12
2012-08-02 14:13:17 PDT
Comment on
attachment 156141
[details]
Patch I think that performance concern that both Eric and myself had warrants r-.
Elliott Sprehn
Comment 13
2012-08-02 14:15:38 PDT
(In reply to
comment #12
)
> (From update of
attachment 156141
[details]
) > I think that performance concern that both Eric and myself had warrants r-.
The existing code already walks the whole tree though, and it's broken (doesn't actually respect the lang attribute at all even though it walks the whole tree). It's better to land code that's correct and has same perf as before than leave code that's totally broken.
Alexey Proskuryakov
Comment 14
2012-08-02 14:28:56 PDT
I don't necessarily agree - new code that uses a wrong idiom can be used as inspiration by other WebKit hackers. Even if detected in review, there is going to be an argument similar to "other code is allowed to do this, so why not me". I hope that using -webkit-locale here won't add much complexity, although I can certainly feel the pain of revisiting a prepared patch.
Elliott Sprehn
Comment 15
2012-08-02 14:38:01 PDT
Created
attachment 156170
[details]
Patch Use -webkit-locale.
Elliott Sprehn
Comment 16
2012-08-02 14:38:52 PDT
(In reply to
comment #14
)
> I don't necessarily agree - new code that uses a wrong idiom can be used as inspiration by other WebKit hackers. Even if detected in review, there is going to be an argument similar to "other code is allowed to do this, so why not me". > > I hope that using -webkit-locale here won't add much complexity, although I can certainly feel the pain of revisiting a prepared patch.
Yeah it wasn't hard, it just took me a second to realize that style()->locale() is the same as -webkit-locale. Thanks for the perf optimization ap!
Alexey Proskuryakov
Comment 17
2012-08-02 14:46:51 PDT
Comment on
attachment 156170
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=156170&action=review
> Source/WebCore/rendering/RenderQuote.cpp:163 > - const QuotesData* quotes = style()->quotes(); > - if (!quotes) > - quotes = defaultQuotes(this); > + const QuotesData* quotes = quotesData();
Hmm. Is this second-guessing what the quotes should be, instead of asking directly?
> Source/WebCore/rendering/RenderQuote.cpp:164 > + ASSERT(quotes);
Is this ASSERT helpful? Generally, we want to assert on null for one of these reasons: 1. If it would be hard to investigate bugs caused by the pointer being null without the assertion. Here, the crash would happen immediately below the ASSERT, and it will be obvious what the cause was. 2. To document non-trivial expectations, particularly about function arguments. This doesn't seem to be so non-trivial. Also, returning a reference is IMO a better way to document the same.
> Source/WebCore/rendering/RenderQuote.cpp:188 > + ASSERT(parent());
Why do we care?
Elliott Sprehn
Comment 18
2012-08-02 14:55:11 PDT
(In reply to
comment #17
)
> (From update of
attachment 156170
[details]
) > View in context:
https://bugs.webkit.org/attachment.cgi?id=156170&action=review
> > > Source/WebCore/rendering/RenderQuote.cpp:163 > > - const QuotesData* quotes = style()->quotes(); > > - if (!quotes) > > - quotes = defaultQuotes(this); > > + const QuotesData* quotes = quotesData(); > > Hmm. Is this second-guessing what the quotes should be, instead of asking directly?
> I don't understand. What do you mean?
Elliott Sprehn
Comment 19
2012-08-02 15:03:06 PDT
Created
attachment 156178
[details]
Patch Remove unneeded asserts.
Alexey Proskuryakov
Comment 20
2012-08-02 15:06:26 PDT
> I don't understand. What do you mean?
Actually never mind. I now see that quotesData() calls style()->quotes() just like old code did.
WebKit Review Bot
Comment 21
2012-08-02 15:51:07 PDT
Comment on
attachment 156178
[details]
Patch Clearing flags on attachment: 156178 Committed
r124518
: <
http://trac.webkit.org/changeset/124518
>
WebKit Review Bot
Comment 22
2012-08-02 15:51:12 PDT
All reviewed patches have been landed. Closing bug.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug