WebKit-https.git
3 years agoReplace CryptoOperationData with BufferSource for WebKitSubtleCrypto
jiewen_tan@apple.com [Wed, 17 May 2017 20:09:47 +0000 (20:09 +0000)]
Replace CryptoOperationData with BufferSource for WebKitSubtleCrypto
https://bugs.webkit.org/show_bug.cgi?id=172146
<rdar://problem/32122256>

Reviewed by Brent Fulgham.

Source/WebCore:

In this patch, we replaces CryptoOperationData with BufferSource for WebKitSubtleCrypto in
the custom binding codes.

Test: crypto/webkitSubtle/import-export-raw-key-leak.html

* bindings/js/JSWebKitSubtleCryptoCustom.cpp:
(WebCore::JSWebKitSubtleCrypto::encrypt):
(WebCore::JSWebKitSubtleCrypto::decrypt):
(WebCore::JSWebKitSubtleCrypto::sign):
(WebCore::JSWebKitSubtleCrypto::verify):
(WebCore::JSWebKitSubtleCrypto::digest):
(WebCore::JSWebKitSubtleCrypto::importKey):
(WebCore::JSWebKitSubtleCrypto::unwrapKey):
* crypto/WebKitSubtleCrypto.idl:

LayoutTests:

* crypto/webkitSubtle/argument-conversion-expected.txt:
* crypto/webkitSubtle/import-export-raw-key-leak-expected.txt: Added.
* crypto/webkitSubtle/import-export-raw-key-leak.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216992 268f45cc-cd09-0410-ab3c-d52691b4dbfc

3 years agoMove-related refactoring on UserMediaPermissionRequestProxy
commit-queue@webkit.org [Wed, 17 May 2017 20:07:27 +0000 (20:07 +0000)]
Move-related refactoring on UserMediaPermissionRequestProxy
https://bugs.webkit.org/show_bug.cgi?id=172195

Patch by Youenn Fablet <youenn@apple.com> on 2017-05-17
Reviewed by Alex Christensen.

Source/WebCore:

No behavioral change.

* platform/mediastream/RealtimeMediaSourceCenter.h: Cleaning the function definition.

Source/WebKit2:

Moving vectors of strings instead of passing as const ref so that we do not copy them.

* UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
(WebKit::UserMediaPermissionRequestManagerProxy::createRequest):
(WebKit::UserMediaPermissionRequestManagerProxy::requestUserMediaPermissionForFrame):
* UIProcess/UserMediaPermissionRequestManagerProxy.h:
* UIProcess/UserMediaPermissionRequestProxy.cpp:
(WebKit::UserMediaPermissionRequestProxy::UserMediaPermissionRequestProxy):
* UIProcess/UserMediaPermissionRequestProxy.h:
(WebKit::UserMediaPermissionRequestProxy::create):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216991 268f45cc-cd09-0410-ab3c-d52691b4dbfc

3 years agoUnreviewed, skip newly imported notifications tests on iOS
cdumez@apple.com [Wed, 17 May 2017 19:44:29 +0000 (19:44 +0000)]
Unreviewed, skip newly imported notifications tests on iOS

Notifications are not enabled on iOS.

* platform/ios/TestExpectations:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216990 268f45cc-cd09-0410-ab3c-d52691b4dbfc

3 years agoPinnedRegisters should be better modeled in IRC/Briggs
sbarati@apple.com [Wed, 17 May 2017 19:25:18 +0000 (19:25 +0000)]
PinnedRegisters should be better modeled in IRC/Briggs
https://bugs.webkit.org/show_bug.cgi?id=171955

Reviewed by Filip Pizlo.

This patch fixes a bug in Briggs/IRC with respect to pinned registers.
Pinned registers were not part of the assignable register file in IRC/Briggs,
and this would lead to an asymmetry because they were modeled in the
interference graph. The bug is that we use registerCount() to move various
Tmps between various lists in the different allocators, and if a Tmp
interfered with a pinned register (usually via a Patchpoint's clobbered set),
we'd have an interference edge modeled in the degree for that Tmp, but the registerCount()
would make us think that this particular Tmp is not assignable. This would
lead us to fail to color a colorable graph. Specifically, this happened in
our various patchpoint tests that stress the register allocator by forcing
the entire register file into arguments for the patchpoint and then doing
interesting things with the result, arguments, etc.

This patch fixes the bug by coming up with an more natural way to model pinned
registers. Pinned registers are now part of the register file. However,
pinned registers are live at every point in the program (this is a defining
property of a pinned register). In practice, this means that the only Tmps
that can be assigned to pinned registers are ones that are coalescing
candidates. This means the program has some number of defs for a Tmp T like:
MoveType pinnedReg, T

Note, if any other defs for T happen, like:
Add32, t1, t2, T
T will have an interference edge with pinnedReg, since pinnedReg is live
at every point in the program. Modeling pinned registers this way allows
IRC/Briggs to have no special casing for them. It treats it like any other
precolored Tmp. This allows us to do coalescing, biased coloring, etc, which
could all lead to a Tmp being assigned to a pinned register.

Interestingly, we used to have special handling for the frame pointer
register, which in many ways, acts like a pinned register, since FP is
always live, and we wanted it to take place in coalescing. The allocator
had a side-table interference graph with FP. Interestingly, we didn't even
handle this properly everywhere since we could rely on a patchpoint never
claiming to clobber FP (this would be illegal). So the code only handled
the pseudo-pinned register properties of FP in various places. This patch
drops this special casing and pins FP since all pinned registers can take
part in coalescing.

* b3/B3PatchpointSpecial.h:
* b3/B3Procedure.cpp:
(JSC::B3::Procedure::mutableGPRs):
(JSC::B3::Procedure::mutableFPRs):
* b3/B3Procedure.h:
* b3/air/AirAllocateRegistersByGraphColoring.cpp:
* b3/air/AirCode.cpp:
(JSC::B3::Air::Code::Code):
(JSC::B3::Air::Code::pinRegister):
(JSC::B3::Air::Code::mutableGPRs):
(JSC::B3::Air::Code::mutableFPRs):
* b3/air/AirCode.h:
(JSC::B3::Air::Code::pinnedRegisters):
* b3/air/AirSpecial.h:
* b3/air/testair.cpp:
* b3/testb3.cpp:
(JSC::B3::testSimplePatchpointWithOuputClobbersGPArgs):
(JSC::B3::testSpillDefSmallerThanUse):
(JSC::B3::testLateRegister):
(JSC::B3::testTerminalPatchpointThatNeedsToBeSpilled):
(JSC::B3::testTerminalPatchpointThatNeedsToBeSpilled2):
(JSC::B3::testMoveConstants):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216989 268f45cc-cd09-0410-ab3c-d52691b4dbfc

3 years agoBlobDataFileReference::generateReplacementFile() should use mkstemp()
ddkilzer@apple.com [Wed, 17 May 2017 18:44:19 +0000 (18:44 +0000)]
BlobDataFileReference::generateReplacementFile() should use mkstemp()
<https://webkit.org/b/172192>

Reviewed by Brent Fulgham.

Source/WebCore:

* platform/network/mac/BlobDataFileReferenceMac.mm:
(WebCore::BlobDataFileReference::generateReplacementFile): Use
mkstemp().

Tools:

* Scripts/webkitpy/style/checkers/cpp.py:
(check_language): Add check for mktemp.
(CppChecker): Add 'security/temp_file' category.
* Scripts/webkitpy/style/checkers/cpp_unittest.py:
(CppStyleTest.test_insecure_temp_file): Add test.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216988 268f45cc-cd09-0410-ab3c-d52691b4dbfc

3 years agoMark two http/tests/media/hls/video tests as failing during investigation.
ryanhaddad@apple.com [Wed, 17 May 2017 18:28:55 +0000 (18:28 +0000)]
Mark two http/tests/media/hls/video tests as failing during investigation.
https://bugs.webkit.org/show_bug.cgi?id=171814

Unreviewed test gardening.

* platform/mac-wk1/TestExpectations:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216984 268f45cc-cd09-0410-ab3c-d52691b4dbfc

3 years agoUnreviewed, change my email.
drousso@apple.com [Wed, 17 May 2017 18:26:11 +0000 (18:26 +0000)]
Unreviewed, change my email.

* Scripts/webkitpy/common/config/contributors.json:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216983 268f45cc-cd09-0410-ab3c-d52691b4dbfc

3 years agoREGRESSION (r215480): PKPaymentAuthorizationStatusFailure sent to PassKit in complete...
aestes@apple.com [Wed, 17 May 2017 18:17:26 +0000 (18:17 +0000)]
REGRESSION (r215480): PKPaymentAuthorizationStatusFailure sent to PassKit in completeShippingContactSelection() even when there are no errors
https://bugs.webkit.org/show_bug.cgi?id=172227
<rdar://problem/31978432>

Reviewed by Alexey Proskuryakov.

* UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
(WebKit::toPKPaymentAuthorizationStatus): If there is an update with no errors, we should
return PKPaymentAuthorizationStatusSuccess instead of PKPaymentAuthorizationStatusFailure.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216982 268f45cc-cd09-0410-ab3c-d52691b4dbfc

3 years agoUnreviewed, rolling out r216974.
jlewis3@apple.com [Wed, 17 May 2017 17:52:59 +0000 (17:52 +0000)]
Unreviewed, rolling out r216974.

Revision caused consistent timeouts on all platforms.

Reverted changeset:

"Add a RuntimeEnabledFeature for display: contents, defaulted
to false."
https://bugs.webkit.org/show_bug.cgi?id=171984
http://trac.webkit.org/changeset/216974

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216981 268f45cc-cd09-0410-ab3c-d52691b4dbfc

3 years agoASSERTION FAILED in WebCore::AccessibilityNodeObject::insertChild()
n_wang@apple.com [Wed, 17 May 2017 17:34:27 +0000 (17:34 +0000)]
ASSERTION FAILED in WebCore::AccessibilityNodeObject::insertChild()
https://bugs.webkit.org/show_bug.cgi?id=171927
<rdar://problem/32109781>

Reviewed by Chris Fleizach.

Source/WebCore:

The nextSibling() logic might include the continuation sibling that's not
the child of the current renderer. Make sure we only insert the valid child.

Test: accessibility/insert-children-assert.html

* accessibility/AccessibilityObject.cpp:
(WebCore::AccessibilityObject::setIsIgnoredFromParentDataForChild):
* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::nextSibling):

LayoutTests:

* accessibility/insert-children-assert-expected.txt: Added.
* accessibility/insert-children-assert.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216980 268f45cc-cd09-0410-ab3c-d52691b4dbfc

3 years agoImport Notification tests from web-platform-tests
cdumez@apple.com [Wed, 17 May 2017 17:23:20 +0000 (17:23 +0000)]
Import Notification tests from web-platform-tests
https://bugs.webkit.org/show_bug.cgi?id=172196

Reviewed by Youenn Fablet.

LayoutTests/imported/w3c:

* resources/import-expectations.json:
* web-platform-tests/notifications/OWNERS: Added.
* web-platform-tests/notifications/common.js: Added.
(createPassFail):
(clearPassFail):
(closeNotifications):
(hasNotificationPermission):
* web-platform-tests/notifications/constructor-basic-expected.txt: Added.
* web-platform-tests/notifications/constructor-basic.html: Added.
* web-platform-tests/notifications/constructor-invalid-expected.txt: Added.
* web-platform-tests/notifications/constructor-invalid.html: Added.
* web-platform-tests/notifications/event-onclose-expected.txt: Added.
* web-platform-tests/notifications/event-onclose.html: Added.
* web-platform-tests/notifications/event-onshow-expected.txt: Added.
* web-platform-tests/notifications/event-onshow.html: Added.
* web-platform-tests/notifications/instance-expected.txt: Added.
* web-platform-tests/notifications/instance.html: Added.
* web-platform-tests/notifications/interfaces-expected.txt: Added.
* web-platform-tests/notifications/interfaces.html: Added.
* web-platform-tests/notifications/lang-expected.txt: Added.
* web-platform-tests/notifications/lang.html: Added.
* web-platform-tests/notifications/permission-expected.txt: Added.
* web-platform-tests/notifications/permission.html: Added.
* web-platform-tests/notifications/resources/icon.png: Added.
* web-platform-tests/notifications/resources/shownotification-sw.js: Added.
(self.onmessage.event.then):
* web-platform-tests/notifications/resources/w3c-import.log: Added.
* web-platform-tests/notifications/shownotification-resolve-manual.https-expected.txt: Added.
* web-platform-tests/notifications/shownotification-resolve-manual.https.html: Added.
* web-platform-tests/notifications/w3c-import.log: Added.

LayoutTests:

* resources/testharnessreport.js:
Allow notifications as this is a pre-requirement for web-platform-tests.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216979 268f45cc-cd09-0410-ab3c-d52691b4dbfc

3 years agogetElementById can return a wrong elemnt when a matching element is removed during...
bfulgham@apple.com [Wed, 17 May 2017 17:15:45 +0000 (17:15 +0000)]
getElementById can return a wrong elemnt when a matching element is removed during beforeload event
https://bugs.webkit.org/show_bug.cgi?id=171374

Patch by Ryosuke Niwa <rniwa@webkit.org> on 2017-05-17
Reviewed by Brent Fulgham.

Source/WebCore:

The bug was caused by HTMLLinkElement firing beforeload event inside insertedInto before the tree state is updated.
Delay the event dispatch to the post insertion callback.

Test: fast/html/link-element-removal-during-beforeload.html

* html/HTMLLinkElement.cpp:
(WebCore::HTMLLinkElement::insertedInto):
(WebCore::HTMLLinkElement::finishedInsertingSubtree):
* html/HTMLLinkElement.h:

LayoutTests:

Added a regression test for calling getElementById after removing a matching element
during beforeload event of a link element.

* fast/html/link-element-removal-during-beforeload-expected.txt: Added.
* fast/html/link-element-removal-during-beforeload.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216978 268f45cc-cd09-0410-ab3c-d52691b4dbfc

3 years agoInteracting with WKHTTPCookieStores before creating WKWebViews and WKProcessPools...
achristensen@apple.com [Wed, 17 May 2017 16:51:46 +0000 (16:51 +0000)]
Interacting with WKHTTPCookieStores before creating WKWebViews and WKProcessPools should affect cookies used
https://bugs.webkit.org/show_bug.cgi?id=171987

Reviewed by Brady Eidson.

Source/WebCore:

Covered by new API tests.

* CMakeLists.txt:
* platform/Cookie.h:
(WebCore::Cookie::Cookie):
(WebCore::Cookie::isNull):
(WebCore::CookieHash::hash):
(WebCore::CookieHash::equal):
(WTF::HashTraits<WebCore::Cookie>::emptyValue):
(WTF::HashTraits<WebCore::Cookie>::constructDeletedValue):
(WTF::HashTraits<WebCore::Cookie>::isDeletedValue):
* platform/network/Cookie.cpp: Added.
(WebCore::Cookie::operator==):
(WebCore::Cookie::hash):
* platform/network/cocoa/CookieCocoa.mm:
(WebCore::Cookie::operator NSHTTPCookie *):
(WebCore::Cookie::operator==):
(WebCore::Cookie::hash):
* platform/network/cocoa/NetworkStorageSessionCocoa.mm:
(WebCore::NetworkStorageSession::setCookies):
Use NSHTTPCookie's hash and equality comparison to more closely match the NSHTTPCookie behavior.

Source/WebKit2:

When putting cookies in a WKHTTPCookieStore that hasn't been associated with a WKProcessPool yet, there is no
NetworkProcess into which to put the cookies.  In such a case, we should store these cookies in the WebsiteDataStore
until there is a NetworkProcess.

* NetworkProcess/NetworkConnectionToWebProcess.cpp:
(WebKit::NetworkConnectionToWebProcess::ensureLegacyPrivateBrowsingSession):
* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::initializeNetworkProcess):
(WebKit::NetworkProcess::ensurePrivateBrowsingSession):
* NetworkProcess/NetworkProcess.h:
* NetworkProcess/NetworkProcess.messages.in:
* NetworkProcess/RemoteNetworkingContext.h:
* NetworkProcess/mac/RemoteNetworkingContext.mm:
(WebKit::RemoteNetworkingContext::ensurePrivateBrowsingSession):
(WebKit::RemoteNetworkingContext::ensureWebsiteDataStoreSession):
* Shared/WebsiteDataStoreParameters.cpp:
(WebKit::WebsiteDataStoreParameters::~WebsiteDataStoreParameters):
(WebKit::WebsiteDataStoreParameters::encode):
(WebKit::WebsiteDataStoreParameters::decode):
(WebKit::WebsiteDataStoreParameters::WebsiteDataStoreParameters): Deleted.
* Shared/WebsiteDataStoreParameters.h:
* UIProcess/API/APIHTTPCookieStore.cpp:
(API::HTTPCookieStore::cookies):
(API::HTTPCookieStore::setCookie):
(API::HTTPCookieStore::deleteCookie):
* UIProcess/API/APIHTTPCookieStore.h:
* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::setAnyPageGroupMightHavePrivateBrowsingEnabled):
(WebKit::WebProcessPool::pageAddedToProcess):
* UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm:
(WebKit::WebsiteDataStore::parameters):
* UIProcess/WebsiteData/WebsiteDataStore.cpp:
(WebKit::WebsiteDataStore::pendingCookies):
(WebKit::WebsiteDataStore::addPendingCookie):
(WebKit::WebsiteDataStore::removePendingCookie):
* UIProcess/WebsiteData/WebsiteDataStore.h:

Tools:

* TestWebKitAPI/Tests/WebKit2Cocoa/WKHTTPCookieStore.mm:
(-[CookieUIDelegate webView:runJavaScriptAlertPanelWithMessage:initiatedByFrame:completionHandler:]):
(TEST):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216977 268f45cc-cd09-0410-ab3c-d52691b4dbfc

3 years agoUnreviewed, rebaseline js/dom/global-constructors-attributes.html after r216959.
cdumez@apple.com [Wed, 17 May 2017 16:23:10 +0000 (16:23 +0000)]
Unreviewed, rebaseline js/dom/global-constructors-attributes.html after r216959.

* js/dom/global-constructors-attributes-expected.txt:
* platform/gtk/js/dom/global-constructors-attributes-expected.txt:
* platform/mac-elcapitan/js/dom/global-constructors-attributes-expected.txt:
* platform/mac-wk1/js/dom/global-constructors-attributes-expected.txt:
* platform/mac-yosemite/js/dom/global-constructors-attributes-expected.txt:
* platform/mac/js/dom/global-constructors-attributes-expected.txt:
* platform/win/js/dom/global-constructors-attributes-expected.txt:
* platform/wpe/js/dom/global-constructors-attributes-expected.txt:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216976 268f45cc-cd09-0410-ab3c-d52691b4dbfc

3 years agoImport FileAPI WPT tests.
commit-queue@webkit.org [Wed, 17 May 2017 16:04:36 +0000 (16:04 +0000)]
Import FileAPI WPT tests.
https://bugs.webkit.org/show_bug.cgi?id=171960

Patch by Ben Kelly <ben@wanderview.com> on 2017-05-17
Reviewed by Youenn Fablet.

LayoutTests/imported/w3c:

* resources/import-expectations.json:
* resources/resource-files.json:
* web-platform-tests/FileAPI/BlobURL/support/file_test1.js: Added.
* web-platform-tests/FileAPI/BlobURL/support/file_test2.txt: Added.
* web-platform-tests/FileAPI/BlobURL/support/file_test3.html: Added.
* web-platform-tests/FileAPI/BlobURL/support/w3c-import.log: Added.
* web-platform-tests/FileAPI/FileReader/Progress_event_bubbles_cancelable-expected.txt: Added.
* web-platform-tests/FileAPI/FileReader/Progress_event_bubbles_cancelable.html: Added.
* web-platform-tests/FileAPI/FileReader/support/file_test1.txt: Added.
* web-platform-tests/FileAPI/FileReader/support/w3c-import.log: Added.
* web-platform-tests/FileAPI/FileReader/w3c-import.log: Added.
* web-platform-tests/FileAPI/FileReaderSync.worker-expected.txt: Added.
* web-platform-tests/FileAPI/FileReaderSync.worker.html: Added.
* web-platform-tests/FileAPI/FileReaderSync.worker.js: Added.
(setup):
(test):
* web-platform-tests/FileAPI/OWNERS: Added.
* web-platform-tests/FileAPI/blob/Blob-XHR-revoke-expected.txt: Added.
* web-platform-tests/FileAPI/blob/Blob-XHR-revoke.html: Added.
* web-platform-tests/FileAPI/blob/Blob-constructor-expected.txt: Added.
* web-platform-tests/FileAPI/blob/Blob-constructor.html: Added.
* web-platform-tests/FileAPI/blob/Blob-in-worker.worker-expected.txt: Added.
* web-platform-tests/FileAPI/blob/Blob-in-worker.worker.html: Added.
* web-platform-tests/FileAPI/blob/Blob-in-worker.worker.js: Added.
(async_test):
* web-platform-tests/FileAPI/blob/Blob-slice-expected.txt: Added.
* web-platform-tests/FileAPI/blob/Blob-slice-overflow-expected.txt: Added.
* web-platform-tests/FileAPI/blob/Blob-slice-overflow.html: Added.
* web-platform-tests/FileAPI/blob/Blob-slice.html: Added.
* web-platform-tests/FileAPI/blob/w3c-import.log: Added.
* web-platform-tests/FileAPI/file/File-constructor-expected.txt: Added.
* web-platform-tests/FileAPI/file/File-constructor.html: Added.
* web-platform-tests/FileAPI/file/Worker-read-file-constructor.worker-expected.txt: Added.
* web-platform-tests/FileAPI/file/Worker-read-file-constructor.worker.html: Added.
* web-platform-tests/FileAPI/file/Worker-read-file-constructor.worker.js: Added.
(async_test):
* web-platform-tests/FileAPI/file/w3c-import.log: Added.
* web-platform-tests/FileAPI/fileReader-expected.txt: Added.
* web-platform-tests/FileAPI/fileReader.html: Added.
* web-platform-tests/FileAPI/filelist-section/filelist-expected.txt: Added.
* web-platform-tests/FileAPI/filelist-section/filelist.html: Added.
* web-platform-tests/FileAPI/filelist-section/support/upload.txt: Added.
* web-platform-tests/FileAPI/filelist-section/support/upload.zip: Added.
* web-platform-tests/FileAPI/filelist-section/support/w3c-import.log: Added.
* web-platform-tests/FileAPI/filelist-section/w3c-import.log: Added.
* web-platform-tests/FileAPI/historical.https-expected.txt: Added.
* web-platform-tests/FileAPI/historical.https.html: Added.
* web-platform-tests/FileAPI/idlharness-expected.txt: Added.
* web-platform-tests/FileAPI/idlharness.html: Added.
* web-platform-tests/FileAPI/idlharness.idl: Added.
* web-platform-tests/FileAPI/idlharness.worker-expected.txt: Added.
* web-platform-tests/FileAPI/idlharness.worker.html: Added.
* web-platform-tests/FileAPI/idlharness.worker.js: Added.
(request.onload):
* web-platform-tests/FileAPI/reading-data-section/Determining-Encoding-expected.txt: Added.
* web-platform-tests/FileAPI/reading-data-section/Determining-Encoding.html: Added.
* web-platform-tests/FileAPI/reading-data-section/FileReader-event-handler-attributes-expected.txt: Added.
* web-platform-tests/FileAPI/reading-data-section/FileReader-event-handler-attributes.html: Added.
* web-platform-tests/FileAPI/reading-data-section/FileReader-multiple-reads-expected.txt: Added.
* web-platform-tests/FileAPI/reading-data-section/FileReader-multiple-reads.html: Added.
* web-platform-tests/FileAPI/reading-data-section/filereader_abort-expected.txt: Added.
* web-platform-tests/FileAPI/reading-data-section/filereader_abort.html: Added.
* web-platform-tests/FileAPI/reading-data-section/filereader_error-expected.txt: Added.
* web-platform-tests/FileAPI/reading-data-section/filereader_error.html: Added.
* web-platform-tests/FileAPI/reading-data-section/filereader_readAsArrayBuffer-expected.txt: Added.
* web-platform-tests/FileAPI/reading-data-section/filereader_readAsArrayBuffer.html: Added.
* web-platform-tests/FileAPI/reading-data-section/filereader_readAsDataURL-expected.txt: Added.
* web-platform-tests/FileAPI/reading-data-section/filereader_readAsDataURL.html: Added.
* web-platform-tests/FileAPI/reading-data-section/filereader_readAsText-expected.txt: Added.
* web-platform-tests/FileAPI/reading-data-section/filereader_readAsText.html: Added.
* web-platform-tests/FileAPI/reading-data-section/filereader_readystate-expected.txt: Added.
* web-platform-tests/FileAPI/reading-data-section/filereader_readystate.html: Added.
* web-platform-tests/FileAPI/reading-data-section/filereader_result-expected.txt: Added.
* web-platform-tests/FileAPI/reading-data-section/filereader_result.html: Added.
* web-platform-tests/FileAPI/reading-data-section/support/blue-100x100.png: Added.
* web-platform-tests/FileAPI/reading-data-section/support/w3c-import.log: Added.
* web-platform-tests/FileAPI/reading-data-section/w3c-import.log: Added.
* web-platform-tests/FileAPI/support/Blob.js: Added.
(test_blob):
* web-platform-tests/FileAPI/support/document-domain-setter.sub.html: Added.
* web-platform-tests/FileAPI/support/historical-serviceworker.js: Added.
(test):
* web-platform-tests/FileAPI/support/incumbent.sub.html: Added.
* web-platform-tests/FileAPI/support/upload.txt: Added.
* web-platform-tests/FileAPI/support/url-origin.html: Added.
* web-platform-tests/FileAPI/support/w3c-import.log: Added.
* web-platform-tests/FileAPI/url/blob-url-in-sandboxed-iframe-expected.txt: Added.
* web-platform-tests/FileAPI/url/blob-url-in-sandboxed-iframe.html: Added.
* web-platform-tests/FileAPI/url/multi-global-origin-serialization.sub-expected.txt: Added.
* web-platform-tests/FileAPI/url/multi-global-origin-serialization.sub.html: Added.
* web-platform-tests/FileAPI/url/origin.sub-expected.txt: Added.
* web-platform-tests/FileAPI/url/origin.sub.html: Added.
* web-platform-tests/FileAPI/url/url_createobjecturl_blob-expected.txt: Added.
* web-platform-tests/FileAPI/url/url_createobjecturl_blob.html: Added.
* web-platform-tests/FileAPI/url/url_xmlhttprequest-expected.txt: Added.
* web-platform-tests/FileAPI/url/url_xmlhttprequest.html: Added.
* web-platform-tests/FileAPI/url/url_xmlhttprequest_img-expected.html: Added.
* web-platform-tests/FileAPI/url/url_xmlhttprequest_img.html: Added.
* web-platform-tests/FileAPI/url/w3c-import.log: Added.
* web-platform-tests/FileAPI/w3c-import.log: Added.

LayoutTests:

* TestExpectations:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216975 268f45cc-cd09-0410-ab3c-d52691b4dbfc

3 years agoAdd a RuntimeEnabledFeature for display: contents, defaulted to false.
commit-queue@webkit.org [Wed, 17 May 2017 15:51:41 +0000 (15:51 +0000)]
Add a RuntimeEnabledFeature for display: contents, defaulted to false.
https://bugs.webkit.org/show_bug.cgi?id=171984

Patch by Emilio Cobos Ãlvarez <ecobos@igalia.com> on 2017-05-17
Reviewed by Antti Koivisto.

LayoutTests/imported/w3c:

* web-platform-tests/innerText/getter-expected.txt:

Source/WebCore:

The "defaulted to false" is not only because there are spec issues,
but because I ran the WPT suite, and there was a fair amount of
crashes and messed render trees.

* css/StyleResolver.cpp:
(WebCore::StyleResolver::adjustRenderStyle):
* page/RuntimeEnabledFeatures.h:
(WebCore::RuntimeEnabledFeatures::setDisplayContentsEnabled):
(WebCore::RuntimeEnabledFeatures::displayContentsEnabled):

Source/WebKit/mac:

* WebView/WebPreferenceKeysPrivate.h:
* WebView/WebPreferences.mm:
(+[WebPreferences initialize]):
(-[WebPreferences displayContentsEnabled]):
(-[WebPreferences setDisplayContentsEnabled:]):
* WebView/WebPreferencesPrivate.h:
* WebView/WebView.mm:
(-[WebView _preferencesChanged:]):

Source/WebKit2:

* Shared/WebPreferencesDefinitions.h:
* UIProcess/API/C/WKPreferences.cpp:
(WKPreferencesSetDisplayContentsEnabled):
(WKPreferencesGetDisplayContentsEnabled):
* UIProcess/API/C/WKPreferencesRefPrivate.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::updatePreferences):

Tools:

* DumpRenderTree/mac/DumpRenderTree.mm:
(enableExperimentalFeatures):
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::resetPreferencesToConsistentValues):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216974 268f45cc-cd09-0410-ab3c-d52691b4dbfc

3 years agoRegression (198943): <marquee> shouldn't wrap text
antti@apple.com [Wed, 17 May 2017 15:12:48 +0000 (15:12 +0000)]
Regression (198943): <marquee> shouldn't wrap text
https://bugs.webkit.org/show_bug.cgi?id=172217

Reviewed by Andreas Kling.

Source/WebCore:

RenderMarquee::updateMarqueeStyle mutated the style and then expected it to inherit to children.
This doesn't work anymore because render tree construction is now separated from style resolution
where inheritance happens.

Test: fast/html/marquee-child-wrap.html

* css/StyleResolver.cpp:
(WebCore::StyleResolver::adjustRenderStyle):

    Implement marquee hacks in adjustRenderStyle instead. This can't do the childrenInline check
    the previous code had but it wasn't working anyway (there are no children when updateMarqueeStyle
    gets called).

* rendering/RenderMarquee.cpp:
(WebCore::RenderMarquee::updateMarqueeStyle):

    This no longer needs mutable style.

LayoutTests:

* fast/html/marquee-child-wrap-expected.html: Added.
* fast/html/marquee-child-wrap.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216973 268f45cc-cd09-0410-ab3c-d52691b4dbfc

3 years agoREGRESSION (r216966): fast/shadow-dom/slot-crash.html started to fail
ddkilzer@apple.com [Wed, 17 May 2017 11:58:38 +0000 (11:58 +0000)]
REGRESSION (r216966): fast/shadow-dom/slot-crash.html started to fail

Unreviewed test gardening.

Update test results after the fix for:
    Do not skip <slot> children when collecting content for innerText.
    https://bugs.webkit.org/show_bug.cgi?id=172113
    <rdar://problem/30362324>

* fast/shadow-dom/slot-crash-expected.txt: Update results to add
a space to the end of the output.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216972 268f45cc-cd09-0410-ab3c-d52691b4dbfc

3 years agoUnreviewed. Fix the build with MEDIA_STREAM disabled after r216952.
carlosgc@webkit.org [Wed, 17 May 2017 08:01:18 +0000 (08:01 +0000)]
Unreviewed. Fix the build with MEDIA_STREAM disabled after r216952.

* UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
(WebKit::UserMediaPermissionRequestManagerProxy::requestUserMediaPermissionForFrame):
(WebKit::UserMediaPermissionRequestManagerProxy::enumerateMediaDevicesForFrame):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216971 268f45cc-cd09-0410-ab3c-d52691b4dbfc

3 years ago[Threaded Compositor] SHOULD NEVER BE REACHED in WebKit::CompositingRunLoop::updateCo...
carlosgc@webkit.org [Wed, 17 May 2017 07:18:56 +0000 (07:18 +0000)]
[Threaded Compositor] SHOULD NEVER BE REACHED in WebKit::CompositingRunLoop::updateCompleted
https://bugs.webkit.org/show_bug.cgi?id=172167

Reviewed by Michael Catanzaro.

This is still happening, even after r216182, less often but still happens. There are two conditions in which
this can happen:

 - Again in force repaint. r216182 fixed the case of force repaint called when update state is completed, but it
   can also crash if update state is inProgress or PendingAfterCompletion when m_coordinateUpdateCompletionWithClient
   is true.
 - When the threaded compositor is invalidated right after renderLayerTree() starts, but before it finishes.

* Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
(WebKit::ThreadedCompositor::invalidate): Invalidate the refresh monitor right after stopping updates in the
compositing run loop to ensure no more updates are scheduled.
(WebKit::ThreadedCompositor::renderLayerTree): Check the scene is still active before calling sceneUpdateFinished().
(WebKit::ThreadedCompositor::updateSceneState): Do not update m_coordinateUpdateCompletionWithClient when in
force repaint.
* Shared/CoordinatedGraphics/threadedcompositor/ThreadedDisplayRefreshMonitor.cpp:
(WebKit::ThreadedDisplayRefreshMonitor::dispatchDisplayRefreshCallback): Return early if the monitor has been invalidated.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216970 268f45cc-cd09-0410-ab3c-d52691b4dbfc

3 years ago[macOS Debug wk2] Layout test svg/animations/animations-paused-in-background-page...
cdumez@apple.com [Wed, 17 May 2017 05:26:10 +0000 (05:26 +0000)]
[macOS Debug wk2] Layout test svg/animations/animations-paused-in-background-page-iframe.html is flaky
https://bugs.webkit.org/show_bug.cgi?id=172183

Reviewed by Andreas Kling.

Fix test flakiness by using shouldBecome() instead of relying on a 30ms timer.

* svg/animations/animations-paused-in-background-page-iframe-expected.txt:
* svg/animations/animations-paused-in-background-page-iframe.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216969 268f45cc-cd09-0410-ab3c-d52691b4dbfc

3 years agoRemove C-style casts by using xmlDocPtr instead of void*
ddkilzer@apple.com [Wed, 17 May 2017 05:04:49 +0000 (05:04 +0000)]
Remove C-style casts by using xmlDocPtr instead of void*
<https://webkit.org/b/172189>

Reviewed by Alex Christensen.

* dom/TransformSource.h: Fix whitespace indentation.
(typedef PlatformTransformSource): Use xmlDocPtr not void*.
* dom/TransformSourceLibxslt.cpp:
(WebCore::TransformSource::~TransformSource): Remove cast.
* xml/XSLStyleSheetLibxslt.cpp:
(WebCore::XSLStyleSheet::document): Remove cast.
* xml/XSLTProcessorLibxslt.cpp:
(WebCore::xmlDocPtrFromNode): Remove casts.
* xml/parser/XMLDocumentParser.h:
(WebCore::xmlDocPtrForString): Update declaration to return
xmlDocPtr not void*.
* xml/parser/XMLDocumentParserLibxml2.cpp:
(WebCore::XMLDocumentParser::doEnd): Change type of local
variable from void* to xmlDocPtr.
(WebCore::xmlDocPtrForString): Update to return xmlDocPtr
not void*.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216968 268f45cc-cd09-0410-ab3c-d52691b4dbfc

3 years agoBring Notification.idl up to spec
commit-queue@webkit.org [Wed, 17 May 2017 03:22:38 +0000 (03:22 +0000)]
Bring Notification.idl up to spec
https://bugs.webkit.org/show_bug.cgi?id=172156

Patch by Sam Weinig <sam@webkit.org> on 2017-05-16
Reviewed by Chris Dumez.

Source/WebCore:

Test: http/tests/notifications/notification.html

* CMakeLists.txt:
* DerivedSources.make:
* WebCore.xcodeproj/project.pbxproj:
Add new files.

* Modules/notifications/Notification.cpp:
(WebCore::Notification::create):
(WebCore::Notification::Notification):
(WebCore::Notification::show):
(WebCore::directionString): Deleted.
(WebCore::Notification::permission): Deleted.
(WebCore::Notification::permissionString): Deleted.
* Modules/notifications/Notification.h:
* Modules/notifications/Notification.idl:
* Modules/notifications/NotificationClient.h:
* Modules/notifications/NotificationDirection.h: Added.
* Modules/notifications/NotificationPermission.h: Added.
* Modules/notifications/NotificationPermission.idl: Added.
* Modules/notifications/NotificationPermissionCallback.h:
* Modules/notifications/NotificationPermissionCallback.idl:
Bring up to spec, replacing DOMStrings with enums where appropriate and adding
additional readonly properties to Notification to mirror options provided
in construction.

Source/WebKit/mac:

* WebCoreSupport/WebNotificationClient.h:
* WebCoreSupport/WebNotificationClient.mm:
(generateNotificationID):
(WebNotificationClient::show):
(WebNotificationClient::cancel):
(WebNotificationClient::clearNotifications):
(WebNotificationClient::notificationObjectDestroyed):
(WebNotificationClient::requestPermission):
(WebNotificationClient::hasPendingPermissionRequests):
(WebNotificationClient::checkPermission):
(-[WebNotificationPolicyListener allow]):
(-[WebNotificationPolicyListener deny]):
* WebView/WebNotification.mm:
(-[WebNotification iconURL]):
(-[WebNotification dir]):
Simplify #ifdefs and update for enum vs String usage.

Source/WebKit2:

* Shared/WebCoreArgumentCoders.h:
* UIProcess/API/C/WKNotification.cpp:
(WKNotificationCopyDir):
* UIProcess/Notifications/WebNotification.cpp:
(WebKit::WebNotification::WebNotification):
* UIProcess/Notifications/WebNotification.h:
(WebKit::WebNotification::create):
(WebKit::WebNotification::dir):
* UIProcess/Notifications/WebNotificationManagerProxy.cpp:
(WebKit::WebNotificationManagerProxy::show):
* UIProcess/Notifications/WebNotificationManagerProxy.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::showNotification):
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* WebProcess/Notifications/NotificationPermissionRequestManager.cpp:
(WebKit::NotificationPermissionRequestManager::startRequest):
(WebKit::NotificationPermissionRequestManager::permissionLevel):
(WebKit::NotificationPermissionRequestManager::didReceiveNotificationPermissionDecision):
* WebProcess/Notifications/WebNotificationManager.cpp:
(WebKit::WebNotificationManager::policyForOrigin):
(WebKit::WebNotificationManager::show):
* WebProcess/WebCoreSupport/WebNotificationClient.cpp:
(WebKit::WebNotificationClient::checkPermission):
* WebProcess/WebCoreSupport/WebNotificationClient.h:
Update for enum vs String usage.

LayoutTests:

* http/tests/notifications/notification-expected.txt: Added.
* http/tests/notifications/notification.html: Added.
Add test for basic Notification API functionality.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216967 268f45cc-cd09-0410-ab3c-d52691b4dbfc

3 years agoDo not skip <slot> children when collecting content for innerText.
zalan@apple.com [Wed, 17 May 2017 02:33:28 +0000 (02:33 +0000)]
Do not skip <slot> children when collecting content for innerText.
https://bugs.webkit.org/show_bug.cgi?id=172113
<rdar://problem/30362324>

Reviewed by Ryosuke Niwa and Brent Fulgham.

Source/WebCore:

"display: contents" elements do not generate renderers but their children might.
This patch ensure that we don't skip them while collecting text content.

Test: fast/text/inner-text-should-include-slot-subtree.html

* editing/TextIterator.cpp:
(WebCore::TextIterator::advance):

LayoutTests:

* fast/text/inner-text-should-include-slot-subtree-expected.txt: Added.
* fast/text/inner-text-should-include-slot-subtree.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216966 268f45cc-cd09-0410-ab3c-d52691b4dbfc

3 years agoGCController::garbageCollectNowIfNotDoneRecently should request Async Full GCs
fpizlo@apple.com [Wed, 17 May 2017 02:11:43 +0000 (02:11 +0000)]
GCController::garbageCollectNowIfNotDoneRecently should request Async Full GCs
https://bugs.webkit.org/show_bug.cgi?id=172204

Reviewed by Saam Barati.

No new tests because existing tests will tell us if there is a problem.

The goal of this change is to reduce the likelihood that we block for a GC. We want it to be
benchmark-neutral.

It's a 0.14% speed-up on JetStream with 24% probability.

It's a 0.12% slow-down on PLT3 with 43% probability.

So it's neutral on my machine.

* bindings/js/GCController.cpp:
(WebCore::GCController::garbageCollectNowIfNotDoneRecently):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216965 268f45cc-cd09-0410-ab3c-d52691b4dbfc

3 years agoUnreviewed, fix LayoutTests/plugins/navigator-plugin-crash.html
jiewen_tan@apple.com [Wed, 17 May 2017 01:17:34 +0000 (01:17 +0000)]
Unreviewed, fix LayoutTests/plugins/navigator-plugin-crash.html
<rdar://problem/32236478>

* plugins/navigator-plugin-crash-expected.txt:
* plugins/navigator-plugin-crash.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216964 268f45cc-cd09-0410-ab3c-d52691b4dbfc

3 years agoFix the build
timothy_horton@apple.com [Wed, 17 May 2017 01:01:56 +0000 (01:01 +0000)]
Fix the build

* TestWebKitAPI/Tests/mac/PageVisibilityStateWithWindowChanges.mm:
(TestWebKitAPI::PageVisibilityStateWithWindowChanges::runTest):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216963 268f45cc-cd09-0410-ab3c-d52691b4dbfc

3 years ago[macOS] REGRESSION: Drag images for links with right-to-left titles are incorrect...
timothy_horton@apple.com [Wed, 17 May 2017 00:53:47 +0000 (00:53 +0000)]
[macOS] REGRESSION: Drag images for links with right-to-left titles are incorrect (172006)
https://bugs.webkit.org/show_bug.cgi?id=172006
<rdar://problem/32165137>

Reviewed by Dean Jackson.

* platform/mac/DragImageMac.mm:
(WebCore::LinkImageLayout::LinkImageLayout):
(WebCore::createDragImageForLink):
(WebCore::LinkImageLayout::addLine): Deleted.
* platform/spi/cocoa/CoreTextSPI.h:
Set and paint the entire frame as a single unit, making use of the
CTFrameMaximumNumberOfLines attribute to limit the number of lines.
This gives CoreText power over text alignment and makes RTL text lay
out correctly.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216962 268f45cc-cd09-0410-ab3c-d52691b4dbfc

3 years agoPageVisibilityStateWithWindowChanges tests sometimes time out
timothy_horton@apple.com [Wed, 17 May 2017 00:51:48 +0000 (00:51 +0000)]
PageVisibilityStateWithWindowChanges tests sometimes time out
https://bugs.webkit.org/show_bug.cgi?id=172202
<rdar://problem/29653266>

Reviewed by Dean Jackson.

* TestWebKitAPI/Tests/mac/PageVisibilityStateWithWindowChanges.mm:
(TestWebKitAPI::PageVisibilityStateWithWindowChanges::runTest):
Make sure the window is miniaturizable, otherwise, in some cases, miniaturize: will not work.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216961 268f45cc-cd09-0410-ab3c-d52691b4dbfc

3 years agoREGRESSION(r216763): JetStream is 1% slower on Mac
msaboff@apple.com [Wed, 17 May 2017 00:12:36 +0000 (00:12 +0000)]
REGRESSION(r216763): JetStream is 1% slower on Mac
https://bugs.webkit.org/show_bug.cgi?id=172124

Reviewed by Filip Pizlo.

It appears that changing maxScavengeSleepDuration from 512 to 250ms in r216763 is
responsible for the regression.

* bmalloc/Sizes.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216960 268f45cc-cd09-0410-ab3c-d52691b4dbfc

3 years agoImplement DOMMatrix / DOMMatrixReadOnly
cdumez@apple.com [Tue, 16 May 2017 23:45:13 +0000 (23:45 +0000)]
Implement DOMMatrix / DOMMatrixReadOnly
https://bugs.webkit.org/show_bug.cgi?id=110001

Reviewed by Sam Weinig and Simon Fraser.

LayoutTests/imported/w3c:

Rebaseline web-platform-tests now that more checks are passing.

* web-platform-tests/css/geometry-1/DOMMatrix-001-expected.txt:
Most checks are now passing. The few remaining failures seem to be due to our
parsing of the input CSS string now matching the specification. This behavior
is not new to this patch as I re-used exactly the same logic as for
WebKitCSSMatrix's parsing of the input string.

* web-platform-tests/css/geometry-1/DOMMatrix-002-expected.txt:
* web-platform-tests/css/geometry-1/DOMMatrix-003-expected.txt:
* web-platform-tests/css/geometry-1/DOMMatrix-a-f-alias-expected.txt:
All checks are now passing.

* web-platform-tests/css/geometry-1/DOMMatrix-newobject-expected.txt:
Most checks are now passing. The remaining failures are due to DOMMatrixReadOnly's
transformPoint() / toFloat32Array() / toFloat64Array() not being implemented in
this patch. I think we can take care of those in a follow-up.

* web-platform-tests/css/geometry-1/DOMPoint-002-expected.txt:
Fails differently now that we support DOMMatrix. The test goes further but still
fails because DOMPoint.matrixTransform() is not implemented.

* web-platform-tests/css/geometry-1/WebKitCSSMatrix-expected.txt:
One more check is passing now that we implement DOMMatrix. The remaining failure is
due to WebKitCSSMatrix not being an alias to DOMMatrix yet. I'd rather do this in a
follow-up.

* web-platform-tests/css/geometry-1/historical-expected.txt:
A lot of new passes.

* web-platform-tests/css/geometry-1/structured-serialization-expected.txt:
The test fails differently now that we support DOMMatrix. The test still fails because
we do not support yet the structured serialization of DOMMatrix objects. It appears we
do not support this for other types in this spec either (e.g. DOMPoint). I filed:
https://bugs.webkit.org/show_bug.cgi?id=172191

* web-platform-tests/css/geometry-1/DOMMatrix-stringifier-expected.txt: Added.
* web-platform-tests/css/geometry-1/DOMMatrix-stringifier.html: Added.
Import new test from upstream. The WebKitCSSMatrix failures are due to our
WebKitCSSMatrix implementation not complying with the standard. As per the
standard, WebKitCSSMatrix is supposed to become an alias to DOMMatrix. If we
do this aliasing (in a follow-up), then those tests will start passing.

* web-platform-tests/css/geometry-1/support/dommatrix-test-util.js: Added.
Add missing script that was missed by the importer when I initially imported the test
suite from upstream.

Source/WebCore:

Implement DOMMatrix / DOMMatrixReadOnly as per:
- https://drafts.fxtf.org/geometry/#DOMMatrix

For now, these new types co-exist with WebKitCSSMatrix / SVGMatrix. However, in the future,
WebKitCSSMatrix / SVGMatrix are supposed to become aliases to DOMMatrix.

Most of it has been implemented. What remaining to be implemented is:
- Make WebKitCSSMatrix / SVGMatrix aliases to DOMMatrix
- DOMMatrix.fromFloat32Array() / fromFloat64Array()
- DOMMatrixReadOnly.fromFloat32Array() / fromFloat64Array() / toFloat32Array() / toFloat64Array()
- DOMMatrixReadOnly.transformPoint().

