Diff
Modified: trunk/LayoutTests/ChangeLog (200944 => 200945)
--- trunk/LayoutTests/ChangeLog 2016-05-16 17:22:13 UTC (rev 200944)
+++ trunk/LayoutTests/ChangeLog 2016-05-16 17:35:30 UTC (rev 200945)
@@ -1,3 +1,36 @@
+2016-05-16 Brent Fulgham <[email protected]>
+
+ REGRESSION (r192098): Content missing after copy and paste to Notes App on retina displays
+ https://bugs.webkit.org/show_bug.cgi?id=157630
+ <rdar://problem/25277577>
+
+ Reviewed by Simon Fraser.
+
+ * http/tests/images/hidpi-srcset-copy-expected.txt: Added.
+ * http/tests/images/hidpi-srcset-copy.html: Added.
+ * http/tests/resources/img-srcset: Added.
+ * http/tests/resources/img-srcset/image1-620x442.jpg: Added.
+ * http/tests/resources/img-srcset/image2-1024x731.jpg: Added.
+ * http/tests/resources/img-srcset/image2-1400x1000.jpg: Added.
+ * http/tests/resources/img-srcset/image2-300x214.jpg: Added.
+ * http/tests/resources/img-srcset/image2-620x442.jpg: Added.
+ * http/tests/resources/img-srcset/image2-840x600.jpg: Added.
+ * http/tests/resources/img-srcset/image3-250x178.jpg: Added.
+ * http/tests/resources/img-srcset/image3-615x438.jpg: Added.
+ * http/tests/resources/img-srcset/image3-620x440.jpg: Added.
+ * http/tests/resources/img-srcset/image3-700x498.jpg: Added.
+ * http/tests/resources/img-srcset/image3-840x598.jpg: Added.
+ * http/tests/resources/img-srcset/image3.jpg: Added.
+ * http/tests/resources/img-srcset/image4-1024x612.jpg: Added.
+ * http/tests/resources/img-srcset/image4-300x179.jpg: Added.
+ * http/tests/resources/img-srcset/image4-620x370.jpg: Added.
+ * http/tests/resources/img-srcset/image4-768x459.jpg: Added.
+ * http/tests/resources/img-srcset/image4-840x502.jpg: Added.
+ * http/tests/resources/img-srcset/image4-940x560.jpg: Added.
+ * platform/efl/TestExpectations: No pasteboard implementation. Skip.
+ * platform/gtk/TestExpectations: Ditto.
+ * platform/win/TestExpectations: Ditto.
+
2016-05-16 Joanmarie Diggs <[email protected]>
[GTK] Unreviewed gardening
Added: trunk/LayoutTests/http/tests/images/hidpi-srcset-copy-expected.txt (0 => 200945)
--- trunk/LayoutTests/http/tests/images/hidpi-srcset-copy-expected.txt (rev 0)
+++ trunk/LayoutTests/http/tests/images/hidpi-srcset-copy-expected.txt 2016-05-16 17:35:30 UTC (rev 200945)
@@ -0,0 +1,24 @@
+Tests that we get the correct number of images when copying under different display resolutions.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+PASS Found all 4 images at 1x Resolution.
+PASS Found all 4 images at 2x Resolution.
+PASS Found all 4 images at 3x Resolution.
+Image 1
+
+
+Image 2
+
+
+Image 3
+
+
+Image 4
+
+
+
Added: trunk/LayoutTests/http/tests/images/hidpi-srcset-copy.html (0 => 200945)
--- trunk/LayoutTests/http/tests/images/hidpi-srcset-copy.html (rev 0)
+++ trunk/LayoutTests/http/tests/images/hidpi-srcset-copy.html 2016-05-16 17:35:30 UTC (rev 200945)
@@ -0,0 +1,83 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+<script type="text/_javascript_">
+ description("Tests that we get the correct number of images when copying under different display resolutions.");
+
+ var pixelRatio = 1;
+
+ if (window.testRunner) {
+ testRunner.dumpAsText(true);
+ testRunner.waitUntilDone();
+ }
+
+ function doCopy()
+ {
+ document.execCommand("selectAll", true);
+ document.execCommand("copy");
+ }
+
+ function checkCount()
+ {
+ var imageCount = testRunner.imageCountInGeneralPasteboard();
+ if (imageCount == 4)
+ testPassed("Found all 4 images at " + pixelRatio + "x Resolution.");
+ else
+ testFailed("Only found " + imageCount + " images at " + pixelRatio + "x Resolution.");
+ }
+
+ function doTest()
+ {
+ doCopy();
+ checkCount();
+ if (pixelRatio < 3) {
+ pixelRatio = pixelRatio + 1;
+ testRunner.setBackingScaleFactor(pixelRatio, doTest);
+ } else {
+ setTimeout(function() { testRunner.notifyDone(); }, 0);
+ }
+ }
+
+ function runTests()
+ {
+ if (window.testRunner)
+ testRunner.setBackingScaleFactor(pixelRatio, doTest);
+ }
+</script>
+</head>
+<body _onLoad_="runTests()">
+ <div id="images">
+ <p>Image 1</p>
+ <img src=""
+ <p>Image 2</p>
+ <img src=""
+ srcset="http://127.0.0.1:8000/resources/img-srcset/image2-300x214.jpg 300w,
+ http://127.0.0.1:8000/resources/img-srcset/image2-1024x731.jpg 1024w,
+ http://127.0.0.1:8000/resources/img-srcset/image2-620x442.jpg 620w,
+ http://127.0.0.1:8000/resources/img-srcset/image2-840x600.jpg 840w,
+ http://127.0.0.1:8000/resources/img-srcset/image2-1400x1000.jpg 1400w"
+ sizes="(max-width: 1024px) 100vw, 1024px">
+ <p>Image 3</p>
+ <img src=""
+ srcset="http://127.0.0.1:8000/resources/img-srcset/image3-250x178.jpg 250w,
+ http://127.0.0.1:8000/resources/img-srcset/image3-700x498.jpg 700w,
+ http://127.0.0.1:8000/resources/img-srcset/image3-620x440.jpg 620w,
+ http://127.0.0.1:8000/resources/img-srcset/image3-615x438.jpg 615w,
+ http://127.0.0.1:8000/resources/img-srcset/image3-840x598.jpg 840w,
+ http://127.0.0.1:8000/resources/img-srcset/image3.jpg 1403w"
+ sizes="(max-width: 700px) 100vw, 700px">
+ <p>Image 4</p>
+ <img src=""
+ srcset="http://127.0.0.1:8000/resources/img-srcset/image4-300x179.jpg 300w,
+ http://127.0.0.1:8000/resources/img-srcset/image4-1024x612.jpg 1024w,
+ http://127.0.0.1:8000/resources/img-srcset/image4-620x370.jpg 620w,
+ http://127.0.0.1:8000/resources/img-srcset/image4-840x502.jpg 840w,
+ http://127.0.0.1:8000/resources/img-srcset/image4-940x560.jpg 940w,
+ http://127.0.0.1:8000/resources/img-srcset/image4-768x459.jpg 768w"
+ sizes="(max-width: 1024px) 100vw, 1024px">
+ </div>
+ <div id="console"></div>
+</body>
+<script src=""
+</html>
\ No newline at end of file
Added: trunk/LayoutTests/http/tests/resources/img-srcset/image1-620x442.jpg
(Binary files differ)
Property changes on: trunk/LayoutTests/http/tests/resources/img-srcset/image1-620x442.jpg
___________________________________________________________________
Added: svn:mime-type
Added: trunk/LayoutTests/http/tests/resources/img-srcset/image2-1024x731.jpg
(Binary files differ)
Property changes on: trunk/LayoutTests/http/tests/resources/img-srcset/image2-1024x731.jpg
___________________________________________________________________
Added: svn:mime-type
Added: trunk/LayoutTests/http/tests/resources/img-srcset/image2-1400x1000.jpg
(Binary files differ)
Property changes on: trunk/LayoutTests/http/tests/resources/img-srcset/image2-1400x1000.jpg
___________________________________________________________________
Added: svn:mime-type
Added: trunk/LayoutTests/http/tests/resources/img-srcset/image2-300x214.jpg
(Binary files differ)
Property changes on: trunk/LayoutTests/http/tests/resources/img-srcset/image2-300x214.jpg
___________________________________________________________________
Added: svn:mime-type
Added: trunk/LayoutTests/http/tests/resources/img-srcset/image2-620x442.jpg
(Binary files differ)
Property changes on: trunk/LayoutTests/http/tests/resources/img-srcset/image2-620x442.jpg
___________________________________________________________________
Added: svn:mime-type
Added: trunk/LayoutTests/http/tests/resources/img-srcset/image2-840x600.jpg
(Binary files differ)
Property changes on: trunk/LayoutTests/http/tests/resources/img-srcset/image2-840x600.jpg
___________________________________________________________________
Added: svn:mime-type
Added: trunk/LayoutTests/http/tests/resources/img-srcset/image3-250x178.jpg
(Binary files differ)
Property changes on: trunk/LayoutTests/http/tests/resources/img-srcset/image3-250x178.jpg
___________________________________________________________________
Added: svn:mime-type
Added: trunk/LayoutTests/http/tests/resources/img-srcset/image3-615x438.jpg
(Binary files differ)
Property changes on: trunk/LayoutTests/http/tests/resources/img-srcset/image3-615x438.jpg
___________________________________________________________________
Added: svn:mime-type
Added: trunk/LayoutTests/http/tests/resources/img-srcset/image3-620x440.jpg
(Binary files differ)
Property changes on: trunk/LayoutTests/http/tests/resources/img-srcset/image3-620x440.jpg
___________________________________________________________________
Added: svn:mime-type
Added: trunk/LayoutTests/http/tests/resources/img-srcset/image3-700x498.jpg
(Binary files differ)
Property changes on: trunk/LayoutTests/http/tests/resources/img-srcset/image3-700x498.jpg
___________________________________________________________________
Added: svn:mime-type
Added: trunk/LayoutTests/http/tests/resources/img-srcset/image3-840x598.jpg
(Binary files differ)
Property changes on: trunk/LayoutTests/http/tests/resources/img-srcset/image3-840x598.jpg
___________________________________________________________________
Added: svn:mime-type
Added: trunk/LayoutTests/http/tests/resources/img-srcset/image3.jpg
(Binary files differ)
Property changes on: trunk/LayoutTests/http/tests/resources/img-srcset/image3.jpg
___________________________________________________________________
Added: svn:mime-type
Added: trunk/LayoutTests/http/tests/resources/img-srcset/image4-1024x612.jpg
(Binary files differ)
Property changes on: trunk/LayoutTests/http/tests/resources/img-srcset/image4-1024x612.jpg
___________________________________________________________________
Added: svn:mime-type
Added: trunk/LayoutTests/http/tests/resources/img-srcset/image4-300x179.jpg
(Binary files differ)
Property changes on: trunk/LayoutTests/http/tests/resources/img-srcset/image4-300x179.jpg
___________________________________________________________________
Added: svn:mime-type
Added: trunk/LayoutTests/http/tests/resources/img-srcset/image4-620x370.jpg
(Binary files differ)
Property changes on: trunk/LayoutTests/http/tests/resources/img-srcset/image4-620x370.jpg
___________________________________________________________________
Added: svn:mime-type
Added: trunk/LayoutTests/http/tests/resources/img-srcset/image4-768x459.jpg
(Binary files differ)
Property changes on: trunk/LayoutTests/http/tests/resources/img-srcset/image4-768x459.jpg
___________________________________________________________________
Added: svn:mime-type
Added: trunk/LayoutTests/http/tests/resources/img-srcset/image4-840x502.jpg
(Binary files differ)
Property changes on: trunk/LayoutTests/http/tests/resources/img-srcset/image4-840x502.jpg
___________________________________________________________________
Added: svn:mime-type
Added: trunk/LayoutTests/http/tests/resources/img-srcset/image4-940x560.jpg
(Binary files differ)
Property changes on: trunk/LayoutTests/http/tests/resources/img-srcset/image4-940x560.jpg
___________________________________________________________________
Added: svn:mime-type
Modified: trunk/LayoutTests/platform/efl/TestExpectations (200944 => 200945)
--- trunk/LayoutTests/platform/efl/TestExpectations 2016-05-16 17:22:13 UTC (rev 200944)
+++ trunk/LayoutTests/platform/efl/TestExpectations 2016-05-16 17:35:30 UTC (rev 200945)
@@ -1119,6 +1119,7 @@
# EFL port needs Pasteboard implementation, needs baselines.
webkit.org/b/84338 fast/forms/plaintext-mode-2.html [ Pass ]
+http/tests/images/hidpi-srcset-copy.html [ Skip ]
# Controls are not zoomed.
webkit.org/b/102367 fast/forms/zoomed-controls.html [ Pass ]
Modified: trunk/LayoutTests/platform/gtk/TestExpectations (200944 => 200945)
--- trunk/LayoutTests/platform/gtk/TestExpectations 2016-05-16 17:22:13 UTC (rev 200944)
+++ trunk/LayoutTests/platform/gtk/TestExpectations 2016-05-16 17:35:30 UTC (rev 200945)
@@ -2186,6 +2186,7 @@
# PasteBoard::plainText() does not support file names.
webkit.org/b/99070 editing/pasteboard/drag-files-to-editable-element.html [ Failure ]
+http/tests/images/hidpi-srcset-copy.html [ Skip ]
# Opera-submitted tests to W3C for <track>, a lot of failures still.
webkit.org/b/103926 media/track/opera/idl/media-idl-tests.html [ Skip ]
Modified: trunk/LayoutTests/platform/win/TestExpectations (200944 => 200945)
--- trunk/LayoutTests/platform/win/TestExpectations 2016-05-16 17:22:13 UTC (rev 200944)
+++ trunk/LayoutTests/platform/win/TestExpectations 2016-05-16 17:35:30 UTC (rev 200945)
@@ -1230,6 +1230,8 @@
# Assertion failure in replaySavedEvents
webkit.org/b/21796 editing/pasteboard/drop-text-events.html [ Skip ]
+http/tests/images/hidpi-srcset-copy.html [ Skip ]
+
###### Selection
editing/selection/ [ Pass Failure ]
# This test is flaky due to capitalization; perhaps a capslock keypress or something?
Modified: trunk/Source/WebCore/ChangeLog (200944 => 200945)
--- trunk/Source/WebCore/ChangeLog 2016-05-16 17:22:13 UTC (rev 200944)
+++ trunk/Source/WebCore/ChangeLog 2016-05-16 17:35:30 UTC (rev 200945)
@@ -1,3 +1,23 @@
+2016-05-16 Brent Fulgham <[email protected]>
+
+ REGRESSION (r192098): Content missing after copy and paste to Notes App on retina displays
+ https://bugs.webkit.org/show_bug.cgi?id=157630
+ <rdar://problem/25277577>
+
+ Reviewed by Simon Fraser.
+
+ Tested by http/tests/images/hidpi-srcset-copy.html
+
+ The code to create a WebArchive (or other representation) of a webpage was using the 'src' attribute of
+ the image element, which might be changed to reflect the optimal image dimensions for a specific
+ display. Instead, we should use the 'imageSourceURL' method of the Element class so we get the correct
+ 'original' image URL in our cached resources.
+
+ * editing/cocoa/HTMLConverter.mm:
+ (HTMLConverter::_processElement): Use 'imageSourceURL', rather than getting the raw 'src' attribute.
+ * html/HTMLImageElement.cpp:
+ (WebCore::HTMLImageElement::addSubresourceAttributeURLs): Ditto.
+
2016-05-16 Brady Eidson <[email protected]>
Random CachedFont.cpp cleanup.
Modified: trunk/Source/WebCore/editing/cocoa/HTMLConverter.mm (200944 => 200945)
--- trunk/Source/WebCore/editing/cocoa/HTMLConverter.mm 2016-05-16 17:22:13 UTC (rev 200944)
+++ trunk/Source/WebCore/editing/cocoa/HTMLConverter.mm 2016-05-16 17:35:30 UTC (rev 200945)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011, 2012 Apple Inc. All rights reserved.
+ * Copyright (C) 2011-2016 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -1901,7 +1901,7 @@
retval = NO;
#endif
} else if (element.hasTagName(imgTag)) {
- NSString *urlString = element.getAttribute(srcAttr);
+ NSString *urlString = element.imageSourceURL();
if (urlString && [urlString length] > 0) {
NSURL *url = ""
if (!url)
Modified: trunk/Source/WebCore/html/HTMLImageElement.cpp (200944 => 200945)
--- trunk/Source/WebCore/html/HTMLImageElement.cpp 2016-05-16 17:22:13 UTC (rev 200944)
+++ trunk/Source/WebCore/html/HTMLImageElement.cpp 2016-05-16 17:35:30 UTC (rev 200945)
@@ -1,7 +1,7 @@
/*
* Copyright (C) 1999 Lars Knoll ([email protected])
* (C) 1999 Antti Koivisto ([email protected])
- * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2004-2016 Apple Inc. All rights reserved.
* Copyright (C) 2010 Google Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
@@ -542,7 +542,7 @@
{
HTMLElement::addSubresourceAttributeURLs(urls);
- addSubresourceURL(urls, src());
+ addSubresourceURL(urls, document().completeURL(imageSourceURL()));
// FIXME: What about when the usemap attribute begins with "#"?
addSubresourceURL(urls, document().completeURL(fastGetAttribute(usemapAttr)));
}
Modified: trunk/Tools/ChangeLog (200944 => 200945)
--- trunk/Tools/ChangeLog 2016-05-16 17:22:13 UTC (rev 200944)
+++ trunk/Tools/ChangeLog 2016-05-16 17:35:30 UTC (rev 200945)
@@ -1,3 +1,36 @@
+2016-05-16 Brent Fulgham <[email protected]>
+
+ REGRESSION (r192098): Content missing after copy and paste to Notes App on retina displays
+ https://bugs.webkit.org/show_bug.cgi?id=157630
+ <rdar://problem/25277577>
+
+ Reviewed by Simon Fraser.
+
+ Update test infrastructure to support checking the number of images in the pasteboard.
+
+ * DumpRenderTree/TestRunner.cpp:
+ (imageCountInGeneralPasteboardCallback): Added.
+ (TestRunner::staticFunctions):
+ * DumpRenderTree/TestRunner.h:
+ * DumpRenderTree/mac/TestRunnerMac.mm:
+ (TestRunner::imageCountInGeneralPasteboard): Added.
+ * DumpRenderTree/win/TestRunnerWin.cpp:
+ (TestRunner::imageCountInGeneralPasteboard): Added stub method.
+ * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
+ * WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
+ (WTR::InjectedBundle::imageCountInGeneralPasteboard): Added.
+ * WebKitTestRunner/InjectedBundle/InjectedBundle.h:
+ * WebKitTestRunner/InjectedBundle/TestRunner.cpp:
+ (WTR::TestRunner::imageCountInGeneralPasteboard): Added.
+ * WebKitTestRunner/InjectedBundle/TestRunner.h:
+ * WebKitTestRunner/TestController.cpp:
+ (WTR::TestController::imageCountInGeneralPasteboard): Added stub implementation.
+ * WebKitTestRunner/TestController.h:
+ * WebKitTestRunner/TestInvocation.cpp:
+ (WTR::TestInvocation::didReceiveSynchronousMessageFromInjectedBundle): Handle copy message.
+ * WebKitTestRunner/cocoa/TestControllerCocoa.mm:
+ (WTR::TestController::imageCountInGeneralPasteboard): Added.
+
2016-05-13 Dewei Zhu <[email protected]>
Fix JSBench which causes math domain error in run-benchmark script.
Modified: trunk/Tools/DumpRenderTree/TestRunner.cpp (200944 => 200945)
--- trunk/Tools/DumpRenderTree/TestRunner.cpp 2016-05-16 17:22:13 UTC (rev 200944)
+++ trunk/Tools/DumpRenderTree/TestRunner.cpp 2016-05-16 17:35:30 UTC (rev 200945)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2007, 2008, 2009, 2011, 2012 Apple Inc. All rights reserved.
+ * Copyright (C) 2007-2016 Apple Inc. All rights reserved.
* Copyright (C) 2010 Joone Hur <[email protected]>
*
* Redistribution and use in source and binary forms, with or without
@@ -1747,6 +1747,14 @@
return JSValueMakeNumber(context, WTF::currentTime());
}
+static JSValueRef imageCountInGeneralPasteboardCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+ // Has mac & windows implementation
+ TestRunner* controller = static_cast<TestRunner*>(JSObjectGetPrivate(thisObject));
+
+ return JSValueMakeNumber(context, controller->imageCountInGeneralPasteboard());
+}
+
// Static Values
static JSValueRef getTimeoutCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
@@ -2175,6 +2183,7 @@
{ "numberOfDFGCompiles", numberOfDFGCompiles, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "neverInlineFunction", neverInlineFunction, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "accummulateLogsForChannel", accummulateLogsForChannel, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+ { "imageCountInGeneralPasteboard", imageCountInGeneralPasteboardCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ 0, 0, 0 }
};
Modified: trunk/Tools/DumpRenderTree/TestRunner.h (200944 => 200945)
--- trunk/Tools/DumpRenderTree/TestRunner.h 2016-05-16 17:22:13 UTC (rev 200944)
+++ trunk/Tools/DumpRenderTree/TestRunner.h 2016-05-16 17:35:30 UTC (rev 200945)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2007, 2008, 2009, 2012 Apple Inc. All rights reserved.
+ * Copyright (C) 2007-2016 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -359,6 +359,8 @@
void setCustomTimeout(int duration) { m_timeout = duration; }
double timeout() { return m_timeout; }
+ unsigned imageCountInGeneralPasteboard() const;
+
private:
TestRunner(const std::string& testURL, const std::string& expectedPixelHash);
Modified: trunk/Tools/DumpRenderTree/mac/TestRunnerMac.mm (200944 => 200945)
--- trunk/Tools/DumpRenderTree/mac/TestRunnerMac.mm 2016-05-16 17:22:13 UTC (rev 200944)
+++ trunk/Tools/DumpRenderTree/mac/TestRunnerMac.mm 2016-05-16 17:35:30 UTC (rev 200945)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2007, 2008, 2009, 2012 Apple Inc. All rights reserved.
+ * Copyright (C) 2007-2016 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -1224,3 +1224,33 @@
{
}
+static NSString * const WebArchivePboardType = @"Apple Web Archive pasteboard type";
+static NSString * const WebSubresourcesKey = @"WebSubresources";
+static NSString * const WebSubframeArchivesKey = @"WebResourceMIMEType like 'image*'";
+
+unsigned TestRunner::imageCountInGeneralPasteboard() const
+{
+#if PLATFORM(MAC)
+ NSData *data = "" generalPasteboard] dataForType:WebArchivePboardType];
+#elif PLATFORM(IOS)
+ NSData *data = "" generalPasteboard] valueForPasteboardType:WebArchivePboardType];
+#endif
+ if (!data)
+ return 0;
+
+ NSError *error = nil;
+ id webArchive = [NSPropertyListSerialization propertyListWithData:data options:NSPropertyListImmutable format:NULL error:&error];
+ if (error) {
+ NSLog(@"Encountered error while serializing Web Archive pasteboard data: %@", error);
+ return 0;
+ }
+
+ NSArray *subItems = [NSArray arrayWithArray:[webArchive objectForKey:WebSubresourcesKey]];
+ NSPredicate *predicate = [NSPredicate predicateWithFormat:WebSubframeArchivesKey];
+ NSArray *imagesArray = [subItems filteredArrayUsingPredicate:predicate];
+
+ if (!imagesArray)
+ return 0;
+
+ return imagesArray.count;
+}
Modified: trunk/Tools/DumpRenderTree/win/TestRunnerWin.cpp (200944 => 200945)
--- trunk/Tools/DumpRenderTree/win/TestRunnerWin.cpp 2016-05-16 17:22:13 UTC (rev 200944)
+++ trunk/Tools/DumpRenderTree/win/TestRunnerWin.cpp 2016-05-16 17:35:30 UTC (rev 200945)
@@ -1333,3 +1333,10 @@
{
// FIXME: Implement.
}
+
+unsigned TestRunner::imageCountInGeneralPasteboard() const
+{
+ printf("ERROR: TestRunner::imageCountInGeneralPasteboard() not implemented\n");
+ return 0;
+}
+
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl (200944 => 200945)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl 2016-05-16 17:22:13 UTC (rev 200944)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl 2016-05-16 17:35:30 UTC (rev 200945)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010, 2011, 2012 Apple Inc. All rights reserved.
+ * Copyright (C) 2010-2016 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -219,6 +219,8 @@
void installDidEndSwipeCallback(object callback);
void installDidRemoveSwipeSnapshotCallback(object callback);
+ unsigned long imageCountInGeneralPasteboard();
+
// UI Process Testing
void runUIScript(DOMString script, object callback);
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp (200944 => 200945)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp 2016-05-16 17:22:13 UTC (rev 200944)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp 2016-05-16 17:35:30 UTC (rev 200945)
@@ -552,6 +552,16 @@
return WKBooleanGetValue(isActive.get());
}
+unsigned InjectedBundle::imageCountInGeneralPasteboard() const
+{
+ WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("ImageCountInGeneralPasteboard"));
+ WKTypeRef resultToPass = 0;
+ WKBundlePagePostSynchronousMessageForTesting(page()->page(), messageName.get(), 0, &resultToPass);
+ WKRetainPtr<WKUInt64Ref> imageCount(AdoptWK, static_cast<WKUInt64Ref>(resultToPass));
+
+ return static_cast<unsigned>(WKUInt64GetValue(imageCount.get()));
+}
+
void InjectedBundle::setUserMediaPermission(bool enabled)
{
auto messageName = adoptWK(WKStringCreateWithUTF8CString("SetUserMediaPermission"));
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.h (200944 => 200945)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.h 2016-05-16 17:22:13 UTC (rev 200944)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.h 2016-05-16 17:35:30 UTC (rev 200945)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010, 2011, 2012 Apple Inc. All rights reserved.
+ * Copyright (C) 2010-2016 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -121,6 +121,8 @@
bool isAllowedHost(WKStringRef);
+ unsigned imageCountInGeneralPasteboard() const;
+
private:
InjectedBundle();
~InjectedBundle();
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp (200944 => 200945)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp 2016-05-16 17:22:13 UTC (rev 200944)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp 2016-05-16 17:35:30 UTC (rev 200945)
@@ -178,6 +178,11 @@
m_waitToDump = false;
}
+unsigned TestRunner::imageCountInGeneralPasteboard() const
+{
+ return InjectedBundle::singleton().imageCountInGeneralPasteboard();
+}
+
void TestRunner::addUserScript(JSStringRef source, bool runAtStart, bool allFrames)
{
WKRetainPtr<WKStringRef> sourceWK = toWK(source);
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h (200944 => 200945)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h 2016-05-16 17:22:13 UTC (rev 200944)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h 2016-05-16 17:35:30 UTC (rev 200945)
@@ -322,6 +322,8 @@
void accummulateLogsForChannel(JSStringRef channel);
+ unsigned imageCountInGeneralPasteboard() const;
+
private:
TestRunner();
Modified: trunk/Tools/WebKitTestRunner/TestController.cpp (200944 => 200945)
--- trunk/Tools/WebKitTestRunner/TestController.cpp 2016-05-16 17:22:13 UTC (rev 200944)
+++ trunk/Tools/WebKitTestRunner/TestController.cpp 2016-05-16 17:35:30 UTC (rev 200945)
@@ -2163,6 +2163,12 @@
{
}
+
+unsigned TestController::imageCountInGeneralPasteboard() const
+{
+ return 0;
+}
+
#endif
} // namespace WTR
Modified: trunk/Tools/WebKitTestRunner/TestController.h (200944 => 200945)
--- trunk/Tools/WebKitTestRunner/TestController.h 2016-05-16 17:22:13 UTC (rev 200944)
+++ trunk/Tools/WebKitTestRunner/TestController.h 2016-05-16 17:35:30 UTC (rev 200945)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010, 2015 Apple Inc. All rights reserved.
+ * Copyright (C) 2010, 2015-2016 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -111,6 +111,8 @@
// Page Visibility.
void setHidden(bool);
+ unsigned imageCountInGeneralPasteboard() const;
+
bool resetStateToConsistentValues(const TestOptions&);
void resetPreferencesToConsistentValues(const TestOptions&);
Modified: trunk/Tools/WebKitTestRunner/TestInvocation.cpp (200944 => 200945)
--- trunk/Tools/WebKitTestRunner/TestInvocation.cpp 2016-05-16 17:22:13 UTC (rev 200944)
+++ trunk/Tools/WebKitTestRunner/TestInvocation.cpp 2016-05-16 17:35:30 UTC (rev 200945)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010, 2011, 2012 Apple Inc. All rights reserved.
+ * Copyright (C) 2010-2016 Apple Inc. All rights reserved.
* Copyright (C) 2012 Intel Corporation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -708,6 +708,12 @@
return nullptr;
}
+ if (WKStringIsEqualToUTF8CString(messageName, "ImageCountInGeneralPasteboard")) {
+ unsigned count = TestController::singleton().imageCountInGeneralPasteboard();
+ WKRetainPtr<WKUInt64Ref> result(AdoptWK, WKUInt64Create(count));
+ return result;
+ }
+
ASSERT_NOT_REACHED();
return nullptr;
}
Modified: trunk/Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm (200944 => 200945)
--- trunk/Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm 2016-05-16 17:22:13 UTC (rev 200944)
+++ trunk/Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm 2016-05-16 17:35:30 UTC (rev 200945)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2015 Apple Inc. All rights reserved.
+ * Copyright (C) 2015-2016 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -142,4 +142,35 @@
setCrashReportApplicationSpecificInformationToURL(testInvocation.url());
}
+static NSString * const WebArchivePboardType = @"Apple Web Archive pasteboard type";
+static NSString * const WebSubresourcesKey = @"WebSubresources";
+static NSString * const WebSubframeArchivesKey = @"WebResourceMIMEType like 'image*'";
+
+unsigned TestController::imageCountInGeneralPasteboard() const
+{
+#if PLATFORM(MAC)
+ NSData *data = "" generalPasteboard] dataForType:WebArchivePboardType];
+#elif PLATFORM(IOS)
+ NSData *data = "" generalPasteboard] valueForPasteboardType:WebArchivePboardType];
+#endif
+ if (!data)
+ return 0;
+
+ NSError *error = nil;
+ id webArchive = [NSPropertyListSerialization propertyListWithData:data options:NSPropertyListImmutable format:NULL error:&error];
+ if (error) {
+ NSLog(@"Encountered error while serializing Web Archive pasteboard data: %@", error);
+ return 0;
+ }
+
+ NSArray *subItems = [NSArray arrayWithArray:[webArchive objectForKey:WebSubresourcesKey]];
+ NSPredicate *predicate = [NSPredicate predicateWithFormat:WebSubframeArchivesKey];
+ NSArray *imagesArray = [subItems filteredArrayUsingPredicate:predicate];
+
+ if (!imagesArray)
+ return 0;
+
+ return imagesArray.count;
+}
+
} // namespace WTR