Title: [147008] trunk/Source/WebCore
- Revision
- 147008
- Author
- rn...@webkit.org
- Date
- 2013-03-27 13:51:11 -0700 (Wed, 27 Mar 2013)
Log Message
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):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (147007 => 147008)
--- trunk/Source/WebCore/ChangeLog 2013-03-27 20:47:51 UTC (rev 147007)
+++ trunk/Source/WebCore/ChangeLog 2013-03-27 20:51:11 UTC (rev 147008)
@@ -1,3 +1,17 @@
+2013-03-27 Ryosuke Niwa <rn...@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 <timo...@apple.com>
Add support for dock-to-right of the Web Inspector in the Mac port.
Modified: trunk/Source/WebCore/rendering/InlineTextBox.cpp (147007 => 147008)
--- trunk/Source/WebCore/rendering/InlineTextBox.cpp 2013-03-27 20:47:51 UTC (rev 147007)
+++ trunk/Source/WebCore/rendering/InlineTextBox.cpp 2013-03-27 20:51:11 UTC (rev 147008)
@@ -206,7 +206,12 @@
if (respectHyphen)
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();
if (r.x() > logicalRight())
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes