[LFC][IFC] Remove InlineItem::width
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2019-06-04  Zalan Bujtas  <zalan@apple.com>
2
3         [LFC][IFC] Remove InlineItem::width
4         https://bugs.webkit.org/show_bug.cgi?id=198502
5         <rdar://problem/51371744>
6
7         Reviewed by Antti Koivisto.
8
9         InlineItems are supposd to work across subsequent layouts (and in preferred width computation as well) so they should
10         not hold on to layout information (run width). This would not work with split runs either.
11
12         * layout/inlineformatting/InlineFormattingContext.h:
13         * layout/inlineformatting/InlineFormattingContextLineLayout.cpp:
14         (WebCore::Layout::UncommittedContent::runs):
15         (WebCore::Layout::UncommittedContent::isEmpty const):
16         (WebCore::Layout::UncommittedContent::size const):
17         (WebCore::Layout::UncommittedContent::add):
18         (WebCore::Layout::UncommittedContent::reset):
19         (WebCore::Layout::InlineFormattingContext::LineLayout::placeInlineItems const):
20         (WebCore::Layout::InlineFormattingContext::LineLayout::computedIntrinsicWidth const):
21         (WebCore::Layout::InlineFormattingContext::LineLayout::createDisplayRuns const):
22         (): Deleted.
23         (WebCore::Layout::InlineFormattingContext::LineLayout::commitInlineItemToLine const): Deleted.
24         * layout/inlineformatting/InlineItem.h:
25         (WebCore::Layout::InlineItem::style const):
26         (): Deleted.
27         (WebCore::Layout::InlineItem::setWidth): Deleted.
28         (WebCore::Layout::InlineItem::width const): Deleted.
29
30 2019-06-04  Zalan Bujtas  <zalan@apple.com>
31
32         [LFC][IFC] Move run width measuring out of LineBreaker
33         https://bugs.webkit.org/show_bug.cgi?id=198491
34         <rdar://problem/51363554>
35
36         Reviewed by Antti Koivisto.
37
38         LineBreaker should not need to deal with measuring runs.
39         This is also in preparation for removing InlineItem::width().
40
41         * layout/inlineformatting/InlineFormattingContextLineLayout.cpp:
42         (WebCore::Layout::inlineItemWidth):
43         (WebCore::Layout::InlineFormattingContext::LineLayout::placeInlineItems const):
44         (WebCore::Layout::InlineFormattingContext::LineLayout::computedIntrinsicWidth const):
45         * layout/inlineformatting/InlineLineBreaker.cpp:
46         (WebCore::Layout::LineBreaker::breakingContext):
47         (WebCore::Layout::LineBreaker::LineBreaker): Deleted.
48         (WebCore::Layout::LineBreaker::runWidth const): Deleted.
49         (WebCore::Layout::LineBreaker::textWidth const): Deleted.
50         * layout/inlineformatting/InlineLineBreaker.h:
51
52 2019-06-04  Zalan Bujtas  <zalan@apple.com>
53
54         [LFC][IFC] Remove redundant InlineItem::width() calls.
55         https://bugs.webkit.org/show_bug.cgi?id=198489
56         <rdar://problem/51360390>
57
58         Reviewed by Antti Koivisto.
59
60         This is in preparation for removing InlineItem::width().
61
62         * layout/inlineformatting/InlineFormattingContextLineLayout.cpp:
63         (WebCore::Layout::InlineFormattingContext::LineLayout::handleFloat const):
64         (WebCore::Layout::InlineFormattingContext::LineLayout::commitInlineItemToLine const):
65         * layout/inlineformatting/InlineLine.cpp:
66         (WebCore::Layout::Line::appendNonBreakableSpace):
67         (WebCore::Layout::Line::appendInlineContainerStart):
68         (WebCore::Layout::Line::appendInlineContainerEnd):
69         * layout/inlineformatting/InlineLine.h:
70
71 2019-06-04  Antoine Quint  <graouts@apple.com>
72
73         The "mouseenter" and "pointerenter" events are fired from the bottom up
74         https://bugs.webkit.org/show_bug.cgi?id=198036
75         <rdar://problem/50940350>
76
77         Reviewed by Darin Adler.
78
79         Ensure "mouseenter" and "pointerenter" events are dispatched from the bottom up to match the UI Events spec
80         at https://w3c.github.io/uievents/#events-mouseevent-event-order. We also fix the issue where "pointerevent"
81         and "pointerleave" events were dispatched as bubbling events on iOS which is not correct and was caught by the
82         new iOS test.
83  
84         Tests: pointerevents/ios/enter-leave-order.html
85                pointerevents/mouse/enter-leave-order.html
86
87         * dom/ios/PointerEventIOS.cpp:
88         (WebCore::typeCanBubble):
89         (WebCore::PointerEvent::PointerEvent):
90         * page/EventHandler.cpp:
91         (WebCore::EventHandler::updateMouseEventTargetNode):
92         * page/PointerCaptureController.cpp:
93         (WebCore::PointerCaptureController::dispatchEventForTouchAtIndex):
94
95 2019-06-04  Cathie Chen  <cathiechen@igalia.com>
96
97         JS wrapper of target in ResizeObserverEntry/ResizeObserver shouldn't get collected ahead
98         https://bugs.webkit.org/show_bug.cgi?id=197457
99
100         Reviewed by Ryosuke Niwa.
101
102         Add JSCustomMarkFunction to make sure JS wrappers wouldn't be collected when JSResizeObserverEntry live.
103
104         For ResizeObserver, if targets are removed, it will get fired for the last time. We also need to keep these JS
105         wrappers live. So add these targets to a GCReachableRef list once they're observed.
106
107         Add element-leak.html to test the targets with `entry.target.myEntry = entry` could be released properly.
108
109         Tests: resize-observer/element-leak.html
110                resize-observer/resize-observer-entry-keeps-js-wrapper-of-target-alive.html
111                resize-observer/resize-observer-keeps-js-wrapper-of-target-alive.html
112
113         * Sources.txt:
114         * WebCore.xcodeproj/project.pbxproj:
115         * bindings/js/JSResizeObserverEntryCustom.cpp: Added.
116         (WebCore::JSResizeObserverEntry::visitAdditionalChildren):
117         * page/ResizeObserver.cpp:
118         (WebCore::ResizeObserver::observe):
119         (WebCore::ResizeObserver::removeAllTargets):
120         (WebCore::ResizeObserver::removeObservation):
121         (WebCore::ResizeObserver::stop):
122         * page/ResizeObserver.h:
123         * page/ResizeObserverEntry.idl:
124
125 2019-06-03  Andy Estes  <aestes@apple.com>
126
127         [Apple Pay] Disable script injection when canMakePayment APIs are called and return true
128         https://bugs.webkit.org/show_bug.cgi?id=198448
129         <rdar://problem/51323694>
130
131         Reviewed by Alex Christensen.
132
133         Previously, only an active Apple Pay session would disable script injection in restricted
134         WKWebViews. However, this can result in websites rendering non-functional Apple Pay buttons
135         due to the race between the hosting app calling -evaluateJavaScript:completionHandler: and
136         the website calling canMakePayment APIs to determine whether to draw a button.
137
138         This patch makes it so that, if a website calls ApplePaySession's canMakePayments or
139         canMakePaymentsWithActiveCard, or PaymentRequest's canMakePayment, in a web view that has no
140         injected scripts, and those calls return true, future script injections from the hosting app
141         will be blocked.
142
143         Also, this patch removes the restrictions on the openPaymentSetup, supportsVersion, and
144         validatedPaymentNetwork APIs, since those APIs do not reveal transaction information and are
145         not used to determine whether to draw buttons.
146
147         Added new API tests.
148
149         * Modules/applepay/PaymentCoordinator.cpp:
150         (WebCore::PaymentCoordinator::supportsVersion const):
151         (WebCore::PaymentCoordinator::canMakePayments):
152         (WebCore::PaymentCoordinator::canMakePaymentsWithActiveCard):
153         (WebCore::PaymentCoordinator::openPaymentSetup):
154         (WebCore::PaymentCoordinator::beginPaymentSession):
155         (WebCore::PaymentCoordinator::validatedPaymentNetwork const):
156         (WebCore::PaymentCoordinator::setApplePayIsActiveIfAllowed const):
157         (WebCore::PaymentCoordinator::shouldAllowUserAgentScripts const):
158         (WebCore::PaymentCoordinator::shouldAllowApplePay const): Deleted.
159         * Modules/applepay/PaymentCoordinator.h:
160         * dom/Document.cpp:
161         (WebCore::Document::isApplePayActive const):
162         (WebCore::Document::setApplePayIsActive):
163         (WebCore::Document::hasStartedApplePaySession const): Deleted.
164         (WebCore::Document::setHasStartedApplePaySession): Deleted.
165         * dom/Document.h:
166         * testing/Internals.cpp:
167         (WebCore::Internals::setApplePayIsActive):
168         (WebCore::Internals::setHasStartedApplePaySession): Deleted.
169         * testing/Internals.h:
170         * testing/Internals.idl:
171
172 2019-06-03  Robin Morisset  <rmorisset@apple.com>
173
174         [WHLSL] Parsing and lexing the standard library is slow
175         https://bugs.webkit.org/show_bug.cgi?id=192890
176         <rdar://problem/50746335>
177
178         Reviewed by Myles Maxfield.
179
180         The main idea is to avoid backtracking by instead peeking at the next token (and occasionally at the one after that).
181         This implies a few things:
182         - We can replace the stack of tokens by a trivial ring buffer of size 2 (holding the next token and the one after, or WTF::nullopt if we are at the end of the file).
183         - We now have "completeFooExpression" functions, to avoid having to reparse the prefix of some expression, if we find half-way through what it is.
184
185         I also fixed the following parser bug:
186         - https://bugs.webkit.org/show_bug.cgi?id=198305 [WHLSL] Multiple variables with initializers in a declaration statement crashes the compiler
187             which was due to a mistake I made in the grammar
188
189         Finally I added two new macros: CONSUME_TYPE and PARSE to eliminate about 500 lines of error propagation boilerplate.
190
191         There are still lots of ways of improving the parser and lexer, such as:
192         - finishing the conversion of tokens in the lexer, not bothering with allocating string views
193         - make two special tokens Invalid and EOF, to remove the overhead of Optional
194         - make peekTypes and consumeTypes use templates to avoid constructing a Vector and calling find on it.
195         - Turn the entire lexer into a proper automata, not going through the same characters again and again (this is certainly the largest win by far)
196         - Remove the last few pieces of backtracking from the parser.
197
198         The current patch is already enough to make parsing the full standard library (something like 85k lines) approximately 260ms.
199         This is still longer than I would like, but nowhere near the bottleneck any longer because of some other parts of the compiler.
200
201         * Modules/webgpu/WHLSL/WHLSLLexer.h:
202         (WebCore::WHLSL::Lexer::Lexer):
203         (WebCore::WHLSL::Lexer::consumeToken):
204         (WebCore::WHLSL::Lexer::peek):
205         (WebCore::WHLSL::Lexer::peekFurther):
206         (WebCore::WHLSL::Lexer::state const):
207         (WebCore::WHLSL::Lexer::setState):
208         (WebCore::WHLSL::Lexer::unconsumeToken): Deleted.
209         * Modules/webgpu/WHLSL/WHLSLParser.cpp:
210         (WebCore::WHLSL::Parser::parse):
211         (WebCore::WHLSL::Parser::peek):
212         (WebCore::WHLSL::Parser::peekTypes):
213         (WebCore::WHLSL::Parser::tryType):
214         (WebCore::WHLSL::Parser::tryTypes):
215         (WebCore::WHLSL::Parser::consumeTypes):
216         (WebCore::WHLSL::Parser::parseConstantExpression):
217         (WebCore::WHLSL::Parser::parseTypeArgument):
218         (WebCore::WHLSL::Parser::parseTypeArguments):
219         (WebCore::WHLSL::Parser::parseTypeSuffixAbbreviated):
220         (WebCore::WHLSL::Parser::parseTypeSuffixNonAbbreviated):
221         (WebCore::WHLSL::Parser::parseType):
222         (WebCore::WHLSL::Parser::parseTypeDefinition):
223         (WebCore::WHLSL::Parser::parseResourceSemantic):
224         (WebCore::WHLSL::Parser::parseSpecializationConstantSemantic):
225         (WebCore::WHLSL::Parser::parseStageInOutSemantic):
226         (WebCore::WHLSL::Parser::parseSemantic):
227         (WebCore::WHLSL::Parser::parseQualifiers):
228         (WebCore::WHLSL::Parser::parseStructureElement):
229         (WebCore::WHLSL::Parser::parseStructureDefinition):
230         (WebCore::WHLSL::Parser::parseEnumerationDefinition):
231         (WebCore::WHLSL::Parser::parseEnumerationMember):
232         (WebCore::WHLSL::Parser::parseNativeTypeDeclaration):
233         (WebCore::WHLSL::Parser::parseNumThreadsFunctionAttribute):
234         (WebCore::WHLSL::Parser::parseAttributeBlock):
235         (WebCore::WHLSL::Parser::parseParameter):
236         (WebCore::WHLSL::Parser::parseParameters):
237         (WebCore::WHLSL::Parser::parseFunctionDefinition):
238         (WebCore::WHLSL::Parser::parseComputeFunctionDeclaration):
239         (WebCore::WHLSL::Parser::parseVertexFragmentFunctionDeclaration):
240         (WebCore::WHLSL::Parser::parseRegularFunctionDeclaration):
241         (WebCore::WHLSL::Parser::parseOperatorFunctionDeclaration):
242         (WebCore::WHLSL::Parser::parseFunctionDeclaration):
243         (WebCore::WHLSL::Parser::parseNativeFunctionDeclaration):
244         (WebCore::WHLSL::Parser::parseBlock):
245         (WebCore::WHLSL::Parser::parseBlockBody):
246         (WebCore::WHLSL::Parser::parseIfStatement):
247         (WebCore::WHLSL::Parser::parseSwitchStatement):
248         (WebCore::WHLSL::Parser::parseSwitchCase):
249         (WebCore::WHLSL::Parser::parseForLoop):
250         (WebCore::WHLSL::Parser::parseWhileLoop):
251         (WebCore::WHLSL::Parser::parseDoWhileLoop):
252         (WebCore::WHLSL::Parser::parseVariableDeclaration):
253         (WebCore::WHLSL::Parser::parseVariableDeclarations):
254         (WebCore::WHLSL::Parser::parseStatement):
255         (WebCore::WHLSL::Parser::parseEffectfulExpression):
256         (WebCore::WHLSL::Parser::parseEffectfulAssignment):
257         (WebCore::WHLSL::Parser::parseExpression):
258         (WebCore::WHLSL::Parser::parseTernaryConditional):
259         (WebCore::WHLSL::Parser::completeTernaryConditional):
260         (WebCore::WHLSL::Parser::parseAssignment):
261         (WebCore::WHLSL::Parser::completeAssignment):
262         (WebCore::WHLSL::Parser::parsePossibleTernaryConditional):
263         (WebCore::WHLSL::Parser::parsePossibleLogicalBinaryOperation):
264         (WebCore::WHLSL::Parser::completePossibleLogicalBinaryOperation):
265         (WebCore::WHLSL::Parser::parsePossibleRelationalBinaryOperation):
266         (WebCore::WHLSL::Parser::completePossibleRelationalBinaryOperation):
267         (WebCore::WHLSL::Parser::parsePossibleShift):
268         (WebCore::WHLSL::Parser::completePossibleShift):
269         (WebCore::WHLSL::Parser::parsePossibleAdd):
270         (WebCore::WHLSL::Parser::completePossibleAdd):
271         (WebCore::WHLSL::Parser::parsePossibleMultiply):
272         (WebCore::WHLSL::Parser::completePossibleMultiply):
273         (WebCore::WHLSL::Parser::parsePossiblePrefix):
274         (WebCore::WHLSL::Parser::parsePossibleSuffix):
275         (WebCore::WHLSL::Parser::parseCallExpression):
276         (WebCore::WHLSL::Parser::parseTerm):
277         (WebCore::WHLSL::Parser::parseAddressSpaceType): Deleted.
278         (WebCore::WHLSL::Parser::parseNonAddressSpaceType): Deleted.
279         (WebCore::WHLSL::Parser::parseEntryPointFunctionDeclaration): Deleted.
280         (WebCore::WHLSL::Parser::parseEffectfulPrefix): Deleted.
281         (WebCore::WHLSL::Parser::parseEffectfulSuffix): Deleted.
282         * Modules/webgpu/WHLSL/WHLSLParser.h:
283         (WebCore::WHLSL::Parser::Error::dump const):
284
285 2019-06-03  Youenn Fablet  <youenn@apple.com>
286
287         Allow resizing of camera video feeds to very small resolutions
288         https://bugs.webkit.org/show_bug.cgi?id=198421
289
290         Reviewed by Alex Christensen.
291
292         Before the patch, the minimum capture resolution was set to 120.
293         Since this is a bit arbitrary and there are some use cases for lower resolution,
294         We now allow down to 1x1 resolution.
295
296         Test: fast/mediastream/getUserMedia-video-rescaling.html
297
298         * platform/mediastream/RealtimeVideoSource.cpp:
299         (WebCore::RealtimeVideoSource::updateCapabilities):
300         Allow 1x1 when computing min/max resolutions.
301         (WebCore::RealtimeVideoSource::bestSupportedSizeAndFrameRate):
302         In case width and height are provided, we pick the closest preset that matches and resize accordingly.
303         If width or height is provided, we pick the closest preset tat matches and applies its aspect ratio.
304
305 2019-06-03  Wenson Hsieh  <wenson_hsieh@apple.com>
306
307         Implement an internal switch to turn idempotent text autosizing and viewport rules off
308         https://bugs.webkit.org/show_bug.cgi?id=198460
309         <rdar://problem/51324526>
310
311         Reviewed by Tim Horton.
312
313         Add a new WebCore setting for viewport shrink-to-fit-content heuristics; additionally, tweak the existing
314         idempotent text autosizing setting to default to false (this is overridden by preferences at the WebKit layer).
315
316         * page/Settings.yaml:
317
318 2019-06-03  Rob Buis  <rbuis@igalia.com>
319
320         Implement imagesrcset and imagesizes attributes on link rel=preload
321         https://bugs.webkit.org/show_bug.cgi?id=192950
322
323         Reviewed by Youenn Fablet.
324
325         Implement imagesrcset and imagesizes attributes for both Link header
326         and link element.
327
328         Tests: imported/w3c/web-platform-tests/preload/dynamic-adding-preload-imagesrcset.html
329                imported/w3c/web-platform-tests/preload/link-header-preload-imagesrcset.html
330                imported/w3c/web-platform-tests/preload/link-header-preload-nonce.html
331                imported/w3c/web-platform-tests/preload/link-header-preload.html
332                imported/w3c/web-platform-tests/preload/onload-event.html
333                imported/w3c/web-platform-tests/preload/preload-with-type.html
334
335         * html/HTMLAttributeNames.in:
336         * html/HTMLLinkElement.cpp:
337         (WebCore::HTMLLinkElement::process):
338         * html/HTMLLinkElement.idl:
339         * loader/LinkHeader.cpp:
340         (WebCore::paramterNameFromString):
341         (WebCore::LinkHeader::setValue):
342         (WebCore::LinkHeader::LinkHeader):
343         * loader/LinkHeader.h:
344         (WebCore::LinkHeader::imageSrcSet const):
345         (WebCore::LinkHeader::imageSizes const):
346         (WebCore::LinkHeader::isViewportDependent const):
347         * loader/LinkLoader.cpp:
348         (WebCore::LinkLoader::loadLinksFromHeader):
349         (WebCore::LinkLoader::preloadIfNeeded):
350         (WebCore::LinkLoader::loadLink):
351         * loader/LinkLoader.h:
352         * page/RuntimeEnabledFeatures.h:
353         (WebCore::RuntimeEnabledFeatures::linkPreloadResponsiveImagesEnabled const):
354         (WebCore::RuntimeEnabledFeatures::setLinkPreloadResponsiveImagesEnabled):
355
356 2019-06-02  Andy Estes  <aestes@apple.com>
357
358         Memory-cached main resources continue to load after the client decides a content policy of PolicyAction::Download
359         https://bugs.webkit.org/show_bug.cgi?id=198469
360         <rdar://problem/50512713>
361
362         Reviewed by Youenn Fablet.
363
364         When a document is loaded from the memory cache it does not have a main resource loader, but
365         DocumentLoader::continueAfterContentPolicy relies on being able to call
366         ResourceLoader::didFail on the main resource loader to cancel the provisional navigation
367         when the client decides a content policy of PolicyAction::Download.
368
369         This means that memory-cached main resources continue to load even after WebKit has started
370         to download the main resource. The expected behavior is for the provisional navigation to
371         fail once the download starts, like what happens when there is a main resource loader.
372
373         This patch teaches DocumentLoader::continueAfterContentPolicy to call
374         stopLoadingForPolicyChange() in the case of a null main resource loader. This will dispatch
375         didFailProvisionalNavigation and remove the DocumentLoader as a client of its
376         CachedRawResource to prevent it from delivering any cached data.
377
378         Added a new API test.
379
380         * loader/DocumentLoader.cpp:
381         (WebCore::DocumentLoader::continueAfterContentPolicy):
382
383 2019-06-03  Timothy Hatcher  <timothy@apple.com>
384
385         Tweak the text and underline color for data detected text.
386         https://bugs.webkit.org/show_bug.cgi?id=198487
387         rdar://problem/50667125
388
389         Reviewed by Devin Rousso.
390
391         Tests: Color.RGBToHSL API tests
392
393         * editing/cocoa/DataDetection.mm:
394         (WebCore::DataDetection::detectContentInRange): Use currentcolor so semantic text colors work.
395         Force the lightness of the underline color to the middle, and multiply the alpha by 38%,
396         so the color will appear on light and dark backgrounds, since only one color can be specified.
397         * platform/graphics/Color.cpp:
398         (WebCore::Color::getHSL const): Return hue in [0...6) range to easily round-trip with makeRGBAFromHSLA().
399
400 2019-06-03  Don Olmstead  <don.olmstead@sony.com>
401
402         [CMake] Add WebKit::JavaScriptCore target
403         https://bugs.webkit.org/show_bug.cgi?id=198403
404
405         Reviewed by Konstantin Tokarev.
406
407         Use the WebKit::JavaScriptCore target.
408
409         * CMakeLists.txt:
410
411 2019-06-03  Zan Dobersek  <zdobersek@igalia.com>
412
413         [Nicosia] Disable async scrolling until implemented
414         https://bugs.webkit.org/show_bug.cgi?id=198476
415         <rdar://problem/51351478>
416
417         Unreviewed follow-up to r246033.
418
419         * page/scrolling/ScrollingCoordinator.cpp:
420         Expand the PLATFORM(IOS) guard to IOS_FAMILY.
421
422 2019-06-03  Darin Adler  <darin@apple.com>
423
424         Finish cleanup of String::number for floating point
425         https://bugs.webkit.org/show_bug.cgi?id=198471
426
427         Reviewed by Yusuke Suzuki.
428
429         * css/CSSCursorImageValue.cpp:
430         (WebCore::CSSCursorImageValue::customCSSText const): Use makeString instead
431         of StringBuilder since it is more terse and possibly more efficient as well.
432         * css/DOMMatrixReadOnly.cpp:
433         (WebCore::DOMMatrixReadOnly::toString const): Ditto.
434         * css/WebKitCSSMatrix.cpp:
435         (WebCore::WebKitCSSMatrix::toString const): Ditto.
436
437         * html/parser/HTMLParserIdioms.cpp:
438         (WebCore::serializeForNumberType): Use String::number instead of
439         String::numberToStringECMAScript since that is now the default.
440         * html/shadow/MediaControlElementTypes.cpp:
441         (WebCore::MediaControlVolumeSliderElement::setVolume): Ditto.
442         * html/shadow/MediaControlElements.cpp:
443         (WebCore::MediaControlTimelineElement::setPosition): Ditto.
444         * platform/Decimal.cpp:
445         (WebCore::Decimal::fromDouble): Ditto.
446
447         * rendering/RenderListMarker.cpp:
448         (WebCore::toRoman): Return a String instead of taking a StringBuilder argument.
449         Use LetterCase enum instead of bool for the uppercase vs. lowercase argument, to
450         be less mysterious at call sites. Use unsigned for string lengths since that's
451         what WTF::String uses.
452         (WebCore::toAlphabeticOrNumeric): Ditto. Also updated since SequenceType is now
453         an enum class.
454         (WebCore::toSymbolic): Use String::createUninitialized instead of StringBuilder.
455         Return a String instead of taking a StringBuilder argument. Straighten out the
456         algorithm so it's easier to understand.
457         (WebCore::toAlphabetic): Updated since SequenceType is now an enum class.
458         (WebCore::toNumeric): Ditto.
459         (WebCore::toHebrew): Return a String instead of taking a StringBuilder argument.
460         Use unsigned for string lengths since that's what WTF::String uses.
461         (WebCore::toArmenianUnder10000): Use unsigned and the LetterCase enum class.
462         (WebCore::toArmenian): Return a String instead of taking a StringBuilder argument.
463         Also use unsigned for string lengths since that's what WTF::String uses.
464         (WebCore::toGeorgian): Ditto.
465         (WebCore::toCJKIdeographic): Ditto.
466         (WebCore::listMarkerSuffix): Tweaked a comment.
467         (WebCore::listMarkerText): Use String return values instead of StringBuilder.
468         (WebCore::RenderListMarker::paint): Use String::createUninitialized instead of
469         StringBuilder since it's a bit more efficient. Use makeString instead of turning
470         single characters into strings since that's more efficient.
471
472         * svg/SVGPathUtilities.cpp:
473         (WebCore::buildStringFromPath): Use appendNumber instead of appendShortestFormNumber
474         since that is now the default.
475
476 2019-06-03  Zan Dobersek  <zdobersek@igalia.com>
477
478         [Nicosia] Disable async scrolling until implemented
479         https://bugs.webkit.org/show_bug.cgi?id=198476
480
481         Reviewed by Antti Koivisto.
482
483         Build ScrollingCoordinator::create() method on iOS or whenever
484         ASYNC_SCROLLING is not enabled.
485
486         Additionally, the USE(COORDINATED_GRAPHICS) build guards are removed
487         throughout the async scrolling classes as they aren't required now
488         and shouldn't be in the future.
489
490         * page/scrolling/ScrollingCoordinator.cpp:
491         * page/scrolling/ScrollingStateFixedNode.cpp:
492         * page/scrolling/ScrollingStateFixedNode.h:
493         * page/scrolling/ScrollingStateFrameHostingNode.cpp:
494         * page/scrolling/ScrollingStateFrameHostingNode.h:
495         * page/scrolling/ScrollingStateFrameScrollingNode.cpp:
496         * page/scrolling/ScrollingStateFrameScrollingNode.h:
497         * page/scrolling/ScrollingStateNode.cpp:
498         * page/scrolling/ScrollingStateNode.h:
499         * page/scrolling/ScrollingStateOverflowScrollingNode.cpp:
500         * page/scrolling/ScrollingStateOverflowScrollingNode.h:
501         * page/scrolling/ScrollingStatePositionedNode.cpp:
502         * page/scrolling/ScrollingStatePositionedNode.h:
503         * page/scrolling/ScrollingStateScrollingNode.cpp:
504         * page/scrolling/ScrollingStateScrollingNode.h:
505         * page/scrolling/ScrollingStateStickyNode.cpp:
506         * page/scrolling/ScrollingStateStickyNode.h:
507         * page/scrolling/ScrollingStateTree.cpp:
508         * page/scrolling/ScrollingStateTree.h:
509
510 2019-06-03  Antoine Quint  <graouts@apple.com>
511
512         [Pointer Events] Check that capturing data managed by the PointerCaptureController gets cleared upon navigation
513         https://bugs.webkit.org/show_bug.cgi?id=198191
514
515         Unreviewed post-commit review feedback suggested by Darin Adler.
516
517         * page/PointerCaptureController.cpp:
518         (WebCore::PointerCaptureController::reset):
519
520 2019-06-01  Simon Fraser  <simon.fraser@apple.com>
521
522         [Async overflow scroll] Flashing content when scrolling async overflow with a negative z-index child
523         https://bugs.webkit.org/show_bug.cgi?id=198458
524
525         Reviewed by Dean Jackson.
526
527         Set the GraphicsLayerPaintOverflowContents phase on the foreground layer in a composited overflow scroller,
528         which prevents clipping to the visible region, fixing scrolling flashes.
529
530         Tested by compositing/overflow/stacking-context-composited-scroller-with-foreground-paint-phases.html
531
532         * rendering/RenderLayerBacking.cpp:
533         (WebCore::RenderLayerBacking::updatePaintingPhases):
534
535 2019-06-01  Simon Fraser  <simon.fraser@apple.com>
536
537         Async overflow scroll on iOS paints slowly if it has a negative z-index child
538         https://bugs.webkit.org/show_bug.cgi?id=196508
539         rdar://problem/49532709
540
541         Reviewed by Dean Jackson.
542         
543         If a RenderLayerBacking had a foreground layer and a scrolled contents layer, every geometry
544         update would change the size and offsetFromRenderer of the foreground layer between two
545         states, triggering repaint.
546
547         Fix by updating the fore- and background-layers last (nothing elese has dependencies
548         on their geometry), and using GraphicsLayer::DontSetNeedsDisplay as we do for the
549         scrolled contents layer.
550         
551         The test also revealed a bug where the shapeMaskLayer would get incorrect geometry when scrollbars
552         were visible, because it would be squished by setting the wrong bounds, so fix that.
553
554         Test: compositing/repaint/scroller-with-foreground-layer-repaints.html
555
556         * platform/graphics/ca/GraphicsLayerCA.cpp:
557         (WebCore::GraphicsLayerCA::updateClippingStrategy):
558         * rendering/RenderLayerBacking.cpp:
559         (WebCore::RenderLayerBacking::updateGeometry):
560
561 2019-06-01  Simon Fraser  <simon.fraser@apple.com>
562
563         Non-composited negative z-order children should not trigger creation of a foreground layer
564         https://bugs.webkit.org/show_bug.cgi?id=198455
565
566         Reviewed by Sam Weinig.
567
568         The existing code triggered creation of a foreground layer on RenderLayerBacking when
569         the negative z-order list was non-empty. This isn't necessary; we can paint the negative
570         z-order children just fine.
571
572         We only need a foreground layer when the negative z-order layers are composited or
573         have composited descendants.
574
575         This will reduce backing store memory use in some cases.
576
577         Test: compositing/layer-creation/composited-negative-z-subtree.html
578
579         * rendering/RenderLayerCompositor.cpp:
580         (WebCore::RenderLayerCompositor::computeCompositingRequirements):
581         (WebCore::RenderLayerCompositor::updateBackingAndHierarchy):
582         (WebCore::RenderLayerCompositor::needsContentsCompositingLayer const):
583
584 2019-06-01  Andy Estes  <aestes@apple.com>
585
586         [Apple Pay] Every PaymentCoordinator client should explicitly decide whether they support unrestricted Apple Pay
587         https://bugs.webkit.org/show_bug.cgi?id=198449
588         <rdar://problem/51038583>
589
590         Reviewed by Wenson Hsieh.
591
592         Rather than having a default return value of true for
593         PaymentCoordinatorClient::supportsUnrestrictedApplePay, make it pure virtual to force each
594         subclass to implement an override and explicitly choose an appropriate return value.
595
596         The only two clients that did not explicitly override were the empty client and
597         WebKitLegacy's client, and Apple Pay was never enabled in those clients, so there is no
598         change in behavior.
599
600         * Modules/applepay/PaymentCoordinatorClient.h:
601         (WebCore::PaymentCoordinatorClient::isAlwaysOnLoggingAllowed const):
602         (WebCore::PaymentCoordinatorClient::supportsUnrestrictedApplePay const): Deleted.
603         * loader/EmptyClients.cpp:
604
605 2019-05-31  Youenn Fablet  <youenn@apple.com>
606
607         Add an option to mute audio capture automatically when page is not visible
608         https://bugs.webkit.org/show_bug.cgi?id=198307
609
610         Reviewed by Eric Carlson.
611
612         Reuse video capture mechanism for audio capture.
613         In case document gets in the background, interrupt the audio track if the audio factory requires it.
614         CoreAudioCaptureSourceIOS requires the audio source be interrupted if the app has not the right background mode.
615         It also allows interrupting the audio capture based on a runtime flag.
616
617         Add a runtime flag to control this.
618         Internals API is used to set it for test purposes, off by default.
619         For regular cases, the runtime flag is set through web preferences.
620
621         Test: platform/ios/mediastream/audio-muted-in-background-tab.html
622
623         * dom/Document.cpp:
624         (WebCore::Document::notifyMediaCaptureOfVisibilityChanged):
625         * page/RuntimeEnabledFeatures.h:
626         (WebCore::RuntimeEnabledFeatures::interruptAudioOnPageVisibilityChangeEnabled const):
627         (WebCore::RuntimeEnabledFeatures::setInterruptAudioOnPageVisibilityChangeEnabled):
628         * platform/mediastream/RealtimeMediaSourceCenter.cpp:
629         (WebCore::RealtimeMediaSourceCenter::RealtimeMediaSourceCenter):
630         (WebCore::RealtimeMediaSourceCenter::initializeShouldInterruptAudioOnPageVisibilityChange):
631         (WebCore::RealtimeMediaSourceCenter::setCapturePageState):
632         (WebCore::RealtimeMediaSourceCenter::visibilityDidChange):
633         * platform/mediastream/RealtimeMediaSourceCenter.h:
634         (WebCore::RealtimeMediaSourceCenter::shouldInterruptAudioOnPageVisibilityChange):
635         * platform/mediastream/RealtimeMediaSourceFactory.h:
636         (WebCore::AudioCaptureFactory::setAudioCapturePageState):
637         (WebCore::VideoCaptureFactory::setVideoCapturePageState):
638         * platform/mediastream/ios/CoreAudioCaptureSourceIOS.h:
639         * platform/mediastream/ios/CoreAudioCaptureSourceIOS.mm:
640         (WebCore::CoreAudioCaptureSourceFactory::setAudioCapturePageState):
641         (WebCore::CoreAudioCaptureSourceFactoryIOS::shouldInterruptAudioOnPageVisibilityChange):
642         * platform/mediastream/mac/CoreAudioCaptureSource.h:
643         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp:
644         (WebCore::RealtimeMediaSourceCenter::initializeShouldInterruptAudioOnPageVisibilityChange):
645         * testing/Internals.cpp:
646         (WebCore::Internals::resetToConsistentState):
647         (WebCore::Internals::setShouldInterruptAudioOnPageVisibilityChange):
648         * testing/Internals.h:
649         * testing/Internals.idl:
650
651 2019-05-31  Geoffrey Garen  <ggaren@apple.com>
652
653         Some WeakPtr typedef cleanup
654         https://bugs.webkit.org/show_bug.cgi?id=198431
655
656         Reviewed by Chris Dumez.
657
658         Use "using" instead of "typedef", since using is preferred in C++ for
659         better compatibility with templates.
660
661         * Modules/indexeddb/shared/InProcessIDBServer.h:
662         * html/HTMLMediaElement.h:
663         * platform/ScrollView.h:
664
665 2019-05-31  Andres Gonzalez  <andresg_22@apple.com>
666
667         Inserting a newline in contenteditable causes two characters to be added instead of one
668         https://bugs.webkit.org/show_bug.cgi?id=197894
669         <rdar://problems/49700998>
670
671         Reviewed by Chris Fleizach.
672
673         No new test is necessary since this is a comment change.
674
675         Removed radar reference from code.
676
677         * editing/Editing.cpp:
678         (WebCore::visiblePositionForIndexUsingCharacterIterator):
679
680 2019-05-31  Tim Horton  <timothy_horton@apple.com>
681
682         Optionally respect device management restrictions when loading from the network
683         https://bugs.webkit.org/show_bug.cgi?id=198318
684         <rdar://problem/44263806>
685
686         Reviewed by Alex Christensen.
687
688         * en.lproj/Localizable.strings:
689
690 2019-05-31  Simon Fraser  <simon.fraser@apple.com>
691
692         Move code that sets compositing paint phases into a single function
693         https://bugs.webkit.org/show_bug.cgi?id=198420
694
695         Reviewed by Zalan Bujtas.
696
697         To compute the correct paint phases for the various GraphicsLayers in a RenderLayerBacking,
698         we have to know which set of layers we've created (m_scrollContainerLayer, m_foregroundLayer etc).
699         So move the code that sets phases into a single function which is called when that
700         set of layers changes.
701
702         The test dumps paint phases for a stacking-context-composited scroller with a negative z-index child.
703
704         Also have GraphicsLayer::setPaintingPhase() trigger the necessary repaint when the paint phase changes.
705
706         Test: compositing/overflow/stacking-context-composited-scroller-with-foreground-paint-phases.html
707
708         * platform/graphics/GraphicsLayer.cpp:
709         (WebCore::GraphicsLayer::setPaintingPhase):
710         * platform/graphics/GraphicsLayer.h:
711         (WebCore::GraphicsLayer::setPaintingPhase): Deleted.
712         * rendering/RenderLayerBacking.cpp:
713         (WebCore::RenderLayerBacking::updateConfiguration):
714         (WebCore::RenderLayerBacking::updateForegroundLayer):
715         (WebCore::RenderLayerBacking::updateBackgroundLayer):
716         (WebCore::RenderLayerBacking::updateMaskingLayer):
717         (WebCore::RenderLayerBacking::updateScrollingLayers):
718         (WebCore::RenderLayerBacking::updatePaintingPhases):
719         (WebCore::RenderLayerBacking::paintingPhaseForPrimaryLayer const): Deleted.
720         * rendering/RenderLayerBacking.h:
721
722 2019-05-31  Saam Barati  <sbarati@apple.com>
723
724         [WHLSL] Make sure we properly emit code for "&*x"
725         https://bugs.webkit.org/show_bug.cgi?id=198198
726
727         Reviewed by Myles C. Maxfield.
728
729         I ran into this when trying to test zero-filling code, so let's just fix it.
730         The issue is that the property resolver ends up emitting code that looks like
731         "&*x". The semantics of this are such that it should result in just x.
732         However, we emitted Metal code in such a way where we'd end up with a pointer
733         to a temporary value. To fix this, DereferenceExpression will emit code that results
734         in a reference type. Then, MakePointerExpression will correctly return the
735         pointer backing that reference type.
736         
737         Because of this, we also no longer need to pattern match the lhs of assignment
738         expressions since we will now be assigning to a reference type.
739
740         Test: webgpu/whlsl-store-to-property-updates-properly.html
741
742         * Modules/webgpu/WHLSL/Metal/WHLSLFunctionWriter.cpp:
743         (WebCore::WHLSL::Metal::FunctionDefinitionWriter::visit):
744
745 2019-05-31  Simon Fraser  <simon.fraser@apple.com>
746
747         [Async overflow scrolling] Flashes of missing layer backing store when scrolling an overflow
748         https://bugs.webkit.org/show_bug.cgi?id=198363
749
750         Reviewed by Tim Horton.
751
752         When the contents of an overflow:scroll did not use a tiled backing layer, GraphicsLayerCA::adjustCoverageRect()
753         would do no coverage rect expansion for scrolling, which meant that backing store attachment for
754         descendant layers would just use the visible rect from their scrolling ancestor which made it easy
755         to scroll into view a layer whose backing store was not yet attached.
756         
757         Since this only affects non-tiled layers, re-use the generic TileController::adjustTileCoverageRect()
758         code by moving it down to GraphicsLayer, and call it for a scrolled contents layer which does not
759         have tiled backing.
760         
761         Tested by fast/scrolling/ios/reconcile-layer-position-recursive.html
762
763         * platform/graphics/GraphicsLayer.cpp:
764         (WebCore::GraphicsLayer::adjustCoverageRectForMovement):
765         * platform/graphics/GraphicsLayer.h:
766         * platform/graphics/ca/GraphicsLayerCA.cpp:
767         (WebCore::GraphicsLayerCA::adjustCoverageRect const):
768         * platform/graphics/ca/TileController.cpp:
769         (WebCore::TileController::adjustTileCoverageRect):
770
771 2019-05-31  Geoffrey Garen  <ggaren@apple.com>
772
773         Some WeakPtr cleanup
774         https://bugs.webkit.org/show_bug.cgi?id=198390
775
776         Reviewed by Chris Dumez.
777
778         * Modules/indexeddb/shared/InProcessIDBServer.cpp:
779         (WebCore::storageQuotaManagerGetter): Dereference the weak pointer
780         directly instead of using a weak pointer to guard a raw pointer. It's
781         safer and more idiomatic to use weak pointers directly.
782
783         * Modules/indexeddb/shared/InProcessIDBServer.h: Use our base clase
784         weakPtrFactory() definition instead of writing our own. Declare
785         WeakValueType so we can dereference the weak pointer we create (above).
786
787 2019-05-31  Zalan Bujtas  <zalan@apple.com>
788
789         [LFC][IFC] InlineFormattingContext::LineLayout::processInlineItemsForLine should create and destroy Line.
790         https://bugs.webkit.org/show_bug.cgi?id=198419
791         <rdar://problem/51300837>
792
793         Reviewed by Antti Koivisto.
794
795         This is in preparation for using "createInlineRunsForLine" logic when computing preferred width.
796         1. Line object is now constructed and destroyed in processInlineItemsForLine (caller does not need to know about Line).
797         2. processInlineItemsForLine returns a Line::Content instance.
798
799         * layout/inlineformatting/InlineFormattingContext.h:
800         * layout/inlineformatting/InlineFormattingContextLineLayout.cpp:
801         (WebCore::Layout::InlineFormattingContext::LineLayout::LineInput::LineInput):
802         (WebCore::Layout::constructLine):
803         (WebCore::Layout::InlineFormattingContext::LineLayout::processInlineItemsForLine const):
804         (WebCore::Layout::InlineFormattingContext::LineLayout::layout const):
805         (WebCore::Layout::InlineFormattingContext::LineLayout::createDisplayRuns const):
806         (WebCore::Layout::InlineFormattingContext::LineLayout::createLine const): Deleted.
807         (WebCore::Layout::InlineFormattingContext::LineLayout::createInlineRunsForLine const): Deleted.
808         (WebCore::Layout::InlineFormattingContext::LineLayout::processInlineRuns const): Deleted.
809
810 2019-05-31  Don Olmstead  <don.olmstead@sony.com>
811
812         [CMake] Add WebKit::WTF target
813         https://bugs.webkit.org/show_bug.cgi?id=198400
814
815         Reviewed by Konstantin Tokarev.
816
817         Use the WebKit::WTF target.
818
819         * PlatformWin.cmake:
820
821 2019-05-31  Joonghun Park  <jh718.park@samsung.com>
822
823         Always min-width should win over max-width.
824         https://bugs.webkit.org/show_bug.cgi?id=198032
825
826         Reviewed by Darin Adler.
827
828         In the spec, https://www.w3.org/TR/CSS21/visudet.html#min-max-widths,
829         the following algorithm describes how the two properties influence
830         the used value of the 'width' property.
831
832         1. The tentative used width is calculated (without 'min-width' and 'max-width')
833         following the rules under "Calculating widths and margins" above.
834         2. If the tentative used width is greater than 'max-width',
835         the rules above are applied again, but this time using the computed value of 'max-width'
836         as the computed value for 'width'.
837         3. If the resulting width is smaller than 'min-width', the rules above are applied again,
838         but this time using the value of 'min-width' as the computed value for 'width'.
839
840         * rendering/RenderBlock.cpp:
841         (WebCore::RenderBlock::computePreferredLogicalWidths):
842
843 2019-05-31  Ryan Haddad  <ryanhaddad@apple.com>
844
845         Unreviewed, rolling out r245946.
846
847         Breaks the watchOS build.
848
849         Reverted changeset:
850
851         "Add an option to mute audio capture automatically when page
852         is not visible"
853         https://bugs.webkit.org/show_bug.cgi?id=198307
854         https://trac.webkit.org/changeset/245946
855
856 2019-05-31  Zalan Bujtas  <zalan@apple.com>
857
858         [LFC[IFC] Do not reuse the same Line object.
859         https://bugs.webkit.org/show_bug.cgi?id=198366
860         <rdar://problem/51250279>
861
862         Reviewed by Antti Koivisto.
863
864         This is in preparation for constructing Line inside createInlineRunsForLine and return Line::Content. 
865
866         * layout/inlineformatting/InlineFormattingContext.h:
867         * layout/inlineformatting/InlineFormattingContextLineLayout.cpp:
868         (WebCore::Layout::InlineFormattingContext::LineLayout::createLine const):
869         (WebCore::Layout::InlineFormattingContext::LineLayout::layout const):
870         (WebCore::Layout::InlineFormattingContext::LineLayout::processInlineRuns const):
871         (WebCore::Layout::InlineFormattingContext::LineLayout::initializeLine const): Deleted.
872         * layout/inlineformatting/InlineLine.cpp:
873         (WebCore::Layout::Line::Line):
874         (WebCore::Layout::m_lineLogicalWidth):
875         (WebCore::Layout::Line::close):
876         (WebCore::Layout::Line::moveLogicalLeft):
877         (WebCore::Layout::Line::appendNonBreakableSpace):
878         (WebCore::Layout::Line::appendTextContent):
879         (WebCore::Layout::Line::appendNonReplacedInlineBox):
880         (WebCore::Layout::Line::appendHardLineBreak):
881         (WebCore::Layout::Line::reset): Deleted.
882         * layout/inlineformatting/InlineLine.h:
883         (WebCore::Layout::Line::hasContent const):
884
885 2019-05-31  Zalan Bujtas  <zalan@apple.com>
886
887         [LFC][IFC] Move final runs to a dedicated class (Line::Content)
888         https://bugs.webkit.org/show_bug.cgi?id=198360
889         <rdar://problem/51247717>
890
891         Reviewed by Antti Koivisto.
892
893         It decouples the line and the final line content. So when we process the runs after closing the line,
894         LineContent should be able to answer all the content and geometry related questions.
895         This is also in preparation for
896         transfering the ownership of the line content when calling Line::close(). 
897
898         * WebCore.xcodeproj/project.pbxproj:
899         * layout/inlineformatting/InlineFormattingContextLineLayout.cpp:
900         (WebCore::Layout::InlineFormattingContext::LineLayout::processInlineRuns const):
901         * layout/inlineformatting/InlineLine.cpp:
902         (WebCore::Layout::Line::Content::isVisuallyEmpty const):
903         (WebCore::Layout::Line::Content::Run::Run):
904         (WebCore::Layout::Line::reset):
905         (WebCore::Layout::Line::close):
906         (WebCore::Layout::Line::moveLogicalLeft):
907         (WebCore::Layout::Line::appendNonBreakableSpace):
908         (WebCore::Layout::Line::appendTextContent):
909         (WebCore::Layout::Line::appendNonReplacedInlineBox):
910         (WebCore::Layout::Line::appendHardLineBreak):
911         (WebCore::Layout::Line::LineItem::LineItem): Deleted.
912         (WebCore::Layout::Line::hasContent const): Deleted.
913         * layout/inlineformatting/InlineLine.h:
914         (WebCore::Layout::Line::Content::runs const):
915         (WebCore::Layout::Line::Content::isEmpty const):
916         (WebCore::Layout::Line::Content::logicalTop const):
917         (WebCore::Layout::Line::Content::logicalLeft const):
918         (WebCore::Layout::Line::Content::logicalRight const):
919         (WebCore::Layout::Line::Content::logicalBottom const):
920         (WebCore::Layout::Line::Content::logicalWidth const):
921         (WebCore::Layout::Line::Content::logicalHeight const):
922         (WebCore::Layout::Line::Content::setLogicalRect):
923         (WebCore::Layout::Line::Content::runs):
924         (WebCore::Layout::Line::hasContent const):
925         (WebCore::Layout::Line::availableWidth const):
926         (WebCore::Layout::Line::contentLogicalRight const):
927         (WebCore::Layout::Line::logicalTop const):
928         (WebCore::Layout::Line::logicalBottom const):
929         (WebCore::Layout::Line::logicalLeft const):
930         (WebCore::Layout::Line::logicalRight const):
931         (WebCore::Layout::Line::logicalWidth const):
932         (WebCore::Layout::Line::logicalHeight const):
933         (WebCore::Layout::Line::contentLogicalWidth const):
934         * page/FrameViewLayoutContext.cpp:
935         (WebCore::layoutUsingFormattingContext):
936
937 2019-05-31  Joonghun Park  <jh718.park@samsung.com>
938
939         Unreviewed. Fix typo of |ComputedStyleExtractor::valueForPropertyInStyle|
940         to follow camel case function naming style.
941
942         No behavioral changes.
943
944         * animation/KeyframeEffect.cpp:
945         (WebCore::KeyframeEffect::getKeyframes):
946         * css/CSSComputedStyleDeclaration.cpp:
947         (WebCore::ComputedStyleExtractor::propertyValue):
948         (WebCore::ComputedStyleExtractor::valueForPropertyInStyle):
949         (WebCore::ComputedStyleExtractor::valueForPropertyinStyle): Deleted.
950         * css/CSSComputedStyleDeclaration.h:
951         * rendering/style/RenderStyle.cpp:
952         (WebCore::changedCustomPaintWatchedProperty):
953
954 2019-05-31  Ali Juma  <ajuma@chromium.org>
955
956         REGRESSION (r245396): Page load time performance regression
957         https://bugs.webkit.org/show_bug.cgi?id=198382
958
959         Reviewed by Simon Fraser.
960
961         Delay the scheduling of a rendering update by 500ms when a new
962         IntersectionObserver target is added during page load. This addresses
963         a page load time regression from r245396, which immediately scheduled a
964         rendering update when a target is added. Note that even with this change,
965         if anything else triggers a rendering update before the 500ms delay expires,
966         intersection observations will be updated during that rendering update.
967
968         Covered by intersection-observer/initial-observation.html 
969
970         * dom/Document.cpp:
971         (WebCore::Document::updateIntersectionObservations):
972         (WebCore::Document::scheduleInitialIntersectionObservationUpdate):
973         * dom/Document.h:
974         * page/IntersectionObserver.cpp:
975         (WebCore::IntersectionObserver::observe):
976
977 2019-05-30  Zan Dobersek  <zdobersek@igalia.com>
978
979         Unreviewed. Suppress -Wunused-variable warnings for the unused static
980         mousePointerID variable by making it a constexpr.
981
982         * platform/PointerID.h:
983
984 2019-05-30  Simon Fraser  <simon.fraser@apple.com>
985
986         Use an OptionSet<> for GraphicsLayerPaintingPhase
987         https://bugs.webkit.org/show_bug.cgi?id=198404
988
989         Reviewed by Tim Horton.
990
991         Replace GraphicsLayerPaintingPhase with OptionSet<GraphicsLayerPaintingPhase>.
992
993         No behavior change.
994
995         * page/PageOverlayController.cpp:
996         (WebCore::PageOverlayController::setPageOverlayNeedsDisplay):
997         (WebCore::PageOverlayController::paintContents):
998         (WebCore::PageOverlayController::notifyFlushRequired):
999         * page/PageOverlayController.h:
1000         * page/linux/ResourceUsageOverlayLinux.cpp:
1001         * page/mac/ServicesOverlayController.h:
1002         * page/mac/ServicesOverlayController.mm:
1003         (WebCore::ServicesOverlayController::Highlight::paintContents):
1004         * platform/graphics/GraphicsLayer.cpp:
1005         (WebCore::GraphicsLayer::dumpProperties const):
1006         * platform/graphics/GraphicsLayer.h:
1007         (WebCore::GraphicsLayer::paintingPhase const):
1008         (WebCore::GraphicsLayer::setPaintingPhase):
1009         * platform/graphics/GraphicsLayerClient.h:
1010         (WebCore::GraphicsLayerClient::paintContents):
1011         * rendering/RenderLayerBacking.cpp:
1012         (WebCore::RenderLayerBacking::updateForegroundLayer):
1013         (WebCore::RenderLayerBacking::updateBackgroundLayer):
1014         (WebCore::RenderLayerBacking::updateMaskingLayer):
1015         (WebCore::RenderLayerBacking::updateChildClippingStrategy):
1016         (WebCore::RenderLayerBacking::updateScrollingLayers):
1017         (WebCore::RenderLayerBacking::paintingPhaseForPrimaryLayer const):
1018         (WebCore::RenderLayerBacking::paintIntoLayer):
1019         (WebCore::RenderLayerBacking::paintContents):
1020         * rendering/RenderLayerBacking.h:
1021         * rendering/RenderLayerCompositor.cpp:
1022         (WebCore::RenderLayerCompositor::paintContents):
1023         * rendering/RenderLayerCompositor.h:
1024
1025 2019-05-30  Youenn Fablet  <youenn@apple.com>
1026
1027         Fix AVVideoCaptureSource::setFrameRateWithPreset logging
1028         https://bugs.webkit.org/show_bug.cgi?id=198392
1029
1030         Reviewed by Eric Carlson.
1031
1032         Move logging from setFrameRateWithPreset to setSessionSizeAndFrameRate which does the actual job.
1033         This ensures to not log in case of preset being null.
1034         No change of behavior.
1035
1036         * platform/mediastream/mac/AVVideoCaptureSource.mm:
1037         (WebCore::AVVideoCaptureSource::setFrameRateWithPreset):
1038         (WebCore::AVVideoCaptureSource::setSessionSizeAndFrameRate):
1039
1040 2019-05-30  Jer Noble  <jer.noble@apple.com>
1041
1042         Video playback in Safari should continue when CarPlay is plugged in
1043         https://bugs.webkit.org/show_bug.cgi?id=198345
1044         <rdar://problem/45505750>
1045
1046         Reviewed by Eric Carlson.
1047
1048         Test: media/video-isplayingtoautomotiveheadunit.html
1049
1050         * html/HTMLMediaElement.cpp:
1051         (WebCore::HTMLMediaElement::shouldOverrideBackgroundPlaybackRestriction const):
1052         * platform/audio/PlatformMediaSessionManager.cpp:
1053         (WebCore::PlatformMediaSessionManager::setIsPlayingToAutomotiveHeadUnit):
1054         * platform/audio/PlatformMediaSessionManager.h:
1055         (WebCore::PlatformMediaSessionManager::isPlayingToAutomotiveHeadUnit const):
1056         * platform/audio/ios/MediaSessionManagerIOS.h:
1057         * platform/audio/ios/MediaSessionManagerIOS.mm:
1058         (WebCore::MediaSessionManageriOS::MediaSessionManageriOS):
1059         (WebCore::MediaSessionManageriOS::carPlayServerDied):
1060         (WebCore::MediaSessionManageriOS::updateCarPlayIsConnected):
1061         (-[WebMediaSessionHelper initWithCallback:]):
1062         (-[WebMediaSessionHelper startMonitoringAirPlayRoutes]):
1063         (-[WebMediaSessionHelper interruption:]):
1064         (-[WebMediaSessionHelper applicationWillEnterForeground:]):
1065         (-[WebMediaSessionHelper applicationDidBecomeActive:]):
1066         (-[WebMediaSessionHelper applicationWillResignActive:]):
1067         (-[WebMediaSessionHelper wirelessRoutesAvailableDidChange:]):
1068         (-[WebMediaSessionHelper applicationDidEnterBackground:]):
1069         (-[WebMediaSessionHelper carPlayServerDied:]):
1070         (-[WebMediaSessionHelper carPlayIsConnectedDidChange:]):
1071         * testing/Internals.cpp:
1072         (WebCore::Internals::resetToConsistentState):
1073         (WebCore::Internals::setIsPlayingToAutomotiveHeadUnit):
1074         * testing/Internals.h:
1075         * testing/Internals.idl:
1076
1077 2019-05-30  Youenn Fablet  <youenn@apple.com>
1078
1079         Add an option to mute audio capture automatically when page is not visible
1080         https://bugs.webkit.org/show_bug.cgi?id=198307
1081
1082         Reviewed by Eric Carlson.
1083
1084         Reuse video capture mechanism for audio capture.
1085         In case document gets in the background, interrupt the audio track if the audio factory requires it.
1086         CoreAudioCaptureSourceIOS requires the audio source be interrupted if the app has not the right background mode.
1087         It also allows interrupting the audio capture based on a runtime flag.
1088
1089         Add a runtime flag to control this.
1090         Internals API is used to set it for test purposes, off by default.
1091         For regular cases, the runtime flag is set through web preferences.
1092
1093         Test: platform/ios/mediastream/audio-muted-in-background-tab.html
1094
1095         * dom/Document.cpp:
1096         (WebCore::Document::notifyMediaCaptureOfVisibilityChanged):
1097         * page/RuntimeEnabledFeatures.h:
1098         (WebCore::RuntimeEnabledFeatures::interruptAudioOnPageVisibilityChangeEnabled const):
1099         (WebCore::RuntimeEnabledFeatures::setInterruptAudioOnPageVisibilityChangeEnabled):
1100         * platform/mediastream/RealtimeMediaSourceCenter.cpp:
1101         (WebCore::RealtimeMediaSourceCenter::RealtimeMediaSourceCenter):
1102         (WebCore::RealtimeMediaSourceCenter::initializeShouldInterruptAudioOnPageVisibilityChange):
1103         (WebCore::RealtimeMediaSourceCenter::setCapturePageState):
1104         (WebCore::RealtimeMediaSourceCenter::visibilityDidChange):
1105         * platform/mediastream/RealtimeMediaSourceCenter.h:
1106         (WebCore::RealtimeMediaSourceCenter::shouldInterruptAudioOnPageVisibilityChange):
1107         * platform/mediastream/RealtimeMediaSourceFactory.h:
1108         (WebCore::AudioCaptureFactory::setAudioCapturePageState):
1109         (WebCore::VideoCaptureFactory::setVideoCapturePageState):
1110         * platform/mediastream/ios/CoreAudioCaptureSourceIOS.h:
1111         * platform/mediastream/ios/CoreAudioCaptureSourceIOS.mm:
1112         (WebCore::CoreAudioCaptureSourceFactory::setAudioCapturePageState):
1113         (WebCore::CoreAudioCaptureSourceFactoryIOS::shouldInterruptAudioOnPageVisibilityChange):
1114         * platform/mediastream/mac/CoreAudioCaptureSource.h:
1115         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp:
1116         (WebCore::RealtimeMediaSourceCenter::initializeShouldInterruptAudioOnPageVisibilityChange):
1117         * testing/Internals.cpp:
1118         (WebCore::Internals::resetToConsistentState):
1119         (WebCore::Internals::setShouldInterruptAudioOnPageVisibilityChange):
1120         * testing/Internals.h:
1121         * testing/Internals.idl:
1122
1123 2019-05-30  Saam Barati  <sbarati@apple.com>
1124
1125         [WHLSL] Enforce variable lifetimes
1126         https://bugs.webkit.org/show_bug.cgi?id=195794
1127         <rdar://problem/50746293>
1128
1129         Reviewed by Myles C. Maxfield.
1130
1131         In WHLSL, each variable has global lifetime. So returning a pointer to a
1132         local variable is a legitimate and well specified thing to do. Each local
1133         variable has a unique place in memory. So, for example:
1134         
1135         ```
1136         thread int* ptr() { int local; return &local; }
1137         thread int* ptrPtr() { return ptr(); }
1138         ```
1139         
1140         In the above program, ptr() must always return the same value
1141         as ptrPtr(). So, the following would print "42":
1142         ```
1143         thread int* p = ptrPtr();
1144         *ptr() = 42;
1145         print(*p);
1146         ```
1147         
1148         To implement these semantics, this patch introduces a new pass which does the
1149         following transformations:
1150         - It notes every variable whose address is taken in the program.
1151         - Each such variable gets defined as a field in a struct.
1152         - Each function which is an entry point defines this struct.
1153         - Each non entry point takes a pointer to this struct as its final parameter.
1154         - Each call to a non-native function is rewritten to pass a pointer to the
1155           struct as the last call argument.
1156         - Each variable reference to "x", where "x" ends up in the struct, is
1157           modified to instead be "struct->x". We store to "struct->x" after declaring
1158           "x". If "x" is a function parameter, we store to "struct->x" as the first
1159           thing we do in the function body.
1160
1161         Tests: webgpu/whlsl-ensure-proper-variable-lifetime-2.html
1162                webgpu/whlsl-ensure-proper-variable-lifetime-3.html
1163                webgpu/whlsl-ensure-proper-variable-lifetime.html
1164                webgpu/whlsl-return-local-variable.html
1165
1166         * Modules/webgpu/WHLSL/AST/WHLSLAST.h:
1167         * Modules/webgpu/WHLSL/AST/WHLSLExpression.h:
1168         (WebCore::WHLSL::AST::Expression::Expression):
1169         (WebCore::WHLSL::AST::Expression::isGlobalVariableReference const):
1170         (WebCore::WHLSL::AST::Expression::origin const): Deleted.
1171         * Modules/webgpu/WHLSL/AST/WHLSLFunctionDeclaration.h:
1172         (WebCore::WHLSL::AST::FunctionDeclaration::origin):
1173         * Modules/webgpu/WHLSL/AST/WHLSLGlobalVariableReference.h: Added.
1174         (WebCore::WHLSL::AST::GlobalVariableReference::GlobalVariableReference):
1175         (WebCore::WHLSL::AST::GlobalVariableReference::structField):
1176         (WebCore::WHLSL::AST::GlobalVariableReference::base):
1177         * Modules/webgpu/WHLSL/AST/WHLSLStatement.h:
1178         (WebCore::WHLSL::AST::Statement::Statement):
1179         (WebCore::WHLSL::AST::Statement::isStatementList const):
1180         (WebCore::WHLSL::AST::Statement::isWhileLoop const):
1181         * Modules/webgpu/WHLSL/AST/WHLSLStatementList.h: Added.
1182         (WebCore::WHLSL::AST::StatementList::StatementList):
1183         (WebCore::WHLSL::AST::StatementList::statements):
1184         * Modules/webgpu/WHLSL/AST/WHLSLValue.h:
1185         (WebCore::WHLSL::AST::Value::Value):
1186         (WebCore::WHLSL::AST::Value::origin const):
1187         * Modules/webgpu/WHLSL/AST/WHLSLVariableDeclaration.h:
1188         (WebCore::WHLSL::AST::VariableDeclaration::VariableDeclaration):
1189         (WebCore::WHLSL::AST::VariableDeclaration::takeInitializer):
1190         (WebCore::WHLSL::AST::VariableDeclaration::origin const): Deleted.
1191         * Modules/webgpu/WHLSL/AST/WHLSLVariableReference.h:
1192         (WebCore::WHLSL::AST::VariableReference::wrap):
1193         * Modules/webgpu/WHLSL/Metal/WHLSLFunctionWriter.cpp:
1194         (WebCore::WHLSL::Metal::FunctionDefinitionWriter::visit):
1195         * Modules/webgpu/WHLSL/WHLSLASTDumper.cpp:
1196         (WebCore::WHLSL::ASTDumper::visit):
1197         * Modules/webgpu/WHLSL/WHLSLASTDumper.h:
1198         (WebCore::WHLSL::dumpASTNode):
1199         (WebCore::WHLSL::dumpAST):
1200         (WebCore::WHLSL::toString): Deleted.
1201         * Modules/webgpu/WHLSL/WHLSLPrepare.cpp:
1202         (WebCore::WHLSL::prepareShared):
1203         * Modules/webgpu/WHLSL/WHLSLPreserveVariableLifetimes.cpp: Added.
1204         (WebCore::WHLSL::EscapedVariableCollector::takeEscapedVariables):
1205         (WebCore::WHLSL::anonymousToken):
1206         (WebCore::WHLSL::PreserveLifetimes::PreserveLifetimes):
1207         (WebCore::WHLSL::PreserveLifetimes::makeStructVariableReference):
1208         (WebCore::WHLSL::preserveVariableLifetimes):
1209         * Modules/webgpu/WHLSL/WHLSLPreserveVariableLifetimes.h: Added.
1210         * Modules/webgpu/WHLSL/WHLSLVisitor.cpp:
1211         (WebCore::WHLSL::Visitor::visit):
1212         * Modules/webgpu/WHLSL/WHLSLVisitor.h:
1213         * Sources.txt:
1214         * WebCore.xcodeproj/project.pbxproj:
1215
1216 2019-05-30  Ryan Haddad  <ryanhaddad@apple.com>
1217
1218         Unreviewed, rolling out r245890, 245887.
1219
1220         Breaks internal builds.
1221
1222         Reverted changeset:
1223         "Video playback in Safari should continue when CarPlay is plugged in"
1224         https://bugs.webkit.org/show_bug.cgi?id=198345
1225         https://trac.webkit.org/changeset/245887/webkit
1226
1227 2019-05-30  Dean Jackson  <dino@apple.com>
1228
1229         Media documents on iPad are too wide in split screen
1230         https://bugs.webkit.org/show_bug.cgi?id=198405
1231         <rdar://problem/50974548>
1232
1233         Reviewed by Tim Horton.
1234
1235         Media documents on iPad had a minimum width of 700px. This
1236         was fine in full-screen, but didn't work when then window
1237         was smaller, such as split screen or a link preview.
1238
1239         Tests: media/modern-media-controls/media-documents/media-document-video-ipad-sizing.html
1240                media/modern-media-controls/media-documents/media-document-video-iphone-sizing.html
1241
1242         * Modules/modern-media-controls/controls/media-document.css: Add a media query to
1243         detect small windows.
1244         * Modules/modern-media-controls/media/media-document-controller.js:
1245
1246 2019-05-30  Andres Gonzalez  <andresg_22@apple.com>
1247
1248         Inserting a newline in contenteditable causes two characters to be added instead of one
1249         https://bugs.webkit.org/show_bug.cgi?id=197894
1250         <rdar://problem/49700998>
1251
1252         Reviewed by Wenson Hsieh and Chris Fleizach.
1253
1254         There were two issues with inserting a newline character at the end of 
1255         a line that caused problems for accessibility:
1256         - the first '\n' inserted after text would result in two line breaks 
1257         inserted instead of one. createFragmentFromText in markup.cpp was 
1258         splitting the string "\n" into two empty strings and creating a <div> 
1259         and a <br> respectively. Then the emission code would emit a '\n' for 
1260         the empty div and another for the <br>.
1261         - the second problem is a consequence of <rdar://problem/5192593> and 
1262         the workaround is the change in editing.cpp in the function
1263         visiblePositionForIndexUsingCharacterIterator, similar to what is done
1264         in VisibleUnits.cpp for nextBoundary.
1265         The rest of the changes in this patch are accessibility changes to 
1266         execute the layout tests.
1267
1268         Tests: accessibility/ios-simulator/set-selected-text-range-after-newline.html
1269                accessibility/set-selected-text-range-after-newline.html
1270
1271         * accessibility/AccessibilityRenderObject.cpp:
1272         (WebCore::AccessibilityRenderObject::setSelectedTextRange):
1273         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
1274         (-[WebAccessibilityObjectWrapper stringForRange:]):
1275         (-[WebAccessibilityObjectWrapper _accessibilitySelectedTextRange]):
1276         (-[WebAccessibilityObjectWrapper accessibilityReplaceRange:withText:]):
1277         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
1278         (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
1279         * editing/Editing.cpp:
1280         (WebCore::visiblePositionForIndexUsingCharacterIterator):
1281         * editing/markup.cpp:
1282         (WebCore::createFragmentFromText):
1283
1284 2019-05-30  Justin Fan  <justin_fan@apple.com>
1285
1286         [Web GPU] Vertex Buffers/Input State API updates
1287         https://bugs.webkit.org/show_bug.cgi?id=194258
1288         <rdar://problem/47806127>
1289
1290         Reviewed by Myles C. Maxfield.
1291
1292         The vertex buffer attributes model for GPURenderPipelines in the WebGPU API has been updated.
1293         Update our implementation to match.
1294
1295         No new tests. Existing tests updated to match new behavior.
1296
1297         * CMakeLists.txt:
1298         * DerivedSources-input.xcfilelist:
1299         * DerivedSources-output.xcfilelist:
1300         * DerivedSources.make:
1301         * Modules/webgpu/GPUVertexAttributeDescriptor.idl:
1302         * Modules/webgpu/GPUVertexBufferDescriptor.idl: Renamed from Source/WebCore/Modules/webgpu/GPUInputStateDescriptor.idl.
1303         * Modules/webgpu/GPUVertexInputDescriptor.idl:
1304         * Modules/webgpu/WebGPURenderPipelineDescriptor.idl:
1305         * Sources.txt:
1306         * WebCore.xcodeproj/project.pbxproj:
1307         * platform/graphics/gpu/GPURenderPipelineDescriptor.h:
1308         * platform/graphics/gpu/GPUVertexAttributeDescriptor.h:
1309         * platform/graphics/gpu/GPUVertexBufferDescriptor.h: Renamed from Source/WebCore/platform/graphics/gpu/GPUInputStateDescriptor.h.
1310         * platform/graphics/gpu/GPUVertexInputDescriptor.h:
1311         * platform/graphics/gpu/cocoa/GPURenderPipelineMetal.mm:
1312         (WebCore::trySetVertexInput): Added. Populate Metal and WHLSL pipeline descriptors with vertex attribute metadata.
1313         (WebCore::trySetColorStates): Added. Populate Metal and WHLSL pipeline descriptors with color attachment metadata.
1314         (WebCore::convertLayout): Moved.
1315         (WebCore::trySetMetalFunctions): Moved.
1316         (WebCore::trySetFunctions): Added. WHLSL compilation to Metal SL happens here, then MSL functions are set on pipeline descriptor.
1317         (WebCore::convertRenderPipelineDescriptor): Repurposed. Convert a GPURenderPipelineDescriptor to Metal and WHLSL versions.
1318         (WebCore::tryCreateMtlRenderPipelineState):
1319         (WebCore::GPURenderPipeline::tryCreate):
1320         (WebCore::trySetMetalFunctionsForPipelineDescriptor): Deleted.
1321         (WebCore::trySetWHLSLFunctionsForPipelineDescriptor): Deleted.
1322         (WebCore::trySetFunctionsForPipelineDescriptor): Deleted.
1323         (WebCore::trySetInputStateForPipelineDescriptor): Deleted.
1324         (WebCore::setColorStatesForColorAttachmentArray): Deleted.
1325
1326 2019-05-30  Zalan Bujtas  <zalan@apple.com>
1327
1328         [iOS] Do not linkify telephone numbers inside <a> elements.
1329         https://bugs.webkit.org/show_bug.cgi?id=198378
1330
1331         Reviewed by Chris Dumez.
1332
1333         Phone number linkifying mutates the DOM in a potentially unexpected way triggering different kinds of failures with JS, CSS selectors etc.
1334         This patch tightens the linkifying rule so that content inside an <a> element won't get linkified even when the <a> has no valid href attribute.
1335
1336         Test: fast/dom/linkify-phone-numbers.html
1337
1338         * html/parser/HTMLTreeBuilder.cpp:
1339         (WebCore::disallowTelephoneNumberParsing):
1340
1341 2019-05-30  Truitt Savell  <tsavell@apple.com>
1342
1343         Unreviewed, rolling out r245883.
1344
1345         Caused 6 webgpu/ layout test failures.
1346
1347         Reverted changeset:
1348
1349         "[WHLSL] Parsing and lexing the standard library is slow"
1350         https://bugs.webkit.org/show_bug.cgi?id=192890
1351         https://trac.webkit.org/changeset/245883
1352
1353 2019-05-30  Simon Fraser  <simon.fraser@apple.com>
1354
1355         Move some HistoricalVelocityData code into the cpp file
1356         https://bugs.webkit.org/show_bug.cgi?id=198353
1357
1358         Reviewed by Tim Horton.
1359         
1360         Now that we have VelocityData.cpp put the non-trivial HistoricalVelocityData::velocityForNewData()
1361         into it. append() can become a lambda function.
1362
1363         * platform/graphics/VelocityData.cpp:
1364         (WebCore::HistoricalVelocityData::velocityForNewData):
1365         * platform/graphics/VelocityData.h:
1366         (WebCore::HistoricalVelocityData::velocityForNewData): Deleted.
1367         (WebCore::HistoricalVelocityData::append): Deleted.
1368
1369 2019-05-30  Truitt Savell  <tsavell@apple.com>
1370
1371         Fix the iOS build after r245887
1372         https://bugs.webkit.org/show_bug.cgi?id=198345
1373
1374         Unreviewed build fix.
1375
1376         * platform/audio/ios/MediaSessionManagerIOS.mm:
1377         (WebCore::MediaSessionManageriOS::updateCarPlayIsConnected):
1378
1379 2019-05-30  Jer Noble  <jer.noble@apple.com>
1380
1381         ASSERTION FAILED: m_scriptExecutionContext under WebCore::AudioContext::isPlayingAudioDidChange()
1382         https://bugs.webkit.org/show_bug.cgi?id=181597
1383         <rdar://problem/36474088>
1384
1385         Reviewed by Eric Carlson.
1386
1387         Because document() is usually null-checked before using (and we can add null-checks where missing),
1388         there's no good reason to debug-assert that m_scriptExecutionContext is non-null before downcast<>ing
1389         to Document*.
1390
1391         * Modules/webaudio/AudioContext.cpp:
1392         (WebCore::AudioContext::constructCommon):
1393         (WebCore::AudioContext::stop):
1394         (WebCore::AudioContext::document const):
1395         (WebCore::AudioContext::visibilityStateChanged):
1396         (WebCore::AudioContext::willBeginPlayback):
1397         (WebCore::AudioContext::willPausePlayback):
1398         (WebCore::AudioContext::pageMutedStateDidChange):
1399
1400 2019-05-30  Jer Noble  <jer.noble@apple.com>
1401
1402         Video playback in Safari should continue when CarPlay is plugged in
1403         https://bugs.webkit.org/show_bug.cgi?id=198345
1404         <rdar://problem/45505750>
1405
1406         Reviewed by Eric Carlson.
1407
1408         Test: media/video-isplayingtoautomotiveheadunit.html
1409
1410         * html/HTMLMediaElement.cpp:
1411         (WebCore::HTMLMediaElement::shouldOverrideBackgroundPlaybackRestriction const):
1412         * platform/audio/PlatformMediaSessionManager.cpp:
1413         (WebCore::PlatformMediaSessionManager::setIsPlayingToAutomotiveHeadUnit):
1414         * platform/audio/PlatformMediaSessionManager.h:
1415         (WebCore::PlatformMediaSessionManager::isPlayingToAutomotiveHeadUnit const):
1416         * platform/audio/ios/MediaSessionManagerIOS.h:
1417         * platform/audio/ios/MediaSessionManagerIOS.mm:
1418         (WebCore::MediaSessionManageriOS::MediaSessionManageriOS):
1419         (WebCore::MediaSessionManageriOS::carPlayServerDied):
1420         (WebCore::MediaSessionManageriOS::updateCarPlayIsConnected):
1421         (-[WebMediaSessionHelper initWithCallback:]):
1422         (-[WebMediaSessionHelper startMonitoringAirPlayRoutes]):
1423         (-[WebMediaSessionHelper interruption:]):
1424         (-[WebMediaSessionHelper applicationWillEnterForeground:]):
1425         (-[WebMediaSessionHelper applicationDidBecomeActive:]):
1426         (-[WebMediaSessionHelper applicationWillResignActive:]):
1427         (-[WebMediaSessionHelper wirelessRoutesAvailableDidChange:]):
1428         (-[WebMediaSessionHelper applicationDidEnterBackground:]):
1429         (-[WebMediaSessionHelper carPlayServerDied:]):
1430         (-[WebMediaSessionHelper carPlayIsConnectedDidChange:]):
1431         * testing/Internals.cpp:
1432         (WebCore::Internals::resetToConsistentState):
1433         (WebCore::Internals::setIsPlayingToAutomotiveHeadUnit):
1434         * testing/Internals.h:
1435         * testing/Internals.idl:
1436
1437 2019-05-29  Robin Morisset  <rmorisset@apple.com>
1438
1439         [WHLSL] Parsing and lexing the standard library is slow
1440         https://bugs.webkit.org/show_bug.cgi?id=192890
1441         <rdar://problem/50746335>
1442
1443         Reviewed by Myles Maxfield.
1444
1445         The main idea is to avoid backtracking by instead peeking at the next token (and occasionally at the one after that).
1446         This implies a few things:
1447         - We can replace the stack of tokens by a trivial ring buffer of size 2 (holding the next token and the one after, or WTF::nullopt if we are at the end of the file).
1448         - We now have "completeFooExpression" functions, to avoid having to reparse the prefix of some expression, if we find half-way through what it is.
1449
1450         I also fixed the following parser bug:
1451         - https://bugs.webkit.org/show_bug.cgi?id=198305 [WHLSL] Multiple variables with initializers in a declaration statement crashes the compiler
1452             which was due to a mistake I made in the grammar
1453
1454         Finally I added two new macros: CONSUME_TYPE and PARSE to eliminate about 500 lines of error propagation boilerplate.
1455
1456         There are still lots of ways of improving the parser and lexer, such as:
1457         - finishing the conversion of tokens in the lexer, not bothering with allocating string views
1458         - make two special tokens Invalid and EOF, to remove the overhead of Optional
1459         - make peekTypes and consumeTypes use templates to avoid constructing a Vector and calling find on it.
1460         - Turn the entire lexer into a proper automata, not going through the same characters again and again (this is certainly the largest win by far)
1461         - Remove the last few pieces of backtracking from the parser.
1462
1463         The current patch is already enough to make parsing the full standard library (something like 85k lines) approximately 260ms.
1464         This is still longer than I would like, but nowhere near the bottleneck any longer because of some other parts of the compiler.
1465
1466         * Modules/webgpu/WHLSL/WHLSLLexer.h:
1467         (WebCore::WHLSL::Lexer::Lexer):
1468         (WebCore::WHLSL::Lexer::consumeToken):
1469         (WebCore::WHLSL::Lexer::peek):
1470         (WebCore::WHLSL::Lexer::peekFurther):
1471         (WebCore::WHLSL::Lexer::state const):
1472         (WebCore::WHLSL::Lexer::setState):
1473         (WebCore::WHLSL::Lexer::unconsumeToken): Deleted.
1474         * Modules/webgpu/WHLSL/WHLSLParser.cpp:
1475         (WebCore::WHLSL::Parser::parse):
1476         (WebCore::WHLSL::Parser::peek):
1477         (WebCore::WHLSL::Parser::peekTypes):
1478         (WebCore::WHLSL::Parser::tryType):
1479         (WebCore::WHLSL::Parser::tryTypes):
1480         (WebCore::WHLSL::Parser::consumeTypes):
1481         (WebCore::WHLSL::Parser::parseConstantExpression):
1482         (WebCore::WHLSL::Parser::parseTypeArgument):
1483         (WebCore::WHLSL::Parser::parseTypeArguments):
1484         (WebCore::WHLSL::Parser::parseTypeSuffixAbbreviated):
1485         (WebCore::WHLSL::Parser::parseTypeSuffixNonAbbreviated):
1486         (WebCore::WHLSL::Parser::parseType):
1487         (WebCore::WHLSL::Parser::parseTypeDefinition):
1488         (WebCore::WHLSL::Parser::parseResourceSemantic):
1489         (WebCore::WHLSL::Parser::parseSpecializationConstantSemantic):
1490         (WebCore::WHLSL::Parser::parseStageInOutSemantic):
1491         (WebCore::WHLSL::Parser::parseSemantic):
1492         (WebCore::WHLSL::Parser::parseQualifiers):
1493         (WebCore::WHLSL::Parser::parseStructureElement):
1494         (WebCore::WHLSL::Parser::parseStructureDefinition):
1495         (WebCore::WHLSL::Parser::parseEnumerationDefinition):
1496         (WebCore::WHLSL::Parser::parseEnumerationMember):
1497         (WebCore::WHLSL::Parser::parseNativeTypeDeclaration):
1498         (WebCore::WHLSL::Parser::parseNumThreadsFunctionAttribute):
1499         (WebCore::WHLSL::Parser::parseAttributeBlock):
1500         (WebCore::WHLSL::Parser::parseParameter):
1501         (WebCore::WHLSL::Parser::parseParameters):
1502         (WebCore::WHLSL::Parser::parseFunctionDefinition):
1503         (WebCore::WHLSL::Parser::parseComputeFunctionDeclaration):
1504         (WebCore::WHLSL::Parser::parseVertexFragmentFunctionDeclaration):
1505         (WebCore::WHLSL::Parser::parseRegularFunctionDeclaration):
1506         (WebCore::WHLSL::Parser::parseOperatorFunctionDeclaration):
1507         (WebCore::WHLSL::Parser::parseFunctionDeclaration):
1508         (WebCore::WHLSL::Parser::parseNativeFunctionDeclaration):
1509         (WebCore::WHLSL::Parser::parseBlock):
1510         (WebCore::WHLSL::Parser::parseBlockBody):
1511         (WebCore::WHLSL::Parser::parseIfStatement):
1512         (WebCore::WHLSL::Parser::parseSwitchStatement):
1513         (WebCore::WHLSL::Parser::parseSwitchCase):
1514         (WebCore::WHLSL::Parser::parseForLoop):
1515         (WebCore::WHLSL::Parser::parseWhileLoop):
1516         (WebCore::WHLSL::Parser::parseDoWhileLoop):
1517         (WebCore::WHLSL::Parser::parseVariableDeclaration):
1518         (WebCore::WHLSL::Parser::parseVariableDeclarations):
1519         (WebCore::WHLSL::Parser::parseStatement):
1520         (WebCore::WHLSL::Parser::parseEffectfulExpression):
1521         (WebCore::WHLSL::Parser::parseEffectfulAssignment):
1522         (WebCore::WHLSL::Parser::parseExpression):
1523         (WebCore::WHLSL::Parser::parseTernaryConditional):
1524         (WebCore::WHLSL::Parser::completeTernaryConditional):
1525         (WebCore::WHLSL::Parser::parseAssignment):
1526         (WebCore::WHLSL::Parser::completeAssignment):
1527         (WebCore::WHLSL::Parser::parsePossibleTernaryConditional):
1528         (WebCore::WHLSL::Parser::parsePossibleLogicalBinaryOperation):
1529         (WebCore::WHLSL::Parser::completePossibleLogicalBinaryOperation):
1530         (WebCore::WHLSL::Parser::parsePossibleRelationalBinaryOperation):
1531         (WebCore::WHLSL::Parser::completePossibleRelationalBinaryOperation):
1532         (WebCore::WHLSL::Parser::parsePossibleShift):
1533         (WebCore::WHLSL::Parser::completePossibleShift):
1534         (WebCore::WHLSL::Parser::parsePossibleAdd):
1535         (WebCore::WHLSL::Parser::completePossibleAdd):
1536         (WebCore::WHLSL::Parser::parsePossibleMultiply):
1537         (WebCore::WHLSL::Parser::completePossibleMultiply):
1538         (WebCore::WHLSL::Parser::parsePossiblePrefix):
1539         (WebCore::WHLSL::Parser::parsePossibleSuffix):
1540         (WebCore::WHLSL::Parser::parseCallExpression):
1541         (WebCore::WHLSL::Parser::parseTerm):
1542         (WebCore::WHLSL::Parser::parseAddressSpaceType): Deleted.
1543         (WebCore::WHLSL::Parser::parseNonAddressSpaceType): Deleted.
1544         (WebCore::WHLSL::Parser::parseEntryPointFunctionDeclaration): Deleted.
1545         (WebCore::WHLSL::Parser::parseEffectfulPrefix): Deleted.
1546         (WebCore::WHLSL::Parser::parseEffectfulSuffix): Deleted.
1547         * Modules/webgpu/WHLSL/WHLSLParser.h:
1548         (WebCore::WHLSL::Parser::Error::dump const):
1549
1550 2019-05-29  Jiewen Tan  <jiewen_tan@apple.com>
1551
1552         Unreviewed, update WebAuthN to "Supported In Preview"
1553
1554         * features.json:
1555
1556 2019-05-29  Don Olmstead  <don.olmstead@sony.com>
1557
1558         Remove ENABLE definitions from WebKit config files
1559         https://bugs.webkit.org/show_bug.cgi?id=197858
1560
1561         Reviewed by Simon Fraser.
1562
1563         Sync FeatureDefines.xcconfig.
1564
1565         * Configurations/FeatureDefines.xcconfig:
1566
1567 2019-05-29  Youenn Fablet  <youenn@apple.com>
1568
1569         Reestablish WebSWClientConnection in case of network process crash
1570         https://bugs.webkit.org/show_bug.cgi?id=198333
1571
1572         Reviewed by Alex Christensen.
1573
1574         Refactor DocumentLoader to no longer take a ref to the SWClientConnection.
1575         Instead, store the sessionID and get the SWClientConnection from it.
1576         Remove unused code from ServiceWorkerContainer.
1577
1578         Test: http/wpt/service-workers/service-worker-networkprocess-crash.html
1579
1580         * loader/DocumentLoader.cpp:
1581         (WebCore::DocumentLoader::registerTemporaryServiceWorkerClient):
1582         (WebCore::DocumentLoader::unregisterTemporaryServiceWorkerClient):
1583         * loader/DocumentLoader.h:
1584         * workers/service/ServiceWorkerContainer.cpp:
1585         * workers/service/ServiceWorkerContainer.h:
1586         * workers/service/ServiceWorkerJobClient.h:
1587
1588 2019-05-29  David Kilzer  <ddkilzer@apple.com>
1589
1590         IndexedDatabase Server thread in com.apple.WebKit.Networking process leaks objects into an autoreleasePool that's never cleared
1591         <https://webkit.org/b/198346>
1592         <rdar://problem/50895658>
1593
1594         Reviewed by Brent Fulgham.
1595
1596         * Modules/indexeddb/server/IDBServer.cpp:
1597         (WebCore::IDBServer::IDBServer::IDBServer):
1598         - Pass AutodrainedPoolForRunLoop::Use when creating
1599           CrossThreadTaskHandler to fix the bug.
1600
1601 2019-05-29  Geoffrey Garen  <ggaren@apple.com>
1602
1603         WeakPtr breaks vtables when upcasting to base classes
1604         https://bugs.webkit.org/show_bug.cgi?id=188799
1605
1606         Reviewed by Youenn Fablet.
1607
1608         * Modules/encryptedmedia/MediaKeySession.cpp:
1609         (WebCore::MediaKeySession::MediaKeySession):
1610         * Modules/encryptedmedia/MediaKeySession.h: Adopted modern WeakPtr APIs.
1611         Removed redundant WeakPtrFactory.
1612
1613         * css/CSSFontFace.cpp:
1614         (WebCore::CSSFontFace::existingWrapper):
1615         * css/CSSFontFace.h: Moved functions out of line to avoid #include
1616         explosion for .get().
1617
1618         * dom/ContainerNode.h:
1619         * dom/Document.h:
1620         * dom/Element.h: Moved CanMakeWeakPtr to ContainerNode because all
1621         subclasses except for DocumentFragment were already so, and we have
1622         code that uses WeakPtr<ContainerNode>, which, now that WeakPtr is
1623         type-safe, is awkward to do when ContainerNode isn't CanMakeWeakPtr.
1624
1625         * dom/FullscreenManager.cpp:
1626         (WebCore::FullscreenManager::fullscreenRenderer const):
1627         * dom/FullscreenManager.h:
1628         (WebCore::FullscreenManager::fullscreenRenderer const): Deleted.
1629         * html/FormAssociatedElement.cpp:
1630         (WebCore::FormAssociatedElement::form const):
1631         * html/FormAssociatedElement.h:
1632         (WebCore::FormAssociatedElement::form const): Deleted. Moved functions
1633         out of line to avoid #include explosion for .get().
1634
1635         * html/HTMLMediaElement.h: It takes an extra using declaration
1636         to disambiguate multiple CanMakeWeakPtr base classes now.
1637
1638         * loader/MediaResourceLoader.cpp:
1639         (WebCore::MediaResourceLoader::requestResource): Removed redundant .get().
1640
1641         * page/DOMWindowProperty.cpp:
1642         (WebCore::DOMWindowProperty::window const):
1643         * page/DOMWindowProperty.h:
1644         (WebCore::DOMWindowProperty::window const): Deleted.
1645         * page/FrameViewLayoutContext.cpp:
1646         (WebCore::FrameViewLayoutContext::subtreeLayoutRoot const):
1647         * page/FrameViewLayoutContext.h:
1648         (WebCore::FrameViewLayoutContext::subtreeLayoutRoot const): Deleted.
1649         * page/UndoItem.cpp:
1650         (WebCore::UndoItem::undoManager const):
1651         * page/UndoItem.h:
1652         (WebCore::UndoItem::undoManager const): Deleted. Moved functions out of
1653         line to avoid #include explosion for .get().
1654
1655         * platform/ScrollView.h: It takes an extra using declaration
1656         to disambiguate multiple CanMakeWeakPtr base classes now.
1657
1658         * platform/Widget.cpp:
1659         (WebCore::Widget::parent const):
1660         * platform/Widget.h:
1661         (WebCore::Widget::parent const): Deleted. Moved functions out of line to avoid #include
1662         explosion for .get().
1663
1664         * platform/encryptedmedia/CDMInstanceSession.h: Made
1665         CDMInstanceSessionClient CanMakeWeakPtr because we use WeakPtr<CDMInstanceSessionClient>.
1666
1667         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
1668         CanMakeWeakPtr is inherited now.
1669
1670         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
1671         (WebCore::MediaPlayerPrivateAVFoundationObjC::MediaPlayerPrivateAVFoundationObjC):
1672         (WebCore::MediaPlayerPrivateAVFoundationObjC::~MediaPlayerPrivateAVFoundationObjC):
1673         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
1674         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::cdmSession const): Deleted.
1675         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::createWeakPtr): Deleted.
1676         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
1677         (WebCore::CMTimebaseEffectiveRateChangedCallback):
1678         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::MediaPlayerPrivateMediaSourceAVFObjC):
1679         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::play):
1680         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::pause):
1681         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::seekWithTolerance):
1682         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::durationChanged):
1683         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::cdmSession const):
1684         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h:
1685         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
1686         (WebCore::SourceBufferPrivateAVFObjC::SourceBufferPrivateAVFObjC):
1687         (WebCore::SourceBufferPrivateAVFObjC::trackDidChangeEnabled):
1688         (WebCore::SourceBufferPrivateAVFObjC::setCDMSession):
1689         (WebCore::SourceBufferPrivateAVFObjC::flushVideo):
1690         (WebCore::SourceBufferPrivateAVFObjC::enqueueSample):
1691         (WebCore::SourceBufferPrivateAVFObjC::notifyClientWhenReadyForMoreSamples):
1692         (WebCore::SourceBufferPrivateAVFObjC::setVideoLayer):
1693         (WebCore::SourceBufferPrivateAVFObjC::setDecompressionSession): Modernized WeakPtr API usage.
1694
1695         * rendering/RenderBlockFlow.cpp:
1696         (WebCore::RenderBlockFlow::multiColumnFlowSlowCase const):
1697         * rendering/RenderBlockFlow.h:
1698         (WebCore::RenderBlockFlow::multiColumnFlow const):
1699         * rendering/RenderMultiColumnFlow.cpp:
1700         (WebCore::RenderMultiColumnFlow::findColumnSpannerPlaceholder const):
1701         * rendering/RenderMultiColumnFlow.h:
1702         * rendering/RenderTable.cpp:
1703         (WebCore::RenderTable::header const):
1704         (WebCore::RenderTable::footer const):
1705         (WebCore::RenderTable::firstBody const):
1706         (WebCore::RenderTable::topSection const):
1707         * rendering/RenderTable.h:
1708         (WebCore::RenderTable::header const): Deleted.
1709         (WebCore::RenderTable::footer const): Deleted.
1710         (WebCore::RenderTable::firstBody const): Deleted.
1711         (WebCore::RenderTable::topSection const): Deleted. Moved functions out
1712         of line to avoid #include explosion for .get().
1713
1714 2019-05-29  Antoine Quint  <graouts@apple.com>
1715
1716         [Pointer Events] toElement and fromElement should be null
1717         https://bugs.webkit.org/show_bug.cgi?id=198338
1718
1719         Reviewed by Dean Jackson.
1720
1721         * dom/MouseEvent.h:
1722         * dom/PointerEvent.h:
1723
1724 2019-05-29  Ryan Haddad  <ryanhaddad@apple.com>
1725
1726         Unreviewed, rolling out r245857.
1727
1728         Breaks internal builds.
1729
1730         Reverted changeset:
1731
1732         "WeakPtr breaks vtables when upcasting to base classes"
1733         https://bugs.webkit.org/show_bug.cgi?id=188799
1734         https://trac.webkit.org/changeset/245857
1735
1736 2019-05-29  Keith Rollin  <krollin@apple.com>
1737
1738         Fix builds that don't use makeWindowFromView
1739         https://bugs.webkit.org/show_bug.cgi?id=198342
1740         <rdar://problem/51228563>
1741
1742         Reviewed by Wenson Hsieh.
1743
1744         In some configurations, VideoFullscreenInterfaceAVKit.mm declares but
1745         does not use makeWindowFromView. Fix by conditionalizing the the
1746         declaration on the same symbol as point where it's used.
1747
1748         No new tests -- no new functionality.
1749
1750         * platform/ios/VideoFullscreenInterfaceAVKit.mm:
1751
1752 2019-05-28  Geoffrey Garen  <ggaren@apple.com>
1753
1754         WeakPtr breaks vtables when upcasting to base classes
1755         https://bugs.webkit.org/show_bug.cgi?id=188799
1756
1757         Reviewed by Youenn Fablet.
1758
1759         * Modules/encryptedmedia/MediaKeySession.cpp:
1760         (WebCore::MediaKeySession::MediaKeySession):
1761         * Modules/encryptedmedia/MediaKeySession.h: Adopted modern WeakPtr APIs.
1762         Removed redundant WeakPtrFactory.
1763
1764         * css/CSSFontFace.cpp:
1765         (WebCore::CSSFontFace::existingWrapper):
1766         * css/CSSFontFace.h: Moved functions out of line to avoid #include
1767         explosion for .get().
1768
1769         * dom/ContainerNode.h:
1770         * dom/Document.h:
1771         * dom/Element.h: Moved CanMakeWeakPtr to ContainerNode because all
1772         subclasses except for DocumentFragment were already so, and we have
1773         code that uses WeakPtr<ContainerNode>, which, now that WeakPtr is
1774         type-safe, is awkward to do when ContainerNode isn't CanMakeWeakPtr.
1775
1776         * dom/FullscreenManager.cpp:
1777         (WebCore::FullscreenManager::fullscreenRenderer const):
1778         * dom/FullscreenManager.h:
1779         (WebCore::FullscreenManager::fullscreenRenderer const): Deleted.
1780         * html/FormAssociatedElement.cpp:
1781         (WebCore::FormAssociatedElement::form const):
1782         * html/FormAssociatedElement.h:
1783         (WebCore::FormAssociatedElement::form const): Deleted. Moved functions
1784         out of line to avoid #include explosion for .get().
1785
1786         * html/HTMLMediaElement.h: It takes an extra using declaration
1787         to disambiguate multiple CanMakeWeakPtr base classes now.
1788
1789         * loader/MediaResourceLoader.cpp:
1790         (WebCore::MediaResourceLoader::requestResource): Removed redundant .get().
1791
1792         * page/DOMWindowProperty.cpp:
1793         (WebCore::DOMWindowProperty::window const):
1794         * page/DOMWindowProperty.h:
1795         (WebCore::DOMWindowProperty::window const): Deleted.
1796         * page/FrameViewLayoutContext.cpp:
1797         (WebCore::FrameViewLayoutContext::subtreeLayoutRoot const):
1798         * page/FrameViewLayoutContext.h:
1799         (WebCore::FrameViewLayoutContext::subtreeLayoutRoot const): Deleted.
1800         * page/UndoItem.cpp:
1801         (WebCore::UndoItem::undoManager const):
1802         * page/UndoItem.h:
1803         (WebCore::UndoItem::undoManager const): Deleted. Moved functions out of
1804         line to avoid #include explosion for .get().
1805
1806         * platform/ScrollView.h: It takes an extra using declaration
1807         to disambiguate multiple CanMakeWeakPtr base classes now.
1808
1809         * platform/Widget.cpp:
1810         (WebCore::Widget::parent const):
1811         * platform/Widget.h:
1812         (WebCore::Widget::parent const): Deleted. Moved functions out of line to avoid #include
1813         explosion for .get().
1814
1815         * platform/encryptedmedia/CDMInstanceSession.h: Made
1816         CDMInstanceSessionClient CanMakeWeakPtr because we use WeakPtr<CDMInstanceSessionClient>.
1817
1818         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
1819         CanMakeWeakPtr is inherited now.
1820
1821         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
1822         (WebCore::MediaPlayerPrivateAVFoundationObjC::MediaPlayerPrivateAVFoundationObjC):
1823         (WebCore::MediaPlayerPrivateAVFoundationObjC::~MediaPlayerPrivateAVFoundationObjC):
1824         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
1825         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::cdmSession const): Deleted.
1826         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::createWeakPtr): Deleted.
1827         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
1828         (WebCore::CMTimebaseEffectiveRateChangedCallback):
1829         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::MediaPlayerPrivateMediaSourceAVFObjC):
1830         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::play):
1831         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::pause):
1832         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::seekWithTolerance):
1833         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::durationChanged):
1834         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::cdmSession const):
1835         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h:
1836         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
1837         (WebCore::SourceBufferPrivateAVFObjC::SourceBufferPrivateAVFObjC):
1838         (WebCore::SourceBufferPrivateAVFObjC::trackDidChangeEnabled):
1839         (WebCore::SourceBufferPrivateAVFObjC::setCDMSession):
1840         (WebCore::SourceBufferPrivateAVFObjC::flushVideo):
1841         (WebCore::SourceBufferPrivateAVFObjC::enqueueSample):
1842         (WebCore::SourceBufferPrivateAVFObjC::notifyClientWhenReadyForMoreSamples):
1843         (WebCore::SourceBufferPrivateAVFObjC::setVideoLayer):
1844         (WebCore::SourceBufferPrivateAVFObjC::setDecompressionSession): Modernized WeakPtr API usage.
1845
1846         * rendering/RenderBlockFlow.cpp:
1847         (WebCore::RenderBlockFlow::multiColumnFlowSlowCase const):
1848         * rendering/RenderBlockFlow.h:
1849         (WebCore::RenderBlockFlow::multiColumnFlow const):
1850         * rendering/RenderMultiColumnFlow.cpp:
1851         (WebCore::RenderMultiColumnFlow::findColumnSpannerPlaceholder const):
1852         * rendering/RenderMultiColumnFlow.h:
1853         * rendering/RenderTable.cpp:
1854         (WebCore::RenderTable::header const):
1855         (WebCore::RenderTable::footer const):
1856         (WebCore::RenderTable::firstBody const):
1857         (WebCore::RenderTable::topSection const):
1858         * rendering/RenderTable.h:
1859         (WebCore::RenderTable::header const): Deleted.
1860         (WebCore::RenderTable::footer const): Deleted.
1861         (WebCore::RenderTable::firstBody const): Deleted.
1862         (WebCore::RenderTable::topSection const): Deleted. Moved functions out
1863         of line to avoid #include explosion for .get().
1864
1865 2019-05-29  Antti Koivisto  <antti@apple.com>
1866
1867         Scrolling node ordering wrong when a layer has both positioning and fixed/sticky node
1868         https://bugs.webkit.org/show_bug.cgi?id=198329
1869
1870         Reviewed by Darin Adler.
1871
1872         Test: scrollingcoordinator/scrolling-tree/sticky-in-overflow.html
1873
1874         With sticky positioning in non-stacking context overflow you currently get structure like
1875
1876         FrameScrollingNode
1877           OverflowScrollingNode
1878           StickyNode
1879             PositionedNode
1880
1881         where StickyNode and PositionedNode reference the same layer. Sticky doesn't get applied at all when the overflow moves.
1882
1883         This patch reverses the order of sticky and positioned. It doesn't fix sticky positioning during scrolling yet,
1884         but it does make it less jumpy. It is a prerequisite for the full fix.
1885
1886         * rendering/RenderLayerCompositor.cpp:
1887         (WebCore::RenderLayerCompositor::updateScrollCoordinationForLayer):
1888
1889 2019-05-29  Ludovico de Nittis  <ludovico.denittis@collabora.com>
1890
1891         Prepend KEY_ to the last key alias in PlatformEventKeyboardGtk
1892         https://bugs.webkit.org/show_bug.cgi?id=198331
1893
1894         Reviewed by Michael Catanzaro.
1895
1896         No behavior change.
1897
1898         With the commit
1899         https://bugs.webkit.org/show_bug.cgi?id=198326
1900         A gdk key slipped away from the renaming.
1901
1902         * platform/gtk/PlatformKeyboardEventGtk.cpp:
1903         (WebCore::modifiersForGdkKeyEvent):
1904
1905 2019-05-29  Zalan Bujtas  <zalan@apple.com>
1906
1907         [LFC][IFC] Move Line class to a dedicated file
1908         https://bugs.webkit.org/show_bug.cgi?id=198332
1909         <rdar://problem/51221403>
1910
1911         Reviewed by Antti Koivisto.
1912
1913         An upcoming refactoring requires the Line class to be in a .h.
1914
1915         * Sources.txt:
1916         * WebCore.xcodeproj/project.pbxproj:
1917         * layout/displaytree/DisplayRun.h:
1918         * layout/inlineformatting/InlineFormattingContextLineLayout.cpp:
1919         (WebCore::Layout::InlineFormattingContext::LineLayout::initializeLine const):
1920         (WebCore::Layout::InlineFormattingContext::LineLayout::computedIntrinsicWidth const):
1921         (WebCore::Layout::halfLeadingMetrics): Deleted.
1922         (WebCore::Layout::Line::availableWidth const): Deleted.
1923         (WebCore::Layout::Line::contentLogicalRight const): Deleted.
1924         (WebCore::Layout::Line::contentLogicalWidth const): Deleted.
1925         (WebCore::Layout::Line::logicalTop const): Deleted.
1926         (WebCore::Layout::Line::logicalLeft const): Deleted.
1927         (WebCore::Layout::Line::logicalRight const): Deleted.
1928         (WebCore::Layout::Line::logicalBottom const): Deleted.
1929         (WebCore::Layout::Line::logicalWidth const): Deleted.
1930         (WebCore::Layout::Line::logicalHeight const): Deleted.
1931         (WebCore::Layout::Line::LineItem::LineItem): Deleted.
1932         (WebCore::Layout::Line::Line): Deleted.
1933         (WebCore::Layout::Line::reset): Deleted.
1934         (WebCore::Layout::Line::close): Deleted.
1935         (WebCore::Layout::Line::removeTrailingTrimmableContent): Deleted.
1936         (WebCore::Layout::Line::moveLogicalLeft): Deleted.
1937         (WebCore::Layout::Line::moveLogicalRight): Deleted.
1938         (WebCore::Layout::isTrimmableContent): Deleted.
1939         (WebCore::Layout::Line::trailingTrimmableWidth const): Deleted.
1940         (WebCore::Layout::Line::hasContent const): Deleted.
1941         (WebCore::Layout::Line::appendNonBreakableSpace): Deleted.
1942         (WebCore::Layout::Line::appendInlineContainerStart): Deleted.
1943         (WebCore::Layout::Line::appendInlineContainerEnd): Deleted.
1944         (WebCore::Layout::Line::appendTextContent): Deleted.
1945         (WebCore::Layout::Line::appendNonReplacedInlineBox): Deleted.
1946         (WebCore::Layout::Line::appendReplacedInlineBox): Deleted.
1947         (WebCore::Layout::Line::appendHardLineBreak): Deleted.
1948         * layout/inlineformatting/InlineTextItem.h:
1949         * layout/inlineformatting/text/TextUtil.cpp:
1950         (WebCore::Layout::TextUtil::isTrimmableContent):
1951         * layout/inlineformatting/text/TextUtil.h:
1952
1953 2019-05-29  Ludovico de Nittis  <ludovico.denittis@collabora.com>
1954
1955         PlatformEventKeyboardGtk still uses old key aliases
1956         https://bugs.webkit.org/show_bug.cgi?id=198326
1957
1958         Reviewed by Carlos Garcia Campos.
1959
1960         No behavior change.
1961
1962         Use the new key names convention prepending "KEY_".
1963
1964         * platform/gtk/PlatformKeyboardEventGtk.cpp:
1965         (WebCore::PlatformKeyboardEvent::keyIdentifierForGdkKeyCode):
1966         (WebCore::PlatformKeyboardEvent::windowsKeyCodeForGdkKeyCode):
1967         (WebCore::PlatformKeyboardEvent::singleCharacterString):
1968         (WebCore::PlatformKeyboardEvent::PlatformKeyboardEvent):
1969
1970 2019-05-28  Yacine Bandou  <yacine.bandou@softathome.com>
1971
1972         [MSE][GStreamer] update the readyState correctly in MediaPlayerPrivateGStreamerMSE
1973         https://bugs.webkit.org/show_bug.cgi?id=197834
1974
1975         Reviewed by Xabier Rodriguez-Calvar.
1976
1977         The buffering state and the m_downloadFinished boolean aren't supported in the MSE case.
1978         When the readyState is already "HaveEnoughData", we don't want to revert it to "HaveFutureData",
1979         or else the MediaPlayer would send a "canplay" event instead of a "canplaythrough".
1980
1981         Test: media/media-source/media-source-canplaythrough-event.html
1982
1983         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
1984         (WebCore::MediaPlayerPrivateGStreamerMSE::updateStates):
1985
1986 2019-05-28  Fujii Hironori  <Hironori.Fujii@sony.com>
1987
1988         [WinCairo] ASSERTION FAILED: !m_preparingToPlay in MediaPlayerPrivateMediaFoundation::prepareToPlay
1989         https://bugs.webkit.org/show_bug.cgi?id=190747
1990
1991         Reviewed by Alex Christensen.
1992
1993         HTMLMediaElement::prepareToPlay had a assertion ensuring that it
1994         was not called twice. However, it was called twice. The first from
1995         HTMLMediaElement::load, the second from
1996         MediaPlayerPrivateMediaFoundation::onTopologySet.
1997
1998         prepareToPlay started loading. And, loading should be started
1999         after onTopologySet is called back.
2000
2001         Covered by existing tests.
2002
2003         * platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp:
2004         (WebCore::MediaPlayerPrivateMediaFoundation::onTopologySet): Moved code from prepareToPlay.
2005         (WebCore::MediaPlayerPrivateMediaFoundation::prepareToPlay): Deleted and moved the code to onTopologySet.
2006         * platform/graphics/win/MediaPlayerPrivateMediaFoundation.h: Removed prepareToPlay declaration.
2007
2008 2019-05-28  Fujii Hironori  <Hironori.Fujii@sony.com>
2009
2010         [WinCairo][MediaFoundation] Assertion failure in MediaPlayerPrivateMediaFoundation::Direct3DPresenter::presentSample
2011         https://bugs.webkit.org/show_bug.cgi?id=198290
2012
2013         Reviewed by Per Arne Vollan.
2014
2015         Covered by existing tests.
2016
2017         * platform/graphics/win/MediaPlayerPrivateMediaFoundation.cpp:
2018         (WebCore::MediaPlayerPrivateMediaFoundation::Direct3DPresenter::presentSample):
2019         Call clear() of m_memSurface before assigning new value.
2020
2021 2019-05-28  Saam Barati  <sbarati@apple.com>
2022
2023         [WHLSL] Type of dereference is the type of the thing we point to, not a pointer to that type
2024         https://bugs.webkit.org/show_bug.cgi?id=198321
2025
2026         Reviewed by Myles C. Maxfield.
2027
2028         Consider this program:
2029         ```
2030         thread int* x;
2031         *x = 42
2032         ```
2033         
2034         In the Checker, we were saying the type of "*x" was "int*" instead of "int".
2035
2036         Test: webgpu/whlsl-dereference-pointer-should-type-check.html
2037
2038         * Modules/webgpu/WHLSL/WHLSLChecker.cpp:
2039         (WebCore::WHLSL::Checker::visit):
2040
2041 2019-05-28  Wenson Hsieh  <wenson_hsieh@apple.com>
2042
2043         [iOS] Respect NSItemProvider's registered types when dropping files that are loaded in-place
2044         https://bugs.webkit.org/show_bug.cgi?id=198315
2045         <rdar://problem/51183762>
2046
2047         Reviewed by Tim Horton.
2048
2049         Currently, logic in PasteboardIOS.mm and WebContentReaderCocoa.mm attempts to deduce the content type from the
2050         file path when dropping attachments on iOS. Instead, we should be plumbing the content type through to the
2051         reader.
2052
2053         Test: WKAttachmentTestsIOS.InsertDroppedImageWithNonImageFileExtension
2054
2055         * editing/WebContentReader.h:
2056         * editing/cocoa/WebContentReaderCocoa.mm:
2057         (WebCore::typeForAttachmentElement):
2058
2059         Add a helper method to determine which type to use in attachment elements. This makes the paste
2060         (attachmentForData) and drop (attachmentForFilePaths) behave the same way, with respect to the type attribute
2061         used to represent the attachment.
2062
2063         (WebCore::attachmentForFilePath):
2064
2065         Use the content type, if specified; otherwise, fall back to deducing it from the file path.
2066
2067         (WebCore::attachmentForData):
2068         (WebCore::WebContentReader::readFilePath):
2069         * platform/Pasteboard.h:
2070         (WebCore::PasteboardWebContentReader::readFilePath):
2071
2072         Pass the highest fidelity representation's content type to the web content reader.
2073
2074         * platform/ios/PasteboardIOS.mm:
2075         (WebCore::Pasteboard::readRespectingUTIFidelities):
2076
2077 2019-05-28  Myles C. Maxfield  <mmaxfield@apple.com>
2078
2079         Move idempotent text autosizing to StyleTreeResolver
2080         https://bugs.webkit.org/show_bug.cgi?id=197808
2081         <rdar://problem/50283983>
2082
2083         Reviewed by Antti Koivisto.
2084
2085         This patch migrates the idempotent text autosizing code to live inside style resolution. This is almost
2086         the same as the algorithm that uses the result of layout to calculate autosizing, but this version only
2087         operates on style (and thus doesn't require double layouts). Because it is being run in an environment
2088         with less information, autosizing is occurring in more places, so the curves have been adjusted to make
2089         autosizing not boost as much as the previous implementation did. The new algorithm is modelled after
2090         text-decorations-in-effect. I've claimed 4 of the unused bits in RenderStyle to contain the state of the
2091         autosizing algorithm. StyleResolver::adjustRenderStyle() is where the algorithm is implemented:
2092         - Look at the inherited bits
2093         - Interogate the element's RenderStyle
2094         - Compute new bits for the element, and set them in its RenderStyle
2095         - Based on the newly computed bits, determine whether we should increase the text size
2096         - If so, determine how much using the specified font size, and apply the result to the computed font size
2097
2098         This works because StyleBuilderCustom::applyInheritFontSize() inherits from the specified font size, not
2099         the computed font size.
2100
2101         This patch also will disable autosizing using the other methods (so there aren't two methods of autosizing
2102         fighting each other) and will honor text-size-adjust:none. However, it won't honor text-size-adjust:100%.
2103         If content says text-size-adjust:100%, we will disregard it and take this code path.
2104
2105         Tests: fast/text-autosizing/ios/idempotentmode/css-exposure.html
2106                fast/text-autosizing/ios/idempotentmode/idempotent-autosizing-skip.html
2107                fast/text-autosizing/ios/idempotentmode/idempotent-autosizing-identity.html
2108                fast/text-autosizing/ios/idempotentmode/idempotent-autosizing.html
2109
2110         * Sources.txt:
2111         * WebCore.xcodeproj/project.pbxproj:
2112         * css/CSSComputedStyleDeclaration.cpp:
2113         (WebCore::ComputedStyleExtractor::valueForPropertyinStyle):
2114         * css/CSSProperties.json:
2115         * css/StyleBuilderCustom.h:
2116         (WebCore::computeBaseSpecifiedFontSize):
2117         (WebCore::computeLineHeightMultiplierDueToFontSize):
2118         * css/StyleResolver.cpp:
2119         (WebCore::idempotentTextSize):
2120         (WebCore::hasTextChildren):
2121         (WebCore::StyleResolver::adjustRenderStyle):
2122         (WebCore::StyleResolver::checkForTextSizeAdjust):
2123         * page/FrameViewLayoutContext.cpp:
2124         (WebCore::FrameViewLayoutContext::applyTextSizingIfNeeded):
2125         * rendering/RenderBlockFlow.cpp:
2126         (WebCore::RenderBlockFlow::adjustComputedFontSizes):
2127         (WebCore::idempotentTextSize): Deleted.
2128         * rendering/RenderBlockFlow.h:
2129         * rendering/RenderElement.cpp:
2130         (WebCore::includeNonFixedHeight):
2131         (WebCore::RenderElement::adjustComputedFontSizesOnBlocks):
2132         (WebCore::RenderElement::resetTextAutosizing):
2133         * rendering/style/RenderStyle.cpp:
2134         (WebCore::RenderStyle::RenderStyle):
2135         (WebCore::RenderStyle::autosizeStatus const):
2136         (WebCore::RenderStyle::setAutosizeStatus):
2137         * rendering/style/RenderStyle.h:
2138         * rendering/style/TextSizeAdjustment.cpp: Added.
2139         (WebCore::AutosizeStatus::AutosizeStatus):
2140         (WebCore::AutosizeStatus::contains const):
2141         (WebCore::AutosizeStatus::modifiedStatus const):
2142         (WebCore::AutosizeStatus::shouldSkipSubtree const):
2143         * rendering/style/TextSizeAdjustment.h:
2144
2145 2019-05-28  Simon Fraser  <simon.fraser@apple.com>
2146
2147         Use scroll-velocity-based tile coverage for overflow:scroll
2148         https://bugs.webkit.org/show_bug.cgi?id=198294
2149         rdar://problem/48942184
2150
2151         Reviewed by Tim Horton.
2152
2153         Start using a velocity-based tile coverage computation on layers with Type::ScrolledContents,
2154         which is the content layers for overflow:scroll when they get big enough to get tiled.
2155
2156         Move legacy macOS coverage code into adjustTileCoverageForDesktopPageScrolling() because
2157         I don't want to change its behavior in this patch. Use TileController::adjustTileCoverageRectForScrolling()
2158         for iOS and macOS overflow scrolling. Since only iOS page scrolling gets velocity data from the UI
2159         process, compute velocity in TileController using the visible rect top-left.
2160         
2161         For overflow scroll, we have to plumb horizontal and vertical coverage in from
2162         RenderLayerBacking.
2163
2164         Tests: tiled-drawing/scrolling/overflow/overflow-scrolled-down-tile-coverage.html
2165                tiled-drawing/scrolling/overflow/overflow-scrolled-up-tile-coverage.html
2166                tiled-drawing/scrolling/overflow/overflow-tile-coverage.html
2167
2168         * platform/graphics/TiledBacking.h:
2169         * platform/graphics/ca/GraphicsLayerCA.cpp:
2170         (WebCore::GraphicsLayerCA::adjustCoverageRect const):
2171         * platform/graphics/ca/PlatformCALayer.h:
2172         * platform/graphics/ca/TileController.cpp:
2173         (WebCore::TileController::setVelocity):
2174         (WebCore::TileController::adjustTileCoverageRect):
2175         (WebCore::TileController::adjustTileCoverageForDesktopPageScrolling const):
2176         (WebCore::TileController::adjustTileCoverageWithScrollingVelocity const):
2177         (WebCore::TileController::adjustTileCoverageRectForScrolling):
2178         (WebCore::expandRectWithinRect): Deleted.
2179         (WebCore::TileController::adjustTileCoverageRect const): Deleted.
2180         (WebCore::TileController::adjustTileCoverageRectForScrolling const): Deleted.
2181         * platform/graphics/ca/TileController.h:
2182         * rendering/RenderLayer.h:
2183         * rendering/RenderLayerBacking.cpp:
2184         (WebCore::computePageTiledBackingCoverage):
2185         (WebCore::computeOverflowTiledBackingCoverage):
2186         (WebCore::RenderLayerBacking::adjustTiledBackingCoverage):
2187         (WebCore::RenderLayerBacking::updateGeometry):
2188
2189 2019-05-28  Shawn Roberts  <sroberts@apple.com>
2190
2191         Unreviewed, rolling out r245475.
2192
2193         Newly imported test is flaky. Features need flags.
2194
2195         Reverted changeset:
2196
2197         "Implement imagesrcset and imagesizes attributes on link
2198         rel=preload"
2199         https://bugs.webkit.org/show_bug.cgi?id=192950
2200         https://trac.webkit.org/changeset/245475
2201
2202 2019-05-28  Brent Fulgham  <bfulgham@apple.com>
2203
2204         Protect frames during style and layout changes
2205         https://bugs.webkit.org/show_bug.cgi?id=198047
2206         <rdar://problem/50954082>
2207
2208         Reviewed by Zalan Bujtas.
2209
2210         Be more careful about the scope and lifetime of objects that participate in layout or
2211         style updates. If a method decides a layout or style update is needed, it needs to
2212         confirm that the elements it was operating on are still valid and needed in the
2213         current operation.
2214
2215         * accessibility/AXObjectCache.cpp:
2216         (WebCore::AXObjectCache::getOrCreate):
2217         * accessibility/AccessibilityRenderObject.cpp:
2218         (WebCore::AccessibilityRenderObject::accessibilityHitTest const):
2219         * css/CSSComputedStyleDeclaration.cpp:
2220         (WebCore::ComputedStyleExtractor::valueForPropertyinStyle):
2221         * css/CSSComputedStyleDeclaration.h:
2222         * css/SVGCSSComputedStyleDeclaration.cpp:
2223         (WebCore::ComputedStyleExtractor::svgPropertyValue):
2224         * dom/Document.cpp:
2225         (WebCore::Document::setFocusedElement):
2226         * editing/TypingCommand.cpp:
2227         (WebCore::TypingCommand::insertTextRunWithoutNewlines):
2228         (WebCore::TypingCommand::insertLineBreak):
2229         (WebCore::TypingCommand::insertParagraphSeparator):
2230         (WebCore::TypingCommand::insertParagraphSeparatorInQuotedContent):
2231         * editing/ios/EditorIOS.mm:
2232         (WebCore::Editor::setDictationPhrasesAsChildOfElement):
2233         * html/HTMLLabelElement.cpp:
2234         (WebCore::HTMLLabelElement::focus):
2235         * html/HTMLTextAreaElement.cpp:
2236         (WebCore::HTMLTextAreaElement::appendFormData):
2237         * html/ImageDocument.cpp:
2238         (WebCore::ImageDocument::imageClicked):
2239         * html/ValidationMessage.cpp:
2240         (WebCore::ValidationMessage::buildBubbleTree):
2241         * page/FrameView.cpp:
2242         (WebCore::FrameView::autoSizeIfEnabled):
2243         (WebCore::FrameView::trackedRepaintRectsAsText const):
2244         * page/PrintContext.cpp:
2245         (WebCore::PrintContext::pageProperty):
2246         (WebCore::PrintContext::numberOfPages):
2247         (WebCore::PrintContext::spoolAllPagesWithBoundaries):
2248
2249 2019-05-28  Antti Koivisto  <antti@apple.com>
2250
2251         [async scrolling] Fixed positioning inside stacking context overflow scroll is jumpy
2252         https://bugs.webkit.org/show_bug.cgi?id=198292
2253
2254         Reviewed by Darin Adler.
2255
2256         Tests: scrollingcoordinator/ios/fixed-in-stacking-context-overflow-scroll-2.html
2257                scrollingcoordinator/ios/fixed-in-stacking-context-overflow-scroll.html
2258
2259         We were computing delta from the layout scroll position in ScrollingTree::notifyRelatedNodesAfterScrollPositionChange
2260         based on the passed in node only. If any other node had deltas they were not taken into account at all. This would occur
2261         frequently since the function is always invoked for the root node after layer tree commit.
2262
2263         Fix by moving the delta computation (and fetching layoutViewport) to ScrollingTreeFixedNode.
2264
2265         * page/scrolling/ScrollingTree.cpp:
2266         (WebCore::ScrollingTree::applyLayerPositions):
2267
2268         No need to pass offset and layoutViewport around anymore.
2269
2270         (WebCore::ScrollingTree::applyLayerPositionsRecursive):
2271         (WebCore::ScrollingTree::notifyRelatedNodesAfterScrollPositionChange):
2272
2273         Remove the offset and layoutViewport computations.
2274
2275         (WebCore::ScrollingTree::notifyRelatedNodesRecursive):
2276         * page/scrolling/ScrollingTree.h:
2277         * page/scrolling/ScrollingTreeFrameHostingNode.cpp:
2278         (WebCore::ScrollingTreeFrameHostingNode::applyLayerPositions):
2279         * page/scrolling/ScrollingTreeFrameHostingNode.h:
2280         * page/scrolling/ScrollingTreeNode.cpp:
2281         (WebCore::ScrollingTreeNode::relatedNodeScrollPositionDidChange):
2282         * page/scrolling/ScrollingTreeNode.h:
2283         * page/scrolling/ScrollingTreeScrollingNode.cpp:
2284         (WebCore::ScrollingTreeScrollingNode::applyLayerPositions):
2285         * page/scrolling/ScrollingTreeScrollingNode.h:
2286         * page/scrolling/cocoa/ScrollingTreeFixedNode.h:
2287         * page/scrolling/cocoa/ScrollingTreeFixedNode.mm:
2288         (WebCore::ScrollingTreeFixedNode::applyLayerPositions):
2289
2290         Compute them here instead, always taking all overflow scrollers up to the closest frame into account.
2291
2292         * page/scrolling/cocoa/ScrollingTreePositionedNode.h:
2293         * page/scrolling/cocoa/ScrollingTreePositionedNode.mm:
2294         (WebCore::ScrollingTreePositionedNode::applyLayerPositions):
2295         (WebCore::ScrollingTreePositionedNode::relatedNodeScrollPositionDidChange):
2296         * page/scrolling/cocoa/ScrollingTreeStickyNode.h:
2297         * page/scrolling/cocoa/ScrollingTreeStickyNode.mm:
2298         (WebCore::ScrollingTreeStickyNode::applyLayerPositions):
2299
2300 2019-05-28  Zalan Bujtas  <zalan@apple.com>
2301
2302         [LFC][Verification] Add additional inline and block checks
2303         https://bugs.webkit.org/show_bug.cgi?id=198252
2304         <rdar://problem/51140687>
2305
2306         Reviewed by Antti Koivisto.
2307
2308         Now we also test the geometry of the blocks with inline formatting contexts.
2309
2310         * layout/Verification.cpp:
2311         (WebCore::Layout::checkForMatchingTextRuns):
2312         (WebCore::Layout::verifyAndOutputSubtree):
2313
2314 2019-05-28  Zalan Bujtas  <zalan@apple.com>
2315
2316         [LFC][IFC] Decouple line layout and processing inline runs.
2317         https://bugs.webkit.org/show_bug.cgi?id=198282
2318         <rdar://problem/51167954>
2319
2320         Reviewed by Antti Koivisto.
2321
2322         This is in preparation for using "createInlineRunsForLine" logic when computing preferred width.
2323
2324         * layout/inlineformatting/InlineFormattingContext.h:
2325         * layout/inlineformatting/InlineFormattingContextLineLayout.cpp:
2326         (WebCore::Layout::UncommittedContent::size const):
2327         (WebCore::Layout::InlineFormattingContext::LineLayout::createInlineRunsForLine const):
2328         (WebCore::Layout::InlineFormattingContext::LineLayout::layout const):
2329         (WebCore::Layout::InlineFormattingContext::LineLayout::processInlineRuns const):
2330         (WebCore::Layout::InlineFormattingContext::LineLayout::closeLine const): Deleted.
2331         * layout/inlineformatting/InlineFormattingState.h:
2332         (WebCore::Layout::InlineFormattingState::addInlineItem):
2333         * layout/inlineformatting/InlineTextItem.cpp:
2334         (WebCore::Layout::InlineTextItem::createAndAppendTextItems):
2335
2336 2019-05-28  Zalan Bujtas  <zalan@apple.com>
2337
2338         [LFC][IFC] Move intrinsic width computation from InlineFormattingContext to LineLayout
2339         https://bugs.webkit.org/show_bug.cgi?id=198258
2340
2341         Reviewed by Antti Koivisto.
2342
2343         This is in preparation for sharing even more code between line layout and preferred width computation. 
2344
2345         * layout/inlineformatting/InlineFormattingContext.cpp:
2346         (WebCore::Layout::InlineFormattingContext::layout const):
2347         (WebCore::Layout::InlineFormattingContext::computeIntrinsicWidthConstraints const):
2348         * layout/inlineformatting/InlineFormattingContext.h:
2349         * layout/inlineformatting/InlineFormattingContextLineLayout.cpp:
2350         (WebCore::Layout::InlineFormattingContext::LineLayout::initializeLine const):
2351         (WebCore::Layout::InlineFormattingContext::LineLayout::layout const):
2352         (WebCore::Layout::InlineFormattingContext::LineLayout::computedIntrinsicWidth const):
2353         (WebCore::Layout::InlineFormattingContext::LineLayout::closeLine const):
2354
2355 2019-05-28  Zalan Bujtas  <zalan@apple.com>
2356
2357         [LFC[IFC] Ignore the initial strut's height when the line does not have any content.
2358         https://bugs.webkit.org/show_bug.cgi?id=198268
2359         <rdar://problem/51150057>
2360
2361         Reviewed by Antti Koivisto.
2362
2363         The strut (https://www.w3.org/TR/CSS22/visudet.html#leading) defines the initial logical height
2364         for the line. This height should be ignored though when the line does not have any content. 
2365
2366         * layout/inlineformatting/InlineFormattingContextLineLayout.cpp:
2367         (WebCore::Layout::InlineFormattingContext::LineLayout::closeLine const):
2368
2369 2019-05-27  Antoine Quint  <graouts@apple.com>
2370
2371         [Pointer Events] Check that capturing data managed by the PointerCaptureController gets cleared upon navigation
2372         https://bugs.webkit.org/show_bug.cgi?id=198191
2373
2374         Reviewed by Dean Jackson.
2375
2376         When the document of the page's main frame changes, make sure we clear all of the data accumulated for the previous document.
2377         I don't think this particular change is testable as none of the data contained in the PointerIdToCapturingDataMap maintained by
2378         the PointerCaptureController contains any data that could be inspected by the page due to other fixes landed to fix wkb.ug/198129,
2379         but I've checked that removing those fixes and using this patch correctly fixes that bug.
2380
2381         * page/Page.cpp:
2382         (WebCore::Page::didChangeMainDocument):
2383         * page/PointerCaptureController.cpp:
2384         (WebCore::PointerCaptureController::PointerCaptureController):
2385         (WebCore::PointerCaptureController::reset):
2386         * page/PointerCaptureController.h:
2387
2388 2019-05-27  Carlos Garcia Campos  <cgarcia@igalia.com>
2389
2390         [GTK] Use WPEBackend-fdo for accelerating compositing in Wayland instead of the nested compositor
2391         https://bugs.webkit.org/show_bug.cgi?id=197944
2392
2393         Reviewed by Michael Catanzaro.
2394
2395         * PlatformGTK.cmake:
2396         * SourcesGTK.txt:
2397         * platform/graphics/GLContext.cpp:
2398         (WebCore::GLContext::createContextForWindow): Check current display is X11 before trying to create a GLX context.
2399         * platform/graphics/PlatformDisplay.cpp:
2400         (WebCore::PlatformDisplay::createPlatformDisplay): Use USE(WPE_RENDERER) instead of USE(LIBWPE).
2401         * platform/graphics/PlatformDisplay.h:
2402         * platform/graphics/egl/GLContextEGL.cpp:
2403         (WebCore::GLContextEGL::createWindowContext): Use USE(WPE_RENDERER) instead of PLATFORM(WPE).
2404         (WebCore::GLContextEGL::createContext): Ditto.
2405         (WebCore::GLContextEGL::createSharingContext): Ditto.
2406         (WebCore::GLContextEGL::~GLContextEGL): Ditto.
2407         * platform/graphics/egl/GLContextEGL.h:
2408         * platform/graphics/egl/GLContextEGLLibWPE.cpp:
2409         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
2410         (WebCore::MediaPlayerPrivateGStreamerBase::ensureGstGLContext): Ditto.
2411         * platform/graphics/libwpe/PlatformDisplayLibWPE.cpp:
2412         (WebCore::PlatformDisplayLibWPE::PlatformDisplayLibWPE): In GTK port set the display as the shared one for compositing.
2413         * platform/graphics/libwpe/PlatformDisplayLibWPE.h:
2414
2415 2019-05-27  Takashi Komori  <Takashi.Komori@sony.com>
2416
2417         [CURL] Fix crashing SocketStreamHandle.
2418         https://bugs.webkit.org/show_bug.cgi?id=197873
2419
2420         Reviewed by Fujii Hironori.
2421
2422         When NetworkSocketStream was destructed SocketStreamHandleImple::platformClose was called wrongly times.
2423         This is because closed state is not set.
2424
2425         Test: http/tests/websocket/tests/hybi/workers/close.html
2426
2427         * platform/network/curl/SocketStreamHandleImpl.h:
2428         * platform/network/curl/SocketStreamHandleImplCurl.cpp:
2429         (WebCore::SocketStreamHandleImpl::platformSendInternal):
2430         (WebCore::SocketStreamHandleImpl::platformClose):
2431         (WebCore::SocketStreamHandleImpl::threadEntryPoint):
2432         (WebCore::SocketStreamHandleImpl::handleError):
2433         (WebCore::SocketStreamHandleImpl::callOnWorkerThread):
2434         (WebCore::SocketStreamHandleImpl::executeTasks):
2435
2436 2019-05-27  Oriol Brufau  <obrufau@igalia.com>
2437
2438         [css-grid] Preserve repeat() notation when serializing declared values
2439         https://bugs.webkit.org/show_bug.cgi?id=197840
2440
2441         Reviewed by Manuel Rego Casasnovas.
2442
2443         Tests: fast/css-grid-layout/grid-element-auto-repeat-get-set.html
2444                fast/css-grid-layout/grid-repeat-calc.html
2445                fast/css-grid-layout/named-grid-line-get-set.html
2446                imported/w3c/web-platform-tests/css/css-grid/grid-definition/grid-support-repeat-002.html
2447
2448         Before this change, a repeat() notation with an integral number of
2449         repetitions was expanded at parse time. This was observable when reading
2450         declared values using JS APIs.
2451
2452         This patch makes the parser preserve that notation, like it was already
2453         happening when the number of repetitions was automatic and not integral.
2454
2455         The resolved value in getComputedStyle() will still be expanded, though,
2456         as required by the spec.
2457
2458         * Sources.txt:
2459         * WebCore.xcodeproj/project.pbxproj:
2460         * css/CSSGridIntegerRepeatValue.cpp: Added.
2461         (WebCore::CSSGridIntegerRepeatValue::customCSSText const):
2462         (WebCore::CSSGridIntegerRepeatValue::equals const):
2463         * css/CSSGridIntegerRepeatValue.h: Added.
2464         * css/CSSValue.cpp:
2465         (WebCore::CSSValue::equals const):
2466         (WebCore::CSSValue::cssText const):
2467         (WebCore::CSSValue::destroy):
2468         * css/CSSValue.h:
2469         (WebCore::CSSValue::isGridIntegerRepeatValue const):
2470         * css/StyleBuilderConverter.h:
2471         (WebCore::StyleBuilderConverter::createGridTrackList):
2472         (WebCore::StyleBuilderConverter::convertGridTrackSizeList):
2473         * css/parser/CSSPropertyParser.cpp:
2474         (WebCore::consumeGridTrackRepeatFunction):
2475
2476 2019-05-27  Chris Dumez  <cdumez@apple.com>
2477
2478         Use a strongly-typed identifier for pages
2479         https://bugs.webkit.org/show_bug.cgi?id=198206
2480
2481         Reviewed by Youenn Fablet.
2482
2483         * WebCore/*:
2484
2485 2019-05-26  Simon Fraser  <simon.fraser@apple.com>
2486
2487         Move GraphicsLayerCA::adjustTiledLayerVisibleRect() to TileController
2488         https://bugs.webkit.org/show_bug.cgi?id=198266
2489
2490         Reviewed by Zalan Bujtas.
2491
2492         GraphicsLayerCA::adjustTiledLayerVisibleRect() was computing tile coverage for a
2493         TiledBacking, just like TileController::adjustTileCoverageRect(), so move the code
2494         into TileController as a first step to unifying more of this code. It's currently
2495         used for tiled compositing layers, including overflow:scroll, and tiled layers
2496         whose coverage may be affected by animations, so it's general-purpose.
2497
2498         TileController::adjustTileCoverageRect() is used for scrollable things, so rename
2499         it to adjustTileCoverageRectForScrolling().
2500
2501         No behavior change.
2502
2503         * platform/graphics/TiledBacking.h:
2504         * platform/graphics/ca/GraphicsLayerCA.cpp:
2505         (WebCore::GraphicsLayerCA::adjustCoverageRect const):
2506         (WebCore::GraphicsLayerCA::adjustTiledLayerVisibleRect): Deleted.
2507         * platform/graphics/ca/GraphicsLayerCA.h:
2508         * platform/graphics/ca/TileController.cpp:
2509         (WebCore::TileController::adjustTileCoverageRect const):
2510         (WebCore::TileController::adjustTileCoverageRectForScrolling const):
2511         * platform/graphics/ca/TileController.h:
2512
2513 2019-05-27  Simon Fraser  <simon.fraser@apple.com>
2514
2515         Fix Apple Internal builds after r245788.
2516
2517         * platform/PlatformScreen.h:
2518         (WebCore::screenHasTouchDevice):
2519         (WebCore::screenIsTouchPrimaryInputDevice):
2520
2521 2019-05-27  Zalan Bujtas  <zalan@apple.com>
2522
2523         [LFC][IFC] Ignore collapsed runs when setting the width on the associated display boxes.
2524         https://bugs.webkit.org/show_bug.cgi?id=198260
2525         <rdar://problem/51145704>
2526
2527         Reviewed by Antti Koivisto.
2528
2529         Collapsed runs don't contribute to the logical width of their containers.
2530
2531         Covered by existing tests.
2532
2533         * layout/inlineformatting/InlineFormattingContextLineLayout.cpp:
2534         (WebCore::Layout::InlineFormattingContext::LineLayout::closeLine const):
2535
2536 2019-05-27  Carlos Garcia Campos  <cgarcia@igalia.com>
2537
2538         Unreviewed. Fix GTK distcheck
2539
2540         Move mac headers to platform specific makefile.
2541
2542         * Headers.cmake:
2543         * PlatformMac.cmake:
2544
2545 2019-05-27  Carlos Garcia Campos  <cgarcia@igalia.com>
2546
2547         Touch support is reported even when the device doesn't have a touch screen
2548         https://bugs.webkit.org/show_bug.cgi?id=139681
2549
2550         Reviewed by Michael Catanzaro.
2551
2552         Add screenHasTouchDevice() and screenIsTouchPrimaryInputDevice() to PlatformScreen and use it to decide whether
2553         to expose touch events functionality or not.
2554
2555         * bindings/js/WebCoreBuiltinNames.h:
2556         * css/MediaQueryEvaluator.cpp:
2557         (WebCore::hoverEvaluate): Use screenIsTouchPrimaryInputDevice() when touch events are enabled at build time.
2558         (WebCore::anyHoverEvaluate): Use screenHasTouchDevice() when touch events are enabled at build time.
2559         (WebCore::pointerEvaluate): Use screenIsTouchPrimaryInputDevice() when touch events are enabled at build time.
2560         (WebCore::anyPointerEvaluate): Use screenHasTouchDevice() when touch events are enabled at build time.
2561         * dom/GlobalEventHandlers.idl: Make touch event attributes enabled at runtime.
2562         * page/RuntimeEnabledFeatures.cpp:
2563         (WebCore::RuntimeEnabledFeatures::touchEventsEnabled const): Return whether touch events are enabled.
2564         * page/RuntimeEnabledFeatures.h:
2565         (WebCore::RuntimeEnabledFeatures::setTouchEventsEnabled): Force touch events to be enabled or disabled.
2566         * platform/PlatformScreen.h:
2567         (WebCore::screenHasTouchDevice): Just return true when touch events are enabled at build time for non-gtk ports.
2568         (WebCore::screenIsTouchPrimaryInputDevice): Ditto.
2569         * platform/gtk/PlatformScreenGtk.cpp:
2570         (WebCore::screenHasTouchDevice):
2571         (WebCore::screenIsTouchPrimaryInputDevice):
2572         (WebCore::isTouchDevice):
2573         (WebCore::deviceAddedCallback):
2574         (WebCore::deviceRemovedCallback):
2575
2576 2019-05-26  Simon Fraser  <simon.fraser@apple.com>
2577
2578         Move VelocityData to WebCore
2579         https://bugs.webkit.org/show_bug.cgi?id=198261
2580
2581         Reviewed by Antti Koivisto.
2582
2583         Move VelocityData and HistoricalVelocityData to WebCore for future use in overflow scroll.
2584         
2585         VisibleContentRectUpdateInfo can now store a VelocityData (its timestamp is used as
2586         the timetamp for the entire update).
2587
2588         No behavior change.
2589
2590         * Headers.cmake:
2591         * Sources.txt:
2592         * WebCore.xcodeproj/project.pbxproj:
2593         * page/FrameView.cpp:
2594         (WebCore::FrameView::setScrollVelocity):
2595         * page/FrameView.h:
2596         * platform/graphics/TiledBacking.h:
2597         (WebCore::VelocityData::VelocityData): Deleted.
2598         (WebCore::VelocityData::velocityOrScaleIsChanging const): Deleted.
2599         * platform/graphics/ca/TileController.cpp:
2600         (WebCore::TileController::adjustTileCoverageRect const):
2601         * platform/graphics/ca/TileController.h:
2602
2603 2019-05-26  Simon Fraser  <simon.fraser@apple.com>
2604
2605         Add a GraphicsLayer::Type for ScrolledContents
2606         https://bugs.webkit.org/show_bug.cgi?id=198257
2607
2608         Reviewed by Zalan Bujtas.
2609
2610         This ScrolledContents layer type will be used to choose different tiling behaviors
2611         in a future patch.
2612
2613         * platform/graphics/GraphicsLayer.cpp:
2614         (WebCore::GraphicsLayer::supportsLayerType):
2615         * platform/graphics/GraphicsLayer.h:
2616         * platform/graphics/ca/GraphicsLayerCA.cpp:
2617         (WebCore::GraphicsLayer::supportsLayerType):
2618         (WebCore::GraphicsLayerCA::initialize):
2619         (WebCore::GraphicsLayerCA::adjustCoverageRect const):
2620         * rendering/RenderLayerBacking.cpp:
2621         (WebCore::RenderLayerBacking::updateScrollingLayers):
2622         * rendering/RenderLayerCompositor.cpp:
2623         (WebCore::RenderLayerCompositor::ensureRootLayer):
2624
2625 2019-05-26  John Wilander  <wilander@apple.com>
2626
2627         Resource Load Statistics: Downgrade document.referrer to the referrer's eTLD+1 if the page was navigated to with a prevalent resource referrer containing link decoration
2628         https://bugs.webkit.org/show_bug.cgi?id=198227
2629         <rdar://problem/51117258>
2630
2631         Reviewed by Alex Christensen.
2632
2633         Test: http/tests/resourceLoadStatistics/downgraded-referrer-for-navigation-with-link-query-from-prevalent-resource.html
2634
2635         * Headers.cmake:
2636         * WebCore.xcodeproj/project.pbxproj:
2637         * dom/Document.cpp:
2638         (WebCore::Document::referrer const):
2639             Now checks if the referrer has been overridden.
2640         (WebCore::Document::wasLoadedWithDataTransferFromPrevalentResource):
2641         (WebCore::Document::downgradeReferrerToRegistrableDomain):
2642         * dom/Document.h:
2643         * page/CrossSiteNavigationDataTransfer.h: Added.
2644             New option set for the growing number of navigational data transfers we care about.
2645         * platform/network/NetworkStorageSession.cpp:
2646         (WebCore::NetworkStorageSession::didCommitCrossSiteLoadWithDataTransferFromPrevalentResource):
2647         (WebCore::NetworkStorageSession::committedCrossSiteLoadWithLinkDecoration): Deleted.
2648             New name since we no longer only look for link decoration but also other means of navigational data transfer.
2649         * platform/network/NetworkStorageSession.h:
2650
2651 2019-05-26  Zalan Bujtas  <zalan@apple.com>
2652
2653         [LFC][Verification] Add areEssentiallyEqual for LayoutRect
2654         https://bugs.webkit.org/show_bug.cgi?id=198250
2655         <rdar://problem/51140119>
2656
2657         Reviewed by Antti Koivisto.
2658
2659         WebKit's inline layout is a mix of int/float/LayoutUnit types, while LFC mostly uses LayoutUnit.
2660         When we compute the used size of a block container (based on the inline tree), the final value might go through a few conversions.
2661
2662         * layout/Verification.cpp:
2663         (WebCore::Layout::areEssentiallyEqual):
2664         (WebCore::Layout::outputMismatchingBlockBoxInformationIfNeeded):
2665
2666 2019-05-26  Wenson Hsieh  <wenson_hsieh@apple.com>
2667
2668         [iOS] Dropped text, attachments, and images should animate into place
2669         https://bugs.webkit.org/show_bug.cgi?id=198243
2670         <rdar://problem/35205373>
2671
2672         Reviewed by Tim Horton.
2673
2674         Add some hooks to notify the chrome client when an HTMLImageElement's image is finished loading. See WebKit
2675         changelog for more detail.
2676
2677         Test: DragAndDropTests.DropPreviewForImageInEditableArea
2678
2679         * loader/EmptyClients.h:
2680         * page/ChromeClient.h:
2681         * page/Page.cpp:
2682         (WebCore::Page::didFinishLoadingImageForElement):
2683         * page/Page.h:
2684         * rendering/RenderImage.cpp:
2685         (WebCore::RenderImage::notifyFinished):
2686
2687 2019-05-25  Zalan Bujtas  <zalan@apple.com>
2688
2689         [LFC][IFC] Introduce DisplayRun to display tree
2690         https://bugs.webkit.org/show_bug.cgi?id=197198
2691
2692         Reviewed by Antti Koivisto.
2693
2694         Add a simple inline layout implementation. Now we've got DisplayBoxes for layout boxes and
2695         DisplayRuns for inline runs.
2696
2697         * Sources.txt:
2698         * WebCore.xcodeproj/project.pbxproj:
2699         * layout/FormattingContextGeometry.cpp:
2700         (WebCore::Layout::contentHeightForFormattingContextRoot):
2701         * layout/Verification.cpp:
2702         (WebCore::Layout::areEssentiallyEqual):
2703         (WebCore::Layout::outputMismatchingSimpleLineInformationIfNeeded):
2704         (WebCore::Layout::checkForMatchingNonTextRuns):
2705         (WebCore::Layout::checkForMatchingTextRuns):
2706         (WebCore::Layout::outputMismatchingComplexLineInformationIfNeeded):
2707         (WebCore::Layout::outputMismatchingBlockBoxInformationIfNeeded):
2708         (WebCore::Layout::resolveForRelativePositionIfNeeded): Deleted.
2709         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
2710         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin):
2711         * layout/displaytree/DisplayBox.cpp:
2712         (WebCore::Display::Box::marginBox const):
2713         (WebCore::Display::Box::nonCollapsedMarginBox const):
2714         (WebCore::Display::Box::borderBox const):
2715         (WebCore::Display::Box::paddingBox const):
2716         (WebCore::Display::Box::contentBox const):
2717         (WebCore::Display::Box::Rect::Rect): Deleted.
2718         * layout/displaytree/DisplayBox.h:
2719         (WebCore::Display::Box::rectWithMargin const):
2720         (WebCore::Display::Box::horizontalMargin const):
2721         (WebCore::Display::Box::Rect::intersects const): Deleted.
2722         (WebCore::Display::Box::Rect::invalidateTop): Deleted.
2723         (WebCore::Display::Box::Rect::invalidateLeft): Deleted.
2724         (WebCore::Display::Box::Rect::invalidateWidth): Deleted.
2725         (WebCore::Display::Box::Rect::invalidateHeight): Deleted.
2726         (WebCore::Display::Box::Rect::hasValidPosition const): Deleted.
2727         (WebCore::Display::Box::Rect::hasValidSize const): Deleted.
2728         (WebCore::Display::Box::Rect::hasValidGeometry const): Deleted.
2729         (WebCore::Display::Box::Rect::invalidatePosition): Deleted.
2730         (WebCore::Display::Box::Rect::setHasValidPosition): Deleted.
2731         (WebCore::Display::Box::Rect::setHasValidSize): Deleted.
2732         (WebCore::Display::Box::Rect::top const): Deleted.
2733         (WebCore::Display::Box::Rect::left const): Deleted.
2734         (WebCore::Display::Box::Rect::bottom const): Deleted.
2735         (WebCore::Display::Box::Rect::right const): Deleted.
2736         (WebCore::Display::Box::Rect::topLeft const): Deleted.
2737         (WebCore::Display::Box::Rect::bottomRight const): Deleted.
2738         (WebCore::Display::Box::Rect::size const): Deleted.
2739         (WebCore::Display::Box::Rect::width const): Deleted.
2740         (WebCore::Display::Box::Rect::height const): Deleted.
2741         (WebCore::Display::Box::Rect::setTopLeft): Deleted.
2742         (WebCore::Display::Box::Rect::setTop): Deleted.
2743         (WebCore::Display::Box::Rect::setLeft): Deleted.
2744         (WebCore::Display::Box::Rect::setWidth): Deleted.
2745         (WebCore::Display::Box::Rect::setHeight): Deleted.
2746         (WebCore::Display::Box::Rect::setSize): Deleted.
2747         (WebCore::Display::Box::Rect::shiftLeftTo): Deleted.
2748         (WebCore::Display::Box::Rect::shiftRightTo): Deleted.
2749         (WebCore::Display::Box::Rect::shiftTopTo): Deleted.
2750         (WebCore::Display::Box::Rect::shiftBottomTo): Deleted.
2751         (WebCore::Display::Box::Rect::moveHorizontally): Deleted.
2752         (WebCore::Display::Box::Rect::moveVertically): Deleted.
2753         (WebCore::Display::Box::Rect::expand): Deleted.
2754         (WebCore::Display::Box::Rect::clone const): Deleted.
2755         (WebCore::Display::Box::Rect::operator LayoutRect const): Deleted.
2756         * layout/displaytree/DisplayRect.h: Added.
2757         (WebCore::Display::Rect::expandHorizontally):
2758         (WebCore::Display::Rect::expandVertically):
2759         (WebCore::Display::Rect::intersects const):
2760         (WebCore::Display::Rect::invalidateTop):
2761         (WebCore::Display::Rect::invalidateLeft):
2762         (WebCore::Display::Rect::invalidateWidth):
2763         (WebCore::Display::Rect::invalidateHeight):
2764         (WebCore::Display::Rect::hasValidPosition const):
2765         (WebCore::Display::Rect::hasValidSize const):
2766         (WebCore::Display::Rect::hasValidGeometry const):
2767         (WebCore::Display::Rect::Rect):
2768         (WebCore::Display::Rect::invalidatePosition):
2769         (WebCore::Display::Rect::setHasValidPosition):
2770         (WebCore::Display::Rect::setHasValidSize):
2771         (WebCore::Display::Rect::top const):
2772         (WebCore::Display::Rect::left const):
2773         (WebCore::Display::Rect::bottom const):
2774         (WebCore::Display::Rect::right const):
2775         (WebCore::Display::Rect::topLeft const):
2776         (WebCore::Display::Rect::bottomRight const):
2777         (WebCore::Display::Rect::size const):
2778         (WebCore::Display::Rect::width const):
2779         (WebCore::Display::Rect::height const):
2780         (WebCore::Display::Rect::setTopLeft):
2781         (WebCore::Display::Rect::setTop):
2782         (WebCore::Display::Rect::setLeft):
2783         (WebCore::Display::Rect::setWidth):
2784         (WebCore::Display::Rect::setHeight):
2785         (WebCore::Display::Rect::setSize):
2786         (WebCore::Display::Rect::shiftLeftTo):
2787         (WebCore::Display::Rect::shiftRightTo):
2788         (WebCore::Display::Rect::shiftTopTo):
2789         (WebCore::Display::Rect::shiftBottomTo):
2790         (WebCore::Display::Rect::moveHorizontally):
2791         (WebCore::Display::Rect::moveVertically):
2792         (WebCore::Display::Rect::expand):
2793         (WebCore::Display::Rect::clone const):
2794         (WebCore::Display::Rect::operator LayoutRect const):
2795         * layout/displaytree/DisplayRun.h: Renamed from Source/WebCore/layout/inlineformatting/InlineRun.h.
2796         (WebCore::Display::Run::TextContext::start const):
2797         (WebCore::Display::Run::TextContext::end const):
2798         (WebCore::Display::Run::TextContext::length const):
2799         (WebCore::Display::Run::TextContext::expand):
2800         (WebCore::Display::Run::logicalTopLeft const):
2801         (WebCore::Display::Run::logicalLeft const):
2802         (WebCore::Display::Run::logicalRight const):
2803         (WebCore::Display::Run::logicalTop const):
2804         (WebCore::Display::Run::logicalBottom const):
2805         (WebCore::Display::Run::logicalWidth const):
2806         (WebCore::Display::Run::logicalHeight const):
2807         (WebCore::Display::Run::setLogicalWidth):
2808         (WebCore::Display::Run::setLogicalTop):
2809         (WebCore::Display::Run::setLogicalLeft):
2810         (WebCore::Display::Run::setLogicalRight):
2811         (WebCore::Display::Run::moveVertically):
2812         (WebCore::Display::Run::moveHorizontally):
2813         (WebCore::Display::Run::expandVertically):
2814         (WebCore::Display::Run::expandHorizontally):
2815         (WebCore::Display::Run::setTextContext):
2816         (WebCore::Display::Run::textContext):
2817         (WebCore::Display::Run::textContext const):
2818         (WebCore::Display::Run::Run):
2819         (WebCore::Display::Run::TextContext::TextContext):
2820         * layout/floats/FloatAvoider.cpp:
2821         (WebCore::Layout::FloatAvoider::rectInContainingBlock const):
2822         * layout/floats/FloatAvoider.h:
2823         (WebCore::Layout::FloatAvoider::rect const):
2824         * layout/floats/FloatBox.cpp:
2825         (WebCore::Layout::FloatBox::rect const):
2826         * layout/floats/FloatBox.h:
2827         * layout/floats/FloatingContext.cpp:
2828         (WebCore::Layout::FloatPair::intersects const):
2829         * layout/floats/FloatingState.h:
2830         (WebCore::Layout::FloatingState::FloatItem::rectWithMargin const):
2831         * layout/inlineformatting/InlineFormattingContext.cpp:
2832         (WebCore::Layout::InlineFormattingContext::layout const):
2833         (WebCore::Layout::InlineFormattingContext::computeIntrinsicWidthConstraints const):
2834         (WebCore::Layout::InlineFormattingContext::initializeMarginBorderAndPaddingForGenericInlineBox const):
2835         (WebCore::Layout::InlineFormattingContext::computeMarginBorderAndPaddingForInlineContainer const):
2836         (WebCore::Layout::InlineFormattingContext::computeIntrinsicWidthForFloatBox const):
2837         (WebCore::Layout::InlineFormattingContext::computeIntrinsicWidthForInlineBlock const):
2838         (WebCore::Layout::InlineFormattingContext::computeHorizontalMargin const):
2839         (WebCore::Layout::InlineFormattingContext::layoutFormattingContextRoot const):
2840         (WebCore::Layout::InlineFormattingContext::collectInlineContent const):
2841         (WebCore::Layout::InlineFormattingContext::computeMargin const): Deleted.
2842         (WebCore::Layout::addDetachingRules): Deleted.
2843         (WebCore::Layout::createAndAppendInlineItem): Deleted.
2844         * layout/inlineformatting/InlineFormattingContext.h:
2845         (WebCore::Layout::InlineFormattingContext::LineLayout::layoutState const):
2846         * layout/inlineformatting/InlineFormattingContextLineLayout.cpp:
2847         (WebCore::Layout::halfLeadingMetrics):
2848         (WebCore::Layout::Line::availableWidth const):
2849         (WebCore::Layout::Line::contentLogicalRight const):
2850         (WebCore::Layout::Line::contentLogicalWidth const):
2851         (WebCore::Layout::Line::logicalTop const):
2852         (WebCore::Layout::Line::logicalLeft const):
2853         (WebCore::Layout::Line::logicalRight const):
2854         (WebCore::Layout::Line::logicalBottom const):
2855         (WebCore::Layout::Line::logicalWidth const):
2856         (WebCore::Layout::Line::logicalHeight const):
2857         (WebCore::Layout::Line::LineItem::LineItem):
2858         (WebCore::Layout::Line::Line):
2859         (WebCore::Layout::Line::reset):
2860         (WebCore::Layout::Line::close):
2861         (WebCore::Layout::Line::removeTrailingTrimmableContent):
2862         (WebCore::Layout::Line::moveLogicalLeft):
2863         (WebCore::Layout::Line::moveLogicalRight):
2864         (WebCore::Layout::isTrimmableContent):
2865         (WebCore::Layout::Line::trailingTrimmableWidth const):
2866         (WebCore::Layout::Line::hasContent const):
2867         (WebCore::Layout::Line::appendNonBreakableSpace):
2868         (WebCore::Layout::Line::appendInlineContainerStart):
2869         (WebCore::Layout::Line::appendInlineContainerEnd):
2870         (WebCore::Layout::Line::appendTextContent):
2871         (WebCore::Layout::Line::appendNonTextContent):
2872         (WebCore::Layout::Line::appendHardLineBreak):
2873         (WebCore::Layout::UncommittedContent::isEmpty const):
2874         (WebCore::Layout::UncommittedContent::width const):
2875         (WebCore::Layout::UncommittedContent::add):
2876         (WebCore::Layout::UncommittedContent::reset):
2877         (WebCore::Layout::InlineFormattingContext::LineLayout::LineLayout):
2878         (WebCore::Layout::InlineFormattingContext::LineLayout::initializeLine const):
2879         (WebCore::Layout::InlineFormattingContext::LineLayout::layout const):
2880         (WebCore::Layout::InlineFormattingContext::LineLayout::closeLine const):
2881         (WebCore::Layout::InlineFormattingContext::LineLayout::handleFloat const):
2882         (WebCore::Layout::InlineFormattingContext::LineLayout::commitInlineItemToLine const):
2883         (WebCore::Layout::horizontalAdjustmentForAlignment):
2884         (WebCore::Layout::InlineFormattingContext::LineLayout::alignRuns const):
2885         (WebCore::Layout::Line::isClosed const): Deleted.
2886         (WebCore::Layout::Line::isFirstLine const): Deleted.
2887         (WebCore::Layout::Line::runs): Deleted.
2888         (WebCore::Layout::Line::contentLogicalLeft const): Deleted.
2889         (WebCore::Layout::Line::lastRunType const): Deleted.
2890         (WebCore::Layout::Line::init): Deleted.
2891         (WebCore::Layout::Line::adjustLogicalLeft): Deleted.
2892         (WebCore::Layout::Line::adjustLogicalRight): Deleted.
2893         (WebCore::Layout::Line::appendContent): Deleted.
2894         (WebCore::Layout::InlineFormattingContext::LineLayout::initializeNewLine const): Deleted.
2895         (WebCore::Layout::InlineFormattingContext::LineLayout::splitInlineRunIfNeeded const): Deleted.
2896         (WebCore::Layout::InlineFormattingContext::LineLayout::createFinalRuns const): Deleted.
2897         (WebCore::Layout::InlineFormattingContext::LineLayout::postProcessInlineRuns const): Deleted.
2898         (WebCore::Layout::InlineFormattingContext::LineLayout::appendContentToLine const): Deleted.
2899         (WebCore::Layout::InlineFormattingContext::LineLayout::computeFloatPosition const): Deleted.
2900         (WebCore::Layout::InlineFormattingContext::LineLayout::placeInFlowPositionedChildren const): Deleted.
2901         (WebCore::Layout::adjustedLineLogicalLeft): Deleted.
2902         (WebCore::Layout::InlineFormattingContext::LineLayout::justifyRuns): Deleted.
2903         (WebCore::Layout::InlineFormattingContext::LineLayout::computeExpansionOpportunities const): Deleted.
2904         (WebCore::Layout::InlineFormattingContext::LineLayout::runWidth const): Deleted.
2905         * layout/inlineformatting/InlineFormattingState.h:
2906         (WebCore::Layout::InlineFormattingState::inlineItems):
2907         (WebCore::Layout::InlineFormattingState::lineBoxes):
2908         (WebCore::Layout::InlineFormattingState::addInlineItem):
2909         (WebCore::Layout::InlineFormattingState::addInlineRun):
2910         (WebCore::Layout::InlineFormattingState::addLineBox):
2911         (WebCore::Layout::InlineFormattingState::inlineContent): Deleted.
2912         (WebCore::Layout::InlineFormattingState::lastInlineItem const): Deleted.
2913         (WebCore::Layout::InlineFormattingState::appendInlineRun): Deleted.
2914         * layout/inlineformatting/InlineItem.h:
2915         (WebCore::Layout::InlineItem::type const):
2916         (WebCore::Layout::InlineItem::isText const):
2917         (WebCore::Layout::InlineItem::isBox const):
2918         (WebCore::Layout::InlineItem::isHardLineBreak const):
2919         (WebCore::Layout::InlineItem::isFloat const):
2920         (WebCore::Layout::InlineItem::isLineBreak const):
2921         (WebCore::Layout::InlineItem::isContainerStart const):
2922         (WebCore::Layout::InlineItem::isContainerEnd const):
2923         (WebCore::Layout::InlineItem::InlineItem):
2924         (WebCore::Layout::InlineItem::setWidth):
2925         (WebCore::Layout::InlineItem::width const):
2926         (WebCore::Layout::InlineItem::addDetachingRule): Deleted.
2927         (WebCore::Layout::InlineItem::detachingRules const): Deleted.
2928         (WebCore::Layout::InlineItem::nonBreakableStart const): Deleted.
2929         (WebCore::Layout::InlineItem::nonBreakableEnd const): Deleted.
2930         (WebCore::Layout::InlineItem::addNonBreakableStart): Deleted.
2931         (WebCore::Layout::InlineItem::addNonBreakableEnd): Deleted.
2932         (WebCore::Layout::InlineItem::textContent const): Deleted.
2933         * layout/inlineformatting/InlineLineBox.h: Copied from Source/WebCore/layout/floats/FloatBox.h.
2934         (WebCore::Layout::LineBox::logicalTopLeft const):
2935         (WebCore::Layout::LineBox::logicalLeft const):
2936         (WebCore::Layout::LineBox::logicalRight const):
2937         (WebCore::Layout::LineBox::logicalTop const):
2938         (WebCore::Layout::LineBox::logicalBottom const):
2939         (WebCore::Layout::LineBox::logicalWidth const):
2940         (WebCore::Layout::LineBox::logicalHeight const):
2941         (WebCore::Layout::LineBox::LineBox):
2942         * layout/inlineformatting/InlineLineBreaker.cpp:
2943         (WebCore::Layout::LineBreaker::LineBreaker):
2944         (WebCore::Layout::LineBreaker::breakingContext):
2945         (WebCore::Layout::LineBreaker::wordBreakingBehavior const):
2946         (WebCore::Layout::LineBreaker::runWidth const):
2947         (WebCore::Layout::LineBreaker::isAtBreakingOpportunity):
2948         (WebCore::Layout::LineBreaker::textWidth const):
2949         (WebCore::Layout::InlineLineBreaker::InlineLineBreaker): Deleted.
2950         (WebCore::Layout::InlineLineBreaker::nextRun): Deleted.
2951         (WebCore::Layout::InlineLineBreaker::isAtContentEnd const): Deleted.
2952         (WebCore::Layout::InlineLineBreaker::lineBreakingBehavior): Deleted.
2953         (WebCore::Layout::InlineLineBreaker::runWidth const): Deleted.
2954         (WebCore::Layout::InlineLineBreaker::textWidth const): Deleted.
2955         (WebCore::Layout::InlineLineBreaker::splitRun): Deleted.
2956         (WebCore::Layout::InlineLineBreaker::adjustSplitPositionWithHyphenation const): Deleted.
2957         * layout/inlineformatting/InlineLineBreaker.h:
2958         * layout/inlineformatting/InlineRunProvider.cpp: Removed.
2959         * layout/inlineformatting/InlineRunProvider.h: Removed.
2960         * layout/inlineformatting/InlineTextItem.cpp: Added.
2961         (WebCore::Layout::isWhitespaceCharacter):
2962         (WebCore::Layout::isSoftLineBreak):
2963         (WebCore::Layout::moveToNextNonWhitespacePosition):
2964         (WebCore::Layout::moveToNextBreakablePosition):
2965         (WebCore::Layout::InlineTextItem::createAndAppendTextItems):
2966         (WebCore::Layout::InlineTextItem::InlineTextItem):
2967         * layout/inlineformatting/InlineTextItem.h: Copied from Source/WebCore/layout/inlineformatting/text/TextUtil.h.
2968         (WebCore::Layout::InlineTextItem::start const):
2969         (WebCore::Layout::InlineTextItem::end const):
2970         (WebCore::Layout::InlineTextItem::length const):
2971         (WebCore::Layout::InlineTextItem::isWhitespace const):
2972         (WebCore::Layout::InlineTextItem::isCollapsed const):
2973         * layout/inlineformatting/text/TextUtil.cpp:
2974         (WebCore::Layout::TextUtil::hyphenPositionBefore):
2975         (WebCore::Layout::TextUtil::width):
2976         (WebCore::Layout::TextUtil::fixedPitchWidth):
2977         * layout/inlineformatting/text/TextUtil.h:
2978         * layout/layouttree/LayoutBox.h:
2979         * layout/layouttree/LayoutReplaced.cpp:
2980         (WebCore::Layout::Replaced::intrinsicRatio const):
2981         * layout/layouttree/LayoutTreeBuilder.cpp:
2982         (WebCore::Layout::accumulatedOffsetForInFlowPositionedContinuation):
2983         (WebCore::Layout::TreeBuilder::createSubTree):
2984         (WebCore::Layout::outputInlineRuns):
2985         (WebCore::Layout::outputLayoutBox):
2986
2987 2019-05-25  Wenson Hsieh  <wenson_hsieh@apple.com>
2988
2989         [iOS] Respect -[NSItemProvider preferredPresentationSize] when dropping images
2990         https://bugs.webkit.org/show_bug.cgi?id=198242
2991
2992         Reviewed by Beth Dakin.
2993
2994         Teach the web content reader to respect the -preferredPresentationSize when creating attachment-backed image
2995         elements. See below for more details.
2996
2997         Test: WKAttachmentTestsIOS.InsertDroppedImageWithPreferredPresentationSize
2998
2999         * editing/WebContentReader.h:
3000         * editing/cocoa/WebContentReaderCocoa.mm:
3001         (WebCore::attachmentForFilePath):
3002         (WebCore::attachmentForData):
3003
3004         When creating attachment-backed image elements, additionally set width and height attributes from the preferred
3005         presentation size, if specified.
3006
3007         (WebCore::WebContentReader::readFilePath):
3008
3009         Add a version of readFilePath that takes a single file path, and an optional preferred presentation size.
3010
3011         (WebCore::WebContentReader::readFilePaths):
3012
3013         Reimplement readFilePaths in terms of readFilePath.
3014
3015         (WebCore::WebContentReader::readDataBuffer):
3016
3017         Add more plumbing for preferredPresentationSize.
3018
3019         * platform/Pasteboard.h:
3020         (WebCore::PasteboardWebContentReader::readFilePath):
3021         (WebCore::PasteboardWebContentReader::readDataBuffer):
3022         * platform/ios/PasteboardIOS.mm:
3023         (WebCore::Pasteboard::read):
3024         (WebCore::Pasteboard::readRespectingUTIFidelities):
3025
3026         Forward PasteboardItemInfo's preferredPresentationSize to the web content reader.
3027
3028 2019-05-25  Antoine Quint  <graouts@apple.com>
3029
3030         Opt naver.com into simulated mouse events quirk on iOS
3031         https://bugs.webkit.org/show_bug.cgi?id=198248
3032         <rdar://problem/50598281>
3033
3034         Reviewed by Brent Fulgham.
3035
3036         * page/Quirks.cpp:
3037         (WebCore::Quirks::shouldDispatchSimulatedMouseEvents const):
3038
3039 2019-05-25  Youenn Fablet  <youenn@apple.com>
3040
3041         media/video-remote-control-playpause.html is timing out after r245712
3042         https://bugs.webkit.org/show_bug.cgi?id=198238
3043
3044         Reviewed by Eric Carlson.
3045
3046         Fix regression introduced in r245712.
3047         Covered by test no longer timing out.
3048
3049         * platform/audio/PlatformMediaSessionManager.cpp:
3050         (WebCore::PlatformMediaSessionManager::sessionWillEndPlayback):
3051
3052 2019-05-25  Simon Fraser  <simon.fraser@apple.com>
3053
3054         [Async overflow scrolling] Absolute positioned element inside async overflow scroll didn't get composited sometimes
3055         https://bugs.webkit.org/show_bug.cgi?id=198237
3056
3057         Reviewed by Antti Koivisto.
3058
3059         The logic in requiresCompositingForIndirectReason() that decides if we need to do
3060         compositing for a layer that needs to move independently of its enclosing scroller
3061         was wrong.
3062
3063         Instead of asking question about the enclosing compositing layer, it needs to ask
3064         whether it has different positioning behavior from the layer that it would
3065         otherwise paint into, which is its paint-order parent.
3066
3067         "paintsIntoProvidedBacking" already does a containing-block check against the
3068         scroller, so we know we don't have to do the check in that case.
3069
3070         Test: scrollingcoordinator/scrolling-tree/absolute-inside-stacking-in-scroller.html
3071
3072         * rendering/RenderLayerCompositor.cpp:
3073         (WebCore::RenderLayerCompositor::computeCompositingRequirements):
3074         (WebCore::enclosingCompositedScrollingLayer):
3075         (WebCore::isScrolledByOverflowScrollLayer):
3076         (WebCore::isNonScrolledLayerInsideScrolledCompositedAncestor):
3077         (WebCore::RenderLayerCompositor::requiresCompositingForIndirectReason const):
3078         * rendering/RenderLayerCompositor.h:
3079
3080 2019-05-25  Simon Fraser  <simon.fraser@apple.com>
3081
3082         [macOS] Fix programmatic scroll in RTL overflow with async scrolling enabled
3083         https://bugs.webkit.org/show_bug.cgi?id=198226
3084
3085         Reviewed by Antti Koivisto.
3086
3087         On macOS we need to use a scroll offset to set the layer position, not
3088         a scroll position.
3089
3090         Test: scrollingcoordinator/mac/rtl-programmatic-overflow-scroll.html
3091
3092         * page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm:
3093         (WebCore::ScrollingTreeOverflowScrollingNodeMac::repositionScrollingLayers):
3094
3095 2019-05-24  Joonghun Park  <jh718.park@samsung.com>
3096
3097         Make computed width of non-replaced inline return computed style.
3098         https://bugs.webkit.org/show_bug.cgi?id=197814
3099
3100         Reviewed by Antti Koivisto.
3101
3102         Currently, Computed width of non-replaced inline incorrectly returns "auto"
3103         instead of the computed value.
3104         This patch changes the behavior according to
3105         https://drafts.csswg.org/cssom/#resolved-value as below.
3106
3107         'If the property applies to the element or pseudo-element
3108         and the resolved value of the display property is not none or contents,
3109         then the resolved value is the used value.
3110         Otherwise the resolved value is the computed value.'
3111
3112         * css/CSSComputedStyleDeclaration.cpp:
3113         (WebCore::ComputedStyleExtractor::valueForPropertyinStyle):
3114
3115 2019-05-24  Myles C. Maxfield  <mmaxfield@apple.com>
3116
3117         [WHLSL] Allow vertex attributes to have arbitrary names in the shader
3118         https://bugs.webkit.org/show_bug.cgi?id=198235
3119
3120         Reviewed by Dean Jackson and Justin Fan.
3121
3122         Metal doesn't allow arbitrary vertex attribute IDs. If you try to create a vertex attribute > 16,
3123         the Metal validation layer will assert. So, we need to have a mapping from whatever the WebGPU
3124         API says the vertex attribute IDs should be to the internally-used vertex attribute IDs.
3125
3126         Test: webgpu/whlsl-arbitrary-vertex-attribute-locations.html
3127
3128         * Modules/webgpu/WHLSL/Metal/WHLSLEntryPointScaffolding.cpp:
3129         (WebCore::WHLSL::Metal::VertexEntryPointScaffolding::VertexEntryPointScaffolding):
3130         * Modules/webgpu/WHLSL/WHLSLPipelineDescriptor.h:
3131         * Modules/webgpu/WHLSL/WHLSLSemanticMatcher.cpp:
3132         (WebCore::WHLSL::matchVertexAttributes):
3133         * platform/graphics/gpu/cocoa/GPURenderPipelineMetal.mm:
3134         (WebCore::convertRenderPipelineDescriptor):
3135         (WebCore::trySetInputStateForPipelineDescriptor):
3136
3137 2019-05-24  Timothy Hatcher  <timothy@apple.com>
3138
3139         Refactor how showLetterpressedGlyphsWithAdvances gets the graphics context.
3140         https://bugs.webkit.org/show_bug.cgi?id=198225
3141
3142         Reviewed by Dean Jackson.
3143
3144         * platform/graphics/cocoa/FontCascadeCocoa.mm:
3145         (WebCore::showLetterpressedGlyphsWithAdvances):
3146         (WebCore::FontCascade::drawGlyphs):
3147
3148 2019-05-24  Timothy Hatcher  <timothy@apple.com>
3149
3150         Plumb dark appearance down to GraphicsContext.
3151         https://bugs.webkit.org/show_bug.cgi?id=198224
3152         rdar://problem/51068494
3153
3154         Reviewed by Dean Jackson.
3155
3156         No test yet, as it is not testable until this gets used.
3157
3158         * platform/graphics/GraphicsContext.cpp:
3159         (WebCore::GraphicsContextStateChange::changesFromState const):
3160         (WebCore::GraphicsContextStateChange::accumulate):
3161         (WebCore::GraphicsContextStateChange::apply const):
3162         (WebCore::GraphicsContextStateChange::dump const):
3163         (WebCore::GraphicsContext::setUseDarkAppearance):
3164         * platform/graphics/GraphicsContext.h:
3165         (WebCore::GraphicsContext::useDarkAppearance const):
3166         * rendering/TextPaintStyle.cpp:
3167         (WebCore::TextPaintStyle::operator== const):
3168         (WebCore::computeTextPaintStyle):
3169         (WebCore::updateGraphicsContext):
3170         * rendering/TextPaintStyle.h:
3171
3172 2019-05-24  Youenn Fablet  <youenn@apple.com>
3173
3174         Make sure completion handler is always called in SWServer::startSuspension
3175         https://bugs.webkit.org/show_bug.cgi?id=198215
3176
3177         Reviewed by Alex Christensen.
3178
3179         * workers/service/server/SWServer.cpp:
3180         (WebCore::SWServer::startSuspension):
3181         Make sure completion handler is called in case of no registration store.
3182
3183 2019-05-24  Ryosuke Niwa  <rniwa@webkit.org>
3184
3185         Asssertion failure in dispatchSubtreeModifiedEvent due to TextFieldInputType updating UA shadow tree inside Element::removedFromAncestor
3186         https://bugs.webkit.org/show_bug.cgi?id=198216
3187
3188         Reviewed by Brent Fulgham.
3189
3190         The bug was caused by ListAttributeTargetObserver::idTargetChanged() updating the shadow tree of an input element
3191         within Element::removedFromAncestor via TextFieldInputType::createDataListDropdownIndicator(). Fixed it by
3192         supressing the assertions with ScriptDisallowedScope::EventAllowedScope since it's always safe to update
3193         UA shadow trees of input elements as it's not exposed to author scripts.
3194
3195         Avoiding the creation of dropdown indicator in this particular scenario is a lot more involved and it's not
3196         particularly correct because there could be another datalist element which matches the ID specified in list
3197         content attribute after the removal of the old datalist element.
3198
3199         Test: fast/forms/datalist/datalist-removal-assertion.html
3200
3201         * html/TextFieldInputType.cpp:
3202         (WebCore::TextFieldInputType::createDataListDropdownIndicator):
3203         (WebCore::TextFieldInputType::createContainer):
3204         * html/shadow/DataListButtonElement.cpp:
3205         (WebCore::DataListButtonElement::DataListButtonElement):
3206
3207 2019-05-24  Saam barati  <sbarati@apple.com>
3208
3209         [WHLSL] ReadModifyWriteExpression always has a result and new value expression
3210         https://bugs.webkit.org/show_bug.cgi?id=198079
3211
3212         Reviewed by Myles Maxfield.
3213
3214         Let's not pretend it might not.
3215
3216         * Modules/webgpu/WHLSL/AST/WHLSLReadModifyWriteExpression.h:
3217         (WebCore::WHLSL::AST::ReadModifyWriteExpression::newValueExpression):
3218         (WebCore::WHLSL::AST::ReadModifyWriteExpression::resultExpression):
3219         (WebCore::WHLSL::AST::ReadModifyWriteExpression::takeNewValueExpression):
3220         (WebCore::WHLSL::AST::ReadModifyWriteExpression::takeResultExpression):
3221         * Modules/webgpu/WHLSL/WHLSLASTDumper.cpp:
3222         (WebCore::WHLSL::ASTDumper::visit):
3223         * Modules/webgpu/WHLSL/WHLSLChecker.cpp:
3224         (WebCore::WHLSL::Checker::visit):
3225         * Modules/webgpu/WHLSL/WHLSLPropertyResolver.cpp:
3226         (WebCore::WHLSL::PropertyResolver::visit):
3227         * Modules/webgpu/WHLSL/WHLSLVisitor.cpp:
3228         (WebCore::WHLSL::Visitor::visit):
3229
3230 2019-05-23  Simon Fraser  <simon.fraser@apple.com>
3231
3232         With async overflow scrolling, programmatic scroll to a negative offset fails to clamp the scroll offset
3233         https://bugs.webkit.org/show_bug.cgi?id=198208
3234         <rdar://problem/49720087>
3235
3236         Reviewed by Zalan Bujtas.
3237
3238         RenderLayer::scrollToOffset() needs to pass the clamped offset to scrollingCoordinator->requestScrollPositionUpdate(),
3239         otherwise the scrolling tree will round-trip a negative value and scrollLeft will end up negative.
3240
3241         Test: fast/scrolling/programmatic-scroll-to-negative-offset.html
3242
3243         * rendering/RenderLayer.cpp:
3244         (WebCore::RenderLayer::scrollToOffset):
3245
3246 2019-05-23  Devin Rousso  <drousso@apple.com>
3247
3248         Web Inspector: Overlay: rulers/guides should be shown whenever element selection is enabled
3249         https://bugs.webkit.org/show_bug.cgi?id=198088
3250
3251         Reviewed by Timothy Hatcher.
3252
3253         When trying to "measure" the absolute position (to the viewport) or relative position (to
3254         another element) of a given element, often the easiest way is to enable Element Selection
3255         and Show Rulers at the same time.
3256
3257         This can have the undesired "side-effect" of having the rulers be always present, even when
3258         not highlighting any nodes.
3259
3260         The ideal functionality is to allow the rulers/guides to be shown when element selection is
3261         active and a node is hovered, regardless of whether "Show Rulers" is enabled.
3262
3263         * inspector/InspectorOverlay.h:
3264         (WebCore::InspectorOverlay::setShowRulersDuringElementSelection): Added.
3265         * inspector/InspectorOverlay.cpp:
3266         (WebCore::InspectorOverlay::paint):
3267         (WebCore::InspectorOverlay::shouldShowOverlay):
3268         (WebCore::InspectorOverlay::drawNodeHighlight):
3269         (WebCore::InspectorOverlay::drawQuadHighlight):
3270         (WebCore::InspectorOverlay::drawElementTitle):
3271         If `showRulersDuringElementSelection` is enabled, draw rulers whenever any highlight bounds
3272         are calculated, but don't update the overlay if it's the only thing enabled (e.g. if there's
3273         no currently hovered node, the overlay will disappear).
3274
3275         * inspector/agents/InspectorDOMAgent.cpp:
3276         (WebCore::InspectorDOMAgent::willDestroyFrontendAndBackend):
3277         (WebCore::InspectorDOMAgent::inspect):
3278         (WebCore::InspectorDOMAgent::setInspectModeEnabled):
3279         (WebCore::InspectorDOMAgent::setSearchingForNode):
3280         Add an optional `showRulers` parameter to `DOM.setInspectModeEnabled` that supersedes the
3281         current value of `Page.setShowRulers` as to whether rulers/guides are shown.
3282
3283 2019-05-23  Devin Rousso  <drousso@apple.com>
3284
3285         Web Inspector: Overlay: rulers should switch sides if they intersect the highlighted node(s) so they don't obstruct any content
3286         https://bugs.webkit.org/show_bug.cgi?id=198165
3287
3288         Reviewed by Timothy Hatcher.
3289
3290         If the highlighted node is against the top edge of the screen, the top ruler should shift to
3291         the bottom, unless the highlighted node is also against the bottom edge of the screen.
3292
3293         If the highlighted node is against the left edge of the screen, the left ruler should shift
3294         to the right, unless the highlighted node is also against the right edge of the screen.
3295
3296         This way, unless the node is very wide/tall, the rulers won't be drawn on top of anything
3297         being highlighted.
3298
3299         * inspector/InspectorOverlay.h:
3300         * inspector/InspectorOverlay.cpp:
3301         (WebCore::InspectorOverlay::paint):
3302         (WebCore::InspectorOverlay::drawNodeHighlight):
3303         (WebCore::InspectorOverlay::drawQuadHighlight):
3304         (WebCore::InspectorOverlay::drawBounds):
3305         (WebCore::InspectorOverlay::drawRulers):
3306         Drive-by: create an alias for the type (`FloatRect`) used when calculating the bounds of
3307                   everything that's highlighted.
3308
3309 2019-05-23  Saam barati  <sbarati@apple.com>
3310
3311         [WHLSL] Make the AST dumper disambiguate expressions using parenthesis to represent AST construction
3312         https://bugs.webkit.org/show_bug.cgi?id=198199
3313
3314         Reviewed by Myles C. Maxfield.
3315
3316         We would dump "*foo.bar" for "(*foo).bar", which is super confusing.
3317         We now dump "(*foo).bar".
3318
3319         * Modules/webgpu/WHLSL/WHLSLASTDumper.cpp:
3320         (WebCore::WHLSL::ASTDumper::visit):
3321
3322 2019-05-23  Saam barati  <sbarati@apple.com>
3323
3324         [WHLSL] Don't wrap anonymous variables in parens in the AST dumper
3325         https://bugs.webkit.org/show_bug.cgi?id=198196
3326
3327         Reviewed by Myles C. Maxfield.
3328
3329         This makes the dump of 'foo.bar.x = 42' go from
3330         ($(0x7f86d9d94440) = &foo, $(0x7f86d9d944e0) = operator.bar(*$(0x7f86d9d94440)), $(0x7f86d9d944e0) = operator.x=($(0x7f86d9d944e0), 42), *$(0x7f86d9d94440) = operator.bar=(*$(0x7f86d9d94440), $(0x7f86d9d944e0)));
3331         
3332         to:
3333         ($0x7f86d9d94440 = &foo, $0x7f86d9d944e0 = operator.bar(*$0x7f86d9d94440), $0x7f86d9d944e0 = operator.x=($0x7f86d9d944e0, 42), *$0x7f86d9d94440 = operator.bar=(*$0x7f86d9d94440, $0x7f86d9d944e0));
3334
3335         * Modules/webgpu/WHLSL/WHLSLASTDumper.cpp:
3336         (WebCore::WHLSL::ASTDumper::visit):
3337
3338 2019-05-23  Myles C. Maxfield  <mmaxfield@apple.com>
3339
3340         [WHLSL] Implement property resolver
3341         https://bugs.webkit.org/show_bug.cgi?id=195925
3342         <rdar://problem/48219643>
3343
3344         Unreviewed watchOS build fix.
3345
3346         * Modules/webgpu/WHLSL/AST/WHLSLAssignmentExpression.h:
3347         (WebCore::WHLSL::AST::AssignmentExpression::AssignmentExpression):
3348
3349 2019-05-23  Saam barati  <sbarati@apple.com>
3350
3351         [WHLSL] Property resolver needs to recurse to handle the base when simplifying rvalues
3352         https://bugs.webkit.org/show_bug.cgi?id=198193
3353
3354         Reviewed by Myles Maxfield.
3355
3356         We were only transforming the top most node in the AST. So things like
3357         'x = foo.bar' would work, but 'x = foo.bar.baz' would not.
3358
3359         Test: webgpu/whlsl-nested-dot-expression-rvalue.html
3360
3361         * Modules/webgpu/WHLSL/WHLSLPropertyResolver.cpp:
3362         (WebCore::WHLSL::PropertyResolver::simplifyRightValue):
3363
3364 2019-05-22  Stephanie Lewis  <slewis@apple.com>
3365
3366         release builds of webkit cannot be used to generate a dyld shared cache
3367         https://bugs.webkit.org/show_bug.cgi?id=198150
3368         <rdar://problem/50675982>
3369
3370         Reviewed by Dan Bernstein.
3371
3372         Restrict the -not_for_dyld_shared_cache linker flag to macosx
3373
3374         * Configurations/WebCore.xcconfig:
3375
3376 2019-05-23  Zalan Bujtas  <zalan@apple.com>
3377
3378         [Hittest] Move hittesting from RenderView to Document
3379         https://bugs.webkit.org/show_bug.cgi?id=198192
3380         <rdar://problem/51077762>
3381
3382         Reviewed by Antti Koivisto.
3383
3384         RenderView is not refcounted and may be destroyed in updateLayout(), so enter hit-testing from Document.
3385
3386         * accessibility/AccessibilityObject.cpp:
3387         (WebCore::AccessibilityObject::press):
3388         * accessibility/AccessibilityRenderObject.cpp:
3389         (WebCore::AccessibilityRenderObject::visiblePositionForPoint const):
3390         * dom/Document.cpp:
3391         (WebCore::FrameFlatteningLayoutDisallower::FrameFlatteningLayoutDisallower):
3392         (WebCore::FrameFlatteningLayoutDisallower::~FrameFlatteningLayoutDisallower):
3393         (WebCore::Document::scheduleStyleRecalc):
3394         (WebCore::Document::prepareMouseEvent):
3395         (WebCore::Document::hitTest):
3396         * dom/Document.h:
3397         (WebCore::Document::inHitTesting const):
3398         * dom/TreeScope.cpp:
3399         (WebCore::TreeScope::nodeFromPoint):
3400         (WebCore::TreeScope::elementsFromPoint):
3401         * editing/FrameSelection.cpp:
3402         (WebCore::FrameSelection::contains const):
3403         * html/HTMLPlugInElement.cpp:
3404         (WebCore::HTMLPlugInElement::isReplacementObscured):
3405         * html/MediaElementSession.cpp:
3406         (WebCore::isElementMainContentForPurposesOfAutoplay):
3407         * page/DragController.cpp:
3408         (WebCore::elementUnderMouse):
3409         * page/EventHandler.cpp:
3410         (WebCore::EventHandler::handleMouseDraggedEvent):
3411         (WebCore::EventHandler::eventMayStartDrag const):
3412         (WebCore::EventHandler::updateSelectionForMouseDrag):
3413         (WebCore::EventHandler::hitTestResultAtPoint const):
3414         (WebCore::EventHandler::updateCursor):
3415         (WebCore::EventHandler::isInsideScrollbar const):
3416         (WebCore::EventHandler::handleWheelEvent):
3417         (WebCore::EventHandler::hoverTimerFired):
3418         (WebCore::EventHandler::handleDrag):
3419         (WebCore::hitTestResultInFrame):
3420         * page/FrameViewLayoutContext.cpp:
3421         (WebCore::FrameViewLayoutContext::setNeedsLayoutAfterViewConfigurationChange):
3422         * rendering/RenderView.cpp:
3423         (WebCore::FrameFlatteningLayoutDisallower::FrameFlatteningLayoutDisallower): Deleted.
3424         (WebCore::FrameFlatteningLayoutDisallower::~FrameFlatteningLayoutDisallower): Deleted.
3425         (): Deleted.
3426         (WebCore::RenderView::hitTest): Deleted.
3427         * rendering/RenderView.h:
3428         * rendering/RenderWidget.cpp:
3429         (WebCore::RenderWidget::nodeAtPoint):
3430         * testing/Internals.cpp:
3431         (WebCore::Internals::nodesFromRect const):
3432
3433 2019-05-23  Youenn Fablet  <youenn@apple.com>
3434
3435         CacheStorageConnection callbacks should be completed on network connection close
3436         https://bugs.webkit.org/show_bug.cgi?id=195757
3437
3438         Reviewed by Alex Christensen.
3439
3440         Move HashMap-based callbacks to WorkerCacheStorageConnection.
3441         Make CacheStorageConnection default API to implement use callbacks.
3442         This is used by WebKit layer to do AsyncReply IPC.
3443
3444         Move DOMCacheEngine callbacks to CompletionHandler.
3445
3446         Test: http/wpt/cache-storage/cache-storage-networkprocess-crash.html
3447
3448         * Modules/cache/CacheStorageConnection.cpp:
3449         * Modules/cache/CacheStorageConnection.h:
3450         (WebCore::CacheStorageConnection::engineRepresentation):
3451         * Modules/cache/DOMCacheEngine.h:
3452         * Modules/cache/WorkerCacheStorageConnection.cpp:
3453         (WebCore::recordsDataFromRecords):
3454         (WebCore::recordsDataOrErrorFromRecords):
3455         (WebCore::recordsFromRecordsData):
3456         (WebCore::recordsOrErrorFromRecordsData):
3457         (WebCore::WorkerCacheStorageConnection::open):
3458         (WebCore::WorkerCacheStorageConnection::openOrRemoveCompleted):
3459         (WebCore::WorkerCacheStorageConnection::remove):
3460         (WebCore::WorkerCacheStorageConnection::retrieveCaches):
3461         (WebCore::WorkerCacheStorageConnection::retrieveCachesCompleted):
3462         (WebCore::WorkerCacheStorageConnection::retrieveRecords):
3463         (WebCore::WorkerCacheStorageConnection::retrieveRecordsCompleted):
3464         (WebCore::WorkerCacheStorageConnection::batchDeleteOperation):
3465         (WebCore::WorkerCacheStorageConnection::deleteRecordsCompleted):
3466         (WebCore::WorkerCacheStorageConnection::batchPutOperation):
3467         (WebCore::WorkerCacheStorageConnection::putRecordsCompleted):
3468         (WebCore::WorkerCacheStorageConnection::reference):
3469         (WebCore::WorkerCacheStorageConnection::dereference):
3470         (WebCore::WorkerCacheStorageConnection::clearPendingRequests):
3471         * Modules/cache/WorkerCacheStorageConnection.h:
3472         * page/CacheStorageProvider.h:
3473         (WebCore::CacheStorageProvider::createCacheStorageConnection):
3474
3475 2019-05-23  Youenn Fablet  <youenn@apple.com>
3476
3477         Multiple videos (with audios) with autoplay & playinline not working. Only one video play at a time.
3478         https://bugs.webkit.org/show_bug.cgi?id=193312
3479         <rdar://problem/47189864>
3480
3481         Reviewed by Jer Noble.
3482
3483         Allow all MediaStream backed video elements to play together.
3484         Any non MediaStream backed video will stop all MediaStream backed video elements.
3485         Conversely, all non MediaStream backed videos will stop when playing one MediaStream backed video.
3486
3487         Refactor PlatformMediaSessionManager as the way to iterate through sessions
3488         is not safe when pausing a session: if playing, the session will be moved in the array of sessions.
3489
3490         To handle this, copy the list of sessions before iterating through them.
3491         For extra safety, make sessions WeakPtr.
3492
3493         Add routines for the case of filtering with a predicate taking a const session.
3494         In that case, we do not copy the vector but iterate through it as a small optimization.
3495
3496         Test: webrtc/concurrentVideoPlayback.html
3497
3498         * html/HTMLMediaElement.cpp:
3499         (WebCore::HTMLMediaElement::bestMediaElementForShowingPlaybackControlsManager):
3500         (WebCore::HTMLMediaElement::hasMediaStreamSource const):
3501         * html/HTMLMediaElement.h:
3502         * platform/audio/PlatformMediaSession.cpp:
3503         (WebCore::PlatformMediaSession::activeAudioSessionRequired const):
3504         (WebCore::PlatformMediaSession::canPlayConcurrently const):
3505         (WebCore::PlatformMediaSession::activeAudioSessionRequired): Deleted.
3506         * platform/audio/PlatformMediaSession.h:
3507         (WebCore::PlatformMediaSessionClient::hasMediaStreamSource const):
3508         * platform/audio/PlatformMediaSessionManager.cpp:
3509         (WebCore::PlatformMediaSessionManager::has const):
3510         (WebCore::PlatformMediaSessionManager::activeAudioSessionRequired const):
3511         (WebCore::PlatformMediaSessionManager::canProduceAudio const):
3512         (WebCore::PlatformMediaSessionManager::count const):
3513         (WebCore::PlatformMediaSessionManager::beginInterruption):
3514         (WebCore::PlatformMediaSessionManager::endInterruption):
3515         (WebCore::PlatformMediaSessionManager::addSession):
3516         (WebCore::PlatformMediaSessionManager::removeSession):
3517         (WebCore::PlatformMediaSessionManager::sessionWillBeginPlayback):
3518         (WebCore::PlatformMediaSessionManager::sessionWillEndPlayback):
3519         (WebCore::PlatformMediaSessionManager::setCurrentSession):
3520         (WebCore::PlatformMediaSessionManager::currentSession const):
3521         (WebCore::PlatformMediaSessionManager::applicationWillBecomeInactive):
3522         (WebCore::PlatformMediaSessionManager::applicationDidBecomeActive):
3523         (WebCore::PlatformMediaSessionManager::applicationDidEnterBackground):
3524         (WebCore::PlatformMediaSessionManager::applicationWillEnterForeground):
3525         (WebCore::PlatformMediaSessionManager::systemWillSleep):
3526         (WebCore::PlatformMediaSessionManager::systemDidWake):
3527         (WebCore::PlatformMediaSessionManager::stopAllMediaPlaybackForDocument):
3528         (WebCore::PlatformMediaSessionManager::stopAllMediaPlaybackForProcess):
3529         (WebCore::PlatformMediaSessionManager::suspendAllMediaPlaybackForDocument):
3530         (WebCore::PlatformMediaSessionManager::resumeAllMediaPlaybackForDocument):
3531         (WebCore::PlatformMediaSessionManager::suspendAllMediaBufferingForDocument):
3532         (WebCore::PlatformMediaSessionManager::resumeAllMediaBufferingForDocument):
3533         (WebCore::PlatformMediaSessionManager::currentSessionsMatching const):
3534         (WebCore::PlatformMediaSessionManager::forEachMatchingSession):
3535         (WebCore::PlatformMediaSessionManager::forEachMatchingSession const):
3536         (WebCore::PlatformMediaSessionManager::forEachSession):
3537         (WebCore::PlatformMediaSessionManager::anyOfSessions const):
3538         (): Deleted.
3539         (WebCore::PlatformMediaSessionManager::applicationWillBecomeInactive const): Deleted.
3540         (WebCore::PlatformMediaSessionManager::applicationDidBecomeActive const): Deleted.
3541         (WebCore::PlatformMediaSessionManager::applicationDidEnterBackground const): Deleted.
3542         (WebCore::PlatformMediaSessionManager::applicationWillEnterForeground const): Deleted.
3543         (WebCore::PlatformMediaSessionManager::forEachSession const): Deleted.
3544         (WebCore::PlatformMediaSessionManager::findSession const): Deleted.
3545         * platform/audio/PlatformMediaSessionManager.h:
3546         (WebCore::PlatformMediaSessionManager::anyOfSessions const): Deleted.
3547         * platform/audio/cocoa/MediaSessionManagerCocoa.mm:
3548         (MediaSessionManagerCocoa::updateSessionState):
3549         (MediaSessionManagerCocoa::beginInterruption):
3550         * platform/audio/ios/MediaSessionManagerIOS.mm:
3551         (WebCore::MediaSessionManageriOS::configureWireLessTargetMonitoring):
3552         (WebCore::MediaSessionManageriOS::externalOutputDeviceAvailableDidChange):
3553
3554 2019-05-23  Saam barati  <sbarati@apple.com>
3555
3556         [WHLSL] Add a helper for in-place AST mutation
3557         https://bugs.webkit.org/show_bug.cgi?id=198175
3558
3559         Reviewed by Myles Maxfield.
3560
3561         This makes WHLSL AST mutation code a bit easier to read and write.
3562         
3563         Code that looked like:
3564         ```
3565         static_assert(sizeof(AST::DereferenceExpression) <= sizeof(AST::DotExpression), "Dot expressions need to be able to become dereference expressions without updating backreferences");
3566         void* location = &dotExpression;
3567         dotExpression.~DotExpression();
3568         auto* dereferenceExpression = new (location) AST::DereferenceExpression(WTFMove(origin), WTFMove(callExpression));
3569         ```
3570         
3571         Can now be:
3572         ```
3573         auto* dereferenceExpression = AST::replaceWith<AST::DereferenceExpression>(dotExpression, WTFMove(origin), WTFMove(callExpression));
3574         ```
3575
3576         * Modules/webgpu/WHLSL/AST/WHLSLNode.h:
3577         (WebCore::WHLSL::AST::replaceWith):
3578         * Modules/webgpu/WHLSL/WHLSLNameResolver.cpp:
3579         (WebCore::WHLSL::NameResolver::visit):
3580         * Modules/webgpu/WHLSL/WHLSLPropertyResolver.cpp:
3581         (WebCore::WHLSL::PropertyResolver::visit):
3582         (WebCore::WHLSL::PropertyResolver::simplifyRightValue):
3583         (WebCore::WHLSL::LeftValueSimplifier::visit):
3584
3585 2019-05-23  Eric Carlson  <eric.carlson@apple.com>
3586
3587         [macOS,iOS] Add always-on logging for AVPlayerTimeControlStatus changes
3588         https://bugs.webkit.org/show_bug.cgi?id=197946
3589         <rdar://problem/50627457>
3590
3591         Reviewed by Jon Lee.
3592
3593         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
3594         (WebCore::convertEnumerationToString):
3595         (WTF::LogArgument<AVPlayerTimeControlStatus>::toString):
3596         (WebCore::MediaPlayerPrivateAVFoundationObjC::timeControlStatusDidChange):
3597
3598 2019-05-23  Antoine Quint  <graouts@apple.com>
3599
3600         [Pointer Events] Compatibility mouse events can only be prevented while the pointer is pressed
3601         https://bugs.webkit.org/show_bug.cgi?id=198178
3602
3603         Reviewed by Dean Jackson.
3604
3605         Test: pointerevents/mouse/compatibility-mouse-events-prevention-mouse-released.html
3606
3607         The Pointer Events spec, in https://www.w3.org/TR/pointerevents/#compatibility-mapping-with-mouse-events, says that "Mouse events
3608         can only be prevented when the pointer is down. Hovering pointers (e.g. a mouse with no buttons pressed) cannot have their mouse
3609         events prevented." We now track whether the pointer is pressed and clear the preventsCompatibilityMouseEvents when the pointer is
3610         moved and it is not pressed.
3611
3612         * page/PointerCaptureController.cpp:
3613         (WebCore::PointerCaptureController::pointerEventWasDispatched):
3614         * page/PointerCaptureController.h:
3615
3616 2019-05-23  Simon Fraser  <simon.fraser@apple.com>
3617
3618         Build fix after r245695.
3619
3620         * dom/Element.cpp:
3621
3622 2019-05-23  Antoine Quint  <graouts@apple.com>
3623
3624         [Pointer Events] The mouseover, mouseout, mouseenter, and mouseleave events should not be prevented while the pointer is down
3625         https://bugs.webkit.org/show_bug.cgi?id=198177
3626
3627         Reviewed by Dean Jackson.
3628
3629         Test: pointerevents/mouse/compatibility-mouse-events-prevention-mouse-pressed.html
3630
3631         The Pointer Event spec, in https://www.w3.org/TR/pointerevents/#compatibility-mapping-with-mouse-events, says that "the mouseover,
3632         mouseout, mouseenter, and mouseleave events are never prevented (even if the pointer is down)." We add a new static function which
3633         indicates what is "compatibility" mouse event since those should be excluded, along with "click", which we already excluded.
3634
3635         * dom/Element.cpp:
3636         (WebCore::isCompatibilityMouseEvent):
3637         (WebCore::Element::dispatchMouseEvent):
3638
3639 2019-05-23  Jon Davis  <jond@apple.com>
3640
3641         Update feature status for shipped features
3642         https://bugs.webkit.org/show_bug.cgi?id=196783
3643
3644         Reviewed by Timothy Hatcher.
3645         
3646         Updated feature status for Beacon API, CSS Text Decoration Level 4, Intersection Observer,
3647         Conic Gradients, Datalist Element, and Web Share.
3648
3649         * features.json:
3650
3651 2019-05-23  Simon Fraser  <simon.fraser@apple.com>
3652
3653         Create scrolling tree nodes for descendants of position:absolute inside stacking-context overflow
3654         https://bugs.webkit.org/show_bug.cgi?id=198154
3655
3656         Reviewed by Antti Koivisto.
3657         
3658         There exists code that creates scrolling tree nodes for position:absolute when the containing block
3659         chain skips an enclosing scroller, but the compositing ancestor tree includes the scroller. However
3660         this code explicitly checked that the layer was position:absolute.
3661
3662         This needed to be generalized for any layer whose containing block ancestor chain includes
3663         a position:absolute that skips the scroller, for example a transformed inside a position:absolute,
3664         so remove an explicit isAbsolutelyPositioned() check and some similar assertions.
3665
3666         Test: scrollingcoordinator/scrolling-tree/composited-in-absolute-in-stacking-context-overflow.html
3667
3668         * rendering/RenderLayerCompositor.cpp:
3669         (WebCore::collectStationaryLayerRelatedOverflowNodes):
3670         (WebCore::RenderLayerCompositor::computeCoordinatedPositioningForLayer const):
3671         (WebCore::collectRelatedCoordinatedScrollingNodes):
3672
3673 2019-05-23  Adrian Perez de Castro  <aperez@igalia.com>
3674
3675         Fix a few missing header inclusions often masked by by unified sources
3676         https://bugs.webkit.org/show_bug.cgi?id=198180
3677
3678         Reviewed by Eric Carlson.
3679
3680         * editing/markup.h: Add missing "FloatSize.h" inclusion.
3681         * html/FeaturePolicy.cpp: Add missing "HTMLParserIdioms.h" inclusion.
3682         * platform/text/TextCodec.cpp: Add missing <cstdio> inclusion.
3683
3684 2019-05-23  Myles C. Maxfield  <mmaxfield@apple.com>
3685
3686         [WHLSL] Implement property resolver
3687         https://bugs.webkit.org/show_bug.cgi?id=195925
3688         <rdar://problem/48219643>
3689
3690         Reviewed by Saam Barati and Robin Morisset.
3691
3692         The property resolver is the thing that replaces dot expressions, index expressions, and
3693         read-modify-write expressions with calls to getters, setters, and anders. This patch doesn't
3694         fully implement the property resolver, but implements enough for simple dot expressions to
3695         work. This is enough for us to be able to test most of the rest of the compiler. Index
3696         expressions and read-modify-write expressions are not fully included in this patch, and will
3697         be finished in a follow-up patch.
3698
3699         The property resolver may introduce anonymous variables in various places. In order to do
3700         this, after the property resolver runs, it will insert all these anonymous variables in the
3701         beginning of the function. However, this means that entries in the VariableDeclarations
3702         vector will all shift, which means VariableDeclarations have to be allocated on the heap so
3703         backreferences to them stay valid. This patch moves the storage associated with these values
3704         to living directly in the vector's storage to living in heap storage (via filling the vector
3705         with UniqueRefs).
3706
3707         This patch also adds the third concept of value-ness. We now have right values, left values,
3708         and abstract left values (for things which have setters but have no address). This addition
3709         is required for the analysis the property resolver performs. This concept is also present in
3710         the spec.
3711
3712         Test: webgpu/whlsl-dot-expressions.html
3713
3714         * Modules/webgpu/WHLSL/AST/WHLSLAddressSpace.h:
3715         (WebCore::WHLSL::AST::TypeAnnotation::TypeAnnotation):
3716         (WebCore::WHLSL::AST::TypeAnnotation::leftAddressSpace const):
3717         (WebCore::WHLSL::AST::TypeAnnotation::isRightValue const):
3718         (WebCore::WHLSL::AST::TypeAnnotation::visit):
3719         * Modules/webgpu/WHLSL/AST/WHLSLAssignmentExpression.h:
3720         (WebCore::WHLSL::AST::AssignmentExpression::takeRight):
3721         * Modules/webgpu/WHLSL/AST/WHLSLConstantExpression.h:
3722         * Modules/webgpu/WHLSL/AST/WHLSLDotExpression.h:
3723         * Modules/webgpu/WHLSL/AST/WHLSLEntryPointType.h:
3724         * Modules/webgpu/WHLSL/AST/WHLSLExpression.h:
3725         (WebCore::WHLSL::AST::Expression::maybeResolvedType):
3726         (WebCore::WHLSL::AST::Expression::resolvedType):
3727         (WebCore::WHLSL::AST::Expression::maybeTypeAnnotation const):
3728         (WebCore::WHLSL::AST::Expression::typeAnnotation const):
3729         (WebCore::WHLSL::AST::Expression::setTypeAnnotation):
3730         (WebCore::WHLSL::AST::Expression::addressSpace const): Deleted.
3731         (WebCore::WHLSL::AST::Expression::setAddressSpace): Deleted.
3732         * Modules/webgpu/WHLSL/AST/WHLSLFloatLiteral.h:
3733         (WebCore::WHLSL::AST::FloatLiteral::clone const):
3734         * Modules/webgpu/WHLSL/AST/WHLSLIndexExpression.h:
3735         * Modules/webgpu/WHLSL/AST/WHLSLIntegerLiteral.cpp:
3736         (WebCore::WHLSL::AST::IntegerLiteral::valueForSelectedType const):
3737         * Modules/webgpu/WHLSL/AST/WHLSLIntegerLiteral.h:
3738         (WebCore::WHLSL::AST::IntegerLiteral::clone const):
3739         * Modules/webgpu/WHLSL/AST/WHLSLMakeArrayReferenceExpression.h:
3740         (WebCore::WHLSL::AST::MakeArrayReferenceExpression::MakeArrayReferenceExpression):
3741         (WebCore::WHLSL::AST::MakeArrayReferenceExpression::leftValue):
3742         (WebCore::WHLSL::AST::MakeArrayReferenceExpression::lValue): Deleted.
3743         * Modules/webgpu/WHLSL/AST/WHLSLMakePointerExpression.h:
3744         (WebCore::WHLSL::AST::MakePointerExpression::MakePointerExpression):
3745         (WebCore::WHLSL::AST::MakePointerExpression::leftValue):
3746         (WebCore::WHLSL::AST::MakePointerExpression::lValue): Deleted.
3747         * Modules/webgpu/WHLSL/AST/WHLSLNullLiteral.h:
3748         (WebCore::WHLSL::AST::NullLiteral::clone const):
3749         * Modules/webgpu/WHLSL/AST/WHLSLPropertyAccessExpression.h:
3750         (WebCore::WHLSL::AST::PropertyAccessExpression::possibleGetterOverloads):
3751         (WebCore::WHLSL::AST::PropertyAccessExpression::possibleSetterOverloads):
3752         (WebCore::WHLSL::AST::PropertyAccessExpression::possibleAnderOverloads):
3753         (WebCore::WHLSL::AST::PropertyAccessExpression::getterFunction):
3754         (WebCore::WHLSL::AST::PropertyAccessExpression::anderFunction):
3755         (WebCore::WHLSL::AST::PropertyAccessExpression::threadAnderFunction):
3756         (WebCore::WHLSL::AST::PropertyAccessExpression::setterFunction):
3757         (WebCore::WHLSL::AST::PropertyAccessExpression::setPossibleGetterOverloads):
3758         (WebCore::WHLSL::AST::PropertyAccessExpression::setPossibleAnderOverloads):
3759         (WebCore::WHLSL::AST::PropertyAccessExpression::setPossibleSetterOverloads):
3760         (WebCore::WHLSL::AST::PropertyAccessExpression::setGetterFunction):
3761         (WebCore::WHLSL::AST::PropertyAccessExpression::setAnderFunction):
3762         (WebCore::WHLSL::AST::PropertyAccessExpression::setThreadAnderFunction):
3763         (WebCore::WHLSL::AST::PropertyAccessExpression::setSetterFunction):
3764         (WebCore::WHLSL::AST::PropertyAccessExpression::takeBase):
3765         (WebCore::WHLSL::AST::PropertyAccessExpression::possibleGetOverloads): Deleted.
3766         (WebCore::WHLSL::AST::PropertyAccessExpression::possibleSetOverloads): Deleted.
3767         (WebCore::WHLSL::AST::PropertyAccessExpression::possibleAndOverloads): Deleted.
3768         (WebCore::WHLSL::AST::PropertyAccessExpression::setPossibleGetOverloads): Deleted.
3769         (WebCore::WHLSL::AST::PropertyAccessExpression::setPossibleSetOverloads): Deleted.
3770         (WebCore::WHLSL::AST::PropertyAccessExpression::setPossibleAndOverloads): Deleted.
3771         * Modules/webgpu/WHLSL/AST/WHLSLReadModifyWriteExpression.h:
3772         (WebCore::WHLSL::AST::ReadModifyWriteExpression::oldVariableReference):
3773         (WebCore::WHLSL::AST::ReadModifyWriteExpression::newVariableReference):
3774         (WebCore::WHLSL::AST::ReadModifyWriteExpression::leftValue):
3775         (WebCore::WHLSL::AST::ReadModifyWriteExpression::takeLeftValue):
3776         (WebCore::WHLSL::AST::ReadModifyWriteExpression::takeOldValue):
3777         (WebCore::WHLSL::AST::ReadModifyWriteExpression::takeNewValue):
3778         (WebCore::WHLSL::AST::ReadModifyWriteExpression::takeNewValueExpression):
3779         (WebCore::WHLSL::AST::ReadModifyWriteExpression::takeResultExpression):
3780         (WebCore::WHLSL::AST::ReadModifyWriteExpression::ReadModifyWriteExpression):
3781         (WebCore::WHLSL::AST::ReadModifyWriteExpression::lValue): Deleted.
3782         * Modules/webgpu/WHLSL/AST/WHLSLResolvableType.h:
3783         (WebCore::WHLSL::AST::ResolvableType::maybeResolvedType const):
3784         (WebCore::WHLSL::AST::ResolvableType::resolvedType const):
3785         (WebCore::WHLSL::AST::ResolvableType::maybeResolvedType):
3786         (WebCore::WHLSL::AST::ResolvableType::resolvedType):
3787         * Modules/webgpu/WHLSL/AST/WHLSLResourceSemantic.cpp:
3788         (WebCore::WHLSL::AST::ResourceSemantic::isAcceptableType const):
3789         * Modules/webgpu/WHLSL/AST/WHLSLSpecializationConstantSemantic.cpp:
3790         (WebCore::WHLSL::AST::SpecializationConstantSemantic::isAcceptableType const):
3791         * Modules/webgpu/WHLSL/AST/WHLSLStageInOutSemantic.cpp:
3792         (WebCore::WHLSL::AST::StageInOutSemantic::isAcceptableType const):
3793         * Modules/webgpu/WHLSL/AST/WHLSLStructureDefinition.h:
3794         (WebCore::WHLSL::AST::StructureDefinition::find):
3795         * Modules/webgpu/WHLSL/AST/WHLSLTypeReference.h:
3796         (WebCore::WHLSL::AST::TypeReference::maybeResolvedType const):
3797         (WebCore::WHLSL::AST::TypeReference::resolvedType const):
3798         * Modules/webgpu/WHLSL/AST/WHLSLUnsignedIntegerLiteral.cpp:
3799         (WebCore::WHLSL::AST::UnsignedIntegerLiteral::valueForSelectedType const):
3800         * Modules/webgpu/WHLSL/AST/WHLSLUnsignedIntegerLiteral.h:
3801         (WebCore::WHLSL::AST::UnsignedIntegerLiteral::clone const):
3802         * Modules/webgpu/WHLSL/AST/WHLSLVariableDeclaration.h:
3803         * Modules/webgpu/WHLSL/AST/WHLSLVariableDeclarationsStatement.h:
3804         (WebCore::WHLSL::AST::VariableDeclarationsStatement::VariableDeclarationsStatement):
3805         (WebCore::WHLSL::AST::VariableDeclarationsStatement::variableDeclarations):
3806         * Modules/webgpu/WHLSL/Metal/WHLSLEntryPointScaffolding.cpp:
3807         (WebCore::WHLSL::Metal::attributeForSemantic):
3808         (WebCore::WHLSL::Metal::EntryPointScaffolding::mangledInputPath):
3809         (WebCore::WHLSL::Metal::EntryPointScaffolding::unpackResourcesAndNamedBuiltIns):
3810         (WebCore::WHLSL::Metal::FragmentEntryPointScaffolding::helperTypes):
3811         (WebCore::WHLSL::Metal::FragmentEntryPointScaffolding::unpack):
3812         * Modules/webgpu/WHLSL/Metal/WHLSLFunctionWriter.cpp:
3813         (WebCore::WHLSL::Metal::FunctionDeclarationWriter::visit):
3814         (WebCore::WHLSL::Metal::FunctionDefinitionWriter::visit):
3815         * Modules/webgpu/WHLSL/Metal/WHLSLNativeFunctionWriter.cpp:
3816         (WebCore::WHLSL::Metal::writeNativeFunction):
3817         * Modules/webgpu/WHLSL/Metal/WHLSLNativeTypeWriter.cpp:
3818         (WebCore::WHLSL::Metal::writeNativeType):
3819         * Modules/webgpu/WHLSL/Metal/WHLSLTypeNamer.cpp:
3820         (WebCore::WHLSL::Metal::findInVector):
3821         (WebCore::WHLSL::Metal::TypeNamer::visit):
3822         (WebCore::WHLSL::Metal::TypeNamer::createNameNode):
3823         * Modules/webgpu/WHLSL/WHLSLASTDumper.cpp:
3824         (WebCore::WHLSL::ASTDumper::visit):
3825         * Modules/webgpu/WHLSL/WHLSLCheckDuplicateFunctions.cpp:
3826         (WebCore::WHLSL::checkDuplicateFunctions):
3827         * Modules/webgpu/WHLSL/WHLSLChecker.cpp:
3828         (WebCore::WHLSL::resolveWithOperatorAnderIndexer):
3829         (WebCore::WHLSL::resolveWithOperatorLength):
3830         (WebCore::WHLSL::resolveWithReferenceComparator):
3831         (WebCore::WHLSL::resolveByInstantiation):
3832         (WebCore::WHLSL::checkOperatorOverload):
3833         (WebCore::WHLSL::Checker::assignTypes):
3834         (WebCore::WHLSL::commit):
3835         (WebCore::WHLSL::Checker::visit):
3836         (WebCore::WHLSL::Checker::recurseAndGetInfo):
3837         (WebCore::WHLSL::Checker::getInfo):
3838         (WebCore::WHLSL::Checker::assignType):
3839         (WebCore::WHLSL::Checker::forwardType):
3840         (WebCore::WHLSL::getUnnamedType):
3841         (WebCore::WHLSL::Checker::finishVisitingPropertyAccess): Deleted.
3842         (WebCore::WHLSL::Checker::recurseAndWrapBaseType): Deleted.
3843         * Modules/webgpu/WHLSL/WHLSLGatherEntryPointItems.cpp:
3844         (WebCore::WHLSL::Gatherer::takeEntryPointItems):
3845         (WebCore::WHLSL::Gatherer::visit):
3846         * Modules/webgpu/WHLSL/WHLSLInferTypes.cpp:
3847         (WebCore::WHLSL::matchAndCommit):
3848         (WebCore::WHLSL::commit):
3849         (WebCore::WHLSL::inferTypesForCall):
3850         * Modules/webgpu/WHLSL/WHLSLLiteralTypeChecker.cpp:
3851         (WebCore::WHLSL::getNativeTypeDeclaration):
3852         * Modules/webgpu/WHLSL/WHLSLNameResolver.cpp:
3853         (WebCore::WHLSL::NameResolver::visit):
3854         * Modules/webgpu/WHLSL/WHLSLParser.cpp:
3855         (WebCore::WHLSL::Parser::parseParameters):
3856         (WebCore::WHLSL::Parser::parseVariableDeclarations):
3857         * Modules/webgpu/WHLSL/WHLSLPipelineDescriptor.h:
3858         * Modules/webgpu/WHLSL/WHLSLPrepare.cpp:
3859         (WebCore::WHLSL::prepareShared):
3860         * Modules/webgpu/WHLSL/WHLSLPrepare.h:
3861         * Modules/webgpu/WHLSL/WHLSLPropertyResolver.cpp: Added.
3862         (WebCore::WHLSL::PropertyResolver::visit):
3863         (WebCore::WHLSL::setterCall):
3864         (WebCore::WHLSL::getterCall):
3865         (WebCore::WHLSL::modify):
3866         (WebCore::WHLSL::PropertyResolver::simplifyRightValue):
3867         (WebCore::WHLSL::LeftValueSimplifier::visit):
3868         (WebCore::WHLSL::PropertyResolver::simplifyLeftValue):
3869         (WebCore::WHLSL::resolveProperties):
3870         * Modules/webgpu/WHLSL/WHLSLPropertyResolver.h: Copied from Source/WebCore/Modules/webgpu/WHLSL/AST/WHLSLEntryPointType.h.
3871         * Modules/webgpu/WHLSL/WHLSLRecursiveTypeChecker.cpp:
3872         (WebCore::WHLSL::RecursiveTypeChecker::visit):
3873         * Modules/webgpu/WHLSL/WHLSLResolveOverloadImpl.cpp:
3874         (WebCore::WHLSL::conversionCost):
3875         * Modules/webgpu/WHLSL/WHLSLResolvingType.h:
3876         (WebCore::WHLSL::ResolvingType::getUnnamedType):
3877         * Modules/webgpu/WHLSL/WHLSLStandardLibrary.txt:
3878         * Modules/webgpu/WHLSL/WHLSLSynthesizeArrayOperatorLength.cpp:
3879         (WebCore::WHLSL::FindArrayTypes::takeArrayTypes):
3880         (WebCore::WHLSL::synthesizeArrayOperatorLength):
3881         * Modules/webgpu/WHLSL/WHLSLSynthesizeConstructors.cpp:
3882         (WebCore::WHLSL::FindAllTypes::takeUnnamedTypes):
3883         (WebCore::WHLSL::FindAllTypes::takeNamedTypes):
3884         (WebCore::WHLSL::synthesizeConstructors):
3885         * Modules/webgpu/WHLSL/WHLSLSynthesizeEnumerationFunctions.cpp:
3886         (WebCore::WHLSL::synthesizeEnumerationFunctions):
3887         * Modules/webgpu/WHLSL/WHLSLSynthesizeStructureAccessors.cpp:
3888         (WebCore::WHLSL::synthesizeStructureAccessors):
3889         * Modules/webgpu/WHLSL/WHLSLVisitor.cpp:
3890         (WebCore::WHLSL::Visitor::visit):
3891         * Modules/webgpu/WHLSL/WHLSLVisitor.h:
3892         * Sources.txt:
3893         * WebCore.xcodeproj/project.pbxproj:
3894         * platform/graphics/gpu/cocoa/GPURenderPipelineMetal.mm:
3895         (WebCore::trySetWHLSLFunctionsForPipelineDescriptor):
3896
3897 2019-05-22  Myles C. Maxfield  <mmaxfield@apple.com>
3898
3899         font-optical-sizing applies the wrong variation value
3900         https://bugs.webkit.org/show_bug.cgi?id=197528
3901         <rdar://problem/50152854>
3902
3903         Reviewed by Antti Koivisto.
3904
3905         The OpenType spec says in
3906         https://docs.microsoft.com/en-us/typography/opentype/spec/dvaraxistag_opsz
3907
3908         "Scale interpretation: Values can be interpreted as text size, in points."
3909
3910         It turns out that it means "typographic point size" which is equal to CSS pixels, not
3911         CSS points.
3912
3913         There are two parts of the font that are sensitive to optical sizing: variation values and
3914         the trak table. We don't want to set the variation value directly because then the trak table
3915         won't be affected. Instead, we can use kCTFontOpticalSizeAttribute to set both of them together.
3916         We will only do this when the CSS says text-rendering:optimizeLegibility or when the font has
3917         an opsz axis but no STAT table. Otherwise, we won't do anything special, which lets CoreText
3918         handle the default behavior for us. This gives us the same default behavior as the rest of the
3919         system.
3920
3921         Tests: fast/text/variations/optical-sizing-trak-2.html
3922                fast/text/variations/optical-sizing-trak.html
3923                fast/text/variations/optical-sizing-units-2.html
3924                fast/text/variations/optical-sizing-units.html
3925
3926         * platform/graphics/cocoa/FontCacheCoreText.cpp:
3927         (WebCore::FontType::FontType):
3928         (WebCore::preparePlatformFont):
3929         (WebCore::fontWithFamily):
3930         (WebCore::FontCache::systemFallbackForCharacters):
3931         * platform/graphics/cocoa/FontCacheCoreText.h:
3932         * platform/graphics/cocoa/FontFamilySpecificationCoreText.cpp:
3933         (WebCore::FontFamilySpecificationCoreText::fontRanges const):
3934         * platform/graphics/mac/FontCustomPlatformData.cpp:
3935         (WebCore::FontCustomPlatformData::fontPlatformData):
3936
3937 2019-05-22  Antti Koivisto  <antti@apple.com>
3938
3939         Subselectors not searched when determining property whitelist for