Fixed elements bounce when rubber-banding at the bottom of the page
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2017-02-17  Simon Fraser  <simon.fraser@apple.com>
2
3         Fixed elements bounce when rubber-banding at the bottom of the page
4         https://bugs.webkit.org/show_bug.cgi?id=168493
5         rdar://problem/30567713
6
7         Reviewed by Tim Horton.
8
9         FrameView::visibleDocumentRect() was computing a bad visible rect when bottom-rubber-banding,
10         by adding rubberBandBottom which is negative, rather than subtracting.
11
12         Log some more scrolling stuff.
13
14         Ironically, the existing test didn't test stick-to-viewport fixed position because
15         backgroundShouldExtendBeyondPage() is off by default in WTR, so clone it to a test
16         that sets this, to test both behaviors.
17
18         This also revealed that dynamic changes to backgroundShouldExtendBeyondPage() need
19         to be propagated to the scrolling tree, which is fixed in AsyncScrollingCoordinator::frameViewLayoutUpdated().
20
21         Test: fast/visual-viewport/rubberbanding-viewport-rects-extended-background.html
22
23         * page/FrameView.cpp:
24         (WebCore::FrameView::updateLayoutViewport):
25         (WebCore::FrameView::visibleDocumentRect):
26         * page/scrolling/AsyncScrollingCoordinator.cpp:
27         (WebCore::AsyncScrollingCoordinator::frameViewLayoutUpdated):
28         * page/scrolling/ScrollingStateFrameScrollingNode.cpp:
29         (WebCore::ScrollingStateFrameScrollingNode::dumpProperties):
30         * page/scrolling/ScrollingTreeFrameScrollingNode.cpp:
31         (WebCore::ScrollingTreeFrameScrollingNode::layoutViewportForScrollPosition):
32         * page/scrolling/mac/ScrollingCoordinatorMac.mm:
33         (WebCore::ScrollingCoordinatorMac::scheduleTreeStateCommit):
34         (WebCore::ScrollingCoordinatorMac::commitTreeState):
35
36 2017-02-17  Simon Fraser  <simon.fraser@apple.com>
37
38         REGRESSION (209396): Apple Pay buttons do not render
39         https://bugs.webkit.org/show_bug.cgi?id=168523
40         rdar://problem/30451563
41
42         Reviewed by Geoffrey Garen.
43
44         The new CSS parser mistakenly converted -apple-pay-button values to
45         -webkit-pay-button, breaking -webkit-appearance: -apple-pay-button.
46
47         Fix by excluding "-apple-pay" prefixed values from the conversion.
48
49         Test: fast/css/appearance-apple-pay-button.html
50
51         * css/parser/CSSPropertyParser.cpp:
52         (WebCore::isAppleLegacyCssValueKeyword):
53
54 2017-02-17  Commit Queue  <commit-queue@webkit.org>
55
56         Unreviewed, rolling out r212463.
57         https://bugs.webkit.org/show_bug.cgi?id=168526
58
59         Some crashes with GuardMalloc (Requested by anttik on
60         #webkit).
61
62         Reverted changeset:
63
64         "Execute pending scripts asynchronously after stylesheet loads
65         complete"
66         https://bugs.webkit.org/show_bug.cgi?id=168367
67         http://trac.webkit.org/changeset/212463
68
69 2017-02-16  Brent Fulgham  <bfulgham@apple.com>
70
71         RenderView needs to be updated when FrameView changes
72         https://bugs.webkit.org/show_bug.cgi?id=168481
73         <rdar://problem/30339638>
74
75         Reviewed by Andreas Kling.
76
77         The state of the Document's RenderView can get out of sync with the Frame's FrameView.
78         We need a notification mechanism so that modifications to the Frame's view are properly
79         relayed to Document so that it can have a correct RenderView.
80
81         * dom/Document.cpp:
82         (WebCore::Document::didBecomeCurrentDocumentInView): Create an updated render tree (if
83         one does not already exist).
84         (WebCore::Document::destroyRenderTree): Remove an incorrect ASSERT. We may enter this
85         code when the Frame uses 'setView(nullptr)', which happens during certain  updates.
86         * dom/Document.h:
87         * page/Frame.cpp:
88         (WebCore::Frame::setView): Destroy the old render tree (if present) before switching to
89         the new view. Then notify the document that it is now the current document in the new view.
90
91 2017-02-17  Enrique Ocaña González  <eocanha@igalia.com>
92
93         [GStreamer] Fast replay on video hide/unhide on platforms with limited video buffer pools
94         https://bugs.webkit.org/show_bug.cgi?id=168505
95
96         Reviewed by Žan Doberšek.
97
98         The WebKit code isn't consuming the video samples when the video layer is hidden,
99         so the buffers aren't being returned to the pool and starve the decoder when the
100         buffer pool runs out of buffers (on platforms using a buffer pool and a custom
101         allocator, such as OMX on the Raspberry Pi 2). When the video layer is restored,
102         the pipeline tries to catch up and the user sees the video "going fast forward".
103
104         The added code "consumes" (removes and unrefs) the buffer in that case. However,
105         the sample isn't completely removed because it still holds important info (eg:
106         caps) needed for the proper operation of the video element.
107
108         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
109         (WebCore::MediaPlayerPrivateGStreamerBase::pushTextureToCompositor):
110
111 2017-02-17  Carlos Garcia Campos  <cgarcia@igalia.com>
112
113         [SOUP] Stop removing the fragment identifier from resource requests
114         https://bugs.webkit.org/show_bug.cgi?id=168509
115
116         Reviewed by Sergio Villar Senin.
117
118         I don't know why, but have always removed the fragment identifier from the URL when creating the SoupURI that
119         is passed to libsoup. Maybe it was a bug in a very old version of libsoup, but it doesn't look necessary anymore
120         and it's causing several layout test failures.
121
122         Fixes: http/tests/svg/svg-use-external.html
123                imported/w3c/web-platform-tests/html/webappapis/scripting/processing-model-2/compile-error-same-origin-with-hash.html
124                imported/w3c/web-platform-tests/html/webappapis/scripting/processing-model-2/runtime-error-same-origin-with-hash.html
125
126         * platform/network/soup/ResourceRequestSoup.cpp:
127         (WebCore::ResourceRequest::createSoupURI): Do not remove the fragment identifier from the URL.
128
129 2017-02-16  Yusuke Suzuki  <utatane.tea@gmail.com>
130
131         [JSC] Drop PassRefPtr from ArrayBuffer
132         https://bugs.webkit.org/show_bug.cgi?id=168455
133
134         Reviewed by Geoffrey Garen.
135
136         * bindings/js/SerializedScriptValue.cpp:
137         (WebCore::CloneDeserializer::readArrayBufferView):
138         * css/FontFace.cpp:
139         (WebCore::FontFace::create):
140         * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp:
141         (WebCore::MediaPlayerPrivateAVFoundation::extractKeyURIKeyIDAndCertificateFromInitData):
142         * platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp:
143         (WebCore::AVFWrapper::shouldWaitForLoadingOfResource):
144         * platform/graphics/avfoundation/objc/CDMSessionAVFoundationObjC.mm:
145         (WebCore::CDMSessionAVFoundationObjC::generateKeyRequest):
146         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
147         (WebCore::MediaPlayerPrivateAVFoundationObjC::shouldWaitForLoadingOfResource):
148
149 2017-02-16  Simon Fraser  <simon.fraser@apple.com>
150
151         REGRESSION(r212439): Web Inspector Toolbar / Window appears broken
152         https://bugs.webkit.org/show_bug.cgi?id=168494
153
154         Reviewed by Joseph Pecoraro.
155
156         Missed one conversion from acceleratesDrawing to drawsAsynchronously, which
157         caused non-Whippet GrpahicsContext shadow drawing to happen unexpectedly.
158
159         * platform/graphics/ca/cocoa/WebTiledBackingLayer.mm:
160         (-[WebTiledBackingLayer drawsAsynchronously]):
161         (-[WebTiledBackingLayer acceleratesDrawing]): Deleted.
162
163 2017-02-16  Chris Dumez  <cdumez@apple.com>
164
165         <input>.labels is empty if type changes from text->hidden->checkbox
166         https://bugs.webkit.org/show_bug.cgi?id=168358
167
168         Reviewed by Ryosuke Niwa.
169
170         We were invalidating LabelsNodeLists on 'for' attribute change.
171         We now also invalidate them of 'type' attribute change since
172         HTMLInputElements whose type is 'hidden' do not support labels.
173
174         No new tests, updated existing test.
175
176         * dom/Document.h:
177         * dom/LiveNodeList.h:
178         (WebCore::shouldInvalidateTypeOnAttributeChange):
179         * html/LabelsNodeList.cpp:
180         (WebCore::LabelsNodeList::LabelsNodeList):
181
182 2017-02-16  Michael Catanzaro  <mcatanzaro@igalia.com>
183
184         Remove even more EFL from WebCore
185         https://bugs.webkit.org/show_bug.cgi?id=168485
186
187         Reviewed by Alex Christensen.
188
189         * accessibility/atk/WebKitAccessibleWrapperAtk.cpp:
190         (webkitAccessibleGetAttributes):
191         (atkRole):
192         * css/StyleRule.cpp:
193         (WebCore::StyleRuleBase::copy):
194         * platform/ContextMenuItem.h:
195         * platform/graphics/OpenGLESShims.h:
196         * platform/graphics/PlatformDisplay.cpp:
197         (WebCore::PlatformDisplay::createPlatformDisplay):
198         * platform/graphics/PlatformDisplay.h:
199         * platform/graphics/cairo/ImageBufferCairo.cpp:
200         * platform/graphics/freetype/SimpleFontDataFreeType.cpp:
201         (WebCore::Font::platformInit):
202         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
203         (WebCore::MediaPlayerPrivateGStreamer::MediaPlayerPrivateGStreamer):
204         * platform/graphics/texmap/GraphicsLayerTextureMapper.cpp:
205         (WebCore::GraphicsLayerTextureMapper::setContentsToImage):
206         * platform/graphics/texmap/TextureMapperGC3DPlatformLayer.cpp:
207         * platform/graphics/texmap/TextureMapperGC3DPlatformLayer.h:
208         * platform/network/soup/ResourceErrorSoup.cpp:
209         (WebCore::ResourceError::timeoutError):
210         * platform/network/soup/SoupNetworkSession.cpp:
211         (WebCore::SoupNetworkSession::setProxySettingsFromEnvironment): Deleted.
212         * platform/network/soup/SoupNetworkSession.h:
213
214 2017-02-16  Daniel Bates  <dabates@apple.com>
215
216         Remove Chromium-specific code to call FrameLoaderClient::redirectDataToPlugin(nullptr)
217         https://bugs.webkit.org/show_bug.cgi?id=168417
218         <rdar://problem/30541748>
219
220         Reviewed by Brent Fulgham.
221
222         Remove Chromium-specific code that was added in r125500 to call FrameLoaderClient::redirectDataToPlugin(nullptr)
223         in PluginDocument::detachFromPluginElement(). Calling redirectDataToPlugin() with nullptr was used by the
224         Chromium port to signify that the plugin document was being destroyed so that they could tear down their
225         plugin widget. And PluginDocument::detachFromPluginElement() is the only place that calls redirectDataToPlugin()
226         passing nullptr. No other port made use of this machinery and the Chromium port has long since been removed
227         from the Open Source WebKit Project. We should remove this code.
228
229         * html/PluginDocument.cpp:
230         (WebCore::PluginDocumentParser::appendBytes): Pass the plugin widget by reference.
231         (WebCore::PluginDocument::detachFromPluginElement): Remove call to FrameLoaderClient::redirectDataToPlugin().
232         This call was only used by the Chromium port as means to be notified when the plugin document was being
233         destroyed. No other port made use of this notification or needed such a notification.
234         * loader/EmptyClients.cpp: Change argument of redirectDataToPlugin() from Widget* to Widget& to convey
235         that this function always takes a valid Widget. Also remove unnecessary argument name as the data type
236         of the argument and the name of the function sufficiently describes the purpose of the argument.
237         * loader/FrameLoaderClient.h: Ditto.
238
239 2017-02-16  Myles C. Maxfield  <mmaxfield@apple.com>
240
241         font-weight in @font-face can cause a font to be downloaded even when it's not used
242         https://bugs.webkit.org/show_bug.cgi?id=168114
243         <rdar://problem/30301317>
244
245         Reviewed by Darin Adler.
246
247         There were two problems with our font loading code.
248
249         When we are in the middle of a download, we will use a special interstitial font,
250         and this special font has a flag set which will cause it to be invisible when it is
251         drawn. However, when we start using this font during the load, we give it a
252         unicode-range of U+0-0 which means that it will never be used, and fallback will
253         happen to other weights immediately. 
254
255         The second problem with the font loading code is that this interstital font is just
256         Times. Times doesn't support every character, which means that if we are trying
257         to render some exotic character, we fall back to other weights. The solution here
258         is to use LastResort as the interstitial font, because it supports all characters.
259         Because its metrics are reasonable and we don't ever actually paint this
260         interstitial font, this choice is no worse than Times.
261
262         Tests: fast/text/font-style-download.html
263                fast/text/font-weight-download-2.html
264                fast/text/font-weight-download.html
265                fast/text/font-weight-fallback.html
266
267         * css/CSSFontFace.cpp:
268         (WebCore::CSSFontFace::font):
269         * css/CSSSegmentedFontFace.cpp:
270         (WebCore::appendFont):
271         (WebCore::CSSSegmentedFontFace::fontRanges):
272         (WebCore::appendFontWithInvalidUnicodeRangeIfLoading): Deleted.
273         * platform/graphics/Font.h:
274         (WebCore::Font::widthForGlyph):
275         * platform/graphics/FontCache.h:
276         * platform/graphics/freetype/FontCacheFreeType.cpp:
277         (WebCore::FontCache::lastResortFallbackFontForEveryCharacter):
278         * platform/graphics/mac/FontCacheMac.mm:
279         (WebCore::FontCache::lastResortFallbackFontForEveryCharacter):
280         * platform/graphics/win/FontCacheWin.cpp:
281         (WebCore::FontCache::lastResortFallbackFontForEveryCharacter):
282
283 2017-02-16  Alex Christensen  <achristensen@webkit.org>
284
285         Remove EFL-specific files in Source.
286
287         Rubber-stamped by Anders Carlsson.
288
289         * editing/efl: Removed.
290         * page/efl: Removed.
291         * platform/audio/efl: Removed.
292         * platform/efl: Removed.
293         * platform/efl/DefaultTheme: Removed.
294         * platform/efl/DefaultTheme/widget: Removed.
295         * platform/efl/DefaultTheme/widget/button: Removed.
296         * platform/efl/DefaultTheme/widget/check: Removed.
297         * platform/efl/DefaultTheme/widget/combo: Removed.
298         * platform/efl/DefaultTheme/widget/entry: Removed.
299         * platform/efl/DefaultTheme/widget/progressbar: Removed.
300         * platform/efl/DefaultTheme/widget/radio: Removed.
301         * platform/efl/DefaultTheme/widget/scrollbar: Removed.
302         * platform/efl/DefaultTheme/widget/search: Removed.
303         * platform/efl/DefaultTheme/widget/search/cancel: Removed.
304         * platform/efl/DefaultTheme/widget/search/decoration: Removed.
305         * platform/efl/DefaultTheme/widget/search/field: Removed.
306         * platform/efl/DefaultTheme/widget/slider: Removed.
307         * platform/efl/DefaultTheme/widget/spinner: Removed.
308         * platform/gamepad/efl: Removed.
309         * platform/graphics/efl: Removed.
310         * platform/graphics/surfaces/efl: Removed.
311         * platform/network/efl: Removed.
312
313 2017-02-16  Simon Fraser  <simon.fraser@apple.com>
314
315         Add WebUSB to features.json as a "Not Considering".
316
317         * features.json:
318
319 2017-02-16  Alex Christensen  <achristensen@webkit.org>
320
321         Remove old URL parser
322         https://bugs.webkit.org/show_bug.cgi?id=168483
323
324         Reviewed by Tim Horton.
325
326         * platform/URL.cpp:
327         (WebCore::isSchemeFirstChar):
328         (WebCore::isSchemeChar):
329         (WebCore::URL::URL):
330         (WebCore::URL::setProtocol):
331         (WebCore::URL::setHost):
332         (WebCore::URL::removePort):
333         (WebCore::URL::setPort):
334         (WebCore::URL::setHostAndPort):
335         (WebCore::URL::setUser):
336         (WebCore::URL::setPass):
337         (WebCore::URL::setFragmentIdentifier):
338         (WebCore::URL::setQuery):
339         (WebCore::URL::setPath):
340         (WebCore::URL::serialize):
341         (WebCore::isUserInfoChar): Deleted.
342         (WebCore::isHostnameChar): Deleted.
343         (WebCore::isIPv6Char): Deleted.
344         (WebCore::isPathSegmentEndChar): Deleted.
345         (WebCore::appendASCII): Deleted.
346         (WebCore::findFirstOf): Deleted.
347         (WebCore::checkEncodedString): Deleted.
348         (WebCore::URL::init): Deleted.
349         (WebCore::appendEscapingBadChars): Deleted.
350         (WebCore::escapeAndAppendNonHierarchicalPart): Deleted.
351         (WebCore::copyPathRemovingDots): Deleted.
352         (WebCore::hasSlashDotOrDotDot): Deleted.
353         (WebCore::URL::parse): Deleted.
354         (WebCore::cannotBeABaseURL): Deleted.
355         (WebCore::isDefaultPortForScheme): Deleted.
356         (WebCore::hostPortIsEmptyButCredentialsArePresent): Deleted.
357         (WebCore::isNonFileHierarchicalScheme): Deleted.
358         (WebCore::isCanonicalHostnameLowercaseForScheme): Deleted.
359         (WebCore::findHostnamesInMailToURL): Deleted.
360         (WebCore::findHostnameInHierarchicalURL): Deleted.
361         (WebCore::encodeHostnames): Deleted.
362         (WebCore::encodeRelativeString): Deleted.
363         (WebCore::substituteBackslashes): Deleted.
364         * platform/URLParser.cpp:
365         (WebCore::URLParser::URLParser):
366         (WebCore::URLParser::setEnabled): Deleted.
367         (WebCore::URLParser::enabled): Deleted.
368         * platform/URLParser.h:
369         * platform/cf/URLCF.cpp:
370         (WebCore::URL::URL):
371         * platform/mac/URLMac.mm:
372         (WebCore::URL::URL):
373
374 2017-02-16  Anders Carlsson  <andersca@apple.com>
375
376         Build fixes.
377
378         * page/gtk/EventHandlerGtk.cpp:
379         (WebCore::EventHandler::createDraggingDataTransfer):
380         * page/win/EventHandlerWin.cpp:
381         (WebCore::EventHandler::createDraggingDataTransfer):
382
383 2017-02-16  Anders Carlsson  <andersca@apple.com>
384
385         Remove EFL from WebCore
386         https://bugs.webkit.org/show_bug.cgi?id=168477
387
388         Reviewed by Brian Burg.
389
390         * accessibility/AccessibilityList.cpp:
391         (WebCore::AccessibilityList::childHasPseudoVisibleListItemMarkers):
392         * accessibility/AccessibilityNodeObject.cpp:
393         (WebCore::AccessibilityNodeObject::canSetValueAttribute):
394         * accessibility/AccessibilityObject.cpp:
395         (WebCore::AccessibilityObject::AccessibilityObject):
396         (WebCore::AccessibilityObject::textIteratorBehaviorForTextRange):
397         * accessibility/AccessibilityObject.h:
398         * accessibility/AccessibilityRenderObject.cpp:
399         (WebCore::AccessibilityRenderObject::determineAccessibilityRole):
400         * accessibility/AccessibilityTableColumn.cpp:
401         (WebCore::AccessibilityTableColumn::computeAccessibilityIsIgnored):
402         * accessibility/AccessibilityTableHeaderContainer.cpp:
403         (WebCore::AccessibilityTableHeaderContainer::computeAccessibilityIsIgnored):
404         * crypto/CryptoKey.cpp:
405         * crypto/keys/CryptoKeyRSA.h:
406         * dom/Document.cpp:
407         (WebCore::Document::implicitClose):
408         * editing/Editor.cpp:
409         (WebCore::Editor::performCutOrCopy):
410         (WebCore::Editor::copyImage):
411         * editing/Editor.h:
412         * editing/FrameSelection.h:
413         * html/HTMLCanvasElement.cpp:
414         (WebCore::requiresAcceleratedCompositingForWebGL):
415         * inspector/InspectorFrontendHost.cpp:
416         (WebCore::InspectorFrontendHost::port):
417         * loader/HistoryController.cpp:
418         (WebCore::HistoryController::restoreScrollPositionAndViewState):
419         * loader/icon/IconDatabase.cpp:
420         (WebCore::IconDatabase::performURLImport):
421         * page/ContextMenuController.cpp:
422         (WebCore::ContextMenuController::contextMenuItemSelected):
423         (WebCore::ContextMenuController::populate):
424         (WebCore::ContextMenuController::checkOrEnableIfNeeded):
425         * page/DragController.cpp:
426         (WebCore::DragController::startDrag):
427         * page/EventHandler.cpp:
428         (WebCore::EventHandler::eventInvertsTabsToLinksClientCallResult):
429         * page/FrameView.cpp:
430         (WebCore::FrameView::layout):
431         * platform/ContextMenuItem.h:
432         * platform/Cursor.h:
433         * platform/DragData.h:
434         * platform/DragImage.h:
435         * platform/FileSystem.h:
436         * platform/LocalizedStrings.h:
437         * platform/MIMETypeRegistry.cpp:
438         (WebCore::initializeSupportedImageMIMETypesForEncoding):
439         * platform/NotImplemented.h:
440         * platform/Pasteboard.h:
441         * platform/PlatformKeyboardEvent.h:
442         * platform/PlatformMouseEvent.h:
443         * platform/PlatformSpeechSynthesizer.h:
444         * platform/PlatformWheelEvent.h:
445         * platform/Widget.h:
446         * platform/graphics/ANGLEWebKitBridge.h:
447         * platform/graphics/BitmapImage.h:
448         * platform/graphics/GraphicsContext3D.h:
449         * platform/graphics/Icon.h:
450         * platform/graphics/Image.h:
451         (WebCore::Image::getEvasObject): Deleted.
452         * platform/graphics/IntPoint.h:
453         * platform/graphics/IntRect.h:
454         * platform/graphics/opengl/Extensions3DOpenGL.cpp:
455         (WebCore::Extensions3DOpenGL::createVertexArrayOES):
456         (WebCore::Extensions3DOpenGL::deleteVertexArrayOES):
457         (WebCore::Extensions3DOpenGL::isVertexArrayOES):
458         (WebCore::Extensions3DOpenGL::bindVertexArrayOES):
459         (WebCore::Extensions3DOpenGL::supportsExtension):
460         * platform/graphics/opengl/Extensions3DOpenGL.h:
461         * platform/graphics/opengl/Extensions3DOpenGLCommon.cpp:
462         * platform/graphics/opengl/GraphicsContext3DOpenGL.cpp:
463         * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
464         (WebCore::GraphicsContext3D::createForCurrentGLContext):
465         (WebCore::GraphicsContext3D::reshape):
466         (WebCore::GraphicsContext3D::createVertexArray):
467         (WebCore::GraphicsContext3D::deleteVertexArray):
468         (WebCore::GraphicsContext3D::isVertexArray):
469         (WebCore::GraphicsContext3D::bindVertexArray):
470         * platform/graphics/opengl/TemporaryOpenGLSetting.cpp:
471         * platform/network/NetworkStateNotifier.h:
472         * platform/posix/FileSystemPOSIX.cpp:
473         * rendering/RenderLayerCompositor.cpp:
474         (WebCore::RenderLayerCompositor::ensureRootLayer):
475         * rendering/RenderText.cpp:
476         (WebCore::RenderText::previousOffsetForBackwardDeletion):
477         * xml/XSLStyleSheetLibxslt.cpp:
478         * xml/XSLTExtensions.cpp:
479         * xml/XSLTProcessorLibxslt.cpp:
480         * xml/XSLTUnicodeSort.cpp:
481
482 2017-02-16  Zalan Bujtas  <zalan@apple.com>
483
484         Simple line layout: Add forced line layout info to coverage print.
485         https://bugs.webkit.org/show_bug.cgi?id=168470
486
487         Reviewed by Simon Fraser.
488
489         This is about potential vs. actual coverage:
490
491         Simple line layout potential coverage: 65.05%
492         Simple line layout actual coverage: 46.60%
493         Forced line layout blocks: 4 content length: 57(18.45%)
494
495         Not testable.
496
497         * rendering/SimpleLineLayout.cpp:
498         (WebCore::SimpleLineLayout::printSimpleLineLayoutCoverage):
499
500 2017-02-16  Anders Carlsson  <andersca@apple.com>
501
502         Rename DataTransfer functions to indicate whether they are for dragging or dropping
503         https://bugs.webkit.org/show_bug.cgi?id=168478
504
505         Reviewed by Tim Horton.
506
507         * dom/DataTransfer.cpp:
508         (WebCore::DataTransfer::createForDrag):
509         (WebCore::DataTransfer::createForDrop):
510         (WebCore::DataTransfer::createForDragAndDrop): Deleted.
511         * dom/DataTransfer.h:
512         * page/DragController.cpp:
513         (WebCore::DragController::dragExited):
514         (WebCore::DragController::performDragOperation):
515         (WebCore::DragController::tryDHTMLDrag):
516         * page/mac/EventHandlerMac.mm:
517         (WebCore::EventHandler::createDraggingDataTransfer):
518
519 2017-02-16  Anders Carlsson  <andersca@apple.com>
520
521         Rename EventHandler::freeDataTransfer to invalidateDataTransfer
522         https://bugs.webkit.org/show_bug.cgi?id=168472
523
524         Reviewed by Tim Horton.
525
526         The code doesn't necessarily free the data transfer object, so rename the member function
527         to reflect that. Also, get rid of a goto.
528
529         * page/EventHandler.cpp:
530         (WebCore::EventHandler::invalidateDataTransfer):
531         (WebCore::EventHandler::dragSourceEndedAt):
532         (WebCore::EventHandler::handleDrag):
533         (WebCore::EventHandler::freeDataTransfer): Deleted.
534         * page/EventHandler.h:
535
536 2017-02-16  Alex Christensen  <achristensen@webkit.org>
537
538         Special URLs without a host are invalid
539         https://bugs.webkit.org/show_bug.cgi?id=168461
540
541         Reviewed by Tim Horton.
542
543         http://? should be invalid.  This matches Chrome and the spec and the intent of my implementation
544         of URLParser which already fails with urls like http:// and this was just an oversight.
545         Covered by newly passing web platform tests.  Updated API tests.
546
547         * platform/URLParser.cpp:
548         (WebCore::URLParser::parse):
549
550 2017-02-16  Zalan Bujtas  <zalan@apple.com>
551
552         Simple line layout: Add support for pagination.
553         https://bugs.webkit.org/show_bug.cgi?id=168355
554         <rdar://problem/30119769>
555
556         Reviewed by David Hyatt.
557
558         This patch adds basic support for paginated content including widows and orphans.
559
560         This is based on the normal line layout pagination logic. However there are 2 major
561         advantages here (and they allow us to have a much simpler logic):
562         1. all the lines are positioned by the time we start paginating them and
563         2. lines always have uniform heights. 
564
565         This is not enabled yet.
566
567         * rendering/RenderBlockFlow.h:
568         * rendering/SimpleLineLayout.cpp:
569         (WebCore::SimpleLineLayout::computeLineTopAndBottomWithOverflow):
570         (WebCore::SimpleLineLayout::computeLineBreakIndex):
571         (WebCore::SimpleLineLayout::setPageBreakForLine):
572         (WebCore::SimpleLineLayout::computeOffsetAfterLineBreak):
573         (WebCore::SimpleLineLayout::updateMinimumPageHeight):
574         (WebCore::SimpleLineLayout::adjustLinePositionsForPagination):
575         (WebCore::SimpleLineLayout::create):
576         (WebCore::SimpleLineLayout::Layout::create):
577         (WebCore::SimpleLineLayout::Layout::Layout):
578         * rendering/SimpleLineLayout.h:
579         (WebCore::SimpleLineLayout::Layout::isPaginated):
580         (WebCore::SimpleLineLayout::Layout::struts):
581         * rendering/SimpleLineLayoutFunctions.h:
582         (WebCore::SimpleLineLayout::computeFlowHeight):
583         * rendering/SimpleLineLayoutResolver.h:
584         (WebCore::SimpleLineLayout::RunResolver::Run::computeBaselinePosition):
585
586 2017-02-11  Filip Pizlo  <fpizlo@apple.com>
587
588         The collector thread should only start when the mutator doesn't have heap access
589         https://bugs.webkit.org/show_bug.cgi?id=167737
590
591         Reviewed by Keith Miller.
592
593         Added new tests in JSTests and LayoutTests.
594         
595         The WebCore changes involve:
596         
597         - Refactoring around new header discipline.
598         
599         - Adding crazy GC APIs to window.internals to enable us to test the GC's runloop discipline.
600
601         * ForwardingHeaders/heap/GCFinalizationCallback.h: Added.
602         * ForwardingHeaders/heap/IncrementalSweeper.h: Added.
603         * ForwardingHeaders/heap/MachineStackMarker.h: Added.
604         * ForwardingHeaders/heap/RunningScope.h: Added.
605         * bindings/js/CommonVM.cpp:
606         * testing/Internals.cpp:
607         (WebCore::Internals::parserMetaData):
608         (WebCore::Internals::isReadableStreamDisturbed):
609         (WebCore::Internals::isGCRunning):
610         (WebCore::Internals::addGCFinalizationCallback):
611         (WebCore::Internals::stopSweeping):
612         (WebCore::Internals::startSweeping):
613         * testing/Internals.h:
614         * testing/Internals.idl:
615
616 2017-02-16  Jiewen Tan  <jiewen_tan@apple.com>
617
618         [WebCrypto] remove toJSValueFromJsonWebKey from custom SubtleCrypto binding codes
619         https://bugs.webkit.org/show_bug.cgi?id=167026
620
621         Reviewed by Chris Dumez.
622
623         Covered by existing tests.
624
625         * bindings/js/JSSubtleCryptoCustom.cpp:
626         (WebCore::jsSubtleCryptoFunctionExportKeyPromise):
627         (WebCore::jsSubtleCryptoFunctionWrapKeyPromise):
628         (WebCore::toJSValueFromJsonWebKey): Deleted.
629         * crypto/JsonWebKey.h:
630         * crypto/JsonWebKey.idl:
631         * crypto/RsaOtherPrimesInfo.idl:
632         Change std::optional<String> to String in order to use toJS<IDLDictionary<JsonWebKey>>.
633         * crypto/algorithms/CryptoAlgorithmAES_CBC.cpp:
634         (WebCore::CryptoAlgorithmAES_CBC::importKey):
635         * crypto/algorithms/CryptoAlgorithmAES_KW.cpp:
636         (WebCore::CryptoAlgorithmAES_KW::importKey):
637         * crypto/algorithms/CryptoAlgorithmHMAC.cpp:
638         (WebCore::CryptoAlgorithmHMAC::importKey):
639         * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp:
640         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::importKey):
641         * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp:
642         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::importKey):
643         * crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp:
644         (WebCore::CryptoAlgorithmRSA_OAEP::importKey):
645         * crypto/keys/CryptoKeyAES.cpp:
646         (WebCore::CryptoKeyAES::importJwk):
647         Only check if key_ops contains all of the specified usages when key_ops field of jwk is present,
648         as per the specification: https://www.w3.org/TR/WebCryptoAPI/#aes-cbc-operations
649         * crypto/keys/CryptoKeyAES.h:
650         * crypto/keys/CryptoKeyHMAC.cpp:
651         (WebCore::CryptoKeyHMAC::importJwk):
652         * crypto/keys/CryptoKeyHMAC.h:
653         * crypto/keys/CryptoKeyRSA.cpp:
654         (WebCore::CryptoKeyRSA::importJwk):
655         Accommodate the change from std::optional<String> to String.
656         * crypto/mac/CryptoKeyRSAMac.cpp:
657         (WebCore::CryptoKeyRSA::create):
658         Add a null check for p.
659
660 2017-02-16  Antti Koivisto  <antti@apple.com>
661
662         Execute pending scripts asynchronously after stylesheet loads complete
663         https://bugs.webkit.org/show_bug.cgi?id=168367
664         rdar://problem/30561379
665
666         Reviewed by Andreas Kling.
667
668         The current synchronous execution is fragile and creates various problems.
669
670         * css/StyleSheetContents.cpp:
671         (WebCore::StyleSheetContents::checkLoaded):
672         * dom/ContainerNode.cpp:
673         (WebCore::ContainerNode::takeAllChildrenFrom):
674         (WebCore::ContainerNode::notifyChildInserted):
675         (WebCore::ContainerNode::removeChild):
676         (WebCore::ContainerNode::parserRemoveChild):
677         (WebCore::ContainerNode::removeChildren):
678
679             Remove various places where we would trigger delayed synchronous execution.
680
681         * dom/Document.cpp:
682         (WebCore::Document::Document):
683         (WebCore::Document::recalcStyle):
684
685             Trigger scroll to anchor at the end of style resolution instead of when style sheet load completes.
686
687         (WebCore::Document::didRemoveAllPendingStylesheet):
688
689             Call asynchronous script execution function.
690
691         * dom/Document.h:
692         (WebCore::Document::setNeedsNotifyRemoveAllPendingStylesheet): Deleted.
693         (WebCore::Document::notifyRemovePendingSheetIfNeeded): Deleted.
694         * dom/ScriptableDocumentParser.cpp:
695         (WebCore::ScriptableDocumentParser::ScriptableDocumentParser):
696         (WebCore::ScriptableDocumentParser::executeScriptsWaitingForStylesheetsSoon):
697         (WebCore::ScriptableDocumentParser::scriptsWaitingForStylesheetsExecutionTimerFired):
698
699             Add a timer for executing pending scripts.
700
701         (WebCore::ScriptableDocumentParser::detach):
702         * dom/ScriptableDocumentParser.h:
703         (WebCore::ScriptableDocumentParser::executeScriptsWaitingForStylesheets):
704         * html/HTMLLinkElement.cpp:
705         (WebCore::HTMLLinkElement::removedFrom):
706         (WebCore::HTMLLinkElement::removePendingSheet):
707         * html/HTMLLinkElement.h:
708         * html/parser/HTMLDocumentParser.cpp:
709         (WebCore::HTMLDocumentParser::detach):
710         * loader/DocumentLoader.cpp:
711         (WebCore::DocumentLoader::isLoadingInAPISense):
712
713             Stay in loading state if we have a pending script. This matches existing behavior.
714
715         * style/StyleScope.cpp:
716         (WebCore::Style::Scope::removePendingSheet):
717         * style/StyleScope.h:
718
719 2017-02-16  Anders Carlsson  <andersca@apple.com>
720
721         Set the DHTML drag image in the DHTML type check
722         https://bugs.webkit.org/show_bug.cgi?id=168451
723
724         Reviewed by Wenson Hsieh.
725
726         * page/DragController.cpp:
727         (WebCore::DragController::startDrag):
728
729 2017-02-16  Anders Carlsson  <andersca@apple.com>
730
731         Begin removing EFL code from WebCore.
732
733         Rubber-stamped by Alex Christensen.
734
735         * PlatformEfl.cmake: Removed.
736         * editing/efl/EditorEfl.cpp: Removed.
737         * page/efl/DragControllerEfl.cpp: Removed.
738         * page/efl/EventHandlerEfl.cpp: Removed.
739         * platform/audio/efl/AudioBusEfl.cpp: Removed.
740         * platform/efl/CursorEfl.cpp: Removed.
741         * platform/efl/DefaultTheme/CMakeLists.txt: Removed.
742         * platform/efl/DefaultTheme/default.edc: Removed.
743         * platform/efl/DefaultTheme/widget/button/button.edc: Removed.
744         * platform/efl/DefaultTheme/widget/button/img_button_focus.png: Removed.
745         * platform/efl/DefaultTheme/widget/button/img_button_hover.png: Removed.
746         * platform/efl/DefaultTheme/widget/button/img_button_normal.png: Removed.
747         * platform/efl/DefaultTheme/widget/button/img_button_press.png: Removed.
748         * platform/efl/DefaultTheme/widget/check/check.edc: Removed.
749         * platform/efl/DefaultTheme/widget/check/img_check_bg_disabled.png: Removed.
750         * platform/efl/DefaultTheme/widget/check/img_check_bg_enabled.png: Removed.
751         * platform/efl/DefaultTheme/widget/check/img_check_off.png: Removed.
752         * platform/efl/DefaultTheme/widget/check/img_check_off_focus.png: Removed.
753         * platform/efl/DefaultTheme/widget/check/img_check_off_hover.png: Removed.
754         * platform/efl/DefaultTheme/widget/check/img_check_on.png: Removed.
755         * platform/efl/DefaultTheme/widget/check/img_check_on_focus.png: Removed.
756         * platform/efl/DefaultTheme/widget/check/img_check_on_hover.png: Removed.
757         * platform/efl/DefaultTheme/widget/combo/combo.edc: Removed.
758         * platform/efl/DefaultTheme/widget/combo/combo_focus.png: Removed.
759         * platform/efl/DefaultTheme/widget/combo/combo_focus_button.png: Removed.
760         * platform/efl/DefaultTheme/widget/combo/combo_focus_button_transparent.png: Removed.
761         * platform/efl/DefaultTheme/widget/combo/combo_focus_transparent.png: Removed.
762         * platform/efl/DefaultTheme/widget/combo/combo_hover.png: Removed.
763         * platform/efl/DefaultTheme/widget/combo/combo_hover_button.png: Removed.
764         * platform/efl/DefaultTheme/widget/combo/combo_hover_button_transparent.png: Removed.
765         * platform/efl/DefaultTheme/widget/combo/combo_hover_transparent.png: Removed.
766         * platform/efl/DefaultTheme/widget/combo/combo_normal.png: Removed.
767         * platform/efl/DefaultTheme/widget/combo/combo_normal_button.png: Removed.
768         * platform/efl/DefaultTheme/widget/combo/combo_normal_button_transparent.png: Removed.
769         * platform/efl/DefaultTheme/widget/combo/combo_normal_transparent.png: Removed.
770         * platform/efl/DefaultTheme/widget/combo/combo_press.png: Removed.
771         * platform/efl/DefaultTheme/widget/combo/combo_press_button.png: Removed.
772         * platform/efl/DefaultTheme/widget/combo/combo_press_button_transparent.png: Removed.
773         * platform/efl/DefaultTheme/widget/combo/combo_press_transparent.png: Removed.
774         * platform/efl/DefaultTheme/widget/combo/icon.png: Removed.
775         * platform/efl/DefaultTheme/widget/entry/entry.edc: Removed.
776         * platform/efl/DefaultTheme/widget/entry/img_focused.png: Removed.
777         * platform/efl/DefaultTheme/widget/entry/img_hovered.png: Removed.
778         * platform/efl/DefaultTheme/widget/entry/img_normal.png: Removed.
779         * platform/efl/DefaultTheme/widget/progressbar/bt_base.png: Removed.
780         * platform/efl/DefaultTheme/widget/progressbar/progressbar.edc: Removed.
781         * platform/efl/DefaultTheme/widget/progressbar/shelf_inset.png: Removed.
782         * platform/efl/DefaultTheme/widget/radio/img_radio_bg_disabled.png: Removed.
783         * platform/efl/DefaultTheme/widget/radio/img_radio_bg_enabled.png: Removed.
784         * platform/efl/DefaultTheme/widget/radio/img_radio_off.png: Removed.
785         * platform/efl/DefaultTheme/widget/radio/img_radio_off_focus.png: Removed.
786         * platform/efl/DefaultTheme/widget/radio/img_radio_off_hover.png: Removed.
787         * platform/efl/DefaultTheme/widget/radio/img_radio_on.png: Removed.
788         * platform/efl/DefaultTheme/widget/radio/img_radio_on_focus.png: Removed.
789         * platform/efl/DefaultTheme/widget/radio/img_radio_on_hover.png: Removed.
790         * platform/efl/DefaultTheme/widget/radio/radio.edc: Removed.
791         * platform/efl/DefaultTheme/widget/scrollbar/scrollbar.edc: Removed.
792         * platform/efl/DefaultTheme/widget/scrollbar/scrollbar_bg_horizontal.png: Removed.
793         * platform/efl/DefaultTheme/widget/scrollbar/scrollbar_bg_vertical.png: Removed.
794         * platform/efl/DefaultTheme/widget/scrollbar/scrollbar_thumb_horizontal.png: Removed.
795         * platform/efl/DefaultTheme/widget/scrollbar/scrollbar_thumb_vertical.png: Removed.
796         * platform/efl/DefaultTheme/widget/search/cancel/cancel_normal_button.png: Removed.
797         * platform/efl/DefaultTheme/widget/search/cancel/cancel_normal_button2.png: Removed.
798         * platform/efl/DefaultTheme/widget/search/cancel/search_cancel.edc: Removed.
799         * platform/efl/DefaultTheme/widget/search/decoration/decoration_normal_button.png: Removed.
800         * platform/efl/DefaultTheme/widget/search/decoration/search_decoration.edc: Removed.
801         * platform/efl/DefaultTheme/widget/search/field/field_focused.png: Removed.
802         * platform/efl/DefaultTheme/widget/search/field/field_hovered.png: Removed.
803         * platform/efl/DefaultTheme/widget/search/field/field_normal.png: Removed.
804         * platform/efl/DefaultTheme/widget/search/field/search_field.edc: Removed.
805         * platform/efl/DefaultTheme/widget/slider/slider.edc: Removed.
806         * platform/efl/DefaultTheme/widget/slider/slider_fill_h.png: Removed.
807         * platform/efl/DefaultTheme/widget/slider/slider_fill_v.png: Removed.
808         * platform/efl/DefaultTheme/widget/slider/slider_h.png: Removed.
809         * platform/efl/DefaultTheme/widget/slider/slider_thumb_h.png: Removed.
810         * platform/efl/DefaultTheme/widget/slider/slider_thumb_press_h.png: Removed.
811         * platform/efl/DefaultTheme/widget/slider/slider_thumb_press_v.png: Removed.
812         * platform/efl/DefaultTheme/widget/slider/slider_thumb_v.png: Removed.
813         * platform/efl/DefaultTheme/widget/slider/slider_v.png: Removed.
814         * platform/efl/DefaultTheme/widget/spinner/sp_bg.png: Removed.
815         * platform/efl/DefaultTheme/widget/spinner/sp_down_default.png: Removed.
816         * platform/efl/DefaultTheme/widget/spinner/sp_down_hover.png: Removed.
817         * platform/efl/DefaultTheme/widget/spinner/sp_down_pressed.png: Removed.
818         * platform/efl/DefaultTheme/widget/spinner/sp_up_default.png: Removed.
819         * platform/efl/DefaultTheme/widget/spinner/sp_up_hover.png: Removed.
820         * platform/efl/DefaultTheme/widget/spinner/sp_up_pressed.png: Removed.
821         * platform/efl/DefaultTheme/widget/spinner/spinner.edc: Removed.
822         * platform/efl/DragDataEfl.cpp: Removed.
823         * platform/efl/DragImageEfl.cpp: Removed.
824         * platform/efl/EflInspectorUtilities.cpp: Removed.
825         * platform/efl/EflInspectorUtilities.h: Removed.
826         * platform/efl/EflKeyboardUtilities.cpp: Removed.
827         * platform/efl/EflKeyboardUtilities.h: Removed.
828         * platform/efl/EflScreenUtilities.cpp: Removed.
829         * platform/efl/EflScreenUtilities.h: Removed.
830         * platform/efl/ErrorsEfl.cpp: Removed.
831         * platform/efl/ErrorsEfl.h: Removed.
832         * platform/efl/EventLoopEfl.cpp: Removed.
833         * platform/efl/FileSystemEfl.cpp: Removed.
834         * platform/efl/LocalizedStringsEfl.cpp: Removed.
835         * platform/efl/MIMETypeRegistryEfl.cpp: Removed.
836         * platform/efl/MainThreadSharedTimerEfl.cpp: Removed.
837         * platform/efl/PasteboardEfl.cpp: Removed.
838         * platform/efl/PlatformKeyboardEventEfl.cpp: Removed.
839         * platform/efl/PlatformMouseEventEfl.cpp: Removed.
840         * platform/efl/PlatformScreenEfl.cpp: Removed.
841         * platform/efl/PlatformSpeechSynthesisProviderEfl.cpp: Removed.
842         * platform/efl/PlatformSpeechSynthesisProviderEfl.h: Removed.
843         * platform/efl/PlatformSpeechSynthesizerEfl.cpp: Removed.
844         * platform/efl/PlatformWheelEventEfl.cpp: Removed.
845         * platform/efl/ScrollbarThemeEfl.cpp: Removed.
846         * platform/efl/ScrollbarThemeEfl.h: Removed.
847         * platform/efl/SoundEfl.cpp: Removed.
848         * platform/efl/TemporaryLinkStubs.cpp: Removed.
849         * platform/efl/UserAgentEfl.cpp: Removed.
850         * platform/efl/WidgetEfl.cpp: Removed.
851         * platform/gamepad/efl/GamepadsEfl.cpp: Removed.
852         * platform/graphics/efl/CairoUtilitiesEfl.cpp: Removed.
853         * platform/graphics/efl/CairoUtilitiesEfl.h: Removed.
854         * platform/graphics/efl/EvasGLContext.cpp: Removed.
855         * platform/graphics/efl/EvasGLContext.h: Removed.
856         * platform/graphics/efl/EvasGLSurface.cpp: Removed.
857         * platform/graphics/efl/EvasGLSurface.h: Removed.
858         * platform/graphics/efl/GraphicsContext3DEfl.cpp: Removed.
859         * platform/graphics/efl/GraphicsContext3DPrivate.cpp: Removed.
860         * platform/graphics/efl/GraphicsContext3DPrivate.h: Removed.
861         * platform/graphics/efl/IconEfl.cpp: Removed.
862         * platform/graphics/efl/ImageBufferEfl.cpp: Removed.
863         * platform/graphics/efl/ImageEfl.cpp: Removed.
864         * platform/graphics/efl/IntPointEfl.cpp: Removed.
865         * platform/graphics/efl/IntRectEfl.cpp: Removed.
866         * platform/graphics/surfaces/efl/GraphicsSurfaceCommon.cpp: Removed.
867         * platform/network/efl/NetworkStateNotifierEfl.cpp: Removed.
868         * rendering/RenderThemeEfl.cpp: Removed.
869         * rendering/RenderThemeEfl.h: Removed.
870
871 2017-02-16  Joseph Pecoraro  <pecoraro@apple.com>
872
873         [Resource Timing] Support Resource Timing in Workers
874         https://bugs.webkit.org/show_bug.cgi?id=168086
875         <rdar://problem/30430117>
876
877         Reviewed by Alex Christensen.
878
879         Worker's load resources through the Document that loaded them. However,
880         their PerformanceResourceTiming entries should be added to the Performance
881         object inside the Worker context, not the Document's context.
882
883         This change adds an InitiatorContext to ResourceLoadOptions so that loaders
884         can determine if the load was initiated by the Document or a Worker. This
885         allows loaders to then know if the ResourceTiming data they collect should
886         be added to the Document's Performance object or forwarded on to the Worker's.
887
888         This adds a new ThreadableLoaderClient method intended only for the purpose
889         of adding the ResourceTiming information to the Worker's Performance object.
890         Unlike other ThreadableLoaderClient methods that are bridged and forwarded
891         on to a client inside the worker (e.g. XMLHttpRequest or FetchLoader) this
892         method never needs to be handled by clients and can be uniformly handled by
893         the WorkerThreadableLoader itself.
894
895         We also add a new ResourceTiming object that encapsulates all of the data
896         ultimately needed for a PerformanceResourceTimingEntry object. This allows
897         for all of the information to be gathered while loading on the Document
898         before serializing across to the Worker. That includes the Timing-Allow-Origin
899         check which uses the SecurityOrigin of the Worker.
900
901         This also modernizes and addresses issues in the Resource Timing implementation.
902         Better handling cases like loading from the Cache, Synchronous Loads, and
903         improving initiatorType information.
904
905         Tests: imported/w3c/web-platform-tests/resource-timing/rt-cors.html
906                imported/w3c/web-platform-tests/resource-timing/rt-cors.worker.html
907                imported/w3c/web-platform-tests/resource-timing/rt-initiatorType-css.html
908                imported/w3c/web-platform-tests/resource-timing/rt-initiatorType-element.html
909                imported/w3c/web-platform-tests/resource-timing/rt-initiatorType-fetch.html
910                imported/w3c/web-platform-tests/resource-timing/rt-initiatorType-media.html
911                imported/w3c/web-platform-tests/resource-timing/rt-initiatorType-other.html
912                imported/w3c/web-platform-tests/resource-timing/rt-initiatorType-script-module.html
913                imported/w3c/web-platform-tests/resource-timing/rt-initiatorType-xmlhttprequest.html
914                imported/w3c/web-platform-tests/resource-timing/rt-initiatorType.worker.html
915                imported/w3c/web-platform-tests/resource-timing/rt-performance-extensions.html
916                imported/w3c/web-platform-tests/resource-timing/rt-performance-extensions.worker.html
917                imported/w3c/web-platform-tests/resource-timing/rt-resource-errors.html
918                imported/w3c/web-platform-tests/resource-timing/rt-resource-ignored.html
919                imported/w3c/web-platform-tests/resource-timing/rt-resources-per-frame.html
920                imported/w3c/web-platform-tests/resource-timing/rt-resources-per-worker.html
921                imported/w3c/web-platform-tests/resource-timing/rt-serialization.html
922                imported/w3c/web-platform-tests/resource-timing/rt-shared-resource-in-frames.html
923                imported/w3c/web-platform-tests/resource-timing/rt-shared-resource-in-workers.html
924                performance-api/resource-timing-apis.html
925
926         * CMakeLists.txt:
927         * WebCore.xcodeproj/project.pbxproj:
928         New files.
929
930         * platform/network/NetworkLoadTiming.h:
931         (WebCore::NetworkLoadTiming::reset): Deleted.
932         We no longer need to reset.
933
934         * loader/ResourceTiming.cpp: Added.
935         (WebCore::passesTimingAllowCheck):
936         (WebCore::ResourceTiming::fromCache):
937         (WebCore::ResourceTiming::fromLoad):
938         (WebCore::ResourceTiming::fromSynchronousLoad):
939         (WebCore::ResourceTiming::ResourceTiming):
940         (WebCore::ResourceTiming::isolatedCopy):
941         * loader/ResourceTiming.h: Added.
942         (WebCore::ResourceTiming::url):
943         (WebCore::ResourceTiming::initiator):
944         (WebCore::ResourceTiming::loadTiming):
945         (WebCore::ResourceTiming::networkLoadTiming):
946         (WebCore::ResourceTiming::allowTimingDetails):
947         (WebCore::ResourceTiming::overrideInitiatorName):
948         (WebCore::ResourceTiming::ResourceTiming):
949         Class that encapsulates all of the data needed for a PerformanceResourceTiming entry.
950         There are three static constructors indicating the different ways this object can
951         be constructed and the different data available at the time of construction.
952
953         * loader/ResourceLoaderOptions.h:
954         Add the new InitiatorContext, default to Document.
955
956         * loader/ThreadableLoaderClient.h:
957         (WebCore::ThreadableLoaderClient::didFinishTiming):
958         New client method only used by WorkerThreadableLoader.
959
960         * loader/WorkerThreadableLoader.h:
961         * loader/WorkerThreadableLoader.cpp:
962         (WebCore::WorkerThreadableLoader::MainThreadBridge::MainThreadBridge):
963         (WebCore::WorkerThreadableLoader::MainThreadBridge::didFinishTiming):
964         All loads initiated in a WorkerThreadableLoader get identified as InitiatorContext::Worker.
965         Add timing information to the Performance object when received. No need to inform clients.
966
967         * loader/DocumentThreadableLoader.h:
968         * loader/DocumentThreadableLoader.cpp:
969         (WebCore::DocumentThreadableLoader::finishedTimingForWorkerLoad):
970         (WebCore::DocumentThreadableLoader::loadRequest):
971         Provide APIs to pass timing data on to a WorkerThreadableLoader.
972         Create ResourceTiming data for synchronous loads.
973
974         * loader/LoadTiming.h:
975         * loader/LoadTiming.cpp:
976         (WebCore::LoadTiming::isolatedCopy):
977         Add isolatedCopy to allow this data to be passed across to a Worker.
978
979         * loader/ResourceTimingInformation.h:
980         * loader/ResourceTimingInformation.cpp:
981         (WebCore::ResourceTimingInformation::shouldAddResourceTiming):
982         (WebCore::ResourceTimingInformation::addResourceTiming):
983         (WebCore::ResourceTimingInformation::storeResourceTimingInitiatorInformation):
984         Refactor to remove unused / unnecessary bits. Extract out some helpful code.
985         Changed this to match when Blink decides when to add or ignore entries, however
986         this may change over time.
987
988         * loader/SubresourceLoader.cpp:
989         (WebCore::SubresourceLoader::didFinishLoading):
990         (WebCore::SubresourceLoader::notifyDone):
991         (WebCore::SubresourceLoader::reportResourceTiming):
992         * loader/SubresourceLoader.h:
993         * loader/cache/CachedRawResource.cpp:
994         (WebCore::CachedRawResource::finishedTimingForWorkerLoad):
995         * loader/cache/CachedRawResource.h:
996         * loader/cache/CachedRawResourceClient.h:
997         (WebCore::CachedRawResourceClient::finishedTimingForWorkerLoad):
998         Plumbing to report timing information to Worker if this resource was loaded for a Worker.
999
1000         * loader/cache/CachedResource.cpp:
1001         (WebCore::CachedResource::CachedResource):
1002         * loader/cache/CachedResource.h:
1003         (WebCore::CachedResource::initiatorName):
1004         Store the initiator name on the CachedResource like other data added to the original
1005         CachedResourceRequest. This is a bit of a hack but follows an existing pattern, and
1006         cleans up other hacks that worked around this later on.
1007
1008         * loader/cache/CachedResourceLoader.h:
1009         * loader/cache/CachedResourceLoader.cpp:
1010         (WebCore::CachedResourceLoader::requestResource):
1011         (WebCore::CachedResourceLoader::revalidateResource):
1012         (WebCore::CachedResourceLoader::loadResource):
1013         Simply the creation of a ResourceTiming object for cache hits.
1014         Report timing information to Worker if this resource was loaded for a Worker.
1015
1016         (WebCore::CachedResourceLoader::loadDone):
1017         Eliminate this redundant point attempting to add a ResourceTiming entry.
1018
1019         * loader/cache/CachedResourceRequest.cpp:
1020         (WebCore::CachedResourceRequest::initiatorName):
1021         Update to match the spec. The fallback is "other".
1022
1023         * page/Performance.h:
1024         * page/Performance.cpp:
1025         (WebCore::Performance::setResourceTimingBufferSize):
1026         (WebCore::Performance::addResourceTiming):
1027         Update to support PerformanceObservers.
1028         Update to match spec (event should bubble).
1029
1030         * page/PerformanceResourceTiming.h:
1031         * page/PerformanceResourceTiming.cpp:
1032         (WebCore::PerformanceResourceTiming::create):
1033         (WebCore::PerformanceResourceTiming::PerformanceResourceTiming):
1034         (WebCore::PerformanceResourceTiming::fetchStart):
1035         (WebCore::PerformanceResourceTiming::domainLookupStart):
1036         (WebCore::PerformanceResourceTiming::domainLookupEnd):
1037         (WebCore::PerformanceResourceTiming::connectStart):
1038         (WebCore::PerformanceResourceTiming::connectEnd):
1039         (WebCore::PerformanceResourceTiming::secureConnectionStart):
1040         (WebCore::PerformanceResourceTiming::requestStart):
1041         (WebCore::PerformanceResourceTiming::responseStart):
1042         (WebCore::PerformanceResourceTiming::responseEnd):
1043         (WebCore::PerformanceResourceTiming::networkLoadTimeToDOMHighResTimeStamp):
1044         Construct with a ResourceTiming object containing all the data we need for the entry.
1045         Update to match spec for what is required, should fallback, should be zero, etc.
1046
1047         (WebCore::passesTimingAllowCheck): Deleted.
1048         Extracted this to ResourceTiming creation time in the loading context,
1049         since this can't be determined on the Worker context without also having
1050         all of the header information from each resource response.
1051
1052         * page/PerformanceResourceTiming.idl:
1053         Expose to Workers!
1054
1055 2017-02-16  Yusuke Suzuki  <utatane.tea@gmail.com>
1056
1057         [JSC] Drop PassRefPtr in inspector/
1058         https://bugs.webkit.org/show_bug.cgi?id=168420
1059
1060         Reviewed by Alex Christensen.
1061
1062         Use Ref<Inspector::ScriptArguments> and Ref<ScriptCallStack> as much as possible.
1063         It drops some unnecessary null checks.
1064
1065         * bindings/scripts/CodeGeneratorJS.pm:
1066         (GenerateCallWith):
1067         * bindings/scripts/test/JS/JSTestObj.cpp:
1068         (WebCore::jsTestObjPrototypeFunctionWithScriptArgumentsAndCallStackCaller):
1069         * dom/ScriptExecutionContext.cpp:
1070         (WebCore::ScriptExecutionContext::PendingException::PendingException):
1071         * inspector/InspectorInstrumentation.cpp:
1072         (WebCore::InspectorInstrumentation::consoleCountImpl):
1073         (WebCore::InspectorInstrumentation::stopConsoleTimingImpl):
1074         (WebCore::InspectorInstrumentation::consoleTimeStampImpl):
1075         * inspector/InspectorInstrumentation.h:
1076         (WebCore::InspectorInstrumentation::consoleCount):
1077         (WebCore::InspectorInstrumentation::stopConsoleTiming):
1078         (WebCore::InspectorInstrumentation::consoleTimeStamp):
1079         * inspector/InspectorNetworkAgent.cpp:
1080         (WebCore::InspectorNetworkAgent::buildInitiatorObject):
1081         * inspector/TimelineRecordFactory.cpp:
1082         (WebCore::TimelineRecordFactory::createGenericRecord):
1083         * inspector/WebInjectedScriptManager.cpp:
1084         (WebCore::WebInjectedScriptManager::WebInjectedScriptManager):
1085         * inspector/WebInjectedScriptManager.h:
1086         * page/DOMWindow.cpp:
1087         (WebCore::DOMWindow::postMessageTimerFired):
1088         We dispatch appropriate addMessage function according to whether
1089         `timer.stackTrace()` is nullptr.
1090
1091         * page/PageConsoleClient.cpp:
1092         (WebCore::PageConsoleClient::addMessage):
1093         (WebCore::PageConsoleClient::messageWithTypeAndLevel):
1094         (WebCore::PageConsoleClient::count):
1095         (WebCore::PageConsoleClient::timeEnd):
1096         (WebCore::PageConsoleClient::timeStamp):
1097         * page/PageConsoleClient.h:
1098         * workers/WorkerConsoleClient.cpp:
1099         (WebCore::WorkerConsoleClient::messageWithTypeAndLevel):
1100         (WebCore::WorkerConsoleClient::count):
1101         (WebCore::WorkerConsoleClient::timeEnd):
1102         (WebCore::WorkerConsoleClient::timeStamp):
1103         * workers/WorkerConsoleClient.h:
1104         * workers/WorkerGlobalScope.cpp:
1105         (WebCore::WorkerGlobalScope::addMessage):
1106
1107 2017-02-16  Chris Fleizach  <cfleizach@apple.com>
1108
1109         AX: Make form validation accessible on iOS
1110         https://bugs.webkit.org/show_bug.cgi?id=168400
1111
1112         Reviewed by Chris Dumez.
1113
1114         Hide the popover content of form validation from accessibility (since its not interactable)
1115         and instead announce the message.
1116
1117         * platform/ios/ValidationBubbleIOS.mm:
1118         (WebCore::ValidationBubble::show):
1119
1120 2017-02-16  Simon Fraser  <simon.fraser@apple.com>
1121
1122         Clean up use of some CALayer-related SPI
1123         https://bugs.webkit.org/show_bug.cgi?id=168401
1124
1125         Reviewed by Tim Horton.
1126
1127         Use -setDrawsAsynchronously: rather than the old -setAcceleratesDrawing: SPI.
1128
1129         Remove CATiledLayer-related stuff from QuartzCoreSPI.h, since we don't use it any more.
1130
1131         * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
1132         (PlatformCALayerCocoa::acceleratesDrawing):
1133         (PlatformCALayerCocoa::setAcceleratesDrawing):
1134         * platform/graphics/ca/cocoa/WebTiledBackingLayer.mm:
1135         (-[WebTiledBackingLayer setDrawsAsynchronously:]): This override passes the state
1136         onto the TileController.
1137         (-[WebTiledBackingLayer setAcceleratesDrawing:]): Deleted.
1138         * platform/ios/LegacyTileGridTile.mm:
1139         (WebCore::LegacyTileGridTile::LegacyTileGridTile):
1140         * platform/spi/cocoa/QuartzCoreSPI.h:
1141
1142 2017-02-16  Yusuke Suzuki  <utatane.tea@gmail.com>
1143
1144         Web Inspector: allow import() inside the inspector
1145         https://bugs.webkit.org/show_bug.cgi?id=167457
1146
1147         Reviewed by Ryosuke Niwa.
1148
1149         When evaluating `import("...")`, we need the caller's context to resolve
1150         the module specifier correctly. For example, if `import("./cocoa.js")` is
1151         evaluated in the script "drinks/hot.js", this module name is resolved to
1152         "drinks/cocoa.js". If the same import operator is evaluated in the script
1153         "menu/all.js", the module specifier becomes "menu/cocoa.js".
1154
1155         Previously we reject the import operator if the caller does not have such
1156         a context. These context is SourceOrigin and its ScriptFetcher. While they
1157         are offered in the script tag and other code evaluations, the inspector
1158         console does not offer that. These class are offered in the WebCore side
1159         and we should not touch these classes in the JSC's inspector code.
1160
1161         Now we relax the above restriction. If the above caller information is not
1162         offered, we fallback to the default one. In the web page, we use the page's
1163         URL as the caller's source origin. This allows us to evaluate the import
1164         operator in the inspector console.
1165
1166         And as of r167698, the console recognizes `await import("...")` form. We use
1167         this to test this `import()` in the console functionality.
1168
1169         Test: inspector/controller/runtime-controller-import.html
1170
1171         * bindings/js/ScriptModuleLoader.cpp:
1172         (WebCore::ScriptModuleLoader::importModule):
1173
1174 2017-02-16  Miguel Gomez  <magomez@igalia.com>
1175
1176         [GTK] scroll with transparent background not repainted after scrollY >= 32768
1177         https://bugs.webkit.org/show_bug.cgi?id=154283
1178
1179         Reviewed by Carlos Garcia Campos.
1180
1181         Due to a limitation of the pixman backend, which uses 16 bits to hold signed integers, cairo is
1182         not able to draw anything when using transformation matrices with values bigger than 32768. When
1183         drawing patterns into large pages, the matrices values can overflow those 16 bits, so cairo doesn't
1184         draw anything in, which causes the reported transparent backgrounds.
1185
1186         The patch modifies the transformation matrices both from the current context and the pattern we
1187         are painting, to avoid them to hold values that cannot stored in 16 bits.
1188
1189         There's still the possibility that this happens, but it would require using a pattern with a size
1190         bigger than 32768.
1191
1192         Based on a previous patch by Gwang Yoon Hwang  <yoon@igalia.com>.
1193
1194         Test: fast/backgrounds/background-repeat-long-scroll.html
1195
1196         * platform/graphics/cairo/CairoUtilities.cpp:
1197         (WebCore::drawPatternToCairoContext):
1198
1199 2017-02-16  Carlos Garcia Campos  <cgarcia@igalia.com>
1200
1201         [GTK] Images are never read from the clipboard
1202         https://bugs.webkit.org/show_bug.cgi?id=168419
1203
1204         Reviewed by Sergio Villar Senin.
1205
1206         We write images in the clipboard, but we don't read them.
1207
1208         Fixes: editing/pasteboard/paste-image-using-image-data.html
1209
1210         * editing/Editor.cpp:
1211         (WebCore::Editor::createFragmentForImageAndURL): Moved from EditorMac.mm since it's cross-platform code.
1212         * editing/Editor.h:
1213         * editing/gtk/EditorGtk.cpp:
1214         (WebCore::createFragmentFromPasteboardData): Check if there's an image in the selection, and use
1215         Editor::createFragmentForImageAndURL in that case.
1216         * editing/mac/EditorMac.mm:
1217         (WebCore::Editor::createFragmentForImageAndURL): Deleted.
1218         * platform/gtk/PasteboardHelper.cpp:
1219         (WebCore::PasteboardHelper::getClipboardContents): Check also if there's an image in the clipboard.
1220
1221 2017-02-15  Jer Noble  <jer.noble@apple.com>
1222
1223         REGRESSION (r212311): NULL-dereference in HTMLMediaElement::prepareToPlay()
1224         https://bugs.webkit.org/show_bug.cgi?id=168404
1225         <rdar://problem/30547188>
1226
1227         Reviewed by Brian Weinstein.
1228
1229         Prior to r212311, m_player was always guaranteed to be initialized when calling
1230         prepareToPlay(). r212311 began calling prepareToPlay() on a subsequent run-loop iteration
1231         after creating m_player. So now check whether m_player is NULL before calling methods on it.
1232
1233         * html/HTMLMediaElement.cpp:
1234         (WebCore::HTMLMediaElement::prepareToPlay):
1235
1236 2017-02-15  Eric Carlson  <eric.carlson@apple.com>
1237
1238         [MediaStream] delete CaptureDeviceInfo struct
1239         https://bugs.webkit.org/show_bug.cgi?id=168395
1240
1241         The CaptureDeviceInfo struct and CaptureDevice class were almost identical, so
1242         add an "enabled" field to the later, delete the former, and switch all uses of
1243         CaptureDeviceInfo to CaptureDevice.
1244
1245         Do some minor drive-by cleanup of AVCaptureDeviceManager::refreshCaptureDevices
1246         and CaptureDeviceManager::captureDeviceFromDeviceID.
1247         
1248         Reviewed by Sam Weinig.
1249
1250         No new tests, no behavior change.
1251
1252         * Modules/mediastream/MediaDevicesRequest.cpp:
1253         (WebCore::MediaDevicesRequest::start): SourceKind -> DeviceType
1254         * platform/mediastream/CaptureDevice.h:
1255         (WebCore::CaptureDevice::CaptureDevice):
1256         (WebCore::CaptureDevice::type): Renamed from kind.
1257         (WebCore::CaptureDevice::setType):
1258         (WebCore::CaptureDevice::enabled): Added.
1259         (WebCore::CaptureDevice::setEnabled):
1260         (WebCore::CaptureDevice::kind): Deleted.
1261         (WebCore::CaptureDevice::setKind): Deleted.
1262
1263         * platform/mediastream/CaptureDeviceManager.cpp:
1264         (CaptureDeviceManager::getSourcesInfo):
1265         (CaptureDeviceManager::captureDeviceFromDeviceID): Don't call sourceWithUID.
1266         (CaptureDeviceManager::bestSourcesForTypeAndConstraints):
1267         (CaptureDeviceManager::sourceWithUID):
1268         * platform/mediastream/CaptureDeviceManager.h:
1269         (WebCore::CaptureDeviceManager::refreshCaptureDevices):
1270         (WebCore::CaptureDeviceManager::refreshCaptureDeviceList): Deleted.
1271
1272         * platform/mediastream/mac/AVCaptureDeviceManager.h:
1273         * platform/mediastream/mac/AVCaptureDeviceManager.mm:
1274         (WebCore::AVCaptureDeviceManager::captureDevices):
1275         (WebCore::deviceIsAvailable):
1276         (WebCore::AVCaptureDeviceManager::refreshCaptureDevices):
1277         (WebCore::AVCaptureDeviceManager::createMediaSourceForCaptureDeviceWithConstraints):
1278         (WebCore::AVCaptureDeviceManager::deviceConnected):
1279         (WebCore::AVCaptureDeviceManager::deviceDisconnected):
1280         (WebCore::AVCaptureDeviceManager::captureDeviceList): Deleted.
1281         (WebCore::shouldConsiderDeviceInDeviceList): Deleted.
1282         (WebCore::AVCaptureDeviceManager::refreshCaptureDeviceList): Deleted.
1283         * platform/mock/MockRealtimeMediaSource.cpp:
1284         (WebCore::MockRealtimeMediaSource::audioDeviceInfo):
1285         (WebCore::MockRealtimeMediaSource::videoDeviceInfo):
1286
1287 2017-02-15  Sam Weinig  <sam@webkit.org>
1288
1289         [WebIDL] Remove custom conversion from FontFace code by using a Variant
1290         https://bugs.webkit.org/show_bug.cgi?id=168384
1291
1292         Reviewed by Alex Christensen.
1293
1294         Match the font face spec and use a union rather than any in the FontFace constructor.
1295
1296         Test: Added additional cases to fast/text/font-face-javascript.html.
1297
1298         * css/FontFace.cpp:
1299         (WebCore::FontFace::create):
1300         * css/FontFace.h:
1301         * css/FontFace.idl:
1302
1303 2017-02-15  Jer Noble  <jer.noble@apple.com>
1304
1305         Disabled Media Sources should render black/silence
1306         https://bugs.webkit.org/show_bug.cgi?id=168281
1307
1308         Reviewed by Eric Carlson.
1309
1310         Test: webrtc/video-disabled-black.html
1311
1312         Pass the enabled flag setting down from the MediaStreamTrackPrivate to its underlying
1313         source, including RealtimeMediaSource and RealtimeOutgoingAudio/VideoSource. When either
1314         enabled is cleared or muted is set, generate empty (black or silent) media, as opposed to
1315         pausing media or (worse) continuing to send generated media.
1316
1317         * platform/mediastream/MediaStreamTrackPrivate.cpp:
1318         (WebCore::MediaStreamTrackPrivate::setEnabled):
1319         (WebCore::MediaStreamTrackPrivate::sourceEnabledChanged):
1320         * platform/mediastream/MediaStreamTrackPrivate.h:
1321         * platform/mediastream/RealtimeMediaSource.cpp:
1322         (WebCore::RealtimeMediaSource::setEnabled):
1323         * platform/mediastream/RealtimeMediaSource.h:
1324         (WebCore::RealtimeMediaSource::enabled):
1325         * platform/mediastream/mac/AudioTrackPrivateMediaStreamCocoa.h:
1326         * platform/mediastream/mac/MockRealtimeAudioSourceMac.mm:
1327         (WebCore::MockRealtimeAudioSourceMac::render):
1328         * platform/mediastream/mac/RealtimeOutgoingAudioSource.cpp:
1329         (WebCore::RealtimeOutgoingAudioSource::sourceMutedChanged):
1330         (WebCore::RealtimeOutgoingAudioSource::sourceEnabledChanged):
1331         (WebCore::RealtimeOutgoingAudioSource::pullAudioData):
1332         * platform/mediastream/mac/RealtimeOutgoingAudioSource.h:
1333         * platform/mediastream/mac/RealtimeOutgoingVideoSource.cpp:
1334         (WebCore::RealtimeOutgoingVideoSource::sourceMutedChanged):
1335         (WebCore::RealtimeOutgoingVideoSource::sourceEnabledChanged):
1336         (WebCore::RealtimeOutgoingVideoSource::videoSampleAvailable):
1337         * platform/mediastream/mac/RealtimeOutgoingVideoSource.h:
1338         * platform/mock/MockRealtimeVideoSource.cpp:
1339         (WebCore::MockRealtimeVideoSource::generateFrame):
1340
1341 2017-02-15  Wenson Hsieh  <wenson_hsieh@apple.com>
1342
1343         Editing history scripts should not add the contenteditable attribute or override key events
1344         https://bugs.webkit.org/show_bug.cgi?id=168389
1345         <rdar://problem/30529945>
1346
1347         Reviewed by Dan Bernstein.
1348
1349         Clients that hook into editing history tracking should handle setting the contenteditable attribute on the body
1350         rather than have the script add it to the body. Additionally, this script should NOT be overriding any keydown
1351         events. These were initially added for compatibility with a test harness early on, and should have been removed
1352         earlier.
1353
1354         * Scripts/DumpEditingHistory.js:
1355
1356 2017-02-15  Jer Noble  <jer.noble@apple.com>
1357
1358         Pass "RequiresCustomURLLoading" in AVURLAsset options dictionary
1359         https://bugs.webkit.org/show_bug.cgi?id=168381
1360
1361         Reviewed by Eric Carlson.
1362
1363         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
1364         (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVAssetForURL):
1365
1366 2017-02-15  Anders Carlsson  <andersca@apple.com>
1367
1368         Fix build.
1369
1370         * page/DragController.cpp:
1371         (WebCore::DragController::doSystemDrag):
1372
1373 2017-02-15  Anders Carlsson  <andersca@apple.com>
1374
1375         Modernize DragClient::startDrag somewhat
1376         https://bugs.webkit.org/show_bug.cgi?id=168379
1377
1378         Reviewed by Tim Horton.
1379
1380         Change DragClient::startDrag to take a DragImage instead of a DragImageRef, and to pass along the source action
1381         instead of whether it's a link or not.
1382
1383         * loader/EmptyClients.cpp:
1384         * page/DragClient.h:
1385         * page/DragController.cpp:
1386         (WebCore::DragController::startDrag):
1387         (WebCore::DragController::doImageDrag):
1388         (WebCore::DragController::doSystemDrag):
1389         * page/DragController.h:
1390
1391 2017-02-15  Chris Dumez  <cdumez@apple.com>
1392
1393         Expose Symbol.toPrimitive / valueOf on Location instances
1394         https://bugs.webkit.org/show_bug.cgi?id=168295
1395
1396         Reviewed by Geoffrey Garen, Keith Miller and Mark Lam.
1397
1398         Expose Symbol.toPrimitive / valueOf on Location instances as per:
1399         - https://html.spec.whatwg.org/#the-location-interface
1400
1401         Firefox and Chrome already comply with the specification.
1402
1403         Tests: fast/dom/location-valueOf-after-object-prototype-update.html
1404                fast/dom/location-valueOf-after-object-prototype-update2.html
1405                imported/w3c/web-platform-tests/html/browsers/history/the-location-interface/location-symbol-toprimitive.html
1406                imported/w3c/web-platform-tests/html/browsers/history/the-location-interface/location-valueof.html
1407
1408         * bindings/scripts/CodeGeneratorJS.pm:
1409         (GenerateImplementation):
1410
1411 2017-02-15  Aakash Jain  <aakash_jain@apple.com>
1412
1413         Remove WebIOSEvent interface
1414         https://bugs.webkit.org/show_bug.cgi?id=168368
1415
1416         Reviewed by Tim Horton.
1417
1418         * platform/ios/WebEvent.h: Removed WebIOSEvent.
1419
1420 2017-02-15  Chris Dumez  <cdumez@apple.com>
1421
1422         [iOS] Form Validation Bubble should be sensitive to Dynamic Type
1423         https://bugs.webkit.org/show_bug.cgi?id=168291
1424         <rdar://problem/30508593>
1425
1426         Reviewed by Tim Horton.
1427
1428         Update ValidationBubble implementation on iOS to stop obeying the
1429         minimum font size setting, given that this setting is not exposed
1430         on iOS. Instead, we now rely on
1431         [UIFont preferredFontForTextStyle:UIFontTextStyleCallout], which
1432         will give us a font whose size obeys Dynamic Type [1] setting on iOS.
1433
1434         [1] https://developer.apple.com/ios/human-interface-guidelines/visual-design/typography/
1435
1436         No new tests, no easily testable.
1437
1438         * platform/ios/ValidationBubbleIOS.mm:
1439         (WebCore::ValidationBubble::ValidationBubble):
1440
1441 2017-02-15  Yusuke Suzuki  <utatane.tea@gmail.com>
1442
1443         [JSC] Drop PassRefPtr
1444         https://bugs.webkit.org/show_bug.cgi?id=168320
1445
1446         Reviewed by Saam Barati.
1447
1448         * bindings/js/ScriptSourceCode.h:
1449         (WebCore::ScriptSourceCode::ScriptSourceCode):
1450         Use Ref and pass it to SourceCode.
1451
1452         * replay/ReplayController.cpp:
1453         (WebCore::ReplayController::frameNavigated):
1454         Pass reference.
1455
1456 2017-02-15  Xabier Rodriguez Calvar  <calvaris@igalia.com>
1457
1458         [GStreamer][MSE][EME] Handle protection event also at decryptor level
1459         https://bugs.webkit.org/show_bug.cgi?id=168316
1460
1461         Reviewed by Žan Doberšek.
1462
1463         So far in MSE pipeline we were handling the encryption events
1464         only when they arrived at the demuxer but this won't work in any
1465         kind of key renegotiation as the event will never arrive. Now we
1466         connect to the element messages, check for the drm id and send it
1467         to the private player for processing.
1468
1469         * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
1470         (WebCore::appendPipelineElementMessageCallback):
1471         (WebCore::AppendPipeline::AppendPipeline):
1472         (WebCore::AppendPipeline::handleElementMessage):
1473         * platform/graphics/gstreamer/mse/AppendPipeline.h:
1474
1475 2017-02-15  Zan Dobersek  <zdobersek@igalia.com>
1476
1477         [EME] MediaKeys::setServerCertificate() must resolve with 'false' when certificates aren't supported
1478         https://bugs.webkit.org/show_bug.cgi?id=168362
1479
1480         Reviewed by Xabier Rodriguez-Calvar.
1481
1482         In MediaKeys::setServerCertificate(), when the CDM implementation
1483         doesn't support server certificates, it should resolve the promise
1484         with the 'false' value, as mandated by the specification, and not
1485         reject it.
1486
1487         A test case in mock-MediaKeys-setServerCertificate.html is updated.
1488
1489         * Modules/encryptedmedia/MediaKeys.cpp:
1490         (WebCore::MediaKeys::setServerCertificate):
1491
1492 2017-02-15  Carlos Garcia Campos  <cgarcia@igalia.com>
1493
1494         REGRESSION (r206014): HTTPHeaderMap does not consistently use comma without space to separate values of header fields
1495         https://bugs.webkit.org/show_bug.cgi?id=168115
1496
1497         Reviewed by Darin Adler.
1498
1499         In r206014 HTTPHeaderMap::add() was updated to combine common headers with ',' instead of ", " to match the
1500         fetch specification, but the uncommon headers are still combined with ", ".
1501
1502         * platform/network/HTTPHeaderMap.cpp:
1503         (WebCore::HTTPHeaderMap::add):
1504
1505 2017-02-14  Ryosuke Niwa  <rniwa@webkit.org>
1506
1507         An assertion failure inside removeChildren
1508         https://bugs.webkit.org/show_bug.cgi?id=168069
1509
1510         Reviewed by Brent Fulgham.
1511
1512         The bug was caused by notifyRemovePendingSheet executing scripts synchronously where it shouldn't.
1513
1514         Removed the call to notifyRemovePendingSheetIfNeeded in notifyChildNodeRemoved. Instead, invoke it
1515         in its call sites when they're safe.
1516
1517         Test: http/tests/security/move-iframe-within-focus-handler-inside-removal.html
1518
1519         * dom/ContainerNode.cpp:
1520         (WebCore::ContainerNode::takeAllChildrenFrom):
1521         (WebCore::ContainerNode::notifyChildInserted):
1522         (WebCore::ContainerNode::removeChild):
1523         (WebCore::ContainerNode::parserRemoveChild):
1524         (WebCore::ContainerNode::replaceAllChildren):
1525         (WebCore::ContainerNode::removeChildren):
1526         * dom/ContainerNodeAlgorithms.cpp:
1527         (WebCore::notifyChildNodeRemoved):
1528
1529 2017-02-15  Carlos Garcia Campos  <cgarcia@igalia.com>
1530
1531         [GStreamer] Several tests are timing out after r212349
1532         https://bugs.webkit.org/show_bug.cgi?id=168359
1533
1534         Reviewed by Žan Doberšek.
1535
1536         This is because they are failing the cross origin check. Those tests are not using WebKitWebSrc, but
1537         GstFileSrc. I didn't consider the case of source not being a WebKitWebSrc.
1538
1539         Fixes several timeout instroduced in r212349.
1540
1541         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
1542         (WebCore::MediaPlayerPrivateGStreamer::hasSingleSecurityOrigin): Split the source check in two. First check if
1543         it's nullptr, and return false. Then check if it's a WebKitWebSrc and return true if it isn't.
1544
1545 2017-02-14  Brent Fulgham  <bfulgham@apple.com>
1546
1547         Revalidate URL after events that could trigger navigations
1548         https://bugs.webkit.org/show_bug.cgi?id=168071
1549         <rdar://problem/30450379>
1550
1551         Reviewed by Ryosuke Niwa.
1552
1553         When arbitary javascript runs during a load, we should revalidate
1554         the URLs involved to make sure they are still valid.
1555
1556         Tests: http/tests/plugins/navigation-during-load-embed.html
1557                http/tests/plugins/navigation-during-load.html
1558
1559         * html/HTMLEmbedElement.cpp:
1560         (WebCore::HTMLEmbedElement::updateWidget): Confirm we are still allowed to
1561         load the URL after executing JS callbacks.
1562         * html/HTMLFrameElementBase.cpp:
1563         (WebCore::HTMLFrameElementBase::isURLAllowed): Split existing function into
1564         existing protected method, and a new public method that checks a passed URL
1565         for validity.
1566         * html/HTMLFrameElementBase.h:
1567         * html/HTMLFrameOwnerElement.h:
1568         (WebCore::HTMLFrameOwnerElement::isURLAllowed):
1569         * html/HTMLObjectElement.cpp:
1570         (WebCore::HTMLObjectElement::updateWidget): Confirm we are still allowed to
1571         load the URL after executing JS callbacks.
1572         * loader/SubframeLoader.cpp:
1573         (WebCore::SubframeLoader::requestFrame): Ditto.
1574
1575 2017-02-14  Carlos Garcia Campos  <cgarcia@igalia.com>
1576
1577         [GStreamer] Implement MediaPlayerPrivate::hasSingleSecurityOrigin()
1578         https://bugs.webkit.org/show_bug.cgi?id=168322
1579
1580         Reviewed by Žan Doberšek.
1581
1582         It currently returns true unconditionally. Add resolved-location property to WebKitWebSourceGStreamer to track
1583         the resolved url returned by the server and use that from MediaPlayerPrivate to check if there was a cross
1584         origin redirection.
1585
1586         Fixes: http/tests/security/canvas-remote-read-remote-video-redirect.html
1587
1588         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
1589         (WebCore::MediaPlayerPrivateGStreamer::hasSingleSecurityOrigin):
1590         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.h:
1591         * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
1592         (webKitWebSrcFinalize):
1593         (webKitWebSrcGetProperty):
1594         (webKitWebSrcStart):
1595         (webKitWebSrcQueryWithParent):
1596         (webKitWebSrcGetUri):
1597         (webKitWebSrcSetUri):
1598         (StreamingClient::handleResponseReceived):
1599         (ResourceHandleStreamingClient::wasBlocked):
1600         (ResourceHandleStreamingClient::cannotShowURL):
1601
1602 2017-02-14  Carlos Garcia Campos  <cgarcia@igalia.com>
1603
1604         Unreviewed, rolling out r211967.
1605
1606         Caused rendering issues in HiDPI
1607
1608         Reverted changeset:
1609
1610         "[GTK] scroll with transparent background not repainted after
1611         scrollY >= 32768"
1612         https://bugs.webkit.org/show_bug.cgi?id=154283
1613         http://trac.webkit.org/changeset/211967
1614
1615 2017-02-14  Carlos Garcia Campos  <cgarcia@igalia.com>
1616
1617         [GTK] Update cookie manager API to properly work with ephemeral sessions
1618         https://bugs.webkit.org/show_bug.cgi?id=168230
1619
1620         Reviewed by Michael Catanzaro.
1621
1622         Add implementation for deleteAllCookiesModifiedSince. Note that this only works when the timespan is 0, we need
1623         new libsoup API to support removing recently modified cookies.
1624
1625         * platform/network/soup/CookieJarSoup.cpp:
1626         (WebCore::deleteAllCookiesModifiedSince):
1627
1628 2017-02-14  Joseph Pecoraro  <pecoraro@apple.com>
1629
1630         [WebIDL] Improve serializer = { inherit }
1631         https://bugs.webkit.org/show_bug.cgi?id=168293
1632
1633         Reviewed by Youenn Fablet.
1634
1635         * bindings/scripts/CodeGeneratorJS.pm:
1636         (GenerateHeader):
1637         Expose a serialize() method on the interface.
1638
1639         (GenerateSerializerFunction):
1640         (GenerateSerializerAttributesForInterface): Deleted.
1641         Subclasses that have `serializer = { inherit }` can use
1642         their parent's serialize() method to get the initial object.
1643         We can now collapse everything back into a single function
1644         because we only generate code for our own attributes.
1645
1646         * bindings/scripts/test/JS/JSTestNode.cpp:
1647         (WebCore::JSTestNode::serialize):
1648         (WebCore::jsTestNodePrototypeFunctionToJSONCaller):
1649         * bindings/scripts/test/JS/JSTestNode.h:
1650         * bindings/scripts/test/JS/JSTestObj.cpp:
1651         (WebCore::JSTestObj::serialize):
1652         (WebCore::jsTestObjPrototypeFunctionToJSONCaller):
1653         * bindings/scripts/test/JS/JSTestObj.h:
1654         * bindings/scripts/test/JS/JSTestSerialization.cpp:
1655         (WebCore::JSTestSerialization::serialize):
1656         (WebCore::jsTestSerializationPrototypeFunctionToJSONCaller):
1657         * bindings/scripts/test/JS/JSTestSerialization.h:
1658         * bindings/scripts/test/JS/JSTestSerializationInherit.cpp:
1659         (WebCore::JSTestSerializationInherit::serialize):
1660         (WebCore::jsTestSerializationInheritPrototypeFunctionToJSONCaller):
1661         * bindings/scripts/test/JS/JSTestSerializationInherit.h:
1662         * bindings/scripts/test/JS/JSTestSerializationInheritFinal.cpp:
1663         (WebCore::JSTestSerializationInheritFinal::serialize):
1664         (WebCore::jsTestSerializationInheritFinalPrototypeFunctionToJSONCaller):
1665         * bindings/scripts/test/JS/JSTestSerializationInheritFinal.h:
1666         Updated results.
1667
1668 2017-02-14  Aakash Jain  <aakash_jain@apple.com>
1669
1670         Move methods from WebCoreThread.h to WebCoreThreadInternal.h
1671         https://bugs.webkit.org/show_bug.cgi?id=168326
1672
1673         Reviewed by Alexey Proskuryakov.
1674
1675         * platform/ios/wak/WebCoreThread.h: Move methods WebThreadRunLoop and WebThreadCurrentContext to WebCoreThreadInternal.h
1676         * platform/ios/wak/WebCoreThreadInternal.h: Ditto.
1677         * platform/ios/wak/WebCoreThreadRun.cpp: Removed WebCoreThread.h as it is already included by WebCoreThreadInternal.h
1678         * platform/ios/wak/WKGraphics.mm: Included WebCoreThreadInternal.h, it subsequently includes WebCoreThread.h
1679         * inspector/InspectorTimelineAgent.cpp: Ditto.
1680         * page/mac/PageMac.mm: Ditto.
1681         * platform/cf/MainThreadSharedTimerCF.cpp: Ditto.
1682         * platform/cocoa/MemoryPressureHandlerCocoa.mm: Ditto.
1683         * platform/graphics/ca/cocoa/LayerFlushSchedulerMac.cpp: Ditto.
1684         * platform/network/cf/SynchronousResourceHandleCFURLConnectionDelegate.cpp: Ditto.
1685         * bindings/js/CommonVM.cpp: included WebCoreThreadInternal.h
1686
1687 2017-02-14  Wenson Hsieh  <wenson_hsieh@apple.com>
1688
1689         [WK2] Support data interaction on links
1690         https://bugs.webkit.org/show_bug.cgi?id=168331
1691         <rdar://problem/30200837>
1692
1693         Reviewed by Tim Horton.
1694
1695         Adds support for data interaction on links at the WebCore layer, refactoring some drag-and-drop code on the Mac
1696         along the way. Also adds two new TestWebKitAPI unit tests in DataInteractionTests.mm: LinkToInput and
1697         BackgroundImageLinkToInput (see Tools/ChangeLog for more information).
1698
1699         * page/DragController.cpp:
1700         (WebCore::DragController::startDrag):
1701         (WebCore::DragController::doImageDrag):
1702         (WebCore::DragController::doSystemDrag):
1703
1704         Introduce platformAdjustDragImageForDeviceScaleFactor, and special-case drag images for links to anchor at the
1705         bottom center.
1706
1707         * platform/DragImage.cpp:
1708         (WebCore::platformAdjustDragImageForDeviceScaleFactor):
1709
1710         Scale the drag image up by the device scale factor. In WebDragClient, we scale the image back down to the
1711         original size. It seems the reason we do this extra dance is because the image sizing heuristic in between
1712         assumes that the image dimensions are for a non-retina device, but this work should really not be necessary if
1713         we tweak the heuristic to account for deviceScaleFactor. We should address this in a separate patch.
1714
1715         * platform/DragImage.h:
1716         * platform/graphics/Path.h:
1717
1718 2017-02-14  Basuke Suzuki  <Basuke.Suzuki@am.sony.com>
1719
1720         [CURL] ResourceError created with error information should have default type Type::General
1721         https://bugs.webkit.org/show_bug.cgi?id=168345
1722
1723         Reviewed by Alex Christensen.
1724
1725         ResourceError has separate implementaion for each platform
1726         so that the interface should be same.
1727         On CURL port, the constructor with error information has
1728         different default value on `type` parameter. It is Type::Null but other implementaitons have Type::General.
1729         This causes some ResourceError is created inconsistent. 
1730
1731         * platform/network/curl/ResourceError.h:
1732         (WebCore::ResourceError::ResourceError):
1733
1734 2017-02-14  Youenn Fablet  <youennf@gmail.com>
1735
1736         [WebRTC] Add support for libwebrtc negotiation needed event
1737         https://bugs.webkit.org/show_bug.cgi?id=168267
1738
1739         Reviewed by Eric Carlson.
1740
1741         Test: webrtc/negotiatedneeded-event-addStream.html
1742
1743         Moving generic code (markAsNeedingNegotiation) from MediaEndpointPeerConnection to PeerConnectionBackend.
1744         This code handles the control of sending or not the negotiationneeded event.
1745
1746         Updating mock to use markAsNeedingNegotiation when streams are changed.
1747         Updating libwebrtc backend to call markAsNeedingNegotiation when required by libwebrtc implementation.
1748
1749         * Modules/mediastream/MediaEndpointPeerConnection.cpp:
1750         (WebCore::MediaEndpointPeerConnection::setLocalDescriptionTask):
1751         * Modules/mediastream/MediaEndpointPeerConnection.h:
1752         * Modules/mediastream/PeerConnectionBackend.cpp:
1753         (WebCore::PeerConnectionBackend::markAsNeedingNegotiation):
1754         * Modules/mediastream/PeerConnectionBackend.h:
1755         (WebCore::PeerConnectionBackend::isNegotiationNeeded):
1756         (WebCore::PeerConnectionBackend::clearNegotiationNeededState):
1757         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
1758         (WebCore::LibWebRTCMediaEndpoint::OnRenegotiationNeeded):
1759         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
1760         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h:
1761         * testing/MockLibWebRTCPeerConnection.cpp:
1762         (WebCore::MockLibWebRTCPeerConnection::AddStream):
1763         (WebCore::MockLibWebRTCPeerConnection::RemoveStream):
1764
1765 2017-02-14  Brady Eidson  <beidson@apple.com>
1766
1767         Unreviewed followup to r212330 to fix Debug builds
1768
1769         * loader/DocumentThreadableLoader.cpp:
1770         (WebCore::DocumentThreadableLoader::DocumentThreadableLoader): Add call to relaxAdoptionRequirement().
1771
1772 2017-02-14  Matt Rajca  <mrajca@apple.com>
1773
1774         Website policies: iframes should respect the autoplay policy of the top-level document
1775         https://bugs.webkit.org/show_bug.cgi?id=168333
1776
1777         Reviewed by Alex Christensen.
1778
1779         API tests were added.
1780
1781         * html/HTMLMediaElement.cpp:
1782         (WebCore::HTMLMediaElement::HTMLMediaElement):
1783
1784 2017-02-14  Dean Jackson  <dino@apple.com>
1785
1786         Rename preferLowPowerWebGLRendering setting to forceWebGLUsesLowPower
1787         https://bugs.webkit.org/show_bug.cgi?id=168339
1788         <rdar://problem/30522092>
1789
1790         Reviewed by Simon Fraser.
1791
1792         Use a setting name that more clearly reflects what it is doing. It's not
1793         preferring to use the low-power GPU, it's forcing it.
1794
1795         * html/canvas/WebGLRenderingContextBase.cpp:
1796         (WebCore::WebGLRenderingContextBase::create):
1797         * page/Settings.in:
1798
1799 2017-02-14  Brady Eidson  <beidson@apple.com>
1800
1801         Speculative fix for: Crash in DocumentThreadableLoader::redirectReceived.
1802         <rdar://problem/29899473> and https://bugs.webkit.org/show_bug.cgi?id=168337
1803
1804         Reviewed by Geoffrey Garen.
1805
1806         No new tests (Unable to find a reproduction).
1807
1808         * loader/DocumentThreadableLoader.cpp:
1809         (WebCore::DocumentThreadableLoader::loadRequest):
1810
1811 2017-02-14  Youenn Fablet  <youenn@apple.com>
1812
1813         [WebRTC] Remove obsolete WebRTC stats API
1814         https://bugs.webkit.org/show_bug.cgi?id=167910
1815
1816         Reviewed by Alex Christensen.
1817
1818         No change of behavior as removed constructs are not functional.
1819         Removing RTCStatsResponse which no longer exists and made RTCStatsReport an empty container for now.
1820
1821         * CMakeLists.txt:
1822         * DerivedSources.cpp:
1823         * DerivedSources.make:
1824         * Modules/mediastream/MediaEndpointPeerConnection.cpp:
1825         (WebCore::MediaEndpointPeerConnection::getStats):
1826         * Modules/mediastream/MediaEndpointPeerConnection.h:
1827         * Modules/mediastream/PeerConnectionBackend.h:
1828         * Modules/mediastream/RTCPeerConnection.cpp:
1829         (WebCore::RTCPeerConnection::getStats):
1830         * Modules/mediastream/RTCStatsReport.cpp:
1831         (WebCore::RTCStatsReport::create): Deleted.
1832         (WebCore::RTCStatsReport::RTCStatsReport): Deleted.
1833         (WebCore::RTCStatsReport::names): Deleted.
1834         (WebCore::RTCStatsReport::local): Deleted.
1835         (WebCore::RTCStatsReport::remote): Deleted.
1836         (WebCore::RTCStatsReport::addStatistic): Deleted.
1837         * Modules/mediastream/RTCStatsReport.h:
1838         (WebCore::RTCStatsReport::create):
1839         (WebCore::RTCStatsReport::timestamp): Deleted.
1840         (WebCore::RTCStatsReport::id): Deleted.
1841         (WebCore::RTCStatsReport::type): Deleted.
1842         (WebCore::RTCStatsReport::stat): Deleted.
1843         * Modules/mediastream/RTCStatsReport.idl:
1844         * Modules/mediastream/RTCStatsResponse.cpp: Removed.
1845         * Modules/mediastream/RTCStatsResponse.h: Removed.
1846         * Modules/mediastream/RTCStatsResponse.idl: Removed.
1847         * WebCore.xcodeproj/project.pbxproj:
1848         * platform/mediastream/MediaEndpoint.h:
1849         (WebCore::MediaEndpoint::getStats):
1850         * platform/mediastream/RTCStatsRequest.h: Removed.
1851         * platform/mediastream/RTCStatsResponseBase.h: Removed.
1852
1853 2017-02-14  Karim H  <karim@karhm.com>
1854
1855         Removed unused methods of WebCore::FileStream
1856         https://bugs.webkit.org/show_bug.cgi?id=168025
1857
1858         Reviewed by Michael Catanzaro.
1859
1860         * fileapi/AsyncFileStream.cpp:
1861         (WebCore::AsyncFileStream::openForWrite): Deleted.
1862         (WebCore::AsyncFileStream::write): Deleted.
1863         (WebCore::AsyncFileStream::truncate): Deleted.
1864         * fileapi/AsyncFileStream.h:
1865         * platform/FileStream.cpp:
1866         (WebCore::FileStream::openForWrite): Deleted.
1867         (WebCore::FileStream::write): Deleted.
1868         (WebCore::FileStream::truncate): Deleted.
1869         * platform/FileStream.h:
1870
1871 2017-02-14  Chris Dumez  <cdumez@apple.com>
1872
1873         HTML Form Validation bubble should take minimum font size setting into consideration
1874         https://bugs.webkit.org/show_bug.cgi?id=168271
1875         <rdar://problem/29869869>
1876
1877         Reviewed by Simon Fraser.
1878
1879         HTML Form Validation bubble should take minimum font size setting into consideration
1880         for better accessibility.
1881
1882         Test: fast/forms/validation-message-minimum-font-size.html
1883
1884         * platform/ValidationBubble.h:
1885         (WebCore::ValidationBubble::create):
1886         (WebCore::ValidationBubble::fontSize):
1887         * platform/ios/ValidationBubbleIOS.mm:
1888         (WebCore::ValidationBubble::ValidationBubble):
1889         * platform/mac/ValidationBubbleMac.mm:
1890         (WebCore::ValidationBubble::ValidationBubble):
1891         Update the ValidationBubble constructor to take in Settings. For now, there is a
1892         single setting that is the minimum font size and that is taken into account when
1893         setting the font size of the validation bubble text.
1894
1895 2017-02-14  Eric Carlson  <eric.carlson@apple.com>
1896
1897         [MediaStream] add navigator.getUserMedia for compatibility with legacy content
1898         https://bugs.webkit.org/show_bug.cgi?id=168324
1899         <rdar://problem/30513125>
1900
1901         Reviewed by Youenn Fablet.
1902
1903         Tests: fast/mediastream/argument-types.html
1904                fast/mediastream/getusermedia.html
1905                fast/mediastream/webkitGetUserMedia-shadowing-then.html
1906
1907         * CMakeLists.txt:
1908         * DerivedSources.cpp:
1909         * DerivedSources.make:
1910         * Modules/mediastream/MediaDevices.idl:
1911         * Modules/mediastream/NavigatorUserMedia.idl: Added.
1912         * Modules/mediastream/NavigatorUserMedia.js: Added.
1913         * WebCore.xcodeproj/project.pbxproj:
1914         * bindings/js/WebCoreBuiltinNames.h:
1915         * page/Navigator.idl:
1916
1917 2017-02-14  Chris Dumez  <cdumez@apple.com>
1918
1919         Fallback to legacy type only when event is trusted
1920         https://bugs.webkit.org/show_bug.cgi?id=168301
1921
1922         Reviewed by Ryosuke Niwa.
1923
1924         Fallback to legacy type only when event is trusted as per a recent
1925         DOM specification change:
1926         - https://github.com/whatwg/dom/issues/404
1927         - https://github.com/whatwg/dom/pull/406
1928
1929         No new tests, rebaselined existing test.
1930
1931         * dom/EventTarget.cpp:
1932         (WebCore::legacyType):
1933         (WebCore::EventTarget::fireEventListeners):
1934
1935 2017-02-13  Dean Jackson  <dino@apple.com>
1936
1937         Rename preferLowPowerToHighPerformance to powerPreference
1938         https://bugs.webkit.org/show_bug.cgi?id=168269
1939         <rdar://problem/30504444>
1940
1941         Reviewed by Chris Dumez.
1942
1943         Based on the discussion in https://github.com/KhronosGroup/WebGL/pull/2283.
1944
1945         Change WebGLContextAttributes's preferLowPowerToHighPerformance boolean
1946         into a powerPreference enum taking three values. The implementation
1947         of the enum is in GraphicsContext3DAttributes.
1948
1949         While the name and values have changed, there should be no change in
1950         behaviour caused by this patch.
1951
1952         * html/canvas/WebGLContextAttributes.h: Use GraphicsContext3DAttributes
1953         enum GraphicsContext3DPowerPreference.
1954         * html/canvas/WebGLContextAttributes.idl: Rename and add the WebIDL enum.
1955         * html/canvas/WebGLRenderingContextBase.cpp: Use the new values.
1956         (WebCore::WebGLRenderingContextBase::create):
1957         (WebCore::WebGLRenderingContextBase::registerWithWebGLStateTracker):
1958         * platform/WebGLStateTracker.cpp:
1959         * platform/WebGLStateTracker.h: Update the state tracker to use the new
1960         values.
1961         * platform/graphics/GraphicsContext3DAttributes.h:
1962         * platform/graphics/mac/GraphicsContext3DMac.mm:
1963         (WebCore::setPixelFormat): Accept GraphicsContext3DPowerPreference as a parameter.
1964         (WebCore::GraphicsContext3D::GraphicsContext3D):
1965
1966 2017-02-14  Youenn Fablet  <youennf@gmail.com>
1967
1968         [WebRTC] Implement description getters for libwebrtc RTCPeerConnection
1969         https://bugs.webkit.org/show_bug.cgi?id=168234
1970
1971         Reviewed by Alex Christensen.
1972
1973         Allows passing W3C webrtc tests.
1974
1975         Implementing localDescription/remoteDescription using libwebrtc backend.
1976         current and pending description getters are made the same as local/remote getters for the moment.
1977         This should be fixed when upgrading to latest libwebrtc revision.
1978
1979         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
1980         (WebCore::toSessionDescriptionType):
1981         (WebCore::fromSessionDescriptionType):
1982         (WebCore::fromSessionDescription):
1983         (WebCore::LibWebRTCMediaEndpoint::localDescription):
1984         (WebCore::LibWebRTCMediaEndpoint::remoteDescription):
1985         (WebCore::LibWebRTCMediaEndpoint::doSetLocalDescription):
1986         (WebCore::LibWebRTCMediaEndpoint::doSetRemoteDescription):
1987         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:
1988         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
1989         (WebCore::LibWebRTCPeerConnectionBackend::localDescription):
1990         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h:
1991
1992 2017-02-14  Jeremy Jones  <jeremyj@apple.com>
1993
1994         When playing inline after fullscreen, set a flag instead of adding attribute plays inline, and use in requiresFullscreenForVideoPlayback.
1995         https://bugs.webkit.org/show_bug.cgi?id=167815
1996         rdar://problem/27685077
1997
1998         Reviewed by Jer Noble.
1999
2000         Test: media/media-fullscreen-loop-inline.html
2001
2002         When video is allowed to play inline after fullscreen. Looped video causes play state to update, which can send video back to fullscreen when
2003         allowsInline is false. This change will set a new flag when allowsInlineMediaPlaybackAfterFullscreen allows inline playback that can be tested
2004         in requiresFullscreenForVideoPlayback to prevent sending video back into fullscreen when video loops.
2005
2006         * html/HTMLMediaElement.cpp:
2007         (WebCore::HTMLMediaElement::enterFullscreen):
2008         (WebCore::HTMLMediaElement::exitFullscreen):
2009         * html/HTMLMediaElement.h:
2010         (WebCore::HTMLMediaElement::isTemporarilyAllowingInlinePlaybackAfterFullscreen): Added.
2011         * html/MediaElementSession.cpp:
2012         (WebCore::MediaElementSession::requiresFullscreenForVideoPlayback):
2013
2014 2017-02-14  Jer Noble  <jer.noble@apple.com>
2015
2016         Video elements with MediaSource objects set by srcObject are not cleared when srcObject is set to null
2017         https://bugs.webkit.org/show_bug.cgi?id=168268
2018
2019         Reviewed by Eric Carlson.
2020
2021         Test: fast/mediastream/MediaStream-MediaElement-setObject-null.html
2022
2023         Make the setSrcObject() operation compliant with the HTML spec. Since the specification defines
2024         srcObject in terms of either a MediaSource, MediaStream, or Blob object, add the variant typedef
2025         to HTMLMediaElement and move the definition out of the Modules/mediastream extension IDL and into
2026         HTMLMediaElement.idl. Then bring the "media elements load" and "resource selection" algorithms up
2027         to their most recent definitions in the HTML5 spec.
2028
2029         Drive-by fix: Allow the (admittedly weird) single-element-union type in IDL.
2030
2031         * CMakeLists.txt:
2032         * DerivedSources.cpp:
2033         * DerivedSources.make:
2034         * Modules/mediastream/HTMLMediaElementMediaStream.cpp: Removed.
2035         * Modules/mediastream/HTMLMediaElementMediaStream.h: Removed.
2036         * Modules/mediastream/HTMLMediaElementMediaStream.idl: Removed.
2037         * WebCore.xcodeproj/project.pbxproj:
2038         * bindings/scripts/IDLParser.pm:
2039         (parseUnionType):
2040         * html/HTMLAudioElement.cpp:
2041         (WebCore::HTMLAudioElement::createForJSConstructor):
2042         * html/HTMLMediaElement.cpp:
2043         (WebCore::actionName):
2044         (WebCore::HTMLMediaElement::parseAttribute):
2045         (WebCore::HTMLMediaElement::insertedInto):
2046         (WebCore::HTMLMediaElement::scheduleDelayedAction):
2047         (WebCore::HTMLMediaElement::scheduleNextSourceChild):
2048         (WebCore::HTMLMediaElement::pendingActionTimerFired):
2049         (WebCore::HTMLMediaElement::setSrcObject):
2050         (WebCore::HTMLMediaElement::load):
2051         (WebCore::HTMLMediaElement::prepareForLoad):
2052         (WebCore::HTMLMediaElement::selectMediaResource):
2053         (WebCore::HTMLMediaElement::loadResource):
2054         (WebCore::HTMLMediaElement::playInternal):
2055         (WebCore::HTMLMediaElement::pauseInternal):
2056         (WebCore::HTMLMediaElement::sourceWasAdded):
2057         (WebCore::HTMLMediaElement::clearMediaPlayer):
2058         (WebCore::HTMLMediaElement::resume):
2059         (WebCore::HTMLMediaElement::mediaCanStart):
2060         (WebCore::HTMLMediaElement::createMediaPlayer):
2061         (WebCore::HTMLMediaElement::loadInternal): Deleted.
2062         * html/HTMLMediaElement.h:
2063         (WebCore::HTMLMediaElement::srcObject):
2064         * html/HTMLMediaElement.idl:
2065         * platform/ContentType.h:
2066
2067 2017-02-14  Aakash Jain  <aakash_jain@apple.com>
2068
2069         Remove unused WebThreadContextIsCurrent method from WebCoreThread.h
2070         https://bugs.webkit.org/show_bug.cgi?id=168254
2071
2072         Reviewed by Dan Bernstein.
2073
2074         * platform/ios/wak/WebCoreThread.h: Removed unused WebThreadContextIsCurrent.
2075         * platform/ios/wak/WebCoreThread.mm:
2076         (WebThreadContextIsCurrent): Deleted.
2077
2078 2017-02-14  Alexey Proskuryakov  <ap@apple.com>
2079
2080         WebCore shouldn't export SystemMemory.h
2081         https://bugs.webkit.org/show_bug.cgi?id=168285
2082
2083         Reviewed by Alex Christensen.
2084
2085         * WebCore.xcodeproj/project.pbxproj:
2086
2087 2017-02-13  Filip Pizlo  <fpizlo@apple.com>
2088
2089         worker.postMessage should throw a TypeError if a SharedArrayBuffer is in the transfer list
2090         https://bugs.webkit.org/show_bug.cgi?id=168277
2091
2092         Reviewed by Mark Lam.
2093
2094         Test: workers/sab/postMessage-transfer-type-error.html
2095         
2096         This is a simple spec compliance change. The title says it all.
2097
2098         * bindings/js/SerializedScriptValue.cpp:
2099         (WebCore::SerializedScriptValue::create):
2100
2101 2017-02-14  Zan Dobersek  <zdobersek@igalia.com>
2102
2103         HTMLMediaElement: WebKitMediaKeys member name should be prefixed
2104         https://bugs.webkit.org/show_bug.cgi?id=168297
2105
2106         Reviewed by Xabier Rodriguez-Calvar.
2107
2108         Rename the LEGACY_ENCRYPTED_MEDIA m_mediaKeys variable to m_webkitMediaKeys
2109         so that it contains the legacy prefix, just like the API. This will make
2110         room for the MediaKeys member variable that will be implemented under
2111         the ENCRYPTED_MEDIA guards.
2112
2113         * html/HTMLMediaElement.cpp:
2114         (WebCore::HTMLMediaElement::mediaPlayerCachedKeyForKeyId):
2115         (WebCore::HTMLMediaElement::webkitSetMediaKeys):
2116         * html/HTMLMediaElement.h:
2117         (WebCore::HTMLMediaElement::webkitKeys):
2118
2119 2017-02-14  Carlos Garcia Campos  <cgarcia@igalia.com>
2120
2121         [GTK] Make DragImageRef a RefPtr instead of a plain pointer
2122         https://bugs.webkit.org/show_bug.cgi?id=168296
2123
2124         Reviewed by Sergio Villar Senin.
2125
2126         Use RefPtr<cairo_surface_t> as DragImageRef for GTK+ port to avoid memory leaks.
2127
2128         * platform/DragImage.h:
2129         * platform/gtk/DragImageGtk.cpp:
2130         (WebCore::dragImageSize):
2131         (WebCore::deleteDragImage):
2132         (WebCore::scaleDragImage):
2133         (WebCore::dissolveDragImageToFraction):
2134         (WebCore::createDragImageFromImage):
2135         (WebCore::createDragImageIconForCachedImageFilename):
2136
2137 2017-02-14  Vanessa Chipirrás Navalón  <vchipirras@igalia.com>
2138
2139         [GStreamer][MSE] Some GStreamer log messages are generated with the 'default' category
2140         https://bugs.webkit.org/show_bug.cgi?id=168015
2141
2142         Reviewed by Xabier Rodriguez-Calvar.
2143
2144         The elements AppendPipeline, PlaybackPipeline, MediaSourceClientGstreamerMSE do not have
2145         a defined Gstreamer log category, then the webkitmse category has been added to them.
2146         WebKitMediaSourceGstreamer has its own category but was not declared at the beginning of
2147         the .cpp file.
2148
2149         * platform/graphics/gstreamer/mse/AppendPipeline.cpp: Added webkitmse category.
2150         * platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.cpp:
2151         Added webkitmse category and gst header.
2152         * platform/graphics/gstreamer/mse/PlaybackPipeline.cpp: Added webkitmse category.
2153         * platform/graphics/gstreamer/mse/WebKitMediaSourceGStreamer.cpp:
2154         Added webkitmediasrc category.
2155
2156 2017-02-14  Carlos Garcia Campos  <cgarcia@igalia.com>
2157
2158         CookieManager only works with the default session
2159         https://bugs.webkit.org/show_bug.cgi?id=168229
2160
2161         Reviewed by Alex Christensen.
2162
2163         Update cookie observer API to use a std::function instead of a function pointer and make it work with multiple
2164         sessions in the backends that support it.
2165
2166         * platform/network/CookieStorage.h:
2167         * platform/network/cf/CookieStorageCFNet.cpp:
2168         (WebCore::cookieChangeCallbackMap):
2169         (WebCore::notifyCookiesChanged):
2170         (WebCore::startObservingCookieChanges):
2171         (WebCore::stopObservingCookieChanges):
2172         * platform/network/mac/CookieStorageMac.mm:
2173         (-[WebCookieStorageObjCAdapter startListeningForCookieChangeNotificationsWithCallback:]):
2174         (-[WebCookieStorageObjCAdapter stopListeningForCookieChangeNotifications]):
2175         (WebCore::startObservingCookieChanges):
2176         (WebCore::stopObservingCookieChanges):
2177         * platform/network/soup/CookieStorageSoup.cpp:
2178         (WebCore::cookieChangeCallbackMap):
2179         (WebCore::soupCookiesChanged):
2180         (WebCore::startObservingCookieChanges):
2181         (WebCore::stopObservingCookieChanges):
2182
2183 2017-02-13  Antoine Quint  <graouts@apple.com>
2184
2185         REGRESSION: Update volume and scrubbing slider to match HI designs
2186         https://bugs.webkit.org/show_bug.cgi?id=168170
2187         <rdar://problem/28095266>
2188
2189         Reviewed by Dean Jackson.
2190
2191         We bring the designs of the control's background materials, scrubber and
2192         volume slider up to spec.
2193
2194         The first important set of changes is that, on macOS, the materials and colors
2195         were incorrect. Buttons and time labels now set a mix-blend-mode to correctly
2196         appear vibrant against the media, and the controls bar, volume container
2197         and tracks menu now use a new BackgroundTint node to correctly apply both
2198         a backdrop-filter and blended tint above it.
2199
2200         The second important set of changes is the rendering of the sliders. Up to now
2201         we would simply style the <input type="range"> track and thumb, applying solid
2202         fills and strokes. We now draw sliders in two ways depending on the platform.
2203         
2204         On macOS, we draw the whole slider with a <canvas> element with "mix-blend-mode"
2205         set to "plus-lighter". On iOS, we draw the track as a <div> with "mix-blend-mode"
2206         set to "plus-darker" and draw the fill (up to the thumb) in the <canvas> with
2207         no blend mode to obtain a pure white color, finally the thumb is rendered by the
2208         <input> element. We couldn't draw the pure white color with the track in the
2209         same <canvas> due to the "plus-darker" blend mode.
2210
2211         Test: media/modern-media-controls/background-tint/background-tint.html
2212
2213         * Modules/modern-media-controls/controls/airplay-button.css:
2214         (button.airplay.on):
2215         * Modules/modern-media-controls/controls/background-tint.css: Added.
2216         (.background-tint):
2217         (.background-tint,):
2218         (.background-tint > .blur):
2219         (.background-tint > .tint):
2220         * Modules/modern-media-controls/controls/background-tint.js: Added.
2221         (BackgroundTint):
2222         * Modules/modern-media-controls/controls/ios-inline-media-controls.css:
2223         (.media-controls.ios.inline .scrubber.slider):
2224         (.media-controls.ios.inline .scrubber.slider > div):
2225         (.media-controls.ios.inline .scrubber.slider > input::-webkit-slider-thumb):
2226         (.media-controls.ios.inline .scrubber.slider > .fill): Deleted.
2227         * Modules/modern-media-controls/controls/macos-compact-inline-media-controls.css:
2228         (.media-controls.mac.inline.compact .volume-slider-container):
2229         (.media-controls.mac.inline.compact .volume.slider):
2230         (.media-controls.mac.inline.compact .scrubber.slider > input::-webkit-slider-thumb): Deleted.
2231         * Modules/modern-media-controls/controls/macos-fullscreen-media-controls.css:
2232         (.media-controls.mac.fullscreen > .controls-bar):
2233         (.media-controls.mac.fullscreen > .controls-bar > .background-tint > div):
2234         (.media-controls.mac.fullscreen .volume.slider):
2235         (.media-controls.mac.fullscreen button.volume-up):
2236         (.media-controls.mac.fullscreen button.rewind):
2237         (.media-controls.mac.fullscreen button.forward):
2238         (.media-controls.mac.fullscreen .buttons-container.right button):
2239         (.media-controls.mac.fullscreen .scrubber):
2240         (.media-controls.mac.fullscreen > .controls-bar button): Deleted.
2241         (.media-controls.mac.fullscreen button.airplay): Deleted.
2242         (.media-controls.mac.fullscreen button.aspect-ratio): Deleted.
2243         (.media-controls.mac.fullscreen button.pip): Deleted.
2244         (.media-controls.mac.fullscreen button.tracks): Deleted.
2245         (.media-controls.mac.fullscreen button.fullscreen): Deleted.
2246         * Modules/modern-media-controls/controls/macos-fullscreen-media-controls.js:
2247         * Modules/modern-media-controls/controls/macos-inline-media-controls.css:
2248         (.media-controls.mac.inline .scrubber.slider):
2249         (.media-controls.mac.inline .volume-slider-container):
2250         (.media-controls.mac.inline .volume-slider-container > .background-tint):
2251         (.media-controls.mac.inline .volume-slider-container > .background-tint > div):
2252         (.media-controls.mac.inline .volume.slider):
2253         (.media-controls.mac.inline button): Deleted.
2254         (.media-controls.mac.inline button:active): Deleted.
2255         (.media-controls.mac.inline > .controls-bar button): Deleted.
2256         (.media-controls.mac.inline > .controls-bar,): Deleted.
2257         (.media-controls.mac.inline .volume-slider-container:before): Deleted.
2258         * Modules/modern-media-controls/controls/macos-inline-media-controls.js:
2259         (MacOSInlineMediaControls.prototype.layout):
2260         * Modules/modern-media-controls/controls/macos-media-controls.css: Added.
2261         (.media-controls.mac button:active):
2262         (.media-controls.mac > .controls-bar button):
2263         (.media-controls.mac > .controls-bar .time-label):
2264         (.media-controls.mac > .controls-bar .slider > canvas):
2265         (.media-controls.mac > .controls-bar .slider > input::-webkit-slider-thumb):
2266         * Modules/modern-media-controls/controls/scrubber.css: Removed.
2267         * Modules/modern-media-controls/controls/scrubber.js:
2268         (Scrubber):
2269         (Scrubber.prototype.get buffered):
2270         (Scrubber.prototype.set buffered):
2271         (Scrubber.prototype.draw):
2272         (Scrubber.prototype._drawMacOS):
2273         (Scrubber.prototype._drawiOS):
2274         * Modules/modern-media-controls/controls/slider.css:
2275         (.slider):
2276         (.slider > canvas,):
2277         (.slider > canvas):
2278         (.slider > input):
2279         (.slider > input,): Deleted.
2280         (.slider > .fill): Deleted.
2281         (.slider > input::-webkit-slider-thumb): Deleted.
2282         * Modules/modern-media-controls/controls/slider.js:
2283         (Slider.prototype.set value):
2284         (Slider.prototype.set width):
2285         (Slider.prototype.commitProperty):
2286         (Slider.prototype.layout):
2287         (Slider.prototype.draw):
2288         (Slider.prototype._handleInputEvent):
2289         (Slider.prototype._handleChangeEvent):
2290         (addRoundedRect):
2291         (Slider.prototype._updateFill): Deleted.
2292         * Modules/modern-media-controls/controls/start-button.css:
2293         (button.start):
2294         * Modules/modern-media-controls/controls/time-control.js:
2295         * Modules/modern-media-controls/controls/time-label.css:
2296         (.time-label):
2297         * Modules/modern-media-controls/controls/tracks-panel.css:
2298         (.tracks-panel):
2299         (.tracks-panel > .background-tint > div):
2300         (.tracks-panel > section):
2301         (.tracks-panel > section:first-of-type):
2302         (.tracks-panel > section > h3):
2303         (.tracks-panel > section > ul):
2304         (.tracks-panel > section > ul > li):
2305         (.tracks-panel > section > ul > li:focus):
2306         (.tracks-panel > section > ul > li.selected:before):
2307         (.tracks-panel > section > ul > li.animated):
2308         (.tracks-panel-section): Deleted.
2309         (.tracks-panel-section:first-of-type): Deleted.
2310         (.tracks-panel-section > h3): Deleted.
2311         (.tracks-panel-section > ul): Deleted.
2312         (.tracks-panel-section > ul > li): Deleted.
2313         (.tracks-panel-section > ul > li:focus): Deleted.
2314         (.tracks-panel-section > ul > li.selected:before): Deleted.
2315         (.tracks-panel-section > ul > li.animated): Deleted.
2316         * Modules/modern-media-controls/controls/tracks-panel.js:
2317         (TracksPanel.prototype._childrenFromDataSource):
2318         (TracksPanel.prototype._childrenFromDataSource.): Deleted.
2319         * Modules/modern-media-controls/controls/volume-slider.js:
2320         (VolumeSlider):
2321         (VolumeSlider.prototype.handleEvent):
2322         (VolumeSlider.prototype.draw):
2323         * Modules/modern-media-controls/js-files:
2324         * Modules/modern-media-controls/media/scrubbing-support.js:
2325         (ScrubbingSupport.prototype.get mediaEvents):
2326         (ScrubbingSupport.prototype.syncControl):
2327         (ScrubbingSupport):
2328
2329 2017-02-13  Alex Christensen  <achristensen@webkit.org>
2330
2331         URLs with an invalid IPv4 address should be invalid
2332         https://bugs.webkit.org/show_bug.cgi?id=168260
2333
2334         Reviewed by Tim Horton.
2335
2336         All URL hosts are fed through the IPv4 parser.  https://webkit.org/ doesn't
2337         look enough like an IPv4 address to be considered an invalid IPv4 address, so 
2338         we continue to the String host processing.  http://127.0.0.257 does, though, and
2339         according to https://url.spec.whatwg.org/#concept-ipv4-parser parsing that URL
2340         should fail.
2341
2342         Covered by newly passing web platform tests.
2343
2344         * platform/URLParser.cpp:
2345         (WebCore::URLParser::parseIPv4Host):
2346         (WebCore::URLParser::parseHostAndPort):
2347         * platform/URLParser.h:
2348
2349 2017-02-13  Dan Bernstein  <mitz@apple.com>
2350
2351         Reverted r212275. It still breaks some Apple-internal builds.
2352
2353         * platform/spi/mac/TUCallSPI.h:
2354
2355 2017-02-13  Joseph Pecoraro  <pecoraro@apple.com>
2356
2357         Address ESLint warnings in modern-media-controls
2358         https://bugs.webkit.org/show_bug.cgi?id=168224
2359
2360         Reviewed by Alexey Proskuryakov.
2361
2362         * Modules/modern-media-controls/controls/controls-bar.js:
2363         * Modules/modern-media-controls/controls/fullscreen-button.js:
2364         * Modules/modern-media-controls/controls/layout-node.js:
2365         * Modules/modern-media-controls/controls/macos-fullscreen-media-controls.js:
2366         * Modules/modern-media-controls/controls/media-controls.js:
2367         * Modules/modern-media-controls/controls/scheduler.js:
2368         * Modules/modern-media-controls/controls/seek-button.js:
2369         * Modules/modern-media-controls/controls/tracks-panel.js:
2370         * Modules/modern-media-controls/controls/volume-slider.js:
2371         * Modules/modern-media-controls/gesture-recognizers/gesture-recognizer.js:
2372         * Modules/modern-media-controls/gesture-recognizers/pinch.js:
2373         * Modules/modern-media-controls/media/fullscreen-support.js:
2374         * Modules/modern-media-controls/media/media-controller.js:
2375         * Modules/modern-media-controls/media/placard-support.js:
2376         * Modules/modern-media-controls/media/status-support.js:
2377         Address pedantic warnings.
2378
2379 2017-02-13  Dan Bernstein  <mitz@apple.com>
2380
2381         Restored changes from r212210 in a way that does not break the build.
2382
2383         * platform/spi/mac/TUCallSPI.h:
2384
2385 2017-02-13  Zalan Bujtas  <zalan@apple.com>
2386
2387         FontCascade::widthForSimpleText should skip applyTransforms() when kerning and ligatures are off.
2388         https://bugs.webkit.org/show_bug.cgi?id=168251
2389         <rdar://problem/30498102>
2390
2391         Reviewed by Antti Koivisto.
2392
2393         Covered by existing (perf)tests.
2394
2395         * platform/graphics/FontCascade.cpp:
2396         (WebCore::FontCascade::widthForSimpleText):
2397
2398 2017-02-12  Brian Burg  <bburg@apple.com>
2399
2400         Web Inspector: expose system user interface layout direction through InspectorFrontendHost
2401         https://bugs.webkit.org/show_bug.cgi?id=168209
2402         <rdar://problem/11573736>
2403
2404         Reviewed by Joseph Pecoraro.
2405
2406         Forward the UserInterfaceLayoutDirection of the inspector page. If the WebKit client has
2407         properly set the UI directionality from system settings in PageClient, this will get inherited
2408         automatically by the Inspector's WebPage instance.
2409
2410         * inspector/InspectorFrontendClient.h:
2411         * inspector/InspectorFrontendClientLocal.cpp:
2412         (WebCore::InspectorFrontendClientLocal::userInterfaceLayoutDirection):
2413         * inspector/InspectorFrontendClientLocal.h:
2414
2415         * inspector/InspectorFrontendHost.h:
2416         * inspector/InspectorFrontendHost.idl:
2417         * inspector/InspectorFrontendHost.cpp:
2418         (WebCore::InspectorFrontendHost::userInterfaceLayoutDirection):
2419         Expose the directionality to the frontend as "ltr" or "rtl" strings.
2420
2421 2017-02-13  Zalan Bujtas  <zalan@apple.com>
2422
2423         Simple line layout: Do not measure runs with trailing whitespace when kerning and ligatures are off.
2424         https://bugs.webkit.org/show_bug.cgi?id=168247
2425         <rdar://problem/30497288>
2426
2427         Reviewed by Antti Koivisto.
2428
2429         The width of the run is supposed to be the same with or without the trailing whitespace.
2430
2431         Covered by performance test.
2432
2433         * rendering/SimpleLineLayoutTextFragmentIterator.cpp:
2434         (WebCore::SimpleLineLayout::TextFragmentIterator::Style::Style):
2435         (WebCore::SimpleLineLayout::TextFragmentIterator::textWidth):
2436         * rendering/SimpleLineLayoutTextFragmentIterator.h:
2437
2438 2017-02-13  Karim H  <karim@karhm.com>
2439
2440         Added the other missing BSTR roles tag names.
2441         https://bugs.webkit.org/show_bug.cgi?id=165545
2442
2443         Reviewed by Chris Fleizach.
2444
2445         Test: accessibility/win/bstr-elements-role.html
2446
2447         * accessibility/AccessibilityRenderObject.cpp:
2448         (WebCore::shouldReturnTagNameAsRoleForMSAA):
2449
2450 2017-02-13  Youenn Fablet  <youennf@gmail.com>
2451
2452         [WebRTC] Creating RTCPeerConnection with libwebrtc backend is crashing on rwt
2453         https://bugs.webkit.org/show_bug.cgi?id=168250
2454
2455         Reviewed by Alex Christensen.
2456
2457         Covered by webrtc tests in LayoutTests and in web-platform-tests.
2458         Making mock peer connection factory keep a ref of the real libwebrtc peer connection factory.
2459         That way, it can create real libwebrtc backends whenever requested by tests.
2460
2461         Moving LibWebRTCUtils.h routines as static LibWebRTCProvider methods.
2462         In the future, we should make them no longer static.
2463
2464         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
2465         (WebCore::LibWebRTCMediaEndpoint::doCreateOffer):
2466         (WebCore::LibWebRTCMediaEndpoint::doCreateAnswer):
2467         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:
2468         * WebCore.xcodeproj/project.pbxproj:
2469         * platform/mediastream/libwebrtc/LibWebRTCProvider.cpp: Renamed from Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCUtils.cpp.
2470         (WebCore::LibWebRTCProvider::callOnWebRTCNetworkThread):
2471         (WebCore::LibWebRTCProvider::callOnWebRTCSignalingThread):
2472         (WebCore::LibWebRTCProvider::factory):
2473         (WebCore::LibWebRTCProvider::setPeerConnectionFactory):
2474         (WebCore::createActualPeerConnection):
2475         (WebCore::LibWebRTCProvider::createPeerConnection):
2476         * platform/mediastream/libwebrtc/LibWebRTCProvider.h:
2477         * platform/mediastream/libwebrtc/LibWebRTCUtils.h: Removed.
2478         * platform/mediastream/mac/RealtimeOutgoingAudioSource.cpp:
2479         (WebCore::RealtimeOutgoingAudioSource::audioSamplesAvailable):
2480         * testing/Internals.cpp:
2481         * testing/MockLibWebRTCPeerConnection.cpp:
2482         (WebCore::useMockRTCPeerConnectionFactory):
2483         (WebCore::MockLibWebRTCPeerConnectionForIceCandidates::gotLocalDescription):
2484         (WebCore::releaseInNetworkThread):
2485         (WebCore::MockLibWebRTCPeerConnection::SetLocalDescription):
2486         (WebCore::MockLibWebRTCPeerConnection::SetRemoteDescription):
2487         (WebCore::MockLibWebRTCPeerConnection::CreateOffer):
2488         (WebCore::MockLibWebRTCPeerConnection::CreateAnswer):
2489
2490 2017-02-13  Anders Carlsson  <andersca@apple.com>
2491
2492         Simplify DragController::startDrag
2493         https://bugs.webkit.org/show_bug.cgi?id=168240
2494
2495         Reviewed by Tim Horton.
2496
2497         Use early returns instead of assigning to a variable that's returned at the end of the function.
2498
2499         * page/DragController.cpp:
2500         (WebCore::DragController::startDrag):
2501
2502 2017-02-13  Said Abou-Hallawa  <sabouhallawa@apple.com>
2503
2504         The current frame of an image should not deleted if another frame is asynchronously being decoded
2505         https://bugs.webkit.org/show_bug.cgi?id=167618
2506
2507         Reviewed by Simon Fraser.
2508
2509         Test: fast/images/animated-image-draw-while-decode.html
2510
2511         If the memory cache asks the BitmapImage to destroy all its frames while
2512         the next frame is being decoded, a thread contention may happen. This can
2513         happen when BitmapImage::draw() is called and the next frame is not ready
2514         yet for drawing, so the current frame has to be drawn. This will invoke
2515         a frame decoding in the same image from the drawing committing thread.
2516
2517         We can avoid that by destroying all the frames except the current frame if
2518         the image is asynchronously decoding its frames. This should not add extra
2519         memory overhead because building the image frame cache and then destroying
2520         it, when needed, is an on-going process. The frames will be allocated and
2521         decoded all the time and all of them can be destroyed except the current one.
2522         
2523         * platform/graphics/BitmapImage.cpp:
2524         (WebCore::BitmapImage::destroyDecodedData):
2525         (WebCore::BitmapImage::destroyDecodedDataIfNecessary):
2526         The logic of destroying the ImageFrames was split among BitmapImage, ImageSource
2527         and ImageFrameCache. Move all the logic to BitmapImage and have ImageFrameCache
2528         be responsible only for destroying a range of ImageFrames.
2529
2530         (WebCore::BitmapImage::draw): add an ASSERT_IMPLIES to ensure the current frame
2531         is ready to be rendered if the next frame is being decoded.
2532         
2533         * platform/graphics/BitmapImage.h: Move a const from ImageFrameCache.h to BitmapImage.h.
2534
2535         * platform/graphics/ImageFrameCache.cpp:
2536         (WebCore::ImageFrameCache::destroyDecodedData):
2537         (WebCore::ImageFrameCache::destroyDecodedDataIfNecessary): Deleted.
2538         * platform/graphics/ImageFrameCache.h:
2539         (WebCore::ImageFrameCache::destroyAllDecodedData):
2540         (WebCore::ImageFrameCache::destroyAllDecodedDataExcludeFrame):
2541         (WebCore::ImageFrameCache::destroyDecodedDataBeforeFrame):
2542         Make ImageFrameCache be responsible for destroying a range of ImageFrames.
2543         This range might include all the frames, all the frames but up to a specific
2544         frame, or all the frames but exclude one frame in the middle.
2545         
2546         * platform/graphics/ImageSource.cpp:
2547         (WebCore::ImageSource::clear): No need to call clearFrameBufferCache() from clear().
2548         The decision to call clearFrameBufferCache() or clear() is moved to
2549         BitmapImage::destroyDecodedData().
2550          
2551         (WebCore::ImageSource::destroyDecodedData): Deleted.
2552         (WebCore::ImageSource::destroyDecodedDataIfNecessary): Deleted.
2553         These functions are replaced by another set of functions in ImageSource.h.
2554         
2555         * platform/graphics/ImageSource.h:
2556         (WebCore::ImageSource::destroyAllDecodedData):
2557         (WebCore::ImageSource::destroyAllDecodedDataExcludeFrame):
2558         (WebCore::ImageSource::destroyDecodedDataBeforeFrame):
2559         (WebCore::ImageSource::hasDecodingQueue):
2560         These are new wrappers which call the corresponding ImageFrameCache functions.
2561
2562 2017-02-13  Myles C. Maxfield  <mmaxfield@apple.com>
2563
2564         [Cocoa] Stop soft-linking CTRunGetBaseAdvancesAndOrigins()
2565         https://bugs.webkit.org/show_bug.cgi?id=168256
2566
2567         Reviewed by Alex Christensen.
2568
2569         Use of this function is already behind a platform guard.
2570
2571         No new tests because there is no behavior change.
2572
2573         * platform/graphics/mac/ComplexTextControllerCoreText.mm:
2574         (SOFT_LINK): Deleted.
2575
2576 2017-02-13  Jiewen Tan  <jiewen_tan@apple.com>
2577
2578         [WebCrypto] WebInspector should indicate webkitSubtle is deprecated
2579         https://bugs.webkit.org/show_bug.cgi?id=165913
2580         <rdar://problem/30477222>
2581
2582         Reviewed by Joseph Pecoraro.
2583
2584         Covered by existing tests.
2585
2586         * page/Crypto.cpp:
2587         (WebCore::Crypto::webkitSubtle):
2588
2589 2017-02-13  Simon Fraser  <simon.fraser@apple.com>
2590
2591         Call WKDestroyRenderingResources() on iOS when tabs are backgrounded
2592         https://bugs.webkit.org/show_bug.cgi?id=168261
2593         rdar://problem/30481079
2594
2595         Reviewed by Tim Horton.
2596
2597         Add CABackingStoreCollectBlocking() to QuartzCoreSPI.h, and fix files in WebCore
2598         that do a framework include.
2599
2600         * platform/graphics/cocoa/TextTrackRepresentationCocoa.mm:
2601         * platform/graphics/cocoa/WebActionDisablingCALayerDelegate.h:
2602         * platform/spi/cocoa/QuartzCoreSPI.h:
2603         * platform/spi/mac/NSViewSPI.h:
2604
2605 2017-02-13  Youenn Fablet  <youenn@apple.com>
2606
2607         ASSERTION FAILED: !m_bodyLoader
2608         https://bugs.webkit.org/show_bug.cgi?id=166986
2609
2610         Reviewed by Sam Weinig.
2611
2612         Refactoring to make the unset/set pending activity part of body loader.
2613         This allows ensuring to not forget to do that by simply deleting the body loader.
2614
2615         * Modules/fetch/FetchResponse.cpp:
2616         (WebCore::FetchResponse::fetch):
2617         (WebCore::FetchResponse::BodyLoader::didSucceed):
2618         (WebCore::FetchResponse::BodyLoader::didFail):
2619         (WebCore::FetchResponse::BodyLoader::BodyLoader):
2620         (WebCore::FetchResponse::BodyLoader::~BodyLoader):
2621         (WebCore::FetchResponse::stop):
2622         * Modules/fetch/FetchResponse.h:
2623
2624 2017-02-13  Aakash Jain  <aakash_jain@apple.com>
2625
2626         Remove unused WebCoreThreadSafe.h
2627         https://bugs.webkit.org/show_bug.cgi?id=168236
2628
2629         Reviewed by Dan Bernstein.
2630
2631         * platform/ios/wak/WebCoreThreadSafe.h: Removed.
2632         * WebCore.xcodeproj/project.pbxproj: Removed WebCoreThreadSafe.h
2633         * platform/ios/wak/WebCoreThread.mm: Removed WebCoreThreadSafe.h and included WAKWindow.h directly
2634
2635 2017-02-13  Anders Carlsson  <andersca@apple.com>
2636
2637         Fix iOS build.
2638
2639         * platform/ios/DragImageIOS.mm:
2640         (WebCore::deleteDragImage):
2641
2642 2017-02-13  Sam Weinig  <sam@webkit.org>
2643
2644         Rename MediaQueryExp.h/cpp to MediaQueryExpression.h/cpp
2645         https://bugs.webkit.org/show_bug.cgi?id=168249
2646
2647         Reviewed by Dean Jackson.
2648
2649         Fix a FIXME and rename MediaQueryExp.h/cpp to match the class it contains, MediaQueryExpression.
2650
2651         * CMakeLists.txt:
2652         * WebCore.xcodeproj/project.pbxproj:
2653         * css/CSSAllInOne.cpp:
2654         * css/MediaQuery.h:
2655         * css/MediaQueryEvaluator.h:
2656         * css/MediaQueryExp.cpp: Removed.
2657         * css/MediaQueryExp.h: Removed.
2658         * css/MediaQueryExpression.cpp: Copied from Source/WebCore/css/MediaQueryExp.cpp.
2659         * css/MediaQueryExpression.h: Copied from Source/WebCore/css/MediaQueryExp.h.
2660         * css/parser/MediaQueryParser.h:
2661
2662 2017-02-13  Aakash Jain  <aakash_jain@apple.com>
2663
2664         WAKResponder should be exported from WebCore
2665         https://bugs.webkit.org/show_bug.cgi?id=168245
2666
2667         Reviewed by Dan Bernstein.
2668
2669         * platform/ios/wak/WAKResponder.h:
2670
2671 2017-02-13  Simon Fraser  <simon.fraser@apple.com>
2672
2673         Log to the History Channel in a few more places
2674         https://bugs.webkit.org/show_bug.cgi?id=168252
2675
2676         Reviewed by Brady Eidson.
2677
2678         *** Aliens ***
2679
2680         * loader/HistoryController.cpp:
2681         (WebCore::HistoryController::restoreScrollPositionAndViewState):
2682         (WebCore::HistoryController::updateForReload):
2683         * loader/NavigationScheduler.cpp:
2684         (WebCore::NavigationScheduler::scheduleHistoryNavigation):
2685         (WebCore::NavigationScheduler::timerFired):
2686         (WebCore::NavigationScheduler::cancel):
2687         * page/History.cpp:
2688         (WebCore::History::go):
2689
2690 2017-02-13  Alex Christensen  <achristensen@webkit.org>
2691
2692         Percent should be allowed in non-special URL hosts
2693         https://bugs.webkit.org/show_bug.cgi?id=168255
2694
2695         Reviewed by Tim Horton.
2696
2697         In the last few weeks, the spec has consolidated its sets of code points.
2698         Now forbidden host code points replace the old invalid host code points with
2699         the modification that percents are allowed in non-special hosts because we
2700         percent-encode non-ascii code points in non-special hosts.
2701         See https://url.spec.whatwg.org/#concept-opaque-host-parser
2702
2703         Covered by newly passing web platform tests.
2704
2705         * platform/URLParser.cpp:
2706         (WebCore::isC0Control):
2707         (WebCore::isInUserInfoEncodeSet):
2708         (WebCore::URLParser::hasForbiddenHostCodePoint):
2709         (WebCore::URLParser::parseHostAndPort):
2710         (WebCore::isInvalidDomainCharacter): Deleted.
2711         (WebCore::URLParser::hasInvalidDomainCharacter): Deleted.
2712         * platform/URLParser.h:
2713
2714 2017-02-13  Anders Carlsson  <andersca@apple.com>
2715
2716         Fix Windows build.
2717
2718         * platform/win/PasteboardWin.cpp:
2719         (WebCore::Pasteboard::setDragImage):
2720
2721 2017-02-13  Alex Christensen  <achristensen@webkit.org>
2722
2723         Fix Yosemite build after r211765
2724         https://bugs.webkit.org/show_bug.cgi?id=168246
2725         <rdar://problem/30494174>
2726
2727         Reviewed by Brady Eidson.
2728
2729         * platform/graphics/mac/ComplexTextControllerCoreText.mm:
2730         (SOFT_LINK):
2731
2732 2017-02-13  Anders Carlsson  <andersca@apple.com>
2733
2734         Add a DragImage class that wraps a DragImageRef
2735         https://bugs.webkit.org/show_bug.cgi?id=168131
2736
2737         Reviewed by Beth Dakin.
2738
2739         This allows us to get rid of the explicit deleteDragImage calls and will make additional cleanup of the
2740         various drag code paths possible. No functionality change.
2741
2742         * dom/DataTransfer.cpp:
2743         (WebCore::DataTransfer::updateDragImage):
2744         * page/DragController.cpp:
2745         (WebCore::DragController::startDrag):
2746         (WebCore::DragController::doImageDrag):
2747         (WebCore::DragController::doSystemDrag):
2748         * page/DragController.h:
2749         * platform/DragImage.cpp:
2750         (WebCore::DragImage::DragImage):
2751         (WebCore::DragImage::operator=):
2752         (WebCore::DragImage::~DragImage):
2753         * platform/DragImage.h:
2754         * platform/Pasteboard.h:
2755         * platform/StaticPasteboard.h:
2756         * platform/mac/PasteboardMac.mm:
2757         (WebCore::Pasteboard::setDragImage):
2758
2759 2017-02-13  Chris Dumez  <cdumez@apple.com>
2760
2761         Regression(r211455): ASSERTION FAILED: frameView || pageCacheState() == InPageCache in com.apple.WebCore: WebCore::Document::destroyRenderTree
2762         https://bugs.webkit.org/show_bug.cgi?id=168237
2763         <rdar://problem/30494165>
2764
2765         Reviewed by Gavin Barraclough.
2766
2767         Drop bad assertion under document::destroyRenderTree() that was introduced in r211455.
2768         The assertion seemed like a good idea but the issue is that CachedFrame::destroy()
2769         reset's the document's pageCacheState before calling Document::prepareForDestruction().
2770
2771         No new tests, this fixes assertion hits on our bots.
2772
2773         * dom/Document.cpp:
2774         (WebCore::Document::destroyRenderTree):
2775
2776 2017-02-13  Myles C. Maxfield  <mmaxfield@apple.com>
2777
2778         Update custom line breaking iterators to the latest version of Unicode
2779         https://bugs.webkit.org/show_bug.cgi?id=168182
2780
2781         Reviewed by Zalan Bujtas.
2782
2783         Clean up our breaking code to be more descriptive about the difference between
2784         line-break: auto vs line-break: loose | normal | strict. The only difference is
2785         that we have some hardcoded tables to speed up character iteration for
2786         line-break: auto.
2787
2788         Tests: TestWebKitAPI WebKit2.LineBreaking
2789
2790         * rendering/BreakLines.h:
2791         (WebCore::nextBreakablePosition):
2792         (WebCore::nextBreakablePositionIgnoringNBSP):
2793         (WebCore::nextBreakablePositionWithoutShortcut):
2794         (WebCore::nextBreakablePositionIgnoringNBSPWithoutShortcut):
2795         (WebCore::isBreakable):
2796         (WebCore::nextBreakablePositionNonLoosely): Deleted.
2797         (WebCore::nextBreakablePositionLoosely): Deleted.
2798         (WebCore::nextBreakablePositionLoose): Deleted.
2799         (WebCore::nextBreakablePositionIgnoringNBSPLoose): Deleted.
2800         * rendering/RenderText.cpp:
2801         (WebCore::RenderText::computePreferredLogicalWidths):
2802         * rendering/SimpleLineLayoutTextFragmentIterator.cpp:
2803         (WebCore::SimpleLineLayout::nextBreakablePositionInSegment):
2804         * rendering/line/BreakingContext.h:
2805         (WebCore::BreakingContext::handleText):
2806         (WebCore::BreakingContext::optimalLineBreakLocationForTrailingWord):
2807
2808 2017-02-13  Youenn Fablet  <youenn@apple.com>
2809
2810         Remove @getUserMedia identifier
2811         https://bugs.webkit.org/show_bug.cgi?id=168216
2812
2813         Reviewed by Sam Weinig.
2814
2815         No change of behavior.
2816
2817         * Modules/mediastream/MediaDevices.idl:
2818         * bindings/js/WebCoreBuiltinNames.h:
2819
2820 2017-02-13  Carlos Garcia Campos  <cgarcia@igalia.com>
2821
2822         [GTK] Non-accelerated drawing is broken with HiDPI
2823         https://bugs.webkit.org/show_bug.cgi?id=168128
2824
2825         Reviewed by Michael Catanzaro.
2826
2827         When device scale factor changes, the page notifies the page overlay controller about it. Then overlay root
2828         layers are created to be notified about the device scale factor. That causes us to enter in accelerated
2829         compositing mode, because the graphics layer factory is called. But the render layer compositor doesn't really
2830         enter in accelerated mode, because there aren't page overlays, the accelerated mode is not forced and the website
2831         doesn't require acceleration either. This leaves our drawing area in an inconsistent state, it thinks it's in AC
2832         mode because it has a layer tree host, but without a root layer attached, so nothing is rendered. The page
2833         overlay controller doesn't need to create the layers when device scale factor changes, when an overlay is
2834         installed, layers will be created with the current device scale factor anyway.
2835
2836         * page/PageOverlayController.cpp:
2837         (WebCore::PageOverlayController::didChangeDeviceScaleFactor): Return early if not initialized yet.
2838
2839 2017-02-13  Csaba Osztrogonác  <ossy@webkit.org>
2840
2841         REGRESSION(r210845) Build broken with ENABLE_MHTML disabled
2842         https://bugs.webkit.org/show_bug.cgi?id=167771
2843
2844         Reviewed by Daniel Bates.
2845
2846         * loader/DocumentLoader.cpp:
2847         (WebCore::DocumentLoader::commitData):
2848
2849 2017-02-12  Dan Bernstein  <mitz@apple.com>
2850
2851         Tried to fix USE(APPLE_INTERNAL_SDK) builds after r212211.
2852
2853         * platform/spi/mac/TUCallSPI.h: Reverted to r212210.
2854
2855 2017-02-12  Dan Bernstein  <mitz@apple.com>
2856
2857         Tried to fix USE(APPLE_INTERNAL_SDK) builds after r212211.
2858
2859         * platform/spi/mac/TUCallSPI.h:
2860
2861 2017-02-12  Dan Bernstein  <mitz@apple.com>
2862
2863         Tried to fix USE(APPLE_INTERNAL_SDK) builds after r212211.
2864
2865         * platform/spi/mac/TUCallSPI.h:
2866
2867 2017-02-12  Dan Bernstein  <mitz@apple.com>
2868
2869         Tried to fix USE(APPLE_INTERNAL_SDK) builds after r212211.
2870
2871         * platform/spi/mac/NSMenuSPI.h: Replaced declaration of deprecated method with its current
2872           equivalent.
2873
2874 2017-02-12  Dan Bernstein  <mitz@apple.com>
2875
2876         Tried to fix USE(APPLE_INTERNAL_SDK) builds after r212211.
2877
2878         * platform/spi/mac/NSImmediateActionGestureRecognizerSPI.h:
2879
2880 2017-02-12  Ryosuke Niwa  <rniwa@webkit.org>
2881
2882         parserRemoveChild should unload subframes
2883         https://bugs.webkit.org/show_bug.cgi?id=168151
2884
2885         Reviewed by Darin Adler.
2886
2887         Fix the bug that the adoption agency algorithm does not unload subframes as it disconnects nodes.
2888
2889         Also moved calls to nodeWillBeRemoved inside NoEventDispatchAssertion to expand on r211965.
2890
2891         Tests: fast/parser/adoption-agency-clear-focus-range.html
2892                fast/parser/adoption-agency-unload-iframe-1.html
2893                fast/parser/adoption-agency-unload-iframe-2.html
2894
2895         * dom/ContainerNode.cpp:
2896         (WebCore::ContainerNode::takeAllChildrenFrom): Rewritten using idioms used in removeChildren and parserAppendChild.
2897
2898         Disconnect all subframes first since this can synchronously dispatch an unload event. Then update DOM ranges,
2899         the focused element, and other states in the document.
2900
2901         Second, use the regular removeBetween, notifyChildNodeRemoved, childrenChanged sequence of calls to disconnect nodes
2902         instead of a single call to removeDetachedChildren to properly disconnect child nodes since those nodes may have
2903         already come live due to execution of synchronous scripts prior to the adoption agency algorithm has run, or in
2904         response to the unload event we just dispatched.
2905
2906         Third, append these nodes using parserAppendChild to avoid dispatching mutation events.
2907
2908         (WebCore::willRemoveChild): Removed the call to nodeWillBeRemoved. It's now called within NoEventDispatchAssertion
2909         in each call site of willRemoveChild and willRemoveChildren.
2910         (WebCore::willRemoveChildren): Ditto.
2911         (WebCore::ContainerNode::removeChild): Call nodeWillBeRemoved inside NoEventDispatchAssertion.
2912         (WebCore::ContainerNode::replaceAllChildren): Call nodeWillBeRemoved inside NoEventDispatchAssertion.
2913         (WebCore::ContainerNode::parserRemoveChild): Disconnect subframes and update document's states.
2914
2915         * html/parser/HTMLConstructionSite.cpp:
2916         (WebCore::executeTakeAllChildrenAndReparentTask): Add a release assert that new parent does not already have a parent. 
2917
2918 2017-02-12  Ryosuke Niwa  <rniwa@webkit.org>
2919
2920         REGRESSION (r179497): Crash inside setAttributeNode
2921         https://bugs.webkit.org/show_bug.cgi?id=168161
2922         <rdar://problem/30451581>
2923
2924         Reviewed by Andreas Kling.
2925
2926         The bug was caused by setAttributeNode calling setAttributeInternal with the same element data as the one used
2927         to call removeAttributeInternal despite of the fact removeAttributeInternal could have invoked arbitrary scripts
2928         and mutated element's m_elementData.
2929
2930         Fixed the bug by calling with setAttributeInternal with the result of new invocation of ensureUniqueElementData().
2931
2932         Test: fast/dom/Attr/make-unique-element-data-while-replacing-attr.html
2933
2934         * dom/Element.cpp:
2935         (WebCore::Element::setAttributeNode):
2936
2937 2017-02-12  Ryosuke Niwa  <rniwa@webkit.org>
2938
2939         Rebaseline bindings tests after r212207.
2940
2941         * bindings/scripts/test/JS/JSTestObj.cpp:
2942         * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.cpp:
2943
2944 2017-02-12  Dan Bernstein  <mitz@apple.com>
2945
2946         [Cocoa] Some -respondsToSelector: checks are unnecessary
2947         https://bugs.webkit.org/show_bug.cgi?id=168183
2948
2949         Reviewed by Tim Horton.
2950
2951         * English.lproj/Localizable.strings: Removed a string that’s no longer needed after the
2952           change to WebKit2/Platform/mac/MenuUtilities.mm.
2953
2954         * editing/mac/DictionaryLookup.mm:
2955         (WebCore::showPopupOrCreateAnimationController): Removed check whether
2956           LULookupDefinitionModule responds to +showDefinitionForTerm:relativeToRect:ofView:options:.
2957
2958         * platform/cocoa/NetworkExtensionContentFilter.mm:
2959         (WebCore::NetworkExtensionContentFilter::initialize): Changed to use
2960           -[NEFilterSource setSourceAppIdentifier:], without checking, instead of
2961           -setSourceAppBundleID:, which does not exist.
2962
2963         * platform/cocoa/ScrollController.mm:
2964         (systemUptime): Deleted.
2965         (WebCore::ScrollController::snapRubberBand): Use -[NSProcessInfo systemUptime] directly.
2966
2967         * platform/graphics/avfoundation/objc/MediaPlaybackTargetPickerMac.mm:
2968         (WebCore::MediaPlaybackTargetPickerMac::showPlaybackTargetPicker): Remove unnecessary check.
2969
2970         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
2971         (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayerLayer): Ditto.
2972         (WebCore::MediaPlayerPrivateAVFoundationObjC::setVideoFullscreenMode): Ditto.
2973         (WebCore::MediaPlayerPrivateAVFoundationObjC::didPassCORSAccessCheck): Replaced
2974           -respondsToSelector: check with -isKindOfClass: check corresponding to the above cast.
2975         (WebCore::MediaPlayerPrivateAVFoundationObjC::setShouldDisableSleep): Removed unnecessary
2976           check.
2977
2978         * platform/graphics/avfoundation/objc/VideoFullscreenLayerManager.mm:
2979         (WebCore::VideoFullscreenLayerManager::setVideoFullscreenLayer): Removed unnecessary checks.
2980
2981         * platform/graphics/mac/WebGLLayer.mm:
2982         (-[WebGLLayer initWithGraphicsContext3D:]): Ditto.
2983
2984         * platform/mac/PlatformEventFactoryMac.mm:
2985         (WebCore::typeForEvent): Removed check whether NSMenu responds to +menuTypeForEvent: and
2986           all code to handle that case that it doesn’t.
2987
2988         * platform/mac/WebVideoFullscreenController.mm:
2989         (-[WebVideoFullscreenController applicationDidResignActive:]): Removed check whether
2990           NSWindow responds to -isOnActiveSpace.
2991         (-[WebVideoFullscreenController updateMenuAndDockForFullscreen]): Removed check whether
2992           NSApplication responds to -setPresentationOptions:
2993
2994         * platform/mac/WebVideoFullscreenInterfaceMac.mm:
2995         (-[WebVideoFullscreenInterfaceMacObjC updateIsPlaying:newPlaybackRate:]): Removed
2996           unnecessary -respondsToSelector: check.
2997         (-[WebVideoFullscreenInterfaceMacObjC setVideoDimensions:]): Ditto.
2998         (-[WebVideoFullscreenInterfaceMacObjC setUpPIPForVideoView:withFrame:inWindow:]): Ditto.
2999
3000         * platform/spi/cf/CFNetworkSPI.h: Moved declarations of
3001           -[NSURLCache _initWithMemoryCapacity:diskCapacity:relativePath:] and
3002           -[NSURLCache _CFURLCache] to the !USE(APPLE_INTERNAL_SDK) section.
3003
3004         * platform/spi/cocoa/NEFilterSourceSPI.h: Added declaration of NEFilterSource’
3005           sourceAppIdentifier property to the !USE(APPLE_INTERNAL_SDK) section and deleted
3006           unconditional declaration of sourceAppBundleID property, which doesn’t exist.
3007
3008         * platform/spi/cocoa/QuartzCoreSPI.h: Removed redundant declarations.
3009
3010         * platform/spi/ios/DataDetectorsUISPI.h: Moved declarations of DDDetectionController methods
3011           from WebKit2/UIProcess/ios/{WKActionSheetAssistant,WKContentViewInteraction}.mm to here.
3012           Removed an unused declaration.
3013
3014         * platform/spi/mac/LookupSPI.h: Moved redundant declarations into the
3015           !USE(APPLE_INTERNAL_SDK) section.
3016
3017         * platform/spi/mac/NSMenuSPI.h: Changed to import NSMenu_Private.h when using the
3018           Apple internal SDK. Cleaned up the declarations for the other case.
3019
3020         * platform/spi/mac/TUCallSPI.h: Changed to import TUCall_Strings.h when use the Apple
3021           internal SDK.
3022
3023 2017-02-11  Sam Weinig  <sam@webkit.org>
3024
3025         Remove the remaining functions out of JSDOMBinding
3026         https://bugs.webkit.org/show_bug.cgi?id=168179
3027
3028         Reviewed by Darin Adler.
3029
3030         Move utility functions into more appropriate locations.
3031         - Move hasIteratorMethod to runtime/IteratorOperations.h
3032         - Move nonCachingStaticFunctionGetter to runtime/Lookup.h
3033         - Move addImpureProperty to CommonVM
3034
3035         Remove toJS overload that took a Vector<T>. Replace it's usage
3036         with toJS<IDLSequence<T>> usage. To make this work, added two
3037         new types, IDLIDBKeyData and IDLIDBValue.
3038
3039         * Modules/indexeddb/IDBCursor.cpp:
3040         (WebCore::IDBCursor::setGetResult):
3041         * Modules/indexeddb/IDBRequest.cpp:
3042         (WebCore::IDBRequest::setResult):
3043         (WebCore::IDBRequest::setResultToStructuredClone):
3044         Adopt JSDOMConvert infrastructure for conversions using new types.
3045
3046         * bindings/IDLTypes.h:
3047         * bindings/js/JSDOMConvertIndexedDB.h:
3048         (WebCore::JSConverter<IDLIDBKeyData>::convert):
3049         (WebCore::JSConverter<IDLIDBValue>::convert):
3050         Add new types for IDBKeyData and IDBValue.
3051
3052         * bindings/js/CommonVM.cpp:
3053         (WebCore::addImpureProperty):
3054         * bindings/js/CommonVM.h:
3055         Move addImpureProperty here from JSDOMBinding.
3056
3057         * bindings/js/IDBBindingUtilities.cpp:
3058         (WebCore::idbKeyDataToScriptValue): Deleted.
3059         * bindings/js/IDBBindingUtilities.h:
3060         Remove unused idbKeyDataToScriptValue, and group like functions
3061         together.
3062
3063         * bindings/js/JSDOMBinding.cpp: Removed.
3064         * bindings/js/JSDOMBinding.h:
3065         (WebCore::nonCachingStaticFunctionGetter): Deleted.
3066         (WebCore::toJS): Deleted.
3067         Move/remove functions.
3068
3069         * bindings/js/JSDOMConvertUnion.h:
3070         Update for move of hasIteratorMethod to runtime/IteratorOperations.h
3071
3072         * bindings/js/JSDOMWindowCustom.cpp:
3073         * bindings/js/JSHTMLDocumentCustom.cpp:
3074         * bindings/js/JSLocationCustom.cpp:
3075         Update for move of nonCachingStaticFunctionGetter to runtime/Lookup.h
3076
3077         * bindings/js/JSSubtleCryptoCustom.cpp:
3078         Remove unneeded include of runtime/IteratorOperations.h
3079
3080         * bindings/scripts/CodeGeneratorJS.pm:
3081         (GenerateOverloadedFunctionOrConstructor):
3082         Include runtime/IteratorOperations when needing to distinguish a sequence.
3083
3084         * html/HTMLDocument.cpp:
3085         Replace include of JSDOMBinding.h with CommonVM.h for addImpureProperty.
3086
3087 2017-02-12  Carlos Garcia Campos  <cgarcia@igalia.com>
3088
3089         [GTK] Handle caps lock indicator in event modifiers
3090         https://bugs.webkit.org/show_bug.cgi?id=168186
3091
3092         Reviewed by Michael Catanzaro.
3093
3094         Add helper function to check if caps lock is present in the given modifiers. We need this because in GDK
3095         GDK_LOCK_MASK might be either CapsLock or ShiftLock in X11. We use this new method in all platform event
3096         implementations to add the appropriate modifiers.
3097
3098         Fixes: fast/events/special-key-events-in-input-text.html
3099
3100         * platform/PlatformKeyboardEvent.h:
3101         * platform/gtk/PlatformKeyboardEventGtk.cpp:
3102         (WebCore::modifiersForGdkKeyEvent):
3103         (WebCore::PlatformKeyboardEvent::modifiersContainCapsLock):
3104         * platform/gtk/PlatformMouseEventGtk.cpp:
3105         (WebCore::PlatformMouseEvent::PlatformMouseEvent):
3106         * platform/gtk/PlatformWheelEventGtk.cpp:
3107         (WebCore::PlatformWheelEvent::PlatformWheelEvent):
3108
3109 2017-02-11  Sam Weinig  <sam@webkit.org>
3110
3111         Remove custom bindings for XSLTProcessor.idl
3112         https://bugs.webkit.org/show_bug.cgi?id=168174
3113
3114         Reviewed by Andreas Kling.
3115
3116         * CMakeLists.txt:
3117         * WebCore.xcodeproj/project.pbxproj:
3118         * bindings/js/JSBindingsAllInOne.cpp:
3119         * bindings/js/JSXSLTProcessorCustom.cpp: Removed.
3120         Remove file.
3121  
3122         * bindings/js/JSDOMBinding.cpp:
3123         (WebCore::jsStringOrUndefined): Deleted.
3124         * bindings/js/JSDOMBinding.h:
3125         Remove now unused jsStringOrUndefined.
3126
3127         * xml/XSLTProcessor.cpp:
3128         (WebCore::XSLTProcessor::setParameter):
3129         (WebCore::XSLTProcessor::getParameter):
3130         (WebCore::XSLTProcessor::removeParameter):
3131         * xml/XSLTProcessor.idl:
3132         Replace custom bindings bindings with early returns. One subtle difference
3133         between the custom bindings and this, is that getParameter will return 
3134         jsNull() rather than jsUndefined() for null String returns. This matches
3135         all other bindings.
3136
3137 2017-02-11  Olivier Blin  <olivier.blin@softathome.com>
3138
3139         [GStreamer][MSE][EME] Fix decryptor assignment
3140         https://bugs.webkit.org/show_bug.cgi?id=168122
3141
3142         Reviewed by Michael Catanzaro.
3143
3144         The new decryptor is a floating reference so we should not use the
3145         adopt GRefPtr constructor, but use the regular assignment operator
3146         that will sink the object (clear the floating flag).
3147
3148         This fixes assertions in debug build.
3149
3150         See previous pipeline fix in r210851 and WPE commit
3151         06020b18831e1c0eead34e2c1a5a4b7d026c227d.
3152
3153         * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
3154         (WebCore::AppendPipeline::parseDemuxerSrcPadCaps):
3155         Do not use adoptGRef(), it prevented the object from being sunk.
3156
3157 2017-02-11  Simon Fraser  <simon.fraser@apple.com>
3158
3159         Avoid a redundant scroll to 0,0 when navigating back to a url with no fragment
3160         https://bugs.webkit.org/show_bug.cgi?id=168177
3161
3162         Reviewed by Sam Weinig.
3163
3164         FrameView::scrollToFragment() is called from FrameLoader::scrollToFragmentWithParentBoundary()
3165         when navigating within the page. If the URL had no fragment identifier, this code would
3166         call into FrameView::scrollToAnchor() with an empty name, where maintainScrollPositionAtAnchor()
3167         used the document as the anchor, thus scrolling to 0,0. Later, history().restoreScrollPositionAndViewState()
3168         the restores the scroll position from history.
3169         
3170         This scroll to 0,0 happened to be not visible to the page because of scroll event
3171         coalescing, but it makes implementation of history.scrollRestoration harder, so avoid it
3172         by just returning early from FrameView::scrollToFragment() if there is no fragment,
3173         making sure to clear the document's CSSTarget.
3174
3175         * dom/Document.cpp:
3176         (WebCore::Document::setCSSTarget):
3177         * page/FrameView.cpp:
3178         (WebCore::FrameView::scrollToFragment):
3179         (WebCore::FrameView::scrollToAnchor):
3180
3181 2017-02-11  Chris Dumez  <cdumez@apple.com>
3182
3183         Implement URL's toJSON()
3184         https://bugs.webkit.org/show_bug.cgi?id=167979
3185
3186         Reviewed by Sam Weinig.
3187
3188         Implement URL's toJSON() as per:
3189         - https://url.spec.whatwg.org/#dom-url-tojson
3190
3191         This is already supported by Firefox.
3192
3193         Also, drop URLUtils.idl as it is no longer in the specification.
3194         Merge its content to DOMURL.idl as per the URL specification.
3195
3196         Finally, mark href attribute as stringifier and drop the toString()
3197         operation to match the specification. This fixes a bug where our
3198         toString property was not enumerable but should have been.
3199
3200         Tests: fast/url/url-tojson.html
3201                imported/w3c/web-platform-tests/url/url-tojson.html
3202
3203         * CMakeLists.txt:
3204         * DerivedSources.make:
3205         * WebCore.xcodeproj/project.pbxproj:
3206         * html/DOMURL.idl:
3207         * html/URLUtils.h:
3208         (WebCore::URLUtils<T>::toJSON):
3209         * html/URLUtils.idl: Removed.
3210
3211 2017-02-11  Carlos Garcia Campos  <cgarcia@igalia.com>
3212
3213         [GTK][EFL] Implement MIMETypeRegistry::getPreferredExtensionForMIMEType
3214         https://bugs.webkit.org/show_bug.cgi?id=168163
3215
3216         Reviewed by Michael Catanzaro.
3217
3218         It's missing causing several HTML anchor download tests to fail because the suggested filename missed the
3219         extension. This patch moves MIMETypeRegistry::appendFileExtensionIfNecessary() from the cocoa specific file to the
3220         common file because it's not actually platform specific. MIMETypeRegistry::getPreferredExtensionForMIMEType() is
3221         what platforms should implement.
3222
3223         Fixes: fast/dom/HTMLAnchorElement/anchor-download-user-triggered-synthetic-click.html
3224                fast/dom/HTMLAnchorElement/anchor-download.html
3225                fast/dom/HTMLAnchorElement/anchor-file-blob-download-no-extension.html
3226                fast/dom/HTMLAnchorElement/anchor-nodownload-set.html
3227
3228         * platform/MIMETypeRegistry.cpp:
3229         (WebCore::MIMETypeRegistry::appendFileExtensionIfNecessary):
3230         * platform/cocoa/MIMETypeRegistryCocoa.mm:
3231         (WebCore::MIMETypeRegistry::appendFileExtensionIfNecessary): Deleted.
3232         * platform/efl/MIMETypeRegistryEfl.cpp:
3233         (WebCore::MIMETypeRegistry::getPreferredExtensionForMIMEType):
3234         * platform/gtk/MIMETypeRegistryGtk.cpp:
3235         (WebCore::MIMETypeRegistry::getPreferredExtensionForMIMEType):
3236
3237 2017-02-11  Carlos Garcia Campos  <cgarcia@igalia.com>
3238
3239         Unreviewed. Update imageTitle translatable string.
3240
3241         To match mac port. Fixes fast/images/imageDocument-title.html.
3242
3243         * platform/gtk/LocalizedStringsGtk.cpp:
3244         (WebCore::imageTitle):
3245
3246 2017-02-10  John Wilander  <wilander@apple.com>
3247
3248         Updates to Resource Load Statistics: Get the right website data store and introduce timeout for user interaction
3249         https://bugs.webkit.org/show_bug.cgi?id=167474
3250         <rdar://problem/24681808>
3251         <rdar://problem/24703286>
3252         <rdar://problem/30290270>
3253
3254         This patch does the following:
3255         1. Gets the right website data store. API::WebsiteDataStore::defaultDataStore()
3256             does not provide the right data store.
3257         2. Introduces timeout for user interaction. A domain needs interaction every 30
3258             days to stay in that category.
3259         3. Adds grandfathered to the statistics model in preparation for grandfathering of
3260             existing data records.
3261         4. Adds test infrastructure to allow testing of the various rules in place for
3262             data records removal.
3263         5. Fixes various smaller bugs that were found as part of setting up the tests.
3264         6. Regresses the data records removal counting. We need to come up with a thread
3265             safe way of gathering removal statistics from more than one data store now
3266             that we potentially interact with multiple stores.
3267         7. Adds a first set of layout tests for resource load statistics.
3268
3269         Reviewed by Andy Estes.
3270
3271         Tests: http/tests/loading/resourceLoadStatistics/non-prevalent-resource-with-user-interaction.html
3272                http/tests/loading/resourceLoadStatistics/non-prevalent-resource-without-user-interaction.html
3273                http/tests/loading/resourceLoadStatistics/prevalent-resource-with-user-interaction-timeout.html
3274                http/tests/loading/resourceLoadStatistics/prevalent-resource-with-user-interaction.html
3275                http/tests/loading/resourceLoadStatistics/prevalent-resource-without-user-interaction.html
3276
3277         * dom/Document.cpp:
3278         (WebCore::Document::updateLastHandledUserGestureTimestamp):
3279             This now calls ResourceLoadObserver::logUserInteraction() every time since
3280             we want to keep track of the most recent user interaction.
3281         * loader/ResourceLoadObserver.cpp:
3282         (WebCore::ResourceLoadObserver::statisticsStore):
3283             New getter used by WebResourceLoadStatisticsManager::resetToConsistentState().
3284         (WebCore::reduceTimeResolutionToOneDay):
3285             Convenience function.
3286         (WebCore::ResourceLoadObserver::logUserInteractionWithReducedTimeResolution):
3287             Reduces time resolution for privacy reasons.
3288         (WebCore::ResourceLoadObserver::logUserInteraction):
3289         (WebCore::ResourceLoadObserver::clearUserInteraction):
3290         (WebCore::ResourceLoadObserver::hasHadUserInteraction):
3291         (WebCore::ResourceLoadObserver::setPrevalentResource):
3292         (WebCore::ResourceLoadObserver::isPrevalentResource):
3293         (WebCore::ResourceLoadObserver::clearPrevalentResource):
3294         (WebCore::ResourceLoadObserver::setTimeToLiveUserInteraction):
3295         (WebCore::ResourceLoadObserver::fireDataModificationHandler):
3296             New functions that allow WebKitTestRunner to stage exact
3297             statistics, fire the handler, and test the outcome.
3298         * loader/ResourceLoadObserver.h:
3299         * loader/ResourceLoadStatistics.cpp:
3300         (WebCore::ResourceLoadStatistics::encode):
3301         (WebCore::ResourceLoadStatistics::decode):
3302         (WebCore::ResourceLoadStatistics::toString):
3303         (WebCore::ResourceLoadStatistics::merge):
3304             Support for statistics mostRecentUserInteraction, grandfathered, and
3305             dataRecordsRemoved.
3306         * loader/ResourceLoadStatistics.h:
3307         * loader/ResourceLoadStatisticsStore.cpp:
3308         (WebCore::ResourceLoadStatisticsStore::setTimeToLiveUserInteraction):
3309             New function that allows WebKitTestRunner to test 
3310             aging out of user interaction.
3311         (WebCore::ResourceLoadStatisticsStore::hasHadRecentUserInteraction):
3312             Now takes into account the timestamp and ages
3313             out user interaction.
3314         (WebCore::ResourceLoadStatisticsStore::prevalentResourceDomainsWithoutUserInteraction):
3315             Now makes use of ResourceLoadStatisticsStore::hasHadRecentUserInteraction().
3316         * loader/ResourceLoadStatisticsStore.h:
3317
3318 2017-02-10  Sam Weinig  <sam@webkit.org>
3319
3320         [WebIDL] Cleanup XMLHttpRequest's bindings
3321         https://bugs.webkit.org/show_bug.cgi?id=168067
3322
3323         Reviewed by Chris Dumez.
3324
3325         * bindings/js/JSDOMBinding.cpp:
3326         (WebCore::jsOwnedStringOrNull): Deleted.
3327         * bindings/js/JSDOMBinding.h:
3328         Remove jsOwnedStringOrNull and inline it into it's one use
3329         in JSXMLHttpRequestCustom.
3330
3331         * bindings/js/JSXMLHttpRequestCustom.cpp:
3332         (WebCore::JSXMLHttpRequest::responseText):
3333         (WebCore::SendFunctor::SendFunctor): Deleted.
3334         (WebCore::SendFunctor::line): Deleted.
3335         (WebCore::SendFunctor::column): Deleted.
3336         (WebCore::SendFunctor::url): Deleted.
3337         (WebCore::SendFunctor::operator()): Deleted.
3338         (WebCore::JSXMLHttpRequest::send): Deleted.
3339         * xml/XMLHttpRequest.cpp:
3340         (WebCore::XMLHttpRequest::send):
3341         * xml/XMLHttpRequest.h:
3342         Remove custom send, replacing it with a single send implementation that
3343         takes a variant.
3344
3345         * xml/XMLHttpRequest.idl:
3346         Cleanup the IDL to better match the spec. Update correct types where trivial.
3347
3348 2017-02-10  Chris Dumez  <cdumez@apple.com>
3349
3350         document.origin doesn't match spec
3351         https://bugs.webkit.org/show_bug.cgi?id=168022
3352
3353         Reviewed by Sam Weinig.
3354
3355         Update document.origin to return the origin in the expected format:
3356         - https://dom.spec.whatwg.org/#dom-document-origin
3357
3358         Change: "https_webkit.org_0 -> "https://webkit.org".
3359
3360         The new behavior matches Firefox and Chrome.
3361
3362         No new tests, updated existing tests.
3363
3364         * dom/Document.cpp:
3365         (WebCore::Document::origin):
3366
3367 2017-02-10  Daniel Bates  <dabates@apple.com>
3368
3369         Attempt to fix the build following <https://trac.webkit.org/changeset/212173>
3370         (https://bugs.webkit.org/show_bug.cgi?id=166774)
3371
3372         * dom/Document.cpp:
3373         (WebCore::Document::detachFromCachedFrame): Use ASSER_UNUSED() instead of ASSERT() since
3374         the parameter cachedFrame is unused in non-debug build.
3375
3376 2017-02-10  Daniel Bates  <dabates@apple.com>
3377
3378         Detach frame from document when entering page cache
3379         https://bugs.webkit.org/show_bug.cgi?id=166774
3380         <rdar://problem/29904368>
3381
3382         Reviewed by Chris Dumez.
3383
3384         When a page enters the page cache it is unnecessary for it to hold a reference to its
3385         associated frame because subsequent interactions with the page do not need to make use
3386         of it. Once a page exits the page cache we associate it with its frame.
3387
3388         * dom/Document.cpp:
3389         (WebCore::Document::frameDestroyed): Update comment to reflect the renaming of disconnectFromFrame().
3390         (WebCore::Document::attachToCachedFrame): Added.
3391         (WebCore::Document::detachFromCachedFrame): Added.
3392         (WebCore::Document::prepareForDestruction): Only call CSSAnimationController::detachFromDocument() if
3393         we have a frame. Substitute detachFromFrame() for disconnectFromFrame() as the latter was renamed to
3394         the former.
3395         (WebCore::Document::hasEverCalledWindowOpen): Deleted.
3396         (WebCore::Document::markHasCalledWindowOpen): Deleted.
3397         (WebCore::Document::disconnectFromFrame): Renamed to detachFromFrame.
3398         * dom/Document.h:
3399         (WebCore::Document::detachFromFrame): Renamed; formerly named disconnectFromFrame(). Changed
3400         visibility from public to private and made this function inline.
3401         * history/CachedFrame.cpp:
3402         (WebCore::CachedFrameBase::pruneDetachedChildFrames): Remove cached child frames that were
3403         removed from the page when it was in the page cache as there is no need to restore such frames.
3404         (WebCore::CachedFrameBase::restore): Call pruneDetachedChildFrames() before restoring the
3405         frame tree.
3406         (WebCore::CachedFrame::CachedFrame): Detach from the frame.
3407         (WebCore::CachedFrame::open): Assert that we have a document and re-attach the frame.
3408         (WebCore::CachedFrame::destroy): Update assertion as this function should only be called for a
3409         frameless document. Only detach the FrameView, DocumentLoader, and Page when the cached frame is for
3410         subframe and is associated with a Page object. Call CSSAnimationController::detachFromDocument() to
3411         detach the animation controller from the document as it is being destroyed. We have to do this here
3412         because the document does not have a frame. And Document::prepareForDestruction() only calls
3413         CSSAnimationController::detachFromDocument() if the document has a frame.
3414         * history/CachedFrame.h:
3415         * history/PageCache.cpp:
3416         (WebCore::canCachePage): Remove logic that prevents caching of a page that called window.open()
3417         or has an opener as it is feasible to keep such pages in the page cache.
3418         * html/HTMLFrameElementBase.cpp:
3419         (WebCore::HTMLFrameElementBase::finishedInsertingSubtree): Fix style nit.
3420         * loader/FrameLoader.cpp:
3421         (WebCore::FrameLoader::frameDetached): Only stop all loaders and stop active DOM objects if the
3422         page is not in- or about to enter- the page cache. A page in the page cache has finished loading
3423         and its active DOM objects are suspended. Also fix style nit in comment.
3424         (WebCore::FrameLoader::detachFromParent): Only stop all loaders if the page is not in- or about to
3425         enter- the page cache. A page in the page cache has finished loading. Also added a comment to explain
3426         that we protect the frame because stopAllLoaders() can cause the frame to be deallocated.
3427         * page/DOMWindow.cpp:
3428         (WebCore::DOMWindow::createWindow): Remove logic to call markHasCalledWindowOpen() as this
3429         function will be removed.
3430         * page/DiagnosticLoggingKeys.cpp:
3431         (WebCore::DiagnosticLoggingKeys::hasCalledWindowOpenKey): Deleted.
3432         (WebCore::DiagnosticLoggingKeys::hasOpenerKey): Deleted.
3433         * page/DiagnosticLoggingKeys.h:
3434         * page/Page.cpp:
3435         (WebCore::Page::openedByWindowOpen): Deleted.
3436         * page/Page.h:
3437         * page/Settings.in: Remove setting allowsPageCacheWithWindowOpener.
3438
3439 2017-02-10  Simon Fraser  <simon.fraser@apple.com>
3440
3441         REGRESSION (r211845): [ios-simulator] LayoutTest compositing/masks/solid-color-masked.html is a flaky failure
3442         https://bugs.webkit.org/show_bug.cgi?id=168054
3443
3444         Reviewed by Tim Horton.
3445
3446         When adding mask layers, there was an ordering dependency. There was a hack in GraphicsLayerCA::setVisibleAndCoverageRects()
3447         to propagate m_intersectsCoverageRect to masks. However, if GraphicsLayerCA::setVisibleAndCoverageRects()
3448         ran on the masked layer before the mask was added, nothing updated the "m_intersectsCoverageRect" state of the mask layer.
3449
3450         Fix by explicitly calling setVisibleAndCoverageRects() on the mask layer, passing the same rects and
3451         viewport-constrained state as for its host layer (we already assume that their geometry matches).
3452
3453         Tested by compositing/masks/solid-color-masked.html
3454
3455         * platform/graphics/ca/GraphicsLayerCA.cpp:
3456         (WebCore::GraphicsLayerCA::setVisibleAndCoverageRects):
3457         (WebCore::GraphicsLayerCA::recursiveCommitChanges):
3458
3459 2017-02-10  Commit Queue  <commit-queue@webkit.org>
3460
3461         Unreviewed, rolling out r212154, r212154, and r212156.
3462         https://bugs.webkit.org/show_bug.cgi?id=168156
3463
3464         broke internal builds (Requested by smfr on #webkit).
3465
3466         Reverted changesets:
3467
3468         "Add a DragImage class that wraps a DragImageRef"
3469         https://bugs.webkit.org/show_bug.cgi?id=168131
3470         http://trac.webkit.org/changeset/212154
3471
3472         "Add a DragImage class that wraps a DragImageRef"
3473         https://bugs.webkit.org/show_bug.cgi?id=168131
3474         http://trac.webkit.org/changeset/212154
3475
3476         "Try to fix the iOS and Windows builds."
3477         http://trac.webkit.org/changeset/212156
3478
3479 2017-02-10  Csaba Osztrogonác  <ossy@webkit.org>
3480
3481         Fix the !ENABLE(WEBGL) build
3482         https://bugs.webkit.org/show_bug.cgi?id=168112
3483
3484         Reviewed by Alex Christensen.
3485
3486         * html/canvas/WebGLRenderingContextBase.h:
3487
3488 2017-02-10  Youenn Fablet  <youenn@apple.com>
3489
3490         [Fetch API] fetch fails when undefined is passed as headers
3491         https://bugs.webkit.org/show_bug.cgi?id=168043
3492
3493         Reviewed by Geoffrey Garen.
3494
3495         Covered by updated test.
3496
3497         * Modules/fetch/FetchInternals.js:
3498         (fillFetchHeaders): Exit early in case of undefined headers, since it is an optional parameter.
3499
3500 2017-02-10  Csaba Osztrogonác  <ossy@webkit.org>
3501
3502         Fix the !ENABLE(WEB_TIMING) build
3503         https://bugs.webkit.org/show_bug.cgi?id=168113
3504
3505         Reviewed by Alex Christensen.
3506
3507         * workers/WorkerGlobalScope.cpp:
3508         (WebCore::WorkerGlobalScope::WorkerGlobalScope):
3509
3510 2017-02-10  Joseph Pecoraro  <pecoraro@apple.com>
3511
3512         Update features.json for Performance Timing APIs
3513         https://bugs.webkit.org/show_bug.cgi?id=168148
3514
3515         Reviewed by Simon Fraser.
3516
3517         * features.json:
3518
3519 2017-02-10  Anders Carlsson  <andersca@apple.com>
3520
3521         Try to fix the iOS and Windows builds.
3522
3523         * platform/ios/DragImageIOS.mm:
3524         (WebCore::deleteDragImage):
3525         * platform/win/PasteboardWin.cpp:
3526         (WebCore::Pasteboard::setDragImage):
3527
3528 2017-02-10  Anders Carlsson  <andersca@apple.com>
3529
3530         Add a DragImage class that wraps a DragImageRef
3531         https://bugs.webkit.org/show_bug.cgi?id=168131
3532
3533         Reviewed by Beth Dakin.
3534
3535         This allows us to get rid of the explicit deleteDragImage calls and will make additional cleanup of the
3536         various drag code paths possible. No functionality change.
3537
3538         * dom/DataTransfer.cpp:
3539         (WebCore::DataTransfer::updateDragImage):
3540         * page/DragController.cpp:
3541         (WebCore::DragController::startDrag):
3542         (WebCore::DragController::doImageDrag):
3543         (WebCore::DragController::doSystemDrag):
3544         * page/DragController.h:
3545         * platform/DragImage.cpp:
3546         (WebCore::DragImage::DragImage):
3547         (WebCore::DragImage::operator=):
3548         (WebCore::DragImage::~DragImage):
3549         * platform/DragImage.h:
3550         * platform/Pasteboard.h:
3551         * platform/StaticPasteboard.h:
3552         * platform/mac/PasteboardMac.mm:
3553         (WebCore::Pasteboard::setDragImage):
3554
3555 2017-02-10  Simon Fraser  <simon.fraser@apple.com>
3556
3557         Make sure the "inwindow" flag propagates to TiledBackings for masks and reflections
3558         https://bugs.webkit.org/show_bug.cgi?id=168127
3559         rdar://problem/30467120
3560
3561         Reviewed by Tim Horton.
3562         
3563         Replace the special-case, but wrong, GraphicsLayer traversal in setIsInWindowIncludingDescendants()
3564         which forgot to hit masks and replica layers with a generic traverse() function, which
3565         is then used for setting 'inWindow' as well as resetting tracked repaints.
3566
3567         Tests: compositing/tiling/tiled-mask-inwindow.html
3568                compositing/tiling/tiled-reflection-inwindow.html
3569
3570         * page/PageOverlayController.cpp:
3571         (WebCore::PageOverlayController::layerWithDocumentOverlays):
3572         (WebCore::PageOverlayController::layerWithViewOverlays):
3573         * platform/graphics/GraphicsLayer.cpp:
3574         (WebCore::GraphicsLayer::setIsInWindow):
3575         (WebCore::GraphicsLayer::setReplicatedByLayer):
3576         (WebCore::GraphicsLayer::traverse):
3577         (WebCore::GraphicsLayer::setIsInWindowIncludingDescendants): Deleted.
3578         * platform/graphics/GraphicsLayer.h:
3579         * rendering/RenderLayerCompositor.cpp:
3580         (WebCore::RenderLayerCompositor::setIsInWindow):
3581         (WebCore::RenderLayerCompositor::resetTrackedRepaintRects):
3582         (WebCore::resetTrackedRepaintRectsRecursive): Deleted.
3583
3584 2017-02-09  Simon Fraser  <simon.fraser@apple.com>
3585
3586         Tiled layers are sometimes left with some tiles when outside the viewport
3587         https://bugs.webkit.org/show_bug.cgi?id=168104
3588         rdar://problem/30459055
3589
3590         Reviewed by Tim Horton.
3591
3592         When the coverage rect of a TiledBacking goes from a non-empty rect to an empty rect, we
3593         shouldn't just early return from TileGrid::revalidateTiles(), otherwise we are left with some
3594         tiles. Run through the function as normal, which will remove all the tiles for an empty coverage rect.
3595         
3596         Minor logging changes.
3597
3598         Test: tiled-drawing/tile-coverage-iframe-to-zero-coverage.html
3599
3600         * platform/graphics/ca/TileGrid.cpp:
3601         (WebCore::TileGrid::revalidateTiles):
3602
3603 2017-02-10  Zalan Bujtas  <zalan@apple.com>
3604
3605         Mail hangs when removing multiple rows from large table.
3606         https://bugs.webkit.org/show_bug.cgi?id=168103
3607         <rdar://problem/30090186>
3608
3609         Reviewed by Ryosuke Niwa.
3610
3611         DeleteSelectionCommand::removeNode doesn't actually destroy table structure items,
3612         but instead it removes their content. In order to be able to continue editing the table after
3613         the delete, we need to ensure that its cells' width and height are > 0. Currently we issue layout on
3614         each table item recursively.
3615         This patch delays the layout until after we've finished with the entire subtree delete (10x progression).
3616
3617         Performance test added.
3618
3619         * editing/DeleteSelectionCommand.cpp:
3620         (WebCore::DeleteSelectionCommand::insertBlockPlaceholderForTableCellIfNeeded):
3621         (WebCore::DeleteSelectionCommand::removeNodeUpdatingStates):
3622         (WebCore::shouldRemoveContentOnly):
3623         (WebCore::DeleteSelectionCommand::removeNode):
3624         * editing/DeleteSelectionCommand.h:
3625
3626 2017-02-10  Joseph Pecoraro  <pecoraro@apple.com>
3627
3628         [Resource Timing] Enable Resource Timing by default in Tests
3629         https://bugs.webkit.org/show_bug.cgi?id=168145
3630
3631         Reviewed by Ryosuke Niwa.
3632
3633         * loader/ResourceTimingInformation.cpp:
3634         (WebCore::ResourceTimingInformation::addResourceTiming):
3635         * testing/InternalSettings.cpp:
3636         (WebCore::InternalSettings::Backup::Backup):
3637         (WebCore::InternalSettings::Backup::restoreTo):
3638         (WebCore::InternalSettings::setResourceTimingEnabled): Deleted.
3639         * testing/InternalSettings.h:
3640         * testing/InternalSettings.idl:
3641         No longer needed for tests.
3642
3643 2017-02-10  Dan Bernstein  <mitz@apple.com>
3644
3645         [Cocoa] Add shouldChangeSelectedRange to WKWebProcessPlugInEditingDelegate
3646         https://bugs.webkit.org/show_bug.cgi?id=168097
3647
3648         Reviewed by Tim Horton.
3649
3650         Added a userTriggered argument to FrameSelection::setSelectedRange so that WebKit2 can
3651         indicate that changes should be agreed to by the delegate.
3652
3653         * editing/FrameSelection.cpp:
3654         (WebCore::FrameSelection::setSelectedRange): If the change is user-triggered, check with
3655           shouldChangeSelection.
3656         * editing/FrameSelection.h:
3657
3658 2017-02-10  Jonathan Bedard  <jbedard@apple.com>
3659
3660         Removing LayoutTestRelay
3661         https://bugs.webkit.org/show_bug.cgi?id=165927
3662
3663         Reviewed by Daniel Bates.
3664         Part 2
3665
3666         LayoutTestRelay uses SPI, since recent versions of the iOS SDK allow for installing apps on
3667         simulators through simctl (iOS 10 and later), use this functionality instead.
3668
3669         * platform/RuntimeApplicationChecks.mm:
3670         (WebCore::IOSApplication::isDumpRenderTree): Update comment to reflect removal of LayoutTestRelay.
3671
3672 2017-02-10  Youenn Fablet  <youenn@apple.com>
3673
3674         [WebRTC] Implement Outgoing libwebrtc audio source support
3675         https://bugs.webkit.org/show_bug.cgi?id=168118
3676
3677         Reviewed by Eric Carlson.
3678
3679         No new automated tests as we need the audio rendering to work to test the whole loop.
3680
3681         Using an AudioSampleDataSource to convert the captured data to libwebrtc expected format.
3682         Capturing and pushing data happens in the capture thread.
3683         Pulling of converted data happens in libwebrtc thread.
3684
3685         Introducing LibWebRTCAudioFormat.h to centralize libwbebrtc expected audio format.
3686
3687         * WebCore.xcodeproj/project.pbxproj:
3688         * platform/audio/WebAudioBufferList.cpp:
3689         (WebCore::WebAudioBufferList::WebAudioBufferList): Missing initialization leads to assertion failure.
3690         * platform/audio/mac/AudioSampleBufferList.cpp:
3691         (WebCore::AudioSampleBufferList::copyFrom): In case of interleaved channels, there is one buffer but two channels.
3692         * platform/audio/mac/AudioSampleDataSource.cpp:
3693         (WebCore::AudioSampleDataSource::pushSamples):
3694         (WebCore::AudioSampleDataSource::pullAvalaibleSamplesAsChunks):
3695         * platform/audio/mac/AudioSampleDataSource.h:
3696         * platform/mediastream/libwebrtc/LibWebRTCAudioFormat.h: Added.
3697         * platform/mediastream/mac/RealtimeOutgoingAudioSource.cpp:
3698         (WebCore::libwebrtcAudioFormat):
3699         (WebCore::RealtimeOutgoingAudioSource::RealtimeOutgoingAudioSource):
3700         (WebCore::RealtimeOutgoingAudioSource::sourceMutedChanged):
3701         (WebCore::RealtimeOutgoingAudioSource::audioSamplesAvailable):
3702         (WebCore::RealtimeOutgoingAudioSource::pullAudioData):
3703         * platform/mediastream/mac/RealtimeOutgoingAudioSource.h:
3704
3705 2017-02-10  Ryosuke Niwa  <rniwa@webkit.org>
3706
3707         HTMLConstructionSiteTask::Insert should never be called on a node with a parent
3708         https://bugs.webkit.org/show_bug.cgi?id=168099
3709
3710         Reviewed by Sam Weinig.
3711
3712         insertAlreadyParsedChild always use HTMLConstructionSiteTask::InsertAlreadyParsedChild instead
3713         of using HTMLConstructionSiteTask::Insert when fostering a child.
3714
3715         Also combine the step to take all children and re-parenting into a single task instead of
3716         separately issuing TakeAllChildren and Reparent tasks.
3717
3718         No new tests since this is a refactoring.
3719
3720         * html/parser/HTMLConstructionSite.cpp:
3721         (WebCore::insert): Now asserts that the child node never have a parent.
3722         (WebCore::executeInsertAlreadyParsedChildTask): Moved the code to remove the parent here.
3723         (WebCore::executeTakeAllChildrenAndReparentTask): Renamed from executeTakeAllChildrenTask
3724         now that this function also does the reparenting.
3725         (WebCore::executeTask):
3726         (WebCore::HTMLConstructionSite::reparent): Removed the variant only used with takeAllChildren.
3727         (WebCore::HTMLConstructionSite::insertAlreadyParsedChild): Always use InsertAlreadyParsedChild
3728         instead of calling fosterParent which uses Insert when fostering parents.
3729         (WebCore::HTMLConstructionSite::takeAllChildrenAndReparent): Renamed from takeAllChildren.
3730         * html/parser/HTMLConstructionSite.h:
3731         (WebCore::HTMLConstructionSiteTask:Operation):
3732         * html/parser/HTMLTreeBuilder.cpp:
3733         (WebCore::HTMLTreeBuilder::callTheAdoptionAgency):
3734
3735 2017-02-10  Dave Hyatt  <hyatt@apple.com>
3736
3737         [CSS Parser] Make intercap property values serialize correctly
3738         https://bugs.webkit.org/show_bug.cgi?id=168073
3739
3740         Reviewed by Zalan Bujtas.
3741
3742         Fix CSS value keywords to preserve case when the value contains capital
3743         letters. Examples include optimizeSpeed, translateX, scaleY, etc.
3744
3745         * css/CSSPrimitiveValueMappings.h:
3746         (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
3747         (WebCore::CSSPrimitiveValue::operator EPointerEvents):
3748         (WebCore::CSSPrimitiveValue::operator TextRenderingMode):
3749         (WebCore::CSSPrimitiveValue::operator EImageRendering):
3750         (WebCore::CSSPrimitiveValue::operator EColorInterpolation):
3751         (WebCore::CSSPrimitiveValue::operator EColorRendering):
3752         (WebCore::CSSPrimitiveValue::operator EShapeRendering):
3753         * css/MediaQueryEvaluator.cpp:
3754         (WebCore::colorGamutEvaluate):
3755         * css/SVGCSSValueKeywords.in:
3756         * css/TransformFunctions.cpp:
3757         (WebCore::transformOperationType):
3758         (WebCore::transformsForValue):
3759         * css/makevalues.pl:
3760         * css/parser/CSSParserFastPaths.cpp:
3761         (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
3762         (WebCore::parseTransformTranslateArguments):
3763         (WebCore::parseSimpleTransformValue):
3764         * css/parser/CSSPropertyParser.cpp:
3765         (WebCore::consumeTransformValue):
3766         * css/parser/CSSPropertyParserHelpers.cpp:
3767         (WebCore::CSSPropertyParserHelpers::parseColorFunctionParameters):
3768
3769 2017-02-10  Zan Dobersek  <zdobersek@igalia.com>
3770
3771         [EME] Implement MediaKeySession::load()
3772         https://bugs.webkit.org/show_bug.cgi?id=168041
3773
3774         Reviewed by Xabier Rodriguez-Calvar.
3775
3776         Implement the MediaKeySession::load() method, tracing the steps as they
3777         are defined in the EME specification. The only exception is step 8.3,
3778         which requires additional facility that tracks currently open sessions
3779         and provides information whether for a given session ID there's already
3780         a MediaKeySession that's not yet been closed.
3781
3782         Session ID sanitization is done through the CDM::sanitizeSessionId()
3783         method, which relays the task to the CDMPrivate implementation.
3784
3785         The CDMInstance::loadSession() virtual method is called with the session
3786         type, sanitized ID, the Document's origin (in string form) and the
3787         callback that's invoked upon completion of the task. The callback
3788         checks whether the operation was successful, or examines the reason for
3789         the load failure in case it wasn't, rejecting the promise in the latter
3790         case either immediately or in the following task at the latest.
3791
3792         When the load was successful, the optional known keys, expiration time
3793         and message are handled appropriately, and the promise is resolved.
3794
3795         MockCDM::sanitizeSessionId() implementation only treats
3796         'valid-loaded-session' as a valid session ID.
3797         MockCDMInstance::loadSession() implementation is kept slim for now, only
3798         providing the 'license-renewal' message when invoking the passed-in
3799         callback. Known keys and expiration time will also be tested once the
3800         relevant MediaKeySession algorithms are implemented.
3801
3802         Test: media/encrypted-media/mock-MediaKeySession-load.html
3803
3804         * Modules/encryptedmedia/CDM.cpp:
3805         (WebCore::CDM::sanitizeSessionId):
3806         * Modules/encryptedmedia/CDM.h:
3807         * Modules/encryptedmedia/CDMInstance.h:
3808         * Modules/encryptedmedia/CDMPrivate.h:
3809         * Modules/encryptedmedia/MediaKeySession.cpp:
3810         (WebCore::MediaKeySession::load):
3811         * testing/MockCDMFactory.cpp:
3812         (WebCore::MockCDM::sanitizeSessionId):
3813         (WebCore::MockCDMInstance::loadSession):
3814         * testing/MockCDMFactory.h:
3815
3816 2017-02-10  Zan Dobersek  <zdobersek@igalia.com>
3817
3818         [EME] Implement MediaKeySession::sessionClosed()
3819         https://bugs.webkit.org/show_bug.cgi?id=168039
3820
3821         Reviewed by Xabier Rodriguez-Calvar.
3822
3823         Implement the 'session closed' algorithm for MediaKeySession by
3824         following the specified steps. After this algorithm is run, the
3825         session should be considered closed, which we track via the m_closed
3826         member variable on the class. This is set to true before the promise
3827         that's accessible through the 'closed' attribute is resolved.
3828
3829         Because the algorithm requires the CDM instance to store any record
3830         of key usage when the session's type is 'persistent-usage-record', the
3831         storeRecordOfKeyUsage() virtual method is added to the CDMInstance
3832         interface. MockCDMInstance implementation is left unimplemented for now.
3833
3834         JSMediaKeySession::closed() accessor now has a custom implementation
3835         that creates a deferred promise for that object if there's none yet, and
3836         shares it with the wrapped class through the registerClosedPromise()
3837         method, storing a reference to the promise in the m_closedPromise
3838         member variable, or resolving the promise immediately if the session was
3839         already closed.
3840
3841         Test cases added to media/encrypted-media/mock-MediaKeySession-close.html.
3842
3843         * Modules/encryptedmedia/CDMInstance.h:
3844         * Modules/encryptedmedia/MediaKeySession.cpp:
3845         (WebCore::MediaKeySession::registerClosedPromise):
3846         (WebCore::MediaKeySession::sessionClosed):
3847         * Modules/encryptedmedia/MediaKeySession.h:
3848         * bindings/js/JSMediaKeySessionCustom.cpp:
3849         (WebCore::JSMediaKeySession::closed):
3850         * testing/MockCDMFactory.cpp:
3851         (WebCore::MockCDMInstance::storeRecordOfKeyUsage):
3852         * testing/MockCDMFactory.h:
3853
3854 2017-02-10  Zan Dobersek  <zdobersek@igalia.com>
3855
3856         [EME] Implement MediaKeySession::updateKeyStatuses(), MediaKeyStatusMap
3857         https://bugs.webkit.org/show_bug.cgi?id=167888
3858
3859         Reviewed by Xabier Rodriguez-Calvar.
3860
3861         Implement MediaKeySession::updateKeyStatuses(), transforming the passed-in
3862         KeyStatusVector into a Vector mapping the key IDs to MediaKeyStatus values.
3863         A keystatuseschange event is fired on the MediaKeySession object afterwards.
3864         The queueing of the task that runs the 'attemp to resume playback' on the
3865         related HTMLMediaElement objects isn't done yet since that algorithm isn't
3866         implemented yet.
3867
3868         The statuses Vector is stored on the MediaKeySession object. That Vector is
3869         then exposed through the MediaKeyStatusMap object, each such object being
3870         unique to one MediaKeySession object. The implementation of MediaKeyStatusMap
3871         thus keeps a reference to the session object as long as that object is alive,
3872         and queries the MediaKeySession::statuses() getter to access the Vector that
3873         contains status information for all the key IDs.
3874
3875         MediaKeyStatusMap::Iterator object keeps a reference to the MediaKeyStatusMap
3876         object and accesses the statuses by indexing into the status Vector of the
3877         related MediaKeySession object.
3878
3879         CDMInstance::updateLicense() now accepts the session ID string as the first
3880         argument, making it possible to specify which session should be updated.
3881
3882         MockCDMFactory::keysForSessionWithID() returns an optional reference to the
3883         Vector value in the session map that lists all the key IDs that are being
3884         stored for that session.
3885
3886         MockCDMInstance::updateLicense() now detects the 'keys-changed' entry in the
3887         passed-in response data, and upon detecting that constructs a KeyStatusVector
3888         object containing all the keys for that session. KeyStatus::Usable is returned
3889         for each object at the moment, but this should be adjustable in the future
3890         through additional parameters passed through the response data. The Vector
3891         object is then passed to the callback and is then passed to the 'update key
3892         statuses' algorithm in MediaKeySession.
3893
3894         Covered by a test case in media/encrypted-media/mock-MediaKeySession-update.html.
3895
3896         * Modules/encryptedmedia/CDMInstance.h:
3897         * Modules/encryptedmedia/MediaKeySession.cpp:
3898         (WebCore::MediaKeySession::MediaKeySession):
3899         (WebCore::MediaKeySession::~MediaKeySession):
3900         (WebCore::MediaKeySession::update):
3901         (WebCore::MediaKeySession::updateKeyStatuses):
3902         * Modules/encryptedmedia/MediaKeySession.h:
3903         * Modules/encryptedmedia/MediaKeyStatusMap.cpp:
3904         (WebCore::MediaKeyStatusMap::MediaKeyStatusMap):
3905         (WebCore::MediaKeyStatusMap::detachSession):
3906         (WebCore::MediaKeyStatusMap::size):
3907         (WebCore::keyIdsMatch):
3908         (WebCore::MediaKeyStatusMap::has):
3909         (WebCore::MediaKeyStatusMap::get):
3910         (WebCore::MediaKeyStatusMap::Iterator::Iterator):
3911         (WebCore::MediaKeyStatusMap::Iterator::next):
3912         * Modules/encryptedmedia/MediaKeyStatusMap.h:
3913         (WebCore::MediaKeyStatusMap::create):
3914         * Modules/encryptedmedia/MediaKeyStatusMap.idl:
3915         * testing/MockCDMFactory.cpp:
3916         (WebCore::MockCDMFactory::keysForSessionWithID):
3917         (WebCore::MockCDMInstance::updateLicense):
3918         * testing/MockCDMFactory.h:
3919
3920 2017-02-09  Simon Fraser  <simon.fraser@apple.com>
3921
3922         Improve IOSurfacePool logging
3923         https://bugs.webkit.org/show_bug.cgi?id=168098
3924
3925         Reviewed by Tim Horton.
3926
3927         Pass a string to DUMP_POOL_STATISTICS so we can tell what's triggering the
3928         logging.
3929
3930         * platform/graphics/cg/IOSurfacePool.cpp:
3931         (WebCore::IOSurfacePool::takeSurface):
3932         (WebCore::IOSurfacePool::addSurface):
3933         (WebCore::IOSurfacePool::evict):
3934         (WebCore::IOSurfacePool::collectionTimerFired):
3935         (WebCore::IOSurfacePool::showPoolStatistics):
3936         * platform/graphics/cg/IOSurfacePool.h:
3937
3938 2017-02-09  Alex Christensen  <achristensen@webkit.org>
3939
3940         Unreviewed, rolling out r212040.
3941
3942         Broke build.  I'm not surprised
3943
3944         Reverted changeset:
3945
3946         "[WebRTC][Mac] Activate libwebrtc"
3947         https://bugs.webkit.org/show_bug.cgi?id=167293
3948         http://trac.webkit.org/changeset/212040
3949
3950 2017-02-09  Chris Dumez  <cdumez@apple.com>
3951
3952         [Mac][WK2] Use MIME type to add file extension to downloads' suggested filenames when missing
3953         https://bugs.webkit.org/show_bug.cgi?id=168077
3954         <rdar://problem/30412595>
3955
3956         Reviewed by Alex Christensen.
3957
3958         Add utility function to MIMETypeRegistry that appends an extension to
3959         a filename if necessary, based on a provided MIME type.
3960
3961         Tests: fast/dom/HTMLAnchorElement/anchor-file-blob-download-no-extension.html
3962                http/tests/download/anchor-download-no-extension.html
3963
3964         * platform/MIMETypeRegistry.cpp:
3965         (WebCore::MIMETypeRegistry::appendFileExtensionIfNecessary):
3966         * platform/MIMETypeRegistry.h:
3967         * platform/cocoa/MIMETypeRegistryCocoa.mm:
3968         (WebCore::MIMETypeRegistry::appendFileExtensionIfNecessary):
3969
3970 2017-02-09  Youenn Fablet  <youenn@apple.com>
3971
3972         [WebRTC][Mac] Activate libwebrtc
3973         https://bugs.webkit.org/show_bug.cgi?id=167293
3974
3975         Reviewed by Alex Christensen.
3976
3977         * Configurations/WebCore.xcconfig:
3978         * Configurations/WebCoreTestSupport.xcconfig:
3979
3980 2017-02-09  Philip Rogers  <pdr@google.com>
3981
3982         SVG clip-path references can clip out later content
3983         https://bugs.webkit.org/show_bug.cgi?id=164181
3984
3985         Reviewed by Said Abou-Hallawa.
3986
3987         RenderSVGResourceClipper can modify the GraphicsContext state (through the path-only
3988         clipping codepath) so we need to ensure RenderLayer::setupClipPath saves the context
3989         and its caller restores it back so later content is not clipped as well.
3990
3991         This patch is based on a chromium patch by fs@opera.com: