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