* SUMMARY In RenderText::absoluteRectsForRange(), the following code is used in an else clause: IntRect r = box->selectionRect(0, 0, start, realEnd); if (!r.isEmpty()) { if (!useSelectionHeight) { In RenderText::absoluteQuadsForRange(), the same code uses a slightly different check: IntRect r = box->selectionRect(0, 0, start, realEnd); if (r.height()) { if (!useSelectionHeight) { It seems like these methods should be using the same check, and it would be great if the duplicate code could be extracted into a local static method.
From bug 34239
Created attachment 101949 [details] Patch
Comment on attachment 101949 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=101949&action=review > Source/WebCore/rendering/RenderText.cpp:281 > + // change the height and y position because selectionRect uses selection-specific values Please change this to use sentence case and end with a period. > Source/WebCore/rendering/RenderText.cpp:324 > + if (!rect.size().isZero()) Don't we have rect.isEmpty()? > Source/WebCore/rendering/RenderText.cpp:405 > + if (!rect.size().isZero()) Ditto.
Created attachment 102019 [details] Patch for landing
Thanks for the quick review. (In reply to comment #3) > (From update of attachment 101949 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=101949&action=review > > > Source/WebCore/rendering/RenderText.cpp:281 > > + // change the height and y position because selectionRect uses selection-specific values > > Please change this to use sentence case and end with a period. Done. > > > Source/WebCore/rendering/RenderText.cpp:324 > > + if (!rect.size().isZero()) > > Don't we have rect.isEmpty()? We do but I want to check for zero as opposed to empty here as we have a couple of tests that expect getClientRects to return a rect with a zero width. Added FloatRect::isZero that calls FloatSize::isZero and changed the code in RenderText to use that method.
Comment on attachment 102019 [details] Patch for landing Clearing flags on attachment: 102019 Committed r91763: <http://trac.webkit.org/changeset/91763>
All reviewed patches have been landed. Closing bug.
This test has been failing on GTK: http://build.webkit.org/old-results/GTK%20Linux%2032-bit%20Release/r91765%20(15930)/fast/dom/Range/getClientRects-pretty-diff.html
Comment on attachment 102019 [details] Patch for landing View in context: https://bugs.webkit.org/attachment.cgi?id=102019&action=review > Source/WebCore/rendering/RenderText.cpp:407 > + FloatRect rect = absoluteQuadForTextBox(box, start, end, useSelectionHeight); > + if (!rect.isZero()) > + quads.append(localToAbsoluteQuad(rect)); This is wrong. It converts local to absolute twice.