Commit fe851a45 authored by rniwa@webkit.org's avatar rniwa@webkit.org
Browse files

Selection code spends a lot of time in InlineTextBox::localSelectionRect

https://bugs.webkit.org/show_bug.cgi?id=113364

Reviewed by Enrica Casucci.

Avoid computing the font width when we're selecting the entire line box.

This appears to be 25-26% improvement on Interactive/SelectAll:Time.

* rendering/InlineTextBox.cpp:
(WebCore::InlineTextBox::localSelectionRect):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@147008 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 79c34d60
2013-03-27 Ryosuke Niwa <rniwa@webkit.org>
Selection code spends a lot of time in InlineTextBox::localSelectionRect
https://bugs.webkit.org/show_bug.cgi?id=113364
Reviewed by Enrica Casucci.
Avoid computing the font width when we're selecting the entire line box.
This appears to be 25-26% improvement on Interactive/SelectAll:Time.
* rendering/InlineTextBox.cpp:
(WebCore::InlineTextBox::localSelectionRect):
2013-03-26 Timothy Hatcher <timothy@apple.com> 2013-03-26 Timothy Hatcher <timothy@apple.com>
   
Add support for dock-to-right of the Web Inspector in the Mac port. Add support for dock-to-right of the Web Inspector in the Mac port.
...@@ -206,7 +206,12 @@ LayoutRect InlineTextBox::localSelectionRect(int startPos, int endPos) ...@@ -206,7 +206,12 @@ LayoutRect InlineTextBox::localSelectionRect(int startPos, int endPos)
if (respectHyphen) if (respectHyphen)
endPos = textRun.length(); endPos = textRun.length();
LayoutRect r = enclosingIntRect(font.selectionRectForText(textRun, FloatPoint(logicalLeft(), selTop), selHeight, sPos, ePos)); FloatPoint startingPoint = FloatPoint(logicalLeft(), selTop);
LayoutRect r;
if (sPos || ePos != static_cast<int>(m_len))
r = enclosingIntRect(font.selectionRectForText(textRun, startingPoint, selHeight, sPos, ePos));
else // Avoid computing the font width when the entire line box is selected as an optimization.
r = enclosingIntRect(FloatRect(startingPoint, FloatSize(m_logicalWidth, selHeight)));
LayoutUnit logicalWidth = r.width(); LayoutUnit logicalWidth = r.width();
if (r.x() > logicalRight()) if (r.x() > logicalRight())
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment