Changeset 209682 in webkit
- Timestamp:
- Dec 11, 2016 10:10:03 AM (7 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r209677 r209682 1 2016-12-11 Dan Bernstein <mitz@apple.com> 2 3 [Cocoa] NSAttributedString representation of text copied from -webkit-nbsp-mode:space element contains non-breaking space characters, but shouldn’t 4 https://bugs.webkit.org/show_bug.cgi?id=165515 5 <rdar://problem/4108460> 6 7 Reviewed by Darin Adler. 8 9 * platform/mac/fast/text/attributed-substring-from-range-expected.txt: Updated. 10 1 11 2016-12-10 Simon Fraser <simon.fraser@apple.com> 2 12 -
trunk/LayoutTests/platform/mac/fast/text/attributed-substring-from-range-expected.txt
r25367 r209682 14 14 total length: 15 15 15 one space: " " 16 two spaces: " 17 three spaces: " 18 four spaces: " 16 two spaces: " " 17 three spaces: " " 18 four spaces: " " 19 19 20 20 Testing space-only runs (1..2...3....4.5) -
trunk/Source/WebCore/ChangeLog
r209680 r209682 1 2016-12-11 Dan Bernstein <mitz@apple.com> 2 3 [Cocoa] NSAttributedString representation of text copied from -webkit-nbsp-mode:space element contains non-breaking space characters, but shouldn’t 4 https://bugs.webkit.org/show_bug.cgi?id=165515 5 <rdar://problem/4108460> 6 7 Reviewed by Darin Adler. 8 9 Test: platform/mac/fast/text/attributed-substring-from-range.html 10 11 * editing/cocoa/HTMLConverter.mm: 12 (HTMLConverter::_processText): Emit a space instead of a non-breaking space if the text node 13 is styled with -webkit-nbsp-mode:space. 14 (WebCore::editingAttributedStringFromRange): Replace all non-breaking spaces with spaces if 15 they come from a text node with -webkit-nbsp-mode:space. 16 1 17 2016-12-11 Konstantin Tokarev <annulen@yandex.ru> 2 18 -
trunk/Source/WebCore/editing/cocoa/HTMLConverter.mm
r208565 r209682 2237 2237 bool wasLeading = true; 2238 2238 StringBuilder builder; 2239 LChar noBreakSpaceRepresentation = 0; 2239 2240 for (unsigned i = 0; i < count; i++) { 2240 2241 UChar c = originalString.at(i); … … 2245 2246 if (wasSpace) 2246 2247 builder.append(' '); 2247 builder.append(c); 2248 if (c != noBreakSpace) 2249 builder.append(c); 2250 else { 2251 if (!noBreakSpaceRepresentation) 2252 noBreakSpaceRepresentation = _caches->propertyValueForNode(characterData, CSSPropertyWebkitNbspMode) == "space" ? ' ' : noBreakSpace; 2253 builder.append(noBreakSpaceRepresentation); 2254 } 2248 2255 wasSpace = false; 2249 2256 wasLeading = false; … … 2520 2527 [attrs.get() removeObjectForKey:NSBackgroundColorAttributeName]; 2521 2528 2522 [string replaceCharactersInRange:NSMakeRange(stringLength, 0) withString:it.text().createNSStringWithoutCopying().get()]; 2529 RetainPtr<NSString> text; 2530 if (style.nbspMode() == NBNORMAL) 2531 text = it.text().createNSStringWithoutCopying(); 2532 else 2533 text = it.text().toString().replace(noBreakSpace, ' '); 2534 2535 [string replaceCharactersInRange:NSMakeRange(stringLength, 0) withString:text.get()]; 2523 2536 [string setAttributes:attrs.get() range:NSMakeRange(stringLength, currentTextLength)]; 2524 2537 stringLength += currentTextLength;
Note: See TracChangeset
for help on using the changeset viewer.