Re: [whatwg] Drag-and-drop folders/files support with directory structure using DirectoryEntry

2012-09-24 Thread Kinuko Yasuda
Thanks for the feedback.

On Fri, Sep 14, 2012 at 6:58 AM, Ian Hickson i...@hixie.ch wrote:

 On Tue, 15 Nov 2011, Kinuko Yasuda wrote:
 
  Many sites have 'upload your files' feature, like for your photo images.
  HTML5 allows you to do this via input type=file multiple or
  drag-and-drop feature, but the current solution does not provide clean
  solution for cases with folders, files/folder mixed cases, or folders
  with subfolders cases.
 
  For context, back then we have proposed (and implemented) 'directory'
  attribute for input type=file specifically to upload a directory, but
  the approach does not provide useful information to webapps about which
  file comes from which folder, neither does it allow apps to control how
  and when to enumerate directories (e.g. app cannot show progress meter
  etc even the enumerating part takes long time).
 
 http://lists.whatwg.org/htdig.cgi/whatwg-whatwg.org/2010-April/025764.html

 This isn't really about directories, it's a problem with file I/O in
 general, made worse when there are large numbers of files -- it's just
 that when you have directories you're more likely to have many files.
 Other situations also make this difficult, e.g. if the files are on a
 network drive with high latency, or a removable drive such as a DVD or
 tape drive.


This seems true.  For the record, when this proposal was made there wasn't
clear agreement that file metadata needs to be retrieved when the File
object is created, the file name was the only information that was clearly
necessary to create a File.

Fundamentally the problem is that the objects in drag-and-drop and in
 input type=file synchronously expose all the files, and we just don't
 necessarily have the time to get all the files' sizes before that starts
 to be noticably slow. We could have the UA show progress UI, but while
 that could work for input type=file, it would be quite jarring for drag
 and drop.

 There are various ways we could fix this if we were starting afresh, but
 if we're trying to keep backwards compatibility there's basically no
 solution: the spec already requires this sync API, and pages might depend
 on it.

So we have a problem: do we not fix the problem, do we break all pages
 always, break all pages but only when the user drags in a lot of files (so
 authors might not notice), break all pages whenever there's more than one
 file (so authors will notice but pages still support one file at a time),
 break pages only when the user drags in one or more directories?


My proposal is to add an alternative asynchronous API and encourage app
authors to use the version when they expect it could get large number of
files/directories.  This does not solve the existing problem but could
offer better alternative approach.

There's various ways we could fix the problem, if we're ok with breaking
 things. We could expose all the files in a flat list, incrementally. We
 could expose the directory hiearchy, with asynchronous access. If we do
 incremental access, there's various ways to do that: event-based
 notification that there's more data; an enumerator / callback mechanism; a
 lazy array where reading the number of files, or reading the nth file, is
 asynchronous... We can extend FileList and DataTransferItemList to support
 this, or we can add a new object that they point to, or we can just update
 FileList and make DataTransferItemList support the new object...

 In many cases, exposing the actual hierarchy can reduce the total amount
 of work that's needed, because many use cases don't actually need to crawl
 everything. For example, people gave examples of just wanting Subversion's
 internal .svn directories in a big tree, not the actual data; or indeed in
 other cases vice-versa.

 However, both exposing the hiearchy and flattening it have all kinds of
 risks. It's possible for the user to accidentally expose his entire
 computer's hard drive without realising it.


This seems to be possible regardless of whether we expose files in a
hierarchy or in a flattened list.

On some systems (including at
 least modern Mac OS and Linux OSes, not sure about Windows), it's possible
 to have hard-link loops.


Newer Mac OS X allows hard links on directories, but not in the way that
could create loops.
On most other OSes I believe hard links on directories are still disallowed.

On some systems, it's possible to drag special
 directories like .., and it's not clear what that would mean. When the
 user drags files from multiple parts of the file system (e.g. from a
 Windows virtual folder), it's not clear what parts of the path we should
 expose -- even exposing just the common parts can expose sensitive
 information like the profile path if one file is in the user's profile and
 another is not.


The proposed spec doesn't say anything about that, but Chrome's basic
stance is we should not expose any information that is outside the dropped
files/folders even some of dragged paths have the common parts in 

Re: [whatwg] New URL Standard

2012-09-24 Thread Tobie Langel
On Mon, Sep 24, 2012 at 10:58 AM, Anne van Kesteren ann...@annevk.nl wrote:
 The kind of predictability we have for the HTML parser, I want to have for the
 URL parser as well.

Yes, please!!

--tobie


Re: [whatwg] New URL Standard

2012-09-24 Thread Anne van Kesteren
On Sat, Sep 22, 2012 at 9:10 AM, Alexandre Morgaut
alexandre.morg...@4d.com wrote:
 Would the URLUtil interface replace the URL decomposition IDL attributes of 
 the Location interface?
 - 
 http://www.whatwg.org/specs/web-apps/current-work/multipage/urls.html#url-decomposition-idl-attributes
 - 
 http://www.whatwg.org/specs/web-apps/current-work/multipage/history.html#the-location-interface

Yes. My plan is to obsolete most URL parts of HTML.


 Could the search property have a key/value mapping?
 ex:
 http://test.com?param1=value1
 - var value1 = url.search.param1
 search as window.location could still be usable as a string

I have been thinking about introducing a .query attribute that would
return a special interface for this purpose, but what the right API
should be seems somewhat tricky. Adam and Erik came up with a solution
that introduces eight new methods (see
http://dvcs.w3.org/hg/url/raw-file/tip/Overview.html#url ) but I hope
we can find something more elegant. (Unless we are stuck with their
solution for some reason, but I believe that is not the case.)


 Shouldn't this document have references on some of the URL related RFCs:

The plan is to obsolete the RFCs. But yes, I will add some references
in the Goals section most likely. Similar to what has been done in the
DOM Standard.


 Should this document include a more complete list of schemes with ones that 
 are more and more used in URLs?

Maybe, kinda depends on what turns out to be the ideal scope for the
URL Standard. For now I only wanted to include those schemes relevant
to the parser (and it may turn out there is a few more of those, e.g.
mailto, javascript, data, and file might need some special casing).


 Unfortunately, the URLUtil interface would not be adapted for them:
 - the protocol, host, and hostname properties make sense and would work;
 - the query part (search property) is used by the mailto:; and sms: URIs;
 - for tel: and fax, we see parameters prefixed by ; as the ones used 
 in some media types, those parameters could be found in the search property

We might not want to adapt it either because of the relative increase
in complexity while not actually addressing many use cases. You want
to modify query/path for http/https and maybe ws/wss a lot, but not so
much for mailto I'd think.


-- 
http://annevankesteren.nl/


Re: [whatwg] New URL Standard

2012-09-24 Thread Karl Dubost

Le 21 sept. 2012 à 17:16, Anne van Kesteren a écrit :
 I took a crack at defining URLs: http://url.spec.whatwg.org/

Very cool.



On cite attributes, I'm using urn:isbn:

blockquote cite=urn:isbn:2-7073-1038-7
   pJ'aime la liberté. J'aime être responsable 
  de mes actes. J'aime comprendre ce que je 
  fais… Et, cependant, je donne mon accord 
  à ce marché bizarre./p
/blockquote
   
Which I can use and parse with an extension in Opera [1] which convert it into 
a link to the Open Library. In the future I could give accessibilities to 
different services, and the user could choose its own reference system.

In this case.
http://openlibrary.org/books/OL8913264M/Djinn


All of that, it would be cool to be able to grab the relevant part of the URI 
without having to regex the string return by the cite attribute.

PS: and Yes I can live with not being there if you say no ;)

[1]: https://addons.opera.com/fr/extensions/details/quotelink/?display=en

-- 
Karl Dubost - http://dev.opera.com/
Developer Relations, Opera Software



Re: [whatwg] New URL Standard

2012-09-24 Thread Jukka K. Korpela

2012-09-24 12:47, Karl Dubost wrote:


On cite attributes, I'm using urn:isbn:

blockquote cite=urn:isbn:2-7073-1038-7
pJ'aime la liberté. J'aime être responsable
   de mes actes. J'aime comprendre ce que je
   fais… Et, cependant, je donne mon accord
   à ce marché bizarre./p
/blockquote

Which I can use and parse with an extension in Opera [1] which convert it
 into a link to the Open Library. In the future I could give 
accessibilities

to different services, and the user could choose its own reference system.


This is all very cool in its own way, and could be useful when used
with discipline within a discipline. But for a long time, such cool 
ideas will not be supported in most browsing situations. Yet, authors 
who know the cool idea will apply it and will fail to duplicate any 
credits in the normal visible content. This means that to most users, a 
quotation will appear without any credits or source information.


It also means that the only immediately available source information for 
a quotation will be an ISBN in URL format. So, for example, working 
offline, you won't see even the title and the author. Would the 
quotation even satisfy the legal requirements for quotations?


