Re: [whatwg] add html-attribute for "responsive images"

2011-08-31 Thread Charles Pritchard

On 8/31/2011 2:32 PM, Karl Dubost wrote:

Anselm,
(setting reply-to on www-style)

Seen this today, to remind people that it is not just
something up in the air. People need it.
http://www.webmonkey.com/2011/08/speed-up-your-responsive-designs-with-adaptive-images/

I wonder if it could be handled by CSS in fact.
I guess Anselm, you could ask there.
On the www-style mailing-list, Charles proposed [1]

content: url(img.jpg) replaced;



Oh, that's not my proposal, that syntax was brought up by Tab Atkins.

It's already available. I was looking into how to handle source] style="background: url(..)" />

It may work with the following, now, or at some point in the future:


I'd proposed visibility: content-hidden; to be used with background and 
border.



I'm not sure I fully understand the proposal
but we can imagine something that could fit nicely
with the CSS Generated Content Module Level 3 [2]

http://example.org/foo"; alt="wiizz"/>

and then the CSS


@media  screen and (min-width:550px) and (max-width:960px) {
img.responsive {
url(http://example.org/foobis) replaced;}
}
@media  screen and (min-width:240px) and (max-width:549px) {
img.responsive {
url(http://example.org/footer) replaced;}
}


[1]: http://www.w3.org/mid/4e5d4a46.7000...@jumis.com
[2]: http://dev.w3.org/csswg/css3-content/#replacedContent


Keep in mind that min-device-pixel-ratio is also useful to monitor.
Set image dimensions in the css style to prevent reflowing.







Re: [whatwg] add html-attribute for "responsive images"

2011-08-31 Thread Bjartur Thorlacius
Bottom (top?) line: User agents should negotiate an appropriate 
message-body size using HTTP. Sending an accept-size (or some such) 
could solve both the problem of high resolution photography and lengthy 
documents. The amount of split articles ("Click here to go to the next 
page / page 4") and long search results show clear demand.


Þann mið 31.ágú 2011 21:32, skrifaði Karl Dubost:

Anselm,
(setting reply-to on www-style)

Seen this today, to remind people that it is not just
something up in the air. People need it.
http://www.webmonkey.com/2011/08/speed-up-your-responsive-designs-with-adaptive-images/

I wonder if it could be handled by CSS in fact.
Different technologies seem appropriate depending on the relation 
between the document and the images.

Use Case A
Multiple representations of a resource may exist, where all can be 
deduced from the original (e.g. by downsampling). Doing the deducing on 
the server is an optimization to save bandwidth.

Proposed Solutions
1) Nest objects
2) Negotiate content serverside as per HTTP
3) Negotiate content clientside as per HTTP

Use Case B
An article might link to (directly or, theoretically, via a 
text/uri-list) to a number of non-critical "asides" (i.e. images to rest 
your eyes on, background music, etc), that may be omitted, but are in no 
way the same resource.

Proposed Solutions
1) Use s or s with an appropriate relation specified
2) Use your favorite linking element (be it a, area, object, img, audio, 
video, link, a future media element not yet specified, or an old one not 
yet deprecated) in an aside.

3) Add the rel attribute to object, and use instead of  in 1. See A.1
Expected Rendering
User agents are to render zero or more of the tolinked resources, 
omitting none, some or all of the resources completely from the output 
viewport, or rendered only on demand.




I guess Anselm, you could ask there.
On the www-style mailing-list, Charles proposed [1]

content: url(img.jpg) replaced;

I'm not sure I fully understand the proposal
but we can imagine something that could fit nicely
with the CSS Generated Content Module Level 3 [2]

http://example.org/foo"; alt="wiizz"/>

and then the CSS


