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