The following "is block in the viewport" code is incorrect: basicBlocks = basicBlocks.filter(function(block) { return (block.startOffset >= startOffset && block.startOffset <= endOffset) || (block.startOffset <= startOffset && block.endOffset >= endOffset); }); https://github.com/WebKit/webkit/blob/f70c51a855acc626ec921f7400a69ede4bffac96/Source/WebInspectorUI/UserInterface/Controllers/BasicBlockAnnotator.js#L68-L71 Let's break it down into smaller pieces: block.startOffset >= startOffset && block.startOffset <= endOffset returns true for the following cases (tilt your head 90 degrees): Viewport: [---] Block: [---] block.startOffset <= startOffset && block.endOffset >= endOffset returns true for the following case: Viewport: [---] Block: [------] The following case isn't covered, e.g. the filter function wrongly returns false: Viewport: [---] Block: [---]
<rdar://problem/23485933>
Let's outline all the possible scenarios. Intersect: A: [---] B: [---] A: [-----] B: [-] A: [-] B: [-----] A: [---] B: [---] Don't intersect: A: [---] B: [---] A: [---] B: [---] The easiest way to check if two ranges intersect is to check if they don't intersect. It is also the fastest way.
Created attachment 265220 [details] Patch
Comment on attachment 265220 [details] Patch r=me
Comment on attachment 265220 [details] Patch Clearing flags on attachment: 265220 Committed r192264: <http://trac.webkit.org/changeset/192264>
All reviewed patches have been landed. Closing bug.