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