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