967cdf96feb27964fe0256e92a20b882812c747a
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2018-08-30  Ross Kirsling  <ross.kirsling@sony.com>
2
3         Speculative build fix for WPE after r235531.
4
5         * platform/graphics/filters/PointLightSource.cpp:
6         Add missing include.
7
8 2018-08-30  Ryosuke Niwa  <rniwa@webkit.org>
9
10         Add assignedElements to HTMLSlotElement
11         https://bugs.webkit.org/show_bug.cgi?id=189146
12
13         Reviewed by Darin Adler.
14
15         Added assignedElements to HTMLSlotElement. For now, we simply filter the results returned by assignedNodes.
16
17         Also fixed a bug that assignedNodes was returning the fallback content when the slot is not in a shadow tree,
18         which is specified in step 2 of the concept to find flattened slotables for a slot.
19
20         Spec: https://html.spec.whatwg.org/multipage/scripting.html#dom-slot-assignedelements
21               https://dom.spec.whatwg.org/#find-flattened-slotables
22
23         Tests: imported/w3c/web-platform-tests/shadow-dom/slots.html
24                imported/w3c/web-platform-tests/shadow-dom/slots-fallback.html
25
26         * html/HTMLSlotElement.cpp:
27         (WebCore::flattenAssignedNodes): Updated to take Vector<Ref<Node>> for consistency.
28         (WebCore::HTMLSlotElement::assignedNodes const): Ditto.
29         (WebCore::HTMLSlotElement::assignedElements const):
30         * html/HTMLSlotElement.h:
31         * html/HTMLSlotElement.idl:
32
33 2018-08-30  Don Olmstead  <don.olmstead@sony.com>
34
35         [CMake] Replace AVFoundationSupport.py using CMake
36         https://bugs.webkit.org/show_bug.cgi?id=182891
37
38         Reviewed by Per Arne Vollan.
39
40         No new tests. No change in behavior.
41
42         Remove refernces to PAL derived sources.
43
44         * PlatformWin.cmake:
45         * config.h:
46
47 2018-08-30  Olivia Barnett  <obarnett@apple.com>
48
49         REGRESSION(r235489): fast/dom/navigator-detached-no-crash.html crashes under Navigator::share
50         https://bugs.webkit.org/show_bug.cgi?id=189170
51
52         Reviewed by Tim Horton.
53
54         No new tests; fixing a failing existing test.
55
56         * page/Navigator.cpp:
57         (WebCore::Navigator::share):
58         Added null check for frame.
59
60 2018-08-30  Truitt Savell  <tsavell@apple.com>
61
62         Unreviewed, rolling out r235516.
63
64         Caused 50 Crashes on Sierra
65
66         Reverted changeset:
67
68         "The width of a nullptr TextRun should be zero"
69         https://bugs.webkit.org/show_bug.cgi?id=189154
70         https://trac.webkit.org/changeset/235516
71
72 2018-08-30  Tim Horton  <timothy_horton@apple.com>
73
74         Bundle unified sources more tightly in projects with deep directory structures
75         https://bugs.webkit.org/show_bug.cgi?id=189009
76
77         Reviewed by Simon Fraser.
78
79         Fix a variety of unification errors due to reshuffling the bundles.
80
81         * Modules/mediastream/RTCController.cpp:
82         * SourcesCocoa.txt:
83         * WebCore.xcodeproj/project.pbxproj:
84         * crypto/algorithms/CryptoAlgorithmECDSA.cpp:
85         (WebCore::CryptoAlgorithmECDSA::importKey):
86         * dom/Document.h:
87         * html/parser/HTMLTreeBuilder.cpp:
88         * loader/appcache/ApplicationCacheResourceLoader.h:
89         * page/AlternativeTextClient.h:
90         * platform/Pasteboard.h:
91         * platform/graphics/DisplayRefreshMonitor.cpp:
92         * platform/graphics/FontFamilySpecificationNull.cpp:
93         * platform/graphics/cocoa/WebGLLayer.mm:
94         (-[WebGLLayer initWithGraphicsContext3D:]):
95         (-[WebGLLayer copyImageSnapshotWithColorSpace:]):
96         (-[WebGLLayer display]):
97         (-[WebGLLayer allocateIOSurfaceBackingStoreWithSize:usingAlpha:]):
98         * platform/graphics/cocoa/WebGPULayer.mm:
99         (-[WebGPULayer initWithGPUDevice:]):
100         * platform/graphics/metal/GPUCommandQueueMetal.mm:
101         * platform/mac/PasteboardMac.mm:
102         * platform/mediastream/mac/DisplayCaptureManagerCocoa.cpp:
103         * platform/network/ResourceRequestBase.cpp:
104         * rendering/updating/RenderTreeBuilderBlockFlow.cpp:
105         * rendering/updating/RenderTreeBuilderInline.cpp:
106
107 2018-08-30  Andy Estes  <aestes@apple.com>
108
109         [Payment Request] Implement the PaymentMethodChangeEvent and PaymentMethodChangeEventInit interfaces
110         https://bugs.webkit.org/show_bug.cgi?id=189100
111
112         Reviewed by Daniel Bates.
113
114         Implement the PaymentMethodChangeEvent interface and PaymentMethodChangeEventInit dictionary
115         defined in the Payment Request API W3C Editor's Draft of 30 August 2018.
116
117         <https://w3c.github.io/payment-request/#paymentmethodchangeevent-interface>
118
119         The "payment method changed" algorithm will be implemented in a follow-up.
120
121         Covered by existing web platform tests.
122
123         * CMakeLists.txt:
124         * DerivedSources.make:
125         * Modules/paymentrequest/PaymentMethodChangeEvent.cpp: Added.
126         (WebCore::PaymentMethodChangeEvent::eventInterface const):
127         (WebCore::PaymentMethodChangeEvent::PaymentMethodChangeEvent):
128         * Modules/paymentrequest/PaymentMethodChangeEvent.h: Added.
129         * Modules/paymentrequest/PaymentMethodChangeEvent.idl: Added.
130         * Modules/paymentrequest/PaymentMethodChangeEventInit.h: Added.
131         * Modules/paymentrequest/PaymentMethodChangeEventInit.idl: Added.
132         * Modules/paymentrequest/PaymentRequest.idl:
133         * Modules/paymentrequest/PaymentRequestUpdateEvent.cpp:
134         (WebCore::PaymentRequestUpdateEvent::PaymentRequestUpdateEvent):
135         * Modules/paymentrequest/PaymentRequestUpdateEvent.h:
136         * Modules/paymentrequest/PaymentRequestUpdateEventInit.h:
137         * Sources.txt:
138         * WebCore.xcodeproj/project.pbxproj:
139         * bindings/js/WebCoreBuiltinNames.h:
140         * dom/EventNames.h:
141         * dom/EventNames.in:
142
143 2018-08-30  Brent Fulgham  <bfulgham@apple.com>
144
145         The width of a nullptr TextRun should be zero
146         https://bugs.webkit.org/show_bug.cgi?id=189154
147         <rdar://problem/43685926>
148
149         Reviewed by Zalan Bujtas.
150
151         If a page has an empty TextRun and attempts to paint it we can crash with a nullptr.
152
153         This patch recognizes that an empty TextRun should always produce a zero width, rather than
154         attempt to compute this value from font data.
155
156         Test: fast/text/null-string-textrun.html
157
158         * platform/graphics/FontCascade.cpp:
159         (WebCore::FontCascade::widthOfTextRange const): An empty TextRun has zero width.
160         (WebCore::FontCascade::width const): Ditto.
161         (WebCore::FontCascade::codePath const): ASSERT that the TextRun is non-empty.
162
163 2018-08-30  Eric Carlson  <eric.carlson@apple.com>
164
165         Mock video devices should only support discrete sizes
166         https://bugs.webkit.org/show_bug.cgi?id=189000
167         <rdar://problem/43766551>
168
169         Reviewed by Youenn Fablet.
170         
171         While many/most video capture devices only support a finite number of discrete width/height
172         pairs, our mock video capture devices supported arbitrary width and height combinations which
173         made it difficult to write realistic tests using them. Change the mock devices to support
174         finite "presets" like those supported by AVFoundation. Create a RealtimeVideoSource base
175         class with support for these presets, so the same code will eventually be used by the mock
176         and real capture devices.
177
178         No new tests, existing tests updated for these changes.
179
180         * Sources.txt: Add RealtimeVideoSource.cpp, remove MockRealtimeMediaSource.cpp.
181
182         * WebCore.xcodeproj/project.pbxproj: Ditto.
183
184         * platform/mediastream/MediaConstraints.h: Deal with min constraint less than the supported minimum
185         and max larger than the supported maximum when there is no ideal.
186
187         * platform/mediastream/RealtimeMediaSource.cpp:
188         (WebCore::RealtimeMediaSource::selectSettings): Use supportsSizeAndFrameRate for widths,
189         heights, and framerates in advanced constraints so a width and height that are supported but
190         in the same preset are filtered out.
191         (WebCore::RealtimeMediaSource::setSize): New.
192         * platform/mediastream/RealtimeMediaSource.h:
193
194         * platform/mediastream/RealtimeMediaSourceSettings.h: Remove an unneeded include.
195
196         * platform/mediastream/RealtimeVideoSource.cpp: Added.
197         (WebCore::RealtimeVideoSource::RealtimeVideoSource):
198         (WebCore::RealtimeVideoSource::~RealtimeVideoSource):
199         (WebCore::RealtimeVideoSource::startProducingData):
200         (WebCore::RealtimeVideoSource::setSupportedFrameRates):
201         (WebCore::RealtimeVideoSource::addSupportedCapabilities const):
202         (WebCore::RealtimeVideoSource::supportsSizeAndFrameRate):
203         (WebCore::RealtimeVideoSource::bestSupportedCaptureSizeForWidthAndHeight):
204         (WebCore::RealtimeVideoSource::applySize):
205         (WebCore::RealtimeVideoSource::applySizeAndFrameRate):
206         (WebCore::RealtimeVideoSource::videoSampleAvailable):
207         (WebCore::RealtimeVideoSource::applyFrameRate):
208         (WebCore::RealtimeVideoSource::supportsFrameRate):
209
210         * platform/mediastream/RealtimeVideoSource.h: Copied from Source/WebCore/platform/mock/MockRealtimeAudioSource.h.
211         (WebCore::RealtimeVideoSource::setSupportedCaptureSizes):
212         (WebCore::RealtimeVideoSource::setDefaultSize):
213         (WebCore::RealtimeVideoSource::observedFrameRate const):
214
215         * platform/mediastream/mac/AVMediaCaptureSource.mm:
216         (WebCore::AVMediaCaptureSource::initializeSettings): Don't set label, it isn't used.
217
218         * platform/mediastream/mac/MockRealtimeVideoSourceMac.mm:
219         (WebCore::MockRealtimeVideoSourceMac::applySize): Call the base class.
220
221         * platform/mock/MockMediaDevice.h:
222         (WebCore::MockCameraProperties::encode const): Add frame rates, sizes, and facing mode.
223         (WebCore::MockCameraProperties::decode): Ditto.
224
225         * platform/mock/MockRealtimeAudioSource.cpp:
226         (WebCore::MockRealtimeAudioSource::MockRealtimeAudioSource): No more MockRealtimeMediaSource.
227         (WebCore::MockRealtimeAudioSource::settings const): Clean up.
228         (WebCore::MockRealtimeAudioSource::capabilities const): Ditto.
229         (WebCore::MockRealtimeAudioSource::settingsDidChange): Ditto.
230         (WebCore::MockRealtimeAudioSource::stopProducingData): m_elapsedTime isn't used, delete it.
231         (WebCore::MockRealtimeAudioSource::updateSettings): Deleted.
232         (WebCore::MockRealtimeAudioSource::initializeCapabilities): Deleted.
233         (WebCore::MockRealtimeAudioSource::initializeSupportedConstraints): Deleted.
234         (WebCore::MockRealtimeAudioSource::elapsedTime): Deleted.
235         * platform/mock/MockRealtimeAudioSource.h:
236
237         * platform/mock/MockRealtimeMediaSourceCenter.cpp: Moved all of the mock device management
238         code from MockRealtimeMediaSource.cpp here.
239         (WebCore::defaultDevices):
240         (WebCore::devices):
241         (WebCore::deviceMap):
242         (WebCore::deviceListForDevice):
243         (WebCore::createCaptureDevice):
244         (WebCore::MockRealtimeMediaSourceCenter::resetDevices):
245         (WebCore::MockRealtimeMediaSourceCenter::setDevices):
246         (WebCore::MockRealtimeMediaSourceCenter::addDevice):
247         (WebCore::MockRealtimeMediaSourceCenter::removeDevice):
248         (WebCore::MockRealtimeMediaSourceCenter::mockDeviceWithPersistentID):
249         (WebCore::MockRealtimeMediaSourceCenter::captureDeviceWithPersistentID):
250         (WebCore::MockRealtimeMediaSourceCenter::audioDevices):
251         (WebCore::MockRealtimeMediaSourceCenter::videoDevices):
252         (WebCore::MockRealtimeMediaSourceCenter::displayDevices):
253
254         * platform/mock/MockRealtimeVideoSource.cpp:
255         (WebCore::MockRealtimeVideoSource::MockRealtimeVideoSource): Use RealtimeVideoSource, no
256         more MockRealtimeMediaSource.
257         (WebCore::MockRealtimeVideoSource::capabilities const): Ditto, cleanup.
258         (WebCore::MockRealtimeVideoSource::settings const): Ditto.
259         (WebCore::MockRealtimeVideoSource::settingsDidChange): Ditto.
260         (WebCore::MockRealtimeVideoSource::startCaptureTimer): Ditto.
261         (WebCore::MockRealtimeVideoSource::startProducingData): Ditto.
262         (WebCore::MockRealtimeVideoSource::stopProducingData): Ditto.
263         (WebCore::MockRealtimeVideoSource::elapsedTime): Ditto.
264         (WebCore::MockRealtimeVideoSource::applySize): Ditto.
265         (WebCore::MockRealtimeVideoSource::drawText): Render the actual frame rate.
266         (WebCore::MockRealtimeVideoSource::generateFrame): Use m_fillColor.
267         (WebCore::MockRealtimeVideoSource::~MockRealtimeVideoSource): Deleted.
268         (WebCore::MockRealtimeVideoSource::updateSettings): Deleted.
269         (WebCore::MockRealtimeVideoSource::initializeCapabilities): Deleted.
270         (WebCore::MockRealtimeVideoSource::initializeSupportedConstraints): Deleted.
271         (WebCore::MockRealtimeVideoSource::applyFrameRate): Deleted.
272         * platform/mock/MockRealtimeVideoSource.h:
273         (WebCore::MockRealtimeVideoSource::updateSampleBuffer): Deleted.
274
275 2018-08-30  Zalan Bujtas  <zalan@apple.com>
276
277         [LFC][Floating] Block formatting context roots avoid floats.
278         https://bugs.webkit.org/show_bug.cgi?id=189150
279
280         Reviewed by Antti Koivisto.
281
282         This patch implements the float avoiding behaviour for block formatting context roots.
283
284         When a box establishes a block formatting context, floats from outside of the context can't interfere with content inside. In order
285         to achive this, such formatting root boxes need to be positioned so that they don't overlap with floats (floats that share the same
286         context with the formatting root). In ltr block direction, roots start with avoiding floats on the left, while in rtl on the right.
287
288         Tests: fast/block/block-only/float-avoider-multiple-roots.html
289                fast/block/block-only/float-avoider-simple-left.html
290                fast/block/block-only/float-avoider-simple-right.html
291                fast/block/block-only/float-avoider-with-margins.html
292
293         * layout/blockformatting/BlockFormattingContext.cpp:
294         (WebCore::Layout::BlockFormattingContext::layoutFormattingContextRoot const):
295         (WebCore::Layout::BlockFormattingContext::computeEstimatedMarginTopForAncestors const):
296         (WebCore::Layout::BlockFormattingContext::computePositionToAvoidFloats const):
297         * layout/blockformatting/BlockFormattingContext.h:
298         * layout/floats/FloatAvoider.cpp:
299         (WebCore::Layout::FloatAvoider::FloatAvoider):
300         * layout/floats/FloatingContext.cpp:
301         (WebCore::Layout::FloatingContext::positionForFloatAvoiding const):
302         * layout/floats/FloatingContext.h:
303
304 2018-08-30  Zalan Bujtas  <zalan@apple.com>
305
306         [LFC][Floating] Move containing block constraint logic from FloatAvoider to FloatingContext
307         https://bugs.webkit.org/show_bug.cgi?id=189145
308
309         Reviewed by Antti Koivisto.
310
311         When the float avoider is constrained horizontally, simply align it with the left/right edge of its containing block (with the combination of the constraints)
312         and check the overflow as part of the FloatingContext::floatingPosition() logic. It simplifies the constraint logic/helps implementing the non-float avoider
313         case.
314
315         * layout/floats/FloatAvoider.cpp:
316         (WebCore::Layout::FloatAvoider::setHorizontalConstraints):
317         (WebCore::Layout::FloatAvoider::overflowsContainingBlock const):
318         * layout/floats/FloatAvoider.h:
319         * layout/floats/FloatingContext.cpp:
320         (WebCore::Layout::FloatingContext::floatingPosition const):
321
322 2018-08-30  Zalan Bujtas  <zalan@apple.com>
323
324         [LFC][Floating] Use non-computed horizontal margins when intersecting floats with float avoiders.
325         https://bugs.webkit.org/show_bug.cgi?id=189143
326
327         Reviewed by Antti Koivisto.
328
329         * layout/Verification.cpp:
330         (WebCore::Layout::LayoutContext::verifyAndOutputMismatchingLayoutTree const):
331         * layout/floats/FloatAvoider.cpp:
332         (WebCore::Layout::FloatAvoider::setHorizontalConstraints):
333         (WebCore::Layout::FloatAvoider::initialHorizontalPosition const):
334         * layout/floats/FloatAvoider.h:
335         (WebCore::Layout::FloatAvoider::marginTop const):
336         (WebCore::Layout::FloatAvoider::marginBottom const):
337         (WebCore::Layout::FloatAvoider::marginLeft const):
338         (WebCore::Layout::FloatAvoider::marginRight const):
339         (WebCore::Layout::FloatAvoider::marginBoxWidth const):
340         * layout/floats/FloatBox.cpp:
341         (WebCore::Layout::FloatBox::rect const):
342         (WebCore::Layout::FloatBox::horizontalPositionCandidate):
343         (WebCore::Layout::FloatBox::verticalPositionCandidate):
344         (WebCore::Layout::FloatBox::initialVerticalPosition const):
345         * layout/floats/FloatBox.h:
346
347 2018-08-30  Zalan Bujtas  <zalan@apple.com>
348
349         [LFC][Margins] Add non-computed horizontal margins to DisplayBox
350         https://bugs.webkit.org/show_bug.cgi?id=189141
351
352         Reviewed by Antti Koivisto.
353
354         Inflow block boxes' horizontal margins extend all the way to the left/right edge of their containing block.
355         See https://www.w3.org/TR/CSS22/visudet.html#blockwidth for example
356         "...
357         10.3.3 Block-level, non-replaced elements in normal flow
358         'margin-left' + 'border-left-width' + 'padding-left' + 'width' + 'padding-right' + 'border-right-width' + 'margin-right' = width of containing block
359         ..."
360
361         In certain cases (float avoiding) we need to know the original (non-extended) horiztonal margin values.
362
363         * layout/FormattingContext.cpp:
364         (WebCore::Layout::FormattingContext::computeFloatingWidthAndMargin const):
365         (WebCore::Layout::FormattingContext::computeOutOfFlowHorizontalGeometry const):
366         * layout/FormattingContextGeometry.cpp:
367         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGeometry):
368         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedHorizontalGeometry):
369         (WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedWidthAndMargin):
370         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedWidthAndMargin):
371         * layout/LayoutContext.cpp:
372         (WebCore::Layout::LayoutContext::initializeRoot):
373         * layout/LayoutUnits.h:
374         * layout/blockformatting/BlockFormattingContext.cpp:
375         (WebCore::Layout::BlockFormattingContext::computeInFlowWidthAndMargin const):
376         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
377         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin):
378         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowReplacedWidthAndMargin):
379         * layout/displaytree/DisplayBox.h:
380         (WebCore::Display::Box::setHasValidHorizontalNonComputedMargin):
381         (WebCore::Display::Box::setHorizontalNonComputedMargin):
382         (WebCore::Display::Box::nonComputedMarginLeft const):
383         (WebCore::Display::Box::nonComputedMarginRight const):
384
385 2018-08-30  Yusuke Suzuki  <yusukesuzuki@slowstart.org>
386
387         Unreviewed, add comments about enum names to bitfields
388         https://bugs.webkit.org/show_bug.cgi?id=188944
389
390         * xml/XMLHttpRequest.h:
391
392 2018-08-30  Yusuke Suzuki  <yusukesuzuki@slowstart.org>
393
394         Unreviewed, add comments about enum names to bitfields
395         https://bugs.webkit.org/show_bug.cgi?id=188945
396
397         * html/HTMLCollection.h:
398
399 2018-08-29  Andy Estes  <aestes@apple.com>
400
401         Addressed additional review feedback after r235342.
402
403         * Modules/applepay/ApplePayRequestBase.cpp:
404         (WebCore::convertAndValidate):
405
406         Used '"' instead of "\"" with makeString().
407
408 2018-08-29  Aditya Keerthi  <akeerthi@apple.com>
409
410         [Datalist] Display prefix-matched suggestions first
411         https://bugs.webkit.org/show_bug.cgi?id=189106
412
413         Reviewed by Tim Horton.
414
415         In order to increase suggestion relevancy, we should display suggestions that have
416         the same prefix as the input value first. In order to achieve this, we can place
417         the suggestions into two buckets, one that contains prefix-matched values and
418         another that contains only substring-matched values.
419
420         TextFieldInputType::suggestions() can be called up to three times before we
421         display the values. In order to avoid generating the same suggestions multiple
422         times, the most recent values can be stored and reused. We clear the cached values
423         whenever the datalist element is modified or when the suggestions view is hidden.
424
425         Finally, removed logic to de-duplicate the list of suggested values. This behavior
426         is not a part of the specification and leads to unnecessary slowdown when
427         populating the suggestions view.
428
429         Test: fast/forms/datalist/datalist-textinput-suggestions-order.html
430
431         * html/TextFieldInputType.cpp:
432         (WebCore::TextFieldInputType::listAttributeTargetChanged):
433         (WebCore::TextFieldInputType::suggestions):
434         (WebCore::TextFieldInputType::didCloseSuggestions):
435         * html/TextFieldInputType.h:
436         * platform/DataListSuggestionsClient.h:
437
438 2018-08-29  Olivia Barnett  <obarnett@apple.com>
439
440         Implement the Web Share API
441         https://bugs.webkit.org/show_bug.cgi?id=171100
442         <rdar://problem/31751734>
443
444         Reviewed by Tim Horton.
445
446         Added one test in fast/events/ios called share.html; adjusted expectations for existing tests.
447
448         * DerivedSources.make:
449         * Sources.txt:
450         * WebCore.xcodeproj/project.pbxproj:
451         * features.json:
452         * loader/EmptyClients.cpp:
453         (WebCore::EmptyChromeClient::showShareSheet):
454         * loader/EmptyClients.h:
455         Added empty showShareSheet function.
456
457         * page/Chrome.cpp:
458         (WebCore::Chrome::showShareSheet):
459         * page/Chrome.h:
460         Added call to showShareSheet on client.
461
462         * page/ChromeClient.h:
463         Virtual showShareSheet function.
464
465         * page/Navigator.cpp:
466         (WebCore::Navigator::share):
467         * page/Navigator.h:
468         Share function that returns a promise and invokes the share sheet.
469
470         * page/Navigator.idl:
471         Implements NavigatorShare
472
473         * page/NavigatorShare.idl: Added.
474         Added definition of share function returning a promise.
475
476         * page/RuntimeEnabledFeatures.h:
477         (WebCore::RuntimeEnabledFeatures::setWebShareEnabled):
478         (WebCore::RuntimeEnabledFeatures::webShareEnabled const):
479         Added RuntimeEnabledFeature switch.
480
481         * page/ShareData.h: Added.
482         * page/ShareData.idl: Added.
483         Definition of ShareData struct.
484
485 2018-08-29  Daniel Bates  <dabates@apple.com>
486
487         REGRESSION (r226138): WebCore::subdivide() may return an empty vector; Web process can crash when performing find in Epiphany
488         https://bugs.webkit.org/show_bug.cgi?id=184390
489         <rdar://problem/41804994>
490         And
491         <rdar://problem/39771867>
492
493         Reviewed by Simon Fraser.
494
495         Speculative fix for Epiphany.
496
497         In theory, WebCore::subdivide() should never return an empty vector - no subdivisions - as such a
498         result represents a programmer error. In practice, InlineTextBox can invoke WebCore::subdivide()
499         such that it returns an empty vector. One way this can happen is when subdividing an empty inline
500         text box associated with combined text (RenderCombineText). For now we add a check to bail out of
501         resolving the style of subdivisions when WebCore::subdivide() returns no subdivisions. In a
502         subsequent patch we will look to assert that WebCore::subdivide() always returns subdivisions.
503
504         Test: fast/text/text-combine-surroundContents-crash.html
505
506         * rendering/InlineTextBox.cpp:
507         (WebCore::InlineTextBox::subdivideAndResolveStyle):
508
509 2018-08-29  Youenn Fablet  <youenn@apple.com>
510
511         Remove WebRTC legacy API implementation
512         https://bugs.webkit.org/show_bug.cgi?id=189040
513
514         Reviewed by Eric Carlson.
515
516         This API is no longer needed as the runtime flag is off by default.
517         Removing this option allows removing some code and will ease future WebRTC improvements.
518         Covered by existing tests.
519
520         * CMakeLists.txt:
521         * DerivedSources.make:
522         * Modules/mediastream/MediaStreamEvent.cpp: Removed.
523         * Modules/mediastream/MediaStreamEvent.h: Removed.
524         * Modules/mediastream/MediaStreamEvent.idl: Removed.
525         * Modules/mediastream/NavigatorUserMedia.idl: Removed.
526         * Modules/mediastream/NavigatorUserMedia.js: Removed.
527         * Modules/mediastream/PeerConnectionBackend.cpp:
528         * Modules/mediastream/PeerConnectionBackend.h:
529         * Modules/mediastream/RTCPeerConnection.h:
530         * Modules/mediastream/RTCPeerConnection.idl:
531         * Modules/mediastream/RTCPeerConnection.js:
532         (initializeRTCPeerConnection):
533         (createOffer):
534         (createAnswer):
535         (setLocalDescription):
536         (setRemoteDescription):
537         (addIceCandidate):
538         (getLocalStreams): Deleted.
539         (getStreamById): Deleted.
540         (addStream): Deleted.
541         (): Deleted.
542         * Modules/mediastream/RTCPeerConnectionInternals.js:
543         (callbacksAndDictionaryOverload):
544         (if): Deleted.
545         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
546         (WebCore::LibWebRTCMediaEndpoint::mediaStreamFromRTCStream):
547         (WebCore::LibWebRTCMediaEndpoint::addRemoteStream):
548         (WebCore::LibWebRTCMediaEndpoint::removeRemoteStream):
549         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:
550         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
551         (WebCore::LibWebRTCPeerConnectionBackend::doStop):
552         (WebCore::LibWebRTCPeerConnectionBackend::removeRemoteStream): Deleted.
553         (WebCore::LibWebRTCPeerConnectionBackend::addRemoteStream): Deleted.
554         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h:
555         * Sources.txt:
556         * WebCore.xcodeproj/project.pbxproj:
557         * bindings/js/JSDOMGlobalObject.cpp:
558         (WebCore::JSDOMGlobalObject::addBuiltinGlobals):
559         (WebCore::isWebRTCLegacyAPIEnabled): Deleted.
560         * bindings/js/WebCoreBuiltinNames.h:
561         * dom/EventNames.in:
562         * page/RuntimeEnabledFeatures.h:
563         (WebCore::RuntimeEnabledFeatures::setPeerConnectionEnabled):
564         (WebCore::RuntimeEnabledFeatures::webRTCLegacyAPIEnabled const): Deleted.
565         (WebCore::RuntimeEnabledFeatures::setWebRTCLegacyAPIEnabled): Deleted.
566
567 2018-08-29  Ryosuke Niwa  <rniwa@webkit.org>
568
569         Modernize SlotAssignment
570         https://bugs.webkit.org/show_bug.cgi?id=189075
571
572         Reviewed by Antti Koivisto.
573
574         Modernized the code related to SlotAssignment. Namely, use HashMap<>::get instead of HashMap<>::find,
575         and use HashMap<>::ensure instead of HashMap<>::add. Also use WeakPtr to keep track of HTMLSlotElement
576         instead of a raw pointer.
577
578         * dom/SlotAssignment.cpp:
579         (WebCore::SlotAssignment::findAssignedSlot):
580         (WebCore::SlotAssignment::addSlotElementByName):
581         (WebCore::SlotAssignment::removeSlotElementByName):
582         (WebCore::SlotAssignment::didChangeSlot):
583         (WebCore::SlotAssignment::findFirstSlotElement):
584         (WebCore::SlotAssignment::resolveAllSlotElements):
585         (WebCore::SlotAssignment::assignToSlot):
586         * dom/SlotAssignment.h:
587         (WebCore::SlotAssignment::Slot::Slot): Renamed from SlotInfo since "Info" doesn't add any value.
588         * html/HTMLSlotElement.h:
589
590 2018-08-29  Chris Dumez  <cdumez@apple.com>
591
592         [PSON] We should only process-swap when eTLD+1 changes on navigation
593         https://bugs.webkit.org/show_bug.cgi?id=189090
594         <rdar://problem/43799225>
595
596         Reviewed by Geoffrey Garen.
597
598         Add toRegistrableDomain() utility function to get the eTLD+1 (aka "registrable
599         domain") from an URL.
600
601         * platform/network/ResourceRequestBase.h:
602         (WebCore::toRegistrableDomain):
603         (WebCore::registrableDomainsAreEqual):
604
605 2018-08-29  Youenn Fablet  <youenn@apple.com>
606
607         Add a runtime flag for WebRTC unified plan
608         https://bugs.webkit.org/show_bug.cgi?id=189068
609
610         Reviewed by Eric Carlson.
611
612         Covered by existing updated tests.
613         Main change is to call addTrack with a stream parameter so that on the other side, the track will be tied to a stream.
614         Receive-only case in unified plan is not yet supported.
615         This will be supported in follow-up patches.
616
617         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
618         (WebCore::LibWebRTCMediaEndpoint::setConfiguration): Activate unified plan based on runtime flag.
619         (WebCore::LibWebRTCMediaEndpoint::addTrack): Do not use AddStream in case of unified plan.
620         (WebCore::LibWebRTCMediaEndpoint::shouldOfferAllowToReceiveAudio const):
621         (WebCore::LibWebRTCMediaEndpoint::shouldOfferAllowToReceiveVideo const):
622         (WebCore::LibWebRTCMediaEndpoint::doCreateOffer): Use legacy webrtc option for receive only cases only in plan B case.
623         * page/RuntimeEnabledFeatures.h:
624         (WebCore::RuntimeEnabledFeatures::webRTCUnifiedPlanEnabled const):
625         (WebCore::RuntimeEnabledFeatures::setWebRTCUnifiedPlanEnabled):
626
627 2018-08-28  Simon Fraser  <simon.fraser@apple.com>
628
629         Fix crash when reflections and backdrop filter are combined
630         https://bugs.webkit.org/show_bug.cgi?id=188504
631         rdar://problem/43225590
632
633         Reviewed by Dan Bates.
634         
635         GraphicsLayerCA::updateBackdropFiltersRect() was confused about which hash map to modify
636         when changes to the clipping rect affect whether we make backdrop clipping layers;
637         we need to add/remove from backdropClippingLayerClones, not backdropLayerClones.
638
639         Test: compositing/filters/backdrop-filter-update-rect.html
640
641         * platform/graphics/ca/GraphicsLayerCA.cpp:
642         (WebCore::GraphicsLayerCA::updateBackdropFiltersRect):
643
644 2018-08-29  Jer Noble  <jer.noble@apple.com>
645
646         Muted elements do not have their Now Playing status updated when unmuted.
647         https://bugs.webkit.org/show_bug.cgi?id=189069
648
649         Reviewed by Eric Carlson.
650
651         Schedule an updateNowPlayingInfo() when an element becomes unmuted.
652
653         * platform/audio/PlatformMediaSessionManager.h:
654         * platform/audio/mac/MediaSessionManagerMac.h:
655         * platform/audio/mac/MediaSessionManagerMac.mm:
656         (WebCore::MediaSessionManagerMac::sessionCanProduceAudioChanged):
657
658 2018-08-29  Wenson Hsieh  <wenson_hsieh@apple.com>
659
660         Use the null string instead of std::nullopt for missing attachment file names and content types
661         https://bugs.webkit.org/show_bug.cgi?id=189080
662
663         Reviewed by Tim Horton.
664
665         Replace instances of std::optional<String> with just String instead, and use the null string to represent a
666         missing value instead of std::nullopt. No change in behavior.
667
668         * html/HTMLAttachmentElement.cpp:
669         (WebCore::HTMLAttachmentElement::updateAttributes):
670         * html/HTMLAttachmentElement.h:
671
672 2018-08-29  David Kilzer  <ddkilzer@apple.com>
673
674         Remove empty directories from from svn.webkit.org repository
675         <https://webkit.org/b/189081>
676
677         * Modules/proximity: Removed.
678
679 2018-08-28  Zalan Bujtas  <zalan@apple.com>
680
681         [LFC][Floating] Introduce FloatBox, a FloatAvoider subclass.
682         https://bugs.webkit.org/show_bug.cgi?id=189074
683
684         Reviewed by Antti Koivisto.
685
686         FloatBox is a float avoider and a float positioned box as well.
687         This is in preparation for the float avoidance feature where formatting context root boxes avoid existing floats.
688
689         * Sources.txt:
690         * WebCore.xcodeproj/project.pbxproj:
691         * layout/displaytree/DisplayBox.h:
692         * layout/floats/FloatAvoider.cpp:
693         (WebCore::Layout::FloatAvoider::FloatAvoider):
694         (WebCore::Layout::FloatAvoider::setHorizontalConstraints):
695         (WebCore::Layout::FloatAvoider::setVerticalConstraint):
696         (WebCore::Layout::FloatAvoider::horizontalPositionCandidate):
697         (WebCore::Layout::FloatAvoider::verticalPositionCandidate):
698         (WebCore::Layout::FloatAvoider::resetPosition):
699         (WebCore::Layout::FloatAvoider::rectInContainingBlock const):
700         (WebCore::Layout::FloatAvoider::initializePosition): Deleted.
701         (WebCore::Layout::FloatAvoider::isLeftAligned const): Deleted.
702         (WebCore::Layout::FloatAvoider::rect const): Deleted.
703         (WebCore::Layout::FloatAvoider::resetHorizontalConstraints): Deleted.
704         (WebCore::Layout::FloatAvoider::initialVerticalPosition const): Deleted.
705         * layout/floats/FloatAvoider.h:
706         (WebCore::Layout::FloatAvoider::rect const):
707         (WebCore::Layout::FloatAvoider::isLeftAligned const):
708         (WebCore::Layout::FloatAvoider::initialVerticalPosition const):
709         (WebCore::Layout::FloatAvoider::floatingState const):
710         (WebCore::Layout::FloatAvoider::layoutBox const):
711         (WebCore::Layout::FloatAvoider::displayBox const):
712         * layout/floats/FloatBox.cpp: Copied from Source/WebCore/layout/floats/FloatAvoider.h.
713         (WebCore::Layout::FloatBox::FloatBox):
714         (WebCore::Layout::FloatBox::horizontalPositionCandidate):
715         (WebCore::Layout::FloatBox::verticalPositionCandidate):
716         (WebCore::Layout::FloatBox::initialVerticalPosition const):
717         * layout/floats/FloatBox.h: Copied from Source/WebCore/layout/floats/FloatAvoider.h.
718         * layout/floats/FloatingContext.cpp:
719         (WebCore::Layout::FloatingContext::positionForFloat const):
720         (WebCore::Layout::FloatingContext::floatingPosition const):
721
722 2018-08-29  Ali Juma  <ajuma@chromium.org>
723
724         [IntersectionObserver]  Implement intersection logic for the same-document implicit root case
725         https://bugs.webkit.org/show_bug.cgi?id=189055
726
727         Reviewed by Simon Fraser.
728
729         Extend the intersection logic to handle computing the intersection of the target and the
730         viewport, for the case where the target is in the main frame.
731
732         Tested by existing tests in imported/w3c/web-platform-tests/intersection-observer.
733
734         * dom/Document.cpp:
735         (WebCore::computeIntersectionRects):
736         (WebCore::Document::updateIntersectionObservations):
737
738 2018-08-28  Ryosuke Niwa  <rniwa@webkit.org>
739
740         Changes to slot children should trigger slotchange
741         https://bugs.webkit.org/show_bug.cgi?id=169718
742         <rdar://problem/43317496>
743
744         Reviewed by Darin Adler.
745
746         Fix the bug that slotchange event is not fired when a slot's fallback content is updated now that slotchange event
747         is more formally specified.
748
749         This particular behavior corresponds to step 7.5. of the concept *to insert a node* where it says:
750         "[I]f parent’s root is a shadow root, and parent is a slot whose assigned nodes is the empty list, then run signal
751         a slot change for parent."
752
753         See https://dom.spec.whatwg.org/#concept-node-insert
754
755         Tests: fast/shadow-dom/slotchange-in-fallback.html
756                imported/w3c/web-platform-tests/shadow-dom/slotchange.html 
757
758         * dom/Element.cpp:
759         (WebCore::Element::childrenChanged): Updated the comment.
760         * dom/ShadowRoot.cpp:
761         (WebCore::ShadowRoot::addSlotElementByName): Added an assertion.
762         (WebCore::ShadowRoot::slotFallbackDidChange): Added.
763         * dom/ShadowRoot.h:
764         * dom/SlotAssignment.cpp:
765         (WebCore::SlotAssignment::slotFallbackDidChange): Added. When the assigned nodes is empty, we enqueue a slotchange.
766         Because assignedNodesForSlot invokes assignSlots, this can be O(n) but we don't expect mutating slot's fallback
767         contents and shadow host's children in turn to be a common scenario so this shouldn't be an issue in practice.
768         * dom/SlotAssignment.h:
769         * html/HTMLSlotElement.cpp:
770         (WebCore::HTMLSlotElement::insertedIntoAncestor): Be explicit about auto* being used here.
771         (WebCore::HTMLSlotElement::childrenChanged): Added. Invokes slotFallbackDidChange whenver child node is muated.
772         * html/HTMLSlotElement.h:
773
774 2018-08-28  Don Olmstead  <don.olmstead@sony.com>
775
776         Check for null renderer in canBeScrolledIntoView
777         https://bugs.webkit.org/show_bug.cgi?id=188935
778
779         Reviewed by Simon Fraser.
780
781         Test: fast/spatial-navigation/snav-display-contents-crash.html
782
783         * page/SpatialNavigation.cpp:
784         (WebCore::canBeScrolledIntoView):
785
786 2018-08-28  Youenn Fablet  <youenn@apple.com>
787
788         IDBDatabase should not return true to hasPendingActivity after being stopped
789         https://bugs.webkit.org/show_bug.cgi?id=189073
790
791         Reviewed by Darin Adler.
792
793         There is a chance that IDBDatabase::hasPendingActivity returns true.
794         The case that might happen is when stop() is called but there are still some active/being committed transactions.
795         In that case, hasPendingActivity will return true until these transactions get finalized.
796         While these transactions will probably be finalized at some point, it delays GC for no good reason.
797         And we might want in a follow-up patch to assert that ActiveDOMObject are GC-able whenever their context is stopped.
798         For that purpose, make sure hasPendingActivity returns false when context is stopped.
799
800         * Modules/indexeddb/IDBDatabase.cpp:
801         (WebCore::IDBDatabase::hasPendingActivity const):
802
803 2018-08-28  Don Olmstead  <don.olmstead@sony.com>
804
805         [CMake] Use CMake's FindFreetype
806         https://bugs.webkit.org/show_bug.cgi?id=189071
807
808         Reviewed by Michael Catanzaro.
809
810         No new tests. No change in behavior.
811
812         * platform/FreeType.cmake:
813
814 2018-08-28  Wenson Hsieh  <wenson_hsieh@apple.com>
815
816         Work towards: [iOS] Consolidate the implementations of readString, stringForType, and readURL in PlatformPasteboardIOS.mm
817         https://bugs.webkit.org/show_bug.cgi?id=189054
818
819         Reviewed by Andy Estes.
820
821         Remove the pasteboard type argument from PlatformPasteboard::readURL(). Currently, we only ever pass it
822         "public.url" anyways; for reading other types of strings, readString() already exists, which takes an arbitrary
823         pasteboard type.
824
825         * platform/PasteboardStrategy.h:
826         * platform/PlatformPasteboard.h:
827         * platform/ios/PasteboardIOS.mm:
828         (WebCore::Pasteboard::readPasteboardWebContentDataForType):
829         (WebCore::Pasteboard::readPlatformValueAsString):
830         * platform/ios/PlatformPasteboardIOS.mm:
831         (WebCore::PlatformPasteboard::readURL):
832
833 2018-08-28  Youenn Fablet  <youenn@apple.com>
834
835         MediaDevices should be collectable as soon as its document is stopped
836         https://bugs.webkit.org/show_bug.cgi?id=189021
837
838         Reviewed by Eric Carlson.
839
840         Introduce ActiveDOMObject::isContextStopped to check whether the context is stopped.
841         Use this check in MediaDevices::hasPendingActivity so that it returns false as soon as active dom objects are stopped.
842
843         Test: http/tests/media/collect-media-devices.https.html
844
845         * Modules/mediastream/MediaDevices.cpp:
846         (WebCore::MediaDevices::hasPendingActivity const):
847         * dom/ActiveDOMObject.cpp:
848         (WebCore::ActiveDOMObject::hasPendingActivity const):
849         (WebCore::ActiveDOMObject::isContextStopped const):
850         * dom/ActiveDOMObject.h:
851
852 2018-08-28  Basuke Suzuki  <Basuke.Suzuki@sony.com>
853
854         [Curl] Fix issue that extra cookie is added when redirect happens.
855         https://bugs.webkit.org/show_bug.cgi?id=187874
856
857         Reviewed by Alex Christensen.
858
859         When initial request has cookie set and redirect happens, it add extra Cookie header to that
860         abd request was broken. Just stop modifying the original request by passing a value.
861
862         Test: http/tests/cookies/multiple-redirect-and-set-cookie.php
863
864         * platform/network/ResourceHandle.h:
865         * platform/network/curl/ResourceHandleCurl.cpp:
866         (WebCore::ResourceHandle::createCurlRequest):
867
868 2018-08-28  Aditya Keerthi  <akeerthi@apple.com>
869
870         [macOS] Color wells should appear rounded and textured
871         https://bugs.webkit.org/show_bug.cgi?id=189039
872
873         Reviewed by Tim Horton.
874
875         Color wells should have a rounded and textured appearance on macOS. We can use
876         NSBezelStyleTexturedSquare to achieve this appearance.
877
878         Also updated the user-agent stylesheet to match the system appearance.
879
880         Rebaselined existing test: fast/forms/color/input-appearance-color.html
881
882         * css/html.css:
883         (input[type="color"]::-webkit-color-swatch-wrapper):
884         (input[type="color"]::-webkit-color-swatch):
885         * platform/mac/ThemeMac.mm:
886         (WebCore::setUpButtonCell):
887         * rendering/RenderThemeMac.h: Build fix.
888
889 2018-08-28  Youenn Fablet  <youenn@apple.com>
890
891         WebKitMediaSession should be GC collectable when its document is being stopped
892         https://bugs.webkit.org/show_bug.cgi?id=189016
893
894         Reviewed by Eric Carlson.
895
896         Make sure WebKitMediaSession is  collectable after its document is stopped.
897         This is done by nullifying m_session when calling close.
898         This way hasPendingActivity() returns false when stop() is called.
899
900         Test: http/tests/media/clearkey/collect-webkit-media-session.html
901
902         * Modules/encryptedmedia/legacy/WebKitMediaKeySession.cpp:
903         (WebCore::WebKitMediaKeySession::WebKitMediaKeySession):
904         (WebCore::WebKitMediaKeySession::close):
905         * Modules/encryptedmedia/legacy/WebKitMediaKeySession.h:
906
907 2018-08-28  Ali Juma  <ajuma@chromium.org>
908
909         [IntersectionObserver] Fix build after r235424
910         https://bugs.webkit.org/show_bug.cgi?id=189051
911
912         Rubber-stamped by Simon Fraser.
913
914         Fix unused variable warning by using the variable.
915
916         * page/FrameView.cpp:
917         (WebCore::FrameView::viewportContentsChanged):
918
919 2018-08-28  Aditya Keerthi  <akeerthi@apple.com>
920
921         [iOS] Support inputmode=none
922         https://bugs.webkit.org/show_bug.cgi?id=188896
923
924         Reviewed by Tim Horton.
925
926         Updated InputMode.cpp to ensure that "none" is recognized as a valid value for the
927         inputmode attribute. This keyword is useful for content that renders its own
928         keyboard control.
929
930         Spec: https://html.spec.whatwg.org/multipage/interaction.html#input-modalities%3A-the-inputmode-attribute
931
932         Test: fast/forms/ios/inputmode-none.html
933
934         * html/InputMode.cpp:
935         (WebCore::inputModeForAttributeValue):
936         (WebCore::stringForInputMode):
937         (WebCore::InputModeNames::none):
938         * html/InputMode.h:
939
940 2018-08-28  Ali Juma  <ajuma@chromium.org>
941
942         [IntersectionObserver] Schedule intersection observation updates
943         https://bugs.webkit.org/show_bug.cgi?id=189007
944
945         Reviewed by Simon Fraser.
946
947         Schedule intersection observation updates in the following situations:
948         1) A new observation target is added.
949         2) FrameView::viewportContentsChanged -- this covers changes to layout and
950            to scroll positions for same-document observation. Scheduling for
951            cross-document observation will be handled in a future patch.
952         3) Style is resolved without triggering layout -- this handles updates that
953            were deferred because of a pending style recalculation.
954
955         Tested by existing tests in imported/w3c/web-platform-tests/intersection-observer.
956
957         * dom/Document.cpp:
958         (WebCore::Document::resolveStyle):
959         (WebCore::Document::updateIntersectionObservations):
960         (WebCore::Document::scheduleIntersectionObservationUpdate):
961         * dom/Document.h:
962         * page/FrameView.cpp:
963         (WebCore::FrameView::viewportContentsChanged):
964         * page/IntersectionObserver.cpp:
965         (WebCore::IntersectionObserver::observe):
966
967 2018-08-28  Zalan Bujtas  <zalan@apple.com>
968
969         [LFC][Floating] Remove redundant FloatAvoider functions.
970         https://bugs.webkit.org/show_bug.cgi?id=189035
971
972         Reviewed by Antti Koivisto.
973
974         and move some code from FloatContext to FloatAvoider.
975
976         * layout/floats/FloatAvoider.cpp:
977         (WebCore::Layout::FloatAvoider::initializePosition):
978         (WebCore::Layout::FloatAvoider::rect const):
979         (WebCore::Layout::FloatAvoider::setVerticalConstraint):
980         (WebCore::Layout::FloatAvoider::setHorizontalConstraints):
981         (WebCore::Layout::FloatAvoider::resetHorizontalConstraint):
982         (WebCore::Layout::FloatAvoider::initialVerticalPosition const):
983         (WebCore::Layout::FloatAvoider::initialHorizontalPosition const):
984         (WebCore::Layout::FloatAvoider::rectInContainingBlock const):
985         (WebCore::Layout::FloatAvoider::setLeft): Deleted.
986         (WebCore::Layout::FloatAvoider::setTopLeft): Deleted.
987         (WebCore::Layout::FloatAvoider::resetVertically): Deleted.
988         (WebCore::Layout::FloatAvoider::resetHorizontally): Deleted.
989         (WebCore::Layout::FloatAvoider::topLeftInContainingBlock const): Deleted.
990         * layout/floats/FloatAvoider.h:
991         (WebCore::Layout::FloatAvoider::top const): Deleted.
992         (WebCore::Layout::FloatAvoider::left const): Deleted.
993         (WebCore::Layout::FloatAvoider::marginTop const): Deleted.
994         (WebCore::Layout::FloatAvoider::marginLeft const): Deleted.
995         (WebCore::Layout::FloatAvoider::marginBottom const): Deleted.
996         (WebCore::Layout::FloatAvoider::marginRight const): Deleted.
997         (WebCore::Layout::FloatAvoider::rectWithMargin const): Deleted.
998         (WebCore::Layout::FloatAvoider::setTop): Deleted.
999         * layout/floats/FloatingContext.cpp:
1000         (WebCore::Layout::FloatingContext::positionForFloat const):
1001         (WebCore::Layout::FloatingContext::floatingPosition const):
1002         (WebCore::Layout::FloatingPair::horizontalConstraints const):
1003         (WebCore::Layout::FloatingPair::horiztonalPosition const): Deleted.
1004
1005 2018-08-28  Eric Carlson  <eric.carlson@apple.com>
1006
1007         Revert changes to RealtimeMediaSource.cpp made in r235086
1008         https://bugs.webkit.org/show_bug.cgi?id=189046
1009         <rdar://problem/43794875>
1010
1011         Unreviewed, reverting an accidental change.
1012
1013         * platform/mediastream/RealtimeMediaSource.cpp:
1014         (WebCore::RealtimeMediaSource::supportsSizeAndFrameRate): 
1015
1016 2018-08-28  Alejandro G. Castro  <alex@igalia.com>
1017
1018         Fix gcc compilation warnings after r235230
1019         https://bugs.webkit.org/show_bug.cgi?id=188981
1020
1021         Reviewed by Eric Carlson.
1022
1023         Replace the pragma clang with pragma GCC, it is understood by
1024         clang and gcc.
1025
1026         * Modules/mediastream/libwebrtc/LibWebRTCDataChannelHandler.h:
1027         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:
1028         * platform/mediastream/RealtimeIncomingAudioSource.h:
1029         * platform/mediastream/RealtimeIncomingVideoSource.h:
1030         * platform/mediastream/RealtimeOutgoingAudioSource.h:
1031         * platform/mediastream/RealtimeOutgoingVideoSource.h:
1032         * platform/mediastream/libwebrtc/LibWebRTCAudioModule.h:
1033         * platform/mediastream/libwebrtc/LibWebRTCProvider.cpp:
1034         * platform/mediastream/libwebrtc/LibWebRTCProvider.h:
1035         * testing/MockLibWebRTCPeerConnection.h:
1036
1037 2018-08-27  Justin Fan  <justin_fan@apple.com>
1038
1039         WebGL 2 conformance: framebuffer-test
1040         https://bugs.webkit.org/show_bug.cgi?id=188812
1041
1042         Reviewed by Jon Lee.
1043
1044         Update WebGL 2 implementation to handle READ_FRAMEBUFFER and default framebuffer conformance. Also taking this
1045         chance to fix memory leak in PlatformScreenMac/gpuIDForDisplayMask().
1046
1047         Covered by existing WebGL tests as well as newly-enabled webgl/2.0.0/conformance2/renderbuffers/framebuffer-test.html.
1048
1049         * html/canvas/WebGL2RenderingContext.cpp:
1050         (WebCore::WebGL2RenderingContext::blitFramebuffer):
1051         (WebCore::WebGL2RenderingContext::framebufferTextureLayer):
1052         (WebCore::validateDefaultFramebufferAttachment):
1053         (WebCore::WebGL2RenderingContext::getFramebufferAttachmentParameter):
1054         (WebCore::WebGL2RenderingContext::validateFramebufferFuncParameters):
1055         (WebCore::WebGL2RenderingContext::validateFramebufferTarget):
1056         (WebCore::WebGL2RenderingContext::validateNonDefaultFramebufferAttachment):
1057         (WebCore::WebGL2RenderingContext::getParameter):
1058         * html/canvas/WebGL2RenderingContext.h:
1059         * html/canvas/WebGLFramebuffer.cpp:
1060         (WebCore::WebGLFramebuffer::isBound const):
1061         * html/canvas/WebGLRenderingContextBase.cpp:
1062         (WebCore::WebGLRenderingContextBase::initializeNewContext):
1063         (WebCore::WebGLRenderingContextBase::~WebGLRenderingContextBase):
1064         (WebCore::WebGLRenderingContextBase::bindFramebuffer):
1065         (WebCore::WebGLRenderingContextBase::checkFramebufferStatus):
1066         (WebCore::WebGLRenderingContextBase::deleteFramebuffer):
1067         (WebCore::WebGLRenderingContextBase::framebufferRenderbuffer):
1068         (WebCore::WebGLRenderingContextBase::framebufferTexture2D):
1069         * html/canvas/WebGLRenderingContextBase.h:
1070         * platform/graphics/GraphicsContext3D.h:
1071         * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
1072         (WebCore::GraphicsContext3D::blitFramebuffer):
1073         * platform/mac/PlatformScreenMac.mm:
1074         (WebCore::gpuIDForDisplayMask):
1075
1076 2018-08-27  Myles C. Maxfield  <mmaxfield@apple.com>
1077
1078         Null pointer deref in WidthIterator
1079         https://bugs.webkit.org/show_bug.cgi?id=188993
1080
1081         Reviewed by Brent Fulgham.
1082
1083         Test: fast/text/rtl-justification.html
1084
1085         We simply need to guard glyphBuffer like we do in the rest of the function.
1086
1087         * platform/graphics/WidthIterator.cpp:
1088         (WebCore::WidthIterator::advanceInternal):
1089
1090 2018-08-27  Wenson Hsieh  <wenson_hsieh@apple.com>
1091
1092         [Attachment Support] Remove WebCore::AttachmentDisplayOptions and friends
1093         https://bugs.webkit.org/show_bug.cgi?id=189004
1094
1095         Reviewed by Dan Bernstein.
1096
1097         No new tests, since there is no change in behavior.
1098
1099         * WebCore.xcodeproj/project.pbxproj:
1100         * editing/Editor.cpp:
1101         (WebCore::Editor::insertAttachment):
1102         * editing/Editor.h:
1103         * html/AttachmentTypes.h: Removed.
1104         * html/HTMLAttachmentElement.h:
1105
1106 2018-08-27  Keith Rollin  <krollin@apple.com>
1107
1108         Unreviewed build fix -- disable LTO for production builds
1109
1110         * Configurations/Base.xcconfig:
1111
1112 2018-08-27  Youenn Fablet  <youenn@apple.com>
1113
1114         Various IndexDB tests abandon documents
1115         https://bugs.webkit.org/show_bug.cgi?id=188728
1116         <rdar://problem/43651095>
1117
1118         Reviewed by Alex Christensen.
1119
1120         Some IDB objects implement hasPendingActivity but there are some possibilities that they continue returning true after being stopped.
1121         This is the case for requests that get stopped while still waiting for some pending activity.
1122         This is also the case for requests that emits upgradeneeded or blocked events.
1123
1124         Enforce that these objects return false to hasPendingActivity once being stopped.
1125         This ensures that they can be garbage collected once their context is preparing for destruction like in Document::prepareForDestruction.
1126
1127         Test: http/tests/IndexedDB/collect-IDB-objects.https.html
1128
1129         * Modules/indexeddb/IDBIndex.cpp:
1130         (WebCore::IDBIndex::hasPendingActivity const):
1131         * Modules/indexeddb/IDBObjectStore.cpp:
1132         (WebCore::IDBObjectStore::hasPendingActivity const):
1133         * Modules/indexeddb/IDBRequest.cpp:
1134         (WebCore::IDBRequest::hasPendingActivity const):
1135         (WebCore::IDBRequest::enqueueEvent):
1136         * Modules/indexeddb/IDBTransaction.cpp:
1137         (WebCore::IDBTransaction::notifyDidAbort):
1138         In case the context is stopped, IDBTransaction should not ask IDBRequest to fire an event.
1139
1140 2018-08-27  Simon Fraser  <simon.fraser@apple.com>
1141
1142         Teach WebKitTestRunner and DumpRenderTree about detecting world leaks
1143         https://bugs.webkit.org/show_bug.cgi?id=188994
1144
1145         Reviewed by Tim Horton.
1146
1147         Export Document::postTask() for use by WTR's injected bundle.
1148
1149         * dom/Document.h:
1150
1151 2018-08-27  Aditya Keerthi  <akeerthi@apple.com>
1152
1153         Consolidate ENABLE_INPUT_TYPE_COLOR and ENABLE_INPUT_TYPE_COLOR_POPOVER
1154         https://bugs.webkit.org/show_bug.cgi?id=188931
1155
1156         Reviewed by Wenson Hsieh.
1157
1158         * Configurations/FeatureDefines.xcconfig: Removed ENABLE_INPUT_TYPE_COLOR_POPOVER.
1159
1160 2018-08-27  Simon Fraser  <simon.fraser@apple.com>
1161
1162         Improve the showAllDocuments logging
1163         https://bugs.webkit.org/show_bug.cgi?id=188990
1164
1165         Reviewed by Tim Horton.
1166         
1167         Improve the output triggered by "notifyutil -p com.apple.WebKit.showAllDocuments" to denote
1168         SVG documents (which often have no URL), and to show the refCount and referencingNodeCount,
1169         which helps with leak debugging.
1170         
1171         Sample output:
1172
1173         2 live documents:
1174         Document 0x1236f1200 3 (refCount 6, referencingNodeCount 580) https://webkit.org/
1175         SVGDocument 0x134b60000 13 (refCount 1, referencingNodeCount 197) 
1176
1177         * page/mac/PageMac.mm:
1178         (WebCore::Page::platformInitialize):
1179
1180 2018-08-27  Wenson Hsieh  <wenson_hsieh@apple.com>
1181
1182         [Cocoa] Exception (fileType 'dyn.agq8u' is not a valid UTI) raised when dragging an attachment whose file wrapper is a directory
1183         https://bugs.webkit.org/show_bug.cgi?id=188903
1184         <rdar://problem/43702993>
1185
1186         Reviewed by Tim Horton.
1187
1188         Fixes the exception for attachments that are created when dropping files with extensions that don't map to any
1189         known UTIs, and when dropping folders. See below for more detail.
1190
1191         Tests:  WKAttachmentTests.InsertFolderAndFileWithUnknownExtension
1192                 WKAttachmentTests.DropFolderAsAttachmentAndMoveByDragging
1193                 WKAttachmentTests.ChangeAttachmentDataAndFileInformation
1194
1195         * editing/Editor.cpp:
1196         (WebCore::Editor::insertAttachment):
1197         * editing/Editor.h:
1198         * editing/cocoa/WebContentReaderCocoa.mm:
1199         (WebCore::WebContentReader::readFilePaths):
1200
1201         When creating an attachment by dropping or pasting a file backed by a file path, handle the cases where…
1202         (1)     the dropped path is a directory, by setting the UTI to "public.directory". This allows us to show a
1203                 folder icon for the dropped attachment element on macOS.
1204         (2)     the dropped path is a file whose UTI is unknown, by defaulting to "public.data".
1205
1206         By ensuring that the UTI of a dropped file-backed attachment is set to a concrete type in any case, we avoid an
1207         exception when dragging the attachment on macOS, and on iOS, avoid silently failing to drag an attachment.
1208
1209         * html/HTMLAttachmentElement.cpp:
1210         (WebCore::HTMLAttachmentElement::updateAttributes):
1211
1212         Change this method to take an optional file size (the subtitle attribute will only be set if the file size is
1213         not `std::nullopt`). Furthermore, allow callers of this method to clear attributes on the attachment element by
1214         passing in `std::nullopt` for any of the three arguments. This allows us to handle the case where an
1215         attachment's file wrapper is changed from a regular file to a folder whose total size is currently unknown.
1216         Instead of showing "0 bytes", we'll simply refrain from showing a subtitle at all (in the future, this should
1217         be improved by implementing a way to estimate the size of the files in the folder, or perhaps show the number of
1218         items in the folder as the subtitle).
1219
1220         * html/HTMLAttachmentElement.h:
1221
1222 2018-08-27  Devin Rousso  <drousso@apple.com>
1223
1224         Web Inspector: provide autocompletion for event breakpoints
1225         https://bugs.webkit.org/show_bug.cgi?id=188717
1226
1227         Reviewed by Brian Burg.
1228
1229         Test: inspector/dom/getSupportedEventNames.html
1230
1231         * inspector/agents/InspectorDOMAgent.h:
1232         * inspector/agents/InspectorDOMAgent.cpp:
1233         (WebCore::InspectorDOMAgent::getSupportedEventNames): Added.
1234
1235 2018-08-27  Keith Rollin  <krollin@apple.com>
1236
1237         Build system support for LTO
1238         https://bugs.webkit.org/show_bug.cgi?id=187785
1239         <rdar://problem/42353132>
1240
1241         Reviewed by Dan Bernstein.
1242
1243         Update Base.xcconfig and DebugRelease.xcconfig to optionally enable
1244         LTO.
1245
1246         No new tests -- no new WebKit functionality.
1247
1248         * Configurations/Base.xcconfig:
1249         * Configurations/DebugRelease.xcconfig:
1250
1251 2018-08-27  Daniel Bates  <dabates@apple.com>
1252
1253         [iOS] Make color of spelling dots match UIKit
1254         https://bugs.webkit.org/show_bug.cgi?id=188861
1255
1256         Reviewed by Simon Fraser.
1257
1258         * rendering/RenderThemeCocoa.h:
1259         * rendering/RenderThemeCocoa.mm:
1260         (WebCore::RenderThemeCocoa::drawLineForDocumentMarker): Modified to call colorForMarkerLineStyle()
1261         for the color to use for the line style.
1262         (WebCore::colorForStyle): Deleted.
1263         * rendering/RenderThemeIOS.h:
1264         * rendering/RenderThemeIOS.mm:
1265         (WebCore::RenderThemeIOS::colorForMarkerLineStyle): Added.
1266         * rendering/RenderThemeMac.h:
1267         * rendering/RenderThemeMac.mm:
1268         (WebCore::RenderThemeMac::colorForMarkerLineStyle): Added.
1269
1270 2018-08-27  Daniel Bates  <dabates@apple.com>
1271
1272         Spelling dots do not scale with page on iOS; share spelling dot painting code between Mac and iOS
1273         https://bugs.webkit.org/show_bug.cgi?id=188828
1274         <rdar://problem/15966403>
1275
1276         Reviewed by Simon Fraser.
1277
1278         The look of the spelling dots on Mac and iOS are identical up to color. Towards making the
1279         spelling dots in WebKit on iOS more closely match the look of the spelling dots in UIKit-
1280         apps, standardize on using the same painting code for both Mac and iOS.
1281
1282         Currently iOS uses bitmaps to render the spelling dots and does not account for user/CSS
1283         zooming. As a result, the spelling dots on iOS render with artifacts (e.g. truncated dots).
1284         A side benefit of having iOS share the same painting code as Mac is that iOS will now paint
1285         the dots programmatically and we avoid both the need to use bitmaps and fix the bugs in
1286         the painting of the bitmap dots with respect to zooming.
1287
1288         * Resources/DictationPhraseWithAlternativesDot.png: Removed.
1289         * Resources/DictationPhraseWithAlternativesDot@2x.png: Removed.
1290         * Resources/SpellingDot.png: Removed.
1291         * Resources/SpellingDot@2x.png: Removed.
1292         * Resources/SpellingDot@3x.png: Removed.
1293         * WebCore.xcodeproj/project.pbxproj:
1294         * page/Page.cpp:
1295         (WebCore::Page::setDeviceScaleFactor):
1296         * platform/graphics/GraphicsContext.h:
1297         * platform/graphics/cairo/GraphicsContextCairo.cpp:
1298         (WebCore::GraphicsContext::updateDocumentMarkerResources): Deleted.
1299         * platform/graphics/cocoa/GraphicsContextCocoa.mm:
1300         (WebCore::GraphicsContext::drawLineForDocumentMarker):
1301         (WebCore::findImage): Deleted.
1302         (WebCore::createDotPattern): Deleted.
1303         (WebCore::GraphicsContext::updateDocumentMarkerResources): Deleted.
1304         * platform/graphics/win/GraphicsContextCGWin.cpp:
1305         (WebCore::GraphicsContext::updateDocumentMarkerResources): Deleted.
1306         * platform/graphics/win/GraphicsContextDirect2D.cpp:
1307         (WebCore::GraphicsContext::updateDocumentMarkerResources): Deleted.
1308         * platform/ios/wak/WKGraphics.mm:
1309         (WKRectFill): Incorporated the logic from _FillRectUsingOperation().
1310         (_FillRectUsingOperation): Deleted; moved the logic into WKRectFill() since WKRectFill()
1311         is now the only caller of this function.
1312         (WKRectFillUsingOperation): Deleted.
1313         (imageResourcePath): Deleted.
1314         (WKGraphicsCreateImageFromBundleWithName): Deleted.
1315         (WKDrawPatternBitmap): Deleted.
1316         (WKReleasePatternBitmap): Deleted.
1317         (WKSetPattern): Deleted.
1318         * platform/ios/wak/WKGraphicsInternal.h: Removed.
1319         * rendering/InlineTextBox.cpp:
1320         (WebCore::InlineTextBox::paintPlatformDocumentMarker):
1321         * rendering/RenderThemeCocoa.h: Add headers RenderText.h and GraphicsContextCG.h. Fix some style nits while I am here;
1322         substitute #import for #include and remove some unnecessary headers TranslateTransformOperation.h, RenderStyle.h, and
1323         RenderElement.h.
1324         * rendering/RenderThemeCocoa.mm:
1325         (WebCore::colorForStyle):
1326         (WebCore::RenderThemeCocoa::drawLineForDocumentMarker): Moved from RenderThemeMac. I renamed
1327         the local variable ctx to context and fixed a type in a comment while moving this code.
1328         * rendering/RenderThemeMac.h:
1329         * rendering/RenderThemeMac.mm:
1330         (WebCore::colorForStyle): Deleted; moved to class RenderThemeCocoa.
1331         (WebCore::RenderThemeMac::drawLineForDocumentMarker): Deleted; moved to class RenderThemeCocoa.
1332
1333 2018-08-27  Wenson Hsieh  <wenson_hsieh@apple.com>
1334
1335         [Attachment Support] [WK2] Images copied from Mail message view paste with the wrong file name in compose
1336         https://bugs.webkit.org/show_bug.cgi?id=188957
1337         <rdar://problem/43737715>
1338
1339         Reviewed by Darin Adler.
1340
1341         Allow the alt attribute of a pasted image element to determine the name of an image attachment, rather than
1342         using the source URL's last path component first. This is because in some clients, such as Mail, the source of
1343         the image element is some nondescript UUID, and the alt text contains the real name of the image.
1344
1345         Test: WKAttachmentTests.PasteWebArchiveContainingImages
1346
1347         * editing/cocoa/WebContentReaderCocoa.mm:
1348         (WebCore::replaceRichContentWithAttachments):
1349
1350 2018-08-27  Alex Christensen  <achristensen@webkit.org>
1351
1352         Fix IOSMAC build
1353         https://bugs.webkit.org/show_bug.cgi?id=188934
1354         <rdar://problem/43694979>
1355
1356         Reviewed by Darin Adler.
1357
1358         * platform/network/cf/FormDataStreamCFNet.cpp:
1359
1360 2018-08-27  Rob Buis  <rbuis@igalia.com>
1361
1362         XMLHTTPRequest.send for Document should have same Content-Type processing rules as String
1363         https://bugs.webkit.org/show_bug.cgi?id=188953
1364
1365         Reviewed by Darin Adler.
1366
1367         Processing rules for Content-Type have been implemented for send with String as parameter, but
1368         not for Document, but both should be treated the same according to the spec [1]. This patch
1369         implements this.
1370
1371         Behavior matches Firefox.
1372
1373         [1] https://xhr.spec.whatwg.org/#the-send()-method
1374
1375         Test: web-platform-tests/XMLHttpRequest/setrequestheader-content-type.htm
1376
1377         * xml/XMLHttpRequest.cpp:
1378         (WebCore::XMLHttpRequest::send):
1379
1380 2018-08-27  Ali Juma  <ajuma@chromium.org>
1381
1382         [IntersectionObserver] Implement intersection logic for the explicit root case
1383         https://bugs.webkit.org/show_bug.cgi?id=188809
1384
1385         Reviewed by Simon Fraser.
1386
1387         Add logic to Document::updateIntersectionObservations to compute the intersection
1388         between the target and root elements, for the case where an IntersectionObserver
1389         has a root element.
1390
1391         There are no changes to the scheduling of intersection observations in this patch,
1392         so observations are still only computed once for each observer.
1393
1394         * dom/Document.cpp:
1395         (WebCore::computeIntersectionRects):
1396         (WebCore::Document::updateIntersectionObservations):
1397         * page/FrameView.cpp:
1398         (WebCore::FrameView::absoluteToClientRect const):
1399         * page/FrameView.h:
1400         * page/IntersectionObserver.cpp:
1401         (WebCore::IntersectionObserver::IntersectionObserver):
1402         (WebCore::IntersectionObserver::createTimestamp const):
1403         * page/IntersectionObserver.h:
1404         * platform/graphics/FloatRect.h:
1405         (WebCore::FloatRect::area const):
1406         * rendering/RenderBlock.cpp:
1407         (WebCore::RenderBlock::isContainingBlockAncestorFor const):
1408         * rendering/RenderBlock.h:
1409
1410 2018-08-25  Yusuke Suzuki  <yusukesuzuki@slowstart.org>
1411
1412         Shrink size of HTMLCollection
1413         https://bugs.webkit.org/show_bug.cgi?id=188945
1414
1415         Reviewed by Darin Adler.
1416
1417         Shrink the size of HTMLCollection by reordering members.
1418
1419         No behavior change.
1420
1421         * html/HTMLCollection.cpp:
1422         (WebCore::HTMLCollection::HTMLCollection):
1423         * html/HTMLCollection.h:
1424
1425 2018-08-25  Yusuke Suzuki  <yusukesuzuki@slowstart.org>
1426
1427         Shrink size of XMLHttpRequest
1428         https://bugs.webkit.org/show_bug.cgi?id=188944
1429
1430         Reviewed by Saam Barati.
1431
1432         Shrink the size of XMLHttpRequest by packing bits and reordering members.
1433         It reduces the size from 1248 to 1176.
1434
1435         No behavior change.
1436
1437         * xml/XMLHttpRequest.cpp:
1438         (WebCore::XMLHttpRequest::XMLHttpRequest):
1439         (WebCore::XMLHttpRequest::responseText):
1440         (WebCore::XMLHttpRequest::createResponseBlob):
1441         (WebCore::XMLHttpRequest::createResponseArrayBuffer):
1442         (WebCore::XMLHttpRequest::setResponseType):
1443         (WebCore::XMLHttpRequest::changeState):
1444         (WebCore::XMLHttpRequest::callReadyStateChangeListener):
1445         (WebCore::XMLHttpRequest::setWithCredentials):
1446         (WebCore::XMLHttpRequest::open):
1447         (WebCore::XMLHttpRequest::prepareToSend):
1448         (WebCore::XMLHttpRequest::createRequest):
1449         (WebCore::XMLHttpRequest::abort):
1450         (WebCore::XMLHttpRequest::overrideMimeType):
1451         (WebCore::XMLHttpRequest::setRequestHeader):
1452         (WebCore::XMLHttpRequest::getAllResponseHeaders const):
1453         (WebCore::XMLHttpRequest::getResponseHeader const):
1454         (WebCore::XMLHttpRequest::status const):
1455         (WebCore::XMLHttpRequest::statusText const):
1456         (WebCore::XMLHttpRequest::didFinishLoading):
1457         (WebCore::XMLHttpRequest::createDecoder const):
1458         (WebCore::XMLHttpRequest::didReceiveData):
1459         (WebCore::XMLHttpRequest::didReachTimeout):
1460         (WebCore::XMLHttpRequest::readyState const): Deleted.
1461         * xml/XMLHttpRequest.h:
1462         (WebCore::XMLHttpRequest::responseType const):
1463         (WebCore::XMLHttpRequest::readyState const):
1464         * xml/XMLHttpRequestProgressEventThrottle.cpp:
1465         (WebCore::XMLHttpRequestProgressEventThrottle::XMLHttpRequestProgressEventThrottle):
1466         * xml/XMLHttpRequestProgressEventThrottle.h:
1467
1468 2018-08-26  Zalan Bujtas  <zalan@apple.com>
1469
1470         [LFC][Floating] FloatBox -> FloatAvoider
1471         https://bugs.webkit.org/show_bug.cgi?id=188941
1472
1473         Reviewed by Antti Koivisto.
1474
1475         This is in preparation for the float avoidance feature where formatting context root boxes avoid existing floats.
1476
1477         * Sources.txt:
1478         * WebCore.xcodeproj/project.pbxproj:
1479         * layout/displaytree/DisplayBox.h:
1480         * layout/floats/FloatAvoider.cpp: Renamed from Source/WebCore/layout/floats/FloatBox.cpp.
1481         (WebCore::Layout::FloatAvoider::FloatAvoider):
1482         (WebCore::Layout::FloatAvoider::initializePosition):
1483         (WebCore::Layout::FloatAvoider::isLeftAligned const):
1484         (WebCore::Layout::FloatAvoider::setLeft):
1485         (WebCore::Layout::FloatAvoider::setTopLeft):
1486         (WebCore::Layout::FloatAvoider::resetVertically):
1487         (WebCore::Layout::FloatAvoider::resetHorizontally):
1488         (WebCore::Layout::FloatAvoider::topLeftInContainingBlock const):
1489         * layout/floats/FloatAvoider.h: Renamed from Source/WebCore/layout/floats/FloatBox.h.
1490         (WebCore::Layout::FloatAvoider::top const):
1491         (WebCore::Layout::FloatAvoider::left const):
1492         (WebCore::Layout::FloatAvoider::marginTop const):
1493         (WebCore::Layout::FloatAvoider::marginLeft const):
1494         (WebCore::Layout::FloatAvoider::marginBottom const):
1495         (WebCore::Layout::FloatAvoider::marginRight const):
1496         (WebCore::Layout::FloatAvoider::rectWithMargin const):
1497         (WebCore::Layout::FloatAvoider::setTop):
1498         * layout/floats/FloatingContext.cpp:
1499         (WebCore::Layout::FloatingContext::positionForFloat const):
1500         (WebCore::Layout::FloatingContext::floatingPosition const):
1501         * layout/floats/FloatingContext.h:
1502
1503 2018-08-26  Christopher Reid  <chris.reid@sony.com>
1504
1505         [Curl] Implement deleteCookie()
1506         https://bugs.webkit.org/show_bug.cgi?id=188908
1507
1508         Reviewed by Fujii Hironori.
1509
1510         Support deleting cookies from the web inspector
1511
1512         Tested from the web inspector.
1513
1514         * platform/network/curl/CookieJarCurlDatabase.cpp:
1515         (WebCore::CookieJarCurlDatabase::deleteCookie const):
1516
1517 2018-08-26  Zalan Bujtas  <zalan@apple.com>
1518
1519         [LFC][Floating] Simplify FloatingState::FloatItem class
1520         https://bugs.webkit.org/show_bug.cgi?id=188912
1521
1522         Reviewed by Antti Koivisto.
1523
1524         Let's remove some redundant code now that FloatingState::FloatItem is not used for incoming floats anymore.
1525
1526         * layout/Verification.cpp:
1527         (WebCore::Layout::LayoutContext::verifyAndOutputMismatchingLayoutTree const):
1528         * layout/floats/FloatBox.cpp:
1529         (WebCore::Layout::FloatBox::resetVertically):
1530         * layout/floats/FloatingContext.cpp:
1531         (WebCore::Layout::FloatingPair::left const):
1532         (WebCore::Layout::FloatingPair::right const):
1533         (WebCore::Layout::FloatingPair::intersects const):
1534         (WebCore::Layout::previousFloatingIndex):
1535         (WebCore::Layout::Iterator::operator++):
1536         (WebCore::Layout::Iterator::set):
1537         * layout/floats/FloatingState.cpp:
1538         (WebCore::Layout::FloatingState::FloatItem::FloatItem):
1539         (WebCore::Layout::FloatingState::remove):
1540         (WebCore::Layout::FloatingState::bottom const):
1541         * layout/floats/FloatingState.h:
1542         (WebCore::Layout::FloatingState::FloatItem::operator== const):
1543         (WebCore::Layout::FloatingState::FloatItem::isLeftPositioned const):
1544         (WebCore::Layout::FloatingState::FloatItem::rectWithMargin const):
1545         (WebCore::Layout::FloatingState::FloatItem::bottom const):
1546         (WebCore::Layout::FloatingState::leftBottom const):
1547         (WebCore::Layout::FloatingState::rightBottom const):
1548         (WebCore::Layout::FloatingState::bottom const):
1549         (WebCore::Layout::FloatingState::FloatItem::inFormattingContext const):
1550         (WebCore::Layout::FloatingState::FloatItem::layoutBox const): Deleted.
1551         (WebCore::Layout::FloatingState::FloatItem::containingBlock const): Deleted.
1552         (WebCore::Layout::FloatingState::FloatItem::displayBox const): Deleted.
1553         (WebCore::Layout::FloatingState::FloatItem::containingBlockDisplayBox const): Deleted.
1554
1555 2018-08-26  Andy Estes  <aestes@apple.com>
1556
1557         [Apple Pay] Introduce new values for -apple-pay-button-type
1558         https://bugs.webkit.org/show_bug.cgi?id=188949
1559         <rdar://problem/39992228>
1560
1561         Reviewed by Anders Carlsson.
1562
1563         Added "in-store", "checkout", "book", and "subscribe" keywords for -apple-pay-button-type,
1564         and mapped those values to their equivalent PKPaymentButtonTypes.
1565
1566         Tests: http/tests/ssl/applepay/ApplePayButton.html
1567                http/tests/ssl/applepay/ApplePayButtonV4.html
1568
1569         * css/CSSPrimitiveValueMappings.h:
1570         (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
1571         (WebCore::CSSPrimitiveValue::operator ApplePayButtonType const):
1572         * css/CSSValueKeywords.in:
1573         * css/parser/CSSParserFastPaths.cpp:
1574         (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
1575         * rendering/RenderThemeCocoa.mm:
1576         (WebCore::toPKPaymentButtonType):
1577         * rendering/style/RenderStyleConstants.h:
1578
1579 2018-08-26  Youenn Fablet  <youenn@apple.com>
1580
1581         Make IDBCursor::m_request a WeakPtr
1582         https://bugs.webkit.org/show_bug.cgi?id=188938
1583
1584         Reviewed by Alex Christensen.
1585
1586         Make m_request a WeakPtr so that if m_request is destroyed, the related cursor will not use the invalid pointer.
1587
1588         Covered by existing tests.
1589
1590         * Modules/indexeddb/IDBCursor.cpp:
1591         (WebCore::IDBCursor::continuePrimaryKey): Other continue and advance methods that are calling uncheckedIterateCursor do check for m_request.
1592         Apply the same check for continuePrimaryKey.
1593         (WebCore::IDBCursor::uncheckedIterateCursor):
1594         * Modules/indexeddb/IDBCursor.h:
1595         (WebCore::IDBCursor::setRequest):
1596         (WebCore::IDBCursor::clearRequest):
1597         (WebCore::IDBCursor::request):
1598         * Modules/indexeddb/IDBRequest.h:
1599
1600 2018-08-26  Youenn Fablet  <youenn@apple.com>
1601
1602         IDBCursor does not need to be an ActiveDOMObject
1603         https://bugs.webkit.org/show_bug.cgi?id=188937
1604
1605         Reviewed by Alex Christensen.
1606
1607         Remove ActiveDOMObject from IDBCursor IDL.
1608         Update constructors and call sites accordingly.
1609         This allows removing m_outstandingRequestCount and related code in IDBRequest.
1610
1611         Covered by existing tests.
1612
1613         * Modules/indexeddb/IDBCursor.cpp:
1614         (WebCore::IDBCursor::create):
1615         (WebCore::IDBCursor::IDBCursor):
1616         (WebCore::IDBCursor::update):
1617         (WebCore::IDBCursor::uncheckedIterateCursor):
1618         (WebCore::IDBCursor::deleteFunction):
1619         (WebCore::IDBCursor::activeDOMObjectName const): Deleted.
1620         (WebCore::IDBCursor::canSuspendForDocumentSuspension const): Deleted.
1621         (WebCore::IDBCursor::hasPendingActivity const): Deleted.
1622         (WebCore::IDBCursor::decrementOutstandingRequestCount): Deleted.
1623         * Modules/indexeddb/IDBCursor.h:
1624         * Modules/indexeddb/IDBCursor.idl:
1625         * Modules/indexeddb/IDBCursorWithValue.cpp:
1626         (WebCore::IDBCursorWithValue::create):
1627         (WebCore::IDBCursorWithValue::IDBCursorWithValue):
1628         * Modules/indexeddb/IDBCursorWithValue.h:
1629         * Modules/indexeddb/IDBCursorWithValue.idl:
1630         * Modules/indexeddb/IDBRequest.cpp:
1631         (WebCore::IDBRequest::setSource):
1632         (WebCore::IDBRequest::dispatchEvent):
1633         (WebCore::IDBRequest::willIterateCursor):
1634         (WebCore::IDBRequest::didOpenOrIterateCursor):
1635         * Modules/indexeddb/IDBRequest.h:
1636         * Modules/indexeddb/IDBTransaction.cpp:
1637         (WebCore::IDBTransaction::requestOpenCursor):
1638         * WebCore.xcodeproj/project.pbxproj:
1639
1640 2018-08-26  Wenson Hsieh  <wenson_hsieh@apple.com>
1641
1642         [Attachment Support] Dropping and pasting images should insert inline image elements with _WKAttachments
1643         https://bugs.webkit.org/show_bug.cgi?id=188933
1644         <rdar://problem/43699724>
1645
1646         Reviewed by Darin Adler.
1647
1648         Support the ability to drop and paste images as image elements, with attachment elements, only if attachment
1649         elements are enabled. See changes below for more detail.
1650
1651         Tests:  WKAttachmentTests.CutAndPastePastedImage
1652                 WKAttachmentTests.MovePastedImageByDragging
1653                 WKAttachmentTests.RemoveNewlinesBeforePastedImage
1654
1655         * editing/Editor.h:
1656         * editing/cocoa/EditorCocoa.mm:
1657         (WebCore::Editor::getPasteboardTypesAndDataForAttachment):
1658
1659         Adjust this helper to take an Element& rather than an HTMLAttachmentElement&, and address a FIXME by writing the
1660         document origin identifier to the pasteboard via custom pasteboard data when dragging an attachment. This allows
1661         us to avoid creating extra image and attachment elements when dragging an image backed by an attachment within
1662         the same document.
1663
1664         * editing/cocoa/WebContentReaderCocoa.mm:
1665         (WebCore::contentTypeIsSuitableForInlineImageRepresentation):
1666
1667         Add a helper to determine whether a content type (UTI or MIME type) should be read as an inline image.
1668
1669         (WebCore::createFragmentForImageAttachment):
1670         (WebCore::replaceRichContentWithAttachments):
1671         (WebCore::WebContentReader::readFilePaths):
1672
1673         Teach codepaths where we currently create attachment elements to instead create image elements if the MIME type,
1674         is something suitable for display via an inline image element; add the attachment element under the shadow root
1675         of the image element.
1676
1677         * editing/markup.cpp:
1678         (WebCore::StyledMarkupAccumulator::appendCustomAttributes):
1679         (WebCore::restoreAttachmentElementsInFragment):
1680
1681         When dragging or copying an image element, we need to make sure that any attachment element backing the image
1682         is preserved in the pasted or dropped fragment. To do this, we use a technique similar to what was done for
1683         r180785 and r224593 and write a temporary "webkitattachmentid" attribute to the serialized markup on copy. Upon
1684         deserializing the markup back to a fragment, we then create an attachment element with the same identifier under
1685         the image.
1686
1687         (WebCore::createFragmentFromMarkup):
1688         * html/HTMLAttachmentElement.h:
1689         * html/HTMLImageElement.cpp:
1690         (WebCore::HTMLImageElement::setAttachmentElement):
1691         (WebCore::HTMLImageElement::attachmentElement const):
1692
1693         Helper methods to get and set an attachment element under an image element. Setting an image's attachment
1694         element puts that attachment element under the shadow root of the image, and also hides the attachment element.
1695
1696         (WebCore::HTMLImageElement::attachmentIdentifier const):
1697
1698         Returns the identifier of an attachment element associated with the image element, or null.
1699
1700         * html/HTMLImageElement.h:
1701         * html/HTMLImageElement.idl:
1702
1703         Add HTMLImageElement.webkitAttachmentIdentifier, a readonly attribute guarded by runtime-enabled attachment
1704         element feature.
1705
1706         * page/DragController.cpp:
1707         (WebCore::DragController::startDrag):
1708
1709         In the case of dragging an image, if that image element is backed by an attachment element, don't bother writing
1710         the image data to the clipboard; instead, write the attachment data as a promise.
1711
1712         (WebCore::DragController::doImageDrag):
1713
1714         Plumb promised attachment information to DragController::doSystemDrag.
1715
1716         (WebCore::DragController::promisedAttachmentInfo):
1717
1718         Teach this to handle attachment elements as well as image elements that are backed by attachment elements.
1719
1720         * page/DragController.h:
1721         * platform/PromisedAttachmentInfo.h:
1722         (WebCore::PromisedAttachmentInfo::operator bool const):
1723
1724         A valid PromisedAttachmentInfo no longer requires a contentType to be set; instead, an attachment identifier
1725         alone is sufficient, since an up-to-date content type can be requested in the UI process from the API attachment
1726         object.
1727
1728 2018-08-26  Andy Estes  <aestes@apple.com>
1729
1730         [Apple Pay] PaymentRequest.show() should reject when an unsupported ApplePayRequest version is specified
1731         https://bugs.webkit.org/show_bug.cgi?id=188954
1732
1733         Reviewed by Darin Adler.
1734
1735         In Apple Pay JS, calling the ApplePaySession constructor with an unsupported version results
1736         in an exception being thrown. We need to do something similar for Payment Request.
1737
1738         This patch moves the logic for validating the version from ApplePaySession to a common
1739         routine in ApplePayRequestBase that both APIs call to convert requests into a common format.
1740
1741         In Apple Pay JS, an exception will still be thrown when constructing an ApplePaySession. In
1742         Payment Request, the promise returned by show() will be rejected.
1743
1744         Added test cases to http/tests/ssl/applepay/PaymentRequest.https.html.
1745
1746         * Modules/applepay/ApplePayRequestBase.cpp:
1747         (WebCore::convertAndValidate):
1748         * Modules/applepay/ApplePaySession.cpp:
1749         (WebCore::ApplePaySession::create):
1750
1751 2018-08-24  Ryosuke Niwa  <rniwa@webkit.org>
1752
1753         Click event from click() is not composed
1754         https://bugs.webkit.org/show_bug.cgi?id=170211
1755
1756         Reviewed by Wenson Hsieh.
1757
1758         Fixed the bug. All simulated clicks should be composed regardless of whether it's trusted or not.
1759         See: https://html.spec.whatwg.org/multipage/interaction.html#dom-click
1760              https://html.spec.whatwg.org/multipage/webappapis.html#fire-a-synthetic-mouse-event
1761
1762         * dom/SimulatedClick.cpp:
1763
1764 2018-08-24  Ryosuke Niwa  <rniwa@webkit.org>
1765
1766         Avoid calling setUntrusted in SimulatedMouseEvent
1767         https://bugs.webkit.org/show_bug.cgi?id=188929
1768
1769         Reviewed by Simon Fraser.
1770
1771         Added IsTrusted flag to Event constructors instead of creating a trusted event
1772         and making it untrusted in the constructor of SimulatedMouseEvent.
1773
1774         This makes EventTarget::dispatchEventForBindings the only caller of setUntrusted().
1775
1776         * dom/Event.cpp:
1777         (WebCore::Event::Event):
1778         * dom/Event.h:
1779         * dom/KeyboardEvent.cpp:
1780         (WebCore::KeyboardEvent::KeyboardEvent):
1781         * dom/MouseEvent.cpp:
1782         (WebCore::MouseEvent::create):
1783         (WebCore::MouseEvent::MouseEvent):
1784         * dom/MouseEvent.h:
1785         * dom/MouseRelatedEvent.cpp:
1786         (WebCore::MouseRelatedEvent::MouseRelatedEvent):
1787         * dom/MouseRelatedEvent.h:
1788         * dom/SimulatedClick.cpp:
1789         * dom/UIEvent.cpp:
1790         (WebCore::UIEvent::UIEvent):
1791         * dom/UIEvent.h:
1792         * dom/UIEventWithKeyState.h:
1793         (WebCore::UIEventWithKeyState::UIEventWithKeyState):
1794         * dom/WheelEvent.cpp:
1795         (WebCore::WheelEvent::WheelEvent):
1796
1797 2018-08-24  Jer Noble  <jer.noble@apple.com>
1798
1799         Using Touch Bar to scrub video on Youtube results in video playback freeze
1800         https://bugs.webkit.org/show_bug.cgi?id=188926
1801
1802         Reviewed by Eric Carlson.
1803
1804         Test: media/media-source/media-source-seek-twice.html
1805
1806         When converting from a double-precision float to a MediaTime, a certain amount of precision is lost. If that
1807         results in a round-trip between `float in -> MediaTime -> float out` where in != out, we will wait forever for
1808         the time jump observer to fire. Break the cycle by comparing m_lastSeekTime to the synchronizerTime only after
1809         m_lastSeekTime has been normalized into a rational-time value.
1810
1811         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
1812         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::seekInternal):
1813
1814 2018-08-24  Ryosuke Niwa  <rniwa@webkit.org>
1815
1816         Pass in IsComposed flag to Event constructors
1817         https://bugs.webkit.org/show_bug.cgi?id=188720
1818         <rdar://problem/43580387>
1819
1820         Reviewed by Simon Fraser.
1821
1822         This patch replaces the logic in Event::isComposed to decide whether an event is composed or not by
1823         explicitly passing IsComposed flag to Event constructor. This decouples being composed from whether
1824         an event is trusted and of a partciular event type, paving our way to make synthetic click event
1825         dispatched by an author script composable in webkit.org/b/170211.
1826
1827         This patch also removes IsTrusted from the argument list of event constructors and create functions
1828         to systematically eliminate the possibility of this patch making an event uncomposed by not setting
1829         IsComposed flag.
1830
1831         No new tests since there should be no behavioral change.
1832
1833         * dom/ClipboardEvent.cpp:
1834         (WebCore::ClipboardEvent::ClipboardEvent): A trusted ClipboardEvent is composed.
1835         * dom/ClipboardEvent.h:
1836         (WebCore::ClipboardEvent::ClipboardEvent): Removed IsTrusted from the variant which takes Init object
1837         to make sure this refactoring is correct.
1838         (WebCore::ClipboardEvent::create): Ditto.
1839         * dom/CompositionEvent.cpp:
1840         (WebCore::CompositionEvent::CompositionEvent): A trusted CompositionEvent is composed.
1841         * dom/CompositionEvent.h:
1842         * dom/Element.cpp:
1843         (WebCore::Element::dispatchMouseEvent): A trusted dblclick event is composed (this is a non-standard
1844         event but virtually every mouse event is composed so it makes sense to make this composed).
1845         * dom/Event.cpp:
1846         (WebCore::Event::Event):
1847         (WebCore::Event::create):
1848         (WebCore::Event::composed const): Deleted. The trival implementation moved to the header file.
1849         * dom/Event.h:
1850         (WebCore::Event::composed const):
1851         * dom/FocusEvent.cpp:
1852         (WebCore::FocusEvent::FocusEvent): A trusted Focus event is composed.
1853         * dom/FocusEvent.h:
1854         (WebCore::FocusEvent::create): Removed IsTrusted from Init variant for the correctness guarantee.
1855         (WebCore::FocusEvent::FocusEvent): Ditto.
1856         * dom/InputEvent.cpp:
1857         (WebCore::InputEvent::create): Removed IsTrusted from Init variant for the correctness guarantee.
1858         (WebCore::InputEvent::InputEvent): A trsuted InputEvent is composed.
1859         * dom/InputEvent.h:
1860         * dom/KeyboardEvent.cpp:
1861         (WebCore::KeyboardEvent::KeyboardEvent): A trsuted KeyboardEvent is composed.
1862         (WebCore::KeyboardEvent::create): Removed IsTrusted from Init variant for the correctness guarantee.
1863         * dom/KeyboardEvent.h:
1864         * dom/MouseEvent.cpp:
1865         (WebCore::MouseEvent::create): Removed IsTrusted from Init variant for the correctness guarantee.
1866         (WebCore::MouseEvent::MouseEvent): Explicitly take IsComposed flag from subclasses since simulated click
1867         does not currently compose.
1868         * dom/MouseEvent.h:
1869         * dom/MouseRelatedEvent.cpp:
1870         (WebCore::MouseRelatedEvent::MouseRelatedEvent): A trusted touch event is composed.
1871         * dom/MouseRelatedEvent.h:
1872         * dom/Node.cpp:
1873         (WebCore::Node::dispatchDOMActivateEvent): A trusted DOMActivateEvent event is composed.
1874         (WebCore::Node::dispatchInputEvent): A trusted input event is composed.
1875         * dom/SimulatedClick.cpp:
1876         (SimulatedMouseEvent::SimulatedMouseEvent): A simulated click is composed if it's a trusted event for now.
1877         This is the bug to be fixed in webkit.org/b/170211.
1878         * dom/TextEvent.cpp:
1879         (WebCore::TextEvent::TextEvent): A trsuted textInput event is composed.
1880         * dom/UIEvent.cpp:
1881         (WebCore::UIEvent::UIEvent): Added IsComposed as an argument to the variant which creates a trusted event,
1882         and removed IsTrusted from Init variant for the correctness guarantee.
1883         * dom/UIEvent.h:
1884         (WebCore::UIEvent::create): Ditto.
1885         * dom/UIEventWithKeyState.h:
1886         (WebCore::UIEventWithKeyState::UIEventWithKeyState): Ditto.
1887         * dom/WheelEvent.cpp:
1888         (WebCore::WheelEvent::WheelEvent): A trusted Wheel event, which is a subclass of MouseEvent, is composed.
1889         (WebCore::WheelEvent::create): Removed IsTrusted from Init variant for the correctness guarantee.
1890         * dom/WheelEvent.h:
1891         * editing/Editor.cpp:
1892         (WebCore::dispatchBeforeInputEvent):
1893         (WebCore::dispatchInputEvent):
1894         (WebCore::dispatchClipboardEvent): Call the newly added variant which takes DataTransfer directly so that
1895         we can remove IsTrusted from the variant which takes Init for the correctness guarantee.
1896         * page/EventHandler.cpp:
1897         (WebCore::EventHandler::dispatchDragEvent): A trusted mouse event is composed.
1898
1899 2018-08-24  Ryosuke Niwa  <rniwa@webkit.org>
1900
1901         Add getModifierState to MouseEvent
1902         https://bugs.webkit.org/show_bug.cgi?id=188913
1903         <rdar://problem/43668772>
1904
1905         Reviewed by Simon Fraser.
1906
1907         Moved getModifierState from KeyboardEvent to UIEventWithKeyState and exposed it in MouseEvent.
1908         See https://www.w3.org/TR/2016/WD-uievents-20160804/#mouseevent
1909
1910         This patch also fixes the bug that initMouseEvent was not clearing AltGraph and CapsLock states,
1911         which was preserved in the refactoring done in r235158.
1912
1913         Tests: fast/events/constructors/mouse-event-getModifierState.html
1914                fast/events/dblclick-event-getModifierState.html
1915
1916         * dom/KeyboardEvent.cpp:
1917         (WebCore::KeyboardEvent::getModifierState const): Moved to UIEventWithKeyState.
1918         * dom/KeyboardEvent.h:
1919         * dom/KeyboardEvent.idl: Insert a blank line to match the spec's IDL.
1920         * dom/MouseEvent.idl: Added getModifierState. 
1921         * dom/UIEventWithKeyState.cpp:
1922         (WebCore::UIEventWithKeyState::modifiersFromInitializer): Moved from the header file.
1923         (WebCore::UIEventWithKeyState::getModifierState const):
1924         (WebCore::UIEventWithKeyState::setModifierKeys): Moved from the header file.
1925         * dom/UIEventWithKeyState.h:
1926         (WebCore::UIEventWithKeyState::modifierKeys const):
1927         (WebCore::UIEventWithKeyState::setModifierKeys): Deleted the variant which didn't take altGraphKey
1928         since that variant behaves same as the one which takes altGraphKey.
1929
1930 2018-08-24  Youenn Fablet  <youenn@apple.com>
1931
1932         libwebrtc PeerConnection::AddTrack sometimes fail
1933         https://bugs.webkit.org/show_bug.cgi?id=188914
1934
1935         Reviewed by Eric Carlson.
1936
1937         AddTrack may fail so test the result and if not successful, make JS addTrack to throw an exception.
1938         This makes some tests to fail now.
1939         These tests should pass again when unified plan will be enabled.
1940         Covered by rebased tests.
1941
1942         * Modules/mediastream/PeerConnectionBackend.h:
1943         (WebCore::PeerConnectionBackend::notifyAddedTrack):
1944         * Modules/mediastream/RTCPeerConnection.cpp:
1945         (WebCore::RTCPeerConnection::addTrack):
1946         (WebCore::RTCPeerConnection::addTransceiver):
1947         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
1948         (WebCore::LibWebRTCMediaEndpoint::addTrack):
1949         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:
1950         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
1951         (WebCore::LibWebRTCPeerConnectionBackend::notifyAddedTrack):
1952         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h:
1953
1954 2018-08-24  Adrian Perez de Castro  <aperez@igalia.com>
1955
1956         [FreeType] Do not cast through GLib types in FontCustomPlatformDataFreeType.cpp
1957         https://bugs.webkit.org/show_bug.cgi?id=188919
1958
1959         Reviewed by Michael Catanzaro.
1960
1961         No new tests needed.
1962
1963         * platform/graphics/freetype/FontCustomPlatformDataFreeType.cpp:
1964         (WebCore::FontCustomPlatformData::FontCustomPlatformData): Cast
1965         through "void (*)(void)" instead of GCallback to avoid the warning
1966         produced by -Wcast-function-type.
1967
1968 2018-08-24  Andy Estes  <aestes@apple.com>
1969
1970         [Apple Pay] Allow $0 totals
1971         https://bugs.webkit.org/show_bug.cgi?id=185150
1972         <rdar://problem/39212331>
1973
1974         Reviewed by Dan Bernstein.
1975
1976         Relaxed payment request validation to allow $0 totals. This matches PassKit behavior.
1977
1978         Updated test cases in http/tests/ssl/applepay/.
1979
1980         * Modules/applepay/PaymentRequestValidator.mm:
1981         (WebCore::PaymentRequestValidator::validateTotal):
1982
1983 2018-08-24  Frederic Wang  <fwang@igalia.com>
1984
1985         Remove ScrollByPrecisePixel granularity
1986         https://bugs.webkit.org/show_bug.cgi?id=188915
1987
1988         Reviewed by Carlos Garcia Campos.
1989
1990         ScrollByPrecisePixel was introduced in bug 87535 and bug 91020 for Chromium Linux/Windows but
1991         it is no longer used.
1992
1993         No new tests, behavior unchanged.
1994
1995         * platform/ScrollAnimatorSmooth.cpp:
1996         (WebCore::ScrollAnimatorSmooth::scroll): Remove special handling for ScrollByPrecisePixel.
1997         * platform/ScrollTypes.h: Remove ScrollByPrecisePixel, it is never used.
1998         * platform/ScrollableArea.cpp:
1999         (WebCore::ScrollableArea::scroll): Remove special handling for ScrollByPrecisePixel.
2000         * platform/gtk/ScrollAnimatorGtk.cpp:
2001         (WebCore::ScrollAnimatorGtk::scroll): Remove special handling for ScrollByPrecisePixel.
2002
2003 2018-08-24  Antti Koivisto  <antti@apple.com>
2004
2005         Allow creating WeakPtrs to const objects
2006         https://bugs.webkit.org/show_bug.cgi?id=188785
2007
2008         Reviewed by Geoff Garen.
2009
2010         Remove some unneeded const_casts.
2011
2012         * css/MediaQueryEvaluator.cpp:
2013         (WebCore::MediaQueryEvaluator::MediaQueryEvaluator):
2014         (WebCore::MediaQueryEvaluator::evaluate const):
2015         * css/MediaQueryEvaluator.h:
2016         * rendering/FloatingObjects.cpp:
2017         (WebCore::ComputeFloatOffsetAdapter::ComputeFloatOffsetAdapter):
2018         (WebCore::ComputeFloatOffsetForFloatLayoutAdapter::ComputeFloatOffsetForFloatLayoutAdapter):
2019         (WebCore::ComputeFloatOffsetForLineLayoutAdapter::ComputeFloatOffsetForLineLayoutAdapter):
2020         (WebCore::FindNextFloatLogicalBottomAdapter::FindNextFloatLogicalBottomAdapter):
2021         (WebCore::FloatingObjects::FloatingObjects):
2022         * rendering/FloatingObjects.h:
2023         (WebCore::FloatingObjects::renderer const):
2024
2025 2018-08-24  Zan Dobersek  <zdobersek@igalia.com>
2026
2027         [CoordGraphics] Move inline methods on CoordinatedGraphicsLayer out-of-line
2028         https://bugs.webkit.org/show_bug.cgi?id=188916
2029
2030         Reviewed by Carlos Garcia Campos.
2031
2032         Style checker produced complaints that CoordinatedGraphicsLayer class is
2033         using inline-defined methods despite the WEBCORE_EXPORT macro being used
2034         for the whole class. Keep the macro where it is but instead move the
2035         method definitions out-of-line.
2036
2037         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
2038         (WebCore::CoordinatedGraphicsLayer::isCoordinatedGraphicsLayer const):
2039         (WebCore::CoordinatedGraphicsLayer::id const):
2040         (WebCore::CoordinatedGraphicsLayer::primaryLayerID const):
2041         (WebCore::CoordinatedGraphicsLayer::usesContentsLayer const):
2042         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h:
2043
2044 2018-08-24  Antti Koivisto  <antti@apple.com>
2045
2046         Use OptionSet::containsAny and containsAll in some more places
2047         https://bugs.webkit.org/show_bug.cgi?id=188885
2048
2049         Reviewed by Sam Weinig.
2050
2051         * page/PerformanceMonitor.cpp:
2052         (WebCore::PerformanceMonitor::activityStateChanged):
2053         * rendering/RenderLayer.cpp:
2054         (WebCore::RenderLayer::updateLayerPositionsAfterScroll):
2055         (WebCore::RenderLayer::paintLayerContents):
2056         (WebCore::RenderLayer::calculateClipRects const):
2057         * rendering/RenderLayerBacking.cpp:
2058         (WebCore::RenderLayerBacking::~RenderLayerBacking):
2059
2060 2018-08-23  Simon Fraser  <simon.fraser@apple.com>
2061
2062         Add support for dumping GC heap snapshots, and a viewer
2063         https://bugs.webkit.org/show_bug.cgi?id=186416
2064
2065         Reviewed by Joseph Pecoraro.
2066
2067         Make a way to dump information about the GC heap that is useful for looking for leaked
2068         or abandoned objects. This dump is obtained (on Apple platforms) via:
2069             notifyutil -p com.apple.WebKit.dumpGCHeap
2070         which writes a JSON file to /tmp which can then be loaded into the viewer in Tools/GCHeapInspector.
2071
2072         This leverages the heap snapshot used by Web Inspector, adding an alternate format for
2073         the snapshot JSON that adds additional data about objects and why they are GC roots.
2074         
2075         The generated bindings code is changed to include the output root reason from isReachableFromOpaqueRoots(),
2076         and to implement heapSnapshot() which provides the address of the wrapped object. A new IDL attribute,
2077         CustomHeapSnapshot, is used to allow custom heapSnapshot() implementations for classes like JSDocument
2078         that need to decorate the heap snapshot cell data with things like the document URL.
2079
2080         GCController registers a notifyutil callback which gathers the debug heap snapshot, and dumps it
2081         to a file in /tmp. The file path is printed out to the system log.
2082
2083         * bindings/js/DOMGCOutputConstraint.cpp:
2084         (WebCore::DOMGCOutputConstraint::executeImpl):
2085         * bindings/js/GCController.cpp:
2086         (WebCore::GCController::GCController):
2087         (WebCore::GCController::dumpHeap):
2088         * bindings/js/GCController.h:
2089         * bindings/js/JSCSSRuleListCustom.cpp:
2090         (WebCore::JSCSSRuleListOwner::isReachableFromOpaqueRoots):
2091         * bindings/js/JSCallbackData.cpp:
2092         (WebCore::JSCallbackDataWeak::WeakOwner::isReachableFromOpaqueRoots):
2093         * bindings/js/JSCallbackData.h:
2094         * bindings/js/JSCanvasRenderingContext2DCustom.cpp:
2095         (WebCore::JSCanvasRenderingContext2DOwner::isReachableFromOpaqueRoots):
2096         * bindings/js/JSDOMWindowCustom.cpp:
2097         (WebCore::JSDOMWindow::getOwnPropertySlot):
2098         (WebCore::JSDOMWindow::heapSnapshot):
2099         * bindings/js/JSDeprecatedCSSOMValueCustom.cpp:
2100         (WebCore::JSDeprecatedCSSOMValueOwner::isReachableFromOpaqueRoots):
2101         * bindings/js/JSDocumentCustom.cpp:
2102         (WebCore::JSDocument::heapSnapshot):
2103         * bindings/js/JSMicrotaskCallback.h:
2104         (WebCore::JSMicrotaskCallback::call):
2105         * bindings/js/JSMutationObserverCustom.cpp:
2106         (WebCore::JSMutationObserverOwner::isReachableFromOpaqueRoots):
2107         * bindings/js/JSNavigatorCustom.cpp:
2108         (WebCore::JSNavigator::visitAdditionalChildren):
2109         * bindings/js/JSNodeCustom.cpp:
2110         (WebCore::isReachableFromDOM):
2111         (WebCore::JSNodeOwner::isReachableFromOpaqueRoots):
2112         * bindings/js/JSNodeListCustom.cpp:
2113         (WebCore::JSNodeListOwner::isReachableFromOpaqueRoots):
2114         * bindings/js/JSOffscreenCanvasRenderingContext2DCustom.cpp:
2115         (WebCore::JSOffscreenCanvasRenderingContext2DOwner::isReachableFromOpaqueRoots):
2116         * bindings/js/JSPerformanceObserverCustom.cpp:
2117         (WebCore::JSPerformanceObserverOwner::isReachableFromOpaqueRoots):
2118         * bindings/js/JSPopStateEventCustom.cpp:
2119         * bindings/js/JSTextTrackCueCustom.cpp:
2120         (WebCore::JSTextTrackCueOwner::isReachableFromOpaqueRoots):
2121         * bindings/js/WebCoreTypedArrayController.cpp:
2122         (WebCore::WebCoreTypedArrayController::JSArrayBufferOwner::isReachableFromOpaqueRoots):
2123         * bindings/js/WebCoreTypedArrayController.h:
2124         * bindings/scripts/CodeGeneratorJS.pm:
2125         (GenerateHeader):
2126         (GenerateImplementation):
2127         * bindings/scripts/IDLAttributes.json:
2128         * bindings/scripts/test/JS/JSInterfaceName.cpp:
2129         (WebCore::JSInterfaceName::heapSnapshot):
2130         (WebCore::JSInterfaceNameOwner::isReachableFromOpaqueRoots):
2131         * bindings/scripts/test/JS/JSInterfaceName.h:
2132         * bindings/scripts/test/JS/JSMapLike.cpp:
2133         (WebCore::JSMapLike::heapSnapshot):
2134         (WebCore::JSMapLikeOwner::isReachableFromOpaqueRoots):
2135         * bindings/scripts/test/JS/JSMapLike.h:
2136         * bindings/scripts/test/JS/JSReadOnlyMapLike.cpp:
2137         (WebCore::JSReadOnlyMapLike::heapSnapshot):
2138         (WebCore::JSReadOnlyMapLikeOwner::isReachableFromOpaqueRoots):
2139         * bindings/scripts/test/JS/JSReadOnlyMapLike.h:
2140         * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
2141         (WebCore::JSTestActiveDOMObject::heapSnapshot):
2142         (WebCore::JSTestActiveDOMObjectOwner::isReachableFromOpaqueRoots):
2143         * bindings/scripts/test/JS/JSTestActiveDOMObject.h:
2144         * bindings/scripts/test/JS/JSTestCEReactions.cpp:
2145         (WebCore::JSTestCEReactions::heapSnapshot):
2146         (WebCore::JSTestCEReactionsOwner::isReachableFromOpaqueRoots):
2147         * bindings/scripts/test/JS/JSTestCEReactions.h:
2148         * bindings/scripts/test/JS/JSTestCEReactionsStringifier.cpp:
2149         (WebCore::JSTestCEReactionsStringifier::heapSnapshot):
2150         (WebCore::JSTestCEReactionsStringifierOwner::isReachableFromOpaqueRoots):
2151         * bindings/scripts/test/JS/JSTestCEReactionsStringifier.h:
2152         * bindings/scripts/test/JS/JSTestCallTracer.cpp:
2153         (WebCore::JSTestCallTracer::heapSnapshot):
2154         (WebCore::JSTestCallTracerOwner::isReachableFromOpaqueRoots):
2155         * bindings/scripts/test/JS/JSTestCallTracer.h:
2156         * bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.cpp:
2157         (WebCore::JSTestClassWithJSBuiltinConstructor::heapSnapshot):
2158         (WebCore::JSTestClassWithJSBuiltinConstructorOwner::isReachableFromOpaqueRoots):
2159         * bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.h:
2160         * bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.cpp:
2161         (WebCore::JSTestCustomConstructorWithNoInterfaceObject::heapSnapshot):
2162         (WebCore::JSTestCustomConstructorWithNoInterfaceObjectOwner::isReachableFromOpaqueRoots):
2163         * bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.h:
2164         * bindings/scripts/test/JS/JSTestDOMJIT.cpp:
2165         (WebCore::JSTestDOMJIT::heapSnapshot):
2166         * bindings/scripts/test/JS/JSTestDOMJIT.h:
2167         * bindings/scripts/test/JS/JSTestEnabledBySetting.cpp:
2168         (WebCore::JSTestEnabledBySetting::heapSnapshot):
2169         (WebCore::JSTestEnabledBySettingOwner::isReachableFromOpaqueRoots):
2170         * bindings/scripts/test/JS/JSTestEnabledBySetting.h:
2171         * bindings/scripts/test/JS/JSTestEventConstructor.cpp:
2172         (WebCore::JSTestEventConstructor::heapSnapshot):
2173         * bindings/scripts/test/JS/JSTestEventConstructor.h:
2174         * bindings/scripts/test/JS/JSTestEventTarget.cpp:
2175         (WebCore::JSTestEventTarget::heapSnapshot):
2176         * bindings/scripts/test/JS/JSTestEventTarget.h:
2177         * bindings/scripts/test/JS/JSTestException.cpp:
2178         (WebCore::JSTestException::heapSnapshot):
2179         (WebCore::JSTestExceptionOwner::isReachableFromOpaqueRoots):
2180         * bindings/scripts/test/JS/JSTestException.h:
2181         * bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp:
2182         (WebCore::JSTestGenerateIsReachable::heapSnapshot):
2183         (WebCore::JSTestGenerateIsReachableOwner::isReachableFromOpaqueRoots):
2184         * bindings/scripts/test/JS/JSTestGenerateIsReachable.h:
2185         * bindings/scripts/test/JS/JSTestGlobalObject.cpp:
2186         (WebCore::JSTestGlobalObject::heapSnapshot):
2187         (WebCore::JSTestGlobalObjectOwner::isReachableFromOpaqueRoots):
2188         * bindings/scripts/test/JS/JSTestGlobalObject.h:
2189         * bindings/scripts/test/JS/JSTestIndexedSetterNoIdentifier.cpp:
2190         (WebCore::JSTestIndexedSetterNoIdentifier::heapSnapshot):
2191         (WebCore::JSTestIndexedSetterNoIdentifierOwner::isReachableFromOpaqueRoots):
2192         * bindings/scripts/test/JS/JSTestIndexedSetterNoIdentifier.h:
2193         * bindings/scripts/test/JS/JSTestIndexedSetterThrowingException.cpp:
2194         (WebCore::JSTestIndexedSetterThrowingException::heapSnapshot):
2195         (WebCore::JSTestIndexedSetterThrowingExceptionOwner::isReachableFromOpaqueRoots):
2196         * bindings/scripts/test/JS/JSTestIndexedSetterThrowingException.h:
2197         * bindings/scripts/test/JS/JSTestIndexedSetterWithIdentifier.cpp:
2198         (WebCore::JSTestIndexedSetterWithIdentifier::heapSnapshot):
2199         (WebCore::JSTestIndexedSetterWithIdentifierOwner::isReachableFromOpaqueRoots):
2200         * bindings/scripts/test/JS/JSTestIndexedSetterWithIdentifier.h:
2201         * bindings/scripts/test/JS/JSTestInterface.cpp:
2202         (WebCore::JSTestInterface::heapSnapshot):
2203         (WebCore::JSTestInterfaceOwner::isReachableFromOpaqueRoots):
2204         * bindings/scripts/test/JS/JSTestInterface.h:
2205         * bindings/scripts/test/JS/JSTestInterfaceLeadingUnderscore.cpp:
2206         (WebCore::JSTestInterfaceLeadingUnderscore::heapSnapshot):
2207         (WebCore::JSTestInterfaceLeadingUnderscoreOwner::isReachableFromOpaqueRoots):
2208         * bindings/scripts/test/JS/JSTestInterfaceLeadingUnderscore.h:
2209         * bindings/scripts/test/JS/JSTestIterable.cpp:
2210         (WebCore::JSTestIterable::heapSnapshot):
2211         (WebCore::JSTestIterableOwner::isReachableFromOpaqueRoots):
2212         * bindings/scripts/test/JS/JSTestIterable.h:
2213         * bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp:
2214         (WebCore::JSTestMediaQueryListListener::heapSnapshot):
2215         (WebCore::JSTestMediaQueryListListenerOwner::isReachableFromOpaqueRoots):
2216         * bindings/scripts/test/JS/JSTestMediaQueryListListener.h:
2217         * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterNoIdentifier.cpp:
2218         (WebCore::JSTestNamedAndIndexedSetterNoIdentifier::heapSnapshot):
2219         (WebCore::JSTestNamedAndIndexedSetterNoIdentifierOwner::isReachableFromOpaqueRoots):
2220         * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterNoIdentifier.h:
2221         * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterThrowingException.cpp:
2222         (WebCore::JSTestNamedAndIndexedSetterThrowingException::heapSnapshot):
2223         (WebCore::JSTestNamedAndIndexedSetterThrowingExceptionOwner::isReachableFromOpaqueRoots):
2224         * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterThrowingException.h:
2225         * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterWithIdentifier.cpp:
2226         (WebCore::JSTestNamedAndIndexedSetterWithIdentifier::heapSnapshot):
2227         (WebCore::JSTestNamedAndIndexedSetterWithIdentifierOwner::isReachableFromOpaqueRoots):
2228         * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterWithIdentifier.h:
2229         * bindings/scripts/test/JS/JSTestNamedConstructor.cpp:
2230         (WebCore::JSTestNamedConstructor::heapSnapshot):
2231         (WebCore::JSTestNamedConstructorOwner::isReachableFromOpaqueRoots):
2232         * bindings/scripts/test/JS/JSTestNamedConstructor.h:
2233         * bindings/scripts/test/JS/JSTestNamedDeleterNoIdentifier.cpp:
2234         (WebCore::JSTestNamedDeleterNoIdentifier::heapSnapshot):
2235         (WebCore::JSTestNamedDeleterNoIdentifierOwner::isReachableFromOpaqueRoots):
2236         * bindings/scripts/test/JS/JSTestNamedDeleterNoIdentifier.h:
2237         * bindings/scripts/test/JS/JSTestNamedDeleterThrowingException.cpp:
2238         (WebCore::JSTestNamedDeleterThrowingException::heapSnapshot):
2239         (WebCore::JSTestNamedDeleterThrowingExceptionOwner::isReachableFromOpaqueRoots):
2240         * bindings/scripts/test/JS/JSTestNamedDeleterThrowingException.h:
2241         * bindings/scripts/test/JS/JSTestNamedDeleterWithIdentifier.cpp:
2242         (WebCore::JSTestNamedDeleterWithIdentifier::heapSnapshot):
2243         (WebCore::JSTestNamedDeleterWithIdentifierOwner::isReachableFromOpaqueRoots):
2244         * bindings/scripts/test/JS/JSTestNamedDeleterWithIdentifier.h:
2245         * bindings/scripts/test/JS/JSTestNamedDeleterWithIndexedGetter.cpp:
2246         (WebCore::JSTestNamedDeleterWithIndexedGetter::heapSnapshot):
2247         (WebCore::JSTestNamedDeleterWithIndexedGetterOwner::isReachableFromOpaqueRoots):
2248         * bindings/scripts/test/JS/JSTestNamedDeleterWithIndexedGetter.h:
2249         * bindings/scripts/test/JS/JSTestNamedGetterCallWith.cpp:
2250         (WebCore::JSTestNamedGetterCallWith::heapSnapshot):
2251         (WebCore::JSTestNamedGetterCallWithOwner::isReachableFromOpaqueRoots):
2252         * bindings/scripts/test/JS/JSTestNamedGetterCallWith.h:
2253         * bindings/scripts/test/JS/JSTestNamedGetterNoIdentifier.cpp:
2254         (WebCore::JSTestNamedGetterNoIdentifier::heapSnapshot):
2255         (WebCore::JSTestNamedGetterNoIdentifierOwner::isReachableFromOpaqueRoots):
2256         * bindings/scripts/test/JS/JSTestNamedGetterNoIdentifier.h:
2257         * bindings/scripts/test/JS/JSTestNamedGetterWithIdentifier.cpp:
2258         (WebCore::JSTestNamedGetterWithIdentifier::heapSnapshot):
2259         (WebCore::JSTestNamedGetterWithIdentifierOwner::isReachableFromOpaqueRoots):
2260         * bindings/scripts/test/JS/JSTestNamedGetterWithIdentifier.h:
2261         * bindings/scripts/test/JS/JSTestNamedSetterNoIdentifier.cpp:
2262         (WebCore::JSTestNamedSetterNoIdentifier::heapSnapshot):
2263         (WebCore::JSTestNamedSetterNoIdentifierOwner::isReachableFromOpaqueRoots):
2264         * bindings/scripts/test/JS/JSTestNamedSetterNoIdentifier.h:
2265         * bindings/scripts/test/JS/JSTestNamedSetterThrowingException.cpp:
2266         (WebCore::JSTestNamedSetterThrowingException::heapSnapshot):
2267         (WebCore::JSTestNamedSetterThrowingExceptionOwner::isReachableFromOpaqueRoots):
2268         * bindings/scripts/test/JS/JSTestNamedSetterThrowingException.h:
2269         * bindings/scripts/test/JS/JSTestNamedSetterWithIdentifier.cpp:
2270         (WebCore::JSTestNamedSetterWithIdentifier::heapSnapshot):
2271         (WebCore::JSTestNamedSetterWithIdentifierOwner::isReachableFromOpaqueRoots):
2272         * bindings/scripts/test/JS/JSTestNamedSetterWithIdentifier.h:
2273         * bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetter.cpp:
2274         (WebCore::JSTestNamedSetterWithIndexedGetter::heapSnapshot):
2275         (WebCore::JSTestNamedSetterWithIndexedGetterOwner::isReachableFromOpaqueRoots):
2276         * bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetter.h:
2277         * bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetterAndSetter.cpp:
2278         (WebCore::JSTestNamedSetterWithIndexedGetterAndSetter::heapSnapshot):
2279         (WebCore::JSTestNamedSetterWithIndexedGetterAndSetterOwner::isReachableFromOpaqueRoots):
2280         * bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetterAndSetter.h:
2281         * bindings/scripts/test/JS/JSTestNamedSetterWithOverrideBuiltins.cpp:
2282         (WebCore::JSTestNamedSetterWithOverrideBuiltins::heapSnapshot):
2283         (WebCore::JSTestNamedSetterWithOverrideBuiltinsOwner::isReachableFromOpaqueRoots):
2284         * bindings/scripts/test/JS/JSTestNamedSetterWithOverrideBuiltins.h:
2285         * bindings/scripts/test/JS/JSTestNamedSetterWithUnforgableProperties.cpp:
2286         (WebCore::JSTestNamedSetterWithUnforgableProperties::heapSnapshot):
2287         (WebCore::JSTestNamedSetterWithUnforgablePropertiesOwner::isReachableFromOpaqueRoots):
2288         * bindings/scripts/test/JS/JSTestNamedSetterWithUnforgableProperties.h:
2289         * bindings/scripts/test/JS/JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins.cpp:
2290         (WebCore::JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins::heapSnapshot):
2291         (WebCore::JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltinsOwner::isReachableFromOpaqueRoots):
2292         * bindings/scripts/test/JS/JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins.h:
2293         * bindings/scripts/test/JS/JSTestNode.cpp:
2294         (WebCore::JSTestNode::heapSnapshot):
2295         * bindings/scripts/test/JS/JSTestNode.h:
2296         * bindings/scripts/test/JS/JSTestObj.cpp:
2297         (WebCore::JSTestObj::heapSnapshot):
2298         (WebCore::JSTestObjOwner::isReachableFromOpaqueRoots):
2299         * bindings/scripts/test/JS/JSTestObj.h:
2300         * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
2301         (WebCore::JSTestOverloadedConstructors::heapSnapshot):
2302         (WebCore::JSTestOverloadedConstructorsOwner::isReachableFromOpaqueRoots):
2303         * bindings/scripts/test/JS/JSTestOverloadedConstructors.h:
2304         * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.cpp:
2305         (WebCore::JSTestOverloadedConstructorsWithSequence::heapSnapshot):
2306         (WebCore::JSTestOverloadedConstructorsWithSequenceOwner::isReachableFromOpaqueRoots):
2307         * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.h:
2308         * bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp:
2309         (WebCore::JSTestOverrideBuiltins::heapSnapshot):
2310         (WebCore::JSTestOverrideBuiltinsOwner::isReachableFromOpaqueRoots):
2311         * bindings/scripts/test/JS/JSTestOverrideBuiltins.h:
2312         * bindings/scripts/test/JS/JSTestPluginInterface.cpp:
2313         (WebCore::JSTestPluginInterface::heapSnapshot):
2314         (WebCore::JSTestPluginInterfaceOwner::isReachableFromOpaqueRoots):
2315         * bindings/scripts/test/JS/JSTestPluginInterface.h:
2316         * bindings/scripts/test/JS/JSTestPromiseRejectionEvent.cpp:
2317         (WebCore::JSTestPromiseRejectionEvent::heapSnapshot):
2318         * bindings/scripts/test/JS/JSTestPromiseRejectionEvent.h:
2319         * bindings/scripts/test/JS/JSTestSerialization.cpp:
2320         (WebCore::JSTestSerialization::heapSnapshot):
2321         (WebCore::JSTestSerializationOwner::isReachableFromOpaqueRoots):
2322         * bindings/scripts/test/JS/JSTestSerialization.h:
2323         * bindings/scripts/test/JS/JSTestSerializationIndirectInheritance.cpp:
2324         (WebCore::JSTestSerializationIndirectInheritance::heapSnapshot):
2325         * bindings/scripts/test/JS/JSTestSerializationIndirectInheritance.h:
2326         * bindings/scripts/test/JS/JSTestSerializationInherit.cpp:
2327         (WebCore::JSTestSerializationInherit::heapSnapshot):
2328         * bindings/scripts/test/JS/JSTestSerializationInherit.h:
2329         * bindings/scripts/test/JS/JSTestSerializationInheritFinal.cpp:
2330         (WebCore::JSTestSerializationInheritFinal::heapSnapshot):
2331         * bindings/scripts/test/JS/JSTestSerializationInheritFinal.h:
2332         * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
2333         (WebCore::JSTestSerializedScriptValueInterface::heapSnapshot):
2334         (WebCore::JSTestSerializedScriptValueInterfaceOwner::isReachableFromOpaqueRoots):
2335         * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.h:
2336         * bindings/scripts/test/JS/JSTestStringifier.cpp:
2337         (WebCore::JSTestStringifier::heapSnapshot):
2338         (WebCore::JSTestStringifierOwner::isReachableFromOpaqueRoots):
2339         * bindings/scripts/test/JS/JSTestStringifier.h:
2340         * bindings/scripts/test/JS/JSTestStringifierAnonymousOperation.cpp:
2341         (WebCore::JSTestStringifierAnonymousOperation::heapSnapshot):
2342         (WebCore::JSTestStringifierAnonymousOperationOwner::isReachableFromOpaqueRoots):
2343         * bindings/scripts/test/JS/JSTestStringifierAnonymousOperation.h:
2344         * bindings/scripts/test/JS/JSTestStringifierNamedOperation.cpp:
2345         (WebCore::JSTestStringifierNamedOperation::heapSnapshot):
2346         (WebCore::JSTestStringifierNamedOperationOwner::isReachableFromOpaqueRoots):
2347         * bindings/scripts/test/JS/JSTestStringifierNamedOperation.h:
2348         * bindings/scripts/test/JS/JSTestStringifierOperationImplementedAs.cpp:
2349         (WebCore::JSTestStringifierOperationImplementedAs::heapSnapshot):
2350         (WebCore::JSTestStringifierOperationImplementedAsOwner::isReachableFromOpaqueRoots):
2351         * bindings/scripts/test/JS/JSTestStringifierOperationImplementedAs.h:
2352         * bindings/scripts/test/JS/JSTestStringifierOperationNamedToString.cpp:
2353         (WebCore::JSTestStringifierOperationNamedToString::heapSnapshot):
2354         (WebCore::JSTestStringifierOperationNamedToStringOwner::isReachableFromOpaqueRoots):
2355         * bindings/scripts/test/JS/JSTestStringifierOperationNamedToString.h:
2356         * bindings/scripts/test/JS/JSTestStringifierReadOnlyAttribute.cpp:
2357         (WebCore::JSTestStringifierReadOnlyAttribute::heapSnapshot):
2358         (WebCore::JSTestStringifierReadOnlyAttributeOwner::isReachableFromOpaqueRoots):
2359         * bindings/scripts/test/JS/JSTestStringifierReadOnlyAttribute.h:
2360         * bindings/scripts/test/JS/JSTestStringifierReadWriteAttribute.cpp:
2361         (WebCore::JSTestStringifierReadWriteAttribute::heapSnapshot):
2362         (WebCore::JSTestStringifierReadWriteAttributeOwner::isReachableFromOpaqueRoots):
2363         * bindings/scripts/test/JS/JSTestStringifierReadWriteAttribute.h:
2364         * bindings/scripts/test/JS/JSTestTypedefs.cpp:
2365         (WebCore::JSTestTypedefs::heapSnapshot):
2366         (WebCore::JSTestTypedefsOwner::isReachableFromOpaqueRoots):
2367         * bindings/scripts/test/JS/JSTestTypedefs.h:
2368         * dom/Document.idl:
2369         * page/DOMWindow.idl:
2370
2371 2018-08-23  Ryosuke Niwa  <rniwa@webkit.org>
2372
2373         initKeyboardEvent doesn't clear CapsLock state
2374         https://bugs.webkit.org/show_bug.cgi?id=188909
2375
2376         Reviewed by Wenson Hsieh.
2377
2378         Fixed the bug by not preserving CapsLock state in setModifierKeys variant which takes boolean
2379         for altGraphKey, which is only called by KeyboardEvent::initKeyboardEvent.
2380
2381         Test: fast/events/init-event-clears-capslock.html
2382
2383         * dom/UIEventWithKeyState.h:
2384         (WebCore::UIEventWithKeyState::setModifierKeys):
2385
2386 2018-08-23  Aditya Keerthi  <akeerthi@apple.com>
2387
2388         Unreviewed, fix the Windows build after r235245.
2389
2390         * html/InputMode.cpp:
2391         (WebCore::stringForInputMode):
2392
2393 2018-08-23  Saam barati  <sbarati@apple.com>
2394
2395         JSRunLoopTimer may run part of a member function after it's destroyed
2396         https://bugs.webkit.org/show_bug.cgi?id=188426
2397
2398         Reviewed by Mark Lam.
2399
2400         * page/cocoa/ResourceUsageThreadCocoa.mm:
2401         (WebCore::ResourceUsageThread::platformThreadBody):
2402         * page/linux/ResourceUsageThreadLinux.cpp:
2403         (WebCore::ResourceUsageThread::platformThreadBody):
2404
2405 2018-08-23  David Fenton  <david_fenton@apple.com>
2406
2407         Unreviewed, rolling out r235129.
2408
2409         broke internal builds
2410
2411         Reverted changeset:
2412
2413         "Allow creating WeakPtrs to const objects"
2414         https://bugs.webkit.org/show_bug.cgi?id=188785
2415         https://trac.webkit.org/changeset/235129
2416
2417 2018-08-23  Daniel Bates  <dabates@apple.com>
2418
2419         [iOS] Test editing/undo/replace-text-in-node-preserving-markers-crash.html crashes
2420         https://bugs.webkit.org/show_bug.cgi?id=188898
2421
2422         Reviewed by Simon Fraser.
2423
2424         Not all document markers may have a dictation metadata on iOS.
2425
2426         Currently we assume that every marker has dictation alternatives (i.e. DocumentMarker::alternatives()
2427         can be called) when deleting a selection preserving document markers on iOS. However, only markers
2428         for dictation may have dictation alternatives. For example, document markers for misspelled words do
2429         not have dictation metadata by definition. Instead of assuming every marker has dictation alternatives
2430         on iOS we need to check the marker type to determine whether it has associated dictation metadata and
2431         invoke the appropriate DocumentMarkerController::addMarker() overload.
2432
2433         * dom/DocumentMarker.h:
2434         (WebCore::DocumentMarker::isDictation const): Added.
2435         * editing/CompositeEditCommand.cpp:
2436         (WebCore::CompositeEditCommand::replaceTextInNodePreservingMarkers): Only access DocumentMarker::alternatives()
2437         and add a dictation marker on iOS if the marker is a dictation marker.
2438
2439 2018-08-23  Mark Lam  <mark.lam@apple.com>
2440
2441         Move vmEntryGlobalObject() to VM from CallFrame.
2442         https://bugs.webkit.org/show_bug.cgi?id=188900
2443         <rdar://problem/43655753>
2444
2445         Reviewed by Michael Saboff.
2446
2447         No new tests needed because this patch does not introduce new functionality.
2448
2449         * bindings/js/JSCustomXPathNSResolver.cpp:
2450         (WebCore::JSCustomXPathNSResolver::create):
2451         * bindings/js/JSDOMGlobalObject.cpp:
2452         (WebCore::callerGlobalObject):
2453         (WebCore::toJSDOMGlobalObject): Deleted.
2454         * bindings/js/JSDOMWindowBase.cpp:
2455         (WebCore::firstDOMWindow):
2456         * bridge/c/c_utility.cpp:
2457         (JSC::Bindings::convertValueToNPVariant):
2458         * bridge/objc/WebScriptObject.mm:
2459         (WebCore::addExceptionToConsole):
2460         * bridge/objc/objc_instance.mm:
2461         (ObjcInstance::moveGlobalExceptionToExecState):
2462         * bridge/objc/objc_runtime.mm:
2463         (JSC::Bindings::convertValueToObjcObject):
2464         * bridge/objc/objc_utility.mm:
2465         (JSC::Bindings::convertValueToObjcValue):
2466         * testing/Internals.cpp:
2467         (WebCore::Internals::cloneArrayBuffer):
2468
2469 2018-08-23  Andy Estes  <aestes@apple.com>
2470
2471         [Apple Pay] Introduce Apple Pay JS v4 on iOS 12 and macOS Mojave
2472         https://bugs.webkit.org/show_bug.cgi?id=188829
2473
2474         Reviewed by Tim Horton.
2475
2476         Test: http/tests/ssl/applepay/ApplePaySessionV4.html
2477
2478         * Configurations/FeatureDefines.xcconfig:
2479         * testing/MockPaymentCoordinator.cpp:
2480         (WebCore::MockPaymentCoordinator::supportsVersion):
2481
2482 2018-08-23  Devin Rousso  <drousso@apple.com>
2483
2484         Web Inspector: support breakpoints for timers and animation-frame events
2485         https://bugs.webkit.org/show_bug.cgi?id=188778
2486
2487         Reviewed by Brian Burg.
2488
2489         The original implementation of "instrumentation" breakpoints relied upon the frontend
2490         sending somewhat arbitrary strings when enabling breakpoints for specific events. As an
2491         example, setting a breakpoint for `requestAnimationFrame` expects `"animationFrameFired"`
2492         as the string, which doesn't make much sense. This patch removes the usage of these strings
2493         and instead expects the agent to implement a method that matches what is happening.
2494
2495         Tests: inspector/dom-debugger/event-animation-frame-breakpoints.html
2496                inspector/dom-debugger/event-listener-breakpoints.html
2497                inspector/dom-debugger/event-timer-breakpoints.html
2498
2499         * inspector/InspectorInstrumentation.h:
2500         (WebCore::InspectorInstrumentation::willFireTimer):
2501         * inspector/InspectorInstrumentation.cpp:
2502         (WebCore::InspectorInstrumentation::didInstallTimerImpl):
2503         (WebCore::InspectorInstrumentation::didRemoveTimerImpl):
2504         (WebCore::InspectorInstrumentation::willFireTimerImpl):
2505         (WebCore::InspectorInstrumentation::didRequestAnimationFrameImpl):
2506         (WebCore::InspectorInstrumentation::didCancelAnimationFrameImpl):
2507         (WebCore::InspectorInstrumentation::willFireAnimationFrameImpl):
2508         (WebCore::InspectorInstrumentation::pauseOnNativeEventIfNeeded): Deleted.
2509
2510         * inspector/agents/InspectorDOMDebuggerAgent.h:
2511         * inspector/agents/InspectorDOMDebuggerAgent.cpp:
2512         (WebCore::InspectorDOMDebuggerAgent::setEventBreakpoint): Added.
2513         (WebCore::InspectorDOMDebuggerAgent::removeEventBreakpoint): Added.
2514         (WebCore::InspectorDOMDebuggerAgent::willHandleEvent):
2515         (WebCore::InspectorDOMDebuggerAgent::willFireTimer): Added.
2516         (WebCore::InspectorDOMDebuggerAgent::willFireAnimationFrame): Added.
2517         (WebCore::InspectorDOMDebuggerAgent::setEventListenerBreakpoint): Deleted.
2518         (WebCore::InspectorDOMDebuggerAgent::setInstrumentationBreakpoint): Deleted.
2519         (WebCore::InspectorDOMDebuggerAgent::setBreakpoint): Deleted.
2520         (WebCore::InspectorDOMDebuggerAgent::removeEventListenerBreakpoint): Deleted.
2521         (WebCore::InspectorDOMDebuggerAgent::removeInstrumentationBreakpoint): Deleted.
2522         (WebCore::InspectorDOMDebuggerAgent::removeBreakpoint): Deleted.
2523         (WebCore::InspectorDOMDebuggerAgent::pauseOnNativeEventIfNeeded): Deleted.
2524         Unify the event listener and instrumentation breakpoint commands into a single method,
2525         `setEventBreakpoint`, that takes in both an `EventBreakpointType` and `eventName`.
2526
2527         * page/DOMTimer.cpp:
2528         (WebCore::DOMTimer::fired):
2529
2530 2018-08-23  Aditya Keerthi  <akeerthi@apple.com>
2531
2532         [iOS] Support the inputmode attribute on contenteditable elements
2533         https://bugs.webkit.org/show_bug.cgi?id=188878
2534
2535         Reviewed by Ryosuke Niwa.
2536
2537         The inputmode attribute should apply to contenteditable elements, in addition to
2538         textfield inputs and textareas.
2539
2540         Moved the inputmode attribute from HTMLInputElement.idl and
2541         HTMLTextAreaElement.idl to HTMLElement.idl to reflect the specification.
2542
2543         Also moved all logic to convert between the InputMode enum and string values
2544         into InputMode.cpp to avoid exposing unnecessary details to WebKit. Furthermore,
2545         InputMode::Auto was renamed to InputMode::Unspecified to avoid confusion with the
2546         specification.
2547
2548         Spec: https://html.spec.whatwg.org/multipage/interaction.html#input-modalities:-the-inputmode-attribute
2549
2550         Tests: fast/forms/inputmode-attribute-contenteditable.html
2551                fast/forms/inputmode-attribute-input.html
2552                fast/forms/inputmode-attribute-textarea.html
2553
2554         * Sources.txt:
2555         * WebCore.xcodeproj/project.pbxproj:
2556         * html/HTMLElement.cpp:
2557         (WebCore::HTMLElement::canonicalInputMode const):
2558         (WebCore::HTMLElement::inputMode const):
2559         (WebCore::HTMLElement::setInputMode):
2560         * html/HTMLElement.h:
2561         * html/HTMLElement.idl:
2562         * html/HTMLInputElement.idl:
2563         * html/HTMLTextAreaElement.idl:
2564         * html/HTMLTextFormControlElement.cpp:
2565         * html/HTMLTextFormControlElement.h:
2566         * html/InputMode.cpp: Renamed from Source/WebCore/html/InputModeNames.cpp.
2567         (WebCore::inputModeForAttributeValue):
2568         (WebCore::stringForInputMode):
2569         * html/InputMode.h: Renamed from Source/WebCore/html/InputModeNames.h.
2570
2571 2018-08-23  Eric Carlson  <eric.carlson@apple.com>
2572
2573         [MediaStream] Store video preset sizes in a map
2574         https://bugs.webkit.org/show_bug.cgi?id=188866
2575         <rdar://problem/43622643>
2576
2577         Reviewed by Youenn Fablet.
2578
2579         No new tests, tested manually.
2580
2581         * platform/mediastream/mac/AVVideoCaptureSource.h:
2582         * platform/mediastream/mac/AVVideoCaptureSource.mm:
2583         (WebCore::AVVideoCaptureSource::AVVideoCaptureSource):
2584         (WebCore::AVVideoCaptureSource::initializeCapabilities):
2585         (WebCore::AVVideoCaptureSource::sizeForPreset):
2586         (WebCore::AVVideoCaptureSource::setPreset):
2587         (WebCore::AVVideoCaptureSource::bestSessionPresetForVideoDimensions):
2588         (WebCore::sizeForPreset): Deleted.
2589         (WebCore::AVVideoCaptureSource::bestSessionPresetForVideoDimensions const): Deleted.
2590
2591 2018-08-23  Ryan Haddad  <ryanhaddad@apple.com>
2592
2593         Unreviewed, attempt to fix the build after r235230.
2594
2595         * platform/mediastream/mac/RealtimeOutgoingVideoSourceCocoa.cpp:
2596
2597 2018-08-23  Youenn Fablet  <youenn@apple.com>
2598
2599         Update libwebrtc up to 984f1a80c0
2600         https://bugs.webkit.org/show_bug.cgi?id=188745
2601         <rdar://problem/43539177>
2602
2603         Reviewed by Eric Carlson.
2604
2605         Updated implementation according new webrtc backend.
2606         Instead of modifying libwebrtc header files, we disable unused parameter warning for such headers included in WebCore.
2607         WebCore implementation is updated according new webrtc API, mostly AddRef/Release.
2608         RealtimeOutgoingVideoSource now uses a pixel convolver to convert RGB pixel buffers as I420.
2609
2610         Covered by existing tests.
2611
2612         * CMakeLists.txt:
2613         * Modules/mediastream/libwebrtc/LibWebRTCDataChannelHandler.h:
2614         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
2615         (WebCore::LibWebRTCMediaEndpoint::addTrack):
2616         (WebCore::LibWebRTCMediaEndpoint::mediaStreamFromRTCStream):
2617         (WebCore::fillEncodingParameters):
2618         (WebCore::fillRtpParameters):
2619         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:
2620         (WebCore::LibWebRTCMediaEndpoint::Release const):
2621         * WebCore.xcodeproj/project.pbxproj:
2622         * platform/mediastream/RealtimeIncomingAudioSource.h:
2623         * platform/mediastream/RealtimeIncomingVideoSource.h:
2624         * platform/mediastream/RealtimeMediaSource.cpp:
2625         (WebCore::RealtimeMediaSource::supportsSizeAndFrameRate):
2626         (WebCore::RealtimeMediaSource::supportsConstraint const):
2627         (WebCore::RealtimeMediaSource::supportsConstraints):
2628         * platform/mediastream/RealtimeOutgoingAudioSource.h:
2629         * platform/mediastream/RealtimeOutgoingVideoSource.h:
2630         * platform/mediastream/libwebrtc/GStreamerVideoDecoderFactory.cpp:
2631         (WebCore::GStreamerVideoDecoder::newSampleCallback):
2632         * platform/mediastream/libwebrtc/GStreamerVideoEncoderFactory.cpp:
2633         (WebCore::GStreamerVideoEncoder::GStreamerVideoEncoder):
2634         (WebCore::GStreamerVideoEncoder::newSampleCallback):
2635         * platform/mediastream/libwebrtc/LibWebRTCProvider.h:
2636         * platform/mediastream/libwebrtc/LibWebRTCAudioModule.h:
2637         * platform/mediastream/libwebrtc/LibWebRTCProvider.cpp:
2638         * platform/mediastream/libwebrtc/LibWebRTCProvider.h:
2639         * platform/mediastream/mac/MockRealtimeVideoSourceMac.mm:
2640         (WebCore::MockRealtimeVideoSourceMac::CMSampleBufferFromPixelBuffer):
2641         * platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.mm:
2642         * platform/mediastream/mac/RealtimeOutgoingVideoSourceCocoa.cpp:
2643         (WebCore::ConvertToI420):
2644         (WebCore::RealtimeOutgoingVideoSourceCocoa::sampleBufferUpdated):
2645         * platform/mediastream/mac/RealtimeOutgoingVideoSourceCocoa.h:
2646         * platform/mediastream/mac/RealtimeOutgoingVideoSourceCocoa.mm: Added.
2647         (WebCore::RealtimeOutgoingVideoSourceCocoa::convertToYUV):
2648         * testing/MockLibWebRTCPeerConnection.cpp:
2649         (WebCore::MockLibWebRTCPeerConnection::AddTrack):
2650         * testing/MockLibWebRTCPeerConnection.h:
2651         (WebCore::MockRtpSender::GetParameters):
2652         (WebCore::MockRtpSender::SetParameters):
2653
2654 2018-08-23  Wenson Hsieh  <wenson_hsieh@apple.com>
2655
2656         [Attachment Support] Attachment elements don't appear in drag images on macOS
2657         https://bugs.webkit.org/show_bug.cgi?id=188823
2658         <rdar://problem/43616378>
2659
2660         Reviewed by Tim Horton.
2661
2662         Currently, attachment elements don't show up in the drag image snapshot on macOS. This is because only the
2663         "Selection" phase is painted when generating a drag image on macOS, and many replaced renderers (with some
2664         exceptions, such as RenderImage) only paint visible content during the "Foreground" phase. To fix this, we
2665         override RenderAttachment::paintReplaced to paint the attachment in the case where the Selection phase is being
2666         painted.
2667
2668         Tests:  WKAttachmentTestsMac.DragAttachmentAsFilePromise
2669                 WKAttachmentTests.MoveAttachmentElementAsIconByDragging
2670
2671         * rendering/RenderAttachment.cpp:
2672         (WebCore::RenderAttachment::paintReplaced):
2673         * rendering/RenderAttachment.h:
2674         * rendering/RenderThemeMac.mm:
2675         (WebCore::titleTextColorForAttachment):
2676         (WebCore::AttachmentLayout::layOutTitle):
2677
2678         Plumb an AttachmentLayoutStyle (i.e. NonSelected or Selected) to AttachmentLayout, and use this bit when
2679         determining the title text color, as well whether to paint backgrounds for the icon and title.
2680
2681         (WebCore::AttachmentLayout::AttachmentLayout):
2682         (WebCore::RenderThemeMac::attachmentIntrinsicSize const):
2683         (WebCore::RenderThemeMac::attachmentBaseline const):
2684         (WebCore::paintAttachmentIconBackground):
2685         (WebCore::paintAttachmentTitleBackground):
2686
2687         Bail from painting backgrounds if a selected style is used for the attachment.
2688
2689         (WebCore::RenderThemeMac::paintAttachment):
2690
2691         Rather than check the RenderAttachment's selection state when determining whether to paint with a non-selected
2692         or selected style, only use selected style if the RenderAttachment has a selection _and_ the painting phase is
2693         not "Selection". While this sounds extremely counter-intuitive, the "Selection" painting phase refers to
2694         painting the selected foreground content _without_ including any part of the selection highlight.
2695
2696 2018-08-23  Zalan Bujtas  <zalan@apple.com>
2697
2698         [LFC][Floating] Decouple the incoming floats and floats already placed in the list
2699         https://bugs.webkit.org/show_bug.cgi?id=188886
2700
2701         Reviewed by Antti Koivisto.
2702
2703         This is in preparation for the float avoidance feature where formatting context root boxes avoid existing floats.
2704
2705         1. Introduce FloatBox class for the incoming floats (This will need to be renamed when adding support for avoidance -incoming box is actually not a float).
2706         2. Use the existing FloatState::FloatItem class for placed floats.
2707
2708         * Sources.txt:
2709         * WebCore.xcodeproj/project.pbxproj:
2710         * layout/LayoutUnits.h:
2711         * layout/Verification.cpp:
2712         (WebCore::Layout::LayoutContext::verifyAndOutputMismatchingLayoutTree const):
2713         * layout/displaytree/DisplayBox.h:
2714         * layout/floats/FloatBox.cpp: Added.
2715         (WebCore::Layout::FloatBox::FloatBox):
2716         (WebCore::Layout::FloatBox::initializePosition):
2717         (WebCore::Layout::FloatBox::isLeftAligned const):
2718         (WebCore::Layout::FloatBox::setLeft):
2719         (WebCore::Layout::FloatBox::setTopLeft):
2720         (WebCore::Layout::FloatBox::resetVertically):
2721         (WebCore::Layout::FloatBox::resetHorizontally):
2722         (WebCore::Layout::FloatBox::topLeftInContainingBlock const):
2723         * layout/floats/FloatBox.h: Copied from Source/WebCore/layout/floats/FloatingContext.h.
2724         (WebCore::Layout::FloatBox::top const):
2725         (WebCore::Layout::FloatBox::left const):
2726         (WebCore::Layout::FloatBox::marginTop const):
2727         (WebCore::Layout::FloatBox::marginLeft const):
2728         (WebCore::Layout::FloatBox::marginBottom const):
2729         (WebCore::Layout::FloatBox::marginRight const):
2730         (WebCore::Layout::FloatBox::rectWithMargin const):
2731         (WebCore::Layout::FloatBox::setTop):
2732         * layout/floats/FloatingContext.cpp:
2733         (WebCore::Layout::FloatingPair::verticalPosition const):
2734         (WebCore::Layout::begin):
2735         (WebCore::Layout::FloatingContext::positionForFloat const):
2736         (WebCore::Layout::FloatingContext::verticalPositionWithClearance const):
2737         (WebCore::Layout::FloatingContext::floatingPosition const):
2738         (WebCore::Layout::FloatingPair::horiztonalPosition const):
2739         (WebCore::Layout::FloatingPair::bottom const):
2740         (WebCore::Layout::Iterator::Iterator):
2741         (WebCore::Layout::Iterator::operator++):
2742         (WebCore::Layout::Iterator::set):
2743         (WebCore::Layout::FloatingContext::initialVerticalPosition const): Deleted.
2744         (WebCore::Layout::FloatingContext::alignWithContainingBlock const): Deleted.
2745         (WebCore::Layout::FloatingContext::alignWithFloatings const): Deleted.
2746         (WebCore::Layout::FloatingContext::toContainingBlock const): Deleted.
2747         * layout/floats/FloatingContext.h:
2748         * layout/floats/FloatingState.h:
2749         (WebCore::Layout::FloatingState::root const):
2750         (WebCore::Layout::FloatingState::layoutContext const):
2751
2752 2018-08-23  Zan Dobersek  <zdobersek@igalia.com>
2753
2754         [CoordGraphics] Remove the remaining CoordinatedGraphicsLayerState cruft
2755         https://bugs.webkit.org/show_bug.cgi?id=188881
2756
2757         Reviewed by Carlos Garcia Campos.
2758
2759         Remove what's left of CoordinatedGraphicsLayerState usage in the
2760         CoordinatedGraphics subsystem. In CoordinatedGraphicsLayer, this means
2761         dropping the m_layerState member variable since at this point it is not
2762         used anymore in any capacity. Affected helper methods and member
2763         variables are also removed where possible.
2764
2765         The syncLayerState() method on the CoordinatedGraphicsLayerClient
2766         interface is adjusted to not accept any parameters. Client should just
2767         mark frame synchronization as required while the layer state is now
2768         managed differently.
2769
2770         Instead of the CoordinatedLayerID (which is removed) the
2771         Nicosia::PlatformLayer::LayerID alias is introduced as a layer ID type,
2772         aliased to the uint64_t type.
2773
2774         CoordinatedGraphicsState.h file is rid of all structs except the
2775         basic CoordinatedGraphicsState struct that at this point contains only
2776         a reference to the Nicosia::Scene object. This will be further
2777         simplified in the patches that follow.
2778
2779         * platform/graphics/nicosia/NicosiaPlatformLayer.h:
2780         (Nicosia::PlatformLayer::id const):
2781         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
2782         (WebCore::CoordinatedGraphicsLayer::didChangeAnimations):
2783         (WebCore::CoordinatedGraphicsLayer::didChangeChildren):
2784         (WebCore::CoordinatedGraphicsLayer::didChangeFilters):
2785         (WebCore::CoordinatedGraphicsLayer::didUpdateTileBuffers):
2786         (WebCore::CoordinatedGraphicsLayer::didChangeGeometry):
2787         (WebCore::CoordinatedGraphicsLayer::CoordinatedGraphicsLayer):
2788         (WebCore::CoordinatedGraphicsLayer::setPosition):
2789         (WebCore::CoordinatedGraphicsLayer::setAnchorPoint):
2790         (WebCore::CoordinatedGraphicsLayer::setSize):
2791         (WebCore::CoordinatedGraphicsLayer::setTransform):
2792         (WebCore::CoordinatedGraphicsLayer::setChildrenTransform):
2793         (WebCore::CoordinatedGraphicsLayer::setPreserves3D):
2794         (WebCore::CoordinatedGraphicsLayer::setMasksToBounds):
2795         (WebCore::CoordinatedGraphicsLayer::setDrawsContent):
2796         (WebCore::CoordinatedGraphicsLayer::setContentsVisible):
2797         (WebCore::CoordinatedGraphicsLayer::setContentsOpaque):
2798         (WebCore::CoordinatedGraphicsLayer::setBackfaceVisibility):
2799         (WebCore::CoordinatedGraphicsLayer::setOpacity):
2800         (WebCore::CoordinatedGraphicsLayer::setContentsRect):
2801         (WebCore::CoordinatedGraphicsLayer::setContentsTileSize):
2802         (WebCore::CoordinatedGraphicsLayer::setContentsTilePhase):
2803         (WebCore::CoordinatedGraphicsLayer::setContentsToSolidColor):
2804         (WebCore::CoordinatedGraphicsLayer::setShowDebugBorder):
2805         (WebCore::CoordinatedGraphicsLayer::setShowRepaintCounter):
2806         (WebCore::CoordinatedGraphicsLayer::setMaskLayer):
2807         (WebCore::CoordinatedGraphicsLayer::setReplicatedByLayer):
2808         (WebCore::CoordinatedGraphicsLayer::setNeedsDisplay):
2809         (WebCore::CoordinatedGraphicsLayer::setNeedsDisplayInRect):
2810         (WebCore::CoordinatedGraphicsLayer::setDebugBorder):
2811         (WebCore::CoordinatedGraphicsLayer::flushCompositingStateForThisLayerOnly):
2812         (WebCore::CoordinatedGraphicsLayer::syncPendingStateChangesIncludingSubLayers):
2813         (WebCore::CoordinatedGraphicsLayer::purgeBackingStores):
2814         (WebCore::CoordinatedGraphicsLayer::setCoordinatorIncludingSubLayersIfNeeded):
2815         (WebCore::toCoordinatedLayerID): Deleted.
2816         (WebCore::CoordinatedGraphicsLayer::didChangeLayerState): Deleted.
2817         (WebCore::CoordinatedGraphicsLayer::syncChildren): Deleted.
2818         (WebCore::CoordinatedGraphicsLayer::syncFilters): Deleted.
2819         (WebCore::CoordinatedGraphicsLayer::syncLayerState): Deleted.
2820         (WebCore::CoordinatedGraphicsLayer::syncAnimations): Deleted.
2821         (WebCore::CoordinatedGraphicsLayer::resetLayerState): Deleted.
2822         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h:
2823         * platform/graphics/texmap/coordinated/CoordinatedGraphicsState.h:
2824         (): Deleted.
2825         (WebCore::CoordinatedGraphicsLayerState::CoordinatedGraphicsLayerState): Deleted.
2826         (WebCore::CoordinatedGraphicsLayerState::hasPendingChanges const): Deleted.
2827
2828 2018-08-22  Zan Dobersek  <zdobersek@igalia.com>
2829
2830         [CoordGraphics] Drop old-school PlatformLayer management in CoordinatedGraphicsLayer
2831         https://bugs.webkit.org/show_bug.cgi?id=188850
2832
2833         Reviewed by Michael Catanzaro.
2834
2835         Remove the m_platformLayer member from the CoordinatedGraphicsLayer
2836         class as it's been unused since the rework in r235165.
2837
2838         The CoordinatedGraphicsLayer::syncPlatformLayer() helper method and the
2839         related member variable can both be removed as well. On the
2840         CoordinatedGraphicsLayerState class, we can remove the obsolete
2841         flags and the TextureMapperPlatformLayerProxy member variable that's
2842         unused now that such objects are handled through the Nicosia impl class.
2843
2844         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
2845         (WebCore::CoordinatedGraphicsLayer::CoordinatedGraphicsLayer):
2846         (WebCore::CoordinatedGraphicsLayer::setContentsNeedsDisplay):
2847         (WebCore::CoordinatedGraphicsLayer::setContentsToPlatformLayer):
2848         (WebCore::CoordinatedGraphicsLayer::updatePlatformLayer):
2849         (WebCore::CoordinatedGraphicsLayer::flushCompositingStateForThisLayerOnly):
2850         (WebCore::CoordinatedGraphicsLayer::syncPlatformLayer): Deleted.
2851         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h:
2852         * platform/graphics/texmap/coordinated/CoordinatedGraphicsState.h:
2853         (WebCore::CoordinatedGraphicsLayerState::CoordinatedGraphicsLayerState):
2854
2855 2018-08-22  Zan Dobersek  <zdobersek@igalia.com>
2856
2857         [CoordGraphics] Remove TiledBackingStoreClient inheritance from CoordinatedGraphicsLayer
2858         https://bugs.webkit.org/show_bug.cgi?id=188849
2859
2860         Reviewed by Michael Catanzaro.
2861
2862         Remove the TiledBackingStoreClient inheritance from the
2863         CoordinatedGraphicsLayer class since it's not used anymore after changes
2864         made in r235165.
2865
2866         Related TiledBackingStore objects on this class, along with tile state
2867         tracking member variables on the CoordinatedGraphicsLayerState class,
2868         are also removed.
2869
2870         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
2871         (WebCore::CoordinatedGraphicsLayer::~CoordinatedGraphicsLayer):
2872         (WebCore::CoordinatedGraphicsLayer::resetLayerState):
2873         (WebCore::CoordinatedGraphicsLayer::purgeBackingStores):
2874         (WebCore::CoordinatedGraphicsLayer::tiledBackingStoreHasPendingTileCreation): Deleted.
2875         (WebCore::CoordinatedGraphicsLayer::createTile): Deleted.
2876         (WebCore::CoordinatedGraphicsLayer::updateTile): Deleted.
2877         (WebCore::CoordinatedGraphicsLayer::removeTile): Deleted.
2878         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h:
2879         * platform/graphics/texmap/coordinated/CoordinatedGraphicsState.h:
2880         (WebCore::CoordinatedGraphicsLayerState::hasPendingChanges const):
2881
2882 2018-08-22  Zan Dobersek  <zdobersek@igalia.com>
2883
2884         [CoordGraphics] Remove CoordinatedImageBacking and related functionality
2885         https://bugs.webkit.org/show_bug.cgi?id=188847
2886
2887         Reviewed by Michael Catanzaro.
2888
2889         Remove the CoordinatedImageBacking class and its intertwining use in the
2890         CoordinatedGraphics system.
2891
2892         Remove the now-unused m_coordinatedImageBacking member variable from the
2893         CoordinatedGraphicsLayer class, along with CoordinatedImageBacking::Host
2894         inheritance. Various related helper methods are also removed.
2895
2896         In CoordinatedGraphicsState and CoordinatedGraphicsLayerState classes,
2897         we are able to drop different CoordinatedImageBacking-related state
2898         values that are not used anymore.
2899
2900         * platform/TextureMapper.cmake:
2901         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
2902         (WebCore::CoordinatedGraphicsLayer::CoordinatedGraphicsLayer):
2903         (WebCore::CoordinatedGraphicsLayer::~CoordinatedGraphicsLayer):
2904         (WebCore::CoordinatedGraphicsLayer::setContentsToImage):
2905         (WebCore::CoordinatedGraphicsLayer::purgeBackingStores):
2906         (WebCore::CoordinatedGraphicsLayer::didChangeImageBacking): Deleted.
2907         (WebCore::CoordinatedGraphicsLayer::syncImageBacking): Deleted.
2908         (WebCore::CoordinatedGraphicsLayer::imageBackingVisible): Deleted.
2909         (WebCore::CoordinatedGraphicsLayer::releaseImageBackingIfNeeded): Deleted.
2910         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h:
2911         * platform/graphics/texmap/coordinated/CoordinatedGraphicsState.h:
2912         (WebCore::CoordinatedGraphicsLayerState::CoordinatedGraphicsLayerState):
2913         * platform/graphics/texmap/coordinated/CoordinatedImageBacking.cpp: Removed.
2914         * platform/graphics/texmap/coordinated/CoordinatedImageBacking.h: Removed.
2915
2916 2018-08-22  Ryosuke Niwa  <rniwa@webkit.org>
2917
2918         Store RefPtr in FocusNavigationScope
2919         https://bugs.webkit.org/show_bug.cgi?id=188864
2920
2921         Reviewed by Simon Fraser.
2922
2923         Use RefPtr to store the root node of a tree scope and a slot element instead of a reference and a raw pointer.
2924
2925         * page/FocusController.cpp:
2926         (WebCore::FocusNavigationScope::parentInScope const):
2927         (WebCore::FocusNavigationScope::firstNodeInScope const):
2928         (WebCore::FocusNavigationScope::lastNodeInScope const):
2929         (WebCore::FocusNavigationScope::FocusNavigationScope):
2930         (WebCore::FocusNavigationScope::owner const):
2931
2932 2018-08-22  Jiewen Tan  <jiewen_tan@apple.com>
2933
2934         Unreviewed, update "Web Authentication" from "Under Consideration" to "In Development"
2935         in features.json.
2936
2937         * features.json:
2938
2939 2018-08-22  Wenson Hsieh  <wenson_hsieh@apple.com>
2940
2941         [Attachment Support] Support dragging attachment elements out as files on macOS
2942         https://bugs.webkit.org/show_bug.cgi?id=181294
2943         <rdar://problem/36298801>
2944
2945         Reviewed by Tim Horton.
2946
2947         Serialize a dragged attachment element as a web archive on macOS. This allows us to move attachment elements
2948         around a document by dragging, without performing a file upload upon every drop. Ideally, we should do this on
2949         iOS as well, but this currently causes attachment data to go missing; further investigation to fix this for iOS
2950         is tracked in <https://bugs.webkit.org/show_bug.cgi?id=181514>.
2951
2952         Tests:  WKAttachmentTestsMac.DragAttachmentAsFilePromise
2953                 WKAttachmentTests.MoveAttachmentElementAsIconByDragging
2954
2955         * editing/cocoa/EditorCocoa.mm:
2956         (WebCore::Editor::getPasteboardTypesAndDataForAttachment):
2957
2958 2018-08-22  Aditya Keerthi  <akeerthi@apple.com>
2959
2960         [iOS] Add support for the inputmode attribute
2961         https://bugs.webkit.org/show_bug.cgi?id=183621
2962
2963         Reviewed by Tim Horton.
2964
2965         Added the inputmode attribute to the HTMLInputElement and HTMLTextAreaElement IDL
2966         files. The possible values for the attribute are specified in InputModeNames.
2967
2968         Test: fast/forms/inputmode-attribute.html
2969
2970         * Sources.txt:
2971         * WebCore.xcodeproj/project.pbxproj:
2972         * html/HTMLAttributeNames.in:
2973         * html/HTMLInputElement.idl:
2974         * html/HTMLTextAreaElement.idl:
2975         * html/HTMLTextFormControlElement.cpp:
2976         (WebCore::HTMLTextFormControlElement::inputMode const):
2977         (WebCore::HTMLTextFormControlElement::setInputMode):
2978         * html/HTMLTextFormControlElement.h:
2979         * html/InputModeNames.cpp: Added.
2980         (WebCore::InputModeNames::text):
2981         (WebCore::InputModeNames::tel):
2982         (WebCore::InputModeNames::url):
2983         (WebCore::InputModeNames::email):
2984         (WebCore::InputModeNames::numeric):
2985         (WebCore::InputModeNames::decimal):
2986         (WebCore::InputModeNames::search):
2987         * html/InputModeNames.h: Added.
2988
2989 2018-08-22  Eric Carlson  <eric.carlson@apple.com>
2990
2991         Log more often during AirPlay state changes
2992         https://bugs.webkit.org/show_bug.cgi?id=188854
2993
2994         Always log some infrequent but important AirPlay state changes to make debugging easier.
2995
2996         Reviewed by Jer Noble.
2997
2998         * html/HTMLMediaElement.cpp:
2999         (WebCore::HTMLMediaElement::webkitShowPlaybackTargetPicker): Low always.
3000         (WebCore::HTMLMediaElement::mediaPlayerCurrentPlaybackTargetIsWirelessChanged): Ditto.
3001         (WebCore::HTMLMediaElement::setWirelessPlaybackTarget): Ditto.
3002         (WebCore::HTMLMediaElement::setShouldPlayToPlaybackTarget): Ditto.
3003
3004 2018-08-21  Ryosuke Niwa  <rniwa@webkit.org>
3005
3006         Focus navigation order in slot fallback contents is wrong
3007         https://bugs.webkit.org/show_bug.cgi?id=178001
3008         <rdar://problem/42842997>
3009
3010         Reviewed by Antti Koivisto.
3011
3012         The bug here is that when a slot uses its fallback content, the fallback content's focus order doesn't get
3013         grouped by that of the slot. Consider the following DOM tree:
3014
3015         - ShadowRoot
3016             - div tabindex = 2
3017             - slot tabindex = 1
3018                 - span tabindex = 3
3019
3020         In this example, the sequential focus navigation should be slot, span, then div. Even though span has tabindex
3021         order of 3, which is lower than that of div, the fallback content of the slot should be grouped together
3022         before the focus moves out of the slot content.
3023
3024         In WebKit, this concept of grouping elements for the sequential focus navigation ordering is implemeneted
3025         as FocusNavigationScope. Both ShadowRoot and HTMLSlotElement are treated as a focus scope owner but we had
3026         a bug that a slot element which uses its fallback content was not treated as a focus scope owner.
3027
3028         This patch addresses the bug by treating a slot wich uses its fallback content as a focus scope owner.
3029
3030         Test: fast/shadow-dom/focus-navigation-across-slots.html
3031
3032         * page/FocusController.cpp:
3033         (WebCore::isFocusScopeOwner): Treat a slot elment hs a focus scope owner regardless of whether it has assigned
3034         nodes or not.
3035         (WebCore::FocusNavigationScope::SlotKind): Added.
3036         (WebCore::FocusNavigationScope::m_slotKind): Added.
3037         (WebCore::FocusNavigationScope::parentInScope const): Return null if `node` is a child of the slot element for
3038         which this FocusNavigationScope is created (i.e. `node` is slot's fallback content).
3039         (WebCore::FocusNavigationScope::firstNodeInScope const): Return the first child node when this
3040         FocusNavigationScope is for a slot element using its fallback content.
3041         (WebCore::FocusNavigationScope::lastNodeInScope const): Ditto for the last child.
3042         (WebCore::FocusNavigationScope::FocusNavigationScope):
3043         (WebCore::FocusNavigationScope::scopeOf): The scope of a child of a slot element which uses its fallback content
3044         is its slot element (i.e. the current node is a fallback content). We can't simply check the current node is
3045         a slot element which uses a fallback content since the scope of a slot element is the parent scope. e.g. its
3046         tree scope like ShadowRoot or Document inside which this slot element appears.
3047         (WebCore::FocusNavigationScope::scopeOwnedByScopeOwner): Create the appropriate FocusNavigationScope based on
3048         whether the slot element has assigned or it uses its fallback content.
3049
3050 2018-08-22  David Kilzer  <ddkilzer@apple.com>
3051
3052         Move files in WebCore project to match Xcode folder structure
3053         <https://webkit.org/b/188851>
3054
3055         Reviewed by Tim Horton.
3056
3057         * Scripts/LocalizableStrings.pm: Renamed from Source/WebCore/LocalizableStrings.pm.
3058         * Scripts/extract-localizable-strings.pl: Renamed from Source/WebCore/extract-localizable-strings.pl.
3059         * WebCore.xcodeproj/project.pbxproj: Update to match new location of files.
3060         * platform/audio/cocoa/WebAudioBufferList.cpp: Renamed from Source/WebCore/platform/audio/WebAudioBufferList.cpp.
3061         * platform/audio/cocoa/WebAudioBufferList.h: Renamed from Source/WebCore/platform/audio/WebAudioBufferList.h.
3062         * platform/graphics/avfoundation/objc/MediaSampleAVFObjC.h: Renamed from Source/WebCore/platform/graphics/avfoundation/MediaSampleAVFObjC.h.
3063         * platform/ios/wak/WAKViewInternal.h: Renamed from Source/WebCore/platform/WAKViewInternal.h.
3064           Also fix 3 webkit-style warnings.
3065
3066 2018-08-22  Zalan Bujtas  <zalan@apple.com>
3067
3068         [LFC][Floating] Move files to a dedicated directory.
3069         https://bugs.webkit.org/show_bug.cgi?id=188846
3070
3071         Reviewed by Simon Fraser.
3072
3073         layout/Float* -> layout/floats
3074
3075         * WebCore.xcodeproj/project.pbxproj:
3076         * layout/floatformatting/FloatingContext.cpp: Renamed from Source/WebCore/layout/FloatingContext.cpp.
3077         (WebCore::Layout::FloatingPair::isEmpty const):
3078         (WebCore::Layout::FloatingPair::verticalPosition const):
3079         (WebCore::Layout::Iterator::operator* const):
3080         (WebCore::Layout::begin):
3081         (WebCore::Layout::end):
3082         (WebCore::Layout::FloatingContext::FloatingContext):
3083         (WebCore::Layout::FloatingContext::positionForFloat const):
3084         (WebCore::Layout::FloatingContext::verticalPositionWithClearance const):
3085         (WebCore::Layout::FloatingContext::floatingPosition const):
3086         (WebCore::Layout::FloatingContext::initialVerticalPosition const):
3087         (WebCore::Layout::FloatingContext::alignWithContainingBlock const):
3088         (WebCore::Layout::FloatingContext::alignWithFloatings const):
3089         (WebCore::Layout::FloatingContext::toContainingBlock const):
3090         (WebCore::Layout::FloatingPair::FloatingPair):
3091         (WebCore::Layout::FloatingPair::left const):
3092         (WebCore::Layout::FloatingPair::right const):
3093         (WebCore::Layout::FloatingPair::intersects const):
3094         (WebCore::Layout::FloatingPair::operator == const):
3095         (WebCore::Layout::FloatingPair::bottom const):
3096         (WebCore::Layout::Iterator::Iterator):
3097         (WebCore::Layout::previousFloatingIndex):
3098         (WebCore::Layout::Iterator::operator++):
3099         (WebCore::Layout::Iterator::set):
3100         (WebCore::Layout::Iterator::operator== const):
3101         (WebCore::Layout::Iterator::operator!= const):
3102         * layout/floatformatting/FloatingContext.h: Renamed from Source/WebCore/layout/FloatingContext.h.
3103         (WebCore::Layout::FloatingContext::floatingState const):
3104         (WebCore::Layout::FloatingContext::layoutContext const):
3105         * layout/floatformatting/FloatingState.cpp: Renamed from Source/WebCore/layout/FloatingState.cpp.
3106         (WebCore::Layout::FloatingState::FloatItem::FloatItem):
3107         (WebCore::Layout::FloatingState::FloatingState):
3108         (WebCore::Layout::belongsToThisFloatingContext):
3109         (WebCore::Layout::FloatingState::remove):
3110         (WebCore::Layout::FloatingState::append):
3111         (WebCore::Layout::FloatingState::bottom const):
3112         * layout/floatformatting/FloatingState.h: Renamed from Source/WebCore/layout/FloatingState.h.
3113         (WebCore::Layout::FloatingState::create):
3114         (WebCore::Layout::FloatingState::isEmpty const):
3115         (WebCore::Layout::FloatingState::FloatItem::layoutBox const):
3116         (WebCore::Layout::FloatingState::FloatItem::containingBlock const):
3117         (WebCore::Layout::FloatingState::FloatItem::displayBox const):
3118         (WebCore::Layout::FloatingState::FloatItem::containingBlockDisplayBox const):
3119         (WebCore::Layout::FloatingState::floats const):
3120         (WebCore::Layout::FloatingState::last const):
3121         (WebCore::Layout::FloatingState::layoutContext const):
3122         (WebCore::Layout::FloatingState::root const):
3123         (WebCore::Layout::FloatingState::leftBottom const):
3124         (WebCore::Layout::FloatingState::rightBottom const):
3125         (WebCore::Layout::FloatingState::bottom const):
3126
3127 2018-08-22  Rob Buis  <rbuis@igalia.com>
3128
3129         Fetch: Stop checking Request.integrity's value in no-cors mode
3130         https://bugs.webkit.org/show_bug.cgi?id=188802
3131
3132         Reviewed by Frédéric Wang.
3133
3134         Remove this check since it was removed from the spec.
3135
3136         Behavior matches Chrome and Firefox.
3137
3138         Test: http/tests/subresource-integrity/sri-fetch.js:
3139
3140         * Modules/fetch/FetchRequest.cpp:
3141         (WebCore::FetchRequest::initializeOptions):
3142
3143 2018-08-22  Youenn Fablet  <youenn@apple.com>
3144
3145         Mark MediaStream Recording API as under consideration
3146         https://bugs.webkit.org/show_bug.cgi?id=188822
3147
3148         Reviewed by Jon Lee.
3149
3150         * features.json:
3151
3152 2018-08-22  Ms2ger  <Ms2ger@igalia.com>
3153
3154         [GTK] Never return an uninitialized ImageGStreamer object.
3155         https://bugs.webkit.org/show_bug.cgi?id=188305
3156
3157         Reviewed by Philippe Normand.
3158
3159         The single caller was already checking for a null return value, so
3160         make that check actually do something. Also remove the null-check on
3161         the return value of image(), which asserted that it would never return
3162         null.
3163
3164         Test: fast/canvas/canvas-createPattern-video-loading.html
3165
3166         * platform/graphics/gstreamer/ImageGStreamer.h:
3167         (WebCore::ImageGStreamer::createImage): Return null if m_image wasn't created.
3168         (WebCore::ImageGStreamer::image): Return a reference.
3169         (WebCore::ImageGStreamer::rect): Always assert that m_image is present.
3170         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
3171         (WebCore::MediaPlayerPrivateGStreamerBase::paint): Update for new signature.
3172
3173 2018-08-22  Zalan Bujtas  <zalan@apple.com>
3174
3175         Add changes missing from r234925.
3176
3177         * layout/blockformatting/BlockMarginCollapse.cpp:
3178         (WebCore::Layout::isMarginTopCollapsedWithParent):
3179         (WebCore::Layout::isMarginBottomCollapsedThrough):
3180         (WebCore::Layout::BlockFormattingContext::MarginCollapse::isMarginBottomCollapsedWithParent):
3181
3182 2018-08-22  Zan Dobersek  <zdobersek@igalia.com>
3183
3184         [CoordGraphics] Switch to Nicosia::CompositionLayer state tracking
3185         https://bugs.webkit.org/show_bug.cgi?id=188693
3186
3187         Reviewed by Carlos Garcia Campos.
3188
3189         Populate Nicosia::CompositionLayer with additional LayerState member
3190         objects. For now we're using pending, staging and committed states,
3191         though it might be possible to narrow down these to just two.
3192
3193         Pending state contains state that will be moved to staging during the
3194         final steps of the next layer flush. flushState() method accumulates all
3195         state changes in the staging state, and also allows the caller to
3196         additionally perform flushing operations that are specific to backing
3197         store, image backing or content layer containers.
3198
3199         commitState() method moves staging state over into the committed state,
3200         again allowing user to pass a functor that receives the just-committed
3201         state and apply it to their composition engine.
3202
3203         Changes in state objects are done under a thread-safe lock. This might
3204         not be completely necessary at this point, but will be useful when
3205         additonal layer state updates will be coming from e.g. the scrolling
3206         thread. It might also make sense to tie in this lock use with the
3207         Nicosia::Scene lock in the future.
3208
3209         Nicosia::ContentLayerTextureMapperImpl is modified slightly to allow
3210         determining during flushes whether an update is pending. This is
3211         necessary for a special case in ThreadedCompositor where content (i.e.
3212         platform) layers like WebGL or video require an additional level of
3213         scene update coordination. This complete special case has to go through
3214         another review to see whether it's still necessary. Ideally we would be
3215         able to remove it.
3216
3217         CoordinatedGraphicsLayer is finally switched over to using
3218         Nicosia layer objects for state updates of any kind. This patch only
3219         adds all the necessary bits, but doesn't yet remove any of the existing
3220         code (but rather disables it temporarily, before it's removed).
3221
3222         Updating of simple state values is already in place. For backing stores,
3223         the flushCompositingStateForThisLayerOnly() method now takes care of
3224         preparing the backing store object if necessary as per layer state,
3225         while the updateContentBuffers() method is switched to operate with
3226         TiledBackingStore objects now kept on the BackingStoreTextureMapperImpl
3227         instance associated with that backing store. Helper methods like
3228         adjustContentsScale() and createBackingStore(), only called from the
3229         updateContentBuffers() method, are removed and the code there inlined.
3230
3231         For image-backed layers, the update is now done directly in
3232         the flushCompositingStateForThisLayerOnly() method, if necessary. The
3233         helper syncImageBacking() method is commented out in order to prevent
3234         double-painting of image buffers for now, but all this (along with the
3235         CoordinatedImageBacking logic in CompositingCoordinator) will be removed
3236         later.
3237
3238         For layers backed by platform layer objects, integration is relatively
3239         simple. setContentsToPlatformLayer() is changed to properly handle any
3240         passed-in platform layer object, and updatePlatformLayer() invokes the
3241         swapBuffersIfNeeded() method on the ContentLayerTextureMapperImpl object
3242         during each flush, if necessary.
3243
3244         In order to ensure any Nicosia-specific state update properly triggers
3245         a composition update, m_nicosia.performLayerUpdate is added and flipped
3246         to true during the flush in case of any state change. This then triggers
3247         a layer sync in the CompositingCoordinator object when the
3248         syncPendingStateChangesIncludingSubLayers() method is called. While no
3249         old-style layer state update is provided, it causes the necessary
3250         synchronization step that properly picks up the Nicosia-provided state
3251         changes. Once the old-style layer state tracking is removed, this method
3252         of update triggering will have to be updated as well.
3253
3254         * platform/graphics/nicosia/NicosiaPlatformLayer.h:
3255         (Nicosia::CompositionLayer::flushState):
3256         (Nicosia::CompositionLayer::commitState):
3257         (Nicosia::CompositionLayer::accessCommitted):
3258         * platform/graphics/nicosia/NicosiaScene.h:
3259         * platform/graphics/nicosia/texmap/NicosiaContentLayerTextureMapperImpl.cpp:
3260         (Nicosia::ContentLayerTextureMapperImpl::flushUpdate):
3261         * platform/graphics/nicosia/texmap/NicosiaContentLayerTextureMapperImpl.h:
3262         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
3263         (WebCore::CoordinatedGraphicsLayer::~CoordinatedGraphicsLayer):
3264         (WebCore::CoordinatedGraphicsLayer::setContentsNeedsDisplay):
3265         (WebCore::CoordinatedGraphicsLayer::setContentsToPlatformLayer):
3266         (WebCore::CoordinatedGraphicsLayer::updatePlatformLayer):
3267         (WebCore::CoordinatedGraphicsLayer::flushCompositingStateForThisLayerOnly):
3268         (WebCore::CoordinatedGraphicsLayer::syncPendingStateChangesIncludingSubLayers):
3269         (WebCore::CoordinatedGraphicsLayer::updateContentBuffers):
3270         (WebCore::CoordinatedGraphicsLayer::purgeBackingStores):
3271         (WebCore::CoordinatedGraphicsLayer::adjustContentsScale): Deleted.
3272         (WebCore::CoordinatedGraphicsLayer::createBackingStore): Deleted.
3273         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h:
3274
3275 2018-08-22  David Kilzer  <ddkilzer@apple.com>
3276
3277         Remove stale file references in WebCore Xcode project
3278
3279         I manually removed these using Xcode and verified that there was
3280         a commit that removed the original files.
3281
3282         Found by tool created for Bug 188754: Tool to fix folders that
3283         should map to directories in Xcode project files.
3284
3285         * WebCore.xcodeproj/project.pbxproj:
3286         (dom/DOMExceptions.in): Removed in r219741.
3287         (Modules/modern-media-controls/start-button.js):
3288         (Modules/modern-media-controls/volume-slider.css):
3289         (Modules/modern-media-controls/icon-button.css):
3290         (Modules/modern-media-controls/volume-slider.js):
3291         (Modules/modern-media-controls/macos-media-controls.js):
3292         (Modules/modern-media-controls/ios-inline-media-controls.css):
3293         (Modules/modern-media-controls/scrubber.css):
3294         (Modules/modern-media-controls/start-button.css):
3295         (Modules/modern-media-controls/scrubber.js):
3296         (Modules/modern-media-controls/icon-button.js):
3297         (Modules/modern-media-controls/macos-compact-inline-media-controls.css):
3298         (Modules/modern-media-controls/images/iOS/enter-fullscreen@2x.png):
3299         (Modules/modern-media-controls/images/iOS/start@1x.png):
3300         (Modules/modern-media-controls/images/iOS/enter-fullscreen@1x.png):
3301         (Modules/modern-media-controls/images/iOS/pause@2x.png):
3302         (Modules/modern-media-controls/images/iOS/play@3x.png):
3303         (Modules/modern-media-controls/images/iOS/interval-skip-back@2x.png):
3304         (Modules/modern-media-controls/images/iOS/interval-skip-back@3x.png):
3305         (Modules/modern-media-controls/images/iOS/pip-in@2x.png):
3306         (Modules/modern-media-controls/images/iOS/start@3x.png):
3307         (Modules/modern-media-controls/images/iOS/airplay@1x.png):
3308         (Modules/modern-media-controls/images/iOS/enter-fullscreen@3x.png):
3309         (Modules/modern-media-controls/images/iOS/slider-thumb@2x.png):
3310         (Modules/modern-media-controls/images/iOS/airplay@2x.png):
3311         (Modules/modern-media-controls/images/iOS/pause@3x.png):
3312         (Modules/modern-media-controls/images/iOS/pip-in@3x.png):
3313         (Modules/modern-media-controls/images/iOS/interval-skip-back@1x.png):
3314         (Modules/modern-media-controls/images/iOS/pause@1x.png):
3315         (Modules/modern-media-controls/images/iOS/start@2x.png):
3316         (Modules/modern-media-controls/images/iOS/play@2x.png):
3317         (Modules/modern-media-controls/images/iOS/pip-in@1x.png):
3318         (Modules/modern-media-controls/images/iOS/play@1x.png):
3319         (Modules/modern-media-controls/images/macOS/enter-fullscreen-compact@1x.png):
3320         (Modules/modern-media-controls/images/macOS/rewind@1x.png):
3321         (Modules/modern-media-controls/images/macOS/play@2x.png):
3322         (Modules/modern-media-controls/images/macOS/volume-mute@2x.png):
3323         (Modules/modern-media-controls/images/macOS/airplay-fullscreen@1x.png):
3324         (Modules/modern-media-controls/images/macOS/volume@2x.png):
3325         (Modules/modern-media-controls/images/macOS/interval-skip-back@2x.png):
3326         (Modules/modern-media-controls/images/macOS/volume-compact@2x.png):
3327         (Modules/modern-media-controls/images/macOS/start@2x.png):
3328         (Modules/modern-media-controls/images/macOS/exit-fullscreen@2x.png):
3329         (Modules/modern-media-controls/images/macOS/airplay@2x.png):
3330         (Modules/modern-media-controls/images/macOS/media-selection-fullscreen@1x.png):
3331         (Modules/modern-media-controls/images/macOS/interval-skip-back@1x.png):
3332         (Modules/modern-media-controls/images/macOS/airplay@1x.png):
3333         (Modules/modern-media-controls/images/macOS/pip-in@1x.png):
3334         (Modules/modern-media-controls/images/macOS/scale-to-fill@2x.png):
3335         (Modules/modern-media-controls/images/macOS/rewind@2x.png):
3336         (Modules/modern-media-controls/images/macOS/play-compact@1x.png):
3337         (Modules/modern-media-controls/images/macOS/media-selection-fullscreen@2x.png):
3338         (Modules/modern-media-controls/images/macOS/pip-in-fullscreen@1x.png):
3339         (Modules/modern-media-controls/images/macOS/volume@1x.png):
3340         (Modules/modern-media-controls/images/macOS/pip-in@2x.png):
3341         (Modules/modern-media-controls/images/macOS/play-fullscreen@2x.png):
3342         (Modules/modern-media-controls/images/macOS/volume-down-fullscreen@1x.png):
3343         (Modules/modern-media-controls/images/macOS/pause-fullscreen@2x.png):
3344         (Modules/modern-media-controls/images/macOS/enter-fullscreen-compact@2x.png):
3345         (Modules/modern-media-controls/images/macOS/enter-fullscreen@1x.png):
3346         (Modules/modern-media-controls/images/macOS/pause-compact@1x.png):
3347         (Modules/modern-media-controls/images/macOS/start@1x.png):
3348         (Modules/modern-media-controls/images/macOS/pip-in-fullscreen@2x.png):
3349         (Modules/modern-media-controls/images/macOS/pause-fullscreen@1x.png):
3350         (Modules/modern-media-controls/images/macOS/play@1x.png):
3351         (Modules/modern-media-controls/images/macOS/exit-fullscreen@1x.png):
3352         (Modules/modern-media-controls/images/macOS/forward@1x.png):
3353         (Modules/modern-media-controls/images/macOS/enter-fullscreen@2x.png):
3354         (Modules/modern-media-controls/images/macOS/pause@1x.png):
3355         (Modules/modern-media-controls/images/macOS/scale-to-fit@2x.png):
3356         (Modules/modern-media-controls/images/macOS/interval-skip-back-compact@2x.png):
3357         (Modules/modern-media-controls/images/macOS/pause@2x.png):
3358         (Modules/modern-media-controls/images/macOS/volume-up-fullscreen@1x.png):
3359         (Modules/modern-media-controls/images/macOS/volume-compact@1x.png):
3360         (Modules/modern-media-controls/images/macOS/play-compact@2x.png):
3361         (Modules/modern-media-controls/images/macOS/media-selection@2x.png):
3362         (Modules/modern-media-controls/images/macOS/forward@2x.png):
3363         (Modules/modern-media-controls/images/macOS/interval-skip-back-compact@1x.png):
3364         (Modules/modern-media-controls/images/macOS/scale-to-fill@1x.png):
3365         (Modules/modern-media-controls/images/macOS/airplay-fullscreen@2x.png):
3366         (Modules/modern-media-controls/images/macOS/media-selection@1x.png):
3367         (Modules/modern-media-controls/images/macOS/volume-mute@1x.png):
3368         (Modules/modern-media-controls/images/macOS/pause-compact@2x.png):
3369         (Modules/modern-media-controls/images/macOS/volume-up-fullscreen@2x.png):
3370         (Modules/modern-media-controls/images/macOS/scale-to-fit@1x.png):
3371         (Modules/modern-media-controls/images/macOS/play-fullscreen@1x.png):
3372         (Modules/modern-media-controls/images/macOS/volume-down-fullscreen@2x.png):
3373         (Modules/modern-media-controls/media/time-labels-support.js):
3374         - Removed in r217823.
3375         (Modules/webvr/VRDisplayCapabilities.cpp): Removed in r229089.
3376         (Modules/webvr/VRFieldOfView.cpp): Removed in r228819.
3377         (rendering/svg/RenderSVGAllInOne.cpp): Removed in r234655.
3378
3379 2018-08-22  Carlos Garcia Campos  <cgarcia@igalia.com>
3380
3381         Do not try to update the compositing policy when not in accelerated compositing mode
3382         https://bugs.webkit.org/show_bug.cgi?id=188787
3383
3384         Reviewed by Simon Fraser.
3385
3386         RenderLayerCompositor::updateCompositingPolicy() is called very often (called from
3387         RenderLayerCompositor::cacheAcceleratedCompositingFlags()) and it uses WTF::memoryFootprint() to decide the
3388         current compositing policy. Getting the memory footprint is an expensive operation in Linux (and I suspect other
3389         non-cocoa ports too), causing an excessive CPU usage. This caused the WPE and GTK+ unit test
3390         /webkit/WebKitWebContext/uri-scheme to start timing out in the bots, because the test expects things to happen
3391         fast and that's no longer the case. We could reduce the CPU usage a lot by not trying to update the policy when
3392         not in accelerated compositing mode. We will need a solution for the accelerated compositing mode, though.
3393
3394         Fixes WPE/GTK+ unit test /webkit/WebKitWebContext/uri-scheme.
3395
3396         * rendering/RenderLayerCompositor.cpp:
3397         (WebCore::RenderLayerCompositor::updateCompositingPolicy): Return early when not in accelerated compositing mode.
3398
3399 2018-08-21  Yusuke Suzuki  <yusukesuzuki@slowstart.org>
3400
3401         Support "name" option for dedicated workers
3402         https://bugs.webkit.org/show_bug.cgi?id=188779
3403
3404         Reviewed by Joseph Pecoraro.
3405
3406         This patch adds `new Worker(url, { name: "Worker Name" })` option support[1].
3407         This name can be accessible from `self.name` of DedicatedWorkerGlobalScope.
3408         It is useful for debugging dedicated workers if the inspector can show the
3409         names of the workers. This enhancement is tracked by [2].
3410
3411         [1]: https://github.com/whatwg/html/issues/2477
3412         [2]: https://bugs.webkit.org/show_bug.cgi?id=164678
3413
3414         Tests: http/wpt/workers/name-property-enhanced.html
3415                http/wpt/workers/name-property-no-name.html
3416
3417         * workers/DedicatedWorkerGlobalScope.cpp:
3418         (WebCore::DedicatedWorkerGlobalScope::create):
3419         (WebCore::DedicatedWorkerGlobalScope::DedicatedWorkerGlobalScope):
3420         Hold `name` member.
3421
3422         * workers/DedicatedWorkerGlobalScope.h:
3423         * workers/DedicatedWorkerGlobalScope.idl:
3424         Add `name` attribute.
3425
3426         * workers/DedicatedWorkerThread.cpp:
3427         (WebCore::DedicatedWorkerThread::DedicatedWorkerThread):
3428         (WebCore::DedicatedWorkerThread::createWorkerGlobalScope):
3429         * workers/DedicatedWorkerThread.h:
3430         * workers/Worker.cpp:
3431         (WebCore::Worker::Worker):
3432         (WebCore::Worker::create):
3433         (WebCore::Worker::notifyFinished):
3434         * workers/Worker.h:
3435         * workers/Worker.idl:
3436         Add WorkerOptions for dedicated worker creation.
3437
3438         * workers/WorkerGlobalScopeProxy.h:
3439         * workers/WorkerMessagingProxy.cpp:
3440         (WebCore::WorkerMessagingProxy::startWorkerGlobalScope):
3441         * workers/WorkerMessagingProxy.h:
3442         * workers/WorkerThread.cpp:
3443         (WebCore::WorkerThreadStartupData::WorkerThreadStartupData):
3444         Isolate copy the given `name` to pass the worker thread.
3445
3446         (WebCore::WorkerThread::WorkerThread):
3447         (WebCore::WorkerThread::workerThread):
3448         * workers/WorkerThread.h:
3449         * workers/service/context/ServiceWorkerThread.cpp:
3450         (WebCore::ServiceWorkerThread::ServiceWorkerThread):
3451         (WebCore::ServiceWorkerThread::createWorkerGlobalScope):
3452         * workers/service/context/ServiceWorkerThread.h:
3453
3454 2018-08-21  Ryosuke Niwa  <rniwa@webkit.org>
3455
3456         Replace booleans for modifier keys in UIEventWithKeyState with OptionSet<Modifier>
3457         https://bugs.webkit.org/show_bug.cgi?id=188777
3458
3459         Reviewed by Simon Fraser.
3460
3461         Replaced boolean arguments and instance variables for modifier keys (ctrl, alt, shift, and meta keys) in
3462         UIEventWithKeyState with OptionSet<Modifier> and isSimulated boolean in MouseRelatedEvent with IsSimulated
3463         enum class.
3464
3465         Also made movementDelta always compiled instead of only when ENABLE(POINTER_LOCK) to simplify the code.
3466
3467         No new tests since there should be no observable behavioral change.
3468
3469         * dom/Element.cpp:
3470         (WebCore::Element::dispatchMouseEvent):
3471         * dom/KeyboardEvent.cpp:
3472         (WebCore::KeyboardEvent::KeyboardEvent):
3473         (WebCore::KeyboardEvent::initKeyboardEvent): Call setModifierKeys.
3474         * dom/MouseEvent.cpp:
3475         (WebCore::MouseEvent::create):
3476         (WebCore::MouseEvent::MouseEvent):
3477         (WebCore::MouseEvent::initMouseEvent): Ditto.
3478         * dom/MouseEvent.h:
3479         * dom/MouseRelatedEvent.cpp:
3480         (WebCore::MouseRelatedEvent::MouseRelatedEvent): Added a new variant which takes the minimum arguments
3481         for gesture & touch events. In those events, detail is always set to 0, movementDelta is always set to 0,0,
3482         and they are never simulated.
3483         * dom/MouseRelatedEvent.h:
3484         (WebCore::MouseRelatedEvent::IsSimulated): Added.
3485         * dom/SimulatedClick.cpp:
3486         (WebCore::SimulatedMouseEvent::SimulatedMouseEvent): Get OptionSet<Modifier> out of the underlying event
3487         instead of manually setting each key state. This code now preserves the state of caps lock and alt-graph
3488         keys but this is not observable because we have yet to implement getModifierState on MouseEvent.
3489         (WebCore::SimulatedMouseEvent::modifiersFromUnderlyingEvent): Added.
3490         * dom/TouchEvent.cpp:
3491         (WebCore::TouchEvent::TouchEvent):
3492         * dom/TouchEvent.h:
3493         * dom/UIEventWithKeyState.h:
3494         (WebCore::UIEventWithKeyState::Modifier): Alias to PlatformEvent::Modifier.
3495         (WebCore::UIEventWithKeyState::ctrlKey const): Updated to use m_modifiers.
3496         (WebCore::UIEventWithKeyState::shiftKey const): Ditto.
3497         (WebCore::UIEventWithKeyState::altKey const): Ditto.
3498         (WebCore::UIEventWithKeyState::metaKey const): Ditto.
3499         (WebCore::UIEventWithKeyState::altGraphKey const): Ditto.
3500         (WebCore::UIEventWithKeyState::capsLockKey const): Ditto.
3501         (WebCore::UIEventWithKeyState::modifierKeys): Added.
3502         (WebCore::UIEventWithKeyState::UIEventWithKeyState): Now takes OptionSet<Modifier>.
3503         (WebCore::UIEventWithKeyState::setModifierKeys): Added. Used by init*Event functions in subclasses. Note that
3504         these functions preseve the states of alt-graph and caps lock keys to match the existing behaviors in this
3505         cleanup patch but they don't match behaviors of Chrome or Firefox.
3506         (WebCore::UIEventWithKeyState::modifiersFromInitializer): Added.
3507         * dom/WheelEvent.cpp:
3508         (WebCore::WheelEvent::WheelEvent): Simulated::No corresponds to the last boolean being false.
3509         * page/EventHandler.cpp:
3510         (WebCore::EventHandler::dispatchDragEvent):
3511         (WebCore::EventHandler::handleTouchEvent):
3512         * platform/PlatformEvent.h:
3513         (WebCore::PlatformEvent::Modifier): Added AltGraphKey.
3514         * platform/mac/PlatformEventFactoryMac.h:
3515         (WebCore::modifiersForEvent): Exported to be used in [WebPDFView PDFViewWillClickOnLink:withURL:].
3516         * platform/mac/PlatformEventFactoryMac.mm:
3517         (WebCore::modifiersForEvent):
3518         * testing/Internals.cpp:
3519         (WebCore::Internals::accessKeyModifiers const):
3520
3521 2018-08-21  Wenson Hsieh  <wenson_hsieh@apple.com>
3522
3523         [Attachment Support] Remove _WKAttachments and notify the UI client upon mainframe navigation
3524         https://bugs.webkit.org/show_bug.cgi?id=188715
3525         <rdar://problem/43541790>
3526
3527         Reviewed by Tim Horton.
3528
3529         Rename didInsertAttachment to didInsertAttachmentWithIdentifier. See WebKit ChangeLog for more detail.
3530
3531         Tests:  WKAttachmentTests.InvalidateAttachmentsAfterMainFrameNavigation
3532                 WKAttachmentTests.InvalidateAttachmentsAfterWebProcessTermination
3533
3534         * editing/Editor.cpp:
3535         (WebCore::Editor::notifyClientOfAttachmentUpdates):
3536         * page/EditorClient.h:
3537         (WebCore::EditorClient::didInsertAttachmentWithIdentifier):
3538         (WebCore::EditorClient::didRemoveAttachmentWithIdentifier):
3539         (WebCore::EditorClient::didInsertAttachment): Deleted.
3540         (WebCore::EditorClient::didRemoveAttachment): Deleted.
3541
3542 2018-08-21  Ryan Haddad  <ryanhaddad@apple.com>
3543
3544         Unreviewed, rolling out r235128.
3545
3546         The test added with this change is frequently failing.
3547
3548         Reverted changeset:
3549
3550         "Support "name" option for dedicated workers"
3551         https://bugs.webkit.org/show_bug.cgi?id=188779
3552         https://trac.webkit.org/changeset/235128
3553
3554 2018-08-21  Commit Queue  <commit-queue@webkit.org>
3555
3556         Unreviewed, rolling out r235107.
3557         https://bugs.webkit.org/show_bug.cgi?id=188832
3558
3559         "It revealed bugs in Blob code as well as regressed JS
3560         performance tests" (Requested by saamyjoon on #webkit).
3561
3562         Reverted changeset:
3563
3564         "JSRunLoopTimer may run part of a member function after it's
3565         destroyed"
3566         https://bugs.webkit.org/show_bug.cgi?id=188426
3567         https://trac.webkit.org/changeset/235107
3568
3569 2018-08-21  Megan Gardner  <megan_gardner@apple.com>
3570
3571         Use VisiblePosition to calculate selection ranges
3572         https://bugs.webkit.org/show_bug.cgi?id=188767
3573         <rdar://problem/43577166>
3574
3575         Reviewed by Ryosuke Niwa.
3576
3577         Exposing comparePositions.
3578
3579         * editing/Editing.h:
3580
3581 2018-08-21  Wenson Hsieh  <wenson_hsieh@apple.com>
3582
3583         [Attachment Support] Augment _WKAttachment SPI to handle NSFileWrappers in addition to NSData
3584         https://bugs.webkit.org/show_bug.cgi?id=188496
3585         <rdar://problem/43216836>
3586
3587         Reviewed by Tim Horton.
3588
3589         Refactors logic around HTMLAttachmentElement and pasteboard reading helpers, in support of moving the data
3590         backing for attachment elements to the client layer, instead of keeping it in the attachment element's File.
3591         Augmented existing API tests in WKAttachmentTests, and also added a new API test (see Tools for more detail).
3592
3593         * WebCore.xcodeproj/project.pbxproj:
3594         * dom/Document.cpp:
3595         (WebCore::Document::didInsertAttachmentElement):
3596
3597         Notify the client layer when a newly inserted attachment element's identifier has been updated to avoid
3598         colliding with the identifier of an existing attachment element. This can happen if, for instance, one or more
3599         attachments are copied and pasted within the same document.
3600
3601         * editing/Editor.cpp:
3602         (WebCore::Editor::registerAttachmentIdentifier):
3603         (WebCore::Editor::cloneAttachmentData):
3604
3605         Add new helper functions to notify the client when the attachment identifier to data mapping needs to be
3606         updated. This can happen in three ways: (1) an attachment is created with raw data, or (2) an attachment is
3607         created with a file path, or (3) the unique identifier for an attachment element has been reassigned. These
3608         correspond to the two versions of `registerAttachmentIdentifier`, and `cloneAttachmentData`, respectively.
3609
3610         (WebCore::EditorClient::supportsClientSideAttachmentData const):
3611
3612         Add a new EditorClient hook to determine whether client-side attachment data management is supported. Currently,
3613         this only returns true for WebKit2. If this flag is set to true, we register attachment identifiers and don't
3614         create a new File object for the attachment element; otherwise, fall back to creating and setting a File for the
3615         new attachment element.
3616
3617         (WebCore::Editor::insertAttachment):
3618         (WebCore::Editor::insertAttachmentFromFile): Deleted.
3619
3620         Adjust logic when inserting an attachment; we now only need to update the attributes of the attachment element
3621         with metadata from the client layer.
3622
3623         * editing/Editor.h:
3624         * editing/cocoa/WebContentReaderCocoa.mm:
3625         (WebCore::supportsClientSideAttachmentData):
3626         (WebCore::createFragmentForImageAttachment):
3627
3628         Notify the client when creating an attachment element from image data on the pasteboard.
3629
3630         (WebCore::replaceRichContentWithAttachments):
3631
3632         Refactor this helper function to no longer connect attachment elements to File objects created from
3633         subresources. Instead, just update each attachment element's attributes using information about the subresource,
3634         and then notify the client about the new attachment data and attachment identifier.
3635
3636         (WebCore::createFragmentAndAddResources):
3637         (WebCore::sanitizeMarkupWithArchive):
3638
3639         Plumb the current WebContentReader's Frame& to each of these helpers, so that it can call out to the client.
3640
3641         (WebCore::WebContentReader::readWebArchive):
3642         (WebCore::WebContentMarkupReader::readWebArchive):
3643         (WebCore::WebContentReader::readImage):
3644         (WebCore::WebContentReader::readFilePaths):
3645
3646         Notify the client when creating an attachment from the path of a dropped file.
3647
3648         * html/AttachmentTypes.h:
3649
3650         Remove AttachmentInfo. This is no longer necessary because we don't need to request attachment data from the web
3651         process anymore.
3652
3653         * html/HTMLAttachmentElement.cpp:
3654         (WebCore::HTMLAttachmentElement::ensureUniqueIdentifier):
3655
3656         Add a helper function on the attachment element to create and return a unique identifier if needed.
3657
3658         (WebCore::HTMLAttachmentElement::updateAttributes):
3659
3660         Add a helper method to update the displayed element attributes (type, title and subtitle) or an attachment.
3661
3662         (WebCore::AttachmentDataReader::create): Deleted.
3663         (WebCore::AttachmentDataReader::AttachmentDataReader): Deleted.
3664
3665         Remove AttachmentDataReader. This helper class was only used to load attachment data when requesting attachment
3666         information in the client, but this is now obviated by moving attachment data to the client layer.
3667
3668         (WebCore::HTMLAttachmentElement::updateFileWithData): Deleted.
3669         (WebCore::HTMLAttachmentElement::requestInfo): Deleted.
3670         (WebCore::HTMLAttachmentElement::destroyReader): Deleted.
3671         (WebCore::AttachmentDataReader::~AttachmentDataReader): Deleted.
3672         (WebCore::AttachmentDataReader::didFinishLoading): Deleted.
3673         (WebCore::AttachmentDataReader::didFail): Deleted.
3674         (WebCore::AttachmentDataReader::invokeCallbackAndFinishReading): Deleted.
3675         * html/HTMLAttachmentElement.h:
3676         * page/DragClient.h:
3677         * page/DragController.cpp:
3678         (WebCore::DragController::startDrag):
3679         (WebCore::DragController::doSystemDrag):
3680         (WebCore::DragController::promisedAttachmentInfo):
3681
3682         Allow dragging an attachment (even if it does not have a file) as long as it has a unique identifier and a
3683         content type.
3684
3685         (WebCore::DragController::promisedBlobInfo): Deleted.
3686         * page/DragController.h:
3687         * page/EditorClient.h:
3688         (WebCore::EditorClient::registerAttachmentIdentifier):
3689         (WebCore::EditorClient::cloneAttachmentData):
3690         * platform/DragItem.h:
3691         (WebCore::DragItem::encode const):
3692         (WebCore::DragItem::decode):
3693         * platform/PromisedAttachmentInfo.h: Renamed from Source/WebCore/platform/PromisedBlobInfo.h.
3694
3695         Add an attachment identifier to PromisedBlobInfo. Additionally, rename PromisedBlobInfo to
3696         PromisedAttachmentInfo, since it is currently exclusively used to attachment element data to the pasteboard.
3697         In the future, this could be renamed to something more general (e.g. PromisedPasteboardData), should we use this
3698         mechanism to write data from other sources to the pasteboard.
3699
3700         (WebCore::PromisedAttachmentInfo::operator bool const):
3701
3702 2018-08-21  Brent Fulgham  <bfulgham@apple.com>
3703
3704         Remove experimental affiliated domain code now that StorageAccess API is available
3705         https://bugs.webkit.org/show_bug.cgi?id=188756
3706         <rdar://problem/43527848>
3707
3708         Reviewed by Alex Christensen.
3709
3710         In Bug 174661 we added a compatibility quirk to support wsj.com authentication. This quirk is no longer needed,
3711         since the StorageAccess API provides the necessary tools to do this type of interaction without needing global
3712         cross-site access.
3713
3714         * loader/ResourceLoadObserver.cpp:
3715         (WebCore::ResourceLoadObserver::logSubresourceLoading):
3716         (WebCore::ResourceLoadObserver::logWebSocketLoading):
3717         (WebCore::areDomainsAssociated): Deleted.
3718         (WebCore::shouldEnableSiteSpecificQuirks): Deleted.
3719         * loader/ResourceLoadStatistics.cpp:
3720         (WebCore::ResourceLoadStatistics::areDomainsAssociated): Deleted.
3721         * loader/ResourceLoadStatistics.h:
3722
3723 2018-08-21  Antti Koivisto  <antti@apple.com>
3724
3725         Allow creating WeakPtrs to const objects
3726         https://bugs.webkit.org/show_bug.cgi?id=188785
3727
3728         Reviewed by Geoffrey Garen.
3729
3730         Remove some unneeded const_casts.
3731
3732         * css/MediaQueryEvaluator.cpp:
3733         (WebCore::MediaQueryEvaluator::MediaQueryEvaluator):
3734         (WebCore::MediaQueryEvaluator::evaluate const):
3735         * css/MediaQueryEvaluator.h:
3736         * rendering/FloatingObjects.cpp:
3737         (WebCore::ComputeFloatOffsetAdapter::ComputeFloatOffsetAdapter):
3738         (WebCore::ComputeFloatOffsetForFloatLayoutAdapter::ComputeFloatOffsetForFloatLayoutAdapter):
3739         (WebCore::ComputeFloatOffsetForLineLayoutAdapter::ComputeFloatOffsetForLineLayoutAdapter):
3740         (WebCore::FindNextFloatLogicalBottomAdapter::FindNextFloatLogicalBottomAdapter):
3741         (WebCore::FloatingObjects::FloatingObjects):
3742         * rendering/FloatingObjects.h:
3743         (WebCore::FloatingObjects::renderer const):
3744
3745 2018-08-21  Yusuke Suzuki  <yusukesuzuki@slowstart.org>
3746
3747         Support "name" option for dedicated workers
3748         https://bugs.webkit.org/show_bug.cgi?id=188779
3749
3750         Reviewed by Joseph Pecoraro.
3751
3752         This patch adds `new Worker(url, { name: "Worker Name" })` option support[1].
3753         This name can be accessible from `self.name` of DedicatedWorkerGlobalScope.
3754         It is useful for debugging dedicated workers if the inspector can show the
3755         names of the workers. This enhancement is tracked by [2].
3756
3757         [1]: https://github.com/whatwg/html/issues/2477
3758         [2]: https://bugs.webkit.org/show_bug.cgi?id=164678
3759
3760         * workers/DedicatedWorkerGlobalScope.cpp:
3761         (WebCore::DedicatedWorkerGlobalScope::create):
3762         (WebCore::DedicatedWorkerGlobalScope::DedicatedWorkerGlobalScope):
3763         Hold `name` member.
3764
3765         * workers/DedicatedWorkerGlobalScope.h:
3766         * workers/DedicatedWorkerGlobalScope.idl:
3767         Add `name` attribute.
3768
3769         * workers/DedicatedWorkerThread.cpp:
3770         (WebCore::DedicatedWorkerThread::DedicatedWorkerThread):
3771         (WebCore::DedicatedWorkerThread::createWorkerGlobalScope):
3772         * workers/DedicatedWorkerThread.h:
3773         * workers/Worker.cpp:
3774         (WebCore::Worker::Worker):
3775         (WebCore::Worker::create):
3776         (WebCore::Worker::notifyFinished):
3777         * workers/Worker.h:
3778         * workers/Worker.idl:
3779         Add WorkerOptions for dedicated worker creation.
3780
3781         * workers/WorkerGlobalScopeProxy.h:
3782         * workers/WorkerMessagingProxy.cpp:
3783         (WebCore::WorkerMessagingProxy::startWorkerGlobalScope):
3784         * workers/WorkerMessagingProxy.h:
3785         * workers/WorkerThread.cpp:
3786         (WebCore::WorkerThreadStartupData::WorkerThreadStartupData):
3787         Isolate copy the given `name` to pass the worker thread.
3788
3789         (WebCore::WorkerThread::WorkerThread):
3790         (WebCore::WorkerThread::workerThread):
3791         * workers/WorkerThread.h:
3792         * workers/service/context/ServiceWorkerThread.cpp:
3793         (WebCore::ServiceWorkerThread::ServiceWorkerThread):
3794         (WebCore::ServiceWorkerThread::createWorkerGlobalScope):
3795         * workers/service/context/ServiceWorkerThread.h:
3796
3797 2018-08-21  Per Arne Vollan  <pvollan@apple.com>
3798
3799         [WebGL] Contexts are not updated when display configuration changed.
3800         https://bugs.webkit.org/show_bug.cgi?id=188750
3801
3802         Reviewed by Brent Fulgham.
3803
3804         Calling CGDisplayRegisterReconfigurationCallback in GraphicsContext3DManager::addContext
3805         returns kCGErrorSuccess when WindowServer access is blocked in the WebContent process,
3806         but the callback function is never called. We should register the callback function in
3807         the UI process, and send a message to the WebContent process when the display
3808         configuration changed.
3809
3810         Test: fast/canvas/webgl/context-update-on-display-configuration.html
3811
3812         * WebCore.xcodeproj/project.pbxproj:
3813         * platform/graphics/GraphicsContext3DManager.cpp:
3814         (WebCore::GraphicsContext3DManager::displayWasReconfigured):
3815         (WebCore::GraphicsContext3DManager::addContext):
3816         (WebCore::GraphicsContext3DManager::removeContext):
3817         (WebCore::displayWasReconfigured): Deleted.
3818         * platform/graphics/GraphicsContext3DManager.h:
3819
3820 2018-08-21  John Wilander  <wilander@apple.com>
3821
3822         Make ResourceLoadObserver::logWebSocketLoading() handle websockets in detached frames
3823         https://bugs.webkit.org/show_bug.cgi?id=188757
3824         <rdar://problem/38713390>
3825
3826         Reviewed by Alex Christensen.
3827
3828         Test: http/tests/websocket/construct-in-detached-frame-resource-load-statistics.html
3829
3830         * Modules/websockets/WebSocket.cpp:
3831         (WebCore::WebSocket::connect):
3832             Now logs even when a frame doesn't exist.
3833         * loader/ResourceLoadObserver.cpp:
3834         (WebCore::ResourceLoadObserver::shouldLog const):
3835             Now takes boolean 'usesEphemeralSession' instead of a page to support logging when there is no page.
3836         (WebCore::ResourceLoadObserver::logSubresourceLoading):
3837             Changed to send a boolean to ResourceLoadObserver::shouldLog().
3838         (WebCore::ResourceLoadObserver::logWebSocketLoading):
3839             Changed to:
3840             - receive the main frame's URL and a boolean for ephemeral sessions instead of the Frame.
3841             - send a boolean to ResourceLoadObserver::shouldLog().
3842             - No longer call areDomainsAssociated(). It is being removed in https://bugs.webkit.org/show_bug.cgi?id=188756.
3843         (WebCore::ResourceLoadObserver::logUserInteractionWithReducedTimeResolution):
3844             Changed to send a boolean to ResourceLoadObserver::shouldLog().
3845         * loader/ResourceLoadObserver.h:
3846
3847 2018-08-21  Daniel Bates  <dabates@apple.com>
3848
3849         Disallow navigations when page cache updates the current document of the frame
3850         https://bugs.webkit.org/show_bug.cgi?id=188422
3851
3852         Reviewed by Ryosuke Niwa.
3853
3854         Make use of NavigationDisabler to disallow navigations when associating the cached
3855         document back with its frame (i.e. calling Frame::setDocument()).
3856
3857         When we associate a cached document with its frame we will construct its render tree
3858         and run post style resolution callbacks that can do anything, including performing
3859         a frame load. Until page restoration is comnplete the frame tree is in a transient
3860         state that makes reasoning about it difficult and error prone. We should not allow
3861         navigations in this state.
3862
3863         Test: fast/history/go-back-to-object-subframe.html
3864
3865         * loader/FrameLoader.cpp:
3866         (WebCore::FrameLoader::open):
3867
3868 2018-08-21  Daniel Bates  <dabates@apple.com>
3869
3870         Replace TextCheckingTypeMask with OptionSet
3871         https://bugs.webkit.org/show_bug.cgi?id=188678
3872
3873         Reviewed by Antti Koivisto.
3874
3875         Replaces TextCheckingTypeMask with an OptionSet to improve type safety and code clarity. Additionally
3876         change the values of TextCheckingType such that all the enumerators fit within an uint8_t.
3877
3878         * PlatformMac.cmake:
3879         * SourcesCocoa.txt:
3880         * WebCore.xcodeproj/project.pbxproj:
3881         * accessibility/AccessibilityObject.cpp:
3882         (WebCore::AccessibilityObject::hasMisspelling const):
3883         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
3884         (AXAttributeStringSetSpelling):
3885         * editing/AlternativeTextController.cpp:
3886         (WebCore::AlternativeTextController::timerFired):
3887         (WebCore::AlternativeTextController::processMarkersOnTextToBeReplacedByResult):
3888         * editing/Editor.cpp:
3889         (WebCore::Editor::replaceSelectionWithFragment):
3890         (WebCore::Editor::markMisspellingsAfterTypingToWord):
3891         (WebCore::Editor::markAllMisspellingsAndBadGrammarInRanges):
3892         (WebCore::isAutomaticTextReplacementType):
3893         (WebCore::Editor::markAndReplaceFor): For now, change a local variable from const to non-const to work
3894         around the following MSVC compiler bug: <https://developercommunity.visualstudio.com/content/problem/316713/msvc-cant-compile-webkits-optionsetcontainsany.html>.
3895         (WebCore::Editor::markMisspellingsAndBadGrammar):
3896         (WebCore::Editor::updateMarkersForWordsAffectedByEditing):
3897         (WebCore::Editor::editorUIUpdateTimerFired):
3898         (WebCore::Editor::resolveTextCheckingTypeMask):
3899         * editing/Editor.h:
3900         * editing/SpellChecker.cpp:
3901         (WebCore::SpellCheckRequest::SpellCheckRequest):
3902         (WebCore::SpellCheckRequest::create):
3903         (WebCore::SpellChecker::didCheckSucceed):
3904         * editing/SpellChecker.h:
3905         * editing/TextCheckingHelper.cpp:
3906         (WebCore::findGrammaticalErrors):
3907         (WebCore::findMisspellings):
3908         (WebCore::TextCheckingHelper::findFirstMisspellingOrBadGrammar):
3909         (WebCore::TextCheckingHelper::guessesForMisspelledOrUngrammaticalRange const):
3910         (WebCore::checkTextOfParagraph):
3911         * editing/TextCheckingHelper.h:
3912         * loader/EmptyClients.cpp:
3913         * platform/text/TextCheckerClient.h:
3914         * platform/text/TextChecking.h: Remove TextCheckingTypeMask. Reorganized the fields of TextCheckingRequestData
3915         to coallesce padding and move it to the end of class. Also used default initializer syntax and defaulted (= default)
3916         the default constructor of TextCheckingRequestData, removing the need for a user-defined default constructor.
3917         (WebCore::TextCheckingRequestData::TextCheckingRequestData):
3918         (WebCore::TextCheckingRequestData::text const): Changed return type from String to const String&
3919         to avoid unnecessary ref-count churn for callers that do not need to take a shared ownership in
3920         this string.
3921         (WebCore::TextCheckingRequestData::checkingTypes const): Renamed; formerly named mask.
3922         (WebCore::TextCheckingRequestData::mask const): Deleted.
3923         * platform/text/mac/TextCheckingMac.mm: Added.
3924         (WebCore::nsTextCheckingTypes):
3925         * testing/Internals.cpp:
3926         (WebCore::Internals::handleAcceptedCandidate):
3927
3928 2018-08-21  Fujii Hironori  <Hironori.Fujii@sony.com>
3929
3930         Don't place "using namespace XXX;" in global space for unified source builds
3931         https://bugs.webkit.org/show_bug.cgi?id=188739
3932
3933         Reviewed by Yusuke Suzuki.
3934
3935         No new tests (No behavior change).
3936
3937         * html/track/AudioTrackList.cpp:
3938         * html/track/TextTrackList.cpp:
3939         * html/track/VideoTrackList.cpp:
3940         * page/SecurityOriginData.cpp:
3941         * page/TextIndicator.cpp:
3942         * platform/geoclue/GeolocationProviderGeoclue.cpp:
3943         * platform/graphics/gstreamer/ImageGStreamerCairo.cpp:
3944         * platform/graphics/win/FullScreenController.cpp:
3945         * platform/mediastream/CaptureDeviceManager.cpp:
3946         * platform/mock/MediaPlaybackTargetPickerMock.cpp:
3947         * svg/animation/SMILTime.cpp:
3948         * testing/js/WebCoreTestSupport.cpp:
3949         * xml/XPathParser.cpp:
3950
3951 2018-08-21  Philippe Normand  <philn@igalia.com>
3952
3953         [GStreamer] Warn early about incomplete MSE track switching support
3954         https://bugs.webkit.org/show_bug.cgi?id=188653
3955
3956        &n