WebKit Bugzilla
Attachment 357206 Details for
Bug 192653
: Make TextInputController.legacyAttributedString take DOM nodes and offsets
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Reverted the unrelated change
bug-192653-20181212193957.patch (text/plain), 10.30 KB, created by
Ryosuke Niwa
on 2018-12-12 19:39:57 PST
(
hide
)
Description:
Reverted the unrelated change
Filename:
MIME Type:
Creator:
Ryosuke Niwa
Created:
2018-12-12 19:39:57 PST
Size:
10.30 KB
patch
obsolete
>Index: Source/WebCore/ChangeLog >=================================================================== >--- Source/WebCore/ChangeLog (revision 239148) >+++ Source/WebCore/ChangeLog (working copy) >@@ -1,3 +1,18 @@ >+2018-12-13 Ryosuke Niwa <rniwa@webkit.org> >+ >+ Make TextInputController.legacyAttributedString take DOM nodes and offsets >+ https://bugs.webkit.org/show_bug.cgi?id=192653 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ No new tests since there should be no observable behavioral change other than >+ TextInputController API in DumpRenderTree. >+ >+ * editing/cocoa/HTMLConverter.h: >+ * editing/cocoa/HTMLConverter.mm: >+ (WebCore::attributedStringFromSelection): >+ (WebCore::attributedStringBetweenStartAndEnd): Added. >+ > 2018-12-12 Ryosuke Niwa <rniwa@webkit.org> > > Fix macOS builds after r239145. >Index: Source/WebCore/editing/cocoa/HTMLConverter.h >=================================================================== >--- Source/WebCore/editing/cocoa/HTMLConverter.h (revision 239148) >+++ Source/WebCore/editing/cocoa/HTMLConverter.h (working copy) >@@ -28,13 +28,18 @@ > OBJC_CLASS NSAttributedString; > > namespace WebCore { >- >+ >+class Position; > class Range; > class VisibleSelection; > > enum class IncludeImagesInAttributedString { Yes, No }; > > NSAttributedString *attributedStringFromSelection(const VisibleSelection&); >+ >+// For testing purpose only >+WEBCORE_EXPORT NSAttributedString *attributedStringBetweenStartAndEnd(const Position&, const Position&); >+ > WEBCORE_EXPORT NSAttributedString *attributedStringFromRange(Range&); > #if !PLATFORM(IOS_FAMILY) > WEBCORE_EXPORT NSAttributedString *editingAttributedStringFromRange(Range&, IncludeImagesInAttributedString = IncludeImagesInAttributedString::Yes); >Index: Source/WebCore/editing/cocoa/HTMLConverter.mm >=================================================================== >--- Source/WebCore/editing/cocoa/HTMLConverter.mm (revision 239148) >+++ Source/WebCore/editing/cocoa/HTMLConverter.mm (working copy) >@@ -2467,7 +2467,12 @@ NSAttributedString *attributedStringFrom > { > auto range = selection.toNormalizedRange(); > ASSERT(range); >- return HTMLConverter { range->startPosition(), range->endPosition() }.convert(); >+ return attributedStringBetweenStartAndEnd(range->startPosition(), range->endPosition()); >+} >+ >+NSAttributedString *attributedStringBetweenStartAndEnd(const Position& start, const Position& end) >+{ >+ return HTMLConverter { start, end }.convert(); > } > > #if !PLATFORM(IOS_FAMILY) >Index: Source/WebKitLegacy/mac/ChangeLog >=================================================================== >--- Source/WebKitLegacy/mac/ChangeLog (revision 239148) >+++ Source/WebKitLegacy/mac/ChangeLog (working copy) >@@ -1,3 +1,13 @@ >+2018-12-12 Ryosuke Niwa <rniwa@webkit.org> >+ >+ Make TextInputController.legacyAttributedString take DOM nodes and offsets >+ https://bugs.webkit.org/show_bug.cgi?id=192653 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * WebView/WebHTMLView.mm: >+ (-[WebHTMLView _legacyAttributedStringFrom:offset:to:offset:]): >+ > 2018-12-11 Justin Michaud <justin_michaud@apple.com> > > Implement feature flag for CSS Typed OM >Index: Source/WebKitLegacy/mac/WebView/WebHTMLView.mm >=================================================================== >--- Source/WebKitLegacy/mac/WebView/WebHTMLView.mm (revision 239148) >+++ Source/WebKitLegacy/mac/WebView/WebHTMLView.mm (working copy) >@@ -7032,6 +7032,13 @@ - (NSAttributedString *)_attributedStrin > return attributedString; > } > >+- (NSAttributedString *)_legacyAttributedStringFrom:(DOMNode*)startContainer offset:(int)startOffset to:(DOMNode*)endContainer offset:(int)endOffset >+{ >+ return attributedStringBetweenStartAndEnd( >+ Position { core(startContainer), startOffset, Position::PositionIsOffsetInAnchor }, >+ Position { core(endContainer), endOffset, Position::PositionIsOffsetInAnchor }); >+} >+ > - (NSAttributedString *)attributedString > { > DOMDocument *document = [[self _frame] DOMDocument]; >Index: Tools/ChangeLog >=================================================================== >--- Tools/ChangeLog (revision 239148) >+++ Tools/ChangeLog (working copy) >@@ -1,3 +1,20 @@ >+2018-12-12 Ryosuke Niwa <rniwa@webkit.org> >+ >+ Make TextInputController.legacyAttributedString take DOM nodes and offsets >+ https://bugs.webkit.org/show_bug.cgi?id=192653 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Updated TextInputController.legacyAttributedString to take DOM nodes and offsets instead of >+ a DOM Range object in preparation to add layout tests for HTMLConverter which crosses >+ shadow boundaries. >+ >+ * DumpRenderTree/mac/TextInputControllerMac.m: >+ (+[TextInputController isSelectorExcludedFromWebScript:]): Updated the selector signature. >+ (+[TextInputController webScriptNameForSelector:]): Ditto. >+ (-[TextInputController legacyAttributedString:offset:to:offset:]): Made this function take >+ start node and offset then end node and offset pairs. >+ > 2018-12-12 Alex Christensen <achristensen@webkit.org> > > Implement safe browsing in WebKit on WatchOS >Index: Tools/DumpRenderTree/mac/TextInputControllerMac.m >=================================================================== >--- Tools/DumpRenderTree/mac/TextInputControllerMac.m (revision 239148) >+++ Tools/DumpRenderTree/mac/TextInputControllerMac.m (working copy) >@@ -64,6 +64,7 @@ - (void)interpretKeyEvents:(NSArray *)ev > @interface WebHTMLView (WebKitSecretsTextInputControllerIsAwareOf) > - (WebFrame *)_frame; > - (NSAttributedString *)_attributedStringFromDOMRange:(DOMRange *)range; >+- (NSAttributedString *)_legacyAttributedStringFrom:(DOMNode*)startContainer offset:(int)startOffset to:(DOMNode*)endContainer offset:(int)endOffset; > @end > > @implementation WebHTMLView (DumpRenderTreeInputMethodHandler) >@@ -230,7 +231,7 @@ + (BOOL)isSelectorExcludedFromWebScript: > || aSelector == @selector(conversationIdentifier) > || aSelector == @selector(substringFrom:length:) > || aSelector == @selector(attributedSubstringFrom:length:) >- || aSelector == @selector(legacyAttributedString:) >+ || aSelector == @selector(legacyAttributedString:offset:to:offset:) > || aSelector == @selector(markedRange) > || aSelector == @selector(selectedRange) > || aSelector == @selector(firstRectForCharactersFrom:length:) >@@ -257,7 +258,7 @@ + (NSString *)webScriptNameForSelector:( > return @"substringFromRange"; > if (aSelector == @selector(attributedSubstringFrom:length:)) > return @"attributedSubstringFromRange"; >- if (aSelector == @selector(legacyAttributedString:)) >+ if (aSelector == @selector(legacyAttributedString:offset:to:offset:)) > return @"legacyAttributedString"; > if (aSelector == @selector(firstRectForCharactersFrom:length:)) > return @"firstRectForCharacterRange"; >@@ -372,15 +373,13 @@ - (NSMutableAttributedString *)attribute > return ret; > } > >-- (NSMutableAttributedString *)legacyAttributedString:(DOMRange*)range >+- (NSAttributedString *)legacyAttributedString:(DOMNode*)startContainer offset:(int)startOffset to:(DOMNode*)endContainer offset:(int)endOffset > { >- NSMutableAttributedString *string = [[[NSMutableAttributedString alloc] init] autorelease]; > id documentView = [[[webView mainFrame] frameView] documentView]; > if (![documentView isKindOfClass:[WebHTMLView class]]) >- return string; >+ return nil; > >- [string setAttributedString:[(WebHTMLView *)documentView _attributedStringFromDOMRange:range]]; >- return string; >+ return [(WebHTMLView *)documentView _legacyAttributedStringFrom:startContainer offset:startOffset to:endContainer offset:endOffset]; > } > > - (NSArray *)markedRange >Index: LayoutTests/ChangeLog >=================================================================== >--- LayoutTests/ChangeLog (revision 239148) >+++ LayoutTests/ChangeLog (working copy) >@@ -1,3 +1,16 @@ >+2018-12-12 Ryosuke Niwa <rniwa@webkit.org> >+ >+ Make TextInputController.legacyAttributedString take DOM nodes and offsets >+ https://bugs.webkit.org/show_bug.cgi?id=192653 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Updated the tests per API change. >+ >+ * editing/mac/attributed-string/attribute-string-for-copy-with-color-filter.html: >+ * editing/mac/attributed-string/resources/dump-attributed-string.js: >+ (dumpAttributedString): >+ > 2018-12-12 Simon Fraser <simon.fraser@apple.com> > > REGRESSION (r238357): Pins on Yelp map disappear >Index: LayoutTests/editing/mac/attributed-string/attribute-string-for-copy-with-color-filter.html >=================================================================== >--- LayoutTests/editing/mac/attributed-string/attribute-string-for-copy-with-color-filter.html (revision 239148) >+++ LayoutTests/editing/mac/attributed-string/attribute-string-for-copy-with-color-filter.html (working copy) >@@ -20,11 +20,7 @@ > var target = document.getElementById("target"); > target.focus(); > >- const range = new Range; >- range.setStart(target.firstChild, 2); >- range.setEnd(target.firstChild, 4); >- >- var attributedString = textInputController.legacyAttributedString(range); >+ var attributedString = textInputController.legacyAttributedString(target.firstChild, 2, target.firstChild, 4); > var serializedString = serializeAttributedString(attributedString); > log(serializedString); > >Index: LayoutTests/editing/mac/attributed-string/resources/dump-attributed-string.js >=================================================================== >--- LayoutTests/editing/mac/attributed-string/resources/dump-attributed-string.js (revision 239148) >+++ LayoutTests/editing/mac/attributed-string/resources/dump-attributed-string.js (working copy) >@@ -15,7 +15,8 @@ var shouldAutoDump = true; > range.selectNodeContents(container); > > var pre = document.createElement('pre'); >- pre.textContent = 'Input:\n' + container.innerHTML.trim() + '\n\nOutput:\n' + serializeAttributedString(textInputController.legacyAttributedString(range)); >+ var result = serializeAttributedString(textInputController.legacyAttributedString(container, 0, container, container.childNodes.length)); >+ pre.textContent = 'Input:\n' + container.innerHTML.trim() + '\n\nOutput:\n' + result; > > body.innerHTML = ''; > body.appendChild(pre);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
wenson_hsieh
:
review+
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 192653
:
357204
| 357206