b52f2f0b8b16e5a50a5ca49bac4dbda933cb7cf3
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2018-01-12  Commit Queue  <commit-queue@webkit.org>
2
3         Unreviewed, rolling out r226721.
4         https://bugs.webkit.org/show_bug.cgi?id=181583
5
6         Lets do a slightly different fix (Requested by anttik on
7         #webkit).
8
9         Reverted changeset:
10
11         "REGRESSION(r225650): The scores of MotionMark tests Multiply
12         and Leaves dropped by 8%"
13         https://bugs.webkit.org/show_bug.cgi?id=181460
14         https://trac.webkit.org/changeset/226721
15
16 2018-01-11  Keith Miller  <keith_miller@apple.com>
17
18         Rename ENABLE_ASYNC_ITERATION to ENABLE_JS_ASYNC_ITERATION
19         https://bugs.webkit.org/show_bug.cgi?id=181573
20
21         Reviewed by Simon Fraser.
22
23         * Configurations/FeatureDefines.xcconfig:
24
25 2018-01-11  Jiewen Tan  <jiewen_tan@apple.com>
26
27         [WebAuthN] Import a CBOR coder from Chromium
28         https://bugs.webkit.org/show_bug.cgi?id=181522
29         <rdar://problem/36055729>
30
31         Reviewed by Brent Fulgham.
32
33         This patch imports a CBOR coder including encoder and decoder from Chromium. CBOR encoder
34         is needed for WebAuthN to encode attestation object into binaries. When supporting extensions
35         in the future, CBOR encoder/decoder will be needed as well. Implementating and maintaining
36         a fully-fledged CBOR coder doesn't seem to align with WebKit's best interests. Therefore,
37         importing a most suitable third party implementation will be wise.
38
39         In this patch, it fully integrate the whole coder into our codebase. Those changes includes:
40             1. Substitute data structures that enjoy a better WTF version.
41             2. Replacing marcos.
42             3. Implementating workarounds for some functionalities that we lack fundamental types' support.
43             4. Changing the coding style to match ours.
44
45         This patch doesn't intend to improve the logic of the original codebase. Hence some of the
46         coding logic might not match what WebKit ususally has.
47
48         Here is a full list of Chromium changes that constructed this CBOR coder in chronological order:
49         6efcf495521d18d060027762f48bb292d6979136,
50         9eb43fd347890b4c6cf54c4bd7ec1bbb88e381e1,
51         31c85e74fd567772f18e0a41be468d04af721f21,
52         68672fdcad280a8ff69b91927d38d0eabf2c87f2,
53         0ca8667c0584fb21c0748ebd7468d32889759a07,
54         df763d790d7e45d70116bdefacbfd4f9faa8995e,
55         6d30c4a621c65314db63eb56e87c19ab75627b26,
56         50fe92953f4739f17a62303fedbf8db9234317c8,
57         47be22c3603424d1832d046a348ff3f982500288,
58         98a59e46948b2c71608926004fac8192b0ff2208,
59         07540c6d850ed6e0fa508d63c20a8ce96d751de6,
60         06ae32d640c8e4b86ea8914a80ee419ea16e56d8.
61
62         Covered by API tests.
63
64         * Modules/webauthn/cbor/CBORBinary.h: Added.
65         * Modules/webauthn/cbor/CBORReader.cpp: Added.
66         (cbor::CBORReader::CBORReader):
67         (cbor::CBORReader::~CBORReader):
68         (cbor::CBORReader::read):
69         (cbor::CBORReader::decodeCBOR):
70         (cbor::CBORReader::readVariadicLengthInteger):
71         (cbor::CBORReader::decodeValueToNegative):
72         (cbor::CBORReader::decodeValueToUnsigned):
73         (cbor::CBORReader::readSimpleValue):
74         (cbor::CBORReader::readString):
75         Workarounds applied.
76         (cbor::CBORReader::readBytes):
77         (cbor::CBORReader::readCBORArray):
78         (cbor::CBORReader::readCBORMap):
79         (cbor::CBORReader::canConsume):
80         (cbor::CBORReader::checkMinimalEncoding):
81         (cbor::CBORReader::checkExtraneousData):
82         (cbor::CBORReader::checkDuplicateKey):
83         (cbor::CBORReader::hasValidUTF8Format):
84         Workarounds applied.
85         (cbor::CBORReader::checkOutOfOrderKey):
86         (cbor::CBORReader::getErrorCode):
87         (cbor::CBORReader::errorCodeToString):
88         * Modules/webauthn/cbor/CBORReader.h: Added.
89         * Modules/webauthn/cbor/CBORValue.cpp: Added.
90         (cbor::CBORValue::CBORValue):
91         (cbor::CBORValue::operator=):
92         (cbor::CBORValue::~CBORValue):
93         (cbor::CBORValue::clone const):
94         (cbor::CBORValue::getInteger const):
95         (cbor::CBORValue::getUnsigned const):
96         (cbor::CBORValue::getNegative const):
97         (cbor::CBORValue::getString const):
98         (cbor::CBORValue::getByteString const):
99         (cbor::CBORValue::getArray const):
100         (cbor::CBORValue::getMap const):
101         (cbor::CBORValue::getSimpleValue const):
102         (cbor::CBORValue::internalMoveConstructFrom):
103         (cbor::CBORValue::internalCleanup):
104         * Modules/webauthn/cbor/CBORValue.h: Added.
105         * Modules/webauthn/cbor/CBORWriter.cpp: Added.
106         (cbor::CBORWriter::~CBORWriter):
107         (cbor::CBORWriter::write):
108         (cbor::CBORWriter::CBORWriter):
109         (cbor::CBORWriter::encodeCBOR):
110         Workarounds applied.
111         (cbor::CBORWriter::startItem):
112         (cbor::CBORWriter::setAdditionalInformation):
113         (cbor::CBORWriter::setUint):
114         (cbor::CBORWriter::getNumUintBytes):
115         * Modules/webauthn/cbor/CBORWriter.h: Added.
116         * Sources.txt:
117         * WebCore.xcodeproj/project.pbxproj:
118
119 2018-01-11  Chris Dumez  <cdumez@apple.com>
120
121         Setting Window.opener to null should disown its opener
122         https://bugs.webkit.org/show_bug.cgi?id=181505
123         <rdar://problem/36443151>
124
125         Reviewed by Ryosuke Niwa.
126
127         Setting Window.opener to null should disown its opener as per:
128         - https://html.spec.whatwg.org/#dom-opener
129
130         With this change, tabs opened by clicking link inside Gmail no
131         longer have the Gmail window as opener.
132
133         Tests: fast/dom/Window/window-opener-set-to-null.html
134                fast/dom/Window/window-opener-shadowing.html
135
136         * bindings/js/JSDOMWindowCustom.cpp:
137         (WebCore::JSDOMWindow::setOpener):
138         * page/DOMWindow.cpp:
139         (WebCore::DOMWindow::disownOpener):
140         * page/DOMWindow.h:
141         * page/DOMWindow.idl:
142
143 2018-01-11  Myles C. Maxfield  <mmaxfield@apple.com>
144
145         [Cocoa] Star character disappears when bolded
146         https://bugs.webkit.org/show_bug.cgi?id=181568
147         <rdar://problem/18755569>
148
149         Reviewed by Simon Fraser.
150
151         We had some code in ComplexTextController to ask the FontCache for a font, given the name
152         of a particular font CoreText used inside a CTRun. This is wrong for two reasons: fonts
153         are not identifiable by PostScript name (in the general case), and because the lookup
154         procedure requires a FontDescription, the result may yield a font that is not the one
155         looked up. The goal of this code was simply to preserve the rendering mode of the font,
156         but we removed support for these rendering modes years ago. So the solution is to skip
157         that lookup and use the CoreText font directly.
158
159         Test: fast/text/unknown-font.html
160
161         * platform/graphics/mac/ComplexTextControllerCoreText.mm:
162         (WebCore::ComplexTextController::collectComplexTextRunsForCharacters):
163
164 2018-01-11  Keith Rollin  <krollin@apple.com>
165
166         Add optional logging of ITP-related user interaction information
167         https://bugs.webkit.org/show_bug.cgi?id=181556
168
169         Reviewed by Brent Fulgham.
170
171         In order to support the tracking of the efficacy of Intelligent
172         Tracking Protection, add some logging indicating when the user
173         interacts with a page in a way that affects cookie partitioning. This
174         logging is off by default, and is enabled with `defaults write -g
175         WebKitLogCookieInformation -bool true`.
176
177         No new tests -- no changed functionality.
178
179         * loader/ResourceLoadObserver.cpp:
180         (WebCore::ResourceLoadObserver::logUserInteractionWithReducedTimeResolution):
181         * loader/ResourceLoadObserver.h:
182         (WebCore::ResourceLoadObserver::shouldLogUserInteraction const):
183         (WebCore::ResourceLoadObserver::setShouldLogUserInteraction):
184
185 2018-01-11  James Craig  <jcraig@apple.com>
186
187         AX: when invert colors is on, double-invert video elements in UserAgentStyleSheet
188         https://bugs.webkit.org/show_bug.cgi?id=168447
189         <rdar://problem/30559874>
190
191         Reviewed by Simon Fraser.
192
193         Double-invert video when platform "invert colors" setting is enabled. Behavior matches 
194         current "Smart Invert" feature of Safari Reader on macOS/iOS and other iOS native apps.
195
196         Tests: accessibility/smart-invert-reference.html
197                accessibility/smart-invert.html
198
199         * Modules/modern-media-controls/controls/media-controls.css:
200         (@media (inverted-colors)):
201         (:host):
202         (picture):
203         * css/html.css:
204         (@media (inverted-colors)):
205         (video):
206
207 2018-01-11  Wenson Hsieh  <wenson_hsieh@apple.com>
208
209         Don't load inline data when requesting info for an attachment element backed by a file path
210         https://bugs.webkit.org/show_bug.cgi?id=181550
211
212         Reviewed by Tim Horton.
213
214         When requesting data for an attachment element that is backed by a file path, we currently trigger a load in the
215         web process to fetch contents of the attachment data as inline data in the AttachmentInfo. This is unnecessary,
216         since the file path of the attachment element must have come from the UI process anyways, so it is sufficient to
217         simply send the file path to the UI process and have the UI process read the contents of the path as a memory-
218         mapped NSData.
219
220         This patch lets HTMLAttachmentElement skip over resource loading codepaths when creating an AttachmentInfo for
221         the client, and also teaches _WKAttachment to read a AttachmentInfo's filepath as memory-mapped data if a file
222         path is present, and no inline data was specified.
223
224         Covered by existing API tests.
225
226         * html/HTMLAttachmentElement.cpp:
227         (WebCore::HTMLAttachmentElement::requestInfo):
228
229 2018-01-10  Ryosuke Niwa  <rniwa@webkit.org>
230
231         Make elements of zero width or height focusable
232         https://bugs.webkit.org/show_bug.cgi?id=181516
233
234         Reviewed by Chris Dumez.
235
236         Don't check render box's size or bounding rect when deciding whether an element is focusable.
237         New behavior matches that of Firefox and Chrome.
238
239         Test: fast/events/focus-zero-size-element.html
240
241         * dom/Element.cpp:
242         (WebCore::Element::isFocusable): Only update the style.
243         * html/HTMLFormControlElement.cpp:
244         (WebCore::HTMLFormControlElement::isFocusable const): Deleted.
245         * html/HTMLFormControlElement.h:
246         * mathml/MathMLElement.cpp:
247         (WebCore::MathMLElement::isFocusable const): Deleted. As far as I can tell, no math ml element is focusable.
248         * mathml/MathMLElement.h:
249         * svg/SVGAElement.cpp:
250         (WebCore::SVGAElement::isFocusable const): Deleted.
251         * svg/SVGAElement.h:
252
253 2018-01-11  Filip Pizlo  <fpizlo@apple.com>
254
255         Rename MarkedAllocator to BlockDirectory and AllocatorAttributes to CellAttributes
256         https://bugs.webkit.org/show_bug.cgi?id=181543
257
258         Rubber stamped by Michael Saboff.
259
260         No new tests because I'm just renaming things.
261
262         * ForwardingHeaders/heap/BlockDirectoryInlines.h: Copied from Source/WebCore/ForwardingHeaders/heap/MarkedAllocatorInlines.h.
263         * ForwardingHeaders/heap/MarkedAllocatorInlines.h: Removed.
264         * bindings/js/DOMGCOutputConstraint.cpp:
265
266 2018-01-11  Alex Christensen  <achristensen@webkit.org>
267
268         REGRESSION(r225003): Loading hangs in environments where dispatch_async does not work
269         https://bugs.webkit.org/show_bug.cgi?id=181553
270         <rdar://problem/35733938>
271
272         Reviewed by Eric Carlson.
273
274         There is an environment where dispatch_async does not work, but performSelectorOnMainThread works.
275         r225003 broke loading in this environment.  This fixes it and updates the test that r225003 fixed.
276         It failed sometimes because loading was happening in a different order than html parsing, so I made
277         the test not depend on html parsing timing by updating media/video-src-remove.html.
278
279         * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm:
280         (-[WebCoreResourceHandleAsOperationQueueDelegate callFunctionOnMainThread:]):
281
282 2018-01-11  Dean Jackson  <dino@apple.com>
283
284         Rolling out 226814. It crashes on some bots.
285
286 2018-01-11  Dean Jackson  <dino@apple.com>
287
288         [WebGL] Simulated vertexAttrib0 can sometimes cause OUT_OF_MEMORY errors
289         https://bugs.webkit.org/show_bug.cgi?id=181558
290         <rdar://problem/36189833>
291
292         Reviewed by Eric Carlson.
293
294         Very large element indices in the ELEMENT_ARRAY_BUFFER meant that
295         our simulated vertexAttrib0 buffer might be too large. We need
296         to check for out-of-memory, but we can also detect some of the issues
297         earlier in our validation code. Additionally, make sure that we don't
298         accidentally cast an unsigned to a signed.
299
300         Test: fast/canvas/webgl/simulated-vertexAttrib0-invalid-indicies.html
301
302         * html/canvas/WebGL2RenderingContext.cpp:
303         (WebCore::WebGL2RenderingContext::validateIndexArrayConservative): Update validation
304         code to look for overflow, rather than relying on looking for sign changes.
305         * html/canvas/WebGLRenderingContext.cpp:
306         (WebCore::WebGLRenderingContext::validateIndexArrayConservative): Ditto.
307         * html/canvas/WebGLRenderingContextBase.cpp:
308         (WebCore::WebGLRenderingContextBase::validateIndexArrayPrecise):
309         (WebCore::WebGLRenderingContextBase::drawArrays): Check that we were able to simulate.
310         (WebCore::WebGLRenderingContextBase::drawElements):
311         (WebCore::WebGLRenderingContextBase::validateSimulatedVertexAttrib0): Update validation code, and
312         use GC3Duint, since that's what the indicies are.
313         (WebCore::WebGLRenderingContextBase::simulateVertexAttrib0): Ditto.
314         (WebCore::WebGLRenderingContextBase::drawArraysInstanced): Check that we were able to simulate.
315         (WebCore::WebGLRenderingContextBase::drawElementsInstanced):
316         * html/canvas/WebGLRenderingContextBase.h:
317
318 2018-01-11  Chris Dumez  <cdumez@apple.com>
319
320         ASSERTION FAILED: registration in WebCore::SWServerWorker::skipWaiting()
321         https://bugs.webkit.org/show_bug.cgi?id=181222
322         <rdar://problem/36332686>
323
324         Reviewed by Youenn Fablet.
325
326         Replace assertion in SWServerWorker::skipWaiting() that assumes the worker
327         has a registration. Nowadays, a SWServerWorker can stay alive for a short
328         period without having a registration, while it is terminating.
329
330         No new tests, unskipped existing test.
331
332         * workers/service/server/SWServerWorker.cpp:
333         (WebCore::SWServerWorker::skipWaiting):
334
335 2018-01-11  Antti Koivisto  <antti@apple.com>
336
337         Don't call RenderElement::setStyle when nothing changes
338         https://bugs.webkit.org/show_bug.cgi?id=181530
339
340         Reviewed by Zalan Bujtas.
341
342         * style/StyleChange.h:
343
344         Remove 'Force' value. This essentially meant 'compute style for all descendants and call setStyle unconditionally'.
345         Using this value lost information about whether anything actually changed in a particular style as it was automatically
346         inherited by all descendants. The 'compute all descendants' part of the behavior is what is actually needed.
347
348         Instead add separate DescendantsToResolve enum for communicating what else to compute.
349
350         * style/StyleTreeResolver.cpp:
351         (WebCore::Style::TreeResolver::Parent::Parent):
352         (WebCore::Style::computeDescendantsToResolve):
353
354             Figure out which descendants will need resolving based on how the current elements style changed.
355
356         (WebCore::Style::TreeResolver::resolveElement):
357         (WebCore::Style::TreeResolver::createAnimatedElementUpdate):
358         (WebCore::Style::TreeResolver::pushParent):
359         (WebCore::Style::shouldResolveElement):
360
361             Use DescendantsToResolve as input.
362
363         (WebCore::Style::TreeResolver::resolveComposedTree):
364         * style/StyleTreeResolver.h:
365         * style/StyleUpdate.h:
366         (WebCore::Style::ElementUpdates::ElementUpdates):
367
368             Add DescendantsToResolve.
369
370 2018-01-11  Wenson Hsieh  <wenson_hsieh@apple.com>
371
372         Send PromisedBlobInfo to the client through DragItem instead of DragClient::prepareToDragPromisedBlob
373         https://bugs.webkit.org/show_bug.cgi?id=181497
374
375         Reviewed by Tim Horton.
376
377         Refactor drag initiation with DOMFile-backed attachment elements. See WebKit ChangeLog for more information. No
378         change in behavior; promised blob dragging covered by WKAttachment API tests.
379
380         * loader/EmptyClients.cpp:
381         * page/DragClient.h:
382         (WebCore::DragClient::prepareToDragPromisedBlob): Deleted.
383         * page/DragController.cpp:
384         (WebCore::DragController::startDrag):
385         (WebCore::DragController::doImageDrag):
386         (WebCore::DragController::doSystemDrag):
387         (WebCore::DragController::promisedBlobInfo):
388         (WebCore::DragController::dragAttachmentElement): Deleted.
389         * page/DragController.h:
390         * platform/DragItem.h:
391         (WebCore::DragItem::encode const):
392         (WebCore::DragItem::decode):
393
394 2018-01-11  Youenn Fablet  <youenn@apple.com>
395
396         RTCController should disable ICE candidate filtering in case of getUserMedia based on the RTCPerrConnection origin
397         https://bugs.webkit.org/show_bug.cgi?id=180851
398
399         Reviewed by Eric Carlson.
400
401         Test: http/wpt/webrtc/third-party-frame-ice-candidate-filtering.html
402
403         RTCController now stores all the client origins (top+frame origins) of frames that got access to camera/microphone access.
404         For any such client origin, PeerConnection objects ICE candidate filtering is disabled.
405         ICE candidate filtering is reset whenever navigating/reloading the page.
406
407         * Modules/mediastream/RTCController.cpp:
408         (WebCore::RTCController::reset):
409         (WebCore::matchDocumentOrigin):
410         (WebCore::RTCController::shouldDisableICECandidateFiltering):
411         (WebCore::RTCController::add):
412         (WebCore::RTCController::disableICECandidateFilteringForAllOrigins):
413         (WebCore::RTCController::disableICECandidateFiltering):
414         (WebCore::RTCController::enableICECandidateFiltering):
415         * Modules/mediastream/RTCController.h:
416         * Modules/mediastream/RTCPeerConnection.cpp:
417         (WebCore::RTCPeerConnection::create):
418         * Modules/mediastream/UserMediaRequest.cpp:
419         (WebCore::UserMediaRequest::allow):
420         * page/Page.cpp:
421         (WebCore::Page::disableICECandidateFiltering):
422         * testing/Internals.cpp:
423         (WebCore::Internals::setICECandidateFiltering):
424
425 2018-01-11  Ali Juma  <ajuma@chromium.org>
426
427         window.visualViewport should behave as [SameObject]
428         https://bugs.webkit.org/show_bug.cgi?id=181548
429
430         Reviewed by Chris Dumez.
431
432         Add 'GenerateIsReachable' to VisualViewport so that window.visualViewport's
433         JS wrapper object doesn't get garbage collected too soon.
434
435         Test: fast/visual-viewport/visual-viewport-same-object.html
436
437         * page/VisualViewport.idl:
438
439 2018-01-11  Basuke Suzuki  <Basuke.Suzuki@sony.com>
440
441         [Curl] Extract multipart handling from ResourceHandle to CurlRequest.
442         https://bugs.webkit.org/show_bug.cgi?id=181506
443
444         Reviewed by Alex Christensen.
445
446         Rename old MultipartHandle class to CurlMultipartHandle and modernize it. Also move the responsibility 
447         of handling multi part from ResourceHandle to CurlRequest. This is required for upcoming NetworkLoadTask.
448
449         No new tests because no new behavior.
450
451         * platform/Curl.cmake:
452         * platform/network/curl/CurlMultipartHandle.cpp: Renamed from Source/WebCore/platform/network/curl/MultipartHandle.cpp.
453         (WebCore::CurlMultipartHandle::createIfNeeded):
454         (WebCore::CurlMultipartHandle::extractBoundary):
455         (WebCore::CurlMultipartHandle::extractBoundaryFromContentType):
456         (WebCore::CurlMultipartHandle::CurlMultipartHandle):
457         (WebCore::CurlMultipartHandle::didReceiveData):
458         (WebCore::CurlMultipartHandle::didComplete):
459         (WebCore::CurlMultipartHandle::processContent):
460         (WebCore::CurlMultipartHandle::checkForBoundary):
461         (WebCore::CurlMultipartHandle::matchedLength):
462         (WebCore::CurlMultipartHandle::parseHeadersIfPossible):
463         * platform/network/curl/CurlMultipartHandle.h: Renamed from Source/WebCore/platform/network/curl/MultipartHandle.h.
464         (WebCore::CurlMultipartHandle::~CurlMultipartHandle):
465         * platform/network/curl/CurlMultipartHandleClient.h: Added.
466         (WebCore::CurlMultipartHandleClient::~CurlMultipartHandleClient):
467         * platform/network/curl/CurlRequest.cpp:
468         (WebCore::CurlRequest::CurlRequest):
469         (WebCore::CurlRequest::didReceiveHeader):
470         (WebCore::CurlRequest::didReceiveData):
471         (WebCore::CurlRequest::didReceiveHeaderFromMultipart):
472         (WebCore::CurlRequest::didReceiveDataFromMultipart):
473         (WebCore::CurlRequest::didCompleteTransfer):
474         (WebCore::CurlRequest::finalizeTransfer):
475         (WebCore::CurlRequest::invokeDidReceiveResponseForFile):
476         (WebCore::CurlRequest::invokeDidReceiveResponse):
477         (WebCore::CurlRequest::completeDidReceiveResponse):
478         * platform/network/curl/CurlRequest.h:
479         (WebCore::CurlRequest::create):
480         * platform/network/curl/ResourceHandleCurlDelegate.cpp:
481         (WebCore::ResourceHandleCurlDelegate::createCurlRequest):
482         (WebCore::ResourceHandleCurlDelegate::curlDidReceiveResponse):
483         (WebCore::ResourceHandleCurlDelegate::curlDidReceiveBuffer):
484         (WebCore::ResourceHandleCurlDelegate::curlDidComplete):
485         * platform/network/curl/ResourceHandleCurlDelegate.h:
486
487 2018-01-11  Zalan Bujtas  <zalan@apple.com>
488
489         RenderTreeUpdater::current() returns null_ptr when mutation is done through Document::resolveStyle.
490         https://bugs.webkit.org/show_bug.cgi?id=181513
491         <rdar://problem/36367085>
492
493         Reviewed by Antti Koivisto.
494
495         This patch ensures that we use a valid RenderTreeBuilder even when
496         Document::resolveStyle (incorrectly) triggers tree mutation.
497         It can be reverted soon after the incorrect mutations are taken care of.
498
499         Test: fast/forms/button-set-text-crash.html
500
501         * rendering/RenderButton.cpp:
502         (WebCore::RenderButton::setText):
503         * rendering/RenderMenuList.cpp:
504         (RenderMenuList::setText):
505
506 2018-01-11  Antoine Quint  <graouts@apple.com>
507
508         Only listen to webkitplaybacktargetavailabilitychanged when media controls are visible to the user
509         https://bugs.webkit.org/show_bug.cgi?id=181547
510         <rdar://problem/35947650>
511
512         Reviewed by Eric Carlson.
513
514         Because listening to "webkitplaybacktargetavailabilitychanged" events incurs some higher power usage on iOS,
515         we only listen to such events when controls are visible to the user. In other words, the MediaControls need to
516         have both "visible" set to "true" and "faded" set to "false". To support this, we add a delegate method on
517         MediaControls such that it can tell the MediaController that the "visible" property changed. With this message,
518         MediaController can inform its MediaControllerSupport objects that user visibility of the controls changed, which
519         lets AirplaySupport disable itself when controls are no longer visible.
520
521         Test: media/modern-media-controls/airplay-support/airplay-support-disable-event-listeners-with-hidden-controls.html
522
523         * Modules/modern-media-controls/controls/media-controls.js:
524         (MediaControls.prototype.set visible):
525         * Modules/modern-media-controls/media/airplay-support.js:
526         (AirplaySupport.prototype.controlsUserVisibilityDidChange):
527         * Modules/modern-media-controls/media/media-controller-support.js:
528         (MediaControllerSupport.prototype.controlsUserVisibilityDidChange):
529         * Modules/modern-media-controls/media/media-controller.js:
530         (MediaController.prototype.mediaControlsVisibilityDidChange):
531         (MediaController.prototype.mediaControlsFadedStateDidChange):
532         (MediaController.prototype._controlsUserVisibilityDidChange):
533
534 2018-01-11  Antoine Quint  <graouts@apple.com>
535
536         [iOS] There should be no controls markup generated in fullscreen
537         https://bugs.webkit.org/show_bug.cgi?id=181540
538         <rdar://problem/35060379>
539
540         Reviewed by Eric Carlson.
541
542         We completely forgo the display of any content when fullscreen on iOS by setting the
543         "visible" flag to "false" on the MediaControls, which will prevent any DOM content from
544         being added.
545
546         * Modules/modern-media-controls/media/media-controller.js:
547         (MediaController.prototype.handleEvent):
548         (MediaController.prototype._updateiOSFullscreenProperties):
549         (MediaController):
550         (MediaController.prototype._updateSupportingObjectsEnabledState): Deleted.
551
552 2018-01-11  Alex Christensen  <achristensen@webkit.org>
553
554         Revert changes accidentally committed with r226789.
555         https://bugs.webkit.org/show_bug.cgi?id=181423
556
557         I had some local changes I did not mean to commit.
558
559         * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm:
560         (scheduledWithCustomRunLoopMode):
561         (-[WebCoreResourceHandleAsOperationQueueDelegate callFunctionOnMainThread:]):
562         (WebCore::if): Deleted.
563         (WebCore::>::fromCallable): Deleted.
564
565 2018-01-10  Simon Fraser  <simon.fraser@apple.com>
566
567         On macOS, getBoundingClientRect gives incorrect values when pinch-zoomed
568         https://bugs.webkit.org/show_bug.cgi?id=181511
569         rdar://problem/33741427
570
571         Reviewed by Zalan Bujtas.
572         
573         When reverting "client coordinates are relative to layout viewport" in r219829
574         I broke documentToClientOffset() on macOS by failing to take pinch zoom scale into
575         account (frameScaleFactor() is always 1 on iOs, so this bug doesn't manifest there).
576
577         Covered by existing tests.
578
579         * page/FrameView.cpp:
580         (WebCore::FrameView::documentToClientOffset const):
581
582 2018-01-11  Youenn Fablet  <youenn@apple.com>
583
584         Replace WebRTCLegacyAPIDisabled by WebRTCLegacyAPIEnabled and switch off WebRTC legacy flag by default
585         https://bugs.webkit.org/show_bug.cgi?id=181480
586
587         Reviewed by Eric Carlson.
588
589         No change of behavior.
590
591         * page/RuntimeEnabledFeatures.h: Set default value to false.
592
593 2018-01-11  Wenson Hsieh  <wenson_hsieh@apple.com>
594
595         [Attachment Support] Support moving attachment elements in editable areas using drag and drop
596         https://bugs.webkit.org/show_bug.cgi?id=181337
597         <rdar://problem/36324813>
598
599         Reviewed by Tim Horton.
600
601         Makes slight adjustments to attachment-specific drag and drop logic to ensure that moving attachments via drag
602         and drop behaves correctly. See per-change comments for more detail.
603
604         Tests:  WKAttachmentTests.DragInPlaceVideoAttachmentElement
605                 WKAttachmentTests.MoveAttachmentElementAsIconByDragging
606                 WKAttachmentTests.MoveInPlaceAttachmentElementByDragging
607
608         * editing/cocoa/EditorCocoa.mm:
609         (WebCore::Editor::getPasteboardTypesAndDataForAttachment):
610
611         Stop vending the private web archive pasteboard type for attachments, for now. This works around issues where an
612         attachment element that is dragged and dropped within the same page may lose its blob backing data if we try to
613         remove and insert it as a fragment from the archive. Providing a web archive would allow us to avoid destroying
614         and recreating an attachment element when dragging within the same page, but this is a nice-to-have optimization
615         we can re-enable after investigation in a subsequent patch.
616
617         * html/HTMLAttachmentElement.cpp:
618         (WebCore::HTMLAttachmentElement::populateShadowRootIfNecessary):
619
620         Add `draggable=false` to the image element of an in-place attachment element.
621
622         * page/DragController.cpp:
623         (WebCore::enclosingAttachmentElement):
624         (WebCore::DragController::draggableElement const):
625
626         Tweak single-selected-attachment handling to account for in-place attachments. Since the hit-tested node is
627         inside the shadow subtree of the attachment element, the condition needs to check for the startElement as well
628         as the startElement's shadow host.
629
630         (WebCore::DragController::startDrag):
631
632         Make two tweaks here. First, don't require a RenderAttachment to drag an attachment element (this is required
633         for dragging in-place attachments). This was added in r217083 to address <rdar://problem/32282831>, but is no
634         longer correct, since attachments may now be displayed in-place.
635
636         Secondly, only restore the previous selection if the attachment is in a richly contenteditable area. This was
637         added to prevent the selection highlight from appearing in when dragging non-editable attachment elements in the
638         Mail viewer. However, to allow drag moves to occur, we need the selection to persist after drag start.
639
640 2018-01-04  Filip Pizlo  <fpizlo@apple.com>
641
642         CodeBlocks should be in IsoSubspaces
643         https://bugs.webkit.org/show_bug.cgi?id=180884
644
645         Reviewed by Saam Barati.
646
647         No new tests because no new behavior.
648         
649         Adopting new parallel constraint API, so that more of the logic of doing parallel
650         constraint solving is shared between the DOM's output constraints and JSC's output
651         constraints.
652
653         * bindings/js/DOMGCOutputConstraint.cpp:
654         (WebCore::DOMGCOutputConstraint::executeImpl):
655         (WebCore::DOMGCOutputConstraint::doParallelWorkImpl): Deleted.
656         (WebCore::DOMGCOutputConstraint::finishParallelWorkImpl): Deleted.
657         * bindings/js/DOMGCOutputConstraint.h:
658
659 2018-01-11  Wenson Hsieh  <wenson_hsieh@apple.com>
660
661         [Attachment Support] Support dragging attachment elements out as files on iOS
662         https://bugs.webkit.org/show_bug.cgi?id=181199
663         <rdar://problem/36299316>
664
665         Reviewed by Tim Horton, Andy Estes and Joseph Pecoraro.
666
667         Adds support for dragging "files" (i.e. creating item providers with preferred attachment presentation styles)
668         from attachment elements on iOS for Mail. See below for more detail.
669
670         Tests:  WKAttachmentTestsIOS.DragAttachmentInsertedAsData
671                 WKAttachmentTestsIOS.DragAttachmentInsertedAsFile
672
673         * page/DragController.cpp:
674         (WebCore::DragController::platformContentTypeForBlobType const):
675         (WebCore::DragController::dragAttachmentElement):
676         * page/DragController.h:
677         * page/mac/DragControllerMac.mm:
678         (WebCore::DragController::platformContentTypeForBlobType const):
679
680         Add a private method to convert the type of a promised blob to a platform type. For Cocoa platforms, this
681         converts the blob type (either a UTI or a MIME type) to a UTI for the platform to consume.
682
683         * platform/ios/WebItemProviderPasteboard.h:
684         * platform/ios/WebItemProviderPasteboard.mm:
685
686         Refactor WebItemProviderRegistrationInfo. WebItemProviderRegistrationInfo currently encapsulates a single item
687         provider registration call, and contains either a type identifier and data buffer, or an NSItemProviderWriting-
688         conformant object. To register an item provider using a WebItemProviderRegistrationInfo, the item provider
689         pasteboard currently checks to see whether the info contains an object or a type and data.
690
691         This patch removes WebItemProviderRegistrationInfo and replaces it with WebItemProviderDataRegistrar. Objects
692         that implement this protocol know how to take an NSItemProvider and register data to it. So far, there are
693         three implementations below.
694
695         (-[WebItemProviderDataRegistrar initWithData:type:]):
696         (-[WebItemProviderDataRegistrar typeIdentifier]):
697         (-[WebItemProviderDataRegistrar data]):
698         (-[WebItemProviderDataRegistrar typeIdentifierForClient]):
699         (-[WebItemProviderDataRegistrar dataForClient]):
700         (-[WebItemProviderDataRegistrar registerItemProvider:]):
701         (-[WebItemProviderDataRegistrar description]):
702
703         A data registrar takes a UTI and data buffer, and registers the UTI to the data. This replaces a
704         WebItemProviderRegistrationInfo with both a type and data, but no representing object.
705
706         (-[WebItemProviderWritableObjectRegistrar initWithObject:]):
707         (-[WebItemProviderWritableObjectRegistrar representingObjectForClient]):
708         (-[WebItemProviderWritableObjectRegistrar registerItemProvider:]):
709         (-[WebItemProviderWritableObjectRegistrar description]):
710
711         The writable object registrar writes an NSItemProviderWriting-conformant object to an item provider. This
712         replaces a WebItemProviderRegistrationInfo with only a representing object.
713
714         (-[WebItemProviderPromisedFileRegistrar initWithType:callback:]):
715         (-[WebItemProviderPromisedFileRegistrar registerItemProvider:]):
716         (-[WebItemProviderPromisedFileRegistrar description]):
717         (-[WebItemProviderRegistrationInfoList addData:forType:]):
718         (-[WebItemProviderRegistrationInfoList addRepresentingObject:]):
719         (-[WebItemProviderRegistrationInfoList addPromisedType:fileCallback:]):
720
721         Helper methods to add new registrars to a registration info list.
722
723         (-[WebItemProviderRegistrationInfoList itemAtIndex:]):
724         (-[WebItemProviderRegistrationInfoList enumerateItems:]):
725         (-[WebItemProviderRegistrationInfoList itemProvider]):
726         (-[WebItemProviderRegistrationInfoList description]):
727         (-[WebItemProviderRegistrationInfo initWithRepresentingObject:typeIdentifier:data:]): Deleted.
728         (-[WebItemProviderRegistrationInfo representingObject]): Deleted.
729         (-[WebItemProviderRegistrationInfo typeIdentifier]): Deleted.
730
731 2018-01-11  Michael Saboff  <msaboff@apple.com>
732
733         Add a DOM gadget for Spectre testing
734         https://bugs.webkit.org/show_bug.cgi?id=181351
735
736         Reviewed by Ryosuke Niwa.
737
738         This change is used to test Spectre mitigations.
739
740         Added a new DOM class to test for Spectre issues in the DOM layer.
741         This additional functionality is disabled by default and must be enabled
742         through the JSC option "enableSpectreGadgets".
743
744         * CMakeLists.txt:
745         * DerivedSources.make:
746         * Sources.txt:
747         * WebCore.xcodeproj/project.pbxproj:
748         * bindings/js/WebCoreBuiltinNames.h:
749         * dom/SpectreGadget.cpp: Added.
750         (WebCore::SpectreGadget::SpectreGadget):
751         (WebCore::SpectreGadget::create):
752         (WebCore::SpectreGadget::setReadLength):
753         (WebCore::SpectreGadget::charCodeAt):
754         (WebCore::SpectreGadget::clflushReadLength):
755         * dom/SpectreGadget.h: Added.
756         * dom/SpectreGadget.idl: Added.
757         * page/RuntimeEnabledFeatures.cpp:
758         (WebCore::RuntimeEnabledFeatures::spectreGadgetsEnabled const):
759         * page/RuntimeEnabledFeatures.h:
760
761 2018-01-11  Philippe Normand  <pnormand@igalia.com>
762
763         [GTK] media/muted-video-is-playing-audio.html is timing out
764         https://bugs.webkit.org/show_bug.cgi?id=163781
765
766         Reviewed by Carlos Garcia Campos.
767
768         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
769         (WebCore::MediaPlayerPrivateGStreamer::notifyPlayerOfVideo): Sprinkle some debugging.
770         (WebCore::MediaPlayerPrivateGStreamer::notifyPlayerOfAudio): Ditto.
771         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
772         (WebCore::MediaPlayerPrivateGStreamerBase::setMuted): Ditto.
773
774 2018-01-10  Andy Estes  <aestes@apple.com>
775
776         [Payment Request] Rename ApplePayMerchantValidationEvent to MerchantValidationEvent
777         https://bugs.webkit.org/show_bug.cgi?id=181437
778         <rdar://problem/36376481>
779
780         Reviewed by Tim Horton.
781         
782         Renamed ApplePayMerchantValidationEvent to MerchantValidationEvent and changed complete() to accept a Promise.
783
784         Test: http/tests/paymentrequest/payment-request-merchant-validation.https.html
785
786         * DerivedSources.make:
787         * Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp:
788         (WebCore::ApplePayPaymentHandler::merchantValidationCompleted):
789         (WebCore::ApplePayPaymentHandler::validateMerchant):
790         * Modules/applepay/paymentrequest/ApplePayPaymentHandler.h:
791         * Modules/paymentrequest/MerchantValidationEvent.cpp: Renamed from Source/WebCore/Modules/applepay/paymentrequest/ApplePayMerchantValidationEvent.cpp.
792         (WebCore::MerchantValidationEvent::create):
793         (WebCore::MerchantValidationEvent::MerchantValidationEvent):
794         (WebCore::MerchantValidationEvent::eventInterface const):
795         (WebCore::MerchantValidationEvent::complete):
796         * Modules/paymentrequest/MerchantValidationEvent.h: Renamed from Source/WebCore/Modules/applepay/paymentrequest/ApplePayMerchantValidationEvent.h.
797         * Modules/paymentrequest/MerchantValidationEvent.idl: Renamed from Source/WebCore/Modules/applepay/paymentrequest/ApplePayMerchantValidationEvent.idl.
798         * Modules/paymentrequest/PaymentHandler.h:
799         * Modules/paymentrequest/PaymentRequest.cpp:
800         (WebCore::PaymentRequest::completeMerchantValidation):
801         * Modules/paymentrequest/PaymentRequest.h:
802         * Modules/paymentrequest/PaymentRequest.idl:
803         * WebCore.xcodeproj/project.pbxproj:
804         * dom/EventNames.h:
805         * dom/EventNames.in:
806
807 2018-01-10  Basuke Suzuki  <Basuke.Suzuki@sony.com>
808
809         [Curl] Cross-protocol, cross-site scripting (XPXSS) using HTML forms
810         Nhttps://bugs.webkit.org/show_bug.cgi?id=153088
811
812         Reviewed by Alex Christensen.
813
814         No new tests because it's covered by existing tests.
815
816         * platform/network/curl/CurlContext.cpp:
817         (WebCore::CurlHandle::getHttpVersion):
818         * platform/network/curl/CurlContext.h:
819         * platform/network/curl/CurlRequest.cpp:
820         (WebCore::CurlRequest::didReceiveHeader):
821         * platform/network/curl/CurlResponse.h:
822         (WebCore::CurlResponse::isolatedCopy const):
823         * platform/network/curl/ResourceResponseCurl.cpp:
824         (WebCore::ResourceResponse::ResourceResponse):
825         (WebCore::ResourceResponse::setStatusLine):
826
827 2018-01-10  Wenson Hsieh  <wenson_hsieh@apple.com>
828
829         REGRESSION(r222507): Composition highlight doesn't render when using IME
830         https://bugs.webkit.org/show_bug.cgi?id=181485
831         <rdar://problem/35896516>
832
833         Reviewed by Ryosuke Niwa.
834
835         Fixes the order of arguments passed to paintTextSubrangeBackground from paintCompositionBackground.
836
837         Test: editing/marked-text-appearance.html
838
839         * rendering/InlineTextBox.cpp:
840         (WebCore::InlineTextBox::paintCompositionBackground):
841
842 2018-01-10  Youenn Fablet  <youenn@apple.com>
843
844         Use no-cache fetch mode when loading main documents with location.reload()
845         https://bugs.webkit.org/show_bug.cgi?id=181285
846
847         Reviewed by Alex Christensen.
848
849         Covered by rebased tests.
850
851         Start to translate cache policy used for navigation as FetchOptions::Cache.
852         This allows ensuring service workers receive the right cache mode when intercepting navigation loads.
853         To not change current navigation behavior, ReturnCacheDataElseLoad and ReturnCacheDataDontLoad still trigger default fetch cache mode.
854
855         For Reload and ReloadExpiredOnly frame load types, using no-cache mode is more efficient than reload mode,
856         as a conditional request will be sent if possible. This applies to location.reload which is consistent with other browsers.
857         Keep reload mode for ReloadFromOrigin.
858
859         * loader/DocumentLoader.cpp:
860         (WebCore::toFetchOptionsCache):
861         (WebCore::DocumentLoader::loadMainResource):
862         * loader/FrameLoader.cpp:
863         (WebCore::FrameLoader::loadFrameRequest):
864         (WebCore::FrameLoader::loadURL):
865         (WebCore::FrameLoader::load):
866         (WebCore::FrameLoader::reload):
867         (WebCore::FrameLoader::defaultRequestCachingPolicy):
868         (WebCore::FrameLoader::loadDifferentDocumentItem):
869         * loader/NavigationScheduler.cpp:
870
871 2018-01-10  Commit Queue  <commit-queue@webkit.org>
872
873         Unreviewed, rolling out r226667 and r226673.
874         https://bugs.webkit.org/show_bug.cgi?id=181488
875
876         This caused a flaky crash. (Requested by mlewis13 on #webkit).
877
878         Reverted changesets:
879
880         "CodeBlocks should be in IsoSubspaces"
881         https://bugs.webkit.org/show_bug.cgi?id=180884
882         https://trac.webkit.org/changeset/226667
883
884         "REGRESSION (r226667): CodeBlocks should be in IsoSubspaces"
885         https://bugs.webkit.org/show_bug.cgi?id=180884
886         https://trac.webkit.org/changeset/226673
887
888 2018-01-10  Antti Koivisto  <antti@apple.com>
889
890         REGRESSION(r225650): The scores of MotionMark tests Multiply and Leaves dropped by 8%
891         https://bugs.webkit.org/show_bug.cgi?id=181460
892         <rdar://problem/36379776>
893
894         Reviewed by Ryosuke Niwa.
895
896         * css/parser/CSSParser.cpp:
897         (WebCore::CSSParserContext::CSSParserContext):
898
899         Don't do the expensive security origin test if the sheet base URL and document URL are identical.
900         This is true for inline style and inline stylesheets.
901
902 2018-01-10  Antti Koivisto  <antti@apple.com>
903
904         Try to fix windows build.
905
906         * css/RuleFeature.cpp:
907         (WebCore::RuleFeatureSet::computeNextMatchElement):
908
909 2018-01-10  Zalan Bujtas  <zalan@apple.com>
910
911         [RenderTreeBuilder] Move RenderRuby's moveChildren logic to RenderTreeBuilder
912         https://bugs.webkit.org/show_bug.cgi?id=181470
913         <rdar://problem/36397683>
914
915         Reviewed by Antti Koivisto.
916
917         This is about moving code, no cleanup and/or normalization (unfortunately it also means
918         some temporary changes).  
919
920         No change in functionality.
921
922         * rendering/RenderBlockFlow.h:
923         * rendering/RenderRubyBase.cpp:
924         (WebCore::RenderRubyBase::moveChildren): Deleted.
925         (WebCore::RenderRubyBase::mergeChildrenWithBase): Deleted.
926         (WebCore::RenderRubyBase::moveInlineChildren): Deleted.
927         (WebCore::RenderRubyBase::moveBlockChildren): Deleted.
928         * rendering/RenderRubyBase.h:
929         * rendering/RenderRubyRun.cpp:
930         (WebCore::RenderRubyRun::takeChild):
931         * rendering/updating/RenderTreeBuilder.cpp:
932         (WebCore::RenderTreeBuilder::moveRubyChildren):
933         * rendering/updating/RenderTreeBuilder.h:
934         * rendering/updating/RenderTreeBuilderRuby.cpp:
935         (WebCore::RenderTreeBuilder::Ruby::moveInlineChildren):
936         (WebCore::RenderTreeBuilder::Ruby::moveBlockChildren):
937         (WebCore::RenderTreeBuilder::Ruby::moveChildren):
938         (WebCore::RenderTreeBuilder::Ruby::moveChildrenInternal):
939         (WebCore::RenderTreeBuilder::Ruby::insertChild):
940         * rendering/updating/RenderTreeBuilderRuby.h:
941
942 2018-01-10  Philippe Normand  <pnormand@igalia.com>
943
944         [GStreamer] fix critical GObject warning
945
946         Rubber-stamped by Carlos Garcia Campos.
947
948         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
949         (WebCore::MediaPlayerPrivateGStreamer::handleMessage): No need to
950         resort to complicated things to get the element name...
951
952 2018-01-10  Philippe Normand  <pnormand@igalia.com>
953
954         [GStreamer] REGRESSION(r226629): broke media/video-interruption-with-resume-allowing-play.html
955         https://bugs.webkit.org/show_bug.cgi?id=181471
956         <rdar://problem/36402323>
957
958         Reviewed by Carlos Garcia Campos.
959
960         This patch mainly reduces the amount of playback state changes
961         emitted by the GStreamer player to its client. Emitting those
962         notifications too often has bad side effects.
963
964         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
965         (WebCore::MediaPlayerPrivateGStreamer::paused const): Add debug messages.
966         (WebCore::MediaPlayerPrivateGStreamer::handleMessage): This debug message appears too much. Demote.
967         (WebCore::MediaPlayerPrivateGStreamer::maxTimeLoaded const): Ditto.
968         (WebCore::MediaPlayerPrivateGStreamer::didLoadingProgress const): Ditto.
969         (WebCore::MediaPlayerPrivateGStreamer::updateStates): Try to emit
970         playback state change notification only when going to PLAYING.
971         (WebCore::MediaPlayerPrivateGStreamer::loadingFailed): Add warning message.
972
973 2018-01-10  Youenn Fablet  <youenn@apple.com>
974
975         Add Service Worker CSP persistency
976         https://bugs.webkit.org/show_bug.cgi?id=181434
977
978         Reviewed by Alex Christensen.
979
980         Covered by manual testing.
981         Future work on service worker test infrastructure should allow automating such tests.
982
983         Add support for service worker CSP data persistency.
984         Add a version parameter to increment each time the schema is changing.
985         This allows the same store to be used by multiple WebKits.
986
987         * workers/service/server/RegistrationDatabase.cpp:
988         (WebCore::v1RecordsTableSchema):
989         (WebCore::RegistrationDatabase::openSQLiteDatabase):
990         (WebCore::RegistrationDatabase::doPushChanges):
991         (WebCore::RegistrationDatabase::importRecords):
992
993 2018-01-10  Antti Koivisto  <antti@apple.com>
994
995         Invalidate current element style on class change accurately
996         https://bugs.webkit.org/show_bug.cgi?id=181210
997
998         Reviewed by Zalan Bujtas.
999
1000         * css/DocumentRuleSets.cpp:
1001         (WebCore::DocumentRuleSets::collectFeatures const):
1002         (WebCore::DocumentRuleSets::subjectClassRules const):
1003
1004             New rule set containing class rules affecting the subject element.
1005
1006         (WebCore::DocumentRuleSets::ancestorClassRules const):
1007         * css/DocumentRuleSets.h:
1008         * css/RuleFeature.cpp:
1009         (WebCore::RuleFeatureSet::recursivelyCollectFeaturesFromSelector):
1010
1011             Classify selector components into various buckets based on the elements they match relative to
1012             the subject element. There are more categories than this patch strictly needs, for future use.
1013
1014         (WebCore::RuleFeatureSet::collectFeatures):
1015         (WebCore::RuleFeatureSet::add):
1016         (WebCore::RuleFeatureSet::clear):
1017         (WebCore::RuleFeatureSet::shrinkToFit):
1018         * css/RuleFeature.h:
1019         * css/StyleResolver.h:
1020         (WebCore::StyleResolver::hasSelectorForClass const): Deleted.
1021         * style/ClassChangeInvalidation.cpp:
1022         (WebCore::Style::elementNeedsInvalidation):
1023         (WebCore::Style::ClassChangeInvalidation::computeInvalidation):
1024
1025             Don't invalidate current element unconditionally on class change. Instead find the subject rulesets
1026             that might affect it use them to perform invalidation.
1027
1028         (WebCore::Style::ClassChangeInvalidation::invalidateStyleWithRuleSets):
1029         (WebCore::Style::ClassChangeInvalidation::invalidateStyle): Deleted.
1030         (WebCore::Style::ClassChangeInvalidation::invalidateDescendantStyle): Deleted.
1031         * style/ClassChangeInvalidation.h:
1032         (WebCore::Style::ClassChangeInvalidation::ClassChangeInvalidation):
1033         (WebCore::Style::ClassChangeInvalidation::~ClassChangeInvalidation):
1034         * style/StyleSharingResolver.cpp:
1035         (WebCore::Style::SharingResolver::classNamesAffectedByRules const):
1036
1037 2018-01-09  Antoine Quint  <graouts@apple.com>
1038
1039         [Web Animations] Expose the id property on Animation
1040         https://bugs.webkit.org/show_bug.cgi?id=181450
1041         <rdar://problem/36383600>
1042
1043         Reviewed by Dean Jackson.
1044
1045         Expose the "id" property on Animation and handle the "id" property on the optional KeyframeAnimationOptions object
1046         passed to Element.animate(). All of the WPT tests related to this property are now passing.
1047
1048         * animation/WebAnimation.h:
1049         * animation/WebAnimation.idl:
1050         * dom/Element.cpp:
1051         (WebCore::Element::animate):
1052
1053 2018-01-09  Chris Dumez  <cdumez@apple.com>
1054
1055         Make service workers behave correctly with regards to Page Cache
1056         https://bugs.webkit.org/show_bug.cgi?id=181446
1057         <rdar://problem/36164291>
1058
1059         Reviewed by Youenn Fablet.
1060
1061         Make service workers behave correctly with regards to Page Cache:
1062         1. If a document has an active service worker, do not let it go into PageCache
1063         2. When a document goes into page cache, unregister it from the list of service worker clients
1064         3. When a document is restored from page cache, add it nack to the list of service worker clients
1065
1066         Tests: http/tests/workers/service/client-added-to-clients-when-restored-from-page-cache.html
1067                http/tests/workers/service/client-removed-from-clients-while-in-page-cache.html
1068                http/tests/workers/service/no-page-cache-when-controlled.html
1069                http/tests/workers/service/other_resources/test.html
1070
1071         * dom/Document.cpp:
1072         (WebCore::Document::suspend):
1073         (WebCore::Document::resume):
1074         * history/PageCache.cpp:
1075         (WebCore::canCacheFrame):
1076         * page/DiagnosticLoggingKeys.cpp:
1077         (WebCore::DiagnosticLoggingKeys::serviceWorkerKey):
1078         * page/DiagnosticLoggingKeys.h:
1079
1080 2018-01-09  Chris Dumez  <cdumez@apple.com>
1081
1082         We should not return undefined for most properties of a detached Window
1083         https://bugs.webkit.org/show_bug.cgi?id=181416
1084         <rdar://problem/36162489>
1085
1086         Reviewed by Ryosuke Niwa.
1087
1088         We should not return undefined for most properties on a detached Window. WebKit previously only exposed "closed"
1089         and "close" properties on detached / frameless windows. However, this does not match the HTML specification [1]
1090         or the behavior of Firefox and Chrome.
1091
1092         Note that Chrome does not seem to fully follow the HTML specification either, it seems to treat detached windows
1093         the same way as cross-origin ones. As a result, it only exposed properties that are visible cross-origin when
1094         a window is detached / frameless.
1095
1096         [1] https://html.spec.whatwg.org/#windowproxy-get
1097
1098         No new tests, updated existingt tests.
1099
1100         * bindings/js/JSDOMWindowCustom.cpp:
1101         (WebCore::jsDOMWindowGetOwnPropertySlotRestrictedAccess):
1102         (WebCore::JSDOMWindow::getOwnPropertySlot):
1103         (WebCore::JSDOMWindow::getOwnPropertySlotByIndex):
1104
1105 2018-01-09  Darin Adler  <darin@apple.com>
1106
1107         Further refinement to list item and counter code after "list-item" counter fix
1108         https://bugs.webkit.org/show_bug.cgi?id=181426
1109
1110         Reviewed by Zalan Bujtas.
1111
1112         * css/StyleBuilderCustom.h:
1113         (WebCore::StyleBuilderCustom::applyInheritCounter): Use auto.
1114         (WebCore::StyleBuilderCustom::applyValueCounter): Use auto, removed unneeded
1115         null checks for things that can never be null, moved the saturated addition
1116         here and got rid of the addIncrementValue function from CounterDirectives.
1117         Use the saturatedAddition function from SaturatedArithmetic.h instead of the
1118         much less efficient one that did the same thing, CounterDirectives::addClamped.
1119
1120         * rendering/RenderCounter.cpp:
1121         (WebCore::listItemCounterDirectives): Use aggregate syntax for the return
1122         statements.
1123         (WebCore::planCounter): Changed to use a struct return value instead of two
1124         out arguments. Use the saturatedAddition function from SaturatedArithmetic.h
1125         instead of the much less efficient one that did the same thing,
1126         CounterDirectives::addClamped.
1127         (WebCore::findPlaceForCounter): Changed to use a struct return value instead
1128         of two out arguments.
1129         (WebCore::makeCounterNode): Updated for the above changes. Changed code to
1130         use add instead of both get and set. Updated to keep the counter maps inside
1131         the values of the "map of maps" instead of using a unique_ptr and allocating
1132         each one on the heap.
1133         (WebCore::destroyCounterNodeWithoutMapRemoval): Changed argument to a reference
1134         instead of a pointer. Updated for changes to the map. Use RefPtr more
1135         consistently.
1136         (WebCore::RenderCounter::destroyCounterNodes): Use iterators less.
1137         (WebCore::RenderCounter::destroyCounterNode): Ditto.
1138         (WebCore::RenderCounter::rendererRemovedFromTree): Add a check of
1139         hasCounterNodeMap here before calling destroyCounterNodes, so that function
1140         can assume the flag is true (both other callers already check it).
1141         (WebCore::updateCounters): Use auto and update for changes above.
1142         (WebCore::RenderCounter::rendererStyleChanged): Use modern for loops instead
1143         of iterators.
1144         (showCounterRendererTree): Use auto and udpate for changes above.
1145
1146         * rendering/RenderListItem.cpp:
1147         (WebCore::enclosingList): Stop referring to elements as "nodes". Changed
1148         the local variable names for clarity.
1149         (WebCore::nextListItemHelper): Renamed from nextListItem since it's not
1150         intended to be called directly and we want to use a function pointer to
1151         nextListItem. Fixed the algorithm to correctly handle ad hoc "lists" that
1152         are not actually HTML list elements, using the definition in the enclosingList
1153         function as the previousListItem function already did.
1154         (WebCore::nextListItem): Updated for name changes.
1155         (WebCore::firstListItem): Renamed from nextListItem for clarity.
1156         (WebCore::previousListItem): Rewrote loop so it doesn't have to do things
1157         so strangely when we find another list.
1158         (WebCore::RenderListItem::updateItemValuesForOrderedList): Use auto and
1159         update local variable names.
1160         (WebCore::RenderListItem::itemCountForOrderedList): Ditto.
1161         (WebCore::RenderListItem::updateValueNow const): Rewrote to use an iterative
1162         algorithm instead of a recursive one. Fixes the FIXME here.
1163         (WebCore::RenderListItem::updateValue): Use m_valueWasSetExplicitly
1164         instead of m_explicitValue.
1165         (WebCore::RenderListItem::explicitValueChanged): Use auto and simplified
1166         the loop a bit.
1167         (WebCore::RenderListItem::setExplicitValue): Set m_valueWasSetExplicitly
1168         instead of m_explicitValue.
1169         (WebCore::previousOrNextItem): Deleted.
1170         (WebCore::RenderListItem::updateListMarkerNumbers): Streamlined the loop
1171         a bit and used a fucntion pointer to handle the two different directions.
1172         (WebCore::RenderListItem::isInReversedOrderedList const): Simplified by
1173         getting rid of an unneeded use of pointers and local variables.
1174
1175         * rendering/RenderListItem.h: Use a boolean, m_valueWasSetExplicitly,
1176         instead of a separate optional m_explicitValue.
1177
1178         * rendering/style/CounterDirectives.h: Since all the code in this file was
1179         rewritten, removed old copyrights. Deleted the addIncrementValue function,
1180         since it is clear enough in the one call site in the style builder.
1181         Deleted the addClamped function because it was just a much slower
1182         version of the saturatedAddition function. Made == and != into constexpr
1183         functions since they are simple enough to be.
1184
1185         * rendering/style/RenderStyle.cpp:
1186         (WebCore::RenderStyle::getCounterDirectives const): Deleted. Caller can
1187         handle this just fine without a helper function.
1188         * rendering/style/RenderStyle.h: Ditto.
1189
1190 2018-01-09  Myles C. Maxfield  <mmaxfield@apple.com>
1191
1192         font-display:fallback can cause a visual flash (which is supposed to be impossible)
1193         https://bugs.webkit.org/show_bug.cgi?id=181374
1194
1195         Reviewed by Simon Fraser.
1196
1197         A FontCascade represents an entire font-family fallback list, but sometimes we need to pull out a single
1198         representative font from the list to calculate things like line height. Previously, if the first item in
1199         the font-family list was in the middle of being downloaded, this representative font was hardcoded to be
1200         Times. However, when actually laying out and drawing the glyphs, we have logic to skip the interstitial
1201         Times if there are any installed fonts present in the font-family list (so you wouldn't ever actually
1202         see Times). This means that line height (among other things) was being calculated as if Times was used,
1203         but in reality, some other font from the font-family list was being used.
1204
1205         Alone, this isn't a huge problem, but font-display:fallback makes a font transition between "timed out"
1206         and "failed," and when the font hits the failed state, the representative font skips over the cancelled
1207         item and hits the next item in the fallback list. This means that line heights will change, which causes
1208         a visual flash, even when font-display:fallback is specified.
1209
1210         The solution is simply to educate the logic which identifies this representative font so that it
1211         understands what to do for currently-loading fonts.
1212
1213         Tests: fast/text/font-display/swap-flash.html
1214
1215         * platform/graphics/FontCascadeFonts.h:
1216         (WebCore::FontCascadeFonts::primaryFont):
1217         * rendering/line/BreakingContext.h:
1218         (WebCore::textWidth):
1219
1220 2018-01-04  Filip Pizlo  <fpizlo@apple.com>
1221
1222         CodeBlocks should be in IsoSubspaces
1223         https://bugs.webkit.org/show_bug.cgi?id=180884
1224
1225         Reviewed by Saam Barati.
1226
1227         No new tests because no new behavior.
1228         
1229         Adopting new parallel constraint API, so that more of the logic of doing parallel
1230         constraint solving is shared between the DOM's output constraints and JSC's output
1231         constraints.
1232
1233         * bindings/js/DOMGCOutputConstraint.cpp:
1234         (WebCore::DOMGCOutputConstraint::executeImpl):
1235         (WebCore::DOMGCOutputConstraint::doParallelWorkImpl): Deleted.
1236         (WebCore::DOMGCOutputConstraint::finishParallelWorkImpl): Deleted.
1237         * bindings/js/DOMGCOutputConstraint.h:
1238
1239 2018-01-08  Simon Fraser  <simon.fraser@apple.com>
1240
1241         Clean up Marquee-related enums
1242         https://bugs.webkit.org/show_bug.cgi?id=181347
1243
1244         Reviewed by Anders Carlsson.
1245
1246         Modernize EMarqueeBehavior and EMarqueeDirection enums. Stop using the weird negative
1247         values in the MarqueeDirection and do manual reverse direction mapping.
1248
1249         Make some member functions of RenderMarquee private.
1250
1251         Stop using bitfields in RenderMarquee because the memory saving is not worth it, and doing so
1252         allows us to use modern initialization.
1253
1254         No behavior change.
1255
1256         * css/CSSPrimitiveValueMappings.h:
1257         (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
1258         (WebCore::CSSPrimitiveValue::operator MarqueeBehavior const):
1259         (WebCore::CSSPrimitiveValue::operator MarqueeDirection const):
1260         (WebCore::CSSPrimitiveValue::operator EMarqueeBehavior const): Deleted.
1261         (WebCore::CSSPrimitiveValue::operator EMarqueeDirection const): Deleted.
1262         * css/StyleResolver.cpp:
1263         (WebCore::StyleResolver::adjustRenderStyle):
1264         * rendering/RenderBox.cpp:
1265         (WebCore::RenderBox::sizesLogicalWidthToFitContent const):
1266         * rendering/RenderLayer.cpp:
1267         (WebCore::RenderLayer::calculateClipRects const):
1268         * rendering/RenderMarquee.cpp:
1269         (WebCore::RenderMarquee::RenderMarquee):
1270         (WebCore::reverseDirection):
1271         (WebCore::RenderMarquee::direction const):
1272         (WebCore::RenderMarquee::isHorizontal const):
1273         (WebCore::RenderMarquee::computePosition):
1274         (WebCore::RenderMarquee::start):
1275         (WebCore::RenderMarquee::updateMarqueePosition):
1276         (WebCore::RenderMarquee::updateMarqueeStyle):
1277         (WebCore::RenderMarquee::timerFired):
1278         * rendering/RenderMarquee.h:
1279         * rendering/style/RenderStyle.h:
1280         (WebCore::RenderStyle::marqueeBehavior const):
1281         (WebCore::RenderStyle::marqueeDirection const):
1282         (WebCore::RenderStyle::setMarqueeDirection):
1283         (WebCore::RenderStyle::setMarqueeBehavior):
1284         (WebCore::RenderStyle::initialMarqueeBehavior):
1285         (WebCore::RenderStyle::initialMarqueeDirection):
1286         * rendering/style/RenderStyleConstants.h:
1287         * rendering/style/StyleMarqueeData.cpp:
1288         (WebCore::StyleMarqueeData::StyleMarqueeData):
1289         * rendering/style/StyleMarqueeData.h:
1290
1291 2018-01-09  Jer Noble  <jer.noble@apple.com>
1292
1293         Many CVDisplayLink threads created and destroyed while watching a YouTube video
1294         https://bugs.webkit.org/show_bug.cgi?id=181396
1295
1296         Reviewed by Simon Fraser.
1297
1298         When watching some YouTube videos (or any video with default controls), event handlers for
1299         the "timeupdate" event which use rAF will cause the underlying platform objects to be
1300         destroyed in between "timeupdate" events being fired, since they occur every 250ms, and rAF
1301         objects are destroyed every 166ms (or 10/60hz). Update this constant to destroy the
1302         underlying objects every 333ms (or 20/60hz) so that this common pattern doesn't lead to
1303         excessive rAF platform object turnover.
1304
1305         * platform/Logging.h:
1306         * platform/graphics/DisplayRefreshMonitor.h:
1307         (WebCore::DisplayRefreshMonitor::shouldBeTerminated const):
1308         * platform/graphics/DisplayRefreshMonitor.cpp:
1309         (WebCore::DisplayRefreshMonitor::displayDidRefresh):
1310         * platform/graphics/DisplayRefreshMonitorManager.cpp:
1311         (WebCore::DisplayRefreshMonitorManager::createMonitorForClient):
1312         (WebCore::DisplayRefreshMonitorManager::displayDidRefresh):
1313
1314 2018-01-09  Zalan Bujtas  <zalan@apple.com>
1315
1316         [RenderTreeBuilder] Move RenderElement addChild mutation logic to RenderTreeBuilder
1317         https://bugs.webkit.org/show_bug.cgi?id=181451
1318         <rdar://problem/36385562>
1319
1320         Reviewed by Antti Koivisto.
1321
1322         This is about moving code, no cleanup and/or normalization (unfortunately it also means
1323         some temporary changes).  
1324
1325         No change in functionality.
1326
1327         * rendering/RenderElement.cpp:
1328         (WebCore::RenderElement::addChild):
1329         (WebCore::RenderElement::childRequiresTable const): Deleted.
1330         * rendering/RenderElement.h:
1331         * rendering/updating/RenderTreeBuilder.cpp:
1332         (WebCore::RenderTreeBuilder::insertChildToRenderElement):
1333         (WebCore::RenderTreeBuilder::childRequiresTable):
1334         * rendering/updating/RenderTreeBuilder.h:
1335         * rendering/updating/RenderTreeBuilderInline.cpp:
1336         (WebCore::RenderTreeBuilder::Inline::insertChildToContinuation):
1337         (WebCore::RenderTreeBuilder::Inline::insertChildIgnoringContinuation):
1338         (WebCore::RenderTreeBuilder::Inline::newChildIsInline):
1339         (WebCore::newChildIsInline): Deleted.
1340         * rendering/updating/RenderTreeBuilderInline.h:
1341
1342 2018-01-09  Matt Lewis  <jlewis3@apple.com>
1343
1344         Unreviewed, rolling out r226531.
1345
1346         This caused test failures on macOS WK2.
1347
1348         Reverted changeset:
1349
1350         "Use no-cache fetch mode when loading main documents with
1351         location.reload()"
1352         https://bugs.webkit.org/show_bug.cgi?id=181285
1353         https://trac.webkit.org/changeset/226531
1354
1355 2018-01-09  Michael Saboff  <msaboff@apple.com>
1356
1357         Unreviewed, rolling out r226600 and r226603
1358         https://bugs.webkit.org/show_bug.cgi?id=181351
1359
1360         Add a DOM gadget for Spectre testing
1361
1362         * dom/Comment.cpp:
1363         (WebCore::Comment::Comment):
1364         (WebCore::Comment::setReadLength): Deleted.
1365         (WebCore::Comment::charCodeAt): Deleted.
1366         (WebCore::Comment::clflushReadLength): Deleted.
1367         * dom/Comment.h:
1368         * dom/Comment.idl:
1369         * page/RuntimeEnabledFeatures.cpp:
1370         (WebCore::RuntimeEnabledFeatures::spectreGadgetsEnabled const): Deleted.
1371         * page/RuntimeEnabledFeatures.h:
1372
1373 2018-01-09  Don Olmstead  <don.olmstead@sony.com>
1374
1375         Add additional WEBCORE_EXPORTs
1376         https://bugs.webkit.org/show_bug.cgi?id=181414
1377
1378         Reviewed by Alex Christensen.
1379
1380         No new tests. No change in behavior.
1381
1382         * dom/Document.h:
1383         * dom/ViewportArguments.h:
1384         * page/DOMWindow.h:
1385         * page/FrameView.h:
1386         * page/PageOverlayController.h:
1387         * platform/ContextMenuItem.h:
1388         * platform/Pasteboard.h:
1389         * platform/SharedBuffer.h:
1390         * platform/UserAgent.h:
1391         * platform/graphics/GLContext.h:
1392         * platform/graphics/GraphicsContext.h:
1393         * platform/graphics/GraphicsLayerTransform.h:
1394         * platform/graphics/PlatformDisplay.h:
1395         * platform/graphics/cairo/BackingStoreBackendCairoImpl.h:
1396         * platform/graphics/cairo/PlatformContextCairo.h:
1397         * platform/graphics/cairo/RefPtrCairo.h:
1398         * platform/graphics/nicosia/NicosiaBuffer.h:
1399         * platform/graphics/nicosia/NicosiaPaintingEngine.h:
1400         * platform/graphics/texmap/TextureMapper.h:
1401         * platform/graphics/texmap/TextureMapperAnimation.h:
1402         * platform/graphics/texmap/TextureMapperBackingStore.h:
1403         * platform/graphics/texmap/TextureMapperFPSCounter.h:
1404         * platform/graphics/texmap/TextureMapperLayer.h:
1405         (WebCore::TextureMapperLayer::TextureMapperLayer): Deleted.
1406         (WebCore::TextureMapperLayer::setID): Deleted.
1407         (WebCore::TextureMapperLayer::id): Deleted.
1408         (WebCore::TextureMapperLayer:: const): Deleted.
1409         (WebCore::TextureMapperLayer::setScrollClient): Deleted.
1410         (WebCore::TextureMapperLayer::setIsScrollable): Deleted.
1411         (WebCore::TextureMapperLayer::isScrollable const): Deleted.
1412         (WebCore::TextureMapperLayer::textureMapper const): Deleted.
1413         (WebCore::TextureMapperLayer::setTextureMapper): Deleted.
1414         (WebCore::TextureMapperLayer::drawsContent const): Deleted.
1415         (WebCore::TextureMapperLayer::contentsAreVisible const): Deleted.
1416         (WebCore::TextureMapperLayer::size const): Deleted.
1417         (WebCore::TextureMapperLayer::opacity const): Deleted.
1418         (WebCore::TextureMapperLayer::transform const): Deleted.
1419         (WebCore::TextureMapperLayer::hasFilters const): Deleted.
1420         (WebCore::TextureMapperLayer::isShowingRepaintCounter const): Deleted.
1421         (WebCore::TextureMapperLayer::fixedToViewport const): Deleted.
1422         (WebCore::TextureMapperLayer::rootLayer const): Deleted.
1423         (WebCore::TextureMapperLayer::texture): Deleted.
1424         (WebCore::TextureMapperLayer::adjustedPosition const): Deleted.
1425         (WebCore::TextureMapperLayer::layerRect const): Deleted.
1426         (WebCore::TextureMapperLayer::State::State): Deleted.
1427         * platform/graphics/texmap/TextureMapperPlatformLayerProxy.h:
1428         * platform/graphics/texmap/TextureMapperTile.h:
1429         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h:
1430         (WebCore::CoordinatedGraphicsLayer::isScrollable const): Deleted.
1431         (WebCore::CoordinatedGraphicsLayer::id const): Deleted.
1432         (WebCore::CoordinatedGraphicsLayer::coverRect const): Deleted.
1433         (WebCore::CoordinatedGraphicsLayer::fixedToViewport const): Deleted.
1434         * platform/graphics/texmap/coordinated/CoordinatedImageBacking.h:
1435         (WebCore::CoordinatedImageBacking::id const): Deleted.
1436         * platform/graphics/texmap/coordinated/TiledBackingStore.h:
1437         * platform/graphics/texmap/coordinated/UpdateAtlas.h:
1438         * platform/network/AuthenticationChallengeBase.h:
1439         * platform/network/CredentialBase.h:
1440         * platform/network/ProtectionSpaceBase.h:
1441         * platform/network/curl/SocketStreamHandleImpl.h:
1442         * replay/UserInputBridge.h:
1443
1444 2018-01-09  Basuke Suzuki  <Basuke.Suzuki@sony.com>
1445
1446         [Curl] Move FormData related tasks into new CurlFormDataStream class.
1447         https://bugs.webkit.org/show_bug.cgi?id=181106
1448
1449         Reviewed by Alex Christensen.
1450
1451         No new tests because no behavior change.
1452
1453         * platform/Curl.cmake:
1454         * platform/network/curl/CurlFormDataStream.cpp: Added.
1455         (WebCore::CurlFormDataStream::CurlFormDataStream):
1456         (WebCore::CurlFormDataStream::~CurlFormDataStream):
1457         (WebCore::CurlFormDataStream::clean):
1458         (WebCore::CurlFormDataStream::shouldUseChunkTransfer):
1459         (WebCore::CurlFormDataStream::totalSize):
1460         (WebCore::CurlFormDataStream::computeContentLength):
1461         (WebCore::CurlFormDataStream::read):
1462         (WebCore::CurlFormDataStream::readFromFile):
1463         (WebCore::CurlFormDataStream::readFromData):
1464         * platform/network/curl/CurlFormDataStream.h: Renamed from Source/WebCore/platform/network/curl/FormDataStreamCurl.h.
1465         (WebCore::CurlFormDataStream::elementSize):
1466         (WebCore::CurlFormDataStream::totalReadSize):
1467         * platform/network/curl/CurlRequest.cpp:
1468         (WebCore::CurlRequest::CurlRequest):
1469         (WebCore::CurlRequest::willSendData):
1470         (WebCore::CurlRequest::finalizeTransfer):
1471         (WebCore::CurlRequest::setupPUT):
1472         (WebCore::CurlRequest::setupPOST):
1473         (WebCore::CurlRequest::setupSendData):
1474         (WebCore::CurlRequest::resolveBlobReferences): Deleted.
1475         (WebCore::CurlRequest::setupFormData): Deleted.
1476         * platform/network/curl/CurlRequest.h:
1477         * platform/network/curl/FormDataStreamCurl.cpp: Removed.
1478
1479 2018-01-09  Zalan Bujtas  <zalan@apple.com>
1480
1481         [RenderTreeBuilder] Move MathML addChild logic to RenderTreeBuilder
1482         https://bugs.webkit.org/show_bug.cgi?id=181443
1483         <rdar://problem/36380228>
1484
1485         Reviewed by Antti Koivisto.
1486
1487         This is about moving code, no cleanup and/or normalization (unfortunately it also means
1488         some temporary changes).  
1489
1490         No change in functionality.
1491
1492         * Sources.txt:
1493         * WebCore.xcodeproj/project.pbxproj:
1494         * rendering/mathml/RenderMathMLFenced.cpp:
1495         (WebCore::RenderMathMLFenced::addChild):
1496         (WebCore::RenderMathMLFenced::createMathMLOperator): Deleted.
1497         (WebCore::RenderMathMLFenced::makeFences): Deleted.
1498         * rendering/mathml/RenderMathMLFenced.h:
1499         * rendering/updating/RenderTreeBuilder.cpp:
1500         (WebCore::RenderTreeBuilder::RenderTreeBuilder):
1501         (WebCore::RenderTreeBuilder::insertChildToRenderMathMLFenced):
1502         * rendering/updating/RenderTreeBuilder.h:
1503         (WebCore::RenderTreeBuilder::mathMLBuilder):
1504
1505 2018-01-09  Antti Koivisto  <antti@apple.com>
1506
1507         Blank page except for inner iframes because pending stylesheets cause style.isNotFinal() to be true
1508         https://bugs.webkit.org/show_bug.cgi?id=180940
1509         <rdar://problem/36116507>
1510
1511         Reviewed by Darin Adler.
1512
1513         Test: http/tests/local/loading-stylesheet-import-remove.html
1514
1515         If a <link> referencing a stylesheet containing an @import that was still loading was removed
1516         from the document, the loading state was never cleared. For head stylesheets this blocked
1517         rendering permanently.
1518
1519         Test reduction by Justin Ridgewell.
1520
1521         * html/HTMLLinkElement.cpp:
1522         (WebCore::HTMLLinkElement::removedFromAncestor):
1523
1524         Test if the stylesheet it loading before clearing the pointer.
1525
1526 2018-01-09  Dan Bernstein  <mitz@apple.com>
1527
1528         Removed some empty directories that were left behind
1529
1530         * Modules/indieui: Removed.
1531         * Modules/vibration: Removed.
1532         * platform/graphics/ca/mac: Removed.
1533         * platform/mediastream/gstreamer: Removed.
1534
1535 2018-01-09  Antoine Quint  <graouts@apple.com>
1536
1537         Refactor timing function solving code
1538         https://bugs.webkit.org/show_bug.cgi?id=181428
1539
1540         Reviewed by Dean Jackson.
1541
1542         We have duplicated code to solve "cubic" and "steps" timing functions in AnimationBase and TextureMapperAnimation,
1543         and we will soon need similar code to deal with timing functions in Web Animations. We move this code into TimingFunction
1544         with a single transformTime() function that can be called directly on the timing function rather than having callers
1545         figure out what type timing functions are to solve them.
1546
1547         No test as there shouldn't be any behavior change.
1548
1549         * page/animation/AnimationBase.cpp:
1550         (WebCore::AnimationBase::progress const):
1551         (WebCore::solveEpsilon): Deleted.
1552         (WebCore::solveCubicBezierFunction): Deleted.
1553         (WebCore::solveStepsFunction): Deleted.
1554         (WebCore::solveSpringFunction): Deleted.
1555         * platform/animation/TimingFunction.cpp:
1556         (WebCore::TimingFunction::transformTime const):
1557         * platform/animation/TimingFunction.h:
1558         * platform/graphics/texmap/TextureMapperAnimation.cpp:
1559         (WebCore::TextureMapperAnimation::apply):
1560         (WebCore::solveEpsilon): Deleted.
1561         (WebCore::solveCubicBezierFunction): Deleted.
1562         (WebCore::solveStepsFunction): Deleted.
1563         (WebCore::applyTimingFunction): Deleted.
1564
1565 2018-01-09  Michael Catanzaro  <mcatanzaro@igalia.com>
1566
1567         Unreviewed, silence -Wunused-parameter warning
1568
1569         * testing/js/WebCoreTestSupport.cpp:
1570         (WebCoreTestSupport::setupNewlyCreatedServiceWorker):
1571
1572 2018-01-09  Said Abou-Hallawa  <sabouhallawa@apple.com>
1573
1574         Check Image::m_image is not null in ImageLoader::decode()
1575         https://bugs.webkit.org/show_bug.cgi?id=180386
1576         <rdar://problem/34634483>
1577
1578         Reviewed by Tim Horton.
1579
1580         Ensure ImageLoader::m_image is not null before referencing it.
1581
1582         * loader/ImageLoader.cpp:
1583         (WebCore::ImageLoader::decode):
1584
1585 2018-01-09  Yusuke Suzuki  <utatane.tea@gmail.com>
1586
1587         [FreeType] Use FastMalloc for FreeType
1588         https://bugs.webkit.org/show_bug.cgi?id=181387
1589
1590         Reviewed by Michael Catanzaro.
1591
1592         Add custom memory allocator for FreeType to use FastMalloc.
1593
1594         * platform/graphics/freetype/FontCustomPlatformDataFreeType.cpp:
1595         (WebCore::initializeFreeTypeLibrary):
1596         (WebCore::createFontCustomPlatformData):
1597
1598 2018-01-09  Zalan Bujtas  <zalan@apple.com>
1599
1600         [RenderTreeBuilder] Move RenderTable* addChild mutation logic to RenderTreeBuilder
1601         https://bugs.webkit.org/show_bug.cgi?id=181424
1602         <rdar://problem/36368628>
1603
1604         Reviewed by Antti Koivisto.
1605
1606         This is about moving code, no cleanup and/or normalization (unfortunately it also means
1607         some temporary changes).  
1608
1609         Covered by existing tests.
1610
1611         * rendering/RenderTable.cpp:
1612         (WebCore::RenderTable::addChild):
1613         * rendering/RenderTableRow.cpp:
1614         (WebCore::RenderTableRow::addChild):
1615         * rendering/RenderTableSection.cpp:
1616         (WebCore::RenderTableSection::addChild):
1617         * rendering/updating/RenderTreeBuilder.cpp:
1618         (WebCore::RenderTreeBuilder::insertChildToRenderTable):
1619         (WebCore::RenderTreeBuilder::insertChildToRenderTableSection):
1620         (WebCore::RenderTreeBuilder::insertChildToRenderTableRow):
1621         * rendering/updating/RenderTreeBuilder.h:
1622         * rendering/updating/RenderTreeBuilderTable.cpp:
1623         (WebCore::RenderTreeBuilder::Table::insertChild):
1624         * rendering/updating/RenderTreeBuilderTable.h:
1625
1626 2018-01-09  Zalan Bujtas  <zalan@apple.com>
1627
1628         [RenderTreeBuilder] Transition Render*::addChild() calls to RenderTreeBuilder::insertChildToRender*()
1629         https://bugs.webkit.org/show_bug.cgi?id=181407
1630         <rdar://problem/36361176>
1631
1632         Reviewed by Antti Koivisto.
1633
1634         Eventually all mutation will be going through the RenderTreeBuilder.
1635
1636         No change in functionality.
1637
1638         * rendering/RenderGrid.cpp:
1639         (WebCore::RenderGrid::addChild):
1640         * rendering/RenderMultiColumnFlow.cpp:
1641         (WebCore::RenderMultiColumnFlow::processPossibleSpannerDescendant):
1642         * rendering/RenderRubyRun.cpp:
1643         (WebCore::RenderRubyRun::rubyBaseSafe):
1644         * rendering/updating/RenderTreeBuilderBlockFlow.cpp:
1645         (WebCore::RenderTreeBuilder::BlockFlow::insertChild):
1646         * rendering/updating/RenderTreeBuilderMultiColumn.cpp:
1647         (WebCore::RenderTreeBuilder::MultiColumn::createFragmentedFlow):
1648         * rendering/updating/RenderTreeBuilderRuby.cpp:
1649         (WebCore::RenderTreeBuilder::Ruby::findOrCreateParentForChild):
1650
1651 2018-01-09  Philippe Normand  <pnormand@igalia.com>
1652
1653         [GStreamer] Ensure SleepDisabler is not held by pages in page cache
1654         https://bugs.webkit.org/show_bug.cgi?id=180197
1655
1656         Reviewed by Eric Carlson.
1657
1658         The sleep disabler is now checked again whenever the media player
1659         playback state or other characteristic has changed in the media
1660         engine.
1661
1662         * html/HTMLMediaElement.cpp:
1663         (WebCore::HTMLMediaElement::mediaPlayerPlaybackStateChanged):
1664         Check if the sleep disabler state needs to be updated or not.
1665         (WebCore::HTMLMediaElement::mediaPlayerCharacteristicChanged): Ditto.
1666         (WebCore::HTMLMediaElement::shouldDisableSleep const): Enable
1667         sleep disabler for GTK and WPE ports.
1668
1669 2018-01-09  Philippe Normand  <pnormand@igalia.com>
1670
1671         [GStreamer] Missing notifications to player client
1672         https://bugs.webkit.org/show_bug.cgi?id=181432
1673
1674         Reviewed by Carlos Garcia Campos.
1675
1676         We now properly emit playback state changes and characteristic
1677         updates to the client when the pipeline state changes and when
1678         audio/video tracks changes are detected.
1679
1680         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
1681         (WebCore::MediaPlayerPrivateGStreamer::playbackPosition const):
1682         This debug message appears too often in logs. Demote.
1683         (WebCore::MediaPlayerPrivateGStreamer::durationMediaTime const): Ditto.
1684         (WebCore::MediaPlayerPrivateGStreamer::notifyPlayerOfVideo): Emit
1685         charasteristicChanged notification.
1686         (WebCore::MediaPlayerPrivateGStreamer::notifyPlayerOfAudio): Ditto.
1687         (WebCore::MediaPlayerPrivateGStreamer::updateStates): Keep track
1688         of old and current pipeline state.
1689         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
1690
1691
1692 2018-01-09  Youenn Fablet  <youenn@apple.com>
1693
1694         Add CSP support to service workers
1695         https://bugs.webkit.org/show_bug.cgi?id=181385
1696
1697         Reviewed by Chris Dumez.
1698
1699         Covered by rebased tests.
1700
1701         Added recovery of CSP information from WorkerScriptLoader.
1702         Added plumbing to pass the CSP information to Service Workers.
1703         Did not add persistency support for the CSP information as this requires changing the SQL database schema.
1704         This will be done in a follow-up.
1705
1706         * workers/WorkerScriptLoader.cpp:
1707         (WebCore::WorkerScriptLoader::loadAsynchronously):
1708         (WebCore::WorkerScriptLoader::didReceiveResponse):
1709         * workers/WorkerScriptLoader.h:
1710         (WebCore::WorkerScriptLoader::contentSecurityPolicy const):
1711         * workers/service/SWClientConnection.cpp:
1712         (WebCore::SWClientConnection::finishedFetchingScript):
1713         (WebCore::SWClientConnection::failedFetchingScript):
1714         * workers/service/SWClientConnection.h:
1715         * workers/service/ServiceWorkerContainer.cpp:
1716         (WebCore::ServiceWorkerContainer::addRegistration):
1717         (WebCore::ServiceWorkerContainer::jobFailedWithException):
1718         (WebCore::ServiceWorkerContainer::jobResolvedWithRegistration):
1719         (WebCore::ServiceWorkerContainer::jobFinishedLoadingScript):
1720         * workers/service/ServiceWorkerContainer.h:
1721         * workers/service/ServiceWorkerContextData.cpp:
1722         (WebCore::ServiceWorkerContextData::isolatedCopy const):
1723         * workers/service/ServiceWorkerContextData.h:
1724         (WebCore::ServiceWorkerContextData::encode const):
1725         (WebCore::ServiceWorkerContextData::decode):
1726         * workers/service/ServiceWorkerFetchResult.h:
1727         (WebCore::ServiceWorkerFetchResult::encode const):
1728         (WebCore::ServiceWorkerFetchResult::decode):
1729         * workers/service/ServiceWorkerGlobalScope.cpp:
1730         (WebCore::ServiceWorkerGlobalScope::create):
1731         * workers/service/ServiceWorkerGlobalScope.h:
1732         * workers/service/ServiceWorkerJob.cpp:
1733         (WebCore::ServiceWorkerJob::notifyFinished):
1734         * workers/service/ServiceWorkerJobClient.h:
1735         * workers/service/context/ServiceWorkerThread.cpp:
1736         (WebCore::ServiceWorkerThread::ServiceWorkerThread):
1737         (WebCore::ServiceWorkerThread::createWorkerGlobalScope):
1738         * workers/service/server/RegistrationDatabase.cpp:
1739         (WebCore::v1RecordsTableSchema):
1740         (WebCore::RegistrationDatabase::importRecords):
1741         * workers/service/server/SWServer.cpp:
1742         (WebCore::SWServer::updateWorker):
1743         (WebCore::SWServer::installContextData):
1744         * workers/service/server/SWServer.h:
1745         * workers/service/server/SWServerJobQueue.cpp:
1746         (WebCore::SWServerJobQueue::scriptFetchFinished):
1747         * workers/service/server/SWServerWorker.cpp:
1748         (WebCore::SWServerWorker::SWServerWorker):
1749         (WebCore::m_contentSecurityPolicy):
1750         (WebCore::SWServerWorker::contextData const):
1751         * workers/service/server/SWServerWorker.h:
1752
1753 2018-01-09  Antoine Quint  <graouts@apple.com>
1754
1755         Provide a method to obtain a CSS value from a RenderStyle by CSSPropertyID
1756         https://bugs.webkit.org/show_bug.cgi?id=181429
1757
1758         Reviewed by Antti Koivisto.
1759
1760         The KeyframeEffect.getKeyframes() method from Web Animations requires that we return all styles applied at a given
1761         animation effect keyframe. When we parse keyframes, we create RenderStyle objects that are stored in a KeyframeList,
1762         as well as a list of CSSPropertyIDs that are animated. In order to provide the list of animated properties and their
1763         values when calling getKeyframes(), we need to be able to read back from the RenderStyle we create. As a first step
1764         towards this goal, we factor some code in ComputedStyleExtractor::propertyValue() out into a new method
1765         ComputedStyleExtractor::valueForPropertyinStyle() which takes in an explicit RenderStyle.
1766
1767         No test as this is simply refactoring that doesn't change or add behavior.
1768
1769         * css/CSSComputedStyleDeclaration.cpp:
1770         (WebCore::ComputedStyleExtractor::propertyValue):
1771         (WebCore::ComputedStyleExtractor::valueForPropertyinStyle):
1772         * css/CSSComputedStyleDeclaration.h:
1773
1774 2018-01-09  Youenn Fablet  <youenn@apple.com>
1775
1776         SWClientConnection should not keep references to service worker jobs
1777         https://bugs.webkit.org/show_bug.cgi?id=181381
1778
1779         Reviewed by Chris Dumez.
1780
1781         Difficult to test determiniscally but corresponding crash log should no longer happen in debug builds.
1782
1783         Stopped passing ServiceWorkerJob references from ServiceWorkerContainer (potentially in service worker thread) to SWClientConnection (main thread).
1784         Instead pass job identifiers and related data to the main thread.
1785
1786         Minor refactoring to use ServiceWorkerJobIdentifier instead of ServiceWorkerJobDataIdentifier which contains more data than needed.
1787
1788         * workers/service/SWClientConnection.cpp:
1789         (WebCore::SWClientConnection::scheduleJob):
1790         (WebCore::SWClientConnection::failedFetchingScript):
1791         (WebCore::SWClientConnection::postTaskForJob):
1792         (WebCore::SWClientConnection::jobRejectedInServer):
1793         (WebCore::SWClientConnection::registrationJobResolvedInServer):
1794         (WebCore::SWClientConnection::unregistrationJobResolvedInServer):
1795         (WebCore::SWClientConnection::startScriptFetchForServer):
1796         (WebCore::SWClientConnection::clearPendingJobs):
1797         (WebCore::SWClientConnection::finishedFetchingScript): Deleted.
1798         * workers/service/SWClientConnection.h:
1799         * workers/service/ServiceWorkerContainer.cpp:
1800         (WebCore::ServiceWorkerContainer::scheduleJob):
1801         (WebCore::ServiceWorkerContainer::startScriptFetchForJob):
1802         (WebCore::ServiceWorkerContainer::jobFinishedLoadingScript):
1803         (WebCore::ServiceWorkerContainer::jobFailedLoadingScript):
1804         * workers/service/ServiceWorkerContainer.h:
1805         * workers/service/server/SWServer.cpp:
1806         (WebCore::SWServer::rejectJob):
1807         (WebCore::SWServer::resolveRegistrationJob):
1808         (WebCore::SWServer::resolveUnregistrationJob):
1809         (WebCore::SWServer::startScriptFetch):
1810         * workers/service/server/SWServer.h:
1811
1812 2018-01-09  Carlos Garcia Campos  <cgarcia@igalia.com>
1813
1814         REGRESSION(r224460): Text fields sometimes get "messed up"
1815         https://bugs.webkit.org/show_bug.cgi?id=181115
1816
1817         Reviewed by Zalan Bujtas.
1818
1819         Add the scroll position to paint offset before computing the clip rectangle. Before r224460, scroll position was
1820         substracted after the clip rectangle was computed.
1821
1822         * rendering/LayoutState.cpp:
1823         (WebCore::LayoutState::computeClipRect):
1824
1825 2018-01-09  Ali Juma  <ajuma@chromium.org>
1826
1827         Implement VisualViewport API events
1828         https://bugs.webkit.org/show_bug.cgi?id=179386
1829
1830         Reviewed by Frédéric Wang.
1831
1832         Implement the events (resize and scroll) defined by the Visual Viewport API
1833         (https://wicg.github.io/visual-viewport/#events).
1834
1835         This is behind the VisualViewportAPI experimental feature flag.
1836
1837         In order to detect when events need to be fired, change the computation of
1838         Visual Viewport attributes to happen whenever the layout viewport is updated
1839         rather than only on-demand.
1840
1841         Tests: fast/visual-viewport/resize-event-fired-window-resized.html
1842                fast/visual-viewport/resize-event-fired.html
1843                fast/visual-viewport/scroll-event-fired.html
1844
1845         * dom/Document.cpp:
1846         (WebCore::Document::addListenerTypeIfNeeded):
1847         Add support for tracking resize event listeners.
1848         * dom/Document.h:
1849         * dom/DocumentEventQueue.cpp:
1850         (WebCore::DocumentEventQueue::enqueueOrDispatchScrollEvent):
1851         (WebCore::DocumentEventQueue::enqueueScrollEvent):
1852         Factored out of enqueueOrDispatchScrollEvent so that this logic can be reused
1853         for Visual Viewport scroll events.
1854         (WebCore::DocumentEventQueue::enqueueResizeEvent):
1855         (WebCore::DocumentEventQueue::pendingEventTimerFired):
1856         * dom/DocumentEventQueue.h:
1857         * page/FrameView.cpp:
1858         (WebCore::FrameView::updateLayoutViewport):
1859         * page/VisualViewport.cpp:
1860         (WebCore::VisualViewport::addEventListener):
1861         (WebCore::layoutIfNonNull):
1862         (WebCore::VisualViewport::offsetLeft const):
1863         Remove attribute computation logic since this now happens during update().
1864         (WebCore::VisualViewport::offsetTop const): Ditto.
1865         (WebCore::VisualViewport::pageLeft const): Ditto.
1866         (WebCore::VisualViewport::pageTop const): Ditto.
1867         (WebCore::VisualViewport::width const): Ditto.
1868         (WebCore::VisualViewport::height const): Ditto.
1869         (WebCore::VisualViewport::scale const):
1870         (WebCore::VisualViewport::update):
1871         Added. Computes all of the Visual Viewport attributes and determines
1872         whether events need to be fired.
1873         (WebCore::VisualViewport::enqueueResizeEvent):
1874         (WebCore::VisualViewport::enqueueScrollEvent):
1875         (WebCore::getFrameViewAndLayoutIfNonNull): Deleted.
1876         * page/VisualViewport.h:
1877
1878 2018-01-09  Yacine Bandou  <yacine.bandou_ext@softathome.com>
1879
1880         [EME] Add the CENC initData support in ClearKey CDM
1881         https://bugs.webkit.org/show_bug.cgi?id=180081
1882
1883         Reviewed by Xabier Rodriguez-Calvar.
1884
1885         Add the "cenc" initDataType support in ClearKey CDM.
1886         Parse the CENC initData and extract the KIDs by following the W3C spec
1887         https://www.w3.org/TR/eme-initdata-cenc/#common-system
1888
1889         Tests: media/encrypted-media/clearKey/clearKey-message-cenc-event.html
1890                media/encrypted-media/clearKey/clearKey-message-cenc-event-mse.html
1891
1892         * platform/encryptedmedia/clearkey/CDMClearKey.cpp:
1893         (WebCore::extractKeyidsLocationFromCencInitData):
1894         (WebCore::isCencInitData):
1895         (WebCore::extractKeyidsFromCencInitData):
1896         (WebCore::CDMPrivateClearKey::supportsInitDataType const):
1897         (WebCore::CDMPrivateClearKey::supportsInitData const):
1898         (WebCore::CDMInstanceClearKey::requestLicense):
1899
1900 2018-01-09  Zan Dobersek  <zdobersek@igalia.com>
1901
1902         [Cairo] Pass state values directly to Cairo operations
1903         https://bugs.webkit.org/show_bug.cgi?id=181389
1904
1905         Reviewed by Carlos Garcia Campos.
1906
1907         Instead of passing reference to the GraphicsContextState object to
1908         various Cairo operations, only pass the required state values. This
1909         makes it explicit what state values are used in these operations, at the
1910         expense of some long parameter lists, but this will be better addressed
1911         by future refactoring of this code into more concise functions.
1912
1913         No new tests -- no change in functionality.
1914
1915         * platform/graphics/cairo/CairoOperations.cpp:
1916         (WebCore::Cairo::drawGlyphsShadow):
1917         (WebCore::Cairo::dashedLineCornerWidthForStrokeWidth):
1918         (WebCore::Cairo::dashedLinePatternWidthForStrokeWidth):
1919         (WebCore::Cairo::drawGlyphs):
1920         (WebCore::Cairo::drawRect):
1921         (WebCore::Cairo::drawLine):
1922         (WebCore::Cairo::drawEllipse):
1923         * platform/graphics/cairo/CairoOperations.h:
1924         * platform/graphics/cairo/FontCairo.cpp:
1925         (WebCore::FontCascade::drawGlyphs):
1926         * platform/graphics/cairo/GraphicsContextCairo.cpp:
1927         (WebCore::GraphicsContext::drawRect):
1928         (WebCore::GraphicsContext::drawLine):
1929         (WebCore::GraphicsContext::drawEllipse):
1930
1931 2018-01-09  Ryosuke Niwa  <rniwa@webkit.org>
1932
1933         Release assert in addResourceTiming when a cache resource is requested during style recalc
1934         https://bugs.webkit.org/show_bug.cgi?id=181137
1935         <rdar://problem/35666574>
1936
1937         Reviewed by Simon Fraser.
1938
1939         Make the dispatching of resourcetimingbufferfull event asynchronous to avoid dispatching it
1940         synchronously during a style resolution when CachedResourceLoader::requestImage requests
1941         a previously loaded image.
1942
1943         We now schedule a timer when the resource timing buffer becomes full, and dispatch the event
1944         when the timer fires. Meanwhile, we have a backup buffer to which additional resource timing
1945         entries would be added. Once the event is dispatched, we refill the buffer exposed to author
1946         scripts. When refilling the buffer results in it becoming full again, we keep repeating the
1947         process of firing resourcetimingbufferfull and re-filling the buffer until either we stop
1948         making progress (i.e. the script didn't increase the number of empty entires in the buffer)
1949         or the backup buffer (at the time we started this process) becomes empty.
1950
1951         Also fixed a bug that we were firing resourcetimingbufferfull event when the last entry that
1952         fits within the buffer size was added instead of when an entry is being added to an already
1953         full buffer. To make this work, the patch introduces m_resourceTimingBufferFullFlag,
1954         representing the concept "resource timing buffer full" flag in the resource timing specification.
1955
1956         Test: http/tests/performance/performance-resource-timing-resourcetimingbufferfull-crash.html
1957
1958         * page/Performance.cpp:
1959         (WebCore::Performance::Performance):
1960         (WebCore::Performance::clearResourceTimings):
1961         (WebCore::Performance::setResourceTimingBufferSize):
1962         (WebCore::Performance::addResourceTiming):
1963         (WebCore::Performance::resourceTimingBufferFullTimerFired):
1964         * page/Performance.h:
1965
1966 2018-01-08  Chris Nardi  <csnardi1@gmail.com>
1967
1968         ::first-letter incorrectly selects grapheme pairs
1969         https://bugs.webkit.org/show_bug.cgi?id=181315
1970
1971         Reviewed by Darin Adler.
1972
1973         Grapheme pairs were incorrectly selected by ::first-letter. This
1974         change fixes their selection.
1975
1976         Tests: Updated fast/css/first-letter-punctuation.html and imported
1977         LayoutTests/imported/w3c/web-platform-tests/css/css-pseudo-4/first-letter-004.html
1978
1979         * rendering/updating/RenderTreeBuilderFirstLetter.cpp:
1980         (WebCore::isPunctuationForFirstLetter):
1981         (WebCore::shouldSkipForFirstLetter):
1982         (WebCore::RenderTreeBuilder::FirstLetter::createRenderers):
1983
1984 2018-01-08  Darin Adler  <darin@apple.com>
1985
1986         Special list-item counter starts from an incorrect number for ::before and ::after
1987         https://bugs.webkit.org/show_bug.cgi?id=181084
1988
1989         Reviewed by Zalan Bujtas.
1990
1991         Test: fast/css/counters/counter-list-item.html
1992
1993         * Sources.txt: Removed CounterDirectives.cpp.
1994         * WebCore.xcodeproj/project.pbxproj: Ditto.
1995
1996         * css/CSSComputedStyleDeclaration.cpp:
1997         (WebCore::counterToCSSValue): Updated for changes to the CounterDirectives struct.
1998         * css/StyleBuilderCustom.h:
1999         (WebCore::StyleBuilderCustom::applyInheritCounter): Ditto.
2000         (WebCore::StyleBuilderCustom::applyValueCounter): Ditto.
2001
2002         * html/HTMLLIElement.cpp:
2003         (WebCore::HTMLLIElement::parseValue): Call setExplicitValue(std::nullopt) instead
2004         of clearExplicitValue since we are using std::optional now.
2005
2006         * rendering/RenderCounter.cpp:
2007         (WebCore::listItemCounterDirectives): Added. Computes the counter directives that
2008         express the effects on the list-item counter from list item and list elements.
2009         Used something as close to what the CSS 3 draft says as possible. This uses a
2010         negative increment when creating a list to counteract the positive increment done
2011         by a list element, except in the case of an unordered list. This is where the bug
2012         fix actually lies. Also fixed handling of reversed ordered lists at the same time.
2013         (WebCore::planCounter): Refactored to use the function above. Also changed the
2014         code to pay attention to both the counter directives and the implicit ones from
2015         list item and list elements, getting as close as possible to what the specification
2016         seems to call for.
2017
2018         * rendering/RenderListItem.cpp:
2019         (WebCore::RenderListItem::RenderListItem): Since we are using std::optional and no
2020         longer using bit fields, simplified the constructor for each list item.
2021         (WebCore::RenderListItem::calcValue const): Deleted.
2022         (WebCore::RenderListItem::updateValueNow const): Merged in all the code from the
2023         old calcValue function, but it is also simpler now since m_value is std::optional.
2024         (WebCore::RenderListItem::updateValue): Updated to use std::optional.
2025         (WebCore::RenderListItem::setExplicitValue): Ditto.
2026         (WebCore::RenderListItem::clearExplicitValue): Deleted.
2027         (WebCore::RenderListItem::updateListMarkerNumbers): Updated to use std::optional.
2028         (WebCore::RenderListItem::isInReversedOrderedList const): Added. This is used by
2029         the counter code so it can decrement instead of incrementing.
2030
2031         * rendering/RenderListItem.h: Updated to use std::optional. Also marked functions
2032         final instead of override and initialized m_notInList after making it not be a
2033         bitfield any more.
2034
2035         * rendering/style/CounterDirectives.cpp: Removed.
2036         * rendering/style/CounterDirectives.h: Removed most of the CounterDirectives
2037         class and replaced it with a struct with two std::optional. Added an addClamped
2038         function so the counter code can share it with the addIncrementValue function.
2039         If we want to make a faster version that doesn't use double, we can come back
2040         and do that. Also moved the == function to the header since the implementation
2041         is so trivial.
2042
2043         * rendering/style/StyleAllInOne.cpp: Removed CounterDirectives.cpp.
2044
2045         * rendering/style/StyleRareNonInheritedData.cpp:
2046         (WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData): Updated to
2047         use std::make_unique directly instead of using a clone function.
2048
2049 2018-01-08  Wenson Hsieh  <wenson_hsieh@apple.com>
2050
2051         [Attachment Support] Expose HTMLAttachmentElement.uniqueIdentifier to bindings
2052         https://bugs.webkit.org/show_bug.cgi?id=181420
2053         <rdar://problem/36365827>
2054
2055         Reviewed by Alex Christensen.
2056
2057         Add a new IDL definition for uniqueIdentifier on HTMLAttachmentElement. This allows clients to relate attachment
2058         elements in the DOM to _WKAttachments delivered via Objective-C SPI.
2059
2060         Adjusted existing tests in WKAttachmentTests.
2061
2062         * html/HTMLAttachmentElement.idl:
2063
2064 2018-01-08  Don Olmstead  <don.olmstead@sony.com>
2065
2066         AccessibilityARIAGrid does not compile when accessibility is disabled
2067         https://bugs.webkit.org/show_bug.cgi?id=181418
2068         <rdar://problem/36365398>
2069
2070         Reviewed by Chris Fleizach.
2071
2072         No new tests. No change in behavior.
2073
2074         * accessibility/AccessibilityARIAGrid.cpp:
2075
2076 2018-01-08  Commit Queue  <commit-queue@webkit.org>
2077
2078         Unreviewed, rolling out r226532 and r226540.
2079         https://bugs.webkit.org/show_bug.cgi?id=181422
2080
2081         jessie says basic browsing does not seem to work (Requested by
2082         alexchristensen on #webkit).
2083
2084         Reverted changesets:
2085
2086         "Add CSP support to service workers"
2087         https://bugs.webkit.org/show_bug.cgi?id=181385
2088         https://trac.webkit.org/changeset/226532
2089
2090         "SWClientConnection should not keep references to service
2091         worker jobs"
2092         https://bugs.webkit.org/show_bug.cgi?id=181381
2093         https://trac.webkit.org/changeset/226540
2094
2095 2018-01-08  Wenson Hsieh  <wenson_hsieh@apple.com>
2096
2097         [Attachment Support] Expose file name and content type of WKAttachment
2098         https://bugs.webkit.org/show_bug.cgi?id=181390
2099         <rdar://problem/36336837>
2100
2101         Reviewed by Tim Horton.
2102
2103         Add new structs in AttachmentTypes.h and refactor HTMLAttachmentElement::requestData to requestInfo. See below
2104         for more details. Augmented existing API tests in WKAttachmentTests.
2105
2106         * html/AttachmentTypes.h:
2107
2108         Add a struct to represent a snapshot of information about an attachment element.
2109
2110         * html/HTMLAttachmentElement.cpp:
2111         (WebCore::HTMLAttachmentElement::requestInfo):
2112         (WebCore::HTMLAttachmentElement::requestData): Deleted.
2113         * html/HTMLAttachmentElement.h:
2114
2115         Change requestData to requestInfo. Instead of fetching and delivering data via callback, requestInfo returns an
2116         AttachmentInfo.
2117
2118         * rendering/RenderThemeIOS.mm:
2119         (WebCore::RenderAttachmentInfo::addLine):
2120         (WebCore::RenderAttachmentInfo::buildWrappedLines):
2121         (WebCore::RenderAttachmentInfo::buildSingleLine):
2122         (WebCore::RenderAttachmentInfo::RenderAttachmentInfo):
2123         (WebCore::RenderThemeIOS::attachmentBaseline const):
2124         (WebCore::paintAttachmentIcon):
2125         (WebCore::paintAttachmentText):
2126         (WebCore::paintAttachmentProgress):
2127         (WebCore::attachmentBorderPath):
2128         (WebCore::RenderThemeIOS::paintAttachment):
2129         (WebCore::AttachmentInfo::addLine): Deleted.
2130         (WebCore::AttachmentInfo::buildWrappedLines): Deleted.
2131         (WebCore::AttachmentInfo::buildSingleLine): Deleted.
2132         (WebCore::AttachmentInfo::AttachmentInfo): Deleted.
2133
2134         Rename AttachmentInfo to RenderAttachmentInfo to resolve a name conflict with the new AttachmentInfo struct.
2135
2136 2018-01-08  Saam Barati  <sbarati@apple.com>
2137
2138         Speculative build fix after r226600. We only use clflush on x86 and the `asm volatile` syntax is not available in the Windows build.
2139
2140         No new tests because this is a build fix.
2141
2142         * dom/Comment.cpp:
2143         (WebCore::Comment::clflushReadLength):
2144
2145 2018-01-08  Michael Saboff  <msaboff@apple.com>
2146
2147         Add a DOM gadget for Spectre testing
2148         https://bugs.webkit.org/show_bug.cgi?id=181351
2149
2150         Reviewed by Saam Barati.
2151
2152         This change is used to test Spectre mitigations.
2153
2154         Added a side data array to the Comment DOM node to test for Spectre issues in
2155         the DOM layer.  This additional functionality is disabled by default and must
2156         be enabled through the JSC option "enableSpectreGadgets".
2157
2158         * dom/Comment.cpp:
2159         (WebCore::Comment::Comment):
2160         (WebCore::Comment::setReadLength):
2161         (WebCore::Comment::charCodeAt):
2162         (WebCore::Comment::clflushReadLength):
2163         * dom/Comment.h:
2164         * dom/Comment.idl:
2165         * page/RuntimeEnabledFeatures.cpp:
2166         (WebCore::RuntimeEnabledFeatures::spectreGadgetsEnabled const):
2167         * page/RuntimeEnabledFeatures.h:
2168
2169 2018-01-08  Said Abou-Hallawa  <sabouhallawa@apple.com>
2170
2171         A canvas should not be tainted if it draws a data URL SVGImage with a <foreignObject>
2172         https://bugs.webkit.org/show_bug.cgi?id=180301
2173
2174         Reviewed by Dean Jackson.
2175
2176         Don't taint the canvas if it draws a data URL SVGImage with a <foreignObject>.
2177         There should not be a cross-origin data leak in this case.
2178
2179         Tests: svg/as-image/svg-canvas-data-url-svg-with-feimage-not-tainted.html
2180                svg/as-image/svg-canvas-data-url-svg-with-foreign-object-not-tainted.html
2181                svg/as-image/svg-canvas-data-url-svg-with-image-not-tainted.html
2182
2183         * html/ImageBitmap.cpp:
2184         (WebCore::taintsOrigin):
2185         * html/canvas/CanvasRenderingContext.cpp:
2186         (WebCore::CanvasRenderingContext::wouldTaintOrigin):
2187
2188 2018-01-08  Don Olmstead  <don.olmstead@sony.com>
2189
2190         Simplify platform checks in Graphics Context
2191         https://bugs.webkit.org/show_bug.cgi?id=181344
2192
2193         Reviewed by Alex Christensen.
2194
2195         No new tests. No change in behavior.
2196
2197         * platform/graphics/ANGLEWebKitBridge.h:
2198         * platform/graphics/GLContext.h:
2199         * platform/graphics/GraphicsContext3D.h:
2200         * platform/graphics/OpenGLESShims.h:
2201         * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
2202         (WebCore::GraphicsContext3D::checkVaryingsPacking const):
2203
2204 2018-01-08  Zalan Bujtas  <zalan@apple.com>
2205
2206         [RenderTreeBuilder] Move SVG addChild logic to RenderTreeBuilder
2207         https://bugs.webkit.org/show_bug.cgi?id=181405
2208         <rdar://problem/36360476>
2209
2210         Reviewed by Antti Koivisto.
2211
2212         This is about moving the code, no cleanup and/or normalization (unfortunately it also means
2213         some temporary changes).  
2214
2215         No change in functionality.
2216
2217         * Sources.txt:
2218         * WebCore.xcodeproj/project.pbxproj:
2219         * rendering/svg/RenderSVGContainer.cpp:
2220         (WebCore::RenderSVGContainer::addChild):
2221         * rendering/svg/RenderSVGInline.cpp:
2222         (WebCore::RenderSVGInline::addChild):
2223         * rendering/svg/RenderSVGRoot.cpp:
2224         (WebCore::RenderSVGRoot::addChild):
2225         * rendering/svg/RenderSVGText.cpp:
2226         (WebCore::RenderSVGText::addChild):
2227         * rendering/updating/RenderTreeBuilder.cpp:
2228         (WebCore::RenderTreeBuilder::RenderTreeBuilder):
2229         (WebCore::RenderTreeBuilder::insertChildToSVGContainer):
2230         (WebCore::RenderTreeBuilder::insertChildToSVGInline):
2231         (WebCore::RenderTreeBuilder::insertChildToSVGRoot):
2232         (WebCore::RenderTreeBuilder::insertChildToSVGText):
2233         * rendering/updating/RenderTreeBuilder.h:
2234         (WebCore::RenderTreeBuilder::SVGBuilder):
2235         * rendering/updating/RenderTreeBuilderSVG.cpp: Added.
2236         (WebCore::RenderTreeBuilder::SVG::SVG):
2237         (WebCore::RenderTreeBuilder::SVG::insertChild):
2238         * rendering/updating/RenderTreeBuilderSVG.h: Added.
2239
2240 2018-01-08  John Wilander  <wilander@apple.com>
2241
2242         Storage Access API: Remove access for all frames under a page when the page is closed
2243         https://bugs.webkit.org/show_bug.cgi?id=181398
2244         <rdar://problem/36357879>
2245
2246         Reviewed by Alex Christensen.
2247
2248         No new tests. Discussed with Alex Christensen and we concluded that
2249         both a layout test and an API test would require a lot of work and
2250         we have existing tests for clearing out storage access for frames.
2251
2252         * platform/network/NetworkStorageSession.h:
2253         * platform/network/cf/NetworkStorageSessionCFNet.cpp:
2254         (WebCore::NetworkStorageSession::removeStorageAccessForAllFramesOnPage):
2255
2256 2018-01-08  Matt Lewis  <jlewis3@apple.com>
2257
2258         Unreviewed, rolling out r226385.
2259
2260         The test introduced with this was a flaky since being added.
2261
2262         Reverted changeset:
2263
2264         "AX: when invert colors is on, double-invert certain media
2265         elements in UserAgentStyleSheet"
2266         https://bugs.webkit.org/show_bug.cgi?id=168447
2267         https://trac.webkit.org/changeset/226385
2268
2269 2018-01-08  Youenn Fablet  <youenn@apple.com>
2270
2271         SWClientConnection should not keep references to service worker jobs
2272         https://bugs.webkit.org/show_bug.cgi?id=181381
2273
2274         Reviewed by Chris Dumez.
2275
2276         Difficult to test determiniscally but corresponding crash log should no longer happen in debug builds.
2277
2278         Stopped passing ServiceWorkerJob references from ServiceWorkerContainer (potentially in service worker thread) to SWClientConnection (main thread).
2279         Instead pass job identifiers and related data to the main thread.
2280
2281         Minor refactoring to use ServiceWorkerJobIdentifier instead of ServiceWorkerJobDataIdentifier which contains more data than needed.
2282
2283         * workers/service/SWClientConnection.cpp:
2284         (WebCore::SWClientConnection::scheduleJob):
2285         (WebCore::SWClientConnection::failedFetchingScript):
2286         (WebCore::SWClientConnection::postTaskForJob):
2287         (WebCore::SWClientConnection::jobRejectedInServer):
2288         (WebCore::SWClientConnection::registrationJobResolvedInServer):
2289         (WebCore::SWClientConnection::unregistrationJobResolvedInServer):
2290         (WebCore::SWClientConnection::startScriptFetchForServer):
2291         (WebCore::SWClientConnection::clearPendingJobs):
2292         (WebCore::SWClientConnection::finishedFetchingScript): Deleted.
2293         * workers/service/SWClientConnection.h:
2294         * workers/service/ServiceWorkerContainer.cpp:
2295         (WebCore::ServiceWorkerContainer::scheduleJob):
2296         (WebCore::ServiceWorkerContainer::startScriptFetchForJob):
2297         (WebCore::ServiceWorkerContainer::jobFinishedLoadingScript):
2298         (WebCore::ServiceWorkerContainer::jobFailedLoadingScript):
2299         * workers/service/ServiceWorkerContainer.h:
2300         * workers/service/server/SWServer.cpp:
2301         (WebCore::SWServer::rejectJob):
2302         (WebCore::SWServer::resolveRegistrationJob):
2303         (WebCore::SWServer::resolveUnregistrationJob):
2304         (WebCore::SWServer::startScriptFetch):
2305         * workers/service/server/SWServer.h:
2306
2307 2018-01-08  Wenson Hsieh  <wenson_hsieh@apple.com>
2308
2309         Copying, pasting, and then deleting an attachment element breaks attachment data requests
2310         https://bugs.webkit.org/show_bug.cgi?id=181365
2311         <rdar://problem/36340647>
2312
2313         Reviewed by Tim Horton.
2314
2315         Currently, copying and pasting an attachment element within the same document and then deleting backwards to
2316         remove the pasted attachment element causes the original attachment element to be inaccessible via SPI. This is
2317         because there are now two different attachment elements with the same unique identifier, such that Document,
2318         which keeps a map of all unique attachment identifiers to attachment elements, will lose track of the original
2319         attachment element.
2320
2321         To fix this, we ensure that attachment elements should always have unique identifiers when they are inserted
2322         into the document. We make several small adjustments to accomplish this:
2323
2324         1.  First, refactor HTMLAttachmentElement's unique identifier so that it no longer depends on the value of the
2325             "webkitattachmentid" attribute, and is instead just a member of HTMLAttachmentElement that is not exposed to
2326             DOM bindings. This means setting and querying an attachment element's uniqueIdentifier can be done without
2327             triggering any side effects, such as layout or mutation events.
2328
2329         2.  Next, make "webkitattachmentid" a temporary attribute similar to "webkitattachmentpath" and
2330             "webkitattachmentbloburl", so that it is added only when generating a markup fragment for editing, and
2331             removed upon deserialization.
2332
2333         3.  Lastly, shift the responsibility of assigning a unique identifier to an attachment away from places where we
2334             create attachment elements, and instead have Document enforce this when an attachment element is inserted.
2335
2336         Tests:  WKAttachmentTests.InsertAndRemoveDuplicateAttachment
2337                 WKAttachmentTests.InsertDuplicateAttachmentAndUpdateData
2338
2339         * dom/Document.cpp:
2340         (WebCore::Document::didInsertAttachmentElement):
2341
2342         Assign the unique identifier of an attachment element that has been inserted. If the identifier already tracks
2343         an existing attachment element in the document or is missing, reassign the identifier to a new value.
2344
2345         * editing/cocoa/WebContentReaderCocoa.mm:
2346         (WebCore::createFragmentForImageAttachment):
2347         (WebCore::replaceRichContentWithAttachments):
2348         (WebCore::WebContentReader::readFilePaths):
2349
2350         Remove calls to setUniqueIdentifier here, since Document will assign a unique identifier upon insertion.
2351
2352         * editing/markup.cpp:
2353         (WebCore::StyledMarkupAccumulator::appendCustomAttributes):
2354         (WebCore::createFragmentFromMarkup):
2355
2356         Set the attachment's unique identifier to the value of the "webkitattachmentid" attribute. When moving existing
2357         attachments around in the DOM without duplication, this ensures that the attachment will be removed and
2358         reinserted in the document without triggering removal and insertion client delegate methods.
2359
2360         When pasting an attachment element that has the same identifier as an existing attachment, we let Document
2361         realize that the attachment identifier already exists, and reassign it to a unique value.
2362
2363         * html/HTMLAttachmentElement.cpp:
2364         (WebCore::HTMLAttachmentElement::uniqueIdentifier const): Deleted.
2365         (WebCore::HTMLAttachmentElement::setUniqueIdentifier): Deleted.
2366         * html/HTMLAttachmentElement.h:
2367
2368 2018-01-08  Zalan Bujtas  <zalan@apple.com>
2369
2370         [RenderTreeBuilder] Move RenderBlockFlow addChild logic to RenderTreeBuilder
2371         https://bugs.webkit.org/show_bug.cgi?id=181348
2372         <rdar://problem/36328117>
2373
2374         Reviewed by Antti Koivisto.
2375
2376         This is about moving the code, no cleanup and/or normalization (unfortunately it also means
2377         some temporary changes).  
2378
2379         No change in functionality.
2380
2381         * Sources.txt:
2382         * WebCore.xcodeproj/project.pbxproj:
2383         * rendering/RenderBlockFlow.cpp:
2384         (WebCore::RenderBlockFlow::addChild):
2385         * rendering/updating/RenderTreeBuilder.cpp:
2386         (WebCore::RenderTreeBuilder::RenderTreeBuilder):
2387         (WebCore::RenderTreeBuilder::insertChildToRenderBlockFlow):
2388         * rendering/updating/RenderTreeBuilder.h:
2389         (WebCore::RenderTreeBuilder::blockFlowBuilder):
2390         * rendering/updating/RenderTreeBuilderBlockFlow.cpp: Added.
2391         (WebCore::RenderTreeBuilder::BlockFlow::BlockFlow):
2392         (WebCore::RenderTreeBuilder::BlockFlow::insertChild):
2393         * rendering/updating/RenderTreeBuilderBlockFlow.h: Added.
2394
2395 2018-01-08  Youenn Fablet  <youenn@apple.com>
2396
2397         Add CSP support to service workers
2398         https://bugs.webkit.org/show_bug.cgi?id=181385
2399
2400         Reviewed by Chris Dumez.
2401
2402         Covered by rebased tests.
2403
2404         Added recovery of CSP information from WorkerScriptLoader.
2405         Added plumbing to pass the CSP information to Service Workers.
2406         Added persistency support for the CSP information.
2407
2408         * workers/WorkerScriptLoader.cpp:
2409         (WebCore::WorkerScriptLoader::loadAsynchronously):
2410         (WebCore::WorkerScriptLoader::didReceiveResponse):
2411         * workers/WorkerScriptLoader.h:
2412         (WebCore::WorkerScriptLoader::contentSecurityPolicy const):
2413         * workers/service/SWClientConnection.cpp:
2414         (WebCore::SWClientConnection::finishedFetchingScript):
2415         (WebCore::SWClientConnection::failedFetchingScript):
2416         * workers/service/SWClientConnection.h:
2417         * workers/service/ServiceWorkerContainer.cpp:
2418         (WebCore::ServiceWorkerContainer::addRegistration):
2419         (WebCore::ServiceWorkerContainer::jobFailedWithException):
2420         (WebCore::ServiceWorkerContainer::jobResolvedWithRegistration):
2421         (WebCore::ServiceWorkerContainer::jobFinishedLoadingScript):
2422         * workers/service/ServiceWorkerContainer.h:
2423         * workers/service/ServiceWorkerContextData.cpp:
2424         (WebCore::ServiceWorkerContextData::isolatedCopy const):
2425         * workers/service/ServiceWorkerContextData.h:
2426         (WebCore::ServiceWorkerContextData::encode const):
2427         (WebCore::ServiceWorkerContextData::decode):
2428         * workers/service/ServiceWorkerFetchResult.h:
2429         (WebCore::ServiceWorkerFetchResult::encode const):
2430         (WebCore::ServiceWorkerFetchResult::decode):
2431         * workers/service/ServiceWorkerGlobalScope.cpp:
2432         (WebCore::ServiceWorkerGlobalScope::create):
2433         * workers/service/ServiceWorkerGlobalScope.h:
2434         * workers/service/ServiceWorkerJob.cpp:
2435         (WebCore::ServiceWorkerJob::notifyFinished):
2436         * workers/service/ServiceWorkerJobClient.h:
2437         * workers/service/context/ServiceWorkerThread.cpp:
2438         (WebCore::ServiceWorkerThread::ServiceWorkerThread):
2439         (WebCore::ServiceWorkerThread::createWorkerGlobalScope):
2440         * workers/service/server/RegistrationDatabase.cpp:
2441         (WebCore::v1RecordsTableSchema):
2442         (WebCore::RegistrationDatabase::openSQLiteDatabase):
2443         (WebCore::RegistrationDatabase::doPushChanges):
2444         (WebCore::RegistrationDatabase::importRecords):
2445         * workers/service/server/SWServer.cpp:
2446         (WebCore::SWServer::updateWorker):
2447         (WebCore::SWServer::installContextData):
2448         * workers/service/server/SWServer.h:
2449         * workers/service/server/SWServerJobQueue.cpp:
2450         (WebCore::SWServerJobQueue::scriptFetchFinished):
2451         * workers/service/server/SWServerWorker.cpp:
2452         (WebCore::SWServerWorker::SWServerWorker):
2453         (WebCore::m_contentSecurityPolicy):
2454         (WebCore::SWServerWorker::contextData const):
2455         * workers/service/server/SWServerWorker.h:
2456
2457 2018-01-08  Youenn Fablet  <youenn@apple.com>
2458
2459         Use no-cache fetch mode when loading main documents with location.reload()
2460         https://bugs.webkit.org/show_bug.cgi?id=181285
2461
2462         Reviewed by Alex Christensen.
2463
2464         Covered by rebased tests.
2465
2466         Start to translate cache policy used for navigation as FetchOptions::Cache.
2467         This allows ensuring service workers receive the right cache mode when intercepting navigation loads.
2468         To not change current navigation behavior, ReturnCacheDataElseLoad and ReturnCacheDataDontLoad still trigger default fetch cache mode.
2469
2470         For Reload and ReloadExpiredOnly frame load types, using no-cache mode is more efficient than reload mode,
2471         as a conditional request will be sent if possible. This applies to location.reload which is consistent with other browsers.
2472         Keep reload mode for ReloadFromOrigin.
2473
2474         * loader/DocumentLoader.cpp:
2475         (WebCore::toFetchOptionsCache):
2476         (WebCore::DocumentLoader::loadMainResource):
2477         * loader/FrameLoader.cpp:
2478         (WebCore::FrameLoader::loadFrameRequest):
2479         (WebCore::FrameLoader::loadURL):
2480         (WebCore::FrameLoader::load):
2481         (WebCore::FrameLoader::reload):
2482         (WebCore::FrameLoader::defaultRequestCachingPolicy):
2483         (WebCore::FrameLoader::loadDifferentDocumentItem):
2484         * loader/NavigationScheduler.cpp:
2485
2486 2018-01-08  Youenn Fablet  <youenn@apple.com>
2487
2488         Stop exposing fetch and extendable events to window
2489         https://bugs.webkit.org/show_bug.cgi?id=181325
2490
2491         Reviewed by Chris Dumez.
2492
2493         Covered by updated tests.
2494
2495         Marked FetchEvent and ExtendableEvent as visible in ServiceWorker environments only.
2496         Moved related Internals testing routines to ServiceWorkerInternals.
2497
2498         * testing/Internals.cpp:
2499         (WebCore::Internals::waitForFetchEventToFinish): Deleted.
2500         (WebCore::Internals::createBeingDispatchedFetchEvent): Deleted.
2501         * testing/Internals.h:
2502         * testing/Internals.idl:
2503         * testing/ServiceWorkerInternals.cpp:
2504         (WebCore::ServiceWorkerInternals::waitForFetchEventToFinish):
2505         (WebCore::ServiceWorkerInternals::createBeingDispatchedFetchEvent):
2506         * testing/ServiceWorkerInternals.h:
2507         * testing/ServiceWorkerInternals.idl:
2508         * workers/service/ExtendableEvent.idl:
2509         * workers/service/FetchEvent.idl:
2510
2511 2018-01-08  Antti Koivisto  <antti@apple.com>
2512
2513         REGRESSION (r219145): Toggling layer borders on a static document no longer works immediately
2514         https://bugs.webkit.org/show_bug.cgi?id=176260
2515         <rdar://problem/34219966>
2516
2517         Reviewed by Simon Fraser.
2518
2519         Optimization reveled bugs in debug indicator painting.
2520
2521         Test: compositing/debug-borders-dynamic.html
2522
2523         * platform/graphics/ca/GraphicsLayerCA.cpp:
2524         (WebCore::GraphicsLayerCA::commitLayerChangesBeforeSublayers):
2525         (WebCore::GraphicsLayerCA::updateDebugIndicators):
2526         (WebCore::GraphicsLayerCA::updateDebugBorder): Deleted.
2527
2528         - Rename to indicate this is not just about debug borders.
2529         - Trigger display so repaint counters get painted. This helper is only called when the indicators change.
2530
2531         * platform/graphics/ca/GraphicsLayerCA.h:
2532         * rendering/RenderLayerCompositor.cpp:
2533         (WebCore::RenderLayerCompositor::cacheAcceleratedCompositingFlags):
2534
2535         Ensure we do compositing update on debug border change even when there is no layout.
2536
2537 2018-01-08  Zalan Bujtas <zalan@apple.com>
2538
2539         [RenderTreeBuilder] Move RenderInline addChild logic to RenderTreeBuilder
2540         https://bugs.webkit.org/show_bug.cgi?id=181336
2541         <rdar://problem/36324693>
2542
2543         Reviewed by Antti Koivisto.
2544
2545         This is about moving the code, no cleanup and/or normalization (unfortunately it also means
2546         some temporary changes).  
2547
2548         No change in functionality.
2549
2550         * Sources.txt:
2551         * WebCore.xcodeproj/project.pbxproj:
2552         * rendering/RenderInline.cpp:
2553         (WebCore::RenderInline::addChild):
2554         (WebCore::RenderInline::addChildIgnoringContinuation):
2555         (WebCore::RenderInline::childBecameNonInline):
2556         (WebCore::nextContinuation): Deleted.
2557         (WebCore::RenderInline::continuationBefore): Deleted.
2558         (WebCore::newChildIsInline): Deleted.
2559         (WebCore::RenderInline::cloneAsContinuation const): Deleted.
2560         (WebCore::RenderInline::splitInlines): Deleted.
2561         (WebCore::RenderInline::splitFlow): Deleted.
2562         (WebCore::canUseAsParentForContinuation): Deleted.
2563         (WebCore::RenderInline::addChildToContinuation): Deleted.
2564         * rendering/RenderInline.h:
2565         * rendering/updating/RenderTreeBuilder.cpp:
2566         (WebCore::RenderTreeBuilder::RenderTreeBuilder):
2567         (WebCore::RenderTreeBuilder::insertChildToRenderInline):
2568         (WebCore::RenderTreeBuilder::insertChildToRenderInlineIgnoringContinuation):
2569         (WebCore::RenderTreeBuilder::splitFlow):
2570         * rendering/updating/RenderTreeBuilder.h:
2571         (WebCore::RenderTreeBuilder::inlineBuilder):
2572         * rendering/updating/RenderTreeBuilderInline.cpp: Added.
2573         (WebCore::canUseAsParentForContinuation):
2574         (WebCore::nextContinuation):
2575         (WebCore::continuationBefore):
2576         (WebCore::cloneAsContinuation):
2577         (WebCore::newChildIsInline):
2578         (WebCore::inFlowPositionedInlineAncestor):
2579         (WebCore::RenderTreeBuilder::Inline::Inline):
2580         (WebCore::RenderTreeBuilder::Inline::insertChild):
2581         (WebCore::RenderTreeBuilder::Inline::insertChildToContinuation):
2582         (WebCore::RenderTreeBuilder::Inline::insertChildIgnoringContinuation):
2583         (WebCore::RenderTreeBuilder::Inline::splitFlow):
2584         (WebCore::RenderTreeBuilder::Inline::splitInlines):
2585         * rendering/updating/RenderTreeBuilderInline.h: Added.
2586
2587 2018-01-08  Zalan Bujtas  <zalan@apple.com>
2588
2589         [RenderTreeBuilder] Move RenderBlock addChild logic to RenderTreeBuilder
2590         https://bugs.webkit.org/show_bug.cgi?id=181319
2591         <rdar://problem/36313464>
2592
2593         Reviewed by Antti Koivisto.
2594
2595         This is about moving the code, no cleanup and/or normalization (unfortunately it also means
2596         some temporary changes).  
2597
2598         No change in functionality.
2599
2600         * Sources.txt:
2601         * WebCore.xcodeproj/project.pbxproj:
2602         * rendering/RenderBlock.cpp:
2603         (WebCore::RenderBlock::addChild):
2604         (WebCore::RenderBlock::addChildIgnoringContinuation):
2605         (WebCore::RenderBlock::childBecameNonInline):
2606         (WebCore::RenderBlock::continuationBefore): Deleted.
2607         (WebCore::RenderBlock::addChildToContinuation): Deleted.
2608         (WebCore::getInlineRun): Deleted.
2609         (WebCore::RenderBlock::makeChildrenNonInline): Deleted.
2610         * rendering/RenderBlock.h:
2611         * rendering/RenderBox.cpp:
2612         (WebCore::markBoxForRelayoutAfterSplit): Deleted.
2613         (WebCore::RenderBox::splitAnonymousBoxesAroundChild): Deleted.
2614         * rendering/RenderBox.h:
2615         * rendering/RenderRubyBase.cpp:
2616         (WebCore::RenderRubyBase::moveChildren):
2617         (WebCore::RenderRubyBase::moveBlockChildren):
2618         * rendering/RenderTable.cpp:
2619         (WebCore::RenderTable::addChild):
2620         * rendering/RenderTableRow.cpp:
2621         (WebCore::RenderTableRow::addChild):
2622         * rendering/RenderTableSection.cpp:
2623         (WebCore::RenderTableSection::addChild):
2624         * rendering/updating/RenderTreeBuilder.cpp:
2625         (WebCore::markBoxForRelayoutAfterSplit):
2626         (WebCore::getInlineRun):
2627         (WebCore::RenderTreeBuilder::RenderTreeBuilder):
2628         (WebCore::RenderTreeBuilder::insertChildToRenderBlock):
2629         (WebCore::RenderTreeBuilder::insertChildToRenderBlockIgnoringContinuation):
2630         (WebCore::RenderTreeBuilder::makeChildrenNonInline):
2631         (WebCore::RenderTreeBuilder::splitAnonymousBoxesAroundChild):
2632         * rendering/updating/RenderTreeBuilder.h:
2633         (WebCore::RenderTreeBuilder::blockBuilder):
2634         * rendering/updating/RenderTreeBuilderBlock.cpp: Added.
2635         (WebCore::continuationBefore):
2636         (WebCore::RenderTreeBuilder::Block::Block):
2637         (WebCore::RenderTreeBuilder::Block::insertChild):
2638         (WebCore::RenderTreeBuilder::Block::insertChildToContinuation):
2639         (WebCore::RenderTreeBuilder::Block::insertChildIgnoringContinuation):
2640         * rendering/updating/RenderTreeBuilderBlock.h: Added.
2641         
2642 2018-01-08  Jeremy Jones  <jeremyj@apple.com>
2643
2644         Standard controls sometimes say video is in pip when it isnt.
2645         https://bugs.webkit.org/show_bug.cgi?id=181095
2646         rdar://problem/36182687
2647
2648         Reviewed by Eric Carlson.
2649
2650         * html/HTMLMediaElement.cpp:
2651         (WebCore::HTMLMediaElement::exitFullscreen):
2652
2653 2018-01-08  Jer Noble  <jer.noble@apple.com>
2654
2655         REGRESSION: [iOS] ASSERTION FAILED: !node.isConnected() in WebCore::notifyNodeInsertedIntoDocument
2656         https://bugs.webkit.org/show_bug.cgi?id=181091
2657
2658         Reviewed by Darin Adler.
2659
2660         Move the work previously performed in insertedIntoAncestor() into didFinishInsertingNode().
2661
2662         * html/HTMLMediaElement.cpp:
2663         (WebCore::HTMLMediaElement::prepareForLoad):
2664
2665 2018-01-08  Zan Dobersek  <zdobersek@igalia.com>
2666
2667         [Cairo] Use isolated fill and stroke source containers
2668         https://bugs.webkit.org/show_bug.cgi?id=181386
2669
2670         Reviewed by Carlos Garcia Campos.
2671
2672         Generate fill and stroke source objects upon invocation of various Cairo
2673         operations, initializing necessary data from the GraphicsContextState
2674         object.
2675
2676         Cairo::FillSource and Cairo::StrokeSource structs are introduced, both
2677         being default-constructible as well as providing a constructor that
2678         accepts a GraphicsContextState object from which the appropriate
2679         resources are created.
2680
2681         The FillSource and StrokeSource objects are then passed to
2682         PlatformContextCairo's prepareForFilling() and prepareForStroking()
2683         methods. Here the helper prepareCairoContextSource() function is now
2684         invoked with cairo_pattern_t objects as pattern or gradient sources, or
2685         the source color if neither cairo_pattern_t object is specified.
2686
2687         The FillSource and StrokeSource constructors mimic the previous behavior
2688         of prepareCairoContextSource(). In case the source is a Pattern object,
2689         a cairo_pattern_t object is created from that. In case of FillSource,
2690         we also retrieve pattern size, transform and repetition information. In
2691         case the source os a Gradient object, we create a 'base' cairo_pattern_t
2692         object for a completely opaque alpha channel. Additionally, if the alpha
2693         value on the state is not 1, we create an alpha-adjusted cairo_pattern_t
2694         that is potentially used for any filling or stroking operation that has
2695         to preserve transparency. If neither Pattern or Gradient objects are set
2696         on the GraphicsContextState, we default to the current fill or stroke
2697         color.
2698
2699         Overall, there's no change in behavior, this is simply a refactoring
2700         that enables us to construct Cairo objects for filling and stroking
2701         sources at the time of Cairo operation dispatch, instead of pulling down
2702         GraphicsContextState deeper into the Cairo-specific code.
2703
2704         No new tests -- no change in functionality.
2705
2706         * platform/graphics/cairo/CairoOperations.cpp:
2707         (WebCore::Cairo::drawPathShadow):
2708         (WebCore::Cairo::fillCurrentCairoPath):
2709         (WebCore::Cairo::FillSource::FillSource):
2710         (WebCore::Cairo::StrokeSource::StrokeSource):
2711         (WebCore::Cairo::fillRect):
2712         (WebCore::Cairo::fillRectWithRoundedHole):
2713         (WebCore::Cairo::fillPath):
2714         (WebCore::Cairo::strokeRect):
2715         (WebCore::Cairo::strokePath):
2716         (WebCore::Cairo::drawGlyphs):
2717         * platform/graphics/cairo/CairoOperations.h:
2718         * platform/graphics/cairo/FontCairo.cpp:
2719         (WebCore::FontCascade::drawGlyphs):
2720         * platform/graphics/cairo/GraphicsContextCairo.cpp:
2721         (WebCore::GraphicsContext::fillPath):
2722         (WebCore::GraphicsContext::strokePath):
2723         (WebCore::GraphicsContext::fillRect):
2724         (WebCore::GraphicsContext::strokeRect):
2725         (WebCore::GraphicsContext::fillRectWithRoundedHole):
2726         * platform/graphics/cairo/PlatformContextCairo.cpp:
2727         (WebCore::prepareCairoContextSource):
2728         (WebCore::PlatformContextCairo::prepareForFilling):
2729         (WebCore::PlatformContextCairo::prepareForStroking):
2730         (WebCore::PlatformContextCairo::clipForPatternFilling):
2731         * platform/graphics/cairo/PlatformContextCairo.h:
2732
2733 2018-01-08  Youenn Fablet  <youenn@apple.com>
2734
2735         navigator.onLine does not work inside service workers
2736         https://bugs.webkit.org/show_bug.cgi?id=181079
2737         <rdar://problem/36178606>
2738
2739         Reviewed by Darin Adler.
2740
2741         Test: http/wpt/service-workers/online.https.html
2742
2743         Added support for onLine by reusing a similar implementation as regular workers.
2744         Added ServiceWorkerInternals as an interface for an object exposed as self.internals in WTR.
2745         This object has currently one method to trigger change in the online/offline status.
2746         This allows writing a test for the onLine feature.
2747
2748         Note that self.internals is inserted asynchronously after the script was evaluated.
2749         When writing a worker script using self.internals, one must make sure to use self.internals when initialized.
2750         online-worker.js for instance makes use of self.internals in a postMessage callback.
2751
2752         * CMakeLists.txt:
2753         * DerivedSources.make:
2754         * WebCore.xcodeproj/project.pbxproj:
2755         * bindings/js/WorkerScriptController.h:
2756         * dom/ScriptExecutionContext.h:
2757         * testing/ServiceWorkerInternals.cpp: Added.
2758         (WebCore::ServiceWorkerInternals::ServiceWorkerInternals):
2759         (WebCore::ServiceWorkerInternals::setOnline):
2760         * testing/ServiceWorkerInternals.h: Added.
2761         * testing/ServiceWorkerInternals.idl: Added.
2762         * testing/js/WebCoreTestSupport.cpp:
2763         (WebCoreTestSupport::setupNewlyCreateServiceWorker):
2764         * testing/js/WebCoreTestSupport.h:
2765         * workers/service/context/SWContextManager.cpp:
2766         (WebCore::SWContextManager::registerServiceWorkerThreadForInstall):
2767         (WebCore::SWContextManager::startedServiceWorker):
2768         * workers/service/context/SWContextManager.h:
2769         (WebCore::SWContextManager::setServiceWorkerCreationCallback):
2770         (WebCore::SWContextManager::workerByID):
2771         * workers/service/context/ServiceWorkerThread.cpp:
2772         (WebCore::ServiceWorkerThread::ServiceWorkerThread):
2773         * workers/service/context/ServiceWorkerThreadProxy.cpp:
2774         (WebCore::ServiceWorkerThreadProxy::ServiceWorkerThreadProxy):
2775         (WebCore::ServiceWorkerThreadProxy::~ServiceWorkerThreadProxy):
2776         (WebCore::ServiceWorkerThreadProxy::networkStateChanged):
2777         (WebCore::ServiceWorkerThreadProxy::notifyNetworkStateChange):
2778         * workers/service/context/ServiceWorkerThreadProxy.h:
2779
2780 2018-01-08  Zan Dobersek  <zdobersek@igalia.com>
2781
2782         [Cairo] Contain shadow blur requirement state in a separate object
2783         https://bugs.webkit.org/show_bug.cgi?id=181380
2784
2785         Reviewed by Carlos Garcia Campos.
2786
2787         Instead of picking up the necessary state parameters from a
2788         GraphicsContextState object, store the necessary parameters in a helper
2789         ShadowBlurUsage struct. Mimicking the mustUseShadowBlur() function that
2790         is being removed, values of the shadow color, shadow blur, and shadow
2791         transform ignorance are stored there. Additionally, the required()
2792         method accepts a PlatformContextCairo object through which it can
2793         retrieve the current CTM and determine whether it's an identity, finally
2794         deciding whether shadow blur can or cannot be ignored.
2795
2796         Goal of this change is to limit usage of GraphicsContextState directly
2797         in operations implemented inside the Cairo namespace. Instead, the
2798         state parameters should be passed directly, or an equivalent but limited
2799         state object should be constructed for invocation of such operations.
2800
2801         This is likely only an intermediate solution. It's possible it will be
2802         replaced by a more complete shadow state struct that would be used for
2803         any operation that is required to draw shadows, if necessary.
2804
2805         No new tests -- no change in functionality.
2806
2807         * platform/graphics/cairo/CairoOperations.cpp:
2808         (WebCore::Cairo::drawGlyphsShadow):
2809         (WebCore::Cairo::ShadowBlurUsage::ShadowBlurUsage):
2810         (WebCore::Cairo::ShadowBlurUsage::required const):
2811         (WebCore::Cairo::fillRectWithRoundedHole):
2812         (WebCore::Cairo::drawGlyphs):
2813         (WebCore::Cairo::mustUseShadowBlur): Deleted.
2814         * platform/graphics/cairo/CairoOperations.h:
2815         * platform/graphics/cairo/FontCairo.cpp:
2816         (WebCore::FontCascade::drawGlyphs):
2817         * platform/graphics/cairo/GraphicsContextCairo.cpp:
2818         (WebCore::GraphicsContext::fillRectWithRoundedHole):
2819
2820 2018-01-08  Philippe Normand  <pnormand@igalia.com>
2821
2822         [GStreamer][Soup] Remove dead getCreateOrReadBuffer code path
2823         https://bugs.webkit.org/show_bug.cgi?id=181376
2824
2825         Reviewed by Carlos Garcia Campos.
2826
2827         This code path is no longer used now that the GStreamer HTTP
2828         source element uses data coming directly from the network process.
2829
2830         * SourcesGTK.txt:
2831         * SourcesWPE.txt:
2832         * loader/MediaResourceLoader.cpp:
2833         (WebCore::MediaResource::getOrCreateReadBuffer): Deleted.
2834         * loader/MediaResourceLoader.h:
2835         * loader/SubresourceLoader.h:
2836         * loader/cache/CachedRawResource.h:
2837         * loader/cache/CachedRawResourceClient.h:
2838         (WebCore::CachedRawResourceClient::finishedTimingForWorkerLoad):
2839         (WebCore::CachedRawResourceClient::getOrCreateReadBuffer): Deleted.
2840         * loader/cache/CachedResource.h:
2841         (WebCore::CachedResource::getOrCreateReadBuffer): Deleted.
2842         * loader/soup/CachedRawResourceSoup.cpp: Removed.
2843         * loader/soup/SubresourceLoaderSoup.cpp: Removed.
2844         * platform/graphics/PlatformMediaResourceLoader.h:
2845         (WebCore::PlatformMediaResourceClient::loadFinished):
2846         (WebCore::PlatformMediaResourceClient::getOrCreateReadBuffer): Deleted.
2847         * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
2848         (CachedResourceStreamingClient::getOrCreateReadBuffer): Deleted.
2849         * platform/network/ResourceHandleClient.h:
2850         (WebCore::ResourceHandleClient::getOrCreateReadBuffer): Deleted.
2851         * platform/network/soup/ResourceHandleSoup.cpp:
2852         (WebCore::ResourceHandle::ensureReadBuffer):
2853
2854 2018-01-08  Zan Dobersek  <zdobersek@igalia.com> and Carlos Garcia Campos  <cgarcia@igalia.com>
2855
2856         [GStreamer] use FastMalloc-based GstAllocator
2857         https://bugs.webkit.org/show_bug.cgi?id=165793
2858
2859         Reviewed by Philippe Normand.
2860
2861         Add GstAllocatorFastMalloc, a GstAllocator implementation using fast malloc. It's only used when fast malloc is
2862         enabled and can be disabled using an environment variable for debugging purposes.
2863
2864         * platform/GStreamer.cmake:
2865         * platform/graphics/gstreamer/GStreamerUtilities.cpp:
2866         (WebCore::initializeGStreamer):
2867         * platform/graphics/gstreamer/GstAllocatorFastMalloc.cpp: Added.
2868         (gstMemoryFastMallocNew):
2869         (gstAllocatorFastMallocAlloc):
2870         (gstAllocatorFastMallocFree):
2871         (gstAllocatorFastMallocMemMap):
2872         (gstAllocatorFastMallocMemUnmap):
2873         (gstAllocatorFastMallocMemCopy):
2874         (gstAllocatorFastMallocMemShare):
2875         (gstAllocatorFastMallocMemIsSpan):
2876         (gst_allocator_fast_malloc_class_init):
2877         (gst_allocator_fast_malloc_init):
2878         * platform/graphics/gstreamer/GstAllocatorFastMalloc.h: Added.
2879
2880 2018-01-07  Ms2ger  <Ms2ger@igalia.com>
2881
2882         Implement createImageBitmap(ImageBitmap)
2883         https://bugs.webkit.org/show_bug.cgi?id=181287
2884
2885         Reviewed by Darin Adler.
2886
2887         Tests: imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-drawImage.html
2888                imported/w3c/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-invalid-args.html
2889
2890         * html/ImageBitmap.cpp:
2891         (WebCore::ImageBitmap::createPromise):
2892
2893 2018-01-07  Ryosuke Niwa  <rniwa@webkit.org>
2894
2895         Reduce the precision of "high" resolution time to 1ms
2896         https://bugs.webkit.org/show_bug.cgi?id=180910
2897         <rdar://problem/36085943>
2898
2899         Reviewed by Saam Barati.
2900
2901         Reduced the high prevision time's resolution to 1ms, the same precision as Date.now().
2902
2903         Also fixed the bug in fillRTCStats that we weren't reducing the time resolution in RTCStats dictionaries.
2904
2905         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
2906         (WebCore::fillRTCStats):
2907         * page/Performance.cpp:
2908         (WebCore::Performance::reduceTimeResolution):
2909
2910 2018-01-06  Simon Fraser  <simon.fraser@apple.com>
2911
2912         Possible crash computing event regions
2913         https://bugs.webkit.org/show_bug.cgi?id=181368
2914         rdar://problem/34847081
2915
2916         Reviewed by Zalan Bujtas.
2917
2918         Don't trigger layout in Element::absoluteEventHandlerBounds(), since this can run arbirary script
2919         which might delete elements or re-enter Document::absoluteRegionForEventTargets().
2920
2921         It's OK to not trigger layout, because if layout is dirty, the next layout will update event regions again.
2922
2923         Add a LayoutDisallowedScope to check that Document::absoluteRegionForEventTargets() doesn't
2924         trigger layout, and move the check for LayoutDisallowedScope::isLayoutAllowed() from Document::updateLayout()
2925         to LayoutContext::layout(), since some layouts don't happen via the former (e.g. the one being removed here).
2926
2927         The test checks that the assertion does not fire. I was not able to get a reliable test for any crash.
2928
2929         Test: fast/events/event-handler-regions-layout.html
2930
2931         * dom/Document.cpp:
2932         (WebCore::Document::updateLayout):
2933         (WebCore::Document::absoluteRegionForEventTargets):
2934         * dom/Element.cpp:
2935         (WebCore::Element::absoluteEventHandlerBounds):
2936         * page/LayoutContext.cpp:
2937         (WebCore::LayoutContext::layout):
2938         * rendering/LayoutDisallowedScope.h: Move the #ifdefs around to avoid defining the enum twice.
2939         (WebCore::LayoutDisallowedScope::LayoutDisallowedScope):
2940         (WebCore::LayoutDisallowedScope::isLayoutAllowed):
2941
2942 2018-01-06  Simon Fraser  <simon.fraser@apple.com>
2943
2944         Crash under RenderLayer::scrollTo() with marquee
2945         https://bugs.webkit.org/show_bug.cgi?id=181349
2946         rdar://problem/36190168
2947
2948         Reviewed by Zalan Bujtas.
2949
2950         Don't call updateWidgetPositions() synchonously during RenderLayer scrolling, because it
2951         can run arbitrary script which may trigger destruction of this RenderLayer.
2952
2953         Instead, queue up updateWidgetPositions() on a zero-delay timer.
2954
2955         Under some circumstances this may allow a paint to occur before the widgets have been
2956         updated (which could be fixed with a more invasive change), but in practice I saw no
2957         painting issues with plug-ins or iframes inside overflow scroll, in WebKit or LegacyWebKit.
2958
2959         Test: fast/scrolling/marquee-scroll-crash.html
2960
2961         * page/FrameView.cpp:
2962         (WebCore::FrameView::FrameView):
2963         (WebCore::FrameView::updateWidgetPositions):
2964         (WebCore::FrameView::scheduleUpdateWidgetPositions):
2965         (WebCore::FrameView::updateWidgetPositionsTimerFired):
2966         * page/FrameView.h:
2967         * rendering/RenderLayer.cpp:
2968         (WebCore::RenderLayer::scrollTo):
2969
2970 2018-01-05  Dean Jackson  <dino@apple.com>
2971
2972         Accurately clip copyTexImage2D and copyTexSubImage2D
2973         https://bugs.webkit.org/show_bug.cgi?id=181356
2974         <rdar://problem/35083877>
2975
2976         Reviewed by Eric Carlson.
2977
2978         The code to make sure copyTexSubImage2D and copyTexImage2D will not try to read
2979         out of bounds had a bad bug introduced here:
2980         https://bugs.webkit.org/show_bug.cgi?id=51421
2981
2982         With appropriate parameters, it would produce a rectangle with
2983         negative dimensions. Most GL drivers just ignored this, but some
2984         are not happy.
2985
2986         Test: fast/canvas/webgl/copy-tex-image-and-sub-image-2d-bad-input.html
2987
2988         * html/canvas/WebGLRenderingContextBase.cpp:
2989         (WebCore::clip2D): Reimplement this in a more sane manner, and use
2990         checked arithmetic while here.
2991         * html/canvas/WebGLRenderingContextBase.h:
2992         (WebCore::clip1D): Deleted.
2993         (WebCore::clip2D): Deleted.
2994
2995 2018-01-06  Antti Koivisto  <antti@apple.com>
2996
2997         Use WeakPtr for RenderTreePosition::m_nextSibling
2998         https://bugs.webkit.org/show_bug.cgi?id=181363
2999
3000         Reviewed by Zalan Bujtas.
3001
3002         For safety. In most cases it is null and won't cause us to instantiate WeakReferences for
3003         many new objects.
3004
3005         * rendering/updating/RenderTreePosition.cpp:
3006         (WebCore::RenderTreePosition::computeNextSibling):
3007         * rendering/updating/RenderTreePosition.h:
3008         (WebCore::RenderTreePosition::RenderTreePosition):
3009         (WebCore::RenderTreePosition::nextSibling const):
3010
3011 2018-01-05  David Kilzer  <ddkilzer@apple.com>
3012
3013         Re-enable -Wcast-qual in WebCore for Apple ports
3014         <https://webkit.org/b/177895>
3015         <rdar://problem/34960830>
3016
3017         Reviewed by Joseph Pecoraro.
3018
3019         * Configurations/Base.xcconfig:
3020         (WARNING_CFLAGS): Remove FIXME and add -Wcast-qual back to
3021         arguments.
3022
3023         * crypto/mac/SerializedCryptoKeyWrapMac.mm:
3024         (WebCore::createAndStoreMasterKey):
3025         - Use checked_cf_cast<SecACLRef>().
3026
3027         * editing/cocoa/DataDetection.mm:
3028         (WebCore::detectItemAtPositionWithRange):
3029         - Manually cast CFTypeRef to DDResultRef until
3030           DDResultGetTypeID() is available as SPI.
3031
3032         * platform/gamepad/mac/HIDGamepad.cpp:
3033         (WebCore::HIDGamepad::initElementsFromArray):
3034         - Use checked_cf_cast<IOHIDElementRef>().
3035
3036         * platform/graphics/avfoundation/objc/MediaSampleAVFObjC.mm:
3037         (WebCore::MediaSampleAVFObjC::createImageSample):
3038         (WebCore::CMSampleBufferIsRandomAccess):
3039         (WebCore::CMSampleBufferIsNonDisplaying):
3040         (WebCore::MediaSampleAVFObjC::createNonDisplayingCopy const):
3041         - Use checked_cf_cast<CFMutableDictionaryRef>() and
3042           checked_cf_cast<CFDictionaryRef>().
3043
3044         * platform/graphics/cocoa/IOSurface.h:
3045         (WebCore::IOSurface::asLayerContents):
3046         - Use reinterpret_cast<id>() to cast from IOSurfaceRef to id.
3047
3048         * platform/graphics/cocoa/WebCoreDecompressionSession.mm:
3049         (WebCore::WebCoreDecompressionSession::getFirstVideoFrame):
3050         (WebCore::WebCoreDecompressionSession::automaticDequeue):
3051         (WebCore::WebCoreDecompressionSession::imageForTime):
3052         (WebCore::WebCoreDecompressionSession::getDecodeTime):
3053         (WebCore::WebCoreDecompressionSession::getPresentationTime):
3054         (WebCore::WebCoreDecompressionSession::getDuration):
3055         - Use checked_cf_cast<CMSampleBufferRef>().
3056
3057         * platform/graphics/Font.h:
3058         (WebCore::Font::m_kernedCFStringAttributes):
3059         (WebCore::Font::m_nonKernedCFStringAttributes):
3060         - Change type from RetainPtr<CFDictionaryRef> to
3061           RetainPtr<CFMutableDictionaryRef> since that's what they are.
3062         * platform/graphics/mac/SimpleFontDataCoreText.cpp:
3063         (WebCore::Font::getCFStringAttributes const):
3064         - Replace local `mutableAttributes` variable with
3065           `attributesDictionary.get()` since it returns the correct type
3066           now.
3067
3068         * platform/ios/wak/WAKView.mm:
3069         (-[WAKView _initWithViewRef:]):
3070         (_WAKCopyWrapper):
3071         * platform/ios/wak/WKView.mm:
3072         (_WKViewClearSuperview):
3073         (WKViewFirstChild):
3074         (WKViewNextSibling):
3075         - Use static_cast<WKViewRef>(const_cast<void*>()) to convert
3076           const void* variable to WKViewRef.
3077
3078         * platform/mac/PasteboardMac.mm:
3079         (WebCore::flipImageSpec):
3080         (WebCore::setDragImageImpl):
3081         - Use const_cast<> to remove 'const' modifier from
3082           unsigned char pointers.  This regressed while -Wcast-qual was
3083           disabled for WebCore.
3084
3085         * platform/mac/SSLKeyGeneratorMac.mm:
3086         (WebCore::signedPublicKeyAndChallengeString):
3087         - Use checked_cf_cast<SecACLRef>().
3088
3089         * platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.cpp:
3090         (WebCore::RealtimeIncomingVideoSourceCocoa::OnFrame):
3091         - Use checked_cf_cast<CFMutableDictionaryRef>().
3092
3093         * platform/network/cf/SocketStreamHandleImplCFNet.cpp:
3094         (WebCore::copyCONNECTProxyResponse):
3095         - Use checked_cf_cast<CFHTTPMessageRef>().
3096
3097         * platform/network/cocoa/ResourceResponseCocoa.mm:
3098         (WebCore::ResourceResponse::platformCertificateInfo const):
3099         - Use checked_cf_cast<SecTrustRef>().
3100
3101         * platform/network/mac/CertificateInfoMac.mm:
3102         (WebCore::CertificateInfo::containsNonRootSHA1SignedCertificate const):
3103         (WebCore::CertificateInfo::dump const):
3104         - Use checked_cf_cast<SecCertificateRef>().
3105
3106         * testing/cocoa/WebArchiveDumpSupport.mm:
3107         (WebCoreTestSupport::createCFURLResponseFromResponseData):
3108         - Use checked_cf_cast<>() for CFMutable* types.
3109
3110 2018-01-05  John Wilander  <wilander@apple.com>
3111
3112         Storage Access API: Refactor to make naming accurate and explicit, simplify access table, and prepare for access removal for page
3113         https://bugs.webkit.org/show_bug.cgi?id=181357
3114         <rdar://problem/36331031>
3115
3116         Reviewed by Alex Christensen.
3117
3118         No new tests. The only changed functionality that isn't covered
3119         by existing tests is cross-origin iframes in the same partition
3120         should be handled as already having access. This cannot be
3121         tested in layout tests since they don't support subdomains.
3122
3123         This change does the following:
3124         - Changes function and message names to reflect how this feature
3125           was eventually implemented, i.e. access per frame.
3126         - Makes it explicit that the UI process is only involved in
3127           granting storage access and not removing storage access.
3128           The latter is done directly by the web process.
3129         - Simplifies the network process' entry map since only needs to
3130           be able to give access to one domain in one frame at a time.
3131           Access goes away on frame navigation so there can only be one
3132           domain at a time per frame. Also, the map now uses pageIDs as
3133           main keys to prepare for efficient access removal for all
3134           frames under a page.
3135         - Fixes a bug in so that a cross-origin iframe with the same
3136           partition as the top frame correctly is handled as already
3137           having access.
3138
3139         * platform/network/NetworkStorageSession.h:
3140         * platform/network/cf/NetworkStorageSessionCFNet.cpp:
3141         (WebCore::NetworkStorageSession::cookieStoragePartition const):
3142             The only change here is the changed named of the call to
3143             NetworkStorageSession::hasStorageAccessForFrame().
3144         (WebCore::NetworkStorageSession::hasStorageAccessForFrame const):
3145         (WebCore::NetworkStorageSession::grantStorageAccessForFrame):
3146         (WebCore::NetworkStorageSession::removeStorageAccessForFrame):
3147         (WebCore::NetworkStorageSession::isStorageAccessGranted const): Deleted.
3148         (WebCore::NetworkStorageSession::setStorageAccessGranted): Deleted.
3149         (WebCore::NetworkStorageSession::removeStorageAccess): Deleted.
3150
3151 2018-01-05  Youenn Fablet  <youenn@apple.com>
3152
3153         Implement Cache API partitioning based on ClientOrigin
3154         https://bugs.webkit.org/show_bug.cgi?id=181240
3155
3156         Reviewed by Alex Christensen.
3157
3158         Covered by updated tests.
3159
3160         Previously, cache storage was partitioned according the origin of the client, represented as a String.
3161         We now partition according both client and top origins, represented as a ClientOrigin
3162
3163         Minor refactoring to use more makePendingActivity.
3164         Added support for IPC serialization of ClientOrigin.
3165         Added SecurityOriginData::toString which is used by WebKit2 Cache Storage implementation.
3166
3167         * Modules/cache/CacheStorageConnection.cpp:
3168         (WebCore::CacheStorageConnection::open):
3169         (WebCore::CacheStorageConnection::retrieveCaches):
3170         * Modules/cache/CacheStorageConnection.h:
3171         (WebCore::CacheStorageConnection::clearMemoryRepresentation):
3172         (WebCore::CacheStorageConnection::doOpen):
3173         (WebCore::CacheStorageConnection::doRetrieveCaches):
3174         * Modules/cache/DOMCacheStorage.cpp:
3175         (WebCore::DOMCacheStorage::origin const):
3176         (WebCore::DOMCacheStorage::retrieveCaches):
3177         (WebCore::DOMCacheStorage::open):
3178         (WebCore::DOMCacheStorage::remove):
3179         * Modules/cache/DOMCacheStorage.h:
3180         * Modules/cache/WorkerCacheStorageConnection.cpp:
3181         (WebCore::WorkerCacheStorageConnection::doOpen):
3182         (WebCore::WorkerCacheStorageConnection::doRetrieveCaches):
3183         * Modules/cache/WorkerCacheStorageConnection.h:
3184         * page/ClientOrigin.h:
3185         (WebCore::ClientOrigin::isolatedCopy const):
3186         (WebCore::ClientOrigin::encode const):
3187         (WebCore::ClientOrigin::decode):
3188         * page/SecurityOriginData.cpp:
3189         (WebCore::SecurityOriginData::toString const):
3190         (WebCore::SecurityOriginData::debugString const): Deleted.
3191         * page/SecurityOriginData.h:
3192         (WebCore::SecurityOriginData::debugString const):
3193         * testing/Internals.cpp:
3194         (WebCore::Internals::clearCacheStorageMemoryRepresentation):
3195
3196 2018-01-05  Wenson Hsieh  <wenson_hsieh@apple.com>
3197
3198         [Attachment Support] Add a way to write blob data to a file URL from the UI process
3199         https://bugs.webkit.org/show_bug.cgi?id=181236
3200
3201         Reviewed by Brady Eidson.
3202
3203         Add support for writing a blob to a designated file path. See comments below for more detail. No new tests, as
3204         there change in behavior yet. See part 2: https://bugs.webkit.org/show_bug.cgi?id=181199.
3205
3206         * page/DragController.cpp:
3207         (WebCore::DragController::dragAttachmentElement):
3208         * platform/PromisedBlobInfo.h:
3209
3210         Remove PromisedBlobData entirely. This was added with the premise of having the web process deliver blob data to
3211         the UI process. However, the new approach I'm taking just has the UI process tell the network process to write
3212         a blob to a given location, so a data structure to deliver blob data over IPC is no longer necessary.
3213
3214         (WebCore::PromisedBlobData::hasData const): Deleted.
3215         (WebCore::PromisedBlobData::hasFile const): Deleted.
3216         (WebCore::PromisedBlobData::operator bool const): Deleted.
3217         (WebCore::PromisedBlobData::fulfills const): Deleted.
3218         * platform/network/BlobRegistryImpl.cpp:
3219         (WebCore::BlobRegistryImpl::populateBlobsForFileWriting):
3220
3221         Introduce a new helper to build a list of blob data for file writing.
3222
3223         (WebCore::writeFilePathsOrDataBuffersToFile):
3224
3225         Introduce a new static helper to write blob data (a list of file paths and data buffers) to a given file handle.
3226         Automatically closes the given file handle upon exit.
3227
3228         (WebCore::BlobRegistryImpl::writeBlobsToTemporaryFiles):
3229         (WebCore::BlobRegistryImpl::writeBlobToFilePath):
3230
3231         Pull out common logic in writeBlobsToTemporaryFiles and writeBlobToFilePath into helper methods (see above), and
3232         refactor both methods to use the helpers.
3233
3234         * platform/network/BlobRegistryImpl.h:
3235
3236 2018-01-05  Alex Christensen  <achristensen@webkit.org>
3237
3238         Forbid < and > in URL hosts
3239         https://bugs.webkit.org/show_bug.cgi?id=181308
3240         <rdar://problem/36012757>
3241
3242         Reviewed by Tim Horton.
3243
3244         https://url.spec.whatwg.org/#forbidden-host-code-point does not include these characters yet, but I think it should.
3245         Firefox fails to parse URLs with < or > in the host.  Chrome percent encodes them.  Safari needs to do something.
3246         The web platform tests are unclear on this case, and they will need to be updated with the specification.
3247         They do show a change in behavior, though.
3248
3249         * platform/URLParser.cpp:
3250         Add < and > to the list of forbidden host code points.
3251
3252 2018-01-05  Eric Carlson  <eric.carlson@apple.com>
3253
3254         [MediaStream] Add Mac screen capture source
3255         https://bugs.webkit.org/show_bug.cgi?id=181333
3256         <rdar://problem/36323219>
3257
3258         Reviewed by Dean Jackson.
3259
3260         * SourcesCocoa.txt: Add ScreenDisplayCaptureSourceMac.mm.
3261
3262         * WebCore.xcodeproj/project.pbxproj: Ditto.
3263
3264         * platform/cocoa/CoreVideoSoftLink.cpp: Declare new constants used.
3265         * platform/cocoa/CoreVideoSoftLink.h:
3266
3267         * platform/mediastream/mac/DisplayCaptureManagerCocoa.cpp:
3268         (WebCore::displayReconfigurationCallBack): Call refreshCaptureDevices.
3269         (WebCore::DisplayCaptureManagerCocoa::~DisplayCaptureManagerCocoa): Unregister for display
3270         reconfiguration callbacks.
3271         (WebCore::DisplayCaptureManagerCocoa::captureDevices): Register for display reconfigrations.
3272         (WebCore::DisplayCaptureManagerCocoa::refreshCaptureDevices): Use CGActiveDisplayList to
3273         get list of active screens.
3274         (WebCore::DisplayCaptureManagerCocoa::screenCaptureDeviceWithPersistentID): Validate screen
3275         ID, return CaptureDevice.
3276         * platform/mediastream/mac/DisplayCaptureManagerCocoa.h:
3277
3278         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp:
3279         (WebCore::VideoCaptureSourceFactoryMac::createVideoCaptureSource): Deal with screen capture
3280         on macOS.
3281
3282         Implement Mac screen capture with CGDisplayStream.
3283         * platform/mediastream/mac/ScreenDisplayCaptureSourceMac.h: Added.
3284         (WebCore::ScreenDisplayCaptureSourceMac::DisplaySurface::~DisplaySurface):
3285         (WebCore::ScreenDisplayCaptureSourceMac::DisplaySurface::operator=):
3286         (WebCore::ScreenDisplayCaptureSourceMac::DisplaySurface::ioSurface const):
3287         * platform/mediastream/mac/ScreenDisplayCaptureSourceMac.mm: Added.
3288         (WebCore::roundUpToMacroblockMultiple):
3289         (WebCore::ScreenDisplayCaptureSourceMac::updateDisplayID):
3290         (WebCore::ScreenDisplayCaptureSourceMac::create):
3291         (WebCore::ScreenDisplayCaptureSourceMac::ScreenDisplayCaptureSourceMac):
3292         (WebCore::ScreenDisplayCaptureSourceMac::~ScreenDisplayCaptureSourceMac):
3293         (WebCore::ScreenDisplayCaptureSourceMac::createDisplayStream):
3294         (WebCore::ScreenDisplayCaptureSourceMac::startProducingData):
3295         (WebCore::ScreenDisplayCaptureSourceMac::stopProducingData):
3296         (WebCore::ScreenDisplayCaptureSourceMac::sampleBufferFromPixelBuffer):
3297         (WebCore::ScreenDisplayCaptureSourceMac::pixelBufferFromIOSurface):
3298         (WebCore::ScreenDisplayCaptureSourceMac::generateFrame):
3299         (WebCore::ScreenDisplayCaptureSourceMac::startDisplayStream):
3300         (WebCore::ScreenDisplayCaptureSourceMac::applySize):
3301         (WebCore::ScreenDisplayCaptureSourceMac::applyFrameRate):
3302         (WebCore::ScreenDisplayCaptureSourceMac::commitConfiguration):
3303         (WebCore::ScreenDisplayCaptureSourceMac::displayWasReconfigured):
3304         (WebCore::ScreenDisplayCaptureSourceMac::displayReconfigurationCallBack):
3305         (WebCore::ScreenDisplayCaptureSourceMac::frameAvailable):
3306
3307 2018-01-05  Don Olmstead  <don.olmstead@sony.com>
3308
3309         [curl] Can't load file:// URL with a URL fragment identifier
3310         https://bugs.webkit.org/show_bug.cgi?id=181170
3311
3312         Reviewed by Alex Christensen.
3313
3314         No new tests. No change in behavior.
3315
3316         * platform/network/curl/CurlRequest.cpp:
3317         (WebCore::CurlRequest::invokeDidReceiveResponseForFile):
3318
3319 2018-01-05  Don Olmstead  <don.olmstead@sony.com>
3320
3321         TextCodec uses std::array but does not include it
3322         https://bugs.webkit.org/show_bug.cgi?id=181340
3323
3324         Reviewed by Alex Christensen.
3325
3326         No new tests. No change in behavior.
3327
3328         * platform/text/TextCodec.h:
3329
3330 2018-01-05  Said Abou-Hallawa  <sabouhallawa@apple.com>
3331
3332         SVGAnimatedListPropertyTearOff::synchronizeWrappersIfNeeded() should do nothing if the property is not animating
3333         https://bugs.webkit.org/show_bug.cgi?id=181316
3334         <rdar://problem/36147545>
3335
3336         Reviewed by Simon Fraser.
3337
3338         This is a speculative change to fix a crash which appeared after r226065.
3339         The crash is very intermittent and sometimes very hard to reproduce. The
3340         basic code analysis did not show how this crash can even happen.
3341
3342         * svg/SVGAnimatedTypeAnimator.h:
3343         (WebCore::SVGAnimatedTypeAnimator::resetFromBaseValues): For SVG property
3344         with two values, e.g. <SVGAngleValue, SVGMarkerOrientType>,  we need to
3345         detach the wrappers of the animated property if the animated values are
3346         going to change. This is similar to what we did in resetFromBaseValue().
3347
3348         * svg/properties/SVGAnimatedListPropertyTearOff.h:
3349         (WebCore::SVGAnimatedListPropertyTearOff::synchronizeWrappersIfNeeded):
3350
3351 2018-01-05  Matt Lewis  <jlewis3@apple.com>
3352
3353         Unreviewed, rolling out r226401.
3354
3355         This caused timeouts on multiple platforms.
3356
3357         Reverted changeset:
3358
3359         "Implement Cache API partitioning based on ClientOrigin"
3360         https://bugs.webkit.org/show_bug.cgi?id=181240
3361         https://trac.webkit.org/changeset/226401
3362
3363 2018-01-05  Dan Bernstein  <mitz@apple.com>
3364
3365         Fixed the build following AppKit API deprecations in a recent SDKs
3366
3367         * platform/mac/PasteboardMac.mm:
3368         (WebCore::setDragImageImpl): Suppressed deprecation warnings.
3369         * platform/mac/WidgetMac.mm:
3370         (WebCore::Widget::paint): Ditto.
3371
3372 2018-01-05  Joseph Pecoraro  <pecoraro@apple.com>
3373
3374         ServiceWorkers: Enable UserTiming / ResourceTiming
3375         https://bugs.webkit.org/show_bug.cgi?id=181297
3376         <rdar://problem/36307306>
3377
3378         Reviewed by Youenn Fablet.
3379
3380         Tests: http/tests/workers/service/service-worker-resource-timing.https.html
3381                http/tests/workers/service/service-worker-user-timing.https.html
3382
3383         * loader/ResourceTiming.cpp:
3384         (WebCore::ResourceTiming::ResourceTiming):
3385         We used to clear extra NetworkLoadMetrics data early on. However,
3386         for Workers we want to pass the complete NetworkLoadMetrics to
3387         the Worker so that a Worker inspector has access to it.
3388
3389         * page/PerformanceResourceTiming.cpp:
3390         (WebCore::PerformanceResourceTiming::PerformanceResourceTiming):
3391         Instead move the clearing of extra data to here, when the NetworkLoadMetrics
3392         have finally settled into being used only for a performance entry.
3393
3394 2018-01-04  Philippe Normand  <pnormand@igalia.com>
3395
3396         [EME][GStreamer] Fix wrong ifdef
3397         https://bugs.webkit.org/show_bug.cgi?id=181289
3398
3399         Reviewed by Alex Christensen.
3400
3401         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
3402         (WebCore::MediaPlayerPrivateGStreamer::handleMessage): Remove the
3403         ENCRYPTED_MEDIA ifdef from the VIDEO_TRACK ifdef block. Both have
3404         nothing to do together.
3405
3406 2018-01-05  Fujii Hironori  <Hironori.Fujii@sony.com>
3407
3408         [Cairo] Canvas: Path::clear should clear its transform
3409         https://bugs.webkit.org/show_bug.cgi?id=181320
3410
3411         Reviewed by Carlos Garcia Campos.
3412
3413         Path of Cairo port has its cairo context. Path::clear() didn't
3414         clear the transform matrix of the context.
3415
3416         Test: fast/canvas/reset-scaling-by-height-change.html
3417
3418         * platform/graphics/cairo/PathCairo.cpp:
3419         (WebCore::Path::clear): Reset the transform matrix of Path.
3420
3421 2018-01-04  Devin Rousso  <webkit@devinrousso.com>
3422
3423         Web Inspector: replace HTMLCanvasElement with CanvasRenderingContext for instrumentation logic
3424         https://bugs.webkit.org/show_bug.cgi?id=180770
3425
3426         Reviewed by Joseph Pecoraro.
3427
3428         No change in functionality.
3429
3430         * html/HTMLCanvasElement.h:
3431         * html/HTMLCanvasElement.cpp:
3432         (WebCore::HTMLCanvasElement::createContext2d):
3433         (WebCore::HTMLCanvasElement::createContextWebGL):
3434         (WebCore::HTMLCanvasElement::createContextWebGPU):
3435         (WebCore::HTMLCanvasElement::createContextBitmapRenderer):
3436         (WebCore::HTMLCanvasElement::reset):
3437         (WebCore::HTMLCanvasElement::paint):
3438         (WebCore::HTMLCanvasElement::setImageBuffer const):
3439         (WebCore::HTMLCanvasElement::addObserver): Deleted.
3440         (WebCore::HTMLCanvasElement::removeObserver): Deleted.
3441         (WebCore::HTMLCanvasElement::cssCanvasClients): Deleted.
3442         (WebCore::HTMLCanvasElement::notifyObserversCanvasChanged): Deleted.
3443         * html/OffscreenCanvas.h:
3444         * html/canvas/CanvasRenderingContext.h:
3445         * html/canvas/CanvasRenderingContext.cpp:
3446         * html/canvas/CanvasRenderingContext2D.h:
3447         * html/canvas/CanvasRenderingContext2D.cpp:
3448         (WebCore::CanvasRenderingContext2D::create):
3449         * html/canvas/CanvasRenderingContext2DBase.h:
3450         * html/canvas/ImageBitmapRenderingContext.h:
3451         * html/canvas/ImageBitmapRenderingContext.cpp:
3452         (WebCore::ImageBitmapRenderingContext::create):
3453         * html/canvas/WebGL2RenderingContext.h:
3454         * html/canvas/WebGL2RenderingContext.cpp:
3455         (WebCore::WebGL2RenderingContext::create):
3456         * html/canvas/WebGLRenderingContext.h:
3457         * html/canvas/WebGLRenderingContext.cpp:
3458         (WebCore::WebGLRenderingContext::create):
3459         * html/canvas/WebGLRenderingContextBase.h:
3460         * html/canvas/WebGLRenderingContextBase.cpp:
3461         (WebCore::WebGLRenderingContextBase::create):
3462         * html/canvas/WebGPURenderingContext.cpp:
3463         (WebCore::WebGPURenderingContext::create):
3464         Instead of adding didCreateCanvasRenderingContext calls at the construction sites of each
3465         context, we can make the constructors private and force the usage of static `create` functions.
3466         This way, we have access to the fully constructed object and have a guaranteed path for creation.
3467
3468         * html/CanvasBase.h:
3469         * html/CanvasBase.cpp:
3470         (WebCore::CanvasBase::~CanvasBase):
3471         (WebCore::CanvasBase::renderingContext const):
3472         (WebCore::CanvasBase::addObserver):
3473         (WebCore::CanvasBase::removeObserver):
3474         (WebCore::CanvasBase::notifyObserversCanvasChanged):
3475         (WebCore::CanvasBase::notifyObserversCanvasResized):
3476         (WebCore::CanvasBase::notifyObserversCanvasDestroyed):
3477         (WebCore::CanvasBase::cssCanvasClients const):
3478         * Modules/mediastream/CanvasCaptureMediaStreamTrack.h:
3479         * Modules/mediastream/CanvasCaptureMediaStreamTrack.cpp:
3480         (WebCore::CanvasCaptureMediaStreamTrack::Source::canvasDestroyed):
3481         (WebCore::CanvasCaptureMediaStreamTrack::Source::canvasResized):
3482         (WebCore::CanvasCaptureMediaStreamTrack::Source::canvasChanged):
3483         * css/CSSCanvasValue.h:
3484         Move the CanvasObserver class to CanvasBase so that it can also be used for OffscreenCanvas.
3485
3486         * inspector/InspectorInstrumentation.h:
3487         (WebCore::InspectorInstrumentation::didChangeCSSCanvasClientNodes):
3488         (WebCore::InspectorInstrumentation::didCreateCanvasRenderingContext):
3489         (WebCore::InspectorInstrumentation::didChangeCanvasMemory):
3490         (WebCore::InspectorInstrumentation::recordCanvasAction):
3491         (WebCore::InspectorInstrumentation::didFinishRecordingCanvasFrame):
3492         (WebCore::InspectorInstrumentation::didEnableExtension):
3493         (WebCore::InspectorInstrumentation::didCreateProgram):
3494         (WebCore::InspectorInstrumentation::willDeleteProgram):
3495         (WebCore::InspectorInstrumentation::isShaderProgramDisabled):
3496         (WebCore::InspectorInstrumentation::consoleStartRecordingCanvas):
3497         (WebCore::InspectorInstrumentation::didCreateCSSCanvas): Deleted.
3498         * inspector/InspectorInstrumentation.cpp:
3499         (WebCore::InspectorInstrumentation::consoleStartRecordingCanvasImpl):
3500         (WebCore::InspectorInstrumentation::didChangeCSSCanvasClientNodesImpl):
3501         (WebCore::InspectorInstrumentation::didCreateCanvasRenderingContextImpl):
3502         (WebCore::InspectorInstrumentation::didChangeCanvasMemoryImpl):
3503         (WebCore::InspectorInstrumentation::didFinishRecordingCanvasFrameImpl):
3504         (WebCore::InspectorInstrumentation::didEnableExtensionImpl):
3505         (WebCore::InspectorInstrumentation::didCreateProgramImpl):
3506         (WebCore::InspectorInstrumentation::didCreateCSSCanvasImpl): Deleted.
3507
3508         * inspector/agents/InspectorCanvasAgent.h:
3509         * inspector/agents/InspectorCanvasAgent.cpp:
3510         (WebCore::InspectorCanvasAgent::enable):
3511         (WebCore::InspectorCanvasAgent::requestNode):
3512         (WebCore::InspectorCanvasAgent::requestContent):
3513         (WebCore::InspectorCanvasAgent::requestCSSCanvasClientNodes):
3514         (WebCore::contextAsScriptValue):
3515         (WebCore::InspectorCanvasAgent::resolveCanvasContext):
3516         (WebCore::InspectorCanvasAgent::startRecording):
3517         (WebCore::InspectorCanvasAgent::stopRecording):
3518         (WebCore::InspectorCanvasAgent::updateShader):
3519         (WebCore::InspectorCanvasAgent::frameNavigated):
3520         (WebCore::InspectorCanvasAgent::didChangeCSSCanvasClientNodes):
3521         (WebCore::InspectorCanvasAgent::didCreateCanvasRenderingContext):
3522         (WebCore::InspectorCanvasAgent::didChangeCanvasMemory):
3523         (WebCore::InspectorCanvasAgent::recordCanvasAction):
3524         (WebCore::InspectorCanvasAgent::canvasDestroyed):
3525         (WebCore::InspectorCanvasAgent::didFinishRecordingCanvasFrame):
3526         (WebCore::InspectorCanvasAgent::consoleStartRecordingCanvas):
3527         (WebCore::InspectorCanvasAgent::didEnableExtension):
3528         (WebCore::InspectorCanvasAgent::didCreateProgram):
3529         (WebCore::InspectorCanvasAgent::canvasRecordingTimerFired):
3530         (WebCore::InspectorCanvasAgent::clearCanvasData):
3531         (WebCore::InspectorCanvasAgent::unbindCanvas):
3532         (WebCore::InspectorCanvasAgent::findInspectorCanvas):
3533         (WebCore::InspectorCanvasAgent::unbindProgram):
3534         (WebCore::InspectorCanvasAgent::didCreateCSSCanvas): Deleted.
3535
3536         * inspector/InspectorCanvas.h:
3537         * inspector/InspectorCanvas.cpp:
3538         (WebCore::InspectorCanvas::create):
3539         (WebCore::InspectorCanvas::InspectorCanvas):
3540         (WebCore::InspectorCanvas::canvasElement):
3541         (WebCore::InspectorCanvas::resetRecordingData):
3542         (WebCore::InspectorCanvas::recordAction):
3543         (WebCore::InspectorCanvas::buildObjectForCanvas):
3544         (WebCore::InspectorCanvas::getCanvasContentAsDataURL):
3545         (WebCore::InspectorCanvas::buildInitialState):
3546         (WebCore::InspectorCanvas::~InspectorCanvas): Deleted.
3547
3548         * inspector/InspectorShaderProgram.h:
3549         * inspector/InspectorShaderProgram.cpp:
3550         (WebCore::InspectorShaderProgram::context const):
3551
3552         * page/PageConsoleClient.cpp:
3553         (WebCore::PageConsoleClient::record):
3554         (WebCore::PageConsoleClient::recordEnd):
3555
3556         * dom/Document.h:
3557         * dom/Document.cpp:
3558         (WebCore::Document::getCSSCanvasElement):
3559         (WebCore::Document::nameForCSSCanvasElement const):
3560         We have no reason to save the CSS canvas name for each InspectorCanvas object, so instead we
3561         can just query for the name based on the CanvasRenderingContext's HTMLCanvasElement (assuming
3562         it is not an OffscreenCanvas) when we need it.
3563
3564 2018-01-04  Chris Fleizach  <cfleizach@apple.com>
3565
3566         AX: Implement updated CSS3 Speech for 'speak' and 'speak-as' properties
3567         https://bugs.webkit.org/show_bug.cgi?id=180361
3568
3569         Reviewed by Zalan Bujtas.
3570
3571         Change speak -> speakAs, and allow a combination of properties.
3572
3573         Tests: Updated accessibility/mac/css-speech-speak.html
3574
3575         * accessibility/AccessibilityObject.h:
3576         (WebCore::AccessibilityObject::speakAsProperty const):
3577         (WebCore::AccessibilityObject::speakProperty const): Deleted.
3578         * accessibility/AccessibilityRenderObject.cpp:
3579         (WebCore::AccessibilityRenderObject::speakAsProperty const):
3580         (WebCore::AccessibilityRenderObject::speakProperty const): Deleted.
3581         * accessibility/AccessibilityRenderObject.h:
3582         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
3583         (-[WebAccessibilityObjectWrapper accessibilitySpeechHint]):
3584         * accessibility/mac/WebAccessibilityObjectWrapperBase.h:
3585         * accessibility/mac/WebAccessibilityObjectWrapperBase.mm:
3586         (-[WebAccessibilityObjectWrapperBase baseAccessibilitySpeechHint]):
3587         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
3588         (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
3589         * css/CSSComputedStyleDeclaration.cpp:
3590         (WebCore::speakAsToCSSValue):
3591         (WebCore::ComputedStyleExtractor::propertyValue):
3592         * css/CSSPrimitiveValueMappings.h:
3593         (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
3594         (WebCore::CSSPrimitiveValue::operator ESpeakAs const):
3595         (WebCore::CSSPrimitiveValue::operator ESpeak const): Deleted.
3596         * css/CSSProperties.json:
3597         * css/StyleBuilderConverter.h:
3598         (WebCore::StyleBuilderConverter::convertSpeakAs):
3599         * css/parser/CSSParserFastPaths.cpp:
3600         (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
3601         (WebCore::CSSParserFastPaths::isKeywordPropertyID):
3602         * css/parser/CSSPropertyParser.cpp:
3603         (WebCore::consumeSpeakAs):
3604         (WebCore::CSSPropertyParser::parseSingleValue):
3605         * rendering/style/RenderStyle.h:
3606         (WebCore::RenderStyle::speakAs const):
3607         (WebCore::RenderStyle::setSpeakAs):
3608         (WebCore::RenderStyle::initialSpeakAs):
3609         (WebCore::RenderStyle::speak const): Deleted.
3610         (WebCore::RenderStyle::setSpeak): Deleted.
3611         (WebCore::RenderStyle::initialSpeak): Deleted.
3612         * rendering/style/RenderStyleConstants.h:
3613         (WebCore::operator| ):
3614         (WebCore::operator|= ):
3615         * rendering/style/StyleRareInheritedData.cpp:
3616         (WebCore::StyleRareInheritedData::StyleRareInheritedData):
3617         (WebCore::StyleRareInheritedData::operator== const):
3618         * rendering/style/StyleRareInheritedData.h:
3619
3620 2018-01-04  Brian Burg  <bburg@apple.com>
3621
3622         Web Inspector: Capture Element Screenshot looks fuzzy
3623         https://bugs.webkit.org/show_bug.cgi?id=175734
3624         <rdar://problem/33803377>
3625
3626         Reviewed by Joseph Pecoraro and Simon Fraser.
3627
3628         Screenshots taken by Web Inspector were being downscaled from the
3629         internal size to the logical size, causing them to be blurry when
3630         later upscaled to the internal size.
3631
3632         Replace ScaleBehavior { Scaled, Unscaled } with PreserveResolution { No, Yes }.
3633         This is a lot less confusing to read both inside ImageBuffer and at its use sites.
3634
3635         Remove unused CoordinateSystem argument for ImageBuffer::toDataURL,
3636         and replace it with PreserveResolution. Plumb PreserveResolution into toCFData
3637         so that PreserveResolution::Yes will preserve the internal size of
3638         the image buffer, just as it does in other methods that take PreserveResolution.
3639
3640         At the use site in InspectorPageAgent, always request PreserveResolution::Yes snapshots
3641         when taking an element screenshot. For now, keep using downscaled (smaller)
3642         snapshots when capturing canvas previews, as the previews are not full-size.
3643
3644         Test: inspector/page/hidpi-snapshot-size.html
3645
3646         * html/HTMLCanvasElement.cpp:
3647         (WebCore::HTMLCanvasElement::makePresentationCopy):
3648         (WebCore::HTMLCanvasElement::copiedImage const):
3649         * html/canvas/CanvasRenderingContext2DBase.cpp:
3650         (WebCore::CanvasRenderingContext2DBase::createPattern):
3651         * inspector/agents/InspectorPageAgent.cpp:
3652         (WebCore::InspectorPageAgent::snapshotNode):
3653         (WebCore::InspectorPageAgent::snapshotRect):
3654         * page/TextIndicator.cpp:
3655         (WebCore::takeSnapshot):
3656         * platform/DragImage.cpp:
3657         (WebCore::createDragImageFromSnapshot):
3658         * platform/graphics/BitmapImage.cpp:
3659         (WebCore::BitmapImage::drawPattern):
3660         * platform/graphics/ImageBuffer.h:
3661         * platform/graphics/cairo/ImageBufferCairo.cpp:
3662         (WebCore::ImageBuffer::sinkIntoImage):
3663         (WebCore::ImageBuffer::copyImage const):
3664         (WebCore::ImageBuffer::toDataURL const):
3665         * platform/graphics/cg/ImageBufferCG.cpp:
3666         (WebCore::createBitmapImageAfterScalingIfNeeded):
3667         (WebCore::ImageBuffer::copyImage const):
3668         (WebCore::ImageBuffer::sinkIntoImage):
3669         (WebCore::ImageBuffer::toDataURL const):
3670         (WebCore::ImageBuffer::toData const):
3671         (WebCore::ImageBuffer::toCFData const):
3672         * platform/graphics/gtk/ImageBufferGtk.cpp:
3673         (WebCore::ImageBuffer::toDataURL const):
3674         * platform/graphics/win/ImageBufferDirect2D.cpp:
3675         (WebCore::ImageBuffer::copyImage const):
3676         (WebCore::ImageBuffer::sinkIntoImage):
3677         (WebCore::ImageBuffer::toDataURL const):
3678         * svg/graphics/SVGImage.cpp:
3679         (WebCore::SVGImage::drawPatternForContainer):
3680
3681 2018-01-04  John Wilander  <wilander@apple.com>
3682
3683         Storage Access API: Turn feature on by default in Settings.yaml
3684         https://bugs.webkit.org/show_bug.cgi?id=181298
3685         <rdar://problem/36302506>
3686
3687         Reviewed by Brent Fulgham.
3688
3689         No new tests. This is just a feature settings change.
3690
3691         * page/Settings.yaml:
3692
3693 2018-01-04  Zalan Bujtas  <zalan@apple.com>
3694
3695         WebContent process crashes while loading https://www.classicspecs.com
3696         https://bugs.webkit.org/show_bug.cgi?id=181290
3697         <rdar://problem/36225906>
3698
3699         Reviewed by Simon Fraser.
3700
3701         Floats can overhang multiple blocks (they are called intruding floats).
3702         Each block keeps track of such intruding floats. When an overhanging float box is destroyed,
3703         we need to deregister it from all those blocks. We do it by walking up the ancestor block chain
3704         and check if the parent (grandparent etc) block still contains this float. Once we find the topmost block, 
3705         we start deregistering it by traversing back on the descendant blocks.
3706         Normally we do it in RenderElement::takeChildInternal right before the box is getting detached.
3707         However in certain cases (like when the float's parent happens to be an anonymous wrapper)
3708         by the time we get to ::takeChildInternal the subtree is already detached and we can't access all the
3709         ancestors.
3710         This patch ensure that the floating box is still attached during de-registration. 
3711
3712         Test: fast/block/float/crash-when-intruding-float-has-anonymous-parent-and-detach.html
3713
3714         * rendering/RenderObject.cpp:
3715         (WebCore::RenderObject::removeFromParentAndDestroyCleaningUpAnonymousWrappers):
3716
3717 2018-01-04  Eric Carlson  <eric.carlson@apple.com>
3718
3719         [MediaStream] Add Mock screen capture source
3720         https://bugs.webkit.org/show_bug.cgi?id=181291
3721         <rdar://problem/36298164>
3722
3723         Reviewed by Dean Jackson.
3724
3725         Tests:  http/tests/media/media-stream/get-display-media-prompt.html
3726                 GetDisplayMediaTest.BasicPrompt
3727                 GetDisplayMediaTest.Constraints
3728
3729         * Modules/mediastream/MediaDevices.cpp:
3730         (WebCore::MediaDevices::MediaDevices): Add static_assert to ensure MediaDevices::DisplayCaptureSurfaceType
3731         and RealtimeMediaSourceSettings::DisplaySurfaceType values are equivalent.
3732         (WebCore::MediaDevices::getSupportedConstraints): Remove bogus code.
3733         * Modules/mediastream/MediaDevices.h: Add DisplayCaptureSurfaceType.
3734         * Modules/mediastream/MediaDevices.idl: Ditto.
3735
3736         * Modules/mediastream/MediaStreamTrack.cpp:
3737         (WebCore::MediaStreamTrack::getSettings const): Add a FIXME.
3738         * Modules/mediastream/MediaStreamTrack.h: Add displaySurface and logicalSurface.
3739
3740         * Modules/mediastream/MediaTrackSupportedConstraints.h: Remove displaySurface and logicalSurface.
3741         * Modules/mediastream/MediaTrackSupportedConstraints.idl:
3742
3743         * SourcesCocoa.txt: Add DisplayCaptureManagerCocoa.cpp and DisplayCaptureSourceCocoa.cpp.
3744
3745         * WebCore.xcodeproj/project.pbxproj: Ditto.
3746
3747         * platform/mediastream/CaptureDevice.h:
3748         (WebCore::CaptureDevice::encode const): Add.
3749         (WebCore::CaptureDevice::decode):
3750
3751         * platform/mediastream/RealtimeMediaSourceCenter.cpp:
3752         (WebCore::RealtimeMediaSourceCenter::getMediaStreamDevices): Include display capture "devices".
3753         (WebCore::RealtimeMediaSourceCenter::validateRequestConstraints): Deal with display capture devices.
3754         (WebCore::RealtimeMediaSourceCenter::captureDeviceWithPersistentID): Ditto.
3755         * platform/mediastream/RealtimeMediaSourceCenter.h:
3756
3757         * platform/mediastream/RealtimeMediaSourceSettings.h:
3758         (WebCore::RealtimeMediaSourceSettings::displaySurface const): Return a DisplaySurfaceType.
3759         (WebCore::RealtimeMediaSourceSettings::setDisplaySurface): Take a DisplaySurfaceType.
3760
3761         * platform/mediastream/mac/DisplayCaptureManagerCocoa.cpp:
3762         (WebCore::DisplayCaptureManagerCocoa::singleton):
3763         (WebCore::DisplayCaptureManagerCocoa::~DisplayCaptureManagerCocoa):
3764         (WebCore::DisplayCaptureManagerCocoa::captureDevices):
3765         (WebCore::DisplayCaptureManagerCocoa::screenCaptureDeviceWithPersistentID):
3766         (WebCore::DisplayCaptureManagerCocoa::captureDeviceWithPersistentID):
3767         * platform/mediastream/mac/DisplayCaptureManagerCocoa.h:
3768
3769         * platform/mediastream/mac/DisplayCaptureSourceCocoa.cpp: Added.
3770         (WebCore::DisplayCaptureSourceCocoa::DisplayCaptureSourceCocoa):
3771         (WebCore::DisplayCaptureSourceCocoa::~DisplayCaptureSourceCocoa):
3772         (WebCore::DisplayCaptureSourceCocoa::capabilities const):
3773         (WebCore::DisplayCaptureSourceCocoa::settings const):
3774         (WebCore::DisplayCaptureSourceCocoa::settingsDidChange):
3775         (WebCore::DisplayCaptureSourceCocoa::startProducingData):
3776         (WebCore::DisplayCaptureSourceCocoa::stopProducingData):
3777         (WebCore::DisplayCaptureSourceCocoa::elapsedTime):
3778         (WebCore::DisplayCaptureSourceCocoa::applyFrameRate):
3779         (WebCore::DisplayCaptureSourceCocoa::emitFrame):
3780         * platform/mediastream/mac/DisplayCaptureSourceCocoa.h:
3781
3782         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp:
3783         (WebCore::RealtimeMediaSourceCenterMac::displayCaptureDeviceManager): New.
3784         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.h:
3785
3786         * platform/mock/MockRealtimeMediaSource.cpp:
3787         (WebCore::deviceMap): Add screen capture "devices".
3788         (WebCore::MockRealtimeMediaSource::displayDevices): New.
3789         * platform/mock/MockRealtimeMediaSource.h:
3790
3791         * platform/mock/MockRealtimeMediaSourceCenter.cpp: Clean up includes.
3792         * platform/mock/MockRealtimeMediaSourceCenter.h:
3793
3794         * platform/mock/MockRealtimeVideoSource.cpp:
3795         (WebCore::MockRealtimeVideoSource::MockRealtimeVideoSource): Mock two screen devices.
3796         (WebCore::MockRealtimeVideoSource::updateSettings): Deal with mock screens.
3797         (WebCore::MockRealtimeVideoSource::initializeCapabilities): Ditto.
3798         (WebCore::MockRealtimeVideoSource::initializeSupportedConstraints): Ditto.
3799         (WebCore::MockRealtimeVideoSource::drawText): Ditto.
3800         (WebCore::MockRealtimeVideoSource::generateFrame): Ditto.
3801         * platform/mock/MockRealtimeVideoSource.h:
3802         (WebCore::MockRealtimeVideoSource::mockCamera const):
3803         (WebCore::MockRealtimeVideoSource::mockScreen const):
3804
3805 2018-01-04  Youenn Fablet  <youenn@apple.com>
3806
3807         FetchResponse should set its internal response text encoding name
3808         https://bugs.webkit.org/show_bug.cgi?id=181284
3809
3810         Reviewed by Alex Christensen.
3811
3812         Covered by rebased test.
3813
3814         * Modules/fetch/FetchResponse.cpp:
3815         (WebCore::FetchResponse::create): Set response text encoding based on content type charset.
3816
3817 2018-01-04  John Wilander  <wilander@apple.com>
3818
3819         Storage Access API: Remove JavaScript confirm() prompt from Document::requestStorageAccess()
3820         https://bugs.webkit.org/show_bug.cgi?id=181276
3821         <rdar://problem/36290463>
3822
3823         Reviewed by Alex Christensen.
3824
3825         No new tests. Existing test expectations updated.
3826
3827         * dom/Document.cpp:
3828         (WebCore::Document::requestStorageAccess):
3829
3830 2018-01-04  Carlos Garcia Campos  <cgarcia@igalia.com>
3831
3832         [GTK] Issues with Ahem's ex / x-height
3833         https://bugs.webkit.org/show_bug.cgi?id=180581
3834
3835         Reviewed by Michael Catanzaro.
3836
3837         Get the x-height value from the TT_OS2 table if available.
3838
3839         Fixes: fast/text/break-word-pre-wrap.html
3840                imported/w3c/web-platform-tests/css/css-shapes-1/shape-outside/values/shape-outside-shape-arguments-000.html
3841
3842         * platform/graphics/freetype/SimpleFontDataFreeType.cpp:
3843         (WebCore::Font::platformInit):
3844
3845 2018-01-04  Philippe Normand  <pnormand@igalia.com>
3846
3847         Unreviewed, GTK build fix attempt after r226357
3848
3849         * platform/graphics/gstreamer/GStreamerUtilities.h: The
3850         GST_BUFFER_DTS_OR_PTS macro was added in GStreamer 1.8 but old
3851         versions of Debian might not have this release yet.
3852
3853 2018-01-04  Youenn Fablet  <youenn@apple.com>
3854
3855         Implement Cache API partitioning based on ClientOrigin
3856         https://bugs.webkit.org/show_bug.cgi?id=181240
3857
3858         Reviewed by Alex Christensen.
3859
3860         Covered by updated tests.
3861
3862         Previously, cache storage was partitioned according the origin of the client, represented as a String.
3863         We now partition according both client and top origins, represented as a ClientOrigin
3864
3865         Minor refactoring to use more makePendingActivity.
3866         Added support for IPC serialization of ClientOrigin.
3867         Added SecurityOriginData::toString which is used by WebKit2 Cache Storage implementation.
3868
3869         * Modules/cache/CacheStorageConnection.cpp:
3870         (WebCore::CacheStorageConnection::open):
3871         (WebCore::CacheStorageConnection::retrieveCaches):
3872         * Modules/cache/CacheStorageConnection.h:
3873         (WebCore::CacheStorageConnection::clearMemoryRepresentation):
3874         (WebCore::CacheStorageConnection::doOpen):
3875         (WebCore::CacheStorageConnection::doRetrieveCaches):
3876         * Modules/cache/DOMCacheStorage.cpp:
3877         (WebCore::DOMCacheStorage::origin const):
3878         (WebCore::DOMCacheStorage::retrieveCaches):
3879         (WebCore::DOMCacheStorage::open):
3880         (WebCore::DOMCacheStorage::remove):
3881         * Modules/cache/DOMCacheStorage.h:
3882         * Modules/cache/WorkerCacheStorageConnection.cpp:
3883         (WebCore::WorkerCacheStorageConnection::doOpen):
3884         (WebCore::WorkerCacheStorageConnection::doRetrieveCaches):
3885         * Modules/cache/WorkerCacheStorageConnection.h:
3886         * page/ClientOrigin.h:
3887         (WebCore::ClientOrigin::isolatedCopy const):
3888         (WebCore::ClientOrigin::encode const):
3889         (WebCore::ClientOrigin::decode):
3890         * page/SecurityOriginData.cpp:
3891         (WebCore::SecurityOriginData::toString const):
3892         (WebCore::SecurityOriginData::debugString const): Deleted.
3893         * page/SecurityOriginData.h:
3894         (WebCore::SecurityOriginData::debugString const):
3895         * testing/Internals.cpp:
3896         (WebCore::Internals::clearCacheStorageMemoryRepresentation):
3897
3898 2018-01-04  Youenn Fablet  <youenn@apple.com>
3899
3900         Service Worker should expose redirect mode for navigation loads as manual
3901         https://bugs.webkit.org/show_bug.cgi?id=181067
3902
3903         Reviewed by Alex Christensen.
3904
3905         Covered by rebased tests.
3906
3907         * loader/CrossOriginAccessControl.cpp: Removing ContentType header only if affecting CORS checks.
3908         This allows extending header filtering in service worker to all modes, including Navigate.
3909         * workers/service/context/ServiceWorkerFetch.cpp:
3910         (WebCore::ServiceWorkerFetch::dispatchFetchEvent): Ideally, document loading code should set redirect to manual.
3911         Since it is not the case yet and that would require changes to various places, manual is set before exposing the corresponding fetch event.
3912
3913 2018-01-04  Youenn Fablet  <youenn@apple.com>
3914
3915         ServiceWorkerThreadProxy::postTaskForModeToWorkerGlobalScope should be a no-op if worker is being terminated
3916         https://bugs.webkit.org/show_bug.cgi?id=181245
3917
3918         Reviewed by Alex Christensen.
3919
3920         Stop appending tasks to a terminating worker and returning false in that case.
3921         This mirrors what is done for regular workers.
3922
3923         * workers/service/context/SWContextManager.cpp:
3924         (WebCore::SWContextManager::terminateWorker):
3925         * workers/service/context/ServiceWorkerThreadProxy.cpp:
3926         (WebCore::ServiceWorkerThreadProxy::postTaskForModeToWorkerGlobalScope):
3927         * workers/service/context/ServiceWorkerThreadProxy.h:
3928
3929 2018-01-04  Youenn Fablet  <youenn@apple.com>
3930
3931         Cancel pending script loads when service worker is being terminated
3932         https://bugs.webkit.org/show_bug.cgi?id=181250
3933
3934         Reviewed by Alex Christensen.
3935
3936         Covered by service worker tests no longer crashing in ASAN builds.
3937
3938         * workers/WorkerScriptLoader.cpp:
3939         (WebCore::WorkerScriptLoader::notifyFinished): Clearing loader when finished.
3940         (WebCore::WorkerScriptLoader::cancel): Implementing cancel of a script loader by cancelling the underlying threadable loader.
3941         * workers/WorkerScriptLoader.h:
3942         * workers/service/ServiceWorkerContainer.cpp: Canceling loads of all pending jobs.
3943         (WebCore::ServiceWorkerContainer::stop):
3944         * workers/service/ServiceWorkerJob.cpp:
3945         (WebCore::ServiceWorkerJob::cancelPendingLoad):
3946         * workers/service/ServiceWorkerJob.h:
3947
3948 2018-01-04  Youenn Fablet  <youenn@apple.com>
3949
3950         Implement  https://fetch.spec.whatwg.org/#main-fetch default referrer policy setting
3951         https://bugs.webkit.org/show_bug.cgi?id=181239
3952
3953         Reviewed by Alex Christensen.
3954
3955         Covered by updated and rebased test.
3956
3957         Setting the request referrer policy to the Document referrer policy if no one is set.
3958         If Document has no referrer policy, use no-referrer-when-downgrade as per the spec.
3959
3960         * loader/cache/CachedResourceLoader.cpp:
3961         (WebCore::CachedResourceLoader::updateHTTPRequestHeaders):
3962         (WebCore::CachedResourceLoader::requestResource):
3963         * loader/cache/CachedResourceLoader.h:
3964         * loader/cache/CachedResourceRequest.cpp:
3965         (WebCore::CachedResourceRequest::updateReferrerPolicy):
3966         (WebCore::CachedResourceRequest::updateReferrerOriginAndUserAgentHeaders):
3967         * loader/cache/CachedResourceRequest.h:
3968
3969 2018-01-03  Wenson Hsieh  <wenson_hsieh@apple.com>
3970
3971         [Attachment Support] Create attachment elements when dropping files on iOS
3972         https://bugs.webkit.org/show_bug.cgi?id=181192
3973         <rdar://problem/36280945>
3974
3975         Reviewed by Tim Horton.
3976
3977         Implements support for dropping data as attachment elements on iOS. See comments below for more detail.
3978
3979         Tests:  WKAttachmentTests.InsertDroppedRichAndPlainTextFilesAsAttachments
3980                 WKAttachmentTests.InsertDroppedZipArchiveAsAttachment
3981                 WKAttachmentTests.InsertDroppedItemProvidersInOrder
3982
3983         * WebCore.xcodeproj/project.pbxproj:
3984         * editing/WebContentReader.cpp:
3985         (WebCore::WebContentReader::ensureFragment):
3986
3987         Add a new helper to create the WebContentReader's fragment, if it hasn't already been created.
3988
3989         * editing/WebContentReader.h:
3990         * editing/cocoa/WebContentReaderCocoa.mm:
3991         (WebCore::WebContentReader::readFilePaths):
3992
3993         Rename readFilenames to readFilePaths (which better reflects its parameters, which are file paths). Also, move
3994         the implementation of readFilePaths to shared iOS/macOS code in WebContentReaderCocoa, and remove the stub
3995         implementation on iOS.
3996
3997         There's a bit of code here that I kept macOS-only which deals with inserting file paths as plain text in
3998         editable areas, but it's unclear to me why and if WebKit clients currently find this useful, so I left a FIXME
3999         to investigate removing this altogether. Code for handling this plain text insertion of file path