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