[CSSRegions] Clean-up selection tests a bit
https://bugs.webkit.org/show_bug.cgi?id=126135

Reviewed by Dirk Schulze.

Move function clearSelection in helper.js. Combine checkResult() from position-for-point* and position-for-point-1*
into a single function, checkSelectionResult() and  move it into helper.js too.

* fast/regions/resources/helper.js:
* fast/regions/selection/position-for-point-1-vert-lr.html:
* fast/regions/selection/position-for-point-1-vert-rl.html:
* fast/regions/selection/position-for-point-1.html:
* fast/regions/selection/position-for-point-vert-lr.html:
* fast/regions/selection/position-for-point-vert-rl.html:
* fast/regions/selection/position-for-point.html:
* fast/regions/selection/selecting-text-through-different-region-flows.html:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@160978 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[CSSRegions] Crash when trying to select content from invalid region
https://bugs.webkit.org/show_bug.cgi?id=126113

Reviewed by Antti Koivisto.

Source/WebCore:

After fix for https://bugs.webkit.org/show_bug.cgi?id=120769, positionForPoint for a region attempts to use the associated named flow to perform its task.
However, this should happen only when the region is valid. If the region is invalid, part of a dependency cycle, positionForPoint should behave as usual
for a block instead of a region, otherwise it may run into an infinite loop due to cyclic dependencies and a crash will occur.

This patch ensures that positionForPoint region specifie behaviour is followed only if the region is valid - not part of a dependency cycle.

Test: fast/regions/selection/invalid-region-selection-crash.html

* rendering/RenderRegion.cpp:
(WebCore::RenderRegion::positionForPoint):

LayoutTests:

* fast/regions/selection/invalid-region-selection-crash-expected.txt: Added.
* fast/regions/selection/invalid-region-selection-crash.html: Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@160979 268f45cc-cd09-0410-ab3c-d52691b4dbfc