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