cb85a300f5369ab44207291635195e705595935f
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2016-11-10  Dean Jackson  <dino@apple.com>
2
3         Add CSS Color Level 4 to features.
4
5         * features.json:
6
7 2016-11-10  Zalan Bujtas  <zalan@apple.com>
8
9         Move update image calls to RenderElement::styleDidChange.
10         https://bugs.webkit.org/show_bug.cgi?id=164623
11
12         Reviewed by Simon Fraser.
13
14         There should be no dependency on the image update between ::styleWillChange and ::styleDidChange.
15
16         Covered by existing tests.
17
18         * rendering/RenderElement.cpp:
19         (WebCore::RenderElement::initializeStyle):
20         (WebCore::RenderElement::setStyle):
21         (WebCore::RenderElement::styleDidChange):
22
23 2016-11-10  Joseph Pecoraro  <pecoraro@apple.com>
24
25         After r207459 ASSERT in CachedResourceLoader under InspectorPageAgent::cachedResource
26         https://bugs.webkit.org/show_bug.cgi?id=164621
27
28         Reviewed by Youenn Fablet.
29
30         * inspector/InspectorPageAgent.cpp:
31         (WebCore::InspectorPageAgent::cachedResource):
32         CachedResourceLoader expects a sanitized URL.
33
34 2016-11-10  Brady Eidson  <beidson@apple.com>
35
36         IndexedDB 2.0 Support the IDBDatabase.onclose event.
37         https://bugs.webkit.org/show_bug.cgi?id=164602
38
39         Reviewed by Alex Christensen.
40
41         No new tests (Covered by existing tests).
42
43         * Modules/indexeddb/IDBDatabase.cpp:
44         (WebCore::IDBDatabase::connectionToServerLost): Fire "onclose" after "onerror"
45         * Modules/indexeddb/IDBDatabase.idl:
46
47 2016-11-10  Ryosuke Niwa  <rniwa@webkit.org>
48
49         Copied text would contain text inside CDATA sections and comments
50         https://bugs.webkit.org/show_bug.cgi?id=164578
51         <rdar://problem/19834542>
52
53         Reviewed by Darin Adler.
54
55         The bug was caused by HTMLConverter::_traverseNode always including the content of a Text node.
56         Since Comment and CDataSection nodes are also Text nodes, we need to exclude them.
57
58         In the long term, we should check the visibility of the text as done in MarkupAccumulator.
59
60         Test: editing/mac/attributed-string/comment-cdata-section.html
61
62         * editing/cocoa/HTMLConverter.mm:
63         (HTMLConverter::_traverseNode):
64
65 2016-11-10  Eric Carlson  <eric.carlson@apple.com>
66
67         [MediaStream] apply constraints passed to getUserMedia()
68         https://bugs.webkit.org/show_bug.cgi?id=164561
69
70         Reviewed by Youenn Fablet.
71         <rdar://problem/29191384>
72
73         No new tests, updated existing tests.
74
75         * Modules/mediastream/UserMediaRequest.cpp:
76         (WebCore::UserMediaRequest::allow): Pass constraints into createMediaStream instead of applying
77           them after the stream has been created.
78
79         * WebCore.xcodeproj/project.pbxproj: Remove MediaConstraintsMock.cpp/.h.
80
81         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
82         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updatePausedImage): Remove a bogus assert.
83         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::currentReadyState): Drive-by fix: a stream
84           that is receiving media data is as ready as it will ever be so it's readyState should be
85           at HAVE_ENOUGH_DATA.
86
87         Simplify CaptureDeviceManager by removing all code for constraint validation because some
88         constraints can't be validated without a live capture device. Ports that are able to resolve
89         constraints without creating a live source can do so in a derived capture device class.
90         * platform/mediastream/CaptureDeviceManager.cpp:
91         (CaptureDeviceManager::bestSourcesForTypeAndConstraints): Return a list of UIDs, not a list
92           of live sources, because that is all the caller will use. This will allows ports to avoid
93           source creation in some cases.
94         (CaptureDeviceManager::sourceWithUID): Add parameters for new source constraints and invalid
95           constraint.
96         (CaptureDeviceManager::verifyConstraintsForMediaType): Deleted.
97         (CaptureDeviceManager::bestDeviceForFacingMode): Deleted.
98         (facingModeFromString): Deleted.
99         (CaptureDeviceManager::sessionSupportsConstraint): Deleted.
100         (CaptureDeviceManager::isSupportedFrameRate): Deleted.
101         * platform/mediastream/CaptureDeviceManager.h:
102         (WebCore::CaptureDeviceManager::defaultCaptureSession): Deleted.
103
104         * platform/mediastream/MediaConstraints.cpp:
105         (WebCore::FlattenedConstraint::find): New, make it possible to examine resolved constraints.
106         * platform/mediastream/MediaConstraints.h:
107         (WebCore::NumericConstraint::fitnessDistance): Reject invalid constraints.
108         (WebCore::NumericConstraint::valueForCapabilityRange): New, resolve a constraint for a 
109           capability range.
110         (WebCore::MediaTrackConstraintSetMap::width): Expose constraints held in the map.
111         (WebCore::MediaTrackConstraintSetMap::height):
112         (WebCore::MediaTrackConstraintSetMap::sampleRate):
113         (WebCore::MediaTrackConstraintSetMap::sampleSize):
114         (WebCore::MediaTrackConstraintSetMap::aspectRatio):
115         (WebCore::MediaTrackConstraintSetMap::frameRate):
116         (WebCore::MediaTrackConstraintSetMap::volume):
117         (WebCore::MediaTrackConstraintSetMap::echoCancellation):
118         (WebCore::MediaTrackConstraintSetMap::facingMode):
119         (WebCore::MediaTrackConstraintSetMap::deviceId):
120         (WebCore::MediaTrackConstraintSetMap::groupId):
121
122         Resolve and apply width, height, and frameRate all at once because the ability to support
123         one may depend on the value of another.
124         * platform/mediastream/RealtimeMediaSource.cpp:
125         (WebCore::RealtimeMediaSource::supportsSizeAndFrameRate): 
126         (WebCore::applyNumericConstraint): Move the guts of the logic into valueForCapabilityRange.
127         (WebCore::RealtimeMediaSource::applySizeAndFrameRate):
128         (WebCore::RealtimeMediaSource::selectSettings):
129         (WebCore::RealtimeMediaSource::supportsConstraints):
130         (WebCore::RealtimeMediaSource::applyConstraints): Support null success/failure lambdas.
131         * platform/mediastream/RealtimeMediaSource.h:
132
133         * platform/mediastream/RealtimeMediaSourceCenter.h:
134         * platform/mediastream/mac/AVAudioCaptureSource.h:
135         * platform/mediastream/mac/AVAudioCaptureSource.mm:
136         (WebCore::AVAudioCaptureSource::create): Add parameter for creation constraints.
137         (WebCore::AVAudioCaptureSource::AVAudioCaptureSource): Ditto.
138
139         Remove all constraint validation code, it is done by the audio and video capture sources. Add
140         support for stream creation constraints.
141         * platform/mediastream/mac/AVCaptureDeviceManager.h:
142         * platform/mediastream/mac/AVCaptureDeviceManager.mm:
143         (WebCore::AVCaptureDeviceManager::captureDeviceList):
144         (WebCore::AVCaptureDeviceManager::createMediaSourceForCaptureDeviceWithConstraints):
145         (WebCore::AVCaptureDeviceManager::bestSourcesForTypeAndConstraints): Deleted.
146         (WebCore::AVCaptureDeviceManager::sourceWithUID): Deleted.
147         (WebCore::AVCaptureDeviceManager::verifyConstraintsForMediaType): Deleted.
148         (WebCore::AVCaptureDeviceManager::defaultCaptureSession): Deleted.
149         (WebCore::AVCaptureDeviceManager::sessionSupportsConstraint): Deleted.
150         (WebCore::AVCaptureDeviceManager::isSupportedFrameRate): Deleted.
151         (WebCore::AVCaptureDeviceManager::supportedConstraints): Deleted.
152
153         * platform/mediastream/mac/AVMediaCaptureSource.h:
154         (WebCore::AVMediaCaptureSource::constraints): Deleted.
155         * platform/mediastream/mac/AVMediaCaptureSource.mm:
156         (WebCore::AVMediaCaptureSource::AVMediaCaptureSource):
157         (WebCore::AVMediaCaptureSource::~AVMediaCaptureSource):
158         (WebCore::AVMediaCaptureSource::startProducingData):
159         (WebCore::AVMediaCaptureSource::stopProducingData):
160         (WebCore::AVMediaCaptureSource::beginConfiguration):
161         (WebCore::AVMediaCaptureSource::commitConfiguration):
162         (WebCore::AVMediaCaptureSource::capabilities):
163         (WebCore::AVMediaCaptureSource::setupSession):
164         (WebCore::AVMediaCaptureSource::reset):
165
166         Validate and apply constraints, support source creation constraints, initialize capabilities
167         and supported constraints by examining device capabilities.
168         * platform/mediastream/mac/AVVideoCaptureSource.h:
169         * platform/mediastream/mac/AVVideoCaptureSource.mm:
170         (WebCore::AVVideoCaptureSource::create):
171         (WebCore::AVVideoCaptureSource::AVVideoCaptureSource):
172         (WebCore::updateSizeMinMax):
173         (WebCore::updateAspectRatioMinMax):
174         (WebCore::AVVideoCaptureSource::initializeCapabilities):
175         (WebCore::AVVideoCaptureSource::initializeSupportedConstraints):
176         (WebCore::AVVideoCaptureSource::applySize):
177         (WebCore::AVVideoCaptureSource::setPreset):
178         (WebCore::AVVideoCaptureSource::applyFrameRate):
179         (WebCore::AVVideoCaptureSource::applySizeAndFrameRate):
180         (WebCore::AVVideoCaptureSource::setupCaptureSession):
181         (WebCore::AVVideoCaptureSource::currentFrameCGImage):
182         (WebCore::AVVideoCaptureSource::bestSessionPresetForVideoDimensions):
183         (WebCore::AVVideoCaptureSource::supportsSizeAndFrameRate):
184
185         * platform/mediastream/mac/MockRealtimeVideoSourceMac.h:
186         * platform/mediastream/mac/MockRealtimeVideoSourceMac.mm:
187         (WebCore::MockRealtimeVideoSource::create): Apply creation constraints, return null if they
188           can not be applied successfully.
189         (WebCore::MockRealtimeVideoSourceMac::MockRealtimeVideoSourceMac):
190         (WebCore::MockRealtimeVideoSource::createMuted):
191
192         Update RealtimeMediaSourceCenters for API changes.
193         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp:
194         (WebCore::RealtimeMediaSourceCenterMac::validateRequestConstraints):
195         (WebCore::RealtimeMediaSourceCenterMac::createMediaStream):
196         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.h:
197         * platform/mediastream/openwebrtc/RealtimeMediaSourceCenterOwr.cpp:
198         (WebCore::RealtimeMediaSourceCenterOwr::validateRequestConstraints):
199         (WebCore::RealtimeMediaSourceCenterOwr::createMediaStream):
200         (WebCore::RealtimeMediaSourceCenterOwr::mediaSourcesAvailable):
201         * platform/mediastream/openwebrtc/RealtimeMediaSourceCenterOwr.h:
202
203         Mock media sources support constraint validation and application directly so "mock constraints"
204         are no longer necessary.
205         * platform/mock/MediaConstraintsMock.cpp: Removed.
206         * platform/mock/MediaConstraintsMock.h: Removed.
207         * platform/mock/MockRealtimeAudioSource.cpp:
208         (WebCore::MockRealtimeAudioSource::create):
209         (WebCore::MockRealtimeAudioSource::createMuted):
210         (WebCore::MockRealtimeAudioSource::updateSettings):
211         (WebCore::MockRealtimeAudioSource::initializeCapabilities):
212         (WebCore::MockRealtimeAudioSource::initializeSupportedConstraints):
213         * platform/mock/MockRealtimeAudioSource.h:
214         * platform/mock/MockRealtimeMediaSourceCenter.cpp:
215         (WebCore::MockRealtimeMediaSourceCenter::validateRequestConstraints):
216         (WebCore::MockRealtimeMediaSourceCenter::createMediaStream):
217         * platform/mock/MockRealtimeMediaSourceCenter.h:
218         * platform/mock/MockRealtimeVideoSource.cpp:
219         (WebCore::MockRealtimeVideoSource::create):
220         (WebCore::MockRealtimeVideoSource::createMuted):
221         * platform/mock/MockRealtimeVideoSource.h:
222         * platform/mock/RTCPeerConnectionHandlerMock.cpp:
223
224 2016-11-10  Alex Christensen  <achristensen@webkit.org>
225
226         Move SecurityOrigin::databaseIdentifier() to SecurityOriginData
227         https://bugs.webkit.org/show_bug.cgi?id=164573
228
229         Reviewed by Brady Eidson.
230
231         No change in behavior.
232
233         * Modules/encryptedmedia/legacy/WebKitMediaKeySession.cpp:
234         (WebCore::WebKitMediaKeySession::mediaKeysStorageDirectory):
235         * Modules/indexeddb/IDBDatabaseIdentifier.cpp:
236         (WebCore::IDBDatabaseIdentifier::databaseDirectoryRelativeToRoot):
237         * Modules/indexeddb/server/IDBServer.cpp:
238         (WebCore::IDBServer::IDBServer::performCloseAndDeleteDatabasesForOrigins):
239         * Modules/webdatabase/DatabaseTracker.cpp:
240         (WebCore::DatabaseTracker::hasEntryForOriginNoLock):
241         (WebCore::DatabaseTracker::hasEntryForDatabase):
242         (WebCore::DatabaseTracker::originPath):
243         (WebCore::DatabaseTracker::fullPathForDatabaseNoLock):
244         (WebCore::DatabaseTracker::databaseNamesForOriginNoLock):
245         (WebCore::DatabaseTracker::detailsForNameAndOrigin):
246         (WebCore::DatabaseTracker::setDatabaseDetails):
247         (WebCore::DatabaseTracker::originLockFor):
248         (WebCore::DatabaseTracker::deleteOriginLockFor):
249         (WebCore::DatabaseTracker::quotaForOriginNoLock):
250         (WebCore::DatabaseTracker::setQuota):
251         (WebCore::DatabaseTracker::addDatabase):
252         (WebCore::DatabaseTracker::deleteOrigin):
253         (WebCore::DatabaseTracker::deleteDatabase):
254         (WebCore::DatabaseTracker::removeDeletedOpenedDatabases):
255         * Modules/webdatabase/SQLTransactionCoordinator.cpp:
256         (WebCore::getDatabaseIdentifier):
257         * dom/Document.cpp:
258         (WebCore::Document::origin):
259         * html/HTMLMediaElement.cpp:
260         (WebCore::HTMLMediaElement::mediaPlayerMediaKeysStorageDirectory):
261         * loader/appcache/ApplicationCacheStorage.cpp:
262         (WebCore::ApplicationCacheStorage::calculateQuotaForOrigin):
263         (WebCore::ApplicationCacheStorage::calculateUsageForOrigin):
264         (WebCore::ApplicationCacheStorage::calculateRemainingSizeForOriginExcludingCache):
265         (WebCore::ApplicationCacheStorage::storeUpdatedQuotaForOrigin):
266         (WebCore::ApplicationCacheStorage::store):
267         (WebCore::ApplicationCacheStorage::ensureOriginRecord):
268         * page/SecurityOrigin.cpp:
269         (WebCore::SecurityOrigin::databaseIdentifier): Deleted.
270         * page/SecurityOrigin.h:
271         * page/SecurityOriginData.cpp:
272         (WebCore::SecurityOriginData::databaseIdentifier):
273         * page/SecurityOriginData.h:
274
275 2016-11-10  Zalan Bujtas  <zalan@apple.com>
276
277         RenderElement::invalidateFlowThreadContainingBlockIncludingDescendants should be on RenderBlock.
278         https://bugs.webkit.org/show_bug.cgi?id=164601
279
280         Reviewed by Simon Fraser.
281
282         FlowThread containing blocks are cached at RenderBlocks. It makes no sense to call the invalidate function on a RenderElement.
283         Move invalidateFlowThreadContainingBlockIncludingDescendants to RenderBlock.
284
285         No change in functionality.
286
287         * rendering/RenderBlock.cpp:
288         (WebCore::RenderBlock::invalidateFlowThreadContainingBlockIncludingDescendants):
289         * rendering/RenderBlock.h:
290         * rendering/RenderElement.cpp:
291         (WebCore::RenderElement::invalidateFlowThreadContainingBlockIncludingDescendants): Deleted.
292         * rendering/RenderElement.h:
293         * rendering/RenderInline.cpp:
294         (WebCore::RenderInline::splitInlines):
295
296 2016-11-10  Brent Fulgham  <bfulgham@apple.com>
297
298         Local file restrictions should not block sessionStorage access.
299         https://bugs.webkit.org/show_bug.cgi?id=155609
300         <rdar://problem/25229461> 
301
302         Reviewed by Andy Estes.
303
304         Re-landing this fix that was lost when the localStorage change was rolled out.
305
306         Use of 'sessionStorage' is governed by SecurityOrigin with third party access
307         set to 'ShouldAllowFromThirdParty::AlwaysAllowFromThirdParty'. We should not
308         reject local files for this combination of arguments.
309
310         Tested by storage/domstorage/sessionstorage/blocked-file-access.html.
311
312         * page/SecurityOrigin.cpp:
313         (WebCore::SecurityOrigin::canAccessStorage): For the case of sessionStorage,
314         allow local file access.
315
316 2016-11-10  Daniel Bates  <dabates@apple.com>
317
318         REGRESSION (r195004): Scripts and plugins blocked for subsequent loads in same WebContent
319         process after receiving HTTP 0.9 response
320         https://bugs.webkit.org/show_bug.cgi?id=164387
321         <rdar://problem/28987537>
322
323         Reviewed by Brent Fulgham.
324
325         Fixes an issue where the HTTP 0.9 sandbox persisted across subsequent loads in the same
326         WebContent process.
327
328         Currently when an HTTP 0.9 response is received for a request made to a default port
329         (e.g. 80) we apply a sandbox policy on the FrameLoader for the main resource that
330         disallows scripts and plugins. A FrameLoader may be re-used for navigations. Therefore,
331         the sandbox policy applied to one site may be applied to another site. Moreover the
332         sandbox policy was applied to the FrameLoader of the main resource regardless of whether
333         the HTTP response was for a subresource. Instead we should apply the sandbox on a per-
334         Document basis and only if we receive an HTTP 0.9 response for the document when the
335         corresponding HTTP request was made to a default port.
336
337         As a side benefit of this change, we emit exactly one console message to Web Inspector
338         when the HTTP 0.9 sandbox is applied to a document as opposed to three console messages.
339         Moreover, we only emit this console message when the document load is not blocked.
340
341         Test: http/tests/security/http-0.9/sandbox-should-not-persist-on-navigation.html
342
343         * dom/Document.cpp:
344         (WebCore::Document::initSecurityContext): Disallow scripts and plugins if an HTTP 0.9
345         response was received for this document. Note that if this function is called for a
346         document associated with an HTTP 0.9 response then the corresponding HTTP request was
347         made to a default port. DocumentLoader::responseReceived() blocks the load for a document
348         with an HTTP 0.9 response corresponding to an HTTP request made to a non-default port.
349         This invariant is covered by the tests LayoutTests/http/tests/security/http-0.9/default-port-{plugin, script}-blocked.html.
350         (WebCore::Document::shouldEnforceHTTP0_9Sandbox): Added. Returns whether an HTTP 0.9 response
351         was received for this document.
352         * dom/Document.h:
353         * loader/DocumentLoader.cpp:
354         (WebCore::DocumentLoader::responseReceived): Remove logic to apply sandbox policy to the
355         FrameLoader associated with the main resource. We will apply the sandbox during initialization
356         of the document.
357         * loader/ResourceLoader.cpp:
358         (WebCore::ResourceLoader::didReceiveResponse): Ditto.
359         * loader/SubresourceLoader.cpp:
360         (WebCore::SubresourceLoader::didReceiveResponse): Ditto.
361
362 2016-11-04  Jiewen Tan  <jiewen_tan@apple.com>
363
364         Update SubtleCrypto::importKey to match the latest spec
365         https://bugs.webkit.org/show_bug.cgi?id=164446
366         <rdar://problem/29123621>
367
368         Reviewed by Brent Fulgham.
369
370         This patch does following few things:
371         1. It updates the SubtleCrypto::importKey method to match the latest spec:
372            https://www.w3.org/TR/WebCryptoAPI/#SubtleCrypto-method-importKey.
373            It also refers to the latest Editor's Draft at a certain degree:
374            https://w3c.github.io/webcrypto/Overview.html#SubtleCrypto-method-importKey.
375         2. It implements importKey operations of following algorithms: AES-CBC, AES-KW,
376            HMAC, RSAES-PKCS1-V1_5, RSASSA-PKCS1-V1_5, and RSA-OAEP.
377         3. It fixes some minor problems of SubtleCrypto::generateKey.
378         4. It addes move constructors for CryptoKeyAES, CryptoKeyHMAC, CryptoKeyRSA and
379            CryptoKeyDataRSAComponents.
380         5. It renames HmacKeyGenParams to HmacKeyParams to serve the purpose of both
381            HmacKeyGenParams and HmacImportParams which are essentially the same.
382         6. It enforces the key length in bits of CryptoKeyHMAC to be multiples of 8.
383         7. It also fixes the following bugs:
384            https://bugs.webkit.org/show_bug.cgi?id=126033,
385            https://bugs.webkit.org/show_bug.cgi?id=126034,
386            https://bugs.webkit.org/show_bug.cgi?id=151308.
387         P.S. We currently only support Raw and Jwk key format.
388
389         Tests: crypto/subtle/aes-cbc-import-jwk-key-length-128.html
390                crypto/subtle/aes-cbc-import-jwk-key-length-192.html
391                crypto/subtle/aes-cbc-import-jwk-key-length-256.html
392                crypto/subtle/aes-cbc-import-jwk-key-minimum.html
393                crypto/subtle/aes-cbc-import-jwk-key-non-extractable.html
394                crypto/subtle/aes-cbc-import-raw-key-length-128.html
395                crypto/subtle/aes-cbc-import-raw-key-length-192.html
396                crypto/subtle/aes-cbc-import-raw-key-length-256.html
397                crypto/subtle/aes-import-key-malformed-parameters.html
398                crypto/subtle/aes-kw-import-jwk-key-length-128.html
399                crypto/subtle/aes-kw-import-jwk-key-length-192.html
400                crypto/subtle/aes-kw-import-jwk-key-length-256.html
401                crypto/subtle/aes-kw-import-raw-key.html
402                crypto/subtle/generate-key-malformed-parameters.html
403                crypto/subtle/hmac-import-jwk-key-minimum.html
404                crypto/subtle/hmac-import-jwk-key-non-extractable.html
405                crypto/subtle/hmac-import-jwk-key-sha1.html
406                crypto/subtle/hmac-import-jwk-key-sha224.html
407                crypto/subtle/hmac-import-jwk-key-sha256.html
408                crypto/subtle/hmac-import-jwk-key-sha384.html
409                crypto/subtle/hmac-import-jwk-key-sha512.html
410                crypto/subtle/hmac-import-malformed-parameters.html
411                crypto/subtle/hmac-import-raw-key-customized-length.html
412                crypto/subtle/hmac-import-raw-key.html
413                crypto/subtle/import-key-malformed-parameters.html
414                crypto/subtle/rsa-import-key-malformed-parameters.html
415                crypto/subtle/rsa-oaep-import-jwk-private-key.html
416                crypto/subtle/rsa-oaep-import-jwk-public-key-sha1.html
417                crypto/subtle/rsa-oaep-import-jwk-public-key-sha224.html
418                crypto/subtle/rsa-oaep-import-jwk-public-key-sha256.html
419                crypto/subtle/rsa-oaep-import-jwk-public-key-sha384.html
420                crypto/subtle/rsa-oaep-import-jwk-public-key-sha512.html
421                crypto/subtle/rsaes-pkcs1-v1_5-import-jwk-private-key.html
422                crypto/subtle/rsaes-pkcs1-v1_5-import-jwk-public-key-leading-zero.html
423                crypto/subtle/rsaes-pkcs1-v1_5-import-jwk-public-key-minimum.html
424                crypto/subtle/rsaes-pkcs1-v1_5-import-jwk-public-key-non-extractable.html
425                crypto/subtle/rsaes-pkcs1-v1_5-import-jwk-public-key.html
426                crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-private-key.html
427                crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-public-key-sha1.html
428                crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-public-key-sha224.html
429                crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-public-key-sha256.html
430                crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-public-key-sha384.html
431                crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-public-key-sha512.html
432                crypto/workers/subtle/aes-import-jwk-key.html
433                crypto/workers/subtle/aes-import-raw-key.html
434                crypto/workers/subtle/hmac-import-jwk-key.html
435                crypto/workers/subtle/hmac-import-raw-key.html
436                crypto/workers/subtle/rsa-import-jwk-private-key.html
437                crypto/workers/subtle/rsa-import-jwk-public-key.html
438
439         * CMakeLists.txt:
440         * DerivedSources.make:
441         * PlatformEfl.cmake:
442         * PlatformGTK.cmake:
443         * PlatformMac.cmake:
444         * WebCore.xcodeproj/project.pbxproj:
445         * bindings/js/JSSubtleCryptoCustom.cpp:
446         (WebCore::normalizeCryptoAlgorithmParameters):
447         (WebCore::cryptoKeyUsageFromString):
448         (WebCore::cryptoKeyUsagesFromJSValue):
449         (WebCore::toKeyData):
450         (WebCore::jsSubtleCryptoFunctionGenerateKeyPromise):
451         (WebCore::jsSubtleCryptoFunctionImportKeyPromise):
452         (WebCore::JSSubtleCrypto::importKey):
453         * crypto/CryptoAlgorithm.cpp:
454         (WebCore::CryptoAlgorithm::importKey):
455         * crypto/CryptoAlgorithm.h:
456         * crypto/CryptoAlgorithmParameters.h:
457         * crypto/JsonWebKey.h: Added.
458         * crypto/JsonWebKey.idl: Added.
459         * crypto/RsaOtherPrimesInfo.h: Added.
460         * crypto/RsaOtherPrimesInfo.idl: Added.
461         * crypto/SubtleCrypto.h:
462         * crypto/SubtleCrypto.idl:
463         * crypto/algorithms/CryptoAlgorithmAES_CBC.cpp:
464         (WebCore::CryptoAlgorithmAES_CBC::generateKey):
465         (WebCore::CryptoAlgorithmAES_CBC::importKey):
466         * crypto/algorithms/CryptoAlgorithmAES_CBC.h:
467         * crypto/algorithms/CryptoAlgorithmAES_KW.cpp:
468         (WebCore::CryptoAlgorithmAES_KW::generateKey):
469         (WebCore::CryptoAlgorithmAES_KW::importKey):
470         * crypto/algorithms/CryptoAlgorithmAES_KW.h:
471         * crypto/algorithms/CryptoAlgorithmHMAC.cpp:
472         (WebCore::CryptoAlgorithmHMAC::generateKey):
473         (WebCore::CryptoAlgorithmHMAC::importKey):
474         * crypto/algorithms/CryptoAlgorithmHMAC.h:
475         * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp:
476         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::importKey):
477         * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.h:
478         * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp:
479         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::importKey):
480         * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.h:
481         * crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp:
482         (WebCore::CryptoAlgorithmRSA_OAEP::importKey):
483         * crypto/algorithms/CryptoAlgorithmRSA_OAEP.h:
484         * crypto/keys/CryptoKeyAES.cpp:
485         (WebCore::CryptoKeyAES::CryptoKeyAES):
486         (WebCore::CryptoKeyAES::generate):
487         (WebCore::CryptoKeyAES::importRaw):
488         (WebCore::CryptoKeyAES::importJwk):
489         * crypto/keys/CryptoKeyAES.h:
490         * crypto/keys/CryptoKeyDataRSAComponents.cpp:
491         (WebCore::CryptoKeyDataRSAComponents::CryptoKeyDataRSAComponents):
492         * crypto/keys/CryptoKeyDataRSAComponents.h:
493         * crypto/keys/CryptoKeyHMAC.cpp:
494         (WebCore::CryptoKeyHMAC::CryptoKeyHMAC):
495         (WebCore::CryptoKeyHMAC::generate):
496         (WebCore::CryptoKeyHMAC::importRaw):
497         (WebCore::CryptoKeyHMAC::importJwk):
498         (WebCore::CryptoKeyHMAC::buildAlgorithm):
499         * crypto/keys/CryptoKeyHMAC.h:
500         * crypto/keys/CryptoKeyRSA.cpp: Added.
501         (WebCore::CryptoKeyRSA::importJwk):
502         * crypto/keys/CryptoKeyRSA.h:
503         * crypto/parameters/CryptoAlgorithmHmacKeyParams.h: Renamed from Source/WebCore/crypto/parameters/CryptoAlgorithmHmacKeyGenParams.h.
504         * crypto/parameters/CryptoAlgorithmRsaHashedImportParams.h: Added.
505         * crypto/parameters/HmacKeyParams.idl: Renamed from Source/WebCore/crypto/parameters/HmacKeyGenParams.idl.
506         * crypto/parameters/RsaHashedImportParams.idl: Added.
507
508 2016-11-10  Brady Eidson  <beidson@apple.com>
509
510         IndexedDB 2.0: REGRESSION(r208467) Fix flaky crashes in IDB GC-related code.
511         https://bugs.webkit.org/show_bug.cgi?id=164596
512
513         Reviewed by Eric Carlson.
514
515         No new tests (Covered by existing tests).
516
517         We can't just WTFMove the pointers from the deleted-IDBObject maps...
518         We need to remove the entries, too.
519
520         * Modules/indexeddb/IDBObjectStore.cpp:
521         (WebCore::IDBObjectStore::rollbackForVersionChangeAbort):
522
523         * Modules/indexeddb/IDBTransaction.cpp:
524         (WebCore::IDBTransaction::internalAbort):
525
526 2016-11-10  Youenn Fablet  <youennf@gmail.com>
527
528         MediaStreamTrack should use more Ref<> and less RefPtr<>
529         https://bugs.webkit.org/show_bug.cgi?id=164560
530
531         Reviewed by Eric Carlson.
532
533         No change of behavior.
534
535         Make MediaStreamTrack take a Ref<>& instead of a reference.
536         Using Ref<>&& instead of RefPtr<>&& in MediaStreamTrackPrivate.
537         Updating constness of some methods accordingly.
538
539         * Modules/mediastream/MediaEndpointPeerConnection.cpp:
540         (WebCore::MediaEndpointPeerConnection::createReceiver):
541         * Modules/mediastream/MediaStreamTrack.cpp:
542         (WebCore::MediaStreamTrack::create):
543         (WebCore::MediaStreamTrack::MediaStreamTrack):
544         (WebCore::MediaStreamTrack::clone):
545         * Modules/mediastream/MediaStreamTrack.h:
546         * Modules/webaudio/MediaStreamAudioSource.cpp:
547         (WebCore::MediaStreamAudioSource::capabilities):
548         (WebCore::MediaStreamAudioSource::settings):
549         * Modules/webaudio/MediaStreamAudioSource.h:
550         * platform/mediastream/MediaEndpoint.cpp:
551         * platform/mediastream/MediaStreamPrivate.cpp:
552         (WebCore::MediaStreamPrivate::create):
553         * platform/mediastream/MediaStreamTrackPrivate.cpp:
554         (WebCore::MediaStreamTrackPrivate::create):
555         (WebCore::MediaStreamTrackPrivate::MediaStreamTrackPrivate):
556         (WebCore::MediaStreamTrackPrivate::clone):
557         * platform/mediastream/MediaStreamTrackPrivate.h:
558         (WebCore::MediaStreamTrackPrivate::setMuted):
559         (WebCore::MediaStreamTrackPrivate::source):
560         * platform/mediastream/RealtimeMediaSource.h:
561         * platform/mediastream/mac/AVMediaCaptureSource.h:
562         * platform/mediastream/mac/AVMediaCaptureSource.mm:
563         (WebCore::AVMediaCaptureSource::initializeSettings):
564         (WebCore::AVMediaCaptureSource::settings):
565         (WebCore::AVMediaCaptureSource::initializeCapabilities):
566         (WebCore::AVMediaCaptureSource::capabilities):
567         * platform/mediastream/openwebrtc/RealtimeMediaSourceOwr.h:
568         (WebCore::RealtimeMediaSourceOwr::capabilities):
569         (WebCore::RealtimeMediaSourceOwr::settings):
570         * platform/mock/MockRealtimeMediaSource.cpp:
571         (WebCore::MockRealtimeMediaSource::initializeCapabilities):
572         (WebCore::MockRealtimeMediaSource::capabilities):
573         (WebCore::MockRealtimeMediaSource::initializeSettings):
574         (WebCore::MockRealtimeMediaSource::settings):
575         * platform/mock/MockRealtimeMediaSource.h:
576
577 2016-11-10  Per Arne Vollan  <pvollan@apple.com>
578
579         [Win32] Crash in layout tests.
580         https://bugs.webkit.org/show_bug.cgi?id=164411
581
582         Reviewed by Mark Lam.
583
584         Use the calling convention expected by the callers of the generated functions.
585
586         * bindings/scripts/CodeGeneratorJS.pm:
587         (GenerateImplementation):
588         * bindings/scripts/test/JS/JSTestDOMJIT.cpp:
589         (WebCore::unsafeJsTestDOMJITPrototypeFunctionGetAttribute):
590         (WebCore::unsafeJsTestDOMJITPrototypeFunctionItem):
591         (WebCore::unsafeJsTestDOMJITPrototypeFunctionHasAttribute):
592         (WebCore::unsafeJsTestDOMJITPrototypeFunctionGetElementById):
593         (WebCore::unsafeJsTestDOMJITPrototypeFunctionGetElementsByName):
594
595 2016-11-10  Aaron Chu  <aaron_chu@apple.com>
596
597         Web Inspector: AXI: clarify button roles (e.g. toggle or popup button)
598         https://bugs.webkit.org/show_bug.cgi?id=130726
599         <rdar://problem/16420420>
600
601         Reviewed by Brian Burg.
602
603         Test: accessibility/ax-differentiate-button-types.html
604
605         Added special case logic to make sure PopUpButtonRole and ToggleButtonRole to user ButtonRole as role.
606         Added an "isPopUpButton" property to be exposed to the Inspector's use.
607
608         * accessibility/AccessibilityObject.cpp:
609         (WebCore::AccessibilityObject::computedRoleString):
610         * inspector/InspectorDOMAgent.cpp:
611         (WebCore::InspectorDOMAgent::buildObjectForAccessibilityProperties):
612
613 2016-11-10  Zan Dobersek  <zdobersek@igalia.com>
614
615         [EME] Add no-op Web-facing APIs
616         https://bugs.webkit.org/show_bug.cgi?id=164028
617
618         Reviewed by Jer Noble.
619
620         Add no-op implementation of the Web-facing APIs as defined in
621         the EME specification. This will be the basis for implementing
622         the various algorithms the same specification defines, and for
623         implementing the relevant platform abstractions.
624
625         Dictionaries and enumerations defined by the specification are
626         defined in separate headers, and not in the implementation files
627         for the class where they are used. This will ease their use
628         across different implementation files.
629
630         BufferSource now exposes the Variant object it holds. This is
631         needed to support the iterable property on the MediaKeyStatusMap
632         class.
633
634         CodeGeneratorJS is fixed to support JS-to-native conversion of
635         sequences of dictionaries.
636
637         * CMakeLists.txt:
638         * DerivedSources.cpp:
639         * DerivedSources.make:
640         * Modules/encryptedmedia/MediaKeyMessageEvent.cpp: Added.
641         (WebCore::MediaKeyMessageEvent::MediaKeyMessageEvent):
642         (WebCore::MediaKeyMessageEvent::eventInterface):
643         * Modules/encryptedmedia/MediaKeyMessageEvent.h: Added.
644         * Modules/encryptedmedia/MediaKeyMessageEvent.idl: Added.
645         * Modules/encryptedmedia/MediaKeyMessageEventInit.h: Added.
646         (WebCore::MediaKeyMessageEventInit::MediaKeyMessageEventInit):
647         * Modules/encryptedmedia/MediaKeyMessageType.h: Added.
648         * Modules/encryptedmedia/MediaKeySession.cpp: Added.
649         (WebCore::MediaKeySession::create):
650         (WebCore::MediaKeySession::MediaKeySession):
651         (WebCore::MediaKeySession::sessionId):
652         (WebCore::MediaKeySession::expiration):
653         (WebCore::MediaKeySession::keyStatuses):
654         (WebCore::MediaKeySession::generateRequest):
655         (WebCore::MediaKeySession::load):
656         (WebCore::MediaKeySession::update):
657         (WebCore::MediaKeySession::close):
658         (WebCore::MediaKeySession::remove):
659         (WebCore::MediaKeySession::hasPendingActivity):
660         (WebCore::MediaKeySession::activeDOMObjectName):
661         (WebCore::MediaKeySession::canSuspendForDocumentSuspension):
662         (WebCore::MediaKeySession::stop):
663         * Modules/encryptedmedia/MediaKeySession.h: Added.
664         * Modules/encryptedmedia/MediaKeySession.idl: Added.
665         * Modules/encryptedmedia/MediaKeySessionType.h: Added.
666         * Modules/encryptedmedia/MediaKeyStatus.h: Added.
667         * Modules/encryptedmedia/MediaKeyStatusMap.cpp: Added.
668         (WebCore::MediaKeyStatusMap::size):
669         (WebCore::MediaKeyStatusMap::has):
670         (WebCore::MediaKeyStatusMap::get):
671         (WebCore::MediaKeyStatusMap::Iterator::Iterator):
672         (WebCore::MediaKeyStatusMap::Iterator::next):
673         * Modules/encryptedmedia/MediaKeyStatusMap.h: Added.
674         (WebCore::MediaKeyStatusMap::create):
675         (WebCore::MediaKeyStatusMap::createIterator):
676         * Modules/encryptedmedia/MediaKeyStatusMap.idl: Added.
677         * Modules/encryptedmedia/MediaKeySystemAccess.cpp: Added.
678         (WebCore::MediaKeySystemAccess::keySystem):
679         (WebCore::MediaKeySystemAccess::getConfiguration):
680         (WebCore::MediaKeySystemAccess::createMediaKeys):
681         * Modules/encryptedmedia/MediaKeySystemAccess.h: Added.
682         (WebCore::MediaKeySystemAccess::create):
683         * Modules/encryptedmedia/MediaKeySystemAccess.idl: Added.
684         * Modules/encryptedmedia/MediaKeySystemConfiguration.h: Added.
685         * Modules/encryptedmedia/MediaKeySystemConfiguration.idl: Added.
686         * Modules/encryptedmedia/MediaKeySystemMediaCapability.h: Added.
687         * Modules/encryptedmedia/MediaKeySystemMediaCapability.idl: Added.
688         * Modules/encryptedmedia/MediaKeys.cpp: Added.
689         (WebCore::MediaKeys::createSession):
690         (WebCore::MediaKeys::setServerCertificate):
691         * Modules/encryptedmedia/MediaKeys.h: Added.
692         (WebCore::MediaKeys::create):
693         * Modules/encryptedmedia/MediaKeys.idl: Added.
694         * Modules/encryptedmedia/MediaKeysRequirement.h: Added.
695         * Modules/encryptedmedia/NavigatorEME.cpp: Added.
696         (WebCore::NavigatorEME::requestMediaKeySystemAccess):
697         * Modules/encryptedmedia/NavigatorEME.h: Added.
698         * Modules/encryptedmedia/NavigatorEME.idl: Added.
699         * WebCore.xcodeproj/project.pbxproj:
700         * bindings/js/BufferSource.h:
701         (WebCore::BufferSource::BufferSource):
702         (WebCore::BufferSource::variant):
703         * bindings/js/JSMediaKeySessionCustom.cpp: Added.
704         (WebCore::JSMediaKeySession::closed):
705         * bindings/js/JSMediaKeySystemAccessCustom.cpp: Added.
706         (WebCore::JSMediaKeySystemAccess::getConfiguration):
707         * bindings/scripts/CodeGeneratorJS.pm:
708         (GetNativeVectorInnerType):
709         * dom/EventNames.h:
710         * dom/EventNames.in:
711         * dom/EventTargetFactory.in:
712         * html/HTMLMediaElement.cpp:
713         (WebCore::HTMLMediaElement::mediaKeys):
714         (WebCore::HTMLMediaElement::setMediaKeys):
715         * html/HTMLMediaElement.h:
716         * html/HTMLMediaElement.idl:
717         * html/MediaEncryptedEvent.cpp: Added.
718         (WebCore::MediaEncryptedEvent::MediaEncryptedEvent):
719         (WebCore::MediaEncryptedEvent::eventInterface):
720         (WebCore::MediaEncryptedEvent::initDataType):
721         (WebCore::MediaEncryptedEvent::initData):
722         * html/MediaEncryptedEvent.h: Added.
723         * html/MediaEncryptedEvent.idl: Added.
724         * html/MediaEncryptedEventInit.h: Added.
725         (WebCore::MediaEncryptedEventInit::MediaEncryptedEventInit):
726
727 2016-11-10  Antoine Quint  <graouts@apple.com>
728
729         [Modern Media Controls] Media Controller: update controls based on fullscreen playback on macOS
730         https://bugs.webkit.org/show_bug.cgi?id=164554
731         <rdar://problem/29183439>
732
733         Reviewed by Dean Jackson.
734
735         When toggling fullscreen on macOS, toggle between MacOSInlineMediaControls and MacOSFullscreenMediaControls.
736         To facilitate this, support objects are created and destroyed when changing the controls in order for the
737         right control objects to be hooked up to the media controller. A new destroy() method on MediaControllerSupport
738         subclasses can be overridden to remove event listeners added by support objects in their constructor.
739
740         Test: media/modern-media-controls/media-controller/media-controller-fullscreen-change.html
741
742         * Modules/modern-media-controls/media/fullscreen-support.js:
743         (FullscreenSupport.prototype.destroy):
744         * Modules/modern-media-controls/media/media-controller-support.js:
745         (MediaControllerSupport.prototype.destroy):
746         * Modules/modern-media-controls/media/media-controller.js:
747         (MediaController):
748         (MediaController.prototype.get layoutTraits):
749         (MediaController.prototype.handleEvent):
750         (MediaController.prototype._updateControlsIfNeeded):
751         (MediaController.prototype._controlsClass):
752
753 2016-11-10  Carlos Garcia Campos  <cgarcia@igalia.com>
754
755         [Linux] Memory values shown by memory pressure handler logger are not useful
756         https://bugs.webkit.org/show_bug.cgi?id=164589
757
758         Reviewed by Michael Catanzaro.
759
760         We are currently using the VmSize field from /proc/self/status which is the virtual memory size of the process
761         and doesn't normally change even when the memory pressure handler manages to release memory. So, most of the
762         time we see that there's no changes in memory usage in the logs.
763         We should use the actual memory used by the process, memory that the process can release and then it's relevant
764         for the memory pressure handler. Using other fields from /proc/self/status we could do something like VmRSS -
765         (RssFile + RssShme), but there's also /proc/self/statm that provides the same information in a single. The main
766         different is that statm provides both resident and shared memory directly, but in number of pages, so we need to
767         multiply by the size of the page.
768         This patch adds a method to parse /proc/self/statm in its given file, because I plan to use this for the linux
769         memory sampler that is incorrectly parsing /proc/self/statm.
770
771         * platform/Linux.cmake: Add new files to compilation.
772         * platform/linux/CurrentProcessMemoryStatus.cpp: Added.
773         (WebCore::systemPageSize): Return the page size.
774         (WebCore::currentProcessMemoryStatus): Parse /proc/self/statm and fill the given ProcessMemoryStatus.
775         * platform/linux/CurrentProcessMemoryStatus.h: Added.
776         * platform/linux/MemoryPressureHandlerLinux.cpp:
777         (WebCore::MemoryPressureHandler::processMemoryUsage(): Helper function to return the memory used by the process
778         in bytes.
779         (WebCore::MemoryPressureHandler::ReliefLogger::platformMemoryUsage): Use processMemoryUsage().
780
781 2016-10-14  Carlos Garcia Campos  <cgarcia@igalia.com>
782
783         MemoryPressureHandler shouldn't know how to release WebCore memory
784         https://bugs.webkit.org/show_bug.cgi?id=160497
785
786         Reviewed by Michael Catanzaro.
787
788         All processes should set their own low memory handler, instead of leaving the web process using the default one
789         that needs to access APIs that are not in platform layer. This patch fixes all the layering violations in the
790         MemoryPressureHandler. Since the default implementation, that releases the WebCore memory, is shared by the
791         WebProcess in WebKit2 and WebKit1 ports, it has been moved to its own file to the WebCore layer.
792
793         * CMakeLists.txt: Add new files to compilation.
794         * PlatformMac.cmake: Ditto.
795         * WebCore.xcodeproj/project.pbxproj: Ditto.
796         * loader/FrameLoader.cpp:
797         (WebCore::FrameLoader::commitProvisionalLoad): Use WebCore::jettisonExpensiveObjectsOnTopLevelNavigation().
798         * page/MemoryRelease.cpp: Added.
799         (WebCore::releaseNoncriticalMemory):
800         (WebCore::releaseCriticalMemory):
801         (WebCore::releaseMemory):
802         (WebCore::platformReleaseMemory):
803         (WebCore::jettisonExpensiveObjectsOnTopLevelNavigation):
804         (WebCore::registerMemoryReleaseNotifyCallbacks):
805         * page/MemoryRelease.h: Added.
806         * page/cocoa/MemoryReleaseCocoa.mm: Added.
807         (WebCore::platformReleaseMemory):
808         (WebCore::jettisonExpensiveObjectsOnTopLevelNavigation):
809         (WebCore::registerMemoryReleaseNotifyCallbacks):
810         * platform/MemoryPressureHandler.cpp:
811         (WebCore::MemoryPressureHandler::MemoryPressureHandler):
812         (WebCore::MemoryPressureHandler::beginSimulatedMemoryPressure):
813         (WebCore::MemoryPressureHandler::releaseMemory): Use the current handler if it has been set.
814         (WebCore::MemoryPressureHandler::platformReleaseMemory): Deleted.
815         * platform/MemoryPressureHandler.h:
816         (WebCore::MemoryPressureHandler::setLowMemoryHandler):
817         (WebCore::MemoryPressureHandler::m_releaseMemoryBlock):
818         * platform/cocoa/MemoryPressureHandlerCocoa.mm:
819         (WebCore::MemoryPressureHandler::respondToMemoryPressure): Call releaseMemory() instead of using the handler directly.
820         (WebCore::MemoryPressureHandler::platformReleaseMemory): Deleted.
821         * platform/linux/MemoryPressureHandlerLinux.cpp:
822         * platform/win/MemoryPressureHandlerWin.cpp:
823         (WebCore::MemoryPressureHandler::respondToMemoryPressure): Call releaseMemory() instead of using the handler directly.
824
825 2016-11-08  Sergio Villar Senin  <svillar@igalia.com>
826
827         [css-grid] Fix fr tracks sizing under min|max-size constraints
828         https://bugs.webkit.org/show_bug.cgi?id=150674
829
830         Reviewed by Darin Adler.
831
832         The min|max-sizes must be used to compute the flex fraction for indefinite free
833         spaces. According to the spec "If using this flex fraction would cause the grid to be
834         smaller than the grid container’s min-width/height (or larger than the grid container’s
835         max-width/height), then redo this step, treating the free space as definite and the
836         available grid space as equal to the grid container’s content box size when it’s sized to
837         its min-width/height (max-width/height)."
838
839         This only affects indefinite heights because during layout both definite sizes and any kind
840         of widths are properly constrained by min|max-width restrictions.
841
842         Tests: fast/css-grid-layout/flex-sizing-columns-min-max-width.html
843                fast/css-grid-layout/flex-sizing-rows-min-max-height.html
844
845         * rendering/RenderGrid.cpp:
846         (WebCore::RenderGrid::computeUsedBreadthOfGridTracks):
847         (WebCore::RenderGrid::computeFlexSizedTracksGrowth):
848         * rendering/RenderGrid.h:
849
850 2016-11-10  Alejandro G. Castro  <alex@igalia.com>
851
852         [WebRTC] [OpenWebRTC] RTX default parameters broken after r207952
853         https://bugs.webkit.org/show_bug.cgi?id=164541
854
855         Reviewed by Philippe Normand.
856
857         Fixed typo in refactoring.
858
859         * platform/mediastream/openwebrtc/MediaEndpointOwr.cpp:
860         (WebCore::MediaEndpointOwr::getDefaultVideoPayloads):
861
862 2016-11-08  Philippe Normand  <pnormand@igalia.com>
863
864         [WebRTC] white-list turns urls from the RTCConfiguration
865         https://bugs.webkit.org/show_bug.cgi?id=164506
866
867         Reviewed by Alejandro G. Castro.
868
869         * Modules/mediastream/RTCConfiguration.cpp:
870         (WebCore::validateIceServerURL): Add the turns URL scheme to the
871         list of supported relay and signaling server protocols.
872
873 2016-11-09  Joseph Pecoraro  <pecoraro@apple.com>
874
875         Web Inspector: DebuggerManager.Event.Resumed introduces test flakiness
876         https://bugs.webkit.org/show_bug.cgi?id=161951
877         <rdar://problem/28295767>
878
879         Reviewed by Brian Burg.
880
881         Covered by existing tests that would ASSERT otherwise.
882
883         * inspector/InspectorClient.cpp:
884         (WebCore::InspectorClient::doDispatchMessageOnFrontendPage):
885         When paused on an exception in the inspected page and evaluating
886         commands in the inspector frontend page (which evaluates JavaScript)
887         we ASSERT when entering the Global DOM VM with an existing exception.
888         This makes it so when we evaluate JavaScript in the frontend we
889         suspend / ignore the state of the VM for the inspected page, and
890         restore it when we return from the inspector.
891
892 2016-11-09  Joseph Pecoraro  <pecoraro@apple.com>
893
894         Web Inspector: Associate Worker Resources with the Worker and not the Page
895         https://bugs.webkit.org/show_bug.cgi?id=164342
896         <rdar://problem/29075775>
897
898         Reviewed by Timothy Hatcher.
899
900         Test: inspector/worker/resources-in-worker.html
901
902         Provide a way to associate an initiator identifier with a ResourceRequest.
903         This will allow Web Inspector to identify who started particular resource
904         loads. This is important to associate Worker(...), importScript(...), and
905         XMLHttpRequest / Fetch loads with that specific Worker.
906
907         * platform/network/ResourceRequestBase.cpp:
908         (WebCore::ResourceRequestBase::setAsIsolatedCopy):
909         * platform/network/ResourceRequestBase.h:
910         (WebCore::ResourceRequestBase::initiatorIdentifier):
911         (WebCore::ResourceRequestBase::setInitiatorIdentifier):
912         Optional initiator identifier. Currently used only be Web Inspector.
913
914         * dom/ScriptExecutionContext.h:
915         (WebCore::ScriptExecutionContext::resourceRequestIdentifier):
916         Non-page execution contexts, like WorkerGlobalScope, should provide
917         a unique identifier that may be used to distinguish loads initiated
918         from within that context.
919
920         * xml/XMLHttpRequest.cpp:
921         (WebCore::XMLHttpRequest::createRequest):
922         * Modules/fetch/FetchLoader.cpp:
923         (WebCore::FetchLoader::start):
924         * Modules/fetch/FetchRequest.cpp:
925         (WebCore::FetchRequest::initializeWith):
926         XHR / Fetch loads should include the ScriptExecutionContext's
927         initiator identifier.
928
929         * workers/WorkerScriptLoader.cpp:
930         (WebCore::WorkerScriptLoader::WorkerScriptLoader):
931         (WebCore::WorkerScriptLoader::loadSynchronously):
932         (WebCore::WorkerScriptLoader::loadAsynchronously):
933         (WebCore::WorkerScriptLoader::createResourceRequest):
934         * workers/WorkerScriptLoader.h:
935         Provide a way to provide initiator identifier information for
936         Worker script loads. Currently this is `new Worker(...)` and
937         `importScripts(...)` resource loads.
938
939         * workers/Worker.cpp:
940         (WebCore::Worker::Worker):
941         (WebCore::Worker::create):
942         * workers/Worker.h:
943         * workers/WorkerGlobalScope.cpp:
944         (WebCore::WorkerGlobalScope::WorkerGlobalScope):
945         (WebCore::WorkerGlobalScope::importScripts):
946         * workers/WorkerGlobalScope.h:
947         Give Worker itself the unique identifier, because `new Worker(...)`
948         loads happen before the WorkerGlobalScript (ScriptExecutionContext)
949         is actually created, but we want to associate it with this Worker.
950
951         * workers/DedicatedWorkerGlobalScope.cpp:
952         (WebCore::DedicatedWorkerGlobalScope::create):
953         (WebCore::DedicatedWorkerGlobalScope::DedicatedWorkerGlobalScope):
954         * workers/DedicatedWorkerGlobalScope.h:
955         * workers/DedicatedWorkerThread.cpp:
956         (WebCore::DedicatedWorkerThread::DedicatedWorkerThread):
957         (WebCore::DedicatedWorkerThread::createWorkerGlobalScope):
958         * workers/DedicatedWorkerThread.h:
959         * workers/WorkerInspectorProxy.cpp:
960         (WebCore::WorkerInspectorProxy::WorkerInspectorProxy):
961         * workers/WorkerInspectorProxy.h:
962         * workers/WorkerMessagingProxy.cpp:
963         (WebCore::WorkerMessagingProxy::WorkerMessagingProxy):
964         (WebCore::WorkerMessagingProxy::startWorkerGlobalScope):
965         * workers/WorkerThread.cpp:
966         (WebCore::WorkerThreadStartupData::WorkerThreadStartupData):
967         (WebCore::WorkerThread::WorkerThread):
968         (WebCore::WorkerThread::workerThread):
969         * workers/WorkerThread.h:
970         Pass the MainThread's Worker identifier through to the WorkerGlobalScope
971         created on the WorkerThread. They should be the same identifier.
972
973         * inspector/InspectorNetworkAgent.cpp:
974         (WebCore::InspectorNetworkAgent::willSendRequest):
975         * inspector/InspectorPageAgent.cpp:
976         (WebCore::InspectorPageAgent::buildObjectForFrameTree):
977         Pass the initiator identifier data to the frontend. This identifier is
978         equivalent to a "target identifier" in the frontend. Currently the only
979         non-Page targets are Workers.
980
981         * loader/cache/CachedResourceLoader.cpp:
982         (WebCore::CachedResourceLoader::shouldContinueAfterNotifyingLoadedFromMemoryCache):
983         When using the memory cache we create a new resource request. Be sure
984         to copy over useful inspector data, like the initiator identifier,
985         from the original request.
986
987         * platform/network/cf/ResourceRequestCFNet.cpp:
988         (WebCore::ResourceRequest::updateFromDelegatePreservingOldProperties):
989         When rebuilding a ResourceRequest from NSURLRequest, copy over the
990         initiator identifier property that wouldn't otherwise have survived
991         the transition.
992
993 2016-11-09  Brady Eidson  <beidson@apple.com>
994
995         IndexedDB 2.0: Clean up some exception ordering.
996         https://bugs.webkit.org/show_bug.cgi?id=164566
997
998         Reviewed by Alex Christensen.
999
1000         No new tests (Covered by existing tests).
1001
1002         * Modules/indexeddb/IDBCursor.cpp:
1003         (WebCore::IDBCursor::advance):
1004         (WebCore::IDBCursor::continueFunction):
1005
1006         * Modules/indexeddb/IDBObjectStore.cpp:
1007         (WebCore::IDBObjectStore::createIndex):
1008
1009 2016-11-09  Alex Christensen  <achristensen@webkit.org>
1010
1011         Unreviewed, rolling out r208438.
1012
1013         crashes
1014
1015         Reverted changeset:
1016
1017         "[WK2][NETWORK_SESSION] Add support for downloading file
1018         backed blobs"
1019         https://bugs.webkit.org/show_bug.cgi?id=164458
1020         http://trac.webkit.org/changeset/208438
1021
1022 2016-11-09  Said Abou-Hallawa  <sabouhallawa@apple.com>
1023
1024         Change the decoding for some animated images to be asynchronous
1025         https://bugs.webkit.org/show_bug.cgi?id=161566
1026
1027         Reviewed by Simon Fraser.
1028
1029         Tests: fast/images/slower-animation-than-decoding-image.html
1030                fast/images/slower-decoding-than-animation-image.html
1031                fast/images/stopped-animation-deleted-image.html
1032                
1033         Request the next frame before firing the animation timer. The asynchronous
1034         image decoding work queue notifies the BitmapImage when the frame finishes
1035         decoding. If the timer fires before the frame is decoded, no repaint will
1036         be requested. Only when the image frame is ready, the animation will be
1037         advanced and the image will be repainted.
1038
1039         * loader/cache/CachedImage.cpp:
1040         (WebCore::CachedImage::load): Cache the image settings in CachedImage.
1041         (WebCore::CachedImage::createImage): No need to pass allowSubsampling to BitmapImage. It can be retrieved through Image::imageObserver().
1042         (WebCore::CachedImage::changedInRect): Change the parameter to notifyObservers() to be a pointer.
1043         * loader/cache/CachedImage.h: Cache the settings: allowSubsampling, allowAsyncImageDecoding and showDebugBackground through m_loader.
1044         * platform/graphics/BitmapImage.cpp:
1045         (WebCore::BitmapImage::dataChanged): Fix a logging message.
1046         (WebCore::BitmapImage::draw): Store the current SubsamplingLevel to be used when requesting decoding the image of the next frame.
1047         Draw a debug rectangle if the next frame is missed because it is being decoded and the setting showDebugBackground is on.
1048         (WebCore::BitmapImage::startAnimation): Deleted. Moved to the header file.
1049         (WebCore::BitmapImage::internalStartAnimation): Added. Request asynchronous image decoding for the next frame if required. Return the
1050         result of starting the animation.
1051         (WebCore::BitmapImage::advanceAnimation): Call internalAdvanceAnimation() if the frame image is not being decoded. If it is being decoded
1052         and the setting showDebugBackground is on, force repaint so the debug rectangle is drawn.
1053         (WebCore::BitmapImage::internalAdvanceAnimation): This is the old body of advanceAnimation().
1054         (WebCore::BitmapImage::stopAnimation): Stop the asynchronous image decoding if it is started.
1055         (WebCore::BitmapImage::newFrameNativeImageAvailableAtIndex): This function is called from the async image decoding work queue when finishing decoding a native image frame.
1056         * platform/graphics/BitmapImage.h:
1057         (WebCore::BitmapImage::startAnimation): Added. It is now calls internalStartAnimation().
1058         * platform/graphics/Color.h: Define a constant for the yellow color.
1059         * platform/graphics/ImageFrameCache.cpp:
1060         (WebCore::ImageFrameCache::clearMetadata): Delete unreferenced member.
1061         (WebCore::ImageFrameCache::requestFrameAsyncDecodingAtIndex): Return true if the frame is requested for async decoding.
1062         * platform/graphics/ImageFrameCache.h:
1063         * platform/graphics/ImageObserver.h:  Add virtual functions for allowSubsampling, allowAsyncImageDecoding and showDebugBackground.
1064         * platform/graphics/ImageSource.cpp:
1065         (WebCore::ImageSource::maximumSubsamplingLevel): Move checking allowSubsampling() to the caller BitmapImage::draw().
1066         * platform/graphics/ImageSource.h: Remove the setting allowSubsampling(); it can be retrieved from imageObserver().
1067         (WebCore::ImageSource::setAllowSubsampling): Deleted.
1068         * rendering/RenderImageResource.cpp:
1069         (WebCore::RenderImageResource::shutdown): Stop the animation of an image when shutting down the resource.
1070         * rendering/RenderImageResourceStyleImage.cpp:
1071         (WebCore::RenderImageResourceStyleImage::shutdown): Ditto.
1072         svg/graphics/SVGImageClients.h: Change the parameter to ImageObserver::changedInRect() to be a pointer.
1073         (WebCore::SVGImageChromeClient::invalidateContentsAndRootView):
1074         * testing/Internals.cpp:
1075         (WebCore::Internals::setImageFrameDecodingDuration): Sets a fixed frame decoding duration for testing.
1076         * testing/Internals.h:
1077         * testing/Internals.idl: Adds an internal option for ImageFrameDecodingDuration.
1078
1079 2016-11-04  Brent Fulgham  <bfulgham@apple.com>
1080
1081         Local HTML should be blocked from localStorage access unless "Disable Local File Restrictions" is checked
1082         https://bugs.webkit.org/show_bug.cgi?id=155185
1083         <rdar://problem/11101440>
1084
1085         Reviewed by Brady Eidson.
1086
1087         Add a new quirk for localStorage that defaults to 'on'. When active, this quirk says that
1088         localStorage access should be granted, without needing to grant universal file access.
1089
1090         If the quirk is turned off, then localStorage is blocked unless the WebKit client explicitly
1091         grants universal file access.
1092
1093         Tests: storage/domstorage/localstorage/blocked-file-access-permitted-by-quirk.html
1094                storage/domstorage/localstorage/blocked-file-access.html
1095
1096         * dom/Document.cpp:
1097         (WebCore::Document::initSecurityContext): Set localStorage quirk mode based on settings.
1098         * page/SecurityOrigin.cpp:
1099         (WebCore::SecurityOrigin::SecurityOrigin): Use more C++11 initializers.
1100         (WebCore::SecurityOrigin::canAccessStorage): If the origin is a local file, and we are NOT in
1101         localStorage quirks mode, and we have not been granted universal file access, prevent access
1102         to DOM localStorage.
1103         (WebCore::SecurityOrigin::setNeedsLocalStorageQuirk): Added.
1104         * page/SecurityOrigin.h:
1105         (WebCore::SecurityOrigin::needsLocalStorageQuirk): Added.
1106         * page/Settings.in:
1107         * workers/WorkerGlobalScope.cpp:
1108         (WebCore::WorkerGlobalScope::WorkerGlobalScope): Make sure Workers know what the
1109         localStorage quirks mode is set to.
1110
1111 2016-11-09  Alex Christensen  <achristensen@webkit.org>
1112
1113         URLParser should not consider path of URLs with no host to start at the first slash after the colon
1114         https://bugs.webkit.org/show_bug.cgi?id=164555
1115
1116         Reviewed by Tim Horton.
1117
1118         When we see a url that is only scheme:// we treated the // as the path.  Firefox did this with unrecognized schemes,
1119         but based on https://github.com/whatwg/url/issues/148 they seem willing to change.  We had added similar behavior to
1120         URL::parse, and I added this to URLParser in r206783 which this effectively reverts.
1121
1122         Covered by API and layout tests.
1123
1124         * platform/URLParser.cpp:
1125         (WebCore::URLParser::parse):
1126         Don't move m_userStart to m_pathStart back by two when we see an empty host.
1127
1128 2016-11-09  Alex Christensen  <achristensen@webkit.org>
1129
1130         Simplify logic of SecurityOrigin::databaseIdentifier
1131         https://bugs.webkit.org/show_bug.cgi?id=164565
1132
1133         Reviewed by Brady Eidson.
1134
1135         No change in behavior.
1136
1137         SecurityOrigins with the file scheme need a special database identifier to be backwards-compatible with existing storage.
1138         Instead of determining whether this is a file SecurityOrigin at parsing time and only using that information when
1139         making the database identifier, just determine whether we need this quirk when making the database identifier.
1140         I'm planning to move this logic to SecurityOriginData in another patch.
1141
1142         * page/SecurityOrigin.cpp:
1143         (WebCore::SecurityOrigin::SecurityOrigin):
1144         (WebCore::SecurityOrigin::create):
1145         (WebCore::SecurityOrigin::databaseIdentifier):
1146         * page/SecurityOrigin.h:
1147
1148 2016-11-09  Jaehun Lim  <ljaehun.lim@samsung.com>
1149
1150         Unreviewed, build fix after r208460
1151
1152         isValidColorString() was renamed isValidSimpleColorString().
1153
1154         * html/ColorInputType.cpp:
1155         (WebCore::ColorInputType::suggestions):
1156
1157 2016-11-09  Anders Carlsson  <andersca@apple.com>
1158
1159         Fix STP build.
1160
1161         * WebCorePrefix.h:
1162
1163 2016-11-09  Simon Fraser  <simon.fraser@apple.com>
1164
1165         Implement visual-viewport based position:fixed handling for Mac async scrolling
1166         https://bugs.webkit.org/show_bug.cgi?id=164495
1167
1168         Reviewed by Tim Horton.
1169
1170         Educate the scrolling tree about visual and layout viewports. This is runtime-switchable,
1171         so we push the enable flag to via the root state node, then push the layout viewport,
1172         and the min/max scroll position that contstrain it, through frame state nodes.
1173
1174         When a scroll happens, we compute a new layout viewport when the visual viewport hits
1175         an edge, and push that down through setScrollLayerPosition() since it's used to position
1176         fixed and sticky layers.
1177
1178         When the main thread gets notified about an async scroll, we set the new layout viewport
1179         on the FrameView, but do so in such a way that does not trigger layout. This is OK because
1180         we do a RenderLayer update which udpates all the layoutViewport-dependent state, and is
1181         necessary to avoid repaints every main thread update.
1182
1183         The iOS code is made to compile, but not work yet.
1184
1185         Tests: compositing/tiling/visiblerect-accumulated-offset.html
1186                fast/visual-viewport/tiled-drawing/zoomed-fixed-scrolled-down-then-up.html
1187                fast/visual-viewport/tiled-drawing/zoomed-fixed-scrolled-down.html
1188                fast/visual-viewport/tiled-drawing/zoomed-fixed-scrolling-layers-state.html
1189
1190         * page/FrameView.cpp:
1191         (WebCore::FrameView::setLayoutViewportOrigin):
1192         (WebCore::FrameView::updateLayoutViewport):
1193         (WebCore::FrameView::visualViewportRect):
1194         (WebCore::FrameView::unscaledMinimumScrollPosition):
1195         (WebCore::FrameView::scrollPositionChanged):
1196         * page/FrameView.h:
1197         * page/scrolling/AsyncScrollingCoordinator.cpp:
1198         (WebCore::AsyncScrollingCoordinator::frameViewLayoutUpdated):
1199         (WebCore::AsyncScrollingCoordinator::requestScrollPositionUpdate):
1200         (WebCore::AsyncScrollingCoordinator::scheduleUpdateScrollPositionAfterAsyncScroll):
1201         (WebCore::AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScrollTimerFired):
1202         (WebCore::AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScroll):
1203         (WebCore::AsyncScrollingCoordinator::visualViewportEnabled):
1204         * page/scrolling/AsyncScrollingCoordinator.h:
1205         (WebCore::AsyncScrollingCoordinator::ScheduledScrollUpdate::ScheduledScrollUpdate):
1206         * page/scrolling/ScrollingStateFrameScrollingNode.cpp:
1207         (WebCore::ScrollingStateFrameScrollingNode::ScrollingStateFrameScrollingNode):
1208         (WebCore::ScrollingStateFrameScrollingNode::setLayoutViewport):
1209         (WebCore::ScrollingStateFrameScrollingNode::setMinLayoutViewportOrigin):
1210         (WebCore::ScrollingStateFrameScrollingNode::setMaxLayoutViewportOrigin):
1211         (WebCore::ScrollingStateFrameScrollingNode::setVisualViewportEnabled):
1212         (WebCore::ScrollingStateFrameScrollingNode::dumpProperties):
1213         * page/scrolling/ScrollingStateFrameScrollingNode.h:
1214         * page/scrolling/ScrollingTree.cpp:
1215         (WebCore::ScrollingTree::viewportChangedViaDelegatedScrolling):
1216         (WebCore::ScrollingTree::scrollPositionChangedViaDelegatedScrolling):
1217         (WebCore::ScrollingTree::commitTreeState):
1218         * page/scrolling/ScrollingTree.h:
1219         (WebCore::ScrollingTree::visualViewportEnabled):
1220         (WebCore::ScrollingTree::setVisualViewportEnabled):
1221         * page/scrolling/ScrollingTreeFrameScrollingNode.cpp:
1222         (WebCore::ScrollingTreeFrameScrollingNode::commitStateBeforeChildren):
1223         (WebCore::ScrollingTreeFrameScrollingNode::layoutViewportForScrollPosition):
1224         * page/scrolling/ScrollingTreeFrameScrollingNode.h:
1225         (WebCore::ScrollingTreeFrameScrollingNode::layoutViewport):
1226         (WebCore::ScrollingTreeFrameScrollingNode::minLayoutViewportOrigin):
1227         (WebCore::ScrollingTreeFrameScrollingNode::maxLayoutViewportOrigin):
1228         * page/scrolling/ScrollingTreeScrollingNode.cpp:
1229         (WebCore::ScrollingTreeScrollingNode::setScrollPositionWithoutContentEdgeConstraints):
1230         * page/scrolling/ScrollingTreeScrollingNode.h:
1231         * page/scrolling/ThreadedScrollingTree.cpp:
1232         (WebCore::ThreadedScrollingTree::scrollingTreeNodeDidScroll):
1233         * page/scrolling/ThreadedScrollingTree.h:
1234         * page/scrolling/ios/ScrollingTreeFrameScrollingNodeIOS.h:
1235         * page/scrolling/ios/ScrollingTreeFrameScrollingNodeIOS.mm:
1236         (WebCore::ScrollingTreeFrameScrollingNodeIOS::setScrollPositionWithoutContentEdgeConstraints):
1237         (WebCore::ScrollingTreeFrameScrollingNodeIOS::setScrollLayerPosition):
1238         * page/scrolling/ios/ScrollingTreeIOS.cpp:
1239         (WebCore::ScrollingTreeIOS::scrollingTreeNodeDidScroll):
1240         * page/scrolling/ios/ScrollingTreeIOS.h:
1241         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h:
1242         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
1243         (WebCore::ScrollingTreeFrameScrollingNodeMac::setScrollPositionWithoutContentEdgeConstraints):
1244         (WebCore::ScrollingTreeFrameScrollingNodeMac::setScrollLayerPosition):
1245
1246 2016-11-09  Brady Eidson  <beidson@apple.com>
1247
1248         IndexedDB 2.0: W3C test IndexedDB/idbtransaction_objectStoreNames.html fails.
1249         https://bugs.webkit.org/show_bug.cgi?id=164528
1250
1251         Reviewed by Alex Christensen.
1252
1253         No new tests (Covered by existing test).
1254
1255         * Modules/indexeddb/IDBDatabase.cpp:
1256         (WebCore::IDBDatabase::transaction): De-dupe the input names.
1257
1258 2016-11-09  Brady Eidson  <beidson@apple.com>
1259
1260         IndexedDB 2.0: Implement new IDBCursor.continuePrimaryKey function.
1261         https://bugs.webkit.org/show_bug.cgi?id=164404
1262
1263         Reviewed by Alex Christensen.
1264
1265         Tests: storage/indexeddb/modern/idbcursor-continue-primary-key-1-private.html
1266                storage/indexeddb/modern/idbcursor-continue-primary-key-1.html
1267                Also covered by existing tests.
1268
1269         * Modules/indexeddb/IDBCursor.cpp:
1270         (WebCore::IDBCursor::continuePrimaryKey):
1271         (WebCore::IDBCursor::uncheckedIterateCursor):
1272         * Modules/indexeddb/IDBCursor.h:
1273         * Modules/indexeddb/IDBCursor.idl:
1274
1275         * Modules/indexeddb/IDBKeyData.h:
1276         (WebCore::IDBKeyData::operator>):
1277         (WebCore::IDBKeyData::operator<=):
1278         (WebCore::IDBKeyData::operator>=):
1279
1280         * Modules/indexeddb/server/MemoryCursor.h:
1281
1282         * Modules/indexeddb/server/MemoryIDBBackingStore.cpp:
1283         (WebCore::IDBServer::MemoryIDBBackingStore::iterateCursor):
1284
1285         * Modules/indexeddb/server/MemoryIndexCursor.cpp:
1286         (WebCore::IDBServer::MemoryIndexCursor::iterate):
1287         * Modules/indexeddb/server/MemoryIndexCursor.h:
1288
1289         * Modules/indexeddb/server/MemoryObjectStoreCursor.cpp:
1290         (WebCore::IDBServer::MemoryObjectStoreCursor::iterate):
1291         * Modules/indexeddb/server/MemoryObjectStoreCursor.h:
1292
1293         * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
1294         (WebCore::IDBServer::SQLiteIDBBackingStore::iterateCursor):
1295
1296         * Modules/indexeddb/server/SQLiteIDBCursor.cpp:
1297         (WebCore::IDBServer::SQLiteIDBCursor::iterate):
1298         * Modules/indexeddb/server/SQLiteIDBCursor.h:
1299
1300         * Modules/indexeddb/shared/IDBIterateCursorData.cpp:
1301         (WebCore::IDBIterateCursorData::isolatedCopy):
1302         * Modules/indexeddb/shared/IDBIterateCursorData.h:
1303         (WebCore::IDBIterateCursorData::encode):
1304         (WebCore::IDBIterateCursorData::decode):
1305
1306 2016-11-09  Antoine Quint  <graouts@apple.com>
1307
1308         [Modern Media Controls] Media Controller: set status label according to media state
1309         https://bugs.webkit.org/show_bug.cgi?id=164557
1310         <rdar://problem/29184097>
1311
1312         Reviewed by Dean Jackson.
1313
1314         Correctly set the StatusLabel text based on the media loading and network state.
1315
1316         Tests: http/tests/media/modern-media-controls/status-support/status-support-live-broadcast.html
1317                http/tests/media/modern-media-controls/status-support/status-support-loading.html
1318                media/modern-media-controls/status-support/status-support-error.html
1319
1320         * Modules/modern-media-controls/js-files:
1321         * Modules/modern-media-controls/media/media-controller.js:
1322         (MediaController):
1323         * Modules/modern-media-controls/media/status-support.js: Added.
1324         (StatusSupport.prototype.get control):
1325         (StatusSupport.prototype.get mediaEvents):
1326         (StatusSupport.prototype.syncControl):
1327         (StatusSupport):
1328         * WebCore.xcodeproj/project.pbxproj:
1329
1330 2016-11-09  Zalan Bujtas  <zalan@apple.com>
1331
1332         No need to set setFlowThreadState on RenderText in createTextRenderer.
1333         https://bugs.webkit.org/show_bug.cgi?id=164559
1334
1335         Reviewed by Antti Koivisto.
1336
1337        setFlowThreadState in create*Renderer ensures that by the time we issue the initial call to
1338        styleWillChange/styleDidChange through initializeStyle, the state is already set.
1339        However since RenderText does not have its own style, it's sufficient to have the flow state set
1340        through the normal RenderElement::insertChildInternal code path.
1341
1342         No change in functionality.
1343
1344         * style/RenderTreeUpdater.cpp:
1345         (WebCore::createTextRenderer):
1346
1347 2016-11-09  Brady Eidson  <beidson@apple.com>
1348
1349         IndexedDB 2.0: Encapsulate cursor iteration parameters for easy future expansion.
1350         https://bugs.webkit.org/show_bug.cgi?id=164504
1351
1352         Reviewed by Darin Adler.
1353
1354         No new tests (Refactor, no behavior change).
1355
1356         This patch literally just takes the "key" and "count" arguments and encapsulates them in a struct.
1357         That struct will then be easily expandable in the future (e.g. bug 164404).
1358
1359         * Modules/indexeddb/IDBCursor.cpp:
1360         (WebCore::IDBCursor::uncheckedIterateCursor):
1361         
1362         * Modules/indexeddb/IDBTransaction.cpp:
1363         (WebCore::IDBTransaction::iterateCursor):
1364         (WebCore::IDBTransaction::iterateCursorOnServer):
1365         * Modules/indexeddb/IDBTransaction.h:
1366         
1367         * Modules/indexeddb/client/IDBConnectionProxy.cpp:
1368         (WebCore::IDBClient::IDBConnectionProxy::iterateCursor):
1369         * Modules/indexeddb/client/IDBConnectionProxy.h:
1370         
1371         * Modules/indexeddb/client/IDBConnectionToServer.cpp:
1372         (WebCore::IDBClient::IDBConnectionToServer::iterateCursor):
1373         * Modules/indexeddb/client/IDBConnectionToServer.h:
1374         * Modules/indexeddb/client/IDBConnectionToServerDelegate.h:
1375         
1376         * Modules/indexeddb/server/IDBBackingStore.h:
1377         
1378         * Modules/indexeddb/server/IDBServer.cpp:
1379         (WebCore::IDBServer::IDBServer::iterateCursor):
1380         * Modules/indexeddb/server/IDBServer.h:
1381         
1382         * Modules/indexeddb/server/MemoryIDBBackingStore.cpp:
1383         (WebCore::IDBServer::MemoryIDBBackingStore::iterateCursor):
1384         * Modules/indexeddb/server/MemoryIDBBackingStore.h:
1385         
1386         * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
1387         (WebCore::IDBServer::SQLiteIDBBackingStore::iterateCursor):
1388         * Modules/indexeddb/server/SQLiteIDBBackingStore.h:
1389         
1390         * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
1391         (WebCore::IDBServer::UniqueIDBDatabase::iterateCursor):
1392         (WebCore::IDBServer::UniqueIDBDatabase::performIterateCursor):
1393         * Modules/indexeddb/server/UniqueIDBDatabase.h:
1394         
1395         * Modules/indexeddb/server/UniqueIDBDatabaseTransaction.cpp:
1396         (WebCore::IDBServer::UniqueIDBDatabaseTransaction::iterateCursor):
1397         * Modules/indexeddb/server/UniqueIDBDatabaseTransaction.h:
1398         
1399         * Modules/indexeddb/shared/IDBIterateCursorData.cpp: Added.
1400         (WebCore::IDBIterateCursorData::isolatedCopy):
1401         * Modules/indexeddb/shared/IDBIterateCursorData.h: Added.
1402         (WebCore::IDBIterateCursorData::encode):
1403         (WebCore::IDBIterateCursorData::decode):
1404
1405         * Modules/indexeddb/shared/InProcessIDBServer.cpp:
1406         (WebCore::InProcessIDBServer::iterateCursor):
1407         * Modules/indexeddb/shared/InProcessIDBServer.h:
1408
1409         * CMakeLists.txt:
1410         * WebCore.xcodeproj/project.pbxproj:
1411
1412 2016-11-09  Ryosuke Niwa  <rniwa@webkit.org>
1413
1414         StyledElement::attributeChanged shouldn't do any work when the attribute value didn't change
1415         https://bugs.webkit.org/show_bug.cgi?id=129476
1416
1417         Reviewed by Andreas Kling.
1418
1419         Avoid calling styleAttributeChanged and setPresentationAttributeStyleIsDirty
1420         when the attribute value didn't change as in r164856.
1421
1422         * dom/StyledElement.cpp:
1423         (WebCore::StyledElement::attributeChanged):
1424
1425 2016-11-09  Yusuke Suzuki  <utatane.tea@gmail.com>
1426
1427         [DOMJIT] Implement Node::ownerDocument
1428         https://bugs.webkit.org/show_bug.cgi?id=164004
1429
1430         Reviewed by Darin Adler.
1431
1432         Test: js/dom/domjit-accessor-owner-document.html
1433
1434         Still I cannot reproduce this crash in x64 environment, according to the crash log, it accesses 0x8 address.
1435         This can happen if document() accidentally returns nullptr. In the C++ ownerDocument implementation,
1436         if document() returns nullptr, it just returns nullptr. But in the DOMJIT implementation, we assume that
1437         document() won't return nullptr and access the member of it.
1438
1439         This patch aligns the DOMJIT implementation strictly to the C++ one.
1440
1441         * dom/Node.idl:
1442         * domjit/JSNodeDOMJIT.cpp:
1443         (WebCore::NodeOwnerDocumentDOMJIT::checkDOM):
1444         (WebCore::NodeOwnerDocumentDOMJIT::callDOMGetter):
1445
1446 2016-11-09  Sam Weinig  <sam@webkit.org>
1447
1448         [SVG] Start moving special casing of SVG out of the bindings - SVGAngle
1449         https://bugs.webkit.org/show_bug.cgi?id=164496
1450
1451         Reviewed by Darin Adler.
1452
1453         There is quite a bit of special casing of SVG types in the bindings that adds
1454         a lot of complexity and is relatively fragile, as it is based on type naming.
1455
1456         Instead of keeping the complexity in the bindings, I am going to move it into
1457         the implementation, where it has also longed to be. 
1458
1459         Starting small, with just SVGAngle. It has been split in two, with the existing
1460         SVGAngle being renamed SVGAngleValue, and the bound instance, which used to be name
1461         SVGPropertyTearOff<SVGAngle>, taking the name SVGAngle (and inheriting from 
1462         SVGPropertyTearOff<SVGAngleValue>).
1463
1464         * CMakeLists.txt:
1465         * WebCore.xcodeproj/project.pbxproj:
1466         Add SVGAngleValue.cpp
1467
1468         * bindings/scripts/CodeGenerator.pm:
1469         Remove SVGAngle as a special case.
1470
1471         * svg/SVGAngle.cpp: Removed.
1472         * svg/SVGAngle.h:
1473         Added. Implements the SVGAngle interface explicitly, getting to
1474         the SVGAngleValue through propertyReference().
1475
1476         * svg/SVGAngle.idl:
1477         * svg/SVGAngleValue.cpp: Copied from Source/WebCore/svg/SVGAngle.cpp.
1478         * svg/SVGAngleValue.h: Copied from Source/WebCore/svg/SVGAngle.h.
1479         Move old SVGAngle implementation to SVGAngleValue.
1480
1481         * svg/SVGAnimatedAngle.cpp:
1482         Replace SVGAngle usage with SVGAngleValue.
1483
1484         * svg/SVGAnimatedAngle.h:
1485         Switch SVGAnimatedAngle to be a type alias. This remains SVGAnimatedPropertyTearOff<SVGAngle>
1486         as SVGAnimatedPropertyTearOff has been changed to take the TearOff type as its parameter.
1487
1488         * svg/SVGAnimatedLength.h:
1489         * svg/SVGAnimatedPreserveAspectRatio.h:
1490         * svg/SVGAnimatedRect.h:
1491         Switch to using type aliases and pass the TearOff to SVGAnimatedPropertyTearOff.
1492
1493         * svg/SVGAnimatedType.cpp:
1494         (WebCore::SVGAnimatedType::createAngleAndEnumeration):
1495         * svg/SVGAnimatedType.h:
1496         (WebCore::SVGAnimatedType::angleAndEnumeration):
1497         Use SVGAngleValue.
1498
1499         * svg/SVGComponentTransferFunctionElement.h:
1500         Add missing include of SVGElement.h (need because it removed from SVGPropertyTearOff).
1501
1502         * svg/SVGMarkerElement.cpp:
1503         (WebCore::SVGMarkerElement::parseAttribute):
1504         (WebCore::SVGMarkerElement::setOrient):
1505         Switch to take an SVGAngleValue.
1506
1507         (WebCore::SVGMarkerElement::setOrientToAngle):
1508         Update to pull the value out via propertyReference().
1509
1510         * svg/SVGMarkerElement.h:
1511         Switch to take an SVGAngleValue.
1512
1513         * svg/SVGLengthList.h:
1514         * svg/SVGNumberList.h:
1515         * svg/SVGPathSegList.h:
1516         * svg/SVGPointList.h:
1517         * svg/SVGStringList.h:
1518         * svg/SVGTransformList.h:
1519         Switch to using type aliases in SVGPropertyTraits and add an alias for
1520         ListItemTearOff.
1521
1522         * svg/SVGSVGElement.cpp:
1523         (WebCore::SVGSVGElement::createSVGAngle):
1524         * svg/SVGSVGElement.h:
1525         Change createSVGAngle to return a Ref<SVGAngle> and create one.
1526
1527         * svg/SVGSVGElement.idl:
1528         Annotate IDL to indicate that a new value is being returned.
1529
1530         * svg/SVGTransform.cpp:
1531         Remove unnecessary include of SVGAngle.h.
1532
1533         * svg/SVGViewSpec.cpp:
1534         Add missing include of SVGElement.h (need because it removed from SVGPropertyTearOff).
1535
1536         * svg/properties/SVGAnimatedPropertyTearOff.h:
1537         Change to be parameterized on the TearOffType, rather than the PropertyType itself. Get the
1538         Property type from the TearOffType.
1539
1540         * svg/properties/SVGListProperty.h:
1541         * svg/properties/SVGListPropertyTearOff.h:
1542         Fix assumption that all TearOffTypes are just a SVGPropertyTearOff templatized on a property
1543         type. This is no longer true for SVGAngle. Instead, get the TearOffType for lists via SVGPropertyTraits.
1544
1545         * svg/properties/SVGPropertyTearOff.h:
1546         Make the PropertyType available by exposing it as a type alias.
1547
1548 2016-11-09  Darin Adler  <darin@apple.com>
1549
1550         Move Range from ExceptionCode to ExceptionOr
1551         https://bugs.webkit.org/show_bug.cgi?id=164457
1552
1553         Reviewed by Alex Christensen.
1554
1555         * accessibility/AXObjectCache.cpp:
1556         (WebCore::AXObjectCache::rangeForNodeContents): Update to use ExceptionOr,
1557         keeping behavior the same.
1558         (WebCore::characterOffsetsInOrder): Ditto.
1559         (WebCore::setRangeStartOrEndWithCharacterOffset): Changed argument to a
1560         reference instead of a pointer. Use a boolean return value to indicate
1561         success rather than an exception, since the callers don't need to know
1562         which exception it is.
1563         (WebCore::AXObjectCache::rangeForUnorderedCharacterOffsets): Updated for
1564         the above.
1565         (WebCore::AXObjectCache::nextBoundary): Ditto.
1566         (WebCore::AXObjectCache::previousBoundary): Ditto.
1567
1568         * accessibility/AccessibilityObject.cpp:
1569         (WebCore::AccessibilityObject::rangeOfStringClosestToRangeInDirection):
1570         Update to use ExceptionOr, keeping behavior the same.
1571         * accessibility/AccessibilityRenderObject.cpp:
1572         (WebCore::AccessibilityRenderObject::documentBasedSelectedTextRange): Ditto.
1573         * accessibility/atk/WebKitAccessibleUtil.cpp:
1574         (selectionBelongsToObject): Ditto.
1575         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
1576         (-[WebAccessibilityObjectWrapper _convertToNSRange:]): Ditto.
1577         * dom/Node.cpp:
1578         (WebCore::Node::textRects): Ditto.
1579
1580         * dom/Range.cpp:
1581         (WebCore::Range::~Range): Remove old comment that no longer makes sense now
1582         that the detach function no longer does anything.
1583         (WebCore::checkForDifferentRootContainer): Updated to use ExceptionOr,
1584         keeping behavior the same.
1585         (WebCore::Range::setStart): Ditto.
1586         (WebCore::Range::setEnd): Ditto.
1587         (WebCore::Range::isPointInRange): Ditto.
1588         (WebCore::Range::comparePoint): Ditto.
1589         (WebCore::Range::compareNode): Ditto.
1590         (WebCore::top): Added helper function so that compareBoundaryPoints doesn't
1591         need to have two identical loops in it.
1592         (WebCore::Range::compareBoundaryPoints): Updated to use ExceptionOr,
1593         keeping behavior the same.
1594         (WebCore::Range::compareBoundaryPointsForBindings): Ditto. Also use a switch
1595         instead of relying on the order of the values to check for unsupported values.
1596         (WebCore::Range::boundaryPointsValid): Ditto.
1597         (WebCore::Range::deleteContents): Ditto.
1598         (WebCore::Range::intersectsNode): Ditto.
1599         (WebCore::Range::processContents): Ditto.
1600         (WebCore::deleteCharacterData): Ditto.
1601         (WebCore::processContentsBetweenOffsets): Ditto. Also changed to be a
1602         non-member function and private to this file instead of in the class.
1603         (WebCore::processNodes): Ditto. Also changed one argument to be a RefPtr
1604         since the code relies on using it after mutating the DOM.
1605         (WebCore::processAncestorsAndTheirSiblings): Ditto. Changed one argument type
1606         to use ExceptionOr so the caller doesn't have to check the exception first.
1607         (WebCore::Range::extractContents): Ditto.
1608         (WebCore::Range::cloneContents): Ditto.
1609         (WebCore::Range::insertNode): Ditto. Also fixed to only call nodeType once
1610         instead of three times.
1611         (WebCore::Range::toString): Ditto. Also fixed to call nodeType only once
1612         per node instead of twice, to use downcast instead of static_cast, and to
1613         use the word "node" instead of "n" for the local variable name.
1614         (WebCore::Range::createContextualFragment): Ditto.
1615         (WebCore::Range::checkNodeWOffset): Ditto.
1616         (WebCore::Range::setStartAfter): Ditto.
1617         (WebCore::Range::setEndBefore): Ditto.
1618         (WebCore::Range::setEndAfter): Ditto.
1619         (WebCore::Range::selectNode): Ditto.
1620         (WebCore::Range::selectNodeContents): Ditto.
1621         (WebCore::Range::surroundContents): Ditto.
1622         (WebCore::Range::setStartBefore): Ditto.
1623         (WebCore::Range::contains): Ditto. Except added code to handle exception
1624         case to return false without asserting because I saw at least one crash
1625         that seemed to imply this behavior was needed.
1626         (WebCore::rangesOverlap): Ditto.
1627         (WebCore::rangeOfContents): Ditto.
1628         (WebCore::Range::expand): Ditto.
1629         (WebCore::Range::getClientRects): Ditto.
1630         (WebCore::Range::getBoundingClientRect): Ditto.
1631         (WebCore::Range::borderAndTextQuads): Changed to use return value
1632         instead of out argument, since it's a private function used only
1633         within this class so it was easy to update all call sites.
1634         (WebCore::Range::boundingRect): Updated for above. Also renamed since
1635         there was no need for the name "internal" in this.
1636         (WebCore::Range::absoluteBoundingRect): Ditto.
1637         * dom/Range.h: Updated for above.
1638         * dom/Range.idl: Use non-legacy exceptions. Also changed the default value
1639         of the string argument to the expand function to the empty string rather
1640         than "undefined", because the function silently does nothing when passed
1641         any unrecognized string, and so this leaves behavior unchanged. I removed
1642         the comment saying that the "undefined" default is wrong.
1643
1644         * editing/AlternativeTextController.cpp:
1645         (WebCore::AlternativeTextController::applyAlternativeTextToRange): Updated
1646         to use ExceptionOr but behave the same.
1647         * editing/Editor.cpp:
1648         (WebCore::Editor::advanceToNextMisspelling): Ditto.
1649         (WebCore::Editor::markAndReplaceFor): Ditto.
1650         (WebCore::isFrameInRange): Ditto. Also made a few style tweaks.
1651         (WebCore::Editor::countMatchesForText): Ditto.
1652         * editing/EditorCommand.cpp:
1653         (WebCore::unionDOMRanges): Ditto.
1654         * editing/FrameSelection.cpp:
1655         (WebCore::FrameSelection::respondToNodeModification): Ditto.
1656         * editing/InsertListCommand.cpp:
1657         (WebCore::InsertListCommand::doApplyForSingleParagraph): Ditto.
1658         * editing/TextCheckingHelper.cpp:
1659         (WebCore::TextCheckingParagraph::offsetTo): Ditto.
1660         * editing/TextCheckingHelper.h: Updated for above and also deleted
1661         unneeded private function checkingRange, which just churned the
1662         reference count unnecessarily; instead use m_checkingRange directly.
1663         * editing/TextIterator.cpp:
1664         (WebCore::TextIterator::getLocationAndLengthFromRange): Ditto.
1665         * editing/VisiblePosition.cpp:
1666         (WebCore::setStart): Ditto.
1667         (WebCore::setEnd): Ditto.
1668         * editing/VisibleSelection.cpp:
1669         (WebCore::makeSearchRange): Ditto.
1670
1671         * editing/VisibleUnits.cpp:
1672         (WebCore::suffixLengthForRange): Changed argument from RefPtr to
1673         a reference.
1674         (WebCore::prefixLengthForRange): Ditto.
1675         (WebCore::previousBoundary): Updated for ExceptionOr and the change
1676         above.
1677         (WebCore::nextBoundary): Ditto.
1678         * editing/VisibleUnits.h: Updated for above.
1679
1680         * editing/htmlediting.cpp:
1681         (WebCore::comparePositions): Updated to use ExceptionOr but behave
1682         the same.
1683         (WebCore::visiblePositionForIndexUsingCharacterIterator): Ditto.
1684         (WebCore::isNodeVisiblyContainedWithin): Ditto.
1685         * editing/ios/EditorIOS.mm:
1686         (WebCore::Editor::setDictationPhrasesAsChildOfElement): Ditto.
1687         (WebCore::Editor::setTextAsChildOfElement): Ditto.
1688         * editing/mac/EditorMac.mm:
1689         (WebCore::Editor::adjustedSelectionRange): Ditto.
1690         * editing/markup.cpp:
1691         (WebCore::createMarkupInternal): Ditto.
1692         * page/ContextMenuController.cpp:
1693         (WebCore::ContextMenuController::contextMenuItemSelected): Ditto.
1694         * page/DOMSelection.cpp:
1695         (WebCore::DOMSelection::addRange): Ditto.
1696         (WebCore::DOMSelection::deleteFromDocument): Ditto.
1697         (WebCore::DOMSelection::containsNode): Ditto.
1698
1699         * page/EventHandler.cpp:
1700         (WebCore::EventHandler::dispatchMouseEvent): Updated for change to
1701         use ExceptionOr in Ragne::compareNode. Also refactored the function
1702         to make the logic a little mroe straightforward and nest less of it
1703         inside a loop.
1704
1705         * page/Page.cpp:
1706         (WebCore::Page::findStringMatchingRanges): Updated for ExceptionOr
1707         without changing behavior.
1708         * page/TextIndicator.cpp:
1709         (WebCore::hasNonInlineOrReplacedElements): Ditto.
1710         * rendering/RenderNamedFlowThread.cpp:
1711         (WebCore::RenderNamedFlowThread::getRanges): Ditto.
1712
1713 2016-11-09  Dave Hyatt  <hyatt@apple.com>
1714
1715         [CSS Parser] Fix grid layout parsing
1716         https://bugs.webkit.org/show_bug.cgi?id=164489
1717
1718         Reviewed by Dean Jackson.
1719
1720         * css/CSSValueKeywords.in:
1721         * css/parser/CSSPropertyParser.cpp:
1722         (WebCore::consumeFitContent):
1723         (WebCore::isGridTrackFixedSized):
1724         (WebCore::consumeGridTrackSize):
1725         (WebCore::consumeGridTrackRepeatFunction):
1726         (WebCore::consumeGridTrackList):
1727         (WebCore::isCustomIdentValue):
1728         (WebCore::CSSPropertyParser::consumeGridItemPositionShorthand):
1729         (WebCore::CSSPropertyParser::consumeGridAreaShorthand):
1730         (WebCore::consumeImplicitGridAutoFlow):
1731         (WebCore::CSSPropertyParser::consumeGridShorthand):
1732
1733 2016-11-09  Darin Adler  <darin@apple.com>
1734
1735         Move EventTarget from ExceptionCode to ExceptionOr
1736         https://bugs.webkit.org/show_bug.cgi?id=164465
1737
1738         Reviewed by Youenn Fablet.
1739
1740         * Modules/indexeddb/IDBRequest.h: Added now-needed forward
1741         class declarations.
1742         * Modules/webaudio/AudioContext.h: Ditto.
1743
1744         * bindings/js/JSEventListener.cpp:
1745         (WebCore::eventHandlerAttribute): Updated for name change of the
1746         attributeEventListener function.
1747         (WebCore::documentEventHandlerAttribute): Ditto.
1748         * dom/Document.cpp:
1749         (WebCore::Document::getWindowAttributeEventListener): Ditto.
1750
1751         * dom/EventTarget.cpp:
1752         (WebCore::EventTarget::setAttributeEventListener): Updated for
1753         name change.
1754         (WebCore::EventTarget::attributeEventListener): Ditto.
1755         (WebCore::EventTarget::dispatchEventForBindings): Use ExceptionOr.
1756         (WebCore::legacyType): Use null instead of empty for no type, since
1757         it's more efficient to check for null.
1758         (WebCore::EventTarget::fireEventListeners): Check for null.
1759         Also streamlined logic a little bit and removed a very old comment.
1760         (WebCore::EventTarget::eventListeners): Renamed from getEventListeners.
1761         * dom/EventTarget.h: Removed lots of unneeded declarations. Renamed
1762         some functions to remove get prefix. Updated for above changes.
1763         Moved one inline function out of the class header. Made the destructor
1764         for EventTarget be inline to make the destructors for derived classes
1765         slightly more efficient.
1766         * dom/EventTarget.idl: Use non-legacy exception.
1767
1768         * dom/Node.cpp:
1769         (WebCore::Node::didMoveToNewDocument): Updated for name change.
1770         * editing/ReplaceSelectionCommand.cpp:
1771         (WebCore::ReplacementFragment::ReplacementFragment): Ditto.
1772
1773         * inspector/InspectorCSSAgent.h: Added now-needed forward declaration.
1774
1775         * inspector/InspectorDOMAgent.cpp:
1776         (WebCore::InspectorDOMAgent::getEventListeners): Updated for name change.
1777
1778         * inspector/InspectorInstrumentation.h: Added now-needed forward declaration.
1779         * page/DOMWindow.h: Ditto.
1780         * xml/XMLHttpRequest.h: Ditto.
1781
1782 2016-11-09  Daniel Bates  <dabates@apple.com>
1783
1784         Add test infrastructure and tests for existing HTTP 0.9 sandbox machinery
1785         https://bugs.webkit.org/show_bug.cgi?id=164389
1786         <rdar://problem/29101072>
1787
1788         Reviewed by Alex Christensen.
1789
1790         Add test infrastructure to support registering an arbitrary port as the default port
1791         for a protocol. The behavior of various machinery, including the HTTP 0.9 machinery,
1792         can be effected by whether the resource request was made using the default port for
1793         the protocol. We expose window.internals.registerDefaultPortForProtocol() to allow
1794         a test to override the default port associated with a protocol so as to support
1795         testing these code paths using the existing port 8000 server started by run-webkit-httpd.
1796         Without window.internals.registerDefaultPortForProtocol() we would need to teach
1797         run-webkit-httpd to run a web server on port 80, which requires superuser privileges
1798         (since it is a privileged port number) and is more likely to interfere with an
1799         existing web server setup.
1800
1801         Tests: http/tests/security/http-0.9/default-port-plugin-blocked.html
1802                http/tests/security/http-0.9/default-port-script-blocked.html
1803                http/tests/security/http-0.9/iframe-blocked.html
1804                http/tests/security/http-0.9/image-blocked.html
1805                http/tests/security/http-0.9/image-on-HTTP-0.9-default-port-page-allowed-ref-test.html
1806                http/tests/security/http-0.9/image-on-HTTP-0.9-default-port-page-allowed.html
1807                http/tests/security/http-0.9/image-on-HTTP-0.9-page-blocked.html
1808                http/tests/security/http-0.9/worker-connect-src-blocked.html
1809                http/tests/security/http-0.9/worker-importScripts-blocked.html
1810                http/tests/security/http-0.9/xhr-asynchronous-blocked.html
1811
1812         * platform/URL.cpp:
1813         (WebCore::defaultPortForProtocolMapForTesting): Added.
1814         (WebCore::registerDefaultPortForProtocolForTesting): Adds the specified (protocol, port) to the
1815         mapping used for testing.
1816         (WebCore::clearDefaultPortForProtocolMapForTesting): Clears the protocol to default port testing map.
1817         We call this function from Internals::resetToConsistentState() so that the mapping is cleared between
1818         test runs.
1819         (WebCore::defaultPortForProtocol): Modified to check the protocol to default port map for testing
1820         before consulting URLParser::defaultPortForProtocol().
1821         * platform/URL.h:
1822         * testing/Internals.cpp:
1823         (WebCore::Internals::resetToConsistentState): Clear the default port mapping used for testing.
1824         (WebCore::Internals::registerDefaultPortForProtocol): Added.
1825         * testing/Internals.h:
1826         * testing/Internals.idl: Added declaration for registerDefaultPortForProtocol().
1827
1828 2016-11-09  Sam Weinig  <sam@webkit.org>
1829
1830         [WebIDL] Add proper parsing for Promises
1831         https://bugs.webkit.org/show_bug.cgi?id=164497
1832
1833         Reviewed by Tim Horton.
1834
1835         * bindings/scripts/IDLParser.pm:
1836         (parseNonAnyType):
1837         (parseStringType):
1838         Require Promise types to declare the type they resolve to.
1839         
1840         * bindings/js/JSDOMPromise.h:
1841         Allow DOMPromise to be be parameterized on void. Add an SFINAE guarded
1842         overload of resolve that takes no arguments when in a DOMPromise<void>.
1843
1844         * Modules/applepay/ApplePaySession.idl:
1845         * Modules/fetch/DOMWindowFetch.idl:
1846         * Modules/fetch/FetchBody.idl:
1847         * Modules/fetch/FetchResponse.idl:
1848         * Modules/fetch/WorkerGlobalScopeFetch.idl:
1849         * Modules/mediastream/MediaDevices.idl:
1850         * Modules/mediastream/MediaStreamTrack.idl:
1851         * Modules/mediastream/RTCPeerConnection.idl:
1852         * Modules/mediastream/RTCRtpSender.idl:
1853         * Modules/mediastream/RTCStatsReport.idl:
1854         * Modules/streams/ReadableStream.idl:
1855         * Modules/streams/ReadableStreamDefaultReader.idl:
1856         * Modules/streams/ReadableStreamSource.idl:
1857         * Modules/streams/WritableStream.idl:
1858         * Modules/webaudio/AudioContext.idl:
1859         * bindings/scripts/test/TestNode.idl:
1860         * bindings/scripts/test/TestObj.idl:
1861         * crypto/SubtleCrypto.idl:
1862         * crypto/WebKitSubtleCrypto.idl:
1863         * css/FontFace.idl:
1864         * css/FontFaceSet.idl:
1865         * dom/CustomElementRegistry.idl:
1866         * html/HTMLMediaElement.idl:
1867         Update IDLs to specify the resolve type of promise types.
1868
1869         * Modules/mediastream/MediaEndpointPeerConnection.cpp:
1870         (WebCore::MediaEndpointPeerConnection::replaceTrack):
1871         (WebCore::MediaEndpointPeerConnection::replaceTrackTask):
1872         * Modules/mediastream/MediaStreamTrack.cpp:
1873         (WebCore::MediaStreamTrack::applyConstraints):
1874         * Modules/mediastream/MediaStreamTrack.h:
1875         * Modules/mediastream/PeerConnectionBackend.cpp:
1876         (WebCore::PeerConnectionBackend::setLocalDescriptionSucceeded):
1877         (WebCore::PeerConnectionBackend::setRemoteDescriptionSucceeded):
1878         (WebCore::PeerConnectionBackend::addIceCandidateSucceeded):
1879         * Modules/mediastream/PeerConnectionBackend.h:
1880         * Modules/streams/ReadableStreamSource.h:
1881         (WebCore::ReadableStreamSource::start):
1882         (WebCore::ReadableStreamSource::pull):
1883         (WebCore::ReadableStreamSource::startFinished):
1884         (WebCore::ReadableStreamSource::pullFinished):
1885         * Modules/webaudio/AudioContext.cpp:
1886         (WebCore::AudioContext::addReaction):
1887         (WebCore::AudioContext::setState):
1888         (WebCore::AudioContext::suspend):
1889         (WebCore::AudioContext::resume):
1890         (WebCore::AudioContext::close):
1891         * Modules/webaudio/AudioContext.h:
1892         * html/HTMLMediaElement.cpp:
1893         (WebCore::HTMLMediaElement::rejectPendingPlayPromises):
1894         (WebCore::HTMLMediaElement::resolvePendingPlayPromises):
1895         (WebCore::HTMLMediaElement::play):
1896         * html/HTMLMediaElement.h:
1897         Update implementations to use DOMPromise<void> rather than DOMPromise<nullptr_t>
1898         and use the new resolve() overload.
1899
1900 2016-11-07  Brady Eidson  <beidson@apple.com>
1901
1902         Followup to https://bugs.webkit.org/show_bug.cgi?id=164466 - Make an IDBTransaction* be an IDBTransaction&
1903
1904         Rubberstamped by Alex Christensen.
1905
1906         No new tests (No behavior change).
1907
1908         * Modules/indexeddb/IDBObjectStore.cpp:
1909         (WebCore::IDBObjectStore::IDBObjectStore):
1910         (WebCore::IDBObjectStore::~IDBObjectStore):
1911         (WebCore::IDBObjectStore::hasPendingActivity):
1912         (WebCore::IDBObjectStore::name):
1913         (WebCore::IDBObjectStore::setName):
1914         (WebCore::IDBObjectStore::keyPath):
1915         (WebCore::IDBObjectStore::indexNames):
1916         (WebCore::IDBObjectStore::transaction):
1917         (WebCore::IDBObjectStore::autoIncrement):
1918         (WebCore::IDBObjectStore::openCursor):
1919         (WebCore::IDBObjectStore::openKeyCursor):
1920         (WebCore::IDBObjectStore::get):
1921         (WebCore::IDBObjectStore::putOrAdd):
1922         (WebCore::IDBObjectStore::doDelete):
1923         (WebCore::IDBObjectStore::clear):
1924         (WebCore::IDBObjectStore::createIndex):
1925         (WebCore::IDBObjectStore::index):
1926         (WebCore::IDBObjectStore::deleteIndex):
1927         (WebCore::IDBObjectStore::doCount):
1928         (WebCore::IDBObjectStore::getAll):
1929         (WebCore::IDBObjectStore::getAllKeys):
1930         (WebCore::IDBObjectStore::markAsDeleted):
1931         (WebCore::IDBObjectStore::rollbackForVersionChangeAbort):
1932         (WebCore::IDBObjectStore::ref):
1933         (WebCore::IDBObjectStore::deref):
1934         * Modules/indexeddb/IDBObjectStore.h:
1935
1936 2016-11-09  Zalan Bujtas  <zalan@apple.com>
1937
1938         Move RenderNamedFlowThread nextRendererForElement logic to RenderTreeUpdater.
1939         https://bugs.webkit.org/show_bug.cgi?id=164503
1940
1941         Reviewed by Antti Koivisto.
1942
1943         When we insert a renderer into the render tree, we need to know both its parent
1944         and its next sibling. Normally the parent and the sibling are based on the DOM, but
1945         when this renderer is part of a flow thread, its insertion sibling is not necessarily the DOM sibling.
1946         To find the correct sibling, we call RenderNamedFlowThread's nextRendererForElement().
1947         RenderNamedFlowThread keeps track of its children so that it can compute the next sibling
1948         for the insertion point.
1949
1950         This patch eliminates the need for keeping track of the child renderers of each
1951         flow by moving the 'next sibling' logic to RenderTreePosition.
1952
1953         No change in functionality.
1954
1955         * rendering/RenderElement.cpp:
1956         (WebCore::RenderElement::insertedIntoTree):
1957         (WebCore::RenderElement::willBeDestroyed):
1958         (WebCore::RenderElement::removeFromRenderFlowThread):
1959         (WebCore::RenderElement::renderNamedFlowThreadWrapper): Deleted.
1960         * rendering/RenderElement.h:
1961         * rendering/RenderNamedFlowThread.cpp:
1962         (WebCore::RenderNamedFlowThread::nextRendererForElement): Deleted.
1963         (WebCore::RenderNamedFlowThread::addFlowChild): Deleted.
1964         (WebCore::RenderNamedFlowThread::removeFlowChild): Deleted.
1965         * rendering/RenderNamedFlowThread.h:
1966         * style/RenderTreePosition.cpp:
1967         (WebCore::RenderTreePosition::previousSiblingRenderer):
1968         (WebCore::RenderTreePosition::flowThreadInsertionContext):
1969         * style/RenderTreePosition.h:
1970         (WebCore::RenderTreePosition::RenderTreePosition):
1971         (WebCore::RenderTreePosition::parent):
1972         * style/RenderTreeUpdater.cpp:
1973         (WebCore::registerElementForFlowThreadIfNeeded): We need to registed the element even when it does not create renderer (display: none).
1974         (WebCore::RenderTreeUpdater::createRenderer):
1975         (WebCore::moveToFlowThreadIfNeeded): Deleted.
1976
1977 2016-11-09  Per Arne Vollan  <pvollan@apple.com>
1978
1979         [Win][Direct2D] Incomplete image decoding.
1980         https://bugs.webkit.org/show_bug.cgi?id=164511
1981
1982         Reviewed by Darin Adler.
1983
1984         Create native decoder when all image data has been received.
1985
1986         * platform/graphics/win/ImageDecoderDirect2D.cpp:
1987         (WebCore::ImageDecoder::setData):
1988
1989 2016-11-09  Beth Dakin  <bdakin@apple.com>
1990
1991         Attempted build fix.
1992
1993         * platform/spi/cocoa/AVKitSPI.h:
1994
1995 2016-11-09  Brady Eidson  <beidson@apple.com>
1996
1997         IndexedDB 2.0: Clean up more transaction abort behavior, including tweaks to Index/ObjectStore lifetime.
1998         https://bugs.webkit.org/show_bug.cgi?id=164466
1999
2000         Reviewed by Alex Christensen.
2001
2002         No new tests (Covered by existing tests that now pass).
2003         
2004         Previously, IDBIndex ref/deref didn't track a traditional ref count but instead kept the owning object store alive.
2005         Now, IDBObjectStore ref/deref do the same thing for the owning transaction.
2006         
2007         Now when a version change transaction is rolled back, some object stores and indexes get pulled out of the "deleted"
2008         set and get promoted back up into the "referenced" set.
2009         
2010         Now deleted object stores/indexes are considered opaque roots, as live objects in the deleted state *can* get back
2011         to the owning objects.
2012
2013         * CMakeLists.txt:
2014         * WebCore.xcodeproj/project.pbxproj:
2015
2016         * Modules/indexeddb/IDBIndex.cpp:
2017         (WebCore::IDBIndex::rollbackInfoForVersionChangeAbort):
2018
2019         * Modules/indexeddb/IDBObjectStore.cpp:
2020         (WebCore::IDBObjectStore::IDBObjectStore):
2021         (WebCore::IDBObjectStore::indexNames):
2022         (WebCore::IDBObjectStore::transaction):
2023         (WebCore::IDBObjectStore::openCursor):
2024         (WebCore::IDBObjectStore::openKeyCursor):
2025         (WebCore::IDBObjectStore::deleteIndex):
2026         (WebCore::IDBObjectStore::rollbackForVersionChangeAbort):
2027         (WebCore::IDBObjectStore::visitReferencedIndexes):
2028         (WebCore::IDBObjectStore::ref):
2029         (WebCore::IDBObjectStore::deref):
2030         (WebCore::IDBObjectStore::create): Deleted.
2031         * Modules/indexeddb/IDBObjectStore.h:
2032
2033         * Modules/indexeddb/IDBTransaction.cpp:
2034         (WebCore::IDBTransaction::objectStore):
2035         (WebCore::IDBTransaction::transitionedToFinishing):
2036         (WebCore::IDBTransaction::internalAbort):
2037         (WebCore::IDBTransaction::createObjectStore):
2038         (WebCore::IDBTransaction::deleteObjectStore):
2039         (WebCore::IDBTransaction::visitReferencedObjectStores):
2040         * Modules/indexeddb/IDBTransaction.h:
2041         * Modules/indexeddb/IDBTransaction.idl:
2042
2043         * bindings/js/JSIDBTransactionCustom.cpp: Added.
2044         (WebCore::JSIDBTransaction::visitAdditionalChildren):
2045
2046 2016-11-09  Simon Fraser  <simon.fraser@apple.com>
2047
2048         Allow customization of TextStream-based logging for geometry types
2049         https://bugs.webkit.org/show_bug.cgi?id=164460
2050
2051         Reviewed by Zalan Bujtas.
2052
2053         TextStream-based logging was constrained by the requirement to maintain compatibility
2054         with DRT-style output, which includes cumbersome rect logging ("at (5,0) size 40x40")
2055         and dumping LayoutRects as IntRects.
2056         
2057         Add some formatting flags so that other TextStream clients (e.g. logging) can have
2058         more readable output, and opt into automatic FormatNumberRespectingIntegers behavior.
2059         
2060         TextStreams whose output appears in test results are given flags to avoid behavior
2061         changes, but in the longer term test results should be updated.
2062
2063         * html/canvas/CanvasRenderingContext2D.cpp:
2064         (WebCore::CanvasRenderingContext2D::replayDisplayListAsText):
2065         * page/scrolling/ScrollingStateNode.cpp:
2066         (WebCore::ScrollingStateNode::scrollingStateTreeAsText):
2067         * platform/graphics/FloatPoint.cpp:
2068         (WebCore::operator<<):
2069         * platform/graphics/FloatRect.cpp:
2070         (WebCore::operator<<):
2071         * platform/graphics/GraphicsLayer.cpp:
2072         (WebCore::GraphicsLayer::layerTreeAsText):
2073         * platform/graphics/IntRect.cpp:
2074         (WebCore::operator<<):
2075         * platform/graphics/LayoutPoint.cpp:
2076         (WebCore::operator<<):
2077         * platform/graphics/LayoutRect.cpp:
2078         (WebCore::operator<<):
2079         * platform/graphics/ca/GraphicsLayerCA.cpp:
2080         (WebCore::GraphicsLayerCA::replayDisplayListAsText):
2081         * platform/graphics/displaylists/DisplayList.cpp:
2082         (WebCore::DisplayList::DisplayList::asText):
2083         * platform/text/TextStream.cpp:
2084         (WebCore::TextStream::operator<<):
2085         * platform/text/TextStream.h:
2086         (WebCore::TextStream::TextStream):
2087         (WebCore::TextStream::formattingFlags):
2088         (WebCore::TextStream::setFormattingFlags):
2089         (WebCore::TextStream::hasFormattingFlag):
2090         (WebCore::TextStream::increaseIndent):
2091         (WebCore::TextStream::decreaseIndent):
2092         * rendering/RenderTreeAsText.cpp:
2093         (WebCore::externalRepresentation):
2094         (WebCore::counterValueForElement):
2095
2096 2016-11-09  Zalan Bujtas  <zalan@apple.com>
2097
2098         RenderFlowThread::flowThreadRelativeWillBeRemoved should take RenderObject& instead of RenderObject*
2099         https://bugs.webkit.org/show_bug.cgi?id=164543
2100
2101         Reviewed by Simon Fraser.
2102
2103         No change in functionality.
2104
2105         * rendering/RenderBlockFlow.cpp:
2106         (WebCore::RenderBlockFlow::removeChild):
2107         * rendering/RenderFlowThread.h:
2108         * rendering/RenderMultiColumnFlowThread.cpp:
2109         (WebCore::RenderMultiColumnFlowThread::handleSpannerRemoval):
2110         (WebCore::RenderMultiColumnFlowThread::flowThreadRelativeWillBeRemoved):
2111         * rendering/RenderMultiColumnFlowThread.h:
2112
2113 2016-11-09  Jer Noble  <jer.noble@apple.com>
2114
2115         REGRESSION (r208149): Media scrubber is not displayed in media controls
2116         https://bugs.webkit.org/show_bug.cgi?id=164514
2117
2118         Reviewed by Darin Adler.
2119
2120         Fixes broken Media Controls API tests.
2121
2122         Added a new PlatformMediaSessionType; need to add that same type to the TYPE_TRAITS section of 
2123         MediaElementSession.h so that is<> and downcast<> work correctly.
2124
2125         * html/MediaElementSession.h:
2126         (isType):
2127
2128 2016-11-09  Wenson Hsieh  <wenson_hsieh@apple.com>
2129
2130         When editing IME, `compositionend` events should fire after input events
2131         https://bugs.webkit.org/show_bug.cgi?id=164324
2132         <rdar://problem/29050438>
2133
2134         Reviewed by Darin Adler.
2135
2136         Moves where we dispatch `compositionend` events to after applying editing commands that fire `beforeinput` or
2137         `input` events. Also augments existing layout tests to verify the change.
2138
2139         * editing/Editor.cpp:
2140         (WebCore::Editor::setComposition):
2141
2142 2016-11-09  Wenson Hsieh  <wenson_hsieh@apple.com>
2143
2144         Setting foreground color when text is selected should fire an input event with color data
2145         https://bugs.webkit.org/show_bug.cgi?id=164241
2146         <rdar://problem/29032759>
2147
2148         Reviewed by Darin Adler.
2149
2150         Refactors Editor::applyStyle and Editor::applyParagraphStyle to handle beforeinput and input event dispatch.
2151         Instead of going through the ApplyStyleCommand to dispatch input events, override shouldDispatchInputEvents to
2152         return false. This strategy also has the effect of unifying the way input events are dispatched in applyStyle,
2153         in both codepaths where we computeAndSetTypingStyle and where we create and then apply a style command.
2154
2155         Test: fast/events/input-events-selection-forecolor-data.html
2156
2157         * editing/ApplyStyleCommand.h:
2158         * editing/Editor.cpp:
2159         (WebCore::inputEventDataForEditingStyleAndAction):
2160         (WebCore::Editor::applyStyle):
2161         (WebCore::Editor::applyParagraphStyle):
2162         (WebCore::Editor::computeAndSetTypingStyle):
2163
2164 2016-11-08  Dean Jackson  <dino@apple.com>
2165
2166         Rendering support for ExtendedColors
2167         https://bugs.webkit.org/show_bug.cgi?id=164443
2168         <rdar://problems/29123243>
2169
2170         Reviewed by Simon Fraser and Darin Adler.
2171
2172         Add support for rendering the new color() syntax, which
2173         ends up as an ExtendedColor.
2174
2175         In order to make rendering code a little more readable, I
2176         changed Color::hasAlpha to Color::isOpaque (since an alpha
2177         of 100% is still an alpha), and added a Color::isVisible
2178         helper (the color isn't completely transparent). These new
2179         helpers support ExtendedColor forms.
2180
2181         Support for painting gradients and blending between colors
2182         is still to come. I also added some FIXME comments
2183         to show other places that don't handle ExtendedColors yet.
2184
2185         Tests: css3/color/backgrounds-and-borders.html
2186                css3/color/box-shadows.html
2187                css3/color/canvas.html
2188                css3/color/composited-solid-backgrounds.html
2189                css3/color/text.html
2190
2191         * css/CSSGradientValue.cpp: Add some notes that this is broken.
2192         (WebCore::interpolate):
2193         (WebCore::CSSGradientValue::knownToBeOpaque):
2194
2195         * editing/EditingStyle.cpp: Use new Color helpers.
2196         (WebCore::isTransparentColorValue):
2197
2198         * editing/mac/EditorMac.mm: Use new Color helpers.
2199         (WebCore::Editor::fontAttributesForSelectionStart):
2200
2201         * html/ColorInputType.cpp: No need to use the Color class at all here.
2202         (WebCore::isValidSimpleColorString): Renamed from isValidColorString.
2203         (WebCore::ColorInputType::sanitizeValue):
2204         (WebCore::ColorInputType::typeMismatchFor):
2205         (WebCore::isValidColorString): Deleted.
2206
2207         * html/canvas/CanvasRenderingContext2D.cpp: New helpers.
2208         (WebCore::CanvasRenderingContext2D::shouldDrawShadows):
2209         (WebCore::CanvasRenderingContext2D::didDraw):
2210
2211         * page/FrameView.cpp: Ditto.
2212         (WebCore::FrameView::recalculateScrollbarOverlayStyle):
2213         (WebCore::FrameView::hasOpaqueBackground):
2214         (WebCore::FrameView::setBaseBackgroundColor):
2215
2216         * platform/graphics/Color.cpp:
2217         (WebCore::differenceSquared): Support ExtendedColor, but also
2218         add a note to indicate that this method and its call sites
2219         should use floats.
2220         (WebCore::Color::serialized): New helper.
2221         (WebCore::Color::cssText): Ditto.
2222         (WebCore::Color::blend): Ditto.
2223         (WebCore::Color::blendWithWhite):
2224         (WebCore::Color::colorWithAlphaMultipliedBy): Implementation of new function.
2225         (WebCore::Color::colorWithAlpha): Ditto.
2226         (WebCore::Color::opaqueColor): New method to return an opaque version of the given color.
2227         (WebCore::blend):
2228         * platform/graphics/Color.h:
2229         (WebCore::Color::isOpaque): New helper that is !hasAlpha().
2230         (WebCore::Color::isVisible): New helper.
2231         (WebCore::Color::alphaAsFloat): Gets the alpha value as a float. This replaces
2232         a bunch of places that were calculating it manually each time. Meanwhile, we
2233         might consider always exposing the primaries as floats... or at least
2234         have that option.
2235         (WebCore::isBlackColor): New helper - it was used in a couple of places.
2236         (WebCore::isWhiteColor): Ditto.
2237         (WebCore::Color::hasAlpha): Deleted.
2238
2239         * platform/graphics/Gradient.cpp: Add FIXME.
2240         (WebCore::Gradient::addColorStop):
2241         * platform/graphics/Gradient.h:
2242
2243         * platform/graphics/GraphicsContext.cpp: Use new helpers.
2244         (WebCore::GraphicsContext::computeLineBoundsAndAntialiasingModeForText):
2245         * platform/graphics/GraphicsContext.h:
2246         (WebCore::GraphicsContext::hasVisibleShadow):
2247
2248         * platform/graphics/Image.cpp: Ditto.
2249         (WebCore::Image::fillWithSolidColor):
2250
2251         * platform/graphics/ShadowBlur.cpp: Ditto.
2252         (WebCore::ShadowBlur::updateShadowBlurValues):
2253
2254         * platform/graphics/ca/GraphicsLayerCA.cpp: Ditto.
2255         (WebCore::GraphicsLayerCA::setContentsToSolidColor):
2256
2257         * platform/graphics/cg/GradientCG.cpp:
2258         (WebCore::Gradient::platformGradient): Add a FIXME to note that we can
2259         add ExtendedColor support simply by using CGColors, rather than fetching
2260         the components ourselves.
2261
2262         * platform/graphics/cg/GraphicsContextCG.cpp: New helpers.
2263         (WebCore::calculateDrawingMode):
2264
2265         * platform/graphics/cocoa/FontCascadeCocoa.mm: New helpers.
2266         (WebCore::FontCascade::drawGlyphs):
2267
2268         * platform/graphics/mac/ColorMac.mm: Use the new helpers and Color::hash().
2269         (WebCore::nsColor):
2270
2271         * platform/graphics/texmap/TextureMapperGL.cpp: New helpers.
2272         (WebCore::TextureMapperGL::drawBorder):
2273
2274         * rendering/BorderEdge.cpp: Ditto.
2275         (WebCore::BorderEdge::obscuresBackgroundEdge):
2276         (WebCore::BorderEdge::obscuresBackground):
2277
2278         * rendering/RenderBox.cpp: Ditto.
2279         (WebCore::RenderBox::getBackgroundPaintedExtent):
2280         (WebCore::RenderBox::backgroundIsKnownToBeOpaqueInRect):
2281         (WebCore::RenderBox::backgroundHasOpaqueTopLayer):
2282
2283         * rendering/RenderBoxModelObject.cpp: Ditto.
2284         (WebCore::RenderBoxModelObject::paintFillLayerExtended):
2285         (WebCore::colorNeedsAntiAliasAtCorner):
2286         (WebCore::willBeOverdrawn):
2287         (WebCore::RenderBoxModelObject::paintTranslucentBorderSides):
2288         (WebCore::RenderBoxModelObject::paintBorder):
2289         (WebCore::RenderBoxModelObject::boxShadowShouldBeAppliedToBackground):
2290         (WebCore::RenderBoxModelObject::paintBoxShadow):
2291         * rendering/RenderElement.cpp:
2292         (WebCore::RenderElement::paintOutline):
2293         * rendering/RenderInline.cpp:
2294         (WebCore::RenderInline::paintOutline):
2295         * rendering/RenderLayerBacking.cpp:
2296         (WebCore::canCreateTiledImage):
2297         * rendering/RenderLayerCompositor.cpp:
2298         (WebCore::RenderLayerCompositor::viewHasTransparentBackground):
2299         * rendering/RenderMenuList.cpp:
2300         (RenderMenuList::getItemBackgroundColor):
2301         * rendering/RenderTheme.cpp:
2302         (WebCore::RenderTheme::disabledTextColor):
2303         * rendering/RenderView.cpp:
2304         (WebCore::RenderView::paintBoxDecorations):
2305         * rendering/TextDecorationPainter.cpp:
2306         (WebCore::TextDecorationPainter::paintTextDecoration):
2307         * rendering/TextPainter.cpp:
2308         (WebCore::TextPainter::paintTextWithShadows):
2309         * rendering/style/BorderValue.h:
2310         (WebCore::BorderValue::isTransparent):
2311         * rendering/style/RenderStyle.cpp:
2312         (WebCore::RenderStyle::visitedDependentColor):
2313         * rendering/style/RenderStyle.h:
2314         (WebCore::RenderStyle::hasBackground):
2315         * rendering/svg/RenderSVGResource.cpp:
2316         (WebCore::requestPaintingResource):
2317         * rendering/svg/SVGInlineTextBox.cpp:
2318         (WebCore::SVGInlineTextBox::paintSelectionBackground):
2319
2320         * svg/SVGAnimatedColor.cpp: Add a FIXME to note this is broken.
2321         (WebCore::SVGAnimatedColorAnimator::calculateAnimatedValue):
2322
2323 2016-11-09  Antoine Quint  <graouts@apple.com>
2324
2325         [Modern Media Controls] UI Library: StatusLabel
2326         https://bugs.webkit.org/show_bug.cgi?id=164544
2327         <rdar://problem/29179541>
2328
2329         Reviewed by Dean Jackson.
2330
2331         We add a new StatusLabel class to display a string of text in place of the TimeControl.
2332         A followup patch will add the logic to display "Error", "Loading" and "Live Broadcast"
2333         test under the right media state.
2334
2335         Tests: media/modern-media-controls/macos-inline-media-controls/macos-inline-media-controls-status-label.html
2336                media/modern-media-controls/status-label/status-label.html
2337
2338         * Modules/modern-media-controls/controls/macos-inline-media-controls.css:
2339         (.media-controls.mac.inline .time-label,):
2340         (.media-controls.mac.inline .time-label): Deleted.
2341         * Modules/modern-media-controls/controls/macos-inline-media-controls.js:
2342         (MacOSInlineMediaControls.prototype.layout):
2343         * Modules/modern-media-controls/controls/media-controls.js:
2344         (MediaControls.):
2345         * Modules/modern-media-controls/controls/status-label.css: Added.
2346         (.status-label):
2347         * Modules/modern-media-controls/controls/status-label.js: Added.
2348         (StatusLabel.prototype.get text):
2349         (StatusLabel.prototype.set text):
2350         (StatusLabel.prototype.commitProperty):
2351         * Modules/modern-media-controls/js-files:
2352         * WebCore.xcodeproj/project.pbxproj:
2353
2354 2016-11-09  Chris Dumez  <cdumez@apple.com>
2355
2356         [Mac] Stop using deprecated AppKit enumeration values
2357         https://bugs.webkit.org/show_bug.cgi?id=164494
2358
2359         Reviewed by Darin Adler.
2360
2361         Stop using deprecated AppKit enumeration values.
2362
2363         * editing/cocoa/HTMLConverter.mm:
2364         (HTMLConverter::computedAttributesForElement):
2365         (HTMLConverter::_processElement):
2366         (HTMLConverter::_addMarkersToList):
2367         * page/mac/EventHandlerMac.mm:
2368         (WebCore::EventHandler::keyEvent):
2369         (WebCore::lastEventIsMouseUp):
2370         (WebCore::EventHandler::passSubframeEventToSubframe):
2371         (WebCore::EventHandler::widgetDidHandleWheelEvent):
2372         (WebCore::EventHandler::sendFakeEventsAfterWidgetTracking):
2373         * page/mac/TextIndicatorWindow.mm:
2374         (WebCore::TextIndicatorWindow::setTextIndicator):
2375         * platform/graphics/mac/IconMac.mm:
2376         (WebCore::Icon::paint):
2377         * platform/mac/CursorMac.mm:
2378         (WebCore::createCustomCursor):
2379         * platform/mac/DragImageMac.mm:
2380         (WebCore::dissolveDragImageToFraction):
2381         (WebCore::createDragImageFromImage):
2382         * platform/mac/EventLoopMac.mm:
2383         (WebCore::EventLoop::cycle):
2384         * platform/mac/PasteboardMac.mm:
2385         (WebCore::Pasteboard::setDragImage):
2386         * platform/mac/PlatformEventFactoryMac.mm:
2387         (WebCore::globalPointForEvent):
2388         (WebCore::pointForEvent):
2389         (WebCore::mouseButtonForEvent):
2390         (WebCore::mouseEventTypeForEvent):
2391         (WebCore::clickCountForEvent):
2392         (WebCore::isKeypadEvent):
2393         (WebCore::windowsKeyCodeForKeyEvent):
2394         (WebCore::isKeyUpEvent):
2395         (WebCore::PlatformKeyboardEventBuilder::PlatformKeyboardEventBuilder):
2396         * platform/mac/ScrollbarThemeMac.mm:
2397         (WebCore::scrollbarControlSizeToNSControlSize):
2398         * platform/mac/ThemeMac.mm:
2399         (-[WebCoreThemeView window]):
2400         (WebCore::controlSizeForFont):
2401         (WebCore::controlSizeFromPixelSize):
2402         (WebCore::setUpButtonCell):
2403         (WebCore::stepperControlSizeForFont):
2404         (WebCore::paintStepper):
2405         (WebCore::ThemeMac::minimumControlSize):
2406         * platform/mac/WebVideoFullscreenHUDWindowController.mm:
2407         (-[WebVideoFullscreenHUDWindow initWithContentRect:styleMask:backing:defer:]):
2408         (-[WebVideoFullscreenHUDWindow performKeyEquivalent:]):
2409         (-[WebVideoFullscreenHUDWindowController init]):
2410         (-[WebVideoFullscreenHUDWindowController keyDown:]):
2411         (-[WebVideoFullscreenHUDWindowController windowDidLoad]):
2412         * platform/mac/WebWindowAnimation.mm:
2413         (WebWindowAnimationDurationFromDuration):
2414         * rendering/RenderThemeMac.mm:
2415         (WebCore::RenderThemeMac::updateCachedSystemFontDescription):
2416         (WebCore::RenderThemeMac::controlSizeForFont):
2417         (WebCore::RenderThemeMac::controlSizeForCell):
2418         (WebCore::RenderThemeMac::controlSizeForSystemFont):
2419         (WebCore::RenderThemeMac::paintProgressBar):
2420         (WebCore::RenderThemeMac::popupMenuSize):
2421         (WebCore::RenderThemeMac::sliderThumbHorizontal):
2422         (WebCore::RenderThemeMac::sliderThumbVertical):
2423
2424 2016-11-08  Antoine Quint  <graouts@apple.com>
2425
2426         [Modern Media Controls] UI Library: iOS inline controls
2427         https://bugs.webkit.org/show_bug.cgi?id=164513
2428         <rdar://problem/27989475>
2429
2430         Reviewed by Dean Jackson.
2431
2432         We introduce a new IOSInlineMediaControls class which can be used to instantiate media controls
2433         for inline playback on iOS.
2434
2435         Tests: media/modern-media-controls/ios-inline-media-controls/ios-inline-media-controls-buttons-styles.html
2436                media/modern-media-controls/ios-inline-media-controls/ios-inline-media-controls-constructor.html
2437                media/modern-media-controls/ios-inline-media-controls/ios-inline-media-controls-controls-bar-styles.html
2438                media/modern-media-controls/ios-inline-media-controls/ios-inline-media-controls-layout.html
2439                media/modern-media-controls/ios-inline-media-controls/ios-inline-media-controls-time-control-styles.html
2440                media/modern-media-controls/ios-inline-media-controls/ios-inline-media-dropping-controls.html
2441
2442         * Modules/modern-media-controls/controls/ios-inline-media-controls.css: Added.
2443         (.media-controls.ios.inline > .controls-bar):
2444         (.media-controls.ios.inline .time-control):
2445         (.media-controls.ios.inline button):
2446         (.media-controls.ios.inline button:active):
2447         (.media-controls.ios.inline > .controls-bar button):
2448         (.media-controls.ios.inline .buttons-container.right):
2449         (.media-controls.ios.inline button.play-pause):
2450         (.media-controls.ios.inline button.skip-back):
2451         (.media-controls.ios.inline .scrubber.slider):
2452         (.media-controls.ios.inline button.airplay):
2453         (.media-controls.ios.inline button.pip):
2454         (.media-controls.ios.inline button.fullscreen):
2455         (.media-controls.ios.inline .time-label):
2456         (.media-controls.ios.inline .scrubber.slider > .fill):
2457         (.media-controls.ios.inline .scrubber.slider > input::-webkit-slider-thumb):
2458         * Modules/modern-media-controls/controls/ios-inline-media-controls.js: Added.
2459         (IOSInlineMediaControls.prototype.layout):
2460         (IOSInlineMediaControls):
2461         * Modules/modern-media-controls/images/iOS/slider-thumb@2x.png: Added.
2462         * Modules/modern-media-controls/js-files:
2463         * WebCore.xcodeproj/project.pbxproj:
2464
2465 2016-11-09  Beth Dakin  <bdakin@apple.com>
2466
2467         Support TouchBar in WebKit
2468         https://bugs.webkit.org/show_bug.cgi?id=164437
2469         -and corresponding-
2470         rdar://problem/28876524
2471
2472         Reviewed by Darin Adler.
2473
2474         * WebCore.xcodeproj/project.pbxproj:
2475         * platform/spi/cocoa/AVKitSPI.h:
2476         * platform/spi/cocoa/NSTouchBarSPI.h: Added.
2477         * platform/spi/mac/NSSpellCheckerSPI.h:
2478
2479 2016-11-09  Chris Dumez  <cdumez@apple.com>
2480
2481         Use Blob URL instead of webkit-fake-url when pasting an image
2482         https://bugs.webkit.org/show_bug.cgi?id=49141
2483
2484         Reviewed by Darin Adler.
2485
2486         Use Blob URL instead of webkit-fake-url when pasting an image.
2487
2488         Tests: editing/pasteboard/paste-image-as-blob-url.html
2489                editing/pasteboard/paste-image-using-image-data.html
2490
2491         * editing/Editor.h:
2492         * editing/mac/EditorMac.mm:
2493         (WebCore::Editor::WebContentReader::readImage):
2494         (WebCore::Editor::createFragmentForImageAndURL):
2495
2496 2016-11-09  Michael Catanzaro  <mcatanzaro@igalia.com>
2497
2498         Fix error message when SQLite initialization fails
2499         https://bugs.webkit.org/show_bug.cgi?id=164462
2500
2501         Reviewed by Darin Adler.
2502
2503         * platform/sql/SQLiteDatabase.cpp:
2504         (WebCore::initializeSQLiteIfNecessary):
2505
2506 2016-11-08  Antoine Quint  <graouts@apple.com>
2507
2508         [Modern Media Controls] UI Library: macOS fullscreen controls
2509         https://bugs.webkit.org/show_bug.cgi?id=164414
2510         <rdar://problem/27989474>
2511
2512         Reviewed by Dean Jackson.
2513
2514         We introduce a new MacOSFullscreenMediaControls class which can be used to instantiate media controls
2515         for fullscreen playback on macOS. These controls can be dragged by the user.
2516
2517         Tests: media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-buttons-containers-styles.html
2518                media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-buttons-styles.html
2519                media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-constructor.html
2520                media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-controls-bar-styles.html
2521                media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-right-container-margin.html
2522                media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-time-control-styles.html
2523                media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-volume-styles.html
2524
2525         * Modules/modern-media-controls/controls/button.js:
2526         (Button.prototype.set enabled):
2527
2528             Correctly notify the layoutDelegate when the enabled property changes, regardless of whether
2529             the flag is on.
2530
2531         * Modules/modern-media-controls/controls/icon-button.js:
2532         (IconButton.prototype._updateImage):
2533         (IconButton):
2534
2535             Correctly notify the layout delegate when the image metrics have changed so that it may perform
2536             a layout. This issues became apparent with the new tests on Yosemite and caused some flakyness.
2537
2538         * Modules/modern-media-controls/controls/icon-service.js:
2539         (const.iconService.new.IconService.prototype._fileNameAndPlatformForIconNameAndLayoutTraits):
2540         (const.iconService.new.IconService):
2541
2542             Fix a typo.
2543
2544         * Modules/modern-media-controls/controls/macos-fullscreen-media-controls.css: Added.
2545         (.media-controls.mac.fullscreen > .controls-bar):
2546         (.media-controls.mac.fullscreen .volume.slider):
2547         (.media-controls.mac.fullscreen .buttons-container):
2548         (.media-controls.mac.fullscreen .buttons-container.center):
2549         (.media-controls.mac.fullscreen > .controls-bar button):
2550         (.media-controls.mac.fullscreen button.rewind):
2551         (.media-controls.mac.fullscreen button.play-pause):
2552         (.media-controls.mac.fullscreen button.forward):
2553         (.media-controls.mac.fullscreen .buttons-container.right):
2554         (.media-controls.mac.fullscreen button.airplay):
2555         (.media-controls.mac.fullscreen button.aspect-ratio):
2556         (.media-controls.mac.fullscreen button.pip):
2557         (.media-controls.mac.fullscreen button.tracks):
2558         (.media-controls.mac.fullscreen button.fullscreen):
2559         (.media-controls.mac.fullscreen .time-control):
2560         (.media-controls.mac.fullscreen .time-label):
2561         (.media-controls.mac.fullscreen .scrubber):
2562         * Modules/modern-media-controls/controls/macos-fullscreen-media-controls.js: Added.
2563         (MacOSFullscreenMediaControls.prototype.layout):
2564         (MacOSFullscreenMediaControls):
2565         * Modules/modern-media-controls/controls/macos-media-controls.js:
2566         (MacOSMediaControls):
2567         
2568             Allow the layoutTraits property to be set to something other than just LayoutTraits.macOS
2569             so that MacOSFullscreenMediaControls may set the LayoutTraits.Fullscreen bit.
2570         
2571         * Modules/modern-media-controls/js-files:
2572         
2573             Add a reference to the new macos-fullscreen-media-controls.js file.
2574         
2575         * WebCore.xcodeproj/project.pbxproj:
2576
2577             Add references to the new macos-fullscreen-media-controls.js and
2578             macos-fullscreen-media-controls.css files.
2579
2580 2016-11-09  Chris Dumez  <cdumez@apple.com>
2581
2582         Shave 16 bytes off HTMLInputElement
2583         https://bugs.webkit.org/show_bug.cgi?id=164488
2584
2585         Reviewed by Sam Weinig.
2586
2587         Shave 16 bytes off HTMLInputElement (232 -> 216) by packing data members
2588         better.
2589
2590         * html/HTMLFormControlElement.h:
2591         * html/HTMLTextFormControlElement.cpp:
2592         (WebCore::HTMLTextFormControlElement::HTMLTextFormControlElement):
2593         * html/HTMLTextFormControlElement.h:
2594
2595 2016-11-09  Youenn Fablet  <youenn@apple.com>
2596
2597         [WebRTC] Introduce asynchronous backend for other RTCPeerConnection API
2598         https://bugs.webkit.org/show_bug.cgi?id=164409
2599
2600         Reviewed by Eric Carlson.
2601
2602         Covered by existing tests.
2603
2604         Following on createOffer changes, applying the same changes to createAnswer, setLocalDescription, setRemoteDescription and addIceCandidate.
2605         Also refactored ICE candidate event generation (done at PeerConnectionBackend).
2606         Updated stop implementation to clean any promise that may be stored in PeerConnectionBackend.
2607
2608         The goal of this is to be more aligned with https://www.w3.org/TR/webrtc/.
2609         Implementation of the various functions such as //www.w3.org/TR/webrtc/#set-description would be done in PeerConnectionBackend.
2610         This will require additional code moved from MediaEndpointPeerConnection up to PeerConnectionBackend.
2611
2612         * Modules/mediastream/MediaEndpointPeerConnection.cpp:
2613         (WebCore::MediaEndpointPeerConnection::createOfferTask):
2614         (WebCore::MediaEndpointPeerConnection::doCreateAnswer):
2615         (WebCore::MediaEndpointPeerConnection::createAnswerTask):
2616         (WebCore::MediaEndpointPeerConnection::doSetLocalDescription):
2617         (WebCore::MediaEndpointPeerConnection::setLocalDescriptionTask):
2618         (WebCore::MediaEndpointPeerConnection::doSetRemoteDescription):
2619         (WebCore::MediaEndpointPeerConnection::setRemoteDescriptionTask):
2620         (WebCore::MediaEndpointPeerConnection::doAddIceCandidate):
2621         (WebCore::MediaEndpointPeerConnection::addIceCandidateTask):
2622         (WebCore::MediaEndpointPeerConnection::doStop):
2623         (WebCore::MediaEndpointPeerConnection::gotIceCandidate):
2624         (WebCore::MediaEndpointPeerConnection::doneGatheringCandidates):
2625         (WebCore::MediaEndpointPeerConnection::createAnswer): Deleted.
2626         (WebCore::MediaEndpointPeerConnection::setLocalDescription): Deleted.
2627         (WebCore::MediaEndpointPeerConnection::setRemoteDescription): Deleted.
2628         (WebCore::MediaEndpointPeerConnection::addIceCandidate): Deleted.
2629         (WebCore::MediaEndpointPeerConnection::stop): Deleted.
2630         (WebCore::MediaEndpointPeerConnection::localDescriptionTypeValidForState): Deleted.
2631         (WebCore::MediaEndpointPeerConnection::remoteDescriptionTypeValidForState): Deleted.
2632         * Modules/mediastream/MediaEndpointPeerConnection.h:
2633         * Modules/mediastream/PeerConnectionBackend.cpp:
2634         (WebCore::PeerConnectionBackend::createOffer):
2635         (WebCore::PeerConnectionBackend::createOfferFailed):
2636         (WebCore::PeerConnectionBackend::createAnswer):
2637         (WebCore::PeerConnectionBackend::createAnswerSucceeded):
2638         (WebCore::PeerConnectionBackend::createAnswerFailed):
2639         (WebCore::isLocalDescriptionTypeValidForState):
2640         (WebCore::PeerConnectionBackend::setLocalDescription):
2641         (WebCore::PeerConnectionBackend::setLocalDescriptionSucceeded):
2642         (WebCore::PeerConnectionBackend::setLocalDescriptionFailed):
2643         (WebCore::isRemoteDescriptionTypeValidForState):
2644         (WebCore::PeerConnectionBackend::setRemoteDescription):
2645         (WebCore::PeerConnectionBackend::setRemoteDescriptionSucceeded):
2646         (WebCore::PeerConnectionBackend::setRemoteDescriptionFailed):
2647         (WebCore::PeerConnectionBackend::addIceCandidate):
2648         (WebCore::PeerConnectionBackend::addIceCandidateSucceeded):
2649         (WebCore::PeerConnectionBackend::addIceCandidateFailed):
2650         (WebCore::PeerConnectionBackend::fireICECandidateEvent):
2651         (WebCore::PeerConnectionBackend::doneGatheringCandidates):
2652         (WebCore::PeerConnectionBackend::stop):
2653         * Modules/mediastream/PeerConnectionBackend.h:
2654
2655 2016-11-09  Eric Carlson  <eric.carlson@apple.com>
2656
2657         [MediaStream][Mac] Mark captured video frames as ready for display immediately
2658         https://bugs.webkit.org/show_bug.cgi?id=164482
2659         <rdar://problem/29139073>
2660
2661         Reviewed by Jer Noble.
2662
2663         * platform/cf/CoreMediaSoftLink.cpp: Add new constant.
2664         * platform/cf/CoreMediaSoftLink.h:
2665
2666         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h:
2667         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
2668         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::requestNotificationWhenReadyForMediaData):
2669           New, ask register for a callback when the sample buffer display layer is ready
2670           for more media data.
2671         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::enqueueVideoSampleBuffer): Don't change
2672           the sample timestamps, assume the caller has configured the sample correctly.
2673         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::prepareVideoSampleBufferFromTrack): Don't
2674           drop frames when the display layer isn't ready.
2675         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::destroyLayer): Call stopRequestingMediaData.
2676         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::sampleBufferUpdated):
2677         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::enqueueVideoSampleBufferFromTrack): Deleted.
2678
2679         * platform/mediastream/mac/AVVideoCaptureSource.mm:
2680         (WebCore::AVVideoCaptureSource::setupCaptureSession): Tell the video output to always discard
2681           late video frames, we don't need them.
2682         (WebCore::AVVideoCaptureSource::processNewFrame): Add a kCMSampleAttachmentKey_DisplayImmediately
2683           attachment.
2684
2685 2016-11-09  Joanmarie Diggs  <jdiggs@igalia.com>
2686
2687         AX: [ATK] Wrong selected element at a given index in a list box (redux)
2688         https://bugs.webkit.org/show_bug.cgi?id=164430
2689
2690         Reviewed by Darin Adler.
2691
2692         This essentially undoes the implementation change resulting from r164577.
2693         As stated in the ATK documentation, atk_selection_ref_selection() takes
2694         "a gint specifying the index in the selection set. (e.g. the ith selection
2695         as opposed to the ith child)." r164577 deliberately modified that, causing
2696         atk_selection_ref_selection() to treat the index as if it were the position
2697         with respect to all of the children. There is different API in ATK, namely
2698         atk_object_ref_accessible_child(), when the ith child from the set of all
2699         children is sought.
2700
2701         Tests: accessibility/aria-listbox-no-selection.html
2702                accessibility/native-listbox-no-selection.html
2703
2704         * accessibility/atk/WebKitAccessibleInterfaceSelection.cpp:
2705         (optionFromSelection):
2706
2707 2016-11-09  Gyuyoung Kim  <gyuyoung.kim@webkit.org>
2708
2709         [EFL] Use libgcrypt instead of GnuTLS for CryptoDigest
2710         https://bugs.webkit.org/show_bug.cgi?id=164461
2711
2712         Reviewed by Michael Catanzaro.
2713
2714         As GTK port in r208297, EFL port starts to use libgcrypt instead of GnuTLS as well.
2715
2716         No new tests, no behavior change.
2717
2718         * PlatformEfl.cmake:
2719
2720 2016-11-09  Ryan Haddad  <ryanhaddad@apple.com>
2721
2722         Unreviewed, rolling out r208422.
2723
2724         Roll r208382 back in since it was not responsible for the API
2725         test failures seen on macOS.
2726
2727         Reverted changeset:
2728
2729         "Unreviewed, rolling out r208382."
2730         https://bugs.webkit.org/show_bug.cgi?id=164319
2731         http://trac.webkit.org/changeset/208422
2732
2733 2016-11-09  Csaba Osztrogonác  <ossy@webkit.org>
2734
2735         One more URTBF after r208361.
2736
2737         * PlatformMac.cmake:
2738
2739 2016-11-09  Csaba Osztrogonác  <ossy@webkit.org>
2740
2741         Typo fix after r162782
2742         https://bugs.webkit.org/show_bug.cgi?id=164473
2743
2744         Unreviewed trivial fix.
2745
2746         * platform/ThreadGlobalData.cpp:
2747
2748 2016-11-07  Ryan Haddad  <ryanhaddad@apple.com>
2749
2750         Unreviewed, rolling out r208382.
2751
2752         This change appears to have caused 3
2753         SerializedCryptoKeyWrapTest API tests to fail on macOS.
2754
2755         Reverted changeset:
2756
2757         "[Readable Streams API] Implement ByteStreamController
2758         error()"
2759         https://bugs.webkit.org/show_bug.cgi?id=164319
2760         http://trac.webkit.org/changeset/208382
2761
2762 2016-11-04  Filip Pizlo  <fpizlo@apple.com>
2763
2764         WTF::ParkingLot should stop using std::chrono because std::chrono::duration casts are prone to overflows
2765         https://bugs.webkit.org/show_bug.cgi?id=152045
2766
2767         Reviewed by Andy Estes.
2768
2769         No new layout tests because no new behavior. The new WTF time classes have some unit tests
2770         in TestWebKitAPI.
2771
2772         * fileapi/ThreadableBlobRegistry.cpp:
2773         (WebCore::ThreadableBlobRegistry::blobSize):
2774         * platform/MainThreadSharedTimer.h:
2775         * platform/SharedTimer.h:
2776         * platform/ThreadTimers.cpp:
2777         (WebCore::ThreadTimers::updateSharedTimer):
2778         * platform/cf/MainThreadSharedTimerCF.cpp:
2779         (WebCore::MainThreadSharedTimer::setFireInterval):
2780         * platform/efl/MainThreadSharedTimerEfl.cpp:
2781         (WebCore::MainThreadSharedTimer::setFireInterval):
2782         * platform/glib/MainThreadSharedTimerGLib.cpp:
2783         (WebCore::MainThreadSharedTimer::setFireInterval):
2784         * platform/win/MainThreadSharedTimerWin.cpp:
2785         (WebCore::MainThreadSharedTimer::setFireInterval):
2786         * workers/WorkerRunLoop.cpp:
2787         (WebCore::WorkerRunLoop::runInMode):
2788
2789 2016-11-04  Zalan Bujtas  <zalan@apple.com>
2790
2791         RenderFlowThread state reset cleanup.
2792         https://bugs.webkit.org/show_bug.cgi?id=164426
2793
2794         Reviewed by Simon Fraser.
2795
2796         RenderFlowThread state reset is spread across several functions. This patch groups them
2797         together in RenderObject::resetFlowThreadState().
2798
2799         No change in functionality.
2800
2801         * rendering/RenderBlock.cpp:
2802         (WebCore::RenderBlock::removeLeftoverAnonymousBlock):
2803         (WebCore::RenderBlock::dropAnonymousBoxChild): This is now part of resetFlowThreadState() since resetFlowThreadState
2804         gets called even when NotifyChildren is false.
2805         * rendering/RenderElement.cpp:
2806         (WebCore::RenderElement::insertChildInternal): Initialize the thread state before we notify the child.
2807         (WebCore::RenderElement::removeChildInternal): Reset the state even when NotifyChildren is false.
2808         (WebCore::RenderElement::willBeRemovedFromTree): This code is moved to removeFromRenderFlowThread().
2809         (WebCore::RenderElement::removeFromRenderFlowThread):
2810         * rendering/RenderObject.cpp:
2811         (WebCore::RenderObject::initializeFlowThreadState): This is in transition for webkit.org/b/164428 (RenderFlowThread state initialization cleanup.)
2812         (WebCore::RenderObject::resetFlowThreadState):
2813         (WebCore::RenderObject::setParent): This was seemingly a random place to put flow state initialization. 
2814         (WebCore::RenderObject::willBeRemovedFromTree): resetFlowThreadState() takes care of it now.
2815         * rendering/RenderObject.h:
2816
2817 2016-11-04  Yusuke Suzuki  <utatane.tea@gmail.com>
2818
2819         [DOMJIT] Add DOMJIT::Signature annotation to Document::getElementById
2820         https://bugs.webkit.org/show_bug.cgi?id=164356
2821
2822         Reviewed by Filip Pizlo.
2823
2824         This patch implements DOMJIT::Signature annotation for getElementById.
2825         Since getElementById is also implemented in DocumentFragment, we implement
2826         the branchIfDocumentFragment/branchIfNotDocumentFragment for that.
2827
2828         In dromaeo, we have a test like this.
2829
2830         test( "getElementById", function(){
2831             for ( var i = 0; i < num * 30; i++ ) {
2832                 ret = document.getElementById("testA" + num).nodeType;
2833                 ret = document.getElementById("testB" + num).nodeType;
2834                 ret = document.getElementById("testC" + num).nodeType;
2835                 ret = document.getElementById("testD" + num).nodeType;
2836                 ret = document.getElementById("testE" + num).nodeType;
2837                 ret = document.getElementById("testF" + num).nodeType;
2838             }
2839         });
2840
2841         In the above test, JSC already knows the following things.
2842
2843         1. Since nodeType is now handled as CallDOMGetter, we know that it is pure.
2844         2. getElementById look up becomes PureGetById since document is impure object. But it is kept as PureGetById. So it does not write DOMState.
2845         3. `"testA" + num` will be converted to constant string.
2846         4. CallDOM for getElementById said it just reads(DOMState:DOM). And it saids that it returns the same value as long as DOMState is not clobbered.
2847         5. CheckCell leading CallDOM ensures the inlined getElementById node. (CallDOM node).
2848
2849         The key thing is that no node clobbers DOMState during the loop. So CallDOM & CallDOMGetter can be hoisted.
2850         This improves dom-query significantly. Dromaeo dom-query getElementById becomes 40x faster (247796 v.s. 6197).
2851         Dromaeo dom-query getElementById (not in document) becomes 89x faster (630317.8 v.s. 7066.).
2852
2853         Tests: js/dom/domjit-function-get-element-by-id-changed.html
2854                js/dom/domjit-function-get-element-by-id-licm.html
2855                js/dom/domjit-function-get-element-by-id.html
2856
2857         * dom/NonElementParentNode.idl:
2858         * domjit/DOMJITCheckDOM.h:
2859         (WebCore::DOMJIT::TypeChecker<DocumentFragment>::branchIfFail):
2860         * domjit/DOMJITHelpers.h:
2861         (WebCore::DOMJIT::branchIfDocumentFragment):
2862         (WebCore::DOMJIT::branchIfNotDocumentFragment):
2863
2864 2016-11-04  Simon Fraser  <simon.fraser@apple.com>
2865
2866         Rename unscaledUnobscuredVisibleContentSize and unscaledVisibleContentSizeIncludingObscuredArea for attempted clarity
2867         https://bugs.webkit.org/show_bug.cgi?id=164438
2868
2869         Reviewed by Tim Horton.
2870
2871         unscaledUnobscuredVisibleContentSize() and unscaledVisibleContentSizeIncludingObscuredArea() were an endless source
2872         of confusion.
2873         
2874         Functions with "VisibleContent" in the name are usually expected to return document coordinates (affected by zooming),
2875         so unscaledUnobscuredVisibleContentSize caused cognitive dissonance because of "unscaled" vs "visibleContent", and
2876         "unobscured" vs "visible".
2877         
2878         So rename:
2879             unscaledUnobscuredVisibleContentSize -> sizeForUnobscuredContent
2880             unscaledVisibleContentSizeIncludingObscuredArea -> sizeForVisibleContent
2881         
2882         sizeForUnobscuredContent() can also be private to ScrollView.
2883
2884         * inspector/InspectorOverlay.cpp:
2885         (WebCore::InspectorOverlay::update):
2886         * platform/ScrollView.cpp:
2887         (WebCore::ScrollView::unobscuredContentRectInternal):
2888         (WebCore::ScrollView::sizeForVisibleContent):
2889         (WebCore::ScrollView::sizeForUnobscuredContent): Don't compute unscaledVisibleContentSizeIncludingObscuredArea
2890         before testing whether we have a platform widget.
2891         (WebCore::ScrollView::layoutSize):
2892         (WebCore::ScrollView::unscaledVisibleContentSizeIncludingObscuredArea): Deleted.
2893         (WebCore::ScrollView::unscaledUnobscuredVisibleContentSize): Deleted.
2894         * platform/ScrollView.h:
2895         * rendering/RenderBoxModelObject.cpp:
2896         (WebCore::RenderBoxModelObject::calculateBackgroundImageGeometry):
2897         * rendering/RenderLayerCompositor.cpp:
2898         (WebCore::RenderLayerCompositor::flushPendingLayerChanges):
2899         (WebCore::RenderLayerCompositor::frameViewDidChangeSize):
2900         (WebCore::RenderLayerCompositor::updateRootLayerPosition):
2901         (WebCore::RenderLayerCompositor::ensureRootLayer):
2902
2903 2016-11-04  Simon Fraser  <simon.fraser@apple.com>
2904
2905         Layout viewport wrong with RTL documents
2906         https://bugs.webkit.org/show_bug.cgi?id=164434
2907
2908         Reviewed by Tim Horton.
2909
2910         The layoutViewportRect was computed incorrectly in RTL documents, because 
2911         FrameView::unscaledMaximumScrollPosition() was wrong; it erroneously mapped
2912         what it thought was a scrollOffset to a scrollPosition.
2913
2914         Unscaled scroll positions are in the same coordinate space as unscaledDocumentRect,
2915         so we should not call scrollPositionFromOffset() in FrameView::unscaledMaximumScrollPosition().
2916
2917         Changed FrameView::unscaledMinimumScrollPosition() to also just grab the location of
2918         unscaledDocumentRect, for symmetry.
2919
2920         Finally fixed the tiled scrolling indicator's viewport rect for zoomed RTL documents
2921         by using the unscaled scroll origin.
2922
2923         Tests: fast/visual-viewport/rtl-nonzoomed-rects.html
2924                fast/visual-viewport/rtl-zoomed-rects.html
2925
2926         * page/FrameView.cpp:
2927         (WebCore::FrameView::setLayoutViewportOrigin):
2928         (WebCore::FrameView::unscaledScrollOrigin):
2929         (WebCore::FrameView::unscaledMinimumScrollPosition):
2930         (WebCore::FrameView::unscaledMaximumScrollPosition):
2931         * page/FrameView.h:
2932
2933 2016-11-04  Sam Weinig  <sam@webkit.org>
2934
2935         [WebIDL] Add support for modern callback syntax
2936         https://bugs.webkit.org/show_bug.cgi?id=164435
2937
2938         Reviewed by Chris Dumez.
2939
2940         Support new callback syntax:
2941             callback Function = void (DOMString arg1, long arg2);
2942
2943         This replaces "callback interface" types with a Callback=FunctionOnly
2944         extended attribute.
2945
2946         * Modules/geolocation/PositionCallback.idl:
2947         * Modules/geolocation/PositionErrorCallback.idl:
2948         * Modules/notifications/NotificationPermissionCallback.idl:
2949         * Modules/quota/StorageErrorCallback.idl:
2950         * Modules/quota/StorageQuotaCallback.idl:
2951         * Modules/quota/StorageUsageCallback.idl:
2952         * Modules/webaudio/AudioBufferCallback.idl:
2953         * Modules/webdatabase/DatabaseCallback.idl:
2954         * Modules/webdatabase/SQLStatementCallback.idl:
2955         * Modules/webdatabase/SQLStatementErrorCallback.idl:
2956         * Modules/webdatabase/SQLTransactionCallback.idl:
2957         * Modules/webdatabase/SQLTransactionErrorCallback.idl:
2958         * dom/RequestAnimationFrameCallback.idl:
2959         * dom/StringCallback.idl:
2960         * html/VoidCallback.idl:
2961         * page/IntersectionObserverCallback.idl:
2962         * css/MediaQueryListListener.idl:
2963         Update to new syntax.
2964
2965         * css/MediaQueryListListener.h:
2966         * css/MediaQueryMatcher.cpp:
2967         (WebCore::MediaQueryMatcher::styleResolverChanged):
2968         Switch to using the now required 'handleEvent' name. This is an implementation detail
2969         that we should change.
2970
2971         * bindings/scripts/CodeGenerator.pm:
2972         Update document processing to allow a callback only file. Update callback
2973         type checks to look for a regex that matches in the new format.
2974
2975         * bindings/scripts/CodeGeneratorJS.pm:
2976         (AddToImplIncludesForIDLType):
2977         (AddToIncludesForIDLType):
2978         (AddToImplIncludes):
2979         (AddToIncludes):
2980         Abstract includes functions to allow passing in an include hash.
2981
2982         (GenerateCallbackFunctionHeader):
2983         (GenerateCallbackFunctionImplementation):
2984         (GenerateCallbackInterfaceHeader):
2985         (GenerateCallbackInterfaceImplementation):
2986         (GenerateCallbackHeaderContent):
2987         (GenerateCallbackImplementationContent):
2988         Refactor callback generation code into GenerateCallbackHeaderContent and GenerateCallbackImplementationContent
2989         to allow using it for both the new callbacks as well as the old callback interfaces.
2990
2991         * bindings/scripts/IDLParser.pm:
2992         (Parse):
2993         (applyTypedefs):
2994         (applyTypedefsToOperation):
2995         (parseCallbackRest):
2996         Parse callbacks into the new IDLCallbackFunction type. Ensure that typedefs are applied as well.
2997
2998         * bindings/scripts/IDLAttributes.txt:
2999         Remove support for Callback=FunctionOnly.
3000
3001         * bindings/scripts/test/JS/JSTestCallback.cpp: Removed.
3002         * bindings/scripts/test/JS/JSTestCallback.h: Removed.
3003         * bindings/scripts/test/JS/JSTestCallbackFunction.cpp:
3004         * bindings/scripts/test/JS/JSTestCallbackFunction.h:
3005         * bindings/scripts/test/JS/JSTestCallbackFunctionWithTypedefs.cpp: Added.
3006         * bindings/scripts/test/JS/JSTestCallbackFunctionWithTypedefs.h: Added.
3007         * bindings/scripts/test/JS/JSTestCallbackInterface.cpp: Copied from Source/WebCore/bindings/scripts/test/JS/JSTestCallback.cpp.
3008         * bindings/scripts/test/JS/JSTestCallbackInterface.h: Copied from Source/WebCore/bindings/scripts/test/JS/JSTestCallback.h.
3009         * bindings/scripts/test/JS/JSTestObj.cpp:
3010         * bindings/scripts/test/JS/JSTestTypedefs.cpp:
3011         * bindings/scripts/test/TestCallback.idl: Removed.
3012         * bindings/scripts/test/TestCallbackFunction.idl:
3013         * bindings/scripts/test/TestCallbackFunctionWithTypedefs.idl: Added.
3014         * bindings/scripts/test/TestCallbackInterface.idl: Copied from Source/WebCore/bindings/scripts/test/TestCallback.idl.
3015         * bindings/scripts/test/TestObj.idl:
3016         * bindings/scripts/test/TestTypedefs.idl:
3017         Update existing tests and add new ones to test callback functions specifically.
3018
3019 2016-11-04  Alex Christensen  <achristensen@webkit.org>
3020
3021         Move isDefaultPortForProtocol from URLParser.cpp back to URL.cpp
3022         https://bugs.webkit.org/show_bug.cgi?id=164439
3023
3024         Reviewed by Daniel Bates.
3025
3026         No change in behaviour.
3027
3028         * platform/URL.cpp:
3029         (WebCore::defaultPortForProtocol):
3030         (WebCore::isDefaultPortForProtocol):
3031         * platform/URLParser.cpp:
3032         (WebCore::URLParser::defaultPortForProtocol):
3033         (WebCore::URLParser::parsePort):
3034         (WebCore::defaultPortForProtocol): Deleted.
3035         (WebCore::isDefaultPortForProtocol): Deleted.
3036         * platform/URLParser.h:
3037
3038 2016-11-04  Wenson Hsieh  <wenson_hsieh@apple.com>
3039
3040         Safari does not emit composition end if blurred for dead key / Japanese IME
3041         https://bugs.webkit.org/show_bug.cgi?id=164369
3042         <rdar://problem/29050439>
3043
3044         Reviewed by Ryosuke Niwa.
3045
3046         On Mac, _before_ changing selection, try to finalize the composition by calling Editor::cancelComposition early.
3047         This is because the focused element may have changed after performing the selection change, so we would
3048         otherwise be dispatching the `compositionend` to the new focused element (or no compositionend at all) instead
3049         of the element with the composition.
3050
3051         Doing this allows us to match Chrome and Firefox behavior. After canceling the composition, we then need to also
3052         clear the system IME state. We do this on Mac WK1/WK2 through the cancelComposition() codepath, which ends up
3053         calling into -discardMarkedText, which resets the marked text state. Some minor refactoring was performed to
3054         accomplish this -- currently, discardedComposition sends a CompositionWasCanceled message over to the UI process
3055         that discards the marked text, and then updates the editor state. This patch splits this into two separate
3056         steps -- see the WebKit2 ChangeLog for more details.
3057
3058         Test: fast/events/ime-compositionend-on-selection-change.html
3059
3060         * editing/Editor.cpp:
3061         (WebCore::Editor::selectionWillChange):
3062         * editing/Editor.h:
3063         * editing/FrameSelection.cpp:
3064         (WebCore::FrameSelection::setSelectionWithoutUpdatingAppearance):
3065         * editing/mac/EditorMac.mm:
3066         (WebCore::Editor::selectionWillChange):
3067         * loader/EmptyClients.h:
3068         * page/EditorClient.h:
3069
3070 2016-11-04  Brady Eidson  <beidson@apple.com>
3071
3072         IndexedDB 2.0: Clean up more transaction abort and exception throwing behavior from IDBObjectStore.
3073         https://bugs.webkit.org/show_bug.cgi?id=164424
3074
3075         Reviewed by Alex Christensen.
3076
3077         No new tests (Covered by existing tests).
3078
3079         This patch actually turns a handful of PASS to FAIL in the imported tests, but those are parts of the
3080         spec in flux/under discussion.
3081
3082         We'll update either source or the tests as things are resolved.
3083
3084         * Modules/indexeddb/IDBIndex.cpp:
3085         (WebCore::IDBIndex::rollbackInfoForVersionChangeAbort):
3086
3087         * Modules/indexeddb/IDBObjectStore.cpp:
3088         (WebCore::IDBObjectStore::get):
3089         (WebCore::IDBObjectStore::putOrAdd):
3090         (WebCore::IDBObjectStore::rollbackForVersionChangeAbort):
3091
3092 2016-11-04  Ryosuke Niwa  <rniwa@webkit.org>
3093
3094         Load stylesheets in link elements inside a connected shadow tree
3095         https://bugs.webkit.org/show_bug.cgi?id=160683
3096         <rdar://problem/29040652>
3097
3098         Reviewed by Antti Koivisto.
3099
3100         Allow external stylesheets within a shadow tree by storing the appropriate style scope in HTMLLinkElement
3101         when it's connected to a document instead of always talking to document's style scope.
3102
3103         Tests: fast/shadow-dom/link-element-in-shadow-tree.html
3104                fast/shadow-dom/selected-stylesheet-in-shadow-tree.html
3105
3106        * html/HTMLLinkElement.cpp:
3107        (WebCore::HTMLLinkElement::HTMLLinkElement):
3108        (WebCore::HTMLLinkElement::~HTMLLinkElement):
3109        (WebCore::HTMLLinkElement::setDisabledState): Exit early when the element is not in a document as invoking
3110        didChangeActiveStyleSheetCandidates would require having a valid m_styleScope and process() already exits
3111        early when inDocument() is false.
3112        (WebCore::HTMLLinkElement::parseAttribute):
3113        (WebCore::HTMLLinkElement::process): Removed the early exit for when the element is in a shadow tree.
3114        (WebCore::HTMLLinkElement::insertedInto): Exit early unless this element has just become connected to
3115        a document instead of whenever its self-inclusive ancestor is inserted into a container.
3116        (WebCore::HTMLLinkElement::removedFrom): Ditto for removal. Also call removeStyleSheetCandidateNode after
3117        calling removePendingSheet since the latter depends on m_styleScope being not null.
3118        (WebCore::HTMLLinkElement::addPendingSheet):
3119        (WebCore::HTMLLinkElement::removePendingSheet):
3120        * html/HTMLLinkElement.h:
3121        * html/HTMLStyleElement.cpp:
3122        (WebCore::HTMLStyleElement::insertedInto): Only call inline style owner's insertedIntoDocument if this
3123        element has just become connected to a document.
3124        (WebCore::HTMLStyleElement::removedFrom): Ditto for the removal.
3125        * style/StyleScope.h:
3126        * svg/SVGStyleElement.cpp:
3127        (WebCore::SVGStyleElement::insertedInto): Ditto.
3128        (WebCore::SVGStyleElement::removedFrom): Ditto for the removal.
3129
3130 2016-11-04  Said Abou-Hallawa  <sabouhallawa@apple.com>
3131
3132         Add a setting and preferences to enable/disable async image decoding
3133         https://bugs.webkit.org/show_bug.cgi?id=164417
3134
3135         Reviewed by Simon Fraser.
3136
3137         Add an asyncImageDecodingEnabled setting. This setting controls whether an
3138         image "can" be asynchronously decoded on a separate thread or not. The
3139         function ImageSource::isAsyncDecodingRequired() will be used in conjunction
3140         with this setting to decide whether an image "should" be asynchronously
3141         decoded or not.
3142
3143         * page/Settings.in:
3144
3145 2016-11-04  Tim Horton  <timothy_horton@apple.com>
3146
3147         Apply post-landing review comments for r208347
3148
3149         * dom/Element.cpp:
3150         (WebCore::Element::findAnchorElementForLink):
3151         Use attributeWithoutSynchronization.
3152
3153         * page/PrintContext.cpp:
3154         (WebCore::PrintContext::spoolPage):
3155         (WebCore::PrintContext::spoolRect):
3156         (WebCore::PrintContext::collectLinkedDestinations):
3157         (WebCore::PrintContext::outputLinkedDestinations):
3158         * page/PrintContext.h:
3159         Pass Document by reference instead of Node by pointer,
3160         use ElementTraversal instead of NodeTraversal to avoid
3161         having to locally check the type, and null-check renderers.
3162
3163 2016-11-04  Myles C. Maxfield  <mmaxfield@apple.com>
3164
3165         Implement WebGL2RenderingContext::copyBufferSubData()
3166         https://bugs.webkit.org/show_bug.cgi?id=164008
3167
3168         Reviewed by Dean Jackson.
3169
3170         Similar to previous work regarding WebGL 2 buffers, this method implements
3171         the ability to copy from one buffer to another without the data leaving
3172         the GPU.
3173
3174         Test: fast/canvas/webgl/copyBufferSubData.html
3175
3176         * html/canvas/WebGL2RenderingContext.cpp:
3177         (WebCore::WebGL2RenderingContext::copyBufferSubData):
3178         * html/canvas/WebGLBuffer.cpp:
3179         (WebCore::WebGLBuffer::associateCopyBufferSubData):
3180         * html/canvas/WebGLBuffer.h:
3181         * platform/graphics/GraphicsContext3D.h:
3182         * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
3183         (WebCore::GraphicsContext3D::copyBufferSubData):
3184
3185 2016-11-04  Simon Fraser  <simon.fraser@apple.com>
3186
3187         Rename some ScrollingTree/Node-related functions to reduce the number of uses of "update"
3188         https://bugs.webkit.org/show_bug.cgi?id=164420
3189
3190         Reviewed by Tim Horton.
3191
3192         Rename:
3193             commitNewTreeState -> commitTreeState ("new" was redundant)
3194             updateBeforeChildren -> commitStateBeforeChildren
3195             updateAfterChildren -> commitStateAfterChildren
3196
3197         * page/scrolling/ScrollingTree.cpp:
3198         (WebCore::ScrollingTree::commitTreeState):
3199         (WebCore::ScrollingTree::updateTreeFromStateNode):
3200         (WebCore::ScrollingTree::commitNewTreeState): Deleted.
3201         * page/scrolling/ScrollingTree.h:
3202         * page/scrolling/ScrollingTreeFrameScrollingNode.cpp:
3203         (WebCore::ScrollingTreeFrameScrollingNode::commitStateBeforeChildren):
3204         (WebCore::ScrollingTreeFrameScrollingNode::updateBeforeChildren): Deleted.
3205         * page/scrolling/ScrollingTreeFrameScrollingNode.h:
3206         * page/scrolling/ScrollingTreeNode.h:
3207         (WebCore::ScrollingTreeNode::commitStateAfterChildren):
3208         (WebCore::ScrollingTreeNode::updateAfterChildren): Deleted.
3209         * page/scrolling/ScrollingTreeScrollingNode.cpp:
3210         (WebCore::ScrollingTreeScrollingNode::commitStateBeforeChildren):
3211         (WebCore::ScrollingTreeScrollingNode::commitStateAfterChildren):
3212         (WebCore::ScrollingTreeScrollingNode::updateBeforeChildren): Deleted.
3213         (WebCore::ScrollingTreeScrollingNode::updateAfterChildren): Deleted.
3214         * page/scrolling/ScrollingTreeScrollingNode.h:
3215         * page/scrolling/ThreadedScrollingTree.cpp:
3216         (WebCore::ThreadedScrollingTree::commitTreeState):
3217         (WebCore::ThreadedScrollingTree::commitNewTreeState): Deleted.
3218         * page/scrolling/ThreadedScrollingTree.h:
3219         * page/scrolling/ios/ScrollingTreeFrameScrollingNodeIOS.h:
3220         * page/scrolling/ios/ScrollingTreeFrameScrollingNodeIOS.mm:
3221         (WebCore::ScrollingTreeFrameScrollingNodeIOS::commitStateBeforeChildren):
3222         (WebCore::ScrollingTreeFrameScrollingNodeIOS::commitStateAfterChildren):
3223         (WebCore::ScrollingTreeFrameScrollingNodeIOS::updateBeforeChildren): Deleted.
3224         (WebCore::ScrollingTreeFrameScrollingNodeIOS::updateAfterChildren): Deleted.
3225         * page/scrolling/ios/ScrollingTreeIOS.cpp:
3226         (WebCore::ScrollingTreeIOS::commitNewTreeState): Deleted.
3227         * page/scrolling/ios/ScrollingTreeIOS.h:
3228         * page/scrolling/mac/ScrollingCoordinatorMac.mm:
3229         (WebCore::ScrollingCoordinatorMac::commitTreeState):
3230         * page/scrolling/mac/ScrollingTreeFixedNode.h:
3231         * page/scrolling/mac/ScrollingTreeFixedNode.mm:
3232         (WebCore::ScrollingTreeFixedNode::commitStateBeforeChildren):
3233         (WebCore::ScrollingTreeFixedNode::updateBeforeChildren): Deleted.
3234         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h:
3235         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
3236         (WebCore::ScrollingTreeFrameScrollingNodeMac::commitStateBeforeChildren):
3237         (WebCore::ScrollingTreeFrameScrollingNodeMac::commitStateAfterChildren):
3238         (WebCore::ScrollingTreeFrameScrollingNodeMac::updateBeforeChildren): Deleted.
3239         (WebCore::ScrollingTreeFrameScrollingNodeMac::updateAfterChildren): Deleted.
3240         * page/scrolling/mac/ScrollingTreeStickyNode.h:
3241         * page/scrolling/mac/ScrollingTreeStickyNode.mm:
3242         (WebCore::ScrollingTreeStickyNode::commitStateBeforeChildren):
3243         (WebCore::ScrollingTreeStickyNode::updateBeforeChildren): Deleted.
3244
3245 2016-11-03  Anders Carlsson  <andersca@apple.com>
3246
3247         Add new 'other' Apple Pay button style
3248         https://bugs.webkit.org/show_bug.cgi?id=164384
3249         rdar://problem/28302528
3250
3251         Reviewed by Dean Jackson.
3252
3253         * DerivedSources.make:
3254         * WebCorePrefix.h:
3255         Add extension points.
3256
3257         * css/CSSPrimitiveValueMappings.h:
3258         (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
3259         Add ApplePayButtonType::Other.
3260
3261         (WebCore::CSSPrimitiveValue::operator ApplePayButtonType):
3262         Add CSSValueOther.
3263
3264         * css/CSSValueKeywords.in:
3265         Add other.
3266
3267         * css/parser/CSSParser.cpp:
3268         (WebCore::isValidKeywordPropertyAndValue):
3269         Add CSSValueOther.
3270
3271         * css/parser/CSSParserFastPaths.cpp:
3272         (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
3273         Add CSSValueOther.
3274
3275         * rendering/RenderThemeCocoa.mm:
3276         (WebCore::toPKPaymentButtonType):
3277         Handle ApplePayButtonType::Other.
3278
3279         * rendering/style/RenderStyleConstants.h:
3280         Add ApplePayButtonType::Other.
3281
3282 2016-11-04  Antti Koivisto  <antti@apple.com>
3283
3284         slotted() pseudo does not work with ID selector
3285         https://bugs.webkit.org/show_bug.cgi?id=160538
3286         <rdar://problem/28534529>
3287
3288         Reviewed by Andreas Kling.
3289
3290         When we saw an id selector while addin rules we immediately threw it into the m_idRules
3291         optimization bucket and bailed out. However selectors containing ::slotted must always end
3292         up in m_slottedPseudoElementRules list no matter what else is there.
3293
3294         Fix by treating id like other selectors and only choosing the bucket after analysing all
3295         the selector components.
3296
3297         Test: fast/shadow-dom/css-scoping-slot-with-id.html
3298
3299         * css/RuleSet.cpp:
3300         (WebCore::RuleSet::addRule): Also made this use switch instead of a series of ifs.
3301
3302 2016-11-04  Brady Eidson  <beidson@apple.com>
3303
3304         IndexedDB 2.0: Handle IDBObjectStore rename behavior properly when version change transaction aborts.
3305         https://bugs.webkit.org/show_bug.cgi?id=164416
3306
3307         Reviewed by Beth Dakin.
3308
3309         No new tests (Covered by existing tests).
3310
3311         * Modules/indexeddb/IDBObjectStore.cpp:
3312         (WebCore::IDBObjectStore::rollbackForVersionChangeAbort):
3313
3314 2016-11-04  Keith Rollin  <krollin@apple.com>
3315
3316         NetworkSession: Add NetworkDataTask implementation for blobs
3317         https://bugs.webkit.org/show_bug.cgi?id=163939
3318
3319         Reviewed by Alex Christensen.
3320
3321         * WebCore.xcodeproj/project.pbxproj: Mark HTTPParsers.h and AsyncFileStream.h as private.
3322         * fileapi/AsyncFileStream.h: Add WEBCORE_EXPORT to AsyncFileStream class.
3323         * platform/network/BlobData.h: Add WEBCORE_EXPORT to length().
3324         * platform/network/HTTPParsers.h: Add WEBCORE_EXPORT to parseRange().
3325         * platform/network/ResourceResponseBase.h: Add WEBCORE_EXPORT to setHTTPHeaderField().
3326
3327 2016-11-04  Brady Eidson  <beidson@apple.com>
3328
3329         IndexedDB 2.0: Use IDB-specific exceptions in places where the generic exceptions are currently used.
3330         https://bugs.webkit.org/show_bug.cgi?id=164406
3331
3332         Reviewed by Alex Christensen.
3333
3334         No new tests (Covered by existing tests).
3335
3336         * Modules/indexeddb/IDBIndex.cpp:
3337         (WebCore::IDBIndex::setName):
3338
3339         * Modules/indexeddb/IDBObjectStore.cpp:
3340         (WebCore::IDBObjectStore::setName):
3341
3342 2016-11-04  Joanmarie Diggs  <jdiggs@igalia.com>
3343
3344         AX: [ATK] Attempting to clear selection on ARIA listboxes results in crash
3345         https://bugs.webkit.org/show_bug.cgi?id=164331
3346
3347         Reviewed by Chris Fleizach.
3348
3349         The ATK code is using is<AccessibilityListBox>() to identify native listboxes.
3350         But is<AccessibilityListBox>() returns the value of isListBox() which returns
3351         true both for AccessibilityListBox instances as well as for AccessibilityObject
3352         instances which have an AccessibilityRole value of ListBoxRole. Because only
3353         native listboxes should be AccessibilityListBoxes, add isNativeListBox() so
3354         that we can distinguish native and ARIA listboxes.
3355
3356         Tests: accessibility/aria-listbox-clear-selection-crash.html
3357                accessibility/listbox-clear-selection.html
3358
3359         * accessibility/AccessibilityListBox.h:
3360         * accessibility/AccessibilityObject.h:
3361         (WebCore::AccessibilityObject::isNativeListBox):
3362         (WebCore::AccessibilityObject::isListBox):
3363
3364 2016-11-04  Brady Eidson  <beidson@apple.com>
3365
3366         IndexedDB 2.0: Throw the correct exceptions during IDBObjectStore/IDBIndex renaming.
3367         https://bugs.webkit.org/show_bug.cgi?id=164405
3368
3369         Reviewed by Alex Christensen.
3370
3371         No new tests (Covered by existing tests).
3372
3373         * Modules/indexeddb/IDBIndex.cpp:
3374         (WebCore::IDBIndex::setName):
3375
3376         * Modules/indexeddb/IDBObjectStore.cpp:
3377         (WebCore::IDBObjectStore::setName):
3378
3379 2016-11-04  Romain Bellessort  <romain.bellessort@crf.canon.fr>
3380
3381         [Readable Streams API] Implement ByteStreamController error()
3382         https://bugs.webkit.org/show_bug.cgi?id=164319
3383
3384         Reviewed by Youenn Fablet.
3385
3386         Implemented error() method of ReadableByteStreamController.
3387
3388         Updated test expectations for error() and added IDL-related tests.
3389
3390         * Modules/streams/ReadableByteStreamController.js:
3391         (error): Implemented.
3392         * Modules/streams/ReadableByteStreamInternals.js:
3393         (privateInitializeReadableByteStreamController):
3394         (isReadableByteStreamController): Added.
3395         (readableByteStreamControllerError): Added.
3396         (readableByteStreamControllerClearPendingPullIntos): Added.
3397         * Modules/streams/ReadableStream.js:
3398         (initializeReadableStream): More detailed error message.
3399         * Modules/streams/ReadableStreamDefaultController.js:
3400         (error): Removed unnecessary variable declaration.
3401         * bindings/js/WebCoreBuiltinNames.h: Added totalQueuedBytes.
3402
3403 2016-11-03  Brady Eidson  <beidson@apple.com>
3404
3405         IndexedDB 2.0: Handle IDBIndex rename behavior properly when version change transaction aborts.
3406         https://bugs.webkit.org/show_bug.cgi?id=164403
3407
3408         Reviewed by Alex Christensen.
3409
3410         No new tests (Covered by existing test).
3411
3412         * Modules/indexeddb/IDBIndex.cpp:
3413         (WebCore::IDBIndex::rollbackInfoForVersionChangeAbort): Only rollback the info if this index
3414           already existed before this version change transaction.
3415
3416 2016-11-03  Youenn Fablet  <youenn@apple.com>
3417
3418         [WebRTC] Introduce asynchronous backend createOffer API
3419         https://bugs.webkit.org/show_bug.cgi?id=164365
3420
3421         Reviewed by Sam Weinig.
3422
3423         Covered by existing tests.
3424
3425         Removing PeerEndpointBackendClient as it is only RTCPeerConnection.
3426         This allows removing virtual for some functions.
3427
3428         Moving MediaEndpointPeerClient::m_client to PeerEndpointBackendClient::m_peerConnection and making it a reference.
3429
3430         Implementing createOffer at PeerConnectionBackend by splitting it in four sub-functions:
3431         - main createOffer, implemented at PeerConnectionBackend.
3432         - doCreateOffer implemented by subclasses (MediaEndpointPeerConnection).
3433         - createOfferSucceeded/createOfferFailed implemented by PeerConnectionBackend.
3434
3435         * CMakeLists.txt:
3436         * Modules/mediastream/MediaEndpointPeerConnection.cpp:
3437         (WebCore::createMediaEndpointPeerConnection):
3438         (WebCore::MediaEndpointPeerConnection::MediaEndpointPeerConnection):
3439         (WebCore::MediaEndpointPeerConnection::doCreateOffer):
3440         (WebCore::MediaEndpointPeerConnection::createOfferTask):
3441         (WebCore::MediaEndpointPeerConnection::createAnswerTask):
3442         (WebCore::MediaEndpointPeerConnection::setLocalDescriptionTask):
3443         (WebCore::MediaEndpointPeerConnection::setRemoteDescriptionTask):
3444         (WebCore::MediaEndpointPeerConnection::addIceCandidateTask):
3445         (WebCore::MediaEndpointPeerConnection::createReceiver):
3446         (WebCore::MediaEndpointPeerConnection::replaceTrack):
3447         (WebCore::MediaEndpointPeerConnection::replaceTrackTask):
3448         (WebCore::MediaEndpointPeerConnection::markAsNeedingNegotiation):
3449         (WebCore::MediaEndpointPeerConnection::localDescriptionTypeValidForState):
3450         (WebCore::MediaEndpointPeerConnection::remoteDescriptionTypeValidForState):
3451         (WebCore::MediaEndpointPeerConnection::gotIceCandidate):
3452         (WebCore::MediaEndpointPeerConnection::doneGatheringCandidates):
3453         (WebCore::MediaEndpointPeerConnection::iceTransportStateChanged):
3454         (WebCore::MediaEndpointPeerConnection::createOffer): Deleted.
3455         * Modules/mediastream/MediaEndpointPeerConnection.h:
3456         * Modules/mediastream/PeerConnectionBackend.cpp:
3457         (WebCore::PeerConnectionBackend::createOffer):
3458         (WebCore::PeerConnectionBackend::createOfferSucceeded):
3459         (WebCore::PeerConnectionBackend::createOfferFailed):
3460         (WebCore::createPeerConnectionBackend): Deleted.
3461         * Modules/mediastream/PeerConnectionBackend.h:
3462         (WebCore::PeerConnectionBackend::PeerConnectionBackend):
3463         (WebCore::PeerConnectionBackendClient::~PeerConnectionBackendClient): Deleted.
3464         * Modules/mediastream/RTCPeerConnection.cpp:
3465         (WebCore::RTCPeerConnection::RTCPeerConnection):
3466         * Modules/mediastream/RTCPeerConnection.h:
3467         * WebCore.xcodeproj/project.pbxproj:
3468
3469 2016-11-03  Antti Koivisto  <antti@apple.com>
3470
3471         REGRESSION (r207717): DumpRenderTree crashed in com.apple.WebCore: WebCore::Style::Scope::flushPendingUpdate + 16
3472         https://bugs.webkit.org/show_bug.cgi?id=164397
3473         <rdar://problem/29100135>
3474
3475         Reviewed by Ryosuke Niwa.
3476
3477         The problem here was that we were leaving stale pointers to Document::m_inDocumentShadowRoots set when
3478         using fast-path document teardown.
3479
3480         (Patch and stories mostly by rniwa).
3481
3482         * dom/Document.cpp:
3483         (WebCore::Document::~Document):
3484         (WebCore::Document::didInsertInDocumentShadowRoot):
3485         (WebCore::Document::didRemoveInDocumentShadowRoot):
3486
3487             Improve asserts.
3488
3489         * dom/Element.cpp:
3490         (WebCore::Element::removeShadowRoot):
3491
3492             Remove the superfluous call to notifyChildNodeRemoved in Element::removeShadowRoot to
3493             avoid invoking notifyChildNodeRemoved during a document teardown, which is incorrect. It's sufficient that
3494             ~ShadowRoot calls ContainerNode::removeDetachedChildren(), and in turn removeDetachedChildrenInContainer()
3495             since the latter function tears down nodes via the deletion queue during a document destruction and use
3496             notifyChildNodeRemoved() on nodes that outlive the shadow root.
3497
3498         * dom/ShadowRoot.cpp:
3499         (WebCore::ShadowRoot::~ShadowRoot):
3500
3501             Take care to clean up inDocumentShadowRoots for fast-pathed destruction too.
3502
3503         (WebCore::ShadowRoot::insertedInto):
3504         (WebCore::ShadowRoot::removedFrom):
3505
3506             Improve ShadowRoot's insertedInto and removedFrom so that they only try to add and remove itself from
3507             m_inDocumentShadowRoots when the connected-ness changes.
3508
3509 2016-11-03  Simon Fraser  <simon.fraser@apple.com>
3510
3511         Give all the geometry classes a single-argument scale() function for consistency
3512         https://bugs.webkit.org/show_bug.cgi?id=164400
3513
3514         Reviewed by Zalan Bujtas.
3515
3516         Add single-argument scale() to FloatPoint, FloatQuad, FloatSize and LayoutPoint, as well
3517         as adding one to GraphicsContext. Switch callers who passed the same value for sx and sy
3518         to the new functions.
3519
3520         * dom/Document.cpp:
3521         (WebCore::Document::adjustFloatQuadsForScrollAndAbsoluteZoomAndFrameScale):
3522         * dom/MouseRelatedEvent.cpp:
3523         (WebCore::MouseRelatedEvent::init):
3524         (WebCore::MouseRelatedEvent::computeRelativePosition):
3525         * dom/TreeScope.cpp:
3526         (WebCore::TreeScope::nodeFromPoint):
3527         * page/PrintContext.cpp:
3528         (WebCore::PrintContext::spoolPage):
3529         * platform/cocoa/ThemeCocoa.mm:
3530         (WebCore::fitContextToBox):
3531         * platform/graphics/FloatPoint.h:
3532         (WebCore::FloatPoint::scale):
3533         * platform/graphics/FloatQuad.h:
3534         (WebCore::FloatQuad::scale):
3535         * platform/graphics/FloatSize.h:
3536         (WebCore::FloatSize::scale):
3537         * platform/graphics/GraphicsContext.cpp:
3538         (WebCore::GraphicsContext::applyDeviceScaleFactor):
3539         * platform/graphics/GraphicsContext.h:
3540         (WebCore::GraphicsContext::scale):
3541         * platform/graphics/LayoutPoint.h:
3542         (WebCore::LayoutPoint::scale):
3543         * platform/graphics/ca/TileCoverageMap.cpp:
3544         (WebCore::TileCoverageMap::update):
3545         * platform/graphics/ca/TileGrid.cpp:
3546         (WebCore::TileGrid::platformCALayerPaintContents):
3547         * platform/graphics/cg/ImageBufferCG.cpp:
3548         (WebCore::ImageBuffer::drawConsuming):
3549         (WebCore::ImageBuffer::draw):
3550         (WebCore::ImageBuffer::drawPattern):
3551         * platform/mac/ThemeMac.mm:
3552         (WebCore::paintToggleButton):
3553         (WebCore::paintButton):
3554         (WebCore::paintStepper):
3555         * rendering/RenderImage.cpp:
3556         (WebCore::RenderImage::nodeAtPoint):
3557         * rendering/RenderMediaControls.cpp:
3558         (WebCore::getUnzoomedRectAndAdjustCurrentContext):
3559         * rendering/RenderThemeMac.mm:
3560         (WebCore::RenderThemeMac::paintMenuList):
3561         (WebCore::RenderThemeMac::paintSliderThumb):
3562         (WebCore::RenderThemeMac::paintSearchField):
3563         (WebCore::RenderThemeMac::paintSearchFieldCancelButton):
3564         (WebCore::RenderThemeMac::paintSearchFieldResultsButton):
3565         * rendering/svg/SVGInlineTextBox.cpp:
3566         (WebCore::SVGInlineTextBox::selectionRectForTextFragment):
3567         (WebCore::SVGInlineTextBox::paintDecorationWithStyle):
3568         (WebCore::SVGInlineTextBox::paintTextWithShadows):
3569         * svg/SVGPathBlender.cpp:
3570         (WebCore::SVGPathBlender::blendAnimatedFloatPoint):
3571         (WebCore::SVGPathBlender::blendArcToSegment):
3572         * svg/SVGPathParser.cpp:
3573         (WebCore::SVGPathParser::parseCurveToCubicSmoothSegment):
3574         (WebCore::SVGPathParser::parseCurveToQuadraticSegment):
3575         (WebCore::SVGPathParser::parseCurveToQuadraticSmoothSegment):
3576         (WebCore::SVGPathParser::decomposeArcToCubic):
3577         * svg/SVGSVGElement.cpp:
3578         (WebCore::SVGSVGElement::localCoordinateSpaceTransform):
3579
3580 2016-11-03  Antti Koivisto  <antti@apple.com>
3581
3582         REGRESSION (r207669): Crash under media controls shadow root construction
3583         https://bugs.webkit.org/show_bug.cgi?id=164381
3584         <rdar://problem/28935401>
3585
3586         Reviewed by Simon Fraser.
3587
3588         The problem is that we are running a script for media control UA shadow tree in HTMLMediaElement::insertedInto.
3589         It is not safe to run scripts in insertedInto as the tree is in inconsistent state. Instead finishedInsertingSubtree
3590         callback should be used.
3591
3592         Test: media/media-controls-shadow-construction-crash.html
3593
3594         Seen on https://www.theguardian.com/artanddesign/video/2013/oct/14/banksy-central-park-new-york-video
3595
3596         * html/HTMLMediaElement.cpp:
3597         (WebCore::HTMLMediaElement::insertedInto):
3598         (WebCore::HTMLMediaElement::finishedInsertingSubtree):
3599
3600             Move configureMediaControls() to finishedInsertingSubtree().
3601
3602         * html/HTMLMediaElement.h:
3603         * style/StyleTreeResolver.cpp:
3604         (WebCore::Style::TreeResolver::resolveComposedTree):
3605
3606             Add an assert to make the bad state easier to hit in tests.
3607
3608 2016-11-03  Ryosuke Niwa  <rniwa@webkit.org>
3609
3610         Add an assertion to diagnose stress GC bots test failures
3611         https://bugs.webkit.org/show_bug.cgi?id=164396
3612
3613         Reviewed by Antti Koivisto.
3614
3615         Added an assertion for calling ElementQueue::add while ElementQueue::invokeAll is in progress.
3616         This should never happen as long as all DOM API has an appropriate CEReactions IDL attribute.
3617
3618         * dom/CustomElementReactionQueue.cpp:
3619         (WebCore::CustomElementReactionStack::ElementQueue::add):
3620         (WebCore::CustomElementReactionStack::ElementQueue::invokeAll):
3621         * dom/CustomElementReactionQueue.h:
3622
3623 2016-11-03  Said Abou-Hallawa  <sabouhallawa@apple.com>
3624
3625         Add the asynchronous image decoding mode
3626         https://bugs.webkit.org/show_bug.cgi?id=155546
3627
3628         Reviewed by Simon Fraser.
3629
3630         The asynchronous image decoding feature targets enhancing the rendering
3631         in two scenarios: the animated images and scrolling a page which large
3632         images. Enabling this feature for these two scenarios will be landed
3633         separately. 
3634
3635         The goal of the asynchronous image decoding is to have the decoded image
3636         frame ready before it has to be drawn. Drawing an image does not have to
3637         wait the image frame to be decoded.
3638
3639         * platform/graphics/BitmapImage.cpp:
3640         (WebCore::BitmapImage::frameImageAtIndex): Use the negation of frameHasValidNativeImageAtIndex().
3641         * platform/graphics/BitmapImage.h:
3642         (WebCore::BitmapImage::frameIsBeingDecodedAtIndex): Answers whether a frame is being decoded.
3643         (WebCore::BitmapImage::frameHasValidNativeImageAtIndex): Checks the validity of a frame.
3644         (WebCore::BitmapImage::frameHasInvalidNativeImageAtIndex): Deleted.
3645         * platform/graphics/Image.h:
3646         (WebCore::Image::newFrameNativeImageAvailableAtIndex): Notifies the image with the availability of a frame NativeImage.
3647         * platform/graphics/ImageFrame.h:
3648         (WebCore::ImageFrame::isBeingDecoded): Answers whether the frame is being decoded.
3649         (WebCore::ImageFrame::hasValidNativeImage): Checks the validity of the frame.
3650         (WebCore::ImageFrame::hasInvalidNativeImage): Deleted.
3651         * platform/graphics/ImageFrameCache.cpp:
3652         (WebCore::ImageFrameCache::~ImageFrameCache): Asserts the decoding loop was ended before deleting the ImageFrameCache.
3653         (WebCore::ImageFrameCache::setFrameNativeImageAtIndex): Rename this function to matches the other which take the frame index.
3654         (WebCore::ImageFrameCache::setFrameMetadataAtIndex): Ditto.
3655         (WebCore::ImageFrameCache::replaceFrameNativeImageAtIndex): It setts the ImageFrame's members and updates the decoded size.
3656         (WebCore::ImageFrameCache::cacheFrameNativeImageAtIndex): Replaces the frame NativeImage and notifies the Image with the new frame.
3657         (WebCore::ImageFrameCache::decodingQueue): Ensures the decoding WorkQueue is created and returns it.
3658         (WebCore::ImageFrameCache::startAsyncDecodingQueue): Starts a decoding WorkQueue which loops until m_frameRequestQueue is closed.
3659         (WebCore::ImageFrameCache::requestFrameAsyncDecodingAtIndex): Allows ImageSource to send a request to start asynchronous frame image decoding.
3660         (WebCore::ImageFrameCache::stopAsyncDecodingQueue): Stops the decoding WorkQueue by closing m_frameRequestQueue.
3661         (WebCore::ImageFrameCache::frameAtIndex): Call replaceFrameNativeImageAtIndex().
3662         (WebCore::ImageFrameCache::frameIsBeingDecodedAtIndex): Returns true if a request for the image frame is issued but not finished yet.
3663         (WebCore::ImageFrameCache::frameHasValidNativeImageAtIndex): Checks the validity of a frame.
3664         (WebCore::ImageFrameCache::setFrameNativeImage): Deleted. Was renamed to be setFrameNativeImageAtIndex.
3665         (WebCore::ImageFrameCache::setFrameMetadata): Deleted. Was renamed to be setFrameMetadataAtIndex
3666         (WebCore::ImageFrameCache::frameHasInvalidNativeImageAtIndex): Deleted. Was renamed to be frameHasValidNativeImageAtIndex.
3667         * platform/graphics/ImageFrameCache.h:
3668         (WebCore::ImageFrameCache::create): The decoding queue needs to hold a reference to this class so it can stop decoding safely without blocking.
3669         (WebCore::ImageFrameCache::hasDecodingQueue): Returns true if a decoding queue has started.
3670         * platform/graphics/ImageSource.cpp:
3671         (WebCore::ImageSource::ImageSource): Call ImageFrameCache::create().
3672         (WebCore::ImageSource::clear): Deleting the decoder is unnecessary for asynchronous decoding because ImageFrameCache manages all the memory.
3673         
3674         (WebCore::ImageSource::destroyDecodedData):
3675         (WebCore::ImageSource::destroyDecodedDataIfNecessary):
3676         (WebCore::ImageSource::ensureDecoderAvailable):
3677         (WebCore::ImageSource::dataChanged):
3678         (WebCore::ImageSource::isAllDataReceived):
3679         (WebCore::ImageSource::isAsyncDecodingRequired): Answers the question whether the async image decoding is required for this ImageSource.
3680         (WebCore::ImageSource::frameImageAtIndex):
3681         * platform/graphics/ImageSource.h:
3682         (WebCore::ImageSource::decodedSize):
3683         (WebCore::ImageSource::requestFrameAsyncDecodingAtIndex):
3684         (WebCore::ImageSource::stopAsyncDecodingQueue):
3685         (WebCore::ImageSource::isSizeAvailable):
3686         (WebCore::ImageSource::frameCount):
3687         (WebCore::ImageSource::repetitionCount):
3688         (WebCore::ImageSource::filenameExtension):
3689         (WebCore::ImageSource::hotSpot):
3690         (WebCore::ImageSource::size):
3691         (WebCore::ImageSource::sizeRespectingOrientation):
3692         (WebCore::ImageSource::singlePixelSolidColor):
3693         (WebCore::ImageSource::frameIsBeingDecodedAtIndex):
3694         (WebCore::ImageSource::frameIsCompleteAtIndex):
3695         (WebCore::ImageSource::frameHasAlphaAtIndex):
3696         (WebCore::ImageSource::frameHasImageAtIndex):
3697         (WebCore::ImageSource::frameSubsamplingLevelAtIndex):
3698         (WebCore::ImageSource::frameSizeAtIndex):
3699         (WebCore::ImageSource::frameBytesAtIndex):
3700         (WebCore::ImageSource::frameDurationAtIndex):
3701         (WebCore::ImageSource::frameOrientationAtIndex):
3702          Make m_frameCache a type Ref<ImageFrameCache>. Use '->' instead of '.' when accessing its members.
3703
3704         (WebCore::ImageSource::frameHasValidNativeImageAtIndex): Checks the validity of a frame.
3705         (WebCore::ImageSource::frameHasInvalidNativeImageAtIndex): Deleted. Was renamed to be frameHasValidNativeImageAtIndex.
3706
3707 2016-11-03  Myles C. Maxfield  <mmaxfield@apple.com>
3708
3709         [WebGL2] Implement getBufferSubData()
3710         https://bugs.webkit.org/show_bug.cgi?id=164111
3711
3712         Reviewed by Dean Jackson.
3713
3714         The call exists in OpenGL 3.2 but in order to have parity with
3715         OpenGL ES 3 we back it with glMapBufferRange() instead.
3716
3717         This patch simply adds surface area to GraphicsContext3D
3718         until we can get an ANGLE implementation of it.
3719
3720         When testing this patch I discovered that r207649 incorrectly
3721         interpreted arguments to bufferData() and bufferSubData() as
3722         byte offsets. Instead, they should be element indices. This
3723         patch fixes those functions to work correctly so that
3724         getBufferSubData() can be tested correctly.
3725
3726         Tests: fast/canvas/webgl/webgl2-buffers.html
3727                fast/canvas/webgl/getBufferSubData-webgl1.html
3728
3729         * html/canvas/WebGL2RenderingContext.cpp:
3730         (WebCore::arrayBufferViewElementSize):
3731         (WebCore::WebGL2RenderingContext::bufferData):
3732         (WebCore::WebGL2RenderingContext::bufferSubData):
3733         (WebCore::WebGL2RenderingContext::getBufferSubData):
3734         * html/canvas/WebGL2RenderingContext.h:
3735         * html/canvas/WebGL2RenderingContext.idl:
3736         * platform/graphics/GraphicsContext3D.h:
3737         * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
3738         (WebCore::GraphicsContext3D::getBufferSubData):
3739         (WebCore::GraphicsContext3D::mapBufferRange):
3740         (WebCore::GraphicsContext3D::unmapBuffer):
3741
3742 2016-11-03  Chris Dumez  <cdumez@apple.com>
3743
3744         Unreviewed, mark support for the 'download' attribute as 'Done'.
3745
3746         * features.json:
3747
3748 2016-11-03  Chris Dumez  <cdumez@apple.com>
3749
3750         [WK2][Cocoa] Implement user interface for HTML form validation
3751         https://bugs.webkit.org/show_bug.cgi?id=164143
3752         <rdar://problem/28944652>
3753
3754         Reviewed by Simon Fraser.
3755
3756         Add ValidationBubble class to show HTML form validation messages
3757         using native dialogs. It currently has an implementation for both
3758         Mac and iOS. It is in WebCore under platform/ so that it can be
3759         used by both WebKit1 and WebKit2.
3760
3761         Update ownership of ValidationMessageClient so that is is owned
3762         by the Page using a unique_ptr<>, which seems to be the modern
3763         way of handling lifetime for page clients.
3764
3765         Test: fast/forms/validation-messages.html
3766
3767         * WebCore.xcodeproj/project.pbxproj:
3768         * html/HTMLFormControlElement.cpp:
3769         (WebCore::HTMLFormControlElement::focusAndShowValidationMessage):
3770         * html/ValidationMessage.cpp:
3771         (WebCore::ValidationMessage::updateValidationMessage):
3772         * page/Page.cpp:
3773         (WebCore::Page::Page):
3774         (WebCore::Page::~Page):
3775         * page/Page.h:
3776         (WebCore::Page::validationMessageClient):
3777         * page/PageConfiguration.cpp:
3778         * page/PageConfiguration.h:
3779         * platform/ValidationBubble.h: Copied from Tools/DumpRenderTree/mac/UIScriptControllerMac.mm.
3780         (WebCore::ValidationBubble::message):
3781         * platform/ios/ValidationBubbleIOS.mm: Added.
3782         (-[WebValidationBubbleDelegate adaptivePresentationStyleForPresentationController:traitCollection:]):
3783         (WebCore::ValidationBubble::ValidationBubble):
3784         (WebCore::ValidationBubble::~ValidationBubble):
3785         (WebCore::ValidationBubble::show):
3786         (WebCore::ValidationBubble::setAnchorRect):
3787         * platform/mac/ValidationBubbleMac.mm: Added.
3788         (WebCore::ValidationBubble::ValidationBubble):
3789         (WebCore::ValidationBubble::~ValidationBubble):
3790         (WebCore::ValidationBubble::showRelativeTo):
3791
3792 2016-11-03  Brady Eidson  <beidson@apple.com>
3793
3794         IndexedDB 2.0: Rename IDBKeyRange.contains to IDBKeyRange.includes.
3795         https://bugs.webkit.org/show_bug.cgi?id=164383
3796
3797         Reviewed by Beth Dakin.
3798
3799         No new tests (Updated existing tests).
3800
3801         * Modules/indexeddb/IDBKeyRange.cpp:
3802         (WebCore::IDBKeyRange::includes):
3803         (WebCore::IDBKeyRange::contains): Deleted.
3804         * Modules/indexeddb/IDBKeyRange.h:
3805         * Modules/indexeddb/IDBKeyRange.idl:
3806
3807 2016-11-03  Ryan Haddad  <ryanhaddad@apple.com>
3808
3809         Unreviewed, rolling out r208302.
3810
3811         This change causes LayoutTest crashes under GuardMalloc.
3812
3813         Reverted changeset:
3814
3815         "Load stylesheets in link elements inside a connected shadow
3816         tree"
3817         https://bugs.webkit.org/show_bug.cgi?id=160683
3818         http://trac.webkit.org/changeset/208302
3819
3820 2016-11-03  Chris Dumez  <cdumez@apple.com>
3821
3822         Unreviewed, add HTML5 specification for HTML Interactive Form Validation feature.
3823
3824         * features.json:
3825
3826 2016-11-03  Chris Dumez  <cdumez@apple.com>
3827
3828         Unreviewed, add HTML Interactive Form Validation to features.json
3829
3830         * features.json:
3831
3832 2016-11-03  Yusuke Suzuki  <utatane.tea@gmail.com>
3833
3834         Unreviewed, rolling out due to crash in Amazon web site
3835         https://bugs.webkit.org/show_bug.cgi?id=164380
3836         <rdar://problem/29094221>
3837
3838         * dom/Node.idl:
3839         * domjit/JSNodeDOMJIT.cpp:
3840         (WebCore::NodeOwnerDocumentDOMJIT::checkDOM): Deleted.
3841         (WebCore::NodeOwnerDocumentDOMJIT::callDOMGetter): Deleted.
3842
3843 2016-11-03  Brady Eidson  <beidson@apple.com>
3844
3845         IndexedDB 2.0: Support binary keys.
3846         <rdar://problem/28806927> and https://bugs.webkit.org/show_bug.cgi?id=164359
3847
3848         Reviewed by Alex Christensen.
3849
3850         Tests: storage/indexeddb/modern/binary-keys-1-private.html
3851                storage/indexeddb/modern/binary-keys-1.html
3852                Changes to other existing tests.
3853
3854         * Modules/indexeddb/IDBKey.cpp:
3855         (WebCore::IDBKey::createBinary):
3856         (WebCore::IDBKey::IDBKey):
3857         (WebCore::IDBKey::compare):
3858         * Modules/indexeddb/IDBKey.h:
3859         (WebCore::IDBKey::binary):
3860         (WebCore::compareBinaryKeyData):
3861
3862         * Modules/indexeddb/IDBKeyData.cpp:
3863         (WebCore::IDBKeyData::IDBKeyData):
3864         (WebCore::IDBKeyData::maybeCreateIDBKey):
3865         (WebCore::IDBKeyData::isolatedCopy):
3866         (WebCore::IDBKeyData::encode):
3867         (WebCore::IDBKeyData::decode):
3868         (WebCore::IDBKeyData::compare):
3869         (WebCore::IDBKeyData::loggingString):
3870         (WebCore::IDBKeyData::operator==):
3871         * Modules/indexeddb/IDBKeyData.h:
3872         (WebCore::IDBKeyData::hash):
3873         (WebCore::IDBKeyData::encode):
3874         (WebCore::IDBKeyData::decode):
3875
3876         * Modules/indexeddb/IndexedDB.h: Add new enum for the new key type.
3877
3878         * bindings/js/IDBBindingUtilities.cpp:
3879         (WebCore::toJS):
3880         (WebCore::createIDBKeyFromValue):
3881
3882         * platform/ThreadSafeDataBuffer.h:
3883         (WebCore::ThreadSafeDataBufferImpl::ThreadSafeDataBufferImpl):
3884         (WebCore::ThreadSafeDataBuffer::copyData):
3885         (WebCore::ThreadSafeDataBuffer::size):
3886         (WebCore::ThreadSafeDataBuffer::operator==):
3887         (WebCore::ThreadSafeDataBuffer::ThreadSafeDataBuffer):
3888
3889 2016-11-03  Tim Horton  <timothy_horton@apple.com>
3890
3891         Printing to PDF should produce internal links when HTML has internal links
3892         https://bugs.webkit.org/show_bug.cgi?id=112081
3893         <rdar://problem/5955705>
3894
3895         Reviewed by Simon Fraser.
3896         Patch originally by David Lattimore.
3897
3898         No new tests, as it's unclear how to test PDF output.
3899
3900         * dom/Element.cpp:
3901         (WebCore::Element::findAnchorElementForLink):
3902         * dom/Element.h:
3903         Add findAnchorElementForLink, which looks up the anchor element corresponding
3904         to the current element's href, and also returns the fragment name as an out parameter.
3905
3906         * page/PrintContext.cpp:
3907         (WebCore::PrintContext::PrintContext):
3908         (WebCore::PrintContext::spoolPage):
3909         (WebCore::PrintContext::spoolRect):
3910         (WebCore::PrintContext::end):
3911         (WebCore::PrintContext::collectLinkedDestinations):
3912         (WebCore::PrintContext::outputLinkedDestinations):
3913         * rendering/RenderObject.cpp:
3914         (WebCore::RenderObject::addPDFURLRect):
3915         Plumb internal links (fragment links) through to GraphicsContext, using
3916         the fragment name from the page.
3917
3918         * page/PrintContext.h:
3919         * platform/graphics/GraphicsContext.cpp:
3920         (WebCore::GraphicsContext::supportsInternalLinks):
3921         (WebCore::GraphicsContext::setDestinationForRect):
3922         (WebCore::GraphicsContext::addDestinationAtPoint):
3923         * platform/graphics/GraphicsContext.h:
3924         * platform/graphics/cg/GraphicsContextCG.cpp:
3925         (WebCore::GraphicsContext::supportsInternalLinks):
3926         (WebCore::GraphicsContext::setDestinationForRect):
3927         (WebCore::GraphicsContext::addDestinationAtPoint):
3928         Plumb internal links through to the CGContext. Apply the CTM, because
3929         these functions expect positions in global coordinates.
3930
3931         * platform/graphics/win/GraphicsContextDirect2D.cpp:
3932         (WebCore::GraphicsContext::setURLForRect):
3933         * platform/graphics/cairo/GraphicsContextCairo.cpp:
3934         (WebCore::GraphicsContext::setURLForRect):
3935         Adjust setURLForRect to take a FloatRect, like everything else, and
3936         stop rounding.
3937
3938 2016-11-03  Alex Christensen  <achristensen@webkit.org>
3939
3940         Unreviewed, rolling out r208298.
3941         https://bugs.webkit.org/show_bug.cgi?id=163939
3942
3943         caused asan crashes
3944
3945         Reverted changeset:
3946
3947         "NetworkSession: Add NetworkDataTask implementation for blobs"
3948         https://bugs.webkit.org/show_bug.cgi?id=163939
3949         http://trac.webkit.org/changeset/208298
3950
3951 2016-11-03  Brent Fulgham  <bfulgham@apple.com>
3952
3953         [Win][Direct2D] Native Windows widgets are drawn upside-down
3954         https://bugs.webkit.org/show_bug.cgi?id=164370
3955
3956         Reviewed by Alex Christensen.
3957
3958         When we return from drawing in GDI code, we need to flip the resulting
3959         bitmap so that it draws in the proper orientation in Direct2D.
3960
3961         Tested by existing widget tests.