If the credits are additionally given in visible content, there *there* 
is the place to do cool things with ISBNs. The credits, when they 
include the ISBN in addition to author, title, etc., could have the ISBN 
part turned to an element like a href=urn:isbn:2-7073-1038-7ISBN 
2-7073-1038-7/a. (This would still suffer from lack of compatibility 
with older user agents, creating non-working links on them, so maybe 
some new markup - which would simply be ignored by old user agents - 
would be better.)


The point, however, is that the cite attribute in blockquote is broken 
by design and should not be implemented in any new ways (or old).


Yucca





Re: [whatwg] New URL Standard

2012-09-24 Thread Alexandre Morgaut

On 24 sept. 2012, at 11:34, Anne van Kesteren wrote:

 Could the search property have a key/value mapping?
 ex:
 http://test.com?param1=value1
 - var value1 = url.search.param1
 search as window.location could still be usable as a string

 I have been thinking about introducing a .query attribute that would
 return a special interface for this purpose, but what the right API
 should be seems somewhat tricky. Adam and Erik came up with a solution
 that introduces eight new methods (see
 http://dvcs.w3.org/hg/url/raw-file/tip/Overview.html#url ) but I hope
 we can find something more elegant. (Unless we are stuck with their
 solution for some reason, but I believe that is not the case.)

Yes I saw the methods, and as for XHR and its headers, I don't find them user 
friendly enough
The search property could stand as is, but I personally think that having a 
Web Storage like key/value mapping for the parameters would make the code more 
readable.
We could then have a params or parameters property with key / value mapping 
and implementing the Storage interface:
http://www.w3.org/TR/webstorage/#storage-0
Developers who are more comfortable with methods would then still be happy, and 
because of having the same interface, the learning curve would be better.

What I would love in the enhancement of parameters management, is that the 
developer should not need to take care about URL encoding of the names and 
values any more all those encoding/decoding could be done automatically, 
either with your proposed methods or using a Storage interface...


 Should this document include a more complete list of schemes with ones that 
 are more and more used in URLs?

 Maybe, kinda depends on what turns out to be the ideal scope for the
 URL Standard. For now I only wanted to include those schemes relevant
 to the parser (and it may turn out there is a few more of those, e.g.
 mailto, javascript, data, and file might need some special casing).

Going progressively makes sense

 Unfortunately, the URLUtil interface would not be adapted for them:
 - the protocol, host, and hostname properties make sense and would 
 work;
 - the query part (search property) is used by the mailto:; and sms: URIs;
 - for tel: and fax, we see parameters prefixed by ; as the ones used 
 in some media types, those parameters could be found in the search property

 We might not want to adapt it either because of the relative increase
 in complexity while not actually addressing many use cases. You want
 to modify query/path for http/https and maybe ws/wss a lot, but not so
 much for mailto I'd think.

I started my purpose saying Unfortunately..., but in the end, it looks like 
the Location/URL interface, in combination with the Storage interface should 
fit with any of the mentioned schemes. The only specificity being the format of 
the tel: parameters (it'd be great if we could update the RFC). I must say 
I'm more comfortable with the matching of this URL interface with mailto:;, 
tel:, sms:, and tv: than with data: or javascript:

Bellow some potential examples for those schemes using the URL and the Storage 
interfaces (without showing the methods)


mailto:j...@example.com?cc=b...@example.comsubject=current-issuebody=send%20current-issue%0D%0Asend%20index

{
host: j...@example.com,
hostname: j...@example.com,
href: 
j...@example.com?cc=b...@example.comsubject=current-issuebody=send%20current-issue%0D%0Asend%20index,
parameters: {
cc: b...@example.com,
subject: current-issue,
body: send current-issue\r\nsend index
}
pathname: ,
port: ,
protocol: mailto:;,
search: ?cc=b...@example.combody=hello,
}


tel:+11231231234;isub=8978

{
host: +11231231234,
hostname: +11231231234,
href: +11231231234;isub=8978,
parameters: {
isub: 8978
}
pathname: ,
port: ,
protocol: tel:,
search: 
}


sms:+15105550101?body=hello%20there

{
host: +15105550101,
hostname: +15105550101,
href: +15105550101?body=hello%20there,
parameters: {
body: hello there
}
pathname: ,
port: ,
protocol: sms:,
search: 
}


tv:west.hbo.com

{
host: west.hbo.com,
hostname: west.hbo.com,
href: west.hbo.com,
parameters: {}
pathname: ,
port: ,
protocol: tv:,
search: 
}


data:image/png;base64; 

{
host: ,
hostname: ,
href: image/png;base64; ,
parameters: {} // might include auto-generated mediaType  charset 
string parameters and base64 boolean parameter
pathname: ,
port: ,
protocol: data:,
search: 
}







Alexandre Morgaut
Wakanda Community Manager

4D SAS
60, rue d'Alsace
92110 Clichy
France

Standard : +33 1 40 87 92 00
Email :alexandre.morg...@4d.com

Re: [whatwg] New URL Standard

2012-09-24 Thread Alexandre Morgaut

On 24 sept. 2012, at 14:08, Alexandre Morgaut wrote:


 sms:+15105550101?body=hello%20there

 {
host: +15105550101,
hostname: +15105550101,
href: +15105550101?body=hello%20there,
parameters: {
body: hello there
}
pathname: ,
port: ,
protocol: sms:,
search: 
 }

ooops

it should be

search: ?body=hello%20there

of course




Alexandre Morgaut
Wakanda Community Manager

4D SAS
60, rue d'Alsace
92110 Clichy
France

Standard : +33 1 40 87 92 00
Email :alexandre.morg...@4d.com
Web :  www.4D.com




Re: [whatwg] New URL Standard

2012-09-24 Thread Karl Dubost

Le 24 sept. 2012 à 12:08, Jukka K. Korpela a écrit :
 It also means that the only immediately available source information for a 
 quotation will be an ISBN in URL format. So, for example, working offline, 
 you won't see even the title and the author. Would the quotation even satisfy 
 the legal requirements for quotations?

unrelated and orthogonal.
We are not talking about bibliographical reference model, which would by useful 
by its own.

-- 
Karl Dubost - http://dev.opera.com/
Developer Relations, Opera Software



Re: [whatwg] Rename the 7-arg arcTo() to ellipseTo()?

2012-09-24 Thread Rick Waldron
On Sun, Sep 23, 2012 at 11:25 PM, Tab Atkins Jr. jackalm...@gmail.comwrote:

 On Sun, Sep 23, 2012 at 3:57 PM, Ian Hickson i...@hixie.ch wrote:
  On Fri, 21 Sep 2012, Tab Atkins Jr. wrote:
  So, can we rename the 7-arg arcTo to ellipseTo?  That seems to support
  your always [require] all the arguments recommendation. ^_^
 
  Just have one arcTo command, that takes all the arguments. Why split it
  into two, if you always require all the arguments?

 Oh, that's what you meant.

 That seems silly.  It's more convenient and simple for authors to have
 a circular form, separate from the elliptical form.  It lets you omit
 the second radius and the rotation, as they're irrelevant.


Tab,

Has there been any discussion about moving newly emerging APIs to a single
options object formal parameter?

Rick




   In general, though, I wouldn't recommend trying to do this at all. The
   SVG path syntax is its own thing, and it already supports arcs and so
   forth. Adding a whole new redundant set of commands that work slightly
   differently is just bloat asking for interop issues, IMHO. The design
   of the path syntax makes sense, it's terse. Embrace its strengths,
   don't second-guess its design.
 
  The existing SVG A command is one of the largest source of complaints
  from hand-authors. While it's *occasionally* useful as stated, it often
  requires you to do trig to get the effect you want. The Canvas arc
  commands, with their use of an angle to sweep across, are exactly what
  authors want a lot of the time, and commonly ask for.
 
  So introduce a new one-letter command that fixes specifically the
 problems
  with A, don't drag in the entire canvas path API. :-)

 We're not, we're pulling in the two/four useful arc commands.

 ~TJ



Re: [whatwg] New URL Standard

2012-09-24 Thread Boris Zbarsky

On 9/24/12 4:58 AM, Anne van Kesteren wrote:

Say you have a href=data:test/; the concern is what e.g.
a.protocol and a.pathname would return here. For invalid URLs they
would return : and  respectively. If we treat this as a valid URL
you would get data: and test. In Gecko I get http: and . If I
make that a href=data:text/html,test/ Gecko will give meaningful
answers (well pathname is still , maybe that is okay and pathname
should only work for hierarchical URLs).


Ah, I see.

So what happens here is that Gecko treats this as an invalid URL (more 
precisely, it cannot create an internal URI object from this string). 
 I guess that's what you were getting at: that data: URLs actually have 
a concept of invalid in Gecko.  This is actually true for all schemes 
Gecko supports, in general.  For example, http://something or other 
(with the spaces) will do the same thing.


For an invalid URI, .protocol currently returns http: in Gecko.  I 
have no idea why, offhand.  It could just as easily return :.


As far as .pathname, what Gecko does is exactly what you say: .pathname 
only works on hierarchical schemes.



More general, what I want is that for *any* given input in a
href=.../, xhr.open(GET, ...), new URL(...), etc. I want to be
able to tell what the various URL components are going to be. The kind
of predictability we have for the HTML parser, I want to have for the
URL parser as well.


Yes, absolutely agreed.


(If that means handling data URLs at the layer of the URL parser
rather than a separate parser that goes over the path, as Gecko
appears to be doing, so be it.)


We could change Gecko's handling here, for what it's worth.  One reason 
for the current handling is that right now we don't even make a into a 
link unless its href is a valid URI as far as Gecko is concerned.  But 
I'm considering changing that anyway, since no one else bothers with 
such niceties and they complicate implementation a bit...



If you want constructive advice, it would be interesting to get a full list
of all the weird stuff that UAs do here so we can evaluate which parts of it
are needed and why.  I can try to produce such a list for Gecko, if there
seems to be motion on the general idea.


I think that would be a great start. I'm happy to start out with
Gecko's behavior and iterate over time as feedback comes in from other
browsers.


Hmm.  So here goes at least a partial list:

1)  On Windows and OS/2, Gecko replaces '\\' with '/' in file:// URI 
strings before doing anything else with the string when parsing a new 
URL.  That includes relative URI strings being resolved against a 
file:// base.


2)  file:// URIs are parsed as a no authority URL in Gecko.  Quoting 
the IDL comment:


