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