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