Created attachment 41698 [details] screenshot of selection on webkit.org In the attached screenshot, observe how the selection paints over the sidebar. Maciej wrote: "http://daringfireball.net/ is another site that has the same problem, likely for the very same reason. I expect this will happen on any site uses a large left margin on the main content to lay out around an absolute-positioned sidebar. Some sites use floats for this kind of thing and are not affected. I'm not sure what the best fix is. Maybe we should be stopping selection painting at the border box and not draw into margins. I'm not sure if this would have negative consequences on other sites."
Ojan has been doing work on selection bugs, so he's a good triage person for this.
Stopping selection painting at the border box makes sense to me. The downside, I think, is that you'd get a jagged right edge in some cases. For example: <div style="width:200px">foo</div> <div style="width:400px">foo</div> If you were to select all that, then the top part of the selection would be smaller. My intuition is that's a less common case than the cases like this one that it would fix.
Seems like hyatt checked in something years ago explicitly to make selection not have jagged edges. I wonder if that patch is the exact opposite of the suggested fix here.
(In reply to comment #3) > Seems like hyatt checked in something years ago explicitly to make selection not have jagged edges. I wonder if that patch is the exact opposite of the suggested fix here. These are all heuristics. We need to pick the one that maximizes only highlighting the part of the DOM you have selected while minimizing jagged edges. I expect highlighting the border-box of elements instead of their margin-box would almost always be better. I can easily construct pages where selections would look bad with either approach. Would be great for someone to put together a patch that we could try locally and see how it feels on different real pages.