Summary: | Crash under WebCore::DataDetection::detectContentInRange() | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Chris Dumez <cdumez> | ||||||||
Component: | DOM | Assignee: | Chris Dumez <cdumez> | ||||||||
Status: | RESOLVED FIXED | ||||||||||
Severity: | Normal | CC: | commit-queue, enrica, rniwa, webkit-bug-importer | ||||||||
Priority: | P2 | Keywords: | InRadar | ||||||||
Version: | WebKit Nightly Build | ||||||||||
Hardware: | Unspecified | ||||||||||
OS: | Unspecified | ||||||||||
Attachments: |
|
Description
Chris Dumez
2016-04-21 16:35:53 PDT
Created attachment 276982 [details]
Patch
Comment on attachment 276982 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=276982&action=review > Source/WebCore/editing/cocoa/DataDetection.mm:567 > + Vector<RefPtr<Range>>& resultRanges = allResultRanges[resultIndex]; I would like auto& better. > Source/WebCore/editing/cocoa/DataDetection.mm:581 > + rangeBoundaries.uncheckedAppend(std::make_pair(range->startPosition(), range->endPosition())); Could use braces instead of make_pair? rangeBoundaries.uncheckedAppend({ range->startPosition(), range->endPosition() }); > Source/WebCore/editing/cocoa/DataDetection.mm:642 > + else if (is<Element>(*parentNode)) { > + if (RefPtr<Attr> color = downcast<Element>(*parentNode).getAttributeNode("color")) > + anchorElement->setAttribute(styleAttr, color->style()->cssText()); > } An Attr node is a really inefficient way to get the CSS color string that depends on a deprecated feature. In fact, Attr::style specifically says "This function only exists to support the Obj-C bindings." I think I had a patch fixing this, but didn’t land it. What we want is something more like this: if (is<StyledElement>(*parentNode)) { if (auto* style = downcast<StyledElement>(*parentNode).presentationAttributeStyle()) { String color = style->getPropertyValue(CSSPropertyIDColor); if (!color.isEmpty()) anchorElement->setInlineStyleProperty(CSSPropertyIDColor, color); } } Created attachment 277092 [details]
Patch
Comment on attachment 277092 [details]
Patch
Confirmed locally that the feature is still working.
Forgot about some of the review comments. Created attachment 277094 [details]
Patch
Comment on attachment 277094 [details] Patch Clearing flags on attachment: 277094 Committed r199910: <http://trac.webkit.org/changeset/199910> All reviewed patches have been landed. Closing bug. |