W3C home > Mailing lists > Public > www-style@w3.org > April 2014

Re: [css3-regions][css3-multicol] how to cutt up elements

From: François REMY <francois.remy.dev@outlook.com>
Date: Thu, 17 Apr 2014 17:43:42 +0200
Message-ID: <DUB130-DS185BA921996050FD16C6AAA5520@phx.gbl>
To: "Johannes Wilm" <johannes@fiduswriter.org>, "www-style list" <www-style@w3.org>
Hey Johannes,

I just wanted to reply this is exactly what I'm ended up doing in the new 
CSS Regions polyfill [0]. I also used a similar process for IE. The relevant 
code is in [1] and [2], mainly. Feel free to extract it from the polyfill if 
it suits your needs.

Yes, I agree with you this is clearly suboptimal to rely on API that are not 
even standardized to perform these operations, but this is all we have for 
now. I don't despair we shall get "getFragments" on elements which will 
return a list of Fragment (a Fragment being a list of DOM Ranges which are 
rendered in the same fragment on the page). This can only be done properly 
once the CSS Breaking spec has reached a satisfactory standardization level, 
though, which is'nt the case yet.

Best regards,
François


[0] https://github.com/FremyCompany/css-regions-polyfill
[1] 
https://github.com/FremyCompany/css-regions-polyfill/blob/master/src/css-break.js
[2] 
https://github.com/FremyCompany/css-regions-polyfill/blob/master/src/css-regions.js#L235


> From: Johannes Wilm
> Sent: Tuesday, April 15, 2014 10:05 PM
> To: www-style list
> Subject: [css3-regions][css3-multicol] how to cutt up elements
> Hey,
> given that CSS Regions unfortunately have been (temporarily) removed from 
> Blink, I've been experimenting with what other options there are to cut op 
> content, but letting the browser do the actual cutting.
>
> The only solutions I have come up with is using multiple CSS columsn and 
> then to determine where one columns ends using 
> caretPositionFromPoint/caretRangeFromPoint, and then cutting using 
> range.extractContents to remove the parts that don't fit.
>
> I have recreated most of the options I had available in the old 
> pagination.js using this method in this test: 
> http://fiduswriter.github.io/simplePagination.js/simplePagination.html 
> (working in Chrome and Firefox if the browser is occupying the entire 
> screen).
>
> It is somewhat of a hack, because 
> caretPositionFromPoint/caretRangeFromPoint only works if one first scrolls 
> to the place where one uses it.
>
>
> So my question to you guys: Is this how you suggest one cuts up contents? 
> Is there no less hackish way envisioned for javascript to determine what 
> content belongs to one specific column? It seems like that would be quite 
> an important piece of information for many uses.
>
> -- 
>
> Johannes Wilm
> Fidus Writer
> http://www.fiduswriter.com 
Received on Thursday, 17 April 2014 15:44:07 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:39:21 UTC