35 /**
36  * blah:foo/bar= blah:///foo/bar
37  * blah:/foo/bar   = blah:///foo/bar
38  * blah://foo/bar  = blah://foo/bar
39  * blah:///foo/bar = blah:///foo/bar
40  */

where the thing on the left is the input string and the thing on the 
right is the normalized form that the parser produces from it.  Note 
that this is different from how HTTP URIs are parsed, for all except the 
item on line number 38 there.


3)  Gecko does not allow setting a username, password, hostname, port on 
an existing no authority URL object, including file://.  Attempts to 
do that throw internally; I believe for web stuff it just becomes a no-op.


4)  For no authority URLs, including file://, on Windows and OS/2 
only, if what looks like authority section looks like a drive letter, 
it's treated as part of the path.  For example, file://c:/ is treated 
as the filename c:\.  Looks like a drive letter is defined as ASCII 
letter (any case), followed by a ':' or '|' and then followed by end of 
string or '/' or '\\'.  I'm not sure why this is checking for '\\' 
again, honestly.  ;)


5)  When parsing a no authority URL (including file://), and when item 
4 above does not apply, it looks like Gecko skips everything after 
file:// up until the next '/', '?', or '#' char before parsing path stuff.


6)  On Windows and OS/2, when dynamically parsing a path for a no 
authority URL (not sure whether this is actually web-exposed, fwiw...) 
Gecko will do something involving looking for a path that's only an 
ASCII letter followed by ':' or '|' followed by end of string.  I'm not 
quite sure what that part is about...  It might have to do with the fact 
that URI objects in Gecko can have concepts of directory, filename, 
extension or something like that.


7)  When doing URI equality comparisons, if two file:// URIs only differ 
in their directory/filename/extension (so the actual file path), then an 
equality comparison is done on the underlying file path objects.  What 
this means depends on the OS.  On Unix this is just a straight-up byte 
by byte compare of file paths.  I think OS X now follows the Unix code 
path as do most other supported platforms.  But note that file path in 
this case is normalized in various ways.  

Re: [whatwg] New URL Standard

2012-09-24 Thread Tab Atkins Jr.
On Mon, Sep 24, 2012 at 2:34 AM, Anne van Kesteren ann...@annevk.nl wrote:
 I have been thinking about introducing a .query attribute that would
 return a special interface for this purpose, but what the right API
 should be seems somewhat tricky. Adam and Erik came up with a solution
 that introduces eight new methods (see
 http://dvcs.w3.org/hg/url/raw-file/tip/Overview.html#url ) but I hope
 we can find something more elegant. (Unless we are stuck with their
 solution for some reason, but I believe that is not the case.)

Yeah, that interface is pretty unfriendly.

I suggest just making it a map from String-[String].  You probably
want a little bit of magic - if the setter receives an array, replace
the current value with it; anything else, stringify then wrap in an
array and replace the current value.  The getter should return an
empty array for non-existing params.  You should be able to set .query
itself with an object, which empties out the map and then runs the
setter over all the items.  Bam, every single methods is now obsolete.

~TJ


Re: [whatwg] Rename the 7-arg arcTo() to ellipseTo()?

2012-09-24 Thread Tab Atkins Jr.
On Mon, Sep 24, 2012 at 6:59 AM, Rick Waldron waldron.r...@gmail.com wrote:
 Has there been any discussion about moving newly emerging APIs to a single
 options object formal parameter?

This discussion is in the context of the SVG path API, which is an
attribute microsyntax.  So, that's not possible for this.  ^_^

However, we discussed several ways to make path editting friendlier,
one of which was to expose a JSON representation both for getting and
setting paths or path segments.  So that's basically the same as just
adding a single options object.

~TJ


Re: [whatwg] Rename the 7-arg arcTo() to ellipseTo()?

2012-09-24 Thread Rick Waldron
On Mon, Sep 24, 2012 at 1:32 PM, Tab Atkins Jr. jackalm...@gmail.comwrote:

 On Mon, Sep 24, 2012 at 6:59 AM, Rick Waldron waldron.r...@gmail.com
 wrote:
  Has there been any discussion about moving newly emerging APIs to a
 single
  options object formal parameter?

 This discussion is in the context of the SVG path API, which is an
 attribute microsyntax.  So, that's not possible for this.  ^_^


0_o Thanks for the clarification on that...

Rick




 However, we discussed several ways to make path editting friendlier,
 one of which was to expose a JSON representation both for getting and
 setting paths or path segments.  So that's basically the same as just
 adding a single options object.

 ~TJ



Re: [whatwg] Rename the 7-arg arcTo() to ellipseTo()?

2012-09-24 Thread Ian Hickson
On Sun, 23 Sep 2012, Tab Atkins Jr. wrote:
 On Sun, Sep 23, 2012 at 3:57 PM, Ian Hickson i...@hixie.ch wrote:
  On Fri, 21 Sep 2012, Tab Atkins Jr. wrote:
  So, can we rename the 7-arg arcTo to ellipseTo?  That seems to 
  support your always [require] all the arguments recommendation. ^_^
 
  Just have one arcTo command, that takes all the arguments. Why split 
  it into two, if you always require all the arguments?
 
 Oh, that's what you meant.
 
 That seems silly.  It's more convenient and simple for authors to have a 
 circular form, separate from the elliptical form.  It lets you omit the 
 second radius and the rotation, as they're irrelevant.

Omitting two numbers, one of which is zero, is easily no more a win than 
the cost of having two different nearly-identical commands. Just consider 
C/c and S/s; is it really worth it?


   In general, though, I wouldn't recommend trying to do this at all. 
   The SVG path syntax is its own thing, and it already supports arcs 
   and so forth. Adding a whole new redundant set of commands that 
   work slightly differently is just bloat asking for interop issues, 
   IMHO. The design of the path syntax makes sense, it's terse. 
   Embrace its strengths, don't second-guess its design.
 
  The existing SVG A command is one of the largest source of 
  complaints from hand-authors. While it's *occasionally* useful as 
  stated, it often requires you to do trig to get the effect you want. 
  The Canvas arc commands, with their use of an angle to sweep across, 
  are exactly what authors want a lot of the time, and commonly ask 
  for.
 
  So introduce a new one-letter command that fixes specifically the 
  problems with A, don't drag in the entire canvas path API. :-)
 
 We're not, we're pulling in the two/four useful arc commands.

I have to admit to being very confused about what you're trying to do.

What's wrong with A/a? It seems to be equivalent to arcTo(). Is it arc() 
that you want to add? I'm very confused.

-- 
Ian Hickson   U+1047E)\._.,--,'``.fL
http://ln.hixie.ch/   U+263A/,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'


Re: [whatwg] Proposal for Links to Unrelated Browsing Contexts

2012-09-24 Thread Ian Hickson
On Mon, 27 Aug 2012, Charlie Reis wrote:
  
  Does this need to be done from window.open()?
 
 Yes.  For example, Gmail uses window.open() for the links in emails, but 
 would like the links to open in an unrelated context.

Why does GMail need to use window.open()? Surely the right way to expose a 
link is to use a href=. What is forcing them to use window.open()? 
(Using window.open() has a number of negative side-effects, so if we could 
move them off that that would be a win. Furthermore, not having to support 
window.open() here would in general make this far easier. So if there 
really is a need to support window.open(), I would like to understand it.)

-- 
Ian Hickson   U+1047E)\._.,--,'``.fL
http://ln.hixie.ch/   U+263A/,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'


Re: [whatwg] Rename the 7-arg arcTo() to ellipseTo()?

