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