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