[Curl] Extract multipart handling from ResourceHandle to CurlRequest.
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2018-01-11  Basuke Suzuki  <Basuke.Suzuki@sony.com>
2
3         [Curl] Extract multipart handling from ResourceHandle to CurlRequest.
4         https://bugs.webkit.org/show_bug.cgi?id=181506
5
6         Reviewed by Alex Christensen.
7
8         Rename old MultipartHandle class to CurlMultipartHandle and modernize it. Also move the responsibility 
9         of handling multi part from ResourceHandle to CurlRequest. This is required for upcoming NetworkLoadTask.
10
11         No new tests because no new behavior.
12
13         * platform/Curl.cmake:
14         * platform/network/curl/CurlMultipartHandle.cpp: Renamed from Source/WebCore/platform/network/curl/MultipartHandle.cpp.
15         (WebCore::CurlMultipartHandle::createIfNeeded):
16         (WebCore::CurlMultipartHandle::extractBoundary):
17         (WebCore::CurlMultipartHandle::extractBoundaryFromContentType):
18         (WebCore::CurlMultipartHandle::CurlMultipartHandle):
19         (WebCore::CurlMultipartHandle::didReceiveData):
20         (WebCore::CurlMultipartHandle::didComplete):
21         (WebCore::CurlMultipartHandle::processContent):
22         (WebCore::CurlMultipartHandle::checkForBoundary):
23         (WebCore::CurlMultipartHandle::matchedLength):
24         (WebCore::CurlMultipartHandle::parseHeadersIfPossible):
25         * platform/network/curl/CurlMultipartHandle.h: Renamed from Source/WebCore/platform/network/curl/MultipartHandle.h.
26         (WebCore::CurlMultipartHandle::~CurlMultipartHandle):
27         * platform/network/curl/CurlMultipartHandleClient.h: Added.
28         (WebCore::CurlMultipartHandleClient::~CurlMultipartHandleClient):
29         * platform/network/curl/CurlRequest.cpp:
30         (WebCore::CurlRequest::CurlRequest):
31         (WebCore::CurlRequest::didReceiveHeader):
32         (WebCore::CurlRequest::didReceiveData):
33         (WebCore::CurlRequest::didReceiveHeaderFromMultipart):
34         (WebCore::CurlRequest::didReceiveDataFromMultipart):
35         (WebCore::CurlRequest::didCompleteTransfer):
36         (WebCore::CurlRequest::finalizeTransfer):
37         (WebCore::CurlRequest::invokeDidReceiveResponseForFile):
38         (WebCore::CurlRequest::invokeDidReceiveResponse):
39         (WebCore::CurlRequest::completeDidReceiveResponse):
40         * platform/network/curl/CurlRequest.h:
41         (WebCore::CurlRequest::create):
42         * platform/network/curl/ResourceHandleCurlDelegate.cpp:
43         (WebCore::ResourceHandleCurlDelegate::createCurlRequest):
44         (WebCore::ResourceHandleCurlDelegate::curlDidReceiveResponse):
45         (WebCore::ResourceHandleCurlDelegate::curlDidReceiveBuffer):
46         (WebCore::ResourceHandleCurlDelegate::curlDidComplete):
47         * platform/network/curl/ResourceHandleCurlDelegate.h:
48
49 2018-01-11  Zalan Bujtas  <zalan@apple.com>
50
51         RenderTreeUpdater::current() returns null_ptr when mutation is done through Document::resolveStyle.
52         https://bugs.webkit.org/show_bug.cgi?id=181513
53         <rdar://problem/36367085>
54
55         Reviewed by Antti Koivisto.
56
57         This patch ensures that we use a valid RenderTreeBuilder even when
58         Document::resolveStyle (incorrectly) triggers tree mutation.
59         It can be reverted soon after the incorrect mutations are taken care of.
60
61         Test: fast/forms/button-set-text-crash.html
62
63         * rendering/RenderButton.cpp:
64         (WebCore::RenderButton::setText):
65         * rendering/RenderMenuList.cpp:
66         (RenderMenuList::setText):
67
68 2018-01-11  Antoine Quint  <graouts@apple.com>
69
70         Only listen to webkitplaybacktargetavailabilitychanged when media controls are visible to the user
71         https://bugs.webkit.org/show_bug.cgi?id=181547
72         <rdar://problem/35947650>
73
74         Reviewed by Eric Carlson.
75
76         Because listening to "webkitplaybacktargetavailabilitychanged" events incurs some higher power usage on iOS,
77         we only listen to such events when controls are visible to the user. In other words, the MediaControls need to
78         have both "visible" set to "true" and "faded" set to "false". To support this, we add a delegate method on
79         MediaControls such that it can tell the MediaController that the "visible" property changed. With this message,
80         MediaController can inform its MediaControllerSupport objects that user visibility of the controls changed, which
81         lets AirplaySupport disable itself when controls are no longer visible.
82
83         Test: media/modern-media-controls/airplay-support/airplay-support-disable-event-listeners-with-hidden-controls.html
84
85         * Modules/modern-media-controls/controls/media-controls.js:
86         (MediaControls.prototype.set visible):
87         * Modules/modern-media-controls/media/airplay-support.js:
88         (AirplaySupport.prototype.controlsUserVisibilityDidChange):
89         * Modules/modern-media-controls/media/media-controller-support.js:
90         (MediaControllerSupport.prototype.controlsUserVisibilityDidChange):
91         * Modules/modern-media-controls/media/media-controller.js:
92         (MediaController.prototype.mediaControlsVisibilityDidChange):
93         (MediaController.prototype.mediaControlsFadedStateDidChange):
94         (MediaController.prototype._controlsUserVisibilityDidChange):
95
96 2018-01-11  Antoine Quint  <graouts@apple.com>
97
98         [iOS] There should be no controls markup generated in fullscreen
99         https://bugs.webkit.org/show_bug.cgi?id=181540
100         <rdar://problem/35060379>
101
102         Reviewed by Eric Carlson.
103
104         We completely forgo the display of any content when fullscreen on iOS by setting the
105         "visible" flag to "false" on the MediaControls, which will prevent any DOM content from
106         being added.
107
108         * Modules/modern-media-controls/media/media-controller.js:
109         (MediaController.prototype.handleEvent):
110         (MediaController.prototype._updateiOSFullscreenProperties):
111         (MediaController):
112         (MediaController.prototype._updateSupportingObjectsEnabledState): Deleted.
113
114 2018-01-11  Alex Christensen  <achristensen@webkit.org>
115
116         Revert changes accidentally committed with r226789.
117         https://bugs.webkit.org/show_bug.cgi?id=181423
118
119         I had some local changes I did not mean to commit.
120
121         * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm:
122         (scheduledWithCustomRunLoopMode):
123         (-[WebCoreResourceHandleAsOperationQueueDelegate callFunctionOnMainThread:]):
124         (WebCore::if): Deleted.
125         (WebCore::>::fromCallable): Deleted.
126
127 2018-01-10  Simon Fraser  <simon.fraser@apple.com>
128
129         On macOS, getBoundingClientRect gives incorrect values when pinch-zoomed
130         https://bugs.webkit.org/show_bug.cgi?id=181511
131         rdar://problem/33741427
132
133         Reviewed by Zalan Bujtas.
134         
135         When reverting "client coordinates are relative to layout viewport" in r219829
136         I broke documentToClientOffset() on macOS by failing to take pinch zoom scale into
137         account (frameScaleFactor() is always 1 on iOs, so this bug doesn't manifest there).
138
139         Covered by existing tests.
140
141         * page/FrameView.cpp:
142         (WebCore::FrameView::documentToClientOffset const):
143
144 2018-01-11  Youenn Fablet  <youenn@apple.com>
145
146         Replace WebRTCLegacyAPIDisabled by WebRTCLegacyAPIEnabled and switch off WebRTC legacy flag by default
147         https://bugs.webkit.org/show_bug.cgi?id=181480
148
149         Reviewed by Eric Carlson.
150
151         No change of behavior.
152
153         * page/RuntimeEnabledFeatures.h: Set default value to false.
154
155 2018-01-11  Wenson Hsieh  <wenson_hsieh@apple.com>
156
157         [Attachment Support] Support moving attachment elements in editable areas using drag and drop
158         https://bugs.webkit.org/show_bug.cgi?id=181337
159         <rdar://problem/36324813>
160
161         Reviewed by Tim Horton.
162
163         Makes slight adjustments to attachment-specific drag and drop logic to ensure that moving attachments via drag
164         and drop behaves correctly. See per-change comments for more detail.
165
166         Tests:  WKAttachmentTests.DragInPlaceVideoAttachmentElement
167                 WKAttachmentTests.MoveAttachmentElementAsIconByDragging
168                 WKAttachmentTests.MoveInPlaceAttachmentElementByDragging
169
170         * editing/cocoa/EditorCocoa.mm:
171         (WebCore::Editor::getPasteboardTypesAndDataForAttachment):
172
173         Stop vending the private web archive pasteboard type for attachments, for now. This works around issues where an
174         attachment element that is dragged and dropped within the same page may lose its blob backing data if we try to
175         remove and insert it as a fragment from the archive. Providing a web archive would allow us to avoid destroying
176         and recreating an attachment element when dragging within the same page, but this is a nice-to-have optimization
177         we can re-enable after investigation in a subsequent patch.
178
179         * html/HTMLAttachmentElement.cpp:
180         (WebCore::HTMLAttachmentElement::populateShadowRootIfNecessary):
181
182         Add `draggable=false` to the image element of an in-place attachment element.
183
184         * page/DragController.cpp:
185         (WebCore::enclosingAttachmentElement):
186         (WebCore::DragController::draggableElement const):
187
188         Tweak single-selected-attachment handling to account for in-place attachments. Since the hit-tested node is
189         inside the shadow subtree of the attachment element, the condition needs to check for the startElement as well
190         as the startElement's shadow host.
191
192         (WebCore::DragController::startDrag):
193
194         Make two tweaks here. First, don't require a RenderAttachment to drag an attachment element (this is required
195         for dragging in-place attachments). This was added in r217083 to address <rdar://problem/32282831>, but is no
196         longer correct, since attachments may now be displayed in-place.
197
198         Secondly, only restore the previous selection if the attachment is in a richly contenteditable area. This was
199         added to prevent the selection highlight from appearing in when dragging non-editable attachment elements in the
200         Mail viewer. However, to allow drag moves to occur, we need the selection to persist after drag start.
201
202 2018-01-04  Filip Pizlo  <fpizlo@apple.com>
203
204         CodeBlocks should be in IsoSubspaces
205         https://bugs.webkit.org/show_bug.cgi?id=180884
206
207         Reviewed by Saam Barati.
208
209         No new tests because no new behavior.
210         
211         Adopting new parallel constraint API, so that more of the logic of doing parallel
212         constraint solving is shared between the DOM's output constraints and JSC's output
213         constraints.
214
215         * bindings/js/DOMGCOutputConstraint.cpp:
216         (WebCore::DOMGCOutputConstraint::executeImpl):
217         (WebCore::DOMGCOutputConstraint::doParallelWorkImpl): Deleted.
218         (WebCore::DOMGCOutputConstraint::finishParallelWorkImpl): Deleted.
219         * bindings/js/DOMGCOutputConstraint.h:
220
221 2018-01-11  Wenson Hsieh  <wenson_hsieh@apple.com>
222
223         [Attachment Support] Support dragging attachment elements out as files on iOS
224         https://bugs.webkit.org/show_bug.cgi?id=181199
225         <rdar://problem/36299316>
226
227         Reviewed by Tim Horton, Andy Estes and Joseph Pecoraro.
228
229         Adds support for dragging "files" (i.e. creating item providers with preferred attachment presentation styles)
230         from attachment elements on iOS for Mail. See below for more detail.
231
232         Tests:  WKAttachmentTestsIOS.DragAttachmentInsertedAsData
233                 WKAttachmentTestsIOS.DragAttachmentInsertedAsFile
234
235         * page/DragController.cpp:
236         (WebCore::DragController::platformContentTypeForBlobType const):
237         (WebCore::DragController::dragAttachmentElement):
238         * page/DragController.h:
239         * page/mac/DragControllerMac.mm:
240         (WebCore::DragController::platformContentTypeForBlobType const):
241
242         Add a private method to convert the type of a promised blob to a platform type. For Cocoa platforms, this
243         converts the blob type (either a UTI or a MIME type) to a UTI for the platform to consume.
244
245         * platform/ios/WebItemProviderPasteboard.h:
246         * platform/ios/WebItemProviderPasteboard.mm:
247
248         Refactor WebItemProviderRegistrationInfo. WebItemProviderRegistrationInfo currently encapsulates a single item
249         provider registration call, and contains either a type identifier and data buffer, or an NSItemProviderWriting-
250         conformant object. To register an item provider using a WebItemProviderRegistrationInfo, the item provider
251         pasteboard currently checks to see whether the info contains an object or a type and data.
252
253         This patch removes WebItemProviderRegistrationInfo and replaces it with WebItemProviderDataRegistrar. Objects
254         that implement this protocol know how to take an NSItemProvider and register data to it. So far, there are
255         three implementations below.
256
257         (-[WebItemProviderDataRegistrar initWithData:type:]):
258         (-[WebItemProviderDataRegistrar typeIdentifier]):
259         (-[WebItemProviderDataRegistrar data]):
260         (-[WebItemProviderDataRegistrar typeIdentifierForClient]):
261         (-[WebItemProviderDataRegistrar dataForClient]):
262         (-[WebItemProviderDataRegistrar registerItemProvider:]):
263         (-[WebItemProviderDataRegistrar description]):
264
265         A data registrar takes a UTI and data buffer, and registers the UTI to the data. This replaces a
266         WebItemProviderRegistrationInfo with both a type and data, but no representing object.
267
268         (-[WebItemProviderWritableObjectRegistrar initWithObject:]):
269         (-[WebItemProviderWritableObjectRegistrar representingObjectForClient]):
270         (-[WebItemProviderWritableObjectRegistrar registerItemProvider:]):
271         (-[WebItemProviderWritableObjectRegistrar description]):
272
273         The writable object registrar writes an NSItemProviderWriting-conformant object to an item provider. This
274         replaces a WebItemProviderRegistrationInfo with only a representing object.
275
276         (-[WebItemProviderPromisedFileRegistrar initWithType:callback:]):
277         (-[WebItemProviderPromisedFileRegistrar registerItemProvider:]):
278         (-[WebItemProviderPromisedFileRegistrar description]):
279         (-[WebItemProviderRegistrationInfoList addData:forType:]):
280         (-[WebItemProviderRegistrationInfoList addRepresentingObject:]):
281         (-[WebItemProviderRegistrationInfoList addPromisedType:fileCallback:]):
282
283         Helper methods to add new registrars to a registration info list.
284
285         (-[WebItemProviderRegistrationInfoList itemAtIndex:]):
286         (-[WebItemProviderRegistrationInfoList enumerateItems:]):
287         (-[WebItemProviderRegistrationInfoList itemProvider]):
288         (-[WebItemProviderRegistrationInfoList description]):
289         (-[WebItemProviderRegistrationInfo initWithRepresentingObject:typeIdentifier:data:]): Deleted.
290         (-[WebItemProviderRegistrationInfo representingObject]): Deleted.
291         (-[WebItemProviderRegistrationInfo typeIdentifier]): Deleted.
292
293 2018-01-11  Michael Saboff  <msaboff@apple.com>
294
295         Add a DOM gadget for Spectre testing
296         https://bugs.webkit.org/show_bug.cgi?id=181351
297
298         Reviewed by Ryosuke Niwa.
299
300         This change is used to test Spectre mitigations.
301
302         Added a new DOM class to test for Spectre issues in the DOM layer.
303         This additional functionality is disabled by default and must be enabled
304         through the JSC option "enableSpectreGadgets".
305
306         * CMakeLists.txt:
307         * DerivedSources.make:
308         * Sources.txt:
309         * WebCore.xcodeproj/project.pbxproj:
310         * bindings/js/WebCoreBuiltinNames.h:
311         * dom/SpectreGadget.cpp: Added.
312         (WebCore::SpectreGadget::SpectreGadget):
313         (WebCore::SpectreGadget::create):
314         (WebCore::SpectreGadget::setReadLength):
315         (WebCore::SpectreGadget::charCodeAt):
316         (WebCore::SpectreGadget::clflushReadLength):
317         * dom/SpectreGadget.h: Added.
318         * dom/SpectreGadget.idl: Added.
319         * page/RuntimeEnabledFeatures.cpp:
320         (WebCore::RuntimeEnabledFeatures::spectreGadgetsEnabled const):
321         * page/RuntimeEnabledFeatures.h:
322
323 2018-01-11  Philippe Normand  <pnormand@igalia.com>
324
325         [GTK] media/muted-video-is-playing-audio.html is timing out
326         https://bugs.webkit.org/show_bug.cgi?id=163781
327
328         Reviewed by Carlos Garcia Campos.
329
330         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
331         (WebCore::MediaPlayerPrivateGStreamer::notifyPlayerOfVideo): Sprinkle some debugging.
332         (WebCore::MediaPlayerPrivateGStreamer::notifyPlayerOfAudio): Ditto.
333         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
334         (WebCore::MediaPlayerPrivateGStreamerBase::setMuted): Ditto.
335
336 2018-01-10  Andy Estes  <aestes@apple.com>
337
338         [Payment Request] Rename ApplePayMerchantValidationEvent to MerchantValidationEvent
339         https://bugs.webkit.org/show_bug.cgi?id=181437
340         <rdar://problem/36376481>
341
342         Reviewed by Tim Horton.
343         
344         Renamed ApplePayMerchantValidationEvent to MerchantValidationEvent and changed complete() to accept a Promise.
345
346         Test: http/tests/paymentrequest/payment-request-merchant-validation.https.html
347
348         * DerivedSources.make:
349         * Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp:
350         (WebCore::ApplePayPaymentHandler::merchantValidationCompleted):
351         (WebCore::ApplePayPaymentHandler::validateMerchant):
352         * Modules/applepay/paymentrequest/ApplePayPaymentHandler.h:
353         * Modules/paymentrequest/MerchantValidationEvent.cpp: Renamed from Source/WebCore/Modules/applepay/paymentrequest/ApplePayMerchantValidationEvent.cpp.
354         (WebCore::MerchantValidationEvent::create):
355         (WebCore::MerchantValidationEvent::MerchantValidationEvent):
356         (WebCore::MerchantValidationEvent::eventInterface const):
357         (WebCore::MerchantValidationEvent::complete):
358         * Modules/paymentrequest/MerchantValidationEvent.h: Renamed from Source/WebCore/Modules/applepay/paymentrequest/ApplePayMerchantValidationEvent.h.
359         * Modules/paymentrequest/MerchantValidationEvent.idl: Renamed from Source/WebCore/Modules/applepay/paymentrequest/ApplePayMerchantValidationEvent.idl.
360         * Modules/paymentrequest/PaymentHandler.h:
361         * Modules/paymentrequest/PaymentRequest.cpp:
362         (WebCore::PaymentRequest::completeMerchantValidation):
363         * Modules/paymentrequest/PaymentRequest.h:
364         * Modules/paymentrequest/PaymentRequest.idl:
365         * WebCore.xcodeproj/project.pbxproj:
366         * dom/EventNames.h:
367         * dom/EventNames.in:
368
369 2018-01-10  Basuke Suzuki  <Basuke.Suzuki@sony.com>
370
371         [Curl] Cross-protocol, cross-site scripting (XPXSS) using HTML forms
372         Nhttps://bugs.webkit.org/show_bug.cgi?id=153088
373
374         Reviewed by Alex Christensen.
375
376         No new tests because it's covered by existing tests.
377
378         * platform/network/curl/CurlContext.cpp:
379         (WebCore::CurlHandle::getHttpVersion):
380         * platform/network/curl/CurlContext.h:
381         * platform/network/curl/CurlRequest.cpp:
382         (WebCore::CurlRequest::didReceiveHeader):
383         * platform/network/curl/CurlResponse.h:
384         (WebCore::CurlResponse::isolatedCopy const):
385         * platform/network/curl/ResourceResponseCurl.cpp:
386         (WebCore::ResourceResponse::ResourceResponse):
387         (WebCore::ResourceResponse::setStatusLine):
388
389 2018-01-10  Wenson Hsieh  <wenson_hsieh@apple.com>
390
391         REGRESSION(r222507): Composition highlight doesn't render when using IME
392         https://bugs.webkit.org/show_bug.cgi?id=181485
393         <rdar://problem/35896516>
394
395         Reviewed by Ryosuke Niwa.
396
397         Fixes the order of arguments passed to paintTextSubrangeBackground from paintCompositionBackground.
398
399         Test: editing/marked-text-appearance.html
400
401         * rendering/InlineTextBox.cpp:
402         (WebCore::InlineTextBox::paintCompositionBackground):
403
404 2018-01-10  Youenn Fablet  <youenn@apple.com>
405
406         Use no-cache fetch mode when loading main documents with location.reload()
407         https://bugs.webkit.org/show_bug.cgi?id=181285
408
409         Reviewed by Alex Christensen.
410
411         Covered by rebased tests.
412
413         Start to translate cache policy used for navigation as FetchOptions::Cache.
414         This allows ensuring service workers receive the right cache mode when intercepting navigation loads.
415         To not change current navigation behavior, ReturnCacheDataElseLoad and ReturnCacheDataDontLoad still trigger default fetch cache mode.
416
417         For Reload and ReloadExpiredOnly frame load types, using no-cache mode is more efficient than reload mode,
418         as a conditional request will be sent if possible. This applies to location.reload which is consistent with other browsers.
419         Keep reload mode for ReloadFromOrigin.
420
421         * loader/DocumentLoader.cpp:
422         (WebCore::toFetchOptionsCache):
423         (WebCore::DocumentLoader::loadMainResource):
424         * loader/FrameLoader.cpp:
425         (WebCore::FrameLoader::loadFrameRequest):
426         (WebCore::FrameLoader::loadURL):
427         (WebCore::FrameLoader::load):
428         (WebCore::FrameLoader::reload):
429         (WebCore::FrameLoader::defaultRequestCachingPolicy):
430         (WebCore::FrameLoader::loadDifferentDocumentItem):
431         * loader/NavigationScheduler.cpp:
432
433 2018-01-10  Commit Queue  <commit-queue@webkit.org>
434
435         Unreviewed, rolling out r226667 and r226673.
436         https://bugs.webkit.org/show_bug.cgi?id=181488
437
438         This caused a flaky crash. (Requested by mlewis13 on #webkit).
439
440         Reverted changesets:
441
442         "CodeBlocks should be in IsoSubspaces"
443         https://bugs.webkit.org/show_bug.cgi?id=180884
444         https://trac.webkit.org/changeset/226667
445
446         "REGRESSION (r226667): CodeBlocks should be in IsoSubspaces"
447         https://bugs.webkit.org/show_bug.cgi?id=180884
448         https://trac.webkit.org/changeset/226673
449
450 2018-01-10  Antti Koivisto  <antti@apple.com>
451
452         REGRESSION(r225650): The scores of MotionMark tests Multiply and Leaves dropped by 8%
453         https://bugs.webkit.org/show_bug.cgi?id=181460
454         <rdar://problem/36379776>
455
456         Reviewed by Ryosuke Niwa.
457
458         * css/parser/CSSParser.cpp:
459         (WebCore::CSSParserContext::CSSParserContext):
460
461         Don't do the expensive security origin test if the sheet base URL and document URL are identical.
462         This is true for inline style and inline stylesheets.
463
464 2018-01-10  Antti Koivisto  <antti@apple.com>
465
466         Try to fix windows build.
467
468         * css/RuleFeature.cpp:
469         (WebCore::RuleFeatureSet::computeNextMatchElement):
470
471 2018-01-10  Zalan Bujtas  <zalan@apple.com>
472
473         [RenderTreeBuilder] Move RenderRuby's moveChildren logic to RenderTreeBuilder
474         https://bugs.webkit.org/show_bug.cgi?id=181470
475         <rdar://problem/36397683>
476
477         Reviewed by Antti Koivisto.
478
479         This is about moving code, no cleanup and/or normalization (unfortunately it also means
480         some temporary changes).  
481
482         No change in functionality.
483
484         * rendering/RenderBlockFlow.h:
485         * rendering/RenderRubyBase.cpp:
486         (WebCore::RenderRubyBase::moveChildren): Deleted.
487         (WebCore::RenderRubyBase::mergeChildrenWithBase): Deleted.
488         (WebCore::RenderRubyBase::moveInlineChildren): Deleted.
489         (WebCore::RenderRubyBase::moveBlockChildren): Deleted.
490         * rendering/RenderRubyBase.h:
491         * rendering/RenderRubyRun.cpp:
492         (WebCore::RenderRubyRun::takeChild):
493         * rendering/updating/RenderTreeBuilder.cpp:
494         (WebCore::RenderTreeBuilder::moveRubyChildren):
495         * rendering/updating/RenderTreeBuilder.h:
496         * rendering/updating/RenderTreeBuilderRuby.cpp:
497         (WebCore::RenderTreeBuilder::Ruby::moveInlineChildren):
498         (WebCore::RenderTreeBuilder::Ruby::moveBlockChildren):
499         (WebCore::RenderTreeBuilder::Ruby::moveChildren):
500         (WebCore::RenderTreeBuilder::Ruby::moveChildrenInternal):
501         (WebCore::RenderTreeBuilder::Ruby::insertChild):
502         * rendering/updating/RenderTreeBuilderRuby.h:
503
504 2018-01-10  Philippe Normand  <pnormand@igalia.com>
505
506         [GStreamer] fix critical GObject warning
507
508         Rubber-stamped by Carlos Garcia Campos.
509
510         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
511         (WebCore::MediaPlayerPrivateGStreamer::handleMessage): No need to
512         resort to complicated things to get the element name...
513
514 2018-01-10  Philippe Normand  <pnormand@igalia.com>
515
516         [GStreamer] REGRESSION(r226629): broke media/video-interruption-with-resume-allowing-play.html
517         https://bugs.webkit.org/show_bug.cgi?id=181471
518         <rdar://problem/36402323>
519
520         Reviewed by Carlos Garcia Campos.
521
522         This patch mainly reduces the amount of playback state changes
523         emitted by the GStreamer player to its client. Emitting those
524         notifications too often has bad side effects.
525
526         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
527         (WebCore::MediaPlayerPrivateGStreamer::paused const): Add debug messages.
528         (WebCore::MediaPlayerPrivateGStreamer::handleMessage): This debug message appears too much. Demote.
529         (WebCore::MediaPlayerPrivateGStreamer::maxTimeLoaded const): Ditto.
530         (WebCore::MediaPlayerPrivateGStreamer::didLoadingProgress const): Ditto.
531         (WebCore::MediaPlayerPrivateGStreamer::updateStates): Try to emit
532         playback state change notification only when going to PLAYING.
533         (WebCore::MediaPlayerPrivateGStreamer::loadingFailed): Add warning message.
534
535 2018-01-10  Youenn Fablet  <youenn@apple.com>
536
537         Add Service Worker CSP persistency
538         https://bugs.webkit.org/show_bug.cgi?id=181434
539
540         Reviewed by Alex Christensen.
541
542         Covered by manual testing.
543         Future work on service worker test infrastructure should allow automating such tests.
544
545         Add support for service worker CSP data persistency.
546         Add a version parameter to increment each time the schema is changing.
547         This allows the same store to be used by multiple WebKits.
548
549         * workers/service/server/RegistrationDatabase.cpp:
550         (WebCore::v1RecordsTableSchema):
551         (WebCore::RegistrationDatabase::openSQLiteDatabase):
552         (WebCore::RegistrationDatabase::doPushChanges):
553         (WebCore::RegistrationDatabase::importRecords):
554
555 2018-01-10  Antti Koivisto  <antti@apple.com>
556
557         Invalidate current element style on class change accurately
558         https://bugs.webkit.org/show_bug.cgi?id=181210
559
560         Reviewed by Zalan Bujtas.
561
562         * css/DocumentRuleSets.cpp:
563         (WebCore::DocumentRuleSets::collectFeatures const):
564         (WebCore::DocumentRuleSets::subjectClassRules const):
565
566             New rule set containing class rules affecting the subject element.
567
568         (WebCore::DocumentRuleSets::ancestorClassRules const):
569         * css/DocumentRuleSets.h:
570         * css/RuleFeature.cpp:
571         (WebCore::RuleFeatureSet::recursivelyCollectFeaturesFromSelector):
572
573             Classify selector components into various buckets based on the elements they match relative to
574             the subject element. There are more categories than this patch strictly needs, for future use.
575
576         (WebCore::RuleFeatureSet::collectFeatures):
577         (WebCore::RuleFeatureSet::add):
578         (WebCore::RuleFeatureSet::clear):
579         (WebCore::RuleFeatureSet::shrinkToFit):
580         * css/RuleFeature.h:
581         * css/StyleResolver.h:
582         (WebCore::StyleResolver::hasSelectorForClass const): Deleted.
583         * style/ClassChangeInvalidation.cpp:
584         (WebCore::Style::elementNeedsInvalidation):
585         (WebCore::Style::ClassChangeInvalidation::computeInvalidation):
586
587             Don't invalidate current element unconditionally on class change. Instead find the subject rulesets
588             that might affect it use them to perform invalidation.
589
590         (WebCore::Style::ClassChangeInvalidation::invalidateStyleWithRuleSets):
591         (WebCore::Style::ClassChangeInvalidation::invalidateStyle): Deleted.
592         (WebCore::Style::ClassChangeInvalidation::invalidateDescendantStyle): Deleted.
593         * style/ClassChangeInvalidation.h:
594         (WebCore::Style::ClassChangeInvalidation::ClassChangeInvalidation):
595         (WebCore::Style::ClassChangeInvalidation::~ClassChangeInvalidation):
596         * style/StyleSharingResolver.cpp:
597         (WebCore::Style::SharingResolver::classNamesAffectedByRules const):
598
599 2018-01-09  Antoine Quint  <graouts@apple.com>
600
601         [Web Animations] Expose the id property on Animation
602         https://bugs.webkit.org/show_bug.cgi?id=181450
603         <rdar://problem/36383600>
604
605         Reviewed by Dean Jackson.
606
607         Expose the "id" property on Animation and handle the "id" property on the optional KeyframeAnimationOptions object
608         passed to Element.animate(). All of the WPT tests related to this property are now passing.
609
610         * animation/WebAnimation.h:
611         * animation/WebAnimation.idl:
612         * dom/Element.cpp:
613         (WebCore::Element::animate):
614
615 2018-01-09  Chris Dumez  <cdumez@apple.com>
616
617         Make service workers behave correctly with regards to Page Cache
618         https://bugs.webkit.org/show_bug.cgi?id=181446
619         <rdar://problem/36164291>
620
621         Reviewed by Youenn Fablet.
622
623         Make service workers behave correctly with regards to Page Cache:
624         1. If a document has an active service worker, do not let it go into PageCache
625         2. When a document goes into page cache, unregister it from the list of service worker clients
626         3. When a document is restored from page cache, add it nack to the list of service worker clients
627
628         Tests: http/tests/workers/service/client-added-to-clients-when-restored-from-page-cache.html
629                http/tests/workers/service/client-removed-from-clients-while-in-page-cache.html
630                http/tests/workers/service/no-page-cache-when-controlled.html
631                http/tests/workers/service/other_resources/test.html
632
633         * dom/Document.cpp:
634         (WebCore::Document::suspend):
635         (WebCore::Document::resume):
636         * history/PageCache.cpp:
637         (WebCore::canCacheFrame):
638         * page/DiagnosticLoggingKeys.cpp:
639         (WebCore::DiagnosticLoggingKeys::serviceWorkerKey):
640         * page/DiagnosticLoggingKeys.h:
641
642 2018-01-09  Chris Dumez  <cdumez@apple.com>
643
644         We should not return undefined for most properties of a detached Window
645         https://bugs.webkit.org/show_bug.cgi?id=181416
646         <rdar://problem/36162489>
647
648         Reviewed by Ryosuke Niwa.
649
650         We should not return undefined for most properties on a detached Window. WebKit previously only exposed "closed"
651         and "close" properties on detached / frameless windows. However, this does not match the HTML specification [1]
652         or the behavior of Firefox and Chrome.
653
654         Note that Chrome does not seem to fully follow the HTML specification either, it seems to treat detached windows
655         the same way as cross-origin ones. As a result, it only exposed properties that are visible cross-origin when
656         a window is detached / frameless.
657
658         [1] https://html.spec.whatwg.org/#windowproxy-get
659
660         No new tests, updated existingt tests.
661
662         * bindings/js/JSDOMWindowCustom.cpp:
663         (WebCore::jsDOMWindowGetOwnPropertySlotRestrictedAccess):
664         (WebCore::JSDOMWindow::getOwnPropertySlot):
665         (WebCore::JSDOMWindow::getOwnPropertySlotByIndex):
666
667 2018-01-09  Darin Adler  <darin@apple.com>
668
669         Further refinement to list item and counter code after "list-item" counter fix
670         https://bugs.webkit.org/show_bug.cgi?id=181426
671
672         Reviewed by Zalan Bujtas.
673
674         * css/StyleBuilderCustom.h:
675         (WebCore::StyleBuilderCustom::applyInheritCounter): Use auto.
676         (WebCore::StyleBuilderCustom::applyValueCounter): Use auto, removed unneeded
677         null checks for things that can never be null, moved the saturated addition
678         here and got rid of the addIncrementValue function from CounterDirectives.
679         Use the saturatedAddition function from SaturatedArithmetic.h instead of the
680         much less efficient one that did the same thing, CounterDirectives::addClamped.
681
682         * rendering/RenderCounter.cpp:
683         (WebCore::listItemCounterDirectives): Use aggregate syntax for the return
684         statements.
685         (WebCore::planCounter): Changed to use a struct return value instead of two
686         out arguments. Use the saturatedAddition function from SaturatedArithmetic.h
687         instead of the much less efficient one that did the same thing,
688         CounterDirectives::addClamped.
689         (WebCore::findPlaceForCounter): Changed to use a struct return value instead
690         of two out arguments.
691         (WebCore::makeCounterNode): Updated for the above changes. Changed code to
692         use add instead of both get and set. Updated to keep the counter maps inside
693         the values of the "map of maps" instead of using a unique_ptr and allocating
694         each one on the heap.
695         (WebCore::destroyCounterNodeWithoutMapRemoval): Changed argument to a reference
696         instead of a pointer. Updated for changes to the map. Use RefPtr more
697         consistently.
698         (WebCore::RenderCounter::destroyCounterNodes): Use iterators less.
699         (WebCore::RenderCounter::destroyCounterNode): Ditto.
700         (WebCore::RenderCounter::rendererRemovedFromTree): Add a check of
701         hasCounterNodeMap here before calling destroyCounterNodes, so that function
702         can assume the flag is true (both other callers already check it).
703         (WebCore::updateCounters): Use auto and update for changes above.
704         (WebCore::RenderCounter::rendererStyleChanged): Use modern for loops instead
705         of iterators.
706         (showCounterRendererTree): Use auto and udpate for changes above.
707
708         * rendering/RenderListItem.cpp:
709         (WebCore::enclosingList): Stop referring to elements as "nodes". Changed
710         the local variable names for clarity.
711         (WebCore::nextListItemHelper): Renamed from nextListItem since it's not
712         intended to be called directly and we want to use a function pointer to
713         nextListItem. Fixed the algorithm to correctly handle ad hoc "lists" that
714         are not actually HTML list elements, using the definition in the enclosingList
715         function as the previousListItem function already did.
716         (WebCore::nextListItem): Updated for name changes.
717         (WebCore::firstListItem): Renamed from nextListItem for clarity.
718         (WebCore::previousListItem): Rewrote loop so it doesn't have to do things
719         so strangely when we find another list.
720         (WebCore::RenderListItem::updateItemValuesForOrderedList): Use auto and
721         update local variable names.
722         (WebCore::RenderListItem::itemCountForOrderedList): Ditto.
723         (WebCore::RenderListItem::updateValueNow const): Rewrote to use an iterative
724         algorithm instead of a recursive one. Fixes the FIXME here.
725         (WebCore::RenderListItem::updateValue): Use m_valueWasSetExplicitly
726         instead of m_explicitValue.
727         (WebCore::RenderListItem::explicitValueChanged): Use auto and simplified
728         the loop a bit.
729         (WebCore::RenderListItem::setExplicitValue): Set m_valueWasSetExplicitly
730         instead of m_explicitValue.
731         (WebCore::previousOrNextItem): Deleted.
732         (WebCore::RenderListItem::updateListMarkerNumbers): Streamlined the loop
733         a bit and used a fucntion pointer to handle the two different directions.
734         (WebCore::RenderListItem::isInReversedOrderedList const): Simplified by
735         getting rid of an unneeded use of pointers and local variables.
736
737         * rendering/RenderListItem.h: Use a boolean, m_valueWasSetExplicitly,
738         instead of a separate optional m_explicitValue.
739
740         * rendering/style/CounterDirectives.h: Since all the code in this file was
741         rewritten, removed old copyrights. Deleted the addIncrementValue function,
742         since it is clear enough in the one call site in the style builder.
743         Deleted the addClamped function because it was just a much slower
744         version of the saturatedAddition function. Made == and != into constexpr
745         functions since they are simple enough to be.
746
747         * rendering/style/RenderStyle.cpp:
748         (WebCore::RenderStyle::getCounterDirectives const): Deleted. Caller can
749         handle this just fine without a helper function.
750         * rendering/style/RenderStyle.h: Ditto.
751
752 2018-01-09  Myles C. Maxfield  <mmaxfield@apple.com>
753
754         font-display:fallback can cause a visual flash (which is supposed to be impossible)
755         https://bugs.webkit.org/show_bug.cgi?id=181374
756
757         Reviewed by Simon Fraser.
758
759         A FontCascade represents an entire font-family fallback list, but sometimes we need to pull out a single
760         representative font from the list to calculate things like line height. Previously, if the first item in
761         the font-family list was in the middle of being downloaded, this representative font was hardcoded to be
762         Times. However, when actually laying out and drawing the glyphs, we have logic to skip the interstitial
763         Times if there are any installed fonts present in the font-family list (so you wouldn't ever actually
764         see Times). This means that line height (among other things) was being calculated as if Times was used,
765         but in reality, some other font from the font-family list was being used.
766
767         Alone, this isn't a huge problem, but font-display:fallback makes a font transition between "timed out"
768         and "failed," and when the font hits the failed state, the representative font skips over the cancelled
769         item and hits the next item in the fallback list. This means that line heights will change, which causes
770         a visual flash, even when font-display:fallback is specified.
771
772         The solution is simply to educate the logic which identifies this representative font so that it
773         understands what to do for currently-loading fonts.
774
775         Tests: fast/text/font-display/swap-flash.html
776
777         * platform/graphics/FontCascadeFonts.h:
778         (WebCore::FontCascadeFonts::primaryFont):
779         * rendering/line/BreakingContext.h:
780         (WebCore::textWidth):
781
782 2018-01-04  Filip Pizlo  <fpizlo@apple.com>
783
784         CodeBlocks should be in IsoSubspaces
785         https://bugs.webkit.org/show_bug.cgi?id=180884
786
787         Reviewed by Saam Barati.
788
789         No new tests because no new behavior.
790         
791         Adopting new parallel constraint API, so that more of the logic of doing parallel
792         constraint solving is shared between the DOM's output constraints and JSC's output
793         constraints.
794
795         * bindings/js/DOMGCOutputConstraint.cpp:
796         (WebCore::DOMGCOutputConstraint::executeImpl):
797         (WebCore::DOMGCOutputConstraint::doParallelWorkImpl): Deleted.
798         (WebCore::DOMGCOutputConstraint::finishParallelWorkImpl): Deleted.
799         * bindings/js/DOMGCOutputConstraint.h:
800
801 2018-01-08  Simon Fraser  <simon.fraser@apple.com>
802
803         Clean up Marquee-related enums
804         https://bugs.webkit.org/show_bug.cgi?id=181347
805
806         Reviewed by Anders Carlsson.
807
808         Modernize EMarqueeBehavior and EMarqueeDirection enums. Stop using the weird negative
809         values in the MarqueeDirection and do manual reverse direction mapping.
810
811         Make some member functions of RenderMarquee private.
812
813         Stop using bitfields in RenderMarquee because the memory saving is not worth it, and doing so
814         allows us to use modern initialization.
815
816         No behavior change.
817
818         * css/CSSPrimitiveValueMappings.h:
819         (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
820         (WebCore::CSSPrimitiveValue::operator MarqueeBehavior const):
821         (WebCore::CSSPrimitiveValue::operator MarqueeDirection const):
822         (WebCore::CSSPrimitiveValue::operator EMarqueeBehavior const): Deleted.
823         (WebCore::CSSPrimitiveValue::operator EMarqueeDirection const): Deleted.
824         * css/StyleResolver.cpp:
825         (WebCore::StyleResolver::adjustRenderStyle):
826         * rendering/RenderBox.cpp:
827         (WebCore::RenderBox::sizesLogicalWidthToFitContent const):
828         * rendering/RenderLayer.cpp:
829         (WebCore::RenderLayer::calculateClipRects const):
830         * rendering/RenderMarquee.cpp:
831         (WebCore::RenderMarquee::RenderMarquee):
832         (WebCore::reverseDirection):
833         (WebCore::RenderMarquee::direction const):
834         (WebCore::RenderMarquee::isHorizontal const):
835         (WebCore::RenderMarquee::computePosition):
836         (WebCore::RenderMarquee::start):
837         (WebCore::RenderMarquee::updateMarqueePosition):
838         (WebCore::RenderMarquee::updateMarqueeStyle):
839         (WebCore::RenderMarquee::timerFired):
840         * rendering/RenderMarquee.h:
841         * rendering/style/RenderStyle.h:
842         (WebCore::RenderStyle::marqueeBehavior const):
843         (WebCore::RenderStyle::marqueeDirection const):
844         (WebCore::RenderStyle::setMarqueeDirection):
845         (WebCore::RenderStyle::setMarqueeBehavior):
846         (WebCore::RenderStyle::initialMarqueeBehavior):
847         (WebCore::RenderStyle::initialMarqueeDirection):
848         * rendering/style/RenderStyleConstants.h:
849         * rendering/style/StyleMarqueeData.cpp:
850         (WebCore::StyleMarqueeData::StyleMarqueeData):
851         * rendering/style/StyleMarqueeData.h:
852
853 2018-01-09  Jer Noble  <jer.noble@apple.com>
854
855         Many CVDisplayLink threads created and destroyed while watching a YouTube video
856         https://bugs.webkit.org/show_bug.cgi?id=181396
857
858         Reviewed by Simon Fraser.
859
860         When watching some YouTube videos (or any video with default controls), event handlers for
861         the "timeupdate" event which use rAF will cause the underlying platform objects to be
862         destroyed in between "timeupdate" events being fired, since they occur every 250ms, and rAF
863         objects are destroyed every 166ms (or 10/60hz). Update this constant to destroy the
864         underlying objects every 333ms (or 20/60hz) so that this common pattern doesn't lead to
865         excessive rAF platform object turnover.
866
867         * platform/Logging.h:
868         * platform/graphics/DisplayRefreshMonitor.h:
869         (WebCore::DisplayRefreshMonitor::shouldBeTerminated const):
870         * platform/graphics/DisplayRefreshMonitor.cpp:
871         (WebCore::DisplayRefreshMonitor::displayDidRefresh):
872         * platform/graphics/DisplayRefreshMonitorManager.cpp:
873         (WebCore::DisplayRefreshMonitorManager::createMonitorForClient):
874         (WebCore::DisplayRefreshMonitorManager::displayDidRefresh):
875
876 2018-01-09  Zalan Bujtas  <zalan@apple.com>
877
878         [RenderTreeBuilder] Move RenderElement addChild mutation logic to RenderTreeBuilder
879         https://bugs.webkit.org/show_bug.cgi?id=181451
880         <rdar://problem/36385562>
881
882         Reviewed by Antti Koivisto.
883
884         This is about moving code, no cleanup and/or normalization (unfortunately it also means
885         some temporary changes).  
886
887         No change in functionality.
888
889         * rendering/RenderElement.cpp:
890         (WebCore::RenderElement::addChild):
891         (WebCore::RenderElement::childRequiresTable const): Deleted.
892         * rendering/RenderElement.h:
893         * rendering/updating/RenderTreeBuilder.cpp:
894         (WebCore::RenderTreeBuilder::insertChildToRenderElement):
895         (WebCore::RenderTreeBuilder::childRequiresTable):
896         * rendering/updating/RenderTreeBuilder.h:
897         * rendering/updating/RenderTreeBuilderInline.cpp:
898         (WebCore::RenderTreeBuilder::Inline::insertChildToContinuation):
899         (WebCore::RenderTreeBuilder::Inline::insertChildIgnoringContinuation):
900         (WebCore::RenderTreeBuilder::Inline::newChildIsInline):
901         (WebCore::newChildIsInline): Deleted.
902         * rendering/updating/RenderTreeBuilderInline.h:
903
904 2018-01-09  Matt Lewis  <jlewis3@apple.com>
905
906         Unreviewed, rolling out r226531.
907
908         This caused test failures on macOS WK2.
909
910         Reverted changeset:
911
912         "Use no-cache fetch mode when loading main documents with
913         location.reload()"
914         https://bugs.webkit.org/show_bug.cgi?id=181285
915         https://trac.webkit.org/changeset/226531
916
917 2018-01-09  Michael Saboff  <msaboff@apple.com>
918
919         Unreviewed, rolling out r226600 and r226603
920         https://bugs.webkit.org/show_bug.cgi?id=181351
921
922         Add a DOM gadget for Spectre testing
923
924         * dom/Comment.cpp:
925         (WebCore::Comment::Comment):
926         (WebCore::Comment::setReadLength): Deleted.
927         (WebCore::Comment::charCodeAt): Deleted.
928         (WebCore::Comment::clflushReadLength): Deleted.
929         * dom/Comment.h:
930         * dom/Comment.idl:
931         * page/RuntimeEnabledFeatures.cpp:
932         (WebCore::RuntimeEnabledFeatures::spectreGadgetsEnabled const): Deleted.
933         * page/RuntimeEnabledFeatures.h:
934
935 2018-01-09  Don Olmstead  <don.olmstead@sony.com>
936
937         Add additional WEBCORE_EXPORTs
938         https://bugs.webkit.org/show_bug.cgi?id=181414
939
940         Reviewed by Alex Christensen.
941
942         No new tests. No change in behavior.
943
944         * dom/Document.h:
945         * dom/ViewportArguments.h:
946         * page/DOMWindow.h:
947         * page/FrameView.h:
948         * page/PageOverlayController.h:
949         * platform/ContextMenuItem.h:
950         * platform/Pasteboard.h:
951         * platform/SharedBuffer.h:
952         * platform/UserAgent.h:
953         * platform/graphics/GLContext.h:
954         * platform/graphics/GraphicsContext.h:
955         * platform/graphics/GraphicsLayerTransform.h:
956         * platform/graphics/PlatformDisplay.h:
957         * platform/graphics/cairo/BackingStoreBackendCairoImpl.h:
958         * platform/graphics/cairo/PlatformContextCairo.h:
959         * platform/graphics/cairo/RefPtrCairo.h:
960         * platform/graphics/nicosia/NicosiaBuffer.h:
961         * platform/graphics/nicosia/NicosiaPaintingEngine.h:
962         * platform/graphics/texmap/TextureMapper.h:
963         * platform/graphics/texmap/TextureMapperAnimation.h:
964         * platform/graphics/texmap/TextureMapperBackingStore.h:
965         * platform/graphics/texmap/TextureMapperFPSCounter.h:
966         * platform/graphics/texmap/TextureMapperLayer.h:
967         (WebCore::TextureMapperLayer::TextureMapperLayer): Deleted.
968         (WebCore::TextureMapperLayer::setID): Deleted.
969         (WebCore::TextureMapperLayer::id): Deleted.
970         (WebCore::TextureMapperLayer:: const): Deleted.
971         (WebCore::TextureMapperLayer::setScrollClient): Deleted.
972         (WebCore::TextureMapperLayer::setIsScrollable): Deleted.
973         (WebCore::TextureMapperLayer::isScrollable const): Deleted.
974         (WebCore::TextureMapperLayer::textureMapper const): Deleted.
975         (WebCore::TextureMapperLayer::setTextureMapper): Deleted.
976         (WebCore::TextureMapperLayer::drawsContent const): Deleted.
977         (WebCore::TextureMapperLayer::contentsAreVisible const): Deleted.
978         (WebCore::TextureMapperLayer::size const): Deleted.
979         (WebCore::TextureMapperLayer::opacity const): Deleted.
980         (WebCore::TextureMapperLayer::transform const): Deleted.
981         (WebCore::TextureMapperLayer::hasFilters const): Deleted.
982         (WebCore::TextureMapperLayer::isShowingRepaintCounter const): Deleted.
983         (WebCore::TextureMapperLayer::fixedToViewport const): Deleted.
984         (WebCore::TextureMapperLayer::rootLayer const): Deleted.
985         (WebCore::TextureMapperLayer::texture): Deleted.
986         (WebCore::TextureMapperLayer::adjustedPosition const): Deleted.
987         (WebCore::TextureMapperLayer::layerRect const): Deleted.
988         (WebCore::TextureMapperLayer::State::State): Deleted.
989         * platform/graphics/texmap/TextureMapperPlatformLayerProxy.h:
990         * platform/graphics/texmap/TextureMapperTile.h:
991         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h:
992         (WebCore::CoordinatedGraphicsLayer::isScrollable const): Deleted.
993         (WebCore::CoordinatedGraphicsLayer::id const): Deleted.
994         (WebCore::CoordinatedGraphicsLayer::coverRect const): Deleted.
995         (WebCore::CoordinatedGraphicsLayer::fixedToViewport const): Deleted.
996         * platform/graphics/texmap/coordinated/CoordinatedImageBacking.h:
997         (WebCore::CoordinatedImageBacking::id const): Deleted.
998         * platform/graphics/texmap/coordinated/TiledBackingStore.h:
999         * platform/graphics/texmap/coordinated/UpdateAtlas.h:
1000         * platform/network/AuthenticationChallengeBase.h:
1001         * platform/network/CredentialBase.h:
1002         * platform/network/ProtectionSpaceBase.h:
1003         * platform/network/curl/SocketStreamHandleImpl.h:
1004         * replay/UserInputBridge.h:
1005
1006 2018-01-09  Basuke Suzuki  <Basuke.Suzuki@sony.com>
1007
1008         [Curl] Move FormData related tasks into new CurlFormDataStream class.
1009         https://bugs.webkit.org/show_bug.cgi?id=181106
1010
1011         Reviewed by Alex Christensen.
1012
1013         No new tests because no behavior change.
1014
1015         * platform/Curl.cmake:
1016         * platform/network/curl/CurlFormDataStream.cpp: Added.
1017         (WebCore::CurlFormDataStream::CurlFormDataStream):
1018         (WebCore::CurlFormDataStream::~CurlFormDataStream):
1019         (WebCore::CurlFormDataStream::clean):
1020         (WebCore::CurlFormDataStream::shouldUseChunkTransfer):
1021         (WebCore::CurlFormDataStream::totalSize):
1022         (WebCore::CurlFormDataStream::computeContentLength):
1023         (WebCore::CurlFormDataStream::read):
1024         (WebCore::CurlFormDataStream::readFromFile):
1025         (WebCore::CurlFormDataStream::readFromData):
1026         * platform/network/curl/CurlFormDataStream.h: Renamed from Source/WebCore/platform/network/curl/FormDataStreamCurl.h.
1027         (WebCore::CurlFormDataStream::elementSize):
1028         (WebCore::CurlFormDataStream::totalReadSize):
1029         * platform/network/curl/CurlRequest.cpp:
1030         (WebCore::CurlRequest::CurlRequest):
1031         (WebCore::CurlRequest::willSendData):
1032         (WebCore::CurlRequest::finalizeTransfer):
1033         (WebCore::CurlRequest::setupPUT):
1034         (WebCore::CurlRequest::setupPOST):
1035         (WebCore::CurlRequest::setupSendData):
1036         (WebCore::CurlRequest::resolveBlobReferences): Deleted.
1037         (WebCore::CurlRequest::setupFormData): Deleted.
1038         * platform/network/curl/CurlRequest.h:
1039         * platform/network/curl/FormDataStreamCurl.cpp: Removed.
1040
1041 2018-01-09  Zalan Bujtas  <zalan@apple.com>
1042
1043         [RenderTreeBuilder] Move MathML addChild logic to RenderTreeBuilder
1044         https://bugs.webkit.org/show_bug.cgi?id=181443
1045         <rdar://problem/36380228>
1046
1047         Reviewed by Antti Koivisto.
1048
1049         This is about moving code, no cleanup and/or normalization (unfortunately it also means
1050         some temporary changes).  
1051
1052         No change in functionality.
1053
1054         * Sources.txt:
1055         * WebCore.xcodeproj/project.pbxproj:
1056         * rendering/mathml/RenderMathMLFenced.cpp:
1057         (WebCore::RenderMathMLFenced::addChild):
1058         (WebCore::RenderMathMLFenced::createMathMLOperator): Deleted.
1059         (WebCore::RenderMathMLFenced::makeFences): Deleted.
1060         * rendering/mathml/RenderMathMLFenced.h:
1061         * rendering/updating/RenderTreeBuilder.cpp:
1062         (WebCore::RenderTreeBuilder::RenderTreeBuilder):
1063         (WebCore::RenderTreeBuilder::insertChildToRenderMathMLFenced):
1064         * rendering/updating/RenderTreeBuilder.h:
1065         (WebCore::RenderTreeBuilder::mathMLBuilder):
1066
1067 2018-01-09  Antti Koivisto  <antti@apple.com>
1068
1069         Blank page except for inner iframes because pending stylesheets cause style.isNotFinal() to be true
1070         https://bugs.webkit.org/show_bug.cgi?id=180940
1071         <rdar://problem/36116507>
1072
1073         Reviewed by Darin Adler.
1074
1075         Test: http/tests/local/loading-stylesheet-import-remove.html
1076
1077         If a <link> referencing a stylesheet containing an @import that was still loading was removed
1078         from the document, the loading state was never cleared. For head stylesheets this blocked
1079         rendering permanently.
1080
1081         Test reduction by Justin Ridgewell.
1082
1083         * html/HTMLLinkElement.cpp:
1084         (WebCore::HTMLLinkElement::removedFromAncestor):
1085
1086         Test if the stylesheet it loading before clearing the pointer.
1087
1088 2018-01-09  Dan Bernstein  <mitz@apple.com>
1089
1090         Removed some empty directories that were left behind
1091
1092         * Modules/indieui: Removed.
1093         * Modules/vibration: Removed.
1094         * platform/graphics/ca/mac: Removed.
1095         * platform/mediastream/gstreamer: Removed.
1096
1097 2018-01-09  Antoine Quint  <graouts@apple.com>
1098
1099         Refactor timing function solving code
1100         https://bugs.webkit.org/show_bug.cgi?id=181428
1101
1102         Reviewed by Dean Jackson.
1103
1104         We have duplicated code to solve "cubic" and "steps" timing functions in AnimationBase and TextureMapperAnimation,
1105         and we will soon need similar code to deal with timing functions in Web Animations. We move this code into TimingFunction
1106         with a single transformTime() function that can be called directly on the timing function rather than having callers
1107         figure out what type timing functions are to solve them.
1108
1109         No test as there shouldn't be any behavior change.
1110
1111         * page/animation/AnimationBase.cpp:
1112         (WebCore::AnimationBase::progress const):
1113         (WebCore::solveEpsilon): Deleted.
1114         (WebCore::solveCubicBezierFunction): Deleted.
1115         (WebCore::solveStepsFunction): Deleted.
1116         (WebCore::solveSpringFunction): Deleted.
1117         * platform/animation/TimingFunction.cpp:
1118         (WebCore::TimingFunction::transformTime const):
1119         * platform/animation/TimingFunction.h:
1120         * platform/graphics/texmap/TextureMapperAnimation.cpp:
1121         (WebCore::TextureMapperAnimation::apply):
1122         (WebCore::solveEpsilon): Deleted.
1123         (WebCore::solveCubicBezierFunction): Deleted.
1124         (WebCore::solveStepsFunction): Deleted.
1125         (WebCore::applyTimingFunction): Deleted.
1126
1127 2018-01-09  Michael Catanzaro  <mcatanzaro@igalia.com>
1128
1129         Unreviewed, silence -Wunused-parameter warning
1130
1131         * testing/js/WebCoreTestSupport.cpp:
1132         (WebCoreTestSupport::setupNewlyCreatedServiceWorker):
1133
1134 2018-01-09  Said Abou-Hallawa  <sabouhallawa@apple.com>
1135
1136         Check Image::m_image is not null in ImageLoader::decode()
1137         https://bugs.webkit.org/show_bug.cgi?id=180386
1138         <rdar://problem/34634483>
1139
1140         Reviewed by Tim Horton.
1141
1142         Ensure ImageLoader::m_image is not null before referencing it.
1143
1144         * loader/ImageLoader.cpp:
1145         (WebCore::ImageLoader::decode):
1146
1147 2018-01-09  Yusuke Suzuki  <utatane.tea@gmail.com>
1148
1149         [FreeType] Use FastMalloc for FreeType
1150         https://bugs.webkit.org/show_bug.cgi?id=181387
1151
1152         Reviewed by Michael Catanzaro.
1153
1154         Add custom memory allocator for FreeType to use FastMalloc.
1155
1156         * platform/graphics/freetype/FontCustomPlatformDataFreeType.cpp:
1157         (WebCore::initializeFreeTypeLibrary):
1158         (WebCore::createFontCustomPlatformData):
1159
1160 2018-01-09  Zalan Bujtas  <zalan@apple.com>
1161
1162         [RenderTreeBuilder] Move RenderTable* addChild mutation logic to RenderTreeBuilder
1163         https://bugs.webkit.org/show_bug.cgi?id=181424
1164         <rdar://problem/36368628>
1165
1166         Reviewed by Antti Koivisto.
1167
1168         This is about moving code, no cleanup and/or normalization (unfortunately it also means
1169         some temporary changes).  
1170
1171         Covered by existing tests.
1172
1173         * rendering/RenderTable.cpp:
1174         (WebCore::RenderTable::addChild):
1175         * rendering/RenderTableRow.cpp:
1176         (WebCore::RenderTableRow::addChild):
1177         * rendering/RenderTableSection.cpp:
1178         (WebCore::RenderTableSection::addChild):
1179         * rendering/updating/RenderTreeBuilder.cpp:
1180         (WebCore::RenderTreeBuilder::insertChildToRenderTable):
1181         (WebCore::RenderTreeBuilder::insertChildToRenderTableSection):
1182         (WebCore::RenderTreeBuilder::insertChildToRenderTableRow):
1183         * rendering/updating/RenderTreeBuilder.h:
1184         * rendering/updating/RenderTreeBuilderTable.cpp:
1185         (WebCore::RenderTreeBuilder::Table::insertChild):
1186         * rendering/updating/RenderTreeBuilderTable.h:
1187
1188 2018-01-09  Zalan Bujtas  <zalan@apple.com>
1189
1190         [RenderTreeBuilder] Transition Render*::addChild() calls to RenderTreeBuilder::insertChildToRender*()
1191         https://bugs.webkit.org/show_bug.cgi?id=181407
1192         <rdar://problem/36361176>
1193
1194         Reviewed by Antti Koivisto.
1195
1196         Eventually all mutation will be going through the RenderTreeBuilder.
1197
1198         No change in functionality.
1199
1200         * rendering/RenderGrid.cpp:
1201         (WebCore::RenderGrid::addChild):
1202         * rendering/RenderMultiColumnFlow.cpp:
1203         (WebCore::RenderMultiColumnFlow::processPossibleSpannerDescendant):
1204         * rendering/RenderRubyRun.cpp:
1205         (WebCore::RenderRubyRun::rubyBaseSafe):
1206         * rendering/updating/RenderTreeBuilderBlockFlow.cpp:
1207         (WebCore::RenderTreeBuilder::BlockFlow::insertChild):
1208         * rendering/updating/RenderTreeBuilderMultiColumn.cpp:
1209         (WebCore::RenderTreeBuilder::MultiColumn::createFragmentedFlow):
1210         * rendering/updating/RenderTreeBuilderRuby.cpp:
1211         (WebCore::RenderTreeBuilder::Ruby::findOrCreateParentForChild):
1212
1213 2018-01-09  Philippe Normand  <pnormand@igalia.com>
1214
1215         [GStreamer] Ensure SleepDisabler is not held by pages in page cache
1216         https://bugs.webkit.org/show_bug.cgi?id=180197
1217
1218         Reviewed by Eric Carlson.
1219
1220         The sleep disabler is now checked again whenever the media player
1221         playback state or other characteristic has changed in the media
1222         engine.
1223
1224         * html/HTMLMediaElement.cpp:
1225         (WebCore::HTMLMediaElement::mediaPlayerPlaybackStateChanged):
1226         Check if the sleep disabler state needs to be updated or not.
1227         (WebCore::HTMLMediaElement::mediaPlayerCharacteristicChanged): Ditto.
1228         (WebCore::HTMLMediaElement::shouldDisableSleep const): Enable
1229         sleep disabler for GTK and WPE ports.
1230
1231 2018-01-09  Philippe Normand  <pnormand@igalia.com>
1232
1233         [GStreamer] Missing notifications to player client
1234         https://bugs.webkit.org/show_bug.cgi?id=181432
1235
1236         Reviewed by Carlos Garcia Campos.
1237
1238         We now properly emit playback state changes and characteristic
1239         updates to the client when the pipeline state changes and when
1240         audio/video tracks changes are detected.
1241
1242         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
1243         (WebCore::MediaPlayerPrivateGStreamer::playbackPosition const):
1244         This debug message appears too often in logs. Demote.
1245         (WebCore::MediaPlayerPrivateGStreamer::durationMediaTime const): Ditto.
1246         (WebCore::MediaPlayerPrivateGStreamer::notifyPlayerOfVideo): Emit
1247         charasteristicChanged notification.
1248         (WebCore::MediaPlayerPrivateGStreamer::notifyPlayerOfAudio): Ditto.
1249         (WebCore::MediaPlayerPrivateGStreamer::updateStates): Keep track
1250         of old and current pipeline state.
1251         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
1252
1253
1254 2018-01-09  Youenn Fablet  <youenn@apple.com>
1255
1256         Add CSP support to service workers
1257         https://bugs.webkit.org/show_bug.cgi?id=181385
1258
1259         Reviewed by Chris Dumez.
1260
1261         Covered by rebased tests.
1262
1263         Added recovery of CSP information from WorkerScriptLoader.
1264         Added plumbing to pass the CSP information to Service Workers.
1265         Did not add persistency support for the CSP information as this requires changing the SQL database schema.
1266         This will be done in a follow-up.
1267
1268         * workers/WorkerScriptLoader.cpp:
1269         (WebCore::WorkerScriptLoader::loadAsynchronously):
1270         (WebCore::WorkerScriptLoader::didReceiveResponse):
1271         * workers/WorkerScriptLoader.h:
1272         (WebCore::WorkerScriptLoader::contentSecurityPolicy const):
1273         * workers/service/SWClientConnection.cpp:
1274         (WebCore::SWClientConnection::finishedFetchingScript):
1275         (WebCore::SWClientConnection::failedFetchingScript):
1276         * workers/service/SWClientConnection.h:
1277         * workers/service/ServiceWorkerContainer.cpp:
1278         (WebCore::ServiceWorkerContainer::addRegistration):
1279         (WebCore::ServiceWorkerContainer::jobFailedWithException):
1280         (WebCore::ServiceWorkerContainer::jobResolvedWithRegistration):
1281         (WebCore::ServiceWorkerContainer::jobFinishedLoadingScript):
1282         * workers/service/ServiceWorkerContainer.h:
1283         * workers/service/ServiceWorkerContextData.cpp:
1284         (WebCore::ServiceWorkerContextData::isolatedCopy const):
1285         * workers/service/ServiceWorkerContextData.h:
1286         (WebCore::ServiceWorkerContextData::encode const):
1287         (WebCore::ServiceWorkerContextData::decode):
1288         * workers/service/ServiceWorkerFetchResult.h:
1289         (WebCore::ServiceWorkerFetchResult::encode const):
1290         (WebCore::ServiceWorkerFetchResult::decode):
1291         * workers/service/ServiceWorkerGlobalScope.cpp:
1292         (WebCore::ServiceWorkerGlobalScope::create):
1293         * workers/service/ServiceWorkerGlobalScope.h:
1294         * workers/service/ServiceWorkerJob.cpp:
1295         (WebCore::ServiceWorkerJob::notifyFinished):
1296         * workers/service/ServiceWorkerJobClient.h:
1297         * workers/service/context/ServiceWorkerThread.cpp:
1298         (WebCore::ServiceWorkerThread::ServiceWorkerThread):
1299         (WebCore::ServiceWorkerThread::createWorkerGlobalScope):
1300         * workers/service/server/RegistrationDatabase.cpp:
1301         (WebCore::v1RecordsTableSchema):
1302         (WebCore::RegistrationDatabase::importRecords):
1303         * workers/service/server/SWServer.cpp:
1304         (WebCore::SWServer::updateWorker):
1305         (WebCore::SWServer::installContextData):
1306         * workers/service/server/SWServer.h:
1307         * workers/service/server/SWServerJobQueue.cpp:
1308         (WebCore::SWServerJobQueue::scriptFetchFinished):
1309         * workers/service/server/SWServerWorker.cpp:
1310         (WebCore::SWServerWorker::SWServerWorker):
1311         (WebCore::m_contentSecurityPolicy):
1312         (WebCore::SWServerWorker::contextData const):
1313         * workers/service/server/SWServerWorker.h:
1314
1315 2018-01-09  Antoine Quint  <graouts@apple.com>
1316
1317         Provide a method to obtain a CSS value from a RenderStyle by CSSPropertyID
1318         https://bugs.webkit.org/show_bug.cgi?id=181429
1319
1320         Reviewed by Antti Koivisto.
1321
1322         The KeyframeEffect.getKeyframes() method from Web Animations requires that we return all styles applied at a given
1323         animation effect keyframe. When we parse keyframes, we create RenderStyle objects that are stored in a KeyframeList,
1324         as well as a list of CSSPropertyIDs that are animated. In order to provide the list of animated properties and their
1325         values when calling getKeyframes(), we need to be able to read back from the RenderStyle we create. As a first step
1326         towards this goal, we factor some code in ComputedStyleExtractor::propertyValue() out into a new method
1327         ComputedStyleExtractor::valueForPropertyinStyle() which takes in an explicit RenderStyle.
1328
1329         No test as this is simply refactoring that doesn't change or add behavior.
1330
1331         * css/CSSComputedStyleDeclaration.cpp:
1332         (WebCore::ComputedStyleExtractor::propertyValue):
1333         (WebCore::ComputedStyleExtractor::valueForPropertyinStyle):
1334         * css/CSSComputedStyleDeclaration.h:
1335
1336 2018-01-09  Youenn Fablet  <youenn@apple.com>
1337
1338         SWClientConnection should not keep references to service worker jobs
1339         https://bugs.webkit.org/show_bug.cgi?id=181381
1340
1341         Reviewed by Chris Dumez.
1342
1343         Difficult to test determiniscally but corresponding crash log should no longer happen in debug builds.
1344
1345         Stopped passing ServiceWorkerJob references from ServiceWorkerContainer (potentially in service worker thread) to SWClientConnection (main thread).
1346         Instead pass job identifiers and related data to the main thread.
1347
1348         Minor refactoring to use ServiceWorkerJobIdentifier instead of ServiceWorkerJobDataIdentifier which contains more data than needed.
1349
1350         * workers/service/SWClientConnection.cpp:
1351         (WebCore::SWClientConnection::scheduleJob):
1352         (WebCore::SWClientConnection::failedFetchingScript):
1353         (WebCore::SWClientConnection::postTaskForJob):
1354         (WebCore::SWClientConnection::jobRejectedInServer):
1355         (WebCore::SWClientConnection::registrationJobResolvedInServer):
1356         (WebCore::SWClientConnection::unregistrationJobResolvedInServer):
1357         (WebCore::SWClientConnection::startScriptFetchForServer):
1358         (WebCore::SWClientConnection::clearPendingJobs):
1359         (WebCore::SWClientConnection::finishedFetchingScript): Deleted.
1360         * workers/service/SWClientConnection.h:
1361         * workers/service/ServiceWorkerContainer.cpp:
1362         (WebCore::ServiceWorkerContainer::scheduleJob):
1363         (WebCore::ServiceWorkerContainer::startScriptFetchForJob):
1364         (WebCore::ServiceWorkerContainer::jobFinishedLoadingScript):
1365         (WebCore::ServiceWorkerContainer::jobFailedLoadingScript):
1366         * workers/service/ServiceWorkerContainer.h:
1367         * workers/service/server/SWServer.cpp:
1368         (WebCore::SWServer::rejectJob):
1369         (WebCore::SWServer::resolveRegistrationJob):
1370         (WebCore::SWServer::resolveUnregistrationJob):
1371         (WebCore::SWServer::startScriptFetch):
1372         * workers/service/server/SWServer.h:
1373
1374 2018-01-09  Carlos Garcia Campos  <cgarcia@igalia.com>
1375
1376         REGRESSION(r224460): Text fields sometimes get "messed up"
1377         https://bugs.webkit.org/show_bug.cgi?id=181115
1378
1379         Reviewed by Zalan Bujtas.
1380
1381         Add the scroll position to paint offset before computing the clip rectangle. Before r224460, scroll position was
1382         substracted after the clip rectangle was computed.
1383
1384         * rendering/LayoutState.cpp:
1385         (WebCore::LayoutState::computeClipRect):
1386
1387 2018-01-09  Ali Juma  <ajuma@chromium.org>
1388
1389         Implement VisualViewport API events
1390         https://bugs.webkit.org/show_bug.cgi?id=179386
1391
1392         Reviewed by Frédéric Wang.
1393
1394         Implement the events (resize and scroll) defined by the Visual Viewport API
1395         (https://wicg.github.io/visual-viewport/#events).
1396
1397         This is behind the VisualViewportAPI experimental feature flag.
1398
1399         In order to detect when events need to be fired, change the computation of
1400         Visual Viewport attributes to happen whenever the layout viewport is updated
1401         rather than only on-demand.
1402
1403         Tests: fast/visual-viewport/resize-event-fired-window-resized.html
1404                fast/visual-viewport/resize-event-fired.html
1405                fast/visual-viewport/scroll-event-fired.html
1406
1407         * dom/Document.cpp:
1408         (WebCore::Document::addListenerTypeIfNeeded):
1409         Add support for tracking resize event listeners.
1410         * dom/Document.h:
1411         * dom/DocumentEventQueue.cpp:
1412         (WebCore::DocumentEventQueue::enqueueOrDispatchScrollEvent):
1413         (WebCore::DocumentEventQueue::enqueueScrollEvent):
1414         Factored out of enqueueOrDispatchScrollEvent so that this logic can be reused
1415         for Visual Viewport scroll events.
1416         (WebCore::DocumentEventQueue::enqueueResizeEvent):
1417         (WebCore::DocumentEventQueue::pendingEventTimerFired):
1418         * dom/DocumentEventQueue.h:
1419         * page/FrameView.cpp:
1420         (WebCore::FrameView::updateLayoutViewport):
1421         * page/VisualViewport.cpp:
1422         (WebCore::VisualViewport::addEventListener):
1423         (WebCore::layoutIfNonNull):
1424         (WebCore::VisualViewport::offsetLeft const):
1425         Remove attribute computation logic since this now happens during update().
1426         (WebCore::VisualViewport::offsetTop const): Ditto.
1427         (WebCore::VisualViewport::pageLeft const): Ditto.
1428         (WebCore::VisualViewport::pageTop const): Ditto.
1429         (WebCore::VisualViewport::width const): Ditto.
1430         (WebCore::VisualViewport::height const): Ditto.
1431         (WebCore::VisualViewport::scale const):
1432         (WebCore::VisualViewport::update):
1433         Added. Computes all of the Visual Viewport attributes and determines
1434         whether events need to be fired.
1435         (WebCore::VisualViewport::enqueueResizeEvent):
1436         (WebCore::VisualViewport::enqueueScrollEvent):
1437         (WebCore::getFrameViewAndLayoutIfNonNull): Deleted.
1438         * page/VisualViewport.h:
1439
1440 2018-01-09  Yacine Bandou  <yacine.bandou_ext@softathome.com>
1441
1442         [EME] Add the CENC initData support in ClearKey CDM
1443         https://bugs.webkit.org/show_bug.cgi?id=180081
1444
1445         Reviewed by Xabier Rodriguez-Calvar.
1446
1447         Add the "cenc" initDataType support in ClearKey CDM.
1448         Parse the CENC initData and extract the KIDs by following the W3C spec
1449         https://www.w3.org/TR/eme-initdata-cenc/#common-system
1450
1451         Tests: media/encrypted-media/clearKey/clearKey-message-cenc-event.html
1452                media/encrypted-media/clearKey/clearKey-message-cenc-event-mse.html
1453
1454         * platform/encryptedmedia/clearkey/CDMClearKey.cpp:
1455         (WebCore::extractKeyidsLocationFromCencInitData):
1456         (WebCore::isCencInitData):
1457         (WebCore::extractKeyidsFromCencInitData):
1458         (WebCore::CDMPrivateClearKey::supportsInitDataType const):
1459         (WebCore::CDMPrivateClearKey::supportsInitData const):
1460         (WebCore::CDMInstanceClearKey::requestLicense):
1461
1462 2018-01-09  Zan Dobersek  <zdobersek@igalia.com>
1463
1464         [Cairo] Pass state values directly to Cairo operations
1465         https://bugs.webkit.org/show_bug.cgi?id=181389
1466
1467         Reviewed by Carlos Garcia Campos.
1468
1469         Instead of passing reference to the GraphicsContextState object to
1470         various Cairo operations, only pass the required state values. This
1471         makes it explicit what state values are used in these operations, at the
1472         expense of some long parameter lists, but this will be better addressed
1473         by future refactoring of this code into more concise functions.
1474
1475         No new tests -- no change in functionality.
1476
1477         * platform/graphics/cairo/CairoOperations.cpp:
1478         (WebCore::Cairo::drawGlyphsShadow):
1479         (WebCore::Cairo::dashedLineCornerWidthForStrokeWidth):
1480         (WebCore::Cairo::dashedLinePatternWidthForStrokeWidth):
1481         (WebCore::Cairo::drawGlyphs):
1482         (WebCore::Cairo::drawRect):
1483         (WebCore::Cairo::drawLine):
1484         (WebCore::Cairo::drawEllipse):
1485         * platform/graphics/cairo/CairoOperations.h:
1486         * platform/graphics/cairo/FontCairo.cpp:
1487         (WebCore::FontCascade::drawGlyphs):
1488         * platform/graphics/cairo/GraphicsContextCairo.cpp:
1489         (WebCore::GraphicsContext::drawRect):
1490         (WebCore::GraphicsContext::drawLine):
1491         (WebCore::GraphicsContext::drawEllipse):
1492
1493 2018-01-09  Ryosuke Niwa  <rniwa@webkit.org>
1494
1495         Release assert in addResourceTiming when a cache resource is requested during style recalc
1496         https://bugs.webkit.org/show_bug.cgi?id=181137
1497         <rdar://problem/35666574>
1498
1499         Reviewed by Simon Fraser.
1500
1501         Make the dispatching of resourcetimingbufferfull event asynchronous to avoid dispatching it
1502         synchronously during a style resolution when CachedResourceLoader::requestImage requests
1503         a previously loaded image.
1504
1505         We now schedule a timer when the resource timing buffer becomes full, and dispatch the event
1506         when the timer fires. Meanwhile, we have a backup buffer to which additional resource timing
1507         entries would be added. Once the event is dispatched, we refill the buffer exposed to author
1508         scripts. When refilling the buffer results in it becoming full again, we keep repeating the
1509         process of firing resourcetimingbufferfull and re-filling the buffer until either we stop
1510         making progress (i.e. the script didn't increase the number of empty entires in the buffer)
1511         or the backup buffer (at the time we started this process) becomes empty.
1512
1513         Also fixed a bug that we were firing resourcetimingbufferfull event when the last entry that
1514         fits within the buffer size was added instead of when an entry is being added to an already
1515         full buffer. To make this work, the patch introduces m_resourceTimingBufferFullFlag,
1516         representing the concept "resource timing buffer full" flag in the resource timing specification.
1517
1518         Test: http/tests/performance/performance-resource-timing-resourcetimingbufferfull-crash.html
1519
1520         * page/Performance.cpp:
1521         (WebCore::Performance::Performance):
1522         (WebCore::Performance::clearResourceTimings):
1523         (WebCore::Performance::setResourceTimingBufferSize):
1524         (WebCore::Performance::addResourceTiming):
1525         (WebCore::Performance::resourceTimingBufferFullTimerFired):
1526         * page/Performance.h:
1527
1528 2018-01-08  Chris Nardi  <csnardi1@gmail.com>
1529
1530         ::first-letter incorrectly selects grapheme pairs
1531         https://bugs.webkit.org/show_bug.cgi?id=181315
1532
1533         Reviewed by Darin Adler.
1534
1535         Grapheme pairs were incorrectly selected by ::first-letter. This
1536         change fixes their selection.
1537
1538         Tests: Updated fast/css/first-letter-punctuation.html and imported
1539         LayoutTests/imported/w3c/web-platform-tests/css/css-pseudo-4/first-letter-004.html
1540
1541         * rendering/updating/RenderTreeBuilderFirstLetter.cpp:
1542         (WebCore::isPunctuationForFirstLetter):
1543         (WebCore::shouldSkipForFirstLetter):
1544         (WebCore::RenderTreeBuilder::FirstLetter::createRenderers):
1545
1546 2018-01-08  Darin Adler  <darin@apple.com>
1547
1548         Special list-item counter starts from an incorrect number for ::before and ::after
1549         https://bugs.webkit.org/show_bug.cgi?id=181084
1550
1551         Reviewed by Zalan Bujtas.
1552
1553         Test: fast/css/counters/counter-list-item.html
1554
1555         * Sources.txt: Removed CounterDirectives.cpp.
1556         * WebCore.xcodeproj/project.pbxproj: Ditto.
1557
1558         * css/CSSComputedStyleDeclaration.cpp:
1559         (WebCore::counterToCSSValue): Updated for changes to the CounterDirectives struct.
1560         * css/StyleBuilderCustom.h:
1561         (WebCore::StyleBuilderCustom::applyInheritCounter): Ditto.
1562         (WebCore::StyleBuilderCustom::applyValueCounter): Ditto.
1563
1564         * html/HTMLLIElement.cpp:
1565         (WebCore::HTMLLIElement::parseValue): Call setExplicitValue(std::nullopt) instead
1566         of clearExplicitValue since we are using std::optional now.
1567
1568         * rendering/RenderCounter.cpp:
1569         (WebCore::listItemCounterDirectives): Added. Computes the counter directives that
1570         express the effects on the list-item counter from list item and list elements.
1571         Used something as close to what the CSS 3 draft says as possible. This uses a
1572         negative increment when creating a list to counteract the positive increment done
1573         by a list element, except in the case of an unordered list. This is where the bug
1574         fix actually lies. Also fixed handling of reversed ordered lists at the same time.
1575         (WebCore::planCounter): Refactored to use the function above. Also changed the
1576         code to pay attention to both the counter directives and the implicit ones from
1577         list item and list elements, getting as close as possible to what the specification
1578         seems to call for.
1579
1580         * rendering/RenderListItem.cpp:
1581         (WebCore::RenderListItem::RenderListItem): Since we are using std::optional and no
1582         longer using bit fields, simplified the constructor for each list item.
1583         (WebCore::RenderListItem::calcValue const): Deleted.
1584         (WebCore::RenderListItem::updateValueNow const): Merged in all the code from the
1585         old calcValue function, but it is also simpler now since m_value is std::optional.
1586         (WebCore::RenderListItem::updateValue): Updated to use std::optional.
1587         (WebCore::RenderListItem::setExplicitValue): Ditto.
1588         (WebCore::RenderListItem::clearExplicitValue): Deleted.
1589         (WebCore::RenderListItem::updateListMarkerNumbers): Updated to use std::optional.
1590         (WebCore::RenderListItem::isInReversedOrderedList const): Added. This is used by
1591         the counter code so it can decrement instead of incrementing.
1592
1593         * rendering/RenderListItem.h: Updated to use std::optional. Also marked functions
1594         final instead of override and initialized m_notInList after making it not be a
1595         bitfield any more.
1596
1597         * rendering/style/CounterDirectives.cpp: Removed.
1598         * rendering/style/CounterDirectives.h: Removed most of the CounterDirectives
1599         class and replaced it with a struct with two std::optional. Added an addClamped
1600         function so the counter code can share it with the addIncrementValue function.
1601         If we want to make a faster version that doesn't use double, we can come back
1602         and do that. Also moved the == function to the header since the implementation
1603         is so trivial.
1604
1605         * rendering/style/StyleAllInOne.cpp: Removed CounterDirectives.cpp.
1606
1607         * rendering/style/StyleRareNonInheritedData.cpp:
1608         (WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData): Updated to
1609         use std::make_unique directly instead of using a clone function.
1610
1611 2018-01-08  Wenson Hsieh  <wenson_hsieh@apple.com>
1612
1613         [Attachment Support] Expose HTMLAttachmentElement.uniqueIdentifier to bindings
1614         https://bugs.webkit.org/show_bug.cgi?id=181420
1615         <rdar://problem/36365827>
1616
1617         Reviewed by Alex Christensen.
1618
1619         Add a new IDL definition for uniqueIdentifier on HTMLAttachmentElement. This allows clients to relate attachment
1620         elements in the DOM to _WKAttachments delivered via Objective-C SPI.
1621
1622         Adjusted existing tests in WKAttachmentTests.
1623
1624         * html/HTMLAttachmentElement.idl:
1625
1626 2018-01-08  Don Olmstead  <don.olmstead@sony.com>
1627
1628         AccessibilityARIAGrid does not compile when accessibility is disabled
1629         https://bugs.webkit.org/show_bug.cgi?id=181418
1630         <rdar://problem/36365398>
1631
1632         Reviewed by Chris Fleizach.
1633
1634         No new tests. No change in behavior.
1635
1636         * accessibility/AccessibilityARIAGrid.cpp:
1637
1638 2018-01-08  Commit Queue  <commit-queue@webkit.org>
1639
1640         Unreviewed, rolling out r226532 and r226540.
1641         https://bugs.webkit.org/show_bug.cgi?id=181422
1642
1643         jessie says basic browsing does not seem to work (Requested by
1644         alexchristensen on #webkit).
1645
1646         Reverted changesets:
1647
1648         "Add CSP support to service workers"
1649         https://bugs.webkit.org/show_bug.cgi?id=181385
1650         https://trac.webkit.org/changeset/226532
1651
1652         "SWClientConnection should not keep references to service
1653         worker jobs"
1654         https://bugs.webkit.org/show_bug.cgi?id=181381
1655         https://trac.webkit.org/changeset/226540
1656
1657 2018-01-08  Wenson Hsieh  <wenson_hsieh@apple.com>
1658
1659         [Attachment Support] Expose file name and content type of WKAttachment
1660         https://bugs.webkit.org/show_bug.cgi?id=181390
1661         <rdar://problem/36336837>
1662
1663         Reviewed by Tim Horton.
1664
1665         Add new structs in AttachmentTypes.h and refactor HTMLAttachmentElement::requestData to requestInfo. See below
1666         for more details. Augmented existing API tests in WKAttachmentTests.
1667
1668         * html/AttachmentTypes.h:
1669
1670         Add a struct to represent a snapshot of information about an attachment element.
1671
1672         * html/HTMLAttachmentElement.cpp:
1673         (WebCore::HTMLAttachmentElement::requestInfo):
1674         (WebCore::HTMLAttachmentElement::requestData): Deleted.
1675         * html/HTMLAttachmentElement.h:
1676
1677         Change requestData to requestInfo. Instead of fetching and delivering data via callback, requestInfo returns an
1678         AttachmentInfo.
1679
1680         * rendering/RenderThemeIOS.mm:
1681         (WebCore::RenderAttachmentInfo::addLine):
1682         (WebCore::RenderAttachmentInfo::buildWrappedLines):
1683         (WebCore::RenderAttachmentInfo::buildSingleLine):
1684         (WebCore::RenderAttachmentInfo::RenderAttachmentInfo):
1685         (WebCore::RenderThemeIOS::attachmentBaseline const):
1686         (WebCore::paintAttachmentIcon):
1687         (WebCore::paintAttachmentText):
1688         (WebCore::paintAttachmentProgress):
1689         (WebCore::attachmentBorderPath):
1690         (WebCore::RenderThemeIOS::paintAttachment):
1691         (WebCore::AttachmentInfo::addLine): Deleted.
1692         (WebCore::AttachmentInfo::buildWrappedLines): Deleted.
1693         (WebCore::AttachmentInfo::buildSingleLine): Deleted.
1694         (WebCore::AttachmentInfo::AttachmentInfo): Deleted.
1695
1696         Rename AttachmentInfo to RenderAttachmentInfo to resolve a name conflict with the new AttachmentInfo struct.
1697
1698 2018-01-08  Saam Barati  <sbarati@apple.com>
1699
1700         Speculative build fix after r226600. We only use clflush on x86 and the `asm volatile` syntax is not available in the Windows build.
1701
1702         No new tests because this is a build fix.
1703
1704         * dom/Comment.cpp:
1705         (WebCore::Comment::clflushReadLength):
1706
1707 2018-01-08  Michael Saboff  <msaboff@apple.com>
1708
1709         Add a DOM gadget for Spectre testing
1710         https://bugs.webkit.org/show_bug.cgi?id=181351
1711
1712         Reviewed by Saam Barati.
1713
1714         This change is used to test Spectre mitigations.
1715
1716         Added a side data array to the Comment DOM node to test for Spectre issues in
1717         the DOM layer.  This additional functionality is disabled by default and must
1718         be enabled through the JSC option "enableSpectreGadgets".
1719
1720         * dom/Comment.cpp:
1721         (WebCore::Comment::Comment):
1722         (WebCore::Comment::setReadLength):
1723         (WebCore::Comment::charCodeAt):
1724         (WebCore::Comment::clflushReadLength):
1725         * dom/Comment.h:
1726         * dom/Comment.idl:
1727         * page/RuntimeEnabledFeatures.cpp:
1728         (WebCore::RuntimeEnabledFeatures::spectreGadgetsEnabled const):
1729         * page/RuntimeEnabledFeatures.h:
1730
1731 2018-01-08  Said Abou-Hallawa  <sabouhallawa@apple.com>
1732
1733         A canvas should not be tainted if it draws a data URL SVGImage with a <foreignObject>
1734         https://bugs.webkit.org/show_bug.cgi?id=180301
1735
1736         Reviewed by Dean Jackson.
1737
1738         Don't taint the canvas if it draws a data URL SVGImage with a <foreignObject>.
1739         There should not be a cross-origin data leak in this case.
1740
1741         Tests: svg/as-image/svg-canvas-data-url-svg-with-feimage-not-tainted.html
1742                svg/as-image/svg-canvas-data-url-svg-with-foreign-object-not-tainted.html
1743                svg/as-image/svg-canvas-data-url-svg-with-image-not-tainted.html
1744
1745         * html/ImageBitmap.cpp:
1746         (WebCore::taintsOrigin):
1747         * html/canvas/CanvasRenderingContext.cpp:
1748         (WebCore::CanvasRenderingContext::wouldTaintOrigin):
1749
1750 2018-01-08  Don Olmstead  <don.olmstead@sony.com>
1751
1752         Simplify platform checks in Graphics Context
1753         https://bugs.webkit.org/show_bug.cgi?id=181344
1754
1755         Reviewed by Alex Christensen.
1756
1757         No new tests. No change in behavior.
1758
1759         * platform/graphics/ANGLEWebKitBridge.h:
1760         * platform/graphics/GLContext.h:
1761         * platform/graphics/GraphicsContext3D.h:
1762         * platform/graphics/OpenGLESShims.h:
1763         * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
1764         (WebCore::GraphicsContext3D::checkVaryingsPacking const):
1765
1766 2018-01-08  Zalan Bujtas  <zalan@apple.com>
1767
1768         [RenderTreeBuilder] Move SVG addChild logic to RenderTreeBuilder
1769         https://bugs.webkit.org/show_bug.cgi?id=181405
1770         <rdar://problem/36360476>
1771
1772         Reviewed by Antti Koivisto.
1773
1774         This is about moving the code, no cleanup and/or normalization (unfortunately it also means
1775         some temporary changes).  
1776
1777         No change in functionality.
1778
1779         * Sources.txt:
1780         * WebCore.xcodeproj/project.pbxproj:
1781         * rendering/svg/RenderSVGContainer.cpp:
1782         (WebCore::RenderSVGContainer::addChild):
1783         * rendering/svg/RenderSVGInline.cpp:
1784         (WebCore::RenderSVGInline::addChild):
1785         * rendering/svg/RenderSVGRoot.cpp:
1786         (WebCore::RenderSVGRoot::addChild):
1787         * rendering/svg/RenderSVGText.cpp:
1788         (WebCore::RenderSVGText::addChild):
1789         * rendering/updating/RenderTreeBuilder.cpp:
1790         (WebCore::RenderTreeBuilder::RenderTreeBuilder):
1791         (WebCore::RenderTreeBuilder::insertChildToSVGContainer):
1792         (WebCore::RenderTreeBuilder::insertChildToSVGInline):
1793         (WebCore::RenderTreeBuilder::insertChildToSVGRoot):
1794         (WebCore::RenderTreeBuilder::insertChildToSVGText):
1795         * rendering/updating/RenderTreeBuilder.h:
1796         (WebCore::RenderTreeBuilder::SVGBuilder):
1797         * rendering/updating/RenderTreeBuilderSVG.cpp: Added.
1798         (WebCore::RenderTreeBuilder::SVG::SVG):
1799         (WebCore::RenderTreeBuilder::SVG::insertChild):
1800         * rendering/updating/RenderTreeBuilderSVG.h: Added.
1801
1802 2018-01-08  John Wilander  <wilander@apple.com>
1803
1804         Storage Access API: Remove access for all frames under a page when the page is closed
1805         https://bugs.webkit.org/show_bug.cgi?id=181398
1806         <rdar://problem/36357879>
1807
1808         Reviewed by Alex Christensen.
1809
1810         No new tests. Discussed with Alex Christensen and we concluded that
1811         both a layout test and an API test would require a lot of work and
1812         we have existing tests for clearing out storage access for frames.
1813
1814         * platform/network/NetworkStorageSession.h:
1815         * platform/network/cf/NetworkStorageSessionCFNet.cpp:
1816         (WebCore::NetworkStorageSession::removeStorageAccessForAllFramesOnPage):
1817
1818 2018-01-08  Matt Lewis  <jlewis3@apple.com>
1819
1820         Unreviewed, rolling out r226385.
1821
1822         The test introduced with this was a flaky since being added.
1823
1824         Reverted changeset:
1825
1826         "AX: when invert colors is on, double-invert certain media
1827         elements in UserAgentStyleSheet"
1828         https://bugs.webkit.org/show_bug.cgi?id=168447
1829         https://trac.webkit.org/changeset/226385
1830
1831 2018-01-08  Youenn Fablet  <youenn@apple.com>
1832
1833         SWClientConnection should not keep references to service worker jobs
1834         https://bugs.webkit.org/show_bug.cgi?id=181381
1835
1836         Reviewed by Chris Dumez.
1837
1838         Difficult to test determiniscally but corresponding crash log should no longer happen in debug builds.
1839
1840         Stopped passing ServiceWorkerJob references from ServiceWorkerContainer (potentially in service worker thread) to SWClientConnection (main thread).
1841         Instead pass job identifiers and related data to the main thread.
1842
1843         Minor refactoring to use ServiceWorkerJobIdentifier instead of ServiceWorkerJobDataIdentifier which contains more data than needed.
1844
1845         * workers/service/SWClientConnection.cpp:
1846         (WebCore::SWClientConnection::scheduleJob):
1847         (WebCore::SWClientConnection::failedFetchingScript):
1848         (WebCore::SWClientConnection::postTaskForJob):
1849         (WebCore::SWClientConnection::jobRejectedInServer):
1850         (WebCore::SWClientConnection::registrationJobResolvedInServer):
1851         (WebCore::SWClientConnection::unregistrationJobResolvedInServer):
1852         (WebCore::SWClientConnection::startScriptFetchForServer):
1853         (WebCore::SWClientConnection::clearPendingJobs):
1854         (WebCore::SWClientConnection::finishedFetchingScript): Deleted.
1855         * workers/service/SWClientConnection.h:
1856         * workers/service/ServiceWorkerContainer.cpp:
1857         (WebCore::ServiceWorkerContainer::scheduleJob):
1858         (WebCore::ServiceWorkerContainer::startScriptFetchForJob):
1859         (WebCore::ServiceWorkerContainer::jobFinishedLoadingScript):
1860         (WebCore::ServiceWorkerContainer::jobFailedLoadingScript):
1861         * workers/service/ServiceWorkerContainer.h:
1862         * workers/service/server/SWServer.cpp:
1863         (WebCore::SWServer::rejectJob):
1864         (WebCore::SWServer::resolveRegistrationJob):
1865         (WebCore::SWServer::resolveUnregistrationJob):
1866         (WebCore::SWServer::startScriptFetch):
1867         * workers/service/server/SWServer.h:
1868
1869 2018-01-08  Wenson Hsieh  <wenson_hsieh@apple.com>
1870
1871         Copying, pasting, and then deleting an attachment element breaks attachment data requests
1872         https://bugs.webkit.org/show_bug.cgi?id=181365
1873         <rdar://problem/36340647>
1874
1875         Reviewed by Tim Horton.
1876
1877         Currently, copying and pasting an attachment element within the same document and then deleting backwards to
1878         remove the pasted attachment element causes the original attachment element to be inaccessible via SPI. This is
1879         because there are now two different attachment elements with the same unique identifier, such that Document,
1880         which keeps a map of all unique attachment identifiers to attachment elements, will lose track of the original
1881         attachment element.
1882
1883         To fix this, we ensure that attachment elements should always have unique identifiers when they are inserted
1884         into the document. We make several small adjustments to accomplish this:
1885
1886         1.  First, refactor HTMLAttachmentElement's unique identifier so that it no longer depends on the value of the
1887             "webkitattachmentid" attribute, and is instead just a member of HTMLAttachmentElement that is not exposed to
1888             DOM bindings. This means setting and querying an attachment element's uniqueIdentifier can be done without
1889             triggering any side effects, such as layout or mutation events.
1890
1891         2.  Next, make "webkitattachmentid" a temporary attribute similar to "webkitattachmentpath" and
1892             "webkitattachmentbloburl", so that it is added only when generating a markup fragment for editing, and
1893             removed upon deserialization.
1894
1895         3.  Lastly, shift the responsibility of assigning a unique identifier to an attachment away from places where we
1896             create attachment elements, and instead have Document enforce this when an attachment element is inserted.
1897
1898         Tests:  WKAttachmentTests.InsertAndRemoveDuplicateAttachment
1899                 WKAttachmentTests.InsertDuplicateAttachmentAndUpdateData
1900
1901         * dom/Document.cpp:
1902         (WebCore::Document::didInsertAttachmentElement):
1903
1904         Assign the unique identifier of an attachment element that has been inserted. If the identifier already tracks
1905         an existing attachment element in the document or is missing, reassign the identifier to a new value.
1906
1907         * editing/cocoa/WebContentReaderCocoa.mm:
1908         (WebCore::createFragmentForImageAttachment):
1909         (WebCore::replaceRichContentWithAttachments):
1910         (WebCore::WebContentReader::readFilePaths):
1911
1912         Remove calls to setUniqueIdentifier here, since Document will assign a unique identifier upon insertion.
1913
1914         * editing/markup.cpp:
1915         (WebCore::StyledMarkupAccumulator::appendCustomAttributes):
1916         (WebCore::createFragmentFromMarkup):
1917
1918         Set the attachment's unique identifier to the value of the "webkitattachmentid" attribute. When moving existing
1919         attachments around in the DOM without duplication, this ensures that the attachment will be removed and
1920         reinserted in the document without triggering removal and insertion client delegate methods.
1921
1922         When pasting an attachment element that has the same identifier as an existing attachment, we let Document
1923         realize that the attachment identifier already exists, and reassign it to a unique value.
1924
1925         * html/HTMLAttachmentElement.cpp:
1926         (WebCore::HTMLAttachmentElement::uniqueIdentifier const): Deleted.
1927         (WebCore::HTMLAttachmentElement::setUniqueIdentifier): Deleted.
1928         * html/HTMLAttachmentElement.h:
1929
1930 2018-01-08  Zalan Bujtas  <zalan@apple.com>
1931
1932         [RenderTreeBuilder] Move RenderBlockFlow addChild logic to RenderTreeBuilder
1933         https://bugs.webkit.org/show_bug.cgi?id=181348
1934         <rdar://problem/36328117>
1935
1936         Reviewed by Antti Koivisto.
1937
1938         This is about moving the code, no cleanup and/or normalization (unfortunately it also means
1939         some temporary changes).  
1940
1941         No change in functionality.
1942
1943         * Sources.txt:
1944         * WebCore.xcodeproj/project.pbxproj:
1945         * rendering/RenderBlockFlow.cpp:
1946         (WebCore::RenderBlockFlow::addChild):
1947         * rendering/updating/RenderTreeBuilder.cpp:
1948         (WebCore::RenderTreeBuilder::RenderTreeBuilder):
1949         (WebCore::RenderTreeBuilder::insertChildToRenderBlockFlow):
1950         * rendering/updating/RenderTreeBuilder.h:
1951         (WebCore::RenderTreeBuilder::blockFlowBuilder):
1952         * rendering/updating/RenderTreeBuilderBlockFlow.cpp: Added.
1953         (WebCore::RenderTreeBuilder::BlockFlow::BlockFlow):
1954         (WebCore::RenderTreeBuilder::BlockFlow::insertChild):
1955         * rendering/updating/RenderTreeBuilderBlockFlow.h: Added.
1956
1957 2018-01-08  Youenn Fablet  <youenn@apple.com>
1958
1959         Add CSP support to service workers
1960         https://bugs.webkit.org/show_bug.cgi?id=181385
1961
1962         Reviewed by Chris Dumez.
1963
1964         Covered by rebased tests.
1965
1966         Added recovery of CSP information from WorkerScriptLoader.
1967         Added plumbing to pass the CSP information to Service Workers.
1968         Added persistency support for the CSP information.
1969
1970         * workers/WorkerScriptLoader.cpp:
1971         (WebCore::WorkerScriptLoader::loadAsynchronously):
1972         (WebCore::WorkerScriptLoader::didReceiveResponse):
1973         * workers/WorkerScriptLoader.h:
1974         (WebCore::WorkerScriptLoader::contentSecurityPolicy const):
1975         * workers/service/SWClientConnection.cpp:
1976         (WebCore::SWClientConnection::finishedFetchingScript):
1977         (WebCore::SWClientConnection::failedFetchingScript):
1978         * workers/service/SWClientConnection.h:
1979         * workers/service/ServiceWorkerContainer.cpp:
1980         (WebCore::ServiceWorkerContainer::addRegistration):
1981         (WebCore::ServiceWorkerContainer::jobFailedWithException):
1982         (WebCore::ServiceWorkerContainer::jobResolvedWithRegistration):
1983         (WebCore::ServiceWorkerContainer::jobFinishedLoadingScript):
1984         * workers/service/ServiceWorkerContainer.h:
1985         * workers/service/ServiceWorkerContextData.cpp:
1986         (WebCore::ServiceWorkerContextData::isolatedCopy const):
1987         * workers/service/ServiceWorkerContextData.h:
1988         (WebCore::ServiceWorkerContextData::encode const):
1989         (WebCore::ServiceWorkerContextData::decode):
1990         * workers/service/ServiceWorkerFetchResult.h:
1991         (WebCore::ServiceWorkerFetchResult::encode const):
1992         (WebCore::ServiceWorkerFetchResult::decode):
1993         * workers/service/ServiceWorkerGlobalScope.cpp:
1994         (WebCore::ServiceWorkerGlobalScope::create):
1995         * workers/service/ServiceWorkerGlobalScope.h:
1996         * workers/service/ServiceWorkerJob.cpp:
1997         (WebCore::ServiceWorkerJob::notifyFinished):
1998         * workers/service/ServiceWorkerJobClient.h:
1999         * workers/service/context/ServiceWorkerThread.cpp:
2000         (WebCore::ServiceWorkerThread::ServiceWorkerThread):
2001         (WebCore::ServiceWorkerThread::createWorkerGlobalScope):
2002         * workers/service/server/RegistrationDatabase.cpp:
2003         (WebCore::v1RecordsTableSchema):
2004         (WebCore::RegistrationDatabase::openSQLiteDatabase):
2005         (WebCore::RegistrationDatabase::doPushChanges):
2006         (WebCore::RegistrationDatabase::importRecords):
2007         * workers/service/server/SWServer.cpp:
2008         (WebCore::SWServer::updateWorker):
2009         (WebCore::SWServer::installContextData):
2010         * workers/service/server/SWServer.h:
2011         * workers/service/server/SWServerJobQueue.cpp:
2012         (WebCore::SWServerJobQueue::scriptFetchFinished):
2013         * workers/service/server/SWServerWorker.cpp:
2014         (WebCore::SWServerWorker::SWServerWorker):
2015         (WebCore::m_contentSecurityPolicy):
2016         (WebCore::SWServerWorker::contextData const):
2017         * workers/service/server/SWServerWorker.h:
2018
2019 2018-01-08  Youenn Fablet  <youenn@apple.com>
2020
2021         Use no-cache fetch mode when loading main documents with location.reload()
2022         https://bugs.webkit.org/show_bug.cgi?id=181285
2023
2024         Reviewed by Alex Christensen.
2025
2026         Covered by rebased tests.
2027
2028         Start to translate cache policy used for navigation as FetchOptions::Cache.
2029         This allows ensuring service workers receive the right cache mode when intercepting navigation loads.
2030         To not change current navigation behavior, ReturnCacheDataElseLoad and ReturnCacheDataDontLoad still trigger default fetch cache mode.
2031
2032         For Reload and ReloadExpiredOnly frame load types, using no-cache mode is more efficient than reload mode,
2033         as a conditional request will be sent if possible. This applies to location.reload which is consistent with other browsers.
2034         Keep reload mode for ReloadFromOrigin.
2035
2036         * loader/DocumentLoader.cpp:
2037         (WebCore::toFetchOptionsCache):
2038         (WebCore::DocumentLoader::loadMainResource):
2039         * loader/FrameLoader.cpp:
2040         (WebCore::FrameLoader::loadFrameRequest):
2041         (WebCore::FrameLoader::loadURL):
2042         (WebCore::FrameLoader::load):
2043         (WebCore::FrameLoader::reload):
2044         (WebCore::FrameLoader::defaultRequestCachingPolicy):
2045         (WebCore::FrameLoader::loadDifferentDocumentItem):
2046         * loader/NavigationScheduler.cpp:
2047
2048 2018-01-08  Youenn Fablet  <youenn@apple.com>
2049
2050         Stop exposing fetch and extendable events to window
2051         https://bugs.webkit.org/show_bug.cgi?id=181325
2052
2053         Reviewed by Chris Dumez.
2054
2055         Covered by updated tests.
2056
2057         Marked FetchEvent and ExtendableEvent as visible in ServiceWorker environments only.
2058         Moved related Internals testing routines to ServiceWorkerInternals.
2059
2060         * testing/Internals.cpp:
2061         (WebCore::Internals::waitForFetchEventToFinish): Deleted.
2062         (WebCore::Internals::createBeingDispatchedFetchEvent): Deleted.
2063         * testing/Internals.h:
2064         * testing/Internals.idl:
2065         * testing/ServiceWorkerInternals.cpp:
2066         (WebCore::ServiceWorkerInternals::waitForFetchEventToFinish):
2067         (WebCore::ServiceWorkerInternals::createBeingDispatchedFetchEvent):
2068         * testing/ServiceWorkerInternals.h:
2069         * testing/ServiceWorkerInternals.idl:
2070         * workers/service/ExtendableEvent.idl:
2071         * workers/service/FetchEvent.idl:
2072
2073 2018-01-08  Antti Koivisto  <antti@apple.com>
2074
2075         REGRESSION (r219145): Toggling layer borders on a static document no longer works immediately
2076         https://bugs.webkit.org/show_bug.cgi?id=176260
2077         <rdar://problem/34219966>
2078
2079         Reviewed by Simon Fraser.
2080
2081         Optimization reveled bugs in debug indicator painting.
2082
2083         Test: compositing/debug-borders-dynamic.html
2084
2085         * platform/graphics/ca/GraphicsLayerCA.cpp:
2086         (WebCore::GraphicsLayerCA::commitLayerChangesBeforeSublayers):
2087         (WebCore::GraphicsLayerCA::updateDebugIndicators):
2088         (WebCore::GraphicsLayerCA::updateDebugBorder): Deleted.
2089
2090         - Rename to indicate this is not just about debug borders.
2091         - Trigger display so repaint counters get painted. This helper is only called when the indicators change.
2092
2093         * platform/graphics/ca/GraphicsLayerCA.h:
2094         * rendering/RenderLayerCompositor.cpp:
2095         (WebCore::RenderLayerCompositor::cacheAcceleratedCompositingFlags):
2096
2097         Ensure we do compositing update on debug border change even when there is no layout.
2098
2099 2018-01-08  Zalan Bujtas <zalan@apple.com>
2100
2101         [RenderTreeBuilder] Move RenderInline addChild logic to RenderTreeBuilder
2102         https://bugs.webkit.org/show_bug.cgi?id=181336
2103         <rdar://problem/36324693>
2104
2105         Reviewed by Antti Koivisto.
2106
2107         This is about moving the code, no cleanup and/or normalization (unfortunately it also means
2108         some temporary changes).  
2109
2110         No change in functionality.
2111
2112         * Sources.txt:
2113         * WebCore.xcodeproj/project.pbxproj:
2114         * rendering/RenderInline.cpp:
2115         (WebCore::RenderInline::addChild):
2116         (WebCore::RenderInline::addChildIgnoringContinuation):
2117         (WebCore::RenderInline::childBecameNonInline):
2118         (WebCore::nextContinuation): Deleted.
2119         (WebCore::RenderInline::continuationBefore): Deleted.
2120         (WebCore::newChildIsInline): Deleted.
2121         (WebCore::RenderInline::cloneAsContinuation const): Deleted.
2122         (WebCore::RenderInline::splitInlines): Deleted.
2123         (WebCore::RenderInline::splitFlow): Deleted.
2124         (WebCore::canUseAsParentForContinuation): Deleted.
2125         (WebCore::RenderInline::addChildToContinuation): Deleted.
2126         * rendering/RenderInline.h:
2127         * rendering/updating/RenderTreeBuilder.cpp:
2128         (WebCore::RenderTreeBuilder::RenderTreeBuilder):
2129         (WebCore::RenderTreeBuilder::insertChildToRenderInline):
2130         (WebCore::RenderTreeBuilder::insertChildToRenderInlineIgnoringContinuation):
2131         (WebCore::RenderTreeBuilder::splitFlow):
2132         * rendering/updating/RenderTreeBuilder.h:
2133         (WebCore::RenderTreeBuilder::inlineBuilder):
2134         * rendering/updating/RenderTreeBuilderInline.cpp: Added.
2135         (WebCore::canUseAsParentForContinuation):
2136         (WebCore::nextContinuation):
2137         (WebCore::continuationBefore):
2138         (WebCore::cloneAsContinuation):
2139         (WebCore::newChildIsInline):
2140         (WebCore::inFlowPositionedInlineAncestor):
2141         (WebCore::RenderTreeBuilder::Inline::Inline):
2142         (WebCore::RenderTreeBuilder::Inline::insertChild):
2143         (WebCore::RenderTreeBuilder::Inline::insertChildToContinuation):
2144         (WebCore::RenderTreeBuilder::Inline::insertChildIgnoringContinuation):
2145         (WebCore::RenderTreeBuilder::Inline::splitFlow):
2146         (WebCore::RenderTreeBuilder::Inline::splitInlines):
2147         * rendering/updating/RenderTreeBuilderInline.h: Added.
2148
2149 2018-01-08  Zalan Bujtas  <zalan@apple.com>
2150
2151         [RenderTreeBuilder] Move RenderBlock addChild logic to RenderTreeBuilder
2152         https://bugs.webkit.org/show_bug.cgi?id=181319
2153         <rdar://problem/36313464>
2154
2155         Reviewed by Antti Koivisto.
2156
2157         This is about moving the code, no cleanup and/or normalization (unfortunately it also means
2158         some temporary changes).  
2159
2160         No change in functionality.
2161
2162         * Sources.txt:
2163         * WebCore.xcodeproj/project.pbxproj:
2164         * rendering/RenderBlock.cpp:
2165         (WebCore::RenderBlock::addChild):
2166         (WebCore::RenderBlock::addChildIgnoringContinuation):
2167         (WebCore::RenderBlock::childBecameNonInline):
2168         (WebCore::RenderBlock::continuationBefore): Deleted.
2169         (WebCore::RenderBlock::addChildToContinuation): Deleted.
2170         (WebCore::getInlineRun): Deleted.
2171         (WebCore::RenderBlock::makeChildrenNonInline): Deleted.
2172         * rendering/RenderBlock.h:
2173         * rendering/RenderBox.cpp:
2174         (WebCore::markBoxForRelayoutAfterSplit): Deleted.
2175         (WebCore::RenderBox::splitAnonymousBoxesAroundChild): Deleted.
2176         * rendering/RenderBox.h:
2177         * rendering/RenderRubyBase.cpp:
2178         (WebCore::RenderRubyBase::moveChildren):
2179         (WebCore::RenderRubyBase::moveBlockChildren):
2180         * rendering/RenderTable.cpp:
2181         (WebCore::RenderTable::addChild):
2182         * rendering/RenderTableRow.cpp:
2183         (WebCore::RenderTableRow::addChild):
2184         * rendering/RenderTableSection.cpp:
2185         (WebCore::RenderTableSection::addChild):
2186         * rendering/updating/RenderTreeBuilder.cpp:
2187         (WebCore::markBoxForRelayoutAfterSplit):
2188         (WebCore::getInlineRun):
2189         (WebCore::RenderTreeBuilder::RenderTreeBuilder):
2190         (WebCore::RenderTreeBuilder::insertChildToRenderBlock):
2191         (WebCore::RenderTreeBuilder::insertChildToRenderBlockIgnoringContinuation):
2192         (WebCore::RenderTreeBuilder::makeChildrenNonInline):
2193         (WebCore::RenderTreeBuilder::splitAnonymousBoxesAroundChild):
2194         * rendering/updating/RenderTreeBuilder.h:
2195         (WebCore::RenderTreeBuilder::blockBuilder):
2196         * rendering/updating/RenderTreeBuilderBlock.cpp: Added.
2197         (WebCore::continuationBefore):
2198         (WebCore::RenderTreeBuilder::Block::Block):
2199         (WebCore::RenderTreeBuilder::Block::insertChild):
2200         (WebCore::RenderTreeBuilder::Block::insertChildToContinuation):
2201         (WebCore::RenderTreeBuilder::Block::insertChildIgnoringContinuation):
2202         * rendering/updating/RenderTreeBuilderBlock.h: Added.
2203         
2204 2018-01-08  Jeremy Jones  <jeremyj@apple.com>
2205
2206         Standard controls sometimes say video is in pip when it isnt.
2207         https://bugs.webkit.org/show_bug.cgi?id=181095
2208         rdar://problem/36182687
2209
2210         Reviewed by Eric Carlson.
2211
2212         * html/HTMLMediaElement.cpp:
2213         (WebCore::HTMLMediaElement::exitFullscreen):
2214
2215 2018-01-08  Jer Noble  <jer.noble@apple.com>
2216
2217         REGRESSION: [iOS] ASSERTION FAILED: !node.isConnected() in WebCore::notifyNodeInsertedIntoDocument
2218         https://bugs.webkit.org/show_bug.cgi?id=181091
2219
2220         Reviewed by Darin Adler.
2221
2222         Move the work previously performed in insertedIntoAncestor() into didFinishInsertingNode().
2223
2224         * html/HTMLMediaElement.cpp:
2225         (WebCore::HTMLMediaElement::prepareForLoad):
2226
2227 2018-01-08  Zan Dobersek  <zdobersek@igalia.com>
2228
2229         [Cairo] Use isolated fill and stroke source containers
2230         https://bugs.webkit.org/show_bug.cgi?id=181386
2231
2232         Reviewed by Carlos Garcia Campos.
2233
2234         Generate fill and stroke source objects upon invocation of various Cairo
2235         operations, initializing necessary data from the GraphicsContextState
2236         object.
2237
2238         Cairo::FillSource and Cairo::StrokeSource structs are introduced, both
2239         being default-constructible as well as providing a constructor that
2240         accepts a GraphicsContextState object from which the appropriate
2241         resources are created.
2242
2243         The FillSource and StrokeSource objects are then passed to
2244         PlatformContextCairo's prepareForFilling() and prepareForStroking()
2245         methods. Here the helper prepareCairoContextSource() function is now
2246         invoked with cairo_pattern_t objects as pattern or gradient sources, or
2247         the source color if neither cairo_pattern_t object is specified.
2248
2249         The FillSource and StrokeSource constructors mimic the previous behavior
2250         of prepareCairoContextSource(). In case the source is a Pattern object,
2251         a cairo_pattern_t object is created from that. In case of FillSource,
2252         we also retrieve pattern size, transform and repetition information. In
2253         case the source os a Gradient object, we create a 'base' cairo_pattern_t
2254         object for a completely opaque alpha channel. Additionally, if the alpha
2255         value on the state is not 1, we create an alpha-adjusted cairo_pattern_t
2256         that is potentially used for any filling or stroking operation that has
2257         to preserve transparency. If neither Pattern or Gradient objects are set
2258         on the GraphicsContextState, we default to the current fill or stroke
2259         color.
2260
2261         Overall, there's no change in behavior, this is simply a refactoring
2262         that enables us to construct Cairo objects for filling and stroking
2263         sources at the time of Cairo operation dispatch, instead of pulling down
2264         GraphicsContextState deeper into the Cairo-specific code.
2265
2266         No new tests -- no change in functionality.
2267
2268         * platform/graphics/cairo/CairoOperations.cpp:
2269         (WebCore::Cairo::drawPathShadow):
2270         (WebCore::Cairo::fillCurrentCairoPath):
2271         (WebCore::Cairo::FillSource::FillSource):
2272         (WebCore::Cairo::StrokeSource::StrokeSource):
2273         (WebCore::Cairo::fillRect):
2274         (WebCore::Cairo::fillRectWithRoundedHole):
2275         (WebCore::Cairo::fillPath):
2276         (WebCore::Cairo::strokeRect):
2277         (WebCore::Cairo::strokePath):
2278         (WebCore::Cairo::drawGlyphs):
2279         * platform/graphics/cairo/CairoOperations.h:
2280         * platform/graphics/cairo/FontCairo.cpp:
2281         (WebCore::FontCascade::drawGlyphs):
2282         * platform/graphics/cairo/GraphicsContextCairo.cpp:
2283         (WebCore::GraphicsContext::fillPath):
2284         (WebCore::GraphicsContext::strokePath):
2285         (WebCore::GraphicsContext::fillRect):
2286         (WebCore::GraphicsContext::strokeRect):
2287         (WebCore::GraphicsContext::fillRectWithRoundedHole):
2288         * platform/graphics/cairo/PlatformContextCairo.cpp:
2289         (WebCore::prepareCairoContextSource):
2290         (WebCore::PlatformContextCairo::prepareForFilling):
2291         (WebCore::PlatformContextCairo::prepareForStroking):
2292         (WebCore::PlatformContextCairo::clipForPatternFilling):
2293         * platform/graphics/cairo/PlatformContextCairo.h:
2294
2295 2018-01-08  Youenn Fablet  <youenn@apple.com>
2296
2297         navigator.onLine does not work inside service workers
2298         https://bugs.webkit.org/show_bug.cgi?id=181079
2299         <rdar://problem/36178606>
2300
2301         Reviewed by Darin Adler.
2302
2303         Test: http/wpt/service-workers/online.https.html
2304
2305         Added support for onLine by reusing a similar implementation as regular workers.
2306         Added ServiceWorkerInternals as an interface for an object exposed as self.internals in WTR.
2307         This object has currently one method to trigger change in the online/offline status.
2308         This allows writing a test for the onLine feature.
2309
2310         Note that self.internals is inserted asynchronously after the script was evaluated.
2311         When writing a worker script using self.internals, one must make sure to use self.internals when initialized.
2312         online-worker.js for instance makes use of self.internals in a postMessage callback.
2313
2314         * CMakeLists.txt:
2315         * DerivedSources.make:
2316         * WebCore.xcodeproj/project.pbxproj:
2317         * bindings/js/WorkerScriptController.h:
2318         * dom/ScriptExecutionContext.h:
2319         * testing/ServiceWorkerInternals.cpp: Added.
2320         (WebCore::ServiceWorkerInternals::ServiceWorkerInternals):
2321         (WebCore::ServiceWorkerInternals::setOnline):
2322         * testing/ServiceWorkerInternals.h: Added.
2323         * testing/ServiceWorkerInternals.idl: Added.
2324         * testing/js/WebCoreTestSupport.cpp:
2325         (WebCoreTestSupport::setupNewlyCreateServiceWorker):
2326         * testing/js/WebCoreTestSupport.h:
2327         * workers/service/context/SWContextManager.cpp:
2328         (WebCore::SWContextManager::registerServiceWorkerThreadForInstall):
2329         (WebCore::SWContextManager::startedServiceWorker):
2330         * workers/service/context/SWContextManager.h:
2331         (WebCore::SWContextManager::setServiceWorkerCreationCallback):
2332         (WebCore::SWContextManager::workerByID):
2333         * workers/service/context/ServiceWorkerThread.cpp:
2334         (WebCore::ServiceWorkerThread::ServiceWorkerThread):
2335         * workers/service/context/ServiceWorkerThreadProxy.cpp:
2336         (WebCore::ServiceWorkerThreadProxy::ServiceWorkerThreadProxy):
2337         (WebCore::ServiceWorkerThreadProxy::~ServiceWorkerThreadProxy):
2338         (WebCore::ServiceWorkerThreadProxy::networkStateChanged):
2339         (WebCore::ServiceWorkerThreadProxy::notifyNetworkStateChange):
2340         * workers/service/context/ServiceWorkerThreadProxy.h:
2341
2342 2018-01-08  Zan Dobersek  <zdobersek@igalia.com>
2343
2344         [Cairo] Contain shadow blur requirement state in a separate object
2345         https://bugs.webkit.org/show_bug.cgi?id=181380
2346
2347         Reviewed by Carlos Garcia Campos.
2348
2349         Instead of picking up the necessary state parameters from a
2350         GraphicsContextState object, store the necessary parameters in a helper
2351         ShadowBlurUsage struct. Mimicking the mustUseShadowBlur() function that
2352         is being removed, values of the shadow color, shadow blur, and shadow
2353         transform ignorance are stored there. Additionally, the required()
2354         method accepts a PlatformContextCairo object through which it can
2355         retrieve the current CTM and determine whether it's an identity, finally
2356         deciding whether shadow blur can or cannot be ignored.
2357
2358         Goal of this change is to limit usage of GraphicsContextState directly
2359         in operations implemented inside the Cairo namespace. Instead, the
2360         state parameters should be passed directly, or an equivalent but limited
2361         state object should be constructed for invocation of such operations.
2362
2363         This is likely only an intermediate solution. It's possible it will be
2364         replaced by a more complete shadow state struct that would be used for
2365         any operation that is required to draw shadows, if necessary.
2366
2367         No new tests -- no change in functionality.
2368
2369         * platform/graphics/cairo/CairoOperations.cpp:
2370         (WebCore::Cairo::drawGlyphsShadow):
2371         (WebCore::Cairo::ShadowBlurUsage::ShadowBlurUsage):
2372         (WebCore::Cairo::ShadowBlurUsage::required const):
2373         (WebCore::Cairo::fillRectWithRoundedHole):
2374         (WebCore::Cairo::drawGlyphs):
2375         (WebCore::Cairo::mustUseShadowBlur): Deleted.
2376         * platform/graphics/cairo/CairoOperations.h:
2377         * platform/graphics/cairo/FontCairo.cpp:
2378         (WebCore::FontCascade::drawGlyphs):
2379         * platform/graphics/cairo/GraphicsContextCairo.cpp:
2380         (WebCore::GraphicsContext::fillRectWithRoundedHole):
2381
2382 2018-01-08  Philippe Normand  <pnormand@igalia.com>
2383
2384         [GStreamer][Soup] Remove dead getCreateOrReadBuffer code path
2385         https://bugs.webkit.org/show_bug.cgi?id=181376
2386
2387         Reviewed by Carlos Garcia Campos.
2388
2389         This code path is no longer used now that the GStreamer HTTP
2390         source element uses data coming directly from the network process.
2391
2392         * SourcesGTK.txt:
2393         * SourcesWPE.txt:
2394         * loader/MediaResourceLoader.cpp:
2395         (WebCore::MediaResource::getOrCreateReadBuffer): Deleted.
2396         * loader/MediaResourceLoader.h:
2397         * loader/SubresourceLoader.h:
2398         * loader/cache/CachedRawResource.h:
2399         * loader/cache/CachedRawResourceClient.h:
2400         (WebCore::CachedRawResourceClient::finishedTimingForWorkerLoad):
2401         (WebCore::CachedRawResourceClient::getOrCreateReadBuffer): Deleted.
2402         * loader/cache/CachedResource.h:
2403         (WebCore::CachedResource::getOrCreateReadBuffer): Deleted.
2404         * loader/soup/CachedRawResourceSoup.cpp: Removed.
2405         * loader/soup/SubresourceLoaderSoup.cpp: Removed.
2406         * platform/graphics/PlatformMediaResourceLoader.h:
2407         (WebCore::PlatformMediaResourceClient::loadFinished):
2408         (WebCore::PlatformMediaResourceClient::getOrCreateReadBuffer): Deleted.
2409         * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
2410         (CachedResourceStreamingClient::getOrCreateReadBuffer): Deleted.
2411         * platform/network/ResourceHandleClient.h:
2412         (WebCore::ResourceHandleClient::getOrCreateReadBuffer): Deleted.
2413         * platform/network/soup/ResourceHandleSoup.cpp:
2414         (WebCore::ResourceHandle::ensureReadBuffer):
2415
2416 2018-01-08  Zan Dobersek  <zdobersek@igalia.com> and Carlos Garcia Campos  <cgarcia@igalia.com>
2417
2418         [GStreamer] use FastMalloc-based GstAllocator
2419         https://bugs.webkit.org/show_bug.cgi?id=165793
2420
2421         Reviewed by Philippe Normand.
2422
2423         Add GstAllocatorFastMalloc, a GstAllocator implementation using fast malloc. It's only used when fast malloc is
2424         enabled and can be disabled using an environment variable for debugging purposes.
2425
2426         * platform/GStreamer.cmake:
2427         * platform/graphics/gstreamer/GStreamerUtilities.cpp:
2428         (WebCore::initializeGStreamer):
2429         * platform/graphics/gstreamer/GstAllocatorFastMalloc.cpp: Added.
2430         (gstMemoryFastMallocNew):
2431         (gstAllocatorFastMallocAlloc):
2432         (gstAllocatorFastMallocFree):
2433         (gstAllocatorFastMallocMemMap):
2434         (gstAllocatorFastMallocMemUnmap):
2435         (gstAllocatorFastMallocMemCopy):
2436         (gstAllocatorFastMallocMemShare):
2437         (gstAllocatorFastMallocMemIsSpan):
2438         (gst_allocator_fast_malloc_class_init):
2439         (gst_allocator_fast_malloc_init):
2440         * platform/graphics/gstreamer/GstAllocatorFastMalloc.h: Added.
2441
2442 2018-01-07  Ms2ger  <Ms2ger@igalia.com>
2443
2444         Implement createImageBitmap(ImageBitmap)
2445         https://bugs.webkit.org/show_bug.cgi?id=181287
2446
2447         Reviewed by Darin Adler.
2448
2449         Tests: imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-drawImage.html
2450                imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-invalid-args.html
2451
2452         * html/ImageBitmap.cpp:
2453         (WebCore::ImageBitmap::createPromise):
2454
2455 2018-01-07  Ryosuke Niwa  <rniwa@webkit.org>
2456
2457         Reduce the precision of "high" resolution time to 1ms
2458         https://bugs.webkit.org/show_bug.cgi?id=180910
2459         <rdar://problem/36085943>
2460
2461         Reviewed by Saam Barati.
2462
2463         Reduced the high prevision time's resolution to 1ms, the same precision as Date.now().
2464
2465         Also fixed the bug in fillRTCStats that we weren't reducing the time resolution in RTCStats dictionaries.
2466
2467         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
2468         (WebCore::fillRTCStats):
2469         * page/Performance.cpp:
2470         (WebCore::Performance::reduceTimeResolution):
2471
2472 2018-01-06  Simon Fraser  <simon.fraser@apple.com>
2473
2474         Possible crash computing event regions
2475         https://bugs.webkit.org/show_bug.cgi?id=181368
2476         rdar://problem/34847081
2477
2478         Reviewed by Zalan Bujtas.
2479
2480         Don't trigger layout in Element::absoluteEventHandlerBounds(), since this can run arbirary script
2481         which might delete elements or re-enter Document::absoluteRegionForEventTargets().
2482
2483         It's OK to not trigger layout, because if layout is dirty, the next layout will update event regions again.
2484
2485         Add a LayoutDisallowedScope to check that Document::absoluteRegionForEventTargets() doesn't
2486         trigger layout, and move the check for LayoutDisallowedScope::isLayoutAllowed() from Document::updateLayout()
2487         to LayoutContext::layout(), since some layouts don't happen via the former (e.g. the one being removed here).
2488
2489         The test checks that the assertion does not fire. I was not able to get a reliable test for any crash.
2490
2491         Test: fast/events/event-handler-regions-layout.html
2492
2493         * dom/Document.cpp:
2494         (WebCore::Document::updateLayout):
2495         (WebCore::Document::absoluteRegionForEventTargets):
2496         * dom/Element.cpp:
2497         (WebCore::Element::absoluteEventHandlerBounds):
2498         * page/LayoutContext.cpp:
2499         (WebCore::LayoutContext::layout):
2500         * rendering/LayoutDisallowedScope.h: Move the #ifdefs around to avoid defining the enum twice.
2501         (WebCore::LayoutDisallowedScope::LayoutDisallowedScope):
2502         (WebCore::LayoutDisallowedScope::isLayoutAllowed):
2503
2504 2018-01-06  Simon Fraser  <simon.fraser@apple.com>
2505
2506         Crash under RenderLayer::scrollTo() with marquee
2507         https://bugs.webkit.org/show_bug.cgi?id=181349
2508         rdar://problem/36190168
2509
2510         Reviewed by Zalan Bujtas.
2511
2512         Don't call updateWidgetPositions() synchonously during RenderLayer scrolling, because it
2513         can run arbitrary script which may trigger destruction of this RenderLayer.
2514
2515         Instead, queue up updateWidgetPositions() on a zero-delay timer.
2516
2517         Under some circumstances this may allow a paint to occur before the widgets have been
2518         updated (which could be fixed with a more invasive change), but in practice I saw no
2519         painting issues with plug-ins or iframes inside overflow scroll, in WebKit or LegacyWebKit.
2520
2521         Test: fast/scrolling/marquee-scroll-crash.html
2522
2523         * page/FrameView.cpp:
2524         (WebCore::FrameView::FrameView):
2525         (WebCore::FrameView::updateWidgetPositions):
2526         (WebCore::FrameView::scheduleUpdateWidgetPositions):
2527         (WebCore::FrameView::updateWidgetPositionsTimerFired):
2528         * page/FrameView.h:
2529         * rendering/RenderLayer.cpp:
2530         (WebCore::RenderLayer::scrollTo):
2531
2532 2018-01-05  Dean Jackson  <dino@apple.com>
2533
2534         Accurately clip copyTexImage2D and copyTexSubImage2D
2535         https://bugs.webkit.org/show_bug.cgi?id=181356
2536         <rdar://problem/35083877>
2537
2538         Reviewed by Eric Carlson.
2539
2540         The code to make sure copyTexSubImage2D and copyTexImage2D will not try to read
2541         out of bounds had a bad bug introduced here:
2542         https://bugs.webkit.org/show_bug.cgi?id=51421
2543
2544         With appropriate parameters, it would produce a rectangle with
2545         negative dimensions. Most GL drivers just ignored this, but some
2546         are not happy.
2547
2548         Test: fast/canvas/webgl/copy-tex-image-and-sub-image-2d-bad-input.html
2549
2550         * html/canvas/WebGLRenderingContextBase.cpp:
2551         (WebCore::clip2D): Reimplement this in a more sane manner, and use
2552         checked arithmetic while here.
2553         * html/canvas/WebGLRenderingContextBase.h:
2554         (WebCore::clip1D): Deleted.
2555         (WebCore::clip2D): Deleted.
2556
2557 2018-01-06  Antti Koivisto  <antti@apple.com>
2558
2559         Use WeakPtr for RenderTreePosition::m_nextSibling
2560         https://bugs.webkit.org/show_bug.cgi?id=181363
2561
2562         Reviewed by Zalan Bujtas.
2563
2564         For safety. In most cases it is null and won't cause us to instantiate WeakReferences for
2565         many new objects.
2566
2567         * rendering/updating/RenderTreePosition.cpp:
2568         (WebCore::RenderTreePosition::computeNextSibling):
2569         * rendering/updating/RenderTreePosition.h:
2570         (WebCore::RenderTreePosition::RenderTreePosition):
2571         (WebCore::RenderTreePosition::nextSibling const):
2572
2573 2018-01-05  David Kilzer  <ddkilzer@apple.com>
2574
2575         Re-enable -Wcast-qual in WebCore for Apple ports
2576         <https://webkit.org/b/177895>
2577         <rdar://problem/34960830>
2578
2579         Reviewed by Joseph Pecoraro.
2580
2581         * Configurations/Base.xcconfig:
2582         (WARNING_CFLAGS): Remove FIXME and add -Wcast-qual back to
2583         arguments.
2584
2585         * crypto/mac/SerializedCryptoKeyWrapMac.mm:
2586         (WebCore::createAndStoreMasterKey):
2587         - Use checked_cf_cast<SecACLRef>().
2588
2589         * editing/cocoa/DataDetection.mm:
2590         (WebCore::detectItemAtPositionWithRange):
2591         - Manually cast CFTypeRef to DDResultRef until
2592           DDResultGetTypeID() is available as SPI.
2593
2594         * platform/gamepad/mac/HIDGamepad.cpp:
2595         (WebCore::HIDGamepad::initElementsFromArray):
2596         - Use checked_cf_cast<IOHIDElementRef>().
2597
2598         * platform/graphics/avfoundation/objc/MediaSampleAVFObjC.mm:
2599         (WebCore::MediaSampleAVFObjC::createImageSample):
2600         (WebCore::CMSampleBufferIsRandomAccess):
2601         (WebCore::CMSampleBufferIsNonDisplaying):
2602         (WebCore::MediaSampleAVFObjC::createNonDisplayingCopy const):
2603         - Use checked_cf_cast<CFMutableDictionaryRef>() and
2604           checked_cf_cast<CFDictionaryRef>().
2605
2606         * platform/graphics/cocoa/IOSurface.h:
2607         (WebCore::IOSurface::asLayerContents):
2608         - Use reinterpret_cast<id>() to cast from IOSurfaceRef to id.
2609
2610         * platform/graphics/cocoa/WebCoreDecompressionSession.mm:
2611         (WebCore::WebCoreDecompressionSession::getFirstVideoFrame):
2612         (WebCore::WebCoreDecompressionSession::automaticDequeue):
2613         (WebCore::WebCoreDecompressionSession::imageForTime):
2614         (WebCore::WebCoreDecompressionSession::getDecodeTime):
2615         (WebCore::WebCoreDecompressionSession::getPresentationTime):
2616         (WebCore::WebCoreDecompressionSession::getDuration):
2617         - Use checked_cf_cast<CMSampleBufferRef>().
2618
2619         * platform/graphics/Font.h:
2620         (WebCore::Font::m_kernedCFStringAttributes):
2621         (WebCore::Font::m_nonKernedCFStringAttributes):
2622         - Change type from RetainPtr<CFDictionaryRef> to
2623           RetainPtr<CFMutableDictionaryRef> since that's what they are.
2624         * platform/graphics/mac/SimpleFontDataCoreText.cpp:
2625         (WebCore::Font::getCFStringAttributes const):
2626         - Replace local `mutableAttributes` variable with
2627           `attributesDictionary.get()` since it returns the correct type
2628           now.
2629
2630         * platform/ios/wak/WAKView.mm:
2631         (-[WAKView _initWithViewRef:]):
2632         (_WAKCopyWrapper):
2633         * platform/ios/wak/WKView.mm:
2634         (_WKViewClearSuperview):
2635         (WKViewFirstChild):
2636         (WKViewNextSibling):
2637         - Use static_cast<WKViewRef>(const_cast<void*>()) to convert
2638           const void* variable to WKViewRef.
2639
2640         * platform/mac/PasteboardMac.mm:
2641         (WebCore::flipImageSpec):
2642         (WebCore::setDragImageImpl):
2643         - Use const_cast<> to remove 'const' modifier from
2644           unsigned char pointers.  This regressed while -Wcast-qual was
2645           disabled for WebCore.
2646
2647         * platform/mac/SSLKeyGeneratorMac.mm:
2648         (WebCore::signedPublicKeyAndChallengeString):
2649         - Use checked_cf_cast<SecACLRef>().
2650
2651         * platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.cpp:
2652         (WebCore::RealtimeIncomingVideoSourceCocoa::OnFrame):
2653         - Use checked_cf_cast<CFMutableDictionaryRef>().
2654
2655         * platform/network/cf/SocketStreamHandleImplCFNet.cpp:
2656         (WebCore::copyCONNECTProxyResponse):
2657         - Use checked_cf_cast<CFHTTPMessageRef>().
2658
2659         * platform/network/cocoa/ResourceResponseCocoa.mm:
2660         (WebCore::ResourceResponse::platformCertificateInfo const):
2661         - Use checked_cf_cast<SecTrustRef>().
2662
2663         * platform/network/mac/CertificateInfoMac.mm:
2664         (WebCore::CertificateInfo::containsNonRootSHA1SignedCertificate const):
2665         (WebCore::CertificateInfo::dump const):
2666         - Use checked_cf_cast<SecCertificateRef>().
2667
2668         * testing/cocoa/WebArchiveDumpSupport.mm:
2669         (WebCoreTestSupport::createCFURLResponseFromResponseData):
2670         - Use checked_cf_cast<>() for CFMutable* types.
2671
2672 2018-01-05  John Wilander  <wilander@apple.com>
2673
2674         Storage Access API: Refactor to make naming accurate and explicit, simplify access table, and prepare for access removal for page
2675         https://bugs.webkit.org/show_bug.cgi?id=181357
2676         <rdar://problem/36331031>
2677
2678         Reviewed by Alex Christensen.
2679
2680         No new tests. The only changed functionality that isn't covered
2681         by existing tests is cross-origin iframes in the same partition
2682         should be handled as already having access. This cannot be
2683         tested in layout tests since they don't support subdomains.
2684
2685         This change does the following:
2686         - Changes function and message names to reflect how this feature
2687           was eventually implemented, i.e. access per frame.
2688         - Makes it explicit that the UI process is only involved in
2689           granting storage access and not removing storage access.
2690           The latter is done directly by the web process.
2691         - Simplifies the network process' entry map since only needs to
2692           be able to give access to one domain in one frame at a time.
2693           Access goes away on frame navigation so there can only be one
2694           domain at a time per frame. Also, the map now uses pageIDs as
2695           main keys to prepare for efficient access removal for all
2696           frames under a page.
2697         - Fixes a bug in so that a cross-origin iframe with the same
2698           partition as the top frame correctly is handled as already
2699           having access.
2700
2701         * platform/network/NetworkStorageSession.h:
2702         * platform/network/cf/NetworkStorageSessionCFNet.cpp:
2703         (WebCore::NetworkStorageSession::cookieStoragePartition const):
2704             The only change here is the changed named of the call to
2705             NetworkStorageSession::hasStorageAccessForFrame().
2706         (WebCore::NetworkStorageSession::hasStorageAccessForFrame const):
2707         (WebCore::NetworkStorageSession::grantStorageAccessForFrame):
2708         (WebCore::NetworkStorageSession::removeStorageAccessForFrame):
2709         (WebCore::NetworkStorageSession::isStorageAccessGranted const): Deleted.
2710         (WebCore::NetworkStorageSession::setStorageAccessGranted): Deleted.
2711         (WebCore::NetworkStorageSession::removeStorageAccess): Deleted.
2712
2713 2018-01-05  Youenn Fablet  <youenn@apple.com>
2714
2715         Implement Cache API partitioning based on ClientOrigin
2716         https://bugs.webkit.org/show_bug.cgi?id=181240
2717
2718         Reviewed by Alex Christensen.
2719
2720         Covered by updated tests.
2721
2722         Previously, cache storage was partitioned according the origin of the client, represented as a String.
2723         We now partition according both client and top origins, represented as a ClientOrigin
2724
2725         Minor refactoring to use more makePendingActivity.
2726         Added support for IPC serialization of ClientOrigin.
2727         Added SecurityOriginData::toString which is used by WebKit2 Cache Storage implementation.
2728
2729         * Modules/cache/CacheStorageConnection.cpp:
2730         (WebCore::CacheStorageConnection::open):
2731         (WebCore::CacheStorageConnection::retrieveCaches):
2732         * Modules/cache/CacheStorageConnection.h:
2733         (WebCore::CacheStorageConnection::clearMemoryRepresentation):
2734         (WebCore::CacheStorageConnection::doOpen):
2735         (WebCore::CacheStorageConnection::doRetrieveCaches):
2736         * Modules/cache/DOMCacheStorage.cpp:
2737         (WebCore::DOMCacheStorage::origin const):
2738         (WebCore::DOMCacheStorage::retrieveCaches):
2739         (WebCore::DOMCacheStorage::open):
2740         (WebCore::DOMCacheStorage::remove):
2741         * Modules/cache/DOMCacheStorage.h:
2742         * Modules/cache/WorkerCacheStorageConnection.cpp:
2743         (WebCore::WorkerCacheStorageConnection::doOpen):
2744         (WebCore::WorkerCacheStorageConnection::doRetrieveCaches):
2745         * Modules/cache/WorkerCacheStorageConnection.h:
2746         * page/ClientOrigin.h:
2747         (WebCore::ClientOrigin::isolatedCopy const):
2748         (WebCore::ClientOrigin::encode const):
2749         (WebCore::ClientOrigin::decode):
2750         * page/SecurityOriginData.cpp:
2751         (WebCore::SecurityOriginData::toString const):
2752         (WebCore::SecurityOriginData::debugString const): Deleted.
2753         * page/SecurityOriginData.h:
2754         (WebCore::SecurityOriginData::debugString const):
2755         * testing/Internals.cpp:
2756         (WebCore::Internals::clearCacheStorageMemoryRepresentation):
2757
2758 2018-01-05  Wenson Hsieh  <wenson_hsieh@apple.com>
2759
2760         [Attachment Support] Add a way to write blob data to a file URL from the UI process
2761         https://bugs.webkit.org/show_bug.cgi?id=181236
2762
2763         Reviewed by Brady Eidson.
2764
2765         Add support for writing a blob to a designated file path. See comments below for more detail. No new tests, as
2766         there change in behavior yet. See part 2: https://bugs.webkit.org/show_bug.cgi?id=181199.
2767
2768         * page/DragController.cpp:
2769         (WebCore::DragController::dragAttachmentElement):
2770         * platform/PromisedBlobInfo.h:
2771
2772         Remove PromisedBlobData entirely. This was added with the premise of having the web process deliver blob data to
2773         the UI process. However, the new approach I'm taking just has the UI process tell the network process to write
2774         a blob to a given location, so a data structure to deliver blob data over IPC is no longer necessary.
2775
2776         (WebCore::PromisedBlobData::hasData const): Deleted.
2777         (WebCore::PromisedBlobData::hasFile const): Deleted.
2778         (WebCore::PromisedBlobData::operator bool const): Deleted.
2779         (WebCore::PromisedBlobData::fulfills const): Deleted.
2780         * platform/network/BlobRegistryImpl.cpp:
2781         (WebCore::BlobRegistryImpl::populateBlobsForFileWriting):
2782
2783         Introduce a new helper to build a list of blob data for file writing.
2784
2785         (WebCore::writeFilePathsOrDataBuffersToFile):
2786
2787         Introduce a new static helper to write blob data (a list of file paths and data buffers) to a given file handle.
2788         Automatically closes the given file handle upon exit.
2789
2790         (WebCore::BlobRegistryImpl::writeBlobsToTemporaryFiles):
2791         (WebCore::BlobRegistryImpl::writeBlobToFilePath):
2792
2793         Pull out common logic in writeBlobsToTemporaryFiles and writeBlobToFilePath into helper methods (see above), and
2794         refactor both methods to use the helpers.
2795
2796         * platform/network/BlobRegistryImpl.h:
2797
2798 2018-01-05  Alex Christensen  <achristensen@webkit.org>
2799
2800         Forbid < and > in URL hosts
2801         https://bugs.webkit.org/show_bug.cgi?id=181308
2802         <rdar://problem/36012757>
2803
2804         Reviewed by Tim Horton.
2805
2806         https://url.spec.whatwg.org/#forbidden-host-code-point does not include these characters yet, but I think it should.
2807         Firefox fails to parse URLs with < or > in the host.  Chrome percent encodes them.  Safari needs to do something.
2808         The web platform tests are unclear on this case, and they will need to be updated with the specification.
2809         They do show a change in behavior, though.
2810
2811         * platform/URLParser.cpp:
2812         Add < and > to the list of forbidden host code points.
2813
2814 2018-01-05  Eric Carlson  <eric.carlson@apple.com>
2815
2816         [MediaStream] Add Mac screen capture source
2817         https://bugs.webkit.org/show_bug.cgi?id=181333
2818         <rdar://problem/36323219>
2819
2820         Reviewed by Dean Jackson.
2821
2822         * SourcesCocoa.txt: Add ScreenDisplayCaptureSourceMac.mm.
2823
2824         * WebCore.xcodeproj/project.pbxproj: Ditto.
2825
2826         * platform/cocoa/CoreVideoSoftLink.cpp: Declare new constants used.
2827         * platform/cocoa/CoreVideoSoftLink.h:
2828
2829         * platform/mediastream/mac/DisplayCaptureManagerCocoa.cpp:
2830         (WebCore::displayReconfigurationCallBack): Call refreshCaptureDevices.
2831         (WebCore::DisplayCaptureManagerCocoa::~DisplayCaptureManagerCocoa): Unregister for display
2832         reconfiguration callbacks.
2833         (WebCore::DisplayCaptureManagerCocoa::captureDevices): Register for display reconfigrations.
2834         (WebCore::DisplayCaptureManagerCocoa::refreshCaptureDevices): Use CGActiveDisplayList to
2835         get list of active screens.
2836         (WebCore::DisplayCaptureManagerCocoa::screenCaptureDeviceWithPersistentID): Validate screen
2837         ID, return CaptureDevice.
2838         * platform/mediastream/mac/DisplayCaptureManagerCocoa.h:
2839
2840         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp:
2841         (WebCore::VideoCaptureSourceFactoryMac::createVideoCaptureSource): Deal with screen capture
2842         on macOS.
2843
2844         Implement Mac screen capture with CGDisplayStream.
2845         * platform/mediastream/mac/ScreenDisplayCaptureSourceMac.h: Added.
2846         (WebCore::ScreenDisplayCaptureSourceMac::DisplaySurface::~DisplaySurface):
2847         (WebCore::ScreenDisplayCaptureSourceMac::DisplaySurface::operator=):
2848         (WebCore::ScreenDisplayCaptureSourceMac::DisplaySurface::ioSurface const):
2849         * platform/mediastream/mac/ScreenDisplayCaptureSourceMac.mm: Added.
2850         (WebCore::roundUpToMacroblockMultiple):
2851         (WebCore::ScreenDisplayCaptureSourceMac::updateDisplayID):
2852         (WebCore::ScreenDisplayCaptureSourceMac::create):
2853         (WebCore::ScreenDisplayCaptureSourceMac::ScreenDisplayCaptureSourceMac):
2854         (WebCore::ScreenDisplayCaptureSourceMac::~ScreenDisplayCaptureSourceMac):
2855         (WebCore::ScreenDisplayCaptureSourceMac::createDisplayStream):
2856         (WebCore::ScreenDisplayCaptureSourceMac::startProducingData):
2857         (WebCore::ScreenDisplayCaptureSourceMac::stopProducingData):
2858         (WebCore::ScreenDisplayCaptureSourceMac::sampleBufferFromPixelBuffer):
2859         (WebCore::ScreenDisplayCaptureSourceMac::pixelBufferFromIOSurface):
2860         (WebCore::ScreenDisplayCaptureSourceMac::generateFrame):
2861         (WebCore::ScreenDisplayCaptureSourceMac::startDisplayStream):
2862         (WebCore::ScreenDisplayCaptureSourceMac::applySize):
2863         (WebCore::ScreenDisplayCaptureSourceMac::applyFrameRate):
2864         (WebCore::ScreenDisplayCaptureSourceMac::commitConfiguration):
2865         (WebCore::ScreenDisplayCaptureSourceMac::displayWasReconfigured):
2866         (WebCore::ScreenDisplayCaptureSourceMac::displayReconfigurationCallBack):
2867         (WebCore::ScreenDisplayCaptureSourceMac::frameAvailable):
2868
2869 2018-01-05  Don Olmstead  <don.olmstead@sony.com>
2870
2871         [curl] Can't load file:// URL with a URL fragment identifier
2872         https://bugs.webkit.org/show_bug.cgi?id=181170
2873
2874         Reviewed by Alex Christensen.
2875
2876         No new tests. No change in behavior.
2877
2878         * platform/network/curl/CurlRequest.cpp:
2879         (WebCore::CurlRequest::invokeDidReceiveResponseForFile):
2880
2881 2018-01-05  Don Olmstead  <don.olmstead@sony.com>
2882
2883         TextCodec uses std::array but does not include it
2884         https://bugs.webkit.org/show_bug.cgi?id=181340
2885
2886         Reviewed by Alex Christensen.
2887
2888         No new tests. No change in behavior.
2889
2890         * platform/text/TextCodec.h:
2891
2892 2018-01-05  Said Abou-Hallawa  <sabouhallawa@apple.com>
2893
2894         SVGAnimatedListPropertyTearOff::synchronizeWrappersIfNeeded() should do nothing if the property is not animating
2895         https://bugs.webkit.org/show_bug.cgi?id=181316
2896         <rdar://problem/36147545>
2897
2898         Reviewed by Simon Fraser.
2899
2900         This is a speculative change to fix a crash which appeared after r226065.
2901         The crash is very intermittent and sometimes very hard to reproduce. The
2902         basic code analysis did not show how this crash can even happen.
2903
2904         * svg/SVGAnimatedTypeAnimator.h:
2905         (WebCore::SVGAnimatedTypeAnimator::resetFromBaseValues): For SVG property
2906         with two values, e.g. <SVGAngleValue, SVGMarkerOrientType>,  we need to
2907         detach the wrappers of the animated property if the animated values are
2908         going to change. This is similar to what we did in resetFromBaseValue().
2909
2910         * svg/properties/SVGAnimatedListPropertyTearOff.h:
2911         (WebCore::SVGAnimatedListPropertyTearOff::synchronizeWrappersIfNeeded):
2912
2913 2018-01-05  Matt Lewis  <jlewis3@apple.com>
2914
2915         Unreviewed, rolling out r226401.
2916
2917         This caused timeouts on multiple platforms.
2918
2919         Reverted changeset:
2920
2921         "Implement Cache API partitioning based on ClientOrigin"
2922         https://bugs.webkit.org/show_bug.cgi?id=181240
2923         https://trac.webkit.org/changeset/226401
2924
2925 2018-01-05  Dan Bernstein  <mitz@apple.com>
2926
2927         Fixed the build following AppKit API deprecations in a recent SDKs
2928
2929         * platform/mac/PasteboardMac.mm:
2930         (WebCore::setDragImageImpl): Suppressed deprecation warnings.
2931         * platform/mac/WidgetMac.mm:
2932         (WebCore::Widget::paint): Ditto.
2933
2934 2018-01-05  Joseph Pecoraro  <pecoraro@apple.com>
2935
2936         ServiceWorkers: Enable UserTiming / ResourceTiming
2937         https://bugs.webkit.org/show_bug.cgi?id=181297
2938         <rdar://problem/36307306>
2939
2940         Reviewed by Youenn Fablet.
2941
2942         Tests: http/tests/workers/service/service-worker-resource-timing.https.html
2943                http/tests/workers/service/service-worker-user-timing.https.html
2944
2945         * loader/ResourceTiming.cpp:
2946         (WebCore::ResourceTiming::ResourceTiming):
2947         We used to clear extra NetworkLoadMetrics data early on. However,
2948         for Workers we want to pass the complete NetworkLoadMetrics to
2949         the Worker so that a Worker inspector has access to it.
2950
2951         * page/PerformanceResourceTiming.cpp:
2952         (WebCore::PerformanceResourceTiming::PerformanceResourceTiming):
2953         Instead move the clearing of extra data to here, when the NetworkLoadMetrics
2954         have finally settled into being used only for a performance entry.
2955
2956 2018-01-04  Philippe Normand  <pnormand@igalia.com>
2957
2958         [EME][GStreamer] Fix wrong ifdef
2959         https://bugs.webkit.org/show_bug.cgi?id=181289
2960
2961         Reviewed by Alex Christensen.
2962
2963         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
2964         (WebCore::MediaPlayerPrivateGStreamer::handleMessage): Remove the
2965         ENCRYPTED_MEDIA ifdef from the VIDEO_TRACK ifdef block. Both have
2966         nothing to do together.
2967
2968 2018-01-05  Fujii Hironori  <Hironori.Fujii@sony.com>
2969
2970         [Cairo] Canvas: Path::clear should clear its transform
2971         https://bugs.webkit.org/show_bug.cgi?id=181320
2972
2973         Reviewed by Carlos Garcia Campos.
2974
2975         Path of Cairo port has its cairo context. Path::clear() didn't
2976         clear the transform matrix of the context.
2977
2978         Test: fast/canvas/reset-scaling-by-height-change.html
2979
2980         * platform/graphics/cairo/PathCairo.cpp:
2981         (WebCore::Path::clear): Reset the transform matrix of Path.
2982
2983 2018-01-04  Devin Rousso  <webkit@devinrousso.com>
2984
2985         Web Inspector: replace HTMLCanvasElement with CanvasRenderingContext for instrumentation logic
2986         https://bugs.webkit.org/show_bug.cgi?id=180770
2987
2988         Reviewed by Joseph Pecoraro.
2989
2990         No change in functionality.
2991
2992         * html/HTMLCanvasElement.h:
2993         * html/HTMLCanvasElement.cpp:
2994         (WebCore::HTMLCanvasElement::createContext2d):
2995         (WebCore::HTMLCanvasElement::createContextWebGL):
2996         (WebCore::HTMLCanvasElement::createContextWebGPU):
2997         (WebCore::HTMLCanvasElement::createContextBitmapRenderer):
2998         (WebCore::HTMLCanvasElement::reset):
2999         (WebCore::HTMLCanvasElement::paint):
3000         (WebCore::HTMLCanvasElement::setImageBuffer const):
3001         (WebCore::HTMLCanvasElement::addObserver): Deleted.
3002         (WebCore::HTMLCanvasElement::removeObserver): Deleted.
3003         (WebCore::HTMLCanvasElement::cssCanvasClients): Deleted.
3004         (WebCore::HTMLCanvasElement::notifyObserversCanvasChanged): Deleted.
3005         * html/OffscreenCanvas.h:
3006         * html/canvas/CanvasRenderingContext.h:
3007         * html/canvas/CanvasRenderingContext.cpp:
3008         * html/canvas/CanvasRenderingContext2D.h:
3009         * html/canvas/CanvasRenderingContext2D.cpp:
3010         (WebCore::CanvasRenderingContext2D::create):
3011         * html/canvas/CanvasRenderingContext2DBase.h:
3012         * html/canvas/ImageBitmapRenderingContext.h:
3013         * html/canvas/ImageBitmapRenderingContext.cpp:
3014         (WebCore::ImageBitmapRenderingContext::create):
3015         * html/canvas/WebGL2RenderingContext.h:
3016         * html/canvas/WebGL2RenderingContext.cpp:
3017         (WebCore::WebGL2RenderingContext::create):
3018         * html/canvas/WebGLRenderingContext.h:
3019         * html/canvas/WebGLRenderingContext.cpp:
3020         (WebCore::WebGLRenderingContext::create):
3021         * html/canvas/WebGLRenderingContextBase.h:
3022         * html/canvas/WebGLRenderingContextBase.cpp:
3023         (WebCore::WebGLRenderingContextBase::create):
3024         * html/canvas/WebGPURenderingContext.cpp:
3025         (WebCore::WebGPURenderingContext::create):
3026         Instead of adding didCreateCanvasRenderingContext calls at the construction sites of each
3027         context, we can make the constructors private and force the usage of static `create` functions.
3028         This way, we have access to the fully constructed object and have a guaranteed path for creation.
3029
3030         * html/CanvasBase.h:
3031         * html/CanvasBase.cpp:
3032         (WebCore::CanvasBase::~CanvasBase):
3033         (WebCore::CanvasBase::renderingContext const):
3034         (WebCore::CanvasBase::addObserver):
3035         (WebCore::CanvasBase::removeObserver):
3036         (WebCore::CanvasBase::notifyObserversCanvasChanged):
3037         (WebCore::CanvasBase::notifyObserversCanvasResized):
3038         (WebCore::CanvasBase::notifyObserversCanvasDestroyed):
3039         (WebCore::CanvasBase::cssCanvasClients const):
3040         * Modules/mediastream/CanvasCaptureMediaStreamTrack.h:
3041         * Modules/mediastream/CanvasCaptureMediaStreamTrack.cpp:
3042         (WebCore::CanvasCaptureMediaStreamTrack::Source::canvasDestroyed):
3043         (WebCore::CanvasCaptureMediaStreamTrack::Source::canvasResized):
3044         (WebCore::CanvasCaptureMediaStreamTrack::Source::canvasChanged):
3045         * css/CSSCanvasValue.h:
3046         Move the CanvasObserver class to CanvasBase so that it can also be used for OffscreenCanvas.
3047
3048         * inspector/InspectorInstrumentation.h:
3049         (WebCore::InspectorInstrumentation::didChangeCSSCanvasClientNodes):
3050         (WebCore::InspectorInstrumentation::didCreateCanvasRenderingContext):
3051         (WebCore::InspectorInstrumentation::didChangeCanvasMemory):
3052         (WebCore::InspectorInstrumentation::recordCanvasAction):
3053         (WebCore::InspectorInstrumentation::didFinishRecordingCanvasFrame):
3054         (WebCore::InspectorInstrumentation::didEnableExtension):
3055         (WebCore::InspectorInstrumentation::didCreateProgram):
3056         (WebCore::InspectorInstrumentation::willDeleteProgram):
3057         (WebCore::InspectorInstrumentation::isShaderProgramDisabled):
3058         (WebCore::InspectorInstrumentation::consoleStartRecordingCanvas):
3059         (WebCore::InspectorInstrumentation::didCreateCSSCanvas): Deleted.
3060         * inspector/InspectorInstrumentation.cpp:
3061         (WebCore::InspectorInstrumentation::consoleStartRecordingCanvasImpl):
3062         (WebCore::InspectorInstrumentation::didChangeCSSCanvasClientNodesImpl):
3063         (WebCore::InspectorInstrumentation::didCreateCanvasRenderingContextImpl):
3064         (WebCore::InspectorInstrumentation::didChangeCanvasMemoryImpl):
3065         (WebCore::InspectorInstrumentation::didFinishRecordingCanvasFrameImpl):
3066         (WebCore::InspectorInstrumentation::didEnableExtensionImpl):
3067         (WebCore::InspectorInstrumentation::didCreateProgramImpl):
3068         (WebCore::InspectorInstrumentation::didCreateCSSCanvasImpl): Deleted.
3069
3070         * inspector/agents/InspectorCanvasAgent.h:
3071         * inspector/agents/InspectorCanvasAgent.cpp:
3072         (WebCore::InspectorCanvasAgent::enable):
3073         (WebCore::InspectorCanvasAgent::requestNode):
3074         (WebCore::InspectorCanvasAgent::requestContent):
3075         (WebCore::InspectorCanvasAgent::requestCSSCanvasClientNodes):
3076         (WebCore::contextAsScriptValue):
3077         (WebCore::InspectorCanvasAgent::resolveCanvasContext):
3078         (WebCore::InspectorCanvasAgent::startRecording):
3079         (WebCore::InspectorCanvasAgent::stopRecording):
3080         (WebCore::InspectorCanvasAgent::updateShader):
3081         (WebCore::InspectorCanvasAgent::frameNavigated):
3082         (WebCore::InspectorCanvasAgent::didChangeCSSCanvasClientNodes):
3083         (WebCore::InspectorCanvasAgent::didCreateCanvasRenderingContext):
3084         (WebCore::InspectorCanvasAgent::didChangeCanvasMemory):
3085         (WebCore::InspectorCanvasAgent::recordCanvasAction):
3086         (WebCore::InspectorCanvasAgent::canvasDestroyed):
3087         (WebCore::InspectorCanvasAgent::didFinishRecordingCanvasFrame):
3088         (WebCore::InspectorCanvasAgent::consoleStartRecordingCanvas):
3089         (WebCore::InspectorCanvasAgent::didEnableExtension):
3090         (WebCore::InspectorCanvasAgent::didCreateProgram):
3091         (WebCore::InspectorCanvasAgent::canvasRecordingTimerFired):
3092         (WebCore::InspectorCanvasAgent::clearCanvasData):
3093         (WebCore::InspectorCanvasAgent::unbindCanvas):
3094         (WebCore::InspectorCanvasAgent::findInspectorCanvas):
3095         (WebCore::InspectorCanvasAgent::unbindProgram):
3096         (WebCore::InspectorCanvasAgent::didCreateCSSCanvas): Deleted.
3097
3098         * inspector/InspectorCanvas.h:
3099         * inspector/InspectorCanvas.cpp:
3100         (WebCore::InspectorCanvas::create):
3101         (WebCore::InspectorCanvas::InspectorCanvas):
3102         (WebCore::InspectorCanvas::canvasElement):
3103         (WebCore::InspectorCanvas::resetRecordingData):
3104         (WebCore::InspectorCanvas::recordAction):
3105         (WebCore::InspectorCanvas::buildObjectForCanvas):
3106         (WebCore::InspectorCanvas::getCanvasContentAsDataURL):
3107         (WebCore::InspectorCanvas::buildInitialState):
3108         (WebCore::InspectorCanvas::~InspectorCanvas): Deleted.
3109
3110         * inspector/InspectorShaderProgram.h:
3111         * inspector/InspectorShaderProgram.cpp:
3112         (WebCore::InspectorShaderProgram::context const):
3113
3114         * page/PageConsoleClient.cpp:
3115         (WebCore::PageConsoleClient::record):
3116         (WebCore::PageConsoleClient::recordEnd):
3117
3118         * dom/Document.h:
3119         * dom/Document.cpp:
3120         (WebCore::Document::getCSSCanvasElement):
3121         (WebCore::Document::nameForCSSCanvasElement const):
3122         We have no reason to save the CSS canvas name for each InspectorCanvas object, so instead we
3123         can just query for the name based on the CanvasRenderingContext's HTMLCanvasElement (assuming
3124         it is not an OffscreenCanvas) when we need it.
3125
3126 2018-01-04  Chris Fleizach  <cfleizach@apple.com>
3127
3128         AX: Implement updated CSS3 Speech for 'speak' and 'speak-as' properties
3129         https://bugs.webkit.org/show_bug.cgi?id=180361
3130
3131         Reviewed by Zalan Bujtas.
3132
3133         Change speak -> speakAs, and allow a combination of properties.
3134
3135         Tests: Updated accessibility/mac/css-speech-speak.html
3136
3137         * accessibility/AccessibilityObject.h:
3138         (WebCore::AccessibilityObject::speakAsProperty const):
3139         (WebCore::AccessibilityObject::speakProperty const): Deleted.
3140         * accessibility/AccessibilityRenderObject.cpp:
3141         (WebCore::AccessibilityRenderObject::speakAsProperty const):
3142         (WebCore::AccessibilityRenderObject::speakProperty const): Deleted.
3143         * accessibility/AccessibilityRenderObject.h:
3144         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
3145         (-[WebAccessibilityObjectWrapper accessibilitySpeechHint]):
3146         * accessibility/mac/WebAccessibilityObjectWrapperBase.h:
3147         * accessibility/mac/WebAccessibilityObjectWrapperBase.mm:
3148         (-[WebAccessibilityObjectWrapperBase baseAccessibilitySpeechHint]):
3149         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
3150         (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
3151         * css/CSSComputedStyleDeclaration.cpp:
3152         (WebCore::speakAsToCSSValue):
3153         (WebCore::ComputedStyleExtractor::propertyValue):
3154         * css/CSSPrimitiveValueMappings.h:
3155         (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
3156         (WebCore::CSSPrimitiveValue::operator ESpeakAs const):
3157         (WebCore::CSSPrimitiveValue::operator ESpeak const): Deleted.
3158         * css/CSSProperties.json:
3159         * css/StyleBuilderConverter.h:
3160         (WebCore::StyleBuilderConverter::convertSpeakAs):
3161         * css/parser/CSSParserFastPaths.cpp:
3162         (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
3163         (WebCore::CSSParserFastPaths::isKeywordPropertyID):
3164         * css/parser/CSSPropertyParser.cpp:
3165         (WebCore::consumeSpeakAs):
3166         (WebCore::CSSPropertyParser::parseSingleValue):
3167         * rendering/style/RenderStyle.h:
3168         (WebCore::RenderStyle::speakAs const):
3169         (WebCore::RenderStyle::setSpeakAs):
3170         (WebCore::RenderStyle::initialSpeakAs):
3171         (WebCore::RenderStyle::speak const): Deleted.
3172         (WebCore::RenderStyle::setSpeak): Deleted.
3173         (WebCore::RenderStyle::initialSpeak): Deleted.
3174         * rendering/style/RenderStyleConstants.h:
3175         (WebCore::operator| ):
3176         (WebCore::operator|= ):
3177         * rendering/style/StyleRareInheritedData.cpp:
3178         (WebCore::StyleRareInheritedData::StyleRareInheritedData):
3179         (WebCore::StyleRareInheritedData::operator== const):
3180         * rendering/style/StyleRareInheritedData.h:
3181
3182 2018-01-04  Brian Burg  <bburg@apple.com>
3183
3184         Web Inspector: Capture Element Screenshot looks fuzzy
3185         https://bugs.webkit.org/show_bug.cgi?id=175734
3186         <rdar://problem/33803377>
3187
3188         Reviewed by Joseph Pecoraro and Simon Fraser.
3189
3190         Screenshots taken by Web Inspector were being downscaled from the
3191         internal size to the logical size, causing them to be blurry when
3192         later upscaled to the internal size.
3193
3194         Replace ScaleBehavior { Scaled, Unscaled } with PreserveResolution { No, Yes }.
3195         This is a lot less confusing to read both inside ImageBuffer and at its use sites.
3196
3197         Remove unused CoordinateSystem argument for ImageBuffer::toDataURL,
3198         and replace it with PreserveResolution. Plumb PreserveResolution into toCFData
3199         so that PreserveResolution::Yes will preserve the internal size of
3200         the image buffer, just as it does in other methods that take PreserveResolution.
3201
3202         At the use site in InspectorPageAgent, always request PreserveResolution::Yes snapshots
3203         when taking an element screenshot. For now, keep using downscaled (smaller)
3204         snapshots when capturing canvas previews, as the previews are not full-size.
3205
3206         Test: inspector/page/hidpi-snapshot-size.html
3207
3208         * html/HTMLCanvasElement.cpp:
3209         (WebCore::HTMLCanvasElement::makePresentationCopy):
3210         (WebCore::HTMLCanvasElement::copiedImage const):
3211         * html/canvas/CanvasRenderingContext2DBase.cpp:
3212         (WebCore::CanvasRenderingContext2DBase::createPattern):
3213         * inspector/agents/InspectorPageAgent.cpp:
3214         (WebCore::InspectorPageAgent::snapshotNode):
3215         (WebCore::InspectorPageAgent::snapshotRect):
3216         * page/TextIndicator.cpp:
3217         (WebCore::takeSnapshot):
3218         * platform/DragImage.cpp:
3219         (WebCore::createDragImageFromSnapshot):
3220         * platform/graphics/BitmapImage.cpp:
3221         (WebCore::BitmapImage::drawPattern):
3222         * platform/graphics/ImageBuffer.h:
3223         * platform/graphics/cairo/ImageBufferCairo.cpp:
3224         (WebCore::ImageBuffer::sinkIntoImage):
3225         (WebCore::ImageBuffer::copyImage const):
3226         (WebCore::ImageBuffer::toDataURL const):
3227         * platform/graphics/cg/ImageBufferCG.cpp:
3228         (WebCore::createBitmapImageAfterScalingIfNeeded):
3229         (WebCore::ImageBuffer::copyImage const):
3230         (WebCore::ImageBuffer::sinkIntoImage):
3231         (WebCore::ImageBuffer::toDataURL const):
3232         (WebCore::ImageBuffer::toData const):
3233         (WebCore::ImageBuffer::toCFData const):
3234         * platform/graphics/gtk/ImageBufferGtk.cpp:
3235         (WebCore::ImageBuffer::toDataURL const):
3236         * platform/graphics/win/ImageBufferDirect2D.cpp:
3237         (WebCore::ImageBuffer::copyImage const):
3238         (WebCore::ImageBuffer::sinkIntoImage):
3239         (WebCore::ImageBuffer::toDataURL const):
3240         * svg/graphics/SVGImage.cpp:
3241         (WebCore::SVGImage::drawPatternForContainer):
3242
3243 2018-01-04  John Wilander  <wilander@apple.com>
3244
3245         Storage Access API: Turn feature on by default in Settings.yaml
3246         https://bugs.webkit.org/show_bug.cgi?id=181298
3247         <rdar://problem/36302506>
3248
3249         Reviewed by Brent Fulgham.
3250
3251         No new tests. This is just a feature settings change.
3252
3253         * page/Settings.yaml:
3254
3255 2018-01-04  Zalan Bujtas  <zalan@apple.com>
3256
3257         WebContent process crashes while loading https://www.classicspecs.com
3258         https://bugs.webkit.org/show_bug.cgi?id=181290
3259         <rdar://problem/36225906>
3260
3261         Reviewed by Simon Fraser.
3262
3263         Floats can overhang multiple blocks (they are called intruding floats).
3264         Each block keeps track of such intruding floats. When an overhanging float box is destroyed,
3265         we need to deregister it from all those blocks. We do it by walking up the ancestor block chain
3266         and check if the parent (grandparent etc) block still contains this float. Once we find the topmost block, 
3267         we start deregistering it by traversing back on the descendant blocks.
3268         Normally we do it in RenderElement::takeChildInternal right before the box is getting detached.
3269         However in certain cases (like when the float's parent happens to be an anonymous wrapper)
3270         by the time we get to ::takeChildInternal the subtree is already detached and we can't access all the
3271         ancestors.
3272         This patch ensure that the floating box is still attached during de-registration. 
3273
3274         Test: fast/block/float/crash-when-intruding-float-has-anonymous-parent-and-detach.html
3275
3276         * rendering/RenderObject.cpp:
3277         (WebCore::RenderObject::removeFromParentAndDestroyCleaningUpAnonymousWrappers):
3278
3279 2018-01-04  Eric Carlson  <eric.carlson@apple.com>
3280
3281         [MediaStream] Add Mock screen capture source
3282         https://bugs.webkit.org/show_bug.cgi?id=181291
3283         <rdar://problem/36298164>
3284
3285         Reviewed by Dean Jackson.
3286
3287         Tests:  http/tests/media/media-stream/get-display-media-prompt.html
3288                 GetDisplayMediaTest.BasicPrompt
3289                 GetDisplayMediaTest.Constraints
3290
3291         * Modules/mediastream/MediaDevices.cpp:
3292         (WebCore::MediaDevices::MediaDevices): Add static_assert to ensure MediaDevices::DisplayCaptureSurfaceType
3293         and RealtimeMediaSourceSettings::DisplaySurfaceType values are equivalent.
3294         (WebCore::MediaDevices::getSupportedConstraints): Remove bogus code.
3295         * Modules/mediastream/MediaDevices.h: Add DisplayCaptureSurfaceType.
3296         * Modules/mediastream/MediaDevices.idl: Ditto.
3297
3298         * Modules/mediastream/MediaStreamTrack.cpp:
3299         (WebCore::MediaStreamTrack::getSettings const): Add a FIXME.
3300         * Modules/mediastream/MediaStreamTrack.h: Add displaySurface and logicalSurface.
3301
3302         * Modules/mediastream/MediaTrackSupportedConstraints.h: Remove displaySurface and logicalSurface.
3303         * Modules/mediastream/MediaTrackSupportedConstraints.idl:
3304
3305         * SourcesCocoa.txt: Add DisplayCaptureManagerCocoa.cpp and DisplayCaptureSourceCocoa.cpp.
3306
3307         * WebCore.xcodeproj/project.pbxproj: Ditto.
3308
3309         * platform/mediastream/CaptureDevice.h:
3310         (WebCore::CaptureDevice::encode const): Add.
3311         (WebCore::CaptureDevice::decode):
3312
3313         * platform/mediastream/RealtimeMediaSourceCenter.cpp:
3314         (WebCore::RealtimeMediaSourceCenter::getMediaStreamDevices): Include display capture "devices".
3315         (WebCore::RealtimeMediaSourceCenter::validateRequestConstraints): Deal with display capture devices.
3316         (WebCore::RealtimeMediaSourceCenter::captureDeviceWithPersistentID): Ditto.
3317         * platform/mediastream/RealtimeMediaSourceCenter.h:
3318
3319         * platform/mediastream/RealtimeMediaSourceSettings.h:
3320         (WebCore::RealtimeMediaSourceSettings::displaySurface const): Return a DisplaySurfaceType.
3321         (WebCore::RealtimeMediaSourceSettings::setDisplaySurface): Take a DisplaySurfaceType.
3322
3323         * platform/mediastream/mac/DisplayCaptureManagerCocoa.cpp:
3324         (WebCore::DisplayCaptureManagerCocoa::singleton):
3325         (WebCore::DisplayCaptureManagerCocoa::~DisplayCaptureManagerCocoa):
3326         (WebCore::DisplayCaptureManagerCocoa::captureDevices):
3327         (WebCore::DisplayCaptureManagerCocoa::screenCaptureDeviceWithPersistentID):
3328         (WebCore::DisplayCaptureManagerCocoa::captureDeviceWithPersistentID):
3329         * platform/mediastream/mac/DisplayCaptureManagerCocoa.h:
3330
3331         * platform/mediastream/mac/DisplayCaptureSourceCocoa.cpp: Added.
3332         (WebCore::DisplayCaptureSourceCocoa::DisplayCaptureSourceCocoa):
3333         (WebCore::DisplayCaptureSourceCocoa::~DisplayCaptureSourceCocoa):
3334         (WebCore::DisplayCaptureSourceCocoa::capabilities const):
3335         (WebCore::DisplayCaptureSourceCocoa::settings const):
3336         (WebCore::DisplayCaptureSourceCocoa::settingsDidChange):
3337         (WebCore::DisplayCaptureSourceCocoa::startProducingData):
3338         (WebCore::DisplayCaptureSourceCocoa::stopProducingData):
3339         (WebCore::DisplayCaptureSourceCocoa::elapsedTime):
3340         (WebCore::DisplayCaptureSourceCocoa::applyFrameRate):
3341         (WebCore::DisplayCaptureSourceCocoa::emitFrame):
3342         * platform/mediastream/mac/DisplayCaptureSourceCocoa.h:
3343
3344         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp:
3345         (WebCore::RealtimeMediaSourceCenterMac::displayCaptureDeviceManager): New.
3346         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.h:
3347
3348         * platform/mock/MockRealtimeMediaSource.cpp:
3349         (WebCore::deviceMap): Add screen capture "devices".
3350         (WebCore::MockRealtimeMediaSource::displayDevices): New.
3351         * platform/mock/MockRealtimeMediaSource.h:
3352
3353         * platform/mock/MockRealtimeMediaSourceCenter.cpp: Clean up includes.
3354         * platform/mock/MockRealtimeMediaSourceCenter.h:
3355
3356         * platform/mock/MockRealtimeVideoSource.cpp:
3357         (WebCore::MockRealtimeVideoSource::MockRealtimeVideoSource): Mock two screen devices.
3358         (WebCore::MockRealtimeVideoSource::updateSettings): Deal with mock screens.
3359         (WebCore::MockRealtimeVideoSource::initializeCapabilities): Ditto.
3360         (WebCore::MockRealtimeVideoSource::initializeSupportedConstraints): Ditto.
3361         (WebCore::MockRealtimeVideoSource::drawText): Ditto.
3362         (WebCore::MockRealtimeVideoSource::generateFrame): Ditto.
3363         * platform/mock/MockRealtimeVideoSource.h:
3364         (WebCore::MockRealtimeVideoSource::mockCamera const):
3365         (WebCore::MockRealtimeVideoSource::mockScreen const):
3366
3367 2018-01-04  Youenn Fablet  <youenn@apple.com>
3368
3369         FetchResponse should set its internal response text encoding name
3370         https://bugs.webkit.org/show_bug.cgi?id=181284
3371
3372         Reviewed by Alex Christensen.
3373
3374         Covered by rebased test.
3375
3376         * Modules/fetch/FetchResponse.cpp:
3377         (WebCore::FetchResponse::create): Set response text encoding based on content type charset.
3378
3379 2018-01-04  John Wilander  <wilander@apple.com>
3380
3381         Storage Access API: Remove JavaScript confirm() prompt from Document::requestStorageAccess()
3382         https://bugs.webkit.org/show_bug.cgi?id=181276
3383         <rdar://problem/36290463>
3384
3385         Reviewed by Alex Christensen.
3386
3387         No new tests. Existing test expectations updated.
3388
3389         * dom/Document.cpp:
3390         (WebCore::Document::requestStorageAccess):
3391
3392 2018-01-04  Carlos Garcia Campos  <cgarcia@igalia.com>
3393
3394         [GTK] Issues with Ahem's ex / x-height
3395         https://bugs.webkit.org/show_bug.cgi?id=180581
3396
3397         Reviewed by Michael Catanzaro.
3398
3399         Get the x-height value from the TT_OS2 table if available.
3400
3401         Fixes: fast/text/break-word-pre-wrap.html
3402                imported/w3c/web-platform-tests/css/css-shapes-1/shape-outside/values/shape-outside-shape-arguments-000.html
3403
3404         * platform/graphics/freetype/SimpleFontDataFreeType.cpp:
3405         (WebCore::Font::platformInit):
3406
3407 2018-01-04  Philippe Normand  <pnormand@igalia.com>
3408
3409         Unreviewed, GTK build fix attempt after r226357
3410
3411         * platform/graphics/gstreamer/GStreamerUtilities.h: The
3412         GST_BUFFER_DTS_OR_PTS macro was added in GStreamer 1.8 but old
3413         versions of Debian might not have this release yet.
3414
3415 2018-01-04  Youenn Fablet  <youenn@apple.com>
3416