<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>15938</bug_id>
          
          <creation_ts>2012-02-08 22:02:31 +0000</creation_ts>
          <short_desc>Attaching events to content flows</short_desc>
          <delta_ts>2012-04-11 21:10:57 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>CSS</product>
          <component>Regions</component>
          <version>unspecified</version>
          <rep_platform>PC</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard>cssom</status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Vincent Hardy">vhardy</reporter>
          <assigned_to name="Vincent Hardy">vhardy</assigned_to>
          <cc>christian.cantrell</cc>
    
    <cc>eoconnor</cc>
    
    <cc>mihnea</cc>
    
    <cc>rcaliman</cc>
    
    <cc>stearns</cc>
          
          <qa_contact>public-css-bugzilla</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>63905</commentid>
    <comment_count>0</comment_count>
    <who name="Vincent Hardy">vhardy</who>
    <bug_when>2012-02-08 22:02:31 +0000</bug_when>
    <thetext>(Some feedback on regions for those interested…)

I&apos;ve written a little framework for dividing content up into &quot;pages&quot; (regions) using the CSSOM APIs. I&apos;m happy with the way it turned out, but the way I had to go about doing it was more complicate than what I was hoping for. In fact, I tried every other method I could think of for detecting overflow before finally resorting to attaching webkitRegionLayoutUpdate events to regions.

From Christian Cantrell (Adobe):

====
[...] something that should work is attaching the webkitRegionLayoutUpdate event listener to the flow itself rather than individual regions. For instance:

var storyFlow = document.webkitGetFlowByName(&apos;story&apos;);
storyFlow.addEventListener(&apos;webkitRegionLayoutUpdate&apos;, function(e) {
	if (storyFlow.overflow) {
		// add another region
	}
});

This would be a great way to know if additional regions were needed, however it wouldn&apos;t be enough to tell whether regions needed to be taken away. In that case, the flow would need an additional property like emptyRegions. Something like this would be nice:

var storyFlow = document.webkitGetFlowByName(&apos;story&apos;);
storyFlow.addEventListener(&apos;webkitRegionLayoutUpdate&apos;, function(e) {
	if (storyFlow.overflow) {
		// add another region
	} else if (storyFlow. emptyRegions.length &gt; 0) {
		for (var i = 0; i &lt; storyFlow.emptyRegions.length; ++i) {
			document.getElementById(&apos;pageContainer&apos;).removeChild(storyFlow.emptyRegions[i]);
		}
	}
});</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>65478</commentid>
    <comment_count>1</comment_count>
    <who name="Vincent Hardy">vhardy</who>
    <bug_when>2012-03-13 22:53:04 +0000</bug_when>
    <thetext>So the proposal is:

a. Have NamedFlow implement the EventTarget interface
b. Have NamedFlow dispatch a region layout update event (http://dev.w3.org/csswg/css3-regions/#region-flow-layout-events)
c. Add an emptyRegions member to the NamedFlow interface.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>65957</commentid>
    <comment_count>2</comment_count>
    <who name="Vincent Hardy">vhardy</who>
    <bug_when>2012-03-22 17:07:54 +0000</bug_when>
    <thetext>(In reply to comment #1)
&gt; So the proposal is:
&gt; 
&gt; a. Have NamedFlow implement the EventTarget interface
&gt; b. Have NamedFlow dispatch a region layout update event
&gt; (http://dev.w3.org/csswg/css3-regions/#region-flow-layout-events)
&gt; c. Add an emptyRegions member to the NamedFlow interface.

- For a. and b., make sure the bubbling is consistent with other EventTargets that are not DOM nodes.
- For c., suggests having a property for the last non empty region index (-1 if empty flow or if no region at all)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>66113</commentid>
    <comment_count>3</comment_count>
    <who name="Razvan Caliman">rcaliman</who>
    <bug_when>2012-03-27 13:52:36 +0000</bug_when>
    <thetext>(In reply to comment #2)
&gt; (In reply to comment #1)
&gt; &gt; So the proposal is:
&gt; &gt; 
&gt; &gt; a. Have NamedFlow implement the EventTarget interface
&gt; &gt; b. Have NamedFlow dispatch a region layout update event
&gt; &gt; (http://dev.w3.org/csswg/css3-regions/#region-flow-layout-events)
&gt; &gt; c. Add an emptyRegions member to the NamedFlow interface.
&gt; 
&gt; - For a. and b., make sure the bubbling is consistent with other EventTargets
&gt; that are not DOM nodes.
&gt; - For c., suggests having a property for the last non empty region index (-1 if
&gt; empty flow or if no region at all)

For c., if you&apos;re suggesting collecting empty regions, why not collect all regions for a flow? 
Then, the developer could iterate through them and check the regionOverflow property.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>66115</commentid>
    <comment_count>4</comment_count>
    <who name="Vincent Hardy">vhardy</who>
    <bug_when>2012-03-27 14:12:25 +0000</bug_when>
    <thetext>(In reply to comment #3)
&gt; (In reply to comment #2)
&gt; &gt; (In reply to comment #1)
&gt; &gt; &gt; So the proposal is:
&gt; &gt; &gt; 
&gt; &gt; &gt; a. Have NamedFlow implement the EventTarget interface
&gt; &gt; &gt; b. Have NamedFlow dispatch a region layout update event
&gt; &gt; &gt; (http://dev.w3.org/csswg/css3-regions/#region-flow-layout-events)
&gt; &gt; &gt; c. Add an emptyRegions member to the NamedFlow interface.
&gt; &gt; 
&gt; &gt; - For a. and b., make sure the bubbling is consistent with other EventTargets
&gt; &gt; that are not DOM nodes.
&gt; &gt; - For c., suggests having a property for the last non empty region index (-1 if
&gt; &gt; empty flow or if no region at all)
&gt; 
&gt; For c., if you&apos;re suggesting collecting empty regions, why not collect all
&gt; regions for a flow? 
&gt; Then, the developer could iterate through them and check the regionOverflow
&gt; property.

Here, the goal is to help the developer get to the index of the last empty region easily. There is already a proposal (on NamedFlow), to help the developers iterate, see:

http://wiki.csswg.org/spec/css3-regions/css-om</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>66117</commentid>
    <comment_count>5</comment_count>
    <who name="Razvan Caliman">rcaliman</who>
    <bug_when>2012-03-27 14:18:20 +0000</bug_when>
    <thetext>(In reply to comment #4)
&gt; (In reply to comment #3)
&gt; &gt; (In reply to comment #2)
&gt; &gt; &gt; (In reply to comment #1)
&gt; &gt; &gt; &gt; So the proposal is:
&gt; &gt; &gt; &gt; 
&gt; &gt; &gt; &gt; a. Have NamedFlow implement the EventTarget interface
&gt; &gt; &gt; &gt; b. Have NamedFlow dispatch a region layout update event
&gt; &gt; &gt; &gt; (http://dev.w3.org/csswg/css3-regions/#region-flow-layout-events)
&gt; &gt; &gt; &gt; c. Add an emptyRegions member to the NamedFlow interface.
&gt; &gt; &gt; 
&gt; &gt; &gt; - For a. and b., make sure the bubbling is consistent with other EventTargets
&gt; &gt; &gt; that are not DOM nodes.
&gt; &gt; &gt; - For c., suggests having a property for the last non empty region index (-1 if
&gt; &gt; &gt; empty flow or if no region at all)
&gt; &gt; 
&gt; &gt; For c., if you&apos;re suggesting collecting empty regions, why not collect all
&gt; &gt; regions for a flow? 
&gt; &gt; Then, the developer could iterate through them and check the regionOverflow
&gt; &gt; property.
&gt; 
&gt; Here, the goal is to help the developer get to the index of the last empty
&gt; region easily. There is already a proposal (on NamedFlow), to help the
&gt; developers iterate, see:
&gt; 
&gt; http://wiki.csswg.org/spec/css3-regions/css-om

Noted. Thanks for the clarification!
I missed the getRegions method.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>66143</commentid>
    <comment_count>6</comment_count>
    <who name="Vincent Hardy">vhardy</who>
    <bug_when>2012-03-27 20:52:08 +0000</bug_when>
    <thetext>https://dvcs.w3.org/hg/csswg/rev/614c5fe1f9ad</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>