Reproducible ASSERTion failure when toggling layer borders with find-in-page up
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2018-12-17  Zalan Bujtas  <zalan@apple.com>
2
3         Reproducible ASSERTion failure when toggling layer borders with find-in-page up
4         https://bugs.webkit.org/show_bug.cgi?id=192762
5         <rdar://problem/46676873>
6
7         Reviewed by Simon Fraser.
8
9         DocumentMarkerController::markersFor() should take a reference instead of a Node*.
10
11         Test: editing/document-marker-null-check.html
12
13         * dom/DocumentMarkerController.cpp:
14         (DocumentMarkerController::hasMarkers):
15         * dom/DocumentMarkerController.h:
16         * editing/AlternativeTextController.cpp:
17         (WebCore::AlternativeTextController::respondToChangedSelection):
18         * editing/Editor.cpp:
19         (WebCore::Editor::selectionStartHasMarkerFor const):
20         * rendering/InlineTextBox.cpp:
21         (WebCore::InlineTextBox::collectMarkedTextsForDocumentMarkers const):
22         * rendering/RenderReplaced.cpp:
23         (WebCore::RenderReplaced::paint):
24         * rendering/RenderText.cpp:
25         (WebCore::RenderText::draggedContentRangesBetweenOffsets const):
26         * rendering/SimpleLineLayout.cpp:
27         (WebCore::SimpleLineLayout::canUseForWithReason):
28         * testing/Internals.cpp:
29         (WebCore::Internals::markerCountForNode):
30
31 2018-12-17  Commit Queue  <commit-queue@webkit.org>
32
33         Unreviewed, rolling out r239265 and r239274.
34         https://bugs.webkit.org/show_bug.cgi?id=192765
35
36         unorm_normalize is deprecated, and broke an internal build
37         (Requested by Truitt on #webkit).
38
39         Reverted changesets:
40
41         "[GTK][WPE] Need a function to convert internal URI to display
42         ("pretty") URI"
43         https://bugs.webkit.org/show_bug.cgi?id=174816
44         https://trac.webkit.org/changeset/239265
45
46         "Fix the Apple Internal Mac build with a newer SDK"
47         https://trac.webkit.org/changeset/239274
48
49 2018-12-17  Daniel Bates  <dabates@apple.com>
50
51         [iOS] Remove -[WebEvent initWithKeyEventType:...:characterSet:]
52         https://bugs.webkit.org/show_bug.cgi?id=192633
53
54         Reviewed by Wenson Hsieh.
55
56         UIKit has long adopted the newer -[WebEvent initWithKeyEventType:] initializer that takes an
57         input manager hint. We no longer need to keep the variant -[WebEvent initWithKeyEventType:...:characterSet:]
58         for binary compatibility.
59
60         * platform/ios/WebEvent.h:
61         * platform/ios/WebEvent.mm:
62         (-[WebEvent initWithKeyEventType:timeStamp:characters:charactersIgnoringModifiers:modifiers:isRepeating:withFlags:keyCode:isTabKey:characterSet:]): Deleted.
63
64 2018-12-17  Matt Lewis  <jlewis3@apple.com>
65
66         Unreviewed, rolling out r239254.
67
68         This broke the Windows 10 Debug build
69
70         Reverted changeset:
71
72         "Replace many uses of String::format with more type-safe
73         alternatives"
74         https://bugs.webkit.org/show_bug.cgi?id=192742
75         https://trac.webkit.org/changeset/239254
76
77 2018-12-17  Antoine Quint  <graouts@apple.com>
78
79         [Web Animations] Remove the redundant m_scheduledMicrotask from WebAnimation
80         https://bugs.webkit.org/show_bug.cgi?id=192758
81
82         Reviewed by Dean Jackson.
83
84         We tracked whether we had a pending microtask twice so we remove the m_scheduledMicrotask flag as m_finishNotificationStepsMicrotaskPending
85         gives us enough information as it is. Additionally, we remove the scheduleMicrotaskIfNeeded() and performMicrotask() functions since there is
86         less bookkeeping to perform.
87
88         No new test since there is no user-observable change.
89
90         * animation/WebAnimation.cpp:
91         (WebCore::WebAnimation::updateFinishedState):
92         (WebCore::WebAnimation::scheduleMicrotaskIfNeeded): Deleted.
93         (WebCore::WebAnimation::performMicrotask): Deleted.
94         * animation/WebAnimation.h:
95
96 2018-12-17  Antoine Quint  <graouts@apple.com>
97
98         [Web Animations] Ensure we don't update an animation's finished state twice when updating animations
99         https://bugs.webkit.org/show_bug.cgi?id=192757
100
101         Reviewed by Dean Jackson.
102
103         When animations are udpated and DocumentTimeline::updateAnimationsAndSendEvents() is called, we used to update an animation's finished state
104         twice since we'd do it once when calling tick() and once again when calling resolve() in the ensuing style invalidation. We now keep track of
105         whether we've already updated an animation's finished state during animation update in the call to tick() and avoid updating in the immediate
106         next call to resolve(), unless any of the timing properties have changed in the meantime.
107
108         No new test since there is no user-observable change.
109
110         * animation/WebAnimation.cpp:
111         (WebCore::WebAnimation::timingDidChange):
112         (WebCore::WebAnimation::tick):
113         (WebCore::WebAnimation::resolve):
114         * animation/WebAnimation.h:
115
116 2018-12-17  Simon Fraser  <simon.fraser@apple.com>
117
118         REGRESSION (r233268): Elements animated in from offscreen sometimes don't display
119         https://bugs.webkit.org/show_bug.cgi?id=192725
120         rdar://problem/46011418
121
122         Reviewed by Antoine Quint.
123
124         There were two problems with backing store attachment and animation.
125         
126         First, animations are an input into the "backing store attached" logic, so when they change
127         we should set the CoverageRectChanged bit on GraphicsLayerCA.
128         
129         Secondly, when an ancestor has unknown animation extent, all its descendants need to
130         get backing store, so we need to set childCommitState.ancestorWithTransformAnimationIntersectsCoverageRect when
131         the current layer has no animation extent.
132
133         Tests: compositing/backing/animate-into-view-with-descendant.html
134                compositing/backing/animate-into-view.html
135
136         * platform/graphics/ca/GraphicsLayerCA.cpp:
137         (WebCore::GraphicsLayerCA::addAnimation):
138         (WebCore::GraphicsLayerCA::removeAnimation):
139         (WebCore::GraphicsLayerCA::recursiveCommitChanges):
140
141 2018-12-17  Zalan Bujtas  <zalan@apple.com>
142
143         [LFC][BFC][MarginCollapsing] Unify margin collapse function naming
144         https://bugs.webkit.org/show_bug.cgi?id=192747
145
146         Reviewed by Antti Koivisto.
147
148         Rename some margin collapse getters.
149
150         * layout/blockformatting/BlockFormattingContext.h:
151         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
152         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin):
153         * layout/blockformatting/BlockMarginCollapse.cpp:
154         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::computedNonCollapsedMarginBefore):
155         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::computedNonCollapsedMarginAfter):
156         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::nonCollapsedMarginBefore):
157         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::nonCollapsedMarginAfter):
158         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::collapsedMarginBeforeFromFirstChild):
159         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::collapsedMarginAfterFromLastChild):
160         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::marginBeforeCollapsesWithParentMarginAfter):
161         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::marginBeforeCollapsesWithParentMarginBefore):
162         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::marginAfterCollapsesWithParentMarginAfter):
163         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::marginBeforeCollapsesWithPreviousSibling):
164         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::marginAfterCollapsesWithNextSibling):
165         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::marginsCollapseThrough):
166         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::marginBefore):
167         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::marginAfter):
168         (WebCore::Layout::isMarginBeforeCollapsedWithSibling): Deleted.
169         (WebCore::Layout::isMarginAfterCollapsedWithSibling): Deleted.
170         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::isMarginBeforeCollapsedWithParent): Deleted.
171         (WebCore::Layout::isMarginAfterCollapsedThrough): Deleted.
172         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::isMarginAfterCollapsedWithParent): Deleted.
173         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::isMarginBeforeCollapsedWithParentMarginAfter): Deleted.
174
175 2018-12-17  David Kilzer  <ddkilzer@apple.com>
176
177         clang-tidy: loop variable is copied but only used as const reference in WebCore, WebKit, Tools
178         <https://webkit.org/b/192751>
179         <rdar://problem/46771623>
180
181         Reviewed by Daniel Bates.
182
183         Change loop variables to const references to avoid unnecessary
184         copies.
185
186         * Modules/indexeddb/server/MemoryBackingStoreTransaction.cpp:
187         (WebCore::IDBServer::MemoryBackingStoreTransaction::abort):
188         * Modules/indexeddb/server/MemoryObjectStore.cpp:
189         (WebCore::IDBServer::MemoryObjectStore::populateIndexWithExistingRecords):
190         * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
191         (WebCore::IDBServer::UniqueIDBDatabase::maybeNotifyConnectionsOfVersionChange):
192         * Modules/indexeddb/server/UniqueIDBDatabaseTransaction.cpp:
193         (WebCore::IDBServer::UniqueIDBDatabaseTransaction::objectStoreIdentifiers):
194         * Modules/indexeddb/shared/IDBDatabaseInfo.cpp:
195         (WebCore::IDBDatabaseInfo::IDBDatabaseInfo):
196         (WebCore::IDBDatabaseInfo::loggingString const):
197         * Modules/mediasource/SourceBuffer.cpp:
198         (WebCore::removeSamplesFromTrackBuffer):
199         * accessibility/AccessibilityRenderObject.cpp:
200         (WebCore::AccessibilityRenderObject::targetElementForActiveDescendant const):
201         * accessibility/AccessibilityTableRow.cpp:
202         (WebCore::AccessibilityTableRow::headerObject):
203         * animation/KeyframeEffect.cpp:
204         (WebCore::KeyframeEffect::computedNeedsForcedLayout):
205         * crypto/keys/CryptoKeyRSA.cpp:
206         (WebCore::CryptoKeyRSA::importJwk):
207         (WebCore::CryptoKeyRSA::exportJwk const):
208         * css/CSSComputedStyleDeclaration.cpp:
209         (WebCore::OrderedNamedLinesCollector::appendLines const):
210         * dom/DataTransfer.cpp:
211         (WebCore::readURLsFromPasteboardAsString):
212         * dom/TreeScope.cpp:
213         (WebCore::TreeScope::elementsFromPoint):
214         * html/track/WebVTTParser.cpp:
215         (WebCore::WebVTTParser::checkAndStoreRegion):
216         * inspector/agents/InspectorTimelineAgent.cpp:
217         (WebCore::InspectorTimelineAgent::setInstruments):
218         * page/Page.cpp:
219         (WebCore::Page::updateIntersectionObservations):
220         * page/TextIndicator.cpp:
221         (WebCore::estimatedBackgroundColorForRange):
222         * page/animation/KeyframeAnimation.cpp:
223         (WebCore::KeyframeAnimation::computeLayoutDependency):
224         * platform/graphics/DisplayRefreshMonitorManager.cpp:
225         (WebCore::DisplayRefreshMonitorManager::displayWasUpdated):
226         * platform/graphics/ca/GraphicsLayerCA.cpp:
227         (WebCore::GraphicsLayerCA::moveOrCopyAnimations):
228         (WebCore::GraphicsLayerCA::updateAnimations):
229         (WebCore::GraphicsLayerCA::isRunningTransformAnimation const):
230         * platform/graphics/mac/ImageMac.mm:
231         (WebCore::BitmapImage::tiffRepresentation):
232         * rendering/HitTestResult.cpp:
233         (WebCore::HitTestResult::append):
234         * testing/Internals.cpp:
235         (WebCore::Internals::acceleratedAnimationsForElement):
236
237 2018-12-17  Ms2ger  <Ms2ger@igalia.com>
238
239         [GTK][WPE] Need a function to convert internal URI to display ("pretty") URI
240         https://bugs.webkit.org/show_bug.cgi?id=174816
241
242         Reviewed by Michael Catanzaro.
243
244         Tests: enabled fast/url/user-visible/.
245
246         * testing/Internals.cpp:
247         (WebCore::Internals::userVisibleString): Enable method on all platforms.
248
249 2018-12-15  Yusuke Suzuki  <yusukesuzuki@slowstart.org>
250
251         Null pointer dereference in JSC::WriteBarrierBase()
252         https://bugs.webkit.org/show_bug.cgi?id=191252
253
254         Reviewed by Keith Miller.
255
256         * bindings/js/JSCustomElementRegistryCustom.cpp:
257         (WebCore::JSCustomElementRegistry::whenDefined):
258         * bindings/js/JSDOMPromiseDeferred.cpp:
259         (WebCore::createDeferredPromise):
260         * bindings/js/JSDOMPromiseDeferred.h:
261         (WebCore::DeferredPromise::create):
262         (WebCore::callPromiseFunction):
263         * bindings/js/JSDOMWindowBase.cpp:
264         (WebCore::JSDOMWindowBase::moduleLoaderFetch):
265         (WebCore::JSDOMWindowBase::moduleLoaderImportModule):
266         * bindings/js/ScriptModuleLoader.cpp:
267         (WebCore::ScriptModuleLoader::fetch):
268         (WebCore::rejectPromise):
269
270 2018-12-15  Darin Adler  <darin@apple.com>
271
272         Use warning-ignoring macros more consistently and simply
273         https://bugs.webkit.org/show_bug.cgi?id=192743
274
275         Reviewed by Mark Lam.
276
277         * bridge/objc/WebScriptObject.mm: Use IGNORE_WARNINGS_BEGIN rather than
278         IGNORE_CLANG_WARNINGS_BEGIN here. There is no need to compile Objective-C++
279         files like this one with non-clang compilers, and no need to worry about
280         them when choosing the macro.
281
282         * crypto/mac/CryptoKeyRSAMac.cpp:
283         (WebCore::getPublicKeyComponents): Use ALLOW_DEPRECATED_DECLARATIONS_BEGIN/END.
284
285         * css/makeprop.pl: Use IGNORE_WARNINGS_BEGIN/END, obviating the need for
286         the "unknown-pragmas" trick, which the macro should take care of.
287         * css/makevalues.pl: Ditto.
288         * platform/ColorData.gperf: Ditto.
289
290         * platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.mm:
291         (WebCore::CDMSessionAVStreamSession::update): Use IGNORE_WARNINGS_BEGIN/END
292         (see rationale above for Objective-C++).
293
294         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
295         (WebCore::MediaPlayerPrivateAVFoundationObjC::videoPlaybackQualityMetrics): Use
296         ALLOW_NEW_API_WITHOUT_GUARDS_BEGIN/END.
297         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
298         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::videoPlaybackQualityMetrics): Ditto.
299
300         * platform/ios/DragImageIOS.mm: Use IGNORE_WARNINGS_BEGIN/END
301         (see rationale above for Objective-C++).
302
303         * platform/ios/VideoFullscreenInterfaceAVKit.mm:
304         (-[WebAVPlayerViewController setWebKitOverrideRouteSharingPolicy:routingContextUID:]):
305         Use ALLOW_NEW_API_WITHOUT_GUARDS_BEGIN/END.
306
307         * platform/mac/WebPlaybackControlsManager.mm: Use IGNORE_WARNINGS_BEGIN/END
308         (see rationale above for Objective-C++).
309
310         * platform/network/cocoa/ResourceResponseCocoa.mm:
311         (WebCore::ResourceResponse::platformCertificateInfo const): Use
312         ALLOW_DEPRECATED_DECLARATIONS_BEGIN/END.
313
314 2018-12-15  Darin Adler  <darin@apple.com>
315
316         Replace many uses of String::format with more type-safe alternatives
317         https://bugs.webkit.org/show_bug.cgi?id=192742
318
319         Reviewed by Mark Lam.
320
321         A while back, String::format was more efficient than string concatenation,
322         but that is no longer true, and we should prefer String::number, makeString,
323         or concatenation with the "+" operator to String::format for new code.
324
325         This is not as good for programmers who are fond of printf formatting
326         style, and in some cases it's a little harder to read the strings
327         interspersed with variables rather than a format string, but it's better
328         in a few ways:
329
330         - more efficient (I didn't measure the difference, but it's definitely
331           slower to use String::Format which calls vsnprintf twice than to use
332           the WTF code)
333         - works in a type-safe way without a need to use a format specifier such
334           as "%" PRIu64 or "%tu" making it much easier to avoid problems due to
335           subtle differences between platforms
336         - allows us to use StringView in some cases to sidestep the need to
337           allocate temporary WTF::String objects
338         - does not require converting each WTF::String to a C string, allowing
339           us to remove many cases of ".utf8().data()" and similar expressions,
340           eliminating the allocation of temporary WTF::CString objects
341
342         This patch covers a batch of easiest-to-convert call sites.
343         Later patches will allow us to deprecate or remove String::format.
344
345         * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
346         (WebCore::IDBServer::SQLiteIDBBackingStore::addRecord): Use makeString.
347         * Modules/indexeddb/shared/IDBCursorInfo.cpp:
348         (WebCore::IDBCursorInfo::loggingString const): Ditto.
349         * Modules/indexeddb/shared/IDBGetAllRecordsData.cpp:
350         (WebCore::IDBGetAllRecordsData::loggingString const): Ditto.
351         * Modules/indexeddb/shared/IDBGetRecordData.cpp:
352         (WebCore::IDBGetRecordData::loggingString const): Ditto.
353         * Modules/indexeddb/shared/IDBIndexInfo.cpp:
354         (WebCore::IDBIndexInfo::loggingString const): Ditto.
355         (WebCore::IDBIndexInfo::condensedLoggingString const): Ditto.
356         * Modules/indexeddb/shared/IDBIterateCursorData.cpp:
357         (WebCore::IDBIterateCursorData::loggingString const): Ditto.
358         * Modules/indexeddb/shared/IDBObjectStoreInfo.cpp:
359         (WebCore::IDBObjectStoreInfo::condensedLoggingString const): Ditto.
360         * Modules/indexeddb/shared/IDBResourceIdentifier.cpp:
361         (WebCore::IDBResourceIdentifier::loggingString const): Ditto.
362         * Modules/webdatabase/Database.cpp:
363         (WebCore::formatErrorMessage): Ditto.
364         * Modules/webdatabase/SQLError.h:
365         (WebCore::SQLError::create): Ditto.
366
367         * bindings/scripts/CodeGeneratorJS.pm:
368         (GenerateImplementation): Use makeString.
369
370         * bindings/scripts/test/JS/JSInterfaceName.cpp:
371         * bindings/scripts/test/JS/JSMapLike.cpp:
372         * bindings/scripts/test/JS/JSReadOnlyMapLike.cpp:
373         * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
374         * bindings/scripts/test/JS/JSTestCEReactions.cpp:
375         * bindings/scripts/test/JS/JSTestCEReactionsStringifier.cpp:
376         * bindings/scripts/test/JS/JSTestCallTracer.cpp:
377         * bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.cpp:
378         * bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.cpp:
379         * bindings/scripts/test/JS/JSTestDOMJIT.cpp:
380         * bindings/scripts/test/JS/JSTestEnabledBySetting.cpp:
381         * bindings/scripts/test/JS/JSTestEventConstructor.cpp:
382         * bindings/scripts/test/JS/JSTestEventTarget.cpp:
383         * bindings/scripts/test/JS/JSTestException.cpp:
384         * bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp:
385         * bindings/scripts/test/JS/JSTestGlobalObject.cpp:
386         * bindings/scripts/test/JS/JSTestIndexedSetterNoIdentifier.cpp:
387         * bindings/scripts/test/JS/JSTestIndexedSetterThrowingException.cpp:
388         * bindings/scripts/test/JS/JSTestIndexedSetterWithIdentifier.cpp:
389         * bindings/scripts/test/JS/JSTestInterface.cpp:
390         * bindings/scripts/test/JS/JSTestInterfaceLeadingUnderscore.cpp:
391         * bindings/scripts/test/JS/JSTestIterable.cpp:
392         * bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp:
393         * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterNoIdentifier.cpp:
394         * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterThrowingException.cpp:
395         * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterWithIdentifier.cpp:
396         * bindings/scripts/test/JS/JSTestNamedConstructor.cpp:
397         * bindings/scripts/test/JS/JSTestNamedDeleterNoIdentifier.cpp:
398         * bindings/scripts/test/JS/JSTestNamedDeleterThrowingException.cpp:
399         * bindings/scripts/test/JS/JSTestNamedDeleterWithIdentifier.cpp:
400         * bindings/scripts/test/JS/JSTestNamedDeleterWithIndexedGetter.cpp:
401         * bindings/scripts/test/JS/JSTestNamedGetterCallWith.cpp:
402         * bindings/scripts/test/JS/JSTestNamedGetterNoIdentifier.cpp:
403         * bindings/scripts/test/JS/JSTestNamedGetterWithIdentifier.cpp:
404         * bindings/scripts/test/JS/JSTestNamedSetterNoIdentifier.cpp:
405         * bindings/scripts/test/JS/JSTestNamedSetterThrowingException.cpp:
406         * bindings/scripts/test/JS/JSTestNamedSetterWithIdentifier.cpp:
407         * bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetter.cpp:
408         * bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetterAndSetter.cpp:
409         * bindings/scripts/test/JS/JSTestNamedSetterWithOverrideBuiltins.cpp:
410         * bindings/scripts/test/JS/JSTestNamedSetterWithUnforgableProperties.cpp:
411         * bindings/scripts/test/JS/JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins.cpp:
412         * bindings/scripts/test/JS/JSTestNode.cpp:
413         * bindings/scripts/test/JS/JSTestObj.cpp:
414         * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
415         * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.cpp:
416         * bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp:
417         * bindings/scripts/test/JS/JSTestPluginInterface.cpp:
418         * bindings/scripts/test/JS/JSTestPromiseRejectionEvent.cpp:
419         * bindings/scripts/test/JS/JSTestSerialization.cpp:
420         * bindings/scripts/test/JS/JSTestSerializationIndirectInheritance.cpp:
421         * bindings/scripts/test/JS/JSTestSerializationInherit.cpp:
422         * bindings/scripts/test/JS/JSTestSerializationInheritFinal.cpp:
423         * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
424         * bindings/scripts/test/JS/JSTestStringifier.cpp:
425         * bindings/scripts/test/JS/JSTestStringifierAnonymousOperation.cpp:
426         * bindings/scripts/test/JS/JSTestStringifierNamedOperation.cpp:
427         * bindings/scripts/test/JS/JSTestStringifierOperationImplementedAs.cpp:
428         * bindings/scripts/test/JS/JSTestStringifierOperationNamedToString.cpp:
429         * bindings/scripts/test/JS/JSTestStringifierReadOnlyAttribute.cpp:
430         * bindings/scripts/test/JS/JSTestStringifierReadWriteAttribute.cpp:
431         * bindings/scripts/test/JS/JSTestTypedefs.cpp:
432         Updated expected results.
433 :
434         * css/parser/CSSPropertyParserHelpers.cpp:
435         (WebCore::CSSPropertyParserHelpers::parseHexColor): Use String::number
436         and makeString.
437
438         * html/HTMLSelectElement.cpp:
439         (WebCore::HTMLSelectElement::setLength): Use makeString.
440         * html/ImageDocument.cpp:
441         (WebCore::ImageDocument::imageUpdated): Ditto.
442         * html/parser/XSSAuditor.cpp:
443         (WebCore::XSSAuditor::init): Ditto.
444         * inspector/InspectorFrontendClientLocal.cpp:
445         (WebCore::InspectorFrontendClientLocal::setDockingUnavailable): Ditto.
446         (WebCore::InspectorFrontendClientLocal::setAttachedWindow): Ditto.
447         (WebCore::InspectorFrontendClientLocal::setDebuggingEnabled): Ditto.
448         (WebCore::InspectorFrontendClientLocal::setTimelineProfilingEnabled): Ditto.
449         (WebCore::InspectorFrontendClientLocal::showMainResourceForFrame): Ditto.
450         * inspector/agents/InspectorCSSAgent.cpp: Ditto.
451         * inspector/agents/InspectorIndexedDBAgent.cpp: Ditto.
452         * page/MemoryRelease.cpp:
453         (WebCore::logMemoryStatisticsAtTimeOfDeath): Ditto.
454
455         * page/cocoa/ResourceUsageOverlayCocoa.mm:
456         (WebCore::formatByteNumber): Use String::number.
457         (WebCore::ResourceUsageOverlay::platformDraw): Use string concatenation.
458
459         * page/cocoa/ResourceUsageThreadCocoa.mm:
460         (WebCore::logFootprintComparison): Use makeString.
461         * platform/animation/TimingFunction.cpp:
462         (WebCore::TimingFunction::cssText const): Ditto.
463
464         * platform/graphics/avfoundation/AVTrackPrivateAVFObjCImpl.mm:
465         (WebCore::AVTrackPrivateAVFObjCImpl::id const): Use AtomicString::number.
466         * platform/graphics/avfoundation/objc/MediaSampleAVFObjC.h:
467         (WebCore::MediaSampleAVFObjC::MediaSampleAVFObjC): Ditto.
468
469         * platform/graphics/ca/GraphicsLayerCA.cpp:
470         (WebCore::GraphicsLayerCA::setContentsToSolidColor): Use makeString.
471         (WebCore::GraphicsLayerCA::updateContentsImage): Ditto.
472         (WebCore::GraphicsLayerCA::updateContentsRects): Ditto.
473         (WebCore::GraphicsLayerCA::createTransformAnimationsFromKeyframes): Ditto.
474         * platform/mock/MockRealtimeVideoSource.cpp:
475         (WebCore::MockRealtimeVideoSource::drawText): Ditto.
476
477         * platform/mock/mediasource/MockSourceBufferPrivate.cpp: Use String::number.
478
479         * platform/network/ParsedContentRange.cpp:
480         (WebCore::ParsedContentRange::headerValue const): Use makeString.
481
482         * platform/network/cf/NetworkStorageSessionCFNet.cpp: Removed some unnecessary
483         compiler conditionals and reorganized the start/stop of namespaces.
484         (WebCore::NetworkStorageSession::switchToNewTestingSession): Use makeString.
485
486         * platform/sql/SQLiteDatabase.cpp:
487         (WebCore::unauthorizedSQLFunction): Use makeString.
488         * rendering/RenderLayerCompositor.cpp:
489         (WebCore::RenderLayerCompositor::logLayerInfo): Ditto.
490         * workers/service/server/RegistrationDatabase.cpp:
491         (WebCore::RegistrationDatabase::ensureValidRecordsTable): Ditto.
492         (WebCore::RegistrationDatabase::importRecords): Ditto.
493
494 2018-12-15  Youenn Fablet  <youenn@apple.com>
495
496         Make RTCRtpSender.setParameters to activate specific encodings
497         https://bugs.webkit.org/show_bug.cgi?id=192732
498
499         Reviewed by Eric Carlson.
500
501         The conversion between libwebrtc and WebCore is lossy for send parameters.
502         Libwebrtc checking the differences of values, call to setParameters will often fail.
503
504         Given some parameters cannot be exposed, the sender backend keeps the
505         current set of parameters when gathered and reuses them when parameters are set.
506
507         For encodings, we only change activate/maxBitRate/maxFrameRate as
508         these are the most important parameters to be able to modify.
509
510         Covered by added tests in webrtc/video.html.
511
512         * Modules/mediastream/libwebrtc/LibWebRTCRtpSenderBackend.cpp:
513         (WebCore::LibWebRTCRtpSenderBackend::getParameters const):
514         (WebCore::LibWebRTCRtpSenderBackend::setParameters):
515         * Modules/mediastream/libwebrtc/LibWebRTCRtpSenderBackend.h:
516         * Modules/mediastream/libwebrtc/LibWebRTCUtils.cpp:
517         (WebCore::fromRTCRtpSendParameters):
518         (WebCore::fromRTCEncodingParameters): Deleted.
519         * Modules/mediastream/libwebrtc/LibWebRTCUtils.h:
520
521 2018-12-14  Joseph Pecoraro  <pecoraro@apple.com>
522
523         Web Inspector: Avoid creating and evaluating in the InspectorOverlay page on iOS as it is unused
524         https://bugs.webkit.org/show_bug.cgi?id=192724
525         <rdar://problem/46745911>
526
527         Reviewed by Devin Rousso.
528
529         iOS never installs the InspectorOverlay page as a page overlay.
530         It also uses its own node highlighting painting. Avoid any work
531         and resources associated with the overlay page for iOS.
532
533         * inspector/InspectorOverlay.cpp:
534         (WebCore::InspectorOverlay::paint):
535         (WebCore::InspectorOverlay::update):
536         (WebCore::InspectorOverlay::overlayPage):
537         (WebCore::evaluateCommandInOverlay):
538
539 2018-12-14  Youenn Fablet  <youenn@apple.com>
540
541         MediaRecorderPrivateAVFImpl should have a Ref<MediaRecorderPrivateWriter> as member
542         https://bugs.webkit.org/show_bug.cgi?id=192720
543
544         Reviewed by Eric Carlson.
545
546         Make sure that MediaRecorderPrivateAVFImpl takes a Ref<MediaRecorderPrivateWriter> as member,
547         as the latter is a ref counted object.
548         Made some refactoring to return early in case of error.
549
550         Also made sure that in the case of a MediaRecorder stopped by a track removal in the recorded stream
551         the MediaRecorder will stop listening for its tracks.
552         Otherwise, the tracks will continue calling the MediaRecorder even after it is dead.
553
554         Test: http/wpt/mediarecorder/MediaRecorder-onremovetrack.html
555
556         * Modules/mediarecorder/MediaRecorder.cpp:
557         (WebCore::MediaRecorder::didAddOrRemoveTrack):
558         (WebCore::MediaRecorder::setNewRecordingState): Deleted.
559         * Modules/mediarecorder/MediaRecorder.h:
560         * platform/mediarecorder/MediaRecorderPrivateAVFImpl.cpp:
561         (WebCore::MediaRecorderPrivateAVFImpl::create):
562         (WebCore::MediaRecorderPrivateAVFImpl::MediaRecorderPrivateAVFImpl):
563         (WebCore::MediaRecorderPrivateAVFImpl::sampleBufferUpdated):
564         (WebCore::MediaRecorderPrivateAVFImpl::audioSamplesAvailable):
565         (WebCore::MediaRecorderPrivateAVFImpl::stopRecording):
566         (WebCore::MediaRecorderPrivateAVFImpl::fetchData):
567         * platform/mediarecorder/MediaRecorderPrivateAVFImpl.h:
568         * platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.h:
569         * platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.mm:
570         (WebCore::MediaRecorderPrivateWriter::create):
571         (WebCore::MediaRecorderPrivateWriter::MediaRecorderPrivateWriter):
572         (WebCore::MediaRecorderPrivateWriter::appendAudioSampleBuffer):
573         (WebCore::MediaRecorderPrivateWriter::setupWriter): Deleted.
574
575 2018-12-14  Youenn Fablet  <youenn@apple.com>
576
577         getSenders/getReceivers() should not return closed transceiver senders/receivers
578         https://bugs.webkit.org/show_bug.cgi?id=192706
579
580         Reviewed by Eric Carlson.
581
582         Updated as per https://github.com/w3c/webrtc-pc/commit/85284b76baebf9e149d194e692be16a21768a91a
583         This forces us to compute the sender/receiver list at getter call time.
584         Updated the internal call sites of senders to use the list of transceivers instead.
585
586         Covered by updated WPT tests.
587
588         * Modules/mediastream/RTCPeerConnection.cpp:
589         (WebCore::RTCPeerConnection::addTrack):
590         (WebCore::RTCPeerConnection::getSenders const):
591         (WebCore::RTCPeerConnection::getReceivers const):
592         * Modules/mediastream/RTCPeerConnection.h:
593         * Modules/mediastream/RTCRtpTransceiver.cpp:
594         (WebCore::RTCRtpTransceiver::stopped const):
595         (WebCore::RtpTransceiverSet::append):
596         (WebCore::RtpTransceiverSet::senders const):
597         (WebCore::RtpTransceiverSet::receivers const):
598         * Modules/mediastream/RTCRtpTransceiver.h:
599         (WebCore::RtpTransceiverSet::senders const): Deleted.
600         (WebCore::RtpTransceiverSet::receivers const): Deleted.
601         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
602         (WebCore::findExistingSender):
603         (WebCore::LibWebRTCPeerConnectionBackend::addTrack):
604
605 2018-12-14  David Kilzer  <ddkilzer@apple.com>
606
607         clang-tidy: Fix unnecessary copy of objects for operator==() methods
608         <https://webkit.org/b/192712>
609         <rdar://problem/46739332>
610
611         Reviewed by Andy Estes.
612
613         * contentextensions/HashableActionList.h:
614         (WebCore::ContentExtensions::HashableActionList::operator== const):
615         (WebCore::ContentExtensions::HashableActionList::operator!= const):
616         * platform/network/FormData.h:
617         (WebCore::FormDataElement::EncodedFileData::operator== const):
618         (WebCore::FormDataElement::EncodedBlobData::operator== const):
619         - Change arguments from const to const reference to avoid
620           copies.
621
622 2018-12-14  Jer Noble  <jer.noble@apple.com>
623
624         CRASH in CDMInstanceSessionFairPlayStreamingAVFObjC::closeSession(WTF::String const&, WTF::Function<void ()>&&)
625         https://bugs.webkit.org/show_bug.cgi?id=192713
626         <rdar://problem/46739706>
627
628         Reviewed by Eric Carlson.
629
630         A callback is being called twice, and the second time has a null Promise. Instead of these
631         callbacks being WTF::Function, make them WTF::CompletionHandlers, which self-nullify and
632         have ASSERTS() that they are called once-and-only-once.
633
634         * platform/encryptedmedia/CDMInstanceSession.h:
635         * platform/encryptedmedia/clearkey/CDMClearKey.cpp:
636         (WebCore::CDMInstanceSessionClearKey::closeSession):
637         * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm:
638         (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::closeSession):
639         (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::didProvideRequest):
640         (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::didProvideRenewingRequest):
641         (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::didFailToProvideRequest):
642         (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::requestDidSucceed):
643
644 2018-12-14  David Kilzer  <ddkilzer@apple.com>
645
646         clang-tidy: Fix unnecessary object copies in WebCore/platform/graphics/avfoundation/objc/
647         <https://webkit.org/b/192708>
648         <rdar://problem/46735907>
649
650         Reviewed by Jer Noble.
651
652         * platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.mm:
653         (WebCore::toSample):
654         - Make argument a const reference.
655
656         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
657         - Update method signatures for implementation changes.
658         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
659         (WebCore::MediaPlayerPrivateAVFoundationObjC::setAsset):
660         (WebCore::MediaPlayerPrivateAVFoundationObjC::seekableTimeRangesDidChange):
661         (WebCore::MediaPlayerPrivateAVFoundationObjC::loadedTimeRangesDidChange):
662         - Make RetainPtr<> argument an rvalue reference and use WTFMove().
663         (WebCore::MediaPlayerPrivateAVFoundationObjC::metadataDidArrive):
664         (WebCore::MediaPlayerPrivateAVFoundationObjC::tracksDidChange):
665         - Make RetainPtr<> argument a const reference.
666
667         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
668         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setVolume):
669         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setMuted):
670         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setPreservesPitch):
671         - Change for loop keys to be const references.
672
673         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h:
674         - Update method signatures for implementation changes.
675         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
676         (WebCore::SourceBufferPrivateAVFObjC::fastSeekTimeForMediaTime):
677         (WebCore::SourceBufferPrivateAVFObjC::seekToTime):
678         - Make Mediatime arguments a const reference.
679
680 2018-12-14  Simon Fraser  <simon.fraser@apple.com>
681
682         REGRESSION (r233268): contents of an animated element inside overflow:hidden disappear
683         https://bugs.webkit.org/show_bug.cgi?id=188655
684         rdar://problem/43382687
685
686         Reviewed by Antoine Quint.
687
688         The logic that computes animation extent, used by backing store attachment code, failed
689         to account for the behavior where a keyframe animation with a missing 0% keyframe uses
690         the transform from the unanimated style. This resulted in the computed extent being wrong,
691         which caused us to remove the layer's backing store in some scenarios.
692
693         Fix both animation code paths to use the renderer style if the first keyframe doesn't
694         contain a transform.
695
696         Tests: compositing/backing/backing-store-attachment-empty-keyframe.html
697                legacy-animation-engine/compositing/backing/backing-store-attachment-empty-keyframe.html
698
699         * animation/KeyframeEffect.cpp:
700         (WebCore::KeyframeEffect::computeExtentOfTransformAnimation const):
701         * page/animation/KeyframeAnimation.cpp:
702         (WebCore::KeyframeAnimation::computeExtentOfTransformAnimation const):
703
704 2018-12-14  Chris Dumez  <cdumez@apple.com>
705
706         [PSON] Stop exposing PolicyAction::Suspend to WebCore
707         https://bugs.webkit.org/show_bug.cgi?id=192701
708
709         Reviewed by Brady Eidson.
710
711         Drop PolicyAction::Suspend enum value and stop dealing with it in WebCore.
712
713         * loader/DocumentLoader.cpp:
714         (WebCore::DocumentLoader::continueAfterContentPolicy):
715         * loader/FrameLoaderTypes.h:
716         * loader/PolicyChecker.cpp:
717         (WebCore::PolicyChecker::checkNavigationPolicy):
718         (WebCore::PolicyChecker::checkNewWindowPolicy):
719
720 2018-12-14  Youenn Fablet  <youenn@apple.com>
721
722         IDB should store RTCCertificate
723         https://bugs.webkit.org/show_bug.cgi?id=192599
724
725         Reviewed by Brady Eidson.
726
727         In case there is no script execution context, do not create a JS DOM wrapper for RTCCertificate.
728         Instead, create an empty object so that the deserialization can still succeed.
729         This should only impact IDB deserialization in the Network Process which does not need the actual JS DOM wrapper.
730
731         Test: webrtc/certificates-indexeddb.html
732
733         * bindings/js/SerializedScriptValue.cpp:
734         (WebCore::CloneDeserializer::readTerminal):
735
736 2018-12-14  Zalan Bujtas  <zalan@apple.com>
737
738         [LFC][BFC] Transition to logical margin types.
739         https://bugs.webkit.org/show_bug.cgi?id=192699
740
741         Reviewed by Antti Koivisto.
742
743         This is in preparation for moving over to logical types.
744         (This patch also transitions to singlular margin naming (verticalMargins -> VerticalMargin))
745
746         * layout/FormattingContext.cpp:
747         (WebCore::Layout::FormattingContext::computeOutOfFlowHorizontalGeometry const):
748         (WebCore::Layout::FormattingContext::computeOutOfFlowVerticalGeometry const):
749         (WebCore::Layout::FormattingContext::validateGeometryConstraintsAfterLayout const):
750         * layout/FormattingContext.h:
751         * layout/FormattingContextGeometry.cpp:
752         (WebCore::Layout::staticVerticalPositionForOutOfFlowPositioned):
753         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedVerticalGeometry):
754         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedHorizontalGeometry):
755         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedVerticalGeometry):
756         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedHorizontalGeometry):
757         (WebCore::Layout::FormattingContext::Geometry::complicatedCases):
758         (WebCore::Layout::FormattingContext::Geometry::floatingNonReplacedWidthAndMargin):
759         (WebCore::Layout::FormattingContext::Geometry::floatingReplacedWidthAndMargin):
760         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedHeightAndMargin):
761         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedWidthAndMargin):
762         (WebCore::Layout::FormattingContext::Geometry::computedNonCollapsedHorizontalMarginValue):
763         (WebCore::Layout::FormattingContext::Geometry::computedNonCollapsedVerticalMarginValue):
764         * layout/FormattingContextQuirks.cpp:
765         (WebCore::Layout::FormattingContext::Quirks::heightValueOfNearestContainingBlockWithFixedHeight):
766         * layout/MarginTypes.h:
767         (WebCore::Layout::VerticalMargin::usedValues const):
768         * layout/Verification.cpp:
769         (WebCore::Layout::outputMismatchingBlockBoxInformationIfNeeded):
770         * layout/blockformatting/BlockFormattingContext.cpp:
771         (WebCore::Layout::BlockFormattingContext::computeEstimatedMarginBefore const):
772         (WebCore::Layout::BlockFormattingContext::computeEstimatedMarginBeforeForAncestors const):
773         (WebCore::Layout::BlockFormattingContext::precomputeVerticalPositionForFormattingRootIfNeeded const):
774         (WebCore::Layout::hasPrecomputedMarginBefore):
775         (WebCore::Layout::BlockFormattingContext::computeFloatingPosition const):
776         (WebCore::Layout::BlockFormattingContext::computePositionToAvoidFloats const):
777         (WebCore::Layout::BlockFormattingContext::computeVerticalPositionForFloatClear const):
778         (WebCore::Layout::BlockFormattingContext::computeWidthAndMargin const):
779         (WebCore::Layout::BlockFormattingContext::computeHeightAndMargin const):
780         (WebCore::Layout::BlockFormattingContext::computeEstimatedMarginTop const): Deleted.
781         (WebCore::Layout::BlockFormattingContext::computeEstimatedMarginTopForAncestors const): Deleted.
782         (WebCore::Layout::hasPrecomputedMarginTop): Deleted.
783         * layout/blockformatting/BlockFormattingContext.h:
784         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
785         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin):
786         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedWidthAndMargin):
787         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowReplacedWidthAndMargin):
788         (WebCore::Layout::BlockFormattingContext::Geometry::staticPosition):
789         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowHeightAndMargin):
790         (WebCore::Layout::BlockFormattingContext::Geometry::instrinsicWidthConstraints):
791         (WebCore::Layout::BlockFormattingContext::Geometry::estimatedMarginBefore):
792         (WebCore::Layout::BlockFormattingContext::Geometry::estimatedMarginAfter):
793         (WebCore::Layout::BlockFormattingContext::Geometry::estimatedMarginTop): Deleted.
794         (WebCore::Layout::BlockFormattingContext::Geometry::estimatedMarginBottom): Deleted.
795         * layout/blockformatting/BlockFormattingContextQuirks.cpp:
796         (WebCore::Layout::hasMarginBeforeQuirkValue):
797         (WebCore::Layout::BlockFormattingContext::Quirks::stretchedHeight):
798         (WebCore::Layout::BlockFormattingContext::Quirks::shouldIgnoreMarginBefore):
799         (WebCore::Layout::hasMarginTopQuirkValue): Deleted.
800         (WebCore::Layout::BlockFormattingContext::Quirks::shouldIgnoreMarginTop): Deleted.
801         * layout/blockformatting/BlockMarginCollapse.cpp:
802         (WebCore::Layout::isMarginBeforeCollapsedWithSibling):
803         (WebCore::Layout::isMarginAfterCollapsedWithSibling):
804         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::isMarginBeforeCollapsedWithParent):
805         (WebCore::Layout::isMarginAfterCollapsedThrough):
806         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::collapsedMarginBeforeFromFirstChild):
807         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::nonCollapsedMarginBefore):
808         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::computedNonCollapsedMarginBefore):
809         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::computedNonCollapsedMarginAfter):
810         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::marginBefore):
811         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::marginAfter):
812         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::isMarginAfterCollapsedWithParent):
813         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::isMarginBeforeCollapsedWithParentMarginAfter):
814         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::collapsedMarginAfterFromLastChild):
815         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::nonCollapsedMarginAfter):
816         (WebCore::Layout::isMarginTopCollapsedWithSibling): Deleted.
817         (WebCore::Layout::isMarginBottomCollapsedWithSibling): Deleted.
818         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::isMarginTopCollapsedWithParent): Deleted.
819         (WebCore::Layout::isMarginBottomCollapsedThrough): Deleted.
820         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::collapsedMarginTopFromFirstChild): Deleted.
821         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::nonCollapsedMarginTop): Deleted.
822         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::computedNonCollapsedMarginTop): Deleted.
823         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::computedNonCollapsedMarginBottom): Deleted.
824         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::marginTop): Deleted.
825         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::marginBottom): Deleted.
826         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::isMarginBottomCollapsedWithParent): Deleted.
827         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::isMarginTopCollapsedWithParentMarginBottom): Deleted.
828         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::collapsedMarginBottomFromLastChild): Deleted.
829         (WebCore::Layout::BlockFormattingContext::Geometry::MarginCollapse::nonCollapsedMarginBottom): Deleted.
830         * layout/displaytree/DisplayBox.cpp:
831         (WebCore::Display::Box::Box):
832         (WebCore::Display::Box::marginBox const):
833         (WebCore::Display::Box::nonCollapsedMarginBox const):
834         * layout/displaytree/DisplayBox.h:
835         (WebCore::Display::Box::rectWithMargin const):
836         (WebCore::Display::Box::estimatedMarginBefore const):
837         (WebCore::Display::Box::setEstimatedMarginBefore):
838         (WebCore::Display::Box::top const):
839         (WebCore::Display::Box::topLeft const):
840         (WebCore::Display::Box::setVerticalMargin):
841         (WebCore::Display::Box::marginBefore const):
842         (WebCore::Display::Box::marginStart const):
843         (WebCore::Display::Box::marginAfter const):
844         (WebCore::Display::Box::marginEnd const):
845         (WebCore::Display::Box::nonCollapsedMarginBefore const):
846         (WebCore::Display::Box::nonCollapsedMarginAfter const):
847         (WebCore::Display::Box::nonComputedMarginStart const):
848         (WebCore::Display::Box::nonComputedMarginEnd const):
849         (WebCore::Display::Box::estimatedMarginTop const): Deleted.
850         (WebCore::Display::Box::setEstimatedMarginTop): Deleted.
851         (WebCore::Display::Box::marginTop const): Deleted.
852         (WebCore::Display::Box::marginLeft const): Deleted.
853         (WebCore::Display::Box::marginBottom const): Deleted.
854         (WebCore::Display::Box::marginRight const): Deleted.
855         (WebCore::Display::Box::nonCollapsedMarginTop const): Deleted.
856         (WebCore::Display::Box::nonCollapsedMarginBottom const): Deleted.
857         (WebCore::Display::Box::nonComputedMarginLeft const): Deleted.
858         (WebCore::Display::Box::nonComputedMarginRight const): Deleted.
859         * layout/floats/FloatAvoider.cpp:
860         (WebCore::Layout::FloatAvoider::setHorizontalConstraints):
861         (WebCore::Layout::FloatAvoider::initialHorizontalPosition const):
862         (WebCore::Layout::FloatAvoider::overflowsContainingBlock const):
863         * layout/floats/FloatAvoider.h:
864         (WebCore::Layout::FloatAvoider::marginBefore const):
865         (WebCore::Layout::FloatAvoider::marginAfter const):
866         (WebCore::Layout::FloatAvoider::marginStart const):
867         (WebCore::Layout::FloatAvoider::marginEnd const):
868         (WebCore::Layout::FloatAvoider::marginBoxWidth const):
869         (WebCore::Layout::FloatAvoider::marginTop const): Deleted.
870         (WebCore::Layout::FloatAvoider::marginBottom const): Deleted.
871         (WebCore::Layout::FloatAvoider::marginLeft const): Deleted.
872         (WebCore::Layout::FloatAvoider::marginRight const): Deleted.
873         * layout/floats/FloatBox.cpp:
874         (WebCore::Layout::FloatBox::rect const):
875         (WebCore::Layout::FloatBox::horizontalPositionCandidate):
876         (WebCore::Layout::FloatBox::verticalPositionCandidate):
877         (WebCore::Layout::FloatBox::initialVerticalPosition const):
878         * layout/floats/FloatingContext.cpp:
879         (WebCore::Layout::FloatingContext::positionForFloat const):
880         (WebCore::Layout::FloatingContext::verticalPositionWithClearance const):
881         * layout/inlineformatting/InlineFormattingContext.cpp:
882         (WebCore::Layout::InlineFormattingContext::collectInlineContentForSubtree const):
883
884 2018-12-14  Zalan Bujtas  <zalan@apple.com>
885
886         [LFC][BFC] Introduce VerticalMargin and HorizontalMargin types.
887         https://bugs.webkit.org/show_bug.cgi?id=192692
888
889         Reviewed by Antti Koivisto.
890
891         This is in preparation for completing block margin collapsing.
892
893         * WebCore.xcodeproj/project.pbxproj:
894         * layout/FormattingContext.cpp:
895         (WebCore::Layout::FormattingContext::computeOutOfFlowVerticalGeometry const):
896         * layout/FormattingContext.h:
897         * layout/FormattingContextGeometry.cpp:
898         (WebCore::Layout::FormattingContext::Geometry::outOfFlowNonReplacedVerticalGeometry):
899         (WebCore::Layout::FormattingContext::Geometry::outOfFlowReplacedVerticalGeometry):
900         (WebCore::Layout::FormattingContext::Geometry::complicatedCases):
901         (WebCore::Layout::FormattingContext::Geometry::inlineReplacedHeightAndMargin):
902         (WebCore::Layout::FormattingContext::Geometry::computedNonCollapsedHorizontalMarginValue):
903         (WebCore::Layout::FormattingContext::Geometry::computedNonCollapsedVerticalMarginValue):
904         * layout/LayoutState.cpp:
905         (WebCore::Layout::LayoutState::LayoutState):
906         * layout/LayoutUnits.h:
907         (WebCore::Layout::HeightAndMargin::usedMarginValues const): Deleted.
908         * layout/MarginTypes.h: Added.
909         (WebCore::Layout::VerticalMargin::nonCollapsedValues const):
910         (WebCore::Layout::VerticalMargin::collapsedValues const):
911         (WebCore::Layout::VerticalMargin::setCollapsedValues):
912         (WebCore::Layout::VerticalMargin::VerticalMargin):
913         (WebCore::Layout::VerticalMargin::usedValues const):
914         * layout/blockformatting/BlockFormattingContext.cpp:
915         (WebCore::Layout::BlockFormattingContext::computeHeightAndMargin const):
916         * layout/blockformatting/BlockFormattingContextGeometry.cpp:
917         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowNonReplacedHeightAndMargin):
918         (WebCore::Layout::BlockFormattingContext::Geometry::inFlowHeightAndMargin):
919         * layout/blockformatting/BlockFormattingContextQuirks.cpp:
920         (WebCore::Layout::BlockFormattingContext::Quirks::stretchedHeight):
921         * layout/displaytree/DisplayBox.cpp:
922         (WebCore::Display::Box::Box):
923         * layout/displaytree/DisplayBox.h:
924         (WebCore::Display::Box::setHorizontalMargin):
925         (WebCore::Display::Box::setVerticalMargin):
926         (WebCore::Display::Box::setHorizontalNonComputedMargin):
927         (WebCore::Display::Box::verticalMargin const):
928         (WebCore::Display::Box::marginTop const):
929         (WebCore::Display::Box::marginLeft const):
930         (WebCore::Display::Box::marginBottom const):
931         (WebCore::Display::Box::marginRight const):
932         (WebCore::Display::Box::nonCollapsedMarginTop const):
933         (WebCore::Display::Box::nonCollapsedMarginBottom const):
934         (WebCore::Display::Box::setVerticalNonCollapsedMargin): Deleted.
935         * layout/floats/FloatingContext.cpp:
936         (WebCore::Layout::FloatingContext::verticalPositionWithClearance const):
937         * layout/inlineformatting/InlineFormattingContext.cpp:
938         (WebCore::Layout::InlineFormattingContext::computeHeightAndMargin const):
939
940 2018-12-14  Fujii Hironori  <Hironori.Fujii@sony.com>
941
942         [Win][Clang] Fix compilation warnings under Source/WebCore/platform/win
943         https://bugs.webkit.org/show_bug.cgi?id=192693
944
945         Reviewed by Ross Kirsling.
946
947         No new tests, no behavior changes.
948
949         * platform/win/ClipboardUtilitiesWin.cpp: Reordered ClipboardDataItem members to match with the initializer list.
950         * platform/win/CursorWin.cpp:
951         (WebCore::loadCursorByName): Changed the argument type of 'name' to const char*.
952         * platform/win/DefWndProcWindowClass.cpp:
953         (WebCore::defWndProcWindowClassName): Removed an unused variable 'atom'.
954         * platform/win/DragImageWin.cpp: Removed an unused variable 'MinDragLabelWidthBeforeClip'.
955         * platform/win/PasteboardWin.cpp:
956         (WebCore::createGlobalImageFileDescriptor): Removed an unused variable 'hr'.
957         (WebCore::createGlobalHDropContent): Use reinterpret_cast to suppress warning.
958         * platform/win/PlatformMouseEventWin.cpp:
959         (WebCore::PlatformMouseEvent::PlatformMouseEvent): Reordered the initializer list.
960         * platform/win/PopupMenuWin.cpp:
961         (WebCore::PopupMenuWin::paint): Removed an unused variable 'itemCount'.
962         * platform/win/PopupMenuWin.h: Marked override methods with 'override'.
963         * platform/win/SSLKeyGeneratorWin.cpp:
964         (WebCore::getSupportedKeySizes): Removed WebCore namespace prefix in WebCore namespace.
965         (WebCore::signedPublicKeyAndChallengeString): Ditto.
966         * platform/win/SearchPopupMenuDB.cpp:
967         (WebCore::SearchPopupMenuDB::createPreparedStatement): Use ASSERT_UNUSED instead of ASSERT.
968         * platform/win/StructuredExceptionHandlerSuppressor.h: Enclosed m_savedExceptionRegistration with #if defined(_M_IX86).
969         * platform/win/SystemInfo.cpp:
970         (WebCore::osVersionForUAString): Added default case.
971
972 2018-12-13  Youenn Fablet  <youenn@apple.com>
973
974         RTCRtpTransceiver.stopped should be true when applying a remote description with the corresponding m section rejected
975         https://bugs.webkit.org/show_bug.cgi?id=192685
976
977         Reviewed by Eric Carlson.
978
979         In case the remote description contains a rejected m section,
980         the corresponding transceiver should be marked as stopped.
981         Libwebrtc backend has that information so pipe it up to JS.
982
983         Covered by updated WPT test.
984
985         * Modules/mediastream/RTCRtpTransceiver.cpp:
986         (WebCore::RTCRtpTransceiver::stopped const):
987         * Modules/mediastream/RTCRtpTransceiver.h:
988         (WebCore::RTCRtpTransceiver::stopped const): Deleted.
989         * Modules/mediastream/RTCRtpTransceiverBackend.h:
990         * Modules/mediastream/libwebrtc/LibWebRTCRtpTransceiverBackend.cpp:
991         (WebCore::LibWebRTCRtpTransceiverBackend::stopped const):
992         * Modules/mediastream/libwebrtc/LibWebRTCRtpTransceiverBackend.h:
993
994 2018-12-13  Mark Lam  <mark.lam@apple.com>
995
996         Ensure that StructureFlags initialization always starts with Base::StructureFlags.
997         https://bugs.webkit.org/show_bug.cgi?id=192686
998
999         Reviewed by Keith Miller.
1000
1001         No new tests needed because there's no new functionality.  Just refactoring.
1002
1003         * bindings/js/JSDOMWindowProperties.h:
1004         * bindings/scripts/CodeGeneratorJS.pm:
1005         (GenerateHeader):
1006         (GeneratePrototypeDeclaration):
1007         * bindings/scripts/test/JS/JSTestActiveDOMObject.h:
1008         * bindings/scripts/test/JS/JSTestEnabledBySetting.h:
1009         * bindings/scripts/test/JS/JSTestEventTarget.h:
1010         * bindings/scripts/test/JS/JSTestGlobalObject.h:
1011         * bindings/scripts/test/JS/JSTestIndexedSetterNoIdentifier.h:
1012         * bindings/scripts/test/JS/JSTestIndexedSetterThrowingException.h:
1013         * bindings/scripts/test/JS/JSTestIndexedSetterWithIdentifier.h:
1014         * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterNoIdentifier.h:
1015         * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterThrowingException.h:
1016         * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterWithIdentifier.h:
1017         * bindings/scripts/test/JS/JSTestNamedDeleterNoIdentifier.h:
1018         * bindings/scripts/test/JS/JSTestNamedDeleterThrowingException.h:
1019         * bindings/scripts/test/JS/JSTestNamedDeleterWithIdentifier.h:
1020         * bindings/scripts/test/JS/JSTestNamedDeleterWithIndexedGetter.h:
1021         * bindings/scripts/test/JS/JSTestNamedGetterCallWith.h:
1022         * bindings/scripts/test/JS/JSTestNamedGetterNoIdentifier.h:
1023         * bindings/scripts/test/JS/JSTestNamedGetterWithIdentifier.h:
1024         * bindings/scripts/test/JS/JSTestNamedSetterNoIdentifier.h:
1025         * bindings/scripts/test/JS/JSTestNamedSetterThrowingException.h:
1026         * bindings/scripts/test/JS/JSTestNamedSetterWithIdentifier.h:
1027         * bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetter.h:
1028         * bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetterAndSetter.h:
1029         * bindings/scripts/test/JS/JSTestNamedSetterWithOverrideBuiltins.h:
1030         * bindings/scripts/test/JS/JSTestNamedSetterWithUnforgableProperties.h:
1031         * bindings/scripts/test/JS/JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins.h:
1032         * bindings/scripts/test/JS/JSTestObj.h:
1033         * bindings/scripts/test/JS/JSTestOverrideBuiltins.h:
1034         * bindings/scripts/test/JS/JSTestPluginInterface.h:
1035         * bindings/scripts/test/JS/JSTestTypedefs.h:
1036
1037 2018-12-13  Ryosuke Niwa  <rniwa@webkit.org>
1038
1039         Make HTMLConverter work across shadow boundaries
1040         https://bugs.webkit.org/show_bug.cgi?id=192640
1041
1042         Reviewed by Wenson Hsieh.
1043
1044         Made HTMLConverter work with shadow boundaries by replacing the various tree traversal functions.
1045
1046         Tests: editing/mac/attributed-string/attributed-string-across-shadow-boundaries-1.html
1047                editing/mac/attributed-string/attributed-string-across-shadow-boundaries-2.html
1048                editing/mac/attributed-string/attributed-string-across-shadow-boundaries-3.html
1049                editing/mac/attributed-string/attributed-string-across-shadow-boundaries-4.html
1050                editing/mac/attributed-string/attributed-string-across-shadow-boundaries-5.html
1051                editing/mac/attributed-string/attributed-string-across-shadow-boundaries-with-style-1.html
1052                editing/mac/attributed-string/attributed-string-across-shadow-boundaries-with-style-2.html
1053                editing/mac/attributed-string/attributed-string-across-shadow-boundaries-with-style-3.html
1054
1055         * dom/Position.cpp:
1056         (WebCore::commonShadowIncludingAncestor): Moved from markup.cpp to be shared between HTMLConverter
1057         and serializePreservingVisualAppearanceInternal.
1058         * dom/Position.h:
1059         * editing/cocoa/HTMLConverter.mm:
1060         (HTMLConverter::convert):
1061         (HTMLConverterCaches::propertyValueForNode):
1062         (HTMLConverterCaches::floatPropertyValueForNode):
1063         (HTMLConverter::_blockLevelElementForNode):
1064         (HTMLConverterCaches::colorPropertyValueForNode):
1065         (HTMLConverter::aggregatedAttributesForAncestors):
1066         (HTMLConverter::aggregatedAttributesForElementAndItsAncestors):
1067         (HTMLConverter::_processElement):
1068         (HTMLConverter::_traverseNode):
1069         (HTMLConverter::_traverseFooterNode):
1070         (HTMLConverterCaches::cacheAncestorsOfStartToBeConverted):
1071         (WebCore::attributedStringFromSelection):
1072         * editing/markup.cpp:
1073         (WebCore::commonShadowIncludingAncestor): Moved to Position.cpp.
1074
1075 2018-12-13  Youenn Fablet  <youenn@apple.com>
1076
1077         Trying to play a media element synchronously after setting srcObject should succeed without user gesture
1078         https://bugs.webkit.org/show_bug.cgi?id=192679
1079
1080         Reviewed by Eric Carlson.
1081
1082         Check the srcObject mediaProvider value which is set synchronously.
1083         Covered by updated fast/mediastream/local-audio-playing-event.html.
1084
1085         * html/HTMLMediaElement.h:
1086         (WebCore::HTMLMediaElement::hasMediaStreamSrcObject const):
1087
1088 2018-12-13  Wenson Hsieh  <wenson_hsieh@apple.com>
1089
1090         [iOS] Support dropping contact card data (public.vcard) in editable content
1091         https://bugs.webkit.org/show_bug.cgi?id=192570
1092         <rdar://problem/35626913>
1093
1094         Reviewed by Tim Horton.
1095
1096         Adds support for accepting vCard (.vcf) data via drop on iOS. See below for more details.
1097
1098         Tests:  DragAndDropTests.ExternalSourceContactIntoEditableAreas
1099                 DragAndDropTests.ExternalSourceMapItemAndContactToUploadArea
1100                 DragAndDropTests.ExternalSourceMapItemIntoEditableAreas
1101                 WKAttachmentTestsIOS.InsertDroppedContactAsAttachment
1102                 WKAttachmentTestsIOS.InsertDroppedMapItemAsAttachment
1103
1104         * editing/WebContentReader.h:
1105         * editing/cocoa/WebContentReaderCocoa.mm:
1106         (WebCore::attachmentForFilePath):
1107
1108         Pull out logic to create an attachment from a file path out into a static helper. Use this in `readFilePaths`
1109         as well as `readVirtualContactFile`.
1110
1111         (WebCore::WebContentReader::readFilePaths):
1112         (WebCore::WebContentReader::readVirtualContactFile):
1113
1114         Add a pasteboard reading method that reads a vCard file (with an optional URL) as web content. The resulting
1115         fragment consists of either an anchor and an attachment element, or just an attachment element if the URL is
1116         empty. In the case of an `MKMapItem`, the URL is populated, so we generate both elements; when dragging a
1117         contact, there is no associated URL, so we only have an attachment.
1118
1119         * platform/Pasteboard.h:
1120         * platform/ios/PasteboardIOS.mm:
1121         (WebCore::Pasteboard::readPasteboardWebContentDataForType):
1122
1123         Augment this to take the current `PasteboardItemInfo` as well; use this item information to get a file path for
1124         "public.vcard" data, which is then passed on to the web content reader. Additionally, by returning
1125         `ReaderResult::DidNotReadType` here, we prevent the web content reader from extracting the plain text contents
1126         of the vCard and dumping it as plain text in the editable element (this would otherwise happen, since
1127         "public.vcard" conforms to "public.text").
1128
1129         (WebCore::Pasteboard::read):
1130         (WebCore::Pasteboard::readRespectingUTIFidelities):
1131         * platform/ios/WebItemProviderPasteboard.mm:
1132         (-[NSItemProvider web_fileUploadContentTypes]):
1133
1134         Prevent the "com.apple.mapkit.map-item" UTI from being considered as file upload content. This special case is
1135         tricky, since "com.apple.mapkit.map-item" conforms to "public.content", yet its corresponding data is only
1136         suitable for deserialization into an `MKMapItem`.
1137
1138 2018-12-13  Devin Rousso  <drousso@apple.com>
1139
1140         Web Inspector: remove DOM.BackendNodeId and associated commands/events
1141         https://bugs.webkit.org/show_bug.cgi?id=192478
1142
1143         Reviewed by Matt Baker.
1144
1145         Removing unused code, so no change in functionality.
1146
1147         * inspector/agents/InspectorDOMAgent.h:
1148         * inspector/agents/InspectorDOMAgent.cpp:
1149         (WebCore::InspectorDOMAgent::discardBindings):
1150         (WebCore::InspectorDOMAgent::backendNodeIdForNode): Deleted.
1151         (WebCore::InspectorDOMAgent::releaseBackendNodeIds): Deleted.
1152         (WebCore::InspectorDOMAgent::pushNodeByBackendIdToFrontend): Deleted.
1153
1154 2018-12-13  Chris Dumez  <cdumez@apple.com>
1155
1156         [PSON] We should not need to navigate to 'about:blank' to suspend pages
1157         https://bugs.webkit.org/show_bug.cgi?id=192668
1158         <rdar://problem/46701466>
1159
1160         Reviewed by Alex Christensen.
1161
1162         * history/PageCache.cpp:
1163         (WebCore::PageCache::addIfCacheable):
1164         * history/PageCache.h:
1165         * loader/DocumentLoader.cpp:
1166         (WebCore::DocumentLoader::redirectReceived):
1167         (WebCore::DocumentLoader::willSendRequest):
1168         (WebCore::DocumentLoader::startLoadingMainResource):
1169         * loader/DocumentLoader.h:
1170         * loader/FrameLoader.cpp:
1171         (WebCore::FrameLoader::init):
1172         (WebCore::FrameLoader::stopAllLoaders):
1173         (WebCore::FrameLoader::setDocumentLoader):
1174         (WebCore::FrameLoader::commitProvisionalLoad):
1175         (WebCore::FrameLoader::continueLoadAfterNavigationPolicy):
1176         (WebCore::FrameLoader::continueLoadAfterNewWindowPolicy):
1177         * loader/FrameLoaderTypes.h:
1178         * loader/PolicyChecker.cpp:
1179         (WebCore::PolicyChecker::checkNavigationPolicy):
1180         * loader/PolicyChecker.h:
1181
1182 2018-12-13  Per Arne Vollan  <pvollan@apple.com>
1183
1184         [macOS] Inline WebVTT styles should override styles from Captions settings in System Preferences
1185         https://bugs.webkit.org/show_bug.cgi?id=192638
1186
1187         Reviewed by Eric Carlson.
1188
1189         It is currently not possible to override caption styles generated from System Preferences with inline
1190         WebVTT styles without adding !important. The reason for this is that the generated styles from
1191         System preferences are author styles which have higher priority than the inline WebVTT styles, which
1192         are user agent styles in the video user agent shadow tree. This can be fixed by moving the generated
1193         styles to the video user agent shadow tree. Inline WebVTT styles will then have higher priority since
1194         they are added after the generated styles. This patch also fixes a problem where inline styles could be
1195         added twice to the video user agent shadow root.
1196
1197         Test: media/track/track-cue-css.html
1198
1199         * dom/ExtensionStyleSheets.cpp:
1200         (WebCore::ExtensionStyleSheets::updateInjectedStyleSheetCache const):
1201         * html/track/VTTCue.cpp:
1202         (WebCore::VTTCue::getDisplayTree):
1203         * page/CaptionUserPreferences.cpp:
1204         (WebCore::CaptionUserPreferences::setCaptionsStyleSheetOverride):
1205         * page/Page.cpp:
1206         (WebCore::Page::setCaptionUserPreferencesStyleSheet):
1207
1208 2018-12-13  Jer Noble  <jer.noble@apple.com>
1209
1210         Fix leak of AVPlayer boundaryTimeObserver object.
1211         https://bugs.webkit.org/show_bug.cgi?id=192674
1212
1213         Reviewed by Eric Carlson.
1214
1215         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
1216         (WebCore::MediaPlayerPrivateAVFoundationObjC::performTaskAtMediaTime):
1217
1218 2018-12-13  Brent Fulgham  <bfulgham@apple.com>
1219
1220         Don't attempt to animate invalid CSS properties
1221         https://bugs.webkit.org/show_bug.cgi?id=192630
1222         <rdar://problem/46664433>
1223
1224         Reviewed by Antoine Quint.
1225
1226         Inherited animation properties can cause child elements to think they need to animate CSS properties
1227         that they do not support, leading to nullptr crashes.
1228
1229         Recognize that CSSPropertyInvalid is a potential requested animation property, and handle it
1230         cleanly.
1231
1232         Tests: animations/invalid-property-animation.html
1233
1234         * page/animation/CompositeAnimation.cpp:
1235         (WebCore::CompositeAnimation::updateTransitions):
1236         * svg/SVGAnimateElementBase.cpp:
1237         (WebCore::SVGAnimateElementBase::calculateAnimatedValue):
1238
1239 2018-12-13  Timothy Hatcher  <timothy@apple.com>
1240
1241         REGRESSION (r230064): Focus rings on webpages are fainter than in native UI.
1242         https://bugs.webkit.org/show_bug.cgi?id=192639
1243         rdar://problem/42669297
1244
1245         Reviewed by Tim Horton.
1246
1247         The focus ring color passed to CoreGraphics is expected to be opaque, since they
1248         will apply opacity when drawing (because opacity is normally animated).
1249         We were getting this by accident before when the old `RenderThemeMac::systemColor()`
1250         used the old `convertNSColorToColor()`, which ignored alpha on NSColor.
1251         Existing tests use fixed test focus ring color.
1252
1253         * css/StyleResolver.cpp:
1254         (WebCore::StyleResolver::colorFromPrimitiveValue const): Use RenderTheme singleton for `focusRingColor()`.
1255         * html/canvas/CanvasRenderingContext2D.cpp:
1256         (WebCore::CanvasRenderingContext2D::drawFocusIfNeededInternal): Ditto.
1257         * platform/graphics/cocoa/GraphicsContextCocoa.mm:
1258         (WebCore::drawFocusRingAtTime): Use `CGContextStateSaver`.
1259         * platform/mac/ThemeMac.mm:
1260         (WebCore::drawCellFocusRingWithFrameAtTime): Force alpha to 1 on the focus ring color. Use `CGContextStateSaver`.
1261         * rendering/RenderElement.cpp:
1262         (WebCore::RenderElement::paintFocusRing): Use RenderTheme singleton for `focusRingColor()`.
1263         * rendering/RenderImage.cpp:
1264         (WebCore::RenderImage::paintAreaElementFocusRing): Ditto.
1265         * rendering/RenderTheme.cpp:
1266         (WebCore::RenderTheme::focusRingColor const): Made const. Cache the result of `platformFocusRingColor()`.
1267         * rendering/RenderTheme.h: Made `focusRingColor()` a member function instead of static.
1268         * rendering/RenderThemeMac.mm:
1269         (WebCore::RenderThemeMac::platformFocusRingColor const): Force alpha to 1 on the focus ring color.
1270         (WebCore::RenderThemeMac::systemColor const): Use `focusRingColor()`, instead of caching color here.
1271
1272 2018-12-13  Eric Carlson  <eric.carlson@apple.com>
1273
1274         [MediaStream] Calculate width or height when constraints contain only the other
1275         https://bugs.webkit.org/show_bug.cgi?id=192632
1276         <rdar://problem/46665734>
1277
1278         Unreviewed, remove an unneeded assert.
1279
1280         * platform/mediastream/RealtimeVideoSource.cpp:
1281         (WebCore::RealtimeVideoSource::dispatchMediaSampleToObservers):
1282
1283 2018-12-13  Zach Li  <zachli@apple.com>
1284
1285         Update Credit Card AutoFill button icon
1286         https://bugs.webkit.org/show_bug.cgi?id=192637
1287         rdar://problem/46545006
1288
1289         Reviewed by Chris Dumez.
1290
1291         * css/html.css:
1292         (input::-webkit-credit-card-auto-fill-button):
1293
1294 2018-12-13  Eric Carlson  <eric.carlson@apple.com>
1295
1296         [MediaStream] Calculate width or height when constraints contain only the other
1297         https://bugs.webkit.org/show_bug.cgi?id=192632
1298         <rdar://problem/46665734>
1299
1300         Reviewed by Youenn Fablet.
1301
1302         Test: fast/mediastream/constraint-intrinsic-size.html
1303
1304         * platform/graphics/RemoteVideoSample.cpp:
1305         (WebCore::RemoteVideoSample::create): Log errors with RELEASE_LOG_ERROR.
1306
1307         * platform/graphics/cv/ImageTransferSessionVT.h:
1308         (WebCore::ImageTransferSessionVT::pixelFormat const): New.
1309
1310         * platform/mediastream/RealtimeMediaSource.cpp:
1311         (WebCore::RealtimeMediaSource::setSizeAndFrameRate): Replace current size with new size.
1312         (WebCore::RealtimeMediaSource::setSize): Don't notify about width and height.
1313         (WebCore::RealtimeMediaSource::size const): Use intrinsic size when necessary.
1314         (WebCore::RealtimeMediaSource::setIntrinsicSize): New.
1315         (WebCore::RealtimeMediaSource::remoteVideoSampleAvailable): Deleted.
1316         * platform/mediastream/RealtimeMediaSource.h:
1317
1318         * platform/mediastream/RealtimeVideoSource.cpp:
1319         (WebCore::RealtimeVideoSource::dispatchMediaSampleToObservers): No more remoteVideoSampleAvailable.
1320
1321         * platform/mediastream/mac/DisplayCaptureSourceCocoa.cpp:
1322         (WebCore::DisplayCaptureSourceCocoa::settings): Report size correctly.
1323         (WebCore::DisplayCaptureSourceCocoa::frameSize const): Use intrinsicSize().
1324         (WebCore::DisplayCaptureSourceCocoa::emitFrame): No more remoteVideoSampleAvailable.
1325         (WebCore::DisplayCaptureSourceCocoa::setIntrinsicSize): Deleted.
1326         * platform/mediastream/mac/DisplayCaptureSourceCocoa.h:
1327         (WebCore::DisplayCaptureSourceCocoa::intrinsicSize const): Deleted.
1328
1329         * platform/mock/MockRealtimeVideoSource.cpp:
1330         (WebCore::MockRealtimeVideoSource::MockRealtimeVideoSource): Report intrinsic size.
1331         (WebCore::MockRealtimeVideoSource::setSizeAndFrameRate): Minor cleanup.
1332         (WebCore::MockRealtimeVideoSource::setSizeAndFrameRateWithPreset):  Report intrinsic size.
1333         (WebCore::MockRealtimeVideoSource::drawText): Don't render preset info for display source.
1334         * platform/mock/MockRealtimeVideoSource.h:
1335
1336 2018-12-13  David Kilzer  <ddkilzer@apple.com>
1337
1338         clang-tidy: loop variable is copied but only used as const reference in Document.cpp, Element.cpp
1339         <https://webkit.org/b/192661>
1340         <rdar://problem/46694035>
1341
1342         Reviewed by Daniel Bates.
1343
1344         * dom/Document.cpp:
1345         (WebCore::Document::updateIntersectionObservations):
1346         (WebCore::Document::notifyIntersectionObserversTimerFired):
1347         * dom/Element.cpp:
1348         (WebCore::Element::didMoveToNewDocument):
1349         (WebCore::Element::disconnectFromIntersectionObservers):
1350         - Change loop variables from `auto` to `const auto&` to prevent
1351           unnecessary copies of WeakPtr<IntersectionObserver> or
1352           struct IntersectionObserverRegistration objects.
1353
1354 2018-12-13  Carlos Garcia Campos  <cgarcia@igalia.com>
1355
1356         [FreeType] Remove HarfBuzzFace
1357         https://bugs.webkit.org/show_bug.cgi?id=192589
1358
1359         Reviewed by Michael Catanzaro.
1360
1361         This was used to share the common implementation with the chromium port, but now that only freetype based ports
1362         use it, it can be removed and use hb_ft_face_create_cached() instead. We don't need the glyph cache either,
1363         since we are already caching glyphs in Font.
1364
1365         * platform/FreeType.cmake: Remove HarfBuzzFaceCairo.cpp and HarfBuzzFace.cpp.
1366         * platform/graphics/FontPlatformData.h: Remove HarfBuzzFace member.
1367         * platform/graphics/freetype/FontCustomPlatformDataFreeType.cpp: Add missing include.
1368         * platform/graphics/freetype/FontPlatformDataFreeType.cpp:
1369         (WebCore::FontPlatformData::operator=): Remove m_harfBuzzFace handling.
1370         (WebCore::FontPlatformData::createOpenTypeMathHarfBuzzFont const): New funtction to create a hb_font_t for
1371         OpenType math.
1372         * platform/graphics/harfbuzz/ComplexTextControllerHarfBuzz.cpp:
1373         (WebCore::floatToHarfBuzzPosition): Moved from HarfBuzzFaceCairo.cpp.
1374         (WebCore::doubleToHarfBuzzPosition): Ditto.
1375         (WebCore::harfBuzzFontFunctions): Also moved from HarfBuzzFaceCairo.cpp, but implement get_nominal/variation
1376         functions when using HarfBuzz >= 1.2.3 and use Font::glyphForCharacter() to make it simpler.
1377         (WebCore::fontFeatures): Moved from HarfBuzzFaceCairo.cpp.
1378         (WebCore::findScriptForVerticalGlyphSubstitution): Moved from HarfBuzzFace.cpp.
1379         (WebCore::ComplexTextController::collectComplexTextRunsForCharacters): Create the HarfBuzz face and font here.
1380         * platform/graphics/harfbuzz/HarfBuzzFace.cpp: Removed.
1381         * platform/graphics/harfbuzz/HarfBuzzFace.h: Removed.
1382         * platform/graphics/harfbuzz/HarfBuzzFaceCairo.cpp: Removed.
1383         * platform/graphics/harfbuzz/HbUniquePtr.h:
1384         (WebCore::HbPtrDeleter<hb_face_t>::operator() const): Add deleter for hb_face_t.
1385         * platform/graphics/opentype/OpenTypeMathData.cpp:
1386         (WebCore::OpenTypeMathData::OpenTypeMathData): Use FontPlatformData::createOpenTypeMathHarfBuzzFont().
1387
1388 2018-12-12  Carlos Garcia Campos  <cgarcia@igalia.com>
1389
1390         [FreeType] Add initial implementation of variation fonts
1391         https://bugs.webkit.org/show_bug.cgi?id=192151
1392
1393         Reviewed by Michael Catanzaro.
1394
1395         * css/CSSFontFaceSource.cpp:
1396         (WebCore::CSSFontFaceSource::font): Remove platform ifdefs.
1397         * loader/cache/CachedFont.cpp:
1398         (WebCore::CachedFont::platformDataFromCustomData): Ditto.
1399         * platform/graphics/FontPlatformData.h:
1400         (WebCore::FontPlatformData::isFixedWidth const):
1401         * platform/graphics/cairo/FontCustomPlatformData.h: Use RefPtr for cairo_font_face_t.
1402         * platform/graphics/freetype/FontCacheFreeType.cpp:
1403         (WebCore::getFontPropertiesFromPattern): Helper function to get several font properties from the fontconfig
1404         pattern.
1405         (WebCore::FontCache::systemFallbackForCharacters): Use getFontPropertiesFromPattern().
1406         (WebCore::FontCache::createFontPlatformData): Pass FC_VARIABLE to the pattern and call buildVariationSettings()
1407         before creating the FontPlatformData to set FC_FONT_VARIATIONS on the pattern.
1408         (WebCore::defaultVariationValues): Parse font variations table.
1409         (WebCore::buildVariationSettings): Build a font variations string from the settings that can be passed to cairo.
1410         * platform/graphics/freetype/FontCacheFreeType.h: Added.
1411         * platform/graphics/freetype/FontCustomPlatformDataFreeType.cpp:
1412         (WebCore::FontCustomPlatformData::FontCustomPlatformData): Use RefPtr and make freeTypeFaceKey global.
1413         (WebCore::FontCustomPlatformData::~FontCustomPlatformData): Remove explicit destroy.
1414         (WebCore::defaultFontconfigOptions): Moved here from FontCacheFreeType.
1415         (WebCore::FontCustomPlatformData::fontPlatformData): Call buildVariationSettings() before creating the
1416         FontPlatformData to set FC_FONT_VARIATIONS on the pattern.
1417         (WebCore::FontCustomPlatformData::supportsFormat): Add variation formats.
1418         * platform/graphics/freetype/FontPlatformDataFreeType.cpp:
1419         (WebCore::setCairoFontOptionsFromFontConfigPattern): Call cairo_font_options_set_variations() with the
1420         FC_FONT_VARIATIONS value from the pattern.
1421         (WebCore::FontPlatformData::FontPlatformData): Use a single constructor that always receives a valid fontconfig
1422         pattern.
1423         (WebCore::FontPlatformData::fcPattern const): Return the fontconfig pattern.
1424         (WebCore::FontPlatformData::platformIsEqual const): Update the condition now that m_pattern can't be nullptr.
1425         (WebCore::FontPlatformData::buildScaledFont): Use m_pattern unconditionally.
1426         * platform/graphics/freetype/SimpleFontDataFreeType.cpp:
1427         (WebCore::Font::platformCreateScaledFont const): Update it to use the new FontPlatformData constructor.
1428         * platform/graphics/harfbuzz/HarfBuzzFaceCairo.cpp:
1429         (WebCore::HarfBuzzFace::createFont): Pass variations to HarfBuzz.
1430         * platform/graphics/win/FontCustomPlatformData.cpp:
1431         (WebCore::FontCustomPlatformData::fontPlatformData):
1432         * platform/graphics/win/FontCustomPlatformData.h:
1433
1434 2018-12-12  Fujii Hironori  <Hironori.Fujii@sony.com>
1435
1436         [Win][Clang][WebKitLegacy] WebFrame.cpp: warning: delete called on non-final 'WebFrame' that has virtual functions but non-virtual destructor [-Wdelete-non-virtual-dtor]
1437         https://bugs.webkit.org/show_bug.cgi?id=192618
1438
1439         Reviewed by Alex Christensen.
1440
1441         No new tests, no behavior changes.
1442
1443         * platform/win/PopupMenuWin.h:
1444         * platform/win/WCDataObject.cpp:
1445         * platform/win/WCDataObject.h:
1446
1447 2018-12-12  Simon Fraser  <simon.fraser@apple.com>
1448
1449         REGRESSION (r238090): CAPCHA UI jumps to the wrong location
1450         https://bugs.webkit.org/show_bug.cgi?id=192651
1451         rdar://problem/46531919
1452
1453         Reviewed by Zalan Bujtas.
1454         
1455         When a RenderLayer becomes non-composited because of a style change, we need to set a dirty
1456         bit to say that descendants need their geometry updated (because they now have to
1457         compute their positions relative to a different ancestor). This wasn't happening
1458         in the layerStyleChanged() code path.
1459         
1460         In the code path that did do this correctly (in the computeCompositingRequirements() tree walk),
1461         we can address a FIXME and only dirty direct children, not all descendants (that code was
1462         written before the child-only dirty bit existed).
1463
1464         Test: compositing/geometry/update-child-geometry-on-compositing-change.html
1465
1466         * rendering/RenderLayerCompositor.cpp:
1467         (WebCore::RenderLayerCompositor::computeCompositingRequirements):
1468         (WebCore::RenderLayerCompositor::layerStyleChanged):
1469
1470 2018-12-13  Ryosuke Niwa  <rniwa@webkit.org>
1471
1472         Make TextInputController.legacyAttributedString take DOM nodes and offsets
1473         https://bugs.webkit.org/show_bug.cgi?id=192653
1474
1475         Reviewed by Wenson Hsieh.
1476
1477         No new tests since there should be no observable behavioral change other than
1478         TextInputController API in DumpRenderTree.
1479
1480         * editing/cocoa/HTMLConverter.h:
1481         * editing/cocoa/HTMLConverter.mm:
1482         (WebCore::attributedStringFromSelection):
1483         (WebCore::attributedStringBetweenStartAndEnd): Added.
1484
1485 2018-12-12  Ryosuke Niwa  <rniwa@webkit.org>
1486
1487         Fix macOS builds after r239145.
1488
1489         * platform/mediastream/mac/MockRealtimeVideoSourceMac.mm:
1490
1491 2018-12-12  Simon Fraser  <simon.fraser@apple.com>
1492
1493         REGRESSION (r238357): Pins on Yelp map disappear
1494         https://bugs.webkit.org/show_bug.cgi?id=192597
1495         rdar://problem/46578285
1496
1497         Reviewed by Zalan Bujtas.
1498
1499         RenderLayerCompositor::updateBackingAndHierarchy() had a bug where if a RenderLayer gained
1500         a negative z-order child (triggering creation of a foreground layer), we'd fail to 
1501         call the "setChildren()" with the vector containing that foreground layer.
1502         
1503         When updateBackingAndHierarchy() stops visiting descendants because none are composited,
1504         it may still have to update the child list with the foreground layer, so make sure
1505         the code handles this case.
1506
1507         Tests: compositing/z-order/add-negative-z-child.html
1508                compositing/z-order/rebuild-sibling-of-layer-with-foreground-layer.html
1509
1510         * rendering/RenderLayer.cpp:
1511         (WebCore::outputPaintOrderTreeRecursive):
1512         * rendering/RenderLayerCompositor.cpp:
1513         (WebCore::RenderLayerCompositor::updateBackingAndHierarchy):
1514
1515 2018-12-12  YUHAN WU  <yuhan_wu@apple.com>
1516
1517         Implement non-timeslice mode encoding for MediaRecorder
1518         https://bugs.webkit.org/show_bug.cgi?id=192069
1519         <rdar://problem/46443290>
1520
1521         Reviewed by Eric Carlson.
1522
1523         Implement the encoding for non-timeslice mode of MediaRecorder.
1524         It only supports to record MP4 file through H264 and AAC encoding, we will need to support more MIME types and encoding methods.
1525         Add a API in internals to allow testings to turn on the mock source.
1526
1527         Test: http/wpt/mediarecorder/MediaRecorder-AV-audio-video-dataavailable.html
1528
1529         * Modules/mediarecorder/MediaRecorder.cpp:
1530         (WebCore::MediaRecorder::create):
1531         (WebCore::MediaRecorder::setCustomPrivateRecorderCreator):
1532         (WebCore::MediaRecorder::getPrivateImpl):
1533         (WebCore::MediaRecorder::MediaRecorder):
1534         (WebCore::MediaRecorder::stopRecording):
1535         (WebCore::MediaRecorder::stopRecordingInternal):
1536         (WebCore::MediaRecorder::createRecordingDataBlob):
1537         (WebCore::MediaRecorder::scheduleDeferredTask):
1538         * Modules/mediarecorder/MediaRecorder.h:
1539         * Modules/mediarecorder/MediaRecorder.idl:
1540         * SourcesCocoa.txt:
1541         * WebCore.xcodeproj/project.pbxproj:
1542         * platform/mediarecorder/MediaRecorderPrivate.h:
1543         (WebCore::MediaRecorderPrivate::stopRecording):
1544         * platform/mediarecorder/MediaRecorderPrivateAVFImpl.cpp: Added.
1545         (WebCore::MediaRecorderPrivateAVFImpl::create):
1546         (WebCore::MediaRecorderPrivateAVFImpl::MediaRecorderPrivateAVFImpl):
1547         (WebCore::MediaRecorderPrivateAVFImpl::sampleBufferUpdated):
1548         (WebCore::MediaRecorderPrivateAVFImpl::audioSamplesAvailable):
1549         (WebCore::MediaRecorderPrivateAVFImpl::stopRecording):
1550         (WebCore::MediaRecorderPrivateAVFImpl::fetchData):
1551         (WebCore::MediaRecorderPrivateAVFImpl::mimeType):
1552         * platform/mediarecorder/MediaRecorderPrivateAVFImpl.h: Added.
1553         * platform/mediarecorder/MediaRecorderPrivateMock.cpp:
1554         (WebCore::MediaRecorderPrivateMock::fetchData):
1555         (WebCore::MediaRecorderPrivateMock::mimeType):
1556         * platform/mediarecorder/MediaRecorderPrivateMock.h:
1557         * platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.h: added.
1558         * platform/mediarecorder/cocoa/MediaRecorderPrivateWriterCocoa.mm: Added.
1559         (WebCore::MediaRecorderPrivateWriter::clear):
1560         (WebCore::MediaRecorderPrivateWriter::setupWriter):
1561         (WebCore::MediaRecorderPrivateWriter::setVideoInput):
1562         (WebCore::MediaRecorderPrivateWriter::setAudioInput):
1563         (WebCore::copySampleBufferWithCurrentTimeStamp):
1564         (WebCore::MediaRecorderPrivateWriter::appendVideoSampleBuffer):
1565         (WebCore::MediaRecorderPrivateWriter::appendAudioSampleBuffer):
1566         (WebCore::MediaRecorderPrivateWriter::stopRecording):
1567         * testing/Internals.cpp:
1568         (WebCore::createRecorderMockSource):
1569         (WebCore::Internals::setCustomPrivateRecorderCreator):
1570         * testing/Internals.h:
1571         * testing/Internals.idl:
1572
1573 2018-12-12  Justin Fan  <justin_fan@apple.com>
1574
1575         [WebGPU] Vertex buffers and WebGPUInputState
1576         https://bugs.webkit.org/show_bug.cgi?id=192611
1577
1578         Reviewed by Dean Jackson.
1579
1580         Test: webgpu/vertex-buffer-triangle-strip.html
1581
1582         Basic implementation of vertex buffers with Metal shading language in WebGPU. In 
1583         WebGPURenderPipelineDescriptor, refactor to match updated shader stage structure and add 
1584         WebGPUInputStateDescriptor. Also implement WebGPURenderPassEncoder::setVertexBuffers.
1585
1586         Add symbols and files for WebGPUIndexFormat, WebGPUInputStateDescriptor, WebGPUInputStepMode, 
1587         WebGPUVertexAttributeDescriptor, WebGPUVertexFormat, WebGPUVertexInputDescriptor:
1588         * CMakeLists.txt:
1589         * DerivedSources.make:
1590         * Sources.txt:
1591         * WebCore.xcodeproj/project.pbxproj:
1592         * bindings/js/WebCoreBuiltinNames.h:
1593
1594         Add and implement interfaces and dictionaries for WebGPUInputState:
1595         * Modules/webgpu/WebGPUBuffer.cpp:
1596         (WebCore::WebGPUBuffer::WebGPUBuffer):
1597         * Modules/webgpu/WebGPUBuffer.h:
1598         (WebCore::WebGPUBuffer::buffer const): Added getter for backing GPUBuffer.
1599         * Modules/webgpu/WebGPUBufferDescriptor.h:
1600         * Modules/webgpu/WebGPUBufferDescriptor.idl: Moving WebGPUBufferUsage out into its own IDL.
1601         * Modules/webgpu/WebGPUDevice.h:
1602         * Modules/webgpu/WebGPUIndexFormat.h: Added.
1603         * Modules/webgpu/WebGPUIndexFormat.idl: Added. 
1604         * Modules/webgpu/WebGPUInputStateDescriptor.h: Added.
1605         * Modules/webgpu/WebGPUInputStateDescriptor.idl: Added.
1606         * Modules/webgpu/WebGPUInputStepMode.h: Added.
1607         * Modules/webgpu/WebGPUInputStepMode.idl: Added.
1608         * Modules/webgpu/WebGPUVertexAttributeDescriptor.h: Added.
1609         * Modules/webgpu/WebGPUVertexAttributeDescriptor.idl: Added.
1610         * Modules/webgpu/WebGPUVertexFormat.h: Added.
1611         * Modules/webgpu/WebGPUVertexFormat.idl: Added.
1612         * Modules/webgpu/WebGPUVertexInputDescriptor.h: Added.
1613         * Modules/webgpu/WebGPUVertexInputDescriptor.idl: Added.
1614         * platform/graphics/gpu/GPUInputStateDescriptor.h: Added.
1615         * platform/graphics/gpu/GPURenderPassEncoder.h: Added.
1616         * platform/graphics/gpu/GPURenderPipelineDescriptor.h: Added.
1617         * platform/graphics/gpu/GPUVertexAttributeDescriptor.h: Added.
1618         * platform/graphics/gpu/GPUVertexInputDescriptor.h: Added.
1619
1620         Refactor to support updated structure of pipeline descriptor in sketch IDL:
1621         * Modules/webgpu/WebGPUDevice.cpp:
1622         (WebCore::validateAndConvertPipelineStage):
1623         (WebCore::WebGPUDevice::createRenderPipeline const):
1624         * Modules/webgpu/WebGPUPipelineDescriptorBase.h:
1625         * Modules/webgpu/WebGPUPipelineDescriptorBase.idl:
1626         * Modules/webgpu/WebGPUPipelineStageDescriptor.h:
1627         * Modules/webgpu/WebGPUPipelineStageDescriptor.idl:
1628         * Modules/webgpu/WebGPURenderPipelineDescriptor.h:
1629         * Modules/webgpu/WebGPURenderPipelineDescriptor.idl:
1630         * Modules/webgpu/WebGPUShaderStage.*: Removed.
1631
1632         Add and implement setVertexBuffers:
1633         * Modules/webgpu/WebGPURenderPassEncoder.cpp:
1634         (WebCore::WebGPURenderPassEncoder::setVertexBuffers): Added. 
1635         * Modules/webgpu/WebGPURenderPassEncoder.h:
1636         * Modules/webgpu/WebGPURenderPassEncoder.idl: 
1637         * platform/graphics/gpu/cocoa/GPURenderPassEncoderMetal.mm:
1638         (WebCore::GPURenderPassEncoder::setVertexBuffers):
1639         * platform/graphics/gpu/cocoa/GPURenderPipelineMetal.mm:
1640         (WebCore::setInputStateForPipelineDescriptor):
1641         (WebCore::GPURenderPipeline::create):
1642
1643 2018-12-12  Tim Horton  <timothy_horton@apple.com>
1644
1645         REGRESSION (r237565): >20 Find in Page highlights in one tile results in a single giant highlight
1646         https://bugs.webkit.org/show_bug.cgi?id=192642
1647         <rdar://problem/46498246>
1648
1649         Reviewed by Geoffrey Garen.
1650
1651         No new tests; adjusted an existing test instead.
1652
1653         * platform/graphics/PathUtilities.cpp:
1654         (WebCore::PathUtilities::pathsWithShrinkWrappedRects):
1655         Instead of uniting when we fail to shrink-wrap, just return the original rects.
1656         This seems like a more reasonable default in most cases.
1657
1658 2018-12-12  Vivek Seth  <v_seth@apple.com>
1659
1660         HTTPS Upgrade: Figure out if/how to tell clients that the HTTPS upgrade happened
1661         https://bugs.webkit.org/show_bug.cgi?id=192375
1662         <rdar://problem/45851159>
1663
1664         Reviewed by Chris Dumez.
1665
1666         Use simulated redirect to tell clients that HTTPS Upgrade happened.
1667
1668         * platform/network/ResourceResponseBase.cpp:
1669         (WebCore::ResourceResponseBase::syntheticRedirectResponse):
1670         * platform/network/ResourceResponseBase.h:
1671         * platform/network/mac/WebCoreURLResponse.mm:
1672         (WebCore::synthesizeRedirectResponseIfNecessary):
1673
1674 2018-12-12  Chris Dumez  <cdumez@apple.com>
1675
1676         Add a preference to enable / disable devicemotion and deviceorientation events
1677         https://bugs.webkit.org/show_bug.cgi?id=192631
1678         <rdar://problem/46646244>
1679
1680         Reviewed by Geoffrey Garen.
1681
1682         Add setting to toggle support for the deviceorientation / devicemotion events:
1683         - https://w3c.github.io/deviceorientation/
1684
1685         * page/DOMWindow.cpp:
1686         (WebCore::DOMWindow::addEventListener):
1687         * page/Settings.yaml:
1688
1689 2018-12-11  Ryosuke Niwa  <rniwa@webkit.org>
1690
1691         Make HTMLConverter take two Positions in preparation to make it work with shadow DOM
1692         https://bugs.webkit.org/show_bug.cgi?id=192613
1693
1694         Reviewed by Darin Adler.
1695
1696         This patch makes HTMLConverter store two Position's instead of a Range so that HTMLConverter can work with
1697         a selection which spans across shadow boundaries in the future.
1698
1699         No new tests since there should be no observable behavioral change.
1700
1701         * editing/cocoa/EditorCocoa.mm:
1702         (WebCore::Editor::writeSelectionToPasteboard): Uses the newly introduced writeSelectionToPasteboard.
1703         (WebCore::Editor::writeSelection): Ditto.
1704         * editing/cocoa/HTMLConverter.h:
1705         * editing/cocoa/HTMLConverter.mm:
1706         (HTMLConverter::HTMLConverter): Now takes two Position's.
1707         (HTMLConverter::convert): Updated to work with Position's.
1708         (HTMLConverter::_processText): Ditto.
1709         (HTMLConverter::_traverseNode): Ditto.
1710         (HTMLConverter::_traverseFooterNode): Ditto.
1711         (HTMLConverterCaches::cacheAncestorsOfStartToBeConverted): Ditto.
1712         (WebCore::attributedStringFromRange): Ditto.
1713         (WebCore::attributedStringFromSelection): Added. For now, we first create a Range via toNormalizedRange
1714         in order to preserve the exact behavior.
1715
1716 2018-12-12  Michael Catanzaro  <mcatanzaro@igalia.com>
1717
1718         Unreviewed manual rollout of r239100-r239102 and r239116
1719         https://bugs.webkit.org/show_bug.cgi?id=192151
1720         <rdar://problem/46655586>
1721
1722         * css/CSSFontFaceSource.cpp:
1723         (WebCore::CSSFontFaceSource::font):
1724         * loader/cache/CachedFont.cpp:
1725         (WebCore::CachedFont::platformDataFromCustomData):
1726         * platform/FreeType.cmake:
1727         * platform/graphics/FontPlatformData.h:
1728         (WebCore::FontPlatformData::isFixedWidth const): Deleted.
1729         * platform/graphics/cairo/FontCustomPlatformData.h:
1730         * platform/graphics/freetype/FontCacheFreeType.cpp:
1731         (WebCore::FontCache::systemFallbackForCharacters):
1732         (WebCore::FontCache::createFontPlatformData):
1733         (WebCore::getFontPropertiesFromPattern): Deleted.
1734         (WebCore::defaultVariationValues): Deleted.
1735         (WebCore::buildVariationSettings): Deleted.
1736         * platform/graphics/freetype/FontCacheFreeType.h: Removed.
1737         * platform/graphics/freetype/FontCustomPlatformDataFreeType.cpp:
1738         (WebCore::FontCustomPlatformData::FontCustomPlatformData):
1739         (WebCore::FontCustomPlatformData::~FontCustomPlatformData):
1740         (WebCore::FontCustomPlatformData::fontPlatformData):
1741         (WebCore::FontCustomPlatformData::supportsFormat):
1742         (WebCore::defaultFontconfigOptions): Deleted.
1743         * platform/graphics/freetype/FontPlatformDataFreeType.cpp:
1744         (WebCore::setCairoFontOptionsFromFontConfigPattern):
1745         (WebCore::getDefaultFontconfigOptions):
1746         (WebCore::FontPlatformData::FontPlatformData):
1747         (WebCore::FontPlatformData::operator=):
1748         (WebCore::FontPlatformData::harfBuzzFace const):
1749         (WebCore::FontPlatformData::platformIsEqual const):
1750         (WebCore::FontPlatformData::buildScaledFont):
1751         (WebCore::FontPlatformData::fcPattern const): Deleted.
1752         (WebCore::FontPlatformData::createOpenTypeMathHarfBuzzFont const): Deleted.
1753         * platform/graphics/freetype/SimpleFontDataFreeType.cpp:
1754         (WebCore::Font::platformCreateScaledFont const):
1755         * platform/graphics/harfbuzz/ComplexTextControllerHarfBuzz.cpp:
1756         (WebCore::fontFeatures):
1757         (WebCore::ComplexTextController::collectComplexTextRunsForCharacters):
1758         (WebCore::floatToHarfBuzzPosition): Deleted.
1759         (WebCore::doubleToHarfBuzzPosition): Deleted.
1760         (WebCore::harfBuzzFontFunctions): Deleted.
1761         (WebCore::findScriptForVerticalGlyphSubstitution): Deleted.
1762         * platform/graphics/harfbuzz/HarfBuzzFace.cpp: Added.
1763         (WebCore::HarfBuzzFace::CacheEntry::CacheEntry):
1764         (WebCore::HarfBuzzFace::CacheEntry::~CacheEntry):
1765         (WebCore::HarfBuzzFace::cache):
1766         (WebCore::HarfBuzzFace::HarfBuzzFace):
1767         (WebCore::HarfBuzzFace::~HarfBuzzFace):
1768         (WebCore::findScriptForVerticalGlyphSubstitution):
1769         (WebCore::HarfBuzzFace::setScriptForVerticalGlyphSubstitution):
1770         * platform/graphics/harfbuzz/HarfBuzzFace.h: Added.
1771         (WebCore::HarfBuzzFace::CacheEntry::create):
1772         (WebCore::HarfBuzzFace::CacheEntry::face):
1773         (WebCore::HarfBuzzFace::CacheEntry::glyphCache):
1774         * platform/graphics/harfbuzz/HarfBuzzFaceCairo.cpp: Added.
1775         (WebCore::floatToHarfBuzzPosition):
1776         (WebCore::doubleToHarfBuzzPosition):
1777         (WebCore::CairoGetGlyphWidthAndExtents):
1778         (WebCore::harfBuzzGetGlyph):
1779         (WebCore::harfBuzzGetGlyphHorizontalAdvance):
1780         (WebCore::harfBuzzGetGlyphHorizontalOrigin):
1781         (WebCore::harfBuzzGetGlyphExtents):
1782         (WebCore::harfBuzzCairoTextGetFontFuncs):
1783         (WebCore::harfBuzzCairoGetTable):
1784         (WebCore::HarfBuzzFace::createFace):
1785         (WebCore::HarfBuzzFace::createFont):
1786         * platform/graphics/harfbuzz/HbUniquePtr.h:
1787         (WebCore::HbPtrDeleter<hb_face_t>::operator() const): Deleted.
1788         * platform/graphics/opentype/OpenTypeMathData.cpp:
1789         (WebCore::OpenTypeMathData::OpenTypeMathData):
1790         * platform/graphics/win/FontCustomPlatformData.cpp:
1791         (WebCore::FontCustomPlatformData::fontPlatformData):
1792         * platform/graphics/win/FontCustomPlatformData.h:
1793         * platform/graphics/win/FontCustomPlatformDataCairo.cpp:
1794         (WebCore::FontCustomPlatformData::fontPlatformData):
1795
1796 2018-12-12  Chris Dumez  <cdumez@apple.com>
1797
1798         Unreviewed attempt to fix Windows Cairo build after r239100.
1799
1800         * platform/graphics/win/FontCustomPlatformDataCairo.cpp:
1801         (WebCore::FontCustomPlatformData::fontPlatformData):
1802
1803 2018-12-12  Wenson Hsieh  <wenson_hsieh@apple.com>
1804
1805         [iOS] A few API tests are failing after r239086
1806         https://bugs.webkit.org/show_bug.cgi?id=192608
1807
1808         Reviewed by Zalan Bujtas.
1809
1810         These test failures were caused by a missing Vector size check in `Pasteboard::readFilePaths` before accessing
1811         the first item. Fix this by adding a helper method on PasteboardItemInfo to grab the file path for the highest
1812         fidelity pasteboard item (returning the null string if there are none), and use this in a few places that grab
1813         the highest fidelity path using Vector::first().
1814
1815         While `Pasteboard::readRespectingUTIFidelities` does have a bounds check before accessing the list of paths,
1816         this patch still replaces it with a call to `pathForHighestFidelityItem()`, so that the intent is more clear.
1817
1818         * platform/PasteboardItemInfo.h:
1819         (WebCore::PasteboardItemInfo::pathForHighestFidelityItem const):
1820         * platform/ios/PasteboardIOS.mm:
1821         (WebCore::Pasteboard::readRespectingUTIFidelities):
1822         (WebCore::Pasteboard::readFilePaths):
1823
1824 2018-12-12  Carlos Garcia Campos  <cgarcia@igalia.com>
1825
1826         Unreviewed. Fix WPE build after r239101.
1827
1828         * platform/graphics/harfbuzz/ComplexTextControllerHarfBuzz.cpp: Include <hb-ot.h>
1829
1830 2018-12-12  Carlos Garcia Campos  <cgarcia@igalia.com>
1831
1832         [FreeType] Remove HarfBuzzFace
1833         https://bugs.webkit.org/show_bug.cgi?id=192589
1834
1835         Reviewed by Michael Catanzaro.
1836
1837         This was used to share the common implementation with the chromium port, but now that only freetype based ports
1838         use it, it can be removed and use hb_ft_face_create_cached() instead. We don't need the glyph cache either,
1839         since we are already caching glyphs in Font.
1840
1841         * platform/FreeType.cmake: Remove HarfBuzzFaceCairo.cpp and HarfBuzzFace.cpp.
1842         * platform/graphics/FontPlatformData.h: Remove HarfBuzzFace member.
1843         * platform/graphics/freetype/FontCustomPlatformDataFreeType.cpp: Add missing include.
1844         * platform/graphics/freetype/FontPlatformDataFreeType.cpp:
1845         (WebCore::FontPlatformData::operator=): Remove m_harfBuzzFace handling.
1846         (WebCore::FontPlatformData::createOpenTypeMathHarfBuzzFont const): New funtction to create a hb_font_t for
1847         OpenType math.
1848         * platform/graphics/harfbuzz/ComplexTextControllerHarfBuzz.cpp:
1849         (WebCore::floatToHarfBuzzPosition): Moved from HarfBuzzFaceCairo.cpp.
1850         (WebCore::doubleToHarfBuzzPosition): Ditto.
1851         (WebCore::harfBuzzFontFunctions): Also moved from HarfBuzzFaceCairo.cpp, but implement get_nominal/variation
1852         functions when using HarfBuzz >= 1.2.3 and use Font::glyphForCharacter() to make it simpler.
1853         (WebCore::fontFeatures): Moved from HarfBuzzFaceCairo.cpp.
1854         (WebCore::findScriptForVerticalGlyphSubstitution): Moved from HarfBuzzFace.cpp.
1855         (WebCore::ComplexTextController::collectComplexTextRunsForCharacters): Create the HarfBuzz face and font here.
1856         * platform/graphics/harfbuzz/HarfBuzzFace.cpp: Removed.
1857         * platform/graphics/harfbuzz/HarfBuzzFace.h: Removed.
1858         * platform/graphics/harfbuzz/HarfBuzzFaceCairo.cpp: Removed.
1859         * platform/graphics/harfbuzz/HbUniquePtr.h:
1860         (WebCore::HbPtrDeleter<hb_face_t>::operator() const): Add deleter for hb_face_t.
1861         * platform/graphics/opentype/OpenTypeMathData.cpp:
1862         (WebCore::OpenTypeMathData::OpenTypeMathData): Use FontPlatformData::createOpenTypeMathHarfBuzzFont().
1863
1864 2018-12-12  Carlos Garcia Campos  <cgarcia@igalia.com>
1865
1866         [FreeType] Add initial implementation of variation fonts
1867         https://bugs.webkit.org/show_bug.cgi?id=192151
1868
1869         Reviewed by Michael Catanzaro.
1870
1871         * css/CSSFontFaceSource.cpp:
1872         (WebCore::CSSFontFaceSource::font): Remove platform ifdefs.
1873         * loader/cache/CachedFont.cpp:
1874         (WebCore::CachedFont::platformDataFromCustomData): Ditto.
1875         * platform/graphics/FontPlatformData.h:
1876         (WebCore::FontPlatformData::isFixedWidth const):
1877         * platform/graphics/cairo/FontCustomPlatformData.h: Use RefPtr for cairo_font_face_t.
1878         * platform/graphics/freetype/FontCacheFreeType.cpp:
1879         (WebCore::getFontPropertiesFromPattern): Helper function to get several font properties from the fontconfig
1880         pattern.
1881         (WebCore::FontCache::systemFallbackForCharacters): Use getFontPropertiesFromPattern().
1882         (WebCore::FontCache::createFontPlatformData): Pass FC_VARIABLE to the pattern and call buildVariationSettings()
1883         before creating the FontPlatformData to set FC_FONT_VARIATIONS on the pattern.
1884         (WebCore::defaultVariationValues): Parse font variations table.
1885         (WebCore::buildVariationSettings): Build a font variations string from the settings that can be passed to cairo.
1886         * platform/graphics/freetype/FontCacheFreeType.h: Added.
1887         * platform/graphics/freetype/FontCustomPlatformDataFreeType.cpp:
1888         (WebCore::FontCustomPlatformData::FontCustomPlatformData): Use RefPtr and make freeTypeFaceKey global.
1889         (WebCore::FontCustomPlatformData::~FontCustomPlatformData): Remove explicit destroy.
1890         (WebCore::defaultFontconfigOptions): Moved here from FontCacheFreeType.
1891         (WebCore::FontCustomPlatformData::fontPlatformData): Call buildVariationSettings() before creating the
1892         FontPlatformData to set FC_FONT_VARIATIONS on the pattern.
1893         (WebCore::FontCustomPlatformData::supportsFormat): Add variation formats.
1894         * platform/graphics/freetype/FontPlatformDataFreeType.cpp:
1895         (WebCore::setCairoFontOptionsFromFontConfigPattern): Call cairo_font_options_set_variations() with the
1896         FC_FONT_VARIATIONS value from the pattern.
1897         (WebCore::FontPlatformData::FontPlatformData): Use a single constructor that always receives a valid fontconfig
1898         pattern.
1899         (WebCore::FontPlatformData::fcPattern const): Return the fontconfig pattern.
1900         (WebCore::FontPlatformData::platformIsEqual const): Update the condition now that m_pattern can't be nullptr.
1901         (WebCore::FontPlatformData::buildScaledFont): Use m_pattern unconditionally.
1902         * platform/graphics/freetype/SimpleFontDataFreeType.cpp:
1903         (WebCore::Font::platformCreateScaledFont const): Update it to use the new FontPlatformData constructor.
1904         * platform/graphics/harfbuzz/HarfBuzzFaceCairo.cpp:
1905         (WebCore::HarfBuzzFace::createFont): Pass variations to HarfBuzz.
1906         * platform/graphics/win/FontCustomPlatformData.cpp:
1907         (WebCore::FontCustomPlatformData::fontPlatformData):
1908         * platform/graphics/win/FontCustomPlatformData.h:
1909
1910 2018-12-11  Justin Michaud  <justin_michaud@apple.com>
1911
1912         Implement feature flag for CSS Typed OM
1913         https://bugs.webkit.org/show_bug.cgi?id=192610
1914
1915         Reviewed by Ryosuke Niwa.
1916
1917         * Configurations/FeatureDefines.xcconfig:
1918         * bindings/js/JSTypedOMCSSStyleValueCustom.cpp:
1919         * css/typedom/StylePropertyMapReadOnly.h:
1920         * css/typedom/StylePropertyMapReadOnly.idl:
1921         * css/typedom/TypedOMCSSImageValue.h:
1922         * css/typedom/TypedOMCSSImageValue.idl:
1923         * css/typedom/TypedOMCSSNumericValue.h:
1924         * css/typedom/TypedOMCSSNumericValue.idl:
1925         * css/typedom/TypedOMCSSStyleValue.h:
1926         * css/typedom/TypedOMCSSStyleValue.idl:
1927         * css/typedom/TypedOMCSSUnitValue.h:
1928         * css/typedom/TypedOMCSSUnitValue.idl:
1929         * css/typedom/TypedOMCSSUnparsedValue.h:
1930         * css/typedom/TypedOMCSSUnparsedValue.idl:
1931         * features.json:
1932         * html/ImageBitmap.cpp:
1933         * html/ImageBitmap.h:
1934         * html/canvas/CanvasDrawImage.idl:
1935         * html/canvas/CanvasFillStrokeStyles.idl:
1936         * html/canvas/CanvasRenderingContext2DBase.cpp:
1937         * html/canvas/CanvasRenderingContext2DBase.h:
1938         * inspector/InspectorCanvas.cpp:
1939         (WebCore::InspectorCanvas::buildAction):
1940         * page/RuntimeEnabledFeatures.h:
1941         (WebCore::RuntimeEnabledFeatures::setCSSTypedOMEnabled):
1942         (WebCore::RuntimeEnabledFeatures::cssTypedOMEnabled const):
1943         * page/WindowOrWorkerGlobalScope.idl:
1944
1945 2018-12-10  Ryosuke Niwa  <rniwa@webkit.org>
1946
1947         connectedCallback is invoked during the removal of the element inside another element's connectedCallback
1948         https://bugs.webkit.org/show_bug.cgi?id=183586
1949         <rdar://problem/38403504>
1950
1951         Reviewed by Frédéric Wang.
1952
1953         Align WebKit's behavior with Chrome/Firefox with regards to https://github.com/w3c/webcomponents/issues/760
1954
1955         After much discussion, it's unclear that there is a clear path forward to fixing the oddness that
1956         the presence of a custom element reaction changes the timing at which another reaction callback gets invoked.
1957         So matching Chrome/Firefox behaviors in this case seems the path of the least resistance to interoperability.
1958
1959         Namely, this patch makes WebKit not insert a custom element to the appropriate element queue when the element
1960         does not have a matching reaction callback. Put it another way, steps 3-5 in would be done before step 6 in:
1961         https://html.spec.whatwg.org/multipage/custom-elements.html#enqueue-a-custom-element-callback-reaction
1962             1. Let definition be element's custom element definition.
1963             2. Let callback be the value of the entry in definition's lifecycle callbacks with key callbackName.
1964             3. If callback is null, then return
1965             4. If callbackName is "attributeChangedCallback", then:
1966                 1. Let attributeName be the first element of args.
1967                 2. If definition's observed attributes does not contain attributeName, then return.
1968             5. Add a new callback reaction to element's custom element reaction queue, with callback function callback
1969                and arguments args.
1970             6. Enqueue an element on the appropriate element queue given element.
1971
1972         Test: fast/custom-elements/enqueue-custom-element-callback-reactions-inside-another-callback.html
1973
1974         * dom/CustomElementReactionQueue.cpp:
1975         (WebCore::CustomElementReactionQueue::enqueueElementUpgrade):
1976         (WebCore::CustomElementReactionQueue::enqueueConnectedCallbackIfNeeded):
1977         (WebCore::CustomElementReactionQueue::enqueueDisconnectedCallbackIfNeeded):
1978         (WebCore::CustomElementReactionQueue::enqueueAdoptedCallbackIfNeeded):
1979         (WebCore::CustomElementReactionQueue::enqueueAttributeChangedCallbackIfNeeded):
1980         (WebCore::CustomElementReactionQueue::enqueuePostUpgradeReactions):
1981         (WebCore::CustomElementReactionQueue::enqueueElementOnAppropriateElementQueue): Renamed from ensureCurrentQueue.
1982         * dom/CustomElementReactionQueue.h:
1983
1984 2018-12-11  Justin Fan  <justin_fan@apple.com>
1985
1986         [WebGPU] Implement WebGPUBuffer, and some nullibility consistency in WebGPU
1987         https://bugs.webkit.org/show_bug.cgi?id=192516
1988
1989         Reviewed by Dean Jackson.
1990
1991         Test: webgpu/buffers.html
1992
1993         Enable basic creation of WebGPUBuffers, and fix nullability inconsitencies in WebGPU implementation.
1994
1995         Add necessary symbols and files for Web/GPUBuffer, Web/GPUBufferUsage, and Web/GPUBufferDescriptor:
1996         * CMakeLists.txt:
1997         * DerivedSources.make:
1998         * Sources.txt:
1999         * SourcesCocoa.txt:
2000         * WebCore.xcodeproj/project.pbxproj:
2001         * bindings/js/WebCoreBuiltinNames.h:
2002
2003         * Modules/webgpu/WebGPUBuffer.cpp: Added.
2004         (WebCore::WebGPUBuffer::create):
2005         (WebCore::WebGPUBuffer::WebGPUBuffer):
2006         * Modules/webgpu/WebGPUBuffer.h: Added.
2007         (WebCore::WebGPUBuffer::mapping const):
2008         (WebCore::WebGPUBuffer::unmap): Unimplemented stub, for now, as Metal equivalent is unclear.
2009         (WebCore::WebGPUBuffer::destroy): Unimplemented stub.
2010         * Modules/webgpu/WebGPUBuffer.idl: Added.
2011         * Modules/webgpu/WebGPUBufferDescriptor.h: Added.
2012         * Modules/webgpu/WebGPUBufferDescriptor.idl: Added.
2013         * Modules/webgpu/WebGPUDevice.cpp:
2014         (WebCore::WebGPUDevice::createBuffer const): Added.
2015         * platform/graphics/gpu/GPUBuffer.h:
2016         (WebCore::GPUBuffer::platformBuffer const):
2017         (WebCore::GPUBuffer::mapping const):
2018         * platform/graphics/gpu/GPUBufferDescriptor.h: Added.
2019         * platform/graphics/gpu/GPUDevice.cpp:
2020         (WebCore::GPUDevice::createBuffer const): Added.
2021         * platform/graphics/gpu/GPUDevice.h:
2022         * platform/graphics/gpu/cocoa/GPUBufferMetal.mm: Added.
2023         (WebCore::GPUBuffer::create): Attempt to create a page-aligned Gigacage to back the GPUBuffer's ArrayBuffer. 
2024         (WebCore::GPUBuffer::GPUBuffer):
2025         (WebCore::GPUBuffer::~GPUBuffer): Dereference mapped ArrayBuffer first.
2026
2027         Small benign edits, most to make nullability more consistent in WebGPU classes:
2028         * Modules/webgpu/WebGPUCommandBuffer.cpp:
2029         (WebCore::WebGPUCommandBuffer::create):
2030         (WebCore::WebGPUCommandBuffer::beginRenderPass):
2031         * Modules/webgpu/WebGPUCommandBuffer.h:
2032         * Modules/webgpu/WebGPUDevice.cpp:
2033         (WebCore::WebGPUDevice::create):
2034         (WebCore::WebGPUDevice::WebGPUDevice):
2035         (WebCore::WebGPUDevice::createShaderModule const):
2036         (WebCore::WebGPUDevice::createRenderPipeline const):
2037         (WebCore::WebGPUDevice::createCommandBuffer const):
2038         * Modules/webgpu/WebGPUDevice.h:
2039         (WebCore::WebGPUDevice::device const):
2040         * Modules/webgpu/WebGPUDevice.idl:
2041         * Modules/webgpu/WebGPUQueue.cpp:
2042         (WebCore::WebGPUQueue::create):
2043         * Modules/webgpu/WebGPURenderPassEncoder.cpp:
2044         (WebCore::WebGPURenderPassEncoder::create):
2045         * Modules/webgpu/WebGPURenderPassEncoder.h:
2046         * Modules/webgpu/WebGPUShaderModule.cpp:
2047         (WebCore::WebGPUShaderModule::create):
2048         (WebCore::WebGPUShaderModule::WebGPUShaderModule):
2049         * Modules/webgpu/WebGPUShaderModule.h:
2050         (WebCore::WebGPUShaderModule::module const):
2051         * Modules/webgpu/WebGPUSwapChain.idl: Sync with IDL changes.
2052         * Modules/webgpu/WebGPUTexture.cpp:
2053         (WebCore::WebGPUTexture::create):
2054         (WebCore::WebGPUTexture::createDefaultTextureView):
2055         * Modules/webgpu/WebGPUTextureView.cpp:
2056         (WebCore::WebGPUTextureView::create):
2057         * Modules/webgpu/WebGPUTextureView.h:
2058         * platform/graphics/gpu/cocoa/GPUQueueMetal.mm:
2059         (WebCore::GPUQueue::create):
2060         * platform/graphics/gpu/cocoa/GPURenderPipelineMetal.mm:
2061         (WebCore::GPURenderPipeline::create):
2062         * platform/graphics/gpu/cocoa/GPUShaderModuleMetal.mm:
2063         (WebCore::GPUShaderModule::create):
2064         * platform/graphics/gpu/cocoa/GPUSwapChainMetal.mm:
2065         (WebCore::GPUSwapChain::setDevice):
2066         * platform/graphics/gpu/cocoa/GPUTextureMetal.mm:
2067         (WebCore::GPUTexture::GPUTexture):
2068
2069 2018-12-11  Fujii Hironori  <Hironori.Fujii@sony.com>
2070
2071         [Win][Clang] Fix warning -Wmissing-field-initializers
2072         https://bugs.webkit.org/show_bug.cgi?id=192584
2073
2074         Reviewed by Yusuke Suzuki.
2075
2076         Initialize a struct with '{ }' instead of '= {0}'.
2077
2078         No new tests, no behavior changes.
2079
2080         * platform/graphics/win/FontCacheWin.cpp:
2081         (WebCore::FontCache::lastResortFallbackFont):
2082         * platform/graphics/win/MediaPlayerPrivateFullscreenWindow.cpp:
2083         (WebCore::MediaPlayerPrivateFullscreenWindow::createWindow):
2084         * platform/win/ClipboardUtilitiesWin.cpp:
2085         (WebCore::setFileDescriptorData):
2086         (WebCore::setFileContentData):
2087         (WebCore::setUCharData):
2088         (WebCore::setUtf8Data):
2089         (WebCore::setCFData):
2090         * platform/win/CursorWin.cpp:
2091         (WebCore::createSharedCursor):
2092         * platform/win/DefWndProcWindowClass.cpp:
2093         (WebCore::registerClass):
2094         * platform/win/DragImageWin.cpp:
2095         (WebCore::createDragImageIconForCachedImageFilename):
2096         * platform/win/PasteboardWin.cpp:
2097         (WebCore::writeURL):
2098         (WebCore::Pasteboard::writeString):
2099         (WebCore::Pasteboard::writeRangeToDataObject):
2100         (WebCore::Pasteboard::writePlainTextToDataObject):
2101         (WebCore::writeFileToDataObject):
2102         (WebCore::Pasteboard::writeMarkup):
2103         * platform/win/PopupMenuWin.cpp:
2104         (WebCore::PopupMenuWin::show):
2105         * platform/win/SSLKeyGeneratorWin.cpp:
2106         (WebCore::WebCore::signedPublicKeyAndChallengeString):
2107
2108 2018-12-11  Jer Noble  <jer.noble@apple.com>
2109
2110         Globally namespaced objects shouldn't use framework-prefixed names
2111         https://bugs.webkit.org/show_bug.cgi?id=192600
2112
2113         Reviewed by Eric Carlson.
2114
2115         Rename CMSampleBufferIs... -> isCMSampleBuffer...
2116
2117         * platform/graphics/avfoundation/objc/MediaSampleAVFObjC.mm:
2118         (WebCore::isCMSampleBufferRandomAccess):
2119         (WebCore::isCMSampleBufferNonDisplaying):
2120         (WebCore::MediaSampleAVFObjC::flags const):
2121         (WebCore::CMSampleBufferIsRandomAccess): Deleted.
2122         (WebCore::CMSampleBufferIsNonDisplaying): Deleted.
2123
2124 2018-12-11  Brent Fulgham  <bfulgham@apple.com>
2125
2126         Don't attempt to compute animated values when there is no relevant animation
2127         https://bugs.webkit.org/show_bug.cgi?id=192591
2128         <rdar://problem/34336946>
2129
2130         Reviewed by Dean Jackson.
2131
2132         Check if the property is supposed to be animated, or has animatable features, before
2133         attempting to calculate the current animated value.
2134
2135         Test: svg/animations/avoid-calculating-for-non-animating-elements.html
2136
2137         * svg/SVGAnimateElementBase.cpp:
2138         (WebCore::SVGAnimateElementBase::calculateAnimatedValue):
2139
2140 2018-12-11  Chris Dumez  <cdumez@apple.com>
2141
2142         Unreviewed, fix typos in console log from r239087.
2143
2144         * page/DOMWindow.cpp:
2145         (WebCore::DOMWindow::addEventListener):
2146
2147 2018-12-11  Tim Horton  <timothy_horton@apple.com>
2148
2149         WebCore shouldn't have a Objective-C class named NSCursor
2150         https://bugs.webkit.org/show_bug.cgi?id=192602
2151         <rdar://problem/46615532>
2152
2153         Reviewed by Wenson Hsieh.
2154
2155         * platform/ios/wak/WAKAppKitStubs.h:
2156         * platform/ios/wak/WAKAppKitStubs.m:
2157         (+[NSCursor setHiddenUntilMouseMoves:]): Deleted.
2158         Get rid of the class.
2159         Also remove a comment that seems to have detached from wherever it's supposed to be.
2160
2161 2018-12-11  Chris Dumez  <cdumez@apple.com>
2162
2163         Restrict DeviceMotion / DeviceOrientation APIs to secure contexts
2164         https://bugs.webkit.org/show_bug.cgi?id=192595
2165         <rdar://problem/46382603>
2166
2167         Reviewed by Dean Jackson.
2168
2169         Tests: http/tests/events/device-orientation-motion-non-secure-context.html
2170                http/tests/events/device-orientation-motion-secure-context.html
2171
2172         * page/DOMWindow.cpp:
2173         (WebCore::DOMWindow::addEventListener):
2174         * page/SecurityOrigin.h:
2175         (WebCore::SecurityOrigin::setIsPotentiallyTrustworthy):
2176         * testing/Internals.cpp:
2177         (WebCore::Internals::markContextAsInsecure):
2178         (WebCore::Internals::postTask):
2179         * testing/Internals.h:
2180         * testing/Internals.idl:
2181
2182 2018-12-11  Wenson Hsieh  <wenson_hsieh@apple.com>
2183
2184         [iOS] Send the full list of file upload URLs and types in PasteboardItemInfo
2185         https://bugs.webkit.org/show_bug.cgi?id=192598
2186         Work towards <rdar://problem/35626913>
2187
2188         Reviewed by Tim Horton.
2189
2190         Refactors PasteboardItemInfo to contain lists of file URLs and corresponding pasteboard types, instead of just
2191         a "preferred" file upload URL and type. See below for more details.
2192
2193         * platform/PasteboardItemInfo.h:
2194         (WebCore::PasteboardItemInfo::pathForContentType const):
2195
2196         Add a helper method to find a file upload URL corresponding to a given type.
2197
2198         (WebCore::PasteboardItemInfo::encode const):
2199         (WebCore::PasteboardItemInfo::decode):
2200
2201         Change `pathForFileUpload` to `pathsForFileUpload`, and `contentTypeForFileUpload` to `contentTypesForFileUpload`.
2202
2203         * platform/ios/AbstractPasteboard.h:
2204         * platform/ios/PasteboardIOS.mm:
2205         (WebCore::Pasteboard::readRespectingUTIFidelities):
2206
2207         Adjust this to take the file path for the highest fidelity representation in `pathsForContentType`.
2208
2209         (WebCore::Pasteboard::readFilePaths):
2210         * platform/ios/PlatformPasteboardIOS.mm:
2211         (WebCore::PlatformPasteboard::informationForItemAtIndex):
2212         * platform/ios/WebItemProviderPasteboard.h:
2213         * platform/ios/WebItemProviderPasteboard.mm:
2214         (-[NSItemProvider web_containsFileURLAndFileUploadContent]):
2215         (-[NSItemProvider web_fileUploadContentTypes]):
2216
2217         Replace `web_containsFileUploadContent` with `web_fileUploadContentTypes`, which returns the full list of file
2218         upload content types (rather than just a `BOOL` indicating whether one or more of these types exist).
2219
2220         (-[WebItemProviderPasteboard fileUploadURLsAtIndex:fileTypes:]):
2221         (-[WebItemProviderPasteboard numberOfFiles]):
2222         (-[NSItemProvider web_containsFileUploadContent]): Deleted.
2223         (-[WebItemProviderPasteboard preferredFileUploadURLAtIndex:fileType:]): Deleted.
2224
2225         Replaced with `-fileUploadURLsAtIndex:fileTypes:`. This implementation currently just returns the highest
2226         fidelity loaded type identifier, but this is wrong because it doesn't take into account inline data types that
2227         shouldn't be represented as data for file uploads (for instance, it never makes sense to upload the internal
2228         data serialization for an `NSURL` as a file on the web).
2229
2230         Instead, use existing logic in `web_fileUploadContentTypes` to determine which file types can be treated as file
2231         uploads, and return all of these file types that we've loaded.
2232
2233 2018-12-11  Don Olmstead  <don.olmstead@sony.com>
2234
2235         Resource Load Statistics: Use common implementation within NetworkStorageSession
2236         https://bugs.webkit.org/show_bug.cgi?id=192592
2237
2238         Reviewed by Alex Christensen.
2239
2240         There's nothing within the resource load statistics implementation contained
2241         in NetworkStorageSessionCFNet that was CF specific. All of the resource load
2242         statistics methods are moved from that file to the root NetworkStorageSession
2243         implementation.
2244
2245         * platform/network/NetworkStorageSession.cpp:
2246         (WebCore::getPartitioningDomain):
2247         (WebCore::NetworkStorageSession::shouldBlockThirdPartyCookies const):
2248         (WebCore::NetworkStorageSession::shouldBlockCookies const):
2249         (WebCore::NetworkStorageSession::maxAgeCacheCap):
2250         (WebCore::NetworkStorageSession::setAgeCapForClientSideCookies):
2251         (WebCore::NetworkStorageSession::setPrevalentDomainsToBlockCookiesFor):
2252         (WebCore::NetworkStorageSession::removePrevalentDomains):
2253         (WebCore::NetworkStorageSession::hasStorageAccess const):
2254         (WebCore::NetworkStorageSession::getAllStorageAccessEntries const):
2255         (WebCore::NetworkStorageSession::grantStorageAccess):
2256         (WebCore::NetworkStorageSession::removeStorageAccessForFrame):
2257         (WebCore::NetworkStorageSession::removeStorageAccessForAllFramesOnPage):
2258         (WebCore::NetworkStorageSession::removeAllStorageAccess):
2259         (WebCore::NetworkStorageSession::setCacheMaxAgeCapForPrevalentResources):
2260         (WebCore::NetworkStorageSession::resetCacheMaxAgeCapForPrevalentResources):
2261         * platform/network/NetworkStorageSession.h:
2262         * platform/network/cf/NetworkStorageSessionCFNet.cpp:
2263         (WebCore::getPartitioningDomain): Deleted.
2264         (WebCore::NetworkStorageSession::shouldBlockThirdPartyCookies const): Deleted.
2265         (WebCore::NetworkStorageSession::shouldBlockCookies const): Deleted.
2266         (WebCore::NetworkStorageSession::maxAgeCacheCap): Deleted.
2267         (WebCore::NetworkStorageSession::setAgeCapForClientSideCookies): Deleted.
2268         (WebCore::NetworkStorageSession::setPrevalentDomainsToBlockCookiesFor): Deleted.
2269         (WebCore::NetworkStorageSession::removePrevalentDomains): Deleted.
2270         (WebCore::NetworkStorageSession::hasStorageAccess const): Deleted.
2271         (WebCore::NetworkStorageSession::getAllStorageAccessEntries const): Deleted.
2272         (WebCore::NetworkStorageSession::grantStorageAccess): Deleted.
2273         (WebCore::NetworkStorageSession::removeStorageAccessForFrame): Deleted.
2274         (WebCore::NetworkStorageSession::removeStorageAccessForAllFramesOnPage): Deleted.
2275         (WebCore::NetworkStorageSession::removeAllStorageAccess): Deleted.
2276         (WebCore::NetworkStorageSession::setCacheMaxAgeCapForPrevalentResources): Deleted.
2277         (WebCore::NetworkStorageSession::resetCacheMaxAgeCapForPrevalentResources): Deleted.
2278
2279 2018-12-11  Devin Rousso  <drousso@apple.com>
2280
2281         Web Inspector: overlay bounds rulers don't match element when page is scrolled
2282         https://bugs.webkit.org/show_bug.cgi?id=192577
2283
2284         Reviewed by Joseph Pecoraro.
2285
2286         When drawing the highlight for a node, the canvas is translated based on the scroll position
2287         of the node. This translation was not applied to the bounds calculations, which meant that
2288         the bounds always drew where the node would have been if it wasn't scrolled.
2289
2290         * inspector/InspectorOverlayPage.js:
2291         (Bounds.prototype.get minX):
2292         (Bounds.prototype.get minY):
2293         (Bounds.prototype.get maxX):
2294         (Bounds.prototype.get maxY):
2295         (Bounds.prototype.offset): Added.
2296         (drawNodeHighlight):
2297         Drive-by: draw bounds for every node being highlighted instead of just the first one.
2298         Drive-by: switch the bounds color to be a semi-transparent red for more visibility/contrast.
2299
2300 2018-12-11  Andy Estes  <aestes@apple.com>
2301
2302         Introduce makeBlockPtr for lambdas
2303         https://bugs.webkit.org/show_bug.cgi?id=192594
2304
2305         Reviewed by Alex Christensen.
2306
2307         Adopted makeBlockPtr.
2308
2309         * platform/cocoa/FileMonitorCocoa.mm:
2310         (WebCore::FileMonitor::FileMonitor):
2311         * platform/graphics/avfoundation/objc/VideoFullscreenLayerManagerObjC.mm:
2312         (WebCore::VideoFullscreenLayerManagerObjC::setVideoFullscreenLayer):
2313         * platform/graphics/gpu/legacy/cocoa/GPULegacyCommandBufferMetal.mm:
2314         (WebCore::GPULegacyCommandBuffer::GPULegacyCommandBuffer):
2315         * platform/network/cocoa/WebCoreNSURLSession.mm:
2316         (-[WebCoreNSURLSession addDelegateOperation:]):
2317         (-[WebCoreNSURLSessionDataTask resource:receivedRedirect:request:completionHandler:]):
2318         * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm:
2319         (-[WebCoreResourceHandleAsOperationQueueDelegate callFunctionOnMainThread:]):
2320
2321 2018-12-10  Brent Fulgham  <bfulgham@apple.com>
2322
2323         SVGViewSpec objects should mark relevant SVG elements
2324         https://bugs.webkit.org/show_bug.cgi?id=192567
2325         <rdar://problem/46491325>
2326
2327         Reviewed by Ryosuke Niwa.
2328
2329         SVGViewSpec elements reflect the state of an underlying SVGElement. Teach the mark algorithm to
2330         recognize the relevant SVGElement as active as long as the SVGViewSpec is active.
2331
2332         Update SVGElement so that it can vend WeakPtrs. I also noticed that SVGAttributeOwner used a bare
2333         pointer to the SVGElement, so switched to a WeakPtr.
2334
2335         Test: svg/animations/view-dependency-crash.html
2336
2337         * Sources.txt: Add new files.
2338         * WebCore.xcodeproj/project.pbxproj: Ditto.
2339         * bindings/js/JSSVGViewSpecCustom.cpp: Added.
2340         (WebCore::JSSVGViewSpec::visitAdditionalChildren):
2341         * svg/SVGElement.h:
2342         * svg/SVGPathElement.h:
2343         * svg/SVGViewSpec.cpp:
2344         (WebCore::SVGViewSpec::SVGViewSpec): Hold a weak pointer (rather than a bare pointer) to the underlying element.
2345         * svg/SVGViewSpec.h:
2346         * svg/SVGViewSpec.idl:
2347         * svg/properties/SVGAttributeOwnerProxy.cpp: Added.
2348         (WebCore::SVGAttributeOwnerProxy::SVGAttributeOwnerProxy): Hold a weak pointer (rather than a bare pointer) to
2349         the underling SVGElement.
2350         (WebCore::SVGAttributeOwnerProxy::element const): Ditto.
2351         * svg/properties/SVGAttributeOwnerProxy.h:
2352         (WebCore::SVGAttributeOwnerProxy::SVGAttributeOwnerProxy): Move implementation to cpp file.
2353         (WebCore::SVGAttributeOwnerProxy::element const): Ditto.
2354         * svg/properties/SVGAttributeOwnerProxyImpl.h: Update for WeakPtr use.
2355
2356 2018-12-10  Benjamin Poulain  <benjamin@webkit.org>
2357
2358         <rdar://problem/45296285> Content blocker rule "raw" blocks media elements from loading
2359         https://bugs.webkit.org/show_bug.cgi?id=192439
2360
2361         Reviewed by Dean Jackson.
2362
2363         This broken when WebKit switched to NSURLSession.
2364         In CachedResourceLoader::requestResource(), toResourceType() was turning media load into RAW.
2365
2366         Test: http/tests/contentextensions/video-element-resource-type.html
2367
2368         * loader/ResourceLoadInfo.cpp:
2369         (WebCore::toResourceType):
2370
2371 2018-12-10  Don Olmstead  <don.olmstead@sony.com>
2372
2373         Move ENABLE_RESOURCE_LOAD_STATISTICS to FeatureDefines.xcconfig
2374         https://bugs.webkit.org/show_bug.cgi?id=192573
2375
2376         Reviewed by Simon Fraser.
2377
2378         * Configurations/FeatureDefines.xcconfig:
2379
2380 2018-12-10  Justin Michaud  <justin_michaud@apple.com>
2381
2382         CS Painting API should support multiple worklets.
2383         https://bugs.webkit.org/show_bug.cgi?id=192335
2384
2385         Reviewed by Dean Jackson.
2386
2387         Adds a new map to support separate paint worklet global scopes (one for each worklet). Also
2388         adds some tests and a fix for a repaint bug that this oncovered, where changing a custom property required
2389         for paint would not trigger a repaint if there had not been a valid value set before.
2390
2391         Test: fast/css-custom-paint/multiple-worklets.html
2392
2393         * css/CSSPaintImageValue.cpp:
2394         (WebCore::CSSPaintImageValue::image):
2395         * css/StyleResolver.cpp:
2396         (WebCore::StyleResolver::applyProperty):
2397         * dom/Document.cpp:
2398         (WebCore::Document::prepareForDestruction):
2399         (WebCore::Document::paintWorkletGlobalScope):
2400         (WebCore::Document::setPaintWorkletGlobalScope):
2401         * dom/Document.h:
2402         (WebCore::Document::paintWorkletGlobalScope): Deleted.
2403         * rendering/style/RenderStyle.cpp:
2404         (WebCore::changedCustomPaintWatchedProperty):
2405         * worklets/Worklet.cpp:
2406         (WebCore::Worklet::addModule):
2407         * worklets/WorkletGlobalScope.cpp:
2408         (WebCore::WorkletGlobalScope::prepareForDestruction):
2409
2410 2018-12-10  Youenn Fablet  <youenn@apple.com>
2411
2412         Remove derived classes of RealtimeMediaSourceCenter
2413         https://bugs.webkit.org/show_bug.cgi?id=192546
2414
2415         Reviewed by Eric Carlson.
2416
2417         Remove virtual methods of RealtimeMediaSourceCenter and remove derived classes of it.
2418         Instead port specific implementation directly implement the needed default factory methods.
2419
2420         Renamed some methods for improved consistency.
2421         Moved some static variables as RealtimeMediaSourceCenter members.
2422
2423         No change of behavior.
2424
2425         * WebCore.xcodeproj/project.pbxproj:
2426         * page/DeprecatedGlobalSettings.cpp:
2427         * platform/mediastream/RealtimeMediaSourceCenter.cpp:
2428         (WebCore::RealtimeMediaSourceCenter::createMediaStream):
2429         (WebCore::RealtimeMediaSourceCenter::getMediaStreamDevices):
2430         (WebCore::RealtimeMediaSourceCenter::getUserMediaDevices):
2431         (WebCore::RealtimeMediaSourceCenter::setVideoCapturePageState):
2432         (WebCore::RealtimeMediaSourceCenter::setAudioFactory):
2433         (WebCore::RealtimeMediaSourceCenter::unsetAudioFactory):
2434         (WebCore::RealtimeMediaSourceCenter::audioCaptureFactory):
2435         (WebCore::RealtimeMediaSourceCenter::setVideoFactory):
2436         (WebCore::RealtimeMediaSourceCenter::unsetVideoFactory):
2437         (WebCore::RealtimeMediaSourceCenter::videoCaptureFactory):
2438         (WebCore::RealtimeMediaSourceCenter::setDisplayCaptureFactory):
2439         (WebCore::RealtimeMediaSourceCenter::unsetDisplayCaptureFactory):
2440         (WebCore::RealtimeMediaSourceCenter::displayCaptureFactory):
2441         * platform/mediastream/RealtimeMediaSourceCenter.h:
2442         * platform/mediastream/RealtimeVideoSource.cpp:
2443         (WebCore::RealtimeVideoSource::~RealtimeVideoSource):
2444         (WebCore::RealtimeVideoSource::prepareToProduceData):
2445         * platform/mediastream/gstreamer/RealtimeMediaSourceCenterLibWebRTC.cpp:
2446         (WebCore::RealtimeMediaSourceCenter::singleton):
2447         (WebCore::RealtimeMediaSourceCenter::defaultAudioCaptureFactory):
2448         (WebCore::RealtimeMediaSourceCenter::defaultVideoCaptureFactory):
2449         (WebCore::RealtimeMediaSourceCenter::defaultDisplayCaptureFactory):
2450         * platform/mediastream/gstreamer/RealtimeMediaSourceCenterLibWebRTC.h: Removed.
2451         * platform/mediastream/mac/AVVideoCaptureSource.mm:
2452         (WebCore::AVVideoCaptureSource::~AVVideoCaptureSource):
2453         (WebCore::AVVideoCaptureSource::setupCaptureSession):
2454         * platform/mediastream/mac/DisplayCaptureSourceCocoa.cpp:
2455         (WebCore::DisplayCaptureSourceCocoa::~DisplayCaptureSourceCocoa):
2456         (WebCore::DisplayCaptureSourceCocoa::startProducingData):
2457         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp:
2458         (WebCore::RealtimeMediaSourceCenter::singleton):
2459         (WebCore::RealtimeMediaSourceCenter::defaultAudioCaptureFactory):
2460         (WebCore::RealtimeMediaSourceCenter::defaultVideoCaptureFactory):
2461         (WebCore::RealtimeMediaSourceCenter::defaultDisplayCaptureFactory):
2462         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.h: Removed.
2463         * platform/mock/MockRealtimeAudioSource.cpp:
2464         (WebCore::MockRealtimeAudioSource::~MockRealtimeAudioSource):
2465         (WebCore::MockRealtimeAudioSource::startProducingData):
2466         * platform/mock/MockRealtimeMediaSourceCenter.cpp:
2467         (WebCore::MockRealtimeMediaSourceCenter::setMockRealtimeMediaSourceCenterEnabled):
2468         (WebCore::MockRealtimeMediaSourceCenter::audioCaptureFactory):
2469         (WebCore::MockRealtimeMediaSourceCenter::videoCaptureFactory):
2470         * platform/mock/MockRealtimeMediaSourceCenter.h:
2471
2472 2018-12-10  Youenn Fablet  <youenn@apple.com>
2473
2474         DataChannels created asynchronously never open and are unusable
2475         https://bugs.webkit.org/show_bug.cgi?id=192566
2476
2477         Reviewed by Eric Carlson.
2478
2479         For every new data channel (remote or local), we should check the underlying backend state.
2480         This allows firing events if needed.
2481         We were not always doing that which was prohibiting sending some open
2482         events for data channels created after the SCTP connection is set up.
2483
2484         Covered by updated test.
2485
2486         * Modules/mediastream/libwebrtc/LibWebRTCDataChannelHandler.cpp:
2487         (WebCore::LibWebRTCDataChannelHandler::channelEvent):
2488         (WebCore::LibWebRTCDataChannelHandler::setClient):
2489         (WebCore::LibWebRTCDataChannelHandler::OnStateChange):
2490         (WebCore::LibWebRTCDataChannelHandler::checkState):
2491         * Modules/mediastream/libwebrtc/LibWebRTCDataChannelHandler.h:
2492
2493 2018-12-10  Ryosuke Niwa  <rniwa@webkit.org>
2494
2495         Use WeakPtr to refer to VTTCue in VTTCueBox
2496         https://bugs.webkit.org/show_bug.cgi?id=192575
2497
2498         Reviewed by Eric Carlson.
2499
2500         Address the FIXME in VTTCue::~VTTCue by clearing VTTCueBox::m_cue when VTTCue goes away.
2501         This is implemented by simply using WeakPtr.
2502
2503         No new tests since there shoul be no behaivoral change.
2504
2505         * html/track/TextTrackCueGeneric.cpp:
2506         (WebCore::TextTrackCueGenericBoxElement::applyCSSProperties):
2507         * html/track/VTTCue.cpp:
2508         (WebCore::VTTCueBox::VTTCueBox):
2509         (WebCore::VTTCueBox::getCue const):
2510         (WebCore::VTTCueBox::applyCSSProperties):
2511         (WebCore::VTTCue::~VTTCue):
2512         * html/track/VTTCue.h:
2513         (WebCore::VTTCueBox::fontSizeFromCaptionUserPrefs const):
2514
2515 2018-12-10  Mark Lam  <mark.lam@apple.com>
2516
2517         PropertyAttribute needs a CustomValue bit.
2518         https://bugs.webkit.org/show_bug.cgi?id=191993
2519         <rdar://problem/46264467>
2520
2521         Reviewed by Saam Barati.
2522
2523         This patch revealed a bug in the CodeGenerator where a constructor property is
2524         set with a ReadOnly attribute.  This conflicts with the WebIDL link (see clause
2525         12 in https://heycam.github.io/webidl/#interface-prototype-object) which states
2526         that it should be [Writable].  The ReadOnly attribute is now removed.
2527
2528         On the WebCore side, this change is covered by existing tests.
2529
2530         * bindings/scripts/CodeGeneratorJS.pm:
2531         (GenerateImplementation):
2532         * bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.cpp:
2533         (WebCore::jsTestCustomConstructorWithNoInterfaceObjectConstructor):
2534
2535 2018-12-10  Antti Koivisto  <antti@apple.com>
2536
2537         Rename "forced style recalc" to "full style rebuild"
2538         https://bugs.webkit.org/show_bug.cgi?id=192572
2539
2540         Reviewed by Zalan Bujtas.
2541
2542         The old name is confusing.
2543
2544         * css/CSSComputedStyleDeclaration.cpp:
2545         (WebCore::hasValidStyleForProperty):
2546         * dom/Document.cpp:
2547         (WebCore::Document::scheduleStyleRebuild):
2548         (WebCore::Document::scheduleStyleRecalc):
2549         (WebCore::Document::unscheduleStyleRecalc):
2550         (WebCore::Document::hasPendingStyleRebuild const):
2551         (WebCore::Document::resolveStyle):
2552         (WebCore::Document::needsStyleRecalc const):
2553         (WebCore::Document::updateLayoutIgnorePendingStylesheets):
2554         (WebCore::Document::invalidateMatchedPropertiesCacheAndForceStyleRecalc):
2555         (WebCore::Document::setDesignMode):
2556         (WebCore::Document::webkitDidExitFullScreenForElement):
2557         (WebCore::Document::setAnimatingFullScreen):
2558         (WebCore::Document::setFullscreenControlsHidden):
2559         (WebCore::Document::scheduleForcedStyleRecalc): Deleted.
2560         (WebCore::Document::hasPendingForcedStyleRecalc const): Deleted.
2561         * dom/Document.h:
2562         * dom/Element.cpp:
2563         (WebCore::Element::needsStyleInvalidation const):
2564         * page/Page.cpp:
2565         (WebCore::Page::updateStyleAfterChangeInEnvironment):
2566         * style/StyleScope.cpp:
2567         (WebCore::Style::Scope::updateActiveStyleSheets):
2568
2569 2018-12-10  Alexey Proskuryakov  <ap@apple.com>
2570
2571         Include CoreGraphics.h from WebCorePrefix.h
2572         https://bugs.webkit.org/show_bug.cgi?id=192557
2573
2574         Reviewed by Tim Horton.
2575
2576         The theory is that this will improve build time. Let's try and see what bots say.
2577
2578         * WebCorePrefix.h:
2579
2580 2018-12-10  Wenson Hsieh  <wenson_hsieh@apple.com>
2581
2582         [iOS] Unable to upload data that conforms to "public.item" but not "public.content"
2583         https://bugs.webkit.org/show_bug.cgi?id=192555
2584         <rdar://problem/35204990>
2585
2586         Reviewed by Tim Horton.
2587
2588         Add support for uploading content that conforms to "public.item" via drag and drop. Currently, iOS WebKit only
2589         supports data that conforms to "public.content", but there exist several types of files that conform to
2590         "public.item" but not "public.content". See below for more detail.
2591
2592         Test: DragAndDropTests.ExternalSourcePKCS12ToSingleFileInput
2593
2594         * platform/ios/PasteboardIOS.mm:
2595         (WebCore::Pasteboard::supportedFileUploadPasteboardTypes):
2596
2597         Update this to include "public.item", and remove "public.folder", which is now redundant because "public.folder"
2598         conforms to "public.item".
2599
2600         * platform/ios/WebItemProviderPasteboard.mm:
2601         (-[NSItemProvider web_containsFileURLAndFileUploadContent]):
2602
2603         Pull out the "contains content that is supported for file uploads" part of this helper method into a separate
2604         method, and use it within `-web_containsFileURLAndFileUploadContent`. Note that this prevents "public.url"-
2605         conformant data from being uploaded as files (i.e., we never want to upload a URL string *itself* as a file).
2606         Drawing this distinction ensures that we don't confuse item providers that contain just a URL as files when
2607         dropping into a file upload area or file input (see API test: ExternalSourceZIPArchiveAndURLToSingleFileInput
2608         for an example of this corner case).
2609
2610         (-[NSItemProvider web_containsFileUploadContent]):
2611         (-[WebItemProviderPasteboard numberOfFiles]):
2612
2613         Refactor this to use `-web_containsFileUploadContent`.
2614
2615 2018-12-10  Chris Dumez  <cdumez@apple.com>
2616
2617         Add SPI to allow the client to set the user-agent at main frame level, from the UIProcess
2618         https://bugs.webkit.org/show_bug.cgi?id=192509
2619         <rdar://problem/46500832>
2620
2621         Reviewed by Alex Christensen.
2622
2623         * loader/DocumentLoader.h:
2624         (WebCore::DocumentLoader::setCustomUserAgent):
2625         (WebCore::DocumentLoader::customUserAgent const):
2626         * loader/FrameLoader.cpp:
2627         (WebCore::FrameLoader::userAgent const):
2628
2629 2018-12-10  Adrian Perez de Castro  <aperez@igalia.com>
2630
2631         [GLib] FileSystem::moveFile() should fall back to copying
2632         https://bugs.webkit.org/show_bug.cgi?id=192562
2633
2634         Reviewed by Michael Catanzaro.
2635
2636         No new tests needed.
2637
2638         * platform/glib/FileSystemGlib.cpp:
2639         (WebCore::FileSystem::moveFile): Use g_file_move() instead of a plain g_rename(), which
2640         provides a fall-back which does copy+delete when a direct move or rename cannot be done.
2641
2642 2018-12-10  Simon Fraser  <simon.fraser@apple.com>
2643
2644         Allow control over child order when adding nodes to the scrolling tree
2645         https://bugs.webkit.org/show_bug.cgi?id=176914
2646         <rdar://problem/46542237>
2647         
2648         Re-land r239010 after over-zealous rollout.
2649
2650         * page/scrolling/AsyncScrollingCoordinator.cpp:
2651         (WebCore::AsyncScrollingCoordinator::attachToStateTree):
2652         (WebCore::AsyncScrollingCoordinator::ensureRootStateNodeForFrameView):
2653         * page/scrolling/AsyncScrollingCoordinator.h:
2654         * page/scrolling/ScrollingCoordinator.h:
2655         (WebCore::ScrollingCoordinator::attachToStateTree):
2656         * page/scrolling/ScrollingStateNode.cpp:
2657         (WebCore::ScrollingStateNode::insertChild):
2658         (WebCore::ScrollingStateNode::indexOfChild const):
2659         * page/scrolling/ScrollingStateNode.h:
2660         * page/scrolling/ScrollingStateTree.cpp:
2661         (WebCore::ScrollingStateTree::nodeTypeAndParentMatch const):
2662         (WebCore::ScrollingStateTree::attachNode):
2663         * page/scrolling/ScrollingStateTree.h:
2664
2665 2018-12-10  Antti Koivisto  <antti@apple.com>
2666
2667         Document should throttle style recalc even when m_pendingStyleRecalcShouldForce is true.
2668         https://bugs.webkit.org/show_bug.cgi?id=191695
2669
2670         Reviewed by Zalan Bujtas.
2671
2672         * dom/Document.cpp:
2673         (WebCore::Document::scheduleStyleRecalc):
2674
2675         Don't test for m_pendingStyleRecalcShouldForce.
2676
2677         (WebCore::Document::hasPendingStyleRecalc const):
2678         (WebCore::Document::hasPendingForcedStyleRecalc const):
2679
2680         Don't base the pending status of these function on whether the timer is running.
2681         Instead check if the style is invalid.
2682
2683 2018-12-10  Rob Buis  <rbuis@igalia.com>
2684
2685         XMLHttpRequest removes spaces from content-types before processing
2686         https://bugs.webkit.org/show_bug.cgi?id=8644
2687
2688         Reviewed by Chris Dumez.
2689
2690         Stop trimming white space characters from the middle of
2691         type/subtype value. Also make sure whitespace being parsed
2692         adheres to OWS definition from RFC 7230 Section 3.2.3
2693         (referenced by RFC 7231), i.e. space or HT.
2694
2695         Based on http://crrev.com/416586.
2696
2697         Behavior matches Firefox and Chrome.
2698
2699         Tests: http/tests/xmlhttprequest/supported-xml-content-types.html
2700                web-platform-tests/mimesniff/mime-types/parsing.any.html
2701                web-platform-tests/mimesniff/mime-types/parsing.any.worker.html
2702
2703         * platform/network/HTTPParsers.cpp:
2704         (WebCore::extractMIMETypeFromMediaType):
2705
2706 2018-12-10  Wenson Hsieh  <wenson_hsieh@apple.com>
2707
2708         [iOS] Caret is obscured by finger when dragging over an editable element
2709         https://bugs.webkit.org/show_bug.cgi?id=192499
2710         <rdar://problem/46570101>
2711
2712         Reviewed by Tim Horton.
2713
2714         * page/DragActions.h:
2715
2716         Move DragHandlingMethod to DragActions.h, and drive-by fix some minor issues (i.e. make a couple of enum classes
2717         use 8 bits, fix the indentation levels, and update the copyright year). Also add `EnumTraits` for
2718         DragHandlingMethod so that it may be encoded over IPC.
2719
2720         * page/DragController.cpp:
2721         (WebCore::dragIsHandledByDocument):
2722
2723         Simplify this helper function.
2724
2725         (WebCore::DragController::tryDocumentDrag):
2726         * page/DragController.h:
2727
2728         Expose the current DragHandlingMethod via a const getter method.
2729
2730         (WebCore::DragController::dragHandlingMethod const):
2731
2732 2018-12-10  Youenn Fablet  <youenn@apple.com>
2733
2734         Make mock capture happen in the process used for real capture
2735         https://bugs.webkit.org/show_bug.cgi?id=192544
2736
2737         Reviewed by Eric Carlson.
2738
2739         MockRealtimeMediaSourceCenter previously was setting its factories whenever mock capture is on.
2740         Add booleans to choose which source (audio, video, display) will actually be toggled on.
2741
2742         Covered by existing tests.
2743
2744         * platform/mock/MockRealtimeMediaSourceCenter.cpp:
2745         (WebCore::MockRealtimeMediaSourceCenter::setMockRealtimeMediaSourceCenterEnabled):
2746         * platform/mock/MockRealtimeMediaSourceCenter.h:
2747         (WebCore::MockRealtimeMediaSourceCenter::setMockAudioCaptureEnabled):
2748         (WebCore::MockRealtimeMediaSourceCenter::setMockVideoCaptureEnabled):
2749         (WebCore::MockRealtimeMediaSourceCenter::setMockDisplayCaptureEnabled):
2750
2751 2018-12-10  Dean Jackson  <dino@apple.com>
2752
2753         Use text/javascript as recommended by the HTML specification
2754         https://bugs.webkit.org/show_bug.cgi?id=192525
2755         <rdar://problem/46569636>
2756
2757         Reviewed by Jon Lee.
2758
2759         The HTML specification says we should use text/javascript for
2760         JavaScript files:
2761         https://html.spec.whatwg.org/multipage/scripting.html#scriptingLanguages:javascript-mime-type
2762
2763         * loader/cache/CachedScript.cpp: Replace application/javascript with text/javascript.
2764         (WebCore::CachedScript::CachedScript):
2765         * platform/network/ios/WebCoreURLResponseIOS.mm: Ditto.
2766         (WebCore::createExtensionToMIMETypeMap):
2767         * platform/network/mac/WebCoreURLResponse.mm: Ditto.
2768         (WebCore::createExtensionToMIMETypeMap):
2769
2770 2018-12-10  Dean Jackson  <dino@apple.com>
2771
2772         [iOS] Make WebGPU work with remote layer hosting
2773         https://bugs.webkit.org/show_bug.cgi?id=192508
2774         <rdar://problem/46560649>
2775
2776         Reviewed by Tim Horton.
2777
2778         WebGPU wasn't working on iOS because we were not correctly
2779         identifying the CALayers for remote hosting. Fix this by
2780         adding a new CALayer type, WebGPULayer. This will also
2781         eventually hold the code to render WebGPU into a canvas.
2782
2783         Covered by the existing reference tests (on device).
2784
2785         * SourcesCocoa.txt: Add new files.
2786         * WebCore.xcodeproj/project.pbxproj: Ditto.
2787
2788         * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm: Recognise the WebGPULayer
2789         class for remote hosting.
2790         (WebCore::PlatformCALayerCocoa::layerTypeForPlatformLayer):
2791         (WebCore::PlatformCALayerCocoa::PlatformCALayerCocoa):
2792
2793         * platform/graphics/cocoa/WebGPULayer.h: Added. Very simple inheritance
2794         from CAMetalLayer.
2795         * platform/graphics/cocoa/WebGPULayer.mm: Added.
2796         (-[WebGPULayer init]):
2797         (-[WebGPULayer copyImageSnapshotWithColorSpace:]):
2798
2799         * platform/graphics/gpu/GPUSwapChain.h: Reference WebGPULayer rather
2800         than CALayer.
2801
2802         * platform/graphics/gpu/cocoa/GPUSwapChainMetal.mm: Ensure that
2803         the WebGPULayer has a reference back to this object, which it
2804         will use in the future.
2805         (WebCore::GPUSwapChain::create):
2806         (WebCore::GPUSwapChain::GPUSwapChain):
2807
2808 2018-12-10  Truitt Savell  <tsavell@apple.com>
2809
2810         Unreviewed, rolling out r238965.
2811
2812         Caused internal iOS build failures
2813
2814         Reverted changeset:
2815
2816         "[iOS] Make WebGPU work with remote layer hosting"
2817         https://bugs.webkit.org/show_bug.cgi?id=192508
2818         https://trac.webkit.org/changeset/238965
2819
2820 2018-12-10  Youenn Fablet  <youenn@apple.com>
2821
2822         MockLibWebRTCPeerConnectionFactory should isolate copy its test case
2823         https://bugs.webkit.org/show_bug.cgi?id=192545
2824
2825         Reviewed by Eric Carlson.
2826
2827         Isolate copy the test case member so that it can be destroyed on another thread.
2828         Covered by existing test that should no longer crash.
2829
2830         * testing/MockLibWebRTCPeerConnection.cpp:
2831         (WebCore::useMockRTCPeerConnectionFactory):
2832         (WebCore::MockLibWebRTCPeerConnectionFactory::MockLibWebRTCPeerConnectionFactory):
2833         * testing/MockLibWebRTCPeerConnection.h:
2834         (WebCore::MockLibWebRTCPeerConnectionFactory::create):
2835
2836 2018-12-09  Youenn Fablet  <youenn@apple.com>
2837
2838         Move capture manager from RealtimeMediaSourceCenter to capture factory
2839         https://bugs.webkit.org/show_bug.cgi?id=192542
2840
2841         Reviewed by Eric Carlson.
2842
2843         We should be able to run mock captures in wither UIProcess or WebProcess.
2844         Currently, mock capture is only done in WebProcess.
2845         This patch is a first step towards that goal.
2846
2847         It also simplifies RealtimeMediaSourceCenter implementation by starting to remove virtual methods.
2848         Further refactoring will remove the need to subclass RealtimeMediaSourceCenter.
2849         Instead, remaining virtual methods will become non virtual and their
2850         implementation will become port specific.
2851
2852         Removed a JS internal method that is not longer used to further simplify RealtimeMediaSourceCenter.
2853
2854         No visible change of behavior.
2855         Covered by existing tests.
2856
2857         * platform/mediastream/CaptureDeviceManager.h:
2858         * platform/mediastream/RealtimeMediaSourceCenter.cpp:
2859         (WebCore::RealtimeMediaSourceCenter::singleton):
2860         (WebCore::RealtimeMediaSourceCenter::getMediaStreamDevices):
2861         (WebCore::RealtimeMediaSourceCenter::getDisplayMediaDevices):
2862         (WebCore::RealtimeMediaSourceCenter::getUserMediaDevices):
2863         (WebCore::RealtimeMediaSourceCenter::captureDeviceWithPersistentID):
2864         (WebCore::RealtimeMediaSourceCenter::unsetAudioFactory):
2865         (WebCore::RealtimeMediaSourceCenter::unsetVideoFactory):
2866         (WebCore::RealtimeMediaSourceCenter::unsetDisplayCaptureFactory):
2867         * platform/mediastream/RealtimeMediaSourceCenter.h:
2868         * platform/mediastream/RealtimeMediaSourceFactory.h:
2869         * platform/mediastream/gstreamer/GStreamerAudioCaptureSource.cpp:
2870         * platform/mediastream/gstreamer/GStreamerVideoCaptureSource.cpp:
2871         * platform/mediastream/gstreamer/RealtimeMediaSourceCenterLibWebRTC.cpp:
2872         * platform/mediastream/gstreamer/RealtimeMediaSourceCenterLibWebRTC.h:
2873         * platform/mediastream/mac/CoreAudioCaptureSource.cpp:
2874         (WebCore::CoreAudioCaptureSourceFactory::audioCaptureDeviceManager):
2875         * platform/mediastream/mac/CoreAudioCaptureSource.h:
2876         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp:
2877         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.h:
2878         * platform/mock/MockRealtimeMediaSourceCenter.cpp:
2879         (WebCore::MockRealtimeMediaSourceCenter::setMockRealtimeMediaSourceCenterEnabled):
2880         (WebCore::MockRealtimeMediaSourceCenter::audioFactory):
2881         (WebCore::MockRealtimeMediaSourceCenter::videoFactory):
2882         (WebCore::MockRealtimeMediaSourceCenter::displayCaptureFactory):
2883         * platform/mock/MockRealtimeMediaSourceCenter.h:
2884         (WebCore::MockRealtimeMediaSourceCenter::audioCaptureDeviceManager):
2885         (WebCore::MockRealtimeMediaSourceCenter::videoCaptureDeviceManager):
2886         (WebCore::MockRealtimeMediaSourceCenter::displayCaptureDeviceManager):
2887         * testing/Internals.cpp:
2888         * testing/Internals.h:
2889         * testing/Internals.idl:
2890
2891 2018-12-09  Commit Queue  <commit-queue@webkit.org>
2892
2893         Unreviewed, rolling out r239010.
2894         https://bugs.webkit.org/show_bug.cgi?id=192537
2895
2896         Breaks fast/visual-viewport/tiled-drawing/zoomed-fixed-
2897         scrolling-layers-state.html again (Requested by ap on
2898         #webkit).
2899
2900         Reverted changeset:
2901
2902         "Allow control over child order when adding nodes to the
2903         scrolling tree"
2904         https://bugs.webkit.org/show_bug.cgi?id=176914
2905         https://trac.webkit.org/changeset/239010
2906
2907 2018-12-08  Eric Carlson  <eric.carlson@apple.com>
2908
2909         [MediaStream] Scaled video frames should be resized in letterbox mode
2910         https://bugs.webkit.org/show_bug.cgi?id=192528
2911         <rdar://problem/46576638>
2912
2913         Reviewed by Darin Adler.
2914
2915         Test: fast/mediastream/resize-letterbox.html
2916
2917         * platform/graphics/cv/ImageTransferSessionVT.mm:
2918         (WebCore::ImageTransferSessionVT::ImageTransferSessionVT): Use letterbox resize mode, not trim.
2919
2920         * platform/mock/MockRealtimeVideoSource.cpp:
2921         (WebCore::MockRealtimeVideoSource::captureSize const): "Capture" at the preset size, not 
2922         necessarily at the requested size to be more like a physical camera.
2923         (WebCore::MockRealtimeVideoSource::settingsDidChange):
2924         (WebCore::MockRealtimeVideoSource::drawAnimation):
2925         (WebCore::MockRealtimeVideoSource::drawBoxes):
2926         (WebCore::MockRealtimeVideoSource::drawText):
2927         (WebCore::MockRealtimeVideoSource::generateFrame):
2928         (WebCore::MockRealtimeVideoSource::imageBuffer const):
2929         * platform/mock/MockRealtimeVideoSource.h:
2930
2931 2018-12-08  Alex Christensen  <achristensen@webkit.org>
2932
2933         Don't programmatically capitalize safe browsing warning buttons
2934         https://bugs.webkit.org/show_bug.cgi?id=192531
2935         <rdar://problem/46417791>
2936
2937         Reviewed by Darin Adler.
2938
2939         This doesn't work so well in other languages.
2940         Capitalize the source strings in English instead.
2941
2942         * en.lproj/Localizable.strings:
2943
2944 2018-12-08  Frederic Wang  <fwang@igalia.com>
2945
2946         Allow control over child order when adding nodes to the scrolling tree
2947         https://bugs.webkit.org/show_bug.cgi?id=176914
2948         <rdar://problem/46542237>
2949
2950         Reviewed by Simon Fraser.
2951
2952         Based on an earlier patch by Simon Fraser.
2953
2954         Previously ScrollingCoordinator just allowed nodes to be "attached" with a given parent,
2955         but with no control over sibling order. To allow for correct hit-testing overflow and
2956         frame scrolling nodes, we have to build the scrolling tree in z-order.
2957
2958         This patch adds a 'childIndex' parameter to attachNode() which gives control over
2959         sibling order. For now, RenderLayerCompositor always uses the default 'notFound' value
2960         for childIndex so the current behavior (appending new nodes at the end of child list) is
2961         preserved.
2962
2963         One test marked as flakey, since scrolling tree order is currently dependent on HashSet
2964         traversal order.
2965
2966         * page/scrolling/AsyncScrollingCoordinator.cpp:
2967         (WebCore::AsyncScrollingCoordinator::attachToStateTree):
2968         (WebCore::AsyncScrollingCoordinator::ensureRootStateNodeForFrameView):
2969         * page/scrolling/AsyncScrollingCoordinator.h:
2970         * page/scrolling/ScrollingCoordinator.h:
2971         (WebCore::ScrollingCoordinator::attachToStateTree):
2972         * page/scrolling/ScrollingStateNode.cpp:
2973         (WebCore::ScrollingStateNode::insertChild):
2974         (WebCore::ScrollingStateNode::indexOfChild const):
2975         * page/scrolling/ScrollingStateNode.h:
2976         * page/scrolling/ScrollingStateTree.cpp:
2977         (WebCore::ScrollingStateTree::nodeTypeAndParentMatch const):
2978         (WebCore::ScrollingStateTree::attachNode):
2979         * page/scrolling/ScrollingStateTree.h:
2980
2981 2018-12-07  Eric Carlson  <eric.carlson@apple.com>
2982
2983         [MediaStream] 'devicechange' event should not fire in frames that can't access capture devices
2984         https://bugs.webkit.org/show_bug.cgi?id=192511
2985         <rdar://problem/46562063>
2986
2987         Reviewed by Youenn Fablet.
2988
2989         Test: http/tests/media/media-stream/device-change-event-in-iframe.html
2990
2991         * Modules/mediastream/MediaDevices.cpp:
2992         (WebCore::MediaDevices::addEventListener): Don't fire the event unless the document can
2993         access a camera or microphone.
2994
2995 2018-12-07  Eric Carlson  <eric.carlson@apple.com>
2996
2997         [MediaStream] Address post-review comments after r238904
2998         https://bugs.webkit.org/show_bug.cgi?id=192514
2999         <rdar://problem/46564302>
3000
3001         Reviewed by Youenn Fablet.
3002
3003         No new tests, no functional change.
3004
3005         * platform/graphics/cv/ImageTransferSessionVT.mm:
3006         (WebCore::ImageTransferSessionVT::setSize):
3007         * platform/mediastream/mac/ScreenDisplayCaptureSourceMac.mm:
3008         (WebCore::ScreenDisplayCaptureSourceMac::createDisplayStream):
3009
3010 2018-12-07  Antti Koivisto  <antti@apple.com>
3011
3012         [LFC] Rename LayoutFormattingState files to LayoutState
3013         https://bugs.webkit.org/show_bug.cgi?id=192520
3014
3015         Reviewed by Zalan Bujtas.
3016
3017         Match the class name.
3018
3019         * layout/FormattingContext.cpp:
3020         * layout/FormattingContextQuirks.cpp:
3021         * layout/FormattingState.h:
3022         * layout/LayoutFormattingState.cpp: Removed.
3023         * layout/LayoutFormattingState.h: Removed.
3024         * layout/LayoutState.cpp: Copied from Source/WebCore/layout/LayoutFormattingState.cpp.
3025         * layout/LayoutState.h: Copied from Source/WebCore/layout/LayoutFormattingState.h.
3026         * layout/Verification.cpp:
3027         * layout/blockformatting/BlockFormattingContext.cpp:
3028         * layout/blockformatting/BlockFormattingContextQuirks.cpp:
3029         * layout/blockformatting/BlockInvalidation.cpp:
3030         * layout/floats/FloatAvoider.cpp:
3031         * layout/floats/FloatingContext.cpp:
3032         * layout/floats/FloatingState.cpp:
3033         * layout/inlineformatting/InlineFormattingContext.cpp:
3034         * layout/inlineformatting/InlineFormattingContextGeometry.cpp:
3035         * layout/inlineformatting/InlineInvalidation.cpp:
3036         * layout/layouttree/LayoutTreeBuilder.cpp:
3037         * page/FrameViewLayoutContext.cpp:
3038
3039 2018-12-07  Justin Michaud  <justin_michaud@apple.com>
3040
3041         CSS Painting API code cleanup
3042         https://bugs.webkit.org/show_bug.cgi?id=192480
3043
3044         Reviewed by Dean Jackson.
3045
3046         No new tests, since the existing tests should cover it.
3047
3048         * bindings/js/JSDOMWrapper.cpp:
3049         (WebCore::outputConstraintSubspaceFor):
3050         (WebCore::globalObjectOutputConstraintSubspaceFor):
3051         * bindings/js/JSWorkletGlobalScopeBase.cpp:
3052         (WebCore::toJS):
3053         * css/CSSPaintCallback.h:
3054         * platform/graphics/CustomPaintImage.cpp:
3055         (WebCore::CustomPaintImage::doCustomPaint):
3056         * platform/graphics/CustomPaintImage.h:
3057         * rendering/style/RenderStyle.cpp:
3058         (WebCore::RenderStyle::addCustomPaintWatchProperty):
3059         (WebCore::changedCustomPaintWatchedProperty):
3060         (WebCore::RenderStyle::changeRequiresRepaint const):
3061         * worklets/PaintWorkletGlobalScope.cpp:
3062         (WebCore::PaintWorkletGlobalScope::registerPaint):
3063         * worklets/PaintWorkletGlobalScope.h:
3064
3065 2018-12-07  Youenn Fablet  <youenn@apple.com>
3066
3067         Update libwebrtc up to 0d007d7c4f
3068         https://bugs.webkit.org/show_bug.cgi?id=192316
3069
3070         Reviewed by Eric Carlson.
3071
3072         Update include according new libwebrtc.
3073
3074         * platform/mediastream/libwebrtc/LibWebRTCProvider.cpp:
3075
3076 2018-12-07  Dean Jackson  <dino@apple.com>
3077
3078         [iOS] Make WebGPU work with remote layer hosting
3079         https://bugs.webkit.org/show_bug.cgi?id=192508
3080         <rdar://problem/46560649>
3081
3082         Reviewed by Tim Horton.
3083
3084         WebGPU wasn't working on iOS because we were not correctly
3085         identifying the CALayers for remote hosting. Fix this by
3086         adding a new CALayer type, WebGPULayer. This will also
3087         eventually hold the code to render WebGPU into a canvas.
3088
3089         Covered by the existing reference tests (on device).
3090
3091         * SourcesCocoa.txt: Add new files.
3092         * WebCore.xcodeproj/project.pbxproj: Ditto.
3093
3094         * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm: Recognise the WebGPULayer
3095         class for remote hosting.
3096         (WebCore::PlatformCALayerCocoa::layerTypeForPlatformLayer):
3097         (WebCore::PlatformCALayerCocoa::PlatformCALayerCocoa):
3098
3099         * platform/graphics/cocoa/WebGPULayer.h: Added. Very simple inheritance
3100         from CAMetalLayer.
3101         * platform/graphics/cocoa/WebGPULayer.mm: Added.
3102         (-[WebGPULayer init]):
3103         (-[WebGPULayer copyImageSnapshotWithColorSpace:]):
3104
3105         * platform/graphics/gpu/GPUSwapChain.h: Reference WebGPULayer rather
3106         than CALayer.
3107
3108         * platform/graphics/gpu/cocoa/GPUSwapChainMetal.mm: Ensure that
3109         the WebGPULayer has a reference back to this object, which it
3110         will use in the future.
3111         (WebCore::GPUSwapChain::create):
3112         (WebCore::GPUSwapChain::GPUSwapChain):
3113
3114 2018-12-07  Antti Koivisto  <antti@apple.com>
3115
3116         Rename LayoutState to RenderLayoutState
3117         https://bugs.webkit.org/show_bug.cgi?id=192504
3118
3119         Reviewed by Zalan Bujtas.
3120
3121         The name is better used in LFC.
3122
3123         * Sources.txt:
3124         * WebCore.xcodeproj/project.pbxproj:
3125         * page/FrameViewLayoutContext.cpp:
3126         (WebCore::FrameViewLayoutContext::layoutState const):
3127         (WebCore::FrameViewLayoutContext::pushLayoutState):
3128         (WebCore::FrameViewLayoutContext::pushLayoutStateForPaginationIfNeeded):
3129         * page/FrameViewLayoutContext.h:
3130         * rendering/LayoutState.cpp: Removed.
3131         * rendering/LayoutState.h: Removed.
3132         * rendering/RenderBlock.cpp:
3133         * rendering/RenderBlock.h:
3134         * rendering/RenderBlockFlow.cpp:
3135         (WebCore::RenderBlockFlow::checkForPaginationLogicalHeightChange):
3136         * rendering/RenderBlockLineLayout.cpp:
3137         * rendering/RenderBox.cpp:
3138         * rendering/RenderEmbeddedObject.cpp:
3139         * rendering/RenderFragmentedFlow.cpp:
3140         * rendering/RenderGrid.cpp:
3141         * rendering/RenderImage.cpp:
3142         * rendering/RenderInline.cpp:
3143         * rendering/RenderLayoutState.cpp: Copied from Source/WebCore/rendering/LayoutState.cpp.
3144         (WebCore::RenderLayoutState::RenderLayoutState):
3145         (WebCore::RenderLayoutState::computeOffsets):
3146         (WebCore::RenderLayoutState::computeClipRect):
3147         (WebCore::RenderLayoutState::computePaginationInformation):
3148         (WebCore::RenderLayoutState::pageLogicalOffset const):
3149         (WebCore::RenderLayoutState::computeLineGridPaginationOrigin):
3150         (WebCore::RenderLayoutState::propagateLineGridInfo):
3151         (WebCore::RenderLayoutState::establishLineGrid):
3152         (WebCore::RenderLayoutState::addLayoutDelta):
3153         (WebCore::RenderLayoutState::layoutDeltaMatches const):
3154         (WebCore::LayoutState::LayoutState): Deleted.
3155         (WebCore::LayoutState::computeOffsets): Deleted.
3156         (WebCore::LayoutState::computeClipRect): Deleted.
3157         (WebCore::LayoutState::computePaginationInformation): Deleted.
3158         (WebCore::LayoutState::pageLogicalOffset const): Deleted.
3159         (WebCore::LayoutState::computeLineGridPaginationOrigin): Deleted.
3160         (WebCore::LayoutState::propagateLineGridInfo): Deleted.
3161         (WebCore::LayoutState::establishLineGrid): Deleted.
3162         (WebCore::LayoutState::addLayoutDelta): Deleted.
3163         (WebCore::LayoutState::layoutDeltaMatches const): Deleted.
3164         * rendering/RenderLayoutState.h: Copied from Source/WebCore/rendering/LayoutState.h.
3165         (WebCore::RenderLayoutState::RenderLayoutState):
3166         (WebCore::LayoutState::LayoutState): Deleted.
3167         (WebCore::LayoutState::isPaginated const): Deleted.
3168         (WebCore::LayoutState::pageLogicalHeight const): Deleted.
3169         (WebCore::LayoutState::pageLogicalHeightChanged const): Deleted.
3170         (WebCore::LayoutState::lineGrid const): Deleted.
3171         (WebCore::LayoutState::lineGridOffset const): Deleted.
3172         (WebCore::LayoutState::lineGridPaginationOrigin const): Deleted.
3173         (WebCore::LayoutState::paintOffset const): Deleted.
3174         (WebCore::LayoutState::layoutOffset const): Deleted.
3175         (WebCore::LayoutState::pageOffset const): Deleted.
3176         (WebCore::LayoutState::needsBlockDirectionLocationSetBeforeLayout const): Deleted.
3177         (WebCore::LayoutState::renderer const): Deleted.
3178         (WebCore::LayoutState::clipRect const): Deleted.
3179         (WebCore::LayoutState::isClipped const): Deleted.
3180         (WebCore::LayoutState::layoutDelta const): Deleted.
3181         * rendering/RenderListBox.cpp:
3182         * rendering/RenderMediaControlElements.cpp:
3183         * rendering/RenderMultiColumnFlow.cpp:
3184         * rendering/RenderTable.cpp:
3185         * rendering/RenderTableRow.cpp:
3186         * rendering/RenderTableSection.cpp:
3187         * rendering/RenderVTTCue.cpp:
3188         * rendering/RenderView.cpp:
3189         * rendering/RenderView.h:
3190         * rendering/RootInlineBox.cpp:
3191         * rendering/svg/RenderSVGRoot.cpp:
3192         (WebCore::RenderSVGRoot::layout):
3193
3194 2018-12-07  Antti Koivisto  <antti@apple.com>
3195
3196         [LFC] Rename formattingContext() to createFormattingContext()
3197         https://bugs.webkit.org/show_bug.cgi?id=192500
3198
3199         Reviewed by Zalan Bujtas.
3200
3201         * layout/FormattingContext.cpp:
3202         (WebCore::Layout::FormattingContext::layoutOutOfFlowDescendants const):
3203         * layout/FormattingState.h:
3204         * layout/LayoutFormattingState.cpp:
3205         (WebCore::Layout::LayoutState::layoutFormattingContextSubtree):
3206         * layout/blockformatting/BlockFormattingState.cpp:
3207         (WebCore::Layout::BlockFormattingState::createFormattingContext):
3208         (WebCore::Layout::BlockFormattingState::formattingContext): Deleted.
3209         * layout/blockformatting/BlockFormattingState.h:
3210         * layout/inlineformatting/InlineFormattingContext.cpp:
3211         (WebCore::Layout::InlineFormattingContext::layoutFormattingContextRoot const):
3212         * layout/inlineformatting/InlineFormattingState.h:
3213
3214 2018-12-07  Truitt Savell  <tsavell@apple.com>
3215
3216         Unreviewed, rolling out r238947.
3217
3218         Revision caused fast/visual-viewport/tiled-drawing/zoomed-
3219         fixed-scrolling-layers-state.html to constantly fail
3220
3221         Reverted changeset:
3222
3223         "Allow control over child order when adding nodes to the
3224         scrolling tree"
3225         https://bugs.webkit.org/show_bug.cgi?id=176914
3226         https://trac.webkit.org/changeset/238947
3227
3228 2018-12-07  Wenson Hsieh  <wenson_hsieh@apple.com>
3229
3230         [Attachment Support] Cloned attachment elements lose their unique identifiers
3231         https://bugs.webkit.org/show_bug.cgi?id=192483
3232
3233         Reviewed by Tim Horton.
3234
3235         This patch adds logic to ensure that the unique identifier of a cloned attachment element is the same as the
3236         unique identifier of the original attachment element. If the cloned attachment is inserted into the same
3237         document as the original attachment, then we will exercise the same codepath for copied-and-pasted attachments,
3238         and assign a new unique identifier to the attachment element, while creating a new `_WKAttachment` in the client
3239         that's backed by the same `NSFileWrapper`.
3240
3241         Test: WKAttachmentTests.AttachmentIdentifierOfClonedAttachment
3242
3243         * html/HTMLAttachmentElement.cpp:
3244         (WebCore::HTMLAttachmentElement::copyNonAttributePropertiesFromElement):
3245         * html/HTMLAttachmentElement.h:
3246
3247 2018-12-07  Rob Buis  <rbuis@igalia.com>
3248
3249         Merge parseAccessControlExposeHeadersAllowList into parseAccessControlAllowList
3250         https://bugs.webkit.org/show_bug.cgi?id=192288
3251
3252         Reviewed by Frédéric Wang.
3253
3254         Merge parseAccessControlExposeHeadersAllowList into parseAccessControlAllowList
3255         as they do the same thing. Also remove std::optional from parseAccessControlAllowList
3256         since the function can't fail.
3257
3258         * WebCore.order:
3259         * loader/CrossOriginAccessControl.cpp:
3260         (WebCore::validatePreflightResponse):
3261         * loader/CrossOriginPreflightResultCache.cpp:
3262         (WebCore::CrossOriginPreflightResultCacheItem::parse):
3263         * loader/CrossOriginPreflightResultCache.h:
3264         * platform/network/HTTPParsers.cpp:
3265         (WebCore::parseAccessControlExposeHeadersAllowList): Deleted.
3266         * platform/network/HTTPParsers.h:
3267         (WebCore::parseAccessControlAllowList):
3268         * platform/network/ResourceResponseBase.cpp:
3269         (WebCore::ResourceResponseBase::filter):
3270         (WebCore::ResourceResponseBase::sanitizeHTTPHeaderFieldsAccordingToTainting):
3271
3272 2018-12-07  Eric Carlson  <eric.carlson@apple.com>
3273
3274         [iOS] Don't update AVPlayerViewController currentTime while scrubbing
3275         https://bugs.webkit.org/show_bug.cgi?id=192438
3276         <rdar://problem/42977046>
3277
3278         Reviewed by Jer Noble.
3279
3280         No new tests, tested manually.
3281
3282         * platform/ios/PlaybackSessionInterfaceAVKit.mm:
3283         (WebCore::PlaybackSessionInterfaceAVKit::currentTimeChanged): Don't report change during scrubbing.
3284
3285         * platform/ios/WebAVPlayerController.h:
3286         * platform/ios/WebAVPlayerController.mm:
3287         (-[WebAVPlayerController beginScrubbing:]): Set _isScrubbing.
3288         (-[WebAVPlayerController endScrubbing:]): Ditto.
3289         (-[WebAVPlayerController isScrubbing]): Return _isScrubbing.
3290
3291 2018-12-07  Thibault Saunier  <tsaunier@igalia.com>
3292
3293         [WPE][GTK] Implement WebAudioSourceProviderGStreamer to allow bridging MediaStream and the WebAudio APIs
3294         https://bugs.webkit.org/show_bug.cgi?id=186933
3295
3296         Reusing the AudioSourceProviderGStreamer itself as it was doing almost everything we needed,
3297         just added a constructor to be able to create it from a MediaStreamTrackPrivate and made it a
3298         WebAudioSourceProvider which only means it is now a ThreadSafeRefCounted.
3299
3300         Sensibily refactored GStreamerMediaStreamSource so that we could reuse it to track a single
3301         MediaStreamTrack.
3302
3303         Reviewed by Philippe Normand.
3304
3305         Enabled all tests depending on that feature.
3306
3307         * platform/audio/gstreamer/AudioSourceProviderGStreamer.cpp:
3308         (WebCore::AudioSourceProviderGStreamer::AudioSourceProviderGStreamer):
3309         (WebCore::AudioSourceProviderGStreamer::~AudioSourceProviderGStreamer):
3310         (WebCore::AudioSourceProviderGStreamer::setClient):
3311         * platform/audio/gstreamer/AudioSourceProviderGStreamer.h:
3312         * platform/mediastream/MediaStreamTrackPrivate.cpp:
3313         (WebCore::MediaStreamTrackPrivate::audioSourceProvider):
3314         * platform/mediastream/gstreamer/GStreamerAudioCapturer.cpp:
3315         (WebCore::GStreamerAudioCapturer::GStreamerAudioCapturer):
3316         * platform/mediastream/gstreamer/GStreamerAudioStreamDescription.h:
3317         * platform/mediastream/gstreamer/GStreamerMediaStreamSource.cpp:
3318         (WebCore::webkitMediaStreamSrcSetupSrc):
3319         (WebCore::webkitMediaStreamSrcSetupAppSrc):
3320         (WebCore::webkitMediaStreamSrcAddTrack):
3321         (WebCore::webkitMediaStreamSrcSetStream):
3322         (WebCore::webkitMediaStreamSrcNew):
3323         * platform/mediastream/gstreamer/GStreamerMediaStreamSource.h:
3324         * platform/mediastream/gstreamer/MockGStreamerAudioCaptureSource.cpp:
3325         (WebCore::WrappedMockRealtimeAudioSource::WrappedMockRealtimeAudioSource):
3326         (WebCore::WrappedMockRealtimeAudioSource::start):
3327         (WebCore::WrappedMockRealtimeAudioSource::addHum):
3328         (WebCore::WrappedMockRealtimeAudioSource::render):
3329         (WebCore::WrappedMockRealtimeAudioSource::settingsDidChange):
3330         (WebCore::MockGStreamerAudioCaptureSource::startProducingData):
3331         * platform/mediastream/gstreamer/RealtimeOutgoingAudioSourceLibWebRTC.cpp:
3332         (WebCore::RealtimeOutgoingAudioSourceLibWebRTC::pullAudioData): Handle the case where input buffers
3333           are "big" and process all the data we can for each runs of the method.
3334
3335 2018-12-06  Alexey Proskuryakov  <ap@apple.com>
3336
3337         Move USE_NEW_THEME out of WebCore's config.h
3338         https://bugs.webkit.org/show_bug.cgi?id=192426
3339
3340         Reviewed by Tim Horton.
3341
3342         * config.h:
3343
3344 2018-12-06  Frederic Wang  <fwang@igalia.com>
3345
3346         Allow control over child order when adding nodes to the scrolling tree
3347         https://bugs.webkit.org/show_bug.cgi?id=176914
3348
3349         Reviewed by Simon Fraser.
3350
3351         Based on an earlier patch by Simon Fraser.
3352
3353         Previously ScrollingCoordinator just allowed nodes to be "attached" with a given parent,
3354         but with no control over sibling order. To allow for correct hit-testing overflow and
3355         frame scrolling nodes, we have to build the scrolling tree in z-order.
3356
3357         This patch adds a 'childIndex' parameter to attachNode() which gives control over
3358         sibling order. For now, RenderLayerCompositor always uses the default 'notFound' value
3359         for childIndex so the current behavior (appending new nodes at the end of child list) is
3360         preserved.
3361
3362         No new tests, behavior unchanged and already covered by existing tests.
3363
3364         * page/scrolling/AsyncScrollingCoordinator.cpp:
3365         (WebCore::AsyncScrollingCoordinator::attachToStateTree):
3366         (WebCore::AsyncScrollingCoordinator::ensureRootStateNodeForFrameView):
3367         * page/scrolling/AsyncScrollingCoordinator.h:
3368         * page/scrolling/ScrollingCoordinator.h:
3369         (WebCore::ScrollingCoordinator::attachToStateTree):
3370         * page/scrolling/ScrollingStateNode.cpp:
3371         (WebCore::ScrollingStateNode::insertChild):
3372         (WebCore::ScrollingStateNode::indexOfChild const):
3373         * page/scrolling/ScrollingStateNode.h:
3374         * page/scrolling/ScrollingStateTree.cpp:
3375         (WebCore::ScrollingStateTree::nodeTypeAndParentMatch const):
3376         (WebCore::ScrollingStateTree::attachNode):
3377         * page/scrolling/ScrollingStateTree.h:
3378
3379 2018-12-06  Yongjun Zhang  <yongjun_zhang@apple.com>
3380
3381         We should ignore minimumEffectiveDeviceWidth if the page specifies device-width in viewport meta-tag.
3382         https://bugs.webkit.org/show_bug.cgi?id=192377
3383         <rdar://problem/46364206>
3384
3385         Reviewed by Tim Horton.
3386
3387         If the page specifies width=device-width or initial-scale=1 in the viewport meta tag, we should use the
3388         native device width and ignore the minimum effective device width in ViewportConfiguration. The patch
3389         also introduces scalableNativeWebpageParameters() which uses the device width as default and also allows the page
3390         to shrink-to-fit. If a page doesn't have viewport meta tag, or if the width argument isn't device-width
3391         and the initial scale isn't 1, we will use scalableNativeWebpageParameters() as the default configuration.
3392