7d4bff3981c93dcf51b777bc240e63317a7f1e19
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2017-12-19  Jer Noble  <jer.noble@apple.com>
2
3         Playing media elements which call "pause(); play()" will have the play promise rejected.
4         https://bugs.webkit.org/show_bug.cgi?id=180781
5         <rdar://problem/33191377>
6
7         Reviewed by Eric Carlson.
8
9         Follow-up to address failing iOS API tests. Rather than skipping the call to
10         prepareForLoad() in the case where media elements are not allowed to load data,
11         unconditionally call prepareForLoad(), but conditionally call selectMediaResource() inside
12         that function only if the media elemnet is allowed to load. This ensures that the
13         MediaPlayer is created when play(), pause(), or load() are called during a user gesture
14         later, and selectMediaResource() (which depends on having a non-null m_player) is called.
15
16         * html/HTMLMediaElement.cpp:
17         (WebCore::HTMLMediaElement::parseAttribute):
18         (WebCore::HTMLMediaElement::insertedIntoAncestor):
19         (WebCore::HTMLMediaElement::load):
20         (WebCore::HTMLMediaElement::prepareForLoad):
21         (WebCore::HTMLMediaElement::playInternal):
22
23 2017-12-19  Timothy Hatcher  <timothy@hatcher.name>
24
25         Build failure in WebGL2 when Video feature is disabled
26         https://bugs.webkit.org/show_bug.cgi?id=180946
27
28         Reviewed by Brian Burg.
29
30         * html/canvas/WebGL2RenderingContext.h: Make TexImageSource conditional on ENABLE(VIDEO).
31         * html/canvas/WebGL2RenderingContext.idl: Ditto.
32
33 2017-12-19  Chris Dumez  <cdumez@apple.com>
34
35         scopeURL should start with the provided scriptURL
36         https://bugs.webkit.org/show_bug.cgi?id=180983
37
38         Reviewed by Youenn Fablet.
39
40         scopeURL should start with the provided scriptURL, as per:
41         - https://w3c.github.io/ServiceWorker/#update (steps 7.8 to 7.18)
42
43         No new tests, rebaselined existing tests.
44
45         * platform/network/HTTPHeaderNames.in:
46         * workers/service/ServiceWorkerJob.cpp:
47         (WebCore::ServiceWorkerJob::didReceiveResponse):
48
49 2017-12-19  Zalan Bujtas  <zalan@apple.com>
50
51         [RenderTreeBuilder] Move finding-the-parent/creating-wrapper logic from RenderTableSection::addChild to RenderTreeBuilder
52         https://bugs.webkit.org/show_bug.cgi?id=180994
53         <rdar://problem/36139222>
54
55         Reviewed by Antti Koivisto.
56
57         This is in preparation for removing all tree mutation from renderering code.
58
59         Covered by existing tests.
60
61         * rendering/RenderTableSection.cpp:
62         (WebCore::RenderTableSection::addChild):
63         * rendering/updating/RenderTreeBuilder.cpp:
64         (WebCore::RenderTreeBuilder::insertChild):
65         * rendering/updating/RenderTreeBuilderTable.cpp:
66         (WebCore::RenderTreeBuilder::Table::findOrCreateParentForChild):
67         * rendering/updating/RenderTreeBuilderTable.h:
68
69 2017-12-19  Daniel Bates  <dabates@apple.com>
70
71         Implement InlineTextBox painting using marker subranges
72         https://bugs.webkit.org/show_bug.cgi?id=180984
73         <rdar://problem/36139364>
74
75         Reviewed by David Hyatt.
76
77         As a step towards implementing CSS Pseudo-Elements Module Level 4, explicitly decompose a
78         text line into subrange objects that may be styled (say, to give the appearance of selected
79         text) and painted.
80
81         No functionality changed. So, no new tests.
82
83         * rendering/InlineTextBox.cpp:
84         (WebCore::InlineTextBox::localSelectionRect const): Update comments.
85
86         (WebCore::InlineTextBox::MarkerSubrangeStyle::operator== const):
87         (WebCore::InlineTextBox::MarkerSubrangeStyle::operator!= const):
88         (WebCore::InlineTextBox::StyledMarkerSubrange::StyledMarkerSubrange):
89         Define a subclass to represent a marker subrange that has associated style information.
90         We will make use of the style information when painting the subrange.
91
92         (WebCore::createMarkerSubrangeFromSelectionInBox): Convenience function to instantiate a
93         MarkerSubrange instance from the current selection of a specified text box.
94
95         (WebCore::InlineTextBox::paint): Write in terms of MarkerSubrange. We keep composition backgrounds
96         and composition underlines as special cases for now. We represent all other subranges of the line
97         as MarkerSubrange instances, including unmarked text (i.e. non-selected text without an associated
98         document marker). The subranges for the gaps between document markers and selection are implicitly
99         created by subdividing the entire line. Support for PaintBehaviorExcludeSelection is implemented
100         by subdividing the entire line with the selection subrange and then removing the selection subrange
101         from the resulting list of subdivisions before painting with the resulting list.
102
103         (WebCore::InlineTextBox::paintPlatformDocumentMarkers): Renamed; formerly named paintDocumentMarkers.
104         (WebCore::InlineTextBox::paintPlatformDocumentMarker): Renamed; formerly named paintDocumentMarker.
105
106         (WebCore::InlineTextBox::computeStyleForUnmarkedMarkerSubrange const): Convenience function to
107         compute the style for unmarked text.
108
109         (WebCore::InlineTextBox::resolveStyleForSubrange): Added
110
111         (WebCore::InlineTextBox::subdivideAndResolveStyle): Subdivides the list of marker subranges and
112         coalesces subranges of the same type (e.g. selection) or with the same style. The latter strategy
113         preserves the optimization of drawing the text of the entire line in one draw command when we know
114         that the selected text looks identical to non-selected text. This optimization was performed in TextPainter::paint().
115
116         (WebCore::InlineTextBox::collectSubrangesForDraggedContent): Added.
117         (WebCore::InlineTextBox::collectSubrangesForDocumentMarkers): Added.
118         (WebCore::InlineTextBox::textOriginFromBoxRect const): Added.
119
120         (WebCore::InlineTextBox::paintMarkerSubranges):
121         (WebCore::InlineTextBox::paintTextSubrangeBackground):
122         (WebCore::InlineTextBox::paintTextSubrangeForeground):
123         (WebCore::InlineTextBox::paintTextSubrangeDecoration):
124         Paint the marker subrange.
125
126         (WebCore::InlineTextBox::paintCompositionBackground): Moved function to group it with the logic to
127         paint composition underlines. Modified to pass clamped offsets to paintTextSubrangeBackground() as
128         paintTextSubrangeBackground() now expects them.
129
130         (WebCore::mirrorRTLSegment): Moved function to be above paintCompositionUnderline() as it is the only
131         function that makes use of it.
132
133         (WebCore::InlineTextBox::paintSelection): Deleted.
134         (WebCore::InlineTextBox::paintTextMatchMarker): Deleted.
135         (WebCore::InlineTextBox::paintDecoration): Deleted.
136         (WebCore::InlineTextBox::paintDocumentMarker): Deleted; renamed to paintPlatformDocumentMarker.
137         (WebCore::InlineTextBox::paintDocumentMarkers): Deleted; renamed to paintPlatformDocumentMarkers.
138         * rendering/InlineTextBox.h:
139         (WebCore::InlineTextBox::paintMarkerSubranges): Added.
140         * rendering/MarkerSubrange.h:
141         (WebCore::MarkerSubrange::isEmpty const): Added.
142         (WebCore::MarkerSubrange::operator!= const): Added.
143         (WebCore::MarkerSubrange::operator== const): Added.
144         * rendering/SimpleLineLayoutFunctions.cpp:
145         (WebCore::SimpleLineLayout::paintFlow): Updated code as we no longer need to pass the text run length
146         to TextPainter::paint(). Also modernize the code while I am here.
147         * rendering/TextDecorationPainter.cpp:
148         (WebCore::TextDecorationPainter::Styles::operator== const): Added.
149         (WebCore::TextDecorationPainter::TextDecorationPainter): Modified to take an optional TextDecorationPainter::Styles
150         instance as an argument and removed the unused parameter for PseudoId.
151         * rendering/TextDecorationPainter.h:
152         (WebCore::TextDecorationPainter::Styles::operator!= const): Added.
153         * rendering/TextPaintStyle.cpp:
154         (WebCore::TextPaintStyle::operator== const): Added.
155         (WebCore::computeTextSelectionPaintStyle): Removed the now unused out-arguments paintSelectedTextOnly, paintSelectedTextSeparately,
156         and paintNonSelectedTextOnly. The values stored in these out-arguments were intended to be used by the caller to
157         minimize the number of drawing commands. The value of paintSelectedTextSeparately indicated whether selected text
158         would look identical to non-selected text so that a caller could use one paint command to draw the entire line
159         instead of issuing two or more drawing commands to paint non-selected and selected text separately. We now
160         accomplish the same optimization by coalescing subrange styles in InlineTextBox::subdivideAndResolveStyle().
161         The value of paintNonSelectedTextOnly, as its name states, indicated whether a caller should only paint non-selected
162         text and hence skip painting of selected text. This value was only used when painting dragged content (i.e. DocumentMarker::DraggedContent
163         markers) and its effect is now more directly achieved by the dragged content logic in InlineTextBox::paint().
164         * rendering/TextPaintStyle.h:
165         (WebCore::TextPaintStyle::operator!= const): Added.
166         * rendering/TextPainter.cpp:
167         (WebCore::TextPainter::paint): Implemented in terms TextPainter::paintRange() now that InlineTextBox::paint() optimizes
168         for the number of drawing calls. See remarks for WebCore::computeTextSelectionPaintStyle() for more details.
169         * rendering/TextPainter.h: Group together related member functions.
170         (WebCore::TextPainter::setSelectionStyle): Deleted.
171         (WebCore::TextPainter::setSelectionShadow): Deleted.
172
173 2017-12-19  Daniel Bates  <dabates@apple.com>
174
175         Add support for computing the frontmost longest effective marker subrange
176         https://bugs.webkit.org/show_bug.cgi?id=180985
177
178         Reviewed by Dave Hyatt.
179
180         Add a new subdivision overlap strategy to return the minimum list of maximal length non-
181         overlapping subranges. We will make use of this strategy together with an algorithm to
182         coalesce adjacent subranges with visually indistinct styles to minimize the total number
183         of drawing commands needed to paint an entire line of text. We are not making use of
184         this functionality now. We will make use of it to simplify the patch for <https://bugs.webkit.org/show_bug.cgi?id=180984>.
185
186         * rendering/MarkerSubrange.cpp:
187         (WebCore::subdivide):
188         * rendering/MarkerSubrange.h:
189
190 2017-12-19  Chris Dumez  <cdumez@apple.com>
191
192         Handle Fetch should wait for the service worker's state to become activated
193         https://bugs.webkit.org/show_bug.cgi?id=180959
194
195         Reviewed by Youenn Fablet.
196
197         Handle Fetch should wait for the service worker's state to become activated when
198         it is currently activating.
199
200         Specification:
201         - https://w3c.github.io/ServiceWorker/#on-fetch-request-algorithm (Step 16)
202
203         No new tests, rebaselined existing test.
204
205         * workers/service/server/SWServerWorker.cpp:
206         (WebCore::SWServerWorker::~SWServerWorker):
207         (WebCore::SWServerWorker::whenActivated):
208         (WebCore::SWServerWorker::setState):
209         (WebCore::SWServerWorker::callWhenActivatedHandler):
210         * workers/service/server/SWServerWorker.h:
211
212 2017-12-19  Yusuke Suzuki  <utatane.tea@gmail.com>
213
214         [YARR] Yarr should return ErrorCode instead of error messages (const char*)
215         https://bugs.webkit.org/show_bug.cgi?id=180966
216
217         Reviewed by Mark Lam.
218
219         Remove unnecessary String creation.
220
221         No behavior change.
222
223         * contentextensions/URLFilterParser.cpp:
224         (WebCore::ContentExtensions::URLFilterParser::addPattern):
225
226 2017-12-19  Zalan Bujtas  <zalan@apple.com>
227
228         [RenderTreeBuilder] Move finding-the-parent/creating-wrapper logic from RenderTableRow::addChild to RenderTreeBuilder
229         https://bugs.webkit.org/show_bug.cgi?id=180964
230         <rdar://problem/36123315>
231
232         Reviewed by Antti Koivisto.
233
234         This is in preparation for removing all tree mutation from renderering code.
235
236         Covered by existing tests.
237
238         * Sources.txt:
239         * WebCore.xcodeproj/project.pbxproj:
240         * rendering/RenderTableRow.cpp:
241         (WebCore::RenderTableRow::addChild):
242         * rendering/updating/RenderTreeBuilder.cpp:
243         (WebCore::RenderTreeBuilder::insertChild):
244         * rendering/updating/RenderTreeBuilder.h:
245         * rendering/updating/RenderTreeBuilderTable.cpp: Added.
246         (WebCore::RenderTreeBuilder::Table::findOrCreateParentForChild):
247         * rendering/updating/RenderTreeBuilderTable.h: Copied from Source/WebCore/rendering/updating/RenderTreeBuilder.h.
248
249 2017-12-19  Youenn Fablet  <youenn@apple.com>
250
251         Service Worker should not clean HTTP headers added by the application or by fetch specification before service worker interception
252         https://bugs.webkit.org/show_bug.cgi?id=180939
253
254         Reviewed by Chris Dumez.
255
256         Covered by modified WPT test.
257
258         Add support to clean only specific headers in cleanHTTPRequestHeadersForAccessControl,
259         renamed from cleanRedirectedRequestForAccessControl.
260         Compute the list of headers to keep in DocumentThreadableLoader.
261         Add a specific rule for Accept header which is set prior service worker interception and for
262         HTTP headers set by DocumentThreadableLoader clients.
263
264         * loader/CrossOriginAccessControl.cpp:
265         (WebCore::httpHeadersToKeepFromCleaning):
266         (WebCore::cleanRedirectedRequestForAccessControl):
267         * loader/CrossOriginAccessControl.h:
268         (WebCore::cleanRedirectedRequestForAccessControl):
269         * loader/DocumentThreadableLoader.cpp:
270         (WebCore::DocumentThreadableLoader::DocumentThreadableLoader):
271         * loader/ResourceLoaderOptions.h:
272         * workers/service/context/ServiceWorkerFetch.cpp:
273         (WebCore::ServiceWorkerFetch::dispatchFetchEvent):
274         * workers/service/context/ServiceWorkerFetch.h:
275         * workers/service/context/ServiceWorkerThread.cpp:
276         (WebCore::ServiceWorkerThread::postFetchTask):
277         * workers/service/context/ServiceWorkerThread.h:
278
279 2017-12-19  Andy Estes  <aestes@apple.com>
280
281         [Apple Pay] Stop maintaining a list of payment networks
282         https://bugs.webkit.org/show_bug.cgi?id=180965
283         <rdar://problem/34696560>
284
285         Reviewed by Tim Horton.
286
287         Instead of maintaining the list of valid payment networks in WebCore, allow the client to
288         provide the list when constructing a PaymentCoordinator. Then, use PaymentCoordinator's list
289         to validate ApplePaySessionPaymentRequests.
290
291         Validation will now be done case-insensitively since Cocoa clients will provide a list of
292         network names that differ in capitalization from the names formerly accepted by WebCore.
293
294         Added new test cases to http/tests/ssl/applepay/ApplePaySession.html.
295
296         * Modules/applepay/ApplePayRequestBase.cpp:
297         (WebCore::convertAndValidate): Changed to return a Vector of validated strings.
298         (WebCore::validate): Renamed to convertAndValidate.
299         * Modules/applepay/ApplePayRequestBase.h:
300         * Modules/applepay/ApplePaySession.cpp:
301         (WebCore::convertAndValidate):
302         (WebCore::ApplePaySession::create):
303         * Modules/applepay/ApplePaySessionPaymentRequest.cpp:
304         (WebCore::ApplePaySessionPaymentRequest::isValidSupportedNetwork): Deleted.
305         * Modules/applepay/ApplePaySessionPaymentRequest.h:
306         * Modules/applepay/PaymentCoordinator.cpp:
307         (WebCore::toHashSet):
308         (WebCore::PaymentCoordinator::PaymentCoordinator): Converted availablePaymentNetworks to a
309         case-insensitive HashSet and stored in m_availablePaymentNetworks.
310         (WebCore::PaymentCoordinator::validatedPaymentNetwork const): Added special cases for "jcb"
311         and "carteBancaire" for API compatibility. For other networks, checked m_availablePaymentNetworks.
312         * Modules/applepay/PaymentCoordinator.h:
313         * Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp:
314         (WebCore::ApplePayPaymentHandler::show):
315         * page/MainFrame.cpp:
316         (WebCore::MainFrame::MainFrame): Constructed m_paymentCoordinator with configuration.availablePaymentNetworks.
317         * page/PageConfiguration.h:
318         * testing/Internals.cpp:
319         (WebCore::Internals::Internals):
320         * testing/MockPaymentCoordinator.cpp:
321         * testing/MockPaymentCoordinator.h:
322
323 2017-12-19  Wenson Hsieh  <wenson_hsieh@apple.com>
324
325         Unreviewed, try to fix the Windows build after r226097.
326
327         * editing/markup.cpp:
328         (WebCore::StyledMarkupAccumulator::appendCustomAttributes):
329
330 2017-12-18  Andy Estes  <aestes@apple.com>
331
332         [Apple Pay] Only include phonetic name properties in ApplePayPaymentContact when version >= 3
333         https://bugs.webkit.org/show_bug.cgi?id=180925
334         <rdar://problem/35907596>
335
336         Reviewed by Tim Horton.
337
338         No tests possible. The fix involves converting PKContacts, which we can't create in our test harness.
339
340         * Modules/applepay/ApplePayPaymentAuthorizedEvent.cpp:
341         (WebCore::ApplePayPaymentAuthorizedEvent::ApplePayPaymentAuthorizedEvent):
342         * Modules/applepay/ApplePayPaymentAuthorizedEvent.h:
343         * Modules/applepay/ApplePaySession.cpp:
344         (WebCore::ApplePaySession::create):
345         (WebCore::ApplePaySession::ApplePaySession):
346         (WebCore::ApplePaySession::version const):
347         (WebCore::ApplePaySession::didAuthorizePayment):
348         (WebCore::ApplePaySession::didSelectShippingContact):
349         * Modules/applepay/ApplePaySession.h:
350         * Modules/applepay/ApplePayShippingContactSelectedEvent.cpp:
351         (WebCore::ApplePayShippingContactSelectedEvent::ApplePayShippingContactSelectedEvent):
352         * Modules/applepay/ApplePayShippingContactSelectedEvent.h:
353         * Modules/applepay/Payment.h:
354         * Modules/applepay/PaymentContact.h:
355         * Modules/applepay/PaymentCoordinator.cpp:
356         (WebCore::PaymentCoordinator::supportsVersion const):
357         (WebCore::PaymentCoordinator::supportsVersion): Deleted.
358         * Modules/applepay/PaymentCoordinator.h:
359         * Modules/applepay/PaymentSession.h:
360         * Modules/applepay/cocoa/PaymentCocoa.mm:
361         (WebCore::convert):
362         (WebCore::Payment::toApplePayPayment const):
363         * Modules/applepay/cocoa/PaymentContactCocoa.mm:
364         (WebCore::convert):
365         (WebCore::PaymentContact::toApplePayPaymentContact const):
366         * Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp:
367         (WebCore::ApplePayPaymentHandler::document const):
368         (WebCore::ApplePayPaymentHandler::paymentCoordinator const):
369         (WebCore::ApplePayPaymentHandler::version const):
370         (WebCore::ApplePayPaymentHandler::didAuthorizePayment):
371         (WebCore::ApplePayPaymentHandler::didSelectShippingContact):
372         (WebCore::ApplePayPaymentHandler::document): Deleted.
373         (WebCore::ApplePayPaymentHandler::paymentCoordinator): Deleted.
374         * Modules/applepay/paymentrequest/ApplePayPaymentHandler.h:
375
376 2017-12-18  Wenson Hsieh  <wenson_hsieh@apple.com>
377
378         [Attachment Support] The 'webkitattachmentbloburl' attribute should not persist after markup serialization
379         https://bugs.webkit.org/show_bug.cgi?id=180924
380         <rdar://problem/36099093>
381
382         Reviewed by Tim Horton.
383
384         Work towards dragging Blob-backed attachment elements as files on iOS and Mac. It doesn't make sense for the
385         attachment blob URL to stick around on the element after markup serialization, so this patch removes logic that
386         eagerly sets the blob URL upon setting an attachment's File. Instead, we just append this attribute when
387         generating markup.
388
389         This patch also augments existing WKAttachmentTests to ensure that these attributes are not present.
390
391         * editing/markup.cpp:
392         (WebCore::StyledMarkupAccumulator::appendCustomAttributes):
393         (WebCore::createFragmentFromMarkup):
394         * html/HTMLAttachmentElement.cpp:
395         (WebCore::HTMLAttachmentElement::setFile):
396         * rendering/HitTestResult.cpp:
397
398         Fixes a related issue where an attachment is backed by Blob data (and not a file path) would specify "file:///"
399         as its attachment file path in DragController when starting a drag. Instead, if there is no file path, fall back
400         to the blob URL.
401
402         This will be tested in a future patch once a WK2 dragging simulator for Mac is implemented, and support for
403         dragging out Blob-backed attachments as (platform) files is implemented.
404
405         (WebCore::HitTestResult::absoluteAttachmentURL const):
406
407 2017-12-18  Chris Dumez  <cdumez@apple.com>
408
409         Default scope used when registering a service worker is wrong
410         https://bugs.webkit.org/show_bug.cgi?id=180961
411
412         Reviewed by Youenn Fablet.
413
414         The default scope we used when registering a service worker was wrong, it did not match:
415         - https://w3c.github.io/ServiceWorker/#start-register (Step 4)
416
417         This patch aligns our behavior with the specification.
418
419         No new tests, rebaselined existing test.
420
421         * workers/service/ServiceWorkerContainer.cpp:
422         (WebCore::ServiceWorkerContainer::addRegistration):
423
424 2017-12-18  Ryosuke Niwa  <rniwa@webkit.org>
425
426         Assertion hit in DocumentOrderedMap::get while removing a form element
427         https://bugs.webkit.org/show_bug.cgi?id=137959
428         <rdar://problem/27702012>
429
430         Reviewed by Brent Fulgham.
431
432         The assertion failure was caused by FormAssociatedElement::findAssociatedForm calling TreeScope::getElementById
433         for a form associated element inside FormAttributeTargetObserver::idTargetChanged during the removal of
434         the owner form element, or the first non-form element with the matching ID. If there are other elements with
435         the same ID in the removed tree at that moment, MapEntry's count for the ID can be higher than it needs to be
436         since Element::removedFromAncestor has not been called on those elements yet.
437
438         Fixed the bug by checking this condition explicitly. This patch introduces ContainerChildRemovalScope which
439         keeps track of the container node from which a subtree was removed as well as the root of the removed subtree.
440         DocumentOrderedMap::get then checks whether the matching element can be found in this removed subtree, and its
441         isConnected() still returns true (the evidence that Element::removedFromAncestor has not been called) when
442         count > 0 and there was no matching element in the tree scope.
443
444         In the long term, we should refactor the way FormAssociatedElement and HTMLFormElement refers to each other
445         and avoid calling DocumentOrderedMap::get before finish calling removedFromAncestor on the removed subtree.
446
447         Tests: fast/forms/update-form-owner-in-moved-subtree-assertion-failure-5.html
448                fast/forms/update-form-owner-in-moved-subtree-assertion-failure-6.html
449
450         * dom/ContainerNodeAlgorithms.cpp:
451         (WebCore::notifyChildNodeRemoved):
452         * dom/ContainerNodeAlgorithms.h:
453         (WebCore::ContainerChildRemovalScope): Added.
454         (WebCore::ContainerChildRemovalScope::ContainerChildRemovalScope):
455         (WebCore::ContainerChildRemovalScope::~ContainerChildRemovalScope):
456         (WebCore::ContainerChildRemovalScope::parentOfRemovedTree):
457         (WebCore::ContainerChildRemovalScope::removedChild):
458         (WebCore::ContainerChildRemovalScope::currentScope):
459         * dom/DocumentOrderedMap.cpp:
460         (WebCore::DocumentOrderedMap::get const): Added a special early exit when this function is called during
461         a node removal.
462
463 2017-12-18  Timothy Hatcher  <timothy@hatcher.name>
464
465         [GTK][WPE] Conditionalize libTASN1 use behind ENABLE_SUBTLE_CRYPTO in the CMake files
466         https://bugs.webkit.org/show_bug.cgi?id=180949
467
468         Reviewed by Carlos Alberto Lopez Perez.
469
470         * PlatformGTK.cmake: Move the include path and library additions to conditional ENABLE_SUBTLE_CRYPTO section.
471         * PlatformWPE.cmake: Ditto.
472
473 2017-12-18  Wenson Hsieh  <wenson_hsieh@apple.com>
474
475         [Attachment Support] Support representing pasted or dropped content using attachment elements
476         https://bugs.webkit.org/show_bug.cgi?id=180892
477         <rdar://problem/36064210>
478
479         Reviewed by Tim Horton.
480
481         Support dropping and pasting attributed strings that contain NSTextAttachments. Teaches
482         replaceRichContentWithAttachmentsIfNecessary to replace object elements with attachments; see comments below for
483         more details.
484
485         Test: WKAttachmentTests.InsertPastedAttributedStringContainingMultipleAttachments
486
487         * editing/WebContentReader.h:
488
489         Add BlobReplacementInfo, which contains a map of blob URLs to replacement Blobs, as well as a map of blob URLs
490         to replaced subresource URLs.
491
492         (WebCore::BlobReplacementInfo::isEmpty const):
493         * editing/cocoa/EditorCocoa.mm:
494         (WebCore::Editor::replaceSelectionWithAttributedString):
495         * editing/cocoa/WebArchiveResourceFromNSAttributedString.h:
496         * editing/cocoa/WebArchiveResourceFromNSAttributedString.mm:
497
498         Implement -[WebArchiveResourceFromNSAttributedString MIMEType]. UIFoundation asks for -MIMEType in the process
499         of generating markup from NSTextAttachments; this currently causes the web process to crash on an unrecognized
500         selector.
501
502         Additionally, work around <rdar://problem/36074429>, a UIFoundation bug in which all but a few hard-coded file
503         extensions actually yield MIME types that are more specific than "application/octet-stream". This can safely be
504         removed once <rdar://problem/36074429> is addressed.
505
506         (-[WebArchiveResourceFromNSAttributedString MIMEType]):
507         * editing/cocoa/WebContentReaderCocoa.mm:
508         (WebCore::replaceRichContentWithAttachmentsIfNecessary):
509
510         Try to replace object elements with attachments, and also tweak the title of the attachment's File to use the
511         replaced subresource's filename if possible. Additionally, abstracts out information for replacing object or
512         image elements (formerly a pair of { File, Element }) into a separate struct, and add a AttachmentDisplayMode
513         parameter to determine whether the attachment should be presented in-line (in the case of images), or as an icon.
514
515         (WebCore::attributesForAttributedStringConversion):
516
517         Only exclude object elements from being generated from NSTextAttachments if the attachment element runtime
518         feature is disabled, or !ENABLE(ATTACHMENT_ELEMENT).
519
520         (WebCore::createFragmentAndAddResources):
521
522         Additionally keep track of a mapping from blob URL => replaced subresource URL. In all the places where we
523         previously only plumbed a map of blob URL => Blob, use a BlobReplacementInfo struct instead, which now includes
524         a map from blob URL => replaced URL.
525
526         (WebCore::sanitizeMarkupWithArchive):
527         (WebCore::WebContentReader::readWebArchive):
528         (WebCore::WebContentMarkupReader::readWebArchive):
529         (WebCore::WebContentReader::readRTFD):
530         (WebCore::WebContentMarkupReader::readRTFD):
531         (WebCore::WebContentReader::readRTF):
532         (WebCore::WebContentMarkupReader::readRTF):
533         (WebCore::WebContentReader::readImage):
534
535 2017-12-18  Youenn Fablet  <youenn@apple.com>
536
537         Service worker served response tainting should keep its tainting
538         https://bugs.webkit.org/show_bug.cgi?id=180952
539
540         Reviewed by Chris Dumez.
541
542         Covered by rebased tests.
543
544         * loader/cache/CachedResource.cpp:
545         (WebCore::CachedResource::setResponse):
546
547 2017-12-18  Wenson Hsieh  <wenson_hsieh@apple.com>
548
549         Unreviewed, attempt to fix watch and TV builds after r226085
550
551         Explicitly include a header in WebContentReaderCocoa.mm.
552
553         * editing/cocoa/WebContentReaderCocoa.mm:
554
555 2017-12-18  Brady Eidson  <beidson@apple.com>
556
557         Add ability to API test Service Workers via a custom protocol.
558         https://bugs.webkit.org/show_bug.cgi?id=180911
559
560         Reviewed by Chris Dumez.
561
562         Covered by API test ServiceWorkers.Basic
563
564         This adds a set of "Service Workers can handle this" schemes to the scheme registry
565         and uses it for SW decisions instead of a handful of previous techniques.
566
567         * bindings/scripts/CodeGeneratorJS.pm:
568         (NeedsRuntimeCheck):
569         (GenerateRuntimeEnableConditionalString):
570         * bindings/scripts/IDLAttributes.json:
571
572         * dom/ScriptExecutionContext.cpp:
573         (WebCore::ScriptExecutionContext::hasServiceWorkerScheme):
574         * dom/ScriptExecutionContext.h:
575
576         * page/NavigatorServiceWorker.idl:
577
578         * platform/SchemeRegistry.cpp:
579         (WebCore::serviceWorkerSchemesLock):
580         (WebCore::serviceWorkerSchemes):
581         (WebCore::SchemeRegistry::registerURLSchemeServiceWorkersCanHandle):
582         (WebCore::SchemeRegistry::canServiceWorkersHandleURLScheme):
583         (WebCore::SchemeRegistry::isServiceWorkerContainerCustomScheme):
584         * platform/SchemeRegistry.h:
585
586         * workers/service/ServiceWorkerContainer.cpp:
587         (WebCore::ServiceWorkerContainer::addRegistration):
588
589         * workers/service/server/SWServerJobQueue.cpp:
590         (WebCore::SWServerJobQueue::runRegisterJob):
591
592 2017-12-18  Chris Dumez  <cdumez@apple.com>
593
594         We should use "error" redirect mode for fetching service worker scripts
595         https://bugs.webkit.org/show_bug.cgi?id=180950
596
597         Reviewed by Youenn Fablet.
598
599         We should use "error" redirect mode for fetching service worker scripts, as per:
600         - https://w3c.github.io/ServiceWorker/#update (Step 7.5)
601
602         No new tests, rebaselined existing test.
603
604         * loader/SubresourceLoader.cpp:
605         (WebCore::SubresourceLoader::willSendRequestInternal):
606         * workers/Worker.cpp:
607         (WebCore::Worker::create):
608         * workers/WorkerScriptLoader.cpp:
609         (WebCore::WorkerScriptLoader::loadAsynchronously):
610         * workers/WorkerScriptLoader.h:
611         * workers/service/ServiceWorkerJob.cpp:
612         (WebCore::ServiceWorkerJob::fetchScriptWithContext):
613
614 2017-12-18  Chris Dumez  <cdumez@apple.com>
615
616         ExtendableMessageEvent constructor fails to initialize the 'source' attribute
617         https://bugs.webkit.org/show_bug.cgi?id=180954
618
619         Reviewed by Youenn Fablet.
620
621         No new tests, rebaselined existing test.
622
623         * workers/service/ExtendableMessageEvent.cpp:
624         (WebCore::ExtendableMessageEvent::ExtendableMessageEvent):
625
626 2017-12-18  Wenson Hsieh  <wenson_hsieh@apple.com>
627
628         [Attachment Support] Insert images as inline attachments when pasting and dropping
629         https://bugs.webkit.org/show_bug.cgi?id=180853
630         <rdar://problem/35756268>
631
632         Reviewed by Tim Horton.
633
634         Adds support for transforming dropped and pasted web content fragments prior to insertion, such that inline
635         elements (so far, only images) are replaced with attachment elements that have an inline representation. See
636         below comments for more detail.
637
638         Tests: WKAttachmentTests.InsertPastedImageAsAttachment
639                WKAttachmentTests.InsertPastedAttributedStringContainingImage
640                WKAttachmentTestsMac.InsertPastedFileURLsAsAttachments
641                WKAttachmentTestsIOS.InsertDroppedImageAsAttachment
642                WKAttachmentTestsIOS.InsertDroppedAttributedStringContainingAttachment
643
644         * editing/WebContentReader.h:
645         * editing/cocoa/EditorCocoa.mm:
646         (WebCore::Editor::replaceSelectionWithAttributedString):
647
648         Add a new helper to replace elements in a DOM fragment with inline attachment elements instead, using the given
649         Blobs. So far, we only replace image elements with these attachments, by mapping the source of each image to a
650         Blob, and constructing a replacement attachment backed by a File constructed from the image's corresponding
651         Blob. However, this mechanism can be generalized in the future to handle transformations from arbitrary elements
652         to attachment elements capable of representing the same elements using inline display mode.
653
654         This function is a noop if the attachment elements are disabled via runtime-enabled features.
655
656         * editing/cocoa/WebContentReaderCocoa.mm:
657         (WebCore::replaceRichContentWithAttachmentsIfNecessary):
658         (WebCore::createFragmentAndAddResources):
659         (WebCore::sanitizeMarkupWithArchive):
660
661         Add out-params to both of these helper functions that capture the map of blob URLs to Blobs being used to
662         replace subresource URLs in the pasted/dropped DOM fragment.
663
664         (WebCore::WebContentReader::readWebArchive):
665         (WebCore::WebContentMarkupReader::readWebArchive):
666         (WebCore::createFragmentFromAttributedString):
667         (WebCore::WebContentReader::readRTFD):
668         (WebCore::WebContentMarkupReader::readRTFD):
669         (WebCore::WebContentReader::readRTF):
670         (WebCore::WebContentMarkupReader::readRTF):
671         (WebCore::WebContentReader::readImage):
672
673         In these places where we swap out subresource URLs for blob URLs, collect a map of blob URL => Blob, and use it
674         to replace images in the DOM with attachments (if needed, and possible).
675
676         * editing/mac/WebContentReaderMac.mm:
677         (WebCore::WebContentReader::readFilenames):
678
679         Augment existing logic to generate attachment elements when pasting or dropping file URLs, so that the generated
680         attachment elements also have titles, subtitles, and content type information.
681
682         * html/HTMLAttachmentElement.cpp:
683         (WebCore::HTMLAttachmentElement::setFile):
684
685         Add an optional second param, UpdateDisplayAttributes. If UpdateDisplayAttributes::Yes is passed in, then we set
686         the elements's attributes that are displayed in the attachment representation (title, subtitle, and type) using
687         the given File.
688
689         (WebCore::HTMLAttachmentElement::updateFileWithData):
690         (WebCore::HTMLAttachmentElement::populateShadowRootIfNecessary):
691
692         Make a small tweak to correctly handle the case where an attachment with a content type that is a UTI is being
693         displayed inline. Content type can either be a UTI or a MIME type, but the code to construct the shadow tree of
694         an attachment element only handles MIME types.
695
696         * html/HTMLAttachmentElement.h:
697
698 2017-12-18  Youenn Fablet  <youenn@apple.com>
699
700         SameOrigin and CORS fetch should fail on opaque responses served from ServiceWorker
701         https://bugs.webkit.org/show_bug.cgi?id=180941
702
703         Reviewed by Chris Dumez.
704
705         Covered by rebased tests.
706
707         * loader/SubresourceLoader.cpp:
708         (WebCore::SubresourceLoader::checkResponseCrossOriginAccessControl):
709
710 2017-12-18  Dean Jackson  <dino@apple.com>
711
712         Make some functions in GraphicsContextCG use call_once for statics
713         https://bugs.webkit.org/show_bug.cgi?id=180841
714         <rdar://problem/36058448>
715
716         Reviewed by Antoine Quint.
717
718         In preparation for making OffscreenCanvas operate inside a Worker,
719         make sure GraphicsContext is thread safe. Change some functions
720         that use a static to call_once.
721
722         * platform/graphics/cg/GraphicsContextCG.cpp:
723         (WebCore::sRGBColorSpaceRef):
724         (WebCore::linearRGBColorSpaceRef):
725         (WebCore::extendedSRGBColorSpaceRef):
726         (WebCore::displayP3ColorSpaceRef):
727
728 2017-12-18  Chris Dumez  <cdumez@apple.com>
729
730         ExtendableMessageEvent.data should return the value it was initialized to
731         https://bugs.webkit.org/show_bug.cgi?id=180868
732
733         Reviewed by Geoffrey Garen.
734
735         No new tests, rebaselined existing test.
736
737         * bindings/js/JSExtendableMessageEventCustom.cpp:
738         (WebCore::constructJSExtendableMessageEvent):
739         * workers/service/ExtendableMessageEvent.cpp:
740         (WebCore::ExtendableMessageEvent::ExtendableMessageEvent):
741         * workers/service/ExtendableMessageEvent.idl:
742
743 2017-12-18  Megan Gardner  <megan_gardner@apple.com>
744
745         Support Autoscrolling in contenteditable for WK2
746         https://bugs.webkit.org/show_bug.cgi?id=180789
747
748         Reviewed by Simon Frasier and Wenson Hsieh..
749
750         Activate the autoscrollController to scroll to the position provided to us by the
751         UIProcess. Allows for scrolling in contentEditable for WebKit2
752
753         Test: fast/events/touch/ios/drag-to-autoscroll-in-single-line-editable.html
754
755         * page/AutoscrollController.cpp:
756         (WebCore::AutoscrollController::autoscrollTimerFired):
757         * page/EventHandler.cpp:
758         (WebCore::EventHandler::clearOrScheduleClearingLatchedStateIfNeeded):
759         (WebCore::EventHandler::targetPositionForSelectionAutoscroll const):
760         (WebCore::EventHandler::shouldUpdateAutoscroll):
761         (WebCore::EventHandler::effectiveMousePositionForSelectionAutoscroll const): Deleted.
762         * page/EventHandler.h:
763         * page/ios/EventHandlerIOS.mm:
764         (WebCore::EventHandler::startTextAutoscroll):
765         (WebCore::EventHandler::cancelTextAutoscroll):
766         (WebCore::EventHandler::targetPositionForSelectionAutoscroll const):
767         (WebCore::EventHandler::shouldUpdateAutoscroll):
768         * page/mac/EventHandlerMac.mm:
769         (WebCore::EventHandler::targetPositionForSelectionAutoscroll const):
770         (WebCore::EventHandler::effectiveMousePositionForSelectionAutoscroll const): Deleted.
771
772 2017-12-18  Youenn Fablet  <youenn@apple.com>
773
774         Add support for response blob given to fetch events
775         https://bugs.webkit.org/show_bug.cgi?id=180894
776
777         Reviewed by Darin Adler.
778
779         Covered by updated test expectations.
780
781         Adding support for getting a blob URL from a FormData that only contains one blob.
782         Adding support to create a FetcLoader from a ServiceWorkerThreadProxy
783
784         * Modules/fetch/FetchLoader.cpp:
785         (WebCore::FetchLoader::start):
786         (WebCore::FetchLoader::startLoadingBlobURL):
787         * Modules/fetch/FetchLoader.h:
788         * WebCore.xcodeproj/project.pbxproj:
789         * platform/network/FormData.cpp:
790         (WebCore::FormData::asBlobURL const):
791         * platform/network/FormData.h:
792         * workers/service/context/ServiceWorkerThreadProxy.cpp:
793         (WebCore::ServiceWorkerThreadProxy::createBlobLoader):
794         * workers/service/context/ServiceWorkerThreadProxy.h:
795
796 2017-12-18  Zalan Bujtas  <zalan@apple.com>
797
798         [SVG] Detach list wrappers before resetting the base value.
799         https://bugs.webkit.org/show_bug.cgi?id=180912
800         <rdar://problem/36017970>
801
802         Reviewed by Simon Fraser.
803
804         Before resetting the animation value (and destroying the assigned SVG object -SVGLengthValue in this case),
805         we need to check if there's an associated tear off wrapper for the said SVG object and make a copy of it.
806         This is currently done in the wrong order through animValDidChange.
807
808         Test: svg/animations/crash-when-animation-is-running-while-getting-value.html
809
810         * svg/SVGAnimatedTypeAnimator.h:
811         (WebCore::SVGAnimatedTypeAnimator::resetFromBaseValue):
812         * svg/properties/SVGAnimatedPropertyTearOff.h:
813         * svg/properties/SVGAnimatedStaticPropertyTearOff.h:
814         (WebCore::SVGAnimatedStaticPropertyTearOff::synchronizeWrappersIfNeeded):
815
816 2017-12-18  Brady Eidson  <beidson@apple.com>
817
818         REGRESSION: ASSERTION FAILED: !m_importCompleted
819         https://bugs.webkit.org/show_bug.cgi?id=180935
820
821         Unreviewed bot gardening.
822
823         No new tests (Covered by existing tests)
824
825         The ASSERT was invalid for database pushes failing to open databases like this, so skip it for that scenario.
826
827         * workers/service/server/RegistrationStore.cpp:
828         (WebCore::RegistrationStore::databaseFailedToOpen):
829         * workers/service/server/SWServer.cpp:
830         (WebCore::SWServer::registrationStoreDatabaseFailedToOpen):
831         * workers/service/server/SWServer.h:
832
833 2017-12-18  Jer Noble  <jer.noble@apple.com>
834
835         Playing media elements which call "pause(); play()" will have the play promise rejected.
836         https://bugs.webkit.org/show_bug.cgi?id=180781
837
838         Reviewed by Eric Carlson.
839
840         Test: media/video-pause-play-resolve.html
841
842         When scheduling a rejection or resolution of existing play promises, move() the existing
843         promises into the block. This ensures that valid promises aren't added to the play promise
844         vector between when a rejection is scheduled and when it runs.
845
846         Drive-by fix: Don't return false from playInternal() just so the newly created promise will
847         get rejected. The pause() command will reject the promise, so just make sure it's added to
848         the m_pendingPlayPromises before calling playInternal().
849
850         Drive-by fix #2: The spec referenced by playInternal() and pauseInternal() doesn't say to
851         call the "Media Element Load Algorithm" (i.e., prepareForLoad()); it says to call the
852         "Resource Selection Algorithm" (i.e., selectMediaResource()). But fixing this bug caused
853         an assertion crash when the resource selection task was fired and m_player was null. This
854         was because the algorithm is being run at stop() time due to stop() calling pause(). The
855         solution to this ASSERT is to stop the m_resourceSelectionTaskQueue in stop().
856
857         * html/HTMLMediaElement.cpp:
858         (WebCore::HTMLMediaElement::scheduleRejectPendingPlayPromises):
859         (WebCore::HTMLMediaElement::rejectPendingPlayPromises):
860         (WebCore::HTMLMediaElement::resolvePendingPlayPromises):
861         (WebCore::HTMLMediaElement::scheduleNotifyAboutPlaying):
862         (WebCore::HTMLMediaElement::notifyAboutPlaying):
863         (WebCore::HTMLMediaElement::noneSupported):
864         (WebCore::HTMLMediaElement::cancelPendingEventsAndCallbacks):
865         (WebCore::HTMLMediaElement::play):
866         (WebCore::HTMLMediaElement::playInternal):
867         (WebCore::HTMLMediaElement::pauseInternal):
868         (WebCore::HTMLMediaElement::stop):
869         * html/HTMLMediaElement.h:
870
871 2017-12-18  Daniel Bates  <dabates@apple.com>
872
873         Add SPI to query for the current and last auto fill button type and pass user data object to _webView:focusShouldStartInputSession:
874         https://bugs.webkit.org/show_bug.cgi?id=180774
875         <rdar://problem/36033832>
876
877         Reviewed by Tim Horton.
878
879         Expose a way for an embedding client to query for the auto fill button type of a specific
880         input element as it may not be feasible for a client to track such state themselves. For
881         similar reasons track and expose SPI to query for the last auto fill button type for a
882         specific field.
883
884         Test: fast/forms/auto-fill-button/last-auto-fill-button-type.html
885
886         * html/HTMLInputElement.cpp:
887         (WebCore::HTMLInputElement::HTMLInputElement):
888         (WebCore::HTMLInputElement::setShowAutoFillButton):
889         Update the last auto fill button type.
890
891         * html/HTMLInputElement.h:
892         (WebCore::HTMLInputElement::lastAutoFillButtonType const): Added.
893
894         * testing/Internals.cpp:
895         (WebCore::toAutoFillButtonType):
896         (WebCore::toInternalsAutoFillButtonType):
897         (WebCore::Internals::autoFillButtonType):
898         (WebCore::Internals::lastAutoFillButtonType):
899         * testing/Internals.h:
900         * testing/Internals.idl:
901         Add functions for testing.
902
903 2017-12-17  John Wilander  <wilander@apple.com>
904
905         Storage Access API: Make document.hasStorageAccess() retrieve current status from the network process
906         https://bugs.webkit.org/show_bug.cgi?id=180681
907         <rdar://problem/35982161>
908
909         Reviewed by Alex Christensen.
910
911         Tests: http/tests/storageAccess/has-storage-access-from-prevalent-domain-with-non-recent-user-interaction.html
912                http/tests/storageAccess/has-storage-access-from-prevalent-domain-with-recent-user-interaction.html
913
914         This change makes an asynchronous request to the network process
915         to see if storage access has been granted for this frame, on this
916         page, for this domain.
917
918         * dom/Document.cpp:
919         (WebCore::Document::hasStorageAccess):
920         * page/ChromeClient.h:
921
922 2017-12-17  Chris Dumez  <cdumez@apple.com>
923
924         Strip fragment identifier from ServiceWorker's scriptURL
925         https://bugs.webkit.org/show_bug.cgi?id=180887
926
927         Reviewed by Darin Adler.
928
929         Strip fragment identifier from ServiceWorker's scriptURL to match Firefox and Chrome.
930         This behavior does not appear to be specified so I filed:
931         - https://github.com/w3c/ServiceWorker/issues/1249
932
933         No new tests, rebaselined existing test.
934
935         * workers/service/server/SWServerWorker.cpp:
936         (WebCore::m_script):
937
938 2017-12-17  Antti Koivisto  <antti@apple.com>
939
940         Move render tree updating related files under rendering/updating/
941         https://bugs.webkit.org/show_bug.cgi?id=180918
942
943         Reviewed by Darin Adler.
944
945         * CMakeLists.txt:
946         * Sources.txt:
947         * WebCore.xcodeproj/project.pbxproj:
948         * rendering/RenderTreeBuilder.cpp: Removed.
949         * rendering/RenderTreeBuilder.h: Removed.
950         * rendering/updating: Added.
951         * rendering/updating/RenderTreeBuilder.cpp: Copied from Source/WebCore/rendering/RenderTreeBuilder.cpp.
952         * rendering/updating/RenderTreeBuilder.h: Copied from Source/WebCore/rendering/RenderTreeBuilder.h.
953         * rendering/updating/RenderTreePosition.cpp: Copied from Source/WebCore/style/RenderTreePosition.cpp.
954         * rendering/updating/RenderTreePosition.h: Copied from Source/WebCore/style/RenderTreePosition.h.
955         * rendering/updating/RenderTreeUpdater.cpp: Copied from Source/WebCore/style/RenderTreeUpdater.cpp.
956         * rendering/updating/RenderTreeUpdater.h: Copied from Source/WebCore/style/RenderTreeUpdater.h.
957         * rendering/updating/RenderTreeUpdaterFirstLetter.cpp: Copied from Source/WebCore/style/RenderTreeUpdaterFirstLetter.cpp.
958         * rendering/updating/RenderTreeUpdaterFirstLetter.h: Copied from Source/WebCore/style/RenderTreeUpdaterFirstLetter.h.
959         * rendering/updating/RenderTreeUpdaterGeneratedContent.cpp: Copied from Source/WebCore/style/RenderTreeUpdaterGeneratedContent.cpp.
960         * rendering/updating/RenderTreeUpdaterGeneratedContent.h: Copied from Source/WebCore/style/RenderTreeUpdaterGeneratedContent.h.
961         * rendering/updating/RenderTreeUpdaterListItem.cpp: Copied from Source/WebCore/style/RenderTreeUpdaterListItem.cpp.
962         * rendering/updating/RenderTreeUpdaterListItem.h: Copied from Source/WebCore/style/RenderTreeUpdaterListItem.h.
963         * rendering/updating/RenderTreeUpdaterMultiColumn.cpp: Copied from Source/WebCore/style/RenderTreeUpdaterMultiColumn.cpp.
964         * rendering/updating/RenderTreeUpdaterMultiColumn.h: Copied from Source/WebCore/style/RenderTreeUpdaterMultiColumn.h.
965         * style/RenderTreePosition.cpp: Removed.
966         * style/RenderTreePosition.h: Removed.
967         * style/RenderTreeUpdater.cpp: Removed.
968         * style/RenderTreeUpdater.h: Removed.
969         * style/RenderTreeUpdaterFirstLetter.cpp: Removed.
970         * style/RenderTreeUpdaterFirstLetter.h: Removed.
971         * style/RenderTreeUpdaterGeneratedContent.cpp: Removed.
972         * style/RenderTreeUpdaterGeneratedContent.h: Removed.
973         * style/RenderTreeUpdaterListItem.cpp: Removed.
974         * style/RenderTreeUpdaterListItem.h: Removed.
975         * style/RenderTreeUpdaterMultiColumn.cpp: Removed.
976         * style/RenderTreeUpdaterMultiColumn.h: Removed.
977
978 2017-12-17  Yusuke Suzuki  <utatane.tea@gmail.com>
979
980         [JSC][WebCore][CSSJIT] Remove VM reference in CSSJIT
981         https://bugs.webkit.org/show_bug.cgi?id=180917
982
983         Reviewed by Sam Weinig.
984
985         Remove VM reference in CSSJIT. CSSJIT should not be
986         bound to a specific VM.
987
988         No behavior change.
989
990         * css/ElementRuleCollector.cpp:
991         (WebCore::ElementRuleCollector::ruleMatches):
992         * cssjit/SelectorCompiler.cpp:
993         (WebCore::SelectorCompiler::compileSelector):
994         * cssjit/SelectorCompiler.h:
995         * dom/SelectorQuery.cpp:
996         (WebCore::SelectorDataList::compileSelector):
997         (WebCore::SelectorDataList::execute const):
998         * dom/SelectorQuery.h:
999
1000 2017-12-16  Dan Bernstein  <mitz@apple.com>
1001
1002         WKWebView has no equivalent of -[WebView setAlwaysShowVerticalScroller:]
1003         https://bugs.webkit.org/show_bug.cgi?id=180613
1004         <rdar://problem/35946124>
1005
1006         Reviewed by Geoff Garen.
1007
1008         Test: TestWebKitAPI/Tests/WebKitCocoa/WKWebViewAlwaysShowsScroller.mm
1009
1010         * platform/ScrollView.h: Exported setScrollbarModes.
1011
1012 2017-12-16  Antti Koivisto  <antti@apple.com>
1013
1014         Introduce RenderTreeBuilder
1015         https://bugs.webkit.org/show_bug.cgi?id=180817
1016
1017         Reviewed by Zalan Bujtas.
1018
1019         RenderTreeBuilder is responsible of building the render tree, including construction of various anonymous
1020         renderers. Renderer subtype specific render tree construction code will eventually move there.
1021
1022         This patch adds RenderTreeBuilder class and passes it as a parameter for all addChild implementations.
1023         Future patches can then mechanically move the building code from renderers to RenderTreeBuilder.
1024
1025         It also moves one addChild implementation (RenderRuby::addChild -> RenderTreeBuilder::rubyRunInsertChild)
1026         to RenderTreeBuilder as a test.
1027
1028         * WebCore.xcodeproj/project.pbxproj:
1029         * rendering/RenderBlock.cpp:
1030         (WebCore::RenderBlock::addChildToContinuation):
1031         (WebCore::RenderBlock::addChild):
1032         (WebCore::RenderBlock::addChildIgnoringContinuation):
1033         * rendering/RenderBlock.h:
1034         * rendering/RenderBlockFlow.cpp:
1035         (WebCore::RenderBlockFlow::addChild):
1036         * rendering/RenderBlockFlow.h:
1037         * rendering/RenderBoxModelObject.cpp:
1038         (WebCore::RenderBoxModelObject::moveChildTo):
1039         * rendering/RenderButton.cpp:
1040         (WebCore::RenderButton::addChild):
1041         (WebCore::RenderButton::setText):
1042         * rendering/RenderButton.h:
1043         * rendering/RenderElement.cpp:
1044         (WebCore::RenderElement::addChild):
1045         * rendering/RenderElement.h:
1046         (WebCore::RenderElement::addChildIgnoringContinuation):
1047         * rendering/RenderFullScreen.cpp:
1048         (WebCore::RenderFullScreen::wrapNewRenderer):
1049         (WebCore::RenderFullScreen::wrapExistingRenderer):
1050         (WebCore::RenderFullScreen::unwrapRenderer):
1051         (WebCore::RenderFullScreen::createPlaceholder):
1052         * rendering/RenderGrid.cpp:
1053         (WebCore::RenderGrid::addChild):
1054         * rendering/RenderGrid.h:
1055         * rendering/RenderInline.cpp:
1056         (WebCore::RenderInline::addChild):
1057         (WebCore::RenderInline::addChildIgnoringContinuation):
1058         (WebCore::RenderInline::splitInlines):
1059         (WebCore::RenderInline::splitFlow):
1060         (WebCore::RenderInline::addChildToContinuation):
1061         (WebCore::RenderInline::childBecameNonInline):
1062         * rendering/RenderInline.h:
1063         * rendering/RenderMenuList.cpp:
1064         (WebCore::RenderMenuList::createInnerBlock):
1065         (RenderMenuList::addChild):
1066         (RenderMenuList::setText):
1067         * rendering/RenderMenuList.h:
1068         * rendering/RenderMultiColumnFlow.cpp:
1069         (WebCore::RenderMultiColumnFlow::processPossibleSpannerDescendant):
1070         * rendering/RenderQuote.cpp:
1071         (WebCore::RenderQuote::updateTextRenderer):
1072         (WebCore::RenderQuote::updateRenderer):
1073         * rendering/RenderQuote.h:
1074         * rendering/RenderRuby.cpp:
1075         (WebCore::RenderRubyAsInline::addChild):
1076         (WebCore::RenderRubyAsBlock::addChild):
1077         * rendering/RenderRuby.h:
1078         * rendering/RenderRubyBase.h:
1079         * rendering/RenderRubyRun.cpp:
1080         (WebCore::RenderRubyRun::rubyBaseSafe):
1081         (WebCore::RenderRubyRun::addChild): Deleted.
1082         * rendering/RenderRubyRun.h:
1083         * rendering/RenderTable.cpp:
1084         (WebCore::RenderTable::addChild):
1085         * rendering/RenderTable.h:
1086         * rendering/RenderTableRow.cpp:
1087         (WebCore::RenderTableRow::addChild):
1088         * rendering/RenderTableRow.h:
1089         * rendering/RenderTableSection.cpp:
1090         (WebCore::RenderTableSection::addChild):
1091         * rendering/RenderTableSection.h:
1092         * rendering/RenderTreeBuilder.cpp: Added.
1093         (WebCore::RenderTreeBuilder::RenderTreeBuilder):
1094         (WebCore::RenderTreeBuilder::~RenderTreeBuilder):
1095         (WebCore::RenderTreeBuilder::insertChild):
1096         (WebCore::RenderTreeBuilder::rubyRunInsertChild):
1097         * rendering/RenderTreeBuilder.h: Added.
1098         (WebCore::RenderTreeBuilder::current):
1099         * rendering/TextAutoSizing.cpp:
1100         (WebCore::TextAutoSizingValue::adjustTextNodeSizes):
1101         * rendering/mathml/RenderMathMLFenced.cpp:
1102         (WebCore::RenderMathMLFenced::updateFromElement):
1103         (WebCore::RenderMathMLFenced::makeFences):
1104         (WebCore::RenderMathMLFenced::addChild):
1105         * rendering/mathml/RenderMathMLFenced.h:
1106         * rendering/svg/RenderSVGContainer.cpp:
1107         (WebCore::RenderSVGContainer::addChild):
1108         * rendering/svg/RenderSVGContainer.h:
1109         * rendering/svg/RenderSVGInline.cpp:
1110         (WebCore::RenderSVGInline::addChild):
1111         * rendering/svg/RenderSVGInline.h:
1112         * rendering/svg/RenderSVGRoot.cpp:
1113         (WebCore::RenderSVGRoot::addChild):
1114         * rendering/svg/RenderSVGRoot.h:
1115         * rendering/svg/RenderSVGText.cpp:
1116         (WebCore::RenderSVGText::addChild):
1117         * rendering/svg/RenderSVGText.h:
1118         * style/RenderTreePosition.cpp:
1119         (WebCore::RenderTreePosition::insert): Deleted.
1120         * style/RenderTreePosition.h:
1121         (WebCore::RenderTreePosition::RenderTreePosition):
1122         (WebCore::RenderTreePosition::nextSibling const):
1123         (WebCore::RenderTreePosition::canInsert const): Deleted.
1124         * style/RenderTreeUpdater.cpp:
1125         (WebCore::RenderTreeUpdater::updateAfterDescendants):
1126         (WebCore::RenderTreeUpdater::createRenderer):
1127         (WebCore::RenderTreeUpdater::createTextRenderer):
1128         (WebCore::RenderTreeUpdater::updateTextRenderer):
1129         (WebCore::createTextRenderer): Deleted.
1130         * style/RenderTreeUpdater.h:
1131         * style/RenderTreeUpdaterFirstLetter.cpp:
1132         (WebCore::updateFirstLetterStyle):
1133         (WebCore::createFirstLetterRenderer):
1134         * style/RenderTreeUpdaterGeneratedContent.cpp:
1135         (WebCore::RenderTreeUpdater::GeneratedContent::updateQuotesUpTo):
1136         (WebCore::createContentRenderers):
1137         (WebCore::RenderTreeUpdater::GeneratedContent::updatePseudoElement):
1138         * style/RenderTreeUpdaterListItem.cpp:
1139         (WebCore::RenderTreeUpdater::ListItem::updateMarker):
1140         * style/RenderTreeUpdaterListItem.h:
1141         * style/RenderTreeUpdaterMultiColumn.cpp:
1142         (WebCore::RenderTreeUpdater::MultiColumn::createFragmentedFlow):
1143         (WebCore::RenderTreeUpdater::MultiColumn::destroyFragmentedFlow):
1144
1145 2017-12-16  Romain Bellessort  <romain.bellessort@crf.canon.fr>
1146
1147         [Readable Streams API] Fix filling of descriptor from queue
1148         https://bugs.webkit.org/show_bug.cgi?id=172717
1149
1150         Reviewed by Youenn Fablet.
1151
1152         Fixed the filling of descriptor from queue (step 10.d at [1]). When first implemented,
1153         spec comprised a bug and code was not reachable. Spec has now been fixed and code can
1154         now be reached.
1155
1156         [1] https://streams.spec.whatwg.org/#readable-byte-stream-controller-fill-pull-into-descriptor-from-queue
1157
1158         No new tests (covered by WPT tests, whose expectations have been updated).
1159
1160         * Modules/streams/ReadableByteStreamInternals.js:
1161         (readableByteStreamControllerFillDescriptorFromQueue): Updated.
1162
1163 2017-12-16  Brady Eidson  <beidson@apple.com>
1164
1165         Implement getting ServiceWorker registrations for the WKWebsiteDataStore API
1166         https://bugs.webkit.org/show_bug.cgi?id=180886
1167
1168         Reviewed by Chris Dumez.
1169
1170         No new tests (API test coming soon).
1171
1172         * workers/service/server/SWServer.cpp:
1173         (WebCore::SWServer::registrationStoreImportComplete):
1174         (WebCore::SWServer::SWServer):
1175         (WebCore::SWServer::getOriginsWithRegistrations):
1176         (WebCore::SWServer::performGetOriginsWithRegistrationsCallbacks):
1177         * workers/service/server/SWServer.h:
1178
1179 2017-12-16  Yusuke Suzuki  <utatane.tea@gmail.com>
1180
1181         Remove unnecessary boolean result of start() functions
1182         https://bugs.webkit.org/show_bug.cgi?id=180856
1183
1184         Reviewed by Darin Adler.
1185
1186         No behavior change.
1187
1188         * Modules/webaudio/AsyncAudioDecoder.cpp:
1189         (WebCore::AsyncAudioDecoder::~AsyncAudioDecoder):
1190         * Modules/webdatabase/DatabaseContext.cpp:
1191         (WebCore::DatabaseContext::databaseThread):
1192         * Modules/webdatabase/DatabaseThread.cpp:
1193         (WebCore::DatabaseThread::start):
1194         Now `Thread::create` always succeeds (if it fails, WebKit crashes).
1195         DatabaseThread::start() now always returns true. So, we do not need
1196         to return bool.
1197
1198         * Modules/webdatabase/DatabaseThread.h:
1199         * platform/network/curl/CurlDownload.cpp:
1200         (WebCore::CurlDownload::start):
1201         * platform/network/curl/CurlDownload.h:
1202         * platform/network/curl/ResourceHandleCurl.cpp:
1203         (WebCore::ResourceHandle::start):
1204         * platform/network/curl/ResourceHandleCurlDelegate.cpp:
1205         (WebCore::ResourceHandleCurlDelegate::start):
1206         * platform/network/curl/ResourceHandleCurlDelegate.h:
1207
1208 2017-12-16  Chris Dumez  <cdumez@apple.com>
1209
1210         Add optimization when updating a SW registration results in the exact same script
1211         https://bugs.webkit.org/show_bug.cgi?id=180891
1212
1213         Reviewed by Geoffrey Garen.
1214
1215         Add optimization when updating a SW registration results in the exact same script:
1216         - https://w3c.github.io/ServiceWorker/#update-algorithm (step 8)
1217
1218         No new tests, rebaselined existing test.
1219
1220         * workers/service/server/SWServerJobQueue.cpp:
1221         (WebCore::SWServerJobQueue::scriptFetchFinished):
1222
1223 2017-12-16  Youenn Fablet  <youenn@apple.com>
1224
1225         Service worker script fetch request should set the Service-Worker header
1226         https://bugs.webkit.org/show_bug.cgi?id=180889
1227
1228         Reviewed by Chris Dumez.
1229
1230         Test: http/wpt/service-workers/check-service-worker-header.https.html
1231
1232         Update WorkerScriptLoader to take a request instead of an URL.
1233         Updates Worker implementation and use it in ServiceWorkerJob to set the missing request header.
1234
1235         * workers/Worker.cpp:
1236         (WebCore::Worker::create):
1237         * workers/WorkerScriptLoader.cpp:
1238         (WebCore::WorkerScriptLoader::loadAsynchronously):
1239         * workers/WorkerScriptLoader.h:
1240         * workers/service/ServiceWorkerJob.cpp:
1241         (WebCore::ServiceWorkerJob::fetchScriptWithContext):
1242
1243 2017-12-15  Ryan Haddad  <ryanhaddad@apple.com>
1244
1245         Unreviewed, rolling out r225969.
1246
1247         This change introduced LayoutTest crashes.
1248
1249         Reverted changeset:
1250
1251         "Introduce RenderTreeBuilder"
1252         https://bugs.webkit.org/show_bug.cgi?id=180817
1253         https://trac.webkit.org/changeset/225969
1254
1255 2017-12-15  Chris Dumez  <cdumez@apple.com>
1256
1257         Support updating a service worker registration's updateViaCache flag
1258         https://bugs.webkit.org/show_bug.cgi?id=180888
1259
1260         Reviewed by Brady Eidson.
1261
1262         Support updating a service worker registration's updateViaCache flag to match other browsers:
1263         - https://github.com/w3c/ServiceWorker/issues/1189
1264
1265         No new tests, rebaselined existing test.
1266
1267         * workers/service/SWClientConnection.cpp:
1268         (WebCore::SWClientConnection::setRegistrationUpdateViaCache):
1269         * workers/service/SWClientConnection.h:
1270         * workers/service/ServiceWorkerRegistration.cpp:
1271         (WebCore::ServiceWorkerRegistration::setUpdateViaCache):
1272         * workers/service/ServiceWorkerRegistration.h:
1273         * workers/service/server/SWServer.h:
1274         * workers/service/server/SWServerJobQueue.cpp:
1275         (WebCore::SWServerJobQueue::runRegisterJob):
1276         * workers/service/server/SWServerRegistration.cpp:
1277         (WebCore::SWServerRegistration::setUpdateViaCache):
1278         * workers/service/server/SWServerRegistration.h:
1279
1280 2017-12-15  Ryan Haddad  <ryanhaddad@apple.com>
1281
1282         Unreviewed, rolling out r225941.
1283
1284         This change introduced LayoutTest crashes and assertion
1285         failures.
1286
1287         Reverted changeset:
1288
1289         "Web Inspector: replace HTMLCanvasElement with
1290         CanvasRenderingContext for instrumentation logic"
1291         https://bugs.webkit.org/show_bug.cgi?id=180770
1292         https://trac.webkit.org/changeset/225941
1293
1294 2017-12-15  Ryosuke Niwa  <rniwa@webkit.org>
1295
1296         Add a release assert that Timer::m_wasDeleted is false in setNextFireTime
1297         https://bugs.webkit.org/show_bug.cgi?id=180860
1298         <rdar://problem/36066500>
1299
1300         Reviewed by David Kilzer.
1301
1302         Turn an exist debug-only assertion into a release assertion to help diagnose a crash
1303         which appears to be caused by a freed timer getting scheduled back into the timer heap.
1304
1305         * platform/Timer.cpp:
1306         (WebCore::TimerBase::~TimerBase):
1307         (WebCore::TimerBase::setNextFireTime):
1308         * platform/Timer.h:
1309
1310 2017-12-15  Simon Fraser  <simon.fraser@apple.com>
1311
1312         Elements animated on-screen are missing sometimes
1313         https://bugs.webkit.org/show_bug.cgi?id=180773
1314         rdar://problem/34923438
1315
1316         Reviewed by Zalan Bujtas.
1317         
1318         After r225310 it was still possible for elements to be missing backing store when brought
1319         on-screen via an animation. This occurred if a child element was outside the bounds of the
1320         element being animated.
1321
1322         Fix by making sure that GraphicsLayer's "animatedExtent" took composited child layers into account.
1323
1324         As for r225310, no test because this is timing sensitive and hard to reliably make a test for.
1325
1326         * rendering/RenderLayer.cpp:
1327         (WebCore::RenderLayer::calculateClipRects const):
1328         * rendering/RenderLayer.h:
1329         * rendering/RenderLayerBacking.cpp:
1330         (WebCore::RenderLayerBacking::updateGeometry):
1331
1332 2017-12-15  Chris Dumez  <cdumez@apple.com>
1333
1334         imported/w3c/web-platform-tests/service-workers/service-worker/update.https.html is sometimes crashing in Debug builds
1335         https://bugs.webkit.org/show_bug.cgi?id=180867
1336
1337         Reviewed by Brady Eidson.
1338
1339         Fix assertion to make sure the worker is terminating if it is already in m_runningOrTerminatingWorkers.
1340
1341         * workers/service/server/SWServer.cpp:
1342         (WebCore::SWServer::runServiceWorker):
1343
1344 2017-12-15  Chris Dumez  <cdumez@apple.com>
1345
1346         Service Worker Registration promise is sometimes not rejected when the script load fails
1347         https://bugs.webkit.org/show_bug.cgi?id=180849
1348
1349         Reviewed by Brady Eidson.
1350
1351         Service Worker Registration promise is sometimes not rejected when the script load fails.
1352         This was caused by the ServiceWorkerJob sometimes passing a null ResourceError to the
1353         StorageProcess, even though the load failed.
1354
1355         No new tests, rebaselined exisiting tests.
1356
1357         * workers/WorkerScriptLoader.cpp:
1358         (WebCore::WorkerScriptLoader::notifyError):
1359         * workers/service/ServiceWorkerJob.cpp:
1360         (WebCore::ServiceWorkerJob::notifyFinished):
1361
1362 2017-12-15  Youenn Fablet  <youenn@apple.com>
1363
1364         WebRTC Stats should not be console logged from a background thread
1365         https://bugs.webkit.org/show_bug.cgi?id=180845
1366
1367         Reviewed by Eric Carlson.
1368
1369         Ensuring console log are done in the main thread.
1370
1371         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
1372         (WebCore::LibWebRTCMediaEndpoint::OnStatsDelivered):
1373
1374 2017-12-15  Antti Koivisto  <antti@apple.com>
1375
1376         Introduce RenderTreeBuilder
1377         https://bugs.webkit.org/show_bug.cgi?id=180817
1378
1379         Reviewed by Zalan Bujtas.
1380
1381         RenderTreeBuilder is responsible of building the render tree, including construction of various anonymous
1382         renderers. Renderer subtype specific render tree construction code will eventually move there.
1383
1384         This patch adds RenderTreeBuilder class and passes it as a parameter for all addChild implementations.
1385         Future patches can then mechanically move the building code from renderers to RenderTreeBuilder.
1386
1387         It also moves one addChild implementation (RenderRuby::addChild -> RenderTreeBuilder::rubyRunInsertChild)
1388         to RenderTreeBuilder as a test.
1389
1390         * WebCore.xcodeproj/project.pbxproj:
1391         * rendering/RenderBlock.cpp:
1392         (WebCore::RenderBlock::addChildToContinuation):
1393         (WebCore::RenderBlock::addChild):
1394         (WebCore::RenderBlock::addChildIgnoringContinuation):
1395         * rendering/RenderBlock.h:
1396         * rendering/RenderBlockFlow.cpp:
1397         (WebCore::RenderBlockFlow::addChild):
1398         * rendering/RenderBlockFlow.h:
1399         * rendering/RenderBoxModelObject.cpp:
1400         (WebCore::RenderBoxModelObject::moveChildTo):
1401         * rendering/RenderButton.cpp:
1402         (WebCore::RenderButton::addChild):
1403         (WebCore::RenderButton::setText):
1404         * rendering/RenderButton.h:
1405         * rendering/RenderElement.cpp:
1406         (WebCore::RenderElement::addChild):
1407         * rendering/RenderElement.h:
1408         (WebCore::RenderElement::addChildIgnoringContinuation):
1409         * rendering/RenderFullScreen.cpp:
1410         (WebCore::RenderFullScreen::wrapNewRenderer):
1411         (WebCore::RenderFullScreen::wrapExistingRenderer):
1412         (WebCore::RenderFullScreen::unwrapRenderer):
1413         (WebCore::RenderFullScreen::createPlaceholder):
1414         * rendering/RenderGrid.cpp:
1415         (WebCore::RenderGrid::addChild):
1416         * rendering/RenderGrid.h:
1417         * rendering/RenderInline.cpp:
1418         (WebCore::RenderInline::addChild):
1419         (WebCore::RenderInline::addChildIgnoringContinuation):
1420         (WebCore::RenderInline::splitInlines):
1421         (WebCore::RenderInline::splitFlow):
1422         (WebCore::RenderInline::addChildToContinuation):
1423         (WebCore::RenderInline::childBecameNonInline):
1424         * rendering/RenderInline.h:
1425         * rendering/RenderMenuList.cpp:
1426         (WebCore::RenderMenuList::createInnerBlock):
1427         (RenderMenuList::addChild):
1428         (RenderMenuList::setText):
1429         * rendering/RenderMenuList.h:
1430         * rendering/RenderMultiColumnFlow.cpp:
1431         (WebCore::RenderMultiColumnFlow::processPossibleSpannerDescendant):
1432         * rendering/RenderQuote.cpp:
1433         (WebCore::RenderQuote::updateTextRenderer):
1434         (WebCore::RenderQuote::updateRenderer):
1435         * rendering/RenderQuote.h:
1436         * rendering/RenderRuby.cpp:
1437         (WebCore::RenderRubyAsInline::addChild):
1438         (WebCore::RenderRubyAsBlock::addChild):
1439         * rendering/RenderRuby.h:
1440         * rendering/RenderRubyBase.h:
1441         * rendering/RenderRubyRun.cpp:
1442         (WebCore::RenderRubyRun::rubyBaseSafe):
1443         (WebCore::RenderRubyRun::addChild): Deleted.
1444         * rendering/RenderRubyRun.h:
1445         * rendering/RenderTable.cpp:
1446         (WebCore::RenderTable::addChild):
1447         * rendering/RenderTable.h:
1448         * rendering/RenderTableRow.cpp:
1449         (WebCore::RenderTableRow::addChild):
1450         * rendering/RenderTableRow.h:
1451         * rendering/RenderTableSection.cpp:
1452         (WebCore::RenderTableSection::addChild):
1453         * rendering/RenderTableSection.h:
1454         * rendering/RenderTreeBuilder.cpp: Added.
1455         (WebCore::RenderTreeBuilder::RenderTreeBuilder):
1456         (WebCore::RenderTreeBuilder::~RenderTreeBuilder):
1457         (WebCore::RenderTreeBuilder::insertChild):
1458         (WebCore::RenderTreeBuilder::rubyRunInsertChild):
1459         * rendering/RenderTreeBuilder.h: Added.
1460         (WebCore::RenderTreeBuilder::current):
1461         * rendering/TextAutoSizing.cpp:
1462         (WebCore::TextAutoSizingValue::adjustTextNodeSizes):
1463         * rendering/mathml/RenderMathMLFenced.cpp:
1464         (WebCore::RenderMathMLFenced::updateFromElement):
1465         (WebCore::RenderMathMLFenced::makeFences):
1466         (WebCore::RenderMathMLFenced::addChild):
1467         * rendering/mathml/RenderMathMLFenced.h:
1468         * rendering/svg/RenderSVGContainer.cpp:
1469         (WebCore::RenderSVGContainer::addChild):
1470         * rendering/svg/RenderSVGContainer.h:
1471         * rendering/svg/RenderSVGInline.cpp:
1472         (WebCore::RenderSVGInline::addChild):
1473         * rendering/svg/RenderSVGInline.h:
1474         * rendering/svg/RenderSVGRoot.cpp:
1475         (WebCore::RenderSVGRoot::addChild):
1476         * rendering/svg/RenderSVGRoot.h:
1477         * rendering/svg/RenderSVGText.cpp:
1478         (WebCore::RenderSVGText::addChild):
1479         * rendering/svg/RenderSVGText.h:
1480         * style/RenderTreePosition.cpp:
1481         (WebCore::RenderTreePosition::insert): Deleted.
1482         * style/RenderTreePosition.h:
1483         (WebCore::RenderTreePosition::RenderTreePosition):
1484         (WebCore::RenderTreePosition::nextSibling const):
1485         (WebCore::RenderTreePosition::canInsert const): Deleted.
1486         * style/RenderTreeUpdater.cpp:
1487         (WebCore::RenderTreeUpdater::updateAfterDescendants):
1488         (WebCore::RenderTreeUpdater::createRenderer):
1489         (WebCore::RenderTreeUpdater::createTextRenderer):
1490         (WebCore::RenderTreeUpdater::updateTextRenderer):
1491         (WebCore::createTextRenderer): Deleted.
1492         * style/RenderTreeUpdater.h:
1493         * style/RenderTreeUpdaterFirstLetter.cpp:
1494         (WebCore::updateFirstLetterStyle):
1495         (WebCore::createFirstLetterRenderer):
1496         * style/RenderTreeUpdaterGeneratedContent.cpp:
1497         (WebCore::RenderTreeUpdater::GeneratedContent::updateQuotesUpTo):
1498         (WebCore::createContentRenderers):
1499         (WebCore::RenderTreeUpdater::GeneratedContent::updatePseudoElement):
1500         * style/RenderTreeUpdaterListItem.cpp:
1501         (WebCore::RenderTreeUpdater::ListItem::updateMarker):
1502         * style/RenderTreeUpdaterListItem.h:
1503         * style/RenderTreeUpdaterMultiColumn.cpp:
1504         (WebCore::RenderTreeUpdater::MultiColumn::createFragmentedFlow):
1505         (WebCore::RenderTreeUpdater::MultiColumn::destroyFragmentedFlow):
1506
1507 2017-12-14  Youenn Fablet  <youenn@apple.com>
1508
1509         Implement <iframe allow="camera; microphone">
1510         https://bugs.webkit.org/show_bug.cgi?id=167430
1511
1512         Reviewed by Eric Carlson.
1513
1514         Tests: imported/w3c/web-platform-tests/mediacapture-streams/MediaStream-default-feature-policy.https.sub.html
1515
1516         Adding allow attribute to HTMLIFrameElement as per https://wicg.github.io/feature-policy/#iframe-allow-attribute.
1517         Cross-origin iframes will get access to camera/microphone based on this attribute value.
1518         Same-origin iframes do not need any attribute.
1519         In case getUserMedia requests both camera and microphone, and allow attribute is only one of these,
1520         getUserMedia access is denied. This goes against the tests but is not very clear from the specification.
1521
1522         * Modules/mediastream/UserMediaRequest.cpp:
1523         (WebCore::isSecure):
1524         (WebCore::isAllowedToUse):
1525         (WebCore::canCallGetUserMedia):
1526         (WebCore::UserMediaRequest::start):
1527         * html/HTMLAttributeNames.in:
1528         * html/HTMLIFrameElement.cpp:
1529         (WebCore::HTMLIFrameElement::parseAttribute):
1530         * html/HTMLIFrameElement.h:
1531         * html/HTMLIFrameElement.idl:
1532
1533 2017-12-14  Zalan Bujtas  <zalan@apple.com>
1534
1535         Inconsistent section grid could lead to CrashOnOverflow
1536         https://bugs.webkit.org/show_bug.cgi?id=180850
1537         <rdar://problem/34064811>
1538
1539         Reviewed by Simon Fraser.
1540
1541         Each RenderTableSection maintains a grid of rows and columns. The number of columns in this grid equals the
1542         maximum number of columns in the entire table (taking spans and multiple sections into account).
1543         Since the maximum number of columns might change while re-computing the sections, we need to
1544         adjust them accordingly at the end (otherwise it could lead to inconsistent grids where rows have different number of columns).
1545
1546         Test: fast/table/table-row-oveflow-crash.html
1547
1548         * rendering/RenderTable.cpp:
1549         (WebCore::RenderTable::recalcSections const):
1550         * rendering/RenderTableSection.cpp:
1551         (WebCore::RenderTableSection::removeRedundantColumns):
1552         * rendering/RenderTableSection.h:
1553
1554 2017-12-14  David Kilzer  <ddkilzer@apple.com>
1555
1556         Enable -Wstrict-prototypes for WebKit
1557         <https://webkit.org/b/180757>
1558         <rdar://problem/36024132>
1559
1560         Rubber-stamped by Joseph Pecoraro.
1561
1562         * Configurations/Base.xcconfig:
1563         (CLANG_WARN_STRICT_PROTOTYPES): Add. Set to YES.
1564
1565 2017-12-14  Youenn Fablet  <youenn@apple.com>
1566
1567         srflx and relay ICE candidates lack raddr (rel-addr) and rport (rel-port) attributes if getUserMedia access has not been granted
1568         https://bugs.webkit.org/show_bug.cgi?id=180842
1569
1570         Reviewed by Jon Lee.
1571
1572         Manually tested since there is no way to gather reflexive or stun candidates in WebKit CI.
1573
1574         * Modules/mediastream/PeerConnectionBackend.cpp:
1575         (WebCore::filterICECandidate):
1576
1577 2017-12-14  Commit Queue  <commit-queue@webkit.org>
1578
1579         Unreviewed, rolling out r225878.
1580         https://bugs.webkit.org/show_bug.cgi?id=180855
1581
1582         Introduced a crash in HTMLPictureElement. We're taking a
1583         different approach for webkit.org/b/180769 (Requested by rniwa
1584         on #webkit).
1585
1586         Reverted changeset:
1587
1588         "Crash inside ImageLoader::updateFromElement()"
1589         https://bugs.webkit.org/show_bug.cgi?id=180769
1590         https://trac.webkit.org/changeset/225878
1591
1592 2017-12-14  Ryan Haddad  <ryanhaddad@apple.com>
1593
1594         Unreviewed, rolling out r225931.
1595
1596         Breaks internal builds.
1597
1598         Reverted changeset:
1599
1600         "Fix Mac CMake build"
1601         https://bugs.webkit.org/show_bug.cgi?id=180835
1602         https://trac.webkit.org/changeset/225931
1603
1604 2017-12-14  Simon Fraser  <simon.fraser@apple.com>
1605
1606         Another Windows build fix.
1607
1608         * platform/graphics/cg/GraphicsContextCG.cpp:
1609         (WebCore::extendedSRGBColorSpaceRef):
1610
1611 2017-12-14  Simon Fraser  <simon.fraser@apple.com>
1612
1613         Fix Windows build after r225915.
1614
1615         Windows doens't have dispatch_once with blocks. Switch to use lambda functions instead.
1616
1617         * platform/graphics/cg/GraphicsContextCG.cpp:
1618         (WebCore::sRGBColorSpaceRef):
1619         (WebCore::linearRGBColorSpaceRef):
1620         (WebCore::extendedSRGBColorSpaceRef):
1621         (WebCore::displayP3ColorSpaceRef):
1622
1623 2017-12-14  Devin Rousso  <webkit@devinrousso.com>
1624
1625         Web Inspector: replace HTMLCanvasElement with CanvasRenderingContext for instrumentation logic
1626         https://bugs.webkit.org/show_bug.cgi?id=180770
1627
1628         Reviewed by Joseph Pecoraro.
1629
1630         No change in functionality.
1631
1632         * html/canvas/CanvasRenderingContext.h:
1633         * html/canvas/CanvasRenderingContext.cpp:
1634         (WebCore::CanvasRenderingContext::~CanvasRenderingContext):
1635         Instead of waiting on the HTMLCanvasElement to destruct to call willDestroyCanvasRenderingContext
1636         we can call out in the destructor and know that the CanvasRenderingContext will be destroyed
1637         immediately thereafter.
1638
1639         * html/canvas/CanvasRenderingContext2D.h:
1640         * html/canvas/CanvasRenderingContext2D.cpp:
1641         (WebCore::CanvasRenderingContext2D::create):
1642         * html/canvas/ImageBitmapRenderingContext.h:
1643         * html/canvas/ImageBitmapRenderingContext.cpp:
1644         (WebCore::ImageBitmapRenderingContext::create):
1645         * html/canvas/WebGL2RenderingContext.h:
1646         * html/canvas/WebGL2RenderingContext.cpp:
1647         (WebCore::WebGL2RenderingContext::create):
1648         * html/canvas/WebGLRenderingContext.h:
1649         * html/canvas/WebGLRenderingContext.cpp:
1650         (WebCore::WebGLRenderingContext::create):
1651         * html/canvas/WebGLRenderingContextBase.cpp:
1652         (WebCore::WebGLRenderingContextBase::create):
1653         * html/canvas/WebGPURenderingContext.cpp:
1654         (WebCore::WebGPURenderingContext::create):
1655         * html/HTMLCanvasElement.cpp:
1656         (WebCore::HTMLCanvasElement::createContext2d):
1657         (WebCore::HTMLCanvasElement::createContextWebGL):
1658         (WebCore::HTMLCanvasElement::createContextWebGPU):
1659         (WebCore::HTMLCanvasElement::createContextBitmapRenderer):
1660         (WebCore::HTMLCanvasElement::paint):
1661         (WebCore::HTMLCanvasElement::setImageBuffer const):
1662         Instead of adding didCreateCanvasRenderingContext calls at the construction sites of each
1663         context, we can make the constructors private and force the usage of static `create` functions.
1664         This way, we have access to the fully constructed object and have a guaranteed path for creation.
1665
1666         * inspector/InspectorCanvas.h:
1667         * inspector/InspectorCanvas.cpp:
1668         (WebCore::InspectorCanvas::create):
1669         (WebCore::InspectorCanvas::InspectorCanvas):
1670         (WebCore::InspectorCanvas::canvasElement):
1671         (WebCore::InspectorCanvas::resetRecordingData):
1672         (WebCore::InspectorCanvas::recordAction):
1673         (WebCore::InspectorCanvas::buildObjectForCanvas):
1674         (WebCore::InspectorCanvas::getCanvasContentAsDataURL):
1675         (WebCore::InspectorCanvas::buildInitialState):
1676         
1677         * inspector/InspectorShaderProgram.h:
1678         * inspector/InspectorShaderProgram.cpp:
1679         (WebCore::InspectorShaderProgram::context const):
1680
1681         * inspector/agents/InspectorCanvasAgent.h:
1682         * inspector/agents/InspectorCanvasAgent.cpp:
1683         (WebCore::InspectorCanvasAgent::InspectorCanvasAgent):
1684         (WebCore::InspectorCanvasAgent::enable):
1685         (WebCore::InspectorCanvasAgent::disable):
1686         (WebCore::InspectorCanvasAgent::requestNode):
1687         (WebCore::InspectorCanvasAgent::requestContent):
1688         (WebCore::InspectorCanvasAgent::requestCSSCanvasClientNodes):
1689         (WebCore::contextAsScriptValue):
1690         (WebCore::InspectorCanvasAgent::resolveCanvasContext):
1691         (WebCore::InspectorCanvasAgent::startRecording):
1692         (WebCore::InspectorCanvasAgent::stopRecording):
1693         (WebCore::InspectorCanvasAgent::updateShader):
1694         (WebCore::InspectorCanvasAgent::frameNavigated):
1695         (WebCore::InspectorCanvasAgent::didChangeCSSCanvasClientNodes):
1696         (WebCore::InspectorCanvasAgent::didCreateCanvasRenderingContext):
1697         (WebCore::InspectorCanvasAgent::willDestroyCanvasRenderingContext):
1698         (WebCore::InspectorCanvasAgent::didChangeCanvasMemory):
1699         (WebCore::InspectorCanvasAgent::recordCanvasAction):
1700         (WebCore::InspectorCanvasAgent::didFinishRecordingCanvasFrame):
1701         (WebCore::InspectorCanvasAgent::consoleStartRecordingCanvas):
1702         (WebCore::InspectorCanvasAgent::didEnableExtension):
1703         (WebCore::InspectorCanvasAgent::didCreateProgram):
1704         (WebCore::InspectorCanvasAgent::canvasDestroyedTimerFired):
1705         (WebCore::InspectorCanvasAgent::canvasRecordingTimerFired):
1706         (WebCore::InspectorCanvasAgent::clearCanvasData):
1707         (WebCore::InspectorCanvasAgent::unbindCanvas):
1708         (WebCore::InspectorCanvasAgent::findInspectorCanvas):
1709         (WebCore::InspectorCanvasAgent::unbindProgram):
1710         (WebCore::InspectorCanvasAgent::didCreateCSSCanvas): Deleted.
1711         (WebCore::InspectorCanvasAgent::canvasDestroyed): Deleted.
1712
1713         * inspector/InspectorInstrumentation.h:
1714         (WebCore::InspectorInstrumentation::didCreateCanvasRenderingContext):
1715         (WebCore::InspectorInstrumentation::willDestroyCanvasRenderingContext):
1716         (WebCore::InspectorInstrumentation::didChangeCanvasMemory):
1717         (WebCore::InspectorInstrumentation::recordCanvasAction):
1718         (WebCore::InspectorInstrumentation::didFinishRecordingCanvasFrame):
1719         (WebCore::InspectorInstrumentation::didEnableExtension):
1720         (WebCore::InspectorInstrumentation::didCreateProgram):
1721         (WebCore::InspectorInstrumentation::willDeleteProgram):
1722         (WebCore::InspectorInstrumentation::isShaderProgramDisabled):
1723         (WebCore::InspectorInstrumentation::consoleStartRecordingCanvas):
1724         (WebCore::InspectorInstrumentation::didCreateCSSCanvas): Deleted.
1725         * inspector/InspectorInstrumentation.cpp:
1726         (WebCore::InspectorInstrumentation::consoleStartRecordingCanvasImpl):
1727         (WebCore::InspectorInstrumentation::didChangeCSSCanvasClientNodesImpl):
1728         (WebCore::InspectorInstrumentation::didCreateCanvasRenderingContextImpl):
1729         (WebCore::InspectorInstrumentation::willDestroyCanvasRenderingContextImpl):
1730         (WebCore::InspectorInstrumentation::didChangeCanvasMemoryImpl):
1731         (WebCore::InspectorInstrumentation::didFinishRecordingCanvasFrameImpl):
1732         (WebCore::InspectorInstrumentation::didEnableExtensionImpl):
1733         (WebCore::InspectorInstrumentation::didCreateProgramImpl):
1734         (WebCore::InspectorInstrumentation::didCreateCSSCanvasImpl): Deleted.
1735
1736         * page/PageConsoleClient.cpp:
1737         (WebCore::PageConsoleClient::record):
1738         (WebCore::PageConsoleClient::recordEnd):
1739
1740         * dom/Document.h:
1741         * dom/Document.cpp:
1742         (WebCore::Document::getCSSCanvasElement):
1743         (WebCore::Document::nameForCSSCanvasElement const):
1744         We have no reason to save the CSS canvas name for each InspectorCanvas object, so instead we
1745         can just query for the name based on the CanvasRenderingContext's HTMLCanvasElement (assuming
1746         it is not an OffscreenCanvas) when we need it.
1747
1748 2017-12-14  Chris Dumez  <cdumez@apple.com>
1749
1750         self.importScripts() should obey updateViaCache inside service workers
1751         https://bugs.webkit.org/show_bug.cgi?id=180826
1752
1753         Reviewed by Youenn Fablet.
1754
1755         self.importScripts() should obey updateViaCache inside service workers, as per:
1756         - https://html.spec.whatwg.org/multipage/workers.html#dom-workerglobalscope-importscripts
1757
1758         Tests: http/tests/workers/service/registration-updateViaCache-all-importScripts.html
1759                http/tests/workers/service/registration-updateViaCache-imports-importScripts.html
1760                http/tests/workers/service/registration-updateViaCache-none-importScripts.html
1761
1762         * workers/WorkerGlobalScope.cpp:
1763         (WebCore::WorkerGlobalScope::importScripts):
1764         * workers/WorkerScriptLoader.cpp:
1765         (WebCore::WorkerScriptLoader::loadSynchronously):
1766         * workers/WorkerScriptLoader.h:
1767         * workers/service/SWClientConnection.cpp:
1768         (WebCore::SWClientConnection::setRegistrationLastUpdateTime):
1769         * workers/service/SWClientConnection.h:
1770         * workers/service/ServiceWorkerRegistration.cpp:
1771         (WebCore::ServiceWorkerRegistration::lastUpdateTime const):
1772         (WebCore::ServiceWorkerRegistration::setLastUpdateTime):
1773         * workers/service/ServiceWorkerRegistration.h:
1774         * workers/service/server/SWServer.h:
1775         * workers/service/server/SWServerRegistration.cpp:
1776         (WebCore::SWServerRegistration::setLastUpdateTime):
1777         * workers/service/server/SWServerRegistration.h:
1778
1779 2017-12-14  Yusuke Suzuki  <utatane.tea@gmail.com>
1780
1781         Drop Thread::tryCreate
1782         https://bugs.webkit.org/show_bug.cgi?id=180808
1783
1784         Reviewed by Darin Adler.
1785
1786         This change reveals that nobody cares the WorkerThread::start's failure.
1787         We should use `Thread::create` to ensure thread is actually starting.
1788
1789         * workers/WorkerThread.cpp:
1790         (WebCore::WorkerThread::start):
1791         * workers/WorkerThread.h:
1792
1793 2017-12-14  Alicia Boya García  <aboya@igalia.com>
1794
1795         [MSE] Add isValid() check before using trackBuffer.lastEnqueuedPresentationTime
1796         https://bugs.webkit.org/show_bug.cgi?id=180258
1797
1798         Reviewed by Jer Noble.
1799
1800         * Modules/mediasource/SourceBuffer.cpp:
1801         (WebCore::SourceBuffer::sourceBufferPrivateDidReceiveSample):
1802
1803 2017-12-14  John Wilander  <wilander@apple.com>
1804
1805         Storage Access API: Implement frame-specific access in the document.cookie layer
1806         https://bugs.webkit.org/show_bug.cgi?id=180682
1807         <rdar://problem/35982257>
1808
1809         Reviewed by Alex Christensen.
1810
1811         No new tests. Changed expected result from existing test.
1812
1813         CookiesStrategy::cookiesForDOM(), CookiesStrategy::setCookiesFromDOM(),
1814         CookiesStrategy::cookieRequestHeaderFieldValue(), and
1815         CookiesStrategy::getRawCookies() now take optional parameters for
1816         frameID and pageID to allow frame-specific scoping of cookies.
1817
1818         This change makes the return values of FrameLoaderClient::frameID()
1819         and FrameLoaderClient::pageID() std::optional<uint64_t> so that
1820         WebCore can call those getters and get the right return values in
1821         WebKit and std:nullopt in WebKitLegacy.
1822
1823         * dom/Document.cpp:
1824         (WebCore::Document::requestStorageAccess):
1825         * loader/CookieJar.cpp:
1826         (WebCore::cookies):
1827         (WebCore::setCookies):
1828         (WebCore::cookieRequestHeaderFieldValue):
1829         (WebCore::getRawCookies):
1830         * loader/EmptyFrameLoaderClient.h:
1831         * loader/FrameLoaderClient.h:
1832         * platform/CookiesStrategy.h:
1833         * platform/network/CacheValidation.cpp:
1834         (WebCore::headerValueForVary):
1835         * platform/network/PlatformCookieJar.h:
1836         * platform/network/cf/CookieJarCFNet.cpp:
1837         (WebCore::setCookiesFromDOM):
1838         (WebCore::cookiesForDOM):
1839         (WebCore::cookieRequestHeaderFieldValue):
1840         (WebCore::getRawCookies):
1841         * platform/network/curl/CookieJarCurl.cpp:
1842         (WebCore::CookieJarCurlFileSystem::setCookiesFromDOM):
1843         (WebCore::CookieJarCurlFileSystem::cookiesForDOM):
1844         (WebCore::CookieJarCurlFileSystem::cookieRequestHeaderFieldValue):
1845         (WebCore::CookieJarCurlFileSystem::getRawCookies):
1846         (WebCore::cookiesForDOM):
1847         (WebCore::setCookiesFromDOM):
1848         (WebCore::cookieRequestHeaderFieldValue):
1849         (WebCore::getRawCookies):
1850         * platform/network/curl/CookieJarCurl.h:
1851         * platform/network/mac/CookieJarMac.mm:
1852         (WebCore::cookiesInPartitionForURL):
1853         (WebCore::cookiesForURL):
1854         (WebCore::cookiesForSession):
1855         (WebCore::cookiesForDOM):
1856         (WebCore::cookieRequestHeaderFieldValue):
1857         (WebCore::setCookiesFromDOM):
1858         (WebCore::getRawCookies):
1859         * platform/network/soup/CookieJarSoup.cpp:
1860         (WebCore::setCookiesFromDOM):
1861         (WebCore::cookiesForDOM):
1862         (WebCore::cookieRequestHeaderFieldValue):
1863         (WebCore::getRawCookies):
1864
1865 2017-12-14  Alex Christensen  <achristensen@webkit.org>
1866
1867         Fix Mac CMake build
1868         https://bugs.webkit.org/show_bug.cgi?id=180835
1869
1870         Reviewed by Andy Estes.
1871
1872         * PlatformMac.cmake:
1873         * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.h:
1874
1875 2017-12-14  Antoine Quint  <graouts@apple.com>
1876
1877         [Web Animations] Use is<> when possible
1878         https://bugs.webkit.org/show_bug.cgi?id=180832
1879
1880         Reviewed by Dean Jackson.
1881
1882         Adopt is<> when possible.
1883
1884         * animation/WebAnimation.cpp:
1885         (WebCore::WebAnimation::setEffect):
1886         (WebCore::WebAnimation::setTimeline):
1887         (WebCore::WebAnimation::startOrStopAccelerated):
1888
1889 2017-12-14  Antoine Quint  <graouts@apple.com>
1890
1891         [Web Animations] Bring timeline and currentTime setters closer to compliance
1892         https://bugs.webkit.org/show_bug.cgi?id=180834
1893
1894         Reviewed by Dean Jackson.
1895
1896         Now that we've added support for the concept of a hold time, pending tasks
1897         and updating the finished state, adopt those in places we had already implemented
1898         but weren't fully compliant.
1899
1900         Web Platform Tests cover these behaviors, but we're currently failing those tests
1901         due to lacking an implementation for Element.animate().
1902
1903         * animation/WebAnimation.cpp:
1904         (WebCore::WebAnimation::setTimeline): Add some spec comments to clarify the code behavior
1905         and implement step 4 of the "setting the timeline" procedure where we reset the hold time
1906         to an unresolved value if the start time is resolved, as well as step 5 where we update the
1907         finished state. Finally, we also ensure we update the pending tasks as the ready state is
1908         dependent on a timeline being set.
1909         (WebCore::WebAnimation::bindingsStartTime const): Invert the way we test for an unresolved
1910         value to match prior review comments by Dean Jackson.
1911         (WebCore::WebAnimation::setBindingsStartTime): Use a boolean check rather than checking
1912         equality with std::nullopt.
1913         (WebCore::WebAnimation::setBindingsCurrentTime): Do not raise an exception when setting
1914         an unresolved time.
1915
1916 2017-12-14  Antoine Quint  <graouts@apple.com>
1917
1918         [Web Animations] Implement the cancel() method on Animation
1919         https://bugs.webkit.org/show_bug.cgi?id=180830
1920         <rdar://problem/36055816>
1921
1922         Reviewed by Dean Jackson.
1923
1924         We implement the cancel() method on the Animation interface with full spec text defining
1925         the normative behavior of those methods and code matching those steps. Implementing the
1926         cancel() method required implementing the notion of "resetting pending tasks",
1927         which the Web Animations spec defines as well.
1928
1929         * animation/WebAnimation.cpp:
1930         (WebCore::WebAnimation::setEffect):
1931         (WebCore::WebAnimation::cancel):
1932         (WebCore::WebAnimation::resetPendingTasks):
1933         * animation/WebAnimation.h:
1934         * animation/WebAnimation.idl:
1935
1936 2017-12-14  Jer Noble  <jer.noble@apple.com>
1937
1938         "Click to exit fullscreen" text not legible on High Sierra
1939         https://bugs.webkit.org/show_bug.cgi?id=180825
1940         <rdar://problem/32839983>
1941
1942         Reviewed by Eric Carlson.
1943
1944         Explicitly set the NSVisualAffectView's .appearance property.
1945
1946         * platform/mac/WebCoreFullScreenPlaceholderView.mm:
1947         (-[WebCoreFullScreenPlaceholderView initWithFrame:]):
1948
1949 2017-12-14  Antoine Quint  <graouts@apple.com>
1950
1951         [Web Animations] Implement the finish() method on Animation
1952         https://bugs.webkit.org/show_bug.cgi?id=180822
1953         <rdar://problem/36053282>
1954
1955         Reviewed by Dean Jackson.
1956
1957         We implement the finish() method on the Animation interface with full spec text defining
1958         the normative behavior of those methods and code matching those steps. Implementing the
1959         finish() method required implementing the notion of "silently setting the current time",
1960         which the Web Animations spec defines as well.
1961
1962         * animation/WebAnimation.cpp:
1963         (WebCore::WebAnimation::silentlySetCurrentTime):
1964         (WebCore::WebAnimation::setCurrentTime):
1965         (WebCore::WebAnimation::finish):
1966         * animation/WebAnimation.h:
1967         * animation/WebAnimation.idl:
1968
1969 2017-12-14  Chris Dumez  <cdumez@apple.com>
1970
1971         Service worker script fetching currently always uses the network cache
1972         https://bugs.webkit.org/show_bug.cgi?id=180816
1973
1974         Reviewed by Alex Christensen.
1975
1976         Service worker script fetching currently always uses the network cache. This is incorrect as per:
1977         - https://w3c.github.io/ServiceWorker/#update-algorithm (step 7.2)
1978
1979         Tests: http/tests/workers/service/registration-updateViaCache-all.html
1980                http/tests/workers/service/registration-updateViaCache-none.html
1981
1982         * workers/Worker.cpp:
1983         (WebCore::Worker::create):
1984         * workers/WorkerScriptLoader.cpp:
1985         (WebCore::WorkerScriptLoader::loadAsynchronously):
1986         * workers/WorkerScriptLoader.h:
1987         * workers/service/SWClientConnection.cpp:
1988         (WebCore::SWClientConnection::startScriptFetchForServer):
1989         * workers/service/SWClientConnection.h:
1990         * workers/service/ServiceWorkerContainer.cpp:
1991         (WebCore::ServiceWorkerContainer::startScriptFetchForJob):
1992         * workers/service/ServiceWorkerContainer.h:
1993         * workers/service/ServiceWorkerJob.cpp:
1994         (WebCore::ServiceWorkerJob::startScriptFetch):
1995         (WebCore::ServiceWorkerJob::fetchScriptWithContext):
1996         * workers/service/ServiceWorkerJob.h:
1997         * workers/service/ServiceWorkerJobClient.h:
1998         * workers/service/server/SWServer.cpp:
1999         (WebCore::SWServer::startScriptFetch):
2000         * workers/service/server/SWServer.h:
2001         * workers/service/server/SWServerJobQueue.cpp:
2002         (WebCore::SWServerJobQueue::runUpdateJob):
2003         * workers/service/server/SWServerRegistration.h:
2004         (WebCore::SWServerRegistration::lastUpdateTime const):
2005
2006 2017-12-14  Simon Fraser  <simon.fraser@apple.com>
2007
2008         Remove ColorSpaceDeviceRGB and most users of the obsolete deviceRGB colorspace
2009         https://bugs.webkit.org/show_bug.cgi?id=180689
2010
2011         Reviewed by Darin Adler.
2012         
2013         Address issues noted by Darin in r225797:
2014         
2015         Existing and new code mistakenly allocated colorspaces on every call, because
2016         they didn't initialize the static variable on the first call. Avoid this mistake
2017         by using dispatch_once() in these functions.
2018
2019         Fix a case where the extendedSRGBColorSpaceRef() fallback was returning deviceRGB
2020         instead of sRGB.
2021
2022         * platform/graphics/cg/GraphicsContextCG.cpp:
2023         (WebCore::sRGBColorSpaceRef):
2024         (WebCore::linearRGBColorSpaceRef):
2025         (WebCore::extendedSRGBColorSpaceRef):
2026         (WebCore::displayP3ColorSpaceRef):
2027         * platform/graphics/cocoa/GraphicsContextCocoa.mm:
2028         (WebCore::linearRGBColorSpaceRef):
2029
2030 2017-12-13  Keith Miller  <keith_miller@apple.com>
2031
2032         JSObjects should have a mask for loading indexed properties
2033         https://bugs.webkit.org/show_bug.cgi?id=180768
2034
2035         Reviewed by Mark Lam.
2036
2037         * bindings/js/JSDOMConvertSequences.h:
2038         (WebCore::Detail::NumericSequenceConverter::convertArray):
2039         (WebCore::Detail::SequenceConverter::convertArray):
2040
2041 2017-12-13  Antoine Quint  <graouts@apple.com>
2042
2043         [Web Animations] Implement the play() and pause() methods on Animation
2044         https://bugs.webkit.org/show_bug.cgi?id=178932
2045         <rdar://problem/35271069>
2046
2047         Reviewed by Eric Carlson.
2048
2049         We implement the play() and pause() methods of the Animation interface with full spec text defining
2050         the normative behavior of those methods and code matching those steps. Playing and pausing animations
2051         incur running a play or pause task when conditions are met, specifically here when the timeline is ready.
2052         So we add the notion of pending tasks and provide a proper implementation of pending() which we had
2053         introduced in an earlier patch with a constant false return value.
2054
2055         Note that the play() method exposes an auto-rewinding flag which we always set to true, but other specs,
2056         namely CSS Animations, do not require the rewinding behavior, so we expose it for future use.
2057
2058         * animation/WebAnimation.cpp:
2059         (WebCore::WebAnimation::play):
2060         (WebCore::WebAnimation::setTimeToRunPendingPlayTask):
2061         (WebCore::WebAnimation::runPendingPlayTask):
2062         (WebCore::WebAnimation::pause):
2063         (WebCore::WebAnimation::setTimeToRunPendingPauseTask):
2064         (WebCore::WebAnimation::runPendingPauseTask):
2065         (WebCore::WebAnimation::updatePendingTasks):
2066         * animation/WebAnimation.h:
2067         * animation/WebAnimation.idl:
2068
2069 2017-12-14  Frederic Wang  <fwang@igalia.com>
2070
2071         Make GraphicsLayer::dumpProperties dump m_offsetFromRenderer
2072         https://bugs.webkit.org/show_bug.cgi?id=180473
2073
2074         Reviewed by Antonio Gomes.
2075
2076         No new tests, this is just a new debug info.
2077
2078         * platform/graphics/GraphicsLayer.cpp:
2079         (WebCore::GraphicsLayer::dumpProperties const): Dump the offset from renderer if nonzero.
2080
2081 2017-12-12  Yusuke Suzuki  <utatane.tea@gmail.com>
2082
2083         REGRESSION(r225769): Build errors with constexpr std::tie on older gcc
2084         https://bugs.webkit.org/show_bug.cgi?id=180692
2085
2086         Reviewed by Carlos Garcia Campos.
2087
2088         * platform/graphics/FontSelectionAlgorithm.h:
2089         (WebCore::FontSelectionRange::operator== const):
2090         (WebCore::FontSelectionRequest::tied const):
2091         (WebCore::FontSelectionCapabilities::tied const):
2092         (WebCore::FontSelectionSpecifiedCapabilities:: const):
2093
2094 2017-12-13  Daniel Bates  <dabates@apple.com>
2095
2096         Fix the Windows build after <https://trac.webkit.org/changeset/225879>
2097         (https://bugs.webkit.org/show_bug.cgi?id=180651)
2098
2099         * html/TextFieldInputType.cpp:
2100         (WebCore::autoFillButtonTypeToAccessibilityLabel):
2101         (WebCore::autoFillButtonTypeToAutoFillButtonText):
2102         (WebCore::autoFillButtonTypeToAutoFillButtonPseudoClassName):
2103
2104 2017-12-13  Devin Rousso  <webkit@devinrousso.com>
2105
2106         Web Inspector: add instrumentation for ImageBitmapRenderingContext
2107         https://bugs.webkit.org/show_bug.cgi?id=180736
2108
2109         Reviewed by Joseph Pecoraro.
2110
2111         Tests: inspector/canvas/create-context-bitmaprenderer.html
2112                inspector/canvas/requestContent-bitmaprenderer.html
2113                inspector/canvas/resolveCanvasContext-bitmaprenderer.html
2114
2115         * CMakeLists.txt:
2116         * Sources.txt:
2117         * WebCore.xcodeproj/project.pbxproj:
2118
2119         * html/HTMLCanvasElement.cpp:
2120         (WebCore::HTMLCanvasElement::getContext):
2121         (WebCore::HTMLCanvasElement::createContextBitmapRenderer):
2122         Support passing an optional settings dictionary when creating an ImageBitmapRenderingContext.
2123
2124         * inspector/agents/InspectorCanvasAgent.cpp:
2125         (WebCore::InspectorCanvasAgent::requestContent):
2126         (WebCore::contextAsScriptValue):
2127
2128         * bindings/js/CallTracerTypes.h:
2129
2130         * inspector/InspectorCanvas.h:
2131         * inspector/InspectorCanvas.cpp:
2132         (WebCore::InspectorCanvas::buildObjectForCanvas):
2133         (WebCore::InspectorCanvas::indexForData):
2134         (WebCore::InspectorCanvas::buildAction):
2135         (WebCore::InspectorCanvas::buildArrayForImageBitmap): Deleted.
2136
2137 2017-12-13  Daniel Bates  <dabates@apple.com>
2138
2139         Add more auto fill button types
2140         https://bugs.webkit.org/show_bug.cgi?id=180651
2141         <rdar://problem/35891125>
2142         And
2143         <rdar://problem/35977943>
2144
2145         Reviewed by Brent Fulgham.
2146
2147         Tests: fast/forms/auto-fill-button/input-autofilled-disabled-strong-password-auto-fill-button.html
2148                fast/forms/auto-fill-button/input-autofilled-readonly-strong-password-auto-fill-button.html
2149                fast/forms/auto-fill-button/input-disabled-strong-password-and-strong-confirmation-password-auto-fill-buttons.html
2150                fast/forms/auto-fill-button/input-readonly-strong-password-and-strong-confirmation-password-auto-fill-buttons.html
2151                fast/forms/auto-fill-button/input-strong-confirmation-password-auto-fill-button.html
2152                fast/forms/auto-fill-button/input-strong-password-auto-fill-button.html
2153
2154         * English.lproj/Localizable.strings:
2155         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
2156         (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]): Add strings for new auto fill button types.
2157
2158         * css/CSSSelector.cpp:
2159         (WebCore::CSSSelector::selectorText const):
2160         * css/CSSSelector.h:
2161         * css/SelectorChecker.cpp:
2162         (WebCore::SelectorChecker::checkOne const):
2163         * css/SelectorCheckerTestFunctions.h:
2164         (WebCore::isAutofilledStrongPassword):
2165         * css/SelectorPseudoClassAndCompatibilityElementMap.in:
2166         * css/html.css:
2167         (input::-webkit-strong-password-auto-fill-button):
2168         (input:-webkit-autofill-strong-password):
2169         (input:-webkit-autofill, input:-webkit-autofill-strong-password):
2170         (input:-webkit-autofill): Deleted.
2171         * cssjit/SelectorCompiler.cpp:
2172         (WebCore::SelectorCompiler::addPseudoClassType):
2173         Add new CSS pseudo class and CSS styles.
2174
2175         * html/HTMLInputElement.cpp:
2176         (WebCore::HTMLInputElement::reset): Hide the auto fill button when the form is reset. This is also called
2177         whenever we suspend the page to put it into the page cache.
2178         (WebCore::HTMLInputElement::setShowAutoFillButton): Modified to update the editability of the inner text element
2179         and invalidate styles for the subtree as the editability may have changed depending on the auto fill button type.
2180
2181         (WebCore::autoFillStrongPasswordMaskImage):
2182         (WebCore::HTMLInputElement::createInnerTextStyle):
2183         (WebCore::HTMLInputElement::createInnerTextStyle const): Deleted.
2184         Adjust the look of the inner text field. This function is not const because we may need to resolve style to
2185         generate a mask image.
2186
2187         * html/HTMLInputElement.h:
2188         (WebCore::HTMLInputElement::autoFillButtonType const): Fix style nit; use a C++ style cast while I am in
2189         this area.
2190         (WebCore::HTMLInputElement::hasAutoFillStrongPasswordButton const): Added.
2191
2192         * html/HTMLTextAreaElement.cpp:
2193         (WebCore::HTMLTextAreaElement::createInnerTextStyle):
2194         (WebCore::HTMLTextAreaElement::createInnerTextStyle const): Deleted.
2195         Made this non-const because HTMLInputElement::createInnerTextStyle() needs to be non-const. See above.
2196
2197         * html/HTMLTextAreaElement.h:
2198         * html/HTMLTextFormControlElement.cpp:
2199         (WebCore::HTMLTextFormControlElement::isInnerTextElementEditable const):
2200         (WebCore::HTMLTextFormControlElement::updateInnerTextElementEditability):
2201         Extract out the query to determine if the inner text element is editable into a virtual function isInnerTextElementEditable()
2202         and have updateInnerTextElementEditability() make use of it. By default a field is considered editable if it is not disabled
2203         or read-only. We override updateInnerTextElementEditability() in HTMLInputElement to also consider the auto fill button type.
2204
2205         * html/HTMLTextFormControlElement.h:
2206         * html/TextFieldInputType.cpp:
2207         (WebCore::autoFillButtonTypeToAccessibilityLabel):
2208         (WebCore::autoFillButtonTypeToAutoFillButtonText):
2209         (WebCore::autoFillButtonTypeToAutoFillButtonPseudoClassName):
2210         (WebCore::isAutoFillButtonTypeChanged):
2211         (WebCore::TextFieldInputType::createAutoFillButton):
2212         (WebCore::TextFieldInputType::updateAutoFillButton):
2213         Support having text for the auto fill button.
2214
2215         * platform/LocalizedStrings.cpp:
2216         (WebCore::AXAutoFillStrongPasswordLabel):
2217         (WebCore::AXAutoFillStrongConfirmationPasswordLabel):
2218         (WebCore::autoFillStrongPasswordLabel):
2219         * platform/LocalizedStrings.h:
2220         Add localized strings.
2221
2222         * rendering/RenderTextControlSingleLine.h: Disallow scrolling depending on the auto fill button type.
2223
2224         * testing/Internals.cpp:
2225         (WebCore::toAutoFillButtonType):
2226         * testing/Internals.h:
2227         * testing/Internals.idl:
2228         Add support for testing.
2229
2230 2017-12-13  Ryosuke Niwa  <rniwa@webkit.org>
2231
2232         Crash inside ImageLoader::updateFromElement()
2233         https://bugs.webkit.org/show_bug.cgi?id=180769
2234         <rdar://problem/35278782>
2235
2236         Reviewed by Antti Koivisto.
2237
2238         Fixed the crash by moving all call sites of ImageLoader::updateFromElement() to be post insertion callbacks
2239         where it's safe to execute arbitrary scripts.
2240
2241         No new test since existing tests cover this with a newly added release assert in ImageLoader.
2242
2243         * html/HTMLImageElement.cpp:
2244         (WebCore::HTMLImageElement::insertedIntoAncestor):
2245         (WebCore::HTMLImageElement::didFinishInsertingNode): Extracted from insertedIntoAncestor to call
2246         selectImageSource or updateFromElement.
2247         * html/HTMLImageElement.h: Made many member functions final.
2248         * html/HTMLInputElement.cpp:
2249         (WebCore::HTMLInputElement::didAttachRenderers): Delay the call to ImageLoader::updateFromElement() in
2250         ImageInputType using a post style resolution callback.
2251         * html/HTMLMetaElement.h:
2252         * html/HTMLPictureElement.cpp:
2253         (WebCore::HTMLPictureElement::sourcesChanged): Store the list of child image elements into a vector before
2254         calling selectImageSource since each call may execute arbitrary scripts.
2255         * html/HTMLSourceElement.cpp:
2256         (WebCore::HTMLSourceElement::insertedIntoAncestor): Delay the call to ImageLoader::updateFromElement()
2257         using a post style resolution callback.
2258         (WebCore::HTMLSourceElement::didFinishInsertingNode): Extracted from insertedIntoAncestor.
2259         * html/HTMLSourceElement.h:
2260         * html/HTMLVideoElement.cpp:
2261         (WebCore::HTMLVideoElement::didAttachRenderers):
2262         (WebCore::HTMLVideoElement::updateAfterStyleResolution): Extracted from didAttachRenderers.
2263         * html/HTMLVideoElement.h:
2264         * html/ImageInputType.cpp:
2265         (WebCore::ImageInputType::needsPostStyleResolutionCallback): Added. Returns true so that HTMLInputElement's
2266         didAttachRenderers would register a post style resolution callback.
2267         (WebCore::ImageInputType::updateAfterStyleResolution): Extracted from attach.
2268         (WebCore::ImageInputType::attach): Deleted.
2269         * html/ImageInputType.h:
2270         * html/InputType.cpp:
2271         (WebCore::InputType::needsPostStyleResolutionCallback): Added. All but ImageInputType returns false.
2272         (WebCore::InputType::updateAfterStyleResolution): Added.
2273         (WebCore::InputType::attach): Deleted.
2274         * html/InputType.h:
2275         * loader/ImageLoader.cpp:
2276         (WebCore::ImageLoader::updateFromElement): Added a release assertion. There is no direct security implication
2277         so there is no need to use RELEASE_ASSERT_WITH_SECURITY_IMPLICATION here.
2278         * svg/SVGImageElement.cpp:
2279         (WebCore::SVGImageElement::insertedIntoAncestor):
2280         (WebCore::SVGImageElement::didFinishInsertingNode):
2281         * svg/SVGImageElement.h:
2282
2283 2017-12-13  Zalan Bujtas  <zalan@apple.com>
2284
2285         RenderImage can be destroyed even before setting the style on it.
2286         https://bugs.webkit.org/show_bug.cgi?id=180767
2287         <rdar://problem/33965995>
2288
2289         Reviewed by Simon Fraser.
2290
2291         In certain cases, when the newly constructed renderer can't be inserted into the tree (parent can only have specific type of children etc),
2292         RenderTreeUpdater destroys it right away. While destroying a RenderImage, the associated image resource assumes
2293         that the image renderer has been initialized through RenderElement::initializeStyle(). This is an incorrect
2294         assumption.
2295         This patch also makes RenderImageResource's m_renderer a weak pointer.
2296            
2297         Test: fast/images/crash-when-image-renderer-is-destroyed-before-calling-initializeStyle.html
2298
2299         * rendering/RenderImageResource.cpp:
2300         (WebCore::RenderImageResource::initialize):
2301         (WebCore::RenderImageResource::setCachedImage):
2302         (WebCore::RenderImageResource::resetAnimation):
2303         (WebCore::RenderImageResource::image const):
2304         (WebCore::RenderImageResource::setContainerContext):
2305         (WebCore::RenderImageResource::imageSize const):
2306         * rendering/RenderImageResource.h:
2307         (WebCore::RenderImageResource::renderer const):
2308         * rendering/RenderImageResourceStyleImage.cpp:
2309         (WebCore::RenderImageResourceStyleImage::shutdown):
2310
2311 2017-12-13  Ryosuke Niwa  <rniwa@webkit.org>
2312
2313         Update the SVG use element's shadow trees explicitly before the style recall
2314         https://bugs.webkit.org/show_bug.cgi?id=180729
2315         <rdar://problem/36009806>
2316
2317         Reviewed by Antti Koivisto.
2318
2319         Update the SVG use element's shadow trees before start resolving styles. Document now has a hash set of all
2320         connected SVG use elements with invalidated shadow trees. SVGUseElement adds itself to this set when its
2321         shadow tree gets invalidated, or it gets newly connected to a document with the invalidated shadow tree.
2322         SVGUseElement removes itself from this set when it updates its shadow tree or it gets disconnected from
2323         a document with the invalidated shadow tree.
2324
2325         No new tests. Covered by existing tests.
2326
2327         * dom/Document.cpp:
2328         (WebCore::Document::~Document): Assert that m_svgUseElements has been cleared.
2329         (WebCore::Document::resolveStyle): Update the shadow trees of SVG use elements with invalidated shadow trees.
2330         (WebCore::Document::addSVGUseElement): Added.
2331         (WebCore::Document::removeSVGUseElement): Added.
2332         * dom/Document.h:
2333         (WebCore::Document::svgUseElements const): Added.
2334         * dom/Element.cpp:
2335         (WebCore::Element::cloneElementWithChildren): Removed EventAllowedScope since the SVG use element's shadow
2336         tree is no longer updated when there is a NoEventDispatchAssertion in the stack.
2337         (WebCore::Element::cloneElementWithoutChildren): Ditto.
2338         * style/StyleTreeResolver.cpp:
2339         (WebCore::Style::TreeResolver::resolveComposedTree): No longer drops the assertion now that SVG use element's
2340         shadow tree is updated before calling this function.
2341         * svg/SVGUseElement.cpp:
2342         (WebCore::SVGUseElement::insertedIntoAncestor): Add the element to the document's hash set if this use element's
2343         shadow tree needs to be updated (m_shadowTreeNeedsUpdate is set), and it got newly connected.
2344         (WebCore::SVGUseElement::removedFromAncestor): Ditto for removal. We have to check m_shadowTreeNeedsUpdate before
2345         calling SVGGraphicsElement::removedFromAncestor or updateExternalDocument since either function can invoke
2346         m_shadowTreeNeedsUpdate to true.
2347         (WebCore::SVGUseElement::willRecalcStyle): Deleted. We no longer call updateShadowTree during style recalc.
2348         (WebCore::SVGUseElement::updateShadowTree): Remove this element from the document's hah set. We can't clear all
2349         the entries in the map at once in Document::resolveStyle because updating the shadow trees of a SVG use element
2350         can result in a sync IPC in ImageLoader::updateFromElement, which end up executing arbitrary author scripts.
2351         (WebCore::SVGUseElement::cloneTarget const): Removed EventAllowedScope since the SVG use element's shadow tree
2352         is no longer updated when there is a NoEventDispatchAssertion in the stack.
2353         (WebCore::SVGUseElement::expandUseElementsInShadowTree const): Ditto.
2354         (WebCore::SVGUseElement::expandSymbolElementsInShadowTree const): Ditto.
2355         (WebCore::SVGUseElement::invalidateShadowTree): Add the element to the document's hash set if it's connected.
2356         * svg/SVGUseElement.h:
2357
2358 2017-12-13  Per Arne Vollan  <pvollan@apple.com>
2359
2360         REGRESSION(225597): Can't select a text box or web view on a page when VO is on.
2361         https://bugs.webkit.org/show_bug.cgi?id=180756
2362         <rdar://problem/35996158>
2363
2364         Reviewed by Brent Fulgham.
2365
2366         No new tests.
2367
2368         * platform/mac/EventLoopMac.mm:
2369         (WebCore::EventLoop::cycle):
2370
2371 2017-12-13  Antoine Quint  <graouts@apple.com>
2372
2373         [Web Animations] Implement the "updating the finished state" procedure
2374         https://bugs.webkit.org/show_bug.cgi?id=180743
2375         <rdar://problem/36017232>
2376
2377         Reviewed by Simon Fraser.
2378
2379         The Web Animations spec defines a procedure for "updating the finished state", which should run as the timeline time
2380         changes and is responsible for ultimately triggering finish events and fulfil the "finished" promise. The procedure
2381         allows for two flags to control its behavior: didSeek and synchronouslyNotify. When synchronouslyNotify is true, the
2382         "finish notification steps" procedure is ran right away, otherwise it's queued as a microtask.
2383
2384         In this patch we introduce the notion of "hold time", which is the time held while an animation is paused. It will be
2385         set by the pause() and play() method in future patches.
2386
2387         * animation/DocumentTimeline.cpp:
2388         (WebCore::DocumentTimeline::updateAnimations): Update the finished state as the timeline time changes with both flags
2389         set to false.
2390         * animation/WebAnimation.cpp:
2391         (WebCore::WebAnimation::currentTime const): Add a private currentTime(bool) variant which allows for the hold time to
2392         be ignored in case updateFinishedState() was called with the didSeek flag set to false.
2393         (WebCore::WebAnimation::updateFinishedState): Implement the procedure as specified with all spec-mandated steps inline.
2394         (WebCore::WebAnimation::scheduleMicrotaskIfNeeded): Schedule a microtask to complete the "finish notification steps"
2395         if we haven't scheduled a microtask before.
2396         (WebCore::WebAnimation::performMicrotask): Perform the microtask if the "finish notification steps" procedure hasn't
2397         been canceled after it was originally scheduled, as tracked by the m_finishNotificationStepsMicrotaskPending flag, since
2398         microtasks are not presently cancelable.
2399         (WebCore::WebAnimation::finishNotificationSteps): Implement the procedure as specified with all spec-mandated steps inline,
2400         dispatching a "finish" events and fulfilling the "finished" promise.
2401         * animation/WebAnimation.h:
2402         * animation/WebAnimation.idl:
2403         * dom/EventNames.h:
2404
2405 2017-12-13  Simon Fraser  <simon.fraser@apple.com>
2406
2407         Fix crash under Document::visualUpdatesSuppressionTimerFired()
2408         https://bugs.webkit.org/show_bug.cgi?id=180758
2409         Document::visualUpdatesSuppressionTimerFired
2410
2411         Reviewed by Zalan Bujtas.
2412
2413         Speculative fix for crash under visualUpdatesSuppressionTimerFired() where view()
2414         can be null. Add null checks for the view() in all code called from this function.
2415
2416         * dom/Document.cpp:
2417         (WebCore::Document::setVisualUpdatesAllowed):
2418         (WebCore::Document::visualUpdatesSuppressionTimerFired):
2419
2420 2017-12-13  Zalan Bujtas  <zalan@apple.com>
2421
2422         ASSERT(LayoutDisallowedScope::isLayoutAllowed()) whenever hitting Enter in Web Inspector console
2423         https://bugs.webkit.org/show_bug.cgi?id=180690
2424
2425         Reviewed by Simon Fraser.
2426
2427         Defer text replacement notification until after layout is done to avoid unexpected forced layouts.
2428
2429         Covered by existing tests.
2430
2431         * accessibility/AXObjectCache.cpp:
2432         (WebCore::AXObjectCache::disableAccessibility):
2433         (WebCore::AXObjectCache::remove):
2434         (WebCore::filterMapForRemoval):
2435         (WebCore::filterListForRemoval):
2436         (WebCore::AXObjectCache::prepareForDocumentDestruction):
2437         (WebCore::AXObjectCache::performDeferredCacheUpdate):
2438         (WebCore::AXObjectCache::deferTextReplacementNotificationForTextControl):
2439         (WebCore::filterForRemoval): Deleted.
2440         * accessibility/AXObjectCache.h: Need to use the base (Element) class since
2441         we can't call is<HTMLTextFormControlElement> in Node d'tor.
2442         (WebCore::AXObjectCache::deferTextReplacementNotificationForTextControl):
2443         * html/HTMLTextFormControlElement.cpp:
2444         (WebCore::HTMLTextFormControlElement::setInnerTextValue):
2445
2446 2017-12-13  Ryan Haddad  <ryanhaddad@apple.com>
2447
2448         Unreviewed, rolling out r225836.
2449
2450         Broke the Windows build.
2451
2452         Reverted changeset:
2453
2454         "Unify some WebGL sources"
2455         https://bugs.webkit.org/show_bug.cgi?id=180726
2456         https://trac.webkit.org/changeset/225836
2457
2458 2017-12-13  Andy Estes  <aestes@apple.com>
2459
2460         [Payment Request] Remove ApplePayPaymentMethodUpdateEvent and use PaymentDetailsModifiers instead
2461         https://bugs.webkit.org/show_bug.cgi?id=180737
2462         <rdar://problem/36013152>
2463
2464         Reviewed by Brady Eidson.
2465
2466         Instead of firing a non-standard "applepaypaymentmethodupdate" event when the payment method
2467         changes, use the PaymentDetailsModifier mechanism to allow the merchant to specify override
2468         totals and additional display items per payment method type.
2469
2470         Test: http/tests/ssl/applepay/ApplePayPaymentDetailsModifier.https.html
2471
2472         * DerivedSources.make:
2473         * Modules/applepay/ApplePayLineItem.idl:
2474         * Modules/applepay/ApplePayPaymentMethod.h:
2475         * Modules/applepay/ApplePayPaymentMethod.idl:
2476         * Modules/applepay/ApplePayPaymentMethodType.h: Added.
2477         * Modules/applepay/ApplePayPaymentMethodType.idl: Added.
2478         * Modules/applepay/cocoa/PaymentMethodCocoa.mm:
2479         * Modules/applepay/paymentrequest/ApplePayModifier.h: Added.
2480         * Modules/applepay/paymentrequest/ApplePayModifier.idl: Added.
2481         * Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp:
2482         (WebCore::ApplePayPaymentHandler::show):
2483         (WebCore::ApplePayPaymentHandler::computeTotalAndLineItems):
2484         (WebCore::ApplePayPaymentHandler::detailsUpdated):
2485         (WebCore::ApplePayPaymentHandler::shippingAddressUpdated):
2486         (WebCore::ApplePayPaymentHandler::shippingOptionUpdated):
2487         (WebCore::ApplePayPaymentHandler::paymentMethodUpdated):
2488         (WebCore::ApplePayPaymentHandler::didSelectPaymentMethod):
2489         * Modules/applepay/paymentrequest/ApplePayPaymentHandler.h:
2490         * Modules/applepay/paymentrequest/ApplePayPaymentMethodUpdateEvent.cpp: Removed.
2491         * Modules/applepay/paymentrequest/ApplePayPaymentMethodUpdateEvent.h: Removed.
2492         * Modules/paymentrequest/PaymentRequest.h:
2493         * Modules/paymentrequest/PaymentRequest.idl:
2494         * WebCore.xcodeproj/project.pbxproj:
2495         * dom/EventNames.h:
2496         * dom/EventNames.in:
2497         * testing/MockPaymentCoordinator.cpp:
2498         (WebCore::convert):
2499         (WebCore::MockPaymentCoordinator::updateTotalAndLineItems):
2500         (WebCore::MockPaymentCoordinator::completeShippingMethodSelection):
2501         (WebCore::MockPaymentCoordinator::completeShippingContactSelection):
2502         (WebCore::MockPaymentCoordinator::completePaymentMethodSelection):
2503         * testing/MockPaymentCoordinator.h:
2504         * testing/MockPaymentCoordinator.idl:
2505
2506 2017-12-12  Zalan Bujtas  <zalan@apple.com>
2507
2508         is<HTMLTextFormControlElement> reports the input type.
2509         https://bugs.webkit.org/show_bug.cgi?id=180721
2510         <rdar://problem/36005123>
2511
2512         Reviewed by Ryosuke Niwa.
2513
2514         This patch ensures that is<HTMLTextFormControlElement> consistently returns true even
2515         when the input type changes from text to non-text (checkbox etc).
2516
2517         * accessibility/AccessibilityObject.cpp:
2518         (WebCore::AccessibilityObject::selectText):
2519         * dom/Element.h:
2520         (WebCore::Element::isTextFormControlElement const):
2521         (WebCore::Element::isTextField const):
2522         (WebCore::Element::isTextFormControl const): Deleted.
2523         * editing/Editor.cpp:
2524         (WebCore::Editor::selectionForCommand):
2525         (WebCore::Editor::setBaseWritingDirection):
2526         (WebCore::findFirstMarkable):
2527         * editing/FrameSelection.cpp:
2528         (WebCore::FrameSelection::selectAll):
2529         * html/FormController.cpp:
2530         (WebCore::FormController::formElementsCharacterCount const):
2531         * html/HTMLElement.cpp:
2532         (WebCore::HTMLElement::directionality const):
2533         * html/HTMLInputElement.h:
2534         * html/HTMLTextAreaElement.h:
2535         * html/HTMLTextFormControlElement.cpp:
2536         (WebCore::HTMLTextFormControlElement::didEditInnerTextValue):
2537         (WebCore::HTMLTextFormControlElement::selectedText const):
2538         (WebCore::HTMLTextFormControlElement::setSelectionRange):
2539         (WebCore::HTMLTextFormControlElement::selectionStart const):
2540         (WebCore::HTMLTextFormControlElement::computeSelectionStart const):
2541         (WebCore::HTMLTextFormControlElement::selectionEnd const):
2542         (WebCore::HTMLTextFormControlElement::computeSelectionEnd const):
2543         (WebCore::HTMLTextFormControlElement::selectionDirection const):
2544         (WebCore::HTMLTextFormControlElement::computeSelectionDirection const):
2545         (WebCore::HTMLTextFormControlElement::selection const):
2546         (WebCore::HTMLTextFormControlElement::selectionChanged):
2547         (WebCore::HTMLTextFormControlElement::lastChangeWasUserEdit const):
2548         (WebCore::HTMLTextFormControlElement::setInnerTextValue):
2549         (WebCore::HTMLTextFormControlElement::valueWithHardLineBreaks const):
2550         (WebCore::enclosingTextFormControl):
2551         * html/HTMLTextFormControlElement.h:
2552         (isType):
2553         * rendering/HitTestResult.cpp:
2554         (WebCore::HitTestResult::isOverTextInsideFormControlElement const):
2555
2556 2017-12-12  Dean Jackson  <dino@apple.com>
2557
2558         Unify some WebGL sources
2559         https://bugs.webkit.org/show_bug.cgi?id=180726
2560
2561         Rubber-stamped by Keith, weeks ago.
2562
2563         * Sources.txt:
2564         * WebCore.xcodeproj/project.pbxproj:
2565         * html/canvas/WebGLRenderingContextBase.cpp:
2566
2567 2017-12-12  Michael Catanzaro  <mcatanzaro@igalia.com>
2568
2569         Unreviewed, fix !ENABLE(MEDIA_STREAM) build after r225822
2570         https://bugs.webkit.org/show_bug.cgi?id=180666
2571         <rdar://problem/36008948>
2572
2573         * html/HTMLMediaElement.cpp:
2574
2575 2017-12-12  Alex Christensen  <achristensen@webkit.org>
2576
2577         Fix possible out-of-bounds read in protocolIsInHTTPFamily
2578         https://bugs.webkit.org/show_bug.cgi?id=180688
2579
2580         Reviewed by Daniel Bates.
2581
2582         It wouldn't read very far out of bounds, and it would just change a bool return value,
2583         but it's still out of bounds.  Covered by an API test that ASAN wouldn't like.
2584
2585         * platform/URL.cpp:
2586         (WebCore::protocolIsInHTTPFamily):
2587         Check bounds before reading a string.
2588
2589 2017-12-12  Youenn Fablet  <youenn@apple.com>
2590
2591         getUserMedia is resolving before the document knows it is capturing
2592         https://bugs.webkit.org/show_bug.cgi?id=180699
2593
2594         Reviewed by Eric Carlson.
2595
2596         Covered by updated test.
2597
2598         Ensure the document state is capturing when getUserMedia promise is resolved by doing the following:
2599         - Promise is resolved when MediaStream is producing data.
2600         - MediaStream asks Document to update its state when MediaStream state is updated.
2601
2602         Introduce PendingActivationMediaStream for waiting for the MediaStream to produce data.
2603
2604         * Modules/mediastream/MediaStream.cpp:
2605         (WebCore::MediaStream::statusDidChange):
2606         * Modules/mediastream/UserMediaRequest.cpp:
2607         (WebCore::UserMediaRequest::allow):
2608         (WebCore::UserMediaRequest::contextDestroyed):
2609         (WebCore::UserMediaRequest::PendingActivationMediaStream::PendingActivationMediaStream):
2610         (WebCore::UserMediaRequest::PendingActivationMediaStream::~PendingActivationMediaStream):
2611         (WebCore::UserMediaRequest::PendingActivationMediaStream::characteristicsChanged):
2612         (WebCore::UserMediaRequest::mediaStreamIsReady):
2613         * Modules/mediastream/UserMediaRequest.h:
2614         (WebCore::UserMediaRequest::PendingActivationMediaStream::create):
2615         * platform/mediastream/RealtimeMediaSourceCenter.h:
2616         * WebCore/WebCore.xcodeproj/project.pbxproj:
2617
2618 2017-12-12  John Wilander  <wilander@apple.com>
2619
2620         Storage Access API: Implement frame-specific access in the network storage session layer
2621         https://bugs.webkit.org/show_bug.cgi?id=180679
2622         <rdar://problem/35982116>
2623
2624         Reviewed by Alex Christensen.
2625
2626         Tests: http/tests/storageAccess/request-and-grant-storage-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-non-recent-user-interaction-and-try-access-from-right-frame.html
2627                http/tests/storageAccess/request-and-grant-storage-access-cross-origin-sandboxed-iframe-from-prevalent-domain-with-non-recent-user-interaction-but-try-access-from-wrong-frame.html
2628
2629         This changes adds frameID and pageID to what is communicated for
2630         storage access and also stored in the network process' table of
2631         partitioning exceptions.
2632
2633         * dom/Document.cpp:
2634         (WebCore::Document::hasStorageAccess):
2635             Now makes use of the new m_hasFrameSpecificStorageAccess to check
2636             if access has already been granted to this document's domain and
2637             frame.
2638         (WebCore::Document::requestStorageAccess):
2639             Now submits frameID and pageID in the request call and sets
2640             m_hasFrameSpecificStorageAccess upon granted access callback.
2641         * dom/Document.h:
2642         * page/ChromeClient.h:
2643         * platform/network/NetworkStorageSession.h:
2644         * platform/network/cf/NetworkStorageSessionCFNet.cpp:
2645         (WebCore::NetworkStorageSession::cookieStoragePartition const):
2646         (WebCore::NetworkStorageSession::setPrevalentDomainsToPartitionOrBlockCookies):
2647         (WebCore::NetworkStorageSession::isStorageAccessGranted const):
2648         (WebCore::NetworkStorageSession::setStorageAccessGranted):
2649             Now makes use of frameID and pageID for partitioning exceptions.
2650         * platform/network/mac/CookieJarMac.mm:
2651         (WebCore::cookiesInPartitionForURL):
2652         (WebCore::setCookiesFromDOM):
2653             Submits std::nullopt for frameID and pageID.
2654             Follow-up work tracked in https://bugs.webkit.org/show_bug.cgi?id=180682. 
2655         * platform/network/mac/ResourceHandleMac.mm:
2656         (WebCore::ResourceHandle::applySniffingPoliciesAndStoragePartitionIfNeeded):
2657             Submits std::nullopt for frameID and pageID.
2658             Follow-up work tracked in https://bugs.webkit.org/show_bug.cgi?id=180682. 
2659
2660 2017-12-12  Youenn Fablet  <youenn@apple.com>
2661
2662         Playing webrtc video tracks should prevent from display to got to sleep
2663         https://bugs.webkit.org/show_bug.cgi?id=180666
2664
2665         Reviewed by Darin Adler.
2666
2667         Done through manual testing by checking screen assertions taken on webrtc sites.
2668
2669         * html/HTMLMediaElement.cpp:
2670         (WebCore::HTMLMediaElement::shouldDisableSleep const):
2671
2672 2017-12-12  Dean Jackson  <dino@apple.com>
2673
2674         Add CanvasRenderingContext2DBase class and OffscreenCanvasRenderingContext2D
2675         https://bugs.webkit.org/show_bug.cgi?id=180718
2676         <rdar://problem/36004015>
2677
2678         Reviewed by Sam Weinig.
2679
2680         Add an OffscreenCanvasRenderingContext2D class, and in the process create a shared
2681         base class for it and CanvasRenderingContext2D, called CanvasRenderingContext2DBase.
2682         The base class has nearly all the functionality, with the exception of the text
2683         and focus rendering APIs, which are only exposed on CanvasRenderingContext2D.
2684
2685         At the moment CanvasRenderingContext2DBase's implementation still expects the attached
2686         canvas to be an HTMLCanvasElement, but that's ok since you can't yet create an
2687         OffscreenCanvasRenderingContext2D. A subsequent patch will do the right thing.
2688
2689         No change in functionality at the moment, so covered by the existing tests.
2690
2691         * DerivedSources.make: Add the new IDL file.
2692
2693         * Sources.txt: Add all the new files to compile.
2694         * WebCore.xcodeproj/project.pbxproj:
2695
2696         * bindings/js/JSCanvasRenderingContext2DCustom.cpp: Removed some unnecessary headers, and
2697         added JSC:: where appropriate.
2698         (WebCore::JSCanvasRenderingContext2DOwner::isReachableFromOpaqueRoots):
2699         (WebCore::JSCanvasRenderingContext2D::visitAdditionalChildren):
2700
2701         * bindings/js/JSOffscreenCanvasRenderingContext2DCustom.cpp: Copied from Source/WebCore/bindings/js/JSCanvasRenderingContext2DCustom.cpp.
2702         (WebCore::root): New root function that just returns the address of the OffscreenCanvas.
2703         (WebCore::JSOffscreenCanvasRenderingContext2DOwner::isReachableFromOpaqueRoots):
2704         (WebCore::JSOffscreenCanvasRenderingContext2D::visitAdditionalChildren):
2705
2706         * bindings/js/JSWorkerNavigatorCustom.cpp: Add JSC:: to fix a compilation error.
2707         (WebCore::JSWorkerNavigator::visitAdditionalChildren):
2708
2709         * bindings/js/WebCoreBuiltinNames.h: New IDL types.
2710
2711         * html/OffscreenCanvas.idl: Explicitly generates an IsReachable.
2712
2713         * html/canvas/CanvasRenderingContext.h:
2714         (WebCore::CanvasRenderingContext::isOffscreen2d const): Helper for is<> trait.
2715
2716         * html/canvas/CanvasRenderingContext2D.cpp: Nearly everything has been moved to the Base class.
2717         * html/canvas/CanvasRenderingContext2D.h:
2718         * html/canvas/CanvasRenderingContext2DBase.cpp: Copied from Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp.
2719         * html/canvas/CanvasRenderingContext2DBase.h: Copied from Source/WebCore/html/canvas/CanvasRenderingContext2D.h.
2720
2721         * html/canvas/OffscreenCanvasRenderingContext2D.cpp: Added. Basic implementation that
2722         just uses the Base class.
2723         (WebCore::OffscreenCanvasRenderingContext2D::OffscreenCanvasRenderingContext2D):
2724         * html/canvas/OffscreenCanvasRenderingContext2D.h: Added.
2725         * html/canvas/OffscreenCanvasRenderingContext2D.idl: Added.
2726
2727 2017-12-12  Jer Noble  <jer.noble@apple.com>
2728
2729         [EME] Support FPS-over-HLS in the Modern EME API
2730         https://bugs.webkit.org/show_bug.cgi?id=180707
2731
2732         Reviewed by Eric Carlson.
2733
2734         Add support for the "skd" initDataType, where the initData is the URI provided in the 
2735         EXT-X-KEY tag in a HLS manifest:
2736
2737         * platform/graphics/avfoundation/CDMFairPlayStreaming.cpp:
2738         (WebCore::CDMPrivateFairPlayStreaming::sinfName):
2739         (WebCore::CDMPrivateFairPlayStreaming::skdName):
2740         (WebCore::extractSinfData):
2741         (WebCore::CDMPrivateFairPlayStreaming::sanitizeSkd):
2742         (WebCore::CDMPrivateFairPlayStreaming::extractKeyIDsSkd):
2743         (WebCore::validInitDataTypes):
2744         (WebCore::CDMFactory::platformRegisterFactories):
2745         (WebCore::CDMPrivateFairPlayStreaming::supportsInitDataType const):
2746         (WebCore::CDMPrivateFairPlayStreaming::supportsConfiguration const):
2747         (WebCore::CDMPrivateFairPlayStreaming::supportsInitData const):
2748         (WebCore::sinfName): Deleted.
2749
2750         Add support for creating a AVContentKeyRequest from a skd key URI rather than from
2751         initialization data, and for extracting keyIDs from the AVContentKeyRequest identifier.
2752
2753         * platform/graphics/avfoundation/CDMFairPlayStreaming.h:
2754         * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.h:
2755         * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm:
2756         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::keyIDs):
2757         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::requestLicense):
2758         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::updateLicense):
2759         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::didProvideRequest):
2760
2761         Add support for AVContentKeySession to MediaPlayerPrivateAVFoundationObjC, and for emitting
2762         initializationData messages when encountering a loading request for a "skd" URI.
2763
2764         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
2765         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
2766         (WebCore::MediaPlayerPrivateAVFoundationObjC::shouldWaitForLoadingOfResource):
2767         (WebCore::MediaPlayerPrivateAVFoundationObjC::cdmInstanceAttached):
2768         (WebCore::MediaPlayerPrivateAVFoundationObjC::cdmInstanceDetached):
2769         (WebCore::MediaPlayerPrivateAVFoundationObjC::attemptToDecryptWithInstance):
2770
2771 2017-12-12  Antoine Quint  <graouts@apple.com>
2772
2773         [Web Animations] Expose promises on Animation interface
2774         https://bugs.webkit.org/show_bug.cgi?id=180710
2775         <rdar://problem/36000604>
2776
2777         Reviewed by Dean Jackson.
2778
2779         Expose the "ready" and "finished" promises on Animation. A future patch will fulfil or reject them.
2780
2781         * animation/WebAnimation.cpp:
2782         (WebCore::WebAnimation::WebAnimation):
2783         (WebCore::WebAnimation::readyPromiseResolve):
2784         (WebCore::WebAnimation::finishedPromiseResolve):
2785         * animation/WebAnimation.h:
2786         * animation/WebAnimation.idl:
2787
2788 2017-12-12  Youenn Fablet  <youenn@apple.com>
2789
2790         Fetch Event header filtering should apply in CORS mode only
2791         https://bugs.webkit.org/show_bug.cgi?id=180708
2792
2793         Reviewed by Alex Christensen.
2794
2795         Covered by no-longer failing test.
2796
2797         * workers/service/context/ServiceWorkerFetch.cpp: cleaning headers only in case of CORS mode.
2798
2799 2017-12-12  Myles C. Maxfield  <mmaxfield@apple.com>
2800
2801         REGRESSION (Safari 11): custom <font-face> tag crashes a page
2802         https://bugs.webkit.org/show_bug.cgi?id=177848
2803
2804         Reviewed by Darin Adler.
2805
2806         We currently use the CSS property parsers to parse SVG's <font-face> element attributes. Instead,
2807         we should be using the CSS descriptor parsers to parse these attributes. However, this is a
2808         fairly involved task, so until I can finish that, this patch fixes the crash. The crash is simple;
2809         the descriptors shouldn't accept the universal keywords ("initial", "inherit", etc.) and our
2810         font-face machinery assumes this. So the fix is just detect these keywords and explicitly disallow
2811         them.
2812
2813         Test: svg/text/font-style-keyword.html
2814
2815         * svg/SVGFontFaceElement.cpp:
2816         (WebCore::SVGFontFaceElement::parseAttribute):
2817
2818 2017-12-12  Antoine Quint  <graouts@apple.com>
2819
2820         [Web Animations] Implement the playState property on Animation
2821         https://bugs.webkit.org/show_bug.cgi?id=180711
2822         <rdar://problem/36000982>
2823
2824         Reviewed by Dean Jackson.
2825
2826         Expose the playState and pending properties. The playState property has a complete implementation but
2827         has some test failures due to Animation lacking correct behavior while running animations which will
2828         be fixed in a followup patch. The pending property is a placeholder until we implement pending play
2829         and pause tasks in followup patches.
2830
2831         * animation/WebAnimation.cpp:
2832         (WebCore::WebAnimation::playState const):
2833         (WebCore::WebAnimation::effectEndTime const):
2834         * animation/WebAnimation.h:
2835         * animation/WebAnimation.idl:
2836
2837 2017-12-12  Javier Fernandez  <jfernandez@igalia.com>
2838
2839         [css-grid] Implement alignment for absolute positioned grid items
2840         https://bugs.webkit.org/show_bug.cgi?id=180632
2841
2842         Reviewed by Manuel Rego Casasnovas.
2843
2844         We are changing how we compute the grid area's size of positioned
2845         items, trying to make the logic as independent as possible of the
2846         grid container's direction.
2847
2848         The new way of placing absolute positioned elements in their grid area
2849         is based on the previously computed area's size. This provide a
2850         mechanism to place an item in its area respecting the offsets derived
2851         from the Content Alignment CSS properties and, which is more important,
2852         ignoring the grid container's direction.
2853
2854         Additionally, we use the already implemented alignment logic that's
2855         used for regular grid items. This patch provides almost full alignment
2856         capabilities for positioned objects, with the exception of 'stretch'.
2857
2858         It's worth mentioning that some of the test cases using vertical-rl
2859         writing mode will fail because of the bug 180633.
2860
2861         Updated web-platform-tests results of the test cases that pass now.
2862
2863         * rendering/GridLayoutFunctions.cpp:
2864        (WebCore::GridLayoutFunctions::hasOverrideContainingBlockContentSizeForChild):
2865         (WebCore::GridLayoutFunctions::overrideContainingBlockContentSizeForChild):
2866         * rendering/GridLayoutFunctions.h:
2867         * rendering/GridTrackSizingAlgorithm.cpp:
2868         (WebCore::GridTrackSizingAlgorithmStrategy::updateOverrideContainingBlockContentSizeForChild const):
2869         * rendering/RenderGrid.cpp:
2870         (WebCore::RenderGrid::layoutBlock):
2871         (WebCore::RenderGrid::gridItemOffset const):
2872         (WebCore::RenderGrid::hasStaticPositionForChild const):
2873         (WebCore::RenderGrid::layoutPositionedObject):
2874         (WebCore::RenderGrid::applyStretchAlignmentToChildIfNeeded):
2875         (WebCore::RenderGrid::columnAxisPositionForChild const):
2876         (WebCore::RenderGrid::rowAxisPositionForChild const):
2877         (WebCore::RenderGrid::columnAxisOffsetForChild const):
2878         (WebCore::RenderGrid::rowAxisOffsetForChild const):
2879         (WebCore::RenderGrid::gridPositionIsAutoForOutOfFlow const):
2880         (WebCore::RenderGrid::resolveAutoStartGridPosition const):
2881         (WebCore::RenderGrid::resolveAutoEndGridPosition const):
2882         (WebCore::RenderGrid::gridAreaBreadthForOutOfFlowChild):
2883         (WebCore::RenderGrid::logicalOffsetForChild const):
2884         (WebCore::RenderGrid::gridAreaPositionForOutOfFlowChild const):
2885         (WebCore::RenderGrid::gridAreaPositionForInFlowChild const):
2886         (WebCore::RenderGrid::gridAreaPositionForChild const):
2887         (WebCore::RenderGrid::translateOutOfFlowRTLCoordinate const):
2888         (WebCore::RenderGrid::findChildLogicalPosition const):
2889         * rendering/RenderGrid.h:
2890         * rendering/style/GridPositionsResolver.cpp:
2891         (WebCore::adjustGridPositionsFromStyle):
2892         (WebCore::GridPositionsResolver::initialPositionSide):
2893         (WebCore::GridPositionsResolver::finalPositionSide):
2894         * rendering/style/GridPositionsResolver.h:
2895
2896 2017-12-12  Jer Noble  <jer.noble@apple.com>
2897
2898         [EME] Support reporting and restoring persistent usage data.
2899         https://bugs.webkit.org/show_bug.cgi?id=180684
2900
2901         Reviewed by Eric Carlson.
2902
2903         Add support for reading and acknowledging persistent usage data from the MediaKeys storage
2904         directory.
2905
2906         Add a mechanism for passing the storage location down to CDMPrivate and CDMInstance objects
2907         inside of the CDM class itself:
2908
2909         * Modules/encryptedmedia/CDM.cpp:
2910         (WebCore::CDM::createInstance):
2911         (WebCore::CDM::storageDirectory const):
2912         * Modules/encryptedmedia/CDM.h:
2913
2914         Support loading expired session data, acknowledging expired session data, closing sessions
2915         and removing usable key data.
2916
2917         * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.h:
2918         * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm:
2919         (WebCore::isEqual):
2920         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::updateLicense):
2921         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::loadSession):
2922         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::closeSession):
2923         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::removeSessionData):
2924
2925 2017-12-12  Christopher Reid  <chris.reid@sony.com>
2926
2927         WebGL TextureMapperShaderProgram shaders don't compile in MSVC
2928         https://bugs.webkit.org/show_bug.cgi?id=180709
2929
2930         Reviewed by Myles C. Maxfield.
2931
2932         No new tests, no change in behavior.
2933
2934         Vertex and Fragment shaders were not compiling because TextureMapperShaderProgram.cpp was
2935         stringifying "#if USE(OPENGL_ES_2) ... #endif" into the shaders rather than evaluating these
2936         preprocessor directives before the STRINGIFY expansion.
2937
2938         Moved these #if conditions outside of STRINGIFY to remove compiler ambiguity.
2939
2940         * platform/graphics/texmap/TextureMapperShaderProgram.cpp:
2941
2942 2017-12-12  Zach Li  <zachli@apple.com>
2943         [WK2] Expose image via WKBundleHitTestResult API.
2944         https://bugs.webkit.org/show_bug.cgi?id=180552.
2945         rdar://problem/23951521
2946
2947         Reviewed by Simon Fraser.
2948
2949         * platform/graphics/ImageSource.h:
2950         This method will be used by clients outside WebCore, so
2951         add WEBCORE_EXPORT.
2952
2953 2017-12-12  Simon Fraser  <simon.fraser@apple.com>
2954
2955         Remove ColorSpaceDeviceRGB and most users of the obsolete deviceRGB colorspace
2956         https://bugs.webkit.org/show_bug.cgi?id=180689
2957
2958         Reviewed by Tim Horton.
2959
2960         Remove the ColorSpaceDeviceRGB enum and users.
2961
2962         ImageBuffer now uses sRGB instead of deviceRGB in the few cases that used the latter.
2963
2964         Switch Windows CG code to use sRGBColorSpaceRef() instead of deviceRGBColorSpaceRef().
2965
2966         Have linearRGBColorSpaceRef() use kCGColorSpaceLinearSRGB, which is present in iOS 9 and 10.11 and later.
2967
2968         * page/win/FrameCGWin.cpp:
2969         (WebCore::imageFromRect):
2970         * platform/graphics/Color.cpp:
2971         (WebCore::operator<<):
2972         * platform/graphics/ColorSpace.h:
2973         * platform/graphics/ImageBuffer.cpp:
2974         (WebCore::ImageBuffer::transformColorSpace):
2975         * platform/graphics/cg/ColorCG.cpp:
2976         (WebCore::Color::Color):
2977         (WebCore::leakCGColor):
2978         (WebCore::createCGColorWithDeviceRGBA): Deleted.
2979         * platform/graphics/cg/GraphicsContextCG.cpp:
2980         (WebCore::sRGBColorSpaceRef):
2981         (WebCore::linearRGBColorSpaceRef):
2982         (WebCore::extendedSRGBColorSpaceRef):
2983         (WebCore::displayP3ColorSpaceRef):
2984         (WebCore::deviceRGBColorSpaceRef): Deleted.
2985         * platform/graphics/cg/GraphicsContextCG.h:
2986         (WebCore::cachedCGColorSpace):
2987         * platform/graphics/cocoa/GraphicsContextCocoa.mm:
2988         * platform/graphics/win/GraphicsContextCGWin.cpp:
2989         (WebCore::CGContextWithHDC):
2990         (WebCore::GraphicsContext::releaseWindowsContext):
2991         (WebCore::GraphicsContext::drawWindowsBitmap):
2992         * platform/graphics/win/ImageCGWin.cpp:
2993         (WebCore::BitmapImage::create):
2994         (WebCore::BitmapImage::getHBITMAPOfSize):
2995         * platform/mediastream/mac/MockRealtimeVideoSourceMac.mm:
2996         (WebCore::MockRealtimeVideoSourceMac::pixelBufferFromCGImage const):
2997         * platform/win/DragImageCGWin.cpp:
2998         (WebCore::allocImage):
2999         (WebCore::createCgContextFromBitmap):
3000         * rendering/svg/RenderSVGResourceFilter.cpp:
3001         (WebCore::RenderSVGResourceFilter::postApplyResource):
3002         * rendering/svg/RenderSVGResourceMasker.cpp:
3003         (WebCore::RenderSVGResourceMasker::drawContentIntoMaskImage):
3004
3005 2017-12-12  Youenn Fablet  <youenn@apple.com>
3006
3007         Navigation requests should use navigate fetch mode
3008         https://bugs.webkit.org/show_bug.cgi?id=179808
3009
3010         Reviewed by Chris Dumez.
3011
3012         Covered by existing tests.
3013
3014         * Modules/fetch/FetchRequest.cpp:
3015         (WebCore::buildOptions): Update to throw only if init.mode is Navigate.
3016         * Modules/fetch/FetchRequestInit.h:
3017         (WebCore::FetchRequestInit::hasMembers const): If init is present, set default values as per spec.
3018         * loader/DocumentLoader.cpp:
3019         (WebCore::DocumentLoader::loadMainResource): Set fetch mode to navigate.
3020         * loader/DocumentThreadableLoader.cpp:
3021         (WebCore::DocumentThreadableLoader::DocumentThreadableLoader): Bypass preflight in case fetch mode is navigate.
3022
3023 2017-12-12  Simon Fraser  <simon.fraser@apple.com>
3024
3025         HTML-page with <object type="image/svg+xml" data="foo.svg"> often is blank
3026         https://bugs.webkit.org/show_bug.cgi?id=180524
3027         <rdar://problem/35920554>
3028
3029         Reviewed by Antti Koivisto.
3030
3031         The test case has script that conditionalizes behavior on whether window.innerWidth/Height
3032         are zero during the load event. We didn't force layout in innerWidth/Height, so whether
3033         they would zero depended on whether the parent frame had laid out, which was timing-sensitive.
3034
3035         Fix by triggering enough layout in the parent document so that the FrameView is resized before
3036         fetching its dimensions in innerWidth/Height. This causes our behavior to match Chrome and Firefox.
3037
3038         Test: fast/dom/iframe-innerWidth.html
3039
3040         * dom/EventDispatcher.cpp:
3041         (WebCore::EventDispatcher::dispatchEvent): Add some logging that helped me diagnose this.
3042         * page/DOMWindow.cpp:
3043         (WebCore::DOMWindow::innerHeight const):
3044         (WebCore::DOMWindow::innerWidth const):
3045
3046 2017-12-11  Antoine Quint  <graouts@apple.com>
3047
3048         [Web Animations] Enqueue and dispatch animation events
3049         https://bugs.webkit.org/show_bug.cgi?id=180657
3050         <rdar://problem/35970103>
3051
3052         Reviewed by Chris Dumez.
3053
3054         Now that we have support for the AnimationPlaybackEvent interface, we need a way to enqueue
3055         such events for dispatch at the opportune time. The Web Animations spec defines two ways
3056         to queue and dispatch events.
3057
3058         If the animation has a "document for timing", it should enqueue events on this document.
3059         In our implementation, if the animation timeline is set to a DocumentTimeline, that means
3060         it has a document for timing, and we let the DocumentTimeline enqueue those events, which
3061         will be dispatched through a dedicated GenericTaskQueue<Timer>. These events will be sorted
3062         by their respective timeline time before being dispatched.
3063
3064         If there is no document for timing, events should be dispatched as a standalone task.
3065
3066         * animation/DocumentTimeline.cpp:
3067         (WebCore::DocumentTimeline::~DocumentTimeline): Close the event dispatch task queue when the
3068         document timeline is torn down.
3069         (WebCore::DocumentTimeline::enqueueAnimationPlaybackEvent): Add the provided event to the
3070         pending animation events queue and, if one hasn't been registered yet, enqueue a task to
3071         dispatch events using a GenericTaskQueue<Timer>.
3072         (WebCore::compareAnimationPlaybackEvents): Comparator used to sort events in performEventDispatchTask()
3073         where events are sorted such that unresolved timeline times come first, and then from the
3074         earlier resolved timeline times to the later resolved timeline times. Events with unresolved
3075         timeline times and equal resolved timeline times are sorted in the order they were enqueued.
3076         (WebCore::DocumentTimeline::performEventDispatchTask): Run a stable sort on a copy of the pending list
3077         of events to dispatch and dispatch the events individually on their respective animations.
3078         * animation/DocumentTimeline.h:
3079         * animation/WebAnimation.cpp:
3080         (WebCore::WebAnimation::create): Pass in the document to the constructor.
3081         (WebCore::WebAnimation::WebAnimation): Use the provided document to initialize ActiveDOMObject.
3082         (WebCore::WebAnimation::enqueueAnimationPlaybackEvent): Create an AnimationPlaybackEvent with
3083         the provided type, timeline time and animation time and enqueue it on the document timeline,
3084         if one is available, or dispatch on this animation as a standalone task.
3085         (WebCore::WebAnimation::acceleratedRunningStateDidChange):
3086         (WebCore::WebAnimation::activeDOMObjectName const):
3087         (WebCore::WebAnimation::canSuspendForDocumentSuspension const):
3088         (WebCore::WebAnimation::stop):
3089         * animation/WebAnimation.h: Define WebAnimation to be an EventTarget and an ActiveDOMObject.
3090         * animation/WebAnimation.idl: Define WebAnimation to be an EventTarget and an ActiveDOMObject.
3091         * dom/EventTargetFactory.in:
3092
3093 2017-12-12  Chris Dumez  <cdumez@apple.com>
3094
3095         Simplify IPC code between WebProcess and StorageProcess for serviceWorker.postMessage()
3096         https://bugs.webkit.org/show_bug.cgi?id=180683
3097
3098         Reviewed by Brady Eidson.
3099
3100         Merge the 2 code paths from calling postMessage() from a ServiceWorkerClient and from
3101         a ServiceWorker. Also, postMessage() now only IPCs an identifier from the WebContent
3102         process to the StorageProcess. The ServiceWorkerClientData is looked up on Storage
3103         process side from the identifier before being sent to the context process.
3104
3105         * workers/service/SWClientConnection.h:
3106         * workers/service/ServiceWorker.cpp:
3107         (WebCore::ServiceWorker::postMessage):
3108         * workers/service/ServiceWorkerTypes.h:
3109         * workers/service/server/SWServer.cpp:
3110         (WebCore::SWServer::clientByID const):
3111         (WebCore::SWServer::matchAll):
3112         (WebCore::SWServer::forEachClientForOrigin):
3113         (WebCore::SWServer::claim):
3114         (WebCore::SWServer::registerServiceWorkerClient):
3115         (WebCore::SWServer::unregisterServiceWorkerClient):
3116         * workers/service/server/SWServer.h:
3117         * workers/service/server/SWServerWorker.cpp:
3118         (WebCore::SWServerWorker::findClientByIdentifier):
3119         * workers/service/server/SWServerWorker.h:
3120
3121 2017-12-12  Youenn Fablet  <youenn@apple.com>
3122
3123         Allow AudioContext to start when getUserMedia is on
3124         https://bugs.webkit.org/show_bug.cgi?id=180680
3125
3126         Reviewed by Eric Carlson.
3127
3128         Test: webrtc/getUserMedia-webaudio-autoplay.html
3129
3130         * Modules/webaudio/AudioContext.cpp:
3131         (WebCore::AudioContext::willBeginPlayback):
3132
3133 2017-12-12  Romain Bellessort  <romain.bellessort@crf.canon.fr>
3134
3135         [Readable Streams API] Throw RangeError if a size is provided when creating a readable byte stream
3136         https://bugs.webkit.org/show_bug.cgi?id=180470
3137
3138         Reviewed by Youenn Fablet.
3139
3140         Throw a RangeError if a ReadableStream is created with type 'bytes' and with a
3141         non-undefined strategy size, as per latest spec:
3142         - https://github.com/whatwg/streams/pull/856
3143         - https://streams.spec.whatwg.org/#rs-constructor (step 4.c)
3144
3145         One new test imported from WPT to check that RangeError is thrown.
3146
3147         * Modules/streams/ReadableStream.js:
3148         (initializeReadableStream): Check strategy size and throw RangeError if needed.
3149
3150 2017-12-12  Carlos Alberto Lopez Perez  <clopez@igalia.com>
3151
3152         [GTK][WebRTC] Stop warning with so much verbosity about not implemented RealtimeMediaSourceCenter
3153         https://bugs.webkit.org/show_bug.cgi?id=180694
3154
3155         Reviewed by Youenn Fablet.
3156
3157         No new tests -- no change in functionality.
3158
3159         * platform/mediastream/RealtimeMediaSourceCenter.cpp:
3160         (WebCore::RealtimeMediaSourceCenter::singleton):
3161
3162 2017-12-12  Ms2ger  <Ms2ger@igalia.com>
3163
3164         Implement {DOMMimeTypeArray, DOMPluginArray}::supportedPropertyNames().
3165         https://bugs.webkit.org/show_bug.cgi?id=180471
3166
3167         Reviewed by Darin Adler.
3168
3169         Test: imported/w3c/web-platform-tests/html/webappapis/system-state-and-capabilities/the-navigator-object/navigator-pluginarray.html
3170
3171         * plugins/DOMMimeTypeArray.cpp:
3172         (WebCore::DOMMimeTypeArray::supportedPropertyNames):
3173         * plugins/DOMPluginArray.cpp:
3174         (WebCore::DOMPluginArray::supportedPropertyNames):
3175
3176 2017-12-12  Yusuke Suzuki  <utatane.tea@gmail.com>
3177
3178         [WTF] Thread::create should have Thread::tryCreate
3179         https://bugs.webkit.org/show_bug.cgi?id=180333
3180
3181         Reviewed by Darin Adler.
3182
3183         No behavior change.
3184
3185         * bindings/js/GCController.cpp:
3186         (WebCore::GCController::garbageCollectOnAlternateThreadForDebugging):
3187         * platform/audio/ReverbConvolver.cpp:
3188         (WebCore::ReverbConvolver::ReverbConvolver):
3189         * platform/audio/ReverbConvolver.h:
3190         * workers/WorkerThread.cpp:
3191         (WebCore::WorkerThread::start):
3192
3193 2017-12-11  Manuel Rego Casasnovas  <rego@igalia.com>
3194
3195         [css-grid] Automatic minimum size is not clamped if min track sizing function is auto
3196         https://bugs.webkit.org/show_bug.cgi?id=180283
3197
3198         Reviewed by Darin Adler.
3199
3200         We were not clamping the automatic minimum size when
3201         the min track sizing function was intrinsic (e.g. minmax(auto, 0px)).
3202         However the spec (https://drafts.csswg.org/css-grid/#min-size-auto)
3203         is very clear regarding that.
3204
3205         This patch modifies
3206         GridTrackSizingAlgorithm::sizeTrackToFitNonSpanningItem(),
3207         so in the case of a fixed max track sizing function it clamps
3208         the automatic minimum size of the item to the stretch fit
3209         of the grid area's size.
3210         It needs to take into account if the item has fixed size, margin, border
3211         and/or padding as those cannot be clamped.
3212
3213         Using WPT tests to verify this behavior,
3214         and corrected a bunch of other tests that were wrong.
3215
3216         Test: imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-minimum-size-grid-items-017.html
3217               imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-minimum-size-grid-items-022.html
3218               imported/w3c/web-platform-tests/css/css-grid/grid-items/grid-minimum-size-grid-items-023.html
3219
3220         * rendering/GridTrackSizingAlgorithm.cpp:
3221         (WebCore::GridTrackSizingAlgorithm::sizeTrackToFitNonSpanningItem):
3222         * rendering/GridTrackSizingAlgorithm.h:
3223         (WebCore::GridTrack::growthLimitIsInfinite const):
3224         * rendering/style/GridTrackSize.h:
3225         (WebCore::GridTrackSize::cacheMinMaxTrackBreadthTypes):
3226         (WebCore::GridTrackSize::hasFixedMaxTrackBreadth const):
3227
3228 2017-12-11  Zan Dobersek  <zdobersek@igalia.com>
3229
3230         [Cairo] Cairo::clipToImageBuffer() should operate on a cairo_surface_t
3231         https://bugs.webkit.org/show_bug.cgi?id=180665
3232
3233         Reviewed by Michael Catanzaro.
3234
3235         Have the Cairo::clipToImageBuffer() function in the CairoUtilities code
3236         operate on a cairo_surface_t object, instead of an Image object.
3237
3238         Call site in GraphicsContext::clipToImageBuffer() is adjusted to first
3239         ensure a non-null Image object, and then retrieve a cairo_surface_t
3240         object from that, passing it on to Cairo::clipToImageBuffer().
3241
3242         No new tests -- no change in functionality.
3243
3244         * platform/graphics/cairo/CairoOperations.cpp:
3245         (WebCore::Cairo::clipToImageBuffer):
3246         * platform/graphics/cairo/CairoOperations.h:
3247         * platform/graphics/cairo/GraphicsContextCairo.cpp:
3248         (WebCore::GraphicsContext::clipToImageBuffer):
3249
3250 2017-12-11  Zan Dobersek  <zdobersek@igalia.com>
3251
3252         [Cairo] Don't use a static cairo_surface_t object for CairoPath contexts
3253         https://bugs.webkit.org/show_bug.cgi?id=180663
3254
3255         Reviewed by Michael Catanzaro.
3256
3257         Instead of using a single cairo_surface_t object and sharing it between
3258         different cairo_t objects handled by CairoPath, create a new mock 1x1px
3259         alpha-only surface for each cairo_t object that's allocated in the
3260         CairoPath constructor.
3261
3262         This avoids potential issues in how Cairo's state handling internally
3263         uses these surfaces, which is completely opaque to us and out of our
3264         control. This also avoids crashes when using this one cairo_surface_t
3265         object through different CairoPath objects across different threads.
3266
3267         No new tests -- no change in behavior.
3268
3269         * platform/graphics/cairo/PlatformPathCairo.cpp:
3270         (WebCore::CairoPath::CairoPath):
3271         (WebCore::pathSurface): Deleted.
3272         * platform/graphics/cairo/PlatformPathCairo.h:
3273         (WebCore::CairoPath::context):
3274
3275 2017-12-11  Zan Dobersek  <zdobersek@igalia.com>
3276
3277         [CoordGraphics] Move UpdateAtlas, AreaAllocator into the platform layer
3278         https://bugs.webkit.org/show_bug.cgi?id=180641
3279
3280         Reviewed by Michael Catanzaro.
3281
3282         Move the UpdateAtlas and AreaAllocator classes and their source files
3283         into the platform layer. This still means using the WebCore namespace,
3284         but apart from that these two classes have no dependency on anything in
3285         the WebKit layer, so they can be moved from there.
3286
3287         No new tests -- no change in functionality.
3288
3289         * platform/TextureMapper.cmake:
3290         * platform/graphics/texmap/coordinated/AreaAllocator.cpp: Renamed from Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/AreaAllocator.cpp.
3291         (WebCore::AreaAllocator::AreaAllocator):
3292         (WebCore::AreaAllocator::~AreaAllocator):
3293         (WebCore::AreaAllocator::expand):
3294         (WebCore::AreaAllocator::expandBy):
3295         (WebCore::AreaAllocator::release):
3296         (WebCore::AreaAllocator::overhead const):
3297         (WebCore::AreaAllocator::roundAllocation const):
3298         (WebCore::GeneralAreaAllocator::GeneralAreaAllocator):
3299         (WebCore::GeneralAreaAllocator::~GeneralAreaAllocator):
3300         (WebCore::GeneralAreaAllocator::freeNode):
3301         (WebCore::GeneralAreaAllocator::expand):
3302         (WebCore::fitsWithin):
3303         (WebCore::GeneralAreaAllocator::allocate):
3304         (WebCore::GeneralAreaAllocator::allocateFromNode):
3305         (WebCore::GeneralAreaAllocator::splitNode):
3306         (WebCore::GeneralAreaAllocator::updateLargestFree):
3307         (WebCore::GeneralAreaAllocator::release):
3308         (WebCore::GeneralAreaAllocator::overhead const):
3309         * platform/graphics/texmap/coordinated/AreaAllocator.h: Renamed from Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/AreaAllocator.h.
3310         (WebCore::nextPowerOfTwo):
3311         (WebCore::AreaAllocator::size const):
3312         (WebCore::AreaAllocator::minimumAllocation const):
3313         (WebCore::AreaAllocator::setMinimumAllocation):
3314         (WebCore::AreaAllocator::margin const):
3315         (WebCore::AreaAllocator::setMargin):
3316         * platform/graphics/texmap/coordinated/UpdateAtlas.cpp: Renamed from Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/UpdateAtlas.cpp.
3317         (WebCore::UpdateAtlas::UpdateAtlas):
3318         (WebCore::UpdateAtlas::~UpdateAtlas):
3319         (WebCore::UpdateAtlas::buildLayoutIfNeeded):
3320         (WebCore::UpdateAtlas::didSwapBuffers):
3321         (WebCore::UpdateAtlas::getCoordinatedBuffer):
3322         * platform/graphics/texmap/coordinated/UpdateAtlas.h: Renamed from Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/UpdateAtlas.h.
3323         (WebCore::UpdateAtlas::size const):
3324         (WebCore::UpdateAtlas::supportsAlpha const):
3325         (WebCore::UpdateAtlas::addTimeInactive):
3326         (WebCore::UpdateAtlas::isInactive const):
3327         (WebCore::UpdateAtlas::isInUse const):
3328
3329 2017-12-11  Ryosuke Niwa  <rniwa@webkit.org>
3330
3331         Disable NoEventDispatchAssertion release assertion in WebKit1
3332         https://bugs.webkit.org/show_bug.cgi?id=180616
3333
3334         Reviewed by Zalan Bujtas.
3335
3336         Disabled the release assertion for NoEventDispatchAssertion in WebKit1 since there are many
3337         delegate callbacks that happen at unsafe timing, and we don't have any hope of fixing them
3338         in short term.
3339
3340         * bindings/js/ScriptController.cpp:
3341         (WebCore::ScriptController::canExecuteScripts):
3342         * dom/Document.cpp:
3343         (WebCore::isSafeToUpdateStyleOrLayout):
3344         * dom/ScriptElement.cpp:
3345         (WebCore::ScriptElement::executeClassicScript):
3346         * platform/RuntimeApplicationChecks.h:
3347         (WebCore::isInWebProcess):
3348         * platform/cocoa/RuntimeApplicationChecksCocoa.mm:
3349         (WebCore::isInWebProcess): Extracted from IOSApplication::isWebProcess.
3350         (WebCore::IOSApplication::isWebProcess):
3351
3352 2017-12-11  Darin Adler  <darin@apple.com>
3353
3354         Improve FontSelectionAlgorithm, including moving from IntegerHasher to Hasher
3355         https://bugs.webkit.org/show_bug.cgi?id=180340
3356
3357         Reviewed by Dan Bates.
3358
3359         * css/CSSFontFaceSet.h: Moved FontSelectionRequestKey and FontSelectionRequestKeyHash
3360         here to be private members, and used a std::optional instead of a class for this.
3361         Also use the new Hasher to compute the hash. Also added FontSelectionRequestKeyHashTraits.
3362
3363         * platform/graphics/FontDescription.cpp:
3364         (WebCore::FontDescription::FontDescription): Updated since FontSelectionRequest
3365         does not always have a constructor any more.
3366
3367         * platform/graphics/FontSelectionAlgorithm.h: Tweaked comments. Used "using" instead
3368         of typedef. Formatted some trivial functions as single lines. Stopped using
3369         NeverDestroyed for simple classes like FontSelectionValue; it's not needed unless
3370         there is a destructor. Got rid of some incorrect use of const. Replaced some member
3371         functions with non-member functions. Moved some function bodies out of class definitions.
3372         Used a lot of constexpr functions.
3373         (WebCore::FontSelectionRequest::tied const): Added so we can easily write both == and the
3374         hash function without listing the data members.
3375         (WebCore::add): Added an overload so we can hash things that include FontSelectionRequest.
3376         (WebCore::FontSelectionRequestKey::FontSelectionRequestKey): Changed this class to
3377         use std::optional instead of a separate boolean for deleted values.
3378         (WebCore::FontSelectionRequestKey::isHashTableDeletedValue const): Ditto.
3379         (WebCore::FontSelectionRequestKey::operator== const): Ditto.
3380         (WebCore::FontSelectionRequestKeyHash::hash): Ditto.
3381         (WebCore::FontSelectionRequestKeyHash::equal): Ditto.
3382         (WebCore::FontSelectionCapabilities::tied const): Added so we can easily write both ==
3383         and the hash function without listing the data members.
3384         (WebCore::FontSelectionSpecifiedCapabilities::tied const): Ditto.
3385         (WebCore::FontSelectionAlgorithm::FontSelectionAlgorithm): Use make_unique instead of new.
3386
3387         * platform/graphics/cocoa/FontCacheCoreText.cpp:
3388         (WebCore::findClosestFont): Move in the vector instead of copying it when creating a
3389         FontSelectionAlgorithm object.
3390
3391 2017-12-11  Jer Noble  <jer.noble@apple.com>
3392
3393         [EME] support update() for FairPlayStreaming in Modern EME API
3394         https://bugs.webkit.org/show_bug.cgi?id=180542
3395
3396         Reviewed by Eric Carlson.
3397
3398         Support the updateLicense() method in CDMInstanceFairPlayStreaming. Also, support adding a
3399         AVStreamDataParser to the AVContentKeySession.
3400
3401         Drive-by fixes:
3402
3403         - Sometimes, AVFoundation will give us a base64 encoded string with spaces url-disallowed
3404         characters, so use base64Decode() rather than base64URLDecode().
3405
3406         * platform/graphics/avfoundation/CDMFairPlayStreaming.cpp:
3407         (WebCore::validFairPlayStreamingSchemes):
3408         (WebCore::extractSinfData):
3409         * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.h:
3410         * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm:
3411         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::updateLicense):
3412         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::didProvideRequest):
3413         (WebCore::CDMInstanceFairPlayStreamingAVFObjC::didFailToProvideRequest):
3414         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
3415         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::cdmInstance const):
3416         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
3417         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::cdmInstanceAttached):
3418         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::cdmInstanceDetached):
3419         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::attemptToDecryptWithInstance):
3420         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h:
3421         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
3422         (WebCore::SourceBufferPrivateAVFObjC::destroyParser):
3423         (WebCore::SourceBufferPrivateAVFObjC::setCDMInstance):
3424
3425 2017-12-11  Eric Carlson  <eric.carlson@apple.com>
3426
3427         Web Inspector: Optionally log WebKit log parameters as JSON
3428         https://bugs.webkit.org/show_bug.cgi?id=180529
3429         <rdar://problem/35909462>
3430
3431         Reviewed by Joseph Pecoraro.
3432
3433         * dom/Document.cpp:
3434         (WebCore::Document::didLogMessage):Update for API change. Don't check for main thread, that
3435         is already done in addConsoleMessage.
3436         * dom/Document.h:
3437
3438         * html/HTMLMediaElement.cpp:
3439         (WebCore::HTMLMediaElement::updatePlayState): Cleanup logging.
3440
3441         * html/track/DataCue.cpp:
3442         (WebCore::DataCue::toJSONString const): Serialize to JSON string.
3443         (WebCore::DataCue::toString const): Deleted.
3444         * html/track/DataCue.h:
3445         (WTF::LogArgument<WebCore::DataCue>::toString):
3446
3447         * html/track/TextTrackCue.cpp:
3448         (WebCore::TextTrackCue::toJSON const): Ditto.
3449         (WebCore::TextTrackCue::toJSONString const):
3450         (WebCore::TextTrackCue::toString const): Deleted.
3451         * html/track/TextTrackCue.h:
3452         (WTF::LogArgument<WebCore::TextTrackCue>::toString):
3453
3454         * html/track/TextTrackCueGeneric.cpp:
3455         (WebCore::TextTrackCueGeneric::toJSONString const): Ditto.
3456         (WebCore::TextTrackCueGeneric::toString const): Deleted.
3457         * html/track/TextTrackCueGeneric.h:
3458         (WTF::LogArgument<WebCore::TextTrackCueGeneric>::toString):
3459
3460         * html/track/VTTCue.cpp:
3461         (WebCore::VTTCue::toJSONString const): Ditto.
3462         (WebCore::VTTCue::toString const): Deleted.
3463         * html/track/VTTCue.h:
3464         (WTF::LogArgument<WebCore::VTTCue>::toString):
3465
3466         * platform/graphics/InbandTextTrackPrivateClient.h:
3467         (WebCore::GenericCueData::toJSONString const): Ditto.
3468         (WTF::LogArgument<WebCore::GenericCueData>::toString):
3469         (WebCore::GenericCueData::toString const): Deleted.
3470
3471         * platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp:
3472         (WebCore::InbandTextTrackPrivateAVF::processAttributedStrings): Cleanup logging.
3473         (WebCore::InbandTextTrackPrivateAVF::removeCompletedCues): Ditto.
3474         (WebCore::InbandTextTrackPrivateAVF::processNativeSamples): Log the entire cue.
3475         (WebCore::InbandTextTrackPrivateAVF::readNativeSampleBuffer): Cleanup logging.
3476
3477         * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp:
3478         (WebCore::MediaPlayerPrivateAVFoundation::maxMediaTimeSeekable const): Don't log, it isn't
3479         interesting and happens frequently.
3480         (WebCore::MediaPlayerPrivateAVFoundation::minMediaTimeSeekable const): Ditto.
3481
3482         * platform/graphics/iso/ISOVTTCue.cpp:
3483         (WebCore::ISOWebVTTCue::toJSONString const): Serialize to JSON string.
3484
3485         * platform/graphics/iso/ISOVTTCue.h:
3486         (WTF::LogArgument<WebCore::ISOWebVTTCue>::toString): Ditto.
3487
3488 2017-12-11  Youenn Fablet  <youenn@apple.com>
3489
3490         Use VCP H264 encoder for platforms supporting it
3491         https://bugs.webkit.org/show_bug.cgi?id=179076
3492         rdar://problem/35180773
3493
3494         Reviewed by Eric Carlson.
3495
3496         Covered by existing test coverage.
3497
3498         * platform/mediastream/libwebrtc/VideoToolBoxEncoderFactory.cpp:
3499         (WebCore::VideoToolboxVideoEncoderFactory::setActive):
3500         (WebCore::VideoToolboxVideoEncoderFactory::CreateSupportedVideoEncoder):
3501         (WebCore::VideoToolboxVideoEncoderFactory::DestroyVideoEncoder):
3502         * platform/mediastream/libwebrtc/VideoToolBoxEncoderFactory.h:
3503
3504 2017-12-11  Chris Dumez  <cdumez@apple.com>
3505
3506         Merge ServiceWorkerClientIdentifier into ServiceWorkerClientData
3507         https://bugs.webkit.org/show_bug.cgi?id=180669
3508
3509         Reviewed by Youenn Fablet.
3510
3511         Merge ServiceWorkerClientIdentifier into ServiceWorkerClientData, for consistency with
3512         ServiceWorkerIdentifier / ServiceWorkerData, and start simplifying the postMessage() code.
3513
3514         * WebCore.xcodeproj/project.pbxproj:
3515         * dom/Document.cpp:
3516         (WebCore::Document::setServiceWorkerConnection):
3517         * workers/service/SWClientConnection.h:
3518         * workers/service/ServiceWorker.cpp:
3519         (WebCore::ServiceWorker::postMessage):
3520         * workers/service/ServiceWorkerClient.cpp:
3521         (WebCore::ServiceWorkerClient::getOrCreate):
3522         (WebCore::ServiceWorkerClient::ServiceWorkerClient):
3523         * workers/service/ServiceWorkerClient.h:
3524         (WebCore::ServiceWorkerClient::identifier const):
3525         * workers/service/ServiceWorkerClientData.cpp:
3526         (WebCore::ServiceWorkerClientData::isolatedCopy const):
3527         (WebCore::ServiceWorkerClientData::from):
3528         * workers/service/ServiceWorkerClientData.h:
3529         (WebCore::ServiceWorkerClientData::encode const):
3530         (WebCore::ServiceWorkerClientData::decode):
3531         * workers/service/ServiceWorkerClientInformation.h: Removed.
3532         * workers/service/ServiceWorkerClients.cpp:
3533         (WebCore::didFinishGetRequest):
3534         (WebCore::ServiceWorkerClients::get):
3535         (WebCore::matchAllCompleted):
3536         * workers/service/ServiceWorkerTypes.h:
3537         * workers/service/ServiceWorkerWindowClient.cpp:
3538         (WebCore::ServiceWorkerWindowClient::ServiceWorkerWindowClient):
3539         * workers/service/ServiceWorkerWindowClient.h:
3540         * workers/service/context/SWContextManager.cpp:
3541         (WebCore::SWContextManager::postMessageToServiceWorker):
3542         * workers/service/context/SWContextManager.h:
3543         * workers/service/context/ServiceWorkerThread.cpp:
3544         (WebCore::ServiceWorkerThread::postMessageToServiceWorker):
3545         * workers/service/context/ServiceWorkerThread.h:
3546         * workers/service/server/SWServer.cpp:
3547         (WebCore::SWServer::findClientByIdentifier):
3548         (WebCore::SWServer::matchAll):
3549         (WebCore::SWServer::claim):
3550         (WebCore::SWServer::registerServiceWorkerClient):
3551         * workers/service/server/SWServer.h:
3552         * workers/service/server/SWServerToContextConnection.h:
3553         * workers/service/server/SWServerWorker.h:
3554
3555 2017-12-11  Daniel Bates  <dabates@apple.com>
3556
3557         Fix the macOS Sierra build following r225179
3558         (https://bugs.webkit.org/show_bug.cgi?id=180011)
3559
3560         Substitute TARGET_MAC_OS_X_VERSION_LESS_THAN_101300 for TARGET_MAC_OS_X_VERSION_LESS_THAN_1013000.
3561
3562         * Configurations/WebCore.xcconfig:
3563
3564 2017-12-11  Zalan Bujtas  <zalan@apple.com>
3565
3566         Make FrameView objects IsoHeap allocated
3567         https://bugs.webkit.org/show_bug.cgi?id=180668
3568         <rdar://problem/35976738>
3569
3570         Reviewed by Simon Fraser.
3571
3572         Related to <https://trac.webkit.org/changeset/225719/webkit>
3573
3574         * page/FrameView.cpp:
3575         * page/FrameView.h:
3576
3577 2017-12-11  Antoine Quint  <graouts@apple.com>
3578
3579         [Web Animations] Implement AnimationPlaybackEvent and AnimationPlaybackEventInit
3580         https://bugs.webkit.org/show_bug.cgi?id=180647
3581
3582         Reviewed by Dean Jackson.
3583
3584         Actually fix Windows build this time.
3585
3586         * animation/AnimationPlaybackEventInit.h:
3587
3588 2017-12-11  Antoine Quint  <graouts@apple.com>
3589
3590         [Web Animations] Implement AnimationPlaybackEvent and AnimationPlaybackEventInit
3591         https://bugs.webkit.org/show_bug.cgi?id=180647
3592         <rdar://problem/35966325>
3593
3594         Reviewed by Dean Jackson.
3595
3596         Unreviewed, fix Windows build.
3597
3598         * animation/AnimationPlaybackEventInit.h:
3599
3600 2017-12-11  Zalan Bujtas  <zalan@apple.com>
3601
3602         FloatingObjects/FloatingObject classes should hold weak references to renderers
3603         https://bugs.webkit.org/show_bug.cgi?id=180627
3604         <rdar://problem/35954069>
3605
3606         Reviewed by Antti Koivisto.
3607
3608         * rendering/FloatingObjects.cpp:
3609         (WebCore::FloatingObject::FloatingObject):
3610         (WebCore::ComputeFloatOffsetAdapter::ComputeFloatOffsetAdapter):
3611         (WebCore::ComputeFloatOffsetForFloatLayoutAdapter::ComputeFloatOffsetForFloatLayoutAdapter):
3612         (WebCore::ComputeFloatOffsetForLineLayoutAdapter::ComputeFloatOffsetForLineLayoutAdapter):
3613         (WebCore::FindNextFloatLogicalBottomAdapter::FindNextFloatLogicalBottomAdapter):
3614         (WebCore::FindNextFloatLogicalBottomAdapter::collectIfNeeded):
3615         (WebCore::FloatingObjects::findNextFloatLogicalBottomBelow):
3616         (WebCore::FloatingObjects::findNextFloatLogicalBottomBelowForBlock):
3617         (WebCore::FloatingObjects::FloatingObjects):
3618         (WebCore::FloatingObjects::clearLineBoxTreePointers):
3619         (WebCore::FloatingObjects::logicalLeftOffsetForPositioningFloat):
3620         (WebCore::FloatingObjects::logicalRightOffsetForPositioningFloat):
3621         (WebCore::FloatingObjects::logicalLeftOffset):
3622         (WebCore::FloatingObjects::logicalRightOffset):
3623         (WebCore::ComputeFloatOffsetForFloatLayoutAdapter<FloatingObject::FloatLeft>::updateOffsetIfNeeded):
3624         (WebCore::ComputeFloatOffsetForFloatLayoutAdapter<FloatingObject::FloatRight>::updateOffsetIfNeeded):
3625         (WebCore::ComputeFloatOffsetForFloatLayoutAdapter<FloatTypeValue>::heightRemaining const):
3626         (WebCore::ComputeFloatOffsetAdapter<FloatTypeValue>::collectIfNeeded):
3627         (WebCore::ComputeFloatOffsetForLineLayoutAdapter<FloatingObject::FloatLeft>::updateOffsetIfNeeded):
3628         (WebCore::ComputeFloatOffsetForLineLayoutAdapter<FloatingObject::FloatRight>::updateOffsetIfNeeded):
3629         * rendering/FloatingObjects.h:
3630         (WebCore::FloatingObject::renderer const):
3631         (WebCore::FloatingObjects::renderer const):
3632
3633 2017-12-11  David Quesada  <david_quesada@apple.com>
3634
3635         Turn on ENABLE_APPLICATION_MANIFEST
3636         https://bugs.webkit.org/show_bug.cgi?id=180562
3637         rdar://problem/35924737
3638
3639         Reviewed by Geoffrey Garen.
3640
3641         * Configurations/FeatureDefines.xcconfig:
3642         * loader/LinkLoader.cpp:
3643         (WebCore::createLinkPreloadResourceClient):
3644         * loader/cached/CachedResourceRequest.cpp:
3645             Add a missing #include that was implicitly added in the unified source when
3646             the feature is disabled.
3647
3648 2017-12-11  Dean Jackson  <dino@apple.com>
3649
3650         Add a runtime feature flag for ImageBitmap and OffscreenCanvas
3651         https://bugs.webkit.org/show_bug.cgi?id=180652
3652         <rdar://problem/35969611>
3653
3654         Reviewed by Antoine Quint.
3655
3656         Add a RuntimeEnabledFeature for these interfaces, and link the bindings
3657         to the feature.
3658
3659         Test: fast/canvas/offscreen-enabled.html
3660
3661         * bindings/js/WebCoreBuiltinNames.h:
3662         * html/ImageBitmap.idl:
3663         * html/OffscreenCanvas.idl:
3664         * page/RuntimeEnabledFeatures.h:
3665         (WebCore::RuntimeEnabledFeatures::setImageBitmapOffscreenCanvasEnabled):
3666         (WebCore::RuntimeEnabledFeatures::imageBitmapOffscreenCanvasEnabled const):
3667         * page/WindowOrWorkerGlobalScope.idl:
3668
3669 2017-12-11  Antoine Quint  <graouts@apple.com>
3670
3671         [Web Animations] Implement AnimationPlaybackEvent and AnimationPlaybackEventInit
3672         https://bugs.webkit.org/show_bug.cgi?id=180647
3673         <rdar://problem/35966325>
3674
3675         Reviewed by Dean Jackson.
3676
3677         We implement the AnimationPlaybackEvent interface and AnimationPlaybackEventInit dictionary
3678         as the first step towards dispatching animation "finish" and "cancel" events.
3679
3680         Animation playback events will be dispatched on Animation objects and expose the timeline time
3681         and animation current time at the time they were constructed. Dispatch itself, which will be
3682         the focus of the next patch, is not synchronous, so it's important to track those values
3683         at creation time.
3684
3685         No new tests yet, followup patches will enable event dispatch and existing Web Platform Tests
3686         will show progressions.
3687
3688         * CMakeLists.txt:
3689         * DerivedSources.make:
3690         * Sources.txt:
3691         * WebCore.xcodeproj/project.pbxproj:
3692         * animation/AnimationPlaybackEvent.cpp: Added.
3693         (WebCore::AnimationPlaybackEvent::AnimationPlaybackEvent):
3694         (WebCore::AnimationPlaybackEvent::bindingsCurrentTime const):
3695         (WebCore::AnimationPlaybackEvent::bindingsTimelineTime const):
3696         * animation/AnimationPlaybackEvent.h: Added.
3697         * animation/AnimationPlaybackEvent.idl: Added.
3698         * animation/AnimationPlaybackEventInit.h: Added.
3699         * animation/AnimationPlaybackEventInit.idl: Added.
3700         * bindings/js/WebCoreBuiltinNames.h:
3701         * dom/EventNames.in:
3702
3703 2017-12-11  Basuke Suzuki  <Basuke.Suzuki@sony.com>
3704
3705         [WinCairo] DumpRenderTree times out for all non-http tests
3706         https://bugs.webkit.org/show_bug.cgi?id=180571
3707
3708         Reviewed by Alex Christensen.
3709
3710         Bug fix on processing the curl event for file protocol.
3711
3712         No new tests. This fix is to run existing tests.
3713
3714         * platform/network/curl/CurlRequest.cpp:
3715         (WebCore::CurlRequest::completeDidReceiveResponse):
3716         * platform/network/curl/CurlRequest.h:
3717         (WebCore::CurlRequest::isCompleted const):
3718         (WebCore::CurlRequest::isCancelled const):
3719         (WebCore::CurlRequest::isCompletedOrCancelled const):
3720
3721 2017-12-11  Manuel Rego Casasnovas  <rego@igalia.com>
3722
3723         REGRESSION(r221931): Row stretch doesn't work for grid container with min-height
3724         https://bugs.webkit.org/show_bug.cgi?id=180287
3725
3726         Reviewed by Darin Adler.
3727
3728         In r221931 we moved the stretch phase as the last step of
3729         the track sizing algorithm.
3730         However this introduced a regression as we were no longer
3731         taking into account the grid container min-width|height constraints
3732         during this step.
3733
3734         The CSS WG modified the spec so it now defines what to do
3735         in these situations (https://drafts.csswg.org/css-grid/#algo-stretch):
3736           "If the free space is indefinite, but the grid container
3737            has a definite min-width/height, use that size to calculate
3738            the free space for this step instead."
3739
3740         This patch adds a new method
3741         GridTrackSizingAlgorithmStrategy::freeSpaceForStretchAutoTracksStep().
3742         When we're in the DefiniteSizeStrategy it just returns the current
3743         free space.
3744         For the IndefiniteSizeStrategy in the columns case we don't need
3745         any special computation (the same that happens in
3746         recomputeUsedFlexFractionIfNeeded()); for rows it uses the min size
3747         of the grid container (respecting min-width|height properties)
3748         to calculate the free space.
3749
3750         Test: imported/w3c/web-platform-tests/css/css-grid/layout-algorithm/grid-stretch-respects-min-size-001.html
3751
3752         * rendering/GridTrackSizingAlgorithm.cpp:
3753         (WebCore::IndefiniteSizeStrategy::freeSpaceForStretchAutoTracksStep const):
3754         (WebCore::DefiniteSizeStrategy::freeSpaceForStretchAutoTracksStep const):
3755         (WebCore::GridTrackSizingAlgorithm::stretchAutoTracks):
3756         * rendering/GridTrackSizingAlgorithm.h:
3757
3758 2017-12-10  Minsheng Liu  <lambda@liu.ms>
3759
3760         Incorrect bounds inside <mover>/<munder> when a stretchy operator is present
3761         https://bugs.webkit.org/show_bug.cgi?id=179682
3762
3763         Reviewed by Frédéric Wang.
3764
3765         Currently a stretchy operator inside <mover>/<munder>/<munderover> is stretched
3766         during paint() rather than layout(), which leads to both end user confusion
3767         and many unexpected behaviors. This patch rewrites
3768         RenderMathMLUnderOver::stretchHorizontalOperatorsAndLayoutChildren()
3769         to both eliminate the issue and make operator stretching more standard
3770         conforming.
3771
3772         A test is added to check the stretch width of stretchy operators in various
3773         scenarios:
3774         mathml/opentype/munderover-stretch-width.html
3775
3776         A previous test is updated:
3777         mathml/opentype/opentype-stretchy-horizontal.html
3778
3779         * rendering/mathml/RenderMathMLOperator.cpp:
3780         (WebCore::RenderMathMLOperator::stretchTo):
3781         (WebCore::RenderMathMLOperator::resetStretchSize):
3782         (WebCore::RenderMathMLOperator::paint):
3783         * rendering/mathml/RenderMathMLOperator.h:
3784         (WebCore::RenderMathMLOperator::setStretchWidthLocked):
3785         (WebCore::RenderMathMLOperator::isStretchWidthLocked const):
3786         * rendering/mathml/RenderMathMLUnderOver.cpp:
3787         (WebCore::toHorizontalStretchyOperator):
3788         (WebCore::fixLayoutAfterStretch):
3789         (WebCore::RenderMathMLUnderOver::stretchHorizontalOperatorsAndLayoutChildren):
3790
3791 2017-12-10  Yusuke Suzuki  <utatane.tea@gmail.com>
3792
3793         Unreviewed, follow-up patch after r225470
3794         https://bugs.webkit.org/show_bug.cgi?id=180308
3795
3796         * Modules/webdatabase/SQLTransaction.cpp:
3797         (WebCore::SQLTransaction::checkAndHandleClosedDatabase):
3798         Use consistent operands.
3799
3800         * bindings/js/JSCallbackData.h:
3801         (WebCore::JSCallbackData::JSCallbackData):
3802         Use class field initializer.
3803
3804         * xml/parser/XMLDocumentParserLibxml2.cpp:
3805         (WebCore::openFunc):
3806         Use consistent operands.
3807
3808 2017-12-09  Ryosuke Niwa  <rniwa@webkit.org>
3809
3810         iOS: Crash in Document::updateLayout() via Document::processViewport
3811         https://bugs.webkit.org/show_bug.cgi?id=180619
3812         <rdar://problem/35717575>
3813
3814         Reviewed by Zalan Bujtas.
3815
3816         The crash is caused by modern media controls updating the layout in the middle of insertedIntoAncestor
3817         via HTMLMediaElement::setControllerJSProperty inside Document::pageScaleFactorChangedAndStable.
3818
3819         Fixed the crash by delaying the work to update the viewport configuration until didFinishInsertingNode
3820         since updating the viewport configuration results in a lot of related code running in response,
3821         and making sure all that code never tries to execute an author script is not attainable in the short term,
3822         and a maintenance nightmare in the long term.
3823
3824         Test: media/ios/viewport-change-with-video.html
3825
3826         * html/HTMLMetaElement.cpp:
3827         (WebCore::HTMLMetaElement::insertedIntoAncestor):
3828         (WebCore::HTMLMetaElement::didFinishInsertingNode): Added.
3829         * html/HTMLMetaElement.h:
3830
3831 2017-12-08  Zalan Bujtas  <zalan@apple.com>
3832
3833         Document::updateLayout() could destroy current frame.
3834         https://bugs.webkit.org/show_bug.cgi?id=180525
3835         <rdar://problem/35906836>
3836
3837         Reviewed by Simon Fraser.
3838
3839         Early return when Document::updateLayout() triggers Frame destruction.
3840
3841         Test: fast/frames/crash-when-iframe-is-remove-in-eventhandler.html
3842
3843         * dom/TreeScope.cpp:
3844         (WebCore::absolutePointIfNotClipped):
3845
3846 2017-12-08  Chris Dumez  <cdumez@apple.com>
3847
3848         ServiceWorkerGlobalScope is a global object and should be marked as [ImplicitThis] in the IDL
3849         https://bugs.webkit.org/show_bug.cgi?id=180615
3850
3851         Reviewed by Brady Eidson.
3852
3853         ServiceWorkerGlobalScope is a global object and should be marked as [ImplicitThis] in the IDL, similarly to what we do for Window.
3854         This allows a getter to be fallback to the global object as ThisValue when the cast of the ThisValue to the expected type fails.
3855
3856         No new tests, rebaselined existing test.
3857
3858         * workers/DedicatedWorkerGlobalScope.idl:
3859         * workers/WorkerGlobalScope.idl:
3860         * workers/service/ServiceWorkerGlobalScope.idl:
3861
3862 2017-12-08  Brady Eidson  <beidson@apple.com>
3863
3864         Delay some service worker operations until after the database import completes.
3865         https://bugs.webkit.org/show_bug.cgi?id=180573
3866
3867         Reviewed by Chris Dumez.
3868
3869         No new tests (Not testable yet).
3870
3871         Right after the storage process launches it starts importing registration records.
3872         During this time, a lot of the decisions we make regarding registrations, fetch, etc.
3873         are invalid, as they rely on those in-memory records being in place.
3874         
3875         This patch delays certain things until after the initial origin table import is complete.
3876         
3877         * workers/service/server/RegistrationStore.cpp:
3878         (WebCore::RegistrationStore::databaseOpenedAndRecordsImported):
3879
3880         * workers/service/server/SWOriginStore.h:
3881
3882         * workers/service/server/SWServer.cpp:
3883         (WebCore::SWServer::registrationStoreImportComplete): Tell the origin store the initial
3884           import was completed.
3885         (WebCore::SWServer::addRegistrationFromStore):
3886         * workers/service/server/SWServer.h:
3887
3888 2017-12-08  Youenn Fablet  <youenn@apple.com>
3889
3890         Service Worker should use a correct user agent
3891         https://bugs.webkit.org/show_bug.cgi?id=180566
3892         <rdar://problem/35926295>
3893
3894         Reviewed by Chris Dumez.
3895
3896         Test: http/wpt/service-workers/useragent.https.html
3897
3898         Make ServiceWorkerFrameLoaderClient return a valid UserAgent.
3899         Pass user agent to ServiceWorkerThread so that navigation.userAgent is correctly initialized.
3900         Allow ServiceWorkerFrameLoaderClient to clean itself when no longer needed.
3901
3902         * loader/EmptyFrameLoaderClient.h:
3903         * workers/service/context/ServiceWorkerThread.cpp:
3904         (WebCore::ServiceWorkerThread::ServiceWorkerThread):
3905         * workers/service/context/ServiceWorkerThread.h:
3906         * workers/service/context/ServiceWorkerThreadProxy.cpp:
3907         (WebCore::ServiceWorkerThreadProxy::ServiceWorkerThreadProxy):
3908         (WebCore::ServiceWorkerThreadProxy::frameLoaderClient):
3909         * workers/service/context/ServiceWorkerThreadProxy.h:
3910
3911 2017-12-07  Simon Fraser  <simon.fraser@apple.com>
3912
3913         Wrong caret position for input field inside a fixed position parent on iOS 11
3914         https://bugs.webkit.org/show_bug.cgi?id=176896
3915         rdar://problem/33726145
3916
3917         Reviewed by Tim Horton.
3918
3919         In r219668 I added code to compute a layout viewport rect in the web process, so that
3920         after programmatic scrolling, getBoundingClientRect() would return the correct values.
3921         However, that computation sometimes used a different visual viewport than the UI process,
3922         resulting in a different layout viewport being set. This would happen when the keyboard
3923         was visible, and the combination of this and zooming when focusing an input would result
3924         in a state where the scrolling tree contained notes computed with the bad layout viewport.
3925         This could cause apparently offset fixed elements, and bad caret positioning if those fixed
3926         elements contained the focused input.
3927
3928         Fix by passing to the web process the same visual viewport rect that the UI process is using,
3929         namely "unobscuredContentRectRespectingInputViewBounds". This was already being set in
3930         VisibleContentRectUpdateInfo but wasn't encoded/decoded, so fix that. Set it as an optional<>
3931         on FrameView when different from the normal visual viewport, and return it from
3932         visualViewportRect().
3933
3934         Some other minor logging changes.
3935
3936         Test: fast/visual-viewport/ios/caret-after-focus-in-fixed.html
3937
3938         * page/FrameView.cpp:
3939         (WebCore::FrameView::setVisualViewportOverrideRect):
3940         (WebCore::FrameView::updateLayoutViewport):
3941         (WebCore::FrameView::visualViewportRect const):
3942         * page/FrameView.h:
3943         * page/scrolling/mac/ScrollingTreeFixedNode.mm:
3944         (WebCore::ScrollingTreeFixedNode::updateLayersAfterAncestorChange):
3945
3946 2017-12-08  Zalan Bujtas  <zalan@apple.com>
3947
3948         Make inline box objects IsoHeap allocated.
3949         https://bugs.webkit.org/show_bug.cgi?id=180556
3950         <rdar://problem/35923629>
3951
3952         Reviewed by Filip Pizlo.
3953
3954         * rendering/EllipsisBox.cpp:
3955         * rendering/EllipsisBox.h:
3956         * rendering/InlineBox.cpp:
3957         * rendering/InlineBox.h:
3958         * rendering/InlineElementBox.cpp:
3959         * rendering/InlineElementBox.h:
3960         * rendering/InlineFlowBox.cpp:
3961         * rendering/InlineFlowBox.h:
3962         * rendering/InlineTextBox.cpp:
3963         * rendering/InlineTextBox.h:
3964         * rendering/RootInlineBox.cpp:
3965         * rendering/RootInlineBox.h:
3966         * rendering/TrailingFloatsRootInlineBox.h:
3967         * rendering/svg/SVGInlineFlowBox.cpp:
3968         * rendering/svg/SVGInlineFlowBox.h:
3969         * rendering/svg/SVGInlineTextBox.cpp:
3970         * rendering/svg/SVGInlineTextBox.h:
3971         * rendering/svg/SVGRootInlineBox.cpp:
3972         * rendering/svg/SVGRootInlineBox.h:
3973
3974 2017-12-08  Chris Dumez  <cdumez@apple.com>
3975
3976         Clearing all Website Data should remove service worker registrations on disk
3977         https://bugs.webkit.org/show_bug.cgi?id=180558
3978
3979         Reviewed by Youenn Fablet.
3980
3981         Clear service worker registrations on disk in addition to the ones in memory.
3982
3983         * workers/service/server/RegistrationDatabase.cpp:
3984         (WebCore::v1RecordsTableSchema):
3985         (WebCore::v1RecordsTableSchemaAlternate):
3986         (WebCore::databaseFilename):
3987         Make sure these always get called from the background thread since they use
3988         a static string.
3989
3990         (WebCore::RegistrationDatabase::RegistrationDatabase):
3991         Call importRecordsIfNecessary() instead of openSQLiteDatabase(). importRecordsIfNecessary()
3992         only calls openSQLiteDatabase() if the database file exists, to avoid creating a database
3993         file unnecessarily.
3994
3995         (WebCore::RegistrationDatabase::databasePath const):
3996         New method which returns the database file path.
3997
3998         (WebCore::RegistrationDatabase::openSQLiteDatabase):
3999
4000         (WebCore::RegistrationDatabase::importRecordsIfNecessary):
4001         New methods which imports records if the database file exist. It the database file does