Improve use of NeverDestroyed
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2017-07-17  Darin Adler  <darin@apple.com>
2
3         Improve use of NeverDestroyed
4         https://bugs.webkit.org/show_bug.cgi?id=174348
5
6         Reviewed by Sam Weinig.
7
8         * Modules/encryptedmedia/MediaKeySession.cpp: Removed unneeded include of
9         NeverDestroyed.h.
10
11         * Modules/encryptedmedia/legacy/LegacyCDM.cpp:
12         (WebCore::installedCDMFactories): Use makeNeverDestroyed and a lambda rather
13         than a separate boolean for initialization.
14
15         * Modules/encryptedmedia/legacy/LegacyCDMSessionClearKey.cpp:
16         (WebCore::clearKeyVM): Removed unneeded use of NeverDestroyed to hold a
17         RefPtr. Simple to just use leakRef instead.
18
19         * Modules/gamepad/GamepadManager.cpp: Added an include of NeverDestroyed.h.
20
21         * Modules/indexeddb/IDBTransaction.cpp: Removed unneeded include of
22         NeverDestroyed.h.
23         * Modules/indexeddb/server/MemoryObjectStore.cpp: Ditto.
24
25         * Modules/mediasession/MediaSessionManager.cpp: Moved include of
26         NeverDestroyed.h here ...
27         * Modules/mediasession/MediaSessionManager.h: ... from here.
28
29         * Modules/mediasource/MediaSourceRegistry.cpp: Moved include of
30         NeverDestroyed.h here ...
31         * Modules/mediasource/MediaSourceRegistry.h: ... from here.
32
33         * Modules/mediasource/SourceBuffer.cpp: Removed unneeded include of
34         NeverDestroyed.h.
35
36         * Modules/plugins/QuickTimePluginReplacement.h: Initialize
37         m_scriptObject in the class definition.
38
39         * Modules/plugins/QuickTimePluginReplacement.mm:
40         (WebCore::QuickTimePluginReplacement::supportsMimeType): Use
41         makeNeverDestroyed and the HashSet constructor instead of a loop.
42         (WebCore::QuickTimePluginReplacement::supportsFileExtension): Ditto.
43         (WebCore::QuickTimePluginReplacement::QuickTimePluginReplacement): Did a
44         slight cleanup of the initializers.
45         (WebCore::QuickTimePluginReplacement::~QuickTimePluginReplacement): Added
46         a FIXME; unclear why there is code here at all.
47
48         * accessibility/AccessibilityRenderObject.cpp:
49         (WebCore::AccessibilityRenderObject::inheritsPresentationalRole): Use
50         makeNeverDestroyed and the Vector constructor instead of using empty
51         vector checks and Vector::add. Use std::any_of rather than Vector::contains
52         since we now are matching against pointers.
53
54         * bindings/scripts/CodeGeneratorJS.pm:
55         (GenerateEnumerationImplementationContent): Use const NeverDestroyed.
56
57         * bindings/scripts/test/JS/JSTestCallbackInterface.cpp:
58         * bindings/scripts/test/JS/JSTestObj.cpp:
59         * bindings/scripts/test/JS/JSTestStandaloneDictionary.cpp:
60         * bindings/scripts/test/JS/JSTestStandaloneEnumeration.cpp:
61         Regenerated.
62
63         * css/CSSProperty.cpp:
64         (WebCore::borderDirections): Removed unnecesssary use of NeverDestroyed
65         for a global object that has a trivial destructor.
66
67         * css/ElementRuleCollector.cpp:
68         (WebCore::leftToRightDeclaration): Removed unneeded use of NeverDestroyed to hold a
69         Ref. Simple to just use leakRef instead. Also use a lambda instead of an explicit
70         isEmpty check each time this is called.
71         (WebCore::rightToLeftDeclaration): Ditto.
72
73         * css/makeprop.pl: Removed unneeded include of NeverDestroyed.h and the
74         uneeded global emptyShorthand. Constructing an empty StylePropertyShorthand
75         is no less efficient than copying a global empty one was.
76
77         * dom/CustomElementReactionQueue.cpp: Added an include of NeverDestroyed.h.
78
79         * dom/DOMImplementation.cpp: Removed unneeded include of NeverDestroyed.h.
80         * dom/InputEvent.cpp: Ditto.
81
82         * dom/Microtasks.cpp: Moved include of NeverDestroyed.h here ...
83         * dom/Microtasks.h: ... from here.
84
85         * dom/MutationObserver.cpp: Added an include of NeverDestroyed.h.
86
87         * dom/ScopedEventQueue.cpp: Moved include of NeverDestroyed.h here ...
88         * dom/ScopedEventQueue.h: ... from here. Added Forward.h.
89
90         * dom/ScriptElement.cpp:
91         (WebCore::isLegacySupportedJavaScriptLanguage): Use makeNeverDestroyed
92         and the HashSet constructor rather than an isEmpty check and a lot of
93         add function calls. Also removed comments that don't have value any more,
94         with dubious no longer relevant claims about the behavior of old web browsers.
95         The function that calls this one already has sufficient comments about why we
96         hope some day this function can be eliminated.
97
98         * dom/SecurityContext.cpp: Removed unneeded include of NeverDestroyed.h.
99
100         * dom/make_names.pl:
101         (printFactoryCppFile): Instead of using a "populate" function, use a function
102         that creates as HashMap. Then use const auto and makeNeverDestroyed.
103         (printWrapperFactoryCppFile): Ditto.
104
105         * editing/AlternativeTextController.cpp:
106         (WebCore::markerTypesForAutocorrection): Use makeNeverDestroyed
107         and the Vector constructor rather than an isEmpty check and a lot of
108         append function calls.
109         (WebCore::markerTypesForReplacement): Ditto.
110         (WebCore::markerTypesForAppliedDictationAlternative): Ditto.
111
112         * editing/EditingStyle.cpp:
113         (WebCore::htmlElementEquivalents): Use const auto, makeNeverDestroyed,
114         the Vector constructor, and new rather than make_unique. Changed return
115         type to use const pointers rather than unique_ptr with non-const type.
116         (WebCore::EditingStyle::conflictsWithImplicitStyleOfElement): Updated
117         for the above change to htmlElementEquivalents.
118         (WebCore::htmlAttributeEquivalents): Same approach as above.
119         (WebCore::EditingStyle::conflictsWithImplicitStyleOfAttributes): Ditto.
120         (WebCore::elementMatchesAndPropertyIsNotInInlineStyleDecl): Take
121         references instead of pointers.
122         (WebCore::EditingStyle::mergeInlineAndImplicitStyleOfElement): Updated
123         for the above.
124
125         * editing/FormatBlockCommand.cpp:
126         (WebCore::isElementForFormatBlock): Use const auto, makeNeverDestroyed,
127         and the HashSet constructor rather than isEmpty and a lot of calls to add.
128         * editing/RemoveFormatCommand.cpp:
129         (WebCore::isElementForRemoveFormatCommand): Ditto.
130
131         * editing/ReplaceSelectionCommand.cpp:
132         (WebCore::isProhibitedParagraphChild): Use const auto, makeNeverDestroyed,
133         and a lambda, rather than isEmpty and a lot of calls to add.
134
135         * html/Autofill.cpp:
136         (WebCore::fieldNameMap): Changed return type to be const. Use const auto,
137         makeNeverDestroyed, a lambda, and an array of values rather than isEmpty
138         and a lot of calls to add. Stopped doing the ConstructFromLiteral
139         optimization here. (Easy to add it back if that is a mistake.)
140
141         * html/HTMLObjectElement.cpp:
142         (WebCore::isRecognizedTagName): Use const auto, makeNeverDestroyed, and
143         a lambda rather than isEmpty.
144
145         * html/HTMLStyleElement.cpp: Added include of NeverDestroyed.h.
146
147         * html/HTMLVideoElement.cpp: Removed uneeded include of NeverDestroyed.h.
148
149         * html/InputType.cpp:
150         (WebCore::createInputTypeFactoryMap): Replaced the populate function
151         with this create function.
152         (WebCore::InputType::create): Use const auto and makeNeverDestroyed
153         istead of isEmpty. Also put the map right where it is used so it's
154         not initialized in code path where not needed.
155
156         * html/parser/HTMLParserIdioms.cpp: Removed uneeded include of
157         NeverDestroyed.h.
158
159         * inspector/InspectorApplicationCacheAgent.cpp:
160         (WebCore::InspectorApplicationCacheAgent::networkStateChanged):
161         Merged into a single line.
162
163         * loader/ContentFilter.cpp:
164         (WebCore::blockedPageURL): Use const auto and makeNeverDestroyed
165         rather than std::call_once. Since this is a URL and has a non-thread-safe
166         reference count, this was not thread safe before, so no need to use the
167         more roundabout and less efficient idiom for its thread safety.
168
169         * loader/CrossOriginAccessControl.cpp:
170         (WebCore::isOnAccessControlResponseHeaderWhitelist): Deleted.
171         * loader/CrossOriginAccessControl.h: Deleted unused function
172         isOnAccessControlResponseHeaderWhitelist.
173
174         * loader/EmptyClients.cpp: Use leakRef instead of NeverDestroyed<Ref>.
175
176         * loader/appcache/ApplicationCacheStorage.cpp: Removed unneeded include of
177         NeverDestroyed.h.
178         * page/CaptionUserPreferences.cpp: Ditto.
179
180         * page/DebugPageOverlays.cpp:
181         (WebCore::touchEventRegionColors): Changed the return type to const, since
182         the callers do not modify the map. Use const auto, makeNeverDestroyed, and
183         a lambda rather than isEmpty and repeated calls to add.
184
185         * page/MainFrame.cpp: Removed unneeded include of NeverDestroyed.h.
186
187         * page/MemoryRelease.cpp:
188         (WebCore::releaseMemory): Use a function directly instead of calling it
189         inside a lambda.
190
191         * page/NavigatorBase.cpp:
192         (WebCore::NavigatorBase::onLine): Updated to call
193         NetworkStateNotifier::singleton.
194
195         * page/Page.cpp:
196         (WebCore::allPages): Made this a function instead of a global to use the
197         normal idiom for such globals.
198         (WebCore::Page::forEachPage): Updated for change to allPages.
199         (WebCore::networkStateChanged): Ditto. Also removed a bit of unnecessary
200         churn by using const AtomicString& instead of AtomicString.
201         (WebCore::Page::Page): Moved initialization of most data members to the
202         class definition. Removed initialiation of allPages. Updated the use of
203         NetworkStateNotifier for its new slightly changed  interface.
204         (WebCore::Page::~Page): Updated for change to allPages.
205         (WebCore::Page::clearPreviousItemFromAllPages): Ditto.
206         (WebCore::Page::updateStyleForAllPagesAfterGlobalChangeInEnvironment): Ditto.
207         (WebCore::Page::refreshPlugins): Ditto.
208
209         * page/Page.h: Moved initialization of most data members here.
210
211         * page/PerformanceUserTiming.cpp: Removed many unneded includes.
212         (WebCore::restrictedMarkFunction): Use const auto, makeNeverDestroyed, and
213         a lambda instead of isEmpty. Also use an array rather than std::array and
214         got rid fo the unneeded use of anonymous namespace since this is fine in
215         the top level WebCore namespace.
216         (WebCore::clearPerformanceEntries): Tweaked coding style.
217         (WebCore::UserTiming::mark): Ditto.
218         (WebCore::UserTiming::findExistingMarkStartTime): Got rid of double hash
219         table lookup by using find instead of using contains followed by get.
220         removed unneeded explicit cast to double. Tweaked coding style.
221         (WebCore::convertToEntrySequence): Tweaked coding style.
222         (WebCore::getEntrySequenceByName): Deleted.
223         (WebCore::UserTiming::getMarks): Call get directly instead of getEntrySequenceByName.
224         (WebCore::UserTiming::getMeasures): Ditto.
225
226         * page/RuntimeEnabledFeatures.cpp: Moved include of NeverDestroyed.h here ...
227         * page/RuntimeEnabledFeatures.h: ... from here. Added Forward.h and Noncopyable.h.
228
229         * platform/LocalizedStrings.cpp: Removed unneeded include of NeverDestroyed.h.
230
231         * platform/MIMETypeRegistry.cpp:
232         (WebCore::initializeSupportedImageMIMETypes): Added a missing const for a global
233         constant array.
234         (WebCore::initializeSupportedJavaScriptMIMETypes): Ditto.
235         (WebCore::initializeSupportedNonImageMimeTypes): Ditto.
236         (WebCore::typesForCommonExtension): Replaced the old mediaMIMETypeMap function
237         with this one. Moved the common media types array here since it's only used here.
238         Use const auto, makeNeverDestroyed, and a lambda instead of using an isEmpty check.
239         Iterate the array using a mdoern for loop. Use HashMap::ensure to avoid the
240         double hashing that the old code was doing. And moved the code to find an entry
241         in the map in here from the client functions.
242         (WebCore::MIMETypeRegistry::getMediaMIMETypeForExtension): Updated to use the
243         typesForCommonExtension, and changed logic to use this first, and only call
244         getMIMETypeForExtension for extensions not in the map. This gives the same
245         result but should be slightly more efficient.
246         (WebCore::MIMETypeRegistry::getMediaMIMETypesForExtension): Updated to use the
247         typesForCommonExtension function. Comment about strategy is now in there.
248         (WebCore::initializeUnsupportedTextMIMETypes): Added a missing const for a global
249         constant array. Also started using ASCIILiteral.
250
251         * platform/MainThreadSharedTimer.cpp: Moved include of NeverDestroyed.h here ...
252         * platform/MainThreadSharedTimer.h: ... from here. Added Forward.h.
253
254         * platform/SchemeRegistry.cpp:
255         (WebCore::add): Added helper functions to keep code below simpler.
256         (WebCore::makeNeverDestroyedSchemeSet): Ditto.
257         (WebCore::allBuiltinSchemes): Use const auto, makeNeverDestroyed, a lambda,
258         and the helper functions above, rather than isEmpty.
259         (WebCore::builtinLocalURLSchemes): Use const auto, makeNeverDestroyed, and
260         the HashSet constructor instead of isEmpty and add calls. Also changed the
261         return type to be const.
262         (WebCore::localURLSchemes): Copy the map using assignment instead of an
263         isEmpty function and a loop with calls to add.
264         (WebCore::builtinSecureSchemes): Use const auto, makeNeverDestroyed, and
265         the Vector constructor rather than isEmpty, repeated calls to append,
266         and shrinkToFit.
267         (WebCore::secureSchemes): Use auto and makeNeverDestroyedSchemeSet rather
268         than isEmpty and repeated calls to add.
269         (WebCore::builtinSchemesWithUniqueOrigins): More of the same.
270         (WebCore::schemesWithUniqueOrigins): Ditto.
271         (WebCore::builtinEmptyDocumentSchemes): Ditto.
272         (WebCore::emptyDocumentSchemes): Ditto.
273         (WebCore::schemesForbiddenFromDomainRelaxation): Ditto.
274         (WebCore::builtinCanDisplayOnlyIfCanRequestSchemes): Ditto.
275         (WebCore::canDisplayOnlyIfCanRequestSchemes): Ditto.
276         (WebCore::builtinCORSEnabledSchemes): Ditto.
277         (WebCore::CORSEnabledSchemes): Ditto.
278         (WebCore::SchemeRegistry::shouldTreatURLSchemeAsLocal): Replaced check for
279         empty string with check for null string, since that's slightly more efficient
280         for non-null, non-empty strings, and the hash table can handle empty strings
281         just fine.
282         (WebCore::SchemeRegistry::registerURLSchemeAsNoAccess): Added null check here.
283         (WebCore::SchemeRegistry::shouldTreatURLSchemeAsNoAccess): Ditto.
284         (WebCore::SchemeRegistry::registerURLSchemeAsDisplayIsolated): Ditto.
285         (WebCore::SchemeRegistry::shouldTreatURLSchemeAsDisplayIsolated): Ditto.
286         (WebCore::SchemeRegistry::registerURLSchemeAsSecure): Ditto.
287         (WebCore::SchemeRegistry::shouldTreatURLSchemeAsSecure): Ditto.
288         (WebCore::SchemeRegistry::registerURLSchemeAsEmptyDocument): Ditto.
289         (WebCore::SchemeRegistry::shouldLoadURLSchemeAsEmptyDocument): Ditto.
290         (WebCore::SchemeRegistry::setDomainRelaxationForbiddenForURLScheme): Ditto.
291         (WebCore::SchemeRegistry::isDomainRelaxationForbiddenForURLScheme): Ditto.
292         (WebCore::SchemeRegistry::canDisplayOnlyIfCanRequest): Ditto.
293         (WebCore::SchemeRegistry::registerAsCanDisplayOnlyIfCanRequest): Ditto.
294         (WebCore::SchemeRegistry::registerURLSchemeAsNotAllowingJavascriptURLs): Ditto.
295         (WebCore::SchemeRegistry::shouldTreatURLSchemeAsNotAllowingJavascriptURLs): Ditto.
296         (WebCore::SchemeRegistry::registerURLSchemeAsAllowingLocalStorageAccessInPrivateBrowsing): Ditto.
297         (WebCore::SchemeRegistry::allowsLocalStorageAccessInPrivateBrowsing): Ditto.
298         (WebCore::SchemeRegistry::registerURLSchemeAsAllowingDatabaseAccessInPrivateBrowsing): Ditto.
299         (WebCore::SchemeRegistry::allowsDatabaseAccessInPrivateBrowsing): Ditto.
300         (WebCore::SchemeRegistry::registerURLSchemeAsCORSEnabled): Ditto.
301         (WebCore::SchemeRegistry::shouldTreatURLSchemeAsCORSEnabled): Ditto.
302         (WebCore::SchemeRegistry::registerURLSchemeAsBypassingContentSecurityPolicy): Ditto.
303         (WebCore::SchemeRegistry::removeURLSchemeRegisteredAsBypassingContentSecurityPolicy): Ditto.
304         (WebCore::SchemeRegistry::schemeShouldBypassContentSecurityPolicy): Ditto.
305         (WebCore::SchemeRegistry::registerURLSchemeAsAlwaysRevalidated): Ditto.
306         (WebCore::SchemeRegistry::shouldAlwaysRevalidateURLScheme): Ditto.
307         (WebCore::SchemeRegistry::registerURLSchemeAsCachePartitioned): Ditto.
308         (WebCore::SchemeRegistry::shouldPartitionCacheForURLScheme): Ditto.
309         (WebCore::SchemeRegistry::isUserExtensionScheme): Tweaked #if a bit.
310         (WebCore::SchemeRegistry::isBuiltinScheme): Added null check.
311
312         * platform/cocoa/WebVideoFullscreenModelVideoElement.mm:
313         (WebVideoFullscreenModelVideoElement::observedEventNames): Use const auto,
314         makeNeverDestroyed, and the Vector constructor rather than a call to size
315         and then append eacn time this funciton is called.
316
317         * platform/gamepad/cocoa/GameControllerGamepadProvider.h: Moved include of
318         NeverDestroyed.h from here ...
319         * platform/gamepad/cocoa/GameControllerGamepadProvider.mm: ... to here.
320
321         * platform/gamepad/mac/HIDGamepadProvider.cpp: Moved include of
322         NeverDestroyed.h here ...
323         * platform/gamepad/mac/HIDGamepadProvider.h: ... from here.
324
325         * platform/graphics/FontCascade.cpp:
326         (WebCore::FontCascade::hasValidAverageCharWidth): Use const auto,
327         makeNeverDestroyed, and the HashSet constructor.
328
329         * platform/graphics/ImageBuffer.cpp:
330         (WebCore::ImageBuffer::transformColorSpace): Removed unneeded use of
331         NeverDestroyed<Vector<int>> here, instead using const std::array.
332
333         * platform/graphics/ImageBuffer.h: Changed platformTransformColorSpace to take
334         const std::array<uint8_t, 256>& instead of const Vector<int>&, since the whole
335         pointer of the argument is that it's a table to map bytes onto other bytes.
336
337         * platform/graphics/MediaPlaybackTarget.h: Removed unneeded include of
338         NeverDestroyed.h, unneeded unused noMediaPlaybackTargetContext function,
339         and unneeded include of MediaPlaybackTargetContext.h, forward declaring instead.
340         Made most functions in this class pure virtual instead of having default
341         implementations.
342
343         * platform/graphics/avfoundation/MediaPlaybackTargetMac.h: Added include
344         of MediaPlaybackTargetContext.h now that it was removed above.
345
346         * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp:
347         (WebCore::MediaPlayerPrivateAVFoundation::staticMIMETypeList): Use const auto,
348         makeNeverDestroyed, and the HashSet constructor.
349
350         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
351         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::isAvailable): Reversed the sense
352         of the boolean logic here to make this simpler and easier to read.
353         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::getSupportedTypes): Changed
354         the implementation here, which empties out the passed in hash set, to use
355         the clear function rather than assignment from a global empty hash set. Added
356         a FIXME because it seems peculiar that this would be considered OK.
357         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::supportsType): Used ? : to make
358         this a little more terse; I think it's clearer.
359
360         * platform/graphics/cairo/ImageBufferCairo.cpp:
361         (WebCore::ImageBuffer::platformTransformColorSpace): Updated for change to
362         argument type.
363
364         * platform/graphics/cg/ImageDecoderCG.cpp: Removed unneeded include of
365         NeverDestroyed.h.
366         (WebCore::appendImageSourceOption): Streamlined code using auto with
367         adoptCF; there is no need to write out the type of the RetainPtr.
368         (WebCore::imageSourceOptions): Instead of NeverDestroyed<RetainPtr>, just use
369         const auto and leakRef.
370         (WebCore::imageSourceAsyncOptions): Ditto.
371
372         * platform/graphics/gtk/GdkCairoUtilities.cpp:
373         (WebCore::getDefaultCairoFontOptions): Instead of using LazyNeverDestroyed
374         on a pointer, just use a global pointer. There is no need to use any kind
375         of NeverDestroyed on a type with a trivial destructor such as a pointer.
376
377         * platform/graphics/ios/FontCacheIOS.mm:
378         (WebCore::platformFontWithFamilySpecialCase): Instead of using
379         NeverDestroyed<RetainPtr> just use a raw pointer global.
380         * platform/graphics/mac/FontCacheMac.mm:
381         (WebCore::platformFontWithFamilySpecialCase): Ditto.
382
383         * platform/graphics/mac/MediaPlayerPrivateQTKit.mm:
384         (WebCore::createFileTypesSet): Return the HashSet instead of adding to it.
385         Use Objective-C for/in syntax for an NSArray, not C++ for syntax, although
386         it seems the C++ syntax was working fine.
387         (WebCore::mimeCommonTypesCache): Fixed return type so we won't copy the
388         HashMap every time this function is called. Use const auto and makeNeverDestroyed
389         instead of using a boolean to do one time initialization.
390         (WebCore::mimeModernTypesCache): Ditto.
391         (WebCore::MediaPlayerPrivateQTKit::disableUnsupportedTracks): Marked a
392         constant array const.
393
394         * platform/ios/Device.cpp:
395         (WebCore::deviceClass): Use a lambda to initialize a variable here instead
396         of using std::call_once. This function does not need to be thread safe.
397         (WebCore::deviceName): Use const NeverDestroyed instead of LazyNeverDestroyed
398         and std::call_once. This function does not need to be thread safe.
399
400         * platform/ios/DragImageIOS.mm: Make defaultLinkIndicatorOptions be a
401         constant instead of a variable.
402         (WebCore::cascadeForSystemFont): Added helper function.
403         (WebCore::createDragImageForLink): Use const auto and makeNeverDestroyed
404         instead of LazyNeverDestroyed and dispatch_once. This code does not need
405         to be thread safe since its arguments include, for example, a DOM element.
406
407         * platform/ios/LegacyTileLayerPool.h: Removed unneeded include of
408         NeverDestroyed.h.
409
410         * platform/ios/QuickLook.mm:
411         (WebCore::QLPreviewGetSupportedMIMETypesSet): Use a global raw pointer
412         instead of NeverDestroyed<RetainPtr<NSSet>>.
413         (WebCore::createQLPreviewProtocol): Deleted.
414         (WebCore::QLPreviewProtocol): Use a global raw pointer instead of
415         a NeverDestroyed<Vector<char>>. It's cleaner to use fastStrdup instead
416         of appending to an array, and less wasteful of memory too.
417
418         * platform/ios/WebCoreMotionManager.mm: Removed unneeded include of
419         NeverDestroyed.h.
420         * platform/ios/WebSQLiteDatabaseTrackerClient.h: Ditto.
421         * platform/mac/DragImageMac.mm: Ditto.
422         * platform/mediastream/CaptureDeviceManager.cpp: Ditto.
423         * platform/mediastream/RealtimeMediaSourceSupportedConstraints.cpp: Ditto.
424
425         * platform/mock/MockRealtimeMediaSource.cpp:
426         (WebCore::MockRealtimeMediaSource::audioDevices): Use auto,
427         makeNeverDestroyed, and a lambda instead of checking size each time.
428         (WebCore::MockRealtimeMediaSource::videoDevices): Ditto.
429
430         * platform/mock/mediasource/MockMediaPlayerMediaSource.cpp:
431         (WebCore::mimeTypeCache): Use const auto, makeNeverDestroyed, and the
432         HashSet constructor instead of an explicit boolean to initialize.
433
434         * platform/network/BlobRegistryImpl.cpp:
435         (WebCore::blobUtilityQueue): Use a global with a raw reference instead
436         of a NeverDestroyed<Ref>.
437
438         * platform/network/NetworkStateNotifier.cpp:
439         (WebCore::NetworkStateNotifier::singleton): Renamed this from
440         networkStateNotifier. We must have missed this when we changed to use the
441         singleton idiom consistently. Also changed to use normal NeverDestroyed
442         rather than using LazyNeverDestroyed and call_once, because this is not
443         used from multiple threads and has no special thread safety requirements.
444         (WebCore::NetworkStateNotifier::NetworkStateNotifier): Moved the constructor
445         here and construct the timer. Before the timer was used only on the Mac
446         platform but now it is there for all platforms.
447         (WebCore::NetworkStateNotifier::onLine): Moved function here from the header.
448         It's a littlel less trivial than before because it now triggers a call to
449         updateState as needed.
450         (WebCore::NetworkStateNotifier::addListener): Renamed from
451         addNetworkStateChangeListener since there is only one kind of listener and
452         the old name was too wordy. Changed to call the new startObserving function,
453         and guaranteed to call it onlh once. The platform-specific logic for iOS is
454         now inside the iOS version of that function instead of here.
455         (WebCore::NetworkStateNotifier::updateState): Moved here now that it is the
456         same for all platforms. The actual state updating is done in a function named
457         updateStateWithoutNotifying, which is implemented for each platform.
458         (WebCore::NetworkStateNotifier::updateStateSoon): New function which takes
459         advantage of the timer to coalesce network state updates.
460         (WebCore::NetworkStateNotifier::updateStateWithoutNotifying): Empty stub
461         version of this function.
462         (WebCore::NetworkStateNotifier::startObserving): Ditto.
463         (WebCore::NetworkStateNotifier::notifyNetworkStateChange): Deleted. Code from
464         this has moved into updateState.
465
466         * platform/network/NetworkStateNotifier.h: Greatly cut down what part of this
467         class is platform-specific.
468
469         * platform/network/ios/NetworkStateNotifierIOS.mm:
470         (-[WebNetworkStateObserver initWithBlock:]): Simplified this class so it
471         takes a block, rather than using a pointer to the C++ notifier and doing
472         WebThreadRun.
473         (-[WebNetworkStateObserver dealloc]): Ditto.
474         (-[WebNetworkStateObserver networkStateChanged:]): Ditto.
475         (WebCore::NetworkStateNotifier::updateStateWithoutNotifying):
476         This now calls isNetworkReachable.
477         (WebCore::NetworkStateNotifier::startObserving): Check the
478         Settings::shouldOptOutOfNetworkStateObservation function, and if it's OK
479         to observe, then create the observer. This code now takes care of the
480         WebThreadRun and calls updateStateSoon.
481         (WebCore::NetworkStateNotifier::NetworkStateNotifier): Deleted. The
482         constructor is now platform independent.
483         (WebCore::NetworkStateNotifier::~NetworkStateNotifier): Deleted. This
484         object is never destroyed so we should not write a destructor for it.
485         (WebCore::NetworkStateNotifier::registerObserverIfNecessary): Deleted.
486         Replaced by startObserving.
487         (WebCore::NetworkStateNotifier::onLine): Deleted. This function is now
488         platform-independent.
489         (WebCore::setOnLine): Deleted. The logic from this is now in
490         updateState and updateStateWithoutNotifying.
491
492         * platform/network/mac/NetworkStateNotifierMac.cpp:
493         (WebCore::NetworkStateNotifier::updateStateWithoutNotifying): Renamed
494         this from updateState and tightened up the code a bit. Also changed
495         to not assume anything. If there is an error, we leave m_isOnLine alone.
496         Default behavior is now in the platform-independent code, and the default
497         is to treat things as on-line if updateStateWithoutNotifying was called
498         and it was never able to update the state even once.
499         (WebCore::NetworkStateNotifier::startObserving): Moved most of the code
500         from the constructor into this function.
501         (WebCore::NetworkStateNotifier::dynamicStoreCallback): Deleted. This is
502         now a lambda inside startObserving.
503         (WebCore::NetworkStateNotifier::networkStateChangeTimerFired): Deleted.
504         This function is now platform-independent and is named updateState.
505
506         * platform/network/win/NetworkStateNotifierWin.cpp:
507         (WebCore::NetworkStateNotifier::updateStateWithoutNotifying): Renamed
508         from updateState and tightened the code up a bit. Also changed
509         to not assume anything. If there is an error, we leave m_isOnLine alone.
510         Default behavior is now in the platform-independent code, and the default
511         is to treat things as on-line if updateStateWithoutNotifying was called
512         and it was never able to update the state even once.
513         (WebCore::NetworkStateNotifier::addressChanged): Deleted.
514         This function is now platform-independent and is named updateState.
515         (WebCore::NetworkStateNotifier::addressChangeCallback): Renamed from
516         addrChangeCallback. Simplified by using the singleton function instead
517         of relying on the context pointer.
518         (WebCore::NetworkStateNotifier::startObserving): Moved most of the code
519         from the constructor here.
520
521         * platform/text/LocaleToScriptMappingDefault.cpp:
522         (WebCore::scriptNameToCode): Use makeNeverDestroyed.
523         (WebCore::localeToScriptCodeForFontSelection): Ditto.
524
525         * platform/text/ios/LocalizedDateCache.h: Moved include of
526         NeverDestroyed.h from here ...
527         * platform/text/ios/LocalizedDateCache.mm: ... to here.
528
529         * platform/wpe/RenderThemeWPE.cpp:
530         (WebCore::RenderTheme::singleton): Use a theme that is never destroyed
531         rather than Ref that is never destroyed.
532
533         * platform/wpe/RenderThemeWPE.h: Use friend NeverDestroyed rather than
534         a create function since RenderTheme is no longer reference counted.
535
536         * rendering/RenderTheme.h: Made RenderTheme no longer reference counted.
537
538         * rendering/RenderThemeGtk.cpp:
539         (WebCore::RenderThemeGtk::create): Deleted.
540         (WebCore::RenderTheme::singleton): Use a theme that is never destroyed
541         rather than Ref that is never destroyed.
542
543         * rendering/RenderThemeGtk.h: Use friend NeverDestroyed rather than
544         a create function since RenderTheme is no longer reference counted.
545         * rendering/RenderThemeIOS.h: Ditto.
546
547         * rendering/RenderThemeIOS.mm:
548         (WebCore::RenderThemeIOS::create): Deleted.
549         (WebCore::RenderTheme::singleton): Use a theme that is never destroyed
550         rather than Ref that is never destroyed.
551
552         * rendering/RenderThemeMac.h: Use friend NeverDestroyed rather than
553         a create function since RenderTheme is no longer reference counted.
554         Also marked a lot of functions final rather than override and initialized
555         data members in the class deifnition.
556
557         * rendering/RenderThemeMac.mm: Moved some SPI interfaces to the top of the
558         file. They should really go into SPI headers.
559         (-[WebCoreRenderThemeNotificationObserver init]): Removed the theme argument
560         here because the theme is a singleton and we don't need a pointer to it.
561         Add the observer here instead of doing it in the caller.
562         (-[WebCoreRenderThemeNotificationObserver systemColorsDidChange:]): Call
563         platformColorsDidChange through the singleton rather than using a pointer.
564         (-[WebCoreTextFieldCell _coreUIDrawOptionsWithFrame:inView:includeFocus:]):
565         Tightened up the code a bit by using CFAutorelease instead of using a
566         combination of NSMakeCollectable, autorelease, and a typecast to accomplish
567         the same thing.
568         (WebCore::RenderTheme::singleton): Use a theme that is never destroyed
569         rather than Ref that is never destroyed.
570         (WebCore::RenderThemeMac::create): Deleted.
571         (WebCore::RenderThemeMac::RenderThemeMac): Moved initialization into the
572         class definition and observing into the WebCoreRenderThemeNotificationObserver
573         init function.
574         (WebCore::RenderThemeMac::~RenderThemeMac): Deleted. No need for this since
575         the object will never be destroyed.
576         (WebCore::RenderThemeMac::mediaControlsBase64StringForIconNameAndType):
577         Removed an unnecessary conversion from C string literal to WTF::String and
578         then to NSString. Instead, just use an NSString literal.
579
580         * rendering/RenderThemeWin.cpp:
581         (WebCore::RenderThemeWin::create): Deleted.
582         (WebCore::RenderTheme::singleton): Use a theme that is never destroyed
583         rather than Ref that is never destroyed.
584
585         * rendering/RenderThemeWin.h: Use friend NeverDestroyed rather than
586         a create function since RenderTheme is no longer reference counted.
587
588         * rendering/svg/RenderSVGResource.cpp:
589         (WebCore::removeFromCacheAndInvalidateDependencies): Moved a global into
590         the code where it is used.
591
592         * svg/SVGAnimatedLength.cpp: Removed unneeded include of NeverDestroyed.h.
593
594         * svg/SVGAnimationElement.cpp:
595         (WebCore::SVGAnimationElement::isSupportedAttribute): Use const auto,
596         makeNeverDestroyed, a lambda, and the new HashSet::add overload instead of
597         an isEmpty check and lots of separate add function calls.
598         * svg/SVGClipPathElement.cpp:
599         (WebCore::SVGClipPathElement::isSupportedAttribute): Ditto.
600         * svg/SVGComponentTransferFunctionElement.cpp:
601         (WebCore::SVGComponentTransferFunctionElement::isSupportedAttribute): Ditto.
602         * svg/SVGCursorElement.cpp:
603         (WebCore::SVGCursorElement::isSupportedAttribute): Ditto.
604
605         * svg/SVGElement.cpp:
606         (WebCore::createAttributeNameToCSSPropertyIDMap): Replaced the populate
607         function with this create function.
608         (WebCore::createAttributeNameToAnimatedPropertyTypeMap): Ditto.
609         (WebCore::attributeNameToAnimatedPropertyTypeMap): Changed return type to
610         const reference. Use const auto and makeNeverDestroyed instead of using
611         isEmpty and a populate function.
612         (WebCore::createCSSPropertyWithSVGDOMNameToAnimatedPropertyTypeMap):
613         More of the same.
614         (WebCore::cssPropertyWithSVGDOMNameToAnimatedPropertyTypeMap): Ditto.
615         (WebCore::SVGElement::childShouldCreateRenderer): Use an array instead of
616         a HashSet since we are checking against only 3 or 4 values.
617         (WebCore::addQualifiedName): Deleted.
618         (WebCore::SVGElement::animatableAttributeForName): Use const auto,
619         makeNeverDestroyed, and a lambda to efficiently build the map in this function.
620         (WebCore::SVGElement::cssPropertyIdForSVGAttributeName): Use const auto and
621         makeNeverDestroyed instead of using isEmpty and a populate function.
622
623         * svg/SVGFilterElement.cpp:
624         (WebCore::SVGFilterElement::isSupportedAttribute): Use const auto,
625         makeNeverDestroyed, a lambda, and the new HashSet::add overload instead of
626         an isEmpty check and lots of separate add function calls.
627         * svg/SVGFilterPrimitiveStandardAttributes.cpp:
628         (WebCore::SVGFilterPrimitiveStandardAttributes::isSupportedAttribute): Ditto.
629         * svg/SVGForeignObjectElement.cpp:
630         (WebCore::SVGForeignObjectElement::isSupportedAttribute): Ditto.
631         * svg/SVGGElement.cpp:
632         (WebCore::SVGGElement::isSupportedAttribute): Ditto.
633         * svg/SVGGradientElement.cpp:
634         (WebCore::SVGGradientElement::isSupportedAttribute): Ditto.
635         * svg/SVGGraphicsElement.cpp:
636         (WebCore::SVGGraphicsElement::isSupportedAttribute): Ditto.
637         * svg/SVGImageElement.cpp:
638         (WebCore::SVGImageElement::isSupportedAttribute): Ditto.
639         * svg/SVGLangSpace.cpp:
640         (WebCore::addWithAndWithoutXMLPrefix): Added helper. Uses xmlAtom instead
641         of making our own NeverDestroyed local xmlPrefix.
642         (WebCore::SVGLangSpace::addSupportedAttributes): Rewrote to use helper.
643         * svg/SVGLineElement.cpp:
644         (WebCore::SVGLineElement::isSupportedAttribute): Use const auto,
645         makeNeverDestroyed, a lambda, and the new HashSet::add overload instead of
646         an isEmpty check and lots of separate add function calls.
647         * svg/SVGLinearGradientElement.cpp:
648         (WebCore::SVGLinearGradientElement::isSupportedAttribute): Ditto.
649         * svg/SVGMarkerElement.cpp:
650         (WebCore::SVGMarkerElement::isSupportedAttribute): Ditto.
651         * svg/SVGMaskElement.cpp:
652         (WebCore::SVGMaskElement::isSupportedAttribute): Ditto.
653         * svg/SVGPathElement.cpp:
654         (WebCore::SVGPathElement::isSupportedAttribute): Ditto.
655         * svg/SVGPatternElement.cpp:
656         (WebCore::SVGPatternElement::isSupportedAttribute): Ditto.
657         * svg/SVGRadialGradientElement.cpp:
658         (WebCore::SVGRadialGradientElement::isSupportedAttribute): Ditto.
659         * svg/SVGTextContentElement.cpp:
660         (WebCore::SVGTextContentElement::isSupportedAttribute): Ditto.
661         * svg/SVGTextPathElement.cpp:
662         (WebCore::SVGTextPathElement::isSupportedAttribute): Ditto.
663         * svg/animation/SVGSMILElement.cpp:
664         (WebCore::SVGSMILElement::isSupportedAttribute): Ditto.
665
666         * testing/MockContentFilterSettings.h: Removed unneeded include of
667         NeverDestroyed.h.
668
669         * testing/MockGamepadProvider.cpp: Moved include of
670         NeverDestroyed.h here ...
671         * testing/MockGamepadProvider.h: ... from here.
672
673         * testing/MockPreviewLoaderClient.h: Removed unneeded include of
674         NeverDestroyed.h.
675
676         * workers/Worker.cpp:
677         (WebCore::allWorkers): Changed this from a global to a function.
678         (WebCore::Worker::networkStateChanged): Updated for above change and
679         made this a member function.
680         (WebCore::Worker::Worker): Updated for above change and
681         change to NetworkStateNotifier.
682         (WebCore::Worker::~Worker): Ditto.
683         * workers/Worker.h: Made networkStateChanged a static member instead of
684         a friend since that is a cleaner way to give it access to private member
685         functions.
686
687         * xml/XPathFunctions.cpp:
688         (WebCore::XPath::createFunctionMap): Use create instead of populate style.
689         (WebCore::XPath::Function::create): Use const auto and makeNeverDestroyed
690         instead of an isEmpty check.
691
692         * xml/XPathParser.cpp:
693         (WebCore::XPath::createAxisNamesMap): Use create instead of populate style.
694         (WebCore::XPath::parseAxisName): Use const auto and makeNeverDestroyed
695         instead of an isEmpty check.
696
697 2017-07-17  Brady Eidson  <beidson@apple.com>
698
699         REGRESSION(r219298): imported/w3c/IndexedDB-private-browsing/idbfactory_open.html is crashing occassionaly (UniqueIDBDatabase being taken from the IDBServer set twice).
700         <rdar://problem/33294987> and https://bugs.webkit.org/show_bug.cgi?id=174354
701
702         Reviewed by Alex Christensen.
703
704         No new tests (Covered by existing tests).
705
706         * Modules/indexeddb/server/IDBServer.cpp:
707         (WebCore::IDBServer::IDBServer::postDatabaseTaskReply): Remove a now invalid ASSERT
708         
709         * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
710         (WebCore::IDBServer::UniqueIDBDatabase::scheduleShutdownForClose): Add a RELEASE_ASSERT.
711         (WebCore::IDBServer::UniqueIDBDatabase::didDeleteBackingStore): Instead of an ad-hoc main thread dispatch, use the "schedule task reply" system
712           to keep dispatch ordering in tact.
713         (WebCore::IDBServer::UniqueIDBDatabase::postDatabaseTaskReply): Remove a now invalid ASSERT
714         (WebCore::IDBServer::UniqueIDBDatabase::immediateCloseForUserDelete): Only take the owning pointer if the object doesn't already own itself.
715
716 2017-07-17  Wenson Hsieh  <wenson_hsieh@apple.com>
717
718         [iOS DnD] Web process uses too much memory when beginning a drag on a very large image
719         https://bugs.webkit.org/show_bug.cgi?id=174585
720         <rdar://problem/33302541>
721
722         Reviewed by Tim Horton.
723
724         Currently, attempting to drag a very large image fails, either due to us telling CoreGraphics to create an image
725         buffer that is too large, or because the web process exceeds its memory limit and gets jetsamed. There are two
726         places where we can optimize our memory use during the drag initialization sequence, and this patch improves
727         both.
728
729         First, on iOS, we attempt to encode and send over a WebCore::Image in the PasteboardImage when writing to the
730         item providers upon starting a drag. Currently, this Image is only used in the drag and drop codepath, in
731         PlatformPasteboard::writeObjectRepresentations, to grab the size of the image being written for the purpose of
732         specifying estimated display size. Serializing and deserializing an Image calls into Image::nativeImage, which
733         attempts to draw the contents of the image into a buffer so that it can be shipped across to the UI process.
734         Instead, we can simply compute the size in the web process while we already have the Image, and simply send that
735         across. For copy/paste, this doesn't result in any behavior change, since we don't use the PasteboardImage's
736         image in the first place.
737
738         Secondly, when starting a drag, we try to allocate create an image buffer the size of the WebCore::Image for the
739         purpose of generating the drag preview. Instead, this patch establishes a limit on the size of this drag preview
740         image, such that if the Image's size is larger, we'll scale down the drag preview image to be the maximum
741         allowed size.
742
743         Test: DataInteractionTests.CanStartDragOnEnormousImage.
744
745         * editing/ios/EditorIOS.mm:
746         (WebCore::Editor::writeImageToPasteboard):
747         * platform/Pasteboard.h:
748         * platform/graphics/GeometryUtilities.cpp:
749         (WebCore::sizeWithAreaAndAspectRatio):
750
751         Introduce a new helper function to compute a size with the given aspect ratio and area.
752
753         * platform/graphics/GeometryUtilities.h:
754         * platform/ios/DragImageIOS.mm:
755         (WebCore::createDragImageFromImage):
756         * platform/ios/PlatformPasteboardIOS.mm:
757         (WebCore::PlatformPasteboard::writeObjectRepresentations):
758
759 2017-07-17  Michael Catanzaro  <mcatanzaro@igalia.com>
760
761         [CMake] Include most CMake modules from WebKitCommon.cmake
762         https://bugs.webkit.org/show_bug.cgi?id=174546
763
764         Reviewed by Konstantin Tokarev.
765
766         * WebCoreMacros.cmake:
767
768 2017-07-17  Michael Catanzaro  <mcatanzaro@igalia.com>
769
770         [CMake] Macros in WebKitMacros.cmake should be prefixed with WEBKIT_ namespace
771         https://bugs.webkit.org/show_bug.cgi?id=174547
772
773         Reviewed by Alex Christensen.
774
775         * CMakeLists.txt:
776         * WebCoreMacros.cmake:
777
778 2017-07-17  Alex Christensen  <achristensen@webkit.org>
779
780         Modernize content extension code
781         https://bugs.webkit.org/show_bug.cgi?id=174588
782
783         Reviewed by Sam Weinig.
784
785         No change in behavior.  Just use Ref instead of RefPtr where possible.
786
787         * contentextensions/ContentExtension.cpp:
788         (WebCore::ContentExtensions::ContentExtension::create):
789         * contentextensions/ContentExtension.h:
790         * contentextensions/ContentExtensionsBackend.cpp:
791         (WebCore::ContentExtensions::ContentExtensionsBackend::addContentExtension):
792         (WebCore::ContentExtensions::ContentExtensionsBackend::actionsForResourceLoad):
793         * contentextensions/ContentExtensionsBackend.h:
794
795 2017-07-17  Simon Fraser  <simon.fraser@apple.com>
796
797         clientX/clientY on TouchEvent.touches are wrong
798         https://bugs.webkit.org/show_bug.cgi?id=174561
799         rdar://problem/33336041
800
801         Reviewed by Tim Horton.
802         
803         Do some refactoring so that WebKitAdditions code that computes Touch coordinates can use
804         the same code that MouseRelatedEvent uses.
805         
806         There is no behavior change in this patch, but the test exercises a behavior change in
807         WebKitAdditions code.
808
809         Test: fast/events/touch/ios/touches-client-coords-after-zoom.html
810
811         * dom/MouseRelatedEvent.cpp:
812         (WebCore::MouseRelatedEvent::init):
813         (WebCore::MouseRelatedEvent::frameViewFromDOMWindow):
814         (WebCore::MouseRelatedEvent::pagePointToClientPoint):
815         (WebCore::MouseRelatedEvent::pagePointToAbsolutePoint):
816         (WebCore::MouseRelatedEvent::initCoordinates):
817         (WebCore::MouseRelatedEvent::documentToAbsoluteScaleFactor):
818         (WebCore::MouseRelatedEvent::computePageLocation):
819         (WebCore::MouseRelatedEvent::locationInRootViewCoordinates):
820         (WebCore::MouseRelatedEvent::frameView): Deleted.
821         * dom/MouseRelatedEvent.h:
822
823 2017-07-17  Jeremy Jones  <jeremyj@apple.com>
824
825         Add video fullscreen transition logging.
826         https://bugs.webkit.org/show_bug.cgi?id=174474
827
828         Reviewed by Jer Noble.
829
830         No new tests, because there is no functional change.
831
832         This change just adds logging.
833
834         * html/HTMLVideoElement.cpp:
835         (WebCore::HTMLVideoElement::webkitEnterFullscreen):
836         (WebCore::HTMLVideoElement::webkitExitFullscreen):
837         (WebCore::HTMLVideoElement::webkitSetPresentationMode):
838
839 2017-07-17  Chris Dumez  <cdumez@apple.com>
840
841         click event does not dispatch to parent when child target stops hit testing after mousedown
842         https://bugs.webkit.org/show_bug.cgi?id=174564
843         <rdar://problem/33340234>
844
845         Reviewed by Simon Fraser.
846
847         As per [1], if the mouse down node and the mouse release node differ, then we are supposed to
848         fire the click event at their common ancestor, if such node exists. This patch implements this
849         logic. This also aligns our behavior with Blink.
850
851         [1] https://w3c.github.io/uievents/#events-mouseevent-event-order
852
853         Test: fast/events/mouse-click-different-mouseDown-mouseUp-nodes.html
854
855         * page/EventHandler.cpp:
856         (WebCore::targetNodeForClickEvent):
857
858 2017-07-17  Brady Eidson  <beidson@apple.com>
859
860         WKHTTPCookieStore observing only works on the default cookie store.
861         <rdar://problem/33330724> and https://bugs.webkit.org/show_bug.cgi?id=174580
862
863         Reviewed by Sam Weinig.
864
865         Covered by new API tests.
866         
867         startObservingCookieChanges and stopObservingCookieChanges are passed a NetworkStorageSession to observe.
868         On Mac/iOS, the passed-in storage session was ignored and the shared cookie storage was assumed.
869         Let's fix that.
870         
871         Also, since using NSNotification based observing only works reliably for the shared cookie storage,
872         switch to direct CFHTTPCookieStorageRef observing.
873
874         * WebCore.xcodeproj/project.pbxproj:
875         
876         * platform/network/NetworkStorageSession.h:
877         
878         * platform/network/cocoa/CookieStorageObserver.h: Added.
879         * platform/network/cocoa/CookieStorageObserver.mm: Added.
880         (WebCore::cookiesChanged):
881         (WebCore::CookieStorageObserver::create):
882         (WebCore::CookieStorageObserver::CookieStorageObserver):
883         (WebCore::CookieStorageObserver::~CookieStorageObserver):
884         (WebCore::CookieStorageObserver::startObserving):
885         (WebCore::CookieStorageObserver::stopObserving):
886         (WebCore::CookieStorageObserver::cookiesDidChange):
887         
888         * platform/network/cocoa/NetworkStorageSessionCocoa.mm:
889         (WebCore::NetworkStorageSession::cookieStorageObserver):
890         
891         * platform/network/mac/CookieStorageMac.mm:
892         (WebCore::startObservingCookieChanges):
893         (WebCore::stopObservingCookieChanges):
894         (-[WebCookieStorageObjCAdapter notifyCookiesChangedOnMainThread]): Deleted.
895         (-[WebCookieStorageObjCAdapter cookiesChangedNotificationHandler:]): Deleted.
896         (-[WebCookieStorageObjCAdapter startListeningForCookieChangeNotificationsWithCallback:]): Deleted.
897         (-[WebCookieStorageObjCAdapter stopListeningForCookieChangeNotifications]): Deleted.
898         
899         * platform/spi/cf/CFNetworkSPI.h:
900
901 2017-07-17  Sam Weinig  <sam@webkit.org>
902
903         [WebIDL] Rename JSCSSValueCustom.cpp to JSDeprecatedCSSOMValueCustom.cpp to match the underlying class
904         https://bugs.webkit.org/show_bug.cgi?id=174550
905
906         Reviewed by Brady Eidson.
907
908         * CMakeLists.txt:
909         * WebCore.xcodeproj/project.pbxproj:
910         * bindings/js/JSBindingsAllInOne.cpp:
911         * bindings/js/JSCSSValueCustom.cpp: Removed.
912         * bindings/js/JSDeprecatedCSSOMValueCustom.cpp: Renamed from bindings/js/JSCSSValueCustom.cpp.
913         Rename file and update references.
914
915 2017-07-17  Antoine Quint  <graouts@apple.com>
916
917         REGRESSION: order of AirPlay and volume controls is inconsistent between <audio> and <video>
918         https://bugs.webkit.org/show_bug.cgi?id=174581
919         <rdar://problem/33297519>
920
921         Reviewed by Sam Weinig.
922
923         We had an inconsistency between <audio> and <video> controls for the relative order of the
924         volume and AirPlay buttons. The <video> layout was correct (volume first and AirPlay after)
925         and the <audio> layout now is the same.
926
927         * Modules/modern-media-controls/controls/inline-media-controls.js:
928         (InlineMediaControls.prototype._rightContainerButtons):
929
930 2017-07-17  Konstantin Tokarev  <annulen@yandex.ru>
931
932         [CMake] Create targets before WEBKIT_INCLUDE_CONFIG_FILES_IF_EXISTS is called
933         https://bugs.webkit.org/show_bug.cgi?id=174557
934
935         Reviewed by Michael Catanzaro.
936
937         No new tests needed.
938
939         * CMakeLists.txt:
940
941 2017-07-17  Michael Catanzaro  <mcatanzaro@igalia.com>
942
943         Unreviewed, rolling out r219556.
944
945         Broke build without WebCrypto
946
947         Reverted changeset:
948
949         "[CMake] Clean up Web Crypto build targets"
950         https://bugs.webkit.org/show_bug.cgi?id=174253
951         http://trac.webkit.org/changeset/219556
952
953 2017-07-17  Antoine Quint  <graouts@apple.com>
954
955         Media controls draw behind captions
956         https://bugs.webkit.org/show_bug.cgi?id=174579
957         <rdar://problem/33295427>
958
959         Reviewed by Dean Jackson.
960
961         Ensure the captions container is added as a previous sibling to the controls container.
962
963         Test: media/modern-media-controls/media-controls/media-controls-display-above-captions.html
964
965         * Modules/modern-media-controls/media/media-controller.js:
966         (MediaController):
967
968 2017-07-17  Zan Dobersek  <zdobersek@igalia.com>
969
970         [CMake] Clean up Web Crypto build targets
971         https://bugs.webkit.org/show_bug.cgi?id=174253
972
973         Reviewed by Michael Catanzaro.
974
975         Gather the common WebCrypto source files in CMakeLists.txt, including them
976         in the build unconditionally and instead relying on ENABLE_SUBTLE_CRYPTO
977         build guards to exclude the code from compilation if the feature is disabled.
978
979         PlatformGTK.cmake, PlatformMac.cmake and PlatformWPE.cmake can then remove
980         duplicated build targets. PlatformMac.cmake still lists all the Mac-specific
981         Web Crypto build targets.
982
983         PlatformGTK.cmake and PlatformWPE.cmake now include GCrypt.cmake if the build
984         was configured to enable the use of libgcrypt. The new CMake file adds the
985         libgcrypt-specific Web Crypto build targets to the build if the feature was
986         enabled, and also sets up libgcrypt include directiories and libraries.
987
988         No new tests -- no change in behavior.
989
990         * CMakeLists.txt:
991         * PlatformGTK.cmake:
992         * PlatformMac.cmake:
993         * PlatformWPE.cmake:
994         * platform/GCrypt.cmake: Added.
995
996 2017-07-16  Michael Catanzaro  <mcatanzaro@igalia.com>
997
998         -Wreorder warning caused by GraphicsContext3D cleanup
999         https://bugs.webkit.org/show_bug.cgi?id=174511
1000
1001         Reviewed by Carlos Garcia Campos.
1002
1003         * platform/graphics/cairo/GraphicsContext3DCairo.cpp:
1004         (WebCore::GraphicsContext3D::GraphicsContext3D):
1005         * platform/graphics/opengl/GraphicsContext3DOpenGLES.cpp:
1006         (WebCore::GraphicsContext3D::GraphicsContext3D):
1007
1008 2017-07-16  Antoine Quint  <graouts@apple.com>
1009
1010         Dismissing the captions panel using the mouse is too eager to remove the captions panel and media controls
1011         https://bugs.webkit.org/show_bug.cgi?id=174571
1012         <rdar://problem/33294968>
1013
1014         Reviewed by Eric Carlson.
1015
1016         We did several things wrong when dismissing the tracks panel:
1017
1018             - we did not check whether we were hosted in a shadow root when figuring if a click was on the tracks panel
1019             - we did not check whether we clicked over the media when dismissing the tracks panel
1020             - we did not check whether auto-hide was on before fading the media controls out when we clicked outside
1021               the media controls bounds
1022
1023         We now correctly account for all of those cases and implement the following behavior when clickng as the tracks
1024         panel is presented:
1025         
1026             - dismiss the panel if the click is outside of the panel
1027             - dismiss the panel and the media controls if the click is outside the video and the media controls have
1028               auto-hide on (ie. media is playing)
1029             - dismiss the panel and the media controls after the track selection animation is finished if a track is selected
1030
1031         Tests: media/modern-media-controls/tracks-panel/tracks-panel-up-click-outside-media-does-not-dimiss-media-controls-when-media-is-paused.html
1032                media/modern-media-controls/tracks-panel/tracks-panel-up-click-over-media-does-not-dimiss-media-controls-when-media-is-playing.html
1033
1034         * Modules/modern-media-controls/controls/media-controls.js:
1035         (MediaControls.prototype.hideTracksPanel): Only hide the media controls if we clicked outside of the media
1036         controls bounds and if we have auto-hide on when idle (ie. the media is playing).
1037         (MediaControls.prototype.isPointInControls): Add an option to specify whether the container should be
1038         considered when checking if a point is contained within the media controls bounds.
1039         * Modules/modern-media-controls/controls/tracks-panel.js:
1040         (TracksPanel.prototype._handleMousedown):
1041         (TracksPanel.prototype._isPointInTracksPanel): Correctly check whether the element that we started pressing
1042         on is contained within the tracks panel, accounting for the case where we are presented within a shadow root
1043         (ie. always when runing inside a Web page).
1044
1045 2017-07-16  Ali Juma  <ajuma@chromium.org>
1046
1047         DisallowUserAgentShadowContent moves out of non-UA shadow roots
1048         https://bugs.webkit.org/show_bug.cgi?id=165647
1049
1050         Reviewed by Ryosuke Niwa.
1051
1052         Make rect-based hit-testing include nodes in non-UA shadow trees when the
1053         HitTestRequest has type DisallowUserAgentShadowContent.
1054
1055         Test: fast/dom/nodesFromRect/nodesFromRect-shadow.html
1056
1057         * rendering/HitTestResult.cpp:
1058         (WebCore::HitTestResult::addNodeToRectBasedTestResult):
1059         * testing/Internals.cpp:
1060         (WebCore::Internals::nodesFromRect):
1061         * testing/Internals.h:
1062
1063 2017-07-16  Antoine Quint  <graouts@apple.com>
1064
1065         Clicking edges of media control buttons changes visual state of button (pressed) but doesn't execute action
1066         https://bugs.webkit.org/show_bug.cgi?id=174565
1067         <rdar://problem/33294833>
1068
1069         Reviewed by Dean Jackson.
1070
1071         WebCore doesn't dispatch a "click" event to a parent element when a child that was the original target when
1072         the "mousedown" occured is no longer hit-testing at the location where the mouse pointer is at when the "mouseup"
1073         occurs (see webkit.org/b/174564). Since button icons, which are a <picture> element that is a child of the
1074         <button> element for media controls buttons, shrink to 89% of their size when the ":active" pseudo-class matches,
1075         clicking on the edges of the media controls buttons would not trigger the expected action.
1076
1077         Test: media/modern-media-controls/button/button-click-on-edges.html
1078
1079         * Modules/modern-media-controls/controls/button.css:
1080         (button > picture):
1081
1082 2017-07-16  Said Abou-Hallawa  <sabouhallawa@apple.com>
1083
1084         Make the decision for asynchronously decoding an image be in one place
1085         https://bugs.webkit.org/show_bug.cgi?id=174479
1086
1087         Reviewed by Tim Horton.
1088
1089         Move all the logic of whether a large image should be asynchronously decoded 
1090         or not be in one place: RenderBoxModelObject::decodingModeForImageDraw().
1091
1092         * loader/cache/CachedImage.cpp:
1093         (WebCore::CachedImage::addPendingImageDrawingClient): Fixing unrelated 
1094         spelling error.
1095         * platform/RuntimeApplicationChecks.h:
1096         * platform/cocoa/RuntimeApplicationChecksCocoa.mm:
1097         (WebCore::IOSApplication::isIBooks):
1098         (WebCore::IOSApplication::isIBooksStorytime):
1099         * platform/graphics/BitmapImage.cpp:
1100         (WebCore::BitmapImage::updateFromSettings): Remove reading the setting
1101         largeImageAsyncDecodingEnabled from this function because it will be read
1102         by RenderBoxModelObject::decodingModeForImageDraw().
1103         (WebCore::BitmapImage::dataChanged):
1104         (WebCore::BitmapImage::draw):
1105         (WebCore::BitmapImage::shouldAnimate):
1106         (WebCore::BitmapImage::canAnimate):
1107         (WebCore::BitmapImage::canUseAsyncDecodingForLargeImages):
1108         (WebCore::BitmapImage::shouldUseAsyncDecodingForAnimatedImages):
1109         (WebCore::BitmapImage::canDestroyDecodedData):
1110         (WebCore::BitmapImage::shouldUseAsyncDecodingForLargeImages): Deleted.
1111         * platform/graphics/BitmapImage.h:
1112         * platform/graphics/ImageSource.cpp:
1113         (WebCore::ImageSource::canUseAsyncDecoding): It is okay to keep the 
1114         decoded frame if canUseAsyncDecodingForLargeImages() is true by the setting
1115         largeImageAsyncDecodingEnabled is false.
1116         (WebCore::ImageSource::shouldUseAsyncDecoding): Deleted.
1117         * platform/graphics/ImageSource.h:
1118         * rendering/RenderBoxModelObject.cpp:
1119         (WebCore::RenderBoxModelObject::decodingModeForImageDraw): The plan is to
1120         add a new Internal settings to force asynchronous image decoding regardless
1121         of the image size and the settings.
1122         (WebCore::RenderBoxModelObject::paintFillLayerExtended):
1123         * rendering/RenderBoxModelObject.h:
1124         * rendering/RenderImage.cpp:
1125         (WebCore::RenderImage::paintIntoRect):
1126
1127 2017-07-16  Michael Catanzaro  <mcatanzaro@igalia.com>
1128
1129         [CMake] Raise minimum CMake requirement
1130         https://bugs.webkit.org/show_bug.cgi?id=174545
1131
1132         Reviewed by Konstantin Tokarev.
1133
1134         * WebCoreMacros.cmake:
1135
1136 2017-07-15  Brady Eidson  <beidson@apple.com>
1137
1138         Make sure all CFHTTPCookieStorageRefs we create are scheduled.
1139         <rdar://problem/33221110> and https://bugs.webkit.org/show_bug.cgi?id=174513
1140
1141         Reviewed by Tim Horton.
1142
1143         * platform/spi/cf/CFNetworkSPI.h:
1144
1145 2017-07-15  Myles C. Maxfield  <mmaxfield@apple.com>
1146
1147         Rename RenderStyle::fontSize() to RenderStyle::computedFontPixelSize()
1148         https://bugs.webkit.org/show_bug.cgi?id=174509
1149
1150         Reviewed by Simon Fraser.
1151
1152         We have three font size functions:
1153         - computedFontSize(): returns a float
1154         - specifiedFontSize(): also returns a float
1155         - fontSize(): returns the rounded computedFontSize()
1156
1157         FontDescription uses the convention of labelling rounded values as "pixel",
1158         so a better name font fontSize() is computedFontPixelSize().
1159
1160         Also, because font sizes can never be negative, switch the type from an int
1161         to an unsigned.
1162
1163         No new tests because there is no behavior change.
1164
1165         * accessibility/atk/WebKitAccessibleInterfaceText.cpp:
1166         (getAttributeSetForAccessibilityObject):
1167         * css/StyleResolver.cpp:
1168         (WebCore::StyleResolver::adjustRenderStyle):
1169         * platform/graphics/FontDescription.h:
1170         (WebCore::FontDescription::computedPixelSize):
1171         (WebCore::FontDescription::fontSelectionRequest):
1172         * rendering/RenderBlock.cpp:
1173         (WebCore::styleForFirstLetter):
1174         * rendering/RenderRubyRun.cpp:
1175         (WebCore::shouldOverhang):
1176         (WebCore::RenderRubyRun::getOverhang):
1177         * rendering/RenderRubyText.cpp:
1178         (WebCore::RenderRubyText::adjustInlineDirectionLineBounds):
1179         * rendering/RenderThemeGtk.cpp:
1180         (WebCore::adjustSearchFieldIconStyle):
1181         (WebCore::paintSearchFieldIcon):
1182         * rendering/RenderThemeIOS.mm:
1183         (WebCore::RenderThemeIOS::adjustCheckboxStyle):
1184         (WebCore::RenderThemeIOS::adjustRadioStyle):
1185         * rendering/RenderThemeMac.mm:
1186         (WebCore::RenderThemeMac::controlSizeForFont):
1187         (WebCore::RenderThemeMac::controlSizeForSystemFont):
1188         (WebCore::RenderThemeMac::paintMenuListButtonDecorations):
1189         (WebCore::RenderThemeMac::popupInternalPaddingBox):
1190         (WebCore::RenderThemeMac::adjustMenuListButtonStyle):
1191         * rendering/RenderThemeWin.cpp:
1192         (WebCore::RenderThemeWin::adjustSearchFieldCancelButtonStyle):
1193         (WebCore::RenderThemeWin::adjustSearchFieldResultsDecorationPartStyle):
1194         (WebCore::RenderThemeWin::adjustSearchFieldResultsButtonStyle):
1195         * rendering/TextDecorationPainter.cpp:
1196         (WebCore::TextDecorationPainter::paintTextDecoration):
1197         * rendering/mathml/RenderMathMLRow.cpp:
1198         (WebCore::RenderMathMLRow::computeLineVerticalStretch):
1199         * rendering/style/RenderStyle.cpp:
1200         (WebCore::RenderStyle::computedFontPixelSize):
1201         (WebCore::RenderStyle::computedLineHeight):
1202         (WebCore::RenderStyle::fontSize): Deleted.
1203         * rendering/style/RenderStyle.h:
1204         * style/InlineTextBoxStyle.cpp:
1205         (WebCore::visualOverflowForDecorations):
1206         * style/StyleTreeResolver.cpp:
1207         (WebCore::Style::TreeResolver::resolveElement):
1208         * svg/SVGLengthContext.cpp:
1209         (WebCore::SVGLengthContext::convertValueFromUserUnitsToEMS):
1210         (WebCore::SVGLengthContext::convertValueFromEMSToUserUnits):
1211
1212 2017-07-15  Myles C. Maxfield  <mmaxfield@apple.com>
1213
1214         line-height: <number> gets visually applied twice when text autosizing is in effect
1215         https://bugs.webkit.org/show_bug.cgi?id=174536
1216         <rdar://problem/33338259>
1217
1218         Reviewed by Simon Fraser.
1219
1220         StyleBuilderConverter::convertLineHeight() converts line-height: <number> into a
1221         "percentage" length. Then, when layout needs to know what the computed value of
1222         line-height is, RenderStyle::computedLineHeight() multiplies this percentage by
1223         the computed font size.
1224
1225         With autosizing, the computed font size already incorporates the autosizing
1226         multiplier, so we shouldn't also incorporate this multiplier into the percentage
1227         value itself. getComputedStyle()'s lineHeightFromStyle() was compensating for
1228         this double application by multiplying the percentage by the font-size's specified
1229         value instead of its computed value, which is incorrect.
1230
1231         Test: fast/text-autosizing/line-height-number.html
1232
1233         * css/CSSComputedStyleDeclaration.cpp:
1234         (WebCore::lineHeightFromStyle):
1235         * css/StyleBuilderConverter.h:
1236         (WebCore::StyleBuilderConverter::convertLineHeight):
1237
1238 2017-07-15  Wenson Hsieh  <wenson_hsieh@apple.com>
1239
1240         [iOS WK2] Presenting an action sheet on an image map prevents selection UI from updating
1241         https://bugs.webkit.org/show_bug.cgi?id=174539
1242         <rdar://problem/33307395>
1243
1244         Reviewed by Darin Adler.
1245
1246         Currently, if TextIndicator fails to take a snapshot in TextIndicator::createWithRange, we will enter an
1247         inconsistent state in the web process where Editor will continue to ignore selection changes until the next time
1248         Editor::setIgnoreSelectionChanges(false) is called. This causes us to indefinitely defer EditorState updates to
1249         the UI process, which leads to selection UI appearing unresponsive.
1250
1251         To fix this, we introduce a new TemporarySelectionChange object to simplify selection changes and/or
1252         EditorState-update-ignoring behaviors within the scope of a single function. The constructor applies these
1253         temporary changes, and the destructor reverts them as needed to their prior values.
1254
1255         This patch only adopts TemporarySelectionChange in order to fix this bug, but future patches will replace the
1256         remaining places where we temporarily change selection and/or ignore selection with this helper.
1257
1258         Test: ActionSheetTests.ImageMapDoesNotDestroySelection.
1259
1260         * editing/Editor.cpp:
1261         (WebCore::TemporarySelectionChange::TemporarySelectionChange):
1262         (WebCore::TemporarySelectionChange::~TemporarySelectionChange):
1263         * editing/Editor.h:
1264         * editing/FrameSelection.h:
1265         (WebCore::FrameSelection::isUpdateAppearanceEnabled):
1266         * page/TextIndicator.cpp:
1267         (WebCore::TextIndicator::createWithRange):
1268
1269 2017-07-15  Myles C. Maxfield  <mmaxfield@apple.com>
1270
1271         Clean up line-height and minimumFontSize functions
1272         https://bugs.webkit.org/show_bug.cgi?id=174535
1273
1274         Reviewed by Simon Fraser.
1275
1276         No behavior change.
1277
1278         No new tests because there is no behavior change.
1279
1280         * css/StyleBuilderConverter.h:
1281         (WebCore::StyleBuilderConverter::convertLineHeight):
1282         * css/StyleResolver.cpp:
1283         (WebCore::StyleResolver::styleForKeyframe):
1284         (WebCore::StyleResolver::adjustRenderStyle):
1285         (WebCore::StyleResolver::pseudoStyleRulesForElement):
1286         (WebCore::StyleResolver::applyMatchedProperties):
1287         (WebCore::StyleResolver::cascadedPropertiesForRollback):
1288         (WebCore::StyleResolver::applyProperty):
1289         (WebCore::StyleResolver::checkForZoomChange):
1290         (WebCore::StyleResolver::createFilterOperations):
1291         (WebCore::StyleResolver::CascadedProperties::set):
1292         (WebCore::StyleResolver::applyCascadedProperties):
1293         * style/StyleFontSizeFunctions.cpp:
1294         (WebCore::Style::computedFontSizeFromSpecifiedSize):
1295         (WebCore::Style::computedFontSizeFromSpecifiedSizeForSVGInlineText):
1296         (): Deleted.
1297
1298 2017-07-14  Jonathan Bedard  <jbedard@apple.com>
1299
1300         Add iOS 11 SPI
1301         https://bugs.webkit.org/show_bug.cgi?id=174430
1302         <rdar://problem/33269288>
1303
1304         Reviewed by Tim Horton.
1305
1306         * WebCore.xcodeproj/project.pbxproj: Add sqlite3SPI.h header.
1307         * platform/ios/PlatformPasteboardIOS.mm: Move UIKit SPI to UIKitSPI.h.
1308         * platform/ios/WebItemProviderPasteboard.mm: Ditto.
1309         * platform/network/cf/FormDataStreamCFNet.cpp: Explicitly define fnfErr and remove
1310         MacErrors.h header for iOS.
1311         * platform/spi/cocoa/IOSurfaceSPI.h: IOSurface is no longer SPI in iOS 11.
1312         * platform/spi/cocoa/PassKitSPI.h: Do not re-define setRequiredShippingContactFields
1313         and setRequiredBillingContactFields in iOS 11.
1314         * platform/spi/cocoa/QuartzCoreSPI.h: Added QuartzCoreSPI used in iOS 11.
1315         * platform/spi/ios/UIKitSPI.h: Add drag-and-drop SPI.
1316         * platform/spi/ios/sqlite3SPI.h: Define required sqlite3 macros.
1317         * platform/sql/SQLiteFileSystem.cpp: Use sqlite3SPI.h.
1318
1319 2017-07-14  Zan Dobersek  <zdobersek@igalia.com>
1320
1321         [GCrypt] Implement CryptoKeyRSA PKCS#8 exports
1322         https://bugs.webkit.org/show_bug.cgi?id=173697
1323
1324         Reviewed by Jiewen Tan.
1325
1326         Implement the PKCS#8 import operation for RSA keys for platforms that use
1327         libgcrypt.
1328
1329         In CryptoKeyRSA::exportPkcs8(), we bail early with an invalid access exception if
1330         this export is not being done for a private key. Otherwise, we start with creating
1331         the `RSAPrivateKey` ASN.1 structure, writing out '0' under the `version` element
1332         and then retrieving the modulus, public and private exponent and both primes.
1333         MPI data for those parameters is written out into corresponding elements in the
1334         `RSAPrivateKey` structure. We then manually compute values of both exponents and
1335         the coefficient parameters, using the private exponent's and both primes' MPI
1336         values. The p and q parameters (i.e. the primes) are switched in libgcrypt,
1337         deviating from the standard practice, so we have to operate with those two
1338         accordingly. We eliminate the optional `otherPrimeInfos` attribute on the
1339         `RSAPrivateKey` structure. Support for this attribute will be added later.
1340
1341         We then create the `PrivateKeyInfo` ASN.1 structure, and write out '0' under the
1342         `version` element. The id-rsaEncryption object identifier is written out under
1343         the `algorithm.algorithm` element. In the future, an object identifier that
1344         matches this key's algorithm will have to be written out here (id-RSASSA-PSS or
1345         id-RSAES-OAEP), along with the appropriate parameters structure, but no test in
1346         WebKit or the web-platform-tests suite covers this detail. For now, a null value
1347         is written out under the `algorithm.parameters` element.
1348
1349         Data for the `RSAPrivateKey` structure is retrieved and written out under the
1350         `privateKey` element.  The optional `attributes` element on the `PrivateKeyInfo`
1351         structure is eliminated.
1352
1353         Data that was encoded through the `PrivateKeyInfo` structure is then retrieved
1354         and returned from the exportPkcs8() method.
1355
1356         No new tests -- related tests are now passing and are unskipped.
1357
1358         * crypto/gcrypt/CryptoKeyRSAGCrypt.cpp:
1359         (WebCore::CryptoKeyRSA::exportPkcs8):
1360
1361 2017-07-14  Zan Dobersek  <zdobersek@igalia.com>
1362
1363         [GCrypt] Implement CryptoKeyRSA PKCS#8 imports
1364         https://bugs.webkit.org/show_bug.cgi?id=173696
1365
1366         Reviewed by Jiewen Tan.
1367
1368         Implement the PKCS#8 import operation for RSA keys for platforms that use
1369         libgcrypt.
1370
1371         In CryptoKeyRSA::importPkcs8(), the provided key data is decoded against the
1372         'PrivateKeyInfo` ASN.1 structure. We then validate the `version` element and
1373         check that the `privateKeyAlgorithm.algorithm` element contains a supported
1374         object identifier. This check is for now mostly superficial, only ensuring
1375         that the object identifier is either id-rsaEncryption, id-RSAES-OAEP or
1376         id-RSASSA-PSS. This has to be further extended to also check the
1377         id-sha{1,256,384,512}WithRSAEncryption identifiers as well as decoding the
1378         `privateKeyAlgorithm.parameters` element against a specific ASN.1 structure, if
1379         necessary (RSASSA-PSS-params or RSAES-OAEP-params), and cross-checking the
1380         specified digest algorithm with the algorithm that's specified through the main
1381         object identifier or the structure contained in `privateKeyAlgorithm.parameters`.
1382         This is avoided for now because no test in WebKit or the web-platform-tests
1383         suite covers this detail of the specification.
1384
1385         Data under the `privateKey` element is decoded against the `RSAPrivateKey` ASN.1
1386         structure, and the `version` element of that structure is validated. We then
1387         retrieve data from that structure for the modulus, public exponent, private
1388         exponent, both primes, both exponents and the coefficient parameters, bailing if
1389         any of them is missing. Because libgcrypt switches the use of p and q parameters,
1390         deviating from the standard use, we have to recompute the u parameter (the
1391         coefficient). With that calculated, we're then able to construct the `private-key`
1392         s-expression, embedding into it all the necessary parameters, and transferring
1393         the ownership of this object to the new CryptoKeyRSA object that's then returned
1394         from the importPkcs8() method.
1395
1396         No new tests -- related tests are now passing and are unskipped.
1397
1398         * crypto/gcrypt/CryptoKeyRSAGCrypt.cpp:
1399         (WebCore::CryptoKeyRSA::importPkcs8):
1400
1401 2017-07-14  Chris Dumez  <cdumez@apple.com>
1402
1403         Possible crash in ~UserGestureIndicator() when on non-main thread
1404         https://bugs.webkit.org/show_bug.cgi?id=174522
1405         <rdar://problem/30283071>
1406
1407         Reviewed by Sam Weinig.
1408
1409         UserGestureIndicator objects may be constructed / destructed in worker thread
1410         (e.g. in DOMTimer::fired()). The UserGestureIndicator constructor / destructor
1411         are supposed to be no-op on non-main threads so that it is safe. However,
1412         we were mistakenly initializing m_previousToken data member in the constructor
1413         on background thread, which meant that we could crash later on in the
1414         UserGestureIndicator destructor when destroying m_previousToken.
1415
1416         Test: fast/workers/worker-user-gesture.html
1417
1418         * dom/UserGestureIndicator.cpp:
1419         (WebCore::currentToken):
1420         (WebCore::UserGestureIndicator::UserGestureIndicator):
1421
1422 2017-07-14  Matt Lewis  <jlewis3@apple.com>
1423
1424         Unreviewed, rolling out r219516.
1425
1426         This caused an API failure on macOS.
1427
1428         Reverted changeset:
1429
1430         "Make sure all CFHTTPCookieStorageRefs we create are
1431         scheduled."
1432         https://bugs.webkit.org/show_bug.cgi?id=174513
1433         http://trac.webkit.org/changeset/219516
1434
1435 2017-07-14  Jer Noble  <jer.noble@apple.com>
1436
1437         Allow clients to override their own hardware media requirements where no fallback media exists.
1438         https://bugs.webkit.org/show_bug.cgi?id=174426
1439         <rdar://problem/32537704>
1440
1441         Reviewed by Eric Carlson.
1442
1443         Add a new setting which allows clients to specify their own mediaContentTypesRequiringHardwareSupport should be
1444         ignared in the case where no fallback exists, such as the case of a single <source> element, or setting the src
1445         attribute directly.
1446
1447         * html/HTMLMediaElement.cpp:
1448         (WebCore::HTMLMediaElement::havePotentialSourceChild):
1449         (WebCore::HTMLMediaElement::selectNextSourceChild):
1450         (WebCore::HTMLMediaElement::sourceWasAdded):
1451         (WebCore::HTMLMediaElement::sourceWasRemoved):
1452         (WebCore::HTMLMediaElement::mediaPlayerShouldCheckHardwareSupport):
1453         * html/HTMLMediaElement.h:
1454         * page/Settings.h:
1455         * platform/graphics/MediaPlayer.cpp:
1456         (WebCore::MediaPlayer::shouldCheckHardwareSupport):
1457         * platform/graphics/MediaPlayer.h:
1458         (WebCore::MediaPlayerClient::mediaPlayerShouldCheckHardwareSupport):
1459         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
1460         (WebCore::MediaPlayerPrivateAVFoundationObjC::assetStatus):
1461         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
1462         (WebCore::SourceBufferPrivateAVFObjC::didParseStreamDataAsAsset):
1463
1464 2017-07-14  Chris Dumez  <cdumez@apple.com>
1465
1466         Possible crash under NetworkSocketStream::didFailSocketStream()
1467         https://bugs.webkit.org/show_bug.cgi?id=174526
1468         <rdar://problem/32831441>
1469
1470         Reviewed by Brent Fulgham.
1471
1472         Call m_client.didFailSocketStream() asynchronously in the constructor as our
1473         caller (the client) is also being initialized at this point.
1474
1475         * platform/network/cf/SocketStreamHandleImplCFNet.cpp:
1476         (WebCore::SocketStreamHandleImpl::SocketStreamHandleImpl):
1477
1478 2017-07-14  Youenn Fablet  <youenn@apple.com>
1479
1480         WebRTC: silence data not sent for disabled audio track
1481         https://bugs.webkit.org/show_bug.cgi?id=174456
1482         <rdar://problem/33284623>
1483
1484         Reviewed by Eric Carlson.
1485
1486         Test: webrtc/audio-muted-stats.html
1487               webrtc/audio-muted-stats2.html
1488
1489         Adding a timer-based approach to send 10ms of silence every second.
1490         This is consistent with how muted video tracks are implemented.
1491         In case the audio track is muted at the time it is added, no silence data is sent.
1492
1493         * platform/mediastream/mac/RealtimeOutgoingAudioSource.cpp:
1494         (WebCore::RealtimeOutgoingAudioSource::RealtimeOutgoingAudioSource):
1495         (WebCore::RealtimeOutgoingAudioSource::initializeConverter):
1496         (WebCore::RealtimeOutgoingAudioSource::stop):
1497         (WebCore::RealtimeOutgoingAudioSource::sourceMutedChanged):
1498         (WebCore::RealtimeOutgoingAudioSource::sourceEnabledChanged):
1499         (WebCore::RealtimeOutgoingAudioSource::handleMutedIfNeeded):
1500         (WebCore::RealtimeOutgoingAudioSource::sendSilence):
1501         * platform/mediastream/mac/RealtimeOutgoingAudioSource.h:
1502
1503 2017-07-14  Michael Catanzaro  <mcatanzaro@igalia.com>
1504
1505         [CMake] Unclear distinction between WebKitHelpers and WebKitMacros
1506         https://bugs.webkit.org/show_bug.cgi?id=153189
1507
1508         Reviewed by Antonio Gomes.
1509
1510         * CMakeLists.txt: Include WebCoreMacros.cmake.
1511         * WebCoreMacros.cmake: Added.
1512
1513 2017-07-14  Jeremy Jones  <jeremyj@apple.com>
1514
1515         Fix style for name of class alloc function in WebVideoFullscreenInterfaceAVKit.
1516         https://bugs.webkit.org/show_bug.cgi?id=174476
1517
1518         Reviewed by Alex Christensen.
1519
1520         No new tests because no behavior change.
1521
1522         This is a rename for per style requirements.
1523
1524         * platform/ios/WebVideoFullscreenInterfaceAVKit.mm:
1525         (allocWebAVPictureInPicturePlayerLayerViewInstance):
1526         (WebAVPlayerLayerView_pictureInPicturePlayerLayerView):
1527         (allocWebAVPlayerLayerViewInstance):
1528         (WebVideoFullscreenInterfaceAVKit::setupFullscreen):
1529         (getWebAVPictureInPicturePlayerLayerViewClass): Deleted.
1530         (getWebAVPlayerLayerViewClass): Deleted.
1531
1532 2017-07-14  Jer Noble  <jer.noble@apple.com>
1533
1534         [MSE] Removing samples when presentation order does not match decode order can cause bad behavior.
1535         https://bugs.webkit.org/show_bug.cgi?id=174514
1536
1537         Reviewed by Sam Weinig.
1538
1539         Test: media/media-source/media-source-remove-decodeorder-crash.html
1540
1541         Fix the algorithm in removeCodedFrames() so that it's not possible to have a removePresentationStart >
1542         removePresentationEnd (and also removeDecodeStart > removeDecodeEnd).
1543
1544         * Modules/mediasource/SampleMap.cpp:
1545         (WebCore::PresentationOrderSampleMap::findSampleContainingOrAfterPresentationTime):
1546         (WebCore::PresentationOrderSampleMap::findSampleStartingAfterPresentationTime):
1547         * Modules/mediasource/SampleMap.h:
1548         * Modules/mediasource/SourceBuffer.cpp:
1549         (WebCore::SourceBuffer::removeCodedFrames):
1550
1551 2017-07-14  Youenn Fablet  <youenn@apple.com>
1552
1553         Increase CoreAudio render audio buffer sizes for WebRTC
1554         https://bugs.webkit.org/show_bug.cgi?id=174508
1555
1556         Reviewed by Eric Carlson.
1557
1558         Covered by manually testing audio rendering through WebRTC sites.
1559
1560         * platform/mediastream/mac/AudioTrackPrivateMediaStreamCocoa.cpp:
1561         (WebCore::AudioTrackPrivateMediaStreamCocoa::createAudioUnit): Setting audio buffer size equivalent to 20 ms.
1562
1563 2017-07-14  Brady Eidson  <beidson@apple.com>
1564
1565         Make sure all CFHTTPCookieStorageRefs we create are scheduled.
1566         <rdar://problem/33221110> and https://bugs.webkit.org/show_bug.cgi?id=174513
1567
1568         Reviewed by Tim Horton.
1569
1570         * platform/spi/cf/CFNetworkSPI.h:
1571
1572 2017-07-14  Youenn Fablet  <youenn@apple.com>
1573
1574         Remove CoreAudioCaptureSource speaker configuration
1575         https://bugs.webkit.org/show_bug.cgi?id=174512
1576
1577         Reviewed by Eric Carlson.
1578
1579         Covered by manually testing audio rendering through WebRTC sites.
1580
1581         * platform/mediastream/mac/CoreAudioCaptureSource.cpp:
1582         (WebCore::CoreAudioSharedUnit::setupAudioUnit):
1583
1584 2017-07-14  Eric Carlson  <eric.carlson@apple.com>
1585
1586         [MediaStream] Limit the number of remote video samples queued
1587         https://bugs.webkit.org/show_bug.cgi?id=174505
1588         <rdar://problem/33223015>
1589
1590         Reviewed by Youenn Fablet.
1591
1592         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
1593         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::removeOldSamplesFromPendingQueue): Only
1594         enqueue a fixed number of frames with invalid or negative decode times.
1595
1596 2017-07-14  Youenn Fablet  <youenn@apple.com>
1597
1598         Report CoreAudioCaptureSource failure in case shared unit stops working properly
1599         https://bugs.webkit.org/show_bug.cgi?id=174494
1600
1601         Reviewed by Eric Carlson.
1602
1603         Manual test by interrupting an audio capture on Mac.
1604
1605         This patch adds a timer to CoreAudioSharedUnit.
1606         In case the capture callback is not called after one second, the shared unit is said to fail.
1607         Each source is notified that capture is failing.
1608         This will in turn trigger onend track event so that web pages can remedy capture failure.
1609
1610         Timer starts with 10 seconds for audio data to start being captured.
1611         It is then decreased to 2 seconds.
1612
1613         * platform/mediastream/RealtimeMediaSource.cpp:
1614         (WebCore::RealtimeMediaSource::captureFailed):
1615         * platform/mediastream/RealtimeMediaSource.h:
1616         * platform/mediastream/mac/CoreAudioCaptureSource.cpp:
1617         (WebCore::CoreAudioSharedUnit::CoreAudioSharedUnit):
1618         (WebCore::CoreAudioSharedUnit::processMicrophoneSamples):
1619         (WebCore::CoreAudioSharedUnit::startInternal):
1620         (WebCore::CoreAudioSharedUnit::verifyIsCapturing):
1621         (WebCore::CoreAudioSharedUnit::stopInternal):
1622
1623 2017-07-14  Jer Noble  <jer.noble@apple.com>
1624
1625         Adding the 'autoplay' attribute to a media element during a user gesture should remove user gesture restrictions.
1626         https://bugs.webkit.org/show_bug.cgi?id=174373
1627
1628         Reviewed by Eric Carlson.
1629
1630         Test: media/video-add-autoplay-user-gesture.html
1631
1632         * html/HTMLMediaElement.cpp:
1633         (WebCore::HTMLMediaElement::parseAttribute):
1634
1635 2017-07-14  Matt Lewis  <jlewis3@apple.com>
1636
1637         Unreviewed, rolling out r219500.
1638
1639         The test is consistently failing on iOS simulator.
1640
1641         Reverted changeset:
1642
1643         "AX: VoiceOver silent or skipping over time values on media
1644         player."
1645         https://bugs.webkit.org/show_bug.cgi?id=174324
1646         http://trac.webkit.org/changeset/219500
1647
1648 2017-07-14  Fujii Hironori  <Hironori.Fujii@sony.com>
1649
1650         [WinCairo] error 'm_compositorTexture': undeclared identifier since Bug 174345
1651         https://bugs.webkit.org/show_bug.cgi?id=174493
1652
1653         Reviewed by Alex Christensen.
1654
1655         Compilation errors are reported by the code using a member
1656         m_compositorTexture of GraphicsContext3D which exists only if
1657         USE(COORDINATED_GRAPHICS_THREADED). WinCairo port doesn't use it.
1658
1659         * platform/graphics/cairo/GraphicsContext3DCairo.cpp:
1660         (WebCore::GraphicsContext3D::GraphicsContext3D):
1661         Use m_compositorTexture only if USE(COORDINATED_GRAPHICS_THREADED).
1662         (WebCore::GraphicsContext3D::~GraphicsContext3D): Ditto.
1663         * platform/graphics/opengl/GraphicsContext3DOpenGLES.cpp:
1664         (WebCore::GraphicsContext3D::reshapeFBOs):
1665         Ditto. Fix the wrong indentation level.
1666
1667 2017-07-14  Fujii Hironori  <Hironori.Fujii@sony.com>
1668
1669         [HarfBuzz] Decomposed Vietnamese characters are rendered incorrectly
1670         https://bugs.webkit.org/show_bug.cgi?id=174418
1671
1672         Reviewed by Michael Catanzaro.
1673
1674         HarfBuzzShaper should normalize the input text before collecting
1675         HarfBuzzRuns. Actually, HarfBuzzShaper::setNormalizedBuffer does
1676         the task. But, this function hasn't been called from anywhere
1677         since Bug 108077.
1678
1679         Test: fast/text/international/vietnamese-nfd.html
1680
1681         * platform/graphics/harfbuzz/HarfBuzzShaper.cpp:
1682         (WebCore::HarfBuzzShaper::HarfBuzzShaper):
1683         Call setNormalizedBuffer instead of normalizeCharacters.
1684         (WebCore::normalizeCharacters): Deleted.
1685
1686 2017-07-14  Fujii Hironori  <Hironori.Fujii@sony.com>
1687
1688         [WinCairo] Build broken "Cannot open include file: 'GL/glext.h'" since Bug 172104
1689         https://bugs.webkit.org/show_bug.cgi?id=174492
1690
1691         Reviewed by Žan Doberšek.
1692
1693         WinCairo port uses GLES. OpenGLShims.h shouldn't be included.
1694
1695         * platform/graphics/cairo/GraphicsContext3DCairo.cpp:
1696         Include "OpenGLShims.h" only if !USE(OPENGL_ES_2) instead of USE(OPENGL).
1697
1698 2017-07-14  Chris Dumez  <cdumez@apple.com>
1699
1700         PageCache::removeAllItemsForPage(Page&) may reenter itself and cause crashes
1701         https://bugs.webkit.org/show_bug.cgi?id=174473
1702         <rdar://problem/32177485>
1703
1704         Reviewed by Antti Koivisto.
1705
1706         This could happen when a Page containing an SVGImage is removed from PageCache and
1707         this resulted in the destruction of the SVGImage. Because the SVGImage has an internal
1708         utility Page, it will also call PageCache::removeAllItemsForPage(WebCore::Page&) upon
1709         destruction, causing us to reenter.
1710
1711         Address the issue by not calling PageCache::removeAllItemsForPage() for utility pages
1712         since those cannot be in PageCache in the first place.
1713
1714         Also add assertions to make sure:
1715         1. We never insert a utility page into PageCache
1716         2. PageCache::removeAllItemsForPage() does not reenter
1717
1718         No new tests, because I was unable to write a test which reproduced the crash. This
1719         is in theory testable using an API test which enables PageCache, loads a page
1720         containing an SVGImage, navigates away from this page so that it goes into PageCache,
1721         and then calls [WebView _close]. However, when I tried writing such test, I could
1722         not get the SVGImage to get destroyed while PageCache::removeAllItemsForPage() is
1723         called for the top-level page for some reason. Something seems to be keeping the
1724         SVGImage alive longer. I tried disabling the MemoryCache but it did not help.
1725
1726         * history/PageCache.cpp:
1727         (WebCore::PageCache::addIfCacheable):
1728         (WebCore::PageCache::removeAllItemsForPage):
1729         * history/PageCache.h:
1730         * page/Page.cpp:
1731         (WebCore::Page::~Page):
1732
1733 2017-07-14  Aaron Chu  <aaron_chu@apple.com>
1734
1735         AX: VoiceOver silent or skipping over time values on media player.
1736         https://bugs.webkit.org/show_bug.cgi?id=174324
1737         <rdar://problem/32021784>
1738
1739         Reviewed by Antoine Quint.
1740
1741         Added role attribute to modern media controls time lable class so that VoiceOver can access the time label when the media is playing.
1742
1743         Updated: media/modern-media-controls/time-label/time-label.html
1744
1745         * Modules/modern-media-controls/controls/time-label.js:
1746
1747 2017-07-13  Michael Catanzaro  <mcatanzaro@igalia.com>
1748
1749         Fix compiler warnings when building with GCC 7
1750         https://bugs.webkit.org/show_bug.cgi?id=174463
1751
1752         Reviewed by Darin Adler.
1753
1754         * testing/InternalSettings.cpp:
1755         (WebCore::InternalSettings::setShouldManageAudioSessionCategory):
1756
1757 2017-07-13  Michael Catanzaro  <mcatanzaro@igalia.com>
1758
1759         Incorrect call to StyledElement::setInlineStyleProperty in ImageDocument::createDocumentStructure
1760         https://bugs.webkit.org/show_bug.cgi?id=174470
1761
1762         Reviewed by Darin Adler.
1763
1764         * html/ImageDocument.cpp:
1765         (WebCore::ImageDocument::createDocumentStructure):
1766
1767 2017-07-13  Dean Jackson  <dino@apple.com>
1768
1769         Fix iOS build.
1770
1771         * platform/graphics/GraphicsContext3D.h:
1772
1773 2017-07-12  Dean Jackson  <dino@apple.com>
1774
1775         Rename GraphicsContext[3D]Mac to Cocoa and move things into graphics/cocoa
1776         https://bugs.webkit.org/show_bug.cgi?id=174453
1777         <rdar://problem/33281481>
1778
1779         Reviewed by Simon Fraser.
1780
1781         Two renames, two moves:
1782         graphics/mac/GraphicsContext3DMac.mm -> graphics/cocoa/GraphicsContext3DCocoa.mm
1783         graphics/mac/GraphicsContext.mm -> graphics/cocoa/GraphicsContextCocoa.mm
1784         graphics/mac/WebGLLayer.h -> graphics/cocoa/WebGLLayer.h
1785         graphics/mac/WebGLLayer.mm -> graphics/cocoa/WebGLLayer.mm
1786
1787         * PlatformMac.cmake:
1788         * WebCore.xcodeproj/project.pbxproj:
1789         * platform/graphics/cocoa/GraphicsContext3DCocoa.mm: Renamed from Source/WebCore/platform/graphics/mac/GraphicsContext3DMac.mm.
1790         * platform/graphics/cocoa/GraphicsContextCocoa.mm: Renamed from Source/WebCore/platform/graphics/mac/GraphicsContextMac.mm.
1791         * platform/graphics/cocoa/WebGLLayer.h: Renamed from Source/WebCore/platform/graphics/mac/WebGLLayer.h.
1792         * platform/graphics/cocoa/WebGLLayer.mm: Renamed from Source/WebCore/platform/graphics/mac/WebGLLayer.mm.
1793
1794 2017-07-12  Dean Jackson  <dino@apple.com>
1795
1796         Clean-up some things in GraphicsContext3D
1797         https://bugs.webkit.org/show_bug.cgi?id=174452
1798         <rdar://problem/33281257>
1799
1800         Reviewed by Simon Fraser.
1801
1802         General clean-up in GC3D.
1803
1804         Covered by existing tests.
1805
1806         * platform/graphics/GraphicsContext3D.h: Use initial values where possible.
1807         (WebCore::GraphicsContext3D::GraphicsContext3DState::GraphicsContext3DState): Deleted.
1808         * platform/graphics/mac/GraphicsContext3DMac.mm:
1809         (WebCore::GraphicsContext3D::GraphicsContext3D): Nearly everything can come from the
1810         initial values now.
1811         (WebCore::GraphicsContext3D::~GraphicsContext3D): Remove code that won't be enabled
1812         on this platform.
1813         * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
1814         (WebCore::GraphicsContext3D::paintRenderingResultsToCanvas): While unlikely to happen,
1815         and possibly harmless in this case, add some checked arithmetic to make sure we don't overflow
1816         when working out how big a buffer to create.
1817         (WebCore::GraphicsContext3D::paintRenderingResultsToImageData): Ditto.
1818         (WebCore::GraphicsContext3D::reshape): Do nothing if we are ever given negative
1819         width or height. Again unlikely.
1820
1821 2017-07-13  Dean Jackson  <dino@apple.com>
1822
1823         Avoid unnecessary copy of framebuffer into WebGL Layer
1824         https://bugs.webkit.org/show_bug.cgi?id=174345
1825         <rdar://problem/33228950>
1826
1827         Reviewed by Sam Weinig.
1828
1829         On macOS, we're unnecessarily copying the framebuffer into another
1830         texture before pushing it into the compositing layer. Instead we
1831         should simply render the FBO into the CALayer we use to draw on
1832         the screen.
1833
1834         Covered by the existing WebGL tests.
1835
1836         * platform/graphics/GraphicsContext3D.h:
1837         (WebCore::GraphicsContext3D::platformTexture): Return the FBO texture instead.
1838         * platform/graphics/mac/GraphicsContext3DMac.mm:
1839         (WebCore::GraphicsContext3D::GraphicsContext3D): No need to have a compositing
1840         texture.
1841         (WebCore::GraphicsContext3D::~GraphicsContext3D):
1842         * platform/graphics/opengl/GraphicsContext3DOpenGL.cpp:
1843         (WebCore::GraphicsContext3D::reshapeFBOs):
1844         * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
1845         (WebCore::GraphicsContext3D::prepareTexture): Don't copy the pixels from
1846         the FBO into the compositing texture
1847
1848 2017-07-13  Mark Lam  <mark.lam@apple.com>
1849
1850         Implementors of memoryCost() need to be thread-safe.
1851         https://bugs.webkit.org/show_bug.cgi?id=172738
1852         <rdar://problem/32474881>
1853
1854         Reviewed by Keith Miller.
1855
1856         No new tests. This patch fixes a race condition bug that can result in random
1857         crashes (and other unpredictable behavior), and is very difficult to test for.
1858
1859         * Modules/webaudio/AudioBuffer.cpp:
1860         (WebCore::AudioBuffer::releaseMemory):
1861         (WebCore::AudioBuffer::memoryCost):
1862         * Modules/webaudio/AudioBuffer.h:
1863         * dom/ChildNodeList.h:
1864         * dom/CollectionIndexCache.h:
1865         (WebCore::CollectionIndexCache::memoryCost):
1866         * dom/LiveNodeList.h:
1867         * html/CachedHTMLCollection.h:
1868         * html/HTMLCanvasElement.cpp:
1869         (WebCore::HTMLCanvasElement::memoryCost):
1870         (WebCore::HTMLCanvasElement::externalMemoryCost):
1871         (WebCore::HTMLCanvasElement::setImageBuffer):
1872         * html/HTMLCanvasElement.h:
1873         * html/HTMLCollection.cpp:
1874         (WebCore::HTMLCollection::invalidateNamedElementCache):
1875         * html/HTMLCollection.h:
1876         (WebCore::CollectionNamedElementCache::memoryCost):
1877         (WebCore::HTMLCollection::memoryCost):
1878         (WebCore::HTMLCollection::setNamedItemCache):
1879         * platform/graphics/ImageBuffer.cpp:
1880         (WebCore::ImageBuffer::memoryCost):
1881         * platform/graphics/cg/ImageBufferCG.cpp:
1882         (WebCore::ImageBuffer::memoryCost):
1883         (WebCore::ImageBuffer::externalMemoryCost):
1884
1885 2017-07-13  Jeremy Jones  <jeremyj@apple.com>
1886
1887         Fix style. Use #pragma once in VideoFullscreen and PlaybackSession headers.
1888         https://bugs.webkit.org/show_bug.cgi?id=174448
1889
1890         Reviewed by Eric Carlson.
1891
1892         No behavior change.
1893
1894         * platform/cocoa/WebPlaybackSessionInterface.h:
1895         * platform/cocoa/WebVideoFullscreenChangeObserver.h:
1896         * platform/cocoa/WebVideoFullscreenModel.h:
1897         * platform/cocoa/WebVideoFullscreenModelVideoElement.h:
1898         * platform/ios/WebPlaybackSessionInterfaceAVKit.h:
1899         * platform/ios/WebVideoFullscreenControllerAVKit.h:
1900         * platform/ios/WebVideoFullscreenInterfaceAVKit.h:
1901         * platform/mac/WebVideoFullscreenInterfaceMac.h:
1902
1903 2017-07-13  Alex Christensen  <achristensen@webkit.org>
1904
1905         Deleting last URLSearchParams key should remove trailing ? in associated URL
1906         https://bugs.webkit.org/show_bug.cgi?id=174465
1907
1908         Reviewed by Chris Dumez.
1909
1910         This makes us match the behavior of Chrome and Firefox, and the spec after https://github.com/whatwg/url/issues/332 is approved.
1911         This will be covered by an upcoming web platform test, and I updated fast/dom/DOMURL/searchparams.html to cover it now.
1912
1913         * platform/URLParser.cpp:
1914         (WebCore::URLParser::serialize):
1915         If there are no tuples, serialize to the null string instead of a non-null empty string.
1916         This makes it so URL::setQuery removes the ?
1917
1918 2017-07-13  Jeremy Jones  <jeremyj@apple.com>
1919
1920         Style fix. Replace strongThis with protectedThis.
1921         https://bugs.webkit.org/show_bug.cgi?id=174444
1922
1923         Reviewed by Eric Carlson.
1924
1925         Rename, no behavior change.
1926
1927         * Modules/webaudio/AudioScheduledSourceNode.cpp:
1928         (WebCore::AudioScheduledSourceNode::finish):
1929         * platform/graphics/cocoa/WebCoreDecompressionSession.mm:
1930         (WebCore::WebCoreDecompressionSession::maybeBecomeReadyForMoreMediaData):
1931         (WebCore::WebCoreDecompressionSession::enqueueSample):
1932         (WebCore::WebCoreDecompressionSession::handleDecompressionOutput):
1933         (WebCore::WebCoreDecompressionSession::enqueueDecodedSample):
1934         (WebCore::WebCoreDecompressionSession::requestMediaDataWhenReady):
1935         (WebCore::WebCoreDecompressionSession::flush):
1936
1937 2017-07-13  Jeremy Jones  <jeremyj@apple.com>
1938
1939         Fix block style in WebVideoFullscreen classes.
1940         https://bugs.webkit.org/show_bug.cgi?id=174446
1941
1942         Reviewed by Eric Carlson.
1943
1944         No behavior change.
1945
1946         * platform/ios/WebVideoFullscreenControllerAVKit.mm:
1947         (WebVideoFullscreenControllerContext::setVideoLayerFrame):
1948         * platform/ios/WebVideoFullscreenInterfaceAVKit.mm:
1949         (-[WebAVPlayerLayer layoutSublayers]):
1950         (getWebAVPictureInPicturePlayerLayerViewClass):
1951         (getWebAVPlayerLayerViewClass):
1952
1953 2017-07-13  Joseph Pecoraro  <pecoraro@apple.com>
1954
1955         Web Inspector: Remove unused and untested Page domain commands
1956         https://bugs.webkit.org/show_bug.cgi?id=174429
1957
1958         Reviewed by Timothy Hatcher.
1959
1960         * inspector/InspectorPageAgent.cpp:
1961         (WebCore::InspectorPageAgent::disable):
1962         (WebCore::InspectorPageAgent::didClearWindowObjectInWorld):
1963         (WebCore::InspectorPageAgent::addScriptToEvaluateOnLoad): Deleted.
1964         (WebCore::InspectorPageAgent::removeScriptToEvaluateOnLoad): Deleted.
1965         * inspector/InspectorPageAgent.h:
1966
1967 2017-07-13  Zan Dobersek  <zdobersek@igalia.com>
1968
1969         [GCrypt] Implement CryptoKeyRSA SPKI exports
1970         https://bugs.webkit.org/show_bug.cgi?id=173695
1971
1972         Reviewed by Jiewen Tan.
1973
1974         Implement the SPKI export operation for RSA keys for platforms that use
1975         libgcrypt.
1976
1977         In CryptoKeyRSA::exportSpki(), we bail early with an invalid access exception if
1978         this export is not being done for a public key. Otherwise, we start with creating
1979         the `RSAPublicKey` ASN.1 structure, filling in the modulus and public exponent
1980         data that's retrieved from the `public-key` s-expression in the signed MPI format.
1981
1982         We then create the `SubjectPublicKeyInfo` ASN.1 structure and fill it out with
1983         the necessary data. The id-rsaEncryption object identifier is written out under
1984         the `algorithm.algorithm` element, and a null value is written out under the
1985         `algorithm.parameters` element. This doesn't follow the specification at the
1986         moment, since id-RSASSA-PSS would have to be written for the RSA-PSS algorithm,
1987         and id-RSAES-OAEP for the RSA-OAEP algorithm, along with specific parameter
1988         structures. But no test in WebKit or the web-platform-tests suite covers this,
1989         so this deviation should be addressed later.
1990
1991         Data of the previously-constructed `RSAPublicKey` structure is retrieved and
1992         written out under the `subjectPublicKey` element, before finally retrieving
1993         data of the `SubjectPublicKeyInfo` structure and returning that to the caller.
1994
1995         A helper mpiSignedData() function is added, providing overloads for gcry_mpi_t
1996         and gcry_sexp_t parameters. MPI data for that parameter is retrieved and the
1997         first byte of that data is tested, inserting an additional 0x00 byte at the
1998         beginning of the Vector if that first byte has the first bit set, avoiding this
1999         data accidentally being interpreted as a signed integer.
2000
2001         No new tests -- related tests are now passing and are unskipped.
2002
2003         * crypto/gcrypt/CryptoKeyRSAGCrypt.cpp:
2004         (WebCore::CryptoKeyRSA::exportSpki):
2005         * crypto/gcrypt/GCryptUtilities.h:
2006         (WebCore::mpiSignedData):
2007
2008 2017-07-13  Zan Dobersek  <zdobersek@igalia.com>
2009
2010         [GCrypt] Implement CryptoKeyRSA SPKI imports
2011         https://bugs.webkit.org/show_bug.cgi?id=173694
2012
2013         Reviewed by Jiewen Tan.
2014
2015         Implement the SPKI import operation for RSA keys for platforms that use
2016         libgcrypt.
2017
2018         The passed-in key data is decoded against the `SubjectPublicKeyInfo` ASN.1
2019         structure. We then validate the `algorithm.algorithm` element, ensuring that
2020         the value under that represents a supported object identifier. This check is
2021         for now mostly superficial, only ensuring that the object identifier is either
2022         id-rsaEncryption, id-RSAES-OAEP or id-RSASSA-PSS. This has to be further extended
2023         to also check the id-sha{1,256,384,512}WithRSAEncryption identifiers as well as
2024         decoding the `algorithm.parameters` element against a specific ASN.1 structure,
2025         if necessary (RSASSA-PSS-params or RSAES-OAEP-params), and cross-checking the
2026         specified digest algorithm with the algorithm that's specified through the main
2027         object identifier or the structure contained in `algorithm.parameters`. This is
2028         avoided for now because no test in WebKit or the web-platform-tests suite covers
2029         this detail of the specification.
2030
2031         After the algorithm is identified as supported, we proceed with decoding the
2032         `subjectPublicKey` data against the `RSAPublicKey` ASN.1 structure. From there,
2033         we retrieve the `modulus` and `publicExponent` data from which we can construct
2034         an RSA `public-key` s-expression that can be used through libgcrypt. A new
2035         CryptoKeyRSA object is then created, taking over ownership of the `public-key`
2036         s-expression, and returned.
2037
2038         No new tests -- related tests are now passing and are unskipped.
2039
2040         * crypto/gcrypt/CryptoKeyRSAGCrypt.cpp:
2041         (WebCore::supportedAlgorithmIdentifier):
2042         (WebCore::CryptoKeyRSA::importSpki):
2043
2044 2017-07-12  Carlos Alberto Lopez Perez  <clopez@igalia.com>
2045
2046         REGRESSION(r219332): [GTK] 9 new failures on fast/forms spinbutton related tests
2047         https://bugs.webkit.org/show_bug.cgi?id=174395
2048
2049         Reviewed by Carlos Garcia Campos.
2050
2051         Covered by existing tests.
2052
2053         Before r219332 the height of the spin button widget was
2054         calculated as the maximum value between the individual button
2055         ( the [+] or [-] ) width (33 pixels) and height (16 pixels).
2056         And r219332 caused the height of the widget to be calculated as
2057         the height of the button (16 pixels), which was incorrect as
2058         each button should be first expanded vertically to fit the
2059         preferred size of the widget.
2060
2061         Fix this by making the calculations about the spin button widget
2062         on a new function spinButtonSize() that takes this into account,
2063         and use this values both for adjusting the style of the input
2064         field and the spin button widget itself.
2065
2066         * rendering/RenderThemeGtk.cpp:
2067         (WebCore::spinButtonSize):
2068         (WebCore::RenderThemeGtk::adjustTextFieldStyle):
2069         (WebCore::RenderThemeGtk::adjustInnerSpinButtonStyle):
2070
2071 2017-07-13  Miguel Gomez  <magomez@igalia.com>
2072
2073         [GTK][WPE] border-radius with non visible border doesn't work on images that have their own RenderLayer
2074         https://bugs.webkit.org/show_bug.cgi?id=174157
2075
2076         Reviewed by Carlos Garcia Campos.
2077
2078         Do not allow direct compositing of images when they have a border-radius property on WebKitGTK+ and WPE.
2079         These platforms don't support clipping using rounded rectangles during composition, which is required
2080         when using border-radius and the border is not visible. Due to this, they need to perform the clippping
2081         with cairo.
2082
2083         This is a temporal fix, until appropriate clipping is implemented in the TextureMapper.
2084
2085         No new tests.
2086
2087         * rendering/RenderLayerBacking.cpp:
2088         (WebCore::RenderLayerBacking::isDirectlyCompositedImage):
2089
2090 2017-07-13  Chris Fleizach  <cfleizach@apple.com>
2091
2092         AX: WebView crashes app after opening VoiceOver context box menu from modal dialog
2093         https://bugs.webkit.org/show_bug.cgi?id=163999
2094         <rdar://problem/28949013>
2095
2096         Reviewed by Joanmarie Diggs.
2097
2098         Protect when m_object goes away.
2099
2100         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
2101         (-[WebAccessibilityObjectWrapper accessibilityShowContextMenu]):
2102
2103 2017-07-12  Said Abou-Hallawa  <sabouhallawa@apple.com>
2104
2105         Async image decoding for large images should be disabled by default
2106         https://bugs.webkit.org/show_bug.cgi?id=174432
2107
2108         Reviewed by Simon Fraser.
2109
2110         -- Rename GraphicsLayerPaintFlags::Snapshotting to AllowAsyncImageDecoding.
2111         -- Replace every reference to GraphicsLayerPaintFlags::Snapshotting by
2112            GraphicsLayerPaintFlags::None and every GraphicsLayerPaintFlags::None
2113            by AllowAsyncImageDecoding.
2114         -- Rename PaintBehaviorSnapshotting to PaintBehaviorAllowAsyncImageDecoding.
2115         -- Propagate PaintBehaviorAllowAsyncImageDecoding from a parent view to 
2116            a child view instead of propagating PaintBehaviorSnapshotting.
2117         -- Remove setting the bit PaintBehaviorSnapshotting in any new PaintBehavoir.
2118         -- Replace setting the bit PaintBehaviorSnapshotting in an existing PaintBehavoir
2119            by resetting the bit PaintBehaviorAllowAsyncImageDecoding.
2120
2121         * html/shadow/MediaControlElements.cpp:
2122         (WebCore::MediaControlTextTrackContainerElement::createTextTrackRepresentationImage):
2123         * page/FrameView.cpp:
2124         (WebCore::FrameView::willPaintContents):
2125         (WebCore::FrameView::paintContentsForSnapshot):
2126         * platform/graphics/GraphicsLayer.h:
2127         * platform/graphics/GraphicsLayerClient.h:
2128         * platform/graphics/mac/WebLayer.mm:
2129         (-[WebLayer drawInContext:]):
2130         (-[WebSimpleLayer drawInContext:]):
2131         * rendering/PaintPhase.h:
2132         * rendering/RenderBoxModelObject.cpp:
2133         (WebCore::RenderBoxModelObject::decodingModeForImageDraw):
2134         (WebCore::RenderBoxModelObject::paintFillLayerExtended):
2135         * rendering/RenderBoxModelObject.h:
2136         * rendering/RenderImage.cpp:
2137         (WebCore::RenderImage::paintIntoRect):
2138         * rendering/RenderLayer.cpp:
2139         (WebCore::RenderLayer::paintLayerContents):
2140         (WebCore::RenderLayer::paintForegroundForFragments):
2141         * rendering/RenderLayerBacking.cpp:
2142         (WebCore::RenderLayerBacking::paintContents):
2143         * rendering/RenderWidget.cpp:
2144         (WebCore::RenderWidget::paintContents): We need to propagate the 
2145         PaintBehaviorAllowAsyncImageDecoding from RenderWidget to the FrameView.
2146         We did not need to do that for PaintBehaviorSnapshotting because 
2147         FrameView was setting it in its m_paintBehavior if (document->printing())
2148         in FrameView::willPaintContents().
2149
2150 2017-07-12  Timothy Hatcher  <timothy@hatcher.name>
2151
2152         REGRESSION(r219391): Broke the USE(OPENGL_ES_2) build
2153         https://bugs.webkit.org/show_bug.cgi?id=174442
2154
2155         Unreviewed build fix.
2156
2157         * platform/graphics/egl/GLContextEGL.cpp: Fix typo of OPENGL_ES2.
2158
2159 2017-07-12  Youenn Fablet  <youenn@apple.com>
2160
2161         Recreate the AudioUnit when restarting capture
2162         https://bugs.webkit.org/show_bug.cgi?id=174439
2163
2164         Reviewed by Jer Noble.
2165
2166         Sometimes other applications in the system like FaceTime may make the audio unit not functional.
2167         Reloading the tab capturing audio will trigger a call to stop the audio shared unit.
2168         When the tab requests again audio, the shared unit will restart.
2169         At that time, the AudioUnit shared unit will be fully recreated.
2170
2171         Manually tested by doing a webrtc call and then doing a FaceTime call.
2172         Remote WebRTC endpoints may not receive any audio.
2173         With the patch, reloading the web page will get back the audio.
2174         Previously, restarting the UIProcess was the only way.
2175
2176         * platform/mediastream/mac/CoreAudioCaptureSource.cpp:
2177         (WebCore::CoreAudioSharedUnit::startProducingData): Cleaning the audio unit when starting to produce data if there is a preexisting audio unit.
2178
2179 2017-07-12  Youenn Fablet  <youenn@apple.com>
2180
2181         Accessing localDescription, remoteDescription, etc. after setTimeout raises EXC_BAD_ACCESS
2182         https://bugs.webkit.org/show_bug.cgi?id=174323
2183         <rdar://problem/33267876>
2184
2185         Reviewed by Eric Carlson.
2186
2187         Test: webrtc/calling-peerconnection-once-closed.html
2188
2189         In case the libwebrtc backend is null, we should not use it to get description from it.
2190         Return null in that case.
2191
2192         Adding ASSERT to other calls where the layer above LibWebRTCMediaEndpoint should protect
2193         from calling a function on a null libwebrtc backend.
2194
2195         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
2196         (WebCore::LibWebRTCMediaEndpoint::currentLocalDescription):
2197         (WebCore::LibWebRTCMediaEndpoint::currentRemoteDescription):
2198         (WebCore::LibWebRTCMediaEndpoint::pendingLocalDescription):
2199         (WebCore::LibWebRTCMediaEndpoint::pendingRemoteDescription):
2200         (WebCore::LibWebRTCMediaEndpoint::localDescription):
2201         (WebCore::LibWebRTCMediaEndpoint::remoteDescription):
2202         (WebCore::LibWebRTCMediaEndpoint::doSetLocalDescription):
2203         (WebCore::LibWebRTCMediaEndpoint::doSetRemoteDescription):
2204         (WebCore::LibWebRTCMediaEndpoint::addTrack):
2205         (WebCore::LibWebRTCMediaEndpoint::removeTrack):
2206         (WebCore::LibWebRTCMediaEndpoint::doCreateOffer):
2207         (WebCore::LibWebRTCMediaEndpoint::doCreateAnswer):
2208         (WebCore::LibWebRTCMediaEndpoint::createDataChannel):
2209
2210 2017-07-12  Commit Queue  <commit-queue@webkit.org>
2211
2212         Unreviewed, rolling out r219176.
2213         https://bugs.webkit.org/show_bug.cgi?id=174436
2214
2215         "Can cause infinite recursion on iOS" (Requested by mlam on
2216         #webkit).
2217
2218         Reverted changeset:
2219
2220         "WTF::Thread should have the threads stack bounds."
2221         https://bugs.webkit.org/show_bug.cgi?id=173975
2222         http://trac.webkit.org/changeset/219176
2223
2224 2017-07-12  Nan Wang  <n_wang@apple.com>
2225
2226         AX: [iOS] Implement a way to retrieve a text marker range with desired text that is closest to a position
2227         https://bugs.webkit.org/show_bug.cgi?id=174393
2228         <rdar://problem/33248006>
2229
2230         Reviewed by Chris Fleizach.
2231
2232         Used the existing findClosestPlainText function to search the range on iOS.
2233         Also exposed a function on the iOS wrapper to return the selection rects of
2234         the result range from the searching. 
2235
2236         Test: accessibility/ios-simulator/text-marker-range-matches-text.html
2237
2238         * accessibility/AXObjectCache.cpp:
2239         (WebCore::visiblePositionForPositionWithOffset):
2240         (WebCore::AXObjectCache::rangeMatchesTextNearRange):
2241         * accessibility/AXObjectCache.h:
2242         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
2243         (-[WebAccessibilityObjectWrapper rangeFromMarkers:withText:]):
2244         (-[WebAccessibilityObjectWrapper textMarkerRangeFromMarkers:withText:]):
2245         (-[WebAccessibilityObjectWrapper textRectsFromMarkers:withText:]):
2246         (-[WebAccessibilityObjectWrapper rectsForSelectionRects:]):
2247
2248 2017-07-12  Matt Lewis  <jlewis3@apple.com>
2249
2250         Unreviewed, rolling out r219409.
2251
2252         The revision caused the Windows builds to fail.
2253
2254         Reverted changeset:
2255
2256         "AX: [iOS] Implement a way to retrieve a text marker range
2257         with desired text that is closest to a position"
2258         https://bugs.webkit.org/show_bug.cgi?id=174393
2259         http://trac.webkit.org/changeset/219409
2260
2261 2017-07-12  Alicia Boya García  <aboya@igalia.com>
2262
2263         [FreeType] Enable BCI on webfonts
2264         https://bugs.webkit.org/show_bug.cgi?id=174403
2265
2266         Reviewed by Michael Catanzaro.
2267
2268         The FreeType BCI hinter used to be disabled on webfonts in favor of
2269         the autohinter.
2270
2271         FreeType BCI hinter has improved considerably in the past and now most
2272         other browsers enable it too. Given the old reasons no longer apply,
2273         the BCI has now been enabled in order to get better text rendering when
2274         embedded hints are available.
2275
2276         * platform/graphics/freetype/FontCustomPlatformDataFreeType.cpp:
2277         (WebCore::FontCustomPlatformData::FontCustomPlatformData):
2278
2279 2017-07-12  Commit Queue  <commit-queue@webkit.org>
2280
2281         Unreviewed, rolling out r219361.
2282         https://bugs.webkit.org/show_bug.cgi?id=174434
2283
2284         Huge PLUM memory regression on iOS (Requested by kling on
2285         #webkit).
2286
2287         Reverted changeset:
2288
2289         "[WebIDL] Convert MutationCallback to be a normal generate
2290         callback"
2291         https://bugs.webkit.org/show_bug.cgi?id=174140
2292         http://trac.webkit.org/changeset/219361
2293
2294 2017-07-12  Eric Carlson  <eric.carlson@apple.com>
2295
2296         [MediaStream] a capture source failure should end the MediaStreamTrack
2297         https://bugs.webkit.org/show_bug.cgi?id=174375
2298
2299         Reviewed by Youenn Fablet.
2300
2301         Test: fast/mediastream/media-stream-track-source-failure.html
2302
2303         * platform/mediastream/RealtimeMediaSource.cpp:
2304         (WebCore::RealtimeMediaSource::captureFailed): New, signal observers that the source has ended.
2305         * platform/mediastream/RealtimeMediaSource.h:
2306
2307         * platform/mediastream/mac/AVMediaCaptureSource.h:
2308         * platform/mediastream/mac/AVMediaCaptureSource.mm:
2309         (WebCore::AVMediaCaptureSource::setupSession): Call captureFailed if setupCaptureSession fails.
2310
2311         * platform/mediastream/mac/AVVideoCaptureSource.h:
2312         * platform/mediastream/mac/AVVideoCaptureSource.mm:
2313         (WebCore::AVVideoCaptureSource::setupCaptureSession): Return false on failure.
2314         (WebCore::AVVideoCaptureSource::shutdownCaptureSession): Delete unused instance variable.
2315         (WebCore::AVVideoCaptureSource::processNewFrame): Ditto.
2316
2317         * testing/Internals.cpp:
2318         (WebCore::Internals::endMediaStreamTrackCaptureSource): Call track.source.captureFailed().
2319         * testing/Internals.h:
2320         * testing/Internals.idl:
2321
2322 2017-07-12  Timothy Hatcher  <timothy@hatcher.name>
2323
2324         Improve font matching with FontConfig and FreeType
2325         https://bugs.webkit.org/show_bug.cgi?id=174374
2326
2327         Reviewed by Michael Catanzaro.
2328
2329         * platform/graphics/freetype/FontCacheFreeType.cpp:
2330         (WebCore::FontCache::createFontPlatformData): Loop through all family name matches from FcFontMatch.
2331
2332 2017-07-12  Youenn Fablet  <youenn@apple.com>
2333
2334         Reactivate audio ducking when restarting the shared unit
2335         https://bugs.webkit.org/show_bug.cgi?id=174428
2336
2337         Reviewed by Eric Carlson.
2338
2339         Currently, when another application ducks WebKit, there is no other way than to quit the UIProcess and restart it.
2340         By again audio ducking when starting the audio unit, reloading the page will be enough.
2341         Testing by launching a tab with audio capture and audio playing.
2342         Then make a FaceTime call and hear the tab volume go down.
2343         End the call to FaceTime and the tab volume remains low.
2344         Reload the tab and the volume has a normal level.
2345
2346         * platform/mediastream/mac/CoreAudioCaptureSource.cpp:
2347         (WebCore::CoreAudioSharedUnit::setupAudioUnit):
2348         (WebCore::CoreAudioSharedUnit::startInternal):
2349
2350 2017-07-12  Antoine Quint  <graouts@apple.com>
2351
2352         Playback controls should not hide while AirPlay is active
2353         https://bugs.webkit.org/show_bug.cgi?id=174422
2354         <rdar://problem/33011477>
2355
2356         Reviewed by Eric Carlson.
2357
2358         We now also track changes in AirPlay playback status and account for it when identifying whether we
2359         ought to let media controls automatically hide, which should only happen if the media is playing and
2360         not playing back through AirPlay.
2361
2362         * Modules/modern-media-controls/media/controls-visibility-support.js:
2363         (ControlsVisibilitySupport.prototype.get mediaEvents):
2364         (ControlsVisibilitySupport.prototype._updateControls):
2365         (ControlsVisibilitySupport):
2366
2367 2017-07-12  Daniel Bates  <dabates@apple.com>
2368
2369         Attempt to fix the build following <https://trac.webkit.org/changeset/219407>
2370         (https://bugs.webkit.org/show_bug.cgi?id=174386)
2371
2372         Fix bad merge after <https://trac.webkit.org/changeset/219404>.
2373
2374         * loader/FrameLoader.cpp:
2375         (WebCore::FrameLoader::loadURL):
2376         (WebCore::FrameLoader::loadWithNavigationAction):
2377         (WebCore::FrameLoader::loadPostRequest):
2378         (WebCore::FrameLoader::continueLoadAfterNewWindowPolicy):
2379         (WebCore::FrameLoader::loadDifferentDocumentItem):
2380         * loader/FrameLoader.h:
2381
2382 2017-07-12  Nan Wang  <n_wang@apple.com>
2383
2384         AX: [iOS] Implement a way to retrieve a text marker range with desired text that is closest to a position
2385         https://bugs.webkit.org/show_bug.cgi?id=174393
2386         <rdar://problem/33248006>
2387
2388         Reviewed by Chris Fleizach.
2389
2390         Used the existing findClosestPlainText function to search the range on iOS.
2391         Also exposed a function on the iOS wrapper to return the selection rects of
2392         the result range from the searching. 
2393
2394         Test: accessibility/ios-simulator/text-marker-range-matches-text.html
2395
2396         * accessibility/AXObjectCache.cpp:
2397         (WebCore::visiblePositionForPositionWithOffset):
2398         (WebCore::AXObjectCache::rangeMatchesTextNearRange):
2399         * accessibility/AXObjectCache.h:
2400         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
2401         (-[WebAccessibilityObjectWrapper rangeFromMarkers:withText:]):
2402         (-[WebAccessibilityObjectWrapper textMarkerRangeFromMarkers:withText:]):
2403         (-[WebAccessibilityObjectWrapper textRectsFromMarkers:withText:]):
2404         (-[WebAccessibilityObjectWrapper rectsForSelectionRects:]):
2405
2406 2017-07-12  Daniel Bates  <dabates@apple.com>
2407
2408         NavigationAction should track whether the navigation was initiated by the main frame
2409         https://bugs.webkit.org/show_bug.cgi?id=174386
2410         <rdar://problem/33245267>
2411
2412         Reviewed by Brady Eidson.
2413
2414         Although we added state to NavigationAction to track whether the navigation was
2415         initiated by the main frame in r219170 it is not possible to initialize this state
2416         when instantiating a NavigationAction. Having NavigationAction track this state
2417         will be useful to ensure that we can always compute the source frame information
2418         when asking the embedding client whether to allow a navigation. We will make use
2419         of it in the fix for <https://bugs.webkit.org/show_bug.cgi?id=174385>.
2420
2421         No behavior changed. So, no new tests.
2422
2423         * loader/FrameLoader.cpp:
2424         (WebCore::FrameLoader::loadURL): Pass whether the load was initiated by the main frame
2425         when instantiating the NavigationAction.
2426         (WebCore::FrameLoader::load): For now, pass InitiatedByMainFrame::Unknown when instantiating
2427         the NavigationAction as we do not know if the load was initiated by the main frame.
2428         (WebCore::FrameLoader::loadWithDocumentLoader): Ditto.
2429         (WebCore::FrameLoader::reload): Ditto
2430         (WebCore::FrameLoader::loadDifferentDocumentItem): Ditto.
2431         (WebCore::createWindow): Pass whether the load was initiated by the main frame when
2432         instantiating the NavigationAction.
2433         * loader/NavigationAction.cpp:
2434         (WebCore::NavigationAction::NavigationAction): Modified to take argument of type InitiatedByMainFrame
2435         that indicates whether the navigation was initiated by the main frame.
2436         * loader/NavigationAction.h:
2437         * loader/PolicyChecker.cpp:
2438         (WebCore::PolicyChecker::checkNavigationPolicy): For now, pass InitiatedByMainFrame::Unknown
2439         when instantiating the NavigationAction as we do not know if the load was initiated by the
2440         main frame.
2441         * page/ContextMenuController.cpp:
2442         (WebCore::openNewWindow): Pass whether the load was initiated by the main frame when
2443         instantiating the NavigationAction.
2444
2445 2017-07-12  Daniel Bates  <dabates@apple.com>
2446
2447         Rename NavigationInitiatedByMainFrame to InitiatedByMainFrame
2448         https://bugs.webkit.org/show_bug.cgi?id=174427
2449
2450         Rubber-stamped by Brady Eidson.
2451
2452         * inspector/InspectorFrontendClientLocal.cpp:
2453         (WebCore::InspectorFrontendClientLocal::openInNewTab):
2454         * inspector/InspectorPageAgent.cpp:
2455         (WebCore::InspectorPageAgent::navigate):
2456         * loader/FrameLoadRequest.cpp:
2457         (WebCore::FrameLoadRequest::FrameLoadRequest):
2458         * loader/FrameLoadRequest.h:
2459         (WebCore::FrameLoadRequest::FrameLoadRequest):
2460         (WebCore::FrameLoadRequest::initiatedByMainFrame):
2461         (WebCore::FrameLoadRequest::navigationInitiatedByMainFrame): Deleted.
2462         * loader/FrameLoader.cpp:
2463         (WebCore::FrameLoader::urlSelected):
2464         (WebCore::FrameLoader::loadURLIntoChildFrame):
2465         (WebCore::shouldOpenExternalURLsPolicyToApply):
2466         (WebCore::applyShouldOpenExternalURLsPolicyToNewDocumentLoader):
2467         (WebCore::FrameLoader::loadURL):
2468         (WebCore::FrameLoader::loadWithNavigationAction):
2469         (WebCore::FrameLoader::reloadWithOverrideEncoding):
2470         (WebCore::FrameLoader::reload):
2471         (WebCore::FrameLoader::loadPostRequest):
2472         (WebCore::FrameLoader::continueLoadAfterNewWindowPolicy):
2473         (WebCore::FrameLoader::loadDifferentDocumentItem):
2474         * loader/FrameLoader.h:
2475         * loader/FrameLoaderTypes.h:
2476         * loader/NavigationAction.h:
2477         (WebCore::NavigationAction::initiatedByMainFrame):
2478         (WebCore::NavigationAction::navigationInitiatedByMainFrame): Deleted.
2479         * loader/NavigationScheduler.cpp:
2480         (WebCore::ScheduledNavigation::ScheduledNavigation):
2481         (WebCore::ScheduledNavigation::initiatedByMainFrame):
2482         (WebCore::NavigationScheduler::scheduleLocationChange):
2483         (WebCore::ScheduledNavigation::navigationInitiatedByMainFrame): Deleted.
2484         * page/ContextMenuController.cpp:
2485         (WebCore::openNewWindow):
2486         (WebCore::ContextMenuController::contextMenuItemSelected):
2487         * page/DOMWindow.cpp:
2488         (WebCore::DOMWindow::createWindow):
2489
2490 2017-07-12  Matt Lewis  <jlewis3@apple.com>
2491
2492         Unreviewed, rolling out r219401.
2493
2494         This revision rolled out the previous patch, but after talking
2495         with reviewer, a rebaseline is what was needed.Rolling back in
2496         before rebaseline.
2497
2498         Reverted changeset:
2499
2500         "Unreviewed, rolling out r219379."
2501         https://bugs.webkit.org/show_bug.cgi?id=174400
2502         http://trac.webkit.org/changeset/219401
2503
2504 2017-07-12  Matt Lewis  <jlewis3@apple.com>
2505
2506         Unreviewed, rolling out r219379.
2507
2508         This revision caused a consistent failure in the test
2509         fast/dom/Window/property-access-on-cached-window-after-frame-
2510         removed.html.
2511
2512         Reverted changeset:
2513
2514         "Remove NAVIGATOR_HWCONCURRENCY"
2515         https://bugs.webkit.org/show_bug.cgi?id=174400
2516         http://trac.webkit.org/changeset/219379
2517
2518 2017-07-12  Zalan Bujtas  <zalan@apple.com>
2519
2520         Paginated mode: Infinite recursion in RenderTable::layout
2521         https://bugs.webkit.org/show_bug.cgi?id=174413
2522
2523         Reviewed by Simon Fraser.
2524
2525         This patch is a workaround for avoiding infinite recursion when the table layout does not stabilize.
2526         Apparently we leak some context (computed padding in this case) from the current to the subsequent layout.
2527         The subsequent layouts always end up producing different line heights for some of the cells in the <thead>.
2528         In paginated mode, when the section moves (<thead>, <tbody> etc) we call layout again recursively.
2529         This could lead to infinite recursion for unstable table layout.
2530
2531         Unable to come up with a reduction yet.
2532
2533         * rendering/RenderTable.cpp:
2534         (WebCore::RenderTable::layout):
2535         * rendering/RenderTable.h:
2536
2537 2017-07-12  Youenn Fablet  <youenn@apple.com>
2538
2539         WebRTC: Incorrect sdpMLineIndex for video breaks Firefox interop
2540         https://bugs.webkit.org/show_bug.cgi?id=173530
2541
2542         Reviewed by Alex Christensen.
2543
2544         Test: webrtc/ice-candidate-sdpMLineIndex.html
2545
2546         Reading missing parameter from libwebrtc backend and setting it when firing the RTCIceCandidate event.
2547
2548         * Modules/mediastream/PeerConnectionBackend.cpp:
2549         (WebCore::PeerConnectionBackend::disableICECandidateFiltering):
2550         (WebCore::PeerConnectionBackend::newICECandidate):
2551         * Modules/mediastream/PeerConnectionBackend.h:
2552         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
2553         (WebCore::LibWebRTCMediaEndpoint::OnIceCandidate):
2554
2555 2017-07-12  Zan Dobersek  <zdobersek@igalia.com>
2556
2557         [GCrypt] Implement CryptoKeyEC PKCS#8 exports
2558         https://bugs.webkit.org/show_bug.cgi?id=173648
2559
2560         Reviewed by Jiewen Tan.
2561
2562         Implement the PKCS#8 export operation for EC keys for platforms that use
2563         libgcrypt.
2564
2565         First, the `ECParameters` and the `ECPrivateKey` ASN.1 structures are created
2566         and filled out accordingly. For the former, the appropriate object identifier
2567         is written under the `namedCurve` element of the structure. For the latter, we
2568         write out '1' under `version`, and eliminate the optional `parameters` element.
2569         An libgcrypt EC context is then used to retrieve the private and public key
2570         MPIs that are then written out under the `privateKey` and `publicKey` elements,
2571         respectively.
2572
2573         After that, we can proceed to create and fill out the `PrivateKeyInfo` structure.
2574         0 is written out under the `version` element, and the id-ecPublicKey object
2575         identifier is written out under the `privateKeyAlgorithm.algorithm` element. This
2576         doesn't strictly follow the specification, since the id-ecDH identifier should be
2577         used for ECDH keys, but no test in WebKit or the web-platform-tests suite covers
2578         this, so this specific detail should be revisited later.
2579
2580         Data of the previously-constructed `ECParameters` structure is retrieved and
2581         written out under the `privateKeyAlgorithm.parameters` element. Similarly is done
2582         for the `ECPrivateKey` structure, writing out its data under the `privateKey`
2583         element. Finally, the optional `attributes` element of the `PrivateKeyInfo`
2584         structure is eliminated, and the encoded data of this structure is retrieved and
2585         returned.
2586
2587         No new tests -- relevant tests are now passing and are unskipped.
2588
2589         * crypto/gcrypt/CryptoKeyECGCrypt.cpp:
2590         (WebCore::CryptoKeyEC::platformExportPkcs8):
2591
2592 2017-07-12  Zan Dobersek  <zdobersek@igalia.com>
2593
2594         [WPE] Use libepoxy
2595         https://bugs.webkit.org/show_bug.cgi?id=172104
2596
2597         Reviewed by Michael Catanzaro.
2598
2599         No new tests -- no changes in behavior.
2600
2601         Implement the proper libepoxy header inclusion for ports that enable it.
2602
2603         The library acts as a loading facility working on top of the system-provided
2604         OpenGL and EGL libraries, with the headers providing a complete collection of
2605         specification-defined OpenGL and EGL types, constants and entrypoints.
2606
2607         Support is added through the USE(LIBEPOXY) build guard. Note that this guard
2608         isn't exclusive with USE(OPENGL), USE(OPENGL_ES_2) or USE(EGL), so the
2609         USE(LIBEPOXY) condition is tested before those.
2610
2611         In case of OpenGL headers, the <epoxy/gl.h> header is included, and in
2612         case of EGL headers, the <epoxy/egl.h> header. <epoxy/egl.h> includes
2613         <epoxy/gl.h> on its own, so in some cases the inclusion of the latter is
2614         omitted.
2615
2616         EpoxyShims.h header is added, doing a job similar to OpenGLESShims.h. The
2617         EXT-suffixed GL entrypoints are redefined to the non-suffixed versions.
2618         No suffixed constants are defined because those are defined by the libepoxy
2619         headers to the well-known values.
2620
2621         * CMakeLists.txt:
2622         * PlatformWPE.cmake:
2623         * platform/graphics/ANGLEWebKitBridge.h:
2624         * platform/graphics/EpoxyShims.h: Added.
2625         * platform/graphics/GLContext.cpp:
2626         (WebCore::initializeOpenGLShimsIfNeeded):
2627         * platform/graphics/GraphicsContext3DPrivate.cpp:
2628         * platform/graphics/PlatformDisplay.cpp:
2629         * platform/graphics/cairo/CairoUtilities.cpp:
2630         * platform/graphics/cairo/GraphicsContext3DCairo.cpp:
2631         (WebCore::GraphicsContext3D::create):
2632         * platform/graphics/cairo/ImageBufferCairo.cpp:
2633         * platform/graphics/egl/GLContextEGL.cpp:
2634         * platform/graphics/egl/GLContextEGLWPE.cpp:
2635         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
2636         * platform/graphics/opengl/Extensions3DOpenGLCommon.cpp:
2637         * platform/graphics/opengl/Extensions3DOpenGLES.cpp:
2638         * platform/graphics/opengl/Extensions3DOpenGLES.h:
2639         * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
2640         * platform/graphics/opengl/TemporaryOpenGLSetting.cpp:
2641         * platform/graphics/texmap/TextureMapperGC3DPlatformLayer.cpp:
2642         * platform/graphics/wpe/PlatformDisplayWPE.cpp:
2643
2644 2017-07-12  Carlos Garcia Campos  <cgarcia@igalia.com>
2645
2646         ImageDecoder: Gifs with infinite animation only play once very often
2647         https://bugs.webkit.org/show_bug.cgi?id=173403
2648
2649         Reviewed by Michael Catanzaro.
2650
2651         It doesn't always happen, it's easier to reproduce when loading big files from the network, but it also depends
2652         on every file. The problem is that ImageFrameCache is caching the repetition count value always when the size is
2653         already available. In the case of gif files, the loop count value can be at any point of the image stream, so
2654         having the size available doesn't mean we also have the loop count. So, if the value is queried before it's
2655         available, the default value is cached (repeat once) and then always used. We should clear the cached value when
2656         new data is added to the decoder, like we do with other cached values that can change when more data is decoded.
2657
2658         * platform/graphics/ImageFrameCache.cpp:
2659         (WebCore::ImageFrameCache::clearMetadata): Clear m_repetitionCount.
2660
2661 2017-07-12  Adrian Perez de Castro  <aperez@igalia.com>
2662
2663         [SOUP] Do not use C linkage for functions using C++ features
2664         https://bugs.webkit.org/show_bug.cgi?id=174392
2665
2666         Reviewed by Michael Catanzaro.
2667
2668         No new tests because there is no behavior change.
2669
2670         * platform/network/soup/WebKitSoupRequestGeneric.h: Move G_END_DECLS
2671         to leave functions which use C++ features outside of the block it
2672         delimits.
2673
2674 2017-07-12  Carlos Garcia Campos  <cgarcia@igalia.com>
2675
2676         [GTK] Crashes in WebCore::PasteboardHelper::fillSelectionData when source file of drag is unavailable
2677         https://bugs.webkit.org/show_bug.cgi?id=174161
2678
2679         Reviewed by Michael Catanzaro.
2680
2681         It seems selection data could contain an empty string, in which case gtk_selection_data_get_data() returns a
2682         valid pointer, but gtk_selection_data_get_length() returns 0. When this happens we end up trying to split an
2683         empty string resulting in an empty vector, but we unconditionally access the first element of the vector.
2684
2685         * platform/gtk/PasteboardHelper.cpp:
2686         (WebCore::selectionDataToUTF8String): Return a null string in case selection data length is 0.
2687         (WebCore::PasteboardHelper::fillSelectionData): Return early if selection data length is 0, instead of checking
2688         the selection data pointer.
2689
2690 2017-07-11  Carlos Garcia Campos  <cgarcia@igalia.com>
2691
2692         [GTK][WPE] Enable FILE_LOCK and implement lockFile and unlockFile
2693         https://bugs.webkit.org/show_bug.cgi?id=174357
2694
2695         Reviewed by Michael Catanzaro.
2696
2697         Implement lockFile and unlockFile using flock().
2698
2699         * PlatformWPE.cmake:
2700         * platform/glib/FileSystemGlib.cpp:
2701         (WebCore::lockFile):
2702         (WebCore::unlockFile):
2703
2704 2017-07-11  Yusuke Suzuki  <utatane.tea@gmail.com>
2705
2706         Use FastAllocator in STL containers
2707         https://bugs.webkit.org/show_bug.cgi?id=174366
2708
2709         Rubber stamped by Sam Weinig.
2710
2711         This patch uses FastAllocator for STL containers including std::set and std::map.
2712         STL can take a template parameter to be used as allocator for containers.
2713         We prepare FastAllocator, which uses fastMalloc for allocation.
2714         This allows us to use bmalloc (if supported) for STL containers which offers
2715         functionalities that is not supported in WTF containers.
2716
2717         * Modules/indexeddb/IDBKeyData.h:
2718         * Modules/indexeddb/server/IndexValueEntry.cpp:
2719         (WebCore::IDBServer::IndexValueEntry::IndexValueEntry):
2720         (WebCore::IDBServer::IndexValueEntry::Iterator::Iterator):
2721         (WebCore::IDBServer::IndexValueEntry::reverseFind):
2722         * Modules/indexeddb/server/IndexValueEntry.h:
2723         * Modules/indexeddb/server/IndexValueStore.cpp:
2724         (WebCore::IDBServer::IndexValueStore::lowestIteratorInRange):
2725         (WebCore::IDBServer::IndexValueStore::highestReverseIteratorInRange):
2726         (WebCore::IDBServer::IndexValueStore::Iterator::Iterator):
2727         * Modules/indexeddb/server/IndexValueStore.h:
2728         * Modules/indexeddb/server/MemoryBackingStoreTransaction.cpp:
2729         (WebCore::IDBServer::MemoryBackingStoreTransaction::objectStoreCleared):
2730         * Modules/indexeddb/server/MemoryBackingStoreTransaction.h:
2731         * Modules/indexeddb/server/MemoryObjectStore.cpp:
2732         (WebCore::IDBServer::MemoryObjectStore::replaceKeyValueStore):
2733         (WebCore::IDBServer::MemoryObjectStore::addRecord):
2734         (WebCore::IDBServer::MemoryObjectStore::updateCursorsForPutRecord):
2735         * Modules/indexeddb/server/MemoryObjectStore.h:
2736         (WebCore::IDBServer::MemoryObjectStore::orderedKeys):
2737         * Modules/indexeddb/server/MemoryObjectStoreCursor.cpp:
2738         (WebCore::IDBServer::MemoryObjectStoreCursor::keyAdded):
2739         (WebCore::IDBServer::MemoryObjectStoreCursor::setFirstInRemainingRange):
2740         (WebCore::IDBServer::MemoryObjectStoreCursor::setForwardIteratorFromRemainingRange):
2741         (WebCore::IDBServer::MemoryObjectStoreCursor::setReverseIteratorFromRemainingRange):
2742         (WebCore::IDBServer::MemoryObjectStoreCursor::incrementForwardIterator):
2743         (WebCore::IDBServer::MemoryObjectStoreCursor::incrementReverseIterator):
2744         * Modules/indexeddb/server/MemoryObjectStoreCursor.h:
2745         * Modules/mediasource/SampleMap.h:
2746         * page/WheelEventTestTrigger.cpp:
2747         (WebCore::WheelEventTestTrigger::deferTestsForReason):
2748         (WebCore::dumpState):
2749         * page/WheelEventTestTrigger.h:
2750         * platform/graphics/cv/VideoTextureCopierCV.cpp:
2751         (WebCore::enumToStringMap):
2752         * rendering/OrderIterator.h:
2753
2754 2017-07-11  Per Arne Vollan  <pvollan@apple.com>
2755
2756         [Win] Build error when building WebKit.dll from WebKit.proj project file.
2757         https://bugs.webkit.org/show_bug.cgi?id=174410
2758
2759         Reviewed by Brent Fulgham.
2760
2761         Copy required header files to forwarding headers folder.
2762
2763         * PlatformWin.cmake:
2764
2765 2017-07-11  Dean Jackson  <dino@apple.com>
2766
2767         Remove NAVIGATOR_HWCONCURRENCY
2768         https://bugs.webkit.org/show_bug.cgi?id=174400
2769
2770         Reviewed by Sam Weinig.
2771
2772         * Configurations/FeatureDefines.xcconfig:
2773         * WebCore.xcodeproj/project.pbxproj:
2774         * page/NavigatorBase.cpp:
2775         (WebCore::NavigatorBase::hardwareConcurrency): Deleted.
2776         * page/NavigatorBase.h:
2777         * page/NavigatorConcurrentHardware.idl: Removed.
2778
2779 2017-07-11  Youenn Fablet  <youenn@apple.com>
2780
2781         RealtimeOutgoingAudioSource should not push more audio data if the WebRTC thread is not able to process it
2782         https://bugs.webkit.org/show_bug.cgi?id=174383
2783
2784         Reviewed by Eric Carlson.
2785
2786         This patch adds support to check for pending-processing audio data.
2787         If the amount of audio data is bigger than a high water mark of 0.5 seconds,
2788         we stop pushing new audio data until buffered audio data is lower than a low water mark of 0.1 seconds.
2789         Patch is tested by adding breakpoints to trigger the high water mark, verifying that low water mark is triggered
2790         and receiving audio is fine on the other connection endpoint.
2791
2792         * platform/mediastream/mac/RealtimeOutgoingAudioSource.cpp:
2793         (WebCore::RealtimeOutgoingAudioSource::isReachingBufferedAudioDataHighLimit):
2794         (WebCore::RealtimeOutgoingAudioSource::isReachingBufferedAudioDataLowLimit):
2795         (WebCore::RealtimeOutgoingAudioSource::audioSamplesAvailable):
2796         * platform/mediastream/mac/RealtimeOutgoingAudioSource.h:
2797
2798 2017-07-11  Dean Jackson  <dino@apple.com>
2799
2800         Rolling out r219372.
2801
2802         * Configurations/FeatureDefines.xcconfig:
2803         * WebCore.xcodeproj/project.pbxproj:
2804         * page/NavigatorBase.cpp:
2805         (WebCore::NavigatorBase::hardwareConcurrency):
2806         * page/NavigatorBase.h:
2807         * page/NavigatorConcurrentHardware.idl: Added.
2808
2809 2017-07-11  Dean Jackson  <dino@apple.com>
2810
2811         Remove NAVIGATOR_HWCONCURRENCY
2812         https://bugs.webkit.org/show_bug.cgi?id=174400
2813
2814         Reviewed by Sam Weinig.
2815
2816         * Configurations/FeatureDefines.xcconfig:
2817         * WebCore.xcodeproj/project.pbxproj:
2818         * page/NavigatorBase.cpp:
2819         (WebCore::NavigatorBase::hardwareConcurrency): Deleted.
2820         * page/NavigatorBase.h:
2821         * page/NavigatorConcurrentHardware.idl: Removed.
2822
2823 2017-07-11  Jiewen Tan  <jiewen_tan@apple.com>
2824
2825         [WebCrypto] CryptoKeyECMac::Custom OpenSSL tag is actually tagged type [1]
2826         https://bugs.webkit.org/show_bug.cgi?id=174382
2827         <rdar://problem/33244871>
2828
2829         Reviewed by Brent Fulgham.
2830
2831         No change of behaviour.
2832
2833         * crypto/mac/CryptoKeyECMac.cpp:
2834         (WebCore::CryptoKeyEC::platformImportPkcs8):
2835         (WebCore::CryptoKeyEC::platformExportPkcs8):
2836         Replace CustomECParameters with TaggedType1 according to X.690(08/2015) section 8.14:
2837         https://www.itu.int/rec/T-REC-X.690-201508-I/en
2838         and RFC 5915 Appendix A:
2839         http://www.ietf.org/rfc/rfc5915.txt.
2840
2841 2017-07-11  Said Abou-Hallawa  <sabouhallawa@apple.com>
2842
2843         REGRESSION(r219045): The <body> element does not get repainted when its background image finishes decoding
2844         https://bugs.webkit.org/show_bug.cgi?id=174376
2845
2846         Reviewed by Simon Fraser.
2847
2848         When adding a CachedImageClient to CachedImage::m_pendingImageDrawingClients
2849         and the CachedImageClient is not one of the CachedImage::m_clients, we
2850         should cancel the repaint optimization in CachedImage::imageFrameAvailable().
2851         This can be done by adding all the CachedImage::m_clients to CachedImage::
2852         m_pendingImageDrawingClients.
2853
2854         Test: fast/images/async-image-body-background-image.html
2855
2856         * loader/cache/CachedImage.cpp:
2857         (WebCore::CachedImage::addPendingImageDrawingClient):
2858
2859 2017-07-11  Chris Dumez  <cdumez@apple.com>
2860
2861         Unreviewed, fix Windows build after r219355.
2862
2863         * bindings/js/JSDOMWindowCustom.cpp:
2864         (WebCore::addCrossOriginWindowPropertyNames):
2865         (WebCore::addCrossOriginWindowOwnPropertyNames):
2866         (WebCore::JSDOMWindow::getOwnPropertyNames):
2867         (WebCore::addCrossOriginPropertyNames): Deleted.
2868         (WebCore::addCrossOriginOwnPropertyNames): Deleted.
2869         * bindings/js/JSLocationCustom.cpp:
2870         (WebCore::addCrossOriginLocationPropertyNames):
2871         (WebCore::addCrossOriginLocationOwnPropertyNames):
2872         (WebCore::JSLocation::getOwnPropertyNames):
2873         (WebCore::addCrossOriginPropertyNames): Deleted.
2874         (WebCore::addCrossOriginOwnPropertyNames): Deleted.
2875
2876 2017-07-10  Sam Weinig  <sam@webkit.org>
2877
2878         [WebIDL] Convert MutationCallback to be a normal generate callback
2879         https://bugs.webkit.org/show_bug.cgi?id=174140
2880
2881         Reviewed by Chris Dumez.
2882
2883         To make this work more nicely, I:
2884         - Added the ability to for non-nullable interfaces in sequences to be passed
2885           via a Ref<> rather than a RefPtr<> as a parameter to a callback function.
2886           (e.g. callback MyCallback = void (sequence<Foo> foos) will now have the 
2887           signature, CallbackResult<void> handleEvent(const Vector<Ref<Foo>>&) rather
2888           than CallbackResult<void> handleEvent(const Vector<RefPtr<Foo>>&).
2889         - Added a new extended attribute for callback functions called [CallbackNeedsCanInvoke]
2890           that adds a virtual function called canInvoke() to the generated callback.
2891           All it does is forward to ActiveDOMCallback's canInvokeCallback, but it
2892           allows the implementation to get to it. We may one day want to move the 
2893           inheritance of ActiveDOMCallback from the generated source to the base class.
2894         - Added a new extended attribute for callback functions called [CallbackThisObject=Type]
2895           which allows you to specify that the callback needs a this object in addition
2896           to its arguments. When specified, the first argument of the C++ implementation
2897           function will now correspond to the this object, with the remaining arguments
2898           shifted over one.
2899
2900         * DerivedSources.make:
2901         Add MutationCallback.
2902
2903         * WebCore.xcodeproj/project.pbxproj:
2904         Remove non-generated JSMutationCallback.cpp, and add generated JSMutationCallback.cpp.
2905
2906         * Modules/mediastream/MediaDevicesRequest.cpp:
2907         (WebCore::MediaDevicesRequest::filterDeviceList):
2908         (WebCore::MediaDevicesRequest::start):
2909         * Modules/mediastream/MediaDevicesRequest.h:
2910         Switch to using Ref.
2911
2912         * bindings/IDLTypes.h:
2913         Add InnerParameterType and NullableInnerParameterType type hooks
2914         and specialize wrappers to use Ref for InnerParameterType, and RefPtr
2915         for NullableInnerParameterType.
2916
2917         * bindings/js/JSCallbackData.cpp:
2918         * bindings/js/JSCallbackData.h:
2919         Add support for passing a this object.
2920
2921         * bindings/js/JSMutationCallback.cpp: Removed.
2922         * bindings/js/JSMutationCallback.h: Removed.
2923         Remove custom callback code.
2924
2925         * bindings/js/JSMutationObserverCustom.cpp:
2926         (WebCore::constructJSMutationObserver): Deleted.
2927         Remove no longer needed custom constructor.
2928
2929         * bindings/scripts/CodeGenerator.pm:
2930         (ParseType):
2931         Add helper to parse a type and cache the result.
2932
2933         * bindings/scripts/CodeGeneratorJS.pm:
2934         (GenerateCallbackHeaderContent):
2935         (GenerateCallbackImplementationContent):
2936         Add support for [CallbackNeedsCanInvoke] and [CallbackThisObject]. When [CallbackThisObject]
2937         is not specified, use jsUndefined() as the this object as specified by WebIDL.
2938
2939         * bindings/scripts/IDLAttributes.json:
2940         Add [CallbackNeedsCanInvoke] and [CallbackThisObject].
2941
2942         * bindings/scripts/IDLParser.pm:
2943         (ParseType):
2944         Add entry point to parse a single type.
2945
2946         * css/FontFaceSet.h:
2947         Switch to using Ref.
2948
2949         * dom/MutationCallback.h:
2950         Update signatures.
2951
2952         * dom/MutationCallback.idl: Added.
2953     
2954         * dom/MutationObserver.cpp:
2955         (WebCore::MutationObserver::canDeliver):
2956         (WebCore::MutationObserver::deliver):
2957         Switch to new signatures.
2958
2959         * dom/MutationObserver.idl:
2960         Remove CustomConstructor.
2961
2962         * page/IntersectionObserverCallback.h:
2963         Switch to using Ref.
2964
2965         * bindings/scripts/test/JS/JSTestCallbackFunction.cpp:
2966         * bindings/scripts/test/JS/JSTestCallbackFunctionRethrow.cpp:
2967         * bindings/scripts/test/JS/JSTestCallbackFunctionWithThisObject.cpp: Added.
2968         * bindings/scripts/test/JS/JSTestCallbackFunctionWithThisObject.h: Added.
2969         * bindings/scripts/test/JS/JSTestCallbackFunctionWithTypedefs.cpp:
2970         * bindings/scripts/test/JS/JSTestCallbackInterface.cpp:
2971         * bindings/scripts/test/JS/JSTestCallbackInterface.h:
2972         * bindings/scripts/test/JS/JSTestVoidCallbackFunction.cpp:
2973         Add / update bindings tests.
2974
2975 2017-07-11  Said Abou-Hallawa  <sabouhallawa@apple.com>
2976
2977         RenderImage should not add itself as a RelevantRepaintedObject if its image frame is being decoded
2978         https://bugs.webkit.org/show_bug.cgi?id=174336
2979
2980         Reviewed by Simon Fraser.
2981
2982         Since nothing will be drawn till the image frame finishes decoding we should
2983         treat returning ImageDrawResult::DidRequestDecoding from BitmapImage::draw
2984         the same as we do when the image is still loading.
2985
2986         * rendering/RenderImage.cpp:
2987         (WebCore::RenderImage::paintReplaced):
2988         (WebCore::RenderImage::paintIntoRect):
2989         * rendering/RenderImage.h:
2990
2991 2017-07-11  Youenn Fablet  <youenn@apple.com>
2992
2993         [WebRTC] Hanging under LibWebRTCMediaEndpoint::getStats
2994         https://bugs.webkit.org/show_bug.cgi?id=174377
2995
2996         Reviewed by Eric Carlson.
2997
2998         No change of behavior.
2999         Moving calls to libwebrtc getStats in the signalling thread since doing it in the main thread
3000         would block the main thread until the signalling thread is ready to handle getStats.
3001         Reducing stat logging since this may be too much for some devices.
3002
3003         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
3004         (WebCore::LibWebRTCMediaEndpoint::getStats):
3005         (WebCore::LibWebRTCMediaEndpoint::gatherStatsForLogging):
3006         (WebCore::LibWebRTCMediaEndpoint::OnStatsDelivered):
3007         (WebCore::LibWebRTCMediaEndpoint::startLoggingStats):
3008
3009 2017-07-11  Michael Catanzaro  <mcatanzaro@igalia.com>
3010
3011         Remove unused OpenGL files
3012         https://bugs.webkit.org/show_bug.cgi?id=174371
3013
3014         Reviewed by Timothy Hatcher.
3015
3016         * platform/graphics/opengl/GLPlatformContext.cpp: Removed.
3017         * platform/graphics/opengl/GLPlatformContext.h: Removed.
3018         * platform/graphics/opengl/GLPlatformSurface.h: Removed.
3019
3020 2017-07-11  Chris Dumez  <cdumez@apple.com>
3021
3022         Window's [[OwnPropertyKeys]] is wrong for cross origin windows
3023         https://bugs.webkit.org/show_bug.cgi?id=174364
3024         <rdar://problem/33238056>
3025
3026         Reviewed by Brent Fulgham.
3027
3028         Window's [[OwnPropertyKeys]] should not list descendant frame names
3029         when the window is cross-origin:
3030         - https://github.com/whatwg/html/pull/2777
3031
3032         This aligns our behavior with Firefox and Chrome.
3033
3034         No new tests, updated existing test.
3035
3036         * bindings/js/JSDOMWindowCustom.cpp:
3037         (WebCore::addCrossOriginPropertyNames):
3038         (WebCore::addCrossOriginOwnPropertyNames):
3039         (WebCore::JSDOMWindow::getOwnPropertyNames):
3040
3041 2017-07-11  Timothy Hatcher  <timothy@hatcher.name>
3042
3043         Fix broken build when ENABLE_VIDEO is disabled.
3044         https://bugs.webkit.org/show_bug.cgi?id=174368
3045
3046         Reviewed by Alex Christensen.
3047
3048         * dom/Document.cpp:
3049         * html/canvas/WebGLRenderingContextBase.cpp:
3050         (WebCore::WebGLRenderingContextBase::texSubImage2D):
3051         (WebCore::WebGLRenderingContextBase::texImage2D):
3052         * html/canvas/WebGLRenderingContextBase.h:
3053         * html/canvas/WebGLRenderingContextBase.idl:
3054         * testing/Internals.cpp:
3055         (WebCore::Internals::mediaResponseSources):
3056         (WebCore::Internals::mediaResponseContentRanges):
3057         * testing/Internals.h:
3058         * testing/Internals.idl:
3059
3060 2017-07-11  Ali Juma  <ajuma@chromium.org>
3061
3062         elementFromPoint() should consider x and y to be in client (layout viewport) coordinates
3063         https://bugs.webkit.org/show_bug.cgi?id=172019
3064
3065         Reviewed by Simon Fraser.
3066
3067         When visual viewports are enabled, this makes TreeScope::nodeFromPoint consider its
3068         input to be in client coordinates, and clips this input to the layout viewport. This change
3069         affects the behavior of document.elementFromPoint() and document.caretRangeFromPoint.
3070
3071         No new tests. Modified an existing test, and made a previously-failing test pass on ios.
3072
3073         * dom/TreeScope.cpp:
3074         (WebCore::TreeScope::nodeFromPoint):
3075         * page/FrameView.cpp:
3076         (WebCore::FrameView::layoutViewportToAbsoluteRect):
3077         (WebCore::FrameView::layoutViewportToAbsolutePoint):
3078         (WebCore::FrameView::clientToLayoutViewportPoint):
3079         * page/FrameView.h:
3080         * rendering/RenderLayer.cpp:
3081         (WebCore::RenderLayer::hitTest):
3082
3083 2017-07-11  Timothy Hatcher  <timothy@hatcher.name>
3084
3085         Broken build when !USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
3086         https://bugs.webkit.org/show_bug.cgi?id=174369
3087
3088         Reviewed by Alex Christensen.
3089
3090         * dom/ScriptedAnimationController.h: Include PlatformScreen.h.
3091
3092 2017-07-11  Wenson Hsieh  <wenson_hsieh@apple.com>
3093
3094         Address post-review feedback after http://trac.webkit.org/r219310
3095         https://bugs.webkit.org/show_bug.cgi?id=174300
3096         <rdar://problem/33030639>
3097
3098         Reviewed by Simon Fraser.
3099
3100         Removes pan-gesture-related plumbing introduced in r219310 that is no longer necessary.
3101
3102         * page/scrolling/ScrollingTree.h:
3103         (WebCore::ScrollingTree::scrollingTreeNodeWillStartPanGesture):
3104         (WebCore::ScrollingTree::scrollingTreeNodeDidEndPanGesture): Deleted.
3105
3106 2017-07-11  Alex Christensen  <achristensen@webkit.org>
3107
3108         Reduce URL size
3109         https://bugs.webkit.org/show_bug.cgi?id=174319
3110
3111         Reviewed by Andreas Kling.
3112
3113         m_fragmentEnd is redundant information. If a URL is valid, then it is always m_string.length().
3114         If a URL is not valid, then it is always 0. Rather than storing additional information,
3115         deduce the fragment end from the validity of the URL and the String's length.
3116
3117         No change in behavior.  This reduces sizeof(URL) from 56 to 48 and reduces operations when parsing.
3118
3119         * platform/URL.cpp:
3120         (WebCore::URL::invalidate):
3121         (WebCore::URL::fragmentIdentifier):
3122         (WebCore::URL::hasFragmentIdentifier):
3123         (WebCore::URL::removeFragmentIdentifier):
3124         * platform/URL.h:
3125         (WebCore::URL::encode):
3126         (WebCore::URL::decode):
3127         (WebCore::URL::hasFragment):
3128         * platform/URLParser.cpp:
3129         (WebCore::URLParser::urlLengthUntilPart):
3130         (WebCore::URLParser::copyURLPartsUntil):
3131         (WebCore::URLParser::parse):
3132         (WebCore::URLParser::allValuesEqual):
3133         (WebCore::URLParser::internalValuesConsistent):
3134
3135 2017-07-11  Alex Christensen  <achristensen@webkit.org>
3136
3137         SharedBuffer::size should return a size_t
3138         https://bugs.webkit.org/show_bug.cgi?id=174328
3139
3140         Reviewed by Andreas Kling.
3141
3142         No change in behaviour.
3143
3144         * html/FTPDirectoryDocument.cpp:
3145         (WebCore::createTemplateDocumentData):
3146         * loader/ContentFilter.cpp:
3147         (WebCore::ContentFilter::handleProvisionalLoadFailure):
3148         * loader/ResourceLoader.cpp:
3149         (WebCore::ResourceLoader::loadDataURL):
3150         * loader/ResourceLoader.h:
3151         * loader/appcache/ApplicationCacheStorage.cpp:
3152         (WebCore::ApplicationCacheStorage::store):
3153         * loader/cache/CachedScript.cpp:
3154         (WebCore::CachedScript::script):
3155         * platform/SharedBuffer.cpp:
3156         (WebCore::SharedBuffer::tryCreateArrayBuffer):
3157         * platform/SharedBuffer.h:
3158
3159 2017-07-11  Per Arne Vollan  <pvollan@apple.com>
3160
3161         [Win] Build error when building WebCore from WebCore.proj project file.
3162         https://bugs.webkit.org/show_bug.cgi?id=174330
3163
3164         Reviewed by Brent Fulgham.
3165
3166         The CMake variable PAL_DIR should be set in the project file.
3167
3168         * WebCore.vcxproj/WebCore.proj:
3169
3170 2017-05-24  Sergio Villar Senin  <svillar@igalia.com>
3171
3172         [SVG] Leak in SVGAnimatedListPropertyTearOff
3173         https://bugs.webkit.org/show_bug.cgi?id=172545
3174
3175         Reviewed by Said Abou-Hallawa.
3176
3177         SVGAnimatedListPropertyTearOff maintains a vector m_wrappers with references to
3178         SVGPropertyTraits<PropertyType>::ListItemTearOff. Apart from that SVGPropertyTearOff has a
3179         reference to SVGAnimatedProperty.
3180
3181         When SVGListProperty::getItemValuesAndWrappers() is called, it creates a
3182         SVGPropertyTraits<PropertyType>::ListItemTearOff pointing to the same SVGAnimatedProperty (a
3183         SVGAnimatedListPropertyTearOff) which stores the m_wrappers vector where the ListItemTearOff
3184         is going to be added to. This effectively creates a reference cycle between the
3185         SVGAnimatedListPropertyTearOff and all the ListItemTearOff it stores in m_wrappers.
3186
3187         We should detach those wrappers in propertyWillBeDeleted() in order to break the cycle.
3188
3189         * svg/properties/SVGAnimatedListPropertyTearOff.h:
3190
3191 2017-07-11  Carlos Alberto Lopez Perez  <clopez@igalia.com>
3192
3193         [GTK] Spin buttons on input type number appear over the value itself for small widths
3194         https://bugs.webkit.org/show_bug.cgi?id=173572
3195
3196         Reviewed by Carlos Garcia Campos.
3197
3198         When drawing the spin buttons, override the width of the input
3199         element to increment it with the width of the spin button.
3200         This ensures that we don't end up covering the input values with
3201         the spin buttons.
3202
3203         Do this also for user controlled styles, because most web authors
3204         won't test how their site renders on WebKitGTK+, and they will
3205         assume spin buttons in the order of 13 pixels wide (that is what
3206         most browsers use), but the GTK+ spin button is much wider (66 pixels).
3207
3208         Test: platform/gtk/fast/forms/number/number-size-spinbutton-nocover.html
3209
3210         * rendering/RenderTheme.cpp:
3211         (WebCore::RenderTheme::adjustStyle):
3212         * rendering/RenderThemeGtk.cpp:
3213         (WebCore::RenderThemeGtk::adjustTextFieldStyle): Call the theme's adjustTextFieldStyle() also for user controlled styles.
3214         (WebCore::RenderThemeGtk::adjustInnerSpinButtonStyle):
3215
3216 2017-07-11  Youenn Fablet  <youenn@apple.com>
3217
3218         We should do ICE candidate filtering at the Document level
3219         https://bugs.webkit.org/show_bug.cgi?id=173861
3220         <rdar://problem/33122058>
3221
3222         Reviewed by Eric Carlson.
3223
3224         Tests: http/tests/webrtc/filtering-ice-candidate-cross-origin-frame.html
3225                http/tests/webrtc/filtering-ice-candidate-same-origin-frame.html
3226                http/tests/webrtc/filtering-ice-candidate-same-origin-frame2.html
3227                webrtc/filtering-ice-candidate-after-reload.html
3228
3229         Making UserMediaRequest disable the ICE candidate filtering for the page RTCController.
3230         All RTCPeerConnection of the page that are created on a document that are same-origin as the top document
3231         are now registered to the RTCController.
3232         This allows disabling filtering to only these RTCPeerConnection.
3233
3234         The page keeps the default ICE candidate filtering policy.
3235         This policy allows disabling ICE candidate filtering for all RTCPeerConnection.
3236
3237         When the top document is changing, the RTCController filtering policy is reset
3238         and its list of RTCPeerConnection is emptied.
3239
3240         Internals no longer disables ICE candidate filtering by default.
3241         This allows finer grained testing.
3242         ICE candidate filtering is disabled for tests including testharnessreport.js
3243         to enable web-platform-tests to run without modifications.
3244
3245         * Modules/mediastream/RTCController.cpp:
3246         (WebCore::RTCController::reset):
3247         * Modules/mediastream/RTCController.h:
3248         * Modules/mediastream/UserMediaRequest.cpp:
3249         (WebCore::UserMediaRequest::allow):
3250         * page/Frame.cpp:
3251         (WebCore::Frame::setDocument):
3252         * page/Page.cpp:
3253         (WebCore::Page::disableICECandidateFiltering):
3254         * page/Page.h:
3255         (WebCore::Page::shouldEnableICECandidateFilteringByDefault):
3256         (WebCore::Page::disableICECandidateFiltering): Deleted.
3257         (WebCore::Page::enableICECandidateFiltering): Deleted.
3258         (WebCore::Page::isICECandidateFilteringEnabled): Deleted.
3259         * testing/Internals.cpp:
3260         (WebCore::Internals::Internals):
3261         (WebCore::Internals::setICECandidateFiltering):
3262         (WebCore::Internals::setEnumeratingAllNetworkInterfacesEnabled):
3263         (WebCore::Internals::isICECandidateFilteringEnabled): Deleted.
3264         * testing/Internals.h:
3265         * testing/Internals.idl:
3266
3267 2017-07-11  Sergio Villar Senin  <svillar@igalia.com>
3268
3269         Unreviewed, rolling out r219325.
3270
3271         The test is still flaky
3272
3273         Reverted changeset:
3274
3275         "[SVG] Leak in SVGAnimatedListPropertyTearOff"
3276         https://bugs.webkit.org/show_bug.cgi?id=172545
3277         http://trac.webkit.org/changeset/219325
3278
3279 2017-05-24  Sergio Villar Senin  <svillar@igalia.com>
3280
3281         [SVG] Leak in SVGAnimatedListPropertyTearOff
3282         https://bugs.webkit.org/show_bug.cgi?id=172545
3283
3284         Reviewed by Said Abou-Hallawa.
3285
3286         SVGAnimatedListPropertyTearOff maintains a vector m_wrappers with references to
3287         SVGPropertyTraits<PropertyType>::ListItemTearOff. Apart from that SVGPropertyTearOff has a
3288         reference to SVGAnimatedProperty.
3289
3290         When SVGListProperty::getItemValuesAndWrappers() is called, it creates a
3291         SVGPropertyTraits<PropertyType>::ListItemTearOff pointing to the same SVGAnimatedProperty (a
3292         SVGAnimatedListPropertyTearOff) which stores the m_wrappers vector where the ListItemTearOff
3293         is going to be added to. This effectively creates a reference cycle between the
3294         SVGAnimatedListPropertyTearOff and all the ListItemTearOff it stores in m_wrappers.
3295
3296         We should detach those wrappers in propertyWillBeDeleted() in order to break the cycle.
3297
3298         * svg/properties/SVGAnimatedListPropertyTearOff.h:
3299
3300 2017-07-10  Simon Fraser  <simon.fraser@apple.com>
3301
3302         [WK2 iOS] REGRESSION (r216803) During momentum scroll, getBoundingClientRect returns wrong coordinates (missing images on pinterest, elle.com and many other sites)
3303         https://bugs.webkit.org/show_bug.cgi?id=174286
3304         rdar://problem/32864180
3305
3306         Reviewed by Dean Jackson.
3307
3308         r216803 made getBoundingClientRects relative to the layout viewport, but when scrolling we
3309         only update that on stable viewport updates (at the end of the scroll). This meant that during
3310         unstable updates, getBoundingClientRects() used a "frozen" viewport origin so things on-screen
3311         would appear to be off-screen, causing sites to fail to dynamically load images etc. when
3312         scrolling.
3313
3314         Fix by pushing an optional "unstable" layout viewport rect onto FrameView, which gets used by
3315         FrameView::documentToClientOffset(). This is cleared when we do a stable update.
3316
3317         This is a short-term solution. Longer term, I would prefer to always call setLayoutViewportOverrideRect(),
3318         but fix the scrolling tree logic to work correctly in this case.
3319
3320         Add a bit more scrolling logging.
3321
3322         Test: fast/visual-viewport/ios/get-bounding-client-rect-unstable.html
3323
3324         * page/FrameView.cpp:
3325         (WebCore::FrameView::setUnstableLayoutViewportRect):
3326         (WebCore::FrameView::documentToClientOffset):
3327         * page/FrameView.h:
3328         * page/scrolling/AsyncScrollingCoordinator.cpp:
3329         (WebCore::AsyncScrollingCoordinator::reconcileScrollingState):
3330         * page/scrolling/ScrollingStateFixedNode.cpp:
3331         (WebCore::ScrollingStateFixedNode::updateConstraints):
3332         (WebCore::ScrollingStateFixedNode::reconcileLayerPositionForViewportRect):
3333
3334 2017-07-10  John Wilander  <wilander@apple.com>
3335
3336         Resource Load Statistics: Prune statistics in orders of importance
3337         https://bugs.webkit.org/show_bug.cgi?id=174215
3338         <rdar://problem/33164403>
3339
3340         Reviewed by Chris Dumez.
3341
3342         Test: http/tests/loading/resourceLoadStatistics/prune-statistics.html
3343
3344         * loader/ResourceLoadObserver.cpp:
3345         (WebCore::reduceTimeResolution):
3346         (WebCore::ResourceLoadObserver::logFrameNavigation):
3347         (WebCore::ResourceLoadObserver::logSubresourceLoading):
3348         (WebCore::ResourceLoadObserver::logWebSocketLoading):
3349         (WebCore::ResourceLoadObserver::logUserInteractionWithReducedTimeResolution):
3350             Now all set the new statistics field lastSeen.
3351         * loader/ResourceLoadStatistics.cpp:
3352         (WebCore::ResourceLoadStatistics::encode):
3353         (WebCore::ResourceLoadStatistics::decode):
3354         (WebCore::ResourceLoadStatistics::toString):
3355         (WebCore::ResourceLoadStatistics::merge):
3356             Handling of the new statistics field lastSeen.
3357         * loader/ResourceLoadStatistics.h:
3358
3359 2017-07-10  Devin Rousso  <drousso@apple.com>
3360
3361         Web Inspector: Highlight matching CSS canvas clients when hovering contexts in the Resources tab
3362         https://bugs.webkit.org/show_bug.cgi?id=174279
3363
3364         Reviewed by Matt Baker.
3365
3366         Test: inspector/dom/highlightNodeList.html
3367
3368         * inspector/InspectorDOMAgent.h:
3369         * inspector/InspectorDOMAgent.cpp:
3370         (WebCore::InspectorDOMAgent::highlightNodeList):
3371
3372 2017-07-10  Javier Fernandez  <jfernandez@igalia.com>
3373
3374         [css-align][css-flex][css-grid] 'auto' values of align-self and justify-self must not be resolved
3375         https://bugs.webkit.org/show_bug.cgi?id=172707
3376
3377         Reviewed by Antti Koivisto.
3378
3379         The CSS Box Alignment specification has been changed recently so that
3380         now all the propeties have the specificed value as computed value. The
3381         rationale of this change are at the associated W3C github issue [1].
3382
3383         This change implies that we don't need to execute the StyleAdjuter
3384         logic we implemented specifically for supporting 'auto' values
3385         resolution for computed style. We can live now with resolution at
3386         layout time only.
3387
3388         [1] https://github.com/w3c/csswg-drafts/issues/440
3389
3390         No new tests, just updating the already defined tests.
3391