Implement "UpdateWorkerState" and use it
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2017-11-07  Brady Eidson  <beidson@apple.com>
2
3         Implement "UpdateWorkerState" and use it
4         https://bugs.webkit.org/show_bug.cgi?id=179318
5
6         Reviewed by Chris Dumez.
7
8         No new tests (Existing tests and changes there-to).
9
10         * workers/service/ServiceWorker.cpp:
11         (WebCore::ServiceWorker::allWorkers):
12         (WebCore::ServiceWorker::mutableAllWorkers):
13         (WebCore::ServiceWorker::ServiceWorker):
14         (WebCore::ServiceWorker::~ServiceWorker):
15         (WebCore::ServiceWorker::updateWorkerState):
16         (WebCore::ServiceWorker::setState): Deleted.
17         * workers/service/ServiceWorker.h:
18
19         * workers/service/ServiceWorkerContainer.cpp:
20         (WebCore::ServiceWorkerContainer::updateRegistrationState):
21         (WebCore::ServiceWorkerContainer::jobResolvedWithRegistration):
22         * workers/service/ServiceWorkerContainer.h:
23
24         * workers/service/ServiceWorkerRegistration.cpp:
25         (WebCore::ServiceWorkerRegistration::ServiceWorkerRegistration):
26         (WebCore::ServiceWorkerRegistration::~ServiceWorkerRegistration):
27         (WebCore::ServiceWorkerRegistration::updateStateFromServer):
28
29         * workers/service/ServiceWorkerRegistrationData.cpp:
30         (WebCore::ServiceWorkerRegistrationData::isolatedCopy const):
31         * workers/service/ServiceWorkerRegistrationData.h:
32         (WebCore::ServiceWorkerRegistrationData::encode const):
33         (WebCore::ServiceWorkerRegistrationData::decode):
34
35         * workers/service/ServiceWorkerRegistrationKey.cpp:
36         (WebCore::ServiceWorkerRegistrationKey::loggingString const):
37         * workers/service/ServiceWorkerRegistrationKey.h:
38
39         * workers/service/ServiceWorkerTypes.h:
40
41         * workers/service/context/SWContextManager.cpp:
42         (WebCore::SWContextManager::registerServiceWorkerThreadForInstall):
43         (WebCore::SWContextManager::registerServiceWorkerThreadForUpdate): Deleted.
44         * workers/service/context/SWContextManager.h:
45
46         * workers/service/server/SWClientConnection.cpp:
47         (WebCore::SWClientConnection::updateRegistrationState):
48         (WebCore::SWClientConnection::updateWorkerState):
49         * workers/service/server/SWClientConnection.h:
50
51         * workers/service/server/SWServer.cpp:
52         (WebCore::SWServer::updateWorker):
53         * workers/service/server/SWServer.h:
54         (WebCore::SWServer::workerByID const):
55
56         * workers/service/server/SWServerJobQueue.cpp:
57         (WebCore::SWServerJobQueue::scriptFetchFinished):
58         (WebCore::SWServerJobQueue::scriptContextStarted):
59         (WebCore::SWServerJobQueue::install):
60         (WebCore::SWServerJobQueue::tryClearRegistration):
61
62         * workers/service/server/SWServerRegistration.cpp:
63         (WebCore::SWServerRegistration::updateRegistrationState):
64         (WebCore::SWServerRegistration::updateWorkerState):
65         (WebCore::SWServerRegistration::data const):
66         * workers/service/server/SWServerRegistration.h:
67         (WebCore::SWServerRegistration::setActiveServiceWorkerIdentifier): Deleted.
68
69         * workers/service/server/SWServerWorker.h:
70         (WebCore::SWServerWorker::state const):
71         (WebCore::SWServerWorker::setState):
72
73 2017-11-07  Zalan Bujtas  <zalan@apple.com>
74
75         [LayoutState cleanup] Remove explicit LayoutStateMaintainer::pop calls.
76         https://bugs.webkit.org/show_bug.cgi?id=179380
77         <rdar://problem/35392161>
78
79         Reviewed by Antti Koivisto.
80
81         Besides the pagination related explicit pops (FIXME), all LayoutStateMaintainer pops are
82         now in LayoutStateMaintainer's d'tor.
83
84         Covered by existing tests.
85
86         * rendering/LayoutState.cpp:
87         (WebCore::LayoutStateMaintainer::~LayoutStateMaintainer):
88         * rendering/RenderBlock.cpp:
89         (WebCore::RenderBlock::simplifiedLayout):
90         * rendering/RenderBlockFlow.cpp:
91         (WebCore::RenderBlockFlow::layoutBlock):
92         * rendering/RenderBox.cpp:
93         (WebCore::RenderBox::layout):
94         * rendering/RenderDeprecatedFlexibleBox.cpp:
95         (WebCore::RenderDeprecatedFlexibleBox::layoutBlock):
96         * rendering/RenderEmbeddedObject.cpp:
97         (WebCore::RenderEmbeddedObject::layout):
98         * rendering/RenderFlexibleBox.cpp:
99         (WebCore::RenderFlexibleBox::layoutBlock):
100         * rendering/RenderGrid.cpp:
101         (WebCore::RenderGrid::layoutBlock):
102         * rendering/RenderImage.cpp:
103         (WebCore::RenderImage::layoutShadowControls):
104         * rendering/RenderTable.cpp:
105         (WebCore::RenderTable::layout):
106         * rendering/RenderTableRow.cpp:
107         (WebCore::RenderTableRow::layout):
108         * rendering/RenderTableSection.cpp:
109         (WebCore::RenderTableSection::calcRowLogicalHeight):
110         (WebCore::RenderTableSection::layout):
111         (WebCore::RenderTableSection::layoutRows):
112         * rendering/RenderVTTCue.cpp:
113         (WebCore::RenderVTTCue::layout):
114         * rendering/RenderView.cpp:
115         (WebCore::RenderView::layout):
116
117 2017-11-07  Commit Queue  <commit-queue@webkit.org>
118
119         Unreviewed, rolling out r224512 and r224521.
120         https://bugs.webkit.org/show_bug.cgi?id=179388
121
122         An API test added with this change is failing an assertion on
123         the bots. (Requested by ryanhaddad on #webkit).
124
125         Reverted changesets:
126
127         "[Attachment Support] Implement delegate hooks for attachment
128         element insertion and removal"
129         https://bugs.webkit.org/show_bug.cgi?id=179016
130         https://trac.webkit.org/changeset/224512
131
132         "Remove stray logging from a newly added API test"
133         https://trac.webkit.org/changeset/224521
134
135 2017-11-07  Antoine Quint  <graouts@apple.com>
136
137         <video> does not respect pointer-events
138         https://bugs.webkit.org/show_bug.cgi?id=179378
139         <rdar://problem/34687668>
140
141         Reviewed by Simon Fraser.
142
143         We now honor the "pointer-events" property value set on the <video> element by setting it to "inherit"
144         on the media controls shadow root container.
145
146         Test: media/modern-media-controls/css/pointer-events-none.html
147
148         * Modules/modern-media-controls/controls/media-controls.css:
149         (.media-controls-container):
150
151 2017-11-07  Chris Dumez  <cdumez@apple.com>
152
153         [Service Workers] Add support for "install" event
154         https://bugs.webkit.org/show_bug.cgi?id=179338
155
156         Reviewed by Youenn Fablet.
157
158         Add support for "install" event as per:
159         - https://w3c.github.io/ServiceWorker/#installation-algorithm (Step 10)
160
161         For now, install always succeeds as our support for ExtendableEvent.waitUntil() is
162         still incomplete.
163
164         Test: http/tests/workers/service/basic-install-event.html
165
166         * workers/service/ServiceWorkerContainer.cpp:
167         (WebCore::ServiceWorkerContainer::firePostInstallEvents):
168         * workers/service/ServiceWorkerContainer.h:
169         * workers/service/context/SWContextManager.cpp:
170         (WebCore::SWContextManager::fireInstallEvent):
171         * workers/service/context/SWContextManager.h:
172         * workers/service/context/ServiceWorkerThread.cpp:
173         (WebCore::ServiceWorkerThread::fireInstallEvent):
174         * workers/service/context/ServiceWorkerThread.h:
175         * workers/service/server/SWClientConnection.cpp:
176         (WebCore::SWClientConnection::firePostInstallEvents):
177         * workers/service/server/SWClientConnection.h:
178         * workers/service/server/SWServer.cpp:
179         (WebCore::SWServer::Connection::didFinishInstall):
180         (WebCore::SWServer::didFinishInstall):
181         (WebCore::SWServer::fireInstallEvent):
182         * workers/service/server/SWServer.h:
183         * workers/service/server/SWServerJobQueue.cpp:
184         (WebCore::SWServerJobQueue::scriptContextStarted):
185         (WebCore::SWServerJobQueue::install):
186         (WebCore::SWServerJobQueue::didFinishInstall):
187         * workers/service/server/SWServerJobQueue.h:
188         * workers/service/server/SWServerRegistration.cpp:
189         (WebCore::SWServerRegistration::firePostInstallEvents):
190         * workers/service/server/SWServerRegistration.h:
191
192 2017-11-07  Ryan Haddad  <ryanhaddad@apple.com>
193
194         Unreviewed, rolling out r224498.
195
196         The LayoutTest for this change is flaky and affecting EWS
197         results.
198
199         Reverted changeset:
200
201         "Add tests to ensure that <source> tags are only preloaded
202         when the `type`"
203         https://bugs.webkit.org/show_bug.cgi?id=179231
204         https://trac.webkit.org/changeset/224498
205
206 2017-11-07  Joseph Pecoraro  <pecoraro@apple.com>
207
208         Web Inspector: Add some fast returns in cases where we only call through to a NetworkAgent
209         https://bugs.webkit.org/show_bug.cgi?id=179359
210
211         Reviewed by Devin Rousso.
212
213         * inspector/InspectorInstrumentation.h:
214         (WebCore::InspectorInstrumentation::willSendRequest):
215         (WebCore::InspectorInstrumentation::willSendRequestOfType):
216         (WebCore::InspectorInstrumentation::didLoadResourceFromMemoryCache):
217         (WebCore::InspectorInstrumentation::didReceiveThreadableLoaderResponse):
218         (WebCore::InspectorInstrumentation::didReceiveData):
219         (WebCore::InspectorInstrumentation::didFinishXHRLoading):
220         (WebCore::InspectorInstrumentation::willLoadXHRSynchronously):
221         (WebCore::InspectorInstrumentation::didLoadXHRSynchronously):
222         (WebCore::InspectorInstrumentation::scriptImported):
223         (WebCore::InspectorInstrumentation::didReceiveScriptResponse):
224         Fast return if no frontend in cases that only call into NetworkAgent
225         because the NetworkAgent is only available if there is a frontend.
226
227 2017-10-31  Filip Pizlo  <fpizlo@apple.com>
228
229         bmalloc should support strictly type-segregated isolated heaps
230         https://bugs.webkit.org/show_bug.cgi?id=178108
231
232         Reviewed by Saam Barati, Simon Fraser, and Ryosuke Niwa.
233
234         No new tests because no new change in behavior. Though, the bmalloc change has a unit test.
235         
236         Adopting IsoHeap means dropping in macros in both the .h and .cpp file of each class that we
237         opt in. It's not pretty, but it helps ensure speedy allocation since it means that we never
238         have to do any kind of switch or dynamic lookup to find the right allocator for a type.
239         
240         This change is perf-neutral on MotionMark, PLT3, and membuster.
241
242         * Sources.txt:
243         * html/shadow/SliderThumbElement.cpp:
244         * html/shadow/SliderThumbElement.h:
245         * html/shadow/mac/ImageControlsButtonElementMac.cpp:
246         * html/shadow/mac/ImageControlsRootElementMac.cpp:
247         * rendering/RenderAttachment.cpp:
248         * rendering/RenderAttachment.h:
249         * rendering/RenderBlock.cpp:
250         * rendering/RenderBlock.h:
251         * rendering/RenderBlockFlow.cpp:
252         * rendering/RenderBlockFlow.h:
253         * rendering/RenderBox.cpp:
254         * rendering/RenderBox.h:
255         * rendering/RenderBoxModelObject.cpp:
256         * rendering/RenderBoxModelObject.h:
257         * rendering/RenderButton.cpp:
258         * rendering/RenderButton.h:
259         * rendering/RenderCombineText.cpp:
260         * rendering/RenderCombineText.h:
261         * rendering/RenderCounter.cpp:
262         * rendering/RenderCounter.h:
263         * rendering/RenderDeprecatedFlexibleBox.cpp:
264         * rendering/RenderDeprecatedFlexibleBox.h:
265         * rendering/RenderDetailsMarker.cpp:
266         * rendering/RenderDetailsMarker.h:
267         * rendering/RenderElement.cpp:
268         * rendering/RenderElement.h:
269         * rendering/RenderEmbeddedObject.cpp:
270         * rendering/RenderEmbeddedObject.h:
271         * rendering/RenderFileUploadControl.cpp:
272         * rendering/RenderFileUploadControl.h:
273         * rendering/RenderFlexibleBox.cpp:
274         * rendering/RenderFlexibleBox.h:
275         * rendering/RenderFragmentContainer.cpp:
276         * rendering/RenderFragmentContainer.h:
277         * rendering/RenderFragmentContainerSet.cpp:
278         * rendering/RenderFragmentContainerSet.h:
279         * rendering/RenderFragmentedFlow.cpp:
280         * rendering/RenderFragmentedFlow.h:
281         * rendering/RenderFrameBase.cpp:
282         * rendering/RenderFrameBase.h:
283         * rendering/RenderFrameSet.cpp:
284         * rendering/RenderFrameSet.h:
285         * rendering/RenderFullScreen.cpp:
286         * rendering/RenderFullScreen.h:
287         * rendering/RenderGrid.cpp:
288         * rendering/RenderGrid.h:
289         * rendering/RenderHTMLCanvas.cpp:
290         * rendering/RenderHTMLCanvas.h:
291         * rendering/RenderImage.cpp:
292         * rendering/RenderImage.h:
293         * rendering/RenderImageResourceStyleImage.cpp:
294         * rendering/RenderImageResourceStyleImage.h:
295         * rendering/RenderInline.cpp:
296         * rendering/RenderInline.h:
297         * rendering/RenderLayerModelObject.cpp:
298         * rendering/RenderLayerModelObject.h:
299         * rendering/RenderLineBreak.cpp:
300         * rendering/RenderLineBreak.h:
301         * rendering/RenderListBox.cpp:
302         * rendering/RenderListBox.h:
303         * rendering/RenderListItem.cpp:
304         * rendering/RenderListItem.h:
305         * rendering/RenderListMarker.cpp:
306         * rendering/RenderListMarker.h:
307         * rendering/RenderMedia.cpp:
308         * rendering/RenderMedia.h:
309         * rendering/RenderMediaControlElements.cpp:
310         * rendering/RenderMediaControlElements.h:
311         * rendering/RenderMenuList.cpp:
312         * rendering/RenderMenuList.h:
313         * rendering/RenderMeter.cpp:
314         * rendering/RenderMeter.h:
315         * rendering/RenderMultiColumnFlow.cpp:
316         * rendering/RenderMultiColumnFlow.h:
317         * rendering/RenderMultiColumnSet.cpp:
318         * rendering/RenderMultiColumnSet.h:
319         * rendering/RenderMultiColumnSpannerPlaceholder.cpp:
320         * rendering/RenderMultiColumnSpannerPlaceholder.h:
321         * rendering/RenderObject.cpp:
322         * rendering/RenderObject.h:
323         * rendering/RenderProgress.cpp:
324         * rendering/RenderProgress.h:
325         * rendering/RenderQuote.cpp:
326         * rendering/RenderQuote.h:
327         * rendering/RenderReplaced.cpp:
328         * rendering/RenderReplaced.h:
329         * rendering/RenderReplica.cpp:
330         * rendering/RenderReplica.h:
331         * rendering/RenderRuby.cpp:
332         * rendering/RenderRuby.h:
333         * rendering/RenderRubyBase.cpp:
334         * rendering/RenderRubyBase.h:
335         * rendering/RenderRubyRun.cpp:
336         * rendering/RenderRubyRun.h:
337         * rendering/RenderRubyText.cpp:
338         * rendering/RenderRubyText.h:
339         * rendering/RenderScrollbarPart.cpp:
340         * rendering/RenderScrollbarPart.h:
341         * rendering/RenderSearchField.cpp:
342         * rendering/RenderSearchField.h:
343         * rendering/RenderSlider.cpp:
344         * rendering/RenderSlider.h:
345         * rendering/RenderTable.cpp:
346         * rendering/RenderTable.h:
347         * rendering/RenderTableCaption.cpp:
348         * rendering/RenderTableCaption.h:
349         * rendering/RenderTableCell.cpp:
350         * rendering/RenderTableCell.h:
351         * rendering/RenderTableCol.cpp:
352         * rendering/RenderTableCol.h:
353         * rendering/RenderTableRow.cpp:
354         * rendering/RenderTableRow.h:
355         * rendering/RenderTableSection.cpp:
356         * rendering/RenderTableSection.h:
357         * rendering/RenderText.cpp:
358         * rendering/RenderText.h:
359         * rendering/RenderTextControl.cpp:
360         * rendering/RenderTextControl.h:
361         * rendering/RenderTextControlMultiLine.cpp:
362         * rendering/RenderTextControlMultiLine.h:
363         * rendering/RenderTextControlSingleLine.cpp:
364         * rendering/RenderTextControlSingleLine.h:
365         * rendering/RenderTextFragment.cpp:
366         * rendering/RenderTextFragment.h:
367         * rendering/RenderVTTCue.cpp:
368         * rendering/RenderVTTCue.h:
369         * rendering/RenderVideo.cpp:
370         * rendering/RenderVideo.h:
371         * rendering/RenderView.cpp:
372         * rendering/RenderView.h:
373         * rendering/RenderWidget.cpp:
374         * rendering/RenderWidget.h:
375         * rendering/mathml/RenderMathMLBlock.cpp:
376         * rendering/mathml/RenderMathMLBlock.h:
377         * rendering/mathml/RenderMathMLFenced.cpp:
378         * rendering/mathml/RenderMathMLFenced.h:
379         * rendering/mathml/RenderMathMLFencedOperator.cpp:
380         * rendering/mathml/RenderMathMLFencedOperator.h:
381         * rendering/mathml/RenderMathMLFraction.cpp:
382         * rendering/mathml/RenderMathMLFraction.h:
383         * rendering/mathml/RenderMathMLMath.cpp:
384         * rendering/mathml/RenderMathMLMath.h:
385         * rendering/mathml/RenderMathMLMenclose.cpp:
386         * rendering/mathml/RenderMathMLMenclose.h:
387         * rendering/mathml/RenderMathMLOperator.cpp:
388         * rendering/mathml/RenderMathMLOperator.h:
389         * rendering/mathml/RenderMathMLPadded.cpp:
390         * rendering/mathml/RenderMathMLPadded.h:
391         * rendering/mathml/RenderMathMLRoot.cpp:
392         * rendering/mathml/RenderMathMLRoot.h:
393         * rendering/mathml/RenderMathMLRow.cpp:
394         * rendering/mathml/RenderMathMLRow.h:
395         * rendering/mathml/RenderMathMLScripts.cpp:
396         * rendering/mathml/RenderMathMLScripts.h:
397         * rendering/mathml/RenderMathMLSpace.cpp:
398         * rendering/mathml/RenderMathMLSpace.h:
399         * rendering/mathml/RenderMathMLToken.cpp:
400         * rendering/mathml/RenderMathMLToken.h:
401         * rendering/mathml/RenderMathMLUnderOver.cpp:
402         * rendering/mathml/RenderMathMLUnderOver.h:
403         * rendering/svg/RenderSVGBlock.cpp:
404         * rendering/svg/RenderSVGBlock.h:
405         * rendering/svg/RenderSVGContainer.cpp:
406         * rendering/svg/RenderSVGContainer.h:
407         * rendering/svg/RenderSVGEllipse.cpp:
408         * rendering/svg/RenderSVGEllipse.h:
409         * rendering/svg/RenderSVGForeignObject.cpp:
410         * rendering/svg/RenderSVGForeignObject.h:
411         * rendering/svg/RenderSVGGradientStop.cpp:
412         * rendering/svg/RenderSVGGradientStop.h:
413         * rendering/svg/RenderSVGHiddenContainer.cpp:
414         * rendering/svg/RenderSVGHiddenContainer.h:
415         * rendering/svg/RenderSVGImage.cpp:
416         * rendering/svg/RenderSVGImage.h:
417         * rendering/svg/RenderSVGInline.cpp:
418         * rendering/svg/RenderSVGInline.h:
419         * rendering/svg/RenderSVGInlineText.cpp:
420         * rendering/svg/RenderSVGInlineText.h:
421         * rendering/svg/RenderSVGModelObject.cpp:
422         * rendering/svg/RenderSVGModelObject.h:
423         * rendering/svg/RenderSVGPath.cpp:
424         * rendering/svg/RenderSVGPath.h:
425         * rendering/svg/RenderSVGRect.cpp:
426         * rendering/svg/RenderSVGRect.h:
427         * rendering/svg/RenderSVGResourceClipper.cpp:
428         * rendering/svg/RenderSVGResourceClipper.h:
429         * rendering/svg/RenderSVGResourceContainer.cpp:
430         * rendering/svg/RenderSVGResourceContainer.h:
431         * rendering/svg/RenderSVGResourceFilter.cpp:
432         * rendering/svg/RenderSVGResourceFilter.h:
433         * rendering/svg/RenderSVGResourceFilterPrimitive.cpp:
434         * rendering/svg/RenderSVGResourceFilterPrimitive.h:
435         * rendering/svg/RenderSVGResourceGradient.cpp:
436         * rendering/svg/RenderSVGResourceGradient.h:
437         * rendering/svg/RenderSVGResourceLinearGradient.cpp:
438         * rendering/svg/RenderSVGResourceLinearGradient.h:
439         * rendering/svg/RenderSVGResourceMarker.cpp:
440         * rendering/svg/RenderSVGResourceMarker.h:
441         * rendering/svg/RenderSVGResourceMasker.cpp:
442         * rendering/svg/RenderSVGResourceMasker.h:
443         * rendering/svg/RenderSVGResourcePattern.cpp:
444         * rendering/svg/RenderSVGResourcePattern.h:
445         * rendering/svg/RenderSVGResourceRadialGradient.cpp:
446         * rendering/svg/RenderSVGResourceRadialGradient.h:
447         * rendering/svg/RenderSVGRoot.cpp:
448         * rendering/svg/RenderSVGRoot.h:
449         * rendering/svg/RenderSVGShape.cpp:
450         * rendering/svg/RenderSVGShape.h:
451         * rendering/svg/RenderSVGTSpan.cpp: Added.
452         * rendering/svg/RenderSVGTSpan.h:
453         * rendering/svg/RenderSVGText.cpp:
454         * rendering/svg/RenderSVGText.h:
455         * rendering/svg/RenderSVGTextPath.cpp:
456         * rendering/svg/RenderSVGTextPath.h:
457         * rendering/svg/RenderSVGTransformableContainer.cpp:
458         * rendering/svg/RenderSVGTransformableContainer.h:
459         * rendering/svg/RenderSVGViewportContainer.cpp:
460         * rendering/svg/RenderSVGViewportContainer.h:
461
462 2017-11-07  Antti Koivisto  <antti@apple.com>
463
464         Dynamic media queries don't update in shadow tree stylesheets
465         https://bugs.webkit.org/show_bug.cgi?id=179324
466
467         Reviewed by Ryosuke Niwa.
468
469         Viewport and accessibility queries should work dynamically also in shadow trees.
470
471         Test: fast/shadow-dom/media-query-in-shadow-style.html
472
473         * page/LayoutContext.cpp:
474         (WebCore::LayoutContext::updateStyleForLayout):
475         * page/Page.cpp:
476         (WebCore::Page::accessibilitySettingsDidChange):
477
478             Evaluate media query list (JS API) unconditionally as it is independent from style queries.
479             Remove some logging.
480
481         * style/StyleScope.cpp:
482         (WebCore::Style::Scope::evaluateMediaQueriesForViewportChange):
483         (WebCore::Style::Scope::evaluateMediaQueriesForAccessibilitySettingsChange):
484
485             Factor into functions in style scope.
486
487         (WebCore::Style::Scope::evaluateMediaQueries):
488
489             Evaluate queries in all shadow trees too.
490
491         * style/StyleScope.h:
492
493 2017-11-07  Ryosuke Niwa  <rniwa@webkit.org>
494
495         Release-assert NoEventDispatchAssertion in canExecute, updateLayout, and updateStyle
496         https://bugs.webkit.org/show_bug.cgi?id=179281
497         <rdar://problem/35008993>
498
499         Reviewed by Antti Koivisto.
500
501         Surgically enable NoEventDispatchAssertion::InMainThread::isEventAllowed() in release builds to prevent
502         against insecure execution of author scripts.
503
504         No new tests since there should be no behavioral changes (other than preventing potential security bugs
505         from being exploited).
506
507         * bindings/js/ScriptController.cpp:
508         (WebCore::ScriptController::canExecuteScripts): Use the release assert here. This function is consulted
509         whenever author scripts are executed in event handler, script element, etc... in the main thread so
510         enabling the release assert here should basically prevent all unwanted script executions protected by
511         NoEventDispatchAssertion.
512         * dom/ContainerNode.cpp:
513         (NoEventDispatchAssertion::s_count): Now always compiled.
514         * dom/Document.cpp:
515         (WebCore::Document::updateStyleIfNeeded): Use the release assert here. This assertion would prevent
516         unwanted style updating. This part of the change can be reverted if it turns out to be too crashy since
517         just updating the style would not directly introduce a security vulnerability.
518         (WebCore::Document::updateLayout): Ditto for updating the layout.
519         * dom/NoEventDispatchAssertion.h:
520         (WebCore::NoEventDispatchAssertion::NoEventDispatchAssertion): Enabled this in release builds.
521         (WebCore::NoEventDispatchAssertion::~NoEventDispatchAssertion): Ditto.
522         (WebCore::NoEventDispatchAssertion::isEventAllowedInMainThread): Ditto.
523         (WebCore::NoEventDispatchAssertion::InMainThread::InMainThread): Ditto.
524         (WebCore::NoEventDispatchAssertion::InMainThread::~InMainThread): Ditto.
525         (WebCore::NoEventDispatchAssertion::InMainThread::isEventDispatchAllowedInSubtree): We still don't enable
526         this assertion because this check requires O(n) operation. Added a comment to that end.
527         (WebCore::NoEventDispatchAssertion::InMainThread::isEventAllowed): Enabled this in release builds.
528         (WebCore::NoEventDispatchAssertion::DisableAssertionsInScope): Ditto.
529         * dom/ScriptElement.cpp:
530         (WebCore::ScriptElement::executeClassicScript): Use the release assert here. This is the function used by
531         the HTML parser to run scripts via HTMLScriptRunner::executePendingScriptAndDispatchEvent. Having a release
532         assertion here should prevent the rest of the unwanted script executions in the HTML parser not caught by
533         canExecuteScripts.
534
535 2017-11-07  Adrian Perez de Castro  <aperez@igalia.com>
536
537         [WPE][GTK] Building with ENABLE_VIDEO=OFF fails to find AudioTrack.idl
538         https://bugs.webkit.org/show_bug.cgi?id=179372
539
540         Reviewed by Michael Catanzaro.
541
542         Arrange MSE extensions defined in {Audio,Text,Video}TrackMediaSource.idl to be
543         only used for building when both ENABLE_VIDEO_TRACK and ENABLE_MEDIA_SOURCE are
544         enabled.
545
546         No new tests needed.
547
548         * CMakeLists.txt: Add conditional for ENABLE_MEDIA_SOURCE and move the addition
549         of the IDL files to the build there.
550         * Sources.txt: Conversely, source unification should skip sources derived from
551         the IDL files when ENABLE_MEDIA_SOURCE disabled, so add guards as well.
552
553 2017-11-07  Youenn Fablet  <youenn@apple.com>
554
555         Support the case of fetch events that are not responded
556         https://bugs.webkit.org/show_bug.cgi?id=179336
557
558         Reviewed by Chris Dumez.
559
560         Covered by updated test.
561
562         Implementing https://w3c.github.io/ServiceWorker/#on-fetch-request-algorithm step 19.
563         Making FetchEvent cancellable.
564
565         * workers/service/FetchEvent.h:
566         * workers/service/context/ServiceWorkerFetch.cpp:
567         (WebCore::ServiceWorkerFetch::dispatchFetchEvent):
568         * workers/service/context/ServiceWorkerFetch.h:
569
570 2017-11-07  Joseph Pecoraro  <pecoraro@apple.com>
571
572         Web Inspector: Create inspector agents lazily
573         https://bugs.webkit.org/show_bug.cgi?id=179360
574
575         Reviewed by Sam Weinig.
576
577         * inspector/CommandLineAPIHost.h:
578         Modernize style.
579
580         * inspector/InspectorController.h:
581         * inspector/InspectorController.cpp:
582         (WebCore::InspectorController::InspectorController):
583         (WebCore::InspectorController::pageAgentContext):
584         (WebCore::InspectorController::createLazyAgents):
585         (WebCore::InspectorController::connectFrontend):
586         Move many of the agent construction to happen lazily. These
587         agent's aren't needed until an inspector connects, so defer
588         creation until an inspector connects.
589
590 2017-11-06  Zalan Bujtas  <zalan@apple.com>
591
592         [LayoutState cleanup] Move m_layoutState from RenderView to LayoutContext
593         https://bugs.webkit.org/show_bug.cgi?id=179282
594         <rdar://problem/35348653>
595
596         Reviewed by Antti Koivisto.
597
598         LayoutContext now owns the top level LayoutState object.
599         It makes RenderView behave like any other renderer by constructing a LayoutStateMaintainer on the stack.
600         This is mostly moving code from RenderView.h/.cpp to LayoutContext.h/.cpp and fixing the callsites.
601         (While view().frameView().layoutContext().layoutState() is a bit lengthy, it's
602         temporary only, since LayoutState is planned to be an argument of the layout() method.  
603
604         Covered by existing test.
605
606         * accessibility/AXObjectCache.cpp:
607         (WebCore::AXObjectCache::notificationPostTimerFired):
608         * page/LayoutContext.cpp:
609         (WebCore::LayoutContext::layoutDelta const):
610         (WebCore::LayoutContext::addLayoutDelta):
611         (WebCore::LayoutContext::layoutDeltaMatches):
612         (WebCore::LayoutContext::pushLayoutState):
613         (WebCore::LayoutContext::pushLayoutStateForPaginationIfNeeded):
614         (WebCore::LayoutContext::popLayoutState):
615         (WebCore::LayoutContext::checkLayoutState):
616         * page/LayoutContext.h:
617         (WebCore::LayoutContext::layoutState const):
618         (WebCore::LayoutContext::layoutStateEnabled const):
619         (WebCore::LayoutContext::disableLayoutState):
620         (WebCore::LayoutContext::enableLayoutState):
621         * rendering/LayoutState.cpp:
622         (WebCore::LayoutState::LayoutState):
623         (WebCore::LayoutState::computeClipRect):
624         (WebCore::LayoutStateMaintainer::LayoutStateMaintainer):
625         (WebCore::LayoutStateMaintainer::push):
626         (WebCore::LayoutStateMaintainer::pop):
627         (WebCore::LayoutStateDisabler::LayoutStateDisabler):
628         (WebCore::LayoutStateDisabler::~LayoutStateDisabler):
629         (WebCore::SubtreeLayoutStateMaintainer::SubtreeLayoutStateMaintainer):
630         (WebCore::SubtreeLayoutStateMaintainer::~SubtreeLayoutStateMaintainer):
631         (WebCore::PaginatedLayoutStateMaintainer::PaginatedLayoutStateMaintainer):
632         (WebCore::PaginatedLayoutStateMaintainer::~PaginatedLayoutStateMaintainer):
633         * rendering/LayoutState.h:
634         * rendering/RenderBlock.cpp:
635         (WebCore::RenderBlock::setLogicalLeftForChild):
636         (WebCore::RenderBlock::setLogicalTopForChild):
637         (WebCore::RenderBlock::layoutPositionedObject):
638         (WebCore::RenderBlock::markForPaginationRelayoutIfNeeded):
639         (WebCore::RenderBlock::adjustLogicalLeftOffsetForLine const):
640         (WebCore::RenderBlock::adjustLogicalRightOffsetForLine const):
641         (WebCore::RenderBlock::offsetFromLogicalTopOfFirstPage const):
642         (WebCore::RenderBlock::childBoxIsUnsplittableForFragmentation const):
643         * rendering/RenderBlockFlow.cpp:
644         (WebCore::RenderBlockFlow::layoutBlock):
645         (WebCore::RenderBlockFlow::layoutBlockChildren):
646         (WebCore::RenderBlockFlow::layoutBlockChild):
647         (WebCore::RenderBlockFlow::collapseMarginsWithChildInfo):
648         (WebCore::RenderBlockFlow::estimateLogicalTopPosition):
649         (WebCore::RenderBlockFlow::applyBeforeBreak):
650         (WebCore::RenderBlockFlow::applyAfterBreak):
651         (WebCore::RenderBlockFlow::hasNextPage const):
652         (WebCore::RenderBlockFlow::pageLogicalTopForOffset const):
653         (WebCore::RenderBlockFlow::pageLogicalHeightForOffset const):
654         (WebCore::RenderBlockFlow::pageRemainingLogicalHeightForOffset const):
655         (WebCore::RenderBlockFlow::repaintOverhangingFloats):
656         (WebCore::RenderBlockFlow::insertFloatingObject):
657         (WebCore::RenderBlockFlow::positionNewFloats):
658         (WebCore::RenderBlockFlow::layoutSimpleLines):
659         * rendering/RenderBlockLineLayout.cpp:
660         (WebCore::RenderBlockFlow::layoutRunsAndFloats):
661         (WebCore::RenderBlockFlow::layoutRunsAndFloatsInRange):
662         (WebCore::RenderBlockFlow::linkToEndLineIfNeeded):
663         (WebCore::RenderBlockFlow::layoutLineBoxes):
664         (WebCore::RenderBlockFlow::determineStartPosition):
665         (WebCore::RenderBlockFlow::checkPaginationAndFloatsAtEndLine):
666         * rendering/RenderBox.cpp:
667         (WebCore::RenderBox::outlineBoundsForRepaint const):
668         (WebCore::RenderBox::mapLocalToContainer const):
669         (WebCore::RenderBox::clippedOverflowRectForRepaint const):
670         (WebCore::RenderBox::computeRectForRepaint const):
671         (WebCore::RenderBox::offsetFromLogicalTopOfFirstPage const):
672         * rendering/RenderDeprecatedFlexibleBox.cpp:
673         (WebCore::RenderDeprecatedFlexibleBox::layoutBlock):
674         (WebCore::layoutChildIfNeededApplyingDelta):
675         * rendering/RenderElement.cpp:
676         (WebCore::RenderElement::insertChildInternal):
677         (WebCore::RenderElement::takeChildInternal):
678         * rendering/RenderEmbeddedObject.cpp:
679         * rendering/RenderFragmentedFlow.cpp:
680         (WebCore::RenderFragmentedFlow::repaintRectangleInFragments const):
681         * rendering/RenderGrid.cpp:
682         * rendering/RenderInline.cpp:
683         (WebCore::RenderInline::clippedOverflowRectForRepaint const):
684         (WebCore::RenderInline::computeRectForRepaint const):
685         (WebCore::RenderInline::mapLocalToContainer const):
686         * rendering/RenderLayer.cpp:
687         (WebCore::RenderLayer::updateLayerPositions):
688         * rendering/RenderListBox.cpp:
689         (WebCore::RenderListBox::layout):
690         * rendering/RenderMediaControlElements.cpp:
691         (WebCore::RenderMediaVolumeSliderContainer::layout):
692         (WebCore::RenderMediaControlTimelineContainer::layout):
693         (WebCore::RenderTextTrackContainerElement::layout):
694         * rendering/RenderObject.cpp:
695         (WebCore::RenderObject::repaintRectangle const):
696         * rendering/RenderReplaced.cpp:
697         (WebCore::RenderReplaced::clippedOverflowRectForRepaint const):
698         * rendering/RenderTable.cpp:
699         (WebCore::RenderTable::layout):
700         (WebCore::RenderTable::markForPaginationRelayoutIfNeeded):
701         * rendering/RenderTableCell.cpp:
702         (WebCore::RenderTableCell::clippedOverflowRectForRepaint const):
703         (WebCore::RenderTableCell::computeRectForRepaint const):
704         * rendering/RenderTableRow.cpp:
705         (WebCore::RenderTableRow::layout):
706         * rendering/RenderTableSection.cpp:
707         (WebCore::RenderTableSection::calcRowLogicalHeight):
708         (WebCore::RenderTableSection::layout):
709         (WebCore::RenderTableSection::layoutRows):
710         (WebCore::RenderTableSection::setLogicalPositionForCell const):
711         * rendering/RenderVTTCue.cpp:
712         * rendering/RenderView.cpp:
713         (WebCore::RenderView::layout):
714         (WebCore::RenderView::layoutContent): Deleted.
715         (WebCore::RenderView::checkLayoutState): Deleted.
716         (WebCore::RenderView::initializeLayoutState): Deleted.
717         (WebCore::RenderView::pushLayoutState): Deleted.
718         (WebCore::RenderView::pushLayoutStateForPaginationIfNeeded): Deleted.
719         * rendering/RenderView.h:
720         * rendering/RootInlineBox.cpp:
721         (WebCore::RootInlineBox::lineSnapAdjustment const):
722         * rendering/svg/RenderSVGContainer.cpp:
723         (WebCore::RenderSVGContainer::layout):
724         * rendering/svg/RenderSVGForeignObject.cpp:
725         (WebCore::RenderSVGForeignObject::layout):
726         * rendering/svg/RenderSVGRoot.cpp:
727         (WebCore::RenderSVGRoot::layout):
728         * style/RenderTreeUpdaterFirstLetter.cpp:
729         (WebCore::RenderTreeUpdater::FirstLetter::update):
730         * style/RenderTreeUpdaterListItem.cpp:
731         (WebCore::RenderTreeUpdater::ListItem::updateMarker):
732
733 2017-11-06  Said Abou-Hallawa  <sabouhallawa@apple.com>
734
735         [CG] Adopt CGContextDrawPathDirect()
736         https://bugs.webkit.org/show_bug.cgi?id=179339
737         <rdar://problem/26283575>
738
739         Reviewed by Simon Fraser.
740
741         Adopt this function on macOS >= 10.12 and iOS >= 10.0. Instead of clearing
742         the current path and creating a new one by calling CGContextBeginPath()
743         and then adding a CGPath by calling CGContextAddPath() and then calling 
744         one of the drawing path functions, we just call CGContextDrawPathDirect().
745
746         * platform/graphics/cg/GraphicsContextCG.cpp:
747         (WebCore::GraphicsContext::drawPath):
748         (WebCore::GraphicsContext::fillPath):
749         (WebCore::GraphicsContext::strokePath): Don't call CGContextBeginPath()
750         and CGContextAddPath() for the drawing CGContext in the case of gradient
751         shadow because we add the CGPath to the layerContext and at the end we
752         draw this CGLayer into the drawing context.
753
754 2017-11-06  Alex Christensen  <achristensen@webkit.org>
755
756         Make ResourceLoader::willSendRequestInternal asynchronous
757         https://bugs.webkit.org/show_bug.cgi?id=179251
758
759         Reviewed by Andy Estes.
760
761         ResourceLoader::willSendRequestInternal is used for redirects, which need to be asynchronous, and for the initial request.
762         Making it asynchronous requires making load initialization asynchronous, too.
763
764         No change in behavior.  This will allow us to make more things asynchronous.
765
766         * loader/LoaderStrategy.h:
767         * loader/NetscapePlugInStreamLoader.cpp:
768         (WebCore::NetscapePlugInStreamLoader::create):
769         (WebCore::NetscapePlugInStreamLoader::init):
770         (WebCore::NetscapePlugInStreamLoader::willSendRequest):
771         * loader/NetscapePlugInStreamLoader.h:
772         * loader/ResourceLoader.cpp:
773         (WebCore::ResourceLoader::init):
774         (WebCore::ResourceLoader::willSendRequestInternal):
775         (WebCore::ResourceLoader::willSendRequest):
776         (WebCore::ResourceLoader::willSendRequestAsync):
777         * loader/ResourceLoader.h:
778         (WebCore::ResourceLoader::startLoading):
779         * loader/SubresourceLoader.cpp:
780         (WebCore::SubresourceLoader::create):
781         (WebCore::SubresourceLoader::startLoading):
782         (WebCore::SubresourceLoader::init):
783         (WebCore::SubresourceLoader::willSendRequestInternal):
784         * loader/SubresourceLoader.h:
785         * loader/cache/CachedResource.cpp:
786         (WebCore::CachedResource::load):
787         * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm:
788         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:willSendRequest:redirectResponse:]):
789         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:willCacheResponse:]):
790         Calling autorelease from a non-main thread was causing crashes.  This is because we need to set up an autorelease pool on that thread, which we have not done.  See:
791         https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/MemoryMgmt/Articles/mmAutoreleasePools.html#//apple_ref/doc/uid/20000047-1041876
792         I replaced the calls to RetainPtr::autorelease with RetainPtr::get.  This causes us to keep the NSURLRequest and NSURLResponse alive as long as the request is being
793         responded to in WebKitLegacy and in El Capitan.  Given the number of ResourceRequest and ResourceResponse copies we store, this shouldn't be a problem memory-wise.
794         This will all go away once NSURLSession is used for loading in WebKitLegacy, and this is a large step towards that.
795
796 2017-11-06  Wenson Hsieh  <wenson_hsieh@apple.com>
797
798         [Attachment Support] Implement delegate hooks for attachment element insertion and removal
799         https://bugs.webkit.org/show_bug.cgi?id=179016
800         <rdar://problem/35250890>
801
802         Reviewed by Tim Horton.
803
804         Implements a mechanism for notifying WebKit2 clients when attachment elements are inserted into or removed from
805         the document. See per-change comments below for more details.
806
807         API tests: WKAttachmentTests.AttachmentElementInsertion
808                    WKAttachmentTests.AttachmentUpdatesWhenInsertingAndDeletingNewline
809                    WKAttachmentTests.AttachmentUpdatesWhenUndoingAndRedoing
810                    WKAttachmentTests.AttachmentUpdatesWhenChangingFontStyles
811                    WKAttachmentTests.AttachmentUpdatesWhenInsertingLists
812                    WKAttachmentTests.AttachmentUpdatesWhenInsertingRichMarkup
813
814         * editing/Editor.cpp:
815         (WebCore::Editor::respondToChangedSelection):
816         (WebCore::Editor::editorUIUpdateTimerFired):
817
818         Additionally notify the client of any attachment updates.
819
820         (WebCore::Editor::scheduleEditorUIUpdate):
821
822         Add a new helper that starts the editor UI update timer with 0 delay, and use it everywhere we schedule an
823         editor UI update.
824
825         (WebCore::Editor::didInsertAttachmentElement):
826         (WebCore::Editor::didRemoveAttachmentElement):
827
828         Maintain two sets of attachment element identifiers -- the first one tracking insertions, and the second one
829         tracking removals. When an attachment element is inserted, we first check to see if that attachment element has
830         just been removed; if so, we don't add it to the inserted identifiers set, but instead remove it from the set of
831         removed identifiers. We perform a similar check in the opposite case. This prevents us from notifying the client
832         of extraneous insertions and removals during certain editing commands which may reparent and move attachment
833         elements around. In both cases, we schedule an editor UI update afterwards, where we will notify the client of
834         attachment updates.
835
836         (WebCore::Editor::notifyClientOfAttachmentUpdates):
837         (WebCore::Editor::insertAttachmentFromFile):
838         * editing/Editor.h:
839         * html/HTMLAttachmentElement.cpp:
840         (WebCore::HTMLAttachmentElement::HTMLAttachmentElement):
841
842         Remove the version of HTMLAttachmentElement's constructor that takes a unique identifier.
843
844         (WebCore::HTMLAttachmentElement::insertedIntoAncestor):
845         (WebCore::HTMLAttachmentElement::removedFromAncestor):
846
847         Implement these hooks to observe insertion into and removal from the DOM. If the element was attached to or
848         removed from an ancestor that was connected to the document, call out to the document's frame's editor. This
849         "document-connected" rule prevents us from calling out to the client in cases where (for instance) we append an
850         attachment element to a newly created DocumentFragment in preparation for executing a ReplaceSelectionCommand.
851
852         (WebCore::HTMLAttachmentElement::uniqueIdentifier const):
853         (WebCore::HTMLAttachmentElement::setUniqueIdentifier):
854
855         Refactor unique identifier to refer to the new attachment identifier attribute instead of a member variable.
856
857         * html/HTMLAttachmentElement.h:
858         * html/HTMLAttributeNames.in:
859
860         Add a new attribute representing an attachment element's identifier. This enables us to keep track of particular
861         attachments as they are destroyed and recreated as different objects, as a result of some editing commands.
862
863         * page/EditorClient.h:
864         (WebCore::EditorClient::didInsertAttachment):
865         (WebCore::EditorClient::didRemoveAttachment):
866
867         Add boilerplate editor client hooks for attachment insertion and removal.
868
869 2017-11-06  Ryan Haddad  <ryanhaddad@apple.com>
870
871         Unreviewed, rolling out r224494.
872
873         Introduced LayoutTest flakiness on WK1.
874
875         Reverted changeset:
876
877         "[LayoutState cleanup] Move m_layoutState from RenderView to
878         LayoutContext"
879         https://bugs.webkit.org/show_bug.cgi?id=179282
880         https://trac.webkit.org/changeset/224494
881
882 2017-11-03  Simon Fraser  <simon.fraser@apple.com>
883
884         UIWebView is not rendering content that comes on screen during overflow scroll
885         https://bugs.webkit.org/show_bug.cgi?id=179277
886         rdar://problem/34272949
887
888         Reviewed by Tim Horton
889
890         When page or overflow scrolling happens, we do a traversal of GraphicsLayers to determine
891         whether the exposed part of tiled layers changed in a way that requires a change in the tile
892         coverage. If so, we schedule a compositing layer flush.
893
894         There was no equivalent logic for computing whether the "backing store detached" state
895         of a layer changed (which we use to throw away backing store of layers outside the viewport),
896         so after scrolling an accelerated overflow:scroll which contained composited layers, we
897         would sometimes fail to recompute that we should re-create backing store for revealed
898         layers.
899
900         Fix by having GraphicsLayerCA::recursiveVisibleRectChangeRequiresFlush() determine
901         whether 'intersectsCoverageRect' changed, and if so trigger a flush. This requires
902         tracking CommitState for isViewportConstrained-ness, just like we do during commits.
903
904         Also clean up code related to computing the visible rect passed into visibleRectChangeRequiresFlush() and
905         flushCompositingState(); these diverged for no good reason. Also clean up the logging a little.
906         
907         Not testable because UIWebView layout tests are unreliable.
908
909         * page/ios/FrameIOS.mm:
910         (WebCore::Frame::viewportOffsetChanged):
911         (WebCore::Frame::overflowScrollPositionChangedForNode):
912         * platform/graphics/ca/GraphicsLayerCA.cpp:
913         (WebCore::GraphicsLayerCA::recursiveVisibleRectChangeRequiresFlush const):
914         (WebCore::GraphicsLayerCA::visibleRectChangeRequiresFlush const):
915         * platform/graphics/ca/GraphicsLayerCA.h:
916         * rendering/RenderLayerCompositor.cpp:
917         (WebCore::RenderLayerCompositor::visibleRectForLayerFlushing const):
918         (WebCore::RenderLayerCompositor::flushPendingLayerChanges):
919         (WebCore::RenderLayerCompositor::didChangeVisibleRect):
920         * rendering/RenderLayerCompositor.h:
921
922 2017-11-06  Chris Dumez  <cdumez@apple.com>
923
924         [Service Workers] Add proper implementation for 'updatefound' event
925         https://bugs.webkit.org/show_bug.cgi?id=179302
926
927         Reviewed by Brady Eidson.
928
929         Add proper implementation for 'updatefound' event instead of faking it.
930         The 'updatefound' event firing is now triggered from the StorageProcess,
931         during the install steps, instead of being fired on WebContent process
932         side in jobResolvedWithRegistration().
933
934         Specification:
935         - https://w3c.github.io/ServiceWorker/#install (step 7)
936
937         * workers/service/ServiceWorkerContainer.cpp:
938         (WebCore::ServiceWorkerContainer::scheduleJob):
939         (WebCore::ServiceWorkerContainer::fireUpdateFoundEvent):
940         (WebCore::ServiceWorkerContainer::jobResolvedWithRegistration):
941         (WebCore::ServiceWorkerContainer::jobDidFinish):
942         * workers/service/ServiceWorkerContainer.h:
943         * workers/service/server/SWClientConnection.cpp:
944         (WebCore::SWClientConnection::fireUpdateFoundEvent):
945         * workers/service/server/SWClientConnection.h:
946         * workers/service/server/SWServer.h:
947         * workers/service/server/SWServerJobQueue.cpp:
948         (WebCore::SWServerJobQueue::scriptContextStarted):
949         (WebCore::SWServerJobQueue::install):
950         * workers/service/server/SWServerJobQueue.h:
951         * workers/service/server/SWServerRegistration.cpp:
952         (WebCore::SWServerRegistration::fireUpdateFoundEvent):
953         * workers/service/server/SWServerRegistration.h:
954
955 2017-11-06  Christopher Reid  <chris.reid@sony.com>
956
957         Use enum classes within FileSystem
958         https://bugs.webkit.org/show_bug.cgi?id=175172
959
960         Reviewed by Myles C. Maxfield.
961
962         No new tests, no change in behavior.
963
964         Using enum classes in filesystem to enforce stronger type safety.
965
966         * Modules/webdatabase/OriginLock.cpp:
967         * loader/appcache/ApplicationCacheStorage.cpp:
968         * platform/FileHandle.h:
969         * platform/FileStream.cpp:
970         * platform/FileSystem.cpp:
971         * platform/FileSystem.h:
972         * platform/cocoa/FileMonitorCocoa.mm:
973         * platform/glib/FileSystemGlib.cpp:
974         * platform/network/curl/CurlCacheEntry.cpp:
975         * platform/network/curl/CurlCacheManager.cpp:
976         * platform/posix/FileSystemPOSIX.cpp:
977         * platform/win/FileSystemWin.cpp:
978         * rendering/RenderThemeWin.cpp:
979
980 2017-11-06  Commit Queue  <commit-queue@webkit.org>
981
982         Unreviewed, rolling out r224497.
983         https://bugs.webkit.org/show_bug.cgi?id=179335
984
985         It is breaking internal builds (Requested by youenn on
986         #webkit).
987
988         Reverted changeset:
989
990         "Use VCP H264 encoder for platforms supporting it"
991         https://bugs.webkit.org/show_bug.cgi?id=179076
992         https://trac.webkit.org/changeset/224497
993
994 2017-11-06  Chris Dumez  <cdumez@apple.com>
995
996         ScriptExecutionContext::serviceWorkerContainer() should avoid constructing a Navigator object
997         https://bugs.webkit.org/show_bug.cgi?id=179322
998
999         Reviewed by Sam Weinig.
1000
1001         ScriptExecutionContext::serviceWorkerContainer() should avoid constructing a Navigator object
1002         unnecessarily.
1003
1004         * dom/ScriptExecutionContext.cpp:
1005         (WebCore::ScriptExecutionContext::serviceWorkerContainer):
1006         * page/DOMWindow.h:
1007
1008 2017-11-06  Colin Bendell  <colin@bendell.ca>
1009
1010         Added mime type check to the picture source preloader to avoid downloading incompatible resources.
1011         https://bugs.webkit.org/show_bug.cgi?id=179231
1012
1013         Reviewed by Alex Christensen.
1014
1015         Test: http/tests/loading/preload-picture-type.html
1016
1017         * html/parser/HTMLPreloadScanner.cpp:
1018         (WebCore::TokenPreloadScanner::StartTagScanner::processAttributes): include type match state when selecting candidate imgs
1019         (WebCore::TokenPreloadScanner::StartTagScanner::processAttribute): added type attribute evaluation and matching
1020
1021 2017-11-06  Youenn Fablet  <youenn@apple.com>
1022
1023         Use VCP H264 encoder for platforms supporting it
1024         https://bugs.webkit.org/show_bug.cgi?id=179076
1025         rdar://problem/35180773
1026
1027         Reviewed by Eric Carlson.
1028
1029         Covered by existing test coverage.
1030
1031         * platform/mediastream/libwebrtc/VideoToolBoxEncoderFactory.cpp:
1032         (WebCore::VideoToolboxVideoEncoderFactory::setActive):
1033         (WebCore::VideoToolboxVideoEncoderFactory::CreateSupportedVideoEncoder):
1034         (WebCore::VideoToolboxVideoEncoderFactory::DestroyVideoEncoder):
1035         * platform/mediastream/libwebrtc/VideoToolBoxEncoderFactory.h:
1036
1037 2017-11-06  Chris Dumez  <cdumez@apple.com>
1038
1039         ServiceWorkerContainer should take a PendingActivity while a service worker job is pending
1040         https://bugs.webkit.org/show_bug.cgi?id=179321
1041
1042         Reviewed by Youenn Fablet.
1043
1044         ServiceWorkerContainer should take a PendingActivity while a service worker job is pending.
1045         ServiceWorkerContainer is an ActiveDOMObject and taking such pending activity makes sure
1046         the object stays alive while a job is pending (and a promise is not resolved yet). It also
1047         makes sure the document does not get suspended in the middle of a job.
1048
1049         * workers/service/ServiceWorkerContainer.cpp:
1050         (WebCore::ServiceWorkerContainer::scheduleJob):
1051         (WebCore::ServiceWorkerContainer::jobDidFinish):
1052
1053 2017-11-06  Antti Koivisto  <antti@apple.com>
1054
1055         @media rules ignored in user agent style sheet html.css
1056         https://bugs.webkit.org/show_bug.cgi?id=169245
1057         <rdar://problem/30885951>
1058
1059         Reviewed by Darin Adler.
1060
1061         To support accessibility features, allow non-trivial @media rules in user agent stylesheet.
1062
1063         This patch creates a special stylesheet consisting of rules with media queries seen on user agent stylesheets.
1064         The queries on this sheet are evaluated with the document's media query evaluator.
1065
1066         No tests as I don't want to add things to UA style just for testing purposes. This will
1067         gain coverage when the feature is used.
1068
1069          * css/CSSDefaultStyleSheets.cpp:
1070         (WebCore::CSSDefaultStyleSheets::addToDefaultStyle):
1071
1072             Add a helper.
1073             Build a new stylesheet that consists of complex media rules seen in user agent sheets.
1074
1075         (WebCore::CSSDefaultStyleSheets::loadFullDefaultStyle):
1076         (WebCore::CSSDefaultStyleSheets::ensureDefaultStyleSheetsForElement):
1077         * css/CSSDefaultStyleSheets.h:
1078         * css/DocumentRuleSets.cpp:
1079         (WebCore::DocumentRuleSets::userAgentMediaQueryStyle const):
1080
1081             Rule set constructed from media queries seen on UA sheet.
1082
1083         (WebCore::DocumentRuleSets::updateUserAgentMediaQueryStyleIfNeeded const):
1084
1085             Evalute the media queries if needed.
1086             Re-evaluate if the rule count of the media query stylesheet increases
1087             (this could happen when additional UA style is added).
1088
1089         (WebCore::DocumentRuleSets::resetUserAgentMediaQueryStyle):
1090         (WebCore::DocumentRuleSets::collectFeatures const):
1091
1092             Collect the features from userAgentMediaQueryStyle.
1093
1094         * css/DocumentRuleSets.h:
1095         (WebCore::DocumentRuleSets::setIsForShadowScope):
1096         * css/ElementRuleCollector.cpp:
1097         (WebCore::ElementRuleCollector::ElementRuleCollector):
1098         (WebCore::ElementRuleCollector::matchUARules):
1099
1100             Also match rules in userAgentMediaQueryStyle.
1101
1102         * css/ElementRuleCollector.h:
1103         * css/InspectorCSSOMWrappers.cpp:
1104         (WebCore::InspectorCSSOMWrappers::collectDocumentWrappers):
1105         * css/StyleResolver.cpp:
1106         (WebCore::StyleResolver::StyleResolver):
1107         * style/StyleScope.cpp:
1108         (WebCore::Style::Scope::resolver):
1109
1110 2017-11-06  Zalan Bujtas  <zalan@apple.com>
1111
1112         [LayoutState cleanup] Move m_layoutState from RenderView to LayoutContext
1113         https://bugs.webkit.org/show_bug.cgi?id=179282
1114         <rdar://problem/35348653>
1115
1116         Reviewed by Antti Koivisto.
1117
1118         LayoutContext now owns the top level LayoutState object.
1119         It makes RenderView behave like any other renderer by constructing a LayoutStateMaintainer on the stack.
1120         This is mostly moving code from RenderView.h/.cpp to LayoutContext.h/.cpp and fixing the callsites.
1121         (While view().frameView().layoutContext().layoutState() is a bit lengthy, it's
1122         temporary only, since LayoutState is planned to be an argument of the layout() method.  
1123
1124         Covered by existing test.
1125
1126         * accessibility/AXObjectCache.cpp:
1127         (WebCore::AXObjectCache::notificationPostTimerFired):
1128         * page/LayoutContext.cpp:
1129         (WebCore::LayoutContext::layoutDelta const):
1130         (WebCore::LayoutContext::addLayoutDelta):
1131         (WebCore::LayoutContext::layoutDeltaMatches):
1132         (WebCore::LayoutContext::pushLayoutState):
1133         (WebCore::LayoutContext::pushLayoutStateForPaginationIfNeeded):
1134         (WebCore::LayoutContext::popLayoutState):
1135         (WebCore::LayoutContext::checkLayoutState):
1136         * page/LayoutContext.h:
1137         (WebCore::LayoutContext::layoutState const):
1138         (WebCore::LayoutContext::layoutStateEnabled const):
1139         (WebCore::LayoutContext::disableLayoutState):
1140         (WebCore::LayoutContext::enableLayoutState):
1141         * rendering/LayoutState.cpp:
1142         (WebCore::LayoutState::LayoutState):
1143         (WebCore::LayoutState::computeClipRect):
1144         (WebCore::LayoutStateMaintainer::LayoutStateMaintainer):
1145         (WebCore::LayoutStateMaintainer::push):
1146         (WebCore::LayoutStateMaintainer::pop):
1147         (WebCore::LayoutStateDisabler::LayoutStateDisabler):
1148         (WebCore::LayoutStateDisabler::~LayoutStateDisabler):
1149         (WebCore::SubtreeLayoutStateMaintainer::SubtreeLayoutStateMaintainer):
1150         (WebCore::SubtreeLayoutStateMaintainer::~SubtreeLayoutStateMaintainer):
1151         (WebCore::PaginatedLayoutStateMaintainer::PaginatedLayoutStateMaintainer):
1152         (WebCore::PaginatedLayoutStateMaintainer::~PaginatedLayoutStateMaintainer):
1153         * rendering/LayoutState.h:
1154         * rendering/RenderBlock.cpp:
1155         (WebCore::RenderBlock::setLogicalLeftForChild):
1156         (WebCore::RenderBlock::setLogicalTopForChild):
1157         (WebCore::RenderBlock::layoutPositionedObject):
1158         (WebCore::RenderBlock::markForPaginationRelayoutIfNeeded):
1159         (WebCore::RenderBlock::adjustLogicalLeftOffsetForLine const):
1160         (WebCore::RenderBlock::adjustLogicalRightOffsetForLine const):
1161         (WebCore::RenderBlock::offsetFromLogicalTopOfFirstPage const):
1162         (WebCore::RenderBlock::childBoxIsUnsplittableForFragmentation const):
1163         * rendering/RenderBlockFlow.cpp:
1164         (WebCore::RenderBlockFlow::layoutBlock):
1165         (WebCore::RenderBlockFlow::layoutBlockChildren):
1166         (WebCore::RenderBlockFlow::layoutBlockChild):
1167         (WebCore::RenderBlockFlow::collapseMarginsWithChildInfo):
1168         (WebCore::RenderBlockFlow::estimateLogicalTopPosition):
1169         (WebCore::RenderBlockFlow::applyBeforeBreak):
1170         (WebCore::RenderBlockFlow::applyAfterBreak):
1171         (WebCore::RenderBlockFlow::hasNextPage const):
1172         (WebCore::RenderBlockFlow::pageLogicalTopForOffset const):
1173         (WebCore::RenderBlockFlow::pageLogicalHeightForOffset const):
1174         (WebCore::RenderBlockFlow::pageRemainingLogicalHeightForOffset const):
1175         (WebCore::RenderBlockFlow::repaintOverhangingFloats):
1176         (WebCore::RenderBlockFlow::insertFloatingObject):
1177         (WebCore::RenderBlockFlow::positionNewFloats):
1178         (WebCore::RenderBlockFlow::layoutSimpleLines):
1179         * rendering/RenderBlockLineLayout.cpp:
1180         (WebCore::RenderBlockFlow::layoutRunsAndFloats):
1181         (WebCore::RenderBlockFlow::layoutRunsAndFloatsInRange):
1182         (WebCore::RenderBlockFlow::linkToEndLineIfNeeded):
1183         (WebCore::RenderBlockFlow::layoutLineBoxes):
1184         (WebCore::RenderBlockFlow::determineStartPosition):
1185         (WebCore::RenderBlockFlow::checkPaginationAndFloatsAtEndLine):
1186         * rendering/RenderBox.cpp:
1187         (WebCore::RenderBox::outlineBoundsForRepaint const):
1188         (WebCore::RenderBox::mapLocalToContainer const):
1189         (WebCore::RenderBox::clippedOverflowRectForRepaint const):
1190         (WebCore::RenderBox::computeRectForRepaint const):
1191         (WebCore::RenderBox::offsetFromLogicalTopOfFirstPage const):
1192         * rendering/RenderDeprecatedFlexibleBox.cpp:
1193         (WebCore::RenderDeprecatedFlexibleBox::layoutBlock):
1194         (WebCore::layoutChildIfNeededApplyingDelta):
1195         * rendering/RenderElement.cpp:
1196         (WebCore::RenderElement::insertChildInternal):
1197         (WebCore::RenderElement::takeChildInternal):
1198         * rendering/RenderEmbeddedObject.cpp:
1199         * rendering/RenderFragmentedFlow.cpp:
1200         (WebCore::RenderFragmentedFlow::repaintRectangleInFragments const):
1201         * rendering/RenderGrid.cpp:
1202         * rendering/RenderInline.cpp:
1203         (WebCore::RenderInline::clippedOverflowRectForRepaint const):
1204         (WebCore::RenderInline::computeRectForRepaint const):
1205         (WebCore::RenderInline::mapLocalToContainer const):
1206         * rendering/RenderLayer.cpp:
1207         (WebCore::RenderLayer::updateLayerPositions):
1208         * rendering/RenderListBox.cpp:
1209         (WebCore::RenderListBox::layout):
1210         * rendering/RenderMediaControlElements.cpp:
1211         (WebCore::RenderMediaVolumeSliderContainer::layout):
1212         (WebCore::RenderMediaControlTimelineContainer::layout):
1213         (WebCore::RenderTextTrackContainerElement::layout):
1214         * rendering/RenderObject.cpp:
1215         (WebCore::RenderObject::repaintRectangle const):
1216         * rendering/RenderReplaced.cpp:
1217         (WebCore::RenderReplaced::clippedOverflowRectForRepaint const):
1218         * rendering/RenderTable.cpp:
1219         (WebCore::RenderTable::layout):
1220         (WebCore::RenderTable::markForPaginationRelayoutIfNeeded):
1221         * rendering/RenderTableCell.cpp:
1222         (WebCore::RenderTableCell::clippedOverflowRectForRepaint const):
1223         (WebCore::RenderTableCell::computeRectForRepaint const):
1224         * rendering/RenderTableRow.cpp:
1225         (WebCore::RenderTableRow::layout):
1226         * rendering/RenderTableSection.cpp:
1227         (WebCore::RenderTableSection::calcRowLogicalHeight):
1228         (WebCore::RenderTableSection::layout):
1229         (WebCore::RenderTableSection::layoutRows):
1230         (WebCore::RenderTableSection::setLogicalPositionForCell const):
1231         * rendering/RenderVTTCue.cpp:
1232         * rendering/RenderView.cpp:
1233         (WebCore::RenderView::layout):
1234         (WebCore::RenderView::layoutContent): Deleted.
1235         (WebCore::RenderView::checkLayoutState): Deleted.
1236         (WebCore::RenderView::initializeLayoutState): Deleted.
1237         (WebCore::RenderView::pushLayoutState): Deleted.
1238         (WebCore::RenderView::pushLayoutStateForPaginationIfNeeded): Deleted.
1239         * rendering/RenderView.h:
1240         * rendering/RootInlineBox.cpp:
1241         (WebCore::RootInlineBox::lineSnapAdjustment const):
1242         * rendering/svg/RenderSVGContainer.cpp:
1243         (WebCore::RenderSVGContainer::layout):
1244         * rendering/svg/RenderSVGForeignObject.cpp:
1245         (WebCore::RenderSVGForeignObject::layout):
1246         * rendering/svg/RenderSVGRoot.cpp:
1247         (WebCore::RenderSVGRoot::layout):
1248         * style/RenderTreeUpdaterFirstLetter.cpp:
1249         (WebCore::RenderTreeUpdater::FirstLetter::update):
1250         * style/RenderTreeUpdaterListItem.cpp:
1251         (WebCore::RenderTreeUpdater::ListItem::updateMarker):
1252
1253 2017-11-05  Yusuke Suzuki  <utatane.tea@gmail.com>
1254
1255         JIT call inline caches should cache calls to objects with getCallData/getConstructData traps
1256         https://bugs.webkit.org/show_bug.cgi?id=144458
1257
1258         Reviewed by Saam Barati.
1259
1260         * bridge/runtime_method.cpp:
1261         (JSC::RuntimeMethod::RuntimeMethod):
1262         (JSC::RuntimeMethod::getCallData): Deleted.
1263         * bridge/runtime_method.h:
1264
1265 2017-11-06  Maciej Stachowiak  <mjs@apple.com>
1266
1267         Canonical name of EUC-KR encoding should be EUC-KR, not windows-949
1268         https://bugs.webkit.org/show_bug.cgi?id=179305
1269
1270         Reviewed by Alexey Proskuryakov.
1271
1272         Already covered by:
1273         LayoutTests/imported/w3c/web-platform-tests/encoding/textdecoder-labels.html
1274         LayoutTests/imported/w3c/web-platform-tests/encoding/textencoder-constructor-non-utf-expected.html
1275         LayoutTests/fast/encoding/charset-decode.html
1276         
1277         * platform/text/TextCodecICU.cpp: Change registration so the EUC-KR name
1278         is canonical.
1279         (WebCore::TextCodecICU::registerCodecs): However, we still want to use the windows-949
1280         decoder. It's not exactly the same, but the spec calls for that.
1281
1282 2017-11-06  Zan Dobersek  <zdobersek@igalia.com>
1283
1284         [Cairo] CairoGlyphToPathTranslator::path() shouldn't fill out the glyph path
1285         https://bugs.webkit.org/show_bug.cgi?id=179159
1286
1287         Reviewed by Michael Catanzaro.
1288
1289         In case of non-zero synthetic bold offset in CairoGlyphToPathTranslator::path(),
1290         cairo_glyph_path() should be called just like in the generic case.
1291         cairo_show_glyphs() performs the actual rasterization of the glyph, but we're
1292         only interested in the generated path operations.
1293
1294         No new tests -- covered by existing tests.
1295
1296         * platform/graphics/cairo/FontCairo.cpp:
1297         (WebCore::CairoGlyphToPathTranslator::path):
1298
1299 2017-11-05  Fujii Hironori  <Hironori.Fujii@sony.com>
1300
1301         [WinCairo] Fix build after r224463
1302         https://bugs.webkit.org/show_bug.cgi?id=179310
1303
1304         Unreviewed build fix.
1305
1306         No new tests (No behavior change).
1307
1308         * platform/graphics/win/GraphicsContextCairoWin.cpp: Include "GraphicsContextImpl.h".
1309
1310 2017-11-05  Antoine Quint  <graouts@apple.com>
1311
1312         [Web Animations] Schedule animations registered on the document timeline
1313         https://bugs.webkit.org/show_bug.cgi?id=179236
1314         <rdar://problem/35332669>
1315
1316         Reviewed by Dean Jackson.
1317
1318         We now schedule animations contained in the document timeline using a three-step approach.
1319
1320         1. Each time an object that is part of the timing model changes one of its timing properties, we call
1321            animationTimingModelDidChange() on the document timeline. This schedules performInvalidationTask()
1322            to be called when the current run loop completes, such that we invalidate the timing model just once
1323            per run loop.
1324
1325         2. Once performInvalidationTask() is called, the timing model is invalidated in updateAnimationSchedule().
1326            We iterate over the registered animations on the timineline and identify the shortest interval between
1327            the current time and the next moment one of the animations requires a tick to update its value. If we
1328            find a value below 15ms, we schedule animations to be resolved with scheduleAnimationResolution() right
1329            away. If the value is above 15ms, and not inifinity, we schedule a one-shot timer for that interval to
1330            call scheduleAnimationResolution().
1331
1332         3. Once scheduleAnimationResolution() is called, we call scheduleAnimation() on the shared DisplayRefreshMonitorManager
1333            to be notified when the next display refresh occurs to actually resolve animations with resolveAnimations().
1334
1335         Note that, in this patch, resolveAnimations() does nothing, we will add support for interpolating values in
1336         a future patch.
1337
1338         Another important thing to note is that every time the document timeline's current time is requested, we cache
1339         it for the duration of the run loop such that the timing model always uses the same value during a given run loop.
1340
1341         Finally, to support tests where we check the state of the timing model by manually advancing time, we expose a
1342         new pause() method on AnimationTimeline for tests to call to avoid the timeline to self-advance.
1343
1344         * animation/AnimationTimeline.cpp:
1345         (WebCore::AnimationTimeline::addAnimation): Mark that the timing model changed as a result of adding an animation.
1346         (WebCore::AnimationTimeline::removeAnimation): Mark that the timing model changed as a result of removing an animation.
1347         (WebCore::AnimationTimeline::bindingsCurrentTime): Update the method signature to no longer be const and call into
1348         currentTime() instead of reading directly from the m_currentTime member variable since a subclass, like DocumentTimeline,
1349         may have a custom currentTime() implementation.
1350         (WebCore::AnimationTimeline::setCurrentTime): Mark that the timing model changed as a result of the timeline current time
1351         changing.
1352         (WebCore::AnimationTimeline::bindingsCurrentTime const): Deleted.
1353         * animation/AnimationTimeline.h:
1354         (WebCore::AnimationTimeline::currentTime): Change both methods signatures to no longer be const so that DocumentTimeline's
1355         implementation of currentTime() may cache the current time in a member variable, enqueuing a callback when the run loop
1356         completes for this member variable to be reset, and updating some states.
1357         (WebCore::AnimationTimeline::pause): To be implemented by subclasses.
1358         (WebCore::AnimationTimeline::animationTimingModelDidChange): Add a new virtual method to indicate that the timing model
1359         needs invalidating.
1360         (WebCore::AnimationTimeline::animations const): Add an accessor to allow animations to be accessed by a subclass.
1361         * animation/DocumentTimeline.cpp:
1362         (WebCore::DocumentTimeline::create):
1363         (WebCore::DocumentTimeline::DocumentTimeline): Update the constructor signature to receive a Document and a PlatformDisplayID
1364         since we need a reference to the Document to get at the nowTime() and a PlatformDisplayID to create the DisplayRefreshMonitor.
1365         (WebCore::DocumentTimeline::~DocumentTimeline): Close the task queue when the timeline gets destroyed.
1366         (WebCore::DocumentTimeline::currentTime): If we don't have a current cahed current time, compute one and schedule
1367         the invalidation task if needed so that we may reset the cached value as the run loop completes.
1368         (WebCore::DocumentTimeline::pause): Allows the timeline not to self-advance, for testing purposes only.
1369         (WebCore::DocumentTimeline::animationTimingModelDidChange): If we haven't already done so, mark that we need to update our
1370         animation schedule in the invalidation task and schedule that task if not scheduled yet.
1371         (WebCore::DocumentTimeline::scheduleInvalidationTaskIfNeeded): Schedule the invalidation task to run as the run loop completes
1372         if we haven't already done so.
1373         (WebCore::DocumentTimeline::performInvalidationTask): Update the animation schedule if needed and reset the cached current
1374         time value.
1375         (WebCore::DocumentTimeline::updateAnimationSchedule): Iterate over registed animations and find the shortest interval until
1376         one of them needs to update their animation. If the shortest interval is below 15ms, schedule the animation resolution right
1377         away. If the shortest inverval is finite and above 15ms, then schedule a one-shot timer for that interval to perform the
1378         animation resolution then. 
1379         (WebCore::DocumentTimeline::animationScheduleTimerFired): The one-shot timer to perform the animation resolution has fired,
1380         we call scheduleAnimationResolution().
1381         (WebCore::DocumentTimeline::scheduleAnimationResolution): We call scheduleAnimation() on the shared DisplayRefreshMonitorManager
1382         so that we may resolve animations on the next display refresh, or start a timer if the DisplayRefreshMonitorManager is not available.
1383         (WebCore::DocumentTimeline::displayRefreshFired): The display is about to refresh, we call resolveAnimations().
1384         (WebCore::DocumentTimeline::animationResolutionTimerFired): The fallback animation resolution timer has fired, we call resolveAnimations().
1385         (WebCore::DocumentTimeline::resolveAnimations): Currently do nothing, this is where we'll iterate over registered animations to
1386         update them with the current time.
1387         (WebCore::DocumentTimeline::windowScreenDidChange): Notify the shared DisplayRefreshMonitorManager that the PlatformDisplayID
1388         changed.
1389         (WebCore::DocumentTimeline::createDisplayRefreshMonitor const): Provide a DisplayRefreshMonitor as part of the
1390         DisplayRefreshMonitorClient protocol. 
1391         * animation/DocumentTimeline.h:
1392         * animation/WebAnimation.cpp:
1393         (WebCore::WebAnimation::create): Remove extra white space.
1394         (WebCore::WebAnimation::setStartTime): Mark that the timing model changed as a result of changing this animation's start time.
1395         (WebCore::WebAnimation::timeToNextRequiredTick const): Compute the interval until the next time we need to resolve this animation.
1396         If the provided current time is before this animation's start time, compute the delay until the start time. If the current time
1397         is after the animation's start time but before the animation's end time, indicate that we want to resolve the animation again
1398         right away and return 0ms. In any other case, return an infinite interval to indicate that we don't need to be refreshed after
1399         the provided time.
1400         * animation/WebAnimation.h:
1401         * dom/Document.cpp:
1402         (WebCore::Document::windowScreenDidChange): Notify the document timeline that the PlatformDisplayID changed.
1403         (WebCore::Document::timeline): Provide the Document and the PlatformDisplayID to the DocumentTimeline.
1404         * testing/Internals.cpp:
1405         (WebCore::Internals::pauseTimeline):
1406         * testing/Internals.h:
1407         * testing/Internals.idl:
1408
1409 2017-11-05  Chris Dumez  <cdumez@apple.com>
1410
1411         Implement ServiceWorkerRegistration.update()
1412         https://bugs.webkit.org/show_bug.cgi?id=179270
1413
1414         Reviewed by Youenn Fablet.
1415
1416         Implement ServiceWorkerRegistration.update():
1417         - https://w3c.github.io/ServiceWorker/#service-worker-registration-update
1418
1419         We already had support for the Update algorithm in SWServerJobQueue but
1420         this patch enhances our support a bit to get us closer to the specification:
1421         - https://w3c.github.io/ServiceWorker/#update-algorithm
1422
1423         No new tests, rebaselined existing tests.
1424
1425         * workers/service/ServiceWorker.h:
1426         * workers/service/ServiceWorkerContainer.cpp:
1427         (WebCore::ServiceWorkerContainer::updateRegistration):
1428         (WebCore::ServiceWorkerContainer::getRegistration):
1429         (WebCore::ServiceWorkerContainer::jobResolvedWithRegistration):
1430         * workers/service/ServiceWorkerContainer.h:
1431         * workers/service/ServiceWorkerJobData.h:
1432         (WebCore::ServiceWorkerJobData::encode const):
1433         (WebCore::ServiceWorkerJobData::decode):
1434         * workers/service/ServiceWorkerJobType.h:
1435         * workers/service/ServiceWorkerRegistration.cpp:
1436         (WebCore::ServiceWorkerRegistration::ServiceWorkerRegistration):
1437         (WebCore::ServiceWorkerRegistration::installing):
1438         (WebCore::ServiceWorkerRegistration::waiting):
1439         (WebCore::ServiceWorkerRegistration::active):
1440         (WebCore::ServiceWorkerRegistration::setInstallingWorker):
1441         (WebCore::ServiceWorkerRegistration::setWaitingWorker):
1442         (WebCore::ServiceWorkerRegistration::setActiveWorker):
1443         (WebCore::ServiceWorkerRegistration::getNewestWorker):
1444         (WebCore::ServiceWorkerRegistration::update):
1445         * workers/service/ServiceWorkerRegistration.h:
1446         * workers/service/server/SWServerJobQueue.cpp:
1447         (WebCore::SWServerJobQueue::scriptFetchFinished):
1448         (WebCore::SWServerJobQueue::scriptContextFailedToStart):
1449         (WebCore::SWServerJobQueue::runNextJobSynchronously):
1450         (WebCore::SWServerJobQueue::runUpdateJob):
1451
1452 2017-11-04  Simon Fraser  <simon.fraser@apple.com>
1453
1454         Move code that maps a CompositeOperator and BlendMode to a CGBlendMode into a helper function
1455         https://bugs.webkit.org/show_bug.cgi?id=179290
1456
1457         Reviewed by Darin Adler.
1458
1459         Move the code, and use nested switch rather than conditionals.
1460
1461         * platform/graphics/GraphicsTypes.h:
1462         * platform/graphics/cg/GraphicsContextCG.cpp:
1463         (WebCore::selectCGBlendMode):
1464         (WebCore::GraphicsContext::setPlatformCompositeOperation):
1465
1466 2017-11-04  Chris Dumez  <cdumez@apple.com>
1467
1468         Index properties on cross origin Window objects should be enumerable
1469         https://bugs.webkit.org/show_bug.cgi?id=179289
1470
1471         Reviewed by Darin Adler.
1472
1473         Index properties on cross origin Window objects should be enumerable:
1474         - https://github.com/whatwg/html/pull/3186
1475         - https://github.com/w3c/web-platform-tests/pull/8045
1476
1477         All exposed properties used to be enumerable but we had to revert this in
1478         r224287 because it was not Web-compatible. The HTML specification has now
1479         been updated so that only index properties are enumerable cross origin.
1480
1481         No new tests, rebaselined existing tests.
1482
1483         * bindings/js/JSDOMWindowCustom.cpp:
1484         (WebCore::JSDOMWindow::getOwnPropertySlotByIndex):
1485         (WebCore::JSDOMWindow::getOwnPropertyNames):
1486
1487 2017-11-04  Simon Fraser  <simon.fraser@apple.com>
1488
1489         Add a GraphicsContextImpl and use it for DispayList::Recorder
1490         https://bugs.webkit.org/show_bug.cgi?id=179286
1491
1492         Reviewed by Sam Weinig.
1493
1494         Start moving towards a model when GraphicsContext has a pointer to an implementation
1495         ("pimpl") by adding GraphicsContextImpl, and converting display list recording to
1496         be an implementation of a GraphicsContextImpl.
1497
1498         No behavior change.
1499
1500         * Sources.txt:
1501         * WebCore.xcodeproj/project.pbxproj:
1502         * html/canvas/CanvasRenderingContext2D.cpp:
1503         (WebCore::DisplayListDrawingContext::DisplayListDrawingContext):
1504         * platform/graphics/GraphicsContext.cpp:
1505         (WebCore::GraphicsContext::GraphicsContext):
1506         (WebCore::GraphicsContext::save):
1507         (WebCore::GraphicsContext::restore):
1508         (WebCore::GraphicsContext::setStrokeThickness):
1509         (WebCore::GraphicsContext::setStrokeStyle):
1510         (WebCore::GraphicsContext::setStrokeColor):
1511         (WebCore::GraphicsContext::setShadow):
1512         (WebCore::GraphicsContext::setLegacyShadow):
1513         (WebCore::GraphicsContext::clearShadow):
1514         (WebCore::GraphicsContext::setFillColor):
1515         (WebCore::GraphicsContext::setShadowsIgnoreTransforms):
1516         (WebCore::GraphicsContext::setShouldAntialias):
1517         (WebCore::GraphicsContext::setShouldSmoothFonts):
1518         (WebCore::GraphicsContext::setShouldSubpixelQuantizeFonts):
1519         (WebCore::GraphicsContext::setImageInterpolationQuality):
1520         (WebCore::GraphicsContext::setStrokePattern):
1521         (WebCore::GraphicsContext::setFillPattern):
1522         (WebCore::GraphicsContext::setStrokeGradient):
1523         (WebCore::GraphicsContext::setFillRule):
1524         (WebCore::GraphicsContext::setFillGradient):
1525         (WebCore::GraphicsContext::beginTransparencyLayer):
1526         (WebCore::GraphicsContext::endTransparencyLayer):
1527         (WebCore::GraphicsContext::drawGlyphs):
1528         (WebCore::GraphicsContext::drawImage):
1529         (WebCore::GraphicsContext::drawTiledImage):
1530         (WebCore::GraphicsContext::setTextDrawingMode):
1531         (WebCore::GraphicsContext::fillRect):
1532         (WebCore::GraphicsContext::fillRoundedRect):
1533         (WebCore::GraphicsContext::setAlpha):
1534         (WebCore::GraphicsContext::setCompositeOperation):
1535         (WebCore::GraphicsContext::setDrawLuminanceMask):
1536         (WebCore::GraphicsContext::applyDeviceScaleFactor):
1537         (WebCore::GraphicsContext::fillEllipse):
1538         (WebCore::GraphicsContext::strokeEllipse):
1539         * platform/graphics/GraphicsContext.h:
1540         (WebCore::GraphicsContext::hasPlatformContext const):
1541         (WebCore::GraphicsContext::paintingDisabled const):
1542         (WebCore::GraphicsContext::setDisplayListRecorder): Deleted.
1543         (WebCore::GraphicsContext::isRecording const): Deleted.
1544         * platform/graphics/GraphicsContextImpl.cpp: Added.
1545         (WebCore::GraphicsContextImpl::GraphicsContextImpl):
1546         (WebCore::GraphicsContextImpl::~GraphicsContextImpl):
1547         * platform/graphics/GraphicsContextImpl.h: Added.
1548         (WebCore::GraphicsContextImpl::graphicsContext const):
1549         * platform/graphics/ca/GraphicsLayerCA.cpp:
1550         (WebCore::GraphicsLayerCA::recursiveCommitChanges):
1551         * platform/graphics/cairo/GraphicsContextCairo.cpp:
1552         (WebCore::GraphicsContext::getCTM const):
1553         (WebCore::GraphicsContext::savePlatformState):
1554         (WebCore::GraphicsContext::restorePlatformState):
1555         (WebCore::GraphicsContext::drawRect):
1556         (WebCore::GraphicsContext::drawNativeImage):
1557         (WebCore::GraphicsContext::drawLine):
1558         (WebCore::GraphicsContext::drawEllipse):
1559         (WebCore::GraphicsContext::fillPath):
1560         (WebCore::GraphicsContext::strokePath):
1561         (WebCore::GraphicsContext::fillRect):
1562         (WebCore::GraphicsContext::clip):
1563         (WebCore::GraphicsContext::clipPath):
1564         (WebCore::GraphicsContext::clipBounds const):
1565         (WebCore::GraphicsContext::drawLinesForText):
1566         (WebCore::GraphicsContext::roundToDevicePixels):
1567         (WebCore::GraphicsContext::translate):
1568         (WebCore::GraphicsContext::setPlatformStrokeThickness):
1569         (WebCore::GraphicsContext::setPlatformStrokeStyle):
1570         (WebCore::GraphicsContext::concatCTM):
1571         (WebCore::GraphicsContext::setCTM):
1572         (WebCore::GraphicsContext::beginPlatformTransparencyLayer):
1573         (WebCore::GraphicsContext::endPlatformTransparencyLayer):
1574         (WebCore::GraphicsContext::clearRect):
1575         (WebCore::GraphicsContext::strokeRect):
1576         (WebCore::GraphicsContext::setLineCap):
1577         (WebCore::GraphicsContext::setLineDash):
1578         (WebCore::GraphicsContext::setLineJoin):
1579         (WebCore::GraphicsContext::setMiterLimit):
1580         (WebCore::GraphicsContext::clipOut):
1581         (WebCore::GraphicsContext::rotate):
1582         (WebCore::GraphicsContext::scale):
1583         (WebCore::GraphicsContext::platformFillRoundedRect):
1584         (WebCore::GraphicsContext::fillRectWithRoundedHole):
1585         (WebCore::GraphicsContext::drawPattern):
1586         (WebCore::GraphicsContext::setPlatformShouldAntialias):
1587         (WebCore::GraphicsContext::setPlatformImageInterpolationQuality):
1588         (WebCore::GraphicsContext::isAcceleratedContext const):
1589         * platform/graphics/cg/GraphicsContextCG.cpp:
1590         (WebCore::GraphicsContext::savePlatformState):
1591         (WebCore::GraphicsContext::restorePlatformState):
1592         (WebCore::GraphicsContext::drawNativeImage):
1593         (WebCore::GraphicsContext::drawPattern):
1594         (WebCore::GraphicsContext::drawRect):
1595         (WebCore::GraphicsContext::drawLine):
1596         (WebCore::GraphicsContext::drawEllipse):
1597         (WebCore::GraphicsContext::applyStrokePattern):
1598         (WebCore::GraphicsContext::applyFillPattern):
1599         (WebCore::GraphicsContext::drawPath):
1600         (WebCore::GraphicsContext::fillPath):
1601         (WebCore::GraphicsContext::strokePath):
1602         (WebCore::GraphicsContext::fillRect):
1603         (WebCore::GraphicsContext::platformFillRoundedRect):
1604         (WebCore::GraphicsContext::fillRectWithRoundedHole):
1605         (WebCore::GraphicsContext::clip):
1606         (WebCore::GraphicsContext::clipOut):
1607         (WebCore::GraphicsContext::clipPath):
1608         (WebCore::GraphicsContext::clipBounds const):
1609         (WebCore::GraphicsContext::beginPlatformTransparencyLayer):
1610         (WebCore::GraphicsContext::endPlatformTransparencyLayer):
1611         (WebCore::GraphicsContext::setPlatformShadow):
1612         (WebCore::GraphicsContext::setMiterLimit):
1613         (WebCore::GraphicsContext::clearRect):
1614         (WebCore::GraphicsContext::strokeRect):
1615         (WebCore::GraphicsContext::setLineCap):
1616         (WebCore::GraphicsContext::setLineDash):
1617         (WebCore::GraphicsContext::setLineJoin):
1618         (WebCore::GraphicsContext::scale):
1619         (WebCore::GraphicsContext::rotate):
1620         (WebCore::GraphicsContext::translate):
1621         (WebCore::GraphicsContext::concatCTM):
1622         (WebCore::GraphicsContext::setCTM):
1623         (WebCore::GraphicsContext::getCTM const):
1624         (WebCore::GraphicsContext::roundToDevicePixels):
1625         (WebCore::GraphicsContext::drawLinesForText):
1626         (WebCore::GraphicsContext::setURLForRect):
1627         (WebCore::GraphicsContext::setIsCALayerContext):
1628         (WebCore::GraphicsContext::isCALayerContext const):
1629         (WebCore::GraphicsContext::setIsAcceleratedContext):
1630         (WebCore::GraphicsContext::isAcceleratedContext const):
1631         (WebCore::GraphicsContext::setPlatformTextDrawingMode):
1632         (WebCore::GraphicsContext::setPlatformStrokeColor):
1633         (WebCore::GraphicsContext::setPlatformStrokeThickness):
1634         (WebCore::GraphicsContext::setPlatformFillColor):
1635         (WebCore::GraphicsContext::setPlatformShouldAntialias):
1636         (WebCore::GraphicsContext::setPlatformShouldSmoothFonts):
1637         (WebCore::GraphicsContext::setPlatformAlpha):
1638         (WebCore::GraphicsContext::setPlatformCompositeOperation):
1639         (WebCore::GraphicsContext::platformApplyDeviceScaleFactor):
1640         (WebCore::GraphicsContext::platformFillEllipse):
1641         (WebCore::GraphicsContext::platformStrokeEllipse):
1642         (WebCore::GraphicsContext::setDestinationForRect):
1643         (WebCore::GraphicsContext::addDestinationAtPoint):
1644         * platform/graphics/cocoa/GraphicsContextCocoa.mm:
1645         (WebCore::GraphicsContext::drawFocusRing):
1646         * platform/graphics/displaylists/DisplayListRecorder.cpp:
1647         (WebCore::DisplayList::Recorder::Recorder):
1648         (WebCore::DisplayList::Recorder::updateItemExtent const):
1649         (WebCore::DisplayList::Recorder::extentFromLocalBounds const):
1650         * platform/graphics/displaylists/DisplayListRecorder.h:
1651         (WebCore::DisplayList::Recorder::itemCount const):
1652         * rendering/RenderTheme.cpp:
1653         (WebCore::RenderTheme::paint):
1654
1655 2017-11-04  Zalan Bujtas  <zalan@apple.com>
1656
1657         [LayoutState cleanup] Move all LayoutState* classes to LayoutState.h/cpp
1658         https://bugs.webkit.org/show_bug.cgi?id=179280
1659         <rdar://problem/35348452>
1660
1661         Reviewed by Antti Koivisto.
1662
1663         No change in functionality.
1664
1665         * page/LayoutContext.cpp:
1666         (WebCore::SubtreeLayoutStateMaintainer::SubtreeLayoutStateMaintainer): Deleted.
1667         (WebCore::SubtreeLayoutStateMaintainer::~SubtreeLayoutStateMaintainer): Deleted.
1668         (WebCore::SubtreeLayoutStateMaintainer::shouldDisableLayoutStateForSubtree): Deleted.
1669         * rendering/LayoutState.cpp:
1670         (WebCore::LayoutStateMaintainer::LayoutStateMaintainer):
1671         (WebCore::LayoutStateMaintainer::~LayoutStateMaintainer):
1672         (WebCore::LayoutStateMaintainer::push):
1673         (WebCore::LayoutStateMaintainer::pop):
1674         (WebCore::LayoutStateDisabler::LayoutStateDisabler):
1675         (WebCore::LayoutStateDisabler::~LayoutStateDisabler):
1676         (WebCore::shouldDisableLayoutStateForSubtree):
1677         (WebCore::SubtreeLayoutStateMaintainer::SubtreeLayoutStateMaintainer):
1678         (WebCore::SubtreeLayoutStateMaintainer::~SubtreeLayoutStateMaintainer):
1679         (WebCore::PaginatedLayoutStateMaintainer::PaginatedLayoutStateMaintainer):
1680         (WebCore::PaginatedLayoutStateMaintainer::~PaginatedLayoutStateMaintainer):
1681         * rendering/LayoutState.h:
1682         (WebCore::LayoutStateMaintainer::didPush const):
1683         * rendering/RenderBlockFlow.cpp:
1684         (WebCore::PaginatedLayoutStateMaintainer::PaginatedLayoutStateMaintainer): Deleted.
1685         (WebCore::PaginatedLayoutStateMaintainer::~PaginatedLayoutStateMaintainer): Deleted.
1686         (): Deleted.
1687         * rendering/RenderView.h:
1688         (WebCore::LayoutStateMaintainer::LayoutStateMaintainer): Deleted.
1689         (WebCore::LayoutStateMaintainer::~LayoutStateMaintainer): Deleted.
1690         (WebCore::LayoutStateMaintainer::push): Deleted.
1691         (WebCore::LayoutStateMaintainer::pop): Deleted.
1692         (WebCore::LayoutStateMaintainer::didPush const): Deleted.
1693         (WebCore::LayoutStateDisabler::LayoutStateDisabler): Deleted.
1694         (WebCore::LayoutStateDisabler::~LayoutStateDisabler): Deleted.
1695
1696 2017-11-04  Zalan Bujtas  <zalan@apple.com>
1697
1698         [LayoutState cleanup] Move offset/cliprect/pagination code to dedicate methods
1699         https://bugs.webkit.org/show_bug.cgi?id=179279
1700         <rdar://problem/35348171>
1701
1702         Reviewed by Antti Koivisto.
1703
1704         This is in preparation for creating the initial LayoutSate through LayoutStateMaintainer.
1705
1706         Moving code around. No change in functionality.
1707
1708         * rendering/LayoutState.cpp:
1709         (WebCore::LayoutState::LayoutState):
1710         (WebCore::LayoutState::computeOffsets):
1711         (WebCore::LayoutState::computeClipRect):
1712         (WebCore::LayoutState::computePaginationInformation):
1713         * rendering/LayoutState.h:
1714
1715 2017-11-01  Darin Adler  <darin@apple.com>
1716
1717         Simplify event dispatch code and make it a bit more consistent
1718         https://bugs.webkit.org/show_bug.cgi?id=178991
1719
1720         Reviewed by Chris Dumez.
1721
1722         Straighten out event dispatch code in three ways:
1723
1724         1) Add an Event::resetAfterDispatch function, and use it instead of the multiple
1725            separate functions that were used before to reset after dispatching. This fixed
1726            an extremely minor bug where we would leave some kinds of state on some event
1727            objects in unusual cases after dispatching the events.
1728
1729         2) Remove IDBEventDispatcher and make its callers use EventDispatcher instead.
1730            This leaves us with one less event dispatch code path to maintain, more shared code.
1731
1732         3) Remove boolean return values from functions that take event objects and
1733            dispatch the events. The return values are redundant with various things that
1734            can be checked by looking at the event itself. The legacy return value indicates
1735            whether the event has its "canceled flag" set, which means that the default
1736            behavior should be prevented. If that is what we need to check, it's easier
1737            to read the code and see that it's correct if it calls the named function
1738            "defaultPrevented" directly. More importantly, callers can also call whatever
1739            other function is appropriate to ask the specific relevant question to their needs.
1740            The general rule is that default behavior that we want to allow even with an
1741            untrusted event can be inside a default event handler function. Default behavior
1742            that should only happen for the browser-generated event can and should be done
1743            after dispatching the event, in the code that dispatches it; but that requires
1744            explicitly checking "defaultPrevented".
1745
1746         * Modules/indexeddb/IDBDatabase.cpp:
1747         (WebCore::IDBDatabase::dispatchEvent): Removed boolean return value.
1748         * Modules/indexeddb/IDBDatabase.h: Ditto.
1749
1750         * Modules/indexeddb/IDBEventDispatcher.cpp: Removed.
1751         * Modules/indexeddb/IDBEventDispatcher.h: Removed.
1752
1753         * Modules/indexeddb/IDBOpenDBRequest.cpp:
1754         (WebCore::IDBOpenDBRequest::dispatchEvent): Removed boolean return value.
1755         Added protection for "this" since the function accesses it after dispatching the event.
1756         * Modules/indexeddb/IDBOpenDBRequest.h: Ditto.
1757
1758         * Modules/indexeddb/IDBRequest.cpp:
1759         (WebCore::IDBRequest::dispatchEvent): Removed boolean return value. Instead of using
1760         IDBEventDispatcher, use EventDispatcher's new function that takes an initializer_list
1761         with a list of event targets. Added protection for "this" since the function accesses
1762         it after dispatching the event.
1763         * Modules/indexeddb/IDBRequest.h: Ditto.
1764         * Modules/indexeddb/IDBTransaction.cpp:
1765         (WebCore::IDBTransaction::dispatchEvent): Ditto.
1766         * Modules/indexeddb/IDBTransaction.h: Ditto.
1767
1768         * Modules/mediastream/RTCPeerConnection.cpp:
1769         (WebCore::RTCPeerConnection::dispatchEvent): Removed boolean return value.
1770         * Modules/mediastream/RTCPeerConnection.h: Ditto.
1771         * Modules/paymentrequest/PaymentRequest.cpp:
1772         (WebCore::PaymentRequest::shippingAddressChanged): Don't dispatch an event if
1773         m_isUpdating is true; preserves behavior that was implemented in
1774         PaymentRequest::dispatchEvent before. Since this is the source of the trusted
1775         event, cleaner to implement the rule here instead of overriding dispatchEvent.
1776         (WebCore::PaymentRequest::shippingOptionChanged): Ditto.
1777         (WebCore::PaymentRequest::dispatchEvent): Deleted.
1778         * Modules/paymentrequest/PaymentRequest.h: Ditto.
1779
1780         * Sources.txt: Removed IDBEventDispatcher.cpp.
1781         * WebCore.xcodeproj/project.pbxproj: Removed IDBEventDispatcher.h/cpp.
1782
1783         * dom/Element.cpp:
1784         (WebCore::Element::dispatchMouseEvent): Updated to call defaultPrevented
1785         directly instead of using the return value of dispatchEvent.
1786         (WebCore::Element::dispatchWheelEvent): Ditto.
1787         (WebCore::Element::dispatchKeyEvent): Ditto.
1788         (WebCore::Element::dispatchFocusInEvent): Removed assertion, since the
1789         underlying event dispatching takes care of it.
1790         (WebCore::Element::dispatchFocusOutEvent): Ditto.
1791         (WebCore::Element::dispatchFocusEvent): Call dispatchEvent instead of
1792         calling EventDispatcher::dispatchEvent. There is no good reason to use
1793         EventDispatcher directly.
1794         (WebCore::Element::dispatchBlurEvent): Ditto.
1795
1796         * dom/Event.cpp:
1797         (WebCore::Event::eventInterface const): Deleted. Moved into header since this is
1798         short and if called in a non-polymorphic context it's good to have it be inlined.
1799         (WebCore::Event::isUIEvent const): Ditto.
1800         (WebCore::Event::isMouseEvent const): Ditto.
1801         (WebCore::Event::isFocusEvent const): Ditto.
1802         (WebCore::Event::isKeyboardEvent const): Ditto.
1803         (WebCore::Event::isInputEvent const): Ditto.
1804         (WebCore::Event::isCompositionEvent const): Ditto.
1805         (WebCore::Event::isTouchEvent const): Ditto.
1806         (WebCore::Event::isClipboardEvent const): Ditto.
1807         (WebCore::Event::isBeforeTextInsertedEvent const): Ditto.
1808         (WebCore::Event::isBeforeUnloadEvent const): Ditto.
1809         (WebCore::Event::isErrorEvent const): Ditto.
1810         (WebCore::Event::isTextEvent const): Ditto.
1811         (WebCore::Event::isWheelEvent const): Ditto.
1812         (WebCore::Event::receivedTarget): Ditto.
1813         (WebCore::Event::resetAfterDispatch): Added. Replaces functions like
1814         clearEventPath and resetPropagationFlags, covering all the things we need to clear
1815         after dispatching an event.
1816
1817         * dom/Event.h: Removed some unneeded includes and forward declarations. Moved bodies
1818         of multi-line inline member functions out of the class definition. Changed argument
1819         type of setEventPhase and m_eventPhase to an enum rather than just an integer, since
1820         only the getter is for use from the bindings. Removed clearEventPath, srcElement, and
1821         resetPropagationFlags. Sorted the isXXX functions alphabetically and removed previous
1822         attempts to make categories out of them. Marked the constructor explicit since it has
1823         a single argument. Moved trivially short bodies into the class definition.
1824
1825         * dom/Event.idl: Use ImplementedAs to implement srcElement so we don't need it in
1826         the C++ code.
1827
1828         * dom/EventContext.cpp:
1829         (WebCore::EventContext::EventContext): Removed assertion since we now handle event
1830         contexts without nodes so we can use this to dispatch events for IDB, for example.
1831         (WebCore::EventContext::handleLocalEvents const): Add code to handle non-node event
1832         targets by calling fireEventListeners directly.
1833         (WebCore::MouseOrFocusEventContext::MouseOrFocusEventContext): Take a reference
1834         insetad of a pointer for the node.
1835         (WebCore::TouchEventContext::TouchEventContext): Ditto.
1836         (WebCore::TouchEventContext::handleLocalEvents const): Streamline a bit by improving
1837         the checkReachability function to be easier to call. Also removed an unneeded assertion
1838         just before calling downcast<>, the same assertion that downcast<> itself does.
1839         (WebCore::TouchEventContext::checkReachability const): Chagned argument type to take
1840         a Ref& so the caller doesn't have to call get() or ptr().
1841
1842         * dom/EventContext.h: Removed unneeded FIXME and currentTargetSameAsTarget function.
1843         Changed arguemnt types to use Node& instead of Node* as appropriate. Removed unused
1844         functions from TouchEventContext, made more private, and changed data members to Ref
1845         instead of RefPtr. Removed unused NotTouchList value from TouchListType enumeration.
1846         Changed touchList function to return a reference instead of a pointer.
1847
1848         * dom/EventDispatcher.cpp: Removed unneeded includes.
1849         (WebCore::dispatchEventInDOM): Removed use of currentTargetSameAsTarget since it's
1850         clearer if written out.
1851         (WebCore::EventDispatcher::dispatchEvent): Changed no-event dispatch assertion to
1852         use RELEASE_ASSERT_WITH_SECURITY_IMPLICATION since the style checker says so, but
1853         it still doesn't assert anything in release builds because the check in
1854         NoEventDispatchAssertion itself is debug-only. Moved the calls to EventPath's
1855         setRelatedTarget and retargetTouchLists functions inside the EventPath constructor.
1856         Removed the second no-event dispatch assertion because we only need one. Replaced
1857         calls to clearEventPath, setCurrentTarget(nullptr), resetPropagationFlags,
1858         and setEventPhase(NONE) and with a call to resetAfterDispatch. Moved the code that
1859         temporarily sets the target to a different value when calling default event handlers
1860         into the block that calls the default event handlers. Added a new overload that
1861         takes an initializer list of event targets so we can dispatch events that are not
1862         being sent to nodes.
1863
1864         * dom/EventDispatcher.h: Fixed misleading copyright dates and names since this file
1865         just contains a couple of function declarations. Added new overload of dispatchEvent.
1866
1867         * dom/EventPath.cpp:
1868         (WebCore::WindowEventContext::WindowEventContext): Take references instead of pointers.
1869         (WebCore::EventPath::EventPath): Moved the bulk of construction into a new function
1870         named buildPath, so it can still use "return" without skipping the additions here.
1871         Added calls to setRelatedTarget and retargetTouchLists and now both can be private.
1872         Also added a new overload that takes event targets that are not nodes.
1873         (WebCore::EventPath::buildPath): Added. Contains what used to be in the constructor.
1874         But use some references instead of pointers and refactor a bit using lambdas.
1875         (WebCore::EventPath::retargetTouchList): Added. Makes the retargetTouchLists function
1876         shorter and less repetetive.
1877         (WebCore::EventPath::retargetTouchLists): Updated to call retargetTouchList.
1878         (WebCore::EventPath::hasEventListeners const): Deleted. This was unused.
1879         * dom/EventPath.h: Added a constructor that takes an initializer list of event targets.
1880         Made retargetTouchEvents and setRelatedTarget private and used them in the constructor
1881         insead of expecting clients to call them. Removed unused hasEventListeners and
1882         lastContextIfExists functions. Moved body of the eventTargetRespectingTargetRules
1883         function out of the class definition.
1884
1885         * dom/EventTarget.cpp:
1886         (WebCore::EventTarget::dispatchEventForBindings): Updated so it does not expect
1887         dispatchEvent to return a boolean. Instead call a function on the event after dispatching.
1888         Decided to use legacyReturnValue instead of !defaultPrevented, because this is exactly
1889         the return value that the returnValue property is referring to.
1890         (WebCore::EventTarget::dispatchEvent): Removed return value. Replaced calls to
1891         resetPropagationFlags and setEventPhase(NONE) with a call to resetAfterDispatch.
1892         I noticed that there was a local boolean here named "defaultPrevented", which was
1893         backwards; the value in that local was "default not prevented". Doesn't matter since
1894         the boolean return value was removed.
1895         (WebCore::EventTarget::fireEventListeners): Removed the boolean return value.
1896
1897         * dom/EventTarget.h: Added initial values to members of ListenerOptions and
1898         AddEventListenerOptions; maybe we can get rid of the constructors some day.
1899         Removed booelan return values from dispatchEvent and fireEventListeners.
1900
1901         * dom/KeyboardEvent.cpp: Removed unneeded include of EventDispatcher.h.
1902
1903         * dom/Node.cpp:
1904         (WebCore::Node::dispatchEvent): Got rid of boolean return value.
1905         Removed special case code that sometimes called dispatchTouchEvent, since that
1906         just turns around and calls EventDispatcher::dispatchEvent just like this function.
1907         (WebCore::Node::dispatchDOMActivateEvent): Removed boolean return value, removed
1908         integer detail argument and moved the logic to compute the value of the detail
1909         peroprty and to call setDefaultHandled on the underlying click event in here.
1910         This is a private helper function used only in one place.
1911         (WebCore::Node::dispatchTouchEvent): Deleted.
1912         (WebCore::Node::defaultEventHandler): Updated for change to dispatchDOMActivateEvent.
1913         * dom/Node.h: Updated for the above changes.
1914
1915         * dom/RejectedPromiseTracker.cpp:
1916         (WebCore::RejectedPromiseTracker::reportUnhandledRejections): Use defaultPrevented
1917         directly instead of the return value from dispatchEvent.
1918
1919         * dom/ScopedEventQueue.cpp:
1920         (WebCore::ScopedEventQueue::enqueueEvent): Moved assertions here ...
1921         (WebCore::ScopedEventQueue::dispatchEvent const): ... from here. Also changed this
1922         to call Node::dispatchEvent instead of calling EventDispatcher::dispatchEvent directly.
1923
1924         * dom/SimulatedClick.cpp:
1925         (WebCore::simulateMouseEvent): Call Element::dispatchEvent instead of calling
1926         EventDispatcher::dispatchEvent directly.
1927
1928         * editing/Editor.cpp:
1929         (WebCore::dispatchBeforeInputEvent): Use defaultPrevented directly instead of the
1930         return value from dispatchEvent.
1931         * editing/FrameSelection.cpp:
1932         (WebCore::FrameSelection::selectAll): Ditto.
1933         (WebCore::FrameSelection::dispatchSelectStart): Ditto.
1934
1935         * html/CheckboxInputType.cpp:
1936         (WebCore::CheckboxInputType::didDispatchClick): Take a reference instead of a pointer.
1937         * html/CheckboxInputType.h: Updated for above and to use final instead of override.
1938
1939         * html/HTMLFormControlElement.cpp:
1940         (WebCore::HTMLFormControlElement::checkValidity): Use defaultPrevented directly instead
1941         of the return value from dispatchEvent.
1942
1943         * html/HTMLFormElement.cpp:
1944         (WebCore::HTMLFormElement::prepareForSubmission): Use defaultPrevented directly instead
1945         of the return value from dispatchEvent.
1946         (WebCore::HTMLFormElement::reset): Ditto.
1947
1948         * html/HTMLInputElement.cpp:
1949         (WebCore::HTMLInputElement::didDispatchClickEvent): Updated to pass references instead
1950         of pointer.
1951
1952         * html/HTMLMediaElement.cpp:
1953         (WebCore::HTMLMediaElement::dispatchEvent): Got rid of boolean return value.
1954         * html/HTMLMediaElement.h: Ditto.
1955
1956         * html/HTMLPlugInElement.h: Use "delete" instead of just a private function for something
1957         that should never be called.
1958
1959         * html/InputType.cpp:
1960         (WebCore::InputType::didDispatchClick): Take a reference instead of a pointer.
1961         * html/InputType.h: Ditto.
1962         * html/RadioInputType.cpp:
1963         (WebCore::RadioInputType::didDispatchClick): Ditto.
1964         * html/RadioInputType.h: Updated for above and to use final instead of override.
1965
1966         * html/track/TextTrackCue.cpp:
1967         (WebCore::TextTrackCue::dispatchEvent): Got rid of boolean return value.
1968         * html/track/TextTrackCue.h: Ditto.
1969
1970         * inspector/InspectorInstrumentation.cpp: Removed unneeded include of EventDispatcher.h.
1971
1972         * page/DOMWindow.cpp:
1973         (WebCore::DOMWindow::dispatchLoadEvent): Streamlined code a bit so we only have a single
1974         call to dispatchEvent. Improved comments.
1975         (WebCore::DOMWindow::dispatchEvent): Removed return value. Added comments. Replaced
1976         calls to setCurrentTarget(null), setEventPhase(NONE), and resetPropagationFlags with
1977         a call to resetAfterDispatch.
1978         * page/DOMWindow.h: Updated to get rid of the boolean return value.
1979
1980         * page/DragController.cpp:
1981         (WebCore::DragController::dispatchTextInputEventFor): Use defaultPrevented directly instead
1982         of the return value from dispatchEvent.
1983
1984         * page/EventHandler.cpp:
1985         (WebCore::dispatchSelectStart): Use defaultPrevented directly instead
1986         of the return value from dispatchEvent.
1987         (WebCore::EventHandler::accessibilityPreventsEventPropagation): Fixed spelling error in the
1988         name of this function.
1989         (WebCore::EventHandler::dispatchDragSrcEvent): Got rid of boolean return value.
1990         (WebCore::EventHandler::handleTouchEvent): Call dispatchEvent instead of dispatchTouchEvent;
1991         there was no difference between the two except that dispatchTouchEvent required downcasting
1992         and might some day lead to us missing some behavior implemented in an override to dispatchEvent.
1993         * page/EventHandler.h: Updated for above changes.
1994
1995         * platform/graphics/filters/FilterOperation.h:
1996         (WebCore::FilterOperation::clone): Removed dead code that was causing a compiler warning.
1997
1998         * workers/WorkerMessagingProxy.cpp:
1999         (WebCore::WorkerMessagingProxy::postExceptionToWorkerObject): Use defaultPrevented
2000         directly instead of the return value from dispatchEvent.
2001
2002 2017-11-04  Aishwarya Nirmal  <anirmal@apple.com>
2003
2004         [Touch Bar Web API] Add support for menuitem tag
2005         https://bugs.webkit.org/show_bug.cgi?id=179020
2006
2007         Reviewed by Ryosuke Niwa.
2008
2009         The Touch Bar Web API will make use of the menu and menuitem tags
2010         to represent the NSTouchBar and NSTouchBarItem respectively.
2011         Since WebKit currently does not offer support for the menuitem tag,
2012         this change adds it in. There is a runtime flag for this tag, which
2013         is set to false by default.
2014
2015         A specification for the menuitem element can be found at
2016         https://www.w3.org/TR/2013/WD-html51-20130528/interactive-elements.html#the-menuitem-element.
2017         More attributes of this element will be implemented in future patches.
2018
2019         Test: fast/html/menuitem-element.html
2020
2021         * CMakeLists.txt:
2022         * DerivedSources.cpp:
2023         * DerivedSources.make:
2024         * Sources.txt:
2025         * WebCore.xcodeproj/project.pbxproj:
2026         * bindings/js/WebCoreBuiltinNames.h:
2027         * html/HTMLElementsAllInOne.cpp:
2028         * html/HTMLMenuItemElement.cpp: Added.
2029         (WebCore::HTMLMenuItemElement::HTMLMenuItemElement):
2030         (WebCore::HTMLMenuItemElement::create):
2031         * html/HTMLMenuItemElement.h: Added.
2032         * html/HTMLMenuItemElement.idl: Added.
2033         * html/HTMLTagNames.in:
2034         * page/RuntimeEnabledFeatures.h:
2035         (WebCore::RuntimeEnabledFeatures::setMenuItemElementEnabled):
2036         (WebCore::RuntimeEnabledFeatures::menuItemElementEnabled const):
2037
2038 2017-11-03  Zalan Bujtas  <zalan@apple.com>
2039
2040         LayoutState should take RenderBox reference.
2041         https://bugs.webkit.org/show_bug.cgi?id=179272
2042         <rdar://problem/35345247>
2043
2044         Reviewed by Simon Fraser.
2045
2046         No change in functionality.
2047
2048         * rendering/LayoutState.cpp:
2049         (WebCore::LayoutState::LayoutState):
2050         (WebCore::LayoutState::propagateLineGridInfo):
2051         (WebCore::LayoutState::establishLineGrid):
2052         * rendering/LayoutState.h: type tightening.
2053         * rendering/RenderBlock.cpp:
2054         (WebCore::RenderBlock::offsetFromLogicalTopOfFirstPage const):
2055         * rendering/RenderView.cpp:
2056         (WebCore::RenderView::pushLayoutState):
2057         * rendering/RenderView.h:
2058
2059 2017-11-03  Youenn Fablet  <youenn@apple.com>
2060
2061         Implement ServiceWorkerContainer.getRegistration
2062         https://bugs.webkit.org/show_bug.cgi?id=179253
2063
2064         Reviewed by Chris Dumez.
2065
2066         Test: http/tests/workers/service/service-worker-getRegistration.html
2067
2068         Added a map of ServiceWorkerRegistration in ServiceWorkerContainer.
2069         Removing a similar map from SWClientConnection as it is more convenient to have this map per ScriptExecutionContext.
2070
2071         This map allows returning the same JS object for different getRegistration.
2072         Delegating the actual matching to SWServer::Connection which is implemented on the StorageProcess through IPC.
2073
2074         * workers/service/ServiceWorkerContainer.cpp:
2075         (WebCore::ServiceWorkerContainer::getRegistration):
2076         (WebCore::ServiceWorkerContainer::jobResolvedWithRegistration):
2077         (WebCore::ServiceWorkerContainer::jobDidFinish):
2078         * workers/service/ServiceWorkerContainer.h:
2079         * workers/service/ServiceWorkerContainer.idl:
2080         * workers/service/ServiceWorkerRegistration.cpp:
2081         (WebCore::ServiceWorkerRegistration::ServiceWorkerRegistration):
2082         (WebCore::ServiceWorkerRegistration::~ServiceWorkerRegistration):
2083         * workers/service/ServiceWorkerRegistration.h:
2084         * workers/service/server/SWClientConnection.cpp:
2085         (WebCore::SWClientConnection::updateRegistrationState):
2086         (WebCore::SWClientConnection::addServiceWorkerRegistration): Deleted.
2087         (WebCore::SWClientConnection::removeServiceWorkerRegistration): Deleted.
2088         * workers/service/server/SWClientConnection.h:
2089
2090 2017-11-03  Chris Dumez  <cdumez@apple.com>
2091
2092         [iOS-WK1] Fix thread safety issue in WebSQLiteDatabaseTrackerClient
2093         https://bugs.webkit.org/show_bug.cgi?id=179190
2094
2095         Reviewed by David Kilzer.
2096
2097         WebSQLiteDatabaseTrackerClient and its HystererisActivity member are constructed on the UIThread. The
2098         HystererisActivity activity also fires on the UIThread, which means that WebSQLiteDatabaseTrackerClient::hysteresisUpdated()
2099         gets called on the UIThread.
2100
2101         However, the code in WebSQLiteDatabaseTrackerClient::willBeginFirstTransaction() / WebSQLiteDatabaseTrackerClient::didFinishLastTransaction()
2102         uses callOnMainThread() before calling methods on the HysteresisActivity. callOnMainThread() dispatches to the WebThread on WK1 iOS, which
2103         would lead to crashes when calling methods of the HystererisActivity object:
2104         *** -[CFRunLoopTimer respondsToSelector:]: message sent to deallocated instance 0x1c0b6a500
2105
2106         To address the issue, we now dispatch_async() to the main queue in willBeginFirstTransaction() / didFinishLastTransaction()
2107         instead of using callOnMainThread(). I also added assertions to catch issues like these.
2108
2109         * platform/ios/WebSQLiteDatabaseTrackerClient.mm:
2110         (WebCore::WebSQLiteDatabaseTrackerClient::willBeginFirstTransaction):
2111         (WebCore::WebSQLiteDatabaseTrackerClient::didFinishLastTransaction):
2112         (WebCore::WebSQLiteDatabaseTrackerClient::hysteresisUpdated):
2113
2114 2017-11-03  Ryosuke Niwa  <rniwa@webkit.org>
2115
2116         ASSERTION FAILED: NoEventDispatchAssertion::InMainThread::isEventAllowed() || (frameView && frameView->isInChildFrameWithFrameFlattening())
2117         https://bugs.webkit.org/show_bug.cgi?id=179259
2118
2119         Reviewed by Youenn Fablet.
2120
2121         Avoid updating the layout inside HTMLMediaElement::stop() and MediaElementSession::~MediaElementSession
2122
2123         No new tests since existing tests cover this.
2124
2125         * html/HTMLMediaElement.cpp:
2126         (WebCore::HTMLMediaElement::userCancelledLoad): Don't update VTT cues when the active DOM objects are being stopped.
2127         * platform/audio/mac/MediaSessionManagerMac.mm:
2128         (WebCore::MediaSessionManagerMac::removeSession): Update the updateNowPlayingInfo asynchronously
2129         since this function can be called inside HTMLMediaElement::~HTMLMediaElement.
2130
2131 2017-11-03  Alex Christensen  <achristensen@webkit.org>
2132
2133         Add WEBCORE_EXPORT to CachedResourceHandleBase
2134         https://bugs.webkit.org/show_bug.cgi?id=179251
2135
2136         * loader/cache/CachedResourceHandle.h:
2137         (WebCore::CachedResourceHandleBase::get const): Deleted.
2138         (WebCore::CachedResourceHandleBase::operator! const): Deleted.
2139         (WebCore::CachedResourceHandleBase::operator UnspecifiedBoolType const): Deleted.
2140         (WebCore::CachedResourceHandleBase::operator=): Deleted.
2141         I'll need this soon for bug 179251, and having to touch CachedResourceHandle.h causes me to rebuild everything.
2142         Committing it separately greatly increases my debugging and comparison speed.
2143
2144 2017-11-03  Commit Queue  <commit-queue@webkit.org>
2145
2146         Unreviewed, rolling out r224428, r224435, and r224440.
2147         https://bugs.webkit.org/show_bug.cgi?id=179274
2148
2149         Broke iOS and internal builds (Requested by ryanhaddad on
2150         #webkit).
2151
2152         Reverted changesets:
2153
2154         "Use VCP H264 encoder for platforms supporting it"
2155         https://bugs.webkit.org/show_bug.cgi?id=179076
2156         https://trac.webkit.org/changeset/224428
2157
2158         "Use VCP H264 encoder for platforms supporting it"
2159         https://bugs.webkit.org/show_bug.cgi?id=179076
2160         https://trac.webkit.org/changeset/224435
2161
2162         "Use VCP H264 encoder for platforms supporting it"
2163         https://bugs.webkit.org/show_bug.cgi?id=179076
2164         https://trac.webkit.org/changeset/224440
2165
2166 2017-11-03  Youenn Fablet  <youenn@apple.com>
2167
2168         Requests handled by Service Worker should not go through preflighting
2169         https://bugs.webkit.org/show_bug.cgi?id=179250
2170
2171         Reviewed by Alex Christensen.
2172
2173         Test: http/tests/workers/service/service-worker-crossorigin-fetch.html
2174         In case of cross origin requests needed preflighting that may be served through SW, the following is done:
2175         - Bypass preflight
2176         - Put service workers mode as Only so that if SW is not handling the request, the load will fail
2177         - If load fails, restart DocumentThreadableLoader load with preflight.
2178
2179         Additional testing should be added when we properly handle the case where no fetch event handler is registered in the service worker.
2180
2181         * loader/DocumentThreadableLoader.cpp:
2182         (WebCore::DocumentThreadableLoader::makeCrossOriginAccessRequest):
2183         (WebCore::DocumentThreadableLoader::didFail):
2184         * loader/DocumentThreadableLoader.h:
2185         * loader/ResourceLoaderOptions.h:
2186         * loader/cache/CachedResourceRequest.cpp:
2187         (WebCore::CachedResourceRequest::setSelectedServiceWorkerIdentifierIfNeeded):
2188         * platform/network/ResourceErrorBase.h:
2189
2190 2017-11-03  Zalan Bujtas  <zalan@apple.com>
2191
2192         Remove redundant LayoutStateMaintainer argument (RenderView&)
2193         https://bugs.webkit.org/show_bug.cgi?id=179269
2194         <rdar://problem/35344397>
2195
2196         Reviewed by Simon Fraser.
2197
2198         No change in functionality.
2199
2200         * rendering/RenderBlock.cpp:
2201         (WebCore::RenderBlock::simplifiedLayout):
2202         * rendering/RenderBlockFlow.cpp:
2203         (WebCore::RenderBlockFlow::layoutBlock):
2204         * rendering/RenderBox.cpp:
2205         (WebCore::RenderBox::layout):
2206         * rendering/RenderDeprecatedFlexibleBox.cpp:
2207         (WebCore::RenderDeprecatedFlexibleBox::layoutBlock):
2208         * rendering/RenderEmbeddedObject.cpp:
2209         (WebCore::RenderEmbeddedObject::layout):
2210         * rendering/RenderFlexibleBox.cpp:
2211         (WebCore::RenderFlexibleBox::layoutBlock):
2212         * rendering/RenderGrid.cpp:
2213         (WebCore::RenderGrid::layoutBlock):
2214         * rendering/RenderImage.cpp:
2215         (WebCore::RenderImage::layoutShadowControls):
2216         * rendering/RenderTable.cpp:
2217         (WebCore::RenderTable::layout):
2218         * rendering/RenderTableRow.cpp:
2219         (WebCore::RenderTableRow::layout):
2220         * rendering/RenderTableSection.cpp:
2221         (WebCore::RenderTableSection::layout):
2222         (WebCore::RenderTableSection::layoutRows):
2223         * rendering/RenderVTTCue.cpp:
2224         (WebCore::RenderVTTCue::layout):
2225         * rendering/RenderView.h:
2226         (WebCore::LayoutStateMaintainer::LayoutStateMaintainer):
2227
2228 2017-11-03  Youenn Fablet  <youenn@apple.com>
2229
2230         Use VCP H264 encoder for platforms supporting it
2231         https://bugs.webkit.org/show_bug.cgi?id=179076
2232         rdar://problem/35180773
2233
2234         Reviewed by Eric Carlson.
2235
2236         Covered by existing test coverage.
2237
2238         * platform/mediastream/libwebrtc/VideoToolBoxEncoderFactory.cpp:
2239         (WebCore::VideoToolboxVideoEncoderFactory::setActive):
2240         (WebCore::VideoToolboxVideoEncoderFactory::CreateSupportedVideoEncoder):
2241         (WebCore::VideoToolboxVideoEncoderFactory::DestroyVideoEncoder):
2242         * platform/mediastream/libwebrtc/VideoToolBoxEncoderFactory.h:
2243
2244 2017-11-03  Basuke Suzuki  <Basuke.Suzuki@sony.com>
2245
2246         [Curl] Fix build after r224373
2247         https://bugs.webkit.org/show_bug.cgi?id=179265
2248
2249         Unreviewed build fix.
2250
2251         * platform/network/curl/ResourceHandleCurl.cpp:
2252         (WebCore::ResourceHandle::continueWillSendRequest): Deleted.
2253
2254 2017-11-03  Brady Eidson  <beidson@apple.com>
2255
2256         Remove an invalid ASSERT that is seen intermittently.
2257         https://bugs.webkit.org/show_bug.cgi?id=179186
2258
2259         Unreviewed.
2260
2261         * workers/service/server/SWServerRegistration.cpp:
2262         (WebCore::SWServerRegistration::removeClientServiceWorkerRegistration): This is an invalid ASSERT,
2263           it's definitely racey over IPC.
2264
2265 2017-11-03  Michael Catanzaro  <mcatanzaro@igalia.com>
2266
2267         [WPE] Remove unneeded USE(LIBEPOXY) guards
2268         https://bugs.webkit.org/show_bug.cgi?id=179228
2269
2270         Reviewed by Carlos Garcia Campos.
2271
2272         USE(LIBEPOXY) is already mandatory for WPE.
2273
2274         * platform/graphics/egl/GLContextEGLWPE.cpp:
2275         * platform/graphics/wpe/PlatformDisplayWPE.cpp:
2276
2277 2017-11-03  Ali Juma  <ajuma@chromium.org>
2278
2279         Layout viewport rect is too wide after window resize
2280         https://bugs.webkit.org/show_bug.cgi?id=175235
2281
2282         Fix a formatting mistake that was introduced by r224241.
2283
2284         Reviewed by Simon Fraser.
2285
2286         No change in behavior.
2287
2288         * platform/ScrollView.cpp:
2289         (WebCore::ScrollView::updateScrollbars):
2290
2291 2017-11-03  Youenn Fablet  <youenn@apple.com>
2292
2293         Implement Service Worker Matching Registration algorithm
2294         https://bugs.webkit.org/show_bug.cgi?id=178882
2295
2296         Reviewed by Chris Dumez.
2297
2298         Test: http/tests/workers/service/service-worker-clear.html
2299
2300         Adding support for scope as part of the ServiceWorkerRegistrationKey to disambiguate several service workers registered with different scopes.
2301         Adding the Service Worker Registration algorithm in SWServer and adding internals API to test it.
2302         Making ServiceWorkerRegistrationKey a class to protect its internal field to be reused in wrong places.
2303
2304         Added preliminary support for clearing service workers for a given session ID as this is needed by WTR for stable testing.
2305
2306         * testing/Internals.cpp:
2307         (WebCore::Internals::hasServiceWorkerRegistration):
2308         * testing/Internals.h:
2309         * testing/Internals.idl:
2310         * workers/service/ServiceWorkerJobData.cpp:
2311         (WebCore::ServiceWorkerJobData::registrationKey const):
2312         * workers/service/ServiceWorkerRegistration.h:
2313         * workers/service/ServiceWorkerRegistrationKey.cpp:
2314         (WebCore::ServiceWorkerRegistrationKey::hash const):
2315         (WebCore::ServiceWorkerRegistrationKey::operator== const):
2316         (WebCore::ServiceWorkerRegistrationKey::isolatedCopy const):
2317         * workers/service/ServiceWorkerRegistrationKey.h:
2318         (WebCore::ServiceWorkerRegistrationKey::encode const):
2319         (WebCore::ServiceWorkerRegistrationKey::decode):
2320         * workers/service/server/SWClientConnection.h:
2321         * workers/service/server/SWServer.cpp:
2322         (WebCore::SWServer::clear):
2323         (WebCore::SWServer::doRegistrationMatching const):
2324         * workers/service/server/SWServer.h:
2325         (WebCore::SWServer::Connection::doRegistrationMatching const):
2326         * workers/service/server/SWServerJobQueue.cpp:
2327         (WebCore::SWServerJobQueue::~SWServerJobQueue):
2328         * workers/service/server/SWServerRegistration.h:
2329
2330 2017-11-02  Dean Jackson  <dino@apple.com>
2331
2332         Add basic OffscreenCanvas interface
2333         https://bugs.webkit.org/show_bug.cgi?id=179213
2334         <rdar://problem/35326778>
2335
2336         Reviewed by Sam Weinig.
2337
2338         Add the basic infrastructure for the OffscreenCanvas
2339         object, so it can be created from script.
2340
2341         Test: http/wpt/offscreen-canvas/offscreencanvas.constructor.html
2342
2343         * DerivedSources.make:
2344         * Sources.txt:
2345         * WebCore.xcodeproj/project.pbxproj:
2346         * bindings/js/JSEventTargetCustom.cpp:
2347         * dom/EventTargetFactory.in:
2348         * html/OffscreenCanvas.cpp: Added.
2349         (WebCore::OffscreenCanvas::create):
2350         (WebCore::OffscreenCanvas::OffscreenCanvas):
2351         (WebCore::OffscreenCanvas::width const):
2352         (WebCore::OffscreenCanvas::setWidth):
2353         (WebCore::OffscreenCanvas::height const):
2354         (WebCore::OffscreenCanvas::setHeight):
2355         * html/OffscreenCanvas.h: Added.
2356         * html/OffscreenCanvas.idl: Added.
2357
2358 2017-11-03  Ryosuke Niwa  <rniwa@webkit.org>
2359
2360         Crash inside ChildListMutationAccumulator::enqueueMutationRecord()
2361         https://bugs.webkit.org/show_bug.cgi?id=179234
2362         <rdar://problem/35287748>
2363
2364         Reviewed by Darin Adler.
2365
2366         Fixed the crash by keeping MutationObserver referenced by MutationObserverInterestGroup alive.
2367
2368         Also added hasCallback() virtual function on MutationObserver to check whether the callback is alive
2369         to work around the bug that JS function referenced by MutationObserver isn't kept alive.
2370         We'll address this bug separately in https://webkit.org/b/179224.
2371
2372         Test: fast/dom/MutationObserver/disconnect-observer-while-mutation-records-are-enqueued-crash.html
2373
2374         * bindings/scripts/CodeGeneratorJS.pm:
2375         (GenerateCallbackHeaderContent): Added an override for the newly added virtual hasCallback().
2376         * dom/MutationCallback.h:
2377         * dom/MutationObserver.cpp:
2378         (WebCore::MutationObserver::deliver): Added the aforementioned workaround.
2379         * dom/MutationObserverInterestGroup.cpp:
2380         (WebCore::MutationObserverInterestGroup::MutationObserverInterestGroup): Fixed the crash by using Ref.
2381         (WebCore::MutationObserverInterestGroup::enqueueMutationRecord): Ditto.
2382         * dom/MutationObserverInterestGroup.h:
2383         * dom/NativeNodeFilter.cpp:
2384         (WebCore::NativeNodeFilter::hasCallback const): Always return true here. This function is never called
2385         but we still need to implement it since NodeFilter has a pure virtual hasCallback() now.
2386         * dom/NativeNodeFilter.h:
2387         * dom/Node.cpp:
2388         (WebCore::collectMatchingObserversForMutation): Use Ref to fix the crash.
2389         (WebCore::Node::registeredMutationObservers): Ditto.
2390         * dom/Node.h:
2391         * dom/NodeFilter.h:
2392
2393 2017-11-03  Zalan Bujtas  <zalan@apple.com>
2394
2395         RenderObject::*positioned() naming cleanup
2396         https://bugs.webkit.org/show_bug.cgi?id=179206
2397         <rdar://problem/35325254>
2398
2399         Reviewed by Darin Adler.
2400
2401         +isFixedPositioned()
2402         +isAbsolutelyPositioned()
2403         isRelPositioned() -> isRelativelyPositioned()
2404
2405         Covered by existing tests.
2406
2407         * css/CSSComputedStyleDeclaration.cpp:
2408         (WebCore::positionOffsetValue):
2409         * dom/Element.cpp:
2410         (WebCore::layoutOverflowRectContainsAllDescendants):
2411         * rendering/LayoutState.cpp:
2412         (WebCore::LayoutState::LayoutState):
2413         * rendering/LayoutState.h:
2414         * rendering/RenderBlock.cpp:
2415         (WebCore::RenderBlock::renderName const):
2416         * rendering/RenderBox.cpp:
2417         (WebCore::RenderBox::fixedElementLaysOutRelativeToFrame const):
2418         (WebCore::RenderBox::foregroundIsKnownToBeOpaqueInRect const):
2419         (WebCore::RenderBox::mapLocalToContainer const):
2420         (WebCore::RenderBox::pushMappingToContainer const):
2421         (WebCore::RenderBox::mapAbsoluteToLocalPoint const):
2422         (WebCore::RenderBox::offsetFromContainer const):
2423         (WebCore::RenderBox::containingBlockLogicalWidthForPositioned const):
2424         (WebCore::RenderBox::containingBlockLogicalHeightForPositioned const):
2425         * rendering/RenderBoxModelObject.cpp:
2426         (WebCore::RenderBoxModelObject::adjustedPositionRelativeToOffsetParent const):
2427         (WebCore::RenderBoxModelObject::offsetForInFlowPosition const):
2428         * rendering/RenderDeprecatedFlexibleBox.cpp:
2429         (WebCore::RenderDeprecatedFlexibleBox::renderName const):
2430         * rendering/RenderFragmentedFlow.cpp:
2431         (WebCore::RenderFragmentedFlow::adjustedPositionRelativeToOffsetParent const):
2432         * rendering/RenderGeometryMap.cpp:
2433         (WebCore::canMapBetweenRenderersViaLayers):
2434         * rendering/RenderGrid.cpp:
2435         (WebCore::RenderGrid::renderName const):
2436         * rendering/RenderInline.cpp:
2437         (WebCore::RenderInline::renderName const):
2438         * rendering/RenderLayer.cpp:
2439         (WebCore::RenderLayer::paintLayer):
2440         (WebCore::RenderLayer::calculateClipRects const):
2441         * rendering/RenderLayerBacking.cpp:
2442         (WebCore::RenderLayerBacking::updateCompositedBounds):
2443         * rendering/RenderLayerCompositor.cpp:
2444         (WebCore::RenderLayerCompositor::updateBacking):
2445         (WebCore::RenderLayerCompositor::computeExtent const):
2446         (WebCore::RenderLayerCompositor::reasonsForCompositing const):
2447         (WebCore::RenderLayerCompositor::isViewportConstrainedFixedOrStickyLayer const):
2448         (WebCore::RenderLayerCompositor::updateScrollCoordinatedLayer):
2449         (WebCore::RenderLayerCompositor::registerAllViewportConstrainedLayers):
2450         * rendering/RenderObject.cpp:
2451         (WebCore::RenderObject::containingBlock const):
2452         (WebCore::RenderObject::outputRenderObject const):
2453         (WebCore::RenderObject::offsetParent const):
2454         * rendering/RenderObject.h:
2455         (WebCore::RenderObject::isPositioned const):
2456         (WebCore::RenderObject::isInFlowPositioned const):
2457         (WebCore::RenderObject::isFixedPositioned const):
2458         (WebCore::RenderObject::isAbsolutePositioned const):
2459         (WebCore::RenderObject::isRelativePositioned const):
2460         (WebCore::RenderObject::isStickyPositioned const):
2461         (WebCore::RenderObject::RenderObjectBitfields::RenderObjectBitfields):
2462         (WebCore::RenderObject::RenderObjectBitfields::isRelativePositioned const):
2463         (WebCore::RenderObject::RenderObjectBitfields::isPositioned const):
2464         (WebCore::RenderObject::isRelPositioned const): Deleted.
2465         (WebCore::RenderObject::RenderObjectBitfields::isRelPositioned const): Deleted.
2466
2467 2017-11-03  Chris Dumez  <cdumez@apple.com>
2468
2469         Use a single identifier type to identify Service Workers
2470         https://bugs.webkit.org/show_bug.cgi?id=179192
2471
2472         Reviewed by Brady Eidson.
2473
2474         Use a single identifier type to identify Service Workers. We had both a String
2475         identifier and a uint64_t identifier for each service worker. We now consistently
2476         use a ServiceWorkerIdentifier which is a strongly typed identifier backed by a
2477         uint64_t.
2478
2479         * WebCore.xcodeproj/project.pbxproj:
2480         * loader/ResourceLoaderOptions.h:
2481         * loader/cache/CachedResourceRequest.cpp:
2482         (WebCore::CachedResourceRequest::setSelectedServiceWorkerIdentifierIfNeeded):
2483         * loader/cache/CachedResourceRequest.h:
2484         * workers/service/ServiceWorker.cpp:
2485         (WebCore::ServiceWorker::ServiceWorker):
2486         * workers/service/ServiceWorker.h:
2487         * workers/service/ServiceWorkerClient.cpp:
2488         (WebCore::ServiceWorkerClient::postMessage):
2489         * workers/service/ServiceWorkerContainer.cpp:
2490         (WebCore::ServiceWorkerContainer::jobResolvedWithRegistration):
2491         * workers/service/ServiceWorkerContextData.cpp:
2492         (WebCore::ServiceWorkerContextData::isolatedCopy const):
2493         * workers/service/ServiceWorkerContextData.h:
2494         (WebCore::ServiceWorkerContextData::encode const):
2495         (WebCore::ServiceWorkerContextData::decode):
2496         * workers/service/ServiceWorkerIdentifier.h: Copied from Source/WebCore/workers/service/ServiceWorkerContextData.cpp.
2497         * workers/service/ServiceWorkerRegistrationData.h:
2498         (WebCore::ServiceWorkerRegistrationData::decode):
2499         * workers/service/context/SWContextManager.cpp:
2500         (WebCore::SWContextManager::serviceWorkerThreadProxy const):
2501         (WebCore::SWContextManager::postMessageToServiceWorkerGlobalScope):
2502         * workers/service/context/SWContextManager.h:
2503         * workers/service/context/ServiceWorkerThread.cpp:
2504         (WebCore::ServiceWorkerThread::ServiceWorkerThread):
2505         * workers/service/context/ServiceWorkerThread.h:
2506         (WebCore::ServiceWorkerThread::identifier const):
2507         * workers/service/context/ServiceWorkerThreadProxy.h:
2508         * workers/service/server/SWClientConnection.cpp:
2509         (WebCore::SWClientConnection::postMessageToServiceWorkerClient):
2510         * workers/service/server/SWClientConnection.h:
2511         * workers/service/server/SWServer.cpp:
2512         (WebCore::generateServiceWorkerIdentifier):
2513         (WebCore::SWServer::Connection::scriptContextFailedToStart):
2514         (WebCore::SWServer::Connection::scriptContextStarted):
2515         (WebCore::SWServer::scriptContextFailedToStart):
2516         (WebCore::SWServer::scriptContextStarted):
2517         (WebCore::SWServer::updateWorker):
2518         * workers/service/server/SWServer.h:
2519         * workers/service/server/SWServerJobQueue.cpp:
2520         (WebCore::SWServerJobQueue::scriptContextFailedToStart):
2521         (WebCore::SWServerJobQueue::scriptContextStarted):
2522         * workers/service/server/SWServerJobQueue.h:
2523         * workers/service/server/SWServerRegistration.h:
2524         (WebCore::SWServerRegistration::setActiveServiceWorkerIdentifier):
2525         * workers/service/server/SWServerWorker.cpp:
2526         (WebCore::SWServerWorker::SWServerWorker):
2527         * workers/service/server/SWServerWorker.h:
2528         (WebCore::SWServerWorker::create):
2529         (WebCore::SWServerWorker::identifier const):
2530
2531 2017-11-02  Andy Estes  <aestes@apple.com>
2532
2533         [Payment Request] show() should only be called with user activation
2534         https://bugs.webkit.org/show_bug.cgi?id=179056
2535
2536         Reviewed by Sam Weinig.
2537
2538         Updated existing tests to call PaymentRequest.show() with user activation.
2539
2540         * Modules/paymentrequest/PaymentRequest.cpp:
2541         (WebCore::PaymentRequest::show):
2542
2543 2017-11-03  Daniel Bates  <dabates@apple.com>
2544
2545         Invalidate node list when associated form control element is removed
2546         https://bugs.webkit.org/show_bug.cgi?id=179232
2547         <rdar://problem/35308269>
2548
2549         Reviewed by Ryosuke Niwa.
2550
2551         A node list represents a live view of the DOM. Invalidate the node list
2552         associated with a form element whenever one of its associated form control
2553         elements is removed.
2554
2555         Test: fast/forms/node-list-remove-button-from-form.html
2556
2557         * html/HTMLFormElement.cpp:
2558         (WebCore::HTMLFormElement::removeFormElement):
2559
2560 2017-11-03  Frederic Wang  <fwang@igalia.com>
2561
2562         Add USE(APPLE_INTERNAL_SDK)-guards around SPI in ResourceHandle code
2563         https://bugs.webkit.org/show_bug.cgi?id=136107
2564
2565         Based on patch by Daniel Bates <dabates@apple.com>
2566         Reviewed by Darin Adler.
2567
2568         No new tests, behavior unchanged.
2569
2570         * platform/network/ResourceHandleClient.h: Replace includes of private headers with CFNetworkSPI.h.
2571         * platform/network/ResourceHandleInternal.h: Ditto.
2572         * platform/network/ios/ResourceHandleIOS.mm: Add USE(APPLE_INTERNAL_SDK)-guard around SPI
2573         headers and forward declare NSURLRequest SPI and constant _kCFStreamSSLTrustedLeafCertificates
2574         for clients that build without the internal SDK. Add BSD license block to file.
2575         (WebCore::ResourceHandle::createSSLPropertiesFromNSURLRequest): Fix code style issues; use
2576         nullptr instead of 0, use reinterpret_cast instead of C-style cast, remove unnecessary
2577         "using namespace WebCore"
2578         and rename variables to improve readability.
2579         * platform/network/mac/ResourceErrorMac.mm: Add USE(APPLE_INTERNAL_SDK)-guard around private
2580         headers and add typedef for CFCachedURLResponseRef for clients that build without the
2581         internal SDK.
2582
2583 2017-11-03  Antti Koivisto  <antti@apple.com>
2584
2585         Crash in WebCore::RenderStyle::overflowX with display:contents
2586         https://bugs.webkit.org/show_bug.cgi?id=178857
2587         <rdar://problem/35201120>
2588
2589         Reviewed by Zalan Bujtas.
2590
2591         Crash test by Renata Hodovan.
2592
2593         Tests: fast/css/display-contents-all.html
2594                fast/css/display-contents-document-element.html
2595
2596         * css/StyleResolver.cpp:
2597         (WebCore::adjustDisplayContentsStyle):
2598
2599         For document element 'display:contents' should adjust to 'display:block' like it does for other display types.
2600
2601 2017-11-03  Jiewen Tan  <jiewen_tan@apple.com>
2602
2603         Replace some auto* with RefPtr within WebCore/html
2604         https://bugs.webkit.org/show_bug.cgi?id=179218
2605         <rdar://problem/35102567>
2606
2607         Reviewed by Ryosuke Niwa.
2608
2609         No changes in behaviors.
2610
2611         In this patch, it replace some auto* pointers with RefPtrs. The way it achieves this goal is to wrap
2612         the RHS with makeRefPtr(). Also, some methods have been modified to return RefPtrs directly. Those
2613         include:
2614             HTMLInputElement::list,
2615             HTMLInputElement::dataList,
2616             HTMLLabelElement::control,
2617             HTMLLegendElement::associatedControl,
2618             HTMLSummaryElement::detailsElement,
2619             HTMLTableElement::tHead,
2620             HTMLTableElement::tFoot,
2621             HTMLTablePartElement::findParentTable,
2622             HTMLTableRowElement.cpp::findTable, local function
2623             RadioNodeList.cpp::toRadioButtonInputElement, local function
2624             CanvasStyle::canvasGradient,
2625             CanvasStyle::canvasPattern,
2626             WebGLRenderingContextBase::validateTextureBinding,
2627             GraphicsContext::strokeGradient,
2628             GraphicsContext::fillGradient.
2629
2630         * accessibility/AXObjectCache.cpp:
2631         (WebCore::AXObjectCache::labelChanged):
2632         * accessibility/AccessibilityRenderObject.cpp:
2633         (WebCore::AccessibilityRenderObject::correspondingControlForLabelElement const):
2634         * accessibility/AccessibilityTable.cpp:
2635         (WebCore::AccessibilityTable::addChildren):
2636         (WebCore::AccessibilityTable::title const):
2637         * accessibility/atk/WebKitAccessibleInterfaceTable.cpp:
2638         (webkitAccessibleTableGetCaption):
2639         * html/ColorInputType.cpp:
2640         (WebCore::ColorInputType::suggestions const):
2641         * html/FTPDirectoryDocument.cpp:
2642         (WebCore::FTPDirectoryDocumentParser::loadDocumentTemplate):
2643         * html/FileInputType.cpp:
2644         (WebCore::FileInputType::appendFormData const):
2645         (WebCore::FileInputType::disabledAttributeChanged):
2646         (WebCore::FileInputType::multipleAttributeChanged):
2647         * html/FormAssociatedElement.cpp:
2648         (WebCore::FormAssociatedElement::formOwnerRemovedFromTree):
2649         * html/HTMLBodyElement.cpp:
2650         (WebCore::HTMLBodyElement::insertedIntoAncestor):
2651         (WebCore::HTMLBodyElement::didFinishInsertingNode):
2652         (WebCore::HTMLBodyElement::scrollTo):
2653         * html/HTMLDetailsElement.cpp:
2654         (WebCore::HTMLDetailsElement::isActiveSummary const):
2655         (WebCore::HTMLDetailsElement::parseAttribute):
2656         * html/HTMLDocument.cpp:
2657         (WebCore::HTMLDocument::namedItem):
2658         * html/HTMLElement.cpp:
2659         (WebCore::HTMLElement::editabilityFromContentEditableAttr):
2660         * html/HTMLFormControlElement.cpp:
2661         (WebCore::HTMLFormControlElement::didAttachRenderers):
2662         * html/HTMLFrameOwnerElement.cpp:
2663         (WebCore:: const):
2664         * html/HTMLFrameSetElement.cpp:
2665         (WebCore::HTMLFrameSetElement::namedItem):
2666         * html/HTMLHtmlElement.cpp:
2667         (WebCore::HTMLHtmlElement::insertedByParser):
2668         * html/HTMLImageElement.cpp:
2669         (WebCore::HTMLImageElement::bestFitSourceFromPictureElement):
2670         * html/HTMLInputElement.cpp:
2671         (WebCore::HTMLInputElement::defaultEventHandler):
2672         (WebCore::HTMLInputElement::list const):
2673         (WebCore::HTMLInputElement::dataList const):
2674         (WebCore::HTMLInputElement::setupDateTimeChooserParameters):
2675         * html/HTMLInputElement.h:
2676         * html/HTMLLabelElement.cpp:
2677         (WebCore::firstElementWithIdIfLabelable):
2678         (WebCore::HTMLLabelElement::control const):
2679         (WebCore::HTMLLabelElement::form const):
2680         (WebCore::HTMLLabelElement::setActive):
2681         (WebCore::HTMLLabelElement::setHovered):
2682         (WebCore::HTMLLabelElement::willRespondToMouseClickEvents):
2683         (WebCore::HTMLLabelElement::focus):
2684         (WebCore::HTMLLabelElement::accessKeyAction):
2685         * html/HTMLLabelElement.h:
2686         * html/HTMLLegendElement.cpp:
2687         (WebCore::HTMLLegendElement::associatedControl):
2688         (WebCore::HTMLLegendElement::focus):
2689         (WebCore::HTMLLegendElement::accessKeyAction):
2690         (WebCore::HTMLLegendElement::form const):
2691         * html/HTMLLegendElement.h:
2692         * html/HTMLLinkElement.cpp:
2693         (WebCore::HTMLLinkElement::setCSSStyleSheet):
2694         (WebCore::HTMLLinkElement::addSubresourceAttributeURLs const):
2695         * html/HTMLMediaElement.cpp:
2696         (WebCore::needsAutoplayPlayPauseEventsQuirk):
2697         (WebCore::HTMLMediaElement::loadResource):
2698         (WebCore::HTMLMediaElement::updateActiveTextTrackCues):
2699         (WebCore::HTMLMediaElement::removeTextTrack):
2700         (WebCore::HTMLMediaElement::layoutSizeChanged):
2701         * html/HTMLObjectElement.cpp:
2702         (WebCore::shouldBeExposed):
2703         (WebCore::HTMLObjectElement::appendFormData):
2704         * html/HTMLOptGroupElement.cpp:
2705         (WebCore::HTMLOptGroupElement::recalcSelectOptions):
2706         * html/HTMLPictureElement.cpp:
2707         (WebCore::HTMLPictureElement::viewportChangeAffectedPicture const):
2708         * html/HTMLPlugInElement.cpp:
2709         (WebCore::HTMLPlugInElement::bindingsInstance):
2710         * html/HTMLPlugInImageElement.cpp:
2711         (WebCore::HTMLPlugInImageElement::isImageType):
2712         (WebCore::HTMLPlugInImageElement::willDetachRenderers):
2713         (WebCore::HTMLPlugInImageElement::partOfSnapshotOverlay const):
2714         (WebCore::HTMLPlugInImageElement::checkSizeChangeForSnapshotting):
2715         * html/HTMLSlotElement.cpp:
2716         (WebCore::HTMLSlotElement::attributeChanged):
2717         (WebCore:: const):
2718         * html/HTMLSourceElement.cpp:
2719         (WebCore::HTMLSourceElement::parseAttribute):
2720         * html/HTMLStyleElement.cpp:
2721         (WebCore::HTMLStyleElement::addSubresourceAttributeURLs const):
2722         * html/HTMLSummaryElement.cpp:
2723         (WebCore::HTMLSummaryElement::detailsElement const):
2724         * html/HTMLSummaryElement.h:
2725         * html/HTMLTableElement.cpp:
2726         (WebCore::HTMLTableElement::caption const):
2727         (WebCore::HTMLTableElement::tHead const):
2728         (WebCore::HTMLTableElement::tFoot const):
2729         (WebCore::HTMLTableElement::createTHead):
2730         (WebCore::HTMLTableElement::deleteTHead):
2731         (WebCore::HTMLTableElement::createTFoot):
2732         (WebCore::HTMLTableElement::deleteTFoot):
2733         (WebCore::HTMLTableElement::createCaption):
2734         (WebCore::HTMLTableElement::deleteCaption):
2735         * html/HTMLTableElement.h:
2736         * html/HTMLTablePartElement.cpp:
2737         (WebCore::HTMLTablePartElement::findParentTable const):
2738         * html/HTMLTablePartElement.h:
2739         * html/HTMLTableRowElement.cpp:
2740         (WebCore::findTable):
2741         (WebCore::HTMLTableRowElement::rowIndex const):
2742         (WebCore::findRows):
2743         * html/HTMLTableSectionElement.cpp:
2744         (WebCore::HTMLTableSectionElement::additionalPresentationAttributeStyle const):
2745         * html/HTMLTrackElement.cpp:
2746         (WebCore::HTMLTrackElement::mediaElement const):
2747         * html/LinkIconCollector.cpp:
2748         (WebCore::LinkIconCollector::iconsOfTypes):
2749         * html/MediaDocument.cpp:
2750         (WebCore::MediaDocumentParser::createDocumentStructure):
2751         (WebCore::MediaDocument::replaceMediaElementTimerFired):
2752         * html/MediaElementSession.cpp:
2753         (WebCore::needsArbitraryUserGestureAutoplayQuirk):
2754         (WebCore::isElementRectMostlyInMainFrame):
2755         (WebCore::isElementLargeRelativeToMainFrame):
2756         * html/PluginDocument.cpp:
2757         (WebCore::PluginDocumentParser::createDocumentStructure):
2758         (WebCore::PluginDocumentParser::appendBytes):
2759         * html/RadioNodeList.cpp:
2760         (WebCore::toRadioButtonInputElement):
2761         (WebCore::RadioNodeList::value const):
2762         (WebCore::RadioNodeList::setValue):
2763         * html/RangeInputType.cpp:
2764         (WebCore::RangeInputType::updateTickMarkValues):
2765         * html/canvas/CanvasRenderingContext.cpp:
2766         (WebCore::CanvasRenderingContext::wouldTaintOrigin):
2767         * html/canvas/CanvasRenderingContext2D.cpp:
2768         (WebCore::CanvasRenderingContext2D::setStrokeStyle):
2769         (WebCore::CanvasRenderingContext2D::setFillStyle):
2770         (WebCore::CanvasRenderingContext2D::fillInternal):
2771         (WebCore::CanvasRenderingContext2D::strokeInternal):
2772         (WebCore::CanvasRenderingContext2D::fillRect):
2773         (WebCore::CanvasRenderingContext2D::strokeRect):
2774         (WebCore::toStyle):
2775         (WebCore::CanvasRenderingContext2D::drawTextInternal):
2776         * html/canvas/CanvasStyle.h:
2777         (WebCore::CanvasStyle::canvasGradient const):
2778         (WebCore::CanvasStyle::canvasPattern const):
2779         * html/canvas/WebGL2RenderingContext.cpp:
2780         (WebCore::WebGL2RenderingContext::texStorage2D):
2781         (WebCore::WebGL2RenderingContext::getFramebufferAttachmentParameter):
2782         (WebCore::WebGL2RenderingContext::validateIndexArrayConservative):
2783         * html/canvas/WebGLBuffer.h:
2784         * html/canvas/WebGLRenderingContext.cpp:
2785         (WebCore::WebGLRenderingContext::getFramebufferAttachmentParameter):
2786         (WebCore::WebGLRenderingContext::validateIndexArrayConservative):
2787         * html/canvas/WebGLRenderingContextBase.cpp:
2788         (WebCore::WebGLRenderingContextBase::compressedTexImage2D):
2789         (WebCore::WebGLRenderingContextBase::compressedTexSubImage2D):
2790         (WebCore::WebGLRenderingContextBase::copyTexSubImage2D):
2791         (WebCore::WebGLRenderingContextBase::generateMipmap):
2792         (WebCore::WebGLRenderingContextBase::getTexParameter):
2793         (WebCore::WebGLRenderingContextBase::texImage2DBase):
2794         (WebCore::WebGLRenderingContextBase::validateTexFunc):
2795         (WebCore::WebGLRenderingContextBase::texSubImage2D):
2796         (WebCore::WebGLRenderingContextBase::texSubImage2DBase):
2797         (WebCore::WebGLRenderingContextBase::copyTexImage2D):
2798         (WebCore::WebGLRenderingContextBase::texImage2D):
2799         (WebCore::WebGLRenderingContextBase::texParameter):
2800         (WebCore::WebGLRenderingContextBase::validateTextureBinding):
2801         * html/canvas/WebGLRenderingContextBase.h:
2802         * html/parser/HTMLConstructionSite.cpp:
2803         (WebCore::executeReparentTask):
2804         (WebCore::executeTakeAllChildrenAndReparentTask):
2805         (WebCore::HTMLConstructionSite::dispatchDocumentElementAvailableIfNeeded):
2806         (WebCore::HTMLConstructionSite::createHTMLElementOrFindCustomElementInterface):
2807         (WebCore::HTMLConstructionSite::findFosterSite):
2808         * html/parser/HTMLPreloadScanner.cpp:
2809         (WebCore::TokenPreloadScanner::StartTagScanner::processAttribute):
2810         * html/parser/XSSAuditorDelegate.cpp:
2811         (WebCore::XSSAuditorDelegate::generateViolationReport):
2812         * html/shadow/TextControlInnerElements.cpp:
2813         (WebCore::SearchFieldResultsButtonElement::defaultEventHandler):
2814         * html/track/InbandGenericTextTrack.cpp:
2815         (WebCore::InbandGenericTextTrack::updateGenericCue):
2816         (WebCore::InbandGenericTextTrack::removeGenericCue):
2817         * html/track/InbandTextTrack.cpp:
2818         (WebCore::InbandTextTrack::willRemove):
2819         * html/track/TextTrack.cpp:
2820         (WebCore::TextTrack::addCue):
2821         (WebCore::TextTrack::addRegion):
2822         * html/track/VideoTrack.cpp:
2823         (WebCore::VideoTrack::willRemove):
2824         * inspector/InspectorCanvas.cpp:
2825         (WebCore::InspectorCanvas::buildInitialState):
2826         * platform/graphics/GraphicsContext.h:
2827         (WebCore::GraphicsContext::strokeGradient const):
2828         (WebCore::GraphicsContext::fillGradient const):
2829         * rendering/svg/RenderSVGPath.cpp:
2830         (WebCore::useStrokeStyleToFill):
2831
2832 2017-11-03  Devin Rousso  <webkit@devinrousso.com>
2833
2834         Web Inspector: Canvas2D Profiling: highlight expensive context commands in the captured command log
2835         https://bugs.webkit.org/show_bug.cgi?id=178302
2836         <rdar://problem/33158849>
2837
2838         Reviewed by Brian Burg.
2839
2840         No new tests, updated existing tests.
2841
2842         * inspector/InspectorCanvas.h:
2843         * inspector/InspectorCanvas.cpp:
2844         (WebCore::InspectorCanvas::recordAction):
2845         (WebCore::InspectorCanvas::finalizeFrame):
2846         (WebCore::InspectorCanvas::markNewFrame): Deleted.
2847
2848         * inspector/InspectorCanvasAgent.cpp:
2849         (WebCore::InspectorCanvasAgent::didFinishRecordingCanvasFrame):
2850
2851 2017-11-02  Maciej Stachowiak  <mjs@apple.com>
2852
2853         Don't try to guess plugin MIME type from a file extension in a URL (no observable effect)
2854         https://bugs.webkit.org/show_bug.cgi?id=178333
2855
2856         Reviewed by Darin Adler.
2857
2858         No test cases because I could not find an observable behavior difference,
2859         even after trying many different plugin loading scenarios.
2860         
2861         * html/HTMLPlugInImageElement.cpp:
2862         (WebCore::HTMLPlugInImageElement::didAddUserAgentShadowRoot): loadedMIMEType --> serviceType
2863         (WebCore::HTMLPlugInImageElement::restartSimilarPlugIns): ditto
2864         (WebCore::HTMLPlugInImageElement::userDidClickSnapshot): ditto
2865         (WebCore::HTMLPlugInImageElement::subframeLoaderWillCreatePlugIn): ditto
2866         * html/HTMLPlugInImageElement.h:
2867         (WebCore::HTMLPlugInImageElement::loadedMimeType const): Deleted. This was the one call site
2868         for mimeTypeFromURL, and is otherwise just a wrapper for SerciceType()
2869         * platform/URL.cpp:
2870         (WebCore::mimeTypeFromURL): Deleted. This was the only use of MIMETypeDatabase in URL.
2871         * platform/URL.h: Removed declaration for mimeTypeFromURL.
2872         * WebCore.order: Removed mimeTypeFromURL.
2873
2874 2017-11-02  Basuke Suzuki  <Basuke.Suzuki@sony.com>
2875
2876         [Curl] Fix cancellation process implementation
2877         https://bugs.webkit.org/show_bug.cgi?id=179199
2878
2879         Reviewed by Alex Christensen.
2880
2881         * platform/network/curl/CurlRequest.cpp:
2882         (WebCore::CurlRequest::cancel):
2883         (WebCore::CurlRequest::willSendData):
2884         (WebCore::CurlRequest::didReceiveHeader):
2885         (WebCore::CurlRequest::didReceiveData):
2886         (WebCore::CurlRequest::completeDidReceiveResponse):
2887         (WebCore::CurlRequest::pausedStatusChanged):
2888         * platform/network/curl/CurlRequest.h:
2889         (WebCore::CurlRequest::isSyncRequest const):
2890         (WebCore::CurlRequest::isCompletedOrCancelled const):
2891         (WebCore::CurlRequest::needToInvokeDidCancelTransfer const):
2892         (WebCore::CurlRequest::isSyncRequest): Deleted.
2893
2894 2017-11-02  Brady Eidson  <beidson@apple.com>
2895
2896         SW: Implement "Update Registration State" algorithm (unused for now)
2897         https://bugs.webkit.org/show_bug.cgi?id=179186
2898
2899         Reviewed by Chris Dumez.
2900
2901         No new tests (No behavior change yet).
2902
2903         This algorithm is very simple, and this patch plumbs it through.
2904         But it's not useful to start using this algorithm without "Update Worker State" also.
2905         So to keep this patch small, it's unused for now. Will be used in the next patch.
2906
2907         * WebCore.xcodeproj/project.pbxproj:
2908
2909         * workers/service/ServiceWorkerContainer.cpp:
2910         (WebCore::ServiceWorkerContainer::jobResolvedWithRegistration):
2911
2912         * workers/service/ServiceWorkerRegistration.cpp:
2913         (WebCore::ServiceWorkerRegistration::ServiceWorkerRegistration):
2914         (WebCore::ServiceWorkerRegistration::~ServiceWorkerRegistration):
2915         (WebCore::ServiceWorkerRegistration::updateStateFromServer):
2916         * workers/service/ServiceWorkerRegistration.h:
2917
2918         * workers/service/ServiceWorkerTypes.h: Copied from Source/WebCore/workers/service/server/SWServerRegistration.cpp.
2919
2920         * workers/service/server/SWClientConnection.cpp:
2921         (WebCore::SWClientConnection::addServiceWorkerRegistration):
2922         (WebCore::SWClientConnection::removeServiceWorkerRegistration):
2923         (WebCore::SWClientConnection::updateRegistrationState):
2924         * workers/service/server/SWClientConnection.h:
2925
2926         * workers/service/server/SWServer.cpp:
2927         (WebCore::SWServer::Connection::addServiceWorkerRegistrationInServer):
2928         (WebCore::SWServer::Connection::removeServiceWorkerRegistrationInServer):
2929         (WebCore::SWServer::addClientServiceWorkerRegistration):
2930         (WebCore::SWServer::removeClientServiceWorkerRegistration):
2931         * workers/service/server/SWServer.h:
2932         (WebCore::SWServer::getConnection):
2933
2934         * workers/service/server/SWServerJobQueue.cpp:
2935         (WebCore::SWServerJobQueue::runRegisterJob):
2936
2937         * workers/service/server/SWServerRegistration.cpp:
2938         (WebCore::SWServerRegistration::SWServerRegistration):
2939         (WebCore::SWServerRegistration::updateRegistrationState):
2940         (WebCore::SWServerRegistration::addClientServiceWorkerRegistration):
2941         (WebCore::SWServerRegistration::removeClientServiceWorkerRegistration):
2942         * workers/service/server/SWServerRegistration.h:
2943
2944 2017-11-01  Ryosuke Niwa  <rniwa@webkit.org>
2945
2946         Assert that updateStyle and updateLayout are only called when it's safe to dispatch events
2947         https://bugs.webkit.org/show_bug.cgi?id=179157
2948         <rdar://problem/35144778>
2949
2950         Reviewed by Zalan Bujtas.
2951
2952         Added assertions to Document::updateStyleIfNeeded and Document::updateLayout that these functions are
2953         only called when NoEventDispatchAssertion::isEventAllowedInMainThread() is true with two exceptions:
2954         1. Inside SVGImage::draw which triggers a layout on a separate document.
2955         2. While doing a nested layout for a frame flattening.
2956
2957         No new tests since there should be no behavioral changes.
2958
2959         * dom/ContainerNode.cpp:
2960         (NoEventDispatchAssertion::DisableAssertionsInScope::s_existingCount): Deleted. This is now an instance
2961         variable of DisableAssertionsInScope.
2962         (ContainerNode::removeNodeWithScriptAssertion): Moved childrenChanged out of the scope since it could
2963         invoke respondToChangedSelection via HTMLTextAreaElement::childrenChanged.
2964         * dom/Document.cpp:
2965         (WebCore::Document::updateStyleIfNeeded): Added the assertion. Allow updateWidgetPositions() to call
2966         this function but exit early when checking needsStyleRecalc().
2967         (WebCore::Document::updateLayout): Added the assertion.
2968         * dom/NoEventDispatchAssertion.h:
2969         (WebCore::NoEventDispatchAssertion::DisableAssertionsInScope::DisableAssertionsInScope): Made this class
2970         store the original value of s_count as an instance variable to support re-entrancy.
2971         (WebCore::NoEventDispatchAssertion::DisableAssertionsInScope::~DisableAssertionsInScope): Ditto.
2972         * page/LayoutContext.cpp:
2973         (WebCore::LayoutContext::runOrScheduleAsynchronousTasks): Temporarily disable the assertion. This is safe
2974         since SVGImage has its own document.
2975         * svg/SVGSVGElement.cpp:
2976         (WebCore::checkIntersectionWithoutUpdatingLayout): Extracted out of SVGSVGElement::checkIntersection.
2977         (WebCore::checkEnclosureWithoutUpdatingLayout): Extracted out of SVGSVGElement::checkEnclosure.
2978         (WebCore::SVGSVGElement::getIntersectionList): Use checkIntersectionWithoutUpdatingLayout to avoid
2979         calling updateLayoutIgnorePendingStylesheets while iterating over elements.
2980         (WebCore::SVGSVGElement::getEnclosureList): Ditto.
2981         (WebCore::SVGSVGElement::checkIntersection):
2982         (WebCore::SVGSVGElement::checkEnclosure):
2983         * svg/graphics/SVGImage.cpp:
2984         (WebCore::SVGImage::draw): Temporarily disable the assertion. This is safe as SVGImage has its own page.
2985
2986 2017-11-02  Alex Christensen  <achristensen@webkit.org>
2987
2988         Fix Windows debug build after r224371
2989
2990         * platform/graphics/win/DIBPixelData.h:
2991
2992 2017-11-02  Alex Christensen  <achristensen@webkit.org>
2993
2994         Use CompletionHandlers for redirects
2995         https://bugs.webkit.org/show_bug.cgi?id=179163
2996
2997         Reviewed by Tim Horton.
2998
2999         Having functions sometimes have to remember to call client->continueWillSendRequest is fragile.
3000         CompletionHandler asserts if it's not called once before destruction, and that's what we need here.
3001         This will prevent future bugs, and make ResourceHandle look more like NetworkDataTask.
3002
3003         No change in behavior.
3004
3005         * loader/NetscapePlugInStreamLoader.cpp:
3006         (WebCore::NetscapePlugInStreamLoader::willSendRequest):
3007         * loader/NetscapePlugInStreamLoader.h:
3008         * loader/ResourceLoader.cpp:
3009         (WebCore::ResourceLoader::willSendRequest):
3010         (WebCore::ResourceLoader::willSendRequestAsync):
3011         * loader/ResourceLoader.h:
3012         * loader/appcache/ApplicationCacheGroup.cpp:
3013         (WebCore::ApplicationCacheGroup::willSendRequestAsync):
3014         * loader/appcache/ApplicationCacheGroup.h:
3015         * platform/network/BlobResourceHandle.cpp:
3016         * platform/network/PingHandle.h:
3017         * platform/network/ResourceHandle.h:
3018         * platform/network/ResourceHandleClient.h:
3019         * platform/network/SynchronousLoaderClient.cpp:
3020         (WebCore::SynchronousLoaderClient::willSendRequestAsync):
3021         * platform/network/SynchronousLoaderClient.h:
3022         * platform/network/cf/ResourceHandleCFNet.cpp:
3023         (WebCore::ResourceHandle::willSendRequest):
3024         (WebCore::ResourceHandle::continueWillSendRequest): Deleted.
3025         * platform/network/cf/ResourceHandleCFURLConnectionDelegate.h:
3026         * platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.cpp:
3027         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::willSendRequest):
3028         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::continueWillSendRequest): Deleted.
3029         * platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.h:
3030         * platform/network/curl/ResourceHandleCurlDelegate.cpp:
3031         (WebCore::ResourceHandleCurlDelegate::willSendRequest):
3032         * platform/network/mac/ResourceHandleMac.mm:
3033         (WebCore::ResourceHandle::willSendRequest):
3034         (WebCore::ResourceHandle::continueWillSendRequest): Deleted.
3035         * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.h:
3036         * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm:
3037         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:willSendRequest:redirectResponse:]):
3038         (-[WebCoreResourceHandleAsOperationQueueDelegate continueWillSendRequest:]): Deleted.
3039         * platform/network/soup/ResourceHandleSoup.cpp:
3040         (WebCore::doRedirect):
3041         (WebCore::ResourceHandle::continueWillSendRequest): Deleted.
3042
3043 2017-11-02  Christopher Reid  <chris.reid@sony.com>
3044
3045         Add a FileSystem namespace to FileSystem.cpp
3046         https://bugs.webkit.org/show_bug.cgi?id=179063
3047
3048         Reviewed by Darin Adler.
3049
3050         No new tests, no change in behavior.
3051
3052         Adding a FileSystem namespace so its functions aren't global in WebCore.
3053
3054         * Modules/encryptedmedia/legacy/WebKitMediaKeySession.cpp:
3055         * Modules/entriesapi/DOMFileSystem.cpp:
3056         * Modules/entriesapi/FileSystemEntry.cpp:
3057         * Modules/indexeddb/IDBDatabaseIdentifier.cpp:
3058         * Modules/indexeddb/server/IDBServer.cpp:
3059         * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
3060         * Modules/indexeddb/server/SQLiteIDBTransaction.cpp:
3061         * Modules/indexeddb/shared/InProcessIDBServer.cpp:
3062         * Modules/webdatabase/DatabaseTracker.cpp:
3063         * Modules/webdatabase/OriginLock.cpp:
3064         * Modules/webdatabase/OriginLock.h:
3065         * fileapi/File.cpp:
3066         * fileapi/FileCocoa.mm:
3067         * html/FileListCreator.cpp:
3068         * html/HTMLMediaElement.cpp:
3069         * loader/appcache/ApplicationCacheStorage.cpp:
3070         * page/Page.cpp:
3071         * page/SecurityOrigin.cpp:
3072         * page/SecurityOriginData.cpp:
3073         * platform/FileHandle.cpp:
3074         * platform/FileHandle.h:
3075         * platform/FileStream.cpp:
3076         * platform/FileStream.h:
3077         * platform/FileSystem.cpp: Added FileSystem namespace
3078         * platform/FileSystem.h: Added FileSystem namespace
3079         * platform/SharedBuffer.cpp:
3080         * platform/SharedBuffer.h:
3081         * platform/cf/FileSystemCF.cpp: Added FileSystem namespace
3082         * platform/cocoa/FileMonitorCocoa.mm:
3083         * platform/cocoa/FileSystemCocoa.mm: Added FileSystem namespace
3084         * platform/glib/FileMonitorGLib.cpp:
3085         * platform/glib/FileSystemGlib.cpp: Added FileSystem namespace
3086         * platform/glib/SharedBufferGlib.cpp:
3087         * platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.mm:
3088         * platform/graphics/avfoundation/objc/CDMSessionMediaSourceAVFObjC.mm:
3089         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
3090         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
3091         * platform/graphics/win/DIBPixelData.h:
3092         * platform/ios/QuickLook.mm:
3093         * platform/ios/WebItemProviderPasteboard.mm:
3094         * platform/mac/FileSystemMac.mm: Added FileSystem namespace
3095         * platform/network/BlobDataFileReference.cpp:
3096         * platform/network/BlobRegistryImpl.cpp:
3097         * platform/network/FormData.cpp:
3098         * platform/network/cf/FormDataStreamCFNet.cpp:
3099         * platform/network/cocoa/ResourceRequestCocoa.mm:
3100         * platform/network/curl/CurlCacheEntry.cpp:
3101         * platform/network/curl/CurlCacheEntry.h:
3102         * platform/network/curl/CurlCacheManager.cpp:
3103         * platform/network/curl/CurlDownload.cpp:
3104         * platform/network/curl/CurlRequest.cpp:
3105         * platform/network/curl/CurlRequest.h:
3106         * platform/network/curl/ResourceHandleCurl.cpp:
3107         * platform/network/mac/BlobDataFileReferenceMac.mm:
3108         * platform/network/soup/ResourceRequestSoup.cpp:
3109         * platform/network/soup/SoupNetworkSession.cpp:
3110         * platform/posix/FileSystemPOSIX.cpp: Added FileSystem namespace
3111         * platform/posix/SharedBufferPOSIX.cpp:
3112         * platform/sql/SQLiteFileSystem.cpp:
3113         * platform/text/hyphen/HyphenationLibHyphen.cpp:
3114         * platform/win/FileSystemWin.cpp: Added FileSystem namespace
3115         * rendering/RenderThemeGtk.cpp:
3116         * rendering/RenderThemeWin.cpp:
3117
3118 2017-11-02  Devin Rousso  <webkit@devinrousso.com>
3119
3120         Web Inspector: Canvas Tab: show supported GL extensions for selected canvas
3121         https://bugs.webkit.org/show_bug.cgi?id=179070
3122         <rdar://problem/35278276>
3123
3124         Reviewed by Brian Burg.
3125
3126         Test: inspector/canvas/extensions.html
3127
3128         * html/canvas/WebGL2RenderingContext.cpp:
3129         (WebCore::WebGL2RenderingContext::getExtension):
3130         * html/canvas/WebGLRenderingContext.cpp:
3131         (WebCore::WebGLRenderingContext::getExtension):
3132         Rework common logic into a macro for readability and to simplify adding calls to
3133         InspectorInstrumentation functions.
3134
3135         * html/canvas/WebGLRenderingContextBase.h:
3136         * html/canvas/WebGLRenderingContextBase.cpp:
3137         (WebCore::WebGLRenderingContextBase::extensionIsEnabled):
3138
3139         * inspector/InspectorCanvasAgent.h:
3140         * inspector/InspectorCanvasAgent.cpp:
3141         (WebCore::InspectorCanvasAgent::enable):
3142         (WebCore::InspectorCanvasAgent::didEnableExtension):
3143
3144         * inspector/InspectorInstrumentation.h:
3145         (WebCore::InspectorInstrumentation::didEnableExtension):
3146         * inspector/InspectorInstrumentation.cpp:
3147         (WebCore::InspectorInstrumentation::didEnableExtensionImpl):
3148
3149 2017-11-02  Youenn Fablet  <youenn@apple.com>
3150
3151         Do not check for CORS in case response is coming from a service worker
3152         https://bugs.webkit.org/show_bug.cgi?id=179177
3153
3154         Reviewed by Chris Dumez.
3155
3156         Test: http/tests/workers/service/cors-image-fetch.html
3157
3158         As per fetch spec, CORS check (https://fetch.spec.whatwg.org/#cors-check) is done
3159         within HTTP fetch (https://fetch.spec.whatwg.org/#http-fetch).
3160         It does not apply to fetches handled by service workers.
3161
3162         * loader/SubresourceLoader.cpp:
3163         (WebCore::SubresourceLoader::checkResponseCrossOriginAccessControl):
3164
3165 2017-11-02  Joseph Pecoraro  <pecoraro@apple.com>
3166
3167         Make ServiceWorker a Remote Inspector debuggable target
3168         https://bugs.webkit.org/show_bug.cgi?id=179043
3169         <rdar://problem/34126008>
3170
3171         Reviewed by Brian Burg.
3172
3173         * Sources.txt:
3174         * WebCore.xcodeproj/project.pbxproj:
3175         New files.
3176
3177         * workers/service/context/ServiceWorkerDebuggable.h: Added.
3178         * workers/service/context/ServiceWorkerDebuggable.cpp: Added.
3179         (WebCore::ServiceWorkerDebuggable::ServiceWorkerDebuggable):
3180         (WebCore::ServiceWorkerDebuggable::connect):
3181         (WebCore::ServiceWorkerDebuggable::disconnect):
3182         (WebCore::ServiceWorkerDebuggable::dispatchMessageFromRemote):
3183         ServiceWorker remote inspector target, exposes the script url to debuggers.
3184         Pass the channel on to the inspector proxy to hook it up to the worker.
3185
3186         * workers/service/context/ServiceWorkerInspectorProxy.h:
3187         * workers/service/context/ServiceWorkerInspectorProxy.cpp: Added.
3188         (WebCore::ServiceWorkerInspectorProxy::ServiceWorkerInspectorProxy):
3189         (WebCore::ServiceWorkerInspectorProxy::~ServiceWorkerInspectorProxy):
3190         (WebCore::ServiceWorkerInspectorProxy::serviceWorkerTerminated):
3191         Handle interesting events throughout a Service Worker life cycle.
3192
3193         (WebCore::ServiceWorkerInspectorProxy::connectToWorker):
3194         (WebCore::ServiceWorkerInspectorProxy::disconnectFromWorker):
3195         (WebCore::ServiceWorkerInspectorProxy::sendMessageToWorker):
3196         (WebCore::ServiceWorkerInspectorProxy::sendMessageFromWorkerToFrontend):
3197         Implement existing worker debugger hooks for connection setup and sending messages.
3198         Inspector protocol messages come in on the MainThread and hop over to the
3199         WorkerThread to be handled on the expected context thread. Likewise outgoing
3200         messages hop back to be sent through the InspectorFrontend channel on MainThread.
3201
3202         * workers/service/context/ServiceWorkerThread.cpp:
3203         (WebCore::ServiceWorkerThread::ServiceWorkerThread):
3204         * workers/service/context/ServiceWorkerThread.h:
3205         * workers/service/context/ServiceWorkerThreadProxy.h:
3206         * workers/service/context/ServiceWorkerThreadProxy.cpp:
3207         (WebCore::ServiceWorkerThreadProxy::ServiceWorkerThreadProxy):
3208         (WebCore::ServiceWorkerThreadProxy::postMessageToDebugger):
3209         Construct the new inspector proxy and debuggable registration.
3210         Call lifecycle events and debugger hooks when appropriate.
3211
3212 2017-11-02  Antti Koivisto  <antti@apple.com>
3213
3214         display:contents should work with dynamic table mutations
3215         https://bugs.webkit.org/show_bug.cgi?id=179179
3216
3217         Reviewed by Ryosuke Niwa.
3218
3219         * rendering/RenderBlock.cpp:
3220         (WebCore::RenderBlock::addChildIgnoringContinuation):
3221
3222             RenderText with inline text wrapper as beforeChild is now resolved in RenderTreePosition, covering all cases.
3223             Verify this with assert.
3224
3225         * rendering/RenderElement.cpp:
3226         (WebCore::RenderElement::insertChildInternal):
3227
3228             Add assertion.
3229
3230         * rendering/RenderTableSection.cpp:
3231         (WebCore::RenderTableSection::addChild):
3232
3233             Fix cases where we did unchecked downcasts for anonymous beforeChild.
3234
3235         * style/RenderTreePosition.cpp:
3236         (WebCore::RenderTreePosition::insert):
3237
3238             When inserting before a text rendeder with an display:contents inline wrapper, use the wrapper as beforeChild.
3239
3240         * style/RenderTreePosition.h:
3241         (WebCore::RenderTreePosition::insert): Deleted.
3242         * style/RenderTreeUpdater.cpp:
3243         (WebCore::RenderTreeUpdater::updateRenderTree):
3244         (WebCore::RenderTreeUpdater::renderingParent):
3245
3246             Add separate helper to get parent frame for the closest rendered (non display:contents) ancestor.
3247
3248         (WebCore::RenderTreeUpdater::renderTreePosition):
3249         (WebCore::RenderTreeUpdater::updateElementRenderer):
3250         (WebCore::RenderTreeUpdater::textRendererIsNeeded):
3251         (WebCore::RenderTreeUpdater::updateTextRenderer):
3252         (WebCore::RenderTreeUpdater::storePreviousRenderer):
3253
3254             Use it for tracking state related to render tree siblings. With this we compute whitespace nodes
3255             correctly for display:contents. The test cases end up depending on that.
3256
3257         * style/RenderTreeUpdater.h:
3258
3259 2017-11-02  Tim Horton  <timothy_horton@apple.com>
3260
3261         Bump the size of SameAsRenderElement after r224324
3262
3263         * rendering/RenderElement.cpp:
3264         RenderElement uses one more bit in the bitfield now.
3265
3266 2017-11-02  Ryan Haddad  <ryanhaddad@apple.com>
3267
3268         Unreviewed, rolling out r224353.
3269
3270         Breaks internal builds.
3271
3272         Reverted changeset:
3273
3274         "Ignore HSTS for partitioned, cross-origin subresource
3275         requests"
3276         https://bugs.webkit.org/show_bug.cgi?id=178993
3277         https://trac.webkit.org/changeset/224353
3278
3279 2017-11-02  Joseph Pecoraro  <pecoraro@apple.com>
3280
3281         Inspector should display service worker served responses properly
3282         https://bugs.webkit.org/show_bug.cgi?id=178597
3283         <rdar://problem/35186111>
3284
3285         Reviewed by Brian Burg.
3286
3287         Test: http/tests/inspector/network/resource-response-service-worker.html
3288
3289         * inspector/InspectorNetworkAgent.cpp:
3290         (WebCore::responseSource):
3291         Use the new protocol enum.
3292
3293 2017-11-02  Ryosuke Niwa  <rniwa@webkit.org>
3294
3295         Eliminate isMainThread() checks in most call sites of NoEventDispatchAssertion
3296         https://bugs.webkit.org/show_bug.cgi?id=179161
3297
3298         Reviewed by Zalan Bujtas.
3299
3300         Introduced NoEventDispatchAssertion::InMainThread which bypasses the expensive isMainThread() check
3301         in order to turn NoEventDispatchAssertion into a release assertion in a separate patch.
3302
3303         Also removed instances of NoEventDispatchAssertion in notifyChildNodeInserted and notifyChildNodeRemoved
3304         and asserted that the caller has instantiated NoEventDispatchAssertion instead.
3305
3306         No new tests since there should be no behavioral changes.
3307
3308         * bindings/js/ScriptController.cpp:
3309         (WebCore::ScriptController::canExecuteScripts):
3310         * dom/Attr.cpp:
3311         * dom/CharacterData.cpp:
3312         * dom/ContainerNode.cpp:
3313         (WebCore::ContainerNode::removeAllChildrenWithScriptAssertion):
3314         (WebCore::ContainerNode::removeNodeWithScriptAssertion):
3315         (WebCore::executeNodeInsertionWithScriptAssertion):
3316         (WebCore::ContainerNode::removeDetachedChildren): Instantiated NoEventDispatchAssertion::InMainThread
3317         so that notifyChildNodeRemoved would be called inside NoEventDispatchAssertion. 
3318         (WebCore::ContainerNode::insertBeforeCommon):
3319         (WebCore::ContainerNode::appendChildCommon):
3320         (WebCore::ContainerNode::removeBetween):
3321         (WebCore::dispatchChildInsertionEvents):
3322         (WebCore::dispatchChildRemovalEvents):
3323         * dom/ContainerNodeAlgorithms.cpp:
3324         (WebCore::notifyChildNodeInserted): Assert that the caller has instantiated NoEventDispatchAssertion.
3325         (WebCore::notifyChildNodeRemoved): Ditto.
3326         * dom/Document.cpp:
3327         (WebCore::Document::resolveStyle):
3328         (WebCore::Document::updateStyleIfNeeded):
3329         (WebCore::Document::nodeChildrenWillBeRemoved):
3330         (WebCore::Document::nodeWillBeRemoved):
3331         (WebCore::Document::dispatchWindowEvent): Replaced RELEASE_ASSERT with ASSERT_WITH_SECURITY_IMPLICATION
3332         for clarity since NoEventDispatchAssertion::isEventAllowedInMainThread() always returns true in release
3333         builds right now.
3334         (WebCore::Document::dispatchWindowLoadEvent): Ditto.
3335         (WebCore::Document::applyPendingXSLTransformsTimerFired): Use ASSERT_WITH_SECURITY_IMPLICATION instead
3336         of regular ASSERT.
3337         * dom/Element.cpp:
3338         (WebCore::Element::addShadowRoot): Instantiate NoEventDispatchAssertion::InMainThread to call
3339         notifyChildNodeInserted will it.
3340         (WebCore::Element::attachAttributeNodeIfNeeded):
3341         (WebCore::Element::setAttributeNode): Fixed the indentation.
3342         (WebCore::Element::setAttributeNodeNS): Ditto.
3343         (WebCore::Element::dispatchFocusInEvent):
3344         (WebCore::Element::dispatchFocusOutEvent):
3345         * dom/EventDispatcher.cpp:
3346         (WebCore::EventDispatcher::dispatchEvent):
3347         * dom/NoEventDispatchAssertion.h:
3348         (WebCore::NoEventDispatchAssertion::isEventDispatchAllowedInSubtree): Moved to InMainThread.
3349         (WebCore::NoEventDispatchAssertion::InMainThread): Added.
3350         (WebCore::NoEventDispatchAssertion::InMainThread::InMainThread): Assert that we're in the main thread
3351         instead of exiting early.
3352         (WebCore::NoEventDispatchAssertion::InMainThread::~InMainThread): Ditto.
3353         (WebCore::NoEventDispatchAssertion::InMainThread::isEventDispatchAllowedInSubtree): Moved here.
3354         (WebCore::NoEventDispatchAssertion::InMainThread::isEventAllowed):
3355         * dom/Node.cpp:
3356         (WebCore::Node::dispatchSubtreeModifiedEvent):
3357         (WebCore::Node::dispatchDOMActivateEvent):
3358         * dom/ScriptExecutionContext.cpp:
3359         (WebCore::ScriptExecutionContext::canSuspendActiveDOMObjectsForDocumentSuspension):
3360         (WebCore::ScriptExecutionContext::suspendActiveDOMObjects):
3361         (WebCore::ScriptExecutionContext::resumeActiveDOMObjects):
3362         * history/CachedPage.cpp:
3363         (WebCore::CachedPage::restore):
3364         * history/PageCache.cpp:
3365         (WebCore::PageCache::addIfCacheable):
3366         * page/LayoutContext.cpp:
3367         (WebCore::LayoutContext::layout):
3368         * rendering/RenderLayer.cpp:
3369         (WebCore::RenderLayer::scrollRectToVisible):
3370
3371 2017-11-02  John Wilander  <wilander@apple.com>
3372
3373         Ignore HSTS for partitioned, cross-origin subresource requests
3374         https://bugs.webkit.org/show_bug.cgi?id=178993
3375         <rdar://problem/34962462>
3376