[Webkit-unassigned] [Bug 165515] [Cocoa] NSAttributedString representation of text copied from -webkit-nbsp-mode:sapce element contains non-breaking space characters, but shouldn’t

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Dec 7 09:01:19 PST 2016


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

--- Comment #3 from Darin Adler <darin at apple.com> ---
Comment on attachment 296374
  --> https://bugs.webkit.org/attachment.cgi?id=296374
Possible fix (no tests and no change log)

View in context: https://bugs.webkit.org/attachment.cgi?id=296374&action=review

>> Source/WebCore/editing/cocoa/HTMLConverter.mm:2252
>> +                        nbspMode = characterData.parentElement() ? static_cast<ENBSPMode>(downcast<CSSPrimitiveValue>(*_caches->computedStylePropertyForElement(*characterData.parentElement(), CSSPropertyWebkitNbspMode).get())) : NBNORMAL;
> 
> Perhaps the chance of encountering an non-breaking space is low enough that we can use afford to use propertyValueForNode() and do a string compare instead of using computedStylePropertyForElement().

Seems clear we *could* do that even if non-breaking spaces are relatively common, because the textTransform logic below calls propertyValueForNode once per string already. So calling it a second time couldn’t make things more than twice as slow.

I have to admit, I am not really an expert on the philosophy behind how the HTMLConverter works, but I see no harm in making this change.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.webkit.org/pipermail/webkit-unassigned/attachments/20161207/a55d7bf9/attachment.html>


More information about the webkit-unassigned mailing list