Re: [whatwg] Node inDocument
On 08/30/2011 10:44 AM, Anne van Kesteren wrote: On Tue, 30 Aug 2011 10:38:19 +0200, Jonas Sicking jo...@sicking.cc wrote: In general I think it's better to have functions that deal with child lists on Node rather than on Element/Document/DocumentFragment. I think it might still make sense to have inDocument though. That'll allow people to more clearly express what they are actually trying to do, while allowing implementations to write faster code. If we are going to have Node.contains implementations surely could optimize document.contains(node) which seems as clear as node.inDocument to me. They are different in the case of multiple documents though. Which solution makes sense given the use cases? What are the use cases?
Re: [whatwg] Node inDocument
On Aug 30, 2011, at 11:40 , James Graham wrote: On 08/30/2011 10:44 AM, Anne van Kesteren wrote: On Tue, 30 Aug 2011 10:38:19 +0200, Jonas Sicking jo...@sicking.cc wrote: In general I think it's better to have functions that deal with child lists on Node rather than on Element/Document/DocumentFragment. I think it might still make sense to have inDocument though. That'll allow people to more clearly express what they are actually trying to do, while allowing implementations to write faster code. If we are going to have Node.contains implementations surely could optimize document.contains(node) which seems as clear as node.inDocument to me. They are different in the case of multiple documents though. But node.ownerDocument.contains(node) isn't. There's no doubt that node.inDocument is less error-prone though. -- Robin Berjon - http://berjon.com/ - @robinberjon
Re: [whatwg] Node inDocument
On Tue, 30 Aug 2011 11:58:21 +0200, Robin Berjon ro...@berjon.com 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] Terminology: managed vs. manual transactions
On 29/08/2011, at 7:18 PM, Aryeh Gregor wrote: In the UndoManager spec http://rniwa.com/editing/undomanager.html, there are two types of transactions: managed and manual. Managed transactions are handled by the browser, while manual ones are handled by the author. The term managed keeps confusing me, though. I never remember if it means managed by the browser, or by the author. Why don't you rename managed transactions to automatic transactions or something like that? it could be implicit\explicit transactions. for me, 'manual' is the non-ambiguous term. cam
Re: [whatwg] Terminology: managed vs. manual transactions
Le 30 août 2011 à 02:39, Anne van Kesteren a écrit : Or user agent transaction and author transaction. (XMLHttpRequest e.g. uses author request headers.) In version UndoManager and DOM Transaction Proposal Working Draft — 9 August 2011 Suggestion: A managed transaction is a transaction where DOM changes is tracked by the user agent and the logic to unapply or reapply the transaction is implicitly created by the user agent. - user agent transaction A manual transaction is a transaction where the logic to apply, unapply, or reapply the transaction is explicitly defined by an application. /by an application/by a(n author) script/ - (author) script transaction ps: I would not put author personally. -- Karl Dubost - http://dev.opera.com/ Developer Relations Tools, Opera Software
Re: [whatwg] add html-attribute for responsive images
Anne, Le 30 août 2011 à 10:21, Anne van Kesteren a écrit : It's too much complexity for a niche problem. It is not a niche problem. * It is in fact an issue for being able to make the website responsive on Mobile devices in low banwidth. * It has also the impact that you want to send different type of images for different types of screen resolutions a full fledged logo or a logo icon depending on the size of the screen. It is easy to do right now with background images, but not at all for images in img/ element. There was a thread about this recently in May 2011. http://lists.w3.org/Archives/Public/public-html/2011May/thread.html#msg386 If you want example of Web sites doing responsive design http://mediaqueri.es/ -- Karl Dubost - http://dev.opera.com/ Developer Relations Tools, Opera Software
Re: [whatwg] add html-attribute for responsive images
On Tue, 30 Aug 2011 16:31:59 +0200, Karl Dubost ka...@opera.com wrote: * It is in fact an issue for being able to make the website responsive on Mobile devices in low banwidth. The mobile devices are the ones with the high-resolution displays. -- Anne van Kesteren http://annevankesteren.nl/
Re: [whatwg] add html-attribute for responsive images
On 2011-08-30 16:51, Anne van Kesteren wrote: On Tue, 30 Aug 2011 16:31:59 +0200, Karl Dubost ka...@opera.com wrote: * It is in fact an issue for being able to make the website responsive on Mobile devices in low banwidth. The mobile devices are the ones with the high-resolution displays. Speak for your own device :-)
Re: [whatwg] add html-attribute for responsive images
Le 30 août 2011 à 10:51, Anne van Kesteren a écrit : On Tue, 30 Aug 2011 16:31:59 +0200, Karl Dubost ka...@opera.com wrote: * It is in fact an issue for being able to make the website responsive on Mobile devices in low banwidth. The mobile devices are the ones with the high-resolution displays. And as I explained elsewhere it is not a question of high/low-resolution only, but about interaction contexts. Different images for different surface sizes. Desktop: Show a full photo of Anne van Kesteren riding on a plane 1024*250 px Tablet: Show the photo a closer shot of the plane (cowboy frame) 400*150 px Mobile: Show a portrait of Anne with his leather pilot helmet 100x100 px -- Karl Dubost - http://dev.opera.com/ Developer Relations Tools, Opera Software
Re: [whatwg] add html-attribute for responsive images
On Tue, 30 Aug 2011 17:18:38 +0200, Karl Dubost ka...@opera.com wrote: Le 30 août 2011 à 10:51, Anne van Kesteren a écrit : On Tue, 30 Aug 2011 16:31:59 +0200, Karl Dubost ka...@opera.com wrote: * It is in fact an issue for being able to make the website responsive on Mobile devices in low banwidth. The mobile devices are the ones with the high-resolution displays. And as I explained elsewhere it is not a question of high/low-resolution only, but about interaction contexts. Different images for different surface sizes. Desktop: Show a full photo of Anne van Kesteren riding on a plane 1024*250 px Tablet: Show the photo a closer shot of the plane (cowboy frame) 400*150 px Mobile: Show a portrait of Anne with his leather pilot helmet 100x100 px That seems like different content. We do not really have a good solution for client-side content adaptation. -- Anne van Kesteren http://annevankesteren.nl/
Re: [whatwg] Add naturalOrientation property to img
On Fri, Aug 26, 2011 at 9:04 PM, Karl Dubost ka...@opera.com wrote: Le 26 août 2011 à 16:49, Tab Atkins Jr. a écrit : If Flickr uses this CSS property, and does so in different ways in the two places, that's just a Flickr bug. nope Flickr offers tools to process images. Flickr offers hosting of images. People using the hosting do not necessary use Flickr CSS and Flickr markup. Oh, I see the issue now. Sorry, I misread your previous email. In that case, the objection still doesn't seem to apply. If you are using Flickr's photo-editting tools (which presumably use canvas, or at least Flash), and those tools use .naturalOrientation to automatically rotate the image for you, then the saved image will be a *new image* produced by one of the canvas or Flash export methods. This new image will either have no orientation or the default orientation, not whatever the original image's orientation was. If you *aren't* using Flickr's editting tools, just uploading the image directly and then hotlinking it, .naturalOrientation never plays a part. Flickr *may* use a CSS property like the proposed 'image-orientation' to auto-rotate the image when it's displayed, which would run into the trouble you mention (image appears correct on Flickr, but rotated on your website where Flickr's CSS isn't applying), but that's irrelevant for the .naturalOrientation proposal. ~TJ
Re: [whatwg] add html-attribute for responsive images
On 30.8.2011 17:23, Anne van Kesteren wrote: On Tue, 30 Aug 2011 17:18:38 +0200, Karl Dubost ka...@opera.com wrote: Le 30 août 2011 à 10:51, Anne van Kesteren a écrit : On Tue, 30 Aug 2011 16:31:59 +0200, Karl Dubost ka...@opera.com wrote: * It is in fact an issue for being able to make the website responsive on Mobile devices in low banwidth. The mobile devices are the ones with the high-resolution displays. And as I explained elsewhere it is not a question of high/low-resolution only, but about interaction contexts. Different images for different surface sizes. Desktop: Show a full photo of Anne van Kesteren riding on a plane 1024*250 px Tablet: Show the photo a closer shot of the plane (cowboy frame) 400*150 px Mobile: Show a portrait of Anne with his leather pilot helmet 100x100 px That seems like different content. We do not really have a good solution for client-side content adaptation. But we do using CSS height, width and background-image based on media query for some div container... this could solve this problem from visual point of view... but passing semantic (not decorative) image management to CSS is not correct solution... Brona
Re: [whatwg] Terminology: managed vs. manual transactions
On Tue, Aug 30, 2011 at 12:12 PM, Ryosuke Niwa rn...@webkit.org wrote: Mn... I've never had that problem. e.g. .net framework uses the term managed code to mean the code that's garbage-collected by the framework and unmanaged code to mean the code that manually manage memory among other things. That's true, but many web authors aren't going to be familiar with .NET, or any non-garbage-collected language. Managed definitely sounds ambiguous to me, and I've been exposed to more non-garbage-collected code than most web authors. Mn... Jonas requested that I add separate method on undoManager for manual and managed transactions so I'd rather not name one of them userAgentTransact since the term user agent doesn't seem to be popular outside of standard bodies. I agree that user agent is a very standards-y term. Maybe browser-managed transaction and script-managed transaction?
Re: [whatwg] Fixing undo on the Web - UndoManager and Transaction
On 11-08-25 7:06 PM, Ian Hickson wrote: - We need to figure out how UndoManager objects affect the bfcache and the document salvageable flag. Please ping me on IRC about this. Would you mind sharing the results of that conversation, please (in case it has happened yet). Thanks! Ehsan
Re: [whatwg] Terminology: managed vs. manual transactions
On 11-08-30 12:23 PM, Aryeh Gregor wrote: On Tue, Aug 30, 2011 at 12:12 PM, Ryosuke Niwarn...@webkit.org wrote: Mn... I've never had that problem. e.g. .net framework uses the term managed code to mean the code that's garbage-collected by the framework and unmanaged code to mean the code that manually manage memory among other things. That's true, but many web authors aren't going to be familiar with .NET, or any non-garbage-collected language. Managed definitely sounds ambiguous to me, and I've been exposed to more non-garbage-collected code than most web authors. I agree with Aryeh. Also, note that the term managed code means more than just the memory being garbage collected. Mn... Jonas requested that I add separate method on undoManager for manual and managed transactions so I'd rather not name one of them userAgentTransact since the term user agent doesn't seem to be popular outside of standard bodies. I agree that user agent is a very standards-y term. Maybe browser-managed transaction and script-managed transaction? Isn't the main difference between the two transactions the fact that the browser knows how to undo/redo managed transactions, whereas the author explicitly specifies how to undo/redo manual transactions? In this case, why wouldn't we go with a terminology like automatic/manual? Cheers, Ehsan
Re: [whatwg] Fixing undo on the Web - UndoManager and Transaction
On Tue, Aug 30, 2011 at 11:52 AM, Ryosuke Niwa rn...@webkit.org wrote: - must return the object implementing the UndoManager interface should probably clarify _which_ object. There's presumably more than one object in the world implementing this interface. :-) Oh, yes. I'll clarify in the next version. 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. - Ryosuke
Re: [whatwg] Fixing undo on the Web - UndoManager and Transaction
On Tue, Aug 30, 2011 at 12:21 PM, Ehsan Akhgari eh...@mozilla.com wrote: On 11-08-30 3:15 PM, Ryosuke Niwa wrote: 1. Should Transaction have reapply property or not? It appears that some of us (e.g. me, Annie, Alex) want it for semantical clarity while others (e.g. Jonas and Ehsan) doesn't wait to avoid code duplication and to simply the API. I still think that if we can design an API which discourages code duplication, we probably should. (I feel like we're bikesheding here but) authors can do that by omitting reapply as in {'apply': ..., 'unapply': ...}. 2. Transaction seems to be too generic. Need more domain-specific name such as UndoTransaction. I don't have a lot of ideas on what a better name would be. I don't like any of the suggested ones. UndoTransaction makes it seem like the transaction can only be undone. EditingTransaction makes it seem like the transaction is somehow tied to editing commands... I had used the name DOMTransaction in earlier drafts of my document. 3. Managed transaction seems to be confusing as to whether it's managed by the UA or the author. 4. Jonas requested that we have manualTransact and managedTransact instead of single transact on undoManager for clarity. I think this is a good idea but I'd rather settle the naming issue first. I agree that this is a good idea. Alternatively, we can make separate the idea of managed/manual transaction and undoManager and add a function like createAutomaticTransaction() that takes a callback. It'll then create a Transaction object with apply, unapply reapply properties. Authors can then add it to UndoManager just like manual transactions. This will make the responsibility of undoManager and transactions clear; undoManager is solely responsible for managing undo transaction history and won't be concerned with DOM changes at all. With this interface, there is exactly one type of Transaction. And the difference between manual transaction and managed transaction is just that whether it's created manually by the author or via some special function (e.g. createAutomaticTransaction). - Ryosuke
[whatwg] Requesting TextMetrics baseline property
I'd like to see a new property added to the TextMetrics object from Canvas 2d. var t = ctx.measureText('text span'); t == { width: int, baseline: int }; The baseline corresponds to the vertical offset of the anchor point. A tiny number. It's not the same as height, but it has a similar use. It allows allows the author to manage style markers on spans of text presenting different baselines. The following textBaseline image can not be generated in canvas: https://developer.mozilla.org/en/drawing_text_using_a_canvas http://www.whatwg.org/specs/web-apps/current-work/images/baselines.png It can, but we have to do css hacks/edge detection, as measureText is insufficient. By exposing the baseline offset in the TextMetrics method, we would be able to generate the lines in that image, and appropriately position the text captions. It seems appropriate that the illustration for textBaseline be something that can be easily generated from within canvas. The same standard is held for SVG documentation. -Charles
Re: [whatwg] Requesting TextMetrics baseline property
On Tue, Aug 30, 2011 at 3:19 PM, Charles Pritchard ch...@jumis.com wrote: I'd like to see a new property added to the TextMetrics object from Canvas 2d. var t = ctx.measureText('text span'); t == { width: int, baseline: int }; The baseline corresponds to the vertical offset of the anchor point. A tiny number. It's not the same as height, but it has a similar use. It allows allows the author to manage style markers on spans of text presenting different baselines. The following textBaseline image can not be generated in canvas: https://developer.mozilla.org/en/drawing_text_using_a_canvas http://www.whatwg.org/specs/web-apps/current-work/images/baselines.png It can, but we have to do css hacks/edge detection, as measureText is insufficient. By exposing the baseline offset in the TextMetrics method, we would be able to generate the lines in that image, and appropriately position the text captions. It seems appropriate that the illustration for textBaseline be something that can be easily generated from within canvas. The same standard is held for SVG documentation. Agreed, though there are multiple baselines that could be requested. The diagram you link to points out three of them. The alphabetic baseline is what you want most of the time, but all of them can be useful depending on the type of text you're formatting. ~TJ
Re: [whatwg] Requesting TextMetrics baseline property
On Aug 30, 2011, at 3:26 PM, Tab Atkins Jr. jackalm...@gmail.com wrote: On Tue, Aug 30, 2011 at 3:19 PM, Charles Pritchard ch...@jumis.com wrote: I'd like to see a new property added to the TextMetrics object from Canvas 2d. var t = ctx.measureText('text span'); t == { width: int, baseline: int }; The baseline corresponds to the vertical offset of the anchor point. A tiny number. It's not the same as height, but it has a similar use. It allows allows the author to manage style markers on spans of text presenting different baselines. The following textBaseline image can not be generated in canvas: https://developer.mozilla.org/en/drawing_text_using_a_canvas http://www.whatwg.org/specs/web-apps/current-work/images/baselines.png It can, but we have to do css hacks/edge detection, as measureText is insufficient. By exposing the baseline offset in the TextMetrics method, we would be able to generate the lines in that image, and appropriately position the text captions. It seems appropriate that the illustration for textBaseline be something that can be easily generated from within canvas. The same standard is held for SVG documentation. Agreed, though there are multiple baselines that could be requested. The diagram you link to points out three of them. The alphabetic baseline is what you want most of the time, but all of them can be useful depending on the type of text you're formatting. The author would have to set ctx.textBaseline, and re-run TextMetrics for each baseline they are incorporating. The enumeration of supported baselines is already in the canvas spec.
Re: [whatwg] Requesting TextMetrics baseline property
On Tue, Aug 30, 2011 at 3:56 PM, Charles Pritchard ch...@jumis.com wrote: On Aug 30, 2011, at 3:26 PM, Tab Atkins Jr. jackalm...@gmail.com wrote: On Tue, Aug 30, 2011 at 3:19 PM, Charles Pritchard ch...@jumis.com wrote: I'd like to see a new property added to the TextMetrics object from Canvas 2d. var t = ctx.measureText('text span'); t == { width: int, baseline: int }; The baseline corresponds to the vertical offset of the anchor point. A tiny number. It's not the same as height, but it has a similar use. It allows allows the author to manage style markers on spans of text presenting different baselines. The following textBaseline image can not be generated in canvas: https://developer.mozilla.org/en/drawing_text_using_a_canvas http://www.whatwg.org/specs/web-apps/current-work/images/baselines.png It can, but we have to do css hacks/edge detection, as measureText is insufficient. By exposing the baseline offset in the TextMetrics method, we would be able to generate the lines in that image, and appropriately position the text captions. It seems appropriate that the illustration for textBaseline be something that can be easily generated from within canvas. The same standard is held for SVG documentation. Agreed, though there are multiple baselines that could be requested. The diagram you link to points out three of them. The alphabetic baseline is what you want most of the time, but all of them can be useful depending on the type of text you're formatting. The author would have to set ctx.textBaseline, and re-run TextMetrics for each baseline they are incorporating. The enumeration of supported baselines is already in the canvas spec. Okay, that's reasonable. ~TJ
Re: [whatwg] Terminology: managed vs. manual transactions
On Tue, Aug 30, 2011 at 11:55 AM, Ehsan Akhgari eh...@mozilla.com wrote: On 11-08-30 12:23 PM, Aryeh Gregor wrote: On Tue, Aug 30, 2011 at 12:12 PM, Ryosuke Niwarn...@webkit.org wrote: Mn... I've never had that problem. e.g. .net framework uses the term managed code to mean the code that's garbage-collected by the framework and unmanaged code to mean the code that manually manage memory among other things. That's true, but many web authors aren't going to be familiar with .NET, or any non-garbage-collected language. Managed definitely sounds ambiguous to me, and I've been exposed to more non-garbage-collected code than most web authors. I agree with Aryeh. Also, note that the term managed code means more than just the memory being garbage collected. Mn... Jonas requested that I add separate method on undoManager for manual and managed transactions so I'd rather not name one of them userAgentTransact since the term user agent doesn't seem to be popular outside of standard bodies. I agree that user agent is a very standards-y term. Maybe browser-managed transaction and script-managed transaction? Isn't the main difference between the two transactions the fact that the browser knows how to undo/redo managed transactions, whereas the author explicitly specifies how to undo/redo manual transactions? In this case, why wouldn't we go with a terminology like automatic/manual? I like that! / Jonas
Re: [whatwg] Terminology: managed vs. manual transactions
On Tue, Aug 30, 2011 at 7:12 PM, Jonas Sicking jo...@sicking.cc wrote: On Tue, Aug 30, 2011 at 11:55 AM, Ehsan Akhgari eh...@mozilla.com wrote: Isn't the main difference between the two transactions the fact that the browser knows how to undo/redo managed transactions, whereas the author explicitly specifies how to undo/redo manual transactions? In this case, why wouldn't we go with a terminology like automatic/manual? I like that! So do I. - Ryosuke
Re: [whatwg] Fixing undo on the Web - UndoManager and Transaction
On Tue, Aug 30, 2011 at 12:30 PM, Ryosuke Niwa rn...@webkit.org wrote: On Tue, Aug 30, 2011 at 12:21 PM, Ehsan Akhgari eh...@mozilla.com wrote: On 11-08-30 3:15 PM, Ryosuke Niwa wrote: 1. Should Transaction have reapply property or not? It appears that some of us (e.g. me, Annie, Alex) want it for semantical clarity while others (e.g. Jonas and Ehsan) doesn't wait to avoid code duplication and to simply the API. I still think that if we can design an API which discourages code duplication, we probably should. (I feel like we're bikesheding here but) authors can do that by omitting reapply as in {'apply': ..., 'unapply': ...}. First of all people tend to copy and be inspired by what other people do, so it seems very likely that people would end up duplicating code not realizing that the reapply function is optional. Second, I think you brought up really good arguments for why the reapply behavior often needs to be slightly different than the apply behavior. As you pointed out this would be awkward if you simply left out the reapply function under your proposal. This is why I suggested we add the boolean argument passed to the apply function which is indicates if it's the first apply call, or a subsequent one. I'm really failing to think of a case when you'd really want to have apply and reapply as separate callbacks. Even in the most trivial cases it seems like it would lead to code duplication which is something that even the most basic developers try to avoid. And especially in more complex scenarios like collaborative editors it seems like you really wouldn't want to duplicate the logic between apply and reapply. So once we have the boolean argument to apply, I fail to see any cases where the reapply approach is better. I'd love to see some examples if you have any? / Jonas
Re: [whatwg] Fixing undo on the Web - UndoManager and Transaction
On Tue, 30 Aug 2011 21:04:09 +0200, Ryosuke Niwa rn...@webkit.org 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. -- Anne van Kesteren http://annevankesteren.nl/