@media  screen and (min-width:550px) and (max-width:960px) {
img.responsive {
url(http://example.org/foobis) replaced;}
}
@media  screen and (min-width:240px) and (max-width:549px) {
img.responsive {
url(http://example.org/footer) replaced;}
}
And allocate every image a class, and every sample a rule in a style 
sheet? Maybe, if the images are decorative, but I think you can come up 
with a more clever solution using media fragments (either standardized, 
or implemented per site by binding media queries to URI templates).


Re: [whatwg] Node inDocument

2011-08-31 Thread Erik Arvidsson
After thinking more about this we believe that moving contains to Node
is a better alternative. The problem with Node inDocument is that it
does not say which document it is in so code would need to also check
ownerDocument to be robust in the presence of frames and multiple
windows.

erik

On Tue, Aug 30, 2011 at 03:02, Anne van Kesteren  wrote:
> On Tue, 30 Aug 2011 11:58:21 +0200, Robin Berjon  wrote:
>>
>> But node.ownerDocument.contains(node) isn't. There's no doubt that
>> node.inDocument is less error-prone though.
>
> Depends on the use case. The thread started with "the document" in which
> case you want document.contains().
>
>
> --
> Anne van Kesteren
> http://annevankesteren.nl/
>


Re: [whatwg] add html-attribute for "responsive images"

2011-08-31 Thread Karl Dubost
Anselm,
(setting reply-to on www-style)

Seen this today, to remind people that it is not just 
something up in the air. People need it.
http://www.webmonkey.com/2011/08/speed-up-your-responsive-designs-with-adaptive-images/

I wonder if it could be handled by CSS in fact. 
I guess Anselm, you could ask there.
On the www-style mailing-list, Charles proposed [1]

content: url(img.jpg) replaced;

I'm not sure I fully understand the proposal 
but we can imagine something that could fit nicely 
with the CSS Generated Content Module Level 3 [2]

http://example.org/foo"; alt="wiizz"/>

and then the CSS


@media  screen and (min-width:550px) and (max-width:960px) {
   img.responsive {
url(http://example.org/foobis) replaced;}
   }
@media  screen and (min-width:240px) and (max-width:549px) {
   img.responsive {
url(http://example.org/footer) replaced;}
   }


[1]: http://www.w3.org/mid/4e5d4a46.7000...@jumis.com
[2]: http://dev.w3.org/csswg/css3-content/#replacedContent


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



Re: [whatwg] windowToCanvas()

2011-08-31 Thread Tab Atkins Jr.
On Wed, Aug 31, 2011 at 10:52 AM, David Geary
 wrote:
> In a previous email titled ‘Should Paths be First Class Citizens’, I briefly
> discussed this code snippet:
>
> context.canvas.onmousedown = function (e) {
>   var loc = windowToCanvas(context.canvas, e);
>
>   polygons.forEach( function (polygon) {  // polygons is an array of
> polygon objects
>      polygon.createPath();  // my polygons have a createPath() method
>
>      if (context.isPointInPath(loc.x, loc.y)) {
>         alert('mouse clicked in polygon');
>      }
>   });
> }
>
> I implemented the windowToCanvas() myself. That methods’s not too difficult
> to implement after you know how to do it properly, but it’s not very
> straightforward to implement if you are new to web development.
>
> Would it make sense to add such a method to the Canvas specification?

I assume this just translates window-relative coordinates to
element-relative coordinates.  Yes, that sort of thing is useful, but
it's nothing to do with canvas specifically - it would be useful for
every element if it were easier to do that sort of thing.

~TJ


[whatwg] enumerated attributes: needs 1:1 mapping from conforming values to states

2011-08-31 Thread David Flanagan

The HTML spec says:
If a reflecting IDL attribute is a |DOMString| attribute whose content 
attribute is an enumerated attribute 
, 
and the IDL attribute is limited to only known values, then, on 
getting, the IDL attribute must return the conforming value associated 
with the state the attribute is in (in its canonical case),

And also says:
The keywords are each defined to map to a particular /state/ (several 
keywords might map to the same state, in which case some of the 
keywords are synonyms of each other; additionally, some of the 
keywords can be said to be non-conforming, and are only in the 
specification for historical reasons).
I assume that if there are multiple keywords that map to the same state, 
only one of those keywords will be conforming.  But I think that needs 
to be clarified in the last-quoted text above.


   David


[whatwg] Fwd: windowToCanvas()

2011-08-31 Thread David Geary
Forgive me if this shows up twice on the list. I’m new at this, and I
believe I sent the original to the wrong address.

-- Forwarded message --
From: David Geary 
Date: Wed, Aug 31, 2011 at 11:52 AM
Subject: windowToCanvas()
To: wha...@whatwg.org

In a previous email titled ‘Should Paths be First Class Citizens’, I briefly
discussed this code snippet:

context.canvas.onmousedown = function (e) {
   var loc = windowToCanvas(context.canvas, e);

   polygons.forEach( function (polygon) {  // polygons is an array of
polygon objects
  polygon.createPath();  // my polygons have a createPath() method

  if (context.isPointInPath(loc.x, loc.y)) {
 alert('mouse clicked in polygon');
  }
   });
}

I implemented the windowToCanvas() myself. That methods’s not too difficult
to implement after you know how to do it properly, but it’s not very
straightforward to implement if you are new to web development.

Would it make sense to add such a method to the Canvas specification?


David
Author of Core HTML5 Canvas (corehtml5canvas.com)


[whatwg] Fwd: Should Paths be First Class Citizens?

2011-08-31 Thread David Geary
Forgive me if this shows up twice on the list. I’m new at this, and I
believe I sent the original to the wrong address.

-- Forwarded message --
From: David Geary 
Date: Wed, Aug 31, 2011 at 11:48 AM
Subject: Should Paths be First Class Citizens?
To: wha...@whatwg.org


I’ve implemented some polygon objects for my book that I can drag around in
a canvas. I detect mouse clicks in the polygons with the isPointInPath()
method. Here’s a simple code snippet that detects mouse clicks in a set of
polygons (dnd code is too lengthy for this purpose):

context.canvas.onmousedown = function (e) {
   var loc = windowToCanvas(context.canvas, e);

   polygons.forEach( function (polygon) {  // polygons is an array of
polygon objects
  polygon.createPath();  // my polygons have a createPath() method

  if (context.isPointInPath(loc.x, loc.y)) {
 alert('mouse clicked in polygon');
  }
   });
}

Notice that I have to recreate each path for every polygon.
Polygon.createPath() is implemented with beginPath()...moveTo()...repeated
calls to lineTo()...and finally...closePath().

It seems to me that it would be great if the Canvas context provided two new
methods: Path getPath(), which would return a path object representing the
context’s current path, and setPath(Path), which would set the current path.

Those two methods seem like they’d be easy for UAs to implement. It also
seems like they would, under certain circumstances, give a significant boost
to performance. If I have thousands of polygons, for example, I must be
paying some price for all that path building.


David
Author of Core HTML5 Canvas (corehtml5canvas.com)


[whatwg] windowToCanvas()

2011-08-31 Thread David Geary
In a previous email titled ‘Should Paths be First Class Citizens’, I briefly
discussed this code snippet:

context.canvas.onmousedown = function (e) {
   var loc = windowToCanvas(context.canvas, e);

   polygons.forEach( function (polygon) {  // polygons is an array of
polygon objects
  polygon.createPath();  // my polygons have a createPath() method

  if (context.isPointInPath(loc.x, loc.y)) {
 alert('mouse clicked in polygon');
  }
   });
}

I implemented the windowToCanvas() myself. That methods’s not too difficult
to implement after you know how to do it properly, but it’s not very
straightforward to implement if you are new to web development.

Would it make sense to add such a method to the Canvas specification?


David
Author of Core HTML5 Canvas (corehtml5canvas.com)


[whatwg] Should Paths be First Class Citizens?

2011-08-31 Thread David Geary
I’ve implemented some polygon objects for my book that I can drag around in
a canvas. I detect mouse clicks in the polygons with the isPointInPath()
method. Here’s a simple code snippet that detects mouse clicks in a set of
polygons (dnd code is too lengthy for this purpose):

context.canvas.onmousedown = function (e) {
   var loc = windowToCanvas(context.canvas, e);

   polygons.forEach( function (polygon) {  // polygons is an array of
polygon objects
  polygon.createPath();  // my polygons have a createPath() method

  if (context.isPointInPath(loc.x, loc.y)) {
 alert('mouse clicked in polygon');
  }
   });
}

Notice that I have to recreate each path for every polygon.
Polygon.createPath() is implemented with beginPath()...moveTo()...repeated
calls to lineTo()...and finally...closePath().

It seems to me that it would be great if the Canvas context provided two new
methods: Path getPath(), which would return a path object representing the
context’s current path, and setPath(Path), which would set the current path.

Those two methods seem like they’d be easy for UAs to implement. It also
seems like they would, under certain circumstances, give a significant boost
to performance. If I have thousands of polygons, for example, I must be
paying some price for all that path building.


David
Author of Core HTML5 Canvas (corehtml5canvas.com)


Re: [whatwg] Fixing undo on the Web - UndoManager and Transaction

2011-08-31 Thread Jonas Sicking
On Tue, Aug 30, 2011 at 10:49 PM, Anne van Kesteren  wrote:
> On Tue, 30 Aug 2011 21:04:09 +0200, Ryosuke Niwa  wrote:
>>
>> I've updated my document: https://rniwa.com/editing/undomanager.html
>>
>> I clarified which object it should return and also moved undoManager idl
>> attribute from Element/Document to Node as we have agreed.
>
> I missed this agreement. In DOM Core we try to avoid putting things on Node
> when it only needs to be available on a few node types. Does it make sense
> for this to be exposed on Comment, ProcessingInstruction, Text,
> DocumentType, etc. now?
>
> If it does indeed make sense the non-normative text also needs to be updated
> as it still talks about element and document.

Makes sense to me. Having .undoManager on Element and Document seems fine.

/ Jonas