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