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