Diff
Modified: trunk/LayoutTests/ChangeLog (239148 => 239149)
--- trunk/LayoutTests/ChangeLog 2018-12-13 03:21:51 UTC (rev 239148)
+++ trunk/LayoutTests/ChangeLog 2018-12-13 03:54:13 UTC (rev 239149)
@@ -1,3 +1,16 @@
+2018-12-12 Ryosuke Niwa <[email protected]>
+
+ Make TextInputController.legacyAttributedString take DOM nodes and offsets
+ https://bugs.webkit.org/show_bug.cgi?id=192653
+
+ Reviewed by Wenson Hsieh.
+
+ 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 <[email protected]>
REGRESSION (r238357): Pins on Yelp map disappear
Modified: trunk/LayoutTests/editing/mac/attributed-string/attribute-string-for-copy-with-color-filter.html (239148 => 239149)
--- trunk/LayoutTests/editing/mac/attributed-string/attribute-string-for-copy-with-color-filter.html 2018-12-13 03:21:51 UTC (rev 239148)
+++ trunk/LayoutTests/editing/mac/attributed-string/attribute-string-for-copy-with-color-filter.html 2018-12-13 03:54:13 UTC (rev 239149)
@@ -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);
Modified: trunk/LayoutTests/editing/mac/attributed-string/resources/dump-attributed-string.js (239148 => 239149)
--- trunk/LayoutTests/editing/mac/attributed-string/resources/dump-attributed-string.js 2018-12-13 03:21:51 UTC (rev 239148)
+++ trunk/LayoutTests/editing/mac/attributed-string/resources/dump-attributed-string.js 2018-12-13 03:54:13 UTC (rev 239149)
@@ -15,7 +15,8 @@
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);
Modified: trunk/Source/WebCore/ChangeLog (239148 => 239149)
--- trunk/Source/WebCore/ChangeLog 2018-12-13 03:21:51 UTC (rev 239148)
+++ trunk/Source/WebCore/ChangeLog 2018-12-13 03:54:13 UTC (rev 239149)
@@ -1,3 +1,18 @@
+2018-12-13 Ryosuke Niwa <[email protected]>
+
+ Make TextInputController.legacyAttributedString take DOM nodes and offsets
+ https://bugs.webkit.org/show_bug.cgi?id=192653
+
+ Reviewed by Wenson Hsieh.
+
+ 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 <[email protected]>
Fix macOS builds after r239145.
Modified: trunk/Source/WebCore/editing/cocoa/HTMLConverter.h (239148 => 239149)
--- trunk/Source/WebCore/editing/cocoa/HTMLConverter.h 2018-12-13 03:21:51 UTC (rev 239148)
+++ trunk/Source/WebCore/editing/cocoa/HTMLConverter.h 2018-12-13 03:54:13 UTC (rev 239149)
@@ -28,7 +28,8 @@
OBJC_CLASS NSAttributedString;
namespace WebCore {
-
+
+class Position;
class Range;
class VisibleSelection;
@@ -35,6 +36,10 @@
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);
Modified: trunk/Source/WebCore/editing/cocoa/HTMLConverter.mm (239148 => 239149)
--- trunk/Source/WebCore/editing/cocoa/HTMLConverter.mm 2018-12-13 03:21:51 UTC (rev 239148)
+++ trunk/Source/WebCore/editing/cocoa/HTMLConverter.mm 2018-12-13 03:54:13 UTC (rev 239149)
@@ -2467,8 +2467,13 @@
{
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)
Modified: trunk/Source/WebKitLegacy/mac/ChangeLog (239148 => 239149)
--- trunk/Source/WebKitLegacy/mac/ChangeLog 2018-12-13 03:21:51 UTC (rev 239148)
+++ trunk/Source/WebKitLegacy/mac/ChangeLog 2018-12-13 03:54:13 UTC (rev 239149)
@@ -1,3 +1,13 @@
+2018-12-12 Ryosuke Niwa <[email protected]>
+
+ Make TextInputController.legacyAttributedString take DOM nodes and offsets
+ https://bugs.webkit.org/show_bug.cgi?id=192653
+
+ Reviewed by Wenson Hsieh.
+
+ * WebView/WebHTMLView.mm:
+ (-[WebHTMLView _legacyAttributedStringFrom:offset:to:offset:]):
+
2018-12-11 Justin Michaud <[email protected]>
Implement feature flag for CSS Typed OM
Modified: trunk/Source/WebKitLegacy/mac/WebView/WebHTMLView.mm (239148 => 239149)
--- trunk/Source/WebKitLegacy/mac/WebView/WebHTMLView.mm 2018-12-13 03:21:51 UTC (rev 239148)
+++ trunk/Source/WebKitLegacy/mac/WebView/WebHTMLView.mm 2018-12-13 03:54:13 UTC (rev 239149)
@@ -7032,6 +7032,13 @@
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];
Modified: trunk/Tools/ChangeLog (239148 => 239149)
--- trunk/Tools/ChangeLog 2018-12-13 03:21:51 UTC (rev 239148)
+++ trunk/Tools/ChangeLog 2018-12-13 03:54:13 UTC (rev 239149)
@@ -1,3 +1,20 @@
+2018-12-12 Ryosuke Niwa <[email protected]>
+
+ Make TextInputController.legacyAttributedString take DOM nodes and offsets
+ https://bugs.webkit.org/show_bug.cgi?id=192653
+
+ Reviewed by Wenson Hsieh.
+
+ 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 <[email protected]>
Implement safe browsing in WebKit on WatchOS
Modified: trunk/Tools/DumpRenderTree/mac/TextInputControllerMac.m (239148 => 239149)
--- trunk/Tools/DumpRenderTree/mac/TextInputControllerMac.m 2018-12-13 03:21:51 UTC (rev 239148)
+++ trunk/Tools/DumpRenderTree/mac/TextInputControllerMac.m 2018-12-13 03:54:13 UTC (rev 239149)
@@ -64,6 +64,7 @@
@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 @@
|| 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 @@
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 @@
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