[Web Animations] Audit Web Animations classes for memory reduction
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2019-01-09  Antoine Quint  <graouts@apple.com>
2
3         [Web Animations] Audit Web Animations classes for memory reduction
4         https://bugs.webkit.org/show_bug.cgi?id=193195
5
6         Reviewed by Simon Fraser and Yusuke Suzuki.
7
8         The classes, enums and structs added to support Web Animations were not as memory-efficient as they could be. We now order
9         members in a way that reduces padding, use Markable<T, Traits> instead of Optional<T> where applicable, declare enums as uint8_t
10         and removed unnecessary members.
11
12         As a result, classes and structs have shrunk as follows:
13
14         WebAnimation: 256 > 216
15         DeclarativeAnimation: 392 > 344
16         CSSAnimation: 416 > 368
17         CSSTransition: 440 > 392
18         AnimationEffect: 88 > 72
19         KeyframeEffect: 208 > 184
20         AnimationPlaybackEvent: 104 > 88
21         EffectTiming: 72 > 64
22         ComputedEffectTiming: 136 > 112
23         AnimationTimeline: 264 > 248
24         DocumentTimeline: 496 > 464
25         OptionalEffectTiming: 112 > 80
26         BaseKeyframe: 32 > 24
27         ParsedKeyframe: 80 > 72
28         BaseComputedKeyframe: 40 > 32
29
30         * animation/AnimationEffect.h: Order members in decreasing size, except for m_fill and m_direction, which we put at the top to
31         save 8 bytes (2 bytes of padding instead of 4 before m_animation and saving 6 bytes of padding at the end).
32         * animation/AnimationPlaybackEvent.cpp:
33         (WebCore::AnimationPlaybackEvent::AnimationPlaybackEvent):
34         * animation/AnimationPlaybackEvent.h:
35         * animation/AnimationPlaybackEventInit.h:
36         * animation/AnimationTimeline.cpp:
37         (WebCore::AnimationTimeline::AnimationTimeline):
38         (WebCore::AnimationTimeline::updateCSSTransitionsForElement):
39         * animation/AnimationTimeline.h: We remove the m_classType member and instead make isDocumentTimeline() virtual.
40         (WebCore::AnimationTimeline::isDocumentTimeline const):
41         (): Deleted.
42         (WebCore::AnimationTimeline::classType const): Deleted.
43         * animation/CompositeOperation.h:
44         * animation/CompositeOperationOrAuto.h:
45         * animation/ComputedEffectTiming.h:
46         * animation/DeclarativeAnimation.cpp:
47         (WebCore::DeclarativeAnimation::DeclarativeAnimation):
48         (WebCore::DeclarativeAnimation::invalidateDOMEvents):
49         * animation/DeclarativeAnimation.h: We keep m_wasPending and m_previousPhase at the top to save some padding at the end.
50         * animation/DocumentTimeline.cpp:
51         (WebCore::DocumentTimeline::DocumentTimeline):
52         * animation/DocumentTimeline.h:
53         * animation/EffectTiming.h:
54         * animation/FillMode.h:
55         * animation/IterationCompositeOperation.h:
56         * animation/KeyframeEffect.cpp:
57         (WebCore::computeMissingKeyframeOffsets):
58         (WebCore::KeyframeEffect::create):
59         (WebCore::KeyframeEffect::KeyframeEffect):
60         * animation/KeyframeEffect.h:
61         * animation/OptionalEffectTiming.h:
62         * animation/PlaybackDirection.h:
63         * animation/WebAnimation.h:
64         * animation/WebAnimationUtilities.h:
65         (WebCore::WebAnimationsMarkableDoubleTraits::isEmptyValue):
66         (WebCore::WebAnimationsMarkableDoubleTraits::emptyValue):
67
68 2019-01-09  Ryosuke Niwa  <rniwa@webkit.org>
69
70         ThreadTimers should not store a raw pointer in its heap
71         https://bugs.webkit.org/show_bug.cgi?id=192975
72         <rdar://problem/46893946>
73
74         Reviewed by Geoffrey Garen.
75
76         Right now, ThreadTimers's heap data structure stores a raw pointer to TimerBase. In order to harden the timer code,
77         this patch replaces it with ThreadTimerHeapItem, a newly introduced struct, which effectively acks like
78         WeakReference<TimerBase*> as the timer heap and TimerBase both store RefPtr to it, and TimerBase's destructor clears
79         the raw pointer back to TimerBase*.
80
81         This approach was taken instead of an out-right adoptation of WeakPtr since the heap data structure requires each node
82         in the heap to have a fixed "priority" yet WeakPtr with no valid pointer back to TimerBase would effectively lose its
83         "priority" thereby corrupting the heap data structure. That is, each item in the heap must remember its fire time and
84         insertion order even when the underlying TimerBase had gone away (this should never happen but the whole point of this
85         hardening is to make it work even in the precense of such a bug).
86
87         This patch also moves the heap index in TimerBase to ThreadTimerHeapItem, and replaces the pointer to the heap vector
88         in TimerBase by a reference to ThreadTimers in ThreadTimerHeapItem. Note that ThreadTimers is a per-thread singleton.
89
90         The correctness of this hardening was tested by commenting out the call to stop() and !isInHeap() assertion in
91         TimerBase::~TimerBase() as well as the !isInHeap() assertion in ThreadTimerHeapItem::clearTimer() and observing that
92         layout tests run successfully without hitting any debug assertions.
93
94         No new tests since there should be no observable behavior difference.
95
96         * WebCore.xcodeproj/project.pbxproj: Export ThreadTimers.h as a private header since it's now included in Timer.h
97         * platform/ThreadTimers.cpp:
98         (WebCore::ThreadTimers::updateSharedTimer): Delete ThreadTimerHeapItem's with nullptr TimerBase* (TimerBase had
99         already been deleted). This should only happen when TimerBase's destructor failed to remove itself from the timer heap,
100         which should never happen.
101         (WebCore::ThreadTimers::sharedTimerFiredInternal): Ditto. Also removed the redundant code which had removed the timer
102         from the heap since setNextFireTime does the removal already.
103         * platform/ThreadTimers.h: Outdented the whole file.
104         (WebCore::ThreadTimers::timerHeap): We use Vector<RefPtr<ThreadTimerHeapItem>> instead of Vector<Ref<~>> since Ref<~>
105         doesn't have a copy constructor which is used by std::push_heap.
106         (WebCore::ThreadTimerHeapItem): Added.
107         (WebCore::ThreadTimerHeapItem::hasTimer const): Added.
108         (WebCore::ThreadTimerHeapItem::setNotInHeap): Added. ThreadTimerHeapItem uses unsigned -1 as the single value which
109         signifies the item not being in the heap instead of all negative values as in the old code in TimerBase.
110         (WebCore::ThreadTimerHeapItem::isInHeap const): Added.
111         (WebCore::ThreadTimerHeapItem::isFirstInHeap const): Added.
112         (WebCore::ThreadTimerHeapItem::timer): Added.
113         (WebCore::ThreadTimerHeapItem::clearTimer): Added.
114         (WebCore::ThreadTimerHeapItem::heapIndex const): Added.
115         (WebCore::ThreadTimerHeapItem::setHeapIndex): Added.
116         (WebCore::ThreadTimerHeapItem::timerHeap const): Added.
117         * platform/Timer.cpp:
118         (WebCore::threadGlobalTimerHeap): This function is now only used in assertions.
119         (WebCore::ThreadTimerHeapItem::ThreadTimerHeapItem): Added.
120         (WebCore::ThreadTimerHeapItem::create): Added.
121         (WebCore::TimerHeapPointer::TimerHeapPointer):
122         (WebCore::TimerHeapPointer::operator-> const):
123         (WebCore::TimerHeapReference::TimerHeapReference): Added a copy constructor.
124         (WebCore::TimerHeapReference::copyRef const): Added.
125         (WebCore::TimerHeapReference::operator RefPtr<ThreadTimerHeapItem>& const):
126         (WebCore::TimerHeapPointer::operator* const):
127         (WebCore::TimerHeapReference::operator=): Use move assignment operator.
128         (WebCore::TimerHeapReference::swapWith):
129         (WebCore::TimerHeapReference::updateHeapIndex): Extracted to share code between two verions of operator=.
130         (WebCore::swap):
131         (WebCore::TimerHeapIterator::TimerHeapIterator):
132         (WebCore::TimerHeapIterator::operator-> const):
133         (WebCore::TimerHeapLessThanFunction::compare): Added variants which take RefPtr<ThreadTimerHeapItem>.
134         (WebCore::TimerHeapLessThanFunction::operator() const):
135         (WebCore::TimerBase::TimerBase):
136         (WebCore::TimerBase::~TimerBase):Clear the raw pointer in ThreadTimerHeapItem.
137         (WebCore::TimerBase::stop):
138         (WebCore::TimerBase::nextFireInterval const):
139         (WebCore::TimerBase::checkHeapIndex const): Added the consistency check for other items in the heap.
140         (WebCore::TimerBase::checkConsistency const):
141         (WebCore::TimerBase::heapDecreaseKey):
142         (WebCore::TimerBase::heapDelete):
143         (WebCore::TimerBase::heapDeleteMin):
144         (WebCore::TimerBase::heapIncreaseKey):
145         (WebCore::TimerBase::heapInsert):
146         (WebCore::TimerBase::heapPop):
147         (WebCore::TimerBase::heapPopMin):
148         (WebCore::TimerBase::heapDeleteNullMin): Added. Used to delete ThreadTimerHeapItem which no longer has a valid TimerBase.
149         (WebCore::parentHeapPropertyHolds):
150         (WebCore::childHeapPropertyHolds):
151         (WebCore::TimerBase::hasValidHeapPosition const):
152         (WebCore::TimerBase::updateHeapIfNeeded): Tweaked the heap index assertion as heapIndex() itself would assert when called
153         on an item with an invalid (-1) heap index.
154         (WebCore::TimerBase::setNextFireTime): Create ThreadTimerHeapItem. Note m_heapItem is never cleared until this TimerBase
155         is deleted.
156         (WebCore::TimerHeapReference::operator TimerBase* const): Deleted.
157         * platform/Timer.h:
158         (WebCore::TimerBase): Replaced m_nextFireTime, m_heapIndex, m_heapInsertionOrder, and m_cachedThreadGlobalTimerHeap
159         by m_heapItem, RefPtr to an ThreadTimerHeapItem.
160         (WebCore::TimerBase::augmentFireInterval):
161         (WebCore::TimerBase::inHeap const):
162         (WebCore::TimerBase::nextFireTime const):
163         (WebCore::TimerBase::isActive const):
164         (WebCore::TimerBase:: const): Deleted.
165
166 2019-01-09  Alex Christensen  <achristensen@webkit.org>
167
168         REGRESSION(239737) iOS quicklook tests should not dereference null
169         https://bugs.webkit.org/show_bug.cgi?id=193307
170
171         Reviewed by Brent Fulgham.
172
173         The quicklook tests rely on ResourceHandle on iOS for some reason.
174         This is a problem we'll fix later, but for now keep them working by not crashing.
175
176         * platform/network/mac/ResourceHandleMac.mm:
177         (WebCore::ResourceHandle::createNSURLConnection):
178         (WebCore::ResourceHandle::start):
179         (WebCore::ResourceHandle::willSendRequest):
180         (WebCore::ResourceHandle::tryHandlePasswordBasedAuthentication):
181         (WebCore::ResourceHandle::receivedCredential):
182
183 2019-01-09  Zalan Bujtas  <zalan@apple.com>
184
185         [Datalist] Crash when input with datalist is dynamically added.
186         https://bugs.webkit.org/show_bug.cgi?id=193012
187         <rdar://problem/45923457>
188
189         Reviewed by Brent Fulgham.
190
191         In certain cases (cloning, setAttribute), it's too early to check for the list attribute in createShadowSubtree
192         to see whether the input needs datalist related items. The list attribute is simply not set yet.
193         This patch only addresses the obvious crash. m_dataListDropdownIndicator clearly lacks proper lifecycle management (see webkit.org/b/193032). 
194
195         Test: fast/forms/datalist/datalist-crash-when-dynamic.html
196
197         * html/TextFieldInputType.cpp:
198         (WebCore::TextFieldInputType::createShadowSubtree):
199         (WebCore::TextFieldInputType::attributeChanged):
200         (WebCore::TextFieldInputType::createDataListDropdownIndicator):
201         * html/TextFieldInputType.h:
202
203 2019-01-09  Justin Fan  <justin_fan@apple.com>
204
205         [WebGPU] Fix vertex-buffer-triangle-strip test and small update to GPURenderPipeline
206         https://bugs.webkit.org/show_bug.cgi?id=193289
207
208         Reviewed by Dean Jackson.
209
210         Fix broken test after pipeline layouts were added, and a small refactoring to GPURenderPipeline to avoid
211         retaining its descriptor after creation.
212
213         * platform/graphics/gpu/GPURenderPipeline.h:
214         (WebCore::GPURenderPipeline::primitiveTopology const):
215         * platform/graphics/gpu/cocoa/GPURenderPipelineMetal.mm:
216         (WebCore::GPURenderPipeline::GPURenderPipeline):
217
218 2019-01-09  Devin Rousso  <drousso@apple.com>
219
220         Web Inspector: Protocol Logging: log messages as objects if inspector^2 is open
221         https://bugs.webkit.org/show_bug.cgi?id=193284
222
223         Reviewed by Joseph Pecoraro.
224
225         No newe tests, as this is simply exposes a value.
226
227         * inspector/InspectorFrontendHost.idl:
228         * inspector/InspectorFrontendHost.h:
229         * inspector/InspectorFrontendHost.cpp:
230         (WebCore::InspectorFrontendHost::isBeingInspected): Added.
231
232 2019-01-09  Zalan Bujtas  <zalan@apple.com>
233
234         [LFC][BFC][MarginCollapsing] Add support for peculiar cases.
235         https://bugs.webkit.org/show_bug.cgi?id=192625
236
237         Reviewed by Antti Koivisto.
238
239         Implement some of the more peculiar cases like margin collpasing through multiple boxes etc.
240         Add ~100 new passing cases.
241
242         * layout/FormattingContextGeometry.cpp:
243         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedHeightAndMargin):
244         * layout/LayoutState.h:
245         (WebCore::Layout::LayoutState::hasFormattingState const):
246         * layout/MarginTypes.h:
247         * layout/blockformatting/BlockFormattingContext.cpp:
248         (WebCore::Layout::BlockFormattingContext::computeEstimatedMarginBefore const):
249         (WebCore::Layout::BlockFormattingContext::computeEstimatedMarginBeforeForAncestors const):
250         (WebCore::Layout::hasPrecomputedMarginBefore):
251         (WebCore::Layout::BlockFormattingContext::computeFloatingPosition const):
252         (WebCore::Layout::BlockFormattingContext::computePositionToAvoidFloats const):
253         (WebCore::Layout::BlockFormattingContext::computeVerticalPositionForFloatClear const):
254         (WebCore::Layout::BlockFormattingContext::computeHeightAndMargin const):
255         (WebCore::Layout::BlockFormattingContext::adjustedVerticalPositionAfterMarginCollapsing const):
256         * layout/blockformatting/BlockFormattingContext.h:
257         (WebCore::Layout::BlockFormattingContext::blockFormattingState const):
258         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
259         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin):
260         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowHeightAndMargin):
261         (WebCore::Layout::BlockFormattingContext::Geometry::estimatedMarginBefore): Deleted.
262         (WebCore::Layout::BlockFormattingContext::Geometry::estimatedMarginAfter): Deleted.
263         * layout/blockformatting/BlockFormattingContextQuirks.cpp:
264         (WebCore::Layout::BlockFormattingContext::Quirks::stretchedInFlowHeight):
265         (WebCore::Layout::BlockFormattingContext::Quirks::shouldIgnoreMarginAfter):
266         (WebCore::Layout::BlockFormattingContext::Quirks::stretchedHeight): Deleted.
267         * layout/blockformatting/BlockFormattingState.h:
268         (WebCore::Layout::BlockFormattingState::setPositiveAndNegativeVerticalMargin):
269         (WebCore::Layout::BlockFormattingState::hasPositiveAndNegativeVerticalMargin const):
270         (WebCore::Layout::BlockFormattingState::positiveAndNegativeVerticalMargin const):
271         (WebCore::Layout::BlockFormattingState::setHasEstimatedMarginBefore):
272         (WebCore::Layout::BlockFormattingState::clearHasEstimatedMarginBefore):
273         (WebCore::Layout::BlockFormattingState::hasEstimatedMarginBefore const):
274         * layout/blockformatting/BlockMarginCollapse.cpp:
275         (WebCore::Layout::hasClearance):
276         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginBeforeCollapsesWithParentMarginAfter):
277         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginBeforeCollapsesWithParentMarginBefore):
278         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginBeforeCollapsesWithPreviousSiblingMarginAfter):
279         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginBeforeCollapsesWithFirstInFlowChildMarginBefore):
280         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginAfterCollapsesWithSiblingMarginBeforeWithClearance):
281         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginAfterCollapsesWithParentMarginBefore):
282         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginAfterCollapsesWithLastInFlowChildMarginAfter):
283         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginAfterCollapsesWithNextSiblingMarginBefore):
284         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginsCollapseThrough):
285         (WebCore::Layout::computedPositiveAndNegativeMargin):
286         (WebCore::Layout::marginValue):
287         (WebCore::Layout::BlockFormattingContext::MarginCollapse::updateCollapsedMarginAfter):
288         (WebCore::Layout::BlockFormattingContext::MarginCollapse::positiveNegativeValues):
289         (WebCore::Layout::BlockFormattingContext::MarginCollapse::positiveNegativeMarginBefore):
290         (WebCore::Layout::BlockFormattingContext::MarginCollapse::positiveNegativeMarginAfter):
291         (WebCore::Layout::BlockFormattingContext::MarginCollapse::estimatedMarginBefore):
292         (WebCore::Layout::BlockFormattingContext::MarginCollapse::collapsedVerticalValues):
293         (WebCore::Layout::BlockFormattingContext::MarginCollapse::computedNonCollapsedMarginBefore): Deleted.
294         (WebCore::Layout::BlockFormattingContext::MarginCollapse::computedNonCollapsedMarginAfter): Deleted.
295         (WebCore::Layout::BlockFormattingContext::MarginCollapse::nonCollapsedMarginBefore): Deleted.
296         (WebCore::Layout::BlockFormattingContext::MarginCollapse::nonCollapsedMarginAfter): Deleted.
297         (WebCore::Layout::BlockFormattingContext::MarginCollapse::collapsedMarginBeforeFromFirstChild): Deleted.
298         (WebCore::Layout::BlockFormattingContext::MarginCollapse::collapsedMarginAfterFromLastChild): Deleted.
299         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginBeforeCollapsesWithPreviousSibling): Deleted.
300         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginAfterCollapsesWithNextSibling): Deleted.
301         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginBefore): Deleted.
302         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginAfter): Deleted.
303         * layout/displaytree/DisplayBox.cpp:
304         (WebCore::Display::Box::Box):
305         * layout/displaytree/DisplayBox.h:
306         (WebCore::Display::Box::hasClearance const):
307         (WebCore::Display::Box::setEstimatedMarginBefore):
308         (WebCore::Display::Box::estimatedMarginBefore const):
309         (WebCore::Display::Box::setHasClearance):
310         (WebCore::Display::Box::invalidateEstimatedMarginBefore):
311         (WebCore::Display::Box::setVerticalMargin):
312         (WebCore::Display::Box::rectWithMargin const):
313         * layout/floats/FloatingContext.cpp:
314         (WebCore::Layout::FloatingContext::verticalPositionWithClearance const):
315         * layout/inlineformatting/InlineFormattingContext.cpp:
316         (WebCore::Layout::InlineFormattingContext::collectInlineContentForSubtree const):
317
318 2019-01-09  Carlos Garcia Campos  <cgarcia@igalia.com>
319
320         REGRESSION(r239156): [FreeType] fixed width, and synthetic bold/italic not correctly applied since r239156
321         https://bugs.webkit.org/show_bug.cgi?id=193276
322
323         Reviewed by Žan Doberšek.
324
325         FontCache::createFontPlatformData() is calling getFontPropertiesFromPattern() with the configure pattern instead
326         of the result one after the match.
327
328         * platform/graphics/freetype/FontCacheFreeType.cpp:
329         (WebCore::FontCache::createFontPlatformData):
330
331 2019-01-08  Dean Jackson  <dino@apple.com>
332
333         Blob references for System Previews don't get a correct file extension
334         https://bugs.webkit.org/show_bug.cgi?id=193268
335         <rdar://problem/47133037>
336
337         Reviewed by Tim Horton.
338
339         Apple platforms don't yet have a mapping from the USD MIME type to
340         file extensions (and we support some non-standard MIME types), which
341         means that downloads from Blob references don't get correctly named.
342
343         Fix this by adding an explicit mapping between System Preview types
344         and ".usdz".
345
346         WebKit API test: _WKDownload.SystemPreviewUSDZBlobNaming
347
348         * platform/MIMETypeRegistry.cpp:
349         (WebCore::MIMETypeRegistry::isSystemPreviewMIMEType): Remove USE(SYSTEM_PREVIEW) since
350         this applies to macOS and iOS now.
351         * platform/MIMETypeRegistry.h:
352         * platform/cocoa/MIMETypeRegistryCocoa.mm:
353         (WebCore::MIMETypeRegistry::getPreferredExtensionForMIMEType): Add a mapping
354         for USDZ.
355
356 2019-01-08  Tim Horton  <timothy_horton@apple.com>
357
358         Editable images sometimes don't become focused when tapped
359         https://bugs.webkit.org/show_bug.cgi?id=193259
360         <rdar://problem/47038424>
361
362         Reviewed by Wenson Hsieh.
363
364         Often when tapping an editable image inside an editable text area, the
365         text area's selection will change instead of focusing the editable image.
366
367         No new tests; I have had no luck writing a test that reliably failed 
368         beforehand (the "sometimes" is a problem).
369
370         * html/HTMLImageElement.cpp:
371         (WebCore::HTMLImageElement::defaultEventHandler):
372         * html/HTMLImageElement.h:
373         Override mousedown on editable images, focus the image, and prevent
374         the default behavior.
375
376 2019-01-08  Jiewen Tan  <jiewen_tan@apple.com>
377
378         [WebAuthN] Support U2F HID Authenticators on macOS
379         https://bugs.webkit.org/show_bug.cgi?id=191535
380         <rdar://problem/47102027>
381
382         Reviewed by Brent Fulgham.
383
384         This patch changes U2fCommandConstructor to produce register commands with
385         enforcing test of user presence. Otherwise, authenticators would silently
386         generate credentials. It also renames readFromU2fSignResponse to
387         readU2fSignResponse.
388
389         Tests: http/wpt/webauthn/public-key-credential-create-failure-u2f-silent.https.html
390                http/wpt/webauthn/public-key-credential-create-failure-u2f.https.html
391                http/wpt/webauthn/public-key-credential-create-success-u2f.https.html
392                http/wpt/webauthn/public-key-credential-get-failure-u2f-silent.https.html
393                http/wpt/webauthn/public-key-credential-get-failure-u2f.https.html
394                http/wpt/webauthn/public-key-credential-get-success-u2f.https.html
395
396         * Modules/webauthn/fido/U2fCommandConstructor.cpp:
397         (fido::WebCore::constructU2fRegisterCommand):
398         * Modules/webauthn/fido/U2fResponseConverter.cpp:
399         (fido::readU2fSignResponse):
400         (fido::readFromU2fSignResponse): Deleted.
401         * Modules/webauthn/fido/U2fResponseConverter.h:
402
403 2019-01-08  Wenson Hsieh  <wenson_hsieh@apple.com>
404
405         [iOS] Dispatch a synthetic mousedown event prior to starting drags
406         https://bugs.webkit.org/show_bug.cgi?id=193229
407         <rdar://problem/46717097>
408
409         Reviewed by Tim Horton.
410
411         Tweaks some drag initiation logic on iOS to actually send a "mousedown" event to the page prior to drag start.
412         This improves drag and drop compatibility with web pages that expect a mousedown to always precede dragging.
413         Additionally, ensure that preventing the "mousedown" event also prevents "dragstart", which matches macOS
414         behavior.
415
416         Test: DragAndDropTests.PreventingMouseDownShouldPreventDragStart
417
418         * page/EventHandler.cpp:
419
420         Make the text drag delay 0 on iOS. This was introduced on iOS when originally bringing up drag and drop, and was
421         made to simply match macOS. However, it doesn't make sense to respect the delay here, since the purpose of this
422         delay is to disambiguate between making a text selection and starting a drag when pressing on text that is
423         already selected; on iOS (including iOSMac), this gesture conflict is already resolved by platform gesture
424         recognizers in the client layer, so there is always no delay between mouse down and drag here.
425
426         * page/ios/EventHandlerIOS.mm:
427
428         Dispatch a mousedown and inspect the value of `m_mouseDownMayStartDrag` when starting a drag on iOS. This brings
429         our behavior closer in line with macOS.
430
431         (WebCore::EventHandler::tryToBeginDataInteractionAtPoint):
432
433 2019-01-08  Youenn Fablet  <youenn@apple.com>
434
435         service worker fetch handler results in bad referrer
436         https://bugs.webkit.org/show_bug.cgi?id=188248
437         <rdar://problem/47050478>
438
439         Reviewed by Alex Christensen.
440
441         Response sanitization was removing the ReferrerPolicy header from opaque redirect responses.
442         Reduce sanitization of opaque redirect responses to opaque responses and allow Location header.
443         Make sure referrer policy is updated for all load redirections, not only CORS loads.
444
445         Test: http/tests/security/referrer-policy-redirect-link-downgrade.html
446
447         * loader/SubresourceLoader.cpp:
448         (WebCore::SubresourceLoader::checkRedirectionCrossOriginAccessControl):
449         * platform/network/ResourceResponseBase.cpp:
450         (WebCore::isSafeCrossOriginResponseHeader):
451         (WebCore::ResourceResponseBase::sanitizeHTTPHeaderFieldsAccordingToTainting):
452
453 2019-01-08  Youenn Fablet  <youenn@apple.com>
454
455         IDB storage of Crypto keys does not work in private browsing mode
456         https://bugs.webkit.org/show_bug.cgi?id=193219
457
458         Reviewed by Brady Eidson.
459
460         https://trac.webkit.org/changeset/238677 moved from using a JSGlobalObject to a JSDOMGlobalObject for serialization/deserialization.
461         This does not work for crypto keys as they require not only a JSDOMGlobalObject but either a window or worker global object.
462
463         To fix the issue, revert 238677, and fix it by checking whether the dumping of an ArrayBuffer happens for a JSDOMGlobalObject or a JSGlobalObject.
464         If it is the latter, use JSC routines instead of toJS() which requires a JSDOMGlobalObject.
465
466         Covered by updated test.
467
468         * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
469         (WebCore::IDBServer::UniqueIDBDatabase::databaseThreadVM):
470         (WebCore::IDBServer::UniqueIDBDatabase::databaseThreadExecState):
471         * bindings/js/JSDOMGlobalObject.cpp:
472         * bindings/js/JSDOMGlobalObject.h:
473         * bindings/js/JSDOMWrapper.cpp:
474         (WebCore::JSDOMObject::JSDOMObject):
475         * bindings/js/SerializedScriptValue.cpp:
476         (WebCore::CloneSerializer::dumpArrayBufferView):
477         (WebCore::CloneSerializer::toJSArrayBuffer):
478
479 2019-01-08  Justin Fan  <justin_fan@apple.com>
480
481         [WebGPU] Update createRenderPipeline for WebGPUPipelineLayout
482         https://bugs.webkit.org/show_bug.cgi?id=193247
483
484         Reviewed by Dean Jackson.
485
486         Add WebGPUPipelineLayout to WebGPURenderPipeline via WebGPUPipelineDescriptorBase.
487
488         Test: Updated render-pipelines.html to test new functionality.
489
490         * Modules/webgpu/WebGPUDevice.cpp:
491         (WebCore::WebGPUDevice::createRenderPipeline const): Convert WebGPUPipelineLayout to GPUPipelineLayout.
492         * Modules/webgpu/WebGPUPipelineDescriptorBase.h:
493         * Modules/webgpu/WebGPUPipelineDescriptorBase.idl: Add layout field.
494         * Modules/webgpu/WebGPUPipelineLayout.h: 
495         (WebCore::WebGPUPipelineLayout::pipelineLayout): Added. Getter.
496         * platform/graphics/gpu/GPUPipelineDescriptorBase.h: Updated from out-of-date version.
497         * platform/graphics/gpu/GPUPipelineLayout.cpp:
498         (WebCore::GPUPipelineLayout::GPUPipelineLayout): Now retains bindGroupLayouts from descriptor.
499         * platform/graphics/gpu/GPUPipelineLayout.h:
500         * platform/graphics/gpu/GPURenderPipelineDescriptor.h: Now inherits from GPUPipelineDescriptorBase.
501         (WebCore::GPURenderPipelineDescriptor::GPURenderPipelineDescriptor): Custom constructor for non-aggregate struct.
502
503 2019-01-08  Chris Dumez  <cdumez@apple.com>
504
505         Prevent cross-site top-level navigations from third-party iframes
506         https://bugs.webkit.org/show_bug.cgi?id=193076
507         <rdar://problem/36074736>
508
509         Reviewed by Alex Christensen.
510
511         Prevent cross-site top-level navigations from third-party iframes if the following conditions are met:
512         1. Its tries to navigate the top-level page cross-site (different eTDL+1)
513         2. The user has never interacted with the third-party iframe or any of its subframes
514
515         This experiment's intent is to block suspicious main-frame navigations by third-party content. The feature
516         is behind a runtime experimental feature flag, on by default.
517
518         Tests: http/tests/security/allow-top-level-navigations-by-third-party-iframes-to-same-origin.html
519                http/tests/security/allow-top-level-navigations-by-third-party-iframes-with-previous-user-activation.html
520                http/tests/security/allow-top-level-navigations-by-third-party-iframes-with-user-activation.html
521                http/tests/security/block-top-level-navigations-by-third-party-iframes.html
522
523         * dom/Document.cpp:
524         (WebCore::printNavigationErrorMessage):
525         (WebCore::Document::canNavigate):
526         (WebCore::Document::canNavigateInternal):
527         (WebCore::Document::isNavigationBlockedByThirdPartyIFrameRedirectBlocking):
528         * dom/Document.h:
529         * dom/UserGestureIndicator.cpp:
530         * page/DOMWindow.cpp:
531         (WebCore::DOMWindow::setLocation):
532         * page/DOMWindow.h:
533         * page/Frame.h:
534         * page/Location.cpp:
535         (WebCore::Location::replace):
536         (WebCore::Location::setLocation):
537         * page/Settings.yaml:
538
539 2019-01-08  Alex Christensen  <achristensen@webkit.org>
540
541         Stop using NetworkStorageSession in WebProcess
542         https://bugs.webkit.org/show_bug.cgi?id=193236
543
544         Reviewed by Don Olmstead.
545
546         No change in behavior.  Some code was only used for ResourceHandle, which isn't used in modern WebKit,
547         and for cookies, which are handled in the NetworkProcess in modern WebKit.
548
549         * loader/CookieJar.cpp:
550         (WebCore::storageSession):
551         * loader/EmptyClients.cpp:
552         * platform/network/NetworkingContext.h:
553         * platform/network/mac/ResourceHandleMac.mm:
554         (WebCore::ResourceHandle::createNSURLConnection):
555         (WebCore::ResourceHandle::start):
556         (WebCore::ResourceHandle::platformLoadResourceSynchronously):
557         (WebCore::ResourceHandle::willSendRequest):
558         (WebCore::ResourceHandle::tryHandlePasswordBasedAuthentication):
559         (WebCore::ResourceHandle::receivedCredential):
560
561 2019-01-08  Alex Christensen  <achristensen@webkit.org>
562
563         Unreviewed, rolling out r239727.
564
565         Broke API tests
566
567         Reverted changeset:
568
569         "Stop using NetworkStorageSession in WebProcess"
570         https://bugs.webkit.org/show_bug.cgi?id=193236
571         https://trac.webkit.org/changeset/239727
572
573 2019-01-08  Alex Christensen  <achristensen@webkit.org>
574
575         Stop using NetworkStorageSession in WebProcess
576         https://bugs.webkit.org/show_bug.cgi?id=193236
577
578         Reviewed by Don Olmstead.
579
580         No change in behavior.  Some code was only used for ResourceHandle, which isn't used in modern WebKit,
581         and for cookies, which are handled in the NetworkProcess in modern WebKit.
582
583         * loader/CookieJar.cpp:
584         (WebCore::storageSession):
585         * loader/EmptyClients.cpp:
586         * platform/network/NetworkingContext.h:
587         * platform/network/mac/ResourceHandleMac.mm:
588         (WebCore::ResourceHandle::createNSURLConnection):
589         (WebCore::ResourceHandle::start):
590         (WebCore::ResourceHandle::platformLoadResourceSynchronously):
591         (WebCore::ResourceHandle::willSendRequest):
592         (WebCore::ResourceHandle::tryHandlePasswordBasedAuthentication):
593         (WebCore::ResourceHandle::receivedCredential):
594
595 2019-01-08  Chris Dumez  <cdumez@apple.com>
596
597         Regression(PSON-r239182): Blank view when navigating back and forth between google.com and stack overflow
598         https://bugs.webkit.org/show_bug.cgi?id=193224
599         <rdar://problem/47097726>
600
601         Reviewed by Alex Christensen.
602
603         Since r239182, pages get suspended in-place when we suspend the old process after a process-swap on navigation.
604         When we return to a suspended page, we load the current history item again and it normally properly restores
605         the page from PageCache, even though we load the same history item and the current one and even though the
606         page is suspended in-place (i.e. we did not navigate away, which is the usual case for page cache).
607
608         The issue is that if the page URL contains a fragment, FrameLoader::shouldPerformFragmentNavigation() would
609         return true because both the source and destination URLs (which are the same) contains a fragment. To address
610         the issue, update FrameLoader::shouldPerformFragmentNavigation() to return false if the current page is
611         suspended.
612
613         * loader/FrameLoader.cpp:
614         (WebCore::FrameLoader::shouldPerformFragmentNavigation):
615
616 2019-01-08  Alex Christensen  <achristensen@webkit.org>
617
618         Move Windows-specific code from NetworkStorageSessionCFNet.cpp to its own file
619         https://bugs.webkit.org/show_bug.cgi?id=192958
620
621         Reviewed by Yusuke Suzuki.
622
623         This makes it easier to reason about what code is used where.
624
625         * PlatformAppleWin.cmake:
626         * platform/network/cf/NetworkStorageSessionCFNet.cpp:
627         (WebCore::createPrivateStorageSession): Deleted.
628         (WebCore::cookieDomain): Deleted.
629         (WebCore::canonicalCookieTime): Deleted.
630         (WebCore::cookieCreatedTime): Deleted.
631         (WebCore::cookieExpirationTime): Deleted.
632         (WebCore::cookieName): Deleted.
633         (WebCore::cookiePath): Deleted.
634         (WebCore::cookieValue): Deleted.
635         (WebCore::filterCookies): Deleted.
636         (WebCore::copyCookiesForURLWithFirstPartyURL): Deleted.
637         (WebCore::createCookies): Deleted.
638         (WebCore::NetworkStorageSession::setCookiesFromDOM const): Deleted.
639         (WebCore::containsSecureCookies): Deleted.
640         (WebCore::NetworkStorageSession::cookiesForDOM const): Deleted.
641         (WebCore::NetworkStorageSession::cookieRequestHeaderFieldValue const): Deleted.
642         (WebCore::NetworkStorageSession::cookiesEnabled const): Deleted.
643         (WebCore::NetworkStorageSession::getRawCookies const): Deleted.
644         (WebCore::NetworkStorageSession::deleteCookie const): Deleted.
645         (WebCore::NetworkStorageSession::getHostnamesWithCookies): Deleted.
646         (WebCore::NetworkStorageSession::deleteAllCookies): Deleted.
647         (WebCore::NetworkStorageSession::deleteCookiesForHostnames): Deleted.
648         (WebCore::NetworkStorageSession::deleteAllCookiesModifiedSince): Deleted.
649         * platform/network/cf/NetworkStorageSessionCFNetWin.cpp: Added.
650         (WebCore::createPrivateStorageSession):
651         (WebCore::NetworkStorageSession::setCookies):
652         (WebCore::cookieDomain):
653         (WebCore::canonicalCookieTime):
654         (WebCore::cookieCreatedTime):
655         (WebCore::cookieExpirationTime):
656         (WebCore::cookieName):
657         (WebCore::cookiePath):
658         (WebCore::cookieValue):
659         (WebCore::filterCookies):
660         (WebCore::copyCookiesForURLWithFirstPartyURL):
661         (WebCore::createCookies):
662         (WebCore::NetworkStorageSession::setCookiesFromDOM const):
663         (WebCore::containsSecureCookies):
664         (WebCore::NetworkStorageSession::cookiesForDOM const):
665         (WebCore::NetworkStorageSession::cookieRequestHeaderFieldValue const):
666         (WebCore::NetworkStorageSession::cookiesEnabled const):
667         (WebCore::NetworkStorageSession::getRawCookies const):
668         (WebCore::NetworkStorageSession::deleteCookie const):
669         (WebCore::NetworkStorageSession::getHostnamesWithCookies):
670         (WebCore::NetworkStorageSession::deleteAllCookies):
671         (WebCore::NetworkStorageSession::deleteCookiesForHostnames):
672         (WebCore::NetworkStorageSession::deleteAllCookiesModifiedSince):
673
674 2018-12-19  Antoine Quint  <graouts@apple.com>
675
676         [Web Animations] Compute animation effect timing properties in batch
677         https://bugs.webkit.org/show_bug.cgi?id=192850
678
679         Reviewed by Dean Jackson.
680
681         We remove a host of functions from AnimationEffect that would allow the computation of various timing properties
682         defined by the Web Animations specification: phase, progress, current iteration, etc. Indeed, a lot of these functions
683         would call each other in a chain, and we would re-compute a lot of the earlier properties in those chains several times
684         when doing something like querying the animation progress. Additionally, some functions, such as WebAnimation::computeRelevance()
685         and WebAnimation::timeToNextTick() would yield the computation of several such properties numerous times. All of those
686         functions are called during each animation frame and are ripe for optimizations.
687
688         We now compute all timing properties across two functions:
689         
690         1. the new AnimationEffect::getBasicTiming() which computes the local time, end time, active duration, active time and phase,
691         2. the existing AnimationEffect::getComputedTiming() which now also exposes the phase and simple iteration progress.
692
693         To support this we introduce a new BasicEffectTiming struct to contain the values computed in AnimationEffect::getBasicTiming()
694         and spun the AnimationEffect::Phase struct as AnimationEffectPhase so that it may be used across BasicEffectTiming and
695         ComputedEffectTiming.
696
697         No new test since there is no user-observable change.
698
699         * WebCore.xcodeproj/project.pbxproj:
700         * animation/AnimationEffect.cpp:
701         (WebCore::AnimationEffect::getTiming const):
702         (WebCore::AnimationEffect::getBasicTiming const):
703         (WebCore::AnimationEffect::getComputedTiming const):
704         (WebCore::AnimationEffect::localTime const): Deleted.
705         (WebCore::AnimationEffect::phase const): Deleted.
706         (WebCore::AnimationEffect::activeTime const): Deleted.
707         (WebCore::AnimationEffect::overallProgress const): Deleted.
708         (WebCore::AnimationEffect::simpleIterationProgress const): Deleted.
709         (WebCore::AnimationEffect::currentIteration const): Deleted.
710         (WebCore::AnimationEffect::currentDirection const): Deleted.
711         (WebCore::AnimationEffect::directedProgress const): Deleted.
712         (WebCore::AnimationEffect::transformedProgress const): Deleted.
713         (WebCore::AnimationEffect::iterationProgress const): Deleted.
714         (WebCore::AnimationEffect::getTiming): Deleted.
715         (WebCore::AnimationEffect::getComputedTiming): Deleted.
716         (WebCore::AnimationEffect::endTime const): Deleted.
717         (WebCore::AnimationEffect::activeDuration const): Deleted.
718         * animation/AnimationEffect.h:
719         * animation/AnimationEffectPhase.h: Copied from Source/WebCore/animation/ComputedEffectTiming.h.
720         * animation/AnimationTimeline.cpp:
721         (WebCore::AnimationTimeline::updateCSSTransitionsForElement):
722         * animation/AnimationTimeline.h:
723         * animation/BasicEffectTiming.h: Copied from Source/WebCore/animation/ComputedEffectTiming.h.
724         * animation/ComputedEffectTiming.h:
725         * animation/DeclarativeAnimation.cpp:
726         (WebCore::DeclarativeAnimation::cancel):
727         (WebCore::DeclarativeAnimation::phaseWithoutEffect const):
728         (WebCore::DeclarativeAnimation::invalidateDOMEvents):
729         * animation/DeclarativeAnimation.h:
730         * animation/KeyframeEffect.cpp:
731         (WebCore::KeyframeEffect::apply):
732         (WebCore::KeyframeEffect::getAnimatedStyle):
733         * animation/WebAnimation.cpp:
734         (WebCore::WebAnimation::effectEndTime const):
735         (WebCore::WebAnimation::computeRelevance):
736         (WebCore::WebAnimation::timeToNextTick const):
737
738 2019-01-07  Youenn Fablet  <youenn@apple.com>
739
740         Crash in SWServer::Connection::resolveRegistrationReadyRequests
741         https://bugs.webkit.org/show_bug.cgi?id=193217
742
743         Reviewed by Chris Dumez.
744
745         As can be seen from the traces, SWServer might clear its connections HashMap in its destructor.
746         This might then trigger calling SWServer::resolveRegistrationReadyRequests.
747         This method is iterating on the connections HashMap which is being cleared.
748         To remove this problem, move the HashMap in a temporary variable and clear the temporary variable.
749
750         * workers/service/server/SWServer.cpp:
751         (WebCore::SWServer::~SWServer):
752
753 2019-01-07  Jer Noble  <jer.noble@apple.com>
754
755         REGRESSION (r239519): ASSERTION FAILED: !m_adoptionIsRequired in com.apple.WebCore: void WTF::refIfNotNull<WebCore::CDMSessionMediaSourceAVFObjC> + 53
756         https://bugs.webkit.org/show_bug.cgi?id=193211
757         <rdar://problem/46937412>
758
759         Reviewed by Eric Carlson.
760
761         Make CDMSessionMediaSourceAVFObjC a CanMakeWeakPtr rather than RefCounted, as CDMSessions are stored in
762         std::unique_ptrs, and not in Ref or RefPtr.
763
764         * platform/graphics/avfoundation/objc/CDMSessionMediaSourceAVFObjC.h:
765         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
766         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
767         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setCDMSession):
768
769 2019-01-07  David Kilzer  <ddkilzer@apple.com>
770
771         Prefer RetainPtr<NSObject> to RetainPtr<NSObject *>
772         <https://webkit.org/b/193056>
773
774         Reviewed by Alex Christensen.
775
776         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
777         (-[WebAVStreamDataParserListener streamDataParser:didParseStreamDataAsAsset:]):
778         (-[WebAVStreamDataParserListener streamDataParser:didParseStreamDataAsAsset:withDiscontinuity:]):
779         * platform/network/cf/AuthenticationChallenge.h:
780         - Remove '*' from RetainPtr<> type.
781
782         * platform/network/cocoa/NetworkStorageSessionCocoa.mm:
783         (WebCore::cookiesForURL):
784         - Once retainPtr() was changed to return RetainPtr<NSArray>
785           instead of RetainPtr<NSArray *> here, that forced the type of
786           `cookiesPtr` to change as well since
787           Optional<RetainPtr<NSArray>> is not assignable to
788           Optional<RetainPtr<NSArray *>> without further template
789           specialization, which didn't seem useful since
790           Optional<RetainPtr<>> variable types are rarely used.
791
792 2019-01-07  Devin Rousso  <drousso@apple.com>
793
794         Web Inspector: extend XHR breakpoints to work with fetch
795         https://bugs.webkit.org/show_bug.cgi?id=185843
796         <rdar://problem/40431027>
797
798         Reviewed by Matt Baker.
799
800         Test: inspector/dom-debugger/url-breakpoints.html
801
802         * Modules/fetch/FetchResponse.cpp:
803         (WebCore::FetchResponse::fetch):
804
805         * inspector/InspectorInstrumentation.h:
806         (WebCore::InspectorInstrumentation::willFetch): Added.
807         * inspector/InspectorInstrumentation.cpp:
808         (WebCore::InspectorInstrumentation::willFetchImpl): Added.
809
810         * inspector/agents/InspectorDOMDebuggerAgent.h:
811         * inspector/agents/InspectorDOMDebuggerAgent.cpp:
812         (WebCore::InspectorDOMDebuggerAgent::disable):
813         (WebCore::InspectorDOMDebuggerAgent::discardBindings):
814         (WebCore::InspectorDOMDebuggerAgent::setURLBreakpoint): Added.
815         (WebCore::InspectorDOMDebuggerAgent::removeURLBreakpoint): Added.
816         (WebCore::InspectorDOMDebuggerAgent::breakOnURLIfNeeded): Added.
817         (WebCore::InspectorDOMDebuggerAgent::willSendXMLHttpRequest):
818         (WebCore::InspectorDOMDebuggerAgent::willFetch): Added.
819         (WebCore::InspectorDOMDebuggerAgent::setXHRBreakpoint): Deleted.
820         (WebCore::InspectorDOMDebuggerAgent::removeXHRBreakpoint): Deleted.
821
822 2019-01-07  Eric Carlson  <eric.carlson@apple.com>
823
824         Cleanup AudioTrackPrivateMediaStreamCocoa
825         https://bugs.webkit.org/show_bug.cgi?id=193208
826         <rdar://problem/42225870>
827
828         Reviewed by Youenn Fablet.
829
830         * platform/mediastream/mac/AudioTrackPrivateMediaStreamCocoa.cpp:
831         (WebCore::AudioTrackPrivateMediaStreamCocoa::audioSamplesAvailable): Clear input and
832         output format descriptions after stopping the audio unit.
833
834 2019-01-07  Devin Rousso  <drousso@apple.com>
835
836         Web Inspector: Network: show secure connection details per-request
837         https://bugs.webkit.org/show_bug.cgi?id=191539
838         <rdar://problem/45979891>
839
840         Reviewed by Joseph Pecoraro.
841
842         Test: http/tests/inspector/network/resource-security-connection.html
843
844         * platform/network/NetworkLoadMetrics.h:
845         (WebCore::NetworkLoadMetrics:isolatedCopy):
846         (WebCore::NetworkLoadMetrics:clearNonTimingData):
847         (WebCore::NetworkLoadMetrics:operator==):
848         (WebCore::NetworkLoadMetrics:encode):
849         (WebCore::NetworkLoadMetrics:decode):
850
851         * inspector/agents/InspectorNetworkAgent.cpp:
852         (WebCore::InspectorNetworkAgent::buildObjectForMetrics):
853
854 2019-01-07  Eric Carlson  <eric.carlson@apple.com>
855
856         Deactivate audio session whenever possible
857         https://bugs.webkit.org/show_bug.cgi?id=193188
858         <rdar://problem/42678977>
859
860         Reviewed by Jer Noble.
861
862         Test: media/deactivate-audio-session.html
863
864         * platform/audio/AudioSession.cpp:
865         (WebCore::AudioSession::tryToSetActive):
866         (WebCore::AudioSession::tryToSetActiveInternal):
867         * platform/audio/AudioSession.h:
868         (WebCore::AudioSession::isActive const):
869
870         * platform/audio/PlatformMediaSessionManager.cpp:
871         (WebCore::PlatformMediaSessionManager::removeSession):
872         (WebCore::deactivateAudioSession):
873         (WebCore::PlatformMediaSessionManager::shouldDeactivateAudioSession):
874         (WebCore::PlatformMediaSessionManager::setShouldDeactivateAudioSession):
875         * platform/audio/PlatformMediaSessionManager.h:
876
877         * platform/audio/ios/AudioSessionIOS.mm:
878         (WebCore::AudioSession::tryToSetActiveInternal):
879         (WebCore::AudioSession::tryToSetActive): Deleted.
880
881         * platform/audio/mac/AudioSessionMac.cpp:
882         (WebCore::AudioSession::tryToSetActiveInternal):
883         (WebCore::AudioSession::tryToSetActive): Deleted.
884
885         * testing/Internals.cpp:
886         (WebCore::Internals::audioSessionActive const):
887         * testing/Internals.h:
888         * testing/Internals.idl:
889
890 2019-01-07  David Kilzer  <ddkilzer@apple.com>
891
892         PlatformECKey should use a std::unique_ptr
893         <https://webkit.org/b/193170>
894
895         Reviewed by Brent Fulgham.
896
897         Broadly:
898         - Switch from using raw pointers to using std::unique_ptr<> to
899           hold PlatformECKey.
900         - Introduce PlatformECKeyContainer type to handle different
901           std::unique_ptr<> types on each platform.
902         - Get rid of custom CryptoKeyEC destructors since the
903           std::unique_ptr<> handles that with a Deleter.
904         - Initialize stack variables to nullptr.
905
906         * crypto/gcrypt/CryptoKeyECGCrypt.cpp:
907         (WebCore::CryptoKeyEC::keySizeInBits const):
908         (WebCore::CryptoKeyEC::platformGeneratePair):
909         (WebCore::CryptoKeyEC::platformImportRaw):
910         (WebCore::CryptoKeyEC::platformImportJWKPublic):
911         (WebCore::CryptoKeyEC::platformImportJWKPrivate):
912         (WebCore::CryptoKeyEC::platformImportSpki):
913         (WebCore::CryptoKeyEC::platformImportPkcs8):
914         (WebCore::CryptoKeyEC::platformExportRaw const):
915         (WebCore::CryptoKeyEC::platformAddFieldElements const):
916         (WebCore::CryptoKeyEC::platformExportSpki const):
917         (WebCore::CryptoKeyEC::platformExportPkcs8 const):
918         (WebCore::CryptoKeyEC::~CryptoKeyEC): Deleted.
919         * crypto/keys/CryptoKeyEC.cpp:
920         (WebCore::CryptoKeyEC::CryptoKeyEC):
921         * crypto/keys/CryptoKeyEC.h:
922         (WebCore::CCECCryptorRefDeleter::operator() const):
923         * crypto/mac/CryptoKeyECMac.cpp:
924         (WebCore::CryptoKeyEC::keySizeInBits const):
925         (WebCore::CryptoKeyEC::platformGeneratePair):
926         (WebCore::CryptoKeyEC::platformImportRaw):
927         (WebCore::CryptoKeyEC::platformExportRaw const):
928         (WebCore::CryptoKeyEC::platformImportJWKPublic):
929         (WebCore::CryptoKeyEC::platformImportJWKPrivate):
930         (WebCore::CryptoKeyEC::platformAddFieldElements const):
931         (WebCore::CryptoKeyEC::platformImportSpki):
932         (WebCore::CryptoKeyEC::platformExportSpki const):
933         (WebCore::CryptoKeyEC::platformImportPkcs8):
934         (WebCore::CryptoKeyEC::platformExportPkcs8 const):
935         (WebCore::CryptoKeyEC::~CryptoKeyEC): Deleted.
936
937 2019-01-07  Antti Koivisto  <antti@apple.com>
938
939         UI process side scrollbars for UI side compositing on Mac
940         https://bugs.webkit.org/show_bug.cgi?id=193106
941
942         Reviewed by Tim Horton.
943
944         * page/FrameView.cpp:
945         (WebCore::FrameView::paintScrollCorner):
946         * page/scrolling/AsyncScrollingCoordinator.cpp:
947         (WebCore::AsyncScrollingCoordinator::frameViewLayoutUpdated):
948
949         Pass scrollbar host layers and the dark appearance bit to the scrolling tree.
950
951         * page/scrolling/ScrollingCoordinator.cpp:
952         (WebCore::ScrollingCoordinator::verticalScrollbarLayerForFrameView):
953         (WebCore::ScrollingCoordinator::horizontalScrollbarLayerForFrameView):
954         * page/scrolling/ScrollingCoordinator.h:
955         (WebCore::ScrollableAreaParameters::ScrollableAreaParameters):
956         (WebCore::ScrollableAreaParameters::operator== const):
957         * page/scrolling/ScrollingStateFrameScrollingNode.cpp:
958         (WebCore::ScrollingStateFrameScrollingNode::ScrollingStateFrameScrollingNode):
959         (WebCore::ScrollingStateFrameScrollingNode::setScrollbarLayers):
960         * page/scrolling/ScrollingStateFrameScrollingNode.h:
961         * page/scrolling/ScrollingTreeFrameScrollingNode.h:
962         * page/scrolling/ScrollingTreeScrollingNode.h:
963         (WebCore::ScrollingTreeScrollingNode::scrollableAreaSize const):
964         (WebCore::ScrollingTreeScrollingNode::totalContentsSize const):
965         (WebCore::ScrollingTreeScrollingNode::useDarkAppearanceForScrollbars const):
966         (WebCore::ScrollingTreeScrollingNode::lastCommittedScrollPosition const):
967         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h:
968         * platform/ScrollableArea.cpp:
969         (WebCore::ScrollableArea::useDarkAppearanceForScrollbars const):
970
971         Factor into a function as this is used in several places.
972
973         * platform/ScrollableArea.h:
974         * platform/mac/NSScrollerImpDetails.h:
975         * platform/mac/ScrollAnimatorMac.mm:
976         (-[WebScrollerImpDelegate effectiveAppearanceForScrollerImp:]):
977         * platform/mac/ScrollbarThemeMac.h:
978
979 2019-01-07  Wenson Hsieh  <wenson_hsieh@apple.com>
980
981         Native caret shows up alongside the page's caret when requesting desktop site on jsfiddle.net
982         https://bugs.webkit.org/show_bug.cgi?id=193180
983         <rdar://problem/45971041>
984
985         Reviewed by Tim Horton.
986
987         Adjust a method on RenderObject to additionally detect when the RenderObject is inside of an `overflow: hidden`
988         container that is also empty. See WebKit ChangeLog for more details.
989
990         Test:   editing/selection/ios/hide-selection-in-empty-overflow-hidden-container.html
991                 editing/selection/ios/show-selection-in-empty-overflow-hidden-document.html
992
993         * rendering/RenderObject.cpp:
994         (WebCore::RenderObject::isTransparentOrFullyClippedRespectingParentFrames const):
995         (WebCore::RenderObject::isTransparentRespectingParentFrames const): Deleted.
996         * rendering/RenderObject.h:
997
998 2019-01-07  Zalan Bujtas  <zalan@apple.com>
999
1000         [LFC][BFC] Margin collapsing should not be limited to in-flow non-replaced boxes.
1001         https://bugs.webkit.org/show_bug.cgi?id=193183
1002
1003         Reviewed by Antti Koivisto.
1004
1005         * layout/FormattingContext.cpp:
1006         (WebCore::Layout::FormattingContext::computeOutOfFlowVerticalGeometry const):
1007         * layout/FormattingContextGeometry.cpp:
1008         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedVerticalGeometry):
1009         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedVerticalGeometry):
1010         (WebCore::Layout::FormattingContext::Geometry::complicatedCases):
1011         (WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedWidthAndMargin):
1012         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedHeightAndMargin):
1013         * layout/LayoutUnits.h:
1014         * layout/blockformatting/BlockFormattingContext.cpp:
1015         (WebCore::Layout::BlockFormattingContext::computeHeightAndMargin const):
1016         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
1017         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin):
1018         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowHeightAndMargin):
1019         * layout/blockformatting/BlockFormattingContextQuirks.cpp:
1020         (WebCore::Layout::BlockFormattingContext::Quirks::stretchedHeight):
1021         * layout/inlineformatting/InlineFormattingContext.cpp:
1022         (WebCore::Layout::InlineFormattingContext::computeHeightAndMargin const):
1023
1024 2019-01-07  Zalan Bujtas  <zalan@apple.com>
1025
1026         [LFC][BFC] Move MarginCollapse from BlockFormattingContext::Geometry to BlockFormattingContext
1027         https://bugs.webkit.org/show_bug.cgi?id=193181
1028
1029         Reviewed by Antti Koivisto.
1030
1031         This is in preparation to share margin collapsing across all boxes in block formatting context.
1032
1033         * layout/blockformatting/BlockFormattingContext.h:
1034         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin):
1035         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin):
1036         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowReplacedWidthAndMargin):
1037         * layout/blockformatting/BlockMarginCollapse.cpp:
1038         (WebCore::Layout::BlockFormattingContext::MarginCollapse::computedNonCollapsedMarginBefore):
1039         (WebCore::Layout::BlockFormattingContext::MarginCollapse::computedNonCollapsedMarginAfter):
1040         (WebCore::Layout::BlockFormattingContext::MarginCollapse::nonCollapsedMarginBefore):
1041         (WebCore::Layout::BlockFormattingContext::MarginCollapse::nonCollapsedMarginAfter):
1042         (WebCore::Layout::BlockFormattingContext::MarginCollapse::collapsedMarginBeforeFromFirstChild):
1043         (WebCore::Layout::BlockFormattingContext::MarginCollapse::collapsedMarginAfterFromLastChild):
1044         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginBeforeCollapsesWithParentMarginAfter):
1045         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginBeforeCollapsesWithParentMarginBefore):
1046         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginAfterCollapsesWithSiblingMarginBeforeWithClearance):
1047         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginAfterCollapsesWithParentMarginBefore):
1048         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginAfterCollapsesWithParentMarginAfter):
1049         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginBeforeCollapsesWithPreviousSibling):
1050         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginAfterCollapsesWithNextSibling):
1051         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginsCollapseThrough):
1052         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginBefore):
1053         (WebCore::Layout::BlockFormattingContext::MarginCollapse::marginAfter):
1054         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::computedNonCollapsedMarginBefore): Deleted.
1055         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::computedNonCollapsedMarginAfter): Deleted.
1056         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::nonCollapsedMarginBefore): Deleted.
1057         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::nonCollapsedMarginAfter): Deleted.
1058         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::collapsedMarginBeforeFromFirstChild): Deleted.
1059         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::collapsedMarginAfterFromLastChild): Deleted.
1060         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::marginBeforeCollapsesWithParentMarginAfter): Deleted.
1061         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::marginBeforeCollapsesWithParentMarginBefore): Deleted.
1062         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::marginAfterCollapsesWithSiblingMarginBeforeWithClearance): Deleted.
1063         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::marginAfterCollapsesWithParentMarginBefore): Deleted.
1064         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::marginAfterCollapsesWithParentMarginAfter): Deleted.
1065         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::marginBeforeCollapsesWithPreviousSibling): Deleted.
1066         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::marginAfterCollapsesWithNextSibling): Deleted.
1067         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::marginsCollapseThrough): Deleted.
1068         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::marginBefore): Deleted.
1069         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::marginAfter): Deleted.
1070
1071 2019-01-07  Zan Dobersek  <zdobersek@igalia.com>
1072
1073         [WPE] Use Widget bounds for PlatformScreen rectangle information
1074         https://bugs.webkit.org/show_bug.cgi?id=193190
1075
1076         Reviewed by Philippe Normand.
1077
1078         Provide a better screen area estimate in screenRect() and
1079         screenAvailableRect() return values than the current 1240x640 value by
1080         using the Widget's bounds rectangle.
1081
1082         This approach is only factually correct when the Widget-associated view
1083         is displayed in fullscreen, but it provides a better estimate even when
1084         displayed in any other case as well. WPE doesn't provide specific API
1085         that could enable the embedding environment to provide this information.
1086
1087         * platform/wpe/PlatformScreenWPE.cpp:
1088         (WebCore::screenRect): Return bounds of the Widget object.
1089         (WebCore::screenAvailableRect): Relay the call to screenRect().
1090
1091 2019-01-07  Zan Dobersek  <zdobersek@igalia.com>
1092
1093         Make Gradient::gradientSpaceTransform(), Pattern::patternSpaceTransform() methods const
1094         https://bugs.webkit.org/show_bug.cgi?id=193189
1095
1096         Reviewed by Philippe Normand.
1097
1098         The transform getter methods on the Gradient and Pattern classes both
1099         return const references to the transform objects, and don't modify any
1100         internal state. They should be marked const accordingly, allowing
1101         invocations of these two methods through const references to Gradient
1102         and Pattern objects.
1103
1104         * platform/graphics/Gradient.h:
1105         (WebCore::Gradient::gradientSpaceTransform): Now const.
1106         * platform/graphics/Pattern.h:
1107         (WebCore::Pattern::patternSpaceTransform): Now const.
1108
1109 2019-01-07  Zan Dobersek  <zdobersek@igalia.com>
1110
1111         REGRESSION(r239636): ImageDecoder::setEncodedDataStatusChangeCallback() can be called on a null decoder
1112         https://bugs.webkit.org/show_bug.cgi?id=193187
1113
1114         Reviewed by Philippe Normand.
1115
1116         * platform/graphics/ImageSource.cpp:
1117         (WebCore::ImageSource::ensureDecoderAvailable): Bail before calling the
1118         setEncodedDataStatusChangeCallback() method when the returned
1119         ImageDecoder object is null.
1120
1121 2019-01-06  Zan Dobersek  <zdobersek@igalia.com>
1122
1123         [Nicosia] Take over CoordinatedGraphics-named implementation of async scrolling classes
1124         https://bugs.webkit.org/show_bug.cgi?id=193133
1125
1126         Reviewed by Michael Catanzaro.
1127
1128         Move the CoordinatedGraphics-specific files under
1129         page/scrolling/coordinatedgraphics/ to page/scrolling/nicosia/, along
1130         with renaming the files and classes accordingly. Implementation will
1131         only depend on the Nicosia-specific layer structure and is not specific
1132         to the CoordinatedGraphics system.
1133
1134         * PlatformPlayStation.cmake:
1135         * SourcesGTK.txt:
1136         * SourcesWPE.txt:
1137         * page/scrolling/nicosia/ScrollingCoordinatorNicosia.cpp: Renamed from Source/WebCore/page/scrolling/coordinatedgraphics/ScrollingCoordinatorCoordinatedGraphics.cpp.
1138         * page/scrolling/nicosia/ScrollingCoordinatorNicosia.h: Renamed from Source/WebCore/page/scrolling/coordinatedgraphics/ScrollingCoordinatorCoordinatedGraphics.h.
1139         * page/scrolling/nicosia/ScrollingStateNodeNicosia.cpp: Renamed from Source/WebCore/page/scrolling/coordinatedgraphics/ScrollingStateNodeCoordinatedGraphics.cpp.
1140         * page/scrolling/nicosia/ScrollingTreeFixedNode.cpp: Renamed from Source/WebCore/page/scrolling/coordinatedgraphics/ScrollingTreeFixedNode.cpp.
1141         * page/scrolling/nicosia/ScrollingTreeFixedNode.h: Renamed from Source/WebCore/page/scrolling/coordinatedgraphics/ScrollingTreeFixedNode.h.
1142         * page/scrolling/nicosia/ScrollingTreeFrameScrollingNodeNicosia.cpp: Renamed from Source/WebCore/page/scrolling/coordinatedgraphics/ScrollingTreeFrameScrollingNodeCoordinatedGraphics.cpp.
1143         * page/scrolling/nicosia/ScrollingTreeFrameScrollingNodeNicosia.h: Renamed from Source/WebCore/page/scrolling/coordinatedgraphics/ScrollingTreeFrameScrollingNodeCoordinatedGraphics.h.
1144         * page/scrolling/nicosia/ScrollingTreeNicosia.cpp: Renamed from Source/WebCore/page/scrolling/coordinatedgraphics/ScrollingTreeCoordinatedGraphics.cpp.
1145         * page/scrolling/nicosia/ScrollingTreeNicosia.h: Renamed from Source/WebCore/page/scrolling/coordinatedgraphics/ScrollingTreeCoordinatedGraphics.h.
1146         * page/scrolling/nicosia/ScrollingTreeStickyNode.cpp: Renamed from Source/WebCore/page/scrolling/coordinatedgraphics/ScrollingTreeStickyNode.cpp.
1147         * page/scrolling/nicosia/ScrollingTreeStickyNode.h: Renamed from Source/WebCore/page/scrolling/coordinatedgraphics/ScrollingTreeStickyNode.h.
1148         * platform/TextureMapper.cmake:
1149
1150 2019-01-06  Jiewen Tan  <jiewen_tan@apple.com>
1151
1152         [WebAuthN] Import U2F command/response converters from Chromium
1153         https://bugs.webkit.org/show_bug.cgi?id=193150
1154         <rdar://problem/47054028>
1155
1156         Reviewed by Brent Fulgham.
1157
1158         This patch imports Chromium's U2F command/response converters:
1159         https://fidoalliance.org/specs/fido-v2.0-id-20180227/fido-client-to-authenticator-protocol-v2.0-id-20180227.html#u2f-interoperability
1160         1. It directly imports the following files and suit them to WebKit's coding style:
1161         https://cs.chromium.org/chromium/src/device/fido/u2f_command_constructor.cc?l=1&rcl=db624110317d01efa78cd32e7be1524190e1beb0
1162         https://cs.chromium.org/chromium/src/device/fido/u2f_command_constructor.h?rcl=db624110317d01efa78cd32e7be1524190e1beb0
1163         https://cs.chromium.org/chromium/src/device/fido/u2f_command_constructor_unittest.cc?rcl=db624110317d01efa78cd32e7be1524190e1beb0
1164         2. It gathers the following methods into U2fResponseConverter:
1165         AuthenticatorMakeCredentialResponse::CreateFromU2fRegisterResponse()
1166         AuthenticatorGetAssertionResponse::CreateFromU2fSignResponse()
1167         3. It also updates FidoConstants.h, FidoTestData.h and CtapResponseTest.cpp accordingly.
1168
1169         Besides importing stuff from Chroimum, it also gathers a bunch of constants and helper functions into WebAuthenticationConstants.h
1170         and WebAuthenticationUtils.h. It also fixes Bug 183534: 2) and 7).
1171
1172         Covered by API tests.
1173
1174         * Modules/webauthn/AuthenticatorCoordinator.cpp:
1175         (WebCore::AuthenticatorCoordinatorInternal::produceClientDataJsonHash):
1176         * Modules/webauthn/WebAuthenticationConstants.h: Copied from Source/WebCore/Modules/webauthn/COSEConstants.h.
1177         * Modules/webauthn/WebAuthenticationUtils.cpp: Added.
1178         (WebCore::convertBytesToVector):
1179         (WebCore::produceRpIdHash):
1180         (WebCore::encodeES256PublicKeyAsCBOR):
1181         (WebCore::buildAttestedCredentialData):
1182         (WebCore::buildAuthData):
1183         (WebCore::buildAttestationObject):
1184         * Modules/webauthn/WebAuthenticationUtils.h: Renamed from Source/WebCore/Modules/webauthn/COSEConstants.h.
1185         * Modules/webauthn/fido/DeviceResponseConverter.cpp:
1186         (fido::getCredentialId):
1187         (fido::readCTAPGetInfoResponse):
1188         * Modules/webauthn/fido/FidoConstants.h:
1189         * Modules/webauthn/fido/U2fCommandConstructor.cpp: Added.
1190         (fido::WebCore::constructU2fRegisterCommand):
1191         (fido::WebCore::constructU2fSignCommand):
1192         (fido::isConvertibleToU2fRegisterCommand):
1193         (fido::isConvertibleToU2fSignCommand):
1194         (fido::convertToU2fRegisterCommand):
1195         (fido::convertToU2fCheckOnlySignCommand):
1196         (fido::convertToU2fSignCommand):
1197         (fido::constructBogusU2fRegistrationCommand):
1198         * Modules/webauthn/fido/U2fCommandConstructor.h: Added.
1199         * Modules/webauthn/fido/U2fResponseConverter.cpp: Added.
1200         (fido::WebCore::extractECPublicKeyFromU2fRegistrationResponse):
1201         (fido::WebCore::extractCredentialIdFromU2fRegistrationResponse):
1202         (fido::WebCore::createAttestedCredentialDataFromU2fRegisterResponse):
1203         (fido::WebCore::parseX509Length):
1204         (fido::WebCore::createFidoAttestationStatementFromU2fRegisterResponse):
1205         (fido::readU2fRegisterResponse):
1206         (fido::readFromU2fSignResponse):
1207         * Modules/webauthn/fido/U2fResponseConverter.h: Added.
1208         * Modules/webgpu/WebGPUCommandBuffer.cpp:
1209         * Sources.txt:
1210         * WebCore.xcodeproj/project.pbxproj:
1211
1212 2019-01-06  David Kilzer  <ddkilzer@apple.com>
1213
1214         Leak of WTF::Function objects in WebCore::CryptoKeyRSA::generatePair() (64-80 bytes each) in com.apple.WebKit.WebContent running WebKit layout tests
1215         <https://webkit.org/b/193177>
1216         <rdar://problem/47072196>
1217
1218         Reviewed by Saam Barati.
1219
1220         * crypto/mac/CryptoKeyRSAMac.cpp:
1221         (WebCore::CryptoKeyRSA::generatePair): Fix the leak by changing
1222         raw pointers to heap-allocated __block variables to hold the
1223         WTF::Function objects until they are consumed within the block
1224         passed to dispatch_async().  The __block variables act like
1225         captured variables in a C++ lambda and have the same lifetime as
1226         the block that they are captured in.  Note that we would have to
1227         convert the source file from C++ to Objective-C++ to use a C++
1228         lambda functor with dispatch_async(), which creates its own
1229         issue because the comipiler requires a copy constructor to
1230         convert the C++ lambda to a block functor, but the copy
1231         constructor for the C++ lambda is implicitly deleted because the
1232         WTF::Function copy constructor is explicitly deleted.  Whew!
1233
1234 2019-01-06  Pablo Saavedra  <psaavedra@igalia.com>
1235
1236         [WPE][GTK] Building with ENABLE_VIDEO=OFF fails trying to use Document MediaPlayback functions.
1237         https://bugs.webkit.org/show_bug.cgi?id=193174
1238
1239         Reviewed by Michael Catanzaro.
1240
1241         * page/Page.cpp:
1242         (WebCore::Page::stopAllMediaPlayback):
1243         (WebCore::Page::suspendAllMediaPlayback):
1244         (WebCore::Page::resumeAllMediaPlayback):
1245
1246 2019-01-05  David Kilzer  <ddkilzer@apple.com>
1247
1248         Leak of two CCRSACryptorRef (4.0 Kbytes/1 page each) in com.apple.WebKit.WebContent running WebKit layout tests
1249         <https://webkit.org/b/193154>
1250         <rdar://problem/47052993>
1251
1252         Reviewed by Brent Fulgham.
1253
1254         Broadly:
1255         - Fix leaks by switching from using raw pointers to using
1256           std::unique_ptr<>.
1257         - Introduce PlatformRSAKeyContainer type to handle different
1258           std::unique_ptr<> on each platform.
1259         - Get rid of custom CryptoKeyRSA destructors since the
1260           std::unique_ptr<> handles that with a Deleter.
1261         - Initialize stack variables to nullptr.
1262
1263         * crypto/gcrypt/CryptoKeyRSAGCrypt.cpp:
1264         (WebCore::CryptoKeyRSA::create):
1265         (WebCore::CryptoKeyRSA::CryptoKeyRSA):
1266         (WebCore::CryptoKeyRSA::keySizeInBits const):
1267         (WebCore::CryptoKeyRSA::generatePair):
1268         (WebCore::CryptoKeyRSA::importSpki):
1269         (WebCore::CryptoKeyRSA::importPkcs8):
1270         (WebCore::CryptoKeyRSA::exportSpki const):
1271         (WebCore::CryptoKeyRSA::exportPkcs8 const):
1272         (WebCore::CryptoKeyRSA::algorithm const):
1273         (WebCore::CryptoKeyRSA::exportData const):
1274         (WebCore::CryptoKeyRSA::~CryptoKeyRSA): Deleted.
1275         * crypto/keys/CryptoKeyRSA.h:
1276         (WebCore::CCRSACryptorRefDeleter::operator() const):
1277         * crypto/mac/CryptoKeyRSAMac.cpp:
1278         (WebCore::getPublicKeyComponents):
1279         (WebCore::getPrivateKeyComponents):
1280         (WebCore::CryptoKeyRSA::CryptoKeyRSA):
1281         (WebCore::CryptoKeyRSA::create):
1282         (WebCore::CryptoKeyRSA::exportData const):
1283         (WebCore::CryptoKeyRSA::generatePair):
1284         (WebCore::CryptoKeyRSA::importSpki):
1285         (WebCore::CryptoKeyRSA::importPkcs8):
1286         (WebCore::CryptoKeyRSA::~CryptoKeyRSA): Deleted.
1287
1288 2019-01-05  Zalan Bujtas  <zalan@apple.com>
1289
1290         Incorrect clipping across compositing boundary.
1291         https://bugs.webkit.org/show_bug.cgi?id=193172
1292         <rdar://problem/44693008>
1293
1294         Reviewed by Simon Fraser.
1295
1296         Use temporary cliprect type when crossing compositing boundary to prevent cliprect caching.
1297
1298         The issue here is that RenderLayer::backgroundClipRect() could cross compositing boundary by calling parentClipRects() which triggers
1299         clip rect update using the wrong painting root. This happens when the layer hierarchy and the compositing context do not match.
1300         For clip rect computation, we need to climb up on the layer hierarchy (calling parent layer's cliprect functions)
1301         but we also need to make sure that the computed cliprects on any given layer are cached only when the painting root is correct.
1302         It ensures that when we paint a layer (with the painting root as entry point), the cached cliprects are always based on its onw painting root. 
1303
1304         Test: compositing/clipping/cached-cliprect-with-compositing-boundary.html
1305
1306         * rendering/RenderLayer.cpp:
1307         (WebCore::RenderLayer::calculateClipRects const):
1308
1309 2019-01-05  Youenn Fablet  <youenn@apple.com>
1310
1311         Service Worker fetch should obey its referrer policy
1312         https://bugs.webkit.org/show_bug.cgi?id=193152
1313
1314         Reviewed by Chris Dumez.
1315
1316         Pass referrer policy retrieved when fetching the service worker script to the SWServer.
1317         The SWServer then stores it persistently and sends it to the manager creating service workers.
1318         This manager will then set the referrer policy on the dummy Document of the corresponding service worker.
1319
1320         Covered by rebased test.
1321
1322         * workers/WorkerScriptLoader.cpp:
1323         (WebCore::WorkerScriptLoader::didReceiveResponse):
1324         * workers/WorkerScriptLoader.h:
1325         (WebCore::WorkerScriptLoader::referrerPolicy const):
1326         * workers/service/SWClientConnection.cpp:
1327         (WebCore::SWClientConnection::failedFetchingScript):
1328         * workers/service/ServiceWorkerContainer.cpp:
1329         (WebCore::ServiceWorkerContainer::jobFinishedLoadingScript):
1330         * workers/service/ServiceWorkerContainer.h:
1331         * workers/service/ServiceWorkerContextData.cpp:
1332         (WebCore::ServiceWorkerContextData::isolatedCopy const):
1333         * workers/service/ServiceWorkerContextData.h:
1334         (WebCore::ServiceWorkerContextData::encode const):
1335         (WebCore::ServiceWorkerContextData::decode):
1336         * workers/service/ServiceWorkerFetchResult.h:
1337         (WebCore::ServiceWorkerFetchResult::encode const):
1338         (WebCore::ServiceWorkerFetchResult::decode):
1339         * workers/service/ServiceWorkerJob.cpp:
1340         (WebCore::ServiceWorkerJob::notifyFinished):
1341         * workers/service/ServiceWorkerJobClient.h:
1342         * workers/service/context/ServiceWorkerThreadProxy.cpp:
1343         (WebCore::createPageForServiceWorker):
1344         * workers/service/server/RegistrationDatabase.cpp:
1345         (WebCore::recordsTableSchema):
1346         (WebCore::RegistrationDatabase::doPushChanges):
1347         (WebCore::RegistrationDatabase::importRecords):
1348         * workers/service/server/SWServer.cpp:
1349         (WebCore::SWServer::addRegistrationFromStore):
1350         (WebCore::SWServer::updateWorker):
1351         (WebCore::SWServer::installContextData):
1352         * workers/service/server/SWServer.h:
1353         * workers/service/server/SWServerJobQueue.cpp:
1354         (WebCore::SWServerJobQueue::scriptFetchFinished):
1355         * workers/service/server/SWServerWorker.cpp:
1356         (WebCore::SWServerWorker::SWServerWorker):
1357         (WebCore::SWServerWorker::contextData const):
1358         * workers/service/server/SWServerWorker.h:
1359
1360 2019-01-04  Simon Fraser  <simon.fraser@apple.com>
1361
1362         Factor legacy WK1 code for fixed and scrolling layers into their own helper class
1363         https://bugs.webkit.org/show_bug.cgi?id=193165
1364
1365         Reviewed by Frédéric Wang.
1366
1367         RenderLayerCompositor has some code to handle registration of viewport-constrained
1368         and scrolling layers which is specific to iOS WK1. To reduce pollution, move this
1369         into its own helper class called LegacyWebKitScrollingLayerCoordinator, which is only
1370         allocated for iOS WK1.
1371         
1372         iOS WK1 never has a ScrollingCoordinator, so rather than the check for scrollingCoordinator(),
1373         we know that we only made a LegacyWebKitScrollingLayerCoordinator when there's a platform widget
1374         (i.e. WK1).
1375         
1376         * page/ChromeClient.h:
1377         * rendering/RenderLayerCompositor.cpp:
1378         (WebCore::RenderLayerCompositor::RenderLayerCompositor):
1379         (WebCore::RenderLayerCompositor::updateCustomLayersAfterFlush):
1380         (WebCore::RenderLayerCompositor::didFlushChangesForLayer):
1381         (WebCore::RenderLayerCompositor::setIsInWindow):
1382         (WebCore::RenderLayerCompositor::willRemoveScrollingLayerWithBacking): No longer check the page cache state; now we
1383         destroy the render tree of pages in the page cache, so we should never hit this code path.
1384         (WebCore::RenderLayerCompositor::didAddScrollingLayer):
1385         (WebCore::LegacyWebKitScrollingLayerCoordinator::registerAllViewportConstrainedLayers):
1386         (WebCore::LegacyWebKitScrollingLayerCoordinator::unregisterAllViewportConstrainedLayers):
1387         (WebCore::scrollbarHasDisplayNone):
1388         (WebCore::LegacyWebKitScrollingLayerCoordinator::updateScrollingLayer):
1389         (WebCore::LegacyWebKitScrollingLayerCoordinator::registerAllScrollingLayers):
1390         (WebCore::LegacyWebKitScrollingLayerCoordinator::registerScrollingLayersNeedingUpdate):
1391         (WebCore::LegacyWebKitScrollingLayerCoordinator::unregisterAllScrollingLayers):
1392         (WebCore::LegacyWebKitScrollingLayerCoordinator::addScrollingLayer):
1393         (WebCore::LegacyWebKitScrollingLayerCoordinator::removeScrollingLayer):
1394         (WebCore::LegacyWebKitScrollingLayerCoordinator::didFlushChangesForLayer):
1395         (WebCore::updateScrollingLayerWithClient): Deleted.
1396         (WebCore::RenderLayerCompositor::registerAllViewportConstrainedLayers): Deleted.
1397         (WebCore::RenderLayerCompositor::unregisterAllViewportConstrainedLayers): Deleted.
1398         (WebCore::RenderLayerCompositor::registerAllScrollingLayers): Deleted.
1399         (WebCore::RenderLayerCompositor::unregisterAllScrollingLayers): Deleted.
1400         * rendering/RenderLayerCompositor.h:
1401         (WebCore::LegacyWebKitScrollingLayerCoordinator::LegacyWebKitScrollingLayerCoordinator):
1402         * workers/service/ServiceWorkerContainer.cpp:
1403         (WebCore::ServiceWorkerContainer::~ServiceWorkerContainer):
1404
1405 2019-01-05  Zalan Bujtas  <zalan@apple.com>
1406
1407         [LFC] VerticalMargin should only have the used values.
1408         https://bugs.webkit.org/show_bug.cgi?id=193168
1409
1410         Reviewed by Antti Koivisto.
1411
1412         Split VerticalMargin into ComputedVerticalMargin and UsedVerticalMargin.
1413         ComputedVerticalMargin holds the computed (optional) values while UsedVerticalMargin holds both the
1414         collapsed (optional) and the non-collapsed values.
1415
1416         * layout/FormattingContext.cpp:
1417         (WebCore::Layout::FormattingContext::computeOutOfFlowVerticalGeometry const):
1418         * layout/FormattingContext.h:
1419         * layout/FormattingContextGeometry.cpp:
1420         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedVerticalGeometry):
1421         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedVerticalGeometry):
1422         (WebCore::Layout::FormattingContext::Geometry::complicatedCases):
1423         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedHeightAndMargin):
1424         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedWidthAndMargin):
1425         (WebCore::Layout::FormattingContext::Geometry::computedVerticalMargin):
1426         (WebCore::Layout::FormattingContext::Geometry::computedNonCollapsedVerticalMarginValue): Deleted.
1427         * layout/FormattingContextQuirks.cpp:
1428         (WebCore::Layout::FormattingContext::Quirks::heightValueOfNearestContainingBlockWithFixedHeight):
1429         * layout/LayoutUnits.h:
1430         * layout/MarginTypes.h:
1431         (WebCore::Layout::UsedVerticalMargin::before const):
1432         (WebCore::Layout::UsedVerticalMargin::after const):
1433         (WebCore::Layout::UsedVerticalMargin::nonCollapsedValues const):
1434         (WebCore::Layout::UsedVerticalMargin::collapsedValues const):
1435         (WebCore::Layout::UsedVerticalMargin::hasCollapsedValues const):
1436         (WebCore::Layout::UsedVerticalMargin::setCollapsedValues):
1437         (WebCore::Layout::UsedVerticalMargin::UsedVerticalMargin):
1438         (WebCore::Layout::VerticalMargin::nonCollapsedValues const): Deleted.
1439         (WebCore::Layout::VerticalMargin::collapsedValues const): Deleted.
1440         (WebCore::Layout::VerticalMargin::setCollapsedValues): Deleted.
1441         (WebCore::Layout::VerticalMargin::VerticalMargin): Deleted.
1442         (WebCore::Layout::VerticalMargin::usedValues const): Deleted.
1443         * layout/blockformatting/BlockFormattingContext.cpp:
1444         (WebCore::Layout::BlockFormattingContext::computeHeightAndMargin const):
1445         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
1446         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin):
1447         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowHeightAndMargin):
1448         * layout/blockformatting/BlockFormattingContextQuirks.cpp:
1449         (WebCore::Layout::BlockFormattingContext::Quirks::stretchedHeight):
1450         * layout/blockformatting/BlockMarginCollapse.cpp:
1451         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::computedNonCollapsedMarginBefore):
1452         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::computedNonCollapsedMarginAfter):
1453         * layout/displaytree/DisplayBox.h:
1454         (WebCore::Display::Box::setVerticalMargin):
1455         (WebCore::Display::Box::verticalMargin const):
1456         (WebCore::Display::Box::marginBefore const):
1457         (WebCore::Display::Box::marginAfter const):
1458         * layout/floats/FloatingContext.cpp:
1459         (WebCore::Layout::FloatingContext::verticalPositionWithClearance const):
1460         * layout/inlineformatting/InlineFormattingContext.cpp:
1461         (WebCore::Layout::InlineFormattingContext::computeHeightAndMargin const):
1462
1463 2019-01-04  Daniel Bates  <dabates@apple.com>
1464
1465         REGRESSION (r238522): Erratic scrolling on Google flights search result page and vrbo.com
1466         https://bugs.webkit.org/show_bug.cgi?id=192996
1467         <rdar://problem/46573552>
1468
1469         Reviewed by Simon Fraser.
1470
1471         Only scroll a text field if its inner text size changes and it is the currently active and
1472         focused element on the page.
1473
1474         Test: fast/scrolling/page-should-not-scroll-on-unfocused-text-field-layout.html
1475
1476         * rendering/RenderTextControlSingleLine.cpp:
1477         (WebCore::RenderTextControlSingleLine::layout):
1478
1479 2019-01-04  Alex Christensen  <achristensen@webkit.org>
1480
1481         Progress towards fixing Mac CMake build
1482         https://bugs.webkit.org/show_bug.cgi?id=193105
1483
1484         Reviewed by Don Olmstead.
1485
1486         * PlatformMac.cmake:
1487         * Sources.txt:
1488         * SourcesCocoa.txt:
1489         * WebCore.xcodeproj/project.pbxproj:
1490         * platform/graphics/gpu/GPURenderPassEncoder.h:
1491
1492 2019-01-04  Zalan Bujtas  <zalan@apple.com>
1493
1494         [iOS] ERROR: post-layout: dirty renderer(s) in WebCore::RenderTreeNeedsLayoutChecker::~RenderTreeNeedsLayoutChecker()
1495         https://bugs.webkit.org/show_bug.cgi?id=189608
1496         <rdar://problem/44473299>
1497
1498         Reviewed by Simon Fraser.
1499
1500         When a frameset/iframe is hidden and we skip layout, clear the dirty flag on its subtree as well.
1501
1502         Covered by fast/frames/invalid-frameset.html.
1503
1504         * rendering/RenderFrameSet.cpp:
1505         (WebCore::clearSiblingSubtrees):
1506         (WebCore::RenderFrameSet::positionFrames):
1507         (WebCore::RenderFrameSet::positionFramesWithFlattening):
1508
1509 2019-01-04  Youenn Fablet  <youenn@apple.com>
1510
1511         [Fetch API] Implement abortable fetch
1512         https://bugs.webkit.org/show_bug.cgi?id=174980
1513         <rdar://problem/46861402>
1514
1515         Reviewed by Chris Dumez.
1516
1517         Add an AbortSignal to FetchRequest.
1518
1519         Add support for AbortSignal algorithm.
1520         The fetch request signal is added an algorithm to abort the fetch.
1521         Update clone algorithm to let signal of the cloned request be following the origin request.
1522
1523         Update ReadableStream error handling to return an exception instead of a string.
1524         This allows passing an AbortError instead of a TypeError as previously done.
1525
1526         Update FetchBodyOwner to store a loading error either as an exception or as a resource error.
1527         The latter is used for passing the error from service worker back to the page.
1528         The former is used to pass it to ReadableStream or body accessors.
1529
1530         Covered by enabled tests.
1531
1532         * Modules/cache/DOMCache.cpp:
1533         (WebCore::DOMCache::put):
1534         * Modules/fetch/FetchBody.cpp:
1535         (WebCore::FetchBody::consumeAsStream):
1536         (WebCore::FetchBody::loadingFailed):
1537         * Modules/fetch/FetchBody.h:
1538         * Modules/fetch/FetchBodyConsumer.cpp:
1539         (WebCore::FetchBodyConsumer::loadingFailed):
1540         * Modules/fetch/FetchBodyConsumer.h:
1541         * Modules/fetch/FetchBodyOwner.cpp:
1542         (WebCore::FetchBodyOwner::arrayBuffer):
1543         (WebCore::FetchBodyOwner::blob):
1544         (WebCore::FetchBodyOwner::cloneBody):
1545         (WebCore::FetchBodyOwner::formData):
1546         (WebCore::FetchBodyOwner::json):
1547         (WebCore::FetchBodyOwner::text):
1548         (WebCore::FetchBodyOwner::loadBlob):
1549         (WebCore::FetchBodyOwner::blobLoadingFailed):
1550         (WebCore::FetchBodyOwner::consumeBodyAsStream):
1551         (WebCore::FetchBodyOwner::setLoadingError):
1552         * Modules/fetch/FetchBodyOwner.h:
1553         (WebCore::FetchBodyOwner::loadingError const):
1554         (WebCore::FetchBodyOwner::loadingException const):
1555         * Modules/fetch/FetchBodySource.cpp:
1556         (WebCore::FetchBodySource::error):
1557         * Modules/fetch/FetchBodySource.h:
1558         * Modules/fetch/FetchRequest.cpp:
1559         (WebCore::FetchRequest::initializeWith):
1560         (WebCore::FetchRequest::clone):
1561         * Modules/fetch/FetchRequest.h:
1562         (WebCore::FetchRequest::FetchRequest):
1563         * Modules/fetch/FetchRequest.idl:
1564         * Modules/fetch/FetchRequestInit.h:
1565         (WebCore::FetchRequestInit::hasMembers const):
1566         * Modules/fetch/FetchRequestInit.idl:
1567         * Modules/fetch/FetchResponse.cpp:
1568         (WebCore::FetchResponse::clone):
1569         (WebCore::FetchResponse::fetch):
1570         (WebCore::FetchResponse::BodyLoader::didFail):
1571         * Modules/fetch/FetchResponse.h:
1572         * bindings/js/ReadableStreamDefaultController.h:
1573         (WebCore::ReadableStreamDefaultController::error):
1574         * dom/AbortSignal.cpp:
1575         (WebCore::AbortSignal::abort):
1576         (WebCore::AbortSignal::follow):
1577         * dom/AbortSignal.h:
1578
1579 2019-01-04  Brent Fulgham  <bfulgham@apple.com>
1580
1581         Parsed protocol of javascript URLs with embedded newlines and carriage returns do not match parsed protocol in Chrome and Firefox
1582         https://bugs.webkit.org/show_bug.cgi?id=193155
1583         <rdar://problem/40230982>
1584
1585         Reviewed by Chris Dumez.
1586
1587         Test: fast/loader/comment-only-javascript-url.html
1588
1589         Make a special case for URLs beginning with 'javascript:'. We should always
1590         treat these as JS URLs, even if the content contained within the URL
1591         string might match other parts of the URL parsing spec.
1592
1593         * html/URLUtils.h:
1594         (WebCore::URLUtils<T>::protocol const):
1595
1596 2019-01-04  Jer Noble  <jer.noble@apple.com>
1597
1598         [WebKitLegacy] Media playback pauses on scroll
1599         https://bugs.webkit.org/show_bug.cgi?id=192829
1600
1601         Reviewed by Eric Carlson.
1602
1603         New API tests:
1604             WebKitLegacy.ScrollingDoesNotPauseMedia
1605             WKWebView.StopAllMediaPlayback
1606             WKWebView.SuspendResumeAllMediaPlayback
1607
1608         Do not use suspendActiveDOMObjects(ReasonForSuspension::PageWillBeSuspended) to pause
1609         video. Roll back the changes to HTMLMediaElement, and introduce a new set of Page calls
1610         suspendAllMediaPlayback() & resumeAllMediaPlayback() which replaces the removed bahavior.
1611
1612         * dom/Document.cpp:
1613         (WebCore::Document::~Document):
1614         (WebCore::Document::stopAllMediaPlayback):
1615         (WebCore::Document::suspendAllMediaPlayback):
1616         (WebCore::Document::resumeAllMediaPlayback):
1617         * dom/Document.h:
1618         * html/HTMLMediaElement.cpp:
1619         (WebCore::HTMLMediaElement::HTMLMediaElement):
1620         (WebCore::HTMLMediaElement::parseAttribute):
1621         (WebCore::HTMLMediaElement::didFinishInsertingNode):
1622         (WebCore::HTMLMediaElement::setSrcObject):
1623         (WebCore::HTMLMediaElement::updateActiveTextTrackCues):
1624         (WebCore::HTMLMediaElement::suspend):
1625         (WebCore::HTMLMediaElement::resume):
1626         (WebCore::HTMLMediaElement::webkitCurrentPlaybackTargetIsWireless const):
1627         * html/HTMLMediaElement.h:
1628         (WebCore::HTMLMediaElement::webkitCurrentPlaybackTargetIsWireless const): Deleted.
1629         * html/MediaElementSession.cpp:
1630         (WebCore::MediaElementSession::playbackPermitted const):
1631         * page/Page.cpp:
1632         (WebCore::Page::stopAllMediaPlayback):
1633         (WebCore::Page::suspendAllMediaPlayback):
1634         (WebCore::Page::resumeAllMediaPlayback):
1635         * page/Page.h:
1636         (WebCore::Page::mediaPlaybackIsSuspended):
1637         * platform/audio/PlatformMediaSession.h:
1638         * platform/audio/PlatformMediaSessionManager.cpp:
1639         (WebCore::PlatformMediaSessionManager::suspendAllMediaPlaybackForDocument):
1640         (WebCore::PlatformMediaSessionManager::resumeAllMediaPlaybackForDocument):
1641         * platform/audio/PlatformMediaSessionManager.h:
1642
1643 2019-01-04  Chris Dumez  <cdumez@apple.com>
1644
1645         Add support for toggling device orientation API support per site
1646         https://bugs.webkit.org/show_bug.cgi?id=193143
1647         <rdar://problem/46605724>
1648
1649         Reviewed by Alex Christensen.
1650
1651         Add support for toggling device orientation API support per site via _WKWebsitePolicies.
1652
1653         * dom/Document.cpp:
1654         (WebCore::Document::simulateDeviceOrientationChange):
1655         * dom/Document.h:
1656         * loader/DocumentLoader.h:
1657         (WebCore::DocumentLoader::deviceOrientationEventEnabled const):
1658         (WebCore::DocumentLoader::setDeviceOrientationEventEnabled):
1659         * page/DOMWindow.cpp:
1660         (WebCore::DOMWindow::addEventListener):
1661
1662 2019-01-04  Jer Noble  <jer.noble@apple.com>
1663
1664         Web Content process main thread blocked beneath ImageDecoderAVFObjC::readSamples for many seconds on imgur.com
1665         https://bugs.webkit.org/show_bug.cgi?id=191806
1666         <rdar://problem/46151477>
1667
1668         Reviewed by Dean Jackson.
1669
1670         Test: http/tests/images/mp4-partial-load.html
1671
1672         Rather than use an AVAssetReaderTrackOutput, which will load both sample metadata and sample data
1673         synchronously when a sample is requested, use AVAssetReaderSampleReferenceOutput, which only loads
1674         sample metadata, including the byte offset and byte length of the sample data. By waiting until the
1675         AVAsset signals that it's own metadata is loaded, we can safely parse all the sample metadata without
1676         blocking on network loads. Once enough data is loaded, we can replace the byte reference and offset
1677         attachements in the sample with actual data, and mark the sample as "complete".
1678
1679         Because the existing ImageSource assumes that image data parsing will occur synchronously, and that
1680         synchronous parsing could cause a hang if the metadata is not loaded, add a new callback method which
1681         allows the ImageSource to be notified when the encodedDataStatus changes. The ImageSource notifies the
1682         CacheImage, which notifies the RenderImage, and thus the asynchronous parsing will kick off the
1683         renderer's animation loop.
1684
1685         * loader/cache/CachedImage.cpp:
1686         (WebCore::CachedImage::CachedImageObserver::encodedDataStatusChanged):
1687         (WebCore::CachedImage::encodedDataStatusChanged):
1688         * loader/cache/CachedImage.h:
1689         * platform/graphics/ImageDecoder.h:
1690         (WebCore::ImageDecoder::setEncodedDataStatusChangeCallback):
1691         * platform/graphics/ImageObserver.h:
1692         (WebCore::ImageObserver::encodedDataStatusChanged):
1693         * platform/graphics/ImageSource.cpp:
1694         (WebCore::ImageSource::ensureDecoderAvailable):
1695         (WebCore::ImageSource::encodedDataStatusChanged):
1696         (WebCore::ImageSource::frameDecodingStatusAtIndex):
1697         * platform/graphics/ImageSource.h:
1698         * platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.h:
1699         * platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.mm:
1700         (-[WebCoreSharedBufferResourceLoaderDelegate data]):
1701         (WebCore::ImageDecoderAVFObjCSample::byteRange const):
1702         (WebCore::ImageDecoderAVFObjC::readSamples):
1703         (WebCore::ImageDecoderAVFObjC::setEncodedDataStatusChangeCallback):
1704         (WebCore::ImageDecoderAVFObjC::encodedDataStatus const):
1705         (WebCore::ImageDecoderAVFObjC::frameIsCompleteAtIndex const):
1706         (WebCore::ImageDecoderAVFObjC::createFrameImageAtIndex):
1707         (WebCore::ImageDecoderAVFObjC::sampleIsComplete const):
1708
1709 2019-01-04  Youenn Fablet  <youenn@apple.com>
1710
1711         CSP violation reports should bypass CSP checks
1712         https://bugs.webkit.org/show_bug.cgi?id=192857
1713         <rdar://problem/46887236>
1714
1715         Reviewed by Chris Dumez.
1716
1717         For ping loads, pass the option to do CSP checks from PingLoader to LoaderStrategy.
1718         This new option is unused by WebKit Legacy.
1719         It is used by WebKit loader strategy to only send any CSP response header to network process
1720         in case CSP checks should be done.
1721
1722         This option is used to disable CSP checks for Ping Loads that report CSP violations.
1723
1724         Test: http/wpt/fetch/csp-reports-bypass-csp-checks.html
1725
1726         * loader/LoaderStrategy.h:
1727         * loader/PingLoader.cpp:
1728         (WebCore::PingLoader::loadImage):
1729         (WebCore::PingLoader::sendPing):
1730         (WebCore::PingLoader::sendViolationReport):
1731         (WebCore::PingLoader::startPingLoad):
1732         * loader/PingLoader.h:
1733         * loader/cache/CachedResource.cpp:
1734         (WebCore::CachedResource::load):
1735
1736 2019-01-04  Wenson Hsieh  <wenson_hsieh@apple.com>
1737
1738         [Cocoa] Merge WebEditCommandProxy::nameForEditAction and undoNameForEditAction into a single function
1739         https://bugs.webkit.org/show_bug.cgi?id=193129
1740
1741         Reviewed by Tim Horton.
1742
1743         Adds a new helper function that returns the undo/redo name for a given EditAction. No change in behavior.
1744
1745         * Sources.txt:
1746         * WebCore.xcodeproj/project.pbxproj:
1747         * editing/EditAction.cpp: Copied from Source/WebKit/UIProcess/WebEditCommandProxy.cpp.
1748         (WebCore::nameForUndoRedo):
1749         * editing/EditAction.h:
1750         * editing/Editor.cpp:
1751
1752 2019-01-03  Matt Rajca  <mrajca@apple.com>
1753
1754         Make DidPlayMediaPreventedFromPlaying autoplay event more generic.
1755         https://bugs.webkit.org/show_bug.cgi?id=193128
1756         rdar://34554231
1757
1758         Reviewed by Jer Noble.
1759
1760         Today, the "DidPlayMediaPreventedFromPlaying" autoplay event is only sent for
1761         media prevented from autoplaying. It could be generalized to a "DidPlayMediaWithUserGesture"
1762         event along with a flag that indicates whether or not autoplay was actually prevented.
1763         Moreover, we can include a flag that indicates whether the media element in question
1764         is main content. Clients will then know in more cases when media was played with a user
1765         gesture, whether or not it has audio, as well as its main content status. While the main
1766         content heuristics may not be perfect, they covered the top 20 video-centric websites that
1767         this was tested with and are meant to be used by clients for data evaluation purposes.
1768
1769         As part of this, the PlaybackWithoutUserGesture enum was renamed to AutoplayEventPlaybackState
1770         since it now also applies to cases where there is a user gesture. The
1771         `m_playbackWithoutUserGestureStartedTime` member variable was also removed in favor of
1772         `playbackStartedTime` which also covers all the cases we care about.
1773
1774         Tests: existing API tests were updated to reflect the new names. New API tests
1775         were added for the new case in which the "DidPlayMediaWithUserGesture" event is sent.
1776
1777         * html/HTMLMediaElement.cpp:
1778         (WebCore::convertEnumerationToString): Update to new enum cases.
1779         (WebCore::HTMLMediaElement::setReadyState): Ditto.
1780         (WebCore::HTMLMediaElement::play): Ditto.
1781         (WebCore::HTMLMediaElement::playInternal): Also cover the case where
1782          playback was not prevented but there was a user gesture.
1783         (WebCore::HTMLMediaElement::pauseInternal): Use new name.
1784         (WebCore::HTMLMediaElement::setVolume): Use new name.
1785         (WebCore::HTMLMediaElement::playbackProgressTimerFired): Dispatch the
1786          DidPlayMediaWithUserGesture event when playback was started with a user
1787          gesture as well.
1788         (WebCore::HTMLMediaElement::mediaPlayerDidAddAudioTrack): Use new name.
1789         (WebCore::HTMLMediaElement::mediaPlayerTimeChanged): Ditto.
1790         (WebCore::HTMLMediaElement::mediaPlayerCharacteristicChanged): Ditto.
1791         (WebCore::HTMLMediaElement::stopWithoutDestroyingMediaPlayer): Ditto.
1792         (WebCore::HTMLMediaElement::handleAutoplayEvent): Pass along new media state.
1793         (WebCore::HTMLMediaElement::userDidInterfereWithAutoplay): Use new name.
1794         (WebCore::HTMLMediaElement::setAutoplayEventPlaybackState): Stop setting
1795          m_playbackWithoutUserGestureStartedTime in favor of using playbackStartedTime.
1796         (WebCore::HTMLMediaElement::updateShouldPlay): Use new name.
1797         (WebCore::HTMLMediaElement::setPlaybackWithoutUserGesture): Renamed.
1798         * html/HTMLMediaElement.h:
1799         (WTF::LogArgument<WebCore::HTMLMediaElement::AutoplayEventPlaybackState>::toString): Renamed from...
1800         (WTF::LogArgument<WebCore::HTMLMediaElement::PlaybackWithoutUserGesture>::toString):
1801         * html/MediaElementSession.cpp:
1802         (WebCore::MediaElementSession::isMainContentForPurposesOfAutoplayEvents const): Don't
1803          do the hit testing check for the purposes of autoplay events. It seems to fail on the
1804          basic Vimeo player due to overlapping divs.
1805         (WebCore::isElementMainContentForPurposesOfAutoplay):
1806         (WebCore::MediaElementSession::updateIsMainContent const): Keep the existing behavior
1807          here of hit testing.
1808         (WebCore::isMainContentForPurposesOfAutoplay): Renamed.
1809         * html/MediaElementSession.h:
1810         * page/AutoplayEvent.h:
1811
1812 2019-01-04  Youenn Fablet  <youenn@apple.com>
1813
1814         Crash in WebCore::ServiceWorkerGlobalScope
1815         https://bugs.webkit.org/show_bug.cgi?id=192513
1816         <rdar://problem/46563880>
1817
1818         Reviewed by Alex Christensen.
1819
1820         Store the identifier in its own variable to make sure we do not use workerThread after being moved.
1821
1822         * workers/service/ServiceWorkerGlobalScope.cpp:
1823         (WebCore::ServiceWorkerGlobalScope::skipWaiting):
1824
1825 2019-01-04  Chris Fleizach  <cfleizach@apple.com>
1826
1827         AX: String check: "Rule" does not reflect the meaning of the <hr> html tag
1828         https://bugs.webkit.org/show_bug.cgi?id=193041
1829         <rdar://problem/46954090>
1830
1831         Reviewed by Zalan Bujtas.
1832
1833         * en.lproj/Localizable.strings:
1834         * platform/cocoa/LocalizedStringsCocoa.mm:
1835         (WebCore::AXHorizontalRuleDescriptionText):
1836
1837 2019-01-04  Zalan Bujtas  <zalan@apple.com>
1838
1839         [LFC] ComputedHorizontalMargin should have optional members
1840         https://bugs.webkit.org/show_bug.cgi?id=193131
1841
1842         Reviewed by Antti Koivisto.
1843
1844         Split HorizontalMargin into UsedHorizontalMargin and ComputedHorizontalMargin. ComputedHorizontalMargin's members are optional.
1845         (see computed vs used values)
1846
1847         * layout/FormattingContext.h:
1848         * layout/FormattingContextGeometry.cpp:
1849         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGeometry):
1850         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedHorizontalGeometry):
1851         (WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedWidthAndMargin):
1852         (WebCore::Layout::FormattingContext::Geometry::floatingReplacedWidthAndMargin):
1853         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedWidthAndMargin):
1854         (WebCore::Layout::FormattingContext::Geometry::computedHorizontalMargin):
1855         (WebCore::Layout::FormattingContext::Geometry::computedNonCollapsedHorizontalMarginValue): Deleted.
1856         * layout/LayoutUnits.h:
1857         * layout/MarginTypes.h:
1858         * layout/Verification.cpp:
1859         (WebCore::Layout::outputMismatchingBlockBoxInformationIfNeeded):
1860         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
1861         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin):
1862         * layout/displaytree/DisplayBox.h:
1863         (WebCore::Display::Box::setHorizontalMargin):
1864         (WebCore::Display::Box::setHorizontalComputedMargin):
1865         (WebCore::Display::Box::computedMarginStart const):
1866         (WebCore::Display::Box::computedMarginEnd const):
1867         * layout/floats/FloatAvoider.h:
1868         (WebCore::Layout::FloatAvoider::marginStart const):
1869         (WebCore::Layout::FloatAvoider::marginEnd const):
1870         * layout/inlineformatting/InlineFormattingContext.cpp:
1871         (WebCore::Layout::InlineFormattingContext::collectInlineContentForSubtree const):
1872         * layout/inlineformatting/InlineFormattingContextGeometry.cpp:
1873         (WebCore::Layout::InlineFormattingContext::Geometry::inlineBlockWidthAndMargin):
1874
1875 2019-01-04  Zalan Bujtas  <zalan@apple.com>
1876
1877         [LFC][BFC] Use computedValue and usedValue consistently
1878         https://bugs.webkit.org/show_bug.cgi?id=193059
1879
1880         Reviewed by Antti Koivisto.
1881
1882         https://www.w3.org/TR/CSS22/cascade.html#value-stages
1883
1884         6.1.2 Computed values
1885         Specified values are resolved to computed values during the cascade; for example URIs are made absolute and 'em' and 'ex' units
1886         are computed to pixel or absolute lengths. Computing a value never requires the user agent to render the document...
1887
1888         6.1.3 Used values
1889         Computed values are processed as far as possible without formatting the document. Some values, however, can only be determined when the document
1890         is being laid out. For example, if the width of an element is set to be a certain percentage of its containing block, the width cannot be determined
1891         until the width of the containing block has been determined. The used value is the result of taking the computed value and resolving any remaining
1892         dependencies into an absolute value.
1893
1894         * layout/FormattingContext.cpp:
1895         (WebCore::Layout::FormattingContext::computeOutOfFlowHorizontalGeometry const):
1896         * layout/FormattingContextGeometry.cpp:
1897         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGeometry):
1898         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedVerticalGeometry):
1899         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedHorizontalGeometry):
1900         (WebCore::Layout::FormattingContext::Geometry::complicatedCases):
1901         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedWidthAndMargin):
1902         * layout/LayoutState.cpp:
1903         (WebCore::Layout::LayoutState::LayoutState):
1904         * layout/LayoutUnits.h:
1905         * layout/Verification.cpp:
1906         (WebCore::Layout::outputMismatchingBlockBoxInformationIfNeeded):
1907         * layout/blockformatting/BlockFormattingContext.cpp:
1908         (WebCore::Layout::BlockFormattingContext::computeWidthAndMargin const):
1909         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
1910         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin):
1911         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowReplacedWidthAndMargin):
1912         * layout/displaytree/DisplayBox.cpp:
1913         (WebCore::Display::Box::Box):
1914         * layout/displaytree/DisplayBox.h:
1915         (WebCore::Display::Box::setHasValidHorizontalComputedMargin):
1916         (WebCore::Display::Box::setHorizontalComputedMargin):
1917         (WebCore::Display::Box::computedMarginStart const):
1918         (WebCore::Display::Box::computedMarginEnd const):
1919         (WebCore::Display::Box::setHasValidHorizontalNonComputedMargin): Deleted.
1920         (WebCore::Display::Box::setHorizontalNonComputedMargin): Deleted.
1921         (WebCore::Display::Box::nonComputedMarginStart const): Deleted.
1922         (WebCore::Display::Box::nonComputedMarginEnd const): Deleted.
1923         * layout/floats/FloatAvoider.h:
1924         (WebCore::Layout::FloatAvoider::marginStart const):
1925         (WebCore::Layout::FloatAvoider::marginEnd const):
1926         * layout/inlineformatting/InlineFormattingContext.cpp:
1927         (WebCore::Layout::InlineFormattingContext::computeWidthAndMargin const):
1928
1929 2019-01-03  Zalan Bujtas  <zalan@apple.com>
1930
1931         REGRESSION: -webkit-appearance test case crashes
1932         https://bugs.webkit.org/show_bug.cgi?id=189302
1933         <rdar://problem/44143049>
1934
1935         Reviewed by Wenson Hsieh.
1936
1937         The painting and the layout positions of the cancel button need to match in order to be able to interact with it.
1938         This patch removes the previous position inlining attempts.
1939
1940         Test: fast/forms/webkit-appearance-searchfield-cancel-button-crash.html
1941
1942         * rendering/RenderThemeMac.mm:
1943         (WebCore::RenderThemeMac::paintSearchFieldCancelButton):
1944
1945 2019-01-03  David Kilzer  <ddkilzer@apple.com>
1946
1947         Leak of WebCore::LibWebRTCCertificateGenerator::RTCCertificateGeneratorCallback (48 bytes) in com.apple.WebKit.WebContent running WebKit layout tests
1948         <https://webkit.org/b/193122>
1949         <rdar://problem/47022987>
1950
1951         Reviewed by Youenn Fablet.
1952
1953         * Modules/mediastream/libwebrtc/LibWebRTCCertificateGenerator.cpp:
1954         (WebCore::LibWebRTCCertificateGenerator::RTCCertificateGeneratorCallback::AddRef const):
1955         (WebCore::LibWebRTCCertificateGenerator::RTCCertificateGeneratorCallback::Release const):
1956         - Remove `final` keyword so that
1957           `new rtc::RefCountedObject<RTCCertificateGeneratorCallback>()`
1958           can be called.
1959         (WebCore::LibWebRTCCertificateGenerator::generateCertificate):
1960         - To fix the leak call
1961           `new rtc::RefCountedObject<RTCCertificateGeneratorCallback>()`
1962           to create the object.
1963
1964 2019-01-03  Simon Fraser  <simon.fraser@apple.com>
1965
1966         REGRESSION (r238090): After showing the Find banner or tab bar, hit tests are vertically offset (or painting is not offset)
1967         https://bugs.webkit.org/show_bug.cgi?id=193124
1968         rdar://problem/46755409
1969
1970         Reviewed by Tim Horton.
1971
1972         Top content inset feeds into scrolling tree geometry, so when it changes we need to trigger
1973         an update of the root scrolling node, which happens via RenderLayerBacking::updateGeometry().
1974         So set a dirty bit on the root layer in frameViewDidChangeSize(), which is called from the code
1975         path that runs when top content inset changes.
1976
1977         Find banner behavior is not easily testable. platform/mac/fast/events/content-inset-hit-testing.html did not detect the regression.
1978
1979         * rendering/RenderLayerCompositor.cpp:
1980         (WebCore::RenderLayerCompositor::frameViewDidChangeSize):
1981
1982 2019-01-03  Chris Dumez  <cdumez@apple.com>
1983
1984         Potential infinite recursion in isFrameFamiliarWith(Frame&, Frame&)
1985         https://bugs.webkit.org/show_bug.cgi?id=192997
1986         <rdar://problem/46217271>
1987
1988         Reviewed by Antti Koivisto.
1989
1990         isFrameFamiliarWith(Frame&, Frame&) was called recursively using the passed frames' openers.
1991         The issue is that a Frame can be its opener. There could also be a cycle in the opener chain.
1992
1993         To address the issue, simplify isFrameFamiliarWith() so that it is no longer recursive. We now
1994         only check if the frames belong to the same pages or if their openers do. We no longer check
1995         openers' opener and up.
1996
1997         Note that this function is used to check if a frame is allowed to target another. In practice,
1998         it is unlikely to be useful to navigate an opener's opener and an openee's openee.
1999
2000         Tests: fast/dom/Window/window-open-opener-cycle.html
2001                fast/dom/Window/window-open-self-as-opener.html
2002
2003         * page/FrameTree.cpp:
2004         (WebCore::isFrameFamiliarWith):
2005
2006 2019-01-02  Simon Fraser  <simon.fraser@apple.com>
2007
2008         REGRESSION (r239306): Don't disable font smoothing in transparent layers on macOS Mojave and later
2009         https://bugs.webkit.org/show_bug.cgi?id=193095
2010         <rdar://problem/47014944>
2011
2012         Reviewed by Zalan Bujtas.
2013         
2014         In r239306 we stopped making CALayers for font-smoothed text when not necessary on macOS Mojave
2015         and later. However, we still turned off smoothing for non-opaque layers (setShouldSmoothFonts(false)),
2016         which continues to affect the appearance of text.
2017         
2018         Fix by only calling setShouldSmoothFonts(false) when the OS supports font smoothing.
2019
2020         Test: compositing/contents-format/subpixel-antialiased-text.html
2021
2022         * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
2023         (WebCore::PlatformCALayer::drawLayerContents):
2024
2025 2019-01-02  David Kilzer  <ddkilzer@apple.com>
2026
2027         Leak of CMSampleBuffer (752 bytes) in com.apple.WebKit.WebContent running WebKit layout tests
2028         <https://webkit.org/b/193016>
2029         <rdar://problem/46925703>
2030
2031         Reviewed by Simon Fraser.
2032
2033         * platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.mm:
2034         (WebCore::copySampleBufferWithCurrentTimeStamp):
2035         - Change to return RetainPtr<CMSampleBufferRef>.
2036         - Check return value of CMSampleBufferCreateCopyWithNewTiming().
2037         (WebCore::MediaRecorderPrivateWriter::appendVideoSampleBuffer):
2038         - Check return value of copySampleBufferWithCurrentTimeStamp().
2039         - Fix leak by using RetainPtr<CMSampleBufferRef> returned from
2040           copySampleBufferWithCurrentTimeStamp() instead of leaking
2041           `bufferWithCurrentTime` by using retainPtr().
2042         (WebCore::createAudioFormatDescription):
2043         - Extract method from appendAudioSampleBuffer() to return
2044           RetainPtr<CMFormatDescriptionRef> after calling
2045           CMAudioFormatDescriptionCreate().
2046         - Check return value of CMAudioFormatDescriptionCreate().
2047         (WebCore::createAudioSampleBufferWithPacketDescriptions):
2048         - Extract method from appendAudioSampleBuffer() to return
2049           RetainPtr<CMSampleBufferRef> after calling
2050           CMAudioSampleBufferCreateWithPacketDescriptions().
2051         (WebCore::MediaRecorderPrivateWriter::appendAudioSampleBuffer):
2052         - Check return values of createAudioFormatDescription() and
2053           createAudioSampleBufferWithPacketDescriptions().
2054         - Fix leaks by extracting code into helper methods that return
2055           RetainPtr<> objects instead of leaking CMFormatDescriptionRef
2056           directly or leaking `sampleBuffer` by using retainPtr().
2057
2058 2019-01-02  Wenson Hsieh  <wenson_hsieh@apple.com>
2059
2060         Add support for using the current text selection as the find string on iOS
2061         https://bugs.webkit.org/show_bug.cgi?id=193034
2062         <rdar://problem/45138739>
2063
2064         Reviewed by Tim Horton.
2065
2066         Add support for "TakeFindStringFromSelection" on iOS. Unlike macOS, iOS does not have a notion of a "find
2067         pasteboard" like macOS; instead, we handle this editing command by sending the selection string to the UI
2068         process, where it is exposed via WebKit SPI so that clients that present find-in-page UI (i.e. MobileSafari) are
2069         able to trigger find-in-page with this string.
2070
2071         Test: WebKit.UseSelectionAsFindString
2072
2073         * editing/Editor.cpp:
2074         (WebCore::Editor::canCopyExcludingStandaloneImages const):
2075
2076         Make this helper function cross-platform.
2077
2078         * editing/Editor.h:
2079         * editing/EditorCommand.cpp:
2080         (WebCore::createCommandMap):
2081         * editing/cocoa/EditorCocoa.mm:
2082         (WebCore::Editor::takeFindStringFromSelection):
2083
2084         Move this from EditorMac to EditorCocoa, and implement it on iOS by calling into the editor client to update the
2085         find string (see WebKit/ChangeLog for more details).
2086
2087         * editing/mac/EditorMac.mm:
2088         (WebCore::Editor::canCopyExcludingStandaloneImages): Deleted.
2089         (WebCore::Editor::takeFindStringFromSelection): Deleted.
2090         * loader/EmptyClients.cpp:
2091         * page/EditorClient.h:
2092
2093         Add a new editor client method to send the string for find-in-page to the UI process.
2094
2095 2019-01-02  Devin Rousso  <webkit@devinrousso.com>
2096
2097         Web Inspector: Implement `queryObjects` Command Line API
2098         https://bugs.webkit.org/show_bug.cgi?id=176766
2099         <rdar://problem/34890689>
2100
2101         Reviewed by Joseph Pecoraro.
2102
2103         Test: inspector/console/queryObjects.html
2104
2105         * inspector/CommandLineAPIModuleSource.js:
2106         (CommandLineAPI):
2107         (CommandLineAPIImpl.prototype.queryObjects): Added.
2108
2109 2019-01-02  Charles Vazac  <cvazac@gmail.com>
2110
2111         Fix resourcetimingbufferfull bubbles attribute
2112         https://bugs.webkit.org/show_bug.cgi?id=193087
2113
2114         Reviewed by Chris Dumez.
2115
2116         This change is covered by web-platform-tests [1].
2117
2118         [1] https://github.com/web-platform-tests/wpt/blob/master/resource-timing/buffer-full-when-populate-entries.html#L20
2119
2120         * page/Performance.cpp:
2121         (WebCore::Performance::resourceTimingBufferFullTimerFired):
2122
2123 2019-01-02  Simon Fraser  <simon.fraser@apple.com>
2124
2125         Rename LayerScrollCoordinationRole to ScrollCoordinationRole and make an enum class
2126         https://bugs.webkit.org/show_bug.cgi?id=193010
2127
2128         Reviewed by Zalan Bujtas.
2129
2130         Move the enum LayerScrollCoordinationRole from RenderLayer.h to RenderLayerCompositor.h,
2131         and make it an enum class.
2132
2133         * page/FrameView.cpp:
2134         (WebCore::FrameView::scrollLayerID const):
2135         * rendering/RenderLayer.h:
2136         * rendering/RenderLayerBacking.cpp:
2137         (WebCore::RenderLayerBacking::~RenderLayerBacking):
2138         (WebCore::RenderLayerBacking::detachFromScrollingCoordinator):
2139         (WebCore::operator<<):
2140         * rendering/RenderLayerBacking.h:
2141         * rendering/RenderLayerCompositor.cpp:
2142         (WebCore::RenderLayerCompositor::updateScrollCoordinatedStatus):
2143         (WebCore::RenderLayerCompositor::removeFromScrollCoordinatedLayers):
2144         (WebCore::scrollCoordinationRoleForNodeType):
2145         (WebCore::RenderLayerCompositor::attachScrollingNode):
2146         (WebCore::RenderLayerCompositor::detachScrollCoordinatedLayer):
2147         (WebCore::RenderLayerCompositor::updateScrollCoordinatedLayer):
2148         (WebCore::RenderLayerCompositor::willRemoveScrollingLayerWithBacking):
2149         * rendering/RenderLayerCompositor.h:
2150
2151 2019-01-02  Simon Fraser  <simon.fraser@apple.com>
2152
2153         Don't spin up a CalcParser if the current token is not a function token
2154         https://bugs.webkit.org/show_bug.cgi?id=193067
2155
2156         Reviewed by Zalan Bujtas.
2157
2158         Various functions in CSSPropertyParserHelpers fall back to trying to parse
2159         a calc expression if the normal parsing fails. Don't do this unless the
2160         current token is a function token, which should be slightly more efficient.
2161
2162         * css/parser/CSSPropertyParserHelpers.cpp:
2163         (WebCore::CSSPropertyParserHelpers::consumeInteger):
2164         (WebCore::CSSPropertyParserHelpers::consumePositiveIntegerRaw):
2165         (WebCore::CSSPropertyParserHelpers::consumeNumberRaw):
2166         (WebCore::CSSPropertyParserHelpers::consumeNumber):
2167         (WebCore::CSSPropertyParserHelpers::consumeFontWeightNumber):
2168         (WebCore::CSSPropertyParserHelpers::consumeLength):
2169         (WebCore::CSSPropertyParserHelpers::consumePercent):
2170         (WebCore::CSSPropertyParserHelpers::consumeLengthOrPercent):
2171         (WebCore::CSSPropertyParserHelpers::consumeAngle):
2172         (WebCore::CSSPropertyParserHelpers::consumeAngleOrPercent):
2173         (WebCore::CSSPropertyParserHelpers::consumeTime):
2174
2175 2019-01-02  Simon Fraser  <simon.fraser@apple.com>
2176
2177         Support css-color-4 rgb functions
2178         https://bugs.webkit.org/show_bug.cgi?id=192321
2179
2180         Reviewed by Zalan Bujtas.
2181         
2182         Support the new rgb()/rgba() syntax described in https://drafts.csswg.org/css-color/#rgb-functions.
2183         The differences are:
2184         1. There is a new comma-free syntax, where the optional alpha is separated by a slash:
2185             rgb(128 34 56)
2186             rgb(128 34 56 / 50%)
2187         2. Floating point values are allowed, and rounded:
2188             rgb(128.5 34.2 56.5) becomes rgb(129 34 57)
2189         3. rgba() is a pure alias for rgb(), so these are equivalent:
2190             rgb(128 34 56 / 50%)
2191             rgba(128 34 56 / 50%)
2192             
2193         hsl()/hsla() parsing was already updated to this new syntax in r230861.
2194
2195         Tested by tests in imported/w3c/web-platform-tests/css/css-color/
2196
2197         * css/parser/CSSPropertyParserHelpers.cpp:
2198         (WebCore::CSSPropertyParserHelpers::clampRGBComponent):
2199         (WebCore::CSSPropertyParserHelpers::parseRGBParameters):
2200         (WebCore::CSSPropertyParserHelpers::parseColorFunction):
2201
2202 2019-01-02  Simon Fraser  <simon.fraser@apple.com>
2203
2204         Handle calc() expressions in gradient color stops
2205         https://bugs.webkit.org/show_bug.cgi?id=193066
2206         rdar://problem/46961985
2207
2208         Reviewed by Sam Weinig.
2209         
2210         Fix two issues that prevented calc() expressions from working in conic-gradient color stops,
2211         for the angle or percent value. First, consumeAngleOrPercent() needs to look for CalculationCategory::Percent
2212         calc values as well as angle ones.
2213
2214         Second, CSSPrimitiveValue::isAngle() needs to use primitiveType() (which takes calc into account),
2215         just as isPx() etc do.
2216
2217         Test: fast/gradients/conic-calc-stop-position.html
2218
2219         * css/CSSPrimitiveValue.h:
2220         (WebCore::CSSPrimitiveValue::isAngle const):
2221         * css/parser/CSSPropertyParserHelpers.cpp:
2222         (WebCore::CSSPropertyParserHelpers::consumeAngleOrPercent):
2223         (WebCore::CSSPropertyParserHelpers::consumeGradientColorStops):
2224
2225 2018-12-31  Keith Miller  <keith_miller@apple.com>
2226
2227         SourceProviders should use an actual URL instead of a string
2228         https://bugs.webkit.org/show_bug.cgi?id=192734
2229
2230         Reviewed by Yusuke Suzuki.
2231
2232         Remove ScriptSourceCode's URL member and make the url() method
2233         reference the URL on the SourceProvider. Also, avoid some
2234         ref count churn.
2235
2236         Additionally, this patch fixes an existing bug in
2237         WorkletGlobalScope() that would use a ScriptSourceCode after
2238         WTFMoving it.
2239
2240         * bindings/js/CachedScriptSourceProvider.h:
2241         (WebCore::CachedScriptSourceProvider::CachedScriptSourceProvider):
2242         * bindings/js/ScheduledAction.cpp:
2243         (WebCore::ScheduledAction::execute):
2244         * bindings/js/ScriptController.cpp:
2245         (WebCore::ScriptController::executeScriptInWorld):
2246         (WebCore::ScriptController::executeScript):
2247         * bindings/js/ScriptSourceCode.h:
2248         (WebCore::ScriptSourceCode::ScriptSourceCode):
2249         (WebCore::ScriptSourceCode::m_code):
2250         (WebCore::ScriptSourceCode::url const):
2251         (WebCore::ScriptSourceCode::m_url): Deleted.
2252         * dom/ScriptElement.cpp:
2253         (WebCore::ScriptElement::prepareScript):
2254         (WebCore::ScriptElement::requestModuleScript):
2255         (WebCore::ScriptElement::executePendingScript):
2256         * html/HTMLMediaElement.cpp:
2257         (WebCore::HTMLMediaElement::ensureMediaControlsInjectedScript):
2258         * page/Frame.cpp:
2259         (WebCore::Frame::injectUserScriptImmediately):
2260         * workers/WorkerGlobalScope.cpp:
2261         (WebCore::WorkerGlobalScope::importScripts):
2262         * workers/WorkerThread.cpp:
2263         (WebCore::WorkerThread::workerThread):
2264         * worklets/WorkletGlobalScope.cpp:
2265         (WebCore::WorkletGlobalScope::WorkletGlobalScope):
2266         * xml/parser/XMLDocumentParserLibxml2.cpp:
2267         (WebCore::XMLDocumentParser::endElementNs):
2268
2269 2019-01-01  Jeff Miller  <jeffm@apple.com>
2270
2271         Update user-visible copyright strings to include 2019
2272         https://bugs.webkit.org/show_bug.cgi?id=192811
2273
2274         Reviewed by Mark Lam.
2275
2276         * Info.plist:
2277
2278 2018-12-30  David Kilzer  <ddkilzer@apple.com>
2279
2280         clang-tidy: Save 8 padding bytes on WebCore::BorderEdge
2281         <https://webkit.org/b/193058>
2282         <rdar://problem/46979275>
2283
2284         Reviewed by Yusuke Suzuki.
2285
2286         * rendering/BorderEdge.cpp:
2287         (WebCore::BorderEdge::BorderEdge): Reorder initialization to
2288         match new instance variable order.
2289         * rendering/BorderEdge.h: Reorder instance variables to save
2290         8 padding bytes.
2291
2292 2018-12-28  Yusuke Suzuki  <yusukesuzuki@slowstart.org>
2293
2294         [JSC] Remove one indirection in JSObject::toStringName
2295         https://bugs.webkit.org/show_bug.cgi?id=193037
2296
2297         Reviewed by Keith Miller.
2298
2299         Use old JSObject::toStringName function here.
2300
2301         * bindings/js/JSDOMConstructorBase.cpp:
2302         (WebCore::JSDOMConstructorBase::className):
2303         (WebCore::JSDOMConstructorBase::toStringName):
2304         * bindings/js/JSDOMConstructorBase.h:
2305         (WebCore::JSDOMConstructorBase::className): Deleted.
2306
2307 2018-12-27  Alex Christensen  <achristensen@webkit.org>
2308
2309         Resurrect Mac CMake build
2310         https://bugs.webkit.org/show_bug.cgi?id=192658
2311
2312         Reviewed by Yusuke Suzuki.
2313
2314         This makes it so JSC and most of WebCore builds.
2315         WebCore's use of ARC seems inconsistent, so I'll fix that later.
2316
2317         * PlatformMac.cmake:
2318         * config.h:
2319
2320 2018-12-26  Jim Mason  <jmason@ibinx.com>
2321
2322         [FreeType] Restore conditional compilation logic for recent HarfBuzz refactoring
2323         https://bugs.webkit.org/show_bug.cgi?id=193036
2324
2325         Reviewed by Michael Catanzaro.
2326
2327         * platform/graphics/FontPlatformData.h:
2328         * platform/graphics/freetype/FontPlatformDataFreeType.cpp:
2329
2330 2018-12-24  Fujii Hironori  <Hironori.Fujii@sony.com>
2331
2332         Remove "using namespace std;"
2333         https://bugs.webkit.org/show_bug.cgi?id=192973
2334         <rdar://problem/46937309>
2335
2336         Unreviewed Windows port Debug builds fix.
2337
2338         No new tests since no behavior changes.
2339
2340         * accessibility/win/AXObjectCacheWin.cpp:
2341         (WebCore::AXObjectCache::postPlatformNotification): Add "std::" prefix to numeric_limits in ASSERT macro.
2342
2343 2018-12-24  Fujii Hironori  <Hironori.Fujii@sony.com>
2344
2345         Remove "using namespace std;"
2346         https://bugs.webkit.org/show_bug.cgi?id=192973
2347
2348         Reviewed by Alex Christensen.
2349
2350         Removed "using namespace std" statement, and use std:: prefix.
2351
2352         No new tests since no behavior changes.
2353
2354         * accessibility/win/AXObjectCacheWin.cpp:
2355         * platform/graphics/GraphicsContext3DPrivate.cpp:
2356         * platform/graphics/cairo/ImageBufferCairo.cpp:
2357         * platform/graphics/win/FontPlatformDataCairoWin.cpp:
2358         * platform/graphics/win/FontWin.cpp:
2359         (WebCore::FontCascade::floatWidthForComplexText const):
2360         * platform/graphics/win/GraphicsContextCGWin.cpp:
2361         * platform/graphics/win/GraphicsContextCairoWin.cpp:
2362         * platform/graphics/win/GraphicsContextDirect2D.cpp:
2363         * platform/graphics/win/GraphicsContextWin.cpp:
2364         * platform/graphics/win/SimpleFontDataCGWin.cpp:
2365         * platform/graphics/win/UniscribeController.cpp:
2366         (WebCore::UniscribeController::UniscribeController):
2367         (WebCore::UniscribeController::shapeAndPlaceItem):
2368         * platform/image-decoders/ScalableImageDecoder.cpp:
2369         * platform/text/LocaleICU.cpp:
2370         * platform/text/win/LocaleWin.cpp:
2371         * platform/win/ScrollbarThemeWin.cpp:
2372         * rendering/RenderRubyRun.cpp:
2373         (WebCore::RenderRubyRun::layoutBlock):
2374         * rendering/RenderThemeWin.cpp:
2375         (WebCore::RenderThemeWin::adjustMenuListButtonStyle const):
2376         (WebCore::RenderThemeWin::paintSearchFieldCancelButton):
2377         (WebCore::RenderThemeWin::adjustSearchFieldCancelButtonStyle const):
2378         (WebCore::RenderThemeWin::adjustSearchFieldResultsDecorationPartStyle const):
2379         (WebCore::RenderThemeWin::paintSearchFieldResultsDecorationPart):
2380         (WebCore::RenderThemeWin::adjustSearchFieldResultsButtonStyle const):
2381         (WebCore::RenderThemeWin::paintSearchFieldResultsButton):
2382
2383 2018-12-24  Simon Fraser  <simon.fraser@apple.com>
2384
2385         Change ScrollingNodeType to an enum class
2386         https://bugs.webkit.org/show_bug.cgi?id=193009
2387
2388         Reviewed by Zalan Bujtas.
2389
2390         Change the ScrollingNodeType enum to an enum class.
2391         
2392         No behavior change.
2393
2394         * page/scrolling/AsyncScrollingCoordinator.cpp:
2395         (WebCore::AsyncScrollingCoordinator::ensureRootStateNodeForFrameView):
2396         * page/scrolling/ScrollingCoordinator.cpp:
2397         (WebCore::operator<<):
2398         * page/scrolling/ScrollingCoordinator.h:
2399         * page/scrolling/ScrollingStateFixedNode.cpp:
2400         (WebCore::ScrollingStateFixedNode::ScrollingStateFixedNode):
2401         * page/scrolling/ScrollingStateNode.h:
2402         (WebCore::ScrollingStateNode::isFixedNode const):
2403         (WebCore::ScrollingStateNode::isStickyNode const):
2404         (WebCore::ScrollingStateNode::isFrameScrollingNode const):
2405         (WebCore::ScrollingStateNode::isOverflowScrollingNode const):
2406         * page/scrolling/ScrollingStateOverflowScrollingNode.cpp:
2407         (WebCore::ScrollingStateOverflowScrollingNode::ScrollingStateOverflowScrollingNode):
2408         * page/scrolling/ScrollingStateStickyNode.cpp:
2409         (WebCore::ScrollingStateStickyNode::ScrollingStateStickyNode):
2410         * page/scrolling/ScrollingStateTree.cpp:
2411         (WebCore::ScrollingStateTree::createNode):
2412         (WebCore::ScrollingStateTree::attachNode):
2413         * page/scrolling/ScrollingTreeNode.h:
2414         (WebCore::ScrollingTreeNode::isFixedNode const):
2415         (WebCore::ScrollingTreeNode::isStickyNode const):
2416         (WebCore::ScrollingTreeNode::isFrameScrollingNode const):
2417         (WebCore::ScrollingTreeNode::isOverflowScrollingNode const):
2418         * page/scrolling/ScrollingTreeOverflowScrollingNode.cpp:
2419         (WebCore::ScrollingTreeOverflowScrollingNode::ScrollingTreeOverflowScrollingNode):
2420         * page/scrolling/ios/ScrollingTreeIOS.cpp:
2421         (WebCore::ScrollingTreeIOS::createScrollingTreeNode):
2422         * page/scrolling/mac/ScrollingTreeFixedNode.mm:
2423         (WebCore::ScrollingTreeFixedNode::ScrollingTreeFixedNode):
2424         * page/scrolling/mac/ScrollingTreeMac.cpp:
2425         (ScrollingTreeMac::createScrollingTreeNode):
2426         * page/scrolling/mac/ScrollingTreeStickyNode.mm:
2427         (WebCore::ScrollingTreeStickyNode::ScrollingTreeStickyNode):
2428         * platform/graphics/GraphicsLayerClient.h:
2429         * rendering/RenderLayerCompositor.cpp:
2430         (WebCore::RenderLayerCompositor::reattachSubframeScrollLayers):
2431         (WebCore::scrollCoordinationRoleForNodeType):
2432         (WebCore::RenderLayerCompositor::updateScrollCoordinationForThisFrame):
2433         (WebCore::RenderLayerCompositor::updateScrollCoordinatedLayer):
2434
2435 2018-12-22  Carlos Garcia Campos  <cgarcia@igalia.com>
2436
2437         [HarfBuzz] Width not correctly reported as 0 for zero font size
2438         https://bugs.webkit.org/show_bug.cgi?id=192986
2439
2440         Reviewed by Michael Catanzaro.
2441
2442         Fixes test fast/text/font-size-zero.html
2443
2444         * platform/graphics/harfbuzz/ComplexTextControllerHarfBuzz.cpp:
2445         (WebCore::ComplexTextController::ComplexTextRun::ComplexTextRun): Use empty advances for glyphs when the font
2446         size is zero.
2447
2448 2018-12-20  Yusuke Suzuki  <yusukesuzuki@slowstart.org>
2449
2450         Use Ref<> as much as possible
2451         https://bugs.webkit.org/show_bug.cgi?id=192808
2452
2453         Reviewed by Alex Christensen.
2454
2455         * Modules/encryptedmedia/NavigatorEME.cpp:
2456         (WebCore::NavigatorEME::requestMediaKeySystemAccess):
2457         * Modules/fetch/FetchBody.cpp:
2458         (WebCore::FetchBody::bodyAsFormData const):
2459         * Modules/geolocation/Geolocation.cpp:
2460         (WebCore::Geolocation::getCurrentPosition):
2461         (WebCore::Geolocation::watchPosition):
2462         * Modules/indexeddb/IDBDatabase.cpp:
2463         (WebCore::IDBDatabase::objectStoreNames const):
2464         * Modules/indexeddb/IDBDatabase.h:
2465         * Modules/indexeddb/IDBObjectStore.cpp:
2466         (WebCore::IDBObjectStore::indexNames const):
2467         * Modules/indexeddb/IDBObjectStore.h:
2468         * Modules/indexeddb/IDBTransaction.cpp:
2469         (WebCore::IDBTransaction::scheduleOperation):
2470         * Modules/indexeddb/IDBTransaction.h:
2471         * Modules/indexeddb/client/TransactionOperation.h:
2472         (WebCore::IDBClient::createTransactionOperation):
2473         * Modules/mediastream/MediaDevices.cpp:
2474         (WebCore::MediaDevices::getUserMedia const):
2475         (WebCore::MediaDevices::getDisplayMedia const):
2476         * Modules/mediastream/UserMediaRequest.cpp:
2477         (WebCore::UserMediaRequest::create):
2478         * Modules/mediastream/UserMediaRequest.h:
2479         * Modules/webaudio/AudioParam.cpp:
2480         (WebCore::AudioParam::calculateFinalValues):
2481         * Modules/webaudio/ScriptProcessorNode.cpp:
2482         (WebCore::ScriptProcessorNode::initialize):
2483         * Modules/webdatabase/SQLStatement.cpp:
2484         (WebCore::SQLStatement::execute):
2485         * Modules/webgpu/WebGPU.cpp:
2486         (WebCore::WebGPU::requestAdapter const):
2487         * Modules/webgpu/WebGPUAdapter.cpp:
2488         (WebCore::WebGPUAdapter::create):
2489         * Modules/webgpu/WebGPUAdapter.h:
2490         * Modules/webgpu/WebGPUBuffer.cpp:
2491         (WebCore::WebGPUBuffer::create):
2492         * Modules/webgpu/WebGPUBuffer.h:
2493         * Modules/webgpu/WebGPUCommandBuffer.cpp:
2494         (WebCore::WebGPUCommandBuffer::create):
2495         (WebCore::WebGPUCommandBuffer::beginRenderPass):
2496         * Modules/webgpu/WebGPUCommandBuffer.h:
2497         * Modules/webgpu/WebGPUDevice.cpp:
2498         (WebCore::WebGPUDevice::create):
2499         (WebCore::WebGPUDevice::createBuffer const):
2500         (WebCore::WebGPUDevice::createShaderModule const):
2501         (WebCore::WebGPUDevice::createRenderPipeline const):
2502         (WebCore::WebGPUDevice::createCommandBuffer const):
2503         * Modules/webgpu/WebGPURenderPassEncoder.cpp:
2504         (WebCore::WebGPURenderPassEncoder::create):
2505         * Modules/webgpu/WebGPURenderPassEncoder.h:
2506         * Modules/webgpu/WebGPURenderPipeline.cpp:
2507         (WebCore::WebGPURenderPipeline::create):
2508         * Modules/webgpu/WebGPURenderPipeline.h:
2509         * Modules/webgpu/WebGPUShaderModule.cpp:
2510         (WebCore::WebGPUShaderModule::create):
2511         * Modules/webgpu/WebGPUShaderModule.h:
2512         * Modules/webgpu/WebGPUTexture.cpp:
2513         (WebCore::WebGPUTexture::createDefaultTextureView):
2514         * Modules/webgpu/WebGPUTextureView.cpp:
2515         (WebCore::WebGPUTextureView::create):
2516         * Modules/webgpu/WebGPUTextureView.h:
2517         * accessibility/AXObjectCache.cpp:
2518         (WebCore::AXObjectCache::rangeMatchesTextNearRange):
2519         * accessibility/atk/AXObjectCacheAtk.cpp:
2520         (WebCore::AXObjectCache::nodeTextChangePlatformNotification):
2521         * accessibility/atk/WebKitAccessibleHyperlink.cpp:
2522         (webkitAccessibleHyperlinkGetStartIndex):
2523         (webkitAccessibleHyperlinkGetEndIndex):
2524         * accessibility/atk/WebKitAccessibleInterfaceText.cpp:
2525         (getSelectionOffsetsForObject):
2526         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
2527         (-[WebAccessibilityObjectWrapper _convertToNSRange:]):
2528         * bindings/js/JSDOMGlobalObjectTask.cpp:
2529         * bindings/js/JSDOMWindowBase.cpp:
2530         (WebCore::JSDOMWindowBase::queueTaskToEventLoop):
2531         * bindings/js/JSWorkerGlobalScopeBase.cpp:
2532         (WebCore::JSWorkerGlobalScopeBase::queueTaskToEventLoop):
2533         * bindings/js/ScriptControllerMac.mm:
2534         (WebCore::ScriptController::createScriptInstanceForWidget):
2535         * bindings/js/SerializedScriptValue.cpp:
2536         (WebCore::CloneDeserializer::readTerminal):
2537         (WebCore::SerializedScriptValue::create):
2538         * bridge/objc/objc_instance.h:
2539         * bridge/objc/objc_instance.mm:
2540         (ObjcInstance::create):
2541         * css/CSSComputedStyleDeclaration.cpp:
2542         (WebCore::ComputedStyleExtractor::currentColorOrValidColor const):
2543         (WebCore::ComputedStyleExtractor::getCSSPropertyValuesForShorthandProperties):
2544         (WebCore::ComputedStyleExtractor::getCSSPropertyValuesForGridShorthand):
2545         (WebCore::ComputedStyleExtractor::getBackgroundShorthandValue):
2546         * css/CSSComputedStyleDeclaration.h:
2547         * css/CSSFontFaceSource.cpp:
2548         (WebCore::CSSFontFaceSource::load):
2549         * css/CSSStyleSheet.cpp:
2550         (WebCore::CSSStyleSheet::rules):
2551         * css/FontFace.cpp:
2552         (WebCore::FontFace::unicodeRange const):
2553         (WebCore::FontFace::featureSettings const):
2554         * css/InspectorCSSOMWrappers.cpp:
2555         (WebCore::InspectorCSSOMWrappers::collectFromStyleSheetContents):
2556         * css/SVGCSSComputedStyleDeclaration.cpp:
2557         (WebCore::strokeDashArrayToCSSValueList):
2558         (WebCore::ComputedStyleExtractor::adjustSVGPaintForCurrentColor const):
2559         * css/StyleResolver.cpp:
2560         (WebCore::StyleResolver::createFilterOperations):
2561         * css/StyleRule.cpp:
2562         (WebCore::StyleRuleBase::createCSSOMWrapper const):
2563         * css/StyleRule.h:
2564         * dom/ChildListMutationScope.cpp:
2565         (WebCore::ChildListMutationAccumulator::getOrCreate):
2566         * dom/ChildListMutationScope.h:
2567         * dom/DocumentMarkerController.cpp:
2568         (WebCore::updateRenderedRectsForMarker):
2569         * dom/InlineStyleSheetOwner.cpp:
2570         (WebCore::InlineStyleSheetOwner::createSheet):
2571         * dom/PointerEvent.h:
2572         * dom/UserGestureIndicator.h:
2573         (WebCore::UserGestureToken::create):
2574         * editing/AlternativeTextController.cpp:
2575         (WebCore::AlternativeTextController::applyAlternativeTextToRange):
2576         (WebCore::AlternativeTextController::respondToUnappliedSpellCorrection):
2577         (WebCore::AlternativeTextController::respondToUnappliedEditing):
2578         (WebCore::AlternativeTextController::markPrecedingWhitespaceForDeletedAutocorrectionAfterCommand):
2579         (WebCore::AlternativeTextController::respondToMarkerAtEndOfWord):
2580         * editing/ApplyStyleCommand.cpp:
2581         (WebCore::ApplyStyleCommand::applyBlockStyle):
2582         (WebCore::ApplyStyleCommand::pushDownInlineStyleAroundNode):
2583         * editing/CompositeEditCommand.cpp:
2584         (WebCore::CompositeEditCommand::targetRanges const):
2585         (WebCore::CompositeEditCommand::replaceTextInNodePreservingMarkers):
2586         (WebCore::CompositeEditCommand::moveParagraphs):
2587         * editing/DeleteSelectionCommand.cpp:
2588         (WebCore::DeleteSelectionCommand::mergeParagraphs):
2589         * editing/Editing.cpp:
2590         (WebCore::visiblePositionForIndexUsingCharacterIterator):
2591         * editing/EditingStyle.cpp:
2592         (WebCore::EditingStyle::removeStyleConflictingWithStyleOfNode):
2593         (WebCore::EditingStyle::conflictsWithInlineStyleOfElement const):
2594         (WebCore::EditingStyle::prepareToApplyAt):
2595         (WebCore::EditingStyle::mergeInlineAndImplicitStyleOfElement):
2596         (WebCore::EditingStyle::mergeStyleFromRulesForSerialization):
2597         (WebCore::EditingStyle::removeStyleFromRulesAndContext):
2598         (WebCore::extractPropertiesNotIn):
2599         * editing/Editor.cpp:
2600         (WebCore::Editor::setBaseWritingDirection):
2601         (WebCore::Editor::setComposition):
2602         * editing/EditorCommand.cpp:
2603         (WebCore::executeApplyParagraphStyle):
2604         (WebCore::executeMakeTextWritingDirectionLeftToRight):
2605         (WebCore::executeMakeTextWritingDirectionNatural):
2606         (WebCore::executeMakeTextWritingDirectionRightToLeft):
2607         * editing/FormatBlockCommand.cpp:
2608         (WebCore::FormatBlockCommand::formatRange):
2609         * editing/RemoveFormatCommand.cpp:
2610         (WebCore::RemoveFormatCommand::doApply):
2611         * editing/ReplaceRangeWithTextCommand.cpp:
2612         (WebCore::ReplaceRangeWithTextCommand::targetRanges const):
2613         * editing/ReplaceSelectionCommand.cpp:
2614         (WebCore::ReplaceSelectionCommand::removeRedundantStylesAndKeepStyleSpanInline):
2615         (WebCore::handleStyleSpansBeforeInsertion):
2616         (WebCore::ReplaceSelectionCommand::handleStyleSpans):
2617         * editing/SpellingCorrectionCommand.cpp:
2618         (WebCore::SpellingCorrectionCommand::targetRanges const):
2619         * editing/TextCheckingHelper.cpp:
2620         (WebCore::TextCheckingHelper::findFirstMisspellingOrBadGrammar):
2621         * editing/TypingCommand.cpp:
2622         (WebCore::TypingCommand::insertText):
2623         (WebCore::TypingCommand::willAddTypingToOpenCommand):
2624         * editing/VisibleUnits.cpp:
2625         (WebCore::distanceBetweenPositions):
2626         * editing/cocoa/EditorCocoa.mm:
2627         (WebCore::Editor::selectionInWebArchiveFormat):
2628         * editing/ios/DictationCommandIOS.cpp:
2629         (WebCore::DictationCommandIOS::doApply):
2630         * editing/ios/EditorIOS.mm:
2631         (WebCore::Editor::setTextAlignmentForChangedBaseWritingDirection):
2632         (WebCore::Editor::removeUnchangeableStyles):
2633         (WebCore::Editor::writeImageToPasteboard):
2634         * editing/mac/EditorMac.mm:
2635         (WebCore::Editor::replaceNodeFromPasteboard):
2636         (WebCore::Editor::imageInWebArchiveFormat):
2637         * editing/markup.cpp:
2638         (WebCore::styleFromMatchedRulesAndInlineDecl):
2639         (WebCore::createFragmentForTransformToFragment):
2640         * fileapi/FileReaderLoader.cpp:
2641         (WebCore::FileReaderLoader::didFinishLoading):
2642         * html/FTPDirectoryDocument.cpp:
2643         (WebCore::createTemplateDocumentData):
2644         * html/HTMLMediaElement.cpp:
2645         (WebCore::HTMLMediaElement::scheduleEvent):
2646         (WebCore::HTMLMediaElement::createMediaControls):
2647         * html/HTMLTableElement.cpp:
2648         (WebCore::HTMLTableElement::createSharedCellStyle):
2649         * html/HTMLTableElement.h:
2650         * html/URLUtils.h:
2651         (WebCore::URLUtils<T>::origin const):
2652         * html/parser/HTMLConstructionSite.cpp:
2653         (WebCore::HTMLConstructionSite::createHTMLElementOrFindCustomElementInterface):
2654         * html/shadow/TextControlInnerElements.cpp:
2655         (WebCore::TextControlInnerElement::resolveCustomStyle):
2656         * html/track/WebVTTParser.cpp:
2657         (WebCore::WebVTTParser::createNewCue):
2658         * inspector/DOMPatchSupport.cpp:
2659         * inspector/InspectorCanvas.cpp:
2660         (WebCore::InspectorCanvas::buildInitialState):
2661         (WebCore::InspectorCanvas::buildAction):
2662         * inspector/InspectorFrontendClientLocal.cpp:
2663         (WebCore::InspectorFrontendClientLocal::openInNewTab):
2664         * inspector/InspectorStyleSheet.cpp:
2665         (WebCore::asCSSRuleList):
2666         (WebCore::InspectorStyle::styleWithProperties const):
2667         (WebCore::InspectorStyleSheet::ensureSourceData):
2668         * inspector/agents/InspectorCanvasAgent.cpp:
2669         (WebCore::InspectorCanvasAgent::didCreateCanvasRenderingContext):
2670         * inspector/agents/InspectorIndexedDBAgent.cpp:
2671         (WebCore::Inspector::keyPathFromIDBKeyPath):
2672         * inspector/agents/InspectorPageAgent.cpp:
2673         (WebCore::InspectorPageAgent::archive):
2674         * loader/EmptyClients.cpp:
2675         (WebCore::EmptyStorageNamespaceProvider::createSessionStorageNamespace):
2676         (WebCore::EmptyStorageNamespaceProvider::createLocalStorageNamespace):
2677         (WebCore::EmptyStorageNamespaceProvider::createEphemeralLocalStorageNamespace):
2678         (WebCore::EmptyStorageNamespaceProvider::createTransientLocalStorageNamespace):
2679         * loader/FrameLoader.cpp:
2680         (WebCore::FrameLoader::loadURL):
2681         (WebCore::FrameLoader::shouldInterruptLoadForXFrameOptions):
2682         (WebCore::FrameLoader::loadDifferentDocumentItem):
2683         * loader/WorkerThreadableLoader.cpp:
2684         (WebCore::WorkerThreadableLoader::loadResourceSynchronously):
2685         * loader/archive/mhtml/MHTMLParser.cpp:
2686         (WebCore::MHTMLParser::addResourceToArchive):
2687         (WebCore::MHTMLParser::parseNextPart):
2688         * loader/cache/MemoryCache.cpp:
2689         (WebCore::MemoryCache::addImageToCache):
2690         (WebCore::MemoryCache::removeResourcesWithOrigin):
2691         * page/DOMWindow.cpp:
2692         (WebCore::DOMWindow::getMatchedCSSRules const):
2693         (WebCore::DOMWindow::createWindow):
2694         * page/EventHandler.cpp:
2695         (WebCore::textDistance):
2696         * page/Page.cpp:
2697         (WebCore::Page::userStyleSheet const):
2698         * page/animation/CSSPropertyAnimation.cpp:
2699         (WebCore::blendFilterOperations):
2700         * page/ios/FrameIOS.mm:
2701         (WebCore::Frame::initWithSimpleHTMLDocument):
2702         (WebCore::Frame::interpretationsForCurrentRoot const):
2703         * page/mac/ServicesOverlayController.mm:
2704         (WebCore::ServicesOverlayController::Highlight::fadeIn):
2705         (WebCore::ServicesOverlayController::Highlight::fadeOut):
2706         * platform/SharedBuffer.cpp:
2707         (WebCore::SharedBuffer::tryCreateArrayBuffer const):
2708         * platform/audio/HRTFElevation.cpp:
2709         (WebCore::HRTFElevation::calculateKernelsForAzimuthElevation):
2710         * platform/audio/SincResampler.cpp:
2711         (WebCore::SincResampler::consumeSource):
2712         * platform/audio/gstreamer/AudioFileReaderGStreamer.cpp:
2713         (WebCore::AudioFileReader::createBus):
2714         * platform/audio/mac/AudioFileReaderMac.cpp:
2715         (WebCore::AudioFileReader::createBus):
2716         * platform/graphics/Icon.h:
2717         (WebCore::Icon::create):
2718         * platform/graphics/InbandTextTrackPrivate.h:
2719         (WebCore::InbandTextTrackPrivate::create):
2720         * platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp:
2721         (WebCore::AVFWrapper::shouldWaitForLoadingOfResource):
2722         * platform/graphics/avfoundation/objc/AudioTrackPrivateMediaSourceAVFObjC.h:
2723         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
2724         (WebCore::fulfillRequestWithKeyData):
2725         (WebCore::MediaPlayerPrivateAVFoundationObjC::shouldWaitForLoadingOfResource):
2726         * platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.h:
2727         * platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.mm:
2728         (WebCore::MediaSourcePrivateAVFObjC::create):
2729         (WebCore::MediaSourcePrivateAVFObjC::addSourceBuffer):
2730         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h:
2731         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
2732         (WebCore::SourceBufferPrivateAVFObjC::create):
2733         (WebCore::SourceBufferPrivateAVFObjC::didParseStreamDataAsAsset):
2734         * platform/graphics/avfoundation/objc/VideoTrackPrivateMediaSourceAVFObjC.h:
2735         * platform/graphics/ca/TileController.cpp:
2736         (WebCore::TileController::createTileLayer):
2737         * platform/graphics/ca/TileController.h:
2738         * platform/graphics/ca/win/CACFLayerTreeHost.cpp:
2739         (WebCore::CACFLayerTreeHost::acceleratedCompositingAvailable):
2740         (WebCore::CACFLayerTreeHost::create):
2741         * platform/graphics/gpu/cocoa/GPUBufferMetal.mm:
2742         (WebCore::GPUBuffer::create):
2743         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
2744         (WebCore::MediaPlayerPrivateGStreamer::updateTracks):
2745         (WebCore::MediaPlayerPrivateGStreamer::notifyPlayerOfVideo):
2746         (WebCore::MediaPlayerPrivateGStreamer::notifyPlayerOfAudio):
2747         (WebCore::MediaPlayerPrivateGStreamer::notifyPlayerOfText):
2748         (WebCore::MediaPlayerPrivateGStreamer::handleMessage):
2749         (WebCore::MediaPlayerPrivateGStreamer::processMpegTsSection):
2750         (WebCore::MediaPlayerPrivateGStreamer::loadNextLocation):
2751         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
2752         (WebCore::MediaPlayerPrivateGStreamerBase::paint):
2753         * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
2754         (WebCore::AppendPipeline::appsinkNewSample):
2755         * platform/graphics/iso/ISOProtectionSystemSpecificHeaderBox.cpp:
2756         (WebCore::ISOProtectionSystemSpecificHeaderBox::parse):
2757         * platform/graphics/iso/ISOTrackEncryptionBox.cpp:
2758         (WebCore::ISOTrackEncryptionBox::parse):
2759         * platform/graphics/texmap/TextureMapperAnimation.cpp:
2760         (WebCore::applyFilterAnimation):
2761         * platform/graphics/texmap/TextureMapperPlatformLayerBuffer.cpp:
2762         (WebCore::TextureMapperPlatformLayerBuffer::clone):
2763         * platform/graphics/transforms/TransformOperations.cpp:
2764         (WebCore::TransformOperations::blendByMatchingOperations const):
2765         * platform/image-decoders/ico/ICOImageDecoder.cpp:
2766         (WebCore::ICOImageDecoder::setDataForPNGDecoderAtIndex):
2767         * platform/mock/mediasource/MockBox.cpp:
2768         (WebCore::MockInitializationBox::MockInitializationBox):
2769         * platform/mock/mediasource/MockSourceBufferPrivate.cpp:
2770         (WebCore::MockSourceBufferPrivate::create):
2771         (WebCore::MockSourceBufferPrivate::append):
2772         * platform/mock/mediasource/MockSourceBufferPrivate.h:
2773         * platform/mock/mediasource/MockTracks.h:
2774         (WebCore::MockTextTrackPrivate::create):
2775         (WebCore::MockVideoTrackPrivate::create):
2776         * platform/network/FormData.h:
2777         (WebCore::FormData::decode):
2778         * platform/network/cocoa/CookieStorageObserver.h:
2779         * platform/network/cocoa/CookieStorageObserver.mm:
2780         (WebCore::CookieStorageObserver::create):
2781         * platform/network/soup/ResourceRequestSoup.cpp:
2782         (WebCore::appendEncodedBlobItemToSoupMessageBody):
2783         (WebCore::ResourceRequest::updateSoupMessageBody const):
2784         * platform/text/hyphen/HyphenationLibHyphen.cpp:
2785         (WebCore::HyphenationDictionary::createNull):
2786         (WebCore::HyphenationDictionary::create):
2787         * platform/win/SearchPopupMenuWin.cpp:
2788         (WebCore::SearchPopupMenuWin::SearchPopupMenuWin):
2789         (WebCore::SearchPopupMenuWin::popupMenu):
2790         * platform/win/SearchPopupMenuWin.h:
2791         * rendering/RenderThemeIOS.mm:
2792         (WebCore::applyCommonButtonPaddingToStyle):
2793         (WebCore::RenderThemeIOS::paintProgressBar):
2794         (WebCore::RenderThemeIOS::adjustButtonStyle const):
2795         (WebCore::paintAttachmentIcon):
2796         * rendering/svg/SVGRenderTreeAsText.cpp:
2797         (WebCore::writeSVGResourceContainer):
2798         * storage/Storage.cpp:
2799         (WebCore::Storage::create):
2800         (WebCore::Storage::Storage):
2801         * storage/Storage.h:
2802         (WebCore::Storage::area const):
2803         * storage/StorageNamespace.h:
2804         * storage/StorageNamespaceProvider.cpp:
2805         (WebCore::StorageNamespaceProvider::localStorageArea):
2806         * storage/StorageNamespaceProvider.h:
2807         * svg/SVGElement.cpp:
2808         (WebCore::SVGElement::getPresentationAttribute):
2809         * svg/SVGFEBlendElement.cpp:
2810         (WebCore::SVGFEBlendElement::build):
2811         * svg/SVGFEColorMatrixElement.cpp:
2812         (WebCore::SVGFEColorMatrixElement::build):
2813         * svg/SVGFEComponentTransferElement.cpp:
2814         (WebCore::SVGFEComponentTransferElement::build):
2815         * svg/SVGFECompositeElement.cpp:
2816         (WebCore::SVGFECompositeElement::build):
2817         * svg/SVGFEDiffuseLightingElement.cpp:
2818         (WebCore::SVGFEDiffuseLightingElement::build):
2819         * svg/SVGFEDisplacementMapElement.cpp:
2820         (WebCore::SVGFEDisplacementMapElement::build):
2821         * svg/SVGFEDropShadowElement.cpp:
2822         (WebCore::SVGFEDropShadowElement::build):
2823         * svg/SVGFEGaussianBlurElement.cpp:
2824         (WebCore::SVGFEGaussianBlurElement::build):
2825         * svg/SVGFEMergeElement.cpp:
2826         (WebCore::SVGFEMergeElement::build):
2827         * svg/SVGFEMorphologyElement.cpp:
2828         (WebCore::SVGFEMorphologyElement::build):
2829         * svg/SVGFEOffsetElement.cpp:
2830         (WebCore::SVGFEOffsetElement::build):
2831         * svg/SVGFESpecularLightingElement.cpp:
2832         (WebCore::SVGFESpecularLightingElement::build):
2833         * svg/SVGFETileElement.cpp:
2834         (WebCore::SVGFETileElement::build):
2835         * testing/GCObservation.h:
2836         * xml/XSLTProcessor.cpp:
2837         (WebCore::XSLTProcessor::createDocumentFromSource):
2838         * xml/parser/XMLDocumentParser.cpp:
2839         (WebCore::XMLDocumentParser::parseDocumentFragment):
2840
2841 2018-12-21  Chris Dumez  <cdumez@apple.com>
2842
2843         navigator.userAgent in service workers does not reflect customUserAgent set by client
2844         https://bugs.webkit.org/show_bug.cgi?id=192951
2845
2846         Reviewed by Youenn Fablet.
2847
2848         Whenever a service worker client registers itself, also pass its effective user agent.
2849         In the network process, for each origin, we store the latest client's user agent and
2850         use it when starting the service worker.
2851
2852         * dom/Document.cpp:
2853         (WebCore::Document::setServiceWorkerConnection):
2854         * loader/DocumentLoader.cpp:
2855         (WebCore::DocumentLoader::registerTemporaryServiceWorkerClient):
2856         * workers/service/SWClientConnection.h:
2857         * workers/service/server/SWServer.cpp:
2858         (WebCore::SWServer::serviceWorkerClientUserAgent const):
2859         (WebCore::SWServer::installContextData):
2860         (WebCore::SWServer::runServiceWorker):
2861         (WebCore::SWServer::registerServiceWorkerClient):
2862         * workers/service/server/SWServer.h:
2863         * workers/service/server/SWServerToContextConnection.h:
2864         * workers/service/server/SWServerWorker.cpp:
2865         (WebCore::SWServerWorker::userAgent const):
2866         * workers/service/server/SWServerWorker.h:
2867
2868 2018-12-21  Youenn Fablet  <youenn@apple.com>
2869
2870         RTCRtpSender.setParameters() does set active parameter
2871         https://bugs.webkit.org/show_bug.cgi?id=192848
2872
2873         Reviewed by Eric Carlson.
2874
2875         Covered by updated test.
2876
2877         * Modules/mediastream/libwebrtc/LibWebRTCUtils.cpp:
2878         (WebCore::updateRTCRtpSendParameters):
2879         The routine was updating the local value, not the out parameter.
2880
2881 2018-12-21  Eric Carlson  <eric.carlson@apple.com>
2882
2883         'ended' Event doesn't fire on MediaStreamTrack when a USB camera is unplugged
2884         https://bugs.webkit.org/show_bug.cgi?id=187896
2885         <rdar://problem/42681445>
2886
2887         Reviewed by Jer Noble.
2888
2889         No new tests, tested manually.
2890
2891         * platform/mediastream/mac/AVVideoCaptureSource.h:
2892         * platform/mediastream/mac/AVVideoCaptureSource.mm:
2893         (WebCore::AVVideoCaptureSource::deviceDisconnected):
2894         (-[WebCoreAVVideoCaptureSourceObserver addNotificationObservers]):
2895         (-[WebCoreAVVideoCaptureSourceObserver removeNotificationObservers]):
2896         (-[WebCoreAVVideoCaptureSourceObserver deviceConnectedDidChange:]):
2897         * platform/mediastream/mac/CoreAudioCaptureDeviceManager.cpp:
2898         (WebCore::deviceHasInputStreams):
2899         (WebCore::isValidCaptureDevice):
2900         (WebCore::CoreAudioCaptureDeviceManager::coreAudioCaptureDevices):
2901         (WebCore::CoreAudioCaptureDeviceManager::refreshAudioCaptureDevices):
2902         (WebCore::CoreAudioCaptureDeviceManager::devicesChanged): Deleted.
2903         * platform/mediastream/mac/CoreAudioCaptureDeviceManager.h:
2904         * platform/mediastream/mac/CoreAudioCaptureSource.cpp:
2905         (WebCore::CoreAudioSharedUnit::setCaptureDevice):
2906         (WebCore::CoreAudioSharedUnit::devicesChanged):
2907         (WebCore::CoreAudioSharedUnit::startProducingData):
2908         (WebCore::CoreAudioSharedUnit::startInternal):
2909         (WebCore::CoreAudioSharedUnit::verifyIsCapturing):
2910         (WebCore::CoreAudioSharedUnit::captureFailed):
2911         (WebCore::CoreAudioCaptureSourceFactory::devicesChanged):
2912         (WebCore::CoreAudioCaptureSource::CoreAudioCaptureSource):
2913         (WebCore::CoreAudioSharedUnit::setCaptureDeviceID): Deleted.
2914         * platform/mediastream/mac/CoreAudioCaptureSource.h:
2915
2916 2018-12-20  Ryosuke Niwa  <rniwa@webkit.org>
2917
2918         REGRESSION(r239353): iOS WK1 Assertion failure in notifyChildNodeRemoved while running
2919         TestWebKitAPI.QuickLook.LegacyQuickLookContent
2920         https://bugs.webkit.org/show_bug.cgi?id=192859
2921         <rdar://problem/46887237>
2922
2923         Reviewed by Antti Koivisto.
2924
2925         After r239353, ScriptDisallowedScope::InMainThread::isScriptAllowed() may return false when the web thread
2926         is inside a delegate callback even when there is a ScriptDisallowedScope defined.
2927
2928         Replace the existign debug assertions which assert !ScriptDisallowedScope::InMainThread::isScriptAllowed()
2929         by a newly added ScriptDisallowedScope::InMainThread::hasDisallowedScope to avoid hitting this assertion.
2930
2931         Tests: TestWebKitAPI.QuickLook.LegacyQuickLookContent
2932
2933         * dom/ContainerNodeAlgorithms.cpp:
2934         (WebCore::notifyChildNodeInserted):
2935         (WebCore::notifyChildNodeRemoved):
2936         * dom/Document.cpp:
2937         (WebCore::Document::nodeChildrenWillBeRemoved):
2938         (WebCore::Document::nodeWillBeRemoved):
2939         * dom/ScriptDisallowedScope.h:
2940         (WebCore::ScriptDisallowedScope::InMainThread::hasDisallowedScope):
2941         * html/HTMLFormElement.cpp:
2942         (WebCore:: const):
2943
2944 2018-12-21  Joseph Pecoraro  <pecoraro@apple.com>
2945
2946         Update status of some WebCore features in features.json
2947         https://bugs.webkit.org/show_bug.cgi?id=192998
2948
2949         Reviewed by Tim Horton.
2950
2951         * features.json:
2952         - Variation Fonts: Supported
2953         - Conic Gradients: Supported in Preview
2954         - Web Share: Supported in Preview
2955         - <datalist>: Supported in Preview
2956         - Intersection Observers: Supported in Preview
2957
2958 2018-12-21  Zalan Bujtas  <zalan@apple.com>
2959
2960         [iOS] Using file upload can trigger a crash under RenderThemeIOS::paintFileUploadIconDecorations()
2961         https://bugs.webkit.org/show_bug.cgi?id=192357
2962         <rdar://problem/42852260>
2963
2964         Reviewed by Simon Fraser.
2965
2966         Do not try to paint the file picker when painting is disabled.
2967
2968         * rendering/RenderFileUploadControl.cpp:
2969         (WebCore::RenderFileUploadControl::paintObject):
2970
2971 2018-12-21  Jiewen Tan  <jiewen_tan@apple.com>
2972
2973         [WebAuthN] userPresence should always be true
2974         https://bugs.webkit.org/show_bug.cgi?id=192835
2975         <rdar://problem/46538788>
2976
2977         Reviewed by Brent Fulgham.
2978
2979         In the current spec as of 7 August 2018, userPresence is suggested to set to the inverse of userVerification.
2980         This doesn't comply with the CTAP spec. Details in: https://github.com/w3c/webauthn/issues/1123.
2981         After discussing with other members of the working group, we decided to make userPresence always default to true.
2982
2983         Covered by exisiting tests.
2984
2985         * Modules/webauthn/fido/DeviceRequestConverter.cpp:
2986         (fido::encodeGetAssertionRequestAsCBOR):
2987
2988 2018-12-21  Jiewen Tan  <jiewen_tan@apple.com>
2989
2990         [WebAuthN] Import an APDU coder from Chromium
2991         https://bugs.webkit.org/show_bug.cgi?id=192949
2992         <rdar://problem/46879933>
2993
2994         Reviewed by Brent Fulgham.
2995
2996         This patch imports an APDU coder from Chromium. Here is the documentation:
2997         https://fidoalliance.org/specs/fido-u2f-v1.2-ps-20170411/fido-u2f-raw-message-formats-v1.2-ps-20170411.html#u2f-message-framing
2998         APDU is a binary format to frame any U2F requests/responses into binaries. It is equivalent to CBOR in CTAP2.
2999
3000         Here is a list of files that are imported from Chromium:
3001         https://cs.chromium.org/chromium/src/components/apdu/apdu_command.cc?rcl=a2f290c10d132f53518e7f99d5635ee814ff8090
3002         https://cs.chromium.org/chromium/src/components/apdu/apdu_command.h?rcl=867b103481f6f4ccc79a69bba16c11eefac3cdb6
3003         https://cs.chromium.org/chromium/src/components/apdu/apdu_response.cc?rcl=867b103481f6f4ccc79a69bba16c11eefac3cdb6
3004         https://cs.chromium.org/chromium/src/components/apdu/apdu_response.h?rcl=867b103481f6f4ccc79a69bba16c11eefac3cdb6
3005         https://cs.chromium.org/chromium/src/components/apdu/apdu_unittest.cc?rcl=867b103481f6f4ccc79a69bba16c11eefac3cdb6
3006
3007         Covered by API tests.
3008
3009         * Modules/webauthn/apdu/ApduCommand.cpp: Added.
3010         (apdu::ApduCommand::createFromMessage):
3011         (apdu::ApduCommand::ApduCommand):
3012         (apdu::ApduCommand::getEncodedCommand const):
3013         * Modules/webauthn/apdu/ApduCommand.h: Added.
3014         * Modules/webauthn/apdu/ApduResponse.cpp: Added.
3015         (apdu::ApduResponse::createFromMessage):
3016         (apdu::ApduResponse::ApduResponse):
3017         (apdu::ApduResponse::getEncodedResponse const):
3018         * Modules/webauthn/apdu/ApduResponse.h: Added.
3019         * Sources.txt:
3020         * WebCore.xcodeproj/project.pbxproj:
3021
3022 2018-12-21  Jer Noble  <jer.noble@apple.com>
3023
3024         Convert raw CDMSessionMediaSourceAVFObjC pointer in MediaPlayerPrivateMediaSourceAVFObjC
3025         https://bugs.webkit.org/show_bug.cgi?id=192985
3026         <rdar://problem/46750743>
3027
3028         Reviewed by Eric Carlson.
3029
3030         Make m_session a RefPtr; drive-by fix: make m_mediaElement in WebKitMediaKeys a WeakPtr.
3031
3032         * Modules/encryptedmedia/legacy/WebKitMediaKeys.cpp:
3033         (WebCore::WebKitMediaKeys::setMediaElement):
3034         * Modules/encryptedmedia/legacy/WebKitMediaKeys.h:
3035         * platform/graphics/avfoundation/objc/CDMSessionMediaSourceAVFObjC.h:
3036         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
3037         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
3038         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::MediaPlayerPrivateMediaSourceAVFObjC):
3039         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setCDMSession):
3040
3041 2018-12-21  Justin Michaud  <justin_michaud@apple.com>
3042
3043         CSS variables don't work for colors in "border" property
3044         https://bugs.webkit.org/show_bug.cgi?id=192922
3045
3046         Reviewed by Simon Fraser.
3047
3048         ParseColorFunction no longer consumes anything if the color was not valid.
3049
3050         Test: css-custom-properties-api/border-variable-parsing.html
3051
3052         * css/parser/CSSPropertyParserHelpers.cpp:
3053         (WebCore::CSSPropertyParserHelpers::parseColorFunction):
3054
3055 2018-12-21  Justin Fan  <justin_fan@apple.com>
3056
3057         [WebGPU] GPUBindGroupLayout refactoring: no HashMap, and failure logging
3058         https://bugs.webkit.org/show_bug.cgi?id=192990
3059
3060         Reviewed by Myles C. Maxfield.
3061
3062         Refactor away the unnecessary HashMaps when creating MTLArgumentEncoders in GPUBindGroupLayout creation.
3063         Also update GPUBindGroupLayout::create -> tryCreate, in order to better handle Objective-C exceptions.
3064
3065         No new tests; no change in behavior.
3066
3067         * Modules/webgpu/WebGPUBindGroupLayout.cpp:
3068         (WebCore::WebGPUBindGroupLayout::create):
3069         (WebCore::WebGPUBindGroupLayout::WebGPUBindGroupLayout):
3070         * Modules/webgpu/WebGPUBindGroupLayout.h:
3071         (WebCore::WebGPUBindGroupLayout::bindGroupLayout const):
3072         * Modules/webgpu/WebGPUDevice.cpp:
3073         (WebCore::WebGPUDevice::createBindGroupLayout const):
3074         * platform/graphics/gpu/GPUBindGroupLayout.h:
3075         * platform/graphics/gpu/GPUDevice.cpp:
3076         (WebCore::GPUDevice::tryCreateBindGroupLayout const): Renamed from ::create*. Now returning a RefPtr. 
3077         (WebCore::GPUDevice::createBindGroupLayout const): Deleted.
3078         * platform/graphics/gpu/GPUDevice.h:
3079         * platform/graphics/gpu/cocoa/GPUBindGroupLayoutMetal.mm:
3080         (WebCore::appendArgumentToArray):
3081         (WebCore::newEncoder):
3082         (WebCore::GPUBindGroupLayout::tryCreate): Renamed from ::create. Now returning a RefPtr.
3083         (WebCore::GPUBindGroupLayout::GPUBindGroupLayout):
3084         (WebCore::appendArgumentToArrayInMap): Deleted.
3085         (WebCore::GPUBindGroupLayout::create): Deleted.
3086
3087         Deleted unneeded GPUBindGroupLayout.cpp:
3088         * Sources.txt:
3089         * WebCore.xcodeproj/project.pbxproj:
3090         * platform/graphics/gpu/GPUBindGroupLayout.cpp: Removed.
3091
3092 2018-12-21  Alejandro G. Castro  <alex@igalia.com>
3093
3094         [GTK][WPE] Add DeviceIdHashSaltStorage disk persistence
3095         https://bugs.webkit.org/show_bug.cgi?id=190466
3096
3097         Reviewed by Youenn Fablet.
3098
3099         Added persistency to the DeviceIdHashSaltStorage.
3100
3101         * platform/glib/FileSystemGlib.cpp:
3102         (WebCore::FileSystem::getFileSize): Implemented this function to
3103         allow sharing code with the statistics storage class.
3104         * platform/glib/KeyedDecoderGlib.cpp:
3105         (WebCore::KeyedDecoderGlib::dictionaryFromGVariant): Added a
3106         condition to control situations where the key is empty, it can
3107         happen if the user modifies the file in the disk.
3108         * Modules/indexeddb/shared/IDBResourceIdentifier.cpp: Add include
3109         to make work compilation with debug, unified builds.
3110
3111 2018-12-21  Zalan Bujtas  <zalan@apple.com>
3112
3113         Synchronous media query evaluation could destroy current Frame/FrameView.
3114         https://bugs.webkit.org/show_bug.cgi?id=192781
3115         <rdar://problem/34416793>
3116
3117         Reviewed by Chris Dumez.
3118
3119         Protect Frame and FrameView when coming back from printing and check if the current Frame/FrameView/FrameLoader objects are still valid.
3120
3121         Test: printing/print-with-media-query-destory.html
3122
3123         * loader/DocumentLoader.cpp:
3124         (WebCore::DocumentLoader::finishedLoading):
3125         * page/Frame.cpp:
3126         (WebCore::Frame::setPrinting):
3127         * page/FrameView.cpp:
3128         (WebCore::FrameView::forceLayoutForPagination):
3129         * page/PrintContext.cpp:
3130         (WebCore::PrintContext::PrintContext):
3131         (WebCore::PrintContext::computePageRects):
3132         (WebCore::PrintContext::computePageRectsWithPageSizeInternal):
3133         (WebCore::PrintContext::begin):
3134         (WebCore::PrintContext::computeAutomaticScaleFactor):
3135         (WebCore::PrintContext::spoolPage):
3136         (WebCore::PrintContext::spoolRect):
3137         (WebCore::PrintContext::end):
3138         * page/PrintContext.h:
3139         (WebCore::PrintContext::frame const): Deleted.
3140
3141 2018-12-21  Wenson Hsieh  <wenson_hsieh@apple.com>
3142
3143         Setting the file wrapper and content type of an attachment to a PDF should update its image
3144         https://bugs.webkit.org/show_bug.cgi?id=192984
3145         <rdar://problem/46798028>
3146
3147         Reviewed by Tim Horton.
3148
3149         Allow PDF data to be used to update enclosing image elements when setting the file wrapper for an attachment.
3150         Covered by a new API test: WKAttachmentTests.SetFileWrapperForPDFImageAttachment.
3151
3152         * html/HTMLAttachmentElement.cpp:
3153         (WebCore::mimeTypeIsSuitableForInlineImageAttachment):
3154         (WebCore::HTMLAttachmentElement::updateEnclosingImageWithData):
3155
3156 2018-12-21  Justin Michaud  <justin_michaud@apple.com>
3157
3158         Repeated background images with zero size should display the background color
3159         https://bugs.webkit.org/show_bug.cgi?id=192962
3160
3161         Reviewed by Antti Koivisto.
3162
3163         Test: fast/backgrounds/background-repeat-with-zero-size.html
3164
3165         * platform/LengthSize.h:
3166         (WebCore::LengthSize::isEmpty const):
3167         * rendering/RenderBoxModelObject.cpp:
3168         (WebCore::RenderBoxModelObject::paintFillLayerExtended):
3169         * rendering/style/FillLayer.h:
3170         (WebCore::FillLayer::isEmpty const):
3171
3172 2018-12-21  Manuel Rego Casasnovas  <rego@igalia.com>
3173
3174         [css-grid] Fix percentages in relative offsets for grid items
3175         https://bugs.webkit.org/show_bug.cgi?id=190492
3176
3177         Reviewed by Sergio Villar Senin.
3178
3179         The method RenderBoxModelObject::relativePositionOffset() was not considering the case of grid items,
3180         where the containing block is the grid area.
3181         The patch modifies the method so the new code uses overrideContainingBlockContentWidth|Height when required.
3182
3183         Test: imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-items-relative-offsets-002.html
3184
3185         * rendering/RenderBox.cpp: Implement the physical versions of the already existent methods.
3186         (WebCore::RenderBox::overrideContainingBlockContentWidth const):
3187         (WebCore::RenderBox::overrideContainingBlockContentHeight const):
3188         (WebCore::RenderBox::hasOverrideContainingBlockContentWidth const):
3189         (WebCore::RenderBox::hasOverrideContainingBlockContentHeight const):
3190         * rendering/RenderBox.h:
3191         * rendering/RenderBoxModelObject.cpp:
3192         (WebCore::RenderBoxModelObject::relativePositionOffset const): Modified method
3193         to take into account overrideContainingBlockContentWidth|Height for grid items.
3194         * rendering/RenderBoxModelObject.h: Added new headers for physical virtual methods
3195         that will be overridden in RenderBox.
3196         (WebCore::RenderBoxModelObject::overrideContainingBlockContentWidth const):
3197         (WebCore::RenderBoxModelObject::overrideContainingBlockContentHeight const):
3198         (WebCore::RenderBoxModelObject::hasOverrideContainingBlockContentWidth const):
3199         (WebCore::RenderBoxModelObject::hasOverrideContainingBlockContentHeight const):
3200
3201 2018-12-20  Justin Fan  <justin_fan@apple.com>
3202
3203         [WebGPU] Convert WebGPUBindGroups into MTLArgumentEncoders
3204         https://bugs.webkit.org/show_bug.cgi?id=192956
3205
3206         Reviewed by Myles Maxfield.
3207
3208         No testable behavior change. Existing tests cover possible crashing.
3209
3210         Add GPUBindGroupLayoutMetal.mm:
3211         * SourcesCocoa.txt:
3212         * WebCore.xcodeproj/project.pbxproj:
3213
3214         Flesh out GPUBindGroupLayout::create:
3215         * platform/graphics/gpu/GPUBindGroupLayout.cpp:
3216         * platform/graphics/gpu/GPUBindGroupLayout.h:
3217         * platform/graphics/gpu/GPUDevice.cpp:
3218         (WebCore::GPUDevice::createBindGroupLayout const):
3219         * platform/graphics/gpu/cocoa/GPUBindGroupLayoutMetal.mm: Added.
3220         (WebCore::appendArgumentToArrayInMap): Added.
3221         (WebCore::GPUBindGroupLayout::create):
3222         (WebCore::GPUBindGroupLayout::GPUBindGroupLayout):
3223         (WebCore::MTLDataTypeForBindingType): Added.
3224
3225 2018-12-20  Michael Catanzaro  <mcatanzaro@igalia.com>
3226
3227         Unreviewed, remove stray #pragma once added to .cpp file
3228
3229         * svg/properties/SVGAttributeOwnerProxy.cpp:
3230
3231 2018-12-20  Justin Michaud  <justin_michaud@apple.com>
3232
3233         Adding runtime-enabled attribute to Element prevents inlining property access
3234         https://bugs.webkit.org/show_bug.cgi?id=192901
3235
3236         Add a call to flattenDictionaryObject after disabling runtime-enabled attributes.
3237
3238         Reviewed by Ryosuke Niwa.
3239
3240         * bindings/scripts/CodeGeneratorJS.pm:
3241         (GenerateImplementation):
3242         * bindings/scripts/test/JS/JSTestEnabledBySetting.cpp:
3243         (WebCore::JSTestEnabledBySettingPrototype::finishCreation):
3244         * bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp:
3245         (WebCore::JSTestGenerateIsReachablePrototype::finishCreation):
3246         * bindings/scripts/test/JS/JSTestNode.cpp:
3247         (WebCore::JSTestNodePrototype::finishCreation):
3248         * bindings/scripts/test/JS/JSTestObj.cpp:
3249         (WebCore::JSTestObjPrototype::finishCreation):
3250
3251 2018-12-20  Chris Dumez  <cdumez@apple.com>
3252
3253         Use Optional::hasValue() instead of Optional::has_value()
3254         https://bugs.webkit.org/show_bug.cgi?id=192948
3255
3256         Reviewed by Tim Horton.
3257
3258         * bindings/js/DOMPromiseProxy.h:
3259         (WebCore::DOMPromiseProxy<IDLType>::isFulfilled const):
3260         (WebCore::DOMPromiseProxy<IDLVoid>::isFulfilled const):
3261         (WebCore::DOMPromiseProxyWithResolveCallback<IDLType>::isFulfilled const):
3262         * dom/DataTransferItemList.h:
3263         (WebCore::DataTransferItemList::hasItems const):
3264         * dom/EventTarget.cpp:
3265         (WebCore::EventTarget::addEventListener):
3266         * html/HTMLMediaElement.cpp:
3267         (WebCore::HTMLMediaElement::captionDisplayMode):
3268         * platform/graphics/MediaPlayer.cpp:
3269         (WebCore::MediaPlayer::wouldTaintOrigin const):
3270         * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
3271         (WebCore::AppendPipeline::parseDemuxerSrcPadCaps):
3272         * platform/graphics/gstreamer/mse/MediaPlayerPrivateGStreamerMSE.cpp:
3273         (WebCore::MediaPlayerPrivateGStreamerMSE::trackDetected):
3274         * platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.cpp:
3275         (webKitMediaSrcUpdatePresentationSize):
3276         * platform/mac/NSScrollerImpDetails.mm:
3277         (WebCore::ScrollerStyle::recommendedScrollerStyle):
3278         * rendering/RenderListItem.cpp:
3279         (WebCore::RenderListItem::setExplicitValue):
3280
3281 2018-12-20  Chris Dumez  <cdumez@apple.com>
3282
3283         Move HTTPS_UPGRADE code behind a runtime flag, off by default
3284         https://bugs.webkit.org/show_bug.cgi?id=192937
3285
3286         Reviewed by Youenn Fablet.
3287
3288         Move HTTPS_UPGRADE code behind a runtime flag, off by default and drop the build time flag.
3289
3290         * page/Settings.yaml:
3291
3292 2018-12-20  Youenn Fablet  <youenn@apple.com>
3293
3294         Remove custom constructors of ReadableStreamDefaultReader and ReadableStreamBYOBReader
3295         https://bugs.webkit.org/show_bug.cgi?id=192838
3296
3297         Reviewed by Chris Dumez.
3298
3299         Generate constructor code in case of a Private but not Public constructor.
3300         Make sure this is correctly exposed in global objects.
3301         Add JS built-in constructor implementations for those two objects.
3302
3303         Also add JS built-in constructors for controller and byob request.
3304         To keep existing behavior, JS built-ins calling these constructors need to pass
3305         an additional parameter that allows making the difference between a JS builtin caller or a JS caller.
3306         In the latter case, the constructor will throw.
3307
3308         Covered by existing tests, no observable change of behavior.
3309
3310         * Modules/streams/ReadableByteStreamController.idl:
3311         * Modules/streams/ReadableByteStreamController.js:
3312         (initializeReadableByteStreamController):
3313         (getter.byobRequest):
3314         * Modules/streams/ReadableByteStreamInternals.js:
3315         (privateInitializeReadableByteStreamController): Deleted.
3316         (privateInitializeReadableStreamBYOBRequest): Deleted.
3317         * Modules/streams/ReadableStream.js:
3318         (initializeReadableStream):
3319         * Modules/streams/ReadableStreamBYOBReader.js:
3320         (initializeReadableStreamBYOBReader):
3321         * Modules/streams/ReadableStreamBYOBRequest.idl:
3322         * Modules/streams/ReadableStreamBYOBRequest.js:
3323         (initializeReadableStreamBYOBRequest):
3324         * Modules/streams/ReadableStreamDefaultController.idl:
3325         * Modules/streams/ReadableStreamDefaultController.js:
3326         (initializeReadableStreamDefaultController):
3327         (enqueue):
3328         * Modules/streams/ReadableStreamDefaultReader.js:
3329         (initializeReadableStreamDefaultReader):
3330         * Modules/streams/ReadableStreamInternals.js:
3331         (readableStreamDefaultControllerError): Deleted.
3332         * Sources.txt:
3333         * UnifiedSources-input.xcfilelist:
3334         * WebCore.xcodeproj/project.pbxproj:
3335         * bindings/js/JSDOMBuiltinConstructor.h:
3336         * bindings/js/JSDOMGlobalObject.cpp:
3337         (WebCore::JSDOMGlobalObject::addBuiltinGlobals):
3338         * bindings/js/JSReadableStreamPrivateConstructors.cpp: Removed.
3339         * bindings/js/JSReadableStreamPrivateConstructors.h: Removed.
3340         * bindings/scripts/CodeGeneratorJS.pm:
3341         (GeneratePropertiesHashTable):
3342         * bindings/scripts/preprocess-idls.pl:
3343         (shouldExposeInterface):
3344
3345 2018-12-20  Jiewen Tan  <jiewen_tan@apple.com>
3346
3347         [WebAuthN] Remove hash from Client Data
3348         https://bugs.webkit.org/show_bug.cgi?id=192727
3349         <rdar://problem/46746673>
3350
3351         Reviewed by Brent Fulgham.
3352
3353         The hash algorithm for hashing the client data is enforced to SHA_256 in the latest spec:
3354         https://www.w3.org/TR/webauthn/#sec-client-data. Therefore, we should remove it.
3355
3356         Covered by existing tests.
3357
3358         * Modules/webauthn/AuthenticatorCoordinator.cpp:
3359         (WebCore::AuthenticatorCoordinatorInternal::produceClientDataJson):
3360
3361 2018-12-20  Jiewen Tan  <jiewen_tan@apple.com>
3362
3363         [WebAuthN] Add a runtime flag for local authenticator
3364         https://bugs.webkit.org/show_bug.cgi?id=192792
3365         <rdar://problem/46798738>
3366
3367         Reviewed by Brent Fulgham.
3368
3369         No tests.
3370
3371         This patch adds a runtime flag for local authenticator and removes ways to
3372         set the runtime flag for web authentication in LegacyWebKit.
3373
3374         * page/RuntimeEnabledFeatures.h:
3375         (WebCore::RuntimeEnabledFeatures::setWebAuthenticationLocalAuthenticatorEnabled):
3376         (WebCore::RuntimeEnabledFeatures::webAuthenticationLocalAuthenticatorEnabled const):
3377
3378 2018-12-20  Jeremy Jones  <jeremyj@apple.com>
3379
3380         Pointer lock causes abandoned documents
3381         https://bugs.webkit.org/show_bug.cgi?id=188727
3382         rdar://problem/44248197
3383         
3384         Reviewed by Simon Fraser.
3385