70b353b80a16a919ad02848cd0942fb61d189222
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2017-02-02  Joseph Pecoraro  <pecoraro@apple.com>
2
3         Removed unused m_navigationStart from NavigatorGamepad
4         https://bugs.webkit.org/show_bug.cgi?id=167722
5
6         Reviewed by Yusuke Suzuki.
7
8         * Modules/gamepad/NavigatorGamepad.cpp:
9         (WebCore::NavigatorGamepad::NavigatorGamepad):
10         (WebCore::NavigatorGamepad::from):
11         * Modules/gamepad/NavigatorGamepad.h:
12         (WebCore::NavigatorGamepad::navigationStart): Deleted.
13
14 2017-02-02  Yongjun Zhang  <yongjun_zhang@apple.com>
15
16         In iOS, we should take background assertion when accessing localstorage databases.
17         https://bugs.webkit.org/show_bug.cgi?id=165478
18
19         Move WebSQLiteDatabaseTrackerClient from WebKitLegacy to WebCore so that it can be accessible from
20         WebKit1 and WebKit2. Previously, to avoid dependencies on UIKit, WebKitLegacy introduced several
21         global methods for UIKit to setup the start/end background task blocks on runtime (WebKitSetStartBackgroundTaskBlock,
22         WebKitSetInvalidWebBackgroundTaskIdentifier and WebKitSetEndBackgroundTaskBlock). Since we have to
23         move the background task handling to WebCore, to avoid adding WebCore dependencies on UIKit, this
24         patch introdues a new WebCore class WebBackgroundTaskController which holds the start/end background
25         task blocks. The existing WebKitSetStartBackgroundTaskBlock and WebKitSetEndBackgroundTaskBlock methods
26         in WebKit1 will use WebBackgroundTaskController to store the blocks set by UIKit. 
27
28         Reviewed by Brady Eidson.
29
30         No new test since this is code refactoring.
31
32         * WebCore.xcodeproj/project.pbxproj: Add a new class WebBackgroundTaskController to the project. Also move
33             WebSQLiteDatabaseTrackerClient from WebKitLegacy to WebCore.
34         * platform/ios/WebBackgroundTaskController.h: Use properties to hold the blocks for starting or ending background tasks.
35         * platform/ios/WebBackgroundTaskController.mm:
36         (+[WebBackgroundTaskController sharedController]):
37         (-[WebBackgroundTaskController dealloc]):
38         (-[WebBackgroundTaskController startBackgroundTaskWithExpirationHandler:]): Start a background task with a expiration handler;
39             to start the background task, we will use backgroundTaskStartBlock set up by UIKit.
40         (-[WebBackgroundTaskController endBackgroundTaskWithIdentifier:]): Call backgroundTaskEndBlack to end a background task.
41         * platform/ios/WebSQLiteDatabaseTrackerClient.h: Copied from Source/WebKit/ios/Storage/WebSQLiteDatabaseTrackerClient.h.
42         * platform/ios/WebSQLiteDatabaseTrackerClient.mm: Copied from Source/WebKit/ios/Storage/WebSQLiteDatabaseTrackerClient.mm.
43         (WebCore::WebSQLiteDatabaseTrackerClient::sharedWebSQLiteDatabaseTrackerClient): Make WebSQLiteDatabaseTrackerClient a singleton.
44         (WebCore::WebSQLiteDatabaseTrackerClient::WebSQLiteDatabaseTrackerClient): 
45         (WebCore::WebSQLiteDatabaseTrackerClient::~WebSQLiteDatabaseTrackerClient):
46         (WebCore::WebSQLiteDatabaseTrackerClient::willBeginFirstTransaction): Use a utility class WebDatabaseTransactionBackgroundTaskController
47             to schedule database transaction background task.
48         (WebCore::WebSQLiteDatabaseTrackerClient::didFinishLastTransaction): Use WebDatabaseTransactionBackgroundTaskController to stop
49             databas transaction background task.
50         (transactionBackgroundTaskIdentifierLock: Moved from Source/WebKit/mac/Storage/WebDatabaseManager.mm.
51         (setTransactionBackgroundTaskIdentifier): Ditto.
52         (getTransactionBackgroundTaskIdentifier): Ditto.
53         (+[WebDatabaseTransactionBackgroundTaskController startBackgroundTask]): Ditto.
54         (+[WebDatabaseTransactionBackgroundTaskController endBackgroundTask]): Ditto.
55
56 2017-02-01  Zan Dobersek  <zdobersek@igalia.com>
57
58         [EME] Implement MediaKeySession::update()
59         https://bugs.webkit.org/show_bug.cgi?id=167636
60
61         Reviewed by Xabier Rodriguez-Calvar.
62
63         Implement the MediaKeySession::update() method by following the steps as
64         they are described in the specification.
65
66         In order to sanitize the passed-in response data, CDM::sanitizeResponse()
67         is added. It passes the SharedBuffer object by reference to the CDMPrivate
68         interface implementor, which returns a SharedBuffer object containing
69         sanitized response data.
70
71         CDMInstance::updateLicense() virtual method is added to perform the license
72         update for some specific CDMInstance object. After the update the CDMInstance
73         invokes the callback that's passed to updateLicense(), providing information
74         about session being closed, changed keys or expiration value, any message
75         that has to be enqueued, and whether the update was successful.
76
77         After that callback is invoked, MediaKeySession::update() goes on to handle
78         all the provided information in a future task, finally resolving the promise
79         (or rejecting it beforehand in case of any failure during response handling
80         or license update).
81
82         Three algorithms that can be invoked from MediaKeySession::update() (key
83         status update, expiration update and session closure) will be implemented
84         separately. Placeholder methods are provided until then.
85
86         MockCDM::sanitizeResponse() and MockCDMInstance::updateLicense() are
87         implemented for testing purposes. For now only the response sanitization
88         and sanitized response format are checked there. Key status update,
89         expiration update and session closure should be tested once the
90         implementations for those algorithms are added.
91
92         Test: media/encrypted-media/mock-MediaKeySession-update.html
93
94         * Modules/encryptedmedia/CDM.cpp:
95         (WebCore::CDM::sanitizeResponse):
96         * Modules/encryptedmedia/CDM.h:
97         * Modules/encryptedmedia/CDMInstance.h:
98         * Modules/encryptedmedia/CDMPrivate.h:
99         * Modules/encryptedmedia/MediaKeySession.cpp:
100         (WebCore::MediaKeySession::update):
101         (WebCore::MediaKeySession::updateKeyStatuses):
102         (WebCore::MediaKeySession::updateExpiration):
103         (WebCore::MediaKeySession::sessionClosed):
104         * Modules/encryptedmedia/MediaKeySession.h:
105         * testing/MockCDMFactory.cpp:
106         (WebCore::MockCDM::sanitizeResponse):
107         (WebCore::MockCDMInstance::updateLicense):
108         * testing/MockCDMFactory.h:
109
110 2017-02-01  Eric Carlson  <eric.carlson@apple.com>
111
112         [Mac] Update CARingBuffer class
113         https://bugs.webkit.org/show_bug.cgi?id=167656
114         <rdar://problem/30318329>
115
116         Unreviewed fix the 32-bit build after r211539.
117
118         * platform/audio/mac/CAAudioStreamDescription.cpp:
119         (WebCore::CAAudioStreamDescription::CAAudioStreamDescription):
120
121 2017-02-01  Simon Fraser  <simon.fraser@apple.com>
122
123         [iOS WK2] With visual viewports, a fixed bottom bar can be clipped out when the keyboard is visible
124         https://bugs.webkit.org/show_bug.cgi?id=167710
125         rdar://problem/30100286
126
127         Reviewed by Wenson Hsieh.
128         
129         Add a bit of logging to show when RLC decides to not composite a fixed element which
130         is out of bounds.
131
132         Test: fast/visual-viewport/ios/bottom-bar-with-keyboard.html
133
134         * rendering/RenderLayerCompositor.cpp:
135         (WebCore::RenderLayerCompositor::requiresCompositingForPosition):
136
137 2017-02-01  Eric Carlson  <eric.carlson@apple.com>
138
139         [Mac] Update CARingBuffer class
140         https://bugs.webkit.org/show_bug.cgi?id=167656
141
142         Unreviewed build fix after r211539.
143
144         * platform/audio/mac/CAAudioStreamDescription.cpp:
145         (WebCore::CAAudioStreamDescription::CAAudioStreamDescription): Initialize a variable to fix
146         release builds.
147
148 2017-02-01  Eric Carlson  <eric.carlson@apple.com>
149
150         [Mac] Update CARingBuffer class
151         https://bugs.webkit.org/show_bug.cgi?id=167656
152
153         Reviewed by Jer Noble.
154
155         API test CARingBufferTest added.
156
157         * WebCore.xcodeproj/project.pbxproj: Add headers to framework so they can be used from the API test.
158
159         * platform/audio/AudioStreamDescription.h: Add Int32.
160
161         * platform/audio/mac/CAAudioStreamDescription.cpp:
162         (WebCore::CAAudioStreamDescription::CAAudioStreamDescription):
163         (WebCore::CAAudioStreamDescription::~CAAudioStreamDescription):
164         (WebCore::CAAudioStreamDescription::format): Support Int32.
165         (WebCore::CAAudioStreamDescription::operator==): Make inline.
166         * platform/audio/mac/CAAudioStreamDescription.h:
167
168         * platform/audio/mac/CARingBuffer.cpp:
169         (WebCore::CARingBuffer::CARingBuffer): Move initializers into class declaration.
170         (WebCore::CARingBuffer::allocate): Use flush method, get allocation info from a CAAudioStreamDescription.
171         (WebCore::FetchABL): Add a mode parameter to allow samples to replace or mix into destination.
172         (WebCore::CARingBuffer::flush): New.
173         (WebCore::CARingBuffer::fetch): Add mode parameter.
174         (WebCore::CARingBuffer::~CARingBuffer): Deleted.
175         * platform/audio/mac/CARingBuffer.h:
176         (WebCore::CARingBuffer::~CARingBuffer):
177
178         * platform/graphics/avfoundation/AudioSourceProviderAVFObjC.mm:
179         (WebCore::AudioSourceProviderAVFObjC::prepare): Use new CARingBuffer constructor.
180         (WebCore::operator==): Deleted.
181         (WebCore::operator!=): Deleted.
182
183         * platform/mediastream/mac/WebAudioSourceProviderAVFObjC.mm:
184         (WebCore::WebAudioSourceProviderAVFObjC::prepare): Use new CARingBuffer constructor
185         (WebCore::operator==): Deleted.
186         (WebCore::operator!=): Deleted.
187
188 2017-02-01  Zalan Bujtas  <zalan@apple.com>
189
190         Simple line layout: Move TextFragmentIterator::runWidth to ::textWidth.
191         https://bugs.webkit.org/show_bug.cgi?id=167705
192         <rdar://problem/30314393>
193
194         Reviewed by Antti Koivisto.
195
196         We also don't need to compute logicalHeight for logicalLeft/right since the
197         cases where it matters (floating boxes) are not supported by simple line layout. 
198
199         Covered by existing test.
200
201         * rendering/SimpleLineLayout.cpp:
202         (WebCore::SimpleLineLayout::updateLineConstrains):
203         * rendering/SimpleLineLayoutTextFragmentIterator.cpp:
204         (WebCore::SimpleLineLayout::nextBreakablePositionInSegment):
205         (WebCore::SimpleLineLayout::TextFragmentIterator::textWidth):
206         (WebCore::SimpleLineLayout::TextFragmentIterator::runWidth): Deleted.
207         * rendering/SimpleLineLayoutTextFragmentIterator.h:
208
209 2017-02-01  Jer Noble  <jer.noble@apple.com>
210
211         Fix compilation error under recent clang update
212         https://bugs.webkit.org/show_bug.cgi?id=167707
213
214         Reviewed by Eric Carlson.
215
216         Include TypedArrayInlines.h to fix a "missing symbol" link error when compiling under a recent clang update.
217
218         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
219
220 2017-02-01  Joseph Pecoraro  <pecoraro@apple.com>
221
222         Performance Timeline: Prepare for Worker support
223         https://bugs.webkit.org/show_bug.cgi?id=167633
224
225         Reviewed by Ryosuke Niwa.
226
227         Remove references to Document/Frame in Performance. Instead use
228         ScriptExecutionContext and pass in the time origin / SecurityOrigin
229         where it is relevant. No tests should change this is just refactoring.
230
231         * loader/ResourceTimingInformation.cpp:
232         (WebCore::ResourceTimingInformation::addResourceTiming):
233         * page/DOMWindow.cpp:
234         (WebCore::DOMWindow::performance):
235         * page/Performance.cpp:
236         (WebCore::Performance::Performance):
237         (WebCore::Performance::now):
238         (WebCore::Performance::reduceTimeResolution):
239         (WebCore::Performance::navigation):
240         (WebCore::Performance::timing):
241         (WebCore::Performance::addResourceTiming):
242         (WebCore::Performance::scriptExecutionContext): Deleted.
243         * page/Performance.h:
244         * page/Performance.idl:
245         * page/PerformanceResourceTiming.cpp:
246         (WebCore::monotonicTimeToDOMHighResTimeStamp):
247         (WebCore::passesTimingAllowCheck):
248         (WebCore::PerformanceResourceTiming::PerformanceResourceTiming):
249         (WebCore::PerformanceResourceTiming::redirectStart):
250         (WebCore::PerformanceResourceTiming::redirectEnd):
251         (WebCore::PerformanceResourceTiming::fetchStart):
252         (WebCore::PerformanceResourceTiming::domainLookupStart):
253         (WebCore::PerformanceResourceTiming::domainLookupEnd):
254         (WebCore::PerformanceResourceTiming::connectStart):
255         (WebCore::PerformanceResourceTiming::connectEnd):
256         (WebCore::PerformanceResourceTiming::secureConnectionStart):
257         (WebCore::PerformanceResourceTiming::requestStart):
258         (WebCore::PerformanceResourceTiming::responseStart):
259         (WebCore::PerformanceResourceTiming::responseEnd):
260         (WebCore::PerformanceResourceTiming::networkLoadTimeToDOMHighResTimeStamp):
261         (WebCore::monotonicTimeToDocumentMilliseconds): Deleted.
262         (WebCore::PerformanceResourceTiming::initiatorType): Deleted.
263         (WebCore::PerformanceResourceTiming::resourceTimeToDocumentMilliseconds): Deleted.
264         * page/PerformanceResourceTiming.h:
265         * page/PerformanceUserTiming.cpp:
266         (WebCore::UserTiming::findExistingMarkStartTime):
267
268 2017-02-01  Chris Dumez  <cdumez@apple.com>
269
270         REGRESSION(r205136): {}.toString.call(crossOriginWindow) should not throw
271         https://bugs.webkit.org/show_bug.cgi?id=167681
272         <rdar://problem/30301117>
273
274         Reviewed by Mark Lam.
275
276         As per https://html.spec.whatwg.org/#crossorigingetownpropertyhelper-(-o,-p-):
277         """
278         If P is @@toStringTag, @@hasInstance, or @@isConcatSpreadable, then return
279         PropertyDescriptor{ [[Value]]: undefined, [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }.
280         """
281
282         We now implement this behavior instead of throwing.
283
284         Test: http/tests/security/symbols-cross-origin.html
285
286         * bindings/js/JSDOMWindowCustom.cpp:
287         (WebCore::jsDOMWindowGetOwnPropertySlotRestrictedAccess):
288         * bindings/js/JSLocationCustom.cpp:
289         (WebCore::JSLocation::getOwnPropertySlotDelegate):
290
291 2017-02-01  Brent Fulgham  <bfulgham@apple.com>
292
293         Correct "filesHaveSameVolume" predicate
294         https://bugs.webkit.org/show_bug.cgi?id=167696
295         <rdar://problem/30298722>
296
297         Reviewed by David Kilzer.
298
299         We are passing %-encoded strings to the underlying operating system's file system APIs.
300         This doesn't work. Instead, we need to present a decoded version of the file path
301         that matches what the system APIs expect.
302
303         Tested by new TestWebKitAPI Test.
304
305         * platform/FileSystem.cpp:
306         (WebCore::filesHaveSameVolume): Make sure the file paths we give to the underlying
307         operating system are not percent encoded.
308         * platform/FileSystem.h: Export 'filesHaveSameVolume' for use by testing system.
309
310 2017-02-01  Antoine Quint  <graouts@apple.com>
311
312         [mac-wk1] LayoutTest media/modern-media-controls/tracks-support/tracks-support-click-track-in-panel.html is a flaky timeout
313         https://bugs.webkit.org/show_bug.cgi?id=165319
314         <rdar://problem/30284104>
315
316         Reviewed by Dean Jackson.
317
318         Running media/controls/track-menu.html before media/modern-media-controls/tracks-support/tracks-
319         support-click-track-in-panel.html makes that test time out in all test runs. The root of the issue
320         is that animations are suspended by media/controls/track-menu.html with a call to
321         internals.suspendAnimations(), and that state isn't reset with a call to internals.resumeAnimations().
322         Then, media/modern-media-controls/tracks-support/tracks-support-click-track-in-panel.html fails because
323         the selection animation for the tracks panel menu item that is clicked never completes and the delegate
324         to notify that an item in the tracks panel was selected is never fired, which leads to the test failure.
325
326         We change Internals::suspendAnimations() and Internals::resumeAnimations() to only affect the current
327         document, rather than calling into AnimationController::suspendAnimations() which would do just that,
328         but also set a Frame-wide flag that would prevent further animations from running, even in a subsequent
329         document load.
330
331         * dom/Document.cpp:
332         (WebCore::Document::prepareForDestruction): Ensure the document that is about to be destroyed is no longer
333         associated with an AnimationController.
334         * page/animation/AnimationController.cpp:
335         (WebCore::AnimationControllerPrivate::ensureCompositeAnimation): Update the animation's suspend state in case
336         the document its renderer is associated with is suspended. This is required since previously CompositeAnimations
337         would set their suspend state in their constructor, based on the Frame-wide suspended state, but there is no
338         document to use as a basis to query its suspended state in that constructor.
339         (WebCore::AnimationControllerPrivate::animationsAreSuspendedForDocument):
340         (WebCore::AnimationControllerPrivate::detachFromDocument):
341         (WebCore::AnimationControllerPrivate::suspendAnimationsForDocument):
342         (WebCore::AnimationControllerPrivate::resumeAnimationsForDocument):
343         (WebCore::AnimationControllerPrivate::startAnimationsIfNotSuspended):
344         (WebCore::AnimationController::animationsAreSuspendedForDocument):
345         (WebCore::AnimationController::detachFromDocument):
346         * page/animation/AnimationController.h:
347         * page/animation/AnimationControllerPrivate.h:
348         * testing/Internals.cpp:
349         (WebCore::Internals::animationsAreSuspended):
350         (WebCore::Internals::suspendAnimations):
351         (WebCore::Internals::resumeAnimations):
352
353 2017-02-01  Ryan Haddad  <ryanhaddad@apple.com>
354
355         Unreviewed build fix after r211488.
356
357         * accessibility/AXObjectCache.h: Removed property svn:executable.
358
359 2017-02-01  Brent Fulgham  <bfulgham@apple.com>
360
361         Unreviewed build fix.
362
363         * html/HTMLMediaElement.h: Removed property svn:executable.
364
365 2017-02-01  Jer Noble  <jer.noble@apple.com>
366
367         NULL-deref crash in TextTrack::removeCue()
368         https://bugs.webkit.org/show_bug.cgi?id=167615
369
370         Reviewed by Eric Carlson.
371
372         Test: http/tests/media/track-in-band-hls-metadata-crash.html
373
374         Follow-up to r211401. When passing around a reference to an object, the assumption is that
375         the caller is retaining the underlying object. This breaks down for
376         InbandDataTextTrack::removeDataCue(), which releases its own ownership of the cue object,
377         then passes the reference to that object to its superclass to do further remove steps. The
378         retain count of the cue can thus drop to zero within the scope of
379         InbandTextTrack::removeCue(). Use "take" semantics to remove the cue from the
380         m_incompleteCueMap without releasing ownership, and pass a reference to that retained object
381         on to removeCue(), guaranteeing that the cue will not be destroyed until after the
382         romeveDataCue() method returns.
383
384         * html/track/InbandDataTextTrack.cpp:
385         (WebCore::InbandDataTextTrack::removeDataCue):
386
387 2017-02-01  Nan Wang  <n_wang@apple.com>
388
389         AX: Incorrect range from index and length in text controls when there are newlines
390         https://bugs.webkit.org/show_bug.cgi?id=167677
391         <rdar://problem/30300099>
392
393         Reviewed by Chris Fleizach.
394
395         When there are newlines in text controls, the VisiblePosition that is created
396         from the index could be wrong. Because the index doesn't include the information 
397         regarding a position's affinity. Fixed it by using CharacterOffset instead, since
398         it doesn't require that information.
399
400         Test: accessibility/mac/range-for-contenteditable-newline.html
401
402         * accessibility/AXObjectCache.cpp:
403         (WebCore::AXObjectCache::traverseToOffsetInRange):
404         (WebCore::AXObjectCache::nextCharacterOffset):
405         (WebCore::AXObjectCache::characterOffsetForIndex):
406
407 2017-02-01  Timothy Hatcher  <timothy@hatcher.name>
408
409         AXObjectCache is missing two functions at link time when !HAVE(ACCESSIBILITY)
410         https://bugs.webkit.org/show_bug.cgi?id=167691
411
412         Reviewed by Chris Fleizach.
413
414         * accessibility/AXObjectCache.h:
415         (WebCore::AXObjectCache::recomputeDeferredIsIgnored): Added empty stub.
416         (WebCore::AXObjectCache::performDeferredIsIgnoredChange): Added empty stub.
417
418 2017-02-01  Timothy Hatcher  <timothy@hatcher.name>
419
420         HTMLMediaElement.h fails to build when ENABLE(MEDIA_CONTROLS_SCRIPT) is false
421         https://bugs.webkit.org/show_bug.cgi?id=167689
422
423         Reviewed by Joseph Pecoraro.
424
425         * html/HTMLMediaElement.h: Move mediaControlsHost() into the ENABLE(MEDIA_CONTROLS_SCRIPT)
426         block that is just above it to match m_mediaControlsHost.
427
428 2017-02-01  Romain Bellessort  <romain.bellessort@crf.canon.fr>
429
430         [Readable Streams API] Implement ReadableByteStreamController pull()
431         https://bugs.webkit.org/show_bug.cgi?id=167593
432
433         Reviewed by Youenn Fablet.
434
435         Implemented pull() method for ReadableByteStreamController. Also updated
436         pendingPullIntos attribute, which was a more complex object than necessary
437         (an array is enough).
438
439         Added 2 tests that allow covering most of new code. Code not yet tested will
440         become reachable as the rest of the spec is implemented (new tests will then
441         be added).
442
443         * Modules/streams/ReadableByteStreamInternals.js:
444         (privateInitializeReadableByteStreamController): Updated pendingPullIntos.
445         (readableByteStreamControllerCancel): Updated pendingPullIntos.
446         (readableByteStreamControllerClose): Updated pendingPullIntos.
447         (readableByteStreamControllerHandleQueueDrain): Added.
448         (readableByteStreamControllerPull): Added.
449
450 2017-02-01  Enrique Ocaña González  <eocanha@igalia.com>
451
452         [GStreamer][MSE] qtdemux: Update the tfdt patch to the version finally accepted upstream
453         https://bugs.webkit.org/show_bug.cgi?id=166529
454
455         Reviewed by Xabier Rodriguez-Calvar.
456
457         * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
458         (WebCore::AppendPipeline::AppendPipeline): Don't use the "always-honor-tfdt" property
459         in qtdemux anymore.
460
461 2017-02-01  Yusuke Suzuki  <utatane.tea@gmail.com>
462
463         Unreviewed, build fix for macOS and iOS ports, part 2
464
465         Annotate the function with static.
466
467         * bindings/js/ScriptModuleLoader.cpp:
468         (WebCore::rejectToPropagateNetworkError):
469
470 2017-02-01  Yusuke Suzuki  <utatane.tea@gmail.com>
471
472         Unreviewed, build fix for macOS and iOS ports
473
474         * bindings/js/ModuleFetchFailureKind.h: Renamed from Source/ModuleFetchFailureKind.h.
475
476 2017-02-01  Yusuke Suzuki  <utatane.tea@gmail.com>
477
478         Propagate networking errors correctly for import() operator
479         https://bugs.webkit.org/show_bug.cgi?id=167501
480
481         Reviewed by Ryosuke Niwa.
482
483         We use the promise chain inside the module loader pipeline.
484         The problem is that,
485
486         1. The errors of loading module scripts are propagated through the promise's rejection.
487         2. Some module related errors like syntax error (when scanning module dependencies) are
488            reported at loading time (evaluating time). These errors are propagated through the
489            promise rejections and dumped to the console. LoadableModuleScript set catch handler
490            for that and print these errors to the console for ScriptElement.
491         3. Some of errors are already reported to the console. For example, networking errors
492            are reported by the CachedModuleLoader.
493         4. But there is no way to distinguish between (2) and (3) at the catch handler.
494
495         Previously, we propagate the special symbol for the already reported errors to distinguish
496         that. This was OK because these errors cannot be catched by the user code. However,
497         recent `import()` call needs to expose these errors to the user code. So now, accidentally,
498         the special purpose symbol is exposed.
499
500         Instead of propagating the special symbol, this patch just propagates the errors. But these
501         error objects are annotated with the private symbol. So these errors can be distinguished
502         from the other ones.
503
504         Currently, we do not have the way to expose the error details to the client of the
505         CachedScript. So we just report the error with the failed / canceled. This should be
506         more descriptive error messages in the separate patch[1].
507
508         [1]: https://bugs.webkit.org/show_bug.cgi?id=167553
509
510         Tests: http/tests/security/mixedContent/import-insecure-script-in-iframe.html
511                js/dom/modules/import-not-found-error.html
512
513         * WebCore.xcodeproj/project.pbxproj:
514         * bindings/js/JSDOMPromise.h:
515         (WebCore::DeferredPromise::resolveWithCallback):
516         (WebCore::DeferredPromise::rejectWithCallback):
517         * bindings/js/ScriptController.cpp:
518         (WebCore::ScriptController::setupModuleScriptHandlers):
519         * bindings/js/ScriptController.h:
520         (WebCore::ScriptController::moduleLoaderAlreadyReportedErrorSymbol): Deleted.
521         (WebCore::ScriptController::moduleLoaderFetchingIsCanceledSymbol): Deleted.
522         * bindings/js/ScriptModuleLoader.cpp:
523         (WebCore::rejectToPropagateNetworkError):
524         (WebCore::ScriptModuleLoader::fetch):
525         (WebCore::ScriptModuleLoader::notifyFinished):
526         * bindings/js/WebCoreBuiltinNames.h:
527
528 2017-01-31  Wenson Hsieh  <wenson_hsieh@apple.com>
529
530         Regression (Safari 10.1): Pressing Return in a contenteditable no longer inserts a line break under certain conditions
531         https://bugs.webkit.org/show_bug.cgi?id=167525
532         <rdar://problem/30270210>
533
534         Reviewed by Ryosuke Niwa.
535
536         Test: fast/events/input-events-insert-newlines-after-mutation.html
537
538         Reverts an unintended change made while refactoring code for input events that caused input events to be
539         dispatched immediately rather than on the scoped queue. Normally, input events are dispatched in
540         CompositeEditCommand::apply after the end of the scope, but TypingCommands may fire input events *from within*
541         the scope by calling typingAddedToOpenCommand.
542
543         Instead, TypingCommands should always dispatch events
544         synchronously after the end of the scoped queue in CompositeEditCommand::apply, but this is a riskier change
545         than we should currently allow, so we should revert to our old behavior for the time being.
546
547         * editing/Editor.cpp:
548
549 2017-01-31  Zalan Bujtas  <zalan@apple.com>
550
551         Simple line layout: Do not assert on zero length/width trailing whitespace.
552         https://bugs.webkit.org/show_bug.cgi?id=167679
553
554         Reviewed by Simon Fraser.
555
556         It's valid to have an zero length/width trailing whitespace.
557
558         Covered by existing tests.
559
560         * rendering/SimpleLineLayout.cpp:
561         (WebCore::SimpleLineLayout::LineState::removeTrailingWhitespace): Zero length -> nothing to do.
562         Zero width with length > 0 (font-size: 0) -> remove trailing run.
563
564 2017-01-31  Alex Christensen  <achristensen@webkit.org>
565
566         Fix debug libwebrtc build after r211439
567         https://bugs.webkit.org/show_bug.cgi?id=167572
568
569         * platform/mediastream/libwebrtc/LibWebRTCAudioModule.cpp:
570         (WebCore::LibWebRTCAudioModule::OnMessage):
571
572 2017-01-31  Zalan Bujtas  <zalan@apple.com>
573
574         Simple line layout: Collect fragments in LineState only when needed for post-processing.
575         https://bugs.webkit.org/show_bug.cgi?id=167655
576         <rdar://problem/30290592>
577
578         Reviewed by Antti Koivisto.
579
580         The fragments we need to keep around for basic line breaking are the last and last non-whitespace fragments.
581         However in certain cases such as text-align: justify, we have to traverse the entire line
582         at post-processing which requires all the fragments on the current line.
583         This patch speeds up the basic line handling by using m_fragment list only for the special cases.
584         It improves PerformanceTests/Layout/simple-line-layout-non-repeating-text.html by ~7% (local measurement)
585         median: 114.25 runs/s -> median: 122.16 runs
586
587         Covered by existing tests.
588
589         * rendering/SimpleLineLayout.cpp:
590         (WebCore::SimpleLineLayout::LineState::setNeedsAllFragments):
591         (WebCore::SimpleLineLayout::LineState::hasTrailingWhitespace):
592         (WebCore::SimpleLineLayout::LineState::lastFragment):
593         (WebCore::SimpleLineLayout::LineState::expansionOpportunityCount):
594         (WebCore::SimpleLineLayout::LineState::isEmpty):
595         (WebCore::SimpleLineLayout::LineState::endPositionForCollapsedFragment):
596         (WebCore::SimpleLineLayout::LineState::appendFragmentAndCreateRunIfNeeded): Track uncompleted width.
597         (WebCore::SimpleLineLayout::LineState::revertToLastCompleteFragment):
598         (WebCore::SimpleLineLayout::LineState::removeTrailingWhitespace):
599         (WebCore::SimpleLineLayout::removeTrailingWhitespace):
600         (WebCore::SimpleLineLayout::updateLineConstrains): Set the slow path for text-align: justify.
601         (WebCore::SimpleLineLayout::createLineRuns):
602         (WebCore::SimpleLineLayout::closeLineEndingAndAdjustRuns):
603         (WebCore::SimpleLineLayout::createTextRuns):
604         * rendering/SimpleLineLayoutTextFragmentIterator.h:
605         (WebCore::SimpleLineLayout::TextFragmentIterator::TextFragment::isValid):
606         (WebCore::SimpleLineLayout::TextFragmentIterator::TextFragment::length):
607
608 2017-01-31  Chris Dumez  <cdumez@apple.com>
609
610         com.apple.WebKit.WebContent.Development crashed in com.apple.WebCore: WebCore::FrameView::didDestroyRenderTree
611         https://bugs.webkit.org/show_bug.cgi?id=167665
612         <rdar://problem/30241193>
613
614         Reviewed by Andreas Kling.
615
616         When destroying a PageCache entry, we would call Document::prepareFromDestruction()
617         which would destroy the render tree and then call FrameView::didDestroyRenderTree().
618         We would sometimes hit the ASSERT(m_widgetsInRenderTree.isEmpty()) assertion in
619         didDestroyRenderTree(). This indicates that there are still RenderWidgets associated
620         with the FrameView even though we claim we already destroyed the render tree.
621
622         The reason for this is that, in the PageCache context, the top document's frame is
623         reused on navigation and may not be associated with a new document that is currently
624         displayed, has a render tree (and possible RenderWidgets). The solution proposed is
625         to stop calling FrameView::didDestroyRenderTree() in Document::prepareFromDestruction()
626         if the frame's document is not |this|. This happens when the document is destroyed
627         while in PageCache. We do not want to mess with the frame / frameview in this case
628         since they are no longer associated to the present document anymore.
629
630         No new tests, already covered by existing tests which currently crash flakily.
631
632         * dom/Document.cpp:
633         (WebCore::Document::destroyRenderTree):
634
635 2017-01-31  Sam Weinig  <sam@webkit.org>
636
637         Remove unused/rarely used bindings helpers
638         https://bugs.webkit.org/show_bug.cgi?id=167648
639
640         Reviewed by Anders Carlsson.
641
642         * bindings/js/JSDOMBinding.cpp:
643         * bindings/js/JSDOMBinding.h:
644         (WebCore::jsString): Deleted.
645         (WebCore::jsStringOrUndefined): Deleted.
646         (WebCore::finiteInt32Value): Deleted.
647         (WebCore::toJS): Deleted.
648         Remove unused functions. The toJS overrides can be replaced with their
649         modern JSDOMConvert counterparts.
650         
651         * bindings/js/JSDOMExceptionHandling.h:
652         (WebCore::toJS): Deleted.
653         (WebCore::toJSNewlyCreated): Deleted.
654         Remove unused functions.
655
656         * bindings/js/JSDOMIterator.h:
657         Add more specific include of JSDOMConvert.h to fix compile.
658
659         * bindings/js/JSDOMPromise.cpp:
660         (WebCore::DeferredPromise::reject):
661         Create the Symbol directly, instead of using the toJS override.
662
663         * bindings/js/JSWorkerCustom.cpp:
664         (WebCore::constructJSWorker):
665         Use JSDOMConvert toJS function.
666
667         * bindings/js/JSXMLHttpRequestCustom.cpp:
668         (WebCore::JSXMLHttpRequest::retrieveResponse):
669         Use JSDOMConvert toJS functions.
670
671         * bindings/js/ScriptController.h:
672         Add missing forward declaration of URL.
673
674         * bindings/js/ScriptModuleLoader.cpp:
675         (WebCore::ScriptModuleLoader::resolve):
676         Create the Symbol directly, instead of using the toJS override.
677
678         * html/HTMLPlugInImageElement.cpp:
679         (WebCore::HTMLPlugInImageElement::didAddUserAgentShadowRoot):
680         Use JSDOMConvert toJS functions.
681
682 2017-01-31  Wenson Hsieh  <wenson_hsieh@apple.com>
683
684         WebItemProviderPasteboard should be robust when UIItemProvider fails to initialize an object
685         https://bugs.webkit.org/show_bug.cgi?id=167663
686         <rdar://problem/30294240>
687
688         Reviewed by Tim Horton.
689
690         Adds a nil check for the result of -createObjectOfClass:error:.
691
692         * platform/ios/WebItemProviderPasteboard.mm:
693         (-[WebItemProviderPasteboard valuesForPasteboardType:inItemSet:]):
694         (-[WebItemProviderPasteboard _tryToCreateAndAppendObjectOfClass:toArray:usingProvider:]):
695
696 2017-01-31  Keith Rollin  <krollin@apple.com>
697
698         Variable used after it's been WTFMove'd
699         https://bugs.webkit.org/show_bug.cgi?id=167658
700
701         Reviewed by Chris Dumez.
702
703         Rather than WTFMoving the variable as part of passing it to a function
704         that takes an RValue-ref, call copyRef to provide the RValue-ref. This
705         preserves the original variable for later use in the function.
706
707         No new tests -- this issue was found by inspection. It's not apparent
708         what the side-effect of this bug is or how a test would verify it.
709
710         * loader/SubresourceLoader.cpp:
711         (WebCore::SubresourceLoader::didReceiveDataOrBuffer):
712
713 2017-01-31  Anders Carlsson  <andersca@apple.com>
714
715         Apple Pay button does nothing on nytimes.com
716         https://bugs.webkit.org/show_bug.cgi?id=167664
717         rdar://problem/30273885
718
719         Reviewed by Sam Weinig.
720
721         Separate line item validation into convertAndValidateTotal and convertAndValidate. The former
722         works on totals (which require an amount), and the latter works on regular line items that do not require an amount
723         if the item type is "pending".
724
725         * Modules/applepay/ApplePaySession.cpp:
726         (WebCore::convertAndValidateTotal):
727         (WebCore::convertAndValidate):
728         Only check the amount if the type is not pending.
729
730         (WebCore::ApplePaySession::completeShippingMethodSelection):
731         (WebCore::ApplePaySession::completeShippingContactSelection):
732         (WebCore::ApplePaySession::completePaymentMethodSelection):
733         Call convertAndValidateTotal for totals.
734
735 2017-01-31  Youenn Fablet  <youenn@apple.com>
736
737         [WebRTC] Add a libwebrtc AudioModule specific to WebKit
738         https://bugs.webkit.org/show_bug.cgi?id=167572
739
740         Reviewed by Alex Christensen.
741
742         To be covered by webrtc audio tests.
743         Adding an AudioModule to circumvent the default LibWebRTC Audio Module which does the audio directly.
744         The implementation of the AudioModule is restricted to enable fueling the incoming audio tracks with incoming data.
745         Code inspired from https://chromium.googlesource.com/chromium/src/+/master/remoting/protocol/webrtc_audio_module.h
746
747         * WebCore.xcodeproj/project.pbxproj:
748         * platform/mediastream/libwebrtc/LibWebRTCAudioModule.cpp: Added.
749         (WebCore::LibWebRTCAudioModule::LibWebRTCAudioModule):
750         (WebCore::LibWebRTCAudioModule::RegisterAudioCallback):
751         (WebCore::LibWebRTCAudioModule::OnMessage):
752         (WebCore::LibWebRTCAudioModule::StartPlayout):
753         (WebCore::LibWebRTCAudioModule::StopPlayout):
754         (WebCore::LibWebRTCAudioModule::StartPlayoutOnAudioThread):
755         (WebCore::LibWebRTCAudioModule::PollFromSource):
756         * platform/mediastream/libwebrtc/LibWebRTCAudioModule.h: Added.
757         * platform/mediastream/libwebrtc/LibWebRTCUtils.cpp:
758         (WebCore::ThreadMessageData::ThreadMessageData):
759         (WebCore::initializePeerConnectionFactoryAndThreads):
760
761 2017-01-31  Jessie Berlin  <jberlin@webkit.org>
762
763         Build fix.
764
765         * editing/mac/EditorMac.mm:
766         (WebCore::Editor::pasteWithPasteboard):
767         (WebCore::Editor::takeFindStringFromSelection):
768         (WebCore::Editor::replaceNodeFromPasteboard):
769         * page/mac/EventHandlerMac.mm:
770         (WebCore::EventHandler::createDraggingDataTransfer):
771         * platform/mac/PasteboardMac.mm:
772         (WebCore::Pasteboard::createForCopyAndPaste):
773         (WebCore::Pasteboard::createForDragAndDrop):
774
775 2017-01-31  Eric Carlson  <eric.carlson@apple.com>
776
777         [Mac] Add an audio stream description class
778         https://bugs.webkit.org/show_bug.cgi?id=167639
779
780         Reviewed by Youenn Fablet.
781
782         No new tests, the new class is not used yet.
783
784         * WebCore.xcodeproj/project.pbxproj:
785         * platform/audio/AudioStreamDescription.h: Added.
786         (WebCore::AudioStreamDescription::isPCM):
787         * platform/audio/mac/CAAudioStreamDescription.cpp: Added.
788         (WebCore::CAAudioStreamDescription::CAAudioStreamDescription):
789         (WebCore::CAAudioStreamDescription::platformDescription):
790         (WebCore::CAAudioStreamDescription::format):
791         (WebCore::toCAAudioStreamDescription):
792         (WebCore::CAAudioStreamDescription::operator==):
793         (WebCore::operator==):
794         * platform/audio/mac/CAAudioStreamDescription.h: Added.
795         (WebCore::operator!=):
796         (WebCore::CAAudioStreamDescription::bytesPerFrame):
797         (WebCore::CAAudioStreamDescription::bytesPerPacket):
798         (WebCore::CAAudioStreamDescription::formatFlags):
799         (WebCore::CAAudioStreamDescription::operator==):
800         (WebCore::CAAudioStreamDescription::operator!=):
801         (WebCore::CAAudioStreamDescription::streamDescription):
802
803 2017-01-31  Youenn Fablet  <youenn@apple.com>
804
805         RTCPeerConnection methods can take dictionaries as input
806         https://bugs.webkit.org/show_bug.cgi?id=167590
807
808         Reviewed by Alex Christensen.
809
810         Test: webrtc/rtcpeerconnection-error-messages.html
811
812         Made addIceCandidate/setRemoteDescription/setLocalDescription take either dictionaries or objects as parameter.
813         Spec only mandates this for addIceCandidate, but sites may be using the old version for setRemoteDescription and setLocalDescription.
814
815         Updated RTCPeerConnection methods error messages.
816
817         * Modules/mediastream/RTCPeerConnection.js:
818         (getLocalStreams):
819         (getStreamById):
820         (addStream):
821         (createOffer):
822         (createAnswer):
823         (setLocalDescription):
824         (setRemoteDescription):
825         (addIceCandidate):
826         (getStats):
827         * Modules/mediastream/RTCPeerConnectionInternals.js:
828
829 2017-01-31  Simon Fraser  <simon.fraser@apple.com>
830
831         REGRESSION (r209411): Scrolling to a fragment identifier in overflow:scroll inside position:fixed no longer works
832         https://bugs.webkit.org/show_bug.cgi?id=167630
833         rdar://problem/30091558
834
835         Reviewed by Zalan Bujtas.
836         
837         r209411 added special handling for scrolling inside position:fixed, but cut off all scrolling, breaking
838         overflow:scroll inside position:fixed. Fix by only handling the position:fixed case when we get to 
839         the root layer, which is where we scroll the document.
840
841         Test: fast/overflow/scroll-anchor-in-overflow-in-position-fixed.html
842
843         * rendering/RenderLayer.cpp:
844         (WebCore::RenderLayer::getRectToExpose):
845
846 2017-01-31  Zan Dobersek  <zdobersek@igalia.com>
847
848         [EME] InitDataRegistry should use base64url encoding and decoding for keyids
849         https://bugs.webkit.org/show_bug.cgi?id=167592
850
851         Reviewed by Jer Noble.
852
853         In InitDataRegistry, WTF::base64URLEncode() and WTF::base64URLDecode() should
854         be used to encode and decode the 'keyids' initialization data format, as
855         required by the relevant specification.
856         https://w3c.github.io/encrypted-media/format-registry/initdata/keyids.html#format
857
858         Relevant test case was added to media/encrypted-media/mock-MediaKeySession-generateRequest.html.
859
860         * Modules/encryptedmedia/InitDataRegistry.cpp:
861         (WebCore::extractKeyIDsKeyids):
862         (WebCore::sanitizeKeyids):
863
864 2017-01-31  Joseph Pecoraro  <pecoraro@apple.com>
865
866         Performance Timeline: Add serializer to PerformanceEntry
867         https://bugs.webkit.org/show_bug.cgi?id=167632
868
869         Reviewed by Ryosuke Niwa.
870
871         Test: performance-api/performance-timeline-serializers.html
872
873         * page/PerformanceEntry.idl:
874
875 2017-01-31  Chris Fleizach  <cfleizach@apple.com>
876
877         AX: enable search predication for iOS
878         https://bugs.webkit.org/show_bug.cgi?id=167558
879         <rdar://problem/30251367>
880
881         Reviewed by Joanmarie Diggs.
882
883         Move the code to support accessibility searching into a shared place so it can be used by iOS.
884
885         Test: accessibility/ios-simulator/ios-search-predicate.html
886
887         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
888         (-[WebAccessibilityObjectWrapper accessibilityFindMatchingObjects:]):
889         * accessibility/mac/WebAccessibilityObjectWrapperBase.h:
890         * accessibility/mac/WebAccessibilityObjectWrapperBase.mm:
891         (convertToNSArray):
892         (createAccessibilitySearchKeyMap):
893         (accessibilitySearchKeyForString):
894         (accessibilitySearchCriteriaForSearchPredicateParameterizedAttribute):
895         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
896         (createAccessibilitySearchKeyMap): Deleted.
897         (accessibilitySearchKeyForString): Deleted.
898         (accessibilitySearchCriteriaForSearchPredicateParameterizedAttribute): Deleted.
899         (convertToNSArray): Deleted.
900
901 2017-01-30  Joseph Pecoraro  <pecoraro@apple.com>
902
903         [WebIDL] Add support for inherit serializer attribute
904         https://bugs.webkit.org/show_bug.cgi?id=167274
905
906         Reviewed by Darin Adler.
907
908         Support for serializer { inherit }, which will be used by Resource Timing.
909         https://heycam.github.io/webidl/#idl-serializers
910
911         * bindings/scripts/CodeGenerator.pm:
912         (GetInterfaceForAttribute):
913         (IsSerializableAttribute):
914         Determine if an attribute is serializable at generation time so we can
915         verify types. This allows us to support typedefs. We don't yet support
916         serializing an attribute that is itself a serializable interface.
917
918         * bindings/scripts/CodeGeneratorJS.pm:
919         (GenerateSerializerFunction):
920         (GenerateSerializerAttributesForInterface):
921         Generate inherited attributes first, then generate our own list.
922         Explicitly provided attribute names are expected to be serializable,
923         so produce an error if they are not.
924
925         * bindings/scripts/IDLParser.pm:
926         (parseSerializationAttributes):
927         Update parsing of serializer attributes to allow for multiple
928         special strings. The spec does not precisely define where the
929         special "attribute" keyword is allowed.
930
931         (applyMemberList):
932         (isSerializableAttribute): Deleted.
933         Move serializable attribute checking to generation.
934
935         * bindings/scripts/test/JS/JSTestSerialization.cpp:
936         * bindings/scripts/test/JS/JSTestSerializationInherit.cpp: Added.
937         * bindings/scripts/test/JS/JSTestSerializationInherit.h: Added.
938         * bindings/scripts/test/JS/JSTestSerializationInheritFinal.cpp: Added.
939         * bindings/scripts/test/JS/JSTestSerializationInheritFinal.h: Added.
940         The toJSON implementations are the most interesting.
941
942         * bindings/scripts/test/TestSerialization.idl:
943         Extend this test for typedefed attributes that are serializable.
944         Change TestNode (a serializable Interface) to TestException (an
945         unserializable Interface) for expected behavior of an
946         unserializable attribute.
947
948         * bindings/scripts/test/TestSerializationInherit.idl:
949         Test for { inherit, attribute }.
950
951         * bindings/scripts/test/TestSerializationInheritFinal.idl:
952         Test for { inherit, attribute_names... }, and multi-level inherit.
953
954 2017-01-30  Joseph Pecoraro  <pecoraro@apple.com>
955
956         Implement PerformanceObserver
957         https://bugs.webkit.org/show_bug.cgi?id=167546
958         <rdar://problem/30247959>
959
960         Reviewed by Ryosuke Niwa.
961
962         This implements PerformanceObserver from Performance Timeline Level 2:
963         https://w3c.github.io/performance-timeline/
964
965         Tests: performance-api/performance-observer-api.html
966                performance-api/performance-observer-basic.html
967                performance-api/performance-observer-callback-mutate.html
968                performance-api/performance-observer-callback-task.html
969                performance-api/performance-observer-entry-sort.html
970                performance-api/performance-observer-exception.html
971                performance-api/performance-observer-nested.html
972                performance-api/performance-observer-order.html
973                performance-api/performance-observer-periodic.html
974                performance-api/performance-timeline-api.html
975
976         * CMakeLists.txt:
977         * DerivedSources.make:
978         * WebCore.xcodeproj/project.pbxproj:
979         New files.
980
981         * page/Performance.h:
982         * page/Performance.cpp:
983         (WebCore::Performance::mark):
984         (WebCore::Performance::measure):
985         (WebCore::Performance::registerPerformanceObserver):
986         (WebCore::Performance::unregisterPerformanceObserver):
987         (WebCore::Performance::queueEntry):
988         Register PerformanceObservers with the Performance object.
989         When new PerformanceEntries are created (Mark and Measure
990         right now) check them against observers.
991
992         * page/PerformanceEntry.cpp:
993         (WebCore::PerformanceEntry::PerformanceEntry):
994         (WebCore::PerformanceEntry::typeForEntryTypeString):
995         * page/PerformanceEntry.h:
996         (WebCore::PerformanceEntry::type):
997         Give PerformanceEntry a convenience enum for easy comparison
998         and to know if it is one of the built-in known types (which the
999         PerformanceObserver API takes into account).
1000
1001         * page/PerformanceObserver.cpp: Added.
1002         (WebCore::PerformanceObserver::PerformanceObserver):
1003         (WebCore::PerformanceObserver::observe):
1004         (WebCore::PerformanceObserver::disconnect):
1005         (WebCore::PerformanceObserver::queueEntry):
1006         (WebCore::PerformanceObserver::deliver):
1007         * page/PerformanceObserver.h:
1008         (WebCore::PerformanceObserver::create):
1009         (WebCore::PerformanceObserver::typeFilter):
1010         - TypeErrors on observe bad behavior
1011         - Completely replace types filter on observe
1012         - Handle register and unregister
1013         - Handle calling the callback
1014
1015         * page/PerformanceObserverCallback.idl: Added.
1016         * page/PerformanceObserverEntryList.cpp: Added.
1017         (WebCore::PerformanceObserverEntryList::PerformanceObserverEntryList):
1018         (WebCore::PerformanceObserverEntryList::getEntries):
1019         (WebCore::PerformanceObserverEntryList::getEntriesByType):
1020         (WebCore::PerformanceObserverEntryList::getEntriesByName):
1021         * page/PerformanceObserverEntryList.h:
1022         (WebCore::PerformanceObserverEntryList::create):
1023         * page/PerformanceObserverEntryList.idl: Added.
1024         Implement sorting and filtering of entries.
1025
1026         * page/PerformanceObserver.idl: Added.
1027         * page/PerformanceObserverCallback.h:
1028         (WebCore::PerformanceObserverCallback::~PerformanceObserverCallback):
1029         Mostly autogenerated.
1030
1031         * page/PerformanceUserTiming.cpp:
1032         (WebCore::UserTiming::mark):
1033         (WebCore::UserTiming::measure):
1034         * page/PerformanceUserTiming.h:
1035         Update these to return the entry so it can be passed on to
1036         any interested PerformanceObservers.
1037
1038 2017-01-30  Youenn Fablet  <youenn@apple.com>
1039
1040         [WebRTC] getStats does not support legacy callback
1041         https://bugs.webkit.org/show_bug.cgi?id=167617
1042
1043         Reviewed by Alex Christensen.
1044
1045         Covered by updated tests.
1046
1047         * Modules/mediastream/RTCPeerConnection.cpp:
1048         (WebCore::RTCPeerConnection::getStats):
1049         (WebCore::RTCPeerConnection::privateGetStats): Deleted.
1050         * Modules/mediastream/RTCPeerConnection.h:
1051         * Modules/mediastream/RTCPeerConnection.idl:
1052         * Modules/mediastream/RTCPeerConnection.js:
1053         (addIceCandidate):
1054         (getStats): Deleted.
1055
1056 2017-01-30  Sam Weinig  <sam@webkit.org>
1057
1058         JSDOMBinding is too big. Split it up!
1059         https://bugs.webkit.org/show_bug.cgi?id=167601
1060
1061         Reviewed by Darin Adler.
1062
1063         Splits JSDOMBinding.h/cpp up a bit by splitting out:
1064         - JSDOMBindingCaller.h
1065         - JSDOMBindingSecurity.h/cpp
1066         - JSDOMExceptionHandling.h/cpp
1067         - JSDOMWrapperCache.h/cpp
1068
1069         Also:
1070         - Moves all constructor objects to JSDOMConstructor.h/cpp,  
1071         - Moves special DOMWindow accessors to JSDOMWindowBase.
1072         - Deletes unused CallbackFunction.h/cpp
1073
1074         * CMakeLists.txt:
1075         * Modules/webdatabase/Database.cpp:
1076         * WebCore.xcodeproj/project.pbxproj:
1077         * bindings/js/CallbackFunction.cpp: Removed.
1078         * bindings/js/CallbackFunction.h: Removed.
1079         * bindings/js/DOMConstructorWithDocument.h: Removed.
1080         * bindings/js/JSCryptoCustom.cpp:
1081         * bindings/js/JSCustomXPathNSResolver.cpp:
1082         * bindings/js/JSDOMBinding.cpp:
1083         * bindings/js/JSDOMBinding.h:
1084         * bindings/js/JSDOMBindingCaller.h: Copied from Source/WebCore/bindings/js/JSDOMBinding.h.
1085         * bindings/js/JSDOMBindingSecurity.cpp: Copied from Source/WebCore/bindings/js/JSDOMBinding.cpp.
1086         * bindings/js/JSDOMBindingSecurity.h: Copied from Source/WebCore/bindings/js/JSDOMBinding.h.
1087         * bindings/js/JSDOMConstructor.cpp: Copied from Source/WebCore/bindings/js/JSDOMBinding.cpp.
1088         * bindings/js/JSDOMConstructor.h:
1089         * bindings/js/JSDOMConvert.h:
1090         * bindings/js/JSDOMExceptionHandling.cpp: Copied from Source/WebCore/bindings/js/JSDOMBinding.cpp.
1091         * bindings/js/JSDOMExceptionHandling.h: Copied from Source/WebCore/bindings/js/JSDOMBinding.h.
1092         * bindings/js/JSDOMWindowBase.cpp:
1093         (WebCore::callerDOMWindow): Moved from JSDOMBinding.h
1094         (WebCore::activeDOMWindow): Moved from JSDOMBinding.h
1095         (WebCore::firstDOMWindow): Moved from JSDOMBinding.h
1096         * bindings/js/JSDOMWindowBase.h:
1097         * bindings/js/JSDOMWindowCustom.cpp:
1098         * bindings/js/JSDOMWindowProperties.cpp:
1099         * bindings/js/JSDOMWrapperCache.cpp: Copied from Source/WebCore/bindings/js/JSDOMBinding.cpp.
1100         * bindings/js/JSDOMWrapperCache.h: Copied from Source/WebCore/bindings/js/JSDOMBinding.h.
1101         * bindings/js/JSEventTargetCustom.h:
1102         * bindings/js/JSHTMLElementCustom.cpp:
1103         * bindings/js/JSLocationCustom.cpp:
1104         * bindings/js/JSMutationObserverCustom.cpp:
1105         * bindings/js/JSSQLStatementErrorCallbackCustom.cpp:
1106         * bindings/js/JSStorageCustom.cpp:
1107         * bindings/js/JSWorkerCustom.cpp:
1108         * bindings/js/JSXPathNSResolverCustom.cpp:
1109         * bindings/js/ScheduledAction.cpp:
1110         * bindings/js/ScriptController.cpp:
1111         * bindings/js/ScriptController.h:
1112         * bindings/js/ScriptGlobalObject.cpp:
1113         (WebCore::ScriptGlobalObject::set):
1114         * bindings/js/StructuredClone.cpp:
1115         * bindings/scripts/CodeGeneratorJS.pm:
1116         (GenerateImplementation):
1117         (GenerateCallWith):
1118         (GenerateParametersCheck):
1119         (GenerateCallbackImplementationContent):
1120         (NativeToJSValue):
1121         * bridge/objc/WebScriptObject.mm:
1122         * html/HTMLFrameElementBase.cpp:
1123         * html/HTMLVideoElement.cpp:
1124         * inspector/InspectorController.cpp:
1125         * inspector/InspectorDOMAgent.cpp:
1126         * inspector/PageScriptDebugServer.cpp:
1127         * inspector/WorkerScriptDebugServer.cpp:
1128
1129 2017-01-30  Andy Estes  <aestes@apple.com>
1130
1131         [QuickLook] FrameLoaderClient should return the new QuickLookHandleClient it creates
1132         https://bugs.webkit.org/show_bug.cgi?id=167625
1133
1134         Reviewed by Andreas Kling.
1135
1136         QuickLookHandleClients were being created by QuickLookHandle calling
1137         FrameLoaderClient::didCreateQuickLookHandle() then having the FrameLoaderClient create a new
1138         QuickLookHandleClient and set it using QuickLookHandle::setClient().
1139
1140         Since all FrameLoaderClient::didCreateQuickLookHandle() does is create a new
1141         QuickLookHandleClient, this patch changes the FrameLoaderClient function to return the new
1142         QuickLookHandleClient directly and removes the API from QuickLookHandle to set a client.
1143         This also removes previewFileName() and previewUTI() from QuickLookHandle and instead passes
1144         these as arguments to the FrameLoaderClient.
1145
1146         No change in behavior. Covered by existing tests.
1147
1148         * loader/EmptyClients.cpp: Added an implementation of createQuickLookHandleClient() that
1149         returns nullptr.
1150         * loader/FrameLoaderClient.h: Declared createQuickLookHandleClient() and removed
1151         didCreateQuickLookHandle().
1152         * loader/ios/QuickLook.h: Removed setClient(), previewFileName(), and previewUTI().
1153         * loader/ios/QuickLook.mm: Removed testingOrEmptyClient().
1154         (-[WebPreviewLoader initWithResourceLoader:resourceResponse:quickLookHandle:]): Set _client
1155         to testingClient() if it exists, otherwise set it to the client returned by
1156         FrameLoaderClient::createQuickLookHandleClient() it non-null, otherwise set it to
1157         emptyClient().
1158         (testingOrEmptyClient): Deleted.
1159         (-[WebPreviewLoader setClient:]): Deleted.
1160         (-[WebPreviewLoader converter]): Deleted.
1161         (WebCore::QuickLookHandle::setClient): Deleted.
1162         (WebCore::QuickLookHandle::previewFileName): Deleted.
1163         (WebCore::QuickLookHandle::previewUTI): Deleted.
1164
1165 2017-01-30  Jer Noble  <jer.noble@apple.com>
1166
1167         NULL-deref crash in TextTrack::removeCue()
1168         https://bugs.webkit.org/show_bug.cgi?id=167615
1169
1170         Reviewed by Eric Carlson.
1171
1172         It's possible for a track to be removed which was never actually added to the cue list.
1173         Specifically, if an in-band track with a negative start or end time was parsed, it would
1174         have been rejected by TextTrack::addCue(). When it comes time to flush those in-band cues,
1175         TextTrack::m_cues will still be NULL. Rather than ASSERT in this case, we should revert the
1176         behavior added in r210319 and throw an exception.
1177
1178         * html/track/TextTrack.cpp:
1179         (WebCore::TextTrack::removeCue):
1180
1181 2017-01-30  Andreas Kling  <akling@apple.com>
1182
1183         Fix CMSampleBuffer leak in MediaSampleAVFObjC::createNonDisplayingCopy().
1184         <https://webkit.org/b/167621>
1185
1186         Reviewed by Andy Estes.
1187
1188         We were failing to adopt the CMSampleBuffer after copying it. Seen on leaks bot.
1189
1190         * platform/graphics/avfoundation/objc/MediaSampleAVFObjC.mm:
1191         (WebCore::MediaSampleAVFObjC::createNonDisplayingCopy):
1192
1193 2017-01-30  Andy Estes  <aestes@apple.com>
1194
1195         [QuickLook] QLPreviewConverter and QuickLookHandle have different lifetime requirements
1196         https://bugs.webkit.org/show_bug.cgi?id=167609
1197
1198         Reviewed by Andreas Kling.
1199         
1200         Currently, QuickLookHandles are owned by DocumentLoader so that the underlying
1201         QLPreviewConverter stays alive to service subresource requests. However, the QuickLookHandle
1202         itself only needs to live long enough to handle the main resource load. And in a follow-on
1203         patch we will need to create QLPreviewConverters independent of QuickLookHandle.
1204
1205         This patch moves ownership of QuickLookHandle from DocumentLoader to ResourceLoader. It also
1206         creates a C++ wrapper around QLPreviewConverter and teaches QuickLookHandle to transfer
1207         ownership of the wrapper to DocumentLoader once the main resource conversion is complete.
1208
1209         No change in behavior. Covered by existing tests.
1210
1211         * WebCore.xcodeproj/project.pbxproj: Added PreviewConverter.{h,mm}.
1212         * loader/DocumentLoader.cpp:
1213         (WebCore::DocumentLoader::setPreviewConverter): Renamed from setQuickLookHandle().
1214         (WebCore::DocumentLoader::previewConverter): Renamed from quickLookHandle().
1215         (WebCore::DocumentLoader::setQuickLookHandle): Renamed to setPreviewConverter().
1216         * loader/DocumentLoader.h:
1217         (WebCore::DocumentLoader::quickLookHandle): Renamed to quickLookHandle().
1218         * loader/ResourceLoader.cpp:
1219         (WebCore::ResourceLoader::willSendRequestInternal): Changed to call PreviewConverter::safeRequest().
1220         (WebCore::ResourceLoader::isQuickLookResource): Changed to check if m_quickLookHandle is null.
1221         (WebCore::ResourceLoader::didCreateQuickLookHandle): Deleted.
1222         * loader/ResourceLoader.h:
1223         * loader/SubresourceLoader.cpp:
1224         (WebCore::SubresourceLoader::shouldCreateQuickLookHandleForResponse): Changed to access m_quickLookHandle.
1225         (WebCore::SubresourceLoader::didReceiveResponse): Ditto.
1226         (WebCore::SubresourceLoader::didReceiveData): Ditto.
1227         (WebCore::SubresourceLoader::didReceiveBuffer): Ditto.
1228         (WebCore::SubresourceLoader::didFinishLoading): Ditto.
1229         (WebCore::SubresourceLoader::didFail): Ditto.
1230         * loader/cache/CachedRawResource.cpp:
1231         (WebCore::CachedRawResource::finishLoading): Wrapped the call to ResourceLoader::isQuickLookResource() in USE(QUICK_LOOK).
1232         * loader/ios/QuickLook.h: Renamed m_converter to m_previewLoader.
1233         * loader/ios/QuickLook.mm: Renamed WebPreviewConverter to WebPreviewLoader.
1234         (WebCore::registerQLPreviewConverterIfNeeded): Created a PreviewConverter instead of a QLPreviewConverter.
1235         (-[WebPreviewLoader initWithResourceLoader:resourceResponse:quickLookHandle:]): Ditto.
1236         (-[WebPreviewLoader appendDataArray:]): Accessed the QLPreviewConverter from the PreviewConverter.
1237         (-[WebPreviewLoader finishedAppending]): Ditto.
1238         (-[WebPreviewLoader failed]): Ditto.
1239         (-[WebPreviewLoader converter]): Renamed from platformConverter. Returns a pointer to the PreviewConverter.
1240         (-[WebPreviewLoader _sendDidReceiveResponseIfNecessary]): Moved _converter to DocumentLoader.
1241         (-[WebPreviewLoader connection:didFailWithError:]): Created a PreviewConverter instead of a QLPreviewConverter.
1242         (WebCore::QuickLookHandle::QuickLookHandle): Called FrameLoaderClient::didCreateQuickLookHandle() instead of going through FrameLoader.
1243         (WebCore::QuickLookHandle::didReceiveData): Renamed m_converter to m_previewLoader.
1244         (WebCore::QuickLookHandle::didReceiveBuffer): Ditto.
1245         (WebCore::QuickLookHandle::didFinishLoading): Ditto.
1246         (WebCore::QuickLookHandle::didFail): Ditto.
1247         (WebCore::QuickLookHandle::setClient): Ditto.
1248         (WebCore::QuickLookHandle::previewFileName): Ditto.
1249         (WebCore::QuickLookHandle::previewUTI): Ditto.
1250         (WebCore::QuickLookHandle::willSendRequest): Deleted.
1251         * platform/ios/QuickLookSoftLink.h: Removed soft-linking of QLPreviewConverter and kQLPreviewOptionPasswordKey.
1252         * platform/ios/QuickLookSoftLink.mm: Ditto.
1253         * platform/network/ios/PreviewConverter.h: Added.
1254         (WebCore::PreviewConverter::platformConverter): Added. Returns the underlying QLPreviewConverter.
1255         * platform/network/ios/PreviewConverter.mm: Added.
1256         (WebCore::optionsWithPassword): Creates a dictionary with the kQLPreviewOptionPasswordKey option set if password is non-null.
1257         (WebCore::PreviewConverter::PreviewConverter): Added constructors for the delegate/response and data/uti cases.
1258         (WebCore::PreviewConverter::safeRequest): Wraps -[QLPreviewConverter safeRequestForRequest:].
1259         (WebCore::PreviewConverter::previewRequest): Wraps -[QLPreviewConverter previewRequest].
1260         (WebCore::PreviewConverter::previewResponse): Wraps -[QLPreviewConverter previewResponse].
1261         (WebCore::PreviewConverter::previewFileName): Wraps -[QLPreviewConverter previewFileName].
1262         (WebCore::PreviewConverter::previewUTI): Wraps -[QLPreviewConverter previewUTI].
1263
1264 2017-01-30  Chris Dumez  <cdumez@apple.com>
1265
1266         Drop legacy Attributes.isId attribute
1267         https://bugs.webkit.org/show_bug.cgi?id=167603
1268
1269         Reviewed by Ryosuke Niwa.
1270
1271         Drop legacy Attributes.isId attribute.
1272
1273         This attribute is not in the specification:
1274         - https://dom.spec.whatwg.org/#interface-attr
1275
1276         Both Firefox and Chrome currently do not expose this attribute.
1277
1278         No new tests, rebaselined existing test.
1279
1280         * dom/Attr.cpp:
1281         * dom/Attr.h:
1282         * dom/Attr.idl:
1283
1284 2017-01-30  Zalan Bujtas  <zalan@apple.com>
1285
1286         Simple line layout: Small tweaks to improve performance.
1287         https://bugs.webkit.org/show_bug.cgi?id=167611
1288         <rdar://problem/30274294>
1289
1290         Reviewed by Simon Fraser.
1291
1292         This is ~10% progression on the attached test case (paragraphs with non-redundant content).
1293         median: 102.08 runs/s -> median: 114.25 runs/s
1294
1295         * rendering/SimpleLineLayout.cpp:
1296         (WebCore::SimpleLineLayout::LineState::appendFragmentAndCreateRunIfNeeded):
1297         * rendering/SimpleLineLayoutFlowContents.cpp:
1298         (WebCore::SimpleLineLayout::initializeSegments):
1299         (WebCore::SimpleLineLayout::FlowContents::FlowContents):
1300         * rendering/SimpleLineLayoutFlowContents.h:
1301         * rendering/SimpleLineLayoutTextFragmentIterator.cpp:
1302         (WebCore::SimpleLineLayout::TextFragmentIterator::nextNonWhitespacePosition):
1303         (WebCore::SimpleLineLayout::TextFragmentIterator::skipToNextPosition):
1304         * rendering/SimpleLineLayoutTextFragmentIterator.h:
1305
1306 2017-01-30  Chris Dumez  <cdumez@apple.com>
1307
1308         Drop legacy constants on Event interface
1309         https://bugs.webkit.org/show_bug.cgi?id=167602
1310
1311         Reviewed by Sam Weinig.
1312
1313         Drop legacy constants on Event interface:
1314         MOUSEDOWN, MOUSEUP, MOUSEOVER, MOUSEOUT, MOUSEMOVE, MOUSEDRAG,
1315         CLICK, DBLCLICK, KEYDOWN, KEYUP, KEYPRESS, DRAGDROP, FOCUS,
1316         BLUR, SELECT, and CHANGE.
1317
1318         Those constants are not used for anything, they are not in the
1319         specification and Chrome / Firefox do not have them.
1320
1321         No new tests, rebaselined existing test.
1322
1323         * dom/Event.idl:
1324
1325 2017-01-30  Simon Fraser  <simon.fraser@apple.com>
1326
1327         [iOS] position:fixed inside touch-scrollable overflow is mispositioned
1328         https://bugs.webkit.org/show_bug.cgi?id=167604
1329         rdar://problem/29500273
1330
1331         Reviewed by Zalan Bujtas.
1332         
1333         For layers inside touch-scrollable overflow, RenderLayerBacking::computeParentGraphicsLayerRect() needs
1334         to account for the offset from the ancestor compositing layer's origin, to handle scrollable elements with
1335         box-shadow, for example.
1336         
1337         Also make the compositing log output a little easier to read.
1338
1339         Test: compositing/scrolling/fixed-inside-scroll.html
1340
1341         * rendering/RenderLayerBacking.cpp:
1342         (WebCore::RenderLayerBacking::computeParentGraphicsLayerRect):
1343         * rendering/RenderLayerCompositor.cpp:
1344         (WebCore::RenderLayerCompositor::logLayerInfo):
1345
1346 2017-01-30  Jer Noble  <jer.noble@apple.com>
1347
1348         NULL-deref crash at PlatformMediaSession::endInterruption
1349         https://bugs.webkit.org/show_bug.cgi?id=167595
1350
1351         Reviewed by Eric Carlson.
1352
1353         Use the same, NULL-aware forEachSession() iterator rather than iterating over m_sessions directly.
1354
1355         * platform/audio/PlatformMediaSessionManager.cpp:
1356         (WebCore::PlatformMediaSessionManager::beginInterruption):
1357         (WebCore::PlatformMediaSessionManager::endInterruption):
1358
1359 2017-01-30  Myles C. Maxfield  <mmaxfield@apple.com>
1360
1361         Correct spacing regression on inter-element complex path shaping on some fonts
1362         https://bugs.webkit.org/show_bug.cgi?id=166013
1363
1364         Reviewed by Simon Fraser.
1365
1366         This patch brings the implementation of ComplexTextController in-line with the
1367         design at https://trac.webkit.org/wiki/ComplexTextController. Previously,
1368         ComplexTextController had a few problems:
1369         - The total width computed by ComplexTextController didn't match the width if
1370         you iterated over the entire string and added up the advances
1371         - FontCascade::getGlyphsAndAdvancesForComplexText() tried to compensate for
1372         the above by construing the concepts of paint advances as distinct from layout
1373         advances
1374         - Initial advances were considered part of layout sometimes and part of painting
1375         other times, depending on which function reports the information
1376         - For RTL runs, the wrong origin was added to the initial advance, and the origin
1377         should have been subtracted instead of added
1378
1379         This patch exhaustively updates every function in ComplexTextController to be
1380         consistent with the design linked to above. This design solves all of these
1381         problems.
1382
1383         Tests: ComplexTextControllerTest.InitialAdvanceWithLeftRunInRTL
1384                ComplexTextControllerTest.InitialAdvanceInRTL
1385                ComplexTextControllerTest.InitialAdvanceWithLeftRunInLTR
1386                ComplexTextControllerTest.InitialAdvanceInLTR
1387                ComplexTextControllerTest.InitialAdvanceInRTLNoOrigins
1388                ComplexTextControllerTest.LeadingExpansion
1389                ComplexTextControllerTest.VerticalAdvances
1390
1391         * platform/graphics/GlyphBuffer.h:
1392         (WebCore::GlyphBuffer::setLeadingExpansion): Deleted. No longer necessary.
1393         (WebCore::GlyphBuffer::leadingExpansion): Deleted. Ditto.
1394         * platform/graphics/cocoa/FontCascadeCocoa.mm:
1395         (WebCore::FontCascade::adjustSelectionRectForComplexText): Removed use of
1396         unnecessary leadingExpansion().
1397         (WebCore::FontCascade::getGlyphsAndAdvancesForComplexText): This function needs
1398         to compute paint advances, which means that it can't base this information off
1399         of layout advances. This function uses the trick mentioned at the end of the
1400         above link to compute the paint offset of an arbitrary glyph in the middle of
1401         an RTL run.
1402         * platform/graphics/mac/ComplexTextController.cpp:
1403         (WebCore::ComplexTextController::computeExpansionOpportunity): Refactored for
1404         testing.
1405         (WebCore::ComplexTextController::ComplexTextController): Ditto.
1406         (WebCore::ComplexTextController::finishConstruction): Ditto.
1407         (WebCore::ComplexTextController::offsetForPosition): This function operates on
1408         layout advances, and the initial layout advance is already added into the
1409         m_adjustedBaseAdvances vector by adjustGlyphsAndAdvances(). Therefore, there is
1410         no need to add it again here.
1411         (WebCore::ComplexTextController::advance): This function had completely busted
1412         logic about the relationship between initial advances and the first origin in
1413         each run. Because of the fortunate choice of only representing layout advances 
1414         in m_adjustedBaseAdvances, this entire block can be removed and the raw paint
1415         initial advance can be reported to the GlyphBuffer. Later in the function, we
1416         have to update the logic about how to compute a paint advance given a layout
1417         advance and some origins. In particular, there are two tricky pieces here: 1.
1418         The layout advance for the first glyph is equal to (initial advance - first
1419         origin + first Core Text advance, so computing the paint offset must cancel out
1420         the initial layout offset, and 2. the last paint advance in a run must actually
1421         end up at the position of the first glyph in the next run, so the next run's
1422         initial advance must be queried.
1423         (WebCore::ComplexTextController::adjustGlyphsAndAdvances): Previously, we
1424         represented an initial advance of a successive run by just adding it to the
1425         previous run's last advance. However, this is incompatible with the new model
1426         presented in the link above, so we remove this section. We also have to add in
1427         the logic that the layout advance for the first glyph is equal to the formula
1428         presented above.
1429         * platform/graphics/mac/ComplexTextController.h:
1430         (WebCore::ComplexTextController::ComplexTextRun::initialAdvance): Adjust comment
1431         to reflect reality.
1432         (WebCore::ComplexTextController::leadingExpansion): Deleted.
1433
1434 2017-01-30  Simon Fraser  <simon.fraser@apple.com>
1435
1436         Fixed elements should not rubber-band in WK2, nor remain at negative offsets
1437         https://bugs.webkit.org/show_bug.cgi?id=167484
1438         rdar://problem/29453068
1439
1440         Reviewed by Dean Jackson.
1441
1442         There were various problems with the layout rect computation:
1443         1. It ignored the scrollBehaviorForFixedElements() which we use to avoid rubber-banding fixed
1444            elements in WK2, but allow in WK1, so make use of that.
1445         2. Sometimes layouts/paints of fixed elements would be triggered when coalesced calls to
1446            AsyncScrollingCoordinator::scheduleUpdateScrollPositionAfterAsyncScroll() failed to
1447            copy the layoutViewportOrigin to the scheduled update.
1448         3. The layout viewport could be left with a negative top/left after rubber-banding.
1449         
1450         Also add a way to do unconstrained scrollTo(), so that a test can call window.scrollTo(-10, -10) to
1451         simulate rubberbanding.
1452
1453         Tests: fast/visual-viewport/rubberbanding-viewport-rects-header-footer.html
1454                fast/visual-viewport/rubberbanding-viewport-rects.html
1455
1456         * page/FrameView.cpp:
1457         (WebCore::FrameView::computeLayoutViewportOrigin): Handle ScrollBehaviorForFixedElements, incorporating it
1458         into logic that clamps layoutViewportOrigin between min/max when rubberbanding is not allowed, or not in progress.
1459         (WebCore::FrameView::updateLayoutViewport): Pass in scrollBehaviorForFixedElements().
1460         (WebCore::FrameView::visibleDocumentRect): The clamping here was preventing the visible rect from
1461         escaping the document bounds, which caused fixed elements to bounce with rubber-banding, so remove the clamping,
1462         and fix the logic to allow rubber-banding while taking headers and footers into account.
1463         * page/FrameView.h:
1464         * page/scrolling/AsyncScrollingCoordinator.cpp:
1465         (WebCore::AsyncScrollingCoordinator::scheduleUpdateScrollPositionAfterAsyncScroll): layoutViewportOrigin has to
1466         be pushed onto the scheduled update, just like scroll position.
1467         * page/scrolling/ScrollingTreeFrameScrollingNode.cpp:
1468         (WebCore::ScrollingTreeFrameScrollingNode::layoutViewportForScrollPosition): Pass in m_behaviorForFixed.
1469         * platform/ScrollView.cpp:
1470         (WebCore::ScrollView::ScrollView):
1471         (WebCore::ScrollView::adjustScrollPositionWithinRange):
1472         (WebCore::ScrollView::setScrollOffset):
1473         * platform/ScrollView.h:
1474         (WebCore::ScrollView::setAllowsUnclampedScrollPositionForTesting):
1475         (WebCore::ScrollView::allowsUnclampedScrollPosition):
1476         * testing/InternalSettings.cpp:
1477         (WebCore::InternalSettings::setAllowUnclampedScrollPosition):
1478         * testing/InternalSettings.h:
1479         * testing/InternalSettings.idl:
1480
1481 2017-01-30  Wenson Hsieh  <wenson_hsieh@apple.com>
1482
1483         Web content process crashes when initiating a drag on a very large image
1484         https://bugs.webkit.org/show_bug.cgi?id=167564
1485
1486         Reviewed by Beth Dakin.
1487
1488         If we begin dragging an image element that is too large to show the cached image for, we will show an image file
1489         icon instead of the cached image. This may return null if createDragImageIconForCachedImageFilename is
1490         unimplemented, so in the meantime, we should not assume that dragImage will always exist before calling into
1491         doSystemDrag in doImageDrag and bail from the drag operation if that is the case.
1492
1493         * page/DragController.cpp:
1494         (WebCore::DragController::doImageDrag):
1495
1496 2017-01-30  Chris Dumez  <cdumez@apple.com>
1497
1498         Update DiagnosticLoggingClient::logDiagnosticMessageWithValue() to take in the value as a double
1499         https://bugs.webkit.org/show_bug.cgi?id=167536
1500
1501         Reviewed by Darin Adler.
1502
1503         Update DiagnosticLoggingClient::logDiagnosticMessageWithValue() to take in the value as a double
1504         instead of a string. The value needs to be numeric and the current API is error-prone.
1505
1506         * html/HTMLMediaElement.cpp:
1507         (WebCore::HTMLMediaElement::mediaPlayerEngineFailedToLoad):
1508         * loader/EmptyClients.cpp:
1509         * page/DiagnosticLoggingClient.h:
1510
1511 2017-01-30  Ryan Haddad  <ryanhaddad@apple.com>
1512
1513         Unreviewed, rollout r211235 Pointer lock events should be delivered directly to the target element.
1514
1515         The LayoutTest for this change is frequently failing.
1516
1517         * page/EventHandler.cpp:
1518         (WebCore::EventHandler::handleMousePressEvent):
1519         (WebCore::EventHandler::handleMouseDoubleClickEvent):
1520         (WebCore::EventHandler::handleMouseMoveEvent):
1521         (WebCore::EventHandler::handleMouseReleaseEvent):
1522         (WebCore::EventHandler::handleMouseForceEvent):
1523         (WebCore::EventHandler::handleWheelEvent):
1524         * page/PointerLockController.cpp:
1525         (WebCore::PointerLockController::isLocked): Deleted.
1526         (WebCore::PointerLockController::dispatchLockedWheelEvent): Deleted.
1527         * page/PointerLockController.h:
1528
1529 2017-01-30  Antoine Quint  <graouts@apple.com>
1530
1531         LayoutTest media/modern-media-controls/media-controller/media-controller-auto-hide-mouse-leave-after-play.html is flaky
1532         https://bugs.webkit.org/show_bug.cgi?id=167254
1533         <rdar://problem/30259293>
1534
1535         Reviewed by Dean Jackson.
1536
1537         When we would identify that we need to prolong an existing auto-hide timer, when the previous
1538         auto-hide timer was marked as non-cancelable, calling _cancelAutoHideTimer() would not actually
1539         cancel the previous timer, which would let it fire and hide the controls bar. We now have two
1540         methods, _cancelAutoHideTimer() which always cancels the current auto-hide timer, and
1541         _cancelNonEnforcedAutoHideTimer() which is used from all other existing call sites, which only
1542         cancels the current auto-hide timer if it was marked as cancelable. This, and revised timing in
1543         the test itself, make media/modern-media-controls/media-controller/media-controller-auto-hide-
1544         mouse-leave-after-play.html a lot more reliable.
1545
1546         We also make a small drive-by fix where we ensure the "autoHideDelay" property is set first so
1547         that setting other members which may set a timer do not used an undefined value for the auto-hide
1548         timer delay.
1549
1550         * Modules/modern-media-controls/controls/controls-bar.js:
1551         (ControlsBar.prototype.set visible):
1552         (ControlsBar.prototype.handleEvent):
1553         (ControlsBar.prototype._cancelNonEnforcedAutoHideTimer):
1554         (ControlsBar.prototype._cancelAutoHideTimer):
1555
1556 2017-01-30  Carlos Garcia Campos  <cgarcia@igalia.com>
1557
1558         REGRESSION(r202615?): [GStreamer] ASSERTION FAILED: isMainThread() in WebCore::BuiltinResourceHandleConstructorMap& WebCore::builtinResourceHandleConstructorMap()
1559         https://bugs.webkit.org/show_bug.cgi?id=167003
1560
1561         Reviewed by Michael Catanzaro.
1562
1563         Add a way to create a ResourceHandle for a given SoupNetworkSession and use it in the GStreamer streaming client
1564         to ensure both the session and the handle are created and destroyed in the secondary thread. This way we also
1565         avoid using the default session for downloading HLS fragments.
1566
1567         * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
1568         (ResourceHandleStreamingClient::ResourceHandleStreamingClient): Create a SoupNetworkSession and pass it to ResourceHandle::create().
1569         * platform/network/ResourceHandle.h: Add create and constructor to receive a SoupNetworkSession.
1570         * platform/network/ResourceHandleInternal.h: Add SoupNetworkSession member.
1571         * platform/network/soup/ResourceHandleSoup.cpp:
1572         (WebCore::ResourceHandleInternal::soupSession): Return the SoupNetworkSession if not nullptr.
1573         (WebCore::ResourceHandle::create): Create a ResourceHandle without trying to use any builtin constructor and
1574         using the given SoupNetworkSession.
1575         (WebCore::ResourceHandle::ResourceHandle): Set the SoupNetworkSession if early request validations didn't fail.
1576
1577 2017-01-30  Youenn Fablet  <youennf@gmail.com>
1578
1579         [WebRTC] Add support for libwebrtc data channel
1580         https://bugs.webkit.org/show_bug.cgi?id=167489
1581
1582         Reviewed by Alex Christensen.
1583
1584         Partially covered by webrtc/datachannel/basic.html but not yet enabled on bots.
1585
1586         Introducing LibWebRTCDataChannelHandler as the integration layer between WebCore (RTCDataChannel)
1587         and libwebrtc (DataChannelObserver).
1588
1589         * Modules/mediastream/RTCDataChannel.cpp:
1590         (WebCore::RTCDataChannel::create):
1591         (WebCore::RTCDataChannel::RTCDataChannel):
1592         (WebCore::RTCDataChannel::bufferedAmount):
1593         (WebCore::RTCDataChannel::bufferedAmountIsDecreasing):
1594         * Modules/mediastream/RTCDataChannel.h:
1595         * Modules/mediastream/libwebrtc/LibWebRTCDataChannelHandler.cpp: Added.
1596         (WebCore::LibWebRTCDataChannelHandler::~LibWebRTCDataChannelHandler):
1597         (WebCore::LibWebRTCDataChannelHandler::setClient):
1598         (WebCore::LibWebRTCDataChannelHandler::sendStringData):
1599         (WebCore::LibWebRTCDataChannelHandler::sendRawData):
1600         (WebCore::LibWebRTCDataChannelHandler::close):
1601         (WebCore::LibWebRTCDataChannelHandler::OnStateChange):
1602         (WebCore::LibWebRTCDataChannelHandler::OnMessage):
1603         * Modules/mediastream/libwebrtc/LibWebRTCDataChannelHandler.h:
1604         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
1605         (WebCore::LibWebRTCMediaEndpoint::OnRemoveStream):
1606         (WebCore::LibWebRTCMediaEndpoint::addDataChannel):
1607         (): Deleted.
1608         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
1609         (WebCore::LibWebRTCPeerConnectionBackend::createDataChannelHandler):
1610         * dom/EventNames.h:
1611         * platform/mediastream/RTCDataChannelHandler.h:
1612         * platform/mediastream/RTCDataChannelHandlerClient.h:
1613         * platform/mock/RTCDataChannelHandlerMock.h:
1614
1615 2017-01-30  Carlos Garcia Campos  <cgarcia@igalia.com>
1616
1617         Several web timing tests crash in GTK+ and AppleWin bots
1618         https://bugs.webkit.org/show_bug.cgi?id=167577
1619
1620         Reviewed by Ryosuke Niwa.
1621
1622         The problem is that entry is used in both the key, to get name, and in the value with WTFMove. So, the name is
1623         invalidated by the move. It could be fixed by simply copying the name, instead of using entry->name, but I think
1624         that code could be simplified using HashMap::ensure and then we don't need any string copy, nor even the static
1625         insertPerformanceEntry().
1626
1627         Fix crashes in several imported/w3c/web-platform-tests/user-timing/ tests.
1628
1629         * page/PerformanceUserTiming.cpp:
1630         (WebCore::UserTiming::mark):
1631         (WebCore::UserTiming::measure):
1632         (WebCore::insertPerformanceEntry): Deleted.
1633
1634 2017-01-30  Carlos Garcia Campos  <cgarcia@igalia.com>
1635
1636         [Threaded Compositor] Crash in GraphicsContext3D::deleteTexture when destroying TextureMapperPlatformLayerProxy
1637         https://bugs.webkit.org/show_bug.cgi?id=167575
1638
1639         Reviewed by Žan Doberšek.
1640
1641         We should clear all the buffers on invalidate to ensure we don't have textures alive after CoordinatedGraphicsScene::purgeGLResources().
1642
1643         Fix crash in media/video-poster-background.html.
1644
1645         * platform/graphics/texmap/TextureMapperPlatformLayerProxy.cpp:
1646         (WebCore::TextureMapperPlatformLayerProxy::invalidate): Clear current, pending and all used buffers.
1647
1648 2017-01-29  Carlos Garcia Campos  <cgarcia@igalia.com>
1649
1650         [Threaded Compositor] Crash on WebCore::GLContext::version()
1651         https://bugs.webkit.org/show_bug.cgi?id=167559
1652
1653         Reviewed by Michael Catanzaro.
1654
1655         Fixes crashes in several media tests.
1656
1657         * platform/graphics/texmap/TextureMapperPlatformLayerProxy.cpp:
1658         (WebCore::TextureMapperPlatformLayerProxy::invalidate): Clear m_compositorThreadUpdateTimer and call the update function.
1659
1660 2017-01-29  Nan Wang  <n_wang@apple.com>
1661
1662         AX: WKContentView needs to implement UITextInput methods to make speak selection highlighting work
1663         https://bugs.webkit.org/show_bug.cgi?id=166955
1664
1665         Reviewed by Ryosuke Niwa.
1666
1667         Created a new version of Range::collectSelectionRect() that returns rects for each
1668         line, so that Speak Selection doesn't need to handle searching for soft line breaks.
1669         Also added a variant of findPlainText to search for the closest matched range to the given position.
1670
1671         Test: editing/text-iterator/range-of-string-closest-to-position.html
1672
1673         * dom/Range.cpp:
1674         (WebCore::Range::collectSelectionRectsWithoutUnionInteriorLines):
1675         (WebCore::Range::collectSelectionRects):
1676         * dom/Range.h:
1677         * editing/TextIterator.cpp:
1678         (WebCore::findPlainTextMatches):
1679         (WebCore::updateSearchBuffer):
1680         (WebCore::findIteratorOptions):
1681         (WebCore::rangeMatches):
1682         (WebCore::findClosestPlainText):
1683         (WebCore::findPlainText):
1684         (WebCore::findPlainTextOffset): Deleted.
1685         * editing/TextIterator.h:
1686         * editing/htmlediting.h:
1687         * testing/Internals.cpp:
1688         (WebCore::Internals::rangeOfStringNearLocation):
1689         * testing/Internals.h:
1690         * testing/Internals.idl:
1691
1692 2017-01-29  Andy Estes  <aestes@apple.com>
1693
1694         [QuickLook] Add a WebPreference to enable saving QuickLook documents in WebKitLegacy
1695         https://bugs.webkit.org/show_bug.cgi?id=167563
1696         <rdar://problem/30253207>
1697
1698         Reviewed by Andreas Kling.
1699
1700         * loader/ios/QuickLook.h: Removed unused declarations.
1701         (WebCore::QuickLookHandle::firstRequestURL): Deleted.
1702         * loader/ios/QuickLook.mm:
1703         (WebCore::removeQLPreviewConverterForURL): Stopped deleting the temporary file here; that's
1704         now done in QuickLookDocumentWriter.
1705         (addQLPreviewConverterWithFileForURL): Changed from an exported function to a static
1706         function since it's now only called inside QuickLook.mm.
1707         (WebCore::QuickLookHandle::QuickLookHandle): Stopped initializing m_firstRequestURL.
1708         (WebCore::addQLPreviewConverterWithFileForURL): Deleted.
1709         (WebCore::qlPreviewConverterFileNameForURL): Deleted.
1710         (WebCore::qlPreviewConverterUTIForURL): Deleted.
1711         (WebCore::QuickLookHandle::previewRequestURL): Deleted.
1712         (WebCore::QuickLookHandle::converter): Deleted.
1713
1714 2017-01-29  Zalan Bujtas  <zalan@apple.com>
1715
1716         Simple line layout: PerformanceTests/Layout/simple-line-layout-innertext.html regressed at r211108
1717         https://bugs.webkit.org/show_bug.cgi?id=167562
1718
1719         Reviewed by Antti Koivisto.
1720
1721         Apparently RunResolver::Run::constructStringForHyphenIfNeeded() is in a superhot codepath.
1722         The Run should not have any additional members anyway, so let's construct the hyphenated
1723         string on demand.
1724         Progression on simple-line-layout-innertext.html is from ~34runs/sec back to ~50runs/sec.
1725
1726         Covered by existing text.
1727
1728         * rendering/RenderTreeAsText.cpp:
1729         (WebCore::writeSimpleLine):
1730         * rendering/SimpleLineLayoutFunctions.cpp:
1731         (WebCore::SimpleLineLayout::paintFlow):
1732         * rendering/SimpleLineLayoutResolver.cpp:
1733         (WebCore::SimpleLineLayout::RunResolver::Run::Run):
1734         (WebCore::SimpleLineLayout::RunResolver::Run::textWithHyphen):
1735         (WebCore::SimpleLineLayout::RunResolver::Run::text):
1736         (WebCore::SimpleLineLayout::RunResolver::Run::constructStringForHyphenIfNeeded): Deleted.
1737         * rendering/SimpleLineLayoutResolver.h:
1738
1739 2017-01-28  Tim Horton  <timothy_horton@apple.com>
1740
1741         Don't flash a tap highlight for the entirety of an editable WKWebView
1742         https://bugs.webkit.org/show_bug.cgi?id=167486
1743         <rdar://problem/30193996>
1744
1745         Reviewed by Dan Bernstein.
1746
1747         * dom/Document.h:
1748         Export.
1749
1750 2017-01-28  Wenson Hsieh  <wenson_hsieh@apple.com>
1751
1752         Check USE(APPLE_INTERNAL_SDK) instead of specific headers when importing from WebKitAdditions
1753         https://bugs.webkit.org/show_bug.cgi?id=167555
1754
1755         Reviewed by Dan Bernstein.
1756
1757         Instead of guarding #import <WebKitAdditions/*> on the existence of the imported file, consult
1758         USE(APPLE_INTERNAL_SDK) instead.
1759
1760         * page/ios/EventHandlerIOS.mm:
1761         * platform/ios/DragImageIOS.mm:
1762         * platform/ios/PasteboardIOS.mm:
1763         * platform/mac/DragDataMac.mm:
1764
1765 2017-01-28  Yoav Weiss  <yoav@yoav.ws>
1766
1767         Add Link Preload as an off-by-default experimental feature menu item.
1768         https://bugs.webkit.org/show_bug.cgi?id=167201
1769
1770         Reviewed by Ryosuke Niwa.
1771
1772         Removed the explicit setting of the Link Preload experimental feature,
1773         as it is now on by default for testing.
1774
1775         No new tests as this just removes methods from settings.
1776
1777         * testing/InternalSettings.cpp:
1778         (WebCore::InternalSettings::Backup::Backup):
1779         (WebCore::InternalSettings::Backup::restoreTo):
1780         * testing/InternalSettings.h:
1781         * testing/InternalSettings.idl:
1782
1783 2017-01-28  Joseph Pecoraro  <pecoraro@apple.com>
1784
1785         Fix typo in error message
1786         https://bugs.webkit.org/show_bug.cgi?id=167554
1787
1788         Reviewed by Sam Weinig.
1789
1790         * bindings/scripts/CodeGenerator.pm:
1791         (GetEnumByType):
1792
1793 2017-01-28  Antoine Quint  <graouts@apple.com>
1794
1795         [Modern Media Controls] REGRESSION: Video stops playing after going into Full Screen in media documents
1796         https://bugs.webkit.org/show_bug.cgi?id=167552
1797         <rdar://problem/29601646>
1798
1799         Reviewed by Eric Carlson.
1800
1801         In the case of media documents, there is a built-in behavior, implemented in MediaDocument::defaultEventHandler(),
1802         that toggles playback when clicking or double-clicking the video. We disable this behavior by adding a "click" event
1803         handler on the entire media shadow root and calling "preventDefault()".
1804
1805         Test: media/modern-media-controls/media-documents/click-on-video-should-not-pause.html
1806
1807         * Modules/modern-media-controls/media/media-controller.js:
1808         (MediaController):
1809         (MediaController.prototype.handleEvent):
1810         (MediaController.prototype._containerWasClicked):
1811
1812 2017-01-28  Dan Bernstein  <mitz@apple.com>
1813
1814         [Xcode] Clean up PAL and WebCore’s build settings a little
1815         https://bugs.webkit.org/show_bug.cgi?id=167292
1816
1817         Reviewed by Sam Weinig.
1818
1819         * Configurations/Base.xcconfig: Simplified the definition of
1820           GCC_WARN_64_TO_32_BIT_CONVERSION, removed the unused build setting PREBINDING, removed
1821           a duplicate definition of GCC_GENERATE_DEBUGGING_SYMBOLS, and removed definitions specific
1822           to OS X versions that are no longer supported.
1823
1824         * Configurations/DebugRelease.xcconfig: Removed definitions specific to OS X versions
1825           that are no longer supported.
1826
1827 2017-01-28  Zalan Bujtas  <zalan@apple.com>
1828
1829         Resolve beforeChild's render tree position before calling addChildIgnoringContinuation.
1830         https://bugs.webkit.org/show_bug.cgi?id=167540
1831         <rdar://problem/30126535>
1832
1833         Reviewed by Simon Fraser.
1834
1835         Use the actual render tree position for the beforeChild when inside a flow thread.
1836
1837         Test: fast/multicol/assert-on-continuation-with-spanner.html
1838
1839         * rendering/RenderBlockFlow.cpp:
1840         (WebCore::RenderBlockFlow::addChild):
1841         * rendering/RenderInline.cpp:
1842         (WebCore::RenderInline::addChild):
1843         * rendering/RenderMultiColumnFlowThread.cpp:
1844         (WebCore::RenderMultiColumnFlowThread::resolveMovedChild):
1845
1846 2017-01-28  Andreas Kling  <akling@apple.com>
1847
1848         Avoid synchronous style recalc in dispatchUnloadEvents().
1849         <https://webkit.org/b/167551>
1850
1851         Reviewed by Antti Koivisto.
1852
1853         It shouldn't be necessary to force a synchronous style resolution in an unloading document.
1854         This call has been here since the import of KHTMLPart.
1855
1856         * loader/FrameLoader.cpp:
1857         (WebCore::FrameLoader::dispatchUnloadEvents):
1858
1859 2017-01-28  Andreas Kling  <akling@apple.com>
1860
1861         REGRESSION(r196383): Automatic shrink-to-fit of RuleSet no longer works.
1862         <https://webkit.org/b/167543>
1863
1864         Reviewed by Antti Koivisto.
1865
1866         Re-enable the automatic shrink-to-fit optimization in RuleSet.
1867         This was disabled accidentally, which I discovered while investigating
1868         the memory footprint of extension stylesheets.
1869
1870         * css/RuleSet.h:
1871
1872 2017-01-28  Antti Koivisto  <antti@apple.com>
1873
1874         Give scripts 'high' load priority
1875         https://bugs.webkit.org/show_bug.cgi?id=167550
1876
1877         Reviewed by Andreas Kling.
1878
1879         For historical reasons it is currently 'medium', same as web fonts and some other non-parsing blocking things.
1880
1881         * loader/cache/CachedResource.cpp:
1882         (WebCore::CachedResource::defaultPriorityForResourceType):
1883
1884 2017-01-28  Joseph Pecoraro  <pecoraro@apple.com>
1885
1886         Add User Timing Experimental Feature
1887         https://bugs.webkit.org/show_bug.cgi?id=167542
1888         <rdar://problem/22746307>
1889
1890         Reviewed by Ryosuke Niwa.
1891
1892         * page/RuntimeEnabledFeatures.h:
1893         (WebCore::RuntimeEnabledFeatures::performanceTimelineEnabled):
1894         * page/Performance.idl:
1895         * page/PerformanceEntry.idl:
1896         Make a better RuntimeEnabledFeature named "PerformanceTiming" which
1897         is enabled if either UserTiming or ResourceTiming is enabled. This
1898         will then expose the APIs that are only useful when at least one of
1899         the APIs are available.
1900
1901         * page/PerformanceEntry.cpp:
1902         (WebCore::PerformanceEntry::name): Deleted.
1903         (WebCore::PerformanceEntry::entryType): Deleted.
1904         (WebCore::PerformanceEntry::startTime): Deleted.
1905         (WebCore::PerformanceEntry::duration): Deleted.
1906         * page/PerformanceEntry.h:
1907         (WebCore::PerformanceEntry::name):
1908         (WebCore::PerformanceEntry::entryType):
1909         (WebCore::PerformanceEntry::startTime):
1910         (WebCore::PerformanceEntry::duration):
1911         Inline simple accessors.
1912
1913         * page/PerformanceUserTiming.cpp:
1914         (WebCore::UserTiming::measure):
1915         Fix a bug introduced by ExceptionOr refactoring.
1916
1917         (WebCore::UserTiming::clearMarks):
1918         (WebCore::UserTiming::clearMeasures):
1919         (WebCore::clearPerformanceEntries):
1920         (WebCore::clearPeformanceEntries): Deleted.
1921         Fix method name typo.
1922
1923 2017-01-27  Dan Bernstein  <mitz@apple.com>
1924
1925         Ignore Xcode’s project.xcworkspace and userdata directories in this new project like we do
1926         in other projects.
1927
1928         * PAL/PAL.xcodeproj: Added property svn:ignore.
1929
1930 2017-01-27  Andy Estes  <aestes@apple.com>
1931
1932         Fix the iOS build when USE(QUICK_LOOK) is disabled.
1933
1934         * testing/Internals.cpp:
1935         (WebCore::Internals::setQuickLookPassword):
1936         * testing/Internals.h:
1937
1938 2017-01-27  Yusuke Suzuki  <utatane.tea@gmail.com>
1939
1940         setTimeout / setInterval's string execution should inherit SourceOrigin correctly
1941         https://bugs.webkit.org/show_bug.cgi?id=167097
1942
1943         Reviewed by Darin Adler.
1944
1945         Tests: js/dom/modules/import-from-set-interval.html
1946                js/dom/modules/import-from-set-timeout.html
1947
1948         * bindings/js/ScriptController.cpp:
1949         (WebCore::ScriptController::executeScriptInWorld):
1950
1951 2017-01-27  Yusuke Suzuki  <utatane.tea@gmail.com>
1952
1953         Merge CachedModuleScript and LoadableModuleScript
1954         https://bugs.webkit.org/show_bug.cgi?id=167500
1955
1956         Reviewed by Darin Adler.
1957
1958         CachedModuleScript becomes duplicate with LoadableModuleScript.
1959         And CachedModuleScript does not offer any meaningful functionality
1960         to LoadableModuleScript.
1961         This patch merges CachedModuleScript to LoadableModuleScript.
1962
1963         No behavior change.
1964
1965         * CMakeLists.txt:
1966         * WebCore.xcodeproj/project.pbxproj:
1967         * bindings/js/CachedModuleScript.cpp: Removed.
1968         * bindings/js/CachedModuleScript.h: Removed.
1969         * bindings/js/CachedModuleScriptClient.h: Removed.
1970         * bindings/js/JSBindingsAllInOne.cpp:
1971         * bindings/js/ScriptController.cpp:
1972         (WebCore::ScriptController::loadModuleScriptInWorld):
1973         (WebCore::ScriptController::loadModuleScript):
1974         (WebCore::ScriptController::linkAndEvaluateModuleScriptInWorld):
1975         (WebCore::ScriptController::linkAndEvaluateModuleScript):
1976         (WebCore::ScriptController::setupModuleScriptHandlers):
1977         * bindings/js/ScriptController.h:
1978         * dom/LoadableModuleScript.cpp:
1979         (WebCore::LoadableModuleScript::create):
1980         (WebCore::LoadableModuleScript::LoadableModuleScript):
1981         (WebCore::LoadableModuleScript::~LoadableModuleScript):
1982         (WebCore::LoadableModuleScript::isLoaded):
1983         (WebCore::LoadableModuleScript::error):
1984         (WebCore::LoadableModuleScript::wasCanceled):
1985         (WebCore::LoadableModuleScript::notifyLoadCompleted):
1986         (WebCore::LoadableModuleScript::notifyLoadFailed):
1987         (WebCore::LoadableModuleScript::notifyLoadWasCanceled):
1988         (WebCore::LoadableModuleScript::execute):
1989         (WebCore::LoadableModuleScript::load):
1990         (WebCore::LoadableModuleScript::notifyFinished): Deleted.
1991         * dom/LoadableModuleScript.h:
1992         * dom/ScriptElement.cpp:
1993         (WebCore::ScriptElement::executeModuleScript):
1994         * dom/ScriptElement.h:
1995
1996 2017-01-27  Michael Saboff  <msaboff@apple.com>
1997
1998         JSCustomElementInterface::invokeCallback can be called with a null callback because Weak<>
1999         https://bugs.webkit.org/show_bug.cgi?id=167522
2000
2001         Reviewed by Filip Pizlo.
2002
2003         Added all provided callbacks to the global object with a private name the same way 
2004         that the constructor was added.  This will keep these callbacks from being GC'ed.
2005
2006         * bindings/js/JSCustomElementRegistryCustom.cpp:
2007         (WebCore::JSCustomElementRegistry::define):
2008
2009 2017-01-27  Myles C. Maxfield  <mmaxfield@apple.com>
2010
2011         [Cocoa] Prepare ComplexTextController for unit testing
2012         https://bugs.webkit.org/show_bug.cgi?id=167493
2013
2014         Reviewed by Simon Fraser.
2015
2016         Addressing post-review comments from Simon Fraser.
2017
2018         * platform/graphics/FontCascade.h:
2019         * platform/graphics/mac/ComplexTextController.h:
2020         (WebCore::ComplexTextController::ComplexTextRun::createForTesting):
2021         * platform/graphics/mac/ComplexTextControllerCoreText.h:
2022         (WebCore::ComplexTextController::ComplexTextRun::ComplexTextRun):
2023
2024 2017-01-27  Simon Fraser  <simon.fraser@apple.com>
2025
2026         Element with a backdrop-filter and a mask may not correctly mask the backdrop
2027         https://bugs.webkit.org/show_bug.cgi?id=167456
2028         rdar://problem/29320059
2029
2030         Reviewed by Antoine Quint.
2031
2032         If a layer had a backdrop filter, but also corner radii that triggered using a mask layer,
2033         then the call to updateClippingStrategy() in GraphicsLayerCA::updateBackdropFiltersRect() would
2034         set the backdrop layer's mask, but GraphicsLayerCA::updateMaskLayer() would promptly then set
2035         the mask layer back to nil.
2036
2037         Fix by having GraphicsLayerCA::updateMaskLayer() put the mask on the structural layer, if there
2038         is one. We always have a structural layer with backdrops, so this will mask both the layer
2039         and the backdrop.
2040
2041         Test: css3/filters/backdrop/backdrop-filter-uneven-corner-radii.html
2042
2043         * platform/graphics/ca/GraphicsLayerCA.cpp:
2044         (WebCore::GraphicsLayerCA::updateMaskLayer):
2045         * platform/graphics/mac/WebLayer.mm:
2046         (-[CALayer _descriptionWithPrefix:]): Dump the mask layer.
2047
2048 2017-01-27  Chris Dumez  <cdumez@apple.com>
2049
2050         Fix remaining bad uses of logDiagnosticMessageWithValue()
2051         https://bugs.webkit.org/show_bug.cgi?id=167526
2052
2053         Reviewed by Alex Christensen.
2054
2055         Drop unused keys, add new ones.
2056
2057         * page/DiagnosticLoggingKeys.cpp:
2058         (WebCore::DiagnosticLoggingKeys::networkCacheFailureReasonKey):
2059         (WebCore::DiagnosticLoggingKeys::networkCacheUnusedReasonKey):
2060         (WebCore::DiagnosticLoggingKeys::networkCacheReuseFailureKey):
2061         (WebCore::DiagnosticLoggingKeys::backNavigationDeltaKey):
2062         (WebCore::DiagnosticLoggingKeys::userZoomActionKey):
2063         (WebCore::DiagnosticLoggingKeys::deltaKey): Deleted.
2064         (WebCore::DiagnosticLoggingKeys::backNavigationKey): Deleted.
2065         (WebCore::DiagnosticLoggingKeys::requestKey): Deleted.
2066         (WebCore::DiagnosticLoggingKeys::unusableCachedEntryKey): Deleted.
2067         (WebCore::DiagnosticLoggingKeys::userKey): Deleted.
2068         (WebCore::DiagnosticLoggingKeys::zoomedKey): Deleted.
2069         (WebCore::DiagnosticLoggingKeys::notInCacheKey): Deleted.
2070         * page/DiagnosticLoggingKeys.h:
2071
2072 2017-01-27  Myles C. Maxfield  <mmaxfield@apple.com>
2073
2074         Proclaim that we are considering font-display, rhythmic sizing, and text decoration level 4
2075         https://bugs.webkit.org/show_bug.cgi?id=167340
2076
2077         Reviewed by Saam Barati.
2078
2079         * features.json:
2080
2081 2017-01-27  Chris Dumez  <cdumez@apple.com>
2082
2083         Fix diagnostic logging under loader/
2084         https://bugs.webkit.org/show_bug.cgi?id=167512
2085
2086         Reviewed by Alex Christensen.
2087
2088         Fix diagnostic logging under loader/. We should not be using logDiagnosticLoggingWithValue()
2089         without a numeric value.
2090
2091         * loader/ResourceLoader.cpp:
2092         (WebCore::logResourceResponseSource):
2093         * loader/SubresourceLoader.cpp:
2094         (WebCore::logResourceLoaded):
2095         * loader/cache/CachedResourceLoader.cpp:
2096         (WebCore::logMemoryCacheResourceRequest):
2097         (WebCore::CachedResourceLoader::requestResource):
2098         (WebCore::logRevalidation):
2099         * page/DiagnosticLoggingKeys.cpp:
2100         (WebCore::DiagnosticLoggingKeys::memoryCacheEntryDecisionKey):
2101         (WebCore::DiagnosticLoggingKeys::memoryCacheUsageKey):
2102         (WebCore::DiagnosticLoggingKeys::cachedResourceRevalidationReasonKey):
2103         (WebCore::DiagnosticLoggingKeys::resourceLoadedKey):
2104         (WebCore::DiagnosticLoggingKeys::resourceResponseSourceKey):
2105         * page/DiagnosticLoggingKeys.h:
2106
2107 2017-01-27  Chris Dumez  <cdumez@apple.com>
2108
2109         Fix diagnostic logging in media code
2110         https://bugs.webkit.org/show_bug.cgi?id=167510
2111
2112         Reviewed by Alex Christensen.
2113
2114         Fix diagnostic logging in media code. It should not use logDiagnosticMessageWithValue()
2115         with a non-numeric value.
2116
2117         * html/HTMLMediaElement.cpp:
2118         (WebCore::HTMLMediaElement::loadResource):
2119         (WebCore::HTMLMediaElement::updatePlayState):
2120
2121 2017-01-27  Myles C. Maxfield  <mmaxfield@apple.com>
2122
2123         [Cocoa] Prepare ComplexTextController for unit testing
2124         https://bugs.webkit.org/show_bug.cgi?id=167493
2125
2126         Reviewed by Dean Jackson.
2127
2128         ComplexTextController has three phases:
2129         1. Interrogate Core Text about some text
2130         2. Compute layout advances and paint advances from the information retrieved from
2131         Core Text
2132         3. Iterate through the layout advances or paint advances.
2133
2134         This patch tests phases 2 and 3 by chopping ComplexTextController between
2135         phases 1 and 2, and injecting foreign metrics from a unit test. These metrics
2136         have been gathered from real-world uses; however, a layout test is not appropriate
2137         because the fonts which produced these metrics are not licensed appropriately.
2138         The tests can enforce the correct behavior by using ComplexTextController's
2139         public API.
2140
2141         This is in preparation for https://bugs.webkit.org/show_bug.cgi?id=166013.
2142         However, the fix for that bug is quite large, so I've split out this smaller piece
2143         to ease the reviewing burden. The tests I've added are disabled for now (because
2144         they fail), but will be enabled by the fix to that bug.
2145
2146         No new tests because there is no behavior change.
2147
2148         * WebCore.xcodeproj/project.pbxproj:
2149         * platform/graphics/FontCascade.h:
2150         * platform/graphics/FontDescription.h:
2151         * platform/graphics/mac/ComplexTextController.cpp:
2152         (WebCore::ComplexTextController::ComplexTextController):
2153         (WebCore::ComplexTextController::finishConstruction):
2154         * platform/graphics/mac/ComplexTextController.h:
2155         (WebCore::ComplexTextController::ComplexTextRun::createForTesting):
2156         * platform/graphics/mac/ComplexTextControllerCoreText.mm:
2157         (WebCore::ComplexTextController::ComplexTextRun::ComplexTextRun):
2158
2159 2017-01-27  Zalan Bujtas  <zalan@apple.com>
2160
2161         Simple line layout: Do not bail out on -webkit-line-box-contain: block glyphs unless text overflows vertically.
2162         https://bugs.webkit.org/show_bug.cgi?id=167481
2163         <rdar://problem/30180150>
2164
2165         Reviewed by Antti Koivisto.
2166
2167         Since -webkit-line-box-contain: glyphs requires variable line height support, we can use simple line layout
2168         only when each line happen to have the same height ('block' property value is set, glyphs do not overflow the block line height).  
2169
2170         Test: fast/text/simple-line-layout-line-box-contain-glyphs.html
2171
2172         * rendering/SimpleLineLayout.cpp:
2173         (WebCore::SimpleLineLayout::canUseForText):
2174         (WebCore::SimpleLineLayout::canUseForFontAndText):
2175         (WebCore::SimpleLineLayout::canUseForStyle):
2176         (WebCore::SimpleLineLayout::printReason):
2177
2178 2017-01-27  Chris Dumez  <cdumez@apple.com>
2179
2180         Fix PageCache diagnostic logging
2181         https://bugs.webkit.org/show_bug.cgi?id=167508
2182
2183         Reviewed by Sam Weinig.
2184
2185         Fix PageCache diagnostic logging. It should not call logDiagnosticMessageWithValue()
2186         with a non-numeric value. Use logDiagnosticMessage() instead.
2187
2188         * history/PageCache.cpp:
2189         (WebCore::logPageCacheFailureDiagnosticMessage):
2190         (WebCore::canCacheFrame):
2191         * page/DiagnosticLoggingKeys.cpp:
2192         (WebCore::DiagnosticLoggingKeys::pageCacheFailureKey):
2193         (WebCore::DiagnosticLoggingKeys::successKey): Deleted.
2194         (WebCore::DiagnosticLoggingKeys::failureKey): Deleted.
2195         * page/DiagnosticLoggingKeys.h:
2196
2197 2017-01-27  Devin Rousso  <dcrousso+webkit@gmail.com>
2198
2199         Styles should not show background-repeat-x/y, or -webkit-mask-repeat-x/y
2200         https://bugs.webkit.org/show_bug.cgi?id=167255
2201
2202         Reviewed by Joseph Pecoraro.
2203
2204         Test: inspector/css/css-property.html
2205
2206         * css/makeprop.pl:
2207         (addProperty):
2208         Add a generated function `isInternalCSSProperty` that checks the given CSSPropertyID against
2209         a derived list of properties from CSSProperties.json with "internal-only".
2210
2211         * inspector/InspectorCSSAgent.cpp:
2212         (WebCore::InspectorCSSAgent::getSupportedCSSProperties):
2213         * inspector/InspectorStyleSheet.cpp:
2214         (WebCore::InspectorStyle::styleWithProperties):
2215         Only pass CSS property payloads to the frontend if they are not internal.
2216
2217 2017-01-27  Antti Koivisto  <antti@apple.com>
2218
2219         Implement Cache-control: immutable
2220         https://bugs.webkit.org/show_bug.cgi?id=167497
2221
2222         Reviewed by Chris Dumez.
2223
2224         Cache-control value 'immutable' indicates that a subresource does not change and so does not need to be
2225         revalidated on a normal reload. This can significantly speed up reloads and reduce network traffic.
2226
2227         It is has been implemented in Firefox and is already used by Facebook.
2228
2229         https://tools.ietf.org/html/draft-mcmanus-immutable-00
2230         https://hacks.mozilla.org/2017/01/using-immutable-caching-to-speed-up-the-web/
2231
2232         This patch implements Cache-control: immutable for memory cache only. A disk cache implementation
2233         doesn't seem necessary as the resource is basically always expected to be in memory cache on reload.
2234
2235         Immutable is only supported for https as suggested by the draft specification (and Gecko implementation).
2236
2237         Test: http/tests/cache/cache-control-immutable-http.html
2238               http/tests/cache/cache-control-immutable-https.html
2239
2240         * loader/cache/CachedResource.cpp:
2241         (WebCore::CachedResource::makeRevalidationDecision):
2242
2243             On normal reloads (CachePolicyRevalidate) of https resources check for 'Cache-control: immutable'.
2244             If the resource is not expired don't revalidate it.
2245
2246         * platform/network/CacheValidation.cpp:
2247         (WebCore::parseCacheControlDirectives):
2248         * platform/network/CacheValidation.h:
2249         * platform/network/ResourceResponseBase.cpp:
2250         (WebCore::ResourceResponseBase::cacheControlContainsImmutable):
2251         * platform/network/ResourceResponseBase.h:
2252
2253 2017-01-27  Youenn Fablet  <youennf@gmail.com>
2254
2255         [WebRTC] Use MediaEndPointPeerConnection if not using libwebrtc
2256         https://bugs.webkit.org/show_bug.cgi?id=167504
2257
2258         Reviewed by Alex Christensen.
2259
2260         No change of behavior.
2261
2262         * Modules/mediastream/MediaEndpointPeerConnection.cpp: If libwebrtc, we should use libwebrtc peer connection backend.
2263
2264 2017-01-27  Ryan Haddad  <ryanhaddad@apple.com>
2265
2266         Rebaseline bindings tests after r211238.
2267
2268         Unreviewed test gardening.
2269
2270         * bindings/scripts/test/JS/JSTestDOMJIT.cpp:
2271         (WebCore::JSTestDOMJIT::visitChildren):
2272         * bindings/scripts/test/JS/JSTestEventTarget.cpp:
2273         (WebCore::JSTestEventTarget::visitChildren):
2274         * bindings/scripts/test/JS/JSTestNode.cpp:
2275         (WebCore::JSTestNode::visitChildren):
2276
2277 2017-01-25  Sergio Villar Senin  <svillar@igalia.com>
2278
2279         [css-grid] Move Grid class out of RenderGrid
2280         https://bugs.webkit.org/show_bug.cgi?id=167418
2281
2282         Reviewed by Antti Koivisto.
2283
2284         The RenderGrid should be able to use different implementations of
2285         the Grid class. The latter is big enough to be in its own file. That
2286         would help on the effort of moving the grid track sizing algorithm
2287         out of RenderGrid too.
2288
2289         No new tests required as we're just moving code.
2290
2291         * CMakeLists.txt:
2292         * rendering/Grid.cpp: Added.
2293         (WebCore::Grid::Grid):
2294         (WebCore::Grid::numTracks):
2295         (WebCore::Grid::ensureGridSize):
2296         (WebCore::Grid::insert):
2297         (WebCore::Grid::setSmallestTracksStart):
2298         (WebCore::Grid::smallestTrackStart):
2299         (WebCore::Grid::gridItemArea):
2300         (WebCore::Grid::setGridItemArea):
2301         (WebCore::Grid::setAutoRepeatTracks):
2302         (WebCore::Grid::autoRepeatTracks):
2303         (WebCore::Grid::setAutoRepeatEmptyColumns):
2304         (WebCore::Grid::setAutoRepeatEmptyRows):
2305         (WebCore::Grid::hasAutoRepeatEmptyTracks):
2306         (WebCore::Grid::isEmptyAutoRepeatTrack):
2307         (WebCore::Grid::autoRepeatEmptyTracks):
2308         (WebCore::Grid::gridItemSpan):
2309         (WebCore::Grid::setNeedsItemsPlacement):
2310         (WebCore::GridIterator::GridIterator):
2311         (WebCore::GridIterator::nextGridItem):
2312         (WebCore::GridIterator::isEmptyAreaEnough):
2313         (WebCore::GridIterator::nextEmptyGridArea):
2314         * rendering/Grid.h: Added.
2315         * rendering/RenderGrid.cpp:
2316         (WebCore::RenderGrid::computeEmptyTracksForAutoRepeat):
2317         (WebCore::RenderGrid::Grid::numTracks): Deleted.
2318         (WebCore::RenderGrid::Grid::ensureGridSize): Deleted.
2319         (WebCore::RenderGrid::Grid::insert): Deleted.
2320         (WebCore::RenderGrid::Grid::setSmallestTracksStart): Deleted.
2321         (WebCore::RenderGrid::Grid::smallestTrackStart): Deleted.
2322         (WebCore::RenderGrid::Grid::gridItemArea): Deleted.
2323         (WebCore::RenderGrid::Grid::setGridItemArea): Deleted.
2324         (WebCore::RenderGrid::Grid::setAutoRepeatTracks): Deleted.
2325         (WebCore::RenderGrid::Grid::autoRepeatTracks): Deleted.
2326         (WebCore::RenderGrid::Grid::setAutoRepeatEmptyColumns): Deleted.
2327         (WebCore::RenderGrid::Grid::setAutoRepeatEmptyRows): Deleted.
2328         (WebCore::RenderGrid::Grid::hasAutoRepeatEmptyTracks): Deleted.
2329         (WebCore::RenderGrid::Grid::isEmptyAutoRepeatTrack): Deleted.
2330         (WebCore::RenderGrid::Grid::autoRepeatEmptyTracks): Deleted.
2331         (WebCore::RenderGrid::Grid::gridItemSpan): Deleted.
2332         (WebCore::RenderGrid::Grid::setNeedsItemsPlacement): Deleted.
2333         (WebCore::RenderGrid::GridIterator::GridIterator): Deleted.
2334         (WebCore::RenderGrid::GridIterator::nextGridItem): Deleted.
2335         (WebCore::RenderGrid::GridIterator::isEmptyAreaEnough): Deleted.
2336         (WebCore::RenderGrid::GridIterator::nextEmptyGridArea): Deleted.
2337         * rendering/RenderGrid.h:
2338
2339 2017-01-27  Yusuke Suzuki  <utatane.tea@gmail.com>
2340
2341         Implement dynamic-import for WebCore
2342         https://bugs.webkit.org/show_bug.cgi?id=166926
2343
2344         Reviewed by Ryosuke Niwa.
2345
2346         This patch introduces browser side dynamic-import implementation.
2347         The dynamic-import is new ES feature which is now stage 3.
2348         The JSC shell already implements it.
2349
2350         The dynamic-import allows us to kick module loading in a dynamic manner.
2351         For example, you can write,
2352
2353             await module = import(`${HOST}/hello.js`);
2354
2355         The dynamic `import` operator (this is not a function) returns a promise with
2356         module namespace object if the module loading succeeds. Otherwise, it returns
2357         a rejected promise.
2358
2359         And importantly, this feature allows us to kick module loading from classic script.
2360         Previously, module loading can be only used from <script type="module"> tag. And
2361         all the module loading is done statically.
2362
2363         * CMakeLists.txt:
2364         * WebCore.xcodeproj/project.pbxproj:
2365         * bindings/js/CachedModuleScriptLoader.cpp:
2366         (WebCore::CachedModuleScriptLoader::load):
2367         * bindings/js/CachedScriptFetcher.cpp:
2368         (WebCore::CachedScriptFetcher::create):
2369         (WebCore::CachedScriptFetcher::requestModuleScript):
2370         requestModuleScript function is used only when loading a new module script.
2371         So, LoadableClassicScript should use requestScriptWithCache to load itself.
2372         We pass String() for cross origin mode for null cross origin attribute as
2373         specified.
2374
2375         (WebCore::CachedScriptFetcher::requestScriptWithCache):
2376         * bindings/js/CachedScriptFetcher.h:
2377         (WebCore::CachedScriptFetcher::CachedScriptFetcher):
2378         * bindings/js/JSDOMWindowBase.cpp:
2379         (WebCore::JSDOMWindowBase::moduleLoaderImportModule):
2380         * bindings/js/JSDOMWindowBase.h:
2381         * bindings/js/JSLazyEventListener.cpp:
2382         (WebCore::JSLazyEventListener::initializeJSFunction):
2383         * bindings/js/ScriptController.cpp:
2384         (WebCore::ScriptController::executeScript):
2385         * bindings/js/ScriptModuleLoader.cpp:
2386         (WebCore::resolveModuleSpecifier):
2387         Extract the part of resolving module specifier to a static function to use
2388         it in ScriptModuleLoader::resolve and ScriptModuleLoader::importModule.
2389
2390         (WebCore::ScriptModuleLoader::resolve):
2391         (WebCore::rejectPromise):
2392         (WebCore::ScriptModuleLoader::importModule):
2393         New hook moduleLoaderImportModule is implemented. This hook is called when
2394         `import` operator is used. This hook is responsible to
2395             1. resolve the module name to obtain module specifier. (like, resolve the
2396                 relative URL to get absolute URL.)
2397             2. kick module loading with the resolved specifier.
2398         When resolving the module name, the referrer information is needed.
2399         For example, "./script.js" will be resolved to "http://example.com/script.js" if
2400         the referrer module specifier is "http://example.com/".
2401         If `import("./script.js")` is executed in the classic script
2402         src="http://example.com/test.js", it starts loading "http://example.com/script.js".
2403         So the information of the caller of `import` operator is necessary here.
2404         This appropriate referrer is propagated by SourceOrigin.
2405
2406         * bindings/js/ScriptModuleLoader.h:
2407         * dom/InlineClassicScript.h:
2408         * dom/LoadableClassicScript.cpp:
2409         (WebCore::LoadableClassicScript::load):
2410         * dom/LoadableClassicScript.h:
2411         * dom/LoadableModuleScript.h:
2412         * dom/LoadableScript.h:
2413         (WebCore::LoadableScript::LoadableScript):
2414         (WebCore::LoadableScript::isClassicScript): Deleted.
2415         (WebCore::LoadableScript::isModuleScript): Deleted.
2416         * dom/ScriptElement.h:
2417         * dom/ScriptElementCachedScriptFetcher.cpp: Copied from Source/WebCore/dom/InlineClassicScript.h.
2418         (WebCore::ScriptElementCachedScriptFetcher::requestModuleScript):
2419         This requestModuleScript will be used when the script tag (or modules imported from the script tag) uses `import` operator.
2420         In classic scripts, `crossorigin` mode always becomes "omit" while module scripts
2421         propagate the original `crossorigin` value.
2422
2423         * dom/ScriptElementCachedScriptFetcher.h: Copied from Source/WebCore/bindings/js/CachedScriptFetcher.h.
2424         (WebCore::ScriptElementCachedScriptFetcher::crossOriginMode):
2425         (WebCore::ScriptElementCachedScriptFetcher::ScriptElementCachedScriptFetcher):
2426
2427 2017-01-26  Chris Dumez  <cdumez@apple.com>
2428
2429         Revert r210474 it is no longer needed
2430         https://bugs.webkit.org/show_bug.cgi?id=167487
2431
2432         Reviewed by Daniel Bates.
2433
2434         Revert r210474 it is no longer needed after r211254.
2435
2436         * dom/Document.cpp:
2437         (WebCore::Document::canNavigate):
2438         * html/HTMLAnchorElement.cpp:
2439         (WebCore::HTMLAnchorElement::handleClick):
2440         * html/HTMLLinkElement.cpp:
2441         (WebCore::HTMLLinkElement::handleClick):
2442         * loader/FrameLoader.cpp:
2443         (WebCore::FrameLoader::urlSelected):
2444         (WebCore::FrameLoader::submitForm):
2445         (WebCore::FrameLoader::loadFrameRequest):
2446         * mathml/MathMLElement.cpp:
2447         (WebCore::MathMLElement::defaultEventHandler):
2448         * svg/SVGAElement.cpp:
2449         (WebCore::SVGAElement::defaultEventHandler):
2450
2451 2017-01-26  Youenn Fablet  <youennf@gmail.com>
2452
2453         [WebRTC] Implement WebRTC PeerConnection backend based on libwebrtc
2454         https://bugs.webkit.org/show_bug.cgi?id=167289
2455
2456         Reviewed by Alex Christensen.
2457
2458         Introducing an initial implementation of WebRTC peer connection backend based on LibWebRTC.
2459         This is done behind a compilation flag which is off by default, until the implementation is ready.
2460
2461         The backend implements the PeerConnectionBackend API.
2462         The implementation is split into LibWebRTCPeerConnectionBackend which contains mostly generic code and
2463         passes the real work to LibWebRTCMediaEndpoint.
2464         The latter class is implementing the API using LibWebRTC.
2465
2466         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp: Added.
2467         (WebCore::LibWebRTCMediaEndpoint::LibWebRTCMediaEndpoint):
2468         (WebCore::sessionDescriptionType):
2469         (WebCore::LibWebRTCMediaEndpoint::doSetLocalDescription):
2470         (WebCore::LibWebRTCMediaEndpoint::doSetRemoteDescription):
2471         (WebCore::LibWebRTCMediaEndpoint::addPendingIceCandidates):
2472         (WebCore::streamId):
2473         (WebCore::LibWebRTCMediaEndpoint::doCreateOffer):
2474         (WebCore::LibWebRTCMediaEndpoint::doCreateAnswer):
2475         (WebCore::LibWebRTCMediaEndpoint::getStats):
2476         (WebCore::LibWebRTCMediaEndpoint::StatsCollector::StatsCollector):
2477         (WebCore::LibWebRTCMediaEndpoint::StatsCollector::OnStatsDelivered):
2478         (WebCore::signalingState):
2479         (WebCore::LibWebRTCMediaEndpoint::OnSignalingChange):
2480         (WebCore::trackId):
2481         (WebCore::createMediaStreamTrack):
2482         (WebCore::LibWebRTCMediaEndpoint::addStream):
2483         (WebCore::LibWebRTCMediaEndpoint::OnAddStream):
2484         (WebCore::LibWebRTCMediaEndpoint::OnRemoveStream):
2485         (WebCore::LibWebRTCMediaEndpoint::OnDataChannel):
2486         (WebCore::LibWebRTCMediaEndpoint::stop):
2487         (WebCore::LibWebRTCMediaEndpoint::OnRenegotiationNeeded):
2488         (WebCore::iceConnectionState):
2489         (WebCore::LibWebRTCMediaEndpoint::OnIceConnectionChange):
2490         (WebCore::LibWebRTCMediaEndpoint::OnIceGatheringChange):
2491         (WebCore::LibWebRTCMediaEndpoint::OnIceCandidate):
2492         (WebCore::LibWebRTCMediaEndpoint::OnIceCandidatesRemoved):
2493         (WebCore::LibWebRTCMediaEndpoint::createSessionDescriptionSucceeded):
2494         (WebCore::LibWebRTCMediaEndpoint::createSessionDescriptionFailed):
2495         (WebCore::LibWebRTCMediaEndpoint::setLocalSessionDescriptionSucceeded):
2496         (WebCore::LibWebRTCMediaEndpoint::setLocalSessionDescriptionFailed):
2497         (WebCore::LibWebRTCMediaEndpoint::setRemoteSessionDescriptionSucceeded):
2498         (WebCore::LibWebRTCMediaEndpoint::setRemoteSessionDescriptionFailed):
2499         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h: Added.
2500         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp: Added.
2501         (WebCore::createLibWebRTCPeerConnectionBackend):
2502         (WebCore::libWebRTCProvider):
2503         (WebCore::LibWebRTCPeerConnectionBackend::LibWebRTCPeerConnectionBackend):
2504         (WebCore::configurationFromMediaEndpointConfiguration):
2505         (WebCore::LibWebRTCPeerConnectionBackend::setConfiguration):
2506         (WebCore::LibWebRTCPeerConnectionBackend::getStats):
2507         (WebCore::LibWebRTCPeerConnectionBackend::doSetLocalDescription):
2508         (WebCore::LibWebRTCPeerConnectionBackend::doSetRemoteDescription):
2509         (WebCore::LibWebRTCPeerConnectionBackend::doCreateOffer):
2510         (WebCore::LibWebRTCPeerConnectionBackend::doCreateAnswer):
2511         (WebCore::LibWebRTCPeerConnectionBackend::doStop):
2512         (WebCore::LibWebRTCPeerConnectionBackend::doAddIceCandidate):
2513         (WebCore::LibWebRTCPeerConnectionBackend::markAsNeedingNegotiation):
2514         (WebCore::LibWebRTCPeerConnectionBackend::createReceiver):
2515         (WebCore::LibWebRTCPeerConnectionBackend::createDataChannelHandler):
2516         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h: Added.
2517         * WebCore.xcodeproj/project.pbxproj:
2518
2519 2017-01-26  Chris Dumez  <cdumez@apple.com>
2520
2521         Crash when navigating back to a page in PacheCache when one of its frames has been removed
2522         https://bugs.webkit.org/show_bug.cgi?id=167421
2523         <rdar://problem/30188490>
2524
2525         Reviewed by Darin Adler.
2526
2527         Disallow page caching of a page if:
2528         1. The main window has an opener (i.e. it was opened via window.open)
2529         2. It has ever used window.open()
2530
2531         This is because allowing page caching in this case would allow such
2532         windows to script each other even after one of them entered Page
2533         Cache. Allowing this is dangerous and easily causes crashes.
2534
2535         This is a short term workaround until we find a better solution to
2536         the problem. One issue is this workaround is that navigating back
2537         to a page that has an opener or used window.open() will not longer
2538         get the page from PageCache. As a result, state may be lost upon
2539         navigating back. However, we never guarantee that pages get page
2540         cached, and Chrome does not have a PageCache.
2541
2542         Tests: fast/history/page-cache-after-window-open.html
2543                fast/history/page-cache-back-navigation-crash.html
2544                fast/history/page-cache-with-opener.html
2545
2546         * dom/Document.cpp:
2547         (WebCore::Document::hasEverCalledWindowOpen):
2548         (WebCore::Document::markHasCalledWindowOpen):
2549         * dom/Document.h:
2550         * history/PageCache.cpp:
2551         (WebCore::canCachePage):
2552         * page/DOMWindow.cpp:
2553         (WebCore::DOMWindow::createWindow):
2554         * page/DiagnosticLoggingKeys.cpp:
2555         (WebCore::DiagnosticLoggingKeys::hasCalledWindowOpenKey):
2556         (WebCore::DiagnosticLoggingKeys::hasOpenerKey):
2557         * page/DiagnosticLoggingKeys.h:
2558         * page/Page.cpp:
2559         (WebCore::Page::openedByWindowOpen):
2560         * page/Page.h:
2561         * page/Settings.in:
2562
2563 2017-01-26  Youenn Fablet  <youennf@gmail.com>
2564
2565         [WebRTC] Add a LibWebRTC mock for testing
2566         https://bugs.webkit.org/show_bug.cgi?id=167429
2567
2568         Reviewed by Alex Christensen.
2569
2570         Covered by updated tests although feature is behind a flag, off by default.
2571         MockLibWebRTCPeerConnection will allow us testing the code above the WebRTC implementation above LibWebRTC,
2572         without reyling on it and controlling the way that the peer connections will behave.
2573         Adding support for mock factory to create real peer connections in case where we want to do full testing through the local loopback.
2574
2575         Tests: fast/mediastream/getUserMedia-webaudio.html
2576                webrtc/datachannel/basic.html
2577                webrtc/video.html
2578
2579         * WebCore.xcodeproj/project.pbxproj:
2580         * testing/Internals.cpp:
2581         (WebCore::Internals::Internals):
2582         (WebCore::Internals::useMockRTCPeerConnectionFactory):
2583         * testing/Internals.h:
2584         * testing/Internals.idl:
2585         * testing/MockLibWebRTCPeerConnection.cpp: Added.
2586         (WebCore::useMockRTCPeerConnectionFactory):
2587         (WebCore::MockLibWebRTCPeerConnectionForIceCandidates::MockLibWebRTCPeerConnectionForIceCandidates):
2588         (WebCore::MockLibWebRTCPeerConnectionForIceCandidates::gotLocalDescription):
2589         (WebCore::MockLibWebRTCPeerConnectionForIceConnectionState::MockLibWebRTCPeerConnectionForIceConnectionState):
2590         (WebCore::MockLibWebRTCPeerConnectionForIceConnectionState::gotLocalDescription):
2591         (WebCore::MockLibWebRTCPeerConnectionFactory::MockLibWebRTCPeerConnectionFactory):
2592         (WebCore::MockLibWebRTCPeerConnectionFactory::CreatePeerConnection):
2593         (WebCore::MockLibWebRTCPeerConnectionFactory::CreateLocalMediaStream):
2594         (WebCore::MockLibWebRTCPeerConnection::SetLocalDescription):
2595         (WebCore::MockLibWebRTCPeerConnection::SetRemoteDescription):
2596         (WebCore::MockLibWebRTCPeerConnection::CreateDataChannel):
2597         (WebCore::MockLibWebRTCPeerConnection::AddStream):
2598         (WebCore::MockLibWebRTCPeerConnection::RemoveStream):
2599         (WebCore::MockLibWebRTCPeerConnection::CreateOffer):
2600         (WebCore::MockLibWebRTCPeerConnection::CreateAnswer):
2601         * testing/MockLibWebRTCPeerConnection.h: Added.
2602         (WebCore::MockLibWebRTCPeerConnection::~MockLibWebRTCPeerConnection):
2603         (WebCore::MockLibWebRTCPeerConnection::MockLibWebRTCPeerConnection):
2604         (WebCore::MockLibWebRTCPeerConnection::local_streams):
2605         (WebCore::MockLibWebRTCPeerConnection::remote_streams):
2606         (WebCore::MockLibWebRTCPeerConnection::CreateDtmfSender):
2607         (WebCore::MockLibWebRTCPeerConnection::GetStats):
2608         (WebCore::MockLibWebRTCPeerConnection::local_description):
2609         (WebCore::MockLibWebRTCPeerConnection::remote_description):
2610         (WebCore::MockLibWebRTCPeerConnection::AddIceCandidate):
2611         (WebCore::MockLibWebRTCPeerConnection::RegisterUMAObserver):
2612         (WebCore::MockLibWebRTCPeerConnection::signaling_state):
2613         (WebCore::MockLibWebRTCPeerConnection::ice_connection_state):
2614         (WebCore::MockLibWebRTCPeerConnection::ice_gathering_state):
2615         (WebCore::MockLibWebRTCPeerConnection::StopRtcEventLog):
2616         (WebCore::MockLibWebRTCPeerConnection::Close):
2617         (WebCore::MockLibWebRTCPeerConnection::gotLocalDescription):
2618         (WebCore::MockLibWebRTCIceCandidate::MockLibWebRTCIceCandidate):
2619         (WebCore::MockLibWebRTCAudioTrack::MockLibWebRTCAudioTrack):
2620         (WebCore::MockLibWebRTCVideoTrack::MockLibWebRTCVideoTrack):
2621         (WebCore::MockLibWebRTCDataChannel::MockLibWebRTCDataChannel):
2622         (WebCore::MockLibWebRTCPeerConnectionFactory::create):
2623
2624 2017-01-26  Jeremy Jones  <jeremyj@apple.com>
2625
2626         Page should be able to request pointer lock without user gesture if it relinquished it without a user gesture
2627         https://bugs.webkit.org/show_bug.cgi?id=167126
2628
2629         Reviewed by Jon Lee.
2630
2631         Enabled pointer-lock/locked-element-removed-from-dom.html for WK2.
2632         Not enable in WK1 because of https://bugs.webkit.org/show_bug.cgi?id=167127
2633
2634         This change allows a page to lock the pointer again without a user gesture if it was unlocked by
2635         the page and not by the user. See https://www.w3.org/TR/2016/REC-pointerlock-20161027/ 5.1 Methods
2636
2637         * page/PointerLockController.cpp:
2638
2639         When a document acquires pointer lock with a user gesture, that document is allowed to request pointer lock again
2640         until the user takes an action to end pointer lock. We know it is a user action because user actions always
2641         call requestPointerUnlockAndForceCursorVisible().
2642
2643         When the page requests a pointer unlock (via requestPointerUnlock), that document is allowed to continue to relock
2644         the page. This continues until there is either an unlock request form the user 
2645         via requestPointerUnlockAndForceCursorVisible or a didLosePointerLock without a pointer unlock request.
2646
2647         (WebCore::PointerLockController::PointerLockController):
2648         (WebCore::PointerLockController::requestPointerLock):
2649         (WebCore::PointerLockController::requestPointerUnlock):
2650         (WebCore::PointerLockController::requestPointerUnlockAndForceCursorVisible):
2651         (WebCore::PointerLockController::elementRemoved):
2652         (WebCore::PointerLockController::documentDetached):
2653         (WebCore::PointerLockController::didAcquirePointerLock):
2654         (WebCore::PointerLockController::didLosePointerLock):
2655         (WebCore::PointerLockController::clearElement):
2656         * page/PointerLockController.h:
2657
2658 2017-01-26  Andy Estes  <aestes@apple.com>
2659
2660         [QuickLook] REGRESSION (WebKit2): Requests are made to invalid x-apple-ql-id: URLs
2661         https://bugs.webkit.org/show_bug.cgi?id=167453
2662
2663         Reviewed by Brent Fulgham.
2664
2665         Requests to x-apple-ql-id: URLs should be filtered by
2666         -[QLPreviewConverter safeRequestForRequest:]. This method checks that the URL is one of the
2667         ones generated for the current preview, and changes it to "about:" if it isn't.
2668
2669         WebCore::safeQLURLForDocumentURLAndResourceURL() was responsible for finding the
2670         QLPreviewConverter instance to use by looking it up in an NSMutableDictionary using the
2671         document URL as a key. In WebKit1, this dictionary was populated by the
2672         QuickLookHandleClient when new QuickLookHandles were created, but the WebKit2
2673         QuickLookHandleClient never did this. As a result, requests to invalid URLs were not being
2674         rewritten.
2675
2676         An easy way to load a QuickLook document with invalid URLs is to create an HTML file with a
2677         Microsoft Office extension (e.g. .xls); QuickLook, iWork, and Office support opening HTML
2678         files with Office document extensions. In r207155 we applied a Content Security Policy to
2679         QuickLook documents that only allows x-apple-ql-id: resources to load. This blocked
2680         cross-origin requests from loading, but same-origin requests to URLs that weren't generated
2681         by QLPreviewConverter were still allowed to load.
2682
2683         This change blocks these URLs by calling -[QLPreviewConverter safeRequestForRequest:] in a
2684         way that works for both WebKit1 and WebKit2.
2685
2686         After implementing QuickLook for WebKit2, we found a bug when loading HTML-as-Office
2687         documents (webkit.org/b/135651) that presented as a nil MIME type in the preview
2688         NSURLResponse returned by QLPreviewConverter. Unfortunately r172159 papered over the actual
2689         bug by failing to load previews with nil MIME types.
2690
2691         The real issue was that we were asking for the preview response before QuickLook had
2692         received enough data to determine a MIME type, so this change also removes the bad fix from
2693         r172159 and instead waits until QuickLook has converted the document to ask for its preview
2694         response. This restores the ability to load HTML files with Office document extensions.
2695         These two fixes are combined in a single patch because I don't know how to create an invalid
2696         QuickLook URL for testing without loading an HTML-as-Office document.
2697
2698         Test: quicklook/invalid-ql-id-url.html
2699
2700         * loader/ResourceLoader.cpp:
2701         (WebCore::ResourceLoader::willSendRequestInternal): Called
2702         QuickLookHandle::willSendRequest() if m_documentLoader has a QuickLookHandle.
2703         * loader/cache/CachedResource.cpp:
2704         (WebCore::CachedResource::load): Removed the call to
2705         WebCore::safeQLURLForDocumentURLAndResourceURL().
2706         * loader/ios/QuickLook.h: Removed safeQLURLForDocumentURLAndResourceURL() and declared
2707         QuickLookHandle::willSendRequest().
2708         * loader/ios/QuickLook.mm: Removed _previewResponse and _hasFailed ivars from
2709         WebPreviewConverter.
2710         (-[WebPreviewConverter initWithResourceLoader:resourceResponse:quickLookHandle:]): Stopped
2711         setting _previewResponse.
2712         (-[WebPreviewConverter _sendDidReceiveResponseIfNecessary]): Only emptied _bufferedDataArray
2713         if we haven't already called -_sendDidReceiveResponseIfNecessary; removed the check for a
2714         nil _previewResponse MIME type; accessed -[QLPreviewConverter previewResponse] now that the
2715         document has been converted and asserted its MIME type is non-nil.
2716         (-[WebPreviewConverter connection:didReceiveData:lengthReceived:]): Removed _hasFailed check.
2717         (-[WebPreviewConverter connectionDidFinishLoading:]): Ditto.
2718         (isQuickLookPasswordError): Moved the check for password failure errors to here from
2719         -connection:didFailWithError: for better readability.
2720         (-[WebPreviewConverter connection:didFailWithError:]): Removed _hasFailed check and used
2721         more early returns.
2722         (WebCore::QuickLookHandle::willSendRequest): Filtered the request through
2723         -[QLPreviewConverter safeRequestWithRequest:] if the request URL's scheme is x-apple-ql-id:.
2724         (WebCore::safeQLURLForDocumentURLAndResourceURL): Deleted.
2725
2726 2017-01-26  Keith Miller  <keith_miller@apple.com>
2727
2728         classInfo should take a VM so it is not materialized from the object on each call
2729         https://bugs.webkit.org/show_bug.cgi?id=167424
2730
2731         Rubber Stamped by Michael Saboff.
2732
2733         Previously, classInfo() would get the VM from the target's
2734         MarkedBlock.  Most callers already have a VM on hand, so it is
2735         wasteful to compute the VM from the marked block every time. This
2736         patch refactors some of the most common callers of classInfo(),
2737         jsDynamicCast and inherits to take a VM as well.
2738
2739         * Modules/fetch/FetchBody.cpp:
2740         (WebCore::FetchBody::extract):
2741         * Modules/plugins/QuickTimePluginReplacement.mm:
2742         (WebCore::QuickTimePluginReplacement::installReplacement):
2743         * bindings/js/IDBBindingUtilities.cpp:
2744         (WebCore::createIDBKeyFromValue):
2745         * bindings/js/JSCommandLineAPIHostCustom.cpp:
2746         (WebCore::JSCommandLineAPIHost::getEventListeners):
2747         (WebCore::JSCommandLineAPIHost::databaseId):
2748         (WebCore::JSCommandLineAPIHost::storageId):
2749         * bindings/js/JSCryptoAlgorithmDictionary.cpp:
2750         (WebCore::JSCryptoAlgorithmDictionary::parseAlgorithmIdentifier):
2751         (WebCore::createRsaKeyGenParams):
2752         * bindings/js/JSCryptoCustom.cpp:
2753         (WebCore::JSCrypto::getRandomValues):
2754         * bindings/js/JSCryptoOperationData.cpp:
2755         (WebCore::cryptoOperationDataFromJSValue):
2756         * bindings/js/JSCustomElementInterface.cpp:
2757         (WebCore::constructCustomElementSynchronously):
2758         (WebCore::JSCustomElementInterface::upgradeElement):
2759         * bindings/js/JSDOMBinding.cpp:
2760         (WebCore::valueToDate):
2761         (WebCore::reportException):
2762         (WebCore::retrieveErrorMessage):
2763         * bindings/js/JSDOMBinding.h:
2764         (WebCore::castThisValue):
2765         (WebCore::toPossiblySharedArrayBufferView):
2766         (WebCore::toUnsharedArrayBufferView):
2767         (WebCore::toPossiblySharedInt8Array):
2768         (WebCore::toPossiblySharedInt16Array):
2769         (WebCore::toPossiblySharedInt32Array):
2770         (WebCore::toPossiblySharedUint8Array):
2771         (WebCore::toPossiblySharedUint8ClampedArray):
2772         (WebCore::toPossiblySharedUint16Array):
2773         (WebCore::toPossiblySharedUint32Array):
2774         (WebCore::toPossiblySharedFloat32Array):
2775         (WebCore::toPossiblySharedFloat64Array):
2776         (WebCore::toUnsharedInt8Array):
2777         (WebCore::toUnsharedInt16Array):
2778         (WebCore::toUnsharedInt32Array):
2779         (WebCore::toUnsharedUint8Array):
2780         (WebCore::toUnsharedUint8ClampedArray):
2781         (WebCore::toUnsharedUint16Array):
2782         (WebCore::toUnsharedUint32Array):
2783         (WebCore::toUnsharedFloat32Array):
2784         (WebCore::toUnsharedFloat64Array):
2785         (WebCore::toRefNativeArray):
2786         * bindings/js/JSDOMConstructor.h:
2787         (WebCore::JSDOMConstructorNotConstructable<JSClass>::finishCreation):
2788         (WebCore::JSDOMConstructor<JSClass>::finishCreation):
2789         (WebCore::JSDOMNamedConstructor<JSClass>::finishCreation):
2790         (WebCore::JSBuiltinConstructor<JSClass>::finishCreation):
2791         * bindings/js/JSDOMConvert.h:
2792         (WebCore::Converter<IDLInterface<T>>::convert):
2793         (WebCore::Converter<IDLXPathNSResolver<T>>::convert):
2794         * bindings/js/JSDOMGlobalObject.cpp:
2795         (WebCore::JSDOMGlobalObject::finishCreation):
2796         (WebCore::JSDOMGlobalObject::scriptExecutionContext):
2797         * bindings/js/JSDOMIterator.h:
2798         (WebCore::IteratorTraits>::next):
2799         (WebCore::IteratorTraits>::finishCreation):
2800         * bindings/js/JSDOMWindowBase.cpp:
2801         (WebCore::JSDOMWindowBase::finishCreation):
2802         (WebCore::toJSDOMWindow):
2803         * bindings/js/JSDOMWindowBase.h:
2804         * bindings/js/JSDOMWindowCustom.cpp:
2805         (WebCore::jsDOMWindowWebKit):
2806         (WebCore::JSDOMWindow::toWrapped):
2807         * bindings/js/JSDOMWindowShell.cpp:
2808         (WebCore::JSDOMWindowShell::finishCreation):
2809         (WebCore::JSDOMWindowShell::toWrapped):
2810         * bindings/js/JSDOMWindowShell.h:
2811         * bindings/js/JSDocumentCustom.cpp:
2812         (WebCore::cachedDocumentWrapper):
2813         (WebCore::JSDocument::createTouchList):
2814         * bindings/js/JSDynamicDowncast.h:
2815         (WebCore::JSDynamicCastTrait::cast):
2816         (WebCore::JSDynamicCastTrait<JSNode>::cast):
2817         (WebCore::JSDynamicCastTrait<JSElement>::cast):
2818         (WebCore::JSDynamicCastTrait<JSDocument>::cast):
2819         (WebCore::JSDynamicCastTrait<JSEvent>::cast):
2820         (WebCore::jsDynamicDowncast):
2821         * bindings/js/JSEventListener.cpp:
2822         (WebCore::JSEventListener::handleEvent):
2823         * bindings/js/JSEventTargetCustom.cpp:
2824         (WebCore::JSEventTarget::toWrapped):
2825         (WebCore::jsEventTargetCast):
2826         * bindings/js/JSEventTargetCustom.h:
2827         (WebCore::BindingCaller<JSEventTarget>::callOperation):
2828         * bindings/js/JSExceptionBase.cpp:
2829         (WebCore::toExceptionBase):
2830         * bindings/js/JSExceptionBase.h:
2831         * bindings/js/JSInspectorFrontendHostCustom.cpp:
2832         (WebCore::populateContextMenuItems):
2833         (WebCore::JSInspectorFrontendHost::showContextMenu):
2834         * bindings/js/JSNodeCustom.cpp:
2835         (WebCore::JSNode::insertBefore):
2836         (WebCore::JSNode::replaceChild):
2837         (WebCore::JSNode::removeChild):
2838         (WebCore::JSNode::appendChild):
2839         (WebCore::JSNode::pushEventHandlerScope):
2840         * bindings/js/JSPluginElementFunctions.cpp:
2841         (WebCore::pluginElementPropertyGetter):
2842         * bindings/js/JSReadableStreamPrivateConstructors.cpp:
2843         (WebCore::constructJSReadableStreamDefaultReader):
2844         * bindings/js/JSReadableStreamSourceCustom.cpp:
2845         (WebCore::startReadableStream):
2846         (WebCore::JSReadableStreamSource::start):
2847         (WebCore::pullReadableStream):
2848         * bindings/js/JSSubtleCryptoCustom.cpp:
2849         (WebCore::toCryptoKey):
2850         (WebCore::jsSubtleCryptoFunctionEncryptPromise):
2851         (WebCore::jsSubtleCryptoFunctionDecryptPromise):
2852         (WebCore::jsSubtleCryptoFunctionSignPromise):
2853         (WebCore::jsSubtleCryptoFunctionVerifyPromise):
2854         (WebCore::jsSubtleCryptoFunctionDigestPromise):
2855         (WebCore::jsSubtleCryptoFunctionWrapKeyPromise):
2856         (WebCore::jsSubtleCryptoFunctionUnwrapKeyPromise):
2857         * bindings/js/JSTrackCustom.cpp:
2858         (WebCore::toTrack): Deleted.
2859         * bindings/js/JSTrackCustom.h:
2860         * bindings/js/JSWebKitSubtleCryptoCustom.cpp:
2861         (WebCore::JSWebKitSubtleCrypto::encrypt):
2862         (WebCore::JSWebKitSubtleCrypto::decrypt):
2863         (WebCore::JSWebKitSubtleCrypto::sign):
2864         (WebCore::JSWebKitSubtleCrypto::verify):
2865         (WebCore::JSWebKitSubtleCrypto::exportKey):
2866         (WebCore::JSWebKitSubtleCrypto::wrapKey):
2867         (WebCore::JSWebKitSubtleCrypto::unwrapKey):
2868         * bindings/js/JSWorkerGlobalScopeBase.cpp:
2869         (WebCore::JSWorkerGlobalScopeBase::finishCreation):
2870         (WebCore::toJSDedicatedWorkerGlobalScope):
2871         (WebCore::toJSWorkerGlobalScope):
2872         * bindings/js/JSWorkerGlobalScopeBase.h:
2873         * bindings/js/JSXMLHttpRequestCustom.cpp:
2874         (WebCore::JSXMLHttpRequest::send):
2875         * bindings/js/JSXPathNSResolverCustom.cpp:
2876         (WebCore::JSXPathNSResolver::toWrapped):
2877         * bindings/js/ScriptController.cpp:
2878         (WebCore::ScriptController::setupModuleScriptHandlers):
2879         * bindings/js/ScriptModuleLoader.cpp:
2880         (WebCore::ScriptModuleLoader::fetch):
2881         (WebCore::ScriptModuleLoader::evaluate):
2882         * bindings/js/ScriptState.cpp:
2883         (WebCore::domWindowFromExecState):
2884         (WebCore::scriptExecutionContextFromExecState):
2885         * bindings/js/SerializedScriptValue.cpp:
2886         (WebCore::CloneSerializer::isArray):
2887         (WebCore::CloneSerializer::isMap):
2888         (WebCore::CloneSerializer::isSet):
2889         (WebCore::CloneSerializer::dumpArrayBufferView):
2890         (WebCore::CloneSerializer::dumpIfTerminal):
2891         (WebCore::CloneSerializer::serialize):
2892         (WebCore::CloneDeserializer::CloneDeserializer):
2893         (WebCore::CloneDeserializer::readArrayBufferView):
2894         (WebCore::CloneDeserializer::readTerminal):
2895         (WebCore::transferArrayBuffers):
2896         (WebCore::SerializedScriptValue::create):
2897         * bindings/js/StructuredClone.cpp:
2898         (WebCore::structuredCloneArrayBuffer):
2899         (WebCore::structuredCloneArrayBufferView):
2900         * bindings/js/WorkerScriptController.cpp:
2901         (WebCore::WorkerScriptController::evaluate):
2902         * bindings/scripts/CodeGeneratorJS.pm:
2903         (GenerateHeader):
2904         (GenerateOverloadedFunctionOrConstructor):
2905         (GenerateImplementation):
2906         * bindings/scripts/test/JS/JSInterfaceName.cpp:
2907         (WebCore::JSInterfaceName::finishCreation):
2908         (WebCore::jsInterfaceNameConstructor):
2909         (WebCore::setJSInterfaceNameConstructor):
2910         (WebCore::JSInterfaceName::toWrapped):
2911         * bindings/scripts/test/JS/JSInterfaceName.h:
2912         * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
2913         (WebCore::JSTestActiveDOMObject::finishCreation):
2914         (WebCore::BindingCaller<JSTestActiveDOMObject>::castForAttribute):
2915         (WebCore::BindingCaller<JSTestActiveDOMObject>::castForOperation):
2916         (WebCore::jsTestActiveDOMObjectConstructor):
2917         (WebCore::setJSTestActiveDOMObjectConstructor):
2918         (WebCore::JSTestActiveDOMObject::toWrapped):
2919         * bindings/scripts/test/JS/JSTestActiveDOMObject.h:
2920         * bindings/scripts/test/JS/JSTestCEReactions.cpp:
2921         (WebCore::JSTestCEReactions::finishCreation):
2922         (WebCore::BindingCaller<JSTestCEReactions>::castForAttribute):
2923         (WebCore::BindingCaller<JSTestCEReactions>::castForOperation):
2924         (WebCore::jsTestCEReactionsConstructor):
2925         (WebCore::setJSTestCEReactionsConstructor):
2926         (WebCore::JSTestCEReactions::toWrapped):
2927         * bindings/scripts/test/JS/JSTestCEReactions.h:
2928         * bindings/scripts/test/JS/JSTestCEReactionsStringifier.cpp:
2929         (WebCore::JSTestCEReactionsStringifier::finishCreation):
2930         (WebCore::BindingCaller<JSTestCEReactionsStringifier>::castForAttribute):
2931         (WebCore::BindingCaller<JSTestCEReactionsStringifier>::castForOperation):
2932         (WebCore::jsTestCEReactionsStringifierConstructor):
2933         (WebCore::setJSTestCEReactionsStringifierConstructor):
2934         (WebCore::JSTestCEReactionsStringifier::toWrapped):
2935         * bindings/scripts/test/JS/JSTestCEReactionsStringifier.h:
2936         * bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.cpp:
2937         (WebCore::JSTestClassWithJSBuiltinConstructor::finishCreation):
2938         (WebCore::jsTestClassWithJSBuiltinConstructorConstructor):
2939         (WebCore::setJSTestClassWithJSBuiltinConstructorConstructor):
2940         (WebCore::JSTestClassWithJSBuiltinConstructor::toWrapped):
2941         * bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.h:
2942         * bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.cpp:
2943         (WebCore::JSTestCustomConstructorWithNoInterfaceObject::finishCreation):
2944         (WebCore::jsTestCustomConstructorWithNoInterfaceObjectConstructor):
2945         (WebCore::setJSTestCustomConstructorWithNoInterfaceObjectConstructor):
2946         (WebCore::JSTestCustomConstructorWithNoInterfaceObject::toWrapped):
2947         * bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.h:
2948         * bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp:
2949         (WebCore::JSTestCustomNamedGetter::finishCreation):
2950         (WebCore::BindingCaller<JSTestCustomNamedGetter>::castForOperation):
2951         (WebCore::jsTestCustomNamedGetterConstructor):
2952         (WebCore::setJSTestCustomNamedGetterConstructor):
2953         (WebCore::JSTestCustomNamedGetter::toWrapped):
2954         * bindings/scripts/test/JS/JSTestCustomNamedGetter.h:
2955         * bindings/scripts/test/JS/JSTestDOMJIT.cpp:
2956         (WebCore::JSTestDOMJIT::finishCreation):
2957         (WebCore::BindingCaller<JSTestDOMJIT>::castForAttribute):
2958         (WebCore::BindingCaller<JSTestDOMJIT>::castForOperation):
2959         (WebCore::jsTestDOMJITConstructor):
2960         (WebCore::setJSTestDOMJITConstructor):
2961         * bindings/scripts/test/JS/JSTestEventConstructor.cpp:
2962         (WebCore::JSTestEventConstructor::finishCreation):
2963         (WebCore::BindingCaller<JSTestEventConstructor>::castForAttribute):
2964         (WebCore::jsTestEventConstructorConstructor):
2965         (WebCore::setJSTestEventConstructorConstructor):
2966         * bindings/scripts/test/JS/JSTestEventTarget.cpp:
2967         (WebCore::JSTestEventTarget::finishCreation):
2968         (WebCore::BindingCaller<JSTestEventTarget>::castForOperation):
2969         (WebCore::jsTestEventTargetConstructor):
2970         (WebCore::setJSTestEventTargetConstructor):
2971         (WebCore::JSTestEventTarget::toWrapped):
2972         * bindings/scripts/test/JS/JSTestEventTarget.h:
2973         * bindings/scripts/test/JS/JSTestException.cpp:
2974         (WebCore::JSTestException::finishCreation):
2975         (WebCore::BindingCaller<JSTestException>::castForAttribute):
2976         (WebCore::jsTestExceptionConstructor):
2977         (WebCore::setJSTestExceptionConstructor):
2978         (WebCore::JSTestException::toWrapped):
2979         * bindings/scripts/test/JS/JSTestException.h:
2980         * bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp:
2981         (WebCore::JSTestGenerateIsReachable::finishCreation):
2982         (WebCore::jsTestGenerateIsReachableConstructor):
2983         (WebCore::setJSTestGenerateIsReachableConstructor):
2984         (WebCore::JSTestGenerateIsReachable::toWrapped):
2985         * bindings/scripts/test/JS/JSTestGenerateIsReachable.h:
2986         * bindings/scripts/test/JS/JSTestGlobalObject.cpp:
2987         (WebCore::JSTestGlobalObject::finishCreation):
2988         (WebCore::BindingCaller<JSTestGlobalObject>::castForAttribute):
2989         (WebCore::BindingCaller<JSTestGlobalObject>::castForOperation):
2990         (WebCore::jsTestGlobalObjectConstructor):
2991         (WebCore::setJSTestGlobalObjectConstructor):
2992         (WebCore::JSTestGlobalObject::toWrapped):
2993         * bindings/scripts/test/JS/JSTestGlobalObject.h:
2994         * bindings/scripts/test/JS/JSTestInterface.cpp:
2995         (WebCore::JSTestInterface::finishCreation):
2996         (WebCore::BindingCaller<JSTestInterface>::castForAttribute):
2997         (WebCore::BindingCaller<JSTestInterface>::castForOperation):
2998         (WebCore::jsTestInterfaceConstructor):
2999         (WebCore::setJSTestInterfaceConstructor):
3000         (WebCore::JSTestInterface::toWrapped):
3001         * bindings/scripts/test/JS/JSTestInterface.h:
3002         * bindings/scripts/test/JS/JSTestInterfaceLeadingUnderscore.cpp:
3003         (WebCore::JSTestInterfaceLeadingUnderscore::finishCreation):
3004         (WebCore::BindingCaller<JSTestInterfaceLeadingUnderscore>::castForAttribute):
3005         (WebCore::jsTestInterfaceLeadingUnderscoreConstructor):
3006         (WebCore::setJSTestInterfaceLeadingUnderscoreConstructor):
3007         (WebCore::JSTestInterfaceLeadingUnderscore::toWrapped):
3008         * bindings/scripts/test/JS/JSTestInterfaceLeadingUnderscore.h:
3009         * bindings/scripts/test/JS/JSTestIterable.cpp:
3010         (WebCore::JSTestIterable::finishCreation):
3011         (WebCore::BindingCaller<JSTestIterable>::castForOperation):
3012         (WebCore::jsTestIterableConstructor):
3013         (WebCore::setJSTestIterableConstructor):
3014         (WebCore::JSTestIterable::toWrapped):
3015         * bindings/scripts/test/JS/JSTestIterable.h:
3016         * bindings/scripts/test/JS/JSTestJSBuiltinConstructor.cpp:
3017         (WebCore::JSTestJSBuiltinConstructor::finishCreation):
3018         (WebCore::BindingCaller<JSTestJSBuiltinConstructor>::castForAttribute):
3019         (WebCore::BindingCaller<JSTestJSBuiltinConstructor>::castForOperation):
3020         (WebCore::jsTestJSBuiltinConstructorConstructor):
3021         (WebCore::setJSTestJSBuiltinConstructorConstructor):
3022         * bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp:
3023         (WebCore::JSTestMediaQueryListListener::finishCreation):
3024         (WebCore::BindingCaller<JSTestMediaQueryListListener>::castForOperation):
3025         (WebCore::jsTestMediaQueryListListenerConstructor):
3026         (WebCore::setJSTestMediaQueryListListenerConstructor):
3027         (WebCore::JSTestMediaQueryListListener::toWrapped):
3028         * bindings/scripts/test/JS/JSTestMediaQueryListListener.h:
3029         * bindings/scripts/test/JS/JSTestNamedConstructor.cpp:
3030         (WebCore::JSTestNamedConstructor::finishCreation):
3031         (WebCore::jsTestNamedConstructorConstructor):
3032         (WebCore::setJSTestNamedConstructorConstructor):
3033         (WebCore::JSTestNamedConstructor::toWrapped):
3034         * bindings/scripts/test/JS/JSTestNamedConstructor.h:
3035         * bindings/scripts/test/JS/JSTestNode.cpp:
3036         (WebCore::JSTestNode::finishCreation):
3037         (WebCore::BindingCaller<JSTestNode>::castForAttribute):
3038         (WebCore::BindingCaller<JSTestNode>::castForOperation):
3039         (WebCore::jsTestNodeConstructor):
3040         (WebCore::setJSTestNodeConstructor):
3041         * bindings/scripts/test/JS/JSTestObj.cpp:
3042         (WebCore::JSTestObj::finishCreation):
3043         (WebCore::BindingCaller<JSTestObj>::castForAttribute):
3044         (WebCore::BindingCaller<JSTestObj>::castForOperation):
3045         (WebCore::jsTestObjConstructor):
3046         (WebCore::setJSTestObjConstructor):
3047         (WebCore::jsTestObjPrototypeFunctionOverloadedMethod):
3048         (WebCore::jsTestObjPrototypeFunctionOverloadedMethodWithOptionalParameter):
3049         (WebCore::jsTestObjPrototypeFunctionOverloadedMethodWithDistinguishingUnion):
3050         (WebCore::jsTestObjPrototypeFunctionOverloadedMethodWith2DistinguishingUnions):
3051         (WebCore::jsTestObjPrototypeFunctionOverloadedMethodWithNonDistinguishingUnion):
3052         (WebCore::jsTestObjPrototypeFunctionOverloadWithNullableUnion):
3053         (WebCore::jsTestObjPrototypeFunctionOverloadWithNullableNonDistinguishingParameter):
3054         (WebCore::jsTestObjPrototypeFunctionTestPromiseOverloadedFunction):
3055         (WebCore::JSTestObj::toWrapped):
3056         * bindings/scripts/test/JS/JSTestObj.h:
3057         * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
3058         (WebCore::JSTestOverloadedConstructorsConstructor::construct):
3059         (WebCore::JSTestOverloadedConstructors::finishCreation):
3060         (WebCore::jsTestOverloadedConstructorsConstructor):
3061         (WebCore::setJSTestOverloadedConstructorsConstructor):
3062         (WebCore::JSTestOverloadedConstructors::toWrapped):
3063         * bindings/scripts/test/JS/JSTestOverloadedConstructors.h:
3064         * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.cpp:
3065         (WebCore::JSTestOverloadedConstructorsWithSequence::finishCreation):
3066         (WebCore::jsTestOverloadedConstructorsWithSequenceConstructor):
3067         (WebCore::setJSTestOverloadedConstructorsWithSequenceConstructor):
3068         (WebCore::JSTestOverloadedConstructorsWithSequence::toWrapped):
3069         * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.h:
3070         * bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp:
3071         (WebCore::JSTestOverrideBuiltins::finishCreation):
3072         (WebCore::BindingCaller<JSTestOverrideBuiltins>::castForOperation):
3073         (WebCore::jsTestOverrideBuiltinsConstructor):
3074         (WebCore::setJSTestOverrideBuiltinsConstructor):
3075         (WebCore::JSTestOverrideBuiltins::toWrapped):
3076         * bindings/scripts/test/JS/JSTestOverrideBuiltins.h:
3077         * bindings/scripts/test/JS/JSTestSerialization.cpp:
3078         (WebCore::JSTestSerialization::finishCreation):
3079         (WebCore::BindingCaller<JSTestSerialization>::castForAttribute):
3080         (WebCore::BindingCaller<JSTestSerialization>::castForOperation):
3081         (WebCore::jsTestSerializationConstructor):
3082         (WebCore::setJSTestSerializationConstructor):
3083         (WebCore::JSTestSerialization::toWrapped):
3084         * bindings/scripts/test/JS/JSTestSerialization.h:
3085         * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
3086         (WebCore::JSTestSerializedScriptValueInterface::finishCreation):
3087         (WebCore::BindingCaller<JSTestSerializedScriptValueInterface>::castForAttribute):
3088         (WebCore::BindingCaller<JSTestSerializedScriptValueInterface>::castForOperation):
3089         (WebCore::jsTestSerializedScriptValueInterfaceConstructor):
3090         (WebCore::setJSTestSerializedScriptValueInterfaceConstructor):
3091         (WebCore::JSTestSerializedScriptValueInterface::toWrapped):
3092         * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.h:
3093         * bindings/scripts/test/JS/JSTestTypedefs.cpp:
3094         (WebCore::JSTestTypedefs::finishCreation):
3095         (WebCore::BindingCaller<JSTestTypedefs>::castForAttribute):
3096         (WebCore::BindingCaller<JSTestTypedefs>::castForOperation):
3097         (WebCore::jsTestTypedefsConstructor):
3098         (WebCore::setJSTestTypedefsConstructor):
3099         (WebCore::JSTestTypedefs::toWrapped):
3100         * bindings/scripts/test/JS/JSTestTypedefs.h:
3101         * bridge/c/CRuntimeObject.cpp:
3102         (JSC::Bindings::CRuntimeObject::finishCreation):
3103         * bridge/c/c_instance.cpp:
3104         (JSC::Bindings::CRuntimeMethod::finishCreation):
3105         (JSC::Bindings::CInstance::invokeMethod):
3106         * bridge/c/c_utility.cpp:
3107         (JSC::Bindings::convertValueToNPVariant):
3108         * bridge/objc/ObjCRuntimeObject.mm:
3109         (JSC::Bindings::ObjCRuntimeObject::finishCreation):
3110         * bridge/objc/WebScriptObject.mm:
3111         (-[WebScriptObject setValue:forKey:]):
3112         (+[WebScriptObject _convertValueToObjcValue:originRootObject:rootObject:]):
3113         * bridge/objc/objc_instance.mm:
3114         (ObjCRuntimeMethod::finishCreation):
3115         (ObjcInstance::invokeMethod):
3116         * bridge/objc/objc_runtime.mm:
3117         (JSC::Bindings::ObjcFallbackObjectImp::finishCreation):
3118         (JSC::Bindings::callObjCFallbackObject):
3119         * bridge/runtime_array.cpp:
3120         (JSC::RuntimeArray::finishCreation):
3121         (JSC::RuntimeArray::lengthGetter):
3122         * bridge/runtime_method.cpp:
3123         (JSC::RuntimeMethod::finishCreation):
3124         (JSC::RuntimeMethod::lengthGetter):
3125         (JSC::callRuntimeMethod):
3126         * bridge/runtime_object.cpp:
3127         (JSC::Bindings::RuntimeObject::finishCreation):
3128         (JSC::Bindings::callRuntimeObject):
3129         (JSC::Bindings::callRuntimeConstructor):
3130         * css/FontFace.cpp:
3131         (WebCore::FontFace::create):
3132         * html/HTMLMediaElement.cpp:
3133         (WebCore::controllerJSValue):
3134         (WebCore::HTMLMediaElement::updateCaptionContainer):
3135         (WebCore::HTMLMediaElement::didAddUserAgentShadowRoot):
3136         * inspector/InspectorController.cpp:
3137         (WebCore::InspectorController::canAccessInspectedScriptState):
3138         * inspector/InspectorDOMAgent.cpp:
3139         (WebCore::InspectorDOMAgent::buildObjectForEventListener):
3140         (WebCore::InspectorDOMAgent::scriptValueAsNode):
3141         * inspector/WebInjectedScriptHost.cpp:
3142         (WebCore::WebInjectedScriptHost::subtype):
3143         (WebCore::WebInjectedScriptHost::isHTMLAllCollection):
3144         * inspector/WebInjectedScriptHost.h:
3145
3146 2017-01-26  Dean Jackson  <dino@apple.com>
3147
3148         WebGL content in Safari sticks to GPU that it was started on, sometimes causing extra battery drain and difficulty interacting with UI
3149         https://bugs.webkit.org/show_bug.cgi?id=167477
3150         <rdar://problem/29956321>
3151
3152         Reviewed by Tim Horton.
3153
3154         We were not implementing the recommended approach to properly handle
3155         GPU switching, causing some contexts to remain on a GPU and slow
3156         down the machine's UI. It also could stop the discrete GPU from
3157         turning off.
3158
3159         Register for CGL's display reconfiguration notification, so that we
3160         can alert any active CGLContexts and cause them to update.
3161
3162         The code change here doesn't lend itself to automated testing because
3163         it is specific to hardware with multiple GPUs, relies on some separate
3164         tools to detect which GPU is active, and an external method of triggering
3165         a GPU switch. It's best tested by the manual workflow in Radar.
3166
3167         * platform/graphics/GraphicsContext3D.h: Add a macOS-specific update
3168         call.
3169         * platform/graphics/mac/GraphicsContext3DMac.mm:
3170         (WebCore::displayWasReconfigured): The callback for display reconfigurations.
3171         (WebCore::addActiveContext): Helper to keep track of active contexts, so we
3172         can register/unregister the callback when necessary.
3173         (WebCore::removeActiveContext):
3174         (WebCore::GraphicsContext3D::create): Use the new helpers.
3175         (WebCore::GraphicsContext3D::~GraphicsContext3D):
3176         (WebCore::GraphicsContext3D::updateCGLContext): Tell the CGLContextRef to update.
3177
3178 2017-01-26  Commit Queue  <commit-queue@webkit.org>
3179
3180         Unreviewed, rolling out r210328.
3181         https://bugs.webkit.org/show_bug.cgi?id=167476
3182
3183         Blocking bug is fixed <rdar://problem/29957753> (Requested by
3184         keith_miller on #webkit).
3185
3186         Reverted changeset:
3187
3188         "Disable smooth playhead animation for main content media in
3189         the Touch Bar"
3190         https://bugs.webkit.org/show_bug.cgi?id=166715
3191         http://trac.webkit.org/changeset/210328
3192
3193 2017-01-26  Joseph Pecoraro  <pecoraro@apple.com>
3194
3195         Web Inspector: iOS: Memory timeline shows impossible values for Page size (underflowed)
3196         https://bugs.webkit.org/show_bug.cgi?id=167468
3197         <rdar://problem/30099051>
3198
3199         Reviewed by Andreas Kling.
3200
3201         * page/cocoa/ResourceUsageThreadCocoa.mm:
3202         (WebCore::vmPageSize):
3203         This value matches the sysctl value we were attempting to access, and is
3204         the most appropriate when dealing with mach APIs, as we are using here.
3205
3206 2017-01-26  Jer Noble  <jer.noble@apple.com>
3207
3208         Autoplay muted videos stop playback of any streaming app in the background
3209         https://bugs.webkit.org/show_bug.cgi?id=163993
3210         <rdar://problem/29020431>
3211
3212         Reviewed by Eric Carlson.
3213
3214         Added test in TestWebKitAPI, WebKit1.AudioSessionCategoryIOS.
3215
3216         Previously, we would set the audio session category to "playback" if there was a media-
3217         element-type media session, and if there was a session capable of playing audio. But because
3218         this was an "or" operation, we would incorrectly set the category to "playback" if there was
3219         a video element incapable of rendering audio (due to being muted, without an audio track,
3220         etc.), and also a session capable of producing audio, such as WebAudio.
3221
3222         With this change, this turns into an "and" operation; there must be a media element capable
3223         of rendering audio in order to switch the audio session category to "playback".
3224
3225         Additionally, we no longer cache the value of "canProduceAudio()"; it's queried directly
3226         whenever updateSessionState() is called.
3227
3228         * Modules/webaudio/AudioContext.cpp:
3229         (WebCore::AudioContext::constructCommon):
3230         * Modules/webaudio/AudioContext.h:
3231         * html/HTMLMediaElement.cpp:
3232         (WebCore::HTMLMediaElement::insertedInto):
3233         (WebCore::HTMLMediaElement::loadResource):
3234         (WebCore::HTMLMediaElement::setMuted):
3235         (WebCore::HTMLMediaElement::mediaPlayerCurrentPlaybackTargetIsWirelessChanged):
3236         (WebCore::HTMLMediaElement::mediaPlayerCharacteristicChanged):
3237         (WebCore::HTMLMediaElement::clearMediaPlayer):
3238         (WebCore::HTMLMediaElement::mediaPlayerCurrentPlaybackTargetIsWirelessChanged):
3239         (WebCore::HTMLMediaElement::presentationType):
3240         (WebCore::HTMLMediaElement::characteristics):
3241         (WebCore::HTMLMediaElement::canProduceAudio):
3242         * html/HTMLMediaElement.h:
3243         * platform/audio/PlatformMediaSession.cpp:
3244         (WebCore::PlatformMediaSession::activeAudioSessionRequired):
3245         (WebCore::PlatformMediaSession::canProduceAudio):
3246         (WebCore::PlatformMediaSession::canProduceAudioChanged):
3247         (WebCore::PlatformMediaSession::setCanProduceAudio): Deleted.
3248         * platform/audio/PlatformMediaSession.h:
3249         (WebCore::PlatformMediaSessionClient::canProduceAudio):
3250         (WebCore::PlatformMediaSession::canProduceAudio): Deleted.
3251         * platform/audio/cocoa/MediaSessionManagerCocoa.cpp:
3252         (PlatformMediaSessionManager::updateSessionState):
3253
3254 2017-01-26  Filip Pizlo  <fpizlo@apple.com>
3255
3256         EventTarget should visit the JSEventListeners using visitAdditionalChildren
3257         https://bugs.webkit.org/show_bug.cgi?id=167462
3258
3259         Reviewed by Michael Saboff.
3260
3261         No new tests because this is already caught by existing testing. This would show up as ASSERTs
3262         in debug, and we suspect it might be at fault for null deref crashes.
3263         
3264         Previously, EventTarget would have its event listeners visited by its subclasses' visitChildren
3265         methods. Every subclass of EventTarget would call EventTarget's visitJSEventListeners. For
3266         example, this means that if JSFoo has seven classes between it and JSEventTarget in the JSCell
3267         class hierarchy, then JSFoo::visitChildren would end up calling visitJSEventListeners seven extra
3268         times.
3269         
3270         Also, the weird way that visitJSEventListeners was called meant that it was not part of the GC's
3271         output constraint processing. This meant that it would not be called when the GC tried to
3272         terminate. So, if something about the event listener changes during a GC cycle, the GC would
3273         potentially fail to mark one of the references.
3274         
3275         Both problems can be solved by simply moving the call to visitJSEventListeners into
3276         visitAdditionalChildren.
3277
3278         * bindings/js/JSDOMWindowCustom.cpp:
3279         (WebCore::JSDOMWindow::visitAdditionalChildren):
3280         * bindings/js/JSEventTargetCustom.cpp:
3281         (WebCore::JSEventTarget::visitAdditionalChildren):
3282         * bindings/scripts/CodeGeneratorJS.pm:
3283         (GenerateImplementation):
3284         * dom/EventTarget.idl:
3285
3286 2017-01-26  Andy Estes  <aestes@apple.com>
3287
3288         [QuickLook] Create temporary files with NSFileProtectionCompleteUnlessOpen
3289         https://bugs.webkit.org/show_bug.cgi?id=167455
3290         <rdar://problem/12499118>
3291
3292         Reviewed by David Kilzer.
3293
3294         Add the NSFileProtectionKey attribute with value NSFileProtectionCompleteUnlessOpen to
3295         temporary directories created for QuickLook files. Also:
3296
3297         1. Stop calling -[NSFileManager _web_pathWithUniqueFilenameForPath:], since the temporary
3298         directory is already unique and only one file will be placed inside it.
3299         2. Create the temporary file with -[NSFileManager _web_createFileAtPath:contents:attributes:]
3300         instead of with -[NSFileManager _web_createFileAtPathWithIntermediateDirectories:contents:attributes:directoryAttributes:],
3301         since the intermediate directories were already created by createTemporaryDirectory().
3302         3. Explicitly set the temporary directory's attributes with
3303         -[NSFileManager setAttributes:ofItemAtPath:error:].
3304         4. Append the lastPathComponent of fileName to downloadDirectory to ensure fileName isn't
3305         really a relative path.
3306
3307         * loader/ios/QuickLook.h: Stopped declaring QLFileAttributes() and QLDirectoryAttributes().
3308         * loader/ios/QuickLook.mm:
3309         (WebCore::temporaryFileAttributes): Renamed from QLFileAttributes().
3310         (WebCore::temporaryDirectoryAttributes): Renamed from QLDirectoryAttributes().
3311         (WebCore::createTemporaryFileForQuickLook):
3312         (WebCore::QLFileAttributes): Deleted.
3313         (WebCore::QLDirectoryAttributes): Deleted.
3314         * platform/spi/cocoa/NSFileManagerSPI.h: Declared -_web_createFileAtPath:contents:attributes:
3315         and removed declarations for -_web_createFileAtPathWithIntermediateDirectories:contents:attributes:directoryAttributes:
3316         and -_web_pathWithUniqueFilenameForPath:
3317
3318 2017-01-26  Jeremy Jones  <jeremyj@apple.com>
3319
3320         Pointer lock events should be delivered directly to the target element
3321         https://bugs.webkit.org/show_bug.cgi?id=167134
3322
3323         Reviewed by Jon Lee.
3324
3325         pointer-lock/mouse-event-delivery.html: Enabled for mac, added wheel event tests.
3326
3327         When pointer is locked on an element, route mouse events directly to the target element, instead of 
3328         doing the normal event disptach.
3329
3330         * page/EventHandler.cpp:
3331         (WebCore::EventHandler::handleMousePressEvent):
3332         (WebCore::EventHandler::handleMouseDoubleClickEvent):
3333         (WebCore::EventHandler::handleMouseMoveEvent):
3334         (WebCore::EventHandler::handleMouseReleaseEvent):
3335         (WebCore::EventHandler::handleMouseForceEvent):
3336         (WebCore::EventHandler::handleWheelEvent):
3337         * page/PointerLockController.cpp:
3338         (WebCore::PointerLockController::isLocked): Added.
3339         (WebCore::PointerLockController::dispatchLockedWheelEvent): Added.
3340         * page/PointerLockController.h:
3341
3342 2017-01-26  Chris Dumez  <cdumez@apple.com>
3343
3344         Fix CPU / Memory diagnostic logging in PerformanceMonitor
3345         https://bugs.webkit.org/show_bug.cgi?id=167469
3346         <rdar://problem/30220959>
3347
3348         Reviewed by Alex Christensen.
3349
3350         Fix CPU / Memory diagnostic logging in PerformanceMonitor to use logDiagnosticMessage()
3351         instead of logDiagnosticMessageWithValue(). logDiagnosticMessageWithValue() should only
3352         be used with numeric values but we already take care of the bucketing on our side.
3353
3354         * page/DiagnosticLoggingClient.h:
3355         * page/DiagnosticLoggingKeys.cpp:
3356         (WebCore::DiagnosticLoggingKeys::postPageBackgroundingCPUUsageKey):
3357         (WebCore::DiagnosticLoggingKeys::postPageBackgroundingMemoryUsageKey):
3358         (WebCore::DiagnosticLoggingKeys::postPageLoadCPUUsageKey):
3359         (WebCore::DiagnosticLoggingKeys::postPageLoadMemoryUsageKey):
3360         (WebCore::DiagnosticLoggingKeys::foregroundCPUUsageToDiagnosticLoggingKey):
3361         (WebCore::DiagnosticLoggingKeys::backgroundCPUUsageToDiagnosticLoggingKey):
3362         (WebCore::DiagnosticLoggingKeys::postPageBackgroundingKey): Deleted.
3363         (WebCore::DiagnosticLoggingKeys::postPageLoadKey): Deleted.
3364         (WebCore::DiagnosticLoggingKeys::memoryUsageKey): Deleted.
3365         * page/DiagnosticLoggingKeys.h:
3366         * page/PerformanceMonitor.cpp:
3367         (WebCore::PerformanceMonitor::measurePostLoadCPUUsage):
3368         (WebCore::PerformanceMonitor::measurePostLoadMemoryUsage):
3369         (WebCore::PerformanceMonitor::measurePostBackgroundingMemoryUsage):
3370         (WebCore::PerformanceMonitor::measurePostBackgroundingCPUUsage):
3371
3372 2017-01-26  Brady Eidson  <beidson@apple.com>
3373
3374         Gamepads: Some DPads are still not exposed in the HID backend.
3375         rdar://problem/30217518 and https://bugs.webkit.org/show_bug.cgi?id=167465
3376
3377         Reviewed by Alex Christensen.
3378
3379         No new tests (Currently unable to test HID backend directly)
3380
3381         * platform/gamepad/mac/HIDGamepad.cpp:
3382         (WebCore::HIDGamepad::maybeAddButton): Allow GenericDesktop paged elements that are DPads to be buttons.
3383
3384 2017-01-26  Commit Queue  <commit-queue@webkit.org>
3385
3386         Unreviewed, rolling out r210095.
3387         https://bugs.webkit.org/show_bug.cgi?id=167464
3388
3389         broke tiling on mac (Requested by thorton on #webkit).
3390
3391         Reverted changeset:
3392
3393         "TileGrid revalidates tiles twice during flush, first with
3394         wrong visible rect"
3395         https://bugs.webkit.org/show_bug.cgi?id=166406
3396         http://trac.webkit.org/changeset/210095
3397
3398 2017-01-26  Chris Dumez  <cdumez@apple.com>
3399
3400         Fix WebGL diagnostic logging
3401         https://bugs.webkit.org/show_bug.cgi?id=167463
3402         <rdar://problem/30216981>
3403
3404         Reviewed by Alex Christensen.
3405
3406         Fix WebGL diagnostic logging so that it no longer uses logDiagnosticMessageWithValue().
3407         This is because the value apparently needs to be numeric on Mac.
3408
3409         * html/canvas/WebGLRenderingContextBase.cpp:
3410         (WebCore::WebGLRenderingContextBase::checkForContextLossHandling):
3411         * page/DiagnosticLoggingKeys.cpp:
3412         (WebCore::DiagnosticLoggingKeys::pageHandlesWebGLContextLossKey):
3413         (WebCore::WebCore::DiagnosticLoggingKeys::webGLStateKey):
3414         (WebCore::DiagnosticLoggingKeys::stateKey): Deleted.
3415         (WebCore::DiagnosticLoggingKeys::handlesContextLossKey): Deleted.
3416         (WebCore::WebCore::DiagnosticLoggingKeys::webGLKey): Deleted.
3417         * page/DiagnosticLoggingKeys.h:
3418
3419 2017-01-26  Zalan Bujtas  <zalan@apple.com>
3420
3421         Simple line layout: Add support for -webkit-hyphenate-limit-lines
3422         https://bugs.webkit.org/show_bug.cgi?id=167446
3423         <rdar://problem/30194030>
3424
3425         Reviewed by Antti Koivisto.
3426
3427         Now we can set the limit on the number of lines that a word can split across through hyphenation.
3428
3429         Tests: fast/text/simple-line-layout-hyphen-limit-lines.html
3430                fast/text/simple-line-layout-hyphen-limit-lines2.html
3431
3432         * rendering/SimpleLineLayout.cpp:
3433         (WebCore::SimpleLineLayout::canUseForStyle):
3434         (WebCore::SimpleLineLayout::splitFragmentToFitLine):
3435         (WebCore::SimpleLineLayout::printReason):
3436         * rendering/SimpleLineLayoutTextFragmentIterator.cpp:
3437         (WebCore::SimpleLineLayout::TextFragmentIterator::Style::Style):
3438         * rendering/SimpleLineLayoutTextFragmentIterator.h:
3439         (WebCore::SimpleLineLayout::TextFragmentIterator::TextFragment::TextFragment):
3440         (WebCore::SimpleLineLayout::TextFragmentIterator::TextFragment::wrappingWithHyphenCounter):
3441         (WebCore::SimpleLineLayout::TextFragmentIterator::TextFragment::splitWithHyphen): The right side of the split has +1 on the wrapping counter.
3442
3443 2017-01-26  Wenson Hsieh  <wenson_hsieh@apple.com>
3444
3445         Add support for recognizing data interaction gestures in WebKit2
3446         https://bugs.webkit.org/show_bug.cgi?id=167444
3447
3448         Reviewed by Beth Dakin.
3449
3450         Minor tweaks to pasteboard code to support data interaction.
3451
3452         * WebCore.xcodeproj/project.pbxproj:
3453         * platform/PlatformPasteboard.h:
3454         * platform/ios/PasteboardIOS.mm:
3455         (WebCore::Pasteboard::read):
3456         * platform/ios/PlatformPasteboardIOS.mm:
3457         (WebCore::PlatformPasteboard::PlatformPasteboard):
3458
3459         If the pasteboard is the special data interaction type, use the shared item provider pasteboard; otherwise,
3460         fall back to the general pasteboard.
3461
3462         (WebCore::PlatformPasteboard::getTypes):
3463
3464         Actually populate the list of available types using available pasteboardTypes.
3465
3466         (WebCore::PlatformPasteboard::write):
3467
3468         Add UTF8 plaintext type (kUTTypeUTF8PlainText) when vending data representations of rich text.
3469
3470         * platform/ios/WebItemProviderPasteboard.mm:
3471         (-[WebItemProviderPasteboard setItems:]):
3472         (-[WebItemProviderPasteboard dataForPasteboardType:inItemSet:]):
3473         (-[WebItemProviderPasteboard valuesForPasteboardType:inItemSet:]):
3474
3475         Move off of deprecated methods when retrieving and supplying data to the item provider pasteboard.
3476
3477         * platform/spi/ios/UIKitSPI.h:
3478
3479 2017-01-26  Matt Rajca  <mrajca@apple.com>
3480
3481         Notify clients when the user plays media otherwise prevented from autoplaying
3482         https://bugs.webkit.org/show_bug.cgi?id=167390
3483
3484         Reviewed by Alex Christensen.
3485
3486         The API is tested.
3487
3488         * html/HTMLMediaElement.cpp:
3489         (WebCore::HTMLMediaElement::playInternal):
3490         * page/ChromeClient.h:
3491
3492 2017-01-26  Enrique Ocaña González  <eocanha@igalia.com>
3493
3494         [GStreamer] ASSERTION FAILED: !g_object_is_floating(ptr) in adoptGRef(GstContext* ptr)
3495         https://bugs.webkit.org/show_bug.cgi?id=167458
3496
3497         Reviewed by Xabier Rodriguez-Calvar.
3498
3499         GstContext is a mini_object, not a GObject. Therefore it shouldn't (and can't) be checked for floatingness.
3500
3501         * platform/graphics/gstreamer/GRefPtrGStreamer.cpp:
3502         (WTF::adoptGRef): Removed incorrect assertion.
3503
3504 2017-01-26  Zalan Bujtas  <zalan@apple.com>
3505
3506         Simple line layout: Add support for -webkit-hyphenate-limit-after and -webkit-hyphenate-limit-before
3507         https://bugs.webkit.org/show_bug.cgi?id=167439
3508         <rdar://problem/30180184>
3509
3510         Reviewed by Antti Koivisto.
3511
3512         Implement pre and post hyphen length constrains for simple line layout.
3513
3514         Tests: fast/text/simple-line-layout-hyphen-limit-after.html
3515                fast/text/simple-line-layout-hyphen-limit-before.html
3516
3517         * rendering/SimpleLineLayout.cpp:
3518         (WebCore::SimpleLineLayout::canUseForStyle):
3519         (WebCore::SimpleLineLayout::printReason):
3520         * rendering/SimpleLineLayoutTextFragmentIterator.cpp:
3521         (WebCore::SimpleLineLayout::TextFragmentIterator::Style::Style): Same as normal line layout default values.
3522         (WebCore::SimpleLineLayout::TextFragmentIterator::lastHyphenPosition):
3523         * rendering/SimpleLineLayoutTextFragmentIterator.h:
3524
3525 2017-01-26  Brady Eidson  <beidson@apple.com>
3526
3527         Gamepad support shows wrong values for PS4 controllers (D-pad is missing).
3528         <rdar://problem/29578619> and https://bugs.webkit.org/show_bug.cgi?id=165588
3529
3530         Reviewed by Alex Christensen.
3531
3532         No new tests (Currently unable to test HID backend directly)
3533
3534         DPads report their HID type as "a button", but their HID usage is "Hatswitch".
3535         This patch adds a new element type that maps a "hatswitch" value to 4 additional buttons.
3536         
3537         * platform/gamepad/mac/HIDGamepad.cpp:
3538         (WebCore::HIDGamepad::initElements):
3539         (WebCore::HIDGamepad::initElementsFromArray):
3540         (WebCore::HIDGamepad::maybeAddButton):
3541         (WebCore::HIDGamepad::maybeAddDPad):
3542         (WebCore::HIDGamepad::maybeAddAxis):
3543         (WebCore::fillInButtonValues):
3544         (WebCore::HIDGamepad::valueChanged):
3545
3546         * platform/gamepad/mac/HIDGamepad.h:
3547         (WebCore::HIDGamepadElement::isDPad):
3548         (WebCore::HIDGamepadDPad::HIDGamepadDPad):
3549         (WebCore::HIDGamepadDPad::normalizedValue):
3550
3551 2017-01-26  Antoine Quint  <graouts@apple.com>
3552
3553         [Modern Media Controls] Hiding controls, changing their width and showing them again shows an incorrect layout
3554         https://bugs.webkit.org/show_bug.cgi?id=167160
3555         <rdar://problem/29612318>
3556
3557         Reviewed by Dean Jackson.
3558
3559         When we toggle visibility of the controls bar, we notify the hosting media controls and in the case of the
3560         macOS inline media controls, we update the controls layout which would have failed to run last time it tried
3561         due to the controls bar being hidden.
3562
3563         Test: media/modern-media-controls/macos-inline-media-controls/macos-inline-media-controls-resize-with-hidden-controls-bar.html
3564
3565         * Modules/modern-media-controls/controls/controls-bar.js:
3566         (ControlsBar.prototype.set visible):
3567         * Modules/modern-media-controls/controls/macos-inline-media-controls.js:
3568         (MacOSInlineMediaControls.prototype.controlsBarVisibilityDidChange):
3569         * Modules/modern-media-controls/controls/media-controls.js:
3570         (MediaControls.prototype.controlsBarVisibilityDidChange):
3571
3572 2017-01-26  Csaba Osztrogonác  <ossy@webkit.org>
3573
3574         [Mac][cmake] Unreviewed speculative buildfix after r211161.
3575         https://bugs.webkit.org/show_bug.cgi?id=167294
3576
3577         * PlatformMac.cmake:
3578
3579 2017-01-26  Zan Dobersek  <zdobersek@igalia.com>
3580
3581         ImageBufferCairo: cairo_image_surface should use bmalloc-allocated memory
3582         https://bugs.webkit.org/show_bug.cgi?id=165751
3583
3584         Reviewed by Carlos Garcia Campos.
3585
3586         Allocate the underlying memory for cairo_image_surface objects through FastMalloc.
3587         This way we can steer such large allocations away from the default libc allocator.
3588
3589         Objects of this class can create Cairo surfaces that need as much as 4MB of memory
3590         for the underlying pixel buffer. Allocating such objects through the default
3591         libc allocator can lead to increased memory usage because of non-optimal allocation
3592         strategy in libc. In contrast, bmalloc performs large allocations by directly using
3593         mmap() to reserve the necessary memory.
3594
3595         The improvements can be significant. On nytimes.com, with the threaded version of
3596         the CoordinatedGraphics system, the memory consumption can drop by roughly 20%.
3597
3598         * platform/graphics/cairo/ImageBufferCairo.cpp:
3599         (WebCore::ImageBuffer::ImageBuffer): Zero-allocate the necessary memory via FastMalloc.
3600         Tie that memory lifetime to the lifetime of the surface by using
3601         cairo_surface_set_user_data() with the specific user data key.
3602
3603 2017-01-26  Miguel Gomez  <magomez@igalia.com>
3604
3605         [GTK] WebProcess from WebKitGtk+ 2.15.3 SIGSEVs in WebCore::GraphicsContext3D::drawArrays(unsigned int, int, int) at Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:740
3606         https://bugs.webkit.org/show_bug.cgi?id=167296
3607
3608         Reviewed by Sergio Villar Senin.
3609
3610         Use a VBO to pass the vertex data when using the stencil for clipping. Passing a custom array without
3611         using an VBO is deprecated when using OpenGL >= 3.0 and a Core profile.
3612
3613         No behaviour change, no new tests.
3614
3615         * platform/graphics/texmap/TextureMapperGL.cpp:
3616         (WebCore::TextureMapperGL::beginClip):
3617
3618 2017-01-25  Ryosuke Niwa  <rniwa@webkit.org>
3619
3620         Crash under DOMSelection::deleteFromDocument()
3621         https://bugs.webkit.org/show_bug.cgi?id=167232
3622
3623         Reviewed by Chris Dumez.
3624
3625         The crash was caused by DOMSelection's deleteFromDocument() mutating contents inside the user-agent
3626         shadow tree of an input element when the text field is readonly. Fixed the bug by exiting early
3627         whenever the selection is inside a shadow tree since getSelection().getRangeAt(0) always returns
3628         a range outside the input element or any shadow tree for that matter.
3629
3630         New behavior matches that of Gecko. The working draft spec of which I'm the editor states that
3631         deleteFromDocument() must invoke Range's deleteContents() on the associated range, which is
3632         the collapsed range returned by getSelection().getRangeAt(0) in the spec:
3633         https://www.w3.org/TR/2016/WD-selection-api-20160921/#widl-Selection-deleteFromDocument-void
3634         And Range's deleteContents() immediately terminates in step 1 when start and end are identical:
3635         https://dom.spec.whatwg.org/commit-snapshots/6b7621282c2e3b222ac585650e484abf4c0a416b/
3636
3637         Note that Range's DOM mutating methods are not available inside an user-agent shadow tree because
3638         WebKit never returns a Range whose end boundary points are inside the tree to author scripts.
3639         Editing commands (ones executable from document.execCommand) that mutate DOM like this check whether
3640         the content is editable or not. Since VisibleSelection's validate() function makes sure the selection
3641         is either entirely within or outside of an root editable element (editing host in the W3C spec lingo),
3642         editing commands should never mutate a random node inside an user-agent shadow tree.
3643
3644         Test: editing/selection/deleteFromDocument-shadow-tree-crash.html
3645
3646         * page/DOMSelection.cpp:
3647         (WebCore::DOMSelection::deleteFromDocument):
3648
3649 2017-01-25  Ryan Haddad  <ryanhaddad@apple.com>
3650
3651         Unreviewed, rolling out r211193.
3652
3653         This change broke internal builds.
3654
3655         Reverted changeset:
3656
3657         "Notify clients when the user plays media otherwise prevented
3658         from autoplaying"
3659         https://bugs.webkit.org/show_bug.cgi?id=167390
3660         http://trac.webkit.org/changeset/211193
3661
3662 2017-01-25  Wenson Hsieh  <wenson_hsieh@apple.com>
3663
3664         Add infrastructure to support data interaction in WebKit2
3665         https://bugs.webkit.org/show_bug.cgi?id=167443
3666
3667         Reviewed by Simon Fraser.
3668
3669         Adds support in WebCore to determine whether there is interactive data at a given position. No new tests, since
3670         there should be no behavior change yet.
3671
3672         * page/EventHandler.h:
3673         * page/Page.cpp:
3674         (WebCore::Page::hasDataInteractionAtPosition):
3675         * page/Page.h:
3676
3677 2017-01-25  Matt Rajca  <mrajca@apple.com>
3678
3679         Notify clients when the user plays media otherwise prevented from autoplaying
3680         https://bugs.webkit.org/show_bug.cgi?id=167390
3681
3682         Reviewed by Alex Christensen.
3683
3684         The API is tested.
3685
3686         * html/HTMLMediaElement.cpp:
3687         (WebCore::HTMLMediaElement::playInternal):
3688         * page/ChromeClient.h:
3689
3690 2017-01-25  Wenson Hsieh  <wenson_hsieh@apple.com>
3691
3692         Refactor drag and drop implementation on Mac
3693         https://bugs.webkit.org/show_bug.cgi?id=167427
3694
3695         Reviewed by Enrica Casucci.
3696
3697         Refactors some code around drag and drop on Mac, and cleans up some other related code as needed. This patch
3698         should result in no behavior change.
3699
3700         * dom/DataTransfer.cpp:
3701         * page/EventHandler.cpp:
3702         * page/ios/EventHandlerIOS.mm:
3703         (WebCore::EventHandler::eventLoopHandleMouseDragged):
3704         * page/mac/EventHandlerMac.mm:
3705         * platform/DragImage.cpp:
3706         * platform/Pasteboard.h:
3707         * platform/ios/DragImageIOS.mm:
3708         * platform/ios/PasteboardIOS.mm:
3709         * platform/mac/DragDataMac.mm:
3710         (rtfPasteboardType):
3711         (rtfdPasteboardType):
3712         (stringPasteboardType):
3713         (urlPasteboardType):
3714         (htmlPasteboardType):
3715         (colorPasteboardType):
3716         (pdfPasteboardType):
3717         (tiffPasteboardType):
3718         (WebCore::DragData::DragData):
3719         (WebCore::DragData::containsColor):
3720         (WebCore::DragData::containsFiles):
3721         (WebCore::DragData::numberOfFiles):
3722         (WebCore::DragData::asFilenames):
3723         (WebCore::DragData::containsPlainText):
3724         (WebCore::DragData::containsCompatibleContent):
3725         (WebCore::DragData::containsPromise):
3726         (WebCore::DragData::asURL):
3727         * platform/mac/DragImageMac.mm:
3728
3729 2017-01-25  Youenn Fablet  <youenn@apple.com>
3730
3731         [WebRTC] Add support for incoming and outgoing libwebrtc audio tracks
3732         https://bugs.webkit.org/show_bug.cgi?id=167438
3733
3734         Reviewed by Eric Carlson.
3735
3736         RealtimeIncomingAudioSource consumes audio buffers given by libwebrtc.
3737         RealtimeOutgoingAudioSource consumes audio buffers from WebCore tracks (capture typically) and feeds libwebrtc with them.
3738         To be covered by Layout/mock tests once LibWebRTC peer connection will be added.
3739         These are only skeletons right now, the conversion between WebCore and LibWebRTC data is not yet implemented.
3740
3741         * WebCore.xcodeproj/project.pbxproj:
3742         * platform/mediastream/mac/RealtimeIncomingAudioSource.cpp: Added.
3743         (WebCore::RealtimeIncomingAudioSource::create):
3744         (WebCore::RealtimeIncomingAudioSource::RealtimeIncomingAudioSource):
3745         (WebCore::RealtimeIncomingAudioSource::OnData):
3746         (WebCore::RealtimeIncomingAudioSource::startProducingData):
3747         (WebCore::RealtimeIncomingAudioSource::stopProducingData):
3748         (WebCore::RealtimeIncomingAudioSource::capabilities):
3749         (WebCore::RealtimeIncomingAudioSource::settings):
3750         (WebCore::RealtimeIncomingAudioSource::supportedConstraints):
3751         (WebCore::RealtimeIncomingAudioSource::addObserver):
3752         (WebCore::RealtimeIncomingAudioSource::removeObserver):
3753         (WebCore::RealtimeIncomingAudioSource::start):
3754         (WebCore::RealtimeIncomingAudioSource::audioSourceProvider):
3755         * platform/mediastream/mac/RealtimeIncomingAudioSource.h: Added.
3756         * platform/mediastream/mac/RealtimeOutgoingAudioSource.cpp: Added.
3757         (WebCore::RealtimeOutgoingAudioSource::sourceHasMoreMediaData):
3758         * platform/mediastream/mac/RealtimeOutgoingAudioSource.h: Added.
3759
3760 2017-01-25  Youenn Fablet  <youenn@apple.com>
3761
3762         [WebRTC] Add support for libwebrtc video incoming and outgoing video tracks
3763         https://bugs.webkit.org/show_bug.cgi?id=167432
3764
3765         Reviewed by Eric Carlson.
3766
3767         Not covered by tests right now, this will be covered by layout/mock tests.
3768         RealtimeIncomingVideoSource consumes video frames given by libwebrtc.
3769         RealtimeOutgoingVideoSource consumes video frames from WebCore tracks (capture typically) and feeds libwebrtc with them.
3770
3771         * platform/mediastream/mac/RealtimeIncomingVideoSource.cpp: Added.
3772         (WebCore::RealtimeIncomingVideoSource::create):
3773         (WebCore::RealtimeIncomingVideoSource::RealtimeIncomingVideoSource):
3774         (WebCore::RealtimeIncomingVideoSource::startProducingData):
3775         (WebCore::RealtimeIncomingVideoSource::stopProducingData):
3776         (WebCore::RealtimeIncomingVideoSource::OnFrame):
3777         (WebCore::RealtimeIncomingVideoSource::processNewSample):
3778         (WebCore::drawImage):
3779         (WebCore::RealtimeIncomingVideoSource::currentFrameImage):
3780         (WebCore::RealtimeIncomingVideoSource::paintCurrentFrameInContext):
3781         (WebCore::RealtimeIncomingVideoSource::capabilities):
3782         (WebCore::RealtimeIncomingVideoSource::settings):
3783         (WebCore::RealtimeIncomingVideoSource::supportedConstraints):
3784         * platform/mediastream/mac/RealtimeIncomingVideoSource.h: Added.
3785         * platform/mediastream/mac/RealtimeOutgoingVideoSource.cpp: Added.
3786         (WebCore::RealtimeOutgoingVideoSource::RealtimeOutgoingVideoSource):
3787         (WebCore::RealtimeOutgoingVideoSource::GetStats):
3788         (WebCore::RealtimeOutgoingVideoSource::AddOrUpdateSink):
3789         (WebCore::RealtimeOutgoingVideoSource::RemoveSink):
3790         (WebCore::RealtimeOutgoingVideoSource::sourceHasMoreMediaData):
3791         * platform/mediastream/mac/RealtimeOutgoingVideoSource.h: Added.
3792
3793 2017-01-25  Wenson Hsieh  <wenson_hsieh@apple.com>
3794
3795         Introduce an item-provider-based pasteboard wrapper
3796         https://bugs.webkit.org/show_bug.cgi?id=167410
3797
3798         Reviewed by Enrica Casucci.
3799
3800         Introduces WebItemProviderPasteboard, a pasteboard-like object backed by a number of item providers. No new
3801         tests, since there is no behavior change.
3802
3803         * WebCore.xcodeproj/project.pbxproj:
3804         * platform/ios/AbstractPasteboard.h: Copied from Source/WebCore/platform/spi/ios/UIKitSPI.h.
3805         * platform/ios/WebItemProviderPasteboard.h: Copied from Source/WebCore/platform/spi/ios/UIKitSPI.h.
3806         * platform/ios/WebItemProviderPasteboard.mm: Added.
3807         (isRichTextType):
3808         (isStringType):
3809         (isURLType):
3810         (isColorType):
3811         (isImageType):
3812         (+[WebItemProviderPasteboard sharedInstance]):
3813         (-[WebItemProviderPasteboard init]):
3814         (-[WebItemProviderPasteboard dealloc]):
3815         (-[WebItemProviderPasteboard pasteboardTypes]):
3816         (-[WebItemProviderPasteboard setItemProviders:]):
3817         (-[WebItemProviderPasteboard numberOfItems]):
3818         (-[WebItemProviderPasteboard setItems:]):
3819         (-[WebItemProviderPasteboard dataForPasteboardType:inItemSet:]):
3820         (-[WebItemProviderPasteboard valuesForPasteboardType:inItemSet:]):
3821         (-[WebItemProviderPasteboard changeCount]):
3822         (-[WebItemProviderPasteboard itemProviderAtIndex:]):
3823         * platform/spi/ios/UIKitSPI.h:
3824
3825 2017-01-25  Konstantin Tokarev  <annulen@yandex.ru>
3826
3827         Removed leftovers of pre-2015 VisualStudio support
3828         https://bugs.webkit.org/show_bug.cgi?id=167434
3829
3830         Reviewed by Alex Christensen.
3831
3832         No new tests needed.
3833
3834         * platform/graphics/filters/FEConvolveMatrix.cpp: Replaced MSC_VER
3835         usage with COMPILER(MSVC)
3836
3837 2017-01-25  Youenn Fablet  <youenn@apple.com>
3838
3839         Fixing typos in r211161
3840         https://bugs.webkit.org/show_bug.cgi?id=167433
3841
3842         Reviewed by Alex Christensen.
3843
3844         * platform/mediastream/libwebrtc/LibWebRTCProvider.h:
3845
3846 2017-01-25  Simon Fraser  <simon.fraser@apple.com>
3847
3848         Revert r210882, removing support for background-repeat-x/y
3849         https://bugs.webkit.org/show_bug.cgi?id=167223
3850
3851         Reviewed by Myles C. Maxfield.
3852         
3853         Followup from r211149; I missed part of the patch when committing.
3854
3855         * css/parser/CSSParserFastPaths.cpp:
3856         (WebCore::CSSParserFastPaths::isKeywordPropertyID):
3857
3858 2017-01-25  Youenn Fablet  <youennf@gmail.com>
3859
3860         [WebRTC] Introduce libwebrtc abstraction for WK1/WK2 implementations
3861         https://bugs.webkit.org/show_bug.cgi?id=167294
3862
3863         Reviewed by Alex Christensen.
3864
3865         Introducing LibWebRTCMacros.h which should be included before any libwebrtc header.
3866
3867         Introducing LibWebRTCProvider as the abstraction allowing to suport WK1 and WK2 libwebrtc-based WebRTC endpoints.
3868         It  will create a libwebrtc peerconnection object differently in WK1 and WK2 as networking will be done differently.
3869
3870         LibWebRTCUtils contains routines used by WK1 and WK2 RTC providers to create the libwebrtc peerconnection object
3871         and implement the necessary functionalities for it.
3872
3873         Updating PageConfiguration accordingly.
3874
3875         * WebCore.xcodeproj/project.pbxproj:
3876         * page/Page.cpp:
3877         (WebCore::Page::Page):
3878         * page/Page.h:
3879         (WebCore::Page::libWebRTCProvider):
3880         * page/PageConfiguration.cpp:
3881         (WebCore::PageConfiguration::PageConfiguration):
3882         * page/PageConfiguration.h:
3883         * platform/mediastream/libwebrtc/LibWebRTCMacros.h: Added.
3884         * platform/mediastream/libwebrtc/LibWebRTCProvider.h: Added.
3885         * platform/mediastream/libwebrtc/LibWebRTCUtils.cpp: Added.
3886         (WebCore::staticFactoryAndThreads):
3887         (WebCore::ThreadMessageData::ThreadMessageData):
3888         (WebCore::PeerConnectionFactoryAndThreads::OnMessage):
3889         (WebCore::callOnWebRTCNetworkThread):
3890         (WebCore::initializePeerConnectionFactoryAndThreads):
3891         (WebCore::initializeLibWebRTCInternalsWithSocketServer):
3892         (WebCore::peerConnectionFactory):
3893         (WebCore::createPeerConnection):
3894         * platform/mediastream/libwebrtc/LibWebRTCUtils.h: Added.
3895         * svg/graphics/SVGImage.cpp:
3896         (WebCore::SVGImage::dataChanged):
3897
3898 2017-01-25  Wenson Hsieh  <wenson_hsieh@apple.com>
3899
3900         Add support for named pasteboards, pasteboard strategies and platform pasteboards
3901         https://bugs.webkit.org/show_bug.cgi?id=167404
3902
3903         Reviewed by Enrica Casucci.
3904
3905         Refactors some pasteboard-related code to plumb the name of the pasteboard across from WebCore to the client
3906         layer. No new tests, because there should be no change in behavior.
3907
3908         * platform/DragData.h:
3909         * platform/Pasteboard.h:
3910         * platform/PasteboardStrategy.h:
3911         * platform/PlatformPasteboard.h:
3912         * platform/ios/PasteboardIOS.mm:
3913         (WebCore::Pasteboard::Pasteboard):
3914         (WebCore::Pasteboard::write):
3915         (WebCore::Pasteboard::writePlainText):
3916         (WebCore::Pasteboard::read):
3917         (WebCore::Pasteboard::hasData):
3918         (WebCore::Pasteboard::clear):
3919         (WebCore::Pasteboard::readString):
3920         (WebCore::Pasteboard::writeString):
3921         (WebCore::Pasteboard::types):
3922
3923 2017-01-25  Antoine Quint  <graouts@apple.com>
3924
3925         LayoutTest media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-buttons-containers-styles.html is flaky
3926         https://bugs.webkit.org/show_bug.cgi?id=167253
3927
3928         Reviewed by Jon Lee.
3929
3930         An IconButton loads its image asynchronously and waits for its load to obtain metrics. Once that happens,
3931         its layout delegate needs to be notified that it needs a new layout. The test was a flaky failure because
3932         the images would sometime load prior to layout, and sometime after, which would cause a failure. The test
3933         is now robust with a controls layout happening after all buttons had loaded.
3934
3935         * Modules/modern-media-controls/controls/icon-button.js:
3936         (IconButton.prototype._updateImage):
3937         (IconButton):
3938
3939 2017-01-25  Timothy Hatcher  <timothy@hatcher.name>
3940
3941         Fix the !HAVE(ACCESSIBILITY) build by properly instantiating AXObjectCache member timers.
3942
3943         * accessibility/AXObjectCache.h:
3944         (WebCore::AXObjectCache::AXObjectCache):
3945
3946 2017-01-25  Chris Dumez  <cdumez@apple.com>
3947
3948         Measure how common it is for content to deal with WebGL context loss
3949         https://bugs.webkit.org/show_bug.cgi?id=166866
3950         <rdar://problem/30171195>
3951
3952         Reviewed by Alex Christensen.
3953
3954         Add diagnostic logging to measure how common it is for sites to handle
3955         WebGL context loss via the webglcontextlost & webglcontextrestored
3956         events.
3957
3958         * html/canvas/WebGLRenderingContextBase.cpp:
3959         (WebCore::WebGLRenderingContextBase::WebGLRenderingContextBase):
3960         (WebCore::WebGLRenderingContextBase::checkForContextLossHandling):
3961         * html/canvas/WebGLRenderingContextBase.h:
3962         * page/DiagnosticLoggingKeys.cpp:
3963         (WebCore::DiagnosticLoggingKeys::noKey):
3964         (WebCore::DiagnosticLoggingKeys::yesKey):
3965         (WebCore::DiagnosticLoggingKeys::handlesContextLossKey):
3966         * page/DiagnosticLoggingKeys.h:
3967
3968 2017-01-25  Simon Fraser  <simon.fraser@apple.com>
3969