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