2ba87c3e3401319a9ef2f86da9c9be584deccffc
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2018-08-06  Ryan Haddad  <ryanhaddad@apple.com>
2
3         Unreviewed, rolling out r234569.
4
5         Breaks internal builds.
6
7         Reverted changeset:
8
9         "We should cache the compiled sandbox profile in a data vault"
10         https://bugs.webkit.org/show_bug.cgi?id=184991
11         https://trac.webkit.org/changeset/234569
12
13 2018-08-06  Alex Christensen  <achristensen@webkit.org>
14
15         Make BlendMode an enum class
16         https://bugs.webkit.org/show_bug.cgi?id=188325
17
18         Reviewed by Darin Adler.
19
20         No change in behavior.
21
22         * css/CSSPrimitiveValueMappings.h:
23         (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
24         (WebCore::CSSPrimitiveValue::operator BlendMode const):
25         * html/HTMLImageElement.cpp:
26         (WebCore::HTMLImageElement::parseAttribute):
27         * html/canvas/CanvasRenderingContext2DBase.cpp:
28         (WebCore::CanvasRenderingContext2DBase::State::State):
29         (WebCore::CanvasRenderingContext2DBase::setGlobalCompositeOperation):
30         (WebCore::CanvasRenderingContext2DBase::drawImageFromRect):
31         * platform/graphics/BitmapImage.h:
32         * platform/graphics/GraphicsContext.h:
33         (WebCore::ImagePaintingOptions::ImagePaintingOptions):
34         * platform/graphics/GraphicsContextImpl.h:
35         * platform/graphics/GraphicsLayer.cpp:
36         (WebCore::GraphicsLayer::dumpProperties const):
37         * platform/graphics/GraphicsLayer.h:
38         * platform/graphics/GraphicsTypes.cpp:
39         (WebCore::parseBlendMode):
40         (WebCore::parseCompositeAndBlendOperator):
41         (WebCore::compositeOperatorName):
42         (WebCore::blendModeName):
43         (WebCore::operator<<):
44         * platform/graphics/GraphicsTypes.h:
45         * platform/graphics/Image.cpp:
46         (WebCore::Image::drawTiled):
47         * platform/graphics/Image.h:
48         * platform/graphics/ImageBuffer.h:
49         * platform/graphics/ca/cocoa/PlatformCAFiltersCocoa.mm:
50         (PlatformCAFilters::setBlendingFiltersOnLayer):
51         * platform/graphics/cg/GraphicsContextCG.cpp:
52         (WebCore::selectCGBlendMode):
53         * platform/graphics/cpu/arm/filters/FEBlendNEON.h:
54         (WebCore::FEBlend::platformApplyNEON):
55         * platform/graphics/displaylists/DisplayListItems.h:
56         * platform/graphics/displaylists/DisplayListRecorder.h:
57         * platform/graphics/filters/FEBlend.cpp:
58         (WebCore::FEBlend::externalRepresentation const):
59         * rendering/RenderBox.cpp:
60         (WebCore::RenderBox::paintFillLayers):
61         * rendering/RenderImage.cpp:
62         (WebCore::RenderImage::paintIntoRect):
63         * rendering/RenderLayer.cpp:
64         (WebCore::RenderLayer::RenderLayer):
65         (WebCore::RenderLayer::updateBlendMode):
66         (WebCore::RenderLayer::beginTransparencyLayers):
67         * rendering/RenderLayerBacking.cpp:
68         (WebCore::RenderLayerBacking::updateBlendMode):
69         * rendering/style/FillLayer.cpp:
70         (WebCore::FillLayer::FillLayer):
71         (WebCore::FillLayer::hasOpaqueImage const):
72         * rendering/style/FillLayer.h:
73         (WebCore::FillLayer::initialFillBlendMode):
74         * rendering/style/RenderStyle.h:
75         (WebCore::RenderStyle::setBlendMode):
76         (WebCore::RenderStyle::hasBlendMode const):
77         (WebCore::RenderStyle::blendMode const):
78         (WebCore::RenderStyle::initialBlendMode):
79         * rendering/style/StyleRareNonInheritedData.cpp:
80         (WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData):
81         * rendering/svg/SVGRenderingContext.cpp:
82         (WebCore::SVGRenderingContext::prepareToRenderSVGContent):
83         * svg/SVGAnimatedEnumeration.cpp:
84         (WebCore::enumerationValueForTargetAttribute):
85         * svg/SVGFEBlendElement.cpp:
86         (WebCore::SVGFEBlendElement::SVGFEBlendElement):
87         (WebCore::SVGFEBlendElement::parseAttribute):
88         * svg/SVGFEBlendElement.h:
89         (WebCore::SVGPropertyTraits<BlendMode>::highestEnumValue):
90         (WebCore::SVGPropertyTraits<BlendMode>::toString):
91         * svg/graphics/SVGImage.cpp:
92         (WebCore::SVGImage::nativeImageForCurrentFrame):
93         (WebCore::SVGImage::nativeImage):
94         (WebCore::SVGImage::drawPatternForContainer):
95         (WebCore::SVGImage::draw):
96
97 2018-08-06  Aditya Keerthi  <akeerthi@apple.com>
98
99         [iOS] Indeterminate checkboxes appear unchecked
100         https://bugs.webkit.org/show_bug.cgi?id=160484
101         <rdar://problem/31143185>
102
103         Reviewed by Wenson Hsieh.
104
105         Add support for rendering indeterminate checkboxes on iOS.
106
107         We now paint the unchecked appearance only if the checkbox is not checked and is
108         not indeterminate. Otherwise, we draw a checkmark if the checkbox is in the
109         checked state and a dash if the checkbox is in the indeterminate state. Both of
110         these states share the same dark background.
111
112         Test: fast/forms/ios/render-indeterminate-checkbox.html
113
114         * css/html.css:
115         (input[type="checkbox"]:indeterminate):
116         (input[type="checkbox"]:indeterminate:disabled):
117         * rendering/RenderThemeIOS.mm:
118         (WebCore::drawJoinedLines):
119         (WebCore::RenderThemeIOS::paintCheckboxDecorations):
120
121 2018-08-06  Ryosuke Niwa  <rniwa@webkit.org>
122
123         HTML parser should execute custom element reactions for setting attributes immediately after creating a custom element
124         https://bugs.webkit.org/show_bug.cgi?id=188336
125
126         Reviewed by Frédéric Wang.
127
128         Push and pop an element queue from the custom element reactions stack when constructing a custom element:
129         https://html.spec.whatwg.org/multipage/parsing.html#create-an-element-for-the-token
130
131         To do this, we instantiate CustomElementReactionStack in HTMLDocumentParser::runScriptsForPausedTreeBuilder
132         where we synchronously construct a custom element. We don't have to worry about whether *will execute script*
133         is set or not since the presence of an element queue should not be observable in the case where we're constructing
134         a fallback element (since it would not enqueue any new custom element reaction).
135
136         Tests: imported/w3c/web-platform-tests/custom-elements/parser/parser-sets-attributes-and-children.html
137
138         * html/parser/HTMLDocumentParser.cpp:
139         (WebCore::HTMLDocumentParser::runScriptsForPausedTreeBuilder): Instantiate CustomElementReactionStack. Note that we
140         don't insert the custom element into the parser until we finish processing the custom element reactions.
141
142 2018-08-06  Charlie Turner  <cturner@igalia.com>
143
144         Return extracted key ids as an optional
145         https://bugs.webkit.org/show_bug.cgi?id=188303
146
147         Reviewed by Darin Adler.
148
149         An empty list of extracted key ids was being considered a failure
150         case before this patch. In the PSSH boxes from the CENC standard,
151         it's not uncommon for the box to be version 0, meaning it has no
152         embedded key ids, so the case when there's an empty list should
153         not be treated as an error. Given this, the interface should be
154         more general and allow for a sentinel value indicating a parsing
155         error rather than an absence of key ids.
156
157         Covered by existing tests.
158
159         * Modules/encryptedmedia/InitDataRegistry.cpp:
160         (WebCore::extractKeyIDsKeyids): Change return type to be wrapped
161         in an optional, and make parsing errors return a nullopt rather
162         than an empty vector.
163         (WebCore::sanitizeKeyids): Use the new optional interface, return
164         a null RefPtr in the case of a parsing error, this method may now
165         return an empty vector.
166         (WebCore::extractKeyIDsCenc): Not implemented, so return an error
167         value rather than an empty vector.
168         (WebCore::extractKeyIDsWebM): Ditto.
169         (WebCore::InitDataRegistry::extractKeyIDs): Ditto.
170         * Modules/encryptedmedia/InitDataRegistry.h: Update the interface
171         to use an optional return type.
172         * platform/graphics/avfoundation/CDMFairPlayStreaming.cpp:
173         (WebCore::CDMPrivateFairPlayStreaming::extractKeyIDsSinf): Update
174         to use the new interface.
175         (WebCore::CDMPrivateFairPlayStreaming::extractKeyIDsSkd): Ditto.
176         * platform/graphics/avfoundation/CDMFairPlayStreaming.h: Ditto.
177         * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm:
178         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::keyIDs): Convert
179         the optional value into a vector, since it is assumed you can not
180         have an empty vector of key ids in the init datas FPS supports.
181         * testing/MockCDMFactory.cpp:
182         (WebCore::MockCDMInstance::requestLicense): Only return an error
183         if there really was a parsing error, rather than the case of there
184         being zero key ids in the init data payload.
185
186 2018-08-06  Frederic Wang  <fwang@igalia.com>
187
188         Make two-arguments versions of scrollBy/scrollTo depend on the one-argument versions
189         https://bugs.webkit.org/show_bug.cgi?id=188300
190
191         Reviewed by Darin Adler.
192
193         This patch refactors a bit the scrollBy/scrollTo code, so that the two-arguments versions
194         share the same code path as the more generic one-argument versions. In particular, this
195         helps to implement the ScrollBehavior option (bug 188043) since the one-argument versions
196         will require to distinguish between smooth and instant scrolling. The logic to normalize
197         non finite left/right values or to use a fallback when they are absent is also factored out
198         into ScrollToOptions.
199
200         References:
201         https://drafts.csswg.org/cssom-view/#dom-element-scroll
202         https://drafts.csswg.org/cssom-view/#dom-element-scrollby
203         https://drafts.csswg.org/cssom-view/#dom-window-scroll
204         https://drafts.csswg.org/cssom-view/#dom-window-scrollby
205
206         No new tests, behavior is unchanged.
207
208         * dom/Element.cpp:
209         (WebCore::Element::scrollBy): Make two-parameter version depends on one-parameter version
210         and rewrite the normalize / fallback logic.
211         (WebCore::Element::scrollTo): Rewrite the normalize / fallback logic.
212         (WebCore::normalizeNonFiniteValue): Deleted. The logic is moved to ScrollToOptions.
213         * page/DOMWindow.cpp:
214         (WebCore::DOMWindow::scrollBy const): Make two-parameter version depends on one-parameter
215         version and rewrite the normalize / fallback logic.
216         (WebCore::DOMWindow::scrollTo const): Make two-parameter version depends on one-parameter
217         version and rewrite the normalize / fallback logic.
218         * page/ScrollToOptions.h: Add <cmath> to use std::isfinite
219         (WebCore::ScrollToOptions::normalizeNonFiniteCoordinatesOrFallBackTo): New function to
220         normalize left/right values or fallback to the specified value if it is missing.
221
222 2018-08-06  Zan Dobersek  <zdobersek@igalia.com>
223
224         Unreviewed follow-up to r234594.
225
226         Add missing constructor and destructor definitions for the bunch of new
227         classes that were added in that revision.
228
229         * platform/graphics/nicosia/NicosiaPlatformLayer.cpp:
230         (Nicosia::ContentLayer::ContentLayer):
231         (Nicosia::BackingStore::BackingStore):
232         (Nicosia::ImageBacking::ImageBacking):
233
234 2018-08-06  Zan Dobersek  <zdobersek@igalia.com>
235
236         [Nicosia] Add additional layer state classes, use impl-based approach to make them extendable
237         https://bugs.webkit.org/show_bug.cgi?id=188341
238
239         Reviewed by Carlos Garcia Campos.
240
241         Add the ContentLayer, BackingStore and ImageBacking classes in the
242         Nicosia namespace. State objects of CompositionLayer instances keep
243         references to objects of these classes depending on the content that's
244         presented in the associated GraphicsLayer.
245
246         ContentLayer derives from the PlatformLayer class. It's used for layers
247         that display things like WebGL and HTML5 canvas and media content in a
248         platform-specific way. In case of TextureMapper the hardware-accelerated
249         content is piped into that rendering pipeline.
250
251         BackingStore is meant to represent the painted contents of a layer. The
252         equivalent current functionality is using a tiled backing store that
253         has its contents copied into the CoordinatedBackingStore instance.
254
255         ImageBacking is used for a layer whose content is a simple Image object.
256         Image's pixel data is rasterized and again managed through
257         CoordinatedBackingStore for rendering.
258
259         All these classes, along with the CompositionLayer class, should now be
260         constructed with a factory function that returns an object that derives
261         the class-specific Impl interface. This will allow for simpler
262         implementation of different approaches in parallel. The TextureMapper
263         variants will be the first ones, replicating the current behavior as it
264         is implemented across classes in the CoordinatedGraphics and
265         TextureMapper layers.
266
267         * platform/graphics/nicosia/NicosiaPlatformLayer.cpp:
268         (Nicosia::CompositionLayer::CompositionLayer):
269         * platform/graphics/nicosia/NicosiaPlatformLayer.h:
270         (Nicosia::PlatformLayer::isContentLayer const):
271         (Nicosia::CompositionLayer::Impl::isTextureMapperImpl const):
272         (Nicosia::CompositionLayer::create):
273         (Nicosia::CompositionLayer::impl const):
274         (Nicosia::ContentLayer::Impl::isTextureMapperImpl const):
275         (Nicosia::ContentLayer::create):
276         (Nicosia::ContentLayer::impl const):
277         (Nicosia::BackingStore::Impl::isTextureMapperImpl const):
278         (Nicosia::BackingStore::create):
279         (Nicosia::BackingStore::impl const):
280         (Nicosia::ImageBacking::Impl::isTextureMapperImpl const):
281         (Nicosia::ImageBacking::create):
282         (Nicosia::ImageBacking::impl const):
283         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
284         (WebCore::CoordinatedGraphicsLayer::CoordinatedGraphicsLayer):
285
286 2018-08-06  Zan Dobersek  <zdobersek@igalia.com>
287
288         [Nicosia] Add Nicosia::Scene
289         https://bugs.webkit.org/show_bug.cgi?id=188340
290
291         Reviewed by Carlos Garcia Campos.
292
293         Add the Nicosia::Scene class that controls the scene's state and enables
294         thread-safe updates to that state.
295
296         The State struct itself holds a set of all the layers in the scene, and
297         separates out the root layer specifically. An ID counter is also present
298         there, allowing consumers of this state to easily check for any updates.
299
300         A reference to the Nicosia::Scene object now replaces the
301         HashSet-and-root-layer pair in the CoordinatedGraphicsState struct.
302
303         * platform/TextureMapper.cmake:
304         * platform/graphics/nicosia/NicosiaScene.cpp: Added.
305         * platform/graphics/nicosia/NicosiaScene.h: Added.
306         (Nicosia::Scene::create):
307         (Nicosia::Scene::accessState):
308         * platform/graphics/texmap/coordinated/CoordinatedGraphicsState.h:
309
310 2018-08-06  Carlos Eduardo Ramalho  <cadubentzen@gmail.com>
311
312         [GTK] Buttons are drawn too large, text not centered
313         https://bugs.webkit.org/show_bug.cgi?id=185854
314
315         Reviewed by Carlos Garcia Campos.
316
317         Some pages require small buttons and the GTK theme was
318         drawing only down to a minimum size.
319
320         No new tests required. Current layout tests and ManualTests/gtk/theme.html
321         already cover it.
322
323         * platform/gtk/RenderThemeGadget.cpp:
324         (WebCore::RenderThemeGadget::create):
325         (WebCore::RenderThemeButtonGadget::RenderThemeButtonGadget): Added
326         (WebCore::RenderThemeButtonGadget::minimumSize const):
327         Allow sizes smaller than the minimum size.
328         * platform/gtk/RenderThemeGadget.h:
329         * platform/gtk/RenderThemeWidget.cpp:
330         (WebCore::RenderThemeButton::RenderThemeButton):
331
332 2018-08-05  Yusuke Suzuki  <utatane.tea@gmail.com>
333
334         Implement self.queueMicrotask in Workers
335         https://bugs.webkit.org/show_bug.cgi?id=188247
336
337         Reviewed by Ryosuke Niwa.
338
339         This patch adds support for self.queueMicrotask to workers.
340
341         Tests: http/wpt/workers/queue-microtask.any.html
342                http/wpt/workers/queue-microtask.any.worker.html
343
344         * bindings/js/JSWorkerGlobalScopeCustom.cpp:
345         (WebCore::JSWorkerGlobalScope::queueMicrotask):
346         * page/DOMWindow.idl:
347         Move queueMicrotask declaration to WindowOrWorkerGlobalScope.idl.
348         * page/WindowOrWorkerGlobalScope.idl:
349
350 2018-08-05  Rob Buis  <rbuis@igalia.com>
351
352         [GTK][WPE] Fetch tests assert in SubresourceLoader::didReceiveResponse()
353         https://bugs.webkit.org/show_bug.cgi?id=188163
354
355         Reviewed by Frédéric Wang.
356
357         Fetch in manual redirect mode uses didReceiveResponse instead of
358         willSendRequestInternal, so update the ASSERT.
359
360         * loader/SubresourceLoader.cpp:
361         (WebCore::SubresourceLoader::didReceiveResponse):
362
363 2018-08-05  Yusuke Suzuki  <utatane.tea@gmail.com>
364
365         Add support for microtasks in workers
366         https://bugs.webkit.org/show_bug.cgi?id=188246
367
368         Reviewed by Darin Adler.
369
370         This patch adds the microtask mechanism to workers. To adopt the existing microtask mechanism from the main thread,
371         we extend JSMainThreadExecState for non-main-threads. We rename it to JSExecState, and store stacked
372         ExecState* data in thread local storage in ThreadGlobalData instead of a static variable s_mainThreadState.
373
374         We add MicrotaskQueue to WorkerGlobalScope since each worker has its own thread and it should have its
375         own microtask queue.
376
377         * Modules/encryptedmedia/legacy/LegacyCDMSessionClearKey.cpp:
378         * Sources.txt:
379         * WebCore.xcodeproj/project.pbxproj:
380         * bindings/js/JSBindingsAllInOne.cpp:
381         * bindings/js/JSCallbackData.cpp:
382         (WebCore::JSCallbackData::invokeCallback):
383         * bindings/js/JSCustomElementInterface.cpp:
384         (WebCore::constructCustomElementSynchronously):
385         (WebCore::JSCustomElementInterface::upgradeElement):
386         (WebCore::JSCustomElementInterface::invokeCallback):
387         * bindings/js/JSCustomXPathNSResolver.cpp:
388         (WebCore::JSCustomXPathNSResolver::lookupNamespaceURI):
389         * bindings/js/JSDOMGlobalObjectTask.cpp:
390         * bindings/js/JSDOMWindowBase.cpp:
391         (WebCore::JSDOMWindowBase::queueTaskToEventLoop):
392         Queue a microtask to MicrotaskQueue instead of posting a macrotask.
393
394         (WebCore::JSDOMWindowMicrotaskCallback::create): Deleted.
395         (WebCore::JSDOMWindowMicrotaskCallback::call): Deleted.
396         (WebCore::JSDOMWindowMicrotaskCallback::JSDOMWindowMicrotaskCallback): Deleted.
397         (): Deleted.
398         Extract JSDOMWindowMicrotaskCallback as JSMicrotaskCallback and create a new file for it.
399
400         * bindings/js/JSErrorHandler.cpp:
401         (WebCore::JSErrorHandler::handleEvent):
402         * bindings/js/JSEventListener.cpp:
403         (WebCore::JSEventListener::handleEvent):
404         * bindings/js/JSExecState.cpp: Renamed from Source/WebCore/bindings/js/JSMainThreadExecState.cpp.
405         (WebCore::JSExecState::didLeaveScriptContext):
406         If we are in a main thread, we consume main thread microtask queue. If we are in worker thread,
407         we consume a microtask queue per worker.
408
409         (WebCore::functionCallHandlerFromAnyThread):
410         (WebCore::evaluateHandlerFromAnyThread):
411         * bindings/js/JSExecState.h: Renamed from Source/WebCore/bindings/js/JSMainThreadExecState.h.
412         (WebCore::JSExecState::currentState):
413         (WebCore::JSExecState::call):
414         (WebCore::JSExecState::evaluate):
415         (WebCore::JSExecState::profiledCall):
416         (WebCore::JSExecState::profiledEvaluate):
417         (WebCore::JSExecState::runTask):
418         (WebCore::JSExecState::loadModule):
419         (WebCore::JSExecState::linkAndEvaluateModule):
420         (WebCore::JSExecState::JSExecState):
421         (WebCore::JSExecState::~JSExecState):
422         (WebCore::JSExecState::setCurrentState):
423         Store and load ExecState in thread local storage, ThreadGlobalData. This allows us to use it for workers.
424
425         (WebCore::JSMainThreadNullState::JSMainThreadNullState):
426         (WebCore::JSMainThreadNullState::~JSMainThreadNullState):
427         We keep this name "JSMainThreadNullState" since CustomElementReactionStack should be stick to the main thread.
428         And this class is only used in the main thread.
429
430         * bindings/js/JSExecStateInstrumentation.h: Renamed from Source/WebCore/bindings/js/JSMainThreadExecStateInstrumentation.h.
431         (WebCore::JSExecState::instrumentFunctionInternal):
432         (WebCore::JSExecState::instrumentFunctionCall):
433         (WebCore::JSExecState::instrumentFunctionConstruct):
434         * bindings/js/JSMicrotaskCallback.h: Copied from Source/WebKitLegacy/mac/DOM/DOMHTMLBaseElement.mm.
435         (WebCore::JSMicrotaskCallback::create):
436         (WebCore::JSMicrotaskCallback::call):
437         (WebCore::JSMicrotaskCallback::JSMicrotaskCallback):
438         * bindings/js/JSWorkerGlobalScopeBase.cpp:
439         (WebCore::JSWorkerGlobalScopeBase::queueTaskToEventLoop):
440         * bindings/js/ScheduledAction.cpp:
441         (WebCore::ScheduledAction::executeFunctionInContext):
442         * bindings/js/ScriptController.cpp:
443         (WebCore::ScriptController::evaluateInWorld):
444         (WebCore::ScriptController::loadModuleScriptInWorld):
445         (WebCore::ScriptController::linkAndEvaluateModuleScriptInWorld):
446         (WebCore::ScriptController::canAccessFromCurrentOrigin):
447         * bindings/js/WorkerScriptController.cpp:
448         (WebCore::WorkerScriptController::evaluate):
449         * bridge/objc/WebScriptObject.mm:
450         (-[WebScriptObject callWebScriptMethod:withArguments:]):
451         (-[WebScriptObject evaluateWebScript:]):
452         * html/canvas/WebGLRenderingContextBase.cpp:
453         (WebCore::WebGLRenderingContextBase::compileShader):
454         (WebCore::WebGLRenderingContextBase::printToConsole):
455         * inspector/InspectorCanvas.cpp:
456         (WebCore::InspectorCanvas::buildObjectForCanvas):
457         (WebCore::InspectorCanvas::buildAction):
458         * inspector/InspectorController.cpp:
459         * inspector/InspectorFrontendHost.cpp:
460         * inspector/TimelineRecordFactory.cpp:
461         (WebCore::TimelineRecordFactory::createGenericRecord):
462         * inspector/WorkerInspectorController.cpp:
463         * inspector/agents/InspectorCanvasAgent.cpp:
464         * inspector/agents/InspectorNetworkAgent.cpp:
465         (WebCore::InspectorNetworkAgent::buildInitiatorObject):
466         * page/DOMWindow.cpp:
467         (WebCore::DOMWindow::postMessage):
468         * page/PageConsoleClient.cpp:
469         (WebCore::PageConsoleClient::addMessage):
470         * page/csp/ContentSecurityPolicy.cpp:
471         (WebCore::ContentSecurityPolicy::reportViolation const):
472         * platform/ThreadGlobalData.h:
473         (WebCore::ThreadGlobalData::ThreadGlobalData::currentState const):
474         (WebCore::ThreadGlobalData::ThreadGlobalData::setCurrentState):
475         * workers/WorkerGlobalScope.cpp:
476         (WebCore::WorkerGlobalScope::WorkerGlobalScope):
477         (WebCore::WorkerGlobalScope::removeMicrotaskQueue):
478         * workers/WorkerGlobalScope.h:
479         (WebCore::WorkerGlobalScope::microtaskQueue const):
480         * workers/WorkerThread.cpp:
481         (WebCore::WorkerThread::stop):
482         * workers/service/ExtendableEvent.cpp:
483         (WebCore::ExtendableEvent::addExtendLifetimePromise):
484         When dispatching an "install" event from service worker, we first create an event,
485         dispatch it, and set a handler which is called when a pending promise count becomes zero.
486         However, the old code checked pending promise count in a queued microtask. It worked
487         previously because microtask is actually a macrotask in the service worker. So this check
488         is done after a handler is set. But this patch introduces real microtask, and this check
489         happens before a handler is set because dispatching an event can exhaust microtask queue.
490         According to the spec, this check should not be done in microtask[1]. We make this checking
491         part as a macrotask. We note that algorithm noted as FIXMEs should be done in this
492         microtask while the checking part should not be done.
493
494         [1]: https://w3c.github.io/ServiceWorker/#installation-algorithm
495
496 2018-08-05  Ryosuke Niwa  <rniwa@webkit.org>
497
498         Properties set on window.customElements can disappear due to GC
499         https://bugs.webkit.org/show_bug.cgi?id=172575
500
501         Lexicologically sort the IDL attributes per Darin's comment.
502
503         * dom/CustomElementRegistry.idl:
504
505 2018-08-05  Zalan Bujtas  <zalan@apple.com>
506
507         [LFC][BFC] contentHeightForFormattingContextRoot uses the wrong coordinate system to compute the height.
508         https://bugs.webkit.org/show_bug.cgi?id=188319
509
510         Reviewed by Antti Koivisto.
511
512         Display::Box::marginBox() is in the coordinate system of the box itself (8px top margin translates to y = -8px).
513         What we need instead to compute the content height is the top/bottom position in the containing block's coordinate system (rect and rectWithMargin).
514
515         * layout/FormattingContextGeometry.cpp:
516         (WebCore::Layout::contentHeightForFormattingContextRoot):
517
518 2018-08-05  Ms2ger  <Ms2ger@igalia.com>
519
520         [GStreamer] Remove unsound assertions in MediaPlayerPrivateGStreamerBase.
521         https://bugs.webkit.org/show_bug.cgi?id=188162
522
523         Reviewed by Philippe Normand.
524
525         These assertions sometimes fail, and there's a runtime check right
526         after them anyway.
527
528         Tests: fast/canvas/webgl/texImage2D-video-flipY-false.html
529                fast/canvas/webgl/texImage2D-video-flipY-true.html
530
531         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
532         (WebCore::MediaPlayerPrivateGStreamerBase::copyVideoTextureToPlatformTexture):
533         (WebCore::MediaPlayerPrivateGStreamerBase::nativeImageForCurrentTime):
534
535 2018-08-05  Philippe Normand  <pnormand@igalia.com>
536
537         [MediaCapabilities] Platform integration
538         https://bugs.webkit.org/show_bug.cgi?id=187850
539
540         Reviewed by Eric Carlson.
541
542         Mock platform support for the MediaCapabilities specification.
543
544         Test: media/mediacapabilities/mock-decodingInfo.html
545               media/mediacapabilities/mock-encodingInfo.html
546
547         * Modules/mediacapabilities/MediaCapabilities.cpp:
548         (WebCore::MediaCapabilities::decodingInfo):
549         (WebCore::MediaCapabilities::encodingInfo):
550         * Modules/mediacapabilities/MediaCapabilitiesInfo.h:
551         (WebCore::MediaCapabilitiesInfo::create):
552         * PlatformGTK.cmake:
553         * PlatformMac.cmake:
554         * PlatformWPE.cmake:
555         * Sources.txt:
556         * WebCore.xcodeproj/project.pbxproj:
557         * platform/mediacapabilities/MediaEngineConfiguration.cpp: Added.
558         (WebCore::MediaEngineVideoConfiguration::MediaEngineVideoConfiguration):
559         (WebCore::MediaEngineAudioConfiguration::MediaEngineAudioConfiguration):
560         (WebCore::MediaEngineConfiguration::MediaEngineConfiguration):
561         * platform/mediacapabilities/MediaEngineConfiguration.h: Added.
562         (WebCore::MediaEngineVideoConfiguration::create):
563         (WebCore::MediaEngineVideoConfiguration::contentType const):
564         (WebCore::MediaEngineVideoConfiguration::size const):
565         (WebCore::MediaEngineVideoConfiguration::bitrate const):
566         (WebCore::MediaEngineVideoConfiguration::framerate const):
567         (WebCore::MediaEngineAudioConfiguration::create):
568         (WebCore::MediaEngineAudioConfiguration::contentType const):
569         (WebCore::MediaEngineAudioConfiguration::channels const):
570         (WebCore::MediaEngineAudioConfiguration::bitrate const):
571         (WebCore::MediaEngineAudioConfiguration::samplerate const):
572         (WebCore::MediaEngineConfiguration::audioConfiguration const):
573         (WebCore::MediaEngineConfiguration::videoConfiguration const):
574         * platform/mediacapabilities/MediaEngineConfigurationFactory.cpp: Added.
575         (WebCore::mockEnabled):
576         (WebCore::MediaEngineConfigurationFactory::createDecodingConfiguration):
577         (WebCore::MediaEngineConfigurationFactory::createEncodingConfiguration):
578         (WebCore::MediaEngineConfigurationFactory::enableMock):
579         (WebCore::MediaEngineConfigurationFactory::disableMock):
580         * platform/mediacapabilities/MediaEngineConfigurationFactory.h: Added.
581         * platform/mediacapabilities/MediaEngineDecodingConfiguration.h: Added.
582         (WebCore::MediaEngineDecodingConfiguration::MediaEngineDecodingConfiguration):
583         (WebCore::MediaEngineDecodingConfiguration::canDecodeMedia):
584         (WebCore::MediaEngineDecodingConfiguration::canSmoothlyDecodeMedia):
585         (WebCore::MediaEngineDecodingConfiguration::canPowerEfficientlyDecodeMedia):
586         (WebCore::MediaEngineDecodingConfiguration::decodingType const):
587         * platform/mediacapabilities/MediaEngineEncodingConfiguration.h: Added.
588         (WebCore::MediaEngineEncodingConfiguration::MediaEngineEncodingConfiguration):
589         (WebCore::MediaEngineEncodingConfiguration::canEncodeMedia):
590         (WebCore::MediaEngineEncodingConfiguration::canSmoothlyEncodeMedia):
591         (WebCore::MediaEngineEncodingConfiguration::canPowerEfficientlyEncodeMedia):
592         (WebCore::MediaEngineEncodingConfiguration::encodingType const):
593         * platform/mock/MediaEngineDecodingConfigurationMock.cpp: Added.
594         (WebCore::MediaEngineDecodingConfigurationMock::canDecodeMedia):
595         (WebCore::MediaEngineDecodingConfigurationMock::canSmoothlyDecodeMedia):
596         (WebCore::MediaEngineDecodingConfigurationMock::canPowerEfficientlyDecodeMedia):
597         * platform/mock/MediaEngineDecodingConfigurationMock.h: Added.
598         * platform/mock/MediaEngineEncodingConfigurationMock.cpp: Added.
599         (WebCore::MediaEngineEncodingConfigurationMock::canEncodeMedia):
600         (WebCore::MediaEngineEncodingConfigurationMock::canSmoothlyEncodeMedia):
601         (WebCore::MediaEngineEncodingConfigurationMock::canPowerEfficientlyEncodeMedia):
602         * platform/mock/MediaEngineEncodingConfigurationMock.h: Added.
603         * testing/Internals.cpp:
604         (WebCore::Internals::resetToConsistentState):
605         (WebCore::Internals::enableMockMediaCapabilities):
606         * testing/Internals.h:
607         * testing/Internals.idl:
608
609 2018-08-04  Simon Fraser  <simon.fraser@apple.com>
610
611         Make WebCore::Timer more space-efficient
612         https://bugs.webkit.org/show_bug.cgi?id=187455
613
614         Reviewed by Brent Fulgham.
615
616         Steal a bit from m_heapIndex for m_wasDeleted to eliminate padding in Timer.
617         This reduces the size of Document, which has 8 Timers, from 3360 to 3296 bytes (saving 64 bytes).
618
619         * platform/Timer.cpp:
620         (WebCore::TimerBase::TimerBase):
621         * platform/Timer.h:
622
623 2018-08-04  Ryosuke Niwa  <rniwa@webkit.org>
624
625         Properties set on window.customElements can disappear due to GC
626         https://bugs.webkit.org/show_bug.cgi?id=172575
627         <rdar://problem/32440668>
628
629         Reviewed by Saam Barati.
630
631         Fixed the bug that JS wrapper of CustomElementsRegistry can erroneously get collected during GC
632         by keeping it alive as long as the global object is alive.
633
634         Test: fast/custom-elements/custom-element-registry-wrapper-should-stay-alive.html
635
636         * dom/CustomElementRegistry.cpp:
637         (WebCore::CustomElementRegistry::create):
638         (WebCore::CustomElementRegistry::CustomElementRegistry):
639         * dom/CustomElementRegistry.h:
640         (WebCore::CustomElementRegistry): Make this inherited from ContextDestructionObserver.
641         * dom/CustomElementRegistry.idl: Set GenerateIsReachable=ImplScriptExecutionContext in IDL. This will
642         make CustomElementRegistry reachable from the global object.
643         * page/DOMWindow.cpp:
644         (WebCore::DOMWindow::ensureCustomElementRegistry):
645
646 2018-08-03  Ryosuke Niwa  <rniwa@webkit.org>
647
648         innerHTML should not synchronously create a custom element
649         https://bugs.webkit.org/show_bug.cgi?id=188327
650         <rdar://problem/42923114>
651
652         Reviewed by Daniel Bates.
653
654         Fixed the bug that the fragment parsing algorithm was synchronously constructing a custom element instead of
655         enqueuing an element to upgrade.
656
657         The fragment parsing algorithm creates an element for a token with *will execute script* flag set to false:
658         https://html.spec.whatwg.org/multipage/parsing.html#create-an-element-for-the-token
659         which results in creating an element with synchronous custom elements flag *not* set:
660         https://dom.spec.whatwg.org/#concept-create-element
661
662         When synchronous custom elements flag is false, we're supposed to create an element and enqueue a custom element
663         upgrade reaction. createHTMLElementOrFindCustomElementInterface was missing this last logic. 
664
665         Also fixed a bug that Element::enqueueToUpgrade would hit a debug assertion when a custom element which has been
666         enqueued to upgrade is enqueued to upgrade for the second time. In this case, we need to put the element into the
667         current element queue (https://html.spec.whatwg.org/multipage/custom-elements.html#current-element-queue) again.
668
669         While the specification simply enqueues another upgrade reaction and bails out immediately in the first step of
670         the upgrade, WebKit's implementation simply avoids this redundancy in the first place:
671         https://html.spec.whatwg.org/multipage/custom-elements.html#concept-upgrade-an-element
672
673         Existing tests such as imported/w3c/web-platform-tests/custom-elements/reactions/Document.html exercises this
674         code path after the fragment parsing algorithm fix.
675
676         Tests: imported/w3c/web-platform-tests/custom-elements/connected-callbacks-html-fragment-parsing.html
677
678         * dom/CustomElementReactionQueue.cpp:
679         (WebCore::CustomElementReactionQueueItem::type const): Added for an assertion.
680         (WebCore::CustomElementReactionQueue::enqueueElementUpgrade): Enqueue this element to the current element queue
681         by calling ensureCurrentQueue and avoid inserting a redundant upgrade reaction.
682         * dom/CustomElementReactionQueue.h:
683         * dom/Element.cpp:
684         (WebCore::Element::enqueueToUpgrade): Handle the case when a custom element is enqueued to upgrade for the second
685         time while it had been waiting in some element queue. In this case, the reaction queue for this element has
686         already been created and we simply need to put this element back into the current element queue (i.e. this element
687         now belongs to both element queues).
688         * html/parser/HTMLConstructionSite.cpp:
689         (WebCore::findCustomElementInterface): Extracted out of createHTMLElementOrFindCustomElementInterface.
690         (WebCore::HTMLConstructionSite::createHTMLElementOrFindCustomElementInterface): Fixed the bug that the HTML parser
691         was synchronously constructing a custom element even for the fragment parsing algorithm.
692
693 2018-08-03  Ben Richards  <benton_richards@apple.com>
694
695         We should cache the compiled sandbox profile in a data vault
696         https://bugs.webkit.org/show_bug.cgi?id=184991
697
698         Reviewed by Ryosuke Niwa.
699
700         Added functionality to FileHandle so that it can lock a file while open.
701         Added a function to FileSystem to delete non empty directories.
702
703         * platform/FileHandle.cpp:
704         (WebCore::FileHandle::FileHandle):
705         (WebCore::FileHandle::open):
706         (WebCore::FileHandle::close):
707         * platform/FileHandle.h:
708         * platform/FileSystem.h:
709         * platform/cocoa/FileSystemCocoa.mm:
710         (WebCore::FileSystem::deleteNonEmptyDirectory):
711
712 2018-08-03  Justin Fan  <justin_fan@apple.com>
713
714         WebGL 2 conformance: vertex_arrays/vertex_array_object.html
715         https://bugs.webkit.org/show_bug.cgi?id=188291
716         <rdar://problem/42792709>
717
718         Reviewed by Dean Jackson.
719
720         Get https://www.khronos.org/registry/webgl/conformance-suites/2.0.0/conformance2/vertex_arrays/vertex-array-object.html 
721         working on Mac OS and iOS, and check in the new test expectations.
722
723         Existing test: webgl/2.0.0/conformance2/vertex_arrays/vertex-array-object.html
724
725         * html/canvas/WebGL2RenderingContext.cpp:
726         (WebCore::WebGL2RenderingContext::initializeVertexArrayObjects):
727         (WebCore::WebGL2RenderingContext::deleteVertexArray):
728         * html/canvas/WebGLRenderingContextBase.cpp:
729         (WebCore::WebGLRenderingContextBase::deleteObject):
730         * html/canvas/WebGLVertexArrayObject.cpp:
731         (WebCore::WebGLVertexArrayObject::WebGLVertexArrayObject):
732         * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
733         (WebCore::GraphicsContext3D::checkVaryingsPacking const):
734         (WebCore::GraphicsContext3D::createVertexArray):
735         (WebCore::GraphicsContext3D::deleteVertexArray):
736         (WebCore::GraphicsContext3D::isVertexArray):
737         (WebCore::GraphicsContext3D::bindVertexArray):
738
739 2018-08-03  Sam Weinig  <sam@webkit.org>
740
741         Remove WebGPUObject
742         https://bugs.webkit.org/show_bug.cgi?id=188114
743
744         Reviewed by Darin Adler.
745
746         This removes the unecessary WebGPUObject base class and updates the classes
747         that were inheriting from it to instead inherit directly from RefCounted. This
748         shrinks the size of all the classes that were inheriting from it, as they no
749         longer store a RefPtr<WebGPURenderingContext> member, which is unused. Most
750         of the classes also shrink because they can be devirtualized.
751
752         This also updates most of the create functions and constructors for the classes
753         that were inheriting from WebGPUObject to no longer require the WebGPURenderingContext
754         to be passed in. 
755         - For WebGPUBuffer, WebGPUCommandQueue, WebGPUComputeCommandEncoder, WebGPUComputePipelineState, 
756         WebGPUDepthStencilState, WebGPUDrawable, WebGPUFunction, WebGPULibrary, WebGPURenderCommandEncoder, 
757         WebGPURenderPassDepthAttachmentDescriptor, WebGPURenderPipelineColorAttachmentDescriptor, 
758         WebGPURenderPipelineState, and WebGPUTexture the WebGPURenderingContext and any other additional 
759         parameters needed for initialization were replaced with the underlying type (e.g. WebGPUBuffer 
760         now gets passed a GPUBuffer).
761         - WebGPUCommandBuffer is passed a GPUCommandQueue, since it needs to construct the underlying
762         GPUCommandBuffer itself so it can pass in the completion handler.
763         - For WebGPUDepthStencilDescriptor, WebGPURenderPassAttachmentDescriptor, 
764         WebGPURenderPassColorAttachmentDescriptor, WebGPURenderPassDescriptor and WebGPURenderPipelineDescriptor
765         the create and constructor functions are empty.        
766
767         * Sources.txt:
768         * WebCore.xcodeproj/project.pbxproj:
769         Remove WebGPUObject.h/cpp
770
771         * html/canvas/WebGPUBuffer.cpp:
772         (WebCore::WebGPUBuffer::WebGPUBuffer):
773         * html/canvas/WebGPUBuffer.h:
774         * html/canvas/WebGPUBuffer.idl:
775         Switch from inheriting from WebGPUObject to directly inheriting from 
776         RefCounted<WebGPUBuffer>. Since this de-virtualizes it, also add 
777         ImplementationLacksVTable to the IDL file. Also update create 
778         and constructor to take a GPUBuffer directly, rather than the context.
779
780         * html/canvas/WebGPUCommandBuffer.cpp:
781         (WebCore::WebGPUCommandBuffer::create):
782         (WebCore::WebGPUCommandBuffer::WebGPUCommandBuffer):
783         Update create and constructor to no longer require a context, as it would
784         now be unused, as it no longer inherits from WebGPUObject nor needs to hold
785         onto the context for any reason.
786
787         (WebCore::WebGPUCommandBuffer::createRenderCommandEncoderWithDescriptor):
788         Update to call the new WebGPURenderCommandEncoder::create, which no longer
789         requires a context.
790
791         (WebCore::WebGPUCommandBuffer::createComputeCommandEncoder):
792         Update to call the new WebGPUComputeCommandEncoder::create, which no longer
793         requires a context.
794
795         * html/canvas/WebGPUCommandBuffer.h:
796         * html/canvas/WebGPUCommandBuffer.idl:
797         Switch from inheriting from GPUObject to directly inheriting from 
798         RefCounted<WebGPUCommandBuffer>. Since this de-virtualizes it, also add 
799         ImplementationLacksVTable to the IDL file. Also update create and constructor 
800         to no longer take a context, and just take a GPUCommandQueue. We can't directly
801         pass a GPUCommandBuffer as WebGPUCommandBuffer needs to pass in a completion handler
802         on construction of the underlying GPUCommandBuffer.
803         
804         * html/canvas/WebGPUCommandQueue.cpp:
805         (WebCore::WebGPUCommandQueue::WebGPUCommandQueue):
806         (WebCore::WebGPUCommandQueue::createCommandBuffer):
807         Update to call the new WebGPUCommandBuffer::create, which no longer
808         requires a context.
809     
810         * html/canvas/WebGPUCommandQueue.h:
811         * html/canvas/WebGPUCommandQueue.idl:
812         Switch from inheriting from GPUObject to directly inheriting from 
813         RefCounted<WebGPUCommandQueue>. Since this de-virtualizes it, also add 
814         ImplementationLacksVTable to the IDL file. Also update create and
815         constructor to take a GPUCommandQueue directly.
816
817         * html/canvas/WebGPUComputeCommandEncoder.cpp:
818         (WebCore::WebGPUComputeCommandEncoder::create):
819         (WebCore::WebGPUComputeCommandEncoder::WebGPUComputeCommandEncoder):
820         * html/canvas/WebGPUComputeCommandEncoder.h:
821         * html/canvas/WebGPUComputeCommandEncoder.idl:
822         Switch from inheriting from GPUObject to directly inheriting from 
823         RefCounted<WebGPUComputeCommandEncoder>. Since this de-virtualizes it, 
824         also add ImplementationLacksVTable to the IDL file. Also update create and
825         constructor to take a GPUComputeCommandEncoder directly
826
827         * html/canvas/WebGPUComputePipelineState.cpp:
828         (WebCore::WebGPUComputePipelineState::WebGPUComputePipelineState):
829         * html/canvas/WebGPUComputePipelineState.h:
830         * html/canvas/WebGPUComputePipelineState.idl:
831         Switch from inheriting from WebGPUObject to directly inheriting from 
832         RefCounted<WebGPUComputePipelineState>. Since this de-virtualizes it, also add 
833         ImplementationLacksVTable to the IDL file. Also update create and
834         constructor to take a GPUComputePipelineState directly.
835
836         * html/canvas/WebGPUDepthStencilDescriptor.cpp:
837         Remove unneeded include of include "WebGPURenderingContext.h".
838
839         * html/canvas/WebGPUDepthStencilDescriptor.h:
840         * html/canvas/WebGPUDepthStencilDescriptor.idl:
841         Switch from inheriting from WebGPUObject to directly inheriting from 
842         RefCounted<WebGPUDepthStencilDescriptor>. Since this de-virtualizes it, also add 
843         ImplementationLacksVTable to the IDL file.
844
845         * html/canvas/WebGPUDepthStencilState.cpp:
846         (WebCore::WebGPUDepthStencilState::WebGPUDepthStencilState):
847         * html/canvas/WebGPUDepthStencilState.h:
848         * html/canvas/WebGPUDepthStencilState.idl:
849         Switch from inheriting from WebGPUObject to directly inheriting from 
850         RefCounted<WebGPUDepthStencilState>. Since this de-virtualizes it, also add 
851         ImplementationLacksVTable to the IDL file. Also update create and
852         constructor to take a GPUDepthStencilState directly.
853
854         * html/canvas/WebGPUDrawable.cpp:
855         (WebCore::WebGPUDrawable::WebGPUDrawable):
856         * html/canvas/WebGPUDrawable.h:
857         * html/canvas/WebGPUDrawable.idl:
858         Switch from inheriting from WebGPUObject to directly inheriting from 
859         RefCounted<WebGPUDrawable>. Since this de-virtualizes it, also add 
860         ImplementationLacksVTable to the IDL file. Also update create and
861         constructor to take a GPUDrawable directly.
862
863         * html/canvas/WebGPUFunction.cpp:
864         (WebCore::WebGPUFunction::create):
865         (WebCore::WebGPUFunction::WebGPUFunction):
866         * html/canvas/WebGPUFunction.h:
867         * html/canvas/WebGPUFunction.idl:
868         Switch from inheriting from GPUObject to directly inheriting from 
869         RefCounted<WebGPUFunction>. Since this de-virtualizes it, also add 
870         ImplementationLacksVTable to the IDL file. Also update create and
871         constructor to take a GPUFunction directly.
872
873         * html/canvas/WebGPULibrary.cpp:
874         (WebCore::WebGPULibrary::WebGPULibrary):
875         (WebCore::WebGPULibrary::functionWithName const):
876         Update for new WebGPUFunction::create, which no longer requires a
877         context.
878
879         * html/canvas/WebGPULibrary.h:
880         * html/canvas/WebGPULibrary.idl:
881         Switch from inheriting from WebGPUObject to directly inheriting from 
882         RefCounted<WebGPULibrary>. Since this de-virtualizes it, also add 
883         ImplementationLacksVTable to the IDL file. Also update create and
884         constructor to take a GPULibrary directly, rather than the context.
885         Unlike the other create functions that take their underlying type, this
886         one also continues to need the sourceCode String to be passed, as that
887         is not available from the underlying GPULibrary and must be stored
888         seperately.
889
890         * html/canvas/WebGPUObject.cpp: Removed.
891         * html/canvas/WebGPUObject.h: Removed.
892         Deleted.
893
894         * html/canvas/WebGPURenderCommandEncoder.cpp:
895         (WebCore::WebGPURenderCommandEncoder::create):
896         (WebCore::WebGPURenderCommandEncoder::WebGPURenderCommandEncoder):
897         * html/canvas/WebGPURenderCommandEncoder.h:
898         * html/canvas/WebGPURenderCommandEncoder.idl:
899         Switch from inheriting from GPUObject to directly inheriting from
900         RefCounted<WebGPURenderCommandEncoder>. Since this de-virtualizes it, also add
901         ImplementationLacksVTable to the IDL file. Also update create and
902         constructor to take a GPURenderCommandEncoder directly.
903
904         * html/canvas/WebGPURenderPassAttachmentDescriptor.cpp:
905         (WebCore::WebGPURenderPassAttachmentDescriptor::WebGPURenderPassAttachmentDescriptor):
906         * html/canvas/WebGPURenderPassAttachmentDescriptor.h:
907         Switch from inheriting from GPUObject to directly inheriting from 
908         RefCounted<WebGPURenderPassAttachmentDescriptor>. Also update create and 
909         constructor to no longer take a context, as it is now not used. This remains virtual
910         as it is inherited from by WebGPURenderPassColorAttachmentDescriptor and WebGPURenderPassDepthAttachmentDescriptor.
911
912         * html/canvas/WebGPURenderPassColorAttachmentDescriptor.cpp:
913         (WebCore::WebGPURenderPassColorAttachmentDescriptor::create):
914         (WebCore::WebGPURenderPassColorAttachmentDescriptor::WebGPURenderPassColorAttachmentDescriptor):
915         * html/canvas/WebGPURenderPassColorAttachmentDescriptor.h:
916         Update create and constructor to no longer take a context, as it is now not used. Declare final
917         as this is not inherited by anything.
918
919         * html/canvas/WebGPURenderPassDepthAttachmentDescriptor.cpp:
920         (WebCore::WebGPURenderPassDepthAttachmentDescriptor::create):
921         (WebCore::WebGPURenderPassDepthAttachmentDescriptor::WebGPURenderPassDepthAttachmentDescriptor):
922         * html/canvas/WebGPURenderPassDepthAttachmentDescriptor.h:
923         Update create and constructor to no longer take a context, as it is now not used. Declare final
924         as this is not inherited by anything.
925
926         * html/canvas/WebGPURenderPassDescriptor.cpp:
927         (WebCore::WebGPURenderPassDescriptor::depthAttachment):
928         Update for new WebGPURenderPassDepthAttachmentDescriptor::create function which no longer requires
929         a context. 
930         
931         Semi-interesting note: This function was previously calling "*context()" to pass a WebGPURenderingContext&
932         to WebGPURenderPassDepthAttachmentDescriptor::create. However, "context()" was always returning null, as
933         the constructor of WebGPURenderPassDescriptor was not initializing the WebGPUObject with a WebGPURenderingContext.
934         Now, one might think that this would cause a null-deref, but, because it was being assigned into a 
935         WebGPURenderingContext&, no dereference happens right away (it essentially just passes a pointer) and since
936         the function it is being passed to does not use it, it never actually gets dereferenced.
937
938         (WebCore::WebGPURenderPassDescriptor::colorAttachments):
939         Update for new WebGPURenderPassColorAttachmentDescriptor::create function which no longer requires
940         a context. 
941
942         * html/canvas/WebGPURenderPassDescriptor.h:
943         * html/canvas/WebGPURenderPassDescriptor.idl:
944         Switch from inheriting from GPUObject to directly inheriting from
945         RefCounted<WebGPURenderPassDescriptor>. Since this de-virtualizes it, also add
946         ImplementationLacksVTable to the IDL file.
947
948         * html/canvas/WebGPURenderPipelineColorAttachmentDescriptor.cpp:
949         (WebCore::WebGPURenderPipelineColorAttachmentDescriptor::create):
950         (WebCore::WebGPURenderPipelineColorAttachmentDescriptor::WebGPURenderPipelineColorAttachmentDescriptor):
951         * html/canvas/WebGPURenderPipelineColorAttachmentDescriptor.h:
952         * html/canvas/WebGPURenderPipelineColorAttachmentDescriptor.idl:
953         Switch from inheriting from GPUObject to directly inheriting from
954         RefCounted<WebGPURenderPipelineColorAttachmentDescriptor>. Since this de-virtualizes it, also add
955         ImplementationLacksVTable to the IDL file. Also update create and constructor to
956         no longer take a context, as it is now not used.
957
958         * html/canvas/WebGPURenderPipelineDescriptor.cpp:
959         (WebCore::WebGPURenderPipelineDescriptor::colorAttachments):
960         Update for new WebGPURenderPipelineColorAttachmentDescriptor::create which no longer requires
961         a context.
962
963         * html/canvas/WebGPURenderPipelineDescriptor.h:
964         * html/canvas/WebGPURenderPipelineDescriptor.idl:
965         Switch from inheriting from GPUObject to directly inheriting from
966         RefCounted<WebGPURenderPipelineDescriptor>. Since this de-virtualizes it, also add
967         ImplementationLacksVTable to the IDL file.
968
969         * html/canvas/WebGPURenderPipelineState.cpp:
970         (WebCore::WebGPURenderPipelineState::WebGPURenderPipelineState):
971         * html/canvas/WebGPURenderPipelineState.h:
972         * html/canvas/WebGPURenderPipelineState.idl:
973         Switch from inheriting from GPUObject to directly inheriting from
974         RefCounted<WebGPURenderPipelineState>. Since this de-virtualizes it, also add
975         ImplementationLacksVTable to the IDL file. Also update create and
976         constructor to take a GPURenderPipelineState directly.
977
978         * html/canvas/WebGPURenderingContext.cpp:
979         (WebCore::WebGPURenderingContext::createLibrary):
980         (WebCore::WebGPURenderingContext::createRenderPipelineState):
981         (WebCore::WebGPURenderingContext::createDepthStencilState):
982         (WebCore::WebGPURenderingContext::createComputePipelineState):
983         (WebCore::WebGPURenderingContext::createCommandQueue):
984         (WebCore::WebGPURenderingContext::nextDrawable):
985         (WebCore::WebGPURenderingContext::createBuffer):
986         (WebCore::WebGPURenderingContext::createTexture):
987         Update for new create functions which require the caller to pass
988         the underlying type.
989
990         * html/canvas/WebGPUTexture.cpp:
991         (WebCore::WebGPUTexture::createFromDrawableTexture):
992         Renamed to create.
993
994         (WebCore::WebGPUTexture::create): Deleted
995         All callers now pass a GPUTexture directly.
996
997         * html/canvas/WebGPUTexture.h:
998         * html/canvas/WebGPUTexture.idl:
999         Switch from inheriting from GPUObject to directly inheriting from
1000         RefCounted<WebGPUTexture>. Since this de-virtualizes it, also add
1001         ImplementationLacksVTable to the IDL file. 
1002
1003         * html/canvas/WebGPUTextureDescriptor.h:
1004         * html/canvas/WebGPUTextureDescriptor.idl:
1005         Switch from inheriting from GPUObject to directly inheriting from
1006         RefCounted<WebGPUTextureDescriptor>. Since this de-virtualizes it, also add
1007         ImplementationLacksVTable to the IDL file.
1008
1009 2018-08-03  Alex Christensen  <achristensen@webkit.org>
1010
1011         Fix spelling of "overridden"
1012         https://bugs.webkit.org/show_bug.cgi?id=188315
1013
1014         Reviewed by Darin Adler.
1015
1016         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
1017         (-[WebAccessibilityObjectWrapper accessibilityLabel]):
1018         (-[WebAccessibilityObjectWrapper accessibilityValue]):
1019         * contentextensions/ContentExtensionsBackend.h:
1020         * editing/EditingStyle.cpp:
1021         (WebCore::EditingStyle::removeStyleFromRulesAndContext):
1022         * inspector/CommandLineAPIModuleSource.js:
1023         * platform/ScrollView.h:
1024         * platform/ScrollableArea.h:
1025         * platform/mediasession/MediaSessionInterruptionProvider.h:
1026         * rendering/RenderFragmentedFlow.cpp:
1027         (WebCore::RenderFragmentedFlow::adjustedPositionRelativeToOffsetParent const):
1028         * rendering/RenderLayer.h:
1029         * rendering/RenderListBox.h:
1030         * rendering/svg/RenderSVGResourceClipper.cpp:
1031         (WebCore::RenderSVGResourceClipper::drawContentIntoMaskImage):
1032         * svg/SVGElement.cpp:
1033         (WebCore::SVGElement::localCoordinateSpaceTransform const):
1034         * svg/SVGLengthContext.cpp:
1035         (WebCore::SVGLengthContext::SVGLengthContext):
1036         (WebCore::SVGLengthContext::convertValueToUserUnits const):
1037         (WebCore::SVGLengthContext::determineViewport const):
1038         * svg/SVGLengthContext.h:
1039
1040 2018-08-03  Zalan Bujtas  <zalan@apple.com>
1041
1042         [LFC][BFC] Special case the document renderer when computing the height and margin
1043         https://bugs.webkit.org/show_bug.cgi?id=188313
1044
1045         Reviewed by Antti Koivisto.
1046
1047         The document renderer is certainly special and its geometry is likely to be computed as part of "10.6.6 Complicated cases" (spec is unclear) but probably not by
1048         making the it a formatting root. Let's just special case it at contentHeightForFormattingContextRoot(), since having the document renderer as a context root has unwanted side effect. 
1049
1050         * layout/FormattingContextGeometry.cpp:
1051         (WebCore::Layout::contentHeightForFormattingContextRoot):
1052         * layout/layouttree/LayoutBox.cpp:
1053         (WebCore::Layout::Box::establishesBlockFormattingContext const):
1054
1055 2018-08-03  Zalan Bujtas  <zalan@apple.com>
1056
1057         [LFC][BFC] Layout out-of-flow descendants only on the formatting context root.
1058         https://bugs.webkit.org/show_bug.cgi?id=188312
1059
1060         Reviewed by Antti Koivisto.
1061
1062         Collect out-of-flow descendants on the formatting root container instead of the containing block and run layout on them on the root level. It's more efficient this way.
1063
1064         * layout/blockformatting/BlockFormattingContext.cpp:
1065         (WebCore::Layout::BlockFormattingContext::layout const):
1066         * layout/layouttree/LayoutTreeBuilder.cpp:
1067         (WebCore::Layout::TreeBuilder::createSubTree):
1068
1069 2018-08-03  Andy Estes  <aestes@apple.com>
1070
1071         ContentFilterUnblockHandler's constructors access moved-from variables
1072         https://bugs.webkit.org/show_bug.cgi?id=188308
1073         <rdar://problem/42882758>
1074
1075         Reviewed by Alex Christensen.
1076
1077         * platform/cocoa/ContentFilterUnblockHandlerCocoa.mm:
1078
1079 2018-08-03  Zalan Bujtas  <zalan@apple.com>
1080
1081         [LFC][Floating] Now that the document renderer belongs to "complicated cases", adjust viewport stretching.
1082         https://bugs.webkit.org/show_bug.cgi?id=188306
1083
1084         Reviewed by Antti Koivisto.
1085
1086         And add passing cases for floats.
1087
1088         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
1089         (WebCore::Layout::initialContainingBlock):
1090         (WebCore::Layout::isStretchedToInitialContainingBlock):
1091         (WebCore::Layout::stretchHeightToInitialContainingBlock):
1092         (WebCore::Layout::stretchWidthToInitialContainingBlock):
1093         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin):
1094         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin):
1095         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowHeightAndMargin):
1096         (WebCore::Layout::isStretchedToViewport): Deleted.
1097
1098 2018-08-03  Zalan Bujtas  <zalan@apple.com>
1099
1100         [LFC] Do not check margin box while validating geometry.
1101         https://bugs.webkit.org/show_bug.cgi?id=188297
1102
1103         Reviewed by Antti Koivisto.
1104
1105         The current RenderBox::marginBox implementation is not spec compliant. Ignore it for now.
1106
1107         * layout/Verification.cpp:
1108         (WebCore::Layout::outputMismatchingBlockBoxInformationIfNeeded):
1109
1110 2018-08-03  Carlos Garcia Campos  <cgarcia@igalia.com>
1111
1112         [WPE] Use WPE key symbols and new API instead of xkbcommon and the key mapper
1113         https://bugs.webkit.org/show_bug.cgi?id=188093
1114
1115         Reviewed by Žan Doberšek.
1116
1117         Add helper functions to get key code, hardware key code, key identifier and windows key code from a WPE key symbol.
1118
1119         * platform/PlatformKeyboardEvent.h:
1120         * platform/wpe/PlatformKeyboardEventWPE.cpp:
1121         (WebCore::PlatformKeyboardEvent::keyValueForWPEKeyCode):
1122         (WebCore::PlatformKeyboardEvent::keyCodeForHardwareKeyCode):
1123         (WebCore::PlatformKeyboardEvent::keyIdentifierForWPEKeyCode):
1124         (WebCore::PlatformKeyboardEvent::windowsKeyCodeForWPEKeyCode):
1125         (WebCore::PlatformKeyboardEvent::singleCharacterString):
1126
1127 2018-08-02  Ryosuke Niwa  <rniwa@webkit.org>
1128
1129         Release assert when throwing exceptions in custom element reactions
1130         https://bugs.webkit.org/show_bug.cgi?id=187805
1131         <rdar://problem/42432714>
1132
1133         Reviewed by Saam Barati.
1134
1135         The release assertion was hit because we were not catching & re-throwing the exception thrown by DOM API
1136         before trying to execute custom elements reactions in ~CustomElementReactionStack as specified here:
1137         https://html.spec.whatwg.org/multipage/custom-elements.html#cereactions
1138         Fixed the bug by capturing the exception and re-throwing the exception as specified.
1139
1140         Tests: imported/w3c/web-platform-tests/custom-elements/reactions/with-exceptions.html
1141
1142         * bindings/js/JSMainThreadExecState.h:
1143         (WebCore::JSMainThreadNullState::JSMainThreadNullState): Use the previous JS state.
1144         * bindings/scripts/CodeGeneratorJS.pm:
1145         (GeneratePut): Pass in the exec state to CustomElementReactionStack.
1146         (GeneratePutByIndex): Ditto.
1147         (GenerateDefineOwnProperty): Ditto.
1148         (GenerateDeletePropertyCommon): Ditto.
1149         (GenerateAttributeSetterBodyDefinition): Ditto.
1150         (GenerateOperationBodyDefinition): Ditto.
1151         * bindings/scripts/test/JS/JSTestCEReactions.cpp:
1152         (WebCore::setJSTestCEReactionsAttributeWithCEReactionsSetter):
1153         (WebCore::setJSTestCEReactionsReflectAttributeWithCEReactionsSetter):
1154         (WebCore::jsTestCEReactionsPrototypeFunctionMethodWithCEReactionsBody):
1155         * bindings/scripts/test/JS/JSTestCEReactionsStringifier.cpp:
1156         (WebCore::setJSTestCEReactionsStringifierValueSetter):
1157         * dom/CustomElementReactionQueue.cpp:
1158         (WebCore::CustomElementReactionQueue::ElementQueue::processQueue): Added. If there is a script running
1159         in the stack (i.e. ExecState is not null), catch any exception before executing custom element reactions,
1160         then re-throw the exception afterwards. ExecState is null when DOM API is invoked via Objective-C bindings
1161         or when custom element reactions are executed in the backup queue (e.g. for editing operations).
1162         (WebCore::CustomElementReactionStack::processQueue):
1163         (WebCore::CustomElementReactionQueue::processBackupQueue):
1164         * dom/CustomElementReactionQueue.h:
1165         (WebCore::CustomElementReactionStack::CustomElementReactionStack):
1166         (WebCore::CustomElementReactionStack::~CustomElementReactionStack):
1167
1168 2018-08-02  Zalan Bujtas  <zalan@apple.com>
1169
1170         [LFC][BFC] Apply the "10.6.6 Complicated cases" when computing height and margin for the document renderer
1171         https://bugs.webkit.org/show_bug.cgi?id=188296
1172
1173         Reviewed by Simon Fraser.
1174
1175         The spec is not clear about what to do with the document renderer. It behaves as if it was a formatting context root when
1176         it comes to computing the content height. Let's apply "10.6.6 Complicated cases" for now.
1177
1178         * layout/FormattingContext.h:
1179         * layout/FormattingContextGeometry.cpp:
1180         (WebCore::Layout::FormattingContext::Geometry::complicatedCases):
1181         (WebCore::Layout::FormattingContext::Geometry::floatingHeightAndMargin):
1182         (WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedHeightAndMargin): Deleted.
1183         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
1184         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin):
1185         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowHeightAndMargin):
1186         * layout/layouttree/LayoutBox.cpp:
1187         (WebCore::Layout::Box::establishesBlockFormattingContext const):
1188         * layout/layouttree/LayoutBox.h:
1189
1190 2018-08-02  Zalan Bujtas  <zalan@apple.com>
1191
1192         [LFC][Floating] Add FloatingState::bottom() to enable content height computation for formatting roots.
1193         https://bugs.webkit.org/show_bug.cgi?id=188294
1194
1195         Reviewed by Simon Fraser.
1196
1197         "10.6.7 'Auto' heights for block formatting context roots
1198         ...
1199         In addition, if the element has any floating descendants whose bottom margin edge is below the element's bottom content edge,
1200         then the height is increased to include those edges. Only floats that participate in this block formatting context are taken into
1201         account, e.g., floats inside absolutely positioned descendants or other floats are not..."
1202
1203         * layout/FloatingState.cpp:
1204         (WebCore::Layout::FloatingState::bottom const):
1205         * layout/FloatingState.h:
1206         * layout/FormattingContextGeometry.cpp:
1207         (WebCore::Layout::contentHeightForFormattingContextRoot):
1208
1209 2018-08-02  Jer Noble  <jer.noble@apple.com>
1210
1211         Control center controls disappear when pausing, locking device.
1212         https://bugs.webkit.org/show_bug.cgi?id=188282
1213         <rdar://problem/42497809>
1214
1215         Reviewed by Eric Carlson.
1216
1217         Test: platform/mac/media/audio-session-category-video-paused.html
1218
1219         MediaRemote will set any app whose audio session category changes from MediaPlayback to
1220         Ambient as not eligable for being the "now playing" app. Previously, due to the ordering of
1221         events, we never moved from MediaPlayback to Ambient when pausing <video>, even though that
1222         was the intention. Now that that bug is fixed, it exposed this new issue with MediaRemote.
1223
1224         To solve the new issue, make our audio session category policy more explicit: once we are in
1225         MediaPlayback category, we will remain so as long as the media element in queston stays
1226         loaded, has played, and is never interrupted by the system.
1227
1228         Make MediaSessionManagerCocoa a proper subclass of PlatformMediaSessionManager, and make
1229         MediaSessionManageriOS and -Mac subclasses of the -Cocoa class. Add a new
1230         m_hasPlayedSinceLastInterruption ivar to PlatformMediaSession, set when the state() changes
1231         to Playing, and cleared during an interruption. Check this flag when deciding what audio 
1232         sessino category to set in MediaSessionManagerCocoa.
1233
1234         * WebCore.xcodeproj/project.pbxproj:
1235         * platform/audio/PlatformMediaSession.cpp:
1236         (WebCore::PlatformMediaSession::setState):
1237         * platform/audio/PlatformMediaSession.h:
1238         (WebCore::PlatformMediaSession::hasPlayedSinceLastInterruption const):
1239         (WebCore::PlatformMediaSession::clearHasPlayedSinceLastInterruption):
1240         * platform/audio/PlatformMediaSessionManager.cpp:
1241         (WebCore::PlatformMediaSessionManager::updateSessionState): Deleted.
1242         * platform/audio/PlatformMediaSessionManager.h:
1243         (WebCore::PlatformMediaSessionManager::audioHardwareListener):
1244         (WebCore::PlatformMediaSessionManager::updateSessionState):
1245         * platform/audio/cocoa/MediaSessionManagerCocoa.cpp:
1246         (MediaSessionManagerCocoa::updateSessionState):
1247         (MediaSessionManagerCocoa::beginInterruption):
1248         (PlatformMediaSessionManager::updateSessionState): Deleted.
1249         * platform/audio/cocoa/MediaSessionManagerCocoa.h: Added.
1250         * platform/audio/ios/MediaSessionManagerIOS.h:
1251         * platform/audio/ios/MediaSessionManagerIOS.mm:
1252         (WebCore::MediaSessionManageriOS::MediaSessionManageriOS):
1253         * platform/audio/mac/MediaSessionManagerMac.h:
1254         * platform/audio/mac/MediaSessionManagerMac.mm:
1255         (WebCore::MediaSessionManagerMac::MediaSessionManagerMac):
1256
1257 2018-08-02  Nan Wang  <n_wang@apple.com>
1258
1259         AX: [iOS] add support to return the attributed string under the element
1260         https://bugs.webkit.org/show_bug.cgi?id=188276
1261         <rdar://problem/42872357>
1262
1263         Reviewed by Chris Fleizach.
1264
1265         Provided a way on iOS to return the attributed string under the element for 
1266         better performance.
1267
1268         Test: accessibility/ios-simulator/attributed-string-for-element.html
1269
1270         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
1271         (-[WebAccessibilityObjectWrapper _stringFromStartMarker:toEndMarker:attributed:]):
1272         (-[WebAccessibilityObjectWrapper _stringForRange:attributed:]):
1273         (-[WebAccessibilityObjectWrapper attributedStringForElement]):
1274
1275 2018-08-02  Zalan Bujtas  <zalan@apple.com>
1276
1277         [LFC][Floating] Remove redundant LayoutContext member variable.
1278         https://bugs.webkit.org/show_bug.cgi?id=188286
1279
1280         Reviewed by Simon Fraser.
1281
1282         * layout/FloatingContext.cpp:
1283         (WebCore::Layout::begin):
1284         (WebCore::Layout::end):
1285         (WebCore::Layout::FloatingContext::floatingPosition const):
1286         (WebCore::Layout::FloatingPair::FloatingPair):
1287         (WebCore::Layout::Iterator::Iterator):
1288
1289 2018-08-02  Ryosuke Niwa  <rniwa@webkit.org>
1290
1291         Move queue processing logic from CustomElementReactionStack to CustomElementReactionQueue
1292         https://bugs.webkit.org/show_bug.cgi?id=188277
1293
1294         Reviewed by Wenson Hsieh.
1295
1296         Moved ensureCurrentQueue, processBackupQueue, ElementQueue, ensureBackupQueue, and backupElementQueue
1297         from CustomElementReactionStack to CustomElementReactionQueue to simplify CustomElementReactionStack.
1298
1299         No new tests since there is no behavior change.
1300
1301         * dom/CustomElementReactionQueue.cpp:
1302         (WebCore::CustomElementReactionQueue::enqueueElementUpgrade):
1303         (WebCore::CustomElementReactionQueue::enqueueConnectedCallbackIfNeeded):
1304         (WebCore::CustomElementReactionQueue::enqueueDisconnectedCallbackIfNeeded):
1305         (WebCore::CustomElementReactionQueue::enqueueAdoptedCallbackIfNeeded):
1306         (WebCore::CustomElementReactionQueue::enqueueAttributeChangedCallbackIfNeeded):
1307         (WebCore::CustomElementReactionQueue::ElementQueue::add): Moved from CustomElementReactionStack.
1308         (WebCore::CustomElementReactionQueue::ElementQueue::invokeAll): Ditto.
1309         (WebCore::CustomElementReactionQueue::ensureCurrentQueue): Ditto.
1310         (WebCore::CustomElementReactionQueue::ensureBackupQueue): Ditto.
1311         (WebCore::CustomElementReactionQueue::processBackupQueue): Ditto.
1312         (WebCore::CustomElementReactionQueue::backupElementQueue): Ditto.
1313         * dom/CustomElementReactionQueue.h:
1314         (WebCore::CustomElementReactionStack::hasCurrentProcessingStack): Deleted. It was never called.
1315
1316 2018-08-02  Timothy Hatcher  <timothy@apple.com>
1317
1318         Text selection color is hard to see in dark mode web views.
1319         https://bugs.webkit.org/show_bug.cgi?id=188260
1320         rdar://problem/42721294
1321
1322         Reviewed by Simon Fraser.
1323
1324         Stop using blendWithWhite() to transform the AppKit selection color in dark mode.
1325         Using an alpha of 80% gives good contrast, and still works good for selections over images.
1326
1327         * platform/graphics/Color.cpp:
1328         (WebCore::Color::blendWithWhite const): Mark new colors as semantic if the original is.
1329         (WebCore::Color::colorWithAlpha const): Ditto.
1330         * rendering/RenderElement.cpp:
1331         (WebCore::RenderElement::selectionBackgroundColor const): Use transformSelectionBackgroundColor.
1332         * rendering/RenderTheme.cpp:
1333         (WebCore::RenderTheme::activeSelectionBackgroundColor const): Use transformSelectionBackgroundColor.
1334         (WebCore::RenderTheme::inactiveSelectionBackgroundColor const): Ditto.
1335         (WebCore::RenderTheme::transformSelectionBackgroundColor const): Added. Just blend with white.
1336         * rendering/RenderTheme.h:
1337         * rendering/RenderThemeMac.h:
1338         * rendering/RenderThemeMac.mm:
1339         (WebCore::RenderThemeMac::transformSelectionBackgroundColor const): Added. Use an alpha with the color
1340         in dark mode, otherwise fallback to RenderTheme.
1341         (WebCore::RenderThemeMac::systemColor const): Use activeListBoxSelectionBackgroundColor()
1342         and activeSelectionBackgroundColor() instead of caching the colors again. Update hardcoded color.
1343
1344 2018-08-02  Zalan Bujtas  <zalan@apple.com>
1345
1346         [LFC][Floating] Use displayBox.rectWithMargin().bottom instead of displayBox.bottom() to where applicable.
1347         https://bugs.webkit.org/show_bug.cgi?id=188274
1348
1349         Reviewed by Antti Koivisto.
1350
1351         Float placement uses the margin box.
1352
1353         * layout/FloatingContext.cpp:
1354         (WebCore::Layout::FloatingPair::bottom const):
1355         (WebCore::Layout::Iterator::operator++):
1356         (WebCore::Layout::Iterator::set):
1357
1358 2018-08-02  Zalan Bujtas  <zalan@apple.com>
1359
1360         [LFC][Floating] Right aligned float's horizontal candidate position is miscomputed.
1361         https://bugs.webkit.org/show_bug.cgi?id=188273
1362
1363         Reviewed by Antti Koivisto.
1364
1365         rightAlignedBoxLeft is already shifted with the size of the margin box.
1366
1367         * layout/FloatingContext.cpp:
1368         (WebCore::Layout::FloatingContext::alignWithFloatings const):
1369
1370 2018-08-02  Zalan Bujtas  <zalan@apple.com>
1371
1372         [LFC] Display:Box::rectWithMargin()'s width and height don't include margin left/top.
1373         https://bugs.webkit.org/show_bug.cgi?id=188272
1374
1375         Reviewed by Antti Koivisto.
1376
1377         * layout/displaytree/DisplayBox.h:
1378         (WebCore::Display::Box::rectWithMargin const):
1379
1380 2018-08-02  Zalan Bujtas  <zalan@apple.com>
1381
1382         [LFC][Floating] Containing block of a float could push the candidate position beyond the current float.
1383         https://bugs.webkit.org/show_bug.cgi?id=188264
1384
1385         Reviewed by Antti Koivisto.
1386
1387         <div id=first style="float: left; width: 100px; height: 10px;"></div>
1388         <div id=second style="float: left; width: 10px; height: 10px;"></div>
1389         <div style="width: 50px; height: 50px;>
1390             <div id=third style="float: left; width: 10px; height: 10px;"></div>
1391         </div>
1392         In the example above by the time the "third" float comes in, we are already at 110px horizontally. However the containing block of the "third" float forces
1393         the candidate position at 0px. In such cases intersecting won't work since the candidate position is beyond the last(second) float (horizontally).
1394         We could either keep going back to the previous floats on this vertical position and eventually intersect with "first" or just compare the horizontal
1395         positions and ensure that the left/right float is not going to be placed to the left/right of the last float on the current vertical position.
1396
1397         * layout/FloatingContext.cpp:
1398         (WebCore::Layout::FloatingPair::intersects const):
1399
1400 2018-08-01  Ryosuke Niwa  <rniwa@webkit.org>
1401
1402         Implement customElements.upgrade()
1403         https://bugs.webkit.org/show_bug.cgi?id=183397
1404
1405         Reviewed by Frédéric Wang.
1406
1407         Added the support to upgrade custom elements directly. Ordinarily, custom elements get upgraded as they are
1408         inserted / connected into a document but some script libraries and authors want to be able to upgrade them before that.
1409         Also see https://github.com/w3c/webcomponents/issues/710
1410
1411         Implemented the method as specified at:
1412         https://html.spec.whatwg.org/multipage/custom-elements.html#dom-customelementregistry-upgrade
1413
1414             When invoked, the upgrade(root) method must run these steps:
1415             1. Let candidates be a list of all of root's shadow-including inclusive descendant elements,
1416                in shadow-including tree order.
1417             2. For each candidate of candidates, try to upgrade candidate.
1418
1419         Tests: imported/w3c/web-platform-tests/custom-elements/custom-element-registry/upgrade.html
1420
1421         * dom/CustomElementReactionQueue.cpp:
1422         (WebCore::CustomElementReactionQueue::enqueueElementUpgradeIfDefined): Removed the assertion that the upgraded element
1423         is connected since the whole point of this API is to upgrade a disconnected element.
1424         * dom/CustomElementRegistry.cpp:
1425         (WebCore::upgradeElementsInShadowIncludingdescendants): Added.
1426         (WebCore::CustomElementRegistry::upgrade): Added.
1427         * dom/CustomElementRegistry.h: Forward declare DeferredPromise instead of unnecessarily including JSDOMPromiseDeferred.h.
1428         * dom/CustomElementRegistry.idl:
1429         * dom/Element.cpp:
1430         (WebCore::Element::insertedIntoAncestor): Moved the assertion here.
1431
1432 2018-08-02  Simon Fraser  <simon.fraser@apple.com>
1433
1434         Convert calc-related enums to 8-bit enum classes
1435         https://bugs.webkit.org/show_bug.cgi?id=188215
1436
1437         Reviewed by Zalan Bujtas.
1438
1439         This shrinks CSSCalcOperation from 48 to 32 bytes.
1440
1441         * css/CSSCalculationValue.cpp:
1442         (WebCore::unitCategory):
1443         (WebCore::determineCategory):
1444         (WebCore::resolvedTypeForMinOrMax):
1445         (WebCore::isIntegerResult):
1446         (WebCore::CSSCalcExpressionNodeParser::parseValue):
1447         (WebCore::CSSCalcExpressionNodeParser::parseValueMultiplicativeExpression):
1448         (WebCore::CSSCalcExpressionNodeParser::parseAdditiveValueExpression):
1449         (WebCore::CSSCalcExpressionNodeParser::parseMinMaxExpression):
1450         (WebCore::createBlendHalf):
1451         (WebCore::createCSS):
1452         * css/CSSCalculationValue.h:
1453         * css/CSSPrimitiveValue.cpp:
1454         (WebCore::CSSPrimitiveValue::primitiveType const):
1455         * css/StyleBuilderConverter.h:
1456         (WebCore::StyleBuilderConverter::convertTo100PercentMinusLength):
1457         * css/parser/CSSPropertyParserHelpers.cpp:
1458         (WebCore::CSSPropertyParserHelpers::CalcParser::consumeNumberRaw):
1459         (WebCore::CSSPropertyParserHelpers::CalcParser::consumePositiveIntegerRaw):
1460         (WebCore::CSSPropertyParserHelpers::consumeInteger):
1461         (WebCore::CSSPropertyParserHelpers::consumePositiveIntegerRaw):
1462         (WebCore::CSSPropertyParserHelpers::consumeNumberRaw):
1463         (WebCore::CSSPropertyParserHelpers::consumeNumber):
1464         (WebCore::CSSPropertyParserHelpers::consumeFontWeightNumber):
1465         (WebCore::CSSPropertyParserHelpers::consumeLength):
1466         (WebCore::CSSPropertyParserHelpers::consumePercent):
1467         (WebCore::CSSPropertyParserHelpers::canConsumeCalcValue):
1468         (WebCore::CSSPropertyParserHelpers::consumeLengthOrPercent):
1469         (WebCore::CSSPropertyParserHelpers::consumeAngle):
1470         (WebCore::CSSPropertyParserHelpers::consumeAngleOrPercent):
1471         (WebCore::CSSPropertyParserHelpers::consumeTime):
1472         * platform/CalculationValue.cpp:
1473         (WebCore::CalcExpressionNumber::operator== const):
1474         (WebCore::CalcExpressionOperation::evaluate const):
1475         (WebCore::CalcExpressionOperation::operator== const):
1476         (WebCore::CalcExpressionOperation::dump const):
1477         (WebCore::CalcExpressionLength::operator== const):
1478         (WebCore::CalcExpressionBlendLength::CalcExpressionBlendLength):
1479         (WebCore::CalcExpressionBlendLength::operator== const):
1480         (WebCore::operator<<):
1481         * platform/CalculationValue.h:
1482         (WebCore::CalcExpressionNumber::CalcExpressionNumber):
1483         (WebCore::toCalcExpressionNumber):
1484         (WebCore::CalcExpressionLength::CalcExpressionLength):
1485         (WebCore::toCalcExpressionLength):
1486         (WebCore::CalcExpressionOperation::CalcExpressionOperation):
1487         (WebCore::toCalcExpressionOperation):
1488         (WebCore::toCalcExpressionBlendLength):
1489         * platform/Length.cpp:
1490         (WebCore::convertTo100PercentMinusLength):
1491
1492 2018-08-02  Charlie Turner  <cturner@igalia.com>
1493
1494         Handle zero-sized ISOMP4 boxes appropriately
1495         https://bugs.webkit.org/show_bug.cgi?id=188256
1496
1497         Reviewed by Jer Noble.
1498
1499         According to ISO/IEC 14496-12:2012(E), when the Box classes' size
1500         field is zero, the implied size of the box extends to the end of
1501         the file. If this detail is not taken into account, CENC
1502         sanitization can incorrectly report an invalid box size, since 0
1503         != the number of bytes in this box, specifically, the data layout
1504         of Box is as follows,
1505
1506         aligned(8) class Box (unsigned int(32) boxtype,
1507               optional unsigned int(8)[16] extended_type) {
1508            unsigned int(32) size;
1509            unsigned int(32) type = boxtype;
1510            if (size==1) {
1511              unsigned int(64) largesize;
1512            } else if (size==0) { // This is the case now handled.
1513              // box extends to end of file
1514            }
1515            if (boxtype==‘uuid’) {
1516              unsigned int(8)[16] usertype = extended_type;
1517            }
1518         }
1519
1520         Tested by imported/w3c/web-platform-tests/encrypted-media/clearkey-generate-request-disallowed-input.https.html
1521
1522         * platform/graphics/iso/ISOBox.cpp:
1523         (WebCore::ISOBox::peekBox): Check if the parsed size is zero, and
1524         if it is, the size is calculated as the total number of bytes in
1525         the incoming DataView.
1526         (WebCore::ISOBox::parse): Ditto.
1527
1528 2018-08-01  Dan Bernstein  <mitz@apple.com>
1529
1530         Optionally expose Attr::style to JavaScript
1531         https://bugs.webkit.org/show_bug.cgi?id=188226
1532         <rdar://problem/42818113>
1533
1534         Reviewed by Darin Adler.
1535
1536         Test: TestWebKitAPI/Tests/WebKitCocoa/AttrStyle.mm
1537
1538         * dom/Attr.cpp: Update comment.
1539         * dom/Attr.idl: Define the style attribute, enabled at runtime by the AttrStyle feature.
1540
1541         * page/RuntimeEnabledFeatures.h:
1542         (WebCore::RuntimeEnabledFeatures::setAttrStyleEnabled): Added this accessor.
1543         (WebCore::RuntimeEnabledFeatures::attrStyleEnabled const): Ditto.
1544
1545 2018-08-02  David Fenton  <david_fenton@apple.com>
1546
1547         Unreviewed, rolling out r234489.
1548
1549         Caused 50+ crashes and 60+ API failures on iOS
1550
1551         Reverted changeset:
1552
1553         "[WTF] Rename String::format to String::deprecatedFormat"
1554         https://bugs.webkit.org/show_bug.cgi?id=188191
1555         https://trac.webkit.org/changeset/234489
1556
1557 2018-08-02  Zalan Bujtas  <zalan@apple.com>
1558
1559         [LFC][Floating] Do not pass formatting root to FloatingContext
1560         https://bugs.webkit.org/show_bug.cgi?id=188257
1561
1562         Reviewed by Antti Koivisto.
1563
1564         If we ever need it, we can get it from FloatingState.
1565
1566         * layout/FloatingContext.cpp:
1567         (WebCore::Layout::FloatingContext::FloatingContext):
1568         * layout/FloatingContext.h:
1569         * layout/blockformatting/BlockFormattingContext.cpp:
1570         (WebCore::Layout::BlockFormattingContext::layout const):
1571
1572 2018-08-01  Zalan Bujtas  <zalan@apple.com>
1573
1574         [LFC][Floating] Convert all coordinates relative to the formatting context root.
1575         https://bugs.webkit.org/show_bug.cgi?id=188249
1576
1577         Reviewed by Antti Koivisto.
1578
1579         The idea here is that all the float related computation should be happening in the same coordinate system.
1580         FloatItem holds the transformed Display::Box for both the layout box and its containing block. 
1581
1582         * layout/FloatingContext.cpp:
1583         (WebCore::Layout::begin):
1584         (WebCore::Layout::end):
1585         (WebCore::Layout::FloatingContext::computePosition const):
1586         (WebCore::Layout::FloatingContext::floatingPosition const):
1587         (WebCore::Layout::FloatingContext::initialVerticalPosition const):
1588         (WebCore::Layout::FloatingContext::alignWithContainingBlock const):
1589         (WebCore::Layout::FloatingContext::alignWithFloatings const):
1590         (WebCore::Layout::FloatingContext::toContainingBlock const):
1591         (WebCore::Layout::FloatingPair::FloatingPair):
1592         (WebCore::Layout::FloatingPair::left const):
1593         (WebCore::Layout::FloatingPair::right const):
1594         (WebCore::Layout::Iterator::Iterator):
1595         (WebCore::Layout::previousFloatingIndex):
1596         (WebCore::Layout::Iterator::operator++):
1597         (WebCore::Layout::Iterator::set):
1598         * layout/FloatingContext.h:
1599         * layout/FloatingState.cpp:
1600         (WebCore::Layout::FloatingState::FloatItem::FloatItem):
1601         (WebCore::Layout::FloatingState::remove):
1602         (WebCore::Layout::FloatingState::append):
1603         * layout/FloatingState.h:
1604         (WebCore::Layout::FloatingState::isEmpty const):
1605         (WebCore::Layout::FloatingState::FloatItem::layoutBox const):
1606         (WebCore::Layout::FloatingState::FloatItem::containingBlock const):
1607         (WebCore::Layout::FloatingState::FloatItem::displayBox const):
1608         (WebCore::Layout::FloatingState::FloatItem::containingBlockDisplayBox const):
1609         (WebCore::Layout::FloatingState::floats const):
1610         (WebCore::Layout::FloatingState::last const):
1611         (WebCore::Layout::FloatingState::root const):
1612         (WebCore::Layout::FloatingState::floatings const): Deleted.
1613         * layout/displaytree/DisplayBox.h:
1614
1615 2018-08-02  Charlie Turner  <cturner@igalia.com>
1616
1617         [GStreamer] Dynamically adjust blocksize
1618         https://bugs.webkit.org/show_bug.cgi?id=188194
1619
1620         Reviewed by Xabier Rodriguez-Calvar.
1621
1622         Update the blocksize depending on how much is obtained from a read
1623         of the input stream. This avoids doing too many reads in small
1624         chunks when larger amounts of data are available and also prevents
1625         using a very large memory area to read a small chunk of data.
1626
1627         Adapted from https://bugzilla.gnome.org/show_bug.cgi?id=767833
1628
1629         No tests new tests since no change in functionality.
1630
1631         * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
1632         (webkit_web_src_init):
1633         (CachedResourceStreamingClient::checkUpdateBlocksize):
1634         (CachedResourceStreamingClient::dataReceived):
1635
1636 2018-08-02  Charlie Turner  <cturner@igalia.com>
1637
1638         [GStreamer] Stop pushing buffers when seeking status changes
1639         https://bugs.webkit.org/show_bug.cgi?id=188193
1640
1641         Reviewed by Xabier Rodriguez-Calvar.
1642
1643         After switching to splitting buffers into smaller block sizes in
1644
1645             https://bugs.webkit.org/show_bug.cgi?id=182829
1646
1647         It was found that during the individual buffer pushes, the seeking
1648         status could change behind our backs from another thread. When
1649         this happens, buffers from incorrect offsets would find their way
1650         into appsrc and eventually the demuxer itself, which would start
1651         parsing from a random place and at best give a confusing error
1652         message.
1653
1654         The solution here is break from pushing buffers when the seeking
1655         status has been has changed. Flushes will clear out what we've
1656         already delivered into the appsrc, then we must make sure to not
1657         continue sending buffers in there after the flush.
1658
1659         No new tests since this is a timing bug.
1660
1661         * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
1662         (CachedResourceStreamingClient::dataReceived):
1663
1664 2018-08-01  Yusuke Suzuki  <utatane.tea@gmail.com>
1665
1666         Unreviewed, revert TransformationMatrix::operator== change
1667         https://bugs.webkit.org/show_bug.cgi?id=188197
1668
1669         This change partially revert cleaning up of TransformationMatrix since memcmp does not
1670         follow double comparison algorithm. So semantics was accidentally changed.
1671
1672         * platform/graphics/transforms/TransformationMatrix.h:
1673         (WebCore::TransformationMatrix::operator== const):
1674
1675 2018-08-01  Yusuke Suzuki  <utatane.tea@gmail.com>
1676
1677         Unreviewed, rename TransformationMatrix::Identity to TransformationMatrix::identity
1678         https://bugs.webkit.org/show_bug.cgi?id=188204
1679
1680         Follow the coding style.
1681
1682         * platform/graphics/GraphicsLayer.cpp:
1683         (WebCore::GraphicsLayer::transform const):
1684         (WebCore::GraphicsLayer::childrenTransform const):
1685         * platform/graphics/transforms/TransformationMatrix.cpp:
1686         * platform/graphics/transforms/TransformationMatrix.h:
1687
1688 2018-08-01  Yusuke Suzuki  <utatane.tea@gmail.com>
1689
1690         Add self.queueMicrotask(f) on DOMWindow
1691         https://bugs.webkit.org/show_bug.cgi?id=188212
1692
1693         Reviewed by Ryosuke Niwa.
1694
1695         This patch adds self.queueMicrotask(f) in DOMWindow, which takes a function and enqueue it into microtask queue.
1696         We do not add this to Worker's global scope since our worker does not support microtasks correctly.
1697
1698         Tests: js/dom/queue-microtask-window.html
1699
1700         * bindings/js/JSDOMWindowCustom.cpp:
1701         (WebCore::JSDOMWindow::queueMicrotask):
1702         Post a microtask to JSC's microtask mechanism. This will eventually go to WebCore's MicrotaskQueue code.
1703
1704         * page/DOMWindow.idl:
1705
1706 2018-08-01  Tomas Popela  <tpopela@redhat.com>
1707
1708         [WTF] Rename String::format to String::deprecatedFormat
1709         https://bugs.webkit.org/show_bug.cgi?id=188191
1710
1711         Reviewed by Darin Adler.
1712
1713         It should be replaced with string concatenation.
1714
1715         * Modules/indexeddb/IDBKeyData.cpp:
1716         (WebCore::IDBKeyData::loggingString const):
1717         * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
1718         (WebCore::IDBServer::SQLiteIDBBackingStore::addRecord):
1719         * Modules/indexeddb/shared/IDBCursorInfo.cpp:
1720         (WebCore::IDBCursorInfo::loggingString const):
1721         * Modules/indexeddb/shared/IDBGetAllRecordsData.cpp:
1722         (WebCore::IDBGetAllRecordsData::loggingString const):
1723         * Modules/indexeddb/shared/IDBGetRecordData.cpp:
1724         (WebCore::IDBGetRecordData::loggingString const):
1725         * Modules/indexeddb/shared/IDBIndexInfo.cpp:
1726         (WebCore::IDBIndexInfo::loggingString const):
1727         (WebCore::IDBIndexInfo::condensedLoggingString const):
1728         * Modules/indexeddb/shared/IDBIterateCursorData.cpp:
1729         (WebCore::IDBIterateCursorData::loggingString const):
1730         * Modules/indexeddb/shared/IDBObjectStoreInfo.cpp:
1731         (WebCore::IDBObjectStoreInfo::condensedLoggingString const):
1732         * Modules/indexeddb/shared/IDBResourceIdentifier.cpp:
1733         (WebCore::IDBResourceIdentifier::loggingString const):
1734         * Modules/webdatabase/Database.cpp:
1735         (WebCore::formatErrorMessage):
1736         * Modules/webdatabase/SQLError.h:
1737         (WebCore::SQLError::create):
1738         * Modules/websockets/WebSocket.cpp:
1739         (WebCore::encodeProtocolString):
1740         * accessibility/win/AccessibilityObjectWrapperWin.cpp:
1741         (WebCore::AccessibilityObjectWrapper::accessibilityAttributeValue):
1742         * css/CSSUnicodeRangeValue.cpp:
1743         (WebCore::CSSUnicodeRangeValue::customCSSText const):
1744         * css/MediaQueryEvaluator.cpp:
1745         (WebCore::aspectRatioValueAsString):
1746         * css/parser/CSSParserToken.cpp:
1747         (WebCore::CSSParserToken::serialize const):
1748         * css/parser/CSSPropertyParserHelpers.cpp:
1749         (WebCore::CSSPropertyParserHelpers::parseHexColor):
1750         * dom/Document.cpp:
1751         (WebCore::Document::lastModified):
1752         * html/FTPDirectoryDocument.cpp:
1753         (WebCore::processFilesizeString):
1754         (WebCore::processFileDateString):
1755         * html/HTMLMediaElement.h:
1756         (WTF::ValueToString<WebCore::TextTrackCue::string):
1757         * html/HTMLSelectElement.cpp:
1758         (WebCore::HTMLSelectElement::setLength):
1759         * html/ImageDocument.cpp:
1760         (WebCore::ImageDocument::imageUpdated):
1761         * html/canvas/WebGLRenderingContextBase.cpp:
1762         * html/parser/XSSAuditor.cpp:
1763         (WebCore::XSSAuditor::init):
1764         * html/track/VTTCue.cpp:
1765         (WebCore::VTTCueBox::applyCSSProperties):
1766         * inspector/InspectorFrontendClientLocal.cpp:
1767         (WebCore::InspectorFrontendClientLocal::setDockingUnavailable):
1768         (WebCore::InspectorFrontendClientLocal::setAttachedWindow):
1769         (WebCore::InspectorFrontendClientLocal::setDebuggingEnabled):
1770         (WebCore::InspectorFrontendClientLocal::setTimelineProfilingEnabled):
1771         (WebCore::InspectorFrontendClientLocal::showMainResourceForFrame):
1772         * inspector/agents/InspectorCSSAgent.cpp:
1773         * inspector/agents/InspectorIndexedDBAgent.cpp:
1774         * page/CaptionUserPreferencesMediaAF.cpp:
1775         (WebCore::CaptionUserPreferencesMediaAF::windowRoundedCornerRadiusCSS const):
1776         * page/History.cpp:
1777         (WebCore::History::stateObjectAdded):
1778         * page/MemoryRelease.cpp:
1779         (WebCore::logMemoryStatisticsAtTimeOfDeath):
1780         * page/cocoa/ResourceUsageOverlayCocoa.mm:
1781         (WebCore::formatByteNumber):
1782         (WebCore::gcTimerString):
1783         (WebCore::ResourceUsageOverlay::platformDraw):
1784         * page/cocoa/ResourceUsageThreadCocoa.mm:
1785         (WebCore::logFootprintComparison):
1786         * page/linux/ResourceUsageOverlayLinux.cpp:
1787         (WebCore::cpuUsageString):
1788         (WebCore::formatByteNumber):
1789         (WebCore::gcTimerString):
1790         * page/scrolling/AxisScrollSnapOffsets.cpp:
1791         (WebCore::snapOffsetsToString):
1792         (WebCore::snapOffsetRangesToString):
1793         (WebCore::snapPortOrAreaToString):
1794         * platform/DateComponents.cpp:
1795         (WebCore::DateComponents::toStringForTime const):
1796         (WebCore::DateComponents::toString const):
1797         * platform/LocalizedStrings.cpp:
1798         * platform/animation/TimingFunction.cpp:
1799         (WebCore::TimingFunction::cssText const):
1800         * platform/audio/HRTFElevation.cpp:
1801         (WebCore::HRTFElevation::calculateKernelsForAzimuthElevation):
1802         * platform/cocoa/KeyEventCocoa.mm:
1803         (WebCore::keyIdentifierForCharCode):
1804         * platform/gamepad/mac/HIDGamepad.cpp:
1805         (WebCore::HIDGamepad::HIDGamepad):
1806         * platform/glib/UserAgentGLib.cpp:
1807         (WebCore::platformVersionForUAString):
1808         * platform/graphics/Color.cpp:
1809         (WebCore::Color::nameForRenderTreeAsText const):
1810         * platform/graphics/FloatPolygon.h:
1811         (WTF::ValueToString<WebCore::FloatPolygonEdge::string):
1812         * platform/graphics/avfoundation/AVTrackPrivateAVFObjCImpl.mm:
1813         (WebCore::AVTrackPrivateAVFObjCImpl::id const):
1814         * platform/graphics/avfoundation/MediaSampleAVFObjC.h:
1815         (WebCore::MediaSampleAVFObjC::MediaSampleAVFObjC):
1816         * platform/graphics/ca/GraphicsLayerCA.cpp:
1817         (WebCore::GraphicsLayerCA::setName):
1818         (WebCore::GraphicsLayerCA::setContentsToSolidColor):
1819         (WebCore::GraphicsLayerCA::recursiveCommitChanges):
1820         (WebCore::GraphicsLayerCA::updateContentsImage):
1821         (WebCore::GraphicsLayerCA::updateContentsRects):
1822         (WebCore::GraphicsLayerCA::createTransformAnimationsFromKeyframes):
1823         * platform/graphics/gstreamer/GStreamerCommon.cpp:
1824         (WebCore::simpleBusMessageCallback):
1825         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
1826         (WebCore::MediaPlayerPrivateGStreamer::load):
1827         (WebCore::MediaPlayerPrivateGStreamer::handleMessage):
1828         (WebCore::MediaPlayerPrivateGStreamer::createGSTPlayBin):
1829         * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
1830         (WebCore::AppendPipeline::handleStateChangeMessage):
1831         (WebCore::AppendPipeline::resetPipeline):
1832         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
1833         (WebCore::MediaPlayerPrivateGStreamerMSE::load):
1834         (WebCore::MediaPlayerPrivateGStreamerMSE::doSeek):
1835         * platform/graphics/gtk/ImageBufferGtk.cpp:
1836         (WebCore::encodeImage):
1837         * platform/gtk/PlatformKeyboardEventGtk.cpp:
1838         (WebCore::PlatformKeyboardEvent::keyIdentifierForGdkKeyCode):
1839         * platform/mediastream/gstreamer/GStreamerAudioCaptureSource.cpp:
1840         (WebCore::GStreamerAudioCaptureSource::create):
1841         * platform/mediastream/gstreamer/GStreamerMediaStreamSource.cpp:
1842         (WebCore::webkitMediaStreamSrcAddPad):
1843         * platform/mediastream/gstreamer/GStreamerVideoCaptureSource.cpp:
1844         (WebCore::GStreamerVideoCaptureSource::create):
1845         * platform/mediastream/libwebrtc/GStreamerVideoEncoderFactory.cpp:
1846         (WebCore::GStreamerVideoEncoder::makeElement):
1847         * platform/mock/MockRealtimeVideoSource.cpp:
1848         (WebCore::MockRealtimeVideoSource::drawText):
1849         * platform/mock/mediasource/MockSourceBufferPrivate.cpp:
1850         * platform/network/ParsedContentRange.cpp:
1851         (WebCore::ParsedContentRange::headerValue const):
1852         * platform/network/cf/NetworkStorageSessionCFNet.cpp:
1853         (WebCore::NetworkStorageSession::switchToNewTestingSession):
1854         * platform/sql/SQLiteDatabase.cpp:
1855         (WebCore::unauthorizedSQLFunction):
1856         * platform/text/PlatformLocale.cpp:
1857         (WebCore::DateTimeStringBuilder::visitField):
1858         * platform/win/GDIObjectCounter.cpp:
1859         (WebCore::GDIObjectCounter::GDIObjectCounter):
1860         * platform/win/KeyEventWin.cpp:
1861         (WebCore::keyIdentifierForWindowsKeyCode):
1862         * rendering/FloatingObjects.h:
1863         (WTF::ValueToString<WebCore::FloatingObject::string):
1864         * rendering/RenderFragmentedFlow.h:
1865         (WTF::ValueToString<WebCore::RenderFragmentContainer::string):
1866         * rendering/RenderLayerCompositor.cpp:
1867         (WebCore::RenderLayerCompositor::logLayerInfo):
1868         * rendering/RenderTheme.cpp:
1869         (WebCore::RenderTheme::formatMediaControlsTime const):
1870         * testing/Internals.cpp:
1871         (WebCore::Internals::address):
1872         * workers/service/server/RegistrationDatabase.cpp:
1873         (WebCore::RegistrationDatabase::ensureValidRecordsTable):
1874         (WebCore::RegistrationDatabase::importRecords):
1875
1876 2018-08-01  Alex Christensen  <achristensen@webkit.org>
1877
1878         Move all calls to ResourceLoader::start to WebKitLegacy
1879         https://bugs.webkit.org/show_bug.cgi?id=184946
1880
1881         Reviewed by Andy Estes.
1882
1883         This is in preparation for moving ResourceLoader::start to WebKitLegacy along with all ResourceHandle code.
1884         I move the code that moves m_deferredRequest into m_request into WebKitLegacy, which won't change behavior for
1885         modern WebKit because modern WebKit never calls ResourceLoader::start, the only place where m_deferredRequest
1886         is ever set.  This won't change behavior for WebKitLegacy because the same operations happen in the same order.
1887
1888         * loader/LoaderStrategy.h:
1889         * loader/ResourceLoader.cpp:
1890         (WebCore::ResourceLoader::setDefersLoading):
1891         * loader/ResourceLoader.h:
1892         (WebCore::ResourceLoader::setRequest):
1893         (WebCore::ResourceLoader::deferredRequest const):
1894         (WebCore::ResourceLoader::takeDeferredRequest):
1895
1896 2018-08-01  Nan Wang  <n_wang@apple.com>
1897
1898         AX: AOM: Add ARIA IDL Attribute Reflection
1899         https://bugs.webkit.org/show_bug.cgi?id=184676
1900         <rdar://problem/39476882>
1901
1902         Reviewed by Chris Fleizach.
1903
1904         Test: accessibility/ARIA-reflection.html
1905
1906         * CMakeLists.txt:
1907         * DerivedSources.make:
1908         * WebCore.xcodeproj/project.pbxproj:
1909         * accessibility/AccessibilityRole.idl: Added.
1910         * accessibility/AriaAttributes.idl: Added.
1911         * dom/Element.idl:
1912         * page/RuntimeEnabledFeatures.h:
1913         (WebCore::RuntimeEnabledFeatures::setAriaReflectionEnabled):
1914         (WebCore::RuntimeEnabledFeatures::ariaReflectionEnabled const):
1915
1916 2018-08-01  Zalan Bujtas  <zalan@apple.com>
1917
1918         [LFC][Floating] Revert back to only one list for the all the floatings.
1919         https://bugs.webkit.org/show_bug.cgi?id=188232
1920
1921         Reviewed by Antti Koivisto.
1922
1923         If the combined floating list turns out to be a performance bottleneck, we can still split it into left and right. However at this point
1924         having 2 dedicated lists just makes the implementation more complicated.
1925
1926         * layout/FloatingContext.cpp:
1927         (WebCore::Layout::begin):
1928         (WebCore::Layout::end):
1929         (WebCore::Layout::FloatingPair::FloatingPair):
1930         (WebCore::Layout::FloatingPair::left const):
1931         (WebCore::Layout::FloatingPair::right const):
1932         (WebCore::Layout::Iterator::Iterator):
1933         (WebCore::Layout::previousFloatingIndex):
1934         (WebCore::Layout::Iterator::operator++):
1935         (WebCore::Layout::Iterator::set):
1936         (WebCore::Layout::floatingDisplayBox): Deleted.
1937         * layout/FloatingState.cpp:
1938         (WebCore::Layout::FloatingState::remove):
1939         (WebCore::Layout::FloatingState::append):
1940         * layout/FloatingState.h:
1941         (WebCore::Layout::FloatingState::isEmpty const):
1942         (WebCore::Layout::FloatingState::floatings const):
1943         (WebCore::Layout::FloatingState::last const):
1944
1945 2018-08-01  Basuke Suzuki  <Basuke.Suzuki@sony.com>
1946
1947         [Curl] Change synchronous request logic using MessageQueue to match with Mac port.
1948         https://bugs.webkit.org/show_bug.cgi?id=188206
1949
1950         Reviewed by Alex Christensen.
1951
1952         Port synchronous request logic from ResourceHandleMac to use MessageQueue for
1953         client callback invocation. This makes simplify the logic of CurlRequest because
1954         now every requests are handled in Curl thread and there's no difference between
1955         sync and async requests.
1956
1957         Test: Covered by these tests:
1958         - http\tests\xmlhttprequest\simple-sync.html
1959         - http\tests\xmlhttprequest\xmlhttprequest-unsafe-redirect.html
1960
1961         * platform/network/ResourceHandleInternal.h:
1962         * platform/network/curl/CurlRequest.cpp: Remove synchronous request logics.
1963         (WebCore::CurlRequest::CurlRequest):
1964         (WebCore::CurlRequest::invalidateClient):
1965         (WebCore::CurlRequest::start):
1966         (WebCore::CurlRequest::cancel):
1967         (WebCore::CurlRequest::runOnMainThread): Added message queue handling.
1968         (WebCore::CurlRequest::runOnWorkerThreadIfRequired):
1969         (WebCore::CurlRequest::didReceiveData):
1970         (WebCore::CurlRequest::invokeDidReceiveResponseForFile):
1971         (WebCore::CurlRequest::completeDidReceiveResponse):
1972         (WebCore::CurlRequest::updateHandlePauseState):
1973         (WebCore::CurlRequest::isHandlePaused const):
1974         * platform/network/curl/CurlRequest.h:
1975         (WebCore::CurlRequest::create):
1976         (WebCore::CurlRequest::resourceRequest const):
1977         * platform/network/curl/ResourceHandleCurl.cpp:
1978         (WebCore::ResourceHandle::createCurlRequest):
1979         (WebCore::ResourceHandle::restartRequestWithCredential):
1980         (WebCore::ResourceHandle::platformLoadResourceSynchronously):
1981         (WebCore::ResourceHandle::platformContinueSynchronousDidReceiveResponse):
1982         (WebCore::ResourceHandle::continueAfterDidReceiveResponse):
1983         (WebCore::ResourceHandle::continueAfterWillSendRequest):
1984         (WebCore::ResourceHandle::handleDataURL):
1985
1986 2018-08-01  Zalan Bujtas  <zalan@apple.com>
1987
1988         [LFC][Floating] Use margin box consistently while placing a floating.
1989         https://bugs.webkit.org/show_bug.cgi?id=188222
1990
1991         Reviewed by Antti Koivisto.
1992
1993         The floating box fits when its margin box fits.
1994
1995         * layout/FloatingContext.cpp:
1996         (WebCore::Layout::FloatingContext::computePosition const):
1997         (WebCore::Layout::FloatingContext::floatingPosition const):
1998         (WebCore::Layout::FloatingContext::initialVerticalPosition const):
1999         (WebCore::Layout::FloatingContext::alignWithContainingBlock const):
2000         (WebCore::Layout::FloatingContext::alignWithFloatings const):
2001         (WebCore::Layout::FloatingPair::intersects const):
2002         * layout/displaytree/DisplayBox.h:
2003         (WebCore::Display::Box::rectWithMargin const):
2004
2005 2018-08-01  Zalan Bujtas  <zalan@apple.com>
2006
2007         [LFC] Add FormattingContext::mapToAncestor geometry mapping function
2008         https://bugs.webkit.org/show_bug.cgi?id=188188
2009
2010         Reviewed by Antti Koivisto.
2011
2012         * layout/FormattingContext.cpp:
2013         (WebCore::Layout::FormattingContext::mapToAncestor):
2014         * layout/FormattingContext.h:
2015         * layout/displaytree/DisplayBox.cpp:
2016         (WebCore::Display::Box::clone const):
2017         * layout/displaytree/DisplayBox.h:
2018
2019 2018-08-01  Basuke Suzuki  <Basuke.Suzuki@sony.com>
2020
2021         [Curl] Bugfix on ResourceHandle::cancel()
2022         https://bugs.webkit.org/show_bug.cgi?id=188234
2023
2024         Reviewed by Darin Adler.
2025         Trivial bug. The actual request was not cancelled correctly.
2026
2027         * platform/network/curl/ResourceHandleCurl.cpp:
2028         (WebCore::ResourceHandle::cancel):
2029
2030 2018-08-01  Zalan Bujtas  <zalan@apple.com>
2031
2032         [LFC][Floating] FloatingState should take the formatting root box.
2033         https://bugs.webkit.org/show_bug.cgi?id=188214
2034
2035         Reviewed by Antti Koivisto.
2036
2037         This will be taken into use when FormattingContext takes all boxes in the coordinate system of the formatting root.
2038
2039         * layout/FloatingState.cpp:
2040         (WebCore::Layout::FloatingState::FloatingState):
2041         (WebCore::Layout::belongsToThisFloatingContext):
2042         (WebCore::Layout::FloatingState::append):
2043         * layout/FloatingState.h:
2044         (WebCore::Layout::FloatingState::create):
2045         * layout/LayoutContext.cpp:
2046         (WebCore::Layout::LayoutContext::establishedFormattingState):
2047
2048 2018-08-01  Zalan Bujtas  <zalan@apple.com>
2049
2050         [LFC][Floating] Align new floating with the bottom of the existing floatings.
2051         https://bugs.webkit.org/show_bug.cgi?id=188213
2052
2053         Reviewed by Antti Koivisto.
2054
2055         When the incoming floating does not fit at all, align its top with the bottom of the existing floatings.
2056
2057         * layout/FloatingContext.cpp:
2058         (WebCore::Layout::FloatingContext::floatingPosition const):
2059         (WebCore::Layout::FloatingPair::bottom const):
2060
2061 2018-08-01  Eric Carlson  <eric.carlson@apple.com>
2062
2063         Always use MediaPlayback audio category when playing to AppleTV
2064         https://bugs.webkit.org/show_bug.cgi?id=188230
2065         <rdar://problem/42497809>
2066
2067         Reviewed by Jer Noble.
2068
2069         * platform/audio/cocoa/MediaSessionManagerCocoa.cpp:
2070         (PlatformMediaSessionManager::updateSessionState): Check session.isPlayingToWirelessPlaybackTarget().
2071
2072 2018-08-01  Timothy Hatcher  <timothy@apple.com>
2073
2074         Hardcode some system colors to avoid fingerprinting exposure.
2075         https://bugs.webkit.org/show_bug.cgi?id=188203
2076         rdar://problem/42781630
2077
2078         Reviewed by Tim Horton.
2079
2080         Passes existing tests with the hardcoded blue system appearance.
2081
2082         * rendering/RenderTheme.h:
2083         * rendering/RenderThemeMac.mm:
2084         (WebCore::RenderThemeMac::systemColor const):
2085         Adds special handling for some system colors. Fixes -apple-system-selected-text-background
2086         to match the real selection color by using blendWithWhite().
2087
2088 2018-08-01  Eric Carlson  <eric.carlson@apple.com>
2089
2090         [iOS] Remove the delay before setting audio session category added in r233535
2091         https://bugs.webkit.org/show_bug.cgi?id=188225
2092
2093         Reviewed by Jer Noble.
2094
2095         * platform/audio/PlatformMediaSessionManager.cpp:
2096         (WebCore::PlatformMediaSessionManager::beginInterruption): scheduleUpdateSessionState -> updateSessionState.
2097         (WebCore::PlatformMediaSessionManager::addSession): Ditto.
2098         (WebCore::PlatformMediaSessionManager::removeSession): Ditto.
2099         (WebCore::PlatformMediaSessionManager::sessionStateChanged): Ditto.
2100         (WebCore::PlatformMediaSessionManager::sessionCanProduceAudioChanged): Ditto.
2101         (WebCore::PlatformMediaSessionManager::updateSessionState): Ditto.
2102         (WebCore::PlatformMediaSessionManager::audioOutputDeviceChanged): Ditto.
2103         (WebCore::PlatformMediaSessionManager::scheduleUpdateSessionState): Deleted.
2104         * platform/audio/PlatformMediaSessionManager.h:
2105
2106         * platform/audio/cocoa/MediaSessionManagerCocoa.cpp:
2107         (PlatformMediaSessionManager::updateSessionState):
2108         (PlatformMediaSessionManager::scheduleUpdateSessionState): Deleted.
2109         * rendering/RenderLayer.cpp:
2110         (WebCore::RenderLayer::updateClipRects):
2111
2112 2018-08-01  Yusuke Suzuki  <utatane.tea@gmail.com>
2113
2114         Add TransformationMatrix::Identity
2115         https://bugs.webkit.org/show_bug.cgi?id=188204
2116
2117         Reviewed by Simon Fraser.
2118
2119         This patch adds TransformationMatrix::Identity, which is a static const variable holding an identity matrix.
2120
2121         No behavior change.
2122
2123         * platform/graphics/GraphicsLayer.cpp:
2124         (WebCore::GraphicsLayer::transform const):
2125         (WebCore::GraphicsLayer::childrenTransform const):
2126         (): Deleted.
2127         * platform/graphics/transforms/TransformationMatrix.cpp:
2128         * platform/graphics/transforms/TransformationMatrix.h:
2129
2130 2018-08-01  Thibault Saunier  <tsaunier@igalia.com>
2131
2132         [GStreamer] Make sure that first buffer running time is 0 in GStreamerMediaStreamSource
2133         https://bugs.webkit.org/show_bug.cgi?id=188210
2134
2135         This is a live source and the first frame is the beginning of the stream,
2136         but that doesn't mean that the incoming stream from the camera didn't start
2137         before. We need to set a pad offset on each srcpad of the source to compensate
2138         for that. This is the exact same logic as in webrtc GStreamerVideo/Enc/Dec/oder.
2139
2140         Reviewed by Alejandro G. Castro.
2141
2142         * platform/mediastream/gstreamer/GStreamerMediaStreamSource.cpp:
2143         (WebCore::webkit_media_stream_src_init):
2144         (WebCore::webkitMediaStreamSrcPushVideoSample):
2145         (WebCore::webkitMediaStreamSrcPushAudioSample):
2146
2147 2018-08-01  Zan Dobersek  <zdobersek@igalia.com>
2148
2149         [CoordGraphics] Move CoordinatedBackingStore to WebCore
2150         https://bugs.webkit.org/show_bug.cgi?id=188158
2151
2152         Reviewed by Carlos Garcia Campos.
2153
2154         Move the CoordinatedBackingStore class from WebKit to WebCore. It has no
2155         dependency on anything in the WebKit layer, and it's more suitable to
2156         future needs to keep it in the WebCore layer.
2157
2158         * platform/TextureMapper.cmake:
2159         * platform/graphics/texmap/coordinated/CoordinatedBackingStore.cpp: Renamed from Source/WebKit/Shared/CoordinatedGraphics/CoordinatedBackingStore.cpp.
2160         * platform/graphics/texmap/coordinated/CoordinatedBackingStore.h: Renamed from Source/WebKit/Shared/CoordinatedGraphics/CoordinatedBackingStore.h.
2161         (WebCore::CoordinatedBackingStoreTile::CoordinatedBackingStoreTile):
2162         (WebCore::CoordinatedBackingStore::rect const):
2163
2164 2018-07-31  Myles C. Maxfield  <mmaxfield@apple.com>
2165
2166         [WIN] Fix tests for text with initial advances
2167         https://bugs.webkit.org/show_bug.cgi?id=188099
2168
2169         Reviewed by Darin Adler.
2170
2171         Fixup after r234318.
2172
2173         Tests: fast/text/complex-first-glyph-with-initial-advance.html
2174                fast/text/initial-advance-in-intermediate-run-complex.html
2175
2176         * platform/graphics/ComplexTextController.cpp:
2177         * platform/graphics/FontCascade.cpp:
2178         (WebCore::FontCascade::drawGlyphBuffer const):
2179
2180 2018-07-31  Alex Christensen  <achristensen@webkit.org>
2181
2182         REGRESSION (r231107): MoviStar+ launches to a blank black screen
2183         https://bugs.webkit.org/show_bug.cgi?id=188139
2184
2185         Reviewed by Brent Fulgham.
2186
2187         For this app, revert behavior to how it was before r231107 with a linked-on-or-before check.
2188         r231107 increased our fetch spec conformance, which we intend to keep.  This makes a low-risk
2189         targeted fix that will fix the affected app until they update.  
2190
2191         I manually verified this fixes the app.
2192
2193         * loader/DocumentThreadableLoader.cpp:
2194         (WebCore::DocumentThreadableLoader::makeCrossOriginAccessRequest):
2195         * platform/RuntimeApplicationChecks.h:
2196         * platform/cocoa/RuntimeApplicationChecksCocoa.mm:
2197         (WebCore::applicationSDKVersionOverride):
2198         (WebCore::setApplicationSDKVersion):
2199         (WebCore::applicationSDKVersion):
2200         (WebCore::IOSApplication::isMoviStarPlus):
2201
2202 2018-07-31  Myles C. Maxfield  <mmaxfield@apple.com>
2203
2204         [Cocoa] Addressing post-review comments on r234158
2205         https://bugs.webkit.org/show_bug.cgi?id=188202
2206
2207         Reviewed by Darin Adler.
2208
2209         * platform/graphics/cocoa/FontCacheCoreText.cpp:
2210         (WebCore::FontCache::lastResortFallbackFont):
2211
2212 2018-07-31  John Wilander  <wilander@apple.com>
2213
2214         Resource Load Statistics: Remove partitioned cookies for reduced complexity, lower memory footprint, and ability to support more platforms
2215         https://bugs.webkit.org/show_bug.cgi?id=188109
2216         <rdar://problem/42664391>
2217
2218         Reviewed by Brent Fulgham, Chris Dumez, and Alex Christensen.
2219
2220         Tests: http/tests/resourceLoadStatistics/cookie-deletion.html
2221                http/tests/resourceLoadStatistics/cookies-with-and-without-user-interaction.html
2222                http/tests/storageAccess/has-storage-access-from-prevalent-domain-with-user-interaction.html
2223                http/tests/storageAccess/request-and-grant-access-cross-origin-non-sandboxed-iframe-pop-window.html
2224                http/tests/storageAccess/request-and-grant-access-cross-origin-non-sandboxed-iframe.html
2225                http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-user-interaction-and-access-from-right-frame.html
2226                http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-user-interaction-but-access-from-wrong-frame.html
2227                http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-user-interaction.html
2228                http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe-from-prevalent-domain-without-user-interaction.html
2229                http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-iframe.html
2230                http/tests/storageAccess/request-and-grant-access-cross-origin-sandboxed-nested-iframe.html
2231
2232         This patch removes cookie partitioning which reduces the model to just
2233         blocked cookies (in third-party contexts) and first-party cookie access.
2234
2235         Several of the changes are renaming to reflect that there are no more
2236         cookie partitions. However, the compile-time check remains for now since
2237         this change is not ready to ship.
2238
2239         The test cases mentioned about are not new. They are just renamed to
2240         reflect the code changes and to shorten their names (as requested by
2241         non-Cocoa platforms).
2242
2243         * loader/ResourceLoadStatistics.cpp:
2244         (WebCore::ResourceLoadStatistics::toString const):
2245         (WebCore::ResourceLoadStatistics::merge):
2246             Removed the use of isMarkedForCookiePartitioning.
2247         * loader/ResourceLoadStatistics.h:
2248             Removed isMarkedForCookiePartitioning.
2249         * platform/network/NetworkStorageSession.h:
2250         * platform/network/ResourceHandle.h:
2251             Renamed applySniffingPoliciesAndStoragePartitionIfNeeded() to
2252             applySniffingPoliciesIfNeeded().
2253         * platform/network/cf/NetworkStorageSessionCFNet.cpp:
2254         (WebCore::getPartitioningDomain):
2255         (WebCore::NetworkStorageSession::shouldBlockCookies const):
2256             Now takes a frame ID and a page ID to be able to support
2257             the Storage Access API. This was previously handled by
2258             shouldPartitionCookies() which is now deleted.
2259         (WebCore::NetworkStorageSession::setPrevalentDomainsToBlockCookiesFor):
2260             Renamed from setPrevalentDomainsToPartitionOrBlockCookies().
2261         (WebCore::NetworkStorageSession::removePrevalentDomains):
2262             No longer needs to clear the member variable for partitioned cookie domains.
2263         (WebCore::NetworkStorageSession::setCookieStoragePartitioningEnabled): Deleted.
2264         (WebCore::NetworkStorageSession::cookieStoragePartition const): Deleted.
2265         (WebCore::NetworkStorageSession::shouldPartitionCookies const): Deleted.
2266         (WebCore::NetworkStorageSession::setPrevalentDomainsToPartitionOrBlockCookies): Deleted.
2267             Renamed to setPrevalentDomainsToBlockCookiesFor().
2268         * platform/network/mac/CookieJarMac.mm:
2269         (WebCore::cookiesForURL):
2270             Now calls session.shouldBlockCookies() instead of the
2271             wrapper cookiesAreBlockedForURL().
2272         (WebCore::setCookiesFromDOM):
2273             No longer checks for partition.
2274         (WebCore::applyPartitionToCookies): Deleted.
2275         (WebCore::cookiesAreBlockedForURL): Deleted.
2276             This was just a wrapper for session.shouldBlockCookies().
2277         (WebCore::cookiesInPartitionForURL): Deleted.
2278         * platform/network/mac/ResourceHandleMac.mm:
2279         (WebCore::ResourceHandle::applySniffingPoliciesIfNeeded):
2280             Renamed from applySniffingPoliciesAndStoragePartitionIfNeeded().
2281         (WebCore::ResourceHandle::createNSURLConnection):
2282             Consequence of function name change.
2283         (WebCore::ResourceHandle::applySniffingPoliciesAndStoragePartitionIfNeeded): Deleted.
2284             Renamed to applySniffingPoliciesIfNeeded().
2285
2286 2018-07-31  Wenson Hsieh  <wenson_hsieh@apple.com>
2287
2288         [iOS] Spelling suggestions cannot be selected in focused form controls when zoomed in
2289         https://bugs.webkit.org/show_bug.cgi?id=188107
2290         <rdar://problem/42354250>
2291
2292         Reviewed by Tim Horton.
2293
2294         After r232040, the synthetic click gesture recognizer was enabled when tapping inside of the focused element,
2295         which allows the page to handle click events inside editable content. However, this means that codepaths in
2296         EventHandler that are responsible for changing selection due to default click event behaviors on macOS are now
2297         active on iOS; this conflicts with selection changes due to text interaction gestures, which are the existing
2298         mechanism for modifying the selection on iOS.
2299
2300         To address this, we defer selection changes when clicking to text interaction gestures on iOS by tweaking the
2301         default behavior of a click on iOS to /not/ change selection when moving within the same editable root. This is
2302         similar to r233311, but in a different codepath that specifically handles selection changes when clicking on
2303         content that is already selected.
2304
2305         Test: fast/forms/ios/click-should-not-suppress-misspelling.html
2306
2307         * page/EventHandler.cpp:
2308         (WebCore::EventHandler::handleMouseReleaseEvent):
2309
2310 2018-07-31  Yusuke Suzuki  <utatane.tea@gmail.com>
2311
2312         Clean up TransformationMatrix implementation
2313         https://bugs.webkit.org/show_bug.cgi?id=188197
2314
2315         Reviewed by Simon Fraser.
2316
2317         We perform cleaning up of TransformationMatrix.
2318
2319         1. We drop user-defined operator= and copy constructor. Default ones works well for TransformationMatrix.
2320         2. Remove unused setMatrix. We explicitly use memcpy in TransformationMatrix.cpp (only one place).
2321         3. Use memcmp for implementing operator==.
2322
2323         In (2) and (3), we use `memcpy(&matrix[0][0], &tmp[0][0], sizeof(Matrix4))` instead of `memcpy(matrix, tmp, sizeof(Matrix4))`,
2324         since they both are non nullptr and the former is easier to understand.
2325
2326         * platform/graphics/transforms/TransformationMatrix.cpp:
2327         (WebCore::TransformationMatrix::multiply):
2328         * platform/graphics/transforms/TransformationMatrix.h:
2329         (WebCore::TransformationMatrix::setMatrix):
2330         (WebCore::TransformationMatrix::operator== const):
2331         (WebCore::TransformationMatrix::operator =): Deleted.
2332
2333 2018-07-31  Timothy Hatcher  <timothy@apple.com>
2334
2335         Don't call RenderTheme::platformColorsDidChange() during printing.
2336         https://bugs.webkit.org/show_bug.cgi?id=188181
2337         rdar://problem/42360070
2338
2339         Reviewed by Tim Horton.
2340
2341         * inspector/agents/InspectorPageAgent.cpp:
2342         (WebCore::InspectorPageAgent::setEmulatedMedia): Call m_page.updateStyleAfterChangeInEnvironment()
2343         instead of going to styleStope() and remove call to RenderTheme::platformColorsDidChange().
2344         * page/FrameView.cpp:
2345         (WebCore::FrameView::adjustMediaTypeForPrinting): Remove call RenderTheme::platformColorsDidChange().
2346
2347 2018-07-31  Yusuke Suzuki  <utatane.tea@gmail.com>
2348
2349         Use static const global variable for TransformationMatrix instead of NeverDestroyed
2350         https://bugs.webkit.org/show_bug.cgi?id=188195
2351
2352         Reviewed by Darin Adler.
2353
2354         Since TransformationMatrix does not have a non-trivial destructor, we can put it
2355         as static const global variable if its constructor is constexpr. This patch makes
2356         some of constructors constexpr and makes identityTransform static const global variable
2357         instead of NeverDestroyed<> + static function. This removes unnecessary static function
2358         and lazy initialization.
2359
2360         No behavior change.
2361
2362         * platform/graphics/GraphicsLayer.cpp:
2363         (WebCore::GraphicsLayer::transform const):
2364         (WebCore::GraphicsLayer::childrenTransform const):
2365         (WebCore::identityTransform): Deleted.
2366         * platform/graphics/transforms/TransformationMatrix.h:
2367         (WebCore::TransformationMatrix::TransformationMatrix):
2368
2369 2018-07-31  Zalan Bujtas  <zalan@apple.com>
2370
2371         [LFC][Floating] Add basic left/right floating positioning.
2372         https://bugs.webkit.org/show_bug.cgi?id=188148
2373
2374         Reviewed by Antti Koivisto.
2375
2376         This patch implements simple floating positioning.
2377         (Floatings with different containing blocks do not work yet.)
2378
2379         * layout/FloatingContext.cpp:
2380         (WebCore::Layout::FloatingPair::isEmpty const):
2381         (WebCore::Layout::Iterator::current const):
2382         (WebCore::Layout::Iterator::verticalPosition const):
2383         (WebCore::Layout::FloatingContext::FloatingContext):
2384         (WebCore::Layout::FloatingContext::computePosition const):
2385         (WebCore::Layout::FloatingContext::floatingPosition const):
2386         (WebCore::Layout::FloatingContext::initialVerticalPosition const):
2387         (WebCore::Layout::FloatingContext::alignWithContainingBlock const):
2388         (WebCore::Layout::FloatingContext::alignWithFloatings const):
2389         (WebCore::Layout::floatingDisplayBox):
2390         (WebCore::Layout::FloatingPair::FloatingPair):
2391         (WebCore::Layout::FloatingPair::left const):
2392         (WebCore::Layout::FloatingPair::right const):
2393         (WebCore::Layout::FloatingPair::intersects const):
2394         (WebCore::Layout::Iterator::Iterator):
2395         (WebCore::Layout::Iterator::operator++):
2396         (WebCore::Layout::Iterator::set):
2397         (WebCore::Layout::FloatingContext::computePosition): Deleted.
2398         * layout/FloatingContext.h:
2399         * layout/FloatingState.cpp:
2400         (WebCore::Layout::FloatingState::append):
2401         * layout/FloatingState.h:
2402         (WebCore::Layout::FloatingState::floatings const):
2403         (WebCore::Layout::FloatingState::last const):
2404         * layout/blockformatting/BlockFormattingContext.cpp:
2405         (WebCore::Layout::BlockFormattingContext::layout const):
2406         (WebCore::Layout::BlockFormattingContext::layoutFormattingContextRoot const):
2407         * layout/displaytree/DisplayBox.cpp:
2408         (WebCore::Display::Box::Rect::Rect):
2409         * layout/displaytree/DisplayBox.h:
2410         (WebCore::Display::Box::Rect::intersects const):
2411         (WebCore::Display::Box::rect const):
2412
2413 2018-07-31  Rob Buis  <rbuis@igalia.com>
2414
2415         Remove ResourceResponse::cacheBodyKey API
2416         https://bugs.webkit.org/show_bug.cgi?id=188192
2417
2418         Reviewed by Frédéric Wang.
2419
2420         Removed unused API.
2421
2422         No new tests needed since this API is not used.
2423
2424         * platform/network/ResourceResponseBase.h:
2425         (WebCore::ResourceResponseBase::encode const):
2426         (WebCore::ResourceResponseBase::decode):
2427         (WebCore::ResourceResponseBase::cacheBodyKey const): Deleted.
2428         (WebCore::ResourceResponseBase::setCacheBodyKey): Deleted.
2429
2430 2018-07-30  Simon Fraser  <simon.fraser@apple.com>
2431
2432         Shrink GraphicsLayerCA
2433         https://bugs.webkit.org/show_bug.cgi?id=188141
2434
2435         Reviewed by Zalan Bujtas.
2436         
2437         Shrink GraphicsLayerCA from 1040 to 880 bytes by:
2438         * moving all the clone-related stuff into the lazily-allocated m_layerClones
2439         * moving all the animation-related stuff into the lazily-allocated m_animations
2440         * making enums be 8-bit
2441         * re-ordering data members
2442
2443         * page/cocoa/ResourceUsageOverlayCocoa.mm:
2444         (WebCore::ResourceUsageOverlay::platformInitialize):
2445         * platform/graphics/GraphicsLayer.cpp:
2446         (WebCore::GraphicsLayer::GraphicsLayer):
2447         (WebCore::operator<<):
2448         * platform/graphics/GraphicsLayer.h:
2449         * platform/graphics/GraphicsLayerClient.h:
2450         * platform/graphics/WindRule.h:
2451         * platform/graphics/ca/GraphicsLayerCA.cpp:
2452         (WebCore::GraphicsLayerCA::GraphicsLayerCA):
2453         (WebCore::GraphicsLayerCA::moveOrCopyAnimations):
2454         (WebCore::GraphicsLayerCA::addProcessingActionForAnimation):
2455         (WebCore::GraphicsLayerCA::setContentsToSolidColor):
2456         (WebCore::GraphicsLayerCA::setContentsToImage):
2457         (WebCore::GraphicsLayerCA::setContentsToPlatformLayer):
2458         (WebCore::GraphicsLayerCA::contentsLayerForMedia const):
2459         (WebCore::GraphicsLayerCA::layerDidDisplay):
2460         (WebCore::layerTypeForCustomBackdropAppearance):
2461         (WebCore::GraphicsLayerCA::commitLayerChangesBeforeSublayers):
2462         (WebCore::GraphicsLayerCA::updateGeometry):
2463         (WebCore::GraphicsLayerCA::updateMasksToBounds):
2464         (WebCore::GraphicsLayerCA::updateContentsVisibility):
2465         (WebCore::GraphicsLayerCA::updateContentsOpaque):
2466         (WebCore::GraphicsLayerCA::updateBackfaceVisibility):
2467         (WebCore::GraphicsLayerCA::updateFilters):
2468         (WebCore::GraphicsLayerCA::updateBackdropFilters):
2469         (WebCore::GraphicsLayerCA::updateBackdropFiltersRect):
2470         (WebCore::GraphicsLayerCA::ensureStructuralLayer):
2471         (WebCore::GraphicsLayerCA::updateDrawsContent):
2472         (WebCore::GraphicsLayerCA::updateCoverage):
2473         (WebCore::GraphicsLayerCA::updateDebugIndicators):
2474         (WebCore::GraphicsLayerCA::updateContentsImage):
2475         (WebCore::GraphicsLayerCA::updateContentsPlatformLayer):
2476         (WebCore::GraphicsLayerCA::updateContentsColorLayer):
2477         (WebCore::GraphicsLayerCA::updateContentsRects):
2478         (WebCore::GraphicsLayerCA::updateMasksToBoundsRect):
2479         (WebCore::GraphicsLayerCA::updateMaskLayer):
2480         (WebCore::GraphicsLayerCA::updateAnimations):
2481         (WebCore::GraphicsLayerCA::isRunningTransformAnimation const):
2482         (WebCore::GraphicsLayerCA::ensureLayerAnimations):
2483         (WebCore::GraphicsLayerCA::createTransformAnimationsFromKeyframes):
2484         * platform/graphics/ca/GraphicsLayerCA.h:
2485         (WebCore::GraphicsLayerCA::animationIsRunning const):
2486         (WebCore::GraphicsLayerCA::primaryLayerClones const): Deleted.
2487         * platform/graphics/ca/PlatformCALayerClient.h:
2488         (WebCore::PlatformCALayerClient::platformCALayerContentsOrientation const):
2489         * platform/graphics/ca/TileCoverageMap.h:
2490         * platform/graphics/ca/cocoa/PlatformCALayerCocoa.h:
2491         * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
2492         (PlatformCALayerCocoa::PlatformCALayerCocoa):
2493         (PlatformCALayerCocoa::requiresCustomAppearanceUpdateOnBoundsChange const):
2494         (PlatformCALayerCocoa::updateCustomAppearance):
2495         (PlatformCALayer::drawLayerContents):
2496         * rendering/RenderLayerBacking.cpp:
2497         (WebCore::RenderLayerBacking::updateCustomAppearance):
2498         (WebCore::RenderLayerBacking::updateConfiguration):
2499         * rendering/RenderLayerCompositor.cpp:
2500         (WebCore::RenderLayerCompositor::rootBackgroundColorOrTransparencyChanged):
2501         (WebCore::RenderLayerCompositor::updateOverflowControlsLayers):
2502
2503 2018-07-30  Justin Fan  <justin_fan@apple.com>
2504
2505         [WebGL2] Support compilation of GLSL ES version 300 shaders
2506         https://bugs.webkit.org/show_bug.cgi?id=187982
2507         <rdar://problem/42564229>
2508
2509         Reviewed by Dean Jackson.
2510
2511         Test: fast/canvas/webgl/webgl2-glsl3-compile.html
2512
2513         * html/canvas/WebGLRenderingContextBase.cpp:
2514         (WebCore::WebGLRenderingContextBase::create): Rename 'useGLES3' to 'isWebGL2' (everywhere) to make more sense.
2515         * platform/graphics/GraphicsContext3DAttributes.h: Rename 'useGLES3' to 'isWebGL2'.
2516         * platform/graphics/cocoa/GraphicsContext3DCocoa.mm:
2517         (WebCore::setPixelFormat): Back WebGL2 contexts with OpenGL 4 for full OpenGL ES 3 support. 
2518         (WebCore::GraphicsContext3D::GraphicsContext3D): Request correct GLSL output version and WebGL 2 for ANGLE shader compilation.
2519         * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
2520         (WebCore::GraphicsContext3D::checkVaryingsPacking const): MAX_VARYING_FLOATS is deprecated in OpenGL 3+.
2521         * platform/graphics/texmap/GraphicsContext3DTextureMapper.cpp: Rename 'useGLES3' to 'isWebGL2'.
2522         (WebCore::GraphicsContext3D::create):
2523         (WebCore::GraphicsContext3D::GraphicsContext3D):
2524
2525 2018-07-30  Justin Fan  <justin_fan@apple.com>
2526
2527         Match GraphicsContext3D with correct virtual screen using registryID
2528         https://bugs.webkit.org/show_bug.cgi?id=188072
2529         <rdar://problem/42634940>
2530
2531         Reviewed by Dean Jackson.
2532
2533         Follow up to https://bugs.webkit.org/show_bug.cgi?id=187750. Rather than matching rendererIDs, 
2534         which can vary between processes, match GPU to display using registryID that is unique to a GPU, 
2535         which was added to CGL in MacOS 10.13. 
2536
2537         No new tests. Manually tested on MacBookPro13,3 and iMacPro1,1 with Apple DisplayPort Cinema Display
2538         and RX 580 external GPU. 
2539
2540         * platform/PlatformScreen.h:
2541         * platform/ScreenProperties.h:
2542         (WebCore::ScreenData::encode const):
2543         (WebCore::ScreenData::decode):
2544         * platform/graphics/cocoa/GraphicsContext3DCocoa.mm:
2545         (WebCore::setGPUByRegistryID):
2546         (WebCore::setGPUByDisplayMask):
2547         (WebCore::GraphicsContext3D::GraphicsContext3D):
2548         (WebCore::GraphicsContext3D::screenDidChange):
2549         (WebCore::identifyAndSetCurrentGPU): Deleted.
2550         * platform/mac/PlatformScreenMac.mm:
2551         (WebCore::collectScreenProperties):
2552         (WebCore::primaryRegistryID):
2553         (WebCore::registryIDForDisplay):
2554         (WebCore::registryIDForDisplayMask):
2555         (WebCore::rendererIDForDisplayMask): Deleted.
2556         (WebCore::rendererIDForDisplay): Deleted.
2557         (WebCore::primaryRendererID): Deleted.
2558
2559 2018-07-30  Rob Buis  <rbuis@igalia.com>
2560
2561         Merge PlatformCookieJar functions into NetworkStorageSession
2562         https://bugs.webkit.org/show_bug.cgi?id=188137
2563
2564         Reviewed by Alex Christensen.
2565
2566         No new tests -- no change in WebKit functionality.
2567
2568         * PlatformMac.cmake: Remove CookieJarMac.mm reference
2569         * SourcesCocoa.txt: Remove CookieJarMac.mm reference
2570         * WebCore.xcodeproj/project.pbxproj:
2571         * loader/CookieJar.cpp: Remove PlatformCookieJar.h reference.
2572         * platform/Curl.cmake: Remove CookieJarCurl.cpp reference.
2573         * platform/SourcesSoup.txt: Remove CookieJarSoup.cpp reference.
2574         * platform/network/CacheValidation.cpp: Adapt callsites to use
2575         NetworkStorageSession instead of CookieJar functions.
2576
2577         (WebCore::headerValueForVary):
2578         * platform/network/NetworkStorageSession.h: Add PlatformCookieJar
2579         functions.
2580
2581         * platform/network/PlatformCookieJar.h: Removed.
2582         * platform/network/SocketStreamHandleImpl.cpp: Adapt callsites to
2583         use NetworkStorageSession instead of CookieJar functions.
2584         (WebCore::cookieDataForHandshake):
2585         * platform/network/cf/CookieJarCFNet.cpp: Removed.
2586         * platform/network/cf/NetworkStorageSessionCFNet.cpp: Move functions
2587         from CookieJarCFNet.cpp.
2588         (WebCore::cookieDomain):
2589         (WebCore::canonicalCookieTime):
2590         (WebCore::cookieCreatedTime):
2591         (WebCore::cookieExpirationTime):
2592         (WebCore::cookieName):
2593         (WebCore::cookiePath):
2594         (WebCore::cookieValue):
2595         (WebCore::filterCookies):
2596         (WebCore::copyCookiesForURLWithFirstPartyURL):
2597         (WebCore::createCookies):
2598         (WebCore::NetworkStorageSession::setCookiesFromDOM const):
2599         (WebCore::containsSecureCookies):
2600         (WebCore::NetworkStorageSession::cookiesForDOM const):
2601         (WebCore::NetworkStorageSession::cookieRequestHeaderFieldValue const):
2602         (WebCore::NetworkStorageSession::cookiesEnabled const):
2603         (WebCore::NetworkStorageSession::getRawCookies const):
2604         (WebCore::NetworkStorageSession::deleteCookie const):
2605         (WebCore::NetworkStorageSession::getHostnamesWithCookies):
2606         (WebCore::NetworkStorageSession::deleteAllCookies):
2607         (WebCore::NetworkStorageSession::deleteCookiesForHostnames):
2608         (WebCore::NetworkStorageSession::deleteAllCookiesModifiedSince):
2609         * platform/network/cocoa/NetworkStorageSessionCocoa.mm: Move functions
2610         from CookieJarMac.mm.
2611         (WebCore::httpCookies):
2612         (WebCore::deleteHTTPCookie):
2613         (WebCore::policyProperties):
2614         (WebCore::cookiesForURL):
2615         (WebCore::setHTTPCookiesForURL):
2616         (WebCore::httpCookiesForURL):
2617         (WebCore::filterCookies):
2618         (WebCore::applyPartitionToCookies):
2619         (WebCore::cookiesAreBlockedForURL):
2620         (WebCore::cookiesInPartitionForURL):
2621         (WebCore::cookiesForSession):
2622         (WebCore::deleteAllHTTPCookies):
2623         (WebCore::NetworkStorageSession::cookiesForDOM const):
2624         (WebCore::NetworkStorageSession::cookieRequestHeaderFieldValue const):
2625         (WebCore::NetworkStorageSession::setCookiesFromDOM const):
2626         (WebCore::httpCookieAcceptPolicy):
2627         (WebCore::NetworkStorageSession::cookiesEnabled const):
2628         (WebCore::NetworkStorageSession::getRawCookies const):
2629         (WebCore::NetworkStorageSession::deleteCookie const):
2630         (WebCore::NetworkStorageSession::getHostnamesWithCookies):
2631         (WebCore::NetworkStorageSession::deleteAllCookies):
2632         (WebCore::NetworkStorageSession::deleteCookiesForHostnames):
2633         (WebCore::NetworkStorageSession::deleteAllCookiesModifiedSince):
2634         * platform/network/curl/CookieJarCurl.cpp: Removed.
2635         * platform/network/curl/CookieJarCurl.h:
2636         * platform/network/curl/NetworkStorageSessionCurl.cpp: Merge functions
2637         from CookieJarCurl.cpp.
2638         (WebCore::NetworkStorageSession::setCookiesFromDOM const):
2639         (WebCore::NetworkStorageSession::cookiesEnabled const):
2640         (WebCore::NetworkStorageSession::cookiesForDOM const):
2641         (WebCore::NetworkStorageSession::deleteCookie const):
2642         (WebCore::NetworkStorageSession::deleteAllCookies):
2643         (WebCore::NetworkStorageSession::deleteAllCookiesModifiedSince):
2644         (WebCore::NetworkStorageSession::deleteCookiesForHostnames):
2645         (WebCore::NetworkStorageSession::getHostnamesWithCookies):
2646         (WebCore::NetworkStorageSession::getRawCookies const):
2647         (WebCore::NetworkStorageSession::cookieRequestHeaderFieldValue const):
2648         * platform/network/mac/CookieJarMac.mm: Removed.
2649         * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm:
2650         * platform/network/soup/CookieJarSoup.cpp: Removed.
2651         * platform/network/soup/NetworkStorageSessionSoup.cpp: Merge functions
2652         from CookieJarSoup.cpp.
2653         (WebCore::NetworkStorageSession::cookiesEnabled const):
2654         (WebCore::httpOnlyCookieExists):
2655         (WebCore::NetworkStorageSession::setCookiesFromDOM const):
2656         (WebCore::NetworkStorageSession::deleteCookie const):
2657         (WebCore::NetworkStorageSession::deleteAllCookies):
2658         (WebCore::NetworkStorageSession::deleteAllCookiesModifiedSince):
2659         (WebCore::NetworkStorageSession::deleteCookiesForHostnames):
2660         (WebCore::NetworkStorageSession::getHostnamesWithCookies):
2661         (WebCore::NetworkStorageSession::getRawCookies const):
2662         (WebCore::cookiesForSession):
2663         (WebCore::NetworkStorageSession::cookiesForDOM const):
2664         (WebCore::NetworkStorageSession::cookieRequestHeaderFieldValue const):
2665
2666 2018-07-30  Chris Dumez  <cdumez@apple.com>
2667
2668         Nullptr crash accessing Document in GenericEventQueue::dispatchOneEvent()
2669         https://bugs.webkit.org/show_bug.cgi?id=187284
2670
2671         Unreviewed, roll r233496 and r233571 now that all known issues have been fixed via
2672         dependency bugs.
2673
2674         Test: media/track/video-track-addition-and-frame-removal.html
2675
2676         * Modules/encryptedmedia/legacy/WebKitMediaKeySession.cpp:
2677         (WebCore::WebKitMediaKeySession::suspend):
2678         (WebCore::WebKitMediaKeySession::resume):
2679         (WebCore::WebKitMediaKeySession::stop):
2680         * Modules/encryptedmedia/legacy/WebKitMediaKeySession.h:
2681         * Modules/mediasource/MediaSource.cpp:
2682         (WebCore::MediaSource::removeSourceBuffer):
2683         (WebCore::MediaSource::suspend):
2684         (WebCore::MediaSource::resume):
2685         * Modules/mediasource/MediaSource.h:
2686         * Modules/mediasource/SourceBuffer.cpp:
2687         (WebCore::SourceBuffer::suspend):
2688         (WebCore::SourceBuffer::resume):
2689         (WebCore::SourceBuffer::stop):
2690         * Modules/mediasource/SourceBuffer.h:
2691         * Modules/mediasource/SourceBufferList.cpp:
2692         (WebCore::SourceBufferList::SourceBufferList):
2693         (WebCore::SourceBufferList::canSuspendForDocumentSuspension const):
2694         (WebCore::SourceBufferList::suspend):
2695         (WebCore::SourceBufferList::resume):
2696         (WebCore::SourceBufferList::stop):
2697         (WebCore::SourceBufferList::activeDOMObjectName const):
2698         * Modules/mediasource/SourceBufferList.h:
2699         * Modules/mediasource/SourceBufferList.idl:
2700         * dom/Document.h:
2701         (WebCore::Document::hasBrowsingContext const):
2702         * dom/GenericEventQueue.cpp:
2703         (WebCore::GenericEventQueue::dispatchOneEvent):
2704         * html/HTMLMediaElement.cpp:
2705         (WebCore::HTMLMediaElement::prepareForLoad):
2706         (WebCore::HTMLMediaElement::selectMediaResource):
2707         (WebCore::HTMLMediaElement::prepareToPlay):
2708         (WebCore::HTMLMediaElement::playInternal):
2709         (WebCore::HTMLMediaElement::pauseInternal):
2710         (WebCore::HTMLMediaElement::sourceWasAdded):
2711         * html/track/AudioTrackList.cpp:
2712         (AudioTrackList::activeDOMObjectName const):
2713         * html/track/AudioTrackList.h:
2714         * html/track/AudioTrackList.idl:
2715         * html/track/TextTrackList.cpp:
2716         (TextTrackList::activeDOMObjectName const):
2717         * html/track/TextTrackList.h:
2718         * html/track/TextTrackList.idl:
2719         * html/track/TrackListBase.cpp:
2720         (WebCore::TrackListBase::TrackListBase):
2721         (WebCore::TrackListBase::canSuspendForDocumentSuspension const):
2722         (WebCore::TrackListBase::suspend):
2723         (WebCore::TrackListBase::resume):
2724         (WebCore::TrackListBase::stop):
2725         * html/track/TrackListBase.h:
2726         * html/track/VideoTrackList.cpp:
2727         (VideoTrackList::activeDOMObjectName const):
2728         * html/track/VideoTrackList.h:
2729         * html/track/VideoTrackList.idl:
2730
2731 2018-07-30  Chris Dumez  <cdumez@apple.com>
2732
2733         Unreviewed internal build fix after r234347.
2734
2735         * html/StepRange.cpp:
2736         (WebCore::StepRange::StepRange):
2737
2738 2018-07-29  Simon Fraser  <simon.fraser@apple.com>
2739
2740         Shrink GraphicsLayer by making m_transform and m_childrenTransform be unique_ptrs
2741         https://bugs.webkit.org/show_bug.cgi?id=188143
2742
2743         Reviewed by Zalan Bujtas.
2744
2745         m_transform and m_childrenTransform are usually identity; save space by making
2746         these unique_ptrs. The getters still return references by returning a reference
2747         to a NeverDestroyed<TransformationMatrix> if necessary.
2748         
2749         Shrinks GraphicsLayerCA from 840 to 640 bytes.
2750
2751         * platform/graphics/GraphicsLayer.cpp:
2752         (WebCore::identityTransform):
2753         (WebCore::GraphicsLayer::transform const):
2754         (WebCore::GraphicsLayer::setTransform):
2755         (WebCore::GraphicsLayer::childrenTransform const):
2756         (WebCore::GraphicsLayer::setChildrenTransform):
2757         (WebCore::GraphicsLayer::dumpProperties const):
2758         * platform/graphics/GraphicsLayer.h:
2759         (WebCore::GraphicsLayer::hasNonIdentityTransform const):
2760         (WebCore::GraphicsLayer::hasNonIdentityChildrenTransform const):
2761         (WebCore::GraphicsLayer::transform const): Deleted.
2762         (WebCore::GraphicsLayer::setTransform): Deleted.
2763         (WebCore::GraphicsLayer::childrenTransform const): Deleted.
2764         (WebCore::GraphicsLayer::setChildrenTransform): Deleted.
2765         (WebCore::GraphicsLayer::hasFlattenedPerspectiveTransform): Deleted. It was unused.
2766         * platform/graphics/ca/GraphicsLayerCA.cpp:
2767         (WebCore::GraphicsLayerCA::setTransform):
2768         (WebCore::GraphicsLayerCA::setChildrenTransform):
2769         (WebCore::GraphicsLayerCA::layerTransform const):
2770         (WebCore::GraphicsLayerCA::updateTransform):
2771         (WebCore::GraphicsLayerCA::updateChildrenTransform):
2772         (WebCore::GraphicsLayerCA::removeCAAnimationFromLayer):
2773
2774 2018-07-30  Thibault Saunier  <tsaunier@igalia.com>
2775
2776         [GStreamer] Make codecparsers optionnal
2777         https://bugs.webkit.org/show_bug.cgi?id=188010
2778
2779         And avoid building libWebRTC if it won't be used. While there is no other
2780         WebRTC backend, it makes no sense to expose an option.
2781
2782         Error out when WEBRTC or MEDIA_STREAM is enabled but GStreamer < 1.10
2783
2784         Reviewed by Alejandro G. Castro.
2785
2786         * platform/GStreamer.cmake:
2787
2788 2018-07-28  Darin Adler  <darin@apple.com>
2789
2790         [Cocoa] Update more WebCore Objective-C code to be ARC compatible
2791         https://bugs.webkit.org/show_bug.cgi?id=188140
2792
2793         Reviewed by Sam Weinig.
2794
2795         This make sure we don't put any Objective-C objects into HashMap/Set
2796         data structures, which doesn't work under ARC at this time. We could
2797         fix that some day, but it's pretty simple to change code not to rely
2798         on it, for now, and not as simple to support it in HashMap/Set.
2799
2800         * accessibility/mac/WebAccessibilityObjectWrapperBase.mm:
2801         (-[WebAccessibilityObjectWrapperBase updateObjectBackingStore]):
2802         Use CFRetain/CFAutorelease instead of retain/autorelease.
2803
2804         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
2805         (createAccessibilityRoleMap): Use CFStringRef in a HashMap rather than
2806         NSString * for string constants.
2807         (roleValueToNSString): Updated for above change.
2808
2809         * bridge/objc/WebScriptObject.mm:
2810         (-[WebScriptObject stringRepresentation]): Updated since objectValue
2811         is now CFTypeRef rather than NSObject *.
2812
2813         * bridge/objc/objc_instance.mm:
2814         (ObjcInstance::create): Use CFTypeRef instead of id for the key types
2815         in a HashMap.
2816         (ObjcInstance::~ObjcInstance): Updated for the above change.
2817         (ObjcInstance::invokeObjcMethod): Updated since objectValue is now
2818         CFTypeRef.
2819         (ObjcInstance::invokeDefaultMethod): Ditto.
2820         (ObjcInstance::setValueOfUndefinedField): Ditto.
2821         * bridge/objc/objc_runtime.mm:
2822         (JSC::Bindings::ObjcArray::setValueAt const): Ditto.
2823
2824         * bridge/objc/objc_utility.h: Use #pragma once. Use CFTypeRef instead
2825         of NSObject * for objectValue, since it's in a union and ARC does not
2826         support strong Objective-C object pointers in a union.
2827
2828         * bridge/objc/objc_utility.mm:
2829         (JSC::Bindings::convertValueToObjcValue): Updated since objectValue is
2830         now CFTypeRef.
2831
2832         * editing/cocoa/HTMLConverter.mm:
2833         (HTMLConverter::_processElement): Use CFTypeRef rather than NSTextTable
2834         for a HashMap.
2835         (HTMLConverter::_exitElement): Ditto.
2836
2837         * editing/cocoa/WebContentReaderCocoa.mm:
2838         (WebCore::attributesForAttributedStringConversion): Use CFRetain rather
2839         than -[NSObject retain] in a workaround for an overrelease.
2840
2841         * editing/mac/DictionaryLookup.h: Removed code to make this usable from
2842         non-Objective-C source files. Use tuples rather than out arguments
2843         for the results of the various functions.
2844
2845         * editing/mac/DictionaryLookup.mm:
2846         (WebCore::DictionaryLookup::rangeForSelection): Return a tuple rather
2847         than using an out argument for options.
2848         (WebCore::DictionaryLookup::rangeAtHitTestResult): Ditto.
2849         (WebCore::DictionaryLookup::stringForPDFSelection): Ditto.
2850         (WebCore::showPopupOrCreateAnimationController): Removed use of typedef
2851         PlatformAnimationController.
2852         (WebCore::DictionaryLookup::animationControllerForPopup): Ditto.
2853
2854         * html/HTMLMediaElement.h: Put the videoFullscreenLayer function inside
2855         an __OBJC__ ifdef since we can't do the type conversion without the
2856         full Objective-C type.
2857
2858         * page/mac/EventHandlerMac.mm:
2859         (WebCore::selfRetainingNSScrollViewScrollWheel): Use CFRetain/CFRelease
2860         instead of retain/release.
2861         (WebCore::EventHandler::selectClosestWordFromHitTestResultBasedOnLookup):
2862         Updated to use tuple return value from DictionaryLookup.
2863
2864         * page/scrolling/ScrollingStateNode.h: Replaced direct use of PlatformLayer*
2865         in a union with use of a "typless" void* pointer and added helper functions
2866         to convert in both directions.
2867         * page/scrolling/cocoa/ScrollingStateNode.mm:
2868         (WebCore::LayerRepresentation::retainPlatformLayer): Use CFRetain instead
2869         of retain.
2870         (WebCore::LayerRepresentation::releasePlatformLayer): Use CFRelease instead
2871         of release.
2872         (WebCore::LayerRepresentation::makePlatformLayerTyped): Added.
2873         (WebCore::LayerRepresentation::makePlatformLayerTypeless): Ditto.
2874         * page/scrolling/coordinatedgraphics/ScrollingStateNodeCoordinatedGraphics.cpp:
2875         (WebCore::LayerRepresentation::retainPlatformLayer): Updated argument type.
2876         (WebCore::LayerRepresentation::releasePlatformLayer): Ditto.
2877         (WebCore::LayerRepresentation::makePlatformLayerTyped): Added.
2878         (WebCore::LayerRepresentation::makePlatformLayerTypeless): Ditto.
2879
2880         * platform/gamepad/cocoa/GameControllerGamepadProvider.h: Use CFTypeRef
2881         instad of GCController * for key type of HashMap.
2882         * platform/gamepad/cocoa/GameControllerGamepadProvider.mm:
2883         (WebCore::GameControllerGamepadProvider::controllerDidConnect): Updated
2884         for the above change.
2885         (WebCore::GameControllerGamepadProvider::controllerDidDisconnect): Ditto.
2886
2887         * platform/graphics/avfoundation/AVTrackPrivateAVFObjCImpl.mm:
2888         Use SOFT_LINK_CONSTANT_MAY_FAIL instead of SOFT_LINK_POINTER_OPTIONAL for
2889         strings, since SOFT_LINK_POINTER_OPTIONAL does not work for Objective-C
2890         types under ARC.
2891         (WebCore::AVTrackPrivateAVFObjCImpl::audioKind const): Added checks
2892         for the constants.
2893         (WebCore::AVTrackPrivateAVFObjCImpl::videoKind const): Ditto.
2894         (WebCore::AVTrackPrivateAVFObjCImpl::label const): Ditto.
2895
2896         * platform/graphics/avfoundation/MediaSelectionGroupAVFObjC.h:
2897         Use #pragma once and use CFTypeRef instead of AVMediaSelectionOption *
2898         in the key to a HashMap.
2899         * platform/graphics/avfoundation/MediaSelectionGroupAVFObjC.mm:
2900         (WebCore::MediaSelectionGroupAVFObjC::updateOptions): Updated for
2901         the above change.
2902
2903         * platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.mm:
2904         Use SOFT_LINK_CONSTANT_MAY_FAIL instead of SOFT_LINK_POINTER_OPTIONAL for
2905         strings, since SOFT_LINK_POINTER_OPTIONAL does not work for Objective-C
2906         types under ARC.
2907         (WebCore::customSchemeURL): Removed unnecessary use of
2908         NeverDestroyed<RetainPtr>. Can just use a straight pointer without calling
2909         release, and that works with or without ARC.
2910         (WebCore::imageDecoderAssetOptions): Ditto. Here, had to add a retain,
2911         which we'll remove when we turn on ARC. Added canLoad checks, needed
2912         because of SOFT_LINK_CONSTANT_MAY_FAIL.
2913         (WebCore::ImageDecoderAVFObjC::firstEnabledTrack): Added canLoad check,
2914         needed because of SOFT_LINK_CONSTANT_MAY_FAIL.
2915
2916         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
2917         Use CFTypeRef instead of AVAssetResourceLoadingRequest in HashMap.
2918         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
2919         (WebCore::MediaPlayerPrivateAVFoundationObjC::shouldWaitForLoadingOfResource):
2920         Updated for above.
2921         (WebCore::MediaPlayerPrivateAVFoundationObjC::didCancelLoadingRequest): Ditto.
2922         (WebCore::MediaPlayerPrivateAVFoundationObjC::didStopLoadingRequest): Ditto.
2923
2924         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
2925         Use CFTypeRef instead of AVSampleBufferAudioRenderer in HashMap.
2926         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
2927         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setVolume): Updated for above.
2928         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setMuted): Ditto.
2929         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setPreservesPitch): Ditto.
2930         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setHasAvailableAudioSample): Ditto.
2931         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::addAudioRenderer): Ditto.
2932         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::removeAudioRenderer): Ditto.
2933
2934         * platform/graphics/metal/GPUDrawableMetal.mm: Updated include; under ARC, it's
2935         not safe to call a method on a class without seeing its interface.
2936
2937         * platform/mac/VideoFullscreenInterfaceMac.mm: Added an explicit
2938         __unsafe_unretained for a delegate. Could consider moving to weak, but for now
2939         this preserves the current behavior and compiles under ARC.
2940
2941         * platform/mac/WebCoreFullScreenPlaceholderView.h: Use strong for the contents,
2942         weak for the target, and changed the action to be hard-coded instead of an
2943         arbitrary selector. If we find we need the flexibility again later, we can do
2944         it with a block, which is more ARC-friendly than calling an arbitrary selector.
2945         * platform/mac/WebCoreFullScreenPlaceholderView.mm:
2946         (-[WebCoreFullScreenPlaceholderView initWithFrame:]): Call function directly
2947         instead of taking advantage of "using".
2948         (-[WebCoreFullScreenPlaceholderView mouseDown:]): Call cancelOperation: on the
2949         target rather than performing an arbitrary selector.
2950
2951         * platform/mac/WebCoreObjCExtras.mm:
2952         (WebCoreObjCScheduleDeallocateOnMainThread): Use sel_registerName instead of
2953         @selector, since @selector is not supported under ARC.
2954
2955         * platform/network/ResourceHandle.h: Use a return value rather than using an
2956         inout argument in applySniffingPoliciesAndStoragePartitionIfNeeded.
2957
2958         * platform/network/cocoa/CookieStorageObserver.mm:
2959         (WebCore::CookieStorageObserver::startObserving): Removed unnecessary
2960         assertion of repondsToSelector since we are about to dispatch it immediately
2961         after. Call the selector in the conventional way instead of using performSelector.
2962
2963         * platform/network/cocoa/WebCoreNSURLSession.h: Use #pragma once and use
2964         CFTypeRef instead of an Objective-C type. Also use an explicit __unsafe_unretained
2965         for the session in the data task.
2966         * platform/network/cocoa/WebCoreNSURLSession.mm:
2967         (-[WebCoreNSURLSession dealloc]): Updated for the above.
2968         (-[WebCoreNSURLSession taskCompleted:]): Ditto.
2969         (-[WebCoreNSURLSession invalidateAndCancel]): Ditto.
2970         (-[WebCoreNSURLSession getTasksWithCompletionHandler:]): Ditto.
2971         (-[WebCoreNSURLSession getAllTasksWithCompletionHandler:]): Ditto.
2972         (-[WebCoreNSURLSession dataTaskWithRequest:]): Ditto.
2973         (-[WebCoreNSURLSession dataTaskWithURL:]): Ditto.
2974
2975         * platform/network/mac/ResourceHandleMac.mm:
2976         (WebCore::ResourceHandle::applySniffingPoliciesAndStoragePartitionIfNeeded):
2977         Use a return value instead of an inout argument. Also use bridging casts.
2978         (WebCore::ResourceHandle::createNSURLConnection): Updated for the change above.
2979         Also use a bridging cast.
2980         (WebCore::ResourceHandle::schedule): Use a bridging cast.
2981         (WebCore::ResourceHandle::unschedule): Ditto.
2982
2983         * platform/network/mac/WebCoreURLResponse.mm:
2984         (WebCore::adjustMIMETypeIfNecessary): Use a bridging cast.
2985
2986         * testing/Internals.cpp:
2987         (WebCore::Internals::rangeForDictionaryLookupAtLocation): Moved the macOS
2988         version of this function out of this file ...
2989         * testing/Internals.mm:
2990         (WebCore::Internals::rangeForDictionaryLookupAtLocation): ... to here.
2991
2992 2018-07-29  Yusuke Suzuki  <utatane.tea@gmail.com>
2993
2994         Use static global variables instead of static NeverDestroyed inside function if possible
2995         https://bugs.webkit.org/show_bug.cgi?id=188146
2996
2997         Reviewed by Darin Adler.
2998
2999         This patch leverages constexpr constructors / trivial destructors more to remove unnecessary `static NeverDestroyed`
3000         inside a function. It simplifies the code, removes the unnecessary function, and ensures the initialization at
3001         a program loader phase.
3002
3003         We make StepRange::StepDescription constructor constexpr to remove bunch of `static NeverDestroyed<const StepRange::StepDescription>`.
3004         And we use `static Lock` since WTF::Lock has constexpr constructor.
3005
3006         No behavior change.
3007
3008         * dom/MessagePort.cpp:
3009         (WebCore::MessagePort::deref const):
3010         (WebCore::MessagePort::isExistingMessagePortLocallyReachable):
3011         (WebCore::MessagePort::notifyMessageAvailable):
3012         (WebCore::MessagePort::MessagePort):
3013         (WebCore::MessagePort::~MessagePort):
3014         (WebCore::allMessagePortsLock): Deleted.
3015         * dom/ScriptExecutionContext.cpp:
3016         (WebCore::ScriptExecutionContext::contextIdentifier const):
3017         (WebCore::ScriptExecutionContext::removeFromContextsMap):
3018         (WebCore::ScriptExecutionContext::~ScriptExecutionContext):
3019         (WebCore::ScriptExecutionContext::postTaskTo):
3020         (WebCore::allScriptExecutionContextsMapLock): Deleted.
3021         * html/DateInputType.cpp:
3022         (WebCore::DateInputType::createStepRange const):
3023         * html/DateTimeInputType.cpp:
3024         (WebCore::DateTimeInputType::createStepRange const):
3025         * html/DateTimeLocalInputType.cpp:
3026         (WebCore::DateTimeLocalInputType::createStepRange const):
3027         * html/MonthInputType.cpp:
3028         (WebCore::MonthInputType::createStepRange const):
3029         * html/RangeInputType.cpp:
3030         (WebCore::RangeInputType::createStepRange const):
3031         * html/StepRange.h:
3032         (WebCore::StepRange::StepDescription::StepDescription):
3033         * html/TimeInputType.cpp:
3034         (WebCore::TimeInputType::createStepRange const):
3035         * html/WeekInputType.cpp:
3036         (WebCore::WeekInputType::createStepRange const):
3037         * page/SecurityPolicy.cpp:
3038         (WebCore::originAccessMap):
3039         (WebCore::SecurityPolicy::isAccessWhiteListed):
3040         (WebCore::SecurityPolicy::addOriginAccessWhitelistEntry):
3041         (WebCore::SecurityPolicy::removeOriginAccessWhitelistEntry):
3042         (WebCore::SecurityPolicy::resetOriginAccessWhitelists):
3043         (WebCore::originAccessMapLock): Deleted.
3044         * platform/SchemeRegistry.cpp:
3045         (WebCore::allBuiltinSchemes):
3046         (WebCore::builtinLocalURLSchemes):
3047         (WebCore::localURLSchemes):
3048         (WebCore::displayIsolatedURLSchemes):
3049         (WebCore::builtinSecureSchemes):
3050         (WebCore::secureSchemes):
3051         (WebCore::builtinSchemesWithUniqueOrigins):
3052         (WebCore::schemesWithUniqueOrigins):
3053         (WebCore::builtinCanDisplayOnlyIfCanRequestSchemes):
3054         (WebCore::canDisplayOnlyIfCanRequestSchemes):
3055         (WebCore::SchemeRegistry::registerURLSchemeAsLocal):
3056         (WebCore::SchemeRegistry::removeURLSchemeRegisteredAsLocal):
3057         (WebCore::ContentSecurityPolicyBypassingSchemes):
3058         (WebCore::cachePartitioningSchemes):
3059         (WebCore::serviceWorkerSchemes):
3060         (WebCore::SchemeRegistry::shouldTreatURLSchemeAsLocal):
3061         (WebCore::SchemeRegistry::registerURLSchemeAsNoAccess):
3062         (WebCore::SchemeRegistry::shouldTreatURLSchemeAsNoAccess):
3063         (WebCore::SchemeRegistry::registerURLSchemeAsDisplayIsolated):
3064         (WebCore::SchemeRegistry::shouldTreatURLSchemeAsDisplayIsolated):
3065         (WebCore::SchemeRegistry::registerURLSchemeAsSecure):
3066         (WebCore::SchemeRegistry::shouldTreatURLSchemeAsSecure):
3067         (WebCore::SchemeRegistry::canDisplayOnlyIfCanRequest):
3068         (WebCore::SchemeRegistry::registerAsCanDisplayOnlyIfCanRequest):
3069         (WebCore::SchemeRegistry::registerURLSchemeAsBypassingContentSecurityPolicy):
3070         (WebCore::SchemeRegistry::removeURLSchemeRegisteredAsBypassingContentSecurityPolicy):
3071         (WebCore::SchemeRegistry::schemeShouldBypassContentSecurityPolicy):
3072         (WebCore::SchemeRegistry::registerURLSchemeAsCachePartitioned):
3073         (WebCore::SchemeRegistry::shouldPartitionCacheForURLScheme):
3074         (WebCore::SchemeRegistry::registerURLSchemeServiceWorkersCanHandle):
3075         (WebCore::SchemeRegistry::canServiceWorkersHandleURLScheme):
3076         (WebCore::SchemeRegistry::isServiceWorkerContainerCustomScheme):
3077         (WebCore::schemeRegistryLock): Deleted.
3078
3079 2018-07-29  Basuke Suzuki  <Basuke.Suzuki@sony.com>
3080
3081         [Curl] Fix the bug when client reject the redirect on WebKitLegacy.
3082         https://bugs.webkit.org/show_bug.cgi?id=188130
3083
3084         Reviewed by Darin Adler.
3085
3086         ResourceHandle for Curl port has a bug when a client returns en empty request which
3087         indicates the redirecti is rejected by the client. It should be quit the task immediately,
3088         but it kept doing the job. Fixed.
3089         NetworkDataTask implementation did the right thing and there's no bug for them. 
3090
3091         Test: http/tests/xmlhttprequest/xmlhttprequest-unsafe-redirect-expected.txt
3092
3093         * platform/network/curl/ResourceHandleCurl.cpp:
3094         (WebCore::ResourceHandle::continueAfterWillSendRequest):
3095
3096 2018-07-28  Simon Fraser  <simon.fraser@apple.com>
3097
3098         Reset CompositingPolicyOverride between tests
3099         https://bugs.webkit.org/show_bug.cgi?id=188138
3100
3101         Reviewed by Zalan Bujtas.
3102
3103         WK1 tests were failing after r234330 because the compositing policy override optional
3104         was left set on the Page (WK1 has injected bundle SPI to clear it). Fix by having 
3105         Internals::resetToConsistentState clear this state.
3106
3107         * testing/Internals.cpp:
3108         (WebCore::Internals::resetToConsistentState):
3109
3110 2018-07-24  Simon Fraser  <simon.fraser@apple.com>
3111
3112         Animation stops with object-fit:contain on an animated 2d canvas
3113         https://bugs.webkit.org/show_bug.cgi?id=187840
3114
3115         Reviewed by Zalan Bujtas.
3116         
3117         If a canvas has object-fit: cover or contain, repaints need to mapped through
3118         the rect that is used to position the canvas in the element bounds, which is replacedContentRect().
3119         
3120         Add a version of replacedContentRect() that doesn't require passing the intrinsicSize() since
3121         all but RenderVideo just pass the RenderReplaced's intrinsicSize.
3122
3123         Test: fast/repaint/canvas-object-fit.html
3124
3125         * html/HTMLCanvasElement.cpp:
3126         (WebCore::HTMLCanvasElement::didDraw):
3127         * rendering/RenderHTMLCanvas.cpp:
3128         (WebCore::RenderHTMLCanvas::paintReplaced):
3129         * rendering/RenderImage.cpp:
3130         (WebCore::RenderImage::updateInnerContentRect):
3131         (WebCore::RenderImage::paintReplaced):
3132         * rendering/RenderLayerBacking.cpp:
3133         (WebCore::RenderLayerBacking::contentsBox const):
3134         * rendering/RenderReplaced.h:
3135         (WebCore::RenderReplaced::replacedContentRect const):
3136         * rendering/shapes/ShapeOutsideInfo.cpp:
3137         (WebCore::ShapeOutsideInfo::createShapeForImage const):
3138
3139 2018-07-27  Simon Fraser  <simon.fraser@apple.com>
3140
3141         Adjust the color matrix for the inverse apple-invert-lightness() transformation
3142         https://bugs.webkit.org/show_bug.cgi?id=188131
3143         rdar://problem/42673070
3144
3145         Reviewed by Zalan Bujtas.
3146
3147         Use the correct inverse matrix values.
3148
3149         Test: editing/style/inverse-color-filter.html
3150
3151         * platform/graphics/filters/FilterOperation.cpp:
3152         (WebCore::InvertLightnessFilterOperation::inverseTransformColor const):
3153
3154 2018-07-27  Eric Carlson  <eric.carlson@apple.com>
3155
3156         [iOS] Don't deactivate audio session
3157         https://bugs.webkit.org/show_bug.cgi?id=188127
3158         <rdar://problem/42544143>
3159
3160         Reviewed by Jon Lee.
3161         
3162         r233435 includes a change that deactivates the shared audio session when there are no more
3163         active media sessions. This is a good in WK2 because it allows other applications to resume
3164         playing audio when WebKit stops playing, but it is potentially bad in WK1 where the host
3165         app may also be playing audio.
3166
3167         * platform/audio/PlatformMediaSessionManager.cpp:
3168         (WebCore::PlatformMediaSessionManager::removeSession): Don't deactivate the audio session.
3169
3170 2018-07-27  Chris Dumez  <cdumez@apple.com>
3171
3172         Fix thread-safety issues related to RealtimeMediaSource::audioSamplesAvailable()
3173         https://bugs.webkit.org/show_bug.cgi?id=188097
3174         <rdar://problem/42558823>
3175
3176         Reviewed by Eric Carlson.
3177
3178         Fix thread-safety issues related to RealtimeMediaSource::audioSamplesAvailable(). RealtimeMediaSource::audioSamplesAvailable()
3179         is called on a background thread but iterates over observers that may get destroyed concurrently on the main thread.
3180
3181         To address the issue:
3182         - Introduce a Lock to protect m_observer accesses
3183         - Copy observers to a Vector before iterating over them
3184
3185         * platform/mediastream/MediaStreamTrackPrivate.cpp:
3186         (WebCore::MediaStreamTrackPrivate::forEachObserver const):
3187         (WebCore::MediaStreamTrackPrivate::addObserver):
3188         (WebCore::MediaStreamTrackPrivate::removeObserver):
3189         (WebCore::MediaStreamTrackPrivate::setEnabled):
3190         (WebCore::MediaStreamTrackPrivate::endTrack):
3191         (WebCore::MediaStreamTrackPrivate::sourceStarted):
3192         (WebCore::MediaStreamTrackPrivate::sourceStopped):
3193         (WebCore::MediaStreamTrackPrivate::sourceMutedChanged):
3194         (WebCore::MediaStreamTrackPrivate::sourceSettingsChanged):
3195         (WebCore::MediaStreamTrackPrivate::videoSampleAvailable):
3196         (WebCore::MediaStreamTrackPrivate::audioSamplesAvailable):
3197         (WebCore::MediaStreamTrackPrivate::updateReadyState):
3198         * platform/mediastream/MediaStreamTrackPrivate.h:
3199         (WebCore::MediaStreamTrackPrivate::Observer::sampleBufferUpdated):
3200         (WebCore::MediaStreamTrackPrivate::Observer::audioSamplesAvailable):
3201         * platform/mediastream/RealtimeMediaSource.cpp:
3202         (WebCore::RealtimeMediaSource::addObserver):
3203         (WebCore::RealtimeMediaSource::removeObserver):
3204         (WebCore::RealtimeMediaSource::forEachObserver const):
3205         (WebCore::RealtimeMediaSource::notifyMutedObservers const):
3206         (WebCore::RealtimeMediaSource::settingsDidChange):
3207         (WebCore::RealtimeMediaSource::videoSampleAvailable):
3208         (WebCore::RealtimeMediaSource::audioSamplesAvailable):
3209         (WebCore::RealtimeMediaSource::start):
3210         (WebCore::RealtimeMediaSource::requestStop):
3211         (WebCore::RealtimeMediaSource::captureFailed):
3212         * platform/mediastream/RealtimeMediaSource.h:
3213         * platform/mediastream/mac/AudioTrackPrivateMediaStreamCocoa.cpp:
3214         (WebCore::AudioTrackPrivateMediaStreamCocoa::audioSamplesAvailable):
3215         * platform/mediastream/mac/RealtimeOutgoingAudioSourceCocoa.cpp:
3216         * platform/mediastream/mac/WebAudioSourceProviderAVFObjC.mm:
3217
3218 2018-07-27  Alex Christensen  <achristensen@webkit.org>
3219
3220         Don't include WebPageProxy.h just for UndoOrRedo
3221         https://bugs.webkit.org/show_bug.cgi?id=188086
3222
3223         Reviewed by Saam Barati.
3224
3225         * platform/DragItem.h:
3226
3227 2018-07-27  Alex Christensen  <achristensen@webkit.org>
3228
3229         Make CompletionHandler more const correct
3230         https://bugs.webkit.org/show_bug.cgi?id=186543
3231
3232         Reviewed by Saam Barati.
3233
3234         * dom/messageports/MessagePortChannel.cpp:
3235         (WebCore::MessagePortChannel::checkRemotePortForActivity):
3236         * dom/messageports/MessagePortChannelProviderImpl.cpp:
3237         (WebCore::MessagePortChannelProviderImpl::checkRemotePortForActivity):
3238         * loader/DocumentLoader.cpp:
3239         (WebCore::DocumentLoader::responseReceived):
3240         * loader/FrameLoader.cpp:
3241         (WebCore::FrameLoader::loadURL):
3242         (WebCore::FrameLoader::loadWithDocumentLoader):
3243         (WebCore::FrameLoader::loadPostRequest):
3244         * platform/network/cocoa/WebCoreNSURLSession.mm:
3245         (WebCore::WebCoreNSURLSessionDataTaskClient::redirectReceived):
3246         * workers/service/server/RegistrationDatabase.cpp:
3247         (WebCore::RegistrationDatabase::pushChanges):
3248         (WebCore::RegistrationDatabase::clearAll):
3249         * workers/service/server/SWServer.cpp:
3250         (WebCore::SWServer::matchAll):
3251         * workers/service/server/SWServer.h:
3252         * workers/service/server/SWServerWorker.cpp:
3253         (WebCore::SWServerWorker::matchAll):
3254         * workers/service/server/SWServerWorker.h:
3255
3256 2018-07-27  Simon Fraser  <simon.fraser@apple.com>
3257
3258         Be more conservative with compositing layer creation when memory is low
3259         https://bugs.webkit.org/show_bug.cgi?id=187866
3260         rdar://problem/42366345
3261
3262         Reviewed by Zalan Bujtas.
3263         
3264         When process physical footprint is above a fraction of the jetsam limit, be more conservative in making
3265         compositing layers. We avoid compositing for these situations:
3266         1. Layers with 3D transforms which are affine (like translateZ(0)).
3267         2. Layers with will-change
3268         3. Layers for canvases (other than WebGL/WebGPU)
3269         
3270         We reuse some macOS code in MemoryPressureHandler() but choose different thresholds for iOS,
3271         falling into "conservative mode" at 50% of jetsam limit, and "strict mode" at 65%.
3272         Compositing chooses to be more conservative in either "conservative" or "strict" memory modes.
3273         
3274         Plumb through a "compositingPolicyOverride" both so that on-device testing isn't
3275         flakily falling into a different mode, and so that we can impose the conservative
3276         mode for testing.
3277
3278         Test: compositing/layer-creation/compositing-policy.html
3279
3280         * page/Page.h:
3281         (WebCore::Page::compositingPolicyOverride const):
3282         (WebCore::Page::setCompositingPolicyOverride):
3283         * platform/graphics/transforms/Matrix3DTransformOperation.cpp:
3284         (WebCore::Matrix3DTransformOperation::isRepresentableIn2D const):
3285         * platform/graphics/transforms/Matrix3DTransformOperation.h:
3286         * platform/graphics/transforms/PerspectiveTransformOperation.h:
3287         * platform/graphics/transforms/RotateTransformOperation.h:
3288         * platform/graphics/transforms/ScaleTransformOperation.h:
3289         * platform/graphics/transforms/TransformOperation.h:
3290         (WebCore::TransformOperation::isRepresentableIn2D const):
3291         * platform/graphics/transforms/TransformOperations.h:
3292         (WebCore::TransformOperations::has3DOperation const):
3293         (WebCore::TransformOperations::isRepresentableIn2D const):
3294         * platform/graphics/transforms/TranslateTransformOperation.h:
3295         * rendering/RenderLayerBacking.cpp:
3296         (WebCore::RenderLayerBacking::updateGeometry):
3297         * rendering/RenderLayerCompositor.cpp:
3298         (WebCore::RenderLayerCompositor::cacheAcceleratedCompositingFlags):
3299         (WebCore::RenderLayerCompositor::updateCompositingPolicy):
3300         (WebCore::RenderLayerCompositor::updateCompositingLayers):
3301         (WebCore::RenderLayerCompositor::requiresCompositingForTransform const):
3302         (WebCore::RenderLayerCompositor::requiresCompositingForVideo const):
3303         (WebCore::RenderLayerCompositor::requiresCompositingForCanvas const):
3304         (WebCore::RenderLayerCompositor::requiresCompositingForPlugin const):
3305         (WebCore::RenderLayerCompositor::requiresCompositingForWillChange const):
3306         (WebCore::RenderLayerCompositor::needsFixedRootBackgroundLayer const):
3307         (WebCore::operator<<):
3308         * rendering/RenderLayerCompositor.h:
3309         * testing/Internals.cpp:
3310         (WebCore::Internals::setCompositingPolicyOverride):
3311         (WebCore::Internals::compositingPolicyOverride const):
3312         * testing/Internals.h:
3313         * testing/Internals.idl:
3314
3315 2018-07-27  Zalan Bujtas  <zalan@apple.com>
3316
3317         [WK1] ASSERTION FAILED: renderer().repaintLayoutRects().m_repaintRect == renderer().clippedOverflowRectForRepaint(renderer().containerForRepaint()) in WebCore::RenderLayer::updateLayerPositionsAfterScroll
3318         https://bugs.webkit.org/show_bug.cgi?id=188122
3319         <rdar://problem/42584790>
3320
3321         Reviewed by Simon Fraser.
3322
3323         When ScrollView's m_paintsEntireContents flag flips due to layer backing changes, the repaint area transitions from
3324         visual to layout overflow. When this happens the cached repaint rects become invalid and they need to be recomputed.
3325         Currently there's no mechanism to trigger repaint cache invalidation from ScrollView.
3326         Skip assertion for now on WK1 (see webkit.org/b/188121)
3327
3328         * rendering/RenderLayer.cpp:
3329         (WebCore::RenderLayer::updateLayerPositionsAfterScroll):
3330
3331 2018-07-27  Myles C. Maxfield  <mmaxfield@apple.com>
3332
3333         [WIN] Crash when trying to access store pages
3334         https://bugs.webkit.org/show_bug.cgi?id=188032
3335         <rdar://problem/42467016>
3336
3337         Reviewed by Brent Fulgham.
3338
3339         The Windows implementation of GlyphBuffer has an additional member, m_offsets, which represents
3340         an additional offset to the position to paint each glyph. It also has two add() functions, one
3341         which appends to this vector, and one which doesn't. The one that doesn't append to the vector
3342         should never be called on Windows (because Windows requires this vector to be full).
3343
3344         There were two situations where it was getting called:
3345         1) Inside ComplexTextController
3346         2) Inside display list playback
3347
3348         Windows shouldn't be using ComplexTextController because the Windows implementation of this 
3349         class isn't ready yet; instead it should be using UniscribeController. The display list playback
3350         code should be used on Windows.
3351
3352         Rather than fix the function to append an offset, we actually don't need the m_offsets vector
3353         in the first place. Instead, we can do it the same way that the Cocoa ports do it, which is to
3354         bake the offsets into the glyph advances. This is possible because the GlyphBuffer doesn't need
3355         to distinguish between layout advances and paint advances, so we can bake them together and
3356         just put paint advances in the GlyphBuffer. This should be a small (probably within-the-noise)
3357         performance and memory improvement.
3358
3359         * platform/graphics/ComplexTextController.cpp:
3360         (WebCore::ComplexTextController::ComplexTextController): Make sure that ComplexTextController
3361         isn't used on Windows.
3362         * platform/graphics/FontCascade.cpp:
3363         (WebCore::FontCascade::widthOfTextRange const): Switch from ComplexTextController to
3364         UniscribeController on Windows.
3365         (WebCore::FontCascade::drawGlyphBuffer const): After deleting the m_offsets vector, there's
3366         no reason to consult it when drawing.
3367         * platform/graphics/GlyphBuffer.h: Remove m_offsets
3368         (WebCore::GlyphBuffer::clear):
3369         (WebCore::GlyphBuffer::advanceAt const):
3370         (WebCore::GlyphBuffer::add):
3371         (WebCore::GlyphBuffer::expandLastAdvance):
3372         (WebCore::GlyphBuffer::shrink):
3373         (WebCore::GlyphBuffer::swap):
3374         (WebCore::GlyphBuffer::offsetAt const): Deleted.
3375         * platform/graphics/win/FontCGWin.cpp:
3376         (WebCore::FontCascade::drawGlyphs): After deleting the m_offsets vector, there's no reason
3377         to consult it when drawing.
3378         * platform/graphics/win/FontCascadeDirect2D.cpp:
3379         (WebCore::FontCascade::drawGlyphs): Ditto.
3380         * platform/graphics/win/UniscribeController.cpp:
3381         (WebCore::UniscribeController::shapeAndPlaceItem): Bake in the offsets into the glyph advances.
3382
3383 2018-07-27  Basuke Suzuki  <Basuke.Suzuki@sony.com>
3384
3385         [Curl] Crash on synchronous request via ResourceHandle.
3386         https://bugs.webkit.org/show_bug.cgi?id=188033
3387
3388         Reviewed by Alex Christensen.
3389
3390         The timing of instantiation of delegate was wrong. Move it inside `delegate` getter().
3391         This bug was introduced at r228577.
3392
3393         Test: http/tests/xmlhttprequest/simple-sync.html
3394
3395         * platform/network/curl/ResourceHandleCurl.cpp:
3396         (WebCore::ResourceHandle::start):
3397         (WebCore::ResourceHandle::delegate):
3398
3399 2018-07-03  David Fenton  <david_fenton@apple.com>
3400
3401         Unreviewed, rolling out r233461.
3402
3403         assertions triggered on ios11 Debug wk2
3404
3405         Reverted changeset:
3406
3407         "[iOS] Add assert to catch improper use of WebCore::Timer in
3408         UI Process"
3409         https://bugs.webkit.org/show_bug.cgi?id=185330
3410         https://trac.webkit.org/changeset/233461
3411
3412 2018-07-27  Chris Dumez  <cdumez@apple.com>
3413
3414         [Media] Avoid unnecessarily constructing *TrackList objects
3415         https://bugs.webkit.org/show_bug.cgi?id=188094
3416
3417         Reviewed by Eric Carlson.
3418
3419         Avoid unnecessarily constructing *TrackList objects as this is preventing us from making them
3420         ActiveDOMObjects.
3421
3422         * Modules/mediasource/MediaSource.cpp:
3423         (WebCore::MediaSource::removeSourceBuffer):
3424         * Modules/mediasource/SourceBuffer.cpp:
3425         (WebCore::SourceBuffer::sourceBufferPrivateDidReceiveInitializationSegment):
3426         * html/HTMLMediaElement.cpp:
3427         (WebCore::HTMLMediaElement::addAudioTrack):
3428         (WebCore::HTMLMediaElement::addTextTrack):
3429         (WebCore::HTMLMediaElement::addVideoTrack):
3430         (WebCore::HTMLMediaElement::ensureAudioTracks):
3431         (WebCore::HTMLMediaElement::ensureTextTracks):
3432         (WebCore::HTMLMediaElement::ensureVideoTracks):
3433         (WebCore::HTMLMediaElement::setSelectedTextTrack):
3434         (WebCore::HTMLMediaElement::audioTracks): Deleted.
3435         (WebCore::HTMLMediaElement::textTracks): Deleted.
3436         (WebCore::HTMLMediaElement::videoTracks): Deleted.
3437         * html/HTMLMediaElement.h:
3438         (WebCore::HTMLMediaElement::audioTracks const):
3439         (WebCore::HTMLMediaElement::textTracks const):
3440         (WebCore::HTMLMediaElement::videoTracks const):
3441         * html/HTMLMediaElement.idl:
3442         * html/shadow/MediaControlElements.cpp:
3443         (WebCore::MediaControlClosedCaptionsTrackListElement::updateDisplay):
3444         (WebCore::MediaControlClosedCaptionsTrackListElement::rebuildTrackListMenu):
3445         (WebCore::MediaControlTextTrackContainerElement::updateTextStrokeStyle):
3446         * html/track/TextTrack.cpp:
3447         (WebCore::TextTrack::setKind):
3448         (WebCore::TextTrack::trackIndex):
3449         (WebCore::TextTrack::trackIndexRelativeToRenderedTracks):
3450         (WebCore::TextTrack::setLanguage):
3451         * html/track/VideoTrack.cpp:
3452         (WebCore::VideoTrack::setKind):
3453         (WebCore::VideoTrack::setLanguage):
3454         * platform/cocoa/PlaybackSessionModelMediaElement.mm:
3455         (WebCore::PlaybackSessionModelMediaElement::setMediaElement):
3456         (WebCore::PlaybackSessionModelMediaElement::updateMediaSelectionOptions):
3457
3458 2018-07-27  Basuke Suzuki  <Basuke.Suzuki@sony.com>
3459
3460         [Curl] Set correct source info to ResourceResponse.
3461         https://bugs.webkit.org/show_bug.cgi?id=188069
3462
3463         Reviewed by Fujii Hironori.
3464
3465         ResourceResponseBase::Source::Network must be set by each ports. Curl port
3466         didn't set this.
3467
3468         Test: http/tests/cache/disk-cache/disk-cache-302-status-code.html
3469
3470         * platform/network/curl/ResourceResponseCurl.cpp:
3471         (WebCore::ResourceResponse::ResourceResponse):
3472
3473 2018-07-26  Andy VanWagoner  <andy@vanwagoner.family>
3474
3475         [INTL] Remove INTL sub-feature compile flags
3476         https://bugs.webkit.org/show_bug.cgi?id=188081
3477
3478         Reviewed by Michael Catanzaro.
3479
3480         Compile time feature flags for INTL sub features were removed, and are covered by existing tests.
3481
3482         * Configurations/FeatureDefines.xcconfig:
3483
3484 2018-07-26  Zalan Bujtas  <zalan@apple.com>
3485
3486         [Fullscreen] Do not create composited layers for renderers unless they are part of the fullscreen subtree.
3487         https://bugs.webkit.org/show_bug.cgi?id=188087
3488         <rdar://problem/42632124>
3489
3490         Reviewed by Simon Fraser.
3491
3492         Sibling composited layers prevent battery lifetime optimizations when in fullscreen.
3493
3494         Test: compositing/no-compositing-when-fulll-screen-is-present.html
3495
3496         * rendering/RenderLayer.cpp:
3497         (WebCore::RenderLayer::isDescendantOf const):
3498         * rendering/RenderLayer.h:
3499         * rendering/RenderLayerCompositor.cpp:
3500         (WebCore::isDescendantOfFullScreenLayer):
3501         (WebCore::RenderLayerCompositor::requiresCompositingForWillChange const):
3502         (WebCore::RenderLayerCompositor::requiresCompositingForPosition const):
3503
3504 2018-07-26  Ryan Haddad  <ryanhaddad@apple.com>
3505
3506         Unreviewed, rolling out r234281.
3507
3508         Broke internal builds.
3509
3510         Reverted changeset:
3511
3512         "[Datalist] Add button to TextFieldInputs with a datalist"
3513         https://bugs.webkit.org/show_bug.cgi?id=187741
3514         https://trac.webkit.org/changeset/234281
3515
3516 2018-07-26  Aditya Keerthi  <akeerthi@apple.com>
3517
3518         [Datalist] Add button to TextFieldInputs with a datalist
3519         https://bugs.webkit.org/show_bug.cgi?id=187741
3520
3521         Reviewed by Tim Horton.
3522
3523         TextFieldInputs that have an associated datalist element should be drawn as
3524         combo boxes. However, we cannot use NSComboBox for this control, as NSComboBox
3525         is not height-resizable. Furthermore, the input should also be able to contain
3526         additional elements, such as the stepper for type=number and the cancel button
3527         for type=search. For these reasons, we draw a button at the end of the input,
3528         mimicking appearance of a combo box.
3529
3530         The list-button -webkit-appearance value was added to display the new button.
3531
3532         Tests: fast/forms/datalist/datalist-searchinput-appearance.html
3533                fast/forms/datalist/datalist-textinput-appearance.html
3534
3535         * Resources/ListButtonArrow.png: Added.
3536         * Resources/ListButtonArrow@2x.png: Added.
3537         * WebCore.xcodeproj/project.pbxproj:
3538         * css/CSSPrimitiveValueMappings.h:
3539         (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
3540         * css/CSSProperties.json:
3541         * css/CSSValueKeywords.in:
3542         * css/html.css:
3543         (input::-webkit-list-button):
3544         * html/HTMLInputElement.cpp:
3545         (WebCore::HTMLInputElement::dataListButtonElement const):
3546         (WebCore::HTMLInputElement::isShowingList const):
3547         * html/HTMLInputElement.h:
3548         * html/InputType.h:
3549         (WebCore::InputType::dataListButtonElement const):
3550         (WebCore::InputType::isShowingList const):
3551         * html/TextFieldInputType.cpp:
3552         (WebCore::TextFieldInputType::needsContainer const):
3553         (WebCore::TextFieldInputType::createShadowSubtree):
3554         (WebCore::TextFieldInputType::destroyShadowSubtree):
3555         (WebCore::TextFieldInputType::listAttributeTargetChanged):
3556         (WebCore::TextFieldInputType::dataListButtonElement const):
3557         (WebCore::TextFieldInputType::dataListButtonElementWasClicked):
3558         (WebCore::TextFieldInputType::didCloseSuggestions):
3559         (WebCore::TextFieldInputType::isShowingList const):
3560         * html/TextFieldInputType.h:
3561         * html/shadow/DataListButtonElement.cpp: Added.
3562         (WebCore::DataListButtonElement::create):
3563         (WebCore::DataListButtonElement::DataListButtonElement):
3564         (WebCore::DataListButtonElement::~DataListButtonElement):
3565         (WebCore::DataListButtonElement::defaultEventHandler):
3566         * html/shadow/DataListButtonElement.h: Added.
3567         * platform/ThemeTypes.h:
3568         * rendering/RenderTheme.cpp:
3569         (WebCore::RenderTheme::adjustStyle):
3570         (WebCore::RenderTheme::adjustListButtonStyle const):
3571         * rendering/RenderTheme.h:
3572         * rendering/RenderThemeMac.h:
3573         * rendering/RenderThemeMac.mm:
3574         (-[WebListButtonCell drawWithFrame:inView:]):
3575         (WebCore::RenderThemeMac::paintListButtonForInput):
3576         (WebCore::RenderThemeMac::adjustListButtonStyle const):
3577         (WebCore::RenderThemeMac::paintTextField):
3578         (WebCore::RenderThemeMac::paintSearchField):
3579         (WebCore::RenderThemeMac::paintSearchFieldCancelButton):
3580         (WebCore::RenderThemeMac::listButton const):
3581
3582 2018-07-26  Antoine Quint  <graouts@apple.com>
3583
3584         [Web Animations] Accelerated animations don't respect a positive delay value
3585         https://bugs.webkit.org/show_bug.cgi?id=186930
3586         <rdar://problem/41393393>
3587
3588         Reviewed by Dean Jackson.
3589
3590         Test: webanimations/accelerated-animation-with-delay.html
3591
3592         We would mistakenly clear the list of pending accelerated actions in KeyframeEffectReadOnly::applyPendingAcceleratedActions()
3593         even if we failed to proceed because of the target element's renderer not being composited yet. Now, we clear the list after
3594         we've established we can apply them, and if we can't we inform the animation with a call to acceleratedStateDidChange() which
3595         will in turn call into the document timeline so that we may consider these animations on the next tick.
3596
3597         For this to work correctly we must make a change to DocumentTimeline::applyPendingAcceleratedAnimations() which only cleared
3598         its list of pending accelerated animations _after_ iterating through them, which would be problematic since we would now add
3599         animations to this list. That list is now copied and cleared prior to iterating through its members.
3600
3601         We also fix the naming of the m_pendingAcceleratedActions copy in KeyframeEffectReadOnly::applyPendingAcceleratedActions()
3602         to have a more similar name.
3603
3604         * animation/DocumentTimeline.cpp:
3605         (WebCore::DocumentTimeline::applyPendingAcceleratedAnimations):
3606         * animation/KeyframeEffectReadOnly.cpp:
3607         (WebCore::KeyframeEffectReadOnly::applyPendingAcceleratedActions):
3608
3609 2018-07-26  Ross Kirsling  <ross.kirsling@sony.com>
3610
3611         String(View) should have a splitAllowingEmptyEntries function instead of a flag parameter
3612         https://bugs.webkit.org/show_bug.cgi?id=187963
3613
3614         Reviewed by Alex Christensen.
3615
3616         * Modules/applepay/cocoa/PaymentContactCocoa.mm:
3617         (WebCore::convert):
3618         * Modules/cache/DOMCache.cpp:
3619         (WebCore::hasResponseVaryStarHeaderValue):
3620         * Modules/cache/DOMCacheEngine.cpp:
3621         (WebCore::DOMCacheEngine::queryCacheMatch):
3622         * Modules/mediastream/PeerConnectionBackend.cpp:
3623         (WebCore::filterICECandidate):
3624         (WebCore::PeerConnectionBackend::filterSDP const):
3625         * Modules/websockets/WebSocketHandshake.cpp:
3626         (WebCore::WebSocketHandshake::checkResponseHeaders):
3627         * accessibility/AccessibilityObject.h:
3628         (WebCore::AccessibilityObject::determineARIADropEffects):
3629         * accessibility/AccessibilityRenderObject.cpp:
3630         (WebCore::AccessibilityRenderObject::determineARIADropEffects):
3631         * accessibility/AccessibilityRenderObject.h:
3632         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
3633         (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
3634         * editing/cocoa/DataDetection.mm:
3635         (WebCore::DataDetection::shouldCancelDefaultAction):
3636         * editing/markup.cpp:
3637         (WebCore::fillContainerFromString):
3638         (WebCore::createFragmentFromText):
3639         * html/EmailInputType.cpp:
3640         (WebCore::EmailInputType::typeMismatchFor const):
3641         (WebCore::EmailInputType::sanitizeValue const):
3642         * html/HTMLInputElement.cpp:
3643         (WebCore::parseAcceptAttribute):
3644         * html/ValidationMessage.cpp:
3645         (WebCore::ValidationMessage::setMessageDOMAndStartTimer):
3646         * html/canvas/WebGLRenderingContextBase.cpp:
3647         (WebCore::WebGLRenderingContextBase::compileShader):
3648         * inspector/agents/InspectorDOMAgent.cpp:
3649         (WebCore::InspectorDOMAgent::nodeForPath):
3650         * loader/FormSubmission.cpp:
3651         (WebCore::encodingFromAcceptCharset):
3652         * loader/ResourceTiming.cpp:
3653         (WebCore::passesTimingAllowCheck):
3654         * page/WindowFeatures.cpp:
3655         (WebCore::parseDisabledAdaptations):
3656         (WebCore::parseDialogFeaturesMap):
3657         * platform/URL.cpp:
3658         (WebCore::isIPv4Address):
3659         (WebCore::isIPv6Address):
3660         * platform/graphics/GLContext.cpp:
3661         (WebCore::GLContext::version):
3662         * platform/graphics/freetype/FontCacheFreeType.cpp:
3663         (WebCore::patternToFamilies):
3664         * platform/graphics/gstreamer/GStreamerCommon.cpp:
3665         (WebCore::extractGStreamerOptionsFromCommandLine):
3666         * platform/graphics/opengl/Extensions3DOpenGLCommon.cpp:
3667         (WebCore::Extensions3DOpenGLCommon::Extensions3DOpenGLCommon):
3668         (WebCore::Extensions3DOpenGLCommon::initializeAvailableExtensions):
3669         * platform/gtk/PasteboardHelper.cpp:
3670         (WebCore::PasteboardHelper::fillSelectionData):
3671         * platform/gtk/SelectionData.cpp:
3672         (WebCore::SelectionData::setURIList):
3673         * platform/network/CacheValidation.cpp:
3674         (WebCore::collectVaryingRequestHeaders):
3675         * platform/network/HTTPParsers.cpp:
3676         (WebCore::filenameFromHTTPContentDisposition):
3677         (WebCore::parseXFrameOptionsHeader):
3678         (WebCore::parseAccessControlExposeHeadersAllowList):
3679         * platform/network/curl/CookieUtil.cpp:
3680         (WebCore::CookieUtil::parseCookieHeader):
3681         * platform/network/curl/CurlCacheEntry.cpp:
3682         (WebCore::CurlCacheEntry::loadResponseHeaders):
3683         * platform/network/curl/CurlCacheManager.cpp:
3684         (WebCore::CurlCacheManager::loadIndex):
3685         * platform/network/soup/CookieJarSoup.cpp:
3686         (WebCore::setCookiesFromDOM):
3687         * svg/SVGAnimationElement.cpp:
3688         (WebCore::SVGAnimationElement::parseAttribute):
3689         * svg/SVGToOTFFontConversion.cpp:
3690         (WebCore::SVGToOTFFontConverter::appendOS2Table):
3691         * svg/animation/SVGSMILElement.cpp:
3692         (WebCore::SVGSMILElement::parseBeginOrEnd):
3693         * testing/MockCDMFactory.cpp:
3694         (WebCore::MockCDM::sanitizeResponse const):
3695         (WebCore::MockCDMInstance::updateLicense):
3696         Update split/splitAllowingEmptyEntries usage.
3697
3698 2018-07-26  Nan Wang  <n_wang@apple.com>
3699
3700         AX: nothing returned for various previous text marker APIs from one div/p node to another
3701         https://bugs.webkit.org/show_bug.cgi?id=188071
3702
3703         Reviewed by Chris Fleizach.
3704
3705         TextIterator is emitting an extra '\n' at the end of the <p> node and there's no
3706         corresponding text node in the DOM tree, so we are not able to handle that for 
3707         text markers. Fixed it by ignoring the extra '\n' and anchor the text marker to 
3708         the previous child text node.
3709
3710         Test: accessibility/mac/text-marker-p-tags.html
3711
3712         * accessibility/AXObjectCache.cpp:
3713         (WebCore::AXObjectCache::traverseToOffsetInRange):
3714
3715 2018-07-26  Commit Queue  <commit-queue@webkit.org>
3716
3717         Unreviewed, rolling out r234181 and r234189.
3718         https://bugs.webkit.org/show_bug.cgi?id=188075
3719
3720         These are not needed right now (Requested by thorton on
3721         #webkit).
3722
3723         Reverted changesets:
3724
3725         "Enable Web Content Filtering on watchOS"
3726         https://bugs.webkit.org/show_bug.cgi?id=187979
3727         https://trac.webkit.org/changeset/234181
3728
3729         "HAVE(PARENTAL_CONTROLS) should be true on watchOS"
3730         https://bugs.webkit.org/show_bug.cgi?id=187985
3731         https://trac.webkit.org/changeset/234189
3732
3733 2018-07-26  Timothy Hatcher  <timothy@apple.com>
3734
3735         Use the Page's appearance when converting pasteboard attributed strings.
3736         https://bugs.webkit.org/show_bug.cgi?id=188067
3737         rdar://problem/42632246
3738
3739         Reviewed by Wenson Hsieh.
3740
3741         * editing/cocoa/WebContentReaderCocoa.mm:
3742         (WebCore::createFragment): Create a LocalDefaultSystemAppearance based on the Page.
3743
3744 2018-07-26  Eric Carlson  <eric.carlson@apple.com>
3745
3746         Switching tabs should not close PiP window
3747         https://bugs.webkit.org/show_bug.cgi?id=188054
3748         <rdar://problem/41212379>
3749
3750         Reviewed by Jon Lee.
3751
3752         No new tests, fixes an existing test.
3753         
3754         Prior to r233926, calling VideoFullscreenInterfaceMac::requestHideAndExitFullscreen was a noop.
3755         In r233926 it was updated to close the PiP window and was called from the PIPViewControllerDelegate
3756         selectors to close the PiP window. requestHideAndExitFullscreen is also called from 
3757         WebPageProxy::viewDidLeaveWindow when the web view is removed from it window, so switching
3758         tabs also closed the PiP window. Revert the changes to requestHideAndExitFullscreen, and add
3759         a new method that is only used by the delegate to exit PiP.
3760
3761         * platform/mac/VideoFullscreenInterfaceMac.h:
3762         (WebCore::VideoFullscreenInterfaceMac::requestHideAndExitFullscreen): Make this an empty,
3763         do-nothing method.
3764         * platform/mac/VideoFullscreenInterfaceMac.mm:
3765         (-[WebVideoFullscreenInterfaceMacObjC pipShouldClose:]): Call requestHideAndExitPiP.
3766         (-[WebVideoFullscreenInterfaceMacObjC pipActionStop:]): Ditto.
3767         (WebCore::VideoFullscreenInterfaceMac::requestHideAndExitPiP): Renamed from requestHideAndExitFullscreen.
3768         (WebCore::VideoFullscreenInterfaceMac::requestHideAndExitFullscreen): Deleted.
3769
3770 2018-07-04  Darin Adler  <darin@apple.com>
3771
3772         Improve WebGPU implementation, including using Metal Objective-C protocols more simply and correctly
3773         https://bugs.webkit.org/show_bug.cgi?id=187333
3774
3775         Reviewed by Sam Weinig.
3776
3777         - Used a new OBJC_PROTOCOL macro to handle things in the Metal API that are protocols.
3778           The code previously had used OBJC_CLASS, but that created unrelated classes.
3779           Fixing this allows removing many typecasts that were in the existing code, makes it
3780           ARC-compatible, and also allowed the compiler to detect a couple mistakes where we
3781           were calling methods that don't exist.
3782
3783         - Eliminated use of separate heap-allocated, reference-counted objects to
3784           hold pointers to Metal objects.
3785
3786         - Reduced the use of the WebGPU wrappers to pass around arguments inside the code.
3787           They are now used only as part of the DOM binding; the inner GPU objects are used
3788           whenever possible. This cuts down the number of separate functions needed a bit,
3789           since we don't always need accessors for the things inside the wrappers.
3790
3791         - Used references rather than pointers in many cases.
3792
3793         - Took out three kinds of null checks: 1) Unneeded ones since Objective-C has the
3794           "do nothing and return 0" behavior for methods without return values and that return
3795           integer scalars. 2) Checks that aren't needed because the code has clear, invariant
3796           guarantees that the pointer won't be null. 3) The simplest variant of (2), checks
3797           that can be obviated by using reference types instead of pointer types.
3798
3799         - For Metal-specific functions and data members, used the function name metal() and
3800           the data member name m_metal rather than longer wordier names with the word "platform"
3801           in them. We could use "platform" if these objects were platform-specific objects used
3802           in a cross-platform way that needed a common name. But in this case it's clearer to
3803           call them "metal" since we are dropping down to the metal with Metal API, and
3804           shared platform-independent code will not be accessing these.
3805
3806         - Fixed the common mistake of using "unsigned long" in our C++ code to match IDL.
3807           The "unsigned long" type in IDL correponds to the "unsigned" type in WebKit code.
3808
3809         - Used "const" more in the GPU functions that are wrappers around Metal objects to
3810           reflect the fact that these have semantics of smart pointers; most operations can be
3811           done without changing which object is pointed to. This allows us to use const
3812           references to pass things around without reference count churn.
3813
3814         - Reduced includes.
3815
3816         - Added "explicit" keywords where appropriate.
3817
3818         - Removed unused functions. In particular, removed non-Metal stub versions of the
3819           functions in the GPU classes: the right way to start a new port is to clone the
3820           Metal-specific files and turn the into stubs if needed, it does not make it
3821           significantly more convenient to have stubs in the platform independent files,
3822           especially ones that are not compiled for any platform.
3823
3824         - Removed most the WEBCORE_EXPORT in the GPU headers; left only what's needed to
3825           support testing with TestWebKitAPI.
3826
3827         - Fixed two storage leaks in GPUDevice by adding missing adoptNS.
3828
3829         * PlatformMac.cmake: Moved files from platform/graphics/cocoa to platform/graphics/metal.
3830         * SourcesCocoa.txt: Ditto.
3831         * WebCore.xcodeproj/project.pbxproj: Ditto. Fixed paths on some files and groups/directories.
3832         Made the platform files that abstract GPU all be "project" visible, not "private", since
3833         they don't need to be visible outside WebCore. Removed reference to FontSelectionKeywordValues.h,
3834         which does not seem to be a source file, a derived source file, or mentioned in any change log.
3835
3836         * bindings/js/JSWebGPURenderPassAttachmentDescriptorCustom.cpp:
3837         (WebCore::toJSNewlyCreated): Create the correct wrapper for a
3838         WebGPURenderPassDepthAttachmentDescriptor. The old code would instead
3839         create a WebGPURenderPassAttachmentDescriptor wrapper, which can't be
3840         used to access the clearDepth attribute.
3841
3842         * html/canvas/WebGPUBuffer.cpp:
3843         (WebCore::WebGPUBuffer::create): Use more references rather than pointers for things
3844         that are never null. Added comment about possibly returning null on failure in future.
3845         (WebCore::WebGPUBuffer::WebGPUBuffer): Updated to store the GPUBuffer inside the class
3846         instead of in a separate reference counted object.
3847         * html/canvas/WebGPUBuffer.h: Ditto.
3848
3849         * html/canvas/WebGPUCommandBuffer.cpp:
3850         (WebCore::WebGPUCommandBuffer::create): Use references and lower level types.
3851         (WebCore::WebGPUCommandBuffer::WebGPUCommandBuffer): Store the GPUCommandBuffer
3852         inside the class.
3853         (WebCore::WebGPUCommandBuffer::commit): Removed unneeded null checks.
3854         (WebCore::WebGPUCommandBuffer::presentDrawable): Ditto.
3855         (WebCore::WebGPUCommandBuffer::createRenderCommandEncoderWithDescriptor):
3856         Removed unneeded local variable.
3857         (WebCore::WebGPUCommandBuffer::createComputeCommandEncoder): Ditto.
3858         (WebCore::WebGPUCommandBuffer::completed): Store the DOMPromiseProxy in this
3859         class, not in GPUCommandBuffer.
3860         * html/canvas/WebGPUCommandBuffer.h: Ditto.
3861
3862         * html/canvas/WebGPUCommandQueue.cpp:
3863         (WebCore::WebGPUCommandQueue::create): Use references and lower level types.
3864         (WebCore::WebGPUCommandQueue::WebGPUCommandQueue): Store the GPUCommandQueue
3865         inside the class.
3866         (WebCore::WebGPUCommandQueue::createCommandBuffer): Ditto.
3867         * html/canvas/WebGPUCommandQueue.h: Ditto.
3868         * html/canvas/WebGPUCommandQueue.idl: The return value of createCommandBuffer
3869         is no longer nullable.
3870
3871         * html/canvas/WebGPUComputeCommandEncoder.cpp:
3872         (WebCore::WebGPUComputeCommandEncoder::create): More of the same.
3873         (WebCore::WebGPUComputeCommandEncoder::WebGPUComputeCommandEncoder): Ditto.
3874         (WebCore::WebGPUComputeCommandEncoder::setComputePipelineState): Ditto.
3875         (WebCore::WebGPUComputeCommandEncoder::setBuffer): Ditto.
3876         (WebCore::WebGPUComputeCommandEncoder::dispatch): Ditto.
3877         (WebCore::WebGPUComputeCommandEncoder::endEncoding): Ditto.
3878         * html/canvas/WebGPUComputeCommandEncoder.h: Ditto.
3879
3880         * html/canvas/WebGPUComputePipelineState.cpp:
3881         (WebCore::WebGPUComputePipelineState::create): More of the same.
3882         (WebCore::WebGPUComputePipelineState::WebGPUComputePipelineState): Ditto.
3883         * html/canvas/WebGPUComputePipelineState.h: Ditto.
3884
3885         * html/canvas/WebGPUDepthStencilDescriptor.cpp:
3886         (WebCore::WebGPUDepthStencilDescriptor::create): More of the same.
3887         (WebCore::WebGPUDepthStencilDescriptor::depthWriteEnabled const): Ditto.
3888         (WebCore::WebGPUDepthStencilDescriptor::setDepthWriteEnabled): Ditto.
3889         (WebCore::WebGPUDepthStencilDescriptor::depthCompareFunction const): Ditto.
3890         (WebCore::WebGPUDepthStencilDescriptor::setDepthCompareFunction): Ditto.
3891         * html/canvas/WebGPUDepthStencilDescriptor.h: Ditto. Also fixed a bug
3892         where m_depthCompareFunction was uninitialized in newly created objects.
3893
3894         * html/canvas/WebGPUDepthStencilState.cpp:
3895         (WebCore::WebGPUDepthStencilState::create): More of the same.
3896         (WebCore::WebGPUDepthStencilState::WebGPUDepthStencilState): Ditto.
3897         (WebCore::WebGPUDepthStencilState::label const): Ditto.
3898         (WebCore::WebGPUDepthStencilState::setLabel): Ditto.
3899         * html/canvas/WebGPUDepthStencilState.h: Ditto.
3900
3901         * html/canvas/WebGPUDrawable.cpp:
3902         (WebCore::WebGPUDrawable::create): More of the same.
3903         (WebCore::WebGPUDrawable::WebGPUDrawable): Ditto.
3904         * html/canvas/WebGPUDrawable.h: Ditto.
3905
3906         * html/canvas/WebGPUEnums.cpp: Removed some stray const.
3907         * html/canvas/WebGPUEnums.h: Ditto.
3908
3909         * html/canvas/WebGPUFunction.cpp:
3910         (WebCore::WebGPUFunction::create): More of the same.
3911         (WebCore::WebGPUFunction::WebGPUFunction): Ditto.
3912         * html/canvas/WebGPUFunction.h: Ditto.
3913
3914         * html/canvas/WebGPULibrary.cpp:
3915         (WebCore::WebGPULibrary::create): More of the same.
3916         (WebCore::WebGPULibrary::WebGPULibrary): Ditto.
3917         (WebCore::WebGPULibrary::functionNames const): Ditto.
3918         (WebCore::WebGPULibrary::functionWithName const): Ditto.
3919         * html/canvas/WebGPULibrary.h: Ditto.
3920
3921         * html/canvas/WebGPUObject.cpp:
3922         (WebCore::WebGPUObject::WebGPUObject):
3923         (WebCore::WebGPUObject::deleteObject): Deleted this unused function.
3924         We can bring it back later if we find we need it the way we did with the
3925         WebGL implementation, but currently it's a never-called stub. Also
3926         deleted the isDeleted and m_deleted for the same reason.
3927         * html/canvas/WebGPUObject.h: Ditto.
3928
3929         * html/canvas/WebGP