0d827fac8dbbf14ea5bd9e66be6872930851cb11
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2017-11-02  Antti Koivisto  <antti@apple.com>
2
3         Remove empty continuations in RenderObject::removeFromParentAndDestroyCleaningUpAnonymousWrappers
4         https://bugs.webkit.org/show_bug.cgi?id=179014
5
6         Remove overly optimistic non-critical assertion that is hit on WK1 debug.
7
8         * rendering/RenderBoxModelObject.cpp:
9         (WebCore::RenderBoxModelObject::removeAndDestroyAllContinuations):
10
11 2017-11-02  Frederic Wang  <fwang@igalia.com>
12
13         Add references to bug 179167 in FIXME comments
14         https://bugs.webkit.org/show_bug.cgi?id=179168
15
16         Reviewed by Daniel Bates.
17
18         * Configurations/FeatureDefines.xcconfig:
19
20 2017-11-02  Antti Koivisto  <antti@apple.com>
21
22         Remove empty continuations in RenderObject::removeFromParentAndDestroyCleaningUpAnonymousWrappers
23         https://bugs.webkit.org/show_bug.cgi?id=179014
24
25         Reviewed by Geoff Garen.
26
27         Treat continuation similarly to other anonymous wrappers. This makes things more understandable
28         and allows removal of some questionable code in RenderBlock::takeChild.
29
30         The patch also makes continuation chain a double linked so we can efficiently remove single
31         continuations from the chain. It also gets rid of algorithms that recurse in continuation chain.
32
33         * accessibility/AccessibilityRenderObject.cpp:
34         (WebCore::firstChildInContinuation):
35         * rendering/RenderBlock.cpp:
36         (WebCore::RenderBlock::styleDidChange):
37
38             Don't add and remove continuations from the chain when updating style. Prevent recursion by walking
39             the chain only in the (non-continuation) head renderer.
40
41         (WebCore::RenderBlock::dropAnonymousBoxChild):
42
43             Make a member function.
44
45         (WebCore::RenderBlock::takeChild):
46
47             Remove code that destroyed empty continuations and caused the parent to destroy itself.
48             Empty continuations are now removed by RenderObject::removeFromParentAndDestroyCleaningUpAnonymousWrappers.
49
50         * rendering/RenderBlock.h:
51         * rendering/RenderBoxModelObject.cpp:
52         (WebCore::RenderBoxModelObject::ContinuationChainNode::ContinuationChainNode):
53         (WebCore::RenderBoxModelObject::ContinuationChainNode::~ContinuationChainNode):
54         (WebCore::RenderBoxModelObject::ContinuationChainNode::insertAfter):
55
56             Track continuations with double linked lists.
57
58         (WebCore::continuationChainNodeMap):
59         (WebCore::RenderBoxModelObject::willBeDestroyed):
60
61             Don't recurse to destroy continuation chain. 
62             Destroy all continuations iteratively if this is the head of the chain.
63             When destroying a continuation renderer simply remove it from the chain.
64
65         (WebCore::RenderBoxModelObject::continuation const):
66         (WebCore::RenderBoxModelObject::insertIntoContinuationChainAfter):
67         (WebCore::RenderBoxModelObject::removeFromContinuationChain):
68         (WebCore::RenderBoxModelObject::ensureContinuationChainNode):
69         (WebCore::continuationMap): Deleted.
70         (WebCore::RenderBoxModelObject::setContinuation): Deleted.
71         * rendering/RenderBoxModelObject.h:
72         * rendering/RenderElement.cpp:
73         (WebCore::RenderElement::RenderElement):
74         (WebCore::RenderElement::removeAnonymousWrappersForInlinesIfNecessary):
75
76             Make this a function of the parent renderer itself instead of getting 'parent()' as first operation and
77             then using it.
78             Don't remove continuations (isAnonymousBlockContinuation() test gives wrong result for the last continuation of the chain).
79
80         (WebCore::RenderElement::styleDidChange):
81
82             removeAnonymousWrappersForInlinesIfNecessary is no function of the parent.
83
84         (WebCore::RenderElement::updateOutlineAutoAncestor):
85         * rendering/RenderElement.h:
86         (WebCore::RenderElement::hasContinuationChainNode const):
87         (WebCore::RenderElement::setHasContinuationChainNode):
88         (WebCore::RenderElement::hasContinuation const): Deleted.
89         (WebCore::RenderElement::setHasContinuation): Deleted.
90         * rendering/RenderInline.cpp:
91         (WebCore::RenderInline::styleDidChange):
92
93             Don't add and remove continuations from the chain when updating style. Prevent recursion by walking
94             the chain only in the (non-continuation) head renderer.
95
96         (WebCore::RenderInline::addChildIgnoringContinuation):
97
98             Remove the old continuation from the chain. splitFlow() will add it back into the right place.
99
100         (WebCore::RenderInline::splitInlines):
101         (WebCore::RenderInline::addChildToContinuation):
102         (WebCore::RenderInline::childBecameNonInline):
103
104             Remove the old continuation from the chain. splitFlow() will add it back into the right place.
105
106         * rendering/RenderInline.h:
107         * rendering/RenderObject.cpp:
108         (WebCore::RenderObject::propagateRepaintToParentWithOutlineAutoIfNeeded const):
109         (WebCore::RenderObject::outputRenderObject const):
110         (WebCore::findDestroyRootIncludingAnonymous):
111
112             Allow anonymous continuations as destroy roots.
113
114         (WebCore::RenderObject::removeFromParentAndDestroyCleaningUpAnonymousWrappers):
115
116             Removing a continuation may leave behind unnecessary anonymous sibling wrappers.
117             Call removeAnonymousWrappersForInlinesIfNecessary() on parent after removal to get rid of them.
118             If takeChild/removeAnonymousWrappersForInlinesIfNecessary leaves us with empty anonymous parent destroy that too.
119
120         * rendering/RenderRubyRun.cpp:
121         (WebCore::RenderRubyRun::takeChild):
122
123             Similar to RenderBlock::takeChild, remove the code that would make the renderer destroy itself.
124             Cleaning up RenderRubyRuns is now handled by removeFromParentAndDestroyCleaningUpAnonymousWrappers.
125
126 2017-11-02  Ryosuke Niwa  <rniwa@webkit.org>
127
128         REGRESSION(r224053): Crash in WebCore::Node::moveTreeToNewScope
129         https://bugs.webkit.org/show_bug.cgi?id=179158
130
131         Reviewed by Antti Koivisto.
132
133         Call decrementReferencingNodeCount after checking the release assertion
134         since that could delete oldDocument.
135
136         * dom/Node.cpp:
137         (WebCore::Node::moveTreeToNewScope):
138
139 2017-11-02  Antti Koivisto  <antti@apple.com>
140
141         First letter text renderer should be anonymous
142         https://bugs.webkit.org/show_bug.cgi?id=179114
143
144         Reviewed by Darin Adler.
145
146         Currently both RenderTextFragment and RenderText for first letter point to the same Text node.
147         There should only be one non-anonymous renderer per node.
148
149         * accessibility/AccessibilityRenderObject.cpp:
150         (WebCore::AccessibilityRenderObject::computeAccessibilityIsIgnored const):
151
152             Skip the first letter text renderer instead of the fragment.
153
154         * rendering/RenderBoxModelObject.cpp:
155         (WebCore::firstLetterRemainingTextMap):
156
157             Use WeakPtr.
158             Modernize.
159
160         (WebCore::RenderBoxModelObject::willBeDestroyed):
161         (WebCore::RenderBoxModelObject::firstLetterRemainingText const):
162
163             Avoid hash lookup with the new isFirstLetter bit.
164
165         (WebCore::RenderBoxModelObject::setFirstLetterRemainingText):
166
167         * rendering/RenderElement.cpp:
168         (WebCore::RenderElement::RenderElement):
169         * rendering/RenderElement.h:
170         (WebCore::RenderElement::isFirstLetter const):
171         (WebCore::RenderElement::setIsFirstLetter):
172
173             Add a bit for more explicit code.
174
175         * rendering/RenderTextFragment.cpp:
176         (WebCore::RenderTextFragment::setText):
177
178             Assert that RenderTextFragment is always the non-anonymous renderer.
179
180         * style/RenderTreeUpdaterFirstLetter.cpp:
181         (WebCore::updateFirstLetterStyle):
182
183             Set the isFirstLetter bit.
184
185         (WebCore::createFirstLetterRenderer):
186
187             Set the isFirstLetter bit.
188             Remove the old text renderer before adding a new one.
189
190 2017-11-01  Frederic Wang  <fwang@igalia.com>
191
192         Remove ScrollableArea::isTouchScrollable and ScrollableArea::isOverflowScroll
193         https://bugs.webkit.org/show_bug.cgi?id=179121
194
195         Reviewed by Alex Christensen.
196
197         These functions were introduced in r161589 and r160236 but it seems that they have never
198         been used.
199
200         No new tests, behavior unchanged.
201
202         * platform/ScrollableArea.h:
203         (WebCore::ScrollableArea::isTouchScrollable const): Deleted.
204         (WebCore::ScrollableArea::isOverflowScroll const): Deleted.
205         * rendering/RenderLayer.h:
206
207 2017-11-01  Basuke Suzuki  <Basuke.Suzuki@sony.com>
208
209         [Curl] Make the order of scheduler job handling sequential 
210         https://bugs.webkit.org/show_bug.cgi?id=179127
211
212         Reviewed by Alex Christensen.
213
214         * platform/network/curl/CurlRequestScheduler.cpp:
215         (WebCore::CurlRequestScheduler::add):
216         (WebCore::CurlRequestScheduler::cancel):
217         (WebCore::CurlRequestScheduler::stopThreadIfNoMoreJobRunning):
218         (WebCore::CurlRequestScheduler::executeTasks):
219         (WebCore::CurlRequestScheduler::workerThread):
220         (WebCore::CurlRequestScheduler::startTransfer):
221         (WebCore::CurlRequestScheduler::completeTransfer):
222         (WebCore::CurlRequestScheduler::cancelTransfer):
223         (WebCore::CurlRequestScheduler::finalizeTransfer):
224         (WebCore::CurlJobList::isEmpty const): Deleted.
225         (WebCore::CurlJobList::startJobs): Deleted.
226         (WebCore::CurlJobList::finishJobs): Deleted.
227         (WebCore::CurlRequestScheduler::updateJobList): Deleted.
228         * platform/network/curl/CurlRequestScheduler.h:
229
230 2017-11-01  Ryosuke Niwa  <rniwa@webkit.org>
231
232         NavigatorBase::onLine() accesses NetworkStateNotifier's singleton in a worker thread
233         https://bugs.webkit.org/show_bug.cgi?id=179149
234         <rdar://problem/35307552>
235
236         Reviewed by Jiewen Tan.
237
238         Fixed the bug making NavigatorBase::onLine a pure virtual function, and having two separate
239         implementations for Navigator and WorkerNavigator. The former uses the singleton directly,
240         and the latter returns the boolean stored in its instance. The boolean value is updated
241         via WorkerMessagingProxy when the online status changes.
242
243         No new tests.
244
245         * page/Navigator.cpp:
246         (WebCore::Navigator::onLine const):
247         * page/Navigator.h:
248         * page/NavigatorBase.cpp:
249         (WebCore::NavigatorBase::onLine): Deleted.
250         * page/NavigatorBase.h:
251         * page/WorkerNavigator.cpp:
252         (WebCore::WorkerNavigator::WorkerNavigator):
253         (WebCore::WorkerNavigator::onLine const):
254         * page/WorkerNavigator.h:
255         * platform/network/NetworkStateNotifier.cpp:
256         (WebCore::NetworkStateNotifier::singleton):
257         * workers/DedicatedWorkerGlobalScope.cpp:
258         (WebCore::DedicatedWorkerGlobalScope::create):
259         (WebCore::DedicatedWorkerGlobalScope::DedicatedWorkerGlobalScope):
260         * workers/DedicatedWorkerGlobalScope.h:
261         * workers/DedicatedWorkerThread.cpp:
262         (WebCore::DedicatedWorkerThread::DedicatedWorkerThread):
263         (WebCore::DedicatedWorkerThread::createWorkerGlobalScope):
264         * workers/DedicatedWorkerThread.h:
265         * workers/Worker.cpp:
266         (WebCore::Worker::notifyFinished):
267         * workers/WorkerGlobalScope.cpp:
268         (WebCore::WorkerGlobalScope::WorkerGlobalScope):
269         (WebCore::WorkerGlobalScope::navigator):
270         (WebCore::WorkerGlobalScope::setIsOnline):
271         * workers/WorkerGlobalScope.h:
272         * workers/WorkerGlobalScopeProxy.h:
273         * workers/WorkerMessagingProxy.cpp:
274         (WebCore::WorkerMessagingProxy::startWorkerGlobalScope):
275         (WebCore::WorkerMessagingProxy::notifyNetworkStateChange):
276         * workers/WorkerMessagingProxy.h:
277         * workers/WorkerThread.cpp:
278         (WebCore::WorkerThreadStartupData::WorkerThreadStartupData):
279         (WebCore::WorkerThread::WorkerThread):
280         (WebCore::WorkerThread::workerThread):
281         * workers/WorkerThread.h:
282         * workers/service/ServiceWorkerGlobalScope.cpp:
283         (WebCore::ServiceWorkerGlobalScope::ServiceWorkerGlobalScope):
284         * workers/service/ServiceWorkerGlobalScope.h:
285         * workers/service/context/ServiceWorkerThread.cpp:
286         (WebCore::ServiceWorkerThread::ServiceWorkerThread):
287         (WebCore::ServiceWorkerThread::createWorkerGlobalScope):
288         * workers/service/context/ServiceWorkerThread.h:
289
290 2017-11-01  Jiewen Tan  <jiewen_tan@apple.com>
291
292         Let is<T>() accept RefPtrs
293         https://bugs.webkit.org/show_bug.cgi?id=178612
294         <rdar://problem/35102004>
295
296         Reviewed by Ryosuke Niwa.
297
298         Get rid of .get() for all is<T>() calls.
299
300         No changes in behaviors.
301
302         * bindings/js/JSElementCustom.cpp:
303         (WebCore::createNewElementWrapper):
304         * bindings/js/JSMediaStreamTrackCustom.cpp:
305         (WebCore::toJSNewlyCreated):
306         * bindings/js/JSNodeCustom.cpp:
307         (WebCore::createWrapperInline):
308         * bindings/js/JSTextCustom.cpp:
309         (WebCore::toJSNewlyCreated):
310         * css/CSSFilterImageValue.cpp:
311         (WebCore::CSSFilterImageValue::loadSubimages):
312         * css/CSSFontFaceSet.cpp:
313         (WebCore::CSSFontFaceSet::matchingFaces):
314         * css/CSSFontSelector.cpp:
315         (WebCore::CSSFontSelector::addFontFaceRule):
316         * css/CSSToStyleMap.cpp:
317         (WebCore::CSSToStyleMap::mapNinePieceImage):
318         * css/FontFace.cpp:
319         (WebCore::FontFace::create):
320         * css/StyleBuilderConverter.h:
321         (WebCore::StyleBuilderConverter::createGridTrackList):
322         * css/StyleBuilderCustom.h:
323         (WebCore::StyleBuilderCustom::applyValueCursor):
324         (WebCore::StyleBuilderCustom::applyValueContent):
325         (WebCore::StyleBuilderCustom::applyValueWillChange):
326         * css/StyleProperties.cpp:
327         (WebCore::StyleProperties::propertyAsColor const):
328         (WebCore::StyleProperties::propertyAsValueID const):
329         * css/StyleResolver.cpp:
330         (WebCore::StyleResolver::createFilterOperations):
331         * css/TransformFunctions.cpp:
332         (WebCore::transformsForValue):
333         * css/ViewportStyleResolver.cpp:
334         (WebCore::ViewportStyleResolver::getViewportArgumentValue const):
335         * dom/Document.cpp:
336         (WebCore::Document::setBodyOrFrameset):
337         (WebCore::Document::setFocusedElement):
338         (WebCore::Document::updateHoverActiveState):
339         * dom/Element.cpp:
340         (WebCore::Element::setOuterHTML):
341         * dom/Range.cpp:
342         (WebCore::Range::insertNode):
343         * editing/ApplyStyleCommand.cpp:
344         (WebCore::toIdentifier):
345         (WebCore::ApplyStyleCommand::applyBlockStyle):
346         (WebCore::ApplyStyleCommand::surroundNodeRangeWithElement):
347         * editing/EditingStyle.cpp:
348         (WebCore::identifierForStyleProperty):
349         (WebCore::HTMLElementEquivalent::valueIsPresentInStyle const):
350         (WebCore::EditingStyle::extractFontSizeDelta):
351         (WebCore::EditingStyle::textDirection const):
352         (WebCore::textDecorationValueList):
353         (WebCore::EditingStyle::prepareToApplyAt):
354         (WebCore::EditingStyle::legacyFontSize const):
355         (WebCore::EditingStyle::textDirectionForSelection):
356         (WebCore::StyleChange::StyleChange):
357         (WebCore::StyleChange::extractTextStyles):
358         (WebCore::diffTextDecorations):
359         * html/BaseChooserOnlyDateAndTimeInputType.cpp:
360         (WebCore::BaseChooserOnlyDateAndTimeInputType::updateAppearance):
361         * html/FormAssociatedElement.cpp:
362         (WebCore::FormAssociatedElement::findAssociatedForm):
363         * html/HTMLAreaElement.cpp:
364         (WebCore::HTMLAreaElement::imageElement const):
365         * html/HTMLElement.cpp:
366         (WebCore::HTMLElement::setOuterText):
367         (WebCore::HTMLElement::dirAttributeChanged):
368         * html/HTMLEmbedElement.cpp:
369         (WebCore::HTMLEmbedElement::rendererIsNeeded):
370         * html/HTMLFormControlElement.cpp:
371         (WebCore::HTMLFormControlElement::computeIsDisabledByFieldsetAncestor const):
372         * html/HTMLInputElement.cpp:
373         (WebCore::HTMLInputElement::dataList const):
374         * html/HTMLOptionElement.cpp:
375         (WebCore::HTMLOptionElement::setText):
376         (WebCore::HTMLOptionElement::textIndentedToRespectGroupLabel const):
377         * html/HTMLPlugInElement.cpp:
378         (WebCore::HTMLPlugInElement::isKeyboardFocusable const):
379         (WebCore::HTMLPlugInElement::isUserObservable const):
380         * html/HTMLSelectElement.cpp:
381         (WebCore::HTMLSelectElement::selectOption):
382         * html/HTMLSummaryElement.cpp:
383         (WebCore::isClickableControl):
384         * html/HTMLTextFormControlElement.cpp:
385         (WebCore::HTMLTextFormControlElement::adjustInnerTextStyle const):
386         * html/RadioInputType.cpp:
387         (WebCore::RadioInputType::isKeyboardFocusable const):
388         * html/parser/HTMLConstructionSite.cpp:
389         (WebCore::HTMLConstructionSite::attachLater):
390         (WebCore::HTMLConstructionSite::insertTextNode):
391         * html/shadow/MediaControlElements.cpp:
392         (WebCore::MediaControlClosedCaptionsTrackListElement::defaultEventHandler):
393         * html/track/TextTrackList.cpp:
394         (TextTrackList::append):
395         * inspector/InspectorDOMAgent.cpp:
396         (WebCore::InspectorDOMAgent::setNodeName):
397         * inspector/PageScriptDebugServer.cpp:
398         (WebCore::PageScriptDebugServer::setJavaScriptPaused):
399         * page/FocusController.cpp:
400         (WebCore::shouldClearSelectionWhenChangingFocusedElement):
401         * page/FrameView.cpp:
402         (WebCore::FrameView::hasCustomScrollbars const):
403         * page/Page.cpp:
404         (WebCore::Page::pluginViews):
405         * page/mac/EventHandlerMac.mm:
406         (WebCore::EventHandler::platformPrepareForWheelEvents):
407         * rendering/RenderBoxModelObject.cpp:
408         (WebCore::RenderBoxModelObject::paintFillLayerExtended):
409         * testing/Internals.cpp:
410         (WebCore::deferredStyleRulesCountForList):
411         (WebCore::deferredGroupRulesCountForList):
412         (WebCore::deferredKeyframesRulesCountForList):
413
414 2017-11-01  Fujii Hironori  <Hironori.Fujii@sony.com>
415
416         [curl] Fix build after r224299
417         https://bugs.webkit.org/show_bug.cgi?id=179155
418
419         Unreviewed.
420
421         Bug 175597 added the 6th argument of ResourceHandle constructor.
422         Apply the same change of ResourceHandleCFNet.cpp to
423         platformLoadResourceSynchronously of ResourceHandleCurl.cpp.
424
425         No new tests since there should be no behavioral change other
426
427         * platform/network/curl/ResourceHandleCurl.cpp:
428         (WebCore::ResourceHandle::platformLoadResourceSynchronously):
429         Added the 6th arguemnt shouldContentEncodingSniff.
430
431 2017-11-01  Simon Fraser  <simon.fraser@apple.com>
432
433         Fix iOS build after r224312.
434
435         * platform/graphics/cocoa/GraphicsContextCocoa.mm:
436         (WebCore::GraphicsContext::drawFocusRing):
437
438 2017-11-01  Daniel Bates  <dabates@apple.com>
439
440         Change Element::didAddUserAgentShadowRoot() to take a reference instead of a pointer
441         https://bugs.webkit.org/show_bug.cgi?id=179153
442
443         Reviewed by Ryosuke Niwa.
444
445         Element::didAddUserAgentShadowRoot() is always passed a non-null pointer to the added
446         ShadowRoot. Therefore we should have didAddUserAgentShadowRoot() take a lvalue reference
447         to a ShadowRoot.
448
449         No functionality changed. So, no new tests.
450
451         * dom/Element.cpp:
452         (WebCore::Element::addShadowRoot):
453         * dom/Element.h:
454         (WebCore::Element::didAddUserAgentShadowRoot):
455         * html/HTMLDetailsElement.cpp:
456         (WebCore::HTMLDetailsElement::didAddUserAgentShadowRoot):
457         * html/HTMLDetailsElement.h:
458         * html/HTMLInputElement.cpp:
459         (WebCore::HTMLInputElement::didAddUserAgentShadowRoot):
460         * html/HTMLInputElement.h:
461         * html/HTMLMediaElement.cpp:
462         (WebCore::HTMLMediaElement::didAddUserAgentShadowRoot):
463         * html/HTMLMediaElement.h:
464         * html/HTMLMeterElement.cpp:
465         (WebCore::HTMLMeterElement::didAddUserAgentShadowRoot):
466         * html/HTMLMeterElement.h:
467         * html/HTMLPlugInElement.cpp:
468         (WebCore::HTMLPlugInElement::didAddUserAgentShadowRoot):
469         * html/HTMLPlugInElement.h:
470         * html/HTMLPlugInImageElement.cpp:
471         (WebCore::HTMLPlugInImageElement::didAddUserAgentShadowRoot):
472         * html/HTMLPlugInImageElement.h:
473         * html/HTMLProgressElement.cpp:
474         (WebCore::HTMLProgressElement::didAddUserAgentShadowRoot):
475         * html/HTMLProgressElement.h:
476         * html/HTMLSummaryElement.cpp:
477         (WebCore::HTMLSummaryElement::didAddUserAgentShadowRoot):
478         * html/HTMLSummaryElement.h:
479         * html/HTMLTextAreaElement.cpp:
480         (WebCore::HTMLTextAreaElement::didAddUserAgentShadowRoot):
481         * html/HTMLTextAreaElement.h:
482
483 2017-11-01  Jeremy Jones  <jeremyj@apple.com>
484
485         Implement WKFullscreenWindowController for iOS.
486         https://bugs.webkit.org/show_bug.cgi?id=178924
487         rdar://problem/34697120
488
489         Reviewed by Simon Fraser.
490
491         Enable ENABLE_FULLSCREEN_API for iOS.
492
493         * Configurations/FeatureDefines.xcconfig:
494
495 2017-11-01  Simon Fraser  <simon.fraser@apple.com>
496
497         Misc display list and other cleanup
498         https://bugs.webkit.org/show_bug.cgi?id=179150
499
500         Reviewed by Tim Horton.
501
502         A few functions in GraphicsContext would assert when using display lists, because they
503         had no recording clause. Fix them (ellipse drawing, and focus ring drawing).
504         
505         Use #pragma once in more places.
506
507         Add system trace points for display list recording.
508
509         No behavior change for non-display list code.
510
511         * platform/graphics/GraphicsContext.cpp:
512         (WebCore::GraphicsContext::fillEllipse):
513         (WebCore::GraphicsContext::strokeEllipse):
514         * platform/graphics/PlatformLayer.h:
515         * platform/graphics/ca/GraphicsLayerCA.cpp:
516         (WebCore::GraphicsLayerCA::recursiveCommitChanges):
517         * platform/graphics/ca/cocoa/WebSystemBackdropLayer.h:
518         * platform/graphics/ca/cocoa/WebTiledBackingLayer.h:
519         * platform/graphics/cg/GraphicsContextCG.h:
520         * platform/graphics/cocoa/GraphicsContextCocoa.mm:
521         (WebCore::GraphicsContext::drawFocusRing):
522         * platform/graphics/displaylists/DisplayList.h:
523         * platform/graphics/displaylists/DisplayListItems.h:
524         (WebCore::DisplayList::DrawFocusRingPath::create):
525         (WebCore::DisplayList::DrawFocusRingPath::width const):
526         (WebCore::DisplayList::DrawFocusRingPath::offset const):
527         (WebCore::DisplayList::DrawFocusRingPath::DrawFocusRingPath):
528         (WebCore::DisplayList::DrawFocusRingRects::create):
529         (WebCore::DisplayList::DrawFocusRingRects::width const):
530         (WebCore::DisplayList::DrawFocusRingRects::offset const):
531         (WebCore::DisplayList::DrawFocusRingRects::DrawFocusRingRects):
532         * platform/graphics/displaylists/DisplayListRecorder.cpp:
533         (WebCore::DisplayList::Recorder::restore):
534         (WebCore::DisplayList::Recorder::drawFocusRing):
535         * platform/graphics/displaylists/DisplayListRecorder.h:
536         * platform/graphics/displaylists/DisplayListReplayer.h:
537         * platform/graphics/mac/WebLayer.h:
538
539 2017-11-01  Per Arne Vollan  <pvollan@apple.com>
540
541         [Win] Fix compile errors in MediaPlayerPrivateAVFoundationCF.cpp
542         https://bugs.webkit.org/show_bug.cgi?id=179148
543
544         Reviewed by Ryosuke Niwa.
545
546         * platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp:
547         (WebCore::MediaPlayerPrivateAVFoundationCF::resolvedURLChanged):
548
549 2017-11-01  Tim Horton  <timothy_horton@apple.com>
550
551         Adjust RenderElement size assertion to be more accurate
552         https://bugs.webkit.org/show_bug.cgi?id=179146
553
554         Reviewed by Simon Fraser.
555
556         * rendering/RenderElement.cpp:
557         Alignment rules for bitfields differ on different platforms. If we're
558         more truthful in our mimicing the layout of RenderElement, we can avoid
559         the assertion firing on more configurations.
560
561 2017-11-01  Mark Lam  <mark.lam@apple.com>
562
563         Add support to throw OOM if MarkedArgumentBuffer may overflow.
564         https://bugs.webkit.org/show_bug.cgi?id=179092
565         <rdar://problem/35116160>
566
567         Reviewed by Saam Barati.
568
569         No new tests.  The test for overflowing a MarkedArgumentBuffer will run for a
570         ridiculously long time, which renders it unsuitable for automated tests.
571
572         * Modules/plugins/QuickTimePluginReplacement.mm:
573         (WebCore::QuickTimePluginReplacement::installReplacement):
574         * bindings/js/JSCustomElementInterface.cpp:
575         (WebCore::constructCustomElementSynchronously):
576         (WebCore::JSCustomElementInterface::upgradeElement):
577         (WebCore::JSCustomElementInterface::invokeCallback):
578         * bindings/js/JSCustomXPathNSResolver.cpp:
579         (WebCore::JSCustomXPathNSResolver::lookupNamespaceURI):
580         * bindings/js/JSDOMBuiltinConstructorBase.cpp:
581         (WebCore::JSDOMBuiltinConstructorBase::callFunctionWithCurrentArguments):
582         * bindings/js/JSDOMConvertSequences.h:
583         (WebCore::JSConverter<IDLSequence<T>>::convert):
584         (WebCore::JSConverter<IDLFrozenArray<T>>::convert):
585         * bindings/js/JSDOMConvertWebGL.cpp:
586         (WebCore::convertToJSValue):
587         * bindings/js/JSDOMIterator.h:
588         (WebCore::jsPair):
589         (WebCore::iteratorForEach):
590         * bindings/js/JSDOMMapLike.cpp:
591         (WebCore::forwardFunctionCallToBackingMap):
592         (WebCore::forwardForEachCallToBackingMap):
593         * bindings/js/JSDOMPromiseDeferred.cpp:
594         (WebCore::DeferredPromise::callFunction):
595         (WebCore::createRejectedPromiseWithTypeError):
596         * bindings/js/JSErrorHandler.cpp:
597         (WebCore::JSErrorHandler::handleEvent):
598         * bindings/js/JSEventListener.cpp:
599         (WebCore::JSEventListener::handleEvent):
600         * bindings/js/JSLazyEventListener.cpp:
601         (WebCore::JSLazyEventListener::initializeJSFunction const):
602         * bindings/js/JSPluginElementFunctions.cpp:
603         (WebCore::callPlugin):
604         * bindings/js/JSReadableStreamPrivateConstructors.cpp:
605         (WebCore::constructJSReadableStreamReaderGeneric):
606         * bindings/js/ReadableStream.cpp:
607         (WebCore::ReadableStream::create):
608         (WebCore::ReadableStream::pipeTo):
609         (WebCore::ReadableStream::tee):
610         (WebCore::ReadableStream::lock):
611         (WebCore::checkReadableStream):
612         * bindings/js/ReadableStreamDefaultController.cpp:
613         (WebCore::ReadableStreamDefaultController::invoke):
614         * bindings/js/ScheduledAction.cpp:
615         (WebCore::ScheduledAction::executeFunctionInContext):
616         * bindings/js/SerializedScriptValue.cpp:
617         (WebCore::CloneSerializer::recordObject):
618         (WebCore::CloneSerializer::serialize):
619         (WebCore::CloneDeserializer::readTerminal):
620         (WebCore::CloneDeserializer::deserialize):
621         * bindings/scripts/CodeGeneratorJS.pm:
622         (GenerateCallbackImplementationContent):
623         * bindings/scripts/test/JS/JSTestCallbackFunction.cpp:
624         (WebCore::JSTestCallbackFunction::handleEvent):
625         * bindings/scripts/test/JS/JSTestCallbackFunctionRethrow.cpp:
626         (WebCore::JSTestCallbackFunctionRethrow::handleEvent):
627         * bindings/scripts/test/JS/JSTestCallbackFunctionWithThisObject.cpp:
628         (WebCore::JSTestCallbackFunctionWithThisObject::handleEvent):
629         * bindings/scripts/test/JS/JSTestCallbackFunctionWithTypedefs.cpp:
630         (WebCore::JSTestCallbackFunctionWithTypedefs::handleEvent):
631         * bindings/scripts/test/JS/JSTestCallbackInterface.cpp:
632         (WebCore::JSTestCallbackInterface::callbackWithNoParam):
633         (WebCore::JSTestCallbackInterface::callbackWithArrayParam):
634         (WebCore::JSTestCallbackInterface::callbackWithSerializedScriptValueParam):
635         (WebCore::JSTestCallbackInterface::callbackWithStringList):
636         (WebCore::JSTestCallbackInterface::callbackWithBoolean):
637         (WebCore::JSTestCallbackInterface::callbackRequiresThisToPass):
638         (WebCore::JSTestCallbackInterface::callbackWithAReturnValue):
639         (WebCore::JSTestCallbackInterface::callbackThatRethrowsExceptions):
640         (WebCore::JSTestCallbackInterface::callbackThatSkipsInvokeCheck):
641         (WebCore::JSTestCallbackInterface::callbackWithThisObject):
642         * bindings/scripts/test/JS/JSTestVoidCallbackFunction.cpp:
643         (WebCore::JSTestVoidCallbackFunction::handleEvent):
644         * bridge/NP_jsobject.cpp:
645         * bridge/objc/WebScriptObject.mm:
646         (-[WebScriptObject callWebScriptMethod:withArguments:]):
647         * html/HTMLMediaElement.cpp:
648         (WebCore::HTMLMediaElement::updateCaptionContainer):
649         (WebCore::HTMLMediaElement::didAddUserAgentShadowRoot):
650         (WebCore::HTMLMediaElement::updateMediaControlsAfterPresentationModeChange):
651         (WebCore::HTMLMediaElement::getCurrentMediaControlsStatus):
652         * html/HTMLPlugInImageElement.cpp:
653         (WebCore::HTMLPlugInImageElement::didAddUserAgentShadowRoot):
654         * testing/Internals.cpp:
655         (WebCore::Internals::cloneArrayBuffer):
656
657 2017-11-01  Andy Estes  <aestes@apple.com>
658
659         [Apple Pay] Update the enum traits for PaymentError::ContactField
660         https://bugs.webkit.org/show_bug.cgi?id=179145
661         <rdar://problem/35303108>
662
663         Reviewed by Tim Horton.
664
665         Account for the values added to PaymentError::ContactField in r220718 and r223580.
666
667         * Modules/applepay/ApplePaySessionPaymentRequest.h:
668
669 2017-11-01  Daniel Bates  <dabates@apple.com>
670
671         Remove unused Element::alwaysCreateUserAgentShadowRoot()
672         https://bugs.webkit.org/show_bug.cgi?id=179141
673
674         Reviewed by Ryosuke Niwa.
675
676         In changeset r208135 Element::createShadowRoot() was removed. And Element::createShadowRoot()
677         was the only caller of Element::alwaysCreateUserAgentShadowRoot(). We should remove
678         Element::alwaysCreateUserAgentShadowRoot() as it is unused.
679
680         * dom/Element.h:
681         (WebCore::Element::didAddUserAgentShadowRoot):
682         (WebCore::Element::alwaysCreateUserAgentShadowRoot const): Deleted.
683         * html/HTMLButtonElement.h:
684         * html/HTMLFormControlElement.h:
685         * html/HTMLMediaElement.h:
686
687 2017-11-01  Chris Dumez  <cdumez@apple.com>
688
689         Drop running Service Worker Jobs on a background thread
690         https://bugs.webkit.org/show_bug.cgi?id=179142
691
692         Reviewed by Youenn Fablet.
693
694         Drop running Service Worker Jobs on a background thread. We don't really need to
695         and this simplifies the logic a lot.
696
697         * workers/service/server/SWServer.cpp:
698         (WebCore::SWServer::getRegistration):
699         (WebCore::SWServer::addRegistration):
700         (WebCore::SWServer::removeRegistration):
701         * workers/service/server/SWServerJobQueue.cpp:
702         (WebCore::SWServerJobQueue::scriptContextStarted):
703         (WebCore::SWServerJobQueue::startNextJob):
704         (WebCore::SWServerJobQueue::runRegisterJob):
705         (WebCore::SWServerJobQueue::runUnregisterJob):
706         (WebCore::SWServerJobQueue::runUpdateJob):
707         (WebCore::SWServerJobQueue::finishCurrentJob):
708         * workers/service/server/SWServerJobQueue.h:
709
710 2017-11-01  Per Arne Vollan  <pvollan@apple.com>
711
712         Unreviewed, try to fix Windows build.
713
714         * platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp:
715         (WebCore::MediaPlayerPrivateAVFoundationCF::createAVAssetForURL):
716
717 2017-11-01  Chris Dumez  <cdumez@apple.com>
718
719         Split JobQueue logic out of SWServerRegistration
720         https://bugs.webkit.org/show_bug.cgi?id=179126
721
722         Reviewed by Brady Eidson.
723
724         Split JobQueue logic out of SWServerRegistration and into a SWServerJobQueue class to match the Service Workers
725         specification more closely.
726
727         * Sources.txt:
728         * WebCore.xcodeproj/project.pbxproj:
729         * workers/service/ServiceWorkerContainer.cpp:
730         (WebCore::ServiceWorkerContainer::jobResolvedWithRegistration):
731         * workers/service/ServiceWorkerRegistrationData.cpp:
732         (WebCore::ServiceWorkerRegistrationData::isolatedCopy const):
733         * workers/service/ServiceWorkerRegistrationData.h:
734         (WebCore::ServiceWorkerRegistrationData::encode const):
735         (WebCore::ServiceWorkerRegistrationData::decode):
736         * workers/service/server/SWServer.cpp:
737         (WebCore::SWServer::~SWServer):
738         (WebCore::SWServer::getRegistration):
739         (WebCore::SWServer::addRegistration):
740         (WebCore::SWServer::removeRegistration):
741         (WebCore::SWServer::Connection::scriptContextStarted):
742         (WebCore::SWServer::scheduleJob):
743         (WebCore::SWServer::scriptFetchFinished):
744         (WebCore::SWServer::scriptContextFailedToStart):
745         (WebCore::SWServer::scriptContextStarted):
746         * workers/service/server/SWServer.h:
747         * workers/service/server/SWServerJobQueue.cpp: Added.
748         (WebCore::SWServerJobQueue::SWServerJobQueue):
749         (WebCore::SWServerJobQueue::~SWServerJobQueue):
750         (WebCore::SWServerJobQueue::enqueueJob):
751         (WebCore::SWServerJobQueue::scriptFetchFinished):
752         (WebCore::SWServerJobQueue::scriptContextFailedToStart):
753         (WebCore::SWServerJobQueue::scriptContextStarted):
754         (WebCore::SWServerJobQueue::startNextJob):
755         (WebCore::SWServerJobQueue::runRegisterJob):
756         (WebCore::SWServerJobQueue::runUnregisterJob):
757         (WebCore::SWServerJobQueue::runUpdateJob):
758         (WebCore::SWServerJobQueue::rejectWithExceptionOnMainThread):
759         (WebCore::SWServerJobQueue::resolveWithRegistrationOnMainThread):
760         (WebCore::SWServerJobQueue::resolveCurrentRegistrationJobOnMainThead):
761         (WebCore::SWServerJobQueue::resolveWithUnregistrationResultOnMainThread):
762         (WebCore::SWServerJobQueue::startScriptFetchFromMainThread):
763         (WebCore::SWServerJobQueue::rejectCurrentJob):
764         (WebCore::SWServerJobQueue::resolveCurrentRegistrationJob):
765         (WebCore::SWServerJobQueue::resolveCurrentUnregistrationJob):
766         (WebCore::SWServerJobQueue::startScriptFetchForCurrentJob):
767         (WebCore::SWServerJobQueue::finishCurrentJob):
768         * workers/service/server/SWServerJobQueue.h: Added.
769         * workers/service/server/SWServerRegistration.cpp:
770         (WebCore::SWServerRegistration::SWServerRegistration):
771         (WebCore::SWServerRegistration::~SWServerRegistration):
772         (WebCore::SWServerRegistration::data const):
773         * workers/service/server/SWServerRegistration.h:
774         (WebCore::SWServerRegistration::key const):
775         (WebCore::SWServerRegistration::isUninstalling const):
776         (WebCore::SWServerRegistration::setIsUninstalling):
777         (WebCore::SWServerRegistration::setLastUpdateTime):
778         (WebCore::SWServerRegistration::updateViaCache const):
779         (WebCore::SWServerRegistration::setActiveServiceWorkerIdentifier):
780
781 2017-11-01  Daniel Bates  <dabates@apple.com>
782
783         XMLHttpRequest should not sniff content encoding
784         https://bugs.webkit.org/show_bug.cgi?id=175597
785         <rdar://problem/34912624>
786
787         Reviewed by Alex Christensen.
788
789         Fixes an issue where the body of an HTTP response with headers "Content-Type: application/octet-stream" and
790         "Content-Encoding: gzip" associated with an XHR request to a .gz file would not be automatically gzipped
791         decompressed. Specifically, such a response would be treated analogous to a response with headers
792         "Content-Type: application/gzip" and "Content-Encoding: identity". This behavior does not conform to the
793         behavior of the Content-Encoding header as defined in the HTTP 1.1 and later specs. Moreover this behavior
794         breaks the Epic Zen Garden demo: <https://s3.amazonaws.com/mozilla-games/ZenGarden/EpicZenGarden.html>.
795
796         On macOS 10.13.2 opt out of content encoding sniffing when making an XHR request. We likely can
797         selectively opt out of content encoding sniffing for other network requests. This will be done
798         in subsequent commits to make it straightforward to identify site breakage (if any).
799
800         * loader/ResourceLoader.cpp:
801         (WebCore::ResourceLoader::start): Pass content encoding policy.
802         * loader/ResourceLoader.h:
803         (WebCore::ResourceLoader::shouldSniffContentEncoding const): Added.
804         * loader/ResourceLoaderOptions.h:
805         * loader/appcache/ApplicationCacheGroup.cpp:
806         (WebCore::ApplicationCacheGroup::createResourceHandle): Enable content encoding sniff to match existing behavior.
807         * platform/network/BlobResourceHandle.cpp:
808         (WebCore::BlobResourceHandle::BlobResourceHandle): Ditto. We should look to disable content encoding sniffing in
809         a subsequent change.
810         * platform/network/PingHandle.h: Ditto.
811         * platform/network/ResourceHandle.cpp:
812         (WebCore::ResourceHandle::ResourceHandle): Modified to take a boolean as to whether to enable content encoding sniffing.
813         (WebCore::ResourceHandle::create): Ditto.
814         (WebCore::ResourceHandle::shouldContentEncodingSniff const): Added.
815         * platform/network/ResourceHandle.h:
816         * platform/network/ResourceHandleInternal.h:
817         (WebCore::ResourceHandleInternal::ResourceHandleInternal): Modified to take a boolean as to whether to enable content
818         encoding sniffing.
819         * platform/network/cf/ResourceHandleCFNet.cpp:
820         (WebCore::ResourceHandle::createCFURLConnection): Modified to take a boolean as to whether to enable content encoding
821         sniffing and apply this policy to the CFMutableURLRequestRef object when building on macOS 10.13.2.
822         (WebCore::ResourceHandle::start):
823         (WebCore::ResourceHandle::platformLoadResourceSynchronously): Enable content encoding sniff to match existing behavior.
824         * platform/network/mac/ResourceHandleMac.mm:
825         (WebCore::ResourceHandle::applySniffingPoliciesAndStoragePartitionIfNeeded): Added helper function to apply sniffing policies
826         and storage partition, if applicable. 
827         (WebCore::ResourceHandle::createNSURLConnection): Modified to take a boolean as to whether to enable content encoding
828         sniffing. Calls adjustNSRequestApplyingPolicies() to apply this policy.
829         (WebCore::ResourceHandle::start):
830         (WebCore::ResourceHandle::platformLoadResourceSynchronously): Enable content encoding sniff to match existing behavior.
831         * platform/network/soup/ResourceHandleSoup.cpp:
832         (WebCore::ResourceHandle::create): Modified to take a boolean as to whether to enable content encoding sniffing.
833         (WebCore::ResourceHandle::ResourceHandle): Ditto.
834         (WebCore::ResourceHandle::releaseForDownload): Pass content encoding policy.
835         * xml/XMLHttpRequest.cpp:
836         (WebCore::XMLHttpRequest::createRequest): Do not enable content encoding sniffing for the request.
837
838 2017-11-01  Jer Noble  <jer.noble@apple.com>
839
840         [Performance] Painting <video> to canvas spends a lot of time in URL getting and parsing
841         https://bugs.webkit.org/show_bug.cgi?id=179131
842
843         Reviewed by Eric Carlson.
844
845         Every time a <video> backed by MediaPlayerPrivateAVFoundation is asked to paint, it is first
846         queried whether it has a single security origin. To do this, the media player asks
847         AVFoundation what the "resolvedURL" of the asset is. This answer never changes after
848         metadata is first fetched, so the answer should be cached. To do so, add a m_resolvedURL
849         ivar to MediaPlayerPrivateAVFoundation, and add a setResolvedURL() and resolvedURLChanged()
850         method to re-query the value. Also create ivars for the security origin rather than re-
851         parsing them every time.
852
853         Drive-by fix: clean up all the instances where we pass a String rather than a URL (and thus
854         have to re-parse the URL at each point).
855
856         * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp:
857         (WebCore::MediaPlayerPrivateAVFoundation::load):
858         (WebCore::MediaPlayerPrivateAVFoundation::hasSingleSecurityOrigin const):
859         (WebCore::MediaPlayerPrivateAVFoundation::setResolvedURL):
860         (WebCore::MediaPlayerPrivateAVFoundation::metadataLoaded):
861         (WebCore::MediaPlayerPrivateAVFoundation::setPreload):
862         (WebCore::MediaPlayerPrivateAVFoundation::resolvedURL const): Deleted.
863         * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h:
864         (WebCore::MediaPlayerPrivateAVFoundation::resolvedURL const):
865         * platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp:
866         (WebCore::MediaPlayerPrivateAVFoundationCF::resolvedURLChanged):
867         (WebCore::AVFWrapper::createAssetForURL):
868         (WebCore::MediaPlayerPrivateAVFoundationCF::resolvedURL const): Deleted.
869         (WebCore::MediaPlayerPrivateAVFoundationCF::hasSingleSecurityOrigin const): Deleted.
870         * platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.h:
871         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
872         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
873         (WebCore::canonicalURL):
874         (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVAssetForURL):
875         (WebCore::MediaPlayerPrivateAVFoundationObjC::sizeChanged):
876         (WebCore::canonicalURL):
877         (WebCore::MediaPlayerPrivateAVFoundationObjC::hasSingleSecurityOrigin const): Deleted.
878
879 2017-11-01  Ryosuke Niwa  <rniwa@webkit.org>
880
881         innerText->renderBox() can be null in HTMLTextFormControlElement::setSelectionRange
882         https://bugs.webkit.org/show_bug.cgi?id=179103
883
884         Reviewed by Antti Koivisto.
885
886         Added a missing null check.
887
888         Unfortunately, no new tests since we don't have a working reproduction for trunk code.
889
890         * html/HTMLTextFormControlElement.cpp:
891         (WebCore::HTMLTextFormControlElement::setSelectionRange): Added a null check.
892
893 2017-11-01  Brady Eidson  <beidson@apple.com>
894
895         Plumbing for handling SW scripts failing to evaluate
896         https://bugs.webkit.org/show_bug.cgi?id=178926
897
898         Reviewed by Chris Dumez.
899
900         No new tests (Currently no observable behavior change).
901
902         In an upcoming patch we'll actually run the appropriate observable steps for when
903         a ServiceWorker script fails to evaluate.
904
905         This is a standalone refactoring + plumbing patch that will make the observable changes
906         easier to review.
907
908         * bindings/js/WorkerScriptController.cpp:
909         (WebCore::WorkerScriptController::evaluate):
910         * bindings/js/WorkerScriptController.h:
911         (WebCore::WorkerScriptController::workerGlobalScopeWrapper):
912         (WebCore::WorkerScriptController::vm):
913         (WebCore::WorkerScriptController::initScriptIfNeeded):
914
915         * workers/WorkerMessagingProxy.cpp:
916         (WebCore::WorkerMessagingProxy::startWorkerGlobalScope):
917
918         * workers/WorkerThread.cpp:
919         (WebCore::WorkerThread::start):
920         (WebCore::WorkerThread::workerThread):
921         * workers/WorkerThread.h:
922
923         * workers/service/context/SWContextManager.cpp:
924         (WebCore::SWContextManager::registerServiceWorkerThreadForUpdate):
925         (WebCore::SWContextManager::registerServiceWorkerThread): Deleted.
926         * workers/service/context/SWContextManager.h:
927
928         * workers/service/context/ServiceWorkerThread.h:
929         (WebCore::ServiceWorkerThread::serverConnectionIdentifier const):
930         (WebCore::ServiceWorkerThread::contextData const):
931
932         * workers/service/context/ServiceWorkerThreadProxy.cpp:
933         (WebCore::ServiceWorkerThreadProxy::create):
934         (WebCore::ServiceWorkerThreadProxy::ServiceWorkerThreadProxy):
935
936         * workers/service/server/SWServer.cpp:
937         (WebCore::SWServer::updateWorker):
938         (WebCore::SWServer::createWorker): Deleted.
939         * workers/service/server/SWServer.h:
940
941         * workers/service/server/SWServerRegistration.cpp:
942         (WebCore::SWServerRegistration::scriptFetchFinished):
943         (WebCore::SWServerRegistration::scriptContextFailedToStart):
944
945 2017-11-01  Ryosuke Niwa  <rniwa@webkit.org>
946
947         Assert that NoEventDispatchAssertion is not in the stack when executing a script
948         https://bugs.webkit.org/show_bug.cgi?id=179107
949
950         Reviewed by Simon Fraser.
951
952         Assert that NoEventDispatchAssertion::isEventAllowedInMainThread() is true when we're about to execute a script
953         by adding the assertion in ScriptController::canExecuteScripts which gets called with AboutToExecuteScript
954         whenever we're about to run scripts in event handlers, etc...
955
956         We don't assert the construction of event handlers in JSLazyEventListener since this happens while copying
957         the DOM tree inside a SVG use element and creating a event handler's JS function won't execute arbitrary scripts.
958
959         No new tests since there should be no behavioral change other 
960
961         * bindings/js/JSLazyEventListener.cpp:
962         (WebCore::JSLazyEventListener::initializeJSFunction const): Use newly added AboutToCreateEventListener.
963         (WebCore::JSLazyEventListener::create): Ditto.
964         * bindings/js/ScriptController.cpp:
965         (WebCore::ScriptController::canExecuteScripts): Added the assertion.
966         * bindings/js/ScriptController.h:
967
968 2017-11-01  Chris Dumez  <cdumez@apple.com>
969
970         Regression(r219659): Can no longer log into ifttt.com using Google account
971         https://bugs.webkit.org/show_bug.cgi?id=179117
972
973         Reviewed by Geoffrey Garen.
974
975         After r219659, it is no longer possible to log into ifttt.com using a Google
976         account:
977         - Signed into a Google account already
978         - Visit https://ifttt.com/login
979         - Click "Continue with Google"
980         - Select the signed in account
981
982         It turns out that this change to the HTML specification was not Web-compatible:
983         See https://bugzilla.mozilla.org/show_bug.cgi?id=1412741 & https://github.com/whatwg/html/issues/3183
984
985         This patch reverts r219659 for now until we agree on what behavior should get
986         specified.
987
988         No new tests, rebaselined existing tests.
989
990         * bindings/js/JSDOMWindowCustom.cpp:
991         (WebCore::jsDOMWindowGetOwnPropertySlotRestrictedAccess):
992         (WebCore::JSDOMWindow::getOwnPropertySlotByIndex):
993         (WebCore::JSDOMWindow::getOwnPropertyNames):
994         * bindings/js/JSLocationCustom.cpp:
995         (WebCore::getOwnPropertySlotCommon):
996         (WebCore::JSLocation::getOwnPropertyNames):
997
998 2017-10-31  Dean Jackson  <dino@apple.com>
999
1000         transferFromImageBitmap should update canvas dimensions
1001         https://bugs.webkit.org/show_bug.cgi?id=179096
1002         <rdar://problem/35285218>
1003
1004         Reviewed by Sam Weinig.
1005
1006         When transferFromImageBitmap is called, the dimensions of the HTMLCanvasElement
1007         should be updated to reflect the size of the passed ImageBitmap.
1008
1009         Update an existing WPT result.
1010
1011         * html/HTMLCanvasElement.cpp:
1012         (WebCore::HTMLCanvasElement::setImageBuffer const): Update the
1013         size of the element based on the incoming buffer.
1014         * html/HTMLCanvasElement.h: Mark m_size as mutable so we can
1015         call it from the const function setImageBuffer.
1016
1017 2017-11-01  Yusuke Suzuki  <utatane.tea@gmail.com>
1018
1019         [JSC] Introduce @toObject
1020         https://bugs.webkit.org/show_bug.cgi?id=178726
1021
1022         Reviewed by Saam Barati.
1023
1024         Use @isObject instead. It is more efficient.
1025
1026         * Modules/mediastream/NavigatorUserMedia.js:
1027         (getUserMedia):
1028
1029 2017-11-01  Commit Queue  <commit-queue@webkit.org>
1030
1031         Unreviewed, rolling out r224273 and r224278.
1032         https://bugs.webkit.org/show_bug.cgi?id=179120
1033
1034         Some crashes under guard malloc (Requested by anttik on
1035         #webkit).
1036
1037         Reverted changesets:
1038
1039         "Remove empty continuations in
1040         RenderObject::removeFromParentAndDestroyCleaningUpAnonymousWrappers"
1041         https://bugs.webkit.org/show_bug.cgi?id=179014
1042         https://trac.webkit.org/changeset/224273
1043
1044         "Fix ContinuationChainNode::insertAfter assertion."
1045         https://bugs.webkit.org/show_bug.cgi?id=179115
1046         https://trac.webkit.org/changeset/224278
1047
1048 2017-11-01  Emilio Cobos Álvarez  <emilio@crisal.io>
1049
1050         Fix ContinuationChainNode::insertAfter assertion.
1051         https://bugs.webkit.org/show_bug.cgi?id=179115
1052
1053         Reviewed by Antti Koivisto.
1054
1055         The assertion was writing instead of reading next->previous.
1056
1057         Hopefully it's harmless because it was clobbered on the same line, but
1058         it's worth asserting what it was intending to assert.
1059
1060         No new tests (no behaviour change).
1061
1062         * rendering/RenderBoxModelObject.cpp:
1063         (WebCore::RenderBoxModelObject::ContinuationChainNode::insertAfter):
1064
1065 2017-11-01  Fujii Hironori  <Hironori.Fujii@sony.com>
1066
1067         Use LazyNeverDestroyed instead of DEFINE_GLOBAL
1068         https://bugs.webkit.org/show_bug.cgi?id=174979
1069
1070         Reviewed by Yusuke Suzuki.
1071
1072         No new tests since there should be no behavioral change.
1073
1074         * DerivedSources.cpp: Remove the warning of StaticConstructors.h.
1075         * WebCore.order: Removed
1076         * config.h: Removed definitions of SKIP_STATIC_CONSTRUCTORS_ON_MSVC and SKIP_STATIC_CONSTRUCTORS_ON_GCC.
1077         * dom/QualifiedName.cpp:
1078         (WebCore::createQualifiedName): Deleted.
1079         * dom/QualifiedName.h: Removed createQualifiedName.
1080         * dom/make_names.pl:
1081         (printCppHead): Do not include StaticConstructors.h.
1082
1083 2017-11-01  Michael Catanzaro  <mcatanzaro@igalia.com>
1084
1085         [GTK] Always include TextureMapper.cmake
1086         https://bugs.webkit.org/show_bug.cgi?id=179060
1087
1088         Reviewed by Carlos Garcia Campos.
1089
1090         * PlatformGTK.cmake:
1091
1092 2017-11-01  Antti Koivisto  <antti@apple.com>
1093
1094         Remove empty continuations in RenderObject::removeFromParentAndDestroyCleaningUpAnonymousWrappers
1095         https://bugs.webkit.org/show_bug.cgi?id=179014
1096
1097         Reviewed by Geoff Garen.
1098
1099         Treat continuation similarly to other anonymous wrappers. This makes things more understandable
1100         and allows removal of some questionable code in RenderBlock::takeChild.
1101
1102         The patch also makes continuation chain a double linked so we can efficiently remove single
1103         continuations from the chain. It also gets rid of algorithms that recurse in continuation chain.
1104
1105         * accessibility/AccessibilityRenderObject.cpp:
1106         (WebCore::firstChildInContinuation):
1107         * rendering/RenderBlock.cpp:
1108         (WebCore::RenderBlock::styleDidChange):
1109
1110             Don't add and remove continuations from the chain when updating style. Prevent recursion by walking
1111             the chain only in the (non-continuation) head renderer.
1112
1113         (WebCore::RenderBlock::dropAnonymousBoxChild):
1114
1115             Make a member function.
1116
1117         (WebCore::RenderBlock::takeChild):
1118
1119             Remove code that destroyed empty continuations and caused the parent to destroy itself.
1120             Empty continuations are now removed by RenderObject::removeFromParentAndDestroyCleaningUpAnonymousWrappers.
1121
1122         * rendering/RenderBlock.h:
1123         * rendering/RenderBoxModelObject.cpp:
1124         (WebCore::RenderBoxModelObject::ContinuationChainNode::ContinuationChainNode):
1125         (WebCore::RenderBoxModelObject::ContinuationChainNode::~ContinuationChainNode):
1126         (WebCore::RenderBoxModelObject::ContinuationChainNode::insertAfter):
1127
1128             Track continuations with double linked lists.
1129
1130         (WebCore::continuationChainNodeMap):
1131         (WebCore::RenderBoxModelObject::willBeDestroyed):
1132
1133             Don't recurse to destroy continuation chain. 
1134             Destroy all continuations iteratively if this is the head of the chain.
1135             When destroying a continuation renderer simply remove it from the chain.
1136
1137         (WebCore::RenderBoxModelObject::continuation const):
1138         (WebCore::RenderBoxModelObject::insertIntoContinuationChainAfter):
1139         (WebCore::RenderBoxModelObject::removeFromContinuationChain):
1140         (WebCore::RenderBoxModelObject::ensureContinuationChainNode):
1141         (WebCore::continuationMap): Deleted.
1142         (WebCore::RenderBoxModelObject::setContinuation): Deleted.
1143         * rendering/RenderBoxModelObject.h:
1144         * rendering/RenderElement.cpp:
1145         (WebCore::RenderElement::RenderElement):
1146         (WebCore::RenderElement::removeAnonymousWrappersForInlinesIfNecessary):
1147
1148             Make this a function of the parent renderer itself instead of getting 'parent()' as first operation and
1149             then using it.
1150             Don't remove continuations (isAnonymousBlockContinuation() test gives wrong result for the last continuation of the chain).
1151
1152         (WebCore::RenderElement::styleDidChange):
1153
1154             removeAnonymousWrappersForInlinesIfNecessary is no function of the parent.
1155
1156         (WebCore::RenderElement::updateOutlineAutoAncestor):
1157         * rendering/RenderElement.h:
1158         (WebCore::RenderElement::hasContinuationChainNode const):
1159         (WebCore::RenderElement::setHasContinuationChainNode):
1160         (WebCore::RenderElement::hasContinuation const): Deleted.
1161         (WebCore::RenderElement::setHasContinuation): Deleted.
1162         * rendering/RenderInline.cpp:
1163         (WebCore::RenderInline::styleDidChange):
1164
1165             Don't add and remove continuations from the chain when updating style. Prevent recursion by walking
1166             the chain only in the (non-continuation) head renderer.
1167
1168         (WebCore::RenderInline::addChildIgnoringContinuation):
1169
1170             Remove the old continuation from the chain. splitFlow() will add it back into the right place.
1171
1172         (WebCore::RenderInline::splitInlines):
1173         (WebCore::RenderInline::addChildToContinuation):
1174         (WebCore::RenderInline::childBecameNonInline):
1175
1176             Remove the old continuation from the chain. splitFlow() will add it back into the right place.
1177
1178         * rendering/RenderInline.h:
1179         * rendering/RenderObject.cpp:
1180         (WebCore::RenderObject::propagateRepaintToParentWithOutlineAutoIfNeeded const):
1181         (WebCore::RenderObject::outputRenderObject const):
1182         (WebCore::findDestroyRootIncludingAnonymous):
1183
1184             Allow anonymous continuations as destroy roots.
1185
1186         (WebCore::RenderObject::removeFromParentAndDestroyCleaningUpAnonymousWrappers):
1187
1188             Removing a continuation may leave behind unnecessary anonymous sibling wrappers.
1189             Call removeAnonymousWrappersForInlinesIfNecessary() on parent after removal to get rid of them.
1190
1191 2017-10-31  Said Abou-Hallawa  <sabouhallawa@apple.com>
1192
1193         updateMaskedAncestorShouldIsolateBlending() should check the Nullability of the computedStyle() of the element's ancestors
1194         https://bugs.webkit.org/show_bug.cgi?id=179085
1195         <rdar://problem/30888101>
1196
1197         Reviewed by Ryosuke Niwa.
1198
1199         This is a defensive change. The Element::computedStyle() can be null only
1200         if the element is not a connected to the DOM tree. This may happen if
1201         while the DOM tree is being changed, a different event is handled such
1202         that it requires styleReclac()/layout() to happen. In this case, the render
1203         tree will be in an incorrect state.
1204
1205         * rendering/svg/SVGRenderSupport.cpp:
1206         (WebCore::SVGRenderSupport::updateMaskedAncestorShouldIsolateBlending):
1207
1208 2017-10-31  Alex Christensen  <achristensen@webkit.org>
1209
1210         Use asynchronous ResourceHandleClient calls for WebKit1
1211         https://bugs.webkit.org/show_bug.cgi?id=160677
1212
1213         Reviewed by Brady Eidson.
1214
1215         Covered by existing tests.
1216
1217         * PlatformAppleWin.cmake:
1218         * PlatformMac.cmake:
1219         * WebCore.xcodeproj/project.pbxproj:
1220         * loader/ResourceLoader.cpp:
1221         (WebCore::ResourceLoader::willSendRequestAsync):
1222         (WebCore::ResourceLoader::didReceiveResponseAsync):
1223         (WebCore::ResourceLoader::canAuthenticateAgainstProtectionSpaceAsync):
1224         * loader/ResourceLoader.h:
1225         * loader/appcache/ApplicationCacheGroup.cpp:
1226         (WebCore::ApplicationCacheGroup::didReceiveResponseAsync):
1227         (WebCore::ApplicationCacheGroup::willSendRequestAsync):
1228         (WebCore::ApplicationCacheGroup::canAuthenticateAgainstProtectionSpaceAsync):
1229         (WebCore::ApplicationCacheGroup::didReceiveResponse): Deleted.
1230         * loader/appcache/ApplicationCacheGroup.h:
1231         * platform/network/BlobResourceHandle.cpp:
1232         (WebCore::BlobResourceHandle::continueDidReceiveResponse):
1233         (WebCore::BlobResourceHandle::getSizeForNext):
1234         (WebCore::BlobResourceHandle::notifyResponseOnSuccess):
1235         (WebCore::BlobResourceHandle::notifyResponseOnError):
1236         * platform/network/PingHandle.h:
1237         * platform/network/ResourceHandle.cpp:
1238         (WebCore::ResourceHandle::didReceiveResponse):
1239         (WebCore::ResourceHandle::usesAsyncCallbacks): Deleted.
1240         * platform/network/ResourceHandle.h:
1241         * platform/network/ResourceHandleClient.cpp:
1242         (WebCore::ResourceHandleClient::~ResourceHandleClient):
1243         (WebCore::ResourceHandleClient::willSendRequest): Deleted.
1244         (WebCore::ResourceHandleClient::willSendRequestAsync): Deleted.
1245         (WebCore::ResourceHandleClient::didReceiveResponseAsync): Deleted.
1246         (WebCore::ResourceHandleClient::canAuthenticateAgainstProtectionSpaceAsync): Deleted.
1247         * platform/network/ResourceHandleClient.h:
1248         (WebCore::ResourceHandleClient::didReceiveAuthenticationChallenge):
1249         (WebCore::ResourceHandleClient::didReceiveResponse): Deleted.
1250         (WebCore::ResourceHandleClient::usesAsyncCallbacks): Deleted.
1251         (WebCore::ResourceHandleClient::canAuthenticateAgainstProtectionSpace): Deleted.
1252         * platform/network/ResourceHandleInternal.h:
1253         (WebCore::ResourceHandleInternal::ResourceHandleInternal):
1254         * platform/network/SynchronousLoaderClient.cpp:
1255         (WebCore::SynchronousLoaderClient::willSendRequestAsync):
1256         (WebCore::SynchronousLoaderClient::canAuthenticateAgainstProtectionSpaceAsync):
1257         (WebCore::SynchronousLoaderClient::didReceiveResponseAsync):
1258         (WebCore::SynchronousLoaderClient::didFinishLoading):
1259         (WebCore::SynchronousLoaderClient::didFail):
1260         (WebCore::SynchronousLoaderClient::willSendRequest): Deleted.
1261         (WebCore::SynchronousLoaderClient::canAuthenticateAgainstProtectionSpace): Deleted.
1262         (WebCore::SynchronousLoaderClient::didReceiveResponse): Deleted.
1263         * platform/network/SynchronousLoaderClient.h:
1264         * platform/network/cf/ResourceHandleCFNet.cpp:
1265         (WebCore::ResourceHandle::createCFURLConnection):
1266         (WebCore::ResourceHandle::start):
1267         (WebCore::ResourceHandle::willSendRequest):
1268         (WebCore::ResourceHandle::shouldUseCredentialStorage):
1269         (WebCore::ResourceHandle::canAuthenticateAgainstProtectionSpace):
1270         (WebCore::ResourceHandle::platformLoadResourceSynchronously):
1271         * platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.cpp:
1272         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::ResourceHandleCFURLConnectionDelegateWithOperationQueue):
1273         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::releaseHandle):
1274         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::willSendRequest):
1275         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::didReceiveResponse):
1276         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::didReceiveData):
1277         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::didFinishLoading):
1278         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::didFail):
1279         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::willCacheResponse):
1280         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::didReceiveChallenge):
1281         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::didSendBodyData):
1282         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::shouldUseCredentialStorage):
1283         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::canRespondToProtectionSpace):
1284         (WebCore::ResourceHandleCFURLConnectionDelegateWithOperationQueue::continueCanAuthenticateAgainstProtectionSpace):
1285         * platform/network/cf/ResourceHandleCFURLConnectionDelegateWithOperationQueue.h:
1286         * platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.cpp: Removed.
1287         * platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.h: Removed.
1288         * platform/network/mac/ResourceHandleMac.mm:
1289         (WebCore::ResourceHandle::start):
1290         (WebCore::ResourceHandle::schedule):
1291         (WebCore::ResourceHandle::makeDelegate):
1292         (WebCore::ResourceHandle::delegate):
1293         (WebCore::ResourceHandle::platformLoadResourceSynchronously):
1294         (WebCore::ResourceHandle::willSendRequest):
1295         (WebCore::ResourceHandle::continueWillSendRequest):
1296         (WebCore::ResourceHandle::continueDidReceiveResponse):
1297         (WebCore::ResourceHandle::canAuthenticateAgainstProtectionSpace):
1298         (WebCore::ResourceHandle::continueCanAuthenticateAgainstProtectionSpace):
1299         (WebCore::ResourceHandle::continueWillCacheResponse):
1300         (WebCore::ResourceHandle::shouldUseCredentialStorage): Deleted.
1301         * platform/network/mac/WebCoreResourceHandleAsDelegate.h: Removed.
1302         * platform/network/mac/WebCoreResourceHandleAsDelegate.mm: Removed.
1303         * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.h:
1304         * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm:
1305         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:willSendRequest:redirectResponse:]):
1306         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didReceiveAuthenticationChallenge:]):
1307         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:canAuthenticateAgainstProtectionSpace:]):
1308         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didReceiveResponse:]):
1309         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didReceiveData:lengthReceived:]):
1310         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didSendBodyData:totalBytesWritten:totalBytesExpectedToWrite:]):
1311         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:didFailWithError:]):
1312         (-[WebCoreResourceHandleAsOperationQueueDelegate connection:willCacheResponse:]):
1313
1314 2017-10-31  Simon Fraser  <simon.fraser@apple.com>
1315
1316         Rubber-banding overflow-scrolling-touch shows black
1317         https://bugs.webkit.org/show_bug.cgi?id=179087
1318         rdar://problem/35260253
1319
1320         Reviewed by Sam Weinig.
1321
1322         The "backgroundIsKnownToBeObscured" optimization was kicking in for an overflow:scroll
1323         whose area was completely covered by its contents, which happens with overlay scrollbars.
1324
1325         However, this ignored the fact that you can rubber-band to reveal the background, and,
1326         on iOS, composited scrolling requires that the scroller background is painted since it goes
1327         into its own layer.
1328
1329         Fix by turning off the optimization for layers that scroll overflow, including those
1330         using composited scrolling.
1331
1332         Test: fast/scrolling/rubber-band-shows-background.html
1333
1334         * rendering/RenderBox.cpp:
1335         (WebCore::RenderBox::foregroundIsKnownToBeOpaqueInRect const):
1336         (WebCore::RenderBox::computeBackgroundIsKnownToBeObscured):
1337         * rendering/RenderLayer.cpp:
1338         (WebCore::RenderLayer::scrollTo):
1339         (WebCore::RenderLayer::calculateClipRects const):
1340         * rendering/RenderLayer.h:
1341
1342 2017-10-31  Tim Horton  <timothy_horton@apple.com>
1343
1344         Clean up some drag and drop feature flags
1345         https://bugs.webkit.org/show_bug.cgi?id=179082
1346
1347         Reviewed by Simon Fraser.
1348
1349         * Configurations/FeatureDefines.xcconfig:
1350
1351 2017-10-31  Simon Fraser  <simon.fraser@apple.com>
1352
1353         Make it possible to test rubber-banding in overflow scroll
1354         https://bugs.webkit.org/show_bug.cgi?id=179078
1355
1356         Reviewed by Sam Weinig.
1357
1358         Test: fast/scrolling/unconstrained-scrollto.html
1359         
1360         Add internals.unconstrainedScrollTo(element, x, y) and plumb through ScrollClamping
1361         (which replaces RenderLayer::ScrollOffsetClamping) to support it.
1362
1363         Flip the default from unclamped to clamped for various RenderLayer scrolling-related
1364         functions, since most callers want clamped.
1365
1366         * accessibility/AccessibilityRenderObject.cpp:
1367         (WebCore::AccessibilityRenderObject::scrollTo const):
1368         * dom/Element.cpp:
1369         (WebCore::Element::scrollTo):
1370         * dom/Element.h:
1371         * html/HTMLBodyElement.cpp:
1372         (WebCore::HTMLBodyElement::scrollTo):
1373         * html/HTMLBodyElement.h:
1374         * html/TextFieldInputType.cpp:
1375         (WebCore::TextFieldInputType::elementDidBlur):
1376         * page/DOMWindow.cpp:
1377         (WebCore::DOMWindow::scrollTo const):
1378         * page/DOMWindow.h:
1379         * page/Frame.cpp:
1380         (WebCore::Frame::scrollOverflowLayer):
1381         (WebCore::Frame::checkOverflowScroll):
1382         * platform/ScrollAnimator.cpp:
1383         (WebCore::ScrollAnimator::scrollToOffsetWithoutAnimation):
1384         * platform/ScrollAnimator.h:
1385         * platform/ScrollTypes.h:
1386         * platform/ScrollableArea.cpp:
1387         (WebCore::ScrollableArea::scrollToOffsetWithoutAnimation):
1388         * platform/ScrollableArea.h:
1389         * platform/cocoa/ScrollController.h:
1390         * platform/mac/ScrollAnimatorMac.h:
1391         * platform/mac/ScrollAnimatorMac.mm:
1392         (WebCore::ScrollAnimatorMac::scrollToOffsetWithoutAnimation):
1393         (WebCore::ScrollAnimatorMac::immediateScrollToPosition):
1394         * platform/mock/ScrollAnimatorMock.h:
1395         * rendering/RenderBox.cpp:
1396         (WebCore::RenderBox::setScrollLeft):
1397         (WebCore::RenderBox::setScrollTop):
1398         * rendering/RenderBox.h:
1399         * rendering/RenderLayer.cpp:
1400         (WebCore::RenderLayer::panScrollFromPoint):
1401         (WebCore::RenderLayer::scrollByRecursively):
1402         (WebCore::RenderLayer::applyPostLayoutScrollPositionIfNeeded):
1403         (WebCore::RenderLayer::scrollToXPosition):
1404         (WebCore::RenderLayer::scrollToYPosition):
1405         (WebCore::RenderLayer::scrollToOffset):
1406         * rendering/RenderLayer.h:
1407         * rendering/RenderListBox.cpp:
1408         (WebCore::RenderListBox::setScrollLeft):
1409         (WebCore::RenderListBox::setScrollTop):
1410         * rendering/RenderListBox.h:
1411         * rendering/RenderTextControlSingleLine.cpp:
1412         (WebCore::RenderTextControlSingleLine::setScrollLeft):
1413         (WebCore::RenderTextControlSingleLine::setScrollTop):
1414         * rendering/RenderTextControlSingleLine.h:
1415         * testing/Internals.cpp:
1416         (WebCore::Internals::unconstrainedScrollTo):
1417         * testing/Internals.h:
1418         * testing/Internals.idl:
1419
1420 2017-10-31  Dean Jackson  <dino@apple.com>
1421
1422         Accept Settings object in ImageBitmapRenderingContext constructor and getContext
1423         https://bugs.webkit.org/show_bug.cgi?id=179075
1424         <rdar://problem/35279965>
1425
1426         Reviewed by Sam Weinig.
1427
1428         Allow getContext("bitmaprenderer") to take a dictionary as another argument, and
1429         pass that on to the ImageBitmapRenderingContext constructor.
1430
1431         Unfortunately this meant having to move ImageBitmapRenderingContext::Settings out into
1432         a stand-alone struct, since it needs to be defined in HTMLCanvasElement, which itself
1433         needs to be defined for ImageBitmapRenderingContext.
1434
1435         * DerivedSources.make: Add new IDL.
1436         * WebCore.xcodeproj/project.pbxproj: New files.
1437
1438         * html/HTMLCanvasElement.cpp:
1439         (WebCore::HTMLCanvasElement::createContextBitmapRenderer):
1440         (WebCore::HTMLCanvasElement::getContextBitmapRenderer):
1441
1442             Accept the ImageBitmapRenderingContextSettings object, and pass it on.
1443
1444         * html/HTMLCanvasElement.h:
1445         * html/canvas/ImageBitmapRenderingContext.cpp:
1446         (WebCore::ImageBitmapRenderingContext::ImageBitmapRenderingContext):
1447         * html/canvas/ImageBitmapRenderingContext.h:
1448         * html/canvas/ImageBitmapRenderingContext.idl:
1449         * html/canvas/ImageBitmapRenderingContextSettings.h: Copied from Source/WebCore/html/canvas/ImageBitmapRenderingContext.idl.
1450         * html/canvas/ImageBitmapRenderingContextSettings.idl: Added.
1451
1452 2017-10-31  Tim Horton  <timothy_horton@apple.com>
1453
1454         Fix up some content filtering feature flags
1455         https://bugs.webkit.org/show_bug.cgi?id=179079
1456
1457         Reviewed by Simon Fraser.
1458
1459         * Configurations/FeatureDefines.xcconfig:
1460
1461 2017-10-31  Chris Dumez  <cdumez@apple.com>
1462
1463         navigator.serviceWorker should always return the same object
1464         https://bugs.webkit.org/show_bug.cgi?id=179067
1465
1466         Reviewed by Youenn Fablet.
1467
1468         navigator.serviceWorker should always return the same object:
1469         - https://www.w3.org/TR/service-workers-1/#navigator-service-worker
1470
1471         Add visitor to make sure we don't gc() the ServiceWorkerContainer wrapper too early.
1472
1473         Test: http/tests/workers/service/navigator-serviceWorker-same-object.html
1474
1475         * Sources.txt:
1476         * WebCore.xcodeproj/project.pbxproj:
1477         * bindings/js/JSNavigatorCustom.cpp: Copied from Source/WebCore/workers/service/ServiceWorkerContainer.idl.
1478         (WebCore::JSNavigator::visitAdditionalChildren):
1479         * page/Navigator.idl:
1480         * workers/service/ServiceWorkerContainer.idl:
1481
1482 2017-10-31  Antoine Quint  <graouts@apple.com>
1483
1484         [Web Animations] Support AnimationEffect parameter in Animation constructor and read-write timeline property
1485         https://bugs.webkit.org/show_bug.cgi?id=179066
1486
1487         Reviewed by Dean Jackson.
1488
1489         We update the Animation constructor signature and behavior to allow for an AnimationEffect as its first,
1490         null by default, parameter and implement the spec behavior where an omitted AnimationTimeline parameter
1491         should default to the document timeline. We also make the timeline property read-write.
1492
1493         Existing tests are rebaselined and amended for this new behavior.
1494
1495         * animation/WebAnimation.cpp:
1496         (WebCore::WebAnimation::create):
1497         (WebCore::WebAnimation::WebAnimation):
1498         (WebCore::WebAnimation::setEffect):
1499         (WebCore::WebAnimation::setTimeline):
1500         * animation/WebAnimation.h:
1501         * animation/WebAnimation.idl:
1502
1503 2017-10-31  Ali Juma  <ajuma@chromium.org>
1504
1505         Layout viewport rect is too wide after window resize
1506         https://bugs.webkit.org/show_bug.cgi?id=175235
1507
1508         Reviewed by Dave Hyatt.
1509
1510         After a window resize, ScrollView::updateScrollbars adds/removes scrollbars and triggers
1511         layout. Each addition or removal triggers another pass, but at most 2 additional passes
1512         are allowed. If a scrollbar is added or removed in the final allowed pass, layout is
1513         left in an inconsistent state wrt the presence of scrollbars.
1514
1515         To avoid unnecessary passes, don't remove both scrollbars when only one needs to be
1516         removed. This saves the extra pass needed to add the scrollbar back.
1517
1518         Test: fast/dom/Window/window-resize-update-scrollbars.html
1519
1520         * platform/ScrollView.cpp:
1521         (WebCore::ScrollView::updateScrollbars):
1522
1523 2017-10-31  Wenson Hsieh  <wenson_hsieh@apple.com>
1524
1525         [Attachment Support] Implement WKWebView SPI for inserting attachment elements
1526         https://bugs.webkit.org/show_bug.cgi?id=179013
1527         <rdar://problem/35249668>
1528
1529         Reviewed by Tim Horton.
1530
1531         Adds Editor helper methods to insert an attachment element at the current selection.
1532
1533         Test: WKAttachmentTests.AttachmentElementInsertion
1534
1535         * editing/Editor.cpp:
1536         (WebCore::Editor::insertAttachment):
1537         (WebCore::Editor::insertAttachmentFromFile):
1538         * editing/Editor.h:
1539
1540         Add two new helpers for inserting attachment elements, either from a filename or a data blob. This is a wrapper
1541         around Editor::replaceSelectionWithFragment.
1542
1543         * html/HTMLAttachmentElement.cpp:
1544         (WebCore::HTMLAttachmentElement::HTMLAttachmentElement):
1545         (WebCore::HTMLAttachmentElement::create):
1546         * html/HTMLAttachmentElement.h:
1547
1548         Add a unique identifier string to HTMLAttachmentElement. This unique identifier allows the UI process to
1549         reference and indirectly manipulate attachment elements.
1550
1551 2017-10-31  Alex Christensen  <achristensen@webkit.org>
1552
1553         Fix custom header field setting with reloads and asynchronous navigation action policy decisions
1554         https://bugs.webkit.org/show_bug.cgi?id=179064
1555
1556         Reviewed by Tim Horton.
1557
1558         r223909 had two problems:
1559         1. It called addHTTPHeaderField instead of setHTTPHeaderField, so when a page is reloaded the header field
1560         is added to the resource request to be reloaded, which already had the headers added.
1561         2. It only worked in the synchronous decidePolicyForNavigationAction code path, not for asynchronous completion handlers.
1562
1563         These are both fixed, and both cases are covered with new API tests.
1564
1565         * loader/cache/CachedResourceLoader.cpp:
1566         (WebCore::CachedResourceLoader::requestResource):
1567
1568 2017-10-31  Devin Rousso  <webkit@devinrousso.com>
1569
1570         Web Inspector: make ScriptCallStack::maxCallStackSizeToCapture the default value when capturing backtraces
1571         https://bugs.webkit.org/show_bug.cgi?id=179048
1572
1573         Reviewed by Mark Lam.
1574
1575         No change in functionality.
1576
1577         * bindings/js/JSDOMExceptionHandling.cpp:
1578         (WebCore::reportException):
1579         * dom/RejectedPromiseTracker.cpp:
1580         (WebCore::createScriptCallStackFromReason):
1581         * html/canvas/WebGLRenderingContextBase.cpp:
1582         (WebCore::WebGLRenderingContextBase::compileShader):
1583         (WebCore::WebGLRenderingContextBase::printToConsole):
1584         * inspector/InspectorNetworkAgent.cpp:
1585         (WebCore::InspectorNetworkAgent::buildInitiatorObject):
1586         * inspector/PageDebuggerAgent.cpp:
1587         (WebCore::PageDebuggerAgent::breakpointActionLog):
1588         * inspector/WorkerDebuggerAgent.cpp:
1589         (WebCore::WorkerDebuggerAgent::breakpointActionLog):
1590         * page/DOMWindow.cpp:
1591         (WebCore::DOMWindow::postMessage):
1592
1593 2017-10-31  Michael Catanzaro  <mcatanzaro@igalia.com>
1594
1595         [GTK] Build more files under WebCore as unified sources
1596         https://bugs.webkit.org/show_bug.cgi?id=178968
1597
1598         Reviewed by Keith Miller.
1599
1600         * PlatformGTK.cmake:
1601         * PlatformWPE.cmake:
1602         * SourcesGTK.txt: Added.
1603         * SourcesWPE.txt:
1604
1605 2017-10-30  Ryosuke Niwa  <rniwa@webkit.org>
1606
1607         Assert that no script is executed during LayoutPhase::InRenderTreeLayout
1608         https://bugs.webkit.org/show_bug.cgi?id=179046
1609
1610         Reviewed by Antti Koivisto.
1611
1612         Added NoEventDispatchAssertion to LayoutPhase::InRenderTreeLayout.
1613
1614         * page/LayoutContext.cpp:
1615         (WebCore::LayoutContext::layout):
1616
1617 2017-10-31  Devin Rousso  <webkit@devinrousso.com>
1618
1619         Web Inspector: replace Canvas stack iteration with createScriptCallStack
1620         https://bugs.webkit.org/show_bug.cgi?id=178980
1621
1622         Reviewed by Joseph Pecoraro.
1623
1624         No new tests, updated existing tests.
1625
1626         * inspector/InspectorCanvas.cpp:
1627         (WebCore::InspectorCanvas::buildObjectForCanvas):
1628         (WebCore::InspectorCanvas::buildAction):
1629         (WebCore::iterateCallFrames): Deleted.
1630
1631 2017-10-31  Carlos Garcia Campos  <cgarcia@igalia.com>
1632
1633         [FreeType] Simple and complex paths are not applied consistently
1634         https://bugs.webkit.org/show_bug.cgi?id=177601
1635
1636         Reviewed by Michael Catanzaro.
1637
1638         Due to bug #100050, when rendering text, the complex path is forced in case kerning or shaping is enabled and
1639         only part of the run is going to be rendered. This happens in the GTK+ port when selecting text (except when
1640         selecting the whole run, of course). The text is initially rendered using the simple path as returned by
1641         FontCascade::codePath() and then the selection is rendered using the complex path, overriding what
1642         FontCascade::codePath() returned in that case. This doesn't happen in mac, because the selection is rendered
1643         differently, so FontCascade::drawText always renders the full run (simple path) when selecting text. Selecting
1644         text is the most noticeable inconsistency, but it's not the only one. Similar exceptions are applied when
1645         calculating the text width, or getting the offset of a given position. The rendered text is the simple one, but
1646         the calculations are performed using the complex path, so depending on the kerning and ligatures we might end up
1647         with wrong results. If the text has been rendered using the simple path, the selections and all other
1648         calculations should be performed with the simple path too. This patch moves the condition to force complex text
1649         to FontCascade::codePath(), and only for non Freetype ports. This ensures that all callers to
1650         FontCascade::codePath() will get a consistent result.
1651
1652         * platform/graphics/FontCascade.cpp:
1653         (WebCore::FontCascade::drawText const): Use the mode returned by codePath().
1654         (WebCore::FontCascade::drawEmphasisMarks const): Ditto.
1655         (WebCore::FontCascade::adjustSelectionRectForText const): Use the mode returned by codePath().
1656         (WebCore::FontCascade::offsetForPosition const): Ditto.
1657         (WebCore::FontCascade::codePath const): Force complex text for partial runs for ports not enabling advance text
1658         rendering mode by default.
1659         * platform/graphics/FontCascade.h: Add to and from optional parameters to codePath().
1660
1661 2017-10-30  Chris Dumez  <cdumez@apple.com>
1662
1663         Fire updatefound event after resolving the registration promise
1664         https://bugs.webkit.org/show_bug.cgi?id=178985
1665
1666         Reviewed by Youenn Fablet.
1667
1668         Fake series of events that are supposed to happen after registering a service worker
1669         that notify the page of the service worker's installation and activation.
1670
1671         Also make sure that registration.installing / waiting / active return proper values.
1672         Make sure that serviceWorker.scriptURL returns a proper value.
1673
1674         This unblocks a lot of web-platform-tests since they were blocked shortly after
1675         registration due to missing events or registration.installing being null.
1676
1677         * dom/ScriptExecutionContext.cpp:
1678         (WebCore::ScriptExecutionContext::activeServiceWorker const):
1679         (WebCore::ScriptExecutionContext::setActiveServiceWorker):
1680         * dom/ScriptExecutionContext.h:
1681         * loader/WorkerThreadableLoader.cpp:
1682         (WebCore::WorkerThreadableLoader::MainThreadBridge::MainThreadBridge):
1683         * loader/cache/CachedResourceLoader.cpp:
1684         (WebCore::CachedResourceLoader::prepareFetch):
1685         * workers/WorkerScriptLoader.cpp:
1686         (WebCore::WorkerScriptLoader::loadSynchronously):
1687         (WebCore::WorkerScriptLoader::loadAsynchronously):
1688         * workers/service/ServiceWorker.cpp:
1689         (WebCore::ServiceWorker::ServiceWorker):
1690         (WebCore::ServiceWorker::setState):
1691         * workers/service/ServiceWorker.h:
1692         * workers/service/ServiceWorkerContainer.cpp:
1693         (WebCore::ServiceWorkerContainer::controller const):
1694         (WebCore::ServiceWorkerContainer::jobResolvedWithRegistration):
1695         (WebCore::ServiceWorkerContainer::jobResolvedWithUnregistrationResult):
1696         * workers/service/ServiceWorkerContainer.h:
1697         * workers/service/ServiceWorkerRegistration.cpp:
1698         (WebCore::ServiceWorkerRegistration::ServiceWorkerRegistration):
1699         (WebCore::ServiceWorkerRegistration::~ServiceWorkerRegistration):
1700         (WebCore::ServiceWorkerRegistration::installing):
1701         (WebCore::ServiceWorkerRegistration::waiting):
1702         (WebCore::ServiceWorkerRegistration::active):
1703         * workers/service/ServiceWorkerRegistration.h:
1704         * workers/service/ServiceWorkerRegistrationData.cpp:
1705         (WebCore::ServiceWorkerRegistrationData::isolatedCopy const):
1706         * workers/service/ServiceWorkerRegistrationData.h:
1707         (WebCore::ServiceWorkerRegistrationData::encode const):
1708         (WebCore::ServiceWorkerRegistrationData::decode):
1709         * workers/service/server/SWClientConnection.cpp:
1710         (WebCore::SWClientConnection::postMessageToServiceWorkerClient):
1711         * workers/service/server/SWServerRegistration.cpp:
1712         (WebCore::SWServerRegistration::scriptContextStarted):
1713         (WebCore::SWServerRegistration::runRegisterJob):
1714         (WebCore::SWServerRegistration::data const):
1715         * workers/service/server/SWServerRegistration.h:
1716
1717 2017-10-30  Fujii Hironori  <Hironori.Fujii@sony.com>
1718
1719         Use LazyNeverDestroyed instead of DEFINE_GLOBAL for XMLNames, HTMLNames, MathMLNames and SVGNames
1720         https://bugs.webkit.org/show_bug.cgi?id=175118
1721
1722         Reviewed by Alex Christensen.
1723
1724         Stop using DEFINE_GLOBAL hack in favor of LazyNeverDestroyed.
1725
1726         No new tests since there should be no behavioral change.
1727
1728         * dom/make_names.pl:
1729         (printConstructors):
1730         (printNamesHeaderFile):
1731         (printNamesCppFile):
1732         (printDefinitions):
1733         * accessibility/AccessibilityRenderObject.cpp:
1734         (WebCore::AccessibilityRenderObject::inheritsPresentationalRole const):
1735         * css/StyleResolver.cpp:
1736         (WebCore::hasEffectiveDisplayNoneForDisplayContents):
1737         * dom/CustomElementReactionQueue.cpp:
1738         (WebCore::CustomElementReactionQueue::observesStyleAttribute const):
1739         * dom/Document.cpp:
1740         (WebCore::Document::validateCustomElementName):
1741         * dom/Element.cpp:
1742         (WebCore::isStyleAttribute):
1743         (WebCore::canAttachAuthorShadowRoot):
1744         * dom/ElementData.cpp:
1745         (WebCore::ElementData::findLanguageAttribute const):
1746         * domjit/JSDocumentDOMJIT.cpp:
1747         (WebCore::compileDocumentBodyAttribute):
1748         * editing/Editor.cpp:
1749         (WebCore::Editor::applyEditingStyleToBodyElement const):
1750         * editing/EditorCommand.cpp:
1751         (WebCore::valueDefaultParagraphSeparator):
1752         * editing/MarkupAccumulator.cpp:
1753         (WebCore::MarkupAccumulator::serializeNodesWithNamespaces):
1754         (WebCore::MarkupAccumulator::appendNamespace):
1755         (WebCore::MarkupAccumulator::elementCannotHaveEndTag):
1756         * editing/ReplaceSelectionCommand.cpp:
1757         (WebCore::isProhibitedParagraphChild):
1758         * html/HTMLBodyElement.cpp:
1759         (WebCore::HTMLBodyElement::createWindowEventHandlerNameMap):
1760         * html/HTMLDocument.cpp:
1761         (WebCore::HTMLDocument::isCaseSensitiveAttribute):
1762         * html/HTMLElement.cpp:
1763         (WebCore::HTMLElement::createEventHandlerNameMap):
1764         * html/parser/HTMLConstructionSite.cpp:
1765         (WebCore::HTMLConstructionSite::findFosterSite):
1766         * html/parser/HTMLElementStack.cpp:
1767         (WebCore::HTMLElementStack::hasTemplateInHTMLScope const):
1768         * html/parser/HTMLPreloadScanner.cpp:
1769         (WebCore::TokenPreloadScanner::updatePredictedBaseURL):
1770         * html/parser/HTMLTreeBuilder.cpp:
1771         (WebCore::HTMLTreeBuilder::processFakePEndTagIfPInButtonScope):
1772         (WebCore::HTMLTreeBuilder::processStartTagForInBody):
1773         (WebCore::HTMLTreeBuilder::processTemplateEndTag):
1774         (WebCore::HTMLTreeBuilder::processEndOfFileForInTemplateContents):
1775         (WebCore::HTMLTreeBuilder::processStartTag):
1776         (WebCore::HTMLTreeBuilder::processBodyEndTagForInBody):
1777         (WebCore::HTMLTreeBuilder::processEndTagForInBody):
1778         (WebCore::HTMLTreeBuilder::processCaptionEndTagForInCaption):
1779         (WebCore::HTMLTreeBuilder::processTableEndTagForInTable):
1780         (WebCore::HTMLTreeBuilder::processEndTag):
1781         (WebCore::HTMLTreeBuilder::insertPhoneNumberLink):
1782         (WebCore::HTMLTreeBuilder::defaultForBeforeHTML):
1783         (WebCore::HTMLTreeBuilder::defaultForBeforeHead):
1784         (WebCore::HTMLTreeBuilder::defaultForInHead):
1785         (WebCore::HTMLTreeBuilder::defaultForInHeadNoscript):
1786         (WebCore::HTMLTreeBuilder::defaultForAfterHead):
1787         * html/parser/TextDocumentParser.cpp:
1788         (WebCore::TextDocumentParser::insertFakePreElement):
1789         * rendering/svg/SVGPathData.cpp:
1790         (WebCore::pathFromGraphicsElement):
1791         * rendering/svg/SVGResources.cpp:
1792         (WebCore::clipperFilterMaskerTags):
1793         (WebCore::markerTags):
1794         (WebCore::fillAndStrokeTags):
1795         (WebCore::chainableResourceTags):
1796         * svg/SVGAnimatedBoolean.h:
1797         * svg/SVGAnimatedEnumeration.h:
1798         * svg/SVGAnimatedInteger.h:
1799         * svg/SVGAnimatedLength.h:
1800         * svg/SVGAnimatedLengthList.h:
1801         * svg/SVGAnimatedNumber.h:
1802         * svg/SVGAnimatedNumberList.h:
1803         * svg/SVGAnimatedPreserveAspectRatio.h:
1804         * svg/SVGAnimatedRect.h:
1805         * svg/SVGAnimatedString.h:
1806         * svg/SVGAnimatedTransformList.h:
1807         * svg/SVGAnimationElement.cpp:
1808         (WebCore::SVGAnimationElement::isSupportedAttribute):
1809         * svg/SVGCursorElement.cpp:
1810         (WebCore::SVGCursorElement::isSupportedAttribute):
1811         * svg/SVGElement.cpp:
1812         (WebCore::createAttributeNameToCSSPropertyIDMap):
1813         (WebCore::SVGElement::childShouldCreateRenderer const):
1814         (WebCore::SVGElement::animatableAttributeForName):
1815         * svg/SVGFilterElement.cpp:
1816         (WebCore::SVGFilterElement::isSupportedAttribute):
1817         * svg/SVGFilterPrimitiveStandardAttributes.cpp:
1818         (WebCore::SVGFilterPrimitiveStandardAttributes::isSupportedAttribute):
1819         * svg/SVGForeignObjectElement.cpp:
1820         (WebCore::SVGForeignObjectElement::isSupportedAttribute):
1821         * svg/SVGGradientElement.cpp:
1822         (WebCore::SVGGradientElement::isSupportedAttribute):
1823         * svg/SVGImageElement.cpp:
1824         (WebCore::SVGImageElement::isSupportedAttribute):
1825         * svg/SVGLineElement.cpp:
1826         (WebCore::SVGLineElement::isSupportedAttribute):
1827         * svg/SVGMarkerElement.cpp:
1828         (WebCore::SVGMarkerElement::isSupportedAttribute):
1829         * svg/SVGMaskElement.cpp:
1830         (WebCore::SVGMaskElement::isSupportedAttribute):
1831         * svg/SVGPathElement.cpp:
1832         (WebCore::SVGPathElement::dPropertyInfo):
1833         (WebCore::SVGPathElement::isSupportedAttribute):
1834         * svg/SVGPatternElement.cpp:
1835         (WebCore::SVGPatternElement::isSupportedAttribute):
1836         * svg/SVGPolyElement.cpp:
1837         (WebCore::SVGPolyElement::pointsPropertyInfo):
1838         * svg/SVGRadialGradientElement.cpp:
1839         (WebCore::SVGRadialGradientElement::isSupportedAttribute):
1840         * svg/SVGTextContentElement.cpp:
1841         (WebCore::SVGTextContentElement::textLengthPropertyInfo):
1842         (WebCore::SVGTextContentElement::isSupportedAttribute):
1843         * svg/SVGTextPathElement.cpp:
1844         (WebCore::SVGTextPathElement::isSupportedAttribute):
1845         * svg/SVGUseElement.cpp:
1846         (WebCore::createAllowedElementSet):
1847         * xml/NativeXPathNSResolver.cpp:
1848         (WebCore::NativeXPathNSResolver::lookupNamespaceURI):
1849         * xml/parser/XMLDocumentParser.cpp:
1850         (WebCore::XMLDocumentParser::parseDocumentFragment):
1851
1852 2017-10-30  Jer Noble  <jer.noble@apple.com>
1853
1854         [WebGL] Optimization to skip painting if texture and source surface hasn't changed isn't working; re-optimize.
1855         https://bugs.webkit.org/show_bug.cgi?id=178953
1856
1857         Reviewed by Dean Jackson.
1858
1859         The "seed" value of the current bound texture never matches the last saved value in
1860         VideoTextureCopierCV::copyImageToPlatformTexture(). The value is modified by the function
1861         itself, so a fresh value needs to be re-queried after the image's surface is attached to the
1862         texture.
1863
1864         Once this fix is in, however, the <canvas> being painted will flash when no new image is
1865         available. This is because the wrong texture target is being restored by the GC3DStateSaver
1866         at the end of copyImageToPlatformTexture(). While we're fixing that, we may as well use the
1867         texture state saved by the GraphicsContext3D itself to restore the correct texture unit,
1868         texture target, and texture.
1869
1870         * platform/graphics/GraphicsContext3D.h:
1871         (WebCore::GraphicsContext3D::activeTextureUnit const):
1872         (WebCore::GraphicsContext3D::currentBoundTexture const):
1873         (WebCore::GraphicsContext3D::currentBoundTarget const):
1874         (WebCore::GraphicsContext3D::GraphicsContext3DState::currentBoundTexture const):
1875         (WebCore::GraphicsContext3D::GraphicsContext3DState::boundTexture const):
1876         (WebCore::GraphicsContext3D::GraphicsContext3DState::currentBoundTarget const):
1877         (WebCore::GraphicsContext3D::GraphicsContext3DState::boundTarget const):
1878         (WebCore::GraphicsContext3D::GraphicsContext3DState::currentBoundTexture): Deleted.
1879         (WebCore::GraphicsContext3D::GraphicsContext3DState::boundTexture): Deleted.
1880         (WebCore::GraphicsContext3D::GraphicsContext3DState::boundTarget): Deleted.
1881         * platform/graphics/cv/VideoTextureCopierCV.cpp:
1882         (WebCore::VideoTextureCopierCV::copyImageToPlatformTexture):
1883         (WebCore::VideoTextureCopierCV::GC3DStateSaver::GC3DStateSaver):
1884         (WebCore::VideoTextureCopierCV::GC3DStateSaver::~GC3DStateSaver):
1885         * platform/graphics/cv/VideoTextureCopierCV.h:
1886         * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
1887         (WebCore::GraphicsContext3D::prepareTexture):
1888         (WebCore::GraphicsContext3D::activeTexture):
1889         (WebCore::GraphicsContext3D::bindTexture):
1890
1891 2017-10-30  Michael Catanzaro  <mcatanzaro@igalia.com>
1892
1893         WKBundlePageWillSendSubmitEventCallback is called with incorrect frame parameter
1894         https://bugs.webkit.org/show_bug.cgi?id=176719
1895
1896         Reviewed by Chris Dumez.
1897
1898         WKBundlePageWillSendSubmitEventCallback is clearly intended to parallel
1899         WKBundlePageWillSubmitFormCallback, since almost all the parameters are the same. Now, in
1900         WKBundlePageWillSubmitFormCallback, the first WKBundleFrameRef, "frame", is the frame of the
1901         form target, and the second WKBundleFrameRef, sourceFrame, is the frame containing the form.
1902         That's correct. But in WKBundlePageWillSendSubmitEventCallback, both frame and sourceFrame
1903         are always identical. The problem is that the FrameLoaderClient delegate is called on the
1904         wrong FrameLoaderClient. It should be called on the FrameLoaderClient of the target frame,
1905         but HTMLFormElement calls it on the FrameLoaderClient of the source frame instead.
1906
1907         Fix this by factoring the target frame computation out of FormSubmission into some helpers.
1908
1909         * html/HTMLFormElement.cpp:
1910         (WebCore::HTMLFormElement::prepareForSubmission):
1911         (WebCore::HTMLFormElement::effectiveTarget const):
1912         (WebCore::HTMLFormElement::findSubmitButton const):
1913         * html/HTMLFormElement.h:
1914         * loader/FormSubmission.cpp:
1915         (WebCore::FormSubmission::create):
1916
1917 2017-10-30  Alex Christensen  <achristensen@webkit.org>
1918
1919         ASSERTION FAILED: internalValuesConsistent(m_url) in WebCore::URLParser::URLParser
1920         https://bugs.webkit.org/show_bug.cgi?id=178861
1921
1922         Reviewed by Tim Horton.
1923
1924         This is a dark corner of the URL spec that has wildly different behavior in different browsers.
1925         The assertion fired when we have a file URL with a ? or a # after file:// and it was because
1926         m_pathAfterLastSlash was still 0. We definitely shouldn't assert. I'm making us consistent with
1927         other cases where we have nothing there and add an implied missing slash.
1928         
1929         Covered by new API tests.
1930
1931         * platform/URLParser.cpp:
1932         (WebCore::URLParser::parse):
1933
1934 2017-10-27  Megan Gardner  <megan_gardner@apple.com>
1935
1936         Correctly determine affinity when inserting text via Keyboard Suggestions
1937         https://bugs.webkit.org/show_bug.cgi?id=178969
1938
1939         Reviewed by Ryosuke Niwa.
1940
1941         There has been talk about renaming these enums, but in the meantime we should at least have a comment 
1942         clarifying what they actually mean.
1943
1944         No new tests only adding a comment, no tests needed.
1945
1946         * editing/TextAffinity.h:
1947
1948 2017-10-27  Ryosuke Niwa  <rniwa@webkit.org>
1949
1950         Crash in addChildNodesToDeletionQueue
1951         https://bugs.webkit.org/show_bug.cgi?id=178974
1952         <rdar://problem/35234372>
1953
1954         Reviewed by Brent Fulgham.
1955
1956         The bug was caused by HTMLConstructionSite::insertTextNode constructing an ill-formed tree
1957         when fostering parent under a template element by adjusting HTMLConstructionSiteTask's parent
1958         without clearing nextChild. Fixed the crash by simply removing this code since executeTask
1959         already takes care of fostering the parent in static inline insert(HTMLConstructionSiteTask&).
1960
1961         Test: fast/parser/foster-parent-under-template.html
1962
1963         * html/parser/HTMLConstructionSite.cpp:
1964         (WebCore::HTMLConstructionSite::insertTextNode):
1965
1966 2017-10-30  Commit Queue  <commit-queue@webkit.org>
1967
1968         Unreviewed, rolling out r224078.
1969         https://bugs.webkit.org/show_bug.cgi?id=179026
1970
1971         MotionMark regression (Requested by shallawa on #webkit).
1972
1973         Reverted changeset:
1974
1975         "When navigating back to a page, compositing layers may not
1976         use accelerated drawing"
1977         https://bugs.webkit.org/show_bug.cgi?id=178749
1978         https://trac.webkit.org/changeset/224078
1979
1980 2017-10-30  Dean Jackson  <dino@apple.com>
1981
1982         Implement "bitmaprenderer" CanvasRenderingContext
1983         https://bugs.webkit.org/show_bug.cgi?id=178992
1984         <rdar://problem/34147157>
1985
1986         Reviewed by Sam Weinig.
1987
1988         Implement the "bitmaprenderer" context for HTMLCanvasElement.
1989         Use as much of the existing 2d context code as possible, which
1990         means that we are painting the ImageBitmap into the backing
1991         store. This isn't optimal, but it is good enough to get
1992         going while we move buffer ownership from the canvas object
1993         into the rendering contexts.
1994
1995         This patch raised a few issues on the HTML specification:
1996         https://github.com/whatwg/html/issues/3164
1997         https://github.com/whatwg/html/issues/3165
1998         https://github.com/whatwg/html/issues/3166
1999         https://github.com/whatwg/html/issues/3167
2000
2001         Update existing Web Platform Test results.
2002
2003         * html/HTMLCanvasElement.cpp:
2004         (WebCore::HTMLCanvasElement::createContext2d): Drive-by comment fix.
2005         (WebCore::HTMLCanvasElement::createContextWebGL): Ditto.
2006         (WebCore::HTMLCanvasElement::createContextWebGPU): Ditto.
2007         (WebCore::HTMLCanvasElement::createContextBitmapRenderer): We now require
2008         a layer/backing store for a bitmap context.
2009         (WebCore::HTMLCanvasElement::paintsIntoCanvasBuffer const): Add bitmap-renderer
2010         to the type of context that uses the canvas's backing store.
2011         (WebCore::HTMLCanvasElement::createImageBuffer const): Comment fix.
2012         (WebCore::HTMLCanvasElement::setImageBuffer const): Change parameter to a &&.
2013         (WebCore::HTMLCanvasElement::setImageBufferAndMarkDirty): New function to set
2014         the backing store efficiently, as well as make it look like we need to repaint
2015         the entire canvas.
2016         (WebCore::HTMLCanvasElement::drawingContext const): The buffer doesn't actually
2017         need to provide a GraphicsContext if we're a bitmap renderer.
2018         * html/HTMLCanvasElement.h:
2019
2020         * html/ImageBitmap.cpp:
2021         (WebCore::ImageBitmap::transferOwnershipAndClose): New helper to give the ownership
2022         of the ImageBuffer away, and look like close() was called.
2023         * html/ImageBitmap.h:
2024
2025         * html/canvas/ImageBitmapRenderingContext.cpp: Implement the algorithm from the HTML
2026         specification.
2027         (WebCore::ImageBitmapRenderingContext::ImageBitmapRenderingContext):
2028         (WebCore::ImageBitmapRenderingContext::isAccelerated const):
2029         (WebCore::ImageBitmapRenderingContext::setOutputBitmap):
2030         (WebCore::ImageBitmapRenderingContext::transferFromImageBitmap):
2031         * html/canvas/ImageBitmapRenderingContext.h:
2032         * html/canvas/ImageBitmapRenderingContext.idl:
2033
2034 2017-10-30  Simon Fraser  <simon.fraser@apple.com>
2035
2036         tab-size: 0px asserts
2037         https://bugs.webkit.org/show_bug.cgi?id=176198
2038
2039         Reviewed by Antti Koivisto.
2040
2041         Don't claim to support tab-size values with units. We don't, and they would become 0, rather
2042         than fall back to the default as should happen.
2043
2044         Enhanced fast/css/tab-size.html to test.
2045
2046         * css/parser/CSSPropertyParser.cpp:
2047         (WebCore::consumeTabSize):
2048
2049 2017-10-30  Michael Catanzaro  <mcatanzaro@igalia.com>
2050
2051         [WPE] Fix build warnings
2052         https://bugs.webkit.org/show_bug.cgi?id=178899
2053
2054         Reviewed by Carlos Alberto Lopez Perez.
2055
2056         These are actually mostly cross-platform issues.
2057
2058         * html/canvas/WebGL2RenderingContext.cpp:
2059         (WebCore::arrayBufferViewElementSize):
2060         * platform/Cairo.cmake:
2061         * platform/Curl.cmake:
2062         * platform/FreeType.cmake:
2063         * platform/GCrypt.cmake:
2064         * platform/graphics/texmap/TextureMapperShaderProgram.cpp:
2065         (WebCore::TextureMapperShaderProgram::create):
2066         * platform/network/soup/SoupNetworkSession.cpp:
2067         (WebCore::SoupNetworkSession::SoupNetworkSession):
2068
2069 2017-10-30  Michael Catanzaro  <mcatanzaro@igalia.com>
2070
2071         [WPE] Build more files under WebCore as unified sources and get rid of WebCorePlatformWPE build target
2072         https://bugs.webkit.org/show_bug.cgi?id=178964
2073
2074         Reviewed by Carlos Alberto Lopez Perez.
2075
2076         This also gets rid of the WebCorePlatformWPE build target to simplify the build. It links to
2077         all the same libraries as the WebCore target, so it doesn't seem to have any purpose. Bye.
2078
2079         Some CMake files under platform are not unified, either because there is not much to gain
2080         (e.g. ImageDecoders, where everything is in a separate directory), or because it is complex
2081         (e.g. GStreamer, where GObject implementations would be tricky to build unified), and
2082         because we're limited to using only features declared in WebKitFeatures.cmake inside the
2083         unified sources lists, which makes some of the platform files a bit tricky (notably,
2084         anything that needs to go into WebCorePlatformGTK for the GTK port). So it's not perfect.
2085
2086         * PlatformWPE.cmake:
2087         * SourcesWPE.txt: Added.
2088         * crypto/gcrypt/GCryptUtilities.h:
2089         * platform/Cairo.cmake:
2090         * platform/GCrypt.cmake:
2091         * platform/SourcesCairo.txt: Added.
2092         * platform/SourcesGCrypt.txt: Added.
2093         * platform/SourcesGLib.txt: Added.
2094         * platform/SourcesSoup.txt: Added.
2095
2096 2017-10-30  Michael Catanzaro  <mcatanzaro@igalia.com>
2097
2098         Remove more unused ENABLE(GAMEPAD_DEPRECATED) code
2099         https://bugs.webkit.org/show_bug.cgi?id=178364
2100
2101         Reviewed by Carlos Alberto Lopez Perez.
2102
2103         * Modules/gamepad/deprecated/Gamepad.cpp: Removed.
2104         * Modules/gamepad/deprecated/Gamepad.h: Removed.
2105         * Modules/gamepad/deprecated/Gamepad.idl: Removed.
2106         * Modules/gamepad/deprecated/GamepadList.cpp: Removed.
2107         * Modules/gamepad/deprecated/GamepadList.h: Removed.
2108         * Modules/gamepad/deprecated/GamepadList.idl: Removed.
2109         * Modules/gamepad/deprecated/NavigatorGamepad.cpp: Removed.
2110         * Modules/gamepad/deprecated/NavigatorGamepad.h: Removed.
2111         * Modules/gamepad/deprecated/NavigatorGamepad.idl: Removed.
2112
2113 2017-10-30  Daniel Bates  <dabates@apple.com>
2114
2115         Use if conditional function in DerivedSources.make to reduce duplication
2116         https://bugs.webkit.org/show_bug.cgi?id=178989
2117
2118         Reviewed by Darin Adler.
2119
2120         In DerivedSources.make we currently duplicate most of the Makefile recipe for generating HTML/SVG
2121         tags and attributes to support passing the optional command line option --extraDefines when one
2122         or more HTML/SVG compile-time features are enabled. Instead we can make use of a Makefile
2123         conditional function in the recipe itself to avoid code duplication.
2124
2125         * DerivedSources.make:
2126
2127 2017-10-30  Antoine Quint  <graouts@apple.com>
2128
2129         [Web Animations] Expose the playbackRate property on Animation
2130         https://bugs.webkit.org/show_bug.cgi?id=178931
2131
2132         Reviewed by Sam Weinig.
2133
2134         Account for the playback rate when computing and setting an animation's
2135         current time, ensuring that we adjust the start time to preserve the
2136         current time when setting a new playback rate.
2137
2138         Test: http/wpt/wk-web-animations/timing-model/animation-playback-rate.html
2139
2140         * animation/WebAnimation.cpp:
2141         (WebCore::WebAnimation::WebAnimation):
2142         (WebCore::WebAnimation::currentTime const):
2143         (WebCore::WebAnimation::setCurrentTime):
2144         (WebCore::WebAnimation::setPlaybackRate):
2145         * animation/WebAnimation.h:
2146         * animation/WebAnimation.idl:
2147
2148 2017-10-30  Michael Catanzaro  <mcatanzaro@igalia.com>
2149
2150         [WPE][GTK] Expose availability of certain editing commands in WebKitEditorState
2151         https://bugs.webkit.org/show_bug.cgi?id=168219
2152
2153         Reviewed by Ryosuke Niwa.
2154
2155         Make Editor::canUndo and Editor::canRedo const.
2156
2157         Also, remove unused allowsCopy from HitTestResult.
2158
2159         * editing/Editor.cpp:
2160         (WebCore::Editor::canUndo const):
2161         (WebCore::Editor::canRedo const):
2162         (WebCore::Editor::canUndo): Deleted.
2163         (WebCore::Editor::canRedo): Deleted.
2164         * editing/Editor.h:
2165         * rendering/HitTestResult.cpp:
2166         (WebCore::HitTestResult::allowsCopy const): Deleted.
2167         * rendering/HitTestResult.h:
2168         * rendering/SelectionRangeData.cpp:
2169
2170 2017-10-27  Antti Koivisto  <antti@apple.com>
2171
2172         Destroy all unneeded anonymous wrappers in RenderObject::removeFromParentAndDestroyCleaningUpAnonymousWrappers()
2173         https://bugs.webkit.org/show_bug.cgi?id=178933
2174
2175         Reviewed by Zalan Bujtas.
2176
2177         Currently it just cleans up table related wrappers.
2178
2179         * rendering/RenderObject.cpp:
2180         (WebCore::findDestroyRootIncludingAnonymous):
2181
2182         Continuations are left as future work.
2183
2184 2017-10-30  Zalan Bujtas  <zalan@apple.com>
2185
2186         Remove reference to RenderTreeInternalMutationScope
2187         https://bugs.webkit.org/show_bug.cgi?id=178998
2188         <rdar://problem/35246464>
2189
2190         Reviewed by Antti Koivisto.
2191
2192         We don't have such class anymore.
2193
2194         No change in functionality.
2195
2196         * rendering/RenderView.h:
2197
2198 2017-10-30  Zan Dobersek  <zdobersek@igalia.com>
2199
2200         [GCrypt] Add support for P-521 EC curves
2201         https://bugs.webkit.org/show_bug.cgi?id=175199
2202
2203         Reviewed by Jiewen Tan.
2204
2205         Add support for 521-bit elliptic curves in the libgcrypt-based
2206         implementation of WebCrypto API.
2207
2208         In the CryptoAlgorithmECDH implementation, the bit-size of the key is now
2209         rounded up to the next byte boundary and passed to the helper
2210         gcryptDerive() function. There the size in bytes is used to zero-pad the
2211         derived key data. This is done to properly handle derivation results for
2212         the P-521 curves, where the leading zero bit could get clipped, resulting
2213         in a derived key that is only 65 byes in length when it is expected to be
2214         66 bytes. Further cleanups are done in gcryptDerive() to use the mpiData()
2215         function where possible.
2216
2217         In the CryptoAlgorithmECDSA implementation, the bit-size of the key is
2218         again rounded up to the nearest byte boundary before being passed to the
2219         helper gcryptSign() and gcryptVerify() functions. This again properly
2220         enforces the requirement of 66 bytes to handle P-521 elliptic curves.
2221
2222         In the CryptoKeyEC implementation, NamedCurve::P521 cases in helper
2223         functions operating on NamedCurve values are now implemented to return
2224         appropriate values. platformSupportedCurve() now returns true for the
2225         NamedCurve::P521 value. Zero-padding of the private key data is used
2226         wherever it is necessary to avoid clipping any leading zero bit in the
2227         P-521 EC key.
2228
2229         No new tests -- affected tests have their baselines updated.
2230
2231         * crypto/gcrypt/CryptoAlgorithmECDHGCrypt.cpp:
2232         (WebCore::gcryptDerive):
2233         (WebCore::CryptoAlgorithmECDH::platformDeriveBits):
2234         * crypto/gcrypt/CryptoAlgorithmECDSAGCrypt.cpp:
2235         (WebCore::CryptoAlgorithmECDSA::platformSign):
2236         (WebCore::CryptoAlgorithmECDSA::platformVerify):
2237         * crypto/gcrypt/CryptoKeyECGCrypt.cpp:
2238         (WebCore::curveName):
2239         (WebCore::curveIdentifier):
2240         (WebCore::curveSize):
2241         (WebCore::curveUncompressedFieldElementSize):
2242         (WebCore::CryptoKeyEC::platformSupportedCurve):
2243         (WebCore::curveForIdentifier):
2244         (WebCore::CryptoKeyEC::platformImportPkcs8):
2245         (WebCore::CryptoKeyEC::platformAddFieldElements const):
2246         (WebCore::CryptoKeyEC::platformExportPkcs8 const):
2247
2248 2017-10-29  Fujii Hironori  <Hironori.Fujii@sony.com>
2249
2250         Use of uninitialized value $targetIdlFile in hash element at preprocess-idls.pl line 165.
2251         https://bugs.webkit.org/show_bug.cgi?id=177743
2252
2253         Reviewed by Darin Adler.
2254
2255         GamepadWebVR.idl supplements Gamepad.idl. But, Gamepad.idl is not
2256         processed because ENABLE_GAMEPAD is OFF.
2257
2258         No new tests since there should be no behavioral change.
2259
2260         * CMakeLists.txt: Include GamepadWebVR.idl only if ENABLE_GAMEPAD.
2261         * Sources.txt: Ditto.
2262         * bindings/scripts/preprocess-idls.pl: Die if a supplemented IDL file is not found.
2263
2264 2017-10-29  Sam Weinig  <sam@webkit.org>
2265
2266         [Conic Gradients] Add support for parsing conic gradients
2267         https://bugs.webkit.org/show_bug.cgi?id=178987
2268
2269         Reviewed by Dean Jackson.
2270
2271         Adds initial support, disabled by default, for parsing conic gradients as per
2272         CSS 4 Images - https://www.w3.org/TR/css-images-4/#conic-gradients.
2273
2274         Test: fast/gradients/conic-gradient-parsing.html
2275
2276         * css/CSSGradientValue.cpp:
2277         (WebCore::clone):
2278         (WebCore::CSSGradientValue::isCacheable const):
2279         (WebCore::CSSConicGradientValue::customCSSText const):
2280         (WebCore::CSSConicGradientValue::createGradient):
2281         (WebCore::CSSConicGradientValue::equals const):
2282         * css/CSSGradientValue.h:
2283         
2284             Add CSSConicGradientValue as a subclass of CSSGradientValue and implement
2285             customCSSText() and equals(). Stub out createGradient() as painting is not
2286             yet implemented.
2287         
2288         * css/CSSImageGeneratorValue.cpp:
2289         (WebCore::CSSImageGeneratorValue::image):
2290         (WebCore::CSSImageGeneratorValue::isFixedSize const):
2291         (WebCore::CSSImageGeneratorValue::fixedSize):
2292         (WebCore::CSSImageGeneratorValue::isPending const):
2293         (WebCore::CSSImageGeneratorValue::knownToBeOpaque const):
2294         (WebCore::CSSImageGeneratorValue::loadSubimages):
2295         * css/CSSValue.cpp:
2296         (WebCore::CSSValue::equals const):
2297         (WebCore::CSSValue::cssText const):
2298         (WebCore::CSSValue::destroy):
2299         
2300             Dispatch to CSSConicGradientValue as needed.
2301         
2302         * css/CSSValue.h:
2303         (WebCore::CSSValue::isImageGeneratorValue const):
2304         (WebCore::CSSValue::isGradientValue const):
2305         (WebCore::CSSValue::isConicGradientValue const):
2306         
2307             Add conic gradient predicate support and update isImageGeneratorValue and 
2308             isGradientValue to include conic gradient.
2309         
2310         * css/CSSValueKeywords.in:
2311         
2312             Add conic-gradient and repeating-conic-gradient.
2313         
2314         * css/parser/CSSParser.cpp:
2315         (WebCore::CSSParserContext::CSSParserContext):
2316         (WebCore::operator==):
2317         * css/parser/CSSParserMode.h:
2318         (WebCore::CSSParserContextHash::hash):
2319         
2320             Add runtime flags to enable conic gradients.
2321         
2322         * css/parser/CSSPropertyParserHelpers.cpp:
2323         (WebCore::CSSPropertyParserHelpers::consumeAngleOrPercent):
2324         
2325             Helper, similar to consumeLengthOrPercent, for consumeGradientColorStops. 
2326             Corresponds to https://drafts.csswg.org/css-values-4/#typedef-angle-percentage
2327         
2328         (WebCore::CSSPropertyParserHelpers::consumeGradientColorStops):
2329         
2330             Convert to take CSSGradientValue by reference.
2331         
2332         (WebCore::CSSPropertyParserHelpers::consumeAngularGradientColorStops):
2333         
2334             Helper, similar to consumeGradientColorStops, but for angular color stops
2335             used in conic gradients. Corresponds to https://www.w3.org/TR/css-images-4/#typedef-angular-color-stop-list
2336             but does not yet support double position syntax.
2337         
2338         (WebCore::CSSPropertyParserHelpers::consumeDeprecatedRadialGradient):
2339         (WebCore::CSSPropertyParserHelpers::consumeRadialGradient):
2340         (WebCore::CSSPropertyParserHelpers::consumeLinearGradient):
2341         
2342             Pass CSSGradientValue by reference.
2343         
2344         (WebCore::CSSPropertyParserHelpers::consumeConicGradient):
2345         
2346             Parse conic gradient.
2347         
2348         (WebCore::CSSPropertyParserHelpers::consumeGeneratedImage):
2349         
2350             Dispatch to consumeConicGradient for repeating and non-repeating
2351             conic gradients.
2352         
2353         (WebCore::CSSPropertyParserHelpers::isGeneratedImage):
2354         
2355             Put each value on its own line to make it more readable and add CSSValueConicGradient
2356             and CSSValueRepeatingConicGradient.
2357         
2358         * page/Settings.yaml:
2359         
2360             Add a setting to enable conic gradients. Disabled by default.
2361
2362         * features.json:
2363         
2364             Move conic gradients to "In Development".
2365
2366 2017-10-29  Antoine Quint  <graouts@apple.com>
2367
2368         [Web Animations] Expose the currentTime property on Animation
2369         https://bugs.webkit.org/show_bug.cgi?id=178988
2370
2371         Unreviewed.
2372
2373         Style fixes missed in previous patch.
2374
2375         * animation/WebAnimation.cpp:
2376         (WebCore::WebAnimation::setCurrentTime):
2377
2378 2017-10-29  Antoine Quint  <graouts@apple.com>
2379
2380         [Web Animations] Expose the currentTime property on Animation
2381         https://bugs.webkit.org/show_bug.cgi?id=178988
2382
2383         Reviewed by Dean Jackson.
2384
2385         We now expose the currentTime property on Animation objects, our first
2386         step in implementing the Web Animations timing model, specifically section
2387         3.5.4. "The current time of an animation" and section 3.5.5. "Setting the
2388         current time of an animation". Setting the startTime has implications on
2389         currentTime and vice-versa.
2390
2391         Test: webanimations/animation-current-time.html
2392
2393         * animation/WebAnimation.cpp:
2394         (WebCore::WebAnimation::setBindingsStartTime):
2395         (WebCore::WebAnimation::startTime const):
2396         (WebCore::WebAnimation::setStartTime):
2397         (WebCore::WebAnimation::bindingsCurrentTime const):
2398         (WebCore::WebAnimation::setBindingsCurrentTime):
2399         (WebCore::WebAnimation::currentTime const):
2400         (WebCore::WebAnimation::setCurrentTime):
2401         * animation/WebAnimation.h:
2402         * animation/WebAnimation.idl:
2403
2404 2017-10-29  Ryosuke Niwa  <rniwa@webkit.org>
2405
2406         Assert that no script is executed during style recalc
2407         https://bugs.webkit.org/show_bug.cgi?id=178845
2408         <rdar://problem/35106129>
2409
2410         Reviewed by Antti Koivisto.
2411
2412         This patch adds NoEventDispatchAssertion to Document::updateStyle and Document::updateStyleIfNeeded
2413         to make sure we don't start mutating DOM in the middle of a style update.
2414
2415         Added NoEventDispatchAssertion::EventAllowedScope for various places in SVGUseElement to update its
2416         shadow tree since that happens while updating the style.
2417
2418         No new tests since there should be no behavioral change.
2419
2420         * dom/Document.cpp:
2421         (WebCore::Document::resolveStyle): Added NoEventDispatchAssertion while flushing pending stylesheets
2422         and calling FrameView::willRecalcStyle, and while the style tree solver is in works. Also moved in
2423         the code to update the selection and schedule to dispatch a fake mouse event into the same scope.
2424         Also increment m_styleRecalcCount in the same code since post resolution callbacks could run author
2425         scripts which in turn trigger another (recursive) style recalc.
2426         (WebCore::Document::updateStyleIfNeeded): Put everything but the call to resolveStyle in a scope with
2427         NoEventDispatchAssertion.
2428         * dom/Element.cpp:
2429         (WebCore::Element::cloneElementWithChildren): Added NoEventDispatchAssertion::EventAllowedScope to the
2430         newly cloned element for SVG use element's shadow tree.
2431         (WebCore::Element::cloneElementWithoutChildren): Ditto.
2432         * dom/EventDispatcher.cpp:
2433         (WebCore::EventDispatcher::dispatchEvent): Make the assertion more precise to workaround the fact SVG
2434         use elements update its shadow tree in the middle of style updates. Also removed a redundant assertion
2435         since the result of NoEventDispatchAssertion::isEventDispatchAllowedInSubtree cannot chance without
2436         pushing or popoing the stack frame.
2437         * svg/SVGUseElement.cpp:
2438         (WebCore::SVGUseElement::clearShadowTree):
2439         (WebCore::SVGUseElement::updateShadowTree): Added NoEventDispatchAssertion to the user-agent shadow root
2440         of a SVG use element. Since this is a newly created shadow tree which hasn't been exposed to author
2441         scripts, it's safe to mutate them during the style recalc even though it's not the best design.
2442         (WebCore::SVGUseElement::cloneTarget const): Ditto.
2443         (WebCore::SVGUseElement::expandUseElementsInShadowTree const): Ditto.
2444         (WebCore::SVGUseElement::expandSymbolElementsInShadowTree const): Ditto.
2445         (WebCore::SVGUseElement::transferEventListenersToShadowTree const):
2446
2447 2017-10-28  Dean Jackson  <dino@apple.com>
2448
2449         createImageBitmap with HTMLCanvasElement
2450         https://bugs.webkit.org/show_bug.cgi?id=178984
2451         <rdar://problem/35238440>
2452
2453         Reviewed by Sam Weinig.
2454
2455         Implement createImageBitmap(HTMLCanvasElement).
2456
2457         While here, explicitly reject the promises for the
2458         methods we haven't yet implemented. I was hoping this
2459         would avoid a lengthy timeout in one of the imported
2460         WPT tests but, alas, it doesn't. However, it's still
2461         a good idea.
2462
2463         Extend internal WPT proposals to cover canvas creation.
2464
2465         * html/ImageBitmap.cpp:
2466         (WebCore::ImageBitmap::createPromise): Get the image from
2467         the canvas and draw it into a new ImageBitmap buffer.
2468
2469 2017-10-28  Myles C. Maxfield  <mmaxfield@apple.com>
2470
2471         [iOS] Unify Font::platformCharWidthInit() with macOS
2472         https://bugs.webkit.org/show_bug.cgi?id=178951
2473         <rdar://problem/7848198>
2474
2475         Reviewed by Zalan Bujtas.
2476
2477         The only reason these codepaths are different is because historically this codepath
2478         didn't work with GS fonts (which we don't use anymore).
2479
2480         Tests: fast/forms/search-styled.html
2481                fast/forms/text-control-intrinsic-widths.html
2482                fast/forms/textarea-width.html
2483
2484         * platform/graphics/cocoa/FontCocoa.mm:
2485         (WebCore::Font::platformCharWidthInit):
2486
2487 2017-10-28  Chris Dumez  <cdumez@apple.com>
2488
2489         self.ExtendableEvent / Client / Clients / WindowClient do not exist in a Service Worker
2490         https://bugs.webkit.org/show_bug.cgi?id=178976
2491
2492         Reviewed by Sam Weinig.
2493
2494         Test: http/tests/workers/service/ServiceWorkerGlobalScope-properties.html
2495
2496         * workers/service/ExtendableEvent.idl:
2497         * workers/service/FetchEvent.idl:
2498         Drop [Exposed=Worker] as there is already [Exposed=ServiceWorker] and
2499         ServiceWorkerGlobalScope inherits from WorkerGlobalScope. This is redundant
2500         and we would hit assertions and adding the global constructors at runtime
2501         when the feature is enabled, because the property already exists.
2502
2503 2017-10-28  Zalan Bujtas  <zalan@apple.com>
2504
2505         [FrameView::layout cleanup] Move core layout logic to a separate class.
2506         https://bugs.webkit.org/show_bug.cgi?id=178771
2507         <rdar://problem/35166542>
2508
2509         Reviewed by Simon Fraser.
2510
2511         Move layout code out from FrameView to LayoutContext.
2512
2513         LayoutContext holds all the layout related logic (scheduling, needsLayout, handling layout states),
2514         while scrolling, view sizing methods stay in FrameView.
2515         Having a dedicated LayoutContext allows to structure the code better.   
2516
2517         Covered by existing tests.
2518
2519         * Sources.txt:
2520         * WebCore.xcodeproj/project.pbxproj:
2521         * accessibility/AXObjectCache.cpp:
2522         (WebCore::rendererNeedsDeferredUpdate):
2523         * accessibility/AccessibilityObject.cpp:
2524         (WebCore::AccessibilityObject::updateBackingStore):
2525         * accessibility/AccessibilityRenderObject.cpp:
2526         (WebCore::AccessibilityRenderObject::textUnderElement const):
2527         (WebCore::AccessibilityRenderObject::layoutCount const):
2528         * dom/Document.cpp:
2529         (WebCore::Document::setVisualUpdatesAllowed):
2530         (WebCore::Document::resolveStyle):
2531         (WebCore::Document::updateStyleIfNeeded):
2532         (WebCore::Document::updateLayout):
2533         (WebCore::Document::updateLayoutIfDimensionsOutOfDate):
2534         (WebCore::Document::implicitClose):
2535         (WebCore::Document::isLayoutTimerActive):
2536         * dom/Element.cpp:
2537         (WebCore::Element::absoluteEventHandlerBounds):
2538         * editing/FrameSelection.cpp:
2539         (WebCore::FrameSelection::setSelection):
2540         * html/HTMLEmbedElement.cpp:
2541         (WebCore::HTMLEmbedElement::renderWidgetLoadingPlugin const):
2542         * html/HTMLFormControlElement.cpp:
2543         (WebCore::HTMLFormControlElement::didAttachRenderers):
2544         * inspector/InspectorOverlay.cpp:
2545         (WebCore::InspectorOverlay::update):
2546         * loader/FrameLoader.cpp:
2547         (WebCore::FrameLoader::stopForUserCancel):
2548         * page/Frame.cpp:
2549         (WebCore::Frame::setView):
2550         (WebCore::Frame::clearTimers):
2551         (WebCore::Frame::setPageAndTextZoomFactors):
2552         (WebCore::Frame::resumeActiveDOMObjectsAndAnimations):
2553         * page/FrameView.cpp:
2554         (WebCore::FrameView::FrameView):
2555         (WebCore::FrameView::~FrameView):
2556         (WebCore::FrameView::reset):
2557         (WebCore::FrameView::resetScrollbars):
2558         (WebCore::FrameView::didFirstLayout const):
2559         (WebCore::FrameView::willDestroyRenderTree):
2560         (WebCore::FrameView::didDestroyRenderTree):
2561         (WebCore::FrameView::setContentsSize):
2562         (WebCore::FrameView::calculateScrollbarModesForLayout):
2563         (WebCore::FrameView::updateCompositingLayersAfterStyleChange):
2564         (WebCore::FrameView::topContentInsetDidChange):
2565         (WebCore::FrameView::forceLayoutParentViewIfNeeded):
2566         (WebCore::FrameView::adjustScrollbarsForLayout):
2567         (WebCore::FrameView::willDoLayout): This takes care of the view related task right before entering render tree layout.
2568         (WebCore::FrameView::didLayout): post layout tasks.
2569         (WebCore::FrameView::shouldDeferScrollUpdateAfterContentSizeChange):
2570         (WebCore::FrameView::updateLayoutViewport):
2571         (WebCore::FrameView::maintainScrollPositionAtAnchor):
2572         (WebCore::FrameView::updateLayerPositionsAfterScrolling):
2573         (WebCore::FrameView::updateCompositingLayersAfterScrolling):
2574         (WebCore::FrameView::availableContentSizeChanged):
2575         (WebCore::FrameView::updateContentsSize):
2576         (WebCore::FrameView::needsLayout const):
2577         (WebCore::FrameView::setNeedsLayout):
2578         (WebCore::FrameView::scheduleSelectionUpdate):
2579         (WebCore::FrameView::updateEmbeddedObjects):
2580         (WebCore::FrameView::flushAnyPendingPostLayoutTasks):
2581         (WebCore::FrameView::flushPostLayoutTasksQueue):
2582         (WebCore::FrameView::performPostLayoutTasks):
2583         (WebCore::FrameView::sendResizeEventIfNeeded):
2584         (WebCore::FrameView::autoSizeIfEnabled):
2585         (WebCore::FrameView::paintControlTints):
2586         (WebCore::FrameView::paintContents):
2587         (WebCore::FrameView::updateLayoutAndStyleIfNeededRecursive):
2588         (WebCore::FrameView::enableAutoSizeMode):
2589         (WebCore::FrameView::forceLayout):
2590         (WebCore::SubtreeLayoutStateMaintainer::SubtreeLayoutStateMaintainer): Deleted.
2591         (WebCore::SubtreeLayoutStateMaintainer::~SubtreeLayoutStateMaintainer): Deleted.
2592         (WebCore::SubtreeLayoutStateMaintainer::shouldDisableLayoutStateForSubtree): Deleted.
2593         (): Deleted.
2594         (WebCore::RenderTreeNeedsLayoutChecker::~RenderTreeNeedsLayoutChecker): Deleted.
2595         (WebCore::applyTextSizingIfNeeded): Deleted.
2596         (WebCore::FrameView::handleLayoutWithFrameFlatteningIfNeeded): Deleted.
2597         (WebCore::FrameView::updateStyleForLayout): Deleted.
2598         (WebCore::FrameView::canPerformLayout const): Deleted.
2599         (WebCore::FrameView::layout): Deleted.
2600         (WebCore::FrameView::runOrSchedulePostLayoutTasks): Deleted.
2601         (WebCore::FrameView::convertSubtreeLayoutToFullLayout): Deleted.
2602         (WebCore::FrameView::layoutTimerFired): Deleted.
2603         (WebCore::FrameView::scheduleRelayout): Deleted.
2604         (WebCore::isObjectAncestorContainerOf): Deleted.
2605         (WebCore::FrameView::scheduleRelayoutOfSubtree): Deleted.
2606         (WebCore::FrameView::layoutPending const): Deleted.
2607         (WebCore::FrameView::unscheduleRelayout): Deleted.
2608         (WebCore::FrameView::startLayoutAtMainFrameViewIfNeeded): Deleted.
2609         * page/FrameView.h:
2610         * page/LayoutContext.cpp: Added.
2611         (WebCore::isObjectAncestorContainerOf):
2612         (WebCore::SubtreeLayoutStateMaintainer::SubtreeLayoutStateMaintainer):
2613         (WebCore::SubtreeLayoutStateMaintainer::~SubtreeLayoutStateMaintainer):
2614         (WebCore::SubtreeLayoutStateMaintainer::shouldDisableLayoutStateForSubtree):
2615         (WebCore::RenderTreeNeedsLayoutChecker::~RenderTreeNeedsLayoutChecker):
2616         (WebCore::LayoutScope::LayoutScope):
2617         (WebCore::LayoutScope::~LayoutScope):
2618         (WebCore::LayoutContext::LayoutContext):
2619         (WebCore::LayoutContext::layout):
2620         (WebCore::LayoutContext::runOrScheduleAsynchronousTasks):
2621         (WebCore::LayoutContext::runAsynchronousTasks):
2622         (WebCore::LayoutContext::flushAsynchronousTasks):
2623         (WebCore::LayoutContext::reset):
2624         (WebCore::LayoutContext::needsLayout const):
2625         (WebCore::LayoutContext::setNeedsLayout):
2626         (WebCore::LayoutContext::enableSetNeedsLayout):
2627         (WebCore::LayoutContext::disableSetNeedsLayout):
2628         (WebCore::LayoutContext::scheduleLayout):
2629         (WebCore::LayoutContext::unscheduleLayout):
2630         (WebCore::LayoutContext::scheduleSubtreeLayout):
2631         (WebCore::LayoutContext::layoutTimerFired):
2632         (WebCore::LayoutContext::convertSubtreeLayoutToFullLayout):
2633         (WebCore::LayoutContext::setSubtreeLayoutRoot):
2634         (WebCore::LayoutContext::canPerformLayout const):
2635         (WebCore::LayoutContext::applyTextSizingIfNeeded):
2636         (WebCore::LayoutContext::updateStyleForLayout):
2637         (WebCore::LayoutContext::handleLayoutWithFrameFlatteningIfNeeded):
2638         (WebCore::LayoutContext::startLayoutAtMainFrameViewIfNeeded):
2639         (WebCore::LayoutContext::frame const):
2640         (WebCore::LayoutContext::view const):
2641         (WebCore::LayoutContext::renderView const):
2642         (WebCore::LayoutContext::document const):
2643         * page/LayoutContext.h: Added.
2644         (WebCore::LayoutContext::startDisallowingLayout):
2645         (WebCore::LayoutContext::endDisallowingLayout):
2646         (WebCore::LayoutContext::layoutPhase const):
2647         (WebCore::LayoutContext::isLayoutNested const):
2648         (WebCore::LayoutContext::layoutCount const):
2649         (WebCore::LayoutContext::isLayoutPending const):
2650         (WebCore::LayoutContext::isInLayout const):
2651         (WebCore::LayoutContext::isInRenderTreeLayout const):
2652         (WebCore::LayoutContext::inPaintableState const):
2653         (WebCore::LayoutContext::subtreeLayoutRoot const):
2654         (WebCore::LayoutContext::clearSubtreeLayoutRoot):
2655         (WebCore::LayoutContext::resetFirstLayoutFlag):
2656         (WebCore::LayoutContext::didFirstLayout const):
2657         (WebCore::LayoutContext::setNeedsFullRepaint):
2658         (WebCore::LayoutContext::needsFullRepaint const):
2659         (WebCore::LayoutContext::layoutDisallowed const):
2660         (WebCore::LayoutContext::isLayoutSchedulingEnabled const):
2661         (WebCore::LayoutContext::inAsynchronousTasks const):
2662         * page/Page.cpp:
2663         (WebCore::Page::setPageScaleFactor):
2664         * rendering/RenderBlock.cpp:
2665         (WebCore::RenderBlock::insertPositionedObject):
2666         * rendering/RenderBox.cpp:
2667         (WebCore::RenderBox::imageChanged):
2668         (WebCore::RenderBox::computeLogicalWidthInFragment const):
2669         * rendering/RenderElement.cpp:
2670         (WebCore::RenderElement::clearSubtreeLayoutRootIfNeeded const):
2671         (WebCore::RenderElement::checkForRepaintDuringLayout const):
2672         * rendering/RenderFrameBase.cpp:
2673         (WebCore::RenderFrameBase::performLayoutWithFlattening):
2674         * rendering/RenderLayer.cpp:
2675         (WebCore::RenderLayer::scrollTo):
2676         * rendering/RenderObject.cpp:
2677         (WebCore::scheduleRelayoutForSubtree):
2678         * rendering/RenderTreeAsText.cpp:
2679         (WebCore::write):
2680         * rendering/RenderVideo.cpp:
2681         (WebCore::RenderVideo::updatePlayer):
2682         * rendering/RenderView.h:
2683         * rendering/RenderWidget.cpp:
2684         (WebCore::RenderWidget::updateWidgetPosition):
2685         * svg/graphics/SVGImage.cpp:
2686         (WebCore::SVGImage::draw):
2687         * testing/Internals.cpp:
2688         (WebCore::Internals::layoutCount const):
2689         
2690 2017-10-28  Joseph Pecoraro  <pecoraro@apple.com>
2691
2692         Cleanup PageDebuggable
2693         https://bugs.webkit.org/show_bug.cgi?id=178972
2694
2695         Reviewed by Sam Weinig.
2696
2697         * page/PageDebuggable.cpp:
2698         (WebCore::PageDebuggable::PageDebuggable):
2699         * page/PageDebuggable.h:
2700
2701 2017-10-28  Joseph Pecoraro  <pecoraro@apple.com>
2702
2703         Extract a WorkerDebuggerProxy interface out of WorkerReportingProxy
2704         https://bugs.webkit.org/show_bug.cgi?id=178975
2705
2706         Reviewed by Sam Weinig.
2707
2708         No new tests, just refactoring.
2709
2710         * workers/WorkerDebuggerProxy.h:
2711         * workers/WorkerReportingProxy.h:
2712         * WebCore.xcodeproj/project.pbxproj:
2713         Extract a method from WorkerReportingProxy to WorkerDebuggerProxy and
2714         rename it to be more general.
2715
2716         * inspector/WorkerToPageFrontendChannel.h:
2717         (WebCore::WorkerToPageFrontendChannel::sendMessageToFrontend):
2718         * workers/DedicatedWorkerThread.cpp:
2719         (WebCore::DedicatedWorkerThread::DedicatedWorkerThread):
2720         * workers/DedicatedWorkerThread.h:
2721         * workers/WorkerMessagingProxy.cpp:
2722         (WebCore::WorkerMessagingProxy::startWorkerGlobalScope):
2723         (WebCore::WorkerMessagingProxy::postMessageToDebugger):
2724         (WebCore::WorkerMessagingProxy::postMessageToPageInspector): Deleted.
2725         * workers/WorkerMessagingProxy.h:
2726         * workers/WorkerThread.cpp:
2727         (WebCore::WorkerThread::WorkerThread):
2728         * workers/WorkerThread.h:
2729         (WebCore::WorkerThread::workerDebuggerProxy const):
2730         * workers/service/context/ServiceWorkerThread.cpp:
2731         (WebCore::ServiceWorkerThread::ServiceWorkerThread):
2732         * workers/service/context/ServiceWorkerThread.h:
2733         * workers/service/context/ServiceWorkerThreadProxy.cpp:
2734         (WebCore::ServiceWorkerThreadProxy::create):
2735         (WebCore::ServiceWorkerThreadProxy::ServiceWorkerThreadProxy):
2736         Include a WorkerDebuggerProxy alongside the other proxies.
2737         Use the renamed debugger proxy method.
2738
2739 2017-10-28  Ryosuke Niwa  <rniwa@webkit.org>
2740
2741         Style::Scope::flushPendingUpdate() can replace the entire document in XSLTProcessor::createDocumentFromSource
2742         https://bugs.webkit.org/show_bug.cgi?id=178715
2743         <rdar://problem/35144665>
2744
2745         Reviewed by Brent Fulgham.
2746
2747         Apply XLS tranforms when a 0s timer fires or the document finishes parsing or loading whichever comes first
2748         instead of in the middle of collecting a list of stylesheets.
2749
2750         * dom/Document.cpp:
2751         (WebCore::Document::Document): Initialize the newly added timer.
2752         (WebCore::Document::implicitClose): Apply any pending XSLT before we fire load events since some of the event
2753         handlers may be expecting to see the document after XSLT had been applied.
2754         (WebCore::Document::scheduleToApplyXSLTransforms): Added.
2755         (WebCore::Document::applyPendingXSLTransformsNowIfScheduled): Added.
2756         (WebCore::Document::applyPendingXSLTransformsTimerFired): Added. Moved the logic to apply XSL transforms from
2757         Style::Scope::collectActiveStyleSheets, and merged applyXSLTransform into this function.
2758         (WebCore::Document::applyXSLTransform): Deleted.
2759         (WebCore::Document::finishedParsing): Apply XSLT right before updating the style. This is where used to apply
2760         inline XSLT and it happens much earlier than implicitClose.
2761         (WebCore::Document::suspendScheduledTasks): Suspend the XSLT timer.
2762         (WebCore::Document::resumeScheduledTasks): Reschedule the XSLT timer if m_hasPendingXSLTransforms is set.
2763         * dom/Document.h:
2764         * dom/ProcessingInstruction.cpp:
2765         (WebCore::ProcessingInstruction::checkStyleSheet): Schedule XSLT in the document instead of flushing pending
2766         stylesheets, which would have synchronously applied XSLT. We can't apply XSLT synchronously here because this
2767         function can be called from a non-script-resilient call stack.
2768         (WebCore::ProcessingInstruction::sheetLoaded): Ditto.
2769         * style/StyleScope.cpp:
2770         (WebCore::Style::Scope::collectXSLTransforms): Added.
2771         (WebCore::Style::Scope::collectActiveStyleSheets): Removed the code to apply XSLT. Skip ProcessingInstructions
2772         that applies XSLT. Also use RefPtr<StyleSheet> instead of a raw pointer to store StyleSheet.
2773         * style/StyleScope.h:
2774         * xml/parser/XMLDocumentParserLibxml2.cpp:
2775         (WebCore::XMLDocumentParser::doEnd): Apply any pending XSLTs synchronously here as the comment suggests.
2776
2777 2017-10-27  Devin Rousso  <webkit@devinrousso.com>
2778
2779         Web Inspector: Canvas Tab: no way to see backtrace of where a canvas context was created
2780         https://bugs.webkit.org/show_bug.cgi?id=178799
2781         <rdar://problem/35175805>
2782
2783         Reviewed by Brian Burg.
2784
2785         No new tests, updated existing tests.
2786
2787         * inspector/InspectorCanvas.h:
2788         * inspector/InspectorCanvas.cpp:
2789         (iterateCallFrames):
2790         (WebCore::InspectorCanvas::buildObjectForCanvas):
2791         (WebCore::InspectorCanvas::buildAction):
2792
2793         * inspector/InspectorCanvasAgent.cpp:
2794         (WebCore::InspectorCanvasAgent::didCreateCanvasRenderingContext):
2795         If the Canvas agent is enabled, generate a backtrace and send it to the frontend with the canvas.
2796         We do not do this for canvases created before the agent is enabled for performance reasons.
2797
2798 2017-10-27  Keith Miller  <keith_miller@apple.com>
2799
2800         Add unified source list files and build scripts to Xcode project navigator
2801         https://bugs.webkit.org/show_bug.cgi?id=178959
2802
2803         Reviewed by Andy Estes.
2804
2805         * WebCore.xcodeproj/project.pbxproj:
2806
2807 2017-10-27  Daniel Bates  <dabates@apple.com>
2808
2809         Only allow non-mixed content protected subresources to ask for credentials
2810         https://bugs.webkit.org/show_bug.cgi?id=178919
2811         <rdar://problem/35015245>
2812
2813         Reviewed by Alex Christensen.
2814
2815         Only allow non-mixed content protected subresources to ask for credentials. It is not meaningful
2816         to allow protected mixed-content subresources to ask for credentials.
2817
2818         Tests: http/tests/security/mixedContent/insecure-image-redirects-to-basic-auth-secure-image.html
2819                http/tests/security/mixedContent/insecure-script-redirects-to-basic-auth-secure-script.html
2820                http/tests/security/mixedContent/insecure-stylesheet-redirects-to-basic-auth-secure-stylesheet.html
2821                http/tests/security/mixedContent/secure-redirect-to-insecure-redirect-to-basic-auth-secure-image.https.html
2822                http/tests/security/mixedContent/secure-redirect-to-secure-redirect-to-basic-auth-insecure-image.https.html
2823                http/tests/security/mixedContent/secure-redirect-to-secure-redirect-to-basic-auth-secure-image.https.html
2824
2825         * loader/ResourceLoader.cpp:
2826         (WebCore::ResourceLoader::ResourceLoader): Initialize m_canAskClientForCredentials based on the
2827         specified resource loader options.
2828         (WebCore::ResourceLoader::init): Update m_canAskClientForCredentials based on the URL of the initial
2829         request.
2830         (WebCore::ResourceLoader::isMixedContent const): Helper function to check if the specified URL
2831         represents a mixed content resource.
2832         (WebCore::ResourceLoader::willSendRequestInternal): If the original request or the redirect request
2833         is mixed content then update state such that we will disallow asking for credentials.
2834         (WebCore::ResourceLoader::isAllowedToAskUserForCredentials const): Modified to use m_canAskClientForCredentials
2835         when determining whether the request is allowed to ask for credentials.
2836         * loader/ResourceLoader.h:
2837
2838 2017-10-27  Chris Dumez  <cdumez@apple.com>
2839
2840         Unskip more Service Workers tests
2841         https://bugs.webkit.org/show_bug.cgi?id=178944
2842
2843         Reviewed by Sam Weinig.
2844
2845         Drop bad assertion that was causing the Service Worker WebProcess to crash and causing
2846         tests to fail as a result.
2847
2848         * workers/service/ServiceWorkerGlobalScope.cpp:
2849         (WebCore::ServiceWorkerGlobalScope::registration):
2850         * workers/service/ServiceWorkerGlobalScope.h:
2851
2852 2017-10-27  Ryan Haddad  <ryanhaddad@apple.com>
2853
2854         Unreviewed, rolling out r224011.
2855
2856         xsl LayoutTests hit an assertion added with this change since
2857         r223999 was rolled out.
2858
2859         Reverted changeset:
2860
2861         "Assert that no script is executed during style recalc"
2862         https://bugs.webkit.org/show_bug.cgi?id=178845
2863         https://trac.webkit.org/changeset/224011
2864
2865 2017-10-27  Antoine Quint  <graouts@apple.com>
2866
2867         [Web Animations] Expose the currentTime property on AnimationTimeline
2868         https://bugs.webkit.org/show_bug.cgi?id=178928
2869
2870         Reviewed by Dean Jackson.
2871
2872         We add the currentTime property on AnimationTimeline and add an internals method
2873         to set it in a test which will allow us to validate the timing model state for
2874         a given time.
2875
2876         Test: webanimations/timeline-current-time.html
2877
2878         * animation/AnimationTimeline.cpp:
2879         (WebCore::AnimationTimeline::bindingsCurrentTime const):
2880         (WebCore::AnimationTimeline::setCurrentTime):
2881         * animation/AnimationTimeline.h:
2882         (WebCore::AnimationTimeline::currentTime const):
2883         * animation/AnimationTimeline.idl:
2884         * testing/Internals.cpp:
2885         (WebCore::Internals::setTimelineCurrentTime):
2886         * testing/Internals.h:
2887         * testing/Internals.idl:
2888
2889 2017-10-27  Antoine Quint  <graouts@apple.com>
2890
2891         [Web Animations] Use Seconds vs. MonotonicTime to represent times
2892         https://bugs.webkit.org/show_bug.cgi?id=178950
2893
2894         Reviewed by Dean Jackson.
2895
2896         Animation start times, all expressed in seconds, in the Web Animations API are relative to the timeline
2897         originTime, itself relative to the page's nagigation time (Performance.navigationTime), so it makes more
2898         sense to use Seconds to represent them as opposed to a MonotonicTime.
2899
2900         * animation/WebAnimation.cpp:
2901         (WebCore::WebAnimation::bindingsStartTime const):
2902         (WebCore::WebAnimation::setBindingsStartTime):
2903         * animation/WebAnimation.h:
2904
2905 2017-10-27  Chris Dumez  <cdumez@apple.com>
2906
2907         DOMWindow::dispatchEvent() does not reset the event's dispatch flag
2908         https://bugs.webkit.org/show_bug.cgi?id=178897
2909
2910         Reviewed by Darin Adler.
2911
2912         Make sure we reset the currentTarget, dispatch flag, phase and propagation flags
2913         after dispatching an event on a Window, as per:
2914         - https://dom.spec.whatwg.org/#concept-event-dispatch
2915
2916         This behavior is consistent with Firefox.
2917
2918         Test: fast/events/window-load-initEvent.html
2919
2920         * page/DOMWindow.cpp:
2921         (WebCore::DOMWindow::dispatchEvent):
2922
2923 2017-10-27  Keith Miller  <keith_miller@apple.com>
2924
2925         Move iOS specific sources to unified sources
2926         https://bugs.webkit.org/show_bug.cgi?id=178915
2927
2928         Rubber-stamped by Tim Horton.
2929
2930         * SourcesCocoa.txt:
2931         * SourcesIOS.txt:
2932         * SourcesMac.txt:
2933         * WebCore.xcodeproj/project.pbxproj:
2934
2935 2017-10-27  Eric Carlson  <eric.carlson@apple.com>
2936
2937         NowPlayingInfo should contain a unique identifier
2938         https://bugs.webkit.org/show_bug.cgi?id=178872
2939         <rdar://problem/34924012>
2940
2941         Unreviewed, build fix.
2942
2943         * platform/audio/ios/MediaSessionManagerIOS.mm:
2944         (WebCore::MediaSessionManageriOS::updateNowPlayingInfo): Call string.impl().hash() instead of
2945         string.existingHash() because the later will assert in a debug build if the hash hasn't
2946         been calculated yet.
2947         * platform/audio/mac/MediaSessionManagerMac.mm:
2948         (WebCore::MediaSessionManagerMac::updateNowPlayingInfo): Ditto.
2949
2950 2017-10-27  Alex Christensen  <achristensen@webkit.org>
2951
2952         Fix accessibility/mac/aria-label-on-label-element.html after r224074
2953         https://bugs.webkit.org/show_bug.cgi?id=178892
2954
2955         * accessibility/AccessibilityNodeObject.cpp:
2956         (WebCore::AccessibilityNodeObject::titleElementText const):
2957         (WebCore::AccessibilityNodeObject::ariaLabeledByText const):
2958         * accessibility/AccessibilityObject.h:
2959         (WebCore::AccessibilityText::AccessibilityText):
2960         Turns out my null checks changed behavior.  This undoes them.
2961
2962 2017-10-27  Ryan Haddad  <ryanhaddad@apple.com>
2963
2964         Unreviewed, rolling out r223999.
2965
2966         Caused xsl LayoutTest flakiness.
2967
2968         Reverted changeset:
2969
2970         "Style::Scope::flushPendingUpdate() can replace the entire
2971         document in XSLTProcessor::createDocumentFromSource"
2972         https://bugs.webkit.org/show_bug.cgi?id=178715
2973         https://trac.webkit.org/changeset/223999
2974
2975 2017-10-27  Chris Dumez  <cdumez@apple.com>
2976
2977         Audit init*Event() method to make sure they reset internal data members
2978         https://bugs.webkit.org/show_bug.cgi?id=178886
2979
2980         Reviewed by Ryosuke Niwa.
2981
2982         Audit init*Event() method to make sure they reset internal data members.
2983
2984         * dom/Event.cpp:
2985         (WebCore::Event::initEvent):
2986         * dom/KeyboardEvent.cpp:
2987         (WebCore::KeyboardEvent::initKeyboardEvent):
2988         * dom/MessageEvent.cpp:
2989         (WebCore::MessageEvent::initMessageEvent):
2990         * dom/MouseEvent.cpp:
2991         (WebCore::MouseEvent::initMouseEvent):
2992         * dom/MouseRelatedEvent.h:
2993         (WebCore::MouseRelatedEvent::setIsSimulated):
2994         * dom/TextEvent.cpp:
2995         (WebCore::TextEvent::initTextEvent):
2996         * dom/WheelEvent.cpp:
2997         (WebCore::WheelEvent::initWheelEvent):
2998
2999 2017-10-27  Chris Dumez  <cdumez@apple.com>
3000
3001         Add initial support for serviceWorkerClient.postMessage()
3002         https://bugs.webkit.org/show_bug.cgi?id=178794
3003
3004         Reviewed by Youenn Fablet.
3005
3006         Add initial support for serviceWorkerClient.postMessage():
3007         - https://w3c.github.io/ServiceWorker/#client-postmessage
3008
3009         It is now possible to do bi-directional communication with a service worker
3010         via postMessage().
3011
3012         No new tests, updated existing test.
3013
3014         * WebCore.xcodeproj/project.pbxproj:
3015         * dom/Document.cpp:
3016         (WebCore::generateDocumentIdentifier):
3017         (WebCore::Document::allDocumentsMap):
3018         (WebCore::Document::allDocuments):
3019         (WebCore::m_identifier):
3020         (WebCore::Document::~Document):
3021         * dom/Document.h:
3022         (WebCore::Document::identifier const):
3023         * dom/ScriptExecutionContext.cpp:
3024         (WebCore::ScriptExecutionContext::serviceWorkerContainer):
3025         * dom/ScriptExecutionContext.h:
3026         * workers/service/ServiceWorker.cpp:
3027         (WebCore::ServiceWorker::postMessage):
3028         * workers/service/ServiceWorkerClient.cpp:
3029         (WebCore::ServiceWorkerClient::ServiceWorkerClient):
3030         (WebCore::ServiceWorkerClient::~ServiceWorkerClient):
3031         (WebCore::ServiceWorkerClient::id const):
3032         (WebCore::ServiceWorkerClient::postMessage):
3033         * workers/service/ServiceWorkerClient.h:
3034         (WebCore::ServiceWorkerClient::create):
3035         * workers/service/ServiceWorkerClient.idl:
3036         * workers/service/ServiceWorkerClientIdentifier.h: Copied from Source/WebCore/workers/service/ServiceWorkerClient.idl.
3037         (WebCore::ServiceWorkerClientIdentifier::toString const):
3038         * workers/service/ServiceWorkerRegistration.cpp:
3039         (WebCore::ServiceWorkerRegistration::unregister):
3040         * workers/service/ServiceWorkerWindowClient.cpp:
3041         (WebCore::ServiceWorkerWindowClient::ServiceWorkerWindowClient):
3042         * workers/service/ServiceWorkerWindowClient.h:
3043         * workers/service/context/SWContextManager.cpp:
3044         (WebCore::SWContextManager::postMessageToServiceWorkerGlobalScope):
3045         * workers/service/context/SWContextManager.h:
3046         * workers/service/context/ServiceWorkerThread.cpp:
3047         (WebCore::ServiceWorkerThread::postMessageToServiceWorkerGlobalScope):
3048         * workers/service/context/ServiceWorkerThread.h:
3049         * workers/service/server/SWClientConnection.cpp:
3050         (WebCore::SWClientConnection::postMessageToServiceWorkerClient):
3051         * workers/service/server/SWClientConnection.h:
3052
3053 2017-10-27  Frederic Wang  <fwang@igalia.com>
3054
3055         Use auto for some variables in RenderLayerCompositor/Backing
3056         https://bugs.webkit.org/show_bug.cgi?id=178570
3057
3058         Reviewed by Darin Adler.
3059
3060         No new tests, behavior unchanged.
3061
3062         * rendering/RenderLayerBacking.cpp:
3063         (WebCore::canvasCompositingStrategy):
3064         (WebCore::RenderLayerBacking::RenderLayerBacking):
3065         (WebCore::computePageTiledBackingCoverage):
3066         (WebCore::RenderLayerBacking::layerWillBeDestroyed):
3067         (WebCore::RenderLayerBacking::updateBackdropFiltersGeometry):
3068         (WebCore::layerOrAncestorIsTransformedOrUsingCompositedScrolling):
3069         (WebCore::RenderLayerBacking::updateCompositedBounds):
3070         (WebCore::RenderLayerBacking::updateAfterWidgetResize):
3071         (WebCore::RenderLayerBacking::updateAfterLayout):
3072         (WebCore::RenderLayerBacking::updateConfiguration):
3073         (WebCore::ComputedOffsets::fromAncestorGraphicsLayer):
3074         (WebCore::RenderLayerBacking::updateGeometry):
3075         (WebCore::RenderLayerBacking::updateInternalHierarchy):
3076         (WebCore::RenderLayerBacking::positionOverflowControlsLayers):
3077         (WebCore::RenderLayerBacking::hasUnpositionedOverflowControlsLayers const):
3078         (WebCore::RenderLayerBacking::compositingOpacity const):
3079         (WebCore::isRestartedPlugin):
3080         (WebCore::RenderLayerBacking::isDirectlyCompositedImage const):
3081         (WebCore::RenderLayerBacking::updateImageContents):
3082         (WebCore::RenderLayerBacking::setContentsNeedDisplay):
3083         (WebCore::RenderLayerBacking::setContentsNeedDisplayInRect):
3084         (WebCore::RenderLayerBacking::getCurrentTransform const):
3085         (WebCore::RenderLayerBacking::logFilledVisibleFreshTile):
3086         (WebCore::RenderLayerBacking::startAnimation):
3087         (WebCore::RenderLayerBacking::compositedBoundsIncludingMargin const):
3088         * rendering/RenderLayerCompositor.cpp:
3089         (WebCore::RenderLayerCompositor::flushPendingLayerChanges):
3090         (WebCore::RenderLayerCompositor::updateScrollCoordinatedLayersAfterFlushIncludingSubframes):
3091         (WebCore::updateScrollingLayerWithClient):
3092         (WebCore::RenderLayerCompositor::didFlushChangesForLayer):
3093         (WebCore::RenderLayerCompositor::didPaintBacking):
3094         (WebCore::RenderLayerCompositor::didChangeVisibleRect):
3095         (WebCore::RenderLayerCompositor::enclosingCompositorFlushingLayers const):
3096         (WebCore::RenderLayerCompositor::updateCompositingLayers):
3097         (WebCore::RenderLayerCompositor::appendDocumentOverlayLayers):
3098         (WebCore::RenderLayerCompositor::logLayerInfo):
3099         (WebCore::checkIfDescendantClippingContextNeedsUpdate):
3100         (WebCore::styleChangeRequiresLayerRebuild):
3101         (WebCore::RenderLayerCompositor::canCompositeClipPath):
3102         (WebCore::rendererForCompositingTests):
3103         (WebCore::RenderLayerCompositor::updateBacking):
3104         (WebCore::RenderLayerCompositor::repaintOnCompositingChange):
3105         (WebCore::RenderLayerCompositor::repaintInCompositedAncestor):
3106         (WebCore::RenderLayerCompositor::enclosingNonStackingClippingLayer const):
3107         (WebCore::RenderLayerCompositor::setCompositingParent):
3108         (WebCore::RenderLayerCompositor::rebuildCompositingLayerTree):
3109         (WebCore::RenderLayerCompositor::hasCoordinatedScrolling const):
3110         (WebCore::RenderLayerCompositor::updateScrollLayerPosition):
3111         (WebCore::RenderLayerCompositor::positionForClipLayer const):
3112         (WebCore::RenderLayerCompositor::frameViewDidLayout):
3113         (WebCore::RenderLayerCompositor::rootFixedBackgroundsChanged):
3114         (WebCore::RenderLayerCompositor::scrollingLayerDidChange):
3115         (WebCore::RenderLayerCompositor::frameContentsCompositor):
3116         (WebCore::RenderLayerCompositor::parentFrameContentLayers):
3117         (WebCore::RenderLayerCompositor::updateLayerTreeGeometry):
3118         (WebCore::RenderLayerCompositor::updateCompositingDescendantGeometry):
3119         (WebCore::RenderLayerCompositor::setIsInWindow):
3120         (WebCore::RenderLayerCompositor::clearBackingForLayerIncludingDescendants):
3121         (WebCore::RenderLayerCompositor::clippedByAncestor const):
3122         (WebCore::RenderLayerCompositor::requiresCompositingForBackfaceVisibility const):
3123         (WebCore::RenderLayerCompositor::requiresCompositingForCanvas const):
3124         (WebCore::RenderLayerCompositor::requiresCompositingForPlugin const):
3125         (WebCore::RenderLayerCompositor::requiresCompositingForAnimation const):
3126         (WebCore::RenderLayerCompositor::requiresCompositingForIndirectReason const):
3127         (WebCore::RenderLayerCompositor::isAsyncScrollableStickyLayer const):
3128         (WebCore::RenderLayerCompositor::isViewportConstrainedFixedOrStickyLayer const):
3129         (WebCore::RenderLayerCompositor::requiresScrollLayer const):
3130         (WebCore::RenderLayerCompositor::supportsFixedRootBackgroundCompositing const):
3131         (WebCore::RenderLayerCompositor::fixedRootBackgroundLayer const):
3132         (WebCore::RenderLayerCompositor::resetTrackedRepaintRects):
3133         (WebCore::RenderLayerCompositor::contentsScaleMultiplierForNewTiles const):
3134         (WebCore::RenderLayerCompositor::documentUsesTiledBacking const):
3135         (WebCore::RenderLayerCompositor::shouldCompositeOverflowControls const):
3136         (WebCore::RenderLayerCompositor::updateLayerForHeader):
3137         (WebCore::RenderLayerCompositor::updateLayerForFooter):
3138         (WebCore::RenderLayerCompositor::updateOverflowControlsLayers):
3139         (WebCore::RenderLayerCompositor::ensureRootLayer):
3140         (WebCore::RenderLayerCompositor::destroyRootLayer):
3141         (WebCore::RenderLayerCompositor::attachRootLayer):
3142         (WebCore::RenderLayerCompositor::detachRootLayer):
3143         (WebCore::RenderLayerCompositor::rootLayerAttachmentChanged):
3144         (WebCore::RenderLayerCompositor::notifyIFramesOfCompositingChange):
3145         (WebCore::RenderLayerCompositor::deviceOrPageScaleFactorChanged):
3146         (WebCore::RenderLayerCompositor::computeFixedViewportConstraints const):
3147         (WebCore::RenderLayerCompositor::computeStickyViewportConstraints const):
3148         (WebCore::enclosingScrollingNodeID):
3149         (WebCore::scrollCoordinatedAncestorInParentOfFrame):
3150         (WebCore::RenderLayerCompositor::reattachSubframeScrollLayers):
3151         (WebCore::RenderLayerCompositor::attachScrollingNode):
3152         (WebCore::RenderLayerCompositor::detachScrollCoordinatedLayer):
3153         (WebCore::RenderLayerCompositor::updateScrollCoordinationForThisFrame):
3154         (WebCore::RenderLayerCompositor::updateScrollCoordinatedLayer):
3155         (WebCore::RenderLayerCompositor::unregisterAllScrollingLayers):
3156         (WebCore::RenderLayerCompositor::willRemoveScrollingLayerWithBacking):
3157         (WebCore::RenderLayerCompositor::didAddScrollingLayer):
3158         (WebCore::RenderLayerCompositor::updateScrollSnapPropertiesWithFrameView):
3159
3160 2017-10-27  Alicia Boya García  <aboya@igalia.com>
3161
3162         [GStreamer][MSE] Trim space between codecs
3163         https://bugs.webkit.org/show_bug.cgi?id=178160
3164
3165         Reviewed by Xabier Rodriguez-Calvar.
3166
3167         Modify supportsCodecs() to accept a Vector<String> instead of
3168         receiving a string and parsing itself.
3169
3170         This improves passrate for `mediasource-is-type-supported` as it
3171         ensures that whitespace between codecs is now trimmed and codec
3172         strings such as `video/webm;codecs="opus, vp9"` are matched as a valid
3173         type, as required by the spec.
3174
3175         This patch also renames supportCodecs() to supportAllCodecs() and adds
3176         a new variant, supportCodec(), that checks for support of an
3177         individual codec.
3178
3179         * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
3180         (WebCore::AppendPipeline::parseDemuxerSrcPadCaps):
3181         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
3182         (WebCore::MediaPlayerPrivateGStreamerMSE::supportsCodec):
3183         (WebCore::MediaPlayerPrivateGStreamerMSE::supportsAllCodecs):
3184         (WebCore::MediaPlayerPrivateGStreamerMSE::supportsType):
3185         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.h:
3186
3187 2017-10-27  Michael Catanzaro  <mcatanzaro@igalia.com>
3188
3189         [GTK] Crash in WebCore::SelectionRangeData::apply
3190         https://bugs.webkit.org/show_bug.cgi?id=177808
3191
3192         Reviewed by Carlos Garcia Campos.
3193
3194         The problem appears to be a name collision between WebCore::SelectionData and
3195         WebCore::SelectionData. Yes, those are the same names. It seems the destructor for a
3196         Source/WebCore/platform/gtk/SelectionData.h SelectionData is being called on a
3197         Source/WebCore/rendering/SelectionRangeData.cpp SelectionData. Yikes. Can you forgive the
3198         poor linker for not being magic?
3199
3200         This fixes crashes in approximately one bajillion tests.
3201
3202         * rendering/SelectionRangeData.cpp: Move SelectionData into an anonymous namespace.
3203
3204 2017-10-26  Basuke Suzuki  <Basuke.Suzuki@sony.com>
3205
3206         [WinCairo] Fix build after WebCore moves to unified source.
3207         https://bugs.webkit.org/show_bug.cgi?id=178920
3208
3209         Added empty implementations to fix link error.
3210
3211         Reviewed by Ryosuke Niwa.
3212
3213         * platform/network/curl/DNSCurl.cpp:
3214         (WebCore::DNSResolveQueue::updateIsUsingProxy):
3215         (WebCore::DNSResolveQueue::platformResolve):
3216
3217 2017-10-26  Jeremy Jones  <jeremyj@apple.com>
3218
3219         Implement seek tolerance methods in WebAVPlayerController.
3220         https://bugs.webkit.org/show_bug.cgi?id=178838
3221         rdar://problem/33781777
3222
3223         Reviewed by Eric Carlson.
3224
3225         No new tests because this doesn't change any behavior in the page, but exposes seek tolerance to fullscreen platform UI.
3226
3227         * html/HTMLMediaElement.cpp:
3228         (WebCore::HTMLMediaElement::setCurrentTimeWithTolerance):
3229         * html/HTMLMediaElement.h:
3230         * platform/cocoa/PlaybackSessionModel.h:
3231         * platform/cocoa/PlaybackSessionModelMediaElement.h:
3232         * platform/cocoa/PlaybackSessionModelMediaElement.mm:
3233         (WebCore::PlaybackSessionModelMediaElement::seekToTime):
3234         * platform/ios/WebAVPlayerController.mm:
3235         (-[WebAVPlayerController seekToTime:]):
3236         (-[WebAVPlayerController seekToTime:toleranceBefore:toleranceAfter:]):
3237         (-[WebAVPlayerController seekByTimeInterval:]):
3238         (-[WebAVPlayerController seekByTimeInterval:toleranceBefore:toleranceAfter:]):
3239         (-[WebAVPlayerController seekToBeginning:]):
3240         (-[WebAVPlayerController seekToEnd:]):
3241         * platform/ios/WebVideoFullscreenControllerAVKit.mm:
3242         (VideoFullscreenControllerContext::seekToTime):
3243
3244 2017-10-26  Michael Catanzaro  <mcatanzaro@igalia.com>
3245
3246         Unreviewed, fix WPE build after r224074
3247         https://bugs.webkit.org/show_bug.cgi?id=178892
3248
3249         * accessibility/wpe/AccessibilityObjectWPE.cpp:
3250         (WebCore::AccessibilityObject::accessibilityPlatformIncludesObject const):
3251
3252 2017-10-25  Simon Fraser  <simon.fraser@apple.com>
3253
3254         When navigating back to a page, compositing layers may not use accelerated drawing
3255         https://bugs.webkit.org/show_bug.cgi?id=178749
3256         rdar://problem/35158946
3257
3258         Reviewed by Dean Jackson.
3259
3260         There were two issues with setting GraphicsLayerCA's "acceleratesDrawing" state which
3261         occurred on back navigation, related to the ordering of style recalcs and layout.
3262
3263         First, at style recalc time, we created a RenderLayerCompositor but hadn't yet called
3264         its cacheAcceleratedCompositingFlags(), so any layers created during style update
3265         didn't get accelerated drawing. Fix by making cacheAcceleratedCompositingFlags() internal
3266         to RenderLayerCompositor and calling it from willRecalcStyle() and updateCompositingLayers().
3267
3268         Secondly, GraphicsLayerCA::commitLayerChangesBeforeSublayers() needs to updateAcceleratesDrawing()
3269         before updating tiles, so that new tiles fetch the right acceleratesDrawing state from
3270         the TileController.
3271
3272         Test: compositing/accelerated-layers-after-back.html
3273
3274         * page/FrameView.cpp:
3275         (WebCore::FrameView::updateCompositingLayersAfterLayout):
3276         * platform/graphics/ca/GraphicsLayerCA.cpp:
3277         (WebCore::GraphicsLayerCA::commitLayerChangesBeforeSublayers):
3278         * rendering/RenderLayerCompositor.cpp:
3279         (WebCore::RenderLayerCompositor::willRecalcStyle):
3280         (WebCore::RenderLayerCompositor::didRecalcStyleWithNoPendingLayout):
3281         (WebCore::RenderLayerCompositor::updateCompositingLayers):
3282         * rendering/RenderLayerCompositor.h:
3283
3284 2017-10-26  Alex Christensen  <achristensen@webkit.org>
3285
3286         Fix Windows build
3287         https://bugs.webkit.org/show_bug.cgi?id=178892
3288
3289         * accessibility/win/AccessibilityObjectWin.cpp:
3290         (WebCore::AccessibilityObject::accessibilityPlatformIncludesObject const):
3291
3292 2017-10-26  Alex Christensen  <achristensen@webkit.org>
3293
3294         Modernize AccessibilityObject.h
3295         https://bugs.webkit.org/show_bug.cgi?id=178892
3296
3297         Reviewed by Tim Horton.
3298
3299         The enums in AccessibilityObject.h are causing naming collisions with unified builds.
3300         This is what enum classes are for.
3301         HashMaps of enum classes still need a few casts to/from int.
3302         
3303         I also made some RefPtr's Ref's, use some initializer lists instead of values in the constructor implementation, and indentation fixing.
3304         
3305         No change in behavior.
3306
3307         * accessibility/AXObjectCache.cpp:
3308         (WebCore::AXComputedObjectAttributeCache::getIgnored const):
3309         (WebCore::AXObjectCache::~AXObjectCache):
3310         (WebCore::AXObjectCache::getOrCreate):
3311         (WebCore::AXObjectCache::remove):
3312         (WebCore::AXObjectCache::notificationPostTimerFired):
3313         * accessibility/AXObjectCache.h:
3314         (WebCore::AXComputedObjectAttributeCache::CachedAXObjectAttributes::CachedAXObjectAttributes):
3315         (WebCore::AXComputedObjectAttributeCache::getIgnored const):
3316         * accessibility/AccessibilityARIAGrid.cpp:
3317         (WebCore::AccessibilityARIAGrid::addChildren):
3318         * accessibility/AccessibilityARIAGridCell.cpp:
3319         (WebCore::AccessibilityARIAGridCell::parentRowGroup const):
3320         * accessibility/AccessibilityARIAGridRow.cpp:
3321         (WebCore::AccessibilityARIAGridRow::headerObject):
3322         * accessibility/AccessibilityAttachment.cpp:
3323         (WebCore::AccessibilityAttachment::accessibilityText):
3324         * accessibility/AccessibilityAttachment.h:
3325         * accessibility/AccessibilityImageMapLink.cpp:
3326         (WebCore::AccessibilityImageMapLink::roleValue const):
3327         (WebCore::AccessibilityImageMapLink::accessibilityText):
3328         * accessibility/AccessibilityLabel.cpp:
3329         (WebCore::childrenContainOnlyStaticText):
3330         * accessibility/AccessibilityLabel.h:
3331         * accessibility/AccessibilityList.cpp:
3332         (WebCore::AccessibilityList::isUnorderedList const):
3333         (WebCore::AccessibilityList::isOrderedList const):
3334         (WebCore::AccessibilityList::determineAccessibilityRole):
3335         (WebCore::AccessibilityList::roleValue const):
3336         * accessibility/AccessibilityListBox.cpp:
3337         (WebCore::AccessibilityListBox::setSelectedChildren):
3338         (WebCore::AccessibilityListBox::listBoxOptionAccessibilityObject const):
3339         * accessibility/AccessibilityListBox.h:
3340         * accessibility/AccessibilityListBoxOption.h:
3341         * accessibility/AccessibilityMathMLElement.cpp:
3342         (WebCore::AccessibilityMathMLElement::determineAccessibilityRole):
3343         (WebCore::AccessibilityMathMLElement::isMathScriptObject const):
3344         (WebCore::AccessibilityMathMLElement::isMathMultiscriptObject const):
3345         * accessibility/AccessibilityMediaControls.cpp:
3346         (WebCore::AccessibilityMediaControl::accessibilityText):
3347         (WebCore::AccessibilityMediaControl::roleValue const):
3348         * accessibility/AccessibilityMediaControls.h:
3349         * accessibility/AccessibilityMenuList.cpp:
3350         (WebCore::AccessibilityMenuList::addChildren):
3351         * accessibility/AccessibilityMenuList.h:
3352         * accessibility/AccessibilityMenuListOption.h:
3353         * accessibility/AccessibilityMenuListPopup.cpp:
3354         (WebCore::AccessibilityMenuListPopup::menuListOptionAccessibilityObject const):
3355         * accessibility/AccessibilityMenuListPopup.h:
3356         * accessibility/AccessibilityNodeObject.cpp:
3357         (WebCore::AccessibilityNodeObject::AccessibilityNodeObject):
3358         (WebCore::AccessibilityNodeObject::determineAccessibilityRole):
3359         (WebCore::AccessibilityNodeObject::canHaveChildren const):
3360         (WebCore::AccessibilityNodeObject::computeAccessibilityIsIgnored const):
3361         (WebCore::AccessibilityNodeObject::isSearchField const):
3362         (WebCore::AccessibilityNodeObject::isImage const):
3363         (WebCore::AccessibilityNodeObject::isPasswordField const):
3364         (WebCore::AccessibilityNodeObject::isInputImage const):
3365         (WebCore::AccessibilityNodeObject::isProgressIndicator const):
3366         (WebCore::AccessibilityNodeObject::isSlider const):
3367         (WebCore::AccessibilityNodeObject::isMenuRelated const):
3368         (WebCore::AccessibilityNodeObject::isMenu const):
3369         (WebCore::AccessibilityNodeObject::isMenuBar const):
3370         (WebCore::AccessibilityNodeObject::isMenuButton const):
3371         (WebCore::AccessibilityNodeObject::isMenuItem const):
3372         (WebCore::AccessibilityNodeObject::isEnabled const):
3373         (WebCore::AccessibilityNodeObject::isChecked const):
3374         (WebCore::AccessibilityNodeObject::supportsRequiredAttribute const):
3375         (WebCore::AccessibilityNodeObject::headingLevel const):
3376         (WebCore::AccessibilityNodeObject::isHeading const):
3377         (WebCore::AccessibilityNodeObject::isLink const):
3378         (WebCore::AccessibilityNodeObject::isGroup const):
3379         (WebCore::AccessibilityNodeObject::selectedRadioButton):
3380         (WebCore::AccessibilityNodeObject::checkboxOrRadioValue const):
3381         (WebCore::AccessibilityNodeObject::actionElement const):
3382         (WebCore::AccessibilityNodeObject::alterSliderValue):
3383         (WebCore::AccessibilityNodeObject::isGenericFocusableElement const):
3384         (WebCore::AccessibilityNodeObject::menuElementForMenuButton const):
3385         (WebCore::AccessibilityNodeObject::menuItemElementForMenu const):
3386         (WebCore::AccessibilityNodeObject::titleElementText const):
3387         (WebCore::AccessibilityNodeObject::alternativeText const):
3388         (WebCore::AccessibilityNodeObject::visibleText const):
3389         (WebCore::AccessibilityNodeObject::helpText const):
3390         (WebCore::AccessibilityNodeObject::accessibilityText):
3391         (WebCore::AccessibilityNodeObject::ariaLabeledByText const):
3392         (WebCore::AccessibilityNodeObject::accessibilityDescription const):
3393         (WebCore::AccessibilityNodeObject::roleIgnoresTitle const):
3394         (WebCore::AccessibilityNodeObject::hierarchicalLevel const):
3395         (WebCore::AccessibilityNodeObject::title const):
3396         (WebCore::AccessibilityNodeObject::text const):
3397         (WebCore::AccessibilityNodeObject::stringValue const):
3398         (WebCore::AccessibilityNodeObject::determineAriaRoleAttribute const):
3399         (WebCore::AccessibilityNodeObject::remapAriaRoleDueToParent const):
3400         (WebCore::AccessibilityNodeObject::canSetSelectedAttribute const):
3401         * accessibility/AccessibilityNodeObject.h:
3402         * accessibility/AccessibilityObject.cpp:
3403         (WebCore::AccessibilityObject::detach):
3404         (WebCore::AccessibilityObject::isAccessibilityObjectSearchMatchAtIndex):
3405         (WebCore::AccessibilityObject::accessibleNameDerivesFromContent const):
3406         (WebCore::AccessibilityObject::isBlockquote const):
3407         (WebCore::AccessibilityObject::isTextControl const):
3408         (WebCore::AccessibilityObject::isARIATextControl const):
3409         (WebCore::AccessibilityObject::isLandmark const):
3410         (WebCore::AccessibilityObject::findMatchingObjects):
3411         (WebCore::AccessibilityObject::rangeOfStringClosestToRangeInDirection const):
3412         (WebCore::AccessibilityObject::selectText):
3413         (WebCore::AccessibilityObject::isARIAInput):
3414         (WebCore::AccessibilityObject::isARIAControl):
3415         (WebCore::AccessibilityObject::isRangeControl const):
3416         (WebCore::AccessibilityObject::visiblePositionForBounds const):
3417         (WebCore::AccessibilityObject::supportsARIAReadOnly const):
3418         (WebCore::AccessibilityObject::ariaReadOnlyValue const):
3419         (WebCore::AccessibilityObject::headingElementForNode):
3420         (WebCore::AccessibilityObject::ariaTreeRows):
3421         (WebCore::AccessibilityObject::ariaTreeItemContent):
3422         (WebCore::AccessibilityObject::ariaTreeItemDisclosedRows):
3423         (WebCore::AccessibilityObject::defaultLiveRegionStatusForRole):
3424         (WebCore::AccessibilityObject::actionVerb const):
3425         (WebCore::AccessibilityObject::ariaCurrentState const):
3426         (WebCore::AccessibilityObject::ariaCurrentValue const):
3427         (WebCore::AccessibilityObject::orientation const):
3428         (WebCore::initializeRoleMap):
3429         (WebCore::AccessibilityObject::ariaRoleToWebCoreRole):
3430         (WebCore::AccessibilityObject::computedRoleString const):
3431         (WebCore::AccessibilityObject::supportsPressAction const):
3432         (WebCore::AccessibilityObject::sortDirection const):
3433         (WebCore::AccessibilityObject::supportsExpanded const):
3434         (WebCore::AccessibilityObject::isExpanded const):
3435         (WebCore::AccessibilityObject::supportsChecked const):
3436         (WebCore::AccessibilityObject::checkboxOrRadioValue const):
3437         (WebCore::AccessibilityObject::scrollByPage const):
3438         (WebCore::AccessibilityObject::lastKnownIsIgnoredValue):
3439         (WebCore::AccessibilityObject::setLastKnownIsIgnoredValue):
3440         (WebCore::AccessibilityObject::buttonRoleType const):
3441         (WebCore::AccessibilityObject::isButton const):
3442         (WebCore::AccessibilityObject::accessibilityIsIgnoredByDefault const):
3443         (WebCore::AccessibilityObject::defaultObjectInclusion const):
3444         (WebCore::AccessibilityObject::accessibilityIsIgnored const):
3445         (WebCore::AccessibilityObject::isContainedByPasswordField const):
3446         (WebCore::AccessibilityObject::AccessibilityObject): Deleted.
3447         * accessibility/AccessibilityObject.h:
3448         (WebCore::AccessibilityText::AccessibilityText):
3449         (WebCore::AccessibilityIsIgnoredFromParentData::AccessibilityIsIgnoredFromParentData):
3450         (WebCore::AccessibilityObject::isImageMap const):
3451         (WebCore::AccessibilityObject::isWebArea const):
3452         (WebCore::AccessibilityObject::isCheckbox const):
3453         (WebCore::AccessibilityObject::isRadioButton const):
3454         (WebCore::AccessibilityObject::isListBox const):
3455         (WebCore::AccessibilityObject::isSpinButton const):
3456         (WebCore::AccessibilityObject::isSwitch const):
3457         (WebCore::AccessibilityObject::isToggleButton const):
3458         (WebCore::AccessibilityObject::isTabList const):
3459         (WebCore::AccessibilityObject::isTabItem const):
3460         (WebCore::AccessibilityObject::isRadioGroup const):
3461         (WebCore::AccessibilityObject::isComboBox const):
3462         (WebCore::AccessibilityObject::isTree const):
3463         (WebCore::AccessibilityObject::isTreeGrid const):
3464         (WebCore::AccessibilityObject::isTreeItem const):
3465         (WebCore::AccessibilityObject::isScrollbar const):
3466         (WebCore::AccessibilityObject::isListItem const):
3467         (WebCore::AccessibilityObject::isScrollView const):
3468         (WebCore::AccessibilityObject::isCanvas const):
3469         (WebCore::AccessibilityObject::isPopUpButton const):
3470         (WebCore::AccessibilityObject::isColorWell const):
3471         (WebCore::AccessibilityObject::isSplitter const):
3472         (WebCore::AccessibilityObject::isToolbar const):
3473         (WebCore::AccessibilityObject::isSummary const):
3474         (WebCore::AccessibilityObject::isStaticText const):
3475         (WebCore::AccessibilityObject::ariaRoleAttribute const):
3476         (WebCore::AccessibilityObject::accessibilityPlatformIncludesObject const):
3477         * accessibility/AccessibilityProgressIndicator.h:
3478         * accessibility/AccessibilityRenderObject.cpp:
3479         (WebCore::AccessibilityRenderObject::parentObject const):
3480         (WebCore::AccessibilityRenderObject::isAttachment const):
3481         (WebCore::AccessibilityRenderObject::helpText const):
3482         (WebCore::AccessibilityRenderObject::stringValue const):
3483         (WebCore::AccessibilityRenderObject::addRadioButtonGroupChildren const):
3484         (WebCore::AccessibilityRenderObject::addRadioButtonGroupMembers const):
3485         (WebCore::AccessibilityRenderObject::linkedUIElements const):
3486         (WebCore::AccessibilityRenderObject::isAllowedChildOfTree const):
3487         (WebCore::objectInclusionFromAltText):
3488         (WebCore::AccessibilityRenderObject::defaultObjectInclusion const):
3489         (WebCore::AccessibilityRenderObject::computeAccessibilityIsIgnored const):
3490         (WebCore::AccessibilityRenderObject::selectedTextRange const):
3491         (WebCore::AccessibilityRenderObject::isTabItemSelected const):
3492         (WebCore::AccessibilityRenderObject::isFocused const):
3493         (WebCore::AccessibilityRenderObject::setSelectedRows):
3494         (WebCore::AccessibilityRenderObject::getDocumentLinks):
3495         (WebCore::AccessibilityRenderObject::shouldFocusActiveDescendant const):
3496         (WebCore::AccessibilityRenderObject::handleAriaExpandedChanged):
3497         (WebCore::AccessibilityRenderObject::supportsExpandedTextValue const):
3498         (WebCore::AccessibilityRenderObject::determineAccessibilityRole):
3499         (WebCore::AccessibilityRenderObject::orientation const):
3500         (WebCore::AccessibilityRenderObject::inheritsPresentationalRole const):
3501         (WebCore::AccessibilityRenderObject::ariaRoleHasPresentationalChildren const):
3502         (WebCore::AccessibilityRenderObject::canSetExpandedAttribute const):
3503         (WebCore::AccessibilityRenderObject::addImageMapChildren):
3504         (WebCore::AccessibilityRenderObject::addTextFieldChildren):
3505         (WebCore::AccessibilityRenderObject::updateRoleAfterChildrenCreation):
3506         (WebCore::AccessibilityRenderObject::ariaLiveRegionAtomic const):
3507         (WebCore::AccessibilityRenderObject::canHaveSelectedChildren const):
3508         (WebCore::AccessibilityRenderObject::ariaListboxSelectedChildren):
3509         (WebCore::AccessibilityRenderObject::selectedChildren):
3510         (WebCore::AccessibilityRenderObject::visibleChildren):
3511         (WebCore::AccessibilityRenderObject::tabChildren):
3512         (WebCore::AccessibilityRenderObject::actionVerb const):
3513         (WebCore::msaaRoleForRenderer):
3514         (WebCore::AccessibilityRenderObject::roleValueForMSAA const):
3515         * accessibility/AccessibilitySVGElement.cpp:
3516         (WebCore::AccessibilitySVGElement::accessibilityText):
3517         (WebCore::AccessibilitySVGElement::computeAccessibilityIsIgnored const):
3518         (WebCore::AccessibilitySVGElement::inheritsPresentationalRole const):
3519         (WebCore::AccessibilitySVGElement::determineAriaRoleAttribute const):
3520         (WebCore::AccessibilitySVGElement::determineAccessibilityRole):
3521         * accessibility/AccessibilitySVGRoot.h:
3522         * accessibility/AccessibilityScrollView.cpp:
3523         (WebCore::AccessibilityScrollView::scrollBar):
3524         * accessibility/AccessibilityScrollView.h:
3525         * accessibility/AccessibilityScrollbar.cpp:
3526         (WebCore::AccessibilityScrollbar::orientation const):
3527         * accessibility/AccessibilityScrollbar.h:
3528         * accessibility/AccessibilitySlider.cpp:
3529         (WebCore::AccessibilitySlider::orientation const):
3530         (WebCore::AccessibilitySlider::addChildren):
3531         * accessibility/AccessibilitySlider.h:
3532         * accessibility/AccessibilitySpinButton.cpp:
3533         (WebCore::AccessibilitySpinButton::addChildren):
3534         * accessibility/AccessibilitySpinButton.h:
3535         * accessibility/AccessibilityTable.cpp:
3536         (WebCore::AccessibilityTable::hasARIARole const):
3537         (WebCore::AccessibilityTable::addChildren):
3538         (WebCore::AccessibilityTable::headerContainer):
3539         (WebCore::AccessibilityTable::roleValue const):
3540         (WebCore::AccessibilityTable::computeAccessibilityIsIgnored const):
3541         (WebCore::AccessibilityTable::titleElementText const):
3542         * accessibility/AccessibilityTableCell.cpp:
3543         (WebCore::AccessibilityTableCell::computeAccessibilityIsIgnored const):
3544         (WebCore::AccessibilityTableCell::determineAccessibilityRole):
3545         * accessibility/AccessibilityTableColumn.cpp:
3546         (WebCore::AccessibilityTableColumn::headerObject):
3547         * accessibility/AccessibilityTableColumn.h:
3548         * accessibility/AccessibilityTableHeaderContainer.h:
3549         * accessibility/AccessibilityTableRow.cpp:
3550         (WebCore::AccessibilityTableRow::determineAccessibilityRole):
3551         (WebCore::AccessibilityTableRow::computeAccessibilityIsIgnored const):
3552         * accessibility/AccessibilityTree.cpp:
3553         (WebCore::AccessibilityTree::determineAccessibilityRole):
3554         * accessibility/ios/AccessibilityObjectIOS.mm:
3555         (WebCore::AccessibilityObject::accessibilityPlatformIncludesObject const):
3556         (WebCore::AccessibilityObject::isInputTypePopupButton const):
3557         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
3558         (-[WebAccessibilityObjectWrapper accessibilityCanFuzzyHitTest]):
3559         (-[WebAccessibilityObjectWrapper _accessibilityIsLandmarkRole:]):
3560         (-[WebAccessibilityObjectWrapper _accessibilityTreeAncestor]):
3561         (-[WebAccessibilityObjectWrapper _accessibilityListAncestor]):
3562         (-[WebAccessibilityObjectWrapper _accessibilityArticleAncestor]):
3563         (-[WebAccessibilityObjectWrapper _accessibilityTraitsFromAncestors]):
3564         (-[WebAccessibilityObjectWrapper _accessibilityTextEntryTraits]):
3565         (-[WebAccessibilityObjectWrapper accessibilityTraits]):
3566         (-[WebAccessibilityObjectWrapper determineIsAccessibilityElement]):
3567         (-[WebAccessibilityObjectWrapper stringValueShouldBeUsedInLabel]):
3568         (-[WebAccessibilityObjectWrapper accessibilityLabel]):
3569         (-[WebAccessibilityObjectWrapper accessibilityValue]):
3570         (-[WebAccessibilityObjectWrapper accessibilityIsComboBox]):
3571         (-[WebAccessibilityObjectWrapper containsUnnaturallySegmentedChildren]):
3572         (-[WebAccessibilityObjectWrapper accessibilityLinkedElement]):
3573         (-[WebAccessibilityObjectWrapper treeItemParentForObject:]):
3574         (-[WebAccessibilityObjectWrapper accessibilityElementDidBecomeFocused]):
3575         (-[WebAccessibilityObjectWrapper accessibilitySortDirection]):
3576         * accessibility/mac/AccessibilityObjectMac.mm:
3577         (WebCore::AccessibilityObject::accessibilityPlatformIncludesObject const):
3578         * accessibility/mac/WebAccessibilityObjectWrapperBase.mm:
3579         (-[WebAccessibilityObjectWrapperBase baseAccessibilityTitle]):
3580         (-[WebAccessibilityObjectWrapperBase baseAccessibilityDescription]):
3581         (-[WebAccessibilityObjectWrapperBase baseAccessibilityHelpText]):
3582         (-[WebAccessibilityObjectWrapperBase ariaLandmarkRoleDescription]):
3583         (createAccessibilitySearchKeyMap):
3584         (accessibilitySearchKeyForString):
3585         (accessibilitySearchCriteriaForSearchPredicateParameterizedAttribute):
3586         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
3587         (accessibilitySelectTextCriteriaForCriteriaParameterizedAttribute):
3588         (-[WebAccessibilityObjectWrapper additionalAccessibilityAttributeNames]):
3589         (-[WebAccessibilityObjectWrapper accessibilityAttributeNames]):
3590         (createAccessibilityRoleMap):
3591         (roleValueToNSString):
3592         (-[WebAccessibilityObjectWrapper role]):
3593         (-[WebAccessibilityObjectWrapper subrole]):
3594         (-[WebAccessibilityObjectWrapper roleDescription]):
3595         (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
3596         (-[WebAccessibilityObjectWrapper accessibilityPerformShowMenuAction]):
3597         (-[WebAccessibilityObjectWrapper _accessibilitySetValue:forAttribute:]):
3598         * inspector/InspectorDOMAgent.cpp:
3599         (WebCore::InspectorDOMAgent::buildObjectForAccessibilityProperties):
3600
3601 2017-10-26  Youenn Fablet  <youenn@apple.com>
3602
3603         importScripts in service worker should use ServiceWorkersMode::None
3604         https://bugs.webkit.org/show_bug.cgi?id=178888
3605
3606         Reviewed by Chris Dumez.
3607
3608         Test: http/tests/workers/service/service-worker-importScript.html
3609
3610         Made sure ServiceWorkersMode::None is used for loading scripts in service workers as we do not support foreign fetch.
3611
3612         * workers/WorkerScriptLoader.cpp:
3613         (WebCore::WorkerScriptLoader::loadSynchronously):
3614
3615 2017-10-26  Keith Miller  <keith_miller@apple.com>
3616
3617         Unreviewed, cleanup changelogs.
3618
3619 2017-10-26  Keith Miller  <keith_miller@apple.com>
3620
3621         Unreviewed, add deprecated declarations pragma to fix macosx.
3622
3623         * platform/graphics/mac/MediaPlayerPrivateQTKit.mm:
3624
3625 2017-10-26  Andy Estes  <aestes@apple.com>
3626
3627         [Payment Request] Restrict API use to secure, same-origin frames
3628         https://bugs.webkit.org/show_bug.cgi?id=178887
3629
3630         Reviewed by Tim Horton.
3631
3632         Reuse the access checks from Apple Pay to restrict PaymentRequest API usage to secure frames
3633         in the same origin as the main frame.
3634
3635         Progresses active-document-cross-origin.https.sub.html and
3636         active-document-same-origin.https.html from web-platform-tests. Regresses basic.https.html
3637         since the allowpaymentrequest <iframe> attribute is not yet implemented.
3638
3639         * Modules/applepay/ApplePaySession.cpp:
3640         (WebCore::ApplePaySession::create):
3641         (WebCore::ApplePaySession::supportsVersion):
3642         (WebCore::ApplePaySession::canMakePayments):
3643         (WebCore::ApplePaySession::canMakePaymentsWithActiveCard):
3644         (WebCore::ApplePaySession::openPaymentSetup):
3645         (WebCore::isSecure): Deleted.
3646         (WebCore::canCallApplePaySessionAPIs): Deleted.
3647         * Modules/applepay/PaymentSession.cpp: Added.
3648         (WebCore::isSecure):
3649         (WebCore::PaymentSession::canCreateSession):
3650         * Modules/applepay/PaymentSession.h:
3651         * Modules/paymentrequest/PaymentHandler.cpp:
3652         (WebCore::PaymentHandler::canCreateSession):
3653         * Modules/paymentrequest/PaymentHandler.h:
3654         * Modules/paymentrequest/PaymentRequest.cpp:
3655         (WebCore::PaymentRequest::create):
3656         * WebCore.xcodeproj/project.pbxproj:
3657
3658 2017-10-26  Youenn Fablet  <youenn@apple.com>
3659
3660         Add service worker handle fetch support for all subresource requests
3661         https://bugs.webkit.org/show_bug.cgi?id=178769
3662
3663         Reviewed by Chris Dumez.
3664
3665         Test: http/tests/workers/service/image-fetch.html
3666
3667         Moving DocumentThreadableLoader logic to CachedResourceLoader to apply it for all resource loads.
3668         Setting the selected service worker identifier for subresource only at the moment.
3669
3670         Testing is limited to images, future wpt tests should cover other subresource cases.
3671
3672         * loader/DocumentThreadableLoader.cpp:
3673         (WebCore::DocumentThreadableLoader::DocumentThreadableLoader):
3674         * loader/cache/CachedResourceLoader.cpp:
3675         (WebCore::CachedResourceLoader::prepareFetch):
3676         * loader/cache/CachedResourceRequest.cpp:
3677         (WebCore::CachedResourceRequest::setSelectedServiceWorkerIdentifierIfNeeded):
3678         * loader/cache/CachedResourceRequest.h:
3679
3680 2017-10-26  Eric Carlson  <eric.carlson@apple.com>
3681
3682         NowPlayingInfo should contain a unique identifier
3683         https://bugs.webkit.org/show_bug.cgi?id=178872
3684
3685         Reviewed by Jer Noble.
3686
3687         Updated TestWebKitAPI/Tests/WebKitCocoa/NowPlayingControlsTests.mm.
3688
3689         * platform/audio/PlatformMediaSessionManager.h:
3690         (WebCore::PlatformMediaSessionManager::lastUpdatedNowPlayingInfoUniqueIdentifier const): New.
3691
3692         * platform/audio/ios/MediaSessionManagerIOS.h:
3693         * platform/audio/ios/MediaSessionManagerIOS.mm:
3694         (WebCore::MediaSessionManageriOS::updateNowPlayingInfo): Ditto.
3695
3696         * platform/audio/mac/MediaSessionManagerMac.h:
3697         * platform/audio/mac/MediaSessionManagerMac.mm:
3698         (WebCore::MediaSessionManagerMac::updateNowPlayingInfo): Ditto. Don't leak CFString.
3699
3700         * platform/mac/MediaRemoteSoftLink.cpp: Softlink kMRMediaRemoteNowPlayingInfoUniqueIdentifier.
3701         * platform/mac/MediaRemoteSoftLink.h:
3702
3703 2017-10-26  Keith Miller  <keith_miller@apple.com>
3704
3705         Unreviewed, iOS build fix.
3706
3707         * SourcesMac.txt:
3708         * WebCore.xcodeproj/project.pbxproj:
3709
3710 2017-10-26  Keith Miller  <keith_miller@apple.com>
3711
3712         Move Mac specific files to unified sources
3713         https://bugs.webkit.org/show_bug.cgi?id=178883
3714
3715         Rubber-stamped by Tim Horton.
3716
3717         * SourcesCocoa.txt:
3718         * SourcesMac.txt:
3719         * WebCore.xcodeproj/project.pbxproj:
3720
3721 2017-10-26  Ryosuke Niwa  <rniwa@webkit.org>
3722
3723         DidMoveToNewDocumentAssertionScope shouldn't be necessary
3724         https://bugs.webkit.org/show_bug.cgi?id=178836
3725         <rdar://problem/35008876>
3726
3727         Reviewed by Antti Koivisto.
3728
3729         DidMoveToNewDocumentAssertionScope was introduced in r217972 to replace an existing assertion to make sure
3730         Node::didMoveToNewDocument is always called by its overrides in Node's subclasses. However, we can ensure
3731         better Node::didMoveToNewDocument is always called if we called it directly in Node::moveTreeToNewScope.
3732
3733         Because only subclasses of Element and ShadowRoot override Node::didMoveToNewDocument and we already have
3734         a specialized code path to adopt a ShadowRoot to a new document, this refactoring eliminates the need for
3735         having a virtual function on Node at all.
3736
3737         Hence this patch names Node::didMoveToNewDocument to Node::moveToNewDocument and makes it non-virtual,
3738         splits ShadowRoot::didMoveToNewDocument into moveShadowRootToNewParentScope and moveShadowRootToNewDocument,
3739         and removes DidMoveToNewDocumentAssertionScope completely.
3740
3741         No new tests since there should be no behavioral change.
3742
3743         * dom/Document.cpp:
3744         (WebCore::Document::moveNodeIteratorsToNewDocumentSlowCase): Renamed from moveNodeIteratorsToNewDocument.
3745         * dom/Document.h:
3746         (WebCore::Document::moveNodeIteratorsToNewDocument): Inlined the check for emptiness of m_nodeIterators to
3747         avoid keep calling moveNodeIteratorsToNewDocumentSlowCase on every single node getting moved.
3748         * dom/Element.cpp:
3749         (WebCore::Element::didMoveToNewDocument): Removed the call to Node::didMoveToNewDocument since this is the
3750         base virtual function now.
3751         * dom/Element.h:
3752         * dom/Node.cpp:
3753         (WebCore::DidMoveToNewDocumentAssertionScope::DidMoveToNewDocumentAssertionScope): Deleted.
3754         (WebCore::DidMoveToNewDocumentAssertionScope::~DidMoveToNewDocumentAssertionScope): Deleted.
3755         (WebCore::DidMoveToNewDocumentAssertionScope::didRecieveCall): Deleted.
3756         (WebCore::moveNodeToNewDocument): Deleted.
3757         (WebCore::Node::moveShadowTreeToNewDocument): Made this a member function of Node since it needs to call
3758         moveNodeToNewDocument, which is private to Node.
3759         (WebCore::Node::moveTreeToNewScope): Removed the release assert for the root node since  the same check
3760         exists inside traverseSubtreeToUpdateTreeScope. Also removed the release assertion for checking that
3761         node's old document matches the old document since document() simply calls treeScope().documentScope()
3762         and we're already release-asserting that the old scope of a node matches the old scope we know of.
3763         We release-assert that the old tree scope's document didn't change after the traversal instead. Finally,
3764         replaced a bunch of RELEASE_ASSERT with RELEASE_ASSERT_WITH_SECURITY_IMPLICATION.
3765         (WebCore::Node::moveNodeToNewDocument): Renamed from didMoveToNewDocument. Moved the code related to
3766         mutation observers inside hasRareData() check, and moved the the code to move event listeners inside
3767         eventTargetData() check both for clarity, and avoid doing the work for every single node being moved.
3768         Finally, call the old didMoveToNewDocument when "this" is an Element.
3769         * dom/Node.h:
3770         * dom/ShadowRoot.cpp:
3771         (WebCore::ShadowRoot::moveShadowRootToNewParentScope): Added. Extracted from didMoveToNewDocument.
3772         (WebCore::ShadowRoot::moveShadowRootToNewDocument): Renamed from didMoveToNewDocument. We now
3773         release-assert that parent tree scope's document matches the new document if any.
3774         * dom/ShadowRoot.h:
3775
3776 2017-10-26  Youenn Fablet  <youenn@apple.com>
3777
3778         Implement ServiceWorkerContainer getRegistration
3779         https://bugs.webkit.org/show_bug.cgi?id=178882
3780
3781         Reviewed by Chris Dumez.
3782
3783         Replace rejection promise by resolving the promise with a null value.
3784         This helps in running WPT tests as WPT tests usually check for registered service workers before running tests.
3785         For WTR, there should be no registered service worker anyway.
3786
3787         * workers/service/ServiceWorkerContainer.cpp:
3788         (WebCore::ServiceWorkerContainer::getRegistration):
3789         * workers/service/ServiceWorkerContainer.h:
3790
3791 2017-10-26  Dan Bernstein  <mitz@apple.com>
3792
3793         Account for Mail’s WebMessageDocument class being renamed
3794         https://bugs.webkit.org/show_bug.cgi?id=178881
3795
3796         Reviewed by Sam Weinig.
3797
3798         * editing/cocoa/HTMLConverter.mm:
3799         (_WebMessageDocumentClass): Look up the class by its new name. No longer look it up by the
3800           old old name, because TOT WebKit isn’t going to be used by versions of Mail that have that name.
3801
3802 2017-10-26  Antoine Quint  <graouts@apple.com>
3803
3804         Remove FrameView::serviceScriptedAnimations and Document::serviceScriptedAnimations
3805         https://bugs.webkit.org/show_bug.cgi?id=178879
3806
3807         Reviewed by Dean Jackson.
3808
3809         There are no call sites for FrameView::serviceScriptedAnimations() and that method is the
3810         only call site for Document::serviceScriptedAnimations(), so both can go.
3811
3812         * dom/Document.cpp:
3813         (WebCore::Document::serviceScriptedAnimations): Deleted.
3814         * dom/Document.h:
3815         * page/FrameView.cpp:
3816         (WebCore::FrameView::serviceScriptedAnimations): Deleted.
3817         * page/FrameView.h:
3818
3819 2017-10-26  Chris Dumez  <cdumez@apple.com>
3820
3821         Bring back SWContextManager abstraction in WebCore
3822         https://bugs.webkit.org/show_bug.cgi?id=178876
3823
3824         Reviewed by Geoffrey Garen.
3825
3826         Bring back SWContextManager abstraction in WebCore. It was killed in <https://trac.webkit.org/changeset/223718> but
3827         is actually useful when the ServiceWorker wants to message the storage process.
3828
3829         * Sources.txt:
3830         * WebCore.xcodeproj/project.pbxproj:
3831         * workers/service/context/SWContextManager.cpp: Added.
3832         (WebCore::SWContextManager::singleton):
3833         (WebCore::SWContextManager::setConnection):
3834         (WebCore::SWContextManager::connection const):
3835         (WebCore::SWContextManager::registerServiceWorkerThread):
3836         (WebCore::SWContextManager::serviceWorkerThreadProxy const):
3837         (WebCore::SWContextManager::postMessageToServiceWorkerGlobalScope):
3838         * workers/service/context/SWContextManager.h: Copied from Source/WebKit/WebProcess/Storage/ServiceWorkerContextManager.h.
3839         (WebCore::SWContextManager::Connection::~Connection):
3840
3841 2017-10-26  Basuke Suzuki  <Basuke.Suzuki@sony.com>
3842
3843         [Curl] Rename CurlJobManager to CurlRequestScheduler
3844         https://bugs.webkit.org/show_bug.cgi?id=178775
3845
3846         To match the meaning of the class.
3847         It was originally meant to be more generic purpose, but as
3848         other classes was introduced, the objective of the class is
3849         now only to handle the life cycle of curl requests.
3850
3851         The delegate is also renamed to CurlRequestSchedulerClient.
3852
3853         Reviewed by Alex Christensen.
3854
3855         * platform/Curl.cmake:
3856         * platform/network/curl/CurlDownload.cpp:
3857         (WebCore::CurlDownload::~CurlDownload):
3858         (WebCore::CurlDownload::willSendRequest):
3859         * platform/network/curl/CurlDownload.h:
3860         * platform/network/curl/CurlRequest.cpp:
3861         (WebCore::CurlRequest::CurlRequest):
3862         (WebCore::CurlRequest::start):
3863         (WebCore::CurlRequest::startWithJobManager):
3864         (WebCore::CurlRequest::cancel):
3865         (WebCore::CurlRequest::callClient):
3866         (WebCore::CurlRequest::didReceiveData):
3867         (WebCore::CurlRequest::didCompleteTransfer):
3868         (WebCore::CurlRequest::invokeDidReceiveResponseForFile):
3869         (WebCore::CurlRequest::invokeDidReceiveResponse):
3870         (WebCore::CurlRequest::completeDidReceiveResponse):
3871         (WebCore::CurlRequest::pausedStatusChanged):
3872         (WebCore::CurlRequest::callDelegate): Deleted.
3873         * platform/network/curl/CurlRequest.h:
3874         (WebCore::CurlRequest::create):
3875         (WebCore::CurlRequest::setClient):
3876         (WebCore::CurlRequest::setDelegate): Deleted.
3877         * platform/network/curl/CurlRequestClient.h: Renamed from Source/WebCore/platform/network/curl/CurlRequestDelegate.h.
3878         * platform/network/curl/CurlRequestScheduler.cpp: Renamed from Source/WebCore/platform/network/curl/CurlJobManager.cpp.
3879         (WebCore::CurlJobList::startJobs):
3880         (WebCore::CurlJobList::finishJobs):
3881         (WebCore::CurlRequestScheduler::singleton):
3882         (WebCore::CurlRequestScheduler::add):
3883         (WebCore::CurlRequestScheduler::cancel):
3884         (WebCore::CurlRequestScheduler::callOnWorkerThread):
3885         (WebCore::CurlRequestScheduler::startThreadIfNeeded):
3886         (WebCore::CurlRequestScheduler::stopThreadIfNoMoreJobRunning):
3887         (WebCore::CurlRequestScheduler::stopThread):
3888         (WebCore::CurlRequestScheduler::updateJobList):
3889         (WebCore::CurlRequestScheduler::workerThread):
3890         * platform/network/curl/CurlRequestScheduler.h: Renamed from Source/WebCore/platform/network/curl/CurlJobManager.h.
3891         (WebCore::CurlRequestScheduler::~CurlRequestScheduler):
3892         * platform/network/curl/CurlRequestSchedulerClient.h: Added.
3893         (WebCore::CurlRequestSchedulerClient::~CurlRequestSchedulerClient):
3894         * platform/network/curl/ResourceHandleCurlDelegate.cpp:
3895         (WebCore::ResourceHandleCurlDelegate::~ResourceHandleCurlDelegate):
3896         (WebCore::ResourceHandleCurlDelegate::setAuthentication):
3897         (WebCore::ResourceHandleCurlDelegate::continueAfterWillSendRequest):
3898         * platform/network/curl/ResourceHandleCurlDelegate.h:
3899
3900 2017-10-26  Antti Koivisto  <antti@apple.com>
3901
3902         Remove unnecessary whitespace invalidation logic from RenderTreeUpdater
3903         https://bugs.webkit.org/show_bug.cgi?id=178786
3904
3905         Reviewed by Zalan Bujtas.
3906
3907         RenderTreeUpdater::invalidateWhitespaceOnlyTextSiblingsAfterAttachIfNeeded is a somewhat complex
3908         and confusing function for figuring out if some whitespace-only text node might need to have its
3909         rendering status recomputed. However actually computing if a text renderer is needed is not expensive.
3910         We can simply do it for all whitespace nodes after a sibling mutation.
3911
3912         This also removes a set that could have stale renderer pointers in it (they were never dereferenced).
3913
3914         * rendering/RenderBlock.cpp:
3915         (WebCore::RenderBlock::addChildIgnoringContinuation):
3916
3917             Fix a display:contents bug exposed by this change. With display:contents a text renderer may have an anonymous
3918             inline wrapper and we need to take it into account when the text renderer is the beforeChild.
3919
3920             Tested by imported/w3c/web-platform-tests/css/css-display-3/display-contents-state-change-001.html
3921
3922         * style/RenderTreeUpdater.cpp:
3923         (WebCore::RenderTreeUpdater::updateRenderTree):
3924
3925             Call updateTextRenderer() for all whitespace-only text nodes after a change in siblings.
3926             In normal update case it just figures out quickly (by calling textRendererIsNeeded)
3927             that there are no changes and bails out.
3928
3929         (WebCore::RenderTreeUpdater::updateElementRenderer):
3930         (WebCore::RenderTreeUpdater::updateTextRenderer):
3931         (WebCore::RenderTreeUpdater::invalidateWhitespaceOnlyTextSiblingsAfterAttachIfNeeded): Deleted.
3932
3933             No longer needed. Just mark that there have been changes to siblings instead.
3934
3935         * style/RenderTreeUpdater.h:
3936
3937 2017-10-26  Myles C. Maxfield  <mmaxfield@apple.com>
3938
3939         Mark font palettes as in development
3940         https://bugs.webkit.org/show_bug.cgi?id=178590
3941
3942         Unreviewed.
3943
3944         * features.json:
3945
3946 2017-10-26  Ryan Haddad  <ryanhaddad@apple.com>
3947
3948         Unreviewed, rolling out r223984.
3949
3950         Caused LayoutTest assertion failures.
3951
3952         Reverted changeset:
3953
3954         "When navigating back to a page, compositing layers may not
3955         use accelerated drawing"
3956         https://bugs.webkit.org/show_bug.cgi?id=178749
3957         https://trac.webkit.org/changeset/223984
3958
3959 2017-10-26  Youenn Fablet  <youenn@apple.com>
3960
3961         Add inspector logging for MediaElementSession autoplay
3962         https://bugs.webkit.org/show_bug.cgi?id=178846
3963
3964         Reviewed by Eric Carlson.
3965
3966         No change of behavior.
3967         Making use of pal Logger in MediaElementSession.
3968         This new logging is limited to autoplay/playback for now.
3969
3970         * html/MediaElementSession.cpp:
3971         (WebCore::MediaElementSession::MediaElementSession):
3972         (WebCore::MediaElementSession::playbackPermitted const):
3973         (WebCore::MediaElementSession::autoplayPermitted const):
3974         (WebCore::MediaElementSession::willLog const):
3975         (WebCore::MediaElementSession::logChannel const):
3976         * html/MediaElementSession.h:
3977
3978 2017-10-26  Keith Miller  <keith_miller@apple.com>
3979
3980         Move ApplePay to unified sources
3981         https://bugs.webkit.org/show_bug.cgi?id=178871
3982
3983         Rubber-stamped by Tim Horton.
3984
3985         Also, add some other missing files.
3986
3987         * SourcesCocoa.txt:
3988         * WebCore.xcodeproj/project.pbxproj:
3989
3990 2017-10-26  Ryan Haddad  <ryanhaddad@apple.com>
3991
3992         Unreviewed, rolling out r224019.
3993