[TextureMapper] TextureMapperPlatformLayerProxy::swapBuffers() should hold the lock...
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2017-01-10  Zan Dobersek  <zdobersek@igalia.com>
2
3         [TextureMapper] TextureMapperPlatformLayerProxy::swapBuffers() should hold the lock throughout invocation
4         https://bugs.webkit.org/show_bug.cgi?id=166852
5
6         Reviewed by Michael Catanzaro.
7
8         * platform/graphics/texmap/TextureMapperPlatformLayerProxy.cpp:
9         (WebCore::TextureMapperPlatformLayerProxy::swapBuffer): Append to previous buffer
10         to the m_usedBuffers Vector while the object's lock is held. Everywhere else the
11         m_usedBuffers Vector is used under the lock, no reason to not do the same here.
12
13 2017-01-09  Yusuke Suzuki  <utatane.tea@gmail.com>
14
15         Implement JSSourceCode to propagate SourceCode in module pipeline
16         https://bugs.webkit.org/show_bug.cgi?id=166861
17
18         Reviewed by Saam Barati.
19
20         Now SourceOrigin is correctly propagated through the module pipeline.
21         So the error reported by http/tests/security/contentSecurityPolicy/module-eval-blocked-expected.html
22         is updated.
23
24         * ForwardingHeaders/runtime/JSSourceCode.h: Added.
25         * bindings/js/JSDOMPromise.h:
26         (WebCore::DeferredPromise::resolveWithCallback):
27         * bindings/js/ScriptModuleLoader.cpp:
28         (WebCore::ScriptModuleLoader::notifyFinished):
29
30 2017-01-09  Chris Dumez  <cdumez@apple.com>
31
32         REGRESSION(r189555): ImageDocument title no longer includes the size of the image
33         https://bugs.webkit.org/show_bug.cgi?id=166876
34         <rdar://problem/29939970>
35
36         Reviewed by Tim Horton.
37
38         ImageDocument title no longer included the size of the image after r189555.
39         This is because Document::setTitle() is a no-op if the document does not
40         have a <head> element. To address the issue, we now include a <head>
41         element in ImageDocuments so that their title element properly gets added
42         to it.
43
44         Test: fast/images/imageDocument-title.html
45
46         * html/ImageDocument.cpp:
47         (WebCore::ImageDocument::createDocumentStructure):
48
49 2017-01-09  Zalan Bujtas  <zalan@apple.com>
50
51         ASSERTION FAILED: newLogicalTop >= logicalTop in WebCore::RenderBlockFlow::getClearDelta
52         https://bugs.webkit.org/show_bug.cgi?id=151202
53         <rdar://problem/27711822>
54
55         Reviewed by Myles C. Maxfield.
56
57         FindNextFloatLogicalBottomAdapter uses LayoutUnit::max() to flag m_nextLogicalBottom uninitialized.        
58         However LayoutUnit::max() can also be a valid value for m_nextLogicalBottom.
59         FindNextFloatLogicalBottomAdapter::nextLogicalBottom() returns 0 instead of the actual value when
60         it sees m_nextLogicalBottom uninitialized. In certain cases, it confuses the caller and we end up
61         with a runaway loop.
62
63         Test: fast/block/float/assert-when-line-has-not-enough-space-left.html
64
65         * rendering/FloatingObjects.cpp:
66         (WebCore::FindNextFloatLogicalBottomAdapter::FindNextFloatLogicalBottomAdapter):
67         (WebCore::FindNextFloatLogicalBottomAdapter::highValue):
68         (WebCore::FindNextFloatLogicalBottomAdapter::nextLogicalBottom):
69         (WebCore::FindNextFloatLogicalBottomAdapter::nextShapeLogicalBottom):
70         (WebCore::FindNextFloatLogicalBottomAdapter::collectIfNeeded):
71
72 2017-01-09  Ryan Haddad  <ryanhaddad@apple.com>
73
74         Unreviewed, rolling out r210531.
75
76         This change broke the 32-bit macOS build and caused LayoutTest
77         failures.
78
79         Reverted changeset:
80
81         "File scheme should not allow access of a resource on a
82         different volume."
83         https://bugs.webkit.org/show_bug.cgi?id=158552
84         http://trac.webkit.org/changeset/210531
85
86 2017-01-09  Chris Dumez  <cdumez@apple.com>
87
88         [iOS] Drop VNodeTracker
89         https://bugs.webkit.org/show_bug.cgi?id=166868
90         <rdar://problem/29937587>
91
92         Reviewed by Andreas Kling.
93
94         Drop VNodeTracker on iOS. This was introduced a while back to try and
95         address vnode exhaustion issues in long running page load tests.
96         However, there was no evidence that the VNodeTracker functionality
97         helped so there is little point in keeping the extra code complexity.
98
99         * WebCore.xcodeproj/project.pbxproj:
100         * platform/SharedBuffer.h:
101         * platform/VNodeTracker.cpp: Removed.
102         * platform/VNodeTracker.h: Removed.
103         * platform/cf/SharedBufferCF.cpp:
104         (WebCore::SharedBuffer::SharedBuffer):
105         * platform/cocoa/VNodeTrackerCocoa.cpp: Removed.
106
107 2017-01-09  Brent Fulgham  <bfulgham@apple.com>
108
109         File scheme should not allow access of a resource on a different volume.
110         https://bugs.webkit.org/show_bug.cgi?id=158552
111         <rdar://problem/15307582>
112
113         Reviewed by Alex Christensen.
114
115         Revise SecurityOrigin to prevent files from one storage device (volume) from accessing content
116         on a different storage device (volume) unless universal access is enabled.
117
118         Pass the current file device as part of the NSURLRequest so that CFNetwork can reject loads
119         where the device changes in the midst of a load.
120
121         Also properly reflect that SecurityOrigin is never null by passing as a reference,
122         rather than as a pointer.
123
124         Tests: Tools/TestWebKitAPI/Tests/mac/CrossPartitionFileSchemeAccess.mm
125
126         * page/SecurityOrigin.cpp:
127         (WebCore::SecurityOrigin::canAccess): Pass argument as reference.
128         (WebCore::SecurityOrigin::passesFileCheck): Add check that file URLs refer to files in
129         the same storage volume.
130         (WebCore::SecurityOrigin::canDisplay): Add check that files share the same volume.
131         (WebCore::SecurityOrigin::isSameSchemeHostPort): Pass argument as reference.
132         * page/SecurityOrigin.h:
133         * platform/FileSystem.cpp:
134         (WebCore::filesHaveSameVolume): Added.
135         * platform/FileSystem.h:
136         * platform/network/cocoa/ResourceRequestCocoa.mm:
137         (WebCore::ResourceRequest::doUpdatePlatformRequest): If loading a file URL, tell CFNetwork
138         the storage device at the time of the start of the load so we can trigger a failure if this
139         changes during the load operation.
140         * platform/posix/FileSystemPOSIX.cpp:
141         (WebCore::getFileDeviceId): Added.
142         * platform/win/FileSystemWin.cpp:
143         (WebCore::getFileDeviceId): Added.
144
145 2017-01-09  Tim Horton  <timothy_horton@apple.com>
146
147         Unindenting text inside a blockquote can result in the text being reordered
148         https://bugs.webkit.org/show_bug.cgi?id=166813
149
150         Reviewed by Darin Adler and Ryosuke Niwa.
151
152         Test: editing/execCommand/unindent-nested-blockquote-with-inner-div.html
153
154         * editing/IndentOutdentCommand.cpp:
155         (WebCore::IndentOutdentCommand::outdentParagraph):
156         Start splitting the tree at the beginning of the content being unindented,
157         not at the containing block flow element, which could e.g. contain other
158         elements (or even other blockquotes).
159
160 2017-01-09  Yusuke Suzuki  <utatane.tea@gmail.com>
161
162         [JSC] Prototype dynamic-import
163         https://bugs.webkit.org/show_bug.cgi?id=165724
164
165         Reviewed by Saam Barati.
166
167         We do not set a handler for import for now.
168         So dynamic import feature is only enabled in the JSC shell right now.
169
170         * bindings/js/JSDOMWindowBase.cpp:
171         * bindings/js/JSWorkerGlobalScopeBase.cpp:
172
173 2017-01-09  Youenn Fablet  <youennf@gmail.com>
174
175         Merging ThreadableLoader redundant options on filtering responses
176
177         Merge OpaqueResponseBodyPolicy and ResponseFilteringPolicy ThreadableLoader options
178         https://bugs.webkit.org/show_bug.cgi?id=166843
179
180         Reviewed by Darin Adler.
181
182         Covered by existing tests.
183
184         Removing OpaqueResponseBodyPolicy option.
185         When ResponseFilteringPolicy is set to Enable, the body is filtered out in DocumentThreadableLoader.
186
187         * Modules/fetch/FetchLoader.cpp:
188         (WebCore::FetchLoader::start):
189         * loader/DocumentThreadableLoader.cpp:
190         (WebCore::DocumentThreadableLoader::didReceiveResponse): Implementing body filtering based on ResponseFilteringPolicy option.
191         * loader/ThreadableLoader.cpp:
192         (WebCore::ThreadableLoaderOptions::ThreadableLoaderOptions):
193         * loader/ThreadableLoader.h:
194         * loader/WorkerThreadableLoader.cpp:
195         (WebCore::LoaderTaskOptions::LoaderTaskOptions):
196         * workers/WorkerScriptLoader.cpp:
197         (WebCore::WorkerScriptLoader::loadSynchronously):
198         (WebCore::WorkerScriptLoader::loadAsynchronously):
199         * xml/XMLHttpRequest.cpp:
200         (WebCore::XMLHttpRequest::createRequest):
201
202 2017-01-09  Daniel Bates  <dabates@apple.com>
203
204         Evaluating window named element may return wrong result
205         https://bugs.webkit.org/show_bug.cgi?id=166792
206         <rdar://problem/29801059>
207
208         Reviewed by Chris Dumez.
209
210         * bindings/js/JSDOMWindowProperties.cpp:
211         (WebCore::jsDOMWindowPropertiesGetOwnPropertySlotNamedItemGetter):
212
213 2017-01-09  Chris Dumez  <cdumez@apple.com>
214
215         REGRESSION(r178955): Touching Settings.in doesn't cause JSInternalSettingsGenerated.cpp to be updated on first build
216         https://bugs.webkit.org/show_bug.cgi?id=166814
217
218         Reviewed by Darin Adler.
219
220         Stop using .INTERMEDIATE in DerivedSources.make was it seems to break dependency
221         chains for some reason. We started using .INTERMEDIATE for scripts that generate
222         several targets when run a single time. It avoided running the script several
223         times (once per target) unnecessarily, and fixed issues with parallel builds.
224
225         To address the same issue without using .INTERMEDIATE, we now use pattern rules
226         (i.e. rules that have '%'). As per the documentation [1]:
227         "Pattern rules may have more than one target. Unlike normal rules, this does not
228          act as many different rules with the same prerequisites and recipe. If a pattern
229          rule has multiple targets, make knows that the rule’s recipe is responsible for
230          making all of the targets. The recipe is executed only once to make all the
231          targets".
232
233          We are therefore solving the same problem as with .INTERMEDIATE. However, I have
234          confirmed that using pattern rules does not break dependency chains. For example,
235          modifying Settings.in re-generates both InternalSettingsGenerated.idl *and*
236          JSInternalSettingsGenerated.cpp.
237
238          [1] https://www.gnu.org/software/make/manual/html_node/Pattern-Intro.html#Pattern-Intro
239
240         * DerivedSources.make:
241
242 2017-01-09  Commit Queue  <commit-queue@webkit.org>
243
244         Unreviewed, rolling out r210493 and r210495.
245         https://bugs.webkit.org/show_bug.cgi?id=166842
246
247         Causes makeprops.pl to run on every build (Requested by smfr
248         on #webkit).
249
250         Reverted changesets:
251
252         "Avoid triggering rebuilds for minor changes of
253         CSSProperties.json"
254         https://bugs.webkit.org/show_bug.cgi?id=166810
255         http://trac.webkit.org/changeset/210493
256
257         "Avoid triggering rebuilds for minor changes of
258         CSSProperties.json"
259         https://bugs.webkit.org/show_bug.cgi?id=166810
260         http://trac.webkit.org/changeset/210495
261
262 2017-01-06  Gustavo Noronha Silva  <gustavo.noronha@collabora.co.uk>
263
264         [GTK] Should support key and code properties on keyboard events
265         https://bugs.webkit.org/show_bug.cgi?id=166759
266
267         Reviewed by Carlos Garcia Campos.
268
269         This change fixes a bunch of tests which are currently failing, such as:
270         - fast/events/arrow-keys-on-body.html
271         - fast/events/constructors/keyboard-event-constructor.html
272         - fast/events/key-events-in-input-button.html
273         - fast/events/key-events-in-input-text.html
274         - fast/events/keyboardevent-code.html
275         - fast/events/keyboardevent-key.html
276
277         * platform/PlatformKeyboardEvent.h:
278         * platform/gtk/PlatformKeyboardEventGtk.cpp:
279         (WebCore::PlatformKeyboardEvent::keyValueForGdkKeyCode): match web key value
280         to GDK key symbol.
281         (WebCore::PlatformKeyboardEvent::keyCodeForHardwareKeyCode): match web key code
282         to hardware code as reported by GDK.
283         (WebCore::PlatformKeyboardEvent::PlatformKeyboardEvent): add web key value and
284         code to the keyboard event upon creation.
285
286 2017-01-09  Carlos Garcia Campos  <cgarcia@igalia.com>
287
288         [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
289         https://bugs.webkit.org/show_bug.cgi?id=165848
290
291         Reviewed by Michael Catanzaro.
292
293         In r208881 several locks were added to ImageDecoder to prevent frameBufferAtIndex() from being called by multiple
294         threads at the same time, but I forgot isSizeAvailable() also calls frameBufferAtIndex(). However, what we
295         really need to protect is the GIFImageDecoder, to never allow decoding from more than one thread at the same
296         time. This patch reverts r208881 and adds a lock to GIFImageDecoder::decode() instead.
297
298         * platform/image-decoders/ImageDecoder.cpp:
299         (WebCore::ImageDecoder::frameIsCompleteAtIndex):
300         (WebCore::ImageDecoder::frameDurationAtIndex):
301         (WebCore::ImageDecoder::createFrameImageAtIndex):
302         * platform/image-decoders/ImageDecoder.h:
303         * platform/image-decoders/gif/GIFImageDecoder.cpp:
304         (WebCore::GIFImageDecoder::decode):
305         * platform/image-decoders/gif/GIFImageDecoder.h:
306
307 2017-01-09  Alejandro G. Castro  <alex@igalia.com>
308
309         [OWR] Unskip fast/mediastream/MediaStream-video-element-track-stop.html
310         https://bugs.webkit.org/show_bug.cgi?id=165316
311
312         Reviewed by Philippe Normand.
313
314         Fixed the ended support of the video element in the OWR player and
315         fixed the videoTracks support. Now the OW player properly adds and
316         removes the audio and video tracks. Added the getSettings support
317         to the mediastream interface. Solved also the size handling in
318         some of the enable/muted situations.
319
320         Unskipping fast/mediastream/MediaStream-video-element-track-stop.html.
321
322         * platform/GStreamer.cmake: Added the new
323         RealtimeMediaSourceOwr.cpp with the new code handling the
324         settings.
325         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerOwr.cpp:
326         (WebCore::MediaPlayerPrivateGStreamerOwr::~MediaPlayerPrivateGStreamerOwr):
327         Release the new video and audio maps that creates a relationship
328         of the mediastream tracks with the mediatracks of the video element.
329         (WebCore::MediaPlayerPrivateGStreamerOwr::play): Set ended to
330         false when we start playing.
331         (WebCore::MediaPlayerPrivateGStreamerOwr::load): Create the media
332         tracks to the player so that the videoTracks API returns it, and
333         add an entry in the map to be able to restore it using the
334         mediastream track.
335         (WebCore::MediaPlayerPrivateGStreamerOwr::disableMediaTracks):
336         Move some part of the stop function to this one in order to use it
337         in pause method and avoid changing the video selection in that
338         case.
339         (WebCore::MediaPlayerPrivateGStreamerOwr::stop): Now we call the
340         function disableMediaTracks and we also change teh selected
341         videoTrack.
342         (WebCore::MediaPlayerPrivateGStreamerOwr::trackEnded): For
343         videoTrack reset the size and the selected element. In case there
344         is no media playing we Make sure we set the ended variable to true
345         and call the timeChange to modify the state of the player.
346         (WebCore::MediaPlayerPrivateGStreamerOwr::trackEnabledChanged):
347         Handle properly the situation when the user changed the enabled
348         value, we disable the media.
349         (WebCore::MediaPlayerPrivateGStreamerOwr::setSize): Modify the
350         size of the source.
351         (WebCore::MediaPlayerPrivateGStreamerOwr::naturalSize): Overrided
352         to make sure we return a size even when the sample is not ready
353         for gst.
354         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerOwr.h:
355         Added the ended attribute and the maps.
356         * platform/mediastream/openwebrtc/MediaEndpointOwr.cpp:
357         (WebCore::MediaEndpointOwr::createMutedRemoteSource): Use the new
358         realtime video and audio sources classes, this new classes
359         implement the settings of each type of media element.
360         * platform/mediastream/openwebrtc/RealtimeMediaSourceCenterOwr.cpp:
361         (WebCore::RealtimeMediaSourceCenterOwr::mediaSourcesAvailable):
362         Use the new audio and video source classes instead of the general
363         one in order to handle the settings properly.
364         * platform/mediastream/openwebrtc/RealtimeMediaSourceOwr.cpp: Added
365         (WebCore::RealtimeMediaSourceOwr::settings): Initialize using the
366         subclass and return the new currentSettings attribute.
367         (WebCore::RealtimeMediaSourceOwr::supportedConstraints): Call the
368         subclass initialization of the supportedSettings.
369         * platform/mediastream/openwebrtc/RealtimeMediaSourceOwr.h:
370         (WebCore::RealtimeMediaSourceOwr::initializeSettings): Added to
371         initialize the settings before returning the value. Implemented in
372         the subclass.
373         (WebCore::RealtimeMediaSourceOwr::initializeSupportedConstraints):
374         Added to initialize the supported settings of the
375         media. Implemented in the subclass.
376         (WebCore::RealtimeMediaSourceOwr::settings): Moved to the cpp
377         file, implemented using the initialize functions of the subclass
378         * platform/mediastream/openwebrtc/RealtimeVideoSourceOwr.h: Added
379         this new class to handle the settings of the video elements. The
380         class initializes the settings and the supportedSettings.
381         * platform/mediastream/openwebrtc/RealtimeAudioSourceOwr.h: Added
382         this new class to handle the settings of the audio elements. The
383         class initializes the settings and the supportedSettings.
384
385
386 2017-01-08  Konstantin Tokarev  <annulen@yandex.ru>
387
388         Introduce CPU(X86_SSE2) instead of various SSE2 checks
389         https://bugs.webkit.org/show_bug.cgi?id=166808
390
391         Reviewed by Michael Catanzaro.
392
393         Now copyLCharsFromUCharSource can use SSE2 implementation on non-Darwin
394         OSes, and all SSE2 code paths are available for MSVC on x86 if /arch:SSE2
395         or higher is enabled, and for MSVC on x86_64.
396
397         No new tests needed.
398
399         * platform/audio/SincResampler.cpp:
400         (WebCore::SincResampler::process):
401         * platform/audio/VectorMath.cpp:
402         (WebCore::VectorMath::vsma):
403         (WebCore::VectorMath::vsmul):
404         (WebCore::VectorMath::vadd):
405         (WebCore::VectorMath::vmul):
406         (WebCore::VectorMath::zvmul):
407         (WebCore::VectorMath::vsvesq):
408         (WebCore::VectorMath::vmaxmgv):
409
410 2017-01-07  Simon Fraser  <simon.fraser@apple.com>
411
412         Avoid triggering rebuilds for minor changes of CSSProperties.json
413         https://bugs.webkit.org/show_bug.cgi?id=166810
414
415         Post-review cleanup suggested by Darin Adler.
416
417         * css/makeprop.pl:
418
419 2017-01-07  Simon Fraser  <simon.fraser@apple.com>
420
421         Avoid triggering rebuilds for minor changes of CSSProperties.json
422         https://bugs.webkit.org/show_bug.cgi?id=166810
423
424         Reviewed by Daniel Bates.
425
426         We expect to make lots of metadata-related changes to CSSProperties.json, and
427         these should not trigger rebuilds.
428         
429         Have makeprop.pl write to temporary files first, then only replace the generated
430         files if the contents differ.
431
432         * css/makeprop.pl:
433         (replaceFileIfChanged):
434
435 2017-01-06  Darin Adler  <darin@apple.com>
436
437         Remove PassRefPtr use from "inspector", "platform/sql", and "platform/text"
438         https://bugs.webkit.org/show_bug.cgi?id=166797
439
440         Reviewed by Alex Christensen.
441
442         * Modules/webdatabase/Database.cpp:
443         (WebCore::Database::performOpenAndVerify): Pass a reference instead of a pointer.
444
445         * dom/Document.cpp:
446         (WebCore::canonicalizedTitle): Map backslashes to currency symbols inside the
447         existing loop through the characters instead of calling a function confusingly
448         named "displayBuffer" to do it. More straightforward, possibly more efficient,
449         one less function.
450         (WebCore::Document::displayStringModifiedByEncoding): Call replace to map
451         backslashes to currency symbols instead of calling a special displayString
452         function. There was no real benefit to using that function; the String::replace
453         function has all the same optimizations, and this was also the only call site.
454
455         * editing/SpellChecker.cpp:
456         (WebCore::SpellChecker::invokeRequest): Pass a reference instead of a pointer.
457
458         * inspector/InspectorOverlay.cpp:
459         (WebCore::InspectorOverlay::overlayPage): Call createEmptyEditorClient instead
460         of using the class EmptyEditorClient directly.
461
462         * loader/EmptyClients.cpp: Moved most of the empty clients here from the header.
463         Also made lots more things private.
464         (WebCore::createEmptyEditorClient): Added.
465         (WebCore::emptyDiagnosticLoggingClient): Added.
466         * loader/EmptyClients.h: Updated for above changes. Made more things private.
467
468         * page/DatabaseProvider.h: Removed unneeded include.
469         * page/MainFrame.cpp: Ditto.
470
471         * page/Page.cpp:
472         (WebCore::Page::diagnosticLoggingClient): Call emptyDiagnosticLoggingClient
473         instead of using the class EmptyDiagnosticLoggingClient directly.
474
475         * platform/sql/SQLiteDatabase.cpp:
476         (WebCore::SQLiteDatabase::setAuthorizer): Take a reference instead of a
477         PassRefPtr.
478         * platform/sql/SQLiteDatabase.h: Updated for above.
479
480         * platform/text/BidiContext.cpp:
481         (WebCore::BidiContext::BidiContext): Moved this function here from the header.
482         (WebCore::copyContextAndRebaselineLevel): Return a Ref instead of a PassRefPtr,
483         and take a reference rather than a raw pointer.
484         (WebCore::BidiContext::copyStackRemovingUnicodeEmbeddingContexts): Return a
485         Ref instead of a PassRefPtr.
486         * platform/text/BidiContext.h: Updated for the above changes.
487
488         * platform/text/BidiResolver.h: Simplify initialization, use more references,
489         auto, modern for loops, refer to derived class as that rather than the non-C++
490         term subclass.
491
492         * platform/text/TextCheckerClient.h: Changd argument from PassRefPtr to a
493         reference.
494
495         * platform/text/TextEncoding.h:
496         (WebCore::TextEncoding::displayString): Deleted.
497         (WebCore::TextEncoding::displayBuffer): Deleted.
498
499         * rendering/RootInlineBox.cpp: Style tweaks and use a modern for loop.
500
501         * svg/graphics/SVGImage.cpp:
502         (WebCore::SVGImage::dataChanged): Call createEmptyEditorClient instead
503         of using the class EmptyEditorClient directly.
504
505 2017-01-07  Andy Estes  <aestes@apple.com>
506
507         [QuickLook] Update quicklook test expectations
508         https://bugs.webkit.org/show_bug.cgi?id=166798
509         <rdar://problem/26477735>
510
511         Reviewed by Alex Christensen.
512
513         QuickLook uses UUIDs to generate x-apple-ql-id: URLs, so they will differ each time a
514         document is previewed. Since these URLs are included in QuickLook layout test results,
515         WebArchiveDumpSupport needs to replace them with predictable values when dumping a web
516         archive.
517
518         * testing/cocoa/WebArchiveDumpSupport.mm:
519         (WebCoreTestSupport::quickLookURLReplacements): Created a static Vector of CFStringRef pairs
520         to store x-apple-ql-id: URLs and their replacement values.
521         (WebCoreTestSupport::normalizeWebResourceURL): If the URL starts with “x-apple-ql-id://”,
522         replace the text between the scheme and the file extension with “resource”. Store the
523         original URL along with its replacement in quickLookURLReplacements().
524         (WebCoreTestSupport::createXMLStringFromWebArchiveData): Replaced all QuickLook URLs in the
525         final XML text with their replacement URLs. 
526
527 2017-01-07  Andy Estes  <aestes@apple.com>
528
529         [QuickLook] Consolidate usage of QuickLookHandle into SubresourceLoader
530         https://bugs.webkit.org/show_bug.cgi?id=166713
531
532         Reviewed by Alex Christensen.
533
534         QuickLook conversion was originally implemented by intercepting document loads at the
535         ResourceHandle level, with separate paths for NSURLConnection and CFURLConnection handles.
536         When QuickLook was ported to WebKit2, a third path was added in WebResourceLoader.
537         
538         This change removes these three separate paths and implements a single conversion path in
539         SubresourceLoader, where QuickLook can intercept document loads regardless of the networking
540         API being used.
541
542         No change in behavior. Covered by existing tests.
543
544         * loader/ResourceLoader.h: Removed override from didCreateQuickLookHandle() since this
545         function is no longer declared in ResourceHandleClient.
546         * loader/SubresourceLoader.cpp:
547         (WebCore::SubresourceLoader::shouldCreateQuickLookHandleForResponse): Added a helper
548         function to check if a QuickLookHandle should be created for a response.
549         (WebCore::SubresourceLoader::didReceiveResponse): Created a QuickLookHandle if necessary
550         and stored it in the DocumentLoader.
551         (WebCore::SubresourceLoader::didReceiveData): If there is a QuickLookHandle, call
552         QuickLookHandle::didReceiveBuffer(), and return early if QuickLook is converting.
553         (WebCore::SubresourceLoader::didReceiveBuffer): Ditto for QuickLookHandle::didReceiveBuffer().
554         (WebCore::SubresourceLoader::didFinishLoading): Ditto for QuickLookHandle::didFinishLoading().
555         (WebCore::SubresourceLoader::didFail): If there is a QuickLookHandle, call QuickLookHandle::didFail().
556         * loader/SubresourceLoader.h: Declared shouldCreateQuickLookHandleForResponse().
557         * loader/ios/QuickLook.h: Removed declarations used by the ResourceHandles and declared new
558         functions used by SubresourceLoader.
559         * loader/ios/QuickLook.mm:
560         (WebCore::QuickLookHandle::QuickLookHandle): Removed the NSURLConnection * parameter, since
561         we’d now always pass nil.
562         (WebCore::QuickLookHandle::create): Removed create() functions used by ResourceHandles.
563         (WebCore::QuickLookHandle::didReceiveData): Added. Copies the data into an NSData, wraps it
564         in an NSArray, and passes it to didReceiveDataArray().
565         (WebCore::QuickLookHandle::didReceiveBuffer): Added. Creates a NSArray of NSData from the
566         SharedBuffer and passes it to didReceiveDataArray().
567         (-[WebQuickLookHandleAsDelegate initWithConnectionDelegate:]): Deleted.
568         (-[WebQuickLookHandleAsDelegate connection:didReceiveDataArray:]): Deleted.
569         (-[WebQuickLookHandleAsDelegate connection:didReceiveData:lengthReceived:]): Deleted.
570         (-[WebQuickLookHandleAsDelegate connectionDidFinishLoading:]): Deleted.
571         (-[WebQuickLookHandleAsDelegate connection:didFailWithError:]): Deleted.
572         (-[WebQuickLookHandleAsDelegate detachHandle]): Deleted.
573         (WebCore::QuickLookHandle::cfResponse): Deleted.
574         (WebCore::QuickLookHandle::didReceiveDataArray): Passed dataArray to m_converter and m_client.
575         * platform/SharedBuffer.h: Const-qualified createNSDataArray().
576         * platform/cocoa/SharedBufferCocoa.mm:
577         (WebCore::SharedBuffer::createNSDataArray): Ditto.
578         * platform/network/ResourceHandle.cpp: Stopped including QuickLook.h.
579         * platform/network/ResourceHandle.h: Removed m_quickLook.
580         (WebCore::ResourceHandle::quickLookHandle): Deleted.
581         * platform/network/ResourceHandleClient.h:
582         (WebCore::ResourceHandleClient::didCreateQuickLookHandle): Deleted.
583         * platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.cpp:
584         (WebCore::SynchronousResourceHandleCFURLConnectionDelegate::didReceiveResponse): Removed QuickLook code.
585         (WebCore::SynchronousResourceHandleCFURLConnectionDelegate::didReceiveData): Ditto.
586         (WebCore::SynchronousResourceHandleCFURLConnectionDelegate::didFinishLoading): Ditto.
587         (WebCore::SynchronousResourceHandleCFURLConnectionDelegate::didFail): Ditto.
588         (WebCore::SynchronousResourceHandleCFURLConnectionDelegate::didReceiveDataArray): Ditto.
589         * platform/network/mac/ResourceHandleMac.mm:
590         (WebCore::ResourceHandle::setQuickLookHandle): Deleted.
591         * platform/network/mac/WebCoreResourceHandleAsDelegate.mm:
592         (-[WebCoreResourceHandleAsDelegate connection:didReceiveResponse:]): Removed QuickLook code.
593         (-[WebCoreResourceHandleAsDelegate connection:didReceiveDataArray:]): Ditto.
594         (-[WebCoreResourceHandleAsDelegate connection:didReceiveData:lengthReceived:]): Ditto.
595         (-[WebCoreResourceHandleAsDelegate connectionDidFinishLoading:]): Ditto.
596         (-[WebCoreResourceHandleAsDelegate connection:didFailWithError:]): Ditto.
597
598 2017-01-06  Daniel Bates  <dabates@apple.com>
599
600         Ensure navigation only allowed for documents not in the page cache
601         https://bugs.webkit.org/show_bug.cgi?id=166773
602         <rdar://problem/29762809>
603
604         Reviewed by Brent Fulgham.
605
606         It is wise to ensure that navigation is only allowed when initiated from a document that
607         is not in- or about to be put in- the page cache. Such a navigation would surprise a
608         person that had navigated away from the initiating document among other issues.
609
610         * dom/Document.cpp:
611         (WebCore::Document::canNavigate): Only allow navigation if the document is not in the
612         page cache.
613         * html/HTMLAnchorElement.cpp:
614         (WebCore::HTMLAnchorElement::handleClick): Ditto.
615         * html/HTMLLinkElement.cpp:
616         (WebCore::HTMLLinkElement::handleClick): Ditto.
617         * loader/FrameLoader.cpp:
618         (WebCore::FrameLoader::urlSelected): Assert triggering event's document is not in the
619         page cache.
620         (WebCore::FrameLoader::submitForm): Allow submission if the document is not in the
621         page cache.
622         (WebCore::FrameLoader::loadFrameRequest): Assert triggering event's document is not in
623         the page cache.
624         * mathml/MathMLElement.cpp:
625         (WebCore::MathMLElement::defaultEventHandler): Only allow navigation if the document is
626         not in the page cache.
627         * svg/SVGAElement.cpp:
628         (WebCore::SVGAElement::defaultEventHandler): Ditto.
629
630 2017-01-06  Jer Noble  <jer.noble@apple.com>
631
632         Crash in WebCore::MediaPlayerPrivateMediaSourceAVFObjC::sizeWillChangeAtTime(const MediaTime&, const FloatSize&)::block_invoke
633         https://bugs.webkit.org/show_bug.cgi?id=166738
634
635         Reviewed by Eric Carlson.
636
637         AVFoundation can potentially call the same boundary time observer multiple times, and
638         in that case, it's possible that the observer queue will be empty when we attempt
639         to remove the first item from the queue. There's an ASSERT() in Deque for this case,
640         but we need to explicitly protect against this case.
641
642         Drive-by fix: Explicitly unregister the observer before releasing it.
643
644         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
645         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::sizeWillChangeAtTime):
646
647 2017-01-06  Joseph Pecoraro  <pecoraro@apple.com>
648
649         REGRESSION(r208886) Web Inspector: Toggling CSS Properties in Styles Sidebar (comment / uncomment)
650         https://bugs.webkit.org/show_bug.cgi?id=166786
651         <rdar://problem/29767412>
652
653         Reviewed by Brian Burg.
654
655         * inspector/InspectorStyleSheet.cpp:
656         (WebCore::InspectorStyle::populateAllProperties):
657         Match earlier behavior and don't send the frontend information about
658         disabled (commented out) properties. Follow-up later to send this
659         information when implementing proper handling of them in the frontend.
660
661 2017-01-06  Sam Weinig  <sam@webkit.org>
662
663         [WebIDL] Remove custom bindings from CanvasRenderingContext2D
664         https://bugs.webkit.org/show_bug.cgi?id=166793
665
666         Reviewed by Darin Adler.
667
668         * WebCore.xcodeproj/project.pbxproj:
669         Move JSCanvasRenderingContext2DCustom.cpp to the GC only group.
670
671         * bindings/js/JSCanvasRenderingContext2DCustom.cpp:
672         (WebCore::toJS): Deleted.
673         (WebCore::toHTMLCanvasStyle): Deleted.
674         (WebCore::JSCanvasRenderingContext2D::strokeStyle): Deleted.
675         (WebCore::JSCanvasRenderingContext2D::setStrokeStyle): Deleted.
676         (WebCore::JSCanvasRenderingContext2D::fillStyle): Deleted.
677         (WebCore::JSCanvasRenderingContext2D::setFillStyle): Deleted.
678         Remove non-GC related custom bindings.
679
680         * html/canvas/CanvasRenderingContext2D.cpp:
681         (WebCore::CanvasRenderingContext2D::setStrokeStyle):
682         (WebCore::CanvasRenderingContext2D::setFillStyle):
683         (WebCore::toStyle):
684         (WebCore::CanvasRenderingContext2D::strokeStyle):
685         (WebCore::CanvasRenderingContext2D::fillStyle):
686         * html/canvas/CanvasRenderingContext2D.h:
687         * html/canvas/CanvasRenderingContext2D.idl:
688         Made existing setStrokeStyle/setFillStyle functions (which take CanvasStyle's) 
689         private, and implemented new ones that operate on Variants, matching the spec.
690
691 2017-01-05  Darin Adler  <darin@apple.com>
692
693         Remove PassRefPtr use from "rendering" directory, other improvements
694         https://bugs.webkit.org/show_bug.cgi?id=166717
695
696         Reviewed by Sam Weinig.
697
698         * css/CSSComputedStyleDeclaration.cpp:
699         (WebCore::shapePropertyValue): Use auto.
700         * css/CSSFilterImageValue.cpp:
701         (WebCore::CSSFilterImageValue::image): Use auto. Pass references.
702         (WebCore::CSSFilterImageValue::filterImageChanged): Use modern for loop.
703
704         * css/StyleBuilderConverter.h:
705         (WebCore::StyleBuilderConverter::convertShapeValue): Use overloaded
706         ShapeValue::create function instead of differently named functions.
707         * page/animation/CSSPropertyAnimation.cpp:
708         (WebCore::blendFunc): Ditto.
709
710         * platform/graphics/filters/Filter.h: Added a protected constructor that takes
711         a filter resolution.
712
713         * rendering/FilterEffectRenderer.cpp:
714         (WebCore::FilterEffectRenderer::FilterEffectRenderer): Use new constructor so
715         we don't have to call setFilterResolution and can initialize m_sourceGraphic.
716         (WebCore::FilterEffectRenderer::create): Moved here from the header.
717         (WebCore::FilterEffectRenderer::buildReferenceFilter): Take references and not
718         PssRefPtr. Use auto and references.
719         (WebCore::FilterEffectRenderer::build): Take a reference. Updated to work with
720         references rather than pointer. Use auto.
721         (WebCore::FilterEffectRenderer::allocateBackingStoreIfNeeded): Use early return.
722         (WebCore::FilterEffectRenderer::clearIntermediateResults): Use modern for loop.
723         (WebCore::FilterEffectRenderer::apply): Use references.
724         (WebCore::FilterEffectRenderer::output): Moved here from header.
725         (WebCore::FilterEffectRenderer::setMaxEffectRects): Moved here from header.
726         (WebCore::FilterEffectRenderer::outputRect): Moved here from header.
727         (WebCore::FilterEffectRendererHelper::prepareFilterEffect): Take references.
728         (WebCore::FilterEffectRendererHelper::beginFilterEffect): Use auto and references.
729         (WebCore::FilterEffectRendererHelper::applyFilterEffect): Ditto.
730         * rendering/FilterEffectRenderer.h: Updated for the above changes. Made a lot more
731         things private.
732
733         * rendering/RenderLayer.cpp:
734         (WebCore::RenderLayer::filterPainter): Added. Helper so setupFilters does not
735         have to do things twice.
736         (WebCore::RenderLayer::hasFilterThatIsPainting): Updated to call filterPainter.
737         (WebCore::RenderLayer::setupFilters): Ditto.
738         (WebCore::RenderLayer::calculateClipRects): Pass reference.
739         * rendering/RenderLayer.h: Updated for the above changes.
740
741         * rendering/style/ContentData.cpp:
742         (WebCore::ContentData::clone): Use auto.
743         (WebCore::ImageContentData::createContentRenderer): Updated for reference.
744         * rendering/style/ContentData.h: Use Ref&& instead of PassRefPtr. Made more
745         things private.
746
747         * rendering/style/NinePieceImage.cpp:
748         (WebCore::NinePieceImage::defaultData): Made this a static member so it can
749         get at the now-private class NinePieceImage::Data.
750         (WebCore::NinePieceImage::NinePieceImage): Use RefPtr&& instead of PassRefPtr.
751         Use construction instead of calling m_data.access() over and over again.
752         (WebCore::NinePieceImage::Data::Data): Renamed from NinePieceImageData.
753         Moved initialization to class definition. Added a new overload for the normal
754         creation case.
755         (WebCore::NinePieceImage::Data::create): Ditto.
756         (WebCore::NinePieceImage::Data::copy): Ditto.
757         (WebCore::NinePieceImage::Data::operator==): Ditto.
758         * rendering/style/NinePieceImage.h: Cut down on includes. Moved the class
759         named NinePieceImageData in to become the private struct NinePieceImage::Data.
760
761         * rendering/style/RenderStyle.cpp:
762         (WebCore::RenderStyle::setContent): Pass Ref&& instead of RefPtr&& when
763         creating ImageContentData.
764
765         * rendering/style/ShapeValue.cpp:
766         (WebCore::ShapeValue::isImageValid): Tighten up by using data member directly
767         and using a local variabel.
768         (WebCore::pointersOrValuesEqual): Deleted.
769         (WebCore::ShapeValue::operator==): Use arePointingToEqualData instead the
770         above deleted function template. Wrote as a single return statement for clarity.
771         * rendering/style/ShapeValue.h: Changed all the create function names to just
772         create, using overloading instead of separate names. Use Ref&& instead of PassRefPtr.
773         Removed unused constructor that took a type but no data.
774
775 2017-01-06  Chris Dumez  <cdumez@apple.com>
776
777         Regression(r189230): DOM Callbacks may use wrong global object
778         https://bugs.webkit.org/show_bug.cgi?id=166784
779
780         Reviewed by Mark Lam.
781
782         DOM Callbacks could end up using the wrong global object after r189230
783         because we were getting the globalObject from the callback object
784         instead of the one at the point the callback object was passed in by
785         JavaScript. This patch fixes the issue.
786
787         Test: fast/frames/frame-window-as-callback.html
788
789         * bindings/js/JSCallbackData.cpp:
790         (WebCore::JSCallbackData::invokeCallback):
791         * bindings/js/JSCallbackData.h:
792         (WebCore::JSCallbackData::globalObject):
793         (WebCore::JSCallbackData::JSCallbackData):
794         (WebCore::JSCallbackDataStrong::JSCallbackDataStrong):
795         (WebCore::JSCallbackDataStrong::callback):
796         (WebCore::JSCallbackDataStrong::invokeCallback):
797         (WebCore::JSCallbackDataWeak::JSCallbackDataWeak):
798         (WebCore::JSCallbackDataWeak::callback):
799         (WebCore::JSCallbackDataWeak::invokeCallback):
800         * bindings/scripts/CodeGeneratorJS.pm:
801         (GenerateCallbackImplementationContent):
802
803 2017-01-06  Andy Estes  <aestes@apple.com>
804
805         [Cocoa] Consolidate duplicate copies of WebArchiveDumpSupport in DRT and WKTR into WebCoreTestSupport
806         https://bugs.webkit.org/show_bug.cgi?id=166789
807
808         Reviewed by Alex Christensen.
809
810         There were duplicate implementations of WebArchiveDumpSupport in DumpRenderTree and
811         WebKitTestRunner. This change consolidates these into a single implementation in
812         WebCoreTestSupport.
813
814         * PlatformMac.cmake: Added WebArchiveDumpSupport.mm to WebCoreTestSupport.
815         * WebCore.xcodeproj/project.pbxproj: Ditto. Also made WebArchiveDumpSupport.h a Private header.
816         * platform/spi/cf/CFNetworkSPI.h: Moved CFNetwork forward declarations from
817         WebArchiveDumpSupport to here.
818         * testing/cocoa/WebArchiveDumpSupport.h: Added.
819         * testing/cocoa/WebArchiveDumpSupport.mm: Merged WebArchiveDumpSupport.cpp and
820         WebArchiveDumpSupport{Cocoa,Mac}.mm into a single file.
821
822 2017-01-06  Tim Horton  <timothy_horton@apple.com>
823
824         Minor cleanups to IndentOutdentCommand and related code
825         https://bugs.webkit.org/show_bug.cgi?id=166791
826
827         Reviewed by Simon Fraser.
828
829         * editing/IndentOutdentCommand.cpp:
830         (WebCore::IndentOutdentCommand::IndentOutdentCommand):
831         (WebCore::IndentOutdentCommand::outdentRegion):
832         * editing/IndentOutdentCommand.h:
833         (WebCore::IndentOutdentCommand::create):
834         Remove the unused m_marginInPixels and fix the copyright header.
835
836 2017-01-06  Alex Christensen  <achristensen@webkit.org>
837
838         Fix WinCairo build after r210319.
839         https://bugs.webkit.org/show_bug.cgi?id=166635
840
841         * DerivedSources.cpp:
842         A toJS call was ambiguous, but only if the generated IndexedDB bindings are compiled all-in-one in DerivedSources.cpp.
843         Compiling these few files separately (which happens automatically in the CMake build) fixes the build and won't increase
844         the total object files beyond MSVC's current 2GB limit.
845         * bindings/js/JSWebGLRenderingContextBaseCustom.cpp:
846         (WebCore::JSWebGLRenderingContextBaseOwner::isReachableFromOpaqueRoots):
847         Unknown was an ambiguous symbol.  It's also defined in winioctl.h.
848
849 2017-01-06  Zalan Bujtas  <zalan@apple.com>
850
851         Text highlight causes Yoon Gothic webfont to reflow.
852         https://bugs.webkit.org/show_bug.cgi?id=166753
853
854         Reviewed by Darin Adler.
855
856         Add word-break: keep-all; support for CJK and breaking NBSPs.
857
858         Add test later. Need to figure out what font file to use.
859
860         * rendering/SimpleLineLayoutTextFragmentIterator.cpp:
861         (WebCore::SimpleLineLayout::TextFragmentIterator::Style::Style):
862         (WebCore::SimpleLineLayout::TextFragmentIterator::nextBreakablePosition): Use BreakingContext's helper functions
863         to figure out the next breakable position.
864         (WebCore::SimpleLineLayout::TextFragmentIterator::skipToNextPosition):
865         * rendering/SimpleLineLayoutTextFragmentIterator.h:
866
867 2017-01-06  Joseph Pecoraro  <pecoraro@apple.com>
868
869         Add some missing longhand properties to CSSComputedStyleDeclaration and fix default values
870         https://bugs.webkit.org/show_bug.cgi?id=166674
871         <rdar://problem/6026159>
872
873         Reviewed by Darin Adler.
874
875         * css/CSSComputedStyleDeclaration.cpp:
876         Add some missing longhand properties to the list of all longhand properties.
877
878         (WebCore::counterToCSSValue):
879         The default value for counter-increment and counter-reset should be "none"
880         not the empty string.
881
882 2017-01-06  Chris Dumez  <cdumez@apple.com>
883
884         [Form Validation] "character" in maxlength validation message should be singular when maxlength is 1
885         https://bugs.webkit.org/show_bug.cgi?id=166712
886         <rdar://problem/29872292>
887
888         Reviewed by Darin Adler.
889
890         Fix validation message to use singular form of "character" when maxLength value is 1.
891
892         Test: fast/forms/validation-message-maxLength.html
893
894         * English.lproj/Localizable.strings:
895         * English.lproj/Localizable.stringsdict: Added.
896         * WebCore.xcodeproj/project.pbxproj:
897         * extract-localizable-strings.pl:
898         * platform/LocalizedStrings.cpp:
899         * platform/LocalizedStrings.h:
900         * platform/cocoa/LocalizedStringsCocoa.mm:
901         (WebCore::localizedNString):
902         (WebCore::localizedString):
903         (WebCore::validationMessageTooLongText):
904
905 2017-01-06  Jer Noble  <jer.noble@apple.com>
906
907         Add support for MediaKeySystemAccess.createMediaKeys()
908         https://bugs.webkit.org/show_bug.cgi?id=166749
909
910         Reviewed by Eric Carlson.
911
912         Test: media/encrypted-media/mock-MediaKeySystemAccess.html
913
914         Implement MediaKeySystemAccess::createMediaKeys(). This requires some
915         additions to CDM, CDMPrivate, and a new interface CDMInstance to support
916         eventual platform adoption and to implement mock support for testing.
917
918         * Modules/encryptedmedia/CDM.cpp:
919         (WebCore::CDM::loadAndInitialize):
920         (WebCore::CDM::createInstance):
921         * Modules/encryptedmedia/CDM.h:
922         * Modules/encryptedmedia/CDMInstance.h:
923         (WebCore::CDMInstance::~CDMInstance):
924         * Modules/encryptedmedia/CDMPrivate.h:
925         * Modules/encryptedmedia/MediaKeySystemAccess.cpp:
926         (WebCore::MediaKeySystemAccess::createMediaKeys):
927         * Modules/encryptedmedia/MediaKeySystemAccess.h:
928         * Modules/encryptedmedia/MediaKeys.cpp:
929         (WebCore::MediaKeys::MediaKeys):
930         * Modules/encryptedmedia/MediaKeys.h:
931         (WebCore::MediaKeys::create):
932         * Modules/encryptedmedia/MediaKeys.idl:
933         * Modules/encryptedmedia/NavigatorEME.cpp:
934         (WebCore::tryNextSupportedConfiguration):
935         * WebCore.xcodeproj/project.pbxproj:
936         * testing/MockCDMFactory.cpp:
937         (WebCore::MockCDM::MockCDM):
938         (WebCore::MockCDM::createInstance):
939         (WebCore::MockCDM::loadAndInitialize):
940         (WebCore::MockCDMInstance::MockCDMInstance):
941         (WebCore::MockCDMInstance::initializeWithConfiguration):
942         (WebCore::MockCDMInstance::setDistinctiveIdentifiersAllowed):
943         (WebCore::MockCDMInstance::setPersistentStateAllowed):
944         * testing/MockCDMFactory.h:
945         (WebCore::MockCDMFactory::canCreateInstances):
946         (WebCore::MockCDMFactory::setCanCreateInstances):
947         (WebCore::MockCDM::factory):
948         * testing/MockCDMFactory.idl:
949
950 2017-01-06  Andreas Kling  <akling@apple.com>
951
952         Give RenderObject a Page& getter.
953         <https://webkit.org/b/166735>
954
955         Reviewed by Darin Adler.
956
957         The render tree should now only ever be live while in a Frame that's connected to a Page.
958         Hence we can give RenderObject a Page& getter and simplify a lot of code that previously
959         had to get the Page from Document (or Frame) and perform null checks on it.
960
961         * dom/Document.cpp:
962         (WebCore::Document::destroyRenderTree): Assert that the Page is present when we tear the render tree down.
963
964         * page/Frame.cpp:
965         (WebCore::Frame::willDetachPage): Assert that there's no render tree when we're about to detach from the Page.
966         Also added a comment explaining the two main ways that render trees die.
967
968         * rendering/RenderObject.h:
969         (WebCore::RenderObject::page): Added. So neat!
970
971         * accessibility/AccessibilityRenderObject.cpp:
972         (WebCore::AccessibilityRenderObject::estimatedLoadingProgress):
973         * rendering/ImageQualityController.cpp:
974         (WebCore::ImageQualityController::chooseInterpolationQuality):
975         * rendering/InlineTextBox.cpp:
976         (WebCore::InlineTextBox::paint):
977         * rendering/RenderAttachment.cpp:
978         (WebCore::RenderAttachment::layout):
979         (WebCore::RenderAttachment::baselinePosition):
980         * rendering/RenderBlock.cpp:
981         (WebCore::RenderBlock::paintCaret):
982         * rendering/RenderBox.cpp:
983         (WebCore::RenderBox::styleDidChange):
984         (WebCore::setupWheelEventTestTrigger):
985         (WebCore::RenderBox::setScrollLeft):
986         (WebCore::RenderBox::setScrollTop):
987         * rendering/RenderElement.cpp:
988         (WebCore::RenderElement::paintFocusRing):
989         * rendering/RenderEmbeddedObject.cpp:
990         (WebCore::shouldUnavailablePluginMessageBeButton):
991         (WebCore::RenderEmbeddedObject::paint):
992         (WebCore::RenderEmbeddedObject::paintReplaced):
993         (WebCore::RenderEmbeddedObject::getReplacementTextGeometry):
994         (WebCore::RenderEmbeddedObject::handleUnavailablePluginIndicatorEvent):
995         (WebCore::RenderEmbeddedObject::getCursor):
996         * rendering/RenderHTMLCanvas.cpp:
997         (WebCore::RenderHTMLCanvas::paintReplaced):
998         * rendering/RenderIFrame.cpp:
999         (WebCore::RenderIFrame::flattenFrame):
1000         * rendering/RenderImage.cpp:
1001         (WebCore::RenderImage::paintReplaced):
1002         (WebCore::RenderImage::paintAreaElementFocusRing):
1003         * rendering/RenderLayer.cpp:
1004         (WebCore::RenderLayer::~RenderLayer):
1005         (WebCore::RenderLayer::forceUpdateScrollbarsOnMainThreadForPerformanceTesting):
1006         (WebCore::RenderLayer::scrollRectToVisible):
1007         (WebCore::RenderLayer::isActive):
1008         (WebCore::RenderLayer::didStartScroll):
1009         (WebCore::RenderLayer::didEndScroll):
1010         (WebCore::RenderLayer::didUpdateScroll):
1011         (WebCore::RenderLayer::createScrollbar):
1012         (WebCore::RenderLayer::setupFontSubpixelQuantization):
1013         (WebCore::RenderLayer::calculateClipRects):
1014         * rendering/RenderLayer.h:
1015         * rendering/RenderLayerBacking.cpp:
1016         (WebCore::RenderLayerBacking::RenderLayerBacking):
1017         (WebCore::RenderLayerBacking::createGraphicsLayer):
1018         (WebCore::RenderLayerBacking::updateOverflowControlsLayers):
1019         (WebCore::RenderLayerBacking::detachFromScrollingCoordinator):
1020         (WebCore::RenderLayerBacking::paintContents):
1021         (WebCore::RenderLayerBacking::shouldAggressivelyRetainTiles):
1022         (WebCore::RenderLayerBacking::shouldTemporarilyRetainTileCohorts):
1023         (WebCore::RenderLayerBacking::useGiantTiles):
1024         (WebCore::RenderLayerBacking::verifyNotPainting):
1025         (WebCore::RenderLayerBacking::startAnimation):
1026         (WebCore::scrollingCoordinatorFromLayer): Deleted.
1027         * rendering/RenderLayerCompositor.cpp:
1028         (WebCore::RenderLayerCompositor::cacheAcceleratedCompositingFlags):
1029         (WebCore::RenderLayerCompositor::scheduleLayerFlushNow):
1030         (WebCore::RenderLayerCompositor::flushPendingLayerChanges):
1031         (WebCore::updateScrollingLayerWithClient):
1032         (WebCore::RenderLayerCompositor::updateCustomLayersAfterFlush):
1033         (WebCore::RenderLayerCompositor::notifyFlushBeforeDisplayRefresh):
1034         (WebCore::RenderLayerCompositor::layerTiledBackingUsageChanged):
1035         (WebCore::RenderLayerCompositor::updateCompositingLayers):
1036         (WebCore::RenderLayerCompositor::appendDocumentOverlayLayers):
1037         (WebCore::RenderLayerCompositor::layerBecameNonComposited):
1038         (WebCore::RenderLayerCompositor::updateBacking):
1039         (WebCore::RenderLayerCompositor::pageScaleFactor):
1040         (WebCore::RenderLayerCompositor::zoomedOutPageScaleFactor):
1041         (WebCore::RenderLayerCompositor::contentsScaleMultiplierForNewTiles):
1042         (WebCore::RenderLayerCompositor::updateLayerForHeader):
1043         (WebCore::RenderLayerCompositor::updateLayerForFooter):
1044         (WebCore::RenderLayerCompositor::setRootExtendedBackgroundColor):
1045         (WebCore::RenderLayerCompositor::attachRootLayer):
1046         (WebCore::RenderLayerCompositor::detachRootLayer):
1047         (WebCore::RenderLayerCompositor::rootLayerAttachmentChanged):
1048         (WebCore::RenderLayerCompositor::registerAllScrollingLayers):
1049         (WebCore::RenderLayerCompositor::scrollingCoordinator):
1050         (WebCore::RenderLayerCompositor::graphicsLayerFactory):
1051         (WebCore::RenderLayerCompositor::createDisplayRefreshMonitor):
1052         (WebCore::RenderLayerCompositor::page):
1053         * rendering/RenderLayerCompositor.h:
1054         * rendering/RenderListBox.cpp:
1055         (WebCore::setupWheelEventTestTrigger):
1056         (WebCore::RenderListBox::setScrollTop):
1057         (WebCore::RenderListBox::isActive):
1058         (WebCore::RenderListBox::forceUpdateScrollbarsOnMainThreadForPerformanceTesting):
1059         (WebCore::RenderListBox::createScrollbar):
1060         * rendering/RenderObject.cpp:
1061         (WebCore::RenderObject::theme):
1062         * rendering/RenderObject.h:
1063         (WebCore::RenderObject::page):
1064         * rendering/RenderSearchField.cpp:
1065         (WebCore::RenderSearchField::addSearchResult):
1066         (WebCore::RenderSearchField::showPopup):
1067         (WebCore::RenderSearchField::valueChanged):
1068         * rendering/RenderSnapshottedPlugIn.cpp:
1069         (WebCore::RenderSnapshottedPlugIn::updateSnapshot):
1070         * rendering/RenderTheme.cpp:
1071         (WebCore::RenderTheme::paint):
1072         (WebCore::RenderTheme::updateControlStatesForRenderer):
1073         (WebCore::RenderTheme::isActive):
1074         * rendering/RenderThemeMac.mm:
1075         (WebCore::RenderThemeMac::paintCellAndSetFocusedElementNeedsRepaintIfNecessary):
1076         (WebCore::RenderThemeMac::paintSliderThumb):
1077         * rendering/RenderVideo.cpp:
1078         (WebCore::RenderVideo::paintReplaced):
1079         * rendering/RenderView.cpp:
1080         (WebCore::RenderView::pageNumberForBlockProgressionOffset):
1081         (WebCore::RenderView::pageCount):
1082         * rendering/svg/RenderSVGRoot.cpp:
1083         (WebCore::RenderSVGRoot::paintReplaced):
1084         * style/StyleResolveForDocument.cpp:
1085         (WebCore::Style::resolveForDocument):
1086
1087 2017-01-05  Zalan Bujtas  <zalan@apple.com>
1088
1089         TextFragmentIterator::runWidth does not need typename CharacterType<> anymore.
1090         https://bugs.webkit.org/show_bug.cgi?id=166751
1091
1092         Reviewed by Simon Fraser.
1093
1094         No change in functionality.
1095
1096         * rendering/SimpleLineLayoutTextFragmentIterator.cpp:
1097         (WebCore::SimpleLineLayout::TextFragmentIterator::textWidth):
1098         * rendering/SimpleLineLayoutTextFragmentIterator.h:
1099
1100 2017-01-05  Ryosuke Niwa  <rniwa@webkit.org>
1101
1102         Finding text doesn't work across shadow boundary
1103         https://bugs.webkit.org/show_bug.cgi?id=158503
1104
1105         Reviewed by Antti Koivisto.
1106
1107         Added a new TextIterator behavior flag, TextIteratorTraversesFlatTree, which makes TextIterator traverse
1108         the flat tree instead of the DOM tree, and made this behavior default in findPlainText.
1109
1110         Also added a new find options flag, DoNotTraverseFlatTree, to suppress this behavior in window.find(~)
1111         and execCommand('FindString', false, ~) as they should not be able to peek information inside shadow trees.
1112         Unfortunately these APIs have been deprecated in the standards so there is no specification to follow.
1113
1114         For now, we don't support finding a word or a keyword across a shadow boundary as this would require
1115         making rangeOfString and other related functions return a Range-like object that can cross shadow boundaries.
1116
1117         Also added internals.rangeOfString to test Editor::rangeOfString, and replaced the bit-flag arguments
1118         to internals.countMatchesForText and internals.countFindMatches by an array of strings for better portability.
1119
1120         Test: editing/text-iterator/find-string-on-flat-tree.html
1121
1122         * editing/Editor.cpp:
1123         (WebCore::Editor::rangeOfString): Use the modern containingShadowRoot instead of nonBoundaryShadowTreeRootNode
1124         since the start container can be a shadow root, which nonBoundaryShadowTreeRootNode asserts not be the case.
1125         * editing/Editor.h:
1126         * editing/EditorCommand.cpp:
1127         (WebCore::executeFindString): Don't traverse across shadow boundaries.
1128         * editing/FindOptions.h: Added DoNotTraverseFlatTree.
1129         * editing/TextIterator.cpp:
1130         (WebCore::assignedAuthorSlot): Added.
1131         (WebCore::authorShadowRoot): Added.
1132         (WebCore::firstChildInFlatTreeIgnoringUserAgentShadow): Added.
1133         (WebCore::nextSiblingInFlatTreeIgnoringUserAgentShadow): Added.
1134         (WebCore::firstChild): Added. Traverses the flat tree when TextIteratorTraversesFlatTree is set.
1135         (WebCore::nextSibling): Ditto.
1136         (WebCore::parentNodeOrShadowHost): Ditto.
1137         (WebCore::TextIterator::advance): Don't set m_handledChildren to true when the current node has display: contents.
1138         (WebCore::findPlainText): Use TextIteratorTraversesFlatTree unless DoNotTraverseFlatTree is set.
1139         * editing/TextIteratorBehavior.h: Added TextIteratorTraversesFlatTree.
1140         * page/DOMWindow.cpp:
1141         (WebCore::DOMWindow::find): Don't traverse across shadow boundaries.
1142         * testing/Internals.cpp:
1143         (WebCore::parseFindOptions): Added.
1144         (WebCore::Internals::rangeOfString): Added.
1145         (WebCore::Internals::countMatchesForText): Replaced the find options by an array of strings instead of a bit mask.
1146         (WebCore::Internals::countFindMatches): Ditto.
1147         * testing/Internals.h:
1148         * testing/Internals.idl: Added rangeOfString, and replaced find options bit-flag in countMatchesForText and
1149         countFindMatches by an array of strings so that the tests themselves don't rely on a specific value of each bit flag.
1150
1151 2017-01-05  Chris Dumez  <cdumez@apple.com>
1152
1153         [Form Validation] lengthy validation messages should be truncated with an ellipsis
1154         https://bugs.webkit.org/show_bug.cgi?id=166747
1155         <rdar://problem/29872021>
1156
1157         Reviewed by Simon Fraser.
1158
1159         Lengthy HTML validation messages should be truncated with an ellipsis.
1160         Previously, they were truncated but there was no ellipsis.
1161
1162         No new tests, not easily testable. Manually tested on
1163         - http://codepen.io/cdumez/full/zoOZmZ/ (last field)
1164
1165         * platform/ios/ValidationBubbleIOS.mm:
1166         (WebCore::ValidationBubble::ValidationBubble):
1167         * platform/mac/ValidationBubbleMac.mm:
1168         (WebCore::ValidationBubble::ValidationBubble):
1169
1170 2017-01-05  Simon Fraser  <simon.fraser@apple.com>
1171
1172         Radio buttons have a fixed border radius making them look square when resized
1173         https://bugs.webkit.org/show_bug.cgi?id=148676
1174         rdar://problem/29889892
1175
1176         Reviewed by Tim Horton.
1177
1178         Change the 8px border-radius of iOS radio buttons to 50% so they remain circular
1179         when the page overrides the size.
1180
1181         Test: fast/forms/ios/large-radio-button-is-round.html
1182
1183         * css/html.css:
1184         (#if defined(WTF_PLATFORM_IOS) && WTF_PLATFORM_IOS):
1185
1186 2017-01-05  Myles C. Maxfield  <mmaxfield@apple.com>
1187
1188         CoreText variation axis identifiers don't work with 64-bit numbers
1189         https://bugs.webkit.org/show_bug.cgi?id=166745
1190         <rdar://problem/29856541>
1191         <rdar://problem/29848883>
1192
1193         Reviewed by Tim Horton.
1194
1195         There is a bug where some CFNumbers are getting garbage results when
1196         being placed into a 64-bit field. Luckily, we don't need the full
1197         64-bits; 32-bits is sufficient.
1198
1199         Test: fast/text/international/system-language/hindi-system-font-punctuation.html
1200
1201         * platform/graphics/cocoa/FontCacheCoreText.cpp:
1202         (WebCore::defaultVariationValues):
1203
1204 2017-01-05  Zalan Bujtas  <zalan@apple.com>
1205
1206         Start hittesting a clean tree in RenderEmbeddedObject::isReplacementObscured
1207         https://bugs.webkit.org/show_bug.cgi?id=166743
1208         <rdar://problem/29024384>
1209
1210         Reviewed by Simon Fraser.
1211
1212         Unable to reproduce.
1213
1214         * rendering/RenderEmbeddedObject.cpp:
1215         (WebCore::RenderEmbeddedObject::isReplacementObscured):
1216
1217 2017-01-04  Ryosuke Niwa  <rniwa@webkit.org>
1218
1219         Crash inside Editor::styleForSelectionStart
1220         https://bugs.webkit.org/show_bug.cgi?id=166710
1221
1222         Reviewed by Chris Dumez.
1223
1224         Added a null pointer check. This crash can happen when the DOM is mutated as editorState tries
1225         to compute the style at the selection start.
1226
1227         No new tests since there is no reproducible test case, and I couldn't come up with one either.
1228         This crash seems to retire some intricate dependency between when DOM is mutated, selection is
1229         updated, and then performPostLayoutTasks ends up updating the editor state in response to
1230         the element's editabilty changing.
1231
1232         * editing/cocoa/EditorCocoa.mm:
1233         (WebCore::Editor::styleForSelectionStart):
1234
1235 2017-01-05  Ryan Haddad  <ryanhaddad@apple.com>
1236
1237         Unreviewed, rolling out r210370.
1238
1239         This change caused hundreds of LayoutTest failures on Sierra.
1240
1241         Reverted changeset:
1242
1243         "[Cocoa] Variation fonts without variations specified are not
1244         rendered as if the default variations were specified"
1245         https://bugs.webkit.org/show_bug.cgi?id=166672
1246         http://trac.webkit.org/changeset/210370
1247
1248 2017-01-05  Carlos Garcia Campos  <cgarcia@igalia.com>
1249
1250         [SOUP] Network process crash in WebKit::CustomProtocolManagerImpl::didFailWithError
1251         https://bugs.webkit.org/show_bug.cgi?id=165082
1252
1253         Reviewed by Alex Christensen.
1254
1255         Simplified WebKitSoupRequestGenericClient.
1256
1257         * platform/network/soup/WebKitSoupRequestGeneric.cpp:
1258         (webkitSoupRequestGenericSendAsync):
1259         (webkitSoupRequestGenericSendFinish):
1260         (webkitSoupRequestGenericGetRequest):
1261         * platform/network/soup/WebKitSoupRequestGeneric.h:
1262         * platform/network/soup/WebKitSoupRequestGenericClient.h:
1263
1264 2017-01-05  Chris Dumez  <cdumez@apple.com>
1265
1266         Turn preferLowPowerWebGLRendering setting on by default
1267         https://bugs.webkit.org/show_bug.cgi?id=166737
1268         <rdar://problem/29870033>
1269
1270         Reviewed by Dean Jackson.
1271
1272         Temporarily turn preferLowPowerWebGLRendering setting on by default until
1273         we deal better with WebGL content in background tabs.
1274
1275         * page/Settings.in:
1276
1277 2017-01-05  Myles C. Maxfield  <mmaxfield@apple.com>
1278
1279         [Cocoa] Variation fonts without variations specified are not rendered as if the default variations were specified
1280         https://bugs.webkit.org/show_bug.cgi?id=166672
1281         <rdar://problem/29779119>
1282         <rdar://problem/29848883>
1283
1284         Reviewed by Simon Fraser.
1285
1286         CoreText has a bug (<rdar://problem/29859207>) where variation fonts without
1287         a specified variation value are rendered as if the minimum value is specified,
1288         rather than the default value. The solution is to apply default values where
1289         they are omitted.
1290
1291         Test: fast/text/variations/advances.html
1292
1293         * platform/graphics/cocoa/FontCacheCoreText.cpp:
1294         (WebCore::preparePlatformFont):
1295
1296 2017-01-05  Zalan Bujtas  <zalan@apple.com>
1297
1298         Mark the dedicated root linebox for trailing floats in empty inlines dirty.
1299         https://bugs.webkit.org/show_bug.cgi?id=166732
1300         <rdar://problem/29100419>
1301
1302         Reviewed by Antti Koivisto.
1303
1304         We normally attach floating boxes to the last root linebox. However when the floatbox is preceded by a <br>
1305         we generate a dedicated root linebox (TrailingFloatsRootInlineBox) for the floatbox.
1306         When this floatbox is a RenderInline descendant and this RenderInline does not generate lineboxes (it's ancestor RenderBlockFlow does)
1307         we have to make sure that this special root linebox gets marked dirty when the associated floatbox changes.
1308         (Unfortunately through the recursive calls on dirtyLinesFromChangedChild(), we lose the information about
1309         the "changed child" since the inlines propagates the marking logic to the RenderBlockFlow, see FIXME.)
1310
1311         Test: fast/inline/trailing-floats-inline-crash2.html
1312
1313         * rendering/RenderLineBoxList.cpp:
1314         (WebCore::RenderLineBoxList::dirtyLinesFromChangedChild):
1315
1316 2017-01-05  Antoine Quint  <graouts@apple.com>
1317
1318         [Cocoa] Both modern-media-controls/images/iOS modern-media-controls/images/macOS are installed on both platforms
1319         https://bugs.webkit.org/show_bug.cgi?id=163871
1320
1321         Reviewed by Eric Carlson.
1322
1323         We now only copy modern media controls images, if any, for the current platform.
1324
1325         * WebCore.xcodeproj/project.pbxproj:
1326
1327 2017-01-05  Keith Rollin  <krollin@apple.com>
1328
1329         Add WebCore::URL::protocolHostAndPort
1330         https://bugs.webkit.org/show_bug.cgi?id=166426
1331
1332         Reviewed by Alex Christensen.
1333
1334         Added to support record/replay mechanism, which needs it in order to
1335         implement fuzzy-matching of URLs that are similar to each other but
1336         that nonetheless come from the same source/host.
1337
1338         Updated TestWebKitAPI/Tests/WebCore/URL.cpp.
1339
1340         * platform/URL.cpp:
1341         (WebCore::URL::protocolHostAndPort):
1342         * platform/URL.h:
1343
1344 2017-01-05  Chris Dumez  <cdumez@apple.com>
1345
1346         Form validation: Align email validation with the latest HTML specification
1347         https://bugs.webkit.org/show_bug.cgi?id=166697
1348         <rdar://problem/29870245>
1349
1350         Reviewed by Alex Christensen.
1351
1352         Align email validation with the latest HTML specification:
1353         - https://html.spec.whatwg.org/#valid-e-mail-address
1354
1355         It particular, the following changes were made:
1356         - The first and last character of the domain now needs to be a letter or a digit
1357         - Parts of the domain can only be 63 characters in length
1358
1359         No new tests, extended existing test.
1360
1361         * html/EmailInputType.cpp:
1362
1363 2017-01-05  Enrica Casucci  <enrica@apple.com>
1364
1365         Support File Promise during drag for macOS.
1366         https://bugs.webkit.org/show_bug.cgi?id=165204
1367         rdar://problem/19595567
1368
1369         Reviewed by Tim Horton.
1370
1371         Adds the support for handling File Promise type during
1372         drag. DragData now has the knowledge of the NSFilesPromisePboardType and
1373         checks for the data type during drag.
1374
1375         * page/mac/DragControllerMac.mm:
1376         (WebCore::DragController::dragOperation):
1377         * platform/DragData.h:
1378         (WebCore::DragData::setFileNames):
1379         (WebCore::DragData::fileNames):
1380         * platform/mac/DragDataMac.mm:
1381         (WebCore::DragData::containsFiles):
1382         (WebCore::DragData::numberOfFiles):
1383         (WebCore::DragData::asFilenames):
1384         (WebCore::DragData::containsCompatibleContent):
1385         (WebCore::DragData::containsPromise):
1386         (WebCore::DragData::asURL):
1387
1388 2017-01-05  Per Arne Vollan  <pvollan@apple.com>
1389
1390         [Win] Compile error.
1391         https://bugs.webkit.org/show_bug.cgi?id=166726
1392
1393         Reviewed by Alex Christensen.
1394
1395         Add include folder.
1396
1397         * CMakeLists.txt:
1398
1399 2017-01-05  Milan Crha  <mcrha@redhat.com>
1400
1401         [SOUP] AddressSanitizer: heap-use-after-free under WTF::String::fromUTF8()
1402         https://bugs.webkit.org/show_bug.cgi?id=166722
1403
1404         Reviewed by Alex Christensen.
1405
1406         * platform/soup/PublicSuffixSoup.cpp:
1407         (WebCore::topPrivatelyControlledDomain):
1408         Use a variable to hold UTF-8 version of the domain, because
1409         the soup_tld_get_base_domain() returns a pointer into the passed-in
1410         string, which could be freed due to the temporary object being freed.
1411
1412 2017-01-05  Andreas Kling  <akling@apple.com>
1413
1414         Remove some unnecessary page cache checks in render tree code.
1415         <https://webkit.org/b/166728>
1416
1417         Reviewed by Antti Koivisto.
1418
1419         There is no render tree in the page cache, so we don't need to be checking
1420         for it in renderer code.
1421
1422         * rendering/RenderElement.cpp:
1423         (WebCore::shouldRepaintForImageAnimation):
1424         (WebCore::RenderElement::newImageAnimationFrameAvailable):
1425         * rendering/RenderImage.cpp:
1426         (WebCore::RenderImage::imageChanged):
1427         * rendering/RenderObject.cpp:
1428         (WebCore::printRenderTreeForLiveDocuments):
1429         (WebCore::printLayerTreeForLiveDocuments):
1430         * rendering/RenderView.cpp:
1431         (WebCore::RenderView::lazyRepaintTimerFired):
1432
1433 2017-01-05  Andreas Kling  <akling@apple.com>
1434
1435         REGRESSION(r210226): overflow:scroll scroll position not restored on back navigation
1436         <https://webkit.org/b/166724>
1437
1438         Reviewed by Antti Koivisto.
1439
1440         Before r210226, the render tree being torn down and the document being destroyed
1441         were roughly the same thing, since they would always happen together, from the
1442         render tree's perspective.
1443
1444         Changing this caused us to skip over the code that saves the scroll position
1445         for an element's RenderLayer when going into the page cache. Navigating back to
1446         that page would then scroll the layer to (0,0) instead of the previous position.
1447
1448         The fix is simply to remove the check for documentBeingDestroyed() in ~RenderLayer().
1449         Note that two checks are being removed, there was also a weird "optimization"
1450         to avoid nulling out EventHandler's m_resizeLayer if it points to this layer.
1451         That pointer would eventually get nulled out in EventHandler::clear() anyway,
1452         but it feels better to not let that pointer dangle.
1453
1454         Test: fast/scrolling/page-cache-back-overflow-scroll-restore.html
1455
1456         * rendering/RenderLayer.cpp:
1457         (WebCore::RenderLayer::~RenderLayer):
1458
1459 2017-01-05  Wenson Hsieh  <wenson_hsieh@apple.com>
1460
1461         Disable smooth playhead animation for main content media in the Touch Bar
1462         https://bugs.webkit.org/show_bug.cgi?id=166715
1463         <rdar://problem/29870673>
1464
1465         Reviewed by Eric Carlson.
1466
1467         Passing in a non-zero playback rate to WebPlaybackControlsManager's timing property causes unintended effects
1468         further down the stack. Please see the Radar for more details.
1469
1470         * platform/mac/WebPlaybackSessionInterfaceMac.mm:
1471         (WebCore::WebPlaybackSessionInterfaceMac::updatePlaybackControlsManagerTiming):
1472
1473 2017-01-05  Andreas Kling  <akling@apple.com>
1474
1475         Fix iOS build due to missing #include's.
1476
1477         * history/CachedFrame.cpp:
1478
1479 2017-01-05  Andreas Kling  <akling@apple.com>
1480
1481         Remove ChromeClient::needTouchEvents().
1482         <https://webkit.org/b/166723>
1483
1484         Rubber-stamped by Antti Koivisto.
1485
1486         Remove this hook since it's a no-op in every port.
1487
1488         * dom/Document.cpp:
1489         (WebCore::Document::didBecomeCurrentDocumentInFrame):
1490         (WebCore::Document::didAddTouchEventHandler):
1491         (WebCore::Document::didRemoveTouchEventHandler):
1492         * history/CachedFrame.cpp:
1493         (WebCore::CachedFrameBase::restore):
1494         * loader/EmptyClients.h:
1495         * loader/FrameLoader.cpp:
1496         (WebCore::FrameLoader::transitionToCommitted):
1497         * page/ChromeClient.h:
1498
1499 2017-01-05  Darin Adler  <darin@apple.com>
1500
1501         Remove PassRefPtr use from "bindings/scripts", "svg", "testing", and "workers"
1502         https://bugs.webkit.org/show_bug.cgi?id=166718
1503
1504         Reviewed by Alex Christensen.
1505
1506         * bindings/scripts/test/JS/JSFloat64Array.cpp: Removed. Stale unused test
1507         result expectation file.
1508         * bindings/scripts/test/JS/JSFloat64Array.h: Ditto.
1509
1510         * svg/SVGElement.cpp:
1511         (WebCore::SVGElement::removeEventListener): Fix comment that incorrectly
1512         mentions PassRefPtr.
1513
1514         * testing/Internals.cpp:
1515         (WebCore::Internals::computedStyleIncludingVisitedInfo): Return Ref instead
1516         of RefPtr.
1517         (WebCore::Internals::serializeObject): Ditto.
1518         (WebCore::Internals::deserializeBuffer): Ditto.
1519         (WebCore::Internals::observeGC): Streamlined code a bit.
1520         * testing/Internals.h: Updated for above changes.
1521         * testing/Internals.idl: Marked various function results as nullable.
1522
1523         * workers/DedicatedWorkerThread.cpp:
1524         (WebCore::DedicatedWorkerThread::createWorkerGlobalScope): Take a RefPtr&&
1525         instead of a PassRefPtr.
1526         * workers/DedicatedWorkerThread.h: Updated for above change.
1527
1528         * workers/Worker.cpp:
1529         (WebCore::Worker::Worker): Passs a reference to WorkerGlobalScopeProxy::create.
1530         (WebCore::Worker::~Worker): Updated since m_contentProxy is a reference.
1531         (WebCore::Worker::postMessage): Ditto.
1532         (WebCore::Worker::terminate): Ditto.
1533         (WebCore::Worker::hasPendingActivity): Ditto.
1534         (WebCore::Worker::notifyNetworkStateChange): Ditto.
1535         (WebCore::Worker::notifyFinished): Ditto.
1536         * workers/Worker.h: Made m_contextProxy a reference rather than a pointer.
1537
1538         * workers/WorkerGlobalScopeProxy.h: Reduced includes. Made destructor
1539         protected instead of public since this class destroys itself.
1540
1541         * workers/WorkerMessagingProxy.cpp:
1542         (WebCore::WorkerGlobalScopeProxy::create): Take and return a reference.
1543         (WebCore::WorkerMessagingProxy::WorkerMessagingProxy): Moved most initialization
1544         to the calass definition. Take a reference instead of a pointer.
1545         (WebCore::WorkerMessagingProxy::startWorkerGlobalScope): Use auto.
1546         (WebCore::WorkerMessagingProxy::workerThreadCreated): Take a reference
1547         rather than a PassRefPtr.
1548         * workers/WorkerMessagingProxy.h: Updated for above changes.
1549         (WebCore::WorkerMessagingProxy::askedToTerminate): Deleted.
1550         (WebCore::WorkerMessagingProxy::workerObject): Deleted.
1551
1552         * workers/WorkerThread.h: Take a RefPtr&& instead of a PassRefPtr.
1553
1554 2017-01-04  Carlos Garcia Campos  <cgarcia@igalia.com>
1555
1556         Unreviewed. Addressing post-review comments after r21005.
1557
1558         Simplify cairo_glyph_t initialization as suggested by Said.
1559
1560         * platform/graphics/cairo/FontCairo.cpp:
1561         (WebCore::CairoGlyphToPathTranslator::path):
1562
1563 2017-01-04  Manuel Rego Casasnovas  <rego@igalia.com>
1564
1565         [css-grid] Fix crash clamping grid lines
1566         https://bugs.webkit.org/show_bug.cgi?id=166637
1567
1568         Reviewed by Darin Adler.
1569
1570         Avoid issues with very big values for the grid lines clamping them on GridPosition.
1571
1572         Test: fast/css-grid-layout/grid-position-crash.html
1573
1574         * rendering/style/GridArea.h: Move kGridMaxTracks definition to GridPosition.
1575         * rendering/style/GridPosition.h:
1576         (WebCore::GridPosition::setExplicitPosition): Use new setIntegerPosition().
1577         (WebCore::GridPosition::setSpanPosition): Ditto.
1578         (WebCore::GridPosition::setIntegerPosition): Clamp the position using kGridMaxTracks.
1579
1580 2017-01-04  Darin Adler  <darin@apple.com>
1581
1582         Remove PassRefPtr use from the "html" directory, other improvements
1583         https://bugs.webkit.org/show_bug.cgi?id=166635
1584
1585         Reviewed by Alex Christensen.
1586
1587         * CMakeLists.txt: Removed the duplicate copies of all the WebGL-specific files
1588         in the main list of source files; there is no value in listing them twice.
1589         Replaced WebGLGetInfo.cpp with WebGLAny.cpp.
1590
1591         * Modules/mediasource/MediaSource.cpp:
1592         (WebCore::MediaSource::removeSourceBuffer): Updates since the tracks functions
1593         return references now.
1594
1595         * Modules/mediasource/SourceBuffer.cpp:
1596         (WebCore::SourceBuffer::sourceBufferPrivateFastSeekTimeForMediaTime): Removed
1597         unneeded SourceBufferPrivate* argument.
1598         (WebCore::SourceBuffer::appendBufferTimerFired): Ditto.
1599         (WebCore::SourceBuffer::sourceBufferPrivateAppendComplete): Ditto.
1600         (WebCore::SourceBuffer::sourceBufferPrivateDidReceiveRenderingError): Ditto.
1601         (WebCore::SourceBuffer::videoTracks): Return a reference rather than a pointer.
1602         (WebCore::SourceBuffer::audioTracks): Ditto.
1603         (WebCore::SourceBuffer::textTracks): Ditto.
1604         (WebCore::SourceBuffer::sourceBufferPrivateDidReceiveInitializationSegment):
1605         Removed unneeded SourceBufferPrivate* argument.
1606         (WebCore::SourceBuffer::validateInitializationSegment): Updated since tracks
1607         functions now return a pointer.
1608         (WebCore::SourceBuffer::sourceBufferPrivateDidReceiveSample): Removed unneeded
1609         SourceBufferPrivate* argument.
1610         (WebCore::SourceBuffer::sourceBufferPrivateHasAudio): Ditto.
1611         (WebCore::SourceBuffer::sourceBufferPrivateHasVideo): Ditto.
1612         (WebCore::SourceBuffer::videoTrackSelectedChanged): Take a reference rather than
1613         a pointer.
1614         (WebCore::SourceBuffer::audioTrackEnabledChanged): Ditto.
1615         (WebCore::SourceBuffer::textTrackModeChanged): Ditto.
1616         (WebCore::SourceBuffer::textTrackAddCue): Ditto.
1617         (WebCore::SourceBuffer::textTrackAddCues): Ditto.
1618         (WebCore::SourceBuffer::textTrackRemoveCue): Ditto.
1619         (WebCore::SourceBuffer::textTrackRemoveCues): Ditto.
1620         (WebCore::SourceBuffer::textTrackKindChanged): Ditto.
1621         (WebCore::SourceBuffer::sourceBufferPrivateDidBecomeReadyForMoreSamples): Ditto.
1622         (WebCore::SourceBuffer::provideMediaData): Ditto.
1623         (WebCore::SourceBuffer::reenqueueMediaForTime): Ditto.
1624         * Modules/mediasource/SourceBuffer.h: Updated for above changes.
1625
1626         * WebCore.xcodeproj/project.pbxproj: Replaced WebGLGetInfo with WebGLAny.
1627
1628         * bindings/js/JSCanvasRenderingContext2DCustom.cpp:
1629         (WebCore::toHTMLCanvasStyle): Removed explicit cast to CanvasStyle and unneeded
1630         conversion to a pointer since CanvasStyle constructors now take references.
1631
1632         * bindings/js/JSPluginElementFunctions.cpp:
1633         (WebCore::pluginInstance): Updated since bindingsInstance now returns a raw pointer.
1634         (WebCore::pluginScriptObject): Ditto.
1635
1636         * bindings/js/JSWebGL2RenderingContextCustom.cpp:
1637         (WebCore::toJS): Moved to WebGLAny.h/cpp.
1638         (WebCore::JSWebGL2RenderingContext::getIndexedParameter): Updated since the toJS
1639         function in WebGLAny.h takes references, not pointers.
1640
1641         * bindings/js/JSWebGLRenderingContextBaseCustom.cpp: Removed quite a few unneeded
1642         includes and got rid of a lot of unneeded JSC prefixes.
1643         (WebCore::toJS): Moved to WebGLAny.h/cpp.
1644         (WebCore::toJSNewlyCreated):
1645         (WebCore::objectParameter): Renamed from getObjectParameter and also changed to
1646         take a pointer to member function so we don't need an enum and a switch statement.
1647         (WebCore::toJS): Changed to take references rather than pointers.
1648         (WebCore::JSWebGLRenderingContextBase::getAttachedShaders): Use a modern for loop.
1649         (WebCore::JSWebGLRenderingContextBase::getBufferParameter): Use objectParameter.
1650         (WebCore::JSWebGLRenderingContextBase::getRenderbufferParameter): Ditto.
1651         (WebCore::JSWebGLRenderingContextBase::getVertexAttrib): Ditto.
1652         (WebCore::toNumberVector): Renamed from toVector, since this is specifically for
1653         vectors of numbers. Use uncheckedAppend instead of assignment.
1654         (WebCore::functionForUniform): Marked this inline.
1655         (WebCore::dataFunctionf): Updated for above changes.
1656         (WebCore::dataFunctioni): Ditto.
1657         (WebCore::dataFunctionMatrix): Ditto.
1658
1659         * bindings/js/ScriptModuleLoader.cpp:
1660         (WebCore::ScriptModuleLoader::fetch): Moved assertions to the top of the function.
1661         Also added a FIXME because it's unclear why these assertions are correct. Updated
1662         to use downcastScriptElement instead of toScriptElementIfPossible.
1663
1664         * dom/Document.h: Sorted list of forward-declared classes. Removed duplicate
1665         forward declaration of ScriptModuleLoader.
1666
1667         * dom/PendingScript.cpp:
1668         (WebCore::PendingScript::create): Take a ScriptElement instead of an Element.
1669         (WebCore::PendingScript::PendingScript): Ditto.
1670         (WebCore::PendingScript::loadableScript): Moved inline to header and made inline.
1671         (WebCore::PendingScript::setClient): Take a reference instead of a pointer.
1672         * dom/PendingScript.h: UPdated for above changes.
1673
1674         * dom/ScriptElement.cpp:
1675         (WebCore::ScriptElement::prepareScript): Pass a reference instead of a pointer.
1676         (WebCore::ScriptElement::ref): Added. Forwards ref/deref to the underlying element
1677         so we can use Ref and RefPtr with this class.
1678         (WebCore::ScriptElement::deref): Ditto.
1679         (WebCore::isScriptElement): Added. Replaces one of the two uses of
1680         toScriptElementIfPossible, and is similar in style to is<Element>.
1681         (WebCore::downcastScriptElement): Ditto, but for downcast.
1682         * dom/ScriptElement.h: Updated for above changes.
1683
1684         * dom/ScriptRunner.cpp:
1685         (WebCore::ScriptRunner::queueScriptForExecution): Take reference rather than
1686         pointer, and pass ScriptElement rather than Element.
1687         (WebCore::ScriptRunner::notifyFinished): Ditto.
1688         (WebCore::ScriptRunner::timerFired): Ditto.
1689         * dom/ScriptRunner.h: Updated for above changes.
1690
1691         * html/FileInputType.cpp:
1692         (WebCore::FileInputType::files): Updated since m_fileList is a Ref.
1693         (WebCore::FileInputType::createFileList): Updated to return a Ref instead of
1694         a PassRefPtr. Also use reserveInitialCapacity/uncheckedAppend.
1695         (WebCore::FileInputType::requestIcon): Updated since the updateRendering
1696         function is now called iconLoaded. Also use references instead of pointers.
1697         (WebCore::FileInputType::setFiles): Take a RefPtr&& insted of a PassRefPtr.
1698         Also put some conditional code inside an #if.
1699         (WebCore::FileInputType::filesChosen): Updated for function name change.
1700         (WebCore::FileInputType::iconLoaded): Renamed from updateRendering.
1701         Changed argument to RefPtr&& from PassRefPtr.
1702         (WebCore::FileInputType::defaultToolTip): Got rid of unneeded local variable
1703         and used the correct type, unsigned, rather than size_t.
1704         * html/FileInputType.h: Updated for the above changes, use final instead
1705         of override, and use Ref instead of RefPtr.
1706
1707         * html/HTMLElement.cpp:
1708         (WebCore::HTMLElement::form): Renamed from virtualForm.
1709         * html/HTMLElement.h: Replaced the form/virtualForm pair of functions with
1710         just a form function. The old design dates back before we had "final" for
1711         virtual functions, and now we can just use that instead.
1712
1713         * html/HTMLFormControlElement.cpp:
1714         (WebCore::HTMLFormControlElement::virtualForm): Deleted.
1715         * html/HTMLFormControlElement.h: Mark the form function final, since it's
1716         now both an inline function in this class, and an override of a virtual
1717         function inherited from the base class. Deleted the virtualForm function.
1718
1719         * html/HTMLInputElement.cpp:
1720         (WebCore::HTMLInputElement::defaultEventHandler): Removed use of the
1721         formForSubmission function, which was just another way to get the same
1722         thing as the form function; perhaps they were different in the past.
1723         (WebCore::HTMLInputElement::setFiles): Take a RefPtr&& rather than a PassRefPtr.
1724         * html/HTMLInputElement.h: Updated for the above.
1725
1726         * html/HTMLLabelElement.cpp:
1727         (WebCore::HTMLLabelElement::control): Made this const.
1728         (WebCore::HTMLLabelElement::form): Made this const, so it can be used to
1729         override the const form function from the base class.
1730         * html/HTMLLabelElement.h: Marked the form function final, since we want it
1731         to override the form function inherited from HTMLElement.
1732
1733         * html/HTMLLegendElement.cpp:
1734         (WebCore::HTMLLegendElement::form): Renamed from virtualForm.
1735         * html/HTMLLegendElement.h: Override form instead of virtualForm and mark it final
1736         This makes things more efficient if someone calls form directly on this class;
1737         before it would make an unnecessary virtual function call.
1738
1739         * html/HTMLMediaElement.cpp:
1740         (WebCore::TrackDisplayUpdateScope::TrackDisplayUpdateScope): Take a reference
1741         rather than a pointer.
1742         (WebCore::TrackDisplayUpdateScope::~TrackDisplayUpdateScope): Ditto.
1743         (WebCore::eventTimeCueCompare): Compare the cues the same way the cue list would
1744         rather than using cueIndex.
1745         (WebCore::HTMLMediaElement::audioTrackEnabledChanged): Take a reference.
1746         (WebCore::HTMLMediaElement::textTrackModeChanged): Ditto.
1747         (WebCore::HTMLMediaElement::videoTrackSelectedChanged): Ditto.
1748         (WebCore::HTMLMediaElement::textTrackKindChanged): Ditto.
1749         (WebCore::HTMLMediaElement::textTrackAddCues): Ditto.
1750         (WebCore::HTMLMediaElement::textTrackRemoveCues): Ditto.
1751         (WebCore::HTMLMediaElement::textTrackAddCue): Ditto.
1752         (WebCore::HTMLMediaElement::textTrackRemoveCue): Ditto.
1753         (WebCore::HTMLMediaElement::mediaPlayerDidAddAudioTrack): Pass references.
1754         (WebCore::HTMLMediaElement::mediaPlayerDidAddTextTrack): Ditto.
1755         (WebCore::HTMLMediaElement::mediaPlayerDidAddVideoTrack): Ditto.
1756         (WebCore::HTMLMediaElement::removeTextTrack): Ditto.
1757         (WebCore::HTMLMediaElement::forgetResourceSpecificTracks): Ditto.
1758         (WebCore::HTMLMediaElement::setController): Take a RefPtr&& instead of PassRefPtr.
1759         * html/HTMLMediaElement.h: Updated for above changes.
1760
1761         * html/HTMLObjectElement.cpp:
1762         (WebCore::HTMLObjectElement::virtualForm): Deleted.
1763         * html/HTMLObjectElement.h: Made the form function inline and final, which
1764         achieves the same thing we did before with using, but without requiring the
1765         separate virtualForm function, now deleted.
1766
1767         * html/HTMLOptionElement.cpp:
1768         (WebCore::HTMLOptionElement::collectOptionInnerText): Use isScriptElement
1769         instead of toScriptElementIfPossible.
1770
1771         * html/HTMLPlugInElement.cpp:
1772         (WebCore::HTMLPlugInElement::bindingsInstance): Renamed from getInstance and
1773         changed the return type to a raw pointer.
1774         * html/HTMLPlugInElement.h: Updated for the above changes. Also changed the
1775         updateSnapshot function to take a raw pointer instead of a PassRefPtr.
1776
1777         * html/HTMLPlugInImageElement.cpp:
1778         (WebCore::HTMLPlugInImageElement::createElementRenderer): Pass a pointer
1779         to updateSnapshot.
1780         (WebCore::HTMLPlugInImageElement::updateSnapshot): Updated to take a raw
1781         pointer instead of a PassRefPtr.
1782         * html/HTMLPlugInImageElement.h: Updated for above changes.
1783
1784         * html/HTMLScriptElement.h: Added using to resolve the ambiguity with the
1785         ref/deref from HTMLElement and from ScriptElement.
1786
1787         * html/HTMLTextFormControlElement.cpp:
1788         (WebCore::HTMLTextFormControlElement::selection): Return a RefPtr instead
1789         of a PassRefPtr.
1790         * html/HTMLTextFormControlElement.h: Updated for above changes.
1791
1792         * html/HTMLTrackElement.cpp:
1793         (WebCore::HTMLTrackElement::textTrackKindChanged): Take a reference.
1794         (WebCore::HTMLTrackElement::textTrackModeChanged): Ditto.
1795         (WebCore::HTMLTrackElement::textTrackAddCues): Ditto.
1796         (WebCore::HTMLTrackElement::textTrackRemoveCues): Ditto.
1797         (WebCore::HTMLTrackElement::textTrackAddCue): Ditto.
1798         (WebCore::HTMLTrackElement::textTrackRemoveCue): Ditto.
1799         * html/HTMLTrackElement.h: Updated for above changes.
1800
1801         * html/InputType.cpp:
1802         (WebCore::InputType::formForSubmission): Deleted.
1803         (WebCore::InputType::setFiles): Take a RefPtr&& instead of a PassRefPtr.
1804         * html/InputType.h: Updated for above changes.
1805
1806         * html/PluginDocument.cpp:
1807         (WebCore::PluginDocumentParser::createDocumentStructure): Pass a reference.
1808         (WebCore::PluginDocument::setPluginElement): Take a reference rather than
1809         a PassRefPtr.
1810         * html/PluginDocument.h: Updated for above changes.
1811
1812         * html/canvas/CanvasRenderingContext2D.cpp:
1813         (WebCore::CanvasRenderingContext2D::setStrokeStyle): Pass a reference.
1814         (WebCore::CanvasRenderingContext2D::setFillStyle): Ditto.
1815         (WebCore::CanvasRenderingContext2D::drawTextInternal): Ditto.
1816
1817         * html/canvas/CanvasStyle.cpp:
1818         (WebCore::CanvasStyle::CanvasStyle): Rewrite all constructors to use the
1819         m_style variant instead of separate m_type and other data members. Also
1820         change from PassRefPtr to a reference.
1821         (WebCore::CanvasStyle::createFromString): Update to use the variant.
1822         (WebCore::CanvasStyle::createFromStringWithOverrideAlpha): Ditto.
1823         (WebCore::CanvasStyle::isEquivalentColor): Ditto.
1824         (WebCore::CanvasStyle::isEquivalentRGBA): Ditto.
1825         (WebCore::CanvasStyle::isEquivalentCMYKA): Ditto.
1826         (WebCore::CanvasStyle::CanvasStyle): Deleted copy constructor; the compiler
1827         can now generate a correct copy or move constructor.
1828         (WebCore::CanvasStyle::~CanvasStyle): Deleted. Compiler generates this
1829         properly now without help from us.
1830         (WebCore::CanvasStyle::operator=): Deleted. The compiler can now generate
1831         a correct copy of move assignment operator.
1832         (WebCore::CanvasStyle::applyStrokeColor): Updated to take a reference and
1833         use the variant.
1834         (WebCore::CanvasStyle::applyFillColor): Ditto.
1835
1836         * html/canvas/CanvasStyle.h: Redid this class to use a variant instead of
1837         a type enumeration and a union.
1838
1839         * html/canvas/OESVertexArrayObject.cpp:
1840         (WebCore::OESVertexArrayObject::createVertexArrayOES): Updated use of enum
1841         since it's now an enum class.
1842
1843         * html/canvas/WebGL2RenderingContext.cpp:
1844         (WebCore::WebGL2RenderingContext::WebGL2RenderingContext): Use Ref&& instead of
1845         RefPtr&& for the GraphicsContext3D.
1846         (WebCore::WebGL2RenderingContext::initializeVertexArrayObjects): Updated enum
1847         and also use references.
1848         (WebCore::WebGL2RenderingContext::getInternalformatParameter): Use nullptr to
1849         return null rather than the old idiom (default-constructed WebGLGetInfo).
1850         (WebCore::WebGL2RenderingContext::texStorage2D): Ditto.
1851         (WebCore::WebGL2RenderingContext::getQueryParameter): Ditto.
1852         (WebCore::WebGL2RenderingContext::getSamplerParameter): Ditto.
1853         (WebCore::WebGL2RenderingContext::getSyncParameter): Ditto.
1854         (WebCore::WebGL2RenderingContext::getIndexedParameter): Ditto.
1855         (WebCore::WebGL2RenderingContext::getActiveUniformBlockParameter): Ditto.
1856         (WebCore::WebGL2RenderingContext::getActiveUniformBlockName): Ditto.
1857         (WebCore::WebGL2RenderingContext::createVertexArray): Updated enum and also
1858         use reference.
1859         (WebCore::WebGL2RenderingContext::getExtension): Rearranged logic in three ways:
1860         (1) Moved checks for whether an extension is supported inside the case for that
1861         extension, rather than combining the extension name check with the extensions
1862         enabled check. (2) Used the new enableSupportedExtension function to simplify
1863         many of the checks to avoid repeating the extension name twice. (3) Changed the
1864         idiom so we set the pointers to nullptr explicitly, preparing for a future where
1865         we might make the extension pointers use std::optional so we can cache a negative
1866         for each extension too, not just a positive result.
1867         (WebCore::WebGL2RenderingContext::getSupportedExtensions): Use ASCIILiteral.
1868         (WebCore::WebGL2RenderingContext::getFramebufferAttachmentParameter): Use nullptr
1869         as above. For non-null types, return the object without converting, letting the
1870         WebGLAny class handle things, except for enumerations, which we need to explicitly
1871         static_cast to an integral type, and things that will be stored in the variant in
1872         a RefPtr, where we use makeRefPtr.
1873         (WebCore::WebGL2RenderingContext::validateFramebufferFuncParameters):
1874         Simplified and clarified the handling of COLOR_ATTACHMENT.
1875         (WebCore::WebGL2RenderingContext::getParameter): Return WebGLAny, same idiom as
1876         described above for getFramebufferAttachmentParameter.
1877         * html/canvas/WebGL2RenderingContext.h: Updated for above changes.
1878
1879         * html/canvas/WebGLAny.cpp: Added.
1880         (WebCore::toJS): Handles conversion to JavaScript types. This function is based
1881         on the existing toJS functions from the two classes that were using WebGLGetInfo.
1882         Eventually we can probably just get the bindings to automatically generate this,
1883         but there is some work to do to get to that point.
1884         * html/canvas/WebGLAny.h: Added. This type, a variant, replaces the WebGLGetInfo
1885         class. Also includes the toJS function, which is the real point of this type, since
1886         it's about returning a variant mapped appropriately to JavaScript types.
1887
1888         * html/canvas/WebGLContextGroup.cpp:
1889         (WebCore::WebGLContextGroup::getAGraphicsContext3D): Changed to return a reference.
1890         Droped unnecessary local variable with a long type name.
1891         (WebCore::WebGLContextGroup::addContext): Take a reference.
1892         (WebCore::WebGLContextGroup::removeContext): Ditto.
1893         (WebCore::WebGLContextGroup::removeObject): Ditto.
1894         (WebCore::WebGLContextGroup::addObject): Ditto.
1895         (WebCore::WebGLContextGroup::detachAndRemoveAllObjects): Dropped unnecessary
1896         local variable with a long type name.
1897         * html/canvas/WebGLContextGroup.h: Updated for above changes.
1898
1899         * html/canvas/WebGLContextObject.cpp:
1900         (WebCore::WebGLContextObject::~WebGLContextObject): Pass references.
1901         (WebCore::WebGLContextObject::detachContext): Ditto.
1902
1903         * html/canvas/WebGLGetInfo.cpp: Removed.
1904         * html/canvas/WebGLGetInfo.h: Removed.
1905
1906         * html/canvas/WebGLRenderingContext.cpp:
1907         (WebCore::WebGLRenderingContext::WebGLRenderingContext): Take a Ref&& instead
1908         of as PassRefPtr.
1909         (WebCore::WebGLRenderingContext::initializeVertexArrayObjects): Updated enum
1910         and also use references.
1911         (WebCore::WebGLRenderingContext::getExtension): Rearranged logic in three ways:
1912         (1) Moved checks for whether an extension is supported inside the case for that
1913         extension, rather than combining the extension name check with the extensions
1914         enabled check. (2) Used the new enableSupportedExtension function to simplify
1915         many of the checks to avoid repeating the extension name twice. (3) Changed the
1916         idiom so we set the pointers to nullptr explicitly, preparing for a future where
1917         we might make the extension pointers use std::optional so we can cache a negative
1918         for each extension too, not just a positive result.
1919         (WebCore::WebGLRenderingContext::getSupportedExtensions): Use ASCIILiteral.
1920         (WebCore::WebGLRenderingContext::getFramebufferAttachmentParameter): Use nullptr
1921         as above. For non-null types, return the object without converting, letting the
1922         WebGLAny class handle things, except for enumerations, which we need to explicitly
1923         static_cast to an integral type, and things that will be stored in the variant in
1924         a RefPtr, where we use makeRefPtr.
1925         (WebCore::WebGLRenderingContext::validateFramebufferFuncParameters):
1926         Simplified and clarified the handling of COLOR_ATTACHMENT adding a FIXME about
1927         something questionable.
1928         (WebCore::WebGLRenderingContext::getParameter): Return WebGLAny, same idiom as
1929         described above for getFramebufferAttachmentParameter.
1930         * html/canvas/WebGLRenderingContext.h: Updated for above changes.
1931
1932         * html/canvas/WebGLRenderingContextBase.cpp:
1933         (WebCore::WebGLRenderingContextBase::create): Updated to pass references
1934         instead of pointers in a couple cases
1935         (WebCore::WebGLRenderingContextBase::WebGLRenderingContextBase): Changed graphics
1936         context argument type from RefPtr&& to Ref&&. Also moved initialization of scalars
1937         from the constructor to the class definition.
1938         (WebCore::WebGLRenderingContextBase::~WebGLRenderingContextBase): Pass a reference.
1939         (WebCore::WebGLRenderingContextBase::createBuffer): Pass a reference instead of a pointer.
1940         (WebCore::WebGLRenderingContextBase::createFramebuffer): Ditto.
1941         (WebCore::WebGLRenderingContextBase::createTexture): Ditto.
1942         (WebCore::WebGLRenderingContextBase::createProgram): Ditto.
1943         (WebCore::WebGLRenderingContextBase::createRenderbuffer): Ditto.
1944         (WebCore::WebGLRenderingContextBase::createShader): Ditto.
1945         (WebCore::WebGLRenderingContextBase::deleteBuffer): Ditto.
1946         (WebCore::WebGLRenderingContextBase::getBufferParameter): Update to use WebGLAny.
1947         (WebCore::WebGLRenderingContextBase::getProgramParameter): Ditto.
1948         (WebCore::WebGLRenderingContextBase::getRenderbufferParameter): Ditto.
1949         (WebCore::WebGLRenderingContextBase::getShaderParameter): Ditto.
1950         (WebCore::WebGLRenderingContextBase::getTexParameter): Ditto.
1951         (WebCore::WebGLRenderingContextBase::getUniform): Ditto.
1952         (WebCore::WebGLRenderingContextBase::getVertexAttrib): Ditto.
1953         (WebCore::WebGLRenderingContextBase::getVertexAttribOffset): Removed unnneed
1954         type casts.
1955         (WebCore::WebGLRenderingContextBase::vertexAttribPointer): Pass a reference.
1956         (WebCore::WebGLRenderingContextBase::removeSharedObject): Take a reference.
1957         (WebCore::WebGLRenderingContextBase::addSharedObject): Ditto.
1958         (WebCore::WebGLRenderingContextBase::removeContextObject): Ditto.
1959         (WebCore::WebGLRenderingContextBase::addContextObject): Ditto.
1960         (WebCore::WebGLRenderingContextBase::getBooleanParameter): Changed return type;
1961         connversion to WebGLAny can happen at the point of use.
1962         (WebCore::WebGLRenderingContextBase::getBooleanArrayParameter): Ditto.
1963         (WebCore::WebGLRenderingContextBase::getFloatParameter): Ditto.
1964         (WebCore::WebGLRenderingContextBase::getIntParameter): Ditto.
1965         (WebCore::WebGLRenderingContextBase::getUnsignedIntParameter): Ditto.
1966         (WebCore::WebGLRenderingContextBase::getInt64Parameter): Ditto.
1967         (WebCore::WebGLRenderingContextBase::getWebGLFloatArrayParameter): Ditto.
1968         (WebCore::WebGLRenderingContextBase::getWebGLIntArrayParameter): Ditto.
1969         (WebCore::WebGLRenderingContextBase::validateBufferDataParameters): Use
1970         optional to simplify logic and get rid of a boolean.
1971         (WebCore::WebGLRenderingContextBase::enableSupportedExtension): Added.
1972         Helper used by the getExtension functions.
1973         * html/canvas/WebGLRenderingContextBase.h: Updated for the above changes.
1974         Also changed setBoundVertexArrayObject to take a raw pointer instead of
1975         as PassRefPtr.
1976
1977         * html/canvas/WebGLSharedObject.cpp:
1978         (WebCore::WebGLSharedObject::~WebGLSharedObject): Pass a reference.
1979         (WebCore::WebGLSharedObject::detachContextGroup): Ditto.
1980         (WebCore::WebGLSharedObject::getAGraphicsContext3D): Updated since the
1981         underlying getAGraphicsContext3D function now returns a reference.
1982
1983         * html/canvas/WebGLSharedObject.h: Removed many unused "is" virtual functions.
1984         * html/canvas/WebGLTransformFeedback.h: Ditto.
1985
1986         * html/canvas/WebGLVertexArrayObject.cpp:
1987         (WebCore::WebGLVertexArrayObject::create): Updated for new type enumeration.
1988         (WebCore::WebGLVertexArrayObject::WebGLVertexArrayObject): Ditto.
1989         (WebCore::WebGLVertexArrayObject::deleteObjectImpl): Ditto.
1990         * html/canvas/WebGLVertexArrayObject.h: Updated for above changes.
1991
1992         * html/canvas/WebGLVertexArrayObjectBase.cpp:
1993         (WebCore::WebGLVertexArrayObjectBase::WebGLVertexArrayObjectBase): Updated for new
1994         type enumeration and moved initialization to class definition.
1995         (WebCore::WebGLVertexArrayObjectBase::setElementArrayBuffer): Changed argument to
1996         raw pointer instead of PassRefPtr.
1997         (WebCore::WebGLVertexArrayObjectBase::setVertexAttribState): Changed argument to
1998         reference instead of PassRefPtr.
1999         (WebCore::WebGLVertexArrayObjectBase::unbindBuffer): Changed arugment type to
2000         reference instead of PassRefPtr.
2001         (WebCore::WebGLVertexArrayObjectBase::setVertexAttribDivisor): Removed unneeded
2002         local variable.
2003         * html/canvas/WebGLVertexArrayObjectBase.h: Updated for above changes.
2004         Replaced VAOType with Type. Used class member initialization.
2005
2006         * html/canvas/WebGLVertexArrayObjectOES.cpp:
2007         (WebCore::WebGLVertexArrayObjectOES::create): Updated for new type enumeration.
2008         (WebCore::WebGLVertexArrayObjectOES::WebGLVertexArrayObjectOES): Ditto.
2009         (WebCore::WebGLVertexArrayObjectOES::~WebGLVertexArrayObjectOES) Ditto.:
2010         (WebCore::WebGLVertexArrayObjectOES::deleteObjectImpl): Ditto.
2011         * html/canvas/WebGLVertexArrayObjectOES.h: Updated for above changes.
2012
2013         * html/forms/FileIconLoader.cpp:
2014         (WebCore::FileIconLoader::iconLoaded): Renamed from notifyFinished. Also changed
2015         the name of the function this calls to iconLoaded. Changed the arguemnt to
2016         RefPtr&& instead of PassRefPtr.
2017         * html/forms/FileIconLoader.h: Updated for above changes.
2018
2019         * html/parser/HTMLConstructionSite.cpp:
2020         (WebCore::HTMLConstructionSite::attachLater): Use isScriptElement instead of
2021         toScriptElementIfPossible.
2022         (WebCore::HTMLConstructionSite::insertForeignElement): Ditto.
2023
2024         * html/parser/HTMLDocumentParser.cpp:
2025         (WebCore::HTMLDocumentParser::runScriptsForPausedTreeBuilder): Pass script
2026         element as a Ref rather than RefPtr.
2027         (WebCore::HTMLDocumentParser::watchForLoad): Pass a reference instead of a pointer.
2028
2029         * html/parser/HTMLScriptRunner.cpp:
2030         (WebCore::HTMLScriptRunner::executeParsingBlockingScript): Deleted. Moved the code
2031         into the single call site, execute ParsingBlockingScripts.
2032         (WebCore::HTMLScriptRunner::executePendingScriptAndDispatchEvent): Changed argument
2033         type to a reference from a RefPtr; this funtion was not taking ownership. Also remove
2034         call to toScriptElementIfPossible,
2035         since pending scripts now contains script elements already.
2036         (WebCore::HTMLScriptRunner::execute): Changed argument type to Ref<ScriptElement>&&
2037         from PassRefPtr<Element>.
2038         (WebCore::HTMLScriptRunner::executeParsingBlockingScripts): Moved code here from
2039         executeParsingBlockingScript. Also pass a reference.
2040         (WebCore::HTMLScriptRunner::executeScriptsWaitingForParsing): Pass a reference.
2041         (WebCore::requestPendingScript): Changed argument type to ScriptElement& from
2042         Element*.
2043         (WebCore::HTMLScriptRunner::requestParsingBlockingScript): Ditto.
2044         (WebCore::HTMLScriptRunner::requestDeferredScript): Ditto.
2045         (WebCore::HTMLScriptRunner::runScript): Ditto.
2046         * html/parser/HTMLScriptRunner.h: Updated for above changes.
2047
2048         * html/parser/HTMLTreeBuilder.cpp:
2049         (WebCore::HTMLTreeBuilder::takeScriptToProcess): Changed return type from
2050         RefPtr<Element> to RefPtr<ScriptElement>.
2051         (WebCore::HTMLTreeBuilder::processEndTag): Downcast the script element to
2052         HTMLScriptElement so we can store it as a ScriptElement.
2053         (WebCore::HTMLTreeBuilder::processTokenInForeignContent): Downcast the script
2054         element to SVGScriptElement so we can store it as a script element.
2055         * html/parser/HTMLTreeBuilder.h: Updated for above changes. Changed the type
2056         of m_scriptToProcess to RefPtr<ScriptElement>.
2057
2058         * html/parser/TextDocumentParser.cpp: Added now-needed include.
2059
2060         * html/parser/XSSAuditorDelegate.cpp:
2061         (WebCore::XSSAuditorDelegate::generateViolationReport): Changed return type
2062         to Ref from PassRefPtr.
2063         * html/parser/XSSAuditorDelegate.h: Updated for above.
2064
2065         * html/track/AudioTrack.cpp:
2066         (WebCore::AudioTrack::AudioTrack): Take references.
2067         (WebCore::AudioTrack::setPrivate): Ditto.
2068         (WebCore::AudioTrack::setEnabled): Removed redundant code to do what the
2069         private setEnabled function is already going to do.
2070         (WebCore::AudioTrack::inbandTrackIndex): Removed assertion since m_private
2071         is now a Ref rather than RefPtr.
2072         (WebCore::AudioTrack::enabledChanged): Added an early exit so we will only
2073         call audioTrackEnabledChanged if m_enabled is actually changing. Also removed
2074         the unneeded track private argument.
2075         (WebCore::AudioTrack::idChanged): Ditto.
2076         (WebCore::AudioTrack::labelChanged): Ditto.
2077         (WebCore::AudioTrack::languageChanged): Ditto.
2078         (WebCore::AudioTrack::willRemove): Ditto.
2079         * html/track/AudioTrack.h: Updated for above changes.
2080
2081         * html/track/InbandDataTextTrack.cpp:
2082         (WebCore::InbandDataTextTrack::addDataCue): Removed inband text track private
2083         argument. Use contains instead of find/end.
2084         (WebCore::InbandDataTextTrack::updateDataCue): Ditto. Use get instead of find/end.
2085         (WebCore::InbandDataTextTrack::removeDataCue): Ditto.
2086         * html/track/InbandDataTextTrack.h: Updated for above changes.
2087
2088         * html/track/InbandGenericTextTrack.cpp:
2089         (WebCore::InbandGenericTextTrack::InbandGenericTextTrack): Take references.
2090         (WebCore::InbandGenericTextTrack::create): Ditto.
2091         (WebCore::InbandGenericTextTrack::updateCueFromCueData): Ditto.
2092         (WebCore::InbandGenericTextTrack::addGenericCue): Ditto. Also removed unused
2093         track private argument.
2094         (WebCore::InbandGenericTextTrack::updateGenericCue): Ditto.
2095         (WebCore::InbandGenericTextTrack::removeGenericCue): Ditto.
2096         (WebCore::InbandGenericTextTrack::parseWebVTTCueData): Ditto.
2097         (WebCore::InbandGenericTextTrack::parseWebVTTFileHeader): Ditto.
2098         (WebCore::InbandGenericTextTrack::newRegionsParsed): Pass a reference.
2099         * html/track/InbandGenericTextTrack.h: Updated for above changes.
2100
2101         * html/track/InbandTextTrack.cpp:
2102         (WebCore::InbandTextTrack::create): Return a Ref instead of a PassRefPtr. Take
2103         references.
2104         (WebCore::InbandTextTrack::InbandTextTrack): Ditto.
2105         (WebCore::InbandTextTrack::setPrivate): Take a reference instead of a PassRefPtr.
2106         (WebCore::InbandTextTrack::isClosedCaptions): Removed check for null since m_private
2107         is now a Ref and so never null.
2108         (WebCore::InbandTextTrack::isSDH): Ditto.
2109         (WebCore::InbandTextTrack::containsOnlyForcedSubtitles): Ditto.
2110         (WebCore::InbandTextTrack::isMainProgramContent): Ditto.
2111         (WebCore::InbandTextTrack::isEasyToRead): Ditto.
2112         (WebCore::InbandTextTrack::inbandTrackIndex): Ditto.
2113         (WebCore::InbandTextTrack::inBandMetadataTrackDispatchType): Ditto.
2114         (WebCore::InbandTextTrack::idChanged): Removed unneeded track private argument.
2115         (WebCore::InbandTextTrack::labelChanged): Ditto.
2116         (WebCore::InbandTextTrack::languageChanged): Ditto.
2117         (WebCore::InbandTextTrack::willRemove): Ditto.
2118         (WebCore::InbandTextTrack::updateKindFromPrivate): Improved switch statement
2119         by removing default so we get a warning if we forget to handle a kind value.
2120         (WebCore::InbandTextTrack::startTimeVariance): Removed check for null.
2121         * html/track/InbandTextTrack.h: Updated for above changes. Changed m_private from
2122         a RefPtr to a Ref.
2123
2124         * html/track/InbandWebVTTTextTrack.cpp:
2125         (WebCore::InbandWebVTTTextTrack::InbandWebVTTTextTrack): Take references.
2126         (WebCore::InbandWebVTTTextTrack::create): Ditto.
2127         (WebCore::InbandWebVTTTextTrack::parseWebVTTCueData): Removed unneeded track
2128         private arguemnt.
2129         (WebCore::InbandWebVTTTextTrack::newRegionsParsed): Pass a reference.
2130         * html/track/InbandWebVTTTextTrack.h: Updated for above changes.
2131
2132         * html/track/LoadableTextTrack.cpp:
2133         (WebCore::LoadableTextTrack::newCuesAvailable): Pass references.
2134         (WebCore::LoadableTextTrack::newRegionsAvailable): Ditto.
2135
2136         * html/track/TextTrack.cpp:
2137         (WebCore::TextTrack::~TextTrack): Use references.
2138         (WebCore::TextTrack::setKind): Ditto.
2139         (WebCore::TextTrack::setMode): Ditto.
2140         (WebCore::TextTrack::removeAllCues): Ditto.
2141         (WebCore::TextTrack::activeCues): Ditto.
2142         (WebCore::TextTrack::addCue): Ditto.
2143         (WebCore::TextTrack::removeCue): Removed unneeded code to handle a cue
2144         that points to a track but is not in that track. Added a call to
2145         setIsActive(false) here instead of having the remove function do it.
2146         (WebCore::TextTrack::addRegion): Use references.
2147         (WebCore::TextTrack::removeRegion): Removed unneeded code to handle a
2148         region that points to a track but is not in that track.
2149         (WebCore::TextTrack::cueWillChange): Use references.
2150         (WebCore::TextTrack::cueDidChange): Ditto.
2151         (WebCore::TextTrack::setLanguage): Ditto.
2152         * html/track/TextTrack.h: Updated for above changes.
2153
2154         * html/track/TextTrackCue.cpp:
2155         (WebCore::TextTrackCue::TextTrackCue): Initialized the data members
2156         in the class definition.
2157         (WebCore::TextTrackCue::cueIndex): Deleted.
2158         (WebCore::TextTrackCue::invalidateCueIndex): Deleted.
2159         * html/track/TextTrackCue.h: Updated for the above. Removed m_cueIndex,
2160         because it is not a good design to store these and try to keep them up
2161         to date.
2162
2163         * html/track/TextTrackCueList.cpp:
2164         (WebCore::compareCues): Added. Helper for sorting and checking sorting.
2165         (WebCore::TextTrackCueList::TextTrackCueList): Deleted. Let the compiler
2166         generate this.
2167         (WebCore::TextTrackCueList::length): Moved to header.
2168         (WebCore::TextTrackCueList::cueIndex): Renamed from getCueIndex.
2169         Changed return type to unsigned rather than unsigned long.
2170         (WebCore::TextTrackCueList::item): Updated for name change.
2171         (WebCore::TextTrackCueList::getCueById): Ditto.
2172         (WebCore::TextTrackCueList::activeCues): Build the vector directly
2173         rather than wastefully adding with TextTrackCueList::add, which will
2174         try to sort.
2175         (WebCore::TextTrackCueList::add): Take a Ref&& instead of a PassRefPtr.
2176         Also, keep sorted using std::upper_bound instead of the recursive
2177         binary search this code was using before. Also remove the
2178         invalidateCueIndexes call since there are no cue indices any more.
2179         Also remove the boolean return value since no caller was using it.
2180         (WebCore::TextTrackCueList::remove): Take a reference instead of a
2181         pointer. Also remove the boolean return value since no caller was using it.
2182         (WebCore::TextTrackCueList::contains): Deleted. Was unused.
2183         (WebCore::TextTrackCueList::updateCueIndex): Reimplemented using the
2184         std::upper_bound and std::rotate operations. The old code that used
2185         remove and add was inefficient and also could cause a cue to be deallocated
2186         if something else wasn't holding a reference to the cue. Also changed to take
2187         a reference.
2188         (WebCore::TextTrackCueList::clear): Deleted. Was unused.
2189         (WebCore::TextTrackCueList::invalidateCueIndexes): Deleted. No longer
2190         needed since we don't store cue indices in the cues any more.
2191         * html/track/TextTrackCueList.h: Updated for the above changes.
2192
2193         * html/track/VTTRegionList.cpp:
2194         (WebCore::VTTRegionList::VTTRegionList): Deleted. Let the compiler
2195         generate this.
2196         (WebCore::VTTRegionList::length): Moved to header.
2197         (WebCore::VTTRegionList::item): Updated for name and type changes.
2198         (WebCore::VTTRegionList::getRegionById): Ditto.
2199         (WebCore::VTTRegionList::add): Changed to take a Ref&& instead of a
2200         PassRefPtr.
2201         (WebCore::VTTRegionList::remove): Updated.
2202         (WebCore::VTTRegionList::clear): Deleted. Was unused.
2203         * html/track/VTTRegionList.h: Updated for the above changes.
2204         * html/track/VTTRegionList.idl: Made return values nullable to reflect
2205         the actual semantic of the code.
2206
2207         * html/track/VideoTrack.cpp:
2208         (WebCore::VideoTrack::VideoTrack): Use references.
2209         (WebCore::VideoTrack::setPrivate): Ditto.
2210         (WebCore::VideoTrack::setSelected): Ditto.
2211         (WebCore::VideoTrack::inbandTrackIndex): Removed assertion since m_private
2212         is now a Ref instead of a RefPtr.
2213         (WebCore::VideoTrack::selectedChanged): Removed unneeded track private argument.
2214         (WebCore::VideoTrack::idChanged): Ditto.
2215         (WebCore::VideoTrack::labelChanged): Ditto.
2216         (WebCore::VideoTrack::languageChanged): Ditto.
2217         (WebCore::VideoTrack::willRemove): Ditto.
2218         (WebCore::VideoTrack::setKind): Updated to use reference.
2219         (WebCore::VideoTrack::setLanguage): Ditto.
2220         * html/track/VideoTrack.h: Updated for the above. Changed derivation to private.
2221         Removed unneeded defaultKindKeyword.
2222
2223         * loader/EmptyClients.h: Updated to use reference.
2224
2225         * loader/PingLoader.cpp:
2226         (WebCore::PingLoader::sendViolationReport): Take a Ref&& instead of RefPtr&&.
2227         * loader/PingLoader.h: Updated for above change.
2228
2229         * page/Chrome.cpp:
2230         (WebCore::Chrome::loadIconForFiles): Take a reference.
2231         * page/Chrome.h: Updated for above change.
2232         * page/ChromeClient.h: Ditto.
2233
2234         * page/csp/ContentSecurityPolicy.cpp:
2235         (WebCore::ContentSecurityPolicy::reportViolation): Use auto.
2236
2237         * platform/cocoa/WebPlaybackSessionModelMediaElement.mm:
2238         (WebPlaybackSessionModelMediaElement::selectAudioMediaOption): Simplified
2239         algorithm by removing unneeded direct call to audioTrackEnabledChanged,
2240         which will be called by setEnabled and doesn't need to be called again here.
2241         (WebPlaybackSessionModelMediaElement::selectLegibleMediaOption): Removed
2242         unhelpful assertion and unnneded initialization.
2243
2244         * platform/graphics/AudioTrackPrivate.h: Removed unnneeed track private
2245         argument and initialized data members where they are defined.
2246
2247         * platform/graphics/InbandTextTrackPrivateClient.h: Use Ref instead of
2248         PassRefPtr, initialize data members where they are defined, and removed
2249         the unneeded track private arguments from the client functions.
2250
2251         * platform/graphics/SourceBufferPrivate.h: Fixed functions that were taking
2252         AtomicString to take a const& instead. Use Ref&& instead of PassRefPtr.
2253
2254         * platform/graphics/SourceBufferPrivateClient.h: Removed unneded private pointer
2255         arguments from client functions.
2256
2257         * platform/graphics/TrackPrivateBase.h: Removed unneeded private pointers
2258         from client functions.
2259         * platform/graphics/VideoTrackPrivate: Ditto.
2260
2261         * platform/graphics/avfoundation/AudioTrackPrivateAVF.h: Use
2262         const AtomicString&.
2263
2264         * platform/graphics/avfoundation/InbandMetadataTextTrackPrivateAVF.cpp:
2265         (WebCore::InbandMetadataTextTrackPrivateAVF::addDataCue): Updated for change to arguments.
2266         (WebCore::InbandMetadataTextTrackPrivateAVF::updatePendingCueEndTimes): Ditto.
2267         (WebCore::InbandMetadataTextTrackPrivateAVF::flushPartialCues): Ditto.
2268         * platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp:
2269         (WebCore::InbandTextTrackPrivateAVF::processAttributedStrings): Ditto.
2270         (WebCore::InbandTextTrackPrivateAVF::resetCueValues): Ditto.
2271         (WebCore::InbandTextTrackPrivateAVF::processNativeSamples): Ditto.
2272
2273         * platform/graphics/avfoundation/objc/AudioTrackPrivateMediaSourceAVFObjC.cpp:
2274         (WebCore::AudioTrackPrivateMediaSourceAVFObjC::AudioTrackPrivateMediaSourceAVFObjC):
2275         Moved initialization of data memebrs to where they are defined.
2276         (WebCore::AudioTrackPrivateMediaSourceAVFObjC::enabled): Deleted. No longer needed.
2277         (WebCore::AudioTrackPrivateMediaSourceAVFObjC::setEnabled): Changed to use the enabled
2278         flag from the base class instead of a separate m_enabled in this class.
2279         * platform/graphics/avfoundation/objc/AudioTrackPrivateMediaSourceAVFObjC.h:
2280         Removed the enabled function and the m_enabled data member.
2281
2282         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h: Marked functions
2283         final instead of override and updated arguemnts.
2284         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
2285         (WebCore::SourceBufferPrivateAVFObjC::didParseStreamDataAsAsset): Updated for change
2286         to arguments.
2287         (WebCore::SourceBufferPrivateAVFObjC::processCodedFrame): Ditto.
2288         (WebCore::SourceBufferPrivateAVFObjC::appendCompleted): Ditto.
2289         (WebCore::SourceBufferPrivateAVFObjC::hasVideo): Ditto.
2290         (WebCore::SourceBufferPrivateAVFObjC::hasAudio): Ditto.
2291         (WebCore::SourceBufferPrivateAVFObjC::layerDidReceiveError): Ditto.
2292         (WebCore::SourceBufferPrivateAVFObjC::flush): Ditto.
2293         (WebCore::SourceBufferPrivateAVFObjC::enqueueSample): Ditto.
2294         (WebCore::SourceBufferPrivateAVFObjC::isReadyForMoreSamples): Ditto.
2295         (WebCore::SourceBufferPrivateAVFObjC::fastSeekTimeForMediaTime): Ditto.
2296         (WebCore::SourceBufferPrivateAVFObjC::seekToTime): Ditto.
2297         (WebCore::SourceBufferPrivateAVFObjC::didBecomeReadyForMoreSamples): Ditto.
2298         (WebCore::SourceBufferPrivateAVFObjC::notifyClientWhenReadyForMoreSamples): Ditto.
2299
2300         * platform/graphics/gstreamer/InbandMetadataTextTrackPrivateGStreamer.h: Updated for
2301         changes to arguments.
2302         * platform/graphics/gstreamer/InbandTextTrackPrivateGStreamer.cpp:
2303         (WebCore::InbandTextTrackPrivateGStreamer::notifyTrackOfSample): Ditto.
2304         * platform/graphics/gstreamer/TrackPrivateBaseGStreamer.cpp:
2305         (WebCore::TrackPrivateBaseGStreamer::notifyTrackOfTagsChanged): Ditto.
2306         * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
2307         (WebCore::AppendPipeline::appsinkNewSample): Ditto.
2308         * platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.cpp:
2309         (WebCore::SourceBufferPrivateGStreamer::append): Ditto.
2310         (WebCore::SourceBufferPrivateGStreamer::flush): Ditto.
2311         (WebCore::SourceBufferPrivateGStreamer::enqueueSample): Ditto.
2312         (WebCore::SourceBufferPrivateGStreamer::isReadyForMoreSamples): Ditto.
2313         (WebCore::SourceBufferPrivateGStreamer::notifyReadyForMoreSamples): Ditto.
2314         (WebCore::SourceBufferPrivateGStreamer::stopAskingForMoreSamples): Ditto.
2315         (WebCore::SourceBufferPrivateGStreamer::notifyClientWhenReadyForMoreSamples): Ditto.
2316         (WebCore::SourceBufferPrivateGStreamer::didReceiveInitializationSegment): Ditto.
2317         (WebCore::SourceBufferPrivateGStreamer::didReceiveSample): Ditto.
2318         (WebCore::SourceBufferPrivateGStreamer::didReceiveAllPendingSamples): Ditto.
2319         * platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.h: Ditto.
2320         * platform/mock/mediasource/MockSourceBufferPrivate.cpp:
2321         (WebCore::MockSourceBufferPrivate::append): Ditto.
2322         (WebCore::MockSourceBufferPrivate::didReceiveInitializationSegment): Ditto.
2323         (WebCore::MockSourceBufferPrivate::didReceiveSample): Ditto.
2324         (WebCore::MockSourceBufferPrivate::enqueuedSamplesForTrackID): Ditto.
2325         (WebCore::MockSourceBufferPrivate::enqueueSample): Ditto.
2326         (WebCore::MockSourceBufferPrivate::hasVideo): Ditto.
2327         (WebCore::MockSourceBufferPrivate::hasAudio): Ditto.
2328         (WebCore::MockSourceBufferPrivate::fastSeekTimeForMediaTime): Ditto.
2329         (WebCore::MockSourceBufferPrivate::seekToTime): Ditto.
2330         * platform/mock/mediasource/MockSourceBufferPrivate.h: Ditto.
2331
2332         * rendering/RenderSnapshottedPlugIn.cpp:
2333         (WebCore::RenderSnapshottedPlugIn::updateSnapshot): Take raw pointer instead
2334         of PassRefPtr.
2335         * rendering/RenderSnapshottedPlugIn.h: Updated for above change.
2336
2337         * svg/SVGScriptElement.h: Added using to resolve the ambiguity with the
2338         ref/deref from SVGElement and from ScriptElement.
2339
2340         * xml/parser/XMLDocumentParser.cpp:
2341         (WebCore::XMLDocumentParser::notifyFinished): Updated to simplify since
2342         the pending script now has a script element.
2343
2344         * xml/parser/XMLDocumentParserLibxml2.cpp:
2345         (WebCore::XMLDocumentParser::startElementNs): Use isSciprtElement instead
2346         of toScriptElementIfPossible.
2347         (WebCore::XMLDocumentParser::endElementNs): Ditto. Also use downcastScriptElement.
2348
2349 2017-01-04  Wenson Hsieh  <wenson_hsieh@apple.com>
2350
2351         Move editing history scripts to WebCore PrivateHeaders
2352         https://bugs.webkit.org/show_bug.cgi?id=166709
2353         <rdar://problem/29876612>
2354
2355         Reviewed by Dan Bernstein.
2356
2357         Move editing history scripts out of InternalScripts and into Scripts, and update the WebCore Copy Script build
2358         phase to copy the editing scripts into PrivateHeaders.
2359
2360         No new tests, because there should be no behavior change.
2361
2362         * Scripts/DumpEditingHistory.js: Renamed from Source/WebCore/InternalScripts/DumpEditingHistory.js.
2363         * Scripts/EditingHistoryUtil.js: Renamed from Source/WebCore/InternalScripts/EditingHistoryUtil.js.
2364         * WebCore.xcodeproj/project.pbxproj:
2365
2366 2017-01-04  Joseph Pecoraro  <pecoraro@apple.com>
2367
2368         Web Inspector: forced pseudo classes aren't cleared from inspected page when Inspector closes
2369         https://bugs.webkit.org/show_bug.cgi?id=108823
2370         <rdar://problem/13143550>
2371
2372         Reviewed by Timothy Hatcher.
2373
2374         * inspector/InspectorCSSAgent.h:
2375         * inspector/InspectorCSSAgent.cpp:
2376         (WebCore::InspectorCSSAgent::documentDetached):
2377         Clear the document from all of the different Document sets.
2378
2379         (WebCore::InspectorCSSAgent::didRemoveDocument): Deleted.
2380         Use documentDetached, which is more direct.
2381
2382         (WebCore::InspectorCSSAgent::forcePseudoState):
2383         Update the set of Documents with psuedo element changes. So when we
2384         reset forced styles we know which documents to refresh styles.
2385
2386         (WebCore::InspectorCSSAgent::resetPseudoStates):
2387         Use the list of documents we've already computed.
2388
2389         (WebCore::InspectorCSSAgent::didRemoveDOMNode):
2390         (WebCore::InspectorCSSAgent::didModifyDOMAttr):
2391         Change to take a reference and more data to avoid extra work.
2392
2393         * inspector/InspectorDOMAgent.h:
2394         * inspector/InspectorDOMAgent.cpp:
2395         (WebCore::InspectorDOMAgent::unbind):
2396         Eliminated didRemoveDocument.
2397
2398         (WebCore::InspectorDOMAgent::didModifyDOMAttr):
2399         (WebCore::InspectorDOMAgent::didRemoveDOMAttr):
2400         (WebCore::InspectorDOMAgent::styleAttributeInvalidated):
2401         Pass a references to the DOM listener client, these are never null.
2402
2403 2017-01-04  Myles C. Maxfield  <mmaxfield@apple.com>
2404
2405         Remove runtime flag for variation fonts
2406         https://bugs.webkit.org/show_bug.cgi?id=164251
2407
2408         Reviewed by Dean Jackson.
2409
2410         No new tests because there is no behavior change, but updated the following
2411         tests to stop setting the flag:
2412         - animations/font-variations/font-variation-settings-order.html:
2413         - animations/font-variations/font-variation-settings-unlike.html:
2414         - animations/font-variations/font-variation-settings.html:
2415         - fast/text/variations/duplicate.html:
2416         - fast/text/variations/exist.html:
2417         - fast/text/variations/getComputedStyle.html:
2418         - fast/text/variations/inheritance.html:
2419         - fast/text/variations/order.html:
2420         - fast/text/variations/outofbounds.html:
2421
2422         * css/CSSComputedStyleDeclaration.cpp:
2423         (WebCore::ComputedStyleExtractor::propertyValue):
2424         * css/parser/CSSParser.cpp:
2425         (WebCore::CSSParserContext::CSSParserContext):
2426         (WebCore::operator==):
2427         * css/parser/CSSParserMode.h:
2428         (WebCore::CSSParserContext::completeURL):
2429         (WebCore::CSSParserContextHash::hash):
2430         * css/parser/CSSPropertyParser.cpp:
2431         (WebCore::CSSPropertyParser::parseSingleValue):
2432         * page/Settings.in:
2433         * testing/InternalSettings.cpp:
2434         (WebCore::InternalSettings::Backup::Backup):
2435         (WebCore::InternalSettings::Backup::restoreTo):
2436         (WebCore::InternalSettings::variationFontsEnabled): Deleted.
2437         (WebCore::InternalSettings::setVariationFontsEnabled): Deleted.
2438         * testing/InternalSettings.h:
2439         * testing/InternalSettings.idl:
2440
2441 2017-01-04  Andy Estes  <aestes@apple.com>
2442
2443         [Cocoa] Teach SharedBuffer to return an NSArray of data segments to avoid flattening
2444         https://bugs.webkit.org/show_bug.cgi?id=166696
2445
2446         Reviewed by Tim Horton.
2447
2448         Existing methods of extracting NSData from a SharedBuffer require either merging or copying
2449         data segments. Since data segments are stored in CFDataRefs on Cocoa platforms, it should be
2450         possible to retrieve an NSArray of the segments without having to first flatten to a single
2451         buffer.
2452
2453         This patch implements such a method. This will be used in a follow-on patch, where I will
2454         need to pass SharedBuffer data to QuickLook via an NSArray of NSData.
2455
2456         New API test: SharedBufferTest.createNSDataArray.
2457
2458         * platform/SharedBuffer.h: Declared createNSArrayData(), and exported two functions needed
2459         by the API test.
2460         * platform/cocoa/SharedBufferCocoa.mm:
2461         (WebCore::SharedBuffer::createNSDataArray): Added. Returns m_cfData or a copy of m_fileData
2462         if either exist. Otherwise, adds m_buffer (wrapped in a WebCoreSharedBufferData object) and
2463         the objects in m_dataArray to a NSMutableArray and returns it.
2464
2465 2017-01-04  Ryan Haddad  <ryanhaddad@apple.com>
2466
2467         Unreviewed, rolling out r210296.
2468
2469         This change broke macOS builds.
2470
2471         Reverted changeset:
2472
2473         "Check for the existence of
2474         AVSampleBufferDisplayLayer_Private.h in AVFoundationSPI.h"
2475         https://bugs.webkit.org/show_bug.cgi?id=166691
2476         http://trac.webkit.org/changeset/210296
2477
2478 2017-01-04  Ryan Haddad  <ryanhaddad@apple.com>
2479
2480         Unreviewed, rolling out r210287.
2481
2482         This change caused editing test failures on macOS.
2483
2484         Reverted changeset:
2485
2486         "Support File Promise during drag for macOS."
2487         https://bugs.webkit.org/show_bug.cgi?id=165204
2488         http://trac.webkit.org/changeset/210287
2489
2490 2017-01-04  Jer Noble  <jer.noble@apple.com>
2491
2492         Check for the existence of AVSampleBufferDisplayLayer_Private.h in AVFoundationSPI.h
2493         https://bugs.webkit.org/show_bug.cgi?id=166691
2494
2495         Reviewed by Eric Carlson.
2496
2497         Move the declaration of AVSampleBufferDisplayLayer SPI into AVFoundationSPI.h and key off the presence of the _Private.h header.
2498
2499         Drive-by Fix: also check for the presence of AVSampleBufferRenderSynchronizer.h before re-declaring AVSampleBufferRenderSynchronizer.
2500
2501         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
2502         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
2503         * platform/spi/mac/AVFoundationSPI.h:
2504
2505 2017-01-04  Nan Wang  <n_wang@apple.com>
2506
2507         Many new HTML5 input types still exposed as generic AXTextfield
2508         https://bugs.webkit.org/show_bug.cgi?id=109017
2509         <rdar://problem/13658955>
2510
2511         Reviewed by Chris Fleizach.
2512
2513         Provided more detailed role description for input types that
2514         are exposed as standard text fields on the mac.
2515
2516         Changes are covered in modified test expectation.
2517
2518         * English.lproj/Localizable.strings:
2519         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
2520         (-[WebAccessibilityObjectWrapper roleDescription]):
2521         * platform/LocalizedStrings.cpp:
2522         (WebCore::AXDateTimeFieldText):
2523         (WebCore::AXMonthFieldText):
2524         (WebCore::AXNumberFieldText):
2525         (WebCore::AXWeekFieldText):
2526         * platform/LocalizedStrings.h:
2527         * platform/efl/LocalizedStringsEfl.cpp:
2528         (WebCore::AXDateTimeFieldText):
2529         (WebCore::AXMonthFieldText):
2530         (WebCore::AXNumberFieldText):
2531         (WebCore::AXWeekFieldText):
2532         * platform/gtk/LocalizedStringsGtk.cpp:
2533         (WebCore::AXDateTimeFieldText):
2534         (WebCore::AXMonthFieldText):
2535         (WebCore::AXNumberFieldText):
2536         (WebCore::AXWeekFieldText):
2537
2538 2017-01-04  Sam Weinig  <sam@webkit.org>
2539
2540         Remove bindings/generic and distribute its contents appropriately
2541         https://bugs.webkit.org/show_bug.cgi?id=166700
2542
2543         Rubber-stamped by Alex Christensen.
2544
2545         * CMakeLists.txt:
2546         * DerivedSources.make:
2547         * PlatformMac.cmake:
2548         * PlatformWin.cmake:
2549         * WebCore.xcodeproj/project.pbxproj:
2550         * bindings/IDLTypes.h: Copied from Source/WebCore/bindings/generic/IDLTypes.h.
2551         * bindings/generic/ActiveDOMCallback.cpp: Removed.
2552         * bindings/generic/ActiveDOMCallback.h: Removed.
2553         * bindings/generic/IDLTypes.h: Removed.
2554         * bindings/generic/RuntimeEnabledFeatures.cpp: Removed.
2555         * bindings/generic/RuntimeEnabledFeatures.h: Removed.
2556         * dom/ActiveDOMCallback.cpp: Copied from Source/WebCore/bindings/generic/ActiveDOMCallback.cpp.
2557         * dom/ActiveDOMCallback.h: Copied from Source/WebCore/bindings/generic/ActiveDOMCallback.h.
2558         * page/RuntimeEnabledFeatures.cpp: Copied from Source/WebCore/bindings/generic/RuntimeEnabledFeatures.cpp.
2559         * page/RuntimeEnabledFeatures.h: Copied from Source/WebCore/bindings/generic/RuntimeEnabledFeatures.h.
2560         Move files around.
2561
2562 2017-01-04  Sam Weinig  <sam@webkit.org>
2563
2564         Add Exception accessor to ExceptionOr to remove unnecessary releases
2565         https://bugs.webkit.org/show_bug.cgi?id=166692
2566
2567         Reviewed by Alex Christensen.
2568
2569         * Modules/webdatabase/DatabaseManager.cpp:
2570         (WebCore::DatabaseManager::openDatabaseBackend):
2571         Use new exception() function.
2572
2573         * dom/ExceptionOr.h:
2574         (WebCore::ExceptionOr<ReturnType>::exception):
2575         (WebCore::ExceptionOr<void>::exception):
2576         Add exception() function which returns the exception without releasing it.
2577
2578 2016-01-04  Brent Fulgham  <bfulgham@apple.com>
2579
2580         Correct DOMWindow handling during FrameLoader::clear
2581         https://bugs.webkit.org/show_bug.cgi?id=166357
2582         <rdar://problem/29741862>
2583
2584         Reviewed by Andy Estes.
2585
2586         Make sure that we always clean up the DOM window when clearing Window properties, even if the document will
2587         remain in the page cache. Since 'clearWindowShell' is only used in FrameLoader, divide it's beahvior into
2588         two steps:
2589         
2590         1. Rename 'clearWindowShell' to 'clearWIndowShellsNotMatchingDOMWindow' to better describe its function.
2591         Switch to a modern C++ loop. Do not switch to the new DOMWindow here, but detach and clear existing
2592         DOMWindow connections.
2593
2594         2. Add a new method 'setDOMWindowForWindowShell'. Complete switch to the new DOMWindow.
2595
2596         This change allows us to disconnect the old DOMWindow, perform the 'setDocument(nullptr)' operation, and then
2597         connect to the new Window without leaving the loader in an inconsistent state.
2598
2599         * loader/bindings/js/ScriptController.cpp:
2600         (WebCore::clearWindowShellsNotMatchingDOMWindow): Renamed from 'clearWindowShell'
2601         (WebCore::setDOMWindowForWindowShell): Added.
2602         * loader/bindings/js/ScriptController.h:
2603         * loader/FrameLoader.cpp:
2604         (WebCore::FrameLoader::clear): Revise to use the new two-step DOMWindow switch logic.
2605
2606 2017-01-04  Enrica Casucci  <enrica@apple.com>
2607
2608         Support File Promise during drag for macOS.
2609         https://bugs.webkit.org/show_bug.cgi?id=165204
2610         rdar://problem/19595567
2611
2612         Reviewed by Tim Horton.
2613
2614         Adds the support for handling File Promise type during
2615         drag. DragData now has the knowledge of the NSFilesPromisePboardType and
2616         checks for the data type during drag.
2617
2618         * page/mac/DragControllerMac.mm:
2619         (WebCore::DragController::dragOperation):
2620         * platform/DragData.h:
2621         (WebCore::DragData::setFileNames):
2622         (WebCore::DragData::fileNames):
2623         * platform/mac/DragDataMac.mm:
2624         (WebCore::DragData::containsFiles):
2625         (WebCore::DragData::numberOfFiles):
2626         (WebCore::DragData::asFilenames):
2627         (WebCore::DragData::containsCompatibleContent):
2628         (WebCore::DragData::containsPromise):
2629         (WebCore::DragData::asURL):
2630
2631 2017-01-04  Chris Dumez  <cdumez@apple.com>
2632
2633         Assertion hit on redfin.com: ASSERTION FAILED: collection->length() > 1
2634         https://bugs.webkit.org/show_bug.cgi?id=166687
2635         <rdar://problem/29865854>
2636
2637         Reviewed by Darin Adler.
2638
2639         We were mistakenly calling Document::addWindowNamedItem() / Document::removeWindowNamedItem()
2640         for elements in Shadow DOMs. As a result, the windowNamedItem DocumentOrderedMap would
2641         contain elements in shadow DOMs. This would cause the assertion to be hit in window's
2642         named property getter because of the length mismatch between the windowNamedItem
2643         DocumentOrderedMap and the WindowNameCollection.
2644
2645         Tests: fast/shadow-dom/document-named-property.html
2646                fast/shadow-dom/window-named-property.html
2647
2648         * dom/Element.cpp:
2649         (WebCore::Element::updateNameForDocument):
2650         (WebCore::Element::updateIdForDocument):
2651         * html/HTMLImageElement.cpp:
2652         (WebCore::HTMLImageElement::parseAttribute):
2653         * html/HTMLObjectElement.cpp:
2654         (WebCore::HTMLObjectElement::updateDocNamedItem):
2655
2656 2017-01-04  John Wilander  <wilander@apple.com>
2657
2658         Validate the BCP47-ness of the language string passed to TrackBase::setLanguage()
2659         https://bugs.webkit.org/show_bug.cgi?id=123926
2660
2661         Reviewed by Jer Noble.
2662
2663         Test: media/media-source/only-bcp47-language-tags-accepted-as-valid.html
2664
2665         * html/HTMLMediaElement.cpp:
2666         (WebCore::HTMLMediaElement::configureTextTrackGroup):
2667             Log message now includes the valid BCP 47 language too.
2668         (WebCore::HTMLMediaElement::setSelectedTextTrack):
2669             Now sets preferred language to the valid BCP 47 language.
2670         * html/track/TextTrack.cpp:
2671         (WebCore::TextTrack::setLanguage):
2672             Removed fixme and aligned comments with new behavior.
2673         * html/track/TrackBase.cpp:
2674         (WebCore::TrackBase::TrackBase):
2675             Initializes m_validBCP47Language with language parameter.
2676         (WebCore::isValidBCP47LanguageTag):
2677             New convenience function.
2678         (WebCore::TrackBase::setLanguage):
2679             Sets m_validBCP47Language if the incoming tag is valid.
2680             Produces a console warning if the tag is invalid.
2681             The member m_language is set to the incoming tag regardless.
2682         (WebCore::TrackBase::validBCP47Language):
2683             New getter for valid language tag. To be used internally.
2684         * html/track/TrackBase.h:
2685             New AtomicString member m_validBCP47Language.
2686         (WebCore::TrackBase::setLanguage): Deleted.
2687         * html/track/VideoTrack.cpp:
2688         (WebCore::VideoTrack::setLanguage):
2689             Removed fixme and aligned comments with new behavior.
2690         * page/CaptionUserPreferences.cpp:
2691         (WebCore::trackDisplayName):
2692             Now uses the getter for BCP 47 language.
2693         (WebCore::CaptionUserPreferences::textTrackLanguageSelectionScore):
2694             Now uses the getter for BCP 47 language.
2695         * page/CaptionUserPreferencesMediaAF.cpp:
2696         (WebCore::buildDisplayStringForTrackBase):
2697             Now uses the getter for BCP 47 language.
2698         (WebCore::CaptionUserPreferencesMediaAF::textTrackSelectionScore):
2699             Now uses the getter for BCP 47 language.
2700         (WebCore::textTrackCompare):
2701             Now uses the getter for BCP 47 language.
2702         (WebCore::CaptionUserPreferencesMediaAF::sortedTrackListForMenu):
2703             Now uses the getter for BCP 47 language.
2704
2705 2017-01-04  Joseph Pecoraro  <pecoraro@apple.com>
2706
2707         Web Inspector: Cross Origin importScripts() scripts lack source URL, causes issues with Inspector showing Resource
2708         https://bugs.webkit.org/show_bug.cgi?id=165569
2709         <rdar://problem/29607569>
2710
2711         Reviewed by Youenn Fablet.
2712
2713         Test: http/tests/inspector/worker/blob-script-with-cross-domain-imported-scripts.html
2714
2715         * Modules/fetch/FetchLoader.cpp:
2716         (WebCore::FetchLoader::start):
2717         * loader/DocumentThreadableLoader.cpp:
2718         (WebCore::DocumentThreadableLoader::didReceiveResponse):
2719         * loader/ThreadableLoader.cpp:
2720         (WebCore::ThreadableLoaderOptions::ThreadableLoaderOptions):
2721         * loader/ThreadableLoader.h:
2722         * loader/WorkerThreadableLoader.cpp:
2723         (WebCore::LoaderTaskOptions::LoaderTaskOptions):
2724         Add a new ThreadableLoader option to avoid filtering the response.
2725
2726         * workers/WorkerScriptLoader.cpp:
2727         (WebCore::WorkerScriptLoader::loadSynchronously):
2728         (WebCore::WorkerScriptLoader::loadAsynchronously):
2729         Disable filtering of the response. This is an internal load, we
2730         don't want to filter data that would be valuable later.
2731
2732 2017-01-03  Sam Weinig  <sam@webkit.org>
2733
2734         Remove final custom binding from IDBRequest
2735         https://bugs.webkit.org/show_bug.cgi?id=166671
2736
2737         Reviewed by Alex Christensen.
2738
2739         * CMakeLists.txt:
2740         * WebCore.xcodeproj/project.pbxproj:
2741         Remove JSIDBRequestCustom.cpp
2742
2743         * bindings/js/JSIDBRequestCustom.cpp: Removed.
2744
2745         * Modules/indexeddb/IDBRequest.cpp:
2746         (WebCore::IDBRequest::IDBRequest):
2747         (WebCore::IDBRequest::~IDBRequest):
2748         (WebCore::IDBRequest::result):
2749         (WebCore::IDBRequest::setSource):
2750         (WebCore::IDBRequest::sourceObjectStoreIdentifier):
2751         (WebCore::IDBRequest::sourceIndexIdentifier):
2752         (WebCore::IDBRequest::requestedIndexRecordType):
2753         (WebCore::IDBRequest::setResult):
2754         (WebCore::IDBRequest::setResultToStructuredClone):
2755         (WebCore::IDBRequest::setResultToUndefined):
2756         (WebCore::IDBRequest::resultCursor):
2757         (WebCore::IDBRequest::willIterateCursor):
2758         (WebCore::IDBRequest::didOpenOrIterateCursor):
2759         (WebCore::IDBRequest::source): Deleted.
2760         (WebCore::IDBRequest::clearResult): Deleted.
2761         * Modules/indexeddb/IDBRequest.h:
2762         (WebCore::IDBRequest::source):
2763         (WebCore::IDBRequest::cursorResult): Deleted.
2764         (WebCore::IDBRequest::databaseResult): Deleted.
2765         (WebCore::IDBRequest::scriptResult): Deleted.
2766         Replace multiple member variables with Variants for source and result. Add a result
2767         member function that properly sets an exception if not "done".
2768
2769         * Modules/indexeddb/IDBRequest.idl:
2770         Remove CustomGetter annotation and add type.
2771
2772         * bindings/generic/IDLTypes.h:
2773         (WebCore::IDLAny::nullValue):
2774         (WebCore::IDLAny::isNullValue):
2775         (WebCore::IDLAny::extractValueFromNullable):
2776         * bindings/js/JSDOMConvert.h:
2777         (WebCore::Converter<IDLAny>::convert):
2778         Flesh out IDLAny to be implemented as a Strong<Unknown> when used in aggregate types,
2779         but still work with JSValue when passing as a parameter.
2780
2781         * inspector/InspectorIndexedDBAgent.cpp:
2782         Update for new return value of IDBRequest::result().
2783
2784 2017-01-04  Tim Horton  <timothy_horton@apple.com>
2785
2786         Provide a setting for clients to always prefer low-power WebGL
2787         https://bugs.webkit.org/show_bug.cgi?id=166675
2788         <rdar://problem/29834093>
2789
2790         Reviewed by Dan Bernstein.
2791
2792         No new tests; as noted in r204664, we don't know how to reliably test
2793         automatic graphics switching. One could use the manual test introduced
2794         in that commit; after this commit, with the setting switched on, on a
2795         dual-GPU machine that is actively using integrated graphics, that test
2796         should return the same result for both contexts.
2797
2798         * page/Settings.in:
2799         Add a setting to prefer low-power WebGL.
2800
2801         * html/canvas/WebGLRenderingContextBase.cpp:
2802         (WebCore::WebGLRenderingContextBase::create):
2803         If said setting is enabled, set preferLowPowerToHighPerformance.
2804
2805 2017-01-03  Ryosuke Niwa  <rniwa@webkit.org>
2806
2807         label element with tabindex >= 0 is not focusable
2808         https://bugs.webkit.org/show_bug.cgi?id=102780
2809         <rdar://problem/29796608>
2810
2811         Reviewed by Darin Adler.
2812
2813         Fixed the bug by removing the override for HTMLLabelElement::isFocusable which always returned false.
2814
2815         This is a behavior from r5532 but it doesn't match the latest HTML specification or that of Chrome
2816         and Firefox.
2817
2818         Also fixed an existing bug in HTMLLabelElement::focus and HTMLLegendElement::focus which focused
2819         the associated form control when there is one even if the element itself is focusable. Without this fix,
2820         traversing from control with shift+tab would break since focusing the label would move the focus back
2821         to the input element inside the label element.
2822
2823         Finally, fixed a bug in HTMLLegendElement::focus that we can call inFocus without updating layout first.
2824
2825         The fix was inspired by https://chromium.googlesource.com/chromium/src/+/085ad8697b1be50c4f93e296797a25a43a79bcfb
2826
2827         Test: fast/events/focus-label-legend-elements-with-tabindex.html
2828
2829         * html/HTMLLabelElement.cpp:
2830         (WebCore::HTMLLabelElement::focus):
2831         (WebCore::HTMLLabelElement::isFocusable): Deleted.
2832         * html/HTMLLabelElement.h:
2833         * html/HTMLLegendElement.cpp:
2834         (WebCore::HTMLLegendElement::focus):
2835
2836 2017-01-03  Tim Horton  <timothy_horton@apple.com>
2837
2838         NSSpellChecker's recordResponse isn't called for unseen automatic corrections
2839         https://bugs.webkit.org/show_bug.cgi?id=166450
2840         <rdar://problem/29447824>
2841
2842         Reviewed by Darin Adler.
2843
2844         Test: editing/mac/spelling/accept-unseen-candidate-records-acceptance.html
2845
2846         * editing/AlternativeTextController.cpp:
2847         (WebCore::AlternativeTextController::recordAutocorrectionResponse):
2848         (WebCore::AlternativeTextController::recordAutocorrectionResponseReversed): Deleted.
2849         * editing/AlternativeTextController.h:
2850         Add recordAutocorrectionResponse, which takes a AutocorrectionResponseType, instead of having
2851         a function specifically for reverted autocorrections. Also, get rid of the unnecessary indirection
2852         of the private overload of recordAutocorrectionResponseReversed, since there's only one caller.
2853
2854         * editing/Editor.cpp:
2855         (WebCore::Editor::markAndReplaceFor):
2856         Call recordAutocorrectionResponse with Accepted when performing an auto-autocorrection.
2857
2858         (WebCore::Editor::changeBackToReplacedString):
2859         Adopt recordAutocorrectionResponse.
2860
2861         * page/AlternativeTextClient.h:
2862         Add an "AutocorrectionAccepted" response type.
2863
2864 2017-01-03  Nan Wang  <n_wang@apple.com>
2865
2866         AX: Focus should jump into modal dialogs when one appears
2867         https://bugs.webkit.org/show_bug.cgi?id=166670
2868
2869         Reviewed by Chris Fleizach.
2870
2871         Added a timer to let focus jump into a modal dialog if the web
2872         author didn't handle the focus movement.
2873
2874         Test: accessibility/mac/aria-modal-auto-focus.html
2875
2876         * accessibility/AXObjectCache.cpp:
2877         (WebCore::AXObjectCache::AXObjectCache):
2878         (WebCore::AXObjectCache::~AXObjectCache):
2879         (WebCore::firstFocusableChild):
2880         (WebCore::AXObjectCache::focusAriaModalNode):
2881         (WebCore::AXObjectCache::focusAriaModalNodeTimerFired):
2882         (WebCore::AXObjectCache::handleAriaModalChange):
2883         * accessibility/AXObjectCache.h:
2884         (WebCore::AXObjectCache::focusAriaModalNode):
2885
2886 2017-01-03  Andy Estes  <aestes@apple.com>
2887
2888         Rename SharedBufferMac.mm to SharedBufferCocoa.mm
2889         https://bugs.webkit.org/show_bug.cgi?id=166666
2890
2891         Reviewed by Tim Horton.
2892
2893         * PlatformMac.cmake:
2894         * WebCore.xcodeproj/project.pbxproj:
2895         * platform/cocoa/SharedBufferCocoa.mm: Renamed from Source/WebCore/platform/mac/SharedBufferMac.mm.
2896
2897 2017-01-03  Sam Weinig  <sam@webkit.org>
2898
2899         Re-implement ExceptionOr on top of WTF::Expected
2900         https://bugs.webkit.org/show_bug.cgi?id=166668
2901
2902         Reviewed by Alex Christensen.
2903
2904         As a first step towards using WTF::Expected instead of ExceptionOr,
2905         use Expected as an implementation detail, rather than Variant/std::optional. 
2906
2907         * crypto/algorithms/CryptoAlgorithmAES_KW.cpp:
2908         * crypto/algorithms/CryptoAlgorithmHMAC.cpp:
2909         * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp:
2910         * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp:
2911         * crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp:
2912         Add missing #include of Variant.h
2913
2914         * dom/ExceptionOr.h:
2915         (WebCore::ExceptionOr<ReturnType>::ExceptionOr):
2916         (WebCore::ExceptionOr<ReturnType>::hasException):
2917         (WebCore::ExceptionOr<ReturnType>::releaseException):
2918         (WebCore::ExceptionOr<ReturnType>::releaseReturnValue):
2919         (WebCore::ExceptionOr<void>::ExceptionOr):
2920         (WebCore::ExceptionOr<void>::hasException):
2921         (WebCore::ExceptionOr<void>::releaseException):
2922         Re-implement on top of Expected.
2923
2924 2017-01-03  Chris Dumez  <cdumez@apple.com>
2925
2926         Make setting Event's cancelBubble to false a no-op
2927         https://bugs.webkit.org/show_bug.cgi?id=166018
2928
2929         Reviewed by Ryosuke Niwa.
2930
2931         Align behavior of Event.cancelBubble with the latest DOM specification:
2932         - https://dom.spec.whatwg.org/#dom-event-cancelbubble
2933
2934         Setting it to true sets the 'stop propagation' flag to true and setting
2935         it to false is now a no-op.
2936
2937         Tests: imported/w3c/web-platform-tests/dom/events/Event-cancelBubble.html
2938                imported/w3c/web-platform-tests/dom/events/Event-dispatch-bubble-canceled.html
2939                imported/w3c/web-platform-tests/dom/events/Event-dispatch-multiple-cancelBubble.html
2940
2941         * Modules/indexeddb/IDBEventDispatcher.cpp:
2942         (WebCore::IDBEventDispatcher::dispatch):
2943         * dom/Event.h:
2944         (WebCore::Event::cancelBubble):
2945         (WebCore::Event::setCancelBubble):
2946         * dom/EventDispatcher.cpp:
2947         (WebCore::dispatchEventInDOM):
2948
2949 2017-01-03  Jer Noble  <jer.noble@apple.com>
2950
2951         Check for the existence of AVSampleBufferAudioRenderer.h before redeclaring AVSampleBufferAudioRenderer
2952         https://bugs.webkit.org/show_bug.cgi?id=166421
2953         <rdar://problem/29782862>
2954
2955         Reviewed by Dan Bernstein.
2956
2957         Follow up after r210099; fix the __has_include directive to include the framework and fix the #import inside #if.
2958
2959         * platform/spi/mac/AVFoundationSPI.h:
2960
2961 2017-01-03  Andreas Kling  <akling@apple.com>
2962
2963         REGRESSION(r210226): fast/history/back-from-page-with-focused-iframe.html crashes under GuardMalloc
2964         <https://webkit.org/b/166657>
2965         <rdar://problem/29848806>
2966
2967         Reviewed by Antti Koivisto.
2968
2969         The problem was that tearDownRenderers() would cause commit Widget hierarchy updates
2970         before returning, which is just before Document clears its m_renderView pointer.
2971         This led to an awkward callback into Page::setActivityState() which ended up trying
2972         to clear the selection inside a partially dead render tree.
2973
2974         Fix this by adding a WidgetHierarchyUpdatesSuspensionScope to Document::destroyRenderTree()
2975         which ensures that Widget updates don't happen until after Document::m_renderView is cleared.
2976
2977         * dom/Document.cpp:
2978         (WebCore::Document::destroyRenderTree):
2979
2980 2017-01-03  Andreas Kling  <akling@apple.com>
2981
2982         Placeholder style mechanism leaks CSSFontSelector for first Document styled.
2983         <https://webkit.org/b/166652>
2984
2985         Reviewed by Antti Koivisto.
2986
2987         The placeholder style is used when we're resolving style for a non-rendered
2988         element, or any element before stylesheets have loaded.
2989
2990         An old optimization had us reusing the same style each time, which meant that
2991         since it was initialized with a font selector the first time, it kept that
2992         font selector alive forever.
2993
2994         As we have to clone the style anyway, fix this by just making a new style
2995         each time, using the current document's font selector.
2996
2997         * style/StyleTreeResolver.cpp:
2998         (WebCore::Style::makePlaceholderStyle):
2999         (WebCore::Style::TreeResolver::TreeResolver):
3000         (WebCore::Style::TreeResolver::styleForElement):
3001         (WebCore::Style::ensurePlaceholderStyle): Deleted.
3002         (WebCore::Style::isPlaceholderStyle): Deleted.
3003         * style/StyleTreeResolver.h:
3004
3005 2017-01-03  Carlos Alberto Lopez Perez  <clopez@igalia.com>
3006
3007         A floating element within <li> overlaps with the marker
3008         https://bugs.webkit.org/show_bug.cgi?id=166528
3009
3010         Reviewed by Zalan Bujtas.
3011
3012         Merged from Blink (patch by trobhogan@gmail.com):
3013         https://crrev.com/c896e79e5ba348d7ed87438cd3a19d0176f3036d
3014         https://crbug.com/548616
3015
3016         Establish a list marker's offset before floats have been added to its line.
3017
3018         Computing the offset for a list marker after the rest of the objects on the line
3019         it is on have been laid out, means it will avoid floats it ought not to.
3020
3021         Instead, compute the offset when laying out the marker and cache it for use later.
3022
3023         Tests: fast/lists/list-marker-before-float-nested-rtl.html
3024                fast/lists/list-marker-before-float-nested.html
3025                fast/lists/list-marker-before-float-rtl.html
3026                fast/lists/list-marker-before-float.html
3027
3028         * rendering/RenderListItem.cpp:
3029         (WebCore::RenderListItem::positionListMarker):
3030         * rendering/RenderListMarker.cpp:
3031         (WebCore::RenderListMarker::RenderListMarker):
3032         (WebCore::RenderListMarker::layout):
3033         * rendering/RenderListMarker.h:
3034
3035 2017-01-03  Per Arne Vollan  <pvollan@apple.com>
3036
3037         [Win] Some xmlhttprequest tests are failing.
3038         https://bugs.webkit.org/show_bug.cgi?id=166638
3039
3040         Reviewed by Darin Adler.
3041
3042         The tests are failing because the request timeout is set to zero.
3043         When the timeout is set to zero, we should use the default timeout.
3044
3045         * platform/network/cf/ResourceRequestCFNet.cpp:
3046         (WebCore::ResourceRequest::doUpdatePlatformRequest):
3047         (WebCore::ResourceRequest::doUpdatePlatformHTTPBody):
3048
3049 2017-01-02  Yusuke Suzuki  <utatane.tea@gmail.com>
3050
3051         Unreviewed, follow-up fix for r210227
3052         https://bugs.webkit.org/show_bug.cgi?id=166586
3053
3054         Suggested in the above bug.
3055
3056         * bindings/scripts/StaticString.pm:
3057         (GenerateStrings):
3058
3059 2017-01-02  Yusuke Suzuki  <utatane.tea@gmail.com>
3060
3061         Use StaticStringImpl instead of StaticASCIILiteral
3062         https://bugs.webkit.org/show_bug.cgi?id=166586
3063
3064         Reviewed by Darin Adler.
3065
3066         * bindings/scripts/StaticString.pm:
3067         (GenerateStrings):
3068
3069 2017-01-02  Andreas Kling  <akling@apple.com>
3070
3071         Drop the render tree for documents in the page cache.
3072         <https://webkit.org/b/121798>
3073
3074         Reviewed by Antti Koivisto.
3075
3076         To save memory and reduce complexity, have documents tear down their render tree
3077         when entering the page cache. I've wanted to do this for a long time and it seems
3078         like we can actually do it now.
3079
3080         This patch will enable a number of clean-ups since it's no longer valid for renderers
3081         to exist while the document is in page cache.
3082
3083         * dom/Document.cpp:
3084         (WebCore::Document::destroyRenderTree): Remove assertion that we're not in the page cache
3085         since we will now be tearing down render trees right as they enter the page cache.
3086
3087         * dom/PageCache.cpp:
3088         (WebCore::destroyRenderTree):
3089         (WebCore::PageCache::addIfCacheable): Tear down the render tree right before setting
3090         the in-cache flag. The render tree is destroyed in bottom-up order to ensure that the
3091         main frame renderers die last.
3092
3093         * history/CachedFrame.cpp:
3094         (WebCore::CachedFrameBase::restore):
3095         * page/FrameView.h:
3096         * page/FrameView.cpp:
3097         (WebCore::FrameView::didRestoreFromPageCache): Update the scollable area set after restoring
3098         a frame from the page cache. This dirties the scrolling tree, which was covered by tests.
3099
3100         * page/animation/AnimationBase.cpp:
3101         (WebCore::AnimationBase::setNeedsStyleRecalc):
3102         * page/animation/AnimationController.cpp:
3103         (WebCore::AnimationController::cancelAnimations): Make these no-ops if called
3104         while the render tree is being torn down. This fixes some assertion failures
3105         on layout tests and avoids pointless style invalidation.
3106
3107 2017-01-02  Andreas Kling  <akling@apple.com>
3108
3109         Discard media controls JS/CSS caches under memory pressure.
3110         <https://webkit.org/b/166639>
3111
3112         Reviewed by Antti Koivisto.
3113
3114         Add a RenderTheme::purgeCaches() virtual and teach the iOS and macOS implementations
3115         to drop their cached media controls JS/CSS strings there. The strings are only cleared
3116         if nothing else is referencing them, which gives us a decent "weak cache" behavior.
3117
3118         This sheds ~300kB memory on iOS with the current media controls.
3119
3120         * page/MemoryRelease.cpp:
3121         (WebCore::releaseNoncriticalMemory):
3122         * rendering/RenderTheme.h:
3123         (WebCore::RenderTheme::purgeCaches):
3124         * rendering/RenderThemeIOS.h:
3125         * rendering/RenderThemeIOS.mm:
3126         (WebCore::RenderThemeIOS::purgeCaches):
3127         * rendering/RenderThemeMac.h:
3128         * rendering/RenderThemeMac.mm:
3129         (WebCore::RenderThemeMac::purgeCaches):
3130
3131 2017-01-02  Carlos Garcia Campos  <cgarcia@igalia.com>
3132
3133         [GTK] Since the memory pressure relief has been activated, my disk has a high usage and the desktop stalls
3134         https://bugs.webkit.org/show_bug.cgi?id=164052
3135
3136         Reviewed by Michael Catanzaro.
3137
3138         Check how much memory is freed by the memory pressure handler and wait for a long time if we didn't free that
3139         much.
3140
3141         * platform/linux/MemoryPressureHandlerLinux.cpp:
3142         (WebCore::MemoryPressureHandler::EventFDPoller::EventFDPoller):
3143
3144 2017-01-02  Chris Fleizach  <cfleizach@apple.com>
3145
3146         AX: Expose block quote level to iOS API
3147         https://bugs.webkit.org/show_bug.cgi?id=166629
3148         <rdar://problem/29834793>
3149
3150         Reviewed by Darin Adler.
3151
3152         Expose the blockquote level to iOS Accessbility API.
3153         Change the return type of blockquote level to unsigned.
3154
3155         Test: accessibility/ios-simulator/blockquote-level.html
3156
3157         * accessibility/AccessibilityObject.cpp:
3158         (WebCore::AccessibilityObject::blockquoteLevel):
3159         * accessibility/AccessibilityObject.h:
3160         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
3161         (-[WebAccessibilityObjectWrapper accessibilityBlockquoteLevel]):
3162         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
3163         (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
3164
3165 2017-01-01  Jeff Miller  <jeffm@apple.com>
3166
3167         Update user-visible copyright strings to include 2017
3168         https://bugs.webkit.org/show_bug.cgi?id=166278
3169
3170         Reviewed by Dan Bernstein.
3171
3172         * Info.plist:
3173
3174 2017-01-01  Zan Dobersek  <zdobersek@igalia.com>
3175
3176         GraphicsContextCairo: setMiterLimit() is missing the DisplayListRecorder diversion
3177         https://bugs.webkit.org/show_bug.cgi?id=166539
3178
3179         Reviewed by Michael Catanzaro.
3180
3181         * platform/graphics/cairo/GraphicsContextCairo.cpp:
3182         (WebCore::GraphicsContext::setMiterLimit): Call the setMiterLimit() method on the
3183         m_displayListRecorder object when the GraphicsContext object is in recording mode.
3184
3185 2017-01-01  Zan Dobersek  <zdobersek@igalia.com>
3186
3187         Clean up GraphicsContext3D forward declarations, header inclusion
3188         https://bugs.webkit.org/show_bug.cgi?id=166537
3189
3190         Reviewed by Alex Christensen.
3191
3192         Remove two unnecessary GraphicsContext3D forward declarations from the
3193         EmptyClients and ChromeClient header files, and remove the unnecessary
3194         GraphicsContext3D.h header inclusion from RenderLayerBacking.
3195
3196         No changes in behavior.
3197
3198         * loader/EmptyClients.h:
3199         * page/ChromeClient.h:
3200         * rendering/RenderLayerBacking.cpp:
3201
3202 2016-12-31  Michael Catanzaro  <mcatanzaro@igalia.com>
3203
3204         SecurityOrigin::create triplet constructor does not canonicalize port
3205         https://bugs.webkit.org/show_bug.cgi?id=166624
3206
3207         Reviewed by Daniel Bates.
3208
3209         It is currently possible to create two different unequal SecurityOrigin objects that
3210         represent the same security origin. The SecurityOrigin create functions that take URL and
3211         String parameters convert the port to nullopt if it is the default port for the protocol,
3212         but the separate protocol/host/port constructor doesn't. Change it to parallel the other
3213         constructors.
3214
3215         * page/SecurityOrigin.cpp:
3216         (WebCore::SecurityOrigin::create):
3217         * page/SecurityOrigin.h: Export isSameOriginAs for use by tests.
3218
3219 2016-12-25  Darin Adler  <darin@apple.com>
3220
3221         Remove setDOMException and a few custom bindings
3222         https://bugs.webkit.org/show_bug.cgi?id=166002
3223
3224         Reviewed by Sam Weinig.
3225
3226         * CMakeLists.txt: Removed JSFileReaderCustom.cpp.
3227
3228         * WebCore.xcodeproj/project.pbxproj: Removed JSFileReaderCustom.cpp.
3229
3230         * bindings/js/CallbackFunction.cpp:
3231         (WebCore::checkFunctionOnlyCallback): Use throwTypeMismatchError instead
3232         of calling setDOMException with TYPE_MISMATCH_ERR.
3233
3234         * bindings/js/JSBindingsAllInOne.cpp: Removed JSFileReaderCustom.cpp.
3235
3236         * bindings/js/JSCSSStyleDeclarationCustom.cpp:
3237         (WebCore::JSCSSStyleDeclaration::putDelegate): Pass a throw scope in to
3238         propagateException.
3239
3240         * bindings/js/JSCryptoAlgorithmDictionary.cpp:
3241         (WebCore::JSCryptoAlgorithmDictionary::parseAlgorithmIdentifier):
3242         Renamed from getAlgorithmIdentifier. Got rid of bool return value, instead
3243         use a conventional return value and conventional JavaScript exception
3244         handling. Added a ThrowScope argument.
3245         (WebCore::optionalHashAlgorithm): Added. Returns an optional hash algorithm.
3246         Also makes the same changes as above, conventional exception handling and
3247         ThrowScope argument.
3248         (WebCore::requiredHashAlgorithm): Added. Like the above but throws an
3249         exception if the algorithm is omitted.
3250         (WebCore::getHashAlgorithm): Deleted. Replaced by the two functions above.
3251         (WebCore::createAesCbcParams): Updated for above changes.
3252         (WebCore::createHmacParams): Ditto.
3253         (WebCore::createHmacKeyParams): Ditto.
3254         (WebCore::createRsaKeyGenParams): Ditto.
3255         (WebCore::createRsaOaepParams): Ditto.
3256         (WebCore::createRsaSsaParams): Ditto.
3257         (WebCore::JSCryptoAlgorithmDictionary::createParametersForEncrypt): Added
3258         a ThrowScope argument, and changed to use throwNotSupportedError instead
3259         of setDOMException with NOT_SUPPORTED_ERROR.
3260         (WebCore::JSCryptoAlgorithmDictionary::createParametersForDecrypt): Ditto.
3261         (WebCore::JSCryptoAlgorithmDictionary::createParametersForSign): Ditto.
3262         (WebCore::JSCryptoAlgorithmDictionary::createParametersForVerify):
3263         (WebCore::JSCryptoAlgorithmDictionary::createParametersForDigest): Ditto.
3264         (WebCore::JSCryptoAlgorithmDictionary::createParametersForGenerateKey): Ditto.
3265         (WebCore::JSCryptoAlgorithmDictionary::createParametersForDeriveKey): Ditto.
3266         (WebCore::JSCryptoAlgorithmDictionary::createParametersForDeriveBits): Ditto.
3267         (WebCore::JSCryptoAlgorithmDictionary::createParametersForImportKey): Ditto.
3268         (WebCore::JSCryptoAlgorithmDictionary::createParametersForExportKey): Ditto.
3269         * bindings/js/JSCryptoAlgorithmDictionary.h: Updated for the above changes.
3270
3271         * bindings/js/JSCryptoOperationData.cpp:
3272         (WebCore::cryptoOperationDataFromJSValue): Got rid of bool return value and
3273         instead use a conventional return value and conventional JS exception handling.
3274         Added a ThrowScope argument.
3275         * bindings/js/JSCryptoOperationData.h: Updated for the above.
3276
3277         * bindings/js/JSCustomXPathNSResolver.cpp:
3278         (WebCore::JSCustomXPathNSResolver::create): Use ExceptionOr.
3279         (WebCore::JSCustomXPathNSResolver::JSCustomXPathNSResolver): Take a VM&
3280         rather than an ExecState*.
3281         * bindings/js/JSCustomXPathNSResolver.h: Updated for the changes above.
3282         Also marked class final and fixed indentation.
3283
3284         * bindings/js/JSDOMBinding.cpp:
3285         (WebCore::createDOMException): Updated comment.
3286         (WebCore::throwDOMException): Deleted.
3287         (WebCore::propagateException): Deleted non-inline overload that does not take
3288         a throw scope, now that all callers pass a throw scope.
3289         (WebCore::setDOMExceptionSlow): Deleted.
3290         (WebCore::setDOMException): Deleted.
3291         (WebCore::throwNotSupportedError): Added.
3292         (WebCore::throwDOMSyntaxError): Added.
3293         (WebCore::throwDataCloneError): Added.
3294         (WebCore::throwIndexSizeError): Added.
3295         (WebCore::throwTypeMismatchError): Added.
3296         * bindings/js/JSDOMBinding.h: Updated for the additions and removals
3297         above. Also grouped the standard DOM exception throwing functions separately
3298         from the special ones for getters and setters, and sorted them alphabetically.
3299
3300         * bindings/js/JSDataCueCustom.cpp:
3301         (WebCore::createJSDataCue): Added, helper function for the below.
3302         (WebCore::constructJSDataCue): Tightened and tweaked a bit.
3303
3304         * bindings/js/JSFileReaderCustom.cpp: Removed.
3305
3306         * bindings/js/JSHTMLOptionsCollectionCustom.cpp:
3307         (WebCore::JSHTMLOptionsCollection::setLength): Use throwIndexSizeError instead
3308         of setDOMException with INDEX_SIZE_ERR.
3309         * bindings/js/JSHTMLSelectElementCustom.cpp:
3310         (WebCore::selectElementIndexSetter): Use throwTypeMismatchError instead of
3311         setDOMExceptoin with TYPEMISMATCH_ERR.
3312
3313         * bindings/js/JSIDBRequestCustom.cpp:
3314         (WebCore::JSIDBRequest::result): Pass a throw scope in to
3315         propagateException.
3316
3317         * bindings/js/JSSQLResultSetRowListCustom.cpp:
3318         (WebCore::JSSQLResultSetRowList::item): Use throwTypeMismatchError and
3319         throwIndexSizeError instead of setDOMException with TYPE_MISMATCH_ERR and
3320         INDEX_ERR. This required adding a throw scope.
3321
3322         * bindings/js/JSSQLTransactionCustom.cpp:
3323         (WebCore::JSSQLTransaction::executeSql): Use throwDOMSyntaxError and
3324         throwTypeMismatchError instead of setDOMException with SYNTAX_ERR and
3325         TYPE_MISMATCH_ERR.
3326
3327         * bindings/js/JSStorageCustom.cpp:
3328         (WebCore::JSStorage::nameGetter): Pass a throw scope in to
3329         propagateException.
3330
3331         * bindings/js/JSSubtleCryptoCustom.cpp:
3332         (WebCore::normalizeCryptoAlgorithmParameters): Use throwNotSupportedError
3333         instead of setDOMException with NOT_SUPPORTED_ERR.
3334         (WebCore::createAlgorithm): Deleted.
3335         (WebCore::supportExportKeyThrow): Added ThrowScope argument and use
3336         throwNotSupportedError instead of setDOMException with NOT_SUPPORTED_ERR.
3337         (WebCore::jsSubtleCryptoFunctionEncryptPromise): Updated for above changes,
3338         throwing a not supported exception at this level rather than in a helper.
3339         (WebCore::jsSubtleCryptoFunctionDecryptPromise): Ditto.
3340         (WebCore::jsSubtleCryptoFunctionSignPromise): Ditto.
3341         (WebCore::jsSubtleCryptoFunctionVerifyPromise): Ditto.
3342         (WebCore::jsSubtleCryptoFunctionDigestPromise): Ditto.
3343         (WebCore::jsSubtleCryptoFunctionGenerateKeyPromise): Ditto.
3344         (WebCore::jsSubtleCryptoFunctionImportKeyPromise): Ditto.
3345         (WebCore::jsSubtleCryptoFunctionExportKeyPromise): Ditto.
3346         (WebCore::jsSubtleCryptoFunctionWrapKeyPromise): Ditto.
3347         (WebCore::jsSubtleCryptoFunctionUnwrapKeyPromise): Ditto.
3348
3349         * bindings/js/JSWebKitSubtleCryptoCustom.cpp:
3350         (WebCore::createAlgorithmFromJSValue): Got rid of bool return value and
3351         instead use a conventional return value and conventional JS exception handling.
3352         Added a ThrowScope argument.
3353         (WebCore::cryptoKeyFormatFromJSValue): Ditto.
3354         (WebCore::cryptoKeyUsagesFromJSValue): Ditto.
3355         (WebCore::JSWebKitSubtleCrypto::encrypt): Updated for above changes.
3356         (WebCore::JSWebKitSubtleCrypto::decrypt): Ditto.
3357         (WebCore::JSWebKitSubtleCrypto::sign): Ditto.
3358         (WebCore::JSWebKitSubtleCrypto::verify): Ditto.
3359         (WebCore::JSWebKitSubtleCrypto::digest): Ditto.
3360         (WebCore::JSWebKitSubtleCrypto::generateKey): Ditto.
3361         (WebCore::JSWebKitSubtleCrypto::importKey): Ditto.
3362         (WebCore::JSWebKitSubtleCrypto::exportKey): Ditto.
3363         (WebCore::JSWebKitSubtleCrypto::wrapKey): Ditto.
3364         (WebCore::JSWebKitSubtleCrypto::unwrapKey): Ditto.
3365
3366         * bindings/js/JSXMLHttpRequestCustom.cpp:
3367         (WebCore::JSXMLHttpRequest::send): Pass a throw scope in to
3368         propagateException.
3369         (WebCore::JSXMLHttpRequest::responseText): Ditto.