Selections of justified text can create erratic movement of the text within the page. Here is a testcase that works with WebKitQt/QtLauncher: <html> <body> <!--My window of QtLauncher is set to size 424,593 and the bug appears when selecting the last foo and dragging over the space before it--> <p align="justify">Foo Bar Baz Foo Baz Bar Foo Baz Bar Baz Foo Baz Bar Foo Baz</p> </body> </html> When the text is wrapped right after the last foo this bug appears. On the mac it can be seen by using ::selection.
Created attachment 13897 [details] Patch that eliminates run.from() and run.to() in favor of passing them in as args only when needed
Comment on attachment 13897 [details] Patch that eliminates run.from() and run.to() in favor of passing them in as args only when needed + // Using roundf() rather than ceilf() for the right edge as a compromise to ensure correct caret positioning + if (style.rtl()) { + it.advance(run.length()); + startX += it.m_finalRoundingWidth - afterWidth; The copy&pasted comment doesn't make sense there. Also, I think you need to cache the finalRoundingWidth before advancing to the end and use that (like floatWidthForSimpleText() did), otherwise RTL text will jiggle as you select it (if it's painted separately). Finally, you forgot to add it.m_runWidthSoFar there (that's why you advance to the end). So I think the correct code would be + if (style.rtl()) { + float finalRoundingWidth = it.m_finalRoundingWidth; + it.advance(run.length()); + startX += finalRoundingWidth + it.m_runWidthSoFar - afterWidth; + if (Font::isRoundingHackCharacter(nextCh) && (!isLastChar || params->m_style.applyRunRounding())){ Missing space before the { there. Please include a test for the justified text bug (similar to the one for bug 13224).
Created attachment 13913 [details] Add test and fix bug pointed out by mitz
Comment on attachment 13913 [details] Add test and fix bug pointed out by mitz r=me
Fixed in r20646.