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