Bug 104884

Summary: Safari spends a lot of time in WebCore::findSimpleWordBoundary while selecting text on large scrabutility.com page
Product: WebKit Reporter: Ryosuke Niwa <rniwa>
Component: HTML EditingAssignee: Ryosuke Niwa <rniwa>
Status: RESOLVED FIXED    
Severity: Normal CC: barraclough, darin, enrica, jiapu.mail, kling, koivisto, mifenton, morrita, webkit.review.bot
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Don't find word boundaries outside of editable region none

Ryosuke Niwa
Reported 2012-12-13 00:03:38 PST
Visit http://scrabutility.com/4_TWL06.php and select text by mouse drags. You see a spin. <rdar://problem/12188622>
Attachments
Don't find word boundaries outside of editable region (1.81 KB, patch)
2012-12-13 00:24 PST, Ryosuke Niwa
no flags
Ryosuke Niwa
Comment 1 2012-12-13 00:03:53 PST
It appears that this could be a regression from http://trac.webkit.org/changeset/120357.
Ryosuke Niwa
Comment 2 2012-12-13 00:04:57 PST
We’re spending a significant amount of time in AlternativeTextController::respondToChangedSelection Running Time Self Symbol Name 1183.0ms 50.6% 1183.0 icu::RuleBasedBreakIterator::handleNext(icu::RBBIStateTable const*) 1183.0ms 50.6% 0.0 icu::RuleBasedBreakIterator::next() 1183.0ms 50.6% 0.0 icu::RuleBasedBreakIterator::following(int) 1183.0ms 50.6% 0.0 -[NSAttributedString(NSAttributedStringKitAdditions) doubleClickAtIndex:inRange:] 1183.0ms 50.6% 0.0 WebCore::findWordBoundary(unsigned short const*, int, int, int*, int*) 1183.0ms 50.6% 0.0 WebCore::endWordBoundary(unsigned short const*, unsigned int, unsigned int, WebCore::BoundarySearchContextAvailability, bool&) 1183.0ms 50.6% 0.0 WebCore::nextBoundary(WebCore::VisiblePosition const&, unsigned int (*)(unsigned short const*, unsigned int, unsigned int, WebCore::BoundarySearchContextAvailability, bool&)) 1183.0ms 50.6% 0.0 WebCore::endOfWord(WebCore::VisiblePosition const&, WebCore::EWordSide) 1183.0ms 50.6% 0.0 WebCore::AlternativeTextController::respondToChangedSelection(WebCore::VisibleSelection const&, unsigned int) 1183.0ms 50.6% 0.0 WebCore::Editor::respondToChangedSelection(WebCore::VisibleSelection const&, unsigned int) 1183.0ms 50.6% 0.0 WebCore::FrameSelection::setSelection(WebCore::VisibleSelection const&, unsigned int, WebCore::FrameSelection::CursorAlignOnScroll, WebCore::TextGranularity)
Ryosuke Niwa
Comment 3 2012-12-13 00:21:04 PST
Okay, I have a fix for this particular bug but selection is still very laggy. Now we spend most of time clipping selection rect :( Running Time Self Symbol Name 2832.0ms 62.5% 0.0 -[WebTileLayer drawInContext:] 2832.0ms 62.5% 0.0 WebCore::TileCache::drawLayer(WebTileLayer*, CGContext*) 2832.0ms 62.5% 0.0 drawLayerContents(CGContext*, CALayer*, WebCore::PlatformCALayer*) 2830.0ms 62.4% 0.0 WebCore::GraphicsLayer::paintGraphicsLayerContents(WebCore::GraphicsContext&, WebCore::IntRect const&) 2830.0ms 62.4% 0.0 WebCore::RenderLayerBacking::paintContents(WebCore::GraphicsLayer const*, WebCore::GraphicsContext&, unsigned int, WebCore::IntRect const&) 2830.0ms 62.4% 0.0 WebCore::RenderLayerBacking::paintIntoLayer(WebCore::RenderLayer*, WebCore::GraphicsContext*, WebCore::IntRect const&, unsigned int, unsigned int) 2829.0ms 62.4% 0.0 WebCore::RenderLayer::paintLayerContents(WebCore::GraphicsContext*, WebCore::RenderLayer::LayerPaintingInfo const&, unsigned int) 2829.0ms 62.4% 0.0 WebCore::RenderLayer::paintLayer(WebCore::GraphicsContext*, WebCore::RenderLayer::LayerPaintingInfo const&, unsigned int) 2829.0ms 62.4% 2.0 WebCore::RenderLayer::paintLayerContents(WebCore::GraphicsContext*, WebCore::RenderLayer::LayerPaintingInfo const&, unsigned int) 2827.0ms 62.4% 0.0 WebCore::RenderBlock::paint(WebCore::PaintInfo&, WebCore::LayoutPoint const&) 2826.0ms 62.3% 0.0 WebCore::RenderBlock::paintObject(WebCore::PaintInfo&, WebCore::LayoutPoint const&) 2819.0ms 62.2% 0.0 WebCore::RenderBlock::paintFloats(WebCore::PaintInfo&, WebCore::LayoutPoint const&, bool) 2819.0ms 62.2% 0.0 WebCore::RenderBlock::paint(WebCore::PaintInfo&, WebCore::LayoutPoint const&) 2819.0ms 62.2% 0.0 WebCore::RenderBlock::paintObject(WebCore::PaintInfo&, WebCore::LayoutPoint const&) 1904.0ms 42.0% 0.0 WebCore::RenderBlock::paintSelection(WebCore::PaintInfo&, WebCore::LayoutPoint const&) 1363.0ms 30.0% 52.0 WebCore::RenderBlock::selectionGaps(WebCore::RenderBlock*, WebCore::LayoutPoint const&, WebCore::LayoutSize const&, WebCore::LayoutUnit&, WebCore::LayoutUnit&, WebCore::LayoutUnit&, WebCore::PaintInfo const*) 1300.0ms 28.7% 12.0 WebCore::GraphicsContext::clipOut(WebCore::IntRect const&)
Ryosuke Niwa
Comment 4 2012-12-13 00:24:39 PST
Created attachment 179219 [details] Don't find word boundaries outside of editable region
Ryosuke Niwa
Comment 5 2012-12-13 00:29:46 PST
+antti, +kling in the case they know how to improve GraphicsContext::clipOut.
Hajime Morrita
Comment 6 2012-12-13 00:37:09 PST
Comment on attachment 179219 [details] Don't find word boundaries outside of editable region Looks an easy win. You'd file a bug for tracking slowness of selection in general.
Ryosuke Niwa
Comment 7 2012-12-13 00:45:19 PST
Comment on attachment 179219 [details] Don't find word boundaries outside of editable region Thanks for the review.
Ryosuke Niwa
Comment 8 2012-12-13 00:53:12 PST
(In reply to comment #6) > (From update of attachment 179219 [details]) > Looks an easy win. You'd file a bug for tracking slowness of selection in general. Yeah, I'll go talk with someone familiar with GraphicsContext and see there's anyway to improve clipping.
WebKit Review Bot
Comment 9 2012-12-13 02:10:17 PST
Comment on attachment 179219 [details] Don't find word boundaries outside of editable region Clearing flags on attachment: 179219 Committed r137577: <http://trac.webkit.org/changeset/137577>
WebKit Review Bot
Comment 10 2012-12-13 02:10:21 PST
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.