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