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