Composited negative z-index elements are hidden behind the body sometimes
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2016-11-26  Simon Fraser  <simon.fraser@apple.com>
2
3         Composited negative z-index elements are hidden behind the body sometimes
4         https://bugs.webkit.org/show_bug.cgi?id=165080
5         rdar://problem/22260229
6
7         Reviewed by Zalan Bujtas.
8
9         If the <body> falls into the "directly composited background color" code path
10         (say, because it's composited because of composited negative z-index children,
11         and has content of its own), then we failed to take root background propagation
12         into account, and put the opaque root background color on the body's layer.
13
14         Fix by sharing some code from RenderBox related to whether the body's renderer
15         paints its background.
16         
17         Tests cover the buggy case, and the case where the <html> has its own background color.
18
19         Tests: compositing/backgrounds/negative-z-index-behind-body-non-propagated.html
20                compositing/backgrounds/negative-z-index-behind-body.html
21
22         * rendering/RenderBox.cpp:
23         (WebCore::RenderBox::paintsOwnBackground):
24         (WebCore::RenderBox::paintBackground):
25         (WebCore::RenderBox::backgroundIsKnownToBeOpaqueInRect):
26         (WebCore::skipBodyBackground): Deleted.
27         * rendering/RenderBox.h:
28         * rendering/RenderLayerBacking.cpp:
29         (WebCore::RenderLayerBacking::updateDirectlyCompositedBackgroundColor):
30
31 2016-11-25  Myles C. Maxfield  <mmaxfield@apple.com>
32
33         [CSS Font Loading] FontFace.load() promises don't always fire
34         https://bugs.webkit.org/show_bug.cgi?id=165037
35
36         Reviewed by Simon Fraser.
37
38         We currently handle web fonts in two phases. The first phase is building up
39         StyleRuleFontFace objects which reflect the style on the page. The second is creating
40         CSSFontFace objects from those StyleRuleFontFace objects. When script modifies the
41         style on the page, we can often update the CSSFontFace objects, but there are some
42         modifications which we don't know how to model. For these operations, we destroy the
43         CSSFontFace objects and rebuild them from the newly modified StyleRuleFontFace objects.
44
45         Normally, this is fine. However, with the CSS font loading API, the CSSFontFaces back
46         Javascript objects which will persist across the rebuilding step mentioned above. This
47         means that the FontFace objects need to adopt the new CSSFontFace objects and forget
48         the old CSSFontFace objects.
49
50         This gets a little tricky because the operation which caused the rebuild may actually
51         be a modification to the specific @font-face block which backs a Javascript FontFace
52         object. Because the CSSOM can be used to change the src: attribute of the FontFace
53         object, I decided in r201971 to clear the FontFace's promise in case an old load would
54         cause the promise to resolve. However, this would never happen because the old
55         CSSFontFace is unparented during the FontFace::adopt()ion of the new CSSFontFace.
56         Therefore, old loads may still complete, but the signal would never make it to the
57         FontFace and therefore would not cause the promise to resolve. In addition, clearing
58         the promise during a rebuild is problematic because that rebuild may be caused by
59         operations which have nothing to do with the specific FontFace object in question (so
60         the FontFace object should be observably uneffected.)
61
62         Because of the above reasons, this patch simply stops clearing the promise during the
63         rebuild phase.
64
65         Tests: fast/text/fontface-rebuild-during-loading.html
66                fast/text/fontface-rebuild-during-loading-2.html
67
68         * css/FontFace.cpp:
69         (WebCore::FontFace::adopt):
70
71 2016-11-25  Andreas Kling  <akling@apple.com>
72
73         MemoryPressureHandler should only trigger synchronous GC on iOS
74         <https://webkit.org/b/165043>
75         <rdar://problem/29312684>
76
77         Reviewed by Sam Weinig.
78
79         On iOS we know that there is really only one web process in play at a time,
80         so it's okay to do a synchronous GC immediately in response to high memory pressure.
81
82         On other platforms, we may have tens or hundreds of web processes, and if they
83         all start doing full GCs at the same time, it can easily bring a system to its knees
84         if it's already under pressure.
85
86         Fix this by using garbageCollectSoon() on non-iOS platforms.
87
88         * page/MemoryRelease.cpp:
89         (WebCore::releaseCriticalMemory):
90
91 2016-11-23  Sergio Villar Senin  <svillar@igalia.com>
92
93         [css-grid] Convert grid representation into a class
94         https://bugs.webkit.org/show_bug.cgi?id=165042
95
96         Reviewed by Manuel Rego Casasnovas.
97
98         So far grids are represented as Vectors of Vectors. There are a couple of issues associated
99         to that decision. First or all, the source code in RenderGrid assumes the existence of that
100         data structure, meaning that we cannot eventually change it without changing a lot of
101         code. Apart from the coupling there is another issue, RenderGrid is full of methods to
102         access and manipulate that data structure.
103
104         Instead, it'd be much better to have a Grid class encapsulating both the data structures and
105         the methods required to access/manipulate it. Note that follow-up patches will move even
106         more data and procedures into this new class from the RenderGrid code.
107
108         No new tests required as this is a refactoring.
109
110         * rendering/RenderGrid.cpp:
111         (WebCore::RenderGrid::Grid::ensureGridSize): Moved from RenderGrid.
112         (WebCore::RenderGrid::Grid::insert): Ditto.
113         (WebCore::RenderGrid::Grid::clear): Ditto.
114         (WebCore::RenderGrid::GridIterator::GridIterator):
115         (WebCore::RenderGrid::gridColumnCount): Use Grid's methods.
116         (WebCore::RenderGrid::gridRowCount): Ditto.
117         (WebCore::RenderGrid::placeItemsOnGrid): Use Grid's methods to insert children.
118         (WebCore::RenderGrid::populateExplicitGridAndOrderIterator): Ditto.
119         (WebCore::RenderGrid::placeSpecifiedMajorAxisItemsOnGrid): Ditto.
120         (WebCore::RenderGrid::placeAutoMajorAxisItemOnGrid): Ditto.
121         (WebCore::RenderGrid::numTracks): Use Grid's methods.
122         (WebCore::RenderGrid::ensureGridSize): Deleted. Moved to Grid class.
123         (WebCore::RenderGrid::insertItemIntoGrid): Deleted. Moved to Grid class.
124         * rendering/RenderGrid.h:
125
126 2016-11-24  Antti Koivisto  <antti@apple.com>
127
128         Remove unused bool return from Element::willRecalcStyle
129         https://bugs.webkit.org/show_bug.cgi?id=165059
130
131         Reviewed by Andreas Kling.
132
133         It is always true.
134
135         * dom/Element.cpp:
136         (WebCore::Element::willRecalcStyle):
137         * dom/Element.h:
138         * html/HTMLFrameSetElement.cpp:
139         (WebCore::HTMLFrameSetElement::willRecalcStyle):
140         * html/HTMLFrameSetElement.h:
141         * html/HTMLPlugInImageElement.cpp:
142         (WebCore::HTMLPlugInImageElement::willRecalcStyle):
143         * html/HTMLPlugInImageElement.h:
144         * style/StyleTreeResolver.cpp:
145         (WebCore::Style::TreeResolver::resolveComposedTree):
146         * svg/SVGElement.cpp:
147         (WebCore::SVGElement::willRecalcStyle):
148         * svg/SVGElement.h:
149         * svg/SVGUseElement.cpp:
150         (WebCore::SVGUseElement::willRecalcStyle):
151         * svg/SVGUseElement.h:
152
153 2016-11-22  Antti Koivisto  <antti@apple.com>
154
155         CrashTracer: [USER] com.apple.WebKit.WebContent at com.apple.WebCore: WebCore::ExtensionStyleSheets::pageUserSheet + 14
156         https://bugs.webkit.org/show_bug.cgi?id=165030
157
158         Reviewed by Darin Adler.
159
160         We failed to reset the style scope when an element was moved to a different document. This could lead to having dangling
161         document pointers in style scope and style resolver.
162
163         Test: fast/shadow-dom/shadow-host-move-to-different-document.html
164
165         * dom/ShadowRoot.cpp:
166         (WebCore::ShadowRoot::didMoveToNewDocument):
167
168             Reset style scope.
169
170         * dom/ShadowRoot.h:
171         * style/StyleScope.cpp:
172         (WebCore::Style::Scope::resolver):
173
174             Some more assertions.
175
176         * style/StyleScope.h:
177         (WebCore::Style::Scope::document):
178
179 2016-11-22  Darin Adler  <darin@apple.com>
180
181         Make normal case fast in the input element limitString function
182         https://bugs.webkit.org/show_bug.cgi?id=165023
183
184         Reviewed by Dan Bernstein.
185
186         When running Speedometer, the limitLength function was showing up as hot.
187         Fixed a couple obvious problems with that function's performance.
188
189         * html/TextFieldInputType.cpp:
190         (WebCore::isASCIILineBreak): Deleted. The isHTMLLineBreak function does
191         the same thing, but faster.
192         (WebCore::limitLength): Added a FIXME comment explaining that the function
193         isn't really a good idea. Don't call through to numCharactersInGraphemeClusters
194         at all for 8-bit strings since we don't allow CR or LF characters in the string
195         anyway, so there are no grapheme clusters more than a single code unit. Removed
196         optimization when the length is the string's length that String::left already does.
197         (WebCore::TextFieldInputType::sanitizeValue): Use isHTMLLineBreak instead of
198         isASCIILineBreak.
199         (WebCore::TextFieldInputType::handleBeforeTextInsertedEvent): Ditto.
200
201         * platform/LocalizedStrings.cpp: Use auto a lot more rather than writing out
202         RetainPtr.
203         (WebCore::truncatedStringForLookupMenuItem): Removed unneeded special case for
204         empty strings. Removed unneeded string with the ellipsis character in it, since
205         the makeString function already knows how to append a character to a string.
206
207         * rendering/RenderText.cpp:
208         (WebCore::mapLineBreakToIteratorMode): Updated for change to LineBreakIteratorMode.
209         * rendering/SimpleLineLayoutTextFragmentIterator.cpp:
210         (WebCore::SimpleLineLayout::TextFragmentIterator::nextBreakablePosition): Ditto.
211
212 2016-11-21  Sergio Villar Senin  <svillar@igalia.com>
213
214         [css-grid] Isolate size of internal representation from actual grid size
215         https://bugs.webkit.org/show_bug.cgi?id=165006
216
217         Reviewed by Manuel Rego Casasnovas.
218
219         RenderGrid has an internal representation of a grid used to place grid items, compute grid
220         positions, run the track sizing algorithm etc. That data structure normally has exactly the
221         same size as the actual grid specified using the grid-template-xxx properties (or any other
222         shorthand). But in some cases, like for example when the grid is empty, the internal data
223         structure does not really match the actual grid. In the particular case of empty grids no
224         memory allocations are done to create a grid representation as it is not needed.
225
226         From now on both gridColumnCount() and gridRowCount() will always return the size of the
227         data structure representing the grid whereas the newly added numTracks() will always return
228         the actual size of the grid.
229
230         This is the first required step of the process of isolating the data used by the grid track
231         sizing algorithm from the actual internal state of the LayoutGrid object.
232
233         No new tests as this is just a code refactoring.
234
235         * rendering/RenderGrid.cpp:
236         (WebCore::RenderGrid::gridColumnCount): Always return the number of columns of the internal
237         data structure to represent the grid.
238         (WebCore::RenderGrid::layoutBlock):
239         (WebCore::RenderGrid::computeIntrinsicLogicalWidths): Use the actual size of the grid to
240         create the GridSizingData structure.
241         (WebCore::RenderGrid::placeItemsOnGrid): Use the actual size of the grid to create the
242         GridSizingData structure.
243         (WebCore::RenderGrid::offsetAndBreadthForPositionedChild):
244         (WebCore::RenderGrid::numTracks): New method which returns the actual size of the grid.
245         * rendering/RenderGrid.h:
246
247 2016-11-21  Konstantin Tokarev  <annulen@yandex.ru>
248
249         Disable #line markers in bison output on Windows
250         https://bugs.webkit.org/show_bug.cgi?id=164973
251
252         Reviewed by Darin Adler.
253
254         New bison versions since 3.0 have bug that causes unescaped paths
255         to be printed in #line directives. On Windows CMake passes absolute
256         paths to bison that have backslashes in them, leading to compiler
257         errors or warnings because of unrecognized escape sequences.
258
259         No new tests needed.
260
261         * css/makegrammar.pl:
262
263 2016-11-21  Olivier Blin  <olivier.blin@softathome.com>
264
265         [cmake][OpenWebRTC] Move SDPProcessorScriptResource rules to common WebCore
266         https://bugs.webkit.org/show_bug.cgi?id=164937
267
268         Reviewed by Youenn Fablet.
269
270         SDPProcessorScriptResource has been moved in common mediastream directory (bug 163940).
271
272         Since it is not specific to the GTK port, the matching cmake rules should be
273         moved out from PlatformGTK.cmake to the main WebCore CMakeLists.txt.
274
275         This is needed to build OpenWebRTC support in other ports, WPE in my case,
276         probably Mac, EFL and Qt as well.
277
278         This also fixes the path in SDP scripts dependencies, the old openwebrtc subdir
279         was still being used.
280
281         No new tests, build fix only
282
283         * CMakeLists.txt:
284         * PlatformGTK.cmake:
285
286 2016-11-21  Carlos Garcia Campos  <cgarcia@igalia.com>
287
288         Add URL::hostAndPort()
289         https://bugs.webkit.org/show_bug.cgi?id=164907
290
291         Reviewed by Alex Christensen.
292
293         As a convenient way of getting the host and port (if any) as a string.
294
295         * html/URLUtils.h:
296         (WebCore::URLUtils<T>::host): Use URL::hostAndPort().
297         * page/Location.cpp:
298         (WebCore::Location::host): Ditto.
299         * platform/URL.cpp:
300         (WebCore::URL::hostAndPort): Return host:port or just host if there isn't a port.
301         * platform/URL.h:
302         * platform/network/CredentialStorage.cpp:
303         (WebCore::originStringFromURL): Use URL::hostAndPort().
304         * workers/WorkerLocation.cpp:
305         (WebCore::WorkerLocation::host): Ditto.
306
307 2016-11-21  Philippe Normand  <pnormand@igalia.com>
308
309         [WebRTC][OpenWebRTC] parse turns urls
310         https://bugs.webkit.org/show_bug.cgi?id=164587
311
312         Reviewed by Alejandro G. Castro.
313
314         * platform/mediastream/openwebrtc/MediaEndpointOwr.cpp:
315         (WebCore::MediaEndpointOwr::ensureTransportAgentAndTransceivers):
316         Hook turns servers between the RTCConfiguration and the underlying
317         OpenWebRTC layer.
318
319 2016-11-21  Philippe Normand  <pnormand@igalia.com>
320
321         [Gstreamer] Add volume and mute support to the WebRTC mediaplayer
322         https://bugs.webkit.org/show_bug.cgi?id=153828
323
324         Reviewed by Darin Adler.
325
326         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerOwr.cpp:
327         (WebCore::MediaPlayerPrivateGStreamerOwr::setVolume): New implementation setting the OWR source volume property.
328         (WebCore::MediaPlayerPrivateGStreamerOwr::setMuted): New implementation setting the OWR source mute property.
329         (WebCore::MediaPlayerPrivateGStreamerOwr::maybeHandleChangeMutedState): Also set audio OWR source mute state depending on the track enabled state.
330         (WebCore::MediaPlayerPrivateGStreamerOwr::trackEnabledChanged): chain to maybeHandleChangeMuteState.
331         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerOwr.h:
332
333 2016-11-21  Alejandro G. Castro  <alex@igalia.com> and Philippe Normand  <pnormand@igalia.com>
334
335         [WebRTC][OpenWebRTC] RTP bundling support
336         https://bugs.webkit.org/show_bug.cgi?id=162333
337
338         Reviewed by Alejandro G. Castro.
339
340         Configure the OpenWebRTC transport agent bundle policy according
341         to the RTCConfiguration and pass the receive SSRCs over to
342         OpenWebRTC as well. Those are needed so the agent is aware of the
343         bundle layout.
344
345         * platform/mediastream/openwebrtc/MediaEndpointOwr.cpp:
346         (WebCore::MediaEndpointOwr::updateReceiveConfiguration):
347         (WebCore::MediaEndpointOwr::updateSendConfiguration):
348         (WebCore::MediaEndpointOwr::ensureTransportAgentAndTransceivers):
349
350 2016-11-20  Zan Dobersek  <zdobersek@igalia.com>
351
352         [EncryptedMedia] Make EME API runtime-enabled
353         https://bugs.webkit.org/show_bug.cgi?id=164927
354
355         Reviewed by Jer Noble.
356
357         Update the EME API IDL definitions to use the EnabledAtRuntime
358         attribute on the relevant interfaces, attributes and operations.
359         EncryptedMediaAPI is used as the attribute value.
360
361         The corresponding getter, setter and member boolean are added to
362         the RuntimeEnabledFeatures class.
363
364         * Modules/encryptedmedia/MediaKeyMessageEvent.idl:
365         * Modules/encryptedmedia/MediaKeySession.idl:
366         * Modules/encryptedmedia/MediaKeyStatusMap.idl:
367         * Modules/encryptedmedia/MediaKeySystemAccess.idl:
368         * Modules/encryptedmedia/MediaKeys.idl:
369         * Modules/encryptedmedia/NavigatorEME.idl:
370         * bindings/generic/RuntimeEnabledFeatures.h:
371         (WebCore::RuntimeEnabledFeatures::setEncryptedMediaAPIEnabled):
372         (WebCore::RuntimeEnabledFeatures::encryptedMediaAPIEnabled):
373         * html/HTMLMediaElement.idl:
374         * html/MediaEncryptedEvent.idl:
375
376 2016-11-20  Eric Carlson  <eric.carlson@apple.com>
377
378         REGRESSION (r208606?): LayoutTest fast/mediastream/enumerating-crash.html is a flaky crash
379         https://bugs.webkit.org/show_bug.cgi?id=164715
380         <rdar://problem/29277180>
381
382         Reviewed by Alexey Proskuryakov.
383
384         No new tests, fixes an existing test crash.
385
386         * Modules/mediastream/UserMediaRequest.cpp:
387         (WebCore::UserMediaRequest::contextDestroyed): Call base class method before clearing m_controller
388           because it nullifies the security context.
389
390 2016-11-19  Chris Dumez  <cdumez@apple.com>
391
392         Update HTML form validation messages
393         https://bugs.webkit.org/show_bug.cgi?id=164957
394         <rdar://problem/29338669>
395
396         Reviewed by Darin Adler.
397
398         Update HTML form validation messages as per recent feedback:
399         - Drop the "Please".
400         - Drop the period at the end.
401         - Drop the "if you want to proceed" that was used only for the checkbox.
402
403         No new tests, rebaselined existing tests.
404
405         * English.lproj/Localizable.strings:
406         * platform/LocalizedStrings.cpp:
407         (WebCore::validationMessageValueMissingText):
408         (WebCore::validationMessageValueMissingForCheckboxText):
409         (WebCore::validationMessageValueMissingForFileText):
410         (WebCore::validationMessageValueMissingForRadioText):
411         (WebCore::validationMessageValueMissingForSelectText):
412         (WebCore::validationMessageTypeMismatchText):
413         (WebCore::validationMessageTypeMismatchForEmailText):
414         (WebCore::validationMessageTypeMismatchForURLText):
415         (WebCore::validationMessagePatternMismatchText):
416         (WebCore::validationMessageTooShortText):
417         (WebCore::validationMessageTooLongText):
418         (WebCore::validationMessageRangeUnderflowText):
419         (WebCore::validationMessageRangeOverflowText):
420         (WebCore::validationMessageStepMismatchText):
421         (WebCore::validationMessageBadInputForNumberText):
422
423 2016-11-19  Joanmarie Diggs  <jdiggs@igalia.com>
424
425         AX: [ATK] Implement selection interface and states for elements supporting aria-selected and for menu roles
426         https://bugs.webkit.org/show_bug.cgi?id=164865
427
428         Reviewed by Chris Fleizach.
429
430         Implement AtkSelection and support ATK_STATE_SELECTABLE and ATK_STATE_SELECTED
431         for elements supporting aria-selected and for menu-related roles. Also enable the
432         equivalent support for the Mac because NSAccessibilitySelectedChildrenAttribute is
433         included as supported on the same roles.
434
435         In addition, fix several bugs discovered along the way: Call isSelected() on role
436         tab, because tab supports aria-selected; not aria-checked. Correct ATK mapping
437         of ListBoxRole and ListBoxOptionRole for combobox descendants. Always defer to
438         WebCore for inclusion/exclusion decisions related to elements with an explicit
439         ARIA role.
440
441         Tests: accessibility/aria-combobox-hierarchy.html
442                accessibility/aria-selected-menu-items.html
443                accessibility/aria-selected.html
444
445         * accessibility/AccessibilityNodeObject.cpp:
446         (WebCore::AccessibilityNodeObject::selectedTabItem):
447         (WebCore::AccessibilityNodeObject::canSetSelectedAttribute):
448         * accessibility/AccessibilityObject.cpp:
449         (WebCore::AccessibilityObject::isDescendantOfRole):
450         * accessibility/AccessibilityObject.h:
451         (WebCore::AccessibilityObject::canHaveSelectedChildren):
452         * accessibility/AccessibilityRenderObject.cpp:
453         (WebCore::AccessibilityRenderObject::isSelected):
454         (WebCore::AccessibilityRenderObject::canHaveSelectedChildren):
455         (WebCore::AccessibilityRenderObject::selectedChildren):
456         * accessibility/AccessibilityRenderObject.h:
457         * accessibility/atk/AccessibilityObjectAtk.cpp:
458         (WebCore::AccessibilityObject::accessibilityPlatformIncludesObject):
459         * accessibility/atk/WebKitAccessibleInterfaceSelection.cpp:
460         (webkitAccessibleSelectionGetSelectionCount):
461         * accessibility/atk/WebKitAccessibleWrapperAtk.cpp:
462         (atkRole):
463         (getInterfaceMaskFromObject):
464         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
465         (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
466
467 2016-11-19  Simon Fraser  <simon.fraser@apple.com>
468
469         [iOS WK2] When zoomed in and panning on pages with fixed bars, parts of the bars are sometimes missing
470         https://bugs.webkit.org/show_bug.cgi?id=164855
471
472         Reviewed by Sam Weinig.
473
474         During UI-process panning and zooming, we send visible rect updates to the web process
475         with inStableState=false, and don't update GraphicsLayers until we get into a stable state.
476
477         This causes a problem where the web process has a stale notion of where the GraphicsLayers
478         for position:fixed elements are, but is then told to update tiling coverage with an up-to-date
479         visible rect. The existing "sync layer positions" path isn't useful to fix this, because it
480         breaks the relationship between the GraphicsLayer positions and their FixedPositionViewportConstraints
481         in the scrolling tree.
482
483         To address this, add the notion of an Optional<> approximatePosition on GraphicsLayers. This is used
484         only by the coverageRect computation code path, and is cleared by a setPosition(). ApproximatePositions
485         are pushed onto GraphicsLayers via the syncViewportConstrainedLayerPositions() code path (renamed to
486         reconcileViewportConstrainedLayerPositions).
487
488         This allows us to remmove "viewportIsStable" from GraphicsLayer flushing, and FrameView.
489
490         SetOrSyncScrollingLayerPosition is made into an enum class.
491
492         Tested by scrollingcoordinator/ios/non-stable-viewport-scroll.html
493
494         * page/FrameView.cpp:
495         (WebCore::FrameView::reset):
496         * page/FrameView.h:
497         * page/scrolling/AsyncScrollingCoordinator.cpp:
498         (WebCore::AsyncScrollingCoordinator::requestScrollPositionUpdate):
499         (WebCore::AsyncScrollingCoordinator::scheduleUpdateScrollPositionAfterAsyncScroll):
500         (WebCore::AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScroll):
501         (WebCore::AsyncScrollingCoordinator::reconcileScrollingState):
502         (WebCore::AsyncScrollingCoordinator::reconcileViewportConstrainedLayerPositions):
503         (WebCore::AsyncScrollingCoordinator::syncViewportConstrainedLayerPositions): Deleted.
504         * page/scrolling/AsyncScrollingCoordinator.h:
505         (WebCore::AsyncScrollingCoordinator::ScheduledScrollUpdate::ScheduledScrollUpdate):
506         * page/scrolling/ScrollingCoordinator.cpp:
507         (WebCore::operator<<):
508         * page/scrolling/ScrollingCoordinator.h:
509         (WebCore::ScrollingCoordinator::reconcileScrollingState):
510         (WebCore::ScrollingCoordinator::reconcileViewportConstrainedLayerPositions):
511         (WebCore::ScrollingCoordinator::syncViewportConstrainedLayerPositions): Deleted.
512         * page/scrolling/ScrollingStateFixedNode.cpp:
513         (WebCore::ScrollingStateFixedNode::reconcileLayerPositionForViewportRect):
514         (WebCore::ScrollingStateFixedNode::syncLayerPositionForViewportRect): Deleted.
515         * page/scrolling/ScrollingStateFixedNode.h:
516         * page/scrolling/ScrollingStateNode.h:
517         (WebCore::ScrollingStateNode::reconcileLayerPositionForViewportRect):
518         (WebCore::ScrollingStateNode::syncLayerPositionForViewportRect): Deleted.
519         * page/scrolling/ScrollingStateStickyNode.cpp:
520         (WebCore::ScrollingStateStickyNode::reconcileLayerPositionForViewportRect):
521         (WebCore::ScrollingStateStickyNode::syncLayerPositionForViewportRect): Deleted.
522         * page/scrolling/ScrollingStateStickyNode.h:
523         * page/scrolling/ScrollingTree.cpp:
524         (WebCore::ScrollingTree::scrollPositionChangedViaDelegatedScrolling):
525         * page/scrolling/ScrollingTree.h:
526         * page/scrolling/ThreadedScrollingTree.cpp:
527         (WebCore::ThreadedScrollingTree::scrollingTreeNodeDidScroll):
528         * page/scrolling/ThreadedScrollingTree.h:
529         * page/scrolling/ios/ScrollingTreeFrameScrollingNodeIOS.mm:
530         (WebCore::ScrollingTreeFrameScrollingNodeIOS::setScrollPositionWithoutContentEdgeConstraints):
531         * page/scrolling/ios/ScrollingTreeIOS.cpp:
532         (WebCore::ScrollingTreeIOS::scrollingTreeNodeDidScroll):
533         * page/scrolling/ios/ScrollingTreeIOS.h:
534         * page/scrolling/mac/ScrollingTreeFixedNode.mm:
535         (WebCore::ScrollingTreeFixedNode::updateLayersAfterAncestorChange):
536         * platform/graphics/GraphicsLayer.cpp:
537         (WebCore::GraphicsLayer::dumpProperties):
538         * platform/graphics/GraphicsLayer.h:
539         (WebCore::GraphicsLayer::setPosition):
540         (WebCore::GraphicsLayer::approximatePosition):
541         (WebCore::GraphicsLayer::setApproximatePosition):
542         (WebCore::GraphicsLayer::flushCompositingState):
543         (WebCore::GraphicsLayer::flushCompositingStateForThisLayerOnly):
544         * platform/graphics/ca/GraphicsLayerCA.cpp:
545         (WebCore::GraphicsLayerCA::flushCompositingState):
546         (WebCore::GraphicsLayerCA::flushCompositingStateForThisLayerOnly):
547         (WebCore::GraphicsLayerCA::computeVisibleAndCoverageRect):
548         (WebCore::GraphicsLayerCA::setVisibleAndCoverageRects): No longer bail for viewportConstained layers when the viewport is unstable.
549         (WebCore::GraphicsLayerCA::recursiveCommitChanges):
550         * platform/graphics/ca/GraphicsLayerCA.h:
551         (WebCore::GraphicsLayerCA::CommitState::CommitState): Deleted.
552         * platform/graphics/texmap/GraphicsLayerTextureMapper.cpp:
553         (WebCore::GraphicsLayerTextureMapper::flushCompositingState):
554         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
555         (WebCore::CoordinatedGraphicsLayer::flushCompositingState):
556         * rendering/RenderLayerCompositor.cpp:
557         (WebCore::RenderLayerCompositor::flushPendingLayerChanges):
558
559 2016-11-19  Joanmarie Diggs  <jdiggs@igalia.com>
560
561         AX: [ATK] Expose aria-busy via ATK_STATE_BUSY
562         https://bugs.webkit.org/show_bug.cgi?id=164909
563
564         Reviewed by Chris Fleizach.
565
566         Expose aria-busy via ATK_STATE_BUSY. Also rename ariaLiveRegionBusy()
567         to isBusy() because in ARIA 1.1 aria-busy is no longer limited to live
568         regions.
569
570         Test: accessibility/aria-busy.html
571
572         * accessibility/AccessibilityObject.h:
573         (WebCore::AccessibilityObject::isBusy):
574         (WebCore::AccessibilityObject::ariaLiveRegionBusy): Deleted.
575         * accessibility/AccessibilityRenderObject.cpp:
576         (WebCore::AccessibilityRenderObject::isBusy):
577         (WebCore::AccessibilityRenderObject::ariaLiveRegionBusy): Deleted.
578         * accessibility/AccessibilityRenderObject.h:
579         * accessibility/atk/WebKitAccessibleWrapperAtk.cpp:
580         (setAtkStateSetFromCoreObject):
581         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
582         (-[WebAccessibilityObjectWrapper accessibilityARIAIsBusy]):
583         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
584         (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
585         * inspector/InspectorDOMAgent.cpp:
586         (WebCore::InspectorDOMAgent::buildObjectForAccessibilityProperties):
587
588 2016-11-19  Ryosuke Niwa  <rniwa@webkit.org>
589
590         REGRESSION(r200964): Tab focus navigation is broken on results.en.voyages-sncf.com
591         https://bugs.webkit.org/show_bug.cgi?id=164888
592
593         Reviewed by Antti Koivisto.
594
595         The bug was caused by FocusNavigationScope::parentInScope incorrectly returning nullptr when moving out of
596         a user agent shadow tree of a SVG use element. Fixed the bug by explicitly checking against the focus scope's
597         root node or its slot element. Also removed a superfluous early return when the parent node is a focus scope.
598
599         Tests: fast/shadow-dom/focus-navigation-out-of-slot.html
600                fast/shadow-dom/focus-navigation-passes-shadow-host.html
601                fast/shadow-dom/focus-navigation-passes-svg-use-element.html
602
603         * page/FocusController.cpp:
604         (WebCore::FocusNavigationScope::parentInScope):
605
606 2016-11-18  Simon Fraser  <simon.fraser@apple.com>
607
608         [iOS WK2] Eliminate a source of flakiness in layout tests by forcing WebPage into "responsive" mode for all tests, with an internals override
609         https://bugs.webkit.org/show_bug.cgi?id=164980
610
611         Reviewed by Chris Dumez.
612
613         WebPage::eventThrottlingDelay() uses a latency estimate based on the round-trip time from the UI process
614         to affect behavior, including whether scroll events are fired. This also affects the FrameView "scrolledByUser"
615         flag that impacts tile coverage.
616
617         During testing, latency falling above or below the 16ms threshold could affect behavior. Fix by forcing
618         WebPage into "responsive" mode while running tests, via InjectedBundlePage::prepare().
619
620         Add a nullable internals property so that a test can specify responsive, unresponsive or default behavior.
621
622         Tests: fast/scrolling/ios/scroll-events-default.html
623                fast/scrolling/ios/scroll-events-responsive.html
624                fast/scrolling/ios/scroll-events-unresponsive.html
625
626         * page/Page.h:
627         (WebCore::Page::eventThrottlingBehaviorOverride):
628         (WebCore::Page::setEventThrottlingBehaviorOverride):
629         * testing/Internals.cpp:
630         (WebCore::Internals::setEventThrottlingBehaviorOverride):
631         (WebCore::Internals::eventThrottlingBehaviorOverride):
632         * testing/Internals.h:
633         * testing/Internals.idl:
634
635 2016-11-18  Chris Dumez  <cdumez@apple.com>
636
637         Unreviewed attempt to fix the build after r208917.
638
639         * dom/CustomElementReactionQueue.cpp:
640         (WebCore::CustomElementReactionStack::ElementQueue::invokeAll):
641
642 2016-11-18  Chris Dumez  <cdumez@apple.com>
643
644         Unreviewed attempt to fix the build after r208917.
645
646         * dom/CustomElementReactionQueue.cpp:
647
648 2016-11-18  Jiewen Tan  <jiewen_tan@apple.com>
649
650         Update SubtleCrypto::decrypt to match the latest spec
651         https://bugs.webkit.org/show_bug.cgi?id=164739
652         <rdar://problem/29257848>
653
654         Reviewed by Brent Fulgham.
655
656         This patch does following few things:
657         1. It updates the SubtleCrypto::decrypt method to match the latest spec:
658            https://www.w3.org/TR/WebCryptoAPI/#SubtleCrypto-method-decrypt.
659            It also refers to the latest Editor's Draft to a certain degree:
660            https://w3c.github.io/webcrypto/Overview.html#SubtleCrypto-method-decrypt.
661         2. It implements decrypt operations of the following algorithms: AES-CBC,
662            RSAES-PKCS1-V1_5, and RSA-OAEP.
663
664         Tests: crypto/subtle/aes-cbc-decrypt-malformed-parameters.html
665                crypto/subtle/aes-cbc-generate-key-encrypt-decrypt.html
666                crypto/subtle/aes-cbc-import-key-decrypt.html
667                crypto/subtle/decrypt-malformed-parameters.html
668                crypto/subtle/rsa-oaep-decrypt-malformed-parameters.html
669                crypto/subtle/rsa-oaep-generate-key-encrypt-decrypt-label.html
670                crypto/subtle/rsa-oaep-generate-key-encrypt-decrypt.html
671                crypto/subtle/rsa-oaep-import-key-decrypt-label.html
672                crypto/subtle/rsa-oaep-import-key-decrypt.html
673                crypto/subtle/rsaes-pkcs1-v1_5-generate-key-encrypt-decrypt.html
674                crypto/subtle/rsaes-pkcs1-v1_5-import-key-decrypt.html
675                crypto/workers/subtle/aes-cbc-import-key-decrypt.html
676                crypto/workers/subtle/rsa-oaep-import-key-decrypt.html
677                crypto/workers/subtle/rsaes-pkcs1-v1_5-import-key-decrypt.html
678
679         * bindings/js/JSSubtleCryptoCustom.cpp:
680         (WebCore::normalizeCryptoAlgorithmParameters):
681         (WebCore::toCryptoKey):
682         (WebCore::toVector):
683         (WebCore::jsSubtleCryptoFunctionEncryptPromise):
684         (WebCore::jsSubtleCryptoFunctionDecryptPromise):
685         (WebCore::jsSubtleCryptoFunctionExportKeyPromise):
686         (WebCore::JSSubtleCrypto::decrypt):
687         * crypto/CryptoAlgorithm.cpp:
688         (WebCore::CryptoAlgorithm::decrypt):
689         * crypto/CryptoAlgorithm.h:
690         * crypto/SubtleCrypto.idl:
691         * crypto/algorithms/CryptoAlgorithmAES_CBC.cpp:
692         (WebCore::CryptoAlgorithmAES_CBC::decrypt):
693         * crypto/algorithms/CryptoAlgorithmAES_CBC.h:
694         * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp:
695         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::decrypt):
696         * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.h:
697         * crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp:
698         (WebCore::CryptoAlgorithmRSA_OAEP::decrypt):
699         * crypto/algorithms/CryptoAlgorithmRSA_OAEP.h:
700         * crypto/gnutls/CryptoAlgorithmAES_CBCGnuTLS.cpp:
701         (WebCore::CryptoAlgorithmAES_CBC::platformDecrypt):
702         * crypto/gnutls/CryptoAlgorithmRSAES_PKCS1_v1_5GnuTLS.cpp:
703         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::platformDecrypt):
704         * crypto/gnutls/CryptoAlgorithmRSA_OAEPGnuTLS.cpp:
705         (WebCore::CryptoAlgorithmRSA_OAEP::platformDecrypt):
706         * crypto/mac/CryptoAlgorithmAES_CBCMac.cpp:
707         (WebCore::CryptoAlgorithmAES_CBC::platformDecrypt):
708         * crypto/mac/CryptoAlgorithmRSAES_PKCS1_v1_5Mac.cpp:
709         (WebCore::decryptRSAES_PKCS1_v1_5):
710         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::platformDecrypt):
711         * crypto/mac/CryptoAlgorithmRSA_OAEPMac.cpp:
712         (WebCore::decryptRSA_OAEP):
713         (WebCore::CryptoAlgorithmRSA_OAEP::platformDecrypt):
714
715 2016-11-18  Chris Dumez  <cdumez@apple.com>
716
717         Unreviewed, rolling out r208837.
718
719         The bots did not show a progression
720
721         Reverted changeset:
722
723         "REGRESSION(r208082): 1% Speedometer regression on iOS"
724         https://bugs.webkit.org/show_bug.cgi?id=164852
725         http://trac.webkit.org/changeset/208837
726
727 2016-11-18  Simon Fraser  <simon.fraser@apple.com>
728
729         Remove use of std::chrono in WebPage and entrained code
730         https://bugs.webkit.org/show_bug.cgi?id=164967
731
732         Reviewed by Tim Horton.
733
734         Replace std::chrono with Seconds and Monotonic Time.
735
736         Use more C++11 initialization for WebPage data members.
737
738         * page/ChromeClient.h:
739         * page/FrameView.cpp:
740         (WebCore::FrameView::scrollPositionChanged):
741         (WebCore::FrameView::setScrollVelocity):
742         * page/FrameView.h:
743         * platform/Timer.h:
744         (WebCore::TimerBase::startRepeating):
745         (WebCore::TimerBase::startOneShot):
746         (WebCore::TimerBase::augmentFireInterval):
747         (WebCore::TimerBase::augmentRepeatInterval):
748         * platform/graphics/TiledBacking.h:
749         (WebCore::VelocityData::VelocityData):
750         * platform/graphics/ca/TileController.cpp:
751         (WebCore::TileController::adjustTileCoverageRect):
752
753 2016-11-18  Dean Jackson  <dino@apple.com>
754
755         AX: "(inverted-colors)" media query only matches on page reload; should match on change
756         https://bugs.webkit.org/show_bug.cgi?id=163564
757         <rdar://problem/28807350>
758
759         Reviewed by Simon Fraser.
760
761         Mark some media queries as responding to notifications that
762         system accessibility settings have changed. When Page gets told
763         that has happened, check if any of the results have changed.
764
765         Tests: fast/media/mq-inverted-colors-live-update.html
766                fast/media/mq-monochrome-live-update.html
767                fast/media/mq-prefers-reduced-motion-live-update.html
768
769         * css/MediaQueryEvaluator.cpp:
770         (WebCore::isAccessibilitySettingsDependent):
771         (WebCore::MediaQueryEvaluator::evaluate):
772         * css/StyleResolver.cpp:
773         (WebCore::StyleResolver::addAccessibilitySettingsDependentMediaQueryResult):
774         (WebCore::StyleResolver::hasMediaQueriesAffectedByAccessibilitySettingsChange):
775         * css/StyleResolver.h:
776         (WebCore::StyleResolver::hasAccessibilitySettingsDependentMediaQueries):
777         * page/Page.cpp:
778         (WebCore::Page::accessibilitySettingsDidChange):
779         * page/Page.h:
780
781 2016-11-18  Anders Carlsson  <andersca@apple.com>
782
783         Rename the 'other' Apple Pay Button type to 'donate'
784         https://bugs.webkit.org/show_bug.cgi?id=164978
785
786         Reviewed by Dean Jackson.
787
788         * DerivedSources.make:
789         * WebCorePrefix.h:
790         * css/CSSPrimitiveValueMappings.h:
791         (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
792         (WebCore::CSSPrimitiveValue::operator ApplePayButtonType):
793         * css/CSSValueKeywords.in:
794         * css/parser/CSSParser.cpp:
795         (WebCore::isValidKeywordPropertyAndValue):
796         * css/parser/CSSParserFastPaths.cpp:
797         (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
798         * rendering/RenderThemeCocoa.mm:
799         (WebCore::toPKPaymentButtonType):
800         * rendering/style/RenderStyleConstants.h:
801
802 2016-11-18  Myles C. Maxfield  <mmaxfield@apple.com>
803
804         [WebGL2] Implement texStorage2D()
805         https://bugs.webkit.org/show_bug.cgi?id=164493
806
807         Reviewed by Dean Jackson.
808
809         Create a new validation function which only accepts sized internalFormats.
810         After running texStorage2D(), we also texSubImage2D() to zero-fill it. This
811         is to compensate for potentially buggy drivers.
812
813         Because glTexStorage2D() was only added to OpenGL in version 4.2, not all
814         OpenGL 3.2+ contexts can implement this command. However, according to
815         https://developer.apple.com/opengl/capabilities/ all Apple GPUs have the
816         GL_ARB_texture_storage which implements this call. In the future, we could
817         implement texStorage2D() on top of texImage2D() if there are any ports which
818         want WebGL2 but don't have 4.2 and don't have the extension.
819
820         Also, when calling texStorage2D, callers specify an internalFormat but not a
821         type/format pair. This means that storing the texture's type is only valid
822         for WebGL 1 contexts. This patch surrounds all calls to reading the texture
823         type with guards and adds an ASSERT() at the read site to make sure the
824         right thing is happening.
825
826         Test: fast/canvas/webgl/webgl2-texStorage.html
827
828         * html/canvas/WebGL2RenderingContext.cpp:
829         (WebCore::WebGL2RenderingContext::validateTexStorageFuncParameters):
830         (WebCore::WebGL2RenderingContext::texStorage2D):
831         * html/canvas/WebGL2RenderingContext.h:
832         * html/canvas/WebGLRenderingContext.cpp:
833         (WebCore::WebGLRenderingContext::validateIndexArrayConservative):
834         * html/canvas/WebGLRenderingContextBase.cpp:
835         (WebCore::WebGLRenderingContextBase::create):
836         (WebCore::WebGLRenderingContextBase::copyTexSubImage2D):
837         (WebCore::WebGLRenderingContextBase::validateTexFunc):
838         (WebCore::WebGLRenderingContextBase::validateTexFuncData):
839         (WebCore::WebGLRenderingContextBase::texImage2D):
840         * html/canvas/WebGLTexture.cpp:
841         (WebCore::WebGLTexture::WebGLTexture):
842         (WebCore::WebGLTexture::getType):
843         (WebCore::WebGLTexture::needToUseBlackTexture):
844         (WebCore::WebGLTexture::canGenerateMipmaps):
845         (WebCore::internalFormatIsFloatType):
846         (WebCore::internalFormatIsHalfFloatType):
847         (WebCore::WebGLTexture::update):
848         * html/canvas/WebGLTexture.h:
849         * platform/graphics/GraphicsContext3D.cpp:
850         (WebCore::GraphicsContext3D::texImage2DResourceSafe):
851         (WebCore::GraphicsContext3D::packImageData):
852         (WebCore::GraphicsContext3D::extractImageData):
853         * platform/graphics/GraphicsContext3D.h:
854         * platform/graphics/opengl/Extensions3DOpenGLCommon.cpp:
855         (WebCore::Extensions3DOpenGLCommon::initializeAvailableExtensions):
856         * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
857         (WebCore::GraphicsContext3D::texStorage2D):
858         (WebCore::GraphicsContext3D::texStorage3D):
859
860 2016-11-18  Alex Christensen  <achristensen@webkit.org>
861
862         TextDecoder constructor should not accept replacement encodings
863         https://bugs.webkit.org/show_bug.cgi?id=164903
864
865         Reviewed by Chris Dumez.
866
867         Covered by newly passing web platform tests.
868
869         * dom/TextDecoder.cpp:
870         (WebCore::TextDecoder::create):
871         https://encoding.spec.whatwg.org/#textdecoder says about the constructor:
872         "If label is either not a label or is a label for replacement, throws a RangeError."
873         See https://bugs.webkit.org/show_bug.cgi?id=159180 for the mapping of the replacement
874         codec names to "replacement".
875
876 2016-11-18  Chris Dumez  <cdumez@apple.com>
877
878         Assertion failures in ActiveDOMObject::~ActiveDOMObject under Database destructor
879         https://bugs.webkit.org/show_bug.cgi?id=164955
880         <rdar://problem/29336715>
881
882         Reviewed by Brady Eidson.
883
884         Make sure the Database's DatabaseContext object is destroyed on the context
885         thread given that DatabaseContext is an ActiveDOMObject and there is an
886         assertion in the ActiveDOMObject destructor that it should be destroyed on
887         on the context thread.
888
889         No new tests, already covered by existing tests.
890
891         * Modules/webdatabase/Database.cpp:
892         (WebCore::Database::~Database):
893
894 2016-11-18  Enrica Casucci  <enrica@apple.com>
895
896         Refactor drag and drop for WebKit2 to encode DragData message exchange.
897         https://bugs.webkit.org/show_bug.cgi?id=164945
898
899         Reviewed by Tim Horton.
900
901         No new tests. No change in functionality.
902
903         * loader/EmptyClients.h:
904         * page/DragClient.h:
905         * page/DragController.cpp:
906         (WebCore::createMouseEvent):
907         (WebCore::documentFragmentFromDragData):
908         (WebCore::DragController::dragIsMove):
909         (WebCore::DragController::dragEntered):
910         (WebCore::DragController::dragExited):
911         (WebCore::DragController::dragUpdated):
912         (WebCore::DragController::performDragOperation):
913         (WebCore::DragController::dragEnteredOrUpdated):
914         (WebCore::DragController::tryDocumentDrag):
915         (WebCore::DragController::operationForLoad):
916         (WebCore::DragController::dispatchTextInputEventFor):
917         (WebCore::DragController::concludeEditDrag):
918         (WebCore::DragController::canProcessDrag):
919         (WebCore::DragController::tryDHTMLDrag):
920         * page/DragController.h:
921         * page/efl/DragControllerEfl.cpp:
922         (WebCore::DragController::isCopyKeyDown):
923         (WebCore::DragController::dragOperation):
924         * page/gtk/DragControllerGtk.cpp:
925         (WebCore::DragController::isCopyKeyDown):
926         (WebCore::DragController::dragOperation):
927         * page/mac/DragControllerMac.mm:
928         (WebCore::DragController::isCopyKeyDown):
929         (WebCore::DragController::dragOperation):
930         * page/win/DragControllerWin.cpp:
931         (WebCore::DragController::dragOperation):
932         (WebCore::DragController::isCopyKeyDown):
933         * platform/DragData.h:
934         (WebCore::DragData::DragData):
935
936 2016-11-18  Jeremy Jones  <jeremyj@apple.com>
937
938         Add runtime flag to enable pointer lock. Enable pointer lock feature for mac.
939         https://bugs.webkit.org/show_bug.cgi?id=163801
940
941         Reviewed by Simon Fraser.
942
943         These tests now pass with DumpRenderTree.
944         LayoutTests/pointer-lock/lock-already-locked.html
945         LayoutTests/pointer-lock/lock-element-not-in-dom.html
946         LayoutTests/pointer-lock/locked-element-iframe-removed-from-dom.html
947         LayoutTests/pointer-lock/mouse-event-api.html
948
949         PointerLockController::requestPointerLock now protects against synchronous callback
950         to allowPointerLock().
951
952         Add pointerLockEnabled setting.
953
954         * Configurations/FeatureDefines.xcconfig:
955         * dom/Document.cpp:
956         (WebCore::Document::exitPointerLock): Fix existing typo.
957         (WebCore::Document::pointerLockElement):
958         * features.json:
959         * page/EventHandler.cpp:
960         * page/PointerLockController.cpp:
961         (WebCore::PointerLockController::requestPointerLock):
962         (WebCore::PointerLockController::requestPointerUnlock):
963         * page/Settings.in:
964
965 2016-11-17  Alex Christensen  <achristensen@webkit.org>
966
967         Support IDN2008 with UTS #46 instead of IDN2003
968         https://bugs.webkit.org/show_bug.cgi?id=144194
969
970         Reviewed by Darin Adler.
971
972         Use uidna_nameToASCII instead of the deprecated uidna_IDNToASCII.
973         It uses IDN2008 instead of IDN2003, and it uses UTF #46 when used with a UIDNA opened with uidna_openUTS46.
974         This follows https://url.spec.whatwg.org/#concept-domain-to-ascii except we do not use Transitional_Processing
975         to prevent homograph attacks on german domain names with "ß" and "ss" in them.  These are now treated as separate domains.
976         Firefox also doesn't use Transitional_Processing. Chrome and the current specification use Transitional_processing,
977         but https://github.com/whatwg/url/issues/110 might change the spec.
978         
979         In addition, http://unicode.org/reports/tr46/ says:
980         "implementations are encouraged to apply the Bidi and ContextJ validity criteria"
981         Bidi checks prevent domain names with bidirectional text, such as latin and hebrew characters in the same domain.  Chrome and Firefox do this.
982
983         ContextJ checks prevent code points such as U+200D, which is a zero-width joiner which users would not see when looking at the domain name.
984         Firefox currently enables ContextJ checks and it is suggested by UTS #46, so we'll do it.
985
986         ContextO checks, which we do not use and neither does any other browser nor the spec, would fail if a domain contains code points such as U+30FB,
987         which looks somewhat like a dot.  We can investigate enabling these checks later.
988
989         Covered by new API tests and rebased LayoutTests.
990         The new API tests verify that we do not use transitional processing, that we do apply the Bidi and ContextJ checks, but not ContextO checks.
991
992         * platform/URLParser.cpp:
993         (WebCore::URLParser::domainToASCII):
994         (WebCore::URLParser::internationalDomainNameTranscoder):
995         * platform/URLParser.h:
996         * platform/mac/WebCoreNSURLExtras.mm:
997         (WebCore::mapHostNameWithRange):
998
999 2016-11-18  Dean Jackson  <dino@apple.com>
1000
1001         Better testing for accessibility media queries
1002         https://bugs.webkit.org/show_bug.cgi?id=164954
1003         <rdar://problem/29338292>
1004
1005         Reviewed by Myles Maxfield.
1006
1007         Provide an override mode for the accessibility media queries
1008         that rely on system settings. This way we can test that they
1009         are least responding to something.
1010
1011         Tests: fast/media/mq-inverted-colors-forced-value.html
1012                fast/media/mq-monochrome-forced-value.html
1013
1014         * css/MediaQueryEvaluator.cpp: Query the Settings to see if we're
1015         forcing a value.
1016         (WebCore::monochromeEvaluate):
1017         (WebCore::invertedColorsEvaluate):
1018         (WebCore::prefersReducedMotionEvaluate):
1019         * page/Settings.h:
1020         * testing/InternalSettings.cpp: Add new forcing values for inverted-colors
1021         and monochrome.
1022         (WebCore::InternalSettings::Backup::Backup):
1023         (WebCore::InternalSettings::Backup::restoreTo):
1024         (WebCore::settingsToInternalSettingsValue):
1025         (WebCore::internalSettingsToSettingsValue):
1026         (WebCore::InternalSettings::forcedColorsAreInvertedAccessibilityValue):
1027         (WebCore::InternalSettings::setForcedColorsAreInvertedAccessibilityValue):
1028         (WebCore::InternalSettings::forcedDisplayIsMonochromeAccessibilityValue):
1029         (WebCore::InternalSettings::setForcedDisplayIsMonochromeAccessibilityValue):
1030         (WebCore::InternalSettings::forcedPrefersReducedMotionAccessibilityValue):
1031         (WebCore::InternalSettings::setForcedPrefersReducedMotionAccessibilityValue):
1032         (WebCore::InternalSettings::forcedPrefersReducedMotionValue): Deleted.
1033         (WebCore::InternalSettings::setForcedPrefersReducedMotionValue): Deleted.
1034         * testing/InternalSettings.h:
1035         * testing/InternalSettings.idl:
1036
1037 2016-11-18  Myles C. Maxfield  <mmaxfield@apple.com>
1038
1039         Unsupported emoji are invisible
1040         https://bugs.webkit.org/show_bug.cgi?id=164944
1041         <rdar://problem/28591608>
1042
1043         Reviewed by Dean Jackson.
1044
1045         In WidthIterator, we explicitly skip characters which the OS has no font
1046         to render with. However, for emoji, we should draw something to show that
1047         there is missing content. Because we have nothing to draw, we can draw
1048         the .notdef glyph (empty box, or "tofu").
1049
1050         Test: fast/text/emoji-draws.html
1051
1052         * platform/graphics/WidthIterator.cpp:
1053         (WebCore::characterMustDrawSomething):
1054         (WebCore::WidthIterator::advanceInternal):
1055
1056 2016-11-18  Sam Weinig  <sam@webkit.org>
1057
1058         [WebIDL] Add support for record types
1059         https://bugs.webkit.org/show_bug.cgi?id=164935
1060
1061         Reviewed by Tim Horton.
1062
1063         Add support for WebIDLs record types. We map them to HashMap<String, {OtherType}>.
1064
1065         * bindings/generic/IDLTypes.h:
1066         - Add IDLRecord type and helper predicate.
1067         - Remove IDLRegExp which is no longer in WebIDL and we never supported.
1068
1069         * bindings/js/JSDOMBinding.cpp:
1070         (WebCore::stringToByteString):
1071         (WebCore::identifierToByteString):
1072         (WebCore::valueToByteString):
1073         (WebCore::hasUnpairedSurrogate):
1074         (WebCore::stringToUSVString):
1075         (WebCore::identifierToUSVString):
1076         (WebCore::valueToUSVString):
1077         * bindings/js/JSDOMBinding.h:
1078         Refactor ByteString and USVString conversion to support converting from
1079         either a JSValue or Identifier.
1080
1081         * bindings/js/JSDOMConvert.h:
1082         (WebCore::DetailConverter<IDLRecord<K, V>>):
1083         (WebCore::JSConverter<IDLRecord<K, V>>):
1084         Add conversion support for record types. Use Detail::IdentifierConverter helper
1085         to convert identifiers to strings using the correct conversion rules.
1086
1087         (WebCore::Converter<IDLUnion<T...>>::convert):
1088         Update comments in union conversion to match current spec. Remove check
1089         for regular expressions and add support for record types.
1090
1091         * bindings/scripts/CodeGenerator.pm:
1092         (IsRefPtrType):
1093         Add record and union types to the list of things that aren't RefPtrs.
1094
1095         (IsRecordType):
1096         Add predicate for testing if a type is a record.
1097
1098         (IsWrapperType):
1099         Remove check for union. This is now handled in the IsRefPtrType check.
1100
1101         (SkipIncludeHeader): Deleted.
1102         (GetSequenceInnerType): Deleted.
1103         (GetFrozenArrayInnerType): Deleted.
1104         (GetSequenceOrFrozenArrayInnerType): Deleted.
1105         Remove no longer necessary functions.
1106
1107         * bindings/scripts/CodeGeneratorJS.pm:
1108         (AddIncludesForImplementationType):
1109         Remove check for includes to skip. This is now only called for interfaces, which should be included
1110         unconditionally.
1111
1112         (AddToIncludesForIDLType):
1113         Add includes and recursive includes for record types.
1114
1115         (GenerateOverloadedFunctionOrConstructor):
1116         Update to account for records.
1117
1118         (GetGnuVTableRefForInterface):
1119         (GetGnuVTableNameForInterface):
1120         (GetGnuMangledNameForInterface):
1121         (GetWinVTableNameForInterface):
1122         (GetWinMangledNameForInterface):
1123         Strength-reduce GetNativeTypeForConversions and GetNamespaceForInterface into their callers.
1124
1125         (GetBaseIDLType):
1126         Add support for IDLRecord. Remove call to GetIDLInterfaceName now that is simply the type name.
1127
1128         (GetNativeType):
1129         Simplify sequence/FrozenArray support and add record support.
1130
1131         (GetNativeInnerType):
1132         Generalize GetNativeVectorInnerType to work for record types as well.
1133
1134         (ShouldPassWrapperByReference):
1135         Moved so native type accessors can be together.
1136
1137         (NativeToJSValueDOMConvertNeedsState):
1138         (NativeToJSValueDOMConvertNeedsGlobalObject):
1139         Add record support.
1140
1141         (GetNativeTypeForConversions): Deleted.
1142         (GetNamespaceForInterface): Deleted.
1143         (GetNativeVectorType): Deleted.
1144         (GetIDLInterfaceName): Deleted.
1145         (GetNativeVectorInnerType): Deleted.
1146         Remove unneeded functions.
1147
1148         * bindings/scripts/IDLParser.pm:
1149         (typeDescription):
1150         Add helper useful for debugging, that constructs the string form of a type.
1151
1152         (typeByApplyingTypedefs):
1153         Add missing call to typeByApplyingTypedefs (this is noted by a fix in JSTestCallbackFunctionWithTypedefs.h)
1154
1155         (parseNonAnyType):
1156         Remove unused $subtypeName variables and add support for parsing record types.
1157
1158         * bindings/scripts/test/JS/JSTestCallbackFunctionWithTypedefs.cpp:
1159         * bindings/scripts/test/JS/JSTestCallbackFunctionWithTypedefs.h:
1160         * bindings/scripts/test/JS/JSTestObj.cpp:
1161         * bindings/scripts/test/TestObj.idl:
1162         Add tests for records and update results.
1163
1164         * testing/TypeConversions.h:
1165         (WebCore::TypeConversions::testLongRecord):
1166         (WebCore::TypeConversions::setTestLongRecord):
1167         (WebCore::TypeConversions::testNodeRecord):
1168         (WebCore::TypeConversions::setTestNodeRecord):
1169         (WebCore::TypeConversions::testSequenceRecord):
1170         (WebCore::TypeConversions::setTestSequenceRecord):
1171         * testing/TypeConversions.idl:
1172         Add record types so it can be tested from layout tests.
1173
1174 2016-11-18  Dave Hyatt  <hyatt@apple.com>
1175
1176         [CSS Parser] Support font-variation-settings
1177         https://bugs.webkit.org/show_bug.cgi?id=164947
1178
1179         Reviewed by Myles Maxfield.
1180
1181         * css/parser/CSSPropertyParser.cpp:
1182         (WebCore::consumeFontVariationTag):
1183         (WebCore::consumeFontVariationSettings):
1184         (WebCore::CSSPropertyParser::parseSingleValue):
1185
1186 2016-11-17  Jiewen Tan  <jiewen_tan@apple.com>
1187
1188         Update SubtleCrypto::encrypt to match the latest spec
1189         https://bugs.webkit.org/show_bug.cgi?id=164738
1190         <rdar://problem/29257812>
1191
1192         Reviewed by Brent Fulgham.
1193
1194         This patch does following few things:
1195         1. It updates the SubtleCrypto::encrypt method to match the latest spec:
1196            https://www.w3.org/TR/WebCryptoAPI/#SubtleCrypto-method-encrypt.
1197            It also refers to the latest Editor's Draft to a certain degree:
1198            https://w3c.github.io/webcrypto/Overview.html#SubtleCrypto-method-encrypt.
1199         2. It implements encrypt operations of the following algorithms: AES-CBC,
1200            RSAES-PKCS1-V1_5, and RSA-OAEP.
1201         3. It addes ASSERT(parameters) for every method that accepts a
1202            std::unique_ptr<CryptoAlgorithmParameters>&& type parameter.
1203         4. It changes RefPtr<CryptoKey>&& to Ref<CryptoKey>&& for every method that
1204            accepts a CryptoKey.
1205
1206         Tests: crypto/subtle/aes-cbc-encrypt-malformed-parameters.html
1207                crypto/subtle/aes-cbc-import-key-encrypt.html
1208                crypto/subtle/encrypt-malformed-parameters.html
1209                crypto/subtle/rsa-oaep-encrypt-malformed-parameters.html
1210                crypto/subtle/rsa-oaep-import-key-encrypt-label.html
1211                crypto/subtle/rsa-oaep-import-key-encrypt.html
1212                crypto/subtle/rsaes-pkcs1-v1_5-import-key-encrypt.html
1213                crypto/workers/subtle/aes-cbc-import-key-encrypt.html
1214                crypto/workers/subtle/rsa-oaep-import-key-encrypt.html
1215                crypto/workers/subtle/rsaes-pkcs1-v1_5-import-key-encrypt.html
1216
1217         * CMakeLists.txt:
1218         * DerivedSources.make:
1219         * WebCore.xcodeproj/project.pbxproj:
1220         * bindings/js/BufferSource.h:
1221         (WebCore::BufferSource::BufferSource):
1222         Add a default constructor for initializing an empty BufferSource object.
1223         * bindings/js/JSSubtleCryptoCustom.cpp:
1224         (WebCore::normalizeCryptoAlgorithmParameters):
1225         (WebCore::jsSubtleCryptoFunctionEncryptPromise):
1226         (WebCore::JSSubtleCrypto::encrypt):
1227         * crypto/CryptoAlgorithm.cpp:
1228         (WebCore::CryptoAlgorithm::encrypt):
1229         (WebCore::CryptoAlgorithm::exportKey):
1230         * crypto/CryptoAlgorithm.h:
1231         * crypto/CryptoAlgorithmParameters.h:
1232         * crypto/CryptoKey.h:
1233         * crypto/SubtleCrypto.cpp:
1234         (WebCore::SubtleCrypto::SubtleCrypto):
1235         * crypto/SubtleCrypto.h:
1236         (WebCore::SubtleCrypto::workQueue):
1237         * crypto/SubtleCrypto.idl:
1238         * crypto/gnutls/CryptoAlgorithmAES_CBCGnuTLS.cpp:
1239         (WebCore::CryptoAlgorithmAES_CBC::platformEncrypt):
1240         * crypto/gnutls/CryptoAlgorithmRSAES_PKCS1_v1_5GnuTLS.cpp:
1241         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::platformEncrypt):
1242         * crypto/gnutls/CryptoAlgorithmRSA_OAEPGnuTLS.cpp:
1243         (WebCore::CryptoAlgorithmRSA_OAEP::platformEncrypt):
1244         * crypto/gnutls/CryptoKeyRSAGnuTLS.cpp:
1245         (WebCore::CryptoKeyRSA::generatePair):
1246         * crypto/algorithms/CryptoAlgorithmAES_CBC.cpp:
1247         (WebCore::CryptoAlgorithmAES_CBC::encrypt):
1248         (WebCore::CryptoAlgorithmAES_CBC::generateKey):
1249         (WebCore::CryptoAlgorithmAES_CBC::importKey):
1250         (WebCore::CryptoAlgorithmAES_CBC::exportKey):
1251         * crypto/algorithms/CryptoAlgorithmAES_CBC.h:
1252         * crypto/algorithms/CryptoAlgorithmAES_KW.cpp:
1253         (WebCore::CryptoAlgorithmAES_KW::generateKey):
1254         (WebCore::CryptoAlgorithmAES_KW::importKey):
1255         (WebCore::CryptoAlgorithmAES_KW::exportKey):
1256         * crypto/algorithms/CryptoAlgorithmAES_KW.h:
1257         * crypto/algorithms/CryptoAlgorithmHMAC.cpp:
1258         (WebCore::CryptoAlgorithmHMAC::generateKey):
1259         (WebCore::CryptoAlgorithmHMAC::importKey):
1260         (WebCore::CryptoAlgorithmHMAC::exportKey):
1261         * crypto/algorithms/CryptoAlgorithmHMAC.h:
1262         * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp:
1263         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::encrypt):
1264         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::generateKey):
1265         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::importKey):
1266         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::exportKey):
1267         * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.h:
1268         * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp:
1269         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::generateKey):
1270         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::importKey):
1271         (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::exportKey):
1272         * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.h:
1273         * crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp:
1274         (WebCore::CryptoAlgorithmRSA_OAEP::encrypt):
1275         (WebCore::CryptoAlgorithmRSA_OAEP::generateKey):
1276         (WebCore::CryptoAlgorithmRSA_OAEP::importKey):
1277         (WebCore::CryptoAlgorithmRSA_OAEP::exportKey):
1278         * crypto/algorithms/CryptoAlgorithmRSA_OAEP.h:
1279         * crypto/keys/CryptoKeyRSA.h:
1280         * crypto/mac/CryptoAlgorithmAES_CBCMac.cpp:
1281         (WebCore::transformAES_CBC):
1282         (WebCore::CryptoAlgorithmAES_CBC::platformEncrypt):
1283         (WebCore::CryptoAlgorithmAES_CBC::platformDecrypt):
1284         * crypto/mac/CryptoAlgorithmRSAES_PKCS1_v1_5Mac.cpp:
1285         (WebCore::encryptRSAES_PKCS1_v1_5):
1286         (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::platformEncrypt):
1287         * crypto/mac/CryptoAlgorithmRSA_OAEPMac.cpp:
1288         (WebCore::encryptRSA_OAEP):
1289         (WebCore::CryptoAlgorithmRSA_OAEP::platformEncrypt):
1290         * crypto/mac/CryptoKeyRSAMac.cpp:
1291         (WebCore::CryptoKeyRSA::generatePair):
1292         * crypto/parameters/AesCbcParams.idl: Added.
1293         * crypto/parameters/CryptoAlgorithmAesCbcParams.h: Added.
1294         * crypto/parameters/CryptoAlgorithmAesCbcParamsDeprecated.h:
1295         * crypto/parameters/CryptoAlgorithmRsaOaepParams.h: Added.
1296         * crypto/parameters/RsaOaepParams.idl: Added.
1297
1298 2016-11-18  Ryan Haddad  <ryanhaddad@apple.com>
1299
1300         Attempt to fix iOS build again.
1301         <rdar://problem/29312689>
1302
1303         Unreviewed build fix.
1304
1305         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
1306         (WebCore::MediaPlayerPrivateAVFoundationObjC::setCurrentTextTrack):
1307         (WebCore::MediaPlayerPrivateAVFoundationObjC::languageOfPrimaryAudioTrack):
1308
1309 2016-11-18  Myles C. Maxfield  <mmaxfield@apple.com>
1310
1311         [CSS Font Loading] FontFaceSet.load() promises don't always fire
1312         https://bugs.webkit.org/show_bug.cgi?id=164902
1313
1314         Reviewed by David Hyatt.
1315
1316         Test: fast/text/fontfaceset-rebuild-during-loading.html
1317
1318         We currently handle web fonts in two phases. The first phase is building up
1319         StyleRuleFontFace objects which reflect the style on the page. The second is creating
1320         CSSFontFace objects from those StyleRuleFontFace objects. When script modifies the
1321         style on the page, we can often update the CSSFontFace objects, but there are some
1322         modifications which we don't know how to model. For these operations, we destroy the
1323         CSSFontFace objects and rebuild them from the newly modified StyleRuleFontFace objects.
1324
1325         Normally, this is fine. However, with the CSS font loading API, the CSSFontFaces back
1326         Javascript objects which will persist across the rebuilding step mentioned above. This
1327         means that the FontFace objects need to adopt the new CSSFontFace objects and forget
1328         the old CSSFontFace objects.
1329
1330         There was one bit of state which I forgot to update during this rebuilding phase. The
1331         FontFaceSet object contains an internal HashMap where a reference to a CSSFontFace
1332         is used as a key. After the rebuilding phase, this reference wasn't updated to point
1333         to the new CSSFontFace.
1334
1335         The solution is to instead use a reference to the higher-level FontFace as the key to
1336         the HashMap. This object is persistent across the rebuilding phase (and it adopts
1337         the new CSSFontFaces). There is not a lifetime problem because the FontFace holds a
1338         strong reference to its backing CSSFontFace object.
1339
1340         This bug didn't cause a memory problem because the HashMap was keeping the old
1341         CSSFontFace alive because the key was a strong reference.
1342
1343         This patch also adds a lengthy comment explaining how the migration works.
1344
1345         * css/CSSFontFace.cpp:
1346         (WebCore::CSSFontFace::initializeWrapper): This is another bit of state which didn't
1347         survive the rebuilding phase. Moving it here causes it to survive.
1348         (WebCore::CSSFontFace::wrapper):
1349         * css/CSSFontSelector.cpp:
1350         (WebCore::CSSFontSelector::addFontFaceRule):
1351         * css/FontFaceSet.cpp:
1352         (WebCore::FontFaceSet::load):
1353         (WebCore::FontFaceSet::faceFinished):
1354         * css/FontFaceSet.h:
1355
1356 2016-11-18  Myles C. Maxfield  <mmaxfield@apple.com>
1357
1358         [SVG -> OTF Font Converter] Fonts advances are not internally consistent inside the generated font file
1359         https://bugs.webkit.org/show_bug.cgi?id=164846
1360         <rdar://problem/29031509>
1361
1362         Reviewed by Darin Adler.
1363
1364         The fonts I'm generating in the SVG -> OTF converter have fractional FUnit values for their advances.
1365         The CFF table can encode that, but hmtx can't, which means the font isn't internally consistent.
1366
1367         Covered by existing tests.
1368
1369         * svg/SVGToOTFFontConversion.cpp:
1370
1371 2016-11-18  Ryan Haddad  <ryanhaddad@apple.com>
1372
1373         Attempt to fix iOS build.
1374         <rdar://problem/29312689>
1375
1376         Unreviewed build fix.
1377
1378         * platform/graphics/avfoundation/MediaSelectionGroupAVFObjC.mm:
1379         (WebCore::MediaSelectionGroupAVFObjC::updateOptions):
1380
1381 2016-11-18  Dave Hyatt  <hyatt@apple.com>
1382
1383         [CSS Parser] Hook up InspectorStyleSheet to the new CSS parser.
1384         https://bugs.webkit.org/show_bug.cgi?id=164886
1385
1386         Reviewed by Dean Jackson.
1387
1388         * css/CSSGrammar.y.in:
1389         Get rid of the CSSRuleSourceData type enum, since StyleRule's type
1390         enum is exactly the same.
1391
1392         * css/CSSPropertySourceData.cpp:
1393         (WebCore::CSSPropertySourceData::CSSPropertySourceData):
1394         * css/CSSPropertySourceData.h:
1395         Add a concept of disabled to CSSPropertySourceData. This is used for
1396         commented out properties.
1397
1398         (WebCore::CSSRuleSourceData::create):
1399         (WebCore::CSSRuleSourceData::createUnknown):
1400         (WebCore::CSSRuleSourceData::CSSRuleSourceData):
1401         Get rid of the CSSRuleSourceData type enum, since StyleRule's type
1402         enum is exactly the same.
1403
1404         * css/parser/CSSParser.cpp:
1405         (WebCore::CSSParserContext::CSSParserContext):
1406         (WebCore::CSSParser::parseSheetForInspector):
1407         (WebCore::CSSParser::parseDeclarationForInspector):
1408         (WebCore::CSSParser::markSupportsRuleHeaderStart):
1409         (WebCore::CSSParser::markRuleHeaderStart):
1410         (WebCore::CSSParser::markPropertyEnd):
1411         * css/parser/CSSParser.h:
1412         Add functions that represent the new API for inspector sheet
1413         and declaration parsing. Patch the old parse code to use StyleRule::Type
1414         now that the CSSRuleSourceData type is gone.
1415
1416         * css/parser/CSSParserObserver.h:
1417         Tweak the API for our memory management.
1418
1419         * inspector/InspectorStyleSheet.cpp:
1420         (flattenSourceData):
1421         (WebCore::parserContextForDocument):
1422         (WebCore::StyleSheetHandler::StyleSheetHandler):
1423         (WebCore::StyleSheetHandler::startRuleHeader):
1424         (WebCore::StyleSheetHandler::setRuleHeaderEnd):
1425         (WebCore::StyleSheetHandler::endRuleHeader):
1426         (WebCore::StyleSheetHandler::observeSelector):
1427         (WebCore::StyleSheetHandler::startRuleBody):
1428         (WebCore::StyleSheetHandler::endRuleBody):
1429         (WebCore::StyleSheetHandler::popRuleData):
1430         (WebCore::fixUnparsedProperties):
1431         (WebCore::StyleSheetHandler::fixUnparsedPropertyRanges):
1432         (WebCore::StyleSheetHandler::observeProperty):
1433         (WebCore::StyleSheetHandler::observeComment):
1434         (WebCore::InspectorStyle::populateAllProperties):
1435         (WebCore::isValidSelectorListString):
1436         (WebCore::InspectorStyleSheet::ensureSourceData):
1437         (WebCore::InspectorStyleSheetForInlineStyle::ensureParsedDataReady):
1438         (WebCore::InspectorStyleSheetForInlineStyle::ruleSourceData):
1439         (WebCore::createCSSParser): Deleted.
1440         (WebCore::InspectorStyleSheetForInlineStyle::getStyleAttributeRanges): Deleted.
1441         * inspector/InspectorStyleSheet.h:
1442         (WebCore::InspectorStyleProperty::setRawTextFromStyleDeclaration):
1443         Add the new implementation. This involves duplicating most of the old
1444         parser code for this into a new class, StyleSheetHandler, that implements
1445         the observer interface and builds up the same data structures as the old
1446         parser did in response to the callbacks.
1447
1448 2016-11-18  Dan Bernstein  <mitz@apple.com>
1449
1450         Tried to fix some non-macOS builds.
1451         <rdar://problems/29331425&29331438&29331722>
1452
1453         * platform/mac/WebPlaybackControlsManager.h:
1454
1455 2016-11-18  Per Arne Vollan  <pvollan@apple.com>
1456
1457         [Win32] Start releasing memory earlier when memory is running low.
1458         https://bugs.webkit.org/show_bug.cgi?id=164862
1459
1460         Reviewed by Brent Fulgham.
1461
1462         On Windows, 32-bit processes have 2GB of memory available, where some is used by the system.
1463         Debugging has shown that allocations might fail and cause crashes when memory usage is > ~1GB.
1464         We should start releasing memory before we reach 1GB.
1465
1466         * platform/win/MemoryPressureHandlerWin.cpp:
1467         (WebCore::CheckMemoryTimer::fired):
1468
1469 2016-11-17  Carlos Garcia Campos  <cgarcia@igalia.com>
1470
1471         REGRESSION(r208511): ImageDecoders: Crash decoding GIF images since r208511
1472         https://bugs.webkit.org/show_bug.cgi?id=164864
1473
1474         Reviewed by Simon Fraser.
1475
1476         This happens sometimes since r208511 because the same decoder is used by more than one thread at the same
1477         time and the decoders are not thread-safe. Several methods in ImageDecoder need to decode partially the image,
1478         so it's possible that one method calls frameBufferAtIndex at the same times as createFrameImageAtIndex that now
1479         can be called from the image decoder thread. Use a Lock in ImageDecoder to protect calls to frameBufferAtIndex.
1480
1481         * platform/image-decoders/ImageDecoder.cpp:
1482         (WebCore::ImageDecoder::frameIsCompleteAtIndex):
1483         (WebCore::ImageDecoder::frameDurationAtIndex):
1484         (WebCore::ImageDecoder::createFrameImageAtIndex):
1485         * platform/image-decoders/ImageDecoder.h:
1486
1487 2016-11-17  Ryosuke Niwa  <rniwa@webkit.org>
1488
1489         Add an experimental API to find elements across shadow boundaries
1490         https://bugs.webkit.org/show_bug.cgi?id=164851
1491         <rdar://problem/28220092>
1492
1493         Reviewed by Sam Weinig.
1494
1495         Add window.collectMatchingElementsInFlatTree(Node node, DOMString selectors)
1496         as an experimental API which finds a list of elements that matches the given CSS selectors
1497         and expose it to a JSWorld on which WKBundleScriptWorldMakeAllShadowRootsOpen was called.
1498
1499         No new tests. More test cases are added to WebKit2.InjectedBundleMakeAllShadowRootsOpen.
1500
1501         * bindings/scripts/CodeGeneratorJS.pm:
1502         (NeedsRuntimeCheck): Added. Abstracts checks for EnabledAtRuntime and EnabledForWorld.
1503         (OperationShouldBeOnInstance):
1504         (GeneratePropertiesHashTable):
1505         (GetRuntimeEnableFunctionName): Use worldForDOMObject(this).condition() for EnabledForWorld.
1506         Also split the line for EnabledAtRuntime and EnabledAtRuntime for a better readability.
1507         (GenerateImplementation):
1508         (addIterableProperties):
1509         * bindings/scripts/IDLAttributes.txt:
1510         * bindings/scripts/preprocess-idls.pl:
1511         (GenerateConstructorAttribute):
1512         * bindings/scripts/test/JS/JSTestGlobalObject.cpp:
1513         (WebCore::JSTestGlobalObject::finishCreation):
1514         (WebCore::jsTestGlobalObjectInstanceFunctionEnabledInSpecificWorld):
1515         (WebCore::jsTestGlobalObjectInstanceFunctionEnabledInSpecificWorldCaller):
1516         * bindings/scripts/test/JS/JSTestObj.cpp:
1517         (WebCore::JSTestObjPrototype::finishCreation):
1518         (WebCore::jsTestObjPrototypeFunctionWorldSpecificMethod):
1519         (WebCore::jsTestObjPrototypeFunctionWorldSpecificMethodCaller):
1520         * bindings/scripts/test/TestGlobalObject.idl: Added a test case.
1521         * bindings/scripts/test/TestObj.idl: Ditto.
1522         * page/DOMWindow.cpp:
1523         (WebCore::DOMWindow::collectMatchingElementsInFlatTree): Added. Implements the feature by
1524         calling SelectorQuery's matches on a node yielded by ComposedTreeIterator.
1525         * page/DOMWindow.h:
1526         * page/DOMWindow.idl:
1527
1528 2016-11-17  Sam Weinig  <sam@webkit.org>
1529
1530         [WebIDL] Add support for ByteString
1531         https://bugs.webkit.org/show_bug.cgi?id=164901
1532
1533         Reviewed by Darin Adler.
1534
1535         * bindings/generic/IDLTypes.h:
1536         Make IDLByteString a IDLString.
1537
1538         * bindings/js/JSDOMBinding.cpp:
1539         (WebCore::valueToByteString):
1540         (WebCore::valueToUSVString):
1541         * bindings/js/JSDOMBinding.h:
1542         Add conversion function for ByteString and fix valueToUSVString to take an ExecState reference.
1543
1544         * bindings/js/JSDOMConvert.h:
1545         (WebCore::Converter<IDLByteString>::convert):
1546         (WebCore::JSConverter<IDLByteString>::convert):
1547         Add conversion functions for ByteString, using valueToByteString.
1548
1549         (WebCore::Converter<IDLUSVString>::convert):
1550         Update to pass the ExecState by reference.
1551
1552         * bindings/js/JSMessageEventCustom.cpp:
1553         (WebCore::handleInitMessageEvent):
1554         Update to pass the ExecState by reference.
1555
1556         * bindings/js/JSWorkerGlobalScopeCustom.cpp:
1557         (WebCore::JSWorkerGlobalScope::importScripts):
1558         Update to pass the ExecState by reference.
1559
1560         * bindings/scripts/CodeGenerator.pm:
1561         Add ByteString as a string type.
1562
1563         * testing/TypeConversions.h:
1564         (WebCore::TypeConversions::testByteString):
1565         (WebCore::TypeConversions::setTestByteString):
1566         * testing/TypeConversions.idl:
1567         Add a testByteString attribute for testing.
1568
1569 2016-11-17  Ryosuke Niwa  <rniwa@webkit.org>
1570
1571         WKBundleNodeHandleSetHTMLInputElementSpellcheckEnabled should keep text replacement enabled
1572         https://bugs.webkit.org/show_bug.cgi?id=164857
1573         <rdar://problem/27721742>
1574
1575         Reviewed by Wenson Hsieh.
1576
1577         It turns out that some users want text replacement to be always enabled so change the semantics of
1578         WKBundleNodeHandleSetHTMLInputElementSpellcheckEnabled to only disable everything else.
1579
1580         Instead of completely disabling spellchecking, remove all text checking options but text replacement
1581         when the user types into an input element on which this API is used to disable spellchecking.
1582
1583         No new tests since we don't have a good facility to test text replacement.
1584
1585         * dom/Element.h:
1586         (WebCore::Element::isSpellCheckingEnabled): Made this non-virtual now that there is no override.
1587         * editing/Editor.cpp:
1588         (WebCore::Editor::replaceSelectionWithFragment):
1589         (WebCore::Editor::markAllMisspellingsAndBadGrammarInRanges): Don't call resolveTextCheckingTypeMask twice.
1590         (WebCore::Editor::resolveTextCheckingTypeMask): Filter out the text checking options if the root editable
1591         element is inside an input element on which isSpellcheckDisabledExceptTextReplacement is set to true.
1592         * editing/Editor.h:
1593         * html/HTMLInputElement.cpp:
1594         (WebCore::HTMLInputElement::HTMLInputElement):
1595         (WebCore::HTMLInputElement::isSpellCheckingEnabled): Deleted.
1596         * html/HTMLInputElement.h:
1597         (WebCore::HTMLInputElement::setSpellcheckDisabledExceptTextReplacement): Renamed from setSpellcheckEnabled
1598         to reflect the new semantics.
1599         (WebCore::HTMLInputElement::isSpellcheckDisabledExceptTextReplacement): Ditto.
1600
1601 2016-11-17  John Wilander  <wilander@apple.com>
1602
1603         Resource load statistics: Cover further data records, count removed data records, and only fire handler when needed
1604         https://bugs.webkit.org/show_bug.cgi?id=164659
1605
1606         Reviewed by Andy Estes.
1607
1608         No new tests. This feature is behind a flag and off by default. Tests require real domain names.
1609
1610         * loader/ResourceLoadObserver.cpp:
1611         (WebCore::ResourceLoadObserver::logFrameNavigation):
1612         (WebCore::ResourceLoadObserver::logSubresourceLoading):
1613         (WebCore::ResourceLoadObserver::logWebSocketLoading):
1614             All three functions are now more conservative in calls to
1615             m_store->fireDataModificationHandler(). They only fire when an important statistic has
1616             changed or data records have previously been removed for the domain in question.
1617         * loader/ResourceLoadStatistics.cpp:
1618         (WebCore::ResourceLoadStatistics::encode):
1619             Added the dataRecordsRemoved statistic.
1620         (WebCore::ResourceLoadStatistics::decode):
1621             Now takes a version parameter to control which keys to expect.
1622             Added the dataRecordsRemoved statistic.
1623         (WebCore::appendHashCountedSet):
1624             Removed stray linefeed.
1625         (WebCore::ResourceLoadStatistics::toString):
1626             Added the dataRecordsRemoved statistic.
1627         (WebCore::ResourceLoadStatistics::merge):
1628             Added the dataRecordsRemoved statistic.
1629         * loader/ResourceLoadStatistics.h:
1630             Added the dataRecordsRemoved statistic.
1631         * loader/ResourceLoadStatisticsStore.cpp:
1632         (WebCore::ResourceLoadStatisticsStore::createEncoderFromData):
1633             Now encodes a version number for the statistics model.
1634         (WebCore::ResourceLoadStatisticsStore::readDataFromDecoder):
1635             Now tries to decode a version number and passes it on to statistics decoding.
1636         (WebCore::ResourceLoadStatisticsStore::processStatistics):
1637             No longer gates processing on the number of data captured.
1638         (WebCore::ResourceLoadStatisticsStore::updateStatisticsForRemovedDataRecords):
1639             Update function for the new dataRecordsRemoved statistic.
1640         (WebCore::ResourceLoadStatisticsStore::hasEnoughDataForStatisticsProcessing): Deleted.
1641             No longer needed since we no longer gate processing on the number of data captured.
1642         * loader/ResourceLoadStatisticsStore.h:
1643
1644 2016-11-17  Alex Christensen  <achristensen@webkit.org>
1645
1646         Fix WinCairo build after r208740
1647         https://bugs.webkit.org/show_bug.cgi?id=164749
1648
1649         * platform/graphics/opengl/GraphicsContext3DOpenGLES.cpp:
1650         (WebCore::GraphicsContext3D::reshapeFBOs):
1651         (WebCore::GraphicsContext3D::validateAttributes):
1652         (WebCore::GraphicsContext3D::getExtensions):
1653         Use more references instead of pointers, like Myles did in r208740
1654
1655 2016-11-17  Alex Christensen  <achristensen@webkit.org>
1656
1657         Implement TextDecoder and TextEncoder
1658         https://bugs.webkit.org/show_bug.cgi?id=163771
1659
1660         Reviewed by Sam Weinig.
1661
1662         This API is already implemented by Chrome and Firefox
1663         as specified in https://encoding.spec.whatwg.org/
1664
1665         Covered by newly passing web platform tests.
1666
1667         * features.json:
1668         * CMakeLists.txt:
1669         * DerivedSources.make:
1670         * WebCore.xcodeproj/project.pbxproj:
1671         * dom/TextDecoder.cpp: Added.
1672         (WebCore::isEncodingWhitespace):
1673         (WebCore::TextDecoder::create):
1674         (WebCore::TextDecoder::TextDecoder):
1675         (WebCore::TextDecoder::ignoreBOMIfNecessary):
1676         (WebCore::TextDecoder::prependBOMIfNecessary):
1677         (WebCore::codeUnitByteSize):
1678         (WebCore::TextDecoder::decode):
1679         (WebCore::TextDecoder::encoding):
1680         * dom/TextDecoder.h: Added.
1681         (WebCore::TextDecoder::fatal):
1682         (WebCore::TextDecoder::ignoreBOM):
1683         * dom/TextDecoder.idl: Added.
1684         * dom/TextEncoder.cpp: Added.
1685         (WebCore::TextEncoder::TextEncoder):
1686         (WebCore::TextEncoder::encoding):
1687         (WebCore::TextEncoder::encode):
1688         * dom/TextEncoder.h: Added.
1689         (WebCore::TextEncoder::create):
1690         * dom/TextEncoder.idl: Added.
1691
1692 2016-11-17  Sam Weinig  <sam@webkit.org>
1693
1694         Try to fix the windows build again.
1695
1696         * svg/SVGStringList.h:
1697         * svg/properties/SVGStaticListPropertyTearOff.h:
1698         (WebCore::SVGStaticListPropertyTearOff::SVGStaticListPropertyTearOff):
1699
1700 2016-11-17  Sam Weinig  <sam@webkit.org>
1701
1702         Try to fix the windows build.
1703
1704         * svg/SVGStringList.h:
1705         Remove unnecessary using declarations.
1706
1707 2016-11-17  Chris Dumez  <cdumez@apple.com>
1708
1709         Regression(r208672?): ASSERTION FAILED: isMainThread() in WebCore::Node::ref()
1710         https://bugs.webkit.org/show_bug.cgi?id=164887
1711         <rdar://problem/29319497>
1712
1713         Reviewed by Brady Eidson.
1714
1715         Restore pre-r208672 behavior where we do not ref the script execution context in the
1716         background thread since this is unsafe. We use WTFMove(m_scriptExecutionContext)
1717         instead of m_scriptExecutionContext.copyRef(). Before r208672, it was calling
1718         m_scriptExecutionContext.releaseNonNull() because m_scriptExecutionContext was a
1719         RefPtr instead of a Ref. Note that copyRef() causes 2 issues here:
1720         1. It refs the scriptExecutionContext in a non-main thread which is unsafe and asserts.
1721         2. The point of this postTask in the destructor is to make sure the scriptExecutionContext
1722            gets destroyed in the main thread so we definitely want to *transfer* ownership of
1723            m_scriptExecutionContext to the main thread, not ref it to pass it to the main thread.
1724
1725         No new tests, already covered by storage/websql/multiple-transactions-on-different-handles.html.
1726
1727         * Modules/webdatabase/Database.cpp:
1728         (WebCore::Database::~Database):
1729
1730 2016-11-17  Brady Eidson  <beidson@apple.com>
1731
1732         Add _WKIconLoadingDelegate SPI.
1733         https://bugs.webkit.org/show_bug.cgi?id=164894
1734
1735         Reviewed by Alex Christensen.
1736
1737         No new tests (Manual testing possible in MiniBrowser now, WKTR tests coming soon in https://bugs.webkit.org/show_bug.cgi?id=164895).
1738
1739         With this client, WebCore will ask the FrameLoaderClient about each icon found in the <head>.
1740
1741         WebKit2 will then ask the embedding app - for each icon - if it wants that icon to load.
1742
1743         For icons the app decides to load, WebKit will pass the data to the app without storing locally.
1744
1745         * WebCore.xcodeproj/project.pbxproj:
1746
1747         * dom/Document.cpp:
1748         (WebCore::Document::implicitClose):
1749
1750         * html/LinkIconCollector.cpp:
1751         (WebCore::iconSize):
1752         (WebCore::compareIcons):
1753         * html/LinkIconCollector.h:
1754
1755         * loader/DocumentLoader.cpp:
1756         (WebCore::DocumentLoader::startIconLoading):
1757         (WebCore::DocumentLoader::didGetLoadDecisionForIcon):
1758         (WebCore::DocumentLoader::finishedLoadingIcon):
1759         * loader/DocumentLoader.h:
1760
1761         * loader/FrameLoaderClient.h:
1762
1763         * loader/icon/IconLoader.cpp:
1764         (WebCore::IconLoader::IconLoader):
1765         (WebCore::IconLoader::startLoading):
1766         (WebCore::IconLoader::notifyFinished):
1767         * loader/icon/IconLoader.h:
1768
1769         * platform/LinkIcon.h: Copied from Source/WebCore/html/LinkIconCollector.h.
1770         (WebCore::LinkIcon::encode):
1771         (WebCore::LinkIcon::decode):
1772
1773 2016-11-15  Sam Weinig  <sam@webkit.org>
1774
1775         [SVG] Moving more special casing of SVG out of the bindings - SVG lists
1776         https://bugs.webkit.org/show_bug.cgi?id=164790
1777
1778         Reviewed by Alex Christensen.
1779
1780         - Make SVGLengthList, SVGNumberList, SVGPointList, SVGStringList, SVGPathSegList and SVGTransformList
1781           real classes and stop special casing them in the bindings generator. This 
1782           removes the remaining SVG specializations for tear offs from the bindings generator.
1783         - Renamed existing SVGLengthList, SVGNumberList, SVGPointList, SVGStringList, SVGPathSegList, 
1784           SVGPathSegList and SVGTransformList to SVG<Type>ListValues, to make way for the new classes.
1785
1786         * CMakeLists.txt:
1787         * WebCore.xcodeproj/project.pbxproj:
1788         * svg/SVGAllInOne.cpp:
1789         Add new files.
1790
1791         * bindings/scripts/CodeGenerator.pm:
1792         * bindings/scripts/CodeGeneratorJS.pm:
1793         Remove SVG tear off specific code!
1794
1795         * rendering/svg/RenderSVGShape.cpp:
1796         * rendering/svg/RenderSVGText.cpp:
1797         * rendering/svg/RenderSVGTextPath.cpp:
1798         * rendering/svg/SVGRenderTreeAsText.cpp:
1799         * svg/SVGAnimateMotionElement.cpp:
1800         * svg/SVGClipPathElement.cpp:
1801         * svg/SVGLinearGradientElement.cpp:
1802         * svg/SVGRadialGradientElement.cpp:
1803         Remove unnecessary #includes.
1804
1805         * rendering/svg/SVGPathData.cpp:
1806         (WebCore::updatePathFromPolygonElement):
1807         (WebCore::updatePathFromPolylineElement):
1808         * rendering/svg/SVGTextLayoutAttributesBuilder.cpp:
1809         (WebCore::updateCharacterData):
1810         (WebCore::SVGTextLayoutAttributesBuilder::fillCharacterDataMap):
1811         * svg/SVGAnimatedLengthList.cpp:
1812         (WebCore::SVGAnimatedLengthListAnimator::constructFromString):
1813         (WebCore::parseLengthListFromString):
1814         (WebCore::SVGAnimatedLengthListAnimator::calculateAnimatedValue):
1815         (WebCore::SVGAnimatedLengthListAnimator::calculateDistance):
1816         * svg/SVGAnimatedLengthList.h:
1817         * svg/SVGAnimatedNumberList.cpp:
1818         (WebCore::SVGAnimatedNumberListAnimator::constructFromString):
1819         (WebCore::SVGAnimatedNumberListAnimator::addAnimatedTypes):
1820         (WebCore::SVGAnimatedNumberListAnimator::calculateAnimatedValue):
1821         (WebCore::SVGAnimatedNumberListAnimator::calculateDistance):
1822         * svg/SVGAnimatedNumberList.h:
1823         * svg/SVGAnimatedPath.cpp:
1824         (WebCore::SVGAnimatedPathAnimator::resetAnimValToBaseVal):
1825         * svg/SVGAnimatedPointList.cpp:
1826         (WebCore::SVGAnimatedPointListAnimator::constructFromString):
1827         (WebCore::SVGAnimatedPointListAnimator::addAnimatedTypes):
1828         (WebCore::SVGAnimatedPointListAnimator::calculateAnimatedValue):
1829         (WebCore::SVGAnimatedPointListAnimator::calculateDistance):
1830         * svg/SVGAnimatedPointList.h:
1831         * svg/SVGAnimatedTransformList.cpp:
1832         (WebCore::SVGAnimatedTransformListAnimator::constructFromString):
1833         (WebCore::SVGAnimatedTransformListAnimator::calculateAnimatedValue):
1834         * svg/SVGAnimatedTransformList.h:
1835         * svg/SVGAnimatedType.cpp:
1836         (WebCore::SVGAnimatedType::createLengthList):
1837         (WebCore::SVGAnimatedType::createNumberList):
1838         (WebCore::SVGAnimatedType::createPointList):
1839         (WebCore::SVGAnimatedType::createTransformList):
1840         * svg/SVGAnimatedType.h:
1841         (WebCore::SVGAnimatedType::lengthList):
1842         (WebCore::SVGAnimatedType::numberList):
1843         (WebCore::SVGAnimatedType::pointList):
1844         (WebCore::SVGAnimatedType::transformList):
1845         * svg/SVGComponentTransferFunctionElement.cpp:
1846         (WebCore::SVGComponentTransferFunctionElement::parseAttribute):
1847         * svg/SVGFEColorMatrixElement.cpp:
1848         (WebCore::SVGFEColorMatrixElement::parseAttribute):
1849         * svg/SVGFEConvolveMatrixElement.cpp:
1850         (WebCore::SVGFEConvolveMatrixElement::parseAttribute):
1851         (WebCore::SVGFEConvolveMatrixElement::build):
1852         * svg/SVGParserUtilities.cpp:
1853         (WebCore::pointsListFromSVGData):
1854         * svg/SVGParserUtilities.h:
1855         * svg/SVGPathElement.cpp:
1856         * svg/SVGPathElement.h:
1857         * svg/SVGPathSegListBuilder.cpp:
1858         * svg/SVGPathSegListBuilder.h:
1859         * svg/SVGPathSegListSource.cpp:
1860         * svg/SVGPathSegListSource.h:
1861         * svg/SVGPathUtilities.cpp:
1862         (WebCore::buildSVGPathByteStreamFromSVGPathSegListValues):
1863         (WebCore::appendSVGPathByteStreamFromSVGPathSeg):
1864         (WebCore::buildSVGPathSegListValuesFromByteStream):
1865         (WebCore::buildStringFromSVGPathSegListValues):
1866         (WebCore::buildSVGPathByteStreamFromSVGPathSegList): Deleted.
1867         (WebCore::buildSVGPathSegListFromByteStream): Deleted.
1868         (WebCore::buildStringFromSVGPathSegList): Deleted.
1869         * svg/SVGPathUtilities.h:
1870         * svg/SVGPolyElement.cpp:
1871         (WebCore::SVGPolyElement::parseAttribute):
1872         (WebCore::SVGPolyElement::lookupOrCreatePointsWrapper):
1873         (WebCore::SVGPolyElement::points):
1874         (WebCore::SVGPolyElement::animatedPoints):
1875         * svg/SVGPolyElement.h:
1876         (WebCore::SVGPolyElement::pointList):
1877         * svg/SVGTextPositioningElement.cpp:
1878         (WebCore::SVGTextPositioningElement::parseAttribute):
1879         * svg/SVGTransformable.cpp:
1880         (WebCore::SVGTransformable::parseTransformAttribute):
1881         * svg/SVGTransformable.h:
1882         * svg/SVGViewElement.cpp:
1883         (WebCore::SVGViewElement::viewTarget):
1884         (WebCore::SVGViewElement::parseAttribute):
1885         * svg/SVGViewElement.h:
1886         * svg/SVGViewElement.idl:
1887         * svg/SVGViewSpec.cpp:
1888         (WebCore::SVGViewSpec::transformString):
1889         (WebCore::SVGViewSpec::transform):
1890         (WebCore::SVGViewSpec::lookupOrCreateTransformWrapper):
1891         (WebCore::SVGViewSpec::reset):
1892         * svg/SVGViewSpec.h:
1893         Update for name changes.
1894         
1895         * svg/SVGAngle.h:
1896         (WebCore::SVGAngle::create):
1897         (WebCore::SVGAngle::SVGAngle):
1898         * svg/SVGLength.h:
1899         (WebCore::SVGLength::create):
1900         (WebCore::SVGLength::SVGLength):
1901         * svg/SVGMatrix.h:
1902         (WebCore::SVGMatrix::create):
1903         (WebCore::SVGMatrix::SVGMatrix):
1904         * svg/SVGNumber.h:
1905         (WebCore::SVGNumber::create):
1906         (WebCore::SVGNumber::SVGNumber):
1907         * svg/SVGPoint.h:
1908         (WebCore::SVGPoint::create):
1909         (WebCore::SVGPoint::SVGPoint):
1910         * svg/SVGPreserveAspectRatio.h:
1911         (WebCore::SVGPreserveAspectRatio::create):
1912         (WebCore::SVGPreserveAspectRatio::SVGPreserveAspectRatio):
1913         * svg/SVGRect.h:
1914         (WebCore::SVGRect::create):
1915         (WebCore::SVGRect::SVGRect):
1916         * svg/SVGTransform.h:
1917         (WebCore::SVGTransform::create):
1918         (WebCore::SVGTransform::SVGTransform):
1919         * svg/properties/SVGPropertyTearOff.h:
1920         (WebCore::SVGPropertyTearOff::create):
1921         Pass the SVGAnimatedProperty parameter by reference.
1922
1923         * svg/SVGAnimationElement.cpp:
1924         (WebCore::SVGAnimationElement::requiredFeatures):
1925         (WebCore::SVGAnimationElement::requiredExtensions):
1926         (WebCore::SVGAnimationElement::systemLanguage):
1927         * svg/SVGAnimationElement.h:
1928         * svg/SVGCursorElement.cpp:
1929         (WebCore::SVGCursorElement::requiredFeatures):
1930         (WebCore::SVGCursorElement::requiredExtensions):
1931         (WebCore::SVGCursorElement::systemLanguage):
1932         * svg/SVGCursorElement.h:
1933         * svg/SVGGradientElement.cpp:
1934         * svg/SVGGraphicsElement.cpp:
1935         (WebCore::SVGGraphicsElement::requiredFeatures):
1936         (WebCore::SVGGraphicsElement::requiredExtensions):
1937         (WebCore::SVGGraphicsElement::systemLanguage):
1938         * svg/SVGGraphicsElement.h:
1939         * svg/SVGMaskElement.cpp:
1940         (WebCore::SVGMaskElement::requiredFeatures):
1941         (WebCore::SVGMaskElement::requiredExtensions):
1942         (WebCore::SVGMaskElement::systemLanguage):
1943         * svg/SVGMaskElement.h:
1944         * svg/SVGPatternElement.cpp:
1945         (WebCore::SVGPatternElement::parseAttribute):
1946         (WebCore::SVGPatternElement::requiredFeatures):
1947         (WebCore::SVGPatternElement::requiredExtensions):
1948         (WebCore::SVGPatternElement::systemLanguage):
1949         * svg/SVGPatternElement.h:
1950         * svg/SVGTests.cpp:
1951         (WebCore::SVGTests::synchronizeAttribute):
1952         (WebCore::SVGTests::synchronizeRequiredFeatures):
1953         (WebCore::SVGTests::synchronizeRequiredExtensions):
1954         (WebCore::SVGTests::synchronizeSystemLanguage):
1955         (WebCore::SVGTests::requiredFeatures):
1956         (WebCore::SVGTests::requiredExtensions):
1957         (WebCore::SVGTests::systemLanguage):
1958         * svg/SVGTests.h:
1959         * svg/SVGTests.idl:
1960         Make SVGTests SVGStringLists work by adding implementations of functions
1961         on the SVGElements that implement SVGTests, passing *this down to SVGTests.
1962
1963         * svg/SVGLengthList.cpp: Removed.
1964         * svg/SVGLengthList.h:
1965         * svg/SVGLengthList.idl:
1966         * svg/SVGLengthListValues.cpp: Copied from svg/SVGLengthList.cpp.
1967         * svg/SVGLengthListValues.h: Copied from svg/SVGLengthList.h.
1968         Rename SVGLengthList to SVGLengthListValues and add an explicit implementation of
1969         the SVGLengthList interface inheriting from SVGListPropertyTearOff<SVGLengthListValues>.
1970
1971         * svg/SVGNumberList.cpp: Removed.
1972         * svg/SVGNumberList.h:
1973         * svg/SVGNumberListValues.cpp: Copied from svg/SVGNumberList.cpp.
1974         * svg/SVGNumberListValues.h: Copied from svg/SVGNumberList.h.
1975         Rename SVGNumberList to SVGNumberListValues and add an explicit implementation of
1976         the SVGNumberList interface inheriting from SVGListPropertyTearOff<SVGNumberListValues>.
1977
1978         * svg/SVGPathSegList.cpp:
1979         * svg/SVGPathSegList.h:
1980         * svg/SVGPathSegListValues.cpp: Copied from svg/SVGPathSegList.cpp.
1981         * svg/SVGPathSegListValues.h: Copied from svg/SVGPathSegList.h.
1982         * svg/properties/SVGPathSegListPropertyTearOff.cpp: Removed.
1983         * svg/properties/SVGPathSegListPropertyTearOff.h: Removed.
1984         Rename SVGPathSegList to SVGPathSegListValues and add an explicit implementation of
1985         the SVGPathSegList interface inheriting from SVGListProperty<SVGPathSegListValues>.
1986
1987         * svg/SVGPointList.cpp: Removed.
1988         * svg/SVGPointList.h:
1989         * svg/SVGPointListValues.cpp: Copied from svg/SVGPointList.cpp.
1990         * svg/SVGPointListValues.h: Copied from svg/SVGPointList.h.
1991         Rename SVGPointList to SVGPointListValues and add an explicit implementation of
1992         the SVGPointList interface inheriting from SVGListPropertyTearOff<SVGPointListValues>.
1993
1994         * svg/SVGStringList.cpp: Removed.
1995         * svg/SVGStringList.h:
1996         * svg/SVGStringListValues.cpp: Copied from svg/SVGStringList.cpp.
1997         * svg/SVGStringListValues.h: Copied from svg/SVGStringList.h.
1998         Rename SVGStringList to SVGStringListValues and add an explicit implementation of
1999         the SVGStringList interface inheriting from SVGStaticListPropertyTearOff<SVGStringListValues>.
2000
2001         * svg/SVGTransformList.cpp: Removed.
2002         * svg/SVGTransformList.h:
2003         * svg/SVGTransformListValues.cpp: Copied from svg/SVGTransformList.cpp.
2004         * svg/SVGTransformListValues.h: Copied from svg/SVGTransformList.h.
2005         * svg/properties/SVGTransformListPropertyTearOff.h: Removed.
2006         Rename SVGTransformList to SVGTransformListValues and add an explicit implementation of
2007         the SVGTransformList interface inheriting from SVGListPropertyTearOff<SVGTransformListValues>.
2008
2009         * svg/properties/SVGAnimatedListPropertyTearOff.h:
2010         * svg/properties/SVGAnimatedPathSegListPropertyTearOff.h:
2011         * svg/properties/SVGAnimatedPropertyTearOff.h:
2012         * svg/properties/SVGAnimatedTransformListPropertyTearOff.h:
2013         * svg/properties/SVGStaticListPropertyTearOff.h:
2014         Convert to return fully specialized types for baseVal and animVal, removing many unnecessary casts
2015         around the codebase. Also add some uses of Ref.
2016
2017         * svg/properties/SVGListProperty.h:
2018         (WebCore::SVGListProperty::getItemValuesAndWrappers):
2019         (WebCore::SVGListProperty::removeItemValuesAndWrappers):
2020         * svg/properties/SVGListPropertyTearOff.h:
2021         (WebCore::SVGListPropertyTearOff::create):
2022         (WebCore::SVGListPropertyTearOff::SVGListPropertyTearOff):
2023         (WebCore::SVGListPropertyTearOff::~SVGListPropertyTearOff):
2024         Store the AnimatedListPropertyTearOff as a Ref, and pass it around by reference.
2025
2026         * svg/properties/SVGStaticPropertyTearOff.h:
2027         Update to take the ContextElement by reference.
2028
2029 2016-11-17  Brent Fulgham  <bfulgham@apple.com>
2030
2031         Improve URL length handling
2032         https://bugs.webkit.org/show_bug.cgi?id=164884
2033         <rdar://problem/5909143>
2034
2035         Reviewed by David Kilzer.
2036
2037         Make sure the result of re-encoding and other fix-up stays within
2038         expected parameters.
2039
2040         No new tests. No change in behavior.
2041
2042         * platform/URL.cpp:
2043         (WebCore::URL::parse):
2044
2045 2016-11-17  Zalan Bujtas  <zalan@apple.com>
2046
2047         Render tree should be all clean by the end of FrameView::layout().
2048         https://bugs.webkit.org/show_bug.cgi?id=162834
2049
2050         Reviewed by Simon Fraser.
2051
2052         This is a preventive patch to ensure we don't introduce new bugs through
2053         dirty renderers. There are still 3 failing cases and they are skipped for now (debug only).
2054
2055         * page/FrameView.cpp:
2056         (WebCore::RenderTreeNeedsLayoutChecker::~RenderTreeNeedsLayoutChecker):
2057
2058 2016-11-17  Brent Fulgham  <bfulgham@apple.com>
2059
2060         keygen element should not support < 2048 RSA key lengths
2061         https://bugs.webkit.org/show_bug.cgi?id=164874
2062         <rdar://problem/22618141>
2063
2064         Reviewed by Dean Jackson.
2065
2066         Remove the two insecure RSA choices (512-bit and 1024-bit) so that users
2067         do not accidentally select a bad key length.
2068
2069         Tested by fast/html/keygen.html
2070
2071         * platform/LocalizedStrings.cpp:
2072         (WebCore::keygenMenuItem512): Deleted.
2073         (WebCore::keygenMenuItem1024): Deleted.
2074         * platform/LocalizedStrings.h:
2075         * platform/mac/SSLKeyGeneratorMac.mm:
2076         (WebCore::signedPublicKeyAndChallengeString): ASSERT on bad key size.
2077         (WebCore::getSupportedKeySizes): Remove bad key sizes.
2078         (WebCore::signedPublicKeyAndChallengeString): Ditto.
2079         * platform/win/SSLKeyGeneratorWin.cpp:
2080         (WebCore::WebCore::getSupportedKeySizes): Ditto.
2081
2082 2016-11-17  Eric Carlson  <eric.carlson@apple.com>
2083
2084         [MediaStream][Mac] Use AVCapturePreview object for camera/microphone rendering
2085         https://bugs.webkit.org/show_bug.cgi?id=164837
2086         <rdar://problem/29297727>
2087
2088         Reviewed by Jer Noble.
2089
2090         No new tests, the real capture devices can not be used in layout tests.
2091
2092         * WebCore.xcodeproj/project.pbxproj:
2093         
2094         Drive-by fix: clear m_settingMediaStreamSrcObject when the media player is destroyed unless
2095         that happens as a side effect of setting video.srcObject.
2096         * html/HTMLMediaElement.cpp:
2097         (WebCore::HTMLMediaElement::setSrcObject):
2098         (WebCore::HTMLMediaElement::clearMediaPlayer):
2099         * html/HTMLMediaElement.h:
2100
2101         Add support for realtime media source that vend a preview interface, while keeping support
2102         for those that do not (e.g. the mock capture devices).
2103         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h:
2104         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
2105         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::MediaPlayerPrivateMediaStreamAVFObjC):
2106         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::isAvailable):
2107         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::enqueueVideoSampleBuffer):
2108         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::prepareVideoSampleBufferFromTrack):
2109         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::ensureLayer):
2110         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::destroyLayer):
2111         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::platformLayer):
2112         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::currentDisplayMode):
2113         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::play):
2114         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::pause):
2115         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::internalSetVolume):
2116         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updateTracks):
2117
2118         * platform/mediastream/MediaStreamPrivate.cpp:
2119         (WebCore::MediaStreamPrivate::platformLayer): Deleted, no longer used.
2120         * platform/mediastream/MediaStreamPrivate.h:
2121
2122         Enable/disable the preview when available.
2123         * platform/mediastream/MediaStreamTrackPrivate.cpp:
2124         (WebCore::MediaStreamTrackPrivate::setEnabled):
2125         (WebCore::MediaStreamTrackPrivate::endTrack):
2126         (WebCore::MediaStreamTrackPrivate::preview):
2127         * platform/mediastream/MediaStreamTrackPrivate.h:
2128
2129         * platform/mediastream/RealtimeMediaSource.h:
2130         (WebCore::RealtimeMediaSource::preview):
2131         (WebCore::RealtimeMediaSource::createWeakPtr):
2132         (WebCore::RealtimeMediaSource::platformLayer): Deleted.
2133
2134         Define a realtime media source preview interface.
2135         * platform/mediastream/RealtimeMediaSourcePreview.h: Added.
2136         (WebCore::RealtimeMediaSourcePreview::~RealtimeMediaSourcePreview):
2137         (WebCore::RealtimeMediaSourcePreview::invalidate):
2138         (WebCore::RealtimeMediaSourcePreview::createWeakPtr):
2139         (WebCore::RealtimeMediaSourcePreview::RealtimeMediaSourcePreview):
2140
2141         Implement the preview interface.
2142         * platform/mediastream/mac/AVAudioCaptureSource.h:
2143         * platform/mediastream/mac/AVAudioCaptureSource.mm:
2144         (WebCore::AVAudioSourcePreview::create):
2145         (WebCore::AVAudioSourcePreview::AVAudioSourcePreview):
2146         (WebCore::AVAudioSourcePreview::invalidate):
2147         (WebCore::AVAudioSourcePreview::play):
2148         (WebCore::AVAudioSourcePreview::pause):
2149         (WebCore::AVAudioSourcePreview::setEnabled):
2150         (WebCore::AVAudioSourcePreview::setVolume):
2151         (WebCore::AVAudioSourcePreview::updateState):
2152         (WebCore::AVAudioCaptureSource::createPreview):
2153         * platform/mediastream/mac/AVMediaCaptureSource.h:
2154         (WebCore::AVMediaCaptureSource::createWeakPtr):
2155         * platform/mediastream/mac/AVMediaCaptureSource.mm:
2156         (WebCore::AVMediaCaptureSource::AVMediaCaptureSource):
2157         (WebCore::AVMediaCaptureSource::reset):
2158         (WebCore::AVMediaCaptureSource::preview):
2159         (WebCore::AVMediaCaptureSource::removePreview):
2160         (WebCore::AVMediaSourcePreview::AVMediaSourcePreview):
2161         (WebCore::AVMediaSourcePreview::~AVMediaSourcePreview):
2162         (WebCore::AVMediaSourcePreview::invalidate):
2163         * platform/mediastream/mac/AVVideoCaptureSource.h:
2164         * platform/mediastream/mac/AVVideoCaptureSource.mm:
2165         (WebCore::AVVideoSourcePreview::create):
2166         (WebCore::AVVideoSourcePreview::AVVideoSourcePreview):
2167         (WebCore::AVVideoSourcePreview::invalidate):
2168         (WebCore::AVVideoSourcePreview::play):
2169         (WebCore::AVVideoSourcePreview::pause):
2170         (WebCore::AVVideoSourcePreview::setPaused):
2171         (WebCore::AVVideoSourcePreview::setEnabled):
2172         (WebCore::AVVideoCaptureSource::shutdownCaptureSession):
2173         (WebCore::AVVideoCaptureSource::processNewFrame):
2174         (WebCore::AVVideoCaptureSource::createPreview):
2175         (WebCore::AVVideoCaptureSource::platformLayer): Deleted.
2176
2177         * platform/mediastream/mac/MockRealtimeVideoSourceMac.h:
2178         * platform/mediastream/mac/MockRealtimeVideoSourceMac.mm:
2179         (WebCore::MockRealtimeVideoSourceMac::platformLayer): Deleted.
2180         (WebCore::MockRealtimeVideoSourceMac::updatePlatformLayer): Deleted.
2181         * platform/mock/MockRealtimeVideoSource.cpp:
2182         (WebCore::MockRealtimeVideoSource::applyFrameRate):
2183         (WebCore::MockRealtimeVideoSource::applySize):
2184         (WebCore::MockRealtimeVideoSource::generateFrame):
2185         * platform/mock/MockRealtimeVideoSource.h:
2186         (WebCore::MockRealtimeVideoSource::updatePlatformLayer): Deleted.
2187
2188 2016-11-17  Chris Dumez  <cdumez@apple.com>
2189
2190         Unreviewed, fix build after r208839.
2191
2192         * dom/Node.h:
2193         (WebCore::Node::isDescendantOf):
2194
2195 2016-11-16  Dave Hyatt  <hyatt@apple.com>
2196
2197         [CSS Parser] Add @supports, @keyframe and media query parsing options
2198         https://bugs.webkit.org/show_bug.cgi?id=164821
2199
2200         Reviewed by Sam Weinig and Zalan Bujtas.
2201
2202         * css/CSSKeyframeRule.cpp:
2203         (WebCore::StyleKeyframe::setKeyText):
2204         * css/CSSKeyframeRule.h:
2205         * css/CSSKeyframesRule.cpp:
2206         (WebCore::StyleRuleKeyframes::findKeyframeIndex):
2207         Changed to call into CSSParserImpls implementation. The new parser
2208         is now always used when parsing the key list.
2209
2210         * css/MediaList.cpp:
2211         (WebCore::MediaQuerySet::create):
2212         (WebCore::MediaQuerySet::MediaQuerySet):
2213         (WebCore::MediaQuerySet::set):
2214         (WebCore::MediaQuerySet::add):
2215         (WebCore::MediaQuerySet::remove):
2216         (WebCore::MediaList::setMediaText):
2217         (WebCore::parseMediaDescriptor): Deleted.
2218         (WebCore::MediaQuerySet::internalParse): Deleted.
2219         (WebCore::MediaQuerySet::parse): Deleted.
2220         * css/MediaList.h:
2221         Rewritten to remove fallback descriptor support/parsing, since no other
2222         browser supports it, and this was part of our initial 2005 landing that
2223         nobody else appears to use.  Media queries now call into the new parser always.
2224
2225         * css/MediaQueryExp.cpp:
2226         (WebCore::featureWithValidDensity):
2227         (WebCore::featureWithPositiveNumber):
2228         (WebCore::MediaQueryExpression::MediaQueryExpression):
2229         Make sure to support transform2d, animation and transition.
2230
2231         * css/StyleMedia.cpp:
2232         (WebCore::StyleMedia::matchMedium):
2233         Call the normal create now that fallback descriptor syntax is gone.
2234
2235         * css/parser/CSSParser.cpp:
2236         (WebCore::CSSParser::parseKeyframeRule):
2237         (WebCore::CSSParser::parseSupportsCondition):
2238         (WebCore::CSSParser::parseInlineStyleDeclaration):
2239         (WebCore::CSSParser::parseDeclarationDeprecated):
2240         (WebCore::CSSParser::parseDeclaration):
2241         (WebCore::CSSParser::parseKeyframeKeyList):
2242         (WebCore::CSSParser::parseMediaQuery): Deleted.
2243         (WebCore::CSSParser::parseKeyframeSelector): Deleted.
2244         * css/parser/CSSParser.h:
2245         Patched the old parser to have flags to call into the new parser
2246         for supports conditions and keyframes. Rename the parseDeclaration that
2247         is only used by the old parser to have the word Deprecated in it. Removed
2248         the media query and key list parsing functions, since the new parser
2249         now does it always.
2250
2251         * css/parser/CSSParserIdioms.cpp:
2252         (WebCore::convertToASCIILowercaseInPlace): Deleted.
2253         * css/parser/CSSParserIdioms.h:
2254         * css/parser/CSSParserToken.cpp:
2255         (WebCore::convertToASCIILowercaseInPlace):
2256         (WebCore::CSSParserToken::convertToASCIILowercaseInPlace):
2257         * css/parser/CSSParserToken.h:
2258         (WebCore::CSSParserToken::value):
2259         (WebCore::CSSParserToken::initValueFromStringView):
2260         * css/parser/CSSParserValues.cpp:
2261         (WebCore::CSSParserSelector::parsePseudoElementSelectorFromStringView):
2262         * css/parser/CSSPropertyParser.cpp:
2263         (WebCore::consumeAttr):
2264         * css/parser/CSSSelectorParser.cpp:
2265         (WebCore::CSSSelectorParser::consumeId):
2266         (WebCore::CSSSelectorParser::consumeClass):
2267         (WebCore::CSSSelectorParser::consumePseudo):
2268         Moving convertToASCIILowercase to be a CSSParserToken member function instead
2269         of operating on StringView. This saves an extra step, since the token itself
2270         already had all the correct members. Note that converting in-place is bad,
2271         and we'll be removing it once the new parser turns on.
2272
2273         * css/parser/MediaQueryParser.cpp:
2274         (WebCore::MediaQueryParser::readMediaType):
2275         (WebCore::MediaQueryParser::readFeature):
2276         (WebCore::MediaQueryParser::readFeatureEnd):
2277         Require the closing ")" on features. Fix the in-place lowercasing to only
2278         be done for features, not for types. This matches the old parser.
2279
2280         * dom/DOMImplementation.cpp:
2281         (WebCore::DOMImplementation::createCSSStyleSheet):
2282         * dom/InlineStyleSheetOwner.cpp:
2283         (WebCore::InlineStyleSheetOwner::createSheet):
2284         * html/HTMLLinkElement.cpp:
2285         (WebCore::HTMLLinkElement::process):
2286         (WebCore::HTMLLinkElement::initializeStyleSheet):
2287         * html/HTMLSourceElement.cpp:
2288         (WebCore::HTMLSourceElement::parseAttribute):
2289         * html/HTMLStyleElement.cpp:
2290         (WebCore::HTMLStyleElement::parseAttribute):
2291         * html/parser/HTMLPreloadScanner.cpp:
2292         (WebCore::TokenPreloadScanner::StartTagScanner::processAttribute):
2293         * html/parser/HTMLResourcePreloader.cpp:
2294         (WebCore::mediaAttributeMatches):
2295         Patched to call the normal MediaQuerySet::create and not the one that had fallback
2296         descriptor support.
2297
2298 2016-11-17  Yusuke Suzuki  <utatane.tea@gmail.com>
2299
2300         Unreviewed, attempt to fix link error after r208841 part2
2301
2302         Use static_cast to avoid referencing static storage.
2303
2304         * storage/StorageMap.cpp:
2305         (WebCore::StorageMap::setItemIgnoringQuota):
2306
2307 2016-11-17  Yusuke Suzuki  <utatane.tea@gmail.com>
2308
2309         Unreviewed, attempt to fix link error after r208841
2310
2311         * storage/StorageMap.h:
2312
2313 2016-11-17  Saam Barati  <sbarati@apple.com>
2314
2315         Remove async/await compile time flag and enable tests
2316         https://bugs.webkit.org/show_bug.cgi?id=164828
2317         <rdar://problem/28639334>
2318
2319         Reviewed by Yusuke Suzuki.
2320
2321         * Configurations/FeatureDefines.xcconfig:
2322
2323 2016-11-17  Yusuke Suzuki  <utatane.tea@gmail.com>
2324
2325         [JSC] WTF::TemporaryChange with WTF::SetForScope
2326         https://bugs.webkit.org/show_bug.cgi?id=164761
2327
2328         Reviewed by Saam Barati.
2329
2330         No behavior change.
2331
2332         * Modules/indexeddb/server/MemoryBackingStoreTransaction.cpp:
2333         (WebCore::IDBServer::MemoryBackingStoreTransaction::abort):
2334         * bindings/js/JSCustomElementRegistryCustom.cpp:
2335         (WebCore::JSCustomElementRegistry::define):
2336         * bindings/js/ScriptController.cpp:
2337         (WebCore::ScriptController::evaluateModule):
2338         * css/ElementRuleCollector.cpp:
2339         (WebCore::ElementRuleCollector::matchSlottedPseudoElementRules):
2340         * css/StyleResolver.cpp:
2341         * css/parser/CSSParser.cpp:
2342         (WebCore::CSSParser::parseFillShorthand):
2343         (WebCore::CSSParser::parseShorthand):
2344         (WebCore::CSSParser::parse4Values):
2345         (WebCore::CSSParser::parseBorderRadius):
2346         * css/parser/SVGCSSParser.cpp:
2347         (WebCore::CSSParser::parseSVGValue):
2348         * dom/CustomElementRegistry.h:
2349         * dom/Document.cpp:
2350         (WebCore::Document::recalcStyle):
2351         (WebCore::Document::styleForElementIgnoringPendingStylesheets):
2352         (WebCore::Document::destroyRenderTree):
2353         * dom/EventTarget.cpp:
2354         (WebCore::EventTarget::fireEventListeners):
2355         * dom/Microtasks.cpp:
2356         (WebCore::MicrotaskQueue::performMicrotaskCheckpoint):
2357         * history/PageCache.cpp:
2358         (WebCore::PageCache::pruneToSizeNow):
2359         * html/DOMTokenList.cpp:
2360         (WebCore::DOMTokenList::updateAssociatedAttributeFromTokens):
2361         * html/parser/CSSPreloadScanner.cpp:
2362         (WebCore::CSSPreloadScanner::scan):
2363         * html/parser/HTMLConstructionSite.h:
2364         * loader/ContentFilter.cpp:
2365         (WebCore::ContentFilter::handleProvisionalLoadFailure):
2366         * loader/SubresourceLoader.cpp:
2367         * loader/cache/MemoryCache.cpp:
2368         (WebCore::MemoryCache::pruneLiveResourcesToSize):
2369         (WebCore::MemoryCache::pruneDeadResourcesToSize):
2370         * page/Chrome.cpp:
2371         (WebCore::Chrome::runModal):
2372         * page/FrameView.cpp:
2373         (WebCore::FrameView::layout):
2374         (WebCore::FrameView::setScrollPosition):
2375         (WebCore::FrameView::applyRecursivelyWithVisibleRect):
2376         (WebCore::FrameView::autoSizeIfEnabled):
2377         * page/csp/ContentSecurityPolicy.cpp:
2378         (WebCore::ContentSecurityPolicy::didReceiveHeaders):
2379         * page/scrolling/ScrollingTree.cpp:
2380         (WebCore::ScrollingTree::commitTreeState):
2381         * platform/graphics/ca/GraphicsLayerCA.cpp:
2382         (WebCore::GraphicsLayerCA::commitLayerChangesBeforeSublayers):
2383         (WebCore::GraphicsLayerCA::commitLayerChangesAfterSublayers):
2384         * platform/graphics/opengl/TemporaryOpenGLSetting.h:
2385         * platform/graphics/texmap/TextureMapperGL.cpp:
2386         (WebCore::TextureMapperGL::drawTexture):
2387         * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
2388         (WebCore::CoordinatedGraphicsLayer::purgeBackingStores):
2389         * platform/graphics/win/GraphicsLayerDirect2D.cpp:
2390         * platform/gtk/PasteboardHelper.cpp:
2391         (WebCore::PasteboardHelper::writeClipboardContents):
2392         * platform/mac/ScrollbarThemeMac.mm:
2393         (WebCore::ScrollbarThemeMac::paint):
2394         * rendering/RenderBlock.cpp:
2395         * rendering/RenderGeometryMap.cpp:
2396         (WebCore::RenderGeometryMap::pushMappingsToAncestor):
2397         * rendering/RenderLayer.cpp:
2398         (WebCore::RenderLayer::updateLayerPositions):
2399         * rendering/RenderLayerCompositor.cpp:
2400         (WebCore::RenderLayerCompositor::updateCompositingLayers):
2401         * rendering/RenderView.cpp:
2402         (WebCore::RenderView::hitTest):
2403         * replay/EventLoopInputDispatcher.cpp:
2404         (WebCore::EventLoopInputDispatcher::dispatchInput):
2405         * storage/StorageMap.cpp:
2406         (WebCore::StorageMap::setItemIgnoringQuota):
2407         * svg/SVGPathBlender.cpp:
2408         (WebCore::SVGPathBlender::addAnimatedPath):
2409
2410 2016-11-16  Yusuke Suzuki  <utatane.tea@gmail.com>
2411
2412         [WebCore] Clean up script loading code in XML
2413         https://bugs.webkit.org/show_bug.cgi?id=161651
2414
2415         Reviewed by Ryosuke Niwa.
2416
2417         This patch cleans up XML document script handling by using PendingScript.
2418         Previously, we directly used CachedScript. But it is not good since we
2419         have PendingScript wrapper.
2420
2421         We also disable ES6 modules for non HTML document. While ES6 modules tag
2422         requires "defer" semantics, "defer" semantics is not implemented in non
2423         HTML documents. And ES6 module tag is only specified in whatwg HTML spec.
2424
2425         * dom/LoadableClassicScript.cpp:
2426         (WebCore::LoadableClassicScript::execute):
2427         * dom/ScriptElement.cpp:
2428         (WebCore::ScriptElement::determineScriptType):
2429         (WebCore::ScriptElement::prepareScript):
2430         (WebCore::ScriptElement::executeClassicScript):
2431         (WebCore::ScriptElement::executePendingScript):
2432         (WebCore::ScriptElement::executeScript): Deleted.
2433         (WebCore::ScriptElement::executeScriptForScriptRunner): Deleted.
2434         * dom/ScriptElement.h:
2435         * dom/ScriptRunner.cpp:
2436         (WebCore::ScriptRunner::timerFired):
2437         * html/parser/HTMLDocumentParser.cpp:
2438         * html/parser/HTMLScriptRunner.cpp:
2439         (WebCore::HTMLScriptRunner::executePendingScriptAndDispatchEvent):
2440         (WebCore::HTMLScriptRunner::runScript):
2441         * xml/parser/XMLDocumentParser.cpp:
2442         (WebCore::XMLDocumentParser::notifyFinished):
2443         * xml/parser/XMLDocumentParser.h:
2444         * xml/parser/XMLDocumentParserLibxml2.cpp:
2445         (WebCore::XMLDocumentParser::XMLDocumentParser):
2446         (WebCore::XMLDocumentParser::~XMLDocumentParser):
2447         (WebCore::XMLDocumentParser::endElementNs):
2448
2449 2016-11-16  Chris Dumez  <cdumez@apple.com>
2450
2451         Add Node::isDescendantOf() overload that takes in a reference
2452         https://bugs.webkit.org/show_bug.cgi?id=164854
2453
2454         Reviewed by Ryosuke Niwa.
2455
2456         Add Node::isDescendantOf() overload that takes in a reference as a lot
2457         of call sites have a reference or a pointer they know is not null.
2458
2459         No new tests, no Web-exposed behavior change.
2460
2461         * accessibility/AccessibilityObject.cpp:
2462         (WebCore::AccessibilityObject::press):
2463         * dom/Document.cpp:
2464         (WebCore::isNodeInSubtree):
2465         (WebCore::Document::removeFullScreenElementOfSubtree):
2466         (WebCore::Document::setAnimatingFullScreen):
2467         * dom/Node.cpp:
2468         (WebCore::Node::isDescendantOf):
2469         (WebCore::Node::isDescendantOrShadowDescendantOf):
2470         (WebCore::Node::contains):
2471         * dom/Node.h:
2472         (WebCore::Node::isDescendantOf):
2473         * dom/NodeIterator.cpp:
2474         (WebCore::NodeIterator::updateForNodeRemoval):
2475         * dom/SelectorQuery.cpp:
2476         (WebCore::SelectorDataList::executeFastPathForIdSelector):
2477         (WebCore::filterRootById):
2478         * dom/TypedElementDescendantIterator.h:
2479         (WebCore::TypedElementDescendantIteratorAdapter<ElementType>::beginAt):
2480         (WebCore::TypedElementDescendantIteratorAdapter<ElementType>::from):
2481         (WebCore::TypedElementDescendantConstIteratorAdapter<ElementType>::beginAt):
2482         (WebCore::TypedElementDescendantConstIteratorAdapter<ElementType>::from):
2483         * editing/ApplyStyleCommand.cpp:
2484         (WebCore::ApplyStyleCommand::applyRelativeFontStyleChange):
2485         (WebCore::ApplyStyleCommand::applyInlineStyleToNodeRange):
2486         * editing/BreakBlockquoteCommand.cpp:
2487         (WebCore::BreakBlockquoteCommand::doApply):
2488         * editing/CompositeEditCommand.cpp:
2489         (WebCore::CompositeEditCommand::cloneParagraphUnderNewElement):
2490         * editing/DeleteSelectionCommand.cpp:
2491         (WebCore::DeleteSelectionCommand::handleGeneralDelete):
2492         (WebCore::DeleteSelectionCommand::removePreviouslySelectedEmptyTableRows):
2493         (WebCore::DeleteSelectionCommand::doApply):
2494         * editing/EditingStyle.cpp:
2495         (WebCore::EditingStyle::textDirectionForSelection):
2496         * editing/FormatBlockCommand.cpp:
2497         (WebCore::FormatBlockCommand::formatRange):
2498         * editing/TextIterator.cpp:
2499         (WebCore::TextIterator::advance):
2500         * editing/VisiblePosition.cpp:
2501         (WebCore::VisiblePosition::honorEditingBoundaryAtOrBefore):
2502         (WebCore::VisiblePosition::honorEditingBoundaryAtOrAfter):
2503         * editing/htmlediting.cpp:
2504         (WebCore::firstEditablePositionAfterPositionInRoot):
2505         (WebCore::lastEditablePositionBeforePositionInRoot):
2506         (WebCore::selectionForParagraphIteration):
2507         * editing/markup.cpp:
2508         (WebCore::StyledMarkupAccumulator::traverseNodesForSerialization):
2509         * html/CachedHTMLCollection.h:
2510         (WebCore::traversalType>::namedItem):
2511         * html/HTMLFormElement.cpp:
2512         (WebCore::HTMLFormElement::formElementIndex):
2513         * html/canvas/CanvasRenderingContext2D.cpp:
2514         (WebCore::CanvasRenderingContext2D::drawFocusIfNeededInternal):
2515         * page/EventHandler.cpp:
2516         (WebCore::EventHandler::selectClosestContextualWordOrLinkFromMouseEvent):
2517         * svg/SVGSVGElement.cpp:
2518         (WebCore::SVGSVGElement::getElementById):
2519
2520 2016-11-16  Ryosuke Niwa  <rniwa@webkit.org>
2521
2522         Fix build on macOS Sierra when WEB_PLAYBACK_CONTROLS_MANAGER is enabled
2523         https://bugs.webkit.org/show_bug.cgi?id=164845
2524
2525         Reviewed by Dan Bernstein.
2526
2527         Revert r208833 and fix the build by declaring AVFunctionBarMediaSelectionOption and AVThumbnail in AVKitSPI.h
2528
2529         * platform/mac/WebPlaybackControlsManager.h:
2530         * platform/mac/WebPlaybackControlsManager.mm:
2531         (-[WebPlaybackControlsManager generateFunctionBarAudioAmplitudeSamples:completionHandler:]):
2532         * platform/mac/WebPlaybackSessionInterfaceMac.mm:
2533         (WebCore::WebPlaybackSessionInterfaceMac::seekableRangesChanged):
2534         (WebCore::WebPlaybackSessionInterfaceMac::audioMediaSelectionOptionsChanged):
2535         (WebCore::WebPlaybackSessionInterfaceMac::legibleMediaSelectionOptionsChanged):
2536         (WebCore::WebPlaybackSessionInterfaceMac::setPlayBackControlsManager):
2537         * platform/spi/cocoa/AVKitSPI.h:
2538
2539 2016-11-16  Ryosuke Niwa  <rniwa@webkit.org>
2540
2541         REGRESSION(r208082): 1% Speedometer regression on iOS
2542         https://bugs.webkit.org/show_bug.cgi?id=164852
2543
2544         Reviewed by Chris Dumez.
2545
2546         Temporarily disable CEReactions entirely to recover the regression in Speedometer since
2547         reverting r208082 wouldn't remove CEReactions from other DOM APIs and if r208082 was a regression,
2548         then they're likely causing a regression on Speedometer as well.
2549
2550         * dom/CustomElementReactionQueue.cpp:
2551         (WebCore::CustomElementReactionStack::ElementQueue::add): Removed the release assert added in r208785
2552         since reactions can be inserted into the backup queue while the queue is running.
2553         (WebCore::CustomElementReactionStack::ElementQueue::invokeAll): Ditto.
2554         * dom/CustomElementReactionQueue.h:
2555         (WebCore::CustomElementReactionStack::CustomElementReactionStack): Removed all the code so that this
2556         constructor would be optimized away by clang.
2557         (WebCore::CustomElementReactionStack::~CustomElementReactionStack): Ditto.
2558
2559 2016-11-16  Ryosuke Niwa  <rniwa@webkit.org>
2560
2561         Fix build on macOS Sierra when WEB_PLAYBACK_CONTROLS_MANAGER is enabled
2562         https://bugs.webkit.org/show_bug.cgi?id=164845
2563
2564         Reviewed by Wenson Hsieh.
2565
2566         Fix builds after r208802 by wrapping code inside USE(APPLE_INTERNAL_SDK).
2567
2568         * platform/mac/WebPlaybackControlsManager.h:
2569         * platform/mac/WebPlaybackControlsManager.mm:
2570         * platform/mac/WebPlaybackSessionInterfaceMac.mm:
2571         (WebCore::WebPlaybackSessionInterfaceMac::seekableRangesChanged):
2572         (WebCore::WebPlaybackSessionInterfaceMac::audioMediaSelectionOptionsChanged):
2573         (WebCore::WebPlaybackSessionInterfaceMac::legibleMediaSelectionOptionsChanged):
2574         (WebCore::WebPlaybackSessionInterfaceMac::setPlayBackControlsManager):
2575
2576 2016-11-16  Chris Dumez  <cdumez@apple.com>
2577
2578         ScriptExecutionContext::processMessagePortMessagesSoon() should only post task when necessary
2579         https://bugs.webkit.org/show_bug.cgi?id=164812
2580         <rdar://problem/29148465>
2581
2582         Reviewed by Geoffrey Garen.
2583
2584         ScriptExecutionContext::processMessagePortMessagesSoon() should only post task when necessary,
2585         meaning when there is not already one pending.
2586
2587         * dom/ScriptExecutionContext.cpp:
2588         (WebCore::ScriptExecutionContext::processMessagePortMessagesSoon):
2589         (WebCore::ScriptExecutionContext::dispatchMessagePortEvents):
2590         * dom/ScriptExecutionContext.h:
2591
2592 2016-11-16  Chris Dumez  <cdumez@apple.com>
2593
2594         Use more references in TreeScope / TreeScopeAdopter
2595         https://bugs.webkit.org/show_bug.cgi?id=164836
2596
2597         Reviewed by Ryosuke Niwa.
2598
2599         Use more references in TreeScope / TreeScopeAdopter and avoid some
2600         unnecessary null checks.
2601
2602         No new tests, no Web-exposed behavior change.
2603
2604         * dom/ContainerNode.cpp:
2605         (WebCore::ContainerNode::takeAllChildrenFrom):
2606         (WebCore::ContainerNode::insertBefore):
2607         (WebCore::ContainerNode::replaceChild):
2608         (WebCore::ContainerNode::removeBetween):
2609         (WebCore::ContainerNode::appendChildWithoutPreInsertionValidityCheck):
2610         (WebCore::ContainerNode::parserAppendChild):
2611         * dom/ContainerNodeAlgorithms.cpp:
2612         (WebCore::addChildNodesToDeletionQueue):
2613         * dom/Document.cpp:
2614         (WebCore::Document::adoptNode):
2615         (WebCore::Document::moveNodeIteratorsToNewDocument):
2616         * dom/Document.h:
2617         * dom/Element.cpp:
2618         (WebCore::Element::didMoveToNewDocument):
2619         (WebCore::Element::addShadowRoot):
2620         (WebCore::Element::removeShadowRoot):
2621         (WebCore::Element::setAttributeNode):
2622         (WebCore::Element::setAttributeNodeNS):
2623         (WebCore::Element::ensureAttr):
2624         * dom/Element.h:
2625         * dom/Node.cpp:
2626         (WebCore::Node::didMoveToNewDocument):
2627         * dom/Node.h:
2628         * dom/NodeRareData.h:
2629         (WebCore::NodeListsNodeData::adoptDocument):
2630         * dom/TreeScope.cpp:
2631         (WebCore::TreeScope::TreeScope):
2632         (WebCore::TreeScope::setParentTreeScope):
2633         (WebCore::TreeScope::adoptIfNeeded):
2634         * dom/TreeScope.h:
2635         (WebCore::TreeScope::documentScope):
2636         (WebCore::TreeScope::setDocumentScope):
2637         * dom/TreeScopeAdopter.cpp:
2638         (WebCore::TreeScopeAdopter::moveTreeToNewScope):
2639         (WebCore::TreeScopeAdopter::moveShadowTreeToNewDocument):
2640         (WebCore::TreeScopeAdopter::ensureDidMoveToNewDocumentWasCalled):
2641         (WebCore::TreeScopeAdopter::updateTreeScope):
2642         (WebCore::TreeScopeAdopter::moveNodeToNewDocument):
2643         * dom/TreeScopeAdopter.h:
2644         (WebCore::TreeScopeAdopter::ensureDidMoveToNewDocumentWasCalled):
2645         (WebCore::TreeScopeAdopter::TreeScopeAdopter):
2646         * html/FormAssociatedElement.cpp:
2647         (WebCore::FormAssociatedElement::didMoveToNewDocument):
2648         * html/FormAssociatedElement.h:
2649         * html/HTMLFieldSetElement.cpp:
2650         (WebCore::HTMLFieldSetElement::didMoveToNewDocument):
2651         * html/HTMLFieldSetElement.h:
2652         * html/HTMLFormControlElement.cpp:
2653         (WebCore::HTMLFormControlElement::didMoveToNewDocument):
2654         * html/HTMLFormControlElement.h:
2655         * html/HTMLFormElement.cpp:
2656         (WebCore::HTMLFormElement::didMoveToNewDocument):
2657         * html/HTMLFormElement.h:
2658         * html/HTMLImageElement.cpp:
2659         (WebCore::HTMLImageElement::didMoveToNewDocument):
2660         * html/HTMLImageElement.h:
2661         * html/HTMLInputElement.cpp:
2662         (WebCore::HTMLInputElement::didMoveToNewDocument):
2663         * html/HTMLInputElement.h:
2664         * html/HTMLMediaElement.cpp:
2665         (WebCore::HTMLMediaElement::didMoveToNewDocument):
2666         * html/HTMLMediaElement.h:
2667         * html/HTMLObjectElement.cpp:
2668         (WebCore::HTMLObjectElement::didMoveToNewDocument):
2669         * html/HTMLObjectElement.h:
2670         * html/HTMLPictureElement.cpp:
2671         (WebCore::HTMLPictureElement::didMoveToNewDocument):
2672         * html/HTMLPictureElement.h:
2673         * html/HTMLPlugInImageElement.cpp:
2674         (WebCore::HTMLPlugInImageElement::didMoveToNewDocument):
2675         * html/HTMLPlugInImageElement.h:
2676         * html/HTMLTemplateElement.cpp:
2677         (WebCore::HTMLTemplateElement::didMoveToNewDocument):
2678         * html/HTMLTemplateElement.h:
2679         * html/HTMLVideoElement.cpp:
2680         (WebCore::HTMLVideoElement::didMoveToNewDocument):
2681         * html/HTMLVideoElement.h:
2682         * html/ImageDocument.cpp:
2683         (WebCore::ImageDocumentElement::didMoveToNewDocument):
2684         * svg/SVGImageElement.cpp:
2685         (WebCore::SVGImageElement::didMoveToNewDocument):
2686         * svg/SVGImageElement.h:
2687         * svg/SVGSVGElement.cpp:
2688         (WebCore::SVGSVGElement::didMoveToNewDocument):
2689         * svg/SVGSVGElement.h:
2690
2691 2016-11-16  Jon Davis  <jond@apple.com>
2692
2693         Added Web App Manifest to the Feature Status page.
2694         https://bugs.webkit.org/show_bug.cgi?id=162675
2695         
2696         Reviewed by Timothy Hatcher.
2697
2698         * features.json:
2699
2700 2016-11-16  Chris Dumez  <cdumez@apple.com>
2701
2702         Use more references for Document::removeFocusedNodeOfSubtree()
2703         https://bugs.webkit.org/show_bug.cgi?id=164839
2704
2705         Reviewed by Andreas Kling.
2706
2707         Use more references for Document::removeFocusedNodeOfSubtree().
2708
2709         No new tests, no Web-exposed behavior change.
2710
2711         * dom/Document.cpp:
2712         (WebCore::isNodeInSubtree):
2713         (WebCore::Document::removeFocusedNodeOfSubtree):
2714         (WebCore::Document::nodeChildrenWillBeRemoved):
2715         (WebCore::Document::nodeWillBeRemoved):
2716         (WebCore::Document::removeFocusNavigationNodeOfSubtree):
2717         (WebCore::Document::removeFullScreenElementOfSubtree):
2718         * dom/Document.h:
2719         * dom/Element.cpp:
2720         (WebCore::Element::removeShadowRoot):
2721         * loader/FrameLoader.cpp:
2722         (WebCore::FrameLoader::clear):
2723
2724 2016-11-16  Brent Fulgham  <bfulgham@apple.com>
2725
2726         Clear track client when removing a track
2727         https://bugs.webkit.org/show_bug.cgi?id=164842
2728         <rdar://problem/29213621>
2729
2730         Reviewed by Eric Carlson.
2731
2732         Call 'clearClient' when removing a track from an HTMLMediaElement.
2733
2734         Test: media/track/audio-track-add-remove.html
2735               media/track/video-track-add-remove.html
2736
2737         * html/HTMLMediaElement.cpp:
2738         (WebCore::HTMLMediaElement::removeAudioTrack): Call 'clearClient'
2739         (WebCore::HTMLMediaElement::removeVideoTrack): Ditto.
2740
2741 2016-11-16  Yusuke Suzuki  <utatane.tea@gmail.com>
2742
2743         [ES6][WebCore] Change ES6_MODULES compile time flag to runtime flag
2744         https://bugs.webkit.org/show_bug.cgi?id=164827
2745
2746         Reviewed by Ryosuke Niwa.
2747
2748         Use Settings.in. And intentionally do not use RuntimeEnabledFeatures.
2749         According to the pointer lock's issue[1], we should use Settings.
2750
2751         [1]: https://bugs.webkit.org/show_bug.cgi?id=163801
2752
2753         * Configurations/FeatureDefines.xcconfig:
2754         * dom/ScriptElement.cpp:
2755         (WebCore::ScriptElement::determineScriptType):
2756         * html/parser/HTMLPreloadScanner.cpp:
2757         (WebCore::TokenPreloadScanner::StartTagScanner::processAttribute):
2758         * page/Settings.in:
2759         A bit unfortunate thing is that the setter is named `setEs6ModulesEnabled`
2760         if we use `es6ModulesEnabled` here.
2761
2762 2016-11-16  Chris Dumez  <cdumez@apple.com>
2763
2764         Unreviewed, remove outdated comment about using PassRefPtr.
2765
2766         * dom/ContainerNode.cpp:
2767         (WebCore::ContainerNode::parserAppendChild):
2768
2769 2016-11-16  Ryosuke Niwa  <rniwa@webkit.org>
2770
2771         slotchange event should bubble and dispatched once
2772         https://bugs.webkit.org/show_bug.cgi?id=164770
2773
2774         Reviewed by Antti Koivisto.
2775
2776         Updated our implementation of slotchange event to match the latest specification after:
2777         https://github.com/w3c/webcomponents/issues/571
2778         https://dom.spec.whatwg.org/#signal-a-slot-change
2779         The new behavior matches that of Google Chrome Canary.
2780
2781         In the latest specification, we no longer dispatch a separate event on ancestor slots.
2782         Instead, we fire a single slotchange event to which a new node is assigned or from which
2783         an existing assigned node is removed. This patch mostly removes the code that existed to
2784         locate ancestor slot elements, and makes the event bubble up by changing a single line in
2785         HTMLSlotElement::dispatchSlotChangeEvent.
2786
2787         Test: fast/shadow-dom/slotchange-event-bubbling.html
2788
2789         * dom/ShadowRoot.h:
2790         * dom/SlotAssignment.cpp:
2791         (WebCore::recursivelyFireSlotChangeEvent): Deleted.
2792         (WebCore::SlotAssignment::didChangeSlot): Removed ChangeType from the arguments since we
2793         no longer notify the ancestor slot elements.
2794         (WebCore::SlotAssignment::hostChildElementDidChange):
2795         * dom/SlotAssignment.h:
2796         (WebCore::ShadowRoot::didRemoveAllChildrenOfShadowHost):
2797         (WebCore::ShadowRoot::didChangeDefaultSlot):
2798         (WebCore::ShadowRoot::hostChildElementDidChangeSlotAttribute):
2799         (WebCore::ShadowRoot::innerSlotDidChange): Deleted.
2800         * html/HTMLDetailsElement.cpp:
2801         (WebCore::DetailsSlotAssignment::hostChildElementDidChange):
2802         * html/HTMLSlotElement.cpp:
2803         (WebCore::HTMLSlotElement::dispatchSlotChangeEvent): Make slotchange event bubble.
2804
2805 2016-11-16  Alex Christensen  <achristensen@webkit.org>
2806
2807         REGRESSION (r207162): [debug] loader/stateobjects LayoutTests timing out
2808         https://bugs.webkit.org/show_bug.cgi?id=163307
2809
2810         Reviewed by Alexey Proskuryakov.
2811
2812         * platform/URLParser.cpp:
2813         Removed some unnecessary and redundant assertions in iterators, which are inside inner loops.
2814         (WebCore::URLParser::parsedDataView):
2815         (WebCore::URLParser::parse):
2816         Add a parsedDataView that just returns a UChar instead of a StringView for 1-length views.
2817         This speeds up debug builds considerably, which spent most of the time parsing the path
2818         making and destroying these 1-length StringViews.  It can't hurt release builds.
2819         * platform/URLParser.h:
2820
2821 2016-11-16  Chris Dumez  <cdumez@apple.com>
2822
2823         Micro-optimize ContainerNode::removeBetween()
2824         https://bugs.webkit.org/show_bug.cgi?id=164832
2825
2826         Reviewed by Sam Weinig.
2827
2828         Micro-optimize ContainerNode::removeBetween() by updating pointers only
2829         when strictly needed and reducing branching.
2830
2831         No new tests, no Web-exposed behavior change.
2832
2833         * dom/ContainerNode.cpp:
2834         (WebCore::ContainerNode::removeBetween):
2835
2836 2016-11-16  Chris Dumez  <cdumez@apple.com>
2837
2838         Micro-optimize AtomicHTMLToken::initializeAttributes()
2839         https://bugs.webkit.org/show_bug.cgi?id=164826
2840
2841         Reviewed by Sam Weinig.
2842
2843         Micro-optimize AtomicHTMLToken::initializeAttributes():
2844         - Use uncheckedAppend() instead of append() since we reserve capacity
2845           before the loop.
2846         - Use a more efficient findAttribute() that only checks the local names
2847           since this function only adds attributes that have to namespace or
2848           prefix.
2849
2850         No new tests, no Web-exposed behavior change.
2851
2852         * html/parser/AtomicHTMLToken.h:
2853         (WebCore::hasAttribute):
2854         (WebCore::AtomicHTMLToken::initializeAttributes):
2855
2856 2016-11-16  Beth Dakin  <bdakin@apple.com>
2857
2858         Another build fix.
2859
2860         * platform/mac/WebPlaybackSessionInterfaceMac.mm:
2861
2862 2016-11-16  Beth Dakin  <bdakin@apple.com>
2863
2864         Attempted build fix.
2865
2866         * platform/mac/WebPlaybackSessionInterfaceMac.mm:
2867         (WebCore::WebPlaybackSessionInterfaceMac::durationChanged):
2868         (WebCore::WebPlaybackSessionInterfaceMac::currentTimeChanged):
2869         (WebCore::WebPlaybackSessionInterfaceMac::rateChanged):
2870         (WebCore::WebPlaybackSessionInterfaceMac::beginScrubbing):
2871         (WebCore::WebPlaybackSessionInterfaceMac::seekableRangesChanged):
2872         (WebCore::WebPlaybackSessionInterfaceMac::audioMediaSelectionOptionsChanged):
2873         (WebCore::WebPlaybackSessionInterfaceMac::legibleMediaSelectionOptionsChanged):
2874         (WebCore::WebPlaybackSessionInterfaceMac::ensureControlsManager):
2875
2876 2016-11-16  Brady Eidson  <beidson@apple.com>
2877
2878         Re-indent some old headers.
2879
2880         Rubberstamped by Alex Christensen 
2881
2882         No new tests (No behavior change).
2883
2884         (Also #pragma once a few of them)
2885
2886         * loader/DocumentLoader.h:
2887         * loader/FrameLoaderClient.h:
2888         * page/Frame.h:
2889         * page/FrameTree.h:
2890         * page/PageGroup.h:
2891         * platform/Cursor.h:
2892
2893 2016-11-16  Darin Adler  <darin@apple.com>
2894
2895         REGRESSION (r208672): Crash in com.apple.WebCore: WebCore::DatabaseContext::stopDatabases + 34
2896         https://bugs.webkit.org/show_bug.cgi?id=164820
2897
2898         Reviewed by Sam Weinig.
2899
2900         Crash seen in existing regression tests; reliably reproducible in some test configurations.
2901
2902         * Modules/webdatabase/DatabaseContext.cpp:
2903         (WebCore::DatabaseContext::contextDestroyed): Call through to base class before calling
2904         stopDatabases, since that might cause this object to be deallocated.
2905         (WebCore::DatabaseContext::stopDatabases): Be sure not to clear the possibly-last reference
2906         to this database context until after all code that accesses data members, since it might
2907         cause this object to be deallocated.
2908
2909 2016-11-16  Beth Dakin  <bdakin@apple.com>
2910
2911         Implement WebPlaybackControlsManager
2912         https://bugs.webkit.org/show_bug.cgi?id=164789
2913         -and corresponding-
2914         rdar://problem/29275082
2915
2916         Reviewed by Dan Bernstein.
2917
2918         * platform/mac/WebPlaybackControlsManager.h:
2919         * platform/mac/WebPlaybackControlsManager.mm:
2920         (-[WebPlaybackControlsManager dealloc]):
2921         (-[WebPlaybackControlsManager cancelThumbnailAndAudioAmplitudeSampleGeneration]):
2922         (-[WebPlaybackControlsManager generateFunctionBarThumbnailsForTimes:size:completionHandler:]):
2923         (-[WebPlaybackControlsManager generateFunctionBarAudioAmplitudeSamples:completionHandler:]):
2924         (-[WebPlaybackControlsManager canBeginFunctionBarScrubbing]):
2925         (-[WebPlaybackControlsManager beginFunctionBarScrubbing]):
2926         (-[WebPlaybackControlsManager endFunctionBarScrubbing]):
2927         (-[WebPlaybackControlsManager audioFunctionBarMediaSelectionOptions]):
2928         (-[WebPlaybackControlsManager setAudioFunctionBarMediaSelectionOptions:]):
2929         (-[WebPlaybackControlsManager currentAudioFunctionBarMediaSelectionOption]):
2930         (-[WebPlaybackControlsManager setCurrentAudioFunctionBarMediaSelectionOption:]):
2931         (-[WebPlaybackControlsManager legibleFunctionBarMediaSelectionOptions]):
2932         (-[WebPlaybackControlsManager setLegibleFunctionBarMediaSelectionOptions:]):
2933         (-[WebPlaybackControlsManager currentLegibleFunctionBarMediaSelectionOption]):
2934         (-[WebPlaybackControlsManager setCurrentLegibleFunctionBarMediaSelectionOption:]):
2935         (mediaSelectionOptions):
2936         (-[WebPlaybackControlsManager setAudioMediaSelectionOptions:withSelectedIndex:]):
2937         (-[WebPlaybackControlsManager setLegibleMediaSelectionOptions:withSelectedIndex:]):
2938         (-[WebPlaybackControlsManager webPlaybackSessionInterfaceMac]):
2939         (-[WebPlaybackControlsManager setWebPlaybackSessionInterfaceMac:]):
2940         (-[WebPlaybackControlsManager togglePlayback]):
2941         (-[WebPlaybackControlsManager setPlaying:]):
2942         (-[WebPlaybackControlsManager isPlaying]):
2943         * platform/mac/WebPlaybackSessionInterfaceMac.h:
2944         * platform/mac/WebPlaybackSessionInterfaceMac.mm:
2945         (WebCore::WebPlaybackSessionInterfaceMac::durationChanged):
2946         (WebCore::WebPlaybackSessionInterfaceMac::currentTimeChanged):
2947         (WebCore::WebPlaybackSessionInterfaceMac::rateChanged):
2948         (WebCore::WebPlaybackSessionInterfaceMac::playBackControlsManager):
2949
2950 2016-11-16  Jiewen Tan  <jiewen_tan@apple.com>
2951
2952         Add more tests for SubtleCrypto::importKey and SubtleCrypto::exportKey
2953         https://bugs.webkit.org/show_bug.cgi?id=164815
2954         <rdar://problem/29281660>
2955
2956         Reviewed by Brent Fulgham.
2957
2958         Tests: crypto/subtle/aes-import-jwk-key-export-jwk-key.html
2959                crypto/subtle/aes-import-jwk-key-export-raw-key.html
2960                crypto/subtle/aes-import-raw-key-export-jwk-key.html
2961                crypto/subtle/aes-import-raw-key-export-raw-key.html
2962                crypto/subtle/hmac-import-jwk-key-export-jwk-key.html
2963                crypto/subtle/hmac-import-jwk-key-export-raw-key.html
2964                crypto/subtle/hmac-import-raw-key-export-jwk-key.html
2965                crypto/subtle/hmac-import-raw-key-export-raw-key.html
2966                crypto/subtle/rsa-import-jwk-key-export-jwk-key-private.html
2967                crypto/subtle/rsa-import-jwk-key-export-jwk-key-public.html
2968
2969         * crypto/mac/CryptoKeyRSAMac.cpp:
2970         (WebCore::CryptoKeyRSA::create):
2971         Add a comment.
2972
2973 2016-11-16  Antti Koivisto  <antti@apple.com>
2974
2975         Remove getMutableCachedPseudoStyle
2976         https://bugs.webkit.org/show_bug.cgi?id=164819
2977
2978         Reviewed by Zalan Bujtas.
2979
2980         It is only used by styleForFirstLetter.
2981
2982         * rendering/RenderBlock.cpp:
2983         (WebCore::styleForFirstLetter):
2984
2985             Clone the original style before mutations.
2986
2987         (WebCore::RenderBlock::updateFirstLetterStyle):
2988         (WebCore::RenderBlock::createFirstLetterRenderer):
2989
2990             Since we have a clone already just move it in place.
2991
2992         * rendering/RenderElement.cpp:
2993         (WebCore::RenderElement::getMutableCachedPseudoStyle): Deleted.
2994         * rendering/RenderElement.h:
2995
2996 2016-11-16  Romain Bellessort  <romain.bellessort@crf.canon.fr>
2997
2998         [Readable Streams API] Implement ReadableByteStreamController close()
2999         https://bugs.webkit.org/show_bug.cgi?id=164413
3000
3001         Reviewed by Darin Adler.
3002
3003         Implemented close() method of ReadableByteStreamController.
3004
3005         Updated test expectations for close() tests and added tests
3006         to ensure errors are thrown in various cases defined by spec.
3007
3008         * Modules/streams/ReadableByteStreamController.js:
3009         (close): Added.
3010         * Modules/streams/ReadableByteStreamInternals.js:
3011         (readableByteStreamControllerClose): Added.
3012         * bindings/js/WebCoreBuiltinNames.h: Added bytesFilled.
3013
3014 2016-11-16  Philippe Normand  <pnormand@igalia.com>
3015
3016         [GStreamer][GL] build broken when using gst-plugins-bad from git
3017         https://bugs.webkit.org/show_bug.cgi?id=164776
3018
3019         Reviewed by Xabier Rodriguez-Calvar.
3020
3021         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
3022         (WebCore::MediaPlayerPrivateGStreamerBase::requestGLContext): The
3023         GStreamer GL context GType was renamed, add an ifdef taking this
3024         into account.
3025
3026 2016-11-16  Yusuke Suzuki  <utatane.tea@gmail.com>
3027
3028         [ES6] Integrate ES6 Modules into WebCore
3029         https://bugs.webkit.org/show_bug.cgi?id=148897
3030
3031         Reviewed by Ryosuke Niwa.
3032
3033         This patch introduces ES6 Modules into WebCore. We integrate JSC's JSModuleLoader into WebCore.
3034         JSC constructs the module loader pipeline by the chains of the promises. To handle this,
3035         the following components are added.
3036
3037             1. CachedModuleScript
3038
3039                 CachedModuleScript wraps the promise based JSModuleLoader pipeline and offers
3040                 similar APIs to CachedScript. ScriptElement and PendingScript interact with
3041                 CachedModuleScript when the script tag is the module tag instead of CachedScript.
3042                 ScriptElement and PendingScript will receive the notification from
3043                 CachedModuleScript by implementing CachedModuleScriptClient.
3044
3045             2. ScriptModuleLoader
3046
3047                 This is the module loader instantiated per document. It manages fetching and
3048                 offers the callbacks for the JSC's JSModuleLoader implementation. ScriptModuleLoader
3049                 will fetch the resource by creating CachedModuleScriptLoader per resource. ScriptModuleLoader
3050                 will receive the notification by implementing CachedModuleScriptLoaderClient. When the
3051                 resource is fetched, the module loader will drive the promise resolve/reject chain.
3052
3053             3. CachedModuleScriptLoader
3054
3055                 This fetches the resource by using CachedScript. Using CachedScript means that it
3056                 automatically reports the resource to the inspector. CachedModuleScriptLoader notify to
3057                 ScriptModuleLoader when the resource is fetched.
3058
3059         One tricky point is that the fetch requests issued from one module-graph should share the same
3060         nonce, crossorigin attributes etc.
3061
3062             Here, we wrote the module graph like `A -> B (A depends on B)`.
3063
3064             <script tag> -> A -> B -> C -> D
3065
3066         When fetching A, B, C, and D modules, we need to set the same nonce, crossorigin etc. configuration
3067         derived from the original script tag. So per module-graph information should be shared throughout
3068         the module loader pipeline. To do so, JSC's module loader implementation can take the value called
3069         `initiator`. Since the loader will propagate & share this `initiator` throughout the pipeline,
3070         we can transfer and share some metadata. Currently, we pass the JSWrapper of the script tag as the
3071         initiator. Each fetch request is created by using this initiator script element.
3072
3073         More integration into the inspector should be done in the subsequent patch.
3074
3075         * CMakeLists.txt:
3076         * WebCore.xcodeproj/project.pbxproj:
3077         * bindings/js/CachedModuleScript.cpp: Added.
3078         CachedModuleScript offers similar interface to CachedScript to make ScriptElement things easier. It encapsulates the
3079         detail of the JSC JSModuleLoader that this module loader is driven by the chain of the promises. CachedModuleScript's
3080         callbacks are called from the promise's handlers configured in ScriptController::loadModuleScript.
3081         (WebCore::CachedModuleScript::create):
3082         (WebCore::CachedModuleScript::CachedModuleScript):
3083         (WebCore::CachedModuleScript::load):
3084         (WebCore::CachedModuleScript::notifyLoadCompleted):
3085         (WebCore::CachedModuleScript::notifyLoadFailed):
3086         (WebCore::CachedModuleScript::notifyLoadWasCanceled):
3087         (WebCore::CachedModuleScript::notifyClientFinished):
3088         (WebCore::CachedModuleScript::addClient):
3089         (WebCore::CachedModuleScript::removeClient):
3090         * bindings/js/CachedModuleScript.h: Added.
3091         (WebCore::CachedModuleScript::moduleKey):
3092         (WebCore::CachedModuleScript::error):
3093         (WebCore::CachedModuleScript::wasCanceled):
3094         (WebCore::CachedModuleScript::isLoaded):
3095         (WebCore::CachedModuleScript::nonce):
3096         (WebCore::CachedModuleScript::crossOriginMode):
3097         Save nonce and crossorigin attributes when we start ScriptElement::prepareScript.
3098         * bindings/js/CachedModuleScriptClient.h: Copied from Source/WebCore/dom/LoadableScript.h.
3099         (WebCore::CachedModuleScriptClient::~CachedModuleScriptClient):
3100         * bindings/js/CachedModuleScriptLoader.cpp: Added.
3101         CachedModuleScriptLoader is responsible to fetching the resource for the module script. It uses propagated `initiator`
3102         to create the request. This initiator is the JS wrapper of the script element issuing this fetching request. The name
3103         `initiator` is derived from the request.setInitiator(). Once the resource is fetched, the fetcher will notify to the
3104         client. Currently, ScriptModuleLoader implements this client interface.
3105         (WebCore::CachedModuleScriptLoader::create):
3106         (WebCore::CachedModuleScriptLoader::CachedModuleScriptLoader):
3107         (WebCore::CachedModuleScriptLoader::~CachedModuleScriptLoader):
3108         (WebCore::CachedModuleScriptLoader::load):
3109         Create the request. We call ScriptElement::requestCachedScript to initiate a new fetching request. At that time,
3110         nonce and crossorigin (and charset) attributes of this element are applied to the new request.
3111         (WebCore::CachedModuleScriptLoader::notifyFinished):
3112         * bindings/js/CachedModuleScriptLoader.h: Copied from Source/WebCore/bindings/js/ScriptModuleLoader.h.
3113         * bindings/js/CachedModuleScriptLoaderClient.h: Copied from Source/WebCore/dom/LoadableScript.h.
3114         (WebCore::CachedModuleScriptLoaderClient::~CachedModuleScriptLoaderClient):
3115         * bindings/js/CachedScriptSourceProvider.h:
3116         (WebCore::CachedScriptSourceProvider::create):
3117         (WebCore::CachedScriptSourceProvider::CachedScriptSourceProvider):
3118         (WebCore::makeSource):
3119         * bindings/js/JSBindingsAllInOne.cpp:
3120         * bindings/js/JSDOMBinding.cpp:
3121         (WebCore::retrieveErrorMessage):
3122         (WebCore::reportException):
3123         * bindings/js/JSDOMBinding.h:
3124         * bindings/js/JSMainThreadExecState.h:
3125         (WebCore::JSMainThreadExecState::loadModule):
3126         (WebCore::JSMainThreadExecState::linkAndEvaluateModule):
3127         * bindings/js/ScriptController.cpp:
3128         (WebCore::ScriptController::evaluateInWorld):
3129         (WebCore::ScriptController::loadModuleScriptInWorld):
3130         (WebCore::ScriptController::loadModuleScript):
3131         This just performs loading and not executing the module graph. Once the module graph is loaded, it is notified to
3132         the given CachedModuleScript.
3133         (WebCore::ScriptController::linkAndEvaluateModuleScriptInWorld):
3134         (WebCore::ScriptController::linkAndEvaluateModuleScript):
3135         This executes the linking and evaluation of the already instantiated module graph. After loading the module graph,
3136         we call this function for the module to evaluate it. This is called from ScriptElement::executeModuleScript.
3137         (WebCore::ScriptController::evaluateModule):
3138         Every time we evaluate the module, the ScriptModuleLoader::evaluate hook is called. So the loader calls this function
3139         to actually evaluate the module.
3140         (WebCore::jsValueToModuleKey):
3141         (WebCore::ScriptController::setupModuleScriptHandlers):
3142         The JSC's module loader is driven by the chain of the promise. So here, we convert this to CachedModuleScript /
3143         CachedModuleScriptClient style and encapsulate the details. This encapsulation makes CachedModuleScript similar
3144         to CachedScript and it makes things simple in the rest of WebCore. If the propagated error is already reported
3145         to the inspector, we receive moduleLoaderAlreadyReportedErrorSymbol as the error value. So at that case, we
3146         don't report it twice. If the rejection is caused due to the canceled fetching, moduleLoaderFetchingIsCanceledSymbol
3147         appears as the error value. In that case, we will call CachedModuleScript::notifyLoadWasCanceled.
3148         (WebCore::ScriptController::executeScript):
3149         * bindings/js/ScriptController.h:
3150         (WebCore::ScriptController::moduleLoaderAlreadyReportedErrorSymbol):
3151         (WebCore::ScriptController::moduleLoaderFetchingIsCanceledSymbol):
3152         * bindings/js/ScriptModuleLoader.cpp:
3153         We use DeferredWrapper to resolve promises used for the module pipeline. Thus, once the active DOM objects are
3154         suspended, the module loader propagation stops.
3155         (WebCore::ScriptModuleLoader::~ScriptModuleLoader):
3156         Clear the clients of the fetchers issued from this loader.
3157         (WebCore::isRootModule):
3158         (WebCore::ScriptModuleLoader::resolve):
3159         Resolve the module specifier (that is written in `import from "XXX"`) to the unique module key. We use URL
3160         string as module key. The edge case is that the module is inlined one. In that case, we don't have any URL
3161         for that. Instead of URL, we use symbol at that time.
3162         (WebCore::ScriptModuleLoader::fetch):
3163         Start fetching for the requested module. It returns the promise that is resolved when the fetching is done.
3164         The loader creates the fetcher, and the fetcher start loading the resource. Once the fetcher loads the resource,
3165         it notify to the loader through CachedModuleScriptLoaderClient interface. Since we pass the original script
3166         element as the `initiator` here, the fetcher can use this initiator to create the request. While the result of
3167         CachedResource has 3 variations (loaded, canceled, error occurred), Promise only tells us whether it is resolved
3168         or rejected. When CachedModuleScript gets the result from the promise chain, it needs to know which the result is.
3169         To transfer the canceled information, we reject the promise with the special symbol `moduleLoaderAlreadyReportedErrorSymbol`.
3170         This offers the way to distinguish the canceled error from the other errors.
3171         (WebCore::ScriptModuleLoader::evaluate):
3172         This is the hook function that is called when JSC's JSModuleLoader attempts to execute each module.
3173         (WebCore::ScriptModuleLoader::notifyFinished):
3174         This function is called when the fetcher completes. We will resolve the promise with the result of the fetching.
3175         The module loader pipeline is constructed as a chain of promises.
3176         Rejecting a promise when some error occurs is important because the execution flow of
3177         the promise chain is driven by "rejected" or "fulfilled" events.
3178         If the promise is not rejected while error occurs, reject handler won't be executed
3179         and all the subsequent promise chain will wait the result forever.
3180         As a result, even if the error is already reported to the inspector elsewhere,
3181         it should be propagated in the pipeline. For example, the error of loading
3182         CachedResource is already reported to the inspector by the loader. But we still need
3183         to reject the promise to propagate this error to the script element.
3184         At that time, we don't want to report the same error twice. When we propagate the error
3185         that is already reported to the inspector, we throw moduleLoaderAlreadyReportedErrorSymbol
3186         symbol instead. By comparing the thrown error with this symbol, we can distinguish errors raised
3187         when checking syntax of a module script from errors reported already.
3188         In the reject handler of the promise, we only report a error that is not this symbol.
3189         And mime type checking is done here since the module script always require this check.
3190         * bindings/js/ScriptModuleLoader.h:
3191         (WebCore::ScriptModuleLoader::document): Deleted.
3192         * bindings/js/ScriptSourceCode.h:
3193         (WebCore::ScriptSourceCode::ScriptSourceCode):
3194         * dom/CurrentScriptIncrementer.h:
3195         (WebCore::CurrentScriptIncrementer::CurrentScriptIncrementer):
3196         * dom/LoadableClassicScript.cpp:
3197         (WebCore::LoadableClassicScript::error):
3198         (WebCore::LoadableClassicScript::execute):
3199         (WebCore::LoadableClassicScript::wasErrored): Deleted.
3200         * dom/LoadableClassicScript.h:
3201         * dom/LoadableModuleScript.cpp: Copied from Source/WebCore/dom/LoadableScript.h.
3202         This is the derived class from LoadableScript. It is used for the script module graphs.
3203         (WebCore::LoadableModuleScript::create):
3204         (WebCore::LoadableModuleScript::LoadableModuleScript):
3205         (WebCore::LoadableModuleScript::~LoadableModuleScript):
3206         (WebCore::LoadableModuleScript::isLoaded):
3207         (WebCore::LoadableModuleScript::error):
3208         (WebCore::LoadableModuleScript::wasCanceled):
3209         (WebCore::LoadableModuleScript::notifyFinished):
3210         (WebCore::LoadableModuleScript::execute):
3211         * dom/LoadableModuleScript.h: Copied from Source/WebCore/dom/LoadableScript.h.
3212         (isType):
3213         * dom/LoadableScript.h:
3214         (WebCore::LoadableScript::isModuleScript):
3215         (WebCore::LoadableScript::isModuleGraph): Deleted.
3216         * dom/PendingScript.cpp:
3217         (WebCore::PendingScript::error):
3218         (WebCore::PendingScript::wasErrored): Deleted.
3219         * dom/PendingScript.h:
3220         * dom/ScriptElement.cpp:
3221         (WebCore::ScriptElement::ScriptElement):
3222         (WebCore::ScriptElement::determineScriptType):
3223         (WebCore::ScriptElement::prepareScript):
3224         prepareScript is aligned to whatwg spec: the last sequence to setup flags has one-on-one correspondence to
3225         the spec now. And prepareScript recognizes the type="module" case and call the requestModuleScript to setup
3226         the CachedModuleScript.
3227         (WebCore::ScriptElement::requestClassicScript):
3228         (WebCore::ScriptElement::requestModuleScript):
3229         We use the nonce and crossorigin attributes at the time of preparing the script tag. To do so, we store the
3230         above values in CachedModuleScript.
3231         Since inlined module scripts does not have "src" attribute, it is also affected by Content Security Policy's
3232         inline script rules.
3233         (WebCore::ScriptElement::requestScriptWithCacheForModuleScript):
3234         The module loader will construct the fetching request by calling this function. This should be here since we
3235         would like to set this Element to the initiator of the request. And nonce and crossorigin attributes of this
3236         script tag will be used.
3237         (WebCore::ScriptElement::requestScriptWithCache):
3238         (WebCore::ScriptElement::executeScript):
3239         (WebCore::ScriptElement::executeModuleScript):
3240         The entry point to execute the module graph. Since the module graph is beyond the multiple CachedScript code,
3241         we have the different entry point from ScriptElement::executeScript.
3242         (WebCore::ScriptElement::executeScriptAndDispatchEvent):
3243         (WebCore::ScriptElement::executeScriptForScriptRunner):
3244         * dom/ScriptElement.h:
3245         (WebCore::ScriptElement::scriptType):
3246         * html/parser/CSSPreloadScanner.cpp:
3247         (WebCore::CSSPreloadScanner::emitRule):
3248         * html/parser/HTMLPreloadScanner.cpp:
3249         (WebCore::TokenPreloadScanner::StartTagScanner::createPreloadRequest):
3250         According to the spec, the module tag ignores the "charset" attribute as the same to the worker's
3251         importScript. But WebKit supports the "charset" for importScript intentionally. So to be consistent,
3252         even for the module tags, we handle the "charset" attribute. We explicitly note about it in the preloader.
3253         (WebCore::TokenPreloadScanner::StartTagScanner::processAttribute):
3254         * html/parser/HTMLResourcePreloader.cpp:
3255         (WebCore::PreloadRequest::resourceRequest):
3256         * html/parser/HTMLResourcePreloader.h:
3257         (WebCore::PreloadRequest::PreloadRequest):
3258         * html/parser/HTMLScriptRunner.h:
3259         * loader/cache/CachedResourceRequest.cpp:
3260         (WebCore::CachedResourceRequest::setAsPotentiallyCrossOrigin):
3261         * xml/parser/XMLDocumentParser.cpp:
3262         (WebCore::XMLDocumentParser::notifyFinished):
3263
3264 2016-11-15  Alejandro G. Castro  <alex@igalia.com>
3265
3266         Warning added in r208542
3267         https://bugs.webkit.org/show_bug.cgi?id=164636
3268
3269         Reviewed by Eric Carlson.
3270
3271         Deleted the copy constructor, we now explicitly copy the object in
3272         the clone method.
3273
3274         * platform/mediastream/MediaStreamTrackPrivate.cpp: Delete the
3275         copy constructor.
3276         (WebCore::MediaStreamTrackPrivate::clone): Copy the relevant
3277         information for the clone operation in the API.
3278         * platform/mediastream/MediaStreamTrackPrivate.h: Delete the copy
3279         constructor.
3280
3281 2016-11-15  Ryosuke Niwa  <rniwa@webkit.org>
3282
3283         Add more assertions to ElementQueue diagnose a bug
3284         https://bugs.webkit.org/show_bug.cgi?id=164814
3285
3286         Reviewed by Yusuke Suzuki.
3287
3288         Add more assertions to check the sanity of the element queue.
3289         Also made them all release assertions so that we can catch them better.
3290
3291         * dom/CustomElementReactionQueue.cpp:
3292         (WebCore::CustomElementReactionStack::ElementQueue::add):
3293         (WebCore::CustomElementReactionStack::ElementQueue::invokeAll):
3294
3295 2016-11-15  Chris Dumez  <cdumez@apple.com>
3296
3297         Simplify Element::stripScriptingAttributes()
3298         https://bugs.webkit.org/show_bug.cgi?id=164785
3299
3300         Reviewed by Ryosuke Niwa.
3301
3302         Simplify Element::stripScriptingAttributes() by leveraging
3303         Vector::removeAllMatching().
3304
3305         No new tests, no Web-exposed behavior change.
3306
3307         * dom/Element.cpp:
3308         (WebCore::Element::stripScriptingAttributes):
3309
3310 2016-11-15  Jon Lee  <jonlee@apple.com>
3311
3312         Report active video and audio capture devices separately
3313         https://bugs.webkit.org/show_bug.cgi?id=164769
3314
3315         Reviewed by Eric Carlson.
3316
3317         For UI purposes, separate the notion of any active capture device to
3318         an active audio and video capture device.
3319
3320         * page/MediaProducer.h: Replace HasActiveMediaCaptureDevice with
3321         HasActiveAudioCaptureDevice and HasActiveVideoCaptureDevice.
3322
3323         * Modules/mediastream/MediaStream.cpp:
3324         (WebCore::MediaStream::mediaState): Update the logic for mediaState().
3325         Since it is possible to arbitrarily add tracks from various sources,
3326         check specifically for a local AV source (meaning a capture device) that
3327         is producing data.
3328         * platform/mediastream/MediaStreamPrivate.cpp:
3329         (WebCore::MediaStreamPrivate::hasLocalVideoSource): Iterate over the tracks
3330         and look for video sources that are not remote.
3331         (WebCore::MediaStreamPrivate::hasLocalAudioSource): Ditto for audio.
3332         * platform/mediastream/MediaStreamPrivate.h:
3333         * testing/Internals.cpp:
3334         (WebCore::Internals::pageMediaState): Update internals reporting.
3335
3336 2016-11-15  Chris Dumez  <cdumez@apple.com>
3337
3338         Avoid copying vector of attributes as much as possible in the HTML parser
3339         https://bugs.webkit.org/show_bug.cgi?id=164778
3340
3341         Reviewed by Ryosuke Niwa.
3342
3343         Avoid copying vector of attributes as much as possible in the HTML parser by moving
3344         AtomicHTMLToken around and making it obvious it is safe to move its attributes
3345         vector as well.
3346
3347         No new tests, no Web-exposed behavior change.
3348
3349         * html/parser/AtomicHTMLToken.h:
3350         (WebCore::AtomicHTMLToken::AtomicHTMLToken):
3351         (WebCore::findAttribute):
3352         * html/parser/HTMLConstructionSite.cpp:
3353         (WebCore::HTMLConstructionSite::insertHTMLHtmlStartTagBeforeHTML):
3354         (WebCore::HTMLConstructionSite::mergeAttributesFromTokenIntoElement):
3355         (WebCore::HTMLConstructionSite::insertHTMLHtmlStartTagInBody):
3356         (WebCore::HTMLConstructionSite::insertHTMLBodyStartTagInBody):
3357         (WebCore::HTMLConstructionSite::insertDoctype):
3358         (WebCore::HTMLConstructionSite::insertComment):
3359         (WebCore::HTMLConstructionSite::insertCommentOnDocument):
3360         (WebCore::HTMLConstructionSite::insertCommentOnHTMLHtmlElement):
3361         (WebCore::HTMLConstructionSite::insertHTMLHeadElement):
3362         (WebCore::HTMLConstructionSite::insertHTMLBodyElement):
3363         (WebCore::HTMLConstructionSite::insertHTMLFormElement):
3364         (WebCore::HTMLConstructionSite::insertHTMLElement):
3365         (WebCore::HTMLConstructionSite::insertHTMLElementOrFindCustomElementInterface):
3366         (WebCore::HTMLConstructionSite::insertSelfClosingHTMLElement):
3367         (WebCore::HTMLConstructionSite::insertFormattingElement):
3368         (WebCore::HTMLConstructionSite::insertScriptElement):
3369         (WebCore::HTMLConstructionSite::insertForeignElement):
3370         (WebCore::HTMLConstructionSite::createHTMLElementOrFindCustomElementInterface):
3371         (WebCore::HTMLConstructionSite::createElementFromSavedToken):
3372         * html/parser/HTMLConstructionSite.h:
3373         * html/parser/HTMLDocumentParser.cpp:
3374         (WebCore::HTMLDocumentParser::constructTreeFromHTMLToken):
3375         * html/parser/HTMLStackItem.h:
3376         (WebCore::HTMLStackItem::HTMLStackItem):
3377         (WebCore::HTMLStackItem::create):
3378         * html/parser/HTMLTreeBuilder.cpp:
3379         (WebCore::CustomElementConstructionData::CustomElementConstructionData):
3380         (WebCore::HTMLTreeBuilder::constructTree):
3381         (WebCore::HTMLTreeBuilder::processToken):
3382         (WebCore::HTMLTreeBuilder::processDoctypeToken):
3383         (WebCore::HTMLTreeBuilder::processFakeStartTag):
3384         (WebCore::HTMLTreeBuilder::processFakeEndTag):
3385         (WebCore::HTMLTreeBuilder::processFakePEndTagIfPInButtonScope):
3386         (WebCore::HTMLTreeBuilder::processCloseWhenNestedTag):
3387         (WebCore::HTMLTreeBuilder::processStartTagForInBody):
3388         (WebCore::HTMLTreeBuilder::insertGenericHTMLElement):
3389         (WebCore::HTMLTreeBuilder::processTemplateStartTag):
3390         (WebCore::HTMLTreeBuilder::processTemplateEndTag):
3391         (WebCore::HTMLTreeBuilder::processEndOfFileForInTemplateContents):
3392         (WebCore::HTMLTreeBuilder::processStartTagForInTable):
3393         (WebCore::HTMLTreeBuilder::processStartTag):