2012-09-24 Thread Tab Atkins Jr.
On Mon, Sep 24, 2012 at 11:51 AM, Ian Hickson i...@hixie.ch wrote:
 On Sun, 23 Sep 2012, Tab Atkins Jr. wrote:
 On Sun, Sep 23, 2012 at 3:57 PM, Ian Hickson i...@hixie.ch wrote:
  On Fri, 21 Sep 2012, Tab Atkins Jr. wrote:
  So, can we rename the 7-arg arcTo to ellipseTo?  That seems to
  support your always [require] all the arguments recommendation. ^_^
 
  Just have one arcTo command, that takes all the arguments. Why split
  it into two, if you always require all the arguments?

 Oh, that's what you meant.

 That seems silly.  It's more convenient and simple for authors to have a
 circular form, separate from the elliptical form.  It lets you omit the
 second radius and the rotation, as they're irrelevant.

 Omitting two numbers, one of which is zero, is easily no more a win than
 the cost of having two different nearly-identical commands. Just consider
 C/c and S/s; is it really worth it?

Yes, it is.  ^_^  The authoring convenience of not having to repeat
things, or not having to read past useless things, is fairly
significant.


  So introduce a new one-letter command that fixes specifically the
  problems with A, don't drag in the entire canvas path API. :-)

 We're not, we're pulling in the two/four useful arc commands.

 I have to admit to being very confused about what you're trying to do.

 What's wrong with A/a? It seems to be equivalent to arcTo(). Is it arc()
 that you want to add? I'm very confused.

Oh, no, they're *completely* different.  arcTo() is *great*, because
it's convenient and solves a useful problem (rounding a corner)
without you having to do much math.  For A, you have to determine the
start/end points on the circle yourself, usually involving trig.  The
only similarity between the two commands is that they both draw an arc
as part of their operation.

~TJ


Re: [whatwg] Rename the 7-arg arcTo() to ellipseTo()?

2012-09-24 Thread Jonas Sicking
On Mon, Sep 24, 2012 at 11:51 AM, Ian Hickson i...@hixie.ch wrote:
 On Sun, 23 Sep 2012, Tab Atkins Jr. wrote:
 On Sun, Sep 23, 2012 at 3:57 PM, Ian Hickson i...@hixie.ch wrote:
  On Fri, 21 Sep 2012, Tab Atkins Jr. wrote:
  So, can we rename the 7-arg arcTo to ellipseTo?  That seems to
  support your always [require] all the arguments recommendation. ^_^
 
  Just have one arcTo command, that takes all the arguments. Why split
  it into two, if you always require all the arguments?

 Oh, that's what you meant.

 That seems silly.  It's more convenient and simple for authors to have a
 circular form, separate from the elliptical form.  It lets you omit the
 second radius and the rotation, as they're irrelevant.

 Omitting two numbers, one of which is zero, is easily no more a win than
 the cost of having two different nearly-identical commands. Just consider
 C/c and S/s; is it really worth it?

I'm not at all convinced that that's true. Sure, it is fewer number of
functions to document and fewer number of functions for people to
learn. But that obviously isn't the only metric that we care about
since then we'd just cram all functionality into a single function
with a huge number of optional arguments.

Optional arguments, especially once that make a function behave very
different, makes code harder to read. It also means that people have
to put more complexity into their heads as they have to remember which
number of arguments gives what behavior.

All in all I generally try to avoid optional arguments except when
their behavior is very obvious. Using dictionaries help a bunch since
they add documentation right in the code of what the purpose is for
each optional argument.

/ Jonas


Re: [whatwg] Rename the 7-arg arcTo() to ellipseTo()?

2012-09-24 Thread Ian Hickson
On Mon, 24 Sep 2012, Jonas Sicking wrote:
 
 I'm not at all convinced that that's true. Sure, it is fewer number of 
 functions to document and fewer number of functions for people to learn. 
 But that obviously isn't the only metric that we care about since then 
 we'd just cram all functionality into a single function with a huge 
 number of optional arguments.

We're talking about SVG path syntax here, not methods.

-- 
Ian Hickson   U+1047E)\._.,--,'``.fL
http://ln.hixie.ch/   U+263A/,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'


Re: [whatwg] Rename the 7-arg arcTo() to ellipseTo()?

2012-09-24 Thread Ian Hickson
On Mon, 24 Sep 2012, Tab Atkins Jr. wrote:
 
  Omitting two numbers, one of which is zero, is easily no more a win 
  than the cost of having two different nearly-identical commands. Just 
  consider C/c and S/s; is it really worth it?
 
 Yes, it is.  ^_^ The authoring convenience of not having to repeat 
 things, or not having to read past useless things, is fairly 
 significant.

Do we have any data on this? If this really is a concern, it may suggest 
that maybe the whole path syntax should be rethought. As it stands it 
already has quite a lot of repetition. For example, look at the amount of 
repetition in the examples for A/a in the SVG spec.


  What's wrong with A/a? It seems to be equivalent to arcTo(). Is it 
  arc() that you want to add? I'm very confused.
 
 Oh, no, they're *completely* different.  arcTo() is *great*, because 
 it's convenient and solves a useful problem (rounding a corner) without 
 you having to do much math.  For A, you have to determine the start/end 
 points on the circle yourself, usually involving trig.  The only 
 similarity between the two commands is that they both draw an arc as 
 part of their operation.

I don't really follow.

The main use case for arcTo() is rounded corners. With A/a, these are 
trivial. Consider a 300x150 rectangle with 10px radius corners, top left 
corner at 0,0. There's no trig necessary, you just give the points on each 
side, with the radius as offset:

   d=M10,0 H290 A10,10 0 0 1 300,10
V140 A10,10 0 0 1 290,150
H10  A10,10 0 0 1   0,140
V10  A10,10 0 0 1  10,0   
  Z

(The Z isn't really necessary.)

If anything, I'd say this is better than what you have to do with 
arcTo(), since with that one you have to give both the corner coordinate 
and the destination coordinate, rather than just the latter.

Could you elaborate on what exactly it is that is being done here? If 
there were some examples showing the problems that would really help.

-- 
Ian Hickson   U+1047E)\._.,--,'``.fL
http://ln.hixie.ch/   U+263A/,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'


Re: [whatwg] New URL Standard

2012-09-24 Thread David Sheets
On Mon, Sep 24, 2012 at 2:34 AM, Anne van Kesteren ann...@annevk.nl wrote:
 On Sat, Sep 22, 2012 at 9:10 AM, Alexandre Morgaut alexandre.morg...@4d.com 
 wrote:
 Shouldn't this document have references on some of the URL related RFCs:

 The plan is to obsolete the RFCs. But yes, I will add some references
 in the Goals section most likely. Similar to what has been done in the
 DOM Standard.

Is there an issue with defining WHATWG-URL syntax as a grammar
extension to the URI syntax in RFC3986?

How about splitting the definition of the parsing algorithm into a
canonicalization algorithm and a separate parser for the extended
syntax? The type would be string - string with the codomain as a
valid, unique WHATWG-URL serialization. Implementations/IDL could
provide only the composition of canonicalization and parsing but
humans trying to understand the semantics of the present algorithm
would be aided by having these phases explicitly defined.

Will any means be provided to map WHATWG-URL to Internet Standard
RFC3986-URI? Is interoperability with the deployed base of URL
consumers a goal? How will those URLs in the extended syntax be mapped
into standard URIs? Will they be unrepresentable?

Thanks,

David Sheets


Re: [whatwg] Rename the 7-arg arcTo() to ellipseTo()?

2012-09-24 Thread Tab Atkins Jr.
On Mon, Sep 24, 2012 at 1:14 PM, Ian Hickson i...@hixie.ch wrote:
 On Mon, 24 Sep 2012, Tab Atkins Jr. wrote:
 
  Omitting two numbers, one of which is zero, is easily no more a win
  than the cost of having two different nearly-identical commands. Just
  consider C/c and S/s; is it really worth it?

 Yes, it is.  ^_^ The authoring convenience of not having to repeat
 things, or not having to read past useless things, is fairly
 significant.

 Do we have any data on this? If this really is a concern, it may suggest
 that maybe the whole path syntax should be rethought. As it stands it
 already has quite a lot of repetition. For example, look at the amount of
 repetition in the examples for A/a in the SVG spec.

Yes, the A/a commands (ArcBetween) are elliptical-only, which is
problematic.  As part of our revamping of paths, particular the arc
syntaxes, I'll be proposing a circular ArcBetween as well.  That
eliminates the repetition.

  What's wrong with A/a? It seems to be equivalent to arcTo(). Is it
  arc() that you want to add? I'm very confused.

 Oh, no, they're *completely* different.  arcTo() is *great*, because
 it's convenient and solves a useful problem (rounding a corner) without
 you having to do much math.  For A, you have to determine the start/end
 points on the circle yourself, usually involving trig.  The only
 similarity between the two commands is that they both draw an arc as
 part of their operation.

 I don't really follow.

 The main use case for arcTo() is rounded corners. With A/a, these are
 trivial. Consider a 300x150 rectangle with 10px radius corners, top left
 corner at 0,0. There's no trig necessary, you just give the points on each
 side, with the radius as offset:

