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