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