d=M10,0 H290 A10,10 0 0 1 300,10
 V140 A10,10 0 0 1 290,150
 H10  A10,10 0 0 1   0,140
 V10  A10,10 0 0 1  10,0
   Z

 (The Z isn't really necessary.)

 If anything, I'd say this is better than what you have to do with
 arcTo(), since with that one you have to give both the corner coordinate
 and the destination coordinate, rather than just the latter.

 Could you elaborate on what exactly it is that is being done here? If
 there were some examples showing the problems that would really help.

You are looking at the simplest possible use-case for A/a, nearly the
only case that can be done without trig, where you're starting and
stopping the arc at a quarter-turn.  Try virtually anything more
complex, like rotating the square 45deg.  Using arcTo it's still
trivial - you just need to know enough trig to figure out that the
corners are now at (0, 1.414), etc., and the command takes care of the
rest for you.  With A/a, you need to do a bit more to translate the
points of the diamond into the start/end of the arc.

Don't even get me started on trying to do a 5-pointed star with rounded corners.

In general, if you can do a sharp corner, you can do a rounded corner
with arcTo.  You need no additional information.  arcBetween almost
always needs significantly more information.

~TJ


Re: [whatwg] Rename the 7-arg arcTo() to ellipseTo()?

2012-09-24 Thread Ian Hickson
On Mon, 24 Sep 2012, Tab Atkins Jr. wrote:
 
 You are looking at the simplest possible use-case for A/a, nearly the 
 only case that can be done without trig, where you're starting and 
 stopping the arc at a quarter-turn.  Try virtually anything more 
 complex, like rotating the square 45deg.  Using arcTo it's still trivial 
 - you just need to know enough trig to figure out that the corners are 
 now at (0, 1.414), etc., and the command takes care of the rest for you.  
 With A/a, you need to do a bit more to translate the points of the 
 diamond into the start/end of the arc.
 
 Don't even get me started on trying to do a 5-pointed star with rounded 
 corners.
 
 In general, if you can do a sharp corner, you can do a rounded corner 
 with arcTo.  You need no additional information.  arcBetween almost 
 always needs significantly more information.

Fair enough.

Anyway, my original point stands: I don't see why this would have any 
impact on the canvas API. The API to be consistent with is the existing 
path API, not the canvas one. If you did want to introduce optional 
arguments to the path API, though, that would be relatively trivial; just 
introduce a punctuation mark that means end of arguments, e.g. /.

   B 10,10 20,20 5 / 30,30 40,40 10

...instead of:

   B 10,10 20,20 5 5 0 30,30 40,40 10 5 0

...(where B is a command that takes the same arguments as arcTo().)

-- 
Ian Hickson   U+1047E)\._.,--,'``.fL
http://ln.hixie.ch/   U+263A/,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'


Re: [whatwg] Rename the 7-arg arcTo() to ellipseTo()?

2012-09-24 Thread Dirk Schulze


On Sep 24, 2012, at 3:50 PM, Ian Hickson i...@hixie.ch wrote:

 On Mon, 24 Sep 2012, Tab Atkins Jr. wrote:
 
 You are looking at the simplest possible use-case for A/a, nearly the 
 only case that can be done without trig, where you're starting and 
 stopping the arc at a quarter-turn.  Try virtually anything more 
 complex, like rotating the square 45deg.  Using arcTo it's still trivial 
 - you just need to know enough trig to figure out that the corners are 
 now at (0, 1.414), etc., and the command takes care of the rest for you.  
 With A/a, you need to do a bit more to translate the points of the 
 diamond into the start/end of the arc.
 
 Don't even get me started on trying to do a 5-pointed star with rounded 
 corners.
 
 In general, if you can do a sharp corner, you can do a rounded corner 
 with arcTo.  You need no additional information.  arcBetween almost 
 always needs significantly more information.
 
 Fair enough.
 
 Anyway, my original point stands: I don't see why this would have any 
 impact on the canvas API. The API to be consistent with is the existing 
 path API, not the canvas one. If you did want to introduce optional 
 arguments to the path API, though, that would be relatively trivial; just 
 introduce a punctuation mark that means end of arguments, e.g. /.
 
   B 10,10 20,20 5 / 30,30 40,40 10
 
 ...instead of:
 
   B 10,10 20,20 5 5 0 30,30 40,40 10 5 0
 
 ...(where B is a command that takes the same arguments as arcTo().)
 

Tab already noted that the SVG WG will add arc/arcTo ellipse/ellipseTo after 
user requests. And we would like to be as consistent with Canvas as possible. 
Making the path syntax more complex than it needs to be seems not to be an 
option for me. But you are right that it does not need to be a problem with the 
Canvas API.

To be honest it seems very confusing to me that Canvas has arc() and ellipse() 
but no ellipseTo() as pendant to ellipse().

Greetings,
Dirk

 -- 
 Ian Hickson   U+1047E)\._.,--,'``.fL
 http://ln.hixie.ch/   U+263A/,   _.. \   _\  ;`._ ,.
 Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'


Re: [whatwg] Rename the 7-arg arcTo() to ellipseTo()?

2012-09-24 Thread Tab Atkins Jr.
On Mon, Sep 24, 2012 at 3:50 PM, Ian Hickson i...@hixie.ch wrote:
 On Mon, 24 Sep 2012, Tab Atkins Jr. wrote:
 You are looking at the simplest possible use-case for A/a, nearly the
 only case that can be done without trig, where you're starting and
 stopping the arc at a quarter-turn.  Try virtually anything more
 complex, like rotating the square 45deg.  Using arcTo it's still trivial
 - you just need to know enough trig to figure out that the corners are
 now at (0, 1.414), etc., and the command takes care of the rest for you.
 With A/a, you need to do a bit more to translate the points of the
 diamond into the start/end of the arc.

 Don't even get me started on trying to do a 5-pointed star with rounded
 corners.

 In general, if you can do a sharp corner, you can do a rounded corner
 with arcTo.  You need no additional information.  arcBetween almost
 always needs significantly more information.

 Fair enough.

 Anyway, my original point stands: I don't see why this would have any
 impact on the canvas API. The API to be consistent with is the existing
 path API, not the canvas one. If you did want to introduce optional
 arguments to the path API, though, that would be relatively trivial; just
 introduce a punctuation mark that means end of arguments, e.g. /.

B 10,10 20,20 5 / 30,30 40,40 10

 ...instead of:

B 10,10 20,20 5 5 0 30,30 40,40 10 5 0

 ...(where B is a command that takes the same arguments as arcTo().)

Returning to the original subject, we don't *want* optional arguments
here.  We prefer using the names arc and ellipse to denote
circular and elliptical variants of the commands.  Right now, the
canvas path API is inconsistent with itself, using arc/ellipse in one
place, and using arc with optional arguments in another.  We would
prefer to align the syntaxes of canvas path and SVG path as much as
possible, to help authors translate knowledge between the two.  As
such, we're requesting that the canvas path API change to be
consistent with itself, in the direction that we prefer.

~TJ


Re: [whatwg] New URL Standard

2012-09-24 Thread Glenn Maynard
On Mon, Sep 24, 2012 at 12:30 PM, Tab Atkins Jr. jackalm...@gmail.comwrote:

 I suggest just making it a map from String-[String].  You probably
 want a little bit of magic - if the setter receives an array, replace
 the current value with it; anything else, stringify then wrap in an
 array and replace the current value.  The getter should return an
 empty array for non-existing params.  You should be able to set .query
 itself with an object, which empties out the map and then runs the
 setter over all the items.  Bam, every single methods is now obsolete.


When should this API guarantee that it round-trips URLs cleanly (aside from
quoting differences)?  For example, maintaining order in a=1b=2a=1, and
representing things like a=1b (no '=') and ab (no key at all).

Not round-tripping URLs might have annoying side-effects, like trying to
use history.replaceState to replace the path portion of the URL, and
unexpectedly having the query part of the URL get shuffled around or
changed in other ways.

Maybe it could guarantee that the query round-trips only if the value is
never modified (only assigned via the ctor or assigning to href), but once
you modify the query, the order becomes normalized and any other
non-round-trip side effects happen.

By the way, it would also be nice for the query part of this API to be
usable in isolation.  I often put query-like strings in the hash, resulting
in URLs like 
http://example.com/server/side/path?server-side-query=1#client/side/path?client-side-query=1;,
and it would be nice to be able to work with both of these with the same
interface.  That is, query = new URLQuery(a=bc=d); query[a] = x;
query.toString() == a=xc=d;

-- 
Glenn Maynard


Re: [whatwg] Rename the 7-arg arcTo() to ellipseTo()?

2012-09-24 Thread Ian Hickson
On Mon, 24 Sep 2012, Dirk Schulze wrote:
 
 Making the path syntax more complex than it needs to be seems not to be 
 an option for me.

It's definitely an option, assuming this is not a trivial statement, 
because it's no the only axis along which the syntax can be optimised, and 
it is not the axis that has been used previously. Specifically, the path 
syntax has clearly been optimised for terseness and power, at the expense 
of simplicity.

Nothing can quite mess up an API or language like changing optimisation 
function (changing design philosophy) half-way through its life. You end 
up with languages that feel like they have multiple personality disorder, 
and it ends up being much harder to learn the language than if it was 
consistent with itself but overall more complicated than possible.

That is, a language that has complexity 10 throughout is easier to learn 
and use than a language that is half complexity 10 and half complexity 1. 
This is a lesson we have learnt many times on the Web, not least of which 
with HTML, which has lurched in many directions over its lifetime, 
leaving authors highly frustrated and confused.


 To be honest it seems very confusing to me that Canvas has arc() and 
 ellipse() but no ellipseTo() as pendant to ellipse().

ellipse() exists only because arc() already had optional arguments and the 
resulting API had arc() been extended to support ellipse()'s use case 
would have been to have the radii arguments split or to have optional 
arguments in the middle, which is IMHO even worse than adding another 
method. It's an unfortunate situation, certainly.


On Mon, 24 Sep 2012, Tab Atkins Jr. wrote:
 
 Returning to the original subject, we don't *want* optional arguments 
 here.

Well, the canvas API has optional arguments, so there's no way to be 
consistent with canvas with this constraint. (This is the case even before 
ellipses are considered.)


 We prefer using the names arc and ellipse to denote circular and 
 elliptical variants of the commands.

I think this will make the path language really ugly, assuming you're 
talking about the commands and not the names (as in, the strings in d= 
will now be long instead of one-letter commands), and I question whether 
this makes sense, but that's a discussion for the www-svg list.


 Right now, the canvas path API is inconsistent with itself, using 
 arc/ellipse in one place, and using arc with optional arguments in 
 another.

Specifically, it's using arc and arcTo with optional arguments, and 
ellipse separately, because arc couldn't be extended sanely the way arcTo 
could be.


 We would prefer to align the syntaxes of canvas path and SVG path as 
 much as possible, to help authors translate knowledge between the two.  

I think it would be far more useful for SVG to be consistent with itself, 
have no similarity with canvas, and present a sane language, than to have 
SVG inconsistent with both itself and canvas, and present a fractured 
language that is hard to learn.


 As such, we're requesting that the canvas path API change to be 
 consistent with itself, in the direction that we prefer.

I believe the canvas API is adequately consistent with itself given the 
constraints facing this API's evolution, and so have not changed it.

-- 
Ian Hickson   U+1047E)\._.,--,'``.fL
http://ln.hixie.ch/   U+263A/,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'


[whatwg] canvas and high-density displays

2012-09-24 Thread Ian Hickson
On Thu, 1 Dec 2011, John Knottenbelt wrote:

 How should the data url returned by toDataURL be sized in the case of a 
 high device dpi resolution system?

This is now specced, at least in theory. Please let me know if you still 
think this is underdefined.


 The test 
 http://philip.html5.org/tests/canvas/suite/tests/toDataURL.png.primarycolours.html
  
 makes a drawing with canvas, saves this drawing to a data url, loads the 
 data url into an Image element and then draws that back to the canvas, 
 and then performs some assertions that the image is as expected.
 
 I've been trying this out in the DumpRenderTree test runner of WebKit, 
 where toDataURL returns an image derived from the canvas' backing store 
 image data. If I set the device dpi scale to 2.0 to imitate a high DPI 
 display, the test will fail because the image returned by toDataURL is 
 now four times as big as the test expects it to be.

Yeah, this should be changed to use toDataURLHD.


 Is this correct behaviour, or is the test correct and I simply have a 
 bug in WebKit?

You had a bug in WebKit according to the old spec, but since none of the 
browsers correctly implemented the resolution stuff, I've changed the way 
to the spec does it and now it's the test that's got the bug. :-)


On Mon, 16 Apr 2012, Darin Fisher wrote:
 
 Aren't we missing an opportunity here?  By giving web developers this 
 easy migration path, you're also giving up the opportunity to encourage 
 them to use a better API.  Asynchronous APIs are harder to use, and 
 that's why we need to encourage their adoption.  If you just give people 
 a synchronous version that accomplishes the same thing, then they will 
 just use that, even if doing so causes their app to perform poorly.
 
 See synchronous XMLHttpRequest.  I'm sure every browser vendor wishes 
 that didn't exist.  Note how we recently withdrew support for 
 synchronous ArrayBuffer access on XHR?  We did this precisely to 
 discourage use of synchronous mode XHR. Doing so actually broke some 
 existing web pages.  The pain was deemed worth it.
 
 GPU readback of a HD buffer is going to suck.  Any use of this new API 
 is going to suck.

On Mon, 16 Apr 2012, Oliver Hunt wrote:
 
 Any use of imagedata i've seen assumes that they can avoid intermediate 
 states in the canvas ever being visible, if you make reading and writing 
 the data asynchronous you break that invariant and suddenly makes things 
 much harder for the user.
 
 The reason we don't want IO synchronous is because IO can take a 
 potentially unbound amount of time, if you're on a platform that makes a 
 memcpy take similarly unbound time, i recommend that you work around it.
 
 Anyway, the sensible approach to imagedata + hardware backed canvas is 
 to revert to a software backed canvas, as once someone has used 
 imagedata once, they're likely to do it again (and again, and again) so 
 it is probably a win to just do everything in software at that point.  
 Presumably you could through in heuristics to determine whether or not 
 it's worth going back to the GPU at some point, but many of the common 
 image data use cases will have awful perf if you try to keep them on the 
 GPU 100% of the time.

On Mon, 16 Apr 2012, Darin Fisher wrote:
 
 Of course, GPU readbacks do not compare to network IO.  However, if the 
 goal is to achieve smooth animations, then it is important that the main 
 thread not hitch for multiple animation frames.  GPU readbacks are 
 irregular in duration and can sometimes be quite expensive if the GPU 
 pipeline is heavily burdened.
 
 I don't think it is OK if at application startup (or animation startup) 
 there is a big UI glitch as the system determines that it should not 
 GPU-back a canvas.  We have the opportunity now to design an API that 
 does not have that bug.
 
 Why don't you want to take advantage of this opportunity?

On Mon, 16 Apr 2012, Oliver Hunt wrote:
 
 We can already do imagedata based access on a gpu backed canvas in 
 webkit without ill effects simply by pulling the canvas off GPU memory.  
 I don't understand why adding a runloop cycle to any read seems like 
 something that would introduce a much more noticable delay than a 
 memcopy.  I also don't understand what makes reading from the GPU so 
 expensive that adding a runloop cycle is necessary for good perf, but 
 it's unnecessary for a write.  This feels like an argument along the 
 lines of we hate synchronous APIs, but they make sense for graphics.  
 Let's try and make at least part of this asynchronous to satisfy that 
 particular desire.
 
 Moving data to and from the GPU may be expensive, but i doubt it holds a 
 candle to the cost of waiting for a full runloop cycle, unless you're 
 doing something really inefficient in your backing store management.  
 The fact is that the ImageData is a pixel manipulation API, and any such 
 API is not conducive to good performance on the GPU.

On Mon, 16 Apr 2012, Glenn Maynard wrote:
 
 The use 

Re: [whatwg] Rename the 7-arg arcTo() to ellipseTo()?

2012-09-24 Thread Dirk Schulze

On Sep 24, 2012, at 4:32 PM, Ian Hickson i...@hixie.ch wrote:

 On Mon, 24 Sep 2012, Dirk Schulze wrote:
 
 Making the path syntax more complex than it needs to be seems not to be 
 an option for me.
 
 It's definitely an option, assuming this is not a trivial statement, 
 because it's no the only axis along which the syntax can be optimised, and 
 it is not the axis that has been used previously. Specifically, the path 
 syntax has clearly been optimised for terseness and power, at the expense 
 of simplicity.
And this simplicity is asked from developers over the power of the existing 
segments. It is already strange that not even authoring tools use a/A, neither 
Illustrator nor Inkscape, the most famous SVG creation tools.

 
 Nothing can quite mess up an API or language like changing optimisation 
 function (changing design philosophy) half-way through its life. You end 
 up with languages that feel like they have multiple personality disorder, 
 and it ends up being much harder to learn the language than if it was 
 consistent with itself but overall more complicated than possible.
Sometimes this is the price of backwards compatibility.

 
 That is, a language that has complexity 10 throughout is easier to learn 
 and use than a language that is half complexity 10 and half complexity 1. 
 This is a lesson we have learnt many times on the Web, not least of which 
 with HTML, which has lurched in many directions over its lifetime, 
 leaving authors highly frustrated and confused.
