Bug 130613 - webkitGetRegionFlowRanges for last CSS Regions in chain doesn't return fragment
Summary: webkitGetRegionFlowRanges for last CSS Regions in chain doesn't return fragment
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks: 128165
  Show dependency treegraph
 
Reported: 2014-03-21 12:08 PDT by Dave Hyatt
Modified: 2014-05-26 08:35 PDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dave Hyatt 2014-03-21 12:08:57 PDT
When calling webkitGetRegionFlowRanges on the last CSS Region in a chain, it returns all the content left from the flow and not just the fragment displayed, even when the last CSS Region has .style.overflow = 'hidden' AND/OR .style.webkitRegionFragment = 'break'. This makes it impossible to figure out what content is actually displayed for this last region, without creating another region. It makes sense to have the function return the displayed fragment, because you can always figure out the remaining content with some range manipulation, but you can't figure out the displayed without this function.

Steps to Reproduce:
1. Safari 7.0
2. Run this HTML

<!DOCTYPE html>
<html>
<head>
<script>

	function init(){
		var ranges = document.getElementById('sink').webkitGetRegionFlowRanges();
		var source = document.getElementById('source');
		
		
		if(ranges[0].toString() === source.textContent){
			alert('wrong');
		}
	
	}

	document.addEventListener("DOMContentLoaded", init, false);

</script>
<title></title>
<body>

<div id="sink" style="width:200px; height:200px; -webkit-flow-from: flow; overflow:hidden; -webkit-region-fragment: break;"></div>

<div id="source" style="-webkit-flow-into: flow">
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. <span style="display:none">Inline</span> Nam vitae felis dui. Integer ac mi ac quam tempus porttitor sed id quam. Etiam lectus nisl, tristique eget sodales at, ullamcorper at ligula. Nulla molestie malesuada velit, eget fermentum orci egestas id. Praesent semper, ipsum eu volutpat porta, justo lacus congue massa, eu egestas lectus quam vel lectus. Donec non massa vitae leo tempor pellentesque. Suspendisse vehicula diam commodo turpis pulvinar fringilla. Morbi tincidunt tortor quis massa ultricies nec lacinia tortor malesuada. Fusce eget sem arcu. Duis viverra ipsum at lacus mollis tristique.
</p>
<p>
Duis hendrerit diam ut leo bibendum porta. Nam tempus libero ac arcu consectetur a aliquam nulla laoreet. Donec in nunc ante. Ut quis odio velit, adipiscing facilisis elit. Sed lobortis consectetur volutpat. Praesent eget ligula mi, vel lobortis dui. Cras molestie dapibus ante, eget mollis lectus venenatis et. Fusce metus urna, porttitor a pharetra ut, hendrerit non augue. Vivamus non neque eget magna elementum mattis.
</p>
</div>
</body>
</html>



Expected Results:
The above HTML to not alert('wrong')

Actual Results:
The above HTML alerts wrong, which means the webkitGetRegionFlowRanges returns all remaining content
Comment 1 Jon Lee 2014-03-21 13:54:56 PDT
<rdar://problem/15798258>