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