Well, we just add new segments and don't mess up the existing syntax. Authors 
have the freedom to choose between the path syntax they want.


 
 
 To be honest it seems very confusing to me that Canvas has arc() and 
 ellipse() but no ellipseTo() as pendant to ellipse().
 
 ellipse() exists only because arc() already had optional arguments and the 
 resulting API had arc() been extended to support ellipse()'s use case 
 would have been to have the radii arguments split or to have optional 
 arguments in the middle, which is IMHO even worse than adding another 
 method. It's an unfortunate situation, certainly.
I believe you that this wash't your intention initially, but the inconsistency 
is the naming now. Canvas has arc and ellipse on the one side and just arcTo on 
the other side.

 
 
 On Mon, 24 Sep 2012, Tab Atkins Jr. wrote:
 
 Returning to the original subject, we don't *want* optional arguments 
 here.
 
 Well, the canvas API has optional arguments, so there's no way to be 
 consistent with canvas with this constraint. (This is the case even before 
 ellipses are considered.)
Yes, there have been optional arguments before. The question is just related to 
arcTo() and ellipseTo() they don't need to differ so much from the idea of 
arc() and ellipse().

 
 
 We prefer using the names arc and ellipse to denote circular and 
 elliptical variants of the commands.
 
 I think this will make the path language really ugly, assuming you're 
 talking about the commands and not the names (as in, the strings in d= 
 will now be long instead of one-letter commands), and I question whether 
 this makes sense, but that's a discussion for the www-svg list.
This is a separate discussion and you can definitely mail to www-svg raising 
this concern. At some point SVG runs out of meaningful letters :)

 
 
 Right now, the canvas path API is inconsistent with itself, using 
 arc/ellipse in one place, and using arc with optional arguments in 
 another.
 
 Specifically, it's using arc and arcTo with optional arguments, and 
 ellipse separately, because arc couldn't be extended sanely the way arcTo 
 could be.
 
 
 We would prefer to align the syntaxes of canvas path and SVG path as 
 much as possible, to help authors translate knowledge between the two.  
 
 I think it would be far more useful for SVG to be consistent with itself, 
 have no similarity with canvas, and present a sane language, than to have 
 SVG inconsistent with both itself and canvas, and present a fractured 
 language that is hard to learn.
Not if we have the feedback of authors that the current syntax is to complex 
for a lot of cases. It doesn't make sense to act against wishes of web authors.

 
 
 As such, we're requesting that the canvas path API change to be 
 consistent with itself, in the direction that we prefer.
 
 I believe the canvas API is adequately consistent with itself given the 
 constraints facing this API's evolution, and so have not changed it.
I don't see the changes on SVG as a requirement for Canvas to change the API. I 
am just in favor for a harmonization. Canvas and SVG don't need to be two fully 
separate drawing languages. There is a lot of interest from web authors to use 
both.

Greetings,
Dirk

 
 -- 
 Ian Hickson   U+1047E)\._.,--,'``.fL
 http://ln.hixie.ch/   U+263A/,   _.. \   _\  ;`._ ,.
 Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'



Re: [whatwg] Rename the 7-arg arcTo() to ellipseTo()?

2012-09-24 Thread Tab Atkins Jr.
On Mon, Sep 24, 2012 at 4:32 PM, Ian Hickson i...@hixie.ch wrote:
 On Mon, 24 Sep 2012, Tab Atkins Jr. wrote:
 Returning to the original subject, we don't *want* optional arguments
 here.

 Well, the canvas API has optional arguments, so there's no way to be
 consistent with canvas with this constraint. (This is the case even before
 ellipses are considered.)

This is a very minor inconsistency, and one that we feel is acceptable.

 Right now, the canvas path API is inconsistent with itself, using
 arc/ellipse in one place, and using arc with optional arguments in
 another.

 Specifically, it's using arc and arcTo with optional arguments, and
 ellipse separately, because arc couldn't be extended sanely the way arcTo
 could be.

Yes.  What's your point?  That is inconsistent.

 We would prefer to align the syntaxes of canvas path and SVG path as
 much as possible, to help authors translate knowledge between the two.

 I think it would be far more useful for SVG to be consistent with itself,
 have no similarity with canvas, and present a sane language, than to have
 SVG inconsistent with both itself and canvas, and present a fractured
 language that is hard to learn.

Please stay on topic here.  SVG won't be inconsistent with both
itself and canvas.  It will introduce long-form names for *all* of
its commands (the single-letter commands were already showing their
limits - I mean really, T?).

 As such, we're requesting that the canvas path API change to be
 consistent with itself, in the direction that we prefer.

 I believe the canvas API is adequately consistent with itself given the
 constraints facing this API's evolution, and so have not changed it.

That's unfortunate.  SVG is unable to match canvas, then, and must
unnecessarily confuse authors by having *three* of its new arcing
commands match canvas, but not the fourth.

~TJ


Re: [whatwg] New URL Standard

2012-09-24 Thread David Sheets
On Mon, Sep 24, 2012 at 4:07 PM, Glenn Maynard gl...@zewt.org wrote:
 On Mon, Sep 24, 2012 at 12:30 PM, Tab Atkins Jr. jackalm...@gmail.comwrote:

 I suggest just making it a map from String-[String].  You probably
 want a little bit of magic - if the setter receives an array, replace
 the current value with it; anything else, stringify then wrap in an
 array and replace the current value.  The getter should return an
 empty array for non-existing params.  You should be able to set .query
 itself with an object, which empties out the map and then runs the
 setter over all the items.  Bam, every single methods is now obsolete.


 When should this API guarantee that it round-trips URLs cleanly (aside from
 quoting differences)?  For example, maintaining order in a=1b=2a=1, and
 representing things like a=1b (no '=') and ab (no key at all).

Always. The appropriate interface is (string * string?) list. Id est,
an association list of keys and nullable values (null is
key-without-value and empty string is empty-value). If you prefer to
not use a nullable value and don't like tuple representations in JS,
you could use type: string list list

i.e.

[[key_without_value],[],[key,value],[],[numbers,1,2,3,4],[,],[,,]]

becomes

?key_without_valuekey=valuenumbers=1,2,3,4==,

where I've assumed that values after the second are concatenated with
commas (but it could be semicolons or some other separator).

Unfortunately, JavaScript does not have any lightweight product types
so a decision like this is necessary.

 Not round-tripping URLs might have annoying side-effects, like trying to
 use history.replaceState to replace the path portion of the URL, and
 unexpectedly having the query part of the URL get shuffled around or
 changed in other ways.

That would be unacceptably broken.

 Maybe it could guarantee that the query round-trips only if the value is
 never modified (only assigned via the ctor or assigning to href), but once
 you modify the query, the order becomes normalized and any other
 non-round-trip side effects happen.

Why can't as much information as possible be preserved? There exist
many URI manipulation libraries that support maximal preservation.

 By the way, it would also be nice for the query part of this API to be
 usable in isolation.  I often put query-like strings in the hash, resulting
 in URLs like 
 http://example.com/server/side/path?server-side-query=1#client/side/path?client-side-query=1;,
 and it would be nice to be able to work with both of these with the same
 interface.  That is, query = new URLQuery(a=bc=d); query[a] = x;
 query.toString() == a=xc=d;

Is this not already supported by creating a new URL which contains
only a relative query part?

Like: query = new URL(?a=bc=d); query.query[a] = x;
query.toString() == ?a=xc=d;

Why is a new interface necessary?

 --
 Glenn Maynard


Re: [whatwg] New URL Standard

2012-09-24 Thread Ian Hickson
On Mon, 24 Sep 2012, David Sheets wrote:
 
 Is there an issue with defining WHATWG-URL syntax as a grammar extension 
 to the URI syntax in RFC3986?

In general, BNF isn't very useful for defining the parsing rules when you 
also need to handle non-conforming content in a correct manner. Really it 
is only useful for saying whether or not content is conforming.

-- 
Ian Hickson   U+1047E)\._.,--,'``.fL
http://ln.hixie.ch/   U+263A/,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'


Re: [whatwg] canvas and high-density displays

2012-09-24 Thread Glenn Maynard
On Mon, Sep 24, 2012 at 6:40 PM, Ian Hickson i...@hixie.ch wrote:

 We could add an event that fires on ImageData (or even ArrayBuffer) that
 fires when the data is available. If we add it to ArrayBuffer it's
 something that could be used in other contexts, too.

 Is this something that people think we should do? If so, should we add it
 to TypedArray generically?


If it's done this way, a nonblocking function may be needed to request that
the event be fired, without the blocking side-effects of actually
performing a pixel read.  Otherwise, implementations that don't perform the
readback at all until it knows it's really needed (eg. that it can't be
done with an in-GPU blit) would simply never fire the event at all.
Passing in a callback probably makes more sense this way than having it
request that an event be fired.

That would also allow waiting for readability without knowing in advance
whether the event was already fired or not, which would be important eg. if
you just received the ArrayBuffer in a message. (An attribute could do this
as well, but that might be more prone to developer error.)

-- 
Glenn Maynard


Re: [whatwg] Proposal for Links to Unrelated Browsing Contexts

