Drop legacy XPathException type
[WebKit.git] / Source / WebCore / ChangeLog
1 2017-07-20  Chris Dumez  <cdumez@apple.com>
2
3         Drop legacy XPathException type
4         https://bugs.webkit.org/show_bug.cgi?id=174679
5
6         Reviewed by Sam Weinig.
7
8         Drop legacy XPathException type and use DOMException instead. Both Firefox and Chrome
9         no longer expose XPathException.
10
11         Test: fast/dom/DOMException/XPathException-obsolete.html
12
13         * CMakeLists.txt:
14         * DerivedSources.cpp:
15         * DerivedSources.make:
16         * WebCore.xcodeproj/project.pbxproj:
17         * bindings/js/JSDOMExceptionHandling.cpp:
18         (WebCore::createDOMException):
19         * bindings/js/JSExceptionBase.cpp:
20         (WebCore::toExceptionBase):
21         * dom/DOMExceptions.in:
22         * xml/XPathException.cpp: Removed.
23         * xml/XPathException.h: Removed.
24         * xml/XPathException.idl: Removed.
25         * xml/XPathExpression.cpp:
26         (WebCore::XPathExpression::evaluate):
27         * xml/XPathParser.cpp:
28         (WebCore::XPath::Parser::parseStatement):
29         * xml/XPathResult.cpp:
30         (WebCore::XPathResult::convertTo):
31         (WebCore::XPathResult::numberValue):
32         (WebCore::XPathResult::stringValue):
33         (WebCore::XPathResult::booleanValue):
34         (WebCore::XPathResult::singleNodeValue):
35         (WebCore::XPathResult::snapshotLength):
36         (WebCore::XPathResult::iterateNext):
37         (WebCore::XPathResult::snapshotItem):
38
39 2017-07-20  Chris Dumez  <cdumez@apple.com>
40
41         Unreviewed, rolling out r219706.
42
43         Broke iOS build
44
45         Reverted changeset:
46
47         "Drop legacy XPathException type"
48         https://bugs.webkit.org/show_bug.cgi?id=174679
49         http://trac.webkit.org/changeset/219706
50
51 2017-07-20  Chris Dumez  <cdumez@apple.com>
52
53         Drop legacy XPathException type
54         https://bugs.webkit.org/show_bug.cgi?id=174679
55
56         Reviewed by Sam Weinig.
57
58         Drop legacy XPathException type and use DOMException instead. Both Firefox and Chrome
59         no longer expose XPathException.
60
61         Test: fast/dom/DOMException/XPathException-obsolete.html
62
63         * CMakeLists.txt:
64         * DerivedSources.cpp:
65         * DerivedSources.make:
66         * WebCore.xcodeproj/project.pbxproj:
67         * bindings/js/JSDOMExceptionHandling.cpp:
68         (WebCore::createDOMException):
69         * bindings/js/JSExceptionBase.cpp:
70         (WebCore::toExceptionBase):
71         * dom/DOMExceptions.in:
72         * xml/XPathException.cpp: Removed.
73         * xml/XPathException.h: Removed.
74         * xml/XPathException.idl: Removed.
75         * xml/XPathExpression.cpp:
76         (WebCore::XPathExpression::evaluate):
77         * xml/XPathParser.cpp:
78         (WebCore::XPath::Parser::parseStatement):
79         * xml/XPathResult.cpp:
80         (WebCore::XPathResult::convertTo):
81         (WebCore::XPathResult::numberValue):
82         (WebCore::XPathResult::stringValue):
83         (WebCore::XPathResult::booleanValue):
84         (WebCore::XPathResult::singleNodeValue):
85         (WebCore::XPathResult::snapshotLength):
86         (WebCore::XPathResult::iterateNext):
87         (WebCore::XPathResult::snapshotItem):
88
89 2017-07-20  Chris Dumez  <cdumez@apple.com>
90
91         Regression(ITP): May get frequently logged out of wsj.com
92         https://bugs.webkit.org/show_bug.cgi?id=174661
93         <rdar://problem/32343256>
94
95         Reviewed by Geoffrey Garen.
96
97         Add the concept of associated domains in the ResourceLoadObserver. We
98         previously ignore loads to and from the same domains. We now do the same
99         if the to and from domains are associated (i.e. owned by the same entity).
100
101         For now, only add domains owned by Dow Jones & Company, Inc. to the list,
102         to address login issues on wsj.com.
103
104         No new tests, verified manually on wsj.com.
105
106         * loader/ResourceLoadObserver.cpp:
107         (WebCore::areDomainsAssociated):
108         (WebCore::ResourceLoadObserver::logFrameNavigation):
109         (WebCore::ResourceLoadObserver::logSubresourceLoading):
110         (WebCore::ResourceLoadObserver::logWebSocketLoading):
111
112 2017-07-20  Chris Dumez  <cdumez@apple.com>
113
114         Replace calls to Vector::resize() with calls to more efficient shrink() / grow() when applicable
115         https://bugs.webkit.org/show_bug.cgi?id=174660
116
117         Reviewed by Geoffrey Garen.
118
119         Replace calls to Vector::resize() with calls to more efficient shrink() / grow() when applicable.
120         This essentially replaces a branch to figure out if the new size is less or greater than the
121         current size by an assertion.
122
123         * Modules/gamepad/Gamepad.cpp:
124         (WebCore::Gamepad::Gamepad):
125         * Modules/webaudio/AudioContext.cpp:
126         (WebCore::AudioContext::addReaction):
127         * Modules/websockets/WebSocketChannel.cpp:
128         (WebCore::WebSocketChannel::skipBuffer):
129         * Modules/websockets/WebSocketDeflater.cpp:
130         (WebCore::WebSocketDeflater::finish):
131         * contentextensions/ContentExtensionCompiler.cpp:
132         (WebCore::ContentExtensions::serializeSelector):
133         * contentextensions/DFABytecodeCompiler.cpp:
134         (WebCore::ContentExtensions::append):
135         * crypto/gcrypt/CryptoAlgorithmAES_CBCGCrypt.cpp:
136         (WebCore::gcryptEncrypt):
137         (WebCore::gcryptDecrypt):
138         * crypto/gcrypt/CryptoAlgorithmECDHGCrypt.cpp:
139         (WebCore::gcryptDerive):
140         * platform/gamepad/cocoa/GameControllerGamepadProvider.mm:
141         (WebCore::GameControllerGamepadProvider::controllerDidConnect):
142         * platform/gamepad/mac/HIDGamepadProvider.cpp:
143         (WebCore::HIDGamepadProvider::deviceAdded):
144         * platform/graphics/ImageBackingStore.h:
145         (WebCore::ImageBackingStore::setSize):
146         * platform/graphics/WOFFFileFormat.cpp:
147         * platform/graphics/avfoundation/InbandMetadataTextTrackPrivateAVF.cpp:
148         (WebCore::InbandMetadataTextTrackPrivateAVF::updatePendingCueEndTimes):
149         (WebCore::InbandMetadataTextTrackPrivateAVF::flushPartialCues):
150         * platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp:
151         (WebCore::InbandTextTrackPrivateAVF::resetCueValues):
152         (WebCore::InbandTextTrackPrivateAVF::readNativeSampleBuffer):
153         * platform/graphics/avfoundation/cf/InbandTextTrackPrivateAVCF.cpp:
154         (WebCore::InbandTextTrackPrivateAVCF::readNativeSampleBuffer):
155         * platform/graphics/cg/ImageBufferCG.cpp:
156         (WebCore::cfData):
157         * platform/image-decoders/bmp/BMPImageDecoder.cpp:
158         (WebCore::BMPImageDecoder::frameBufferAtIndex):
159         * platform/image-decoders/ico/ICOImageDecoder.cpp:
160         (WebCore::ICOImageDecoder::decode):
161         * platform/image-decoders/jpeg/JPEGImageDecoder.cpp:
162         (WebCore::JPEGImageDecoder::frameBufferAtIndex):
163         * platform/image-decoders/png/PNGImageDecoder.cpp:
164         (WebCore::PNGImageDecoder::frameBufferAtIndex):
165         (WebCore::PNGImageDecoder::readChunks):
166         * platform/image-decoders/webp/WEBPImageDecoder.cpp:
167         (WebCore::WEBPImageDecoder::frameBufferAtIndex):
168         * platform/image-encoders/JPEGImageEncoder.cpp:
169         (WebCore::compressRGBABigEndianToJPEG):
170         * platform/text/DecodeEscapeSequences.h:
171         (WebCore::URLEscapeSequence::decodeRun):
172         * platform/text/SuffixTree.h:
173         (WebCore::SuffixTree::Node::Node):
174         * rendering/Grid.cpp:
175         (WebCore::Grid::setNeedsItemsPlacement):
176         * rendering/RenderTable.cpp:
177         (WebCore::RenderTable::invalidateCachedColumns):
178
179 2017-07-20  Chris Dumez  <cdumez@apple.com>
180
181         Regression(ITP): Can no longer log in on abc.go.com
182         https://bugs.webkit.org/show_bug.cgi?id=174533
183         <rdar://problem/33325881>
184
185         Reviewed by Geoffrey Garen.
186
187         Add quirk for sp.auth.adobe.com which is used for SSO by web sites such as
188         abc.go.com. This would otherwise cause adobe.com to be identified as a
189         tracker and log in on abc.go.com would break.
190
191         No new tests, tested manually on abc.go.com.
192
193         * loader/ResourceLoadObserver.cpp:
194         (WebCore::resourceNeedsSSOQuirk):
195         (WebCore::ResourceLoadObserver::logSubresourceLoading):
196
197 2017-07-20  Antoine Quint  <graouts@apple.com>
198
199         Turn tests at media/modern-media-controls/start-support back on
200         https://bugs.webkit.org/show_bug.cgi?id=174683
201
202         Reviewed by Dean Jackson.
203
204         Turning those tests back on revealed a small bug that is unlikely to really affect content
205         on the Web. In the case where the size of the video is known right away, without the need
206         for loading its metadata, as is the case in the start-support-click-to-start.html test with
207         a local media resource, all queued layouts are flushed at once and we may call the layout()
208         method of the left ButtonsContainer which originally is set to contain the play/pause button,
209         which would remove the play/pause button from the center of the media. So before we potentially
210         set the play/pause button as the central button, we first assign the default button set for
211         the two ButtonsContainer instances and only add the play/pause button when we're not showing
212         the prominent play/pause button.
213
214         * Modules/modern-media-controls/controls/inline-media-controls.js:
215         (InlineMediaControls.prototype.layout):
216         (InlineMediaControls.prototype._leftContainerButtons):
217
218 2017-07-20  Chris Dumez  <cdumez@apple.com>
219
220         Drop legacy FileException type
221         https://bugs.webkit.org/show_bug.cgi?id=174676
222
223         Reviewed by Alex Christensen.
224
225         Drop legacy FileException type and use DOMException instead, as per the latest
226         File API specification:
227         - https://w3c.github.io/FileAPI/#ErrorAndException
228
229         Both Firefox and Chrome no longer expose FileException.
230
231         * CMakeLists.txt:
232         * DerivedSources.cpp:
233         * DerivedSources.make:
234         * WebCore.xcodeproj/project.pbxproj:
235         * bindings/js/JSDOMExceptionHandling.cpp:
236         (WebCore::createDOMException):
237         * dom/DOMExceptions.in:
238         * fileapi/FileException.cpp: Removed.
239         * fileapi/FileException.h: Removed.
240         * fileapi/FileException.idl: Removed.
241         * fileapi/FileReaderLoader.cpp:
242         (WebCore::FileReaderLoader::FileReaderLoader):
243         (WebCore::FileReaderLoader::failed):
244         * fileapi/FileReaderLoader.h:
245         (WebCore::FileReaderLoader::errorCode):
246         * fileapi/FileReaderSync.cpp:
247         (WebCore::errorCodeToExceptionCode):
248         (WebCore::FileReaderSync::startLoading):
249
250 2017-07-20  Sam Weinig  <sam@webkit.org>
251
252         [WebIDL] Remove custom bindings for InspectorFrontendHost
253         https://bugs.webkit.org/show_bug.cgi?id=174659
254
255         Reviewed by Chris Dumez.
256
257         * CMakeLists.txt:
258         * WebCore.xcodeproj/project.pbxproj:
259         * bindings/js/JSBindingsAllInOne.cpp:
260         * bindings/js/JSInspectorFrontendHostCustom.cpp: Removed.
261         Remove JSInspectorFrontendHostCustom.cpp.
262
263         * inspector/InspectorFrontendHost.cpp:
264         (WebCore::populateContextMenu):
265         (WebCore::InspectorFrontendHost::showContextMenu):
266         * inspector/InspectorFrontendHost.h:
267         * inspector/InspectorFrontendHost.idl:
268         Re-implement showContextMenu by using an IDL defined ContextMenuItem dictionary
269         and converting from that to a WebCore::ContextMenu in the implementation.
270
271 2017-07-20  Charlie Turner  <cturner@igalia.com>
272
273         [GTK] Layout Test http/tests/media/hls/hls-progress.html is failing
274         https://bugs.webkit.org/show_bug.cgi?id=141469
275
276         Reviewed by Xabier Rodriguez-Calvar.
277
278         A work-around for getting progress information in a timely manner from
279         live pipelines. We cannot rely on getting BUFFERING messages within
280         the stalled time window (3s), so we have to poll for progress
281         information somehow.
282
283         Makes the following pass reliably
284          http/tests/media/hls/hls-audio-tracks-has-audio.html passed unexpectedly
285          http/tests/media/hls/hls-audio-tracks.html passed unexpectedly
286          http/tests/media/hls/hls-progress.html passed unexpectedly
287
288         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
289         (WebCore::findHLSQueue):
290         (WebCore::isHLSProgressing):
291         (WebCore::MediaPlayerPrivateGStreamer::fillTimerFired):
292
293 2017-07-20  Andreas Kling  <akling@apple.com>
294
295         Minor Node->Element type tightening fixes
296         https://bugs.webkit.org/show_bug.cgi?id=174651
297
298         Reviewed by Sam Weinig.
299
300         Tighten up some Node* into Element* or even better, Element&.
301
302         * dom/Document.cpp:
303         (WebCore::acceptsEditingFocus): Take a const Element&.
304         (WebCore::Document::setFocusedElement):
305         * editing/Editor.cpp:
306         (WebCore::Editor::findEventTargetFrom): Return an Element*.
307         (WebCore::Editor::findEventTargetFromSelection): Ditto.
308         (WebCore::Editor::pasteAsPlainText):
309         (WebCore::Editor::pasteAsFragment):
310         (WebCore::Editor::dispatchCPPEvent):
311         * editing/Editor.h:
312         * page/DragController.cpp:
313         (WebCore::DragController::dispatchTextInputEventFor):
314
315 2017-07-20  Brady Eidson  <beidson@apple.com>
316
317         WKHTTPCookieStore API tests fail on High Sierra.
318         <rdar://problem/33410271> and https://bugs.webkit.org/show_bug.cgi?id=174666
319
320         Reviewed by Andy Estes.
321
322         Covered by existing API tests.
323
324         In r219567 I'd moved cookie storage observation off of NSHTTPCookieStorage and NSNotificationCenter
325         to CFHTTPCookieStorage observation callbacks.
326         
327         This is because notifications were only sent for the default [NSHTTPCookieStorage sharedHTTPCookieStorage]
328         and not any of the other ones we keep in flight.
329         
330         Unfortunately that SPI has been disabled in High Sierra.
331         Fortunately we found a way we can get non-shared NSHTTPCookieStorages to send notifications that works everywhere.
332         
333         * platform/network/cocoa/CookieStorageObserver.h:
334         * platform/network/cocoa/CookieStorageObserver.mm:
335         (-[WebCookieObserverAdapter initWithObserver:]):
336         (-[WebCookieObserverAdapter cookiesChangedNotificationHandler:]):
337         (WebCore::CookieStorageObserver::create):
338         (WebCore::CookieStorageObserver::CookieStorageObserver):
339         (WebCore::CookieStorageObserver::~CookieStorageObserver):
340         (WebCore::CookieStorageObserver::startObserving): Use a trick to call some SPI on non-shared NSHTTPCookieStorages
341           to get them to send notifications.
342         (WebCore::CookieStorageObserver::stopObserving):
343         (WebCore::cookiesChanged): Deleted.
344
345         * platform/network/cocoa/NetworkStorageSessionCocoa.mm:
346         (WebCore::NetworkStorageSession::cookieStorageObserver):
347
348 2017-07-20  Miguel Gomez  <magomez@igalia.com>
349
350         [GStreamer] Some layout tests issue "g_mutex_clear() called on uninitialised or locked mutex" and flaky crash in ~MediaPlayerPrivateGStreamerBase
351         https://bugs.webkit.org/show_bug.cgi?id=173952
352
353         Reviewed by Carlos Garcia Campos.
354
355         Adjust MediaPlayerPrivateGStreamerBase to avoid concurrence problems with the GStreamer thread when
356         destroying the object.
357
358         Covered by existent tests.
359
360         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
361         (WebCore::MediaPlayerPrivateGStreamerBase::~MediaPlayerPrivateGStreamerBase):
362         (WebCore::MediaPlayerPrivateGStreamerBase::repaint):
363         (WebCore::MediaPlayerPrivateGStreamerBase::cancelRepaint):
364
365 2017-07-19  Zan Dobersek  <zdobersek@igalia.com>
366
367         [EME] Push CDMInstance, CDMPrivate and associated types into the Platform layer
368         https://bugs.webkit.org/show_bug.cgi?id=174496
369
370         Reviewed by Xabier Rodriguez-Calvar.
371
372         Move the CDMInstance and CDMPrivate interfaces into the platform layer, enabling
373         implementations of specific key systems at that level, as well as integration with
374         the MediaPlayerPrivate stack without any layering violations.
375
376         While the platform layer still uses the WebCore namespace, the two interface files
377         have now been moved under the platform/encryptedmedia/ directory and out of the
378         Modules/encryptedmedia/ directory where the Web-facing API implementation resides.
379
380         The two interfaces integrated closely with the Web-facing enumerations and
381         dictionaries: MediaKeyMessageType, MediaKeySessionType, MediaKeyStatus,
382         MediaKeySystemConfiguration, MediaKeySystemCapability, MediaKeysRequirement
383         and MediaKeysRestrictions. Definitions of these types are also moved to the
384         platform layer without any changes (apart from renaming), and the previous
385         types now alias against the types now located in the platform layer.
386
387         No new tests -- no change in behavior.
388
389         * CMakeLists.txt:
390         * Modules/encryptedmedia/CDM.cpp:
391         * Modules/encryptedmedia/CDM.h:
392         * Modules/encryptedmedia/MediaKeyMessageType.h:
393         * Modules/encryptedmedia/MediaKeySessionType.h:
394         * Modules/encryptedmedia/MediaKeyStatus.h:
395         * Modules/encryptedmedia/MediaKeySystemAccess.cpp:
396         * Modules/encryptedmedia/MediaKeySystemAccess.h:
397         * Modules/encryptedmedia/MediaKeySystemConfiguration.h:
398         * Modules/encryptedmedia/MediaKeySystemMediaCapability.h:
399         * Modules/encryptedmedia/MediaKeysRequirement.h:
400         * Modules/encryptedmedia/MediaKeysRestrictions.h:
401         * platform/encryptedmedia/CDMInstance.h: Renamed from Source/WebCore/Modules/encryptedmedia/CDMInstance.h.
402         * platform/encryptedmedia/CDMKeyStatus.h: Copied from Source/WebCore/Modules/encryptedmedia/MediaKeyStatus.h.
403         * platform/encryptedmedia/CDMKeySystemConfiguration.h: Copied from Source/WebCore/Modules/encryptedmedia/MediaKeySystemConfiguration.h.
404         * platform/encryptedmedia/CDMMediaCapability.h: Copied from Source/WebCore/Modules/encryptedmedia/MediaKeySystemMediaCapability.h.
405         * platform/encryptedmedia/CDMMessageType.h: Copied from Source/WebCore/Modules/encryptedmedia/MediaKeyMessageType.h.
406         * platform/encryptedmedia/CDMPrivate.h: Renamed from Source/WebCore/Modules/encryptedmedia/CDMPrivate.h.
407         * platform/encryptedmedia/CDMRequirement.h: Copied from Source/WebCore/Modules/encryptedmedia/MediaKeysRequirement.h.
408         * platform/encryptedmedia/CDMRestrictions.h: Copied from Source/WebCore/Modules/encryptedmedia/MediaKeysRestrictions.h.
409         * platform/encryptedmedia/CDMSessionType.h: Copied from Source/WebCore/Modules/encryptedmedia/MediaKeySessionType.h.
410
411 2017-07-19  Zan Dobersek  <zdobersek@igalia.com>
412
413         Unreviewed follow-up to r219674.
414
415         * page/scrolling/coordinatedgraphics/ScrollingCoordinatorCoordinatedGraphics.cpp:
416         Remove the AsyncScrollingCoordinator.h header include that was added by accident.
417
418 2017-07-19  Zan Dobersek  <zdobersek@igalia.com>
419
420         [CMake] Clean up Web Crypto build targets
421         https://bugs.webkit.org/show_bug.cgi?id=174253
422
423         Reviewed by Alex Christensen.
424
425         Gather the common WebCrypto source files in CMakeLists.txt, including them
426         in the build unconditionally and instead relying on ENABLE_SUBTLE_CRYPTO
427         build guards to exclude the code from compilation if the feature is disabled.
428
429         PlatformGTK.cmake, PlatformMac.cmake and PlatformWPE.cmake can then remove
430         duplicated build targets. PlatformMac.cmake still lists all the Mac-specific
431         Web Crypto build targets.
432
433         PlatformGTK.cmake and PlatformWPE.cmake now include GCrypt.cmake if the
434         USE_GCRYPT variable is enabled. Both ports at the moment enable that variable
435         though as they by default leverage a libgcrypt-based CrpytoDigest implementation
436         in the PAL library.
437
438         The new GCrypt.cmake file adds the libgcrypt-specific Web Crypto build targets to
439         the build and also sets up libgcrypt include directiories and libraries.
440
441         No new tests -- no change in behavior.
442
443         * CMakeLists.txt:
444         * PlatformGTK.cmake:
445         * PlatformMac.cmake:
446         * PlatformWPE.cmake:
447         * platform/GCrypt.cmake: Added.
448
449 2017-07-19  Sam Weinig  <sam@webkit.org>
450
451         [WebIDL] Remove custom bindings for CommandLineAPIHost
452         https://bugs.webkit.org/show_bug.cgi?id=174642
453
454         Reviewed by Joseph Pecoraro.
455
456         * CMakeLists.txt:
457         * WebCore.xcodeproj/project.pbxproj:
458         * bindings/js/JSBindingsAllInOne.cpp:
459         * bindings/js/JSCommandLineAPIHostCustom.cpp: Removed.
460         Remove JSCommandLineAPIHostCustom.cpp.
461
462         * bindings/js/JSDOMConvertObject.h:
463         (WebCore::JSConverter<IDLObject>::convert):
464         Add missing JSConverter specialization for IDLObject.
465
466         * inspector/CommandLineAPIHost.cpp:
467         (WebCore::CommandLineAPIHost::inspect):
468         (WebCore::listenerEntriesFromListenerInfo):
469         (WebCore::CommandLineAPIHost::inspectedObject):
470         (WebCore::CommandLineAPIHost::databaseId):
471         (WebCore::CommandLineAPIHost::storageId):
472         (WebCore::CommandLineAPIHost::inspectImpl): Deleted.
473         (WebCore::CommandLineAPIHost::getEventListenersImpl): Deleted.
474         (WebCore::CommandLineAPIHost::databaseIdImpl): Deleted.
475         (WebCore::CommandLineAPIHost::storageIdImpl): Deleted.
476         * inspector/CommandLineAPIHost.h:
477         * inspector/CommandLineAPIHost.idl:
478         Replace custom bindings with modern bindings affordances: dictionaries, records and sequences.
479
480 2017-07-19  Zan Dobersek  <zdobersek@igalia.com>
481
482         Unreviewed CoordGraphics build fix.
483
484         * page/scrolling/coordinatedgraphics/ScrollingCoordinatorCoordinatedGraphics.cpp:
485         (WebCore::ScrollingCoordinatorCoordinatedGraphics::updateNodeViewportConstraints):
486         This should be defined for the ScrollingCoordinatorCoordinatedGraphics class.
487         Also fix the setFixedToViewport() call, fishing out the GraphicsLayer object from
488         the ScrollingStateNode's LayerRepresentation.
489         (WebCore::AsyncScrollingCoordinator::updateNodeViewportConstraints): Deleted.
490
491 2017-07-19  Chris Dumez  <cdumez@apple.com>
492
493         Drop SQLException type
494         https://bugs.webkit.org/show_bug.cgi?id=174665
495
496         Reviewed by Sam Weinig.
497
498         Drop SQLException type. We never throw such exception. Also, Firefox
499         and Chrome no longer expose this type.
500
501         * CMakeLists.txt:
502         * DerivedSources.cpp:
503         * DerivedSources.make:
504         * Modules/webdatabase/SQLException.cpp: Removed.
505         * Modules/webdatabase/SQLException.h: Removed.
506         * Modules/webdatabase/SQLException.idl: Removed.
507         * WebCore.xcodeproj/project.pbxproj:
508         * bindings/js/JSDOMExceptionHandling.cpp:
509         (WebCore::createDOMException):
510         * bindings/js/JSExceptionBase.cpp:
511         (WebCore::toExceptionBase):
512         * dom/DOMExceptions.in:
513
514 2017-07-19  Wenson Hsieh  <wenson_hsieh@apple.com>
515
516         Unreviewed, tweak a comment above TemporarySelectionOptionIgnoreSelectionChanges in Editor.cpp.
517
518         The comment references the UI process, but it describes an entity in WebCore. This should have been generalized
519         to instead refer to the client layer in general (i.e. WebKit1 or WebKit2).
520
521         * editing/Editor.h:
522
523 2017-07-19  Simon Fraser  <simon.fraser@apple.com>
524
525         getBoundingClientRects not updated for programmatic scrolls
526         https://bugs.webkit.org/show_bug.cgi?id=174538
527         rdar://problem/33049012
528
529         Reviewed by Tim Horton.
530
531         Baidu.com has two event handlers on its <input>, and both query the input location with getBoundingClientRect()
532         and the current pageYOffset (via jQuery), then try to scroll the input to the top of the screen. The bug is that
533         programmatic scrolls did not immediately update the layout viewport rect, so the second call to
534         getBoundingClientRect() would return stale coordinates, triggering an extra scroll.
535
536         To fix this, undo the fix for r219320 which tried to keep getBoundingClientRect() current during unstable scroll
537         updates by adding a shadow layout viewport rect. Instead, almost always update the layout viewport rect on
538         FrameView, even during unstable visible rect updates, but not if content insets are being changed interactively,
539         since changing viewport heights cause problems with bottom-fixed elements. Also, we need to compute a new layout
540         viewport rect in FrameView::updateLayoutViewport() for programmatic scrolls.
541
542         However, always updating the layout viewport triggered issues with the scrolling tree. The scrolling state tree
543         fossilizes layer positions relative to a specific viewport rect, and that relationship has to be maintained.
544         There are code paths that recompute fixed/sticky viewport constraints when the layout viewport has changed but
545         we haven't done layout or recomputed layer positions (e.g. updating viewport-constrained layers via
546         updateScrollCoordinatedLayersAfterFlush()) and in these cases using a new layout viewport for those computations
547         results in an inconsistent scrolling tree.
548
549         Fix this by not updating scrolling constraints every time we have to re-register scrolling nodes.
550         updateScrollCoordinatedLayersAfterFlush() only needs to update the layer on the scrolling node (to handle
551         tiled/non-tiled switches), so make updateScrollCoordinatedLayer() a little more fine-grained, and only update
552         constraints when we've just computed layer geometry. This allows for different scrolling nodes to have
553         constraints computed at different times, with different layout viewports, which happens.
554
555         Two additional fixes were required to make bottom-fixed bars behave correctly.
556
557         First, FrameView::computeLayoutViewportOrigin() had a bug where rounding of half-pixel values would cause it to
558         fall into the if (visualViewport.height() > layoutViewport.height()) clause, but then fail to clamp for
559         rubber-banding.
560         
561         Second, the FrameView::unscaledMaximumScrollPosition() was wrong after zooming on iOS, since it uses visibleSize()
562         which is affected by page scale on iOS only (and the function wants scale-independent values). Fix with a hack that
563         should be cleaned up via webkit.org/b/174648.
564
565         Tested by existing tests.
566
567         * page/FrameView.cpp:
568         (WebCore::FrameView::computeUpdatedLayoutViewportRect):
569         (WebCore::FrameView::computeLayoutViewportOrigin):
570         (WebCore::FrameView::setLayoutViewportOverrideRect):
571         (WebCore::FrameView::updateLayoutViewport):
572         (WebCore::FrameView::unscaledMaximumScrollPosition):
573         (WebCore::FrameView::documentToClientOffset):
574         (WebCore::FrameView::setUnstableLayoutViewportRect): Deleted.
575         * page/FrameView.h:
576         * page/scrolling/AsyncScrollingCoordinator.cpp:
577         (WebCore::AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScroll):
578         (WebCore::AsyncScrollingCoordinator::reconcileScrollingState):
579         (WebCore::AsyncScrollingCoordinator::reconcileViewportConstrainedLayerPositions):
580         (WebCore::AsyncScrollingCoordinator::updateNodeLayer):
581         (WebCore::AsyncScrollingCoordinator::updateNodeViewportConstraints):
582         (WebCore::AsyncScrollingCoordinator::updateViewportConstrainedNode): Deleted.
583         * page/scrolling/AsyncScrollingCoordinator.h:
584         * page/scrolling/ScrollingCoordinator.cpp:
585         (WebCore::operator<<):
586         * page/scrolling/ScrollingCoordinator.h:
587         (WebCore::ScrollingCoordinator::reconcileScrollingState):
588         (WebCore::ScrollingCoordinator::updateNodeLayer):
589         (WebCore::ScrollingCoordinator::updateNodeViewportConstraints):
590         (WebCore::ScrollingCoordinator::updateViewportConstrainedNode): Deleted.
591         * page/scrolling/ScrollingStateFixedNode.cpp:
592         (WebCore::ScrollingStateFixedNode::updateConstraints):
593         * page/scrolling/ScrollingStateStickyNode.cpp:
594         (WebCore::ScrollingStateStickyNode::updateConstraints):
595         (WebCore::ScrollingStateStickyNode::reconcileLayerPositionForViewportRect):
596         * page/scrolling/ScrollingTree.cpp:
597         (WebCore::ScrollingTree::commitTreeState):
598         * page/scrolling/mac/ScrollingTreeFixedNode.mm:
599         (WebCore::ScrollingTreeFixedNode::updateLayersAfterAncestorChange):
600         * page/scrolling/mac/ScrollingTreeStickyNode.mm:
601         (WebCore::ScrollingTreeStickyNode::updateLayersAfterAncestorChange):
602         * rendering/RenderLayerBacking.cpp:
603         (WebCore::RenderLayerBacking::updateGeometry):
604         * rendering/RenderLayerCompositor.cpp:
605         (WebCore::RenderLayerCompositor::updateScrollCoordinatedLayersAfterFlush):
606         (WebCore::RenderLayerCompositor::updateBacking):
607         (WebCore::RenderLayerCompositor::fixedRootBackgroundLayerChanged):
608         (WebCore::RenderLayerCompositor::requiresCompositingForPosition):
609         (WebCore::RenderLayerCompositor::updateScrollCoordinatedStatus):
610         (WebCore::RenderLayerCompositor::computeFixedViewportConstraints):
611         (WebCore::RenderLayerCompositor::computeStickyViewportConstraints):
612         (WebCore::RenderLayerCompositor::updateScrollCoordinatedLayer):
613         (WebCore::RenderLayerCompositor::didAddScrollingLayer):
614         * rendering/RenderLayerCompositor.h:
615
616 2017-07-19  Megan Gardner  <megan_gardner@apple.com>
617
618         Don't write file URLs to iOS Pasteboard
619         https://bugs.webkit.org/show_bug.cgi?id=174647
620         <rdar://problem/33199730>
621
622         Reviewed by Wenson Hsieh.
623
624         Tests updated to reflect the changes. We are no longer vending file URLs in Drag & Drop and Copy/Paste.
625
626         * editing/ios/EditorIOS.mm:
627         (WebCore::Editor::writeImageToPasteboard):
628         * platform/ios/PlatformPasteboardIOS.mm:
629         (WebCore::PlatformPasteboard::write):
630
631 2017-07-19  Myles C. Maxfield  <mmaxfield@apple.com>
632
633         Setting the minimum font size preference doesn’t affect absolute line-height values, so lines overlap
634         https://bugs.webkit.org/show_bug.cgi?id=174406
635
636         Reviewed by Simon Fraser.
637         <rdar://problem/10139227>
638
639         Reviewed by NOBODY.
640
641         When the minimumFontSize API preference is set, we will increase the font size without increasing
642         the line height. If the content specifies line-height as an absolute value, there can be two
643         unfortunate results:
644
645         - Adjacent lines in a paragraph can overlap
646         - If the paragraph (or containin block or whatever) uses overflow: hidden, the first and last lines
647         can be cut off and potentially indecipherable.
648
649         Instead, we should use the minimum font size preference as a signal that we should increase the
650         line-height as well as the font-size. Eventually, we will want to increase it by an amount
651         proportional to the increase in font-size (which can be due to minimumFontSize, minimumLogicalFontSize,
652         text autosizing, etc.). However, because minimumLogicalFontSize is on by default, this would cause
653         a behavior change on many webpages which use small text, so such a change would be too risky right now.
654         Instead, we can pretend that minimumFontSize is the only cause that text increases, and use this as the
655         only signal to boost the corresponding line-height.
656
657         Tests: fast/text/line-height-minimumFontSize-text-zoom.html
658                fast/text/line-height-minimumFontSize-visual.html
659                fast/text/line-height-minimumFontSize-zoom.html
660                fast/text/line-height-minimumFontSize.html
661                fast/text/line-height-minimumFontSize-autosize.html
662
663         * css/StyleBuilderCustom.h:
664         (WebCore::computeBaseSpecifiedFontSize):
665         (WebCore::computeLineHeightMultiplierDueToFontSize):
666         (WebCore::StyleBuilderCustom::applyValueLineHeight):
667         (WebCore::StyleBuilderCustom::applyValueFill):
668         (WebCore::StyleBuilderCustom::applyValueStroke):
669         (WebCore::StyleBuilderCustom::applyValueContent):
670         * rendering/TextAutoSizing.cpp:
671
672 2017-07-18  Myles C. Maxfield  <mmaxfield@apple.com>
673
674         Setting the minimum font size preference doesn’t affect absolute line-height values, so lines overlap
675         https://bugs.webkit.org/show_bug.cgi?id=174406
676         <rdar://problem/10139227>
677
678         Reviewed by Simon Fraser.
679
680         When the minimumFontSize API preference is set, we will increase the font size without increasing
681         the line height. If the content specifies line-height as an absolute value, there can be two
682         unfortunate results:
683
684         - Adjacent lines in a paragraph can overlap
685         - If the paragraph (or containin block or whatever) uses overflow: hidden, the first and last lines
686         can be cut off and potentially indecipherable.
687
688         Instead, we should use the minimum font size preference as a signal that we should increase the
689         line-height as well as the font-size. Eventually, we will want to increase it by an amount
690         proportional to the increase in font-size (which can be due to minimumFontSize, minimumLogicalFontSize,
691         text autosizing, etc.). However, because minimumLogicalFontSize is on by default, this would cause
692         a behavior change on many webpages which use small text, so such a change would be too risky right now.
693         Instead, we can pretend that minimumFontSize is the only cause that text increases, and use this as the
694         only signal to boost the corresponding line-height.
695
696         Tests: fast/text/line-height-minimumFontSize-text-zoom.html
697                fast/text/line-height-minimumFontSize-visual.html
698                fast/text/line-height-minimumFontSize-zoom.html
699                fast/text/line-height-minimumFontSize.html
700                fast/text/line-height-minimumFontSize-autosize.html
701
702         * css/StyleBuilderCustom.h:
703         (WebCore::computeBaseSpecifiedFontSize):
704         (WebCore::computeLineHeightMultiplierDueToFontSize):
705         (WebCore::StyleBuilderCustom::applyValueLineHeight):
706         (WebCore::StyleBuilderCustom::applyValueFill):
707         (WebCore::StyleBuilderCustom::applyValueStroke):
708         (WebCore::StyleBuilderCustom::applyValueContent):
709         * rendering/TextAutoSizing.cpp:
710
711 2017-07-19  Chris Dumez  <cdumez@apple.com>
712
713         DOMException should not have its own toString()
714         https://bugs.webkit.org/show_bug.cgi?id=174630
715
716         Reviewed by Sam Weinig.
717
718         DOMException should not have its own toString() and should use the one from Error.prototype.toString()
719         instead:
720         - https://heycam.github.io/webidl/#idl-DOMException
721
722         No new tests, rebaselined existing tests.
723
724         * dom/DOMCoreException.idl:
725
726 2017-07-19  Antoine Quint  <graouts@apple.com>
727
728         [iOS] REGRESSION: Scrubbing media using built-in controls does not pause media
729         https://bugs.webkit.org/show_bug.cgi?id=174650
730         <rdar://problem/33401877>
731
732         Reviewed by Dean Jackson.
733
734         We would only pause when scrubbing on macOS because we only listened to "mousedown" events on the
735         scrubber's backing <input> element to identify that the user had started interacting with the
736         scrubber.
737
738         Implementing the same technique on iOS required a little more work than just listening to "touchstart"
739         events on the same element. On top of that, we needed to make sure that we would only respond to
740         "touchstart" events on the slider's thumb, and not on the track, since only on macOS should the user
741         be able to click anywhere on the track to scrub. So we turn off pointer-events for the <input> on iOS
742         only, and turn them back on specifically for the thumb.
743
744         There is also some finessing when dealing with touch events where we need to track the identifier of
745         the touch that started the user interaction. So we keep track of it in an ivar and wait until we get
746         a "touchend" event where the changedTouches list contains a touch with that same identifier to ensure
747         the same touch that initiates and ends the scrubbing interaction.
748
749         Finally, we fix another issue that was uncovered while turning back on the ScrubbingSupport tests
750         where we would not trash the cached _value ivar when we initiated scrubbing, which was important since
751         we would mistakenly use the pre-srubbing value during a scrub.
752
753         * Modules/modern-media-controls/controls/slider.css:
754         (.ios .slider > input):
755         (.slider > input::-webkit-slider-thumb):
756         * Modules/modern-media-controls/controls/slider.js:
757         (Slider.prototype.handleEvent):
758         (Slider.prototype._handleMousedownEvent):
759         (Slider.prototype._interactionEndTarget):
760         (Slider.prototype._handleTouchstartEvent):
761         (Slider.prototype._valueWillStartChanging):
762         (Slider.prototype._valueDidStopChanging):
763         (Slider.prototype._handleMouseupEvent):
764         (Slider.prototype._handleTouchendEvent):
765
766 2017-07-19  Nan Wang  <n_wang@apple.com>
767
768         AX: Web page reloaded when a node is labelling multiple childnodes
769         https://bugs.webkit.org/show_bug.cgi?id=174655
770
771         Reviewed by Chris Fleizach.
772
773         When we are asking for the aria-labelledby attribute of a node and its
774         sibling is also labelled by the same node, we get into an infinite loop
775         in textUnderElement since we only ignore one child. Added checks for 
776         siblings to avoid such loop.
777
778         Test: accessibility/mac/aria-labelledby-multiple-child-crash.html
779
780         * accessibility/AccessibilityNodeObject.cpp:
781         (WebCore::AccessibilityNodeObject::textUnderElement):
782
783 2017-07-19  Andy Estes  <aestes@apple.com>
784
785         Use a cast to work around clang's false -Wobjc-literal-conversion warnings
786         https://bugs.webkit.org/show_bug.cgi?id=174631
787
788         Reviewed by Dan Bernstein.
789
790         Instead of ignoring -Wobjc-literal-conversion, use a cast to work around rdar://problem/33383354.
791
792         * platform/ios/PlatformPasteboardIOS.mm:
793         (WebCore::PlatformPasteboard::write):
794
795 2017-07-19  Chris Dumez  <cdumez@apple.com>
796
797         Make cross-origin properties enumerable
798         https://bugs.webkit.org/show_bug.cgi?id=174576
799
800         Reviewed by Darin Adler.
801
802         Makes cross-origin properties enumerable on Window and Location objects
803         as per:
804         - https://github.com/whatwg/html/pull/2777
805
806         This simplifies our code quite a bit.
807
808         No new tests, updated existing tests.
809
810         * bindings/js/JSDOMWindowCustom.cpp:
811         (WebCore::jsDOMWindowGetOwnPropertySlotRestrictedAccess):
812         (WebCore::JSDOMWindow::getOwnPropertySlotByIndex):
813         (WebCore::JSDOMWindow::getOwnPropertyNames):
814         * bindings/js/JSLocationCustom.cpp:
815         (WebCore::getOwnPropertySlotCommon):
816         (WebCore::JSLocation::getOwnPropertyNames):
817         * bindings/scripts/CodeGeneratorJS.pm:
818         (GenerateHeader):
819
820 2017-07-18  Carlos Alberto Lopez Perez  <clopez@igalia.com>
821
822         [EME] Build failure with Clang-3.8 on InitDataRegistry.cpp
823         https://bugs.webkit.org/show_bug.cgi?id=174628
824
825         Reviewed by Žan Doberšek.
826
827         * Modules/encryptedmedia/InitDataRegistry.cpp:
828         (WebCore::extractKeyIDsKeyids): Add an explicit cast to unsigned.
829
830 2017-07-19  Matt Lewis  <jlewis3@apple.com>
831
832         Unreviewed, rolling out r219646.
833
834         The test added are failing on all platforms
835
836         Reverted changeset:
837
838         "Setting the minimum font size preference doesn’t affect
839         absolute line-height values, so lines overlap"
840         https://bugs.webkit.org/show_bug.cgi?id=174406
841         http://trac.webkit.org/changeset/219646
842
843 2017-07-19  Yusuke Suzuki  <utatane.tea@gmail.com>
844
845         [WTF] Implement WTF::ThreadGroup
846         https://bugs.webkit.org/show_bug.cgi?id=174081
847
848         Reviewed by Mark Lam.
849
850         * page/ResourceUsageThread.h:
851
852 2017-07-18  Andy Estes  <aestes@apple.com>
853
854         [Xcode] Enable CLANG_WARN_RANGE_LOOP_ANALYSIS
855         https://bugs.webkit.org/show_bug.cgi?id=174631
856
857         Reviewed by Tim Horton.
858
859         * Configurations/Base.xcconfig:
860         * rendering/Grid.cpp:
861         (WebCore::Grid::insert):
862         * rendering/RenderTreeAsText.cpp:
863         (WebCore::write):
864         * rendering/SimpleLineLayoutCoverage.cpp:
865         (WebCore::SimpleLineLayout::printSimpleLineLayoutCoverage):
866
867 2017-07-18  Yusuke Suzuki  <utatane.tea@gmail.com>
868
869         WTF::Thread should have the threads stack bounds.
870         https://bugs.webkit.org/show_bug.cgi?id=173975
871
872         Reviewed by Mark Lam.
873
874         When creating WebThread, we first allocate WebCore::ThreadGlobalData in UI thread
875         and share it with WebThread.
876         The problem is that WebCore::ThreadGlobalData has CachedResourceRequestInitiators.
877         It allocates AtomicString, which requires WTFThreadData.
878
879         In this patch, we call WTF::initializeThreading() before allocating WebCore::ThreadGlobalData.
880         And we also call AtomicString::init() before calling WebCore::ThreadGlobalData since
881         WebCore::ThreadGlobalData allocates AtomicString.
882
883         * platform/ios/wak/WebCoreThread.mm:
884         (StartWebThread):
885
886 2017-07-18  Myles C. Maxfield  <mmaxfield@apple.com>
887
888         Setting the minimum font size preference doesn’t affect absolute line-height values, so lines overlap
889         https://bugs.webkit.org/show_bug.cgi?id=174406
890         <rdar://problem/10139227>
891
892         Reviewed by Simon Fraser.
893
894         When the minimumFontSize API preference is set, we will increase the font size without increasing
895         the line height. If the content specifies line-height as an absolute value, there can be two
896         unfortunate results:
897
898         - Adjacent lines in a paragraph can overlap
899         - If the paragraph (or containin block or whatever) uses overflow: hidden, the first and last lines
900         can be cut off and potentially indecipherable.
901
902         Instead, we should use the minimum font size preference as a signal that we should increase the
903         line-height as well as the font-size. Eventually, we will want to increase it by an amount
904         proportional to the increase in font-size (which can be due to minimumFontSize, minimumLogicalFontSize,
905         text autosizing, etc.). However, because minimumLogicalFontSize is on by default, this would cause
906         a behavior change on many webpages which use small text, so such a change would be too risky right now.
907         Instead, we can pretend that minimumFontSize is the only cause that text increases, and use this as the
908         only signal to boost the corresponding line-height.
909
910         Tests: fast/text/line-height-minimumFontSize-text-zoom.html
911                fast/text/line-height-minimumFontSize-visual.html
912                fast/text/line-height-minimumFontSize-zoom.html
913                fast/text/line-height-minimumFontSize.html
914                fast/text/line-height-minimumFontSize-autosize.html
915
916         * css/StyleBuilderCustom.h:
917         (WebCore::computeBaseSpecifiedFontSize):
918         (WebCore::computeLineHeightMultiplierDueToFontSize):
919         (WebCore::StyleBuilderCustom::applyValueLineHeight):
920         (WebCore::StyleBuilderCustom::applyValueFill):
921         (WebCore::StyleBuilderCustom::applyValueStroke):
922         (WebCore::StyleBuilderCustom::applyValueContent):
923         * rendering/TextAutoSizing.cpp:
924
925 2017-07-18  Zalan Bujtas  <zalan@apple.com>
926
927         Media controls are missing content in fullscreen when document has scroll offset.
928         https://bugs.webkit.org/show_bug.cgi?id=174644
929         <rdar://problem/32415323>
930
931         Reviewed by Simon Fraser.
932
933         If a non-user initiated scrolling (result of resize for example) is processed asynchronously, it might
934         leapfrog other, programatic scrollings and trigger unintentional scroll offsets (and turn into unwanted clippings). 
935         This patch ensures that both resize and top content inset change are translated into programatic scrolling. 
936
937         Unable to test full screen video.
938
939         * page/FrameView.cpp:
940         (WebCore::FrameView::setFrameRect):
941         (WebCore::FrameView::topContentInsetDidChange):
942
943 2017-07-18  Andy Estes  <aestes@apple.com>
944
945         [Xcode] Enable CLANG_WARN_OBJC_LITERAL_CONVERSION
946         https://bugs.webkit.org/show_bug.cgi?id=174631
947
948         Reviewed by Sam Weinig.
949
950         * Configurations/Base.xcconfig:
951         * platform/ios/PlatformPasteboardIOS.mm:
952         (WebCore::PlatformPasteboard::write):
953
954 2017-07-18  Ali Juma  <ajuma@chromium.org>
955
956         Align quirky number parsing with other browsers
957         https://bugs.webkit.org/show_bug.cgi?id=155874
958
959         Reviewed by Simon Fraser.
960
961         Parse unit-less non-zero values for animation-duration and transition-duration
962         as invalid time values in quirks mode.
963
964         Test: fast/css/animation-transition-duration-quirksmode.html
965
966         * css/parser/CSSPropertyParser.cpp:
967         (WebCore::consumeAnimationValue):
968
969 2017-07-18  Chris Dumez  <cdumez@apple.com>
970
971         HysteresisActivity cannot be used in the UIProcess
972         https://bugs.webkit.org/show_bug.cgi?id=174643
973         <rdar://problem/33086442>
974
975         Reviewed by Tim Horton.
976
977         Port HysteresisActivity to RunLoop::Timer so that it can safely be used in
978         the UIProcess as well.
979
980         * platform/HysteresisActivity.h:
981
982 2017-07-18  Joseph Pecoraro  <pecoraro@apple.com>
983
984         Web Inspector: Modernize InjectedScriptSource
985         https://bugs.webkit.org/show_bug.cgi?id=173890
986
987         Reviewed by Brian Burg.
988
989         Covered by existing tests.
990
991         * inspector/CommandLineAPIModuleSource.js:
992         (CommandLineAPIImpl.prototype.copy):
993         (CommandLineAPIImpl.prototype._inspect):
994         Use RemoteObject, a new parameter.
995
996 2017-07-18  Ryosuke Niwa  <rniwa@webkit.org>
997
998         REGRESSION(r218910): Crash when password field changes to text field
999         https://bugs.webkit.org/show_bug.cgi?id=174560
1000
1001         Reviewed by Zalan Bujtas.
1002
1003         The crash was caused by textMarkerDataForFirstPositionInTextControl accessing a nullptr returned by getOrCreate.
1004         Unfortunately, in order to this fix bug while preserving the exact behavior would require synchronously creating
1005         a renderer for the editing host when the input type changed since we can't create an accessbility object out of
1006         a renderer-less node.
1007
1008         Instead, revert back to pre-r218910 behavior of always using the text control element's axID when notifying
1009         the value change. While this is inconsistent with the way editing commands report content changes, I've since
1010         learned that VoiceOver has code to deal with this exact situation.
1011
1012         Test: accessibility/mac/input-type-change-crash-2.html
1013
1014         * accessibility/AXObjectCache.cpp:
1015         (WebCore::AXObjectCache::textMarkerDataForFirstPositionInTextControl):
1016
1017 2017-07-18  Matt Baker  <mattbaker@apple.com>
1018
1019         Web Inspector: Refactoring: replace InspectorCanvasAgent::CanvasEntry with a helper class
1020         https://bugs.webkit.org/show_bug.cgi?id=174311
1021
1022         Reviewed by Devin Rousso.
1023
1024         This patch adds a helper class for tracking canvases and their data. The
1025         current approach of defining a helper structure in the agent's header is
1026         awkward to use and maintain, and won't scale well as more canvas instrumentation
1027         points and data are added.
1028
1029         * CMakeLists.txt:
1030         * WebCore.xcodeproj/project.pbxproj:
1031         New file.
1032
1033         * inspector/InspectorCanvas.cpp: Added.
1034         (WebCore::InspectorCanvas::create):
1035         (WebCore::InspectorCanvas::InspectorCanvas):
1036         (WebCore::InspectorCanvas::buildObjectForCanvas):
1037         * inspector/InspectorCanvas.h: Added.
1038
1039         * inspector/InspectorCanvasAgent.cpp:
1040         (WebCore::InspectorCanvasAgent::InspectorCanvasAgent):
1041         (WebCore::InspectorCanvasAgent::enable):
1042         (WebCore::InspectorCanvasAgent::requestNode):
1043         (WebCore::InspectorCanvasAgent::requestContent):
1044         (WebCore::InspectorCanvasAgent::requestCSSCanvasClientNodes):
1045         (WebCore::InspectorCanvasAgent::resolveCanvasContext):
1046         (WebCore::InspectorCanvasAgent::frameNavigated):
1047         (WebCore::InspectorCanvasAgent::didCreateCSSCanvas):
1048         (WebCore::InspectorCanvasAgent::didChangeCSSCanvasClientNodes):
1049         (WebCore::InspectorCanvasAgent::didCreateCanvasRenderingContext):
1050         (WebCore::InspectorCanvasAgent::didChangeCanvasMemory):
1051         (WebCore::InspectorCanvasAgent::canvasDestroyed):
1052         (WebCore::InspectorCanvasAgent::canvasDestroyedTimerFired):
1053         (WebCore::InspectorCanvasAgent::clearCanvasData):
1054         (WebCore::InspectorCanvasAgent::unbindCanvas):
1055         (WebCore::InspectorCanvasAgent::assertInspectorCanvas):
1056         (WebCore::InspectorCanvasAgent::findInspectorCanvas):
1057         (WebCore::InspectorCanvasAgent::getCanvasEntry): Deleted.
1058         (WebCore::InspectorCanvasAgent::buildObjectForCanvas): Deleted.
1059         * inspector/InspectorCanvasAgent.h:
1060
1061         * inspector/InspectorController.cpp:
1062         (WebCore::InspectorController::InspectorController):
1063         Remove unused constructor argument.
1064
1065 2017-07-18  Basuke Suzuki  <Basuke.Suzuki@sony.com>
1066
1067         [Curl] Move detail implementation from ResourceHandle to ResourceHandleInternal
1068         https://bugs.webkit.org/show_bug.cgi?id=174641
1069
1070         After moving stuff from ResourceHandleManager to ResourceHandle on 
1071         https://bugs.webkit.org/show_bug.cgi?id=173630, still there're many violation
1072         remains between ResourceHandle and ResourceHandleInternal classes.
1073         Many of implementation detail should be move to ResourceHandleInternal
1074         to improve build speed.
1075
1076         Reviewed by Alex Christensen.
1077
1078         * platform/network/ResourceHandle.h:
1079         * platform/network/ResourceHandleInternal.h:
1080         (WebCore::ResourceHandleInternal::ResourceHandleInternal):
1081         * platform/network/curl/ResourceHandleCurl.cpp:
1082         (WebCore::ResourceHandleInternal::~ResourceHandleInternal):
1083         (WebCore::ResourceHandle::start):
1084         (WebCore::ResourceHandle::cancel):
1085         (WebCore::ResourceHandleInternal::initialize):
1086         (WebCore::ResourceHandleInternal::applyAuthentication):
1087         (WebCore::ResourceHandleInternal::setupPUT):
1088         (WebCore::ResourceHandleInternal::setupPOST):
1089         (WebCore::ResourceHandleInternal::setupFormData):
1090         (WebCore::ResourceHandle::platformSetDefersLoading):
1091         (WebCore::ResourceHandleInternal::didFinish):
1092         (WebCore::ResourceHandleInternal::didFail):
1093         (WebCore::ResourceHandleInternal::calculateWebTimingInformations):
1094         (WebCore::ResourceHandleInternal::handleLocalReceiveResponse):
1095         (WebCore::ResourceHandleInternal::willPrepareSendData):
1096         (WebCore::ResourceHandleInternal::didReceiveHeaderLine):
1097         (WebCore::ResourceHandleInternal::didReceiveAllHeaders):
1098         (WebCore::ResourceHandleInternal::didReceiveContentData):
1099         (WebCore::ResourceHandleInternal::readCallback):
1100         (WebCore::ResourceHandleInternal::headerCallback):
1101         (WebCore::ResourceHandleInternal::writeCallback):
1102         (WebCore::ResourceHandle::platformLoadResourceSynchronously):
1103         (WebCore::ResourceHandleInternal::dispatchSynchronousJob):
1104         (WebCore::ResourceHandleInternal::handleDataURL):
1105         (WebCore::ResourceHandle::initialize): Deleted.
1106         (WebCore::ResourceHandle::applyAuthentication): Deleted.
1107         (WebCore::ResourceHandle::setupPUT): Deleted.
1108         (WebCore::ResourceHandle::setupPOST): Deleted.
1109         (WebCore::ResourceHandle::setupFormData): Deleted.
1110         (WebCore::ResourceHandle::didFinish): Deleted.
1111         (WebCore::ResourceHandle::didFail): Deleted.
1112         (WebCore::ResourceHandle::calculateWebTimingInformations): Deleted.
1113         (WebCore::ResourceHandle::handleLocalReceiveResponse): Deleted.
1114         (WebCore::ResourceHandle::willPrepareSendData): Deleted.
1115         (WebCore::ResourceHandle::didReceiveHeaderLine): Deleted.
1116         (WebCore::ResourceHandle::didReceiveAllHeaders): Deleted.
1117         (WebCore::ResourceHandle::didReceiveContentData): Deleted.
1118         (WebCore::ResourceHandle::readCallback): Deleted.
1119         (WebCore::ResourceHandle::headerCallback): Deleted.
1120         (WebCore::ResourceHandle::writeCallback): Deleted.
1121         (WebCore::ResourceHandle::dispatchSynchronousJob): Deleted.
1122         (WebCore::ResourceHandle::handleDataURL): Deleted.
1123
1124 2017-07-18  Andy Estes  <aestes@apple.com>
1125
1126         [Xcode] Enable CLANG_WARN_NON_LITERAL_NULL_CONVERSION
1127         https://bugs.webkit.org/show_bug.cgi?id=174631
1128
1129         Reviewed by Dan Bernstein.
1130
1131         * Configurations/Base.xcconfig:
1132
1133 2017-07-18  Antoine Quint  <graouts@apple.com>
1134
1135         [macOS] Mouse pointer does not hide during fullscreen playback
1136         https://bugs.webkit.org/show_bug.cgi?id=174638
1137         <rdar://problem/33244399>
1138
1139         Reviewed by Dean Jackson.
1140
1141         Test: media/modern-media-controls/css/webkit-cursor-visibility-auto-hide.html
1142
1143         The user-agent stylesheet sets the "-webkit-cursor-visibility" to "auto-hide" for fullscreen <video>
1144         elements. Since we reset the page styles, including UA styles, on .media-controls-container, we need
1145         to explicitly inherit this style property from the page to ensure the mouse pointer automatically
1146         hides in fullscreen.
1147
1148         * Modules/modern-media-controls/controls/media-controls.css:
1149         (.media-controls-container):
1150
1151 2017-07-18  Sam Weinig  <sam@webkit.org>
1152
1153         [WebIDL] Remove custom bindings for MockContentFilterSettings
1154         https://bugs.webkit.org/show_bug.cgi?id=174606
1155
1156         Reviewed by Andy Estes.
1157
1158         * PlatformMac.cmake:
1159         * WebCore.xcodeproj/project.pbxproj:
1160         * bindings/js/JSMockContentFilterSettingsCustom.cpp: Removed.
1161         Remove JSMockContentFilterSettingsCustom.
1162
1163         * testing/MockContentFilterSettings.h:
1164         * testing/MockContentFilterSettings.idl:
1165         Switch from constants to IDL enums to make the bindings and tests simpler.
1166
1167 2017-07-18  Sam Weinig  <sam@webkit.org>
1168
1169         [WebIDL] Replace some custom bindings code in JSCSSStyleDeclarationCustom.cpp with named getters/setters
1170         https://bugs.webkit.org/show_bug.cgi?id=174529
1171
1172         Reviewed by Chris Dumez.
1173
1174         * CMakeLists.txt:
1175         * WebCore.xcodeproj/project.pbxproj:
1176         * css/CSSAllInOne.cpp:
1177         Add CSSStyleDeclaration.cpp
1178
1179         * bindings/js/JSCSSStyleDeclarationCustom.cpp:
1180         Move getter / setter / getOwnProperties logic from here to CSSStyleDeclaration.cpp.
1181
1182         * bindings/scripts/CodeGeneratorJS.pm:
1183         (GenerateGetOwnPropertySlot):
1184         (GenerateGetOwnPropertySlotByIndex):
1185         (InstanceOverridesGetOwnPropertySlot):
1186         (GenerateHeader):
1187         Remove support for no longer needed [CustomGetOwnPropertySlotAndDescriptor].
1188         Add support for [PutOnlyForSupportedProperties], which allows named setters to behave
1189         a bit more like normal setters by allowing the implementation to note which properties
1190         are supported which in turn, allows the bindings to continue down the normal put path
1191         for unsupported properties. This is necessary to mimic the behavior of CSSStyleDeclaration
1192         which is using named setters in place hundreds of additional properties.
1193
1194         (InstanceOverridesDefineOwnProperty):
1195         Add [DefaultDefineOwnProperty] to allow disabling defineOwnProperty overriding that comes
1196         automatically with named setters. We need this for CSSStyleDeclaration since the named
1197         setter usage modeling real properties, not a dictionary style setter. We may want to 
1198         revisit this, and add support for DefineOwnProperty here, but this allows us to maintain
1199         the status quo.
1200
1201         (GenerateDefineOwnProperty):
1202         Fix the case when you have a named setter, an indexed getter, but no indexed setter. In that
1203         case, we would get a compile error, due to the index variable being unused.
1204
1205         * bindings/scripts/IDLAttributes.json:
1206         Remove support for no longer needed [CustomGetOwnPropertySlotAndDescriptor], add
1207         [PutOnlyForSupportedProperties] and [DefaultDefineOwnProperty].
1208
1209         * css/CSSStyleDeclaration.h:
1210         * css/CSSStyleDeclaration.cpp: Added.
1211         (WebCore::CSSStyleDeclaration::namedItem):
1212         (WebCore::CSSStyleDeclaration::setNamedItem):
1213         (WebCore::CSSStyleDeclaration::isSupportedPropertyName):
1214         (WebCore::CSSStyleDeclaration::supportedPropertyNames):
1215         Use standard getter / setter functions to implement CSS property name getting and setting.
1216         Convert from Identifier to AtomicString, which are now bridgeable.
1217
1218         * css/CSSStyleDeclaration.idl:
1219         Add named getter and setter. Remove [CustomGetOwnPropertyNames], [CustomGetOwnPropertySlotAndDescriptor]
1220         and [CustomPut], add [DefaultDefineOwnProperty].
1221
1222         * bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetter.cpp: Added.
1223         * bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetter.h: Added.
1224         * bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetterAndSetter.cpp: Added.
1225         * bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetterAndSetter.h: Added.
1226         * bindings/scripts/test/TestNamedSetterWithIndexedGetter.idl: Added.
1227         * bindings/scripts/test/TestNamedSetterWithIndexedGetterAndSetter.idl: Added.
1228         Add tests for improved behavior when using named setters with variations of indexed getters and setters as well.
1229
1230 2017-07-18  Antoine Quint  <graouts@apple.com>
1231
1232         [iOS] WebKit media controls are sometimes shown after exiting full screen on vimeo.com
1233         https://bugs.webkit.org/show_bug.cgi?id=174627
1234         <rdar://problem/33301005>
1235
1236         Reviewed by Dean Jackson, provisionally reviewed by Jeremy Jones.
1237
1238         On iOS 11, both the WebKit media controls and the Vimeo custom controls would appear sometimes when exiting
1239         from fullscreen when the video was playing and the user would tap the X button, which would pause the video
1240         as well as exit fullscreen.
1241
1242         The reason this happens is that the ControlsVisibilitySupport object, which governs whether the WebKit media
1243         controls should be displayed for a given video, woud listen to "pause" and "webkitfullscreenchange" events
1244         and determine whether to show the WebKit media controls. We listen to the "pause" event because when media
1245         pauses, and the video has the "controls" attribute set, we should show the controls and suspend the controls
1246         auto-hide timer. And we're interested in knowing when we enter and exit fullscreen because we want to override
1247         the "controls" attribute not being set when we enter fullscreen.
1248
1249         However, on iOS 11, it appears that the "webkitfullscreenchange" event is not reliably fired as the user enters
1250         and exits fullscreen, which is tracked by webkit.org/b/174626. So, when the user exits fullscreen, we would be
1251         informed of the video being paused via a "pause" event, but not of the video exiting fullscreen. And because
1252         media events are asynchronous, the "pause" event would sometimes be fired before we exited fullscreen, and when
1253         the _updateControls() would run, we would sometimes determine that we are in fullscreen still and determine
1254         that the WebKit media controls should be shown.
1255
1256         Of course, on iOS, the WebKit media controls are not shown and instead we delegate to AVKit to display media controls.
1257         So we could simply disregard this whole logic in iOS. But we choose to instead use the "webkitpresentationmodechanged"
1258         when the presentation mode API is supported, as is the case on iOS 11, to determine changes of media fullscreen state.
1259         This way, should we ever choose to support fullscreen media controls provided by WebKit on iOS, this logic is already
1260         correct and we write less platform-specific code.
1261
1262         This, alas, cannot be tested since we can't force the X button to be tapped within the AVKit fullscreen controls.
1263
1264         * Modules/modern-media-controls/media/controls-visibility-support.js:
1265         (ControlsVisibilitySupport.prototype.get mediaEvents):
1266         * Modules/modern-media-controls/media/media-controller.js:
1267         (MediaController):
1268         * Modules/modern-media-controls/media/start-support.js:
1269         (StartSupport.prototype.get mediaEvents):
1270
1271 2017-07-18  Matt Lewis  <jlewis3@apple.com>
1272
1273         Unreviewed, rolling out r219610.
1274
1275         This caused an api failure on all platforms for the test
1276         SnapshotImageLargeAsyncDecoding
1277
1278         Reverted changeset:
1279
1280         "Async image decoding for large images should be disabled
1281         after the first time a tile is painted"
1282         https://bugs.webkit.org/show_bug.cgi?id=174451
1283         http://trac.webkit.org/changeset/219610
1284
1285 2017-07-18  Devin Rousso  <drousso@apple.com>
1286
1287         Add CanvasRenderingContext2D::getTransform
1288         https://bugs.webkit.org/show_bug.cgi?id=174278
1289
1290         Reviewed by Dean Jackson.
1291
1292         Tests: fast/canvas/2d.getTransform.modification.html
1293                fast/canvas/2d.getTransform.newobject.html
1294                fast/canvas/2d.setTransform.matrix.html
1295
1296         * css/DOMMatrixReadOnly.h:
1297         Make DOMMatrixReadOnly::validateAndFixup public so that values of DOMMatrixInit are still
1298         usable without having to construct a DOMMatrixReadOnly. This is beneficial in the case that
1299         an exception is thrown, as the validateAndFixup check can happen without any allocations.
1300
1301         * html/canvas/CanvasRenderingContext2D.idl:
1302         * html/canvas/CanvasRenderingContext2D.h:
1303         * html/canvas/CanvasRenderingContext2D.cpp:
1304         (WebCore::CanvasRenderingContext2D::getTransform):
1305         (WebCore::CanvasRenderingContext2D::setTransform):
1306
1307 2017-07-18  Andy Estes  <aestes@apple.com>
1308
1309         [Xcode] Enable CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING
1310         https://bugs.webkit.org/show_bug.cgi?id=174631
1311
1312         Reviewed by Darin Adler.
1313
1314         * Configurations/Base.xcconfig:
1315
1316 2017-07-18  Jonathan Bedard  <jbedard@apple.com>
1317
1318         Unreviewed build fix after r219595
1319
1320         * platform/graphics/cocoa/FontDescriptionCocoa.cpp:
1321         (WebCore::makeNeverDestroyed): Remove duplicate makeNeverDestroyed definition.
1322         * platform/ios/DragImageIOS.mm:
1323         (WebCore::cascadeForSystemFont): Return correct FontCascade object.
1324         (WebCore::createDragImageForLink): Fix compiler error.
1325
1326 2017-07-18  Daniel Bates  <dabates@apple.com>
1327
1328         Cleanup: Remove AlternativeTextInfo and use Variant to represent alternative text info details
1329         https://bugs.webkit.org/show_bug.cgi?id=174604
1330
1331         I inadvertently did not commit some of my local changes.
1332
1333         * editing/AlternativeTextController.cpp:
1334         (WebCore::AlternativeTextController::startAlternativeTextUITimer):
1335         (WebCore::AlternativeTextController::stopAlternativeTextUITimer):
1336         (WebCore::AlternativeTextController::applyPendingCorrection):
1337         (WebCore::AlternativeTextController::hasPendingCorrection):
1338         (WebCore::AlternativeTextController::show):
1339         (WebCore::AlternativeTextController::handleCancelOperation):
1340         (WebCore::AlternativeTextController::dismiss):
1341         (WebCore::AlternativeTextController::dismissSoon):
1342         (WebCore::AlternativeTextController::applyAutocorrectionBeforeTypingIfAppropriate):
1343         (WebCore::AlternativeTextController::timerFired):
1344         (WebCore::AlternativeTextController::handleAlternativeTextUIResult):
1345         (WebCore::AlternativeTextController::respondToMarkerAtEndOfWord):
1346         (WebCore::AlternativeTextController::markerDescriptionForAppliedAlternativeText):
1347
1348 2017-07-17  Daniel Bates  <dabates@apple.com>
1349
1350         Cleanup: Remove AlternativeTextInfo and use Variant to represent alternative text info details
1351         https://bugs.webkit.org/show_bug.cgi?id=174604
1352
1353         Reviewed by Darin Adler.
1354
1355         Remove struct AlternativeTextInfo and represent the alternative text info as instance variables
1356         using Variant to hold either an autocorrection replacement string or the alternative dictation
1357         context.
1358
1359         Not functionality changed. So, no new tests.
1360
1361         * editing/AlternativeTextController.cpp: Remove header Event.h as it is ultimately included by TextEvent.h.
1362         (WebCore::AlternativeTextController::show): Update code as needed.
1363         (WebCore::AlternativeTextController::timerFired): Ditto.
1364         (WebCore::AlternativeTextController::alternativeTextClient): Substitute nullptr for 0.
1365         (WebCore::AlternativeTextController::respondToMarkerAtEndOfWord): Update code as needed.
1366         (WebCore::AutocorrectionAlternativeDetails::create): Deleted.
1367         (WebCore::AutocorrectionAlternativeDetails::replacementString): Deleted.
1368         (WebCore::AutocorrectionAlternativeDetails::AutocorrectionAlternativeDetails): Deleted.
1369         (WebCore::DictationAlternativeDetails::create): Deleted.
1370         (WebCore::DictationAlternativeDetails::dictationContext): Deleted.
1371         (WebCore::DictationAlternativeDetails::DictationAlternativeDetails): Deleted.
1372         * editing/AlternativeTextController.h: Remove header Range.h and forward declare Range. Include header
1373         Position.h and wtf/Variant.h. Sort forward declarations.
1374         (WebCore::AlternativeTextDetails::~AlternativeTextDetails): Deleted.
1375
1376 2017-07-18  Said Abou-Hallawa  <sabouhallawa@apple.com>
1377
1378         Async image decoding for large images should be disabled after the first time a tile is painted
1379         https://bugs.webkit.org/show_bug.cgi?id=174451
1380
1381         Reviewed by Simon Fraser.
1382
1383         Flashing because of DOM mutation can be fixed by disabling the asynchronous
1384         image decoding after the first time a tile was painted.
1385
1386         We can detect this by consulting the tile repaintCount. If it is zero, then
1387         it is safe to use asynchronous image decoded. If the tile repaintCount is
1388         greater than zero, we are not sure if the renderer rectangle has an image
1389         drawn in it already or not. In this case we have to use the synchronous
1390         image decoding to avoid causing a flash.
1391
1392         Tests: fast/images/async-image-background-change.html
1393                fast/images/async-image-src-change.html
1394                http/tests/multipart/multipart-async-image.html
1395
1396         * page/PageOverlayController.cpp:
1397         (WebCore::PageOverlayController::paintContents):
1398         * page/PageOverlayController.h:
1399         * page/linux/ResourceUsageOverlayLinux.cpp:
1400         * page/mac/ServicesOverlayController.h:
1401         * page/mac/ServicesOverlayController.mm:
1402         (WebCore::ServicesOverlayController::Highlight::paintContents):
1403         * platform/graphics/BitmapImage.h:
1404         * platform/graphics/GraphicsLayer.cpp:
1405         (WebCore::GraphicsLayer::paintGraphicsLayerContents):
1406         * platform/graphics/GraphicsLayer.h:
1407         * platform/graphics/GraphicsLayerClient.h:
1408         (WebCore::GraphicsLayerClient::paintContents):
1409         * platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp:
1410         (WebCore::LayerClient::platformCALayerPaintContents):
1411         * platform/graphics/ca/GraphicsLayerCA.cpp:
1412         (WebCore::GraphicsLayerCA::platformCALayerPaintContents):
1413         * platform/graphics/ca/GraphicsLayerCA.h:
1414         * platform/graphics/ca/PlatformCALayer.h:
1415         * platform/graphics/ca/PlatformCALayerClient.h:
1416         (WebCore::PlatformCALayerClient::platformCALayerRepaintCount):
1417         * platform/graphics/ca/TileCoverageMap.cpp:
1418         (WebCore::TileCoverageMap::platformCALayerPaintContents):
1419         * platform/graphics/ca/TileCoverageMap.h:
1420         * platform/graphics/ca/TileGrid.cpp:
1421         (WebCore::TileGrid::platformCALayerPaintContents):
1422         (WebCore::TileGrid::platformCALayerRepaintCount):
1423         * platform/graphics/ca/TileGrid.h:
1424         * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
1425         (PlatformCALayer::drawLayerContents):
1426         * platform/graphics/ca/win/PlatformCALayerWin.cpp:
1427         (PlatformCALayer::drawLayerContents):
1428         * platform/graphics/ca/win/PlatformCALayerWinInternal.cpp:
1429         (PlatformCALayerWinInternal::displayCallback):
1430         * platform/graphics/ca/win/WebTiledBackingLayerWin.cpp:
1431         (WebTiledBackingLayerWin::displayCallback):
1432         * platform/graphics/mac/WebLayer.mm:
1433         (-[WebLayer drawInContext:]):
1434         (-[WebSimpleLayer drawInContext:]):
1435         * rendering/RenderBoxModelObject.cpp:
1436         (WebCore::RenderBoxModelObject::decodingModeForImageDraw):
1437         * rendering/RenderElement.h:
1438         * rendering/RenderLayerBacking.cpp:
1439         (WebCore::RenderLayerBacking::paintContents):
1440         * rendering/RenderLayerBacking.h:
1441         * rendering/RenderLayerCompositor.cpp:
1442         (WebCore::RenderLayerCompositor::paintContents):
1443         * rendering/RenderLayerCompositor.h:
1444         * testing/Internals.cpp:
1445         (WebCore::imageFromImageElement):
1446         (WebCore::bitmapImageFromImageElement):
1447         (WebCore::Internals::imageFrameIndex):
1448         (WebCore::Internals::setImageFrameDecodingDuration):
1449         (WebCore::Internals::resetImageAnimation):
1450         (WebCore::Internals::isImageAnimating):
1451         (WebCore::Internals::setClearDecoderAfterAsyncFrameRequestForTesting):
1452         (WebCore::Internals::imageDecodeCount):
1453         (WebCore::Internals::setLargeImageAsyncDecodingEnabledForTesting):
1454         * testing/Internals.h:
1455         * testing/Internals.idl:
1456
1457 2017-07-18  Chris Dumez  <cdumez@apple.com>
1458
1459         DOMException should have its properties on the prototype
1460         https://bugs.webkit.org/show_bug.cgi?id=174597
1461
1462         Reviewed by Alex Christensen.
1463
1464         DOMException should have its properties on the prototype, as other interfaces:
1465         - https://heycam.github.io/webidl/#idl-DOMException
1466
1467         No new tests, rebaselined existing tests.
1468
1469         * bindings/scripts/CodeGeneratorJS.pm:
1470         (InterfaceRequiresAttributesOnInstance):
1471
1472 2017-07-18  Basuke Suzuki  <Basuke.Suzuki@sony.com>
1473
1474         [Curl] Unify ResourceHandleManager into CurlJobManager.
1475         https://bugs.webkit.org/show_bug.cgi?id=173991
1476
1477         Use CurlJobManager to make ResourceHandle run in background.
1478         CurlJobManager::start() now accept callback to manage life cycle
1479         of the resource easily in a same context.
1480         Actual management tasks of CurlJobManager is now private class
1481         in CurlJobManager which is better thread safeness.
1482         ResourceHandleManager is deleted at all.
1483
1484         Reviewed by Alex Christensen.
1485
1486         * platform/Curl.cmake:
1487         * platform/network/ResourceHandle.h:
1488         * platform/network/curl/CookieJarCurl.cpp:
1489         (WebCore::cookiesForSession):
1490         * platform/network/curl/CurlContext.cpp:
1491         (WebCore::CurlHandle::CurlHandle):
1492         (WebCore::CurlHandle::~CurlHandle):
1493         (WebCore::CurlHandle::errorDescription):
1494         (WebCore::CurlHandle::perform):
1495         (WebCore::CurlHandle::pause):
1496         (WebCore::CurlHandle::appendRequestHeaders):
1497         (WebCore::CurlHandle::appendRequestHeader):
1498         (WebCore::CurlHandle::enableRequestHeaders):
1499         (WebCore::CurlHandle::fetchCookieList):
1500         (WebCore::CurlHandle::getEffectiveURL):
1501         (WebCore::CurlHandle::setPrivateData): Deleted.
1502         (WebCore::CurlHandle::clearRequestHeaders): Deleted.
1503         (WebCore::CurlHandle::getCookieList): Deleted.
1504         (WebCore::CurlHandle::clearCookieList): Deleted.
1505         * platform/network/curl/CurlContext.h:
1506         (WebCore::CurlSList::CurlSList):
1507         (WebCore::CurlSList::~CurlSList):
1508         (WebCore::CurlSList::operator struct curl_slist** ):
1509         (WebCore::CurlSList::head):
1510         (WebCore::CurlSList::isEmpty):
1511         (WebCore::CurlSList::clear):
1512         (WebCore::CurlSList::append):
1513         (WebCore::CurlHandle::errorCode):
1514         (WebCore::CurlHandle::setErrorCode):
1515         (WebCore::CurlHandle::privateData):
1516         (WebCore::CurlHandle::setPrivateData):
1517         * platform/network/curl/CurlDownload.cpp:
1518         (WebCore::CurlDownload::start):
1519         (WebCore::CurlDownload::cancel):
1520         (WebCore::CurlDownload::addHeaders):
1521         (WebCore::CurlDownload::didReceiveData):
1522         (WebCore::CurlDownload::didFail):
1523         (WebCore::CurlDownload::handleCurlMsg): Deleted.
1524         * platform/network/curl/CurlDownload.h:
1525         * platform/network/curl/CurlJobManager.cpp:
1526         (WebCore::CurlJobList::append):
1527         (WebCore::CurlJobList::cancel):
1528         (WebCore::CurlJobList::complete):
1529         (WebCore::CurlJobList::isEmpty):
1530         (WebCore::CurlJobList::withJob):
1531         (WebCore::CurlJobList::withCurlHandle):
1532         (WebCore::CurlJob::invoke):
1533         (WebCore::CurlJobManager::add):
1534         (WebCore::CurlJobManager::cancel):
1535         (WebCore::CurlJobManager::callOnJobThread):
1536         (WebCore::CurlJobManager::startThreadIfNeeded):
1537         (WebCore::CurlJobManager::stopThreadIfNoMoreJobRunning):
1538         (WebCore::CurlJobManager::stopThread):
1539         (WebCore::CurlJobManager::updateJobs):
1540         (WebCore::CurlJobManager::workerThread):
1541         (WebCore::CurlJobManager::CurlJobManager): Deleted.
1542         (WebCore::CurlJobManager::~CurlJobManager): Deleted.
1543         (WebCore::CurlJobManager::remove): Deleted.
1544         (WebCore::CurlJobManager::getActiveCount): Deleted.
1545         (WebCore::CurlJobManager::getPendingCount): Deleted.
1546         (WebCore::CurlJobManager::stopThreadIfIdle): Deleted.
1547         (WebCore::CurlJobManager::updateHandleList): Deleted.
1548         (WebCore::CurlJobManager::addToCurl): Deleted.
1549         (WebCore::CurlJobManager::removeFromCurl): Deleted.
1550         * platform/network/curl/CurlJobManager.h:
1551         (WebCore::CurlJob::CurlJob):
1552         (WebCore::CurlJob::~CurlJob):
1553         (WebCore::CurlJob::operator=):
1554         (WebCore::CurlJob::curlHandle):
1555         (WebCore::CurlJob::ticket):
1556         (WebCore::CurlJob::finished):
1557         (WebCore::CurlJob::error):
1558         (WebCore::CurlJob::cancel):
1559         (WebCore::CurlJobManager::singleton):
1560         (WebCore::CurlJobManager::~CurlJobManager):
1561         (WebCore::CurlJobManager::isActiveJob):
1562         (WebCore::CurlJobManager::runThread): Deleted.
1563         (WebCore::CurlJobManager::setRunThread): Deleted.
1564         * platform/network/curl/ResourceError.h:
1565         (WebCore::ResourceError::ResourceError):
1566         * platform/network/curl/ResourceHandleCurl.cpp:
1567         (WebCore::ResourceHandle::~ResourceHandle):
1568         (WebCore::ResourceHandle::start):
1569         (WebCore::ResourceHandle::cancel):
1570         (WebCore::ResourceHandle::initialize):
1571         (WebCore::ResourceHandle::applyAuthentication):
1572         (WebCore::getFormElementsCount):
1573         (WebCore::ResourceHandle::setupPUT):
1574         (WebCore::ResourceHandle::setupPOST):
1575         (WebCore::ResourceHandle::setupFormData):
1576         (WebCore::ResourceHandle::setHostAllowsAnyHTTPSCertificate):
1577         (WebCore::ResourceHandle::setClientCertificateInfo):
1578         (WebCore::ResourceHandle::platformSetDefersLoading):
1579         (WebCore::ResourceHandle::didFinish):
1580         (WebCore::ResourceHandle::didFail):
1581         (WebCore::ResourceHandle::shouldUseCredentialStorage):
1582         (WebCore::ResourceHandle::didReceiveAuthenticationChallenge):
1583         (WebCore::ResourceHandle::receivedCredential):
1584         (WebCore::ResourceHandle::receivedRequestToContinueWithoutCredential):
1585         (WebCore::ResourceHandle::receivedCancellation):
1586         (WebCore::ResourceHandle::calculateWebTimingInformations):
1587         (WebCore::ResourceHandle::handleLocalReceiveResponse):
1588         (WebCore::ResourceHandle::willPrepareSendData):
1589         (WebCore::ResourceHandle::didReceiveHeaderLine):
1590         (WebCore::ResourceHandle::didReceiveAllHeaders):
1591         (WebCore::ResourceHandle::didReceiveContentData):
1592         (WebCore::ResourceHandle::readCallback):
1593         (WebCore::ResourceHandle::headerCallback):
1594         (WebCore::ResourceHandle::writeCallback):
1595         (WebCore::ResourceHandle::platformLoadResourceSynchronously):
1596         (WebCore::ResourceHandle::dispatchSynchronousJob):
1597         (WebCore::calculateWebTimingInformations): Deleted.
1598         (WebCore::handleLocalReceiveResponse): Deleted.
1599         (WebCore::writeCallback): Deleted.
1600         (WebCore::headerCallback): Deleted.
1601         (WebCore::readCallback): Deleted.
1602         (WebCore::setupFormData): Deleted.
1603         (WebCore::ResourceHandle::handleCurlMsg): Deleted.
1604         * platform/network/curl/ResourceHandleManager.cpp: Removed.
1605         * platform/network/curl/ResourceHandleManager.h: Removed.
1606
1607 2017-07-17  Konstantin Tokarev  <annulen@yandex.ru>
1608
1609         Unreviewed fix to Mac CMake build after r219474.
1610
1611         * PlatformMac.cmake:
1612
1613 2017-07-17  Konstantin Tokarev  <annulen@yandex.ru>
1614
1615         [cmake] Set library types before their targets are created
1616         https://bugs.webkit.org/show_bug.cgi?id=174600
1617
1618         Reviewed by Michael Catanzaro.
1619
1620         Since r219560 library targets are created before PlatformXXX.cmake
1621         files are processed, however library type must be passed in
1622         add_library() call and cannot be changed afterwards. Set these
1623         variables in OptionsXXX.cmake.
1624
1625         No new tests needed.
1626
1627         * PlatformMac.cmake:
1628
1629 2017-07-17  Yoshiaki Jitsukawa  <Yoshiaki.Jitsukawa@sony.com>
1630
1631         Move USE_AVFOUNDATION definition on Windows to wtf/Platform.h
1632         https://bugs.webkit.org/show_bug.cgi?id=174356
1633
1634         Reviewed by Brent Fulgham.
1635
1636         Move the definition of USE_AVFOUNDATION on Windows to wtf/platform.h
1637
1638         Rename WebCoreHeaderDetection.h to AVFoundationHeaderDetection.h
1639
1640         * AVFoundationSupport.py: Moved to Source/WTF/AVFoundationSupport.py.
1641         * DerivedSources.make:
1642         * PlatformWin.cmake:
1643         * config.h:
1644         * platform/graphics/ca/win/PlatformCALayerWin.cpp:
1645         * platform/graphics/ca/win/PlatformCALayerWinInternal.cpp:
1646
1647 2017-07-17  Sam Weinig  <sam@webkit.org>
1648
1649         [WebIDL] Remove custom bindings that require non-caching JS strings
1650         https://bugs.webkit.org/show_bug.cgi?id=174552
1651
1652         Reviewed by Darin Adler.
1653
1654         Adds two new types, UncachedString and OwnedString (both of which
1655         are simple structs that wrap a String) to communicate to the bindings
1656         layer which function to use when converting to a JS string.
1657
1658         * bindings/IDLTypes.h:
1659         (WebCore::IDLString::isNullValue):
1660         Add overloads of isNullValue for UncachedString and OwnedString.
1661
1662         * bindings/js/JSDOMConvertStrings.h:
1663         (WebCore::JSConverter<IDLDOMString>::convert):
1664         (WebCore::JSConverter<IDLByteString>::convert):
1665         (WebCore::JSConverter<IDLUSVString>::convert):
1666         Add overloads of convert for UncachedString that uses JSC::jsString 
1667         and for OwnedString that uses JSC::jsOwnedString.
1668
1669         * bindings/js/JSHTMLCanvasElementCustom.cpp:
1670         (WebCore::JSHTMLCanvasElement::toDataURL): Deleted.
1671         Remove custom binding for toDataURL.
1672
1673         * bindings/js/JSXMLHttpRequestCustom.cpp:
1674         (WebCore::JSXMLHttpRequest::retrieveResponse):
1675         (WebCore::JSXMLHttpRequest::responseText): Deleted.
1676         Remove custom binding for responseText. Replace the caller of the 
1677         binding function with a simple conversion that will do the same thing.
1678
1679         * bindings/js/StringAdaptors.h: Added.
1680         Add UncachedString and OwnedString adaptors.
1681
1682         * html/HTMLCanvasElement.cpp:
1683         (WebCore::HTMLCanvasElement::toDataURL):
1684         Move quality conversion here, matching toBlob and the spec. Return a UncachedString
1685         to instruct the bindings to use JSC::jsString and not JSC::jsStringWithCache.
1686
1687         (WebCore::HTMLCanvasElement::toBlob):
1688         Use asNumber() rather than toNumber(), since we just checked that it is a number.
1689
1690         * html/HTMLCanvasElement.h:
1691         Update header to account for returning an UncachedString.
1692
1693         * html/HTMLCanvasElement.idl:
1694         Remove [Custom] and make the signature of toDataURL match the spec (and what we have been doing).
1695
1696         * inspector/InspectorCanvasAgent.cpp:
1697         (WebCore::InspectorCanvasAgent::requestContent):
1698         Update to account for UncachedString.
1699
1700         * xml/XMLHttpRequest.cpp:
1701         (WebCore::XMLHttpRequest::responseText):
1702         * xml/XMLHttpRequest.h:
1703         Update responseText to return OwnedString. OwnedString instruct the bindings to 
1704         use JSC::jsOwnedString and not JSC::jsStringWithCache.
1705
1706         * xml/XMLHttpRequest.idl:
1707         Remove [CustomGetter].
1708
1709 2017-07-17  Daniel Bates  <dabates@apple.com>
1710
1711         Cleanup: Use OptionSet to represent marker types
1712         https://bugs.webkit.org/show_bug.cgi?id=174594
1713
1714         Reviewed by Darin Adler.
1715
1716         Remove class DocumentMarker::MarkerTypes that duplicates most of functionality of OptionSet
1717         and use OptionSet directly to represent a set of marker types.
1718
1719         No functionality changed. So, no new tests.
1720
1721         * dom/Document.cpp:
1722         (WebCore::Document::updateLayout):
1723         * dom/DocumentMarker.h:
1724         (WebCore::DocumentMarker::MarkerTypes::MarkerTypes): Deleted.
1725         (WebCore::DocumentMarker::MarkerTypes::contains): Deleted.
1726         (WebCore::DocumentMarker::MarkerTypes::intersects): Deleted.
1727         (WebCore::DocumentMarker::MarkerTypes::operator==): Deleted.
1728         (WebCore::DocumentMarker::MarkerTypes::add): Deleted.
1729         (WebCore::DocumentMarker::MarkerTypes::remove): Deleted.
1730         (WebCore::DocumentMarker::AllMarkers::AllMarkers): Deleted.
1731         * dom/DocumentMarkerController.cpp:
1732         (WebCore::DocumentMarkerController::possiblyHasMarkers):
1733         (WebCore::DocumentMarkerController::detach):
1734         (WebCore::DocumentMarkerController::removeMarkers):
1735         (WebCore::DocumentMarkerController::addMarker):
1736         (WebCore::DocumentMarkerController::copyMarkers):
1737         (WebCore::DocumentMarkerController::markersFor):
1738         (WebCore::DocumentMarkerController::markersInRange):
1739         (WebCore::DocumentMarkerController::removeMarkersFromList):
1740         (WebCore::DocumentMarkerController::repaintMarkers):
1741         (WebCore::DocumentMarkerController::shiftMarkers):
1742         (DocumentMarkerController::setMarkersActive):
1743         (DocumentMarkerController::hasMarkers):
1744         (DocumentMarkerController::clearDescriptionOnMarkersIntersectingRange):
1745         Update code as needed.
1746
1747         * dom/DocumentMarkerController.h:
1748         (WebCore::DocumentMarkerController::hasMarkers):
1749         Update code as needed.
1750
1751         * editing/AlternativeTextController.cpp:
1752         (WebCore::markerTypesForAutocorrection):
1753         (WebCore::markerTypesForReplacement):
1754         (WebCore::markerTypesForAppliedDictationAlternative):
1755         Marked as inline and returns an OptionSet<DocumentMarker::MarkerType>. It is unnecessary to use NeverDestroyed
1756         in these functions as constructing an OptionSet and copying/moving it is very efficient. Such operations are
1757         effectively equivalent to an integral assignment and copy of an integral value, respectively.
1758
1759         (WebCore::AlternativeTextController::applyAlternativeTextToRange):
1760         (WebCore::AlternativeTextController::respondToUnappliedSpellCorrection):
1761         (WebCore::AlternativeTextController::markCorrection):
1762         Update code as needed.
1763
1764         * editing/AlternativeTextController.h: While I am here, remove some unnecessary #includes and group
1765         forward declarations of structs.
1766         * editing/CompositeEditCommand.cpp:
1767         (WebCore::CompositeEditCommand::replaceTextInNodePreservingMarkers): Update code as needed.
1768         * editing/Editor.cpp:
1769         (WebCore::Editor::updateMarkersForWordsAffectedByEditing): Ditto.
1770         * editing/SpellChecker.cpp:
1771         (WebCore::SpellChecker::didCheckSucceed): Ditto.
1772         * page/ios/FrameIOS.mm:
1773         (WebCore::Frame::interpretationsForCurrentRoot): Ditto.
1774         * testing/Internals.cpp:
1775         (WebCore::markerTypesFrom): Ditto.
1776         (WebCore::Internals::markerCountForNode): Ditto.
1777         (WebCore::Internals::markerAt): Ditto.
1778
1779 2017-07-17  Devin Rousso  <drousso@apple.com>
1780
1781         Web Inspector: overlay page highlight doesn't disappear when a page is constantly updating
1782         https://bugs.webkit.org/show_bug.cgi?id=174468
1783
1784         Reviewed by Simon Fraser.
1785
1786         Do not allow the PageOverlay to start another fade animation of the same type if one has
1787         already started. As an example, if the PageOverlay is fading out, startFadeOutAnimation
1788         should just return.
1789
1790         * page/PageOverlay.cpp:
1791         (WebCore::PageOverlay::startFadeInAnimation):
1792         (WebCore::PageOverlay::startFadeOutAnimation):
1793
1794 2017-07-17  Darin Adler  <darin@apple.com>
1795
1796         Improve use of NeverDestroyed
1797         https://bugs.webkit.org/show_bug.cgi?id=174348
1798
1799         Reviewed by Sam Weinig.
1800
1801         * Modules/encryptedmedia/MediaKeySession.cpp: Removed unneeded include of
1802         NeverDestroyed.h.
1803
1804         * Modules/encryptedmedia/legacy/LegacyCDM.cpp:
1805         (WebCore::installedCDMFactories): Use makeNeverDestroyed and a lambda rather
1806         than a separate boolean for initialization.
1807
1808         * Modules/encryptedmedia/legacy/LegacyCDMSessionClearKey.cpp:
1809         (WebCore::clearKeyVM): Removed unneeded use of NeverDestroyed to hold a
1810         RefPtr. Simple to just use leakRef instead.
1811
1812         * Modules/gamepad/GamepadManager.cpp: Added an include of NeverDestroyed.h.
1813
1814         * Modules/indexeddb/IDBTransaction.cpp: Removed unneeded include of
1815         NeverDestroyed.h.
1816         * Modules/indexeddb/server/MemoryObjectStore.cpp: Ditto.
1817
1818         * Modules/mediasession/MediaSessionManager.cpp: Moved include of
1819         NeverDestroyed.h here ...
1820         * Modules/mediasession/MediaSessionManager.h: ... from here.
1821
1822         * Modules/mediasource/MediaSourceRegistry.cpp: Moved include of
1823         NeverDestroyed.h here ...
1824         * Modules/mediasource/MediaSourceRegistry.h: ... from here.
1825
1826         * Modules/mediasource/SourceBuffer.cpp: Removed unneeded include of
1827         NeverDestroyed.h.
1828
1829         * Modules/plugins/QuickTimePluginReplacement.h: Initialize
1830         m_scriptObject in the class definition.
1831
1832         * Modules/plugins/QuickTimePluginReplacement.mm:
1833         (WebCore::QuickTimePluginReplacement::supportsMimeType): Use
1834         makeNeverDestroyed and the HashSet constructor instead of a loop.
1835         (WebCore::QuickTimePluginReplacement::supportsFileExtension): Ditto.
1836         (WebCore::QuickTimePluginReplacement::QuickTimePluginReplacement): Did a
1837         slight cleanup of the initializers.
1838         (WebCore::QuickTimePluginReplacement::~QuickTimePluginReplacement): Added
1839         a FIXME; unclear why there is code here at all.
1840
1841         * accessibility/AccessibilityRenderObject.cpp:
1842         (WebCore::AccessibilityRenderObject::inheritsPresentationalRole): Use
1843         makeNeverDestroyed and the Vector constructor instead of using empty
1844         vector checks and Vector::add. Use std::any_of rather than Vector::contains
1845         since we now are matching against pointers.
1846
1847         * bindings/scripts/CodeGeneratorJS.pm:
1848         (GenerateEnumerationImplementationContent): Use const NeverDestroyed.
1849
1850         * bindings/scripts/test/JS/JSTestCallbackInterface.cpp:
1851         * bindings/scripts/test/JS/JSTestObj.cpp:
1852         * bindings/scripts/test/JS/JSTestStandaloneDictionary.cpp:
1853         * bindings/scripts/test/JS/JSTestStandaloneEnumeration.cpp:
1854         Regenerated.
1855
1856         * css/CSSProperty.cpp:
1857         (WebCore::borderDirections): Removed unnecesssary use of NeverDestroyed
1858         for a global object that has a trivial destructor.
1859
1860         * css/ElementRuleCollector.cpp:
1861         (WebCore::leftToRightDeclaration): Removed unneeded use of NeverDestroyed to hold a
1862         Ref. Simple to just use leakRef instead. Also use a lambda instead of an explicit
1863         isEmpty check each time this is called.
1864         (WebCore::rightToLeftDeclaration): Ditto.
1865
1866         * css/makeprop.pl: Removed unneeded include of NeverDestroyed.h and the
1867         uneeded global emptyShorthand. Constructing an empty StylePropertyShorthand
1868         is no less efficient than copying a global empty one was.
1869
1870         * dom/CustomElementReactionQueue.cpp: Added an include of NeverDestroyed.h.
1871
1872         * dom/DOMImplementation.cpp: Removed unneeded include of NeverDestroyed.h.
1873         * dom/InputEvent.cpp: Ditto.
1874
1875         * dom/Microtasks.cpp: Moved include of NeverDestroyed.h here ...
1876         * dom/Microtasks.h: ... from here.
1877
1878         * dom/MutationObserver.cpp: Added an include of NeverDestroyed.h.
1879
1880         * dom/ScopedEventQueue.cpp: Moved include of NeverDestroyed.h here ...
1881         * dom/ScopedEventQueue.h: ... from here. Added Forward.h.
1882
1883         * dom/ScriptElement.cpp:
1884         (WebCore::isLegacySupportedJavaScriptLanguage): Use makeNeverDestroyed
1885         and the HashSet constructor rather than an isEmpty check and a lot of
1886         add function calls. Also removed comments that don't have value any more,
1887         with dubious no longer relevant claims about the behavior of old web browsers.
1888         The function that calls this one already has sufficient comments about why we
1889         hope some day this function can be eliminated.
1890
1891         * dom/SecurityContext.cpp: Removed unneeded include of NeverDestroyed.h.
1892
1893         * dom/make_names.pl:
1894         (printFactoryCppFile): Instead of using a "populate" function, use a function
1895         that creates as HashMap. Then use const auto and makeNeverDestroyed.
1896         (printWrapperFactoryCppFile): Ditto.
1897
1898         * editing/AlternativeTextController.cpp:
1899         (WebCore::markerTypesForAutocorrection): Use makeNeverDestroyed
1900         and the Vector constructor rather than an isEmpty check and a lot of
1901         append function calls.
1902         (WebCore::markerTypesForReplacement): Ditto.
1903         (WebCore::markerTypesForAppliedDictationAlternative): Ditto.
1904
1905         * editing/EditingStyle.cpp:
1906         (WebCore::htmlElementEquivalents): Use const auto, makeNeverDestroyed,
1907         the Vector constructor, and new rather than make_unique. Changed return
1908         type to use const pointers rather than unique_ptr with non-const type.
1909         (WebCore::EditingStyle::conflictsWithImplicitStyleOfElement): Updated
1910         for the above change to htmlElementEquivalents.
1911         (WebCore::htmlAttributeEquivalents): Same approach as above.
1912         (WebCore::EditingStyle::conflictsWithImplicitStyleOfAttributes): Ditto.
1913         (WebCore::elementMatchesAndPropertyIsNotInInlineStyleDecl): Take
1914         references instead of pointers.
1915         (WebCore::EditingStyle::mergeInlineAndImplicitStyleOfElement): Updated
1916         for the above.
1917
1918         * editing/FormatBlockCommand.cpp:
1919         (WebCore::isElementForFormatBlock): Use const auto, makeNeverDestroyed,
1920         and the HashSet constructor rather than isEmpty and a lot of calls to add.
1921         * editing/RemoveFormatCommand.cpp:
1922         (WebCore::isElementForRemoveFormatCommand): Ditto.
1923
1924         * editing/ReplaceSelectionCommand.cpp:
1925         (WebCore::isProhibitedParagraphChild): Use const auto, makeNeverDestroyed,
1926         and a lambda, rather than isEmpty and a lot of calls to add.
1927
1928         * html/Autofill.cpp:
1929         (WebCore::fieldNameMap): Changed return type to be const. Use const auto,
1930         makeNeverDestroyed, a lambda, and an array of values rather than isEmpty
1931         and a lot of calls to add. Stopped doing the ConstructFromLiteral
1932         optimization here. (Easy to add it back if that is a mistake.)
1933
1934         * html/HTMLObjectElement.cpp:
1935         (WebCore::isRecognizedTagName): Use const auto, makeNeverDestroyed, and
1936         a lambda rather than isEmpty.
1937
1938         * html/HTMLStyleElement.cpp: Added include of NeverDestroyed.h.
1939
1940         * html/HTMLVideoElement.cpp: Removed uneeded include of NeverDestroyed.h.
1941
1942         * html/InputType.cpp:
1943         (WebCore::createInputTypeFactoryMap): Replaced the populate function
1944         with this create function.
1945         (WebCore::InputType::create): Use const auto and makeNeverDestroyed
1946         istead of isEmpty. Also put the map right where it is used so it's
1947         not initialized in code path where not needed.
1948
1949         * html/parser/HTMLParserIdioms.cpp: Removed uneeded include of
1950         NeverDestroyed.h.
1951
1952         * inspector/InspectorApplicationCacheAgent.cpp:
1953         (WebCore::InspectorApplicationCacheAgent::networkStateChanged):
1954         Merged into a single line.
1955
1956         * loader/ContentFilter.cpp:
1957         (WebCore::blockedPageURL): Use const auto and makeNeverDestroyed
1958         rather than std::call_once. Since this is a URL and has a non-thread-safe
1959         reference count, this was not thread safe before, so no need to use the
1960         more roundabout and less efficient idiom for its thread safety.
1961
1962         * loader/CrossOriginAccessControl.cpp:
1963         (WebCore::isOnAccessControlResponseHeaderWhitelist): Deleted.
1964         * loader/CrossOriginAccessControl.h: Deleted unused function
1965         isOnAccessControlResponseHeaderWhitelist.
1966
1967         * loader/EmptyClients.cpp: Use leakRef instead of NeverDestroyed<Ref>.
1968
1969         * loader/appcache/ApplicationCacheStorage.cpp: Removed unneeded include of
1970         NeverDestroyed.h.
1971         * page/CaptionUserPreferences.cpp: Ditto.
1972
1973         * page/DebugPageOverlays.cpp:
1974         (WebCore::touchEventRegionColors): Changed the return type to const, since
1975         the callers do not modify the map. Use const auto, makeNeverDestroyed, and
1976         a lambda rather than isEmpty and repeated calls to add.
1977
1978         * page/MainFrame.cpp: Removed unneeded include of NeverDestroyed.h.
1979
1980         * page/MemoryRelease.cpp:
1981         (WebCore::releaseMemory): Use a function directly instead of calling it
1982         inside a lambda.
1983
1984         * page/NavigatorBase.cpp:
1985         (WebCore::NavigatorBase::onLine): Updated to call
1986         NetworkStateNotifier::singleton.
1987
1988         * page/Page.cpp:
1989         (WebCore::allPages): Made this a function instead of a global to use the
1990         normal idiom for such globals.
1991         (WebCore::Page::forEachPage): Updated for change to allPages.
1992         (WebCore::networkStateChanged): Ditto. Also removed a bit of unnecessary
1993         churn by using const AtomicString& instead of AtomicString.
1994         (WebCore::Page::Page): Moved initialization of most data members to the
1995         class definition. Removed initialiation of allPages. Updated the use of
1996         NetworkStateNotifier for its new slightly changed  interface.
1997         (WebCore::Page::~Page): Updated for change to allPages.
1998         (WebCore::Page::clearPreviousItemFromAllPages): Ditto.
1999         (WebCore::Page::updateStyleForAllPagesAfterGlobalChangeInEnvironment): Ditto.
2000         (WebCore::Page::refreshPlugins): Ditto.
2001
2002         * page/Page.h: Moved initialization of most data members here.
2003
2004         * page/PerformanceUserTiming.cpp: Removed many unneded includes.
2005         (WebCore::restrictedMarkFunction): Use const auto, makeNeverDestroyed, and
2006         a lambda instead of isEmpty. Also use an array rather than std::array and
2007         got rid fo the unneeded use of anonymous namespace since this is fine in
2008         the top level WebCore namespace.
2009         (WebCore::clearPerformanceEntries): Tweaked coding style.
2010         (WebCore::UserTiming::mark): Ditto.
2011         (WebCore::UserTiming::findExistingMarkStartTime): Got rid of double hash
2012         table lookup by using find instead of using contains followed by get.
2013         removed unneeded explicit cast to double. Tweaked coding style.
2014         (WebCore::convertToEntrySequence): Tweaked coding style.
2015         (WebCore::getEntrySequenceByName): Deleted.
2016         (WebCore::UserTiming::getMarks): Call get directly instead of getEntrySequenceByName.
2017         (WebCore::UserTiming::getMeasures): Ditto.
2018
2019         * page/RuntimeEnabledFeatures.cpp: Moved include of NeverDestroyed.h here ...
2020         * page/RuntimeEnabledFeatures.h: ... from here. Added Forward.h and Noncopyable.h.
2021
2022         * platform/LocalizedStrings.cpp: Removed unneeded include of NeverDestroyed.h.
2023
2024         * platform/MIMETypeRegistry.cpp:
2025         (WebCore::initializeSupportedImageMIMETypes): Added a missing const for a global
2026         constant array.
2027         (WebCore::initializeSupportedJavaScriptMIMETypes): Ditto.
2028         (WebCore::initializeSupportedNonImageMimeTypes): Ditto.
2029         (WebCore::typesForCommonExtension): Replaced the old mediaMIMETypeMap function
2030         with this one. Moved the common media types array here since it's only used here.
2031         Use const auto, makeNeverDestroyed, and a lambda instead of using an isEmpty check.
2032         Iterate the array using a mdoern for loop. Use HashMap::ensure to avoid the
2033         double hashing that the old code was doing. And moved the code to find an entry
2034         in the map in here from the client functions.
2035         (WebCore::MIMETypeRegistry::getMediaMIMETypeForExtension): Updated to use the
2036         typesForCommonExtension, and changed logic to use this first, and only call
2037         getMIMETypeForExtension for extensions not in the map. This gives the same
2038         result but should be slightly more efficient.
2039         (WebCore::MIMETypeRegistry::getMediaMIMETypesForExtension): Updated to use the
2040         typesForCommonExtension function. Comment about strategy is now in there.
2041         (WebCore::initializeUnsupportedTextMIMETypes): Added a missing const for a global
2042         constant array. Also started using ASCIILiteral.
2043
2044         * platform/MainThreadSharedTimer.cpp: Moved include of NeverDestroyed.h here ...
2045         * platform/MainThreadSharedTimer.h: ... from here. Added Forward.h.
2046
2047         * platform/SchemeRegistry.cpp:
2048         (WebCore::add): Added helper functions to keep code below simpler.
2049         (WebCore::makeNeverDestroyedSchemeSet): Ditto.
2050         (WebCore::allBuiltinSchemes): Use const auto, makeNeverDestroyed, a lambda,
2051         and the helper functions above, rather than isEmpty.
2052         (WebCore::builtinLocalURLSchemes): Use const auto, makeNeverDestroyed, and
2053         the HashSet constructor instead of isEmpty and add calls. Also changed the
2054         return type to be const.
2055         (WebCore::localURLSchemes): Copy the map using assignment instead of an
2056         isEmpty function and a loop with calls to add.
2057         (WebCore::builtinSecureSchemes): Use const auto, makeNeverDestroyed, and
2058         the Vector constructor rather than isEmpty, repeated calls to append,
2059         and shrinkToFit.
2060         (WebCore::secureSchemes): Use auto and makeNeverDestroyedSchemeSet rather
2061         than isEmpty and repeated calls to add.
2062         (WebCore::builtinSchemesWithUniqueOrigins): More of the same.
2063         (WebCore::schemesWithUniqueOrigins): Ditto.
2064         (WebCore::builtinEmptyDocumentSchemes): Ditto.
2065         (WebCore::emptyDocumentSchemes): Ditto.
2066         (WebCore::schemesForbiddenFromDomainRelaxation): Ditto.
2067         (WebCore::builtinCanDisplayOnlyIfCanRequestSchemes): Ditto.
2068         (WebCore::canDisplayOnlyIfCanRequestSchemes): Ditto.
2069         (WebCore::builtinCORSEnabledSchemes): Ditto.
2070         (WebCore::CORSEnabledSchemes): Ditto.
2071         (WebCore::SchemeRegistry::shouldTreatURLSchemeAsLocal): Replaced check for
2072         empty string with check for null string, since that's slightly more efficient
2073         for non-null, non-empty strings, and the hash table can handle empty strings
2074         just fine.
2075         (WebCore::SchemeRegistry::registerURLSchemeAsNoAccess): Added null check here.
2076         (WebCore::SchemeRegistry::shouldTreatURLSchemeAsNoAccess): Ditto.
2077         (WebCore::SchemeRegistry::registerURLSchemeAsDisplayIsolated): Ditto.
2078         (WebCore::SchemeRegistry::shouldTreatURLSchemeAsDisplayIsolated): Ditto.
2079         (WebCore::SchemeRegistry::registerURLSchemeAsSecure): Ditto.
2080         (WebCore::SchemeRegistry::shouldTreatURLSchemeAsSecure): Ditto.
2081         (WebCore::SchemeRegistry::registerURLSchemeAsEmptyDocument): Ditto.
2082         (WebCore::SchemeRegistry::shouldLoadURLSchemeAsEmptyDocument): Ditto.
2083         (WebCore::SchemeRegistry::setDomainRelaxationForbiddenForURLScheme): Ditto.
2084         (WebCore::SchemeRegistry::isDomainRelaxationForbiddenForURLScheme): Ditto.
2085         (WebCore::SchemeRegistry::canDisplayOnlyIfCanRequest): Ditto.
2086         (WebCore::SchemeRegistry::registerAsCanDisplayOnlyIfCanRequest): Ditto.
2087         (WebCore::SchemeRegistry::registerURLSchemeAsNotAllowingJavascriptURLs): Ditto.
2088         (WebCore::SchemeRegistry::shouldTreatURLSchemeAsNotAllowingJavascriptURLs): Ditto.
2089         (WebCore::SchemeRegistry::registerURLSchemeAsAllowingLocalStorageAccessInPrivateBrowsing): Ditto.
2090         (WebCore::SchemeRegistry::allowsLocalStorageAccessInPrivateBrowsing): Ditto.
2091         (WebCore::SchemeRegistry::registerURLSchemeAsAllowingDatabaseAccessInPrivateBrowsing): Ditto.
2092         (WebCore::SchemeRegistry::allowsDatabaseAccessInPrivateBrowsing): Ditto.
2093         (WebCore::SchemeRegistry::registerURLSchemeAsCORSEnabled): Ditto.
2094         (WebCore::SchemeRegistry::shouldTreatURLSchemeAsCORSEnabled): Ditto.
2095         (WebCore::SchemeRegistry::registerURLSchemeAsBypassingContentSecurityPolicy): Ditto.
2096         (WebCore::SchemeRegistry::removeURLSchemeRegisteredAsBypassingContentSecurityPolicy): Ditto.
2097         (WebCore::SchemeRegistry::schemeShouldBypassContentSecurityPolicy): Ditto.
2098         (WebCore::SchemeRegistry::registerURLSchemeAsAlwaysRevalidated): Ditto.
2099         (WebCore::SchemeRegistry::shouldAlwaysRevalidateURLScheme): Ditto.
2100         (WebCore::SchemeRegistry::registerURLSchemeAsCachePartitioned): Ditto.
2101         (WebCore::SchemeRegistry::shouldPartitionCacheForURLScheme): Ditto.
2102         (WebCore::SchemeRegistry::isUserExtensionScheme): Tweaked #if a bit.
2103         (WebCore::SchemeRegistry::isBuiltinScheme): Added null check.
2104
2105         * platform/cocoa/WebVideoFullscreenModelVideoElement.mm:
2106         (WebVideoFullscreenModelVideoElement::observedEventNames): Use const auto,
2107         makeNeverDestroyed, and the Vector constructor rather than a call to size
2108         and then append eacn time this funciton is called.
2109
2110         * platform/gamepad/cocoa/GameControllerGamepadProvider.h: Moved include of
2111         NeverDestroyed.h from here ...
2112         * platform/gamepad/cocoa/GameControllerGamepadProvider.mm: ... to here.
2113
2114         * platform/gamepad/mac/HIDGamepadProvider.cpp: Moved include of
2115         NeverDestroyed.h here ...
2116         * platform/gamepad/mac/HIDGamepadProvider.h: ... from here.
2117
2118         * platform/graphics/FontCascade.cpp:
2119         (WebCore::FontCascade::hasValidAverageCharWidth): Use const auto,
2120         makeNeverDestroyed, and the HashSet constructor.
2121
2122         * platform/graphics/ImageBuffer.cpp:
2123         (WebCore::ImageBuffer::transformColorSpace): Removed unneeded use of
2124         NeverDestroyed<Vector<int>> here, instead using const std::array.
2125
2126         * platform/graphics/ImageBuffer.h: Changed platformTransformColorSpace to take
2127         const std::array<uint8_t, 256>& instead of const Vector<int>&, since the whole
2128         pointer of the argument is that it's a table to map bytes onto other bytes.
2129
2130         * platform/graphics/MediaPlaybackTarget.h: Removed unneeded include of
2131         NeverDestroyed.h, unneeded unused noMediaPlaybackTargetContext function,
2132         and unneeded include of MediaPlaybackTargetContext.h, forward declaring instead.
2133         Made most functions in this class pure virtual instead of having default
2134         implementations.
2135
2136         * platform/graphics/avfoundation/MediaPlaybackTargetMac.h: Added include
2137         of MediaPlaybackTargetContext.h now that it was removed above.
2138
2139         * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp:
2140         (WebCore::MediaPlayerPrivateAVFoundation::staticMIMETypeList): Use const auto,
2141         makeNeverDestroyed, and the HashSet constructor.
2142
2143         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
2144         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::isAvailable): Reversed the sense
2145         of the boolean logic here to make this simpler and easier to read.
2146         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::getSupportedTypes): Changed
2147         the implementation here, which empties out the passed in hash set, to use
2148         the clear function rather than assignment from a global empty hash set. Added
2149         a FIXME because it seems peculiar that this would be considered OK.
2150         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::supportsType): Used ? : to make
2151         this a little more terse; I think it's clearer.
2152
2153         * platform/graphics/cairo/ImageBufferCairo.cpp:
2154         (WebCore::ImageBuffer::platformTransformColorSpace): Updated for change to
2155         argument type.
2156
2157         * platform/graphics/cg/ImageDecoderCG.cpp: Removed unneeded include of
2158         NeverDestroyed.h.
2159         (WebCore::appendImageSourceOption): Streamlined code using auto with
2160         adoptCF; there is no need to write out the type of the RetainPtr.
2161         (WebCore::imageSourceOptions): Instead of NeverDestroyed<RetainPtr>, just use
2162         const auto and leakRef.
2163         (WebCore::imageSourceAsyncOptions): Ditto.
2164
2165         * platform/graphics/gtk/GdkCairoUtilities.cpp:
2166         (WebCore::getDefaultCairoFontOptions): Instead of using LazyNeverDestroyed
2167         on a pointer, just use a global pointer. There is no need to use any kind
2168         of NeverDestroyed on a type with a trivial destructor such as a pointer.
2169
2170         * platform/graphics/ios/FontCacheIOS.mm:
2171         (WebCore::platformFontWithFamilySpecialCase): Instead of using
2172         NeverDestroyed<RetainPtr> just use a raw pointer global.
2173         * platform/graphics/mac/FontCacheMac.mm:
2174         (WebCore::platformFontWithFamilySpecialCase): Ditto.
2175
2176         * platform/graphics/mac/MediaPlayerPrivateQTKit.mm:
2177         (WebCore::createFileTypesSet): Return the HashSet instead of adding to it.
2178         Use Objective-C for/in syntax for an NSArray, not C++ for syntax, although
2179         it seems the C++ syntax was working fine.
2180         (WebCore::mimeCommonTypesCache): Fixed return type so we won't copy the
2181         HashMap every time this function is called. Use const auto and makeNeverDestroyed
2182         instead of using a boolean to do one time initialization.
2183         (WebCore::mimeModernTypesCache): Ditto.
2184         (WebCore::MediaPlayerPrivateQTKit::disableUnsupportedTracks): Marked a
2185         constant array const.
2186
2187         * platform/ios/Device.cpp:
2188         (WebCore::deviceClass): Use a lambda to initialize a variable here instead
2189         of using std::call_once. This function does not need to be thread safe.
2190         (WebCore::deviceName): Use const NeverDestroyed instead of LazyNeverDestroyed
2191         and std::call_once. This function does not need to be thread safe.
2192
2193         * platform/ios/DragImageIOS.mm: Make defaultLinkIndicatorOptions be a
2194         constant instead of a variable.
2195         (WebCore::cascadeForSystemFont): Added helper function.
2196         (WebCore::createDragImageForLink): Use const auto and makeNeverDestroyed
2197         instead of LazyNeverDestroyed and dispatch_once. This code does not need
2198         to be thread safe since its arguments include, for example, a DOM element.
2199
2200         * platform/ios/LegacyTileLayerPool.h: Removed unneeded include of
2201         NeverDestroyed.h.
2202
2203         * platform/ios/QuickLook.mm:
2204         (WebCore::QLPreviewGetSupportedMIMETypesSet): Use a global raw pointer
2205         instead of NeverDestroyed<RetainPtr<NSSet>>.
2206         (WebCore::createQLPreviewProtocol): Deleted.
2207         (WebCore::QLPreviewProtocol): Use a global raw pointer instead of
2208         a NeverDestroyed<Vector<char>>. It's cleaner to use fastStrdup instead
2209         of appending to an array, and less wasteful of memory too.
2210
2211         * platform/ios/WebCoreMotionManager.mm: Removed unneeded include of
2212         NeverDestroyed.h.
2213         * platform/ios/WebSQLiteDatabaseTrackerClient.h: Ditto.
2214         * platform/mac/DragImageMac.mm: Ditto.
2215         * platform/mediastream/CaptureDeviceManager.cpp: Ditto.
2216         * platform/mediastream/RealtimeMediaSourceSupportedConstraints.cpp: Ditto.
2217
2218         * platform/mock/MockRealtimeMediaSource.cpp:
2219         (WebCore::MockRealtimeMediaSource::audioDevices): Use auto,
2220         makeNeverDestroyed, and a lambda instead of checking size each time.
2221         (WebCore::MockRealtimeMediaSource::videoDevices): Ditto.
2222
2223         * platform/mock/mediasource/MockMediaPlayerMediaSource.cpp:
2224         (WebCore::mimeTypeCache): Use const auto, makeNeverDestroyed, and the
2225         HashSet constructor instead of an explicit boolean to initialize.
2226
2227         * platform/network/BlobRegistryImpl.cpp:
2228         (WebCore::blobUtilityQueue): Use a global with a raw reference instead
2229         of a NeverDestroyed<Ref>.
2230
2231         * platform/network/NetworkStateNotifier.cpp:
2232         (WebCore::NetworkStateNotifier::singleton): Renamed this from
2233         networkStateNotifier. We must have missed this when we changed to use the
2234         singleton idiom consistently. Also changed to use normal NeverDestroyed
2235         rather than using LazyNeverDestroyed and call_once, because this is not
2236         used from multiple threads and has no special thread safety requirements.
2237         (WebCore::NetworkStateNotifier::NetworkStateNotifier): Moved the constructor
2238         here and construct the timer. Before the timer was used only on the Mac
2239         platform but now it is there for all platforms.
2240         (WebCore::NetworkStateNotifier::onLine): Moved function here from the header.
2241         It's a littlel less trivial than before because it now triggers a call to
2242         updateState as needed.
2243         (WebCore::NetworkStateNotifier::addListener): Renamed from
2244         addNetworkStateChangeListener since there is only one kind of listener and
2245         the old name was too wordy. Changed to call the new startObserving function,
2246         and guaranteed to call it onlh once. The platform-specific logic for iOS is
2247         now inside the iOS version of that function instead of here.
2248         (WebCore::NetworkStateNotifier::updateState): Moved here now that it is the
2249         same for all platforms. The actual state updating is done in a function named
2250         updateStateWithoutNotifying, which is implemented for each platform.
2251         (WebCore::NetworkStateNotifier::updateStateSoon): New function which takes
2252         advantage of the timer to coalesce network state updates.
2253         (WebCore::NetworkStateNotifier::updateStateWithoutNotifying): Empty stub
2254         version of this function.
2255         (WebCore::NetworkStateNotifier::startObserving): Ditto.
2256         (WebCore::NetworkStateNotifier::notifyNetworkStateChange): Deleted. Code from
2257         this has moved into updateState.
2258
2259         * platform/network/NetworkStateNotifier.h: Greatly cut down what part of this
2260         class is platform-specific.
2261
2262         * platform/network/ios/NetworkStateNotifierIOS.mm:
2263         (-[WebNetworkStateObserver initWithBlock:]): Simplified this class so it
2264         takes a block, rather than using a pointer to the C++ notifier and doing
2265         WebThreadRun.
2266         (-[WebNetworkStateObserver dealloc]): Ditto.
2267         (-[WebNetworkStateObserver networkStateChanged:]): Ditto.
2268         (WebCore::NetworkStateNotifier::updateStateWithoutNotifying):
2269         This now calls isNetworkReachable.
2270         (WebCore::NetworkStateNotifier::startObserving): Check the
2271         Settings::shouldOptOutOfNetworkStateObservation function, and if it's OK
2272         to observe, then create the observer. This code now takes care of the
2273         WebThreadRun and calls updateStateSoon.
2274         (WebCore::NetworkStateNotifier::NetworkStateNotifier): Deleted. The
2275         constructor is now platform independent.
2276         (WebCore::NetworkStateNotifier::~NetworkStateNotifier): Deleted. This
2277         object is never destroyed so we should not write a destructor for it.
2278         (WebCore::NetworkStateNotifier::registerObserverIfNecessary): Deleted.
2279         Replaced by startObserving.
2280         (WebCore::NetworkStateNotifier::onLine): Deleted. This function is now
2281         platform-independent.
2282         (WebCore::setOnLine): Deleted. The logic from this is now in
2283         updateState and updateStateWithoutNotifying.
2284
2285         * platform/network/mac/NetworkStateNotifierMac.cpp:
2286         (WebCore::NetworkStateNotifier::updateStateWithoutNotifying): Renamed
2287         this from updateState and tightened up the code a bit. Also changed
2288         to not assume anything. If there is an error, we leave m_isOnLine alone.
2289         Default behavior is now in the platform-independent code, and the default
2290         is to treat things as on-line if updateStateWithoutNotifying was called
2291         and it was never able to update the state even once.
2292         (WebCore::NetworkStateNotifier::startObserving): Moved most of the code
2293         from the constructor into this function.
2294         (WebCore::NetworkStateNotifier::dynamicStoreCallback): Deleted. This is
2295         now a lambda inside startObserving.
2296         (WebCore::NetworkStateNotifier::networkStateChangeTimerFired): Deleted.
2297         This function is now platform-independent and is named updateState.
2298
2299         * platform/network/win/NetworkStateNotifierWin.cpp:
2300         (WebCore::NetworkStateNotifier::updateStateWithoutNotifying): Renamed
2301         from updateState and tightened the code up a bit. Also changed
2302         to not assume anything. If there is an error, we leave m_isOnLine alone.
2303         Default behavior is now in the platform-independent code, and the default
2304         is to treat things as on-line if updateStateWithoutNotifying was called
2305         and it was never able to update the state even once.
2306         (WebCore::NetworkStateNotifier::addressChanged): Deleted.
2307         This function is now platform-independent and is named updateState.
2308         (WebCore::NetworkStateNotifier::addressChangeCallback): Renamed from
2309         addrChangeCallback. Simplified by using the singleton function instead
2310         of relying on the context pointer.
2311         (WebCore::NetworkStateNotifier::startObserving): Moved most of the code
2312         from the constructor here.
2313
2314         * platform/text/LocaleToScriptMappingDefault.cpp:
2315         (WebCore::scriptNameToCode): Use makeNeverDestroyed.
2316         (WebCore::localeToScriptCodeForFontSelection): Ditto.
2317
2318         * platform/text/ios/LocalizedDateCache.h: Moved include of
2319         NeverDestroyed.h from here ...
2320         * platform/text/ios/LocalizedDateCache.mm: ... to here.
2321
2322         * platform/wpe/RenderThemeWPE.cpp:
2323         (WebCore::RenderTheme::singleton): Use a theme that is never destroyed
2324         rather than Ref that is never destroyed.
2325
2326         * platform/wpe/RenderThemeWPE.h: Use friend NeverDestroyed rather than
2327         a create function since RenderTheme is no longer reference counted.
2328
2329         * rendering/RenderTheme.h: Made RenderTheme no longer reference counted.
2330
2331         * rendering/RenderThemeGtk.cpp:
2332         (WebCore::RenderThemeGtk::create): Deleted.
2333         (WebCore::RenderTheme::singleton): Use a theme that is never destroyed
2334         rather than Ref that is never destroyed.
2335
2336         * rendering/RenderThemeGtk.h: Use friend NeverDestroyed rather than
2337         a create function since RenderTheme is no longer reference counted.
2338         * rendering/RenderThemeIOS.h: Ditto.
2339
2340         * rendering/RenderThemeIOS.mm:
2341         (WebCore::RenderThemeIOS::create): Deleted.
2342         (WebCore::RenderTheme::singleton): Use a theme that is never destroyed
2343         rather than Ref that is never destroyed.
2344
2345         * rendering/RenderThemeMac.h: Use friend NeverDestroyed rather than
2346         a create function since RenderTheme is no longer reference counted.
2347         Also marked a lot of functions final rather than override and initialized
2348         data members in the class deifnition.
2349
2350         * rendering/RenderThemeMac.mm: Moved some SPI interfaces to the top of the
2351         file. They should really go into SPI headers.
2352         (-[WebCoreRenderThemeNotificationObserver init]): Removed the theme argument
2353         here because the theme is a singleton and we don't need a pointer to it.
2354         Add the observer here instead of doing it in the caller.
2355         (-[WebCoreRenderThemeNotificationObserver systemColorsDidChange:]): Call
2356         platformColorsDidChange through the singleton rather than using a pointer.
2357         (-[WebCoreTextFieldCell _coreUIDrawOptionsWithFrame:inView:includeFocus:]):
2358         Tightened up the code a bit by using CFAutorelease instead of using a
2359         combination of NSMakeCollectable, autorelease, and a typecast to accomplish
2360         the same thing.
2361         (WebCore::RenderTheme::singleton): Use a theme that is never destroyed
2362         rather than Ref that is never destroyed.
2363         (WebCore::RenderThemeMac::create): Deleted.
2364         (WebCore::RenderThemeMac::RenderThemeMac): Moved initialization into the
2365         class definition and observing into the WebCoreRenderThemeNotificationObserver
2366         init function.
2367         (WebCore::RenderThemeMac::~RenderThemeMac): Deleted. No need for this since
2368         the object will never be destroyed.
2369         (WebCore::RenderThemeMac::mediaControlsBase64StringForIconNameAndType):
2370         Removed an unnecessary conversion from C string literal to WTF::String and
2371         then to NSString. Instead, just use an NSString literal.
2372
2373         * rendering/RenderThemeWin.cpp:
2374         (WebCore::RenderThemeWin::create): Deleted.
2375         (WebCore::RenderTheme::singleton): Use a theme that is never destroyed
2376         rather than Ref that is never destroyed.
2377
2378         * rendering/RenderThemeWin.h: Use friend NeverDestroyed rather than
2379         a create function since RenderTheme is no longer reference counted.
2380
2381         * rendering/svg/RenderSVGResource.cpp:
2382         (WebCore::removeFromCacheAndInvalidateDependencies): Moved a global into
2383         the code where it is used.
2384
2385         * svg/SVGAnimatedLength.cpp: Removed unneeded include of NeverDestroyed.h.
2386
2387         * svg/SVGAnimationElement.cpp:
2388         (WebCore::SVGAnimationElement::isSupportedAttribute): Use const auto,
2389         makeNeverDestroyed, a lambda, and the new HashSet::add overload instead of
2390         an isEmpty check and lots of separate add function calls.
2391         * svg/SVGClipPathElement.cpp:
2392         (WebCore::SVGClipPathElement::isSupportedAttribute): Ditto.
2393         * svg/SVGComponentTransferFunctionElement.cpp:
2394         (WebCore::SVGComponentTransferFunctionElement::isSupportedAttribute): Ditto.
2395         * svg/SVGCursorElement.cpp:
2396         (WebCore::SVGCursorElement::isSupportedAttribute): Ditto.
2397
2398         * svg/SVGElement.cpp:
2399         (WebCore::createAttributeNameToCSSPropertyIDMap): Replaced the populate
2400         function with this create function.
2401         (WebCore::createAttributeNameToAnimatedPropertyTypeMap): Ditto.
2402         (WebCore::attributeNameToAnimatedPropertyTypeMap): Changed return type to
2403         const reference. Use const auto and makeNeverDestroyed instead of using
2404         isEmpty and a populate function.
2405         (WebCore::createCSSPropertyWithSVGDOMNameToAnimatedPropertyTypeMap):
2406         More of the same.
2407         (WebCore::cssPropertyWithSVGDOMNameToAnimatedPropertyTypeMap): Ditto.
2408         (WebCore::SVGElement::childShouldCreateRenderer): Use an array instead of
2409         a HashSet since we are checking against only 3 or 4 values.
2410         (WebCore::addQualifiedName): Deleted.
2411         (WebCore::SVGElement::animatableAttributeForName): Use const auto,
2412         makeNeverDestroyed, and a lambda to efficiently build the map in this function.
2413         (WebCore::SVGElement::cssPropertyIdForSVGAttributeName): Use const auto and
2414         makeNeverDestroyed instead of using isEmpty and a populate function.
2415
2416         * svg/SVGFilterElement.cpp:
2417         (WebCore::SVGFilterElement::isSupportedAttribute): Use const auto,
2418         makeNeverDestroyed, a lambda, and the new HashSet::add overload instead of
2419         an isEmpty check and lots of separate add function calls.
2420         * svg/SVGFilterPrimitiveStandardAttributes.cpp:
2421         (WebCore::SVGFilterPrimitiveStandardAttributes::isSupportedAttribute): Ditto.
2422         * svg/SVGForeignObjectElement.cpp:
2423         (WebCore::SVGForeignObjectElement::isSupportedAttribute): Ditto.
2424         * svg/SVGGElement.cpp:
2425         (WebCore::SVGGElement::isSupportedAttribute): Ditto.
2426         * svg/SVGGradientElement.cpp:
2427         (WebCore::SVGGradientElement::isSupportedAttribute): Ditto.
2428         * svg/SVGGraphicsElement.cpp:
2429         (WebCore::SVGGraphicsElement::isSupportedAttribute): Ditto.
2430         * svg/SVGImageElement.cpp:
2431         (WebCore::SVGImageElement::isSupportedAttribute): Ditto.
2432         * svg/SVGLangSpace.cpp:
2433         (WebCore::addWithAndWithoutXMLPrefix): Added helper. Uses xmlAtom instead
2434         of making our own NeverDestroyed local xmlPrefix.
2435         (WebCore::SVGLangSpace::addSupportedAttributes): Rewrote to use helper.
2436         * svg/SVGLineElement.cpp:
2437         (WebCore::SVGLineElement::isSupportedAttribute): Use const auto,
2438         makeNeverDestroyed, a lambda, and the new HashSet::add overload instead of
2439         an isEmpty check and lots of separate add function calls.
2440         * svg/SVGLinearGradientElement.cpp:
2441         (WebCore::SVGLinearGradientElement::isSupportedAttribute): Ditto.
2442         * svg/SVGMarkerElement.cpp:
2443         (WebCore::SVGMarkerElement::isSupportedAttribute): Ditto.
2444         * svg/SVGMaskElement.cpp:
2445         (WebCore::SVGMaskElement::isSupportedAttribute): Ditto.
2446         * svg/SVGPathElement.cpp:
2447         (WebCore::SVGPathElement::isSupportedAttribute): Ditto.
2448         * svg/SVGPatternElement.cpp:
2449         (WebCore::SVGPatternElement::isSupportedAttribute): Ditto.
2450         * svg/SVGRadialGradientElement.cpp:
2451         (WebCore::SVGRadialGradientElement::isSupportedAttribute): Ditto.
2452         * svg/SVGTextContentElement.cpp:
2453         (WebCore::SVGTextContentElement::isSupportedAttribute): Ditto.
2454         * svg/SVGTextPathElement.cpp:
2455         (WebCore::SVGTextPathElement::isSupportedAttribute): Ditto.
2456         * svg/animation/SVGSMILElement.cpp:
2457         (WebCore::SVGSMILElement::isSupportedAttribute): Ditto.
2458
2459         * testing/MockContentFilterSettings.h: Removed unneeded include of
2460         NeverDestroyed.h.
2461
2462         * testing/MockGamepadProvider.cpp: Moved include of
2463         NeverDestroyed.h here ...
2464         * testing/MockGamepadProvider.h: ... from here.
2465
2466         * testing/MockPreviewLoaderClient.h: Removed unneeded include of
2467         NeverDestroyed.h.
2468
2469         * workers/Worker.cpp:
2470         (WebCore::allWorkers): Changed this from a global to a function.
2471         (WebCore::Worker::networkStateChanged): Updated for above change and
2472         made this a member function.
2473         (WebCore::Worker::Worker): Updated for above change and
2474         change to NetworkStateNotifier.
2475         (WebCore::Worker::~Worker): Ditto.
2476         * workers/Worker.h: Made networkStateChanged a static member instead of
2477         a friend since that is a cleaner way to give it access to private member
2478         functions.
2479
2480         * xml/XPathFunctions.cpp:
2481         (WebCore::XPath::createFunctionMap): Use create instead of populate style.
2482         (WebCore::XPath::Function::create): Use const auto and makeNeverDestroyed
2483         instead of an isEmpty check.
2484
2485         * xml/XPathParser.cpp:
2486         (WebCore::XPath::createAxisNamesMap): Use create instead of populate style.
2487         (WebCore::XPath::parseAxisName): Use const auto and makeNeverDestroyed
2488         instead of an isEmpty check.
2489
2490 2017-07-17  Brady Eidson  <beidson@apple.com>
2491
2492         REGRESSION(r219298): imported/w3c/IndexedDB-private-browsing/idbfactory_open.html is crashing occassionaly (UniqueIDBDatabase being taken from the IDBServer set twice).
2493         <rdar://problem/33294987> and https://bugs.webkit.org/show_bug.cgi?id=174354
2494
2495         Reviewed by Alex Christensen.
2496
2497         No new tests (Covered by existing tests).
2498
2499         * Modules/indexeddb/server/IDBServer.cpp:
2500         (WebCore::IDBServer::IDBServer::postDatabaseTaskReply): Remove a now invalid ASSERT
2501         
2502         * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
2503         (WebCore::IDBServer::UniqueIDBDatabase::scheduleShutdownForClose): Add a RELEASE_ASSERT.
2504         (WebCore::IDBServer::UniqueIDBDatabase::didDeleteBackingStore): Instead of an ad-hoc main thread dispatch, use the "schedule task reply" system
2505           to keep dispatch ordering in tact.
2506         (WebCore::IDBServer::UniqueIDBDatabase::postDatabaseTaskReply): Remove a now invalid ASSERT
2507         (WebCore::IDBServer::UniqueIDBDatabase::immediateCloseForUserDelete): Only take the owning pointer if the object doesn't already own itself.
2508
2509 2017-07-17  Wenson Hsieh  <wenson_hsieh@apple.com>
2510
2511         [iOS DnD] Web process uses too much memory when beginning a drag on a very large image
2512         https://bugs.webkit.org/show_bug.cgi?id=174585
2513         <rdar://problem/33302541>
2514
2515         Reviewed by Tim Horton.
2516
2517         Currently, attempting to drag a very large image fails, either due to us telling CoreGraphics to create an image
2518         buffer that is too large, or because the web process exceeds its memory limit and gets jetsamed. There are two
2519         places where we can optimize our memory use during the drag initialization sequence, and this patch improves
2520         both.
2521
2522         First, on iOS, we attempt to encode and send over a WebCore::Image in the PasteboardImage when writing to the
2523         item providers upon starting a drag. Currently, this Image is only used in the drag and drop codepath, in
2524         PlatformPasteboard::writeObjectRepresentations, to grab the size of the image being written for the purpose of
2525         specifying estimated display size. Serializing and deserializing an Image calls into Image::nativeImage, which
2526         attempts to draw the contents of the image into a buffer so that it can be shipped across to the UI process.
2527         Instead, we can simply compute the size in the web process while we already have the Image, and simply send that
2528         across. For copy/paste, this doesn't result in any behavior change, since we don't use the PasteboardImage's
2529         image in the first place.
2530
2531         Secondly, when starting a drag, we try to allocate create an image buffer the size of the WebCore::Image for the
2532         purpose of generating the drag preview. Instead, this patch establishes a limit on the size of this drag preview
2533         image, such that if the Image's size is larger, we'll scale down the drag preview image to be the maximum
2534         allowed size.
2535
2536         Test: DataInteractionTests.CanStartDragOnEnormousImage.
2537
2538         * editing/ios/EditorIOS.mm:
2539         (WebCore::Editor::writeImageToPasteboard):
2540         * platform/Pasteboard.h:
2541         * platform/graphics/GeometryUtilities.cpp:
2542         (WebCore::sizeWithAreaAndAspectRatio):
2543
2544         Introduce a new helper function to compute a size with the given aspect ratio and area.
2545
2546         * platform/graphics/GeometryUtilities.h:
2547         * platform/ios/DragImageIOS.mm:
2548         (WebCore::createDragImageFromImage):
2549         * platform/ios/PlatformPasteboardIOS.mm:
2550         (WebCore::PlatformPasteboard::writeObjectRepresentations):
2551
2552 2017-07-17  Michael Catanzaro  <mcatanzaro@igalia.com>
2553
2554         [CMake] Include most CMake modules from WebKitCommon.cmake
2555         https://bugs.webkit.org/show_bug.cgi?id=174546
2556
2557         Reviewed by Konstantin Tokarev.
2558
2559         * WebCoreMacros.cmake:
2560
2561 2017-07-17  Michael Catanzaro  <mcatanzaro@igalia.com>
2562
2563         [CMake] Macros in WebKitMacros.cmake should be prefixed with WEBKIT_ namespace
2564         https://bugs.webkit.org/show_bug.cgi?id=174547
2565
2566         Reviewed by Alex Christensen.
2567
2568         * CMakeLists.txt:
2569         * WebCoreMacros.cmake:
2570
2571 2017-07-17  Alex Christensen  <achristensen@webkit.org>
2572
2573         Modernize content extension code
2574         https://bugs.webkit.org/show_bug.cgi?id=174588
2575
2576         Reviewed by Sam Weinig.
2577
2578         No change in behavior.  Just use Ref instead of RefPtr where possible.
2579
2580         * contentextensions/ContentExtension.cpp:
2581         (WebCore::ContentExtensions::ContentExtension::create):
2582         * contentextensions/ContentExtension.h:
2583         * contentextensions/ContentExtensionsBackend.cpp:
2584         (WebCore::ContentExtensions::ContentExtensionsBackend::addContentExtension):
2585         (WebCore::ContentExtensions::ContentExtensionsBackend::actionsForResourceLoad):
2586         * contentextensions/ContentExtensionsBackend.h:
2587
2588 2017-07-17  Simon Fraser  <simon.fraser@apple.com>
2589
2590         clientX/clientY on TouchEvent.touches are wrong
2591         https://bugs.webkit.org/show_bug.cgi?id=174561
2592         rdar://problem/33336041
2593
2594         Reviewed by Tim Horton.
2595         
2596         Do some refactoring so that WebKitAdditions code that computes Touch coordinates can use
2597         the same code that MouseRelatedEvent uses.
2598         
2599         There is no behavior change in this patch, but the test exercises a behavior change in
2600         WebKitAdditions code.
2601
2602         Test: fast/events/touch/ios/touches-client-coords-after-zoom.html
2603
2604         * dom/MouseRelatedEvent.cpp:
2605         (WebCore::MouseRelatedEvent::init):
2606         (WebCore::MouseRelatedEvent::frameViewFromDOMWindow):
2607         (WebCore::MouseRelatedEvent::pagePointToClientPoint):
2608         (WebCore::MouseRelatedEvent::pagePointToAbsolutePoint):
2609         (WebCore::MouseRelatedEvent::initCoordinates):
2610         (WebCore::MouseRelatedEvent::documentToAbsoluteScaleFactor):
2611         (WebCore::MouseRelatedEvent::computePageLocation):
2612         (WebCore::MouseRelatedEvent::locationInRootViewCoordinates):
2613         (WebCore::MouseRelatedEvent::frameView): Deleted.
2614         * dom/MouseRelatedEvent.h:
2615
2616 2017-07-17  Jeremy Jones  <jeremyj@apple.com>
2617
2618         Add video fullscreen transition logging.
2619         https://bugs.webkit.org/show_bug.cgi?id=174474
2620
2621         Reviewed by Jer Noble.
2622
2623         No new tests, because there is no functional change.
2624
2625         This change just adds logging.
2626
2627         * html/HTMLVideoElement.cpp:
2628         (WebCore::HTMLVideoElement::webkitEnterFullscreen):
2629         (WebCore::HTMLVideoElement::webkitExitFullscreen):
2630         (WebCore::HTMLVideoElement::webkitSetPresentationMode):
2631
2632 2017-07-17  Chris Dumez  <cdumez@apple.com>
2633
2634         click event does not dispatch to parent when child target stops hit testing after mousedown
2635         https://bugs.webkit.org/show_bug.cgi?id=174564
2636         <rdar://problem/33340234>
2637
2638         Reviewed by Simon Fraser.
2639
2640         As per [1], if the mouse down node and the mouse release node differ, then we are supposed to
2641         fire the click event at their common ancestor, if such node exists. This patch implements this
2642         logic. This also aligns our behavior with Blink.
2643
2644         [1] https://w3c.github.io/uievents/#events-mouseevent-event-order
2645
2646         Test: fast/events/mouse-click-different-mouseDown-mouseUp-nodes.html
2647
2648         * page/EventHandler.cpp:
2649         (WebCore::targetNodeForClickEvent):
2650
2651 2017-07-17  Brady Eidson  <beidson@apple.com>
2652
2653         WKHTTPCookieStore observing only works on the default cookie store.
2654         <rdar://problem/33330724> and https://bugs.webkit.org/show_bug.cgi?id=174580
2655
2656         Reviewed by Sam Weinig.
2657
2658         Covered by new API tests.
2659         
2660         startObservingCookieChanges and stopObservingCookieChanges are passed a NetworkStorageSession to observe.
2661         On Mac/iOS, the passed-in storage session was ignored and the shared cookie storage was assumed.
2662         Let's fix that.
2663         
2664         Also, since using NSNotification based observing only works reliably for the shared cookie storage,
2665         switch to direct CFHTTPCookieStorageRef observing.
2666
2667         * WebCore.xcodeproj/project.pbxproj:
2668         
2669         * platform/network/NetworkStorageSession.h:
2670         
2671         * platform/network/cocoa/CookieStorageObserver.h: Added.
2672         * platform/network/cocoa/CookieStorageObserver.mm: Added.
2673         (WebCore::cookiesChanged):
2674         (WebCore::CookieStorageObserver::create):
2675         (WebCore::CookieStorageObserver::CookieStorageObserver):
2676         (WebCore::CookieStorageObserver::~CookieStorageObserver):
2677         (WebCore::CookieStorageObserver::startObserving):
2678         (WebCore::CookieStorageObserver::stopObserving):
2679         (WebCore::CookieStorageObserver::cookiesDidChange):
2680         
2681         * platform/network/cocoa/NetworkStorageSessionCocoa.mm:
2682         (WebCore::NetworkStorageSession::cookieStorageObserver):
2683         
2684         * platform/network/mac/CookieStorageMac.mm:
2685         (WebCore::startObservingCookieChanges):
2686         (WebCore::stopObservingCookieChanges):
2687         (-[WebCookieStorageObjCAdapter notifyCookiesChangedOnMainThread]): Deleted.
2688         (-[WebCookieStorageObjCAdapter cookiesChangedNotificationHandler:]): Deleted.
2689         (-[WebCookieStorageObjCAdapter startListeningForCookieChangeNotificationsWithCallback:]): Deleted.
2690         (-[WebCookieStorageObjCAdapter stopListeningForCookieChangeNotifications]): Deleted.
2691         
2692         * platform/spi/cf/CFNetworkSPI.h:
2693
2694 2017-07-17  Sam Weinig  <sam@webkit.org>
2695
2696         [WebIDL] Rename JSCSSValueCustom.cpp to JSDeprecatedCSSOMValueCustom.cpp to match the underlying class
2697         https://bugs.webkit.org/show_bug.cgi?id=174550
2698
2699         Reviewed by Brady Eidson.
2700
2701         * CMakeLists.txt:
2702         * WebCore.xcodeproj/project.pbxproj:
2703         * bindings/js/JSBindingsAllInOne.cpp:
2704         * bindings/js/JSCSSValueCustom.cpp: Removed.
2705         * bindings/js/JSDeprecatedCSSOMValueCustom.cpp: Renamed from bindings/js/JSCSSValueCustom.cpp.
2706         Rename file and update references.
2707
2708 2017-07-17  Antoine Quint  <graouts@apple.com>
2709
2710         REGRESSION: order of AirPlay and volume controls is inconsistent between <audio> and <video>
2711         https://bugs.webkit.org/show_bug.cgi?id=174581
2712         <rdar://problem/33297519>
2713
2714         Reviewed by Sam Weinig.
2715
2716         We had an inconsistency between <audio> and <video> controls for the relative order of the
2717         volume and AirPlay buttons. The <video> layout was correct (volume first and AirPlay after)
2718         and the <audio> layout now is the same.
2719
2720         * Modules/modern-media-controls/controls/inline-media-controls.js:
2721         (InlineMediaControls.prototype._rightContainerButtons):
2722
2723 2017-07-17  Konstantin Tokarev  <annulen@yandex.ru>
2724
2725         [CMake] Create targets before WEBKIT_INCLUDE_CONFIG_FILES_IF_EXISTS is called
2726         https://bugs.webkit.org/show_bug.cgi?id=174557
2727
2728         Reviewed by Michael Catanzaro.
2729
2730         No new tests needed.
2731
2732         * CMakeLists.txt:
2733
2734 2017-07-17  Michael Catanzaro  <mcatanzaro@igalia.com>
2735
2736         Unreviewed, rolling out r219556.
2737
2738         Broke build without WebCrypto
2739
2740         Reverted changeset:
2741
2742         "[CMake] Clean up Web Crypto build targets"
2743         https://bugs.webkit.org/show_bug.cgi?id=174253
2744         http://trac.webkit.org/changeset/219556
2745
2746 2017-07-17  Antoine Quint  <graouts@apple.com>
2747
2748         Media controls draw behind captions
2749         https://bugs.webkit.org/show_bug.cgi?id=174579
2750         <rdar://problem/33295427>
2751
2752         Reviewed by Dean Jackson.
2753
2754         Ensure the captions container is added as a previous sibling to the controls container.
2755
2756         Test: media/modern-media-controls/media-controls/media-controls-display-above-captions.html
2757
2758         * Modules/modern-media-controls/media/media-controller.js:
2759         (MediaController):
2760
2761 2017-07-17  Zan Dobersek  <zdobersek@igalia.com>
2762
2763         [CMake] Clean up Web Crypto build targets
2764         https://bugs.webkit.org/show_bug.cgi?id=174253
2765
2766         Reviewed by Michael Catanzaro.
2767
2768         Gather the common WebCrypto source files in CMakeLists.txt, including them
2769         in the build unconditionally and instead relying on ENABLE_SUBTLE_CRYPTO
2770         build guards to exclude the code from compilation if the feature is disabled.
2771
2772         PlatformGTK.cmake, PlatformMac.cmake and PlatformWPE.cmake can then remove
2773         duplicated build targets. PlatformMac.cmake still lists all the Mac-specific
2774         Web Crypto build targets.
2775
2776         PlatformGTK.cmake and PlatformWPE.cmake now include GCrypt.cmake if the build
2777         was configured to enable the use of libgcrypt. The new CMake file adds the
2778         libgcrypt-specific Web Crypto build targets to the build if the feature was
2779         enabled, and also sets up libgcrypt include directiories and libraries.
2780
2781         No new tests -- no change in behavior.
2782
2783         * CMakeLists.txt:
2784         * PlatformGTK.cmake:
2785         * PlatformMac.cmake:
2786         * PlatformWPE.cmake:
2787         * platform/GCrypt.cmake: Added.
2788
2789 2017-07-16  Michael Catanzaro  <mcatanzaro@igalia.com>
2790
2791         -Wreorder warning caused by GraphicsContext3D cleanup
2792         https://bugs.webkit.org/show_bug.cgi?id=174511
2793
2794         Reviewed by Carlos Garcia Campos.
2795
2796         * platform/graphics/cairo/GraphicsContext3DCairo.cpp:
2797         (WebCore::GraphicsContext3D::GraphicsContext3D):
2798         * platform/graphics/opengl/GraphicsContext3DOpenGLES.cpp:
2799         (WebCore::GraphicsContext3D::GraphicsContext3D):
2800
2801 2017-07-16  Antoine Quint  <graouts@apple.com>
2802
2803         Dismissing the captions panel using the mouse is too eager to remove the captions panel and media controls
2804         https://bugs.webkit.org/show_bug.cgi?id=174571
2805         <rdar://problem/33294968>
2806
2807         Reviewed by Eric Carlson.
2808
2809         We did several things wrong when dismissing the tracks panel:
2810
2811             - we did not check whether we were hosted in a shadow root when figuring if a click was on the tracks panel
2812             - we did not check whether we clicked over the media when dismissing the tracks panel
2813             - we did not check whether auto-hide was on before fading the media controls out when we clicked outside
2814               the media controls bounds
2815
2816         We now correctly account for all of those cases and implement the following behavior when clickng as the tracks
2817         panel is presented:
2818         
2819             - dismiss the panel if the click is outside of the panel
2820             - dismiss the panel and the media controls if the click is outside the video and the media controls have
2821               auto-hide on (ie. media is playing)
2822             - dismiss the panel and the media controls after the track selection animation is finished if a track is selected
2823
2824         Tests: media/modern-media-controls/tracks-panel/tracks-panel-up-click-outside-media-does-not-dimiss-media-controls-when-media-is-paused.html
2825                media/modern-media-controls/tracks-panel/tracks-panel-up-click-over-media-does-not-dimiss-media-controls-when-media-is-playing.html
2826
2827         * Modules/modern-media-controls/controls/media-controls.js:
2828         (MediaControls.prototype.hideTracksPanel): Only hide the media controls if we clicked outside of the media
2829         controls bounds and if we have auto-hide on when idle (ie. the media is playing).
2830         (MediaControls.prototype.isPointInControls): Add an option to specify whether the container should be
2831         considered when checking if a point is contained within the media controls bounds.
2832         * Modules/modern-media-controls/controls/tracks-panel.js:
2833         (TracksPanel.prototype._handleMousedown):
2834         (TracksPanel.prototype._isPointInTracksPanel): Correctly check whether the element that we started pressing
2835         on is contained within the tracks panel, accounting for the case where we are presented within a shadow root
2836         (ie. always when runing inside a Web page).
2837
2838 2017-07-16  Ali Juma  <ajuma@chromium.org>
2839
2840         DisallowUserAgentShadowContent moves out of non-UA shadow roots
2841         https://bugs.webkit.org/show_bug.cgi?id=165647
2842
2843         Reviewed by Ryosuke Niwa.
2844
2845         Make rect-based hit-testing include nodes in non-UA shadow trees when the
2846         HitTestRequest has type DisallowUserAgentShadowContent.
2847
2848         Test: fast/dom/nodesFromRect/nodesFromRect-shadow.html
2849
2850         * rendering/HitTestResult.cpp:
2851         (WebCore::HitTestResult::addNodeToRectBasedTestResult):
2852         * testing/Internals.cpp:
2853         (WebCore::Internals::nodesFromRect):
2854         * testing/Internals.h:
2855
2856 2017-07-16  Antoine Quint  <graouts@apple.com>
2857
2858         Clicking edges of media control buttons changes visual state of button (pressed) but doesn't execute action
2859         https://bugs.webkit.org/show_bug.cgi?id=174565
2860         <rdar://problem/33294833>
2861
2862         Reviewed by Dean Jackson.
2863
2864         WebCore doesn't dispatch a "click" event to a parent element when a child that was the original target when
2865         the "mousedown" occured is no longer hit-testing at the location where the mouse pointer is at when the "mouseup"
2866         occurs (see webkit.org/b/174564). Since button icons, which are a <picture> element that is a child of the
2867         <button> element for media controls buttons, shrink to 89% of their size when the ":active" pseudo-class matches,
2868         clicking on the edges of the media controls buttons would not trigger the expected action.
2869
2870         Test: media/modern-media-controls/button/button-click-on-edges.html
2871
2872         * Modules/modern-media-controls/controls/button.css:
2873         (button > picture):
2874
2875 2017-07-16  Said Abou-Hallawa  <sabouhallawa@apple.com>
2876
2877         Make the decision for asynchronously decoding an image be in one place
2878         https://bugs.webkit.org/show_bug.cgi?id=174479
2879
2880         Reviewed by Tim Horton.
2881
2882         Move all the logic of whether a large image should be asynchronously decoded 
2883         or not be in one place: RenderBoxModelObject::decodingModeForImageDraw().
2884
2885         * loader/cache/CachedImage.cpp:
2886         (WebCore::CachedImage::addPendingImageDrawingClient): Fixing unrelated 
2887         spelling error.
2888         * platform/RuntimeApplicationChecks.h:
2889         * platform/cocoa/RuntimeApplicationChecksCocoa.mm:
2890         (WebCore::IOSApplication::isIBooks):
2891         (WebCore::IOSApplication::isIBooksStorytime):
2892         * platform/graphics/BitmapImage.cpp:
2893         (WebCore::BitmapImage::updateFromSettings): Remove reading the setting
2894         largeImageAsyncDecodingEnabled from this function because it will be read
2895         by RenderBoxModelObject::decodingModeForImageDraw().
2896         (WebCore::BitmapImage::dataChanged):
2897         (WebCore::BitmapImage::draw):
2898         (WebCore::BitmapImage::shouldAnimate):
2899         (WebCore::BitmapImage::canAnimate):
2900         (WebCore::BitmapImage::canUseAsyncDecodingForLargeImages):
2901         (WebCore::BitmapImage::shouldUseAsyncDecodingForAnimatedImages):
2902         (WebCore::BitmapImage::canDestroyDecodedData):
2903         (WebCore::BitmapImage::shouldUseAsyncDecodingForLargeImages): Deleted.
2904         * platform/graphics/BitmapImage.h:
2905         * platform/graphics/ImageSource.cpp:
2906         (WebCore::ImageSource::canUseAsyncDecoding): It is okay to keep the 
2907         decoded frame if canUseAsyncDecodingForLargeImages() is true by the setting
2908         largeImageAsyncDecodingEnabled is false.
2909         (WebCore::ImageSource::shouldUseAsyncDecoding): Deleted.
2910         * platform/graphics/ImageSource.h:
2911         * rendering/RenderBoxModelObject.cpp:
2912         (WebCore::RenderBoxModelObject::decodingModeForImageDraw): The plan is to
2913         add a new Internal settings to force asynchronous image decoding regardless
2914         of the image size and the settings.
2915         (WebCore::RenderBoxModelObject::paintFillLayerExtended):
2916         * rendering/RenderBoxModelObject.h:
2917         * rendering/RenderImage.cpp:
2918         (WebCore::RenderImage::paintIntoRect):
2919
2920 2017-07-16  Michael Catanzaro  <mcatanzaro@igalia.com>
2921
2922         [CMake] Raise minimum CMake requirement
2923         https://bugs.webkit.org/show_bug.cgi?id=174545
2924
2925         Reviewed by Konstantin Tokarev.
2926
2927         * WebCoreMacros.cmake:
2928
2929 2017-07-15  Brady Eidson  <beidson@apple.com>
2930
2931         Make sure all CFHTTPCookieStorageRefs we create are scheduled.
2932         <rdar://problem/33221110> and https://bugs.webkit.org/show_bug.cgi?id=174513
2933
2934         Reviewed by Tim Horton.
2935
2936         * platform/spi/cf/CFNetworkSPI.h:
2937
2938 2017-07-15  Myles C. Maxfield  <mmaxfield@apple.com>
2939
2940         Rename RenderStyle::fontSize() to RenderStyle::computedFontPixelSize()
2941         https://bugs.webkit.org/show_bug.cgi?id=174509
2942
2943         Reviewed by Simon Fraser.
2944
2945         We have three font size functions:
2946         - computedFontSize(): returns a float
2947         - specifiedFontSize(): also returns a float
2948         - fontSize(): returns the rounded computedFontSize()
2949
2950         FontDescription uses the convention of labelling rounded values as "pixel",
2951         so a better name font fontSize() is computedFontPixelSize().
2952
2953         Also, because font sizes can never be negative, switch the type from an int
2954         to an unsigned.
2955
2956         No new tests because there is no behavior change.
2957
2958         * accessibility/atk/WebKitAccessibleInterfaceText.cpp:
2959         (getAttributeSetForAccessibilityObject):
2960         * css/StyleResolver.cpp:
2961         (WebCore::StyleResolver::adjustRenderStyle):
2962         * platform/graphics/FontDescription.h:
2963         (WebCore::FontDescription::computedPixelSize):
2964         (WebCore::FontDescription::fontSelectionRequest):
2965         * rendering/RenderBlock.cpp:
2966         (WebCore::styleForFirstLetter):
2967         * rendering/RenderRubyRun.cpp:
2968         (WebCore::shouldOverhang):
2969         (WebCore::RenderRubyRun::getOverhang):
2970         * rendering/RenderRubyText.cpp:
2971         (WebCore::RenderRubyText::adjustInlineDirectionLineBounds):
2972         * rendering/RenderThemeGtk.cpp:
2973         (WebCore::adjustSearchFieldIconStyle):
2974         (WebCore::paintSearchFieldIcon):
2975         * rendering/RenderThemeIOS.mm:
2976         (WebCore::RenderThemeIOS::adjustCheckboxStyle):
2977         (WebCore::RenderThemeIOS::adjustRadioStyle):
2978         * rendering/RenderThemeMac.mm:
2979         (WebCore::RenderThemeMac::controlSizeForFont):
2980         (WebCore::RenderThemeMac::controlSizeForSystemFont):
2981         (WebCore::RenderThemeMac::paintMenuListButtonDecorations):
2982         (WebCore::RenderThemeMac::popupInternalPaddingBox):
2983         (WebCore::RenderThemeMac::adjustMenuListButtonStyle):
2984         * rendering/RenderThemeWin.cpp:
2985         (WebCore::RenderThemeWin::adjustSearchFieldCancelButtonStyle):
2986         (WebCore::RenderThemeWin::adjustSearchFieldResultsDecorationPartStyle):
2987         (WebCore::RenderThemeWin::adjustSearchFieldResultsButtonStyle):
2988         * rendering/TextDecorationPainter.cpp:
2989         (WebCore::TextDecorationPainter::paintTextDecoration):
2990         * rendering/mathml/RenderMathMLRow.cpp:
2991         (WebCore::RenderMathMLRow::computeLineVerticalStretch):
2992         * rendering/style/RenderStyle.cpp:
2993         (WebCore::RenderStyle::computedFontPixelSize):
2994         (WebCore::RenderStyle::computedLineHeight):
2995         (WebCore::RenderStyle::fontSize): Deleted.
2996         * rendering/style/RenderStyle.h:
2997         * style/InlineTextBoxStyle.cpp:
2998         (WebCore::visualOverflowForDecorations):
2999         * style/StyleTreeResolver.cpp:
3000         (WebCore::Style::TreeResolver::resolveElement):
3001         * svg/SVGLengthContext.cpp:
3002         (WebCore::SVGLengthContext::convertValueFromUserUnitsToEMS):
3003         (WebCore::SVGLengthContext::convertValueFromEMSToUserUnits):
3004
3005 2017-07-15  Myles C. Maxfield  <mmaxfield@apple.com>
3006
3007         line-height: <number> gets visually applied twice when text autosizing is in effect
3008         https://bugs.webkit.org/show_bug.cgi?id=174536
3009         <rdar://problem/33338259>
3010
3011         Reviewed by Simon Fraser.
3012
3013         StyleBuilderConverter::convertLineHeight() converts line-height: <number> into a
3014         "percentage" length. Then, when layout needs to know what the computed value of
3015         line-height is, RenderStyle::computedLineHeight() multiplies this percentage by
3016         the computed font size.
3017
3018         With autosizing, the computed font size already incorporates the autosizing
3019         multiplier, so we shouldn't also incorporate this multiplier into the percentage
3020         value itself. getComputedStyle()'s lineHeightFromStyle() was compensating for
3021         this double application by multiplying the percentage by the font-size's specified
3022         value instead of its computed value, which is incorrect.
3023
3024         Test: fast/text-autosizing/line-height-number.html
3025
3026         * css/CSSComputedStyleDeclaration.cpp:
3027         (WebCore::lineHeightFromStyle):
3028         * css/StyleBuilderConverter.h:
3029         (WebCore::StyleBuilderConverter::convertLineHeight):
3030
3031 2017-07-15  Wenson Hsieh  <wenson_hsieh@apple.com>
3032
3033         [iOS WK2] Presenting an action sheet on an image map prevents selection UI from updating
3034         https://bugs.webkit.org/show_bug.cgi?id=174539
3035         <rdar://problem/33307395>
3036
3037         Reviewed by Darin Adler.
3038
3039         Currently, if TextIndicator fails to take a snapshot in TextIndicator::createWithRange, we will enter an
3040         inconsistent state in the web process where Editor will continue to ignore selection changes until the next time
3041         Editor::setIgnoreSelectionChanges(false) is called. This causes us to indefinitely defer EditorState updates to
3042         the UI process, which leads to selection UI appearing unresponsive.
3043
3044         To fix this, we introduce a new TemporarySelectionChange object to simplify selection changes and/or
3045         EditorState-update-ignoring behaviors within the scope of a single function. The constructor applies these
3046         temporary changes, and the destructor reverts them as needed to their prior values.
3047
3048         This patch only adopts TemporarySelectionChange in order to fix this bug, but future patches will replace the
3049         remaining places where we temporarily change selection and/or ignore selection with this helper.
3050
3051         Test: ActionSheetTests.ImageMapDoesNotDestroySelection.
3052
3053         * editing/Editor.cpp:
3054         (WebCore::TemporarySelectionChange::TemporarySelectionChange):
3055         (WebCore::TemporarySelectionChange::~TemporarySelectionChange):
3056         * editing/Editor.h:
3057         * editing/FrameSelection.h:
3058         (WebCore::FrameSelection::isUpdateAppearanceEnabled):
3059         * page/TextIndicator.cpp:
3060         (WebCore::TextIndicator::createWithRange):
3061
3062 2017-07-15  Myles C. Maxfield  <mmaxfield@apple.com>
3063
3064         Clean up line-height and minimumFontSize functions
3065         https://bugs.webkit.org/show_bug.cgi?id=174535
3066
3067         Reviewed by Simon Fraser.
3068
3069         No behavior change.
3070
3071         No new tests because there is no behavior change.
3072
3073         * css/StyleBuilderConverter.h:
3074         (WebCore::StyleBuilderConverter::convertLineHeight):
3075         * css/StyleResolver.cpp:
3076         (WebCore::StyleResolver::styleForKeyframe):
3077         (WebCore::StyleResolver::adjustRenderStyle):
3078         (WebCore::StyleResolver::pseudoStyleRulesForElement):
3079         (WebCore::StyleResolver::applyMatchedProperties):
3080         (WebCore::StyleResolver::cascadedPropertiesForRollback):
3081         (WebCore::StyleResolver::applyProperty):
3082         (WebCore::StyleResolver::checkForZoomChange):
3083         (WebCore::StyleResolver::createFilterOperations):
3084         (WebCore::StyleResolver::CascadedProperties::set):
3085         (WebCore::StyleResolver::applyCascadedProperties):
3086         * style/StyleFontSizeFunctions.cpp:
3087         (WebCore::Style::computedFontSizeFromSpecifiedSize):
3088         (WebCore::Style::computedFontSizeFromSpecifiedSizeForSVGInlineText):
3089         (): Deleted.
3090
3091 2017-07-14  Jonathan Bedard  <jbedard@apple.com>
3092
3093         Add iOS 11 SPI
3094         https://bugs.webkit.org/show_bug.cgi?id=174430
3095         <rdar://problem/33269288>
3096
3097         Reviewed by Tim Horton.
3098
3099         * WebCore.xcodeproj/project.pbxproj: Add sqlite3SPI.h header.
3100         * platform/ios/PlatformPasteboardIOS.mm: Move UIKit SPI to UIKitSPI.h.
3101         * platform/ios/WebItemProviderPasteboard.mm: Ditto.
3102         * platform/network/cf/FormDataStreamCFNet.cpp: Explicitly define fnfErr and remove
3103         MacErrors.h header for iOS.
3104         * platform/spi/cocoa/IOSurfaceSPI.h: IOSurface is no longer SPI in iOS 11.
3105         * platform/spi/cocoa/PassKitSPI.h: Do not re-define setRequiredShippingContactFields
3106         and setRequiredBillingContactFields in iOS 11.
3107         * platform/spi/cocoa/QuartzCoreSPI.h: Added QuartzCoreSPI used in iOS 11.
3108         * platform/spi/ios/UIKitSPI.h: Add drag-and-drop SPI.
3109         * platform/spi/ios/sqlite3SPI.h: Define required sqlite3 macros.
3110         * platform/sql/SQLiteFileSystem.cpp: Use sqlite3SPI.h.
3111
3112 2017-07-14  Zan Dobersek  <zdobersek@igalia.com>
3113
3114         [GCrypt] Implement CryptoKeyRSA PKCS#8 exports
3115         https://bugs.webkit.org/show_bug.cgi?id=173697
3116
3117         Reviewed by Jiewen Tan.
3118
3119         Implement the PKCS#8 import operation for RSA keys for platforms that use
3120         libgcrypt.
3121
3122         In CryptoKeyRSA::exportPkcs8(), we bail early with an invalid access exception if
3123         this export is not being done for a private key. Otherwise, we start with creating
3124         the `RSAPrivateKey` ASN.1 structure, writing out '0' under the `version` element
3125         and then retrieving the modulus, public and private exponent and both primes.
3126         MPI data for those parameters is written out into corresponding elements in the
3127         `RSAPrivateKey` structure. We then manually compute values of both exponents and
3128         the coefficient parameters, using the private exponent's and both primes' MPI
3129         values. The p and q parameters (i.e. the primes) are switched in libgcrypt,
3130         deviating from the standard practice, so we have to operate with those two
3131         accordingly. We eliminate the optional `otherPrimeInfos` attribute on the
3132         `RSAPrivateKey` structure. Support for this attribute will be added later.
3133
3134         We then create the `PrivateKeyInfo` ASN.1 structure, and write out '0' under the
3135         `version` element. The id-rsaEncryption object identifier is written out under
3136         the `algorithm.algorithm` element. In the future, an object identifier that
3137         matches this key's algorithm will have to be written out here (id-RSASSA-PSS or
3138         id-RSAES-OAEP), along with the appropriate parameters structure, but no test in
3139         WebKit or the web-platform-tests suite covers this detail. For now, a null value
3140         is written out under the `algorithm.parameters` element.
3141
3142         Data for the `RSAPrivateKey` structure is retrieved and written out under the
3143         `privateKey` element.  The optional `attributes` element on the `PrivateKeyInfo`
3144         structure is eliminated.
3145
3146         Data that was encoded through the `PrivateKeyInfo` structure is then retrieved
3147         and returned from the exportPkcs8() method.
3148
3149         No new tests -- related tests are now passing and are unskipped.
3150
3151         * crypto/gcrypt/CryptoKeyRSAGCrypt.cpp:
3152         (WebCore::CryptoKeyRSA::exportPkcs8):
3153
3154 2017-07-14  Zan Dobersek  <zdobersek@igalia.com>
3155
3156         [GCrypt] Implement CryptoKeyRSA PKCS#8 imports
3157         https://bugs.webkit.org/show_bug.cgi?id=173696
3158
3159         Reviewed by Jiewen Tan.
3160
3161         Implement the PKCS#8 import operation for RSA keys for platforms that use
3162         libgcrypt.
3163
3164         In CryptoKeyRSA::importPkcs8(), the provided key data is decoded against the
3165         'PrivateKeyInfo` ASN.1 structure. We then validate the `version` element and
3166         check that the `privateKeyAlgorithm.algorithm` element contains a supported
3167         object identifier. This check is for now mostly superficial, only ensuring
3168         that the object identifier is either id-rsaEncryption, id-RSAES-OAEP or
3169         id-RSASSA-PSS. This has to be further extended to also check the
3170         id-sha{1,256,384,512}WithRSAEncryption identifiers as well as decoding the
3171         `privateKeyAlgorithm.parameters` element against a specific ASN.1 structure, if
3172         necessary (RSASSA-PSS-params or RSAES-OAEP-params), and cross-checking the
3173         specified digest algorithm with the algorithm that's specified through the main
3174         object identifier or the structure contained in `privateKeyAlgorithm.parameters`.
3175         This is avoided for now because no test in WebKit or the web-platform-tests
3176         suite covers this detail of the specification.
3177
3178         Data under the `privateKey` element is decoded against the `RSAPrivateKey` ASN.1
3179         structure, and the `version` element of that structure is validated. We then
3180         retrieve data from that structure for the modulus, public exponent, private
3181         exponent, both primes, both exponents and the coefficient parameters, bailing if
3182         any of them is missing. Because libgcrypt switches the use of p and q parameters,
3183         deviating from the standard use, we have to recompute the u parameter (the
3184         coefficient). With that calculated, we're then able to construct the `private-key`
3185         s-expression, embedding into it all the necessary parameters, and transferring
3186         the ownership of this object to the new CryptoKeyRSA object that's then returned
3187         from the importPkcs8() method.
3188
3189         No new tests -- related tests are now passing and are unskipped.
3190
3191         * crypto/gcrypt/CryptoKeyRSAGCrypt.cpp:
3192         (WebCore::CryptoKeyRSA::importPkcs8):
3193
3194 2017-07-14  Chris Dumez  <cdumez@apple.com>
3195
3196         Possible crash in ~UserGestureIndicator() when on non-main thread
3197         https://bugs.webkit.org/show_bug.cgi?id=174522
3198         <rdar://problem/30283071>
3199
3200         Reviewed by Sam Weinig.
3201
3202         UserGestureIndicator objects may be constructed / destructed in worker thread
3203         (e.g. in DOMTimer::fired()). The UserGestureIndicator constructor / destructor
3204         are supposed to be no-op on non-main threads so that it is safe. However,
3205         we were mistakenly initializing m_previousToken data member in the constructor
3206         on background thread, which meant that we could crash later on in the
3207         UserGestureIndicator destructor when destroying m_previousToken.
3208
3209         Test: fast/workers/worker-user-gesture.html
3210
3211         * dom/UserGestureIndicator.cpp:
3212         (WebCore::currentToken):
3213         (WebCore::UserGestureIndicator::UserGestureIndicator):
3214
3215 2017-07-14  Matt Lewis  <jlewis3@apple.com>
3216
3217         Unreviewed, rolling out r219516.
3218
3219         This caused an API failure on macOS.
3220
3221         Reverted changeset:
3222
3223         "Make sure all CFHTTPCookieStorageRefs we create are
3224         scheduled."
3225         https://bugs.webkit.org/show_bug.cgi?id=174513
3226         http://trac.webkit.org/changeset/219516
3227
3228 2017-07-14  Jer Noble  <jer.noble@apple.com>
3229
3230         Allow clients to override their own hardware media requirements where no fallback media exists.
3231         https://bugs.webkit.org/show_bug.cgi?id=174426
3232         <rdar://problem/32537704>
3233
3234         Reviewed by Eric Carlson.
3235
3236         Add a new setting which allows clients to specify their own mediaContentTypesRequiringHardwareSupport should be
3237         ignared in the case where no fallback exists, such as the case of a single <source> element, or setting the src
3238         attribute directly.
3239
3240         * html/HTMLMediaElement.cpp:
3241         (WebCore::HTMLMediaElement::havePotentialSourceChild):
3242         (WebCore::HTMLMediaElement::selectNextSourceChild):
3243         (WebCore::HTMLMediaElement::sourceWasAdded):
3244         (WebCore::HTMLMediaElement::sourceWasRemoved):
3245         (WebCore::HTMLMediaElement::mediaPlayerShouldCheckHardwareSupport):
3246         * html/HTMLMediaElement.h:
3247         * page/Settings.h:
3248         * platform/graphics/MediaPlayer.cpp:
3249         (WebCore::MediaPlayer::shouldCheckHardwareSupport):
3250         * platform/graphics/MediaPlayer.h:
3251         (WebCore::MediaPlayerClient::mediaPlayerShouldCheckHardwareSupport):
3252         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
3253         (WebCore::MediaPlayerPrivateAVFoundationObjC::assetStatus):
3254         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
3255         (WebCore::SourceBufferPrivateAVFObjC::didParseStreamDataAsAsset):
3256
3257 2017-07-14  Chris Dumez  <cdumez@apple.com>
3258
3259         Possible crash under NetworkSocketStream::didFailSocketStream()
3260         https://bugs.webkit.org/show_bug.cgi?id=174526
3261         <rdar://problem/32831441>
3262
3263         Reviewed by Brent Fulgham.
3264
3265         Call m_client.didFailSocketStream() asynchronously in the constructor as our
3266         caller (the client) is also being initialized at this point.
3267
3268         * platform/network/cf/SocketStreamHandleImplCFNet.cpp:
3269         (WebCore::SocketStreamHandleImpl::SocketStreamHandleImpl):
3270
3271 2017-07-14  Youenn Fablet  <youenn@apple.com>
3272
3273         WebRTC: silence data not sent for disabled audio track
3274         https://bugs.webkit.org/show_bug.cgi?id=174456
3275         <rdar://problem/33284623>
3276
3277         Reviewed by Eric Carlson.
3278
3279         Test: webrtc/audio-muted-stats.html
3280               webrtc/audio-muted-stats2.html
3281
3282         Adding a timer-based approach to send 10ms of silence every second.
3283         This is consistent with how muted video tracks are implemented.
3284         In case the audio track is muted at the time it is added, no silence data is sent.
3285
3286         * platform/mediastream/mac/RealtimeOutgoingAudioSource.cpp:
3287         (WebCore::RealtimeOutgoingAudioSource::RealtimeOutgoingAudioSource):
3288         (WebCore::RealtimeOutgoingAudioSource::initializeConverter):
3289         (WebCore::RealtimeOutgoingAudioSource::stop):
3290         (WebCore::RealtimeOutgoingAudioSource::sourceMutedChanged):
3291         (WebCore::RealtimeOutgoingAudioSource::sourceEnabledChanged):
3292         (WebCore::RealtimeOutgoingAudioSource::handleMutedIfNeeded):
3293         (WebCore::RealtimeOutgoingAudioSource::sendSilence):
3294         * platform/mediastream/mac/RealtimeOutgoingAudioSource.h:
3295
3296 2017-07-14  Michael Catanzaro  <mcatanzaro@igalia.com>
3297
3298         [CMake] Unclear distinction between WebKitHelpers and WebKitMacros
3299         https://bugs.webkit.org/show_bug.cgi?id=153189
3300
3301         Reviewed by Antonio Gomes.
3302
3303         * CMakeLists.txt: Include WebCoreMacros.cmake.
3304         * WebCoreMacros.cmake: Added.
3305
3306 2017-07-14  Jeremy Jones  <jeremyj@apple.com>
3307
3308         Fix style for name of class alloc function in WebVideoFullscreenInterfaceAVKit.
3309         https://bugs.webkit.org/show_bug.cgi?id=174476
3310
3311         Reviewed by Alex Christensen.
3312
3313         No new tests because no behavior change.
3314
3315         This is a rename for per style requirements.
3316
3317         * platform/ios/WebVideoFullscreenInterfaceAVKit.mm:
3318         (allocWebAVPictureInPicturePlayerLayerViewInstance):
3319         (WebAVPlayerLayerView_pictureInPicturePlayerLayerView):
3320         (allocWebAVPlayerLayerViewInstance):
3321         (WebVideoFullscreenInterfaceAVKit::setupFullscreen):
3322         (getWebAVPictureInPicturePlayerLayerViewClass): Deleted.
3323         (getWebAVPlayerLayerViewClass): Deleted.
3324
3325 2017-07-14  Jer Noble  <jer.noble@apple.com>
3326
3327         [MSE] Removing samples when presentation order does not match decode order can cause bad behavior.
3328         https://bugs.webkit.org/show_bug.cgi?id=174514
3329
3330         Reviewed by Sam Weinig.
3331
3332         Test: media/media-source/media-source-remove-decodeorder-crash.html
3333
3334         Fix the algorithm in removeCodedFrames() so that it's not possible to have a removePresentationStart >
3335         removePresentationEnd (and also removeDecodeStart > removeDecodeEnd).
3336
3337         * Modules/mediasource/SampleMap.cpp:
3338         (WebCore::PresentationOrderSampleMap::findSampleContainingOrAfterPresentationTime):
3339         (WebCore::PresentationOrderSampleMap::findSampleStartingAfterPresentationTime):
3340         * Modules/mediasource/SampleMap.h:
3341         * Modules/mediasource/SourceBuffer.cpp:
3342         (WebCore::SourceBuffer::removeCodedFrames):
3343
3344 2017-07-14  Youenn Fablet  <youenn@apple.com>
3345
3346         Increase CoreAudio render audio buffer sizes for WebRTC
3347         https://bugs.webkit.org/show_bug.cgi?id=174508
3348
3349         Reviewed by Eric Carlson.
3350
3351         Covered by manually testing audio rendering through WebRTC sites.
3352
3353         * platform/mediastream/mac/AudioTrackPrivateMediaStreamCocoa.cpp:
3354         (WebCore::AudioTrackPrivateMediaStreamCocoa::createAudioUnit): Setting audio buffer size equivalent to 20 ms.
3355
3356 2017-07-14  Brady Eidson  <beidson@apple.com>
3357
3358         Make sure all CFHTTPCookieStorageRefs we create are scheduled.
3359         <rdar://problem/33221110> and https://bugs.webkit.org/show_bug.cgi?id=174513
3360
3361         Reviewed by Tim Horton.
3362
3363         * platform/spi/cf/CFNetworkSPI.h:
3364
3365 2017-07-14  Youenn Fablet  <youenn@apple.com>
3366
3367         Remove CoreAudioCaptureSource speaker configuration
3368         https://bugs.webkit.org/show_bug.cgi?id=174512
3369
3370         Reviewed by Eric Carlson.
3371
3372         Covered by manually testing audio rendering through WebRTC sites.
3373
3374         * platform/mediastream/mac/CoreAudioCaptureSource.cpp:
3375         (WebCore::CoreAudioSharedUnit::setupAudioUnit):
3376
3377 2017-07-14  Eric Carlson  <eric.carlson@apple.com>
3378
3379         [MediaStream] Limit the number of remote video samples queued
3380         https://bugs.webkit.org/show_bug.cgi?id=174505
3381         <rdar://problem/33223015>
3382
3383         Reviewed by Youenn Fablet.
3384
3385         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
3386         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::removeOldSamplesFromPendingQueue): Only
3387         enqueue a fixed number of frames with invalid or negative decode times.
3388
3389 2017-07-14  Youenn Fablet  <youenn@apple.com>
3390
3391         Report CoreAudioCaptureSource failure in case shared unit stops working properly
3392         https://bugs.webkit.org/show_bug.cgi?id=174494
3393
3394         Reviewed by Eric Carlson.
3395
3396         Manual test by interrupting an audio capture on Mac.
3397
3398         This patch adds a timer to CoreAudioSharedUnit.
3399         In case the capture callback is not called after one second, the shared unit is said to fail.
3400         Each source is notified that capture is failing.
3401         This will in turn trigger onend track event so that web pages can remedy capture failure.
3402
3403         Timer starts with 10 seconds for audio data to start being captured.
3404         It is then decreased to 2 seconds.
3405
3406         * platform/mediastream/RealtimeMediaSource.cpp:
3407         (WebCore::RealtimeMediaSource::captureFailed):
3408         * platform/mediastream/RealtimeMediaSource.h:
3409         * platform/mediastream/mac/CoreAudioCaptureSource.cpp:
3410         (WebCore::CoreAudioSharedUnit::CoreAudioSharedUnit):
3411         (WebCore::CoreAudioSharedUnit::processMicrophoneSamples):
3412         (WebCore::CoreAudioSharedUnit::startInternal):
3413         (WebCore::CoreAudioSharedUnit::verifyIsCapturing):
3414         (WebCore::CoreAudioSharedUnit::stopInternal):
3415
3416 2017-07-14  Jer Noble  <jer.noble@apple.com>
3417
3418         Adding the 'autoplay' attribute to a media element during a user gesture should remove user gesture restrictions.
3419         https://bugs.webkit.org/show_bug.cgi?id=174373
3420
3421         Reviewed by Eric Carlson.
3422
3423         Test: media/video-add-autoplay-user-gesture.html
3424
3425         * html/HTMLMediaElement.cpp:
3426         (WebCore::HTMLMediaElement::parseAttribute):
3427
3428 2017-07-14  Matt Lewis  <jlewis3@apple.com>
3429
3430         Unreviewed, rolling out r219500.
3431
3432         The test is consistently failing on iOS simulator.
3433
3434         Reverted changeset:
3435
3436         "AX: VoiceOver silent or skipping over time values on media
3437         player."
3438       &n