Bug 3234 - CSS2: Implement better quote support (for the q tag)
Summary: CSS2: Implement better quote support (for the q tag)
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: 412
Hardware: All All
: P2 Normal
Assignee: Elliott Sprehn
URL:
Keywords: InRadar
: 10453 (view as bug list)
Depends on: 3233 6503 9454 92061 92918
Blocks: 47141
  Show dependency treegraph
 
Reported: 2005-06-01 14:54 PDT by Dave Hyatt
Modified: 2012-08-13 23:24 PDT (History)
21 users (show)

See Also:


Attachments
CSS implementation of quotes for q and blockquote>p+p+p+… (7.56 KB, text/css)
2005-06-07 15:50 PDT, Nicholas Shanks
no flags Details
Three-level deep quotation, in French. (553 bytes, application/xhtml+xml)
2006-09-28 08:45 PDT, David Latapie
no flags Details
Three-levels deep quotations. FR, Unicode (573 bytes, application/xhtml+xml)
2006-09-28 08:48 PDT, David Latapie
no flags Details
Three-levels deep quotations. FR, UTF-8, updated (552 bytes, application/xhtml+xml)
2007-01-19 05:41 PST, David Latapie
no flags Details
Same patch with the correct using of css 'quotes' (3.35 KB, text/css)
2008-04-06 09:51 PDT, Vincent Ricard
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Dave Hyatt 2005-06-01 14:54:27 PDT
1. When the <q> tag is used, Safari attempts to put quotes around the text. Unfortunately, it uses hash 
(') and double-hash (") marks instead of real quotes.

2. Safari should detect the language of the html block (like if the lang attribute is used in a containing 
tag) and use the linguistically correct quotes. However, it does not.

3. Safari does not appear to recognize the quotes selector. For example, the following has no effect on 
a Norwegian html page:

Q:lang(no) { quotes: "«" "»" "<" ">" }

In contrast, Gecko-based browsers and Opera have good quote support.

The full CSS 2 specification regarding quotes can be read here:
http://www.w3.org/TR/REC-CSS2/generate.html#quotes-specify
Comment 1 Dave Hyatt 2005-06-01 14:54:49 PDT
Apple Bug: rdar://4119670/
Comment 2 Nicholas Shanks 2005-06-07 15:50:14 PDT
Created attachment 2135 [details]
CSS implementation of quotes for q and blockquote>p+p+p+…

This is the same patch Alexander Clauss is using in iCab 3.0
Comment 3 Dave Hyatt 2005-06-07 15:58:11 PDT
This would be good, but Safari doesn't support the :lang selector yet. :)
Comment 4 Dave Hyatt 2005-06-07 15:59:31 PDT
:last-of-type is not supported either.
Comment 5 Dave Hyatt 2005-06-07 16:01:14 PDT
Also don't recognize content: inhibit.  Is that CSS3?  I assume maybe it is.
Comment 6 Nicholas Shanks 2005-06-07 16:12:35 PDT
Yeah, :empty, :last-of-type and content: inhibit; are CSS3, :lang() is CSS2. I've set a dependancy on bug 
3233 for this. Support for the quotes: "foo" "bar"; would be nice too :-)

A lame work-around is to use q[lang|="en"] instead of q:lang(en) but that isn't as good as it doesn't get 
inherited - the language attribute would have to be on the quote element itself, and be lang="en" rather 
than xml:lang="en" the [lang|=...] selector would also fail for Switzerland. I can supply an alternative patch 
using this instead of :lang() if you would prefer?
Comment 7 Dave Hyatt 2005-06-07 17:14:08 PDT
A great first step might be to implement :lang support.  I think that's even more important than better 
quote handling. :)
Comment 8 Nicholas Shanks 2005-06-07 17:33:05 PDT
I agree. Was this a request?
I'm not familiar with WebCore or WebKit, but I can look at it if you want. As it's 1:30am here I won't have 
anything before tomorrow your time.
Comment 9 Dave Hyatt 2005-06-07 17:40:08 PDT
No rush.  I think having proper :lang support will open up multiple avenues for solving this (whether 
through a bunch of declarative CSS or just smarts in the C++ code that generates the quotes by 
examining the RenderStyle on an element).  It seems like a basic step to getting this right is to get :lang 
working.