2012-09-24 Thread Mihai Parparita
On Mon, Sep 24, 2012 at 12:11 PM, Ian Hickson i...@hixie.ch wrote:

 Why does GMail need to use window.open()? Surely the right way to expose a
 link is to use a href=. What is forcing them to use window.open()?


I can't speak for Gmail, but Google Reader uses window.open since it allows
unrelated links to be opened in response to a key event (the v keyboard
shortcut). It would also benefit from severing all ties to the opened
window.

Mihai


Re: [whatwg] Proposal for Links to Unrelated Browsing Contexts

2012-09-24 Thread Boris Zbarsky

On 9/24/12 8:42 PM, Mihai Parparita wrote:

On Mon, Sep 24, 2012 at 12:11 PM, Ian Hickson i...@hixie.ch wrote:


Why does GMail need to use window.open()? Surely the right way to expose a
link is to use a href=. What is forcing them to use window.open()?



I can't speak for Gmail, but Google Reader uses window.open since it allows
unrelated links to be opened in response to a key event (the v keyboard
shortcut).


In most UAs this is also possible to do with a click() on the HTML a, 
no?  In the ones in which it's _not_ possible that way, they should add 
it, perhaps?


-Boris


Re: [whatwg] New URL Standard

2012-09-24 Thread David Sheets
On Mon, Sep 24, 2012 at 5:23 PM, Ian Hickson i...@hixie.ch wrote:
 On Mon, 24 Sep 2012, David Sheets wrote:

 Is there an issue with defining WHATWG-URL syntax as a grammar extension
 to the URI syntax in RFC3986?

 In general, BNF isn't very useful for defining the parsing rules when you
 also need to handle non-conforming content in a correct manner. Really it
 is only useful for saying whether or not content is conforming.

Your conforming WHATWG-URL syntax will have production rule alphabets
which are supersets of the alphabets in RFC3986. This is what I
propose you define and it does not necessarily have to be in BNF
(though a production rule language of some sort probably isn't a bad
idea).

If you read my mail carefully, you will notice that I address the
non-conforming identifier case in the initial canonicalization
algorithm. This normalization step is separate from the syntax of
conforming WHATWG-URLs and would define how non-conforming strings are
interpreted as conforming strings. The parsing algorithm then provides
a map from these strings into a data structure.

Error recovery and extended syntax for conforming representations are
orthogonal.

How will WHATWG-URLs which use the syntax extended from RFC3986 map
into RFC3986 URI references for systems that only support those?


Re: [whatwg] DOM Keyboard Event Level 3 questions about proposal

2012-09-24 Thread Ojan Vafai
The right mailing list for these questions is www-...@w3.org.


On Sat, Sep 22, 2012 at 2:57 PM, Егор Николаев termi1...@gmail.com wrote:

 Hello.

 Right now I'm looking for a way to implement 'DOM keyboard  event level 3'
 into my current project and also I'm developing polyfill for this API (
 https://github.com/termi/DOM-Keyboard-Event-Level-3-polyfill). As a
 reference I've used this standard (
 http://www.w3.org/TR/2012/WD-DOM-Level-3-Events-20120614/) along with
 Opera
 12.10 and IE9+ implementations.

 I've a few questions:

 1) How can I determine key combination triggering if user's locale is other
 than US_en? Both 'char' and 'key' properties return the symbol, that's
 specific to current user's locale. For example how can we detect 'Ctrl+S'
 combination? With this code:

 if(event.key.toLowerCase() == 's' || event.key.toLowerCase() == 'ы' || ...
 [and so on for every locale that is supported by your web application.]


 2) There's no clear statement about 'char' and 'key' values for special
 symbol key press events. Opera 12.10 x64 Win7x64  (12.10.1592 at least),
 for example, returns some gibberish in key and char property while Ctrl key
 pressed. You can see it for yourself by going to
 http://h123.ru/-/tests/KeyboardEvent/ with Opera 12.10 beta RC and
 pressing
 Ctrl+Q (or Ctrl+any character).


 3) Why the 'key' property is case-sensitive if we already have 'char'
 property for input symbol detection.



 To summarize I'd like to say that the new API doesn't solve any of the
 problems but creating new ones. Especially after cross-locales 'keyCode'
 property has been declared outdated.



 As a solution I'd like to suggest 'char' and 'key' logical division. 'Char'
 property should return input symbol (just like it does right now) and 'key'
 property should always, for any special symbol key pressed, return
 lowercased US_en locale symbol for any symbol value. For example it can be:
 event :{
   key : q
   , char Й
   , shiftKey : true
   , locale : RU_ru
   , ...
 }



Re: [whatwg] New URL Standard

2012-09-24 Thread Ian Hickson

This is Anne's spec, so I'll let him give more canonical answers, but:

On Mon, 24 Sep 2012, David Sheets wrote:
 
 Your conforming WHATWG-URL syntax will have production rule alphabets 
 which are supersets of the alphabets in RFC3986.

Not necessarily, but that's certainly possible. Personally I would 
recommend that we not change the definition of what is conforming from the 
current RFC3986/RFC3987 rules, except to the extent that the character 
encoding affects it (as per the HTML standard today).

   http://whatwg.org/html#valid-url


 This is what I propose you define and it does not necessarily have to be 
 in BNF (though a production rule language of some sort probably isn't a 
 bad idea).

We should definitely define what is a conforming URL, yes (either 
directly, or by reference to the RFCs, as HTML does now). Whether prose or 
a structured language is the better way to go depends on what the 
conformance rules are -- HTML is a good example here: it has parts that 
are defined in terms of prose (e.g. the HTML syntax as a whole), and other 
parts that are defined in terms of BNF (e.g. constraints on the conetnts 
of script elements in certain situations). It's up to Anne.


 Error recovery and extended syntax for conforming representations are 
 orthogonal.

Indeed.


 How will WHATWG-URLs which use the syntax extended from RFC3986 map into 
 RFC3986 URI references for systems that only support those?

The same way that those systems handle invalid URLs today, I would assume. 
Do you have any concrete systems in mind here? It would be good to add 
them to the list of systems that we test. (For what it's worth, in 
practice, I've never found software that exactly followed RFC3986 and 
also rejected any non-conforming strings. There are just too many invalid 
URLs out there for that to be a viable implementation strategy.)

I remember when I was testing this years ago, when doing the first pass on 
attempting to fix this, that I found that some less widely tested 
software, e.g. wget(1), did not handle URLs in the same manner as more 
widely tested software, e.g. IE, with the result being that Web pages were 
not handled interoperably between these two software classes. This is the 
kind of thing we want to stop, by providing a single way to parse all 
input strings, valid or invalid, as URLs.

-- 
Ian Hickson   U+1047E)\._.,--,'``.fL
http://ln.hixie.ch/   U+263A/,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'


[whatwg] Spec for location object needs to make some properties unforgeable; need supporting WebIDL changes

2012-09-24 Thread Boris Zbarsky
Turns out, some things care about at least the .href and .toString of 
Location objects for security-check purposes.  So they need to be 
unforgeable.  But of course WebIDL doesn't provide a way to make 
anything other than readonly attributes unforgeable.  It seems like it 
needs to.


In terms of current UA behavior for Location, it is full of weird.  The 
only interoparable part seems to be that href and toString can't be 
effectively redefined.


In IE and Gecko, neither can any of the other IDL properties of Location 
objects.  So we have indications that making everything on this 
interface unforgeable is sufficiently web-compatible.


Specifically, on the attached testcase, I see the following behavior:

Opera:
  * toString is not an own prop, is a configurable prop on the proto,
but defineProperty on the object for it fails with an exception due
to it not being configurable(!)
  * href is a non-configurable own prop
  * assign/replace/reload are normal props on the proto
  * The rest are normal accessor props on the object itself.

Chrome:

  * toString is a non-configurable readonly own prop
  * href is a non-configurable own prop for which defineProperty
silently does nothing.
  * assign/replace/reload are just like toString
  * The rest are normal data props on the object, except
defineProperty does not change the value, which it should
for normal props.

Safari:

  * toString is a non-configurable readonly own prop and also a
non-configurable writable prop on the proto.  Except
location.hasOwnProperty(toString) returns false.
  * href is a non-configurable readonly own prop
  * assign/replace/reload are just like toString except writable, so
defineProperty can change the value.
  * The rest are all readonly non-configurable props on the object
itself.

Gecko:

  * It's all weird, because location is actually a bizarro proxy object
(e.g. it has no __proto__ property, returns weird stuff that can't
be stringified from Object.getPrototypeOf()).
  * The key part is that trying to redefine _any_ of the properties
that live on Location.prototype on the location object itself is
disallowed in Gecko.

IE9:

  * All properties throw when getting property descriptors on location
object.
  * Some properties are configurable on the proto and some are not.
  * All properties throw when trying to redefine.  Including non-IDL
properties.  Setting expandos works fine, though.
  * All properties claim to not be own properties.

-Boris