Tests: imported/w3c/web-platform-tests/css/geometry-1/*

* CMakeLists.txt:
* DerivedSources.make:
* WebCore.xcodeproj/project.pbxproj:

* bindings/scripts/CodeGeneratorJS.pm:
* bindings/scripts/test/JS/JSTestObj.cpp:
Fix a bug in the bindings generator causing the generator code for
"Constructor(optional (DOMString or sequence<unrestricted double>) init)" to be wrong
and not build.

* css/DOMMatrix.cpp: Added.
(WebCore::DOMMatrix::DOMMatrix):
(WebCore::DOMMatrix::fromMatrix):
(WebCore::DOMMatrix::multiplySelf):
(WebCore::DOMMatrix::preMultiplySelf):
(WebCore::DOMMatrix::translateSelf):
(WebCore::DOMMatrix::scaleSelf):
(WebCore::DOMMatrix::scale3dSelf):
(WebCore::DOMMatrix::rotateSelf):
(WebCore::DOMMatrix::rotateFromVectorSelf):
(WebCore::DOMMatrix::rotateAxisAngleSelf):
(WebCore::DOMMatrix::skewXSelf):
(WebCore::DOMMatrix::skewYSelf):
(WebCore::DOMMatrix::invertSelf):
(WebCore::DOMMatrix::setMatrixValueForBindings):
* css/DOMMatrix.h: Added.
(WebCore::DOMMatrix::create):
(WebCore::DOMMatrix::setA):
(WebCore::DOMMatrix::setB):
(WebCore::DOMMatrix::setC):
(WebCore::DOMMatrix::setD):
(WebCore::DOMMatrix::setE):
(WebCore::DOMMatrix::setF):
(WebCore::DOMMatrix::setM11):
(WebCore::DOMMatrix::setM12):
(WebCore::DOMMatrix::setM13):
(WebCore::DOMMatrix::setM14):
(WebCore::DOMMatrix::setM21):
(WebCore::DOMMatrix::setM22):
(WebCore::DOMMatrix::setM23):
(WebCore::DOMMatrix::setM24):
(WebCore::DOMMatrix::setM31):
(WebCore::DOMMatrix::setM32):
(WebCore::DOMMatrix::setM33):
(WebCore::DOMMatrix::setM34):
(WebCore::DOMMatrix::setM41):
(WebCore::DOMMatrix::setM42):
(WebCore::DOMMatrix::setM43):
(WebCore::DOMMatrix::setM44):
* css/DOMMatrix.idl: Added.
* css/DOMMatrixInit.h: Added.
* css/DOMMatrixInit.idl: Added.
* css/DOMMatrixReadOnly.cpp: Added.
(WebCore::DOMMatrixReadOnly::DOMMatrixReadOnly):
(WebCore::DOMMatrixReadOnly::validateAndFixup):
(WebCore::DOMMatrixReadOnly::fromMatrix):
(WebCore::DOMMatrixReadOnly::isIdentity):
(WebCore::DOMMatrixReadOnly::setMatrixValue):
(WebCore::DOMMatrixReadOnly::translate):
(WebCore::DOMMatrixReadOnly::flipX):
(WebCore::DOMMatrixReadOnly::flipY):
(WebCore::DOMMatrixReadOnly::multiply):
(WebCore::DOMMatrixReadOnly::scale):
(WebCore::DOMMatrixReadOnly::scale3d):
(WebCore::DOMMatrixReadOnly::rotate):
(WebCore::DOMMatrixReadOnly::rotateFromVector):
(WebCore::DOMMatrixReadOnly::rotateAxisAngle):
(WebCore::DOMMatrixReadOnly::skewX):
(WebCore::DOMMatrixReadOnly::skewY):
(WebCore::DOMMatrixReadOnly::inverse):
(WebCore::DOMMatrixReadOnly::toString):
* css/DOMMatrixReadOnly.h: Added.
(WebCore::DOMMatrixReadOnly::create):
(WebCore::DOMMatrixReadOnly::a):
(WebCore::DOMMatrixReadOnly::b):
(WebCore::DOMMatrixReadOnly::c):
(WebCore::DOMMatrixReadOnly::d):
(WebCore::DOMMatrixReadOnly::e):
(WebCore::DOMMatrixReadOnly::f):
(WebCore::DOMMatrixReadOnly::m11):
(WebCore::DOMMatrixReadOnly::m12):
(WebCore::DOMMatrixReadOnly::m13):
(WebCore::DOMMatrixReadOnly::m14):
(WebCore::DOMMatrixReadOnly::m21):
(WebCore::DOMMatrixReadOnly::m22):
(WebCore::DOMMatrixReadOnly::m23):
(WebCore::DOMMatrixReadOnly::m24):
(WebCore::DOMMatrixReadOnly::m31):
(WebCore::DOMMatrixReadOnly::m32):
(WebCore::DOMMatrixReadOnly::m33):
(WebCore::DOMMatrixReadOnly::m34):
(WebCore::DOMMatrixReadOnly::m41):
(WebCore::DOMMatrixReadOnly::m42):
(WebCore::DOMMatrixReadOnly::m43):
(WebCore::DOMMatrixReadOnly::m44):
(WebCore::DOMMatrixReadOnly::is2D):
(WebCore::DOMMatrixReadOnly::fromMatrixHelper):
* css/DOMMatrixReadOnly.idl: Added.
* css/WebKitCSSMatrix.h:
* css/WebKitCSSMatrix.idl:
* svg/SVGMatrix.h:
* svg/SVGMatrix.idl:

LayoutTests:

Drop test I previously added now that a better version landed in web-platform-tests
and was re-imported in this patch.

* fast/css/matrix-stringifier-expected.txt: Removed.
* fast/css/matrix-stringifier.html: Removed.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216959 268f45cc-cd09-0410-ab3c-d52691b4dbfc

3 years agowebkitpy: Start servers before setting-up for testing
jbedard@apple.com [Tue, 16 May 2017 23:19:18 +0000 (23:19 +0000)]
webkitpy: Start servers before setting-up for testing
https://bugs.webkit.org/show_bug.cgi?id=172176
<rdar://problem/32225538>

Reviewed by Alexey Proskuryakov.

On-device testing requires that servers are started before ports set-up their
test environments.

* Scripts/webkitpy/layout_tests/controllers/layout_test_runner.py:
(LayoutTestRunner.__init__): Start servers when initializing LayoutTestRunner.
(LayoutTestRunner.run_tests): Move the starting of servers to the initializer.
* Scripts/webkitpy/layout_tests/controllers/manager.py:
(Manager.__init__): Delay construction of the test runner until we can determine
if servers need to be started.
(Manager.run): Determine if servers need to be started and construct the test runner.
(Manager._run_tests): Move the determination of servers to run into Manager.run.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216955 268f45cc-cd09-0410-ab3c-d52691b4dbfc

3 years ago[MediaStream] AudioSampleBufferList::zeroABL takes byte count, not sample count
eric.carlson@apple.com [Tue, 16 May 2017 23:10:45 +0000 (23:10 +0000)]
[MediaStream] AudioSampleBufferList::zeroABL takes byte count, not sample count
https://bugs.webkit.org/show_bug.cgi?id=172194
<rdar://problem/32233799>

Reviewed by Jer Noble.

* platform/mediastream/mac/AudioTrackPrivateMediaStreamCocoa.cpp:
(WebCore::AudioTrackPrivateMediaStreamCocoa::render): Pass number of bytes to zero,
not number of samples.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216954 268f45cc-cd09-0410-ab3c-d52691b4dbfc

3 years agoWorkerRunLoop::Task::performTask() needs to null check context->script() before use.
mark.lam@apple.com [Tue, 16 May 2017 23:06:53 +0000 (23:06 +0000)]
WorkerRunLoop::Task::performTask() needs to null check context->script() before use.
https://bugs.webkit.org/show_bug.cgi?id=172193
<rdar://problem/32225346>

Reviewed by Filip Pizlo.

According to https://build-safari.apple.com/results/Trunk%20Fuji%20GuardMalloc%20Production%20WK2%20Tests/r216929_459760e0918316187c8e52c6585a3a9ba9181204%20(12066)/results.html,
we see a crash with this crash trace:

Thread 13 Crashed:: WebCore: Worker
0 com.apple.WebCore        0x00000001099607b2 WebCore::WorkerScriptController::isTerminatingExecution() const + 18
1 com.apple.WebCore        0x000000010995ebbf WebCore::WorkerRunLoop::runCleanupTasks(WebCore::WorkerGlobalScope*) + 143
2 com.apple.WebCore        0x000000010995e80f WebCore::WorkerRunLoop::run(WebCore::WorkerGlobalScope*) + 111
3 com.apple.WebCore        0x00000001099621b6 WebCore::WorkerThread::workerThread() + 742
4 com.apple.JavaScriptCore 0x000000010a964b92 WTF::threadEntryPoint(void*) + 178
5 com.apple.JavaScriptCore 0x000000010a964a69 WTF::wtfThreadEntryPoint(void*) + 121
6 libsystem_pthread.dylib  0x00007fffbdb5caab _pthread_body + 180
7 libsystem_pthread.dylib  0x00007fffbdb5c9f7 _pthread_start + 286
8 libsystem_pthread.dylib  0x00007fffbdb5c1fd thread_start + 13

... and the crashing address is:

Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000022

0x0000000000000022 is the offset of m_scheduledTerminationMutex in the
WorkerScriptController.  This means that WorkerScriptController::isTerminatingExecution()
is passed a NULL this pointer.  This means that it's possible to have a race
where a WorkerRunLoop::Task gets enqueued beyond the Cleanup task that deletes the
context->script().  As a result, WorkerRunLoop::Task::performTask() (called by
runCleanupTasks()) may see a null context->script().

Hence, WorkerRunLoop::Task::performTask() should null check context->script()
before invoking the isTerminatingExecution() query on it.

No new tests because this is already covered by existing tests.

* workers/WorkerRunLoop.cpp:
(WebCore::WorkerRunLoop::Task::performTask):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216953 268f45cc-cd09-0410-ab3c-d52691b4dbfc

3 years agoModernize WebKit2 getUserMedia passing of parameters
commit-queue@webkit.org [Tue, 16 May 2017 22:49:59 +0000 (22:49 +0000)]
Modernize WebKit2 getUserMedia passing of parameters
https://bugs.webkit.org/show_bug.cgi?id=172161

Patch by Youenn Fablet <youenn@apple.com> on 2017-05-16
Reviewed by Eric Carlson.

Source/WebCore:

No change of behavior.

* platform/mediastream/RealtimeMediaSourceCenter.h: Using WTF::Function to enable capture Ref<>.

Source/WebKit2:

Passing SecurityOrigin as SecurityOriginData through IPC instead of Strings.
Making more use of Ref<> instead of RefPtr<>.

* UIProcess/UserMediaPermissionCheckProxy.cpp:
(WebKit::UserMediaPermissionCheckProxy::UserMediaPermissionCheckProxy):
(WebKit::UserMediaPermissionCheckProxy::setUserMediaAccessInfo):
* UIProcess/UserMediaPermissionCheckProxy.h:
(WebKit::UserMediaPermissionCheckProxy::create):
(WebKit::UserMediaPermissionCheckProxy::userMediaDocumentSecurityOrigin):
(WebKit::UserMediaPermissionCheckProxy::topLevelDocumentSecurityOrigin):
(WebKit::UserMediaPermissionCheckProxy::completionHandler):
* UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
(WebKit::FrameAuthorizationState::FrameAuthorizationState):
(WebKit::FrameAuthorizationState::ensureSecurityOriginsAreEqual):
(WebKit::UserMediaPermissionRequestManagerProxy::createRequest):
(WebKit::UserMediaPermissionRequestManagerProxy::requestUserMediaPermissionForFrame):
(WebKit::UserMediaPermissionRequestManagerProxy::getUserMediaPermissionInfo):
(WebKit::UserMediaPermissionRequestManagerProxy::enumerateMediaDevicesForFrame):
* UIProcess/UserMediaPermissionRequestManagerProxy.h:
* UIProcess/UserMediaPermissionRequestProxy.cpp:
(WebKit::UserMediaPermissionRequestProxy::UserMediaPermissionRequestProxy):
* UIProcess/UserMediaPermissionRequestProxy.h:
(WebKit::UserMediaPermissionRequestProxy::create):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::requestUserMediaPermissionForFrame):
(WebKit::WebPageProxy::enumerateMediaDevicesForFrame):
(WebKit::WebPageProxy::requestNotificationPermission):
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* WebProcess/MediaStream/UserMediaPermissionRequestManager.cpp:
(WebKit::UserMediaPermissionRequestManager::sendUserMediaRequest):
(WebKit::UserMediaPermissionRequestManager::enumerateMediaDevices):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216952 268f45cc-cd09-0410-ab3c-d52691b4dbfc

3 years agoCaptions and subtitles not showing up in picture-in-picture for MSE content.
commit-queue@webkit.org [Tue, 16 May 2017 22:27:13 +0000 (22:27 +0000)]
Captions and subtitles not showing up in picture-in-picture for MSE content.
https://bugs.webkit.org/show_bug.cgi?id=172145

Patch by Jeremy Jones <jeremyj@apple.com> on 2017-05-16
Reviewed by Eric Carlson.

No new tests as this has no affect on the DOM.

Add TextTrackRepresentation code from MediaPlayerPrivateAVFoundationObj to MediaPlayerPrivateMediaSourceAVFObjc.
This moves the TextTrackRepresentation platfrom layer into the fullscreen container layer when going into
pip for fullscreen, allowing the captions to be visible.

* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
* platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::ensureLayer):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setVideoFullscreenLayer):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setVideoFullscreenFrame):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::requiresTextTrackRepresentation):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::syncTextTrackBounds):
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setTextTrackRepresentation):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216951 268f45cc-cd09-0410-ab3c-d52691b4dbfc

3 years agoWebCore::leakCGColor() needs CF_RETURNS_RETAINED annotation
ddkilzer@apple.com [Tue, 16 May 2017 22:20:08 +0000 (22:20 +0000)]
WebCore::leakCGColor() needs CF_RETURNS_RETAINED annotation
<https://webkit.org/b/172190>

Reviewed by Simon Fraser.

* platform/graphics/cg/ColorCG.cpp:
(WebCore::leakCGColor): Annotate with CF_RETURNS_RETAINED since
it does not follow the CF naming convention, which means the
expected behavior can't be inferred by the clang static
analyzer.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216949 268f45cc-cd09-0410-ab3c-d52691b4dbfc

3 years ago[DFG] Constant Folding Phase should convert MakeRope("", String) => Identity(String)
utatane.tea@gmail.com [Tue, 16 May 2017 21:54:01 +0000 (21:54 +0000)]
[DFG] Constant Folding Phase should convert MakeRope("", String) => Identity(String)
https://bugs.webkit.org/show_bug.cgi?id=172115

Reviewed by Saam Barati.

JSTests:

* stress/constant-folding-should-fold-make-rope-with-empty-strings.js: Added.
(shouldBe):
(unknown):
(readWord1):
(readWord2):
(readWord3):
(readWord4):

Source/JavaScriptCore:

In Fixup phase, we attempt to fold MakeRope to Identity (or reduce arguments) by dropping
empty strings. However, when we are in Fixup phase, we do not have much information about
constant values.

In ARES-6 Babylon, we find that we can constant-fold MakeRope by using constants figured
out by CFA. Without it, Babylon repeatedly produces rope strings. To fix this, we introduce
MakeRope handling in constant folding phase.

It shows 7.5% performance improvement in ARES-6 Babylon steadyState.

    Before:

    firstIteration:     50.02 +- 14.56 ms
    averageWorstCase:   26.52 +- 4.52 ms
    steadyState:        8.15 +- 0.23 ms

    After:

    firstIteration:     49.08 +- 12.90 ms
    averageWorstCase:   25.16 +- 3.82 ms
    steadyState:        7.58 +- 0.21 ms

* dfg/DFGAbstractInterpreterInlines.h:
(JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):
* dfg/DFGConstantFoldingPhase.cpp:
(JSC::DFG::ConstantFoldingPhase::foldConstants):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216948 268f45cc-cd09-0410-ab3c-d52691b4dbfc

3 years agoRealtimeOutgoingVideoSource should support sinkWants for rotation
commit-queue@webkit.org [Tue, 16 May 2017 21:18:19 +0000 (21:18 +0000)]
RealtimeOutgoingVideoSource should support sinkWants for rotation
https://bugs.webkit.org/show_bug.cgi?id=172123
<rdar://problem/32200017>

Patch by Youenn Fablet <youenn@apple.com> on 2017-05-16
Reviewed by Eric Carlson.

Source/ThirdParty/libwebrtc:

* Source/webrtc/api/video/i420_buffer.h: Exporting rotate routine.

Source/WebCore:

Covered by manual testing.

* platform/mediastream/mac/RealtimeOutgoingVideoSource.cpp:
(WebCore::RealtimeOutgoingVideoSource::AddOrUpdateSink): Triggering pixel rotation based on sink.
(WebCore::RealtimeOutgoingVideoSource::sendFrame): Doing the rotation using libwebrtc API.
* platform/mediastream/mac/RealtimeOutgoingVideoSource.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216947 268f45cc-cd09-0410-ab3c-d52691b4dbfc

3 years agoUpdate to Speedometer 2.0 w/updated frameworks + new workloads
commit-queue@webkit.org [Tue, 16 May 2017 21:16:51 +0000 (21:16 +0000)]
Update to Speedometer 2.0 w/updated frameworks + new workloads
https://bugs.webkit.org/show_bug.cgi?id=170513

Patch by Addy Osmani <addyosmani@gmail.com> on 2017-05-16
Reviewed by Ryosuke Niwa.

Refresh test runner and fix apps to work with it.

* Speedometer/InteractiveRunner.html:
(parseQueryString): Adds support for startAutomatically query parameter.
* Speedometer/resources/tests.js:
(triggerEnter): Refactor event triggering behavior for tests.
* Speedometer/resources/todomvc/architecture-examples/angular/dist/index.html:
(CSS): Drop reference to extraneous stylesheet in Angular TodoMVC.
* Speedometer/resources/todomvc/architecture-examples/emberjs/assets/todomvc.js:
* Speedometer/resources/todomvc/architecture-examples/emberjs/index.html:
(base): Enable Ember TodoMVC to be run from any directory/level.
* Speedometer/resources/todomvc/architecture-examples/emberjs/source/app/services/memory.js:
(localStorageMemory): Correct import path and switch to window.localStorageMemory to fix Ember failures.
* Speedometer/resources/todomvc/architecture-examples/emberjs/source/app/services/repo.js:
* Speedometer/resources/todomvc/architecture-examples/emberjs/tests/index.html:
* Speedometer/resources/todomvc/architecture-examples/jquery/index.html:
* Speedometer/resources/todomvc/architecture-examples/jquery/node_modules/director/LICENSE: Added.
(LICENSE): Add missing metadata and LICENSE files as part of director.js package for jQuery TodoMVC
* Speedometer/resources/todomvc/architecture-examples/jquery/node_modules/director/bower.json: Added.
* Speedometer/resources/todomvc/architecture-examples/jquery/node_modules/director/dist/director.js: Add missing
director.js dependency for jQuery TodoMVC implementation.
* Speedometer/resources/todomvc/architecture-examples/jquery/node_modules/director/dist/director.min.js: Added.
* Speedometer/resources/todomvc/architecture-examples/jquery/node_modules/director/dist/ender.js: Added.
* Speedometer/resources/todomvc/architecture-examples/jquery/node_modules/director/package.json: Added.
* Speedometer/resources/todomvc/functional-prog-examples/elm/index.html: Fix path to built Elm TodoMVC scripts.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216946 268f45cc-cd09-0410-ab3c-d52691b4dbfc

3 years agoUnused lambdas in UserMediaPermissionRequestManagerProxy.cpp
ddkilzer@apple.com [Tue, 16 May 2017 21:02:56 +0000 (21:02 +0000)]
Unused lambdas in UserMediaPermissionRequestManagerProxy.cpp
<https://webkit.org/b/172179>

Reviewed by Eric Carlson.

Fixes unused lambda warnings found with newer clang:

    Source/WebKit2/UIProcess/UserMediaPermissionRequestManagerProxy.cpp:309:46: error: lambda capture 'userMediaID' is not used [-Werror,-Wunused-lambda-capture]
        auto validateConstraintsHandler = [this, userMediaID, validHandler = WTFMove(validHandler), invalidHandler = WTFMove(invalidHandler), audioConstraints = WebCore::MediaConstraints(audioConstraints), videoConstraints = WebCore::MediaConstraints(videoConstraints)](String&& deviceIdentifierHashSalt) mutable {
                                                 ^
    Source/WebKit2/UIProcess/UserMediaPermissionRequestManagerProxy.cpp:318:41: error: lambda capture 'userMediaID' is not used [-Werror,-Wunused-lambda-capture]
        auto haveDeviceSaltHandler = [this, userMediaID, frameID, validateConstraintsHandler = WTFMove(validateConstraintsHandler)](uint64_t userMediaID, String&& deviceIdentifierHashSalt, bool originHasPersistentAccess) mutable {
                                            ^
    Source/WebKit2/UIProcess/UserMediaPermissionRequestManagerProxy.cpp:318:54: error: lambda capture 'frameID' is not used [-Werror,-Wunused-lambda-capture]
        auto haveDeviceSaltHandler = [this, userMediaID, frameID, validateConstraintsHandler = WTFMove(validateConstraintsHandler)](uint64_t userMediaID, String&& deviceIdentifierHashSalt, bool originHasPersistentAccess) mutable {
                                                         ^
    Source/WebKit2/UIProcess/UserMediaPermissionRequestManagerProxy.cpp:362:37: error: lambda capture 'userMediaID' is not used [-Werror,-Wunused-lambda-capture]
        auto completionHandler = [this, userMediaID](uint64_t userMediaID, String&& deviceIdentifierHashSalt, bool originHasPersistentAccess) {
                                        ^

* UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
(WebKit::UserMediaPermissionRequestManagerProxy::requestUserMediaPermissionForFrame):
(WebKit::UserMediaPermissionRequestManagerProxy::enumerateMediaDevicesForFrame):
- Remove unused lambdas.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216945 268f45cc-cd09-0410-ab3c-d52691b4dbfc

3 years agoREGRESSION(r212513): LastResort is platform-dependent, so its semantics should not...
mmaxfield@apple.com [Tue, 16 May 2017 20:26:39 +0000 (20:26 +0000)]
REGRESSION(r212513): LastResort is platform-dependent, so its semantics should not be required to perform font loading correctly.
https://bugs.webkit.org/show_bug.cgi?id=168487

Reviewed by Antti Koivisto.

Source/WebCore:

There are three ways a Web author can chain multiple font files together:
1. Multiple entries in the "src" descriptor in an @font-face rule
2. Multiple @font-face rules with the same "font-family" descriptor
3. Multiple entries in the "font-family" property on an element

Before r212513, the code which iterated across #2 and #3 above could have
triggered each item in the chain to download. r212513 tried to solve this
by using LastResort as the interstitial font used during downloads, because
LastResort supports every character and therefore solves #3 above. However,
this change had a few problems:

1. Previously, our code would try to avoid using the interstitial font for
layout or rendering whenever possible (because one of the chains above may
have named a local font which would be better to use). In order to use the
benefits of LastResort, I had to remove this avoidance logic and make
WebKit try to use the interstitial font as often as possible. However, due
to the large metrics of LastResort, this means that offsetWidth queries
during font loading would be wildly inaccurate, causing Google Docs to break.
2. It also means that canvas drawing during font loading would actually draw
LastResort, causing Bing maps to break.
3. LastResort is platform-specific, so only platforms which have it would
actually be able to load fonts correctly.

Instead, we should keep the older logic about avoiding using the
interstitial font so that loading has a better experience for the user.
We solve the unnecessary download problem by giving our loading code a
downloading policy enum, which has two values: allow downloads or forbid
downloads. Whenever our loading code returns the interstitial font, we
continue our search, but we change the policy to forbid downloads.

There is one piece of subtlety, though: It is more common for web authors
to put good fallbacks in the "font-family" property than in the "src"
descriptor inside @font-face. This means that we shouldn't exhaustively
search through the @font-face src list first. Instead, we should look
through the src list until we hit a non-local font, and then immediately
start looking through the other other chains.

Tests: fast/text/font-download-font-face-src-list.html
       fast/text/font-download-font-family-property.html
       fast/text/font-download-remote-fallback-all.html
       fast/text/font-interstitial-invisible-width-while-loading.html
       fast/text/font-weight-download-3.html
       fast/text/web-font-load-fallback-during-loading-2.html
       fast/text/web-font-load-invisible-during-loading.html

* css/CSSFontFace.cpp:
(WebCore::CSSFontFace::fontLoadEventOccurred): Implement support for
the font download policy.
(WebCore::CSSFontFace::setStatus): After 3 seconds of loading, we
will start drawing the fallback font. However, for testing, we have an
internal setting to make this switch happen immediately. This patch now
requires that this internal switch happen synchronously.
(WebCore::CSSFontFace::pump): Implement support for the font download
policy.
(WebCore::CSSFontFace::load): Ditto.
(WebCore::CSSFontFace::font): Ditto.
* css/CSSFontFace.h: Ditto.
* css/CSSFontSelector.cpp:
(WebCore::CSSFontSelector::beginLoadingFontSoon): Implement support for
synchronous font download timeouts.
* css/CSSSegmentedFontFace.cpp:
(WebCore::CSSSegmentedFontFace::fontRanges): Implement support for the
font download policy.
* platform/graphics/Font.cpp: Add new flag which represents if the
interstitial font was created after the 3 second timeout or before.
Previously, we would distinguish between these two cases by knowing
that one font was LastResort and the other font was a fallback. Now that
we're using fallback fonts on both sides of the 3 second timeout, we
now no longer know which one should be invisible. This new enum solves
this problem.
(WebCore::Font::Font):
(WebCore::Font::verticalRightOrientationFont):
(WebCore::Font::uprightOrientationFont):
* platform/graphics/Font.h: Ditto.
(WebCore::Font::create):
(WebCore::Font::origin):
(WebCore::Font::visibility):
* platform/graphics/FontCache.h:
* platform/graphics/FontCascade.cpp: We try to fall back to a local() font
during downloads, but there might not be one that we can use. Therefore, we
can't use the presence of the interstitial font to detect if we should paint
invisibly. Instead, we can move this logic into the font-specific part of
painting, and consult with the specific font to know if it was created from
a timed-out @font-face rule or not.
(WebCore::FontCascade::drawText):
(WebCore::shouldDrawIfLoading):
(WebCore::FontCascade::drawGlyphBuffer):
(WebCore::FontCascade::drawEmphasisMarks):
* platform/graphics/FontCascade.h:
* platform/graphics/FontCascadeFonts.cpp:
(WebCore::FontCascadeFonts::glyphDataForVariant): Implement the logic
described above where we switch the policy if we encounter the intestitial
font.
(WebCore::FontCascadeFonts::glyphDataForNormalVariant): Ditto.
(WebCore::glyphPageFromFontRanges): Ditto.
* platform/graphics/FontRanges.cpp: Implement support for the font download
policy.
(WebCore::FontRanges::Range::font):
(WebCore::FontRanges::glyphDataForCharacter):
(WebCore::FontRanges::fontForCharacter):
(WebCore::FontRanges::fontForFirstRange):
* platform/graphics/FontRanges.h:
* platform/graphics/FontSelector.h:
* platform/graphics/freetype/FontCacheFreeType.cpp:
(WebCore::FontCache::lastResortFallbackFontForEveryCharacter): Deleted.
* platform/graphics/mac/FontCacheMac.mm:
(WebCore::FontCache::lastResortFallbackFontForEveryCharacter): Deleted.
* platform/graphics/win/FontCacheWin.cpp:
(WebCore::FontCache::lastResortFallbackFontForEveryCharacter): Deleted.

LayoutTests:

* fast/text/font-download-font-face-src-list-expected.txt: Added.
* fast/text/font-download-font-face-src-list.html: Copied from LayoutTests/fast/text/font-weight-download-2.html.
* fast/text/font-download-font-family-property-expected.txt: Added.
* fast/text/font-download-font-family-property.html: Copied from LayoutTests/fast/text/font-weight-download-2.html.
* fast/text/font-download-remote-fallback-all-expected.txt: Added.
* fast/text/font-download-remote-fallback-all.html: Copied from LayoutTests/fast/text/font-weight-download-2.html.
* fast/text/font-interstitial-invisible-width-while-loading-expected.txt: Added.
* fast/text/font-interstitial-invisible-width-while-loading.html: Added.
* fast/text/font-weight-download-2.html:
* fast/text/font-weight-download-3-expected.txt: Added.
* fast/text/font-weight-download-3.html: Copied from LayoutTests/fast/text/font-weight-download-2.html.
* fast/text/web-font-load-fallback-during-loading-2-expected.html: Added.
* fast/text/web-font-load-fallback-during-loading-2.html: Added.
* fast/text/web-font-load-fallback-during-loading-expected.html:
* fast/text/web-font-load-fallback-during-loading.html:
* fast/text/web-font-load-invisible-during-loading-expected.txt: Added.
* fast/text/web-font-load-invisible-during-loading.html: Added.
* http/tests/webfont/fallback-font-while-loading-expected.txt:
* http/tests/webfont/fallback-font-while-loading.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216944 268f45cc-cd09-0410-ab3c-d52691b4dbfc

3 years ago[WK2][macOS] Support Flash Player DRM features
bfulgham@apple.com [Tue, 16 May 2017 19:54:45 +0000 (19:54 +0000)]
[WK2][macOS] Support Flash Player DRM features
https://bugs.webkit.org/show_bug.cgi?id=172157
<rdar://problem/31889297>

Reviewed by Dean Jackson.

Relax the IOKit whitelist to support DRM features needed by
some websites.

* PluginProcess/mac/com.apple.WebKit.plugin-common.sb.in:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216943 268f45cc-cd09-0410-ab3c-d52691b4dbfc

3 years agoAnother build fix. Added a missing null check.
rniwa@webkit.org [Tue, 16 May 2017 19:36:40 +0000 (19:36 +0000)]
Another build fix. Added a missing null check.

* public/v3/components/custom-analysis-task-configurator.js:
(CustomAnalysisTaskConfigurator.prototype._setUploadedFilesIfEmpty):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216942 268f45cc-cd09-0410-ab3c-d52691b4dbfc

3 years ago[WK2][macOS] Adopt a whitelist for XPC services
bfulgham@apple.com [Tue, 16 May 2017 19:09:05 +0000 (19:09 +0000)]
[WK2][macOS] Adopt a whitelist for XPC services
https://bugs.webkit.org/show_bug.cgi?id=172151
<rdar://problem/31916325>

Reviewed by Alex Christensen.

* DatabaseProcess/mac/com.apple.WebKit.Databases.sb.in:
* NetworkProcess/mac/com.apple.WebKit.NetworkProcess.sb.in:
* PluginProcess/mac/com.apple.WebKit.plugin-common.sb.in:
* WebProcess/com.apple.WebProcess.sb.in:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216941 268f45cc-cd09-0410-ab3c-d52691b4dbfc

3 years agoSimple line layout: Move setCollapedWhitespaceWidth call to updateLineConstrains.
zalan@apple.com [Tue, 16 May 2017 19:01:15 +0000 (19:01 +0000)]
Simple line layout: Move setCollapedWhitespaceWidth call to updateLineConstrains.
https://bugs.webkit.org/show_bug.cgi?id=172178

Reviewed by Antti Koivisto.

No change in functionality.

* rendering/SimpleLineLayout.cpp:
(WebCore::SimpleLineLayout::updateLineConstrains):
(WebCore::SimpleLineLayout::createLineRuns):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216940 268f45cc-cd09-0410-ab3c-d52691b4dbfc

3 years ago[MediaStream] Return default device list until user gives permission to capture
eric.carlson@apple.com [Tue, 16 May 2017 18:27:31 +0000 (18:27 +0000)]
[MediaStream] Return default device list until user gives permission to capture
https://bugs.webkit.org/show_bug.cgi?id=172168
<rdar://problem/31816884>

Reviewed by Youenn Fablet.

Source/WebCore:

Test: fast/mediastream/media-devices-enumerate-devices.html

* Modules/mediastream/MediaDevicesRequest.cpp:
(WebCore::MediaDevicesRequest::filterDeviceList): Remove all but the "default" number of
devices of each type.
(WebCore::MediaDevicesRequest::start): Call filterDeviceList.
* Modules/mediastream/MediaDevicesRequest.h:

LayoutTests:

* fast/mediastream/MediaDevices-enumerateDevices-expected.txt: Removed.
* fast/mediastream/MediaDevices-enumerateDevices.html: Removed.
* fast/mediastream/media-devices-enumerate-devices-expected.txt: Added.
* fast/mediastream/media-devices-enumerate-devices.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216938 268f45cc-cd09-0410-ab3c-d52691b4dbfc

3 years agoSilent a few warnings about unused parameters
csaavedra@igalia.com [Tue, 16 May 2017 18:18:31 +0000 (18:18 +0000)]
Silent a few warnings about unused parameters
https://bugs.webkit.org/show_bug.cgi?id=172169

Reviewed by Sam Weinig.

* page/Page.cpp:
(WebCore::Page::mainFrameLoadStarted):
* platform/graphics/cairo/ImageBufferCairo.cpp:
(WebCore::ImageBuffer::toData):
* platform/network/ResourceRequestBase.cpp:
(WebCore::ResourceRequestBase::partitionName):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216937 268f45cc-cd09-0410-ab3c-d52691b4dbfc

3 years agoWebItemProviderPasteboard should be robust when temporary files are missing path...
wenson_hsieh@apple.com [Tue, 16 May 2017 17:52:57 +0000 (17:52 +0000)]
WebItemProviderPasteboard should be robust when temporary files are missing path extensions
https://bugs.webkit.org/show_bug.cgi?id=172170

Reviewed by Tim Horton.

Makes a slight adjustment to the temporary file URLs are handled when using WebItemProviderPasteboard to load
data off of item providers. Previously, we would bail early and not load any data if the temporary URL is
missing an extension. Since the switch to NSItemProviders from UIItemProviders, some types of temporary files
generated by item providers are missing extensions, so this extra check is meaningless.

Covered by existing data interaction unit tests.

* platform/ios/WebItemProviderPasteboard.mm:
(temporaryFileURLForDataInteractionContent):
(-[WebItemProviderPasteboard doAfterLoadingProvidedContentIntoFileURLs:synchronousTimeout:]):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216936 268f45cc-cd09-0410-ab3c-d52691b4dbfc

3 years agoMake it possible to adjust which edges are affected by safe area insets
timothy_horton@apple.com [Tue, 16 May 2017 17:20:33 +0000 (17:20 +0000)]
Make it possible to adjust which edges are affected by safe area insets
https://bugs.webkit.org/show_bug.cgi?id=172149
<rdar://problem/31564729>

Reviewed by Beth Dakin.

* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _initializeWithConfiguration:]):
(-[WKWebView _computedContentInset]):
(-[WKWebView _obscuredInsetEdgesAffectedBySafeArea]):
(-[WKWebView _setObscuredInsetEdgesAffectedBySafeArea:]):
* UIProcess/API/Cocoa/WKWebViewPrivate.h:
Add SPI to adjust which edges are taken into account, and adjust the default.

* fast/viewport/ios/viewport-fit-auto-expected.txt:
* fast/viewport/ios/viewport-fit-contain-expected.txt:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216935 268f45cc-cd09-0410-ab3c-d52691b4dbfc

3 years agoGardening: rebased parser-syntax-check test results after r216891.
mark.lam@apple.com [Tue, 16 May 2017 17:12:16 +0000 (17:12 +0000)]
Gardening: rebased parser-syntax-check test results after r216891.
https://bugs.webkit.org/show_bug.cgi?id=172171

Not reviewed.

* js/parser-syntax-check-expected.txt:
* js/script-tests/parser-syntax-check.js:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216934 268f45cc-cd09-0410-ab3c-d52691b4dbfc

3 years agoSkip LayoutTest media/restricted-audio-playback-with-document-gesture.html on iOS.
ryanhaddad@apple.com [Tue, 16 May 2017 16:19:28 +0000 (16:19 +0000)]
Skip LayoutTest media/restricted-audio-playback-with-document-gesture.html on iOS.

Unreviewed test gardening.

* platform/ios/TestExpectations:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216933 268f45cc-cd09-0410-ab3c-d52691b4dbfc

3 years agoPatch
aperez@igalia.com [Tue, 16 May 2017 15:30:20 +0000 (15:30 +0000)]
Patch

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216932 268f45cc-cd09-0410-ab3c-d52691b4dbfc

3 years ago[GTK] Tests that always pass when run alone, but fail in the bots
csaavedra@igalia.com [Tue, 16 May 2017 15:08:44 +0000 (15:08 +0000)]
[GTK] Tests that always pass when run alone, but fail in the bots
https://bugs.webkit.org/show_bug.cgi?id=168572

Reviewed by Michael Catanzaro.

PlatformWebView::viewSupportsOptions() is basically a comparison
that checks that the passed options are the ones supported by the
web view. There is no reason for them to be implemented for each
platform differently. In fact doing so causes issues each time a
new option is added, if the corresponding platform implementation
is not updated accordingly.

A consequence of not updating the viewSupportOptions()
implementations when new options are added is that tests that need
these options might fail if they are executed after a test that
didn't need the option, as the webview will be reused even if the
option is not supported. This cannot be spotted when running the
tests individually. See bug #165133 for other example of the same
problem.

Remove the platform implementations and make the comparison a
method of the TestOptions structure, so that the check is in one
Tools:

place. For the time being, only include in the comparison the
options that were checked in the mac platform, which seem to be
the only ones relevant this far (unless newer ones have also been
forgotten).

* WebKitTestRunner/PlatformWebView.h:
(WTR::PlatformWebView::viewSupportsOptions): Use the method
defined below.
* WebKitTestRunner/TestOptions.h:
(WTR::TestOptions::hasSameInitializationOptions): Added.
* WebKitTestRunner/gtk/PlatformWebViewGtk.cpp:
(WTR::PlatformWebView::viewSupportsOptions): Deleted.
* WebKitTestRunner/ios/PlatformWebViewIOS.mm:
(WTR::PlatformWebView::viewSupportsOptions): Deleted.
* WebKitTestRunner/mac/PlatformWebViewMac.mm:
(WTR::PlatformWebView::viewSupportsOptions): Deleted.
* WebKitTestRunner/wpe/PlatformWebViewWPE.cpp:
(WTR::PlatformWebView::viewSupportsOptions): Deleted.

LayoutTests:

place. For the time being include in the comparison the options
checked in the mac and ios platforms, which seem to be the only
ones relevant this far (unless newer ones have also been
forgotten).

* platform/gtk/TestExpectations: Unskip an affected test.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216931 268f45cc-cd09-0410-ab3c-d52691b4dbfc

3 years ago[WPE] GLContextEGL::createWPEContext() should fall back to pbuffer-based contexts...
zandobersek@gmail.com [Tue, 16 May 2017 13:04:30 +0000 (13:04 +0000)]
[WPE] GLContextEGL::createWPEContext() should fall back to pbuffer-based contexts when offscreen target provides no native window
https://bugs.webkit.org/show_bug.cgi?id=172162

Reviewed by Carlos Garcia Campos.

When creating an offscreen GLContext, the underlying implementation might
provide a mock native window that's to be used as the window target upon
which a window-based GLContext should be created. But we should also support
falling back to pbuffer-based GLContexts when the underlying implementation
can't provide such mock targets.

* platform/graphics/egl/GLContextEGLWPE.cpp:
(WebCore::GLContextEGL::createWPEContext):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216930 268f45cc-cd09-0410-ab3c-d52691b4dbfc

3 years ago[GLib] Use RunLoopSourcePriority::RunLoopDispatcher as the GSocketMonitor's GSource...
zandobersek@gmail.com [Tue, 16 May 2017 12:57:15 +0000 (12:57 +0000)]
[GLib] Use RunLoopSourcePriority::RunLoopDispatcher as the GSocketMonitor's GSource priority
https://bugs.webkit.org/show_bug.cgi?id=172160

Reviewed by Carlos Garcia Campos.

* Platform/IPC/glib/GSocketMonitor.cpp:
(IPC::GSocketMonitor::start): Explicitly set the priority for the GSocketMonitor's
GSource object to RunLoopSourcePriority::RunLoopDispatcher, equating it to the
priority that's used in RunLoop for dispatches of the queued functions.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216929 268f45cc-cd09-0410-ab3c-d52691b4dbfc

3 years ago[WPE] Set and expose ENABLE_DEVELOPER_MODE in build when DEVELOPER_MODE is enabled
zandobersek@gmail.com [Tue, 16 May 2017 12:51:24 +0000 (12:51 +0000)]
[WPE] Set and expose ENABLE_DEVELOPER_MODE in build when DEVELOPER_MODE is enabled
https://bugs.webkit.org/show_bug.cgi?id=172159

Reviewed by Carlos Garcia Campos.

* Source/cmake/OptionsWPE.cmake: Expose the ENABLE_DEVELOPER_MODE macro
when the DEVELOPER_MODE configuration options is enabled.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216928 268f45cc-cd09-0410-ab3c-d52691b4dbfc

3 years ago[GLib] Name more GSource-based RunLoop::Timers
zandobersek@gmail.com [Tue, 16 May 2017 12:49:26 +0000 (12:49 +0000)]
[GLib] Name more GSource-based RunLoop::Timers
https://bugs.webkit.org/show_bug.cgi?id=172158

Reviewed by Carlos Garcia Campos.

Source/WebCore:

* platform/glib/MainThreadSharedTimerGLib.cpp:
(WebCore::MainThreadSharedTimer::MainThreadSharedTimer):
Specify 'MainThreadSharedTimer' as the name of this GSource-based RunLoop::Timer.

Source/WebKit2:

* Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.cpp:
(WebKit::CompositingRunLoop::CompositingRunLoop):
Specify 'CompositingRunLoop' as the name of this GSource-based RunLoop::Timer.
* Shared/CoordinatedGraphics/threadedcompositor/ThreadedDisplayRefreshMonitor.cpp:
(WebKit::ThreadedDisplayRefreshMonitor::ThreadedDisplayRefreshMonitor):
Specify 'ThreadedDisplayRefreshMonitor' as the name of this GSource-based RunLoop::Timer.
* WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp:
(WebKit::CoordinatedLayerTreeHost::CoordinatedLayerTreeHost):
Specify 'CoordinatedLayerTreeHost' as the name of this GSource-based RunLoop::Timer.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216927 268f45cc-cd09-0410-ab3c-d52691b4dbfc

3 years ago[Readable Streams API] Implement ReadableStreamBYOBReader releaseLock()
commit-queue@webkit.org [Tue, 16 May 2017 12:47:22 +0000 (12:47 +0000)]
[Readable Streams API] Implement ReadableStreamBYOBReader releaseLock()
https://bugs.webkit.org/show_bug.cgi?id=172111

Patch by Romain Bellessort <romain.bellessort@crf.canon.fr> on 2017-05-16
Reviewed by Chris Dumez.

LayoutTests/imported/w3c:

Updated test expectations.

* web-platform-tests/streams/readable-byte-streams/general-expected.txt: Updated.
* web-platform-tests/streams/readable-byte-streams/general.dedicatedworker-expected.txt: Updated.

Source/WebCore:

Implemented ReadableStreamBYOBReader releaseLock():
- https://streams.spec.whatwg.org/#byob-reader-release-lock;
- https://streams.spec.whatwg.org/#readable-stream-reader-generic-release.

Added tests to check releaseLock behavior.

* Modules/streams/ReadableStreamBYOBReader.js:
(releaseLock): Implemented.
* Modules/streams/ReadableStreamInternals.js:
(readableStreamReaderGenericRelease): Aligned with spec.

LayoutTests:

Added tests to check releaseLock() behavior.

* streams/readable-stream-byob-reader-expected.txt: Updated.
* streams/readable-stream-byob-reader.js: Added new tests.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216926 268f45cc-cd09-0410-ab3c-d52691b4dbfc

3 years agoUnreviewed Windows gardening. Skip svg animation test, since image throttling behaves...
pvollan@apple.com [Tue, 16 May 2017 10:32:22 +0000 (10:32 +0000)]
Unreviewed Windows gardening. Skip svg animation test, since image throttling behaves differently on WK1.

* platform/win/TestExpectations:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216925 268f45cc-cd09-0410-ab3c-d52691b4dbfc

3 years agoUnreviewed, add Objective C files to CMake Mac port
utatane.tea@gmail.com [Tue, 16 May 2017 09:40:52 +0000 (09:40 +0000)]
Unreviewed, add Objective C files to CMake Mac port
https://bugs.webkit.org/show_bug.cgi?id=172103

* shell/PlatformMac.cmake: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216924 268f45cc-cd09-0410-ab3c-d52691b4dbfc

3 years agoUnreviewed. Revert change committed by mistakle in r216922.
carlosgc@webkit.org [Tue, 16 May 2017 09:37:51 +0000 (09:37 +0000)]
Unreviewed. Revert change committed by mistakle in r216922.

* Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
(WebKit::ThreadedCompositor::forceRepaint):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216923 268f45cc-cd09-0410-ab3c-d52691b4dbfc

3 years agoUnreviewed GTK+ gardening. Rebaseline tests after r216817.
carlosgc@webkit.org [Tue, 16 May 2017 09:35:58 +0000 (09:35 +0000)]
Unreviewed GTK+ gardening. Rebaseline tests after r216817.

* platform/gtk/fast/multicol/client-rects-expected.txt:
* platform/gtk/fast/multicol/client-rects-spanners-complex-expected.txt:
* platform/gtk/fast/multicol/client-rects-spanners-expected.txt:
* platform/gtk/fast/multicol/newmulticol/client-rects-expected.txt:
* platform/gtk/fast/transforms/bounding-rect-zoom-expected.txt:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216922 268f45cc-cd09-0410-ab3c-d52691b4dbfc

3 years agoWebAssembly: enforce size limits
jfbastien@apple.com [Tue, 16 May 2017 09:24:13 +0000 (09:24 +0000)]
WebAssembly: enforce size limits
https://bugs.webkit.org/show_bug.cgi?id=165833
<rdar://problem/29760219>

Reviewed by Keith Miller.

Use the same limits as V8.

* JavaScriptCore.xcodeproj/project.pbxproj:
* wasm/WasmLimits.h: Added.
* wasm/WasmModuleParser.cpp:
* wasm/WasmParser.h:
(JSC::Wasm::Parser<SuccessType>::consumeUTF8String):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216921 268f45cc-cd09-0410-ab3c-d52691b4dbfc

3 years agoUnreviewed. Try to fix GTK+ build with MEDIA_STREAM enabled after r216918.
carlosgc@webkit.org [Tue, 16 May 2017 09:10:55 +0000 (09:10 +0000)]
Unreviewed. Try to fix GTK+ build with MEDIA_STREAM enabled after r216918.

* platform/mediastream/openwebrtc/RealtimeMediaSourceCenterOwr.cpp:
(WebCore::RealtimeMediaSourceCenterOwr::validateRequestConstraints):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216920 268f45cc-cd09-0410-ab3c-d52691b4dbfc

3 years agoUnreviewed GTK+ gardening. Update expectations of several WebRTC tests.
carlosgc@webkit.org [Tue, 16 May 2017 08:53:21 +0000 (08:53 +0000)]
Unreviewed GTK+ gardening. Update expectations of several WebRTC tests.

* platform/gtk/TestExpectations:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216919 268f45cc-cd09-0410-ab3c-d52691b4dbfc

3 years agoRemove MediaConstraintsData and MediaConstraintsImpl
commit-queue@webkit.org [Tue, 16 May 2017 08:51:50 +0000 (08:51 +0000)]
Remove MediaConstraintsData and MediaConstraintsImpl
https://bugs.webkit.org/show_bug.cgi?id=172132

Patch by Youenn Fablet <youenn@apple.com> on 2017-05-16
Reviewed by Eric Carlson.

Source/WebCore:

No observable change of behavior.

Removing MediaConstraintsData and MediaConstraintsImpl allows simplifying the code.
Further simplified the code by making MediaConstraints no longer ref counted and now a struct.
Simplified some RealtimeMediaSource subclasses by removing unused MediaConstraints class members.

* CMakeLists.txt: Removing MediaConstraintsImpl.cpp.
* Modules/mediastream/MediaConstraintsImpl.cpp: Removed.
* Modules/mediastream/MediaConstraintsImpl.h: Removed.
* Modules/mediastream/MediaDevices.cpp:
(WebCore::createMediaConstraints):
(WebCore::MediaDevices::getUserMedia):
(WebCore::createMediaConstraintsImpl): Deleted.
* Modules/mediastream/MediaStreamTrack.cpp:
(WebCore::createMediaConstraints):
(WebCore::MediaStreamTrack::applyConstraints):
(WebCore::createMediaConstraintsImpl): Deleted.
* Modules/mediastream/MediaTrackConstraints.cpp:
(WebCore::createMediaConstraints):
(WebCore::createMediaConstraintsImpl): Deleted.
* Modules/mediastream/MediaTrackConstraints.h:
* Modules/mediastream/UserMediaRequest.cpp:
(WebCore::UserMediaRequest::start):
(WebCore::UserMediaRequest::UserMediaRequest):
(WebCore::UserMediaRequest::allow):
* Modules/mediastream/UserMediaRequest.h:
(WebCore::UserMediaRequest::audioConstraints):
(WebCore::UserMediaRequest::videoConstraints):
* WebCore.xcodeproj/project.pbxproj:
* platform/mediastream/MediaConstraints.cpp:
(WebCore::addDefaultVideoConstraints):
(WebCore::MediaConstraints::isConstraintSet):
(WebCore::MediaConstraints::setDefaultVideoConstraints):
* platform/mediastream/MediaConstraints.h:
(WebCore::MediaConstraints::~MediaConstraints): Deleted.
(WebCore::MediaConstraints::MediaConstraints): Deleted.
* platform/mediastream/MediaStreamConstraintsValidationClient.h:
* platform/mediastream/RealtimeMediaSource.cpp:
(WebCore::RealtimeMediaSource::selectSettings):
(WebCore::RealtimeMediaSource::supportsConstraints):
(WebCore::RealtimeMediaSource::applyConstraints):
* platform/mediastream/RealtimeMediaSourceCenter.cpp:
(WebCore::RealtimeMediaSourceCenter::validateRequestConstraints):
* platform/mediastream/RealtimeMediaSourceCenter.h:
* platform/mediastream/mac/RealtimeIncomingAudioSource.cpp:
(WebCore::RealtimeIncomingAudioSource::supportedConstraints): Deleted.
* platform/mediastream/mac/RealtimeIncomingAudioSource.h:
* platform/mediastream/mac/RealtimeIncomingVideoSource.cpp:
(WebCore::RealtimeIncomingVideoSource::supportedConstraints): Deleted.
* platform/mediastream/mac/RealtimeIncomingVideoSource.h:
* platform/mock/MockRealtimeMediaSource.h:
(WebCore::MockRealtimeMediaSource::constraints): Deleted.

Source/WebKit2:

Removing MediaConstraintsData and MediaConstraintsImpl allows simplifying the code.
Further simplified the code by making MediaConstraints no longer ref counted and now a struct.

* Scripts/webkit/messages.py:
(headers_for_type):
* Shared/WebCoreArgumentCoders.cpp:
(IPC::ArgumentCoder<MediaConstraints>::encode):
(IPC::ArgumentCoder<MediaConstraints>::decode):
(IPC::ArgumentCoder<MediaConstraintsData>::encode): Deleted.
(IPC::ArgumentCoder<MediaConstraintsData>::decode): Deleted.
* Shared/WebCoreArgumentCoders.h:
* UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp:
(WebKit::UserMediaCaptureManagerProxy::createMediaSourceForCaptureDeviceWithConstraints):
(WebKit::UserMediaCaptureManagerProxy::applyConstraints):
* UIProcess/Cocoa/UserMediaCaptureManagerProxy.h:
* UIProcess/Cocoa/UserMediaCaptureManagerProxy.messages.in:
* UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
(WebKit::UserMediaPermissionRequestManagerProxy::requestUserMediaPermissionForFrame):
* UIProcess/UserMediaPermissionRequestManagerProxy.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::requestUserMediaPermissionForFrame):
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* WebProcess/MediaStream/UserMediaPermissionRequestManager.cpp:
(WebKit::UserMediaPermissionRequestManager::sendUserMediaRequest):
* WebProcess/cocoa/UserMediaCaptureManager.cpp:
(WebKit::UserMediaCaptureManager::applyConstraints):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216918 268f45cc-cd09-0410-ab3c-d52691b4dbfc

3 years ago[Cocoa] Tell NEFilterSource about the presenting app's PID
aestes@apple.com [Tue, 16 May 2017 08:03:02 +0000 (08:03 +0000)]
[Cocoa] Tell NEFilterSource about the presenting app's PID
https://bugs.webkit.org/show_bug.cgi?id=172152
<rdar://problem/32197740>

Reviewed by Dan Bernstein.

* platform/cocoa/NetworkExtensionContentFilter.mm:
(WebCore::NetworkExtensionContentFilter::initialize):
* platform/spi/cocoa/NEFilterSourceSPI.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216917 268f45cc-cd09-0410-ab3c-d52691b4dbfc

3 years ago[css-grid] Fix static position of positioned grid items
rego@igalia.com [Tue, 16 May 2017 07:50:32 +0000 (07:50 +0000)]
[css-grid] Fix static position of positioned grid items
https://bugs.webkit.org/show_bug.cgi?id=172108

Reviewed by Sergio Villar Senin.

Source/WebCore:

This patch makes us follow the text on the spec
(https://drafts.csswg.org/css-grid/#static-position):
"The static position of an absolutely-positioned child
 of a grid container is determined as if it were the sole grid item
 in a grid area whose edges coincide with the padding edges
 of the grid container."

Test: fast/css-grid-layout/absolute-positioning-grid-container-parent.html

* rendering/RenderGrid.cpp:
(WebCore::RenderGrid::prepareChildForPositionedLayout): Modified to avoid
including padding to match the spec behavior.

LayoutTests:

The test is updated as the expected results were wrong.
Note that after this patch we match Chrome and Firefox behavior on this test.

* fast/css-grid-layout/absolute-positioning-grid-container-parent.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216916 268f45cc-cd09-0410-ab3c-d52691b4dbfc

3 years ago[SOUP] Remove LATEST_RECORD_VERSION from GnuTLS priority string
mcatanzaro@igalia.com [Tue, 16 May 2017 07:44:41 +0000 (07:44 +0000)]
[SOUP] Remove LATEST_RECORD_VERSION from GnuTLS priority string
https://bugs.webkit.org/show_bug.cgi?id=172153

Based on discussion with Nikos in https://bugzilla.gnome.org/show_bug.cgi?id=782218, we
should remove LATEST_RECORD_VERSION from our GnuTLS priority string. This causes GnuTLS to
use the latest TLS record version (the record format is separate from the TLS protocol
version), which we needed a couple years ago (after dropping SSLv3) for maximum
compatibility with broken web servers. But it's not needed anymore, and is causing new
compatibility problems with other broken web servers, so let's get rid of it.

Reviewed by Carlos Garcia Campos.

* NetworkProcess/EntryPoint/unix/NetworkProcessMain.cpp:
(main):
* WebProcess/EntryPoint/unix/WebProcessMain.cpp:
(main):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216915 268f45cc-cd09-0410-ab3c-d52691b4dbfc

3 years ago[JSC] Build testapi in non Apple ports
utatane.tea@gmail.com [Tue, 16 May 2017 07:27:50 +0000 (07:27 +0000)]
[JSC] Build testapi in non Apple ports
https://bugs.webkit.org/show_bug.cgi?id=172103

Reviewed by Filip Pizlo.

Source/JavaScriptCore:

This patch makes JSC testapi buildable in non-Apple ports.
We isolate CF related tests in testapi.c. If we do not use
CF, we include JavaScript.h instead of JavaScriptCore.h.

By running the testapi in Linux, we found that contraints
test have a bug: If constraint marker runs after WeakRefs
are destroyed, it accesses destroyed WeakRef. This patch
also fixes it.

* API/tests/CurrentThisInsideBlockGetterTest.h:
* API/tests/CustomGlobalObjectClassTest.c:
* API/tests/ExecutionTimeLimitTest.cpp:
* API/tests/FunctionOverridesTest.cpp:
* API/tests/GlobalContextWithFinalizerTest.cpp:
* API/tests/JSObjectGetProxyTargetTest.cpp:
* API/tests/MultithreadedMultiVMExecutionTest.cpp:
* API/tests/PingPongStackOverflowTest.cpp:
* API/tests/TypedArrayCTest.cpp:
* API/tests/testapi.c:
(assertEqualsAsCharactersPtr):
(markingConstraint):
(testMarkingConstraintsAndHeapFinalizers):
(testCFStrings):
(main):
* shell/CMakeLists.txt:

Tools:

Now testapi is drived in JSCOnly, GTK and WPE ports too.

* Scripts/build-jsc:
* Scripts/run-javascriptcore-tests:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216914 268f45cc-cd09-0410-ab3c-d52691b4dbfc

3 years agoWebAssembly: add memory fuzzer
jfbastien@apple.com [Tue, 16 May 2017 07:23:34 +0000 (07:23 +0000)]
WebAssembly: add memory fuzzer
https://bugs.webkit.org/show_bug.cgi?id=169976
<rdar://problem/31965328>

Reviewed by Keith Miller.

* wasm/fuzz/memory.js: Added.
(const.insert):
(const.action.string_appeared_here):
(const.performAction):
(catch):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216913 268f45cc-cd09-0410-ab3c-d52691b4dbfc

3 years agoCompile error, include file is not found.
pvollan@apple.com [Tue, 16 May 2017 07:11:56 +0000 (07:11 +0000)]
Compile error, include file is not found.
https://bugs.webkit.org/show_bug.cgi?id=172105

Reviewed by Brent Fulgham.

Use __has_include to detect if include file exists.

* platform/mediastream/libwebrtc/H264VideoToolBoxEncoder.mm:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216912 268f45cc-cd09-0410-ab3c-d52691b4dbfc

3 years agoWebAssembly: report Memory usage to GC
jfbastien@apple.com [Tue, 16 May 2017 07:09:56 +0000 (07:09 +0000)]
WebAssembly: report Memory usage to GC
https://bugs.webkit.org/show_bug.cgi?id=170690
<rdar://problem/31965310>

Reviewed by Keith Miller.

* wasm/js/JSWebAssemblyMemory.cpp:
(JSC::JSWebAssemblyMemory::grow):
(JSC::JSWebAssemblyMemory::finishCreation):
(JSC::JSWebAssemblyMemory::visitChildren):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216911 268f45cc-cd09-0410-ab3c-d52691b4dbfc

3 years agoWebAssembly: validate load / store alignment
jfbastien@apple.com [Tue, 16 May 2017 07:07:35 +0000 (07:07 +0000)]
WebAssembly: validate load / store alignment
https://bugs.webkit.org/show_bug.cgi?id=168836
<rdar://problem/31965349>

Reviewed by Keith Miller.

JSTests:

* wasm/WASM.js: fix regular expression greed
* wasm/function-tests/memory-alignment.js: Added.
(const.op.of.WASM.opcodes):
* wasm/wasm.json: fix formatting

Source/JavaScriptCore:

* wasm/WasmFunctionParser.h: check the alignment
* wasm/generateWasm.py: generate the log2 alignment helper
(Wasm):
(isSimple):
(memoryLog2Alignment):
* wasm/generateWasmOpsHeader.py:
(memoryLog2AlignmentGenerator):
* wasm/wasm.json: fix formatting

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216908 268f45cc-cd09-0410-ab3c-d52691b4dbfc

3 years agoMake the application PID available to WebCore
aestes@apple.com [Tue, 16 May 2017 06:06:58 +0000 (06:06 +0000)]
Make the application PID available to WebCore
https://bugs.webkit.org/show_bug.cgi?id=172133

Reviewed by Andreas Kling.

Source/WebCore:

* CMakeLists.txt:
* PlatformMac.cmake:
* WebCore.xcodeproj/project.pbxproj:
* platform/RuntimeApplicationChecks.cpp: Added.
(WebCore::presentingApplicationPIDOverride):
(WebCore::presentingApplicationPID): Returns the override PID if set, or getCurrentProcessID()
otherwise.
(WebCore::setPresentingApplicationPID):
* platform/RuntimeApplicationChecks.h:
* platform/cocoa/RuntimeApplicationChecksCocoa.mm: Renamed from Source/WebCore/platform/RuntimeApplicationChecks.mm.

Source/WebKit2:

Added uiProcessPID to Web and Networking process creation parameters. The UI process
initializes these to getpid(), and the child processes call WebCore::setPresentingApplicationPID()
at initialization time.

This replaces presenterApplicationPid.

* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::initializeNetworkProcess):
* NetworkProcess/NetworkProcessCreationParameters.cpp:
(WebKit::NetworkProcessCreationParameters::encode):
(WebKit::NetworkProcessCreationParameters::decode):
* NetworkProcess/NetworkProcessCreationParameters.h:
* Shared/WebProcessCreationParameters.cpp:
(WebKit::WebProcessCreationParameters::encode):
(WebKit::WebProcessCreationParameters::decode):
* Shared/WebProcessCreationParameters.h:
* UIProcess/Cocoa/WebProcessPoolCocoa.mm:
(WebKit::WebProcessPool::platformInitializeWebProcess):
* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::ensureNetworkProcess):
(WebKit::WebProcessPool::createNewWebProcess):
* WebProcess/WebPage/mac/WebPageMac.mm:
(WebKit::WebPage::platformInitialize):
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::initializeWebProcess):
* WebProcess/WebProcess.h:
(WebKit::WebProcess::presenterApplicationPid): Deleted.
* WebProcess/cocoa/WebProcessCocoa.mm:
(WebKit::WebProcess::platformInitializeWebProcess):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216903 268f45cc-cd09-0410-ab3c-d52691b4dbfc

3 years agoRenderTheme does not need to be per-page
antti@apple.com [Tue, 16 May 2017 05:35:04 +0000 (05:35 +0000)]
RenderTheme does not need to be per-page
https://bugs.webkit.org/show_bug.cgi?id=172116
<rdar://problem/30426457>

Reviewed by Zalan Bujtas.

There are no implementations of RenderTheme::themeForPage that actually care about the page.
It can be replaced with a singleton, simplifying a bunch of code.

* Modules/mediacontrols/MediaControlsHost.cpp:
(WebCore::MediaControlsHost::shadowRootCSSText):
(WebCore::MediaControlsHost::base64StringForIconNameAndType):
* css/CSSDefaultStyleSheets.cpp:
(WebCore::CSSDefaultStyleSheets::loadFullDefaultStyle):
(WebCore::CSSDefaultStyleSheets::ensureDefaultStyleSheetsForElement):

    Fix a potential crash if we get here when page is null (though it doesn't appear to repro on trunk).

* css/StyleColor.cpp:
(WebCore::StyleColor::colorFromKeyword):
* css/StyleResolver.cpp:
(WebCore::StyleResolver::adjustRenderStyle):
* css/parser/CSSParser.cpp:
(WebCore::CSSParser::parseSystemColor):
* css/parser/CSSParser.h:
* css/parser/CSSPropertyParser.cpp:
(WebCore::CSSPropertyParser::consumeSystemFont):
* editing/FrameSelection.cpp:
(WebCore::FrameSelection::updateAppearance):
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::ensureMediaControlsInjectedScript):
* html/HTMLMeterElement.cpp:
(WebCore::HTMLMeterElement::createElementRenderer):
* html/HTMLSelectElement.cpp:
(WebCore::HTMLSelectElement::usesMenuList):
(WebCore::HTMLSelectElement::platformHandleKeydownEvent):
(WebCore::HTMLSelectElement::menuListDefaultEventHandler):
* html/HTMLTextFormControlElement.cpp:
(WebCore::HTMLTextFormControlElement::adjustInnerTextStyle):
* html/InputType.cpp:
(WebCore::InputType::themeSupportsDataListUI):
* html/TextFieldInputType.cpp:
(WebCore::TextFieldInputType::shouldHaveSpinButton):
(WebCore::TextFieldInputType::shouldHaveCapsLockIndicator):
* html/canvas/CanvasRenderingContext2D.cpp:
(WebCore::CanvasRenderingContext2D::setStrokeColor):
(WebCore::CanvasRenderingContext2D::setFillColor):
* html/canvas/CanvasStyle.cpp:
(WebCore::parseColor):
(WebCore::parseColorOrCurrentColor):
(WebCore::CanvasStyle::createFromString):
* html/canvas/CanvasStyle.h:
* html/shadow/MediaControlElements.cpp:
(WebCore::MediaControlPanelElement::startTimer):
(WebCore::MediaControlPanelElement::makeOpaque):
(WebCore::MediaControlPanelElement::makeTransparent):
* html/shadow/MediaControls.cpp:
(WebCore::MediaControls::reset):
(WebCore::MediaControls::reportedError):
(WebCore::MediaControls::updateCurrentTimeDisplay):
* html/shadow/mac/ImageControlsButtonElementMac.cpp:
(WebCore::ImageControlsButtonElementMac::tryCreate):
* page/MemoryRelease.cpp:
(WebCore::releaseNoncriticalMemory):
* page/Page.cpp:
(WebCore::Page::Page):
* page/Page.h:
(WebCore::Page::theme): Deleted.
* platform/wpe/RenderThemeWPE.cpp:
(WebCore::RenderTheme::singleton):
(WebCore::RenderTheme::themeForPage): Deleted.
* rendering/RenderEmbeddedObject.cpp:
(WebCore::RenderEmbeddedObject::getReplacementTextGeometry):
* rendering/RenderObject.cpp:
(WebCore::RenderObject::theme):
* rendering/RenderTheme.cpp:
(WebCore::RenderTheme::focusRingColor):
* rendering/RenderTheme.h:
(WebCore::RenderTheme::defaultTheme): Deleted.
* rendering/RenderThemeGtk.cpp:
(WebCore::RenderTheme::singleton):
(WebCore::RenderTheme::themeForPage): Deleted.
* rendering/RenderThemeIOS.mm:
(WebCore::RenderTheme::singleton):
(WebCore::RenderTheme::themeForPage): Deleted.
* rendering/RenderThemeMac.mm:
(WebCore::RenderTheme::singleton):
(WebCore::RenderTheme::themeForPage): Deleted.
* rendering/RenderThemeWin.cpp:
(WebCore::RenderTheme::singleton):
(WebCore::RenderTheme::themeForPage): Deleted.
* rendering/TextPaintStyle.cpp:
(WebCore::computeTextPaintStyle):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216902 268f45cc-cd09-0410-ab3c-d52691b4dbfc

3 years agoDo not delete asynchronously decoded frames for large images if their clients are...
commit-queue@webkit.org [Tue, 16 May 2017 05:14:50 +0000 (05:14 +0000)]
Do not delete asynchronously decoded frames for large images if their clients are in the viewport
https://bugs.webkit.org/show_bug.cgi?id=170640

Patch by Said Abou-Hallawa <sabouhallawa@apple.com> on 2017-05-15
Reviewed by Simon Fraser.

Source/WebCore:

The image flickering problem happens when a large image is visible in the
view port and for some reason, the decoded frame gets destroyed. When this
image is repainted, BitmapImage::draw() does not find a valid decoded frame
for that image. It then requests an async decoding for the image and just
draws nothing in the image rectangle. Drawing no content between two drawing
phases in which the image is drawn causes the unwanted flickering.

To fix this issue we need to protect the decoded frames of all the images
in the view port from being destroyed. When BitmapImage::destroyDecodedData()
is called, it is going to check, through the ImageObserver, whether any
of its clients is visible. And if so, the current decoded frame won't be
destroyed.

Tests: Modifying existing tests.

* loader/cache/CachedImage.cpp:
(WebCore::CachedImage::CachedImageObserver::decodedSizeChanged):
(WebCore::CachedImage::CachedImageObserver::didDraw):
(WebCore::CachedImage::CachedImageObserver::canDestroyDecodedData):
(WebCore::CachedImage::CachedImageObserver::imageFrameAvailable):
(WebCore::CachedImage::CachedImageObserver::changedInRect):
(WebCore::CachedImage::decodedSizeChanged):
(WebCore::CachedImage::didDraw):
(WebCore::CachedImage::canDestroyDecodedData): Finds out whether it's okay
to discard the image decoded data or not.
(WebCore::CachedImage::imageFrameAvailable):
(WebCore::CachedImage::changedInRect):
* loader/cache/CachedImage.h:
* loader/cache/CachedImageClient.h:
(WebCore::CachedImageClient::canDestroyDecodedData):
* loader/cache/MemoryCache.cpp:
(WebCore::MemoryCache::destroyDecodedDataForAllImages): This function is
currently not used. Use in the internal destroyDecodedDataForAllImages()
but unlike what CachedImage::destroyDecodedData() does, make it destroy
the decoded frames without deleting the image itself.
* loader/cache/MemoryCache.h:
* platform/graphics/BitmapImage.cpp:
(WebCore::BitmapImage::destroyDecodedData):
(WebCore::BitmapImage::draw):
(WebCore::BitmapImage::canDestroyCurrentFrameDecodedData):
(WebCore::BitmapImage::advanceAnimation):
(WebCore::BitmapImage::internalAdvanceAnimation):
(WebCore::BitmapImage::imageFrameAvailableAtIndex):
* platform/graphics/BitmapImage.h:
* platform/graphics/GraphicsContext3D.cpp:
(WebCore::GraphicsContext3D::packImageData):
* platform/graphics/ImageFrameCache.cpp:
(WebCore::ImageFrameCache::decodedSizeChanged):
(ImageFrameCache::cacheAsyncFrameNativeImageAtIndex): The assertion in this
function is wrong. frameIsCompleteAtIndex() can be false when the an image
decoding is requested but can be true when the decoding finishes.
* platform/graphics/ImageObserver.h:
* platform/graphics/cairo/ImageCairo.cpp:
(WebCore::Image::drawPattern):
* platform/graphics/cg/ImageCG.cpp:
(WebCore::Image::drawPattern):
* platform/graphics/cg/ImageDecoderCG.cpp:
(WebCore::ImageDecoder::frameIsCompleteAtIndex):
* platform/graphics/cg/PDFDocumentImage.cpp:
(WebCore::PDFDocumentImage::decodedSizeChanged):
(WebCore::PDFDocumentImage::draw):
* platform/graphics/texmap/TextureMapperTiledBackingStore.cpp:
(WebCore::TextureMapperTiledBackingStore::updateContentsFromImageIfNeeded):
* platform/graphics/win/ImageDirect2D.cpp:
(WebCore::Image::drawPattern):
* rendering/RenderElement.cpp:
(WebCore::RenderElement::isVisibleInDocumentRect):
(WebCore::RenderElement::isVisibleInViewport):
(WebCore::RenderElement::imageFrameAvailable):
(WebCore::RenderElement::repaintForPausedImageAnimationsIfNeeded):
(WebCore::RenderElement::shouldRepaintInVisibleRect): Deleted. Function
is renamed to isVisibleInViewport() for better readability.
* rendering/RenderElement.h:
* svg/graphics/SVGImage.cpp:
(WebCore::SVGImage::draw):
* svg/graphics/SVGImageClients.h:
* testing/Internals.cpp:
(WebCore::Internals::destroyDecodedDataForAllImages):
* testing/Internals.h:
* testing/Internals.idl:

Source/WebKit/mac:

Enable the async decoding for large images.

* WebView/WebView.mm:
(-[WebView _preferencesChanged:]):

Source/WebKit2:

Enable the async decoding for large images.

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::updatePreferences):

LayoutTests:

* fast/images/async-image-background-image-repeated.html:
* fast/images/async-image-background-image.html:
* fast/images/sprite-sheet-image-draw.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216901 268f45cc-cd09-0410-ab3c-d52691b4dbfc

3 years agoWPT test importer should not account for slow manual tests
commit-queue@webkit.org [Tue, 16 May 2017 03:41:24 +0000 (03:41 +0000)]
WPT test importer should not account for slow manual tests
https://bugs.webkit.org/show_bug.cgi?id=172127

Patch by Youenn Fablet <youenn@apple.com> on 2017-05-15
Reviewed by Ryosuke Niwa.

Making sure manual tests are not triggering updating tests-options.json file.

* Scripts/webkitpy/w3c/test_importer.py:
(TestImporter.find_importable_tests):
(TestImporter._already_identified_as_resource_file):
(TestImporter.update_tests_options):
* Scripts/webkitpy/w3c/test_importer_unittest.py:
(test_manual_slow_test):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216900 268f45cc-cd09-0410-ab3c-d52691b4dbfc

3 years agowebkitpy: Some versions of simctl do not place parenthesis around runtime identifiers
jbedard@apple.com [Tue, 16 May 2017 03:19:19 +0000 (03:19 +0000)]
webkitpy: Some versions of simctl do not place parenthesis around runtime identifiers
https://bugs.webkit.org/show_bug.cgi?id=172142

Reviewed by Tim Horton.

* Scripts/webkitpy/xcode/simulator.py:
(Simulator._parse_runtimes): Newer versions of simctl output do not put parenthesis
around runtime identifiers.
* Scripts/webkitpy/xcode/simulator_unittest.py: Add tests for new simctl output.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216899 268f45cc-cd09-0410-ab3c-d52691b4dbfc

3 years agoSimplify RealtimeMediaSource data production and state
commit-queue@webkit.org [Tue, 16 May 2017 02:45:28 +0000 (02:45 +0000)]
Simplify RealtimeMediaSource data production and state
https://bugs.webkit.org/show_bug.cgi?id=171999

Patch by Youenn Fablet <youenn@apple.com> on 2017-05-15
Reviewed by Eric Carlson.

Source/WebCore:

RealtimeMediaSource takes 3 booleans:
- m_isProducingData tells whether data is produced or not. In the case of capturing, it tells whether capture
  happens.
- m_muted/m_enabled allows JS or WebKit level to start/stop the source.

Changed MediaStream capture state computation so that capture is reported as follows:
- m_isProducing is true, capture is happenning and is active
- m_muted is true, capture is happening but is inactive.

Except in the case of WebRTC incoming sources, for which sources may be created as muted as per the spec,
all sources are unmuted, enabled and not producing data when created.

RealtimeMediaSource is now activable either by calling start/stop or by calling setMuted/setEnabled.
This in turns will set the boolean values accordingly and will call the underlying
startProducingData/stopProducingData methods doing the actual stuff.

Removing from all RealtimeMediaSource subclasses the handling of producing data.
Making more methods non-virtual/member fields private to simplify the model.

* Modules/mediastream/CanvasCaptureMediaStreamTrack.cpp:
(WebCore::CanvasCaptureMediaStreamTrack::Source::create):
(WebCore::CanvasCaptureMediaStreamTrack::Source::startProducingData):
(WebCore::CanvasCaptureMediaStreamTrack::Source::stopProducingData):
(WebCore::CanvasCaptureMediaStreamTrack::Source::canvasDestroyed):
(WebCore::CanvasCaptureMediaStreamTrack::Source::captureCanvas):
* Modules/mediastream/CanvasCaptureMediaStreamTrack.h:
* Modules/mediastream/MediaStream.cpp:
(WebCore::MediaStream::mediaState):
* platform/mediastream/MediaStreamTrackPrivate.h:
(WebCore::MediaStreamTrackPrivate::startProducingData):
(WebCore::MediaStreamTrackPrivate::stopProducingData):
* platform/mediastream/RealtimeMediaSource.cpp:
(WebCore::RealtimeMediaSource::setMuted):
(WebCore::RealtimeMediaSource::notifyMutedChange):
(WebCore::RealtimeMediaSource::setEnabled):
(WebCore::RealtimeMediaSource::start):
(WebCore::RealtimeMediaSource::stop):
(WebCore::RealtimeMediaSource::requestStop):
(WebCore::RealtimeMediaSource::reset): Deleted.
* platform/mediastream/RealtimeMediaSource.h:
* platform/mediastream/mac/AVMediaCaptureSource.h:
* platform/mediastream/mac/AVMediaCaptureSource.mm:
(WebCore::AVMediaCaptureSource::AVMediaCaptureSource):
(WebCore::AVMediaCaptureSource::captureSessionIsRunningDidChange):
(WebCore::AVMediaCaptureSource::reset): Deleted.
(WebCore::AVMediaCaptureSource::isProducingData): Deleted.
* platform/mediastream/mac/CoreAudioCaptureSource.cpp:
(WebCore::CoreAudioCaptureSource::CoreAudioCaptureSource):
(WebCore::CoreAudioCaptureSource::startProducingData):
(WebCore::CoreAudioCaptureSource::stopProducingData):
(WebCore::CoreAudioCaptureSource::audioSourceProvider):
* platform/mediastream/mac/CoreAudioCaptureSource.h:
* platform/mediastream/mac/MockRealtimeAudioSourceMac.mm:
(WebCore::MockRealtimeAudioSourceMac::render):
(WebCore::MockRealtimeAudioSource::createMuted): Deleted.
* platform/mediastream/mac/MockRealtimeVideoSourceMac.mm:
(WebCore::MockRealtimeVideoSource::createMuted): Deleted.
* platform/mediastream/mac/RealtimeIncomingAudioSource.cpp:
(WebCore::RealtimeIncomingAudioSource::create):
(WebCore::RealtimeIncomingAudioSource::RealtimeIncomingAudioSource):
(WebCore::RealtimeIncomingAudioSource::~RealtimeIncomingAudioSource):
(WebCore::RealtimeIncomingAudioSource::startProducingData):
(WebCore::RealtimeIncomingAudioSource::stopProducingData):
(WebCore::RealtimeIncomingAudioSource::setSourceTrack):
* platform/mediastream/mac/RealtimeIncomingAudioSource.h:
* platform/mediastream/mac/RealtimeIncomingVideoSource.cpp:
(WebCore::RealtimeIncomingVideoSource::create):
(WebCore::RealtimeIncomingVideoSource::RealtimeIncomingVideoSource):
(WebCore::RealtimeIncomingVideoSource::startProducingData):
(WebCore::RealtimeIncomingVideoSource::setSourceTrack):
(WebCore::RealtimeIncomingVideoSource::stopProducingData):
(WebCore::RealtimeIncomingVideoSource::OnFrame):
* platform/mediastream/mac/RealtimeIncomingVideoSource.h:
* platform/mediastream/mac/WebAudioSourceProviderAVFObjC.mm:
(WebCore::WebAudioSourceProviderAVFObjC::setClient):
* platform/mock/MockMediaEndpoint.cpp:
(WebCore::MockMediaEndpoint::createMutedRemoteSource):
(WebCore::MockMediaEndpoint::unmuteTimerFired):
* platform/mock/MockRealtimeAudioSource.cpp:
(WebCore::MockRealtimeAudioSource::createMuted):
(WebCore::MockRealtimeAudioSource::startProducingData):
(WebCore::MockRealtimeAudioSource::stopProducingData):
* platform/mock/MockRealtimeAudioSource.h:
* platform/mock/MockRealtimeMediaSource.cpp:
(WebCore::MockRealtimeMediaSource::startProducingData): Deleted.
(WebCore::MockRealtimeMediaSource::stopProducingData): Deleted.
* platform/mock/MockRealtimeMediaSource.h:
* platform/mock/MockRealtimeVideoSource.cpp:
(WebCore::MockRealtimeVideoSource::createMuted):
(WebCore::MockRealtimeVideoSource::startProducingData):
(WebCore::MockRealtimeVideoSource::stopProducingData):
(WebCore::MockRealtimeVideoSource::generateFrame):
* platform/mock/MockRealtimeVideoSource.h:

Source/WebKit2:

* UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp:
(WebKit::UserMediaCaptureManagerProxy::startProducingData):
(WebKit::UserMediaCaptureManagerProxy::stopProducingData):
* WebProcess/cocoa/UserMediaCaptureManager.cpp:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216898 268f45cc-cd09-0410-ab3c-d52691b4dbfc

3 years agobrowserbench.org/Speedometer/ should show the benchmark not an index of files
rniwa@webkit.org [Tue, 16 May 2017 01:59:10 +0000 (01:59 +0000)]
browserbench.org/Speedometer/ should show the benchmark not an index of files
https://bugs.webkit.org/show_bug.cgi?id=172141

Reviewed by Alexey Proskuryakov.

Renamed Speedometer/Full.html to Speedometer/index.html.
We used to have a .htaccess but it's better to use the same file name convention as other benchmarks.

* Speedometer/index.html: Renamed from Websites/browserbench.org/Speedometer/Full.html.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216897 268f45cc-cd09-0410-ab3c-d52691b4dbfc

3 years agoMigrate Font constructor from bools to enums
mmaxfield@apple.com [Tue, 16 May 2017 01:37:43 +0000 (01:37 +0000)]
Migrate Font constructor from bools to enums
https://bugs.webkit.org/show_bug.cgi?id=172140

Reviewed by Tim Horton.

In https://bugs.webkit.org/show_bug.cgi?id=168487, I'm adding a new flag to Font. We can't
keep having just a pile of bools in this class. Instead, we should be using enums.

No new tests because there is no behavior change.

* css/CSSFontFace.cpp:
(WebCore::CSSFontFace::font):
* css/CSSFontFaceSource.cpp:
(WebCore::CSSFontFaceSource::font):
* css/CSSSegmentedFontFace.cpp:
* loader/cache/CachedFont.cpp:
(WebCore::CachedFont::createFont):
* platform/graphics/Font.cpp:
(WebCore::Font::Font):
(WebCore::Font::verticalRightOrientationFont):
(WebCore::Font::uprightOrientationFont):
(WebCore::Font::brokenIdeographFont):
(WebCore::Font::description):
(WebCore::Font::mathData):
* platform/graphics/Font.h:
(WebCore::Font::create):
(WebCore::Font::origin):
(WebCore::Font::isInterstitial):
(WebCore::Font::widthForGlyph):
(WebCore::Font::isCustomFont): Deleted.
(WebCore::Font::isLoading): Deleted.
* platform/graphics/FontRanges.cpp:
* platform/graphics/cocoa/FontCocoa.mm:
(WebCore::Font::platformInit):
* platform/graphics/freetype/SimpleFontDataFreeType.cpp:
(WebCore::Font::platformCreateScaledFont):
* platform/graphics/win/SimpleFontDataCGWin.cpp:
(WebCore::Font::platformInit):
* platform/graphics/win/SimpleFontDataDirect2D.cpp:
(WebCore::Font::platformInit):
* platform/graphics/win/SimpleFontDataWin.cpp:
(WebCore::Font::platformCreateScaledFont):
(WebCore::Font::determinePitch):
* rendering/SimpleLineLayout.cpp:
(WebCore::SimpleLineLayout::canUseForFontAndText):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216896 268f45cc-cd09-0410-ab3c-d52691b4dbfc

3 years agobmalloc: Bump the size of the deallocator log to 512
ggaren@apple.com [Tue, 16 May 2017 01:29:39 +0000 (01:29 +0000)]
bmalloc: Bump the size of the deallocator log to 512
https://bugs.webkit.org/show_bug.cgi?id=172143

Reviewed by Michael Saboff.

This is a speedup on parallel workloads for machines with lots of CPUs.

* bmalloc/Sizes.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216895 268f45cc-cd09-0410-ab3c-d52691b4dbfc

3 years ago[GTK] [l10n] Updated French translation for Webkit/GTK
mcatanzaro@igalia.com [Tue, 16 May 2017 00:58:32 +0000 (00:58 +0000)]
[GTK] [l10n] Updated French translation for Webkit/GTK
https://bugs.webkit.org/show_bug.cgi?id=172093

Patch by Alexandre Franke <afranke@gnome.org> on 2017-05-15
Rubber-stamped by Michael Catanzaro.

* fr.po:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216894 268f45cc-cd09-0410-ab3c-d52691b4dbfc

3 years agoCorrect typo (part of r216790).
bfulgham@apple.com [Tue, 16 May 2017 00:50:19 +0000 (00:50 +0000)]
Correct typo (part of r216790).

* PluginProcess/mac/com.apple.WebKit.plugin-common.sb.in: The check-in missed part of a
regular expression needed to fix the audio playback.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216893 268f45cc-cd09-0410-ab3c-d52691b4dbfc

3 years agoWebRTC outgoing muted video sources should send black frames
commit-queue@webkit.org [Tue, 16 May 2017 00:41:50 +0000 (00:41 +0000)]
WebRTC outgoing muted video sources should send black frames
https://bugs.webkit.org/show_bug.cgi?id=170627
<rdar://problem/31513869>

Patch by Youenn Fablet <youenn@apple.com> on 2017-05-15
Reviewed by Eric Carlson.

Source/WebCore:

Covered by updated test.

Instead of sending one black frame and then another one asynchronously,
we use the timer to send a black frame every second when outgoing source is muted.

* platform/mediastream/mac/RealtimeOutgoingVideoSource.cpp:
(WebCore::RealtimeOutgoingVideoSource::sourceMutedChanged):
(WebCore::RealtimeOutgoingVideoSource::sourceEnabledChanged):
(WebCore::RealtimeOutgoingVideoSource::sendBlackFrames):
(WebCore::RealtimeOutgoingVideoSource::sendBlackFrame): Deleted.
* platform/mediastream/mac/RealtimeOutgoingVideoSource.h:
* testing/Internals.cpp:
(WebCore::Internals::videoSampleAvailable):

LayoutTests:

* webrtc/video-mute-expected.txt:
* webrtc/video-mute.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216892 268f45cc-cd09-0410-ab3c-d52691b4dbfc

3 years agoRolling out r214038 and r213697: Crashes when using computed properties with rest...
mark.lam@apple.com [Tue, 16 May 2017 00:21:59 +0000 (00:21 +0000)]
Rolling out r214038 and r213697: Crashes when using computed properties with rest destructuring and object spread.
https://bugs.webkit.org/show_bug.cgi?id=172147

Rubber-stamped by Saam Barati.

JSTests:

* stress/object-rest-deconstruct.js: Removed.
* stress/object-spread.js: Removed.

Source/JavaScriptCore:

I rolled out every thing in those 2 patches except for the change to make
CodeBlock::finishCreation() return a bool plus its clients that depend on this.
I made this exception because r214931 relies on this change, and this part of
the change looks correct.

* builtins/BuiltinNames.h:
* builtins/GlobalOperations.js:
(globalPrivate.speciesConstructor):
(globalPrivate.copyDataProperties): Deleted.
* bytecode/CodeBlock.cpp:
(JSC::CodeBlock::finishCreation):
(JSC::CodeBlock::setConstantIdentifierSetRegisters): Deleted.
* bytecode/CodeBlock.h:
* bytecode/UnlinkedCodeBlock.h:
(JSC::UnlinkedCodeBlock::addBitVector):
(JSC::UnlinkedCodeBlock::constantRegisters):
(JSC::UnlinkedCodeBlock::addSetConstant): Deleted.
(JSC::UnlinkedCodeBlock::constantIdentifierSets): Deleted.
* bytecompiler/BytecodeGenerator.cpp:
* bytecompiler/BytecodeGenerator.h:
* bytecompiler/NodesCodegen.cpp:
(JSC::PropertyListNode::emitBytecode):
(JSC::ObjectPatternNode::bindValue):
(JSC::ObjectSpreadExpressionNode::emitBytecode): Deleted.
* parser/ASTBuilder.h:
(JSC::ASTBuilder::createProperty):
(JSC::ASTBuilder::appendObjectPatternEntry):
(JSC::ASTBuilder::createObjectSpreadExpression): Deleted.
(JSC::ASTBuilder::appendObjectPatternRestEntry): Deleted.
(JSC::ASTBuilder::setContainsObjectRestElement): Deleted.
* parser/NodeConstructors.h:
(JSC::PropertyNode::PropertyNode):
(JSC::SpreadExpressionNode::SpreadExpressionNode):
(JSC::ObjectSpreadExpressionNode::ObjectSpreadExpressionNode): Deleted.
* parser/Nodes.h:
(JSC::ObjectPatternNode::appendEntry):
(JSC::ObjectSpreadExpressionNode::expression): Deleted.
(JSC::ObjectPatternNode::setContainsRestElement): Deleted.
* parser/Parser.cpp:
(JSC::Parser<LexerType>::parseDestructuringPattern):
(JSC::Parser<LexerType>::parseProperty):
* parser/SyntaxChecker.h:
(JSC::SyntaxChecker::createSpreadExpression):
(JSC::SyntaxChecker::createProperty):
(JSC::SyntaxChecker::operatorStackPop):
(JSC::SyntaxChecker::createObjectSpreadExpression): Deleted.
* runtime/ObjectConstructor.cpp:
(JSC::ObjectConstructor::finishCreation):
* runtime/SetPrototype.cpp:
(JSC::SetPrototype::finishCreation):

Source/WTF:

* wtf/HashSet.h:
(WTF::=):

LayoutTests:

* js/parser-syntax-check-expected.txt:
* js/script-tests/parser-syntax-check.js:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216891 268f45cc-cd09-0410-ab3c-d52691b4dbfc

3 years agoCrash in libxml2.2.dylib: xmlDictReference
ddkilzer@apple.com [Mon, 15 May 2017 23:54:34 +0000 (23:54 +0000)]
Crash in libxml2.2.dylib: xmlDictReference
<https://webkit.org/b/172086>
<rdar://problem/23643436>

Reviewed by Daniel Bates.

Speculative fix and code clean-up based on source code
inspection.  The fix for the crash is in two parts that change
XSLStyleSheet::parseString():
1. Always set m_stylesheetDoc to nullptr after freeing it via
   XSLStyleSheet::clearXSLStylesheetDocument().
2. Add nullptr check before using m_stylesheetDoc from parent.

Broadly speaking, the changes are:
- Extract code to reset m_stylesheetDoc into new private
  XSLStyleSheet::clearXSLStylesheetDocument() method.  There is
  a special contract between m_stylesheetDoc and
  m_stylesheetDocTaken that wasn't being followed every time.
  See comment in XSLStyleSheet::compileStyleSheet().
- XSLStyleSheet::clearDocuments() now calls new
  clearXSLStylesheetDocument() method.  Previously, it was not
  checking or resetting m_stylesheetDocTaken, and it might have
  leaked an xmlDocPtr if m_stylesheetDoc was set and
  m_stylesheetDocTaken was false.
- XSLStyleSheet::parseString() now calls new
  clearXSLStylesheetDocument() method.  Previously, it did not
  clear m_stylesheetDoc after freeing it, and it could return
  early due to a failure in xmlCreateMemoryParserCtxt().
- In XSLStyleSheet::parseString() use checked arithmetic when
  calculating 'size' for xmlCreateMemoryParserCtxt() and
  xmlCtxtReadMemory().  This code used to do an implicit
  unsigned -> signed integer conversion that could overflow.
- Always iterate m_children using an 'auto& import' variable.

* xml/XSLStyleSheet.h:
(WebCore::XSLStyleSheet::clearXSLStylesheetDocument): Add declaration.
(WebCore::XSLStyleSheet::m_disabled): Add default initializer.
(WebCore::XSLStyleSheet::m_stylesheetDoc): Ditto.
(WebCore::XSLStyleSheet::m_stylesheetDocTaken): Ditto.
(WebCore::XSLStyleSheet::m_parentStyleSheet): Ditto.

* xml/XSLStyleSheetLibxslt.cpp:
(WebCore::XSLStyleSheet::XSLStyleSheet): Get rid of redundant
initializers.  Set m_parentStyleSheet if needed.
(WebCore::XSLStyleSheet::~XSLStyleSheet): Call
clearXSLStylesheetDocument() instead of custom code.  Switch
m_children fast iteration to use 'auto& import' variable.
(WebCore::XSLStyleSheet::isLoading): Switch m_children fast
iteration to use 'auto& import' variable.
(WebCore::XSLStyleSheet::clearDocuments): Call
clearXSLStylesheetDocument() instead of setting m_stylesheetDoc
to nullptr.  This might fix an occasional xmlDocPtr leak.
(WebCore::XSLStyleSheet::clearXSLStylesheetDocument): Add.  This
method always sets m_stylesheetDoc to nullptr (after freeing it
if necessary) and sets m_stylesheetDocTaken to false.
(WebCore::XSLStyleSheet::parseString): Call
clearXSLStylesheetDocument().  Prior to this, m_stylesheetDoc
might be left pointing to a freed value, and this method could
return early if xmlCreateMemoryParserCtxt() failed.  Switch to
using Checked<> to compute required buffer size to parse XSL
stylesheet, and return early on overflow.  Clean up existing
return statements to use boolean expressions.  Add nullptr check
for m_parentStyleSheet->m_stylesheetDoc before using it.
(WebCore::XSLStyleSheet::loadChildSheet): Get rid of local
variable by calling loadSheet() from last array element.
(WebCore::XSLStyleSheet::compileStyleSheet): Add debug assert
that m_stylesheetDoc is not nullptr.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216889 268f45cc-cd09-0410-ab3c-d52691b4dbfc

3 years agoUnreviewed, rebaseline platform/ios/ios/css/construct-WebKitCSSMatrix.html after...
cdumez@apple.com [Mon, 15 May 2017 23:36:20 +0000 (23:36 +0000)]
Unreviewed, rebaseline platform/ios/ios/css/construct-WebKitCSSMatrix.html after r216881.

* platform/ios/ios/css/construct-WebKitCSSMatrix-expected.txt:
* platform/ios/ios/css/resources/construct-WebKitCSSMatrix.js:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216888 268f45cc-cd09-0410-ab3c-d52691b4dbfc

3 years agoUpdate ARES-6 plan file to use the latest version
rniwa@webkit.org [Mon, 15 May 2017 23:24:43 +0000 (23:24 +0000)]
Update ARES-6 plan file to use the latest version
https://bugs.webkit.org/show_bug.cgi?id=172139

Reviewed by Keith Miller.

Include r216538.

* Scripts/webkitpy/benchmark_runner/data/plans/ares6.plan:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216887 268f45cc-cd09-0410-ab3c-d52691b4dbfc

3 years agoAdd experimental setting to allow document gesture interaction to fulfill media playb...
jer.noble@apple.com [Mon, 15 May 2017 22:46:13 +0000 (22:46 +0000)]
Add experimental setting to allow document gesture interaction to fulfill media playback gesture requirement
https://bugs.webkit.org/show_bug.cgi?id=172131

Reviewed by Eric Carlson.

Source/WebCore:

Test: media/restricted-audio-playback-with-document-gesture.html

Move all calls to ScriptController::processingUserGestureForMedia() to the new Document equivalent. In Document,
if the new setting is enabled, return true from processingUserGestureForMedia() if the top-level document has had
a user gesture interaction.

* Modules/mediastream/MediaStream.cpp:
(WebCore::MediaStream::processingUserGestureForMedia):
* Modules/mediastream/MediaStream.h:
* Modules/webaudio/AudioContext.cpp:
(WebCore::AudioContext::processingUserGestureForMedia):
(WebCore::AudioContext::willBeginPlayback):
(WebCore::AudioContext::willPausePlayback):
* Modules/webaudio/AudioContext.h:
* dom/Document.cpp:
(WebCore::Document::processingUserGestureForMedia):
* dom/Document.h:
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::load):
(WebCore::HTMLMediaElement::audioTrackEnabledChanged):
(WebCore::HTMLMediaElement::seekWithTolerance):
(WebCore::HTMLMediaElement::play):
(WebCore::HTMLMediaElement::playInternal):
(WebCore::HTMLMediaElement::pause):
(WebCore::HTMLMediaElement::pauseInternal):
(WebCore::HTMLMediaElement::setMuted):
(WebCore::HTMLMediaElement::webkitShowPlaybackTargetPicker):
(WebCore::HTMLMediaElement::processingUserGestureForMedia):
* html/HTMLMediaElement.h:
* html/MediaElementSession.cpp:
(WebCore::MediaElementSession::playbackPermitted):
(WebCore::MediaElementSession::dataLoadingPermitted):
(WebCore::MediaElementSession::fullscreenPermitted):
(WebCore::MediaElementSession::canShowControlsManager):
(WebCore::MediaElementSession::showPlaybackTargetPicker):
* page/Settings.in:
* platform/audio/PlatformMediaSession.h:

Source/WebKit/mac:

* WebView/WebPreferenceKeysPrivate.h:
* WebView/WebPreferences.mm:
(+[WebPreferences initialize]):
(-[WebPreferences mediaUserGestureInheritsFromDocument]):
(-[WebPreferences setMediaUserGestureInheritsFromDocument:]):
* WebView/WebPreferencesPrivate.h:

Source/WebKit2:

* Shared/WebPreferencesDefinitions.h:
* UIProcess/API/C/WKPreferences.cpp:
(WKPreferencesSetMediaUserGestureInheritsFromDocument):
(WKPreferencesGetMediaUserGestureInheritsFromDocument):
* UIProcess/API/C/WKPreferencesRefPrivate.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::updatePreferences):

LayoutTests:

* media/restricted-audio-playback-with-document-gesture-expected.txt: Added.
* media/restricted-audio-playback-with-document-gesture.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216886 268f45cc-cd09-0410-ab3c-d52691b4dbfc

3 years agoLayoutTest http/tests/media/track-in-band-hls-metadata-crash.html is a flaky timeout
pvollan@apple.com [Mon, 15 May 2017 22:40:50 +0000 (22:40 +0000)]
LayoutTest http/tests/media/track-in-band-hls-metadata-crash.html is a flaky timeout
https://bugs.webkit.org/show_bug.cgi?id=167749

Reviewed by Eric Carlson.

Start video playback when the 'canplaythrough' event is handled, and stop logging the event,
since the event sequence is not identical on all bots.

* http/tests/media/track-in-band-hls-metadata-crash-expected.txt:
* http/tests/media/track-in-band-hls-metadata-crash.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216885 268f45cc-cd09-0410-ab3c-d52691b4dbfc

3 years agoOnly ever initialize LibWebRTCProvider's staticFactoryAndThreads() factories once.
jer.noble@apple.com [Mon, 15 May 2017 22:34:15 +0000 (22:34 +0000)]
Only ever initialize LibWebRTCProvider's staticFactoryAndThreads() factories once.
https://bugs.webkit.org/show_bug.cgi?id=172047

Reviewed by Youenn Fablet.

Wrap the initilization of the factories contained in staticFactoryAndThreads() in a call_once to ensure
new factories aren't created every time it's called.

* platform/mediastream/libwebrtc/LibWebRTCProvider.cpp:
(WebCore::staticFactoryAndThreads):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216884 268f45cc-cd09-0410-ab3c-d52691b4dbfc

3 years agoWeb Inspector: CRASH seen with DOM.setOuterHTML when there is no documentElement
commit-queue@webkit.org [Mon, 15 May 2017 22:32:27 +0000 (22:32 +0000)]
Web Inspector: CRASH seen with DOM.setOuterHTML when there is no documentElement
https://bugs.webkit.org/show_bug.cgi?id=172135
<rdar://problem/32175860>

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2017-05-15
Reviewed by Brian Burg.

Source/WebCore:

Test: inspector/dom/setOuterHTML-no-document-element.html

* inspector/DOMPatchSupport.cpp:
(WebCore::DOMPatchSupport::patchDocument):
Null check the document element which might not exist.

LayoutTests:

* inspector/dom/setOuterHTML-no-document-element-expected.txt: Added.
* inspector/dom/setOuterHTML-no-document-element.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216883 268f45cc-cd09-0410-ab3c-d52691b4dbfc

3 years agoREGRESSION (216471): Infinite repaint-drawing loop when asynchronously decoding incom...
commit-queue@webkit.org [Mon, 15 May 2017 22:10:37 +0000 (22:10 +0000)]
REGRESSION (216471): Infinite repaint-drawing loop when asynchronously decoding incomplete image frames
https://bugs.webkit.org/show_bug.cgi?id=171900

Patch by Said Abou-Hallawa <sabouhallawa@apple.com> on 2017-05-15
Reviewed by Tim Horton.

-- Don't destroy incomplete decoded image frames for large images. This
is to avoid flickering while decoding another image frame with the new
data. The old incomplete image frame will be destroyed once the newer one
finishes decoding.

-- Extend the enum ImageFrame::DecodingStatus by adding a new value called
'Decoding'. This new value will never be cached in the ImageFrame::
m_decodingStatus. Add a member m_currentFrameDecodingStatus to BitmapImage.
The purpose of this member is to invalidate the current frame, without
deleting it, when new encoded data is received.

-- Don't wait until the native image is decoded to cache the ImageFrame
decodingStatus. There is a big chance that more data arrives between
starting the decoding and finishing it such that the decoding changes
from Partial to Complete. We need to prevent keeping incomplete ImageFrames
cached because we mistakenly assume they are complete. To fix this issue
we need to know the ImageFrame decodingStatus when the decoding is requested.

* platform/graphics/BitmapImage.cpp:
(WebCore::BitmapImage::destroyDecodedData):
(WebCore::BitmapImage::dataChanged):
(WebCore::BitmapImage::draw):
(WebCore::BitmapImage::internalStartAnimation): At the beginning of this
function we check whether the next frame is being decoded or not and we
return DecodingActive if it is. Let's handle the second check here also
before requesting the decoding of nextFrame. We need to check whether the
nextFrame has a native image with decoded with the native size or not.
(WebCore::BitmapImage::internalAdvanceAnimation):
(WebCore::BitmapImage::imageFrameAvailableAtIndex):
* platform/graphics/BitmapImage.h:
* platform/graphics/ImageFrame.cpp:
(WebCore::ImageFrame::operator=):
(WebCore::ImageFrame::setDecodingStatus):
(WebCore::ImageFrame::decodingStatus):
* platform/graphics/ImageFrame.h:
(WebCore::ImageFrame::isInvalid):
(WebCore::ImageFrame::isPartial):
(WebCore::ImageFrame::isComplete):
(WebCore::ImageFrame::setDecoding): Deleted.
(WebCore::ImageFrame::decoding): Deleted.
(WebCore::ImageFrame::isEmpty): Deleted.
* platform/graphics/ImageFrameCache.cpp:
(WebCore::ImageFrameCache::setNativeImage):
(WebCore::ImageFrameCache::cacheMetadataAtIndex):
(WebCore::ImageFrameCache::cacheNativeImageAtIndex):
(WebCore::ImageFrameCache::cacheNativeImageAtIndexAsync):
(WebCore::ImageFrameCache::startAsyncDecodingQueue):
(WebCore::ImageFrameCache::requestFrameAsyncDecodingAtIndex):
(WebCore::ImageFrameCache::stopAsyncDecodingQueue):
(WebCore::ImageFrameCache::frameAtIndexCacheIfNeeded):
(WebCore::ImageFrameCache::frameDecodingStatusAtIndex):
(WebCore::ImageFrameCache::cacheFrameMetadataAtIndex): Deleted.
(WebCore::ImageFrameCache::cacheFrameNativeImageAtIndex): Deleted.
(WebCore::ImageFrameCache::cacheAsyncFrameNativeImageAtIndex): Deleted.
(WebCore::ImageFrameCache::frameIsCompleteAtIndex): Deleted.
* platform/graphics/ImageFrameCache.h:
(WebCore::ImageFrameCache::ImageFrameRequest::operator==):
* platform/graphics/ImageSource.cpp:
(WebCore::ImageSource::dataChanged):
* platform/graphics/ImageSource.h:
(WebCore::ImageSource::destroyIncompleteDecodedData):
(WebCore::ImageSource::requestFrameAsyncDecodingAtIndex): Let the caller
decide whether another request for the same image frame is allowed or not.
(WebCore::ImageSource::frameDecodingStatusAtIndex):
(WebCore::ImageSource::frameIsCompleteAtIndex): Deleted.
* platform/image-decoders/ImageDecoder.cpp:
(WebCore::ImageDecoder::frameDurationAtIndex):
(WebCore::ImageDecoder::createFrameImageAtIndex):
* platform/image-decoders/bmp/BMPImageReader.cpp:
(WebCore::BMPImageReader::decodeBMP):
* platform/image-decoders/gif/GIFImageDecoder.cpp:
(WebCore::GIFImageDecoder::clearFrameBufferCache):
(WebCore::GIFImageDecoder::haveDecodedRow):
(WebCore::GIFImageDecoder::frameComplete):
(WebCore::GIFImageDecoder::initFrameBuffer):
* platform/image-decoders/jpeg/JPEGImageDecoder.cpp:
(WebCore::JPEGImageDecoder::outputScanlines):
(WebCore::JPEGImageDecoder::jpegComplete):
* platform/image-decoders/png/PNGImageDecoder.cpp:
(WebCore::PNGImageDecoder::rowAvailable):
(WebCore::PNGImageDecoder::pngComplete):
(WebCore::PNGImageDecoder::clearFrameBufferCache):
(WebCore::PNGImageDecoder::frameComplete):
* platform/image-decoders/webp/WEBPImageDecoder.cpp:
(WebCore::WEBPImageDecoder::decode):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216882 268f45cc-cd09-0410-ab3c-d52691b4dbfc

3 years agoAlign WebKitCSSMatrix stringifier with spec for DOMMatrix
cdumez@apple.com [Mon, 15 May 2017 22:07:54 +0000 (22:07 +0000)]
Align WebKitCSSMatrix stringifier with spec for DOMMatrix
https://bugs.webkit.org/show_bug.cgi?id=172114

Reviewed by Simon Fraser.

Source/WebCore:

Align WebKitCSSMatrix stringifier with spec for DOMMatrix after:
- https://github.com/w3c/fxtf-drafts/pull/148

The following changes were made:
- Use EcmaScript's ToString() to convert floating point values to string
- Throw an invalid state error if the matrix contains non-finite values
- Made WebKitCSSMatrix.toString enumerable as per [1].

[1] https://heycam.github.io/webidl/#es-stringifier

Test: fast/css/matrix-stringifier.html

* css/WebKitCSSMatrix.cpp:
(WebCore::WebKitCSSMatrix::toString):
* css/WebKitCSSMatrix.h:
* css/WebKitCSSMatrix.idl:
* platform/graphics/transforms/TransformationMatrix.cpp:
(WebCore::TransformationMatrix::containsOnlyFiniteValues):
* platform/graphics/transforms/TransformationMatrix.h:

LayoutTests:

* fast/css/matrix-stringifier-expected.txt: Added.
* fast/css/matrix-stringifier.html: Added.
Add layout test coverage.

* fast/dom/Window/custom-constructors-expected.txt:
* fast/dom/Window/custom-constructors.html:
Rebaseline existing test to reflect behavior change.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216881 268f45cc-cd09-0410-ab3c-d52691b4dbfc

3 years agoJSEnvironmentRecord::allocationSizeForScopeSize() and offsetOfVariable(ScopeOffset...
ddkilzer@apple.com [Mon, 15 May 2017 21:51:09 +0000 (21:51 +0000)]
JSEnvironmentRecord::allocationSizeForScopeSize() and offsetOfVariable(ScopeOffset) should used checked arithmetic
<https://webkit.org/b/172134>

Reviewed by Saam Barati.

* runtime/JSEnvironmentRecord.h:
(JSC::JSEnvironmentRecord::offsetOfVariable): Change to return
size_t and use checked arithmetic.
(JSC::JSEnvironmentRecord::allocationSizeForScopeSize): Change
to use checked arithmetic.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216880 268f45cc-cd09-0410-ab3c-d52691b4dbfc

3 years agoAX: Inaccessible content on webkit.org main page
jcraig@apple.com [Mon, 15 May 2017 21:36:32 +0000 (21:36 +0000)]
AX: Inaccessible content on webkit.org main page
https://bugs.webkit.org/show_bug.cgi?id=172106

Reviewed by Joseph Pecoraro.

* wp-content/themes/webkit/widgets/icon.php: Resolved link title.
* wp-content/themes/webkit/widgets/post.php: Resolved link title.
* wp-content/themes/webkit/widgets/twitter.php: Resolved link titles. Suppressed unlabeled images with alt="".

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216879 268f45cc-cd09-0410-ab3c-d52691b4dbfc

3 years agoImport css/geometry-1 web-platform-tests
cdumez@apple.com [Mon, 15 May 2017 21:23:23 +0000 (21:23 +0000)]
Import css/geometry-1 web-platform-tests
https://bugs.webkit.org/show_bug.cgi?id=172130

Reviewed by Youenn Fablet.

Import css/geometry-1 web-platform-tests to gain better test coverage.

* resources/import-expectations.json:
* web-platform-tests/css/geometry-1/DOMMatrix-001-expected.txt: Added.
* web-platform-tests/css/geometry-1/DOMMatrix-001.html: Added.
* web-platform-tests/css/geometry-1/DOMMatrix-002-expected.txt: Added.
* web-platform-tests/css/geometry-1/DOMMatrix-002.html: Added.
* web-platform-tests/css/geometry-1/DOMMatrix-003-expected.txt: Added.
* web-platform-tests/css/geometry-1/DOMMatrix-003.html: Added.
* web-platform-tests/css/geometry-1/DOMMatrix-a-f-alias-expected.txt: Added.
* web-platform-tests/css/geometry-1/DOMMatrix-a-f-alias.html: Added.
* web-platform-tests/css/geometry-1/DOMMatrix-css-string.worker-expected.txt: Added.
* web-platform-tests/css/geometry-1/DOMMatrix-css-string.worker.html: Added.
* web-platform-tests/css/geometry-1/DOMMatrix-css-string.worker.js: Added.
(string_appeared_here.forEach.constr.test):
(string_appeared_here.forEach.constr.assert_equals):
(test):
* web-platform-tests/css/geometry-1/DOMMatrix-newobject-expected.txt: Added.
* web-platform-tests/css/geometry-1/DOMMatrix-newobject.html: Added.
* web-platform-tests/css/geometry-1/DOMPoint-001-expected.txt: Added.
* web-platform-tests/css/geometry-1/DOMPoint-001.html: Added.
* web-platform-tests/css/geometry-1/DOMPoint-002-expected.txt: Added.
* web-platform-tests/css/geometry-1/DOMPoint-002.html: Added.
* web-platform-tests/css/geometry-1/DOMQuad-001-expected.txt: Added.
* web-platform-tests/css/geometry-1/DOMQuad-001.html: Added.
* web-platform-tests/css/geometry-1/DOMQuad-002-expected.txt: Added.
* web-platform-tests/css/geometry-1/DOMQuad-002.html: Added.
* web-platform-tests/css/geometry-1/DOMRect-001-expected.txt: Added.
* web-platform-tests/css/geometry-1/DOMRect-001.html: Added.
* web-platform-tests/css/geometry-1/OWNERS: Added.
* web-platform-tests/css/geometry-1/WebKitCSSMatrix-expected.txt: Added.
* web-platform-tests/css/geometry-1/WebKitCSSMatrix.html: Added.
* web-platform-tests/css/geometry-1/WebKitCSSMatrix.worker-expected.txt: Added.
* web-platform-tests/css/geometry-1/WebKitCSSMatrix.worker.html: Added.
* web-platform-tests/css/geometry-1/WebKitCSSMatrix.worker.js: Added.
(test):
* web-platform-tests/css/geometry-1/historical-expected.txt: Added.
* web-platform-tests/css/geometry-1/historical.html: Added.
* web-platform-tests/css/geometry-1/structured-serialization-expected.txt: Added.
* web-platform-tests/css/geometry-1/structured-serialization.html: Added.
* web-platform-tests/css/geometry-1/w3c-import.log: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@216878 268f45cc-cd09-0410-ab3c-d52691b4dbfc