Log Message
[WK1] iframes in layer-backed NSViews are not cleared between successive draws https://bugs.webkit.org/show_bug.cgi?id=172554 <rdar://problem/31247133>
Reviewed by Simon Fraser. Source/WebKit/mac: Update an overridden internal AppKit function to the new signature. * WebView/WebHTMLView.mm: (-[WebHTMLView _recursive:displayRectIgnoringOpacity:inContext:shouldChangeFontReferenceColor:_recursive:displayRectIgnoringOpacity:inContext:topView:]): (-[WebHTMLView _recursive:displayRectIgnoringOpacity:inGraphicsContext:CGContext:shouldChangeFontReferenceColor:_recursive:displayRectIgnoringOpacity:inGraphicsContext:CGContext:topView:shouldChangeFontReferenceColor:]): (-[WebHTMLView _recursive:displayRectIgnoringOpacity:inContext:topView:]): Deleted. (-[WebHTMLView _recursive:displayRectIgnoringOpacity:inGraphicsContext:CGContext:topView:shouldChangeFontReferenceColor:]): Deleted. Tools: Previously, there was no way to make DumpRenderTree's views layer-backed. Unfortunately, simply setting [WebView setWantsLayer:] is insufficient; turning it on and then off again leaves some state around inside the NSWindow which isn't easily cleaned up. Instead, we should just tear down and rebuild the window whenever we need a layer-backed WebView. We can also use the "webkit-test-runner" header comment to trigger this new layer-backed codepath. * DumpRenderTree/TestOptions.h: * DumpRenderTree/TestOptions.mm: (TestOptions::TestOptions): (TestOptions::webViewIsCompatibleWithOptions): * DumpRenderTree/mac/DumpRenderTree.mm: (shouldIgnoreWebCoreNodeLeaks): (allowedFontFamilySet): (-[DRTMockScroller rectForPart:]): (-[DRTMockScroller drawKnob]): (-[DRTMockScroller drawRect:]): (createWebViewAndOffscreenWindow): (initializeGlobalsFromCommandLineOptions): (prepareConsistentTestingEnvironment): (dumpRenderTree): (dumpAudio): (dumpHistoryItem): (dumpBackForwardListForWebView): (resetWebViewToConsistentStateBeforeTesting): (WebThreadLockAfterDelegateCallbacksHaveCompleted): (runTest): LayoutTests: Cause two successive paints, and compare it against 0 paints. * fast/frames/iframe-translucent-background-expected.html: Added. * fast/frames/iframe-translucent-background.html: Added.
Modified Paths
- trunk/LayoutTests/ChangeLog
- trunk/Source/WebKit/mac/ChangeLog
- trunk/Source/WebKit/mac/WebView/WebHTMLView.mm
- trunk/Tools/ChangeLog
- trunk/Tools/DumpRenderTree/TestOptions.h
- trunk/Tools/DumpRenderTree/TestOptions.mm
- trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (217460 => 217461)
--- trunk/LayoutTests/ChangeLog 2017-05-26 00:29:58 UTC (rev 217460)
+++ trunk/LayoutTests/ChangeLog 2017-05-26 00:42:58 UTC (rev 217461)
@@ -1,3 +1,16 @@
+2017-05-25 Myles C. Maxfield <mmaxfi...@apple.com>
+
+ [WK1] iframes in layer-backed NSViews are not cleared between successive draws
+ https://bugs.webkit.org/show_bug.cgi?id=172554
+ <rdar://problem/31247133>
+
+ Reviewed by Simon Fraser.
+
+ Cause two successive paints, and compare it against 0 paints.
+
+ * fast/frames/iframe-translucent-background-expected.html: Added.
+ * fast/frames/iframe-translucent-background.html: Added.
+
2017-05-25 Keith Miller <keith_mil...@apple.com>
Date should use historical data if it's available.
Added: trunk/LayoutTests/fast/frames/iframe-translucent-background-expected.html (0 => 217461)
--- trunk/LayoutTests/fast/frames/iframe-translucent-background-expected.html (rev 0)
+++ trunk/LayoutTests/fast/frames/iframe-translucent-background-expected.html 2017-05-26 00:42:58 UTC (rev 217461)
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+<p>This test makes sure that iframes with translucent backgrounds are drawn with those background (and not just as black). The test passes if you don't see any black boxes below and the text has correct antialiasing.</p>
+<div style="border: 0px; width: 200px; height: 200px; background-color: rgba(0, 0, 128, 0.25);">Hello World <a href=''>link</a> here.</div>
+</body>
+</html>
+
Added: trunk/LayoutTests/fast/frames/iframe-translucent-background.html (0 => 217461)
--- trunk/LayoutTests/fast/frames/iframe-translucent-background.html (rev 0)
+++ trunk/LayoutTests/fast/frames/iframe-translucent-background.html 2017-05-26 00:42:58 UTC (rev 217461)
@@ -0,0 +1,41 @@
+<!-- webkit-test-runner [ layerBackedWebView=true ] -->
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+<p>This test makes sure that iframes with translucent backgrounds are drawn with those background (and not just as black). The test passes if you don't see any black boxes below and the text has correct antialiasing.</p>
+<script>
+if (window.testRunner)
+ testRunner.waitUntilDone();
+function b() {
+ if (window.testRunner)
+ testRunner.notifyDone();
+}
+</script>
+<div style="width: 200px; height: 200px; overflow: hidden;">
+<iframe style="border: 0px; width: 200px; height: 200px;" srcdoc="<!DOCTYPE html>
+ <html>
+ <head>
+ </head>
+ <body style='background-color: rgba(0, 0, 128, 0.25); margin: 0px;'>
+ <div id='target'>Hello World <a href=''>link</a> here.</div>
+ <script>
+ window.setTimeout(function() {
+ var target = document.getElementById('target');
+ var range = document.createRange();
+ range.selectNodeContents(target);
+ window.getSelection().addRange(range);
+ window.setTimeout(function() {
+ window.getSelection().removeAllRanges();
+ window.parent.b();
+ }, 0);
+ }, 0);
+ </script>
+ </body>
+ </html>"></iframe>
+<div style="background: red; transform-origin: left top; transform: perspective(600px) rotateY(-50deg); width: 200px; height: 200px;">Hello, World</div>
+</div>
+</body>
+</html>
+
Modified: trunk/Source/WebKit/mac/ChangeLog (217460 => 217461)
--- trunk/Source/WebKit/mac/ChangeLog 2017-05-26 00:29:58 UTC (rev 217460)
+++ trunk/Source/WebKit/mac/ChangeLog 2017-05-26 00:42:58 UTC (rev 217461)
@@ -1,3 +1,19 @@
+2017-05-25 Myles C. Maxfield <mmaxfi...@apple.com>
+
+ [WK1] iframes in layer-backed NSViews are not cleared between successive draws
+ https://bugs.webkit.org/show_bug.cgi?id=172554
+ <rdar://problem/31247133>
+
+ Reviewed by Simon Fraser.
+
+ Update an overridden internal AppKit function to the new signature.
+
+ * WebView/WebHTMLView.mm:
+ (-[WebHTMLView _recursive:displayRectIgnoringOpacity:inContext:shouldChangeFontReferenceColor:_recursive:displayRectIgnoringOpacity:inContext:topView:]):
+ (-[WebHTMLView _recursive:displayRectIgnoringOpacity:inGraphicsContext:CGContext:shouldChangeFontReferenceColor:_recursive:displayRectIgnoringOpacity:inGraphicsContext:CGContext:topView:shouldChangeFontReferenceColor:]):
+ (-[WebHTMLView _recursive:displayRectIgnoringOpacity:inContext:topView:]): Deleted.
+ (-[WebHTMLView _recursive:displayRectIgnoringOpacity:inGraphicsContext:CGContext:topView:shouldChangeFontReferenceColor:]): Deleted.
+
2017-05-24 Jer Noble <jer.no...@apple.com>
Rename DisplaySleepDisabler -> SleepDisabler
Modified: trunk/Source/WebKit/mac/WebView/WebHTMLView.mm (217460 => 217461)
--- trunk/Source/WebKit/mac/WebView/WebHTMLView.mm 2017-05-26 00:29:58 UTC (rev 217460)
+++ trunk/Source/WebKit/mac/WebView/WebHTMLView.mm 2017-05-26 00:42:58 UTC (rev 217461)
@@ -684,10 +684,15 @@
@interface NSView (WebNSViewDetails)
- (void)_recursiveDisplayRectIfNeededIgnoringOpacity:(NSRect)rect isVisibleRect:(BOOL)isVisibleRect rectIsVisibleRectForView:(NSView *)visibleView topView:(BOOL)topView;
- (void)_recursiveDisplayAllDirtyWithLockFocus:(BOOL)needsLockFocus visRect:(NSRect)visRect;
-#if !PLATFORM(IOS)
+#if PLATFORM(MAC)
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101300
+- (void)_recursive:(BOOL)recurse displayRectIgnoringOpacity:(NSRect)displayRect inContext:(NSGraphicsContext *)context shouldChangeFontReferenceColor:(BOOL)shouldChangeFontReferenceColor;
+- (void)_recursive:(BOOL)recurseX displayRectIgnoringOpacity:(NSRect)displayRect inGraphicsContext:(NSGraphicsContext *)graphicsContext CGContext:(CGContextRef)ctx shouldChangeFontReferenceColor:(BOOL)shouldChangeFontReferenceColor;
+#else
- (void)_recursive:(BOOL)recurse displayRectIgnoringOpacity:(NSRect)displayRect inContext:(NSGraphicsContext *)context topView:(BOOL)topView;
- (void)_recursive:(BOOL)recurseX displayRectIgnoringOpacity:(NSRect)displayRect inGraphicsContext:(NSGraphicsContext *)graphicsContext CGContext:(CGContextRef)ctx topView:(BOOL)isTopView shouldChangeFontReferenceColor:(BOOL)shouldChangeFontReferenceColor;
#endif
+#endif
- (NSRect)_dirtyRect;
- (void)_setDrawsOwnDescendants:(BOOL)drawsOwnDescendants;
- (BOOL)_drawnByAncestor;
@@ -1836,15 +1841,27 @@
}
// Don't let AppKit even draw subviews. We take care of that.
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101300
+- (void)_recursive:(BOOL)recurse displayRectIgnoringOpacity:(NSRect)displayRect inContext:(NSGraphicsContext *)context shouldChangeFontReferenceColor:(BOOL)shouldChangeFontReferenceColor
+#else
- (void)_recursive:(BOOL)recurse displayRectIgnoringOpacity:(NSRect)displayRect inContext:(NSGraphicsContext *)context topView:(BOOL)topView
+#endif
{
[self _setAsideSubviews];
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101300
+ [super _recursive:recurse displayRectIgnoringOpacity:displayRect inContext:context shouldChangeFontReferenceColor:shouldChangeFontReferenceColor];
+#else
[super _recursive:recurse displayRectIgnoringOpacity:displayRect inContext:context topView:topView];
+#endif
[self _restoreSubviews];
}
// Don't let AppKit even draw subviews. We take care of that.
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101300
+- (void)_recursive:(BOOL)recurseX displayRectIgnoringOpacity:(NSRect)displayRect inGraphicsContext:(NSGraphicsContext *)graphicsContext CGContext:(CGContextRef)ctx shouldChangeFontReferenceColor:(BOOL)shouldChangeFontReferenceColor
+#else
- (void)_recursive:(BOOL)recurseX displayRectIgnoringOpacity:(NSRect)displayRect inGraphicsContext:(NSGraphicsContext *)graphicsContext CGContext:(CGContextRef)ctx topView:(BOOL)isTopView shouldChangeFontReferenceColor:(BOOL)shouldChangeFontReferenceColor
+#endif
{
BOOL didSetAsideSubviews = NO;
@@ -1853,7 +1870,11 @@
didSetAsideSubviews = YES;
}
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101300
+ [super _recursive:recurseX displayRectIgnoringOpacity:displayRect inGraphicsContext:graphicsContext CGContext:ctx shouldChangeFontReferenceColor:shouldChangeFontReferenceColor];
+#else
[super _recursive:recurseX displayRectIgnoringOpacity:displayRect inGraphicsContext:graphicsContext CGContext:ctx topView:isTopView shouldChangeFontReferenceColor:shouldChangeFontReferenceColor];
+#endif
if (didSetAsideSubviews)
[self _restoreSubviews];
Modified: trunk/Tools/ChangeLog (217460 => 217461)
--- trunk/Tools/ChangeLog 2017-05-26 00:29:58 UTC (rev 217460)
+++ trunk/Tools/ChangeLog 2017-05-26 00:42:58 UTC (rev 217461)
@@ -1,3 +1,39 @@
+2017-05-25 Myles C. Maxfield <mmaxfi...@apple.com>
+
+ [WK1] iframes in layer-backed NSViews are not cleared between successive draws
+ https://bugs.webkit.org/show_bug.cgi?id=172554
+ <rdar://problem/31247133>
+
+ Reviewed by Simon Fraser.
+
+ Previously, there was no way to make DumpRenderTree's views layer-backed. Unfortunately,
+ simply setting [WebView setWantsLayer:] is insufficient; turning it on and then off again
+ leaves some state around inside the NSWindow which isn't easily cleaned up. Instead,
+ we should just tear down and rebuild the window whenever we need a layer-backed WebView.
+ We can also use the "webkit-test-runner" header comment to trigger this new layer-backed
+ codepath.
+
+ * DumpRenderTree/TestOptions.h:
+ * DumpRenderTree/TestOptions.mm:
+ (TestOptions::TestOptions):
+ (TestOptions::webViewIsCompatibleWithOptions):
+ * DumpRenderTree/mac/DumpRenderTree.mm:
+ (shouldIgnoreWebCoreNodeLeaks):
+ (allowedFontFamilySet):
+ (-[DRTMockScroller rectForPart:]):
+ (-[DRTMockScroller drawKnob]):
+ (-[DRTMockScroller drawRect:]):
+ (createWebViewAndOffscreenWindow):
+ (initializeGlobalsFromCommandLineOptions):
+ (prepareConsistentTestingEnvironment):
+ (dumpRenderTree):
+ (dumpAudio):
+ (dumpHistoryItem):
+ (dumpBackForwardListForWebView):
+ (resetWebViewToConsistentStateBeforeTesting):
+ (WebThreadLockAfterDelegateCallbacksHaveCompleted):
+ (runTest):
+
2017-05-25 Sam Weinig <s...@webkit.org>
[WebIDL] Use the term 'operation' more consistently
Modified: trunk/Tools/DumpRenderTree/TestOptions.h (217460 => 217461)
--- trunk/Tools/DumpRenderTree/TestOptions.h 2017-05-26 00:29:58 UTC (rev 217460)
+++ trunk/Tools/DumpRenderTree/TestOptions.h 2017-05-26 00:42:58 UTC (rev 217461)
@@ -34,6 +34,8 @@
bool enablePointerLock { false };
bool enableCredentialManagement { false };
bool enableDragDestinationActionLoad { false };
+ bool layerBackedWebView { false };
TestOptions(NSURL*, const TestCommand&);
+ bool webViewIsCompatibleWithOptions(const TestOptions&) const;
};
Modified: trunk/Tools/DumpRenderTree/TestOptions.mm (217460 => 217461)
--- trunk/Tools/DumpRenderTree/TestOptions.mm 2017-05-26 00:29:58 UTC (rev 217460)
+++ trunk/Tools/DumpRenderTree/TestOptions.mm 2017-05-26 00:42:58 UTC (rev 217461)
@@ -90,6 +90,13 @@
this->enableCredentialManagement = parseBooleanTestHeaderValue(value);
else if (key == "enableDragDestinationActionLoad")
this->enableDragDestinationActionLoad = parseBooleanTestHeaderValue(value);
+ else if (key == "layerBackedWebView")
+ this->layerBackedWebView = parseBooleanTestHeaderValue(value);
pairStart = pairEnd + 1;
}
}
+
+bool TestOptions::webViewIsCompatibleWithOptions(const TestOptions& other) const
+{
+ return other.layerBackedWebView == layerBackedWebView;
+}
Modified: trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm (217460 => 217461)
--- trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm 2017-05-26 00:29:58 UTC (rev 217460)
+++ trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm 2017-05-26 00:42:58 UTC (rev 217461)
@@ -180,6 +180,7 @@
NavigationController* gNavigationController = nullptr;
RefPtr<TestRunner> gTestRunner;
+std::optional<TestOptions> mainFrameTestOptions;
WebFrame *mainFrame = nil;
// This is the topmost frame that is loading, during a given load, or nil when no load is
// in progress. Usually this is the same as the main frame, but not always. In the case
@@ -290,7 +291,7 @@
// Keeping this infrastructure around in case we ever need it again.
};
static const int ignoreSetCount = sizeof(ignoreSet) / sizeof(char*);
-
+
for (int i = 0; i < ignoreSetCount; i++) {
// FIXME: ignore case
string curIgnore(ignoreSet[i]);
@@ -425,7 +426,7 @@
@"Zapf Dingbats",
@"Zapfino",
nil] retain];
-
+
return fontFamilySet;
}
@@ -647,7 +648,7 @@
CGFloat minKnobSize = isHorizontal ? bounds.size.height : bounds.size.width;
CGFloat knobLength = max(minKnobSize, static_cast<CGFloat>(round(trackLength * [self knobProportion])));
CGFloat knobPosition = static_cast<CGFloat>((round([self doubleValue] * (trackLength - knobLength))));
-
+
if (isHorizontal)
return NSMakeRect(bounds.origin.x + knobPosition, bounds.origin.y, knobLength, bounds.size.height);
@@ -660,7 +661,7 @@
return;
NSRect knobRect = [self rectForPart:NSScrollerKnob];
-
+
static NSColor *knobColor = [[NSColor colorWithDeviceRed:0x80 / 255.0 green:0x80 / 255.0 blue:0x80 / 255.0 alpha:1] retain];
[knobColor set];
@@ -678,7 +679,7 @@
[disabledTrackColor set];
NSRectFill(dirtyRect);
-
+
[self drawKnob];
}
@@ -714,7 +715,7 @@
[WebView registerURLSchemeAsLocal:@"feed"];
[WebView registerURLSchemeAsLocal:@"feeds"];
[WebView registerURLSchemeAsLocal:@"feedsearch"];
-
+
#if PLATFORM(MAC)
[WebView _setFontWhitelist:fontWhitelist()];
#endif
@@ -731,7 +732,7 @@
[webView setDefersCallbacks:NO];
[webView setInteractiveFormValidationEnabled:YES];
[webView setValidationMessageTimerMagnification:-1];
-
+
// To make things like certain NSViews, dragging, and plug-ins work, put the WebView a window, but put it off-screen so you don't see it.
// Put it at -10000, -10000 in "flipped coordinates", since WebCore and the DOM use flipped coordinates.
NSScreen *firstScreen = [[NSScreen screens] firstObject];
@@ -776,7 +777,7 @@
adjustWebDocumentForStandardViewport(webBrowserView, scrollView);
#endif
-
+
#if !PLATFORM(IOS)
// For reasons that are not entirely clear, the following pair of calls makes WebView handle its
// dynamic scrollbars properly. Without it, every frame will always have scrollbars.
@@ -1128,7 +1129,7 @@
{"print-test-count", no_argument, &printTestCount, YES},
{nullptr, 0, nullptr, 0}
};
-
+
int option;
while ((option = getopt_long(argc, (char * const *)argv, "", options, nullptr)) != -1) {
switch (option) {
@@ -1211,9 +1212,9 @@
#else
activateFontsIOS();
#endif
-
+
allocateGlobalControllers();
-
+
#if PLATFORM(MAC)
NSActivityOptions options = (NSActivityUserInitiatedAllowingIdleSystemSleep | NSActivityLatencyCritical) & ~(NSActivitySuddenTerminationDisabled | NSActivityAutomaticTerminationDisabled);
static id assertion = [[[NSProcessInfo processInfo] beginActivityWithOptions:options reason:@"DumpRenderTree should not be subject to process suppression"] retain];
@@ -1257,9 +1258,6 @@
[NSSound _setAlertType:0];
#endif
- WebView *webView = createWebViewAndOffscreenWindow();
- mainFrame = [webView mainFrame];
-
[[NSURLCache sharedURLCache] removeAllCachedResponses];
[WebCache empty];
@@ -1284,10 +1282,10 @@
if (threaded)
stopJavaScriptThreads();
- destroyWebViewAndOffscreenWindow(webView);
-
+ destroyWebViewAndOffscreenWindow([mainFrame webView]);
+
releaseGlobalControllers();
-
+
#if !PLATFORM(IOS)
[DumpRenderTreePasteboard releaseLocalPasteboards];
#endif
@@ -1406,7 +1404,7 @@
static NSData *dumpAudio()
{
const vector<char>& dataVector = gTestRunner->audioResult();
-
+
NSData *data = "" dataWithBytes:dataVector.data() length:dataVector.size()];
return data;
}
@@ -1420,13 +1418,13 @@
}
for (int i = start; i < indent; i++)
putchar(' ');
-
+
NSString *urlString = [item URLString];
if ([[NSURL URLWithString:urlString] isFileURL]) {
NSRange range = [urlString rangeOfString:@"/LayoutTests/"];
urlString = [@"(file test):" stringByAppendingString:[urlString substringFromIndex:(range.length + range.location)]];
}
-
+
printf("%s", [urlString UTF8String]);
NSString *target = [item target];
if (target && [target length] > 0)
@@ -1551,7 +1549,7 @@
assert(item != prevTestBFItem);
[itemsToPrint addObject:item];
}
-
+
assert([bfList currentItem] != prevTestBFItem);
[itemsToPrint addObject:[bfList currentItem]];
int currentItemIndex = [itemsToPrint count] - 1;
@@ -1810,9 +1808,12 @@
[webView setTracksRepaints:NO];
[WebCache clearCachedCredentials];
-
+
resetWebPreferencesToConsistentValues();
setWebPreferencesForTestOptions(options);
+#if PLATFORM(MAC)
+ [webView setWantsLayer:options.layerBackedWebView];
+#endif
TestRunner::setSerializeHTTPLoads(false);
TestRunner::setAllowsAnySSLCertificate(false);
@@ -1845,7 +1846,7 @@
[[MockGeolocationProvider shared] stopTimer];
[[MockWebNotificationProvider shared] reset];
-
+
#if !PLATFORM(IOS)
// Clear the contents of the general pasteboard
[[NSPasteboard generalPasteboard] declareTypes:[NSArray arrayWithObject:NSStringPboardType] owner:nil];
@@ -1879,7 +1880,7 @@
}
WebThreadLock();
-
+
dispatch_release(delegateSemaphore);
}
#endif
@@ -1949,6 +1950,14 @@
WKSetCrashReportApplicationSpecificInformation((CFStringRef)informationString);
TestOptions options(url, command);
+ if (!mainFrameTestOptions || !options.webViewIsCompatibleWithOptions(mainFrameTestOptions.value())) {
+ if (mainFrame)
+ destroyWebViewAndOffscreenWindow([mainFrame webView]);
+ WebView *pristineWebView = createWebViewAndOffscreenWindow();
+ mainFrame = [pristineWebView mainFrame];
+ }
+ mainFrameTestOptions = options;
+
resetWebViewToConsistentStateBeforeTesting(options);
const char* testURL([[url absoluteString] UTF8String]);
@@ -2056,7 +2065,7 @@
// Don't try to close the main window
if (window == [[mainFrame webView] window])
continue;
-
+
#if !PLATFORM(IOS)
WebView *webView = [[[window contentView] subviews] objectAtIndex:0];
#else
_______________________________________________ webkit-changes mailing list webkit-changes@lists.webkit.org https://lists.webkit.org/mailman/listinfo/webkit-changes