Comment 10 Alexey Proskuryakov 2005-07-28 13:14:01 PDT
Re: Russian data in the CSS implementation.

/* russian */
q:lang(ru)::before		{ content: "\00AB"; }
q:lang(ru)::after		{ content: "\00BB"; }
q:lang(ru) q::before	{ content: "\2039"; }
q:lang(ru) q::after		{ content: "\203A"; }

I've never seen U+2039 or U+203A used in Russian. Do I understand it correctly that q::before and q::
after are for nested quotes? Then, it should be 

q:lang(ru) q::before	{ content: "\201E"; }
q:lang(ru) q::after		{ content: "\201C"; }

See, for example, <http://www.artlebedev.ru/kovodstvo2/sections/104/> or <http://ru.wikipedia.org/
wiki/Кавычки>.
Comment 11 Nicholas Shanks 2005-08-08 15:33:25 PDT
For those viewing this page in UTF-8, AP's second link was http://ru.wikipedia.org/wiki/Кавычки 
(Kav'chki)
Comment 12 Alexey Proskuryakov 2006-08-17 02:49:35 PDT
*** Bug 10453 has been marked as a duplicate of this bug. ***
Comment 13 Trevor Harmon 2006-08-17 10:27:04 PDT
When <q> elements are nested, the rendering of the marks changes from double-quotes to single-quotes (by default). The spec on this is here:

http://www.w3.org/TR/html4/struct/text.html#h-9.2.2.1

And an example can be found on section 2 of this page:

http://www.seomoz.org/blogdetail.php?ID=1282

WebKit incorrectly renders the inner marks as double-quotes. Confirmed on the r15924 build.

Note that I had filed this nested quote issue as a separate bug (bug 10453) because it wasn't mentioned in this one, which is too general and ambiguous anyway. (What does "better" mean?) Bugs reports should be as specific and as narrow as possible IMHO. However, it was marked as a duplicate of this one, so I'm adding the issue as a comment here.
Comment 14 David Latapie 2006-09-28 08:40:47 PDT
I attach two additionnal test cases; one with UTF-8 characters and the other with Unicode values.
Comment 15 David Latapie 2006-09-28 08:45:09 PDT
Created attachment 10823 [details]
Three-level deep quotation, in French.

 I only know the French typography rules so I had to do it in French
Comment 16 David Latapie 2006-09-28 08:48:36 PDT
Created attachment 10824 [details]
Three-levels deep quotations. FR, Unicode

The same, with Unicode values.
Comment 17 David Latapie 2007-01-19 05:41:23 PST
Created attachment 12557 [details]
Three-levels deep quotations. FR, UTF-8, updated

This new version uses another sorting (1 /1 2 /2 3 /3 instead of 1 2 3 /1 /2 /3).
Comment 18 Orlando Agostinho 2007-06-29 08:10:50 PDT
(In reply to comment #0)
> 1. When the <q> tag is used, Safari attempts to put quotes around the text.
> Unfortunately, it uses hash 
> (') and double-hash (") marks instead of real quotes.
> 
> 2. Safari should detect the language of the html block (like if the lang
> attribute is used in a containing 
> tag) and use the linguistically correct quotes. However, it does not.
> 
> 3. Safari does not appear to recognize the quotes selector. For example, the
> following has no effect on 
> a Norwegian html page:
> 
> Q:lang(no) { quotes: "«" "»" "<" ">" }
> 
> In contrast, Gecko-based browsers and Opera have good quote support.
> 
> The full CSS 2 specification regarding quotes can be read here:
> http://www.w3.org/TR/REC-CSS2/generate.html#quotes-specify
> 

Hi,

Everybody! I would like to help, but i'm newcomer, and i would like to know where is the code that process this? More, specically, where i need to look at?

I got the source code!

thanks!
Comment 19 Eric Seidel (no email) 2007-09-30 11:13:39 PDT
:lang support is supposedly implemented (bug 3233 is closed) so it should be possible to make a patch for this now, no?
Comment 20 Alexey Proskuryakov 2007-09-30 12:21:44 PDT
With bug 9454 still not fixed, the existing support for :lang is IMHO not very useful, unfortunately.
Comment 21 Dave Hyatt 2007-10-01 11:33:11 PDT
Yes, although I don't want a giant CSS implementation.  This should be done in code.

Comment 22 Vincent Ricard 2008-04-06 09:51:38 PDT
Created attachment 20368 [details]
Same patch with the correct using of css 'quotes'

This file is based on (and aims to replace) the 'CSS implementations of quotes'. Hence it provides nice default values for the quotes.
I replace the double quotes by single quotes to ease the integration in html4.css
Comment 23 Jon@Chromium 2008-11-18 13:11:57 PST
Also reported against Chromium, see http://code.google.com/p/chromium/issues/detail?id=4426
Comment 24 Daniel Upstone 2009-08-01 08:51:51 PDT
This bug has still not been resolved and is a serious browser inconsistency issue for CSS2 implementation.
It may be worth noting that IE8 is the only browser to do this correctly (yes, you read that correctly). Firefox does render correctly, but c&p of the output shows that it's still using forced quotes on the q element rather than providing the rendered result or a no-generated-content result. Opera seems to have it's own issues (eg. a stray " sneaking in) but is otherwise fine. Webkit still lacks full support and renders incorrectly.

Test Case: http://www.zealous-studios.co.uk/content-quotes.xhtml
The test case shows the following issues.
1. quotes are not changing when nesting. This is because webkit has the defined the defaults in an incorrect way.
2. quotes are not effected by language. This is for the same reason as above.
3. *-quote values for the content property are still not supported (as shown in https://bugs.webkit.org/show_bug.cgi?id=6503). This breaks any attempt to correctly fix this bug with correct css defaults such as the attachment Vincent Richard provided. It also prevents designers from using the values to override the incorrect defaults in webkit.
4. The second issue creates the illusion of a lack of support for the quotes property on anything but blockquote and quote (CSS2 states it applies to all elements). Because of all of the above issues, correct support can't be tested easily.

Bug 6503 needs to be fixed first, then Vincent's patch applied for this bug.
Comment 25 Oli Studholme 2010-01-17 06:47:03 PST
Currently http://trac.webkit.org/browser/trunk/WebCore/css/html.css reads:

97 q:before {
98	    content: '"'
99	    /* FIXME: content: open-quote; */
100	}
101	
102	q:after {
103	    content: '"'
104	    /* FIXME: content: close-quote; */
105	}

Workaround for authors until this is fixed:
http://monc.se/kitchen/129/rendering-quotes-with-css
Comment 26 Carol Szabo 2011-02-07 13:02:39 PST
I am almost done working on a patch for this. My patch implements quotes similar to CSS 2.1 counters.
At this point I have the Qt implementation ready, I am working on updating project files for other ports to include the extra 2 files where I put the bulk of my implementation.
Comment 27 Carol Szabo 2011-02-07 13:46:27 PST
I am going to commit my patch proposal on 6503 since I find it more closely matching what I am trying to do.
Comment 28 MetaEd 2011-10-10 10:31:10 PDT
This bug, as reported against Chromium (http://code.google.com/p/chromium/issues/detail?id=4426), has the following test case:

He said, <q>I said, 
<q>Meh.</q> And then I stopped.</q> And then he stopped.

Using this test case, I can no longer reproduce the problem in Chrome 16.0.899.0 dev-m.
Comment 29 Elliott Sprehn 2012-08-13 23:24:47 PDT
Meta bug 92061 tracking the new quotes implementation is complete so this is resolved.

WebKit now support quotes, and has defaults for 148 languages.