Added: trunk/LayoutTests/ipc/set-text-indicator.html (0 => 271694)
--- trunk/LayoutTests/ipc/set-text-indicator.html (rev 0)
+++ trunk/LayoutTests/ipc/set-text-indicator.html 2021-01-21 17:17:40 UTC (rev 271694)
@@ -0,0 +1,10 @@
+<!DOCTYPE html><!-- webkit-test-runner [ IPCTestingAPIEnabled=true ] -->
+<html>
+Test passes if it does not crash.
+<script>
+if (window.testRunner)
+ testRunner.dumpAsText();
+if (window.IPC)
+ IPC.sendMessage('UI', IPC.webPageProxyID, IPC.messages.WebPageProxy_SetTextIndicator.name, [{type: 'float', value: 598}, {type: 'float', value: 352}, {type: 'float', value: 597}, {type: 'float', value: 948}, {type: 'float', value: 0}, {type: 'float', value: 942}, {type: 'float', value: 233}, {type: 'float', value: 310}, {type: 'Vector', value: [[{type: 'float', value: 0}, {type: 'float', value: 0}, {type: 'float', value: 0}, {type: 'float', value: 0}]]}, {type: 'float', value: 927}, {type: 'float', value: 705}, {type: 'float', value: 498}, {type: 'float', value: 830}, {type: 'float', value: 58}, {type: 'bool', value: 1}, {type: 'float', value: 341}, {type: 'float', value: 1204}, {type: 'float', value: 1292}, {type: 'float', value: 1074}, {type: 'uint8_t', value: 2}, {type: 'uint8_t', value: 2}, {type: 'uint16_t', value: 1}, {type: 'bool', value: 0}, {type: 'bool', value: 0}, {type: 'bool', value: 0}, {type: 'uint64_t', value: 1}]);
+</script>
+</html>
Modified: trunk/Source/WebCore/page/mac/TextIndicatorWindow.mm (271693 => 271694)
--- trunk/Source/WebCore/page/mac/TextIndicatorWindow.mm 2021-01-21 17:12:19 UTC (rev 271693)
+++ trunk/Source/WebCore/page/mac/TextIndicatorWindow.mm 2021-01-21 17:17:40 UTC (rev 271694)
@@ -159,13 +159,16 @@
self.wantsLayer = YES;
self.layer.anchorPoint = CGPointZero;
- FloatSize contentsImageLogicalSize = _textIndicator->contentImage()->size();
- contentsImageLogicalSize.scale(1 / _textIndicator->contentImageScaleFactor());
RefPtr<NativeImage> contentsImage;
- if (indicatorWantsContentCrossfade(*_textIndicator))
- contentsImage = _textIndicator->contentImageWithHighlight()->nativeImage();
- else
- contentsImage = _textIndicator->contentImage()->nativeImage();
+ FloatSize contentsImageLogicalSize { 1, 1 };
+ if (auto* contentImage = _textIndicator->contentImage()) {
+ contentsImageLogicalSize = contentImage->size();
+ contentsImageLogicalSize.scale(1 / _textIndicator->contentImageScaleFactor());
+ if (indicatorWantsContentCrossfade(*_textIndicator) && _textIndicator->contentImageWithHighlight())
+ contentsImage = _textIndicator->contentImageWithHighlight()->nativeImage();
+ else
+ contentsImage = contentImage->nativeImage();
+ }
RetainPtr<NSMutableArray> bounceLayers = adoptNS([[NSMutableArray alloc] init]);
@@ -229,7 +232,8 @@
[textLayer setBorderColor:borderColor.get()];
[textLayer setBorderWidth:borderWidth];
[textLayer setDelegate:[WebActionDisablingCALayerDelegate shared]];
- [textLayer setContents:(__bridge id)contentsImage->platformImage().get()];
+ if (contentsImage)
+ [textLayer setContents:(__bridge id)contentsImage->platformImage().get()];
RetainPtr<CAShapeLayer> maskLayer = adoptNS([[CAShapeLayer alloc] init]);
[maskLayer setPath:translatedPath.platformPath()];