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