bc14d9e1f5a58e35e1de944b970599174a2f8386
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2016-06-14  Ryosuke Niwa  <rniwa@webkit.org>
2
3         Crash inside firstPositionInNode in checkLoadCompleteForThisFrame
4         https://bugs.webkit.org/show_bug.cgi?id=158724
5
6         Reviewed by Alex Christensen.
7
8         Added null checks for document and document element since they could be nullptr here.
9
10         * loader/FrameLoader.cpp:
11         (WebCore::FrameLoader::checkLoadCompleteForThisFrame):
12
13 2016-06-13  Gavin & Ellie Barraclough  <barraclough@apple.com>
14
15         Remove hasStaticPropertyTable (part 3: JSLocation::putDelegate)
16         https://bugs.webkit.org/show_bug.cgi?id=158431
17
18         Unreviewed build fix.
19
20         * bindings/js/JSLocationCustom.cpp:
21         (WebCore::JSLocation::putDelegate):
22
23 2016-06-13  Gavin & Ellie Barraclough  <barraclough@apple.com>
24
25         Remove hasStaticPropertyTable (part 4: JSHTMLDocument & JSStorage)
26         https://bugs.webkit.org/show_bug.cgi?id=158431
27
28         Reviewed by Chris Dumez.
29
30         All uses of hasStaticPropertyTable flag generated by bindings are wrong.
31
32         JSHTMLDocument & JSStorage contain a number of static_asserts claiming that
33         various methods do not support static properties. These asserts were likely
34         correct at the time they were added, as JSObject::getOwnPropertySlot and
35         JSObject::deleteProperty did not support getting / deleting static value.
36         This is no longer the case, and these asserts are now incorrect.
37
38         * bindings/js/JSHTMLDocumentCustom.cpp:
39         (WebCore::JSHTMLDocument::getOwnPropertySlot):
40         * bindings/js/JSStorageCustom.cpp:
41         (WebCore::JSStorage::deleteProperty):
42         (WebCore::JSStorage::deletePropertyByIndex):
43         (WebCore::JSStorage::putDelegate):
44             - remove incorrect static_asserts.
45
46 2016-06-13  Gavin & Ellie Barraclough  <barraclough@apple.com>
47
48         Remove hasStaticPropertyTable (part 3: JSLocation::putDelegate)
49         https://bugs.webkit.org/show_bug.cgi?id=158431
50
51         Reviewed by Geoff Garen.
52
53         All uses of hasStaticPropertyTable flag generated by bindings are wrong.
54
55         JSLocation::putDelegate checks the static property table redundantly.
56
57         In the case of same origin access, if the property is not in the static
58         table the method will call JSObject::put and return true (indicating the
59         delegate handled the put). If the property is in the static table, the
60         method will return false (indicating the the delegate did not handle the
61         access) - in which case the calling function will call JSObject::put.
62         Checking for the property in the static table is redundant - same origin
63         access does not require any special handling, and should just always
64         return false & let the caller handle the put.
65
66         In the case of cross origin access, if the property is not in the static
67         table we return true (indicating the access was handled, and silently
68         blocking it). If it is a static property, we check the name, and if the
69         name is not 'href' we also return true, silently blocking. In the case
70         that the name is 'href' we'll return false, indicating to the caller
71         that the access was not handled by the delegate, resulting in it taking
72         place. The additional check of the static table is redundant, since we
73         only have special behaviour in the case of 'href'. (Moreover it is
74         unnecesszarily fragile, since if we made a change such that 'href' was no
75         longer implemented as a static property with would fail.)
76
77         - for same origin, always return false.
78         - for cross origin, return false for 'href', otherwise return true.
79
80         * bindings/js/JSLocationCustom.cpp:
81         (WebCore::JSLocation::putDelegate):
82             - restructure & remove static table check.
83
84 2016-06-13  Gavin & Ellie Barraclough  <barraclough@apple.com>
85
86         Remove hasStaticPropertyTable (part 2: JSPluginElement)
87         https://bugs.webkit.org/show_bug.cgi?id=158431
88
89         Reviewed by Chris Dumez.
90
91         All uses of hasStaticPropertyTable flag generated by bindings are wrong.
92
93         The check in pluginElementCustomGetOwnPropertySlot was somewhat dubious in the
94         first place (for types with static properties it would give precedence to both
95         static and also property storage properties; for types without static properties
96         it would check neither - an odd asymetry in the case of values in the storage
97         array, and was depending on an implementation detail that could change).
98
99         This is all now redundant anyway. None of these types have static properties.
100         All properties are now corretcly on the prototype (which is handled appropriately
101         below). This is just dead code.
102
103         * bindings/js/JSPluginElementFunctions.h:
104         (WebCore::pluginElementCustomGetOwnPropertySlot):
105             - remove dead code.
106
107 2016-06-13  Gavin & Ellie Barraclough  <barraclough@apple.com>
108
109         Remove hasStaticPropertyTable (part 1: DOM bindings)
110         https://bugs.webkit.org/show_bug.cgi?id=158431
111
112         Reviewed by Chris Dumez.
113
114         All uses of hasStaticPropertyTable flag generated by bindings are wrong.
115
116         * bindings/js/JSDOMBinding.h:
117         (WebCore::getStaticValueSlotEntryWithoutCaching): Deleted.
118         (WebCore::getStaticValueSlotEntryWithoutCaching<JSDOMObject>): Deleted.
119             - this method is not used anywhere.
120
121 2016-06-13  Adam Bergkvist  <adam.bergkvist@ericsson.com>
122
123         WebRTC: Imlement MediaEndpointPeerConnection::replaceTrack()
124         https://bugs.webkit.org/show_bug.cgi?id=158688
125
126         Reviewed by Eric Carlson.
127
128         Implement MediaEndpointPeerConnection::replaceTrack() that is the MediaEndpoint implementation
129         of RTCRtpSender.replaceTrack() [1].
130
131         [1] https://w3c.github.io/webrtc-pc/archives/20160513/webrtc.html#dom-rtcrtpsender-replacetrack
132
133         Updated fast/mediastream/RTCRtpSender-replaceTrack.html
134
135         * Modules/mediastream/MediaEndpointPeerConnection.cpp:
136         (WebCore::MediaEndpointPeerConnection::replaceTrack):
137         (WebCore::MediaEndpointPeerConnection::replaceTrackTask):
138         Implemented.
139         * Modules/mediastream/MediaEndpointPeerConnection.h:
140         * Modules/mediastream/PeerConnectionBackend.h:
141         * Modules/mediastream/RTCPeerConnection.cpp:
142         (WebCore::RTCPeerConnection::replaceTrack):
143         * Modules/mediastream/RTCPeerConnection.h:
144         Move the MediaStreamTrack instance of sending a reference to it. This change is the main
145         reason many files are touched by this change.
146         * Modules/mediastream/RTCRtpSender.h:
147         * Modules/mediastream/RTCRtpSender.idl:
148         * platform/mediastream/MediaEndpoint.h:
149         Use mid instead of mdescIndex to identify the media description in the backend.
150         * platform/mock/MockMediaEndpoint.cpp:
151         (WebCore::MockMediaEndpoint::replaceSendSource):
152         * platform/mock/MockMediaEndpoint.h:
153
154 2016-06-13  Joseph Pecoraro  <pecoraro@apple.com>
155
156         window.onerror should pass the ErrorEvent's 'error' property as the 5th argument to the event handler
157         https://bugs.webkit.org/show_bug.cgi?id=55092
158         <rdar://problem/25731279>
159
160         Reviewed by Dean Jackson.
161
162         This includes the actual Error in window.error / ErrorEvent:
163         https://html.spec.whatwg.org/multipage/webappapis.html#the-errorevent-interface
164
165         This is useful for scripts to be able to get an error stack
166         from uncaught exceptions, by checking the error itself.
167
168         Tests: fast/events/window-onerror17.html
169                http/tests/security/cross-origin-script-error-event-redirected.html
170                http/tests/security/cross-origin-script-error-event.html
171                http/tests/security/script-crossorigin-error-event-information.html
172                http/tests/security/script-no-crossorigin-error-event-should-be-sanitized.html
173                userscripts/window-onerror-for-isolated-world-3.html
174
175         * CMakeLists.txt:
176         * WebCore.xcodeproj/project.pbxproj:
177         * bindings/js/JSBindingsAllInOne.cpp:
178         Add new custom error event file.
179
180         * bindings/js/JSDOMBinding.cpp:
181         (WebCore::reportException):
182         Include the JSC::Exception when reporting exceptions, so the error value is available.
183         
184         * bindings/js/JSErrorEventCustom.cpp:
185         (WebCore::JSErrorEvent::error):
186         Sanitized access to the ErrorEvent's error property to prevent leaking objects
187         across isolated world boundaries. This is like CustomEvent's data property.
188
189         * bindings/js/JSErrorHandler.cpp:
190         (WebCore::JSErrorHandler::handleEvent):
191         * bindings/js/JSErrorHandler.h:
192         Include the error object as the 4th argument to the window.onerror event handler.
193
194         * dom/ScriptExecutionContext.cpp:
195         (WebCore::ScriptExecutionContext::sanitizeScriptError):
196         (WebCore::ScriptExecutionContext::reportException):
197         (WebCore::ScriptExecutionContext::dispatchErrorEvent):
198         * dom/ScriptExecutionContext.h:
199         Include the error object in the ErrorEvent constructed when dispatching error events.
200
201         * dom/ErrorEvent.cpp:
202         (WebCore::ErrorEvent::ErrorEvent):
203         (WebCore::ErrorEvent::sanitizedErrorValue):
204         (WebCore::ErrorEvent::trySerializeError):
205         * dom/ErrorEvent.h:
206         * dom/ErrorEvent.idl:
207         Include an any "error" property on the ErrorEvent, and allow it in initialization.
208
209         * bindings/js/WorkerScriptController.cpp:
210         (WebCore::WorkerScriptController::evaluate):
211         * workers/WorkerMessagingProxy.cpp:
212         (WebCore::WorkerMessagingProxy::postExceptionToWorkerObject):
213         Within the Worker world, the error is included in the event.
214         When re-dispatching the error on the world object in the world that spawned the
215         Worker the event does not include an error object. This matches other browsers
216         right now, but could be improved to have the same cross world serialization
217         as isolated worlds have with the error data.
218
219         * dom/CustomEvent.h:
220         Remove unimplemented stale method.
221
222 2016-06-13  Dean Jackson  <dino@apple.com>
223
224         SVG elements don't blend correctly into HTML
225         https://bugs.webkit.org/show_bug.cgi?id=158718
226         <rdar://problem/26782004>
227
228         Reviewed by Antoine Quint.
229
230         We were not creating any transparency layers for the root SVG nodes.
231         This is ok if the SVG is the root document, because it is the backdrop.
232         However, if it is inline SVG, it needs to apply the operation in
233         order to composite into the document.
234
235         Test: svg/css/mix-blend-mode-with-inline-svg.html
236
237         * rendering/RenderLayer.cpp:
238         (WebCore::RenderLayer::beginTransparencyLayers):
239
240 2016-06-13  Brady Eidson  <beidson@apple.com>
241
242         storage/indexeddb/modern/leaks-1.html leaks the database connection handle.
243         https://bugs.webkit.org/show_bug.cgi?id=158643
244
245         Reviewed by Alex Christensen.
246
247         Tested by changes to existing test.
248
249         * Modules/indexeddb/IDBDatabase.cpp:
250         (WebCore::IDBDatabase::hasPendingActivity):
251         
252         * dom/EventTarget.h:
253         (WebCore::EventTarget::eventTargetData):
254         (WebCore::EventTarget::hasEventListeners):
255
256
257 2016-06-13  Enrica Casucci  <enrica@apple.com>
258
259         REGRESSION(r201956): Failure to initialize new internal settings produced random test failures in release.
260         https://bugs.webkit.org/show_bug.cgi?id=158713
261         rdar://26769957
262
263         Reviewed by Simon Fraser.
264
265         Failed to initialize the new member variable in both Settings and InternalSettings classes.
266
267         * page/Settings.cpp:
268         (WebCore::Settings::Settings):
269         * testing/InternalSettings.cpp:
270         (WebCore::InternalSettings::Backup::Backup):
271
272 2016-06-13  Chris Dumez  <cdumez@apple.com>
273
274         Drop HipChat hack introduced in r197548
275         https://bugs.webkit.org/show_bug.cgi?id=158711
276
277         Reviewed by Geoffrey Garen.
278
279         Drop HipChat hack introduced in r197548. This hack is no longer needed
280         as the bug was fixed in HipChat since then:
281         https://support.atlassian.com/servicedesk/customer/portal/32/HCP-7532
282
283         I have confirmed locally that the latest version (4.0.12.665) is able
284         to connect without the hack.
285
286         * bindings/js/JSLocationCustom.cpp:
287         (WebCore::JSLocation::putDelegate): Deleted.
288         * platform/RuntimeApplicationChecks.h:
289         * platform/RuntimeApplicationChecks.mm:
290         (WebCore::MacApplication::isHipChat): Deleted.
291
292 2016-06-13  Chris Fleizach  <cfleizach@apple.com>
293
294         AX: CrashTracer: com.apple.WebKit.WebContent at WebCore::AccessibilityRenderObject::remoteSVGRootElement const + 227
295         https://bugs.webkit.org/show_bug.cgi?id=158685
296
297         Reviewed by David Kilzer.
298
299         Crash reports show a null access at a line that tries to dereference a pointer. 
300         I still don't have a way to layout test this, as it seems tied to tear down of the main document.
301
302         * accessibility/AccessibilityRenderObject.cpp:
303         (WebCore::AccessibilityRenderObject::remoteSVGRootElement):
304
305 2016-06-13  Jeremy Jones  <jeremyj@apple.com>
306
307         Use two video layer solution only on mac.
308         https://bugs.webkit.org/show_bug.cgi?id=158705
309         rdar://problem/26776360
310
311         Reviewed by Jer Noble.
312
313         Two video layer solution is only useful on the mac to prevent flicker, so don't do it elsewhere.
314
315         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
316         (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayerLayer):
317
318 2016-06-13  Jeremy Jones  <jeremyj@apple.com>
319
320         Decrease PiP flicker by not removing window prematurely.
321         https://bugs.webkit.org/show_bug.cgi?id=158436
322         <rdar://problem/19052639>
323
324         Reviewed by Darin Adler.
325
326         UIWindow shouldn't be removed until cleanupFullscreen, so the video layer has a chance
327         to be reparented in the DOM first.
328
329         * platform/ios/WebVideoFullscreenInterfaceAVKit.mm:
330         (WebVideoFullscreenInterfaceAVKit::didStopPictureInPicture):
331
332 2016-06-13  Alex Christensen  <achristensen@webkit.org>
333
334         Add WebSocketProvider stub
335         https://bugs.webkit.org/show_bug.cgi?id=158702
336
337         Reviewed by Brady Eidson.
338
339         No new tests.  No change in behavior.
340
341         * WebCore.xcodeproj/project.pbxproj:
342         * dom/DocumentMarkerController.cpp:
343         * dom/ScriptedAnimationController.cpp:
344         * html/HTMLMediaElement.cpp:
345         * html/MediaDocument.cpp:
346         * html/shadow/MediaControlElements.cpp:
347         * html/shadow/MediaControls.cpp:
348         * html/shadow/MediaControls.h:
349         * html/shadow/MediaControlsApple.cpp:
350         * inspector/InspectorInstrumentation.cpp:
351         * inspector/InspectorInstrumentation.h:
352         * inspector/InspectorOverlay.cpp:
353         (WebCore::InspectorOverlay::overlayPage):
354         * loader/EmptyClients.h:
355         * loader/FrameLoader.cpp:
356         * loader/FrameLoader.h:
357         * loader/appcache/ApplicationCacheHost.cpp:
358         * loader/cache/CachedResource.cpp:
359         * page/FrameView.cpp:
360         * page/Page.cpp:
361         (WebCore::Page::Page):
362         * page/Page.h:
363         (WebCore::Page::applicationCacheStorage):
364         (WebCore::Page::databaseProvider):
365         (WebCore::Page::socketProvider):
366         (WebCore::Page::storageNamespaceProvider):
367         * page/PageConfiguration.cpp:
368         (WebCore::PageConfiguration::PageConfiguration):
369         * page/PageConfiguration.h:
370         * page/ResourceUsageOverlay.cpp:
371         * page/SocketProvider.h: Added.
372         (WebCore::SocketProvider::~SocketProvider):
373         * page/cocoa/ResourceUsageOverlayCocoa.mm:
374         * rendering/RenderElement.cpp:
375         * rendering/RenderLayerBacking.cpp:
376         * style/StyleResolveForDocument.cpp:
377         * style/StyleTreeResolver.cpp:
378         * svg/graphics/SVGImage.cpp:
379         (WebCore::SVGImage::dataChanged):
380         * testing/MockPageOverlayClient.cpp:
381
382 2016-06-13  Brady Eidson  <beidson@apple.com>
383
384         Crashes in WebCore::IDBServer::UniqueIDBDatabase::executeNextDatabaseTask.
385         <rdar://problem/26768449> and https://bugs.webkit.org/show_bug.cgi?id=158696
386
387         Reviewed by David Kilzer.
388
389         No new tests (Covered by all existing tests in Gmalloc/ASAN configs).
390
391         * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
392         (WebCore::IDBServer::UniqueIDBDatabase::executeNextDatabaseTask):
393         (WebCore::IDBServer::UniqueIDBDatabase::executeNextDatabaseTaskReply):
394
395 2016-06-13  Brady Eidson  <beidson@apple.com>
396
397         Modern IDB: IDBOpenDBRequest objects leak.
398         https://bugs.webkit.org/show_bug.cgi?id=158694
399
400         Reviewed by Alex Christensen.
401
402         No new tests (Currently have no testing strategy for guaranteeing lifetime of WebCore DOM objects)
403
404         * Modules/indexeddb/client/IDBConnectionProxy.cpp:
405         (WebCore::IDBClient::IDBConnectionProxy::completeOpenDBRequest): At this point we never need the
406             request again, so remove it from the map.
407
408 2016-06-13  Chris Dumez  <cdumez@apple.com>
409
410         Make sure HTTPHeaderMap gets a move constructor / assignment operator
411         https://bugs.webkit.org/show_bug.cgi?id=158695
412         <rdar://problem/26729511>
413
414         Reviewed by Alex Christensen.
415
416         Make sure HTTPHeaderMap gets a move constructor / assignment operator.
417         It was not getting an implicit one because of its user-declared
418         destructor. This patch drops the user-declared destructor so that
419         HTTPHeaderMap now gets an implicit move constructor / assignment
420         operator.
421
422         Not having a move constructor / assignment operator is an issue because
423         we rely on HTTPHeaderMap::isolatedCopy() / WTFMove() since r201623 to
424         pass HTTPHeaderMap across thread.
425
426         * platform/network/HTTPHeaderMap.cpp:
427         (WebCore::HTTPHeaderMap::~HTTPHeaderMap): Deleted.
428         * platform/network/HTTPHeaderMap.h:
429
430 2016-06-13  Nael Ouedraogo  <nael.ouedraogo@crf.canon.fr>
431
432         Remove useless parameter from GenerateParametersCheck signature
433         https://bugs.webkit.org/show_bug.cgi?id=158692
434
435         Reviewed by Chris Dumez.
436
437         Remove one parameter which is passed to GenerateParametersCheck
438         but never used in the caller code.
439
440         * bindings/scripts/CodeGeneratorJS.pm:
441         (GenerateImplementation):
442         (GenerateParametersCheck):
443         (GenerateConstructorDefinition):
444
445 2016-06-13  Nael Ouedraogo  <nael.ouedraogo@crf.canon.fr>
446
447         Improve code generator for functions with variadic parameters
448         https://bugs.webkit.org/show_bug.cgi?id=158529
449
450         Reviewed by Darin Adler.
451
452         JS bindings code of functions with variadic parameters is improved.
453
454         Functions with variadic parameters are skipped for ObjC and GObject code generators.
455
456         * bindings/scripts/CodeGeneratorGObject.pm:
457         (SkipFunction): Skip functions with variadic parameters.
458         * bindings/scripts/CodeGeneratorJS.pm:
459         (GenerateParametersCheck):
460         * bindings/scripts/CodeGeneratorObjC.pm:
461         (SkipFunction): Skip functions with variadic parameters.
462         * bindings/scripts/test/GObject/WebKitDOMTestObj.cpp:
463         (webkit_dom_test_obj_any): Deleted.
464         (webkit_dom_test_obj_attach_shadow_root): Deleted.
465         (webkit_dom_test_obj_get_read_only_long_attr): Deleted.
466         (webkit_dom_test_obj_get_read_only_string_attr): Deleted.
467         * bindings/scripts/test/GObject/WebKitDOMTestObj.h:
468         * bindings/scripts/test/JS/JSTestObj.cpp:
469         (WebCore::jsTestObjPrototypeFunctionOverloadedMethod12):
470         (WebCore::jsTestObjPrototypeFunctionVariadicStringMethod):
471         (WebCore::jsTestObjPrototypeFunctionVariadicDoubleMethod):
472         (WebCore::jsTestObjPrototypeFunctionVariadicNodeMethod):
473         * bindings/scripts/test/ObjC/DOMTestObj.h:
474         * bindings/scripts/test/ObjC/DOMTestObj.mm:
475
476 2016-06-12  Zalan Bujtas  <zalan@apple.com>
477
478         Cleanup RenderBlock::removePositionedObjects
479         https://bugs.webkit.org/show_bug.cgi?id=158670
480
481         Reviewed by Simon Fraser.
482
483         No change in functionality.
484
485         * rendering/RenderBlock.cpp:
486         (WebCore::RenderBlock::insertPositionedObject):
487         (WebCore::RenderBlock::removePositionedObject):
488         (WebCore::RenderBlock::removePositionedObjects):
489         * rendering/RenderBlock.h:
490
491 2016-06-12  Zalan Bujtas  <zalan@apple.com>
492
493         Remove positioned descendants when RenderBlock is no longer a containing block.
494         https://bugs.webkit.org/show_bug.cgi?id=158655
495         <rdar://problem/26510032>
496
497         Reviewed by Simon Fraser.
498
499         Normally the RenderView is the containing block for fixed positioned renderers.
500         However when a renderer acquires some transform related properties, it becomes the containing
501         block for all the fixed positioned renderers in its descendant tree.
502         When the last transform related property is removed, the renderer is no longer a containing block
503         and we need to remove all these positioned renderers from the descendant tracker map (gPositionedDescendantsMap).
504         They will be inserted back into the tracker map during the next layout (either under the RenderView or
505         under the next transformed renderer in the ancestor chain).
506
507         Test: fast/block/fixed-position-reparent-when-transition-is-removed.html
508
509         * rendering/RenderBlock.cpp:
510         (WebCore::RenderBlock::removePositionedObjectsIfNeeded):
511
512 2016-06-11  Myles C. Maxfield  <mmaxfield@apple.com>
513
514         Addressing post-review comments after r201978.
515         https://bugs.webkit.org/show_bug.cgi?id=158649
516         <rdar://problem/13258122>
517
518         Unreviewed.
519
520         * platform/graphics/FontCache.cpp:
521         (WebCore::FontCache::alternateFamilyName):
522         * platform/graphics/cocoa/FontCacheCoreText.cpp:
523         (WebCore::FontCache::platformAlternateFamilyName):
524
525 2016-06-11  Darin Adler  <darin@apple.com>
526
527         Tighten code to build set of tag names
528         https://bugs.webkit.org/show_bug.cgi?id=158662
529
530         Reviewed by Alexey Proskuryakov.
531
532         * dom/Element.cpp:
533         (WebCore::canAttachAuthorShadowRoot): Use an array of pointers that the loader
534         can initialize as part of loading the library, rather than an array that needs
535         to be initialized with code at runtime.
536
537 2016-06-11  Myles C. Maxfield  <mmaxfield@apple.com>
538
539         [Win] [EFL] Build fix after r201978.
540         https://bugs.webkit.org/show_bug.cgi?id=158649
541         <rdar://problem/13258122>
542
543         Unreviewed
544
545         * platform/graphics/freetype/FontCacheFreeType.cpp:
546         (WebCore::FontCache::platformAlternateFamilyName):
547         * platform/graphics/win/FontCacheWin.cpp:
548
549 2016-06-11  Myles C. Maxfield  <mmaxfield@apple.com>
550
551         [Cocoa] Map commonly used Chinese Windows font names to names present on Cocoa operating systems
552         https://bugs.webkit.org/show_bug.cgi?id=158649
553         <rdar://problem/13258122>
554
555         Reviewed by Darin Adler.
556
557         There are many Chinese websites which hardcode Windows font names.
558         We should map these to fonts which best match them on Cocoa operating
559         systems. We can do this by using our existing fallback font name
560         infrastructure.
561
562         Tests: fast/text/chinese-font-name-aliases-2.html
563                fast/text/chinese-font-name-aliases.html
564
565         * platform/graphics/FontCache.cpp:
566         (WebCore::FontCache::alternateFamilyName):
567         (WebCore::alternateFamilyName): Deleted.
568         * platform/graphics/FontCache.h:
569         * platform/graphics/cocoa/FontCacheCoreText.cpp:
570         (WebCore::FontCache::platformAlternateFamilyName):
571         * platform/graphics/freetype/FontCacheFreeType.cpp:
572         (WebCore::FontCache::platformAlternateFamilyName):
573         * platform/graphics/win/FontCacheWin.cpp:
574         (WebCore::FontCache::platformAlternateFamilyName):
575
576 2016-06-11  Commit Queue  <commit-queue@webkit.org>
577
578         Unreviewed, rolling out r201967, r201968, and r201972.
579         https://bugs.webkit.org/show_bug.cgi?id=158665
580
581         Caused flaky failures on IndexedDB tests (Requested by ap on
582         #webkit).
583
584         Reverted changesets:
585
586         "Vary:Cookie validation doesn't work in private browsing"
587         https://bugs.webkit.org/show_bug.cgi?id=158616
588         http://trac.webkit.org/changeset/201967
589
590         "Build fix."
591         http://trac.webkit.org/changeset/201968
592
593         "WinCairo build fix attempt."
594         http://trac.webkit.org/changeset/201972
595
596 2016-06-11  Konstantin Tokarev  <annulen@yandex.ru>
597
598         Fixed compilation of LocaleICU with ENABLE(DATE_AND_TIME_INPUT_TYPES)
599         https://bugs.webkit.org/show_bug.cgi?id=158659
600
601         Reviewed by Darin Adler.
602
603         No new tests needed.
604
605         * platform/text/LocaleICU.cpp:
606         (WebCore::getFormatForSkeleton):
607         (WebCore::LocaleICU::monthFormat):
608         (WebCore::LocaleICU::shortMonthFormat):
609
610 2016-06-11  Antti Koivisto  <antti@apple.com>
611
612         WinCairo build fix attempt.
613
614         * platform/network/NetworkStorageSession.cpp:
615         * platform/network/NetworkStorageSession.h:
616         * platform/network/NetworkStorageSessionStub.cpp:
617         (WebCore::NetworkStorageSession::NetworkStorageSession):
618         (WebCore::NetworkStorageSession::context):
619         (WebCore::NetworkStorageSession::createPrivateBrowsingSession):
620         (WebCore::NetworkStorageSession::switchToNewTestingSession):
621         (WebCore::NetworkStorageSession::~NetworkStorageSession): Deleted.
622         (WebCore::defaultSession): Deleted.
623         (WebCore::NetworkStorageSession::defaultStorageSession): Deleted.
624
625 2016-06-11  Myles C. Maxfield  <mmaxfield@apple.com>
626
627         Deleting a CSSOM style rule invalidates any previously-added FontFaces
628         https://bugs.webkit.org/show_bug.cgi?id=158450
629
630         Reviewed by Darin Adler.
631
632         This patch has two pieces: updating the CSSOM when the FontFace changes, and
633         updating the FontFace when the CSSOM changes.
634
635         1: Updating the CSSOM when the FontFace changes: CSSFontFaces already have a RefPtr
636         to their StyleRuleFontFace which represents their CSS-connection. When changing a
637         property of the CSSFontFace, we simply reach into the StyleRule and update it to
638         match. Our existing infrastructure of invalidation due to the attribute changes
639         makes sure that all the necessary updates occur.
640
641         2. Updating the FontFace when the CSSOM changes: If the CSSOM changes in a trivial
642         way (for example, a new @font-face is appended to the end of the last <style>
643         element), we can handle it directly. However, when something more invasive occurs,
644         we end up clearing the entire CSSFontSelector, and then adding all the style rules
645         from scratch. This involves three steps:
646             a) CSSFontSelector::buildStarted() is run, which means "we're about to start
647                building up all the @font-face rules from scratch." We take this opportunity
648                to purge as many fonts as possible. This is valuable because, for example,
649                this function gets run when the page gets put into the page cache, so we
650                want to destroy as much as possible. Not everything can be purged, however -
651                only CSS-connected fonts which have never been inspected by script are
652                purgeable. We don't allow fonts inspected by script to be purged because
653                purging might result in a font appearing from JavaScript to transition from
654                a success -> failure state, which we don't allow.
655             b) Upon style recalc (possibly asynchronously) CSSFontSelector::addFontFaceRule()
656                is called for each @font-face rule. We actually detect that we're in the
657                middle of a style rebuild, and defer this step.
658             c) When we're done adding all the font face rules, we call
659                CSSFontSelector::buildCompleted(). This is where we compare the newly built-
660                up list of font faces with what existed previously (as remembered in
661                CSSFontSelector::buildStarted()) in order to detect font faces which were
662                deleted from the document. Fonts which were newly added to the document
663                are handled naturally.
664                Fonts which have a property modified on them are created as if they were new.
665                However, instead of simply adding the CSSFontFace, we search for the existing
666                CSSFontFace (by CSS connection pointer) and tell the existing FontFace to
667                adopt this new CSSFontFace. This means that the JavaScript object will just
668                pick up any newly-written values in the CSSOM. It also means that the
669                "status" attribute of the JavaScript object is reset, but this is expected
670                and allowed by the spec. (For example, if you change the "src" attribute of
671                an @font-face block via the CSSOM, all bets are off when you inspect the
672                FontFace JS object representing that block.)
673
674         Test: fast/text/font-face-set-cssom.html
675
676         * css/CSSFontFace.cpp:
677         (WebCore::CSSFontFace::CSSFontFace):
678         (WebCore::CSSFontFace::setFamilies):
679         (WebCore::CSSFontFace::setStyle):
680         (WebCore::CSSFontFace::setWeight):
681         (WebCore::CSSFontFace::setUnicodeRange):
682         (WebCore::CSSFontFace::setVariantLigatures):
683         (WebCore::CSSFontFace::setVariantPosition):
684         (WebCore::CSSFontFace::setVariantCaps):
685         (WebCore::CSSFontFace::setVariantNumeric):
686         (WebCore::CSSFontFace::setVariantAlternates):
687         (WebCore::CSSFontFace::setVariantEastAsian):
688         (WebCore::CSSFontFace::setFeatureSettings):
689         (WebCore::CSSFontFace::initializeWrapper):
690         (WebCore::CSSFontFace::wrapper):
691         (WebCore::CSSFontFace::setWrapper):
692         (WebCore::CSSFontFace::purgeable):
693         (WebCore::CSSFontFace::updateStyleIfNeeded):
694         * css/CSSFontFace.h:
695         * css/CSSFontFaceSet.cpp:
696         (WebCore::CSSFontFaceSet::remove):
697         (WebCore::CSSFontFaceSet::containsCSSConnection):
698         (WebCore::CSSFontFaceSet::purge):
699         * css/CSSFontFaceSet.h:
700         * css/CSSFontSelector.cpp:
701         (WebCore::CSSFontSelector::buildStarted):
702         (WebCore::CSSFontSelector::buildCompleted):
703         (WebCore::CSSFontSelector::addFontFaceRule):
704         * css/CSSFontSelector.h:
705         * css/FontFace.cpp:
706         (WebCore::FontFace::family):
707         (WebCore::FontFace::style):
708         (WebCore::FontFace::weight):
709         (WebCore::FontFace::unicodeRange):
710         (WebCore::FontFace::variant):
711         (WebCore::FontFace::featureSettings):
712         (WebCore::FontFace::adopt):
713         * css/FontFace.h:
714
715 2016-06-11  Chris Dumez  <cdumez@apple.com>
716
717         WorkerNavigator is missing some attributes
718         https://bugs.webkit.org/show_bug.cgi?id=158593
719         <rdar://problem/26731334>
720
721         Reviewed by Darin Adler.
722
723         Add attributes that are missing on WorkerNavigator:
724         - appCodeName
725         - hardwareConcurrency
726         - language
727         - product
728         - productSub
729         - vendor
730         - vendorSub
731
732         Firefox and Chrome already expose those attributes.
733
734         Relevant specification:
735         https://html.spec.whatwg.org/multipage/workers.html#the-workernavigator-object
736
737         This patch also refactors the IDL to match the specification more
738         closely and promote sharing between Navigator and WorkerNavigator.
739
740         No new tests, updated existing test.
741
742         * CMakeLists.txt:
743         * DerivedSources.make:
744         Add new supplemental IDL files.
745
746         * page/Navigator.cpp:
747         * page/Navigator.h:
748         Moved language() / hardwareConcurrency() from Navigator to NavigatorBase
749         so that it can be used by NavigatorWorker as well.
750
751         * page/NavigatorBase.h:
752         * page/NavigatorBase.cpp:
753         (WebCore::NavigatorBase::language):
754         The implementation still calls defaultLanguage() but I updated it to be
755         thread safe on all platforms.
756
757         (WebCore::NavigatorBase::hardwareConcurrency):
758         Use std::call_once() for thread safety.
759
760         * page/Navigator.idl:
761         * page/NavigatorConcurrentHardware.idl: Copied from Source/WebCore/page/WorkerNavigator.idl.
762         * page/NavigatorID.idl: Copied from Source/WebCore/page/WorkerNavigator.idl.
763         * page/NavigatorLanguage.idl: Copied from Source/WebCore/page/WorkerNavigator.idl.
764         * page/NavigatorOnLine.idl: Copied from Source/WebCore/page/WorkerNavigator.idl.
765         * page/WorkerNavigator.idl:
766         Move several attributes to their own supplemental interfaces to match
767         the specification and promote sharing with WorkerNavigator.
768
769         * platform/Language.cpp:
770         (WebCore::userPreferredLanguages):
771         * platform/Language.h:
772         Made thread-safe on all platforms.
773
774 2016-06-11  Antti Koivisto  <antti@apple.com>
775
776         Build fix.
777
778         * platform/network/cf/NetworkStorageSessionCFNet.cpp:
779         (WebCore::NetworkStorageSession::switchToNewTestingSession):
780
781 2016-06-10  Antti Koivisto  <antti@apple.com>
782
783         Vary:Cookie validation doesn't work in private browsing
784         https://bugs.webkit.org/show_bug.cgi?id=158616
785         rdar://problem/26755067
786
787         Reviewed by Darin Adler.
788
789         This wasn't implemented because there was no way to get NetworkStorageSession from
790         a SessionID on WebCore side.
791
792         The patch adds a simple WebCore level weak map that allows getting NetworkStorageSessions
793         from SessionID. This seemed like the cleanest way to do this without a big refactoring
794         around the currently WebKit2 level SessionTracker.
795
796         * CMakeLists.txt:
797         * WebCore.xcodeproj/project.pbxproj:
798         * platform/network/CacheValidation.cpp:
799         (WebCore::headerValueForVary):
800
801             Get NetworkStorageSession from SessionID for cookies
802
803         (WebCore::verifyVaryingRequestHeaders):
804         * platform/network/NetworkStorageSession.cpp: Added.
805
806             Add platform independent .cpp for NetworkStorageSession.
807             Implement a weak map for SessionID -> NetworkStorageSession.
808
809         (WebCore::sessionsMap):
810         (WebCore::NetworkStorageSession::NetworkStorageSession):
811         (WebCore::NetworkStorageSession::~NetworkStorageSession):
812         (WebCore::NetworkStorageSession::forSessionID):
813
814             Get NetworkStorageSession for sessionID.
815
816         * platform/network/NetworkStorageSession.h:
817         (WebCore::NetworkStorageSession::sessionID):
818         (WebCore::NetworkStorageSession::credentialStorage):
819         * platform/network/cf/NetworkStorageSessionCFNet.cpp:
820         (WebCore::NetworkStorageSession::NetworkStorageSession):
821
822             Call to common constructor.
823
824         (WebCore::defaultNetworkStorageSession):
825         * platform/network/soup/NetworkStorageSessionSoup.cpp:
826         (WebCore::NetworkStorageSession::NetworkStorageSession):
827
828             Call to common constructor.
829
830         (WebCore::defaultSession):
831         (WebCore::NetworkStorageSession::~NetworkStorageSession): Deleted.
832
833 2016-06-10  Ada Chan  <adachan@apple.com>
834
835         Use the video element's video box when getting the inline video rect in WebVideoFullscreenManager
836         https://bugs.webkit.org/show_bug.cgi?id=158351
837         <rdar://problem/26567938>
838
839         Reviewed by Darin Adler.
840
841         * WebCore.xcodeproj/project.pbxproj:
842         Change the visibility of RenderVideo.h and RenderMedia.h since we'll be importing RenderVideo.h from WebKit2.
843         * rendering/RenderVideo.h:
844
845 2016-06-10  Benjamin Poulain  <bpoulain@apple.com>
846
847         Add support for passive event listeners on touch events
848         https://bugs.webkit.org/show_bug.cgi?id=158601
849
850         Reviewed by Simon Fraser.
851
852         This patch wires "passive" state of EventTarget to the delivery of touch
853         events in WebKit2.
854
855         Instead of having a NonFastScrollableRegion, we have a pair of regions
856         in EventTrackingRegions.
857         The "asynchronousDispatchRegion" tracks the area for which all event
858         listeners are passive. For those, events should be dispatched asynchronously.
859         The "synchronousDispatchRegion" tracks the area for which there is at
860         least one active event listener. Events have to be dispatched synchronously
861         for correctness.
862
863         Tests: fast/events/touch/ios/tap-with-active-listener-on-elements.html
864                fast/events/touch/ios/tap-with-active-listener-on-window.html
865                fast/events/touch/ios/tap-with-passive-listener-on-elements.html
866                fast/events/touch/ios/tap-with-passive-listener-on-window.html
867
868         * WebCore.xcodeproj/project.pbxproj:
869         * dom/Document.cpp:
870         (WebCore::Document::wheelEventHandlersChanged):
871         (WebCore::Document::Document): Deleted.
872         * dom/Document.h:
873
874         * dom/EventListenerMap.cpp:
875         (WebCore::EventListenerMap::containsActive):
876         If a Target has multiple listener for an event type, we want to know
877         if any of them is active.
878
879         * dom/EventListenerMap.h:
880         * dom/EventTarget.cpp:
881         (WebCore::EventTarget::hasActiveEventListeners):
882         (WebCore::EventTarget::hasActiveTouchEventListeners):
883         * dom/EventTarget.h:
884
885         * page/DebugPageOverlays.cpp:
886         (WebCore::NonFastScrollableRegionOverlay::updateRegion):
887         I did not change the debug overlays.
888         The NonFastScrollable area is the region for which events needs
889         synchronous dispatch. Everything else should scroll without delay.
890
891         * page/FrameView.cpp:
892         (WebCore::FrameView::scrollableAreaSetChanged):
893         * page/Page.cpp:
894         (WebCore::Page::nonFastScrollableRects):
895         * page/scrolling/AsyncScrollingCoordinator.cpp:
896         (WebCore::AsyncScrollingCoordinator::setEventTrackingRegionsDirty):
897         (WebCore::AsyncScrollingCoordinator::willCommitTree):
898         (WebCore::AsyncScrollingCoordinator::updateEventTrackingRegions):
899         (WebCore::AsyncScrollingCoordinator::frameViewLayoutUpdated):
900         (WebCore::AsyncScrollingCoordinator::frameViewEventTrackingRegionsChanged):
901         (WebCore::AsyncScrollingCoordinator::scrollingStateTreeAsText):
902         (WebCore::AsyncScrollingCoordinator::setNonFastScrollableRegionDirty): Deleted.
903         (WebCore::AsyncScrollingCoordinator::updateNonFastScrollableRegion): Deleted.
904         (WebCore::AsyncScrollingCoordinator::frameViewNonFastScrollableRegionChanged): Deleted.
905         * page/scrolling/AsyncScrollingCoordinator.h:
906         (WebCore::AsyncScrollingCoordinator::eventTrackingRegionsDirty):
907         (WebCore::AsyncScrollingCoordinator::nonFastScrollableRegionDirty): Deleted.
908
909         * page/scrolling/ScrollingCoordinator.cpp:
910         (WebCore::ScrollingCoordinator::absoluteEventTrackingRegionsForFrame):
911         (WebCore::ScrollingCoordinator::absoluteEventTrackingRegions):
912         (WebCore::ScrollingCoordinator::absoluteNonFastScrollableRegionForFrame): Deleted.
913         (WebCore::ScrollingCoordinator::absoluteNonFastScrollableRegion): Deleted.
914         I intentionally left the Wheel event with synchronous dispatch.
915         This use case will need its own set of tests.
916
917         * page/scrolling/ScrollingCoordinator.h:
918         (WebCore::ScrollingCoordinator::frameViewEventTrackingRegionsChanged):
919         (WebCore::ScrollingCoordinator::frameViewNonFastScrollableRegionChanged): Deleted.
920         * page/scrolling/ScrollingStateFrameScrollingNode.cpp:
921         (WebCore::ScrollingStateFrameScrollingNode::ScrollingStateFrameScrollingNode):
922         (WebCore::ScrollingStateFrameScrollingNode::setEventTrackingRegions):
923         (WebCore::ScrollingStateFrameScrollingNode::dumpProperties):
924         (WebCore::ScrollingStateFrameScrollingNode::setNonFastScrollableRegion): Deleted.
925         * page/scrolling/ScrollingStateFrameScrollingNode.h:
926         * page/scrolling/ScrollingTree.cpp:
927         (WebCore::ScrollingTree::shouldHandleWheelEventSynchronously):
928         (WebCore::ScrollingTree::commitNewTreeState):
929         (WebCore::ScrollingTree::eventTrackingTypeForPoint):
930         (WebCore::ScrollingTree::isPointInNonFastScrollableRegion): Deleted.
931         * page/scrolling/ScrollingTree.h:
932         * page/scrolling/mac/ScrollingCoordinatorMac.mm:
933         (WebCore::ScrollingCoordinatorMac::scheduleTreeStateCommit):
934         * platform/EventTrackingRegions.h: Added.
935         (WebCore::EventTrackingRegions::isEmpty):
936         (WebCore::EventTrackingRegions::trackingTypeForPoint):
937         (WebCore::operator==):
938
939 2016-06-10  Enrica Casucci  <enrica@apple.com>
940
941         REGRESSION(r198177): Cannot paste an image when the pasteboard format is mime type.
942         https://bugs.webkit.org/show_bug.cgi?id=158590
943         rdar://problem/25471371
944
945         Reviewed by Darin Adler.
946
947         When creating a fragment from an image resource, the resource needs to
948         be added to the document loader before setting the src attribute to the
949         image element, otherwise loading is triggered and the loading fails.
950         In r198177 the order of the operations was changed causing the bug.
951         This patch adds support to test the scenario where the image in the pasteboard
952         is available only as mime type (not WebArchive or RTFD), a situation that occurs
953         more frequently on iOS.
954
955         Test: editing/pasteboard/image-in-iframe.html
956
957         * editing/ios/EditorIOS.mm:
958         (WebCore::Editor::createFragmentForImageResourceAndAddResource):
959         * editing/mac/EditorMac.mm:
960         (WebCore::Editor::WebContentReader::readWebArchive):
961         (WebCore::Editor::WebContentReader::readRTFD):
962         (WebCore::Editor::WebContentReader::readRTF):
963         (WebCore::Editor::createFragmentForImageResourceAndAddResource):
964         * page/Settings.cpp:
965         (WebCore::Settings::setImagesEnabled):
966         (WebCore::Settings::setPreferMimeTypeForImages):
967         (WebCore::Settings::setForcePendingWebGLPolicy):
968         * page/Settings.h:
969         (WebCore::Settings::areImagesEnabled):
970         (WebCore::Settings::preferMimeTypeForImages):
971         (WebCore::Settings::arePluginsEnabled):
972         * testing/InternalSettings.cpp:
973         (WebCore::InternalSettings::Backup::restoreTo):
974         (WebCore::InternalSettings::setLangAttributeAwareFormControlUIEnabled):
975         (WebCore::InternalSettings::setPreferMimeTypeForImages):
976         (WebCore::InternalSettings::setImagesEnabled):
977         * testing/InternalSettings.h:
978         * testing/InternalSettings.idl:
979
980 2016-06-10  Alex Christensen  <achristensen@webkit.org>
981
982         Fix WinCairo build after r201943
983
984         * platform/network/curl/MultipartHandle.cpp:
985         (WebCore::MultipartHandle::didReceiveResponse):
986         * platform/network/curl/ResourceHandleManager.cpp:
987         (WebCore::handleLocalReceiveResponse):
988         (WebCore::headerCallback):
989         (WebCore::ResourceHandleManager::dispatchSynchronousJob):
990
991 2016-06-10  Alex Christensen  <achristensen@webkit.org>
992
993         handleDataURL is only used by curl
994         https://bugs.webkit.org/show_bug.cgi?id=158636
995
996         Reviewed by Tim Horton.
997
998         * CMakeLists.txt:
999         * platform/network/DataURL.cpp: Removed.
1000         * platform/network/DataURL.h: Removed.
1001         * platform/network/curl/ResourceHandleManager.cpp:
1002         (WebCore::ResourceHandleManager::startScheduledJobs):
1003         (WebCore::handleDataURL):
1004         (WebCore::ResourceHandleManager::dispatchSynchronousJob):
1005
1006 2016-06-10  Alex Christensen  <achristensen@webkit.org>
1007
1008         Reduce ResourceResponse copying
1009         https://bugs.webkit.org/show_bug.cgi?id=158232
1010
1011         Reviewed by Darin Adler.
1012
1013         No new tests.  No change in behavior except removing an unnecessary copy on cocoa platforms.
1014
1015         * loader/ResourceLoader.cpp:
1016         (WebCore::ResourceLoader::didSendData):
1017         (WebCore::ResourceLoader::didReceiveResponse):
1018         * loader/ResourceLoader.h:
1019         * loader/appcache/ApplicationCacheGroup.cpp:
1020         (WebCore::ApplicationCacheGroup::createResourceHandle):
1021         (WebCore::ApplicationCacheGroup::didReceiveResponse):
1022         * loader/appcache/ApplicationCacheGroup.h:
1023         * platform/graphics/PlatformMediaResourceLoader.h:
1024         (WebCore::PlatformMediaResourceClient::~PlatformMediaResourceClient):
1025         (WebCore::PlatformMediaResourceClient::responseReceived):
1026         (WebCore::PlatformMediaResourceClient::redirectReceived):
1027         (WebCore::PlatformMediaResourceClient::shouldCacheResponse):
1028         (WebCore::PlatformMediaResourceClient::dataSent):
1029         * platform/graphics/avfoundation/objc/WebCoreAVFResourceLoader.h:
1030         * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
1031         (ResourceHandleStreamingClient::willSendRequest):
1032         (ResourceHandleStreamingClient::didReceiveResponse):
1033         * platform/network/BlobResourceHandle.cpp:
1034         (WebCore::BlobResourceHandle::notifyResponseOnSuccess):
1035         (WebCore::BlobResourceHandle::notifyResponseOnError):
1036         (WebCore::BlobResourceHandle::notifyReceiveData):
1037         * platform/network/DataURL.cpp:
1038         (WebCore::handleDataURL):
1039         * platform/network/PingHandle.h:
1040         (WebCore::PingHandle::PingHandle):
1041         * platform/network/ResourceHandleClient.cpp:
1042         (WebCore::ResourceHandleClient::willSendRequestAsync):
1043         (WebCore::ResourceHandleClient::didReceiveResponseAsync):
1044         * platform/network/ResourceHandleClient.h:
1045         (WebCore::ResourceHandleClient::didSendData):
1046         (WebCore::ResourceHandleClient::didReceiveResponse):
1047         (WebCore::ResourceHandleClient::didReceiveData):
1048         * platform/network/ResourceResponseBase.cpp:
1049         (WebCore::ResourceResponseBase::ResourceResponseBase):
1050         (WebCore::ResourceResponseBase::includeCertificateInfo):
1051         (WebCore::ResourceResponseBase::suggestedFilename):
1052         (WebCore::ResourceResponseBase::certificateInfo): Deleted.
1053         * platform/network/ResourceResponseBase.h:
1054         (WebCore::ResourceResponseBase::certificateInfo):
1055         (WebCore::ResourceResponseBase::encode):
1056         (WebCore::ResourceResponseBase::decode):
1057         (WebCore::ResourceResponseBase::containsCertificateInfo): Deleted.
1058         * platform/network/SynchronousLoaderClient.cpp:
1059         (WebCore::SynchronousLoaderClient::canAuthenticateAgainstProtectionSpace):
1060         (WebCore::SynchronousLoaderClient::didReceiveResponse):
1061         (WebCore::SynchronousLoaderClient::didReceiveData):
1062         * platform/network/SynchronousLoaderClient.h:
1063         * platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.cpp:
1064         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::didReceiveResponse):
1065         * platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.cpp:
1066         (WebCore::SynchronousResourceHandleCFURLConnectionDelegate::didReceiveResponse):
1067         (WebCore::SynchronousResourceHandleCFURLConnectionDelegate::didReceiveData):
1068         * platform/network/mac/WebCoreResourceHandleAsDelegate.mm:
1069         (-[WebCoreResourceHandleAsDelegate connection:didReceiveResponse:]):
1070         * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm:
1071         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didReceiveResponse:]):
1072         * platform/network/soup/ResourceHandleSoup.cpp:
1073         (WebCore::nextMultipartResponsePartCallback):
1074         (WebCore::sendRequestCallback):
1075
1076 2016-06-09  Ryosuke Niwa  <rniwa@webkit.org>
1077
1078         Add SPI to disable spellchecking on auto-fillable text fields
1079         https://bugs.webkit.org/show_bug.cgi?id=158611
1080
1081         Reviewed by Anders Carlsson.
1082
1083         Added a boolean flag m_isSpellCheckingEnabled to HTMLInputElement. This flag defaults to true, and can be set
1084         to false by WebKit2 C API.
1085
1086         * editing/Editor.cpp:
1087         (WebCore::Editor::isSpellCheckingEnabledFor): Fixed a bug that we were calling isSpellCheckingEnabled on
1088         the div inside an input element's shadow tree instead of the input element itself.
1089         * html/HTMLInputElement.cpp:
1090         (WebCore::HTMLInputElement::HTMLInputElement): Initialize m_spellcheckEnabled to true (it's a bit field).
1091         (WebCore::HTMLInputElement::isSpellCheckingEnabled): Added. Return false if m_spellcheckEnabled is false.
1092         * html/HTMLInputElement.h:
1093         (WebCore::HTMLInputElement::setSpellcheckEnabled): Added.
1094
1095 2016-06-10  Alex Christensen  <achristensen@webkit.org>
1096
1097         Introduce WTF::UniqueRef
1098         https://bugs.webkit.org/show_bug.cgi?id=158596
1099
1100         Reviewed by Brady Eidson.
1101
1102         No new tests.  No change in behavior.
1103
1104         * inspector/InspectorOverlay.cpp:
1105         (WebCore::InspectorOverlay::overlayPage):
1106         * loader/EmptyClients.cpp:
1107         (WebCore::fillWithEmptyClients):
1108         * page/Page.cpp:
1109         (WebCore::Page::Page):
1110         * page/Page.h:
1111         (WebCore::Page::canStartMedia):
1112         (WebCore::Page::editorClient):
1113         (WebCore::Page::plugInClient):
1114         (WebCore::Page::mainFrame):
1115         (WebCore::Page::groupPtr): Deleted.
1116         * page/PageConfiguration.cpp:
1117         (WebCore::PageConfiguration::PageConfiguration):
1118         * page/PageConfiguration.h:
1119         * svg/graphics/SVGImage.cpp:
1120         (WebCore::SVGImage::dataChanged):
1121
1122 2016-06-10  Joseph Pecoraro  <pecoraro@apple.com>
1123
1124         Web Inspector: Cleanup InspectorIndexedDBAgent a bit
1125         https://bugs.webkit.org/show_bug.cgi?id=158598
1126
1127         Reviewed by Darin Adler.
1128
1129         * inspector/InspectorIndexedDBAgent.cpp:
1130
1131 2016-06-10  Youenn Fablet  <youenn.fablet@crf.canon.fr>
1132
1133         Origin header is not included in CORS requests for preloaded cross-origin resources
1134         https://bugs.webkit.org/show_bug.cgi?id=155761
1135         <rdar://problem/25351850>
1136
1137         Reviewed by Alex Christensen.
1138
1139         Making HTML preloader fully aware of crossorigin attribute value.
1140         Introducing CachedResourceRequest::setAsPotentiallyCrossOrigin as a helper routine to activate CORS mode.
1141         Making HTMLLinkElement and HTMLResourcePreloader use that routine.
1142         Making TokenPreloadScanner store the crossorigin attribute value in preload requests.
1143         Making TokenPreloadScanner store the crossorigin attribute value for link elements.
1144
1145         Test: http/tests/security/cross-origin-css-9.html
1146
1147         * html/HTMLLinkElement.cpp:
1148         (WebCore::HTMLLinkElement::process):
1149         * html/parser/HTMLPreloadScanner.cpp:
1150         (WebCore::TokenPreloadScanner::StartTagScanner::createPreloadRequest):
1151         (WebCore::TokenPreloadScanner::StartTagScanner::processAttribute):
1152         * html/parser/HTMLResourcePreloader.cpp:
1153         (WebCore::crossOriginModeAllowsCookies):
1154         (WebCore::PreloadRequest::resourceRequest):
1155         * html/parser/HTMLResourcePreloader.h:
1156         (WebCore::PreloadRequest::setCrossOriginMode):
1157         (WebCore::PreloadRequest::PreloadRequest): Deleted.
1158         (WebCore::PreloadRequest::resourceType): Deleted.
1159         * loader/cache/CachedResourceRequest.cpp:
1160         (WebCore::CachedResourceRequest::setAsPotentiallyCrossOrigin):
1161         * loader/cache/CachedResourceRequest.h:
1162
1163 2016-06-10  Chris Dumez  <cdumez@apple.com>
1164
1165         ErrorEvent / ProgressEvent should be exposed to workers
1166         https://bugs.webkit.org/show_bug.cgi?id=158606
1167
1168         Reviewed by Brady Eidson.
1169
1170         ErrorEvent / ProgressEvent should be exposed to workers:
1171         - https://html.spec.whatwg.org/multipage/webappapis.html#errorevent
1172         - https://xhr.spec.whatwg.org/#interface-progressevent
1173
1174         Firefox and Chrome both already expose those.
1175
1176         No new tests, rebaselined existing test.
1177
1178         * dom/ErrorEvent.idl:
1179         * dom/ProgressEvent.idl:
1180
1181 2016-06-10  Chris Dumez  <cdumez@apple.com>
1182
1183         MessagePort should be exposed to workers
1184         https://bugs.webkit.org/show_bug.cgi?id=158607
1185
1186         Reviewed by Brady Eidson.
1187
1188         MessagePort should be exposed to workers:
1189         https://html.spec.whatwg.org/multipage/comms.html#messageport
1190
1191         Firefox and Chrome both already expose it.
1192
1193         No new tests, rebaselined existing test.
1194
1195         * dom/MessagePort.idl:
1196
1197 2016-06-10  Youenn Fablet  <youenn.fablet@crf.canon.fr>
1198
1199         Move preflight check code outside of DocumentThreadableLoader
1200         https://bugs.webkit.org/show_bug.cgi?id=158425
1201
1202         Reviewed by Darin Adler.
1203
1204         Moving preflight check code in its own class.
1205         This allows code to be easier to read, use/reuse and update.
1206
1207         Behavior should be the same as before except in the case of a preflight response
1208         being a 3XX redirect response.
1209         Before this patch, the 3XX response was directly passed to the code processing regular responses.
1210         To keep compatibility with existing tests, a didFailRedirectCheck callback is called.
1211         This should be change to a preflight failure.
1212
1213         Covered by existing tests.
1214
1215         * CMakeLists.txt:
1216         * WebCore.xcodeproj/project.pbxproj:
1217         * loader/CrossOriginPreflightChecker.cpp: Added.
1218         (WebCore::CrossOriginPreflightChecker::CrossOriginPreflightChecker):
1219         (WebCore::CrossOriginPreflightChecker::~CrossOriginPreflightChecker):
1220         (WebCore::CrossOriginPreflightChecker::handleLoadingFailure):
1221         (WebCore::CrossOriginPreflightChecker::validatePreflightResponse):
1222         (WebCore::CrossOriginPreflightChecker::notifyFinished):
1223         (WebCore::CrossOriginPreflightChecker::startPreflight):
1224         (WebCore::CrossOriginPreflightChecker::doPreflight):
1225         (WebCore::CrossOriginPreflightChecker::redirectReceived):
1226         (WebCore::CrossOriginPreflightChecker::setDefersLoading):
1227         (WebCore::CrossOriginPreflightChecker::isXMLHttpRequest):
1228         * loader/CrossOriginPreflightChecker.h: Added.
1229         * loader/DocumentThreadableLoader.cpp:
1230         (WebCore::DocumentThreadableLoader::create):
1231         (WebCore::DocumentThreadableLoader::makeCrossOriginAccessRequest):
1232         (WebCore::DocumentThreadableLoader::makeCrossOriginAccessRequestWithPreflight):
1233         (WebCore::DocumentThreadableLoader::setDefersLoading):
1234         (WebCore::DocumentThreadableLoader::clearResource):
1235         (WebCore::DocumentThreadableLoader::didReceiveResponse):
1236         (WebCore::DocumentThreadableLoader::didReceiveData):
1237         (WebCore::DocumentThreadableLoader::notifyFinished):
1238         (WebCore::DocumentThreadableLoader::didFinishLoading):
1239         (WebCore::DocumentThreadableLoader::didFail):
1240         (WebCore::DocumentThreadableLoader::preflightSuccess):
1241         (WebCore::DocumentThreadableLoader::preflightFailure):
1242         (WebCore::DocumentThreadableLoader::loadRequest):
1243         (WebCore::DocumentThreadableLoader::responseReceived): Deleted.
1244         (WebCore::DocumentThreadableLoader::dataReceived): Deleted.
1245         (WebCore::DocumentThreadableLoader::isAllowedByContentSecurityPolicy): Deleted.
1246         * loader/DocumentThreadableLoader.h:
1247         (WebCore::DocumentThreadableLoader::options):
1248         (WebCore::DocumentThreadableLoader::isLoading):
1249         (WebCore::DocumentThreadableLoader::document):
1250
1251 2016-06-10  Adam Bergkvist  <adam.bergkvist@ericsson.com>
1252
1253         WebRTC: Imlement MediaEndpointPeerConnection::createAnswer()
1254         https://bugs.webkit.org/show_bug.cgi?id=158566
1255
1256         Reviewed by Eric Carlson.
1257
1258         Add the MediaEndpointPeerConnection implementation of RTCPeerConnection.createAnswer [1].
1259         createAnswer() creates a 'reply' to an remote offer set with setRemoteDescription(),
1260         completes the offer/answer dialog and brings the RTCPeerConnection back to the 'stable'
1261         signaling state.
1262
1263         [1] https://w3c.github.io/webrtc-pc/archives/20160513/webrtc.html#dom-rtcpeerconnection-createanswer
1264
1265         Test: fast/mediastream/RTCPeerConnection-inspect-answer.html
1266
1267         * Modules/mediastream/MediaEndpointPeerConnection.cpp:
1268         (WebCore::MediaEndpointPeerConnection::createOfferTask):
1269         Align creation of RTCSessionDescription with createAnswerTask.
1270         (WebCore::MediaEndpointPeerConnection::createAnswer):
1271         (WebCore::MediaEndpointPeerConnection::createAnswerTask):
1272         Add Implementation.
1273         * Modules/mediastream/MediaEndpointPeerConnection.h:
1274
1275 2016-06-08  Sergio Villar Senin  <svillar@igalia.com>
1276
1277         [css-grid] CRASH when getting the computed style of a grid with only absolutely positioned children
1278         https://bugs.webkit.org/show_bug.cgi?id=158537
1279
1280         Reviewed by Darin Adler.
1281
1282         Absolute positioning occurs after layout of the grid and its in-flow contents, and does not
1283         contribute to the sizing of any grid tracks or affect the size/configuration of the grid in
1284         any way. This means that we should treat as empty any grid whose only children are
1285         absolutely positioned items.
1286
1287         Since r201510 empty grids are no longer internally represented by a 1x1 matrix. As we were
1288         not considering grids-with-only-absolutely-positioned-children as empty, we were trying to
1289         access some invalid position in the internal representation of the grid triggering an ASSERT
1290         in debug builds and a crash in release.
1291
1292         Test: fast/css-grid-layout/grid-only-abspos-item-computed-style-crash.html
1293
1294         * css/CSSComputedStyleDeclaration.cpp:
1295         (WebCore::valueForGridTrackList):
1296
1297 2016-06-10  Chris Dumez  <cdumez@apple.com>
1298
1299         DOMException should be exposed to workers
1300         https://bugs.webkit.org/show_bug.cgi?id=158608
1301
1302         Reviewed by Alex Christensen.
1303
1304         DOMException should be exposed to workers:
1305         https://heycam.github.io/webidl/#es-DOMException-call
1306
1307         Both Firefox and Chrome expose DOMException to workers already.
1308
1309         No new tests, rebaselined existing test.
1310
1311         * dom/DOMCoreException.idl:
1312
1313 2016-06-09  Alex Christensen  <achristensen@webkit.org>
1314
1315         Fix CMake build.
1316
1317         * PlatformMac.cmake:
1318
1319 2016-06-09  Alex Christensen  <achristensen@webkit.org>
1320
1321         Fix AppleWin build after r201901.
1322         https://bugs.webkit.org/show_bug.cgi?id=119839
1323
1324         * platform/graphics/ca/win/PlatformCALayerWin.cpp:
1325         (PlatformCALayerWin::backingStoreAttached):
1326         (PlatformCALayerWin::userInteractionEnabled):
1327         (PlatformCALayerWin::setUserInteractionEnabled):
1328         (PlatformCALayerWin::geometryFlipped):
1329         * platform/graphics/ca/win/PlatformCALayerWin.h:
1330
1331 2016-06-09  Chris Fleizach  <cfleizach@apple.com>
1332
1333         AX: VoiceOver Unable to View Download Progress or Completion Status for Mail Attachments
1334         https://bugs.webkit.org/show_bug.cgi?id=158581
1335
1336         Reviewed by Darin Adler.
1337
1338         Update attachment element accessibility so that:
1339            1) the action name comes first to match UI
1340            2) on iOS, it has the updates frequently trait
1341
1342         Make sure this test now runs on iOS as well.
1343
1344         Modified tests: accessibility/attachment-element.html
1345
1346         * accessibility/AccessibilityAttachment.cpp:
1347         (WebCore::AccessibilityAttachment::accessibilityText):
1348         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
1349         (-[WebAccessibilityObjectWrapper accessibilityCanFuzzyHitTest]):
1350         (-[WebAccessibilityObjectWrapper accessibilityTraits]):
1351         (-[WebAccessibilityObjectWrapper accessibilityValue]):
1352         (-[WebAccessibilityObjectWrapper accessibilityIsAttachmentElement]):
1353         (-[WebAccessibilityObjectWrapper accessibilityIsComboBox]):
1354
1355 2016-06-09  Alex Christensen  <achristensen@webkit.org>
1356
1357         Clean up WebCore.vcxproj after switching to CMake.
1358
1359         * WebCore.vcxproj/QTMovieWin: Removed.
1360         * WebCore.vcxproj/QTMovieWin/QTMovieWinCairoDebug.props: Removed.
1361         * WebCore.vcxproj/QTMovieWin/QTMovieWinCairoRelease.props: Removed.
1362         * WebCore.vcxproj/QTMovieWin/QTMovieWinCommon.props: Removed.
1363         * WebCore.vcxproj/QTMovieWin/QTMovieWinDebug.props: Removed.
1364         * WebCore.vcxproj/QTMovieWin/QTMovieWinPostBuild.cmd: Removed.
1365         * WebCore.vcxproj/QTMovieWin/QTMovieWinPreBuild.cmd: Removed.
1366         * WebCore.vcxproj/QTMovieWin/QTMovieWinPreLink.cmd: Removed.
1367         * WebCore.vcxproj/QTMovieWin/QTMovieWinProduction.props: Removed.
1368         * WebCore.vcxproj/QTMovieWin/QTMovieWinRelease.props: Removed.
1369         * WebCore.vcxproj/xcopy.excludes: Removed.
1370
1371 2016-06-09  Zalan Bujtas  <zalan@apple.com>
1372
1373         Hairline borders do not show up on 3x displays.
1374         https://bugs.webkit.org/show_bug.cgi?id=158604
1375         <rdar://problem/26511679>
1376
1377         Reviewed by Simon Fraser.
1378
1379         On a 3x display, when we convert a 1/3px hairline border from float
1380         to LayoutUnit and pixel floor the result, we end up with a 0px width border.
1381         It's because float to LayoutUnit is lossy and since the current kFixedPointDenominator % 3 != 0,
1382         flooring LayoutUnit(1/3px) ends up being 0px. (float: 1/3 -> LayoutUnit: (1/3 - 1/kFixedPointDenominator) -> floor: 0)
1383         This patch eliminates the (unnecessary) float -> LayoutUnit - float conversion on border width.   
1384
1385         Test: fast/borders/hidpi-3x-input-hairline-border.html
1386
1387         * rendering/BorderEdge.cpp:
1388         (WebCore::BorderEdge::BorderEdge):
1389         * rendering/BorderEdge.h:
1390
1391 2016-06-09  Commit Queue  <commit-queue@webkit.org>
1392
1393         Unreviewed, rolling out r201887.
1394         https://bugs.webkit.org/show_bug.cgi?id=158610
1395
1396         This change caused LayoutTest crashes under GuardMalloc and
1397         ASan (Requested by ryanhaddad on #webkit).
1398
1399         Reverted changeset:
1400
1401         "Deleting a CSSOM style rule invalidates any previously-added
1402         FontFaces"
1403         https://bugs.webkit.org/show_bug.cgi?id=158450
1404         http://trac.webkit.org/changeset/201887
1405
1406 2016-06-09  Chris Dumez  <cdumez@apple.com>
1407
1408         Address Darin's review comment on r201898.
1409         https://bugs.webkit.org/show_bug.cgi?id=158576
1410
1411         Reviewed by Darin Adler.
1412
1413         * page/Base64Utilities.h:
1414
1415 2016-06-09  Antoine Quint  <graouts@apple.com>
1416
1417         [iOS] -webkit-overflow-scrolling: touch; ignores pointer-events: none;
1418         https://bugs.webkit.org/show_bug.cgi?id=119839
1419         <rdar://problem/9671514>
1420
1421         Reviewed by Simon Fraser.
1422
1423         Propagate a "userInteractionEnabled" flag from the Web process which is used to turn off
1424         user interaction on a UIScrollView created for -webkit-overflow-scrolling: touch.
1425
1426         Test: fast/scrolling/ios/touch-scroll-pointer-events-none.html
1427
1428         * platform/graphics/GraphicsLayer.cpp:
1429         (WebCore::GraphicsLayer::GraphicsLayer):
1430         * platform/graphics/GraphicsLayer.h:
1431         (WebCore::GraphicsLayer::userInteractionEnabled):
1432         (WebCore::GraphicsLayer::setUserInteractionEnabled):
1433         * platform/graphics/ca/GraphicsLayerCA.cpp:
1434         (WebCore::GraphicsLayerCA::setUserInteractionEnabled):
1435         (WebCore::GraphicsLayerCA::commitLayerChangesBeforeSublayers):
1436         (WebCore::GraphicsLayerCA::updateUserInteractionEnabled):
1437         * platform/graphics/ca/GraphicsLayerCA.h:
1438         * platform/graphics/ca/PlatformCALayer.h:
1439         * platform/graphics/ca/cocoa/PlatformCALayerCocoa.h:
1440         * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
1441         (PlatformCALayerCocoa::userInteractionEnabled):
1442         (PlatformCALayerCocoa::setUserInteractionEnabled):
1443         * rendering/RenderLayerBacking.cpp:
1444         (WebCore::RenderLayerBacking::updateAfterDescendants):
1445
1446 2016-06-09  Chris Dumez  <cdumez@apple.com>
1447
1448         WorkerNavigator property should exist on WorkerGlobalScope
1449         https://bugs.webkit.org/show_bug.cgi?id=158574
1450         <rdar://problem/26725108>
1451
1452         Reviewed by Darin Adler.
1453
1454         WorkerNavigator property should exist on WorkerGlobalScope:
1455         https://html.spec.whatwg.org/multipage/workers.html#the-workernavigator-object
1456
1457         Fixing this gets the number of failures on http://w3c-test.org/workers/interfaces.worker
1458         from 34 to 23.
1459
1460         No new tests, rebaselined existing test.
1461
1462         * page/WorkerNavigator.idl:
1463
1464 2016-06-09  Chris Dumez  <cdumez@apple.com>
1465
1466         atob() / btoa() API should be exposed to workers
1467         https://bugs.webkit.org/show_bug.cgi?id=158576
1468         <rdar://problem/26729340>
1469
1470         Reviewed by Sam Weinig.
1471
1472         Expose atob() / btoa() API to workers as per:
1473         https://html.spec.whatwg.org/multipage/webappapis.html#windoworworkerglobalscope
1474
1475         This aligns our behavior with Firefox and Chrome as well.
1476
1477         Test: fast/workers/atob-btoa.html
1478
1479         * CMakeLists.txt:
1480         * DerivedSources.cpp:
1481         * DerivedSources.make:
1482         * PlatformMac.cmake:
1483         * WebCore.xcodeproj/project.pbxproj:
1484         * page/Base64Utilities.cpp: Added.
1485         (WebCore::Base64Utilities::btoa):
1486         (WebCore::Base64Utilities::atob):
1487         * page/Base64Utilities.h: Added.
1488         * page/DOMWindow.cpp:
1489         (WebCore::DOMWindow::find): Deleted.
1490         (WebCore::DOMWindow::offscreenBuffering): Deleted.
1491         (WebCore::DOMWindow::outerHeight): Deleted.
1492         (WebCore::DOMWindow::outerWidth): Deleted.
1493         * page/DOMWindow.h:
1494         * page/DOMWindow.idl:
1495         * page/WindowBase64.idl: Removed.
1496         * page/WindowOrWorkerGlobalScope.idl: Renamed from Source/WebCore/page/WindowTimers.idl.
1497         * workers/WorkerGlobalScope.h:
1498         * workers/WorkerGlobalScope.idl:
1499
1500 2016-06-09  John Wilander  <wilander@apple.com>
1501
1502         Restrict HTTP/0.9 responses to default ports and cancel HTTP/0.9 resource loads if the document was loaded with another HTTP protocol
1503         https://bugs.webkit.org/show_bug.cgi?id=158589
1504         <rdar://problem/25757454>
1505
1506         Reviewed by Brent Fulgham.
1507
1508         No new tests. Our layout test environment does not allow for headerless responses
1509         nor does it allow you to set an explicit HTTP/0.9 status header in PHP. I have
1510         manually tested this change with a Python socket setup doing both headerless and
1511         HTTP/0.9 header tests for positive and negative cases.
1512
1513         * loader/DocumentLoader.cpp:
1514         (WebCore::DocumentLoader::responseReceived):
1515             Cancel loads if the request was made to a non-default port.
1516         * loader/ResourceLoader.cpp:
1517         (WebCore::ResourceLoader::didReceiveResponse):
1518             Cancel loads if the request was made to a non-default port or if the document
1519             was loaded with another protocol. Cancelation is handled as a fail so as to
1520             fire the onerror event and allow sites to handle it gracefully.
1521
1522 2016-06-09  Alex Christensen  <achristensen@webkit.org>
1523
1524         Clean up EditorClient lifetime
1525         https://bugs.webkit.org/show_bug.cgi?id=158588
1526
1527         Reviewed by Anders Carlsson.
1528
1529         No new tests.  This patch does two things, all of which do not change behavior:
1530         1. Use a std::unique_ptr<EditorClient> owned by the Page instead of allocating
1531         with new in WebKit/WebKit2 and deleting in WebEditorClient::pageDestroyed.
1532         2. Give the Page a PageConfiguration&& instead of a PageConfiguration& in its constructor.
1533
1534         * inspector/InspectorOverlay.cpp:
1535         (WebCore::InspectorOverlay::overlayPage):
1536         * loader/EmptyClients.cpp:
1537         (WebCore::fillWithEmptyClients):
1538         * loader/EmptyClients.h:
1539         (WebCore::EmptyEditorClient::EmptyEditorClient):
1540         (WebCore::EmptyEditorClient::~EmptyEditorClient):
1541         * page/EditorClient.h:
1542         (WebCore::EditorClient::~EditorClient):
1543         * page/Page.cpp:
1544         (WebCore::Page::Page):
1545         (WebCore::Page::~Page):
1546         (WebCore::Page::setViewMode):
1547         (WebCore::Page::clearUndoRedoOperations):
1548         (WebCore::Page::inLowQualityImageInterpolationMode):
1549         (WebCore::Page::invalidateStylesForAllLinks):
1550         (WebCore::Page::invalidateStylesForLink):
1551         (WebCore::Page::invalidateInjectedStyleSheetCacheInAllFrames):
1552         (WebCore::Page::setDebugger):
1553         (WebCore::Page::setIsVisibleInternal):
1554         (WebCore::Page::setAllowsMediaDocumentInlinePlayback):
1555         * page/Page.h:
1556         (WebCore::Page::canStartMedia):
1557         (WebCore::Page::editorClient):
1558         (WebCore::Page::plugInClient):
1559         (WebCore::Page::mainFrame):
1560         (WebCore::Page::group):
1561         * page/PageConfiguration.cpp:
1562         * page/PageConfiguration.h:
1563         * page/mac/PageMac.mm:
1564         (WebCore::Page::addSchedulePair):
1565         (WebCore::Page::removeSchedulePair):
1566         * svg/graphics/SVGImage.cpp:
1567         (WebCore::SVGImage::dataChanged):
1568
1569 2016-06-09  Joseph Pecoraro  <pecoraro@apple.com>
1570
1571         REGRESSION: Web Inspector: IndexedDB does not show ObjectStore data
1572         https://bugs.webkit.org/show_bug.cgi?id=158592
1573         <rdar://problem/26730696>
1574
1575         Reviewed by Timothy Hatcher.
1576
1577         * inspector/InspectorIndexedDBAgent.cpp:
1578         (WebCore::DataLoader::execute):
1579         Ensure the IDBTransaction is active when attempting to open a cursor.
1580
1581         (WebCore::OpenCursorCallback::handleEvent):
1582         End, when the cursor result is empty, like we do for script results.
1583
1584 2016-06-09  Antoine Quint  <graouts@apple.com>
1585
1586         Changing canvas height immediately after page load does not relayout canvas
1587         https://bugs.webkit.org/show_bug.cgi?id=156097
1588
1589         Reviewed by Zalan Bujtas.
1590
1591         Promote the logic use to identify whether we should perform a layout after a change of
1592         intrinsic size from RenderImage to RenderReplaced such that RenderCanvas may use it
1593         in canvasSizeChanged() and correctly update its layout in the case where the width
1594         or height attribute is updated and there are no explicit sizing performed with CSS.
1595         Additionally, this will also account for the object-fix property to only perform
1596         a layout if necessary.
1597
1598         Test: fast/canvas/canvas-css-size-after-height-change-with-display-flex.html
1599
1600         * rendering/RenderHTMLCanvas.cpp:
1601         (WebCore::RenderHTMLCanvas::canvasSizeChanged):
1602         * rendering/RenderImage.cpp:
1603         (WebCore::RenderImage::repaintOrMarkForLayout):
1604         * rendering/RenderReplaced.cpp:
1605         (WebCore::RenderReplaced::setNeedsLayoutIfNeededAfterIntrinsicSizeChange):
1606         * rendering/RenderReplaced.h:
1607
1608 2016-06-09  Myles C. Maxfield  <mmaxfield@apple.com>
1609
1610         Deleting a CSSOM style rule invalidates any previously-added FontFaces
1611         https://bugs.webkit.org/show_bug.cgi?id=158450
1612
1613         Reviewed by Darin Adler.
1614
1615         This patch has two pieces: updating the CSSOM when the FontFace changes, and
1616         updating the FontFace when the CSSOM changes.
1617
1618         1: Updating the CSSOM when the FontFace changes: CSSFontFaces already have a RefPtr
1619         to their StyleRuleFontFace which represents their CSS-connection. When changing a
1620         property of the CSSFontFace, we simply reach into the StyleRule and update it to
1621         match. Our existing infrastructure of invalidation due to the attribute changes
1622         makes sure that all the necessary updates occur.
1623
1624         2. Updating the FontFace when the CSSOM changes: If the CSSOM changes in a trivial
1625         way (for example, a new @font-face is appended to the end of the last <style>
1626         element), we can handle it directly. However, when something more invasive occurs,
1627         we end up clearing the entire CSSFontSelector, and then adding all the style rules
1628         from scratch. This involves three steps:
1629             a) CSSFontSelector::buildStarted() is run, which means "we're about to start
1630                building up all the @font-face rules from scratch." We take this opportunity
1631                to purge as many fonts as possible. This is valuable because, for example,
1632                this function gets run when the page gets put into the page cache, so we
1633                want to destroy as much as possible. Not everything can be purged, however -
1634                only CSS-connected fonts which have never been inspected by script are
1635                purgeable. We don't allow fonts inspected by script to be purged because
1636                purging might result in a font appearing from JavaScript to transition from
1637                a success -> failure state, which we don't allow.
1638             b) Upon style recalc (possibly asynchronously) CSSFontSelector::addFontFaceRule()
1639                is called for each @font-face rule. We actually detect that we're in the
1640                middle of a style rebuild, and defer this step.
1641             c) When we're done adding all the font face rules, we call
1642                CSSFontSelector::buildCompleted(). This is where we compare the newly built-
1643                up list of font faces with what existed previously (as remembered in
1644                CSSFontSelector::buildStarted()) in order to detect font faces which were
1645                deleted from the document. Fonts which were newly added to the document
1646                are handled naturally.
1647                Fonts which have a property modified on them are created as if they were new.
1648                However, instead of simply adding the CSSFontFace, we search for the existing
1649                CSSFontFace (by CSS connection pointer) and tell the existing FontFace to
1650                adopt this new CSSFontFace. This means that the JavaScript object will just
1651                pick up any newly-written values in the CSSOM. It also means that the
1652                "status" attribute of the JavaScript object is reset, but this is expected
1653                and allowed by the spec. (For example, if you change the "src" attribute of
1654                an @font-face block via the CSSOM, all bets are off when you inspect the
1655                FontFace JS object representing that block.)
1656
1657         Test: fast/text/font-face-set-cssom.html
1658
1659         * css/CSSFontFace.cpp:
1660         (WebCore::CSSFontFace::CSSFontFace):
1661         (WebCore::CSSFontFace::setFamilies):
1662         (WebCore::CSSFontFace::setStyle):
1663         (WebCore::CSSFontFace::setWeight):
1664         (WebCore::CSSFontFace::setUnicodeRange):
1665         (WebCore::CSSFontFace::setVariantLigatures):
1666         (WebCore::CSSFontFace::setVariantPosition):
1667         (WebCore::CSSFontFace::setVariantCaps):
1668         (WebCore::CSSFontFace::setVariantNumeric):
1669         (WebCore::CSSFontFace::setVariantAlternates):
1670         (WebCore::CSSFontFace::setVariantEastAsian):
1671         (WebCore::CSSFontFace::setFeatureSettings):
1672         (WebCore::CSSFontFace::initializeWrapper):
1673         (WebCore::CSSFontFace::wrapper):
1674         (WebCore::CSSFontFace::setWrapper):
1675         (WebCore::CSSFontFace::purgeable):
1676         (WebCore::CSSFontFace::updateStyleIfNeeded):
1677         * css/CSSFontFace.h:
1678         * css/CSSFontFaceSet.cpp:
1679         (WebCore::CSSFontFaceSet::remove):
1680         (WebCore::CSSFontFaceSet::containsCSSConnection):
1681         (WebCore::CSSFontFaceSet::purge):
1682         * css/CSSFontFaceSet.h:
1683         * css/CSSFontSelector.cpp:
1684         (WebCore::CSSFontSelector::buildStarted):
1685         (WebCore::CSSFontSelector::buildCompleted):
1686         (WebCore::CSSFontSelector::addFontFaceRule):
1687         * css/CSSFontSelector.h:
1688         * css/FontFace.cpp:
1689         (WebCore::FontFace::family):
1690         (WebCore::FontFace::style):
1691         (WebCore::FontFace::weight):
1692         (WebCore::FontFace::unicodeRange):
1693         (WebCore::FontFace::variant):
1694         (WebCore::FontFace::featureSettings):
1695         (WebCore::FontFace::adopt):
1696         * css/FontFace.h:
1697
1698 2016-06-09  Andy Estes  <aestes@apple.com>
1699
1700         Define printing{Minimum,Maximum}ShrinkFactor in only one place
1701         https://bugs.webkit.org/show_bug.cgi?id=158580
1702
1703         Reviewed by Tim Horton.
1704
1705         * page/PrintContext.cpp: Removed printingMinimumShrinkFactor and printingMaximumShrinkFactor.
1706         (WebCore::PrintContext::begin): Used minimumShrinkFactor() and maximumShrinkFactor() instead
1707         of printingMinimumShrinkFactor and printingMaximumShrinkFactor.
1708         (WebCore::PrintContext::computeAutomaticScaleFactor): Ditto.
1709         * page/PrintContext.h:
1710         (WebCore::PrintContext::minimumShrinkFactor): Added to return the same value as
1711         printingMinimumShrinkFactor.
1712         (WebCore::PrintContext::maximumShrinkFactor): Added to return the same value as
1713         printingMaximumShrinkFactor.
1714
1715 2016-06-09  Eric Carlson  <eric.carlson@apple.com>
1716
1717         Don't show the caption menu if a video has only forced tracks
1718         https://bugs.webkit.org/show_bug.cgi?id=158573
1719         <rdar://problem/24632384>
1720
1721         Reviewed by Jer Noble.
1722
1723         Test: media/controls/forced-tracks-only.html
1724
1725         * Modules/mediacontrols/mediaControlsApple.js:
1726         (Controller.prototype.updateCaptionButton): Don't show the button of there are no user-selectable
1727           text or audio tracks.
1728
1729         * page/CaptionUserPreferencesMediaAF.cpp:
1730         (WebCore::CaptionUserPreferencesMediaAF::sortedTrackListForMenu): Return an empty Vector if
1731           there are no user-selectable tracks.
1732
1733 2016-06-09  Jer Noble  <jer.noble@apple.com>
1734
1735         Pass through play state and toggle state to the WebPlaybackControlsManager
1736         https://bugs.webkit.org/show_bug.cgi?id=158578
1737         <rdar://problem/25045616>
1738
1739         Reviewed by Beth Dakin.
1740
1741         Pass through the isPlaying portion of setRate() and allow toggling when a model is present.
1742
1743         * platform/mac/WebPlaybackControlsManager.h:
1744         * platform/mac/WebPlaybackControlsManager.mm:
1745         * platform/mac/WebPlaybackSessionInterfaceMac.mm:
1746         (WebCore::WebPlaybackSessionInterfaceMac::setRate):
1747         (WebCore::WebPlaybackSessionInterfaceMac::setPlayBackControlsManager):
1748
1749 2016-06-09  Frederic Wang  <fred.wang@free.fr>
1750
1751         RenderMathOperator: Move calculation of preferred width into MathOperator
1752         https://bugs.webkit.org/show_bug.cgi?id=157071
1753
1754         Reviewed by Brent Fulgham.
1755
1756         No new tests, behavior is not change.
1757
1758         * rendering/mathml/MathOperator.cpp:
1759         (WebCore::MathOperator::setOperator): Introduce a style parameter and call reset.
1760         (WebCore::MathOperator::reset): New helper function to reset the operator.
1761         For now we only set the width of the base glyph and the preferred max width.
1762         (WebCore::MathOperator::calculateDisplayStyleLargeOperator): Calculate the m_maxPreferredWidth.
1763         (WebCore::MathOperator::calculateStretchyData): Change the signature of the function and directly set m_maxPreferredWidth.
1764         * rendering/mathml/MathOperator.h: Add m_maxPreferredWidth member and update some declarations.
1765         (WebCore::MathOperator::width): New helper function.
1766         (WebCore::MathOperator::maxPreferredWidth): New helper function.
1767         * rendering/mathml/RenderMathMLOperator.cpp:
1768         (WebCore::RenderMathMLOperator::computePreferredLogicalWidths): This function performs wrong
1769         operations that will be fixed in bug 152244 when we update the tests.
1770         For now, let's just use maxPreferredWidth() for non-horizontal operators.
1771         (WebCore::RenderMathMLOperator::updateStyle): Use the new signature of the functions.
1772
1773 2016-06-09  Alex Christensen  <achristensen@webkit.org>
1774
1775         Clean up WebSocket code
1776         https://bugs.webkit.org/show_bug.cgi?id=158551
1777
1778         Reviewed by Darin Adler.
1779
1780         No new tests.  There is no change in behavior.
1781         There seems to be no reason why SocketStreamHandle should be an AuthenticationClient.
1782
1783         * Modules/websockets/ThreadableWebSocketChannel.h:
1784         * Modules/websockets/ThreadableWebSocketChannelClientWrapper.cpp:
1785         (WebCore::ThreadableWebSocketChannelClientWrapper::setSendRequestResult):
1786         (WebCore::ThreadableWebSocketChannelClientWrapper::bufferedAmount):
1787         (WebCore::ThreadableWebSocketChannelClientWrapper::setBufferedAmount):
1788         (WebCore::ThreadableWebSocketChannelClientWrapper::didReceiveBinaryData):
1789         (WebCore::ThreadableWebSocketChannelClientWrapper::didUpdateBufferedAmount):
1790         (WebCore::ThreadableWebSocketChannelClientWrapper::didStartClosingHandshake):
1791         (WebCore::ThreadableWebSocketChannelClientWrapper::didClose):
1792         * Modules/websockets/ThreadableWebSocketChannelClientWrapper.h:
1793         * Modules/websockets/WebSocket.cpp:
1794         (WebCore::joinStrings):
1795         (WebCore::saturateAdd):
1796         (WebCore::WebSocket::send):
1797         (WebCore::WebSocket::readyState):
1798         (WebCore::WebSocket::bufferedAmount):
1799         (WebCore::WebSocket::didReceiveBinaryData):
1800         (WebCore::WebSocket::didReceiveMessageError):
1801         (WebCore::WebSocket::didUpdateBufferedAmount):
1802         (WebCore::WebSocket::didStartClosingHandshake):
1803         (WebCore::WebSocket::didClose):
1804         * Modules/websockets/WebSocket.h:
1805         * Modules/websockets/WebSocketChannel.cpp:
1806         (WebCore::WebSocketChannel::WebSocketChannel):
1807         (WebCore::WebSocketChannel::~WebSocketChannel):
1808         (WebCore::WebSocketChannel::send):
1809         (WebCore::WebSocketChannel::bufferedAmount):
1810         (WebCore::WebSocketChannel::resume):
1811         (WebCore::WebSocketChannel::willOpenSocketStream):
1812         (WebCore::WebSocketChannel::didOpenSocketStream):
1813         (WebCore::WebSocketChannel::didCloseSocketStream):
1814         (WebCore::WebSocketChannel::didReceiveSocketStreamData):
1815         (WebCore::WebSocketChannel::didUpdateBufferedAmount):
1816         (WebCore::WebSocketChannel::didFailSocketStream):
1817         (WebCore::WebSocketChannel::didStartLoading):
1818         (WebCore::WebSocketChannel::appendToBuffer):
1819         (WebCore::WebSocketChannel::processBuffer):
1820         (WebCore::WebSocketChannel::resumeTimerFired):
1821         (WebCore::WebSocketChannel::startClosingHandshake):
1822         (WebCore::WebSocketChannel::didReceiveAuthenticationChallenge): Deleted.
1823         (WebCore::WebSocketChannel::didCancelAuthenticationChallenge): Deleted.
1824         * Modules/websockets/WebSocketChannel.h:
1825         * Modules/websockets/WebSocketChannelClient.h:
1826         (WebCore::WebSocketChannelClient::~WebSocketChannelClient):
1827         (WebCore::WebSocketChannelClient::didConnect):
1828         (WebCore::WebSocketChannelClient::didReceiveMessage):
1829         (WebCore::WebSocketChannelClient::didReceiveBinaryData):
1830         (WebCore::WebSocketChannelClient::didReceiveMessageError):
1831         (WebCore::WebSocketChannelClient::didUpdateBufferedAmount):
1832         (WebCore::WebSocketChannelClient::didStartClosingHandshake):
1833         (WebCore::WebSocketChannelClient::didClose):
1834         (WebCore::WebSocketChannelClient::WebSocketChannelClient):
1835         * Modules/websockets/WorkerThreadableWebSocketChannel.cpp:
1836         (WebCore::WorkerThreadableWebSocketChannel::send):
1837         (WebCore::WorkerThreadableWebSocketChannel::bufferedAmount):
1838         (WebCore::WorkerThreadableWebSocketChannel::Peer::bufferedAmount):
1839         (WebCore::WorkerThreadableWebSocketChannel::Peer::didReceiveBinaryData):
1840         (WebCore::WorkerThreadableWebSocketChannel::Peer::didUpdateBufferedAmount):
1841         (WebCore::WorkerThreadableWebSocketChannel::Peer::didStartClosingHandshake):
1842         (WebCore::WorkerThreadableWebSocketChannel::Peer::didClose):
1843         (WebCore::WorkerThreadableWebSocketChannel::Bridge::send):
1844         (WebCore::WorkerThreadableWebSocketChannel::Bridge::bufferedAmount):
1845         * Modules/websockets/WorkerThreadableWebSocketChannel.h:
1846         * platform/network/BlobData.cpp:
1847         (WebCore::BlobData::appendData):
1848         (WebCore::BlobData::appendFile):
1849         * platform/network/BlobData.h:
1850         (WebCore::BlobDataItem::BlobDataItem):
1851         * platform/network/BlobRegistry.h:
1852         * platform/network/BlobRegistryImpl.cpp:
1853         (WebCore::BlobRegistryImpl::appendStorageItems):
1854         (WebCore::BlobRegistryImpl::registerFileBlobURL):
1855         (WebCore::BlobRegistryImpl::registerBlobURL):
1856         (WebCore::BlobRegistryImpl::registerBlobURLOptionallyFileBacked):
1857         (WebCore::BlobRegistryImpl::registerBlobURLForSlice):
1858         * platform/network/BlobRegistryImpl.h:
1859         * platform/network/SocketStreamHandleBase.cpp:
1860         (WebCore::SocketStreamHandleBase::send):
1861         (WebCore::SocketStreamHandleBase::disconnect):
1862         (WebCore::SocketStreamHandleBase::sendPendingData):
1863         * platform/network/SocketStreamHandleBase.h:
1864         * platform/network/SocketStreamHandleClient.h:
1865         (WebCore::SocketStreamHandleClient::~SocketStreamHandleClient):
1866         (WebCore::SocketStreamHandleClient::willOpenSocketStream):
1867         (WebCore::SocketStreamHandleClient::didOpenSocketStream):
1868         (WebCore::SocketStreamHandleClient::didCloseSocketStream):
1869         (WebCore::SocketStreamHandleClient::didReceiveSocketStreamData):
1870         (WebCore::SocketStreamHandleClient::didUpdateBufferedAmount):
1871         (WebCore::SocketStreamHandleClient::didFailSocketStream):
1872         (WebCore::SocketStreamHandleClient::didReceiveAuthenticationChallenge): Deleted.
1873         (WebCore::SocketStreamHandleClient::didCancelAuthenticationChallenge): Deleted.
1874         * platform/network/cf/SocketStreamHandle.h:
1875         (WebCore::SocketStreamHandle::create):
1876         (WebCore::SocketStreamHandle::refAuthenticationClient): Deleted.
1877         (WebCore::SocketStreamHandle::derefAuthenticationClient): Deleted.
1878         * platform/network/cf/SocketStreamHandleCFNet.cpp:
1879         (WebCore::SocketStreamHandle::SocketStreamHandle):
1880         (WebCore::SocketStreamHandle::addCONNECTCredentials):
1881         (WebCore::SocketStreamHandle::copyCFStreamDescription):
1882         (WebCore::SocketStreamHandle::readStreamCallback):
1883         (WebCore::SocketStreamHandle::writeStreamCallback):
1884         (WebCore::SocketStreamHandle::reportErrorToClient):
1885         (WebCore::SocketStreamHandle::~SocketStreamHandle):
1886         (WebCore::SocketStreamHandle::platformClose):
1887         (WebCore::SocketStreamHandle::port):
1888         (WebCore::SocketStreamHandle::receivedCredential): Deleted.
1889         (WebCore::SocketStreamHandle::receivedRequestToContinueWithoutCredential): Deleted.
1890         (WebCore::SocketStreamHandle::receivedCancellation): Deleted.
1891         (WebCore::SocketStreamHandle::receivedRequestToPerformDefaultHandling): Deleted.
1892         (WebCore::SocketStreamHandle::receivedChallengeRejection): Deleted.
1893         * platform/network/curl/ResourceHandleCurl.cpp:
1894         * platform/network/curl/SocketStreamHandle.h:
1895         (WebCore::SocketStreamHandle::SocketData::SocketData):
1896         * platform/network/curl/SocketStreamHandleCurl.cpp:
1897         (WebCore::SocketStreamHandle::platformClose):
1898         (WebCore::SocketStreamHandle::readData):
1899         (WebCore::SocketStreamHandle::didReceiveData):
1900         (WebCore::SocketStreamHandle::didOpenSocket):
1901         (WebCore::SocketStreamHandle::createCopy):
1902         (WebCore::SocketStreamHandle::didReceiveAuthenticationChallenge): Deleted.
1903         (WebCore::SocketStreamHandle::receivedCredential): Deleted.
1904         (WebCore::SocketStreamHandle::receivedRequestToContinueWithoutCredential): Deleted.
1905         (WebCore::SocketStreamHandle::receivedCancellation): Deleted.
1906         (WebCore::SocketStreamHandle::receivedRequestToPerformDefaultHandling): Deleted.
1907         (WebCore::SocketStreamHandle::receivedChallengeRejection): Deleted.
1908         * platform/network/soup/SocketStreamHandle.h:
1909         (WebCore::SocketStreamHandle::create):
1910         * platform/network/soup/SocketStreamHandleSoup.cpp:
1911         (WebCore::getHandleFromId):
1912         (WebCore::deactivateHandle):
1913         (WebCore::activateHandle):
1914         (WebCore::SocketStreamHandle::SocketStreamHandle):
1915         (WebCore::SocketStreamHandle::~SocketStreamHandle):
1916         (WebCore::SocketStreamHandle::connected):
1917         (WebCore::SocketStreamHandle::readBytes):
1918         (WebCore::SocketStreamHandle::platformSend):
1919         (WebCore::SocketStreamHandle::platformClose):
1920         (WebCore::SocketStreamHandle::beginWaitingForSocketWritability):
1921         (WebCore::SocketStreamHandle::didReceiveAuthenticationChallenge): Deleted.
1922         (WebCore::SocketStreamHandle::receivedCredential): Deleted.
1923         (WebCore::SocketStreamHandle::receivedRequestToContinueWithoutCredential): Deleted.
1924         (WebCore::SocketStreamHandle::receivedCancellation): Deleted.
1925         (WebCore::SocketStreamHandle::receivedRequestToPerformDefaultHandling): Deleted.
1926         (WebCore::SocketStreamHandle::receivedChallengeRejection): Deleted.
1927
1928 2016-06-09  Commit Queue  <commit-queue@webkit.org>
1929
1930         Unreviewed, rolling out r201815.
1931         https://bugs.webkit.org/show_bug.cgi?id=158570
1932
1933         This broke the cmake build. (Requested by lforschler on
1934         #webkit).
1935
1936         Reverted changeset:
1937
1938         "Teach cmake about libWebKitSystemInterfaceOSX10.12"
1939         http://trac.webkit.org/changeset/201815
1940
1941 2016-06-09  Chris Dumez  <cdumez@apple.com>
1942
1943         WorkerGlobalScope attributes / operations should be on the prototype
1944         https://bugs.webkit.org/show_bug.cgi?id=158568
1945         <rdar://problem/26720079>
1946
1947         Reviewed by Geoffrey Garen.
1948
1949         WorkerGlobalScope attributes / operations should be on the prototype
1950         because WorkerGlobalScope is not marked as [Global] / [PrimaryGlobal]:
1951         - https://html.spec.whatwg.org/multipage/workers.html#the-workerglobalscope-common-interface
1952         - http://heycam.github.io/webidl/#es-attributes
1953         - http://heycam.github.io/webidl/#es-operations
1954
1955         DedicatedWorkerGlobalScope is the interface that is marked as [Global]
1956         and whose attributes / operations should be on the instance.
1957
1958         This brings the number of failures on http://w3c-test.org/workers/interfaces.worker
1959         from 65 to 34. It also aligns our behavior with Firefox and Chrome.
1960
1961         Test: fast/workers/WorkerGlobalScope-properties-prototype.html
1962
1963         * bindings/scripts/CodeGeneratorJS.pm:
1964         (InterfaceRequiresAttributesOnInstance):
1965         (OperationShouldBeOnInstance):
1966
1967 2016-06-09  Tim Horton  <timothy_horton@apple.com>
1968
1969         Writing-mode-dependent properties don't apply if their value is a variable
1970         https://bugs.webkit.org/show_bug.cgi?id=158449
1971         <rdar://problem/26662478>
1972
1973         Reviewed by Simon Fraser.
1974
1975         Test: fast/css/variables/direction-dependent-variable-properties.html
1976
1977         * css/CSSParser.cpp:
1978         (WebCore::CSSParser::parseVariableDependentValue):
1979         * css/CSSParser.h:
1980         * css/StyleResolver.cpp:
1981         (WebCore::StyleResolver::resolvedVariableValue):
1982         CSSVariableDependentValue stores the unresolved (direction-dependent) property ID,
1983         because the property that it resolves to cannot be determined until style resolution time.
1984         Plumb the requisite direction and writing mode information into parseVariableDependentValue
1985         at style resolution time so that the property can be resolved to the correct
1986         non-direction-dependent property for each use of the value.
1987
1988 2016-06-09  Ryan Haddad  <ryanhaddad@apple.com>
1989
1990         Attempt to fix the iOS build.
1991
1992         Unreviewed build fix.
1993
1994         * platform/network/mac/ResourceErrorMac.mm:
1995         (WebCore::ResourceError::ResourceError):
1996
1997 2016-06-09  Simon Fraser  <simon.fraser@apple.com>
1998
1999         border-radius with different width and height rendered wrong
2000         https://bugs.webkit.org/show_bug.cgi?id=158300
2001         <rdar://problem/26672922>
2002
2003         Reviewed by Zalan Bujtas.
2004
2005         Borders with border-radius close to 100% 100% got oddly clipped. This happened because
2006         of the clipping we do to achieve the diagonal corner joins; RenderBoxModelObject::clipBorderSidePolygon()
2007         created trapezoids for each side, but only extended them to the center of the inner border rect.
2008         This clipped out parts of these borders.
2009
2010         Fix by computing the trapezoids by intersecting the corner diagonal line with a line that passes
2011         through the adjacent corners of the inner rect, whose intersection is always going to be inside the
2012         rounded border. Also fix the quads used to do the antialiased/non-antialiased clipping,
2013         by adding a point rather than moving a corner point to ensure we don't mistakenly clip out any
2014         parts of the border.
2015         
2016         Finally, improve the rendering of non-renderable cases by actually doing the diagonal
2017         corner joins rather than just giving up.
2018
2019         Tests: fast/borders/border-non-renderable-radius-inner-clip.html
2020                fast/borders/border-radius-inner-clip-vertical.html
2021                fast/borders/border-radius-inner-clip.html
2022
2023         * rendering/RenderBoxModelObject.cpp:
2024         (WebCore::calculateAdjustedInnerBorder): Moved up.
2025         (WebCore::RenderBoxModelObject::paintOneBorderSide):
2026         (WebCore::RenderBoxModelObject::clipBorderSidePolygon):
2027         (WebCore::findInnerVertex): Deleted.
2028         (WebCore::calculateSideRectIncludingInner): Deleted.
2029         (WebCore::RenderBoxModelObject::clipBorderSideForComplexInnerPath): Deleted.
2030         * rendering/RenderBoxModelObject.h:
2031
2032 2016-06-09  Xabier Rodriguez Calvar  <calvaris@igalia.com>
2033
2034         Unreviewed, fixing compilation issue with WebRTC
2035
2036         The code dependencies of the SDP processor were not right.
2037
2038         * PlatformGTK.cmake:
2039
2040 2016-06-09  Frederic Wang  <fwang@igalia.com>
2041
2042         Introduce MathOperator::Type
2043         https://bugs.webkit.org/show_bug.cgi?id=156950
2044
2045         Reviewed by Sergio Villar Senin.
2046
2047         No new tests, behavior is not change.
2048
2049         An enum Type is introduced in MathOperator in order to indicate
2050         which kind of stretching is requested. In follow-up work, this will
2051         allow to just call setOperator and stretchTo without having to
2052         explicitly call calculateDisplayStyleLargeOperator or calculateStretchyData.
2053
2054         * rendering/mathml/MathOperator.cpp:
2055         (WebCore::MathOperator::setOperator): Use Type instead of a boolean.
2056         (WebCore::MathOperator::setGlyphAssembly): Add an assert to ensure that the function is correctly used.
2057         (WebCore::MathOperator::calculateDisplayStyleLargeOperator): Ditto, this makes the assert more accurate.
2058         (WebCore::MathOperator::calculateStretchyData): Ditto and replace m_isVertical with a local isVertical variable.
2059         (WebCore::MathOperator::fillWithVerticalExtensionGlyph): Ditto.
2060         (WebCore::MathOperator::fillWithHorizontalExtensionGlyph): Ditto.
2061         (WebCore::MathOperator::paintVerticalGlyphAssembly): Ditto.
2062         (WebCore::MathOperator::paintHorizontalGlyphAssembly): Ditto.
2063         * rendering/mathml/MathOperator.h: Add the Type enum.
2064         (WebCore::MathOperator::stretchSize): Use Type instead of a boolean and add an
2065         assert to ensure that the function is correctly used.
2066         * rendering/mathml/RenderMathMLOperator.cpp:
2067         (WebCore::RenderMathMLOperator::computePreferredLogicalWidths): Call setOperator with the correct value.
2068         (WebCore::RenderMathMLOperator::updateStyle): Ditto.
2069
2070 2016-06-09  Commit Queue  <commit-queue@webkit.org>
2071
2072         Unreviewed, rolling out r201810.
2073         https://bugs.webkit.org/show_bug.cgi?id=158563
2074
2075         breaks build without ENABLE_WEB_ANIMATION (Requested by
2076         mcatanzaro on #webkit).
2077
2078         Reverted changeset:
2079
2080         "[web-animations] Add Animatable, AnimationEffect,
2081         KeyframeEffect and Animation interface"
2082         https://bugs.webkit.org/show_bug.cgi?id=156096
2083         http://trac.webkit.org/changeset/201810
2084
2085 2016-06-09  Ryosuke Niwa  <rniwa@webkit.org>
2086
2087         slotchange event should be fired at the end of microtask
2088         https://bugs.webkit.org/show_bug.cgi?id=157374
2089         <rdar://problem/26154024>
2090
2091         Reviewed by Antti Koivisto.
2092
2093         Dispatch slotchange event at the end of every microtask after delivering records to mutation observers
2094         as specified in: https://dom.spec.whatwg.org/#notify-mutation-observers
2095
2096         Test: fast/shadow-dom/slotchange-event.html
2097
2098         * dom/Document.cpp:
2099         (WebCore::Document::enqueueSlotchangeEvent): Deleted.
2100         * dom/Document.h:
2101         * dom/MutationObserver.cpp:
2102         (WebCore::signalSlotList): Added.
2103         (WebCore::MutationObserverMicrotask::run): mutationObserverCompoundMicrotaskQueuedFlag is now unset in
2104         notifyMutationObservers to better match the concept to "notify mutation observers".
2105         (WebCore::MutationObserver::enqueueSlotChangeEvent): Added.
2106         (WebCore::MutationObserver::notifyMutationObservers): Renamed from deliverAllMutations. Added the code
2107         to dispatch slotchange events as spec'ed, and also added comments for each step.
2108         * dom/MutationObserver.h:
2109         * html/HTMLSlotElement.cpp:
2110         (WebCore::HTMLSlotElement::enqueueSlotChangeEvent): Use MutationObserver::enqueueSlotChangeEvent. Don't
2111         create an event here since that is only needed when dispatching the event, and to keep track of whether
2112         we've already scheduled an event or not. Use a boolean flag instead for the latter. 
2113         (WebCore::HTMLSlotElement::dispatchSlotChangeEvent): Added. Creates and dispatches an event.
2114         (WebCore::HTMLSlotElement::dispatchEvent): Deleted.
2115         * html/HTMLSlotElement.h:
2116         (WebCore::HTMLSlotElement::didRemoveFromSignalSlotList): Added.
2117
2118 2016-06-08  Youenn Fablet  <youenn.fablet@crf.canon.fr>
2119
2120         Introduce ResourceErrorBase::type
2121         https://bugs.webkit.org/show_bug.cgi?id=158299
2122
2123         Reviewed by Alex Christensen.
2124
2125         Introducing an enum type for ResourceErrorBase.
2126         In most cases, the type is set at construction time.
2127         By default, constructor with no parameters will set type to Null.
2128         Constructor with parameters will set type to General.
2129
2130         Removed boolean state error fields.
2131
2132         Introduced a type setter. It should only be used to  make the type
2133         more precise (when type is Null or General).
2134
2135         Updating related calling code.
2136
2137         No change of behavior.
2138
2139         * loader/DocumentLoader.cpp:
2140         (WebCore::DocumentLoader::stopLoadingForPolicyChange):
2141         * loader/DocumentThreadableLoader.cpp:
2142         (WebCore::DocumentThreadableLoader::cancel):
2143         * loader/EmptyClients.h:
2144         * loader/FrameLoader.cpp:
2145         (WebCore::FrameLoader::cancelledError):
2146         (WebCore::FrameLoader::blockedError):
2147         * loader/WorkerThreadableLoader.cpp:
2148         (WebCore::WorkerThreadableLoader::MainThreadBridge::cancel):
2149         * platform/network/ResourceErrorBase.cpp:
2150         (WebCore::ResourceErrorBase::isolatedCopy):
2151         (WebCore::ResourceErrorBase::setType):
2152         (WebCore::ResourceErrorBase::compare):
2153         * platform/network/ResourceErrorBase.h:
2154         (WebCore::ResourceErrorBase::isNull):
2155         (WebCore::ResourceErrorBase::isCancellation):
2156         (WebCore::ResourceErrorBase::isTimeout):
2157         (WebCore::ResourceErrorBase::type):
2158         (WebCore::ResourceErrorBase::ResourceErrorBase):
2159         (WebCore::ResourceErrorBase::domain):
2160         * platform/network/cf/ResourceError.h:
2161         (WebCore::ResourceError::ResourceError):
2162         * platform/network/cf/ResourceErrorCF.cpp:
2163         (WebCore::ResourceError::ResourceError):
2164         (WebCore::ResourceError::cfError):
2165         * platform/network/curl/ResourceError.h:
2166         (WebCore::ResourceError::ResourceError):
2167         * platform/network/mac/ResourceErrorMac.mm:
2168         (WebCore::m_platformError):
2169         (WebCore::ResourceError::nsError):
2170         (WebCore::ResourceError::ResourceError):
2171         (WebCore::ResourceError::platformLazyInit):
2172         * platform/network/soup/ResourceError.h:
2173         (WebCore::ResourceError::ResourceError):
2174         * platform/network/soup/ResourceErrorSoup.cpp:
2175         (WebCore::ResourceError::timeoutError):
2176
2177 2016-06-08  Frederic Wang  <fwang@igalia.com>
2178
2179         Move selection and drawing of stretchy operators into a separate MathOperator class
2180         https://bugs.webkit.org/show_bug.cgi?id=156921
2181
2182         Reviewed by Martin Robinson.
2183
2184         No new tests, behavior is not changed.
2185
2186         * CMakeLists.txt: Add the MathOperator files.
2187         * WebCore.xcodeproj/project.pbxproj: Ditto.
2188         * rendering/mathml/MathOperator.cpp: Added.
2189         (WebCore::boundsForGlyph): Moved from RenderMathMLOperator.
2190         (WebCore::heightForGlyph): Moved from RenderMathMLOperator.
2191         (WebCore::advanceWidthForGlyph): Moved from RenderMathMLOperator.
2192         (WebCore::MathOperator::MathOperator):
2193         (WebCore::MathOperator::setOperator):
2194         (WebCore::MathOperator::getBaseGlyph): Moved from RenderMathMLOperator.
2195         (WebCore::MathOperator::setSizeVariant): Moved from RenderMathMLOperator.
2196         (WebCore::MathOperator::setGlyphAssembly): Moved from RenderMathMLOperator.
2197         (WebCore::MathOperator::calculateDisplayStyleLargeOperator): Moved from RenderMathMLOperator with additional style parameter.
2198         (WebCore::MathOperator::calculateGlyphAssemblyFallBack): Ditto.
2199         (WebCore::MathOperator::calculateStretchyData): Ditto.
2200         (WebCore::MathOperator::paintGlyph): Ditto.
2201         (WebCore::MathOperator::fillWithVerticalExtensionGlyph): Ditto.
2202         (WebCore::MathOperator::fillWithHorizontalExtensionGlyph): Ditto.
2203         (WebCore::MathOperator::paintVerticalGlyphAssembly): Ditto.
2204         (WebCore::MathOperator::paintHorizontalGlyphAssembly): Ditto.
2205         * rendering/mathml/MathOperator.h: Added.
2206         (WebCore::MathOperator::italicCorrection):
2207         (WebCore::MathOperator::isStretched):
2208         (WebCore::MathOperator::unstretch):
2209         (WebCore::MathOperator::GlyphAssemblyData::GlyphAssemblyData): Moved from RenderMathMLOperator.
2210         (WebCore::MathOperator::stretchSize):
2211         * rendering/mathml/RenderMathMLOperator.cpp:
2212         (WebCore::RenderMathMLOperator::computePreferredLogicalWidths): Updated to use MathOperator members.
2213         For now we call setOperator to transmit information to m_mathOperator.
2214         (WebCore::RenderMathMLOperator::updateStyle): Updated to use MathOperator members.
2215         For now we set some m_mathOperator members to transmit it some information.
2216         (WebCore::RenderMathMLOperator::firstLineBaseline): Updated to use MathOperator members.
2217         (WebCore::RenderMathMLOperator::computeLogicalHeight): Ditto.
2218         (WebCore::RenderMathMLOperator::paint): Ditto.
2219         For now we set some m_mathOperator members to transmit it some information.
2220         (WebCore::RenderMathMLOperator::paintChildren): Updated to use MathOperator members.
2221         (WebCore::RenderMathMLOperator::trailingSpaceError): Ditto.
2222         (WebCore::RenderMathMLOperator::getBaseGlyph): Deleted.
2223         (WebCore::RenderMathMLOperator::setSizeVariant): Deleted.
2224         (WebCore::RenderMathMLOperator::setGlyphAssembly): Deleted.
2225         (WebCore::RenderMathMLOperator::calculateGlyphAssemblyFallBack): Deleted.
2226         (WebCore::RenderMathMLOperator::calculateDisplayStyleLargeOperator): Deleted.
2227         (WebCore::RenderMathMLOperator::calculateStretchyData): Deleted.
2228         (WebCore::RenderMathMLOperator::paintGlyph): Deleted.
2229         (WebCore::RenderMathMLOperator::fillWithVerticalExtensionGlyph): Deleted.
2230         (WebCore::RenderMathMLOperator::fillWithHorizontalExtensionGlyph): Deleted.
2231         (WebCore::RenderMathMLOperator::paintVerticalGlyphAssembly): Deleted.
2232         (WebCore::RenderMathMLOperator::paintHorizontalGlyphAssembly): Deleted.
2233         * rendering/mathml/RenderMathMLOperator.h:
2234         (WebCore::RenderMathMLOperator::italicCorrection): Updated to use MathOperator members.
2235         (WebCore::RenderMathMLOperator::GlyphAssemblyData::GlyphAssemblyData): Deleted.
2236
2237 2016-06-08  Chris Dumez  <cdumez@apple.com>
2238
2239         DedicatedWorkerGlobalScope prototype chain is incorrect
2240         https://bugs.webkit.org/show_bug.cgi?id=158544
2241
2242         Reviewed by Brady Eidson.
2243
2244         There were several issues with the prototype chain of DedicatedWorkerGlobalScope:
2245         1. Object.getPrototypeOf(DedicatedWorkerGlobalScope.prototype) was not
2246            WorkerGlobalScope.prototype.
2247         2. WorkerGlobalScope.prototype was a DedicatedWorkerGlobalScopePrototype
2248            object and was equal to DedicatedWorkerGlobalScope.prototype.
2249         3. Object.getPrototypeOf(WorkerGlobalScope.prototype) was not EventTarget.prototype.
2250
2251         Those issues were identified by the following W3C web-platform-test:
2252         http://w3c-test.org/workers/interfaces.worker
2253
2254         This patch fixes the issue so that the prototype chain is now as per the
2255         specification.
2256
2257         Test: fast/workers/DedicatedWorkerGlobalScope-prototype-chain.html
2258
2259         * bindings/js/WorkerScriptController.cpp:
2260         (WebCore::WorkerScriptController::initScript):
2261         - Stop creating the WorkerGlobalScopePrototype and let JSWorkerGlobalScope
2262           create it.
2263         - Set DedicatedWorkerGlobalScopePrototype's prototype to JSWorkerGlobalScope's
2264           prototype after creating the JSDedicatedWorkerGlobalScope object.
2265
2266         * bindings/scripts/CodeGeneratorJS.pm:
2267         (ShouldUseGlobalObjectPrototype):
2268         (GenerateHeader):
2269         (GenerateImplementation):
2270         (GenerateConstructorHelperMethods):
2271         - Do not use globalObject.getPrototypeDirect() as 'prototype' property for
2272           WorkerGlobalScope. The globalObject is a DedicatedWorkerGlobalScope, not
2273           a WorkerGlobalScope.
2274         - Generate the code to create / get a prototype object for WorkerGlobalScope.
2275
2276
2277 2016-06-08  Adam Bergkvist  <adam.bergkvist@ericsson.com>
2278
2279         WebRTC: Imlement MediaEndpointPeerConnection::setRemoteDescription()
2280         https://bugs.webkit.org/show_bug.cgi?id=158467
2281
2282         Reviewed by Eric Carlson.
2283
2284         Implement MediaEndpointPeerConnection::setRemoteDescription() which verifies a
2285         remote offer or answer, configures the WebRTC backend and dispatches the 'track' events
2286         that represent the incoming media [1].
2287
2288         This change also updates the RTCTrackEvent [2] with a streams and a transceiver attribute.
2289
2290         [1] https://w3c.github.io/webrtc-pc/archives/20160513/webrtc.html#dom-rtcpeerconnection-setremotedescription
2291         [2] https://w3c.github.io/webrtc-pc/archives/20160513/webrtc.html#rtctrackevent
2292
2293         Tests: fast/mediastream/RTCPeerConnection-setRemoteDescription-offer.html
2294                fast/mediastream/RTCTrackEvent-constructor.html
2295
2296         * Modules/mediastream/MediaEndpointPeerConnection.cpp:
2297         (WebCore::createSourceMap):
2298         (WebCore::MediaEndpointPeerConnection::setLocalDescriptionTask):
2299         (WebCore::MediaEndpointPeerConnection::setRemoteDescription):
2300         (WebCore::MediaEndpointPeerConnection::setRemoteDescriptionTask):
2301         Implemented.
2302         (WebCore::MediaEndpointPeerConnection::remoteDescription):
2303         (WebCore::MediaEndpointPeerConnection::currentRemoteDescription):
2304         (WebCore::MediaEndpointPeerConnection::pendingRemoteDescription):
2305         (WebCore::MediaEndpointPeerConnection::remoteDescriptionTypeValidForState):
2306         (WebCore::MediaEndpointPeerConnection::internalRemoteDescription):
2307         * Modules/mediastream/MediaEndpointPeerConnection.h:
2308         * Modules/mediastream/PeerConnectionBackend.h:
2309         * Modules/mediastream/RTCPeerConnection.cpp:
2310         (WebCore::RTCPeerConnection::addTransceiver):
2311         * Modules/mediastream/RTCPeerConnection.h:
2312         * Modules/mediastream/RTCRtpReceiver.h:
2313         (WebCore::RTCRtpReceiver::isDispatched):
2314         (WebCore::RTCRtpReceiver::setDispatched):
2315         * Modules/mediastream/RTCTrackEvent.cpp:
2316         (WebCore::RTCTrackEvent::create):
2317         (WebCore::RTCTrackEvent::RTCTrackEvent):
2318         * Modules/mediastream/RTCTrackEvent.h:
2319         (WebCore::RTCTrackEvent::streams):
2320         (WebCore::RTCTrackEvent::transceiver):
2321         * Modules/mediastream/RTCTrackEvent.idl:
2322         Add streams and transceiver attributes.
2323         * bindings/js/JSDictionary.cpp:
2324         (WebCore::JSDictionary::convertValue):
2325         * bindings/js/JSDictionary.h:
2326         * platform/mediastream/MediaEndpoint.h:
2327         * platform/mock/MockMediaEndpoint.cpp:
2328         (WebCore::MockMediaEndpoint::filterPayloads):
2329         (WebCore::MockMediaEndpoint::updateSendConfiguration):
2330         * platform/mock/MockMediaEndpoint.h:
2331
2332 2016-06-08  John Wilander  <wilander@apple.com>
2333
2334         Perform IDNA encoding on parameters for setHostAndPort and setHost
2335         https://bugs.webkit.org/show_bug.cgi?id=158371
2336         <rdar://problem/16869342>
2337
2338         Reviewed by Brent Fulgham.
2339
2340         Tests: fast/dom/set-document-location-host-to-unaccepted-values.html
2341                fast/dom/set-document-location-hostname-to-unaccepted-values.html
2342                http/tests/dom/set-document-location-host-to-accepted-values.html
2343                http/tests/dom/set-document-location-hostname-to-accepted-values.html
2344
2345         * platform/URL.cpp:
2346         (WebCore::containsOnlyASCII):
2347             Moved up to enable usage in URL::setHost and URL::setHostAndPort.
2348         (WebCore::appendEncodedHostname):
2349             Moved up to enable usage in URL::setHost and URL::setHostAndPort.
2350         (WebCore::URL::setHost):
2351             Now disallows the colon character, does IDNA encoding, and uses StringBuilder.
2352         (WebCore::URL::setHostAndPort):
2353             Now disallows multiple colons, disallows non-numeric ports, disallows the empty
2354             string, does IDNA encoding, and uses StringBuilder.
2355
2356 2016-06-08  Alex Christensen  <achristensen@webkit.org>
2357
2358         Fix WinCairo build.
2359
2360         * platform/network/curl/MultipartHandle.cpp:
2361         (WebCore::MultipartHandle::didReceiveResponse):
2362
2363 2016-06-08  Alex Christensen  <achristensen@webkit.org>
2364
2365         Fix WinCairo build.
2366
2367         * platform/network/curl/MultipartHandle.cpp:
2368         (WebCore::MultipartHandle::didReceiveResponse):
2369
2370 2016-06-08  Jer Noble  <jer.noble@apple.com>
2371
2372         With audio user gesture restriction in place, video.src = 'file', video.play() succeeds where it should fail.
2373         https://bugs.webkit.org/show_bug.cgi?id=158546
2374
2375         Reviewed by Eric Carlson.
2376
2377         Test: media/video-playback-restriction-play-before-load.html
2378
2379         Don't check that the media element isPlaying(); that will only return true if playback has begun.
2380         Instead, check !paused(), as that will be true as soon as the play() method returns.
2381
2382         * html/HTMLMediaElement.cpp:
2383         (WebCore::HTMLMediaElement::mediaPlayerCharacteristicChanged):
2384         (WebCore::HTMLMediaElement::updateShouldPlay):
2385         * rendering/RenderLayer.h:
2386
2387 2016-06-08  Alex Christensen  <achristensen@webkit.org>
2388
2389         Modernize WebSocket code
2390         https://bugs.webkit.org/show_bug.cgi?id=158539
2391
2392         Reviewed by Brady Eidson.
2393
2394         No new tests, no change in behavior.
2395
2396         * Modules/websockets/ThreadableWebSocketChannel.cpp:
2397         (WebCore::ThreadableWebSocketChannel::create):
2398         * Modules/websockets/ThreadableWebSocketChannel.h:
2399         (WebCore::ThreadableWebSocketChannel::ThreadableWebSocketChannel):
2400         * Modules/websockets/ThreadableWebSocketChannelClientWrapper.cpp:
2401         (WebCore::ThreadableWebSocketChannelClientWrapper::ThreadableWebSocketChannelClientWrapper):
2402         (WebCore::ThreadableWebSocketChannelClientWrapper::create):
2403         (WebCore::ThreadableWebSocketChannelClientWrapper::processPendingTasks):
2404         * Modules/websockets/ThreadableWebSocketChannelClientWrapper.h:
2405         * Modules/websockets/WebSocket.cpp:
2406         (WebCore::WebSocket::connect):
2407         * Modules/websockets/WebSocketChannel.cpp:
2408         (WebCore::WebSocketChannel::WebSocketChannel):
2409         * Modules/websockets/WebSocketChannel.h:
2410         (WebCore::WebSocketChannel::create):
2411         * Modules/websockets/WorkerThreadableWebSocketChannel.cpp:
2412         (WebCore::WorkerThreadableWebSocketChannel::WorkerThreadableWebSocketChannel):
2413         (WebCore::WorkerThreadableWebSocketChannel::subprotocol):
2414         (WebCore::WorkerThreadableWebSocketChannel::extensions):
2415         (WebCore::WorkerThreadableWebSocketChannel::resume):
2416         (WebCore::WorkerThreadableWebSocketChannel::Peer::Peer):
2417         (WebCore::WorkerThreadableWebSocketChannel::Peer::send):
2418         (WebCore::WorkerThreadableWebSocketChannel::Peer::bufferedAmount):
2419         (WebCore::WorkerThreadableWebSocketChannel::Peer::didConnect):
2420         (WebCore::WorkerThreadableWebSocketChannel::Peer::didReceiveMessage):
2421         (WebCore::WorkerThreadableWebSocketChannel::Peer::didReceiveBinaryData):
2422         (WebCore::WorkerThreadableWebSocketChannel::Peer::didUpdateBufferedAmount):
2423         (WebCore::WorkerThreadableWebSocketChannel::Peer::didStartClosingHandshake):
2424         (WebCore::WorkerThreadableWebSocketChannel::Peer::didClose):
2425         (WebCore::WorkerThreadableWebSocketChannel::Peer::didReceiveMessageError):
2426         (WebCore::WorkerThreadableWebSocketChannel::Bridge::Bridge):
2427         (WebCore::WorkerThreadableWebSocketChannel::Bridge::~Bridge):
2428         (WebCore::WorkerThreadableWebSocketChannel::Bridge::mainThreadInitialize):
2429         (WebCore::WorkerThreadableWebSocketChannel::Bridge::initialize):
2430         (WebCore::WorkerThreadableWebSocketChannel::Bridge::connect):
2431         (WebCore::WorkerThreadableWebSocketChannel::Bridge::send):
2432         (WebCore::WorkerThreadableWebSocketChannel::Bridge::bufferedAmount):
2433         (WebCore::WorkerThreadableWebSocketChannel::Bridge::close):
2434         (WebCore::WorkerThreadableWebSocketChannel::Bridge::setMethodNotCompleted):
2435         (WebCore::WorkerThreadableWebSocketChannel::Bridge::waitForMethodCompletion):
2436         * Modules/websockets/WorkerThreadableWebSocketChannel.h:
2437         (WebCore::WorkerThreadableWebSocketChannel::create):
2438         (WebCore::WorkerThreadableWebSocketChannel::Bridge::create):
2439
2440 2016-06-08  Chris Dumez  <cdumez@apple.com>
2441
2442         First parameter to MessagePort / DedicatedWorkerGlobalScope.postMessage() should be mandatory
2443         https://bugs.webkit.org/show_bug.cgi?id=158540
2444
2445         Reviewed by Geoffrey Garen.
2446
2447         First parameter to MessagePort / DedicatedWorkerGlobalScope.postMessage() should be mandatory:
2448         - https://html.spec.whatwg.org/multipage/comms.html#messageport
2449         - https://html.spec.whatwg.org/multipage/workers.html#dedicated-workers-and-the-dedicatedworkerglobalscope-interface
2450
2451         Previously, WebKit send a bogus MessageEvent whose data attribute is undefined. This would
2452         cause a testharness error when running the following W3C test:
2453         - http://w3c-test.org/workers/interfaces.worker
2454
2455         Firefox and Chrome already correctly throw in this case. Our Window.postMessage() API is also
2456         already throwing in this case.
2457
2458         Test: fast/workers/postMessage-missing-parameter.html
2459
2460         * bindings/js/JSMessagePortCustom.h:
2461         (WebCore::handlePostMessage):
2462
2463 2016-06-08  Gavin Barraclough  <barraclough@apple.com>
2464
2465         Remove removeDirect
2466         https://bugs.webkit.org/show_bug.cgi?id=158516
2467
2468         Reviewed by Ryosuke Niwa.
2469
2470         removeDirect is typically used as a subroutine of deleteProperty, but is also available to
2471         call directly. Having this functionality factored out to a separate routine is a bad idea
2472         on a couple of fronts:
2473
2474         - for the main use within deleteProperty there is redundancy (presence of the property
2475           was being checked twice) and inconsistency (the two functions returned different results
2476           in the case of a nonexistent property; the result from removeDirect was never observed).
2477
2478         - all uses of removeDirect are in practical terms incorrect. removeDirect had the
2479           advantage of ignoring the configurable (DontDelete) attributes, but this is achievable
2480           using the DeletePropertyMode setting - and the disadvantage of failing delete static
2481           table properties. Last uses were one that was removed in bug #158295 (where failure to
2482           delete static properties was a problem), and as addressed in this patch removeDirect is
2483           being used to implement runtime enabled features. This only works because we currently
2484           force reification of all properties on the DOM prototype objects, so in effect there are
2485           no static properties. In order to make the code robust such that runtime enabled
2486           features would still work even if we were not reifying static properties (a change we
2487           may want to make) we should be calling deleteProperty in this case too.
2488
2489         * bindings/scripts/CodeGeneratorJS.pm:
2490         (GenerateImplementation):
2491             - changed to call deleteProperty instead of removeDirect.
2492         * bindings/scripts/test/JS/JSTestObj.cpp:
2493         (WebCore::JSTestObjPrototype::finishCreation):
2494             - updated bindings test results.
2495
2496 2016-06-08  Nan Wang  <n_wang@apple.com>
2497
2498         For keyboard users, activating a fragment URL should transfer focus and caret to the destination
2499         https://bugs.webkit.org/show_bug.cgi?id=116046
2500
2501         Reviewed by Ryosuke Niwa.
2502
2503         Added a sequential focus navigation starting node to document. When TAB or SHIFT-TAB is pressed
2504         and there is no focused element, we start searching for next focus candidates at the sequential
2505         focus navigation node.
2506         Spec: https://html.spec.whatwg.org/multipage/interaction.html#sequential-focus-navigation-starting-point
2507
2508         Test: fast/events/sequential-focus-navigation-starting-point.html
2509
2510         * dom/Document.cpp:
2511         (WebCore::Document::removedLastRef):
2512         (WebCore::Document::destroyRenderTree):
2513         (WebCore::Document::styleResolverChanged):
2514         (WebCore::isNodeInSubtree):
2515         (WebCore::Document::removeFocusedNodeOfSubtree):
2516         (WebCore::Document::hoveredElementDidDetach):
2517         (WebCore::Document::setFocusedElement):
2518         (WebCore::shouldResetFocusNavigationStartingNode):
2519         (WebCore::Document::setFocusNavigationStartingNode):
2520         (WebCore::Document::focusNavigationStartingNode):
2521         (WebCore::Document::setCSSTarget):
2522         (WebCore::Document::nodeChildrenWillBeRemoved):
2523         (WebCore::Document::nodeWillBeRemoved):
2524         (WebCore::fallbackFocusNavigationStartingNodeAfterRemoval):
2525         (WebCore::Document::removeFocusNavigationNodeOfSubtree):
2526         (WebCore::Document::textInserted):
2527         * dom/Document.h:
2528         (WebCore::Document::userActionElements):
2529         * page/EventHandler.cpp:
2530         (WebCore::EventHandler::handleMousePressEvent):
2531         * page/FocusController.cpp:
2532         (WebCore::FocusController::advanceFocusInDocumentOrder):
2533         * page/FrameView.cpp:
2534         (WebCore::FrameView::scrollToAnchor):
2535
2536 2016-06-08  Eric Carlson  <eric.carlson@apple.com>
2537
2538         HTMLMediaElement.prototype.canPlayType accounting for 250-750ms first loading theverge.com
2539         https://bugs.webkit.org/show_bug.cgi?id=158335
2540         <rdar://problem/26615416>
2541
2542         Reviewed by Brent Fulgham.
2543
2544         * WebCore.xcodeproj/project.pbxproj: Add AVFoundationMIMETypeCache.
2545
2546         * platform/graphics/avfoundation/objc/AVFoundationMIMETypeCache.h: Added.
2547         * platform/graphics/avfoundation/objc/AVFoundationMIMETypeCache.mm: Added.
2548         (WebCore::AVFoundationMIMETypeCache::AVFoundationMIMETypeCache):
2549         (WebCore::AVFoundationMIMETypeCache::loadTypes):
2550         (WebCore::AVFoundationMIMETypeCache::types):
2551         (WebCore::AVFoundationMIMETypeCache::singleton):
2552
2553         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
2554         (WebCore::MediaPlayerPrivateAVFoundationObjC::registerMediaEngine): Start MIME type loading.
2555         (WebCore::MediaPlayerPrivateAVFoundationObjC::getSupportedTypes): Use AVFoundationMIMETypeCache.
2556         (WebCore::MediaPlayerPrivateAVFoundationObjC::supportsType): Ditto.
2557         (WebCore::MediaPlayerPrivateAVFoundationObjC::supportsKeySystem): Ditto.
2558         (WebCore::avfMIMETypes): Deleted.
2559
2560         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
2561         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::registerMediaEngine): Start MIME type loading.
2562         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::isAvailable): Use AVFoundationMIMETypeCache.
2563         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::getSupportedTypes): Ditto.
2564         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::supportsType): Ditto.
2565         (WebCore::mimeTypeCache): Deleted.
2566
2567 2016-06-07  Ryosuke Niwa  <rniwa@webkit.org>
2568
2569         REGRESSION (r201667): ASSERTION FAILED: !m_anchorNode || !editingIgnoresContent(*m_anchorNode)
2570         https://bugs.webkit.org/show_bug.cgi?id=158373
2571         <rdar://problem/26690795>
2572
2573         Reviewed by Brent Fulgham.
2574
2575         The bug was caused by VisibleSelection::toNormalizedRange calling parentAnchoredEquivalent on an orphaned Position.
2576         Fixed it by checking that condition and exiting early since we can't create a Range with a detached node anyway.
2577
2578         Also renamed isNonOrphanedCaretOrRange to isNoneOrOrphaned after negating the semantics for clarity.
2579
2580         Test: editing/selection/selection-in-iframe-removed-crash.html
2581
2582         * editing/EditorCommand.cpp:
2583         (WebCore::valueFormatBlock):
2584         * editing/FrameSelection.cpp:
2585         (WebCore::FrameSelection::setSelectionWithoutUpdatingAppearance):
2586         * editing/InsertLineBreakCommand.cpp:
2587         (WebCore::InsertLineBreakCommand::doApply):
2588         * editing/InsertListCommand.cpp:
2589         (WebCore::InsertListCommand::doApply):
2590         * editing/InsertParagraphSeparatorCommand.cpp:
2591         (WebCore::InsertParagraphSeparatorCommand::doApply):
2592         * editing/InsertTextCommand.cpp:
2593         (WebCore::InsertTextCommand::doApply):
2594         * editing/RemoveFormatCommand.cpp:
2595         (WebCore::RemoveFormatCommand::doApply):
2596         * editing/ReplaceSelectionCommand.cpp:
2597         (WebCore::ReplaceSelectionCommand::doApply):
2598         * editing/SetSelectionCommand.cpp:
2599         (WebCore::SetSelectionCommand::doApply):
2600         (WebCore::SetSelectionCommand::doUnapply):
2601         * editing/TypingCommand.cpp:
2602         (WebCore::TypingCommand::doApply):
2603         * editing/VisibleSelection.cpp:
2604         (WebCore::VisibleSelection::firstRange): Also added a check for isNoneOrOrphaned since this function can hit the same
2605         assertion when the selection end points are orphaned.
2606         (WebCore::VisibleSelection::toNormalizedRange): Fixed the bug.
2607         * editing/VisibleSelection.h:
2608         (WebCore::VisibleSelection::isNoneOrOrphaned): Renamed from isNonOrphanedCaretOrRange and negated the semantics.
2609
2610 2016-06-08  Dean Jackson  <dino@apple.com>
2611
2612         Multiple selectors break keyframes animation
2613         https://bugs.webkit.org/show_bug.cgi?id=158199
2614         <rdar://problem/26652591>
2615
2616         Reviewed by Simon Fraser.
2617
2618         If we came across a duplicate key entry in a keyframe, we
2619         were replacing the existing entry, instead of merging.
2620
2621         Test: animations/duplicate-keys.html
2622
2623         * css/CSSKeyframeRule.h:
2624         (WebCore::StyleKeyframe::setKey): Add a way to set the key of a rule
2625         as a number, rather than going through a string and the CSS parser.
2626         * css/StyleResolver.cpp:
2627         (WebCore::StyleResolver::keyframeStylesForAnimation): Check if the rule
2628         has duplicates, and if it does, merge all the common entries.
2629         * rendering/style/KeyframeList.cpp:
2630         (WebCore::KeyframeList::insert): Now that we've removed duplicates at
2631         the processing time, we should never come across a duplicate while
2632         building this list.
2633
2634 2016-06-08  Ryan Haddad  <ryanhaddad@apple.com>
2635
2636         Rebaseline bindings tests after r201808
2637
2638         Unreviewed test gardening.
2639
2640         * bindings/scripts/test/JS/JSTestGlobalObject.cpp:
2641         (WebCore::JSTestGlobalObject::finishCreation):
2642         * bindings/scripts/test/JS/JSTestGlobalObject.h:
2643
2644 2016-06-08  Lucas Forschler  <lforschler@apple.com>
2645
2646         Teach cmake about libWebKitSystemInterfaceOSX10.12
2647         
2648         Rubber-stamped by Matt Hanson and Alex Christensen.
2649         
2650         * PlatformMac.cmake:
2651
2652 2016-06-08  Rawinder Singh  <rawinder.singh-webkit@cisra.canon.com.au>
2653
2654         [web-animations] Add Animatable, AnimationEffect, KeyframeEffect and Animation interface
2655         https://bugs.webkit.org/show_bug.cgi?id=156096
2656
2657         Reviewed by Dean Jackson.
2658
2659         Adds:
2660         - Animatable interface and implementation of getAnimations in Element
2661         - Interface and implementation for Document getAnimations method.
2662         - AnimationEffect interface and class stub.
2663         - KeyframeEffect interface and constructor implementation.
2664         - 'Animation' interface, constructor and query methods for effect and timeline.
2665         - Remove runtime condition on Web animation interfaces (compile time flag is specified).
2666
2667         Test: webanimations/Document.html
2668
2669         * CMakeLists.txt:
2670         * DerivedSources.make:
2671         * PlatformGTK.cmake:
2672         * WebCore.xcodeproj/project.pbxproj:
2673         * animation/Animatable.idl: Copied from Source/WebCore/animation/DocumentAnimation.idl.
2674         * animation/AnimationEffect.cpp: Copied from Source/WebCore/animation/AnimationTimeline.cpp.
2675         (WebCore::AnimationEffect::AnimationEffect):
2676         (WebCore::AnimationEffect::~AnimationEffect):
2677         (WebCore::AnimationEffect::setAnimation):
2678         (WebCore::AnimationEffect::isCurrent):
2679         (WebCore::AnimationEffect::isInEffect):
2680         * animation/AnimationEffect.h: Copied from Source/WebCore/animation/DocumentTimeline.cpp.
2681         * animation/AnimationEffect.idl: Copied from Source/WebCore/animation/AnimationTimeline.idl.
2682         * animation/AnimationTimeline.cpp:
2683         (WebCore::AnimationTimeline::destroy):
2684         (WebCore::AnimationTimeline::attachAnimation):
2685         (WebCore::AnimationTimeline::detachAnimation):
2686         * animation/AnimationTimeline.h:
2687         * animation/AnimationTimeline.idl:
2688         * animation/DocumentAnimation.cpp:
2689         (WebCore::DocumentAnimation::timeline):
2690         (WebCore::DocumentAnimation::getAnimations):
2691         (WebCore::DocumentAnimation::addAnimation):
2692         (WebCore::DocumentAnimation::removeAnimation):
2693         * animation/DocumentAnimation.h:
2694         (WebCore::DocumentAnimation::getAnimations):
2695         * animation/DocumentAnimation.idl:
2696         * animation/DocumentTimeline.cpp:
2697         (WebCore::DocumentTimeline::create):
2698         (WebCore::DocumentTimeline::DocumentTimeline):
2699         (WebCore::DocumentTimeline::attach):
2700         (WebCore::DocumentTimeline::detach):
2701         * animation/DocumentTimeline.h:
2702         * animation/DocumentTimeline.idl:
2703         * animation/KeyframeEffect.cpp: Copied from Source/WebCore/animation/DocumentTimeline.cpp.
2704         (WebCore::KeyframeEffect::create):
2705         (WebCore::KeyframeEffect::KeyframeEffect):
2706         (WebCore::KeyframeEffect::~KeyframeEffect):
2707         * animation/KeyframeEffect.h: Copied from Source/WebCore/animation/DocumentTimeline.h.
2708         * animation/KeyframeEffect.idl: Copied from Source/WebCore/animation/AnimationTimeline.idl.
2709         * animation/WebAnimation.cpp: Copied from Source/WebCore/animation/DocumentAnimation.cpp.
2710         (WebCore::WebAnimation::create):
2711         (WebCore::WebAnimation::WebAnimation):
2712         (WebCore::WebAnimation::~WebAnimation):
2713         * animation/WebAnimation.h: Copied from Source/WebCore/animation/DocumentAnimation.h.
2714         * animation/WebAnimation.idl: Copied from Source/WebCore/animation/DocumentTimeline.idl.
2715         * bindings/scripts/CodeGeneratorGObject.pm:
2716         * dom/Element.cpp:
2717         (WebCore::Element::getAnimations):
2718         * dom/Element.h:
2719         * dom/Element.idl:
2720
2721 2016-06-08  Chris Dumez  <cdumez@apple.com>
2722
2723         self.hasOwnProperty() does not work inside Web workers
2724         https://bugs.webkit.org/show_bug.cgi?id=158446
2725         <rdar://problem/26638397>
2726
2727         Reviewed by Geoffrey Garen.
2728
2729         W3C tests for workers were severely broken on WebKit because
2730         self.hasOwnProperty() did not work inside workers. The reason is that
2731         hasOwnProperty() (and other methods like toString()) call toThis() in
2732         StrictMode on thisValue. However, in the case of 'self' in workers,
2733         self was a DedicatedWorkerGlobalScope, which is a JSGlobalObject.
2734         JSGlobalObject::toThis() returns jsUndefined() when called in strict
2735         mode. As a result, we would end up with exceptions such as "undefined
2736         is not an object" when calling self.hasOwnProperty() in workers.
2737
2738         To address the problem, this patch introduces a JSProxy whose proxy
2739         type is PureForwardingProxyType and whose target is the
2740         WorkerGlobalScope. This JSProxy is what we expose to the JavaScript,
2741         instead of the JSWorkerGlobalScope itself. As a result, toThis() now
2742         behaves as expected and self.hasOwnProperty() works inside workers.
2743
2744         This patch greatly improves our pass rate on several W3C tests:
2745         http://w3c-test.org/workers/interfaces.worker: 20 passes -> 50 passes (out of 128)
2746         http://w3c-test.org/IndexedDB/interfaces.worker 0 passes -> 145 passes (out of 156)
2747
2748         Tests: fast/workers/self-hasOwnProperty.html
2749                fast/workers/self-toString.html
2750
2751         * bindings/js/JSWorkerGlobalScopeBase.cpp:
2752         (WebCore::JSWorkerGlobalScopeBase::finishCreation):
2753         (WebCore::JSWorkerGlobalScopeBase::visitChildren):
2754         (WebCore::toJS):
2755         * bindings/js/JSWorkerGlobalScopeBase.h:
2756         (WebCore::JSWorkerGlobalScopeBase::proxy):
2757         * bindings/js/WorkerScriptController.cpp:
2758         (WebCore::WorkerScriptController::initScript):
2759         * bindings/scripts/CodeGeneratorJS.pm:
2760         (GenerateHeader):
2761         (GenerateImplementation):
2762
2763 2016-06-08  Antti Koivisto  <antti@apple.com>
2764
2765         WebKit memory cache doesn't respect Vary header
2766         https://bugs.webkit.org/show_bug.cgi?id=71509
2767         <rdar://problem/26651033>
2768
2769         Reviewed by Sam Weinig.
2770
2771         Implement Vary header support in WebCore memory cache.
2772
2773         The patch moves Vary header code from WebKit2 Network Cache to WebCore and uses it to
2774         verify the headers for CachedResources.
2775
2776         * loader/cache/CachedResource.cpp:
2777         (WebCore::CachedResource::failBeforeStarting):
2778         (WebCore::addAdditionalRequestHeadersToRequest):
2779
2780             Factor into standalone function so we can use it from varyHeaderValuesMatch.
2781
2782         (WebCore::CachedResource::addAdditionalRequestHeaders):
2783         (WebCore::CachedResource::load):
2784         (WebCore::CachedResource::setResponse):
2785
2786             Collect the Vary header values when we receive a response.
2787
2788         (WebCore::CachedResource::responseReceived):
2789         (WebCore::CachedResource::redirectChainAllowsReuse):
2790         (WebCore::CachedResource::varyHeaderValuesMatch):
2791
2792             Test for Vary match.
2793
2794         (WebCore::CachedResource::overheadSize):
2795         * loader/cache/CachedResource.h:
2796         (WebCore::CachedResource::isCacheValidator):
2797         (WebCore::CachedResource::resourceToRevalidate):
2798         * loader/cache/CachedResourceLoader.cpp:
2799         (WebCore::CachedResourceLoader::determineRevalidationPolicy):
2800
2801             Reload on Vary mismatch.
2802
2803         * platform/network/CacheValidation.cpp:
2804         (WebCore::parseCacheControlDirectives):
2805         (WebCore::headerValueForVary):
2806         (WebCore::collectVaryingRequestHeaders):
2807         (WebCore::verifyVaryingRequestHeaders):
2808
2809             Vary header collection and validation code moves here.
2810
2811         * platform/network/CacheValidation.h:
2812
2813 2016-06-08  Commit Queue  <commit-queue@webkit.org>
2814
2815         Unreviewed, rolling out r201800.
2816         https://bugs.webkit.org/show_bug.cgi?id=158518
2817
2818         Missing WebKit2 pieces (Requested by anttik on #webkit).
2819
2820         Reverted changeset:
2821
2822         "WebKit memory cache doesn't respect Vary header"
2823         https://bugs.webkit.org/show_bug.cgi?id=71509
2824         http://trac.webkit.org/changeset/201800
2825
2826 2016-06-06  Antti Koivisto  <antti@apple.com>
2827
2828         WebKit memory cache doesn't respect Vary header
2829         https://bugs.webkit.org/show_bug.cgi?id=71509
2830         <rdar://problem/26651033>
2831
2832         Reviewed by Sam Weinig.
2833
2834         Implement Vary header support in WebCore memory cache.
2835
2836         The patch moves Vary header code from WebKit2 Network Cache to WebCore and uses it to
2837         verify the headers for CachedResources.
2838
2839         * loader/cache/CachedResource.cpp:
2840         (WebCore::CachedResource::failBeforeStarting):
2841         (WebCore::addAdditionalRequestHeadersToRequest):
2842
2843             Factor into standalone function so we can use it from varyHeaderValuesMatch.
2844
2845         (WebCore::CachedResource::addAdditionalRequestHeaders):
2846         (WebCore::CachedResource::load):
2847         (WebCore::CachedResource::setResponse):
2848
2849             Collect the Vary header values when we receive a response.
2850
2851         (WebCore::CachedResource::responseReceived):
2852         (WebCore::CachedResource::redirectChainAllowsReuse):
2853         (WebCore::CachedResource::varyHeaderValuesMatch):
2854
2855             Test for Vary match.
2856
2857         (WebCore::CachedResource::overheadSize):
2858         * loader/cache/CachedResource.h:
2859         (WebCore::CachedResource::isCacheValidator):
2860         (WebCore::CachedResource::resourceToRevalidate):
2861         * loader/cache/CachedResourceLoader.cpp:
2862         (WebCore::CachedResourceLoader::determineRevalidationPolicy):
2863
2864             Reload on Vary mismatch.
2865
2866         * platform/network/CacheValidation.cpp:
2867         (WebCore::parseCacheControlDirectives):
2868         (WebCore::headerValueForVary):
2869         (WebCore::collectVaryingRequestHeaders):
2870         (WebCore::verifyVaryingRequestHeaders):
2871
2872             Vary header collection and validation code moves here.
2873
2874         * platform/network/CacheValidation.h:
2875
2876 2016-06-08  Myles C. Maxfield  <mmaxfield@apple.com>
2877
2878         Extend CSSFontSelector's lifetime to be longer than the Document's lifetime
2879         https://bugs.webkit.org/show_bug.cgi?id=154101
2880
2881         Reviewed by Darin Adler.
2882
2883         Rather than destroying the Document's CSSFontSelector, instead, the object should
2884         live for the lifetime of the document, and it should instead be asked to clear its
2885         contents.
2886
2887         This is important for the CSS Font Loading API, where the identity of objects the
2888         CSSFontSelector references needs to persist throughout the lifetime of the
2889         Document. This patch represents the first step to implementing this correctly.
2890         The second step is for the CSSFontSelector to perform a diff instead of a
2891         wholesale clear of its contents. Once this is done, font loading objects can
2892         survive through a call to Document::clearStyleResolver().
2893
2894         This patch gives the CSSFontSelector two states: building underway and building not
2895         underway. The state is building underway in between calls to clearStyleResolver()
2896         and when the style resolver gets built back up. Otherwise, the state is building
2897         not underway. Because of this new design, creation of all FontFace objects can be
2898         postponed until a state transition from building underway to building not underway.
2899         A subsequent patch will perform the diff at this point. An ASSERT() makes sure that
2900         we never service a font lookup request while Building.
2901
2902         No new tests because there is no behavior change.
2903
2904         * css/CSSFontFaceSet.cpp:
2905         (WebCore::CSSFontFaceSet::clear):
2906         * css/CSSFontSelector.cpp:
2907         (WebCore::CSSFontSelector::buildStarted):
2908         (WebCore::CSSFontSelector::buildCompleted):
2909         (WebCore::CSSFontSelector::addFontFaceRule):
2910         (WebCore::CSSFontSelector::fontRangesForFamily):
2911         (WebCore::CSSFontSelector::CSSFontSelector): Deleted.
2912         (WebCore::CSSFontSelector::clearDocument): Deleted.
2913         * css/CSSFontSelector.h:
2914         * css/StyleResolver.cpp:
2915         (WebCore::StyleResolver::appendAuthorStyleSheets):
2916         * dom/Document.cpp:
2917         (WebCore::Document::Document):
2918         (WebCore::Document::~Document):
2919         (WebCore::Document::clearStyleResolver):
2920         (WebCore::Document::fontSelector): Deleted.
2921         * dom/Document.h:
2922         (WebCore::Document::fontSelector):
2923
2924 2016-06-08  Adam Bergkvist  <adam.bergkvist@ericsson.com>
2925
2926         WebRTC: Imlement MediaEndpointPeerConnection::setLocalDescription()
2927         https://bugs.webkit.org/show_bug.cgi?id=158190
2928
2929         Reviewed by Eric Carlson.
2930
2931         Add implementation for MediaEndpointPeerConnection::setLocalDescription. This function
2932         parses the input SDP, configures the media backend and updates the
2933         RTCPeerConnection state.
2934
2935         This change adds MediaEndpointSessionDescription which is an object representation
2936         of an RTCSessionDescription (which contains an SDP string).
2937
2938         Test: fast/mediastream/RTCPeerConnection-setLocalDescription-offer.html
2939
2940         * CMakeLists.txt:
2941         Add MediaEndpointSessionDescription.
2942         * Modules/mediastream/MediaEndpointPeerConnection.cpp:
2943         (WebCore::hasUnassociatedTransceivers):
2944         (WebCore::MediaEndpointPeerConnection::createOfferTask):
2945         (WebCore::MediaEndpointPeerConnection::setLocalDescription):
2946         (WebCore::MediaEndpointPeerConnection::setLocalDescriptionTask):
2947         Add implementation.
2948         (WebCore::MediaEndpointPeerConnection::localDescription):
2949         (WebCore::MediaEndpointPeerConnection::currentLocalDescription):
2950         (WebCore::MediaEndpointPeerConnection::pendingLocalDescription):
2951         (WebCore::MediaEndpointPeerConnection::localDescriptionTypeValidForState):
2952         (WebCore::MediaEndpointPeerConnection::internalLocalDescription):
2953         (WebCore::MediaEndpointPeerConnection::createRTCSessionDescription):
2954         * Modules/mediastream/MediaEndpointPeerConnection.h:
2955         * Modules/mediastream/MediaEndpointSessionDescription.cpp: Added.
2956         (WebCore::MediaEndpointSessionDescription::create):
2957         (WebCore::MediaEndpointSessionDescription::toRTCSessionDescription):
2958         (WebCore::MediaEndpointSessionDescription::typeString):
2959         (WebCore::MediaEndpointSessionDescription::isLaterThan):
2960         * Modules/mediastream/MediaEndpointSessionDescription.h: Added.
2961         (WebCore::MediaEndpointSessionDescription::~MediaEndpointSessionDescription):
2962         (WebCore::MediaEndpointSessionDescription::type):
2963         (WebCore::MediaEndpointSessionDescription::configuration):
2964         (WebCore::MediaEndpointSessionDescription::MediaEndpointSessionDescription):
2965         * WebCore.xcodeproj/project.pbxproj:
2966         Add MediaEndpointSessionDescription.
2967
2968 2016-06-07  Carlos Garcia Campos  <cgarcia@igalia.com>
2969
2970         [GLIB] Implement hardLinkOrCopyFile() in FileSystemGlib
2971         https://bugs.webkit.org/show_bug.cgi?id=158473
2972
2973         Reviewed by Michael Catanzaro.
2974
2975         It was added in r199230 to be used by IndexedDB blob support, but never implemented for GLib.
2976
2977         * platform/glib/FileSystemGlib.cpp:
2978         (WebCore::hardLinkOrCopyFile):
2979
2980 2016-06-07  Adam Bergkvist  <adam.bergkvist@ericsson.com>
2981
2982         WebRTC: Refactor: Use captures with initializers in MediaEndpointPeerConnection::createOffer()
2983         https://bugs.webkit.org/show_bug.cgi?id=158486
2984
2985         Reviewed by Eric Carlson.
2986
2987         Use initializers for the capture list when scheduling the "create offer task".
2988
2989         No change in behavior.
2990
2991         * Modules/mediastream/MediaEndpointPeerConnection.cpp:
2992         (WebCore::MediaEndpointPeerConnection::createOffer):
2993         (WebCore::WrappedSessionDescriptionPromise::create): Deleted.
2994         (WebCore::WrappedSessionDescriptionPromise::promise): Deleted.
2995         (WebCore::WrappedSessionDescriptionPromise::WrappedSessionDescriptionPromise): Deleted.
2996         Not needed anymore.
2997
2998 2016-06-07  Nael Ouedraogo  <nael.ouedraogo@crf.canon.fr>
2999
3000         TouchList::append() should take a Ref instead of RefPtr
3001         https://bugs.webkit.org/show_bug.cgi?id=158469
3002
3003         Reviewed by Chris Dumez.
3004
3005         RefPtr<Touch> items handled in TouchList cannot be null. Thus
3006         RefPtr<Touch> is replaced by Ref<Touch> objects.
3007
3008         * bindings/js/JSDocumentCustom.cpp:
3009         (WebCore::JSDocument::createTouchList):
3010         * dom/TouchList.cpp:
3011         (WebCore::TouchList::item):
3012         * dom/TouchList.h:
3013         (WebCore::TouchList::append):
3014
3015 2016-06-07  Gyuyoung Kim  <gyuyoung.kim@webkit.org>
3016
3017         EFL build has been broken since r201761
3018         https://bugs.webkit.org/show_bug.cgi?id=158512
3019
3020         Unreviewed build fix.
3021
3022         * platform/posix/SharedBufferPOSIX.cpp: 
3023         (WebCore::SharedBuffer::createFromReadingFile):
3024         Do not use ? operand in return line. Additionally return nullptr instead of 0.
3025
3026 2016-06-07  Chris Dumez  <cdumez@apple.com>
3027
3028         Expose Event / EventTarget properties on WorkerGlobalScope
3029         https://bugs.webkit.org/show_bug.cgi?id=158511
3030
3031         Reviewed by Sam Weinig.
3032
3033         Expose Event / EventTarget properties on WorkerGlobalScope, as per the
3034         latest DOM specification:
3035         - https://dom.spec.whatwg.org/#interface-event
3036         - https://dom.spec.whatwg.org/#interface-eventtarget
3037
3038         No new tests, rebaselined existing test.
3039
3040         * dom/Event.idl:
3041         * dom/EventTarget.idl:
3042
3043 2016-06-07  Joonghun Park  <jh718.park@samsung.com>
3044
3045         [EFL] Build fix related with SharedBuffer::createFromReadingFile in SharedBufferPosix.cpp
3046         https://bugs.webkit.org/show_bug.cgi?id=158515
3047
3048         * platform/posix/SharedBufferPOSIX.cpp:
3049         (WebCore::SharedBuffer::createFromReadingFile):
3050
3051 2016-06-07  Mark Lam  <mark.lam@apple.com>
3052
3053         Need an exception check after constructEmptyArray().
3054         https://bugs.webkit.org/show_bug.cgi?id=158411
3055
3056         Reviewed by Saam Barati.
3057
3058         A stress test for this was added in JavaScriptCore.
3059
3060         * bindings/js/IDBBindingUtilities.cpp:
3061         (WebCore::toJS):
3062         * bindings/js/JSCommandLineAPIHostCustom.cpp:
3063         (WebCore::getJSListenerFunctions):
3064         * bindings/js/JSCryptoKeySerializationJWK.cpp:
3065         (WebCore::buildJSONForRSAComponents):
3066         (WebCore::addBoolToJSON):
3067         (WebCore::addUsagesToJSON):
3068         (WebCore::JSCryptoKeySerializationJWK::serialize):
3069         * bindings/js/JSDOMBinding.h:
3070         (WebCore::toJS):
3071         * bindings/js/SerializedScriptValue.cpp:
3072         (WebCore::CloneDeserializer::deserialize):
3073
3074 2016-06-07  Antoine Quint  <graouts@apple.com>
3075
3076         The backdrop-filter property does not respect border-radius
3077         https://bugs.webkit.org/show_bug.cgi?id=158483
3078         <rdar://problem/24210257>
3079
3080         Reviewed by Simon Fraser.
3081
3082         In order to correctly support border-radius and backdrop-filter together, we change
3083         the value set as the m_backdropFiltersRect from a FloatRect to FloatRoundedRect so
3084         that it accounts for values set by the border-radius property. Then we add a new
3085         m_backdropClippingLayer PlatformCALayer member to clip the backdrop layer in the
3086         event that the border-radius is non-zero in updateBackdropFiltersRect(). Finally,
3087         we follow the same pattern used for other PlatformCALayers owned by a GraphicsLayerCA
3088         to support cloning of the new m_backdropClippingLayer.
3089
3090         Tests: css3/filters/backdrop/backdrop-filter-with-border-radius-and-reflection-add.html
3091                css3/filters/backdrop/backdrop-filter-with-border-radius-and-reflection-remove.html
3092                css3/filters/backdrop/backdrop-filter-with-border-radius-and-reflection.html
3093                css3/filters/backdrop/backdrop-filter-with-border-radius-value-change.html
3094                css3/filters/backdrop/backdrop-filter-with-border-radius-value-remove.html
3095                css3/filters/backdrop/backdrop-filter-with-border-radius.html
3096
3097         * platform/graphics/GraphicsLayer.h:
3098         (WebCore::GraphicsLayer::setBackdropFiltersRect):
3099         (WebCore::GraphicsLayer::backdropFiltersRect):
3100         * platform/graphics/ca/GraphicsLayerCA.cpp:
3101         (WebCore::GraphicsLayerCA::willBeDestroyed):
3102         (WebCore::GraphicsLayerCA::setBackdropFiltersRect):
3103         (WebCore::GraphicsLayerCA::updateBackdropFiltersRect):
3104         (WebCore::GraphicsLayerCA::dumpAdditionalProperties):
3105         * platform/graphics/ca/GraphicsLayerCA.h:
3106         * rendering/RenderLayerBacking.cpp:
3107         (WebCore::RenderLayerBacking::updateBackdropFiltersGeometry):
3108         Use a rounded rect if there is no clip and we have non-zero border-radius set on the renderer.
3109
3110 2016-06-07  Andreas Kling  <akling@apple.com>
3111
3112         CachedScript should avoid recomputing its hash multiple times.
3113         <https://webkit.org/b/158506>
3114
3115         Reviewed by Saam Barati.
3116
3117         JSBench was hitting CachedScript::script() hard and spending lots of time hashing scripts.
3118         Since we're already caching the hash in a member variable, don't bother rehashing if we've
3119         already done it before.
3120
3121         This takes total time spent in StringImpl::hashSlowCase() from 1600ms to 77ms on my MBP.
3122
3123         * loader/cache/CachedScript.cpp:
3124         (WebCore::CachedScript::script):
3125
3126 2016-06-07  Keith Rollin  <krollin@apple.com>
3127
3128         Remove all uses of PassRefPtr in WTF
3129         https://bugs.webkit.org/show_bug.cgi?id=157596
3130         <rdar://problem/26234391>
3131
3132         Reviewed by Chris Dumez.
3133
3134         Update calls to interfaces that no longer take or return PassRefPtrs.
3135
3136         No new tests: no new functionality so changes are covered by existing
3137         tests.
3138
3139         * css/CSSPrimitiveValue.cpp:
3140         (WebCore::CSSPrimitiveValue::formatNumberValue):
3141         * dom/Document.cpp:
3142         (WebCore::Document::displayStringModifiedByEncoding):
3143         * xml/XPathGrammar.y:
3144
3145 2016-06-07  Myles C. Maxfield  <mmaxfield@apple.com>
3146
3147         Text-decoration-style: dashed / dotted rendered as solid
3148         https://bugs.webkit.org/show_bug.cgi?id=134336
3149
3150         Reviewed by Dean Jackson.
3151
3152         We already had most of the infrastructure for dotted / dashed underlines.
3153         Previously, we were setting the stroke style for the underlines, but then
3154         filling the underlines (which means the stroke styles is irrelevant).
3155         Instead, we should just compute the individual dots / dashes to fill.
3156
3157         The implementation of this is done inside GraphicsContext because
3158         GraphicsContext is already responsible for handling the single / double
3159         underline distinction. Extending it to be responsible for dotted / dashed
3160         is the natural thing to do.
3161
3162         Tests: fast/css3-text/css3-text-decoration/text-decoration-dashed.html
3163                fast/css3-text/css3-text-decoration/text-decoration-dotted-dashed.html
3164                fast/css3-text/css3-text-decoration/text-decoration-dotted.html
3165
3166         * platform/graphics/GraphicsContext.h:
3167         * platform/graphics/cairo/GraphicsContextCairo.cpp:
3168         (WebCore::GraphicsContext::drawLineForText):
3169         (WebCore::GraphicsContext::drawLinesForText):
3170         * platform/graphics/cg/GraphicsContextCG.cpp:
3171         (WebCore::GraphicsContext::drawLineForText):
3172         (WebCore::GraphicsContext::drawLinesForText):
3173         * rendering/TextDecorationPainter.cpp:
3174         (WebCore::drawSkipInkUnderline):
3175         (WebCore::TextDecorationPainter::paintTextDecoration):
3176
3177 2016-06-07  Chris Fleizach  <cfleizach@apple.com>
3178
3179         AX: iOS: Need to expose whether object is a dialog element
3180         https://bugs.webkit.org/show_bug.cgi?id=158487
3181         <rdar://problem/26678218>
3182
3183         Reviewed by Joanmarie Diggs.
3184
3185         Expose whether an object is a dialog type. This will allow decisions higher up the stack to be made in regards to where to move VoiceOver focus.
3186
3187         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
3188         (-[WebAccessibilityObjectWrapper accessibilityIsDialog]):
3189
3190 2016-06-07  Alex Christensen  <achristensen@webkit.org>
3191
3192         Fix Yosemite build.
3193         https://bugs.webkit.org/show_bug.cgi?id=158403
3194
3195         * platform/spi/cocoa/QuartzCoreSPI.h:
3196
3197 2016-06-07  Alex Christensen  <achristensen@webkit.org>
3198
3199         Fix WinCairo build.
3200
3201         * platform/network/curl/MultipartHandle.cpp:
3202         (WebCore::MultipartHandle::didReceiveResponse):
3203
3204 2016-06-07  Alex Christensen  <achristensen@webkit.org>
3205
3206         Build fix non-cocoa platforms.
3207         https://bugs.webkit.org/show_bug.cgi?id=158332
3208
3209         * loader/cache/CachedFont.cpp:
3210         (WebCore::CachedFont::createCustomFontData):
3211         * platform/network/ResourceHandle.cpp:
3212         (WebCore::ResourceHandle::continueWillSendRequest):
3213         * platform/network/curl/MultipartHandle.cpp:
3214         (WebCore::MultipartHandle::didReceiveResponse):
3215         * platform/network/curl/ResourceHandleManager.cpp:
3216         (WebCore::headerCallback):
3217
3218 2016-06-07  Sam Weinig  <sam@webkit.org>
3219
3220         Try to fix the 10.10 build.
3221
3222         * platform/spi/cocoa/QuartzCoreSPI.h:
3223
3224 2016-06-06  Alex Christensen  <achristensen@webkit.org>
3225
3226         Modernize loading code
3227         https://bugs.webkit.org/show_bug.cgi?id=158332
3228
3229         Reviewed by Darin Adler.
3230
3231         No new tests, no change in behavior.
3232
3233         * inspector/InspectorPageAgent.cpp:
3234         (WebCore::InspectorPageAgent::cachedResourceContent):
3235         * loader/DocumentLoader.cpp:
3236         (WebCore::DocumentLoader::continueAfterContentPolicy):
3237         * loader/FrameLoader.h:
3238         * loader/NetscapePlugInStreamLoader.cpp:
3239         (WebCore::NetscapePlugInStreamLoader::didReceiveData):
3240         (WebCore::NetscapePlugInStreamLoader::didReceiveBuffer):
3241         (WebCore::NetscapePlugInStreamLoader::didReceiveDataOrBuffer):
3242         (WebCore::NetscapePlugInStreamLoader::didFinishLoading):
3243         * loader/NetscapePlugInStreamLoader.h:
3244         * loader/ResourceLoader.cpp:
3245         (WebCore::ResourceLoader::deliverResponseAndData):
3246         (WebCore::ResourceLoader::loadDataURL):
3247         (WebCore::ResourceLoader::addDataOrBuffer):
3248         (WebCore::ResourceLoader::clearResourceData):
3249         (WebCore::ResourceLoader::didReceiveData):
3250         (WebCore::ResourceLoader::didReceiveBuffer):
3251         (WebCore::ResourceLoader::didReceiveDataOrBuffer):
3252         (WebCore::ResourceLoader::didFinishLoading):
3253         * loader/ResourceLoader.h:
3254         (WebCore::ResourceLoader::wasCancelled):
3255         (WebCore::ResourceLoader::options):
3256         * loader/SubresourceLoader.cpp:
3257         (WebCore::SubresourceLoader::didReceiveData):
3258         (WebCore::SubresourceLoader::didReceiveBuffer):
3259         (WebCore::SubresourceLoader::didReceiveDataOrBuffer):
3260         * loader/SubresourceLoader.h:
3261         * loader/appcache/ApplicationCacheGroup.cpp:
3262         (WebCore::ApplicationCacheGroup::abort):
3263         (WebCore::ApplicationCacheGroup::createResourceHandle):
3264         * loader/appcache/ApplicationCacheGroup.h:
3265         * loader/cache/CachedImage.cpp:
3266         (WebCore::CachedImage::addData):
3267         * loader/cache/CachedRawResourceClient.h:
3268         * platform/SharedBuffer.cpp:
3269         (WebCore::SharedBuffer::SharedBuffer):
3270         (WebCore::SharedBuffer::createWithContentsOfFile):
3271         (WebCore::SharedBuffer::adoptVector):
3272         (WebCore::SharedBuffer::duplicateDataBufferIfNecessary):
3273         (WebCore::SharedBuffer::appendToDataBuffer):
3274         (WebCore::SharedBuffer::clearDataBuffer):
3275         * platform/SharedBuffer.h:
3276         (WebCore::SharedBuffer::create):
3277         * platform/cf/SharedBufferCF.cpp:
3278         (WebCore::SharedBuffer::SharedBuffer):
3279         (WebCore::SharedBuffer::maybeAppendPlatformData):
3280         (WebCore::SharedBuffer::wrapCFDataArray):
3281         * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
3282         (ResourceHandleStreamingClient::didReceiveData):
3283         (ResourceHandleStreamingClient::didReceiveBuffer):
3284         * platform/mac/SharedBufferMac.mm:
3285         (WebCore::SharedBuffer::createCFData):
3286         (WebCore::SharedBuffer::createFromReadingFile):
3287         * platform/network/BlobRegistryImpl.cpp:
3288         (WebCore::BlobRegistryImpl::~BlobRegistryImpl):
3289         (WebCore::createBlobResourceHandle):
3290         (WebCore::loadBlobResourceSynchronously):
3291         (WebCore::registerBlobResourceHandleConstructor):
3292         (WebCore::BlobRegistryImpl::createResourceHandle):
3293         (WebCore::BlobRegistryImpl::appendStorageItems):
3294         (WebCore::createResourceHandle): Deleted.
3295         (WebCore::loadResourceSynchronously): Deleted.
3296         * platform/network/BlobRegistryImpl.h:
3297         * platform/network/BlobResourceHandle.cpp:
3298         (WebCore::BlobResourceHandle::createAsync):
3299         (WebCore::BlobResourceHandle::loadResourceSynchronously):
3300         Removed the overridden didReceiveData and didFinishLoading, 
3301         which did nothing and were identical to the function they overwrote.
3302         * platform/network/BlobResourceHandle.h:
3303         * platform/network/PingHandle.h:
3304         * platform/network/ResourceHandle.cpp:
3305         (WebCore::ResourceHandle::ResourceHandle):
3306         (WebCore::ResourceHandle::create):
3307         (WebCore::ResourceHandle::scheduleFailure):
3308         * platform/network/ResourceHandle.h:
3309         * platform/network/ResourceHandleClient.cpp:
3310         (WebCore::ResourceHandleClient::willCacheResponseAsync):
3311         (WebCore::ResourceHandleClient::didReceiveBuffer):
3312         * platform/network/ResourceHandleClient.h:
3313         (WebCore::ResourceHandleClient::didReceiveResponse):
3314         (WebCore::ResourceHandleClient::didReceiveData):
3315         (WebCore::ResourceHandleClient::didFinishLoading):
3316         (WebCore::ResourceHandleClient::didFail):
3317         * platform/network/cocoa/WebCoreNSURLSession.mm:
3318         (-[WebCoreNSURLSessionDataTask resource:receivedData:length:]):
3319         This data must be copied in order to put it in a refcounted NSData because it comes
3320         from IPC from the Network Process and is an IPC::DataReference which will be deallocated
3321         when the message handling is done.
3322         * platform/soup/SharedBufferSoup.cpp:
3323         (WebCore::SharedBuffer::SharedBuffer):
3324         * testing/MockContentFilter.cpp:
3325         (WebCore::MockContentFilter::replacementData):
3326         (WebCore::MockContentFilter::unblockHandler):
3327
3328 2016-06-06  Sam Weinig  <sam@webkit.org>
3329
3330         Add experimental support for spring based CSS animations
3331         https://bugs.webkit.org/show_bug.cgi?id=158403
3332
3333         Reviewed by Dean Jackson.
3334
3335         Adds experimental support for a new CSS animation timing function that uses
3336         spring to model the time function. To use it you replace your normal timing
3337         function, be it cubic-bezier or steps, with a new function called spring().
3338         For instance, for a transition you would write:
3339
3340             transition-timing-function: spring(1 100 10 0);
3341         
3342         The parameters are, in order:
3343             - Mass
3344             - Stiffness
3345             - Damping
3346             - Initial Velocity
3347
3348         Tests: animations/spring-computed-style.html
3349                animations/spring-function.html
3350                animations/spring-parsing.html
3351
3352         * WebCore.xcodeproj/project.pbxproj:
3353         Add new file.
3354
3355         * css/CSSComputedStyleDeclaration.cpp:
3356         (WebCore::createTimingFunctionValue):
3357         Modernize and add support for the spring function.
3358
3359         * css/CSSParser.cpp:
3360         (WebCore::CSSParserContext::CSSParserContext):
3361         (WebCore::operator==):
3362         (WebCore::CSSParser::CSSParser):
3363         (WebCore::CSSParser::parseTransformOriginShorthand):
3364         (WebCore::CSSParser::isSpringTimingFunctionEnabled):
3365         (WebCore::CSSParser::parseCubicBezierTimingFunctionValue):
3366         (WebCore::CSSParser::parseSpringTimingFunctionValue):
3367         (WebCore::CSSParser::parseAnimationTimingFunction):
3368         * css/CSSParser.h:
3369         * css/CSSParserMode.h:
3370         Add parsing support for the spring() function.
3371
3372         * css/CSSTimingFunctionValue.cpp:
3373         (WebCore::CSSCubicBezierTimingFunctionValue::customCSSText):
3374         (WebCore::CSSCubicBezierTimingFunctionValue::equals):
3375         (WebCore::CSSStepsTimingFunctionValue::customCSSText):
3376         (WebCore::CSSStepsTimingFunctionValue::equals):
3377         (WebCore::CSSSpringTimingFunctionValue::customCSSText):
3378         (WebCore::CSSSpringTimingFunctionValue::equals):
3379         * css/CSSTimingFunctionValue.h:
3380         (WebCore::CSSSpringTimingFunctionValue::create):
3381         (WebCore::CSSSpringTimingFunctionValue::mass):
3382         (WebCore::CSSSpringTimingFunctionValue::stiffness):
3383         (WebCore::CSSSpringTimingFunctionValue::damping):
3384         (WebCore::CSSSpringTimingFunctionValue::initialVelocity):
3385         (WebCore::CSSSpringTimingFunctionValue::CSSSpringTimingFunctionValue):
3386         Modernize and add support for the spring function.
3387
3388         * css/CSSToStyleMap.cpp:
3389         (WebCore::CSSToStyleMap::mapAnimationTimingFunction):
3390         Pipe the spring function into the animation.
3391
3392         * css/CSSValue.cpp:
3393         (WebCore::CSSValue::equals):
3394         (WebCore::CSSValue::cssText):
3395         (WebCore::CSSValue::destroy):
3396         * css/CSSValue.h:
3397         (WebCore::CSSValue::isSpringTimingFunctionValue):
3398         Add support for the spring function.
3399         
3400         * page/Settings.in:
3401         Add a setting to control if the spring function is enabled.
3402
3403         * page/animation/AnimationBase.cpp:
3404         (WebCore::solveSpringFunction):
3405         (WebCore::AnimationBase::progress):
3406         Add support for solving the spring function. Since the spring requires time to be absolute,
3407         get the real time by multiplying the ratio t, to the total duration.
3408
3409         * platform/animation/TimingFunction.cpp:
3410         (WebCore::operator<<):
3411         * platform/animation/TimingFunction.h:
3412         (WebCore::TimingFunction::~TimingFunction):
3413         (WebCore::TimingFunction::isSpringTimingFunction):
3414         Add support for the spring timing function.
3415
3416         * platform/graphics/SpringSolver.h: Added.
3417         (WebCore::SpringSolver::SpringSolver):
3418         (WebCore::SpringSolver::solve):
3419         Add a Spring solver that matches the one in CoreAnimation.
3420
3421         * platform/graphics/ca/GraphicsLayerCA.cpp:
3422         (WebCore::GraphicsLayerCA::createAnimationFromKeyframes):
3423         (WebCore::GraphicsLayerCA::appendToUncommittedAnimations):
3424         (WebCore::GraphicsLayerCA::createBasicAnimation):
3425         (WebCore::GraphicsLayerCA::createSpringAnimation):
3426         (WebCore::GraphicsLayerCA::setupAnimation):
3427         * platform/graphics/ca/GraphicsLayerCA.h:
3428         Map animations with spring timing functions to CASpringAnimations.
3429
3430         * platform/graphics/ca/PlatformCAAnimation.cpp:
3431         (WebCore::operator<<):
3432         (WebCore::PlatformCAAnimation::isBasicAnimation):
3433         * platform/graphics/ca/PlatformCAAnimation.h:
3434         (WebCore::PlatformCAAnimation::setActualStartTimeIfNeeded):
3435         (WebCore::PlatformCAAnimation::PlatformCAAnimation):
3436         * platform/graphics/ca/cocoa/PlatformCAAnimationCocoa.mm:
3437         (WebCore::toCAMediaTimingFunction):
3438         (PlatformCAAnimationCocoa::PlatformCAAnimationCocoa):
3439         (PlatformCAAnimationCocoa::setTimingFunction):
3440         (PlatformCAAnimationCocoa::copyTimingFunctionFrom):
3441         (PlatformCAAnimationCocoa::setFromValue):
3442         (PlatformCAAnimationCocoa::copyFromValueFrom):
3443         (PlatformCAAnimationCocoa::setToValue):
3444         (PlatformCAAnimationCocoa::copyToValueFrom):
3445         Add a new type of PlatformCAAnimation, Spring, which is a sub-type of Basic.
3446
3447 2016-06-05  Sam Weinig  <sam@webkit.org>
3448
3449         Add experimental support for spring based CSS animations
3450         https://bugs.webkit.org/show_bug.cgi?id=158403
3451
3452         Reviewed by Dean Jackson.
3453
3454         Adds experimental support for a new CSS animation timing function that uses
3455         spring to model the time function. To use it you replace your normal timing
3456         function, be it cubic-bezier or steps, with a new function called spring().
3457         For instance, for a transition you would write:
3458
3459             transition-timing-function: spring(1 100 10 0);
3460         
3461         The parameters are, in order:
3462             - Mass
3463             - Stiffness
3464             - Damping
3465             - Initial Velocity
3466
3467         Tests: animations/spring-computed-style.html
3468                animations/spring-function.html
3469                animations/spring-parsing.html
3470
3471         * WebCore.xcodeproj/project.pbxproj:
3472         Add new file.
3473
3474         * css/CSSComputedStyleDeclaration.cpp:
3475         (WebCore::createTimingFunctionValue):
3476         Modernize and add support for the spring function.
3477
3478         * css/CSSParser.cpp:
3479         (WebCore::CSSParserContext::CSSParserContext):
3480         (WebCore::operator==):
3481         (WebCore::CSSParser::CSSParser):
3482         (WebCore::CSSParser::parseTransformOriginShorthand):
3483         (WebCore::CSSParser::isSpringTimingFunctionEnabled):
3484         (WebCore::CSSParser::parseCubicBezierTimingFunctionValue):
3485         (WebCore::CSSParser::parseSpringTimingFunctionValue):
3486         (WebCore::CSSParser::parseAnimationTimingFunction):
3487         * css/CSSParser.h:
3488         * css/CSSParserMode.h:
3489         Add parsing support for the spring() function.
3490
3491         * css/CSSTimingFunctionValue.cpp:
3492         (WebCore::CSSCubicBezierTimingFunctionValue::customCSSText):
3493         (WebCore::CSSCubicBezierTimingFunctionValue::equals):
3494         (WebCore::CSSStepsTimingFunctionValue::customCSSText):
3495         (WebCore::CSSStepsTimingFunctionValue::equals):
3496         (WebCore::CSSSpringTimingFunctionValue::customCSSText):
3497         (WebCore::CSSSpringTimingFunctionValue::equals):
3498         * css/CSSTimingFunctionValue.h:
3499         (WebCore::CSSSpringTimingFunctionValue::create):
3500         (WebCore::CSSSpringTimingFunctionValue::mass):
3501         (WebCore::CSSSpringTimingFunctionValue::stiffness):
3502         (WebCore::CSSSpringTimingFunctionValue::damping):
3503         (WebCore::CSSSpringTimingFunctionValue::initialVelocity):
3504         (WebCore::CSSSpringTimingFunctionValue::CSSSpringTimingFunctionValue):
3505         Modernize and add support for the spring function.
3506
3507         * css/CSSToStyleMap.cpp:
3508         (WebCore::CSSToStyleMap::mapAnimationTimingFunction):
3509         Pipe the spring function into the animation.
3510
3511         * css/CSSValue.cpp:
3512         (WebCore::CSSValue::equals):
3513         (WebCore::CSSValue::cssText):
3514         (WebCore::CSSValue::destroy):
3515         * css/CSSValue.h:
3516         (WebCore::CSSValue::isSpringTimingFunctionValue):
3517         Add support for the spring function.
3518         
3519         * page/Settings.in:
3520         Add a setting to control if the spring function is enabled.
3521
3522         * page/animation/AnimationBase.cpp:
3523         (WebCore::solveSpringFunction):
3524         (WebCore::AnimationBase::progress):
3525         Add support for solving the spring function. Since the spring requires time to be absolute,
3526         get the real time by multiplying the ratio t, to the total duration.
3527
3528         * platform/animation/TimingFunction.cpp:
3529         (WebCore::operator<<):
3530         * platform/animation/TimingFunction.h:
3531         (WebCore::TimingFunction::~TimingFunction):
3532         (WebCore::TimingFunction::isSpringTimingFunction):
3533         Add support for the spring timing function.
3534
3535         * platform/graphics/SpringSolver.h: Added.
3536         (WebCore::SpringSolver::SpringSolver):
3537         (WebCore::SpringSolver::solve):
3538         Add a Spring solver that matches the one in CoreAnimation.
3539
3540         * platform/graphics/ca/GraphicsLayerCA.cpp:
3541         (WebCore::GraphicsLayerCA::createAnimationFromKeyframes):
3542         (WebCore::GraphicsLayerCA::appendToUncommittedAnimations):
3543         (WebCore::GraphicsLayerCA::createBasicAnimation):
3544         (WebCore::GraphicsLayerCA::createSpringAnimation):
3545         (WebCore::GraphicsLayerCA::setupAnimation):
3546         * platform/graphics/ca/GraphicsLayerCA.h:
3547         Map animations with spring timing functions to CASpringAnimations.
3548
3549         * platform/graphics/ca/PlatformCAAnimation.cpp:
3550         (WebCore::operator<<):
3551         (WebCore::PlatformCAAnimation::isBasicAnimation):
3552         * platform/graphics/ca/PlatformCAAnimation.h:
3553         (WebCore::PlatformCAAnimation::setActualStartTimeIfNeeded):
3554         (WebCore::PlatformCAAnimation::PlatformCAAnimation):
3555         * platform/graphics/ca/cocoa/PlatformCAAnimationCocoa.mm:
3556         (WebCore::toCAMediaTimingFunction):
3557         (PlatformCAAnimationCocoa::PlatformCAAnimationCocoa):
3558         (PlatformCAAnimationCocoa::setTimingFunction):
3559         (PlatformCAAnimationCocoa::copyTimingFunctionFrom):
3560         (PlatformCAAnimationCocoa::setFromValue):
3561         (PlatformCAAnimationCocoa::copyFromValueFrom):
3562         (PlatformCAAnimationCocoa::setToValue):
3563         (PlatformCAAnimationCocoa::copyToValueFrom):
3564         Add a new type of PlatformCAAnimation, Spring, which is a sub-type of Basic.
3565
3566 2016-06-07  Chris Dumez  <cdumez@apple.com>
3567
3568         Implement EventListenerOptions argument to addEventListener
3569         https://bugs.webkit.org/show_bug.cgi?id=149466
3570         <rdar://problem/22802031>
3571
3572         Reviewed by Dean Jackson.
3573
3574         Implement AddEventListenerOptions dictionary argument to addEventListener()
3575         and EventListenerOptions dictionary argument to removeEventListener(), as
3576         per the latest DOM specification:
3577         - https://dom.spec.whatwg.org/#interface-eventtarget
3578
3579         Firefox and Chrome already support this.
3580
3581         Support for AddEventListenerOptions in this patch is as follows:
3582         - 'capture': fully supported.
3583         - 'once': fully supported.
3584         - 'passive': supported in the sense that preventDefault() will be ignored
3585                      for passive event listeners. There are however currently no
3586                      performance benefits from passing this flag. Those optimizations
3587                      will be implemented in follow-up patches (in particular for
3588                      Touch and Scroll events).
3589
3590         Tests: fast/events/AddEventListenerOptions-once-recursive.html
3591                fast/events/AddEventListenerOptions-once.html
3592                fast/events/AddEventListenerOptions-passive.html
3593                fast/events/removeEventListener-EventListenerOptions-capture.html
3594                imported/w3c/web-platform-tests/dom/events/EventListenerOptions-capture.html
3595
3596         * Modules/webaudio/AudioScheduledSourceNode.cpp:
3597         (WebCore::AudioScheduledSourceNode::addEventListener):
3598         (WebCore::AudioScheduledSourceNode::removeEventListener):
3599         * Modules/webaudio/AudioScheduledSourceNode.h:
3600         * Modules/webaudio/ScriptProcessorNode.cpp:
3601         (WebCore::ScriptProcessorNode::addEventListener):
3602         (WebCore::ScriptProcessorNode::removeEventListener):
3603         * Modules/webaudio/ScriptProcessorNode.h:
3604         * bindings/scripts/CodeGeneratorJS.pm:
3605         (GenerateParametersCheckExpression):
3606         * dom/Event.h:
3607         (WebCore::Event::preventDefault):
3608         (WebCore::Event::setInPassiveListener):
3609         * dom/EventListenerMap.cpp:
3610         (WebCore::addListenerToVector):
3611         (WebCore::EventListenerMap::add):
3612         * dom/EventListenerMap.h:
3613         * dom/EventTarget.cpp:
3614         (WebCore::EventTarget::addEventListener):
3615         (WebCore::EventTarget::addEventListenerForBindings):
3616         (WebCore::EventTarget::removeEventListenerForBindings):
3617         (WebCore::EventTarget::removeEventListener):
3618         (WebCore::EventTarget::setAttributeEventListener):
3619         (WebCore::EventTarget::fireEventListeners):
3620         * dom/EventTarget.h:
3621         (WebCore::EventTarget::ListenerOptions::ListenerOptions):
3622         (WebCore::EventTarget::AddEventListenerOptions::AddEventListenerOptions):
3623         (WebCore::EventTarget::addEventListener):
3624         (WebCore::EventTarget::addEventListenerForBindings):
3625         (WebCore::EventTarget::removeEventListenerForBindings):
3626         * dom/EventTarget.idl:
3627         * dom/MessagePort.cpp:
3628         (WebCore::MessagePort::addEventListener):
3629         * dom/MessagePort.h:
3630         * dom/Node.cpp:
3631         (WebCore::tryAddEventListener):
3632         (WebCore::Node::addEventListener):
3633         (WebCore::tryRemoveEventListener):
3634         (WebCore::Node::removeEventListener):
3635         * dom/Node.h:
3636         * dom/RegisteredEventListener.h:
3637         (WebCore::RegisteredEventListener::Options::Options):
3638         (WebCore::RegisteredEventListener::RegisteredEventListener):
3639         (WebCore::operator==):
3640         * html/HTMLMediaElement.cpp:
3641         (WebCore::HTMLMediaElement::addEventListener):
3642         (WebCore::HTMLMediaElement::removeEventListener):
3643         * html/HTMLMediaElement.h:
3644         * page/DOMWindow.cpp:
3645         (WebCore::DOMWindow::addEventListener):
3646         (WebCore::DOMWindow::removeEventListener):
3647         * page/DOMWindow.h:
3648         * svg/SVGElement.cpp:
3649         (WebCore::SVGElement::addEventListener):
3650         (WebCore::SVGElement::removeEventListener):
3651         * svg/SVGElement.h:
3652
3653 2016-06-07  Brent Fulgham  <bfulgham@apple.com>
3654
3655         CSP: Content Security Policy directive, upgrade-insecure-requests (UIR)
3656         https://bugs.webkit.org/show_bug.cgi?id=143653
3657         <rdar://problem/23032067>
3658
3659         Reviewed by Andy Estes.
3660
3661         Modify our loading logic so that we recognize and upgrade insecure requests to secure
3662         requests if the Content Security Policy directive 'upgrade-insecure-requests' is
3663         present.
3664         
3665         Add a static helper function to ContentSecurityPolicy to upgrade insecure URLs so
3666         that we don't have to sprinkle the same code all over the loader system.
3667
3668         Tests: http/tests/security/contentSecurityPolicy/report-only-upgrade-insecure.php
3669                http/tests/security/contentSecurityPolicy/upgrade-insecure-requests/basic-upgrade-cors.https.html
3670                http/tests/security/contentSecurityPolicy/upgrade-insecure-requests/basic-upgrade.https.html
3671                http/tests/security/contentSecurityPolicy/upgrade-insecure-requests/form-upgrade.html
3672                http/tests/security/contentSecurityPolicy/upgrade-insecure-requests/https-header-auxiliary.html
3673                http/tests/security/contentSecurityPolicy/upgrade-insecure-requests/https-header-nested.html
3674                http/tests/security/contentSecurityPolicy/upgrade-insecure-requests/https-header-subresource.html
3675                http/tests/security/contentSecurityPolicy/upgrade-insecure-requests/https-header-top-level.html
3676                http/tests/security/contentSecurityPolicy/upgrade-insecure-requests/iframe-upgrade.https.html
3677                http/tests/security/contentSecurityPolicy/upgrade-insecure-requests/proper-nested-upgrades.html
3678                http/tests/security/contentSecurityPolicy/upgrade-insecure-requests/proper-open-window-upgrades.html
3679                http/tests/security/contentSecurityPolicy/upgrade-insecure-requests/upgrade-insecure-audio-video-in-main-frame.html
3680                http/tests/security/contentSecurityPolicy/upgrade-insecure-requests/upgrade-insecure-css-in-iframe.html
3681                http/tests/security/contentSecurityPolicy/upgrade-insecure-requests/upgrade-insecure-image-in-main-frame.html
3682                http/tests/security/contentSecurityPolicy/upgrade-insecure-requests/upgrade-simple-ws.html
3683                http/tests/security/contentSecurityPolicy/upgrade-insecure-requests/upgrade-insecure-xhr-in-main-frame.html
3684                http/tests/security/contentSecurityPolicy/upgrade-insecure-requests/upgrade-redirect-http-to-https-script-in-iframe.html
3685                http/tests/security/contentSecurityPolicy/upgrade-insecure-requests/upgrade-redirect-https-to-http-script-in-iframe.html
3686                http/tests/security/contentSecurityPolicy/upgrade-insecure-requests/upgrades-mixed-content.html
3687                http/tests/ssl/iframe-upgrade.https.html
3688                http/tests/ssl/upgrade-origin-usage.html
3689                http/tests/websocket/tests/hybi/upgrade-simple-ws.html
3690
3691         * Modules/websockets/WebSocket.cpp:
3692         (WebCore::WebSocket::connect): Upgrade insecure requests if the CSP
3693         indicates we should.
3694         * dom/Document.cpp:
3695         (WebCore::Document::initSecurityContext): Populate new document CSP with sets of upgrade host and port combinations.
3696         * dom/ScriptElement.cpp:
3697         (WebCore::ScriptElement::requestScript): Upgrade insecure requests if
3698         the CSP indicates we should.
3699         * html/HTMLMediaElement.cpp:
3700         (WebCore::HTMLMediaElement::loadResource): Ditto.
3701         * loader/DocumentWriter.cpp:
3702         (WebCore::DocumentWriter::begin): Ditto.
3703         * loader/FormSubmission.cpp:
3704         (WebCore::FormSubmission::create): Ditto.
3705         (WebCore::FormSubmission::populateFrameLoadRequest): Add "Upgrade-Insecure-Requests"
3706         header to frame load requests.
3707         * loader/FrameLoader.cpp:
3708         (WebCore::FrameLoader::addExtraFieldsToMainResourceRequest): Add the
3709         'Update-Insecure-Requests' header field if necessary.
3710         (WebCore::FrameLoader::addHTTPUpgradeInsecureRequestsIfNeeded): Added helper function.
3711         (WebCore::FrameLoader::loadPostRequest): Upgrade insecure requests if the CSP
3712         indicates we should.
3713         (WebCore::FrameLoader::loadResourceSynchronously): Ditto.
3714         (WebCore::FrameLoader::loadDifferentDocumentItem): If loading a form, add the
3715         'Update-Insecure-Requests' header field if necessary.
3716         (WebCore::createWindow): Upgrade insecure requests if the CSP
3717         indicates we should.
3718         * loader/FrameLoader.h:
3719         * loader/PingLoader.cpp:
3720         (WebCore::PingLoader::loadImage): Upgrade insecure requests if the CSP
3721         indicates we should.
3722         (WebCore::PingLoader::sendPing): Ditto.
3723         (WebCore::PingLoader::sendViolationReport): Ditto.
3724         * loader/ResourceLoader.cpp:
3725         (WebCore::ResourceLoader::willSendRequestInternal): Ditto.
3726         * loader/SubframeLoader.cpp:
3727         (WebCore::SubframeLoader::requestFrame): Ditto.
3728         (WebCore::SubframeLoader::requestObject): Ditto.
3729         * loader/appcache/ApplicationCacheHost.cpp:
3730         (WebCore::ApplicationCacheHost::shouldLoadResourceFromApplicationCache): Ditto.
3731         * loader/cache/CachedResourceLoader.cpp:
3732         (WebCore::CachedResourceLoader::requestImage): Ditto.
3733         (WebCore::CachedResourceLoader::requestResource): Ditto.
3734         * page/DOMWindow.cpp:
3735         (WebCore::DOMWindow::createWindow): Add the 'Update-Insecure-Requests' header
3736         field if necessary.
3737         * page/csp/ContentSecurityPolicy.cpp:
3738         (WebCore::ContentSecurityPolicy::copyStateFrom): Populate upgraded resource set
3739         from other context.
3740         (WebCore::ContentSecurityPolicy::upgradeInsecureRequestIfNeeded): Added helper function
3741         to upgrade requests when the upgrade-insecure-requests CSP policy is present, or if
3742         the host and port combination have previously been upgraded.
3743         (WebCore::ContentSecurityPolicy::upgradeInsecureNavigationRequestIfNeeded): Added
3744         helper function to upgrade requests that have been previously upgraded. Cross-site
3745         navigations only get upgraded when they have been previously upgraded.
3746         (WebCore::ContentSecurityPolicy::addInsecureNavigationRequestsToUpgrade): Added.
3747         (WebCore::ContentSecurityPolicy::populateInsecureNavigationRequestsToUpgradeFromOther): Added.
3748         * page/csp/ContentSecurityPolicy.h:
3749         (WebCore::ContentSecurityPolicy::setUpgradeInsecureRequests): Added.
3750         (WebCore::ContentSecurityPolicy::upgradeInsecureRequests): Added.
3751         * page/csp/ContentSecurityPolicyDirectiveList.cpp:
3752         (WebCore::ContentSecurityPolicyDirectiveList::ContentSecurityPolicyDirectiveList): Use
3753         more C++11 initializations.
3754         (WebCore::ContentSecurityPolicyDirectiveList::setUpgradeInsecureRequests): Added.
3755         (WebCore::ContentSecurityPolicyDirectiveList::addDirective): Teach this function to
3756         recognize the new directive.
3757         * page/csp/ContentSecurityPolicyDirectiveList.h:
3758         * page/csp/ContentSecurityPolicyDirectiveNames.cpp:
3759         * page/csp/ContentSecurityPolicyDirectiveNames.h:
3760         * platform/network/HTTPHeaderNames.in: Add new 'Upgrade-Insecure-Requests' header field.
3761         * xml/XMLHttpRequest.cpp:
3762         (WebCore::XMLHttpRequest::open): Upgrade insecure requests if the CSP if needed.
3763
3764 2016-06-07  Fujii Hironori  <Hironori.Fujii@sony.com>
3765
3766         Video elements are painted twice, in PaintPhaseForeground and PaintPhaseSelfOutline
3767         https://bugs.webkit.org/show_bug.cgi?id=158247
3768
3769         Reviewed by Simon Fraser.
3770
3771         Test: fast/replaced/outline-replaced-elements-offset.html
3772
3773         In <http://trac.webkit.org/changeset/105247>,
3774         RenderReplaced::paint was changed to call
3775         RenderReplaced::paintReplaced in PaintPhaseOutline and
3776         PaintPhaseSelfOutline to paint outline of SVG.
3777
3778         As the result, RenderVideo::paintReplaced paints twice,
3779         in forground and outline phase.
3780
3781         It was changed to paint outline of SVG in PaintPhaseForeground
3782         since <http://trac.webkit.org/changeset/168645>.  No need to call
3783         RenderReplaced::paintReplaced in outline phases anymore.
3784
3785         * rendering/RenderReplaced.cpp:
3786         (WebCore::RenderReplaced::paint): Return early if
3787         PaintPhaseOutline or PaintPhaseSelfOutline.
3788         Return early unless PaintPhaseForeground nor PaintPhaseSelection,
3789         even if canHaveChildren().
3790
3791 2016-06-07  Nael Ouedraogo  <nael.ouedraogo@crf.canon.fr>
3792
3793         Creating a TouchList with non Touch items should throw an exception
3794         https://bugs.webkit.org/show_bug.cgi?id=158302
3795
3796         Reviewed by Youenn Fablet.
3797
3798         Only Touch items should be passed to CreateTouchList function as per specification
3799         (https://w3c.github.io/touch-events/#extensions-to-the-document-interface).
3800         CreateTouchList function behavior is modified. An exception is thrown when non Touch items
3801         are passed as parameters instead of adding null items in the TouchList.
3802
3803         Tests have been modified to check whether behavior of CreateTouchList is correct.
3804
3805         * bindings/js/JSDocumentCustom.cpp:
3806         (WebCore::JSDocument::createTouchList):
3807         * dom/Document.idl:
3808
3809 2016-06-06  Commit Queue  <commit-queue@webkit.org>
3810
3811         Unreviewed, rolling out r201735.
3812         https://bugs.webkit.org/show_bug.cgi?id=158465
3813
3814         fast/events/AddEventListenerOptions-once-recursive.html fails
3815         on all bots (Requested by ap on #webkit).
3816
3817         Reverted changeset:
3818
3819         "Implement EventListenerOptions argument to addEventListener"
3820         https://bugs.webkit.org/show_bug.cgi?id=149466
3821         http://trac.webkit.org/changeset/201735
3822
3823 2016-06-06  Commit Queue  <commit-queue@webkit.org>
3824
3825         Unreviewed, rolling out r201679.
3826         https://bugs.webkit.org/show_bug.cgi?id=158464
3827
3828         http/tests/websocket/tests/hybi/upgrade-simple-ws.html is
3829         flaky (Requested by ap on #webkit).
3830
3831         Reverted changeset:
3832
3833         "CSP: Content Security Policy directive, upgrade-insecure-
3834         requests (UIR)"
3835         https://bugs.webkit.org/show_bug.cgi?id=143653
3836         http://trac.webkit.org/changeset/201679
3837
3838 2016-06-06  Jiewen Tan  <jiewen_tan@apple.com>
3839
3840         URLs containing tabs or newlines are parsed incorrectly
3841         https://bugs.webkit.org/show_bug.cgi?id=143381
3842         <rdar://problem/26567214>
3843
3844         Reviewed by Brent Fulgham.
3845
3846         1. Strip any tabs and newlines in the URL input.
3847         2. Replace the original stripping URL leading and trailing white spaces logic with WTFString's
3848         builtin, and move this logic to the very begining of the URL parser.
3849         3. Enhance the protocolIs method to ignore any leading whitespace/control characters, and
3850         tabs/newlines of the examining url.
3851
3852         Test: fast/url/tab-and-newline-stripping.html
3853
3854         * platform/URL.cpp:
3855         (WebCore::isTabNewline):
3856         (WebCore::shouldTrimFromURL):
3857         (WebCore::URL::init):
3858         (WebCore::protocolIs):
3859
3860 2016-06-02  Ryosuke Niwa  <rniwa@webkit.org>
3861
3862         Update the list of elements attachShadow is allowed
3863         https://bugs.webkit.org/show_bug.cgi?id=157706
3864
3865         Reviewed by Darin Adler.
3866
3867         Update the list of elements on which attachShadow is allowed per the latest shadow DOM spec:
3868         http://www.w3.org/TR/shadow-dom/#widl-Element-attachShadow-ShadowRoot-ShadowRootInit-shadowRootInitDict
3869         which now only allows attachShadow on the following elements and custom elements:
3870         button, details, input, marquee, meter, progress, select, textarea, keygen
3871
3872         In order to check that a given HTML element's local name is a valid custom element name,
3873         this patch moves CustomElementDefinitions::checkName to Document::validateCustomElementName so that
3874         it could be used when either SHADOW_DOM or CUSTOM_ELEMENTS build flag is turned on.
3875
3876         Also removed Element::canHaveUserAgentShadowRoot since it was only used in Element::attachShadow.
3877
3878         Test: fast/shadow-dom/Element-interface-attachShadow.html
3879
3880         * bindings/js/JSDocumentCustom.cpp:
3881         (WebCore::JSDocument::defineElement):
3882         * dom/CustomElementDefinitions.cpp:
3883         (WebCore::CustomElementDefinitions::checkName): Moved to Document::validateCustomElementName.
3884         * dom/CustomElementDefinitions.h:
3885         * dom/Document.cpp:
3886         (WebCore::createHTMLElementWithNameValidation):
3887         (WebCore::createFallbackHTMLElement):
3888         (WebCore::Document::validateCustomElementName): Moved from CustomElementDefinitions::checkName.
3889         * dom/Document.h:
3890         * dom/Element.cpp:
3891         (WebCore::canAttachAuthorShadowRoot): Added.
3892         (WebCore::Element::attachShadow):
3893         * dom/Element.h:
3894         * html/HTMLButtonElement.h:
3895         * html/HTMLDetailsElement.h:
3896         * html/HTMLInputElement.h:
3897         * html/HTMLKeygenElement.h:
3898         * html/HTMLMarqueeElement.h:
3899         * html/HTMLMediaElement.h:
3900         * html/HTMLMeterElement.h:
3901         * html/HTMLPlugInElement.h:
3902         * html/HTMLProgressElement.h:
3903         * html/HTMLQuoteElement.h:
3904         * html/HTMLSelectElement.h:
3905         * html/HTMLSummaryElement.h:
3906         * html/HTMLTagNames.in:
3907         * html/HTMLTextAreaElement.h:
3908         * html/HTMLUnknownElement.h:
3909         * html/parser/HTMLConstructionSite.cpp:
3910         (WebCore::HTMLConstructionSite::createHTMLElementOrFindCustomElementInterface):
3911
3912 2016-06-03  Ryosuke Niwa  <rniwa@webkit.org>
3913
3914         Crash inside moveOutOfAllShadowRoots
3915         https://bugs.webkit.org/show_bug.cgi?id=158378
3916
3917         Reviewed by Antti Koivisto.
3918
3919         The bug was caused by InShadowTreeFlag not being cleared when a shadow host or its ancestor was removed
3920         due to addChildNodesToDeletionQueue not invoking notifyChildNodeRemoved when a node was in a shadow tree
3921         but not in a document.
3922
3923         Fixed the bug by invoking notifyChildNodeRemoved when the removed node is either in a shadow tree
3924         or it's in a shadow tree. Also fixed a bug in VTTCue::~VTTCue that it was trying to remove the display
3925         tree even when the owner document was being destroyed. This results in various assertions to be hit.
3926
3927         Test: fast/shadow-dom/shadow-host-removal-crash.html
3928
3929         * dom/ContainerNodeAlgorithms.cpp:
3930         (WebCore::addChildNodesToDeletionQueue):
3931         * html/track/VTTCue.cpp:
3932         (WebCore::VTTCue::~VTTCue):
3933
3934 2016-06-06  Chris Dumez  <cdumez@apple.com>
3935
3936         Implement EventListenerOptions argument to addEventListener
3937         https://bugs.webkit.org/show_bug.cgi?id=149466
3938         <rdar://problem/22802031>
3939
3940         Reviewed by Dean Jackson.
3941
3942         Implement AddEventListenerOptions dictionary argument to addEventListener()
3943         and EventListenerOptions dictionary argument to removeEventListener(), as
3944         per the latest DOM specification:
3945         - https://dom.spec.whatwg.org/#interface-eventtarget
3946
3947         Firefox and Chrome already support this.
3948
3949         Support for AddEventListenerOptions in this patch is as follows:
3950         - 'capture': fully supported.
3951         - 'once': fully supported.
3952         - 'passive': supported in the sense that preventDefault() will be ignored
3953                      for passive event listeners. There are however currently no
3954                      performance benefits from passing this flag. Those optimizations
3955                      will be implemented in follow-up patches (in particular for
3956                      Touch and Scroll events).
3957
3958         Tests: fast/events/AddEventListenerOptions-once-recursive.html
3959                fast/events/AddEventListenerOptions-once.html
3960                fast/events/AddEventListenerOptions-passive.html
3961                fast/events/removeEventListener-EventListenerOptions-capture.html
3962                imported/w3c/web-platform-tests/dom/events/EventListenerOptions-capture.html
3963
3964         * Modules/webaudio/AudioScheduledSourceNode.cpp:
3965         (WebCore::AudioScheduledSourceNode::addEventListener):
3966         (WebCore::AudioScheduledSourceNode::removeEventListener):
3967         * Modules/webaudio/AudioScheduledSourceNode.h:
3968         * Modules/webaudio/ScriptProcessorNode.cpp:
3969         (WebCore::ScriptProcessorNode::addEventListener):
3970         (WebCore::ScriptProcessorNode::removeEventListener):
3971         * Modules/webaudio/ScriptProcessorNode.h:
3972         * bindings/scripts/CodeGeneratorJS.pm:
3973         (GenerateParametersCheckExpression):
3974         * dom/Event.h:
3975         (WebCore::Event::preventDefault):
3976         (WebCore::Event::setInPassiveListener):
3977         * dom/EventListenerMap.cpp:
3978         (WebCore::addListenerToVector):
3979         (WebCore::EventListenerMap::add):
3980         * dom/EventListenerMap.h:
3981         * dom/EventTarget.cpp:
3982         (WebCore::EventTarget::addEventListener):
3983         (WebCore::EventTarget::addEventListenerForBindings):
3984         (WebCore::EventTarget::removeEventListenerForBindings):
3985         (WebCore::EventTarget::removeEventListener):
3986         (WebCore::EventTarget::setAttributeEventListener):
3987         (WebCore::EventTarget::fireEventListeners):
3988         * dom/EventTarget.h:
3989         (WebCore::EventTarget::ListenerOptions::ListenerOptions):
3990         (WebCore::EventTarget::AddEventListenerOptions::AddEventListenerOptions):
3991         (WebCore::EventTarget::addEventListener):
3992         (WebCore::EventTarget::addEventListenerForBindings):
3993         (WebCore::EventTarget::removeEventListenerForBindings):
3994         * dom/EventTarget.idl:
3995         * dom/MessagePort.cpp: