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