[GTK] WebKitWebProcess at 100% CPU loading hyphenation dictionaries
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2017-01-12  Zan Dobersek  <zdobersek@igalia.com>
2
3         [GTK] WebKitWebProcess at 100% CPU loading hyphenation dictionaries
4         https://bugs.webkit.org/show_bug.cgi?id=165601
5
6         Reviewed by Carlos Garcia Campos.
7
8         In HyphenationLibHyphen, retrieve the canonicalized absolute pathname of the dictionary file
9         in order to avoid storing symbolic links as the target files for specific locales. libhyphen
10         distributes its dictionary files by linking a set of similar locales files to a single file.
11         Not resolving those symbolic links means we'll be opening a single file via multiple
12         HyphenationDictionary objects, which is far from optimal.
13
14         To add insult to injury, these HyphenationDictionary objects were stored in a TinyLRUCache
15         with a slim capacity of 4. This meant that while already loading one single file through
16         multiple symlinks, because of continuous eviciton from this LRU cache the same symlinks
17         continued to be processed, in some cases resulting in opening the same dictionary file
18         hundreds or thousands of times. The capacity of this TinyLRUCache is increased to 32
19         to keep the amount of open libhyphen dictionaries capped at some reasonable number.
20
21         * platform/text/hyphen/HyphenationLibHyphen.cpp:
22         (WebCore::scanDirectoryForDicionaries):
23
24 2017-01-12  Javier Fernandez  <jfernandez@igalia.com>
25
26         [css-grid] Make the grid sizing data persistent through layouts
27         https://bugs.webkit.org/show_bug.cgi?id=166883
28
29         Reviewed by Darin Adler and Manuel Rego Casasnovas.
30
31         We want to keep the grid sizing data structures through different
32         layouts. This will allow to optimize some operations, reusing
33         these data while still valid. Additionally, operations like
34         determining the baseline position when the grid container is under
35         an inline formatting context need these data once the grid has
36         been laid out.
37
38         This patch controls the sizing data validity and make the data
39         structures persistent after layout.
40
41         Tests: fast/css-grid-layout/grid-add-item-with-positioned-items.html
42                fast/css-grid-layout/grid-add-positioned-block-item-after-inline-item.html
43                fast/css-grid-layout/grid-container-change-explicit-grid-recompute-child.html
44                fast/css-grid-layout/grid-item-change-order-auto-flow.html
45
46         * rendering/RenderBox.cpp:
47         (WebCore::RenderBox::styleDidChange): Evaluate if the style change made the grid data invalid.
48         (WebCore::RenderBox::updateGridPositionAfterStyleChange): Evaluate if the style change made the grid data invalid.
49         * rendering/RenderBox.h:
50         * rendering/RenderGrid.cpp:
51         (WebCore::RenderGrid::Grid::setNeedsItemsPlacement): The grid must execute the items placement logic before continue processing the layout.
52         (WebCore::RenderGrid::addChild): Mark the grid data as dirty.
53         (WebCore::RenderGrid::removeChild): Mark the grid data as dirty.
54         (WebCore::RenderGrid::styleDidChange): Evaluate grid data validity.
55         (WebCore::RenderGrid::explicitGridDidResize): Mark the grid data as dirty.
56         (WebCore::RenderGrid::namedGridLinesDefinitionDidChange): Mark the grid data as dirty.
57         (WebCore::RenderGrid::layoutBlock): We don't need to clear the grid data anymore.
58         (WebCore::RenderGrid::dirtyGrid): Clearing the grid data and mark is as needing to execute the items placement logic.
59         (WebCore::RenderGrid::trackSizesForComputedStyle): Assert we don't need to perform the items placement logic.
60         (WebCore::RenderGrid::paintChildren): Assert we don't need to perform the items placement logic.
61         * rendering/RenderGrid.h:
62         (WebCore::RenderGrid::clear): Deleted.
63
64 2017-01-12  Chris Dumez  <cdumez@apple.com>
65
66         [iOS] Implement support for KeyboardEvent.code
67         https://bugs.webkit.org/show_bug.cgi?id=166932
68         <rdar://problem/29972518>
69
70         Reviewed by Darin Adler.
71
72         Implement support for KeyboardEvent.code on iOS.
73
74         No new tests, updated existing test.
75
76         * platform/ios/PlatformEventFactoryIOS.h:
77         * platform/ios/PlatformEventFactoryIOS.mm:
78         (WebCore::codeForKeyEvent):
79         (WebCore::PlatformKeyboardEventBuilder::PlatformKeyboardEventBuilder):
80
81 2017-01-12  Sam Weinig  <sam@webkit.org>
82
83         [WebIDL] Autogenerate named getters
84         https://bugs.webkit.org/show_bug.cgi?id=166835
85
86         Reviewed by Alex Christensen.
87
88         * Modules/mediastream/RTCStatsResponse.idl:
89         Update type to be nullable, since generator expects that for now.
90
91         * WebCore.xcodeproj/project.pbxproj:
92         * bindings/js/JSCustomSQLStatementErrorCallback.cpp: Removed.
93         * bindings/js/JSDOMMimeTypeArrayCustom.cpp: Removed.
94         * bindings/js/JSDOMNamedFlowCollectionCustom.cpp: Removed.
95         * bindings/js/JSDOMPluginArrayCustom.cpp: Removed.
96         * bindings/js/JSDOMPluginCustom.cpp: Removed.
97         * bindings/js/JSNamedNodeMapCustom.cpp: Removed.
98         * bindings/js/JSRTCStatsResponseCustom.cpp: Removed.
99         * bindings/js/JSStyleSheetListCustom.cpp: Removed.
100         Remove deleted files.
101
102         * bindings/js/JSSQLStatementErrorCallbackCustom.cpp: 
103         Renamed from Source/WebCore/bindings/js/JSCustomSQLStatementErrorCallback.cpp for consistency.
104
105         * bindings/IDLTypes.h:
106         (WebCore::IDLNullable::nullValue):
107         (WebCore::IDLNullable::isNullValue):
108         (WebCore::IDLNullable::extractValueFromNullable):
109         Add Nullable traits for IDLNullable, that call down to the underlying type. This allows
110         us to more easily tests for nullability without stripping the IDLNullable off.
111
112         * bindings/js/JSDOMStringMapCustom.cpp:
113         (WebCore::JSDOMStringMap::getOwnPropertySlotDelegate): Deleted.
114         (WebCore::JSDOMStringMap::getOwnPropertyNames): Deleted.
115         Remove overriden getOwnPropertySlot and getOwnPropertyNames.
116
117         * bindings/js/JSHTMLCollectionCustom.cpp:
118         (WebCore::JSHTMLCollection::nameGetter): Deleted.
119         * bindings/js/JSHTMLFormElementCustom.cpp:
120         (WebCore::JSHTMLFormElement::nameGetter): Deleted.
121         * bindings/js/JSHTMLOptionsCollectionCustom.cpp:
122         (WebCore::JSHTMLOptionsCollection::nameGetter): Deleted.
123         * bindings/js/JSStorageCustom.cpp:
124         (WebCore::JSStorage::nameGetter): Deleted.
125         Remove custom name getters.
126
127         * bindings/js/JSHTMLSelectElementCustom.cpp:
128         (WebCore::selectElementIndexSetter):
129         * html/HTMLSelectElement.cpp:
130         (WebCore::HTMLSelectElement::setItem):
131         (WebCore::HTMLSelectElement::setLength):
132         (WebCore::HTMLSelectElement::setOption): Deleted.
133         * html/HTMLSelectElement.h:
134         Add implementation of HTMLSelectElement::setItem() that does properly
135         removes if the option is null. Re-implement selectElementIndexSetter to
136         use it and switch conversion code to use JSDOMConvert.
137
138         * bindings/scripts/CodeGeneratorJS.pm:
139         (GenerateIndexedGetter):
140         (GenerateNamedGetter):
141         Extract typed getter generation into their own functions.
142
143         (GenerateGetOwnPropertySlotBody):
144         (GenerateGetOwnPropertySlotBodyByIndex):
145         Extract getOwnPropertySlotBody / getOwnPropertySlotBodyByIndex generation
146         into their own functions. Add support for generating name getters.
147
148         (GenerateGetOwnPropertyNames):
149         Extract getOwnPropertyNames generation into its own function, adding support
150         for respecting the LegacyUnenumerableNamedProperties attribute and switching
151         the default to not include named properties in the enumerated names.
152
153         (GeneratePut):
154         (GeneratePutByIndex):
155         Extract put / putByIndex generators into their own functions in preparation
156         of supporting namedSetters in the future.
157
158         (GetIndexedSetterFunction):
159         (GetNamedSetterFunction):
160         (GetNamedDeleterFunction):
161         Add helper getter functions to extract named/index setter/deleters.
162
163         (InstanceOverridesPut):
164         Add helper predicate to determine if an interface needs an implementation
165         of put.
166
167         (GenerateHeader):
168         Place custom helper functions (e.g. nameGetter/putDelegate/etc.) together
169         in the generated header.
170
171         (GenerateImplementation):
172         (GenerateCallbackImplementationContent):
173         Replace inline generation with calls to the new helper generator functions.
174
175         (NativeToJSValueUsingReferences):
176         (NativeToJSValueUsingPointers):
177         (NativeToJSValue):
178         Remove unused inFunctionCall parameter, and add new suppressExceptionCheck
179         parameter, which is used for nameGetters.
180
181         * bindings/scripts/IDLAttributes.txt:
182         Add LegacyUnenumerableNamedProperties.
183     
184         * css/StyleSheetList.cpp:
185         (WebCore::StyleSheetList::namedItem):
186         (WebCore::StyleSheetList::getNamedItem): Deleted.
187         * css/StyleSheetList.h:
188         * css/StyleSheetList.idl:
189         Rename getNamedItem to namedItem, and make it return a CSSStyleSheet*
190         which is what the bindings specify.
191
192         * dom/DOMNamedFlowCollection.idl:
193         Add LegacyUnenumerableNamedProperties to match existing behavior.
194
195         * dom/DOMStringMap.h:
196         Switch from typedef to type alias.
197
198         * dom/DOMStringMap.idl:
199         Remove CustomEnumerateProperty and JSCustomGetOwnPropertySlotAndDescriptor
200         and add the getter. Also add the missing setter and deleter commented out.
201
202         * dom/DatasetDOMStringMap.h:
203         * dom/DatasetDOMStringMap.cpp:
204         (WebCore::DatasetDOMStringMap::supportedPropertyNames):
205         (WebCore::DatasetDOMStringMap::names): Deleted.
206         Rename names to supportedPropertyNames to support the bindings.
207
208         (WebCore::DatasetDOMStringMap::item):
209         (WebCore::DatasetDOMStringMap::namedItem):
210         Add namedItems (to support the bindings), and rework item to return
211         an optional rather than using a bool out parameter.
212
213         * dom/NamedNodeMap.idl:
214         Add LegacyUnenumerableNamedProperties matching the spec.
215
216         * html/HTMLAllCollection.idl:
217         Add CustomNamedGetter and LegacyUnenumerableNamedProperties. Update signatures
218         to match the spec. Commenting out ones not implemented yet.
219
220         * html/HTMLCollection.idl:
221         Add LegacyUnenumerableNamedProperties matching the spec.
222
223         * html/HTMLFormControlsCollection.idl:
224         Add CustomNamedGetter. Update signature of the getter to match the spec.
225         The reason this can't be generated yet is that we don't have a good strategy
226         for functions with differing return types that shadow each other.
227
228         * html/HTMLFormElement.h:
229         * html/HTMLFormElement.cpp:
230         (WebCore::HTMLFormElement::namedItem):
231         (WebCore::HTMLFormElement::supportedPropertyNames):
232         Add implementation of namedItem and stub of supportedPropertyNames.
233
234         * html/HTMLFormElement.idl:
235         Add LegacyUnenumerableNamedProperties and remove CustomNamedGetter. Update
236         the signatures to match the spec.
237
238         * page/DOMWindow.idl:
239         Add LegacyUnenumerableNamedProperties matching the spec.
240
241         * plugins/DOMMimeTypeArray.idl:
242         * plugins/DOMPlugin.idl:
243         * plugins/DOMPluginArray.idl:
244         Add LegacyUnenumerableNamedProperties and add nullability to return types.
245
246 2017-01-12  Said Abou-Hallawa  <sabouhallawa@apple.com>
247
248         [iOS][WK1] Fix initialization of CADisplayLink::preferredFramesPerSecond
249         https://bugs.webkit.org/show_bug.cgi?id=166956
250
251         Reviewed by Tim Horton.
252         
253         Set this option to 60fps instead of leaving set to the default.
254
255         * platform/graphics/ios/DisplayRefreshMonitorIOS.mm:
256         (-[WebDisplayLinkHandler initWithMonitor:]):
257
258 2017-01-12  Yusuke Suzuki  <utatane.tea@gmail.com>
259
260         Unreviewed, build fix for macOS ports
261         https://bugs.webkit.org/show_bug.cgi?id=166925
262
263         * WebCore.xcodeproj/project.pbxproj:
264
265 2017-01-12  Yusuke Suzuki  <utatane.tea@gmail.com>
266
267         Implement InlineClassicScript
268         https://bugs.webkit.org/show_bug.cgi?id=166925
269
270         Reviewed by Ryosuke Niwa.
271
272         As of r210585, ScriptFetcher functionality is decoupled from ScriptElement.
273         This patch is a further cleanup. We introduce InlineClassicScript, which is
274         similar to LoadableClassicScript / LoadableModuleScript. And we move ScriptFetcher
275         functionality from LoadableScript to CachedScriptFetcher, which is the base
276         class of InlineClassicScript and LoadableScript.
277
278         And we start setting this CachedScriptFetcher to the member of JSC::SourceOrigin.
279         This allows us to examine the ScriptFetcher from the SourceOrigin.
280         When dynamic-import operator is called, we need to get the ScriptFetcher from the
281         caller script SourceOrigin since the subsequent module loading needs to know the
282         metadata about fetching and ScriptFetcher delivers it.
283
284         No behavior change.
285
286         * CMakeLists.txt:
287         * bindings/js/CachedModuleScript.cpp:
288         (WebCore::CachedModuleScript::load):
289         * bindings/js/CachedModuleScript.h:
290         * bindings/js/CachedModuleScriptLoader.cpp:
291         (WebCore::CachedModuleScriptLoader::create):
292         (WebCore::CachedModuleScriptLoader::CachedModuleScriptLoader):
293         (WebCore::CachedModuleScriptLoader::load):
294         * bindings/js/CachedModuleScriptLoader.h:
295         * bindings/js/CachedScriptFetcher.cpp: Copied from Source/WebCore/dom/LoadableScript.cpp.
296         (WebCore::CachedScriptFetcher::requestScriptWithCache):
297         * bindings/js/CachedScriptFetcher.h: Copied from Source/JavaScriptCore/runtime/SourceOrigin.h.
298         (WebCore::CachedScriptFetcher::CachedScriptFetcher):
299         * bindings/js/CachedScriptSourceProvider.h:
300         (WebCore::CachedScriptSourceProvider::create):
301         (WebCore::CachedScriptSourceProvider::CachedScriptSourceProvider):
302         (WebCore::makeSource): Deleted.
303         * bindings/js/ScriptController.cpp:
304         (WebCore::ScriptController::loadModuleScriptInWorld):
305         (WebCore::ScriptController::loadModuleScript):
306         * bindings/js/ScriptController.h:
307         * bindings/js/ScriptModuleLoader.cpp:
308         (WebCore::ScriptModuleLoader::fetch):
309         (WebCore::ScriptModuleLoader::notifyFinished):
310         * bindings/js/ScriptSourceCode.h:
311         (WebCore::ScriptSourceCode::ScriptSourceCode):
312         (WebCore::ScriptSourceCode::m_url):
313         * dom/InlineClassicScript.cpp: Added.
314         (WebCore::InlineClassicScript::create):
315         * dom/InlineClassicScript.h: Added.
316         * dom/LoadableClassicScript.cpp:
317         (WebCore::LoadableClassicScript::execute):
318         * dom/LoadableScript.cpp:
319         (WebCore::LoadableScript::requestScriptWithCache): Deleted.
320         * dom/LoadableScript.h:
321         (WebCore::LoadableScript::LoadableScript):
322         (): Deleted.
323         * dom/ScriptElement.cpp:
324         (WebCore::ScriptElement::prepareScript):
325         (WebCore::ScriptElement::requestModuleScript):
326         (WebCore::ScriptElement::executePendingScript):
327         * html/parser/HTMLScriptRunner.cpp:
328         (WebCore::HTMLScriptRunner::runScript):
329         * xml/parser/XMLDocumentParserLibxml2.cpp:
330         (WebCore::XMLDocumentParser::endElementNs):
331
332 2017-01-11  Eric Carlson  <eric.carlson@apple.com>
333
334         [MediaStream, Mac] Render media stream audio buffers
335         https://bugs.webkit.org/show_bug.cgi?id=159836
336         <rdar://problem/27380390>
337
338         Reviewed by Jer Noble.
339
340         No new tests, it isn't possible to test audio rendering directly. A follow-up patch will
341         add a mock audio source that will enable audio testing.
342
343         * platform/cf/CoreMediaSoftLink.cpp: Include new functions used.
344         * platform/cf/CoreMediaSoftLink.h:
345
346         * WebCore.xcodeproj/project.pbxproj: Remove references to the deleted previews.
347
348         * platform/Logging.h: Add MediaCaptureSamples.
349
350         * platform/MediaSample.h: Add outputPresentationTime and outputDuration.
351
352         * platform/cf/CoreMediaSoftLink.cpp: Add CMSampleBufferGetOutputDuration, CMSampleBufferGetOutputPresentationTimeStamp,
353         CMTimeConvertScale, CMTimebaseGetEffectiveRate, CMAudioSampleBufferCreateWithPacketDescriptions, 
354         CMSampleBufferSetDataBufferFromAudioBufferList, CMSampleBufferSetDataReady, 
355         CMAudioFormatDescriptionCreate, CMClockGetHostTimeClock, and CMClockGetTime.
356         * platform/cf/CoreMediaSoftLink.h:
357
358         Create and use an AVSampleBufferAudioRenderer each audio stream track, when it is available,
359         to render for audio samples. Store the offset between the first sample received from a track's
360         output presentation and the synchronizer time so we can adjust sample timestamps to be 
361         relative to the synchronizer's timeline regardless of their source. Remove the use of source
362         previews because not all sources will have them.
363
364         * platform/graphics/avfoundation/MediaSampleAVFObjC.h:
365         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h:
366         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
367         
368         Add an ObjC helper to catch renderer status changes.
369         (-[WebAVSampleBufferStatusChangeListener initWithParent:]): 
370         (-[WebAVSampleBufferStatusChangeListener dealloc]):
371         (-[WebAVSampleBufferStatusChangeListener invalidate]):
372         (-[WebAVSampleBufferStatusChangeListener beginObservingLayer:]):
373         (-[WebAVSampleBufferStatusChangeListener stopObservingLayer:]):
374         (-[WebAVSampleBufferStatusChangeListener beginObservingRenderer:]):
375         (-[WebAVSampleBufferStatusChangeListener stopObservingRenderer:]):
376         (-[WebAVSampleBufferStatusChangeListener observeValueForKeyPath:ofObject:change:context:]):
377         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::MediaPlayerPrivateMediaStreamAVFObjC):
378         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::~MediaPlayerPrivateMediaStreamAVFObjC):
379         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::removeOldSamplesFromPendingQueue):
380         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::addSampleToPendingQueue):
381         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updateSampleTimes):
382         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::enqueueAudioSample):
383         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::enqueueVideoSample):
384         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::requestNotificationWhenReadyForVideoData):
385         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::requestNotificationWhenReadyForAudioData):
386         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::createAudioRenderer):
387         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::destroyAudioRenderer):
388         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::destroyAudioRenderers):
389         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::audioSourceProvider):
390         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::rendererStatusDidChange):
391         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::layerStatusDidChange):
392         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::flushRenderers):
393         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::ensureLayer):
394         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::destroyLayer):
395         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::platformLayer):
396         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::currentDisplayMode):
397         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::play):
398         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::enqueueAudioSampleBufferFromTrack): Deleted.
399         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::requestNotificationWhenReadyForMediaData): Deleted.
400         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::enqueueVideoSampleBuffer): Deleted.
401         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::prepareVideoSampleBufferFromTrack): Deleted.
402         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::internalSetVolume): Deleted.
403
404         * platform/graphics/avfoundation/objc/MediaSampleAVFObjC.mm:
405         (WebCore::MediaSampleAVFObjC::outputPresentationTime): New.
406         (WebCore::MediaSampleAVFObjC::outputDuration): New.
407         (WebCore::MediaSampleAVFObjC::dump): Log outputPresentationTime.
408
409         * platform/mediastream/AudioTrackPrivateMediaStream.h: Add timelineOffset.
410
411         * platform/mediastream/MediaStreamTrackPrivate.cpp:
412         (WebCore::MediaStreamTrackPrivate::setEnabled): No more m_preview.
413         (WebCore::MediaStreamTrackPrivate::endTrack): Ditto.
414         (WebCore::MediaStreamTrackPrivate::preview): Deleted.
415         * platform/mediastream/MediaStreamTrackPrivate.h:
416
417         * platform/mediastream/RealtimeMediaSource.h:
418         (WebCore::RealtimeMediaSource::preview): Deleted.
419
420         * platform/mediastream/RealtimeMediaSourcePreview.h: Removed.
421
422         * platform/mediastream/VideoTrackPrivateMediaStream.h: Add timelineOffset.
423
424         * platform/mediastream/mac/AVAudioCaptureSource.h:
425         * platform/mediastream/mac/AVAudioCaptureSource.mm:
426         (WebCore::AVAudioCaptureSource::updateSettings):
427         (WebCore::AVAudioCaptureSource::captureOutputDidOutputSampleBufferFromConnection): Pass the
428         sample buffer up the chain.
429         (WebCore::AVAudioSourcePreview::create): Deleted.
430         (WebCore::AVAudioSourcePreview::AVAudioSourcePreview): Deleted.
431         (WebCore::AVAudioSourcePreview::invalidate): Deleted.
432         (WebCore::AVAudioSourcePreview::play): Deleted.
433         (WebCore::AVAudioSourcePreview::pause): Deleted.
434         (WebCore::AVAudioSourcePreview::setEnabled): Deleted.
435         (WebCore::AVAudioSourcePreview::setVolume): Deleted.
436         (WebCore::AVAudioSourcePreview::updateState): Deleted.
437         (WebCore::AVAudioCaptureSource::createPreview): Deleted.
438
439         * platform/mediastream/mac/AVMediaCaptureSource.h:
440         (WebCore::AVMediaSourcePreview): Deleted.
441         (WebCore::AVMediaCaptureSource::createWeakPtr): Deleted.
442
443         * platform/mediastream/mac/AVMediaCaptureSource.mm:
444         (WebCore::AVMediaCaptureSource::AVMediaCaptureSource): No more preview.
445         (WebCore::AVMediaCaptureSource::reset):
446         (WebCore::AVMediaCaptureSource::preview): Deleted.
447         (WebCore::AVMediaCaptureSource::removePreview): Deleted.
448         (WebCore::AVMediaSourcePreview::AVMediaSourcePreview): Deleted.
449         (WebCore::AVMediaSourcePreview::~AVMediaSourcePreview): Deleted.
450         (WebCore::AVMediaSourcePreview::invalidate): Deleted.
451
452         * platform/mediastream/mac/AVVideoCaptureSource.h:
453         * platform/mediastream/mac/AVVideoCaptureSource.mm:
454         (WebCore::AVVideoCaptureSource::processNewFrame): Don't set the "display immediately" attachment.
455         (WebCore::AVVideoSourcePreview::create): Deleted.
456         (WebCore::AVVideoSourcePreview::AVVideoSourcePreview): Deleted.
457         (WebCore::AVVideoSourcePreview::backgroundLayerBoundsChanged): Deleted.
458         (WebCore::AVVideoSourcePreview::invalidate): Deleted.
459         (WebCore::AVVideoSourcePreview::play): Deleted.
460         (WebCore::AVVideoSourcePreview::pause): Deleted.
461         (WebCore::AVVideoSourcePreview::setPaused): Deleted.
462         (WebCore::AVVideoSourcePreview::setEnabled): Deleted.
463         (WebCore::AVVideoCaptureSource::createPreview): Deleted.
464         (-[WebCoreAVVideoCaptureSourceObserver setParent:]): Deleted.
465         (-[WebCoreAVVideoCaptureSourceObserver observeValueForKeyPath:ofObject:change:context:]): Deleted.
466
467         * platform/mediastream/mac/MockRealtimeVideoSourceMac.mm:
468         (WebCore::MockRealtimeVideoSourceMac::CMSampleBufferFromPixelBuffer): Use a more typical video
469         time scale. Set the sample decode time.
470         (WebCore::MockRealtimeVideoSourceMac::pixelBufferFromCGImage): Use a static for colorspace
471         instead of fetching it for every frame.
472
473         * platform/mock/mediasource/MockSourceBufferPrivate.cpp: Add outputPresentationTime and outputDuration.
474
475 2017-01-11  Youenn Fablet  <youenn@apple.com>
476
477         Remove request.formData property until it gets implemented
478         https://bugs.webkit.org/show_bug.cgi?id=166920
479         <rdar://problem/29971105>
480
481         Reviewed by Chris Dumez.
482
483         Covered by rebased tests.
484
485         * Modules/fetch/FetchBody.idl:
486
487 2017-01-11  Ryan Haddad  <ryanhaddad@apple.com>
488
489         Reverting r210598, r210597, and r210591 to fix the iOS simulator build.
490         https://bugs.webkit.org/show_bug.cgi?id=166672
491
492         Unreviewed build fix.
493
494         * platform/graphics/cocoa/FontCacheCoreText.cpp:
495         (WebCore::preparePlatformFont):
496         (WebCore::fontIsSystemFont): Deleted.
497
498 2017-01-11  Andreas Kling  <akling@apple.com>
499
500         Crash when WebCore's GC heap grows way too large.
501         <https://webkit.org/b/166875>
502         <rdar://problem/27896585>
503
504         Reviewed by Mark Lam.
505
506         Cap the common WebCore VM at 4 GB of live JavaScript heap objects.
507
508         * bindings/js/CommonVM.cpp:
509         (WebCore::commonVMSlow):
510
511 2017-01-11  Nan Wang  <n_wang@apple.com>
512
513         AX: role=treeitem accessible name not spoken to VoiceOver macOS when using string contained inside element
514         https://bugs.webkit.org/show_bug.cgi?id=164950
515         <rdar://problem/29337573>
516
517         Reviewed by Chris Fleizach.
518
519         From the spec: https://www.w3.org/TR/wai-aria-practices/#TreeView
520         The element with role treeitem missing a label is labeled by its child elements.
521
522         Test: accessibility/mac/aria-tree-item-name.html
523
524         * accessibility/AccessibilityNodeObject.cpp:
525         (WebCore::AccessibilityNodeObject::alternativeText):
526
527 2017-01-11  Brent Fulgham  <bfulgham@apple.com>
528
529         [GTK] Unreviewed build fix after r210600.
530
531         * platform/glib/FileSystemGlib.cpp:
532         (WebCore::getFileDeviceId): Attempting to use proper API here.
533
534 2017-01-11  Brent Fulgham  <bfulgham@apple.com>
535
536         [GTK] Unreviewed build fix after r210599.
537
538         * platform/glib/FileSystemGlib.cpp:
539         (WebCore::getFileDeviceId): Revise for new signature.
540
541 2017-01-11  Myles C. Maxfield  <mmaxfield@apple.com>
542
543         ASSERTION FAILED: run->m_stop > 0 in *WebCore::RenderBlockFlow::computeInlineDirectionPositionsForSegment
544         https://bugs.webkit.org/show_bug.cgi?id=166030
545
546         Reviewed by Ryosuke Niwa.
547
548         Ordinarily, we don't process empty BiDi runs (because we filter them out).
549         However, when using isolates, we invoke extra machinery to create a
550         placeholder BiDi run, and replace it with the runs for the isolate. The
551         isolate's runs, though, can be empty, and rather than just deleting the
552         placeholder run, we will keep it around so that the m_logicallyLastRun is
553         still valid. This means that it is possible when all is said and done to
554         have empty runs, and computeInlineDirectionPositionsForSegment() needs to
555         not ASSERT() in this case.
556
557         Test: fast/text/bidi-isolate-empty-run.html
558
559         * rendering/RenderBlockLineLayout.cpp:
560         (WebCore::RenderBlockFlow::computeInlineDirectionPositionsForSegment):
561
562 2017-01-11  Brent Fulgham  <bfulgham@apple.com>
563
564         File scheme should not allow access of a resource on a different volume.
565         https://bugs.webkit.org/show_bug.cgi?id=158552
566         <rdar://problem/15307582>
567
568         Reviewed by Alex Christensen.
569
570         Revise SecurityOrigin to prevent files from one storage device (volume) from accessing content
571         on a different storage device (volume) unless universal access is enabled.
572
573         Pass the current file device as part of the NSURLRequest so that CFNetwork can reject loads
574         where the device changes in the midst of a load.
575
576         Also properly reflect that SecurityOrigin is never null by passing as a reference,
577         rather than as a pointer.
578
579         Tests: Tools/TestWebKitAPI/Tests/mac/CrossPartitionFileSchemeAccess.mm
580
581         * page/SecurityOrigin.cpp:
582         (WebCore::SecurityOrigin::canAccess): Pass argument as reference.
583         (WebCore::SecurityOrigin::canDisplay): Add check that files share the same volume.
584         (WebCore::SecurityOrigin::isSameSchemeHostPort): Pass argument as reference.
585         * page/SecurityOrigin.h:
586         * platform/FileSystem.cpp:
587         (WebCore::filesHaveSameVolume): Added.
588         * platform/FileSystem.h:
589         * platform/network/cocoa/ResourceRequestCocoa.mm:
590         (WebCore::ResourceRequest::doUpdatePlatformRequest): If loading a file URL, tell CFNetwork
591         the storage device at the time of the start of the load so we can trigger a failure if this
592         changes during the load operation.
593         * platform/posix/FileSystemPOSIX.cpp:
594         (WebCore::getFileDeviceId): Added.
595         * platform/win/FileSystemWin.cpp:
596         (WebCore::getFileDeviceId): Added.
597
598 2017-01-11  Myles C. Maxfield  <mmaxfield@apple.com>
599
600         [Cocoa] Testing fix after r210597
601         https://bugs.webkit.org/show_bug.cgi?id=166672
602
603         Unreviewed.
604
605         * platform/graphics/cocoa/FontCacheCoreText.cpp:
606         (WebCore::preparePlatformFont):
607
608 2017-01-11  Myles C. Maxfield  <mmaxfield@apple.com>
609
610         [Cocoa] Testing fix after r210591
611         https://bugs.webkit.org/show_bug.cgi?id=166672
612
613         Unreviewed.
614
615         Fixes fast/text/trak-optimizeLegibility.html and
616         fast/text/system-font-features.html
617
618         * platform/graphics/cocoa/FontCacheCoreText.cpp:
619         (WebCore::fontIsSystemFont):
620         (WebCore::preparePlatformFont):
621
622 2017-01-11  Chris Dumez  <cdumez@apple.com>
623
624         Iterating over URLSearchParams does not work
625         https://bugs.webkit.org/show_bug.cgi?id=166921
626         <rdar://problem/29970907>
627
628         Reviewed by Alex Christensen.
629
630         Make URLSearchParams iterable, as per:
631         - https://url.spec.whatwg.org/#urlsearchparams
632
633         Test: fast/dom/DOMURL/searchparams-iterable.html
634
635         * html/URLSearchParams.cpp:
636         (WebCore::URLSearchParams::Iterator::next):
637         (WebCore::URLSearchParams::Iterator::Iterator):
638         * html/URLSearchParams.h:
639         (WebCore::URLSearchParams::createIterator):
640         * html/URLSearchParams.idl:
641
642 2017-01-11  Myles C. Maxfield  <mmaxfield@apple.com>
643
644         [Cocoa] Variation fonts without variations specified are not rendered as if the default variations were specified
645         https://bugs.webkit.org/show_bug.cgi?id=166672
646         <rdar://problem/29779119>
647         <rdar://problem/29848883>
648
649         Reviewed by Simon Fraser.
650
651         CoreText has a bug (<rdar://problem/29859207>) where variation fonts without
652         a specified variation value are rendered as if the minimum value is specified,
653         rather than the default value. The solution is to apply default values where
654         they are omitted.
655
656         Test: fast/text/variations/advances.html
657
658         * platform/graphics/cocoa/FontCacheCoreText.cpp:
659         (WebCore::preparePlatformFont):
660
661 2017-01-11  Ryan Haddad  <ryanhaddad@apple.com>
662
663         Attempt to fix the Windows build after r210588.
664
665         Unreviewed build fix.
666
667         * bindings/js/JSBindingsAllInOne.cpp:
668
669 2017-01-11  Sam Weinig  <sam@webkit.org>
670
671         Address some feedback from r210567.
672
673         * bindings/scripts/CodeGeneratorJS.pm:
674         (NativeToJSValueDOMConvertNeedsState):
675         (NativeToJSValueDOMConvertNeedsGlobalObject):
676         Fix typo. robost -> robust.
677
678 2017-01-10  Sam Weinig  <sam@webkit.org>
679
680         Rename JSCustomSQLStatementErrorCallback.cpp to JSSQLStatementErrorCallbackCustom.cpp
681         https://bugs.webkit.org/show_bug.cgi?id=166913
682
683         Reviewed by Alex Christensen.
684
685         * CMakeLists.txt:
686         * WebCore.xcodeproj/project.pbxproj:
687         * bindings/js/JSCustomSQLStatementErrorCallback.cpp: Removed.
688         * bindings/js/JSSQLStatementErrorCallbackCustom.cpp: Copied from Source/WebCore/bindings/js/JSCustomSQLStatementErrorCallback.cpp.
689         Rename to match conventions.
690
691 2017-01-11  Ryan Haddad  <ryanhaddad@apple.com>
692
693         Unreviewed, rolling out r210571.
694
695         This change broke the 32-bit macOS build and caused LayoutTest
696         failures.
697
698         Reverted changeset:
699
700         "File scheme should not allow access of a resource on a
701         different volume."
702         https://bugs.webkit.org/show_bug.cgi?id=158552
703         http://trac.webkit.org/changeset/210571
704
705 2017-01-11  Yusuke Suzuki  <utatane.tea@gmail.com>
706
707         Decouple module loading initiator from ScriptElement
708         https://bugs.webkit.org/show_bug.cgi?id=166888
709
710         Reviewed by Saam Barati and Ryosuke Niwa.
711
712         Previously, we use ScriptElement (JSElement for ScriptElement) as the module loading initiator.
713         This element is used to transfer the metadata like charset throughout the module pipeline.
714         As a result, our module loader in the browser side is tightly coupled with ScriptElement.
715         It is not good since it prevent us from using the module loader in the non-DOM environment like
716         Web Workers.
717
718         So we decouple the necessary informations from ScriptElement. We move these information to
719         LoadableScript. And we use JSScriptFetcher to transfer LoadableScript through the JS implemented
720         module loader pipeline. We select LoadableScript instead of LoadableModuleScript since this initiator
721         information will be leveraged even in classic scripts once we implement the dynamic import.
722
723         No behavior change.
724
725         * ForwardingHeaders/runtime/JSScriptFetcher.h: Copied from Source/WebCore/dom/LoadableScript.cpp.
726         * ForwardingHeaders/runtime/ScriptFetcher.h: Copied from Source/WebCore/dom/LoadableScript.cpp.
727         * bindings/js/CachedModuleScript.cpp:
728         (WebCore::CachedModuleScript::create):
729         (WebCore::CachedModuleScript::load):
730         (WebCore::CachedModuleScript::CachedModuleScript): Deleted.
731         * bindings/js/CachedModuleScript.h:
732         Now we can merge CachedModuleScript to LoadableScript. But we do not do this in this patch since
733         we focus on decoupling the initiator information from ScriptElement.
734
735         (WebCore::CachedModuleScript::nonce): Deleted.
736         (WebCore::CachedModuleScript::crossOriginMode): Deleted.
737         * bindings/js/CachedModuleScriptLoader.cpp:
738         (WebCore::CachedModuleScriptLoader::load):
739         * bindings/js/CachedModuleScriptLoader.h:
740         * bindings/js/JSDOMWindowBase.cpp:
741         (WebCore::JSDOMWindowBase::moduleLoaderResolve):
742         (WebCore::JSDOMWindowBase::moduleLoaderFetch):
743         (WebCore::JSDOMWindowBase::moduleLoaderEvaluate):
744         * bindings/js/JSMainThreadExecState.h:
745         (WebCore::JSMainThreadExecState::loadModule):
746         (WebCore::JSMainThreadExecState::linkAndEvaluateModule):
747         * bindings/js/ScriptController.cpp:
748         (WebCore::ScriptController::loadModuleScriptInWorld):
749         (WebCore::ScriptController::loadModuleScript):
750         (WebCore::ScriptController::linkAndEvaluateModuleScriptInWorld):
751         (WebCore::ScriptController::linkAndEvaluateModuleScript):
752         * bindings/js/ScriptController.h:
753         * bindings/js/ScriptModuleLoader.cpp:
754         (WebCore::ScriptModuleLoader::fetch):
755         * bindings/js/ScriptModuleLoader.h:
756         * dom/LoadableClassicScript.cpp:
757         (WebCore::LoadableClassicScript::create):
758         (WebCore::LoadableClassicScript::~LoadableClassicScript):
759         (WebCore::LoadableClassicScript::isLoaded):
760         (WebCore::LoadableClassicScript::error):
761         (WebCore::LoadableClassicScript::wasCanceled):
762         (WebCore::LoadableClassicScript::notifyFinished):
763         (WebCore::LoadableClassicScript::load):
764         * dom/LoadableClassicScript.h:
765         * dom/LoadableModuleScript.cpp:
766         (WebCore::LoadableModuleScript::create):
767         (WebCore::LoadableModuleScript::LoadableModuleScript):
768         (WebCore::LoadableModuleScript::load):
769         * dom/LoadableModuleScript.h:
770         * dom/LoadableScript.cpp:
771         (WebCore::LoadableScript::requestScriptWithCache):
772         * dom/LoadableScript.h:
773         (WebCore::LoadableScript::LoadableScript):
774         * dom/ScriptElement.cpp:
775         (WebCore::ScriptElement::requestClassicScript):
776         (WebCore::ScriptElement::requestModuleScript):
777         (WebCore::ScriptElement::executeModuleScript):
778         (WebCore::ScriptElement::requestScriptWithCacheForModuleScript): Deleted.
779         (WebCore::ScriptElement::requestScriptWithCache): Deleted.
780         * dom/ScriptElement.h:
781
782 2017-01-11  Carlos Garcia Campos  <cgarcia@igalia.com>
783
784         [GStreamer] Use smart pointers and modernize code in WebKitWebAudioSourceGStreamer
785         https://bugs.webkit.org/show_bug.cgi?id=166886
786
787         Reviewed by Xabier Rodriguez-Calvar.
788
789         This patch doesn't change the behavior, so it's covered by existing Web Audio tests. It replaces pointers with
790         smart pointers, uses WTF::Vector instead of GSList and simplifies the code to map/unmap GstBuffers.
791
792         * platform/audio/gstreamer/WebKitWebAudioSourceGStreamer.cpp:
793         (webKitWebAudioSrcConstructed):
794         (webKitWebAudioSrcFinalize):
795         (webKitWebAudioSrcLoop):
796         (webKitWebAudioSrcChangeState):
797         * platform/graphics/gstreamer/GRefPtrGStreamer.cpp:
798         (WTF::derefGPtr<GstBufferList>):
799         (WTF::adoptGRef):
800         (WTF::refGPtr<GstBufferPool>):
801         (WTF::derefGPtr<GstBufferPool>):
802         * platform/graphics/gstreamer/GRefPtrGStreamer.h:
803         * platform/graphics/gstreamer/GStreamerUtilities.cpp:
804         (WebCore::mapGstBuffer):
805         * platform/graphics/gstreamer/GStreamerUtilities.h:
806         * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
807         (StreamingClient::createReadBuffer):
808
809 2017-01-11  Commit Queue  <commit-queue@webkit.org>
810
811         Unreviewed, rolling out r182947.
812         https://bugs.webkit.org/show_bug.cgi?id=166922
813
814         Caused huge memory leak see https://webkit.org/b/166884
815         (Requested by KaL on #webkit).
816
817         Reverted changeset:
818
819         "[GStreamer] Silent WebAudio buffers support"
820         https://bugs.webkit.org/show_bug.cgi?id=143869
821         http://trac.webkit.org/changeset/182947
822
823 2017-01-11  Carlos Garcia Campos  <cgarcia@igalia.com>
824
825         Unreviewed, rolling out r210579.
826
827         That was not the right fix
828
829         Reverted changeset:
830
831         "Unreviewed GTK buildfix after r210571."
832         http://trac.webkit.org/changeset/210579
833
834 2017-01-11  Carlos Garcia Campos  <cgarcia@igalia.com>
835
836         Unreviewed. Fix GTK+ build after r210571.
837
838         Add getFileDeviceId implementation to FileSystemGlib.cpp.
839
840         * platform/glib/FileSystemGlib.cpp:
841         (WebCore::getFileDeviceId):
842
843 2017-01-11  Csaba Osztrogonác  <ossy@webkit.org>
844
845         Unreviewed GTK buildfix after r210571.
846
847         * PlatformGTK.cmake:
848
849 2017-01-10  Yusuke Suzuki  <utatane.tea@gmail.com>
850
851         Implement JSSourceCode to propagate SourceCode in module pipeline
852         https://bugs.webkit.org/show_bug.cgi?id=166861
853
854         Reviewed by Saam Barati.
855
856         Now SourceOrigin is correctly propagated through the module pipeline.
857         So the error reported by http/tests/security/contentSecurityPolicy/module-eval-blocked-expected.html
858         is updated.
859
860         * ForwardingHeaders/runtime/JSSourceCode.h: Added.
861         * bindings/js/JSDOMPromise.h:
862         (WebCore::DeferredPromise::resolveWithCallback):
863         * bindings/js/ScriptModuleLoader.cpp:
864         (WebCore::ScriptModuleLoader::notifyFinished):
865
866 2017-01-10  Brent Fulgham  <bfulgham@apple.com>
867
868         File scheme should not allow access of a resource on a different volume.
869         https://bugs.webkit.org/show_bug.cgi?id=158552
870         <rdar://problem/15307582>
871
872         Reviewed by Alex Christensen.
873
874         Revise SecurityOrigin to prevent files from one storage device (volume) from accessing content
875         on a different storage device (volume) unless universal access is enabled.
876
877         Pass the current file device as part of the NSURLRequest so that CFNetwork can reject loads
878         where the device changes in the midst of a load.
879
880         Also properly reflect that SecurityOrigin is never null by passing as a reference,
881         rather than as a pointer.
882
883         Tests: Tools/TestWebKitAPI/Tests/mac/CrossPartitionFileSchemeAccess.mm
884
885         * page/SecurityOrigin.cpp:
886         (WebCore::SecurityOrigin::canAccess): Pass argument as reference.
887         (WebCore::SecurityOrigin::passesFileCheck): Add check that file URLs refer to files in
888         the same storage volume.
889         (WebCore::SecurityOrigin::canDisplay): Add check that files share the same volume.
890         (WebCore::SecurityOrigin::isSameSchemeHostPort): Pass argument as reference.
891         * page/SecurityOrigin.h:
892         * platform/FileSystem.cpp:
893         (WebCore::filesHaveSameVolume): Added.
894         * platform/FileSystem.h:
895         * platform/network/cocoa/ResourceRequestCocoa.mm:
896         (WebCore::ResourceRequest::doUpdatePlatformRequest): If loading a file URL, tell CFNetwork
897         the storage device at the time of the start of the load so we can trigger a failure if this
898         changes during the load operation.
899         * platform/posix/FileSystemPOSIX.cpp:
900         (WebCore::getFileDeviceId): Added.
901         * platform/win/FileSystemWin.cpp:
902         (WebCore::getFileDeviceId): Added.
903
904 2017-01-10  Sam Weinig  <sam@webkit.org>
905
906         [WebIDL] Remove most of the custom bindings for the WebGL code
907         https://bugs.webkit.org/show_bug.cgi?id=166834
908
909         Reviewed by Alex Christensen.
910
911         Removes all but one custom getter (getExtension) from the WebGL code.
912
913         * Modules/indexeddb/IDBKeyRange.idl:
914         Replace use of non-standard type, with new OverrideIDLType extended attribute, allowing us
915         to stay more consistent with the IDL files spec's provide.
916
917         * WebCore.xcodeproj/project.pbxproj:
918         Move JSWebGL2RenderingContextCustom to the GC/Wrapping only group.
919
920         * bindings/IDLTypes.h:
921         Add IDLWebGLAny, and simplify IDLIDBKey to not be templatized.
922
923         * bindings/js/JSDOMConvert.h:
924         (WebCore::Converter<IDLLong>::convert):
925         (WebCore::Converter<IDLFloat>::convert):
926         (WebCore::Converter<IDLUnrestrictedFloat>::convert):
927         (WebCore::Converter<IDLDouble>::convert):
928         (WebCore::Converter<IDLUnrestrictedDouble>::convert):
929         Add overloads of convert that convert a double to the numeric type.
930
931         (WebCore::Detail::GenericSequenceConverter::convert):
932         Add optimized specialization for JSArrays that does not use the iterator protocol.
933
934         (WebCore::Detail::NumericSequenceConverter::convert):
935         Add an even more optimized specialization for numeric types, which checks to see
936         if the array's butterfly has an optimized shape, and extracts the numeric values
937         from that.
938
939         (WebCore::Detail::SequenceConverter::convert):
940         (WebCore::Detail::SequenceConverter<IDLLong>::convert):
941         (WebCore::Detail::SequenceConverter<IDLFloat>::convert):
942         (WebCore::Detail::SequenceConverter<IDLUnrestrictedFloat>::convert):
943         (WebCore::Detail::SequenceConverter<IDLDouble>::convert):
944         (WebCore::Detail::SequenceConverter<IDLUnrestrictedDouble>::convert):
945         Select the right specialization based on type.
946
947         (WebCore::Converter<IDLSequence<T>>::convert):
948         (WebCore::Converter<IDLFrozenArray<T>>::convert):
949         Rename converter to be more accurate.
950
951         (WebCore::JSConverter<IDLWebGLAny>::convert):
952         Added. Calls through to converter in WebGLAny.h. We should replace this with a
953         call to the IDLUnion JSConverter when feasible.
954
955         * bindings/js/JSWebGL2RenderingContextCustom.cpp:
956         (WebCore::JSWebGL2RenderingContext::getInternalformatParameter): Deleted.
957         (WebCore::JSWebGL2RenderingContext::getQueryParameter): Deleted.
958         (WebCore::JSWebGL2RenderingContext::getSamplerParameter): Deleted.
959         (WebCore::JSWebGL2RenderingContext::getSyncParameter): Deleted.
960         (WebCore::JSWebGL2RenderingContext::getIndexedParameter): Deleted.
961         (WebCore::JSWebGL2RenderingContext::getActiveUniformBlockParameter): Deleted.
962         (WebCore::JSWebGL2RenderingContext::getActiveUniformBlockName): Deleted.
963         Remove unnecessary custom functions.
964
965         * bindings/js/JSWebGLRenderingContextBaseCustom.cpp:
966         (WebCore::objectParameter): Deleted.
967         (WebCore::JSWebGLRenderingContextBase::getAttachedShaders): Deleted.
968         (WebCore::JSWebGLRenderingContextBase::getBufferParameter): Deleted.
969         (WebCore::JSWebGLRenderingContextBase::getFramebufferAttachmentParameter): Deleted.
970         (WebCore::JSWebGLRenderingContextBase::getParameter): Deleted.
971         (WebCore::JSWebGLRenderingContextBase::getProgramParameter): Deleted.
972         (WebCore::JSWebGLRenderingContextBase::getRenderbufferParameter): Deleted.
973         (WebCore::JSWebGLRenderingContextBase::getShaderParameter): Deleted.
974         (WebCore::JSWebGLRenderingContextBase::getSupportedExtensions): Deleted.
975         (WebCore::JSWebGLRenderingContextBase::getTexParameter): Deleted.
976         (WebCore::JSWebGLRenderingContextBase::getUniform): Deleted.
977         (WebCore::JSWebGLRenderingContextBase::getVertexAttrib): Deleted.
978         (WebCore::toNumberVector): Deleted.
979         (WebCore::functionForUniform): Deleted.
980         (WebCore::dataFunctionf): Deleted.
981         (WebCore::dataFunctioni): Deleted.
982         (WebCore::dataFunctionMatrix): Deleted.
983         (WebCore::JSWebGLRenderingContextBase::uniform1fv): Deleted.
984         (WebCore::JSWebGLRenderingContextBase::uniform1iv): Deleted.
985         (WebCore::JSWebGLRenderingContextBase::uniform2fv): Deleted.
986         (WebCore::JSWebGLRenderingContextBase::uniform2iv): Deleted.
987         (WebCore::JSWebGLRenderingContextBase::uniform3fv): Deleted.
988         (WebCore::JSWebGLRenderingContextBase::uniform3iv): Deleted.
989         (WebCore::JSWebGLRenderingContextBase::uniform4fv): Deleted.
990         (WebCore::JSWebGLRenderingContextBase::uniform4iv): Deleted.
991         (WebCore::JSWebGLRenderingContextBase::uniformMatrix2fv): Deleted.
992         (WebCore::JSWebGLRenderingContextBase::uniformMatrix3fv): Deleted.
993         (WebCore::JSWebGLRenderingContextBase::uniformMatrix4fv): Deleted.
994         (WebCore::JSWebGLRenderingContextBase::vertexAttrib1fv): Deleted.
995         (WebCore::JSWebGLRenderingContextBase::vertexAttrib2fv): Deleted.
996         (WebCore::JSWebGLRenderingContextBase::vertexAttrib3fv): Deleted.
997         (WebCore::JSWebGLRenderingContextBase::vertexAttrib4fv): Deleted.
998         Remove unnecessary custom functions.
999
1000         * bindings/scripts/CodeGenerator.pm:
1001         (IsBuiltinType):
1002         Remove specialization of IDBKey.
1003
1004         * bindings/scripts/CodeGeneratorJS.pm:
1005         (GetBaseIDLType):
1006         (GetIDLType):
1007         (NativeToJSValueDOMConvertNeedsState):
1008         (NativeToJSValueDOMConvertNeedsGlobalObject):
1009         (NativeToJSValue):
1010         Allow IDL files to override the type of signature using a new OverrideIDLType
1011         extended attribute. Currently this only works conversion to JS, but could be
1012         extended to support more.
1013
1014         * bindings/scripts/IDLAttributes.txt:
1015         Add OverrideIDLType.
1016
1017         * html/canvas/WebGL2RenderingContext.idl:
1018         Add OverrideIDLType=IDLWebGLAny annotations to remove the need for custom functions.
1019
1020         * html/canvas/WebGLAny.cpp:
1021         (WebCore::convertToJSValue):
1022         (WebCore::toJS): Deleted.
1023         * html/canvas/WebGLAny.h:
1024         Rename the toJS function to convertToJSValue to avoid a template specialization issue.
1025
1026         * html/canvas/WebGLRenderingContextBase.cpp:
1027         (WebCore::WebGLRenderingContextBase::getAttachedShaders):
1028         Update signature to match IDL, replacing bool return value plus out parameter with an
1029         optional return value. Modernize the code a bit.
1030
1031         (WebCore::WebGLRenderingContextBase::uniform2f):
1032         (WebCore::WebGLRenderingContextBase::uniform3f):
1033         (WebCore::WebGLRenderingContextBase::uniform4f):
1034         (WebCore::WebGLRenderingContextBase::uniform1i):
1035         (WebCore::WebGLRenderingContextBase::uniform3i):
1036         (WebCore::WebGLRenderingContextBase::uniform4i):
1037         (WebCore::WebGLRenderingContextBase::uniform1fv):
1038         (WebCore::WebGLRenderingContextBase::uniform2fv):
1039         (WebCore::WebGLRenderingContextBase::uniform3fv):
1040         (WebCore::WebGLRenderingContextBase::uniform4fv):
1041         (WebCore::WebGLRenderingContextBase::uniform1iv):
1042         (WebCore::WebGLRenderingContextBase::uniform2iv):
1043         (WebCore::WebGLRenderingContextBase::uniform3iv):
1044         (WebCore::WebGLRenderingContextBase::uniform4iv):
1045         (WebCore::WebGLRenderingContextBase::uniformMatrix2fv):
1046         (WebCore::WebGLRenderingContextBase::uniformMatrix3fv):
1047         (WebCore::WebGLRenderingContextBase::uniformMatrix4fv):
1048         (WebCore::WebGLRenderingContextBase::vertexAttrib4f):
1049         (WebCore::WebGLRenderingContextBase::vertexAttrib1fv):
1050         (WebCore::WebGLRenderingContextBase::vertexAttrib2fv):
1051         (WebCore::WebGLRenderingContextBase::vertexAttrib3fv):
1052         (WebCore::WebGLRenderingContextBase::vertexAttrib4fv):
1053         (WebCore::WebGLRenderingContextBase::validateUniformParameters):
1054         (WebCore::WebGLRenderingContextBase::validateUniformMatrixParameters):
1055         (WebCore::WebGLRenderingContextBase::vertexAttribfvImpl):
1056         * html/canvas/WebGLRenderingContextBase.h:
1057         (WebCore::WebGLRenderingContextBase::TypedList::TypedList):
1058         (WebCore::WebGLRenderingContextBase::TypedList::data):
1059         (WebCore::WebGLRenderingContextBase::TypedList::length):
1060         Re-order/group to match order in the IDL file. Remove overloads taking a pointer and 
1061         length, and replace it by having the main function take a specialized TypedList. TypedList
1062         allows the bindings to pass the correct Variant type, but then the code to only think in
1063         terms of the data() and length() functions.
1064
1065         * html/canvas/WebGLRenderingContextBase.idl:
1066         Remove [Custom] annotations and re-order/group to match the spec. Update types of uniform*fv/iv
1067         functions to take typedef'd unions.
1068
1069 2017-01-10  Ryosuke Niwa  <rniwa@webkit.org>
1070
1071         :active and :hover states may not be updated across slots
1072         https://bugs.webkit.org/show_bug.cgi?id=166881
1073         <rdar://problem/29944582>
1074
1075         Reviewed by Antti Koivisto.
1076
1077         The bug was caused by updateHoverActiveState not updating :hover and :active states on elements
1078         when nodes are assigned to slots because they were walking up the tree using parentOrShadowHostElement
1079         and parentNode. Fixed the bug by using parentElementInComposedTree instead since :hover and :active
1080         states need to be updated in accordance with the render tree, which is created from the "flat tree"
1081         or the "composed tree" in WebKit's terminology (this is old terminology in the spec).
1082
1083         Tests: fast/shadow-dom/clear-active-state-in-shadow.html
1084                fast/shadow-dom/hover-over-nested-slotted-content.html
1085
1086         * dom/Document.cpp:
1087         (WebCore::Document::updateHoverActiveState): Fixed the bug.
1088         * dom/Node.cpp:
1089         (WebCore::Node::parentElementInComposedTree): Added.
1090         * dom/Node.h:
1091
1092 2017-01-10  Keith Rollin  <krollin@apple.com>
1093
1094         Missing logging in IconLoader::startLoading
1095         https://bugs.webkit.org/show_bug.cgi?id=166904
1096
1097         Reviewed by Sam Weinig.
1098
1099         The LOG_ERROR in startLoading references 'resourceRequest', which has
1100         been WTF::Moved as part of a preceding function call. As such, the
1101         logging statement doesn't print out a possibly useful URL. Fix this by
1102         making a copy of the URL before it's affected by the Move.
1103
1104         No new tests -- change only affects logging code.
1105
1106         * loader/icon/IconLoader.cpp:
1107         (WebCore::IconLoader::startLoading):
1108
1109 2017-01-10  Wenson Hsieh  <wenson_hsieh@apple.com>
1110
1111         Implement "proximity" scroll snapping
1112         https://bugs.webkit.org/show_bug.cgi?id=135994
1113         <rdar://problem/18162418>
1114
1115         Reviewed by Dean Jackson.
1116
1117         Adds support for proximity scroll snapping. To do this, we introduce scroll offset ranges, a list of scroll
1118         offset ranges that are plumbed alongside the list of scroll snap offsets. Similar to a snap offset, a snap
1119         offset range contains scroll offsets on which scrolling is allowed to come to a rest within a scroll snapping
1120         container. However, unlike normal snap offsets, scrolling may only come to rest within a snap offset range if
1121         the predicted scroll offset already lies within the range. The new algorithm for selecting a target scroll snap
1122         position given a destination offset is now:
1123
1124         -   If the scroll destination lies within a snap offset range, return the scroll destination
1125         -   Otherwise, compute the nearest lower/upper snap offsets and lower/upper snap offset ranges
1126         -   If scrolling ended with no velocity, return the nearest snap offset
1127         -   If scrolling ended with positive velocity, choose the upper snap offset only if there is no snap offset
1128             range in between the scroll destination and the snap offset; else, choose the lower snap offset
1129         -   If scrolling ended with negative velocity, choose the lower snap offset only if there is no snap offset
1130             range in between the scroll destination and the snap offset; else, choose the upper snap offset
1131
1132         The extra rule accounting for scroll offset ranges in between the scroll destination and a potential snap offset
1133         handles the corner case where the user scrolls with momentum very lightly away from a snap offset, such that the
1134         predicted scroll destination is still within proximity of the snap offset. In this case, the regular (mandatory
1135         scroll snapping) behavior would be to snap to the next offset in the direction of momentum scrolling, but
1136         instead, it is more intuitive to return to the original snap position.
1137
1138         We also move scrolling prediction logic into ScrollingMomentumCalculator and adopt the platform
1139         _NSScrollingMomentumCalculator's destinationOrigin property when computing the predicted scroll destination.
1140         Previously, we were simply multiplying by an empirically-derived constant to approximate the scroll destination,
1141         but now that we are supporting proximity scroll snapping, we need more exact scroll destinaton prediction in
1142         order to make sure that scrolling to a snap offset range feels natural.
1143
1144         Tests: tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-then-proximity.html
1145                tiled-drawing/scrolling/scroll-snap/scroll-snap-proximity-mainframe.html
1146                tiled-drawing/scrolling/scroll-snap/scroll-snap-proximity-overflow.html
1147
1148         * WebCore.xcodeproj/project.pbxproj:
1149         * page/scrolling/AsyncScrollingCoordinator.cpp:
1150         (WebCore::setStateScrollingNodeSnapOffsetsAsFloat):
1151         (WebCore::AsyncScrollingCoordinator::updateOverflowScrollingNode):
1152         (WebCore::AsyncScrollingCoordinator::updateScrollSnapPropertiesWithFrameView):
1153
1154         Make boilerplate changes to plumb lists of horizontal and vertical snap offset ranges alongside the lists of
1155         horizontal and vertical snap offsets.
1156
1157         * page/scrolling/AxisScrollSnapOffsets.cpp:
1158         (WebCore::snapOffsetRangesToString):
1159         (WebCore::indicesOfNearestSnapOffsetRanges):
1160         (WebCore::indicesOfNearestSnapOffsets):
1161         (WebCore::adjustAxisSnapOffsetsForScrollExtent):
1162         (WebCore::computeAxisProximitySnapOffsetRanges):
1163         (WebCore::updateSnapOffsetsForScrollableArea):
1164         (WebCore::closestSnapOffset):
1165
1166         Adjust the snap offset selection algorithm to take snap offset ranges into account. See above for more details.
1167         Additionally, augment snap offset update logic to emit snap offset ranges for proximity scroll snapping. To do
1168         this, we run the following steps on the final list of processed snap offsets:
1169         -   Compute the proximity distance, which (for now) is arbitrarily 0.3 * the length or width of the scroll snap
1170             port, depending on whether scroll snapping is taking place in the X or Y axis.
1171         -   For each pair of adjacent snap offsets, if they are more than 2 * proximity distance away from each other,
1172             emit a snap offset range starting from (lower snap offset + proximity distance) and ending on (upper snap
1173             offset + proximity distance).
1174
1175         * page/scrolling/AxisScrollSnapOffsets.h:
1176         (WebCore::closestSnapOffset): Deleted.
1177         * page/scrolling/ScrollSnapOffsetsInfo.h:
1178
1179         Introduce ScrollSnapOffsetsInfo, a struct which contains data relevant to scroll snapping. This includes
1180         vertical and horizontal snap offsets, as well as vertical and horizontal snap offset ranges. Snap offset ranges
1181         consist of a vector of ranges of scroll offsets.
1182
1183         * page/scrolling/ScrollingCoordinator.h:
1184         * page/scrolling/ScrollingMomentumCalculator.cpp:
1185         (WebCore::projectedInertialScrollDistance):
1186         (WebCore::ScrollingMomentumCalculator::ScrollingMomentumCalculator):
1187         (WebCore::ScrollingMomentumCalculator::setRetargetedScrollOffset):
1188         (WebCore::ScrollingMomentumCalculator::predictedDestinationOffset):
1189         (WebCore::ScrollingMomentumCalculator::create):
1190         (WebCore::ScrollingMomentumCalculator::setPlatformMomentumScrollingPredictionEnabled):
1191         (WebCore::BasicScrollingMomentumCalculator::BasicScrollingMomentumCalculator):
1192         (WebCore::BasicScrollingMomentumCalculator::linearlyInterpolatedOffsetAtProgress):
1193         (WebCore::BasicScrollingMomentumCalculator::initializeInterpolationCoefficientsIfNecessary):
1194         (WebCore::BasicScrollingMomentumCalculator::initializeSnapProgressCurve):
1195         * page/scrolling/ScrollingMomentumCalculator.h:
1196         (WebCore::ScrollingMomentumCalculator::retargetedScrollOffset):
1197         (WebCore::ScrollingMomentumCalculator::retargetedScrollOffsetDidChange):
1198
1199         Currently, the ScrollingMomentumCalculator is responsible for taking an initial position, initial velocity, and
1200         target position and animating the scroll offset from the initial to target position. Now, we refactor the
1201         ScrollingMomentumCalculator interface to no longer take a target offset upon initialization, and instead compute
1202         the predicted scroll destination given initial position and velocity; clients of the ScrollingMomentumCalculator
1203         then use this predicted scroll destination to compute a retargeted scroll offset and then call
1204         setRetargetedScrollOffset on the calculator, which sets up an animation curve to the new retargeted offset. This
1205         allows both the AppKit-based scrolling momentum calculator and platform-invariant momentum calculator to be used
1206         interchangeably, while still allowing them to compute a destination offset from initial parameters of the
1207         scroll.
1208
1209         * page/scrolling/ScrollingStateScrollingNode.cpp:
1210         (WebCore::ScrollingStateScrollingNode::ScrollingStateScrollingNode):
1211         (WebCore::ScrollingStateScrollingNode::setHorizontalSnapOffsets):
1212         (WebCore::ScrollingStateScrollingNode::setVerticalSnapOffsets):
1213         (WebCore::ScrollingStateScrollingNode::setHorizontalSnapOffsetRanges):
1214         (WebCore::ScrollingStateScrollingNode::setVerticalSnapOffsetRanges):
1215         * page/scrolling/ScrollingStateScrollingNode.h:
1216         (WebCore::ScrollingStateScrollingNode::horizontalSnapOffsets):
1217         (WebCore::ScrollingStateScrollingNode::verticalSnapOffsets):
1218         (WebCore::ScrollingStateScrollingNode::horizontalSnapOffsetRanges):
1219         (WebCore::ScrollingStateScrollingNode::verticalSnapOffsetRanges):
1220         * page/scrolling/ScrollingTreeScrollingNode.cpp:
1221         (WebCore::ScrollingTreeScrollingNode::commitStateBeforeChildren):
1222         (WebCore::ScrollingTreeScrollingNode::dumpProperties):
1223         * page/scrolling/ScrollingTreeScrollingNode.h:
1224         (WebCore::ScrollingTreeScrollingNode::horizontalSnapOffsets):
1225         (WebCore::ScrollingTreeScrollingNode::verticalSnapOffsets):
1226         (WebCore::ScrollingTreeScrollingNode::horizontalSnapOffsetRanges):
1227         (WebCore::ScrollingTreeScrollingNode::verticalSnapOffsetRanges):
1228
1229         Add more boilerplate support for snap offset ranges.
1230
1231         * page/scrolling/mac/ScrollingMomentumCalculatorMac.h:
1232         * page/scrolling/mac/ScrollingMomentumCalculatorMac.mm:
1233         (WebCore::ScrollingMomentumCalculator::create):
1234         (WebCore::ScrollingMomentumCalculator::setPlatformMomentumScrollingPredictionEnabled):
1235         (WebCore::ScrollingMomentumCalculatorMac::ScrollingMomentumCalculatorMac):
1236         (WebCore::ScrollingMomentumCalculatorMac::scrollOffsetAfterElapsedTime):
1237         (WebCore::ScrollingMomentumCalculatorMac::predictedDestinationOffset):
1238         (WebCore::ScrollingMomentumCalculatorMac::retargetedScrollOffsetDidChange):
1239         (WebCore::ScrollingMomentumCalculatorMac::animationDuration):
1240         (WebCore::ScrollingMomentumCalculatorMac::requiresMomentumScrolling):
1241         (WebCore::ScrollingMomentumCalculatorMac::ensurePlatformMomentumCalculator):
1242
1243         Hook into AppKit momentum scroll offset prediction.
1244
1245         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
1246         (WebCore::convertToLayoutUnits):
1247         (WebCore::ScrollingTreeFrameScrollingNodeMac::commitStateBeforeChildren):
1248         * platform/ScrollableArea.cpp:
1249         (WebCore::ScrollableArea::ensureSnapOffsetsInfo):
1250         (WebCore::ScrollableArea::horizontalSnapOffsets):
1251         (WebCore::ScrollableArea::horizontalSnapOffsetRanges):
1252         (WebCore::ScrollableArea::verticalSnapOffsetRanges):
1253         (WebCore::ScrollableArea::verticalSnapOffsets):
1254         (WebCore::ScrollableArea::setHorizontalSnapOffsets):
1255         (WebCore::ScrollableArea::setVerticalSnapOffsets):
1256         (WebCore::ScrollableArea::setHorizontalSnapOffsetRanges):
1257         (WebCore::ScrollableArea::setVerticalSnapOffsetRanges):
1258         (WebCore::ScrollableArea::clearHorizontalSnapOffsets):
1259         (WebCore::ScrollableArea::clearVerticalSnapOffsets):
1260         * platform/ScrollableArea.h:
1261         (WebCore::ScrollableArea::horizontalSnapOffsets): Deleted.
1262         (WebCore::ScrollableArea::verticalSnapOffsets): Deleted.
1263         * platform/cocoa/ScrollController.h:
1264         * platform/cocoa/ScrollController.mm:
1265         (WebCore::ScrollController::processWheelEventForScrollSnap):
1266
1267         Fix an issue where initial scrolling velocity would be set to zero at the end of a drag gesture.
1268
1269         (WebCore::ScrollController::updateScrollSnapState):
1270         (WebCore::ScrollController::updateScrollSnapPoints):
1271         (WebCore::ScrollController::setNearestScrollSnapIndexForAxisAndOffset):
1272         * platform/cocoa/ScrollSnapAnimatorState.h:
1273         (WebCore::ScrollSnapAnimatorState::snapOffsetsForAxis):
1274         (WebCore::ScrollSnapAnimatorState::snapOffsetRangesForAxis):
1275         (WebCore::ScrollSnapAnimatorState::setSnapOffsetsAndPositionRangesForAxis):
1276         (WebCore::ScrollSnapAnimatorState::setSnapOffsetsForAxis): Deleted.
1277         * platform/cocoa/ScrollSnapAnimatorState.mm:
1278         (WebCore::ScrollSnapAnimatorState::setupAnimationForState):
1279         (WebCore::ScrollSnapAnimatorState::targetOffsetForStartOffset):
1280         (WebCore::projectedInertialScrollDistance): Deleted.
1281         * rendering/RenderLayerCompositor.cpp:
1282         (WebCore::RenderLayerCompositor::updateScrollCoordinatedLayer):
1283         * testing/Internals.cpp:
1284         (WebCore::Internals::setPlatformMomentumScrollingPredictionEnabled):
1285
1286         Add a new hook for layout tests to force scrolling momentum calculators to use the platform-invariant momentum
1287         scrolling prediction heuristic instead of the platform-dependent one.
1288
1289         (WebCore::Internals::scrollSnapOffsets):
1290         * testing/Internals.h:
1291         * testing/Internals.idl:
1292
1293 2017-01-10  Chris Dumez  <cdumez@apple.com>
1294
1295         Make Event.initEvent()'s first parameter mandatory
1296         https://bugs.webkit.org/show_bug.cgi?id=166894
1297
1298         Reviewed by Alex Christensen.
1299
1300         Make Event.initEvent()'s first parameter mandatory. As per the
1301         specification, all parameters should be mandatory and we are
1302         currently dicussing the possibility of making them optional in
1303         the specification. However, having the first parameter optional
1304         makes little sense as it would set the event's type to the string
1305         "undefined".
1306
1307         Test: fast/events/initEvent-parameters.html
1308
1309         * dom/Event.idl:
1310
1311 2017-01-10  Commit Queue  <commit-queue@webkit.org>
1312
1313         Unreviewed, rolling out r210537.
1314         https://bugs.webkit.org/show_bug.cgi?id=166903
1315
1316         This change introduced JSC test failures (Requested by
1317         ryanhaddad on #webkit).
1318
1319         Reverted changeset:
1320
1321         "Implement JSSourceCode to propagate SourceCode in module
1322         pipeline"
1323         https://bugs.webkit.org/show_bug.cgi?id=166861
1324         http://trac.webkit.org/changeset/210537
1325
1326 2017-01-10  Chris Dumez  <cdumez@apple.com>
1327
1328         REGRESSION(r189555): ImageDocument title no longer includes the size of the image
1329         https://bugs.webkit.org/show_bug.cgi?id=166876
1330         <rdar://problem/29939970>
1331
1332         Reviewed by Ryosuke Niwa.
1333
1334         Add a code comment to clarify fix that was made in r210536.
1335
1336         * html/ImageDocument.cpp:
1337         (WebCore::ImageDocument::createDocumentStructure):
1338
1339 2017-01-10  Jer Noble  <jer.noble@apple.com>
1340
1341         Add support for MediaKeys.generateRequest().
1342         https://bugs.webkit.org/show_bug.cgi?id=166880
1343
1344         Reviewed by Xabier Rodriguez-Calvar.
1345
1346         Test: media/encrypted-media/mock-MediaKeySession-generateRequest.html
1347
1348         Implement MediaKeySession::generateRequest(). This requires some additions
1349         to CDM, CDMPrivate, and CDMInstance to support platform adoption and to
1350         implement mock support for testing. Additionally, add an InitDataRegistry
1351         object which can sanitize and extract key data from various initData types.
1352         (At the moment, only the "keyids" initData type is implemented.)
1353
1354         Drive-by fixes: Change all instances of initDataType from String -> AtomicString.
1355         Add "const" flags to all CDMPrivate methods that might be called from a const
1356         reference.
1357
1358         * CMakeLists.txt:
1359         * Modules/encryptedmedia/CDM.cpp:
1360         (WebCore::CDM::supportsInitDataType):
1361         (WebCore::CDM::sanitizeInitData):
1362         (WebCore::CDM::supportsInitData):
1363         * Modules/encryptedmedia/CDM.h:
1364         * Modules/encryptedmedia/CDMInstance.h:
1365         * Modules/encryptedmedia/CDMPrivate.h:
1366         * Modules/encryptedmedia/InitDataRegistry.cpp: Added.
1367         (WebCore::extractKeyIDsKeyids):
1368         (WebCore::sanitizeKeyids):
1369         (WebCore::sanitizeCenc):
1370         (WebCore::extractKeyIDsCenc):
1371         (WebCore::sanitizeWebM):
1372         (WebCore::extractKeyIDsWebM):
1373         (WebCore::InitDataRegistry::shared):
1374         (WebCore::InitDataRegistry::InitDataRegistry):
1375         (WebCore::InitDataRegistry::sanitizeInitData):
1376         (WebCore::InitDataRegistry::extractKeyIDs):
1377         (WebCore::InitDataRegistry::registerInitDataType):
1378         * Modules/encryptedmedia/InitDataRegistry.h:
1379         * Modules/encryptedmedia/MediaKeySession.cpp:
1380         (WebCore::messageEventName):
1381         (WebCore::MediaKeySession::MediaKeySession):
1382         (WebCore::MediaKeySession::generateRequest):
1383         (WebCore::MediaKeySession::enqueueMessage):
1384         * Modules/encryptedmedia/MediaKeySession.h:
1385         * Modules/encryptedmedia/MediaKeys.cpp:
1386         (WebCore::MediaKeys::setServerCertificate):
1387         * WebCore.xcodeproj/project.pbxproj:
1388         * testing/MockCDMFactory.cpp:
1389         (WebCore::MockCDMFactory::addKeysToSessionWithID):
1390         (WebCore::MockCDMFactory::setSupportedDataTypes):
1391         (WebCore::MockCDM::supportsInitDataType):
1392         (WebCore::MockCDM::supportsConfiguration):
1393         (WebCore::MockCDM::supportsConfigurationWithRestrictions):
1394         (WebCore::MockCDM::supportsSessionTypeWithConfiguration):
1395         (WebCore::MockCDM::supportsRobustness):
1396         (WebCore::MockCDM::distinctiveIdentifiersRequirement):
1397         (WebCore::MockCDM::persistentStateRequirement):
1398         (WebCore::MockCDM::distinctiveIdentifiersAreUniquePerOriginAndClearable):
1399         (WebCore::MockCDM::supportsInitData):
1400         (WebCore::MockCDMInstance::setServerCertificate):
1401         (WebCore::MockCDMInstance::requestLicense):
1402         * testing/MockCDMFactory.h:
1403         (WebCore::MockCDMFactory::supportedDataTypes):
1404         (WebCore::MockCDMFactory::hasSessionWithID):
1405         (WebCore::MockCDMFactory::removeSessionWithID):
1406         (WebCore::MockCDMFactory::setSupportedDataTypes): Deleted.
1407
1408 2017-01-10  Jer Noble  <jer.noble@apple.com>
1409
1410         Add support for MediaKeys.createSession().
1411         https://bugs.webkit.org/show_bug.cgi?id=166796
1412
1413         Reviewed by Eric Carlson.
1414
1415         Test: media/encrypted-media/mock-MediaKeys-createSession.html
1416
1417         Implement MediaKeys::createSession(). This requires some additions to
1418         CDM, CDMPrivate, and CDMInstance to support platform adoption and to
1419         implement mock support for testing. Because the CDMInstance will now
1420         be shared between MediaKeys and MediaKeySession, it cannot be a unique_ptr.
1421         Make CDMInterface ref-counted and store it as a Ref.
1422
1423         * Modules/encryptedmedia/CDM.cpp:
1424         (WebCore::CDM::createInstance):
1425         (WebCore::CDM::supportsSessions):
1426         * Modules/encryptedmedia/CDM.h:
1427         * Modules/encryptedmedia/CDMInstance.h:
1428         * Modules/encryptedmedia/CDMPrivate.h:
1429         * Modules/encryptedmedia/MediaKeySession.cpp:
1430         (WebCore::MediaKeySession::create):
1431         (WebCore::MediaKeySession::MediaKeySession):
1432         (WebCore::MediaKeySession::sessionId):
1433         (WebCore::MediaKeySession::expiration):
1434         (WebCore::MediaKeySession::keyStatuses):
1435         * Modules/encryptedmedia/MediaKeySession.h:
1436         * Modules/encryptedmedia/MediaKeySessionType.idl:
1437         * Modules/encryptedmedia/MediaKeySystemAccess.cpp:
1438         (WebCore::MediaKeySystemAccess::createMediaKeys):
1439         * Modules/encryptedmedia/MediaKeys.cpp:
1440         (WebCore::MediaKeys::MediaKeys):
1441         (WebCore::MediaKeys::createSession):
1442         * Modules/encryptedmedia/MediaKeys.h:
1443         (WebCore::MediaKeys::create):
1444         * Modules/encryptedmedia/MediaKeys.idl:
1445
1446 2017-01-10  Jer Noble  <jer.noble@apple.com>
1447
1448         Add support for MediaKeys.setServerCertificate()
1449         https://bugs.webkit.org/show_bug.cgi?id=166772
1450
1451         Reviewed by Darin Adler.
1452
1453         Test: media/encrypted-media/mock-MediaKeys-setServerCertificate.html
1454
1455         Implement MediaKeys::setServerCertificate(). This requires some additions
1456         to CDM, CDMPrivate, and CDMInstance to support platform adoption and to
1457         implement mock support for testing.
1458
1459         * Modules/encryptedmedia/CDM.cpp:
1460         (WebCore::CDM::supportsServerCertificates):
1461         * Modules/encryptedmedia/CDM.h:
1462         * Modules/encryptedmedia/CDMInstance.h:
1463         * Modules/encryptedmedia/CDMPrivate.h:
1464         * Modules/encryptedmedia/MediaKeys.cpp:
1465         (WebCore::MediaKeys::setServerCertificate):
1466         * Modules/encryptedmedia/MediaKeys.h:
1467         * testing/MockCDMFactory.cpp:
1468         (WebCore::MockCDM::supportsServerCertificates):
1469         (WebCore::MockCDMInstance::setServerCertificate):
1470         * testing/MockCDMFactory.h:
1471         (WebCore::MockCDMFactory::supportsServerCertificates):
1472         (WebCore::MockCDMFactory::setSupportsServerCertificates):
1473         * testing/MockCDMFactory.idl:
1474
1475 2017-01-10  Youenn Fablet  <youenn@apple.com>
1476
1477         CachedScript cloning does not clone encodedSize
1478         https://bugs.webkit.org/show_bug.cgi?id=166865
1479
1480         Reviewed by Darin Adler.
1481
1482         Covered by updated test.
1483
1484         * loader/cache/CachedResource.cpp:
1485         (WebCore::CachedResource::setBodyDataFrom): set encoded size based on being cloned resource.
1486         * loader/cache/CachedScript.cpp:
1487         (WebCore::CachedScript::script):
1488         (WebCore::CachedScript::setBodyDataFrom): Making use of CachedResource::setBodyDataFrom for complete cloning.
1489
1490 2017-01-10  Zan Dobersek  <zdobersek@igalia.com>
1491
1492         Unreviewed. Remove the unused gReadyStateTimerInterval global from
1493         the MediaPlayerPrivateGStreamerMSE implementation file as it's only
1494         springing up a compiler warning.
1495
1496         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
1497
1498 2017-01-10  Zan Dobersek  <zdobersek@igalia.com>
1499
1500         [CoordinatedGraphics] TextureMapperPlatformLayerProxy is constantly getting activated
1501         https://bugs.webkit.org/show_bug.cgi?id=166856
1502
1503         Reviewed by Michael Catanzaro.
1504
1505         When CoordinatedGraphicsLayer::setContentsNeedsDisplay() is called, currently with
1506         the threaded CoordinatedGraphics mode the platform layer is marked for synchronizing.
1507         This means that at flush-time this layer swaps the buffer of the wrapped platform
1508         layer and updates the layer state to indicate that the underlying
1509         TextureMapperPlatformLayerProxy object has to be activated on the composition thread.
1510
1511         This current logic results in the TextureMapperPlatformLayerProxy object being
1512         reactivated for every display request that arrives via setContentsNeedsDisplay().
1513         This is pretty wasteful since this activation heap-allocates a RunLoop::Timer object
1514         which internally also locks up the GLib main context to attach a new source, and
1515         that's only after the source on the previous RunLoop::Timer was detached before
1516         that RunLoop::Timer was destroyed.
1517
1518         To avoid this, CoordinatedGraphicsLayer::setContentsNeedsDisplay() sets a new flag,
1519         m_shouldUpdatePlatformLayer. During flush, this flag is checked in
1520         CoordinatedGraphicsLayer::updatePlatformLayer(), with the buffer swap performed in
1521         case it's set. CoordinatedGraphicsLayer::syncPlatformLayer() now only sets the
1522         platform layer proxy object for that layer's state.
1523
1524         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
1525         (WebCore::CoordinatedGraphicsLayer::CoordinatedGraphicsLayer):
1526         (WebCore::CoordinatedGraphicsLayer::setContentsNeedsDisplay):
1527         (WebCore::CoordinatedGraphicsLayer::syncPlatformLayer):
1528         (WebCore::CoordinatedGraphicsLayer::updatePlatformLayer):
1529         (WebCore::CoordinatedGraphicsLayer::flushCompositingStateForThisLayerOnly):
1530         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h:
1531
1532 2017-01-10  Zan Dobersek  <zdobersek@igalia.com>
1533
1534         [TexMap] Use WTF::Function in TextureMapperPlatformLayerProxy
1535         https://bugs.webkit.org/show_bug.cgi?id=166853
1536
1537         Reviewed by Michael Catanzaro.
1538
1539         Use WTF::Function in the TextureMapperPlatformLayerProxy, instead of
1540         the std::function bloat.
1541
1542         * platform/graphics/texmap/TextureMapperPlatformLayerProxy.cpp:
1543         (WebCore::TextureMapperPlatformLayerProxy::scheduleUpdateOnCompositorThread):
1544         (WebCore::TextureMapperPlatformLayerProxy::compositorThreadUpdateTimerFired):
1545         * platform/graphics/texmap/TextureMapperPlatformLayerProxy.h:
1546
1547 2017-01-10  Zan Dobersek  <zdobersek@igalia.com>
1548
1549         [TextureMapper] TextureMapperPlatformLayerProxy::swapBuffers() should hold the lock throughout invocation
1550         https://bugs.webkit.org/show_bug.cgi?id=166852
1551
1552         Reviewed by Michael Catanzaro.
1553
1554         * platform/graphics/texmap/TextureMapperPlatformLayerProxy.cpp:
1555         (WebCore::TextureMapperPlatformLayerProxy::swapBuffer): Append to previous buffer
1556         to the m_usedBuffers Vector while the object's lock is held. Everywhere else the
1557         m_usedBuffers Vector is used under the lock, no reason to not do the same here.
1558
1559 2017-01-09  Yusuke Suzuki  <utatane.tea@gmail.com>
1560
1561         Implement JSSourceCode to propagate SourceCode in module pipeline
1562         https://bugs.webkit.org/show_bug.cgi?id=166861
1563
1564         Reviewed by Saam Barati.
1565
1566         Now SourceOrigin is correctly propagated through the module pipeline.
1567         So the error reported by http/tests/security/contentSecurityPolicy/module-eval-blocked-expected.html
1568         is updated.
1569
1570         * ForwardingHeaders/runtime/JSSourceCode.h: Added.
1571         * bindings/js/JSDOMPromise.h:
1572         (WebCore::DeferredPromise::resolveWithCallback):
1573         * bindings/js/ScriptModuleLoader.cpp:
1574         (WebCore::ScriptModuleLoader::notifyFinished):
1575
1576 2017-01-09  Chris Dumez  <cdumez@apple.com>
1577
1578         REGRESSION(r189555): ImageDocument title no longer includes the size of the image
1579         https://bugs.webkit.org/show_bug.cgi?id=166876
1580         <rdar://problem/29939970>
1581
1582         Reviewed by Tim Horton.
1583
1584         ImageDocument title no longer included the size of the image after r189555.
1585         This is because Document::setTitle() is a no-op if the document does not
1586         have a <head> element. To address the issue, we now include a <head>
1587         element in ImageDocuments so that their title element properly gets added
1588         to it.
1589
1590         Test: fast/images/imageDocument-title.html
1591
1592         * html/ImageDocument.cpp:
1593         (WebCore::ImageDocument::createDocumentStructure):
1594
1595 2017-01-09  Zalan Bujtas  <zalan@apple.com>
1596
1597         ASSERTION FAILED: newLogicalTop >= logicalTop in WebCore::RenderBlockFlow::getClearDelta
1598         https://bugs.webkit.org/show_bug.cgi?id=151202
1599         <rdar://problem/27711822>
1600
1601         Reviewed by Myles C. Maxfield.
1602
1603         FindNextFloatLogicalBottomAdapter uses LayoutUnit::max() to flag m_nextLogicalBottom uninitialized.        
1604         However LayoutUnit::max() can also be a valid value for m_nextLogicalBottom.
1605         FindNextFloatLogicalBottomAdapter::nextLogicalBottom() returns 0 instead of the actual value when
1606         it sees m_nextLogicalBottom uninitialized. In certain cases, it confuses the caller and we end up
1607         with a runaway loop.
1608
1609         Test: fast/block/float/assert-when-line-has-not-enough-space-left.html
1610
1611         * rendering/FloatingObjects.cpp:
1612         (WebCore::FindNextFloatLogicalBottomAdapter::FindNextFloatLogicalBottomAdapter):
1613         (WebCore::FindNextFloatLogicalBottomAdapter::highValue):
1614         (WebCore::FindNextFloatLogicalBottomAdapter::nextLogicalBottom):
1615         (WebCore::FindNextFloatLogicalBottomAdapter::nextShapeLogicalBottom):
1616         (WebCore::FindNextFloatLogicalBottomAdapter::collectIfNeeded):
1617
1618 2017-01-09  Ryan Haddad  <ryanhaddad@apple.com>
1619
1620         Unreviewed, rolling out r210531.
1621
1622         This change broke the 32-bit macOS build and caused LayoutTest
1623         failures.
1624
1625         Reverted changeset:
1626
1627         "File scheme should not allow access of a resource on a
1628         different volume."
1629         https://bugs.webkit.org/show_bug.cgi?id=158552
1630         http://trac.webkit.org/changeset/210531
1631
1632 2017-01-09  Chris Dumez  <cdumez@apple.com>
1633
1634         [iOS] Drop VNodeTracker
1635         https://bugs.webkit.org/show_bug.cgi?id=166868
1636         <rdar://problem/29937587>
1637
1638         Reviewed by Andreas Kling.
1639
1640         Drop VNodeTracker on iOS. This was introduced a while back to try and
1641         address vnode exhaustion issues in long running page load tests.
1642         However, there was no evidence that the VNodeTracker functionality
1643         helped so there is little point in keeping the extra code complexity.
1644
1645         * WebCore.xcodeproj/project.pbxproj:
1646         * platform/SharedBuffer.h:
1647         * platform/VNodeTracker.cpp: Removed.
1648         * platform/VNodeTracker.h: Removed.
1649         * platform/cf/SharedBufferCF.cpp:
1650         (WebCore::SharedBuffer::SharedBuffer):
1651         * platform/cocoa/VNodeTrackerCocoa.cpp: Removed.
1652
1653 2017-01-09  Brent Fulgham  <bfulgham@apple.com>
1654
1655         File scheme should not allow access of a resource on a different volume.
1656         https://bugs.webkit.org/show_bug.cgi?id=158552
1657         <rdar://problem/15307582>
1658
1659         Reviewed by Alex Christensen.
1660
1661         Revise SecurityOrigin to prevent files from one storage device (volume) from accessing content
1662         on a different storage device (volume) unless universal access is enabled.
1663
1664         Pass the current file device as part of the NSURLRequest so that CFNetwork can reject loads
1665         where the device changes in the midst of a load.
1666
1667         Also properly reflect that SecurityOrigin is never null by passing as a reference,
1668         rather than as a pointer.
1669
1670         Tests: Tools/TestWebKitAPI/Tests/mac/CrossPartitionFileSchemeAccess.mm
1671
1672         * page/SecurityOrigin.cpp:
1673         (WebCore::SecurityOrigin::canAccess): Pass argument as reference.
1674         (WebCore::SecurityOrigin::passesFileCheck): Add check that file URLs refer to files in
1675         the same storage volume.
1676         (WebCore::SecurityOrigin::canDisplay): Add check that files share the same volume.
1677         (WebCore::SecurityOrigin::isSameSchemeHostPort): Pass argument as reference.
1678         * page/SecurityOrigin.h:
1679         * platform/FileSystem.cpp:
1680         (WebCore::filesHaveSameVolume): Added.
1681         * platform/FileSystem.h:
1682         * platform/network/cocoa/ResourceRequestCocoa.mm:
1683         (WebCore::ResourceRequest::doUpdatePlatformRequest): If loading a file URL, tell CFNetwork
1684         the storage device at the time of the start of the load so we can trigger a failure if this
1685         changes during the load operation.
1686         * platform/posix/FileSystemPOSIX.cpp:
1687         (WebCore::getFileDeviceId): Added.
1688         * platform/win/FileSystemWin.cpp:
1689         (WebCore::getFileDeviceId): Added.
1690
1691 2017-01-09  Tim Horton  <timothy_horton@apple.com>
1692
1693         Unindenting text inside a blockquote can result in the text being reordered
1694         https://bugs.webkit.org/show_bug.cgi?id=166813
1695
1696         Reviewed by Darin Adler and Ryosuke Niwa.
1697
1698         Test: editing/execCommand/unindent-nested-blockquote-with-inner-div.html
1699
1700         * editing/IndentOutdentCommand.cpp:
1701         (WebCore::IndentOutdentCommand::outdentParagraph):
1702         Start splitting the tree at the beginning of the content being unindented,
1703         not at the containing block flow element, which could e.g. contain other
1704         elements (or even other blockquotes).
1705
1706 2017-01-09  Yusuke Suzuki  <utatane.tea@gmail.com>
1707
1708         [JSC] Prototype dynamic-import
1709         https://bugs.webkit.org/show_bug.cgi?id=165724
1710
1711         Reviewed by Saam Barati.
1712
1713         We do not set a handler for import for now.
1714         So dynamic import feature is only enabled in the JSC shell right now.
1715
1716         * bindings/js/JSDOMWindowBase.cpp:
1717         * bindings/js/JSWorkerGlobalScopeBase.cpp:
1718
1719 2017-01-09  Youenn Fablet  <youennf@gmail.com>
1720
1721         Merging ThreadableLoader redundant options on filtering responses
1722
1723         Merge OpaqueResponseBodyPolicy and ResponseFilteringPolicy ThreadableLoader options
1724         https://bugs.webkit.org/show_bug.cgi?id=166843
1725
1726         Reviewed by Darin Adler.
1727
1728         Covered by existing tests.
1729
1730         Removing OpaqueResponseBodyPolicy option.
1731         When ResponseFilteringPolicy is set to Enable, the body is filtered out in DocumentThreadableLoader.
1732
1733         * Modules/fetch/FetchLoader.cpp:
1734         (WebCore::FetchLoader::start):
1735         * loader/DocumentThreadableLoader.cpp:
1736         (WebCore::DocumentThreadableLoader::didReceiveResponse): Implementing body filtering based on ResponseFilteringPolicy option.
1737         * loader/ThreadableLoader.cpp:
1738         (WebCore::ThreadableLoaderOptions::ThreadableLoaderOptions):
1739         * loader/ThreadableLoader.h:
1740         * loader/WorkerThreadableLoader.cpp:
1741         (WebCore::LoaderTaskOptions::LoaderTaskOptions):
1742         * workers/WorkerScriptLoader.cpp:
1743         (WebCore::WorkerScriptLoader::loadSynchronously):
1744         (WebCore::WorkerScriptLoader::loadAsynchronously):
1745         * xml/XMLHttpRequest.cpp:
1746         (WebCore::XMLHttpRequest::createRequest):
1747
1748 2017-01-09  Daniel Bates  <dabates@apple.com>
1749
1750         Evaluating window named element may return wrong result
1751         https://bugs.webkit.org/show_bug.cgi?id=166792
1752         <rdar://problem/29801059>
1753
1754         Reviewed by Chris Dumez.
1755
1756         * bindings/js/JSDOMWindowProperties.cpp:
1757         (WebCore::jsDOMWindowPropertiesGetOwnPropertySlotNamedItemGetter):
1758
1759 2017-01-09  Chris Dumez  <cdumez@apple.com>
1760
1761         REGRESSION(r178955): Touching Settings.in doesn't cause JSInternalSettingsGenerated.cpp to be updated on first build
1762         https://bugs.webkit.org/show_bug.cgi?id=166814
1763
1764         Reviewed by Darin Adler.
1765
1766         Stop using .INTERMEDIATE in DerivedSources.make was it seems to break dependency
1767         chains for some reason. We started using .INTERMEDIATE for scripts that generate
1768         several targets when run a single time. It avoided running the script several
1769         times (once per target) unnecessarily, and fixed issues with parallel builds.
1770
1771         To address the same issue without using .INTERMEDIATE, we now use pattern rules
1772         (i.e. rules that have '%'). As per the documentation [1]:
1773         "Pattern rules may have more than one target. Unlike normal rules, this does not
1774          act as many different rules with the same prerequisites and recipe. If a pattern
1775          rule has multiple targets, make knows that the rule’s recipe is responsible for
1776          making all of the targets. The recipe is executed only once to make all the
1777          targets".
1778
1779          We are therefore solving the same problem as with .INTERMEDIATE. However, I have
1780          confirmed that using pattern rules does not break dependency chains. For example,
1781          modifying Settings.in re-generates both InternalSettingsGenerated.idl *and*
1782          JSInternalSettingsGenerated.cpp.
1783
1784          [1] https://www.gnu.org/software/make/manual/html_node/Pattern-Intro.html#Pattern-Intro
1785
1786         * DerivedSources.make:
1787
1788 2017-01-09  Commit Queue  <commit-queue@webkit.org>
1789
1790         Unreviewed, rolling out r210493 and r210495.
1791         https://bugs.webkit.org/show_bug.cgi?id=166842
1792
1793         Causes makeprops.pl to run on every build (Requested by smfr
1794         on #webkit).
1795
1796         Reverted changesets:
1797
1798         "Avoid triggering rebuilds for minor changes of
1799         CSSProperties.json"
1800         https://bugs.webkit.org/show_bug.cgi?id=166810
1801         http://trac.webkit.org/changeset/210493
1802
1803         "Avoid triggering rebuilds for minor changes of
1804         CSSProperties.json"
1805         https://bugs.webkit.org/show_bug.cgi?id=166810
1806         http://trac.webkit.org/changeset/210495
1807
1808 2017-01-06  Gustavo Noronha Silva  <gustavo.noronha@collabora.co.uk>
1809
1810         [GTK] Should support key and code properties on keyboard events
1811         https://bugs.webkit.org/show_bug.cgi?id=166759
1812
1813         Reviewed by Carlos Garcia Campos.
1814
1815         This change fixes a bunch of tests which are currently failing, such as:
1816         - fast/events/arrow-keys-on-body.html
1817         - fast/events/constructors/keyboard-event-constructor.html
1818         - fast/events/key-events-in-input-button.html
1819         - fast/events/key-events-in-input-text.html
1820         - fast/events/keyboardevent-code.html
1821         - fast/events/keyboardevent-key.html
1822
1823         * platform/PlatformKeyboardEvent.h:
1824         * platform/gtk/PlatformKeyboardEventGtk.cpp:
1825         (WebCore::PlatformKeyboardEvent::keyValueForGdkKeyCode): match web key value
1826         to GDK key symbol.
1827         (WebCore::PlatformKeyboardEvent::keyCodeForHardwareKeyCode): match web key code
1828         to hardware code as reported by GDK.
1829         (WebCore::PlatformKeyboardEvent::PlatformKeyboardEvent): add web key value and
1830         code to the keyboard event upon creation.
1831
1832 2017-01-09  Carlos Garcia Campos  <cgarcia@igalia.com>
1833
1834         [GTK] WebProcess from WebKitGtk+ 2.15.2 SIGSEGVs in std::unique_ptr<SoupBuffer, WTF::GPtrDeleter<SoupBuffer> >::get() const () at /usr/include/c++/6/bits/unique_ptr.h:305
1835         https://bugs.webkit.org/show_bug.cgi?id=165848
1836
1837         Reviewed by Michael Catanzaro.
1838
1839         In r208881 several locks were added to ImageDecoder to prevent frameBufferAtIndex() from being called by multiple
1840         threads at the same time, but I forgot isSizeAvailable() also calls frameBufferAtIndex(). However, what we
1841         really need to protect is the GIFImageDecoder, to never allow decoding from more than one thread at the same
1842         time. This patch reverts r208881 and adds a lock to GIFImageDecoder::decode() instead.
1843
1844         * platform/image-decoders/ImageDecoder.cpp:
1845         (WebCore::ImageDecoder::frameIsCompleteAtIndex):
1846         (WebCore::ImageDecoder::frameDurationAtIndex):
1847         (WebCore::ImageDecoder::createFrameImageAtIndex):
1848         * platform/image-decoders/ImageDecoder.h:
1849         * platform/image-decoders/gif/GIFImageDecoder.cpp:
1850         (WebCore::GIFImageDecoder::decode):
1851         * platform/image-decoders/gif/GIFImageDecoder.h:
1852
1853 2017-01-09  Alejandro G. Castro  <alex@igalia.com>
1854
1855         [OWR] Unskip fast/mediastream/MediaStream-video-element-track-stop.html
1856         https://bugs.webkit.org/show_bug.cgi?id=165316
1857
1858         Reviewed by Philippe Normand.
1859
1860         Fixed the ended support of the video element in the OWR player and
1861         fixed the videoTracks support. Now the OW player properly adds and
1862         removes the audio and video tracks. Added the getSettings support
1863         to the mediastream interface. Solved also the size handling in
1864         some of the enable/muted situations.
1865
1866         Unskipping fast/mediastream/MediaStream-video-element-track-stop.html.
1867
1868         * platform/GStreamer.cmake: Added the new
1869         RealtimeMediaSourceOwr.cpp with the new code handling the
1870         settings.
1871         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerOwr.cpp:
1872         (WebCore::MediaPlayerPrivateGStreamerOwr::~MediaPlayerPrivateGStreamerOwr):
1873         Release the new video and audio maps that creates a relationship
1874         of the mediastream tracks with the mediatracks of the video element.
1875         (WebCore::MediaPlayerPrivateGStreamerOwr::play): Set ended to
1876         false when we start playing.
1877         (WebCore::MediaPlayerPrivateGStreamerOwr::load): Create the media
1878         tracks to the player so that the videoTracks API returns it, and
1879         add an entry in the map to be able to restore it using the
1880         mediastream track.
1881         (WebCore::MediaPlayerPrivateGStreamerOwr::disableMediaTracks):
1882         Move some part of the stop function to this one in order to use it
1883         in pause method and avoid changing the video selection in that
1884         case.
1885         (WebCore::MediaPlayerPrivateGStreamerOwr::stop): Now we call the
1886         function disableMediaTracks and we also change teh selected
1887         videoTrack.
1888         (WebCore::MediaPlayerPrivateGStreamerOwr::trackEnded): For
1889         videoTrack reset the size and the selected element. In case there
1890         is no media playing we Make sure we set the ended variable to true
1891         and call the timeChange to modify the state of the player.
1892         (WebCore::MediaPlayerPrivateGStreamerOwr::trackEnabledChanged):
1893         Handle properly the situation when the user changed the enabled
1894         value, we disable the media.
1895         (WebCore::MediaPlayerPrivateGStreamerOwr::setSize): Modify the
1896         size of the source.
1897         (WebCore::MediaPlayerPrivateGStreamerOwr::naturalSize): Overrided
1898         to make sure we return a size even when the sample is not ready
1899         for gst.
1900         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerOwr.h:
1901         Added the ended attribute and the maps.
1902         * platform/mediastream/openwebrtc/MediaEndpointOwr.cpp:
1903         (WebCore::MediaEndpointOwr::createMutedRemoteSource): Use the new
1904         realtime video and audio sources classes, this new classes
1905         implement the settings of each type of media element.
1906         * platform/mediastream/openwebrtc/RealtimeMediaSourceCenterOwr.cpp:
1907         (WebCore::RealtimeMediaSourceCenterOwr::mediaSourcesAvailable):
1908         Use the new audio and video source classes instead of the general
1909         one in order to handle the settings properly.
1910         * platform/mediastream/openwebrtc/RealtimeMediaSourceOwr.cpp: Added
1911         (WebCore::RealtimeMediaSourceOwr::settings): Initialize using the
1912         subclass and return the new currentSettings attribute.
1913         (WebCore::RealtimeMediaSourceOwr::supportedConstraints): Call the
1914         subclass initialization of the supportedSettings.
1915         * platform/mediastream/openwebrtc/RealtimeMediaSourceOwr.h:
1916         (WebCore::RealtimeMediaSourceOwr::initializeSettings): Added to
1917         initialize the settings before returning the value. Implemented in
1918         the subclass.
1919         (WebCore::RealtimeMediaSourceOwr::initializeSupportedConstraints):
1920         Added to initialize the supported settings of the
1921         media. Implemented in the subclass.
1922         (WebCore::RealtimeMediaSourceOwr::settings): Moved to the cpp
1923         file, implemented using the initialize functions of the subclass
1924         * platform/mediastream/openwebrtc/RealtimeVideoSourceOwr.h: Added
1925         this new class to handle the settings of the video elements. The
1926         class initializes the settings and the supportedSettings.
1927         * platform/mediastream/openwebrtc/RealtimeAudioSourceOwr.h: Added
1928         this new class to handle the settings of the audio elements. The
1929         class initializes the settings and the supportedSettings.
1930
1931
1932 2017-01-08  Konstantin Tokarev  <annulen@yandex.ru>
1933
1934         Introduce CPU(X86_SSE2) instead of various SSE2 checks
1935         https://bugs.webkit.org/show_bug.cgi?id=166808
1936
1937         Reviewed by Michael Catanzaro.
1938
1939         Now copyLCharsFromUCharSource can use SSE2 implementation on non-Darwin
1940         OSes, and all SSE2 code paths are available for MSVC on x86 if /arch:SSE2
1941         or higher is enabled, and for MSVC on x86_64.
1942
1943         No new tests needed.
1944
1945         * platform/audio/SincResampler.cpp:
1946         (WebCore::SincResampler::process):
1947         * platform/audio/VectorMath.cpp:
1948         (WebCore::VectorMath::vsma):
1949         (WebCore::VectorMath::vsmul):
1950         (WebCore::VectorMath::vadd):
1951         (WebCore::VectorMath::vmul):
1952         (WebCore::VectorMath::zvmul):
1953         (WebCore::VectorMath::vsvesq):
1954         (WebCore::VectorMath::vmaxmgv):
1955
1956 2017-01-07  Simon Fraser  <simon.fraser@apple.com>
1957
1958         Avoid triggering rebuilds for minor changes of CSSProperties.json
1959         https://bugs.webkit.org/show_bug.cgi?id=166810
1960
1961         Post-review cleanup suggested by Darin Adler.
1962
1963         * css/makeprop.pl:
1964
1965 2017-01-07  Simon Fraser  <simon.fraser@apple.com>
1966
1967         Avoid triggering rebuilds for minor changes of CSSProperties.json
1968         https://bugs.webkit.org/show_bug.cgi?id=166810
1969
1970         Reviewed by Daniel Bates.
1971
1972         We expect to make lots of metadata-related changes to CSSProperties.json, and
1973         these should not trigger rebuilds.
1974         
1975         Have makeprop.pl write to temporary files first, then only replace the generated
1976         files if the contents differ.
1977
1978         * css/makeprop.pl:
1979         (replaceFileIfChanged):
1980
1981 2017-01-06  Darin Adler  <darin@apple.com>
1982
1983         Remove PassRefPtr use from "inspector", "platform/sql", and "platform/text"
1984         https://bugs.webkit.org/show_bug.cgi?id=166797
1985
1986         Reviewed by Alex Christensen.
1987
1988         * Modules/webdatabase/Database.cpp:
1989         (WebCore::Database::performOpenAndVerify): Pass a reference instead of a pointer.
1990
1991         * dom/Document.cpp:
1992         (WebCore::canonicalizedTitle): Map backslashes to currency symbols inside the
1993         existing loop through the characters instead of calling a function confusingly
1994         named "displayBuffer" to do it. More straightforward, possibly more efficient,
1995         one less function.
1996         (WebCore::Document::displayStringModifiedByEncoding): Call replace to map
1997         backslashes to currency symbols instead of calling a special displayString
1998         function. There was no real benefit to using that function; the String::replace
1999         function has all the same optimizations, and this was also the only call site.
2000
2001         * editing/SpellChecker.cpp:
2002         (WebCore::SpellChecker::invokeRequest): Pass a reference instead of a pointer.
2003
2004         * inspector/InspectorOverlay.cpp:
2005         (WebCore::InspectorOverlay::overlayPage): Call createEmptyEditorClient instead
2006         of using the class EmptyEditorClient directly.
2007
2008         * loader/EmptyClients.cpp: Moved most of the empty clients here from the header.
2009         Also made lots more things private.
2010         (WebCore::createEmptyEditorClient): Added.
2011         (WebCore::emptyDiagnosticLoggingClient): Added.
2012         * loader/EmptyClients.h: Updated for above changes. Made more things private.
2013
2014         * page/DatabaseProvider.h: Removed unneeded include.
2015         * page/MainFrame.cpp: Ditto.
2016
2017         * page/Page.cpp:
2018         (WebCore::Page::diagnosticLoggingClient): Call emptyDiagnosticLoggingClient
2019         instead of using the class EmptyDiagnosticLoggingClient directly.
2020
2021         * platform/sql/SQLiteDatabase.cpp:
2022         (WebCore::SQLiteDatabase::setAuthorizer): Take a reference instead of a
2023         PassRefPtr.
2024         * platform/sql/SQLiteDatabase.h: Updated for above.
2025
2026         * platform/text/BidiContext.cpp:
2027         (WebCore::BidiContext::BidiContext): Moved this function here from the header.
2028         (WebCore::copyContextAndRebaselineLevel): Return a Ref instead of a PassRefPtr,
2029         and take a reference rather than a raw pointer.
2030         (WebCore::BidiContext::copyStackRemovingUnicodeEmbeddingContexts): Return a
2031         Ref instead of a PassRefPtr.
2032         * platform/text/BidiContext.h: Updated for the above changes.
2033
2034         * platform/text/BidiResolver.h: Simplify initialization, use more references,
2035         auto, modern for loops, refer to derived class as that rather than the non-C++
2036         term subclass.
2037
2038         * platform/text/TextCheckerClient.h: Changd argument from PassRefPtr to a
2039         reference.
2040
2041         * platform/text/TextEncoding.h:
2042         (WebCore::TextEncoding::displayString): Deleted.
2043         (WebCore::TextEncoding::displayBuffer): Deleted.
2044
2045         * rendering/RootInlineBox.cpp: Style tweaks and use a modern for loop.
2046
2047         * svg/graphics/SVGImage.cpp:
2048         (WebCore::SVGImage::dataChanged): Call createEmptyEditorClient instead
2049         of using the class EmptyEditorClient directly.
2050
2051 2017-01-07  Andy Estes  <aestes@apple.com>
2052
2053         [QuickLook] Update quicklook test expectations
2054         https://bugs.webkit.org/show_bug.cgi?id=166798
2055         <rdar://problem/26477735>
2056
2057         Reviewed by Alex Christensen.
2058
2059         QuickLook uses UUIDs to generate x-apple-ql-id: URLs, so they will differ each time a
2060         document is previewed. Since these URLs are included in QuickLook layout test results,
2061         WebArchiveDumpSupport needs to replace them with predictable values when dumping a web
2062         archive.
2063
2064         * testing/cocoa/WebArchiveDumpSupport.mm:
2065         (WebCoreTestSupport::quickLookURLReplacements): Created a static Vector of CFStringRef pairs
2066         to store x-apple-ql-id: URLs and their replacement values.
2067         (WebCoreTestSupport::normalizeWebResourceURL): If the URL starts with “x-apple-ql-id://”,
2068         replace the text between the scheme and the file extension with “resource”. Store the
2069         original URL along with its replacement in quickLookURLReplacements().
2070         (WebCoreTestSupport::createXMLStringFromWebArchiveData): Replaced all QuickLook URLs in the
2071         final XML text with their replacement URLs. 
2072
2073 2017-01-07  Andy Estes  <aestes@apple.com>
2074
2075         [QuickLook] Consolidate usage of QuickLookHandle into SubresourceLoader
2076         https://bugs.webkit.org/show_bug.cgi?id=166713
2077
2078         Reviewed by Alex Christensen.
2079
2080         QuickLook conversion was originally implemented by intercepting document loads at the
2081         ResourceHandle level, with separate paths for NSURLConnection and CFURLConnection handles.
2082         When QuickLook was ported to WebKit2, a third path was added in WebResourceLoader.
2083         
2084         This change removes these three separate paths and implements a single conversion path in
2085         SubresourceLoader, where QuickLook can intercept document loads regardless of the networking
2086         API being used.
2087
2088         No change in behavior. Covered by existing tests.
2089
2090         * loader/ResourceLoader.h: Removed override from didCreateQuickLookHandle() since this
2091         function is no longer declared in ResourceHandleClient.
2092         * loader/SubresourceLoader.cpp:
2093         (WebCore::SubresourceLoader::shouldCreateQuickLookHandleForResponse): Added a helper
2094         function to check if a QuickLookHandle should be created for a response.
2095         (WebCore::SubresourceLoader::didReceiveResponse): Created a QuickLookHandle if necessary
2096         and stored it in the DocumentLoader.
2097         (WebCore::SubresourceLoader::didReceiveData): If there is a QuickLookHandle, call
2098         QuickLookHandle::didReceiveBuffer(), and return early if QuickLook is converting.
2099         (WebCore::SubresourceLoader::didReceiveBuffer): Ditto for QuickLookHandle::didReceiveBuffer().
2100         (WebCore::SubresourceLoader::didFinishLoading): Ditto for QuickLookHandle::didFinishLoading().
2101         (WebCore::SubresourceLoader::didFail): If there is a QuickLookHandle, call QuickLookHandle::didFail().
2102         * loader/SubresourceLoader.h: Declared shouldCreateQuickLookHandleForResponse().
2103         * loader/ios/QuickLook.h: Removed declarations used by the ResourceHandles and declared new
2104         functions used by SubresourceLoader.
2105         * loader/ios/QuickLook.mm:
2106         (WebCore::QuickLookHandle::QuickLookHandle): Removed the NSURLConnection * parameter, since
2107         we’d now always pass nil.
2108         (WebCore::QuickLookHandle::create): Removed create() functions used by ResourceHandles.
2109         (WebCore::QuickLookHandle::didReceiveData): Added. Copies the data into an NSData, wraps it
2110         in an NSArray, and passes it to didReceiveDataArray().
2111         (WebCore::QuickLookHandle::didReceiveBuffer): Added. Creates a NSArray of NSData from the
2112         SharedBuffer and passes it to didReceiveDataArray().
2113         (-[WebQuickLookHandleAsDelegate initWithConnectionDelegate:]): Deleted.
2114         (-[WebQuickLookHandleAsDelegate connection:didReceiveDataArray:]): Deleted.
2115         (-[WebQuickLookHandleAsDelegate connection:didReceiveData:lengthReceived:]): Deleted.
2116         (-[WebQuickLookHandleAsDelegate connectionDidFinishLoading:]): Deleted.
2117         (-[WebQuickLookHandleAsDelegate connection:didFailWithError:]): Deleted.
2118         (-[WebQuickLookHandleAsDelegate detachHandle]): Deleted.
2119         (WebCore::QuickLookHandle::cfResponse): Deleted.
2120         (WebCore::QuickLookHandle::didReceiveDataArray): Passed dataArray to m_converter and m_client.
2121         * platform/SharedBuffer.h: Const-qualified createNSDataArray().
2122         * platform/cocoa/SharedBufferCocoa.mm:
2123         (WebCore::SharedBuffer::createNSDataArray): Ditto.
2124         * platform/network/ResourceHandle.cpp: Stopped including QuickLook.h.
2125         * platform/network/ResourceHandle.h: Removed m_quickLook.
2126         (WebCore::ResourceHandle::quickLookHandle): Deleted.
2127         * platform/network/ResourceHandleClient.h:
2128         (WebCore::ResourceHandleClient::didCreateQuickLookHandle): Deleted.
2129         * platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.cpp:
2130         (WebCore::SynchronousResourceHandleCFURLConnectionDelegate::didReceiveResponse): Removed QuickLook code.
2131         (WebCore::SynchronousResourceHandleCFURLConnectionDelegate::didReceiveData): Ditto.
2132         (WebCore::SynchronousResourceHandleCFURLConnectionDelegate::didFinishLoading): Ditto.
2133         (WebCore::SynchronousResourceHandleCFURLConnectionDelegate::didFail): Ditto.
2134         (WebCore::SynchronousResourceHandleCFURLConnectionDelegate::didReceiveDataArray): Ditto.
2135         * platform/network/mac/ResourceHandleMac.mm:
2136         (WebCore::ResourceHandle::setQuickLookHandle): Deleted.
2137         * platform/network/mac/WebCoreResourceHandleAsDelegate.mm:
2138         (-[WebCoreResourceHandleAsDelegate connection:didReceiveResponse:]): Removed QuickLook code.
2139         (-[WebCoreResourceHandleAsDelegate connection:didReceiveDataArray:]): Ditto.
2140         (-[WebCoreResourceHandleAsDelegate connection:didReceiveData:lengthReceived:]): Ditto.
2141         (-[WebCoreResourceHandleAsDelegate connectionDidFinishLoading:]): Ditto.
2142         (-[WebCoreResourceHandleAsDelegate connection:didFailWithError:]): Ditto.
2143
2144 2017-01-06  Daniel Bates  <dabates@apple.com>
2145
2146         Ensure navigation only allowed for documents not in the page cache
2147         https://bugs.webkit.org/show_bug.cgi?id=166773
2148         <rdar://problem/29762809>
2149
2150         Reviewed by Brent Fulgham.
2151
2152         It is wise to ensure that navigation is only allowed when initiated from a document that
2153         is not in- or about to be put in- the page cache. Such a navigation would surprise a
2154         person that had navigated away from the initiating document among other issues.
2155
2156         * dom/Document.cpp:
2157         (WebCore::Document::canNavigate): Only allow navigation if the document is not in the
2158         page cache.
2159         * html/HTMLAnchorElement.cpp:
2160         (WebCore::HTMLAnchorElement::handleClick): Ditto.
2161         * html/HTMLLinkElement.cpp:
2162         (WebCore::HTMLLinkElement::handleClick): Ditto.
2163         * loader/FrameLoader.cpp:
2164         (WebCore::FrameLoader::urlSelected): Assert triggering event's document is not in the
2165         page cache.
2166         (WebCore::FrameLoader::submitForm): Allow submission if the document is not in the
2167         page cache.
2168         (WebCore::FrameLoader::loadFrameRequest): Assert triggering event's document is not in
2169         the page cache.
2170         * mathml/MathMLElement.cpp:
2171         (WebCore::MathMLElement::defaultEventHandler): Only allow navigation if the document is
2172         not in the page cache.
2173         * svg/SVGAElement.cpp:
2174         (WebCore::SVGAElement::defaultEventHandler): Ditto.
2175
2176 2017-01-06  Jer Noble  <jer.noble@apple.com>
2177
2178         Crash in WebCore::MediaPlayerPrivateMediaSourceAVFObjC::sizeWillChangeAtTime(const MediaTime&, const FloatSize&)::block_invoke
2179         https://bugs.webkit.org/show_bug.cgi?id=166738
2180
2181         Reviewed by Eric Carlson.
2182
2183         AVFoundation can potentially call the same boundary time observer multiple times, and
2184         in that case, it's possible that the observer queue will be empty when we attempt
2185         to remove the first item from the queue. There's an ASSERT() in Deque for this case,
2186         but we need to explicitly protect against this case.
2187
2188         Drive-by fix: Explicitly unregister the observer before releasing it.
2189
2190         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
2191         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::sizeWillChangeAtTime):
2192
2193 2017-01-06  Joseph Pecoraro  <pecoraro@apple.com>
2194
2195         REGRESSION(r208886) Web Inspector: Toggling CSS Properties in Styles Sidebar (comment / uncomment)
2196         https://bugs.webkit.org/show_bug.cgi?id=166786
2197         <rdar://problem/29767412>
2198
2199         Reviewed by Brian Burg.
2200
2201         * inspector/InspectorStyleSheet.cpp:
2202         (WebCore::InspectorStyle::populateAllProperties):
2203         Match earlier behavior and don't send the frontend information about
2204         disabled (commented out) properties. Follow-up later to send this
2205         information when implementing proper handling of them in the frontend.
2206
2207 2017-01-06  Sam Weinig  <sam@webkit.org>
2208
2209         [WebIDL] Remove custom bindings from CanvasRenderingContext2D
2210         https://bugs.webkit.org/show_bug.cgi?id=166793
2211
2212         Reviewed by Darin Adler.
2213
2214         * WebCore.xcodeproj/project.pbxproj:
2215         Move JSCanvasRenderingContext2DCustom.cpp to the GC only group.
2216
2217         * bindings/js/JSCanvasRenderingContext2DCustom.cpp:
2218         (WebCore::toJS): Deleted.
2219         (WebCore::toHTMLCanvasStyle): Deleted.
2220         (WebCore::JSCanvasRenderingContext2D::strokeStyle): Deleted.
2221         (WebCore::JSCanvasRenderingContext2D::setStrokeStyle): Deleted.
2222         (WebCore::JSCanvasRenderingContext2D::fillStyle): Deleted.
2223         (WebCore::JSCanvasRenderingContext2D::setFillStyle): Deleted.
2224         Remove non-GC related custom bindings.
2225
2226         * html/canvas/CanvasRenderingContext2D.cpp:
2227         (WebCore::CanvasRenderingContext2D::setStrokeStyle):
2228         (WebCore::CanvasRenderingContext2D::setFillStyle):
2229         (WebCore::toStyle):
2230         (WebCore::CanvasRenderingContext2D::strokeStyle):
2231         (WebCore::CanvasRenderingContext2D::fillStyle):
2232         * html/canvas/CanvasRenderingContext2D.h:
2233         * html/canvas/CanvasRenderingContext2D.idl:
2234         Made existing setStrokeStyle/setFillStyle functions (which take CanvasStyle's) 
2235         private, and implemented new ones that operate on Variants, matching the spec.
2236
2237 2017-01-05  Darin Adler  <darin@apple.com>
2238
2239         Remove PassRefPtr use from "rendering" directory, other improvements
2240         https://bugs.webkit.org/show_bug.cgi?id=166717
2241
2242         Reviewed by Sam Weinig.
2243
2244         * css/CSSComputedStyleDeclaration.cpp:
2245         (WebCore::shapePropertyValue): Use auto.
2246         * css/CSSFilterImageValue.cpp:
2247         (WebCore::CSSFilterImageValue::image): Use auto. Pass references.
2248         (WebCore::CSSFilterImageValue::filterImageChanged): Use modern for loop.
2249
2250         * css/StyleBuilderConverter.h:
2251         (WebCore::StyleBuilderConverter::convertShapeValue): Use overloaded
2252         ShapeValue::create function instead of differently named functions.
2253         * page/animation/CSSPropertyAnimation.cpp:
2254         (WebCore::blendFunc): Ditto.
2255
2256         * platform/graphics/filters/Filter.h: Added a protected constructor that takes
2257         a filter resolution.
2258
2259         * rendering/FilterEffectRenderer.cpp:
2260         (WebCore::FilterEffectRenderer::FilterEffectRenderer): Use new constructor so
2261         we don't have to call setFilterResolution and can initialize m_sourceGraphic.
2262         (WebCore::FilterEffectRenderer::create): Moved here from the header.
2263         (WebCore::FilterEffectRenderer::buildReferenceFilter): Take references and not
2264         PssRefPtr. Use auto and references.
2265         (WebCore::FilterEffectRenderer::build): Take a reference. Updated to work with
2266         references rather than pointer. Use auto.
2267         (WebCore::FilterEffectRenderer::allocateBackingStoreIfNeeded): Use early return.
2268         (WebCore::FilterEffectRenderer::clearIntermediateResults): Use modern for loop.
2269         (WebCore::FilterEffectRenderer::apply): Use references.
2270         (WebCore::FilterEffectRenderer::output): Moved here from header.
2271         (WebCore::FilterEffectRenderer::setMaxEffectRects): Moved here from header.
2272         (WebCore::FilterEffectRenderer::outputRect): Moved here from header.
2273         (WebCore::FilterEffectRendererHelper::prepareFilterEffect): Take references.
2274         (WebCore::FilterEffectRendererHelper::beginFilterEffect): Use auto and references.
2275         (WebCore::FilterEffectRendererHelper::applyFilterEffect): Ditto.
2276         * rendering/FilterEffectRenderer.h: Updated for the above changes. Made a lot more
2277         things private.
2278
2279         * rendering/RenderLayer.cpp:
2280         (WebCore::RenderLayer::filterPainter): Added. Helper so setupFilters does not
2281         have to do things twice.
2282         (WebCore::RenderLayer::hasFilterThatIsPainting): Updated to call filterPainter.
2283         (WebCore::RenderLayer::setupFilters): Ditto.
2284         (WebCore::RenderLayer::calculateClipRects): Pass reference.
2285         * rendering/RenderLayer.h: Updated for the above changes.
2286
2287         * rendering/style/ContentData.cpp:
2288         (WebCore::ContentData::clone): Use auto.
2289         (WebCore::ImageContentData::createContentRenderer): Updated for reference.
2290         * rendering/style/ContentData.h: Use Ref&& instead of PassRefPtr. Made more
2291         things private.
2292
2293         * rendering/style/NinePieceImage.cpp:
2294         (WebCore::NinePieceImage::defaultData): Made this a static member so it can
2295         get at the now-private class NinePieceImage::Data.
2296         (WebCore::NinePieceImage::NinePieceImage): Use RefPtr&& instead of PassRefPtr.
2297         Use construction instead of calling m_data.access() over and over again.
2298         (WebCore::NinePieceImage::Data::Data): Renamed from NinePieceImageData.
2299         Moved initialization to class definition. Added a new overload for the normal
2300         creation case.
2301         (WebCore::NinePieceImage::Data::create): Ditto.
2302         (WebCore::NinePieceImage::Data::copy): Ditto.
2303         (WebCore::NinePieceImage::Data::operator==): Ditto.
2304         * rendering/style/NinePieceImage.h: Cut down on includes. Moved the class
2305         named NinePieceImageData in to become the private struct NinePieceImage::Data.
2306
2307         * rendering/style/RenderStyle.cpp:
2308         (WebCore::RenderStyle::setContent): Pass Ref&& instead of RefPtr&& when
2309         creating ImageContentData.
2310
2311         * rendering/style/ShapeValue.cpp:
2312         (WebCore::ShapeValue::isImageValid): Tighten up by using data member directly
2313         and using a local variabel.
2314         (WebCore::pointersOrValuesEqual): Deleted.
2315         (WebCore::ShapeValue::operator==): Use arePointingToEqualData instead the
2316         above deleted function template. Wrote as a single return statement for clarity.
2317         * rendering/style/ShapeValue.h: Changed all the create function names to just
2318         create, using overloading instead of separate names. Use Ref&& instead of PassRefPtr.
2319         Removed unused constructor that took a type but no data.
2320
2321 2017-01-06  Chris Dumez  <cdumez@apple.com>
2322
2323         Regression(r189230): DOM Callbacks may use wrong global object
2324         https://bugs.webkit.org/show_bug.cgi?id=166784
2325
2326         Reviewed by Mark Lam.
2327
2328         DOM Callbacks could end up using the wrong global object after r189230
2329         because we were getting the globalObject from the callback object
2330         instead of the one at the point the callback object was passed in by
2331         JavaScript. This patch fixes the issue.
2332
2333         Test: fast/frames/frame-window-as-callback.html
2334
2335         * bindings/js/JSCallbackData.cpp:
2336         (WebCore::JSCallbackData::invokeCallback):
2337         * bindings/js/JSCallbackData.h:
2338         (WebCore::JSCallbackData::globalObject):
2339         (WebCore::JSCallbackData::JSCallbackData):
2340         (WebCore::JSCallbackDataStrong::JSCallbackDataStrong):
2341         (WebCore::JSCallbackDataStrong::callback):
2342         (WebCore::JSCallbackDataStrong::invokeCallback):
2343         (WebCore::JSCallbackDataWeak::JSCallbackDataWeak):
2344         (WebCore::JSCallbackDataWeak::callback):
2345         (WebCore::JSCallbackDataWeak::invokeCallback):
2346         * bindings/scripts/CodeGeneratorJS.pm:
2347         (GenerateCallbackImplementationContent):
2348
2349 2017-01-06  Andy Estes  <aestes@apple.com>
2350
2351         [Cocoa] Consolidate duplicate copies of WebArchiveDumpSupport in DRT and WKTR into WebCoreTestSupport
2352         https://bugs.webkit.org/show_bug.cgi?id=166789
2353
2354         Reviewed by Alex Christensen.
2355
2356         There were duplicate implementations of WebArchiveDumpSupport in DumpRenderTree and
2357         WebKitTestRunner. This change consolidates these into a single implementation in
2358         WebCoreTestSupport.
2359
2360         * PlatformMac.cmake: Added WebArchiveDumpSupport.mm to WebCoreTestSupport.
2361         * WebCore.xcodeproj/project.pbxproj: Ditto. Also made WebArchiveDumpSupport.h a Private header.
2362         * platform/spi/cf/CFNetworkSPI.h: Moved CFNetwork forward declarations from
2363         WebArchiveDumpSupport to here.
2364         * testing/cocoa/WebArchiveDumpSupport.h: Added.
2365         * testing/cocoa/WebArchiveDumpSupport.mm: Merged WebArchiveDumpSupport.cpp and
2366         WebArchiveDumpSupport{Cocoa,Mac}.mm into a single file.
2367
2368 2017-01-06  Tim Horton  <timothy_horton@apple.com>
2369
2370         Minor cleanups to IndentOutdentCommand and related code
2371         https://bugs.webkit.org/show_bug.cgi?id=166791
2372
2373         Reviewed by Simon Fraser.
2374
2375         * editing/IndentOutdentCommand.cpp:
2376         (WebCore::IndentOutdentCommand::IndentOutdentCommand):
2377         (WebCore::IndentOutdentCommand::outdentRegion):
2378         * editing/IndentOutdentCommand.h:
2379         (WebCore::IndentOutdentCommand::create):
2380         Remove the unused m_marginInPixels and fix the copyright header.
2381
2382 2017-01-06  Alex Christensen  <achristensen@webkit.org>
2383
2384         Fix WinCairo build after r210319.
2385         https://bugs.webkit.org/show_bug.cgi?id=166635
2386
2387         * DerivedSources.cpp:
2388         A toJS call was ambiguous, but only if the generated IndexedDB bindings are compiled all-in-one in DerivedSources.cpp.
2389         Compiling these few files separately (which happens automatically in the CMake build) fixes the build and won't increase
2390         the total object files beyond MSVC's current 2GB limit.
2391         * bindings/js/JSWebGLRenderingContextBaseCustom.cpp:
2392         (WebCore::JSWebGLRenderingContextBaseOwner::isReachableFromOpaqueRoots):
2393         Unknown was an ambiguous symbol.  It's also defined in winioctl.h.
2394
2395 2017-01-06  Zalan Bujtas  <zalan@apple.com>
2396
2397         Text highlight causes Yoon Gothic webfont to reflow.
2398         https://bugs.webkit.org/show_bug.cgi?id=166753
2399
2400         Reviewed by Darin Adler.
2401
2402         Add word-break: keep-all; support for CJK and breaking NBSPs.
2403
2404         Add test later. Need to figure out what font file to use.
2405
2406         * rendering/SimpleLineLayoutTextFragmentIterator.cpp:
2407         (WebCore::SimpleLineLayout::TextFragmentIterator::Style::Style):
2408         (WebCore::SimpleLineLayout::TextFragmentIterator::nextBreakablePosition): Use BreakingContext's helper functions
2409         to figure out the next breakable position.
2410         (WebCore::SimpleLineLayout::TextFragmentIterator::skipToNextPosition):
2411         * rendering/SimpleLineLayoutTextFragmentIterator.h:
2412
2413 2017-01-06  Joseph Pecoraro  <pecoraro@apple.com>
2414
2415         Add some missing longhand properties to CSSComputedStyleDeclaration and fix default values
2416         https://bugs.webkit.org/show_bug.cgi?id=166674
2417         <rdar://problem/6026159>
2418
2419         Reviewed by Darin Adler.
2420
2421         * css/CSSComputedStyleDeclaration.cpp:
2422         Add some missing longhand properties to the list of all longhand properties.
2423
2424         (WebCore::counterToCSSValue):
2425         The default value for counter-increment and counter-reset should be "none"
2426         not the empty string.
2427
2428 2017-01-06  Chris Dumez  <cdumez@apple.com>
2429
2430         [Form Validation] "character" in maxlength validation message should be singular when maxlength is 1
2431         https://bugs.webkit.org/show_bug.cgi?id=166712
2432         <rdar://problem/29872292>
2433
2434         Reviewed by Darin Adler.
2435
2436         Fix validation message to use singular form of "character" when maxLength value is 1.
2437
2438         Test: fast/forms/validation-message-maxLength.html
2439
2440         * English.lproj/Localizable.strings:
2441         * English.lproj/Localizable.stringsdict: Added.
2442         * WebCore.xcodeproj/project.pbxproj:
2443         * extract-localizable-strings.pl:
2444         * platform/LocalizedStrings.cpp:
2445         * platform/LocalizedStrings.h:
2446         * platform/cocoa/LocalizedStringsCocoa.mm:
2447         (WebCore::localizedNString):
2448         (WebCore::localizedString):
2449         (WebCore::validationMessageTooLongText):
2450
2451 2017-01-06  Jer Noble  <jer.noble@apple.com>
2452
2453         Add support for MediaKeySystemAccess.createMediaKeys()
2454         https://bugs.webkit.org/show_bug.cgi?id=166749
2455
2456         Reviewed by Eric Carlson.
2457
2458         Test: media/encrypted-media/mock-MediaKeySystemAccess.html
2459
2460         Implement MediaKeySystemAccess::createMediaKeys(). This requires some
2461         additions to CDM, CDMPrivate, and a new interface CDMInstance to support
2462         eventual platform adoption and to implement mock support for testing.
2463
2464         * Modules/encryptedmedia/CDM.cpp:
2465         (WebCore::CDM::loadAndInitialize):
2466         (WebCore::CDM::createInstance):
2467         * Modules/encryptedmedia/CDM.h:
2468         * Modules/encryptedmedia/CDMInstance.h:
2469         (WebCore::CDMInstance::~CDMInstance):
2470         * Modules/encryptedmedia/CDMPrivate.h:
2471         * Modules/encryptedmedia/MediaKeySystemAccess.cpp:
2472         (WebCore::MediaKeySystemAccess::createMediaKeys):
2473         * Modules/encryptedmedia/MediaKeySystemAccess.h:
2474         * Modules/encryptedmedia/MediaKeys.cpp:
2475         (WebCore::MediaKeys::MediaKeys):
2476         * Modules/encryptedmedia/MediaKeys.h:
2477         (WebCore::MediaKeys::create):
2478         * Modules/encryptedmedia/MediaKeys.idl:
2479         * Modules/encryptedmedia/NavigatorEME.cpp:
2480         (WebCore::tryNextSupportedConfiguration):
2481         * WebCore.xcodeproj/project.pbxproj:
2482         * testing/MockCDMFactory.cpp:
2483         (WebCore::MockCDM::MockCDM):
2484         (WebCore::MockCDM::createInstance):
2485         (WebCore::MockCDM::loadAndInitialize):
2486         (WebCore::MockCDMInstance::MockCDMInstance):
2487         (WebCore::MockCDMInstance::initializeWithConfiguration):
2488         (WebCore::MockCDMInstance::setDistinctiveIdentifiersAllowed):
2489         (WebCore::MockCDMInstance::setPersistentStateAllowed):
2490         * testing/MockCDMFactory.h:
2491         (WebCore::MockCDMFactory::canCreateInstances):
2492         (WebCore::MockCDMFactory::setCanCreateInstances):
2493         (WebCore::MockCDM::factory):
2494         * testing/MockCDMFactory.idl:
2495
2496 2017-01-06  Andreas Kling  <akling@apple.com>
2497
2498         Give RenderObject a Page& getter.
2499         <https://webkit.org/b/166735>
2500
2501         Reviewed by Darin Adler.
2502
2503         The render tree should now only ever be live while in a Frame that's connected to a Page.
2504         Hence we can give RenderObject a Page& getter and simplify a lot of code that previously
2505         had to get the Page from Document (or Frame) and perform null checks on it.
2506
2507         * dom/Document.cpp:
2508         (WebCore::Document::destroyRenderTree): Assert that the Page is present when we tear the render tree down.
2509
2510         * page/Frame.cpp:
2511         (WebCore::Frame::willDetachPage): Assert that there's no render tree when we're about to detach from the Page.
2512         Also added a comment explaining the two main ways that render trees die.
2513
2514         * rendering/RenderObject.h:
2515         (WebCore::RenderObject::page): Added. So neat!
2516
2517         * accessibility/AccessibilityRenderObject.cpp:
2518         (WebCore::AccessibilityRenderObject::estimatedLoadingProgress):
2519         * rendering/ImageQualityController.cpp:
2520         (WebCore::ImageQualityController::chooseInterpolationQuality):
2521         * rendering/InlineTextBox.cpp:
2522         (WebCore::InlineTextBox::paint):
2523         * rendering/RenderAttachment.cpp:
2524         (WebCore::RenderAttachment::layout):
2525         (WebCore::RenderAttachment::baselinePosition):
2526         * rendering/RenderBlock.cpp:
2527         (WebCore::RenderBlock::paintCaret):
2528         * rendering/RenderBox.cpp:
2529         (WebCore::RenderBox::styleDidChange):
2530         (WebCore::setupWheelEventTestTrigger):
2531         (WebCore::RenderBox::setScrollLeft):
2532         (WebCore::RenderBox::setScrollTop):
2533         * rendering/RenderElement.cpp:
2534         (WebCore::RenderElement::paintFocusRing):
2535         * rendering/RenderEmbeddedObject.cpp:
2536         (WebCore::shouldUnavailablePluginMessageBeButton):
2537         (WebCore::RenderEmbeddedObject::paint):
2538         (WebCore::RenderEmbeddedObject::paintReplaced):
2539         (WebCore::RenderEmbeddedObject::getReplacementTextGeometry):
2540         (WebCore::RenderEmbeddedObject::handleUnavailablePluginIndicatorEvent):
2541         (WebCore::RenderEmbeddedObject::getCursor):
2542         * rendering/RenderHTMLCanvas.cpp:
2543         (WebCore::RenderHTMLCanvas::paintReplaced):
2544         * rendering/RenderIFrame.cpp:
2545         (WebCore::RenderIFrame::flattenFrame):
2546         * rendering/RenderImage.cpp:
2547         (WebCore::RenderImage::paintReplaced):
2548         (WebCore::RenderImage::paintAreaElementFocusRing):
2549         * rendering/RenderLayer.cpp:
2550         (WebCore::RenderLayer::~RenderLayer):
2551         (WebCore::RenderLayer::forceUpdateScrollbarsOnMainThreadForPerformanceTesting):
2552         (WebCore::RenderLayer::scrollRectToVisible):
2553         (WebCore::RenderLayer::isActive):
2554         (WebCore::RenderLayer::didStartScroll):
2555         (WebCore::RenderLayer::didEndScroll):
2556         (WebCore::RenderLayer::didUpdateScroll):
2557         (WebCore::RenderLayer::createScrollbar):
2558         (WebCore::RenderLayer::setupFontSubpixelQuantization):
2559         (WebCore::RenderLayer::calculateClipRects):
2560         * rendering/RenderLayer.h:
2561         * rendering/RenderLayerBacking.cpp:
2562         (WebCore::RenderLayerBacking::RenderLayerBacking):
2563         (WebCore::RenderLayerBacking::createGraphicsLayer):
2564         (WebCore::RenderLayerBacking::updateOverflowControlsLayers):
2565         (WebCore::RenderLayerBacking::detachFromScrollingCoordinator):
2566         (WebCore::RenderLayerBacking::paintContents):
2567         (WebCore::RenderLayerBacking::shouldAggressivelyRetainTiles):
2568         (WebCore::RenderLayerBacking::shouldTemporarilyRetainTileCohorts):
2569         (WebCore::RenderLayerBacking::useGiantTiles):
2570         (WebCore::RenderLayerBacking::verifyNotPainting):
2571         (WebCore::RenderLayerBacking::startAnimation):
2572         (WebCore::scrollingCoordinatorFromLayer): Deleted.
2573         * rendering/RenderLayerCompositor.cpp:
2574         (WebCore::RenderLayerCompositor::cacheAcceleratedCompositingFlags):
2575         (WebCore::RenderLayerCompositor::scheduleLayerFlushNow):
2576         (WebCore::RenderLayerCompositor::flushPendingLayerChanges):
2577         (WebCore::updateScrollingLayerWithClient):
2578         (WebCore::RenderLayerCompositor::updateCustomLayersAfterFlush):
2579         (WebCore::RenderLayerCompositor::notifyFlushBeforeDisplayRefresh):
2580         (WebCore::RenderLayerCompositor::layerTiledBackingUsageChanged):
2581         (WebCore::RenderLayerCompositor::updateCompositingLayers):
2582         (WebCore::RenderLayerCompositor::appendDocumentOverlayLayers):
2583         (WebCore::RenderLayerCompositor::layerBecameNonComposited):
2584         (WebCore::RenderLayerCompositor::updateBacking):
2585         (WebCore::RenderLayerCompositor::pageScaleFactor):
2586         (WebCore::RenderLayerCompositor::zoomedOutPageScaleFactor):
2587         (WebCore::RenderLayerCompositor::contentsScaleMultiplierForNewTiles):
2588         (WebCore::RenderLayerCompositor::updateLayerForHeader):
2589         (WebCore::RenderLayerCompositor::updateLayerForFooter):
2590         (WebCore::RenderLayerCompositor::setRootExtendedBackgroundColor):
2591         (WebCore::RenderLayerCompositor::attachRootLayer):
2592         (WebCore::RenderLayerCompositor::detachRootLayer):
2593         (WebCore::RenderLayerCompositor::rootLayerAttachmentChanged):
2594         (WebCore::RenderLayerCompositor::registerAllScrollingLayers):
2595         (WebCore::RenderLayerCompositor::scrollingCoordinator):
2596         (WebCore::RenderLayerCompositor::graphicsLayerFactory):
2597         (WebCore::RenderLayerCompositor::createDisplayRefreshMonitor):
2598         (WebCore::RenderLayerCompositor::page):
2599         * rendering/RenderLayerCompositor.h:
2600         * rendering/RenderListBox.cpp:
2601         (WebCore::setupWheelEventTestTrigger):
2602         (WebCore::RenderListBox::setScrollTop):
2603         (WebCore::RenderListBox::isActive):
2604         (WebCore::RenderListBox::forceUpdateScrollbarsOnMainThreadForPerformanceTesting):
2605         (WebCore::RenderListBox::createScrollbar):
2606         * rendering/RenderObject.cpp:
2607         (WebCore::RenderObject::theme):
2608         * rendering/RenderObject.h:
2609         (WebCore::RenderObject::page):
2610         * rendering/RenderSearchField.cpp:
2611         (WebCore::RenderSearchField::addSearchResult):
2612         (WebCore::RenderSearchField::showPopup):
2613         (WebCore::RenderSearchField::valueChanged):
2614         * rendering/RenderSnapshottedPlugIn.cpp:
2615         (WebCore::RenderSnapshottedPlugIn::updateSnapshot):
2616         * rendering/RenderTheme.cpp:
2617         (WebCore::RenderTheme::paint):
2618         (WebCore::RenderTheme::updateControlStatesForRenderer):
2619         (WebCore::RenderTheme::isActive):
2620         * rendering/RenderThemeMac.mm:
2621         (WebCore::RenderThemeMac::paintCellAndSetFocusedElementNeedsRepaintIfNecessary):
2622         (WebCore::RenderThemeMac::paintSliderThumb):
2623         * rendering/RenderVideo.cpp:
2624         (WebCore::RenderVideo::paintReplaced):
2625         * rendering/RenderView.cpp:
2626         (WebCore::RenderView::pageNumberForBlockProgressionOffset):
2627         (WebCore::RenderView::pageCount):
2628         * rendering/svg/RenderSVGRoot.cpp:
2629         (WebCore::RenderSVGRoot::paintReplaced):
2630         * style/StyleResolveForDocument.cpp:
2631         (WebCore::Style::resolveForDocument):
2632
2633 2017-01-05  Zalan Bujtas  <zalan@apple.com>
2634
2635         TextFragmentIterator::runWidth does not need typename CharacterType<> anymore.
2636         https://bugs.webkit.org/show_bug.cgi?id=166751
2637
2638         Reviewed by Simon Fraser.
2639
2640         No change in functionality.
2641
2642         * rendering/SimpleLineLayoutTextFragmentIterator.cpp:
2643         (WebCore::SimpleLineLayout::TextFragmentIterator::textWidth):
2644         * rendering/SimpleLineLayoutTextFragmentIterator.h:
2645
2646 2017-01-05  Ryosuke Niwa  <rniwa@webkit.org>
2647
2648         Finding text doesn't work across shadow boundary
2649         https://bugs.webkit.org/show_bug.cgi?id=158503
2650
2651         Reviewed by Antti Koivisto.
2652
2653         Added a new TextIterator behavior flag, TextIteratorTraversesFlatTree, which makes TextIterator traverse
2654         the flat tree instead of the DOM tree, and made this behavior default in findPlainText.
2655
2656         Also added a new find options flag, DoNotTraverseFlatTree, to suppress this behavior in window.find(~)
2657         and execCommand('FindString', false, ~) as they should not be able to peek information inside shadow trees.
2658         Unfortunately these APIs have been deprecated in the standards so there is no specification to follow.
2659
2660         For now, we don't support finding a word or a keyword across a shadow boundary as this would require
2661         making rangeOfString and other related functions return a Range-like object that can cross shadow boundaries.
2662
2663         Also added internals.rangeOfString to test Editor::rangeOfString, and replaced the bit-flag arguments
2664         to internals.countMatchesForText and internals.countFindMatches by an array of strings for better portability.
2665
2666         Test: editing/text-iterator/find-string-on-flat-tree.html
2667
2668         * editing/Editor.cpp:
2669         (WebCore::Editor::rangeOfString): Use the modern containingShadowRoot instead of nonBoundaryShadowTreeRootNode
2670         since the start container can be a shadow root, which nonBoundaryShadowTreeRootNode asserts not be the case.
2671         * editing/Editor.h:
2672         * editing/EditorCommand.cpp:
2673         (WebCore::executeFindString): Don't traverse across shadow boundaries.
2674         * editing/FindOptions.h: Added DoNotTraverseFlatTree.
2675         * editing/TextIterator.cpp:
2676         (WebCore::assignedAuthorSlot): Added.
2677         (WebCore::authorShadowRoot): Added.
2678         (WebCore::firstChildInFlatTreeIgnoringUserAgentShadow): Added.
2679         (WebCore::nextSiblingInFlatTreeIgnoringUserAgentShadow): Added.
2680         (WebCore::firstChild): Added. Traverses the flat tree when TextIteratorTraversesFlatTree is set.
2681         (WebCore::nextSibling): Ditto.
2682         (WebCore::parentNodeOrShadowHost): Ditto.
2683         (WebCore::TextIterator::advance): Don't set m_handledChildren to true when the current node has display: contents.
2684         (WebCore::findPlainText): Use TextIteratorTraversesFlatTree unless DoNotTraverseFlatTree is set.
2685         * editing/TextIteratorBehavior.h: Added TextIteratorTraversesFlatTree.
2686         * page/DOMWindow.cpp:
2687         (WebCore::DOMWindow::find): Don't traverse across shadow boundaries.
2688         * testing/Internals.cpp:
2689         (WebCore::parseFindOptions): Added.
2690         (WebCore::Internals::rangeOfString): Added.
2691         (WebCore::Internals::countMatchesForText): Replaced the find options by an array of strings instead of a bit mask.
2692         (WebCore::Internals::countFindMatches): Ditto.
2693         * testing/Internals.h:
2694         * testing/Internals.idl: Added rangeOfString, and replaced find options bit-flag in countMatchesForText and
2695         countFindMatches by an array of strings so that the tests themselves don't rely on a specific value of each bit flag.
2696
2697 2017-01-05  Chris Dumez  <cdumez@apple.com>
2698
2699         [Form Validation] lengthy validation messages should be truncated with an ellipsis
2700         https://bugs.webkit.org/show_bug.cgi?id=166747
2701         <rdar://problem/29872021>
2702
2703         Reviewed by Simon Fraser.
2704
2705         Lengthy HTML validation messages should be truncated with an ellipsis.
2706         Previously, they were truncated but there was no ellipsis.
2707
2708         No new tests, not easily testable. Manually tested on
2709         - http://codepen.io/cdumez/full/zoOZmZ/ (last field)
2710
2711         * platform/ios/ValidationBubbleIOS.mm:
2712         (WebCore::ValidationBubble::ValidationBubble):
2713         * platform/mac/ValidationBubbleMac.mm:
2714         (WebCore::ValidationBubble::ValidationBubble):
2715
2716 2017-01-05  Simon Fraser  <simon.fraser@apple.com>
2717
2718         Radio buttons have a fixed border radius making them look square when resized
2719         https://bugs.webkit.org/show_bug.cgi?id=148676
2720         rdar://problem/29889892
2721
2722         Reviewed by Tim Horton.
2723
2724         Change the 8px border-radius of iOS radio buttons to 50% so they remain circular
2725         when the page overrides the size.
2726
2727         Test: fast/forms/ios/large-radio-button-is-round.html
2728
2729         * css/html.css:
2730         (#if defined(WTF_PLATFORM_IOS) && WTF_PLATFORM_IOS):
2731
2732 2017-01-05  Myles C. Maxfield  <mmaxfield@apple.com>
2733
2734         CoreText variation axis identifiers don't work with 64-bit numbers
2735         https://bugs.webkit.org/show_bug.cgi?id=166745
2736         <rdar://problem/29856541>
2737         <rdar://problem/29848883>
2738
2739         Reviewed by Tim Horton.
2740
2741         There is a bug where some CFNumbers are getting garbage results when
2742         being placed into a 64-bit field. Luckily, we don't need the full
2743         64-bits; 32-bits is sufficient.
2744
2745         Test: fast/text/international/system-language/hindi-system-font-punctuation.html
2746
2747         * platform/graphics/cocoa/FontCacheCoreText.cpp:
2748         (WebCore::defaultVariationValues):
2749
2750 2017-01-05  Zalan Bujtas  <zalan@apple.com>
2751
2752         Start hittesting a clean tree in RenderEmbeddedObject::isReplacementObscured
2753         https://bugs.webkit.org/show_bug.cgi?id=166743
2754         <rdar://problem/29024384>
2755
2756         Reviewed by Simon Fraser.
2757
2758         Unable to reproduce.
2759
2760         * rendering/RenderEmbeddedObject.cpp:
2761         (WebCore::RenderEmbeddedObject::isReplacementObscured):
2762
2763 2017-01-04  Ryosuke Niwa  <rniwa@webkit.org>
2764
2765         Crash inside Editor::styleForSelectionStart
2766         https://bugs.webkit.org/show_bug.cgi?id=166710
2767
2768         Reviewed by Chris Dumez.
2769
2770         Added a null pointer check. This crash can happen when the DOM is mutated as editorState tries
2771         to compute the style at the selection start.
2772
2773         No new tests since there is no reproducible test case, and I couldn't come up with one either.
2774         This crash seems to retire some intricate dependency between when DOM is mutated, selection is
2775         updated, and then performPostLayoutTasks ends up updating the editor state in response to
2776         the element's editabilty changing.
2777
2778         * editing/cocoa/EditorCocoa.mm:
2779         (WebCore::Editor::styleForSelectionStart):
2780
2781 2017-01-05  Ryan Haddad  <ryanhaddad@apple.com>
2782
2783         Unreviewed, rolling out r210370.
2784
2785         This change caused hundreds of LayoutTest failures on Sierra.
2786
2787         Reverted changeset:
2788
2789         "[Cocoa] Variation fonts without variations specified are not
2790         rendered as if the default variations were specified"
2791         https://bugs.webkit.org/show_bug.cgi?id=166672
2792         http://trac.webkit.org/changeset/210370
2793
2794 2017-01-05  Carlos Garcia Campos  <cgarcia@igalia.com>
2795
2796         [SOUP] Network process crash in WebKit::CustomProtocolManagerImpl::didFailWithError
2797         https://bugs.webkit.org/show_bug.cgi?id=165082
2798
2799         Reviewed by Alex Christensen.
2800
2801         Simplified WebKitSoupRequestGenericClient.
2802
2803         * platform/network/soup/WebKitSoupRequestGeneric.cpp:
2804         (webkitSoupRequestGenericSendAsync):
2805         (webkitSoupRequestGenericSendFinish):
2806         (webkitSoupRequestGenericGetRequest):
2807         * platform/network/soup/WebKitSoupRequestGeneric.h:
2808         * platform/network/soup/WebKitSoupRequestGenericClient.h:
2809
2810 2017-01-05  Chris Dumez  <cdumez@apple.com>
2811
2812         Turn preferLowPowerWebGLRendering setting on by default
2813         https://bugs.webkit.org/show_bug.cgi?id=166737
2814         <rdar://problem/29870033>
2815
2816         Reviewed by Dean Jackson.
2817
2818         Temporarily turn preferLowPowerWebGLRendering setting on by default until
2819         we deal better with WebGL content in background tabs.
2820
2821         * page/Settings.in:
2822
2823 2017-01-05  Myles C. Maxfield  <mmaxfield@apple.com>
2824
2825         [Cocoa] Variation fonts without variations specified are not rendered as if the default variations were specified
2826         https://bugs.webkit.org/show_bug.cgi?id=166672
2827         <rdar://problem/29779119>
2828         <rdar://problem/29848883>
2829
2830         Reviewed by Simon Fraser.
2831
2832         CoreText has a bug (<rdar://problem/29859207>) where variation fonts without
2833         a specified variation value are rendered as if the minimum value is specified,
2834         rather than the default value. The solution is to apply default values where
2835         they are omitted.
2836
2837         Test: fast/text/variations/advances.html
2838
2839         * platform/graphics/cocoa/FontCacheCoreText.cpp:
2840         (WebCore::preparePlatformFont):
2841
2842 2017-01-05  Zalan Bujtas  <zalan@apple.com>
2843
2844         Mark the dedicated root linebox for trailing floats in empty inlines dirty.
2845         https://bugs.webkit.org/show_bug.cgi?id=166732
2846         <rdar://problem/29100419>
2847
2848         Reviewed by Antti Koivisto.
2849
2850         We normally attach floating boxes to the last root linebox. However when the floatbox is preceded by a <br>
2851         we generate a dedicated root linebox (TrailingFloatsRootInlineBox) for the floatbox.
2852         When this floatbox is a RenderInline descendant and this RenderInline does not generate lineboxes (it's ancestor RenderBlockFlow does)
2853         we have to make sure that this special root linebox gets marked dirty when the associated floatbox changes.
2854         (Unfortunately through the recursive calls on dirtyLinesFromChangedChild(), we lose the information about
2855         the "changed child" since the inlines propagates the marking logic to the RenderBlockFlow, see FIXME.)
2856
2857         Test: fast/inline/trailing-floats-inline-crash2.html
2858
2859         * rendering/RenderLineBoxList.cpp:
2860         (WebCore::RenderLineBoxList::dirtyLinesFromChangedChild):
2861
2862 2017-01-05  Antoine Quint  <graouts@apple.com>
2863
2864         [Cocoa] Both modern-media-controls/images/iOS modern-media-controls/images/macOS are installed on both platforms
2865         https://bugs.webkit.org/show_bug.cgi?id=163871
2866
2867         Reviewed by Eric Carlson.
2868
2869         We now only copy modern media controls images, if any, for the current platform.
2870
2871         * WebCore.xcodeproj/project.pbxproj:
2872
2873 2017-01-05  Keith Rollin  <krollin@apple.com>
2874
2875         Add WebCore::URL::protocolHostAndPort
2876         https://bugs.webkit.org/show_bug.cgi?id=166426
2877
2878         Reviewed by Alex Christensen.
2879
2880         Added to support record/replay mechanism, which needs it in order to
2881         implement fuzzy-matching of URLs that are similar to each other but
2882         that nonetheless come from the same source/host.
2883
2884         Updated TestWebKitAPI/Tests/WebCore/URL.cpp.
2885
2886         * platform/URL.cpp:
2887         (WebCore::URL::protocolHostAndPort):
2888         * platform/URL.h:
2889
2890 2017-01-05  Chris Dumez  <cdumez@apple.com>
2891
2892         Form validation: Align email validation with the latest HTML specification
2893         https://bugs.webkit.org/show_bug.cgi?id=166697
2894         <rdar://problem/29870245>
2895
2896         Reviewed by Alex Christensen.
2897
2898         Align email validation with the latest HTML specification:
2899         - https://html.spec.whatwg.org/#valid-e-mail-address
2900
2901         It particular, the following changes were made:
2902         - The first and last character of the domain now needs to be a letter or a digit
2903         - Parts of the domain can only be 63 characters in length
2904
2905         No new tests, extended existing test.
2906
2907         * html/EmailInputType.cpp:
2908
2909 2017-01-05  Enrica Casucci  <enrica@apple.com>
2910
2911         Support File Promise during drag for macOS.
2912         https://bugs.webkit.org/show_bug.cgi?id=165204
2913         rdar://problem/19595567
2914
2915         Reviewed by Tim Horton.
2916
2917         Adds the support for handling File Promise type during
2918         drag. DragData now has the knowledge of the NSFilesPromisePboardType and
2919         checks for the data type during drag.
2920
2921         * page/mac/DragControllerMac.mm:
2922         (WebCore::DragController::dragOperation):
2923         * platform/DragData.h:
2924         (WebCore::DragData::setFileNames):
2925         (WebCore::DragData::fileNames):
2926         * platform/mac/DragDataMac.mm:
2927         (WebCore::DragData::containsFiles):
2928         (WebCore::DragData::numberOfFiles):
2929         (WebCore::DragData::asFilenames):
2930         (WebCore::DragData::containsCompatibleContent):
2931         (WebCore::DragData::containsPromise):
2932         (WebCore::DragData::asURL):
2933
2934 2017-01-05  Per Arne Vollan  <pvollan@apple.com>
2935
2936         [Win] Compile error.
2937         https://bugs.webkit.org/show_bug.cgi?id=166726
2938
2939         Reviewed by Alex Christensen.
2940
2941         Add include folder.
2942
2943         * CMakeLists.txt:
2944
2945 2017-01-05  Milan Crha  <mcrha@redhat.com>
2946
2947         [SOUP] AddressSanitizer: heap-use-after-free under WTF::String::fromUTF8()
2948         https://bugs.webkit.org/show_bug.cgi?id=166722
2949
2950         Reviewed by Alex Christensen.
2951
2952         * platform/soup/PublicSuffixSoup.cpp:
2953         (WebCore::topPrivatelyControlledDomain):
2954         Use a variable to hold UTF-8 version of the domain, because
2955         the soup_tld_get_base_domain() returns a pointer into the passed-in
2956         string, which could be freed due to the temporary object being freed.
2957
2958 2017-01-05  Andreas Kling  <akling@apple.com>
2959
2960         Remove some unnecessary page cache checks in render tree code.
2961         <https://webkit.org/b/166728>
2962
2963         Reviewed by Antti Koivisto.
2964
2965         There is no render tree in the page cache, so we don't need to be checking
2966         for it in renderer code.
2967
2968         * rendering/RenderElement.cpp:
2969         (WebCore::shouldRepaintForImageAnimation):
2970         (WebCore::RenderElement::newImageAnimationFrameAvailable):
2971         * rendering/RenderImage.cpp:
2972         (WebCore::RenderImage::imageChanged):
2973         * rendering/RenderObject.cpp:
2974         (WebCore::printRenderTreeForLiveDocuments):
2975         (WebCore::printLayerTreeForLiveDocuments):
2976         * rendering/RenderView.cpp:
2977         (WebCore::RenderView::lazyRepaintTimerFired):
2978
2979 2017-01-05  Andreas Kling  <akling@apple.com>
2980
2981         REGRESSION(r210226): overflow:scroll scroll position not restored on back navigation
2982         <https://webkit.org/b/166724>
2983
2984         Reviewed by Antti Koivisto.
2985
2986         Before r210226, the render tree being torn down and the document being destroyed
2987         were roughly the same thing, since they would always happen together, from the
2988         render tree's perspective.
2989
2990         Changing this caused us to skip over the code that saves the scroll position
2991         for an element's RenderLayer when going into the page cache. Navigating back to
2992         that page would then scroll the layer to (0,0) instead of the previous position.
2993
2994         The fix is simply to remove the check for documentBeingDestroyed() in ~RenderLayer().
2995         Note that two checks are being removed, there was also a weird "optimization"
2996         to avoid nulling out EventHandler's m_resizeLayer if it points to this layer.
2997         That pointer would eventually get nulled out in EventHandler::clear() anyway,
2998         but it feels better to not let that pointer dangle.
2999
3000         Test: fast/scrolling/page-cache-back-overflow-scroll-restore.html
3001
3002         * rendering/RenderLayer.cpp:
3003         (WebCore::RenderLayer::~RenderLayer):
3004
3005 2017-01-05  Wenson Hsieh  <wenson_hsieh@apple.com>
3006
3007         Disable smooth playhead animation for main content media in the Touch Bar
3008         https://bugs.webkit.org/show_bug.cgi?id=166715
3009         <rdar://problem/29870673>
3010
3011         Reviewed by Eric Carlson.
3012
3013         Passing in a non-zero playback rate to WebPlaybackControlsManager's timing property causes unintended effects
3014         further down the stack. Please see the Radar for more details.
3015
3016         * platform/mac/WebPlaybackSessionInterfaceMac.mm:
3017         (WebCore::WebPlaybackSessionInterfaceMac::updatePlaybackControlsManagerTiming):
3018
3019 2017-01-05  Andreas Kling  <akling@apple.com>
3020
3021         Fix iOS build due to missing #include's.
3022
3023         * history/CachedFrame.cpp:
3024
3025 2017-01-05  Andreas Kling  <akling@apple.com>
3026
3027         Remove ChromeClient::needTouchEvents().
3028         <https://webkit.org/b/166723>
3029
3030         Rubber-stamped by Antti Koivisto.
3031
3032         Remove this hook since it's a no-op in every port.
3033
3034         * dom/Document.cpp:
3035         (WebCore::Document::didBecomeCurrentDocumentInFrame):
3036         (WebCore::Document::didAddTouchEventHandler):
3037         (WebCore::Document::didRemoveTouchEventHandler):
3038         * history/CachedFrame.cpp:
3039         (WebCore::CachedFrameBase::restore):
3040         * loader/EmptyClients.h:
3041         * loader/FrameLoader.cpp:
3042         (WebCore::FrameLoader::transitionToCommitted):
3043         * page/ChromeClient.h:
3044
3045 2017-01-05  Darin Adler  <darin@apple.com>
3046
3047         Remove PassRefPtr use from "bindings/scripts", "svg", "testing", and "workers"
3048         https://bugs.webkit.org/show_bug.cgi?id=166718
3049
3050         Reviewed by Alex Christensen.
3051
3052         * bindings/scripts/test/JS/JSFloat64Array.cpp: Removed. Stale unused test
3053         result expectation file.
3054         * bindings/scripts/test/JS/JSFloat64Array.h: Ditto.
3055
3056         * svg/SVGElement.cpp:
3057         (WebCore::SVGElement::removeEventListener): Fix comment that incorrectly
3058         mentions PassRefPtr.
3059
3060         * testing/Internals.cpp:
3061         (WebCore::Internals::computedStyleIncludingVisitedInfo): Return Ref instead
3062         of RefPtr.
3063         (WebCore::Internals::serializeObject): Ditto.
3064         (WebCore::Internals::deserializeBuffer): Ditto.
3065         (WebCore::Internals::observeGC): Streamlined code a bit.
3066         * testing/Internals.h: Updated for above changes.
3067         * testing/Internals.idl: Marked various function results as nullable.
3068
3069         * workers/DedicatedWorkerThread.cpp:
3070         (WebCore::DedicatedWorkerThread::createWorkerGlobalScope): Take a RefPtr&&
3071         instead of a PassRefPtr.
3072         * workers/DedicatedWorkerThread.h: Updated for above change.
3073
3074         * workers/Worker.cpp:
3075         (WebCore::Worker::Worker): Passs a reference to WorkerGlobalScopeProxy::create.
3076         (WebCore::Worker::~Worker): Updated since m_contentProxy is a reference.
3077         (WebCore::Worker::postMessage): Ditto.
3078         (WebCore::Worker::terminate): Ditto.
3079         (WebCore::Worker::hasPendingActivity): Ditto.
3080         (WebCore::Worker::notifyNetworkStateChange): Ditto.
3081         (WebCore::Worker::notifyFinished): Ditto.
3082         * workers/Worker.h: Made m_contextProxy a reference rather than a pointer.
3083
3084         * workers/WorkerGlobalScopeProxy.h: Reduced includes. Made destructor
3085         protected instead of public since this class destroys itself.
3086
3087         * workers/WorkerMessagingProxy.cpp:
3088         (WebCore::WorkerGlobalScopeProxy::create): Take and return a reference.
3089         (WebCore::WorkerMessagingProxy::WorkerMessagingProxy): Moved most initialization
3090         to the calass definition. Take a reference instead of a pointer.
3091         (WebCore::WorkerMessagingProxy::startWorkerGlobalScope): Use auto.
3092         (WebCore::WorkerMessagingProxy::workerThreadCreated): Take a reference
3093         rather than a PassRefPtr.
3094         * workers/WorkerMessagingProxy.h: Updated for above changes.
3095         (WebCore::WorkerMessagingProxy::askedToTerminate): Deleted.
3096         (WebCore::WorkerMessagingProxy::workerObject): Deleted.
3097
3098         * workers/WorkerThread.h: Take a RefPtr&& instead of a PassRefPtr.
3099
3100 2017-01-04  Carlos Garcia Campos  <cgarcia@igalia.com>
3101
3102         Unreviewed. Addressing post-review comments after r21005.
3103
3104         Simplify cairo_glyph_t initialization as suggested by Said.
3105
3106         * platform/graphics/cairo/FontCairo.cpp:
3107         (WebCore::CairoGlyphToPathTranslator::path):
3108
3109 2017-01-04  Manuel Rego Casasnovas  <rego@igalia.com>
3110
3111         [css-grid] Fix crash clamping grid lines
3112         https://bugs.webkit.org/show_bug.cgi?id=166637
3113
3114         Reviewed by Darin Adler.
3115
3116         Avoid issues with very big values for the grid lines clamping them on GridPosition.
3117
3118         Test: fast/css-grid-layout/grid-position-crash.html
3119
3120         * rendering/style/GridArea.h: Move kGridMaxTracks definition to GridPosition.
3121         * rendering/style/GridPosition.h:
3122         (WebCore::GridPosition::setExplicitPosition): Use new setIntegerPosition().
3123         (WebCore::GridPosition::setSpanPosition): Ditto.
3124         (WebCore::GridPosition::setIntegerPosition): Clamp the position using kGridMaxTracks.
3125
3126 2017-01-04  Darin Adler  <darin@apple.com>
3127
3128         Remove PassRefPtr use from the "html" directory, other improvements
3129         https://bugs.webkit.org/show_bug.cgi?id=166635
3130
3131         Reviewed by Alex Christensen.
3132
3133         * CMakeLists.txt: Removed the duplicate copies of all the WebGL-specific files
3134         in the main list of source files; there is no value in listing them twice.
3135         Replaced WebGLGetInfo.cpp with WebGLAny.cpp.
3136
3137         * Modules/mediasource/MediaSource.cpp:
3138         (WebCore::MediaSource::removeSourceBuffer): Updates since the tracks functions
3139         return references now.
3140
3141         * Modules/mediasource/SourceBuffer.cpp:
3142         (WebCore::SourceBuffer::sourceBufferPrivateFastSeekTimeForMediaTime): Removed
3143         unneeded SourceBufferPrivate* argument.
3144         (WebCore::SourceBuffer::appendBufferTimerFired): Ditto.
3145         (WebCore::SourceBuffer::sourceBufferPrivateAppendComplete): Ditto.
3146         (WebCore::SourceBuffer::sourceBufferPrivateDidReceiveRenderingError): Ditto.
3147         (WebCore::SourceBuffer::videoTracks): Return a reference rather than a pointer.
3148         (WebCore::SourceBuffer::audioTracks): Ditto.
3149         (WebCore::SourceBuffer::textTracks): Ditto.
3150         (WebCore::SourceBuffer::sourceBufferPrivateDidReceiveInitializationSegment):
3151         Removed unneeded SourceBufferPrivate* argument.
3152         (WebCore::SourceBuffer::validateInitializationSegment): Updated since tracks
3153         functions now return a pointer.
3154         (WebCore::SourceBuffer::sourceBufferPrivateDidReceiveSample): Removed unneeded
3155         SourceBufferPrivate* argument.
3156         (WebCore::SourceBuffer::sourceBufferPrivateHasAudio): Ditto.
3157         (WebCore::SourceBuffer::sourceBufferPrivateHasVideo): Ditto.
3158         (WebCore::SourceBuffer::videoTrackSelectedChanged): Take a reference rather than
3159         a pointer.
3160         (WebCore::SourceBuffer::audioTrackEnabledChanged): Ditto.
3161         (WebCore::SourceBuffer::textTrackModeChanged): Ditto.
3162         (WebCore::SourceBuffer::textTrackAddCue): Ditto.
3163         (WebCore::SourceBuffer::textTrackAddCues): Ditto.
3164         (WebCore::SourceBuffer::textTrackRemoveCue): Ditto.
3165         (WebCore::SourceBuffer::textTrackRemoveCues): Ditto.
3166         (WebCore::SourceBuffer::textTrackKindChanged): Ditto.
3167         (WebCore::SourceBuffer::sourceBufferPrivateDidBecomeReadyForMoreSamples): Ditto.
3168         (WebCore::SourceBuffer::provideMediaData): Ditto.
3169         (WebCore::SourceBuffer::reenqueueMediaForTime): Ditto.
3170         * Modules/mediasource/SourceBuffer.h: Updated for above changes.
3171
3172         * WebCore.xcodeproj/project.pbxproj: Replaced WebGLGetInfo with WebGLAny.
3173
3174         * bindings/js/JSCanvasRenderingContext2DCustom.cpp:
3175         (WebCore::toHTMLCanvasStyle): Removed explicit cast to CanvasStyle and unneeded
3176         conversion to a pointer since CanvasStyle constructors now take references.
3177
3178         * bindings/js/JSPluginElementFunctions.cpp:
3179         (WebCore::pluginInstance): Updated since bindingsInstance now returns a raw pointer.
3180         (WebCore::pluginScriptObject): Ditto.
3181
3182         * bindings/js/JSWebGL2RenderingContextCustom.cpp:
3183         (WebCore::toJS): Moved to WebGLAny.h/cpp.
3184         (WebCore::JSWebGL2RenderingContext::getIndexedParameter): Updated since the toJS
3185         function in WebGLAny.h takes references, not pointers.
3186
3187         * bindings/js/JSWebGLRenderingContextBaseCustom.cpp: Removed quite a few unneeded
3188         includes and got rid of a lot of unneeded JSC prefixes.
3189         (WebCore::toJS): Moved to WebGLAny.h/cpp.
3190         (WebCore::toJSNewlyCreated):
3191         (WebCore::objectParameter): Renamed from getObjectParameter and also changed to
3192         take a pointer to member function so we don't need an enum and a switch statement.
3193         (WebCore::toJS): Changed to take references rather than pointers.
3194         (WebCore::JSWebGLRenderingContextBase::getAttachedShaders): Use a modern for loop.
3195         (WebCore::JSWebGLRenderingContextBase::getBufferParameter): Use objectParameter.
3196         (WebCore::JSWebGLRenderingContextBase::getRenderbufferParameter): Ditto.
3197         (WebCore::JSWebGLRenderingContextBase::getVertexAttrib): Ditto.
3198         (WebCore::toNumberVector): Renamed from toVector, since this is specifically for
3199         vectors of numbers. Use uncheckedAppend instead of assignment.
3200         (WebCore::functionForUniform): Marked this inline.
3201         (WebCore::dataFunctionf): Updated for above changes.
3202         (WebCore::dataFunctioni): Ditto.
3203         (WebCore::dataFunctionMatrix): Ditto.
3204
3205         * bindings/js/ScriptModuleLoader.cpp:
3206         (WebCore::ScriptModuleLoader::fetch): Moved assertions to the top of the function.
3207         Also added a FIXME because it's unclear why these assertions are correct. Updated
3208         to use downcastScriptElement instead of toScriptElementIfPossible.
3209
3210         * dom/Document.h: Sorted list of forward-declared classes. Removed duplicate
3211         forward declaration of ScriptModuleLoader.
3212
3213         * dom/PendingScript.cpp:
3214         (WebCore::PendingScript::create): Take a ScriptElement instead of an Element.
3215         (WebCore::PendingScript::PendingScript): Ditto.
3216         (WebCore::PendingScript::loadableScript): Moved inline to header and made inline.
3217         (WebCore::PendingScript::setClient): Take a reference instead of a pointer.
3218         * dom/PendingScript.h: UPdated for above changes.
3219
3220         * dom/ScriptElement.cpp:
3221         (WebCore::ScriptElement::prepareScript): Pass a reference instead of a pointer.
3222         (WebCore::ScriptElement::ref): Added. Forwards ref/deref to the underlying element
3223         so we can use Ref and RefPtr with this class.
3224         (WebCore::ScriptElement::deref): Ditto.
3225         (WebCore::isScriptElement): Added. Replaces one of the two uses of
3226         toScriptElementIfPossible, and is similar in style to is<Element>.
3227         (WebCore::downcastScriptElement): Ditto, but for downcast.
3228         * dom/ScriptElement.h: Updated for above changes.
3229
3230         * dom/ScriptRunner.cpp:
3231         (WebCore::ScriptRunner::queueScriptForExecution): Take reference rather than
3232         pointer, and pass ScriptElement rather than Element.
3233         (WebCore::ScriptRunner::notifyFinished): Ditto.
3234         (WebCore::ScriptRunner::timerFired): Ditto.
3235         * dom/ScriptRunner.h: Updated for above changes.
3236
3237         * html/FileInputType.cpp:
3238         (WebCore::FileInputType::files): Updated since m_fileList is a Ref.
3239         (WebCore::FileInputType::createFileList): Updated to return a Ref instead of
3240         a PassRefPtr. Also use reserveInitialCapacity/uncheckedAppend.
3241         (WebCore::FileInputType::requestIcon): Updated since the updateRendering
3242         function is now called iconLoaded. Also use references instead of pointers.
3243         (WebCore::FileInputType::setFiles): Take a RefPtr&& insted of a PassRefPtr.
3244         Also put some conditional code inside an #if.
3245         (WebCore::FileInputType::filesChosen): Updated for function name change.
3246         (WebCore::FileInputType::iconLoaded): Renamed from updateRendering.
3247         Changed argument to RefPtr&& from PassRefPtr.
3248         (WebCore::FileInputType::defaultToolTip): Got rid of unneeded local variable
3249         and used the correct type, unsigned, rather than size_t.
3250         * html/FileInputType.h: Updated for the above changes, use final instead
3251         of override, and use Ref instead of RefPtr.
3252
3253         * html/HTMLElement.cpp:
3254         (WebCore::HTMLElement::form): Renamed from virtualForm.
3255         * html/HTMLElement.h: Replaced the form/virtualForm pair of functions with
3256         just a form function. The old design dates back before we had "final" for
3257         virtual functions, and now we can just use that instead.
3258
3259         * html/HTMLFormControlElement.cpp:
3260         (WebCore::HTMLFormControlElement::virtualForm): Deleted.
3261         * html/HTMLFormControlElement.h: Mark the form function final, since it's
3262         now both an inline function in this class, and an override of a virtual
3263         function inherited from the base class. Deleted the virtualForm function.
3264
3265         * html/HTMLInputElement.cpp:
3266         (WebCore::HTMLInputElement::defaultEventHandler): Removed use of the
3267         formForSubmission function, which was just another way to get the same
3268         thing as the form function; perhaps they were different in the past.
3269         (WebCore::HTMLInputElement::setFiles): Take a RefPtr&& rather than a PassRefPtr.
3270         * html/HTMLInputElement.h: Updated for the above.
3271
3272         * html/HTMLLabelElement.cpp:
3273         (WebCore::HTMLLabelElement::control): Made this const.
3274         (WebCore::HTMLLabelElement::form): Made this const, so it can be used to
3275         override the const form function from the base class.
3276         * html/HTMLLabelElement.h: Marked the form function final, since we want it
3277         to override the form function inherited from HTMLElement.
3278
3279         * html/HTMLLegendElement.cpp:
3280         (WebCore::HTMLLegendElement::form): Renamed from virtualForm.
3281         * html/HTMLLegendElement.h: Override form instead of virtualForm and mark it final
3282         This makes things more efficient if someone calls form directly on this class;
3283         before it would make an unnecessary virtual function call.
3284
3285         * html/HTMLMediaElement.cpp:
3286         (WebCore::TrackDisplayUpdateScope::TrackDisplayUpdateScope): Take a reference
3287         rather than a pointer.
3288         (WebCore::TrackDisplayUpdateScope::~TrackDisplayUpdateScope): Ditto.
3289         (WebCore::eventTimeCueCompare): Compare the cues the same way the cue list would
3290         rather than using cueIndex.
3291         (WebCore::HTMLMediaElement::audioTrackEnabledChanged): Take a reference.
3292         (WebCore::HTMLMediaElement::textTrackModeChanged): Ditto.
3293         (WebCore::HTMLMediaElement::videoTrackSelectedChanged): Ditto.
3294         (WebCore::HTMLMediaElement::textTrackKindChanged): Ditto.
3295         (WebCore::HTMLMediaElement::textTrackAddCues): Ditto.
3296         (WebCore::HTMLMediaElement::textTrackRemoveCues): Ditto.
3297         (WebCore::HTMLMediaElement::textTrackAddCue): Ditto.
3298         (WebCore::HTMLMediaElement::textTrackRemoveCue): Ditto.
3299         (WebCore::HTMLMediaElement::mediaPlayerDidAddAudioTrack): Pass references.
3300         (WebCore::HTMLMediaElement::mediaPlayerDidAddTextTrack): Ditto.
3301         (WebCore::HTMLMediaElement::mediaPlayerDidAddVideoTrack): Ditto.
3302         (WebCore::HTMLMediaElement::removeTextTrack): Ditto.
3303         (WebCore::HTMLMediaElement::forgetResourceSpecificTracks): Ditto.
3304         (WebCore::HTMLMediaElement::setController): Take a RefPtr&& instead of PassRefPtr.
3305         * html/HTMLMediaElement.h: Updated for above changes.
3306
3307         * html/HTMLObjectElement.cpp:
3308         (WebCore::HTMLObjectElement::virtualForm): Deleted.
3309         * html/HTMLObjectElement.h: Made the form function inline and final, which
3310         achieves the same thing we did before with using, but without requiring the
3311         separate virtualForm function, now deleted.
3312
3313         * html/HTMLOptionElement.cpp:
3314         (WebCore::HTMLOptionElement::collectOptionInnerText): Use isScriptElement
3315         instead of toScriptElementIfPossible.
3316
3317         * html/HTMLPlugInElement.cpp:
3318         (WebCore::HTMLPlugInElement::bindingsInstance): Renamed from getInstance and
3319         changed the return type to a raw pointer.
3320         * html/HTMLPlugInElement.h: Updated for the above changes. Also changed the
3321         updateSnapshot function to take a raw pointer instead of a PassRefPtr.
3322
3323         * html/HTMLPlugInImageElement.cpp:
3324         (WebCore::HTMLPlugInImageElement::createElementRenderer): Pass a pointer
3325         to updateSnapshot.
3326         (WebCore::HTMLPlugInImageElement::updateSnapshot): Updated to take a raw
3327         pointer instead of a PassRefPtr.
3328         * html/HTMLPlugInImageElement.h: Updated for above changes.
3329
3330         * html/HTMLScriptElement.h: Added using to resolve the ambiguity with the
3331         ref/deref from HTMLElement and from ScriptElement.
3332
3333         * html/HTMLTextFormControlElement.cpp:
3334         (WebCore::HTMLTextFormControlElement::selection): Return a RefPtr instead
3335         of a PassRefPtr.
3336         * html/HTMLTextFormControlElement.h: Updated for above changes.
3337
3338         * html/HTMLTrackElement.cpp:
3339         (WebCore::HTMLTrackElement::textTrackKindChanged): Take a reference.
3340         (WebCore::HTMLTrackElement::textTrackModeChanged): Ditto.
3341         (WebCore::HTMLTrackElement::textTrackAddCues): Ditto.
3342         (WebCore::HTMLTrackElement::textTrackRemoveCues): Ditto.
3343         (WebCore::HTMLTrackElement::textTrackAddCue): Ditto.
3344         (WebCore::HTMLTrackElement::textTrackRemoveCue): Ditto.
3345         * html/HTMLTrackElement.h: Updated for above changes.
3346
3347         * html/InputType.cpp:
3348         (WebCore::InputType::formForSubmission): Deleted.
3349         (WebCore::InputType::setFiles): Take a RefPtr&& instead of a PassRefPtr.
3350         * html/InputType.h: Updated for above changes.
3351
3352         * html/PluginDocument.cpp:
3353         (WebCore::PluginDocumentParser::createDocumentStructure): Pass a reference.
3354         (WebCore::PluginDocument::setPluginElement): Take a reference rather than
3355         a PassRefPtr.
3356         * html/PluginDocument.h: Updated for above changes.
3357
3358         * html/canvas/CanvasRenderingContext2D.cpp:
3359         (WebCore::CanvasRenderingContext2D::setStrokeStyle): Pass a reference.
3360         (WebCore::CanvasRenderingContext2D::setFillStyle): Ditto.
3361         (WebCore::CanvasRenderingContext2D::drawTextInternal): Ditto.
3362
3363         * html/canvas/CanvasStyle.cpp:
3364         (WebCore::CanvasStyle::CanvasStyle): Rewrite all constructors to use the
3365         m_style variant instead of separate m_type and other data members. Also
3366         change from PassRefPtr to a reference.
3367         (WebCore::CanvasStyle::createFromString): Update to use the variant.
3368         (WebCore::CanvasStyle::createFromStringWithOverrideAlpha): Ditto.
3369         (WebCore::CanvasStyle::isEquivalentColor): Ditto.
3370         (WebCore::CanvasStyle::isEquivalentRGBA): Ditto.
3371         (WebCore::CanvasStyle::isEquivalentCMYKA): Ditto.
3372         (WebCore::CanvasStyle::CanvasStyle): Deleted copy constructor; the compiler
3373         can now generate a correct copy or move constructor.
3374         (WebCore::CanvasStyle::~CanvasStyle): Deleted. Compiler generates this
3375         properly now without help from us.
3376         (WebCore::CanvasStyle::operator=): Deleted. The compiler can now generate
3377         a correct copy of move assignment operator.
3378         (WebCore::CanvasStyle::applyStrokeColor): Updated to take a reference and
3379         use the variant.
3380         (WebCore::CanvasStyle::applyFillColor): Ditto.
3381
3382         * html/canvas/CanvasStyle.h: Redid this class to use a variant instead of
3383         a type enumeration and a union.
3384
3385         * html/canvas/OESVertexArrayObject.cpp: