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