Rename NoEventDispatchAssertion to ScriptDisallowedScope
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2017-12-21  Ryosuke Niwa  <rniwa@webkit.org>
2
3         Rename NoEventDispatchAssertion to ScriptDisallowedScope
4         https://bugs.webkit.org/show_bug.cgi?id=181102
5
6         Reviewed by Zalan Bujtas.
7
8         Renamed the class.
9
10         * WebCore.xcodeproj/project.pbxproj:
11         * bindings/js/ScriptController.cpp:
12         (WebCore::ScriptController::canExecuteScripts):
13         * dom/ContainerNode.cpp:
14         (WebCore::ContainerNode::removeAllChildrenWithScriptAssertion):
15         (WebCore::ContainerNode::removeNodeWithScriptAssertion):
16         (WebCore::executeNodeInsertionWithScriptAssertion):
17         (WebCore::ContainerNode::removeDetachedChildren):
18         (WebCore::ContainerNode::insertBeforeCommon):
19         (WebCore::ContainerNode::appendChildCommon):
20         (WebCore::ContainerNode::removeBetween):
21         (WebCore::dispatchChildInsertionEvents):
22         (WebCore::dispatchChildRemovalEvents):
23         * dom/ContainerNodeAlgorithms.cpp:
24         (WebCore::notifyChildNodeInserted):
25         (WebCore::notifyChildNodeRemoved):
26         * dom/Document.cpp:
27         (WebCore::Document::resolveStyle):
28         (WebCore::isSafeToUpdateStyleOrLayout):
29         (WebCore::Document::updateStyleIfNeeded):
30         (WebCore::Document::nodeChildrenWillBeRemoved):
31         (WebCore::Document::nodeWillBeRemoved):
32         (WebCore::Document::dispatchWindowEvent):
33         (WebCore::Document::dispatchWindowLoadEvent):
34         (WebCore::Document::applyPendingXSLTransformsTimerFired):
35         * dom/Element.cpp:
36         (WebCore::Element::addShadowRoot):
37         (WebCore::Element::attachAttributeNodeIfNeeded):
38         (WebCore::Element::setAttributeNode):
39         (WebCore::Element::setAttributeNodeNS):
40         (WebCore::Element::dispatchFocusInEvent):
41         (WebCore::Element::dispatchFocusOutEvent):
42         * dom/ElementIteratorAssertions.h:
43         (WebCore::ElementIteratorAssertions::ElementIteratorAssertions):
44         * dom/EventDispatcher.cpp:
45         (WebCore::EventDispatcher::dispatchEvent):
46         * dom/EventTarget.cpp:
47         (WebCore::EventTarget::fireEventListeners):
48         * dom/NoEventDispatchAssertion.h: Removed.
49         * dom/Node.cpp:
50         (WebCore::Node::dispatchSubtreeModifiedEvent):
51         (WebCore::Node::dispatchDOMActivateEvent):
52         * dom/ScriptDisallowedScope.h: Copied from Source/WebCore/dom/NoEventDispatchAssertion.h.
53         (WebCore::ScriptDisallowedScope::ScriptDisallowedScope):
54         (WebCore::ScriptDisallowedScope::~ScriptDisallowedScope):
55         (WebCore::ScriptDisallowedScope::InMainThread::isEventDispatchAllowedInSubtree):
56         (WebCore::ScriptDisallowedScope::InMainThread::isScriptAllowed):
57         (WebCore::NoEventDispatchAssertion::NoEventDispatchAssertion): Deleted.
58         (WebCore::NoEventDispatchAssertion::~NoEventDispatchAssertion): Deleted.
59         (WebCore::NoEventDispatchAssertion::isEventAllowedInMainThread): Deleted.
60         (WebCore::NoEventDispatchAssertion::InMainThread::InMainThread): Deleted.
61         (WebCore::NoEventDispatchAssertion::InMainThread::~InMainThread): Deleted.
62         (WebCore::NoEventDispatchAssertion::InMainThread::isEventDispatchAllowedInSubtree): Deleted.
63         (WebCore::NoEventDispatchAssertion::InMainThread::isEventAllowed): Deleted.
64         (WebCore::NoEventDispatchAssertion::EventAllowedScope::EventAllowedScope): Deleted.
65         (WebCore::NoEventDispatchAssertion::EventAllowedScope::~EventAllowedScope): Deleted.
66         (WebCore::NoEventDispatchAssertion::EventAllowedScope::isAllowedNode): Deleted.
67         (WebCore::NoEventDispatchAssertion::EventAllowedScope::isAllowedNodeInternal): Deleted.
68         (WebCore::NoEventDispatchAssertion::DisableAssertionsInScope::DisableAssertionsInScope): Deleted.
69         (WebCore::NoEventDispatchAssertion::DisableAssertionsInScope::~DisableAssertionsInScope): Deleted.
70         * dom/ScriptElement.cpp:
71         (WebCore::ScriptElement::executeClassicScript):
72         * dom/ScriptExecutionContext.cpp:
73         (WebCore::ScriptExecutionContext::canSuspendActiveDOMObjectsForDocumentSuspension):
74         (WebCore::ScriptExecutionContext::suspendActiveDOMObjects):
75         (WebCore::ScriptExecutionContext::resumeActiveDOMObjects):
76         (WebCore::ScriptExecutionContext::stopActiveDOMObjects):
77         * history/CachedPage.cpp:
78         (WebCore::CachedPage::restore):
79         * history/PageCache.cpp:
80         (WebCore::PageCache::addIfCacheable):
81         * html/HTMLElement.cpp:
82         (WebCore::textToFragment):
83         (WebCore::HTMLElement::setInnerText):
84         * html/HTMLMediaElement.cpp:
85         * html/HTMLTextFormControlElement.cpp:
86         (WebCore::HTMLTextFormControlElement::setInnerTextValue):
87         * html/track/VTTCue.cpp:
88         (WebCore::VTTCue::createCueRenderingTree):
89         (WebCore::VTTCue::updateDisplayTree):
90         (WebCore::VTTCue::removeDisplayTree):
91         * loader/FormSubmission.cpp:
92         * loader/cache/CachedSVGFont.cpp:
93         (WebCore::CachedSVGFont::ensureCustomFontData):
94         * page/LayoutContext.cpp:
95         (WebCore::LayoutContext::layout):
96         * rendering/RenderFrameBase.cpp:
97         (WebCore::RenderFrameBase::performLayoutWithFlattening):
98         * rendering/RenderLayer.cpp:
99         (WebCore::RenderLayer::scrollRectToVisible):
100         * svg/SVGTRefElement.cpp:
101         (WebCore::SVGTRefElement::updateReferencedText):
102         * svg/SVGUseElement.cpp:
103         (WebCore::SVGUseElement::clearShadowTree):
104         * svg/graphics/SVGImage.cpp:
105         (WebCore::SVGImage::draw):
106
107 2017-12-21  Maciej Stachowiak  <mjs@apple.com>
108
109         Update Service Workers status to Supported in Preview
110         https://bugs.webkit.org/show_bug.cgi?id=181093
111
112         Reviewed by Andy Estes.
113
114         * features.json:
115
116 2017-12-21  Brent Fulgham  <bfulgham@apple.com>
117
118         Unreviewed test fix after r226224.
119         <rdar://problem/36185975>
120
121         Pasteboard data is more than a dictionary. We have to whitelist NSString
122         and NSArray as well. Change method name to reflect that we take a whitelist
123         of classes that are allowed to be unarchived in the call.
124
125         * platform/ios/PlatformPasteboardIOS.mm:
126         (WebCore::PlatformPasteboard::write): Use revised method.
127         (WebCore::PlatformPasteboard::typesSafeForDOMToReadAndWrite const): Ditto.
128
129 2017-12-21  Zalan Bujtas  <zalan@apple.com>
130
131         [RenderTreeBuilder] Move RenderRubyAsInline::addChild mutation to a RenderTreeBuilder
132         https://bugs.webkit.org/show_bug.cgi?id=181101
133         <rdar://problem/36184788>
134
135         Reviewed by Antti Koivisto.
136
137         * rendering/RenderRuby.cpp:
138         (WebCore::isRubyBeforeBlock): Deleted.
139         (WebCore::isRubyAfterBlock): Deleted.
140         (WebCore::rubyBeforeBlock): Deleted.
141         (WebCore::rubyAfterBlock): Deleted.
142         (WebCore::createAnonymousRubyInlineBlock): Deleted.
143         (WebCore::lastRubyRun): Deleted.
144         (WebCore::RenderRubyAsInline::addChild): Deleted.
145         * rendering/RenderRuby.h:
146         * rendering/updating/RenderTreeBuilder.cpp:
147         (WebCore::RenderTreeBuilder::insertChild):
148         * rendering/updating/RenderTreeBuilderRuby.cpp:
149         (WebCore::RenderTreeBuilder::Ruby::findOrCreateParentForChild):
150         * rendering/updating/RenderTreeBuilderRuby.h:
151
152 2017-12-21  Jiewen Tan  <jiewen_tan@apple.com>
153
154         Update Credential Management API for WebAuthentication
155         https://bugs.webkit.org/show_bug.cgi?id=181082
156         <rdar://problem/36055239>
157
158         Reviewed by Daniel Bates.
159
160         Part 1/2
161
162         In this patch, it restructure a bit for existing Credential Management API codebase:
163         1. Rename the folder from credentials to credentialmanagement for better understanding.
164         2. Remove unneeded dummy codes, i.e. PasswordCredential and FederatedCredential.
165         3. Core API and layout tests are updated correspondingly as well.
166
167         Rebaseline test results.
168
169         * CMakeLists.txt:
170         * DerivedSources.make:
171         * Modules/credentialmanagement/BasicCredential.cpp: Renamed from Source/WebCore/Modules/credentials/BasicCredential.cpp.
172         (WebCore::BasicCredential::BasicCredential):
173         (WebCore::BasicCredential::type const):
174         * Modules/credentialmanagement/BasicCredential.h: Renamed from Source/WebCore/Modules/credentials/BasicCredential.h.
175         (WebCore::BasicCredential::id const):
176         * Modules/credentialmanagement/BasicCredential.idl: Renamed from Source/WebCore/Modules/credentials/BasicCredential.idl.
177         * Modules/credentialmanagement/CredentialCreationOptions.h: Renamed from Source/WebCore/Modules/credentials/CredentialData.h.
178         * Modules/credentialmanagement/CredentialCreationOptions.idl: Renamed from Source/WebCore/Modules/credentials/CredentialData.idl.
179         * Modules/credentialmanagement/CredentialRequestOptions.h: Renamed from Source/WebCore/Modules/credentials/CredentialRequestOptions.h.
180         * Modules/credentialmanagement/CredentialRequestOptions.idl: Renamed from Source/WebCore/Modules/credentials/CredentialRequestOptions.idl.
181         * Modules/credentialmanagement/CredentialsContainer.cpp: Renamed from Source/WebCore/Modules/credentials/CredentialsContainer.cpp.
182         (WebCore::CredentialsContainer::get):
183         (WebCore::CredentialsContainer::store):
184         (WebCore::CredentialsContainer::isCreate):
185         (WebCore::CredentialsContainer::preventSilentAccess):
186         * Modules/credentialmanagement/CredentialsContainer.h: Renamed from Source/WebCore/Modules/credentials/CredentialsContainer.h.
187         (WebCore::CredentialsContainer::create):
188         (WebCore::CredentialsContainer::CredentialsContainer):
189         * Modules/credentialmanagement/CredentialsContainer.idl: Renamed from Source/WebCore/Modules/credentials/CredentialsContainer.idl.
190         * Modules/credentialmanagement/NavigatorCredentials.cpp: Renamed from Source/WebCore/Modules/credentials/NavigatorCredentials.cpp.
191         (WebCore::NavigatorCredentials::supplementName):
192         (WebCore::NavigatorCredentials::credentials):
193         (WebCore::NavigatorCredentials::from):
194         * Modules/credentialmanagement/NavigatorCredentials.h: Renamed from Source/WebCore/Modules/credentials/NavigatorCredentials.h.
195         * Modules/credentialmanagement/NavigatorCredentials.idl: Renamed from Source/WebCore/Modules/credentials/NavigatorCredentials.idl.
196         * Modules/credentials/CredentialCreationOptions.h: Removed.
197         * Modules/credentials/CredentialCreationOptions.idl: Removed.
198         * Modules/credentials/CredentialUserData.h: Removed.
199         * Modules/credentials/CredentialUserData.idl: Removed.
200         * Modules/credentials/FederatedCredential.cpp: Removed.
201         * Modules/credentials/FederatedCredential.h: Removed.
202         * Modules/credentials/FederatedCredential.idl: Removed.
203         * Modules/credentials/FederatedCredentialInit.h: Removed.
204         * Modules/credentials/FederatedCredentialInit.idl: Removed.
205         * Modules/credentials/FederatedCredentialRequestOptions.h: Removed.
206         * Modules/credentials/FederatedCredentialRequestOptions.idl: Removed.
207         * Modules/credentials/PasswordCredential.cpp: Removed.
208         * Modules/credentials/PasswordCredential.h: Removed.
209         * Modules/credentials/PasswordCredential.idl: Removed.
210         * Modules/credentials/PasswordCredentialData.h: Removed.
211         * Modules/credentials/PasswordCredentialData.idl: Removed.
212         * Sources.txt:
213         * WebCore.xcodeproj/project.pbxproj:
214         * bindings/js/WebCoreBuiltinNames.h:
215
216 2017-12-21  John Wilander  <wilander@apple.com>
217
218         Storage Access API: Allow requests from non-sandboxed iframes
219         https://bugs.webkit.org/show_bug.cgi?id=181099
220         <rdar://problem/36184501>
221
222         Reviewed by Brent Fulgham.
223
224         No new tests. Changed existing tests.
225
226         * dom/Document.cpp:
227         (WebCore::Document::requestStorageAccess):
228
229 2017-12-21  Ryosuke Niwa  <rniwa@webkit.org>
230
231         Minor cleanup in WebContentReaderCocoa after r226213
232         https://bugs.webkit.org/show_bug.cgi?id=181104
233
234         Reviewed by Wenson Hsieh.
235
236         Deployed early exists in the case of attachment replacements to make the code easier to read.
237
238         * editing/cocoa/WebContentReaderCocoa.mm:
239         (WebCore::createFragmentAndAddResources):
240         (WebCore::markupForFragmentInDocument): Extracted out of sanitizeMarkupWithArchive.
241         (WebCore::sanitizeMarkupWithArchive):
242         (WebCore::WebContentReader::readImage): Simplified the return logic.
243
244 2017-12-21  Zalan Bujtas  <zalan@apple.com>
245
246         [RenderTreeBuilder] Move RenderRubyAsBlock::addChild mutation to a RenderTreeBuilder
247         https://bugs.webkit.org/show_bug.cgi?id=181090
248         <rdar://problem/36180916>
249
250         Reviewed by Antti Koivisto.
251
252         This is in preparation for moving all ruby mutation code here.
253
254         Covered by existing tests.
255
256         * rendering/RenderRuby.cpp:
257         (WebCore::RenderRubyAsBlock::addChild): Deleted.
258         * rendering/RenderRuby.h:
259         * rendering/updating/RenderTreeBuilder.cpp:
260         (WebCore::RenderTreeBuilder::insertChild):
261         * rendering/updating/RenderTreeBuilderRuby.cpp:
262         (WebCore::isAnonymousRubyInlineBlock):
263         (WebCore::isRubyBeforeBlock):
264         (WebCore::isRubyAfterBlock):
265         (WebCore::isRubyChildForNormalRemoval):
266         (WebCore::rubyBeforeBlock):
267         (WebCore::rubyAfterBlock):
268         (WebCore::createAnonymousRubyInlineBlock):
269         (WebCore::lastRubyRun):
270         (WebCore::RenderTreeBuilder::Ruby::findOrCreateParentForChild):
271         * rendering/updating/RenderTreeBuilderRuby.h:
272
273 2017-12-21  Jeremy Jones  <jeremyj@apple.com>
274
275         Update FULLSCREEN_API feature defines.
276         https://bugs.webkit.org/show_bug.cgi?id=181015
277
278         Reviewed by Tim Horton.
279
280         Change enabled iphone sdk for FULLSCREEN_API.
281
282         * Configurations/FeatureDefines.xcconfig:
283
284 2017-12-21  Chris Dumez  <cdumez@apple.com>
285
286         ononline, onoffline and navigator.onLine don't work if Parallels or VMWare is installed
287         https://bugs.webkit.org/show_bug.cgi?id=32327
288
289         Reviewed by Alexey Proskuryakov.
290
291         When determining if we are online, ignore virtual interfaces added on the host machine
292         by Parallels and VMWare. This is needed because those interfaces are always up, whether
293         or not the virtual machine is running. This was causing navigator.onLine to always return
294         true on the host machine when Parallels or VMWare was installed.
295
296         Note that it is safe to ignore these interfaces and that it does not cause issues when
297         running Safari inside the virtual machine because those virtual interfaces are only
298         exposed on the host machine. Inside, the virtual machine, we see the usual en0 interface.
299
300         * platform/network/mac/NetworkStateNotifierMac.cpp:
301         (WebCore::NetworkStateNotifier::updateStateWithoutNotifying):
302
303 2017-12-21  Zalan Bujtas  <zalan@apple.com>
304
305         [RenderTreeBuilder] Move repeating code to RenderTreeBuilder::insertInternal
306         https://bugs.webkit.org/show_bug.cgi?id=181094
307
308         Reviewed by Antti Koivisto.
309
310         * rendering/updating/RenderTreeBuilder.cpp:
311         (WebCore::RenderTreeBuilder::insertChild):
312
313 2017-12-21  Jeremy Jones  <jeremyj@apple.com>
314
315         Build fix after r226223
316         https://bugs.webkit.org/show_bug.cgi?id=181088
317
318         Unreviewed.
319
320         * platform/ios/VideoFullscreenInterfaceAVKit.mm:
321         (VideoFullscreenInterfaceAVKit::exitFullscreen):
322
323 2017-12-21  John Wilander  <wilander@apple.com>
324
325         Storage Access API: Make DocumentLoader::willSendRequest() and WebFrameLoaderClient::detachedFromParent2() tell the network process to get rid of any sub frame access entries
326         https://bugs.webkit.org/show_bug.cgi?id=180728
327         <rdar://problem/36009288>
328
329         Reviewed by Youenn Fablet.
330
331         Tests: http/tests/storageAccess/request-and-grant-access-then-detach-should-not-have-access.html
332                http/tests/storageAccess/request-and-grant-access-then-navigate-should-not-have-access.html
333
334         This change calls the network process to clear any storage access
335         entries when a subframe navigates or is detached.
336
337         * dom/Document.cpp:
338         (WebCore::Document::hasStorageAccess):
339         (WebCore::Document::requestStorageAccess):
340         (WebCore::Document::hasFrameSpecificStorageAccess):
341         (WebCore::Document::setHasFrameSpecificStorageAccess):
342         * dom/Document.h:
343         * loader/DocumentLoader.cpp:
344         (WebCore::DocumentLoader::willSendRequest):
345         * loader/EmptyFrameLoaderClient.h:
346         * loader/FrameLoaderClient.h:
347         * platform/network/NetworkStorageSession.h:
348         * platform/network/cf/NetworkStorageSessionCFNet.cpp:
349         (WebCore::NetworkStorageSession::removeStorageAccess):
350
351 2017-12-21  Antoine Quint  <graouts@apple.com>
352
353         [Web Animations] Complete support for keyframe animations
354         https://bugs.webkit.org/show_bug.cgi?id=179708
355
356         Reviewed by Dean Jackson.
357
358         We implement section 5.10.3 "Processing a keyframes argument" of the Web Animations spec to handle
359         multiple keyframes, rather than only two, provided either in iterable (ie. array) or property-index
360         (ie. dictionary) form. Although we don't currently support timing function or composite operations,
361         we parse them as well.
362
363         While there are minimal test changes, there will be a host of changes in the next patch in which
364         we turn Element.animate() on.
365
366         * animation/KeyframeEffect.cpp:
367         (WebCore::IDLAttributeNameToAnimationPropertyName): New utility to convert an IDL-parsed JS property
368         into a WebCore CSSPropertyID.
369         (WebCore::computeMissingKeyframeOffsets): Converts "null" offsets into computed offset values as specified
370         in section 4.4.2. "Calculating computed keyframes".
371         (WebCore::processIterableKeyframes): Process the iterable form of the keyframes argument.
372         (WebCore::processKeyframeLikeObject): Process a keyframe-like object found in the property-indexed form.
373         (WebCore::processPropertyIndexedKeyframes): Process the property-indexed form of the keyframes argument.
374         (WebCore::KeyframeEffect::setKeyframes): Since this method and processKeyframes() share the same signature,
375         we can just return the value from processKeyframes() directly.
376         (WebCore::KeyframeEffect::processKeyframes): Process the keyframes argument as specified.
377         (WebCore::KeyframeEffect::applyAtLocalTime): Delegate blending to the new setAnimatedPropertiesInStyle()
378         since this task is now more complex due to handling of multiple keyframes.
379         (WebCore::KeyframeEffect::getAnimatedStyle): Delegate blending to the new setAnimatedPropertiesInStyle()
380         since this task is now more complex due to handling of multiple keyframes.
381         (WebCore::KeyframeEffect::setAnimatedPropertiesInStyle): Handle multiple and implicit start and end keyframes.
382         * animation/KeyframeEffect.h: Add some new structures used for parsing purposes.
383         * animation/KeyframeEffect.idl: Expose the CompositeOperation enum and the BasePropertyIndexedKeyframe dictionary
384         used in processKeyframeLikeObject().
385         * css/CSSStyleDeclaration.cpp:
386         (WebCore::CSSStyleDeclaration::getCSSPropertyIDFromJavaScriptPropertyName):
387         * css/CSSStyleDeclaration.h:
388         * page/animation/CSSPropertyAnimation.cpp:
389         (WebCore::CSSPropertyAnimation::isPropertyAnimatable):
390         * page/animation/CSSPropertyAnimation.h:
391
392 2017-12-21  Jer Noble  <jer.noble@apple.com>
393
394         Add initial DOM support for Media Capabilities
395         https://bugs.webkit.org/show_bug.cgi?id=181064
396
397         Reviewed by Eric Carlson.
398
399         Test: media/mediacapabilities/mediacapabilities-types.html
400
401         Add basic, cross-platform, DOM facing type and API support for Media Capabilities API.
402
403         * bindings/scripts/CodeGenerator.pm:
404         (WK_ucfirst):
405         * CMakeLists.txt:
406         * DerivedSources.make:
407         * Modules/mediacapabilities/AudioConfiguration.h: Added.
408         * Modules/mediacapabilities/AudioConfiguration.idl: Added.
409         * Modules/mediacapabilities/MediaCapabilities.cpp: Added.
410         (WebCore::bucketMIMETypes):
411         (WebCore::isValidMIMEType):
412         (WebCore::isValidVideoConfiguration):
413         (WebCore::isValidAudioConfiguration):
414         (WebCore::isValidMediaConfiguration):
415         (WebCore::MediaCapabilities::decodingInfo):
416         (WebCore::MediaCapabilities::encodingInfo):
417         * Modules/mediacapabilities/MediaCapabilities.h: Added.
418         * Modules/mediacapabilities/MediaCapabilities.idl: Added.
419         * Modules/mediacapabilities/MediaCapabilitiesInfo.h: Added.
420         (WebCore::MediaCapabilitiesInfo::supported const):
421         (WebCore::MediaCapabilitiesInfo::setSupported):
422         (WebCore::MediaCapabilitiesInfo::smooth const):
423         (WebCore::MediaCapabilitiesInfo::setSmooth):
424         (WebCore::MediaCapabilitiesInfo::powerEfficient const):
425         (WebCore::MediaCapabilitiesInfo::setPowerEfficient):
426         * Modules/mediacapabilities/MediaCapabilitiesInfo.idl: Added.
427         * Modules/mediacapabilities/MediaConfiguration.h: Added.
428         * Modules/mediacapabilities/MediaConfiguration.idl: Added.
429         * Modules/mediacapabilities/MediaDecodingConfiguration.h: Added.
430         * Modules/mediacapabilities/MediaDecodingConfiguration.idl: Added.
431         * Modules/mediacapabilities/MediaDecodingType.h: Added.
432         * Modules/mediacapabilities/MediaDecodingType.idl: Added.
433         * Modules/mediacapabilities/MediaEncodingConfiguration.h: Added.
434         * Modules/mediacapabilities/MediaEncodingConfiguration.idl: Added.
435         * Modules/mediacapabilities/MediaEncodingType.h: Added.
436         * Modules/mediacapabilities/MediaEncodingType.idl: Added.
437         * Modules/mediacapabilities/NavigatorMediaCapabilities.cpp: Added.
438         (WebCore::NavigatorMediaCapabilities::NavigatorMediaCapabilities):
439         (WebCore::NavigatorMediaCapabilities::supplementName):
440         (WebCore::NavigatorMediaCapabilities::from):
441         (WebCore::NavigatorMediaCapabilities::mediaCapabilities):
442         (WebCore::NavigatorMediaCapabilities::mediaCapabilities const):
443         * Modules/mediacapabilities/NavigatorMediaCapabilities.h: Added.
444         * Modules/mediacapabilities/NavigatorMediaCapabilities.idl: Added.
445         * Modules/mediacapabilities/ScreenColorGamut.h: Added.
446         * Modules/mediacapabilities/ScreenColorGamut.idl: Added.
447         * Modules/mediacapabilities/ScreenLuminance.h: Added.
448         (WebCore::ScreenLuminance::min const):
449         (WebCore::ScreenLuminance::setMin):
450         (WebCore::ScreenLuminance::max const):
451         (WebCore::ScreenLuminance::setMax):
452         (WebCore::ScreenLuminance::maxAverage const):
453         (WebCore::ScreenLuminance::setMaxAverage):
454         * Modules/mediacapabilities/ScreenLuminance.idl: Added.
455         * Modules/mediacapabilities/VideoConfiguration.h: Added.
456         * Modules/mediacapabilities/VideoConfiguration.idl: Added.
457         * Sources.txt:
458         * WebCore.xcodeproj/project.pbxproj:
459         * bindings/js/WebCoreBuiltinNames.h:
460         * page/RuntimeEnabledFeatures.h:
461         (WebCore::RuntimeEnabledFeatures::setMediaCapabilitiesEnabled):
462         (WebCore::RuntimeEnabledFeatures::mediaCapabilitiesEnabled const):
463         * page/Settings.yaml:
464
465 2017-12-21  Keith Rollin  <krollin@apple.com>
466
467         Add optional logging of per-resource cookie information
468         https://bugs.webkit.org/show_bug.cgi?id=180883
469         <rdar://problem/35802295>
470
471         Reviewed by Brent Fulgham.
472
473         In order to support the tracking of the efficacy of Intelligent
474         Tracking Protection, add some logging of the cookie information
475         associated with each loaded resource. This logging is off by default
476         and is enabled with `defaults write -g WebKitLogCookieInformation
477         -bool true`.
478
479         No new tests -- no new user functionality added. Only new logging has
480         been added.
481
482         * platform/Cookie.h:
483         (WebCore::Cookie::Cookie):
484         (WebCore::Cookie::isNull const):
485         (WebCore::Cookie::encode const):
486         (WebCore::Cookie::decode):
487         * platform/network/cf/CookieJarCFNet.cpp:
488         (WebCore::canonicalCookieTime):
489         (WebCore::cookieCreatedTime):
490         (WebCore::cookieExpirationTime):
491         (WebCore::getRawCookies):
492         * platform/network/cocoa/CookieCocoa.mm:
493         (WebCore::cookieCreated):
494         (WebCore::Cookie::Cookie):
495         * platform/network/soup/CookieJarSoup.cpp:
496         (WebCore::getRawCookies):
497
498 2017-12-21  Brent Fulgham  <bfulgham@apple.com>
499
500         Adopt new secure coding APIs in WebCore
501         https://bugs.webkit.org/show_bug.cgi?id=178484
502         <rdar://problem/34837193>
503
504         Reviewed by Eric Carlson.
505
506         Switch to new NSKeyed[Un]Archiver methods that use NSSecureCoding by default.
507
508         Most of the new API is wrapped in a set of convenience methods so we can
509         build without the new API on older systems.
510
511         No change in behavior.
512
513         * editing/cocoa/EditorCocoa.mm:
514         (WebCore::archivedDataForAttributedString): Use new convenience method
515         to archive the string object.
516         * platform/ios/PlatformPasteboardIOS.mm:
517         (WebCore::PlatformPasteboard::write): Use new secure API.
518         (WebCore::PlatformPasteboard::typesSafeForDOMToReadAndWrite const): Ditto.
519
520 2017-12-21  Zalan Bujtas  <zalan@apple.com>
521
522         [RenderTreeBuilder] Move ruby mutation code to a dedicated class.
523         https://bugs.webkit.org/show_bug.cgi?id=181066
524         <rdar://problem/36167692>
525
526         Reviewed by Antti Koivisto.
527
528         This is in preparation for moving all ruby mutation code here.
529
530         No change in functionality.
531
532         * Sources.txt:
533         * WebCore.xcodeproj/project.pbxproj:
534         * rendering/updating/RenderTreeBuilder.cpp:
535         (WebCore::RenderTreeBuilder::insertChild):
536         (WebCore::RenderTreeBuilder::rubyRunInsertChild): Deleted.
537         * rendering/updating/RenderTreeBuilder.h:
538         (WebCore::RenderTreeBuilder::rubyBuilder):
539         * rendering/updating/RenderTreeBuilderRuby.cpp: Added.
540         (WebCore::RenderTreeBuilder::Ruby::Ruby):
541         (WebCore::RenderTreeBuilder::Ruby::insertChild):
542         * rendering/updating/RenderTreeBuilderRuby.h: Copied from Source/WebCore/rendering/updating/RenderTreeBuilder.h.
543
544 2017-12-21  Ms2ger  <Ms2ger@igalia.com>
545
546         Replace a FIXME comment in CanvasGradient::addColorStop().
547         https://bugs.webkit.org/show_bug.cgi?id=181034
548
549         Reviewed by Daniel Bates.
550
551         Tests: LayoutTests/imported/w3c/canvas/2d.gradient.object.current.html
552
553         * html/canvas/CanvasGradient.cpp:
554         (WebCore::CanvasGradient::addColorStop):
555
556 2017-12-21  Jeremy Jones  <jeremyj@apple.com>
557
558         Enable picture-in-picture from inline element on suspend.
559         https://bugs.webkit.org/show_bug.cgi?id=180942
560         rdar://problem/34745234
561
562         Reviewed by Jer Noble.
563
564         When a element goes into element fullscreen mode, a descendant video element gains the ability to automatically enter picture-in-picture on application suspend.
565
566         This adds support for video fullscreen standby mode, which creates a VideoFullscreenInterfaceAVKit so that it can
567         trigger auto-pip on application suspend while the element is not actually presenting in video fullscreen mode.
568
569         VideoFullscreenInterfaceAVKit has a new state transition system that will replace the existing one to enable the increased
570         number and complexity of state transitions. Until we are ready to completely commit to this new code path, this implementation is
571         conditionalized to keep the existing code path working.
572
573         * html/HTMLMediaElement.cpp:
574         (WebCore::HTMLMediaElement::enterFullscreen):
575         (WebCore::HTMLMediaElement::exitFullscreen):
576         (WebCore::HTMLMediaElement::setVideoFullscreenStandby):
577         (WebCore::HTMLMediaElement::shouldOverrideBackgroundPlaybackRestriction const):
578         * html/HTMLMediaElement.h:
579         * page/ChromeClient.h:
580         * platform/cocoa/VideoFullscreenChangeObserver.h:
581         * platform/ios/VideoFullscreenInterfaceAVKit.h:
582         * platform/ios/VideoFullscreenInterfaceAVKit.mm:
583         (-[WebAVPlayerViewControllerDelegate playerViewControllerShouldStartPictureInPictureFromInlineWhenEnteringBackground:]):
584         (-[WebAVPlayerLayer layoutSublayers]):
585         (allocWebAVPictureInPicturePlayerLayerViewInstance):
586         (allocWebAVPlayerLayerViewInstance):
587         (VideoFullscreenInterfaceAVKit::applicationDidBecomeActive):
588         (VideoFullscreenInterfaceAVKit::setupFullscreen):
589         (VideoFullscreenInterfaceAVKit::enterFullscreen):
590         (VideoFullscreenInterfaceAVKit::exitFullscreen):
591         (VideoFullscreenInterfaceAVKit::cleanupFullscreen):
592         (VideoFullscreenInterfaceAVKit::requestHideAndExitFullscreen):
593         (VideoFullscreenInterfaceAVKit::preparedToReturnToInline):
594         (VideoFullscreenInterfaceAVKit::mayAutomaticallyShowVideoPictureInPicture const):
595         (VideoFullscreenInterfaceAVKit::willStartPictureInPicture):
596         (VideoFullscreenInterfaceAVKit::didStartPictureInPicture):
597         (VideoFullscreenInterfaceAVKit::failedToStartPictureInPicture):
598         (VideoFullscreenInterfaceAVKit::willStopPictureInPicture):
599         (VideoFullscreenInterfaceAVKit::didStopPictureInPicture):
600         (VideoFullscreenInterfaceAVKit::prepareForPictureInPictureStopWithCompletionHandler):
601         (VideoFullscreenInterfaceAVKit::shouldExitFullscreenWithReason):
602         (VideoFullscreenInterfaceAVKit::setMode):
603         (VideoFullscreenInterfaceAVKit::clearMode):
604         (VideoFullscreenInterfaceAVKit::setHasVideoContentLayer):
605         (VideoFullscreenInterfaceAVKit::setInlineRect):
606         (VideoFullscreenInterfaceAVKit::doSetup):
607         (VideoFullscreenInterfaceAVKit::finalizeSetup):
608         (VideoFullscreenInterfaceAVKit::doEnterFullscreen):
609         (VideoFullscreenInterfaceAVKit::doExitFullscreen):
610         (VideoFullscreenInterfaceAVKit::exitFullscreenHandler):
611         (VideoFullscreenInterfaceAVKit::enterFullscreenHandler):
612         (VideoFullscreenInterfaceAVKit::returnToStandby):
613         * platform/ios/WebVideoFullscreenControllerAVKit.mm:
614         (VideoFullscreenControllerContext::requestUpdateInlineRect):
615         (VideoFullscreenControllerContext::requestVideoContentLayer):
616         (VideoFullscreenControllerContext::returnVideoContentLayer):
617         (VideoFullscreenControllerContext::didSetupFullscreen):
618         (VideoFullscreenControllerContext::didExitFullscreen):
619         (VideoFullscreenControllerContext::setUpFullscreen):
620
621 2017-12-20  Ryosuke Niwa  <rniwa@webkit.org>
622
623         DeferredLoadingScope incorrectly disabled images or enables deferred loading
624         https://bugs.webkit.org/show_bug.cgi?id=181077
625
626         Reviewed by Wenson Hsieh.
627
628         Fixed the bug that DeferredLoadingScope::~DeferredLoadingScope was checking the wrong flag
629         for restoring the disabledness of images and deferred loading.
630
631         Test: editing/pasteboard/pasting-with-images-disabled-should-not-enable-deferred-loading.html
632
633         * editing/cocoa/WebContentReaderCocoa.mm:
634         (WebCore::DeferredLoadingScope::~DeferredLoadingScope): Fixed the bug.
635         * testing/Internals.cpp:
636         (WebCore::Internals::pageDefersLoading): Added for testing.
637         * testing/Internals.h:
638         * testing/Internals.idl: Added pageDefersLoading.
639
640 2017-12-20  Ryosuke Niwa  <rniwa@webkit.org>
641
642         isSafari check should take Safari Technology Preview into account
643         https://bugs.webkit.org/show_bug.cgi?id=181076
644
645         Reviewed by Alex Christensen.
646
647         Fixed isSafari() so that it returns true for Safari Technology Preview. This bug resulted in the custom pasteboard
648         types not being enabled in Safari Technology Preview. In long term, we should eliminate these isSafari() checks.
649
650         * platform/cocoa/RuntimeApplicationChecksCocoa.mm:
651         (WebCore::MacApplication::isSafari):
652
653 2017-12-20  Wenson Hsieh  <wenson_hsieh@apple.com>
654
655         [Attachment Support] Attachment replacement logic should not depend on subresource URL attribute replacement
656         https://bugs.webkit.org/show_bug.cgi?id=181068
657         <rdar://problem/36168313>
658
659         Reviewed by Ryosuke Niwa.
660
661         Refactors attachment replacement logic, so that it doesn't require us to first replace element attributes that
662         contain subresource URLs with blob URLs before performing attachment element replacement. See below comments for
663         more detail.
664
665         Covered by existing API tests in WKAttachmentTests.
666
667         * editing/WebContentReader.h:
668         (WebCore::BlobReplacementInfo::isEmpty const): Deleted.
669
670         Remove BlobReplacementInfo. Instead, augment `replaceRichContentWithAttachments` so that it takes in the list of
671         subresources directly and generates blobs for each subresource.
672
673         * editing/cocoa/EditorCocoa.mm:
674         (WebCore::Editor::replaceSelectionWithAttributedString):
675         * editing/cocoa/WebContentReaderCocoa.mm:
676         (WebCore::shouldReplaceRichContentWithAttachments):
677         (WebCore::createFragmentForImageAttachment):
678         (WebCore::replaceRichContentWithAttachments):
679         (WebCore::createFragmentAndAddResources):
680         (WebCore::sanitizeMarkupWithArchive):
681
682         In these helper functions that currently convert subresource URLs to blob URLs, if attachment elements are not
683         defined out, and the runtime feature for attachment elements is enabled, then use an alternate codepath to
684         adjust the markup (via replaceRichContentWithAttachments).
685
686         Otherwise, fall back to default subresource URL conversion logic, which (at the moment) still converts
687         subresources to blobs, but will soon be changed to emit data URLs instead.
688
689         (WebCore::WebContentReader::readWebArchive):
690         (WebCore::WebContentMarkupReader::readWebArchive):
691         (WebCore::WebContentReader::readRTFD):
692         (WebCore::WebContentMarkupReader::readRTFD):
693         (WebCore::WebContentReader::readRTF):
694         (WebCore::WebContentMarkupReader::readRTF):
695         (WebCore::WebContentReader::readImage):
696
697         Remove the createFragmentFromAttributedString helper and revert to just calling createFragmentAndAddResources.
698
699         (WebCore::createFragmentFromAttributedString): Deleted.
700
701 2017-12-20  Eric Carlson  <eric.carlson@apple.com>
702
703         [MediaStream] Add screen capture IDL and stub functions
704         https://bugs.webkit.org/show_bug.cgi?id=181070
705         <rdar://problem/35555184>
706
707         Reviewed by Youenn Fablet.
708
709         Tests: fast/mediastream/screencapture-disabled.html
710                fast/mediastream/screencapture-enabled.html
711
712         * Modules/mediastream/MediaDevices.cpp:
713         (WebCore::MediaDevices::getDisplayMedia const):
714         (WebCore::MediaDevices::getSupportedConstraints):
715         * Modules/mediastream/MediaDevices.h:
716         * Modules/mediastream/MediaDevices.idl:
717         * Modules/mediastream/MediaTrackConstraints.cpp:
718         (WebCore::convertToInternalForm):
719         * Modules/mediastream/MediaTrackConstraints.h:
720         * Modules/mediastream/MediaTrackConstraints.idl:
721         * Modules/mediastream/MediaTrackSupportedConstraints.h:
722         * Modules/mediastream/MediaTrackSupportedConstraints.idl:
723         * Modules/mediastream/UserMediaRequest.cpp:
724         (WebCore::UserMediaRequest::start):
725         (WebCore::UserMediaRequest::allow):
726         (WebCore::UserMediaRequest::deny):
727         * Modules/mediastream/UserMediaRequest.h:
728         * page/RuntimeEnabledFeatures.h:
729         (WebCore::RuntimeEnabledFeatures::screenCaptureEnabled const):
730         (WebCore::RuntimeEnabledFeatures::setScreenCaptureEnabled):
731         * platform/mediastream/CaptureDevice.h:
732         * platform/mediastream/MediaConstraints.cpp:
733         (WebCore::MediaTrackConstraintSetMap::set):
734         * platform/mediastream/MediaConstraints.h:
735         (WebCore::MediaTrackConstraintSetMap::displaySurface const):
736         (WebCore::MediaTrackConstraintSetMap::logicalSurface const):
737         (WebCore::MediaTrackConstraintSetMap::encode const):
738         (WebCore::MediaTrackConstraintSetMap::decode):
739         * platform/mediastream/MediaStreamRequest.h:
740         * platform/mediastream/RealtimeMediaSource.cpp:
741         (WebCore::RealtimeMediaSource::fitnessDistance):
742         (WebCore::RealtimeMediaSource::applyConstraint):
743         (WebCore::RealtimeMediaSource::supportsConstraint const):
744         * platform/mediastream/RealtimeMediaSourceCenter.cpp:
745         (WebCore::RealtimeMediaSourceCenter::validateRequestConstraints):
746         (WebCore::RealtimeMediaSourceCenter::captureDeviceWithPersistentID):
747         * platform/mediastream/RealtimeMediaSourceSettings.h:
748         (WebCore::RealtimeMediaSourceSettings::supportsDisplaySurface const):
749         (WebCore::RealtimeMediaSourceSettings::displaySurface const):
750         (WebCore::RealtimeMediaSourceSettings::setDisplaySurface):
751         (WebCore::RealtimeMediaSourceSettings::supportsLogicalSurface const):
752         (WebCore::RealtimeMediaSourceSettings::logicalSurface const):
753         (WebCore::RealtimeMediaSourceSettings::setLogicalSurface):
754         * platform/mediastream/RealtimeMediaSourceSupportedConstraints.cpp:
755         (WebCore::RealtimeMediaSourceSupportedConstraints::supportsConstraint const):
756         * platform/mediastream/RealtimeMediaSourceSupportedConstraints.h:
757         (WebCore::RealtimeMediaSourceSupportedConstraints::supportsDisplaySurface const):
758         (WebCore::RealtimeMediaSourceSupportedConstraints::setSupportsDisplaySurface):
759         (WebCore::RealtimeMediaSourceSupportedConstraints::supportsLogicalSurface const):
760         (WebCore::RealtimeMediaSourceSupportedConstraints::setSupportsLogicalSurface):
761         (WebCore::RealtimeMediaSourceSupportedConstraints::encode const):
762         (WebCore::RealtimeMediaSourceSupportedConstraints::decode):
763         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp:
764         * platform/mock/MockRealtimeVideoSource.cpp:
765         * testing/InternalSettings.cpp:
766         (WebCore::InternalSettings::Backup::Backup):
767         (WebCore::InternalSettings::Backup::restoreTo):
768         (WebCore::InternalSettings::setScreenCaptureEnabled):
769         * testing/InternalSettings.h:
770         * testing/InternalSettings.idl:
771
772 2017-12-20  Matt Lewis  <jlewis3@apple.com>
773
774         Unreviewed, rolling out r225656.
775
776         The test has been a flaky timout since being added.
777
778         Reverted changeset:
779
780         "WebAssembly: sending module to iframe fails"
781         https://bugs.webkit.org/show_bug.cgi?id=179263
782         https://trac.webkit.org/changeset/225656
783
784 2017-12-20  Don Olmstead  <don.olmstead@sony.com>
785
786         [Win] Use WCharStringExtras functions in WebCore
787         https://bugs.webkit.org/show_bug.cgi?id=180963
788
789         Reviewed by Alex Christensen.
790
791         No new tests. No change in behavior.
792
793         * platform/graphics/win/FontCacheWin.cpp:
794         (WebCore::appendLinkedFonts):
795         (WebCore::getLinkedFonts):
796         (WebCore::FontCache::systemFallbackForCharacters):
797         (WebCore::FontCache::fontFromDescriptionAndLogFont):
798         * platform/graphics/win/FontCustomPlatformDataCairo.cpp:
799         (WebCore::FontCustomPlatformData::fontPlatformData):
800         * platform/graphics/win/IconWin.cpp:
801         (WebCore::Icon::createIconForFiles):
802         * platform/network/win/DownloadBundleWin.cpp:
803         (WebCore::DownloadBundle::appendResumeData):
804         (WebCore::DownloadBundle::extractResumeData):
805         * platform/text/win/LocaleWin.cpp:
806         (WebCore::LCIDFromLocaleInternal):
807         (WebCore::LCIDFromLocale):
808         * platform/win/ClipboardUtilitiesWin.cpp:
809         (WebCore::getWebLocData):
810         (WebCore::createGlobalData):
811         (WebCore::getFileDescriptorData):
812         (WebCore::getURL):
813         (WebCore::getCFData):
814         (WebCore::setCFData):
815         * platform/win/DragDataWin.cpp:
816         (WebCore::DragData::asFilenames const):
817         * platform/win/DragImageWin.cpp:
818         (WebCore::createDragImageIconForCachedImageFilename):
819         (WebCore::dragLabelFont):
820         * platform/win/FileSystemWin.cpp:
821         (WebCore::FileSystem::getFindData):
822         (WebCore::FileSystem::createSymbolicLink):
823         (WebCore::FileSystem::deleteFile):
824         (WebCore::FileSystem::deleteEmptyDirectory):
825         (WebCore::FileSystem::moveFile):
826         (WebCore::FileSystem::pathByAppendingComponent):
827         (WebCore::FileSystem::makeAllDirectories):
828         (WebCore::FileSystem::pathGetFileName):
829         (WebCore::FileSystem::openTemporaryFile):
830         (WebCore::FileSystem::openFile):
831         (WebCore::FileSystem::hardLinkOrCopyFile):
832         * platform/win/MIMETypeRegistryWin.cpp:
833         (WebCore::mimeTypeForExtension):
834         (WebCore::MIMETypeRegistry::getPreferredExtensionForMIMEType):
835         * platform/win/PasteboardWin.cpp:
836         (WebCore::Pasteboard::read):
837         (WebCore::createGlobalHDropContent):
838         * platform/win/PathWalker.cpp:
839         (WebCore::PathWalker::PathWalker):
840         * platform/win/SSLKeyGeneratorWin.cpp:
841         (WebCore::WebCore::signedPublicKeyAndChallengeString):
842         * platform/win/SharedBufferWin.cpp:
843         (WebCore::SharedBuffer::createFromReadingFile):
844         * rendering/RenderThemeWin.cpp:
845         (WebCore::fillFontDescription):
846
847 2017-12-20  Youenn Fablet  <youenn@apple.com>
848
849         com.apple.WebKit.WebContent.Development crashed in com.apple.WebCore: WebCore::UserMediaRequest::stop + 126
850         https://bugs.webkit.org/show_bug.cgi?id=181057
851
852         Reviewed by Eric Carlson.
853
854         Covered by fast/mediastream tests to not crash anymore.
855
856         * Modules/mediastream/UserMediaRequest.cpp:
857         (WebCore::UserMediaRequest::stop):
858
859 2017-12-20  Brady Eidson  <beidson@apple.com>
860
861         Assertion failure in MessagePort::contextDestroyed in http/tests/security/MessagePort/event-listener-context.html, usually attributed to later tests.
862         https://bugs.webkit.org/show_bug.cgi?id=94458
863
864         Reviewed by Chris Dumez.
865
866         No new tests (Changed existing test to reliably crash before this change, and work after it)
867
868         There was already a glaring FIXME that said "MessagePorts should be ActiveDOMObjects"
869         
870         It was right, and it fixes up this subtle lifetime issue.
871         
872         * dom/MessagePort.cpp:
873         (WebCore::MessagePort::MessagePort):
874         (WebCore::MessagePort::hasPendingActivity const):
875         (WebCore::MessagePort::locallyEntangledPort const):
876         (WebCore::MessagePort::activeDOMObjectName const):
877         (WebCore::MessagePort::hasPendingActivity): Deleted.
878         (WebCore::MessagePort::locallyEntangledPort): Deleted.
879         * dom/MessagePort.h:
880
881         * dom/ScriptExecutionContext.cpp:
882         (WebCore::ScriptExecutionContext::~ScriptExecutionContext):
883         (WebCore::ScriptExecutionContext::stopActiveDOMObjects):
884         (WebCore::ScriptExecutionContext::hasPendingActivity const):
885
886 2017-12-20  Youenn Fablet  <youenn@apple.com>
887
888         Do not search for service worker registration in case of non HTTP navigation loads
889         https://bugs.webkit.org/show_bug.cgi?id=180976
890         <rdar://problem/36157322>
891
892         Unreviewed.
893
894         * loader/DocumentLoader.cpp:
895         (WebCore::DocumentLoader::startLoadingMainResource): Removing unneeded spaces.
896
897 2017-12-20  Alex Christensen  <achristensen@webkit.org>
898
899         Remove some SVN files accidentally committed with r226160
900         https://bugs.webkit.org/show_bug.cgi?id=180934
901
902         * WebCore.xcodeproj/project.pbxproj.orig: Removed.
903         * WebCore.xcodeproj/project.pbxproj.rej: Removed.
904
905 2017-12-20  Zalan Bujtas  <zalan@apple.com>
906
907         [RenderTreeBuilder] Replace remaining addChild calls with RenderTreeBuilder::insert
908         https://bugs.webkit.org/show_bug.cgi?id=181044
909         <rdar://problem/36157613>
910
911         Reviewed by Antti Koivisto.
912
913         Covered by existing test cases.
914
915         * rendering/RenderBlock.cpp:
916         (WebCore::RenderBlock::addChildIgnoringContinuation):
917         * rendering/RenderElement.cpp:
918         (WebCore::RenderElement::addChildIgnoringContinuation):
919         * rendering/RenderElement.h:
920         (WebCore::RenderElement::addChildIgnoringContinuation): Deleted.
921
922 2017-12-20  Daniel Bates  <dabates@apple.com>
923
924         Cleanup: Dereference value of optional directly instead of using checked value in WebCore::subdivide()
925         https://bugs.webkit.org/show_bug.cgi?id=181050
926
927         Reviewed by Simon Fraser.
928
929         It is sufficient and more efficient to dereference a std::optional directly when we know that it has
930         a value as opposed to using the checked dereference member function std::optional<>::value().
931
932         No functionality changed. So, no new tests.
933
934         * rendering/MarkerSubrange.cpp:
935         (WebCore::subdivide):
936
937 2017-12-20  Daniel Bates  <dabates@apple.com>
938
939         MarkerSubrange.SubdivideGrammarAndSelectionOverlap{Frontmost, FrontmostWithLongestEffectiveRange} are failing
940         https://bugs.webkit.org/show_bug.cgi?id=181014
941
942         Reviewed by Simon Fraser.
943
944         Fixes an issue in the subdivision algorithm where the returned subranges may not be paint order
945         or reverse paint order when using the default overlap strategy (OverlapStrategy::None) and
946         either OverlapStrategy::Frontmost or OverlapStrategy::FrontmostWithLongestEffectiveRange, respectively.
947
948         Currently we compute the overlapping subranges up to some point p_i on the line by sweeping from the
949         start of the line through all the unclosed subranges. The unclosed subranges are sorted along the line.
950         That is, they are not sorted by paint order or reverse paint order. Therefore we must take care to
951         ensure that we return the computed overlapping subranges with respect to paint order/reverse paint order.
952
953         * rendering/MarkerSubrange.cpp:
954         (WebCore::subdivide):
955
956 2017-12-20  Youenn Fablet  <youenn@apple.com>
957
958         LayoutTest imported/w3c/web-platform-tests/service-workers/cache-storage/serviceworker/cache-match.https.html is a flaky failure
959         https://bugs.webkit.org/show_bug.cgi?id=179137
960         <rdar://problem/35337335>
961
962         Reviewed by Chris Dumez.
963
964         Covered by unflaked test.
965
966         * workers/service/context/ServiceWorkerThreadProxy.cpp:
967         (WebCore::ServiceWorkerThreadProxy::postTaskToLoader): ThreadableBlobRegistry is using callOnMainThread.
968         Use it also for postTaskToLoader so that there is no race condition between registering a blob and reading it.
969
970 2017-12-20  Youenn Fablet  <youenn@apple.com>
971
972         Support service worker interception of request with blob body
973         https://bugs.webkit.org/show_bug.cgi?id=181035
974
975         Reviewed by Chris Dumez.
976
977         Covered by updated test.
978
979         Add support for getting blob request bodies within service worker.
980         Disable interception of requests with form datas.
981
982         * Modules/fetch/FetchBody.cpp:
983         (WebCore::FetchBody::fromFormData):
984         * Modules/fetch/FetchBody.h:
985         * workers/service/context/ServiceWorkerFetch.cpp:
986         (WebCore::ServiceWorkerFetch::dispatchFetchEvent):
987         * workers/service/context/ServiceWorkerFetch.h:
988         * workers/service/context/ServiceWorkerThread.cpp:
989         (WebCore::ServiceWorkerThread::postFetchTask):
990
991 2017-12-20  Jeremy Jones  <jeremyj@apple.com>
992
993         Send fullscreenChange earlier, in webkitWillEnterFullscreen
994         https://bugs.webkit.org/show_bug.cgi?id=181016
995
996         Reviewed by Jer Noble.
997
998         Sending the event earlier, allows pages to update their interface state before the fullscreen animation.
999         
1000         * dom/Document.cpp:
1001         (WebCore::Document::webkitWillEnterFullScreenForElement):
1002         (WebCore::Document::webkitDidEnterFullScreenForElement):
1003
1004 2017-12-20  Daniel Bates  <dabates@apple.com>
1005
1006         Remove Alternative Presentation Button
1007         https://bugs.webkit.org/show_bug.cgi?id=180500
1008         <rdar://problem/35891047>
1009
1010         Reviewed by Simon Fraser.
1011
1012         We no longer need the alternative presentation button.
1013
1014         * Configurations/FeatureDefines.xcconfig:
1015         * DerivedSources.make:
1016         * English.lproj/Localizable.strings:
1017         * SourcesCocoa.txt:
1018         * WebCore.xcodeproj/project.pbxproj:
1019         * dom/Element.h:
1020         * editing/Editor.cpp:
1021         (WebCore::Editor::clear):
1022         (WebCore::Editor::substituteWithAlternativePresentationButton): Deleted.
1023         (WebCore::Editor::removeAlternativePresentationButton): Deleted.
1024         (WebCore::Editor::elementsReplacedByAlternativePresentationButton): Deleted.
1025         (WebCore::Editor::didInsertAlternativePresentationButtonElement): Deleted.
1026         (WebCore::Editor::didRemoveAlternativePresentationButtonElement): Deleted.
1027         * editing/Editor.h:
1028         * editing/cocoa/AlternativePresentationButtonSubstitution.cpp: Removed.
1029         * editing/cocoa/AlternativePresentationButtonSubstitution.h: Removed.
1030         * html/HTMLInputElement.cpp:
1031         (WebCore::HTMLInputElement::updateType):
1032         (WebCore::HTMLInputElement::parseAttribute):
1033         (WebCore::HTMLInputElement::willAttachRenderers):
1034         (WebCore::HTMLInputElement::alternativePresentationButtonElement const): Deleted.
1035         (WebCore::HTMLInputElement::setTypeWithoutUpdatingAttribute): Deleted.
1036         (WebCore::HTMLInputElement::createInputType): Deleted.
1037         * html/HTMLInputElement.h:
1038         * html/InputType.h:
1039         (WebCore::InputType::alternativePresentationButtonElement const): Deleted.
1040         * html/InputTypeNames.cpp:
1041         (WebCore::InputTypeNames::alternativePresentationButton): Deleted.
1042         * html/InputTypeNames.h:
1043         * html/shadow/cocoa/AlternativePresentationButtonElement.cpp: Removed.
1044         * html/shadow/cocoa/AlternativePresentationButtonElement.h: Removed.
1045         * html/shadow/cocoa/AlternativePresentationButtonInputType.cpp: Removed.
1046         * html/shadow/cocoa/AlternativePresentationButtonInputType.h: Removed.
1047         * page/ChromeClient.h:
1048         * platform/LocalizedStrings.cpp:
1049         (WebCore::AXAlternativePresentationButtonLabel): Deleted.
1050         (WebCore::alternativePresentationButtonTitle): Deleted.
1051         (WebCore::alternativePresentationButtonSubtitle): Deleted.
1052         * platform/LocalizedStrings.h:
1053         * testing/Internals.cpp:
1054         (WebCore::Internals::substituteWithAlternativePresentationButton): Deleted.
1055         (WebCore::Internals::removeAlternativePresentationButton): Deleted.
1056         (WebCore::Internals::elementsReplacedByAlternativePresentationButton): Deleted.
1057         * testing/Internals.h:
1058         * testing/Internals.idl:
1059
1060 2017-12-20  Chris Dumez  <cdumez@apple.com>
1061
1062         Do not reuse resource for memory cache if selected service worker differs
1063         https://bugs.webkit.org/show_bug.cgi?id=181042
1064
1065         Reviewed by Youenn Fablet.
1066
1067         No new tests, rebaselined existing test.
1068
1069         * loader/cache/CachedResource.h:
1070         (WebCore::CachedResource::options const):
1071         * loader/cache/CachedResourceLoader.cpp:
1072         (WebCore::CachedResourceLoader::determineRevalidationPolicy const):
1073
1074 2017-12-20  Youenn Fablet  <youenn@apple.com>
1075
1076         Do not search for service worker registration in case of non HTTP navigation loads
1077         https://bugs.webkit.org/show_bug.cgi?id=180976
1078
1079         Reviewed by Chris Dumez.
1080
1081         Covered by manual testing using perf test app uploaded in https://bugs.webkit.org/show_bug.cgi?id=180929.
1082         In case we are sure there is no possiblity for getting a service worker, skip the search step.
1083         Simialrly, do not report any Document as a Service Worker client if it can never be controlled.
1084         A follow-up patch should handle the case of local URLs service worker selection.
1085
1086         * loader/DocumentLoader.cpp:
1087         (WebCore::DocumentLoader::startLoadingMainResource):
1088         (WebCore::DocumentLoader::commitData):
1089
1090 2017-12-20  Andy Estes  <aestes@apple.com>
1091
1092         [Apple Pay] Tell PassKit whether Apple Pay JS or Payment Request was used to start an Apple Pay session
1093         https://bugs.webkit.org/show_bug.cgi?id=181001
1094         <rdar://problem/35479106>
1095
1096         Reviewed by Tim Horton.
1097
1098         * Modules/applepay/ApplePaySession.cpp:
1099         (WebCore::convertAndValidate):
1100         * Modules/applepay/ApplePaySessionPaymentRequest.h:
1101         (WebCore::ApplePaySessionPaymentRequest::requester const):
1102         (WebCore::ApplePaySessionPaymentRequest::setRequester):
1103         * Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp:
1104         (WebCore::ApplePayPaymentHandler::show):
1105
1106 2017-12-20  Zalan Bujtas  <zalan@apple.com>
1107
1108         [RenderTreeBuilder] Move finding-the-parent/creating-wrapper logic from RenderTable::addChild to RenderTreeBuilder
1109         https://bugs.webkit.org/show_bug.cgi?id=181018
1110         <rdar://problem/36148601>
1111
1112         Reviewed by Antti Koivisto.
1113
1114         This is in preparation for removing all tree mutation from renderering code.
1115
1116         Covered by existing tests.
1117
1118         * rendering/RenderBlock.cpp:
1119         (WebCore::RenderBlock::addChildIgnoringContinuation):
1120         * rendering/RenderTable.cpp:
1121         (WebCore::RenderTable::addChild):
1122         * rendering/updating/RenderTreeBuilder.cpp:
1123         (WebCore::RenderTreeBuilder::insertChild):
1124         * rendering/updating/RenderTreeBuilderTable.cpp:
1125         (WebCore::RenderTreeBuilder::Table::findOrCreateParentForChild):
1126         * rendering/updating/RenderTreeBuilderTable.h:
1127
1128 2017-12-20  Frederic Wang  <fwang@igalia.com>
1129
1130         Split layout of RenderMathMLRow into smaller steps
1131         https://bugs.webkit.org/show_bug.cgi?id=180348
1132
1133         Reviewed by Manuel Rego Casasnovas.
1134
1135         Currently, RenderMathMLRow mixes too many steps in the same layout functions: layout children,
1136         calculate stretch size, stretch vertical operators, calculate final ascent/descent, handle
1137         out-of-flow positioned children, set logical height, set logical width for non-display
1138         <math> tag, center display <math> tag etc This situation is inherited from the old flexbox
1139         implementation but it makes difficult to read the code and to re-use layout & metrics
1140         calculation for follow-up work on <mrow>-like elements (<menclose>, <mapdded>, <msqrt> or
1141         <math>). See for example bug 160547 for <math> or bug 161126 for <menclose>.
1142         This patch rewrites RenderMathMLRow into smaller steps:
1143         - stretchVerticalOperatorsAndLayoutChildren() which calls layoutIfNeeded() or
1144         insertPositionedObject() on children and stretch vertical operators.
1145         - getContentBoundingBox() to determine the metrics of the mrow-like element without calling
1146         layout on children or positioning them, so that we can improve mrow-like element in the
1147         future.
1148         - layoutRowItems() which sets the position of children.
1149
1150         Setting the logical width/height or centering children is now moved into layoutBlock() since
1151         derived class overriding layoutBlock() will do their own adjustment for width, height and
1152         positions.
1153
1154         Test: mathml/mrow-preferred-width-with-out-of-flow-child.html
1155         The rest of the behavior is unchanged and already covered by existing tests.
1156
1157         * rendering/mathml/RenderMathMLMenclose.cpp:
1158         (WebCore::RenderMathMLMenclose::layoutBlock): Use the new function and get contentWidth
1159         directly from getContentBoundingBox().
1160         * rendering/mathml/RenderMathMLPadded.cpp:
1161         (WebCore::RenderMathMLPadded::layoutBlock): Ditto.
1162         * rendering/mathml/RenderMathMLRoot.cpp:
1163         (WebCore::RenderMathMLRoot::layoutBlock): Ditto, also remove useless statement
1164         baseAscent = baseDescent.
1165         * rendering/mathml/RenderMathMLRow.cpp:
1166         (WebCore::toVerticalStretchyOperator): New helper function to cast to a vertical stretchy
1167         operator.
1168         (WebCore::RenderMathMLRow::stretchVerticalOperatorsAndLayoutChildren): New helper function
1169         to ensure layoutIfNeeded()/insertPositionedObject() is called on children and that the
1170         vertical operators are stretched.
1171         (WebCore::RenderMathMLRow::getContentBoundingBox const): New helper function to determine
1172         the width/ascent/descent to use for the mrow content.
1173         (WebCore::RenderMathMLRow::computePreferredLogicalWidths): Skip out-of-flow children in the
1174         preferred width calculation. This is verified by the new test.
1175         (WebCore::RenderMathMLRow::layoutRowItems): Only keep the positioning of children with the
1176         specified width and ascent.
1177         (WebCore::RenderMathMLRow::layoutBlock): Center children for <math display="block"> tag and
1178         set the logical width in other cases. Also set the logical height here.
1179         (WebCore::RenderMathMLRow::computeLineVerticalStretch): Deleted. This work is included in
1180         stretchVerticalOperatorsAndLayoutChildren() now.
1181         * rendering/mathml/RenderMathMLRow.h: Update declaration of functions.
1182
1183 2017-12-20  Antti Koivisto  <antti@apple.com>
1184
1185         Move list and multicolumn building code from RenderTreeUpdater to RenderTreeBuilder
1186         https://bugs.webkit.org/show_bug.cgi?id=181021
1187
1188         Reviewed by Zalan Bujtas.
1189
1190         RenderTreeUpdater::ListItem -> RenderTreeBuilder::List
1191         RenderTreeUpdater::MultiColumn -> RenderTreeBuilder::MultiColumn
1192
1193         * Sources.txt:
1194         * WebCore.xcodeproj/project.pbxproj:
1195         * rendering/TextAutoSizing.cpp:
1196         (WebCore::TextAutoSizingValue::adjustTextNodeSizes):
1197         * rendering/updating/RenderTreeBuilder.cpp:
1198         (WebCore::RenderTreeBuilder::RenderTreeBuilder):
1199         (WebCore::RenderTreeBuilder::updateAfterDescendants):
1200         * rendering/updating/RenderTreeBuilder.h:
1201         (WebCore::RenderTreeBuilder::listBuilder):
1202         (WebCore::RenderTreeBuilder::multiColumnBuilder):
1203         * rendering/updating/RenderTreeBuilderList.cpp: Copied from Source/WebCore/rendering/updating/RenderTreeUpdaterListItem.cpp.
1204         (WebCore::RenderTreeBuilder::List::List):
1205         (WebCore::RenderTreeBuilder::List::updateItemMarker):
1206         (WebCore::RenderTreeUpdater::ListItem::updateMarker): Deleted.
1207         * rendering/updating/RenderTreeBuilderList.h: Copied from Source/WebCore/rendering/updating/RenderTreeUpdaterListItem.h.
1208         * rendering/updating/RenderTreeBuilderMultiColumn.cpp: Copied from Source/WebCore/rendering/updating/RenderTreeUpdaterMultiColumn.cpp.
1209         (WebCore::RenderTreeBuilder::MultiColumn::MultiColumn):
1210         (WebCore::RenderTreeBuilder::MultiColumn::updateAfterDescendants):
1211         (WebCore::RenderTreeBuilder::MultiColumn::createFragmentedFlow):
1212         (WebCore::RenderTreeBuilder::MultiColumn::destroyFragmentedFlow):
1213         (WebCore::RenderTreeUpdater::MultiColumn::update): Deleted.
1214         (WebCore::RenderTreeUpdater::MultiColumn::createFragmentedFlow): Deleted.
1215         (WebCore::RenderTreeUpdater::MultiColumn::destroyFragmentedFlow): Deleted.
1216         * rendering/updating/RenderTreeBuilderMultiColumn.h: Copied from Source/WebCore/rendering/updating/RenderTreeUpdaterMultiColumn.h.
1217         * rendering/updating/RenderTreeUpdater.cpp:
1218         (WebCore::RenderTreeUpdater::commit):
1219         (WebCore::RenderTreeUpdater::updateAfterDescendants):
1220         * rendering/updating/RenderTreeUpdater.h:
1221         * rendering/updating/RenderTreeUpdaterGeneratedContent.cpp:
1222         (WebCore::RenderTreeUpdater::GeneratedContent::updatePseudoElement):
1223         * rendering/updating/RenderTreeUpdaterListItem.cpp: Removed.
1224         * rendering/updating/RenderTreeUpdaterListItem.h: Removed.
1225         * rendering/updating/RenderTreeUpdaterMultiColumn.cpp: Removed.
1226         * rendering/updating/RenderTreeUpdaterMultiColumn.h: Removed.
1227
1228 2017-12-20  Ms2ger  <Ms2ger@igalia.com>
1229
1230         REGRESSION(r226160) Build broken when MEDIA_STREAM is disabled with MediaStreamRequest namespace confusion
1231         https://bugs.webkit.org/show_bug.cgi?id=181026
1232
1233         Unreviewed build fix.
1234
1235         * platform/mediastream/MediaStreamRequest.h: Fix namespace, unconditionally include header.
1236
1237 2017-12-20  Frederic Wang  <fwang@igalia.com>
1238
1239         Refactor RenderMathMLFraction to remove members modified during layout
1240         https://bugs.webkit.org/show_bug.cgi?id=180151
1241
1242         Reviewed by Manuel Rego Casasnovas.
1243
1244         Currently, RenderMathMLFraction has three LayoutUnit members m_defaultLineThickness,
1245         m_lineThickness and m_ascent that are set during layout. In the past such members have caused
1246         MathML rendering bugs due to update issues. This patch refactors the layout of MathML
1247         fractions so that it does not require to store and keep these LayoutUnit members up-to-date.
1248         New helper functions are introduced to perform the simple arithmetic calculations required.
1249
1250         No new tests, behavior unchanged and already covered by existing tests.
1251
1252         * rendering/mathml/RenderMathMLFraction.cpp: We add new helper functions to calculate line
1253         thickness values. This allows to remove updateLineThickness(), m_defaultLineThickness and
1254         m_lineThickness. We also introduce the ascentOverHorizontalAxis() helper function to
1255         calculate the ascent over the middle of its fraction bar or stack gap. This allows to remove
1256         the m_ascent member.
1257         (WebCore::RenderMathMLFraction::defaultLineThickness const): Helper function to calculate
1258         the default thickness of the fraction bar given in the MATH table or a fallback value.
1259         This replaces the use of m_defaultLineThickness.
1260         (WebCore::RenderMathMLFraction::lineThickness const): Helper function to resolve the
1261         actual thickness based on the @linethickness attribute and the default value. This replaces
1262         the use of m_lineThickness.
1263         (WebCore::RenderMathMLFraction::relativeLineThickness const): Rewrite this function using
1264         the new helper functions.
1265         (WebCore::RenderMathMLFraction::fractionParameters const): Make this const and replaces
1266         isStack() with !lineThickness().
1267         (WebCore::RenderMathMLFraction::stackParameters const): Ditto. Also move from layoutBlock
1268         the adjustment of parameters to ensure a minimum gap. Doing so assumes that the fraction is
1269         valid so we add an ASSERT.
1270         (WebCore::RenderMathMLFraction::horizontalOffset const): Make this a const since it does not
1271         mutate anything.
1272         (WebCore::RenderMathMLFraction::ascentOverHorizontalAxis const): Move this code from
1273         layoutBlock() to determine the middle of the stack gap or of the fraction bar. This helper
1274         function replaces m_ascent - mathAxisHeight(). Note that the adjustment of topShiftUp is now
1275         done in stackParameters().
1276         (WebCore::RenderMathMLFraction::layoutBlock): Remove the call to updateLineThickness().
1277         Rely on stackParameters() and ascentOverHorizontalAxis() to perform the necessary calculation
1278         of bottomShiftDown and ascent respectively.
1279         (WebCore::RenderMathMLFraction::paint): Use lineThickness() and ascentOverHorizontalAxis()
1280         instead of m_lineThickness, m_ascent and isStack().
1281         (WebCore::RenderMathMLFraction::firstLineBaseline const): Use ascentOverHorizontalAxis() and
1282         mathAxisHeight() instead of m_ascent.
1283         (WebCore::RenderMathMLFraction::updateLineThickness): Deleted.
1284         * rendering/mathml/RenderMathMLFraction.h: Declare new helper functions for line thickness
1285         values and ascent and remove the old LayoutUnit members. Make horizontalOffset(),
1286         fractionParameter() and stackParameters() const since they do not modify anything and the two
1287         last are used in the const function ascentOverHorizontalAxis(), itself used in
1288         firstLineBaseline().
1289
1290 2017-12-20  Carlos Alberto Lopez Perez  <clopez@igalia.com>
1291
1292         [GTK][Clang] Build fix after r226138
1293         https://bugs.webkit.org/show_bug.cgi?id=180984
1294
1295         Unreviewed build fix.
1296
1297         No new tests, its a build fix.
1298
1299         * rendering/InlineTextBox.cpp:
1300         (WebCore::InlineTextBox::collectSubrangesForDocumentMarkers):
1301
1302 2017-12-20  Ryosuke Niwa  <rniwa@webkit.org>
1303
1304         REGRESSION(r222699): Drag & drop from a web page to Gmail fails
1305         https://bugs.webkit.org/show_bug.cgi?id=181019
1306
1307         Reviewed by Wenson Hsieh.
1308
1309         The bug was caused by imageTypeToFakeFilename returning "image/png" instead of "image.png" for
1310         the filename for a PING image converted from a TIFF image. Fixed the bug by correcting this typo.
1311
1312         Tests: PasteImage.PasteLegacyTIFFImage
1313                PasteImage.PasteTIFFImage 
1314
1315         * platform/cocoa/PasteboardCocoa.mm:
1316         (WebCore::imageTypeToFakeFilename):
1317
1318 2017-12-19  Myles C. Maxfield  <mmaxfield@apple.com>
1319
1320         Refactor user-installed font setting for clarity
1321         https://bugs.webkit.org/show_bug.cgi?id=181013
1322
1323         Reviewed by Simon Fraser.
1324
1325         Pave the way for https://bugs.webkit.org/show_bug.cgi?id=180951.
1326
1327         This patch renames the Setting to not have so many grammatical negatives, and moves
1328         some CoreText-specific FontCache function signatures into a new FontCacheCoreText.h
1329         header file. It also uses the AllowUserInstalledFonts enum class in more places instead
1330         of the old boolean we were using, and puts this enum class in the common TextFlags.h
1331         header.
1332
1333         No new tests because there is no behavior change.
1334
1335         * WebCore.xcodeproj/project.pbxproj:
1336         * css/CSSFontFaceSet.cpp:
1337         (WebCore::CSSFontFaceSet::ensureLocalFontFacesForFamilyRegistered):
1338         * css/StyleResolver.cpp:
1339         (WebCore::StyleResolver::initializeFontStyle):
1340         * page/Settings.yaml:
1341         * platform/graphics/FontCache.h:
1342         (WebCore::SynthesisPair::SynthesisPair): Deleted.
1343         (WebCore::SynthesisPair::boldObliquePair const): Deleted.
1344         * platform/graphics/FontDescription.cpp:
1345         (WebCore::m_shouldAllowUserInstalledFonts):
1346         (WebCore::m_mayRepresentUserInstalledFont): Deleted.
1347         * platform/graphics/FontDescription.h:
1348         (WebCore::FontDescription::shouldAllowUserInstalledFonts const):
1349         (WebCore::FontDescription::setShouldAllowUserInstalledFonts):
1350         (WebCore::FontDescription::operator== const):
1351         (WebCore::FontDescription::mayRepresentUserInstalledFont const): Deleted.
1352         (WebCore::FontDescription::setMayRepresentUserInstalledFont): Deleted.
1353         * platform/graphics/cocoa/FontCacheCoreText.cpp:
1354         (WebCore::FontDatabase::singleton):
1355         (WebCore::FontDatabase::singletonAllowingUserInstalledFonts):
1356         (WebCore::FontDatabase::singletonDisallowingUserInstalledFonts):
1357         (WebCore::FontDatabase::FontDatabase):
1358         (WebCore::platformFontLookupWithFamily):
1359         (WebCore::fontWithFamily):
1360         * platform/graphics/cocoa/FontCacheCoreText.h: Added.
1361         (WebCore::SynthesisPair::SynthesisPair):
1362         (WebCore::SynthesisPair::boldObliquePair const):
1363         * platform/text/TextFlags.h:
1364         * style/StyleResolveForDocument.cpp:
1365         (WebCore::Style::resolveForDocument):
1366
1367 2017-12-19  Youenn Fablet  <youenn@apple.com>
1368
1369         UserMediaRequest should stop a request when Document is being stopped
1370         https://bugs.webkit.org/show_bug.cgi?id=180962
1371
1372         Reviewed by Eric Carlson.
1373
1374         Covered by fast/mediastream/destroy-document-while-enumerating-devices.html not crashing anymore under guardmalloc.
1375         Stopping to wait for the media stream to be active whenDocument goes away.
1376
1377         * Modules/mediastream/UserMediaRequest.cpp:
1378         (WebCore::UserMediaRequest::UserMediaRequest):
1379         (WebCore::UserMediaRequest::stop):
1380         (WebCore::UserMediaRequest::activeDOMObjectName const):
1381         (WebCore::UserMediaRequest::canSuspendForDocumentSuspension const):
1382         (WebCore::UserMediaRequest::contextDestroyed): Deleted.
1383         * Modules/mediastream/UserMediaRequest.h:
1384
1385 2017-12-19  Antti Koivisto  <antti@apple.com>
1386
1387         Move first-letter building code to RenderTreeBuilder
1388         https://bugs.webkit.org/show_bug.cgi?id=180992
1389
1390         Reviewed by Zalan Bujtas.
1391
1392         All special case tree building logic should go to RenderTreeBuilder.
1393
1394         - RenderTreeUpdater::FirstLetter -> RenderTreeBuilder::FirstLetter
1395         - Make the builder non-static and stop using RenderTreeBuilder::current() there.
1396
1397         * Sources.txt:
1398         * WebCore.xcodeproj/project.pbxproj:
1399         * rendering/TextAutoSizing.cpp:
1400         (WebCore::TextAutoSizingValue::adjustTextNodeSizes):
1401         * rendering/updating/RenderTreeBuilder.cpp:
1402         (WebCore::RenderTreeBuilder::RenderTreeBuilder):
1403         (WebCore::RenderTreeBuilder::insertChild):
1404         (WebCore::RenderTreeBuilder::updateAfterDescendants):
1405         * rendering/updating/RenderTreeBuilder.h:
1406         (WebCore::RenderTreeBuilder::firstLetterBuilder):
1407         (WebCore::RenderTreeBuilder::tableBuilder):
1408         * rendering/updating/RenderTreeBuilderFirstLetter.cpp: Copied from rendering/updating/RenderTreeUpdaterFirstLetter.cpp.
1409         (WebCore::supportsFirstLetter):
1410         (WebCore::RenderTreeBuilder::FirstLetter::FirstLetter):
1411         (WebCore::RenderTreeBuilder::FirstLetter::updateAfterDescendants):
1412         (WebCore::RenderTreeBuilder::FirstLetter::updateStyle):
1413         (WebCore::RenderTreeBuilder::FirstLetter::createRenderers):
1414         (WebCore::updateFirstLetterStyle): Deleted.
1415         (WebCore::createFirstLetterRenderer): Deleted.
1416         (WebCore::RenderTreeUpdater::FirstLetter::update): Deleted.
1417         * rendering/updating/RenderTreeBuilderFirstLetter.h: Copied from rendering/updating/RenderTreeUpdaterFirstLetter.h.
1418         * rendering/updating/RenderTreeUpdater.cpp:
1419         (WebCore::RenderTreeUpdater::updateAfterDescendants):
1420         * rendering/updating/RenderTreeUpdater.h:
1421         * rendering/updating/RenderTreeUpdaterFirstLetter.cpp: Removed.
1422         * rendering/updating/RenderTreeUpdaterFirstLetter.h: Removed.
1423
1424 2017-12-19  Chris Dumez  <cdumez@apple.com>
1425
1426         [Fetch] Extracting a body of type Blob should not set Content-Type to the empty string
1427         https://bugs.webkit.org/show_bug.cgi?id=180991
1428
1429         Reviewed by Youenn Fablet.
1430
1431         Extracting a body of type Blob should not set Content-Type to the empty string as per:
1432         - https://fetch.spec.whatwg.org/#concept-bodyinit-extract
1433
1434         No new tests, rebaselined existing test.
1435
1436         * Modules/fetch/FetchBody.cpp:
1437         (WebCore::FetchBody::extract):
1438
1439 2017-12-19  Commit Queue  <commit-queue@webkit.org>
1440
1441         Unreviewed, rolling out r226094.
1442         https://bugs.webkit.org/show_bug.cgi?id=181012
1443
1444         No longer needed to build without error. (Requested by xenon
1445         on #webkit).
1446
1447         Reverted changeset:
1448
1449         "[GTK][WPE] Conditionalize libTASN1 use behind
1450         ENABLE_SUBTLE_CRYPTO in the CMake files"
1451         https://bugs.webkit.org/show_bug.cgi?id=180949
1452         https://trac.webkit.org/changeset/226094
1453
1454 2017-12-19  Eric Carlson  <eric.carlson@apple.com>
1455
1456         [MediaStream] Clean up RealtimeMediaSource interfaces
1457         https://bugs.webkit.org/show_bug.cgi?id=180934
1458         <rdar://problem/36108648>
1459
1460         Reviewed by Youenn Fablet.
1461
1462         No new tests, updated http/tests/media/media-stream/disconnected-frame.html.
1463         
1464         Wrap video and audio constraints in a struct instead of passing both around as separate
1465         parameters. Cleanup up the interface to RealTimeMediaSourceCenter.
1466
1467         * Modules/mediastream/MediaDevices.cpp:
1468         (WebCore::MediaDevices::getUserMedia const):
1469         * Modules/mediastream/MediaDevicesRequest.cpp:
1470         (WebCore::MediaDevicesRequest::start):
1471         * Modules/mediastream/UserMediaRequest.cpp:
1472         (WebCore::UserMediaRequest::create):
1473         (WebCore::UserMediaRequest::UserMediaRequest):
1474         (WebCore::UserMediaRequest::start):
1475         (WebCore::UserMediaRequest::allow):
1476         (WebCore::UserMediaRequest::contextDestroyed):
1477         * Modules/mediastream/UserMediaRequest.h:
1478         (WebCore::UserMediaRequest::request const):
1479         * WebCore.xcodeproj/project.pbxproj:
1480         * platform/mediastream/CaptureDevice.h:
1481         (WebCore::CaptureDevice::persistentId const):
1482         (WebCore::CaptureDevice::label const):
1483         (WebCore::CaptureDevice::groupId const):
1484         (WebCore::CaptureDevice::type const):
1485         (WebCore::CaptureDevice::setPersistentId): Deleted.
1486         (WebCore::CaptureDevice::setLabel): Deleted.
1487         (WebCore::CaptureDevice::setGroupId): Deleted.
1488         (WebCore::CaptureDevice::setType): Deleted.
1489         * platform/mediastream/CaptureDeviceManager.cpp:
1490         (CaptureDeviceManager::getAudioSourcesInfo): Deleted.
1491         (CaptureDeviceManager::getVideoSourcesInfo): Deleted.
1492         (CaptureDeviceManager::deviceWithUID): Deleted.
1493         * platform/mediastream/CaptureDeviceManager.h:
1494         (WebCore::CaptureDeviceManager::captureDeviceWithPersistentID):
1495         (WebCore::CaptureDeviceManager::refreshCaptureDevices):
1496         * platform/mediastream/MediaStreamRequest.h: Copied from Source/WebCore/platform/mediastream/ios/AVAudioSessionCaptureDevice.mm.
1497         (WebCore::MediaStreamRequest::encode const):
1498         (WebCore::MediaStreamRequest::decode):
1499         * platform/mediastream/RealtimeMediaSourceCenter.cpp:
1500         (WebCore::RealtimeMediaSourceCenter::createMediaStream):
1501         (WebCore::RealtimeMediaSourceCenter::getMediaStreamDevices):
1502         (WebCore::RealtimeMediaSourceCenter::validateRequestConstraints):
1503         (WebCore::RealtimeMediaSourceCenter::captureDeviceWithPersistentID):
1504         * platform/mediastream/RealtimeMediaSourceCenter.h:
1505         * platform/mediastream/RealtimeMediaSourceSettings.h:
1506         * platform/mediastream/ios/AVAudioSessionCaptureDevice.mm:
1507         (WebCore::AVAudioSessionCaptureDevice::AVAudioSessionCaptureDevice):
1508         * platform/mediastream/ios/AVAudioSessionCaptureDeviceManager.h:
1509         * platform/mediastream/ios/AVAudioSessionCaptureDeviceManager.mm:
1510         (WebCore::AVAudioSessionCaptureDeviceManager::captureDevices):
1511         (WebCore::AVAudioSessionCaptureDeviceManager::captureDeviceWithPersistentID):
1512         * platform/mediastream/mac/AVCaptureDeviceManager.h:
1513         * platform/mediastream/mac/AVCaptureDeviceManager.mm:
1514         (WebCore::AVCaptureDeviceManager::captureDevicesInternal):
1515         (WebCore::AVCaptureDeviceManager::captureDevices):
1516         (WebCore::AVCaptureDeviceManager::refreshAVCaptureDevicesOfType):
1517         (WebCore::AVCaptureDeviceManager::refreshCaptureDevices):
1518         (WebCore::AVCaptureDeviceManager::deviceDisconnected):
1519         (WebCore::AVCaptureDeviceManager::getAudioSourcesInfo): Deleted.
1520         (WebCore::AVCaptureDeviceManager::getVideoSourcesInfo): Deleted.
1521         * platform/mediastream/mac/CoreAudioCaptureDevice.cpp:
1522         (WebCore::CoreAudioCaptureDevice::CoreAudioCaptureDevice):
1523         * platform/mediastream/mac/CoreAudioCaptureDeviceManager.cpp:
1524         (WebCore::CoreAudioCaptureDeviceManager::captureDevices):
1525         (WebCore::CoreAudioCaptureDeviceManager::captureDeviceWithPersistentID):
1526         (WebCore::CoreAudioCaptureDeviceManager::refreshAudioCaptureDevices):
1527         * platform/mediastream/mac/CoreAudioCaptureDeviceManager.h:
1528         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp:
1529         * platform/mock/MockRealtimeAudioSource.cpp:
1530         (WebCore::MockRealtimeAudioSource::startProducingData):
1531         (WebCore::MockRealtimeAudioSource::createMuted): Deleted.
1532         * platform/mock/MockRealtimeAudioSource.h:
1533         * platform/mock/MockRealtimeMediaSource.cpp:
1534         (WebCore::deviceMap):
1535         (WebCore::MockRealtimeMediaSource::captureDeviceWithPersistentID):
1536         (WebCore::MockRealtimeMediaSource::audioDevices):
1537         (WebCore::MockRealtimeMediaSource::videoDevices):
1538         (WebCore::MockRealtimeMediaSource::MockRealtimeMediaSource):
1539         * platform/mock/MockRealtimeMediaSource.h:
1540         (WebCore::MockRealtimeMediaSource::device const):
1541         (WebCore::MockRealtimeMediaSource::deviceIndex): Deleted.
1542         * platform/mock/MockRealtimeMediaSourceCenter.h:
1543         * platform/mock/MockRealtimeVideoSource.cpp:
1544         (WebCore::MockRealtimeVideoSource::MockRealtimeVideoSource):
1545         (WebCore::MockRealtimeVideoSource::initializeCapabilities):
1546         (WebCore::MockRealtimeVideoSource::generateFrame):
1547         (WebCore::MockRealtimeVideoSource::createMuted): Deleted.
1548         * platform/mock/MockRealtimeVideoSource.h:
1549
1550 2017-12-19  Ryosuke Niwa  <rniwa@webkit.org>
1551
1552         Don't convert pasted content to use blob URL in WebKit1
1553         https://bugs.webkit.org/show_bug.cgi?id=180969
1554
1555         Reviewed by Wenson Hsieh.
1556
1557         Turns out that some WebKit1 clients are relying on being able to see the original URLs of the pasted content;
1558         e.g. not storing content referenced by HTTP/HTTPS protocol as opposed to local files.
1559
1560         This patch restores the behavior prior to r223440 and r222839 for WebKit1 clients by overriding resources in
1561         DocumentLoader instead of converting URLs used in the pasted contents by blob URLs. In addition, this patch
1562         disables the pasteboard sanitization and custom data transfer types for WebKit1 clients as the feature poses
1563         a compatibility concern for WebKit1 clients.
1564
1565         Tests: WebKitLegacy.AccessingImageInPastedRTFD
1566                WebKitLegacy.AccessingImageInPastedWebArchive
1567
1568         * editing/cocoa/WebContentReaderCocoa.mm:
1569         (WebCore::createFragmentAndAddResources):
1570         (WebCore::WebContentReader::readWebArchive):
1571         * page/DeprecatedGlobalSettings.cpp:
1572         (WebCore::DeprecatedGlobalSettings::defaultCustomPasteboardDataEnabled):
1573
1574 2017-12-19  Jer Noble  <jer.noble@apple.com>
1575
1576         Playing media elements which call "pause(); play()" will have the play promise rejected.
1577         https://bugs.webkit.org/show_bug.cgi?id=180781
1578         <rdar://problem/33191377>
1579
1580         Reviewed by Eric Carlson.
1581
1582         Follow-up to address failing iOS API tests. Rather than skipping the call to
1583         prepareForLoad() in the case where media elements are not allowed to load data,
1584         unconditionally call prepareForLoad(), but conditionally call selectMediaResource() inside
1585         that function only if the media elemnet is allowed to load. This ensures that the
1586         MediaPlayer is created when play(), pause(), or load() are called during a user gesture
1587         later, and selectMediaResource() (which depends on having a non-null m_player) is called.
1588
1589         * html/HTMLMediaElement.cpp:
1590         (WebCore::HTMLMediaElement::parseAttribute):
1591         (WebCore::HTMLMediaElement::insertedIntoAncestor):
1592         (WebCore::HTMLMediaElement::load):
1593         (WebCore::HTMLMediaElement::prepareForLoad):
1594         (WebCore::HTMLMediaElement::playInternal):
1595
1596 2017-12-19  Timothy Hatcher  <timothy@hatcher.name>
1597
1598         Build failure in WebGL2 when Video feature is disabled
1599         https://bugs.webkit.org/show_bug.cgi?id=180946
1600
1601         Reviewed by Brian Burg.
1602
1603         * html/canvas/WebGL2RenderingContext.h: Make TexImageSource conditional on ENABLE(VIDEO).
1604         * html/canvas/WebGL2RenderingContext.idl: Ditto.
1605
1606 2017-12-19  Chris Dumez  <cdumez@apple.com>
1607
1608         scopeURL should start with the provided scriptURL
1609         https://bugs.webkit.org/show_bug.cgi?id=180983
1610
1611         Reviewed by Youenn Fablet.
1612
1613         scopeURL should start with the provided scriptURL, as per:
1614         - https://w3c.github.io/ServiceWorker/#update (steps 7.8 to 7.18)
1615
1616         No new tests, rebaselined existing tests.
1617
1618         * platform/network/HTTPHeaderNames.in:
1619         * workers/service/ServiceWorkerJob.cpp:
1620         (WebCore::ServiceWorkerJob::didReceiveResponse):
1621
1622 2017-12-19  Zalan Bujtas  <zalan@apple.com>
1623
1624         [RenderTreeBuilder] Move finding-the-parent/creating-wrapper logic from RenderTableSection::addChild to RenderTreeBuilder
1625         https://bugs.webkit.org/show_bug.cgi?id=180994
1626         <rdar://problem/36139222>
1627
1628         Reviewed by Antti Koivisto.
1629
1630         This is in preparation for removing all tree mutation from renderering code.
1631
1632         Covered by existing tests.
1633
1634         * rendering/RenderTableSection.cpp:
1635         (WebCore::RenderTableSection::addChild):
1636         * rendering/updating/RenderTreeBuilder.cpp:
1637         (WebCore::RenderTreeBuilder::insertChild):
1638         * rendering/updating/RenderTreeBuilderTable.cpp:
1639         (WebCore::RenderTreeBuilder::Table::findOrCreateParentForChild):
1640         * rendering/updating/RenderTreeBuilderTable.h:
1641
1642 2017-12-19  Daniel Bates  <dabates@apple.com>
1643
1644         Implement InlineTextBox painting using marker subranges
1645         https://bugs.webkit.org/show_bug.cgi?id=180984
1646         <rdar://problem/36139364>
1647
1648         Reviewed by David Hyatt.
1649
1650         As a step towards implementing CSS Pseudo-Elements Module Level 4, explicitly decompose a
1651         text line into subrange objects that may be styled (say, to give the appearance of selected
1652         text) and painted.
1653
1654         No functionality changed. So, no new tests.
1655
1656         * rendering/InlineTextBox.cpp:
1657         (WebCore::InlineTextBox::localSelectionRect const): Update comments.
1658
1659         (WebCore::InlineTextBox::MarkerSubrangeStyle::operator== const):
1660         (WebCore::InlineTextBox::MarkerSubrangeStyle::operator!= const):
1661         (WebCore::InlineTextBox::StyledMarkerSubrange::StyledMarkerSubrange):
1662         Define a subclass to represent a marker subrange that has associated style information.
1663         We will make use of the style information when painting the subrange.
1664
1665         (WebCore::createMarkerSubrangeFromSelectionInBox): Convenience function to instantiate a
1666         MarkerSubrange instance from the current selection of a specified text box.
1667
1668         (WebCore::InlineTextBox::paint): Write in terms of MarkerSubrange. We keep composition backgrounds
1669         and composition underlines as special cases for now. We represent all other subranges of the line
1670         as MarkerSubrange instances, including unmarked text (i.e. non-selected text without an associated
1671         document marker). The subranges for the gaps between document markers and selection are implicitly
1672         created by subdividing the entire line. Support for PaintBehaviorExcludeSelection is implemented
1673         by subdividing the entire line with the selection subrange and then removing the selection subrange
1674         from the resulting list of subdivisions before painting with the resulting list.
1675
1676         (WebCore::InlineTextBox::paintPlatformDocumentMarkers): Renamed; formerly named paintDocumentMarkers.
1677         (WebCore::InlineTextBox::paintPlatformDocumentMarker): Renamed; formerly named paintDocumentMarker.
1678
1679         (WebCore::InlineTextBox::computeStyleForUnmarkedMarkerSubrange const): Convenience function to
1680         compute the style for unmarked text.
1681
1682         (WebCore::InlineTextBox::resolveStyleForSubrange): Added
1683
1684         (WebCore::InlineTextBox::subdivideAndResolveStyle): Subdivides the list of marker subranges and
1685         coalesces subranges of the same type (e.g. selection) or with the same style. The latter strategy
1686         preserves the optimization of drawing the text of the entire line in one draw command when we know
1687         that the selected text looks identical to non-selected text. This optimization was performed in TextPainter::paint().
1688
1689         (WebCore::InlineTextBox::collectSubrangesForDraggedContent): Added.
1690         (WebCore::InlineTextBox::collectSubrangesForDocumentMarkers): Added.
1691         (WebCore::InlineTextBox::textOriginFromBoxRect const): Added.
1692
1693         (WebCore::InlineTextBox::paintMarkerSubranges):
1694         (WebCore::InlineTextBox::paintTextSubrangeBackground):
1695         (WebCore::InlineTextBox::paintTextSubrangeForeground):
1696         (WebCore::InlineTextBox::paintTextSubrangeDecoration):
1697         Paint the marker subrange.
1698
1699         (WebCore::InlineTextBox::paintCompositionBackground): Moved function to group it with the logic to
1700         paint composition underlines. Modified to pass clamped offsets to paintTextSubrangeBackground() as
1701         paintTextSubrangeBackground() now expects them.
1702
1703         (WebCore::mirrorRTLSegment): Moved function to be above paintCompositionUnderline() as it is the only
1704         function that makes use of it.
1705
1706         (WebCore::InlineTextBox::paintSelection): Deleted.
1707         (WebCore::InlineTextBox::paintTextMatchMarker): Deleted.
1708         (WebCore::InlineTextBox::paintDecoration): Deleted.
1709         (WebCore::InlineTextBox::paintDocumentMarker): Deleted; renamed to paintPlatformDocumentMarker.
1710         (WebCore::InlineTextBox::paintDocumentMarkers): Deleted; renamed to paintPlatformDocumentMarkers.
1711         * rendering/InlineTextBox.h:
1712         (WebCore::InlineTextBox::paintMarkerSubranges): Added.
1713         * rendering/MarkerSubrange.h:
1714         (WebCore::MarkerSubrange::isEmpty const): Added.
1715         (WebCore::MarkerSubrange::operator!= const): Added.
1716         (WebCore::MarkerSubrange::operator== const): Added.
1717         * rendering/SimpleLineLayoutFunctions.cpp:
1718         (WebCore::SimpleLineLayout::paintFlow): Updated code as we no longer need to pass the text run length
1719         to TextPainter::paint(). Also modernize the code while I am here.
1720         * rendering/TextDecorationPainter.cpp:
1721         (WebCore::TextDecorationPainter::Styles::operator== const): Added.
1722         (WebCore::TextDecorationPainter::TextDecorationPainter): Modified to take an optional TextDecorationPainter::Styles
1723         instance as an argument and removed the unused parameter for PseudoId.
1724         * rendering/TextDecorationPainter.h:
1725         (WebCore::TextDecorationPainter::Styles::operator!= const): Added.
1726         * rendering/TextPaintStyle.cpp:
1727         (WebCore::TextPaintStyle::operator== const): Added.
1728         (WebCore::computeTextSelectionPaintStyle): Removed the now unused out-arguments paintSelectedTextOnly, paintSelectedTextSeparately,
1729         and paintNonSelectedTextOnly. The values stored in these out-arguments were intended to be used by the caller to
1730         minimize the number of drawing commands. The value of paintSelectedTextSeparately indicated whether selected text
1731         would look identical to non-selected text so that a caller could use one paint command to draw the entire line
1732         instead of issuing two or more drawing commands to paint non-selected and selected text separately. We now
1733         accomplish the same optimization by coalescing subrange styles in InlineTextBox::subdivideAndResolveStyle().
1734         The value of paintNonSelectedTextOnly, as its name states, indicated whether a caller should only paint non-selected
1735         text and hence skip painting of selected text. This value was only used when painting dragged content (i.e. DocumentMarker::DraggedContent
1736         markers) and its effect is now more directly achieved by the dragged content logic in InlineTextBox::paint().
1737         * rendering/TextPaintStyle.h:
1738         (WebCore::TextPaintStyle::operator!= const): Added.
1739         * rendering/TextPainter.cpp:
1740         (WebCore::TextPainter::paint): Implemented in terms TextPainter::paintRange() now that InlineTextBox::paint() optimizes
1741         for the number of drawing calls. See remarks for WebCore::computeTextSelectionPaintStyle() for more details.
1742         * rendering/TextPainter.h: Group together related member functions.
1743         (WebCore::TextPainter::setSelectionStyle): Deleted.
1744         (WebCore::TextPainter::setSelectionShadow): Deleted.
1745
1746 2017-12-19  Daniel Bates  <dabates@apple.com>
1747
1748         Add support for computing the frontmost longest effective marker subrange
1749         https://bugs.webkit.org/show_bug.cgi?id=180985
1750
1751         Reviewed by Dave Hyatt.
1752
1753         Add a new subdivision overlap strategy to return the minimum list of maximal length non-
1754         overlapping subranges. We will make use of this strategy together with an algorithm to
1755         coalesce adjacent subranges with visually indistinct styles to minimize the total number
1756         of drawing commands needed to paint an entire line of text. We are not making use of
1757         this functionality now. We will make use of it to simplify the patch for <https://bugs.webkit.org/show_bug.cgi?id=180984>.
1758
1759         * rendering/MarkerSubrange.cpp:
1760         (WebCore::subdivide):
1761         * rendering/MarkerSubrange.h:
1762
1763 2017-12-19  Chris Dumez  <cdumez@apple.com>
1764
1765         Handle Fetch should wait for the service worker's state to become activated
1766         https://bugs.webkit.org/show_bug.cgi?id=180959
1767
1768         Reviewed by Youenn Fablet.
1769
1770         Handle Fetch should wait for the service worker's state to become activated when
1771         it is currently activating.
1772
1773         Specification:
1774         - https://w3c.github.io/ServiceWorker/#on-fetch-request-algorithm (Step 16)
1775
1776         No new tests, rebaselined existing test.
1777
1778         * workers/service/server/SWServerWorker.cpp:
1779         (WebCore::SWServerWorker::~SWServerWorker):
1780         (WebCore::SWServerWorker::whenActivated):
1781         (WebCore::SWServerWorker::setState):
1782         (WebCore::SWServerWorker::callWhenActivatedHandler):
1783         * workers/service/server/SWServerWorker.h:
1784
1785 2017-12-19  Yusuke Suzuki  <utatane.tea@gmail.com>
1786
1787         [YARR] Yarr should return ErrorCode instead of error messages (const char*)
1788         https://bugs.webkit.org/show_bug.cgi?id=180966
1789
1790         Reviewed by Mark Lam.
1791
1792         Remove unnecessary String creation.
1793
1794         No behavior change.
1795
1796         * contentextensions/URLFilterParser.cpp:
1797         (WebCore::ContentExtensions::URLFilterParser::addPattern):
1798
1799 2017-12-19  Zalan Bujtas  <zalan@apple.com>
1800
1801         [RenderTreeBuilder] Move finding-the-parent/creating-wrapper logic from RenderTableRow::addChild to RenderTreeBuilder
1802         https://bugs.webkit.org/show_bug.cgi?id=180964
1803         <rdar://problem/36123315>
1804
1805         Reviewed by Antti Koivisto.
1806
1807         This is in preparation for removing all tree mutation from renderering code.
1808
1809         Covered by existing tests.
1810
1811         * Sources.txt:
1812         * WebCore.xcodeproj/project.pbxproj:
1813         * rendering/RenderTableRow.cpp:
1814         (WebCore::RenderTableRow::addChild):
1815         * rendering/updating/RenderTreeBuilder.cpp:
1816         (WebCore::RenderTreeBuilder::insertChild):
1817         * rendering/updating/RenderTreeBuilder.h:
1818         * rendering/updating/RenderTreeBuilderTable.cpp: Added.
1819         (WebCore::RenderTreeBuilder::Table::findOrCreateParentForChild):
1820         * rendering/updating/RenderTreeBuilderTable.h: Copied from Source/WebCore/rendering/updating/RenderTreeBuilder.h.
1821
1822 2017-12-19  Youenn Fablet  <youenn@apple.com>
1823
1824         Service Worker should not clean HTTP headers added by the application or by fetch specification before service worker interception
1825         https://bugs.webkit.org/show_bug.cgi?id=180939
1826
1827         Reviewed by Chris Dumez.
1828
1829         Covered by modified WPT test.
1830
1831         Add support to clean only specific headers in cleanHTTPRequestHeadersForAccessControl,
1832         renamed from cleanRedirectedRequestForAccessControl.
1833         Compute the list of headers to keep in DocumentThreadableLoader.
1834         Add a specific rule for Accept header which is set prior service worker interception and for
1835         HTTP headers set by DocumentThreadableLoader clients.
1836
1837         * loader/CrossOriginAccessControl.cpp:
1838         (WebCore::httpHeadersToKeepFromCleaning):
1839         (WebCore::cleanRedirectedRequestForAccessControl):
1840         * loader/CrossOriginAccessControl.h:
1841         (WebCore::cleanRedirectedRequestForAccessControl):
1842         * loader/DocumentThreadableLoader.cpp:
1843         (WebCore::DocumentThreadableLoader::DocumentThreadableLoader):
1844         * loader/ResourceLoaderOptions.h:
1845         * workers/service/context/ServiceWorkerFetch.cpp:
1846         (WebCore::ServiceWorkerFetch::dispatchFetchEvent):
1847         * workers/service/context/ServiceWorkerFetch.h:
1848         * workers/service/context/ServiceWorkerThread.cpp:
1849         (WebCore::ServiceWorkerThread::postFetchTask):
1850         * workers/service/context/ServiceWorkerThread.h:
1851
1852 2017-12-19  Andy Estes  <aestes@apple.com>
1853
1854         [Apple Pay] Stop maintaining a list of payment networks
1855         https://bugs.webkit.org/show_bug.cgi?id=180965
1856         <rdar://problem/34696560>
1857
1858         Reviewed by Tim Horton.
1859
1860         Instead of maintaining the list of valid payment networks in WebCore, allow the client to
1861         provide the list when constructing a PaymentCoordinator. Then, use PaymentCoordinator's list
1862         to validate ApplePaySessionPaymentRequests.
1863
1864         Validation will now be done case-insensitively since Cocoa clients will provide a list of
1865         network names that differ in capitalization from the names formerly accepted by WebCore.
1866
1867         Added new test cases to http/tests/ssl/applepay/ApplePaySession.html.
1868
1869         * Modules/applepay/ApplePayRequestBase.cpp:
1870         (WebCore::convertAndValidate): Changed to return a Vector of validated strings.
1871         (WebCore::validate): Renamed to convertAndValidate.
1872         * Modules/applepay/ApplePayRequestBase.h:
1873         * Modules/applepay/ApplePaySession.cpp:
1874         (WebCore::convertAndValidate):
1875         (WebCore::ApplePaySession::create):
1876         * Modules/applepay/ApplePaySessionPaymentRequest.cpp:
1877         (WebCore::ApplePaySessionPaymentRequest::isValidSupportedNetwork): Deleted.
1878         * Modules/applepay/ApplePaySessionPaymentRequest.h:
1879         * Modules/applepay/PaymentCoordinator.cpp:
1880         (WebCore::toHashSet):
1881         (WebCore::PaymentCoordinator::PaymentCoordinator): Converted availablePaymentNetworks to a
1882         case-insensitive HashSet and stored in m_availablePaymentNetworks.
1883         (WebCore::PaymentCoordinator::validatedPaymentNetwork const): Added special cases for "jcb"
1884         and "carteBancaire" for API compatibility. For other networks, checked m_availablePaymentNetworks.
1885         * Modules/applepay/PaymentCoordinator.h:
1886         * Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp:
1887         (WebCore::ApplePayPaymentHandler::show):
1888         * page/MainFrame.cpp:
1889         (WebCore::MainFrame::MainFrame): Constructed m_paymentCoordinator with configuration.availablePaymentNetworks.
1890         * page/PageConfiguration.h:
1891         * testing/Internals.cpp:
1892         (WebCore::Internals::Internals):
1893         * testing/MockPaymentCoordinator.cpp:
1894         * testing/MockPaymentCoordinator.h:
1895
1896 2017-12-19  Wenson Hsieh  <wenson_hsieh@apple.com>
1897
1898         Unreviewed, try to fix the Windows build after r226097.
1899
1900         * editing/markup.cpp:
1901         (WebCore::StyledMarkupAccumulator::appendCustomAttributes):
1902
1903 2017-12-18  Andy Estes  <aestes@apple.com>
1904
1905         [Apple Pay] Only include phonetic name properties in ApplePayPaymentContact when version >= 3
1906         https://bugs.webkit.org/show_bug.cgi?id=180925
1907         <rdar://problem/35907596>
1908
1909         Reviewed by Tim Horton.
1910
1911         No tests possible. The fix involves converting PKContacts, which we can't create in our test harness.
1912
1913         * Modules/applepay/ApplePayPaymentAuthorizedEvent.cpp:
1914         (WebCore::ApplePayPaymentAuthorizedEvent::ApplePayPaymentAuthorizedEvent):
1915         * Modules/applepay/ApplePayPaymentAuthorizedEvent.h:
1916         * Modules/applepay/ApplePaySession.cpp:
1917         (WebCore::ApplePaySession::create):
1918         (WebCore::ApplePaySession::ApplePaySession):
1919         (WebCore::ApplePaySession::version const):
1920         (WebCore::ApplePaySession::didAuthorizePayment):
1921         (WebCore::ApplePaySession::didSelectShippingContact):
1922         * Modules/applepay/ApplePaySession.h:
1923         * Modules/applepay/ApplePayShippingContactSelectedEvent.cpp:
1924         (WebCore::ApplePayShippingContactSelectedEvent::ApplePayShippingContactSelectedEvent):
1925         * Modules/applepay/ApplePayShippingContactSelectedEvent.h:
1926         * Modules/applepay/Payment.h:
1927         * Modules/applepay/PaymentContact.h:
1928         * Modules/applepay/PaymentCoordinator.cpp:
1929         (WebCore::PaymentCoordinator::supportsVersion const):
1930         (WebCore::PaymentCoordinator::supportsVersion): Deleted.
1931         * Modules/applepay/PaymentCoordinator.h:
1932         * Modules/applepay/PaymentSession.h:
1933         * Modules/applepay/cocoa/PaymentCocoa.mm:
1934         (WebCore::convert):
1935         (WebCore::Payment::toApplePayPayment const):
1936         * Modules/applepay/cocoa/PaymentContactCocoa.mm:
1937         (WebCore::convert):
1938         (WebCore::PaymentContact::toApplePayPaymentContact const):
1939         * Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp:
1940         (WebCore::ApplePayPaymentHandler::document const):
1941         (WebCore::ApplePayPaymentHandler::paymentCoordinator const):
1942         (WebCore::ApplePayPaymentHandler::version const):
1943         (WebCore::ApplePayPaymentHandler::didAuthorizePayment):
1944         (WebCore::ApplePayPaymentHandler::didSelectShippingContact):
1945         (WebCore::ApplePayPaymentHandler::document): Deleted.
1946         (WebCore::ApplePayPaymentHandler::paymentCoordinator): Deleted.
1947         * Modules/applepay/paymentrequest/ApplePayPaymentHandler.h:
1948
1949 2017-12-18  Wenson Hsieh  <wenson_hsieh@apple.com>
1950
1951         [Attachment Support] The 'webkitattachmentbloburl' attribute should not persist after markup serialization
1952         https://bugs.webkit.org/show_bug.cgi?id=180924
1953         <rdar://problem/36099093>
1954
1955         Reviewed by Tim Horton.
1956
1957         Work towards dragging Blob-backed attachment elements as files on iOS and Mac. It doesn't make sense for the
1958         attachment blob URL to stick around on the element after markup serialization, so this patch removes logic that
1959         eagerly sets the blob URL upon setting an attachment's File. Instead, we just append this attribute when
1960         generating markup.
1961
1962         This patch also augments existing WKAttachmentTests to ensure that these attributes are not present.
1963
1964         * editing/markup.cpp:
1965         (WebCore::StyledMarkupAccumulator::appendCustomAttributes):
1966         (WebCore::createFragmentFromMarkup):
1967         * html/HTMLAttachmentElement.cpp:
1968         (WebCore::HTMLAttachmentElement::setFile):
1969         * rendering/HitTestResult.cpp:
1970
1971         Fixes a related issue where an attachment is backed by Blob data (and not a file path) would specify "file:///"
1972         as its attachment file path in DragController when starting a drag. Instead, if there is no file path, fall back
1973         to the blob URL.
1974
1975         This will be tested in a future patch once a WK2 dragging simulator for Mac is implemented, and support for
1976         dragging out Blob-backed attachments as (platform) files is implemented.
1977
1978         (WebCore::HitTestResult::absoluteAttachmentURL const):
1979
1980 2017-12-18  Chris Dumez  <cdumez@apple.com>
1981
1982         Default scope used when registering a service worker is wrong
1983         https://bugs.webkit.org/show_bug.cgi?id=180961
1984
1985         Reviewed by Youenn Fablet.
1986
1987         The default scope we used when registering a service worker was wrong, it did not match:
1988         - https://w3c.github.io/ServiceWorker/#start-register (Step 4)
1989
1990         This patch aligns our behavior with the specification.
1991
1992         No new tests, rebaselined existing test.
1993
1994         * workers/service/ServiceWorkerContainer.cpp:
1995         (WebCore::ServiceWorkerContainer::addRegistration):
1996
1997 2017-12-18  Ryosuke Niwa  <rniwa@webkit.org>
1998
1999         Assertion hit in DocumentOrderedMap::get while removing a form element
2000         https://bugs.webkit.org/show_bug.cgi?id=137959
2001         <rdar://problem/27702012>
2002
2003         Reviewed by Brent Fulgham.
2004
2005         The assertion failure was caused by FormAssociatedElement::findAssociatedForm calling TreeScope::getElementById
2006         for a form associated element inside FormAttributeTargetObserver::idTargetChanged during the removal of
2007         the owner form element, or the first non-form element with the matching ID. If there are other elements with
2008         the same ID in the removed tree at that moment, MapEntry's count for the ID can be higher than it needs to be
2009         since Element::removedFromAncestor has not been called on those elements yet.
2010
2011         Fixed the bug by checking this condition explicitly. This patch introduces ContainerChildRemovalScope which
2012         keeps track of the container node from which a subtree was removed as well as the root of the removed subtree.
2013         DocumentOrderedMap::get then checks whether the matching element can be found in this removed subtree, and its
2014         isConnected() still returns true (the evidence that Element::removedFromAncestor has not been called) when
2015         count > 0 and there was no matching element in the tree scope.
2016
2017         In the long term, we should refactor the way FormAssociatedElement and HTMLFormElement refers to each other
2018         and avoid calling DocumentOrderedMap::get before finish calling removedFromAncestor on the removed subtree.
2019
2020         Tests: fast/forms/update-form-owner-in-moved-subtree-assertion-failure-5.html
2021                fast/forms/update-form-owner-in-moved-subtree-assertion-failure-6.html
2022
2023         * dom/ContainerNodeAlgorithms.cpp:
2024         (WebCore::notifyChildNodeRemoved):
2025         * dom/ContainerNodeAlgorithms.h:
2026         (WebCore::ContainerChildRemovalScope): Added.
2027         (WebCore::ContainerChildRemovalScope::ContainerChildRemovalScope):
2028         (WebCore::ContainerChildRemovalScope::~ContainerChildRemovalScope):
2029         (WebCore::ContainerChildRemovalScope::parentOfRemovedTree):
2030         (WebCore::ContainerChildRemovalScope::removedChild):
2031         (WebCore::ContainerChildRemovalScope::currentScope):
2032         * dom/DocumentOrderedMap.cpp:
2033         (WebCore::DocumentOrderedMap::get const): Added a special early exit when this function is called during
2034         a node removal.
2035
2036 2017-12-18  Timothy Hatcher  <timothy@hatcher.name>
2037
2038         [GTK][WPE] Conditionalize libTASN1 use behind ENABLE_SUBTLE_CRYPTO in the CMake files
2039         https://bugs.webkit.org/show_bug.cgi?id=180949
2040
2041         Reviewed by Carlos Alberto Lopez Perez.
2042
2043         * PlatformGTK.cmake: Move the include path and library additions to conditional ENABLE_SUBTLE_CRYPTO section.
2044         * PlatformWPE.cmake: Ditto.
2045
2046 2017-12-18  Wenson Hsieh  <wenson_hsieh@apple.com>
2047
2048         [Attachment Support] Support representing pasted or dropped content using attachment elements
2049         https://bugs.webkit.org/show_bug.cgi?id=180892
2050         <rdar://problem/36064210>
2051
2052         Reviewed by Tim Horton.
2053
2054         Support dropping and pasting attributed strings that contain NSTextAttachments. Teaches
2055         replaceRichContentWithAttachmentsIfNecessary to replace object elements with attachments; see comments below for
2056         more details.
2057
2058         Test: WKAttachmentTests.InsertPastedAttributedStringContainingMultipleAttachments
2059
2060         * editing/WebContentReader.h:
2061
2062         Add BlobReplacementInfo, which contains a map of blob URLs to replacement Blobs, as well as a map of blob URLs
2063         to replaced subresource URLs.
2064
2065         (WebCore::BlobReplacementInfo::isEmpty const):
2066         * editing/cocoa/EditorCocoa.mm:
2067         (WebCore::Editor::replaceSelectionWithAttributedString):
2068         * editing/cocoa/WebArchiveResourceFromNSAttributedString.h:
2069         * editing/cocoa/WebArchiveResourceFromNSAttributedString.mm:
2070
2071         Implement -[WebArchiveResourceFromNSAttributedString MIMEType]. UIFoundation asks for -MIMEType in the process
2072         of generating markup from NSTextAttachments; this currently causes the web process to crash on an unrecognized
2073         selector.
2074
2075         Additionally, work around <rdar://problem/36074429>, a UIFoundation bug in which all but a few hard-coded file
2076         extensions actually yield MIME types that are more specific than "application/octet-stream". This can safely be
2077         removed once <rdar://problem/36074429> is addressed.
2078
2079         (-[WebArchiveResourceFromNSAttributedString MIMEType]):
2080         * editing/cocoa/WebContentReaderCocoa.mm:
2081         (WebCore::replaceRichContentWithAttachmentsIfNecessary):
2082
2083         Try to replace object elements with attachments, and also tweak the title of the attachment's File to use the
2084         replaced subresource's filename if possible. Additionally, abstracts out information for replacing object or
2085         image elements (formerly a pair of { File, Element }) into a separate struct, and add a AttachmentDisplayMode
2086         parameter to determine whether the attachment should be presented in-line (in the case of images), or as an icon.
2087
2088         (WebCore::attributesForAttributedStringConversion):
2089
2090         Only exclude object elements from being generated from NSTextAttachments if the attachment element runtime
2091         feature is disabled, or !ENABLE(ATTACHMENT_ELEMENT).
2092
2093         (WebCore::createFragmentAndAddResources):
2094
2095         Additionally keep track of a mapping from blob URL => replaced subresource URL. In all the places where we
2096         previously only plumbed a map of blob URL => Blob, use a BlobReplacementInfo struct instead, which now includes
2097         a map from blob URL => replaced URL.
2098
2099         (WebCore::sanitizeMarkupWithArchive):
2100         (WebCore::WebContentReader::readWebArchive):
2101         (WebCore::WebContentMarkupReader::readWebArchive):
2102         (WebCore::WebContentReader::readRTFD):
2103         (WebCore::WebContentMarkupReader::readRTFD):
2104         (WebCore::WebContentReader::readRTF):
2105         (WebCore::WebContentMarkupReader::readRTF):
2106         (WebCore::WebContentReader::readImage):
2107
2108 2017-12-18  Youenn Fablet  <youenn@apple.com>
2109
2110         Service worker served response tainting should keep its tainting
2111         https://bugs.webkit.org/show_bug.cgi?id=180952
2112
2113         Reviewed by Chris Dumez.
2114
2115         Covered by rebased tests.
2116
2117         * loader/cache/CachedResource.cpp:
2118         (WebCore::CachedResource::setResponse):
2119
2120 2017-12-18  Wenson Hsieh  <wenson_hsieh@apple.com>
2121
2122         Unreviewed, attempt to fix watch and TV builds after r226085
2123
2124         Explicitly include a header in WebContentReaderCocoa.mm.
2125
2126         * editing/cocoa/WebContentReaderCocoa.mm:
2127
2128 2017-12-18  Brady Eidson  <beidson@apple.com>
2129
2130         Add ability to API test Service Workers via a custom protocol.
2131         https://bugs.webkit.org/show_bug.cgi?id=180911
2132
2133         Reviewed by Chris Dumez.
2134
2135         Covered by API test ServiceWorkers.Basic
2136
2137         This adds a set of "Service Workers can handle this" schemes to the scheme registry
2138         and uses it for SW decisions instead of a handful of previous techniques.
2139
2140         * bindings/scripts/CodeGeneratorJS.pm:
2141         (NeedsRuntimeCheck):
2142         (GenerateRuntimeEnableConditionalString):
2143         * bindings/scripts/IDLAttributes.json:
2144
2145         * dom/ScriptExecutionContext.cpp:
2146         (WebCore::ScriptExecutionContext::hasServiceWorkerScheme):
2147         * dom/ScriptExecutionContext.h:
2148
2149         * page/NavigatorServiceWorker.idl:
2150
2151         * platform/SchemeRegistry.cpp:
2152         (WebCore::serviceWorkerSchemesLock):
2153         (WebCore::serviceWorkerSchemes):
2154         (WebCore::SchemeRegistry::registerURLSchemeServiceWorkersCanHandle):
2155         (WebCore::SchemeRegistry::canServiceWorkersHandleURLScheme):
2156         (WebCore::SchemeRegistry::isServiceWorkerContainerCustomScheme):
2157         * platform/SchemeRegistry.h:
2158
2159         * workers/service/ServiceWorkerContainer.cpp:
2160         (WebCore::ServiceWorkerContainer::addRegistration):
2161
2162         * workers/service/server/SWServerJobQueue.cpp:
2163         (WebCore::SWServerJobQueue::runRegisterJob):
2164
2165 2017-12-18  Chris Dumez  <cdumez@apple.com>
2166
2167         We should use "error" redirect mode for fetching service worker scripts
2168         https://bugs.webkit.org/show_bug.cgi?id=180950
2169
2170         Reviewed by Youenn Fablet.
2171
2172         We should use "error" redirect mode for fetching service worker scripts, as per:
2173         - https://w3c.github.io/ServiceWorker/#update (Step 7.5)
2174
2175         No new tests, rebaselined existing test.
2176
2177         * loader/SubresourceLoader.cpp:
2178         (WebCore::SubresourceLoader::willSendRequestInternal):
2179         * workers/Worker.cpp:
2180         (WebCore::Worker::create):
2181         * workers/WorkerScriptLoader.cpp:
2182         (WebCore::WorkerScriptLoader::loadAsynchronously):
2183         * workers/WorkerScriptLoader.h:
2184         * workers/service/ServiceWorkerJob.cpp:
2185         (WebCore::ServiceWorkerJob::fetchScriptWithContext):
2186
2187 2017-12-18  Chris Dumez  <cdumez@apple.com>
2188
2189         ExtendableMessageEvent constructor fails to initialize the 'source' attribute
2190         https://bugs.webkit.org/show_bug.cgi?id=180954
2191
2192         Reviewed by Youenn Fablet.
2193
2194         No new tests, rebaselined existing test.
2195
2196         * workers/service/ExtendableMessageEvent.cpp:
2197         (WebCore::ExtendableMessageEvent::ExtendableMessageEvent):
2198
2199 2017-12-18  Wenson Hsieh  <wenson_hsieh@apple.com>
2200
2201         [Attachment Support] Insert images as inline attachments when pasting and dropping
2202         https://bugs.webkit.org/show_bug.cgi?id=180853
2203         <rdar://problem/35756268>
2204
2205         Reviewed by Tim Horton.
2206
2207         Adds support for transforming dropped and pasted web content fragments prior to insertion, such that inline
2208         elements (so far, only images) are replaced with attachment elements that have an inline representation. See
2209         below comments for more detail.
2210
2211         Tests: WKAttachmentTests.InsertPastedImageAsAttachment
2212                WKAttachmentTests.InsertPastedAttributedStringContainingImage
2213                WKAttachmentTestsMac.InsertPastedFileURLsAsAttachments
2214                WKAttachmentTestsIOS.InsertDroppedImageAsAttachment
2215                WKAttachmentTestsIOS.InsertDroppedAttributedStringContainingAttachment
2216
2217         * editing/WebContentReader.h:
2218         * editing/cocoa/EditorCocoa.mm:
2219         (WebCore::Editor::replaceSelectionWithAttributedString):
2220
2221         Add a new helper to replace elements in a DOM fragment with inline attachment elements instead, using the given
2222         Blobs. So far, we only replace image elements with these attachments, by mapping the source of each image to a
2223         Blob, and constructing a replacement attachment backed by a File constructed from the image's corresponding
2224         Blob. However, this mechanism can be generalized in the future to handle transformations from arbitrary elements
2225         to attachment elements capable of representing the same elements using inline display mode.
2226
2227         This function is a noop if the attachment elements are disabled via runtime-enabled features.
2228
2229         * editing/cocoa/WebContentReaderCocoa.mm:
2230         (WebCore::replaceRichContentWithAttachmentsIfNecessary):
2231         (WebCore::createFragmentAndAddResources):
2232         (WebCore::sanitizeMarkupWithArchive):
2233
2234         Add out-params to both of these helper functions that capture the map of blob URLs to Blobs being used to
2235         replace subresource URLs in the pasted/dropped DOM fragment.
2236
2237         (WebCore::WebContentReader::readWebArchive):
2238         (WebCore::WebContentMarkupReader::readWebArchive):
2239         (WebCore::createFragmentFromAttributedString):
2240         (WebCore::WebContentReader::readRTFD):
2241         (WebCore::WebContentMarkupReader::readRTFD):
2242         (WebCore::WebContentReader::readRTF):
2243         (WebCore::WebContentMarkupReader::readRTF):
2244         (WebCore::WebContentReader::readImage):
2245
2246         In these places where we swap out subresource URLs for blob URLs, collect a map of blob URL => Blob, and use it
2247         to replace images in the DOM with attachments (if needed, and possible).
2248
2249         * editing/mac/WebContentReaderMac.mm:
2250         (WebCore::WebContentReader::readFilenames):
2251
2252         Augment existing logic to generate attachment elements when pasting or dropping file URLs, so that the generated
2253         attachment elements also have titles, subtitles, and content type information.
2254
2255         * html/HTMLAttachmentElement.cpp:
2256         (WebCore::HTMLAttachmentElement::setFile):
2257
2258         Add an optional second param, UpdateDisplayAttributes. If UpdateDisplayAttributes::Yes is passed in, then we set
2259         the elements's attributes that are displayed in the attachment representation (title, subtitle, and type) using
2260         the given File.
2261
2262         (WebCore::HTMLAttachmentElement::updateFileWithData):
2263         (WebCore::HTMLAttachmentElement::populateShadowRootIfNecessary):
2264
2265         Make a small tweak to correctly handle the case where an attachment with a content type that is a UTI is being
2266         displayed inline. Content type can either be a UTI or a MIME type, but the code to construct the shadow tree of
2267         an attachment element only handles MIME types.
2268
2269         * html/HTMLAttachmentElement.h:
2270
2271 2017-12-18  Youenn Fablet  <youenn@apple.com>
2272
2273         SameOrigin and CORS fetch should fail on opaque responses served from ServiceWorker
2274         https://bugs.webkit.org/show_bug.cgi?id=180941
2275
2276         Reviewed by Chris Dumez.
2277
2278         Covered by rebased tests.
2279
2280         * loader/SubresourceLoader.cpp:
2281         (WebCore::SubresourceLoader::checkResponseCrossOriginAccessControl):
2282
2283 2017-12-18  Dean Jackson  <dino@apple.com>
2284
2285         Make some functions in GraphicsContextCG use call_once for statics
2286         https://bugs.webkit.org/show_bug.cgi?id=180841
2287         <rdar://problem/36058448>
2288
2289         Reviewed by Antoine Quint.
2290
2291         In preparation for making OffscreenCanvas operate inside a Worker,
2292         make sure GraphicsContext is thread safe. Change some functions
2293         that use a static to call_once.
2294
2295         * platform/graphics/cg/GraphicsContextCG.cpp:
2296         (WebCore::sRGBColorSpaceRef):
2297         (WebCore::linearRGBColorSpaceRef):
2298         (WebCore::extendedSRGBColorSpaceRef):
2299         (WebCore::displayP3ColorSpaceRef):
2300
2301 2017-12-18  Chris Dumez  <cdumez@apple.com>
2302
2303         ExtendableMessageEvent.data should return the value it was initialized to
2304         https://bugs.webkit.org/show_bug.cgi?id=180868
2305
2306         Reviewed by Geoffrey Garen.
2307
2308         No new tests, rebaselined existing test.
2309
2310         * bindings/js/JSExtendableMessageEventCustom.cpp:
2311         (WebCore::constructJSExtendableMessageEvent):
2312         * workers/service/ExtendableMessageEvent.cpp:
2313         (WebCore::ExtendableMessageEvent::ExtendableMessageEvent):
2314         * workers/service/ExtendableMessageEvent.idl:
2315
2316 2017-12-18  Megan Gardner  <megan_gardner@apple.com>
2317
2318         Support Autoscrolling in contenteditable for WK2
2319         https://bugs.webkit.org/show_bug.cgi?id=180789
2320
2321         Reviewed by Simon Frasier and Wenson Hsieh..
2322
2323         Activate the autoscrollController to scroll to the position provided to us by the
2324         UIProcess. Allows for scrolling in contentEditable for WebKit2
2325
2326         Test: fast/events/touch/ios/drag-to-autoscroll-in-single-line-editable.html
2327
2328         * page/AutoscrollController.cpp:
2329         (WebCore::AutoscrollController::autoscrollTimerFired):
2330         * page/EventHandler.cpp:
2331         (WebCore::EventHandler::clearOrScheduleClearingLatchedStateIfNeeded):
2332         (WebCore::EventHandler::targetPositionForSelectionAutoscroll const):
2333         (WebCore::EventHandler::shouldUpdateAutoscroll):
2334         (WebCore::EventHandler::effectiveMousePositionForSelectionAutoscroll const): Deleted.
2335         * page/EventHandler.h:
2336         * page/ios/EventHandlerIOS.mm:
2337         (WebCore::EventHandler::startTextAutoscroll):
2338         (WebCore::EventHandler::cancelTextAutoscroll):
2339         (WebCore::EventHandler::targetPositionForSelectionAutoscroll const):
2340         (WebCore::EventHandler::shouldUpdateAutoscroll):
2341         * page/mac/EventHandlerMac.mm:
2342         (WebCore::EventHandler::targetPositionForSelectionAutoscroll const):
2343         (WebCore::EventHandler::effectiveMousePositionForSelectionAutoscroll const): Deleted.
2344
2345 2017-12-18  Youenn Fablet  <youenn@apple.com>
2346
2347         Add support for response blob given to fetch events
2348         https://bugs.webkit.org/show_bug.cgi?id=180894
2349
2350         Reviewed by Darin Adler.
2351
2352         Covered by updated test expectations.
2353
2354         Adding support for getting a blob URL from a FormData that only contains one blob.
2355         Adding support to create a FetcLoader from a ServiceWorkerThreadProxy
2356
2357         * Modules/fetch/FetchLoader.cpp:
2358         (WebCore::FetchLoader::start):
2359         (WebCore::FetchLoader::startLoadingBlobURL):
2360         * Modules/fetch/FetchLoader.h:
2361         * WebCore.xcodeproj/project.pbxproj:
2362         * platform/network/FormData.cpp:
2363         (WebCore::FormData::asBlobURL const):
2364         * platform/network/FormData.h:
2365         * workers/service/context/ServiceWorkerThreadProxy.cpp:
2366         (WebCore::ServiceWorkerThreadProxy::createBlobLoader):
2367         * workers/service/context/ServiceWorkerThreadProxy.h:
2368
2369 2017-12-18  Zalan Bujtas  <zalan@apple.com>
2370
2371         [SVG] Detach list wrappers before resetting the base value.
2372         https://bugs.webkit.org/show_bug.cgi?id=180912
2373         <rdar://problem/36017970>
2374
2375         Reviewed by Simon Fraser.
2376
2377         Before resetting the animation value (and destroying the assigned SVG object -SVGLengthValue in this case),
2378         we need to check if there's an associated tear off wrapper for the said SVG object and make a copy of it.
2379         This is currently done in the wrong order through animValDidChange.
2380
2381         Test: svg/animations/crash-when-animation-is-running-while-getting-value.html
2382
2383         * svg/SVGAnimatedTypeAnimator.h:
2384         (WebCore::SVGAnimatedTypeAnimator::resetFromBaseValue):
2385         * svg/properties/SVGAnimatedPropertyTearOff.h:
2386         * svg/properties/SVGAnimatedStaticPropertyTearOff.h:
2387         (WebCore::SVGAnimatedStaticPropertyTearOff::synchronizeWrappersIfNeeded):
2388
2389 2017-12-18  Brady Eidson  <beidson@apple.com>
2390
2391         REGRESSION: ASSERTION FAILED: !m_importCompleted
2392         https://bugs.webkit.org/show_bug.cgi?id=180935
2393
2394         Unreviewed bot gardening.
2395
2396         No new tests (Covered by existing tests)
2397
2398         The ASSERT was invalid for database pushes failing to open databases like this, so skip it for that scenario.
2399
2400         * workers/service/server/RegistrationStore.cpp:
2401         (WebCore::RegistrationStore::databaseFailedToOpen):
2402         * workers/service/server/SWServer.cpp:
2403         (WebCore::SWServer::registrationStoreDatabaseFailedToOpen):
2404         * workers/service/server/SWServer.h:
2405
2406 2017-12-18  Jer Noble  <jer.noble@apple.com>
2407
2408         Playing media elements which call "pause(); play()" will have the play promise rejected.
2409         https://bugs.webkit.org/show_bug.cgi?id=180781
2410
2411         Reviewed by Eric Carlson.
2412
2413         Test: media/video-pause-play-resolve.html
2414
2415         When scheduling a rejection or resolution of existing play promises, move() the existing
2416         promises into the block. This ensures that valid promises aren't added to the play promise
2417         vector between when a rejection is scheduled and when it runs.
2418
2419         Drive-by fix: Don't return false from playInternal() just so the newly created promise will
2420         get rejected. The pause() command will reject the promise, so just make sure it's added to
2421         the m_pendingPlayPromises before calling playInternal().
2422
2423         Drive-by fix #2: The spec referenced by playInternal() and pauseInternal() doesn't say to
2424         call the "Media Element Load Algorithm" (i.e., prepareForLoad()); it says to call the
2425         "Resource Selection Algorithm" (i.e., selectMediaResource()). But fixing this bug caused
2426         an assertion crash when the resource selection task was fired and m_player was null. This
2427         was because the algorithm is being run at stop() time due to stop() calling pause(). The
2428         solution to this ASSERT is to stop the m_resourceSelectionTaskQueue in stop().
2429
2430         * html/HTMLMediaElement.cpp:
2431         (WebCore::HTMLMediaElement::scheduleRejectPendingPlayPromises):
2432         (WebCore::HTMLMediaElement::rejectPendingPlayPromises):
2433         (WebCore::HTMLMediaElement::resolvePendingPlayPromises):
2434         (WebCore::HTMLMediaElement::scheduleNotifyAboutPlaying):
2435         (WebCore::HTMLMediaElement::notifyAboutPlaying):
2436         (WebCore::HTMLMediaElement::noneSupported):
2437         (WebCore::HTMLMediaElement::cancelPendingEventsAndCallbacks):
2438         (WebCore::HTMLMediaElement::play):
2439         (WebCore::HTMLMediaElement::playInternal):
2440         (WebCore::HTMLMediaElement::pauseInternal):
2441         (WebCore::HTMLMediaElement::stop):
2442         * html/HTMLMediaElement.h:
2443
2444 2017-12-18  Daniel Bates  <dabates@apple.com>
2445
2446         Add SPI to query for the current and last auto fill button type and pass user data object to _webView:focusShouldStartInputSession:
2447         https://bugs.webkit.org/show_bug.cgi?id=180774
2448         <rdar://problem/36033832>
2449
2450         Reviewed by Tim Horton.
2451
2452         Expose a way for an embedding client to query for the auto fill button type of a specific
2453         input element as it may not be feasible for a client to track such state themselves. For
2454         similar reasons track and expose SPI to query for the last auto fill button type for a
2455         specific field.
2456
2457         Test: fast/forms/auto-fill-button/last-auto-fill-button-type.html
2458
2459         * html/HTMLInputElement.cpp:
2460         (WebCore::HTMLInputElement::HTMLInputElement):
2461         (WebCore::HTMLInputElement::setShowAutoFillButton):
2462         Update the last auto fill button type.
2463
2464         * html/HTMLInputElement.h:
2465         (WebCore::HTMLInputElement::lastAutoFillButtonType const): Added.
2466
2467         * testing/Internals.cpp:
2468         (WebCore::toAutoFillButtonType):
2469         (WebCore::toInternalsAutoFillButtonType):
2470         (WebCore::Internals::autoFillButtonType):
2471         (WebCore::Internals::lastAutoFillButtonType):
2472         * testing/Internals.h:
2473         * testing/Internals.idl:
2474         Add functions for testing.
2475
2476 2017-12-17  John Wilander  <wilander@apple.com>
2477
2478         Storage Access API: Make document.hasStorageAccess() retrieve current status from the network process
2479         https://bugs.webkit.org/show_bug.cgi?id=180681
2480         <rdar://problem/35982161>
2481
2482         Reviewed by Alex Christensen.
2483
2484         Tests: http/tests/storageAccess/has-storage-access-from-prevalent-domain-with-non-recent-user-interaction.html
2485                http/tests/storageAccess/has-storage-access-from-prevalent-domain-with-recent-user-interaction.html
2486
2487         This change makes an asynchronous request to the network process
2488         to see if storage access has been granted for this frame, on this
2489         page, for this domain.
2490
2491         * dom/Document.cpp:
2492         (WebCore::Document::hasStorageAccess):
2493         * page/ChromeClient.h:
2494
2495 2017-12-17  Chris Dumez  <cdumez@apple.com>
2496
2497         Strip fragment identifier from ServiceWorker's scriptURL
2498         https://bugs.webkit.org/show_bug.cgi?id=180887
2499
2500         Reviewed by Darin Adler.
2501
2502         Strip fragment identifier from ServiceWorker's scriptURL to match Firefox and Chrome.
2503         This behavior does not appear to be specified so I filed:
2504         - https://github.com/w3c/ServiceWorker/issues/1249
2505
2506         No new tests, rebaselined existing test.
2507
2508         * workers/service/server/SWServerWorker.cpp:
2509         (WebCore::m_script):
2510
2511 2017-12-17  Antti Koivisto  <antti@apple.com>
2512
2513         Move render tree updating related files under rendering/updating/
2514         https://bugs.webkit.org/show_bug.cgi?id=180918
2515
2516         Reviewed by Darin Adler.
2517
2518         * CMakeLists.txt:
2519         * Sources.txt:
2520         * WebCore.xcodeproj/project.pbxproj:
2521         * rendering/RenderTreeBuilder.cpp: Removed.
2522         * rendering/RenderTreeBuilder.h: Removed.
2523         * rendering/updating: Added.
2524         * rendering/updating/RenderTreeBuilder.cpp: Copied from Source/WebCore/rendering/RenderTreeBuilder.cpp.
2525         * rendering/updating/RenderTreeBuilder.h: Copied from Source/WebCore/rendering/RenderTreeBuilder.h.
2526         * rendering/updating/RenderTreePosition.cpp: Copied from Source/WebCore/style/RenderTreePosition.cpp.
2527         * rendering/updating/RenderTreePosition.h: Copied from Source/WebCore/style/RenderTreePosition.h.
2528         * rendering/updating/RenderTreeUpdater.cpp: Copied from Source/WebCore/style/RenderTreeUpdater.cpp.
2529         * rendering/updating/RenderTreeUpdater.h: Copied from Source/WebCore/style/RenderTreeUpdater.h.
2530         * rendering/updating/RenderTreeUpdaterFirstLetter.cpp: Copied from Source/WebCore/style/RenderTreeUpdaterFirstLetter.cpp.
2531         * rendering/updating/RenderTreeUpdaterFirstLetter.h: Copied from Source/WebCore/style/RenderTreeUpdaterFirstLetter.h.
2532         * rendering/updating/RenderTreeUpdaterGeneratedContent.cpp: Copied from Source/WebCore/style/RenderTreeUpdaterGeneratedContent.cpp.
2533         * rendering/updating/RenderTreeUpdaterGeneratedContent.h: Copied from Source/WebCore/style/RenderTreeUpdaterGeneratedContent.h.
2534         * rendering/updating/RenderTreeUpdaterListItem.cpp: Copied from Source/WebCore/style/RenderTreeUpdaterListItem.cpp.
2535         * rendering/updating/RenderTreeUpdaterListItem.h: Copied from Source/WebCore/style/RenderTreeUpdaterListItem.h.
2536         * rendering/updating/RenderTreeUpdaterMultiColumn.cpp: Copied from Source/WebCore/style/RenderTreeUpdaterMultiColumn.cpp.
2537         * rendering/updating/RenderTreeUpdaterMultiColumn.h: Copied from Source/WebCore/style/RenderTreeUpdaterMultiColumn.h.
2538         * style/RenderTreePosition.cpp: Removed.
2539         * style/RenderTreePosition.h: Removed.
2540         * style/RenderTreeUpdater.cpp: Removed.
2541         * style/RenderTreeUpdater.h: Removed.
2542         * style/RenderTreeUpdaterFirstLetter.cpp: Removed.
2543         * style/RenderTreeUpdaterFirstLetter.h: Removed.
2544         * style/RenderTreeUpdaterGeneratedContent.cpp: Removed.
2545         * style/RenderTreeUpdaterGeneratedContent.h: Removed.
2546         * style/RenderTreeUpdaterListItem.cpp: Removed.
2547         * style/RenderTreeUpdaterListItem.h: Removed.
2548         * style/RenderTreeUpdaterMultiColumn.cpp: Removed.
2549         * style/RenderTreeUpdaterMultiColumn.h: Removed.
2550
2551 2017-12-17  Yusuke Suzuki  <utatane.tea@gmail.com>
2552
2553         [JSC][WebCore][CSSJIT] Remove VM reference in CSSJIT
2554         https://bugs.webkit.org/show_bug.cgi?id=180917
2555
2556         Reviewed by Sam Weinig.
2557
2558         Remove VM reference in CSSJIT. CSSJIT should not be
2559         bound to a specific VM.
2560
2561         No behavior change.
2562
2563         * css/ElementRuleCollector.cpp:
2564         (WebCore::ElementRuleCollector::ruleMatches):
2565         * cssjit/SelectorCompiler.cpp:
2566         (WebCore::SelectorCompiler::compileSelector):
2567         * cssjit/SelectorCompiler.h:
2568         * dom/SelectorQuery.cpp:
2569         (WebCore::SelectorDataList::compileSelector):
2570         (WebCore::SelectorDataList::execute const):
2571         * dom/SelectorQuery.h:
2572
2573 2017-12-16  Dan Bernstein  <mitz@apple.com>
2574
2575         WKWebView has no equivalent of -[WebView setAlwaysShowVerticalScroller:]
2576         https://bugs.webkit.org/show_bug.cgi?id=180613
2577         <rdar://problem/35946124>
2578
2579         Reviewed by Geoff Garen.
2580
2581         Test: TestWebKitAPI/Tests/WebKitCocoa/WKWebViewAlwaysShowsScroller.mm
2582
2583         * platform/ScrollView.h: Exported setScrollbarModes.
2584
2585 2017-12-16  Antti Koivisto  <antti@apple.com>
2586
2587         Introduce RenderTreeBuilder
2588         https://bugs.webkit.org/show_bug.cgi?id=180817
2589
2590         Reviewed by Zalan Bujtas.
2591
2592         RenderTreeBuilder is responsible of building the render tree, including construction of various anonymous
2593         renderers. Renderer subtype specific render tree construction code will eventually move there.
2594
2595         This patch adds RenderTreeBuilder class and passes it as a parameter for all addChild implementations.
2596         Future patches can then mechanically move the building code from renderers to RenderTreeBuilder.
2597
2598         It also moves one addChild implementation (RenderRuby::addChild -> RenderTreeBuilder::rubyRunInsertChild)
2599         to RenderTreeBuilder as a test.
2600
2601         * WebCore.xcodeproj/project.pbxproj:
2602         * rendering/RenderBlock.cpp:
2603         (WebCore::RenderBlock::addChildToContinuation):
2604         (WebCore::RenderBlock::addChild):
2605         (WebCore::RenderBlock::addChildIgnoringContinuation):
2606         * rendering/RenderBlock.h:
2607         * rendering/RenderBlockFlow.cpp:
2608         (WebCore::RenderBlockFlow::addChild):
2609         * rendering/RenderBlockFlow.h:
2610         * rendering/RenderBoxModelObject.cpp:
2611         (WebCore::RenderBoxModelObject::moveChildTo):
2612         * rendering/RenderButton.cpp:
2613         (WebCore::RenderButton::addChild):
2614         (WebCore::RenderButton::setText):
2615         * rendering/RenderButton.h:
2616         * rendering/RenderElement.cpp:
2617         (WebCore::RenderElement::addChild):
2618         * rendering/RenderElement.h:
2619         (WebCore::RenderElement::addChildIgnoringContinuation):
2620         * rendering/RenderFullScreen.cpp:
2621         (WebCore::RenderFullScreen::wrapNewRenderer):
2622         (WebCore::RenderFullScreen::wrapExistingRenderer):
2623         (WebCore::RenderFullScreen::unwrapRenderer):
2624         (WebCore::RenderFullScreen::createPlaceholder):
2625         * rendering/RenderGrid.cpp:
2626         (WebCore::RenderGrid::addChild):
2627         * rendering/RenderGrid.h:
2628         * rendering/RenderInline.cpp:
2629         (WebCore::RenderInline::addChild):
2630         (WebCore::RenderInline::addChildIgnoringContinuation):
2631         (WebCore::RenderInline::splitInlines):
2632         (WebCore::RenderInline::splitFlow):
2633         (WebCore::RenderInline::addChildToContinuation):
2634         (WebCore::RenderInline::childBecameNonInline):
2635         * rendering/RenderInline.h:
2636         * rendering/RenderMenuList.cpp:
2637         (WebCore::RenderMenuList::createInnerBlock):
2638         (RenderMenuList::addChild):
2639         (RenderMenuList::setText):
2640         * rendering/RenderMenuList.h:
2641         * rendering/RenderMultiColumnFlow.cpp:
2642         (WebCore::RenderMultiColumnFlow::processPossibleSpannerDescendant):
2643         * rendering/RenderQuote.cpp:
2644         (WebCore::RenderQuote::updateTextRenderer):
2645         (WebCore::RenderQuote::updateRenderer):
2646         * rendering/RenderQuote.h:
2647         * rendering/RenderRuby.cpp:
2648         (WebCore::RenderRubyAsInline::addChild):
2649         (WebCore::RenderRubyAsBlock::addChild):
2650         * rendering/RenderRuby.h:
2651         * rendering/RenderRubyBase.h:
2652         * rendering/RenderRubyRun.cpp:
2653         (WebCore::RenderRubyRun::rubyBaseSafe):
2654         (WebCore::RenderRubyRun::addChild): Deleted.
2655         * rendering/RenderRubyRun.h:
2656         * rendering/RenderTable.cpp:
2657         (WebCore::RenderTable::addChild):
2658         * rendering/RenderTable.h:
2659         * rendering/RenderTableRow.cpp:
2660         (WebCore::RenderTableRow::addChild):
2661         * rendering/RenderTableRow.h:
2662         * rendering/RenderTableSection.cpp:
2663         (WebCore::RenderTableSection::addChild):
2664         * rendering/RenderTableSection.h:
2665         * rendering/RenderTreeBuilder.cpp: Added.
2666         (WebCore::RenderTreeBuilder::RenderTreeBuilder):
2667         (WebCore::RenderTreeBuilder::~RenderTreeBuilder):
2668         (WebCore::RenderTreeBuilder::insertChild):
2669         (WebCore::RenderTreeBuilder::rubyRunInsertChild):
2670         * rendering/RenderTreeBuilder.h: Added.
2671         (WebCore::RenderTreeBuilder::current):
2672         * rendering/TextAutoSizing.cpp:
2673         (WebCore::TextAutoSizingValue::adjustTextNodeSizes):
2674         * rendering/mathml/RenderMathMLFenced.cpp:
2675         (WebCore::RenderMathMLFenced::updateFromElement):
2676         (WebCore::RenderMathMLFenced::makeFences):
2677         (WebCore::RenderMathMLFenced::addChild):
2678         * rendering/mathml/RenderMathMLFenced.h:
2679         * rendering/svg/RenderSVGContainer.cpp:
2680         (WebCore::RenderSVGContainer::addChild):
2681         * rendering/svg/RenderSVGContainer.h:
2682         * rendering/svg/RenderSVGInline.cpp:
2683         (WebCore::RenderSVGInline::addChild):
2684         * rendering/svg/RenderSVGInline.h:
2685         * rendering/svg/RenderSVGRoot.cpp:
2686         (WebCore::RenderSVGRoot::addChild):
2687         * rendering/svg/RenderSVGRoot.h:
2688         * rendering/svg/RenderSVGText.cpp:
2689         (WebCore::RenderSVGText::addChild):
2690         * rendering/svg/RenderSVGText.h:
2691         * style/RenderTreePosition.cpp:
2692         (WebCore::RenderTreePosition::insert): Deleted.
2693         * style/RenderTreePosition.h:
2694         (WebCore::RenderTreePosition::RenderTreePosition):
2695         (WebCore::RenderTreePosition::nextSibling const):
2696         (WebCore::RenderTreePosition::canInsert const): Deleted.
2697         * style/RenderTreeUpdater.cpp:
2698         (WebCore::RenderTreeUpdater::updateAfterDescendants):
2699         (WebCore::RenderTreeUpdater::createRenderer):
2700         (WebCore::RenderTreeUpdater::createTextRenderer):
2701         (WebCore::RenderTreeUpdater::updateTextRenderer):
2702         (WebCore::createTextRenderer): Deleted.
2703         * style/RenderTreeUpdater.h:
2704         * style/RenderTreeUpdaterFirstLetter.cpp:
2705         (WebCore::updateFirstLetterStyle):
2706         (WebCore::createFirstLetterRenderer):
2707         * style/RenderTreeUpdaterGeneratedContent.cpp:
2708         (WebCore::RenderTreeUpdater::GeneratedContent::updateQuotesUpTo):
2709         (WebCore::createContentRenderers):
2710         (WebCore::RenderTreeUpdater::GeneratedContent::updatePseudoElement):
2711         * style/RenderTreeUpdaterListItem.cpp:
2712         (WebCore::RenderTreeUpdater::ListItem::updateMarker):
2713         * style/RenderTreeUpdaterListItem.h:
2714         * style/RenderTreeUpdaterMultiColumn.cpp:
2715         (WebCore::RenderTreeUpdater::MultiColumn::createFragmentedFlow):
2716         (WebCore::RenderTreeUpdater::MultiColumn::destroyFragmentedFlow):
2717
2718 2017-12-16  Romain Bellessort  <romain.bellessort@crf.canon.fr>
2719
2720         [Readable Streams API] Fix filling of descriptor from queue
2721         https://bugs.webkit.org/show_bug.cgi?id=172717
2722
2723         Reviewed by Youenn Fablet.
2724
2725         Fixed the filling of descriptor from queue (step 10.d at [1]). When first implemented,
2726         spec comprised a bug and code was not reachable. Spec has now been fixed and code can
2727         now be reached.
2728
2729         [1] https://streams.spec.whatwg.org/#readable-byte-stream-controller-fill-pull-into-descriptor-from-queue
2730
2731         No new tests (covered by WPT tests, whose expectations have been updated).
2732
2733         * Modules/streams/ReadableByteStreamInternals.js:
2734         (readableByteStreamControllerFillDescriptorFromQueue): Updated.
2735
2736 2017-12-16  Brady Eidson  <beidson@apple.com>
2737
2738         Implement getting ServiceWorker registrations for the WKWebsiteDataStore API
2739         https://bugs.webkit.org/show_bug.cgi?id=180886
2740
2741         Reviewed by Chris Dumez.
2742
2743         No new tests (API test coming soon).
2744
2745         * workers/service/server/SWServer.cpp:
2746         (WebCore::SWServer::registrationStoreImportComplete):
2747         (WebCore::SWServer::SWServer):
2748         (WebCore::SWServer::getOriginsWithRegistrations):
2749         (WebCore::SWServer::performGetOriginsWithRegistrationsCallbacks):
2750         * workers/service/server/SWServer.h:
2751
2752 2017-12-16  Yusuke Suzuki  <utatane.tea@gmail.com>
2753
2754         Remove unnecessary boolean result of start() functions
2755         https://bugs.webkit.org/show_bug.cgi?id=180856
2756
2757         Reviewed by Darin Adler.
2758
2759         No behavior change.
2760
2761         * Modules/webaudio/AsyncAudioDecoder.cpp:
2762         (WebCore::AsyncAudioDecoder::~AsyncAudioDecoder):
2763         * Modules/webdatabase/DatabaseContext.cpp:
2764         (WebCore::DatabaseContext::databaseThread):
2765         * Modules/webdatabase/DatabaseThread.cpp:
2766         (WebCore::DatabaseThread::start):
2767         Now `Thread::create` always succeeds (if it fails, WebKit crashes).
2768         DatabaseThread::start() now always returns true. So, we do not need
2769         to return bool.
2770
2771         * Modules/webdatabase/DatabaseThread.h:
2772         * platform/network/curl/CurlDownload.cpp:
2773         (WebCore::CurlDownload::start):
2774         * platform/network/curl/CurlDownload.h:
2775         * platform/network/curl/ResourceHandleCurl.cpp:
2776         (WebCore::ResourceHandle::start):
2777         * platform/network/curl/ResourceHandleCurlDelegate.cpp:
2778         (WebCore::ResourceHandleCurlDelegate::start):
2779         * platform/network/curl/ResourceHandleCurlDelegate.h:
2780
2781 2017-12-16  Chris Dumez  <cdumez@apple.com>
2782
2783         Add optimization when updating a SW registration results in the exact same script
2784         https://bugs.webkit.org/show_bug.cgi?id=180891
2785
2786         Reviewed by Geoffrey Garen.
2787
2788         Add optimization when updating a SW registration results in the exact same script:
2789         - https://w3c.github.io/ServiceWorker/#update-algorithm (step 8)
2790
2791         No new tests, rebaselined existing test.
2792
2793         * workers/service/server/SWServerJobQueue.cpp:
2794         (WebCore::SWServerJobQueue::scriptFetchFinished):
2795
2796 2017-12-16  Youenn Fablet  <youenn@apple.com>
2797
2798         Service worker script fetch request should set the Service-Worker header
2799         https://bugs.webkit.org/show_bug.cgi?id=180889
2800
2801         Reviewed by Chris Dumez.
2802
2803         Test: http/wpt/service-workers/check-service-worker-header.https.html
2804
2805         Update WorkerScriptLoader to take a request instead of an URL.
2806         Updates Worker implementation and use it in ServiceWorkerJob to set the missing request header.
2807
2808         * workers/Worker.cpp:
2809         (WebCore::Worker::create):
2810         * workers/WorkerScriptLoader.cpp:
2811         (WebCore::WorkerScriptLoader::loadAsynchronously):
2812         * workers/WorkerScriptLoader.h:
2813         * workers/service/ServiceWorkerJob.cpp:
2814         (WebCore::ServiceWorkerJob::fetchScriptWithContext):
2815
2816 2017-12-15  Ryan Haddad  <ryanhaddad@apple.com>
2817
2818         Unreviewed, rolling out r225969.
2819
2820         This change introduced LayoutTest crashes.
2821
2822         Reverted changeset:
2823
2824         "Introduce RenderTreeBuilder"
2825         https://bugs.webkit.org/show_bug.cgi?id=180817
2826         https://trac.webkit.org/changeset/225969
2827
2828 2017-12-15  Chris Dumez  <cdumez@apple.com>
2829
2830         Support updating a service worker registration's updateViaCache flag
2831         https://bugs.webkit.org/show_bug.cgi?id=180888
2832
2833         Reviewed by Brady Eidson.
2834
2835         Support updating a service worker registration's updateViaCache flag to match other browsers:
2836         - https://github.com/w3c/ServiceWorker/issues/1189
2837
2838         No new tests, rebaselined existing test.
2839
2840         * workers/service/SWClientConnection.cpp:
2841         (WebCore::SWClientConnection::setRegistrationUpdateViaCache):
2842         * workers/service/SWClientConnection.h:
2843         * workers/service/ServiceWorkerRegistration.cpp:
2844         (WebCore::ServiceWorkerRegistration::setUpdateViaCache):
2845         * workers/service/ServiceWorkerRegistration.h:
2846         * workers/service/server/SWServer.h:
2847         * workers/service/server/SWServerJobQueue.cpp:
2848         (WebCore::SWServerJobQueue::runRegisterJob):
2849         * workers/service/server/SWServerRegistration.cpp:
2850         (WebCore::SWServerRegistration::setUpdateViaCache):
2851         * workers/service/server/SWServerRegistration.h:
2852
2853 2017-12-15  Ryan Haddad  <ryanhaddad@apple.com>
2854
2855         Unreviewed, rolling out r225941.
2856
2857         This change introduced LayoutTest crashes and assertion
2858         failures.
2859
2860         Reverted changeset:
2861
2862         "Web Inspector: replace HTMLCanvasElement with
2863         CanvasRenderingContext for instrumentation logic"
2864         https://bugs.webkit.org/show_bug.cgi?id=180770
2865         https://trac.webkit.org/changeset/225941
2866
2867 2017-12-15  Ryosuke Niwa  <rniwa@webkit.org>
2868
2869         Add a release assert that Timer::m_wasDeleted is false in setNextFireTime
2870         https://bugs.webkit.org/show_bug.cgi?id=180860
2871         <rdar://problem/36066500>
2872
2873         Reviewed by David Kilzer.
2874
2875         Turn an exist debug-only assertion into a release assertion to help diagnose a crash
2876         which appears to be caused by a freed timer getting scheduled back into the timer heap.
2877
2878         * platform/Timer.cpp:
2879         (WebCore::TimerBase::~TimerBase):
2880         (WebCore::TimerBase::setNextFireTime):
2881         * platform/Timer.h:
2882
2883 2017-12-15  Simon Fraser  <simon.fraser@apple.com>
2884
2885         Elements animated on-screen are missing sometimes
2886         https://bugs.webkit.org/show_bug.cgi?id=180773
2887         rdar://problem/34923438
2888
2889         Reviewed by Zalan Bujtas.
2890         
2891         After r225310 it was still possible for elements to be missing backing store when brought
2892         on-screen via an animation. This occurred if a child element was outside the bounds of the
2893         element being animated.
2894
2895         Fix by making sure that GraphicsLayer's "animatedExtent" took composited child layers into account.
2896
2897         As for r225310, no test because this is timing sensitive and hard to reliably make a test for.
2898
2899         * rendering/RenderLayer.cpp:
2900         (WebCore::RenderLayer::calculateClipRects const):
2901         * rendering/RenderLayer.h:
2902         * rendering/RenderLayerBacking.cpp:
2903         (WebCore::RenderLayerBacking::updateGeometry):
2904
2905 2017-12-15  Chris Dumez  <cdumez@apple.com>
2906
2907         imported/w3c/web-platform-tests/service-workers/service-worker/update.https.html is sometimes crashing in Debug builds
2908         https://bugs.webkit.org/show_bug.cgi?id=180867
2909
2910         Reviewed by Brady Eidson.
2911
2912         Fix assertion to make sure the worker is terminating if it is already in m_runningOrTerminatingWorkers.
2913
2914         * workers/service/server/SWServer.cpp:
2915         (WebCore::SWServer::runServiceWorker):
2916
2917 2017-12-15  Chris Dumez  <cdumez@apple.com>
2918
2919         Service Worker Registration promise is sometimes not rejected when the script load fails
2920         https://bugs.webkit.org/show_bug.cgi?id=180849
2921
2922         Reviewed by Brady Eidson.
2923
2924         Service Worker Registration promise is sometimes not rejected when the script load fails.
2925         This was caused by the ServiceWorkerJob sometimes passing a null ResourceError to the
2926         StorageProcess, even though the load failed.
2927
2928         No new tests, rebaselined exisiting tests.
2929
2930         * workers/WorkerScriptLoader.cpp:
2931         (WebCore::WorkerScriptLoader::notifyError):
2932         * workers/service/ServiceWorkerJob.cpp:
2933         (WebCore::ServiceWorkerJob::notifyFinished):
2934
2935 2017-12-15  Youenn Fablet  <youenn@apple.com>
2936
2937         WebRTC Stats should not be console logged from a background thread
2938         https://bugs.webkit.org/show_bug.cgi?id=180845
2939
2940         Reviewed by Eric Carlson.
2941
2942         Ensuring console log are done in the main thread.
2943
2944         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
2945         (WebCore::LibWebRTCMediaEndpoint::OnStatsDelivered):
2946
2947 2017-12-15  Antti Koivisto  <antti@apple.com>
2948
2949         Introduce RenderTreeBuilder
2950         https://bugs.webkit.org/show_bug.cgi?id=180817
2951
2952         Reviewed by Zalan Bujtas.
2953
2954         RenderTreeBuilder is responsible of building the render tree, including construction of various anonymous
2955         renderers. Renderer subtype specific render tree construction code will eventually move there.
2956
2957         This patch adds RenderTreeBuilder class and passes it as a parameter for all addChild implementations.
2958         Future patches can then mechanically move the building code from renderers to RenderTreeBuilder.
2959
2960         It also moves one addChild implementation (RenderRuby::addChild -> RenderTreeBuilder::rubyRunInsertChild)
2961         to RenderTreeBuilder as a test.
2962
2963         * WebCore.xcodeproj/project.pbxproj:
2964         * rendering/RenderBlock.cpp:
2965         (WebCore::RenderBlock::addChildToContinuation):
2966         (WebCore::RenderBlock::addChild):
2967         (WebCore::RenderBlock::addChildIgnoringContinuation):
2968         * rendering/RenderBlock.h:
2969         * rendering/RenderBlockFlow.cpp:
2970         (WebCore::RenderBlockFlow::addChild):
2971         * rendering/RenderBlockFlow.h:
2972         * rendering/RenderBoxModelObject.cpp:
2973         (WebCore::RenderBoxModelObject::moveChildTo):
2974         * rendering/RenderButton.cpp:
2975         (WebCore::RenderButton::addChild):
2976         (WebCore::RenderButton::setText):
2977         * rendering/RenderButton.h:
2978         * rendering/RenderElement.cpp:
2979         (WebCore::RenderElement::addChild):
2980         * rendering/RenderElement.h:
2981         (WebCore::RenderElement::addChildIgnoringContinuation):
2982         * rendering/RenderFullScreen.cpp:
2983         (WebCore::RenderFullScreen::wrapNewRenderer):
2984         (WebCore::RenderFullScreen::wrapExistingRenderer):
2985         (WebCore::RenderFullScreen::unwrapRenderer):
2986         (WebCore::RenderFullScreen::createPlaceholder):
2987         * rendering/RenderGrid.cpp:
2988         (WebCore::RenderGrid::addChild):
2989         * rendering/RenderGrid.h:
2990         * rendering/RenderInline.cpp:
2991         (WebCore::RenderInline::addChild):
2992         (WebCore::RenderInline::addChildIgnoringContinuation):
2993         (WebCore::RenderInline::splitInlines):
2994         (WebCore::RenderInline::splitFlow):
2995         (WebCore::RenderInline::addChildToContinuation):
2996         (WebCore::RenderInline::childBecameNonInline):
2997         * rendering/RenderInline.h:
2998         * rendering/RenderMenuList.cpp:
2999         (WebCore::RenderMenuList::createInnerBlock):
3000         (RenderMenuList::addChild):
3001         (RenderMenuList::setText):
3002         * rendering/RenderMenuList.h:
3003         * rendering/RenderMultiColumnFlow.cpp:
3004         (WebCore::RenderMultiColumnFlow::processPossibleSpannerDescendant):
3005         * rendering/RenderQuote.cpp:
3006         (WebCore::RenderQuote::updateTextRenderer):
3007         (WebCore::RenderQuote::updateRenderer):
3008         * rendering/RenderQuote.h:
3009         * rendering/RenderRuby.cpp:
3010         (WebCore::RenderRubyAsInline::addChild):
3011         (WebCore::RenderRubyAsBlock::addChild):
3012         * rendering/RenderRuby.h:
3013         * rendering/RenderRubyBase.h:
3014         * rendering/RenderRubyRun.cpp:
3015         (WebCore::RenderRubyRun::rubyBaseSafe):
3016         (WebCore::RenderRubyRun::addChild): Deleted.
3017         * rendering/RenderRubyRun.h:
3018         * rendering/RenderTable.cpp:
3019         (WebCore::RenderTable::addChild):
3020         * rendering/RenderTable.h:
3021         * rendering/RenderTableRow.cpp:
3022         (WebCore::RenderTableRow::addChild):
3023         * rendering/RenderTableRow.h:
3024         * rendering/RenderTableSection.cpp:
3025         (WebCore::RenderTableSection::addChild):
3026         * rendering/RenderTableSection.h:
3027         * rendering/RenderTreeBuilder.cpp: Added.
3028         (WebCore::RenderTreeBuilder::RenderTreeBuilder):
3029         (WebCore::RenderTreeBuilder::~RenderTreeBuilder):
3030         (WebCore::RenderTreeBuilder::insertChild):
3031         (WebCore::RenderTreeBuilder::rubyRunInsertChild):
3032         * rendering/RenderTreeBuilder.h: Added.
3033         (WebCore::RenderTreeBuilder::current):
3034         * rendering/TextAutoSizing.cpp:
3035         (WebCore::TextAutoSizingValue::adjustTextNodeSizes):
3036         * rendering/mathml/RenderMathMLFenced.cpp:
3037         (WebCore::RenderMathMLFenced::updateFromElement):
3038         (WebCore::RenderMathMLFenced::makeFences):
3039         (WebCore::RenderMathMLFenced::addChild):
3040         * rendering/mathml/RenderMathMLFenced.h:
3041         * rendering/svg/RenderSVGContainer.cpp:
3042         (WebCore::RenderSVGContainer::addChild):
3043         * rendering/svg/RenderSVGContainer.h:
3044         * rendering/svg/RenderSVGInline.cpp:
3045         (WebCore::RenderSVGInline::addChild):
3046         * rendering/svg/RenderSVGInline.h:
3047         * rendering/svg/RenderSVGRoot.cpp:
3048         (WebCore::RenderSVGRoot::addChild):
3049         * rendering/svg/RenderSVGRoot.h:
3050         * rendering/svg/RenderSVGText.cpp:
3051         (WebCore::RenderSVGText::addChild):
3052         * rendering/svg/RenderSVGText.h:
3053         * style/RenderTreePosition.cpp:
3054         (WebCore::RenderTreePosition::insert): Deleted.
3055         * style/RenderTreePosition.h:
3056         (WebCore::RenderTreePosition::RenderTreePosition):
3057         (WebCore::RenderTreePosition::nextSibling const):
3058         (WebCore::RenderTreePosition::canInsert const): Deleted.
3059         * style/RenderTreeUpdater.cpp:
3060         (WebCore::RenderTreeUpdater::updateAfterDescendants):
3061         (WebCore::RenderTreeUpdater::createRenderer):
3062         (WebCore::RenderTreeUpdater::createTextRenderer):
3063         (WebCore::RenderTreeUpdater::updateTextRenderer):
3064         (WebCore::createTextRenderer): Deleted.
3065         * style/RenderTreeUpdater.h:
3066         * style/RenderTreeUpdaterFirstLetter.cpp:
3067         (WebCore::updateFirstLetterStyle):
3068         (WebCore::createFirstLetterRenderer):
3069         * style/RenderTreeUpdaterGeneratedContent.cpp:
3070         (WebCore::RenderTreeUpdater::GeneratedContent::updateQuotesUpTo):
3071         (WebCore::createContentRenderers):
3072         (WebCore::RenderTreeUpdater::GeneratedContent::updatePseudoElement):
3073         * style/RenderTreeUpdaterListItem.cpp:
3074         (WebCore::RenderTreeUpdater::ListItem::updateMarker):
3075         * style/RenderTreeUpdaterListItem.h:
3076         * style/RenderTreeUpdaterMultiColumn.cpp:
3077         (WebCore::RenderTreeUpdater::MultiColumn::createFragmentedFlow):
3078         (WebCore::RenderTreeUpdater::MultiColumn::destroyFragmentedFlow):
3079
3080 2017-12-14  Youenn Fablet  <youenn@apple.com>
3081
3082         Implement <iframe allow="camera; microphone">
3083         https://bugs.webkit.org/show_bug.cgi?id=167430
3084
3085         Reviewed by Eric Carlson.
3086
3087         Tests: imported/w3c/web-platform-tests/mediacapture-streams/MediaStream-default-feature-policy.https.sub.html
3088
3089         Adding allow attribute to HTMLIFrameElement as per https://wicg.github.io/feature-policy/#iframe-allow-attribute.
3090         Cross-origin iframes will get access to camera/microphone based on this attribute value.
3091         Same-origin iframes do not need any attribute.
3092         In case getUserMedia requests both camera and microphone, and allow attribute is only one of these,
3093         getUserMedia access is denied. This goes against the tests but is not very clear from the specification.
3094
3095         * Modules/mediastream/UserMediaRequest.cpp:
3096         (WebCore::isSecure):
3097         (WebCore::isAllowedToUse):
3098         (WebCore::canCallGetUserMedia):
3099         (WebCore::UserMediaRequest::start):
3100         * html/HTMLAttributeNames.in:
3101         * html/HTMLIFrameElement.cpp:
3102         (WebCore::HTMLIFrameElement::parseAttribute):
3103         * html/HTMLIFrameElement.h:
3104         * html/HTMLIFrameElement.idl:
3105
3106 2017-12-14  Zalan Bujtas  <zalan@apple.com>
3107
3108         Inconsistent section grid could lead to CrashOnOverflow
3109         https://bugs.webkit.org/show_bug.cgi?id=180850
3110         <rdar://problem/34064811>
3111
3112         Reviewed by Simon Fraser.
3113
3114         Each RenderTableSection maintains a grid of rows and columns. The number of columns in this grid equals the
3115         maximum number of columns in the entire table (taking spans and multiple sections into account).
3116         Since the maximum number of columns might change while re-computing the sections, we need to
3117         adjust them accordingly at the end (otherwise it could lead to inconsistent grids where rows have different number of columns).
3118
3119         Test: fast/table/table-row-oveflow-crash.html
3120
3121         * rendering/RenderTable.cpp:
3122         (WebCore::RenderTable::recalcSections const):
3123         * rendering/RenderTableSection.cpp:
3124         (WebCore::RenderTableSection::removeRedundantColumns):
3125         * rendering/RenderTableSection.h:
3126
3127 2017-12-14  David Kilzer  <ddkilzer@apple.com>
3128
3129         Enable -Wstrict-prototypes for WebKit
3130         <https://webkit.org/b/180757>
3131         <rdar://problem/36024132>
3132
3133         Rubber-stamped by Joseph Pecoraro.
3134
3135         * Configurations/Base.xcconfig:
3136         (CLANG_WARN_STRICT_PROTOTYPES): Add. Set to YES.
3137
3138 2017-12-14  Youenn Fablet  <youenn@apple.com>
3139
3140         srflx and relay ICE candidates lack raddr (rel-addr) and rport (rel-port) attributes if getUserMedia access has not been granted
3141         https://bugs.webkit.org/show_bug.cgi?id=180842
3142
3143         Reviewed by Jon Lee.
3144
3145         Manually tested since there is no way to gather reflexive or stun candidates in WebKit CI.
3146
3147         * Modules/mediastream/PeerConnectionBackend.cpp:
3148         (WebCore::filterICECandidate):
3149
3150 2017-12-14  Commit Queue  <commit-queue@webkit.org>
3151
3152         Unreviewed, rolling out r225878.
3153         https://bugs.webkit.org/show_bug.cgi?id=180855
3154
3155         Introduced a crash in HTMLPictureElement. We're taking a
3156         different approach for webkit.org/b/180769 (Requested by rniwa
3157         on #webkit).
3158
3159         Reverted changeset:
3160
3161         "Crash inside ImageLoader::updateFromElement()"
3162         https://bugs.webkit.org/show_bug.cgi?id=180769
3163         https://trac.webkit.org/changeset/225878
3164
3165 2017-12-14  Ryan Haddad  <ryanhaddad@apple.com>
3166
3167         Unreviewed, rolling out r225931.
3168
3169         Breaks internal builds.
3170
3171         Reverted changeset:
3172
3173         "Fix Mac CMake build"
3174         https://bugs.webkit.org/show_bug.cgi?id=180835
3175         https://trac.webkit.org/changeset/225931
3176
3177 2017-12-14  Simon Fraser  <simon.fraser@apple.com>
3178
3179         Another Windows build fix.
3180
3181         * platform/graphics/cg/GraphicsContextCG.cpp:
3182         (WebCore::extendedSRGBColorSpaceRef):
3183
3184 2017-12-14  Simon Fraser  <simon.fraser@apple.com>
3185
3186         Fix Windows build after r225915.
3187
3188         Windows doens't have dispatch_once with blocks. Switch to use lambda functions instead.
3189
3190         * platform/graphics/cg/GraphicsContextCG.cpp:
3191         (WebCore::sRGBColorSpaceRef):
3192         (WebCore::linearRGBColorSpaceRef):
3193         (WebCore::extendedSRGBColorSpaceRef):
3194         (WebCore::displayP3ColorSpaceRef):
3195
3196 2017-12-14  Devin Rousso  <webkit@devinrousso.com>
3197
3198         Web Inspector: replace HTMLCanvasElement with CanvasRenderingContext for instrumentation logic
3199         https://bugs.webkit.org/show_bug.cgi?id=180770
3200
3201         Reviewed by Joseph Pecoraro.
3202
3203         No change in functionality.
3204
3205         * html/canvas/CanvasRenderingContext.h:
3206         * html/canvas/CanvasRenderingContext.cpp:
3207         (WebCore::CanvasRenderingContext::~CanvasRenderingContext):
3208         Instead of waiting on the HTMLCanvasElement to destruct to call willDestroyCanvasRenderingContext
3209         we can call out in the destructor and know that the CanvasRenderingContext will be destroyed
3210         immediately thereafter.
3211
3212         * html/canvas/CanvasRenderingContext2D.h:
3213         * html/canvas/CanvasRenderingContext2D.cpp:
3214         (WebCore::CanvasRenderingContext2D::create):
3215         * html/canvas/ImageBitmapRenderingContext.h:
3216         * html/canvas/ImageBitmapRenderingContext.cpp:
3217         (WebCore::ImageBitmapRenderingContext::create):
3218         * html/canvas/WebGL2RenderingContext.h:
3219         * html/canvas/WebGL2RenderingContext.cpp:
3220         (WebCore::WebGL2RenderingContext::create):
3221         * html/canvas/WebGLRenderingContext.h:
3222         * html/canvas/WebGLRenderingContext.cpp:
3223         (WebCore::WebGLRenderingContext::create):
3224         * html/canvas/WebGLRenderingContextBase.cpp:
3225         (WebCore::WebGLRenderingContextBase::create):
3226         * html/canvas/WebGPURenderingContext.cpp:
3227         (WebCore::WebGPURenderingContext::create):
3228         * html/HTMLCanvasElement.cpp:
3229         (WebCore::HTMLCanvasElement::createContext2d):
3230         (WebCore::HTMLCanvasElement::createContextWebGL):
3231         (WebCore::HTMLCanvasElement::createContextWebGPU):
3232         (WebCore::HTMLCanvasElement::createContextBitmapRenderer):
3233         (WebCore::HTMLCanvasElement::paint):
3234         (WebCore::HTMLCanvasElement::setImageBuffer const):
3235         Instead of adding didCreateCanvasRenderingContext calls at the construction sites of each
3236         context, we can make the constructors private and force the usage of static `create` functions.
3237         This way, we have access to the fully constructed object and have a guaranteed path for creation.
3238
3239         * inspector/InspectorCanvas.h:
3240         * inspector/InspectorCanvas.cpp:
3241         (WebCore::InspectorCanvas::create):
3242         (WebCore::InspectorCanvas::InspectorCanvas):
3243         (WebCore::InspectorCanvas::canvasElement):
3244         (WebCore::InspectorCanvas::resetRecordingData):
3245         (WebCore::InspectorCanvas::recordAction):
3246         (WebCore::InspectorCanvas::buildObjectForCanvas):
3247         (WebCore::InspectorCanvas::getCanvasContentAsDataURL):
3248         (WebCore::InspectorCanvas::buildInitialState):
3249         
3250         * inspector/InspectorShaderProgram.h:
3251         * inspector/InspectorShaderProgram.cpp:
3252         (WebCore::InspectorShaderProgram::context const):
3253
3254         * inspector/agents/InspectorCanvasAgent.h:
3255         * inspector/agents/InspectorCanvasAgent.cpp:
3256         (WebCore::InspectorCanvasAgent::InspectorCanvasAgent):
3257         (WebCore::InspectorCanvasAgent::enable):
3258         (WebCore::InspectorCanvasAgent::disable):
3259         (WebCore::InspectorCanvasAgent::requestNode):
3260         (WebCore::InspectorCanvasAgent::requestContent):
3261         (WebCore::InspectorCanvasAgent::requestCSSCanvasClientNodes):
3262         (WebCore::contextAsScriptValue):
3263         (WebCore::InspectorCanvasAgent::resolveCanvasContext):
3264         (WebCore::InspectorCanvasAgent::startRecording):
3265         (WebCore::InspectorCanvasAgent::stopRecording):
3266         (WebCore::InspectorCanvasAgent::updateShader):
3267         (WebCore::InspectorCanvasAgent::frameNavigated):
3268         (WebCore::InspectorCanvasAgent::didChangeCSSCanvasClientNodes):
3269         (WebCore::InspectorCanvasAgent::didCreateCanvasRenderingContext):
3270         (WebCore::InspectorCanvasAgent::willDestroyCanvasRenderingContext):
3271         (WebCore::InspectorCanvasAgent::didChangeCanvasMemory):
3272         (WebCore::InspectorCanvasAgent::recordCanvasAction):
3273         (WebCore::InspectorCanvasAgent::didFinishRecordingCanvasFrame):
3274         (WebCore::InspectorCanvasAgent::consoleStartRecordingCanvas):
3275         (WebCore::InspectorCanvasAgent::didEnableExtension):
3276         (WebCore::InspectorCanvasAgent::didCreateProgram):
3277         (WebCore::InspectorCanvasAgent::canvasDestroyedTimerFired):
3278         (WebCore::InspectorCanvasAgent::canvasRecordingTimerFired):
3279         (WebCore::InspectorCanvasAgent::clearCanvasData):
3280         (WebCore::InspectorCanvasAgent::unbindCanvas):
3281         (WebCore::InspectorCanvasAgent::findInspectorCanvas):
3282         (WebCore::InspectorCanvasAgent::unbindProgram):
3283         (WebCore::InspectorCanvasAgent::didCreateCSSCanvas): Deleted.
3284         (WebCore::InspectorCanvasAgent::canvasDestroyed): Deleted.
3285
3286         * inspector/InspectorInstrumentation.h:
3287         (WebCore::InspectorInstrumentation::didCreateCanvasRenderingContext):
3288         (WebCore::InspectorInstrumentation::willDestroyCanvasRenderingContext):
3289         (WebCore::InspectorInstrumentation::didChangeCanvasMemory):
3290         (WebCore::InspectorInstrumentation::recordCanvasAction):
3291         (WebCore::InspectorInstrumentation::didFinishRecordingCanvasFrame):
3292         (WebCore::InspectorInstrumentation::didEnableExtension):
3293         (WebCore::InspectorInstrumentation::didCreateProgram):
3294         (WebCore::InspectorInstrumentation::willDeleteProgram):
3295         (WebCore::InspectorInstrumentation::isShaderProgramDisabled):
3296         (WebCore::InspectorInstrumentation::consoleStartRecordingCanvas):
3297         (WebCore::InspectorInstrumentation::didCreateCSSCanvas): Deleted.
3298         * inspector/InspectorInstrumentation.cpp:
3299         (WebCore::InspectorInstrumentation::consoleStartRecordingCanvasImpl):
3300         (WebCore::InspectorInstrumentation::didChangeCSSCanvasClientNodesImpl):
3301         (WebCore::InspectorInstrumentation::didCreateCanvasRenderingContextImpl):
3302         (WebCore::InspectorInstrumentation::willDestroyCanvasRenderingContextImpl):
3303         (WebCore::InspectorInstrumentation::didChangeCanvasMemoryImpl):
3304         (WebCore::InspectorInstrumentation::didFinishRecordingCanvasFrameImpl):
3305         (WebCore::InspectorInstrumentation::didEnableExtensionImpl):
3306         (WebCore::InspectorInstrumentation::didCreateProgramImpl):
3307         (WebCore::InspectorInstrumentation::didCreateCSSCanvasImpl): Deleted.
3308
3309         * page/PageConsoleClient.cpp:
3310         (WebCore::PageConsoleClient::record):
3311         (WebCore::PageConsoleClient::recordEnd):
3312
3313         * dom/Document.h:
3314         * dom/Document.cpp:
3315         (WebCore::Document::getCSSCanvasElement):
3316         (WebCore::Document::nameForCSSCanvasElement const):
3317         We have no reason to save the CSS canvas name for each InspectorCanvas object, so instead we
3318         can just query for the name based on the CanvasRenderingContext's HTMLCanvasElement (assuming
3319         it is not an OffscreenCanvas) when we need it.
3320
3321 2017-12-14  Chris Dumez  <cdumez@apple.com>
3322
3323         self.importScripts() should obey updateViaCache inside service workers
3324         https://bugs.webkit.org/show_bug.cgi?id=180826
3325
3326         Reviewed by Youenn Fablet.
3327
3328         self.importScripts() should obey updateViaCache inside service workers, as per:
3329         - https://html.spec.whatwg.org/multipage/workers.html#dom-workerglobalscope-importscripts
3330
3331         Tests: http/tests/workers/service/registration-updateViaCache-all-importScripts.html
3332                http/tests/workers/service/registration-updateViaCache-imports-importScripts.html
3333                http/tests/workers/service/registration-updateViaCache-none-importScripts.html
3334
3335         * workers/WorkerGlobalScope.cpp:
3336         (WebCore::WorkerGlobalScope::importScripts):
3337         * workers/WorkerScriptLoader.cpp:
3338         (WebCore::WorkerScriptLoader::loadSynchronously):
3339         * workers/WorkerScriptLoader.h:
3340         * workers/service/SWClientConnection.cpp:
3341         (WebCore::SWClientConnection::setRegistrationLastUpdateTime):
3342         * workers/service/SWClientConnection.h:
3343         * workers/service/ServiceWorkerRegistration.cpp:
3344         (WebCore::ServiceWorkerRegistration::lastUpdateTime const):
3345         (WebCore::ServiceWorkerRegistration::setLastUpdateTime):
3346         * workers/service/ServiceWorkerRegistration.h:
3347         * workers/service/server/SWServer.h:
3348         * workers/service/server/SWServerRegistration.cpp:
3349         (WebCore::SWServerRegistration::setLastUpdateTime):
3350         * workers/service/server/SWServerRegistration.h:
3351
3352 2017-12-14  Yusuke Suzuki  <utatane.tea@gmail.com>
3353
3354         Drop Thread::tryCreate
3355         https://bugs.webkit.org/show_bug.cgi?id=180808
3356
3357         Reviewed by Darin Adler.
3358
3359         This change reveals that nobody cares the WorkerThread::start's failure.
3360         We should use `Thread::create` to ensure thread is actually starting.
3361
3362         * workers/WorkerThread.cpp:
3363         (WebCore::WorkerThread::start):
3364         * workers/WorkerThread.h:
3365
3366 2017-12-14  Alicia Boya GarcĂ­a  <aboya@igalia.com>
3367
3368         [MSE] Add isValid() check before using trackBuffer.lastEnqueuedPresentationTime
3369         https://bugs.webkit.org/show_bug.cgi?id=180258
3370
3371         Reviewed by Jer Noble.
3372
3373         * Modules/mediasource/SourceBuffer.cpp:
3374         (WebCore::SourceBuffer::sourceBufferPrivateDidReceiveSample):
3375
3376 2017-12-14  John Wilander  <wilander@apple.com>
3377
3378         Storage Access API: Implement frame-specific access in the document.cookie layer
3379         https://bugs.webkit.org/show_bug.cgi?id=180682
3380         <rdar://problem/35982257>
3381
3382         Reviewed by Alex Christensen.
3383
3384         No new tests. Changed expected result from existing test.
3385
3386         CookiesStrategy::cookiesForDOM(), CookiesStrategy::setCookiesFromDOM(),
3387         CookiesStrategy::cookieRequestHeaderFieldValue(), and
3388         CookiesStrategy::getRawCookies() now take optional parameters for
3389         frameID and pageID to allow frame-specific scoping of cookies.
3390
3391         This change makes the return values of FrameLoaderClient::frameID()
3392         and FrameLoaderClient::pageID() std::optional<uint64_t> so that
3393         WebCore can call those getters and get the right return values in
3394         WebKit and std:nullopt in WebKitLegacy.
3395
3396         * dom/Document.cpp:
3397         (WebCore::Document::requestStorageAccess):
3398         * loader/CookieJar.cpp:
3399         (WebCore::cookies):
3400         (WebCore::setCookies):
3401         (WebCore::cookieRequestHeaderFieldValue):
3402         (WebCore::getRawCookies):
3403         * loader/EmptyFrameLoaderClient.h:
3404         * loader/FrameLoaderClient.h:
3405         * platform/CookiesStrategy.h:
3406         * platform/network/CacheValidation.cpp:
3407         (WebCore::headerValueForVary):
3408         * platform/network/PlatformCookieJar.h:
3409         * platform/network/cf/CookieJarCFNet.cpp:
3410         (WebCore::setCookiesFromDOM):
3411         (WebCore::cookiesForDOM):
3412         (WebCore::cookieRequestHeaderFieldValue):
3413         (WebCore::getRawCookies):
3414         * platform/network/curl/CookieJarCurl.cpp:
3415         (WebCore::CookieJarCurlFileSystem::setCookiesFromDOM):
3416         (WebCore::CookieJarCurlFileSystem::cookiesForDOM):
3417         (WebCore::CookieJarCurlFileSystem::cookieRequestHeaderFieldValue):
3418         (WebCore::CookieJarCurlFileSystem::getRawCookies):
3419         (WebCore::cookiesForDOM):
3420         (WebCore::setCookiesFromDOM):
3421         (WebCore::cookieRequestHeaderFieldValue):
3422         (WebCore::getRawCookies):
3423         * platform/network/curl/CookieJarCurl.h:
3424         * platform/network/mac/CookieJarMac.mm:
3425         (WebCore::cookiesInPartitionForURL):
3426         (WebCore::cookiesForURL):
3427         (WebCore::cookiesForSession):
3428         (WebCore::cookiesForDOM):
3429         (WebCore::cookieRequestHeaderFieldValue):
3430         (WebCore::setCookiesFromDOM):
3431         (WebCore::getRawCookies):
3432         * platform/network/soup/CookieJarSoup.cpp:
3433         (WebCore::setCookiesFromDOM):
3434         (WebCore::cookiesForDOM):
3435         (WebCore::cookieRequestHeaderFieldValue):
3436         (WebCore::getRawCookies):
3437
3438 2017-12-14  Alex Christensen  <achristensen@webkit.org>
3439
3440         Fix Mac CMake build
3441         https://bugs.webkit.org/show_bug.cgi?id=180835
3442
3443         Reviewed by Andy Estes.
3444
3445         * PlatformMac.cmake:
3446         * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.h:
3447
3448 2017-12-14  Antoine Quint  <graouts@apple.com>
3449
3450         [Web Animations] Use is<> when possible
3451         https://bugs.webkit.org/show_bug.cgi?id=180832
3452
3453         Reviewed by Dean Jackson.
3454
3455         Adopt is<> when possible.
3456
3457         * animation/WebAnimation.cpp:
3458         (WebCore::WebAnimation::setEffect):
3459         (WebCore::WebAnimation::setTimeline):
3460         (WebCore::WebAnimation::startOrStopAccelerated):
3461
3462 2017-12-14  Antoine Quint  <graouts@apple.com>
3463
3464         [Web Animations] Bring timeline and currentTime setters closer to compliance
3465         https://bugs.webkit.org/show_bug.cgi?id=180834
3466
3467         Reviewed by Dean Jackson.
3468
3469         Now that we've added support for the concept of a hold time, pending tasks
3470         and updating the finished state, adopt those in places we had already implemented
3471         but weren't fully compliant.
3472
3473         Web Platform Tests cover these behaviors, but we're currently failing those tests
3474         due to lacking an implementation for Element.animate().
3475
3476         * animation/WebAnimation.cpp:
3477         (WebCore::WebAnimation::setTimeline): Add some spec comments to clarify the code behavior
3478         and implement step 4 of the "setting the timeline" procedure where we reset the hold time
3479         to an unresolved value if the start time is resolved, as well as step 5 where we update the
3480         finished state. Finally, we also ensure we update the pending tasks as the ready state is
3481         dependent on a timeline being set.
3482         (WebCore::WebAnimation::bindingsStartTime const): Invert the way we test for an unresolved
3483         value to match prior review comments by Dean Jackson.
3484         (WebCore::WebAnimation::setBindingsStartTime): Use a boolean check rather than checking
3485         equality with std::nullopt.
3486         (WebCore::WebAnimation::setBindingsCurrentTime): Do not raise an exception when setting
3487         an unresolved time.
3488
3489 2017-12-14  Antoine Quint  <graouts@apple.com>
3490
3491         [Web Animations] Implement the cancel() method on Animation
3492         https://bugs.webkit.org/show_bug.cgi?id=180830
3493         <rdar://problem/36055816>
3494
3495         Reviewed by Dean Jackson.
3496
3497         We implement the cancel() method on the Animation interface with full spec text defining
3498         the normative behavior of those methods and code matching those steps. Implementing the
3499         cancel() method required implementing the notion of "resetting pending tasks",
3500         which the Web Animations spec defines as well.
3501
3502         * animation/WebAnimation.cpp:
3503         (WebCore::WebAnimation::setEffect):
3504         (WebCore::WebAnimation::cancel):
3505         (WebCore::WebAnimation::resetPendingTasks):
3506         * animation/WebAnimation.h:
3507         * animation/WebAnimation.idl:
3508
3509 2017-12-14  Jer Noble  <jer.noble@apple.com>
3510
3511         "Click to exit fullscreen" text not legible on High Sierra
3512         https://bugs.webkit.org/show_bug.cgi?id=180825
3513         <rdar://problem/32839983>
3514
3515         Reviewed by Eric Carlson.
3516
3517         Explicitly set the NSVisualAffectView's .appearance property.
3518
3519         * platform/mac/WebCoreFullScreenPlaceholderView.mm:
3520         (-[WebCoreFullScreenPlaceholderView initWithFrame:]):
3521
3522 2017-12-14  Antoine Quint  <graouts@apple.com>
3523
3524         [Web Animations] Implement the finish() method on Animation
3525         https://bugs.webkit.org/show_bug.cgi?id=180822
3526         <rdar://problem/36053282>
3527
3528         Reviewed by Dean Jackson.
3529
3530         We implement the finish() method on the Animation interface with full spec text defining
3531         the normative behavior of those methods and code matching those steps. Implementing the
3532         finish() method required implementing the notion of "silently setting the current time",
3533         which the Web Animations spec defines as well.
3534
3535         * animation/WebAnimation.cpp:
3536         (WebCore::WebAnimation::silentlySetCurrentTime):
3537         (WebCore::WebAnimation::setCurrentTime):
3538         (WebCore::WebAnimation::finish):
3539         * animation/WebAnimation.h:
3540         * animation/WebAnimation.idl:
3541
3542 2017-12-14  Chris Dumez  <cdumez@apple.com>
3543
3544         Service worker script fetching currently always uses the network cache
3545         https://bugs.webkit.org/show_bug.cgi?id=180816
3546
3547         Reviewed by Alex Christensen.
3548
3549         Service worker script fetching currently always uses the network cache. This is incorrect as per:
3550         - https://w3c.github.io/ServiceWorker/#update-algorithm (step 7.2)
3551
3552         Tests: http/tests/workers/service/registration-updateViaCache-all.html
3553                http/tests/workers/service/registration-updateViaCache-none.html
3554
3555         * workers/Worker.cpp:
3556         (WebCore::Worker::create):
3557         * workers/WorkerScriptLoader.cpp:
3558         (WebCore::WorkerScriptLoader::loadAsynchronously):
3559         * workers/WorkerScriptLoader.h:
3560         * workers/service/SWClientConnection.cpp:
3561         (WebCore::SWClientConnection::startScriptFetchForServer):
3562         * workers/service/SWClientConnection.h:
3563         * workers/service/ServiceWorkerContainer.cpp:
3564         (WebCore::ServiceWorkerContainer::startScriptFetchForJob):
3565         * workers/service/ServiceWorkerContainer.h:
3566         * workers/service/ServiceWorkerJob.cpp:
3567         (WebCore::ServiceWorkerJob::startScriptFetch):
3568         (WebCore::ServiceWorkerJob::fetchScriptWithContext):
3569         * workers/service/ServiceWorkerJob.h:
3570         * workers/service/ServiceWorkerJobClient.h:
3571         * workers/service/server/SWServer.cpp:
3572         (WebCore::SWServer::startScriptFetch):
3573         * workers/service/server/SWServer.h:
3574         * workers/service/server/SWServerJobQueue.cpp:
3575         (WebCore::SWServerJobQueue::runUpdateJob):
3576         * workers/service/server/SWServerRegistration.h:
3577         (WebCore::SWServerRegistration::lastUpdateTime const):
3578
3579 2017-12-14  Simon Fraser  <simon.fraser@apple.com>
3580
3581         Remove ColorSpaceDeviceRGB and most users of the obsolete deviceRGB colorspace
3582         https://bugs.webkit.org/show_bug.cgi?id=180689
3583
3584         Reviewed by Darin Adler.
3585         
3586         Address issues noted by Darin in r225797:
3587         
3588         Existing and new code mistakenly allocated colorspaces on every call, because
3589         they didn't initialize the static variable on the first call. Avoid this mistake
3590         by using dispatch_once() in these functions.
3591
3592         Fix a case where the extendedSRGBColorSpaceRef() fallback was returning deviceRGB
3593         instead of sRGB.
3594
3595         * platform/graphics/cg/GraphicsContextCG.cpp:
3596         (WebCore::sRGBColorSpaceRef):
3597         (WebCore::linearRGBColorSpaceRef):
3598         (WebCore::extendedSRGBColorSpaceRef):
3599         (WebCore::displayP3ColorSpaceRef):
3600         * platform/graphics/cocoa/GraphicsContextCocoa.mm:
3601         (WebCore::linearRGBColorSpaceRef):
3602
3603 2017-12-13  Keith Miller  <keith_miller@apple.com>
3604
3605         JSObjects should have a mask for loading indexed properties
3606         https://bugs.webkit.org/show_bug.cgi?id=180768
3607
3608         Reviewed by Mark Lam.
3609
3610         * bindings/js/JSDOMConvertSequences.h:
3611         (WebCore::Detail::NumericSequenceConverter::convertArray):
3612         (WebCore::Detail::SequenceConverter::convertArray):
3613
3614 2017-12-13  Antoine Quint  <graouts@apple.com>
3615
3616         [Web Animations] Implement the play() and pause() methods on Animation
3617         https://bugs.webkit.org/show_bug.cgi?id=178932
3618         <rdar://problem/35271069>
3619
3620         Reviewed by Eric Carlson.
3621
3622         We implement the play() and pause() methods of the Animation interface with full spec text defining
3623         the normative behavior of those methods and code matching those steps. Playing and pausing animations
3624         incur running a play or pause task when conditions are met, specifically here when the timeline is ready.
3625         So we add the notion of pending tasks and provide a proper implementation of pending() which we had
3626         introduced in an earlier patch with a constant false return value.
3627
3628         Note that the play() method exposes an auto-rewinding flag which we always set to true, but other specs,
3629         namely CSS Animations, do not require the rewinding behavior, so we expose it for future use.
3630
3631         * animation/WebAnimation.cpp:
3632         (WebCore::WebAnimation::play):
3633         (WebCore::WebAnimation::setTimeToRunPendingPlayTask):
3634         (WebCore::WebAnimation::runPendingPlayTask):
3635         (WebCore::WebAnimation::pause):
3636         (WebCore::WebAnimation::setTimeToRunPendingPauseTask):
3637         (WebCore::WebAnimation::runPendingPauseTask):
3638         (WebCore::WebAnimation::updatePendingTasks):
3639         * animation/WebAnimation.h:
3640         * animation/WebAnimation.idl:
3641
3642 2017-12-14  Frederic Wang  <fwang@igalia.com>
3643
3644         Make GraphicsLayer::dumpProperties dump m_offsetFromRenderer
3645         https://bugs.webkit.org/show_bug.cgi?id=180473
3646
3647         Reviewed by Antonio Gomes.
3648
3649         No new tests, this is just a new debug info.
3650
3651         * platform/graphics/GraphicsLayer.cpp:
3652         (WebCore::GraphicsLayer::dumpProperties const): Dump the offset from renderer if nonzero.
3653
3654 2017-12-12  Yusuke Suzuki  <utatane.tea@gmail.com>
3655
3656         REGRESSION(r225769): Build errors with constexpr std::tie on older gcc
3657         https://bugs.webkit.org/show_bug.cgi?id=180692
3658
3659         Reviewed by Carlos Garcia Campos.
3660
3661         * platform/graphics/FontSelectionAlgorithm.h:
3662         (WebCore::FontSelectionRange::operator== const):
3663         (WebCore::FontSelectionRequest::tied const):
3664         (WebCore::FontSelectionCapabilities::tied const):
3665         (WebCore::FontSelectionSpecifiedCapabilities:: const):
3666
3667 2017-12-13  Daniel Bates  <dabates@apple.com>
3668
3669         Fix the Windows build after <https://trac.webkit.org/changeset/225879>
3670         (https://bugs.webkit.org/show_bug.cgi?id=180651)
3671
3672         * html/TextFieldInputType.cpp:
3673         (WebCore::autoFillButtonTypeToAccessibilityLabel):
3674         (WebCore::autoFillButtonTypeToAutoFillButtonText):
3675         (WebCore::autoFillButtonTypeToAutoFillButtonPseudoClassName):
3676
3677 2017-12-13  Devin Rousso  <webkit@devinrousso.com>
3678
3679         Web Inspector: add instrumentation for ImageBitmapRenderingContext
3680         https://bugs.webkit.org/show_bug.cgi?id=180736
3681
3682         Reviewed by Joseph Pecoraro.
3683
3684         Tests: inspector/canvas/create-context-bitmaprenderer.html
3685                inspector/canvas/requestContent-bitmaprenderer.html
3686                inspector/canvas/resolveCanvasContext-bitmaprenderer.html
3687
3688         * CMakeLists.txt:
3689         * Sources.txt:
3690         * WebCore.xcodeproj/project.pbxproj:
3691
3692         * html/HTMLCanvasElement.cpp:
3693         (WebCore::HTMLCanvasElement::getContext):
3694         (WebCore::HTMLCanvasElement::createContextBitmapRenderer):
3695         Support passing an optional settings dictionary when creating an ImageBitmapRenderingContext.
3696
3697         * inspector/agents/InspectorCanvasAgent.cpp:
3698         (WebCore::InspectorCanvasAgent::requestContent):
3699         (WebCore::contextAsScriptValue):
3700
3701         * bindings/js/CallTracerTypes.h:
3702
3703         * inspector/InspectorCanvas.h:
3704         * inspector/InspectorCanvas.cpp:
3705         (WebCore::InspectorCanvas::buildObjectForCanvas):
3706         (WebCore::InspectorCanvas::indexForData):
3707         (WebCore::InspectorCanvas::buildAction):
3708         (WebCore::InspectorCanvas::buildArrayForImageBitmap): Deleted.
3709
3710 2017-12-13  Daniel Bates  <dabates@apple.com>
3711
3712         Add more auto fill button types
3713         https://bugs.webkit.org/show_bug.cgi?id=180651
3714         <rdar://problem/35891125>
3715         And
3716         <rdar://problem/35977943>
3717
3718         Reviewed by Brent Fulgham.
3719
3720         Tests: fast/forms/auto-fill-button/input-autofilled-disabled-strong-password-auto-fill-button.html
3721                fast/forms/auto-fill-button/input-autofilled-readonly-strong-password-auto-fill-button.html
3722                fast/forms/auto-fill-button/input-disabled-strong-password-and-strong-confirmation-password-auto-fill-buttons.html
3723                fast/forms/auto-fill-button/input-readonly-strong-password-and-strong-confirmation-password-auto-fill-buttons.html
3724                fast/forms/auto-fill-button/input-strong-confirmation-password-auto-fill-button.html
3725                fast/forms/auto-fill-button/input-strong-password-auto-fill-button.html
3726
3727         * English.lproj/Localizable.strings:
3728         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
3729         (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]): Add strings for new auto fill button types.
3730
3731         * css/CSSSelector.cpp:
3732         (WebCore::CSSSelector::selectorText const):
3733         * css/CSSSelector.h:
3734         * css/SelectorChecker.cpp:
3735         (WebCore::SelectorChecker::checkOne const):
3736         * css/SelectorCheckerTestFunctions.h:
3737         (WebCore::isAutofilledStrongPassword):
3738         * css/SelectorPseudoClassAndCompatibilityElementMap.in:
3739         * css/html.css:
3740         (input::-webkit-strong-password-auto-fill-button):
3741         (input:-webkit-autofill-strong-password):
3742         (input:-webkit-autofill, input:-webkit-autofill-strong-password):
3743         (input:-webkit-autofill): Deleted.
3744         * cssjit/SelectorCompiler.cpp:
3745         (WebCore::SelectorCompiler::addPseudoClassType):
3746         Add new CSS pseudo class and CSS styles.
3747
3748         * html/HTMLInputElement.cpp:
3749         (WebCore::HTMLInputElement::reset): Hide the auto fill button when the form is reset. This is also called
3750         whenever we suspend the page to put it into the page cache.
3751         (WebCore::HTMLInputElement::setShowAutoFillButton): Modified to update the editability of the inner text element
3752         and invalidate styles for the subtree as the editability may have changed depending on the auto fill button type.
3753
3754         (WebCore::autoFillStrongPasswordMaskImage):
3755         (WebCore::HTMLInputElement::createInnerTextStyle):
3756         (WebCore::HTMLInputElement::createInnerTextStyle const): Deleted.
3757         Adjust the look of the inner text field. This function is not const because we may need to resolve style to
3758         generate a mask image.
3759
3760         * html/HTMLInputElement.h:
3761         (WebCore::HTMLInputElement::autoFillButtonType const): Fix style nit; use a C++ style cast while I am in
3762         this area.
3763         (WebCore::HTMLInputElement::hasAutoFillStrongPasswordButton const): Added.
3764
3765         * html/HTMLTextAreaElement.cpp:
3766         (WebCore::HTMLTextAreaElement::createInnerTextStyle):
3767         (WebCore::HTMLTextAreaElement::createInnerTextStyle const): Deleted.
3768         Made this non-const because HTMLInputElement::createInnerTextStyle() needs to be non-const. See above.
3769
3770         * html/HTMLTextAreaElement.h:
3771         * html/HTMLTextFormControlElement.cpp:
3772         (WebCore::HTMLTextFormControlElement::isInnerTextElementEditable const):
3773         (WebCore::HTMLTextFormControlElement::updateInnerTextElementEditability):
3774         Extract out the query to determine if the inner text element is editable into a virtual function isInnerTextElementEditable()
3775         and have updateInnerTextElementEditability() make use of it. By default a field is considered editable if it is not disabled
3776         or read-only. We override updateInnerTextElementEditability() in HTMLInputElement to also consider the auto fill button type.
3777
3778         * html/HTMLTextFormControlElement.h:
3779         * html/TextFieldInputType.cpp:
3780         (WebCore::autoFillButtonTypeToAccessibilityLabel):
3781         (WebCore::autoFillButtonTypeToAutoFillButtonText):
3782         (WebCore::autoFillButtonTypeToAutoFillButtonPseudoClassName):
3783         (WebCore::isAutoFillButtonTypeChanged):
3784         (WebCore::TextFieldInputType::createAutoFillButton):
3785         (WebCore::TextFieldInputType::updateAutoFillButton):
3786         Support having text for the auto fill button.
3787
3788         * platform/LocalizedStrings.cpp:
3789         (WebCore::AXAutoFillStrongPasswordLabel):
3790         (WebCore::AXAutoFillStrongConfirmationPasswordLabel):
3791         (WebCore::autoFillStrongPasswordLabel):
3792         * platform/LocalizedStrings.h:
3793         Add localized strings.
3794
3795         * rendering/RenderTextControlSingleLine.h: Disallow scrolling depending on the auto fill button type.
3796
3797         * testing/Internals.cpp:
3798         (WebCore::toAutoFillButtonType):
3799         * testing/Internals.h:
3800         * testing/Internals.idl:
3801         Add support for testing.
3802
3803 2017-12-13  Ryosuke Niwa  <rniwa@webkit.org>
3804
3805         Crash inside ImageLoader::updateFromElement()
3806         https://bugs.webkit.org/show_bug.cgi?id=180769
3807         <rdar://problem/35278782>
3808
3809         Reviewed by Antti Koivisto.
3810
3811         Fixed the crash by moving all call sites of ImageLoader::updateFromElement() to be post insertion callbacks
3812         where it's safe to execute arbitrary scripts.
3813
3814         No new test since existing tests cover this with a newly added release assert in ImageLoader.
3815
3816         * html/HTMLImageElement.cpp:
3817         (WebCore::HTMLImageElement::insertedIntoAncestor):
3818         (WebCore::HTMLImageElement::didFinishInsertingNode): Extracted from insertedIntoAncestor to call
3819         selectImageSource or updateFromElement.
3820         * html/HTMLImageElement.h: Made many member functions final.
3821         * html/HTMLInputElement.cpp:
3822         (WebCore::HTMLInputElement::didAttachRenderers): Delay the call to ImageLoader::updateFromElement() in
3823         ImageInputType using a post style resolution callback.
3824         * html/HTMLMetaElement.h:
3825         * html/HTMLPictureElement.cpp:
3826         (WebCore::HTMLPictureElement::sourcesChanged): Store the list of child image elements into a vector before
3827         calling selectImageSource since each call may execute arbitrary scripts.
3828         * html/HTMLSourceElement.cpp:
3829         (WebCore::HTMLSourceElement::insertedIntoAncestor): Delay the call to ImageLoader::updateFromElement()
3830         using a post style resolution callback.
3831         (WebCore::HTMLSourceElement::didFinishInsertingNode): Extracted from insertedIntoAncestor.
3832         * html/HTMLSourceElement.h:
3833         * html/HTMLVideoElement.cpp:
3834         (WebCore::HTMLVideoElement::didAttachRenderers):
3835         (WebCore::HTMLVideoElement::updateAfterStyleResolution): Extracted from didAttachRenderers.
3836         * html/HTMLVideoElement.h:
3837         * html/ImageInputType.cpp:
3838         (WebCore::ImageInputType::needsPostStyleResolutionCallback): Added. Returns true so that HTMLInputElement's
3839         didAttachRenderers would register a post style resolution callback.
3840         (WebCore::ImageInputType::updateAfterStyleResolution): Extracted from attach.
3841         (WebCore::ImageInputType::attach): Deleted.
3842         * html/ImageInputType.h:
3843         * html/InputType.cpp:
3844         (WebCore::InputType::needsPostStyleResolutionCallback): Added. All but ImageInputType returns false.
3845         (WebCore::InputType::updateAfterStyleResolution): Added.
3846         (WebCore::InputType::attach): Deleted.
3847         * html/InputType.h:
3848         * loader/ImageLoader.cpp:
3849         (WebCore::ImageLoader::updateFromElement): Added a release assertion. There is no direct security implication
3850         so there is no need to use RELEASE_ASSERT_WITH_SECURITY_IMPLICATION here.
3851         * svg/SVGImageElement.cpp:
3852         (WebCore::SVGImageElement::insertedIntoAncestor):
3853         (WebCore::SVGImageElement::didFinishInsertingNode):
3854         * svg/SVGImageElement.h:
3855
3856 2017-12-13  Zalan Bujtas  <zalan@apple.com>
3857
3858         RenderImage can be destroyed even before setting the style on it.
3859         https://bugs.webkit.org/show_bug.cgi?id=180767
3860         <rdar://problem/33965995>
3861
3862         Reviewed by Simon Fraser.
3863
3864         In certain cases, when the newly constructed renderer can't be inserted into the tree (parent can only have specific type of children etc),
3865         RenderTreeUpdater destroys it right away. While destroying a RenderImage, the associated image resource assumes
3866         that the image renderer has been initialized through RenderElement::initializeStyle(). This is an incorrect
3867         assumption.
3868         This patch also makes RenderImageResource's m_renderer a weak pointer.
3869            
3870         Test: fast/images/crash-when-image-renderer-is-destroyed-before-calling-initializeStyle.html
3871
3872         * rendering/RenderImageResource.cpp:
3873         (WebCore::RenderImageResource::initialize):
3874         (WebCore::RenderImageResource::setCachedImage):
3875         (WebCore::RenderImageResource::resetAnimation):
3876         (WebCore::RenderImageResource::image const):
3877         (WebCore::RenderImageResource::setContainerContext):
3878         (WebCore::RenderImageResource::imageSize const):
3879         * rendering/RenderImageResource.h:
3880         (WebCore::RenderImageResource::renderer const):
3881         * rendering/RenderImageResourceStyleImage.cpp:
3882         (WebCore::RenderImageResourceStyleImage::shutdown):
3883
3884 2017-12-13  Ryosuke Niwa  <rniwa@webkit.org>
3885
3886         Update the SVG use element's shadow trees explicitly before the style recall
3887         https://bugs.webkit.org/show_bug.cgi?id=180729
3888         <rdar://problem/36009806>
3889
3890         Reviewed by Antti Koivisto.
3891
3892         Update the SVG use element's shadow trees before start resolving styles. Document now has a hash set of all
3893         connected SVG use elements with invalidated shadow trees. SVGUseElement adds itself to this set when its
3894         shadow tree gets invalidated, or it gets newly connected to a document with the invalidated shadow tree.
3895         SVGUseElement removes itself from this set when it updates its shadow tree or it gets disconnected from
3896         a document with the invalidated shadow tree.
3897
3898         No new tests. Covered by existing tests.
3899
3900         * dom/Document.cpp:
3901         (WebCore::Document::~Document): Assert that m_svgUseElements has been cleared.
3902         (WebCore::Document::resolveStyle): Update the shadow trees of SVG use elements with invalidated shadow trees.
3903         (WebCore::Document::addSVGUseElement): Added.
3904         (WebCore::Document::removeSVGUseElement): Added.
3905         * dom/Document.h:
3906         (WebCore::Document::svgUseElements const): Added.
3907         * dom/Element.cpp:
3908         (WebCore::Element::cloneElementWithChildren): Removed EventAllowedScope since the SVG use element's shadow
3909         tree is no longer updated when there is a NoEventDispatchAssertion in the stack.
3910         (WebCore::Element::cloneElementWithoutChildren): Ditto.
3911         * style/StyleTreeResolver.cpp:
3912         (WebCore::Style::TreeResolver::resolveComposedTree): No longer drops the assertion now that SVG use element's
3913         shadow tree is updated before calling this function.
3914         * svg/SVGUseElement.cpp:
3915         (WebCore::SVGUseElement::insertedIntoAncestor): Add the element to the document's hash set if this use element's
3916         shadow tree needs to be updated (m_shadowTreeNeedsUpdate is set), and it got newly connected.
3917         (WebCore::SVGUseElement::removedFromAncestor): Ditto for removal. We have to check m_shadowTreeNeedsUpdate before
3918         calling SVGGraphicsElement::removedFromAncestor or updateExternalDocument since either function can invoke
3919         m_shadowTreeNeedsUpdate to true.
3920         (WebCore::SVGUseElement::willRecalcStyle): Deleted. We no longer call updateShadowTree during style recalc.
3921         (WebCore::SVGUseElement::updateShadowTree): Remove this element from the document's hah set. We can't clear all
3922         the entries in the map at once in Document::resolveStyle because updating the shadow trees of a SVG use element
3923         can result in a sync IPC in ImageLoader::updateFromElement, which end up executing arbitrary author scripts.
3924         (WebCore::SVGUseElement::cloneTarget const): Removed EventAllowedScope since the SVG use element's shadow tree
3925         is no longer updated when there is a NoEventDispatchAssertion in the stack.
3926         (WebCore::SVGUseElement::expandUseElementsInShadowTree const): Ditto.
3927         (WebCore::SVGUseElement::expandSymbolElementsInShadowTree const): Ditto.
3928         (WebCore::SVGUseElement::invalidateShadowTree): Add the element to the document's hash set if it's connected.
3929         * svg/SVGUseElement.h:
3930
3931 2017-12-13  Per Arne Vollan  <pvollan@apple.com>
3932
3933         REGRESSION(225597): Can't select a text box or web view on a page when VO is on.
3934         https://bugs.webkit.org/show_bug.cgi?id=180756
3935         <rdar://problem/35996158>
3936
3937         Reviewed by Brent Fulgham.
3938
3939         No new tests.
3940
3941         * platform/mac/EventLoopMac.mm:
3942         (WebCore::EventLoop::cycle):
3943
3944 2017-12-13  Antoine Quint  <graouts@apple.com>
3945
3946         [Web Animations] Implement the "updating the finished state" procedure
3947         https://bugs.webkit.org/show_bug.cgi?id=180743
3948         <rdar://problem/36017232>
3949
3950         Reviewed by Simon Fraser.
3951
3952         The Web Animations spec defines a procedure for "updating the finished state", which should run as the timeline time
3953         changes and is responsible for ultimately triggering finish events and fulfil the "finished" promise. The procedure
3954         allows for two flags to control its behavior: didSeek and synchronouslyNotify. When synchronouslyNotify is true, the
3955         "finish notification steps" procedure is ran right away, otherwise it's queued as a microtask.
3956
3957         In this patch we introduce the notion of "hold time", which is the time held while an animation is paused. It will be
3958         set by the pause() and play() method in future patches.
3959
3960         * animation/DocumentTimeline.cpp:
3961         (WebCore::DocumentTimeline::updateAnimations): Update the finished state as the timeline time changes with both flags
3962         set to false.
3963         * animation/WebAnimation.cpp:
3964         (WebCore::WebAnimation::currentTime const): Add a private currentTime(bool) variant which allows for the hold time to
3965         be ignored in case updateFinishedState() was called with the didSeek flag set to false.