Bug 130613

Summary: webkitGetRegionFlowRanges for last CSS Regions in chain doesn't return fragment
Product: WebKit Reporter: Dave Hyatt <hyatt>
Component: Layout and RenderingAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: jonlee, mihnea, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 128165    

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>