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