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