11bed0eaa5a842c45bd7e64ad8811f4b2381c289
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2017-10-19  Daniel Bates  <dabates@apple.com>
2
3         Share logic in InlineTextBox to compute selection rect
4         https://bugs.webkit.org/show_bug.cgi?id=178232
5         <rdar://problem/34963452>
6
7         Reviewed by Zalan Bujtas.
8
9         Currently each paint routine in InlineTextBox duplicates similar code to compute the selection
10         rect it will paint. This change consolidates all the duplication into localSelectionRectWithClampedPositions()
11         and writes all of the paint operations, except for paintCompositionUnderline(), in terms of it.
12         We will write paintCompositionUnderline() in terms of localSelectionRectWithClampedPositions()
13         in a subsequent patch.
14
15         We also write localSelectionRect() in terms of localSelectionRectWithClampedPositions(). Ideally
16         we would have one way to compute the selection rect. However, localSelectionRect() and paintDocumentMarker()
17         currently expect the enclosing integral rectangle of the selection rectangle. The function
18         paintDocumentMarker() needs the enclosing integral rectangle to avoid truncating the dot pattern
19         drawn under marked words (e.g. a spelling error) on Cocoa platforms. With regards to localSelectionRect()
20         we should look to have it return the actual selection rectangle. See <https://bugs.webkit.org/show_bug.cgi?id=138913>
21         for more details.
22
23         * rendering/InlineTextBox.cpp:
24         (WebCore::InlineTextBox::localSelectionRect const): Move logic in common with paintSelection() into
25         localSelectionRectWithClampedPositions() and modified code to use it.
26         (WebCore::InlineTextBox::localSelectionRectWithClampedPositions const): Added.
27         (WebCore::InlineTextBox::paint): Store the local paint offset as a LayoutPoint as it is the canonical
28         data type for representing an offset when painting. Pass the local paint offset instead of the analagous boxOrigin value.
29         (WebCore::InlineTextBox::paintSelection): Write in terms of localSelectionRectWithClampedPositions().
30         (WebCore::InlineTextBox::paintTextSubrangeBackground): Ditto.
31         (WebCore::InlineTextBox::paintCompositionBackground): Ditto.
32         (WebCore::InlineTextBox::paintTextMatchMarker): Ditto.
33         (WebCore::InlineTextBox::paintDocumentMarker): Ditto.
34         (WebCore::InlineTextBox::paintDocumentMarkers): Pass paint offset instead of the analogous boxOrigin value.
35         * rendering/InlineTextBox.h:
36
37 2017-10-19  Daniel Bates  <dabates@apple.com>
38
39         Referrer policy should be inherited from creator
40         https://bugs.webkit.org/show_bug.cgi?id=178403
41         <rdar://problem/31546136>
42
43         Reviewed by Andy Estes.
44
45         As per section Browsing contexts of the the HTML standard, <https://html.spec.whatwg.org/multipage/browsers.html>
46         (17 October 2017), the referrer policy of a document should initially be inherited from its
47         creator.
48
49         Tests: http/tests/security/referrer-policy-nested-subframe.html
50                http/tests/security/referrer-policy-nested-window-open.html
51                http/tests/security/referrer-policy-subframe-window-open.html
52                http/tests/security/referrer-policy-window-open-subframe.html
53
54         * dom/Document.cpp:
55         (WebCore::Document::initSecurityContext): Ask the loader for the effective referrer policy.
56         * loader/FrameLoader.cpp:
57         (WebCore::FrameLoader::effectiveReferrerPolicy const): Added. Returns the referrer policy
58         of the creator document. The creator document is document of the parent frame or the document
59         of the opener for a subframe or child window, respectively. If we do not have a creator frame
60         then we return the default referrer policy, non-referrer-when-downgrade, by <https://www.w3.org/TR/2017/CR-referrer-policy-20170126/#referrer-policy-empty-string>.
61         * loader/FrameLoader.h:
62
63 2017-10-19  Zalan Bujtas  <zalan@apple.com>
64
65         [FrameView::layout cleanup] Do not reenter FrameView::performPostLayoutTasks
66         https://bugs.webkit.org/show_bug.cgi?id=178518
67         <rdar://problem/35075409>
68
69         Reviewed by Antti Koivisto.
70
71         This patch tightens existing reentrancy policy on performPostLayoutTasks.
72
73         Covered by existing test cases.
74
75         * page/FrameView.cpp:
76         (WebCore::FrameView::FrameView):
77         (WebCore::FrameView::reset):
78         (WebCore::FrameView::layout):
79         (WebCore::FrameView::performPostLayoutTasks):
80         * page/FrameView.h:
81
82 2017-10-19  Chris Dumez  <cdumez@apple.com>
83
84         Unreviewed, revert r223650 as it caused crashes on the bots.
85
86         * WebCore.xcodeproj/project.pbxproj:
87         * dom/ScriptExecutionContext.h:
88         * loader/DocumentThreadableLoader.cpp:
89         (WebCore::DocumentThreadableLoader::DocumentThreadableLoader):
90         * loader/FetchOptions.h:
91         * loader/ResourceLoaderOptions.h:
92         * loader/WorkerThreadableLoader.cpp:
93         (WebCore::WorkerThreadableLoader::WorkerThreadableLoader):
94         (WebCore::WorkerThreadableLoader::MainThreadBridge::MainThreadBridge):
95         * loader/WorkerThreadableLoader.h:
96         * platform/network/ResourceRequestBase.h:
97         * platform/network/ResourceResponseBase.h:
98         * workers/WorkerThread.h:
99         * workers/service/ServiceWorkerContainer.cpp:
100         (WebCore::ServiceWorkerContainer::jobResolvedWithRegistration):
101         * workers/service/context/SWContextManager.cpp: Copied from Source/WebKit/WebProcess/Storage/ServiceWorkerContextManager.h.
102         (WebCore::SWContextManager::singleton):
103         (WebCore::SWContextManager::SWContextManager):
104         (WebCore::SWContextManager::startServiceWorkerContext):
105         * workers/service/context/SWContextManager.h: Renamed from Source/WebKit/WebProcess/Storage/ServiceWorkerContextManager.h.
106         * workers/service/context/ServiceWorkerThread.h:
107
108 2017-10-19  Zalan Bujtas  <zalan@apple.com>
109
110         [FrameView::layout cleanup] Replace m_nestedLayoutCount with isLayoutNested()
111         https://bugs.webkit.org/show_bug.cgi?id=178503
112         <rdar://problem/35066561>
113
114         Reviewed by Antti Koivisto.
115
116         Covered by existing tests.
117
118         * page/FrameView.cpp:
119         (WebCore::FrameView::reset):
120         (WebCore::FrameView::layout):
121         (WebCore::FrameView::updateLayerPositionsAfterScrolling):
122         (WebCore::FrameView::updateCompositingLayersAfterScrolling):
123         (WebCore::FrameView::updateEmbeddedObjects):
124         (WebCore::FrameView::flushPostLayoutTasksQueue):
125         (WebCore::FrameView::performPostLayoutTasks):
126         (WebCore::FrameView::startLayoutAtMainFrameViewIfNeeded):
127         * page/FrameView.h:
128
129 2017-10-19  Antti Koivisto  <antti@apple.com>
130
131         Overlapping text on all CSS fonts specs
132         https://bugs.webkit.org/show_bug.cgi?id=177585
133         <rdar://problem/34704078>
134
135         Reviewed by Daniel Bates.
136
137         We were resetting StyleResolver::overrideDocumentElementStyle too early when resolving slot elements.
138         This resulted in 'rem' units being miscomputed.
139
140         Reduction by Zalan.
141
142         Test: fast/html/details-line-height-overlap.html
143
144         * style/StyleTreeResolver.cpp:
145         (WebCore::Style::TreeResolver::Scope::Scope):
146         (WebCore::Style::TreeResolver::Scope::~Scope):
147
148             Only reset overrideDocumentElementStyle when destroying the scope.
149
150         (WebCore::Style::TreeResolver::pushScope):
151         (WebCore::Style::TreeResolver::pushEnclosingScope):
152         (WebCore::Style::TreeResolver::popScope):
153
154             A scope can show up multiple times in scope stack.
155
156         * style/StyleTreeResolver.h:
157
158 2017-10-19  Ryosuke Niwa  <rniwa@webkit.org>
159
160         Consolidate calls to insertedInto and expand the coverage of NoEventDispatchAssertion
161         https://bugs.webkit.org/show_bug.cgi?id=178504
162
163         Reviewed by Antti Koivisto.
164
165         Consolidated calls to notifyChildNodeInserted, childrenChanged, didFinishInsertingNode, and
166         dispatchChildInsertionEvents for inserting a node by executeNodeInsertionWithScriptAssertion,
167         a new templatefunction which takes a closure to do the node insertion to make exactly when
168         the script becomes runnable clear.
169
170         Added an exception to SVGTRefElement::updateReferencedText since this code mutates user agent
171         shadow root during insertedInto, and turned ChildChangeSource into an enum class.
172
173         * dom/CharacterData.cpp:
174         (WebCore::CharacterData::parserAppendData):
175         (WebCore::CharacterData::setDataAndUpdate):
176         * dom/ContainerNode.cpp:
177         (WebCore::executeNodeInsertionWithScriptAssertion): Extracted.
178         (WebCore::ContainerNode::takeAllChildrenFrom): Deployed executeNodeInsertionWithScriptAssertion.
179         (WebCore::ContainerNode::insertBefore): Ditto.
180         (WebCore::ContainerNode::changeForChildInsertion): Deleted.
181         (WebCore::ContainerNode::notifyChildInserted): Deleted.
182         (WebCore::ContainerNode::parserInsertBefore): Deployed executeNodeInsertionWithScriptAssertion. 
183         (WebCore::ContainerNode::replaceChild): Ditto.
184         (WebCore::ContainerNode::removeChild):
185         (WebCore::ContainerNode::parserRemoveChild):
186         (WebCore::ContainerNode::replaceAllChildren): Ditto.
187         (WebCore::ContainerNode::removeChildren):
188         (WebCore::ContainerNode::appendChildWithoutPreInsertionValidityCheck): Ditto.
189         (WebCore::ContainerNode::parserAppendChild): Ditto.
190         (WebCore::ContainerNode::childrenChanged):
191         (WebCore::ContainerNode::updateTreeAfterInsertion): Deleted.
192         * dom/ContainerNode.h:
193         * dom/Element.cpp:
194         (WebCore::Element::childrenChanged):
195         * html/HTMLOutputElement.cpp:
196         (WebCore::HTMLOutputElement::childrenChanged):
197         * svg/SVGClipPathElement.cpp:
198         (WebCore::SVGClipPathElement::childrenChanged):
199         * svg/SVGElement.cpp:
200         (WebCore::SVGElement::childrenChanged):
201         * svg/SVGFELightElement.cpp:
202         (WebCore::SVGFELightElement::childrenChanged):
203         * svg/SVGFilterElement.cpp:
204         (WebCore::SVGFilterElement::childrenChanged):
205         * svg/SVGFilterPrimitiveStandardAttributes.cpp:
206         (WebCore::SVGFilterPrimitiveStandardAttributes::childrenChanged):
207         * svg/SVGGradientElement.cpp:
208         (WebCore::SVGGradientElement::childrenChanged):
209         * svg/SVGMarkerElement.cpp:
210         (WebCore::SVGMarkerElement::childrenChanged):
211         * svg/SVGMaskElement.cpp:
212         (WebCore::SVGMaskElement::childrenChanged):
213         * svg/SVGPatternElement.cpp:
214         (WebCore::SVGPatternElement::childrenChanged):
215         * svg/SVGTRefElement.cpp:
216         (WebCore::SVGTRefElement::updateReferencedText): Allow DOM mutations inside the user agent shadow tree here.
217
218 2017-10-19  Ryosuke Niwa  <rniwa@webkit.org>
219
220         Add an argument indicating the type of removal to Node::removedFrom
221         https://bugs.webkit.org/show_bug.cgi?id=178505
222
223         Reviewed by Antti Koivisto.
224
225         Like r223628, added RemovalType as the first argument to Node::removedFrom, which contains two booleans indicating
226         whether the node just become disconnected from a document, and whether node's tree scope had changed or not.
227
228         These boolean flags simplifies the logic in removedFrom implementations, and are required to have a better
229         guarantee about the correctness of node flags during calls to removedFrom. Right now, Node::isConnected() and
230         Node::isInShadowTree() are both outdated until Node::removedFrom is called.
231
232         Also renamed the second argument of removedFrom to parentOfRemovedTree to make the semantics clear.
233
234         Note that in some implementations of removedFrom, we check whether isConnected() was true to decide whether
235         the node had already been disconnected from a document prior to calls to this particular call of removedFrom.
236         This extra check is no longer necessary since no node will be removed from a document without first being inserted
237         completely somewhere after r223458.
238
239         No new tests since there should be no behavioral changes.
240
241         * dom/ContainerNodeAlgorithms.cpp:
242         (WebCore::notifyNodeInsertedIntoDocument): Replaced RELEASE_ASSERT with RELEASE_ASSERT_WITH_SECURITY_IMPLICATION.
243         (WebCore::notifyNodeRemovedFromDocument): Replaced the check that the node had not been re-connected by scripts
244         by a release assert now that we believe we've eliminated all causes of these unwanted DOM mutations in r223458.
245         Also moved the code to call setCSSTarget to Element::removedFrom. This random call to setCSSTarget predates r114351,
246         as well as r40475. It was originally introduced by r29311 into Node::removedFromDocument() ten years ago.
247         (WebCore::notifyNodeRemovedFromTree): Moved NoEventDispatchAssertion to notifyChildNodeRemoved.
248         (WebCore::notifyChildNodeRemoved): Added NoEventDispatchAssertion.
249         * dom/ContainerNodeAlgorithms.h:
250         * dom/Element.cpp:
251         (WebCore::Element::removedFrom): Replaced the complicated code to detect when this element is removed from a document
252         and its tree scope had changed by removalType.disconnectedFromDocument and removalType.treeScopeChanged.
253         * dom/Element.h:
254         * dom/Node.cpp:
255         (WebCore::Node::removedFrom):
256         * dom/Node.h: Replaced a long block of comments above insertedInto by two lines of concise comments now that
257         the semantics of insertedInto and didFinishInsertingNode are more clear, and enforced by assertions.
258         (WebCore::Node::RemovalType::RemovalType): Addedl
259         * dom/ProcessingInstruction.cpp:
260         (WebCore::ProcessingInstruction::removedFrom):
261         * dom/ProcessingInstruction.h:
262         * dom/ShadowRoot.cpp:
263         (WebCore::ShadowRoot::removedFrom): The extra !isConnected() check is no longer needed. See the description above.
264         * dom/ShadowRoot.h:
265         * html/FormAssociatedElement.cpp:
266         (WebCore::FormAssociatedElement::removedFrom):
267         * html/FormAssociatedElement.h:
268         * html/HTMLBaseElement.cpp:
269         (WebCore::HTMLBaseElement::removedFrom):
270         * html/HTMLBaseElement.h:
271         * html/HTMLFormControlElement.cpp:
272         (WebCore::HTMLFormControlElement::removedFrom):
273         * html/HTMLFormControlElement.h:
274         * html/HTMLFormControlElementWithState.cpp:
275         (WebCore::HTMLFormControlElementWithState::removedFrom):
276         * html/HTMLFormControlElementWithState.h:
277         * html/HTMLFormElement.cpp:
278         (WebCore::HTMLFormElement::removedFrom):
279         * html/HTMLFormElement.h:
280         * html/HTMLFrameSetElement.cpp:
281         (WebCore::HTMLFrameSetElement::removedFrom):
282         * html/HTMLFrameSetElement.h:
283         * html/HTMLImageElement.cpp:
284         (WebCore::HTMLImageElement::removedFrom):
285         * html/HTMLImageElement.h:
286         * html/HTMLInputElement.cpp:
287         (WebCore::HTMLInputElement::removedFrom):
288         * html/HTMLInputElement.h:
289         * html/HTMLLinkElement.cpp:
290         (WebCore::HTMLLinkElement::removedFrom): The extra !isConnected() check is no longer needed. See above.
291         * html/HTMLLinkElement.h:
292         * html/HTMLMapElement.cpp:
293         (WebCore::HTMLMapElement::removedFrom):
294         * html/HTMLMapElement.h:
295         * html/HTMLMediaElement.cpp:
296         (WebCore::HTMLMediaElement::removedFrom):
297         * html/HTMLMediaElement.h:
298         * html/HTMLObjectElement.cpp:
299         (WebCore::HTMLObjectElement::removedFrom):
300         * html/HTMLObjectElement.h:
301         * html/HTMLSlotElement.cpp:
302         (WebCore::HTMLSlotElement::removedFrom): Simplifies the logic to detect when this slot element is being
303         removed from a shadow tree using removalType.treeScopeChanged.
304         * html/HTMLSlotElement.h:
305         * html/HTMLSourceElement.cpp:
306         (WebCore::HTMLSourceElement::insertedInto): Added a FIXME for an obvious bug.
307         (WebCore::HTMLSourceElement::removedFrom): Ditto.
308         * html/HTMLSourceElement.h:
309         * html/HTMLStyleElement.cpp:
310         (WebCore::HTMLStyleElement::removedFrom):
311         * html/HTMLStyleElement.h:
312         * html/HTMLTitleElement.cpp:
313         (WebCore::HTMLTitleElement::removedFrom):
314         * html/HTMLTitleElement.h:
315         * html/HTMLTrackElement.cpp:
316         (WebCore::HTMLTrackElement::removedFrom): Ditto.
317         * html/HTMLTrackElement.h:
318         * svg/SVGElement.cpp:
319         (WebCore::SVGElement::removedFrom): Replaced isConnected() check before calling Node::removedFrom by the check of
320         removalType.disconnectedFromDocument.
321         * svg/SVGElement.h:
322         * svg/SVGFEImageElement.cpp:
323         (WebCore::SVGFEImageElement::removedFrom):
324         * svg/SVGFEImageElement.h:
325         * svg/SVGFontFaceElement.cpp:
326         (WebCore::SVGFontFaceElement::removedFrom):
327         * svg/SVGFontFaceElement.h:
328         * svg/SVGMPathElement.cpp:
329         (WebCore::SVGMPathElement::removedFrom):
330         * svg/SVGMPathElement.h:
331         * svg/SVGPathElement.cpp:
332         (WebCore::SVGPathElement::removedFrom):
333         * svg/SVGPathElement.h:
334         * svg/SVGSVGElement.cpp:
335         (WebCore::SVGSVGElement::removedFrom):
336         * svg/SVGSVGElement.h:
337         * svg/SVGStyleElement.cpp:
338         (WebCore::SVGStyleElement::removedFrom): The extra !isConnected() check is no longer needed. See above.
339         * svg/SVGStyleElement.h:
340         * svg/SVGTRefElement.cpp:
341         (WebCore::SVGTRefElement::removedFrom):
342         * svg/SVGTRefElement.h:
343         * svg/SVGTextPathElement.cpp:
344         (WebCore::SVGTextPathElement::removedFrom):
345         * svg/SVGTextPathElement.h:
346         * svg/SVGTitleElement.cpp:
347         (WebCore::SVGTitleElement::removedFrom):
348         * svg/SVGTitleElement.h:
349         * svg/SVGUseElement.cpp:
350         (WebCore::SVGUseElement::removedFrom):
351         * svg/SVGUseElement.h:
352         * svg/animation/SVGSMILElement.cpp:
353         (WebCore::SVGSMILElement::removedFrom):
354         * svg/animation/SVGSMILElement.h:
355
356 2017-10-19  Ms2ger  <Ms2ger@igalia.com>
357
358         Update the signatures of compressedTexSubImage3D.
359         https://bugs.webkit.org/show_bug.cgi?id=178507
360
361         Reviewed by Ryosuke Niwa.
362
363         No new tests: not much point in adding tests now; this method doesn't
364         do anything anyway.
365
366         * html/canvas/WebGL2RenderingContext.cpp:
367         (WebCore::WebGL2RenderingContext::compressedTexSubImage3D):
368         * html/canvas/WebGL2RenderingContext.h:
369         * html/canvas/WebGL2RenderingContext.idl:
370
371 2017-10-19  Basuke Suzuki  <Basuke.Suzuki@sony.com>
372
373         [curl] Segfault in WebCore::CurlRequest::setupPOST
374         https://bugs.webkit.org/show_bug.cgi?id=178434
375
376         Reviewed by Ryosuke Niwa.
377
378         * platform/network/curl/CurlRequest.cpp:
379         (WebCore::CurlRequest::resolveBlobReferences):
380         (WebCore::CurlRequest::setupPOST):
381
382 2017-10-18  Ryosuke Niwa  <rniwa@webkit.org>
383
384         Don't expose raw HTML in pasteboard to the web content
385         https://bugs.webkit.org/show_bug.cgi?id=178422
386         <rdar://problem/34567052>
387
388         Reviewed by Wenson Hsieh.
389
390         This patch enables HTML sanitization added in r223440 when WebKit pastes & concludes edit drag as opposed to
391         just when dataTransfer.get is used. This is important to avoid leaking privacy sensitive information such as
392         local file paths and pasting potentially harmful content such as scripts in event handler serialized by
393         WebKit prior to r223462. In addition, we start using blob URLs in the pasted content instead of retaining
394         the original URL and overriding the document loader like r222839 for RTFD and r222119 for image files.
395
396         To do this, a new superclass FrameWebContentReader of PasteboardWebContentReader and WebContentMarkupReader
397         is introduced, and helper functions are extracted out of WebContentMarkupReader in WebContentReaderCocoa.mm
398         to be also used in WebContentReader.
399
400         Tests: http/tests/security/clipboard/copy-paste-html-cross-origin-iframe-across-origin.html
401                http/tests/security/clipboard/copy-paste-html-cross-origin-iframe-in-same-origin.html
402                http/tests/security/clipboard/drag-drop-html-cross-origin-iframe-in-same-origin.html
403                PasteWebArchive.SanitizesHTML
404
405         * editing/WebContentReader.cpp:
406         (WebCore::FrameWebContentReader::shouldSanitize const): Moved from WebContentMarkupReader.
407         * editing/WebContentReader.h:
408         (WebCore::FrameWebContentReader): Added to share code between WebContentReader and WebContentMarkupReader.
409         (WebCore::FrameWebContentReader::FrameWebContentReader): Added.
410         * editing/cocoa/EditorCocoa.mm:
411         (WebCore::Editor::writeSelectionToPasteboard): Store the content's origin in the pasteboard so that we can
412         avoid sanitizing the content when pasting into the same document. This is important since converting all URLs
413         into blob URLs would break editors on the Web which tracks images, etc... in the content using URLs.
414         (WebCore::Editor::writeSelection): Ditto.
415         * editing/cocoa/WebContentReaderCocoa.mm:
416         (WebCore::MarkupAndArchive): Replaced FragmentAndArchive. Now returns the markup string in the archive
417         instead of the parsed fragment.
418         (WebCore::extractMarkupAndArchive): Renamed from createFragmentFromWebArchive. Now returns the markup string.
419         (WebCore::sanitizeMarkupWithArchive): Extracted out of WebContentMarkupReader::readWebArchive to share code
420         between WebContentReader and WebContentMarkupReader, and added the code to handle subframes recursively.
421         As inefficient as this code is, we can't delay the conversion of subframes' marksup until later time since
422         the main frame's markup would contain blob URLs to refer to those subframes. 
423         (WebCore::WebContentReader::readWebArchive): Use sanitizeMarkupWithArchive when shouldSanitize() is true.
424         Don't add the subresources to the document loader when the content will be loaded into the same origin since
425         subresouces are mostly likely available in the document anyway.
426         (WebCore::WebContentMarkupReader::readWebArchive):
427         * platform/Pasteboard.h:
428         (WebCore::PasteboardWebContent): Added contentOrigin.
429         * platform/PasteboardWriterData.h:
430         (WebCore::PasteboardWriterData): Ditto.
431         * platform/ios/PasteboardIOS.mm:
432         (WebCore::Pasteboard::read): Read the origin before branching out to readRespectingUTIFidelities.
433         * platform/ios/PlatformPasteboardIOS.mm:
434         (WebCore::PlatformPasteboard::write): Record the content origin into the pasteboard.
435         * platform/mac/PasteboardMac.mm:
436         (WebCore::Pasteboard::write): Ditto.
437         * platform/mac/PasteboardWriter.mm:
438         (WebCore::createPasteboardWriter): Ditto.
439
440 2017-10-18  Sam Weinig  <sam@webkit.org>
441
442         Another attempt to fix the windows build.
443
444         * page/SettingsBase.cpp:
445         (WebCore::SettingsBase::resourceUsageOverlayVisibleChanged):
446         * page/SettingsBase.h:
447
448 2017-10-18  Sam Weinig  <sam@webkit.org>
449
450         Attempt to fix the windows build.
451
452         * page/SettingsBase.cpp:
453         (WebCore::SettingsBase::resourceUsageOverlayVisibleChanged):
454         * page/SettingsBase.h:
455
456 2017-10-18  Sam Weinig  <sam@webkit.org>
457
458         [Settings] Convert more settings to be generated
459         https://bugs.webkit.org/show_bug.cgi?id=177766
460
461         Reviewed by Dean Jackson.
462
463         - Replaces setNeedsStyleRecalcInAllFrames option in Settings.in
464           with a more generic, onChange, which allows you to specify a function
465           in SettingsBase that will be called when the setting changes. 
466           setNeedsStyleRecalcInAllFrames is then reimplemented in terms of
467           onChange.
468         - Moves most (all but two) of the remaining non-static settings from
469           SettingsBase to Settings.in
470
471         * Scripts/GenerateSettings/GenerateSettingsImplementationFile.py:
472         (printSetterBody):
473         * Scripts/GenerateSettings/Settings.py:
474         (Setting.__init__):
475         (Setting.__str__):
476         (Setting.typeIsValueType):
477         (Setting.setterFunctionName):
478         (Setting.setterChangeFunctionName):
479         (Setting.hasComplexSetter):
480         (parseInput):
481         
482             Add support for the onChange option.
483         
484         * page/Settings.in:
485
486             Migrate most of the remaining non-static settings to Settings.in.
487             Adopt onChange option.
488
489         * page/SettingsBase.cpp:
490         * page/SettingsBase.h:
491
492             Add helper functions for use by the onChange option.
493
494 2017-10-18  Chris Dumez  <cdumez@apple.com>
495
496         Implement ServiceWorkerRegistration.scope / updateViaCache
497         https://bugs.webkit.org/show_bug.cgi?id=178497
498
499         Reviewed by Youenn Fablet.
500
501         Implement ServiceWorkerRegistration.scope / updateViaCache.
502
503         No new tests, updated existing test.
504
505         * WebCore.xcodeproj/project.pbxproj:
506         * workers/service/ServiceWorkerContainer.cpp:
507         (WebCore::ServiceWorkerContainer::jobResolvedWithRegistration):
508         * workers/service/ServiceWorkerContainer.h:
509         * workers/service/ServiceWorkerJob.cpp:
510         (WebCore::ServiceWorkerJob::resolvedWithRegistration):
511         * workers/service/ServiceWorkerJob.h:
512         * workers/service/ServiceWorkerJobClient.h:
513         * workers/service/ServiceWorkerRegistration.cpp:
514         (WebCore::ServiceWorkerRegistration::ServiceWorkerRegistration):
515         (WebCore::ServiceWorkerRegistration::scope const):
516         (WebCore::ServiceWorkerRegistration::updateViaCache const):
517         (WebCore::ServiceWorkerRegistration::update):
518         (WebCore::ServiceWorkerRegistration::unregister):
519         (WebCore::ServiceWorkerRegistration::scriptExecutionContext const):
520         (WebCore::ServiceWorkerRegistration::activeDOMObjectName const):
521         (WebCore::ServiceWorkerRegistration::canSuspendForDocumentSuspension const):
522         * workers/service/ServiceWorkerRegistration.h:
523         * workers/service/ServiceWorkerRegistration.idl:
524         * workers/service/ServiceWorkerRegistrationData.cpp:
525         (WebCore::ServiceWorkerRegistrationData::isolatedCopy const):
526         * workers/service/ServiceWorkerRegistrationData.h:
527         (WebCore::ServiceWorkerRegistrationData::encode const):
528         (WebCore::ServiceWorkerRegistrationData::decode):
529         * workers/service/server/SWClientConnection.cpp:
530         (WebCore::SWClientConnection::jobResolvedInServer):
531         * workers/service/server/SWClientConnection.h:
532         * workers/service/server/SWServerRegistration.cpp:
533         (WebCore::SWServerRegistration::scriptContextStarted):
534         (WebCore::SWServerRegistration::data const):
535
536 2017-10-18  Youenn Fablet  <youenn@apple.com>
537
538         Add preliminary support for ServiceWorker Handle Fetch
539         https://bugs.webkit.org/show_bug.cgi?id=178475
540
541         Reviewed by Chris Dumez.
542
543         Test: http/tests/workers/service/basic-fetch.https.html
544
545         Adding parameters to allow WebKit to do loading through Service Worker or through regular networking.
546         A script context is now storing its selected service worker identifier. This should be fully implemented later on.
547         This selected service worker identifier is passed to loading code as a ResourceLoaderOptions field.
548         Service workers mode is also added as a ResourceLoaderOptions field so that the service worker can be bypassed.
549
550         * WebCore.xcodeproj/project.pbxproj:
551         * dom/ScriptExecutionContext.h:
552         (WebCore::ScriptExecutionContext::selectedServiceWorkerIdentifier const):
553         (WebCore::ScriptExecutionContext::setSelectedServiceWorkerIdentifier):
554         * loader/DocumentThreadableLoader.cpp:
555         (WebCore::DocumentThreadableLoader::DocumentThreadableLoader):
556         * loader/FetchOptions.h:
557         (WebCore::isPotentialNavigationOrSubresourceRequest):
558         (WebCore::isNonSubresourceRequest):
559         * loader/ResourceLoaderOptions.h:
560         * loader/WorkerThreadableLoader.cpp:
561         (WebCore::WorkerThreadableLoader::WorkerThreadableLoader):
562         (WebCore::WorkerThreadableLoader::MainThreadBridge::MainThreadBridge):
563         * loader/WorkerThreadableLoader.h:
564         * platform/network/ResourceRequestBase.h:
565         * platform/network/ResourceResponseBase.h:
566         * workers/WorkerThread.h:
567         * workers/service/ServiceWorkerContainer.cpp:
568         (WebCore::ServiceWorkerContainer::jobResolvedWithRegistration):
569         * workers/service/ServiceWorkerProvider.h:
570         * workers/service/context/SWContextManager.cpp: Removed.
571         * workers/service/context/ServiceWorkerThread.h:
572         * workers/service/server/SWServer.h:
573
574 2017-10-18  Zalan Bujtas  <zalan@apple.com>
575
576         [FrameView::layout cleanup] Group related pre-layout code to improve readability
577         https://bugs.webkit.org/show_bug.cgi?id=178496
578         <rdar://problem/35065718>
579
580         Reviewed by Simon Fraser.
581
582         Early returns/asserts/member variable resets etc.
583
584         Covered by existing tests.
585
586         * page/FrameView.cpp:
587         (WebCore::FrameView::layout):
588
589 2017-10-17  Jiewen Tan  <jiewen_tan@apple.com>
590
591         Replace some stack raw pointers with RefPtrs within WebCore/html
592         https://bugs.webkit.org/show_bug.cgi?id=178201
593         <rdar://problem/34841692>
594
595         Reviewed by Ryosuke Niwa.
596
597         This is an effort to reduce raw pointer usage in DOM code. In this patch, raw pointers
598         that are ref countable are blindly selected to be replaced with RefPtrs with one exception
599         which is auto*.
600
601         Also, this patch occasionally modifies the return type of some methods, and therefore callers
602         of those methods are modified accordingly.
603
604         * Modules/encryptedmedia/legacy/LegacyCDM.cpp:
605         (WebCore::LegacyCDM::mediaPlayer const):
606         * Modules/encryptedmedia/legacy/LegacyCDM.h:
607         * Modules/encryptedmedia/legacy/LegacyCDMPrivateMediaPlayer.cpp:
608         (WebCore::CDMPrivateMediaPlayer::createSession):
609         * Modules/encryptedmedia/legacy/WebKitMediaKeys.cpp:
610         (WebCore::WebKitMediaKeys::cdmMediaPlayer const):
611         * Modules/encryptedmedia/legacy/WebKitMediaKeys.h:
612         * Modules/mediacontrols/MediaControlsHost.cpp:
613         (WebCore::MediaControlsHost::externalDeviceDisplayName const):
614         (WebCore::MediaControlsHost::externalDeviceType const):
615         * dom/Element.cpp:
616         (WebCore::Element::focusDelegate):
617         (WebCore::Element::userAgentShadowRoot const):
618         (WebCore::Element::ensureUserAgentShadowRoot):
619         * dom/Element.h:
620         * dom/EventContext.cpp:
621         (WebCore::TouchEventContext::checkReachability const):
622         * dom/EventPath.cpp:
623         (WebCore::shouldEventCrossShadowBoundary):
624         (WebCore::EventPath::setRelatedTarget):
625         (WebCore::EventPath::retargetTouch):
626         (WebCore:: const):
627         * dom/EventTarget.cpp:
628         (WebCore::EventTarget::toNode):
629         (WebCore::EventTarget::addEventListener):
630         * dom/EventTarget.h:
631         * dom/MouseEvent.cpp:
632         (WebCore::MouseEvent::toElement const):
633         (WebCore::MouseEvent::fromElement const):
634         * dom/MouseEvent.h:
635         * dom/MouseRelatedEvent.cpp:
636         (WebCore::MouseRelatedEvent::computeRelativePosition):
637         * dom/Node.cpp:
638         (WebCore::Node::toNode):
639         * dom/Node.h:
640         * dom/ScopedEventQueue.cpp:
641         * editing/Editor.cpp:
642         (WebCore::Editor::selectionForCommand):
643         * editing/EditorCommand.cpp:
644         (WebCore::targetFrame):
645         * editing/TextIterator.cpp:
646         (WebCore::TextIterator::handleReplacedElement):
647         * html/BaseChooserOnlyDateAndTimeInputType.cpp:
648         (WebCore::BaseChooserOnlyDateAndTimeInputType::updateAppearance):
649         * html/ColorInputType.cpp:
650         (WebCore::ColorInputType::updateColorSwatch):
651         (WebCore::ColorInputType::shadowColorSwatch const):
652         * html/FileInputType.cpp:
653         (WebCore::FileInputType::disabledAttributeChanged):
654         (WebCore::FileInputType::multipleAttributeChanged):
655         * html/FormAssociatedElement.cpp:
656         (WebCore::FormAssociatedElement::findAssociatedForm):
657         (WebCore::FormAssociatedElement::formOwnerRemovedFromTree):
658         (WebCore::FormAssociatedElement::resetFormOwner):
659         (WebCore::FormAssociatedElement::formAttributeChanged):
660         * html/FormController.cpp:
661         (WebCore::recordFormStructure):
662         (WebCore::FormKeyGenerator::formKey):
663         (WebCore::FormController::restoreControlStateIn):
664         * html/HTMLAnchorElement.cpp:
665         (WebCore::appendServerMapMousePosition):
666         (WebCore::HTMLAnchorElement::handleClick):
667         * html/HTMLAppletElement.cpp:
668         (WebCore::HTMLAppletElement::updateWidget):
669         * html/HTMLAreaElement.cpp:
670         (WebCore::HTMLAreaElement::imageElement const):
671         (WebCore::HTMLAreaElement::isFocusable const):
672         (WebCore::HTMLAreaElement::setFocus):
673         (WebCore::HTMLAreaElement::updateFocusAppearance):
674         * html/HTMLBodyElement.cpp:
675         (WebCore::HTMLBodyElement::scrollLeft):
676         (WebCore::HTMLBodyElement::setScrollLeft):
677         (WebCore::HTMLBodyElement::scrollTop):
678         (WebCore::HTMLBodyElement::setScrollTop):
679         (WebCore::HTMLBodyElement::scrollHeight):
680         (WebCore::HTMLBodyElement::scrollWidth):
681         * html/HTMLCanvasElement.cpp:
682         (WebCore::HTMLCanvasElement::createElementRenderer):
683         (WebCore:: const):
684         * html/HTMLDocument.cpp:
685         (WebCore::HTMLDocument::width):
686         (WebCore::HTMLDocument::height):
687         * html/HTMLElement.cpp:
688         (WebCore::HTMLElement::rendererIsNeeded):
689         (WebCore::setHasDirAutoFlagRecursively):
690         (WebCore::HTMLElement::directionality const):
691         (WebCore::HTMLElement::dirAttributeChanged):
692         (WebCore::HTMLElement::adjustDirectionalityIfNeededAfterChildrenChanged):
693         * html/HTMLEmbedElement.cpp:
694         (WebCore::HTMLEmbedElement::renderWidgetLoadingPlugin const):
695         (WebCore::HTMLEmbedElement::rendererIsNeeded):
696         * html/HTMLFieldSetElement.cpp:
697         (WebCore::updateFromControlElementsAncestorDisabledStateUnder):
698         (WebCore::HTMLFieldSetElement::disabledStateChanged):
699         (WebCore::HTMLFieldSetElement::childrenChanged):
700         * html/HTMLFormControlElement.cpp:
701         (WebCore::HTMLFormControlElement::computeIsDisabledByFieldsetAncestor const):
702         (WebCore::HTMLFormControlElement::setNeedsWillValidateCheck):
703         (WebCore::HTMLFormControlElement::didChangeForm):
704         (WebCore::HTMLFormControlElement::shouldAutocorrect const):
705         (WebCore::HTMLFormControlElement::autocapitalizeType const):
706         * html/HTMLFormElement.cpp:
707         (WebCore::HTMLFormElement::handleLocalEvents):
708         (WebCore::submitElementFromEvent):
709         (WebCore::HTMLFormElement::prepareForSubmission):
710         (WebCore::HTMLFormElement::submit):
711         (WebCore::HTMLFormElement::reset):
712         (WebCore::HTMLFormElement::shouldAutocorrect const):
713         (WebCore::HTMLFormElement::parseAttribute):
714         (WebCore::HTMLFormElement::resetDefaultButton):
715         (WebCore::HTMLFormElement::elementFromPastNamesMap const):
716         (WebCore::HTMLFormElement::namedElements):
717         * html/HTMLFormElement.h:
718         * html/HTMLFrameElement.cpp:
719         (WebCore::HTMLFrameElement::didAttachRenderers):
720         * html/HTMLFrameElementBase.cpp:
721         (WebCore::HTMLFrameElementBase::isURLAllowed const):
722         (WebCore::HTMLFrameElementBase::openURL):
723         (WebCore::HTMLFrameElementBase::didAttachRenderers):
724         * html/HTMLFrameOwnerElement.cpp:
725         (WebCore::HTMLFrameOwnerElement::setContentFrame):
726         (WebCore::HTMLFrameOwnerElement::clearContentFrame):
727         (WebCore::HTMLFrameOwnerElement::disconnectContentFrame):
728         (WebCore::SubframeLoadingDisabler::canLoadFrame):
729         * html/HTMLFrameSetElement.cpp:
730         (WebCore::HTMLFrameSetElement::findContaining):
731         (WebCore::HTMLFrameSetElement::willAttachRenderers):
732         (WebCore::HTMLFrameSetElement::insertedInto):
733         (WebCore::HTMLFrameSetElement::removedFrom):
734         * html/HTMLFrameSetElement.h:
735         * html/HTMLImageElement.cpp:
736         (WebCore::HTMLImageElement::bestFitSourceFromPictureElement):
737         (WebCore::HTMLImageElement::pictureElement const):
738         (WebCore::HTMLImageElement::destroyImageControls):
739         (WebCore::HTMLImageElement::hasImageControls const):
740         * html/HTMLInputElement.cpp:
741         (WebCore::HTMLInputElement::innerTextElement const):
742         (WebCore::HTMLInputElement::endEditing):
743         (WebCore::HTMLInputElement::dataList const):
744         (WebCore::HTMLInputElement::resetListAttributeTargetObserver): Deleted.
745         (WebCore::HTMLInputElement::listAttributeTargetChanged): Deleted.
746         (WebCore::HTMLInputElement::isSteppable const): Deleted.
747         (WebCore::HTMLInputElement::dateType const): Deleted.
748         (WebCore::HTMLInputElement::isTextButton const): Deleted.
749         (WebCore::HTMLInputElement::isRadioButton const): Deleted.
750         (WebCore::HTMLInputElement::isSearchField const): Deleted.
751         (WebCore::HTMLInputElement::isInputTypeHidden const): Deleted.
752         (WebCore::HTMLInputElement::isPasswordField const): Deleted.
753         (WebCore::HTMLInputElement::isCheckbox const): Deleted.
754         (WebCore::HTMLInputElement::isRangeControl const): Deleted.
755         (WebCore::HTMLInputElement::isColorControl const): Deleted.
756         (WebCore::HTMLInputElement::isText const): Deleted.
757         (WebCore::HTMLInputElement::isEmailField const): Deleted.
758         (WebCore::HTMLInputElement::isFileUpload const): Deleted.
759         (WebCore::HTMLInputElement::isImageButton const): Deleted.
760         (WebCore::HTMLInputElement::isNumberField const): Deleted.
761         (WebCore::HTMLInputElement::isSubmitButton const): Deleted.
762         (WebCore::HTMLInputElement::isTelephoneField const): Deleted.
763         (WebCore::HTMLInputElement::isURLField const): Deleted.
764         (WebCore::HTMLInputElement::isDateField const): Deleted.
765         (WebCore::HTMLInputElement::isDateTimeField const): Deleted.
766         (WebCore::HTMLInputElement::isDateTimeLocalField const): Deleted.
767         (WebCore::HTMLInputElement::isMonthField const): Deleted.
768         (WebCore::HTMLInputElement::isTimeField const): Deleted.
769         (WebCore::HTMLInputElement::isWeekField const): Deleted.
770         (WebCore::HTMLInputElement::isEnumeratable const): Deleted.
771         (WebCore::HTMLInputElement::supportLabels const): Deleted.
772         (WebCore::HTMLInputElement::shouldAppearChecked const): Deleted.
773         (WebCore::HTMLInputElement::supportsPlaceholder const): Deleted.
774         (WebCore::HTMLInputElement::updatePlaceholderText): Deleted.
775         (WebCore::HTMLInputElement::isEmptyValue const): Deleted.
776         (WebCore::HTMLInputElement::maxLengthAttributeChanged): Deleted.
777         (WebCore::HTMLInputElement::minLengthAttributeChanged): Deleted.
778         (WebCore::HTMLInputElement::updateValueIfNeeded): Deleted.
779         (WebCore::HTMLInputElement::defaultToolTip const): Deleted.
780         (WebCore::HTMLInputElement::matchesIndeterminatePseudoClass const): Deleted.
781         (WebCore::HTMLInputElement::shouldAppearIndeterminate const): Deleted.
782         (WebCore::HTMLInputElement::mediaCaptureType const): Deleted.
783         (WebCore::HTMLInputElement::isInRequiredRadioButtonGroup): Deleted.
784         (WebCore:: const): Deleted.
785         (WebCore::HTMLInputElement::checkedRadioButtonForGroup const): Deleted.
786         (WebCore::HTMLInputElement::radioButtonGroups const): Deleted.
787         (WebCore::HTMLInputElement::addToRadioButtonGroup): Deleted.
788         (WebCore::HTMLInputElement::removeFromRadioButtonGroup): Deleted.
789         (WebCore::HTMLInputElement::height const): Deleted.
790         (WebCore::HTMLInputElement::width const): Deleted.
791         (WebCore::HTMLInputElement::setHeight): Deleted.
792         (WebCore::HTMLInputElement::setWidth): Deleted.
793         (WebCore::ListAttributeTargetObserver::ListAttributeTargetObserver): Deleted.
794         (WebCore::ListAttributeTargetObserver::idTargetChanged): Deleted.
795         (WebCore::HTMLInputElement::setRangeText): Deleted.
796         (WebCore::HTMLInputElement::shouldTruncateText const): Deleted.
797         (WebCore::HTMLInputElement::selectionStartForBindings const): Deleted.
798         (WebCore::HTMLInputElement::setSelectionStartForBindings): Deleted.
799         (WebCore::HTMLInputElement::selectionEndForBindings const): Deleted.
800         (WebCore::HTMLInputElement::setSelectionEndForBindings): Deleted.
801         (WebCore::HTMLInputElement::selectionDirectionForBindings const): Deleted.
802         (WebCore::HTMLInputElement::setSelectionDirectionForBindings): Deleted.
803         (WebCore::HTMLInputElement::setSelectionRangeForBindings): Deleted.
804         (WebCore::HTMLInputElement::createInnerTextStyle const): Deleted.
805         (WebCore::HTMLInputElement::setupDateTimeChooserParameters): Deleted.
806         (WebCore::HTMLInputElement::capsLockStateMayHaveChanged): Deleted.
807         * html/HTMLInputElement.h:
808         * html/HTMLKeygenElement.cpp:
809         (WebCore::HTMLKeygenElement::shadowSelect const):
810         * html/HTMLLabelElement.cpp:
811         (WebCore::HTMLLabelElement::defaultEventHandler):
812         * html/HTMLLinkElement.cpp:
813         (WebCore::HTMLLinkElement::handleClick):
814         * html/HTMLMapElement.cpp:
815         (WebCore::HTMLMapElement::mapMouseEvent):
816         * html/HTMLMediaElement.cpp:
817         (WebCore::HTMLMediaElement::selectMediaResource):
818         (WebCore::HTMLMediaElement::loadResource):
819         (WebCore::HTMLMediaElement::updateActiveTextTrackCues):
820         (WebCore::HTMLMediaElement::isSafeToLoadURL):
821         (WebCore::HTMLMediaElement::controls const):
822         (WebCore::HTMLMediaElement::layoutSizeChanged):
823         (WebCore::HTMLMediaElement::enterFullscreen):
824         (WebCore::HTMLMediaElement::mediaControls const):
825         (WebCore::HTMLMediaElement::hasMediaControls const):
826         (WebCore::HTMLMediaElement::mediaPlayerReferrer const):
827         (WebCore::HTMLMediaElement::mediaPlayerUserAgent const):
828         (WebCore::HTMLMediaElement::mediaPlayerShouldWaitForResponseToAuthenticationChallenge):
829         (WebCore::HTMLMediaElement::sourceApplicationIdentifier const):
830         (WebCore::HTMLMediaElement::getVideoPlaybackQuality):
831         (WebCore::HTMLMediaElement::session const):
832         * html/HTMLMediaElement.h:
833         (WebCore::HTMLMediaElement::player const):
834         * html/HTMLObjectElement.cpp:
835         (WebCore::HTMLObjectElement::hasFallbackContent const):
836         * html/HTMLOptGroupElement.cpp:
837         (WebCore::HTMLOptGroupElement::ownerSelectElement const):
838         (WebCore::HTMLOptGroupElement::accessKeyAction):
839         * html/HTMLOptionElement.cpp:
840         (WebCore::HTMLOptionElement::setText):
841         (WebCore::HTMLOptionElement::accessKeyAction):
842         (WebCore::HTMLOptionElement::index const):
843         (WebCore::HTMLOptionElement::parseAttribute):
844         (WebCore::HTMLOptionElement::selected):
845         (WebCore::HTMLOptionElement::setSelected):
846         (WebCore::HTMLOptionElement::setSelectedState):
847         (WebCore::HTMLOptionElement::childrenChanged):
848         (WebCore::HTMLOptionElement::ownerDataListElement const):
849         (WebCore::HTMLOptionElement::ownerSelectElement const):
850         (WebCore::HTMLOptionElement::textIndentedToRespectGroupLabel const):
851         (WebCore::HTMLOptionElement::insertedInto):
852         (WebCore::HTMLOptionElement::collectOptionInnerText const):
853         * html/HTMLPlugInElement.cpp:
854         (WebCore::HTMLPlugInElement::willDetachRenderers):
855         (WebCore::HTMLPlugInElement::isKeyboardFocusable const):
856         (WebCore::HTMLPlugInElement::isUserObservable const):
857         * html/HTMLPlugInImageElement.cpp:
858         (WebCore::HTMLPlugInImageElement::partOfSnapshotOverlay const):
859         (WebCore::HTMLPlugInImageElement::restartSimilarPlugIns):
860         * html/HTMLSelectElement.cpp:
861         (WebCore::HTMLSelectElement::add):
862         (WebCore::HTMLSelectElement::recalcListItems const):
863         (WebCore::HTMLSelectElement::selectOption):
864         (WebCore::HTMLSelectElement::reset):
865         (WebCore::HTMLSelectElement::listBoxDefaultEventHandler):
866         * html/HTMLSlotElement.cpp:
867         (WebCore::flattenAssignedNodes):
868         * html/HTMLSourceElement.cpp:
869         (WebCore::HTMLSourceElement::removedFrom):
870         * html/HTMLSummaryElement.cpp:
871         (WebCore::HTMLSummaryElement::isActiveSummary const):
872         (WebCore::isClickableControl):
873         (WebCore::HTMLSummaryElement::defaultEventHandler):
874         * html/HTMLTableCellElement.cpp:
875         (WebCore::HTMLTableCellElement::additionalPresentationAttributeStyle const):
876         * html/HTMLTableColElement.cpp:
877         (WebCore::HTMLTableColElement::additionalPresentationAttributeStyle const):
878         * html/HTMLTableElement.cpp:
879         (WebCore::HTMLTableElement::tHead const):
880         (WebCore::HTMLTableElement::setTHead):
881         (WebCore::HTMLTableElement::tFoot const):
882         (WebCore::HTMLTableElement::createTBody):
883         (WebCore::HTMLTableElement::lastBody const):
884         (WebCore::HTMLTableElement::deleteRow):
885         * html/HTMLTablePartElement.cpp:
886         (WebCore::HTMLTablePartElement::findParentTable const):
887         * html/HTMLTableRowsCollection.cpp:
888         (WebCore::HTMLTableRowsCollection::rowAfter):
889         * html/HTMLTextAreaElement.cpp:
890         (WebCore::HTMLTextAreaElement::subtreeHasChanged):
891         (WebCore::HTMLTextAreaElement::innerTextElement const):
892         * html/HTMLTextAreaElement.h:
893         * html/HTMLTextFormControlElement.cpp:
894         (WebCore::HTMLTextFormControlElement::setSelectionRange):
895         (WebCore::HTMLTextFormControlElement::indexForVisiblePosition const):
896         (WebCore::HTMLTextFormControlElement::visiblePositionForIndex const):
897         (WebCore::HTMLTextFormControlElement::computeSelectionStart const):
898         (WebCore::HTMLTextFormControlElement::computeSelectionEnd const):
899         (WebCore::HTMLTextFormControlElement::computeSelectionDirection const):
900         (WebCore::HTMLTextFormControlElement::selection const):
901         (WebCore::HTMLTextFormControlElement::updateInnerTextElementEditability):
902         (WebCore::innerTextValueFrom):
903         (WebCore::HTMLTextFormControlElement::setInnerTextValue):
904         (WebCore::HTMLTextFormControlElement::innerTextValue const):
905         (WebCore::positionForIndex):
906         (WebCore::HTMLTextFormControlElement::indexForPosition const):
907         (WebCore::HTMLTextFormControlElement::hidePlaceholder):
908         (WebCore::HTMLTextFormControlElement::showPlaceholderIfNecessary):
909         (WebCore::HTMLTextFormControlElement::valueWithHardLineBreaks const):
910         (WebCore::enclosingTextFormControl):
911         (WebCore::HTMLTextFormControlElement::adjustInnerTextStyle const):
912         * html/HTMLTextFormControlElement.h:
913         * html/HTMLTrackElement.cpp:
914         (WebCore::HTMLTrackElement::canLoadURL):
915         (WebCore::HTMLTrackElement::setReadyState):
916         (WebCore::HTMLTrackElement::mediaElementCrossOriginAttribute const):
917         (WebCore::HTMLTrackElement::textTrackKindChanged):
918         (WebCore::HTMLTrackElement::textTrackModeChanged):
919         (WebCore::HTMLTrackElement::textTrackAddCues):
920         (WebCore::HTMLTrackElement::textTrackRemoveCues):
921         (WebCore::HTMLTrackElement::textTrackAddCue):
922         (WebCore::HTMLTrackElement::textTrackRemoveCue):
923         (WebCore::HTMLTrackElement::mediaElement const):
924         * html/HTMLTrackElement.h:
925         * html/HTMLVideoElement.cpp:
926         (WebCore::HTMLVideoElement::setDisplayMode):
927         (WebCore::HTMLVideoElement::paintCurrentFrameInContext):
928         * html/ImageDocument.cpp:
929         (WebCore::ImageDocument::createDocumentStructure):
930         (WebCore::ImageDocument::scale):
931         (WebCore::ImageDocument::imageFitsInWindow):
932         * html/InputType.cpp:
933         (WebCore::InputType::destroyShadowSubtree):
934         * html/InputType.h:
935         (WebCore::InputType::innerTextElement const):
936         * html/MediaDocument.cpp:
937         (WebCore::MediaDocumentParser::createDocumentStructure):
938         (WebCore::MediaDocument::defaultEventHandler):
939         * html/MediaElementSession.cpp:
940         (WebCore::MediaElementSession::wirelessVideoPlaybackDisabled const):
941         (WebCore::MediaElementSession::setWirelessVideoPlaybackDisabled):
942         (WebCore::isMainContentForPurposesOfAutoplay):
943         * html/NumberInputType.cpp:
944         (WebCore::NumberInputType::decorationWidth const):
945         * html/PluginDocument.cpp:
946         (WebCore::PluginDocumentParser::appendBytes):
947         * html/RadioInputType.cpp:
948         (WebCore::RadioInputType::handleKeydownEvent):
949         (WebCore::RadioInputType::isKeyboardFocusable const):
950         (WebCore::RadioInputType::didDispatchClick):
951         * html/RadioNodeList.cpp:
952         (WebCore::RadioNodeList::checkElementMatchesRadioNodeListFilter const):
953         * html/RangeInputType.cpp:
954         (WebCore::RangeInputType::handleMouseDownEvent):
955         (WebCore::RangeInputType::handleTouchEvent):
956         (WebCore::RangeInputType::sliderTrackElement const):
957         (WebCore::RangeInputType::listAttributeTargetChanged):
958         (WebCore::RangeInputType::updateTickMarkValues):
959         * html/SearchInputType.cpp:
960         (WebCore::SearchInputType::createShadowSubtree):
961         * html/TextFieldInputType.cpp:
962         (WebCore::TextFieldInputType::isEmptyValue const):
963         (WebCore::TextFieldInputType::handleKeydownEvent):
964         (WebCore::TextFieldInputType::handleFocusEvent):
965         (WebCore::TextFieldInputType::innerTextElement const):
966         (WebCore::TextFieldInputType::updatePlaceholderText):
967         (WebCore::TextFieldInputType::didSetValueByUserEdit):
968         (WebCore::TextFieldInputType::shouldDrawCapsLockIndicator const):
969         * html/TextFieldInputType.h:
970         * html/canvas/CanvasRenderingContext2D.cpp:
971         (WebCore::size):
972         (WebCore::CanvasRenderingContext2D::drawImage):
973         * html/canvas/WebGL2RenderingContext.cpp:
974         (WebCore::WebGL2RenderingContext::copyBufferSubData):
975         (WebCore::WebGL2RenderingContext::getBufferSubData):
976         * html/canvas/WebGLFramebuffer.cpp:
977         (WebCore::WebGLFramebuffer::attach):
978         (WebCore::WebGLFramebuffer::getAttachmentObject const):
979         (WebCore::WebGLFramebuffer::removeAttachmentFromBoundFramebuffer):
980         (WebCore::WebGLFramebuffer::getColorBufferWidth const):
981         (WebCore::WebGLFramebuffer::getColorBufferHeight const):
982         (WebCore::WebGLFramebuffer::getColorBufferFormat const):
983         (WebCore::WebGLFramebuffer::checkStatus const):
984         (WebCore::WebGLFramebuffer::hasStencilBuffer const):
985         (WebCore::WebGLFramebuffer::initializeAttachments):
986         * html/canvas/WebGLRenderingContext.cpp:
987         (WebCore::WebGLRenderingContext::getFramebufferAttachmentParameter):
988         * html/canvas/WebGLRenderingContextBase.cpp:
989         (WebCore::WebGLRenderingContextBase::create):
990         (WebCore::WebGLRenderingContextBase::bufferData):
991         (WebCore::WebGLRenderingContextBase::bufferSubData):
992         (WebCore::WebGLRenderingContextBase::compressedTexImage2D):
993         (WebCore::WebGLRenderingContextBase::compressedTexSubImage2D):
994         (WebCore::WebGLRenderingContextBase::copyTexSubImage2D):
995         (WebCore::WebGLRenderingContextBase::generateMipmap):
996         (WebCore::WebGLRenderingContextBase::getAttachedShaders):
997         (WebCore::WebGLRenderingContextBase::getTexParameter):
998         (WebCore::WebGLRenderingContextBase::linkProgramWithoutInvalidatingAttribLocations):
999         (WebCore::WebGLRenderingContextBase::texImage2DBase):
1000         (WebCore::WebGLRenderingContextBase::validateTexFunc):
1001         (WebCore::WebGLRenderingContextBase::texSubImage2D):
1002         (WebCore::WebGLRenderingContextBase::texSubImage2DBase):
1003         (WebCore::WebGLRenderingContextBase::copyTexImage2D):
1004         (WebCore::WebGLRenderingContextBase::texImage2D):
1005         (WebCore::WebGLRenderingContextBase::texParameter):
1006         (WebCore::WebGLRenderingContextBase::loseContextImpl):
1007         (WebCore::WebGLRenderingContextBase::checkTextureCompleteness):
1008         (WebCore::WebGLRenderingContextBase::validateTextureBinding):
1009         (WebCore::WebGLRenderingContextBase::maybeRestoreContext):
1010         * html/canvas/WebGPURenderPassColorAttachmentDescriptor.cpp:
1011         (WebCore::WebGPURenderPassColorAttachmentDescriptor::clearColor const):
1012         (WebCore::WebGPURenderPassColorAttachmentDescriptor::setClearColor):
1013         * html/canvas/WebGPURenderPassDepthAttachmentDescriptor.cpp:
1014         (WebCore::WebGPURenderPassDepthAttachmentDescriptor::clearDepth const):
1015         (WebCore::WebGPURenderPassDepthAttachmentDescriptor::setClearDepth):
1016         * html/parser/HTMLConstructionSite.cpp:
1017         (WebCore::executeInsertAlreadyParsedChildTask):
1018         (WebCore::HTMLConstructionSite::insertTextNode):
1019         * html/parser/HTMLFormattingElementList.cpp:
1020         (WebCore::HTMLFormattingElementList::tryToEnsureNoahsArkConditionQuickly):
1021         * html/parser/HTMLParserOptions.cpp:
1022         (WebCore::HTMLParserOptions::HTMLParserOptions):
1023         * html/parser/HTMLParserScheduler.cpp:
1024         (WebCore::HTMLParserScheduler::shouldYieldBeforeExecutingScript):
1025         * html/parser/HTMLTreeBuilder.cpp:
1026         (WebCore::HTMLTreeBuilder::processStartTagForInBody):
1027         (WebCore::HTMLTreeBuilder::callTheAdoptionAgency):
1028         (WebCore::HTMLTreeBuilder::resetInsertionModeAppropriately):
1029         * html/parser/XSSAuditor.cpp:
1030         (WebCore::XSSAuditor::init):
1031         * html/shadow/MediaControlElementTypes.cpp:
1032         (WebCore::parentMediaElement):
1033         * html/shadow/MediaControlElementTypes.h:
1034         (WebCore::parentMediaElement):
1035         * html/shadow/MediaControlElements.cpp:
1036         (WebCore::MediaControlPanelElement::startDrag):
1037         (WebCore::MediaControlPanelElement::endDrag):
1038         (WebCore::MediaControlVolumeSliderContainerElement::defaultEventHandler):
1039         (WebCore::MediaControlClosedCaptionsTrackListElement::defaultEventHandler):
1040         (WebCore::MediaControlClosedCaptionsTrackListElement::updateDisplay):
1041         (WebCore::MediaControlClosedCaptionsTrackListElement::rebuildTrackListMenu):
1042         (WebCore::MediaControlFullscreenButtonElement::defaultEventHandler):
1043         (WebCore::MediaControlTextTrackContainerElement::updateDisplay):
1044         (WebCore::MediaControlTextTrackContainerElement::updateActiveCuesFontSize):
1045         (WebCore::MediaControlTextTrackContainerElement::updateTextStrokeStyle):
1046         (WebCore::MediaControlTextTrackContainerElement::updateTextTrackRepresentation):
1047         (WebCore::MediaControlTextTrackContainerElement::clearTextTrackRepresentation):
1048         (WebCore::MediaControlTextTrackContainerElement::updateSizes):
1049         (WebCore::MediaControlTextTrackContainerElement::createTextTrackRepresentationImage):
1050         * html/shadow/MediaControls.cpp:
1051         (WebCore::MediaControls::containsRelatedTarget):
1052         * html/shadow/SliderThumbElement.cpp:
1053         (WebCore::SliderThumbElement::isDisabledFormControl const):
1054         (WebCore::SliderThumbElement::matchesReadWritePseudoClass const):
1055         (WebCore::SliderThumbElement::focusDelegate):
1056         (WebCore::SliderThumbElement::setPositionFromPoint):
1057         (WebCore::SliderThumbElement::startDragging):
1058         (WebCore::SliderThumbElement::stopDragging):
1059         (WebCore::SliderThumbElement::defaultEventHandler):
1060         (WebCore::SliderThumbElement::willRespondToMouseMoveEvents):
1061         (WebCore::SliderThumbElement::willRespondToMouseClickEvents):
1062         (WebCore::SliderThumbElement::willDetachRenderers):
1063         (WebCore::findTouchWithIdentifier):
1064         (WebCore::SliderThumbElement::handleTouchStart):
1065         (WebCore::SliderThumbElement::handleTouchMove):
1066         (WebCore::SliderThumbElement::handleTouchEndAndCancel):
1067         (WebCore::SliderThumbElement::handleTouchEvent):
1068         (WebCore::SliderThumbElement::hostInput const):
1069         * html/shadow/SliderThumbElement.h:
1070         * html/shadow/SpinButtonElement.cpp:
1071         (WebCore::SpinButtonElement::defaultEventHandler):
1072         (WebCore::SpinButtonElement::releaseCapture):
1073         * html/shadow/TextControlInnerElements.cpp:
1074         (WebCore::TextControlInnerTextElement::defaultEventHandler):
1075         (WebCore::SearchFieldCancelButtonElement::willRespondToMouseClickEvents):
1076         * html/shadow/mac/ImageControlsButtonElementMac.cpp:
1077         (WebCore::ImageControlsButtonElementMac::defaultEventHandler):
1078         * html/track/LoadableTextTrack.cpp:
1079         (WebCore::LoadableTextTrack::trackElementIndex):
1080         * html/track/TextTrack.cpp:
1081         (WebCore::TextTrack::setMode):
1082         (WebCore::TextTrack::hasCue):
1083         * html/track/TextTrackCueGeneric.cpp:
1084         (WebCore::TextTrackCueGenericBoxElement::applyCSSProperties):
1085         * html/track/VTTCue.cpp:
1086         (WebCore::VTTCue::copyWebVTTNodeToDOMTree):
1087         (WebCore::VTTCue::determineTextDirection):
1088         (WebCore::VTTCue::markFutureAndPastNodes):
1089         (WebCore::VTTCue::removeDisplayTree):
1090         (WebCore::VTTCue::cueContentsMatch const):
1091         * inspector/InspectorDOMAgent.cpp:
1092         (WebCore::InspectorDOMAgent::didAddEventListener):
1093         (WebCore::InspectorDOMAgent::willRemoveEventListener):
1094         * loader/FormSubmission.cpp:
1095         (WebCore::FormSubmission::create):
1096         * page/ContextMenuController.cpp:
1097         (WebCore::ContextMenuController::maybeCreateContextMenu):
1098         * rendering/RenderSnapshottedPlugIn.cpp:
1099         (WebCore::RenderSnapshottedPlugIn::handleEvent):
1100         * rendering/RenderTextControl.cpp:
1101         (WebCore::RenderTextControl::innerTextElement const):
1102         (WebCore::RenderTextControl::styleDidChange):
1103         (WebCore::RenderTextControl::textBlockLogicalWidth const):
1104         (WebCore::RenderTextControl::computeLogicalHeight const):
1105         (WebCore::RenderTextControl::hitInnerTextElement):
1106         (WebCore::RenderTextControl::canScroll const):
1107         (WebCore::RenderTextControl::innerLineHeight const):
1108         * rendering/RenderTextControl.h:
1109         * rendering/RenderTextControlSingleLine.cpp:
1110         (WebCore::RenderTextControlSingleLine::nodeAtPoint):
1111         (WebCore::RenderTextControlSingleLine::styleDidChange):
1112         * rendering/RenderTheme.cpp:
1113         (WebCore::RenderTheme::isFocused const):
1114         * rendering/RenderThemeGtk.cpp:
1115         (WebCore::RenderThemeGtk::paintMediaSliderTrack):
1116         (WebCore::RenderThemeGtk::paintMediaVolumeSliderTrack):
1117         * rendering/RenderThemeMac.mm:
1118         (WebCore::RenderThemeMac::paintSliderThumb):
1119         * rendering/RenderVideo.cpp:
1120         (WebCore::RenderVideo::willBeDestroyed):
1121         (WebCore::RenderVideo::calculateIntrinsicSize):
1122         (WebCore::RenderVideo::paintReplaced):
1123         (WebCore::RenderVideo::updatePlayer):
1124         (WebCore::RenderVideo::supportsAcceleratedRendering const):
1125         (WebCore::RenderVideo::acceleratedRenderingStateChanged):
1126         (WebCore::RenderVideo::requiresImmediateCompositing const):
1127         (WebCore::RenderVideo::foregroundIsKnownToBeOpaqueInRect const):
1128         * svg/SVGUseElement.cpp:
1129         (WebCore::SVGUseElement::clearShadowTree):
1130         (WebCore::SVGUseElement::targetClone const):
1131
1132 2017-10-18  Dean Jackson  <dino@apple.com>
1133
1134         Some older hardware can't actually use renderbuffers at the size they advertise
1135         https://bugs.webkit.org/show_bug.cgi?id=178417
1136         <rdar://problem/35042291>
1137
1138         Reviewed by Tim Horton.
1139
1140         The change in r223567 caused some older hardware to fail, because even though
1141         they claimed to support a maximum renderbuffer and viewport of 16K, they were
1142         unable to actually handle one. Rather than trying to identify such hardware,
1143         clamp all buffers to a maximum of 8192. This is bigger than the previous value
1144         of 4096, and large enough to have a full-screen buffer on a Retina 5K iMac.
1145
1146         * platform/graphics/opengl/GraphicsContext3DOpenGL.cpp:
1147         (WebCore::GraphicsContext3D::getIntegerv):
1148
1149 2017-10-18  Chris Dumez  <cdumez@apple.com>
1150
1151         [Service Worker] Add stubs for Client / WindowClient / Clients
1152         https://bugs.webkit.org/show_bug.cgi?id=178469
1153
1154         Reviewed by Youenn Fablet.
1155
1156         Add stubs for Client / WindowClient / Clients:
1157         - https://w3c.github.io/ServiceWorker/v1/#clients
1158         - https://w3c.github.io/ServiceWorker/v1/#client-interface
1159
1160         * CMakeLists.txt:
1161         * DerivedSources.make:
1162         * WebCore.xcodeproj/project.pbxproj:
1163         * bindings/js/WebCoreBuiltinNames.h:
1164         * dom/Document.cpp:
1165         (WebCore::Document::visibilityState const):
1166         * dom/Document.h:
1167         * dom/Document.idl:
1168         * dom/VisibilityState.h: Renamed from Source/WebCore/page/PageVisibilityState.h.
1169         * dom/VisibilityState.idl: Copied from Source/WebCore/workers/service/ServiceWorkerGlobalScope.idl.
1170         * page/Page.cpp:
1171         (WebCore::Page::visibilityState const):
1172         * page/Page.h:
1173         * workers/service/ServiceWorkerClient.cpp: Copied from Source/WebCore/workers/service/ServiceWorkerGlobalScope.idl.
1174         (WebCore::ServiceWorkerClient::ServiceWorkerClient):
1175         (WebCore::ServiceWorkerClient::activeDOMObjectName const):
1176         (WebCore::ServiceWorkerClient::canSuspendForDocumentSuspension const):
1177         (WebCore::ServiceWorkerClient::url const):
1178         (WebCore::ServiceWorkerClient::frameType const):
1179         (WebCore::ServiceWorkerClient::id const):
1180         (WebCore::ServiceWorkerClient::postMessage):
1181         * workers/service/ServiceWorkerClient.h: Copied from Source/WebCore/workers/service/ServiceWorkerGlobalScope.idl.
1182         * workers/service/ServiceWorkerClient.idl: Copied from Source/WebCore/workers/service/ServiceWorkerGlobalScope.idl.
1183         * workers/service/ServiceWorkerClients.cpp: Copied from Source/WebCore/workers/service/ServiceWorkerGlobalScope.cpp.
1184         (WebCore::ServiceWorkerClients::ServiceWorkerClients):
1185         (WebCore::ServiceWorkerClients::activeDOMObjectName const):
1186         (WebCore::ServiceWorkerClients::canSuspendForDocumentSuspension const):
1187         (WebCore::ServiceWorkerClients::get):
1188         (WebCore::ServiceWorkerClients::matchAll):
1189         (WebCore::ServiceWorkerClients::openWindow):
1190         (WebCore::ServiceWorkerClients::claim):
1191         * workers/service/ServiceWorkerClients.h: Copied from Source/WebCore/workers/service/ServiceWorkerGlobalScope.h.
1192         (WebCore::ServiceWorkerClients::create):
1193         * workers/service/ServiceWorkerClients.idl: Copied from Source/WebCore/workers/service/ServiceWorkerGlobalScope.idl.
1194         * workers/service/ServiceWorkerGlobalScope.cpp:
1195         (WebCore::ServiceWorkerGlobalScope::ServiceWorkerGlobalScope):
1196         * workers/service/ServiceWorkerGlobalScope.h:
1197         (WebCore::ServiceWorkerGlobalScope::clients):
1198         * workers/service/ServiceWorkerGlobalScope.idl:
1199         * workers/service/ServiceWorkerWindowClient.cpp: Copied from Source/WebCore/workers/service/ServiceWorkerGlobalScope.idl.
1200         (WebCore::ServiceWorkerWindowClient::ServiceWorkerWindowClient):
1201         (WebCore::ServiceWorkerWindowClient::visibilityState const):
1202         (WebCore::ServiceWorkerWindowClient::isFocused const):
1203         (WebCore::ServiceWorkerWindowClient::focus):
1204         (WebCore::ServiceWorkerWindowClient::navigate):
1205         * workers/service/ServiceWorkerWindowClient.h: Copied from Source/WebCore/workers/service/ServiceWorkerGlobalScope.idl.
1206         * workers/service/ServiceWorkerWindowClient.idl: Copied from Source/WebCore/workers/service/ServiceWorkerGlobalScope.idl.
1207
1208 2017-10-18  Zalan Bujtas  <zalan@apple.com>
1209
1210         [FrameView::layout cleanup] Use SetForScope to protect m_needsFullRepaint's value on reentrancy
1211         https://bugs.webkit.org/show_bug.cgi?id=178479
1212         <rdar://problem/35056950>
1213
1214         Reviewed by Simon Fraser.
1215
1216         No change in functionality.
1217
1218         * page/FrameView.cpp:
1219         (WebCore::FrameView::layout):
1220
1221 2017-10-18  Zalan Bujtas  <zalan@apple.com>
1222
1223         [FrameView::layout cleanup] Remove InPreLayoutStyleUpdate.
1224         https://bugs.webkit.org/show_bug.cgi?id=178483
1225         <rdar://problem/35058800>
1226
1227         Reviewed by Simon Fraser.
1228
1229         Its client, updateCompositingLayersAfterStyleChange only needs to know if there's a upcoming
1230         layer update (part of FrameView::layout()).
1231
1232         No change in functionality.
1233
1234         * page/FrameView.cpp:
1235         (WebCore::FrameView::updateCompositingLayersAfterStyleChange):
1236         (WebCore::FrameView::layout):
1237         * page/FrameView.h:
1238
1239 2017-10-18  Chris Dumez  <cdumez@apple.com>
1240
1241         Global constructors exposed to service workers should go on ServiceWorkerGlobalScope interface
1242         https://bugs.webkit.org/show_bug.cgi?id=178482
1243
1244         Reviewed by Sam Weinig.
1245
1246         Global constructors exposed to service workers should go on ServiceWorkerGlobalScope interface,
1247         not the ServiceWorker interface.
1248
1249         * bindings/scripts/preprocess-idls.pl:
1250
1251 2017-10-17  Ryosuke Niwa  <rniwa@webkit.org>
1252
1253         Add an argument indicating the type of insertion to Node::insertedInto
1254         https://bugs.webkit.org/show_bug.cgi?id=178431
1255
1256         Reviewed by Antti Koivisto.
1257
1258         Added InsertionType as the first argument to Node::insertedInto, which contains two booleans indicating
1259         whether the node just become newly connected to a document, and whether node's tree scope had changed or not.
1260
1261         These boolean flags simplifie the logic in insertedInto implementations, and are required to have a better
1262         guarantee about the correctness of node flags during calls to insertedInto. Right now, isConnected() and
1263         isInShadowTree() are both outdated until Node::insertedInto is called.
1264
1265         Also renamed the second argument from insertionPoint to parentOfInsertedTree to make the semantics clear,
1266         and renamed finishedInsertingSubtree to didFinishInsertingNode, and renamed InsertionNotificationRequest
1267         to InsertedIntoResult using enum class.
1268
1269         Note that in some implementations of insertedInto, we check whether isConnected() was false to decide whether
1270         the node is newly connected to a document. This extra check is no longer necessary since no node will be inserted
1271         into a document without first being completely removed after r223458.
1272
1273         No new tests since there should be no behavioral changes.
1274
1275         * dom/ContainerNode.cpp:
1276         (WebCore::ContainerNode::notifyChildInserted):
1277         * dom/ContainerNodeAlgorithms.cpp:
1278         (WebCore::notifyNodeInsertedIntoDocument): Replaced the check that the node had not been disconnected by scripts
1279         by a release assert now that we believe we've eliminated all causes of these unwanted DOM mutations in r223458.
1280         (WebCore::notifyNodeInsertedIntoTree): Removed NoEventDispatchAssertion since notifyChildNodeInserted has it
1281         already since r223458.
1282         (WebCore::notifyChildNodeInserted): Made this function return NodeVector (copy elision).
1283         * dom/ContainerNodeAlgorithms.h:
1284         * dom/Element.cpp:
1285         (WebCore::Element::insertedInto): Use insertionType.connectedToDocument to detect when this element had become
1286         connected to some document. Similarly, use insertionType.treeScopeChanged to detect when this element had been
1287         inserted into a new tree scope. Removed the comment which became obsolete due to this cleanup.
1288         (WebCore::Element::addShadowRoot): Simplified the code here since we never attach a ShadowRoot with children.
1289         * dom/Element.h:
1290         * dom/Node.cpp:
1291         (WebCore::Node::insertedInto):
1292         * dom/Node.h:
1293         (WebCore::Node::InsertedIntoResult): Renamed from InsertionNotificationRequest, and turned into an enum class.
1294         (WebCore::Node::InsertionType): Added. We pass this object by value to insertedInto as a performance optimization
1295         as passing two booleans by value is faster than passing a pointer and then de-referencing it in a virtual callee.
1296         (WebCore::Node::didFinishInsertingNode): Renamed from finishedInsertingSubtree.
1297         * dom/ProcessingInstruction.cpp:
1298         (WebCore::ProcessingInstruction::insertedInto):
1299         (WebCore::ProcessingInstruction::didFinishInsertingNode): Renamed from finishedInsertingSubtree.
1300         * dom/ProcessingInstruction.h:
1301         * dom/ScriptElement.cpp:
1302         (WebCore::ScriptElement::shouldCallFinishedInsertingSubtree): Deleted.
1303         (WebCore::ScriptElement::didFinishInsertingNode): Renamed from finishedInsertingSubtree.
1304         * dom/ScriptElement.h:
1305         (WebCore::ScriptElement::insertedInto const): Added. Extracted from shouldCallFinishedInsertingSubtree.
1306         * dom/ShadowRoot.cpp:
1307         (WebCore::ShadowRoot::insertedInto): The extra isConnected() check is no longer needed. See the description above.
1308         * dom/ShadowRoot.h:
1309         * html/FormAssociatedElement.cpp:
1310         (WebCore::FormAssociatedElement::insertedInto):
1311         * html/FormAssociatedElement.h:
1312         * html/HTMLBaseElement.cpp:
1313         (WebCore::HTMLBaseElement::insertedInto):
1314         * html/HTMLBaseElement.h:
1315         * html/HTMLBodyElement.cpp:
1316         (WebCore::HTMLBodyElement::insertedInto):
1317         (WebCore::HTMLBodyElement::didFinishInsertingNode): Renamed from finishedInsertingSubtree.
1318         * html/HTMLBodyElement.h:
1319         * html/HTMLFormControlElement.cpp:
1320         (WebCore::HTMLFormControlElement::insertedInto):
1321         (WebCore::HTMLFormControlElement::didFinishInsertingNode): Renamed from finishedInsertingSubtree.
1322         * html/HTMLFormControlElement.h:
1323         * html/HTMLFormControlElementWithState.cpp:
1324         (WebCore::HTMLFormControlElementWithState::insertedInto):
1325         * html/HTMLFormControlElementWithState.h:
1326         * html/HTMLFormElement.cpp:
1327         (WebCore::HTMLFormElement::insertedInto):
1328         * html/HTMLFormElement.h:
1329         * html/HTMLFrameElementBase.cpp:
1330         (WebCore::HTMLFrameElementBase::insertedInto):
1331         (WebCore::HTMLFrameElementBase::didFinishInsertingNode): Renamed from finishedInsertingSubtree.
1332         * html/HTMLFrameElementBase.h:
1333         * html/HTMLFrameSetElement.cpp:
1334         (WebCore::HTMLFrameSetElement::insertedInto):
1335         * html/HTMLFrameSetElement.h:
1336         * html/HTMLImageElement.cpp:
1337         (WebCore::HTMLImageElement::insertedInto):
1338         * html/HTMLImageElement.h:
1339         * html/HTMLInputElement.cpp:
1340         (WebCore::HTMLInputElement::insertedInto):
1341         (WebCore::HTMLInputElement::didFinishInsertingNode): Renamed from finishedInsertingSubtree.
1342         * html/HTMLInputElement.h:
1343         * html/HTMLLinkElement.cpp:
1344         (WebCore::HTMLLinkElement::insertedInto): The extra isConnected() check is no longer needed. See above.
1345         (WebCore::HTMLLinkElement::didFinishInsertingNode): Renamed from finishedInsertingSubtree.
1346         * html/HTMLLinkElement.h:
1347         * html/HTMLMapElement.cpp:
1348         (WebCore::HTMLMapElement::insertedInto):
1349         * html/HTMLMapElement.h:
1350         * html/HTMLMediaElement.cpp:
1351         (WebCore::HTMLMediaElement::insertedInto):
1352         (WebCore::HTMLMediaElement::didFinishInsertingNode): Renamed from finishedInsertingSubtree.
1353         * html/HTMLMediaElement.h:
1354         * html/HTMLMetaElement.cpp:
1355         (WebCore::HTMLMetaElement::insertedInto):
1356         * html/HTMLMetaElement.h:
1357         * html/HTMLObjectElement.cpp:
1358         (WebCore::HTMLObjectElement::insertedInto):
1359         (WebCore::HTMLObjectElement::didFinishInsertingNode): Renamed from finishedInsertingSubtree.
1360         * html/HTMLObjectElement.h:
1361         * html/HTMLOptionElement.cpp:
1362         (WebCore::HTMLOptionElement::insertedInto):
1363         * html/HTMLOptionElement.h:
1364         * html/HTMLScriptElement.cpp:
1365         (WebCore::HTMLScriptElement::insertedInto):
1366         (WebCore::HTMLScriptElement::didFinishInsertingNode): Renamed from finishedInsertingSubtree.
1367         * html/HTMLScriptElement.h:
1368         * html/HTMLSelectElement.cpp:
1369         (WebCore::HTMLSelectElement::insertedInto):
1370         * html/HTMLSelectElement.h:
1371         * html/HTMLSlotElement.cpp:
1372         (WebCore::HTMLSlotElement::insertedInto): Replaced a cumbersome condition by a boolean check on insertionType's
1373         treeScopeChanged and removed the accompanying comment which is no longer needed.
1374         * html/HTMLSlotElement.h:
1375         * html/HTMLSourceElement.cpp:
1376         (WebCore::HTMLSourceElement::insertedInto):
1377         * html/HTMLSourceElement.h:
1378         * html/HTMLStyleElement.cpp:
1379         (WebCore::HTMLStyleElement::insertedInto): The extra isConnected() check is no longer needed. See above.
1380         * html/HTMLStyleElement.h:
1381         * html/HTMLTextFormControlElement.cpp:
1382         (WebCore::HTMLTextFormControlElement::insertedInto):
1383         * html/HTMLTextFormControlElement.h:
1384         * html/HTMLTitleElement.cpp:
1385         (WebCore::HTMLTitleElement::insertedInto):
1386         * html/HTMLTitleElement.h:
1387         * html/HTMLTrackElement.cpp:
1388         (WebCore::HTMLTrackElement::insertedInto): Added a FIXME since this code is clearly wrong.
1389         * html/HTMLTrackElement.h:
1390         * svg/SVGElement.cpp:
1391         (WebCore::SVGElement::insertedInto):
1392         * svg/SVGElement.h:
1393         * svg/SVGFEImageElement.cpp:
1394         (WebCore::SVGFEImageElement::insertedInto):
1395         (WebCore::SVGFEImageElement::didFinishInsertingNode): Renamed from finishedInsertingSubtree.
1396         * svg/SVGFEImageElement.h:
1397         * svg/SVGFontFaceElement.cpp:
1398         (WebCore::SVGFontFaceElement::insertedInto):
1399         * svg/SVGFontFaceElement.h:
1400         * svg/SVGFontFaceUriElement.cpp:
1401         (WebCore::SVGFontFaceUriElement::insertedInto):
1402         * svg/SVGFontFaceUriElement.h:
1403         * svg/SVGImageElement.cpp:
1404         (WebCore::SVGImageElement::insertedInto):
1405         * svg/SVGImageElement.h:
1406         * svg/SVGMPathElement.cpp:
1407         (WebCore::SVGMPathElement::insertedInto):
1408         (WebCore::SVGMPathElement::didFinishInsertingNode): Renamed from finishedInsertingSubtree.
1409         * svg/SVGMPathElement.h:
1410         * svg/SVGPathElement.cpp:
1411         (WebCore::SVGPathElement::insertedInto):
1412         * svg/SVGPathElement.h:
1413         * svg/SVGSVGElement.cpp:
1414         (WebCore::SVGSVGElement::insertedInto):
1415         * svg/SVGSVGElement.h:
1416         * svg/SVGScriptElement.cpp:
1417         (WebCore::SVGScriptElement::insertedInto):
1418         (WebCore::SVGScriptElement::didFinishInsertingNode): Renamed from finishedInsertingSubtree.
1419         * svg/SVGScriptElement.h:
1420         * svg/SVGStyleElement.cpp:
1421         (WebCore::SVGStyleElement::insertedInto): The extra isConnected() check is no longer needed. See above description.
1422         * svg/SVGStyleElement.h:
1423         * svg/SVGTRefElement.cpp:
1424         (WebCore::SVGTRefElement::insertedInto):
1425         (WebCore::SVGTRefElement::didFinishInsertingNode): Renamed from finishedInsertingSubtree.
1426         * svg/SVGTRefElement.h:
1427         * svg/SVGTextPathElement.cpp:
1428         (WebCore::SVGTextPathElement::insertedInto):
1429         (WebCore::SVGTextPathElement::didFinishInsertingNode): Renamed from finishedInsertingSubtree.
1430         * svg/SVGTextPathElement.h:
1431         * svg/SVGTitleElement.cpp:
1432         (WebCore::SVGTitleElement::insertedInto):
1433         * svg/SVGTitleElement.h:
1434         * svg/SVGUseElement.cpp:
1435         (WebCore::SVGUseElement::insertedInto):
1436         * svg/SVGUseElement.h:
1437         * svg/animation/SVGSMILElement.cpp:
1438         (WebCore::SVGSMILElement::insertedInto):
1439         (WebCore::SVGSMILElement::didFinishInsertingNode): Renamed from finishedInsertingSubtree.
1440         * svg/animation/SVGSMILElement.h:
1441
1442 2017-10-18  Eric Carlson  <eric.carlson@apple.com>
1443
1444         Key events should not update Document.lastHandledUserGestureTimestamp unless key event is handled
1445         https://bugs.webkit.org/show_bug.cgi?id=178473
1446         <rdar://problem/34869935>
1447
1448         Reviewed by Brent Fulgham.
1449
1450         No new tests, updated media/restricted-audio-playback-with-document-gesture.html for this change.
1451
1452         * page/EventHandler.cpp:
1453         (WebCore::EventHandler::keyEvent): Restore the current Document's "lastHandledUserGestureTimestamp"
1454         if the key event was not handled.
1455
1456 2017-10-18  Wenson Hsieh  <wenson_hsieh@apple.com>
1457
1458         Unreviewed, rolling out r223291.
1459
1460         After further investigation, this removed codepath is
1461         something Mail may want to re-adopt. Additionally, the
1462         original breaking change was rolled out in r223408, so
1463         this test once again passes on ToT.
1464
1465         Reverted changeset:
1466
1467         "Remove Editor::simplifyMarkup"
1468         https://bugs.webkit.org/show_bug.cgi?id=178271
1469         https://trac.webkit.org/changeset/223291
1470
1471 2017-10-18  Sam Weinig  <sam@webkit.org>
1472
1473         [Settings] Move remaining simple settings to Settings.in
1474         https://bugs.webkit.org/show_bug.cgi?id=177730
1475         <rdar://problem/34763346>
1476
1477         Reviewed by Daniel Bates.
1478
1479         * Scripts/GenerateSettings/Settings.py:
1480         (Setting.__init__):
1481         (Setting.__str__):
1482         (Setting.getterFunctionName):
1483         (parseInput):
1484
1485             Add support for parsing the 'getter' option.
1486
1487         * page/Settings.in:
1488         
1489             Migrate simple settings from SettingsBase to here.
1490         
1491         * page/SettingsBase.cpp:
1492         (WebCore::SettingsBase::SettingsBase):
1493         (WebCore::SettingsBase::setJavaEnabled): Deleted.
1494         (WebCore::SettingsBase::setJavaEnabledForLocalFiles): Deleted.
1495         (WebCore::SettingsBase::setPreferMIMETypeForImages): Deleted.
1496         (WebCore::SettingsBase::setForcePendingWebGLPolicy): Deleted.
1497         (WebCore::SettingsBase::setNeedsAdobeFrameReloadingQuirk): Deleted.
1498         (WebCore::SettingsBase::setFontRenderingMode): Deleted.
1499         (WebCore::SettingsBase::fontRenderingMode const): Deleted.
1500         (WebCore::SettingsBase::setShowTiledScrollingIndicator): Deleted.
1501         (WebCore::SettingsBase::setFontFallbackPrefersPictographs): Deleted.
1502         * page/SettingsBase.h:
1503         (WebCore::SettingsBase::isJavaEnabled const): Deleted.
1504         (WebCore::SettingsBase::isJavaEnabledForLocalFiles const): Deleted.
1505         (WebCore::SettingsBase::preferMIMETypeForImages const): Deleted.
1506         (WebCore::SettingsBase::needsAcrobatFrameReloadingQuirk const): Deleted.
1507         (WebCore::SettingsBase::showTiledScrollingIndicator const): Deleted.
1508         (WebCore::SettingsBase::setTouchEventEmulationEnabled): Deleted.
1509         (WebCore::SettingsBase::isTouchEventEmulationEnabled const): Deleted.
1510         (WebCore::SettingsBase::setTimeWithoutMouseMovementBeforeHidingControls): Deleted.
1511         (WebCore::SettingsBase::timeWithoutMouseMovementBeforeHidingControls const): Deleted.
1512         (WebCore::SettingsBase::fontFallbackPrefersPictographs const): Deleted.
1513         (WebCore::SettingsBase::setMediaKeysStorageDirectory): Deleted.
1514         (WebCore::SettingsBase::mediaKeysStorageDirectory const): Deleted.
1515         (WebCore::SettingsBase::setMediaDeviceIdentifierStorageDirectory): Deleted.
1516         (WebCore::SettingsBase::mediaDeviceIdentifierStorageDirectory const): Deleted.
1517         (WebCore::SettingsBase::applePayEnabled const): Deleted.
1518         (WebCore::SettingsBase::setApplePayEnabled): Deleted.
1519         (WebCore::SettingsBase::applePayCapabilityDisclosureAllowed const): Deleted.
1520         (WebCore::SettingsBase::setApplePayCapabilityDisclosureAllowed): Deleted.
1521         (WebCore::SettingsBase::isForcePendingWebGLPolicy const): Deleted.
1522         
1523             Remove simple settings.
1524
1525 2017-10-18  Zalan Bujtas  <zalan@apple.com>
1526
1527         [FrameView::layout cleanup] Move root/body marking dirty logic to a separate function
1528         https://bugs.webkit.org/show_bug.cgi?id=178477
1529         <rdar://problem/35056478>
1530
1531         Reviewed by Simon Fraser.
1532
1533         No change in functionality.
1534
1535         * page/FrameView.cpp:
1536         (WebCore::FrameView::markRootOrBodyRendererDirty const):
1537         (WebCore::FrameView::layout):
1538         * page/FrameView.h:
1539
1540 2017-10-18  Keith Miller  <keith_miller@apple.com>
1541
1542         Setup WebCore build to start using unified sources.
1543         https://bugs.webkit.org/show_bug.cgi?id=178362
1544
1545         Reviewed by Tim Horton.
1546
1547         This patch adds all the long tooling needed to start adding
1548         unified sources to WebCore. Most of the source list files
1549         are empty to start but will be filled over the next few days.
1550
1551         I started by moving all the non-derived bindings code to
1552         unified sources to make sure everything worked correctly.
1553
1554         * CMakeLists.txt:
1555         * Configurations/GenerateUnifiedSources.xcconfig: Added.
1556         * Configurations/WebCore.xcconfig:
1557         * PlatformMac.cmake:
1558         * Sources.txt: Added.
1559         * SourcesCocoa.txt: Added.
1560         * SourcesIOS.txt: Added.
1561         * SourcesMac.txt: Added.
1562         * WebCore.xcodeproj/project.pbxproj:
1563         * bindings/js/JSMediaStreamCapabilitiesCustom.cpp: Removed. No one seems to use this...
1564
1565 2017-10-18  Commit Queue  <commit-queue@webkit.org>
1566
1567         Unreviewed, rolling out r223321.
1568         https://bugs.webkit.org/show_bug.cgi?id=178476
1569
1570         This protocol change broke some internal builds (Requested by
1571         brrian__ on #webkit).
1572
1573         Reverted changeset:
1574
1575         "Web Inspector: provide a way to enable/disable event
1576         listeners"
1577         https://bugs.webkit.org/show_bug.cgi?id=177451
1578         https://trac.webkit.org/changeset/223321
1579
1580 2017-10-18  Sam Weinig  <sam@webkit.org>
1581
1582         [Settings] Miscellaneous cleanup of the settings generation scripts
1583         https://bugs.webkit.org/show_bug.cgi?id=178462
1584
1585         Reviewed by Daniel Bates.
1586
1587         - Stop generating and remove now unused SettingsMacros.h
1588         - Make functions operating on the python Setting object member functions
1589         - Add predicate to determine if a Setting's type is a value type, allowing
1590           us to exclude those from using const references.
1591
1592         * CMakeLists.txt:
1593         * DerivedSources.make:
1594         * Scripts/GenerateSettings.py:
1595         * Scripts/GenerateSettings/GenerateInternalSettingsHeaderFile.py:
1596         * Scripts/GenerateSettings/GenerateInternalSettingsIDLFile.py:
1597         * Scripts/GenerateSettings/GenerateInternalSettingsImplementationFile.py:
1598         * Scripts/GenerateSettings/GenerateSettings.py:
1599         * Scripts/GenerateSettings/GenerateSettingsHeaderFile.py:
1600         * Scripts/GenerateSettings/GenerateSettingsImplementationFile.py:
1601         * Scripts/GenerateSettings/GenerateSettingsMacrosHeader.py: Removed.
1602         * Scripts/GenerateSettings/Settings.py:
1603         * WebCoreMacros.cmake:
1604         * WebCore.xcodeproj/project.pbxproj:
1605
1606 2017-10-18  Chris Dumez  <cdumez@apple.com>
1607
1608         Align ImageData constructor with the specification
1609         https://bugs.webkit.org/show_bug.cgi?id=178406
1610
1611         Reviewed by Youenn Fablet.
1612
1613         Align ImageData constructor with the specification:
1614         - https://html.spec.whatwg.org/multipage/canvas.html#dom-imagedata
1615
1616         It sometimes throws the wrong exception.
1617
1618         No new tests, rebaselined existing test.
1619
1620         * html/ImageData.cpp:
1621         (WebCore::ImageData::create):
1622         * html/ImageData.h:
1623         * html/ImageData.idl:
1624
1625 2017-10-18  Chris Dumez  <cdumez@apple.com>
1626
1627         Add an efficient data structure for WebCore to query if there is a Service Worker registered for a given origin
1628         https://bugs.webkit.org/show_bug.cgi?id=177876
1629         <rdar://problem/34813129>
1630
1631         Reviewed by Ryosuke Niwa.
1632
1633         No new tests, updatdd existing test.
1634
1635         * dom/Document.h:
1636         * testing/Internals.cpp:
1637         (WebCore::Internals::hasServiceWorkerRegisteredForOrigin):
1638         * testing/Internals.h:
1639         * testing/Internals.idl:
1640         * workers/service/ServiceWorkerProvider.h:
1641         * workers/service/context/SWContextManager.cpp:
1642         (WebCore::SWContextManager::startServiceWorkerContext):
1643         * workers/service/server/SWClientConnection.h:
1644         * workers/service/server/SWServer.cpp:
1645         (WebCore::SWServer::Connection::scriptContextStarted):
1646         (WebCore::SWServer::scriptContextStarted):
1647         * workers/service/server/SWServer.h:
1648         * workers/service/server/SWServerRegistration.cpp:
1649         (WebCore::SWServerRegistration::scriptContextFailedToStart):
1650         (WebCore::SWServerRegistration::scriptContextStarted):
1651         * workers/service/server/SWServerRegistration.h:
1652
1653 2017-10-18  Sam Weinig  <sam@webkit.org>
1654
1655         [Settings] Replace macros in Settings.h/cpp with generated code
1656         https://bugs.webkit.org/show_bug.cgi?id=178419
1657
1658         Reviewed by Antti Koivisto.
1659
1660         * Scripts/GenerateSettings/GenerateSettingsHeaderFile.py:
1661         * Scripts/GenerateSettings/GenerateSettingsImplementationFile.py:
1662
1663             Rather than use macros in the generated Settings class, generate the code the macros
1664             would expand to.
1665
1666 2017-10-18  Zalan Bujtas  <zalan@apple.com>
1667
1668         [FrameView::layout cleanup] Move frame flattening layout logic to a separate function
1669         https://bugs.webkit.org/show_bug.cgi?id=178425
1670         <rdar://problem/35045836>
1671
1672         Reviewed by Antti Koivisto.
1673
1674         No change in functionality.
1675
1676         * page/FrameView.cpp:
1677         (WebCore::FrameView::handleLayoutWithFrameFlatteningIfNeeded):
1678         (WebCore::FrameView::layout):
1679         (WebCore::FrameView::startLayoutAtMainFrameViewIfNeeded):
1680         * page/FrameView.h:
1681
1682 2017-10-18  Antti Koivisto  <antti@apple.com>
1683
1684         Resolve ::before and ::after pseudo elements during style resolution
1685         https://bugs.webkit.org/show_bug.cgi?id=178339
1686
1687         Reviewed by Ryosuke Niwa.
1688
1689         They are currently resolved during render tree building which creates problems with display:contents and animations.
1690
1691         * dom/PseudoElement.cpp:
1692         (WebCore::PseudoElement::PseudoElement):
1693
1694             Call InspectorInstrumentation from constructor.
1695
1696         * style/RenderTreeUpdater.cpp:
1697         (WebCore::RenderTreeUpdater::Parent::Parent):
1698         (WebCore::RenderTreeUpdater::updateRenderTree):
1699         (WebCore::RenderTreeUpdater::pushParent):
1700
1701             Push the full update to the parent stack.
1702
1703         (WebCore::RenderTreeUpdater::popParent):
1704         (WebCore::RenderTreeUpdater::updateBeforeDescendants):
1705         (WebCore::RenderTreeUpdater::updateAfterDescendants):
1706         (WebCore::RenderTreeUpdater::invalidateWhitespaceOnlyTextSiblingsAfterAttachIfNeeded):
1707         * style/RenderTreeUpdater.h:
1708         * style/RenderTreeUpdaterGeneratedContent.cpp:
1709         (WebCore::RenderTreeUpdater::GeneratedContent::updatePseudoElement):
1710
1711             No need to resolve pseudo style, we have it already.
1712
1713         (WebCore::RenderTreeUpdater::GeneratedContent::needsPseudoElement):
1714         (WebCore::RenderTreeUpdater::GeneratedContent::updateBeforePseudoElement): Deleted.
1715         (WebCore::RenderTreeUpdater::GeneratedContent::updateAfterPseudoElement): Deleted.
1716         * style/RenderTreeUpdaterGeneratedContent.h:
1717         * style/StyleTreeResolver.cpp:
1718         (WebCore::Style::TreeResolver::resolveElement):
1719         (WebCore::Style::TreeResolver::resolvePseudoStyle):
1720
1721             Resolve pseudos.
1722
1723         (WebCore::Style::TreeResolver::createAnimatedElementUpdate):
1724
1725             Make a private member function.
1726
1727         (WebCore::Style::TreeResolver::resolveComposedTree):
1728         * style/StyleTreeResolver.h:
1729         * style/StyleUpdate.cpp:
1730         (WebCore::Style::Update::elementUpdates const):
1731         (WebCore::Style::Update::elementUpdates):
1732
1733             Bundle the style update for an element and the associated before/after pseudos.
1734
1735         (WebCore::Style::Update::elementStyle const):
1736         (WebCore::Style::Update::elementStyle):
1737         (WebCore::Style::Update::addElement):
1738         (WebCore::Style::Update::elementUpdate const): Deleted.
1739         (WebCore::Style::Update::elementUpdate): Deleted.
1740         * style/StyleUpdate.h:
1741
1742 2017-10-18  Ms2ger  <Ms2ger@igalia.com>
1743
1744         Update the signatures of texSubImage3D.
1745         https://bugs.webkit.org/show_bug.cgi?id=178435
1746
1747         Reviewed by Sam Weinig.
1748
1749         Update the signatures of texSubImage3D.
1750
1751         No new tests: not much point in adding tests now; this method doesn't
1752         do anything anyway.
1753
1754         * html/canvas/WebGL2RenderingContext.cpp:
1755         (WebCore::WebGL2RenderingContext::texSubImage3D):
1756         * html/canvas/WebGL2RenderingContext.h:
1757         * html/canvas/WebGL2RenderingContext.idl:
1758
1759 2017-10-18  Fujii Hironori  <Hironori.Fujii@sony.com>
1760
1761         Use LazyNeverDestroyed instead of DEFINE_GLOBAL for WebKitFontFamilyNames
1762         https://bugs.webkit.org/show_bug.cgi?id=175106
1763
1764         Reviewed by Yusuke Suzuki.
1765
1766         No new tests because there is no behavior change.
1767
1768         * css/CSSFontFaceSet.cpp:
1769         (WebCore::CSSFontFaceSet::familyNameFromPrimitive): Call get() method of LazyNeverDestroyed.
1770         * dom/make_names.pl: Use LazyNeverDestroyed for font names.
1771
1772 2017-10-18  Zan Dobersek  <zdobersek@igalia.com>
1773
1774         [MSE] Move SourceBuffer's pending append data into the platform implementations
1775         https://bugs.webkit.org/show_bug.cgi?id=178003
1776
1777         Reviewed by Jer Noble.
1778
1779         In SourceBuffer::appendBufferTimerFired(), we can use move semantics to
1780         pass the pending append data into the platform layer, where it can then
1781         be used more efficiently.
1782
1783         Resources in the m_pendingAppendData member are moved into the append()
1784         call on the SourceBufferPrivate object. The m_pendingAppendData is still
1785         cleared out manually in case the underlying implementation doesn't clear
1786         it out through a move operation. The SourceBufferPrivate interface is
1787         updated to accept a Vector rvalue reference as the only parameter of the
1788         append() method.
1789
1790         For the GStreamer implementation, signature of the append() method in
1791         MediaSourceClientGStreamerMSE class is also updated. The implementation
1792         now moves the Vector resources over to a on-heap Vector object that is
1793         then wrapped into a GstBuffer object by using the
1794         gst_buffer_new_wrapped_full() API and specifying the custom deleter.
1795
1796         The AVFoundation implementation of SourceBufferPrivate is only updated
1797         to reflect the changes in the interface. The Vector data that is passed
1798         in is still copied into the NSData allocation.
1799
1800         MockSourceBufferPrivate is also updated, with the append data still
1801         being copied into the m_inputBuffer Vector.
1802
1803         No new tests -- no change in behavior.
1804
1805         * Modules/mediasource/SourceBuffer.cpp:
1806         (WebCore::SourceBuffer::appendBufferTimerFired):
1807         * platform/graphics/SourceBufferPrivate.h:
1808         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h:
1809         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
1810         (WebCore::SourceBufferPrivateAVFObjC::append):
1811         * platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.cpp:
1812         (WebCore::MediaSourceClientGStreamerMSE::append):
1813         * platform/graphics/gstreamer/mse/MediaSourceClientGStreamerMSE.h:
1814         * platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.cpp:
1815         (WebCore::SourceBufferPrivateGStreamer::append):
1816         * platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.h:
1817         * platform/mock/mediasource/MockSourceBufferPrivate.cpp:
1818         (WebCore::MockSourceBufferPrivate::append):
1819         * platform/mock/mediasource/MockSourceBufferPrivate.h:
1820
1821 2017-10-17  Zalan Bujtas  <zalan@apple.com>
1822
1823         [FrameView::layout cleanup] Remove redundant body->renderer()->setChildNeedsLayout() call
1824         https://bugs.webkit.org/show_bug.cgi?id=178414
1825         <rdar://problem/35040876>
1826
1827         Reviewed by Simon Fraser.
1828
1829         Since m_size always equals to layoutSize() at this point, we never call setChildNeedsLayout() on the body's renderer.
1830         However a few lines below, when we adjust the frame size and check if oldSize != m_size, we actually
1831         dirty the body's renderer.
1832
1833         Covered by existing tests.
1834
1835         * page/FrameView.cpp:
1836         (WebCore::FrameView::layout):
1837
1838 2017-10-17  Myles C. Maxfield  <mmaxfield@apple.com>
1839
1840         [Regression] Webkit "-apple-system" font fallback token handles font weights of PingFang incorrectly.
1841         https://bugs.webkit.org/show_bug.cgi?id=177345
1842         <rdar://problem/32975942>
1843
1844         Reviewed by Jon Lee.
1845
1846         This bug has a fairly insideous cause. In particular, the system font fallback path follows
1847         system conventions, which are not the same as the CSS fallback path. For example, the Chinese
1848         fallback of San Francisco weight 600 is Ping Fang weight 500. This doesn't match our
1849         assumptions in CSS, because Ping Fang does have a 600 weight, which CSS would think is closer.
1850         However, the whole point of system-ui is that it follows the system fallback path, not CSS's.
1851         Therefore, falling back from a bold system-ui request to a non-bold fallback font is correct
1852         and expected, and we shouldn't synthesize bold in this situation.
1853
1854         Test: fast/text/system-ui-chinese-bold-fallback.html
1855
1856         * platform/graphics/cocoa/FontFamilySpecificationCoreText.cpp:
1857         (WebCore::FontFamilySpecificationCoreText::fontRanges const):
1858
1859 2017-10-17  Chelsea Pugh  <cpugh@apple.com>
1860
1861         [iOS] Don't turn fields yellow after filling credentials
1862         https://bugs.webkit.org/show_bug.cgi?id=178411
1863
1864         Reviewed by Wenson Hsieh.
1865
1866         * editing/ios/AutofillElements.cpp:
1867         (WebCore::AutofillElements::autofill): We don't want to turn fields yellow when filling the user name
1868         and password. Remove the code that was causing that to happen.
1869
1870 2017-10-16  Andy Estes  <aestes@apple.com>
1871
1872         [Apple Pay] Add subLocality and subAdministrativeArea to ApplePayPaymentContact and ApplePayError
1873         https://bugs.webkit.org/show_bug.cgi?id=178191
1874         <rdar://problem/34906367>
1875
1876         Reviewed by Tim Horton.
1877
1878         Added test cases to http/tests/ssl/applepay/ApplePaySession.html.
1879
1880         * Modules/applepay/ApplePayError.idl:
1881         * Modules/applepay/ApplePayPaymentContact.h:
1882         * Modules/applepay/ApplePayPaymentContact.idl:
1883         * Modules/applepay/ApplePaySessionPaymentRequest.h:
1884         * Modules/applepay/cocoa/PaymentContactCocoa.mm:
1885         (WebCore::subLocality):
1886         (WebCore::setSubLocality):
1887         (WebCore::subAdministrativeArea):
1888         (WebCore::setSubAdministrativeArea):
1889         (WebCore::convert):
1890
1891 2017-10-17  Commit Queue  <commit-queue@webkit.org>
1892
1893         Unreviewed, rolling out r223500.
1894         https://bugs.webkit.org/show_bug.cgi?id=178408
1895
1896         Introduced a crash in CSSAnimationController::updateAnimations
1897         (Requested by rniwa on #webkit).
1898
1899         Reverted changeset:
1900
1901         "Resolve ::before and ::after pseudo elements during style
1902         resolution"
1903         https://bugs.webkit.org/show_bug.cgi?id=178339
1904         https://trac.webkit.org/changeset/223500
1905
1906 2017-10-17  Myles C. Maxfield  <mmaxfield@apple.com>
1907
1908         Delete button doesn't fully delete certain emoji
1909         https://bugs.webkit.org/show_bug.cgi?id=178096
1910         <rdar://problem/34785106>
1911
1912         Reviewed by Simon Fraser.
1913
1914         System infrastructure for handling emoji changes every year. Instead of having
1915         custom code to specifically walk over codepoints, we should delegate to the
1916         system handling.
1917
1918         Tests: editing/deleting/delete-emoji.html
1919                editing/deleting/delete-emoji-1.html
1920                editing/deleting/delete-emoji-2.html
1921                editing/deleting/delete-emoji-3.html
1922                editing/deleting/delete-emoji-4.html
1923                editing/deleting/delete-emoji-5.html
1924                editing/deleting/delete-emoji-6.html
1925                editing/deleting/delete-emoji-7.html
1926                editing/deleting/delete-emoji-8.html
1927                editing/deleting/delete-emoji-9.html
1928
1929         * rendering/RenderText.cpp:
1930         (WebCore::RenderText::previousOffset const):
1931         (WebCore::RenderText::previousOffsetForBackwardDeletion const):
1932         (WebCore::RenderText::nextOffset const):
1933         (WebCore::isHangulLVT): Deleted.
1934         (WebCore::isMark): Deleted.
1935         (WebCore::isRegionalIndicator): Deleted.
1936         (WebCore::isInArmenianToLimbuRange): Deleted.
1937
1938 2017-10-17  Youenn Fablet  <youenn@apple.com>
1939
1940         Add preliminary support for fetch event
1941         https://bugs.webkit.org/show_bug.cgi?id=178171
1942
1943         Unreviewed.
1944
1945         * workers/service/FetchEvent.cpp:
1946         (WebCore::FetchEvent::promiseIsSettled): build fix by removing unnecessary captured this at the moment.
1947
1948 2017-10-17  Myles C. Maxfield  <mmaxfield@apple.com>
1949
1950         [CSS Font Loading] Fonts are erroneously invisible when the policy says they should be visible
1951         https://bugs.webkit.org/show_bug.cgi?id=178238
1952
1953         Reviewed by Simon Fraser.
1954
1955         When implementing font-display, I added testing infrastructure (so we don't have to wait for
1956         3 second timeouts to occur). This testing infrastructure covered up a real bug where the wrong
1957         font would be reported to CSSFontAccessor. This patch reverts the erroneous testing
1958         infrastructure and replaces it with a real fix to the problem. The replacement fix is covered
1959         by the same tests that I wrote when implementing the feature.
1960
1961         Covered by existing tests.
1962
1963         * css/CSSFontFace.cpp:
1964         (WebCore::CSSFontFace::pump):
1965         (WebCore::visibility):
1966         (WebCore::CSSFontFace::font):
1967
1968 2017-10-16  Sam Weinig  <sam@webkit.org>
1969
1970         [Settings] Generate Settings.h/cpp
1971         https://bugs.webkit.org/show_bug.cgi?id=178361
1972
1973         Reviewed by Dean Jackson.
1974
1975         This change generates Settings.h and Settings.cpp exactly as they are,
1976         using SettingsMacros.h and everything. In follow up changes, the use of
1977         SettingsMacros.h will be removed.
1978
1979         * CMakeLists.txt:
1980         * DerivedSources.make:
1981         * Scripts/GenerateSettings.py:
1982         * Scripts/GenerateSettings/GenerateSettings.py:
1983         * Scripts/GenerateSettings/GenerateSettingsHeaderFile.py: Added.
1984         * Scripts/GenerateSettings/GenerateSettingsImplementationFile.py: Added.
1985         * WebCore.xcodeproj/project.pbxproj:
1986         * WebCoreMacros.cmake:
1987         * page/Settings.cpp: Removed.
1988         * page/Settings.h: Removed.
1989
1990 2017-10-17  Ms2ger  <Ms2ger@igalia.com>
1991
1992         Create bindings for WebGL2's versions of texSubImage2D.
1993         https://bugs.webkit.org/show_bug.cgi?id=178382
1994
1995         Reviewed by Ryosuke Niwa.
1996
1997         Create bindings for WebGL2's versions of texSubImage2D.
1998
1999         No new tests: not much point in adding tests now; this method doesn't
2000         do anything anyway.
2001
2002         * html/canvas/WebGL2RenderingContext.cpp:
2003         (WebCore::WebGL2RenderingContext::texSubImage2D):
2004         * html/canvas/WebGL2RenderingContext.h:
2005         * html/canvas/WebGL2RenderingContext.idl:
2006         * html/canvas/WebGLRenderingContext.idl:
2007         * html/canvas/WebGLRenderingContextBase.idl:
2008
2009 2017-10-17  Zalan Bujtas  <zalan@apple.com>
2010
2011         [FrameView::layout cleanup] Subtree should read subtreeLayout.
2012         https://bugs.webkit.org/show_bug.cgi?id=178401
2013
2014         Reviewed by Simon Fraser.
2015
2016         Rename some variables to improve readability.
2017
2018         No change in functionality.
2019
2020         * page/FrameView.cpp:
2021         (WebCore::SubtreeLayoutStateMaintainer::SubtreeLayoutStateMaintainer):
2022         (WebCore::SubtreeLayoutStateMaintainer::~SubtreeLayoutStateMaintainer):
2023         (WebCore::SubtreeLayoutStateMaintainer::shouldDisableLayoutStateForSubtree):
2024         (WebCore::FrameView::reset):
2025         (WebCore::FrameView::willDestroyRenderTree):
2026         (WebCore::FrameView::didDestroyRenderTree):
2027         (WebCore::FrameView::calculateScrollbarModesForLayout):
2028         (WebCore::FrameView::layout):
2029         (WebCore::FrameView::convertSubtreeLayoutToFullLayout):
2030         (WebCore::FrameView::scheduleRelayout):
2031         (WebCore::FrameView::scheduleRelayoutOfSubtree):
2032         (WebCore::FrameView::needsLayout const):
2033         (WebCore::FrameView::autoSizeIfEnabled):
2034         * page/FrameView.h:
2035
2036 2017-10-16  Dean Jackson  <dino@apple.com>
2037
2038         WebGL clamps drawingBufferWidth to 4096 pixels on a 5120 monitor/canvas
2039         https://bugs.webkit.org/show_bug.cgi?id=178223
2040         <rdar://problem/34597567>
2041
2042         Reviewed by Antoine Quint.
2043
2044         Remove the limit of 4k on the width/height of the renderbuffer.
2045
2046         Test: fast/canvas/webgl/large-drawing-buffer-resize.html
2047
2048         * html/canvas/WebGLRenderingContextBase.cpp:
2049         (WebCore::WebGLRenderingContextBase::reshape):
2050
2051 2017-10-17  John Wilander  <wilander@apple.com>
2052
2053         Add and remove cookie partition accordingly in intermediary redirect requests
2054         https://bugs.webkit.org/show_bug.cgi?id=178369
2055         <rdar://problem/34467603>
2056
2057         Reviewed by Brent Fulgham.
2058
2059         Tests: http/tests/resourceLoadStatistics/add-partitioning-to-redirect.html
2060                http/tests/resourceLoadStatistics/remove-partitioning-from-redirect.html
2061
2062         * loader/ResourceLoadObserver.h:
2063             Now exposes notifyObserver() so that it can be triggered
2064             by the TestRunner.
2065             Removed unimplemented ResourceLoadObserver::setShouldThrottleObserverNotifications().
2066
2067 2017-10-17  Jer Noble  <jer.noble@apple.com>
2068
2069         Corrupted image after looping movie-backed <img>.
2070         https://bugs.webkit.org/show_bug.cgi?id=178398
2071
2072         Reviewed by Eric Carlson.
2073
2074         Use the decode-order sample cursor rather than the destination sample cursor when generating
2075         the CMSampleBuffer to decode.
2076
2077         * platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.mm:
2078         (WebCore::ImageDecoderAVFObjC::createFrameImageAtIndex):
2079
2080 2017-10-17  Ryan Haddad  <ryanhaddad@apple.com>
2081
2082         Unreviewed, rolling out r223459.
2083
2084         This change introduced LayoutTest failures.
2085
2086         Reverted changeset:
2087
2088         "WebGL clamps drawingBufferWidth to 4096 pixels on a 5120
2089         monitor/canvas"
2090         https://bugs.webkit.org/show_bug.cgi?id=178223
2091         https://trac.webkit.org/changeset/223459
2092
2093 2017-10-17  Youenn Fablet  <youenn@apple.com>
2094
2095         Add preliminary support for fetch event
2096         https://bugs.webkit.org/show_bug.cgi?id=178171
2097
2098         Reviewed by Chris Dumez.
2099
2100         Test: http/wpt/service-workers/fetchEvent.https.html
2101               http/wpt/service-workers/extendableEvent.https.html
2102
2103         Adding support for ExtendableEvent and FetchEvent as per 
2104         https://w3c.github.io/ServiceWorker/v1/#extendableevent-interface and
2105         https://w3c.github.io/ServiceWorker/v1/#fetchevent-interface.
2106
2107         Both events need to handle promises as method parameters.
2108         Beefing up DOMPromise for that purpose by exposing status, result and being able to call then.
2109         Adding a new DOMPromise create method that would be the base for https://heycam.github.io/webidl/#es-promise
2110         which might be implemented in the binding generator as a follow-up.
2111
2112         This patch makes them exposed on Window for test purposes until they can be fully tested on ServiceWorker environment.
2113         It is also adding two internal methods for the same reason. These should be removed once events can be tested in its environment.
2114
2115         * CMakeLists.txt:
2116         * DerivedSources.make:
2117         * Modules/fetch/FetchResponse.idl:
2118         * WebCore.xcodeproj/project.pbxproj:
2119         * bindings/js/JSDOMPromise.cpp: Added.
2120         (WebCore::callFunction):
2121         (WebCore::DOMPromise::create):
2122         (WebCore::DOMPromise::whenSettled):
2123         (WebCore::DOMPromise::result const):
2124         (WebCore::DOMPromise::status const):
2125         * bindings/js/JSDOMPromise.h:
2126         * bindings/js/WebCoreBuiltinNames.h:
2127         * dom/EventNames.in:
2128         * testing/Internals.cpp:
2129         (WebCore::Internals::waitFetchEventToFinish):
2130         (WebCore::Internals::waitExtendableEventToFinish):
2131         * testing/Internals.h:
2132         * testing/Internals.idl:
2133         * workers/service/ExtendableEvent.cpp: Added.
2134         (WebCore::ExtendableEvent::ExtendableEvent):
2135         (WebCore::ExtendableEvent::waitUntil):
2136         (WebCore::ExtendableEvent::addPendingPromise):
2137         * workers/service/ExtendableEvent.h:
2138         (WebCore::ExtendableEvent::onFinishedWaiting):
2139         (WebCore::ExtendableEvent::promiseSettled):
2140         * workers/service/ExtendableEvent.idl: Added.
2141         * workers/service/ExtendableEventInit.h: Added.
2142         * workers/service/ExtendableEventInit.idl: Added.
2143         * workers/service/FetchEvent.cpp: Added.
2144         (WebCore::FetchEvent::FetchEvent):
2145         (WebCore::FetchEvent::respondWith):
2146         (WebCore::FetchEvent::onResponse):
2147         (WebCore::FetchEvent::respondWithError):
2148         (WebCore::FetchEvent::processResponse):
2149         (WebCore::FetchEvent::promiseSettled):
2150         * workers/service/FetchEvent.h:
2151         * workers/service/FetchEvent.idl:
2152
2153 2017-10-17  Jer Noble  <jer.noble@apple.com>
2154
2155         Leak of one AVSampleCursor inside ImageDecoderAVFObjC::createFrameImageAtIndex()
2156         https://bugs.webkit.org/show_bug.cgi?id=178397
2157
2158         Reviewed by Eric Carlson.
2159
2160         Explicitly wrap the return value of -copy in a RetainPtr.
2161
2162         * platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.mm:
2163         (WebCore::ImageDecoderAVFObjC::createFrameImageAtIndex):
2164
2165 2017-10-17  Youenn Fablet  <youenn@apple.com>
2166
2167         Cache API implementation should be able to compute storage size for WebKit client applications.
2168         https://bugs.webkit.org/show_bug.cgi?id=178350
2169
2170         Reviewed by Chris Dumez.
2171
2172         * page/SecurityOriginData.h:
2173         (WebCore::SecurityOriginData::equals const):
2174
2175 2017-10-17  Daniel Bates  <dabates@apple.com>
2176
2177         ASSERTION FAILED: m_truncation != cFullTruncation in InlineTextBox::clampedOffset()
2178         https://bugs.webkit.org/show_bug.cgi?id=178322
2179
2180         Reviewed by Darin Adler.
2181
2182         It is acceptable for InlineTextBox::clampedOffset() to be called for a fully truncated box,
2183         say a person clicks on the ellipsis in a truncated text run. Restore the behavior prior to
2184         r223259 and return the clamped offset.
2185
2186         Test: fast/text/click-ellipsis-assertion-failure.html
2187
2188         * rendering/InlineTextBox.cpp:
2189         (WebCore::InlineTextBox::clampedOffset const):
2190
2191 2017-10-17  Daniel Bates  <dabates@apple.com>
2192
2193         REGRESSION (r222670 and r222732): RTL truncated text may not be drawn
2194         https://bugs.webkit.org/show_bug.cgi?id=178278
2195         <rdar://problem/34982818>
2196
2197         Reviewed by Darin Adler.
2198
2199         Revert r222732 and partially revert r222670. The underlying font rendering machinery implements
2200         text truncation by taking a TextRun object that represents all of the text in the line fragment
2201         and a subrange of the glyphs to render from this fragment. Only the glyphs in this subrange are
2202         drawn and they are drawn in the same position they would be in had the entire line fragment been
2203         drawn. Following r222670 InlineTextBox applies the truncation to the TextRun in InlineTextBox::text().
2204         Together with r222732, which assumed that the number of glyphs to draw is equal to the length of
2205         the TextRun, a truncated text run would be drawn at the wrong position on screen and could give
2206         the impression that the text is not drawn. Instead InlineTextBox::text() should always return
2207         the text for the entire line fragment without considering truncation and when calling TextPainter::paint()
2208         we need to pass the truncated length of the line fragment.
2209
2210         Test: fast/text/ellipsis-text-rtl.html
2211
2212         * rendering/InlineTextBox.cpp:
2213         (WebCore::InlineTextBox::paint): Compute the truncated length (number of glyphs) and pass this
2214         to TextPainter::paint()
2215         (WebCore::InlineTextBox::text const): Do not apply truncation to the text run. Truncation is
2216         implemented by telling the underlying font rendering machinery to paint the subrange of the
2217         text run that represents the non-truncated (visible) text.
2218         * rendering/InlineTextBox.h:
2219         * rendering/SimpleLineLayoutFunctions.cpp:
2220         (WebCore::SimpleLineLayout::paintFlow): Pass the entire length of the text run as we did prior
2221         to r222732.
2222         * rendering/TextPainter.cpp:
2223         (WebCore::TextPainter::paint): Take a length that represents the number of glyphs to draw from
2224         the text run as we use to take prior to r222732.
2225         * rendering/TextPainter.h:
2226
2227 2017-10-17  Zalan Bujtas  <zalan@apple.com>
2228
2229         [FrameView::layout cleanup] Move text auto sizing logic to a separate function
2230         https://bugs.webkit.org/show_bug.cgi?id=178391
2231         <rdar://problem/35030264>
2232
2233         Reviewed by Antti Koivisto.
2234
2235         No change in functionality.
2236
2237         * page/FrameView.cpp:
2238         (WebCore::applyTextSizingIfNeeded):
2239         (WebCore::FrameView::layout):
2240
2241 2017-10-17  Yoshiaki Jitsukawa  <Yoshiaki.Jitsukawa@sony.com>
2242
2243         [Curl] Forward declaration "class Cookie;" in CookieJarCurl.h should be "struct Cookie;"
2244         https://bugs.webkit.org/show_bug.cgi?id=178378
2245
2246         Reviewed by Per Arne Vollan.
2247
2248         No new tests. No change in behaviors.
2249
2250         * platform/network/curl/CookieJarCurl.h:
2251
2252 2017-10-17  Zalan Bujtas  <zalan@apple.com>
2253
2254         [FrameView::layout cleanup] Merge InPreLayout blocks
2255         https://bugs.webkit.org/show_bug.cgi?id=178373
2256
2257         Reviewed by Antti Koivisto.
2258
2259         Remove redundant comment and scoping.
2260
2261         No change in functionality.
2262
2263         * page/FrameView.cpp:
2264         (WebCore::FrameView::layout):
2265
2266 2017-10-17  Antti Koivisto  <antti@apple.com>
2267
2268         Text nodes with display:contents parent should render as if they were wrapped in an unstyled <span>
2269         https://bugs.webkit.org/show_bug.cgi?id=178332
2270
2271         Reviewed by Ryosuke Niwa.
2272
2273         According to https://github.com/w3c/csswg-drafts/issues/1118
2274
2275             <div style="display:contents;color:green">text</div>
2276
2277         must result in green text even though div doesn't generate a box.
2278
2279         This patch implements the behavior by wrapping text renderers with display:contents parent element
2280         in an anonymous inline box that receives its style by inheriting from the parent element.
2281
2282         * dom/Document.cpp:
2283         (WebCore::Document::updateTextRenderer):
2284         * rendering/RenderElement.cpp:
2285         (WebCore::RenderElement::computeFirstLineStyle const):
2286
2287             Synthesize the first line style in display:contents parent case.
2288
2289         * rendering/RenderObject.cpp:
2290         (WebCore::findDestroyRootIncludingAnonymous):
2291
2292             Factor into a function.
2293
2294         (WebCore::RenderObject::removeFromParentAndDestroyCleaningUpAnonymousWrappers):
2295
2296             Get rid of the anonymous wrapper if it exists.
2297
2298         * rendering/RenderText.cpp:
2299         (WebCore::inlineWrapperForDisplayContentsMap):
2300         (WebCore::RenderText::RenderText):
2301         (WebCore::RenderText::willBeDestroyed):
2302         (WebCore::RenderText::inlineWrapperForDisplayContents):
2303         (WebCore::RenderText::setInlineWrapperForDisplayContents):
2304
2305             Add a weak member (implemented as a rare data map) for holding the wrapper pointer.
2306
2307         (WebCore::RenderText::findByDisplayContentsInlineWrapperCandidate):
2308
2309             Helper to get the text renderer for a wrapper.
2310
2311         * rendering/RenderText.h:
2312         * style/RenderTreeUpdater.cpp:
2313         (WebCore::createTextRenderer):
2314         (WebCore::RenderTreeUpdater::updateTextRenderer):
2315
2316             Create the wrapper if needed.
2317
2318         * style/StyleTreeResolver.cpp:
2319         (WebCore::Style::TreeResolver::resolveComposedTree):
2320
2321             Compute the wrapper style by inheriting from the display:contents parent.
2322
2323         * style/StyleUpdate.h:
2324         (WebCore::Style::TextUpdate::TextUpdate):
2325
2326 2017-10-17  Alicia Boya García  <aboya@igalia.com>
2327
2328         [MSE][GStreamer] Insert parser elements in AppendPipeline when demuxing opus or Vorbis
2329         https://bugs.webkit.org/show_bug.cgi?id=178076
2330
2331         Reviewed by Xabier Rodriguez-Calvar.
2332
2333         YouTube does not include durations in the WebM container for files
2334         containing Opus audio, so we need to read them from the contained
2335         stream. Fortunately, GStreamer has an element to do that: opusparse.
2336
2337         The same thing happens with Vorbis contained in WebM files from the
2338         W3C tests, which should also be fixed by the GStreamer element
2339         vorbisparse.
2340
2341         This patch adds an opusparse or vorbisparse element to the
2342         AppendPipeline at the sinkpad of the demuxer when either is found.
2343
2344         Tests: updated expectations.
2345
2346         * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
2347         (WebCore::AppendPipeline::appsinkNewSample):
2348         (WebCore::createOptionalParserForFormat):
2349         (WebCore::AppendPipeline::connectDemuxerSrcPadToAppsinkFromAnyThread):
2350         (WebCore::AppendPipeline::disconnectDemuxerSrcPadFromAppsinkFromAnyThread):
2351         * platform/graphics/gstreamer/mse/AppendPipeline.h:
2352         * platform/graphics/gstreamer/mse/GStreamerMediaSample.cpp:
2353         (WebCore::GStreamerMediaSample::GStreamerMediaSample):
2354         * platform/graphics/gstreamer/mse/PlaybackPipeline.cpp:
2355         (WebCore::PlaybackPipeline::attachTrack):
2356
2357 2017-10-17  Ms2ger  <Ms2ger@igalia.com>
2358
2359         Add WebGL2 texImage3D overloads.
2360         https://bugs.webkit.org/show_bug.cgi?id=178119
2361
2362         Reviewed by Ryosuke Niwa.
2363
2364         No new tests: not much point in adding tests now; this method doesn't
2365         do anything anyway.
2366
2367         * html/canvas/WebGL2RenderingContext.cpp:
2368         (WebCore::WebGL2RenderingContext::texImage3D):
2369         * html/canvas/WebGL2RenderingContext.h:
2370         * html/canvas/WebGL2RenderingContext.idl:
2371
2372 2017-10-17  Antti Koivisto  <antti@apple.com>
2373
2374         Resolve ::before and ::after pseudo elements during style resolution
2375         https://bugs.webkit.org/show_bug.cgi?id=178339
2376
2377         Reviewed by Ryosuke Niwa.
2378
2379         They are currently resolved during render tree building which creates problems with display:contents and animations.
2380
2381         * dom/PseudoElement.cpp:
2382         (WebCore::PseudoElement::PseudoElement):
2383
2384             Call InspectorInstrumentation from constructor.
2385
2386         * style/RenderTreeUpdater.cpp:
2387         (WebCore::RenderTreeUpdater::Parent::Parent):
2388         (WebCore::RenderTreeUpdater::updateRenderTree):
2389         (WebCore::RenderTreeUpdater::pushParent):
2390
2391             Push the full update to the parent stack.
2392
2393         (WebCore::RenderTreeUpdater::popParent):
2394         (WebCore::RenderTreeUpdater::updateBeforeDescendants):
2395         (WebCore::RenderTreeUpdater::updateAfterDescendants):
2396         (WebCore::RenderTreeUpdater::invalidateWhitespaceOnlyTextSiblingsAfterAttachIfNeeded):
2397         * style/RenderTreeUpdater.h:
2398         * style/RenderTreeUpdaterGeneratedContent.cpp:
2399         (WebCore::RenderTreeUpdater::GeneratedContent::updatePseudoElement):
2400
2401             No need to resolve pseudo style, we have it already.
2402
2403         (WebCore::RenderTreeUpdater::GeneratedContent::needsPseudoElement):
2404         (WebCore::RenderTreeUpdater::GeneratedContent::updateBeforePseudoElement): Deleted.
2405         (WebCore::RenderTreeUpdater::GeneratedContent::updateAfterPseudoElement): Deleted.
2406         * style/RenderTreeUpdaterGeneratedContent.h:
2407         * style/StyleTreeResolver.cpp:
2408         (WebCore::Style::TreeResolver::resolveElement):
2409         (WebCore::Style::TreeResolver::resolvePseudoStyle):
2410
2411             Resolve pseudos.
2412
2413         (WebCore::Style::TreeResolver::createAnimatedElementUpdate):
2414
2415             Make a private member function.
2416
2417         (WebCore::Style::TreeResolver::resolveComposedTree):
2418         * style/StyleTreeResolver.h:
2419         * style/StyleUpdate.cpp:
2420         (WebCore::Style::Update::elementUpdates const):
2421         (WebCore::Style::Update::elementUpdates):
2422
2423             Bundle the style update for an element and the associated before/after pseudos.
2424
2425         (WebCore::Style::Update::elementStyle const):
2426         (WebCore::Style::Update::elementStyle):
2427         (WebCore::Style::Update::addElement):
2428         (WebCore::Style::Update::elementUpdate const): Deleted.
2429         (WebCore::Style::Update::elementUpdate): Deleted.
2430         * style/StyleUpdate.h:
2431
2432 2017-10-17  Keith Miller  <keith_miller@apple.com>
2433
2434         Change WebCore sources to work with unified source builds
2435         https://bugs.webkit.org/show_bug.cgi?id=178229
2436
2437         Rubber stamped by Tim Horton.
2438
2439         This patch does the following:
2440
2441         1) Move all “using namespace <name>;” into the WebCore namespace
2442         (They used to go in the global namespace) and change to "using
2443         WebCore::<name>;” in .mm files.
2444
2445         2) Move a bunch of the soft linking library/framework macros out
2446         of the .mm files since those caused name collision problems.
2447
2448         3) Fix minor other naming collisions.
2449
2450         The problem with 1 in a unified source world is generic names
2451         often collide with system header names. For example, WebCore has a
2452         Rect class and that collided with a system header type elsewhere.
2453
2454         This patch shouldn't change behavior so no new tests.
2455
2456         * Configurations/FeatureDefines.xcconfig:
2457         * Modules/cache/CacheStorageConnection.cpp:
2458         * Modules/cache/DOMCache.cpp:
2459         * Modules/cache/DOMCacheStorage.cpp:
2460         * Modules/cache/WorkerCacheStorageConnection.cpp:
2461         * Modules/encryptedmedia/InitDataRegistry.cpp:
2462         * Modules/encryptedmedia/legacy/LegacyCDMSessionClearKey.cpp:
2463         * Modules/indexeddb/IDBCursor.cpp:
2464         * Modules/indexeddb/IDBFactory.cpp:
2465         * Modules/indexeddb/IDBIndex.cpp:
2466         * Modules/indexeddb/IDBKeyRange.cpp:
2467         * Modules/indexeddb/IDBObjectStore.cpp:
2468         * Modules/indexeddb/IDBRequest.cpp:
2469         * Modules/indexeddb/IDBTransaction.cpp:
2470         * Modules/indexeddb/server/MemoryObjectStore.cpp:
2471         * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
2472         * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
2473         * Modules/mediasource/MediaSource.cpp:
2474         (WebCore::MediaSource::setReadyState):
2475         (WebCore::toString): Deleted.
2476         * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:
2477         * Modules/plugins/QuickTimePluginReplacement.mm:
2478         (WebCore::jsValueWithAVMetadataItemInContext):
2479         * Modules/webdriver/NavigatorWebDriver.cpp:
2480         * PlatformAppleWin.cmake:
2481         * PlatformMac.cmake:
2482         * WebCore.xcodeproj/project.pbxproj:
2483         * accessibility/ios/AccessibilityObjectIOS.mm:
2484         (-[WAKView accessibilityIsIgnored]): Deleted.
2485         * accessibility/ios/WebAccessibilityObjectWrapperIOS.h:
2486         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
2487         (-[WAKView accessibilityIsIgnored]):
2488         * accessibility/win/AXObjectCacheWin.cpp:
2489         * bindings/js/CommonVM.cpp:
2490         * bindings/js/DOMWrapperWorld.cpp:
2491         * bindings/js/GCController.cpp:
2492         * bindings/js/IDBBindingUtilities.cpp:
2493         * bindings/js/JSAudioTrackCustom.cpp:
2494         * bindings/js/JSAudioTrackListCustom.cpp:
2495         * bindings/js/JSBlobCustom.cpp:
2496         * bindings/js/JSCSSRuleCustom.cpp:
2497         * bindings/js/JSCSSRuleListCustom.cpp:
2498         * bindings/js/JSCSSStyleDeclarationCustom.cpp:
2499         * bindings/js/JSCallbackData.cpp:
2500         * bindings/js/JSCanvasRenderingContext2DCustom.cpp:
2501         * bindings/js/JSCustomElementInterface.cpp:
2502         * bindings/js/JSCustomElementRegistryCustom.cpp:
2503         * bindings/js/JSCustomEventCustom.cpp:
2504         * bindings/js/JSDOMBindingSecurity.cpp:
2505         * bindings/js/JSDOMBuiltinConstructorBase.cpp:
2506         * bindings/js/JSDOMConstructorBase.cpp:
2507         * bindings/js/JSDOMConstructorWithDocument.cpp:
2508         * bindings/js/JSDOMConvertDate.cpp:
2509         * bindings/js/JSDOMConvertNumbers.cpp:
2510         * bindings/js/JSDOMConvertStrings.cpp:
2511         * bindings/js/JSDOMConvertWebGL.cpp:
2512         * bindings/js/JSDOMExceptionHandling.cpp:
2513         * bindings/js/JSDOMGlobalObject.cpp:
2514         * bindings/js/JSDOMGlobalObjectTask.cpp:
2515         * bindings/js/JSDOMGuardedObject.cpp:
2516         * bindings/js/JSDOMPromiseDeferred.cpp:
2517         * bindings/js/JSDOMQuadCustom.cpp:
2518         * bindings/js/JSDOMWindowBase.cpp:
2519         * bindings/js/JSDOMWindowCustom.cpp:
2520         * bindings/js/JSDOMWindowProxy.cpp:
2521         * bindings/js/JSDOMWrapper.cpp:
2522         * bindings/js/JSDOMWrapperCache.cpp:
2523         * bindings/js/JSDeprecatedCSSOMValueCustom.cpp:
2524         * bindings/js/JSDocumentCustom.cpp:
2525         * bindings/js/JSDocumentFragmentCustom.cpp:
2526         * bindings/js/JSElementCustom.cpp:
2527         * bindings/js/JSErrorHandler.cpp:
2528         * bindings/js/JSEventCustom.cpp:
2529         * bindings/js/JSEventListener.cpp:
2530         * bindings/js/JSEventTargetCustom.cpp:
2531         * bindings/js/JSFileSystemEntryCustom.cpp:
2532         * bindings/js/JSHTMLCollectionCustom.cpp:
2533         * bindings/js/JSHTMLDocumentCustom.cpp:
2534         * bindings/js/JSHTMLTemplateElementCustom.cpp:
2535         * bindings/js/JSHistoryCustom.cpp:
2536         * bindings/js/JSIDBCursorCustom.cpp:
2537         * bindings/js/JSIDBCursorWithValueCustom.cpp:
2538         * bindings/js/JSIDBIndexCustom.cpp:
2539         * bindings/js/JSIDBObjectStoreCustom.cpp:
2540         * bindings/js/JSIDBTransactionCustom.cpp:
2541         * bindings/js/JSImageDataCustom.cpp:
2542         * bindings/js/JSLazyEventListener.cpp:
2543         * bindings/js/JSLocationCustom.cpp:
2544         * bindings/js/JSMediaStreamCapabilitiesCustom.cpp:
2545         * bindings/js/JSMessageEventCustom.cpp:
2546         * bindings/js/JSMessagePortCustom.cpp:
2547         * bindings/js/JSMutationObserverCustom.cpp:
2548         * bindings/js/JSNodeCustom.cpp:
2549         * bindings/js/JSNodeListCustom.cpp:
2550         * bindings/js/JSPerformanceEntryCustom.cpp:
2551         * bindings/js/JSPluginElementFunctions.cpp:
2552         * bindings/js/JSPopStateEventCustom.cpp:
2553         * bindings/js/JSReadableStreamPrivateConstructors.cpp:
2554         * bindings/js/JSReadableStreamSourceCustom.cpp:
2555         * bindings/js/JSSVGPathSegCustom.cpp:
2556         * bindings/js/JSTextTrackCueCustom.cpp:
2557         * bindings/js/JSTextTrackCustom.cpp:
2558         * bindings/js/JSTextTrackListCustom.cpp:
2559         * bindings/js/JSTrackCustom.cpp:
2560         * bindings/js/JSVideoTrackCustom.cpp:
2561         * bindings/js/JSVideoTrackListCustom.cpp:
2562         * bindings/js/JSWebGL2RenderingContextCustom.cpp:
2563         * bindings/js/JSWebGLRenderingContextCustom.cpp:
2564         * bindings/js/JSWebGPURenderPassAttachmentDescriptorCustom.cpp:
2565         * bindings/js/JSWebGPURenderingContextCustom.cpp:
2566         * bindings/js/JSWorkerGlobalScopeBase.cpp:
2567         * bindings/js/JSWorkerGlobalScopeCustom.cpp:
2568         * bindings/js/JSXMLHttpRequestCustom.cpp:
2569         * bindings/js/JSXPathNSResolverCustom.cpp:
2570         * bindings/js/ReadableStream.cpp:
2571         (WebCore::ReadableStream::pipeTo):
2572         (WebCore::ReadableStream::tee):
2573         (WebCore::checkReadableStream):
2574         (WebCore::callFunction): Deleted.
2575         * bindings/js/ScheduledAction.cpp:
2576         * bindings/js/ScriptCachedFrameData.cpp:
2577         * bindings/js/ScriptController.cpp:
2578         * bindings/js/SerializedScriptValue.cpp:
2579         * bindings/js/StructuredClone.cpp:
2580         * bindings/js/WebCoreJSClientData.cpp:
2581         * bindings/js/WorkerScriptController.cpp:
2582         * bindings/scripts/CodeGeneratorJS.pm:
2583         (GenerateEnumerationImplementation):
2584         (GenerateImplementation):
2585         (GenerateDictionaryImplementation):
2586         (GenerateCallbackFunctionImplementation):
2587         (GenerateCallbackInterfaceImplementation):
2588         * bindings/scripts/test/JS/JSInterfaceName.cpp:
2589         * bindings/scripts/test/JS/JSMapLike.cpp:
2590         * bindings/scripts/test/JS/JSReadOnlyMapLike.cpp:
2591         * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
2592         * bindings/scripts/test/JS/JSTestCEReactions.cpp:
2593         * bindings/scripts/test/JS/JSTestCEReactionsStringifier.cpp:
2594         * bindings/scripts/test/JS/JSTestCallTracer.cpp:
2595         * bindings/scripts/test/JS/JSTestCallbackFunction.cpp:
2596         * bindings/scripts/test/JS/JSTestCallbackFunctionRethrow.cpp:
2597         * bindings/scripts/test/JS/JSTestCallbackFunctionWithThisObject.cpp:
2598         * bindings/scripts/test/JS/JSTestCallbackFunctionWithTypedefs.cpp:
2599         * bindings/scripts/test/JS/JSTestCallbackInterface.cpp:
2600         * bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.cpp:
2601         * bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.cpp:
2602         * bindings/scripts/test/JS/JSTestDOMJIT.cpp:
2603         * bindings/scripts/test/JS/JSTestEnabledBySetting.cpp:
2604         * bindings/scripts/test/JS/JSTestEventConstructor.cpp:
2605         * bindings/scripts/test/JS/JSTestEventTarget.cpp:
2606         * bindings/scripts/test/JS/JSTestException.cpp:
2607         * bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp:
2608         * bindings/scripts/test/JS/JSTestGlobalObject.cpp:
2609         * bindings/scripts/test/JS/JSTestIndexedSetterNoIdentifier.cpp:
2610         * bindings/scripts/test/JS/JSTestIndexedSetterThrowingException.cpp:
2611         * bindings/scripts/test/JS/JSTestIndexedSetterWithIdentifier.cpp:
2612         * bindings/scripts/test/JS/JSTestInterface.cpp:
2613         * bindings/scripts/test/JS/JSTestInterfaceLeadingUnderscore.cpp:
2614         * bindings/scripts/test/JS/JSTestIterable.cpp:
2615         * bindings/scripts/test/JS/JSTestJSBuiltinConstructor.cpp:
2616         * bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp:
2617         * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterNoIdentifier.cpp:
2618         * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterThrowingException.cpp:
2619         * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterWithIdentifier.cpp:
2620         * bindings/scripts/test/JS/JSTestNamedConstructor.cpp:
2621         * bindings/scripts/test/JS/JSTestNamedDeleterNoIdentifier.cpp:
2622         * bindings/scripts/test/JS/JSTestNamedDeleterThrowingException.cpp:
2623         * bindings/scripts/test/JS/JSTestNamedDeleterWithIdentifier.cpp:
2624         * bindings/scripts/test/JS/JSTestNamedDeleterWithIndexedGetter.cpp:
2625         * bindings/scripts/test/JS/JSTestNamedGetterCallWith.cpp:
2626         * bindings/scripts/test/JS/JSTestNamedGetterNoIdentifier.cpp:
2627         * bindings/scripts/test/JS/JSTestNamedGetterWithIdentifier.cpp:
2628         * bindings/scripts/test/JS/JSTestNamedSetterNoIdentifier.cpp:
2629         * bindings/scripts/test/JS/JSTestNamedSetterThrowingException.cpp:
2630         * bindings/scripts/test/JS/JSTestNamedSetterWithIdentifier.cpp:
2631         * bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetter.cpp:
2632         * bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetterAndSetter.cpp:
2633         * bindings/scripts/test/JS/JSTestNamedSetterWithOverrideBuiltins.cpp:
2634         * bindings/scripts/test/JS/JSTestNamedSetterWithUnforgableProperties.cpp:
2635         * bindings/scripts/test/JS/JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins.cpp:
2636         * bindings/scripts/test/JS/JSTestNode.cpp:
2637         * bindings/scripts/test/JS/JSTestObj.cpp:
2638         * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
2639         * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.cpp:
2640         * bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp:
2641         * bindings/scripts/test/JS/JSTestPluginInterface.cpp:
2642         * bindings/scripts/test/JS/JSTestPromiseRejectionEvent.cpp:
2643         * bindings/scripts/test/JS/JSTestSerialization.cpp:
2644         * bindings/scripts/test/JS/JSTestSerializationIndirectInheritance.cpp:
2645         * bindings/scripts/test/JS/JSTestSerializationInherit.cpp:
2646         * bindings/scripts/test/JS/JSTestSerializationInheritFinal.cpp:
2647         * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
2648         * bindings/scripts/test/JS/JSTestStandaloneDictionary.cpp:
2649         * bindings/scripts/test/JS/JSTestStandaloneEnumeration.cpp:
2650         * bindings/scripts/test/JS/JSTestStringifier.cpp:
2651         * bindings/scripts/test/JS/JSTestStringifierAnonymousOperation.cpp:
2652         * bindings/scripts/test/JS/JSTestStringifierNamedOperation.cpp:
2653         * bindings/scripts/test/JS/JSTestStringifierOperationImplementedAs.cpp:
2654         * bindings/scripts/test/JS/JSTestStringifierOperationNamedToString.cpp:
2655         * bindings/scripts/test/JS/JSTestStringifierReadOnlyAttribute.cpp:
2656         * bindings/scripts/test/JS/JSTestStringifierReadWriteAttribute.cpp:
2657         * bindings/scripts/test/JS/JSTestTypedefs.cpp:
2658         * bindings/scripts/test/JS/JSTestVoidCallbackFunction.cpp:
2659         * bridge/IdentifierRep.cpp:
2660         * bridge/NP_jsobject.cpp:
2661         (ObjectMap::get): Deleted.
2662         (ObjectMap::add): Deleted.
2663         (ObjectMap::remove): Deleted.
2664         (objectMap): Deleted.
2665         (ObjectMap::RootObjectInvalidationCallback::operator()): Deleted.
2666         (getListFromVariantArgs): Deleted.
2667         (jsAllocate): Deleted.
2668         (jsDeallocate): Deleted.
2669         (_NPN_CreateNoScriptObject): Deleted.
2670         (_NPN_InvokeDefault): Deleted.
2671         (_NPN_Invoke): Deleted.
2672         (_NPN_Evaluate): Deleted.
2673         (_NPN_GetProperty): Deleted.
2674         (_NPN_SetProperty): Deleted.
2675         (_NPN_RemoveProperty): Deleted.
2676         (_NPN_HasProperty): Deleted.
2677         (_NPN_HasMethod): Deleted.
2678         (_NPN_SetException): Deleted.
2679         (_NPN_Enumerate): Deleted.
2680         (_NPN_Construct): Deleted.
2681         * bridge/NP_jsobject.h:
2682         * contentextensions/ContentExtensionParser.cpp:
2683         * crypto/SubtleCrypto.cpp:
2684         * crypto/algorithms/CryptoAlgorithmAES_CBC.cpp:
2685         (WebCore::CryptoAlgorithmAES_CBC::encrypt):
2686         (WebCore::CryptoAlgorithmAES_CBC::decrypt):
2687         (WebCore::CryptoAlgorithmAES_CBC::importKey):
2688         (WebCore::CryptoAlgorithmAES_CBC::exportKey):
2689         * crypto/algorithms/CryptoAlgorithmAES_CFB.cpp:
2690         (WebCore::CryptoAlgorithmAES_CFB::encrypt):
2691         (WebCore::CryptoAlgorithmAES_CFB::decrypt):
2692         (WebCore::CryptoAlgorithmAES_CFB::importKey):
2693         (WebCore::CryptoAlgorithmAES_CFB::exportKey):
2694         * crypto/algorithms/CryptoAlgorithmAES_CTR.cpp:
2695         (WebCore::parametersAreValid):
2696         (WebCore::CryptoAlgorithmAES_CTR::importKey):
2697         (WebCore::CryptoAlgorithmAES_CTR::exportKey):
2698         * crypto/algorithms/CryptoAlgorithmAES_GCM.cpp:
2699         (WebCore::tagLengthIsValid):
2700         (WebCore::CryptoAlgorithmAES_GCM::encrypt):
2701         (WebCore::CryptoAlgorithmAES_GCM::decrypt):
2702         (WebCore::CryptoAlgorithmAES_GCM::importKey):
2703         (WebCore::CryptoAlgorithmAES_GCM::exportKey):
2704         * crypto/algorithms/CryptoAlgorithmAES_KW.cpp:
2705         (WebCore::CryptoAlgorithmAES_KW::importKey):
2706         (WebCore::CryptoAlgorithmAES_KW::exportKey):
2707         * crypto/algorithms/CryptoAlgorithmHMAC.cpp:
2708         (WebCore::CryptoAlgorithmHMAC::importKey):
2709         (WebCore::CryptoAlgorithmHMAC::exportKey):
2710         * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp:
2711         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::importKey):
2712         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::exportKey):
2713         * crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp:
2714         (WebCore::CryptoAlgorithmRSA_OAEP::importKey):
2715         (WebCore::CryptoAlgorithmRSA_OAEP::exportKey):
2716         * crypto/algorithms/CryptoAlgorithmRSA_PSS.cpp:
2717         (WebCore::CryptoAlgorithmRSA_PSS::importKey):
2718         (WebCore::CryptoAlgorithmRSA_PSS::exportKey):
2719         * crypto/mac/CryptoAlgorithmPBKDF2Mac.cpp:
2720         (WebCore::CryptoAlgorithmPBKDF2::platformDeriveBits):
2721         (WebCore::commonCryptoHMACAlgorithm): Deleted.
2722         * css/CSSBasicShapes.cpp:
2723         * css/CSSPrimitiveValue.cpp:
2724         * css/parser/CSSParser.cpp:
2725         * css/parser/CSSPropertyParser.cpp:
2726         * css/parser/CSSPropertyParserHelpers.cpp:
2727         (WebCore::CSSPropertyParserHelpers::positionFromThreeOrFourValues):
2728         (WebCore::CSSPropertyParserHelpers::consumePosition):
2729         (WebCore::CSSPropertyParserHelpers::createPrimitiveValuePair): Deleted.
2730         * dom/DOMQuad.cpp:
2731         * dom/Document.cpp:
2732         * dom/ErrorEvent.cpp:
2733         * dom/EventListenerMap.cpp:
2734         * dom/EventTarget.cpp:
2735         * dom/PromiseRejectionEvent.cpp:
2736         * dom/RejectedPromiseTracker.cpp:
2737         * dom/ScriptExecutionContext.cpp:
2738         * domjit/JSDocumentDOMJIT.cpp:
2739         * domjit/JSDocumentFragmentDOMJIT.cpp:
2740         * domjit/JSElementDOMJIT.cpp:
2741         * domjit/JSEventDOMJIT.cpp:
2742         * domjit/JSNodeDOMJIT.cpp:
2743         * editing/TextIterator.cpp:
2744         * editing/cocoa/HTMLConverter.mm:
2745         * history/CachedPage.cpp:
2746         * html/HTMLCanvasElement.cpp:
2747         * html/HTMLFontElement.cpp:
2748         * html/HTMLMediaElement.cpp:
2749         * html/HTMLSelectElement.cpp:
2750         * html/TypeAhead.cpp:
2751         * html/parser/HTMLSrcsetParser.cpp:
2752         (WebCore::tokenizeDescriptors):
2753         * html/parser/HTMLTokenizer.cpp:
2754         * html/parser/ParsingUtilities.h:
2755         (WebCore::isNotASCIISpace):
2756         * html/parser/XSSAuditorDelegate.cpp:
2757         * html/track/DataCue.cpp:
2758         * inspector/CommandLineAPIHost.cpp:
2759         * inspector/CommandLineAPIModule.cpp:
2760         * inspector/InspectorApplicationCacheAgent.cpp:
2761         * inspector/InspectorCSSAgent.cpp:
2762         * inspector/InspectorCanvas.cpp:
2763         * inspector/InspectorCanvasAgent.cpp:
2764         * inspector/InspectorClient.cpp:
2765         * inspector/InspectorController.cpp:
2766         * inspector/InspectorDOMAgent.cpp:
2767         * inspector/InspectorDOMDebuggerAgent.cpp:
2768         * inspector/InspectorDOMStorageAgent.cpp:
2769         * inspector/InspectorDatabaseAgent.cpp:
2770         * inspector/InspectorDatabaseResource.cpp:
2771         * inspector/InspectorFrontendClientLocal.cpp:
2772         * inspector/InspectorFrontendHost.cpp:
2773         * inspector/InspectorIndexedDBAgent.cpp:
2774         * inspector/InspectorInstrumentation.cpp:
2775         * inspector/InspectorLayerTreeAgent.cpp:
2776         * inspector/InspectorMemoryAgent.cpp:
2777         * inspector/InspectorNetworkAgent.cpp:
2778         * inspector/InspectorOverlay.cpp:
2779         * inspector/InspectorPageAgent.cpp:
2780         * inspector/InspectorShaderProgram.cpp:
2781         * inspector/InspectorStyleSheet.cpp:
2782         * inspector/InspectorTimelineAgent.cpp:
2783         * inspector/InspectorWorkerAgent.cpp:
2784         * inspector/InstrumentingAgents.cpp:
2785         * inspector/NetworkResourcesData.cpp:
2786         * inspector/PageConsoleAgent.cpp:
2787         * inspector/PageDebuggerAgent.cpp:
2788         * inspector/PageHeapAgent.cpp:
2789         * inspector/PageRuntimeAgent.cpp:
2790         * inspector/PageScriptDebugServer.cpp:
2791         * inspector/TimelineRecordFactory.cpp:
2792         * inspector/WebConsoleAgent.cpp:
2793         * inspector/WebDebuggerAgent.cpp:
2794         * inspector/WebHeapAgent.cpp:
2795         * inspector/WebInjectedScriptHost.cpp:
2796         * inspector/WebInjectedScriptManager.cpp:
2797         * inspector/WorkerConsoleAgent.cpp:
2798         * inspector/WorkerDebuggerAgent.cpp:
2799         * inspector/WorkerInspectorController.cpp:
2800         * inspector/WorkerRuntimeAgent.cpp:
2801         * inspector/WorkerScriptDebugServer.cpp:
2802         * loader/FTPDirectoryParser.cpp:
2803         * loader/TextResourceDecoder.cpp:
2804         * loader/cache/CachedResource.cpp:
2805         * loader/cache/CachedResourceLoader.cpp:
2806         * page/ContextMenuController.cpp:
2807         * page/DOMWindow.cpp:
2808         * page/Navigator.cpp:
2809         * page/PageConsoleClient.cpp:
2810         * page/PageDebuggable.cpp:
2811         * page/cocoa/ResourceUsageOverlayCocoa.mm:
2812         * page/csp/ContentSecurityPolicy.cpp:
2813         * page/csp/ContentSecurityPolicyDirectiveList.cpp:
2814         (WebCore::isNotASCIISpace): Deleted.
2815         * page/csp/ContentSecurityPolicyMediaListDirective.cpp:
2816         (WebCore::isNotASCIISpace): Deleted.
2817         * page/scrolling/ios/ScrollingTreeIOS.cpp:
2818         * page/scrolling/ios/ScrollingTreeIOS.h:
2819         * page/scrolling/mac/ScrollingTreeFixedNode.mm:
2820         (WebCore::ScrollingTreeFixedNode::updateLayersAfterAncestorChange):
2821         (WebCore::operator*): Deleted.
2822         * page/scrolling/mac/ScrollingTreeStickyNode.mm:
2823         (WebCore::ScrollingTreeStickyNode::updateLayersAfterAncestorChange):
2824         (WebCore::operator*): Deleted.
2825         * platform/Length.cpp:
2826         * platform/URL.cpp:
2827         (WebCore::isSchemeFirstChar):
2828         (WebCore::isSchemeChar):
2829         (WebCore::isBadChar):
2830         (WebCore::isTabNewline):
2831         * platform/audio/WebAudioBufferList.cpp:
2832         (WebCore::WebAudioBufferList::WebAudioBufferList):
2833         * platform/audio/mac/AudioSampleDataSource.mm:
2834         (WebCore::AudioSampleDataSource::pushSamples):
2835         * platform/cf/CoreMediaSoftLink.cpp: Removed.
2836         * platform/cf/CoreMediaSoftLink.h: Removed.
2837         * platform/encryptedmedia/clearkey/CDMClearKey.cpp:
2838         * platform/graphics/FloatPolygon.cpp:
2839         (WebCore::areCollinearPoints):
2840         (WebCore::FloatPolygon::FloatPolygon):
2841         (WebCore::VertexPair::intersection const):
2842         (WebCore::determinant): Deleted.
2843         * platform/graphics/FontCache.cpp:
2844         * platform/graphics/FontCascade.cpp:
2845         * platform/graphics/GraphicsContext3DPrivate.cpp:
2846         * platform/graphics/WidthIterator.cpp:
2847         * platform/graphics/avfoundation/AudioSourceProviderAVFObjC.mm:
2848         (WebCore::AudioSourceProviderAVFObjC::process):
2849         * platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp:
2850         (WebCore::InbandTextTrackPrivateAVF::processCueAttributes):
2851         (WebCore::InbandTextTrackPrivateAVF::processNativeSamples):
2852         (WebCore::InbandTextTrackPrivateAVF::readNativeSampleBuffer):
2853         * platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp:
2854         * platform/graphics/avfoundation/objc/AVAssetTrackUtilities.mm:
2855         (WebCore::assetTrackMeetsHardwareDecodeRequirements):
2856         * platform/graphics/avfoundation/objc/AVFoundationMIMETypeCache.mm:
2857         * platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.mm:
2858         (WebCore::ImageDecoderAVFObjC::readSampleMetadata):
2859         (WebCore::ImageDecoderAVFObjC::storeSampleBuffer):
2860         (WebCore::ImageDecoderAVFObjC::frameIsCompleteAtIndex const):
2861         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
2862         (WebCore::MediaPlayerPrivateAVFoundationObjC::createImageGenerator):
2863         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
2864         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
2865         * platform/graphics/avfoundation/objc/MediaSampleAVFObjC.mm:
2866         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
2867         * platform/graphics/ca/win/PlatformCALayerWinInternal.cpp:
2868         * platform/graphics/ca/win/WebTiledBackingLayerWin.cpp:
2869         * platform/graphics/cairo/GraphicsContextCairo.cpp:
2870         * platform/graphics/cairo/ImageBufferCairo.cpp:
2871         * platform/graphics/cg/ImageBufferCG.cpp:
2872         (WebCore::ImageBuffer::ImageBuffer):
2873         (WebCore::releaseImageData): Deleted.
2874         * platform/graphics/cg/ImageBufferDataCG.h:
2875         * platform/graphics/cocoa/WebCoreDecompressionSession.mm:
2876         * platform/graphics/gstreamer/ImageGStreamerCairo.cpp:
2877         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp:
2878         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
2879         * platform/graphics/ios/DisplayRefreshMonitorIOS.mm:
2880         * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
2881         * platform/graphics/opentype/OpenTypeMathData.cpp:
2882         * platform/graphics/opentype/OpenTypeVerticalData.cpp:
2883         * platform/graphics/transforms/MatrixTransformOperation.cpp:
2884         (WebCore::MatrixTransformOperation::blend):
2885         (WebCore::createOperation): Deleted.
2886         * platform/graphics/win/FontPlatformDataCairoWin.cpp:
2887         * platform/graphics/win/FontWin.cpp:
2888         * platform/graphics/win/GraphicsContextCGWin.cpp:
2889         * platform/graphics/win/GraphicsContextCairoWin.cpp:
2890         * platform/graphics/win/GraphicsContextDirect2D.cpp:
2891         * platform/graphics/win/GraphicsContextWin.cpp:
2892         * platform/graphics/win/UniscribeController.cpp:
2893         * platform/image-decoders/ScalableImageDecoder.cpp:
2894         (): Deleted.
2895         * platform/ios/LegacyTileLayer.mm:
2896         (-[LegacyTileHostLayer renderInContext:]):
2897         * platform/ios/PlaybackSessionInterfaceAVKit.mm:
2898         * platform/ios/ScrollAnimatorIOS.mm:
2899         * platform/ios/VideoFullscreenInterfaceAVKit.mm:
2900         * platform/ios/WebAVPlayerController.mm:
2901         (-[WebAVPlayerController skipBackwardThirtySeconds:]):
2902         (-[WebAVPlayerController gotoEndOfSeekableRanges:]):
2903         (-[WebAVPlayerController canSeekToBeginning]):
2904         (-[WebAVPlayerController canSeekToEnd]):
2905         (-[WebAVPlayerController observeValueForKeyPath:ofObject:change:context:]):
2906         (-[WebAVPlayerController updateMinMaxTiming]):
2907         * platform/ios/WebEvent.mm:
2908         * platform/ios/WebItemProviderPasteboard.mm:
2909         * platform/ios/wak/WKContentObservation.cpp:
2910         * platform/mac/KeyEventMac.mm:
2911         * platform/mac/PlaybackSessionInterfaceMac.mm:
2912         (WebCore::timeRangesToArray):
2913         * platform/mac/ScrollAnimatorMac.mm:
2914         (macScrollbarTheme): Deleted.
2915         (scrollerImpForScrollbar): Deleted.
2916         * platform/mac/ScrollbarThemeMac.mm:
2917         (WebCore::scrollbarMap):
2918         * platform/mac/VideoFullscreenInterfaceMac.mm:
2919         * platform/mac/WebCoreFullScreenPlaceholderView.mm:
2920         * platform/mac/WebCoreNSURLExtras.mm:
2921         (WebCore::dataForURLComponentType):
2922         * platform/mac/WebPlaybackControlsManager.mm:
2923         * platform/mac/WebVideoFullscreenController.mm:
2924         (SOFT_LINK_CLASS): Deleted.
2925         * platform/mac/WebVideoFullscreenHUDWindowController.mm:
2926         * platform/mac/WebWindowAnimation.mm:
2927         (WebWindowAnimationDurationFromDuration): Deleted.
2928         (scaledRect): Deleted.
2929         (squaredDistance): Deleted.
2930         * platform/mediastream/RealtimeOutgoingVideoSource.cpp:
2931         * platform/mediastream/mac/AVCaptureDeviceManager.mm:
2932         * platform/mediastream/mac/AVMediaCaptureSource.mm:
2933         * platform/mediastream/mac/AVVideoCaptureSource.mm:
2934         (WebCore::AVVideoCaptureSource::applyFrameRate):
2935         (WebCore::AVVideoCaptureSource::processNewFrame):
2936         * platform/mediastream/mac/AudioTrackPrivateMediaStreamCocoa.cpp:
2937         * platform/mediastream/mac/CoreAudioCaptureDevice.cpp:
2938         * platform/mediastream/mac/CoreAudioCaptureDeviceManager.cpp:
2939         * platform/mediastream/mac/CoreAudioCaptureSource.cpp:
2940         * platform/mediastream/mac/MockRealtimeAudioSourceMac.mm:
2941         * platform/mediastream/mac/MockRealtimeVideoSourceMac.mm:
2942         (WebCore::MockRealtimeVideoSourceMac::CMSampleBufferFromPixelBuffer):
2943         * platform/mediastream/mac/RealtimeIncomingAudioSourceCocoa.cpp:
2944         * platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.cpp:
2945         * platform/mediastream/mac/RealtimeOutgoingVideoSourceCocoa.cpp:
2946         * platform/mediastream/mac/WebAudioSourceProviderAVFObjC.mm:
2947         * platform/network/HTTPParsers.cpp:
2948         * platform/text/LocaleICU.cpp:
2949         * platform/text/TextCodecLatin1.cpp:
2950         * platform/text/TextCodecUTF8.cpp:
2951         * platform/text/TextEncodingRegistry.cpp:
2952         * platform/text/win/LocaleWin.cpp:
2953         * platform/win/BString.cpp:
2954         * platform/win/KeyEventWin.cpp:
2955         * platform/win/ScrollbarThemeWin.cpp:
2956         * rendering/BidiRun.cpp:
2957         * rendering/FloatingObjects.cpp:
2958         * rendering/RenderBlock.cpp:
2959         * rendering/RenderListMarker.cpp:
2960         * rendering/RenderQuote.cpp:
2961         * rendering/RenderText.cpp:
2962         * rendering/RenderThemeWin.cpp:
2963         * testing/Internals.cpp:
2964         * testing/js/WebCoreTestSupport.cpp:
2965         * workers/WorkerConsoleClient.cpp:
2966         * workers/WorkerGlobalScope.cpp:
2967         * workers/WorkerInspectorProxy.cpp:
2968         * xml/SoftLinkLibxslt.cpp: Added.
2969         * xml/SoftLinkLibxslt.h: Added.
2970         * xml/XPathGrammar.cpp:
2971         * xml/XPathParser.cpp:
2972         * xml/XSLStyleSheetLibxslt.cpp:
2973         * xml/XSLTExtensions.cpp:
2974         * xml/XSLTProcessorLibxslt.cpp:
2975         * xml/XSLTUnicodeSort.cpp:
2976         (xsltTransformErrorTrampoline):
2977         (WebCore::xsltUnicodeSortFunction):
2978         * xml/parser/XMLDocumentParser.cpp:
2979         (WebCore::XMLDocumentParser::updateLeafTextNode):
2980         (WebCore::toString): Deleted.
2981
2982 2017-10-16  Wenson Hsieh  <wenson_hsieh@apple.com>
2983
2984         Allow reading data and blob URLs via DataTransfer when the pasteboard contains files
2985         https://bugs.webkit.org/show_bug.cgi?id=178377
2986
2987         Reviewed by Ryosuke Niwa.
2988
2989         Adds data and blob URLs, alongside http(s), as URL protocols safe to expose to bindings.
2990
2991         Test: editing/pasteboard/drag-drop-href-as-url.html
2992
2993         * platform/Pasteboard.cpp:
2994         (WebCore::Pasteboard::canExposeURLToDOMWhenPasteboardContainsFiles):
2995
2996 2017-10-16  Ryosuke Niwa  <rniwa@webkit.org>
2997
2998         Strip away event handlers and JavaScript URLs when copying
2999         https://bugs.webkit.org/show_bug.cgi?id=178375
3000
3001         Reviewed by Wenson Hsieh.
3002
3003         Don't serialize event handlers and URLs with javascript protocol when serializing HTML
3004         since they're not safe to be pasted elsewhere.
3005
3006         Test: editing/pasteboard/copying-html-strips-javascript-url-and-event-handler.html
3007
3008         * dom/Element.cpp:
3009         (WebCore::Element::isEventHandlerAttribute const):
3010         (WebCore::isEventHandlerAttribute): Deleted.
3011         * dom/Element.h:
3012         * editing/markup.cpp:
3013         (WebCore::StyledMarkupAccumulator::appendElement):
3014
3015 2017-10-16  Dean Jackson  <dino@apple.com>
3016
3017         WebGL clamps drawingBufferWidth to 4096 pixels on a 5120 monitor/canvas
3018         https://bugs.webkit.org/show_bug.cgi?id=178223
3019         <rdar://problem/34597567>
3020
3021         Reviewed by Antoine Quint.
3022
3023         Remove the limit of 4k on the width/height of the renderbuffer.
3024
3025         Test: fast/canvas/webgl/large-drawing-buffer-resize.html
3026
3027         * html/canvas/WebGLRenderingContextBase.cpp:
3028         (WebCore::WebGLRenderingContextBase::reshape):
3029
3030 2017-10-16  Ryosuke Niwa  <rniwa@webkit.org>
3031
3032         Assert that Node::insertedInto doesn't fire an event
3033         https://bugs.webkit.org/show_bug.cgi?id=178376
3034         <rdar://problem/35022857>
3035
3036         Reviewed by Daniel Bates.
3037
3038         Fixed the assertion in notifyChildNodeInserted since this function MUST NOT dispatch an event,
3039         and moved a bunch of event-dispatching code from Node::insertedInto into Node::finishedInsertingSubtree.
3040
3041         No new tests since the existing tests cover the behavioral change.
3042
3043         * dom/ContainerNodeAlgorithms.cpp:
3044         (WebCore::notifyChildNodeInserted): Fixed the assertion.
3045         * dom/ProcessingInstruction.cpp:
3046         (WebCore::ProcessingInstruction::insertedInto):
3047         (WebCore::ProcessingInstruction::finishedInsertingSubtree): Extracted from insertedInto since
3048         checkStyleSheet can dispatch an event.
3049         * dom/ProcessingInstruction.h:
3050         * html/HTMLBodyElement.cpp:
3051         (WebCore::HTMLBodyElement::insertedInto):
3052         (WebCore::HTMLBodyElement::finishedInsertingSubtree): Extracted from insertedInto since
3053         setIntegralAttribute could dispatch DOMAttrModified synchronously.
3054         * html/HTMLBodyElement.h:
3055
3056 2017-10-16  Chris Dumez  <cdumez@apple.com>
3057
3058         ServiceWorkerRegistration should subclass RefCounted<>
3059         https://bugs.webkit.org/show_bug.cgi?id=178374
3060
3061         Reviewed by Ryosuke Niwa.
3062
3063         ServiceWorkerRegistration should subclass RefCounted<> or we end up with an infinite recursion
3064         when constructing such object. This is because ServiceWorkerRegistration subclasses
3065         EventTargetWithInlineData which implements ref() / deref() by calling refEventTarget() /
3066         derefEventTarget(). refEventTarget() / derefEventTarget() are implemented in
3067         ServiceWorkerRegistration so that they call ref() / deref() (which ends up being EventTarget's
3068         methods).
3069
3070         * workers/service/ServiceWorkerRegistration.h:
3071
3072 2017-10-16  Jer Noble  <jer.noble@apple.com>
3073
3074         ImageDecoderAVFObjC fails to create more CMSampleBuffers after creating about 32MB worth.
3075         https://bugs.webkit.org/show_bug.cgi?id=178360
3076
3077         Reviewed by Eric Carlson.
3078
3079         AVSampleBufferGenerator has a constrained memory pool of about 32MB in size. Once
3080         CMSampleBuffers representing about 32MB of memory are allocated, no more can be created
3081         until previously created ones are released. So rather than (only) creating the sample
3082         buffers up front in readSampleMetadata(), also create them dynamically, if missing, in
3083         createFrameImageAtIndex(...) and release them in storeSampleBuffer(...) after they have been
3084         decoded.
3085
3086         Drive-by fix: the expected content length was never actually set by the owner of ImageDecoderAVFObjC.
3087         Now that the expected content length is available, we don't have to wait until the data is complete
3088         to respond to requests.
3089
3090         * platform/graphics/ImageSource.cpp:
3091         (WebCore::ImageSource::ensureDecoderAvailable):
3092         * platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.h:
3093         * platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.mm:
3094         (SOFT_LINK_POINTER_OPTIONAL):
3095         (-[WebCoreSharedBufferResourceLoaderDelegate canFulfillRequest:]):
3096         (-[WebCoreSharedBufferResourceLoaderDelegate fulfillRequest:]):
3097         (-[WebCoreSharedBufferResourceLoaderDelegate resourceLoader:shouldWaitForLoadingOfRequestedResource:]):
3098         (WebCore::imageDecoderAssetOptions):
3099         (WebCore::ImageDecoderAVFObjC::firstEnabledTrack):
3100         (WebCore::ImageDecoderAVFObjC::storeSampleBuffer):
3101         (WebCore::ImageDecoderAVFObjC::createFrameImageAtIndex):
3102         (WebCore::ImageDecoderAVFObjC::setExpectedContentSize):
3103
3104 2017-10-12  Matt Rajca  <mrajca@apple.com>
3105
3106         Add API support for quirk that lets an arbitrary click allow auto-play.
3107         https://bugs.webkit.org/show_bug.cgi?id=178227
3108
3109         Reviewed by Alex Christensen.
3110
3111         Added API test.
3112         
3113         Instead of hardcoding sites in WebCore, let API clients control which websites opt into the quirk that lets
3114         an arbitrary click allow auto-play via website policies.
3115
3116         * html/MediaElementSession.cpp:
3117         (WebCore::needsArbitraryUserGestureAutoplayQuirk):
3118         * loader/DocumentLoader.h:
3119
3120 2017-10-16  Chris Dumez  <cdumez@apple.com>
3121
3122         DOMQuad.p1 / p2 / p3 / p4 should behave as [SameObject]
3123         https://bugs.webkit.org/show_bug.cgi?id=178366
3124
3125         Reviewed by Youenn Fablet.
3126
3127         DOMQuad.p1 / p2 / p3 / p4 should behave as [SameObject]. We attempted to do so using JSDOMQuad::visitAdditionalChildren()
3128         but the code did not work because we failed to generate a "isReachableFromOpaqueRoots()" function for JSDOMPoint.
3129
3130         Test: fast/css/DOMQuad-points-SameObject.html
3131
3132         * dom/DOMPoint.idl:
3133
3134 2017-10-16  Andy Estes  <aestes@apple.com>
3135
3136         [Apple Pay] Add subLocality and subAdministrativeArea to ApplePayPaymentContact and ApplePayError
3137         https://bugs.webkit.org/show_bug.cgi?id=178191
3138         <rdar://problem/34906367>
3139
3140         Reviewed by Tim Horton.
3141
3142         Added test cases to http/tests/ssl/applepay/ApplePaySession.html.
3143
3144         * Modules/applepay/ApplePayError.idl:
3145         * Modules/applepay/ApplePayPaymentContact.h:
3146         * Modules/applepay/ApplePayPaymentContact.idl:
3147         * Modules/applepay/ApplePaySessionPaymentRequest.h:
3148         * Modules/applepay/cocoa/PaymentContactCocoa.mm:
3149         (WebCore::subLocality):
3150         (WebCore::setSubLocality):
3151         (WebCore::subAdministrativeArea):
3152         (WebCore::setSubAdministrativeArea):
3153         (WebCore::convert):
3154
3155 2017-10-16  Alex Christensen  <achristensen@webkit.org>
3156
3157         Allow modern decoding of URLs
3158         https://bugs.webkit.org/show_bug.cgi?id=178265
3159
3160         Reviewed by Chris Dumez.
3161
3162         * platform/URL.h:
3163         (WebCore::URL::decode):
3164
3165 2017-10-16  Ryan Haddad  <ryanhaddad@apple.com>
3166
3167         Unreviewed, rolling out r223425.
3168
3169         This change broke internal builds.
3170
3171         Reverted changeset:
3172
3173         "Remove unnecessary include from Document.h"
3174         https://bugs.webkit.org/show_bug.cgi?id=178247
3175         https://trac.webkit.org/changeset/223425
3176
3177 2017-10-16  Maureen Daum  <mdaum@apple.com>
3178
3179         If an origin doesn't have databases in the Databases table we should still remove its information from disk in DatabaseTracker::deleteOrigin()
3180         https://bugs.webkit.org/show_bug.cgi?id=178281
3181         <rdar://problem/34576132>
3182
3183         Reviewed by Brent Fulgham.
3184
3185         New test:
3186         DatabaseTracker.DeleteOriginWithMissingEntryInDatabasesTable
3187
3188         * Modules/webdatabase/DatabaseTracker.cpp:
3189         (WebCore::DatabaseTracker::deleteOrigin):
3190         If databaseNames is empty, don't bail early. Instead, delete everything in the directory
3191         containing the databases for this origin. This condition indicates that we previously
3192         tried to remove the origin but didn't get all of the way through the deletion process.
3193         Because we have lost track of the databases for this origin, we can assume that no
3194         other process is accessing them. This means it should be safe to delete them outright.
3195
3196 2017-10-16  Youenn Fablet  <youenn@apple.com>
3197
3198         [FETCH] Remove Request.type getter
3199         https://bugs.webkit.org/show_bug.cgi?id=177798
3200
3201         Reviewed by Chris Dumez.
3202
3203         Tests: imported/w3c/web-platform-tests/fetch/api/request/request-type-attribute-historical.html
3204                imported/w3c/web-platform-tests/fetch/api/request/url-encoding.html
3205
3206         Removing FetchRequest type getter.
3207         Merging Type and Destination as per https://fetch.spec.whatwg.org/#concept-request-destination.
3208         Setting destination of request within CachedResourceLoader as this will be useful to Service Workers.
3209
3210         * Modules/fetch/FetchRequest.h:
3211         * Modules/fetch/FetchRequest.idl:
3212         * loader/FetchOptions.h:
3213         (WebCore::FetchOptions::isolatedCopy const):
3214         (WebCore::FetchOptions::FetchOptions):
3215         (WebCore::FetchOptions::encode const):
3216         (WebCore::FetchOptions::decode):
3217         * loader/ThreadableLoader.cpp:
3218         (WebCore::ThreadableLoaderOptions::isolatedCopy const):
3219         * loader/cache/CachedResourceLoader.cpp:
3220         (WebCore::CachedResourceLoader::requestImage):
3221         (WebCore::CachedResourceLoader::requestFont):
3222         (WebCore::CachedResourceLoader::requestTextTrack):
3223         (WebCore::CachedResourceLoader::requestCSSStyleSheet):
3224         (WebCore::CachedResourceLoader::requestUserCSSStyleSheet):
3225         (WebCore::CachedResourceLoader::requestScript):
3226         (WebCore::CachedResourceLoader::requestXSLStyleSheet):
3227         (WebCore::CachedResourceLoader::requestMedia):
3228         (WebCore::CachedResourceLoader::requestIcon):
3229         (WebCore::CachedResourceLoader::requestRawResource):
3230         (WebCore::CachedResourceLoader::requestBeaconResource):
3231         (WebCore::CachedResourceLoader::requestMainResource):
3232         * loader/cache/CachedResourceRequest.cpp:
3233         (WebCore::CachedResourceRequest::setDestinationIfNotSet):
3234         * loader/cache/CachedResourceRequest.h:
3235
3236 2017-10-15  Ryosuke Niwa  <rniwa@webkit.org>
3237
3238         Cannot access images included in the content pasted from Microsoft Word
3239         https://bugs.webkit.org/show_bug.cgi?id=124391
3240         <rdar://problem/26862741>
3241
3242         Reviewed by Antti Koivisto.
3243
3244         The bug is caused by the fact Microsoft Word generates HTML content which references an image using file URL.
3245         Because the websites don't have access to arbtirary file URLs, this prevents editors such as TinyMCE to save
3246         those images.
3247
3248         This patch fixes the problem by converting file URLs for images and all other subresources in the web archive
3249         generated by Microsoft Word by blob URLs like r222839 for RTF/RTFD and r222119 for images.
3250
3251         To avoid revealing privacy sensitive information such as the absolute local file path to the user's home directory
3252         Microsoft Word and other applications in the system includes in the web archive placed in the system pasteboard,
3253         this patch also introduces the mechanism to sanitize when the HTML content is read by DataTransfer's getData.
3254
3255         This patch also introduces the sanitization for when writing HTML into the pasteboard since other applications
3256         in the syste which is capable to processing web archives are not necessarily equipped to pretect itself and the
3257         rest of the system from potentially dangerous JavaScript included in the web archive placed in the system pasteboard.
3258
3259         Finally, this patch expands the list of clipboard types that are exposed as "text/html" to the Web platform by
3260         adding the capability to convert RTF, RTFD, and web archive into HTML markup by introducing WebContentMarkupReader,
3261         a new subclass of PasteboardWebContentReader which creates a HTML markup instead of a document fragment. Most of
3262         the sanitization process happens in this new class, and will be expanded to WebContentReader to make pasting safer.
3263
3264         Tests: editing/pasteboard/data-transfer-get-data-on-pasting-html-uses-blob-url.html
3265                editing/pasteboard/data-transfer-set-data-sanitizes-html-when-copying-in-null-origin.html
3266                editing/pasteboard/data-transfer-set-data-sanitizes-html-when-copying.html
3267                editing/pasteboard/data-transfer-set-data-sanitlize-html-when-dragging-in-null-origin.html
3268                http/tests/security/clipboard/copy-paste-html-across-origin-sanitizes-html.html
3269                CopyHTML.Sanitizes
3270                DataInteractionTests.DataTransferSanitizeHTML
3271                PasteRTF.ExposesHTMLTypeInDataTransfer
3272                PasteRTFD.ExposesHTMLTypeInDataTransfer
3273                PasteRTFD.ImageElementUsesBlobURLInHTML
3274                PasteWebArchive.ExposesHTMLTypeInDataTransfer
3275
3276         * dom/DataTransfer.cpp:
3277         (WebCore::originIdentifierForDocument): Moved to Document::originIdentifierForPasteboard.
3278         (WebCore::DataTransfer::createForCopyAndPaste):
3279         (WebCore::DataTransfer::getDataForItem const): Use WebContentMarkupReader read HTMl content so that we can read
3280         web arhive, RTF, and RTFD as text/html.
3281         (WebCore::DataTransfer::getData const):
3282         (WebCore::DataTransfer::setData):
3283         (WebCore::DataTransfer::setDataFromItemList): Sanitize the HTML before placing into the system pasteboard.
3284         (WebCore::DataTransfer::createForDragStartEvent):
3285         (WebCore::DataTransfer::createForDrop):
3286         (WebCore::DataTransfer::createForUpdatingDropTarget):
3287         * dom/DataTransfer.h:
3288         * dom/DataTransfer.idl:
3289         * dom/DataTransferItem.cpp:
3290         (WebCore::DataTransferItem::getAsString const):
3291         * dom/Document.cpp:
3292         (WebCore::Document::originIdentifierForPasteboard): Renamed from uniqueIdentifier. Moved the code to use the origin
3293         string and then falling back to the UUID here from originIdentifierForDocument in DataTransfer.cpp.
3294         * dom/Document.h:
3295         * editing/WebContentReader.cpp:
3296         (WebCore::WebContentMarkupReader::shouldSanitize const): Added.
3297         * editing/WebContentReader.h:
3298         (WebCore::WebContentMarkupReader): Added.
3299         (WebCore::WebContentMarkupReader::WebContentMarkupReader):
3300         * editing/cocoa/WebContentReaderCocoa.mm:
3301         (WebCore::createFragmentFromWebArchive): Extracted out of WebContentReader::readWebArchive to share code.
3302         (WebCore::WebContentReader::readWebArchive):
3303         (WebCore::WebContentMarkupReader::readWebArchive): Added. Reads the web archive, replace all subresource URLs by
3304         blob URLs, and re-generate the markup using our copy & paste code. The last step is requied to strip away any privacy
3305         sensitive information as well as potentially dangerous JavaScript code.
3306         (WebCore::stripMicrosoftPrefix): Extracted out of WebContentReader::readHTML to share code.
3307         (WebCore::WebContentReader::readHTML):
3308         (WebCore::WebContentMarkupReader::readHTML): Added. Only sanitize the markup when it comes from a different origin.
3309         (WebCore::WebContentReader::readRTFD): Added a nullity check for frame.document().
3310         (WebCore::WebContentMarkupReader::readRTFD): Added.
3311         (WebCore::WebContentMarkupReader::readRTF): Added.
3312         * editing/markup.h:
3313         * editing/markup.cpp:
3314         (WebCore::createPageForSanitizingWebContent): Added.
3315         (WebCore::sanitizeMarkup): Added. This function "pastes" the markup into a new isolated document then reserializes
3316         using our serialization code for copy. It strips away all invisible information such as comments, and strips away
3317         event handlers and script elements to remove potentially dangerous scripts.
3318         * platform/Pasteboard.h:
3319         * platform/ios/PasteboardIOS.mm:
3320         (WebCore::Pasteboard::readPasteboardWebContentDataForType): Now that this code can be called by DataTransfer, added
3321         the checks for the change count to make sure we stop letting web content read if the pasteboard had been changed by
3322         some other applications. To do this, turned this function into a member of Pasteboard. Also changed the return type
3323         to an enum with tri-state to exist the loop early in the call sites.
3324         (WebCore::Pasteboard::read):
3325         (WebCore::Pasteboard::readRespectingUTIFidelities):
3326         * platform/ios/PlatformPasteboardIOS.mm:
3327         (WebCore::safeTypeForDOMToReadAndWriteForPlatformType): Treat RTF, RTFD, and web archive as HTML.
3328         * platform/mac/PasteboardMac.mm:
3329         (WebCore::Pasteboard::read): Add the change count checks now that this code can be called by DataTransfer.
3330         * platform/mac/PlatformPasteboardMac.mm:
3331         (WebCore::safeTypeForDOMToReadAndWriteForPlatformType): Treat RTF, RTFD, and web archive as HTML.
3332
3333 2017-10-16  Ryan Haddad  <ryanhaddad@apple.com>
3334
3335         Unreviewed attempt to fix the Windows debug build.
3336
3337         * Modules/webdatabase/DatabaseTracker.cpp:
3338         (WebCore::DatabaseTracker::deleteOrigin):
3339
3340 2017-10-16  Chris Dumez  <cdumez@apple.com>
3341
3342         Log using differential privacy domains where the WebContent process crashes
3343         https://bugs.webkit.org/show_bug.cgi?id=178346
3344         <rdar://problem/33293830>
3345
3346         Reviewed by Alex Christensen.
3347
3348         Add new diagnostic logging key for domain causing crashes.
3349
3350         * page/DiagnosticLoggingKeys.cpp:
3351         (WebCore::DiagnosticLoggingKeys::domainCausingCrashKey):
3352         * page/DiagnosticLoggingKeys.h:
3353
3354 2017-10-16  Sam Weinig  <sam@webkit.org>
3355
3356         [Settings] Remove all custom code from Settings.h/cpp
3357         https://bugs.webkit.org/show_bug.cgi?id=178330
3358
3359         Reviewed by Simon Fraser.
3360
3361         Removes the two remaining functions out of Settings paving the way
3362         for the file to be generated.
3363         
3364         - pageDestroyed was moved down into SettingsBase.
3365         - effectiveFrameFlattening was moved to FrameView (to reduce the need
3366           for additional includes, the FrameFlattening enum was converted to
3367           an enum class to allow it to be forward declared).
3368           
3369         Also moves default values into SettingsDefaultValues.h
3370
3371         * WebCore.xcodeproj/project.pbxproj:
3372         
3373             Add new files.
3374         
3375         * page/FrameView.cpp:
3376         * page/FrameView.h:
3377
3378             Move effectiveFrameFlattening function here from Settings.
3379
3380         * page/Settings.cpp:
3381         * page/Settings.h:
3382
3383             Move effectiveFrameFlattening, pageDestroyed and default values out.
3384
3385         * page/Settings.in:
3386         
3387             Update for turning FrameFlattening into an enum class.
3388         
3389         * page/SettingsBase.h:
3390
3391             Turn FrameFlattening into an enum class and move pageDestroyed here.
3392
3393         * page/SettingsDefaultValues.h: Added.
3394
3395             Move all the default values from Settings here.
3396
3397         * rendering/RenderFrameSet.cpp:
3398         * rendering/RenderIFrame.cpp:
3399         * rendering/RenderView.cpp:
3400
3401             Get effectiveFrameFlattening from the FrameView.
3402
3403         * testing/InternalSettings.cpp:
3404         * testing/InternalSettings.h:
3405         
3406             Update now that FrameFlattening is an enum class.
3407
3408 2017-10-16  Maureen Daum  <mdaum@apple.com>
3409
3410         If we fail to delete any database file, don't remove its information from the tracker database
3411         <rdar://problem/34576132> and https://bugs.webkit.org/show_bug.cgi?id=178251
3412
3413         Reviewed by Brady Eidson.
3414
3415         New tests:
3416         DatabaseTracker.DeleteDatabase
3417         DatabaseTracker.DeleteDatabaseWhenDatabaseDoesNotExist
3418         DatabaseTracker.DeleteOrigin
3419         DatabaseTracker.DeleteOriginWhenDeletingADatabaseFails
3420         DatabaseTracker.DeleteOriginWhenDatabaseDoesNotExist
3421
3422         * Modules/webdatabase/DatabaseTracker.cpp:
3423         (WebCore::DatabaseTracker::deleteDatabasesModifiedSince):
3424         If the database doesn't exist, we previously deleted it but failed to remove the
3425         information from the tracker database. We still want to delete all of the information
3426         associated with this database from the tracker database, so add it to databaseNamesToDelete.
3427         (WebCore::DatabaseTracker::deleteOrigin):
3428         If a database doesn't exist, don't try to delete it. We don't need to, but more
3429         importantly, deleteDatabaseFile() will fail if the database doesn't exist, which
3430         will cause us to incorrectly think we failed to remove database information from disk.
3431         If we actually fail to delete any database file, return before we remove the origin
3432         information from the tracker database so we don't lose track of the database.
3433         (WebCore::DatabaseTracker::deleteDatabase):
3434         If a database doesn't exist, don't try to delete it. We don't need to, but also it
3435         will cause us to incorrectly think that we were unable to delete a database, so we
3436         would bail before we remove the database information from the tracker database. We
3437         want to remove the database information from the tracker database because the database
3438         doesn't exist.
3439         * Modules/webdatabase/DatabaseTracker.h:
3440         Expose fullPathForDatabase() for use by tests.
3441         * platform/Logging.h:
3442         Add a logging channel.
3443
3444 2017-10-16  Alex Christensen  <achristensen@webkit.org>
3445
3446         Remove unnecessary include from Document.h
3447         https://bugs.webkit.org/show_bug.cgi?id=178247
3448
3449         Reviewed by Darin Adler.
3450
3451         * dom/Document.cpp:
3452         (WebCore::Document::hasTouchEventHandlers const):
3453         (WebCore::Document::touchEventTargetsContain const):
3454         * dom/Document.h:
3455         (WebCore::Document::hasTouchEventHandlers const): Deleted.
3456         (WebCore::Document::touchEventTargetsContain const): Deleted.
3457
3458 2017-10-16  Alex Christensen  <achristensen@webkit.org>
3459
3460         Fix iOS build after r223422
3461         https://bugs.webkit.org/show_bug.cgi?id=178251
3462
3463         * Modules/webdatabase/DatabaseManager.h:
3464
3465 2017-10-16  Maureen Daum  <mdaum@apple.com>
3466
3467         We should wrap the removal of information from the tracker database in a transaction in DatabaseTracker::deleteOrigin()
3468         https://bugs.webkit.org/show_bug.cgi?id=178274
3469         <rdar://problem/34576132>
3470
3471         Reviewed by Tim Horton.
3472
3473         * Modules/webdatabase/DatabaseTracker.cpp:
3474         (WebCore::DatabaseTracker::deleteOrigin):
3475         Wrap the removal of information from the tracker database in a transaction so that
3476         we don't end up in a case where only one of the tables contains information about
3477         an origin.
3478         If anything goes wrong when we're modifying the tracker database, rollback the transaction
3479         before bailing.
3480
3481 2017-10-16  Ryan Haddad  <ryanhaddad@apple.com>
3482
3483         Unreviewed, rolling out r223419.
3484
3485         This change broke the Windows build.
3486
3487         Reverted changeset:
3488
3489         "If we fail to delete any database file, don't remove its
3490         information from the tracker database"
3491         https://bugs.webkit.org/show_bug.cgi?id=178251
3492         https://trac.webkit.org/changeset/223419
3493
3494 2017-10-16  Maureen Daum  <mdaum@apple.com>
3495
3496         If we fail to delete any database file, don't remove its information from the tracker database
3497         <rdar://problem/34576132> and https://bugs.webkit.org/show_bug.cgi?id=178251
3498
3499         Reviewed by Brady Eidson.
3500
3501         New tests:
3502         DatabaseTracker.DeleteDatabase
3503         DatabaseTracker.DeleteDatabaseWhenDatabaseDoesNotExist
3504         DatabaseTracker.DeleteOrigin
3505         DatabaseTracker.DeleteOriginWhenDeletingADatabaseFails
3506         DatabaseTracker.DeleteOriginWhenDatabaseDoesNotExist
3507
3508         * Modules/webdatabase/DatabaseTracker.cpp:
3509         (WebCore::DatabaseTracker::deleteDatabasesModifiedSince):
3510         If the database doesn't exist, we previously deleted it but failed to remove the
3511         information from the tracker database. We still want to delete all of the information
3512         associated with this database from the tracker database, so add it to databaseNamesToDelete.
3513         (WebCore::DatabaseTracker::deleteOrigin):
3514         If a database doesn't exist, don't try to delete it. We don't need to, but more
3515         importantly, deleteDatabaseFile() will fail if the database doesn't exist, which
3516         will cause us to incorrectly think we failed to remove database information from disk.
3517         If we actually fail to delete any database file, return before we remove the origin
3518         information from the tracker database so we don't lose track of the database.
3519         (WebCore::DatabaseTracker::deleteDatabase):
3520         If a database doesn't exist, don't try to delete it. We don't need to, but also it
3521         will cause us to incorrectly think that we were unable to delete a database, so we
3522         would bail before we remove the database information from the tracker database. We
3523         want to remove the database information from the tracker database because the database
3524         doesn't exist.
3525         * Modules/webdatabase/DatabaseTracker.h:
3526         Expose fullPathForDatabase() for use by tests.
3527         * platform/Logging.h:
3528         Add a logging channel.
3529
3530 2017-10-16  Brent Fulgham  <bfulgham@apple.com>
3531
3532         REGRESSION(223307): ASSERTION in WebCore::ResourceLoadObserver::logUserInteractionWithReducedTimeResolution
3533         https://bugs.webkit.org/show_bug.cgi?id=178342
3534         <rdar://problem/35008505>
3535
3536         Reviewed by Chris Dumez.
3537
3538         In r223307 I mistakenly used 'topDocument->topDocument()' because of a copy/paste error. I should have just used
3539         'topDocument'.
3540
3541         Tests: CommandBackForwardTestWKWebView in TestWebKitAPI.
3542
3543         * loader/ResourceLoadObserver.cpp:
3544         (WebCore::ResourceLoadObserver::logUserInteractionWithReducedTimeResolution): We might enter this routine at a time
3545         where there is no page. If so, we should return early and not log credit.
3546         * page/EventHandler.cpp:
3547         (WebCore::EventHandler::keyEvent): Correct the argument passed to the log function.
3548
3549 2017-10-15  Filip Pizlo  <fpizlo@apple.com>
3550
3551         Make some asserts into release asserts
3552         https://bugs.webkit.org/show_bug.cgi?id=178324
3553
3554         Reviewed by Saam Barati.
3555
3556         No new tests because no change in behavior.
3557         
3558         This introduces some release asserts. Perf testing shows that it's neutral. So, we get some extra
3559         safety without losing any perf.
3560
3561         * dom/ContainerNodeAlgorithms.cpp:
3562         (WebCore::notifyChildNodeInserted):
3563         * dom/Document.cpp:
3564         (WebCore::Document::adoptNode):
3565         (WebCore::Document::frameDestroyed):
3566         (WebCore::Document::attachToCachedFrame):
3567         (WebCore::Document::detachFromCachedFrame):
3568         (WebCore::Document::prepareForDestruction):
3569         (WebCore::Document::dispatchWindowEvent):
3570         (WebCore::Document::dispatchWindowLoadEvent):
3571         (WebCore::Document::applyQuickLookSandbox):
3572         * dom/DocumentOrderedMap.cpp:
3573         (WebCore::DocumentOrderedMap::add):
3574         (WebCore::DocumentOrderedMap::remove):
3575         (WebCore::DocumentOrderedMap::get const):
3576         (WebCore:: const):
3577         * dom/Node.cpp:
3578         (WebCore::Node::~Node):
3579         (WebCore::DidMoveToNewDocumentAssertionScope::~DidMoveToNewDocumentAssertionScope):
3580         (WebCore::DidMoveToNewDocumentAssertionScope::didRecieveCall):
3581         (WebCore::moveNodeToNewDocument):
3582         (WebCore::moveShadowTreeToNewDocument):
3583         (WebCore::Node::moveTreeToNewScope):
3584         (WebCore::Node::didMoveToNewDocument):
3585         (WebCore::Node::dispatchSubtreeModifiedEvent):
3586         (WebCore::Node::dispatchDOMActivateEvent):
3587
3588 2017-10-16  Alejandro G. Castro  <alex@igalia.com>
3589
3590         Make RealtimeIncomingAudioSources and RealtimeOutgoingAudioSources port agnostic
3591         https://bugs.webkit.org/show_bug.cgi?id=177928
3592
3593         Reviewed by Youenn Fablet.
3594
3595         Refactor the RealtimeIncomingAudioSource and RealtimeOutgoingAudioSource classes,
3596         move the mac specific code to a different class. This way we can use them from
3597         other ports.
3598
3599         No new tests, we are not adding new functionality just refactoring.
3600
3601         * CMakeLists.txt:
3602         * WebCore.xcodeproj/project.pbxproj:
3603         * platform/mediastream/RealtimeIncomingAudioSource.cpp: Copied from Source/WebCore/platform/mediastream/mac/RealtimeIncomingAudioSource.h. Just the port agnostic parts.
3604         * platform/mediastream/RealtimeIncomingAudioSource.h: Copied from Source/WebCore/platform/mediastream/mac/RealtimeIncomingAudioSource.h. Ditto.
3605         * platform/mediastream/RealtimeOutgoingAudioSource.cpp: Copied from Source/WebCore/platform/mediastream/mac/RealtimeOutgoingAudioSource.cpp. Ditto.
3606         * platform/mediastream/RealtimeOutgoingAudioSource.h: Copied from Source/WebCore/platform/mediastream/mac/RealtimeOutgoingAudioSource.h. Ditto.
3607         * platform/mediastream/mac/RealtimeIncomingAudioSourceCocoa.cpp: Added, it adds Cocoa code parts from original Source/WebCore/platform/mediastream/mac/RealtimeIncomingAudioSource.cpp.
3608         (WebCore::RealtimeIncomingAudioSource::create): Moved this function from the RealtimeOutgoingAudioSource.cpp file to avoid including the Cocoa file there.
3609         * platform/mediastream/mac/RealtimeIncomingAudioSourceCocoa.h: Added Cocoa code from original Source/WebCore/platform/mediastream/mac/RealtimeIncomingAudioSource.h.
3610         * platform/mediastream/mac/RealtimeOutgoingAudioSourceCocoa.cpp: Added Cocoa code from original Source/WebCore/platform/mediastream/mac/RealtimeOutgoingAudioSource.cpp.
3611         (WebCore::RealtimeOutgoingAudioSource::create): Moved this function from the RealtimeOutgoingAudioSource.cpp file to avoid including the Cocoa file there.
3612         * platform/mediastream/mac/RealtimeOutgoingAudioSourceCocoa.h: Added Cocoa code from the original Source/WebCore/platform/mediastream/mac/RealtimeOutgoingAudioSource.h.
3613
3614 2017-10-16  Wenson Hsieh  <wenson_hsieh@apple.com>
3615
3616         Unreviewed, fix the tvOS build after r223340.
3617
3618         Add a new #define in PlatformPasteboardIOS.mm for item provider support, and guard usages of
3619         WebItemProviderPasteboard using it.
3620
3621         * platform/ios/PlatformPasteboardIOS.mm:
3622         (WebCore::pasteboardMayContainFilePaths):
3623         (WebCore::PlatformPasteboard::readURL):
3624
3625 2017-10-16  Ryan Haddad  <ryanhaddad@apple.com>
3626
3627         Unreviewed, rolling out r223271.
3628
3629         This change introduced LayoutTest failures on WK1.
3630
3631         Reverted changeset:
3632
3633         "Use asynchronous ResourceHandleClient calls for WebKit1"
3634         https://bugs.webkit.org/show_bug.cgi?id=160677
3635         https://trac.webkit.org/changeset/223271
3636
3637 2017-10-16  Alejandro G. Castro  <alex@igalia.com>
3638
3639         Make RealtimeIncomingVideoSources and RealtimeOutgoingVideoSources port agnostic
3640         https://bugs.webkit.org/show_bug.cgi?id=177869
3641
3642         Reviewed by Youenn Fablet.
3643
3644         Refactor the RealtimeIncomingVideoSource and RealtimeOutgoingVideoSource classes,
3645         move the cocoa specific code to a different class. This way we can use them from
3646         other ports.
3647
3648         No new functionality, just a refactor.
3649
3650         * CMakeLists.txt:
3651         * WebCore.xcodeproj/project.pbxproj:
3652         * platform/mediastream/RealtimeIncomingVideoSource.cpp: Moved from Source/WebCore/platform/mediastream/mac/RealtimeIncomingVideoSource.h. Just the port agnostic parts.
3653         * platform/mediastream/RealtimeIncomingVideoSource.h: Moved from Source/WebCore/platform/mediastream/mac/RealtimeIncomingVideoSource.h. DItto
3654         * platform/mediastream/RealtimeOutgoingVideoSource.cpp: Moved from Source/WebCore/platform/mediastream/mac/RealtimeOutgoingVideoSource.cpp. Ditto
3655         * platform/mediastream/RealtimeOutgoingVideoSource.h: Moved from Source/WebCore/platform/mediastream/mac/RealtimeOutgoingVideoSource.h. Ditto
3656         * platform/mediastream/mac/RealtimeIncomingVideoSourceMac.cpp: Added, it adds the Cocoa specific parts from Source/WebCore/platform/mediastream/mac/RealtimeIncomingVideoSource.cpp.
3657         (WebCore::RealtimeIncomingVideoSource::create): Moved this function from the base class, it allows avoiding the include.
3658         * platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.h: Added, cocoa dependent code from Source/WebCore/platform/mediastream/mac/RealtimeIncomingVideoSource.h.
3659         (WebCore::RealtimeOutgoingVideoSource::create): Moved this funtion from the base class, now we can use the Cocoa create without including it in the base class.
3660         * platform/mediastream/mac/RealtimeOutgoingVideoSourceCocoa.cpp: Added, cocoa dependent code.
3661         * platform/mediastream/mac/RealtimeOutgoingVideoSourceCocoa.h: Added, cocoa dependent code.
3662
3663 2017-10-16  Manuel Rego Casasnovas  <rego@igalia.com>
3664
3665         Don't use intrinsic width if our container's width is zero
3666         https://bugs.webkit.org/show_bug.cgi?id=178073
3667
3668         Reviewed by Sergio Villar Senin.
3669
3670         Based on Blink r173212 by <robhogan@gmail.com>.
3671         https://chromium.googlesource.com/chromium/src/+/1592e8a1e8e56dfa6e5d709c50b129ae659c2fad
3672
3673         Since at least r798 we use a replaced element's intrinsic width
3674         if its containing block has a width of zero. As a result our rendering
3675         of width100percent-image.html has disagreed with all other browsers
3676         and we display replaced elements when they should be invisible.
3677
3678         Test: fast/replaced/container-width-zero.html
3679
3680         * rendering/RenderBox.cpp:
3681         (WebCore::RenderBox::computeReplacedLogicalWidthUsing const):
3682         If our container has zero width then let our width be zero too.
3683
3684 2017-10-16  Wenson Hsieh  <wenson_hsieh@apple.com>
3685
3686         On ToT, event.dataTransfer.getData("text/uri-list") returns an empty string when dragging an image
3687         https://bugs.webkit.org/show_bug.cgi?id=178301
3688         <rdar://problem/34990050>
3689
3690         Reviewed by Darin Adler.
3691
3692         After r222656, we consider images on the pasteboard to be files. This causes DataTransfer.getData to return the
3693         empty string for all types, which brings back https://bugs.webkit.org/show_bug.cgi?id=170637. To allow pages to
3694         access the URL part of a dragged image, we exempt "text/uri-list" from our heurstics to hide pasteboard data
3695         which may contain files, and return the URL as long as its protocol is either HTTP or HTTPS.
3696
3697         Tweaked an existing layout test to cover this scenario, as well as the scenario in which the dragged image links
3698         to a file URL (in which case we should avoid exposing the data).
3699
3700         Test: editing/pasteboard/drag-drop-href-as-url.html
3701               DataInteractionTests.DataTransferGetDataWhenDroppingImageWithHTTPURL
3702
3703         * dom/DataTransfer.cpp:
3704         (WebCore::DataTransfer::getDataForItem const):
3705
3706         When the pasteboard contains files, allow data for "text/uri-list" to be returned, as long as the URL string has
3707         a white-listed protocol (currently, this is just http and https).
3708
3709         (WebCore::DataTransfer::shouldSuppressGetAndSetDataToAvoidExposingFilePaths const):
3710         (WebCore::DataTransfer::setData):
3711         (WebCore::DataTransfer::types const):
3712
3713         When the pasteboard contains files, allow "text/uri-list" to be added, alongside the "Files" type, if it would
3714         have been exposed in the list of safe DOM types.
3715
3716         * dom/DataTransfer.h:
3717         * platform/Pasteboard.cpp:
3718         (WebCore::Pasteboard::canExposeURLToDOMWhenPasteboardContainsFiles):
3719
3720         Add a new helper method to determine whether it is safe to expose an URL string as "text/uri-list" to bindings,
3721         if the pasteboard contains files. While this currently checks whether or not the URL is in the HTTP family, we
3722         may want to consider tweaking this to blacklist the "file" protocol instead, and allow all other valid URLs by
3723         default.
3724
3725         * platform/Pasteboard.h:
3726         * platform/PlatformPasteboard.h:
3727         * platform/ios/PlatformPasteboardIOS.mm:
3728         (WebCore::pasteboardMayContainFilePaths):
3729         (WebCore::PlatformPasteboard::stringForType const):
3730
3731         Mark stringForType as const, and also teach stringForType to return the null string for the platform URL type if
3732         the pasteboard might contain file paths.
3733
3734         (WebCore::PlatformPasteboard::typesSafeForDOMToReadAndWrite const):
3735
3736         Before coercing a platform type to "text/uri-list" when building the list of DOM-safe types, check that the
3737         stringForType is not the empty string, in which case we don't expose the type to the DOM at all. This ensures
3738         that in cases where the URL might reveal a file path, we don't advertise "text/uri-list" as a type. We adopt a
3739         similar strategy on iOS.
3740
3741         (WebCore::PlatformPasteboard::stringForType): Deleted.
3742         * platform/mac/PlatformPasteboardMac.mm:
3743         (WebCore::pasteboardMayContainFilePaths):
3744         (WebCore::PlatformPasteboard::stringForType const):
3745         (WebCore::PlatformPasteboard::typesSafeForDOMToReadAndWrite const):
3746         (WebCore::PlatformPasteboard::stringForType): Deleted.
3747
3748 2017-10-16  Frederic Wang  <fwang@igalia.com>
3749
3750         Use auto/nullptr in scrolling code
3751         https://bugs.webkit.org/show_bug.cgi?id=178306
3752
3753         Reviewed by Carlos Garcia Campos.
3754
3755         This patch modifies the scrolling code to use the auto keyword when
3756         possible. It also replaces '0' with 'nullptr' for the return value of
3757         ScrollingStateTree::stateNodeForID.
3758
3759         No new tests, behavior unchanged.
3760
3761         * page/scrolling/AsyncScrollingCoordinator.cpp:
3762         (WebCore::AsyncScrollingCoordinator::frameViewLayoutUpdated):
3763         (WebCore::AsyncScrollingCoordinator::frameViewRootLayerDidChange):
3764         (WebCore::AsyncScrollingCoordinator::requestScrollPositionUpdate):
3765         (WebCore::AsyncScrollingCoordinator::frameViewForScrollingNode const):
3766         (WebCore::AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScroll):
3767         (WebCore::AsyncScrollingCoordinator::reconcileScrollingState):
3768         (WebCore::AsyncScrollingCoordinator::updateFrameScrollingNode):
3769         (WebCore::AsyncScrollingCoordinator::updateOverflowScrollingNode):
3770         (WebCore::AsyncScrollingCoordinator::updateNodeLayer):
3771         (WebCore::AsyncScrollingCoordinator::updateNodeViewportConstraints):
3772         (WebCore::AsyncScrollingCoordinator::setSynchronousScrollingReasons):
3773         (WebCore::AsyncScrollingCoordinator::updateScrollLayerPosition):
3774         (WebCore::AsyncScrollingCoordinator::setActiveScrollSnapIndices):
3775         * page/scrolling/ScrollingCoordinator.cpp:
3776         (WebCore::ScrollingCoordinator::coordinatesScrollingForFrameView const):
3777         (WebCore::ScrollingCoordinator::absoluteEventTrackingRegionsForFrame const):
3778         (WebCore::ScrollingCoordinator::scrollLayerForFrameView):
3779         (WebCore::ScrollingCoordinator::headerLayerForFrameView):
3780         (WebCore::ScrollingCoordinator::footerLayerForFrameView):
3781         (WebCore::ScrollingCoordinator::counterScrollingLayerForFrameView):
3782         (WebCore::ScrollingCoordinator::insetClipLayerForFrameView):
3783         (WebCore::ScrollingCoordinator::contentShadowLayerForFrameView):
3784         (WebCore::ScrollingCoordinator::rootContentLayerForFrameView):
3785         (WebCore::ScrollingCoordinator::handleWheelEventPhase):
3786         (WebCore::ScrollingCoordinator::hasVisibleSlowRepaintViewportConstrainedObjects const):
3787         (WebCore::ScrollingCoordinator::updateSynchronousScrollingReasonsForAllFrames):
3788         (WebCore::ScrollingCoordinator::synchronousScrollingReasonsAsText const):
3789         * page/scrolling/ScrollingStateFixedNode.cpp:
3790         (WebCore::ScrollingStateFixedNode::reconcileLayerPositionForViewportRect):
3791         * page/scrolling/ScrollingStateStickyNode.cpp:
3792         (WebCore::ScrollingStateStickyNode::reconcileLayerPositionForViewportRect):
3793         * page/scrolling/ScrollingStateTree.cpp:
3794         (WebCore::ScrollingStateTree::nodeTypeAndParentMatch const):
3795         (WebCore::ScrollingStateTree::attachNode):
3796         (WebCore::ScrollingStateTree::detachNode):
3797         (WebCore::ScrollingStateTree::removeNodeAndAllDescendants):
3798         (WebCore::ScrollingStateTree::stateNodeForID const):
3799         * page/scrolling/ScrollingTree.cpp:
3800         (WebCore::ScrollingTree::shouldHandleWheelEventSynchronously):
3801         (WebCore::ScrollingTree::viewportChangedViaDelegatedScrolling):
3802         (WebCore::ScrollingTree::scrollPositionChangedViaDelegatedScrolling):
3803         (WebCore::ScrollingTree::commitTreeState):
3804         (WebCore::ScrollingTree::updateTreeFromStateNode):
3805         * page/scrolling/ScrollingTreeNode.cpp:
3806         (WebCore::ScrollingTreeNode::enclosingFrameNode const):
3807         * page/scrolling/coordinatedgraphics/ScrollingCoordinatorCoordinatedGraphics.cpp:
3808         (WebCore::ScrollingCoordinatorCoordinatedGraphics::detachFromStateTree):
3809         (WebCore::ScrollingCoordinatorCoordinatedGraphics::updateNodeLayer):
3810         (WebCore::ScrollingCoordinatorCoordinatedGraphics::updateNodeViewportConstraints):
3811         (WebCore::ScrollingCoordinatorCoordinatedGraphics::scrollableAreaScrollLayerDidChange):
3812         (WebCore::ScrollingCoordinatorCoordinatedGraphics::willDestroyScrollableArea):
3813
3814 2017-10-16  Fujii Hironori  <Hironori.Fujii@sony.com>
3815
3816         A lot of "Can't stat WebCore/animation: No such file or directory" since r223328
3817         https://bugs.webkit.org/show_bug.cgi?id=178326
3818
3819         Unreviewed build fix
3820
3821         The directory WebCore/animation was removed in r223328.
3822
3823         No new tests because there is no behavior change.
3824
3825         * CMakeLists.txt: Removed animation from
3826         WebCore_INCLUDE_DIRECTORIES and WebCore_IDL_INCLUDES.
3827         * DerivedSources.make: Removed animation from VPATH and IDL_INCLUDES
3828
3829 2017-10-16  Frederic Wang  <fwang@igalia.com>
3830
3831         Replace some ScrollingTreeNode::nodeType() calls with is*Node()
3832         https://bugs.webkit.org/show_bug.cgi?id=178259
3833
3834         Reviewed by Darin Adler.
3835
3836         No new tests, behavior unchanged.
3837
3838         * page/scrolling/AsyncScrollingCoordinator.cpp:
3839         (WebCore::AsyncScrollingCoordinator::frameViewForScrollingNode const):
3840         * page/scrolling/ScrollingStateNode.h:
3841         (WebCore::ScrollingStateNode::isScrollingNode const):
3842         * page/scrolling/ScrollingTree.cpp:
3843         (WebCore::ScrollingTree::updateTreeFromStateNode):
3844         * page/scrolling/ScrollingTreeNode.cpp:
3845         (WebCore::ScrollingTreeNode::enclosingFrameNode const):
3846         * page/scrolling/ScrollingTreeNode.h:
3847         (WebCore::ScrollingTreeNode::isScrollingNode const):
3848
3849 2017-10-16  Tomas Popela  <tpopela@redhat.com>
3850
3851         DataTransfer.cpp triggers -Wunused-but-set-variable
3852         https://bugs.webkit.org/show_bug.cgi?id=178209
3853
3854         Reviewed by Wenson Hsieh.
3855
3856         Use the ASSERT_UNUSED to silence it.
3857
3858         * dom/DataTransfer.cpp:
3859         (WebCore::DataTransfer::filesFromPasteboardAndItemList const):
3860
3861 2017-10-15  Sam Weinig  <sam@webkit.org>
3862
3863         [Settings] Split non-macro generated parts of Settings into SettingsBase base class
3864         https://bugs.webkit.org/show_bug.cgi?id=178321
3865
3866         Reviewed by Darin Adler.
3867
3868         Working towards getting generated Settings working again, but in smaller patches, split
3869         non-generated part off into SettingsBase as a first step.
3870         
3871         One function, effectiveFrameFlattening(), needs to remain in Settings for now, as it directly
3872         references a macro generated function, frameFlattening().
3873
3874         * CMakeLists.txt:
3875         * WebCore.xcodeproj/project.pbxproj:
3876         * page/Page.h:
3877         * page/Settings.cpp:
3878         * page/Settings.h:
3879         * page/SettingsBase.h: Copied from Source/WebCore/page/Settings.h.
3880         * page/cocoa/SettingsBaseCocoa.mm: Copied from Source/WebCore/page/cocoa/SettingsCocoa.mm.
3881         * page/cocoa/SettingsCocoa.mm: Removed.
3882
3883 2017-10-15  Yusuke Suzuki  <utatane.tea@gmail.com>
3884
3885         [JSC] Perform module specifier validation at parsing time
3886         https://bugs.webkit.org/show_bug.cgi?id=178256
3887
3888         Reviewed by Darin Adler.
3889
3890         No behavior change in the current implementation.
3891
3892         * bindings/js/JSDOMWindowBase.cpp:
3893         (WebCore::JSDOMWindowBase::moduleLoaderResolve):
3894         * bindings/js/JSDOMWindowBase.h:
3895         * bindings/js/ScriptModuleLoader.cpp:
3896         (WebCore::ScriptModuleLoader::resolve):
3897         * bindings/js/ScriptModuleLoader.h:
3898
3899 2017-10-15  Chris Dumez  <cdumez@apple.com>
3900
3901         DOMTokenList shouldn't add empty attributes
3902         https://bugs.webkit.org/show_bug.cgi?id=178280
3903         <rdar://problem/34987431>
3904
3905         Reviewed by Ryosuke Niwa.
3906
3907         Follow-up to r223306, reverse the check conditions to avoid attribute
3908         lookup when possible. Also use m_tokens instead of tokens() to avoid
3909         unnecessary branch.
3910
3911         * html/DOMTokenList.cpp:
3912         (WebCore::DOMTokenList::updateAssociatedAttributeFromTokens):
3913
3914 2017-10-15  Darin Adler  <darin@apple.com>
3915
3916         UTF-8 decoding produces one replacement character per byte; Encoding standard requires one replacement character per illegal sequence instead
3917         https://bugs.webkit.org/show_bug.cgi?id=178207
3918
3919         Reviewed by Sam Weinig.
3920
3921         * platform/text/TextCodecUTF8.cpp:
3922         (WebCore::TextCodecUTF8::create): Deleted. Use a lambda instead.
3923         (WebCore::TextCodecUTF8::registerCodecs): Use a lambda.
3924         (WebCore::nonASCIISequenceLength): Changed to return 0 instead of 2 for the range 80-C1 since
3925         none of those are valid sequence leading characters.
3926         (WebCore::decodeNonASCIISequence): Changed the length argument to be in/out so the caller
3927         knows how much of the sequence we decoded for failure cases. Simplified the length 2 section.
3928         (WebCore::TextCodecUTF8::handleError): Deleted.
3929         (WebCore::TextCodecUTF8::handlePartialSequence): Changed this into a pair of plain functions
3930         rather than two template function specializations since the two functions are rather different.
3931         For the one-byte version, got rid of the unused arguments. For the two-byte version, got rid
3932         of the ignored return value, stopped using the handleError function since each error case
3933         needs to be handled differently. In each error case consume the entire incorrect sequence
3934         instead of just one byte.
3935         (WebCore::TextCodecUTF8::decode): Updated for the above change, and changed the non-partial
3936         incorrect sequence to consume the entire incorrect sequence instead of just one byte. Also
3937         use WTF prefixes explicitly so we don't  have to do "using namespace".
3938         (WebCore::TextCodecUTF8::encode): Got rid of unneeded type punning, and added some inline
3939         capacity to save one memory allocation when encoding shorter strings.
3940
3941         * platform/text/TextCodecUTF8.h: Use pragma once. Intialize m_partialSequenceSize where it
3942         is defined and let the compiler generate the constructor. Updated for the changes above.
3943
3944         * platform/text/TextEncoding.h: Export a constructor now used by a unit test.
3945         * platform/text/TextEncodingRegistry.h: Export newTextCodec, now used by a unit test.
3946
3947 2017-10-14  Antoine Quint  <graouts@apple.com>
3948
3949         Remove all Web Animations code
3950         https://bugs.webkit.org/show_bug.cgi?id=178273
3951
3952         Reviewed by Sam Weinig.
3953