Created attachment 173321 [details] reduced testcase See test case. In general we don't handle margins very well with selections (e.g. any page that puts all it's contents in a margin: auto container). Here's another case encountered in the real world.
I don't think margins have a direct effect on the issue. I think that the root cause is extending the selection until reaching the float's container. I'll attach another case which I think reveals the same issue without margins.
Created attachment 318979 [details] another test case
FTR, the issue is clearly reproducible in current trunk.
I can reproduce the issue described in both test cases in FF as well.