Search events should not fire synchronously for search type input elements with incre...
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2017-05-04  Jiewen Tan  <jiewen_tan@apple.com>
2
3         Search events should not fire synchronously for search type input elements with incremental attribute set
4         https://bugs.webkit.org/show_bug.cgi?id=171376
5         <rdar://problem/31863296>
6
7         Reviewed by Chris Dumez.
8
9         For some reasons, we fire search events immediately for search type input elements with incremental
10         attribute set only when the length of the input equals to zero. This behaviour should be prevented
11         as event listeners in the middle might perform unexpectedly.
12
13         Test: fast/forms/search/search-incremental-crash.html
14
15         * html/SearchInputType.cpp:
16         (WebCore::SearchInputType::startSearchEventTimer):
17
18 2017-05-08  Zalan Bujtas  <zalan@apple.com>
19
20         Text overlaps on http://www.duden.de/rechtschreibung/Acre
21         https://bugs.webkit.org/show_bug.cgi?id=171796
22         <rdar://problem/31036028>
23
24         Reviewed by Simon Fraser.
25
26         Simple line layout pre-measures space using the primary font,
27         even if the space glyph requires a fallback font (and even if the string does not have a space in it at all).
28         When this width gets cached (see WidthCache) we might end up using it later during normal line layout and
29         it could produce incorrect layout.
30         This patch removes the space width caching from Simple line layout, since Font already caches it.
31
32         Test: fast/text/simple-line-layout-fallback-space-glyph.html
33
34         * rendering/SimpleLineLayout.cpp:
35         (WebCore::SimpleLineLayout::createLineRuns):
36         * rendering/SimpleLineLayoutTextFragmentIterator.cpp:
37         (WebCore::SimpleLineLayout::TextFragmentIterator::Style::Style):
38         (WebCore::SimpleLineLayout::TextFragmentIterator::skipToNextPosition):
39         (WebCore::SimpleLineLayout::TextFragmentIterator::textWidth):
40         * rendering/SimpleLineLayoutTextFragmentIterator.h:
41
42 2017-05-08  Chris Dumez  <cdumez@apple.com>
43
44         Refactor ImageInputType::width() / height() for clarity
45         https://bugs.webkit.org/show_bug.cgi?id=171810
46
47         Reviewed by Zalan Bujtas.
48
49         Refactor ImageInputType::width() / height() for clarity.
50
51         * html/ImageInputType.cpp:
52         (WebCore::ImageInputType::height):
53         (WebCore::ImageInputType::width):
54
55 2017-05-08  Zalan Bujtas  <zalan@apple.com>
56
57         Bail out of simple line layout when hyphen needs a fallback font.
58         https://bugs.webkit.org/show_bug.cgi?id=171811
59
60         Reviewed by Antti Koivisto.
61
62         With hyphen: auto is set, we don't know if the hypen string is going to be used, until
63         after we started laying out the content and figured that the text overflows the line.
64         However it's too late to bail out of simple line layout at this point, so let's just
65         pre-check if the hyphen string needs a fallback font.
66
67         * rendering/SimpleLineLayout.cpp:
68         (WebCore::SimpleLineLayout::canUseForStyle):
69
70 2017-05-08  Youenn Fablet  <youenn@apple.com>
71
72         TURNS gathering is not working properly
73         https://bugs.webkit.org/show_bug.cgi?id=171747
74
75         Reviewed by Eric Carlson.
76
77         Covered by manual tests.
78
79         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
80         (WebCore::configurationFromMediaEndpointConfiguration): Reveting TURNS ice server skipping.
81
82 2017-05-08  Michael Catanzaro  <mcatanzaro@igalia.com>
83
84         Unreviewed, rolling out r216419.
85
86         Broke 70 layout tests on GTK bot
87
88         Reverted changeset:
89
90         "Ensure clean tree before AX cache update."
91         https://bugs.webkit.org/show_bug.cgi?id=171546
92         http://trac.webkit.org/changeset/216419
93
94 2017-05-08  Youenn Fablet  <youenn@apple.com>
95
96         CoreAudioCaptureSource should not modify its shared unit if already started/stopped
97         https://bugs.webkit.org/show_bug.cgi?id=171804
98
99         Reviewed by Jer Noble.
100
101         Manual testing only since CoreAudioSharedUnit is not mocked.
102
103         * platform/mediastream/mac/CoreAudioCaptureSource.cpp:
104         (WebCore::CoreAudioCaptureSource::startProducingData): Exit early if source is already started.
105         (WebCore::CoreAudioCaptureSource::stopProducingData): Exit early if source is already stopped.
106
107 2017-05-08  Antti Koivisto  <antti@apple.com>
108
109         ComposedTreeIterator does not traverse all slotted children if the traversal root is a slot element.
110         https://bugs.webkit.org/show_bug.cgi?id=171375
111         <rdar://problem/31863184>
112
113         Reviewed by Zalan Bujtas.
114
115         We were hitting an assert when using details element with a flow thread. The root cause for this turned
116         out to be that we only traversed the first slotted child if the traversal root was a slot element.
117
118         Test: fast/html/details-flow-thread.html
119
120         * dom/ComposedTreeIterator.cpp:
121         (WebCore::ComposedTreeIterator::traverseNextLeavingContext):
122
123             Try to traverse to the next slotted child before testing if we at the end of the current context.
124
125 2017-05-08  Mark Lam  <mark.lam@apple.com>
126
127         Introduce ExceptionScope::assertNoException() and releaseAssertNoException().
128         https://bugs.webkit.org/show_bug.cgi?id=171776
129
130         Reviewed by Keith Miller.
131
132         No new tests because there's no behavior change in functionality.  We're only
133         refactoring the code to use the new assertion utility function.
134
135         * Modules/plugins/QuickTimePluginReplacement.mm:
136         (WebCore::QuickTimePluginReplacement::installReplacement):
137         * bindings/js/JSCryptoKeySerializationJWK.cpp:
138         (WebCore::getJSArrayFromJSON):
139         (WebCore::getStringFromJSON):
140         (WebCore::getBooleanFromJSON):
141         * bindings/js/JSCustomElementRegistryCustom.cpp:
142         (WebCore::JSCustomElementRegistry::whenDefined):
143         * bindings/js/JSDOMExceptionHandling.cpp:
144         (WebCore::propagateExceptionSlowPath):
145         (WebCore::throwNotSupportedError):
146         (WebCore::throwInvalidStateError):
147         (WebCore::throwSecurityError):
148         (WebCore::throwDOMSyntaxError):
149         (WebCore::throwDataCloneError):
150         (WebCore::throwIndexSizeError):
151         (WebCore::throwTypeMismatchError):
152         * bindings/js/JSDOMGlobalObject.cpp:
153         (WebCore::makeThisTypeErrorForBuiltins):
154         (WebCore::makeGetterTypeErrorForBuiltins):
155         * bindings/js/JSDOMGlobalObjectTask.cpp:
156         * bindings/js/JSDOMPromise.h:
157         (WebCore::callPromiseFunction):
158         * bindings/js/JSDOMWindowBase.cpp:
159         (WebCore::JSDOMWindowMicrotaskCallback::call):
160         * bindings/js/JSMainThreadExecState.h:
161         (WebCore::JSMainThreadExecState::~JSMainThreadExecState):
162         * bindings/js/ReadableStreamDefaultController.cpp:
163         (WebCore::ReadableStreamDefaultController::isControlledReadableStreamLocked):
164         * bindings/js/ReadableStreamDefaultController.h:
165         (WebCore::ReadableStreamDefaultController::enqueue):
166         * bindings/js/SerializedScriptValue.cpp:
167         (WebCore::CloneDeserializer::readTerminal):
168         * bindings/scripts/CodeGeneratorJS.pm:
169         (GenerateSerializerFunction):
170         * bindings/scripts/test/JS/JSTestNode.cpp:
171         (WebCore::JSTestNode::serialize):
172         * bindings/scripts/test/JS/JSTestObj.cpp:
173         (WebCore::JSTestObj::serialize):
174         * bindings/scripts/test/JS/JSTestSerialization.cpp:
175         (WebCore::JSTestSerialization::serialize):
176         * bindings/scripts/test/JS/JSTestSerializationInherit.cpp:
177         (WebCore::JSTestSerializationInherit::serialize):
178         * bindings/scripts/test/JS/JSTestSerializationInheritFinal.cpp:
179         (WebCore::JSTestSerializationInheritFinal::serialize):
180         * contentextensions/ContentExtensionParser.cpp:
181         (WebCore::ContentExtensions::getTypeFlags):
182         * html/HTMLMediaElement.cpp:
183         (WebCore::HTMLMediaElement::didAddUserAgentShadowRoot):
184         (WebCore::HTMLMediaElement::updateMediaControlsAfterPresentationModeChange):
185         (WebCore::HTMLMediaElement::getCurrentMediaControlsStatus):
186         * html/HTMLPlugInImageElement.cpp:
187         (WebCore::HTMLPlugInImageElement::didAddUserAgentShadowRoot):
188
189 2017-05-08  Chris Dumez  <cdumez@apple.com>
190
191         Move 'style' from Element to HTMLElement / SVGElement and make it settable
192         https://bugs.webkit.org/show_bug.cgi?id=171795
193
194         Reviewed by Alex Christensen.
195
196         Move 'style' from Element to HTMLElement / SVGElement and make it settable
197         as per:
198         - https://drafts.csswg.org/cssom/#the-elementcssinlinestyle-interface
199
200         Both Firefox and Chrome already match the specification (both for the
201         property location and having it settable).
202
203         Test: fast/css/Element-style.html
204
205         * CMakeLists.txt:
206         * DerivedSources.make:
207         * WebCore.xcodeproj/project.pbxproj:
208         * css/ElementCSSInlineStyle.idl: Added.
209         * css/PropertySetCSSStyleDeclaration.h:
210         * css/StyleProperties.cpp:
211         (WebCore::MutableStyleProperties::ensureCSSStyleDeclaration):
212         (WebCore::MutableStyleProperties::ensureInlineCSSStyleDeclaration):
213         * css/StyleProperties.h:
214         * dom/Attr.cpp:
215         (WebCore::Attr::style):
216         * dom/Document.cpp:
217         (WebCore::Document::createCSSStyleDeclaration):
218         * dom/Element.cpp:
219         * dom/Element.h:
220         * dom/Element.idl:
221         * dom/StyledElement.cpp:
222         (WebCore::StyledElement::cssomStyle):
223         * dom/StyledElement.h:
224         * editing/Editor.cpp:
225         (WebCore::Editor::applyEditingStyleToElement):
226         * editing/ReplaceSelectionCommand.cpp:
227         (WebCore::ReplaceSelectionCommand::removeRedundantStylesAndKeepStyleSpanInline):
228         * html/HTMLElement.idl:
229
230         * html/ImageInputType.cpp:
231         (WebCore::ImageInputType::height):
232         (WebCore::ImageInputType::width):
233         Fix bug that was found by fast/forms/input-width-height-attributes-without-renderer-loaded-image.html.
234         That test relied on setting HTMLElement.style which did not work until now. Call updateLayout()
235         *before* doing the renderer check.
236
237         * inspector/InspectorCSSAgent.cpp:
238         (WebCore::InspectorCSSAgent::getMatchedStylesForNode):
239         (WebCore::InspectorCSSAgent::getInlineStylesForNode):
240         (WebCore::InspectorCSSAgent::getComputedStyleForNode):
241         (WebCore::InspectorCSSAgent::asInspectorStyleSheet):
242         (WebCore::InspectorCSSAgent::buildObjectForAttributesStyle):
243         * inspector/InspectorCSSAgent.h:
244         * inspector/InspectorStyleSheet.cpp:
245         (WebCore::InspectorStyle::create):
246         (WebCore::InspectorStyle::InspectorStyle):
247         (WebCore::InspectorStyle::extractSourceData):
248         (WebCore::InspectorStyle::setText):
249         (WebCore::InspectorStyleSheet::inspectorStyleForId):
250         (WebCore::InspectorStyleSheetForInlineStyle::create):
251         (WebCore::InspectorStyleSheetForInlineStyle::InspectorStyleSheetForInlineStyle):
252         (WebCore::InspectorStyleSheetForInlineStyle::didModifyElementAttribute):
253         (WebCore::InspectorStyleSheetForInlineStyle::setStyleText):
254         (WebCore::InspectorStyleSheetForInlineStyle::ensureParsedDataReady):
255         (WebCore::InspectorStyleSheetForInlineStyle::inlineStyle):
256         * inspector/InspectorStyleSheet.h:
257         * svg/SVGElement.idl:
258
259 2017-05-08  Joanmarie Diggs  <jdiggs@igalia.com>
260
261         AX: Propagate aria-readonly to grid descendants
262         https://bugs.webkit.org/show_bug.cgi?id=171189
263
264         Reviewed by Chris Fleizach.
265
266         Propagate aria-readonly to grid descendants if the property is not
267         explicitly set on the descendant.
268
269         Test: accessibility/gtk/aria-readonly-propagated.html
270               Additional test cases also added to accessibility/aria-readonly.html
271
272         * accessibility/AccessibilityARIAGridCell.cpp:
273         (WebCore::AccessibilityARIAGridCell::ariaReadOnlyValue):
274         * accessibility/AccessibilityARIAGridCell.h:
275         * accessibility/AccessibilityObject.h:
276
277 2017-05-06  Zalan Bujtas  <zalan@apple.com>
278
279         Ensure clean tree before AX cache update.
280         https://bugs.webkit.org/show_bug.cgi?id=171546
281         <rdar://problem/31934942>
282
283         While updating an accessibility object state, we might
284         perform unintentional style updates. This style update could
285         end up destroying renderes that are still referenced by function calls 
286         on the callstack.
287         To avoid that, AXObjectCache should operate on a clean tree only. 
288
289         Reviewed by Chris Fleizach.
290
291         Test: accessibility/crash-when-render-tree-is-not-clean.html
292
293         * accessibility/AXObjectCache.cpp:
294         (WebCore::AXObjectCache::checkedStateChanged):
295         (WebCore::AXObjectCache::selectedChildrenChanged):
296         (WebCore::AXObjectCache::handleAriaExpandedChange):
297         (WebCore::AXObjectCache::handleActiveDescendantChanged):
298         (WebCore::AXObjectCache::handleAriaRoleChanged):
299         (WebCore::AXObjectCache::handleAttributeChanged):
300         (WebCore::AXObjectCache::handleAriaModalChange):
301         (WebCore::AXObjectCache::labelChanged):
302         * accessibility/AXObjectCache.h:
303         (WebCore::AXObjectCache::checkedStateChanged):
304         (WebCore::AXObjectCache::handleActiveDescendantChanged):
305         (WebCore::AXObjectCache::handleAriaExpandedChange):
306         (WebCore::AXObjectCache::handleAriaRoleChanged):
307         (WebCore::AXObjectCache::handleAriaModalChange):
308         (WebCore::AXObjectCache::handleAttributeChanged):
309         (WebCore::AXObjectCache::selectedChildrenChanged):
310         * accessibility/AccessibilityRenderObject.cpp:
311         (WebCore::AccessibilityRenderObject::handleAriaExpandedChanged):
312         * dom/Element.cpp:
313         (WebCore::Element::attributeChanged):
314         * html/HTMLInputElement.cpp:
315         (WebCore::HTMLInputElement::setChecked):
316
317 2017-05-08  Myles C. Maxfield  <mmaxfield@apple.com>
318
319         Unprefix unicode-bidi CSS values
320         https://bugs.webkit.org/show_bug.cgi?id=171761
321
322         Reviewed by Simon Fraser.
323
324         Create new values which parse to the same internal state as the
325         prefixed values.
326
327         Tests: fast/text/bidi-unprefix.html
328                imported/w3c/i18n/bidi/bidi-embed-001.html
329                imported/w3c/i18n/bidi/bidi-embed-002.html
330                imported/w3c/i18n/bidi/bidi-embed-003.html
331                imported/w3c/i18n/bidi/bidi-embed-004.html
332                imported/w3c/i18n/bidi/bidi-embed-005.html
333                imported/w3c/i18n/bidi/bidi-embed-006.html
334                imported/w3c/i18n/bidi/bidi-embed-007.html
335                imported/w3c/i18n/bidi/bidi-embed-008.html
336                imported/w3c/i18n/bidi/bidi-embed-009.html
337                imported/w3c/i18n/bidi/bidi-embed-010.html
338                imported/w3c/i18n/bidi/bidi-embed-011.html
339                imported/w3c/i18n/bidi/bidi-isolate-001.html
340                imported/w3c/i18n/bidi/bidi-isolate-002.html
341                imported/w3c/i18n/bidi/bidi-isolate-003.html
342                imported/w3c/i18n/bidi/bidi-isolate-004.html
343                imported/w3c/i18n/bidi/bidi-isolate-005.html
344                imported/w3c/i18n/bidi/bidi-isolate-006.html
345                imported/w3c/i18n/bidi/bidi-isolate-007.html
346                imported/w3c/i18n/bidi/bidi-isolate-008.html
347                imported/w3c/i18n/bidi/bidi-isolate-009.html
348                imported/w3c/i18n/bidi/bidi-isolate-010.html
349                imported/w3c/i18n/bidi/bidi-isolate-011.html
350                imported/w3c/i18n/bidi/bidi-isolate-override-001.html
351                imported/w3c/i18n/bidi/bidi-isolate-override-002.html
352                imported/w3c/i18n/bidi/bidi-isolate-override-003.html
353                imported/w3c/i18n/bidi/bidi-isolate-override-004.html
354                imported/w3c/i18n/bidi/bidi-isolate-override-005.html
355                imported/w3c/i18n/bidi/bidi-isolate-override-006.html
356                imported/w3c/i18n/bidi/bidi-isolate-override-007.html
357                imported/w3c/i18n/bidi/bidi-isolate-override-008.html
358                imported/w3c/i18n/bidi/bidi-isolate-override-009.html
359                imported/w3c/i18n/bidi/bidi-isolate-override-010.html
360                imported/w3c/i18n/bidi/bidi-isolate-override-011.html
361                imported/w3c/i18n/bidi/bidi-isolate-override-012.html
362                imported/w3c/i18n/bidi/bidi-normal-001.html
363                imported/w3c/i18n/bidi/bidi-normal-002.html
364                imported/w3c/i18n/bidi/bidi-normal-003.html
365                imported/w3c/i18n/bidi/bidi-normal-004.html
366                imported/w3c/i18n/bidi/bidi-normal-005.html
367                imported/w3c/i18n/bidi/bidi-normal-006.html
368                imported/w3c/i18n/bidi/bidi-normal-007.html
369                imported/w3c/i18n/bidi/bidi-normal-008.html
370                imported/w3c/i18n/bidi/bidi-normal-009.html
371                imported/w3c/i18n/bidi/bidi-normal-010.html
372                imported/w3c/i18n/bidi/bidi-normal-011.html
373                imported/w3c/i18n/bidi/bidi-override-001.html
374                imported/w3c/i18n/bidi/bidi-override-002.html
375                imported/w3c/i18n/bidi/bidi-override-003.html
376                imported/w3c/i18n/bidi/bidi-override-004.html
377                imported/w3c/i18n/bidi/bidi-override-005.html
378                imported/w3c/i18n/bidi/bidi-override-006.html
379                imported/w3c/i18n/bidi/bidi-override-007.html
380                imported/w3c/i18n/bidi/bidi-override-008.html
381                imported/w3c/i18n/bidi/bidi-override-009.html
382                imported/w3c/i18n/bidi/bidi-override-010.html
383                imported/w3c/i18n/bidi/bidi-override-011.html
384                imported/w3c/i18n/bidi/bidi-override-012.html
385                imported/w3c/i18n/bidi/bidi-plaintext-001.html
386                imported/w3c/i18n/bidi/bidi-plaintext-003.html
387                imported/w3c/i18n/bidi/bidi-plaintext-005.html
388                imported/w3c/i18n/bidi/bidi-plaintext-006.html
389                imported/w3c/i18n/bidi/bidi-plaintext-007.html
390                imported/w3c/i18n/bidi/bidi-plaintext-008.html
391                imported/w3c/i18n/bidi/bidi-plaintext-009.html
392                imported/w3c/i18n/bidi/bidi-plaintext-010.html
393                imported/w3c/i18n/bidi/bidi-plaintext-011.html
394                imported/w3c/i18n/bidi/bidi-table-001.html
395                imported/w3c/i18n/bidi/bidi-unset-001.html
396                imported/w3c/i18n/bidi/bidi-unset-002.html
397                imported/w3c/i18n/bidi/bidi-unset-003.html
398                imported/w3c/i18n/bidi/bidi-unset-004.html
399                imported/w3c/i18n/bidi/bidi-unset-005.html
400                imported/w3c/i18n/bidi/bidi-unset-006.html
401                imported/w3c/i18n/bidi/bidi-unset-007.html
402                imported/w3c/i18n/bidi/bidi-unset-008.html
403                imported/w3c/i18n/bidi/bidi-unset-009.html
404                imported/w3c/i18n/bidi/bidi-unset-010.html
405                imported/w3c/i18n/bidi/block-embed-001.html
406                imported/w3c/i18n/bidi/block-embed-002.html
407                imported/w3c/i18n/bidi/block-embed-003.html
408                imported/w3c/i18n/bidi/block-override-001.html
409                imported/w3c/i18n/bidi/block-override-002.html
410                imported/w3c/i18n/bidi/block-override-003.html
411                imported/w3c/i18n/bidi/block-override-004.html
412                imported/w3c/i18n/bidi/block-override-isolate-001.html
413                imported/w3c/i18n/bidi/block-override-isolate-002.html
414                imported/w3c/i18n/bidi/block-override-isolate-003.html
415                imported/w3c/i18n/bidi/block-override-isolate-004.html
416                imported/w3c/i18n/bidi/block-plaintext-001.html
417                imported/w3c/i18n/bidi/block-plaintext-002.html
418                imported/w3c/i18n/bidi/block-plaintext-003.html
419                imported/w3c/i18n/bidi/block-plaintext-004.html
420                imported/w3c/i18n/bidi/block-plaintext-005.html
421                imported/w3c/i18n/bidi/block-plaintext-006.html
422
423         * css/CSSPrimitiveValueMappings.h:
424         (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
425         (WebCore::CSSPrimitiveValue::operator EUnicodeBidi):
426         * css/CSSProperties.json:
427         * css/CSSValueKeywords.in:
428         * css/html.css:
429         (bdi, output):
430         * css/parser/CSSParserFastPaths.cpp:
431         (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
432         * html/HTMLElement.cpp:
433         (WebCore::unicodeBidiAttributeForDirAuto):
434         * html/track/TextTrackCueGeneric.cpp:
435         (WebCore::TextTrackCueGenericBoxElement::applyCSSProperties):
436         * html/track/VTTCue.cpp:
437         (WebCore::VTTCueBox::applyCSSProperties):
438
439 2017-05-07  Ben Kelly  <ben@wanderview.com>
440
441         Set the Response.blob() type based on the content-type header value.
442         https://bugs.webkit.org/show_bug.cgi?id=170849
443
444         Reviewed by Youenn Fablet.
445
446         There are two problems to fix here:
447
448         1.  Currently the FetchResponse class only called updateContentType()
449         when first created even though all the headers were not available.  This
450         patch calls updateContentType() again after the headers are populated.
451
452         2.  The fetch design requires propagating the normalized blob
453         type to FetchBodyConsumer as well.  Currently this is only done if
454         Response.blob() is called after the body is completely loaded.  If
455         we hit the consumeOnceLoadingFinished() path, then the type is not
456         passed.  This is similar to what was happening in bug 171489 with
457         ReadableStream bodies.  This patch sets the type on the
458         FetchBodyConsumer in consumeOnceLoadingFinished() as well.
459
460         Theses changes allow WebKit to pass the "Consume response's body: from
461         fetch to blob" case in the WPT response-consume.html test.
462
463         Test: http://w3c-test.org/fetch/api/response/response-consume.html
464
465         * Modules/fetch/FetchResponse.cpp:
466         (WebCore::FetchResponse::BodyLoader::didReceiveResponse): Modified to
467         call FetchBodyOwner::updateContentType() after filling m_headers.
468         (WebCore::FetchBody::consumeOnceLoadingFinished): Call
469         FetchBodyConsumer::setContentType() when being consumed as
470         a blob.
471         * Modules/fetch/FetchBody.h: Modify consumeOnceLoadingFinished()
472         to take the content type string.
473         * Modules/fetch/FetchBodyOwner.cpp:
474         (WebCore::FetchBodyOwner::consumeOnceLoadingFinished): Pass
475         the content type string down to FetchBody so it can be
476         propagated to the FetchBodyConsumer.
477
478 2017-05-07  Simon Fraser  <simon.fraser@apple.com>
479
480         [iOS] REGRESSION (r209409): getBoundingClientRect is wrong for fixed-position elements in resize/orientationchange
481         https://bugs.webkit.org/show_bug.cgi?id=171140
482
483         Reviewed by Sam Weinig.
484
485         WebPage::dynamicViewportSizeUpdate() is called during rotation, and does a layout which needs to have
486         an up-to-date layout viewport, since the layout viewport state is detectable in orientationchange and
487         resize events via fetching the client rect of fixed elements. Normally we send in the layout viewport
488         from the UI process, but in this case we need to compute one in the web process. So factor code
489         into FrameView to do the computation, called from both places.
490
491         Tests: fast/events/ios/rotation/layout-viewport-during-rotation.html
492                fast/events/ios/rotation/layout-viewport-during-safari-type-rotation.html
493
494         * page/FrameView.cpp:
495         (WebCore::FrameView::computeUpdatedLayoutViewportRect):
496         * page/FrameView.h:
497
498 2017-05-07  Chris Dumez  <cdumez@apple.com>
499
500         Drop remaining uses of PassRefPtr in editing code
501         https://bugs.webkit.org/show_bug.cgi?id=171787
502
503         Reviewed by Darin Adler.
504
505         Drop remaining uses of PassRefPtr in editing code.
506
507         * editing/AlternativeTextController.cpp:
508         (WebCore::AlternativeTextController::timerFired):
509         * editing/ApplyStyleCommand.cpp:
510         (WebCore::toIdentifier):
511         * editing/CompositeEditCommand.cpp:
512         (WebCore::CompositeEditCommand::didApplyCommand):
513         (WebCore::CompositeEditCommand::moveParagraphs):
514         * editing/CompositeEditCommand.h:
515         * editing/Editor.cpp:
516         (WebCore::Editor::shouldInsertFragment):
517         (WebCore::Editor::replaceSelectionWithFragment):
518         (WebCore::Editor::appliedEditing):
519         (WebCore::Editor::performCutOrCopy):
520         (WebCore::Editor::willWriteSelectionToPasteboard):
521         (WebCore::Editor::advanceToNextMisspelling):
522         (WebCore::Editor::isSelectionUngrammatical):
523         (WebCore::Editor::guessesForMisspelledOrUngrammatical):
524         (WebCore::Editor::markMisspellingsOrBadGrammar):
525         (WebCore::Editor::markAllMisspellingsAndBadGrammarInRanges):
526         (WebCore::correctSpellcheckingPreservingTextCheckingParagraph):
527         (WebCore::Editor::markAndReplaceFor):
528         (WebCore::Editor::changeBackToReplacedString):
529         * editing/Editor.h:
530         * editing/EditorCommand.cpp:
531         (WebCore::executeInsertFragment):
532         (WebCore::Editor::command):
533         (WebCore::Editor::Command::Command):
534         * editing/FormatBlockCommand.cpp:
535         (WebCore::FormatBlockCommand::formatRange):
536         * editing/IndentOutdentCommand.cpp:
537         (WebCore::IndentOutdentCommand::indentIntoBlockquote):
538         (WebCore::IndentOutdentCommand::outdentParagraph):
539         * editing/InsertListCommand.cpp:
540         (WebCore::InsertListCommand::fixOrphanedListChild):
541         (WebCore::InsertListCommand::mergeWithNeighboringLists):
542         (WebCore::InsertListCommand::doApplyForSingleParagraph):
543         (WebCore::InsertListCommand::unlistifyParagraph):
544         (WebCore::InsertListCommand::listifyParagraph):
545         * editing/InsertListCommand.h:
546         * editing/InsertParagraphSeparatorCommand.cpp:
547         (WebCore::InsertParagraphSeparatorCommand::doApply):
548         * editing/InsertTextCommand.cpp:
549         (WebCore::InsertTextCommand::InsertTextCommand):
550         * editing/InsertTextCommand.h:
551         (WebCore::InsertTextCommand::createWithMarkerSupplier):
552         * editing/MoveSelectionCommand.cpp:
553         (WebCore::MoveSelectionCommand::MoveSelectionCommand):
554         * editing/MoveSelectionCommand.h:
555         (WebCore::MoveSelectionCommand::create):
556         * editing/ReplaceSelectionCommand.cpp:
557         (WebCore::ReplacementFragment::removeNodePreservingChildren):
558         (WebCore::ReplacementFragment::removeNode):
559         (WebCore::ReplacementFragment::insertNodeBefore):
560         (WebCore::ReplacementFragment::restoreAndRemoveTestRenderingNodesToFragment):
561         (WebCore::ReplacementFragment::removeUnrenderedNodes):
562         (WebCore::ReplacementFragment::removeInterchangeNodes):
563         (WebCore::ReplaceSelectionCommand::makeInsertedContentRoundTrippableWithHTMLTreeBuilder):
564         (WebCore::ReplaceSelectionCommand::moveNodeOutOfAncestor):
565         (WebCore::removeHeadContents):
566         (WebCore::ReplaceSelectionCommand::doApply):
567         (WebCore::ReplaceSelectionCommand::insertAsListItems):
568         * editing/ReplaceSelectionCommand.h:
569         * editing/SpellChecker.cpp:
570         (WebCore::SpellCheckRequest::SpellCheckRequest):
571         (WebCore::SpellCheckRequest::create):
572         (WebCore::SpellChecker::canCheckAsynchronously):
573         (WebCore::SpellChecker::isCheckable):
574         (WebCore::SpellChecker::requestCheckingFor):
575         (WebCore::SpellChecker::invokeRequest):
576         (WebCore::SpellChecker::enqueueRequest):
577         (WebCore::SpellChecker::didCheck):
578         * editing/SpellChecker.h:
579         (WebCore::SpellCheckRequest::checkingRange):
580         (WebCore::SpellCheckRequest::paragraphRange):
581         * editing/TextCheckingHelper.cpp:
582         (WebCore::expandToParagraphBoundary):
583         (WebCore::TextCheckingParagraph::TextCheckingParagraph):
584         (WebCore::TextCheckingParagraph::expandRangeToNextEnd):
585         (WebCore::TextCheckingParagraph::rangeLength):
586         (WebCore::TextCheckingParagraph::paragraphRange):
587         (WebCore::TextCheckingParagraph::subrange):
588         (WebCore::TextCheckingParagraph::offsetTo):
589         (WebCore::TextCheckingParagraph::offsetAsRange):
590         (WebCore::TextCheckingParagraph::text):
591         (WebCore::TextCheckingParagraph::checkingStart):
592         (WebCore::TextCheckingParagraph::checkingEnd):
593         (WebCore::TextCheckingParagraph::checkingLength):
594         (WebCore::TextCheckingHelper::TextCheckingHelper):
595         (WebCore::TextCheckingHelper::findFirstMisspelling):
596         (WebCore::TextCheckingHelper::findFirstMisspellingOrBadGrammar):
597         (WebCore::TextCheckingHelper::findFirstGrammarDetail):
598         (WebCore::TextCheckingHelper::findFirstBadGrammar):
599         (WebCore::TextCheckingHelper::isUngrammatical):
600         (WebCore::TextCheckingHelper::guessesForMisspelledOrUngrammaticalRange):
601         (WebCore::TextCheckingHelper::unifiedTextCheckerEnabled):
602         * editing/TextCheckingHelper.h:
603         * editing/TypingCommand.cpp:
604         (WebCore::TypingCommand::typingAddedToOpenCommand):
605         * editing/cocoa/EditorCocoa.mm:
606         (WebCore::Editor::replaceSelectionWithAttributedString):
607         * editing/gtk/EditorGtk.cpp:
608         (WebCore::Editor::pasteWithPasteboard):
609         * editing/ios/EditorIOS.mm:
610         (WebCore::Editor::pasteWithPasteboard):
611         * editing/mac/EditorMac.mm:
612         (WebCore::Editor::pasteWithPasteboard):
613         (WebCore::Editor::replaceNodeFromPasteboard):
614         * editing/win/EditorWin.cpp:
615         (WebCore::Editor::pasteWithPasteboard):
616         (WebCore::createFragmentFromPlatformData):
617         * page/DragController.cpp:
618         (WebCore::DragController::concludeEditDrag):
619         (WebCore::DragController::startDrag):
620
621 2017-05-07  Youenn Fablet  <youenn@apple.com>
622
623         [MediaStream] r216197 caused some webrtc tests to fail
624         https://bugs.webkit.org/show_bug.cgi?id=171728
625
626         Reviewed by Eric Carlson.
627
628         Covered by existing tests.
629
630         Rename MediaStream::endStream to MediaStream::endCaptureTracks and only stopping capture tracks.
631         Using it when Document is asked to stop media capture.
632
633         Adding the ability to have only one active capture source at a time in a WebProcess.
634         This is done by keeping in its related factory the active capture source.
635         When a new source is created and started, it replaces the active capture source which becomes muted.
636         Using that mechanism for iOS.
637
638         * Modules/mediastream/MediaStream.cpp:
639         (WebCore::MediaStream::endCaptureTracks):
640         (WebCore::MediaStream::endStream): Deleted.
641         * Modules/mediastream/MediaStream.h:
642         * Modules/mediastream/MediaStreamTrack.h:
643         (WebCore::MediaStreamTrack::isCaptureTrack):
644         * dom/Document.cpp:
645         (WebCore::Document::stopMediaCapture):
646         * platform/mediastream/mac/AVAudioCaptureSource.mm:
647         (WebCore::AVAudioCaptureSourceFactory::setActiveSource):
648         (WebCore::AVAudioCaptureSource::setupCaptureSession):
649         * platform/mediastream/mac/AVVideoCaptureSource.mm:
650         (WebCore::AVVideoCaptureSourceFactory::setActiveSource):
651         (WebCore::AVVideoCaptureSource::setupCaptureSession):
652         * platform/mediastream/mac/CoreAudioCaptureSource.cpp:
653         (WebCore::CoreAudioCaptureSourceFactory::setActiveSource):
654         (WebCore::CoreAudioSharedUnit::startProducingData):
655
656 2017-05-07  Tim Horton  <timothy_horton@apple.com>
657
658         Clean up some WebProcessProxy, WebPage, and message handler includes
659         https://bugs.webkit.org/show_bug.cgi?id=171791
660
661         Reviewed by Sam Weinig.
662
663         * WebCore.xcodeproj/project.pbxproj:
664         * editing/CompositionUnderline.h: Added.
665         (WebCore::CompositionUnderline::CompositionUnderline):
666         * editing/Editor.h:
667         (WebCore::CompositionUnderline::CompositionUnderline): Deleted.
668         Move CompositionUnderline out of Editor.h, so that other files can
669         include that without Editor.h (which is quite large). Also, modernize it slightly.
670
671 2017-05-07  Sam Weinig  <sam@webkit.org>
672
673         Implement Subresource Integrity (SRI)
674         https://bugs.webkit.org/show_bug.cgi?id=148363
675         <rdar://problem/18945879>
676
677         Reviewed by Daniel Bates.
678
679         Tests: http/tests/subresource-integrity/sri-disabled-with-setting.html
680                http/tests/subresource-integrity/sri-enabled-with-setting.html
681                http/tests/subresource-integrity/sri-script-cors.html
682                http/tests/subresource-integrity/sri-style-cors.html
683
684         * CMakeLists.txt:
685         * WebCore.xcodeproj/project.pbxproj:
686         Add new files.
687
688         * dom/LoadableClassicScript.cpp:
689         (WebCore::LoadableClassicScript::create):
690         (WebCore::LoadableClassicScript::notifyFinished):
691         * dom/LoadableClassicScript.h:
692         * dom/LoadableScript.h:
693         * dom/ScriptElement.cpp:
694         (WebCore::ScriptElement::requestClassicScript):
695         Store integrity metadata in the script fetcher so it can be passed to
696         the checked when script load finishes.
697
698         * html/HTMLAttributeNames.in:
699         Add 'integrity'.
700
701         * html/HTMLLinkElement.cpp:
702         (WebCore::HTMLLinkElement::process):
703         When requesting a stylesheet, cache the integrity metadata so it can
704         be used when the load completes (accessing the attribute at load completion
705         time is incorrect, as a script might have changed the attributes value since
706         the request was made).
707
708         (WebCore::HTMLLinkElement::setCSSStyleSheet):
709         Add an integrity check using the cached integrity metadata when a load
710         finishes.
711
712         * html/HTMLLinkElement.h:
713         Add cached integrity metadata member.
714
715         * html/HTMLLinkElement.idl:
716         * html/HTMLScriptElement.idl:
717         Add integrity property.
718
719         * html/parser/HTMLParserIdioms.h:
720         (WebCore::isNotHTMLSpace):
721         Templatize isNotHTMLSpace so it can work for both UChar and LChar.
722
723         * loader/ResourceCryptographicDigest.cpp:
724         (WebCore::parseCryptographicDigestImpl):
725         (WebCore::parseEncodedCryptographicDigestImpl):
726         (WebCore::parseEncodedCryptographicDigest):
727         (WebCore::decodeEncodedResourceCryptographicDigest):
728         * loader/ResourceCryptographicDigest.h:
729         Add concept of an encoded digest to more closely model the spec so that hashes
730         that match the grammar but are invalid (say, mixing base64 and base64URL) make
731         it through the algorithm longer, and don't cause us to load something that should
732         be blocked.
733
734         * loader/SubresourceIntegrity.cpp: Added.
735         * loader/SubresourceIntegrity.h: Added.
736         Add implementation of Subresource Integrity metadata validation allowing
737         for a CachedResource and integrity metadata to be passed for validation.
738
739         * page/Settings.in:
740         Add setting for Subresource Integrity, defaulted to enabled.
741
742 2017-05-07  Michael Catanzaro  <mcatanzaro@igalia.com>
743
744         [GTK] Cannot sign in with new Google sign-in page
745         https://bugs.webkit.org/show_bug.cgi?id=171770
746
747         Reviewed by Carlos Garcia Campos.
748
749         Google's new authentication page does not work with the Firefox user
750         agent that's required to make various Google websites work. Special-case
751         accounts.google.com so that it receives our standard user agent.
752
753         * platform/UserAgentQuirks.cpp:
754         (WebCore::isGoogle):
755         (WebCore::urlRequiresFirefoxBrowser):
756
757 2017-05-06  Myles C. Maxfield  <mmaxfield@apple.com>
758
759         [Cocoa] CTFontDescriptorCreateMatchingFontDescriptor() is not case insensitive
760         https://bugs.webkit.org/show_bug.cgi?id=171636
761         <rdar://problem/30811218>
762
763         Reviewed by Dean Jackson.
764
765         LastResort is the only name which needs to be looked up case-sensitively. We can handle
766         this in our existing function which handles special font names (like -apple-system) to
767         make sure that we always do the right thing.
768
769         Test: fast/text/lastResort.html
770
771         * platform/graphics/ios/FontCacheIOS.mm:
772         (WebCore::platformFontWithFamilySpecialCase):
773         * platform/graphics/mac/FontCacheMac.mm:
774         (WebCore::platformFontWithFamilySpecialCase):
775         * platform/spi/cocoa/CoreTextSPI.h:
776
777 2017-05-06  Chris Dumez  <cdumez@apple.com>
778
779         Implement the concept of cookie-averse document
780         https://bugs.webkit.org/show_bug.cgi?id=171746
781         <rdar://problem/32004466>
782
783         Reviewed by Sam Weinig.
784
785         Implement the concept of cookie-averse document:
786         - https://html.spec.whatwg.org/#cookie-averse-document-object
787
788         Test: fast/cookies/cookie-averse-document.html
789
790         * dom/Document.cpp:
791         (WebCore::Document::isCookieAverse):
792         (WebCore::Document::cookie):
793         (WebCore::Document::setCookie):
794         * dom/Document.h:
795
796 2017-05-06  Chris Dumez  <cdumez@apple.com>
797
798         Unreviewed build fix after r216339.
799
800         * dom/Document.h:
801         (WebCore::Document::readyState):
802
803 2017-05-06  Chris Dumez  <cdumez@apple.com>
804
805         Align our IDL files with the latest DOM specification
806         https://bugs.webkit.org/show_bug.cgi?id=171777
807
808         Reviewed by Sam Weinig.
809
810         Align our IDL files with the latest DOM specification:
811         - https://dom.spec.whatwg.org
812
813         No Web-facing behavior change. Things that do not match the specification
814         have been annotated with FIXME comments.
815
816         * dom/CharacterData.idl:
817         * dom/Comment.idl:
818         * dom/CustomEvent.idl:
819         * dom/DOMImplementation.idl:
820         * dom/Document.cpp:
821         * dom/Document.h:
822         (WebCore::Document::readyState):
823         * dom/Document.idl:
824         * dom/MutationObserver.idl:
825         * dom/NamedNodeMap.idl:
826         * dom/NodeFilter.idl:
827         * dom/NodeIterator.idl:
828         * dom/NodeList.idl:
829         * dom/NonDocumentTypeChildNode.idl:
830         * dom/ParentNode.idl:
831         * dom/ProcessingInstruction.idl:
832         * dom/Range.idl:
833         * dom/ShadowRoot.idl:
834         * dom/Text.idl:
835         * dom/TreeWalker.idl:
836         * html/DOMTokenList.idl:
837
838 2017-05-06  Tim Horton  <timothy_horton@apple.com>
839
840         Reduce the number of includes in WebPage.h and WebProcess.h
841         https://bugs.webkit.org/show_bug.cgi?id=171779
842
843         Reviewed by Sam Weinig.
844
845         * page/TextIndicator.h:
846
847 2017-05-06  Alexey Proskuryakov  <ap@apple.com>
848
849         REGRESSION (r216294): The new test fails on WebKit1
850         https://bugs.webkit.org/show_bug.cgi?id=171780
851
852         Rolling back https://trac.webkit.org/r216294, https://trac.webkit.org/r216296,
853         https://trac.webkit.org/216299, https://trac.webkit.org/216330
854
855         * page/FrameView.cpp:
856         (WebCore::FrameView::paintContents):
857         * page/FrameView.h:
858         * platform/ScrollView.cpp:
859         (WebCore::ScrollView::paint):
860         * platform/ScrollView.h:
861         * platform/Scrollbar.cpp:
862         (WebCore::Scrollbar::paint):
863         * platform/Scrollbar.h:
864         * platform/Widget.h:
865         * platform/graphics/filters/FilterOperation.h:
866         (WebCore::FilterOperation::movesPixels):
867         (WebCore::FilterOperation::shouldBeRestrictedBySecurityOrigin): Deleted.
868         * platform/graphics/filters/FilterOperations.cpp:
869         (WebCore::FilterOperations::hasFilterThatShouldBeRestrictedBySecurityOrigin): Deleted.
870         * platform/graphics/filters/FilterOperations.h:
871         * platform/gtk/WidgetGtk.cpp:
872         (WebCore::Widget::paint):
873         * platform/ios/WidgetIOS.mm:
874         (WebCore::Widget::paint):
875         * platform/mac/WidgetMac.mm:
876         (WebCore::Widget::paint):
877         * platform/win/WidgetWin.cpp:
878         (WebCore::Widget::paint):
879         * rendering/FilterEffectRenderer.cpp:
880         (WebCore::FilterEffectRenderer::build):
881         * rendering/FilterEffectRenderer.h:
882         * rendering/PaintInfo.h:
883         (WebCore::PaintInfo::PaintInfo):
884         (): Deleted.
885         * rendering/RenderLayer.cpp:
886         (WebCore::RenderLayer::paint):
887         (WebCore::RenderLayer::setupFilters):
888         (WebCore::RenderLayer::paintForegroundForFragmentsWithPhase):
889         * rendering/RenderLayer.h:
890         * rendering/RenderScrollbar.cpp:
891         (WebCore::RenderScrollbar::paint):
892         * rendering/RenderScrollbar.h:
893         * rendering/RenderWidget.cpp:
894         (WebCore::RenderWidget::paintContents):
895
896 2017-05-06  Chris Dumez  <cdumez@apple.com>
897
898         Unreviewed, rolling out r216333.
899
900         Caused layout test failures
901
902         Reverted changeset:
903
904         "Implement the concept of cookie-averse document"
905         https://bugs.webkit.org/show_bug.cgi?id=171746
906         http://trac.webkit.org/changeset/216333
907
908 2017-05-06  Chris Dumez  <cdumez@apple.com>
909
910         Implement the concept of cookie-averse document
911         https://bugs.webkit.org/show_bug.cgi?id=171746
912         <rdar://problem/32004466>
913
914         Reviewed by Sam Weinig.
915
916         Implement the concept of cookie-averse document:
917         - https://html.spec.whatwg.org/#cookie-averse-document-object
918
919         Test: fast/cookies/cookie-averse-document.html
920
921         * dom/Document.cpp:
922         (WebCore::Document::isCookieAverse):
923         (WebCore::Document::cookie):
924         (WebCore::Document::setCookie):
925         * dom/Document.h:
926
927 2017-05-06  Myles C. Maxfield  <mmaxfield@apple.com>
928
929         REGERSSION(r213499): Emoji with Fitzpatrick modifiers are drawn as two separate glyphs
930         https://bugs.webkit.org/show_bug.cgi?id=171750
931         <rdar://problem/31122612>
932
933         Reviewed by Zalan Bujtas.
934
935         Emoji with Fitzpatrick modifiers need to take our complex text codepath. When looking through
936         the string to determine which code path to use, we ask if a particular codepoint is an emoji
937         group candidate. r213499 expanded the set of these candidates to include Fitzpatrick modifiers,
938         which means the next "if" statement would never be hit. Instead, we should check that "if"
939         statement first (because order is not important here). The next checks do not intersect with
940         any emoji group candidates.
941
942         Test: fast/text/fitzpatrick-combination.html
943
944         * platform/graphics/FontCascade.cpp:
945         (WebCore::FontCascade::characterRangeCodePath):
946
947 2017-05-06  Youenn Fablet  <youenn@apple.com>
948
949         RealtimeMediaSourceCenter callbacks should be passed as r-values
950         https://bugs.webkit.org/show_bug.cgi?id=171407
951
952         Reviewed by Eric Carlson.
953
954         No change of behavior, this is mostly style here.
955
956         * platform/mediastream/RealtimeMediaSourceCenter.h:
957         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp:
958         (WebCore::RealtimeMediaSourceCenterMac::validateRequestConstraints):
959         (WebCore::RealtimeMediaSourceCenterMac::createMediaStream):
960         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.h:
961         * platform/mediastream/openwebrtc/RealtimeMediaSourceCenterOwr.cpp:
962         (WebCore::RealtimeMediaSourceCenterOwr::validateRequestConstraints):
963         * platform/mediastream/openwebrtc/RealtimeMediaSourceCenterOwr.h:
964         * platform/mock/MockRealtimeMediaSourceCenter.cpp:
965         (WebCore::MockRealtimeMediaSourceCenter::validateRequestConstraints):
966         (WebCore::MockRealtimeMediaSourceCenter::createMediaStream):
967         * platform/mock/MockRealtimeMediaSourceCenter.h:
968
969 2017-05-05  Zalan Bujtas  <zalan@apple.com>
970
971         Renderers being destroyed should not be added to AX's deferred list.
972         https://bugs.webkit.org/show_bug.cgi?id=171768
973         <rdar://problem/31955660>
974
975         Reviewed by Simon Fraser.
976
977         In certain cases, when custom scrollbars are present, while destroying the scrollbars' block parent, we
978           - first remove the block from the AX's deferred list (AXObjectCache::remove)
979           - destroy the render layer that owns the custom scrollbars (RenderLayer::destroyLayer) 
980           - detach the scrollbars from the parent (block) (RenderObject::removeFromParent)
981             - clean up the block's lines (RenderBlock::deleteLines)
982               - push the block back to the AX's deferred list (AXObjectCache::recomputeDeferredIsIgnored)
983         At this point no one will remove the current block from AX's deferred list.
984
985         Test: accessibility/crash-when-renderers-are-added-back-to-deferred-list.html
986
987         * accessibility/AXObjectCache.cpp:
988         (WebCore::AXObjectCache::recomputeDeferredIsIgnored):
989         (WebCore::AXObjectCache::deferTextChanged):
990
991 2017-05-05  Said Abou-Hallawa  <sabouhallawa@apple.com>
992
993         Crash in ImageFrameCache::decodedSizeChanged() after image load cancellation
994         https://bugs.webkit.org/show_bug.cgi?id=171736
995
996         Reviewed by Tim Horton.
997
998         Tests: Covered by run-webkit-tests fast/images/image-formats-support.html
999         --guard-malloc.
1000
1001         Because an image format is not supported, the ImageObserver of the Image
1002         is deleted then the Image itself is deleted. In BitmapImage destructor,
1003         we make a call which ends up accessing the deleted ImageObserver.
1004
1005         To fix this, we need to change the BitImage destructor to avoid calling 
1006         ImageFrameCache::decodedSizeChanged() since it is not really needed.
1007
1008         * platform/graphics/BitmapImage.cpp:
1009         (WebCore::BitmapImage::~BitmapImage):
1010
1011 2017-05-05  Timothy Horton  <timothy_horton@apple.com>
1012
1013         [Mac] Adjust cursor position for dragged link (and stop it from moving based on how fast you are dragging)
1014         https://bugs.webkit.org/show_bug.cgi?id=171764
1015         <rdar://problem/32005865>
1016
1017         Reviewed by Simon Fraser.
1018
1019         * page/DragController.cpp:
1020         (WebCore::DragController::startDrag):
1021         Compute dragImageAnchorPoint only if it is needed.
1022         Don't compute a random unused imageRect.
1023         Factor link drag image offset computation out into DragImage functions
1024         for platforms to override.
1025
1026         Pass dragOrigin (the mouseDown point), not mouseDraggedPoint, to
1027         doSystemDrag, just like all the other drag types. This plus the
1028         WebKit2 change makes the link stable vs. the cursor, instead of
1029         positioned based on how fast you move after the mouse down.
1030
1031         * page/DragController.h:
1032         * page/gtk/DragControllerGtk.cpp:
1033         * page/mac/DragControllerMac.mm:
1034         * page/win/DragControllerWin.cpp:
1035         Move LinkDragBorderInset into DragImage, and share between the non-Mac platforms.
1036
1037         * platform/DragImage.cpp:
1038         (WebCore::dragOffsetForLinkDragImage):
1039         (WebCore::anchorPointForLinkDragImage):
1040         * platform/DragImage.h:
1041         As previously mentioned, move the computation of drag image offset here.
1042
1043         * platform/mac/DragImageMac.mm:
1044         (WebCore::dragOffsetForLinkDragImage):
1045         (WebCore::anchorPointForLinkDragImage):
1046         Put the new drag image to the bottom right of the cursor.
1047
1048 2017-05-05  Dean Jackson  <dino@apple.com>
1049
1050         ...and now the GTK and Windows builds.
1051
1052         * platform/gtk/WidgetGtk.cpp:
1053         (WebCore::Widget::paint):
1054         * platform/win/WidgetWin.cpp:
1055         (WebCore::Widget::paint):
1056
1057 2017-05-05  Brady Eidson  <beidson@apple.com>
1058
1059         API test WebKit2.WebsiteDataStoreCustomPaths is failing on ios-simulator.
1060         <rdar://problem/31977294> and https://bugs.webkit.org/show_bug.cgi?id=171513
1061
1062         Reviewed by Andy Estes.
1063
1064         Covered by API test.
1065
1066         * platform/spi/cf/CFNetworkSPI.h:
1067
1068 2017-05-05  Dean Jackson  <dino@apple.com>
1069
1070         Try to fix iOS build.
1071
1072         * platform/ios/WidgetIOS.mm:
1073         (WebCore::Widget::paint):
1074
1075 2017-05-05  Dean Jackson  <dino@apple.com>
1076
1077         Restrict SVG filters to accessible security origins
1078         https://bugs.webkit.org/show_bug.cgi?id=118689
1079         <rdar://problem/27362159>
1080
1081         Reviewed by Brent Fulgham.
1082
1083         Certain SVG filters should only be allowed to operate
1084         on content that is has SecurityOrigin access to. Implement
1085         this by including a flag in PaintInfo and LayerPaintingInfo,
1086         and have RenderWidget make sure the documents have acceptable
1087         SecurityOrigins as it goes to paint.
1088
1089         This could be used as the first step in a "safe painting"
1090         strategy, allowing some content to be rendered into a 
1091         canvas or via the element() CSS function... but it is only
1092         a small first step.
1093
1094         Test: http/tests/css/filters-on-iframes.html
1095
1096         * page/FrameView.cpp:
1097         (WebCore::FrameView::paintContents):
1098         * page/FrameView.h:
1099         * platform/ScrollView.cpp:
1100         (WebCore::ScrollView::paint):
1101         * platform/ScrollView.h:
1102         * platform/Scrollbar.cpp:
1103         (WebCore::Scrollbar::paint):
1104         * platform/Scrollbar.h:
1105         * platform/Widget.h:
1106         * platform/graphics/filters/FilterOperation.h:
1107         (WebCore::FilterOperation::shouldBeRestrictedBySecurityOrigin):
1108         * platform/graphics/filters/FilterOperations.cpp:
1109         (WebCore::FilterOperations::hasFilterThatShouldBeRestrictedBySecurityOrigin):
1110         * platform/graphics/filters/FilterOperations.h:
1111         * platform/mac/WidgetMac.mm:
1112         (WebCore::Widget::paint):
1113         * rendering/FilterEffectRenderer.cpp:
1114         (WebCore::FilterEffectRenderer::build):
1115         * rendering/FilterEffectRenderer.h:
1116         * rendering/PaintInfo.h:
1117         (WebCore::PaintInfo::PaintInfo):
1118         * rendering/RenderLayer.cpp:
1119         (WebCore::RenderLayer::paint):
1120         (WebCore::RenderLayer::setupFilters):
1121         (WebCore::RenderLayer::paintForegroundForFragmentsWithPhase):
1122         * rendering/RenderLayer.h:
1123         * rendering/RenderScrollbar.cpp:
1124         (WebCore::RenderScrollbar::paint):
1125         * rendering/RenderScrollbar.h:
1126         * rendering/RenderWidget.cpp:
1127         (WebCore::RenderWidget::paintContents):
1128
1129 2017-05-05  Ryan Haddad  <ryanhaddad@apple.com>
1130
1131         Unreviewed, rolling out r216273.
1132
1133         This change caused an assertion failure on WK1.
1134
1135         Reverted changeset:
1136
1137         "Crash in ImageFrameCache::decodedSizeChanged() after image
1138         load cancellation"
1139         https://bugs.webkit.org/show_bug.cgi?id=171736
1140         http://trac.webkit.org/changeset/216273
1141
1142 2017-05-05  Brian Burg  <bburg@apple.com>
1143
1144         [Cocoa] Converting from WebCore::Cookie to NSHTTPCookie always marks cookies as session cookies
1145         https://bugs.webkit.org/show_bug.cgi?id=171748
1146         <rdar://problem/32027327>
1147
1148         Reviewed by Michael Catanzaro.
1149
1150         The function that we use to convert from WebCore::Cookie to NSHTTPCookie was
1151         also misusing the NSHTTPCookieDiscard property. If any value is provided for
1152         this key, even @NO, CFNetwork interprets that to mean that the cookie has the
1153         "session" flag.
1154
1155         This is known to affect cookies set via WebCookieManager, WKHTTPCookieStore,
1156         and WebAutomationSession.
1157
1158         This is covered by existing test WebKit2.WKHTTPCookieStore.
1159
1160         * platform/network/cocoa/CookieCocoa.mm:
1161         (WebCore::Cookie::operator NSHTTPCookie *):
1162         Don't include the property if the cookie is not a session cookie.
1163
1164 2017-05-05  Youenn Fablet  <youenn@apple.com>
1165
1166         TURNS gathering is not working properly
1167         https://bugs.webkit.org/show_bug.cgi?id=171747
1168
1169         Reviewed by Eric Carlson.
1170
1171         Did manual testing on real TURNS servers.
1172
1173         * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:
1174         (WebCore::configurationFromMediaEndpointConfiguration): Disabling TURNS servers gathering.
1175
1176 2017-05-05  Ryan Haddad  <ryanhaddad@apple.com>
1177
1178         Unreviewed, rolling out r216275.
1179
1180         This change broke internal builds.
1181
1182         Reverted changeset:
1183
1184         "[Cocoa] CTFontDescriptorCreateMatchingFontDescriptor() is not
1185         case insensitive"
1186         https://bugs.webkit.org/show_bug.cgi?id=171636
1187         http://trac.webkit.org/changeset/216275
1188
1189 2017-05-05  Myles C. Maxfield  <mmaxfield@apple.com>
1190
1191         [Cocoa] CTFontDescriptorCreateMatchingFontDescriptor() is not case insensitive
1192         https://bugs.webkit.org/show_bug.cgi?id=171636
1193         <rdar://problem/30811218>
1194
1195         Reviewed by Dean Jackson.
1196
1197         LastResort is the only name which needs to be looked up case-sensitively. We can handle
1198         this in our existing function which handles special font names (like -apple-system) to
1199         make sure that we always do the right thing.
1200
1201         Test: fast/text/lastResort.html
1202
1203         * platform/spi/cocoa/CoreTextSPI.h:
1204         * platform/graphics/ios/FontCacheIOS.mm:
1205         (WebCore::platformFontWithFamilySpecialCase):
1206         * platform/graphics/mac/FontCacheMac.mm:
1207         (WebCore::platformFontWithFamilySpecialCase):
1208
1209 2017-05-05  Said Abou-Hallawa  <sabouhallawa@apple.com>
1210
1211         Crash in ImageFrameCache::decodedSizeChanged() after image load cancellation
1212         https://bugs.webkit.org/show_bug.cgi?id=171736
1213
1214         Reviewed by Tim Horton.
1215
1216         Tests: Covered by run-webkit-tests fast/images/image-formats-support.html
1217         --guard-malloc.
1218
1219         Because an image format is not supported, the ImageObserver of the Image
1220         is deleted then the Image itself is deleted. In BitmapImage destructor,
1221         we make a call which ends up accessing the deleted ImageObserver.
1222
1223         To fix this, we need to setImageObsever of the Image to-be-deleted to 
1224         nullptr. So the Image can avoid accessing its ImageObserver, while it is
1225         being deleted. Also we can change the BitImage destructor to avoid calling 
1226         ImageFrameCache::decodedSizeChanged() since it is not really needed.
1227
1228         * loader/cache/CachedImage.cpp:
1229         (WebCore::CachedImage::clearImage):
1230         * platform/graphics/BitmapImage.cpp:
1231         (WebCore::BitmapImage::~BitmapImage):
1232
1233 2017-05-05  Brian Burg  <bburg@apple.com>
1234
1235         CrashTracer: [USER] com.apple.WebKit.WebContent.Development at com.apple.WebCore: WebCore::commonVMSlow + 57
1236         https://bugs.webkit.org/show_bug.cgi?id=171669
1237         <rdar://problem/31967684>
1238
1239         Reviewed by Mark Lam.
1240
1241         * bindings/js/CommonVM.h:
1242         (WebCore::commonVMOrNull):
1243         Add an inline accessor function to expose the global variable.
1244
1245 2017-05-05  Filip Pizlo  <fpizlo@apple.com>
1246
1247         GCController.cpp's collect() should be Async
1248         https://bugs.webkit.org/show_bug.cgi?id=171708
1249
1250         Reviewed by Saam Barati.
1251
1252         No new tests because no change in behavior.
1253         
1254         This is one step towards not requesting sync GCs in WebCore. I'm landing this incrementally to
1255         make bisecting super easy.
1256
1257         * bindings/js/GCController.cpp:
1258         (WebCore::collect):
1259
1260 2017-05-05  Chris Dumez  <cdumez@apple.com>
1261
1262         Attr Nodes should not have children
1263         https://bugs.webkit.org/show_bug.cgi?id=171688
1264         <rdar://problem/31998412>
1265
1266         Reviewed by Andreas Kling.
1267
1268         Attr Nodes should not have children as per the latest DOM specification:
1269         - https://dom.spec.whatwg.org/#interface-attr
1270         - https://dom.spec.whatwg.org/#dom-attr-value
1271         - https://dom.spec.whatwg.org/#concept-node-ensure-pre-insertion-validity (Step 1)
1272
1273         Firefox and Chrome both have been matching the DOM specification for a while so I think
1274         we should do the same. This aligns us with other browsers, simplifies the code, is
1275         more efficient and the code being removed has been prone to security bugs.
1276
1277         Test: fast/dom/Attr/cannot-have-children.html
1278
1279         * dom/Attr.cpp:
1280         (WebCore::Attr::Attr):
1281         (WebCore::Attr::create):
1282         (WebCore::Attr::setValue):
1283         (WebCore::Attr::cloneNodeInternal):
1284         * dom/Attr.h:
1285         - Have Attr subclass Node instead of ContainerNode as it can no longer have children.
1286         - Drop logic to dealing with children / creating a Text child.
1287
1288         * dom/CharacterData.cpp:
1289         (WebCore::CharacterData::notifyParentAfterChange):
1290         Drop useless check found by the compiler. parentNode() can no longer be an Attr node.
1291
1292         * dom/Node.cpp:
1293         (WebCore::appendTextContent):
1294         appendTextContent() is called by Node.TextContent(). For Attr Nodes, we should no longer traverse
1295         its subtree to gather Text Nodes. Instead, we now return Attr.value, as per the specification:
1296         - https://dom.spec.whatwg.org/#dom-node-textcontent
1297
1298         * dom/Range.cpp:
1299         (WebCore::lengthOfContentsInNode):
1300         As per https://dom.spec.whatwg.org/#concept-node-length, we should return the number of children
1301         for Attr Nodes, which will always be 0.
1302
1303         * xml/XPathUtil.cpp:
1304         (WebCore::XPath::isValidContextNode):
1305         Always return true for TEXT_NODE as the !(node->parentNode() && node->parentNode()->isAttributeNode())
1306         check will also with true now. This is because a parentNode() cannot be an Attribute Node.
1307
1308 2017-05-05  Brian Burg  <bburg@apple.com>
1309
1310         [Cocoa] Converting from WebCore::Cookie to NSHTTPCookie always marks cookies as secure
1311         https://bugs.webkit.org/show_bug.cgi?id=171700
1312         <rdar://problem/32017975>
1313
1314         Reviewed by Brady Eidson.
1315
1316         The function that we use to convert from WebCore::Cookie to NSHTTPCookie was
1317         misusing the NSHTTPCookieSecure property. If any value is provided for this key,
1318         even @NO, CFNetwork interprets that to mean that the cookie has the "secure" flag.
1319         Thus, in some cases we would store an "insecure" cookie on a site that uses the
1320         http:// protocol, and be unable to later retrieve the cookie. This is known to
1321         affect cookies set via WebCookieManager, WKHTTPCookieStore, and WebAutomationSession.
1322
1323         This is covered by existing test WebKit2.WKHTTPCookieStore.
1324         The test had a bug that masked this problem.
1325
1326         * platform/network/cocoa/CookieCocoa.mm:
1327         (WebCore::Cookie::operator NSHTTPCookie *):
1328         Don't include the property if the cookie is not secure.
1329
1330 2017-05-05  Wenson Hsieh  <wenson_hsieh@apple.com>
1331
1332         Add SPI to WebItemProviderPasteboard to synchronously load data with a given timeout
1333         https://bugs.webkit.org/show_bug.cgi?id=171725
1334         <rdar://problem/32014052>
1335
1336         Reviewed by Beth Dakin.
1337
1338         Adds a synchronousTimeout: argument to doAfterLoadingProvidedContentIntoFileURLs:. If a positive timeout
1339         interval is specified by the client, then we will block the main thread for at most that amount of time after
1340         beginning to load from the item providers.
1341
1342         To do this, we introduce another `dispatch_group_t` in parallel to the `fileLoadingGroup` that is entered and
1343         left in the same places. However, instead of attaching a handler block, we simply perform a synchronous wait for
1344         either the time limit to be reached, or the item providers to finish loading.
1345
1346         No new tests -- no change in behavior yet.
1347
1348         * platform/ios/WebItemProviderPasteboard.h:
1349         * platform/ios/WebItemProviderPasteboard.mm:
1350         (-[WebItemProviderPasteboard doAfterLoadingProvidedContentIntoFileURLs:]):
1351         (-[WebItemProviderPasteboard doAfterLoadingProvidedContentIntoFileURLs:synchronousTimeout:]):
1352
1353 2017-05-05  Chris Dumez  <cdumez@apple.com>
1354
1355         Clean up Attr.idl
1356         https://bugs.webkit.org/show_bug.cgi?id=171691
1357
1358         Reviewed by Andreas Kling.
1359
1360         Clean up Attr.idl to match the spec:
1361         - https://dom.spec.whatwg.org/#interface-attr
1362
1363         No Web-facing behavior change except for Attr properties being enumerated
1364         in a slightly different order.
1365
1366         * dom/Attr.idl:
1367
1368 2017-05-05  Antti Koivisto  <antti@apple.com>
1369
1370         ASSERTION FAILED: !frame().document()->inRenderTreeUpdate() in WebCore::FrameView::layout(bool)
1371         https://bugs.webkit.org/show_bug.cgi?id=171717
1372
1373         Reviewed by Brent Fulgham.
1374
1375         * loader/FrameLoader.cpp:
1376         (WebCore::FrameLoader::checkCompleted):
1377
1378             Don't allow frame load to complete in the middle of a render tree update. Instead delay the check.
1379
1380 2017-05-05  Chris Dumez  <cdumez@apple.com>
1381
1382         Refactor / Clean up Element.idl
1383         https://bugs.webkit.org/show_bug.cgi?id=171734
1384
1385         Reviewed by Sam Weinig.
1386
1387         Refactor / Clean up Element.idl to match the latest specification:
1388         - https://dom.spec.whatwg.org/#interface-element
1389
1390         There is no Web-facing behavior change in this patch besides the Element properties
1391         being enumerated in a slightly different order. Things that do not match the
1392         specification have merely been annotated with FIXME comments for now. This makes
1393         it much more obvious what's standard, what's not and what needs fixing.
1394
1395         * dom/Element.idl:
1396
1397 2017-05-05  Tim Horton  <timothy_horton@apple.com>
1398
1399         Link drag images for apple.com front page links have a lot of spurious whitespace
1400         https://bugs.webkit.org/show_bug.cgi?id=171719
1401         <rdar://problem/32010854>
1402
1403         Reviewed by Wenson Hsieh.
1404
1405         * page/DragController.cpp:
1406         (WebCore::DragController::startDrag):
1407         Use the white-space-simplified string that we put on the pasteboard
1408         for the drag image, too!
1409
1410 2017-05-04  Mark Lam  <mark.lam@apple.com>
1411
1412         DRT's setAudioResultCallback() and IDBRequest::setResult() need to acquire the JSLock.
1413         https://bugs.webkit.org/show_bug.cgi?id=171716
1414         <rdar://problem/30878027>
1415
1416         Reviewed by Saam Barati.
1417
1418         No new tests.  This issue was caught by existing tests.
1419
1420         IDBRequest::setResult() needs to acquire the JSLock before calling toJS() (which
1421         does JS conversion and therefore, potentially JS allocations).
1422
1423         * Modules/indexeddb/IDBRequest.cpp:
1424         (WebCore::IDBRequest::setResult):
1425         (WebCore::IDBRequest::setResultToStructuredClone):
1426
1427 2017-05-05  Carlos Garcia Campos  <cgarcia@igalia.com>
1428
1429         [GStreamer] Do not report more errors after the first one
1430         https://bugs.webkit.org/show_bug.cgi?id=171722
1431
1432         Reviewed by Xabier Rodriguez-Calvar.
1433
1434         We can receive several error messages for the same error from different elements. That's not expected by the
1435         media source selection algorithm implementation. I don't know if didn't happen with previous versions of GST,
1436         but since the upgrade to 1.10.4 several tests are failing because of this.
1437
1438         Fixes: media/video-error-does-not-exist.html
1439                media/video-load-networkState.html
1440                media/video-source-error.html
1441                media/video-source-none-supported.html
1442                media/video-source-moved.html
1443
1444         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
1445         (WebCore::MediaPlayerPrivateGStreamer::handleMessage): Return early also when an error already occured.
1446
1447 2017-05-05  Carlos Garcia Campos  <cgarcia@igalia.com>
1448
1449         [GStreamer] Fix handling of gst errors in MediaPlayerPrivateGStreamer::handleMessage
1450         https://bugs.webkit.org/show_bug.cgi?id=171721
1451
1452         Reviewed by Xabier Rodriguez-Calvar.
1453
1454         We are checking the GError only comparing the code, and ignoring the domain in some cases. Use g_error_matches()
1455         in those cases instead of only checking the code.
1456
1457         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
1458         (WebCore::MediaPlayerPrivateGStreamer::handleMessage):
1459
1460 2017-05-04  Commit Queue  <commit-queue@webkit.org>
1461
1462         Unreviewed, rolling out r216206.
1463         https://bugs.webkit.org/show_bug.cgi?id=171714
1464
1465         Multiple LayoutTests crashing in Document::page() (Requested
1466         by ap on #webkit).
1467
1468         Reverted changeset:
1469
1470         "Remove support for legacy Notifications"
1471         https://bugs.webkit.org/show_bug.cgi?id=171487
1472         http://trac.webkit.org/changeset/216206
1473
1474 2017-05-04  Chris Dumez  <cdumez@apple.com>
1475
1476         Drop remaining uses of PassRefPtr from CompositeEditCommand
1477         https://bugs.webkit.org/show_bug.cgi?id=171645
1478
1479         Reviewed by Darin Adler.
1480
1481         Drop remaining uses of PassRefPtr from CompositeEditCommand.
1482
1483         * editing/ApplyBlockElementCommand.cpp:
1484         (WebCore::ApplyBlockElementCommand::rangeForParagraphSplittingTextNodesIfNeeded):
1485         (WebCore::ApplyBlockElementCommand::endOfNextParagraphSplittingTextNodesIfNeeded):
1486         * editing/ApplyStyleCommand.cpp:
1487         (WebCore::ApplyStyleCommand::applyRelativeFontStyleChange):
1488         (WebCore::ApplyStyleCommand::cleanupUnstyledAppleStyleSpans):
1489         (WebCore::ApplyStyleCommand::splitAncestorsWithUnicodeBidi):
1490         (WebCore::ApplyStyleCommand::removeEmbeddingUpToEnclosingBlock):
1491         (WebCore::ApplyStyleCommand::applyInlineStyleToNodeRange):
1492         (WebCore::ApplyStyleCommand::removeInlineStyleFromElement):
1493         (WebCore::ApplyStyleCommand::replaceWithSpanOrRemoveIfWithoutAttributes):
1494         (WebCore::ApplyStyleCommand::removeImplicitlyStyledElement):
1495         (WebCore::ApplyStyleCommand::removeCSSStyle):
1496         (WebCore::ApplyStyleCommand::applyInlineStyleToPushDown):
1497         (WebCore::ApplyStyleCommand::splitTextAtStart):
1498         (WebCore::ApplyStyleCommand::splitTextAtEnd):
1499         (WebCore::ApplyStyleCommand::splitTextElementAtStart):
1500         (WebCore::ApplyStyleCommand::splitTextElementAtEnd):
1501         (WebCore::ApplyStyleCommand::surroundNodeRangeWithElement):
1502         (WebCore::ApplyStyleCommand::addBlockStyle):
1503         (WebCore::ApplyStyleCommand::addInlineStyleIfNeeded):
1504         (WebCore::ApplyStyleCommand::applyInlineStyleChange):
1505         (WebCore::ApplyStyleCommand::joinChildTextNodes):
1506         * editing/BreakBlockquoteCommand.cpp:
1507         (WebCore::BreakBlockquoteCommand::doApply):
1508         * editing/CompositeEditCommand.cpp:
1509         (WebCore::applyCommand):
1510         (WebCore::CompositeEditCommand::insertNodeAt):
1511         (WebCore::CompositeEditCommand::removeChildrenInRange):
1512         (WebCore::CompositeEditCommand::removeNode):
1513         (WebCore::CompositeEditCommand::removeNodePreservingChildren):
1514         (WebCore::CompositeEditCommand::removeNodeAndPruneAncestors):
1515         (WebCore::CompositeEditCommand::moveRemainingSiblingsToNewParent):
1516         (WebCore::CompositeEditCommand::replaceElementWithSpanPreservingChildrenAndAttributes):
1517         (WebCore::CompositeEditCommand::prune):
1518         (WebCore::CompositeEditCommand::splitTextNode):
1519         (WebCore::CompositeEditCommand::splitElement):
1520         (WebCore::CompositeEditCommand::mergeIdenticalElements):
1521         (WebCore::CompositeEditCommand::splitTextNodeContainingElement):
1522         (WebCore::CompositeEditCommand::positionOutsideTabSpan):
1523         (WebCore::CompositeEditCommand::removeNodeAttribute):
1524         (WebCore::CompositeEditCommand::setNodeAttribute):
1525         (WebCore::CompositeEditCommand::deleteInsignificantText):
1526         (WebCore::CompositeEditCommand::removePlaceholderAt):
1527         (WebCore::CompositeEditCommand::moveParagraphContentsToNewBlockIfNecessary):
1528         (WebCore::CompositeEditCommand::pushAnchorElementDown):
1529         (WebCore::CompositeEditCommand::cleanupAfterDeletion):
1530         (WebCore::CompositeEditCommand::moveParagraphs):
1531         * editing/CompositeEditCommand.h:
1532         * editing/DeleteSelectionCommand.cpp:
1533         (WebCore::DeleteSelectionCommand::handleSpecialCaseBRDelete):
1534         (WebCore::DeleteSelectionCommand::removeNodeUpdatingStates):
1535         (WebCore::DeleteSelectionCommand::removeNode):
1536         (WebCore::DeleteSelectionCommand::makeStylingElementsDirectChildrenOfEditableRootToPreventStyleLoss):
1537         (WebCore::DeleteSelectionCommand::handleGeneralDelete):
1538         (WebCore::DeleteSelectionCommand::mergeParagraphs):
1539         (WebCore::DeleteSelectionCommand::removePreviouslySelectedEmptyTableRows):
1540         (WebCore::DeleteSelectionCommand::removeRedundantBlocks):
1541         * editing/DeleteSelectionCommand.h:
1542         * editing/Editor.cpp:
1543         (WebCore::ClearTextCommand::CreateAndApply):
1544         (WebCore::Editor::replaceSelectionWithFragment):
1545         (WebCore::Editor::handleAcceptedCandidate):
1546         * editing/EditorCommand.cpp:
1547         (WebCore::executeFormatBlock):
1548         * editing/IndentOutdentCommand.cpp:
1549         (WebCore::IndentOutdentCommand::outdentParagraph):
1550         * editing/InsertLineBreakCommand.cpp:
1551         (WebCore::InsertLineBreakCommand::doApply):
1552         * editing/InsertListCommand.cpp:
1553         (WebCore::InsertListCommand::fixOrphanedListChild):
1554         (WebCore::InsertListCommand::doApplyForSingleParagraph):
1555         (WebCore::InsertListCommand::unlistifyParagraph):
1556         * editing/InsertParagraphSeparatorCommand.cpp:
1557         (WebCore::InsertParagraphSeparatorCommand::doApply):
1558         * editing/InsertTextCommand.cpp:
1559         (WebCore::InsertTextCommand::insertTab):
1560         * editing/ModifySelectionListLevel.cpp:
1561         (WebCore::ModifySelectionListLevelCommand::insertSiblingNodeRangeBefore):
1562         (WebCore::ModifySelectionListLevelCommand::insertSiblingNodeRangeAfter):
1563         (WebCore::ModifySelectionListLevelCommand::appendSiblingNodeRange):
1564         (WebCore::DecreaseSelectionListLevelCommand::doApply):
1565         * editing/RemoveNodePreservingChildrenCommand.cpp:
1566         (WebCore::RemoveNodePreservingChildrenCommand::RemoveNodePreservingChildrenCommand):
1567         (WebCore::RemoveNodePreservingChildrenCommand::doApply):
1568         * editing/RemoveNodePreservingChildrenCommand.h:
1569         (WebCore::RemoveNodePreservingChildrenCommand::create):
1570         * editing/ReplaceNodeWithSpanCommand.cpp:
1571         (WebCore::ReplaceNodeWithSpanCommand::ReplaceNodeWithSpanCommand):
1572         (WebCore::ReplaceNodeWithSpanCommand::doApply):
1573         (WebCore::ReplaceNodeWithSpanCommand::doUnapply):
1574         (WebCore::ReplaceNodeWithSpanCommand::getNodesInCommand):
1575         * editing/ReplaceNodeWithSpanCommand.h:
1576         (WebCore::ReplaceNodeWithSpanCommand::create):
1577         * editing/ReplaceSelectionCommand.cpp:
1578         (WebCore::ReplacementFragment::removeNodePreservingChildren):
1579         (WebCore::ReplacementFragment::removeInterchangeNodes):
1580         (WebCore::ReplaceSelectionCommand::removeRedundantStylesAndKeepStyleSpanInline):
1581         (WebCore::ReplaceSelectionCommand::makeInsertedContentRoundTrippableWithHTMLTreeBuilder):
1582         (WebCore::ReplaceSelectionCommand::moveNodeOutOfAncestor):
1583         (WebCore::ReplaceSelectionCommand::removeUnrenderedTextNodesAtEnds):
1584         (WebCore::handleStyleSpansBeforeInsertion):
1585         (WebCore::ReplaceSelectionCommand::handleStyleSpans):
1586         (WebCore::ReplaceSelectionCommand::doApply):
1587         (WebCore::ReplaceSelectionCommand::mergeTextNodesAroundPosition):
1588         (WebCore::ReplaceSelectionCommand::insertAsListItems):
1589         (WebCore::ReplaceSelectionCommand::performTrivialReplace):
1590         * editing/SetNodeAttributeCommand.cpp:
1591         (WebCore::SetNodeAttributeCommand::SetNodeAttributeCommand):
1592         (WebCore::SetNodeAttributeCommand::getNodesInCommand):
1593         * editing/SetNodeAttributeCommand.h:
1594         (WebCore::SetNodeAttributeCommand::create):
1595         * editing/SimplifyMarkupCommand.cpp:
1596         (WebCore::SimplifyMarkupCommand::doApply):
1597         (WebCore::SimplifyMarkupCommand::pruneSubsequentAncestorsToRemove):
1598         * editing/SimplifyMarkupCommand.h:
1599         * editing/SplitElementCommand.cpp:
1600         (WebCore::SplitElementCommand::SplitElementCommand):
1601         (WebCore::SplitElementCommand::executeApply):
1602         (WebCore::SplitElementCommand::getNodesInCommand):
1603         * editing/SplitElementCommand.h:
1604         (WebCore::SplitElementCommand::create):
1605         * editing/SplitTextNodeCommand.cpp:
1606         (WebCore::SplitTextNodeCommand::SplitTextNodeCommand):
1607         (WebCore::SplitTextNodeCommand::doApply):
1608         (WebCore::SplitTextNodeCommand::doUnapply):
1609         (WebCore::SplitTextNodeCommand::doReapply):
1610         (WebCore::SplitTextNodeCommand::insertText1AndTrimText2):
1611         * editing/SplitTextNodeCommand.h:
1612         (WebCore::SplitTextNodeCommand::create):
1613         * editing/SplitTextNodeContainingElementCommand.cpp:
1614         (WebCore::SplitTextNodeContainingElementCommand::SplitTextNodeContainingElementCommand):
1615         (WebCore::SplitTextNodeContainingElementCommand::doApply):
1616         * editing/SplitTextNodeContainingElementCommand.h:
1617         (WebCore::SplitTextNodeContainingElementCommand::create):
1618         * editing/TextInsertionBaseCommand.cpp:
1619         (WebCore::TextInsertionBaseCommand::applyTextInsertionCommand):
1620         * editing/TypingCommand.cpp:
1621         (WebCore::TypingCommand::makeEditableRootEmpty):
1622         * page/ContextMenuController.cpp:
1623         (WebCore::ContextMenuController::contextMenuItemSelected):
1624
1625 2017-05-04  Daniel Bates  <dabates@apple.com>
1626
1627         Fix misspelled word "interrupt" as pointed out by Darin Adler
1628         in <https://bugs.webkit.org/show_bug.cgi?id=171577>.
1629
1630         * loader/FrameLoader.cpp:
1631         (WebCore::FrameLoader::transitionToCommitted):
1632
1633 2017-05-04  Jeremy Jones  <jeremyj@apple.com>
1634
1635         UIColor +whiteColor and +clearColor are ambiguous and need to be casted when soft linked.
1636         https://bugs.webkit.org/show_bug.cgi?id=171704
1637
1638         Reviewed by Jer Noble.
1639
1640         No new tests because no behavior change.
1641
1642         Fix build by casting result of +clearColor to UIColor.
1643
1644         * platform/ios/WebVideoFullscreenInterfaceAVKit.mm:
1645         (clearUIColor):
1646         (WebVideoFullscreenInterfaceAVKit::setupFullscreen):
1647         (WebVideoFullscreenInterfaceAVKit::exitFullscreen):
1648         (WebVideoFullscreenInterfaceAVKit::didStopPictureInPicture):
1649
1650 2017-05-04  Chris Dumez  <cdumez@apple.com>
1651
1652         Element.slot should be marked as [Unscopable]
1653         https://bugs.webkit.org/show_bug.cgi?id=171683
1654
1655         Reviewed by Darin Adler.
1656
1657         Element.slot should be marked as [Unscopable]:
1658         - https://dom.spec.whatwg.org/#interface-element
1659         - https://heycam.github.io/webidl/#Unscopable
1660
1661         Test: fast/shadow-dom/Element-slot-unscopable.html
1662
1663         * dom/Element.idl:
1664
1665 2017-05-04  Don Olmstead  <don.olmstead@am.sony.com>
1666
1667         [Win] Remove redundant macros that are set in the CMake config
1668         https://bugs.webkit.org/show_bug.cgi?id=171571
1669
1670         Reviewed by Brent Fulgham.
1671
1672         No new tests. No change in behavior.
1673
1674         * WebCorePrefix.h:
1675         * config.h:
1676         * platform/win/COMPtr.h:
1677         * platform/win/WindowsTouch.h:
1678         * testing/js/WebCoreTestSupportPrefix.h:
1679
1680 2017-05-04  Tim Horton  <timothy_horton@apple.com>
1681
1682         [Mac] Modernize image for dragged link
1683         https://bugs.webkit.org/show_bug.cgi?id=171701
1684         <rdar://problem/31978818>
1685
1686         Reviewed by Simon Fraser.
1687
1688         * WebCore.xcodeproj/project.pbxproj:
1689         * page/mac/DragControllerMac.mm:
1690         * platform/mac/DragImageMac.mm:
1691         (WebCore::dragImageSize):
1692         (WebCore::scaleDragImage):
1693         (WebCore::dissolveDragImageToFraction):
1694         (WebCore::createDragImageFromImage):
1695         (WebCore::LinkImageLayout::LinkImageLayout):
1696         (WebCore::LinkImageLayout::layOutText):
1697         (WebCore::LinkImageLayout::addLine):
1698         (WebCore::createDragImageForLink):
1699         (WebCore::fontFromNSFont): Deleted.
1700         (WebCore::canUseFastRenderer): Deleted.
1701         (WebCore::widthWithFont): Deleted.
1702         (WebCore::drawAtPoint): Deleted.
1703         (WebCore::drawDoubledAtPoint): Deleted.
1704         * platform/spi/cocoa/LinkPresentationSPI.h: Added.
1705         Improve the design of URL drag images.
1706         The margins are increased, the background is now white, the text is
1707         not drawn doubled-up, the title will now wrap to two lines, and the
1708         domain name will appear simplified and de-punycoded.
1709
1710         Much of the implementation of text painting is borrowed from
1711         <attachment> for now, but we should figure out how to generalize
1712         it for UI-like parts of WebKit in the future.
1713
1714 2017-05-04  Commit Queue  <commit-queue@webkit.org>
1715
1716         Unreviewed, rolling out r216223.
1717         https://bugs.webkit.org/show_bug.cgi?id=171706
1718
1719         not quite ready (Requested by thorton on #webkit).
1720
1721         Reverted changeset:
1722
1723         "[Mac] Modernize image for dragged link"
1724         https://bugs.webkit.org/show_bug.cgi?id=171701
1725         http://trac.webkit.org/changeset/216223
1726
1727 2017-05-04  Tim Horton  <timothy_horton@apple.com>
1728
1729         [Mac] Modernize image for dragged link
1730         https://bugs.webkit.org/show_bug.cgi?id=171701
1731         <rdar://problem/31978818>
1732
1733         Reviewed by Simon Fraser.
1734
1735         * page/mac/DragControllerMac.mm:
1736         * platform/mac/DragImageMac.mm:
1737         (WebCore::dragImageSize):
1738         (WebCore::scaleDragImage):
1739         (WebCore::dissolveDragImageToFraction):
1740         (WebCore::createDragImageFromImage):
1741         (WebCore::LinkImageLayout::LinkImageLayout):
1742         (WebCore::LinkImageLayout::addLine):
1743         (WebCore::createDragImageForLink):
1744         (WebCore::fontFromNSFont): Deleted.
1745         (WebCore::canUseFastRenderer): Deleted.
1746         (WebCore::widthWithFont): Deleted.
1747         (WebCore::drawAtPoint): Deleted.
1748         (WebCore::drawDoubledAtPoint): Deleted.
1749         Improve the design of URL drag images.
1750         The margins are increased, the background is now white, the text is
1751         not drawn doubled-up, the title will now wrap to two lines, and the
1752         domain name will appear simplified and de-punycoded.
1753
1754         Much of the implementation of text painting is borrowed from
1755         <attachment> for now, but we should figure out how to generalize
1756         it for UI-like parts of WebKit in the future.
1757
1758 2017-05-04  Jeremy Jones  <jeremyj@apple.com>
1759
1760         Use if instead of return early for 13 places in WebAVPlayerController
1761         https://bugs.webkit.org/show_bug.cgi?id=171692
1762
1763         Reviewed by Jer Noble.
1764
1765         No new tests because no behavior change.
1766
1767         * platform/ios/WebAVPlayerController.mm:
1768         (-[WebAVPlayerController play:]):
1769         (-[WebAVPlayerController pause:]):
1770         (-[WebAVPlayerController togglePlayback:]):
1771         (-[WebAVPlayerController beginScrubbing:]):
1772         (-[WebAVPlayerController endScrubbing:]):
1773         (-[WebAVPlayerController seekToTime:]):
1774         (-[WebAVPlayerController beginScanningForward:]):
1775         (-[WebAVPlayerController endScanningForward:]):
1776         (-[WebAVPlayerController beginScanningBackward:]):
1777         (-[WebAVPlayerController endScanningBackward:]):
1778         (-[WebAVPlayerController seekToBeginning:]):
1779         (-[WebAVPlayerController seekToEnd:]):
1780         (-[WebAVPlayerController toggleMuted:]):
1781
1782 2017-05-04  Filip Pizlo  <fpizlo@apple.com>
1783
1784         JSC::Heap should expose a richer API for requesting GCs
1785         https://bugs.webkit.org/show_bug.cgi?id=171690
1786
1787         Reviewed by Geoffrey Garen.
1788
1789         No new tests because this is just a refactoring.
1790         
1791         Change some function calls now that some JSC::Heap APIs got renamed.
1792
1793         * bindings/js/GCController.cpp:
1794         (WebCore::collect):
1795         (WebCore::GCController::garbageCollectNow):
1796         (WebCore::GCController::garbageCollectNowIfNotDoneRecently):
1797
1798 2017-05-04  Mark Lam  <mark.lam@apple.com>
1799
1800         NeverDestroyed<String>(ASCIILiteral(...)) is not thread safe.
1801         https://bugs.webkit.org/show_bug.cgi?id=171586
1802         <rdar://problem/31873190>
1803
1804         Reviewed by Yusuke Suzuki.
1805
1806         No new tests because we're just converting uses of ASCIILiteral (in the
1807         instantiation of NeverDestroyed<String> and NeverDestroyed<const String>) to
1808         MAKE_STATIC_STRING_IMPL.
1809
1810         The correctness of using MAKE_STATIC_STRING_IMPL is tested in the newly added
1811         API test in this patch.
1812
1813         Also changed "static NeverDestroyed<ASCIILiteral>" instances in
1814         SQLiteIDBBackingStore.cpp to "static const char* const" because they are only
1815         ever used to get the underlying const char*.
1816
1817         * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
1818         (WebCore::IDBServer::SQLiteIDBBackingStore::getRecord):
1819         (WebCore::IDBServer::SQLiteIDBBackingStore::cachedStatementForGetAllObjectStoreRecords):
1820         * Modules/mediastream/MediaEndpointSessionDescription.cpp:
1821         * Modules/mediastream/RTCRtpTransceiver.cpp:
1822         * Modules/mediastream/SDPProcessor.cpp:
1823         * Modules/navigatorcontentutils/NavigatorContentUtils.cpp:
1824         (WebCore::customHandlersStateString):
1825         (WebCore::NavigatorContentUtils::isProtocolHandlerRegistered):
1826         * Modules/speech/SpeechSynthesis.cpp:
1827         (WebCore::SpeechSynthesis::boundaryEventOccurred):
1828         * accessibility/AccessibilityMediaControls.cpp:
1829         (WebCore::AccessibilityMediaControl::controlTypeName):
1830         (WebCore::AccessibilityMediaControl::title):
1831         (WebCore::AccessibilityMediaControlsContainer::elementTypeName):
1832         (WebCore::AccessibilityMediaTimeline::helpText):
1833         (WebCore::AccessibilityMediaTimeDisplay::accessibilityDescription):
1834         * bindings/js/JSLazyEventListener.cpp:
1835         (WebCore::eventParameterName):
1836         * contentextensions/ContentExtensionsBackend.cpp:
1837         (WebCore::ContentExtensions::ContentExtensionsBackend::displayNoneCSSRule):
1838         * css/CSSDefaultStyleSheets.cpp:
1839         (WebCore::screenEval):
1840         (WebCore::printEval):
1841         * css/MediaList.cpp:
1842         (WebCore::addResolutionWarningMessageToConsole):
1843         * css/StyleSheetContents.cpp:
1844         (WebCore::StyleSheetContents::parseAuthorStyleSheet):
1845         * dom/Document.cpp:
1846         (WebCore::Document::readyState):
1847         * dom/LoadableClassicScript.cpp:
1848         (WebCore::LoadableClassicScript::notifyFinished):
1849         * dom/PseudoElement.cpp:
1850         (WebCore::PseudoElement::pseudoElementNameForEvents):
1851         * editing/MarkupAccumulator.cpp:
1852         (WebCore::MarkupAccumulator::shouldAddNamespaceElement):
1853         * editing/cocoa/DataDetection.mm:
1854         (WebCore::DataDetection::dataDetectorURLProtocol):
1855         * editing/markup.cpp:
1856         (WebCore::StyledMarkupAccumulator::styleNodeCloseTag):
1857         (WebCore::createMarkupInternal):
1858         * html/FormController.cpp:
1859         (WebCore::formStateSignature):
1860         * html/ImageInputType.cpp:
1861         (WebCore::ImageInputType::appendFormData):
1862         * html/canvas/CanvasRenderingContext2D.cpp:
1863         (WebCore::CanvasRenderingContext2D::realizeSaves):
1864         (WebCore::CanvasRenderingContext2D::getImageData):
1865         * html/parser/XSSAuditor.cpp:
1866         (WebCore::XSSAuditor::init):
1867         (WebCore::XSSAuditor::eraseDangerousAttributesIfInjected):
1868         * html/track/VTTCue.cpp:
1869         (WebCore::startKeyword):
1870         (WebCore::middleKeyword):
1871         (WebCore::endKeyword):
1872         (WebCore::leftKeyword):
1873         (WebCore::rightKeyword):
1874         (WebCore::verticalGrowingLeftKeyword):
1875         (WebCore::verticalGrowingRightKeyword):
1876         (WebCore::VTTCue::determineTextDirection):
1877         (WebCore::VTTCue::markFutureAndPastNodes):
1878         * inspector/InspectorCSSAgent.cpp:
1879         (WebCore::computePseudoClassMask):
1880         * inspector/InspectorIndexedDBAgent.cpp:
1881         * inspector/InspectorPageAgent.cpp:
1882         (WebCore::InspectorPageAgent::sourceMapURLForResource):
1883         * inspector/PageDebuggerAgent.cpp:
1884         (WebCore::PageDebuggerAgent::sourceMapURLForScript):
1885         * loader/ImageLoader.cpp:
1886         (WebCore::ImageLoader::notifyFinished):
1887         * loader/TextTrackLoader.cpp:
1888         (WebCore::TextTrackLoader::corsPolicyPreventedLoad):
1889         * loader/icon/IconDatabase.cpp:
1890         (WebCore::IconDatabase::defaultDatabaseFilename):
1891         * page/CaptionUserPreferencesMediaAF.cpp:
1892         (WebCore::CaptionUserPreferencesMediaAF::captionsTextEdgeCSS):
1893         * page/SecurityOrigin.cpp:
1894         (WebCore::SecurityOrigin::urlWithUniqueSecurityOrigin):
1895         * page/UserContentURLPattern.cpp:
1896         (WebCore::UserContentURLPattern::parse):
1897         * platform/MIMETypeRegistry.cpp:
1898         (WebCore::defaultMIMEType):
1899         * platform/animation/Animation.cpp:
1900         (WebCore::Animation::initialName):
1901         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
1902         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::engineDescription):
1903         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
1904         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::engineDescription):
1905         * platform/graphics/cocoa/FontCacheCoreText.cpp:
1906         (WebCore::FontCache::similarFont):
1907         * platform/gtk/UserAgentGtk.cpp:
1908         (WebCore::platformVersionForUAString):
1909         * platform/mock/mediasource/MockBox.cpp:
1910         (WebCore::MockTrackBox::type):
1911         (WebCore::MockInitializationBox::type):
1912         (WebCore::MockSampleBox::type):
1913         * platform/network/HTTPHeaderValues.cpp:
1914         (WebCore::HTTPHeaderValues::textPlainContentType):
1915         (WebCore::HTTPHeaderValues::formURLEncodedContentType):
1916         (WebCore::HTTPHeaderValues::noCache):
1917         (WebCore::HTTPHeaderValues::maxAge0):
1918         * platform/network/HTTPParsers.cpp:
1919         (WebCore::parseXSSProtectionHeader):
1920         * replay/MemoizedDOMResult.cpp:
1921         (JSC::InputTraits<MemoizedDOMResultBase>::type):
1922         * svg/SVGTransformValue.cpp:
1923         (WebCore::SVGTransformValue::transformTypePrefixForParsing):
1924
1925 2017-05-04  Jeremy Jones  <jeremyj@apple.com>
1926
1927         Add muted to WebPlaybackSessionModel.
1928         https://bugs.webkit.org/show_bug.cgi?id=171592
1929         rdar://problem/31814074
1930
1931         Reviewed by Jer Noble.
1932
1933         No behavior change. This just adds the ability for UI to mute.
1934
1935         * platform/cocoa/WebPlaybackSessionModel.h:
1936         (WebCore::WebPlaybackSessionModelClient::mutedChanged):
1937         * platform/cocoa/WebPlaybackSessionModelMediaElement.h:
1938         * platform/cocoa/WebPlaybackSessionModelMediaElement.mm:
1939         (WebCore::WebPlaybackSessionModelMediaElement::updateForEventName):
1940         (WebCore::WebPlaybackSessionModelMediaElement::toggleMuted):
1941         (WebCore::WebPlaybackSessionModelMediaElement::observedEventNames):
1942         (WebCore::WebPlaybackSessionModelMediaElement::isMuted):
1943         * platform/ios/WebAVPlayerController.h:
1944         * platform/ios/WebAVPlayerController.mm:
1945         (-[WebAVPlayerController toggleMuted:]):
1946         * platform/ios/WebPlaybackSessionInterfaceAVKit.h:
1947         * platform/ios/WebPlaybackSessionInterfaceAVKit.mm:
1948         (WebCore::WebPlaybackSessionInterfaceAVKit::mutedChanged):
1949         * platform/ios/WebVideoFullscreenControllerAVKit.mm:
1950         (WebVideoFullscreenControllerContext::mutedChanged):
1951         (WebVideoFullscreenControllerContext::isMuted):
1952         (WebVideoFullscreenControllerContext::toggleMuted):
1953         * platform/spi/ios/MediaPlayerSPI.h:
1954
1955 2017-05-04  Joseph Pecoraro  <pecoraro@apple.com>
1956
1957         REGRESSION(r216138): Web Inspector: ASSERT(!content.isNull()) when checking for source map url opening inspector
1958         https://bugs.webkit.org/show_bug.cgi?id=171697
1959         <rdar://problem/31999512>
1960
1961         Reviewed by Matt Baker.
1962
1963         * inspector/InspectorPageAgent.cpp:
1964         (WebCore::InspectorPageAgent::cachedResourceContent):
1965         Always set base64Encoded when returning true. Return the empty
1966         string instead of a null string matching previous behavior.
1967
1968 2017-05-04  Wenson Hsieh  <wenson_hsieh@apple.com>
1969
1970         [WK2] Add support for keeping the selection in a focused editable element when dragging begins
1971         https://bugs.webkit.org/show_bug.cgi?id=171585
1972         <rdar://problem/31544320>
1973
1974         Reviewed by Beth Dakin and Zalan Bujtas.
1975
1976         Covered by 4 API tests.
1977
1978         * dom/DocumentMarker.h:
1979
1980         Introduces the DraggedContent DocumentMarker type, which applies to the Range in the DOM that is being used as
1981         a drag source. Also adds DraggedContentData, which contains nodes found by the TextIterator in the process of
1982         finding Ranges to mark.
1983
1984         (WebCore::DocumentMarker::AllMarkers::AllMarkers):
1985         * dom/DocumentMarkerController.cpp:
1986         (WebCore::DocumentMarkerController::addDraggedContentMarker):
1987         (WebCore::shouldInsertAsSeparateMarker):
1988         (WebCore::DocumentMarkerController::addMarker):
1989
1990         When adding DocumentMarkers of type DraggedContent, keep adjacent RenderReplaced elements separate, rather than
1991         merging them into existing RenderedDocumentMarkers. This is because the data for each of these (i.e. the target
1992         node) needs to be preserved.
1993
1994         (WebCore::DocumentMarkerController::markersFor):
1995
1996         Bail and return an empty list if the map of document markers cannot possibly contain a dragged content marker.
1997
1998         * dom/DocumentMarkerController.h:
1999         * page/DragController.h:
2000         * page/DragState.h:
2001
2002         Add draggedContentRange to DragState. This tracks the Range that is being dragged; it is created when the drag
2003         session has begun, and ends when drag session finishes (either via WebPage::dragEnded or WebPage::dragCancelled).
2004
2005         * page/EventHandler.cpp:
2006         (WebCore::repaintContentsOfRange):
2007         (WebCore::EventHandler::dragCancelled):
2008
2009         Called when a drag is cancelled in the UI process without a session ever getting a chance to begin. We use this
2010         as a hook to remove all DraggedContent document markers from the document of the dragged content range.
2011
2012         (WebCore::EventHandler::didStartDrag):
2013
2014         Called when a drag session has begun in the UI process. We use this as a hook to set up document markers for the
2015         Range of content being dragged.
2016
2017         (WebCore::EventHandler::dragSourceEndedAt):
2018
2019         Called when a drag session ends. We use this as a hook to remove all DraggedContent document markers from the
2020         document of the dragged content range.
2021
2022         (WebCore::EventHandler::draggedElement):
2023         * page/EventHandler.h:
2024         * page/FocusController.cpp:
2025         (WebCore::shouldClearSelectionWhenChangingFocusedElement):
2026
2027         Prevent the selection from clearing when the previously focused element is editable and also contains the drag
2028         source element. Ideally, we should experiment with clearing out the selection whenever the element is blurred
2029         (and not have additional restrictions on editability and containing the drag source), but this change is much
2030         riskier.
2031
2032         (WebCore::FocusController::setFocusedElement):
2033         * rendering/InlineTextBox.cpp:
2034         (WebCore::InlineTextBox::paint):
2035
2036         Use RenderText::draggedContentStartEnd to find the range of text (if any) that is dragged content, and paint
2037         these ranges of text at a lower alpha using TextPainter::paintTextInRange.
2038
2039         * rendering/RenderReplaced.cpp:
2040         (WebCore::draggedContentContainsReplacedElement):
2041
2042         Determines whether or not the element being rendered is contained within a dragged content range. Assuming that
2043         the DraggedContent type flag is set in DocumentMarkerController, we first look to see whether or not the
2044         container node is in the document marker map. If so, instead of consulting node offset ranges (since this is, in
2045         the worst-case, linear in the number of sibling nodes per RenderReplaced) we simply check the DraggedContentData
2046         to see if the current element being rendered matches one of the target nodes.
2047
2048         (WebCore::RenderReplaced::paint):
2049
2050         If the element rendered by this RenderReplaced is dragged content, then render it at a low alpha.
2051
2052         * rendering/RenderText.cpp:
2053         (WebCore::RenderText::draggedContentRangesBetweenOffsets):
2054
2055         Determines what range of text, if any, contains dragged content by consulting the Document's DocumentMarkers.
2056
2057         * rendering/RenderText.h:
2058         * rendering/TextPainter.cpp:
2059         (WebCore::TextPainter::paintTextInRange):
2060
2061         Teach TextPainter to only paint a given range in a TextRun.
2062
2063         * rendering/TextPainter.h:
2064
2065         Add TextPainter support for specifying special text offset ranges when rendering a TextRun, such that each
2066         special range in text is rendered after applying some modification to the GraphicsContext.
2067
2068 2017-05-04  Jeremy Jones  <jeremyj@apple.com>
2069
2070         Crash when pointer lock element is removed before pointer lock allowed arrives.
2071         https://bugs.webkit.org/show_bug.cgi?id=171642
2072
2073         Reviewed by Jer Noble.
2074
2075         Make sure there a pending lock before attempting to complete pointer lock.
2076
2077         * page/PointerLockController.cpp:
2078         (WebCore::PointerLockController::didAcquirePointerLock):
2079
2080 2017-05-04  Chris Dumez  <cdumez@apple.com>
2081
2082         Reformat / Clean up Node.idl to match the specification
2083         https://bugs.webkit.org/show_bug.cgi?id=171686
2084
2085         Reviewed by Sam Weinig.
2086
2087         Reformat / Clean up Node.idl to match the specification:
2088         - https://dom.spec.whatwg.org/#node
2089
2090         There should be no Web-facing behavior change, except for Node properties
2091         being enumerated in a slightly different order.
2092
2093         * dom/Node.idl:
2094
2095 2017-05-04  Sam Weinig  <sam@webkit.org>
2096
2097         Remove support for legacy Notifications
2098         https://bugs.webkit.org/show_bug.cgi?id=171487
2099
2100         Reviewed by Jon Lee.
2101
2102         * CMakeLists.txt:
2103         * WebCore.xcodeproj/project.pbxproj:
2104         Remove files.
2105
2106         * Configurations/FeatureDefines.xcconfig:
2107         Remove definition of ENABLE_LEGACY_NOTIFICATIONS.
2108
2109         * DerivedSources.make:
2110         Remove IDL files.
2111
2112         * Modules/notifications/DOMWindowNotifications.cpp: Removed.
2113         * Modules/notifications/DOMWindowNotifications.h: Removed.
2114         * Modules/notifications/DOMWindowNotifications.idl: Removed.
2115         * Modules/notifications/NotificationCenter.cpp: Removed.
2116         * Modules/notifications/NotificationCenter.h: Removed.
2117         * Modules/notifications/NotificationCenter.idl: Removed.
2118         * Modules/notifications/NotificationClient.h:
2119         * Modules/notifications/NotificationController.cpp:
2120         * Modules/notifications/NotificationController.h:
2121         * Modules/notifications/WorkerGlobalScopeNotifications.cpp: Removed.
2122         * Modules/notifications/WorkerGlobalScopeNotifications.h: Removed.
2123         * Modules/notifications/WorkerGlobalScopeNotifications.idl: Removed.
2124         * Modules/notifications/Notification.idl:
2125         * Modules/notifications/Notification.cpp:
2126         * Modules/notifications/Notification.h:
2127         * dom/EventTargetFactory.in:
2128         * page/DOMWindow.cpp:
2129         * workers/WorkerThread.h:
2130         Remove code legacy Notification code. Replace use of NotificationCenter with direct
2131         calls to the NotificationClient.
2132
2133 2017-05-04  Antti Koivisto  <antti@apple.com>
2134
2135         REGRESSION (Safari 10.1): When 'transition' contains -ms-transform, transform-origin is also transitioned
2136         https://bugs.webkit.org/show_bug.cgi?id=171250
2137         <rdar://problem/31827243>
2138
2139         Reviewed by Geoffrey Garen.
2140
2141         We were mapping unknown properties to 'all' animation. With this patch we ignore them instead.
2142         The patch also implements roundtripping of unknown properties via CSSOM, matching Blink and Gecko.
2143
2144         Test: transitions/transition-unknown-property-ignore.html
2145
2146         * css/CSSComputedStyleDeclaration.cpp:
2147         (WebCore::createTransitionPropertyValue):
2148
2149             Return the correct name for unknown properties.
2150
2151         * css/CSSToStyleMap.cpp:
2152         (WebCore::CSSToStyleMap::mapAnimationProperty):
2153
2154             Map any unknown property to AnimateUnknownProperty mode instead of falling back to the default of AnimateAll.
2155             Save the unknown property name so we can roundtrip it properly.
2156
2157         * page/animation/CompositeAnimation.cpp:
2158         (WebCore::CompositeAnimation::updateTransitions):
2159
2160             Ignore AnimateUnknownProperty like AnimateNone.
2161
2162         * platform/animation/Animation.h:
2163         (WebCore::Animation::unknownProperty):
2164         (WebCore::Animation::setUnknownProperty):
2165
2166 2017-05-04  Chris Dumez  <cdumez@apple.com>
2167
2168         Clean up MutationRecord.idl
2169         https://bugs.webkit.org/show_bug.cgi?id=171685
2170
2171         Reviewed by Sam Weinig.
2172
2173         Clean up MutationRecord.idl to match the specification:
2174         - https://dom.spec.whatwg.org/#mutationrecord
2175
2176         There is no Web-facing behavior change.
2177
2178         * dom/MutationRecord.idl:
2179
2180 2017-05-04  Chris Dumez  <cdumez@apple.com>
2181
2182         Reformat / clean up Event.idl
2183         https://bugs.webkit.org/show_bug.cgi?id=171675
2184
2185         Reviewed by Sam Weinig.
2186
2187         Reformat / clean up Event.idl to match the latest spec more closely:
2188         - https://dom.spec.whatwg.org/#interface-event
2189
2190         There is no web-facing behavior change, except for properties being
2191         enumerated in a slightly different order.
2192
2193         * dom/Event.idl:
2194
2195 2017-05-04  Daniel Bates  <dabates@apple.com>
2196
2197         Cleanup: Extract CachedScript::mimeTypeAllowedByNosniff() into a common function
2198         https://bugs.webkit.org/show_bug.cgi?id=171678
2199
2200         Reviewed by Andy Estes.
2201
2202         Extract CachedScript::mimeTypeAllowedByNosniff() into a common function that can
2203         be shared by LoadableClassicScript and WorkerScriptLoader.
2204
2205         No functionality was changed. So, no new tests.
2206
2207         * dom/LoadableClassicScript.cpp:
2208         (WebCore::LoadableClassicScript::notifyFinished): Modified to use WebCore::isScriptAllowedByNosniff().
2209         * loader/cache/CachedScript.cpp:
2210         (WebCore::CachedScript::mimeType): Deleted; incorporated into WebCore::isScriptAllowedByNosniff().
2211         (WebCore::CachedScript::mimeTypeAllowedByNosniff): Deleted; incorporated into WebCore::isScriptAllowedByNosniff().
2212         * loader/cache/CachedScript.h:
2213         * platform/network/ResourceResponseBase.cpp:
2214         (WebCore::isScriptAllowedByNosniff): Added. Note that it is sufficient to extract the MIME type
2215         as-is and query the MIME type registry because the MIME type registry performs look ups case-insensitively.
2216         * platform/network/ResourceResponseBase.h:
2217         * workers/WorkerScriptLoader.cpp:
2218         (WebCore::WorkerScriptLoader::didReceiveResponse): Modified to use WebCore::isScriptAllowedByNosniff().
2219         (WebCore::mimeTypeAllowedByNosniff): Deleted.
2220
2221 2017-05-04  Sam Weinig  <sam@webkit.org>
2222
2223         Make the [EnabledBySetting] extended attribute work for any attribute or operation on a prototype
2224         https://bugs.webkit.org/show_bug.cgi?id=171588
2225
2226         Reviewed by Dean Jackson.
2227
2228         * bindings/js/JSDOMIterator.h:
2229         (WebCore::JSDOMIterator::createPrototype):
2230         * bindings/js/JSDOMWindowShell.cpp:
2231         (WebCore::JSDOMWindowShell::setWindow):
2232         * bindings/js/JSDOMWrapperCache.h:
2233         (WebCore::getDOMStructure):
2234         (WebCore::getDOMPrototype):
2235         * bindings/js/WorkerScriptController.cpp:
2236         (WebCore::WorkerScriptController::initScript):
2237         Update to account for createPrototype and prototype taking the global object by reference.
2238         
2239         * bindings/scripts/CodeGeneratorJS.pm:
2240         (NeedsSettingsCheckForPrototypeProperty):
2241         Add predicate to determine if an interface has any settings enabled properties on the prototype,
2242         needed to determine if we should pass the global object to finishCreation.
2243
2244         (GenerateHeader):
2245         Update signature of both createPrototype and prototype to take JSDOMGlobalObject& rather than
2246         a JSC::JSGlobalObject*, this allows us to pass the more specific type to the prototype constructor,
2247         and access the ScriptExecutionContext for the Settings.
2248
2249         (GeneratePropertiesHashTable):
2250         Update to return, via out parameter, arrays with the attributes and operations that specify EnabledBySetting. This
2251         mimics the model used for RuntimeEnabledFeatures.
2252
2253         (GenerateImplementation):
2254         In {Class}Prototype::finishCreation, add code to check settings to see if an attribute or operation should be enabled,
2255         and if it shouldn't remove it from the object. This, again, is modeled on RuntimeEnabledFeatures.
2256
2257         (GeneratePrototypeDeclaration):
2258         Update signatures to take JSDOMGlobalObject& and specialize finishCreation to take one if there are any properties
2259         that require settings to enable.
2260
2261         (GenerateConstructorHelperMethods):
2262         Update for new signature of prototype(...).
2263
2264         * bindings/scripts/test/JS/JSInterfaceName.cpp:
2265         * bindings/scripts/test/JS/JSInterfaceName.h:
2266         * bindings/scripts/test/JS/JSMapLike.cpp:
2267         * bindings/scripts/test/JS/JSMapLike.h:
2268         * bindings/scripts/test/JS/JSReadOnlyMapLike.cpp:
2269         * bindings/scripts/test/JS/JSReadOnlyMapLike.h:
2270         * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
2271         * bindings/scripts/test/JS/JSTestActiveDOMObject.h:
2272         * bindings/scripts/test/JS/JSTestCEReactions.cpp:
2273         * bindings/scripts/test/JS/JSTestCEReactions.h:
2274         * bindings/scripts/test/JS/JSTestCEReactionsStringifier.cpp:
2275         * bindings/scripts/test/JS/JSTestCEReactionsStringifier.h:
2276         * bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.cpp:
2277         * bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.h:
2278         * bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.cpp:
2279         * bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.h:
2280         * bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp:
2281         * bindings/scripts/test/JS/JSTestCustomNamedGetter.h:
2282         * bindings/scripts/test/JS/JSTestDOMJIT.cpp:
2283         * bindings/scripts/test/JS/JSTestDOMJIT.h:
2284         * bindings/scripts/test/JS/JSTestEventConstructor.cpp:
2285         * bindings/scripts/test/JS/JSTestEventConstructor.h:
2286         * bindings/scripts/test/JS/JSTestEventTarget.cpp:
2287         * bindings/scripts/test/JS/JSTestEventTarget.h:
2288         * bindings/scripts/test/JS/JSTestException.cpp:
2289         * bindings/scripts/test/JS/JSTestException.h:
2290         * bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp:
2291         * bindings/scripts/test/JS/JSTestGenerateIsReachable.h:
2292         * bindings/scripts/test/JS/JSTestGlobalObject.h:
2293         * bindings/scripts/test/JS/JSTestInterface.cpp:
2294         * bindings/scripts/test/JS/JSTestInterface.h:
2295         * bindings/scripts/test/JS/JSTestInterfaceLeadingUnderscore.cpp:
2296         * bindings/scripts/test/JS/JSTestInterfaceLeadingUnderscore.h:
2297         * bindings/scripts/test/JS/JSTestIterable.cpp:
2298         * bindings/scripts/test/JS/JSTestIterable.h:
2299         * bindings/scripts/test/JS/JSTestJSBuiltinConstructor.cpp:
2300         * bindings/scripts/test/JS/JSTestJSBuiltinConstructor.h:
2301         * bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp:
2302         * bindings/scripts/test/JS/JSTestMediaQueryListListener.h:
2303         * bindings/scripts/test/JS/JSTestNamedConstructor.cpp:
2304         * bindings/scripts/test/JS/JSTestNamedConstructor.h:
2305         * bindings/scripts/test/JS/JSTestNode.cpp:
2306         * bindings/scripts/test/JS/JSTestNode.h:
2307         * bindings/scripts/test/JS/JSTestObj.cpp:
2308         * bindings/scripts/test/JS/JSTestObj.h:
2309         * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
2310         * bindings/scripts/test/JS/JSTestOverloadedConstructors.h:
2311         * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.cpp:
2312         * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.h:
2313         * bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp:
2314         * bindings/scripts/test/JS/JSTestOverrideBuiltins.h:
2315         * bindings/scripts/test/JS/JSTestSerialization.cpp:
2316         * bindings/scripts/test/JS/JSTestSerialization.h:
2317         * bindings/scripts/test/JS/JSTestSerializationInherit.cpp:
2318         * bindings/scripts/test/JS/JSTestSerializationInherit.h:
2319         * bindings/scripts/test/JS/JSTestSerializationInheritFinal.cpp:
2320         * bindings/scripts/test/JS/JSTestSerializationInheritFinal.h:
2321         * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
2322         * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.h:
2323         * bindings/scripts/test/JS/JSTestTypedefs.cpp:
2324         * bindings/scripts/test/JS/JSTestTypedefs.h:
2325         Update test results for new test values and changes in signatures to pass JSDOMGlobalObject.
2326
2327         * bindings/scripts/test/TestObj.idl:
2328         Add tests for [EnableBySetting] for attributes and operations.
2329
2330         * bridge/objc/objc_runtime.h:
2331         * bridge/runtime_array.h:
2332         * bridge/runtime_method.h:
2333         * bridge/runtime_object.h:
2334         * inspector/CommandLineAPIHost.cpp:
2335         Update createPrototype function to take the global object by reference.
2336
2337 2017-05-04  Eric Carlson  <eric.carlson@apple.com>
2338
2339         [MediaStream] Allow host application to enable/disable media capture
2340         https://bugs.webkit.org/show_bug.cgi?id=171292
2341         <rdar://problem/31821492>
2342
2343         Reviewed by Jer Noble.
2344
2345         No new layout tests, added an API test instead.
2346
2347         * Modules/mediastream/MediaStream.cpp:
2348         (WebCore::MediaStream::endStream): New, stop all tracks.
2349         * Modules/mediastream/MediaStream.h:
2350
2351         * Modules/mediastream/MediaStreamRegistry.cpp:
2352         (WebCore::MediaStreamRegistry::unregisterStream): Minor cleanup.
2353         (WebCore::MediaStreamRegistry::forEach): New, call the lambda with each stream.
2354         (WebCore::MediaStreamRegistry::MediaStreamRegistry): Deleted, unused.
2355         * Modules/mediastream/MediaStreamRegistry.h:
2356
2357         * Modules/mediastream/MediaStreamTrack.cpp:
2358         (WebCore::MediaStreamTrack::stopTrack): Add parameter so caller can specify if an 'ended' 
2359         event should be sent or not.
2360         (WebCore::MediaStreamTrack::trackMutedChanged): Don't post an event if the track has ended.
2361         * Modules/mediastream/MediaStreamTrack.h:
2362
2363         * dom/Document.cpp:
2364         (WebCore::Document::stopMediaCapture): Stop all streams in the document.
2365         * dom/Document.h:
2366
2367         * page/Page.cpp:
2368         (WebCore::Page::stopMediaCapture): Stop all streams.
2369         * page/Page.h:
2370
2371         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
2372         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::currentDisplayMode): Display a black frame
2373         when the stream ends.
2374         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::activeStatusChanged): Signal a characteristics
2375         change to HTMLMediaElement refresh state.
2376         * platform/mediastream/MediaStreamPrivate.h:
2377
2378         * platform/mediastream/mac/AVMediaCaptureSource.mm:
2379         (WebCore::AVMediaCaptureSource::stopProducingData): Don't return early if the session isn't 
2380         running, we always need to clear m_session on iOS.
2381
2382 2017-05-04  Zalan Bujtas  <zalan@apple.com>
2383
2384         Should never hit layout while updating the render tree.
2385         https://bugs.webkit.org/show_bug.cgi?id=171643
2386
2387         Reviewed by Antti Koivisto.
2388
2389         Laying out a half-baked render tree is not a great idea. Especially considering
2390         that layout (sadly) can mutate the render tree.  
2391
2392         * page/FrameView.cpp:
2393         (WebCore::FrameView::layout):
2394
2395 2017-05-04  Daniel Bates  <dabates@apple.com>
2396
2397         importScripts() should respect X-Content-Type-Options: nosniff
2398         https://bugs.webkit.org/show_bug.cgi?id=171248
2399         <rdar://problem/31819023>
2400
2401         Reviewed by Andy Estes.
2402
2403         Do not load a worker script if it has the HTTP response header "X-Content-Type-Options: nosniff"
2404         and its Content-type header is not an allowed JavaScript script mime type. This behavior follows
2405         from <https://html.spec.whatwg.org/multipage/webappapis.html#fetch-a-classic-worker-imported-script> (3 May 2017),
2406         <https://fetch.spec.whatwg.org/#concept-fetch> (2 May 2017), and <https://fetch.spec.whatwg.org/#concept-main-fetch>.
2407
2408         * workers/WorkerScriptLoader.cpp:
2409         (WebCore::mimeTypeAllowedByNosniff): Added.
2410         (WebCore::WorkerScriptLoader::didReceiveResponse): Mark the load as failed if the response
2411         is not allowed by X-Content-Type-Options: nosniff.
2412
2413 2017-05-04  Dave Hyatt  <hyatt@apple.com>
2414
2415         REGRESSION(STP): rgb() with calc() containing variables doesn't work
2416         https://bugs.webkit.org/show_bug.cgi?id=169939
2417
2418         Reviewed by Zalan Bujtas.
2419
2420         Added new test in fast/css/variables.
2421
2422         * css/CSSCalculationValue.cpp:
2423         (WebCore::CSSCalcExpressionNodeParser::parseValue):
2424         Treat floats in calcs as integers when we can.
2425
2426 2017-05-04  Commit Queue  <commit-queue@webkit.org>
2427
2428         Unreviewed, rolling out r216172.
2429         https://bugs.webkit.org/show_bug.cgi?id=171654
2430
2431         FTBFS for iOS due to missing WebPageProxy::stopMediaCapture()
2432         implementation. (Requested by ddkilzer on #webkit).
2433
2434         Reverted changeset:
2435
2436         "[MediaStream] Allow host application to enable/disable media
2437         capture"
2438         https://bugs.webkit.org/show_bug.cgi?id=171292
2439         http://trac.webkit.org/changeset/216172
2440
2441 2017-05-03  Carlos Garcia Campos  <cgarcia@igalia.com>
2442
2443         REGRESSION(r215686): Incremental reads from SharedBuffer are wrong after r215686
2444         https://bugs.webkit.org/show_bug.cgi?id=171602
2445
2446         Reviewed by Michael Catanzaro.
2447
2448         In TextTrackLoader::processNewCueData() and PNGImageReader::decode() we changed the patter to read data from a
2449         SharedBuffer at a given offset. The new pattern is not correct, because it assumes the whole segment is always
2450         read, and the new offset is not correct when that's not the case. This has broken the rendering of png images in
2451         the GTK+ port, only the first bytes are correctly decoded and drawn, but not the rest of the image.
2452
2453         Fixes: editing/pasteboard/paste-image-using-image-data.html
2454
2455         * loader/TextTrackLoader.cpp:
2456         (WebCore::TextTrackLoader::processNewCueData):
2457         * platform/image-decoders/png/PNGImageDecoder.cpp:
2458         (WebCore::PNGImageReader::decode):
2459
2460 2017-05-03  Eric Carlson  <eric.carlson@apple.com>
2461
2462         [MediaStream] Allow host application to enable/disable media capture
2463         https://bugs.webkit.org/show_bug.cgi?id=171292
2464         <rdar://problem/31821492>
2465
2466         Reviewed by Jer Noble.
2467
2468         No new layout tests, added an API test instead.
2469
2470         * Modules/mediastream/MediaStream.cpp:
2471         (WebCore::MediaStream::endStream): New, stop all tracks.
2472         * Modules/mediastream/MediaStream.h:
2473
2474         * Modules/mediastream/MediaStreamRegistry.cpp:
2475         (WebCore::MediaStreamRegistry::unregisterStream): Minor cleanup.
2476         (WebCore::MediaStreamRegistry::forEach): New, call the lambda with each stream.
2477         (WebCore::MediaStreamRegistry::MediaStreamRegistry): Deleted, unused.
2478         * Modules/mediastream/MediaStreamRegistry.h:
2479
2480         * Modules/mediastream/MediaStreamTrack.cpp:
2481         (WebCore::MediaStreamTrack::stopTrack): Add parameter so caller can specify if an 'ended' 
2482         event should be sent or not.
2483         (WebCore::MediaStreamTrack::trackMutedChanged): Don't post an event if the track has ended.
2484         * Modules/mediastream/MediaStreamTrack.h:
2485
2486         * dom/Document.cpp:
2487         (WebCore::Document::stopMediaCapture): Stop all streams in the document.
2488         * dom/Document.h:
2489
2490         * page/Page.cpp:
2491         (WebCore::Page::stopMediaCapture): Stop all streams.
2492         * page/Page.h:
2493
2494         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
2495         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::currentDisplayMode): Display a black frame
2496         when the stream ends.
2497         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::activeStatusChanged): Signal a characteristics
2498         change to HTMLMediaElement refresh state.
2499         * platform/mediastream/MediaStreamPrivate.h:
2500
2501         * platform/mediastream/mac/AVMediaCaptureSource.mm:
2502         (WebCore::AVMediaCaptureSource::stopProducingData): Don't return early if the session isn't 
2503         running, we always need to clear m_session on iOS.
2504
2505 2017-05-03  John Wilander  <wilander@apple.com>
2506
2507         Resource Load Statistics: Remove all statistics for modifiedSince website data removals
2508         https://bugs.webkit.org/show_bug.cgi?id=171584
2509         <rdar://problem/24702576>
2510
2511         Reviewed by Brent Fulgham.
2512
2513         Test: http/tests/loading/resourceLoadStatistics/clear-in-memory-and-persistent-store-one-hour.html
2514
2515         * loader/ResourceLoadObserver.cpp:
2516         (WebCore::ResourceLoadObserver::clearInMemoryAndPersistentStore):
2517             Now clears all regardless of the modifiedSince parameter's value.
2518
2519 2017-05-03  Andy Estes  <aestes@apple.com>
2520
2521         Try to fix the macOS Public SDK build
2522         https://bugs.webkit.org/show_bug.cgi?id=171635
2523         <rdar://problem/31812751>
2524
2525         Unreviewed because the commit queue told me to say this.
2526
2527         * platform/spi/cocoa/AVKitSPI.h:
2528
2529 2017-05-03  Joanmarie Diggs  <jdiggs@igalia.com>
2530
2531         AX: aria-rowspan value should be ignored if td/th rowspan value is provided
2532         https://bugs.webkit.org/show_bug.cgi?id=171214
2533
2534         Reviewed by Chris Fleizach.
2535
2536         Return -1 in AccessibilityTableCell::ariaColumnSpan() and ariaRowSpan() if the
2537         cell element has an explicit value for the native host language's span attribute.
2538         Add checks to AccessibilityTableCell::columnIndexRange() and rowIndexRange() so
2539         that we prefer an author-provided ARIA span value over an implicit host-language
2540         span value. Similarly, add checks to AccessibilityARIAGridCell::columnIndexRange()
2541         and rowIndexRange() so that we fall back on implicit host-language span values
2542         when there is no author-provided ARIA span value and the ARIA cell is associated
2543         with a cell element.
2544
2545         Test: accessibility/aria-cellspans-with-native-cellspans.html
2546
2547         * accessibility/AccessibilityARIAGridCell.cpp:
2548         (WebCore::AccessibilityARIAGridCell::ariaRowSpanWithRowIndex):
2549         (WebCore::AccessibilityARIAGridCell::columnIndexRange):
2550         * accessibility/AccessibilityTableCell.cpp:
2551         (WebCore::AccessibilityTableCell::rowIndexRange):
2552         (WebCore::AccessibilityTableCell::columnIndexRange):
2553         (WebCore::AccessibilityTableCell::ariaColumnSpan):
2554         (WebCore::AccessibilityTableCell::ariaRowSpan):
2555
2556 2017-05-03  Commit Queue  <commit-queue@webkit.org>
2557
2558         Unreviewed, rolling out r216160 and r216161.
2559         https://bugs.webkit.org/show_bug.cgi?id=171640
2560
2561         These changes broke the iOS build. (Requested by mlewis13 on
2562         #webkit).
2563
2564         Reverted changesets:
2565
2566         "[MediaStream] Allow host application to enable/disable media
2567         capture"
2568         https://bugs.webkit.org/show_bug.cgi?id=171292
2569         http://trac.webkit.org/changeset/216160
2570
2571         "[MediaStream] Allow host application to enable/disable media
2572         capture"
2573         https://bugs.webkit.org/show_bug.cgi?id=171292
2574         http://trac.webkit.org/changeset/216161
2575
2576 2017-05-03  Eric Carlson  <eric.carlson@apple.com>
2577
2578         [MediaStream] Allow host application to enable/disable media capture
2579         https://bugs.webkit.org/show_bug.cgi?id=171292
2580         <rdar://problem/31821492>
2581
2582         Reviewed by Jer Noble.
2583
2584         No new layout tests, added an API test instead.
2585
2586         * Modules/mediastream/MediaStream.cpp:
2587         (WebCore::MediaStream::endStream): New, stop all tracks.
2588         * Modules/mediastream/MediaStream.h:
2589
2590         * Modules/mediastream/MediaStreamRegistry.cpp:
2591         (WebCore::MediaStreamRegistry::unregisterStream): Minor cleanup.
2592         (WebCore::MediaStreamRegistry::forEach): New, call the lambda with each stream.
2593         (WebCore::MediaStreamRegistry::MediaStreamRegistry): Deleted, unused.
2594         * Modules/mediastream/MediaStreamRegistry.h:
2595
2596         * Modules/mediastream/MediaStreamTrack.cpp:
2597         (WebCore::MediaStreamTrack::stopTrack): Add parameter so caller can specify if an 'ended' 
2598         event should be sent or not.
2599         (WebCore::MediaStreamTrack::trackMutedChanged): Don't post an event if the track has ended.
2600         * Modules/mediastream/MediaStreamTrack.h:
2601
2602         * dom/Document.cpp:
2603         (WebCore::Document::stopMediaCapture): Stop all streams in the document.
2604         * dom/Document.h:
2605
2606         * page/Page.cpp:
2607         (WebCore::Page::stopMediaCapture): Stop all streams.
2608         * page/Page.h:
2609
2610         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
2611         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::currentDisplayMode): Display a black frame
2612         when the stream ends.
2613         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::activeStatusChanged): Signal a characteristics
2614         change to HTMLMediaElement refresh state.
2615         * platform/mediastream/MediaStreamPrivate.h:
2616
2617         * platform/mediastream/mac/AVMediaCaptureSource.mm:
2618         (WebCore::AVMediaCaptureSource::stopProducingData): Don't return early if the session isn't 
2619         running, we always need to clear m_session on iOS.
2620
2621 2017-05-03  Zalan Bujtas  <zalan@apple.com>
2622
2623         SearchInputType could end up with a mismatched renderer.
2624         https://bugs.webkit.org/show_bug.cgi?id=171547
2625         <rdar://problem/31935047>
2626
2627         Reviewed by Antti Koivisto.
2628
2629         Normally we've got the correct renderer by the time we call into SearchInputType.
2630         However, since HTMLInputElement::updateType() eagerly updates the type while the associated renderers are done lazily
2631         (so we don't get them updated until after the next tree update), we could actually end up
2632         with a mismatched renderer (e.g. through form submission).
2633
2634         Test: fast/forms/change-input-type-and-submit-form-crash.html
2635
2636         * html/SearchInputType.cpp:
2637         (WebCore::SearchInputType::addSearchResult):
2638         (WebCore::SearchInputType::didSetValueByUserEdit):
2639
2640 2017-05-03  Jer Noble  <jer.noble@apple.com>
2641
2642         Make the VPIO audio unit a singleton, shared between multiple CaptureSources
2643         https://bugs.webkit.org/show_bug.cgi?id=171622
2644
2645         Reviewed by Eric Carlson.
2646
2647         Move the implemnetation of CoreAudioCaptureSource into a shared singleton class, CoreAudioSharedUnit,
2648         which will send audio to each of it's client CoreAudioCaptureSources. The first registered client will
2649         define the settings used by the shared unit.
2650
2651         Drive-by fixes: Fix up setUseAVFoundationAudioCapture() to always accept the first value set.
2652
2653         * platform/mediastream/mac/CoreAudioCaptureSource.cpp:
2654         (WebCore::CoreAudioSharedUnit::isProducingData):
2655         (WebCore::CoreAudioSharedUnit::microphoneFormat):
2656         (WebCore::CoreAudioSharedUnit::singleton):
2657         (WebCore::CoreAudioSharedUnit::addClient):
2658         (WebCore::CoreAudioSharedUnit::removeClient):
2659         (WebCore::CoreAudioSharedUnit::addEchoCancellationSource):
2660         (WebCore::CoreAudioSharedUnit::removeEchoCancellationSource):
2661         (WebCore::CoreAudioSharedUnit::preferredIOBufferSize):
2662         (WebCore::CoreAudioSharedUnit::setupAudioUnits):
2663         (WebCore::CoreAudioSharedUnit::configureMicrophoneProc):
2664         (WebCore::CoreAudioSharedUnit::configureSpeakerProc):
2665         (WebCore::CoreAudioSharedUnit::checkTimestamps):
2666         (WebCore::CoreAudioSharedUnit::provideSpeakerData):
2667         (WebCore::CoreAudioSharedUnit::speakerCallback):
2668         (WebCore::CoreAudioSharedUnit::processMicrophoneSamples):
2669         (WebCore::CoreAudioSharedUnit::microphoneCallback):
2670         (WebCore::CoreAudioSharedUnit::cleanupAudioUnits):
2671         (WebCore::CoreAudioSharedUnit::startProducingData):
2672         (WebCore::CoreAudioSharedUnit::stopProducingData):
2673         (WebCore::CoreAudioSharedUnit::suspend):
2674         (WebCore::CoreAudioSharedUnit::defaultInputDevice):
2675         (WebCore::CoreAudioCaptureSource::create):
2676         (WebCore::CoreAudioCaptureSource::factory):
2677         (WebCore::CoreAudioCaptureSource::CoreAudioCaptureSource):
2678         (WebCore::CoreAudioCaptureSource::~CoreAudioCaptureSource):
2679         (WebCore::CoreAudioCaptureSource::addEchoCancellationSource):
2680         (WebCore::CoreAudioCaptureSource::removeEchoCancellationSource):
2681         (WebCore::CoreAudioCaptureSource::startProducingData):
2682         (WebCore::CoreAudioCaptureSource::stopProducingData):
2683         (WebCore::CoreAudioCaptureSource::audioSourceProvider):
2684         (WebCore::CoreAudioCaptureSource::preferredSampleRate): Deleted.
2685         (WebCore::CoreAudioCaptureSource::preferredIOBufferSize): Deleted.
2686         (WebCore::CoreAudioCaptureSource::configureMicrophoneProc): Deleted.
2687         (WebCore::CoreAudioCaptureSource::configureSpeakerProc): Deleted.
2688         (WebCore::CoreAudioCaptureSource::checkTimestamps): Deleted.
2689         (WebCore::CoreAudioCaptureSource::provideSpeakerData): Deleted.
2690         (WebCore::CoreAudioCaptureSource::speakerCallback): Deleted.
2691         (WebCore::CoreAudioCaptureSource::processMicrophoneSamples): Deleted.
2692         (WebCore::CoreAudioCaptureSource::microphoneCallback): Deleted.
2693         (WebCore::CoreAudioCaptureSource::cleanupAudioUnits): Deleted.
2694         (WebCore::CoreAudioCaptureSource::defaultInputDevice): Deleted.
2695         (WebCore::CoreAudioCaptureSource::setupAudioUnits): Deleted.
2696         (WebCore::CoreAudioCaptureSource::suspend): Deleted.
2697         (WebCore::CoreAudioCaptureSource::resume): Deleted.
2698         * platform/mediastream/mac/CoreAudioCaptureSource.h:
2699         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp:
2700         (WebCore::RealtimeMediaSourceCenterMac::setUseAVFoundationAudioCapture):
2701
2702 2017-05-03  Jer Noble  <jer.noble@apple.com>
2703
2704         getUserMedia() fails because devices list is empty / inactive
2705         https://bugs.webkit.org/show_bug.cgi?id=171626
2706
2707         Reviewed by Eric Carlson.
2708
2709         When creating a AVAudioSessionCaptureDevice, set the device's enabled state to true if the port description
2710         has any items in its dataSources property (which is the best analogue to "isActive" we have in AVAudioSession).
2711
2712         Also, when creating the generic list of CaptureDevices, use the copy constructor to ensure the enabled state
2713         gets copied to the new generic device.
2714
2715         * platform/mediastream/ios/AVAudioSessionCaptureDevice.mm:
2716         (WebCore::AVAudioSessionCaptureDevice::create):
2717         * platform/mediastream/ios/AVAudioSessionCaptureDeviceManager.mm:
2718         (WebCore::AVAudioSessionCaptureDeviceManager::refreshAudioCaptureDevices):
2719
2720 2017-05-03  Said Abou-Hallawa  <sabouhallawa@apple.com>
2721
2722         Implement the imageready event to reliably test the async image decoding
2723         https://bugs.webkit.org/show_bug.cgi?id=171016
2724
2725         Reviewed by Simon Fraser.
2726
2727         The event will be fired for each client of the image. Firing the event
2728         will happen after finishing the decoding and repainting the client.
2729
2730         Existing tests will be modified in a separate patch to use this event.
2731
2732         * dom/Element.cpp:
2733         (WebCore::Element::dispatchWebKitImageReadyEventForTesting):
2734         * dom/Element.h:
2735         * page/Settings.in:
2736         * rendering/RenderElement.cpp:
2737         (WebCore::RenderElement::imageFrameAvailable):
2738
2739 2017-05-03  Tim Horton  <timothy_horton@apple.com>
2740
2741         Maintain interaction information URL as a URL, not a string
2742         https://bugs.webkit.org/show_bug.cgi?id=171623
2743
2744         Reviewed by Simon Fraser.
2745
2746         No new tests, not a behavior change.
2747
2748         * platform/URL.h:
2749
2750 2017-05-03  Yoav Weiss  <yoav@yoav.ws>
2751
2752         Link preload HTMLPreloadScanner support
2753         https://bugs.webkit.org/show_bug.cgi?id=170747
2754
2755         Reviewed by Youenn Fablet.
2756
2757         Test: http/tests/preload/preloadscanner_download_resources.html
2758
2759         * html/parser/HTMLPreloadScanner.cpp:
2760         (WebCore::TokenPreloadScanner::StartTagScanner::StartTagScanner): Initialize link preload flag.
2761         (WebCore::TokenPreloadScanner::StartTagScanner::createPreloadRequest): Create a request only if the type is known (so ignore
2762         preloads with unknown type).
2763         (WebCore::TokenPreloadScanner::StartTagScanner::processAttribute): Add handling for link preload and the `as` attribute.
2764         (WebCore::TokenPreloadScanner::StartTagScanner::relAttributeIsStyleSheet): Get LinkRelAttribute as input.
2765         (WebCore::TokenPreloadScanner::StartTagScanner::resourceType): Return an std::optional, in case the preload type is unknown.
2766         (WebCore::TokenPreloadScanner::StartTagScanner::shouldPreload): Return true for the link preload case.
2767         * loader/cache/CachedResourceLoader.cpp:
2768         (WebCore::CachedResourceLoader::preload): Return the resource rather than a nullptr if it's already in m_preloads.
2769
2770 2017-05-03  Michael Catanzaro  <mcatanzaro@igalia.com>
2771
2772         YouTube user agent quirk breaks new YouTube
2773         https://bugs.webkit.org/show_bug.cgi?id=171603
2774
2775         Reviewed by Carlos Garcia Campos.
2776
2777         Our user agent quirk to make YouTube 360 work breaks the new YouTube UI, causing it to
2778         attempt to use the obsolete custom elements v0 API. WebKit only supports the v1 API. We
2779         have to remove this quirk.
2780
2781         Note this does not affect Safari as Apple ports don't use our user agent quirks.
2782
2783         * platform/UserAgentQuirks.cpp:
2784         (WebCore::urlRequiresChromeBrowser):
2785
2786 2017-05-03  Joseph Pecoraro  <pecoraro@apple.com>
2787
2788         Web Inspector: 404 Image Load does not appear as a failure in Web Inspector
2789         https://bugs.webkit.org/show_bug.cgi?id=171587
2790         <rdar://problem/13222846>
2791
2792         Reviewed by Matt Baker.
2793
2794         * inspector/InspectorPageAgent.h:
2795         * inspector/InspectorPageAgent.cpp:
2796         (WebCore::InspectorPageAgent::cachedResourceContent):
2797         (WebCore::prepareCachedResourceBuffer): Deleted.
2798         Inline the function to make this less confusing.
2799
2800         (WebCore::InspectorPageAgent::buildObjectForFrameTree):
2801         Treat a DecodeError as a failure.
2802
2803 2017-05-03  Said Abou-Hallawa  <sabouhallawa@apple.com>
2804
2805         Async image decoding should be disabled for snapshots, printing and preview
2806         https://bugs.webkit.org/show_bug.cgi?id=171467
2807  
2808         Reviewed by Simon Fraser.
2809  
2810         Asynchronous image decoding should only be used for window display where
2811         RenderElements can be repainted and painted. For cases where there is only
2812         one chance to draw the image, synchronous decoding should be used. 
2813
2814         * rendering/RenderBoxModelObject.cpp:
2815         (WebCore::RenderBoxModelObject::paintFillLayerExtended):
2816         * rendering/RenderImage.cpp:
2817         (WebCore::RenderImage::paintIntoRect):
2818
2819 2017-05-03  Nan Wang  <n_wang@apple.com>
2820
2821         AX: VO skips cells after cell with aria-colspan
2822         https://bugs.webkit.org/show_bug.cgi?id=171579
2823
2824         Reviewed by Chris Fleizach.
2825
2826         We should consider the previous cells' column span value when
2827         calculating the column index.
2828
2829         Test: accessibility/mac/aria-grid-column-span.html
2830
2831         * accessibility/AccessibilityARIAGridCell.cpp:
2832         (WebCore::AccessibilityARIAGridCell::columnIndexRange):
2833
2834 2017-05-03  Jiewen Tan  <jiewen_tan@apple.com>
2835
2836         ASSERTION FAILED: m_scriptExecutionContext->isContextThread() seen with LayoutTest crypto/workers/crypto-random-values-limits-worker.html
2837         https://bugs.webkit.org/show_bug.cgi?id=171462
2838         <rdar://problem/31906859>
2839
2840         Reviewed by Brent Fulgham.
2841
2842         Covered by existing tests.
2843
2844         * workers/WorkerGlobalScope.cpp:
2845         (WebCore::WorkerGlobalScope::~WorkerGlobalScope):
2846         Clear Crypto early in destruction since its ContextDestructionObserver
2847         destruction makes checks about the WorkerThread.
2848
2849 2017-05-03  Zalan Bujtas  <zalan@apple.com>
2850
2851         RenderSearchField should not use isTextField() in SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT
2852         https://bugs.webkit.org/show_bug.cgi?id=171608
2853
2854         Reviewed by Simon Fraser.
2855
2856         isTextField() is true for any generic single line text control.
2857
2858         * rendering/RenderObject.h:
2859         (WebCore::RenderObject::isSearchField):
2860         * rendering/RenderSearchField.h:
2861
2862 2017-05-03  Frederic Wang  <fwang@igalia.com>
2863
2864         Remove ScrollingCoordinator::supportsFixedPositionLayers()
2865         https://bugs.webkit.org/show_bug.cgi?id=171557
2866
2867         Reviewed by Simon Fraser.
2868
2869         No new tests, behavior is not changed.
2870
2871         * page/FrameView.cpp:
2872         (WebCore::FrameView::shouldUpdateCompositingLayersAfterScrolling):
2873         * page/scrolling/AsyncScrollingCoordinator.cpp:
2874         (WebCore::AsyncScrollingCoordinator::updateViewportConstrainedNode):
2875         * page/scrolling/AsyncScrollingCoordinator.h:
2876         * page/scrolling/ScrollingCoordinator.cpp:
2877         (WebCore::ScrollingCoordinator::synchronousScrollingReasons):
2878         * page/scrolling/ScrollingCoordinator.h:
2879         (WebCore::ScrollingCoordinator::supportsFixedPositionLayers): Deleted.
2880         * page/scrolling/coordinatedgraphics/ScrollingCoordinatorCoordinatedGraphics.cpp:
2881         (WebCore::ScrollingCoordinatorCoordinatedGraphics::updateViewportConstrainedNode):
2882         * page/scrolling/coordinatedgraphics/ScrollingCoordinatorCoordinatedGraphics.h:
2883         (): Deleted.
2884         * rendering/RenderLayerCompositor.cpp:
2885         (WebCore::RenderLayerCompositor::updateScrollCoordinatedLayer):
2886
2887 2017-05-03  Chris Dumez  <cdumez@apple.com>
2888
2889         Use PassRefPtr less in CompositeEditCommand
2890         https://bugs.webkit.org/show_bug.cgi?id=171590
2891
2892         Reviewed by Sam Weinig.
2893
2894         Use PassRefPtr less in CompositeEditCommand.
2895
2896         * CMakeLists.txt:
2897         * WebCore.xcodeproj/project.pbxproj:
2898         * editing/ApplyStyleCommand.cpp:
2899         (WebCore::hasNoAttributeOrOnlyStyleAttribute):
2900         (WebCore::isStyleSpanOrSpanWithOnlyStyleAttribute):
2901         (WebCore::isSpanWithoutAttributesOrUnstyledStyleSpan):
2902         (WebCore::isEmptyFontTag):
2903         (WebCore::ApplyStyleCommand::doApply):
2904         (WebCore::ApplyStyleCommand::applyBlockStyle):
2905         (WebCore::ApplyStyleCommand::applyRelativeFontStyleChange):
2906         (WebCore::dummySpanAncestorForNode):
2907         (WebCore::ApplyStyleCommand::cleanupUnstyledAppleStyleSpans):
2908         (WebCore::ApplyStyleCommand::removeEmbeddingUpToEnclosingBlock):
2909         (WebCore::ApplyStyleCommand::applyInlineStyle):
2910         (WebCore::ApplyStyleCommand::fixRangeAndApplyInlineStyle):
2911         (WebCore::ApplyStyleCommand::applyInlineStyleToNodeRange):
2912         (WebCore::ApplyStyleCommand::shouldApplyInlineStyleToRun):
2913         (WebCore::ApplyStyleCommand::removeConflictingInlineStyleFromRun):
2914         (WebCore::ApplyStyleCommand::removeInlineStyleFromElement):
2915         (WebCore::ApplyStyleCommand::replaceWithSpanOrRemoveIfWithoutAttributes):
2916         (WebCore::ApplyStyleCommand::removeImplicitlyStyledElement):
2917         (WebCore::ApplyStyleCommand::removeCSSStyle):
2918         (WebCore::ApplyStyleCommand::highestAncestorWithConflictingInlineStyle):
2919         (WebCore::ApplyStyleCommand::pushDownInlineStyleAroundNode):
2920         (WebCore::ApplyStyleCommand::removeInlineStyle):
2921         (WebCore::ApplyStyleCommand::shouldSplitTextElement):
2922         (WebCore::ApplyStyleCommand::mergeStartWithPreviousIfIdentical):
2923         (WebCore::ApplyStyleCommand::mergeEndWithNextIfIdentical):
2924         (WebCore::ApplyStyleCommand::surroundNodeRangeWithElement):
2925         (WebCore::ApplyStyleCommand::addBlockStyle):
2926         (WebCore::ApplyStyleCommand::joinChildTextNodes):
2927         * editing/ApplyStyleCommand.h:
2928         (WebCore::ApplyStyleCommand::shouldRemoveInlineStyleFromElement):
2929         * editing/CompositeEditCommand.cpp:
2930         (WebCore::CompositeEditCommand::removeChildrenInRange):
2931         (WebCore::CompositeEditCommand::mergeIdenticalElements):
2932         (WebCore::CompositeEditCommand::insertTextIntoNode):
2933         (WebCore::CompositeEditCommand::deleteTextFromNode):
2934         (WebCore::CompositeEditCommand::replaceTextInNode):
2935         (WebCore::CompositeEditCommand::replaceSelectedTextInNode):
2936         (WebCore::CompositeEditCommand::replaceTextInNodePreservingMarkers):
2937         (WebCore::CompositeEditCommand::removeNodeAttribute):
2938         (WebCore::CompositeEditCommand::rebalanceWhitespaceAt):
2939         (WebCore::CompositeEditCommand::rebalanceWhitespaceOnTextSubstring):
2940         (WebCore::CompositeEditCommand::prepareWhitespaceAtPositionForSplit):
2941         (WebCore::CompositeEditCommand::deleteInsignificantText):
2942         (WebCore::CompositeEditCommand::removePlaceholderAt):
2943         (WebCore::CompositeEditCommand::cleanupAfterDeletion):
2944         (WebCore::CompositeEditCommand::moveParagraphs):
2945         * editing/CompositeEditCommand.h:
2946         * editing/DeleteFromTextNodeCommand.cpp:
2947         (WebCore::DeleteFromTextNodeCommand::DeleteFromTextNodeCommand):
2948         (WebCore::DeleteFromTextNodeCommand::doApply):
2949         (WebCore::DeleteFromTextNodeCommand::doUnapply):
2950         (WebCore::DeleteFromTextNodeCommand::getNodesInCommand):
2951         * editing/DeleteFromTextNodeCommand.h:
2952         (WebCore::DeleteFromTextNodeCommand::create):
2953         * editing/DeleteSelectionCommand.cpp:
2954         (WebCore::DeleteSelectionCommand::deleteTextFromNode):
2955         (WebCore::DeleteSelectionCommand::handleGeneralDelete):
2956         (WebCore::DeleteSelectionCommand::fixupWhitespace):
2957         * editing/DeleteSelectionCommand.h:
2958         * editing/EditingAllInOne.cpp:
2959         * editing/EditingStyle.cpp:
2960         (WebCore::EditingStyle::removeStyleConflictingWithStyleOfNode):
2961         (WebCore::elementMatchesAndPropertyIsNotInInlineStyleDecl):
2962         (WebCore::EditingStyle::mergeInlineAndImplicitStyleOfElement):
2963         (WebCore::EditingStyle::wrappingStyleForSerialization):
2964         (WebCore::styleFromMatchedRulesForElement):
2965         (WebCore::EditingStyle::mergeStyleFromRules):
2966         (WebCore::EditingStyle::mergeStyleFromRulesForSerialization):
2967         (WebCore::EditingStyle::removeStyleFromRulesAndContext):
2968         (WebCore::EditingStyle::removePropertiesInElementDefaultStyle):
2969         * editing/EditingStyle.h:
2970         * editing/IndentOutdentCommand.cpp:
2971         (WebCore::IndentOutdentCommand::tryIndentingAsListItem):
2972         * editing/InsertIntoTextNodeCommand.cpp:
2973         (WebCore::InsertIntoTextNodeCommand::InsertIntoTextNodeCommand):
2974         (WebCore::InsertIntoTextNodeCommand::getNodesInCommand):
2975         * editing/InsertIntoTextNodeCommand.h:
2976         (WebCore::InsertIntoTextNodeCommand::create):
2977         * editing/InsertLineBreakCommand.cpp:
2978         (WebCore::InsertLineBreakCommand::doApply):
2979         * editing/InsertListCommand.cpp:
2980         (WebCore::InsertListCommand::mergeWithNeighboringLists):
2981         (WebCore::InsertListCommand::listifyParagraph):
2982         * editing/InsertParagraphSeparatorCommand.cpp:
2983         (WebCore::InsertParagraphSeparatorCommand::doApply):
2984         * editing/InsertTextCommand.cpp:
2985         (WebCore::InsertTextCommand::performOverwrite):
2986         (WebCore::InsertTextCommand::doApply):
2987         (WebCore::InsertTextCommand::insertTab):
2988         * editing/MergeIdenticalElementsCommand.cpp:
2989         (WebCore::MergeIdenticalElementsCommand::MergeIdenticalElementsCommand):
2990         (WebCore::MergeIdenticalElementsCommand::doApply):
2991         (WebCore::MergeIdenticalElementsCommand::doUnapply):
2992         (WebCore::MergeIdenticalElementsCommand::getNodesInCommand):
2993         * editing/MergeIdenticalElementsCommand.h:
2994         (WebCore::MergeIdenticalElementsCommand::create):
2995         * editing/RemoveCSSPropertyCommand.cpp: Removed.
2996         * editing/RemoveCSSPropertyCommand.h: Removed.
2997         * editing/ReplaceSelectionCommand.cpp:
2998         (WebCore::ReplaceSelectionCommand::removeRedundantStylesAndKeepStyleSpanInline):
2999         (WebCore::ReplaceSelectionCommand::doApply):
3000         (WebCore::ReplaceSelectionCommand::addSpacesForSmartReplace):
3001         (WebCore::ReplaceSelectionCommand::mergeTextNodesAroundPosition):
3002         * editing/markup.cpp:
3003         (WebCore::StyledMarkupAccumulator::appendElement):
3004         (WebCore::styleFromMatchedRulesAndInlineDecl):
3005         (WebCore::createMarkupInternal):
3006
3007 2017-05-03  Joanmarie Diggs  <jdiggs@igalia.com>
3008
3009         AX: Treat cells with ARIA table cell properties as cells
3010         https://bugs.webkit.org/show_bug.cgi?id=171178
3011
3012         Reviewed by Chris Fleizach.
3013
3014         Add the following checks to heuristics in AccessibilityTable::isDataTable():
3015         1. If the author has provided a valid aria-rowcount or aria-colcount value on
3016            the table element, expose it as a data table.
3017         2. If the author has provided a valid aria-colindex or aria-rowindex on the
3018            cell element, expose it as a data table.
3019         3. If the author has provided a valid aria-rowindex on the row element, expose
3020            it as a data table.
3021         4. If the author has provided a value for aria-colspan or aria-rowspan on a cell,
3022            expose it as a data table (even though we are supposed to ignore the value for
3023            the purpose of exposing the span via platform accessibility APIs)
3024
3025         Remove the heuristic that a table with only one cell is "not a good AXTable candidate."
3026         It prevents us from ever doing the above checks.
3027
3028         Test: accessibility/minimal-table-with-aria-is-data-table.html
3029
3030         * accessibility/AccessibilityTable.cpp:
3031         (WebCore::AccessibilityTable::isDataTable):
3032
3033 2017-05-03  Carlos Garcia Campos  <cgarcia@igalia.com>
3034
3035         [Cairo] Handle extended colors in gradients
3036         https://bugs.webkit.org/show_bug.cgi?id=171596
3037
3038         Reviewed by Michael Catanzaro.
3039
3040         Check if every gradient color step is an extended color and use asExtended() instead of getRGBA() in such case.
3041
3042         Fixes: css3/color/gradients.html
3043
3044         * platform/graphics/cairo/GradientCairo.cpp:
3045         (WebCore::Gradient::platformGradient):
3046
3047 2017-05-03  Daniel Bates  <dabates@apple.com>
3048
3049         Abandon the current load once the provisional loader detaches from the frame
3050         https://bugs.webkit.org/show_bug.cgi?id=171577
3051         <rdar://problem/31581227>
3052
3053         Reviewed by Brent Fulgham and Brady Eidson.
3054
3055         We detach all child frames as part of setting our document loader to the provisional
3056         document loader when committing a load for a frame. Detaching child frames invokes
3057         the unload event handler on the child frames that can run arbitrary JavaScript script.
3058         Among other things, such script can initiate a new load in the frame whose current
3059         load is being committed. We should stop processing the current load as soon as we
3060         detect that updating our document loader has started a new provisional load.
3061
3062         Test: fast/loader/inner-iframe-loads-data-url-into-parent-on-unload-crash.html
3063
3064         * loader/FrameLoader.cpp:
3065         (WebCore::FrameLoader::transitionToCommitted):
3066
3067 2017-05-03  Daniel Bates  <dabates@apple.com>
3068
3069         Cleanup: Remove out-of-date comment and null check from DocumentLoader::detachFromFrame()
3070         https://bugs.webkit.org/show_bug.cgi?id=171604
3071
3072         Reviewed by Brady Eidson.
3073
3074         We no longer want to passively allow DocumentLoader::detachFromFrame() to be called twice.
3075         It does not make sense to be called twice and should never be called twice. A release assert
3076         in DocumentLoader::cancelPolicyCheckIfNeeded() (added in r187558) called by DocumentLoader::detachFromFrame()
3077         enforces this invariant. Therefore we can remove the null check of DocumentLoader::m_frame
3078         and the comment that explains the purpose of this null check from DocumentLoader::detachFromFrame().
3079
3080         * loader/DocumentLoader.cpp:
3081         (WebCore::DocumentLoader::detachFromFrame):
3082
3083 2017-05-03  Ryan Haddad  <ryanhaddad@apple.com>
3084
3085         Unreviewed attempt to fix the Windows build after r216117.
3086         https://bugs.webkit.org/show_bug.cgi?id=171601
3087
3088         * css/CSSAllInOne.cpp:
3089
3090 2017-05-03  Antti Koivisto  <antti@apple.com>
3091
3092         Rename StyleInvalidationAnalysis to Style::Invalidator
3093         https://bugs.webkit.org/show_bug.cgi?id=171601
3094
3095         Reviewed by Žan Doberšek.
3096
3097         Also move it to the 'style' directory.
3098
3099         * CMakeLists.txt:
3100         * WebCore.xcodeproj/project.pbxproj:
3101         * css/StyleInvalidationAnalysis.cpp: Removed.
3102         * css/StyleInvalidationAnalysis.h: Removed.
3103         * dom/ExtensionStyleSheets.cpp:
3104         * style/AttributeChangeInvalidation.cpp:
3105         (WebCore::Style::AttributeChangeInvalidation::invalidateDescendants):
3106         * style/ClassChangeInvalidation.cpp:
3107         (WebCore::Style::ClassChangeInvalidation::invalidateDescendantStyle):
3108         * style/StyleInvalidator.cpp: Copied from Source/WebCore/css/StyleInvalidationAnalysis.cpp.
3109         (WebCore::Style::Invalidator::Invalidator):
3110         (WebCore::Style::Invalidator::invalidateIfNeeded):
3111         (WebCore::Style::Invalidator::invalidateStyleForTree):
3112         (WebCore::Style::Invalidator::invalidateStyle):
3113         (WebCore::shouldDirtyAllStyle): Deleted.
3114         (WebCore::StyleInvalidationAnalysis::StyleInvalidationAnalysis): Deleted.
3115         (WebCore::StyleInvalidationAnalysis::invalidateIfNeeded): Deleted.
3116         (WebCore::StyleInvalidationAnalysis::invalidateStyleForTree): Deleted.
3117         (WebCore::StyleInvalidationAnalysis::invalidateStyle): Deleted.
3118         * style/StyleInvalidator.h: Copied from Source/WebCore/css/StyleInvalidationAnalysis.h.
3119         (WebCore::StyleInvalidationAnalysis::dirtiesAllStyle): Deleted.
3120         (WebCore::StyleInvalidationAnalysis::hasShadowPseudoElementRulesInAuthorSheet): Deleted.
3121         * style/StyleScope.cpp:
3122         (WebCore::Style::Scope::resolver):
3123         (WebCore::Style::Scope::analyzeStyleSheetChange):
3124
3125 2017-05-02  Andrew Gold  <agold@apple.com>
3126
3127         Typo in AVAudioSessionCaptureDeviceManager.mm
3128         https://bugs.webkit.org/show_bug.cgi?id=171572
3129
3130         Reviewed by Jer Noble.
3131
3132         We attempt to call +[AVAudioSession sharedSession], but the actual method is 
3133         called +[AVAudioSession sharedInstance].
3134
3135         * platform/mediastream/ios/AVAudioSessionCaptureDeviceManager.mm:
3136         (WebCore::AVAudioSessionCaptureDeviceManager::refreshAudioCaptureDevices):
3137
3138 2017-05-02  Simon Fraser  <simon.fraser@apple.com>
3139
3140         Improve scrolling tree logging
3141         https://bugs.webkit.org/show_bug.cgi?id=171574
3142
3143         Reviewed by Tim Horton.
3144
3145         Make a call to showScrollingStateTree() print debugging-related information like node and layer IDs.
3146         Required fixing scrolling state tree nodes to respect ScrollingStateTreeAsTextBehavior, and fixing
3147         fixed and sticky nodes to call super.
3148
3149         Also enhance compositing logging to show layer IDs, and to log for layer scrolling tree registration.
3150
3151         * page/scrolling/AsyncScrollingCoordinator.cpp:
3152         (WebCore::AsyncScrollingCoordinator::scrollingStateTreeAsText):
3153         * page/scrolling/AsyncScrollingCoordinator.h:
3154         * page/scrolling/ScrollingCoordinator.cpp:
3155         (WebCore::ScrollingCoordinator::scrollingStateTreeAsText):
3156         * page/scrolling/ScrollingCoordinator.h:
3157         * page/scrolling/ScrollingStateFixedNode.cpp:
3158         (WebCore::ScrollingStateFixedNode::dumpProperties):
3159         * page/scrolling/ScrollingStateNode.cpp:
3160         (WebCore::ScrollingStateNode::dumpProperties):
3161         (WebCore::ScrollingStateNode::scrollingStateTreeAsText):
3162         * page/scrolling/ScrollingStateNode.h:
3163         * page/scrolling/ScrollingStateScrollingNode.cpp:
3164         (WebCore::ScrollingStateScrollingNode::dumpProperties):
3165         * page/scrolling/ScrollingStateStickyNode.cpp:
3166         (WebCore::ScrollingStateStickyNode::dumpProperties):
3167         * page/scrolling/ScrollingStateTree.cpp:
3168         (showScrollingStateTree):
3169         * page/scrolling/mac/ScrollingCoordinatorMac.mm:
3170         (WebCore::ScrollingCoordinatorMac::commitTreeState):
3171         * rendering/RenderLayerBacking.cpp:
3172         (WebCore::RenderLayerBacking::detachFromScrollingCoordinator):
3173         * rendering/RenderLayerCompositor.cpp:
3174         (WebCore::RenderLayerCompositor::logLayerInfo):
3175         (WebCore::RenderLayerCompositor::updateScrollCoordinatedLayer):
3176
3177 2017-05-02  Daniel Bates  <dabates@apple.com>
3178
3179         Using StringView.split() instead of String.split() in some places
3180         https://bugs.webkit.org/show_bug.cgi?id=170925
3181
3182         Reviewed by Darin Adler and Sam Weinig.
3183
3184         Replace some uses of String.split() with StringView.split() (added in r211087) as the latter
3185         avoids the need to allocate an intermediary Vector of substrings. Instead StringView.split()
3186         returns an iterator for traversing the substrings.
3187
3188         No functionality changed. So, no new tests.
3189
3190         * accessibility/AccessibilityObject.cpp: Convert some typedefs to modern C++ using declarations.
3191         (WebCore::AccessibilityObject::ariaRoleToWebCoreRole): Modified code to use StringView.split().
3192         (WebCore::AccessibilityObject::elementsFromAttribute): Ditto.
3193         * dom/TreeScope.cpp:
3194         (WebCore::TreeScope::getElementById): Added.
3195         * dom/TreeScope.h:
3196         * html/LinkRelAttribute.cpp:
3197         (WebCore::LinkRelAttribute::LinkRelAttribute): Modified code to use StringView.split().
3198         * html/parser/XSSAuditor.cpp:
3199         (WebCore::semicolonSeparatedValueContainsJavaScriptURL): Ditto.
3200         * platform/graphics/avfoundation/CDMPrivateMediaSourceAVFObjC.mm:
3201         (WebCore::CDMPrivateMediaSourceAVFObjC::createSession): Ditto.
3202         * platform/network/CacheValidation.cpp:
3203         (WebCore::collectVaryingRequestHeaders): Simplify code by using the String.split(UChar, Vector<String>&) overload.
3204         * svg/SVGAnimationElement.cpp:
3205         (WebCore::parseKeyTimes): Modified code to use StringView.split().
3206         * svg/SVGToOTFFontConversion.cpp:
3207         (WebCore::SVGToOTFFontConverter::SVGToOTFFontConverter): Ditto.
3208         * testing/Internals.cpp:
3209         (WebCore::Internals::setMediaSessionRestrictions): Ditto.
3210         (WebCore::Internals::setMediaElementRestrictions): Ditto.
3211         (WebCore::Internals::setAudioContextRestrictions): Ditto.
3212         (WebCore::Internals::setPageMuted): Ditto.
3213         * testing/Internals.h:
3214
3215 2017-05-02  Gwang Yoon Hwang  <yoon@igalia.com>
3216
3217         [GTK] Drop coordinated surfaces from the compositing thread as soon as possible
3218         https://bugs.webkit.org/show_bug.cgi?id=171544
3219
3220         Reviewed by Žan Doberšek.
3221
3222         * platform/graphics/texmap/coordinated/CoordinatedGraphicsState.h:
3223         Remove atlasesToRemove from the GraphicsState. It is not a commit
3224         state anymore.
3225
3226 2017-05-02  Gwang Yoon Hwang  <yoon@igalia.com>
3227
3228         [GTK] Recycle textures while handling tiles
3229         https://bugs.webkit.org/show_bug.cgi?id=171541
3230
3231         Reviewed by Žan Doberšek.
3232
3233         * platform/graphics/texmap/TextureMapperTile.h:
3234         Modified m_texture as a protected member to avoid unnessary
3235         refcountings from the CoordinatedBackingStore.
3236         * platform/graphics/texmap/coordinated/CoordinatedSurface.h:
3237         Use reference instead of RefPtr to pass BitmapTexture
3238
3239         No new tests since there should be no change in behavior.
3240
3241 2017-05-02  Zalan Bujtas  <zalan@apple.com>
3242
3243         Defer AX cache update when text content changes until after layout is finished.
3244         https://bugs.webkit.org/show_bug.cgi?id=171429
3245         <rdar://problem/31885984>
3246
3247         Reviewed by Simon Fraser.
3248
3249         When the content of the RenderText changes (even as the result of a text-transform change)
3250         instead of updating the AX cache eagerly (and trigger layout on a half-backed render tree)
3251         we should just defer it until after the subsequent layout is done. 
3252
3253         Test: accessibility/crash-while-adding-text-child-with-transform.html
3254
3255         * accessibility/AXObjectCache.cpp:
3256         (WebCore::AXObjectCache::remove):
3257         (WebCore::AXObjectCache::performDeferredCacheUpdate):
3258         (WebCore::AXObjectCache::recomputeDeferredIsIgnored):
3259         (WebCore::AXObjectCache::deferTextChanged):
3260         (WebCore::AXObjectCache::performDeferredIsIgnoredChange): Deleted.
3261         * accessibility/AXObjectCache.h:
3262         (WebCore::AXObjectCache::deferTextChanged):
3263         (WebCore::AXObjectCache::performDeferredCacheUpdate):
3264         (WebCore::AXObjectCache::performDeferredIsIgnoredChange): Deleted.
3265         * page/FrameView.cpp:
3266         (WebCore::FrameView::performPostLayoutTasks):
3267         * rendering/RenderText.cpp:
3268         (WebCore::RenderText::setText):
3269
3270 2017-05-02  Wenson Hsieh  <wenson_hsieh@apple.com>
3271
3272         Remove an extraneous call to dispatch_group_async in WebItemProviderPasteboard.mm
3273         https://bugs.webkit.org/show_bug.cgi?id=171561
3274
3275         Reviewed by Tim Horton.
3276
3277         In -[WebItemProviderPasteboard doAfterLoadingProvidedContentIntoFileURLs:], the lifetime of the dispatch group
3278         `fileLoadingGroup` is already guarded by dispatch_group_enter/leave calls when beginning and concluding an
3279         item provider load, respectively. As such, the call to dispatch_group_async serves no purpose and should be removed.
3280
3281         No new tests, since there is no change in behavior.
3282
3283         * platform/ios/WebItemProviderPasteboard.mm:
3284         (-[WebItemProviderPasteboard doAfterLoadingProvidedContentIntoFileURLs:]):
3285
3286 2017-05-02  Youenn Fablet  <youenn@apple.com>
3287
3288         [LibWebRTC] Set explicitly logging level in debug mode
3289         https://bugs.webkit.org/show_bug.cgi?id=171562
3290
3291         Reviewed by Eric Carlson.
3292
3293         No change of behavior.
3294
3295         * platform/mediastream/libwebrtc/LibWebRTCProvider.cpp:
3296         (WebCore::initializePeerConnectionFactoryAndThreads): Setting explictly LibWebRTC logging to Info level for
3297         debug builds if WebRTC channel is on.
3298
3299 2017-05-02  Joanmarie Diggs  <jdiggs@igalia.com>
3300
3301         AX: Update implementation of aria-orientation
3302         https://bugs.webkit.org/show_bug.cgi?id=171166
3303
3304         Reviewed by Chris Fleizach.
3305
3306         Update AccessibilityRenderObject::orientation() to be consistent with what is
3307         in the ARIA 1.1 spec. Also add an isTreeGrid() convenience method to be consistent
3308         with what we do for other roles.
3309
3310         Test: accessibility/aria-orientation.html
3311
3312         * accessibility/AccessibilityARIAGridRow.cpp:
3313         (WebCore::AccessibilityARIAGridRow::isARIATreeGridRow):
3314         * accessibility/AccessibilityObject.h:
3315         (WebCore::AccessibilityObject::isTreeGrid):
3316         * accessibility/AccessibilityRenderObject.cpp:
3317         (WebCore::AccessibilityRenderObject::orientation):
3318
3319 2017-05-02  Myles C. Maxfield  <mmaxfield@apple.com>
3320
3321         REGRESSION (r211382): Partial right-to-left text runs are painted at an offset (breaks Find indicators, Look Up, and custom ::selection style)
3322         https://bugs.webkit.org/show_bug.cgi?id=169517
3323         <rdar://problem/30652443>
3324
3325         Reviewed by Dean Jackson.
3326
3327         FontCascade::getGlyphsAndAdvancesForComplexText() is tasked with calculating paint advances for a
3328         subrange of RTL text. It does this by creating a ComplexTextController, telling it to iterate to
3329         the beginning of the subrange (outputting to a GlyphBuffer), then telling it to iterate to the end
3330         of the subrange (outputting to another GlyphBuffer). Because the text is RTL, the sum of the
3331         advances gathered so far is the distance from the right edge of the text to the left edge of the
3332         subrange (because we advance in logical order). Therefore, the x-coordinate we are at now is the
3333         total width minus the sum of both of the GlyphBuffers. For some reason, when I wrote this code I
3334         forgot to add in the contribution from the first GlyphBuffer. Unfortunately, this particular
3335         codepath is rarely hit in practice and completely untested, which made me miss it when I wrote it.
3336
3337         Test: fast/text/complex-text-selection.html
3338
3339         * platform/graphics/cocoa/FontCascadeCocoa.mm:
3340         (WebCore::FontCascade::getGlyphsAndAdvancesForComplexText):
3341
3342 2017-05-02  Chris Dumez  <cdumez@apple.com>
3343
3344         [macOS] Flaky Crash under EventTarget::fireEventListeners on imported/blink/paint/deprecatedpaintlayer/non-self-painting-layer-overrides-visibility.html
3345         https://bugs.webkit.org/show_bug.cgi?id=171406
3346         <rdar://problem/30945281>
3347
3348         Reviewed by Eric Carlson.
3349
3350         I was unfortunately unable to reproduce the flaky crash locally. However, the crash trace
3351         indicates that one of the EventTarget::scriptExecutionContext() overrides is returning a
3352         stale ScriptExecutionContext pointer. Since a GenericEventQueue is involved, the EventTarget
3353         is likely a media-related object. I therefore audited media classes that override
3354         EventTarget::scriptExecutionContext() and found several that look unsafe. I am fixing those
3355         by having them override ContextDestructionObserver, instead of having a raw
3356         ScriptExecutionContext pointer member. This makes sure the pointer gets nulled out whenever
3357         the scriptexecutioncontext gets destroyed, ensuring that those classes's
3358         EventTarget::scriptExecutionContext() overrides can never return a stale pointer.
3359
3360         * Modules/mediasource/SourceBufferList.cpp:
3361         (WebCore::SourceBufferList::SourceBufferList):
3362         * Modules/mediasource/SourceBufferList.h:
3363         * html/track/TextTrack.cpp:
3364         (WebCore::TextTrack::TextTrack):
3365         * html/track/TextTrack.h:
3366         * html/track/TrackListBase.cpp:
3367         (TrackListBase::TrackListBase):
3368         * html/track/TrackListBase.h:
3369
3370 2017-05-02  Antti Koivisto  <antti@apple.com>
3371
3372         Document style resolvers should share user rulesets
3373         https://bugs.webkit.org/show_bug.cgi?id=171549
3374
3375         Reviewed by Andreas Kling.
3376
3377         Large user stylesheets (like those used by ad blockers) can end up using lots of memory if
3378         a document uses large number of shadow trees. User style is inherently per-document and
3379         the resulting rulesets can be shared between the document and the shadow trees.
3380
3381         * css/DocumentRuleSets.cpp:
3382         (WebCore::DocumentRuleSets::DocumentRuleSets):
3383         (WebCore::DocumentRuleSets::userStyle):
3384
3385             Return per-document user style for shadow trees.
3386
3387         (WebCore::DocumentRuleSets::collectFeatures):
3388         * css/DocumentRuleSets.h:
3389         (WebCore::DocumentRuleSets::setUsesSharedUserStyle):
3390         (WebCore::DocumentRuleSets::userStyle): Deleted.
3391         * css/StyleResolver.cpp:
3392         (WebCore::StyleResolver::StyleResolver):
3393         (WebCore::StyleResolver::initializeUserStyle):
3394
3395             Separate user style initialization from construction.
3396
3397         * css/StyleResolver.h:
3398         * style/StyleScope.cpp:
3399         (WebCore::Style::Scope::resolver):
3400
3401             Don't initialize user style for user agents shadow trees.
3402
3403 2017-05-02  Myles C. Maxfield  <mmaxfield@apple.com>
3404
3405         Font Loading API specifies font is loaded but sizing of font after load reports inconsistent values
3406         https://bugs.webkit.org/show_bug.cgi?id=168533
3407
3408         Reviewed by Zalan Bujtas.
3409
3410         Previously, we were marking all local() fonts as immediately successful,
3411         regardless of whether or not they were present on the system. Instead, we
3412         should use the load() function to make this determination and mark the font
3413         as failed if it doesn't exist. (This is, after all, the whole point of the
3414         load() function). This brings us in-line with Firefox's and Chrome's
3415         behavior.
3416
3417         Test: fast/text/font-loading-local.html
3418
3419         * css/CSSFontFace.cpp:
3420         (WebCore::CSSFontFace::pump): Remote loading requires the FontSelector,
3421         but it isn't available for local fonts. Now that load() is called for both
3422         local and remote fonts, the ASSERT() should be lowered into the load()
3423         function and scoped to just the case where we have a remote font.
3424         (WebCore::CSSFontFace::font): Ditto.
3425         * css/CSSFontFaceSource.cpp:
3426         (WebCore::CSSFontFaceSource::CSSFontFaceSource): Don't immediatley set
3427         the success/failure state for local fonts.
3428         (WebCore::CSSFontFaceSource::load): Move loading logic from font() to
3429         load(). None of this code is new; it just is moved.
3430         (WebCore::CSSFontFaceSource::font): Delete code moved to load().
3431         * css/CSSFontFaceSource.h:
3432         * css/FontFace.cpp:
3433         (WebCore::FontFace::create):
3434
3435 2017-05-02  Youenn Fablet  <youenn@apple.com>
3436
3437         Allow media stream based videos with sound to autoplay if the page is already playing sound
3438         https://bugs.webkit.org/show_bug.cgi?id=171447
3439
3440         Reviewed by Eric Carlson.
3441