2748eddec6d04407cf439c57442ed158ccf18445
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2016-11-09  Alex Christensen  <achristensen@webkit.org>
2
3         Simplify logic of SecurityOrigin::databaseIdentifier
4         https://bugs.webkit.org/show_bug.cgi?id=164565
5
6         Reviewed by Brady Eidson.
7
8         No change in behavior.
9
10         SecurityOrigins with the file scheme need a special database identifier to be backwards-compatible with existing storage.
11         Instead of determining whether this is a file SecurityOrigin at parsing time and only using that information when
12         making the database identifier, just determine whether we need this quirk when making the database identifier.
13         I'm planning to move this logic to SecurityOriginData in another patch.
14
15         * page/SecurityOrigin.cpp:
16         (WebCore::SecurityOrigin::SecurityOrigin):
17         (WebCore::SecurityOrigin::create):
18         (WebCore::SecurityOrigin::databaseIdentifier):
19         * page/SecurityOrigin.h:
20
21 2016-11-09  Jaehun Lim  <ljaehun.lim@samsung.com>
22
23         Unreviewed, build fix after r208460
24
25         isValidColorString() was renamed isValidSimpleColorString().
26
27         * html/ColorInputType.cpp:
28         (WebCore::ColorInputType::suggestions):
29
30 2016-11-09  Anders Carlsson  <andersca@apple.com>
31
32         Fix STP build.
33
34         * WebCorePrefix.h:
35
36 2016-11-09  Simon Fraser  <simon.fraser@apple.com>
37
38         Implement visual-viewport based position:fixed handling for Mac async scrolling
39         https://bugs.webkit.org/show_bug.cgi?id=164495
40
41         Reviewed by Tim Horton.
42
43         Educate the scrolling tree about visual and layout viewports. This is runtime-switchable,
44         so we push the enable flag to via the root state node, then push the layout viewport,
45         and the min/max scroll position that contstrain it, through frame state nodes.
46
47         When a scroll happens, we compute a new layout viewport when the visual viewport hits
48         an edge, and push that down through setScrollLayerPosition() since it's used to position
49         fixed and sticky layers.
50
51         When the main thread gets notified about an async scroll, we set the new layout viewport
52         on the FrameView, but do so in such a way that does not trigger layout. This is OK because
53         we do a RenderLayer update which udpates all the layoutViewport-dependent state, and is
54         necessary to avoid repaints every main thread update.
55
56         The iOS code is made to compile, but not work yet.
57
58         Tests: compositing/tiling/visiblerect-accumulated-offset.html
59                fast/visual-viewport/tiled-drawing/zoomed-fixed-scrolled-down-then-up.html
60                fast/visual-viewport/tiled-drawing/zoomed-fixed-scrolled-down.html
61                fast/visual-viewport/tiled-drawing/zoomed-fixed-scrolling-layers-state.html
62
63         * page/FrameView.cpp:
64         (WebCore::FrameView::setLayoutViewportOrigin):
65         (WebCore::FrameView::updateLayoutViewport):
66         (WebCore::FrameView::visualViewportRect):
67         (WebCore::FrameView::unscaledMinimumScrollPosition):
68         (WebCore::FrameView::scrollPositionChanged):
69         * page/FrameView.h:
70         * page/scrolling/AsyncScrollingCoordinator.cpp:
71         (WebCore::AsyncScrollingCoordinator::frameViewLayoutUpdated):
72         (WebCore::AsyncScrollingCoordinator::requestScrollPositionUpdate):
73         (WebCore::AsyncScrollingCoordinator::scheduleUpdateScrollPositionAfterAsyncScroll):
74         (WebCore::AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScrollTimerFired):
75         (WebCore::AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScroll):
76         (WebCore::AsyncScrollingCoordinator::visualViewportEnabled):
77         * page/scrolling/AsyncScrollingCoordinator.h:
78         (WebCore::AsyncScrollingCoordinator::ScheduledScrollUpdate::ScheduledScrollUpdate):
79         * page/scrolling/ScrollingStateFrameScrollingNode.cpp:
80         (WebCore::ScrollingStateFrameScrollingNode::ScrollingStateFrameScrollingNode):
81         (WebCore::ScrollingStateFrameScrollingNode::setLayoutViewport):
82         (WebCore::ScrollingStateFrameScrollingNode::setMinLayoutViewportOrigin):
83         (WebCore::ScrollingStateFrameScrollingNode::setMaxLayoutViewportOrigin):
84         (WebCore::ScrollingStateFrameScrollingNode::setVisualViewportEnabled):
85         (WebCore::ScrollingStateFrameScrollingNode::dumpProperties):
86         * page/scrolling/ScrollingStateFrameScrollingNode.h:
87         * page/scrolling/ScrollingTree.cpp:
88         (WebCore::ScrollingTree::viewportChangedViaDelegatedScrolling):
89         (WebCore::ScrollingTree::scrollPositionChangedViaDelegatedScrolling):
90         (WebCore::ScrollingTree::commitTreeState):
91         * page/scrolling/ScrollingTree.h:
92         (WebCore::ScrollingTree::visualViewportEnabled):
93         (WebCore::ScrollingTree::setVisualViewportEnabled):
94         * page/scrolling/ScrollingTreeFrameScrollingNode.cpp:
95         (WebCore::ScrollingTreeFrameScrollingNode::commitStateBeforeChildren):
96         (WebCore::ScrollingTreeFrameScrollingNode::layoutViewportForScrollPosition):
97         * page/scrolling/ScrollingTreeFrameScrollingNode.h:
98         (WebCore::ScrollingTreeFrameScrollingNode::layoutViewport):
99         (WebCore::ScrollingTreeFrameScrollingNode::minLayoutViewportOrigin):
100         (WebCore::ScrollingTreeFrameScrollingNode::maxLayoutViewportOrigin):
101         * page/scrolling/ScrollingTreeScrollingNode.cpp:
102         (WebCore::ScrollingTreeScrollingNode::setScrollPositionWithoutContentEdgeConstraints):
103         * page/scrolling/ScrollingTreeScrollingNode.h:
104         * page/scrolling/ThreadedScrollingTree.cpp:
105         (WebCore::ThreadedScrollingTree::scrollingTreeNodeDidScroll):
106         * page/scrolling/ThreadedScrollingTree.h:
107         * page/scrolling/ios/ScrollingTreeFrameScrollingNodeIOS.h:
108         * page/scrolling/ios/ScrollingTreeFrameScrollingNodeIOS.mm:
109         (WebCore::ScrollingTreeFrameScrollingNodeIOS::setScrollPositionWithoutContentEdgeConstraints):
110         (WebCore::ScrollingTreeFrameScrollingNodeIOS::setScrollLayerPosition):
111         * page/scrolling/ios/ScrollingTreeIOS.cpp:
112         (WebCore::ScrollingTreeIOS::scrollingTreeNodeDidScroll):
113         * page/scrolling/ios/ScrollingTreeIOS.h:
114         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h:
115         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
116         (WebCore::ScrollingTreeFrameScrollingNodeMac::setScrollPositionWithoutContentEdgeConstraints):
117         (WebCore::ScrollingTreeFrameScrollingNodeMac::setScrollLayerPosition):
118
119 2016-11-09  Brady Eidson  <beidson@apple.com>
120
121         IndexedDB 2.0: W3C test IndexedDB/idbtransaction_objectStoreNames.html fails.
122         https://bugs.webkit.org/show_bug.cgi?id=164528
123
124         Reviewed by Alex Christensen.
125
126         No new tests (Covered by existing test).
127
128         * Modules/indexeddb/IDBDatabase.cpp:
129         (WebCore::IDBDatabase::transaction): De-dupe the input names.
130
131 2016-11-09  Brady Eidson  <beidson@apple.com>
132
133         IndexedDB 2.0: Implement new IDBCursor.continuePrimaryKey function.
134         https://bugs.webkit.org/show_bug.cgi?id=164404
135
136         Reviewed by Alex Christensen.
137
138         Tests: storage/indexeddb/modern/idbcursor-continue-primary-key-1-private.html
139                storage/indexeddb/modern/idbcursor-continue-primary-key-1.html
140                Also covered by existing tests.
141
142         * Modules/indexeddb/IDBCursor.cpp:
143         (WebCore::IDBCursor::continuePrimaryKey):
144         (WebCore::IDBCursor::uncheckedIterateCursor):
145         * Modules/indexeddb/IDBCursor.h:
146         * Modules/indexeddb/IDBCursor.idl:
147
148         * Modules/indexeddb/IDBKeyData.h:
149         (WebCore::IDBKeyData::operator>):
150         (WebCore::IDBKeyData::operator<=):
151         (WebCore::IDBKeyData::operator>=):
152
153         * Modules/indexeddb/server/MemoryCursor.h:
154
155         * Modules/indexeddb/server/MemoryIDBBackingStore.cpp:
156         (WebCore::IDBServer::MemoryIDBBackingStore::iterateCursor):
157
158         * Modules/indexeddb/server/MemoryIndexCursor.cpp:
159         (WebCore::IDBServer::MemoryIndexCursor::iterate):
160         * Modules/indexeddb/server/MemoryIndexCursor.h:
161
162         * Modules/indexeddb/server/MemoryObjectStoreCursor.cpp:
163         (WebCore::IDBServer::MemoryObjectStoreCursor::iterate):
164         * Modules/indexeddb/server/MemoryObjectStoreCursor.h:
165
166         * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
167         (WebCore::IDBServer::SQLiteIDBBackingStore::iterateCursor):
168
169         * Modules/indexeddb/server/SQLiteIDBCursor.cpp:
170         (WebCore::IDBServer::SQLiteIDBCursor::iterate):
171         * Modules/indexeddb/server/SQLiteIDBCursor.h:
172
173         * Modules/indexeddb/shared/IDBIterateCursorData.cpp:
174         (WebCore::IDBIterateCursorData::isolatedCopy):
175         * Modules/indexeddb/shared/IDBIterateCursorData.h:
176         (WebCore::IDBIterateCursorData::encode):
177         (WebCore::IDBIterateCursorData::decode):
178
179 2016-11-09  Antoine Quint  <graouts@apple.com>
180
181         [Modern Media Controls] Media Controller: set status label according to media state
182         https://bugs.webkit.org/show_bug.cgi?id=164557
183         <rdar://problem/29184097>
184
185         Reviewed by Dean Jackson.
186
187         Correctly set the StatusLabel text based on the media loading and network state.
188
189         Tests: http/tests/media/modern-media-controls/status-support/status-support-live-broadcast.html
190                http/tests/media/modern-media-controls/status-support/status-support-loading.html
191                media/modern-media-controls/status-support/status-support-error.html
192
193         * Modules/modern-media-controls/js-files:
194         * Modules/modern-media-controls/media/media-controller.js:
195         (MediaController):
196         * Modules/modern-media-controls/media/status-support.js: Added.
197         (StatusSupport.prototype.get control):
198         (StatusSupport.prototype.get mediaEvents):
199         (StatusSupport.prototype.syncControl):
200         (StatusSupport):
201         * WebCore.xcodeproj/project.pbxproj:
202
203 2016-11-09  Zalan Bujtas  <zalan@apple.com>
204
205         No need to set setFlowThreadState on RenderText in createTextRenderer.
206         https://bugs.webkit.org/show_bug.cgi?id=164559
207
208         Reviewed by Antti Koivisto.
209
210        setFlowThreadState in create*Renderer ensures that by the time we issue the initial call to
211        styleWillChange/styleDidChange through initializeStyle, the state is already set.
212        However since RenderText does not have its own style, it's sufficient to have the flow state set
213        through the normal RenderElement::insertChildInternal code path.
214
215         No change in functionality.
216
217         * style/RenderTreeUpdater.cpp:
218         (WebCore::createTextRenderer):
219
220 2016-11-09  Brady Eidson  <beidson@apple.com>
221
222         IndexedDB 2.0: Encapsulate cursor iteration parameters for easy future expansion.
223         https://bugs.webkit.org/show_bug.cgi?id=164504
224
225         Reviewed by Darin Adler.
226
227         No new tests (Refactor, no behavior change).
228
229         This patch literally just takes the "key" and "count" arguments and encapsulates them in a struct.
230         That struct will then be easily expandable in the future (e.g. bug 164404).
231
232         * Modules/indexeddb/IDBCursor.cpp:
233         (WebCore::IDBCursor::uncheckedIterateCursor):
234         
235         * Modules/indexeddb/IDBTransaction.cpp:
236         (WebCore::IDBTransaction::iterateCursor):
237         (WebCore::IDBTransaction::iterateCursorOnServer):
238         * Modules/indexeddb/IDBTransaction.h:
239         
240         * Modules/indexeddb/client/IDBConnectionProxy.cpp:
241         (WebCore::IDBClient::IDBConnectionProxy::iterateCursor):
242         * Modules/indexeddb/client/IDBConnectionProxy.h:
243         
244         * Modules/indexeddb/client/IDBConnectionToServer.cpp:
245         (WebCore::IDBClient::IDBConnectionToServer::iterateCursor):
246         * Modules/indexeddb/client/IDBConnectionToServer.h:
247         * Modules/indexeddb/client/IDBConnectionToServerDelegate.h:
248         
249         * Modules/indexeddb/server/IDBBackingStore.h:
250         
251         * Modules/indexeddb/server/IDBServer.cpp:
252         (WebCore::IDBServer::IDBServer::iterateCursor):
253         * Modules/indexeddb/server/IDBServer.h:
254         
255         * Modules/indexeddb/server/MemoryIDBBackingStore.cpp:
256         (WebCore::IDBServer::MemoryIDBBackingStore::iterateCursor):
257         * Modules/indexeddb/server/MemoryIDBBackingStore.h:
258         
259         * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
260         (WebCore::IDBServer::SQLiteIDBBackingStore::iterateCursor):
261         * Modules/indexeddb/server/SQLiteIDBBackingStore.h:
262         
263         * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
264         (WebCore::IDBServer::UniqueIDBDatabase::iterateCursor):
265         (WebCore::IDBServer::UniqueIDBDatabase::performIterateCursor):
266         * Modules/indexeddb/server/UniqueIDBDatabase.h:
267         
268         * Modules/indexeddb/server/UniqueIDBDatabaseTransaction.cpp:
269         (WebCore::IDBServer::UniqueIDBDatabaseTransaction::iterateCursor):
270         * Modules/indexeddb/server/UniqueIDBDatabaseTransaction.h:
271         
272         * Modules/indexeddb/shared/IDBIterateCursorData.cpp: Added.
273         (WebCore::IDBIterateCursorData::isolatedCopy):
274         * Modules/indexeddb/shared/IDBIterateCursorData.h: Added.
275         (WebCore::IDBIterateCursorData::encode):
276         (WebCore::IDBIterateCursorData::decode):
277
278         * Modules/indexeddb/shared/InProcessIDBServer.cpp:
279         (WebCore::InProcessIDBServer::iterateCursor):
280         * Modules/indexeddb/shared/InProcessIDBServer.h:
281
282         * CMakeLists.txt:
283         * WebCore.xcodeproj/project.pbxproj:
284
285 2016-11-09  Ryosuke Niwa  <rniwa@webkit.org>
286
287         StyledElement::attributeChanged shouldn't do any work when the attribute value didn't change
288         https://bugs.webkit.org/show_bug.cgi?id=129476
289
290         Reviewed by Andreas Kling.
291
292         Avoid calling styleAttributeChanged and setPresentationAttributeStyleIsDirty
293         when the attribute value didn't change as in r164856.
294
295         * dom/StyledElement.cpp:
296         (WebCore::StyledElement::attributeChanged):
297
298 2016-11-09  Yusuke Suzuki  <utatane.tea@gmail.com>
299
300         [DOMJIT] Implement Node::ownerDocument
301         https://bugs.webkit.org/show_bug.cgi?id=164004
302
303         Reviewed by Darin Adler.
304
305         Test: js/dom/domjit-accessor-owner-document.html
306
307         Still I cannot reproduce this crash in x64 environment, according to the crash log, it accesses 0x8 address.
308         This can happen if document() accidentally returns nullptr. In the C++ ownerDocument implementation,
309         if document() returns nullptr, it just returns nullptr. But in the DOMJIT implementation, we assume that
310         document() won't return nullptr and access the member of it.
311
312         This patch aligns the DOMJIT implementation strictly to the C++ one.
313
314         * dom/Node.idl:
315         * domjit/JSNodeDOMJIT.cpp:
316         (WebCore::NodeOwnerDocumentDOMJIT::checkDOM):
317         (WebCore::NodeOwnerDocumentDOMJIT::callDOMGetter):
318
319 2016-11-09  Sam Weinig  <sam@webkit.org>
320
321         [SVG] Start moving special casing of SVG out of the bindings - SVGAngle
322         https://bugs.webkit.org/show_bug.cgi?id=164496
323
324         Reviewed by Darin Adler.
325
326         There is quite a bit of special casing of SVG types in the bindings that adds
327         a lot of complexity and is relatively fragile, as it is based on type naming.
328
329         Instead of keeping the complexity in the bindings, I am going to move it into
330         the implementation, where it has also longed to be. 
331
332         Starting small, with just SVGAngle. It has been split in two, with the existing
333         SVGAngle being renamed SVGAngleValue, and the bound instance, which used to be name
334         SVGPropertyTearOff<SVGAngle>, taking the name SVGAngle (and inheriting from 
335         SVGPropertyTearOff<SVGAngleValue>).
336
337         * CMakeLists.txt:
338         * WebCore.xcodeproj/project.pbxproj:
339         Add SVGAngleValue.cpp
340
341         * bindings/scripts/CodeGenerator.pm:
342         Remove SVGAngle as a special case.
343
344         * svg/SVGAngle.cpp: Removed.
345         * svg/SVGAngle.h:
346         Added. Implements the SVGAngle interface explicitly, getting to
347         the SVGAngleValue through propertyReference().
348
349         * svg/SVGAngle.idl:
350         * svg/SVGAngleValue.cpp: Copied from Source/WebCore/svg/SVGAngle.cpp.
351         * svg/SVGAngleValue.h: Copied from Source/WebCore/svg/SVGAngle.h.
352         Move old SVGAngle implementation to SVGAngleValue.
353
354         * svg/SVGAnimatedAngle.cpp:
355         Replace SVGAngle usage with SVGAngleValue.
356
357         * svg/SVGAnimatedAngle.h:
358         Switch SVGAnimatedAngle to be a type alias. This remains SVGAnimatedPropertyTearOff<SVGAngle>
359         as SVGAnimatedPropertyTearOff has been changed to take the TearOff type as its parameter.
360
361         * svg/SVGAnimatedLength.h:
362         * svg/SVGAnimatedPreserveAspectRatio.h:
363         * svg/SVGAnimatedRect.h:
364         Switch to using type aliases and pass the TearOff to SVGAnimatedPropertyTearOff.
365
366         * svg/SVGAnimatedType.cpp:
367         (WebCore::SVGAnimatedType::createAngleAndEnumeration):
368         * svg/SVGAnimatedType.h:
369         (WebCore::SVGAnimatedType::angleAndEnumeration):
370         Use SVGAngleValue.
371
372         * svg/SVGComponentTransferFunctionElement.h:
373         Add missing include of SVGElement.h (need because it removed from SVGPropertyTearOff).
374
375         * svg/SVGMarkerElement.cpp:
376         (WebCore::SVGMarkerElement::parseAttribute):
377         (WebCore::SVGMarkerElement::setOrient):
378         Switch to take an SVGAngleValue.
379
380         (WebCore::SVGMarkerElement::setOrientToAngle):
381         Update to pull the value out via propertyReference().
382
383         * svg/SVGMarkerElement.h:
384         Switch to take an SVGAngleValue.
385
386         * svg/SVGLengthList.h:
387         * svg/SVGNumberList.h:
388         * svg/SVGPathSegList.h:
389         * svg/SVGPointList.h:
390         * svg/SVGStringList.h:
391         * svg/SVGTransformList.h:
392         Switch to using type aliases in SVGPropertyTraits and add an alias for
393         ListItemTearOff.
394
395         * svg/SVGSVGElement.cpp:
396         (WebCore::SVGSVGElement::createSVGAngle):
397         * svg/SVGSVGElement.h:
398         Change createSVGAngle to return a Ref<SVGAngle> and create one.
399
400         * svg/SVGSVGElement.idl:
401         Annotate IDL to indicate that a new value is being returned.
402
403         * svg/SVGTransform.cpp:
404         Remove unnecessary include of SVGAngle.h.
405
406         * svg/SVGViewSpec.cpp:
407         Add missing include of SVGElement.h (need because it removed from SVGPropertyTearOff).
408
409         * svg/properties/SVGAnimatedPropertyTearOff.h:
410         Change to be parameterized on the TearOffType, rather than the PropertyType itself. Get the
411         Property type from the TearOffType.
412
413         * svg/properties/SVGListProperty.h:
414         * svg/properties/SVGListPropertyTearOff.h:
415         Fix assumption that all TearOffTypes are just a SVGPropertyTearOff templatized on a property
416         type. This is no longer true for SVGAngle. Instead, get the TearOffType for lists via SVGPropertyTraits.
417
418         * svg/properties/SVGPropertyTearOff.h:
419         Make the PropertyType available by exposing it as a type alias.
420
421 2016-11-09  Darin Adler  <darin@apple.com>
422
423         Move Range from ExceptionCode to ExceptionOr
424         https://bugs.webkit.org/show_bug.cgi?id=164457
425
426         Reviewed by Alex Christensen.
427
428         * accessibility/AXObjectCache.cpp:
429         (WebCore::AXObjectCache::rangeForNodeContents): Update to use ExceptionOr,
430         keeping behavior the same.
431         (WebCore::characterOffsetsInOrder): Ditto.
432         (WebCore::setRangeStartOrEndWithCharacterOffset): Changed argument to a
433         reference instead of a pointer. Use a boolean return value to indicate
434         success rather than an exception, since the callers don't need to know
435         which exception it is.
436         (WebCore::AXObjectCache::rangeForUnorderedCharacterOffsets): Updated for
437         the above.
438         (WebCore::AXObjectCache::nextBoundary): Ditto.
439         (WebCore::AXObjectCache::previousBoundary): Ditto.
440
441         * accessibility/AccessibilityObject.cpp:
442         (WebCore::AccessibilityObject::rangeOfStringClosestToRangeInDirection):
443         Update to use ExceptionOr, keeping behavior the same.
444         * accessibility/AccessibilityRenderObject.cpp:
445         (WebCore::AccessibilityRenderObject::documentBasedSelectedTextRange): Ditto.
446         * accessibility/atk/WebKitAccessibleUtil.cpp:
447         (selectionBelongsToObject): Ditto.
448         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
449         (-[WebAccessibilityObjectWrapper _convertToNSRange:]): Ditto.
450         * dom/Node.cpp:
451         (WebCore::Node::textRects): Ditto.
452
453         * dom/Range.cpp:
454         (WebCore::Range::~Range): Remove old comment that no longer makes sense now
455         that the detach function no longer does anything.
456         (WebCore::checkForDifferentRootContainer): Updated to use ExceptionOr,
457         keeping behavior the same.
458         (WebCore::Range::setStart): Ditto.
459         (WebCore::Range::setEnd): Ditto.
460         (WebCore::Range::isPointInRange): Ditto.
461         (WebCore::Range::comparePoint): Ditto.
462         (WebCore::Range::compareNode): Ditto.
463         (WebCore::top): Added helper function so that compareBoundaryPoints doesn't
464         need to have two identical loops in it.
465         (WebCore::Range::compareBoundaryPoints): Updated to use ExceptionOr,
466         keeping behavior the same.
467         (WebCore::Range::compareBoundaryPointsForBindings): Ditto. Also use a switch
468         instead of relying on the order of the values to check for unsupported values.
469         (WebCore::Range::boundaryPointsValid): Ditto.
470         (WebCore::Range::deleteContents): Ditto.
471         (WebCore::Range::intersectsNode): Ditto.
472         (WebCore::Range::processContents): Ditto.
473         (WebCore::deleteCharacterData): Ditto.
474         (WebCore::processContentsBetweenOffsets): Ditto. Also changed to be a
475         non-member function and private to this file instead of in the class.
476         (WebCore::processNodes): Ditto. Also changed one argument to be a RefPtr
477         since the code relies on using it after mutating the DOM.
478         (WebCore::processAncestorsAndTheirSiblings): Ditto. Changed one argument type
479         to use ExceptionOr so the caller doesn't have to check the exception first.
480         (WebCore::Range::extractContents): Ditto.
481         (WebCore::Range::cloneContents): Ditto.
482         (WebCore::Range::insertNode): Ditto. Also fixed to only call nodeType once
483         instead of three times.
484         (WebCore::Range::toString): Ditto. Also fixed to call nodeType only once
485         per node instead of twice, to use downcast instead of static_cast, and to
486         use the word "node" instead of "n" for the local variable name.
487         (WebCore::Range::createContextualFragment): Ditto.
488         (WebCore::Range::checkNodeWOffset): Ditto.
489         (WebCore::Range::setStartAfter): Ditto.
490         (WebCore::Range::setEndBefore): Ditto.
491         (WebCore::Range::setEndAfter): Ditto.
492         (WebCore::Range::selectNode): Ditto.
493         (WebCore::Range::selectNodeContents): Ditto.
494         (WebCore::Range::surroundContents): Ditto.
495         (WebCore::Range::setStartBefore): Ditto.
496         (WebCore::Range::contains): Ditto. Except added code to handle exception
497         case to return false without asserting because I saw at least one crash
498         that seemed to imply this behavior was needed.
499         (WebCore::rangesOverlap): Ditto.
500         (WebCore::rangeOfContents): Ditto.
501         (WebCore::Range::expand): Ditto.
502         (WebCore::Range::getClientRects): Ditto.
503         (WebCore::Range::getBoundingClientRect): Ditto.
504         (WebCore::Range::borderAndTextQuads): Changed to use return value
505         instead of out argument, since it's a private function used only
506         within this class so it was easy to update all call sites.
507         (WebCore::Range::boundingRect): Updated for above. Also renamed since
508         there was no need for the name "internal" in this.
509         (WebCore::Range::absoluteBoundingRect): Ditto.
510         * dom/Range.h: Updated for above.
511         * dom/Range.idl: Use non-legacy exceptions. Also changed the default value
512         of the string argument to the expand function to the empty string rather
513         than "undefined", because the function silently does nothing when passed
514         any unrecognized string, and so this leaves behavior unchanged. I removed
515         the comment saying that the "undefined" default is wrong.
516
517         * editing/AlternativeTextController.cpp:
518         (WebCore::AlternativeTextController::applyAlternativeTextToRange): Updated
519         to use ExceptionOr but behave the same.
520         * editing/Editor.cpp:
521         (WebCore::Editor::advanceToNextMisspelling): Ditto.
522         (WebCore::Editor::markAndReplaceFor): Ditto.
523         (WebCore::isFrameInRange): Ditto. Also made a few style tweaks.
524         (WebCore::Editor::countMatchesForText): Ditto.
525         * editing/EditorCommand.cpp:
526         (WebCore::unionDOMRanges): Ditto.
527         * editing/FrameSelection.cpp:
528         (WebCore::FrameSelection::respondToNodeModification): Ditto.
529         * editing/InsertListCommand.cpp:
530         (WebCore::InsertListCommand::doApplyForSingleParagraph): Ditto.
531         * editing/TextCheckingHelper.cpp:
532         (WebCore::TextCheckingParagraph::offsetTo): Ditto.
533         * editing/TextCheckingHelper.h: Updated for above and also deleted
534         unneeded private function checkingRange, which just churned the
535         reference count unnecessarily; instead use m_checkingRange directly.
536         * editing/TextIterator.cpp:
537         (WebCore::TextIterator::getLocationAndLengthFromRange): Ditto.
538         * editing/VisiblePosition.cpp:
539         (WebCore::setStart): Ditto.
540         (WebCore::setEnd): Ditto.
541         * editing/VisibleSelection.cpp:
542         (WebCore::makeSearchRange): Ditto.
543
544         * editing/VisibleUnits.cpp:
545         (WebCore::suffixLengthForRange): Changed argument from RefPtr to
546         a reference.
547         (WebCore::prefixLengthForRange): Ditto.
548         (WebCore::previousBoundary): Updated for ExceptionOr and the change
549         above.
550         (WebCore::nextBoundary): Ditto.
551         * editing/VisibleUnits.h: Updated for above.
552
553         * editing/htmlediting.cpp:
554         (WebCore::comparePositions): Updated to use ExceptionOr but behave
555         the same.
556         (WebCore::visiblePositionForIndexUsingCharacterIterator): Ditto.
557         (WebCore::isNodeVisiblyContainedWithin): Ditto.
558         * editing/ios/EditorIOS.mm:
559         (WebCore::Editor::setDictationPhrasesAsChildOfElement): Ditto.
560         (WebCore::Editor::setTextAsChildOfElement): Ditto.
561         * editing/mac/EditorMac.mm:
562         (WebCore::Editor::adjustedSelectionRange): Ditto.
563         * editing/markup.cpp:
564         (WebCore::createMarkupInternal): Ditto.
565         * page/ContextMenuController.cpp:
566         (WebCore::ContextMenuController::contextMenuItemSelected): Ditto.
567         * page/DOMSelection.cpp:
568         (WebCore::DOMSelection::addRange): Ditto.
569         (WebCore::DOMSelection::deleteFromDocument): Ditto.
570         (WebCore::DOMSelection::containsNode): Ditto.
571
572         * page/EventHandler.cpp:
573         (WebCore::EventHandler::dispatchMouseEvent): Updated for change to
574         use ExceptionOr in Ragne::compareNode. Also refactored the function
575         to make the logic a little mroe straightforward and nest less of it
576         inside a loop.
577
578         * page/Page.cpp:
579         (WebCore::Page::findStringMatchingRanges): Updated for ExceptionOr
580         without changing behavior.
581         * page/TextIndicator.cpp:
582         (WebCore::hasNonInlineOrReplacedElements): Ditto.
583         * rendering/RenderNamedFlowThread.cpp:
584         (WebCore::RenderNamedFlowThread::getRanges): Ditto.
585
586 2016-11-09  Dave Hyatt  <hyatt@apple.com>
587
588         [CSS Parser] Fix grid layout parsing
589         https://bugs.webkit.org/show_bug.cgi?id=164489
590
591         Reviewed by Dean Jackson.
592
593         * css/CSSValueKeywords.in:
594         * css/parser/CSSPropertyParser.cpp:
595         (WebCore::consumeFitContent):
596         (WebCore::isGridTrackFixedSized):
597         (WebCore::consumeGridTrackSize):
598         (WebCore::consumeGridTrackRepeatFunction):
599         (WebCore::consumeGridTrackList):
600         (WebCore::isCustomIdentValue):
601         (WebCore::CSSPropertyParser::consumeGridItemPositionShorthand):
602         (WebCore::CSSPropertyParser::consumeGridAreaShorthand):
603         (WebCore::consumeImplicitGridAutoFlow):
604         (WebCore::CSSPropertyParser::consumeGridShorthand):
605
606 2016-11-09  Darin Adler  <darin@apple.com>
607
608         Move EventTarget from ExceptionCode to ExceptionOr
609         https://bugs.webkit.org/show_bug.cgi?id=164465
610
611         Reviewed by Youenn Fablet.
612
613         * Modules/indexeddb/IDBRequest.h: Added now-needed forward
614         class declarations.
615         * Modules/webaudio/AudioContext.h: Ditto.
616
617         * bindings/js/JSEventListener.cpp:
618         (WebCore::eventHandlerAttribute): Updated for name change of the
619         attributeEventListener function.
620         (WebCore::documentEventHandlerAttribute): Ditto.
621         * dom/Document.cpp:
622         (WebCore::Document::getWindowAttributeEventListener): Ditto.
623
624         * dom/EventTarget.cpp:
625         (WebCore::EventTarget::setAttributeEventListener): Updated for
626         name change.
627         (WebCore::EventTarget::attributeEventListener): Ditto.
628         (WebCore::EventTarget::dispatchEventForBindings): Use ExceptionOr.
629         (WebCore::legacyType): Use null instead of empty for no type, since
630         it's more efficient to check for null.
631         (WebCore::EventTarget::fireEventListeners): Check for null.
632         Also streamlined logic a little bit and removed a very old comment.
633         (WebCore::EventTarget::eventListeners): Renamed from getEventListeners.
634         * dom/EventTarget.h: Removed lots of unneeded declarations. Renamed
635         some functions to remove get prefix. Updated for above changes.
636         Moved one inline function out of the class header. Made the destructor
637         for EventTarget be inline to make the destructors for derived classes
638         slightly more efficient.
639         * dom/EventTarget.idl: Use non-legacy exception.
640
641         * dom/Node.cpp:
642         (WebCore::Node::didMoveToNewDocument): Updated for name change.
643         * editing/ReplaceSelectionCommand.cpp:
644         (WebCore::ReplacementFragment::ReplacementFragment): Ditto.
645
646         * inspector/InspectorCSSAgent.h: Added now-needed forward declaration.
647
648         * inspector/InspectorDOMAgent.cpp:
649         (WebCore::InspectorDOMAgent::getEventListeners): Updated for name change.
650
651         * inspector/InspectorInstrumentation.h: Added now-needed forward declaration.
652         * page/DOMWindow.h: Ditto.
653         * xml/XMLHttpRequest.h: Ditto.
654
655 2016-11-09  Daniel Bates  <dabates@apple.com>
656
657         Add test infrastructure and tests for existing HTTP 0.9 sandbox machinery
658         https://bugs.webkit.org/show_bug.cgi?id=164389
659         <rdar://problem/29101072>
660
661         Reviewed by Alex Christensen.
662
663         Add test infrastructure to support registering an arbitrary port as the default port
664         for a protocol. The behavior of various machinery, including the HTTP 0.9 machinery,
665         can be effected by whether the resource request was made using the default port for
666         the protocol. We expose window.internals.registerDefaultPortForProtocol() to allow
667         a test to override the default port associated with a protocol so as to support
668         testing these code paths using the existing port 8000 server started by run-webkit-httpd.
669         Without window.internals.registerDefaultPortForProtocol() we would need to teach
670         run-webkit-httpd to run a web server on port 80, which requires superuser privileges
671         (since it is a privileged port number) and is more likely to interfere with an
672         existing web server setup.
673
674         Tests: http/tests/security/http-0.9/default-port-plugin-blocked.html
675                http/tests/security/http-0.9/default-port-script-blocked.html
676                http/tests/security/http-0.9/iframe-blocked.html
677                http/tests/security/http-0.9/image-blocked.html
678                http/tests/security/http-0.9/image-on-HTTP-0.9-default-port-page-allowed-ref-test.html
679                http/tests/security/http-0.9/image-on-HTTP-0.9-default-port-page-allowed.html
680                http/tests/security/http-0.9/image-on-HTTP-0.9-page-blocked.html
681                http/tests/security/http-0.9/worker-connect-src-blocked.html
682                http/tests/security/http-0.9/worker-importScripts-blocked.html
683                http/tests/security/http-0.9/xhr-asynchronous-blocked.html
684
685         * platform/URL.cpp:
686         (WebCore::defaultPortForProtocolMapForTesting): Added.
687         (WebCore::registerDefaultPortForProtocolForTesting): Adds the specified (protocol, port) to the
688         mapping used for testing.
689         (WebCore::clearDefaultPortForProtocolMapForTesting): Clears the protocol to default port testing map.
690         We call this function from Internals::resetToConsistentState() so that the mapping is cleared between
691         test runs.
692         (WebCore::defaultPortForProtocol): Modified to check the protocol to default port map for testing
693         before consulting URLParser::defaultPortForProtocol().
694         * platform/URL.h:
695         * testing/Internals.cpp:
696         (WebCore::Internals::resetToConsistentState): Clear the default port mapping used for testing.
697         (WebCore::Internals::registerDefaultPortForProtocol): Added.
698         * testing/Internals.h:
699         * testing/Internals.idl: Added declaration for registerDefaultPortForProtocol().
700
701 2016-11-09  Sam Weinig  <sam@webkit.org>
702
703         [WebIDL] Add proper parsing for Promises
704         https://bugs.webkit.org/show_bug.cgi?id=164497
705
706         Reviewed by Tim Horton.
707
708         * bindings/scripts/IDLParser.pm:
709         (parseNonAnyType):
710         (parseStringType):
711         Require Promise types to declare the type they resolve to.
712         
713         * bindings/js/JSDOMPromise.h:
714         Allow DOMPromise to be be parameterized on void. Add an SFINAE guarded
715         overload of resolve that takes no arguments when in a DOMPromise<void>.
716
717         * Modules/applepay/ApplePaySession.idl:
718         * Modules/fetch/DOMWindowFetch.idl:
719         * Modules/fetch/FetchBody.idl:
720         * Modules/fetch/FetchResponse.idl:
721         * Modules/fetch/WorkerGlobalScopeFetch.idl:
722         * Modules/mediastream/MediaDevices.idl:
723         * Modules/mediastream/MediaStreamTrack.idl:
724         * Modules/mediastream/RTCPeerConnection.idl:
725         * Modules/mediastream/RTCRtpSender.idl:
726         * Modules/mediastream/RTCStatsReport.idl:
727         * Modules/streams/ReadableStream.idl:
728         * Modules/streams/ReadableStreamDefaultReader.idl:
729         * Modules/streams/ReadableStreamSource.idl:
730         * Modules/streams/WritableStream.idl:
731         * Modules/webaudio/AudioContext.idl:
732         * bindings/scripts/test/TestNode.idl:
733         * bindings/scripts/test/TestObj.idl:
734         * crypto/SubtleCrypto.idl:
735         * crypto/WebKitSubtleCrypto.idl:
736         * css/FontFace.idl:
737         * css/FontFaceSet.idl:
738         * dom/CustomElementRegistry.idl:
739         * html/HTMLMediaElement.idl:
740         Update IDLs to specify the resolve type of promise types.
741
742         * Modules/mediastream/MediaEndpointPeerConnection.cpp:
743         (WebCore::MediaEndpointPeerConnection::replaceTrack):
744         (WebCore::MediaEndpointPeerConnection::replaceTrackTask):
745         * Modules/mediastream/MediaStreamTrack.cpp:
746         (WebCore::MediaStreamTrack::applyConstraints):
747         * Modules/mediastream/MediaStreamTrack.h:
748         * Modules/mediastream/PeerConnectionBackend.cpp:
749         (WebCore::PeerConnectionBackend::setLocalDescriptionSucceeded):
750         (WebCore::PeerConnectionBackend::setRemoteDescriptionSucceeded):
751         (WebCore::PeerConnectionBackend::addIceCandidateSucceeded):
752         * Modules/mediastream/PeerConnectionBackend.h:
753         * Modules/streams/ReadableStreamSource.h:
754         (WebCore::ReadableStreamSource::start):
755         (WebCore::ReadableStreamSource::pull):
756         (WebCore::ReadableStreamSource::startFinished):
757         (WebCore::ReadableStreamSource::pullFinished):
758         * Modules/webaudio/AudioContext.cpp:
759         (WebCore::AudioContext::addReaction):
760         (WebCore::AudioContext::setState):
761         (WebCore::AudioContext::suspend):
762         (WebCore::AudioContext::resume):
763         (WebCore::AudioContext::close):
764         * Modules/webaudio/AudioContext.h:
765         * html/HTMLMediaElement.cpp:
766         (WebCore::HTMLMediaElement::rejectPendingPlayPromises):
767         (WebCore::HTMLMediaElement::resolvePendingPlayPromises):
768         (WebCore::HTMLMediaElement::play):
769         * html/HTMLMediaElement.h:
770         Update implementations to use DOMPromise<void> rather than DOMPromise<nullptr_t>
771         and use the new resolve() overload.
772
773 2016-11-07  Brady Eidson  <beidson@apple.com>
774
775         Followup to https://bugs.webkit.org/show_bug.cgi?id=164466 - Make an IDBTransaction* be an IDBTransaction&
776
777         Rubberstamped by Alex Christensen.
778
779         No new tests (No behavior change).
780
781         * Modules/indexeddb/IDBObjectStore.cpp:
782         (WebCore::IDBObjectStore::IDBObjectStore):
783         (WebCore::IDBObjectStore::~IDBObjectStore):
784         (WebCore::IDBObjectStore::hasPendingActivity):
785         (WebCore::IDBObjectStore::name):
786         (WebCore::IDBObjectStore::setName):
787         (WebCore::IDBObjectStore::keyPath):
788         (WebCore::IDBObjectStore::indexNames):
789         (WebCore::IDBObjectStore::transaction):
790         (WebCore::IDBObjectStore::autoIncrement):
791         (WebCore::IDBObjectStore::openCursor):
792         (WebCore::IDBObjectStore::openKeyCursor):
793         (WebCore::IDBObjectStore::get):
794         (WebCore::IDBObjectStore::putOrAdd):
795         (WebCore::IDBObjectStore::doDelete):
796         (WebCore::IDBObjectStore::clear):
797         (WebCore::IDBObjectStore::createIndex):
798         (WebCore::IDBObjectStore::index):
799         (WebCore::IDBObjectStore::deleteIndex):
800         (WebCore::IDBObjectStore::doCount):
801         (WebCore::IDBObjectStore::getAll):
802         (WebCore::IDBObjectStore::getAllKeys):
803         (WebCore::IDBObjectStore::markAsDeleted):
804         (WebCore::IDBObjectStore::rollbackForVersionChangeAbort):
805         (WebCore::IDBObjectStore::ref):
806         (WebCore::IDBObjectStore::deref):
807         * Modules/indexeddb/IDBObjectStore.h:
808
809 2016-11-09  Zalan Bujtas  <zalan@apple.com>
810
811         Move RenderNamedFlowThread nextRendererForElement logic to RenderTreeUpdater.
812         https://bugs.webkit.org/show_bug.cgi?id=164503
813
814         Reviewed by Antti Koivisto.
815
816         When we insert a renderer into the render tree, we need to know both its parent
817         and its next sibling. Normally the parent and the sibling are based on the DOM, but
818         when this renderer is part of a flow thread, its insertion sibling is not necessarily the DOM sibling.
819         To find the correct sibling, we call RenderNamedFlowThread's nextRendererForElement().
820         RenderNamedFlowThread keeps track of its children so that it can compute the next sibling
821         for the insertion point.
822
823         This patch eliminates the need for keeping track of the child renderers of each
824         flow by moving the 'next sibling' logic to RenderTreePosition.
825
826         No change in functionality.
827
828         * rendering/RenderElement.cpp:
829         (WebCore::RenderElement::insertedIntoTree):
830         (WebCore::RenderElement::willBeDestroyed):
831         (WebCore::RenderElement::removeFromRenderFlowThread):
832         (WebCore::RenderElement::renderNamedFlowThreadWrapper): Deleted.
833         * rendering/RenderElement.h:
834         * rendering/RenderNamedFlowThread.cpp:
835         (WebCore::RenderNamedFlowThread::nextRendererForElement): Deleted.
836         (WebCore::RenderNamedFlowThread::addFlowChild): Deleted.
837         (WebCore::RenderNamedFlowThread::removeFlowChild): Deleted.
838         * rendering/RenderNamedFlowThread.h:
839         * style/RenderTreePosition.cpp:
840         (WebCore::RenderTreePosition::previousSiblingRenderer):
841         (WebCore::RenderTreePosition::flowThreadInsertionContext):
842         * style/RenderTreePosition.h:
843         (WebCore::RenderTreePosition::RenderTreePosition):
844         (WebCore::RenderTreePosition::parent):
845         * style/RenderTreeUpdater.cpp:
846         (WebCore::registerElementForFlowThreadIfNeeded): We need to registed the element even when it does not create renderer (display: none).
847         (WebCore::RenderTreeUpdater::createRenderer):
848         (WebCore::moveToFlowThreadIfNeeded): Deleted.
849
850 2016-11-09  Per Arne Vollan  <pvollan@apple.com>
851
852         [Win][Direct2D] Incomplete image decoding.
853         https://bugs.webkit.org/show_bug.cgi?id=164511
854
855         Reviewed by Darin Adler.
856
857         Create native decoder when all image data has been received.
858
859         * platform/graphics/win/ImageDecoderDirect2D.cpp:
860         (WebCore::ImageDecoder::setData):
861
862 2016-11-09  Beth Dakin  <bdakin@apple.com>
863
864         Attempted build fix.
865
866         * platform/spi/cocoa/AVKitSPI.h:
867
868 2016-11-09  Brady Eidson  <beidson@apple.com>
869
870         IndexedDB 2.0: Clean up more transaction abort behavior, including tweaks to Index/ObjectStore lifetime.
871         https://bugs.webkit.org/show_bug.cgi?id=164466
872
873         Reviewed by Alex Christensen.
874
875         No new tests (Covered by existing tests that now pass).
876         
877         Previously, IDBIndex ref/deref didn't track a traditional ref count but instead kept the owning object store alive.
878         Now, IDBObjectStore ref/deref do the same thing for the owning transaction.
879         
880         Now when a version change transaction is rolled back, some object stores and indexes get pulled out of the "deleted"
881         set and get promoted back up into the "referenced" set.
882         
883         Now deleted object stores/indexes are considered opaque roots, as live objects in the deleted state *can* get back
884         to the owning objects.
885
886         * CMakeLists.txt:
887         * WebCore.xcodeproj/project.pbxproj:
888
889         * Modules/indexeddb/IDBIndex.cpp:
890         (WebCore::IDBIndex::rollbackInfoForVersionChangeAbort):
891
892         * Modules/indexeddb/IDBObjectStore.cpp:
893         (WebCore::IDBObjectStore::IDBObjectStore):
894         (WebCore::IDBObjectStore::indexNames):
895         (WebCore::IDBObjectStore::transaction):
896         (WebCore::IDBObjectStore::openCursor):
897         (WebCore::IDBObjectStore::openKeyCursor):
898         (WebCore::IDBObjectStore::deleteIndex):
899         (WebCore::IDBObjectStore::rollbackForVersionChangeAbort):
900         (WebCore::IDBObjectStore::visitReferencedIndexes):
901         (WebCore::IDBObjectStore::ref):
902         (WebCore::IDBObjectStore::deref):
903         (WebCore::IDBObjectStore::create): Deleted.
904         * Modules/indexeddb/IDBObjectStore.h:
905
906         * Modules/indexeddb/IDBTransaction.cpp:
907         (WebCore::IDBTransaction::objectStore):
908         (WebCore::IDBTransaction::transitionedToFinishing):
909         (WebCore::IDBTransaction::internalAbort):
910         (WebCore::IDBTransaction::createObjectStore):
911         (WebCore::IDBTransaction::deleteObjectStore):
912         (WebCore::IDBTransaction::visitReferencedObjectStores):
913         * Modules/indexeddb/IDBTransaction.h:
914         * Modules/indexeddb/IDBTransaction.idl:
915
916         * bindings/js/JSIDBTransactionCustom.cpp: Added.
917         (WebCore::JSIDBTransaction::visitAdditionalChildren):
918
919 2016-11-09  Simon Fraser  <simon.fraser@apple.com>
920
921         Allow customization of TextStream-based logging for geometry types
922         https://bugs.webkit.org/show_bug.cgi?id=164460
923
924         Reviewed by Zalan Bujtas.
925
926         TextStream-based logging was constrained by the requirement to maintain compatibility
927         with DRT-style output, which includes cumbersome rect logging ("at (5,0) size 40x40")
928         and dumping LayoutRects as IntRects.
929         
930         Add some formatting flags so that other TextStream clients (e.g. logging) can have
931         more readable output, and opt into automatic FormatNumberRespectingIntegers behavior.
932         
933         TextStreams whose output appears in test results are given flags to avoid behavior
934         changes, but in the longer term test results should be updated.
935
936         * html/canvas/CanvasRenderingContext2D.cpp:
937         (WebCore::CanvasRenderingContext2D::replayDisplayListAsText):
938         * page/scrolling/ScrollingStateNode.cpp:
939         (WebCore::ScrollingStateNode::scrollingStateTreeAsText):
940         * platform/graphics/FloatPoint.cpp:
941         (WebCore::operator<<):
942         * platform/graphics/FloatRect.cpp:
943         (WebCore::operator<<):
944         * platform/graphics/GraphicsLayer.cpp:
945         (WebCore::GraphicsLayer::layerTreeAsText):
946         * platform/graphics/IntRect.cpp:
947         (WebCore::operator<<):
948         * platform/graphics/LayoutPoint.cpp:
949         (WebCore::operator<<):
950         * platform/graphics/LayoutRect.cpp:
951         (WebCore::operator<<):
952         * platform/graphics/ca/GraphicsLayerCA.cpp:
953         (WebCore::GraphicsLayerCA::replayDisplayListAsText):
954         * platform/graphics/displaylists/DisplayList.cpp:
955         (WebCore::DisplayList::DisplayList::asText):
956         * platform/text/TextStream.cpp:
957         (WebCore::TextStream::operator<<):
958         * platform/text/TextStream.h:
959         (WebCore::TextStream::TextStream):
960         (WebCore::TextStream::formattingFlags):
961         (WebCore::TextStream::setFormattingFlags):
962         (WebCore::TextStream::hasFormattingFlag):
963         (WebCore::TextStream::increaseIndent):
964         (WebCore::TextStream::decreaseIndent):
965         * rendering/RenderTreeAsText.cpp:
966         (WebCore::externalRepresentation):
967         (WebCore::counterValueForElement):
968
969 2016-11-09  Zalan Bujtas  <zalan@apple.com>
970
971         RenderFlowThread::flowThreadRelativeWillBeRemoved should take RenderObject& instead of RenderObject*
972         https://bugs.webkit.org/show_bug.cgi?id=164543
973
974         Reviewed by Simon Fraser.
975
976         No change in functionality.
977
978         * rendering/RenderBlockFlow.cpp:
979         (WebCore::RenderBlockFlow::removeChild):
980         * rendering/RenderFlowThread.h:
981         * rendering/RenderMultiColumnFlowThread.cpp:
982         (WebCore::RenderMultiColumnFlowThread::handleSpannerRemoval):
983         (WebCore::RenderMultiColumnFlowThread::flowThreadRelativeWillBeRemoved):
984         * rendering/RenderMultiColumnFlowThread.h:
985
986 2016-11-09  Jer Noble  <jer.noble@apple.com>
987
988         REGRESSION (r208149): Media scrubber is not displayed in media controls
989         https://bugs.webkit.org/show_bug.cgi?id=164514
990
991         Reviewed by Darin Adler.
992
993         Fixes broken Media Controls API tests.
994
995         Added a new PlatformMediaSessionType; need to add that same type to the TYPE_TRAITS section of 
996         MediaElementSession.h so that is<> and downcast<> work correctly.
997
998         * html/MediaElementSession.h:
999         (isType):
1000
1001 2016-11-09  Wenson Hsieh  <wenson_hsieh@apple.com>
1002
1003         When editing IME, `compositionend` events should fire after input events
1004         https://bugs.webkit.org/show_bug.cgi?id=164324
1005         <rdar://problem/29050438>
1006
1007         Reviewed by Darin Adler.
1008
1009         Moves where we dispatch `compositionend` events to after applying editing commands that fire `beforeinput` or
1010         `input` events. Also augments existing layout tests to verify the change.
1011
1012         * editing/Editor.cpp:
1013         (WebCore::Editor::setComposition):
1014
1015 2016-11-09  Wenson Hsieh  <wenson_hsieh@apple.com>
1016
1017         Setting foreground color when text is selected should fire an input event with color data
1018         https://bugs.webkit.org/show_bug.cgi?id=164241
1019         <rdar://problem/29032759>
1020
1021         Reviewed by Darin Adler.
1022
1023         Refactors Editor::applyStyle and Editor::applyParagraphStyle to handle beforeinput and input event dispatch.
1024         Instead of going through the ApplyStyleCommand to dispatch input events, override shouldDispatchInputEvents to
1025         return false. This strategy also has the effect of unifying the way input events are dispatched in applyStyle,
1026         in both codepaths where we computeAndSetTypingStyle and where we create and then apply a style command.
1027
1028         Test: fast/events/input-events-selection-forecolor-data.html
1029
1030         * editing/ApplyStyleCommand.h:
1031         * editing/Editor.cpp:
1032         (WebCore::inputEventDataForEditingStyleAndAction):
1033         (WebCore::Editor::applyStyle):
1034         (WebCore::Editor::applyParagraphStyle):
1035         (WebCore::Editor::computeAndSetTypingStyle):
1036
1037 2016-11-08  Dean Jackson  <dino@apple.com>
1038
1039         Rendering support for ExtendedColors
1040         https://bugs.webkit.org/show_bug.cgi?id=164443
1041         <rdar://problems/29123243>
1042
1043         Reviewed by Simon Fraser and Darin Adler.
1044
1045         Add support for rendering the new color() syntax, which
1046         ends up as an ExtendedColor.
1047
1048         In order to make rendering code a little more readable, I
1049         changed Color::hasAlpha to Color::isOpaque (since an alpha
1050         of 100% is still an alpha), and added a Color::isVisible
1051         helper (the color isn't completely transparent). These new
1052         helpers support ExtendedColor forms.
1053
1054         Support for painting gradients and blending between colors
1055         is still to come. I also added some FIXME comments
1056         to show other places that don't handle ExtendedColors yet.
1057
1058         Tests: css3/color/backgrounds-and-borders.html
1059                css3/color/box-shadows.html
1060                css3/color/canvas.html
1061                css3/color/composited-solid-backgrounds.html
1062                css3/color/text.html
1063
1064         * css/CSSGradientValue.cpp: Add some notes that this is broken.
1065         (WebCore::interpolate):
1066         (WebCore::CSSGradientValue::knownToBeOpaque):
1067
1068         * editing/EditingStyle.cpp: Use new Color helpers.
1069         (WebCore::isTransparentColorValue):
1070
1071         * editing/mac/EditorMac.mm: Use new Color helpers.
1072         (WebCore::Editor::fontAttributesForSelectionStart):
1073
1074         * html/ColorInputType.cpp: No need to use the Color class at all here.
1075         (WebCore::isValidSimpleColorString): Renamed from isValidColorString.
1076         (WebCore::ColorInputType::sanitizeValue):
1077         (WebCore::ColorInputType::typeMismatchFor):
1078         (WebCore::isValidColorString): Deleted.
1079
1080         * html/canvas/CanvasRenderingContext2D.cpp: New helpers.
1081         (WebCore::CanvasRenderingContext2D::shouldDrawShadows):
1082         (WebCore::CanvasRenderingContext2D::didDraw):
1083
1084         * page/FrameView.cpp: Ditto.
1085         (WebCore::FrameView::recalculateScrollbarOverlayStyle):
1086         (WebCore::FrameView::hasOpaqueBackground):
1087         (WebCore::FrameView::setBaseBackgroundColor):
1088
1089         * platform/graphics/Color.cpp:
1090         (WebCore::differenceSquared): Support ExtendedColor, but also
1091         add a note to indicate that this method and its call sites
1092         should use floats.
1093         (WebCore::Color::serialized): New helper.
1094         (WebCore::Color::cssText): Ditto.
1095         (WebCore::Color::blend): Ditto.
1096         (WebCore::Color::blendWithWhite):
1097         (WebCore::Color::colorWithAlphaMultipliedBy): Implementation of new function.
1098         (WebCore::Color::colorWithAlpha): Ditto.
1099         (WebCore::Color::opaqueColor): New method to return an opaque version of the given color.
1100         (WebCore::blend):
1101         * platform/graphics/Color.h:
1102         (WebCore::Color::isOpaque): New helper that is !hasAlpha().
1103         (WebCore::Color::isVisible): New helper.
1104         (WebCore::Color::alphaAsFloat): Gets the alpha value as a float. This replaces
1105         a bunch of places that were calculating it manually each time. Meanwhile, we
1106         might consider always exposing the primaries as floats... or at least
1107         have that option.
1108         (WebCore::isBlackColor): New helper - it was used in a couple of places.
1109         (WebCore::isWhiteColor): Ditto.
1110         (WebCore::Color::hasAlpha): Deleted.
1111
1112         * platform/graphics/Gradient.cpp: Add FIXME.
1113         (WebCore::Gradient::addColorStop):
1114         * platform/graphics/Gradient.h:
1115
1116         * platform/graphics/GraphicsContext.cpp: Use new helpers.
1117         (WebCore::GraphicsContext::computeLineBoundsAndAntialiasingModeForText):
1118         * platform/graphics/GraphicsContext.h:
1119         (WebCore::GraphicsContext::hasVisibleShadow):
1120
1121         * platform/graphics/Image.cpp: Ditto.
1122         (WebCore::Image::fillWithSolidColor):
1123
1124         * platform/graphics/ShadowBlur.cpp: Ditto.
1125         (WebCore::ShadowBlur::updateShadowBlurValues):
1126
1127         * platform/graphics/ca/GraphicsLayerCA.cpp: Ditto.
1128         (WebCore::GraphicsLayerCA::setContentsToSolidColor):
1129
1130         * platform/graphics/cg/GradientCG.cpp:
1131         (WebCore::Gradient::platformGradient): Add a FIXME to note that we can
1132         add ExtendedColor support simply by using CGColors, rather than fetching
1133         the components ourselves.
1134
1135         * platform/graphics/cg/GraphicsContextCG.cpp: New helpers.
1136         (WebCore::calculateDrawingMode):
1137
1138         * platform/graphics/cocoa/FontCascadeCocoa.mm: New helpers.
1139         (WebCore::FontCascade::drawGlyphs):
1140
1141         * platform/graphics/mac/ColorMac.mm: Use the new helpers and Color::hash().
1142         (WebCore::nsColor):
1143
1144         * platform/graphics/texmap/TextureMapperGL.cpp: New helpers.
1145         (WebCore::TextureMapperGL::drawBorder):
1146
1147         * rendering/BorderEdge.cpp: Ditto.
1148         (WebCore::BorderEdge::obscuresBackgroundEdge):
1149         (WebCore::BorderEdge::obscuresBackground):
1150
1151         * rendering/RenderBox.cpp: Ditto.
1152         (WebCore::RenderBox::getBackgroundPaintedExtent):
1153         (WebCore::RenderBox::backgroundIsKnownToBeOpaqueInRect):
1154         (WebCore::RenderBox::backgroundHasOpaqueTopLayer):
1155
1156         * rendering/RenderBoxModelObject.cpp: Ditto.
1157         (WebCore::RenderBoxModelObject::paintFillLayerExtended):
1158         (WebCore::colorNeedsAntiAliasAtCorner):
1159         (WebCore::willBeOverdrawn):
1160         (WebCore::RenderBoxModelObject::paintTranslucentBorderSides):
1161         (WebCore::RenderBoxModelObject::paintBorder):
1162         (WebCore::RenderBoxModelObject::boxShadowShouldBeAppliedToBackground):
1163         (WebCore::RenderBoxModelObject::paintBoxShadow):
1164         * rendering/RenderElement.cpp:
1165         (WebCore::RenderElement::paintOutline):
1166         * rendering/RenderInline.cpp:
1167         (WebCore::RenderInline::paintOutline):
1168         * rendering/RenderLayerBacking.cpp:
1169         (WebCore::canCreateTiledImage):
1170         * rendering/RenderLayerCompositor.cpp:
1171         (WebCore::RenderLayerCompositor::viewHasTransparentBackground):
1172         * rendering/RenderMenuList.cpp:
1173         (RenderMenuList::getItemBackgroundColor):
1174         * rendering/RenderTheme.cpp:
1175         (WebCore::RenderTheme::disabledTextColor):
1176         * rendering/RenderView.cpp:
1177         (WebCore::RenderView::paintBoxDecorations):
1178         * rendering/TextDecorationPainter.cpp:
1179         (WebCore::TextDecorationPainter::paintTextDecoration):
1180         * rendering/TextPainter.cpp:
1181         (WebCore::TextPainter::paintTextWithShadows):
1182         * rendering/style/BorderValue.h:
1183         (WebCore::BorderValue::isTransparent):
1184         * rendering/style/RenderStyle.cpp:
1185         (WebCore::RenderStyle::visitedDependentColor):
1186         * rendering/style/RenderStyle.h:
1187         (WebCore::RenderStyle::hasBackground):
1188         * rendering/svg/RenderSVGResource.cpp:
1189         (WebCore::requestPaintingResource):
1190         * rendering/svg/SVGInlineTextBox.cpp:
1191         (WebCore::SVGInlineTextBox::paintSelectionBackground):
1192
1193         * svg/SVGAnimatedColor.cpp: Add a FIXME to note this is broken.
1194         (WebCore::SVGAnimatedColorAnimator::calculateAnimatedValue):
1195
1196 2016-11-09  Antoine Quint  <graouts@apple.com>
1197
1198         [Modern Media Controls] UI Library: StatusLabel
1199         https://bugs.webkit.org/show_bug.cgi?id=164544
1200         <rdar://problem/29179541>
1201
1202         Reviewed by Dean Jackson.
1203
1204         We add a new StatusLabel class to display a string of text in place of the TimeControl.
1205         A followup patch will add the logic to display "Error", "Loading" and "Live Broadcast"
1206         test under the right media state.
1207
1208         Tests: media/modern-media-controls/macos-inline-media-controls/macos-inline-media-controls-status-label.html
1209                media/modern-media-controls/status-label/status-label.html
1210
1211         * Modules/modern-media-controls/controls/macos-inline-media-controls.css:
1212         (.media-controls.mac.inline .time-label,):
1213         (.media-controls.mac.inline .time-label): Deleted.
1214         * Modules/modern-media-controls/controls/macos-inline-media-controls.js:
1215         (MacOSInlineMediaControls.prototype.layout):
1216         * Modules/modern-media-controls/controls/media-controls.js:
1217         (MediaControls.):
1218         * Modules/modern-media-controls/controls/status-label.css: Added.
1219         (.status-label):
1220         * Modules/modern-media-controls/controls/status-label.js: Added.
1221         (StatusLabel.prototype.get text):
1222         (StatusLabel.prototype.set text):
1223         (StatusLabel.prototype.commitProperty):
1224         * Modules/modern-media-controls/js-files:
1225         * WebCore.xcodeproj/project.pbxproj:
1226
1227 2016-11-09  Chris Dumez  <cdumez@apple.com>
1228
1229         [Mac] Stop using deprecated AppKit enumeration values
1230         https://bugs.webkit.org/show_bug.cgi?id=164494
1231
1232         Reviewed by Darin Adler.
1233
1234         Stop using deprecated AppKit enumeration values.
1235
1236         * editing/cocoa/HTMLConverter.mm:
1237         (HTMLConverter::computedAttributesForElement):
1238         (HTMLConverter::_processElement):
1239         (HTMLConverter::_addMarkersToList):
1240         * page/mac/EventHandlerMac.mm:
1241         (WebCore::EventHandler::keyEvent):
1242         (WebCore::lastEventIsMouseUp):
1243         (WebCore::EventHandler::passSubframeEventToSubframe):
1244         (WebCore::EventHandler::widgetDidHandleWheelEvent):
1245         (WebCore::EventHandler::sendFakeEventsAfterWidgetTracking):
1246         * page/mac/TextIndicatorWindow.mm:
1247         (WebCore::TextIndicatorWindow::setTextIndicator):
1248         * platform/graphics/mac/IconMac.mm:
1249         (WebCore::Icon::paint):
1250         * platform/mac/CursorMac.mm:
1251         (WebCore::createCustomCursor):
1252         * platform/mac/DragImageMac.mm:
1253         (WebCore::dissolveDragImageToFraction):
1254         (WebCore::createDragImageFromImage):
1255         * platform/mac/EventLoopMac.mm:
1256         (WebCore::EventLoop::cycle):
1257         * platform/mac/PasteboardMac.mm:
1258         (WebCore::Pasteboard::setDragImage):
1259         * platform/mac/PlatformEventFactoryMac.mm:
1260         (WebCore::globalPointForEvent):
1261         (WebCore::pointForEvent):
1262         (WebCore::mouseButtonForEvent):
1263         (WebCore::mouseEventTypeForEvent):
1264         (WebCore::clickCountForEvent):
1265         (WebCore::isKeypadEvent):
1266         (WebCore::windowsKeyCodeForKeyEvent):
1267         (WebCore::isKeyUpEvent):
1268         (WebCore::PlatformKeyboardEventBuilder::PlatformKeyboardEventBuilder):
1269         * platform/mac/ScrollbarThemeMac.mm:
1270         (WebCore::scrollbarControlSizeToNSControlSize):
1271         * platform/mac/ThemeMac.mm:
1272         (-[WebCoreThemeView window]):
1273         (WebCore::controlSizeForFont):
1274         (WebCore::controlSizeFromPixelSize):
1275         (WebCore::setUpButtonCell):
1276         (WebCore::stepperControlSizeForFont):
1277         (WebCore::paintStepper):
1278         (WebCore::ThemeMac::minimumControlSize):
1279         * platform/mac/WebVideoFullscreenHUDWindowController.mm:
1280         (-[WebVideoFullscreenHUDWindow initWithContentRect:styleMask:backing:defer:]):
1281         (-[WebVideoFullscreenHUDWindow performKeyEquivalent:]):
1282         (-[WebVideoFullscreenHUDWindowController init]):
1283         (-[WebVideoFullscreenHUDWindowController keyDown:]):
1284         (-[WebVideoFullscreenHUDWindowController windowDidLoad]):
1285         * platform/mac/WebWindowAnimation.mm:
1286         (WebWindowAnimationDurationFromDuration):
1287         * rendering/RenderThemeMac.mm:
1288         (WebCore::RenderThemeMac::updateCachedSystemFontDescription):
1289         (WebCore::RenderThemeMac::controlSizeForFont):
1290         (WebCore::RenderThemeMac::controlSizeForCell):
1291         (WebCore::RenderThemeMac::controlSizeForSystemFont):
1292         (WebCore::RenderThemeMac::paintProgressBar):
1293         (WebCore::RenderThemeMac::popupMenuSize):
1294         (WebCore::RenderThemeMac::sliderThumbHorizontal):
1295         (WebCore::RenderThemeMac::sliderThumbVertical):
1296
1297 2016-11-08  Antoine Quint  <graouts@apple.com>
1298
1299         [Modern Media Controls] UI Library: iOS inline controls
1300         https://bugs.webkit.org/show_bug.cgi?id=164513
1301         <rdar://problem/27989475>
1302
1303         Reviewed by Dean Jackson.
1304
1305         We introduce a new IOSInlineMediaControls class which can be used to instantiate media controls
1306         for inline playback on iOS.
1307
1308         Tests: media/modern-media-controls/ios-inline-media-controls/ios-inline-media-controls-buttons-styles.html
1309                media/modern-media-controls/ios-inline-media-controls/ios-inline-media-controls-constructor.html
1310                media/modern-media-controls/ios-inline-media-controls/ios-inline-media-controls-controls-bar-styles.html
1311                media/modern-media-controls/ios-inline-media-controls/ios-inline-media-controls-layout.html
1312                media/modern-media-controls/ios-inline-media-controls/ios-inline-media-controls-time-control-styles.html
1313                media/modern-media-controls/ios-inline-media-controls/ios-inline-media-dropping-controls.html
1314
1315         * Modules/modern-media-controls/controls/ios-inline-media-controls.css: Added.
1316         (.media-controls.ios.inline > .controls-bar):
1317         (.media-controls.ios.inline .time-control):
1318         (.media-controls.ios.inline button):
1319         (.media-controls.ios.inline button:active):
1320         (.media-controls.ios.inline > .controls-bar button):
1321         (.media-controls.ios.inline .buttons-container.right):
1322         (.media-controls.ios.inline button.play-pause):
1323         (.media-controls.ios.inline button.skip-back):
1324         (.media-controls.ios.inline .scrubber.slider):
1325         (.media-controls.ios.inline button.airplay):
1326         (.media-controls.ios.inline button.pip):
1327         (.media-controls.ios.inline button.fullscreen):
1328         (.media-controls.ios.inline .time-label):
1329         (.media-controls.ios.inline .scrubber.slider > .fill):
1330         (.media-controls.ios.inline .scrubber.slider > input::-webkit-slider-thumb):
1331         * Modules/modern-media-controls/controls/ios-inline-media-controls.js: Added.
1332         (IOSInlineMediaControls.prototype.layout):
1333         (IOSInlineMediaControls):
1334         * Modules/modern-media-controls/images/iOS/slider-thumb@2x.png: Added.
1335         * Modules/modern-media-controls/js-files:
1336         * WebCore.xcodeproj/project.pbxproj:
1337
1338 2016-11-09  Beth Dakin  <bdakin@apple.com>
1339
1340         Support TouchBar in WebKit
1341         https://bugs.webkit.org/show_bug.cgi?id=164437
1342         -and corresponding-
1343         rdar://problem/28876524
1344
1345         Reviewed by Darin Adler.
1346
1347         * WebCore.xcodeproj/project.pbxproj:
1348         * platform/spi/cocoa/AVKitSPI.h:
1349         * platform/spi/cocoa/NSTouchBarSPI.h: Added.
1350         * platform/spi/mac/NSSpellCheckerSPI.h:
1351
1352 2016-11-09  Chris Dumez  <cdumez@apple.com>
1353
1354         Use Blob URL instead of webkit-fake-url when pasting an image
1355         https://bugs.webkit.org/show_bug.cgi?id=49141
1356
1357         Reviewed by Darin Adler.
1358
1359         Use Blob URL instead of webkit-fake-url when pasting an image.
1360
1361         Tests: editing/pasteboard/paste-image-as-blob-url.html
1362                editing/pasteboard/paste-image-using-image-data.html
1363
1364         * editing/Editor.h:
1365         * editing/mac/EditorMac.mm:
1366         (WebCore::Editor::WebContentReader::readImage):
1367         (WebCore::Editor::createFragmentForImageAndURL):
1368
1369 2016-11-09  Michael Catanzaro  <mcatanzaro@igalia.com>
1370
1371         Fix error message when SQLite initialization fails
1372         https://bugs.webkit.org/show_bug.cgi?id=164462
1373
1374         Reviewed by Darin Adler.
1375
1376         * platform/sql/SQLiteDatabase.cpp:
1377         (WebCore::initializeSQLiteIfNecessary):
1378
1379 2016-11-08  Antoine Quint  <graouts@apple.com>
1380
1381         [Modern Media Controls] UI Library: macOS fullscreen controls
1382         https://bugs.webkit.org/show_bug.cgi?id=164414
1383         <rdar://problem/27989474>
1384
1385         Reviewed by Dean Jackson.
1386
1387         We introduce a new MacOSFullscreenMediaControls class which can be used to instantiate media controls
1388         for fullscreen playback on macOS. These controls can be dragged by the user.
1389
1390         Tests: media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-buttons-containers-styles.html
1391                media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-buttons-styles.html
1392                media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-constructor.html
1393                media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-controls-bar-styles.html
1394                media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-right-container-margin.html
1395                media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-time-control-styles.html
1396                media/modern-media-controls/macos-fullscreen-media-controls/macos-fullscreen-media-controls-volume-styles.html
1397
1398         * Modules/modern-media-controls/controls/button.js:
1399         (Button.prototype.set enabled):
1400
1401             Correctly notify the layoutDelegate when the enabled property changes, regardless of whether
1402             the flag is on.
1403
1404         * Modules/modern-media-controls/controls/icon-button.js:
1405         (IconButton.prototype._updateImage):
1406         (IconButton):
1407
1408             Correctly notify the layout delegate when the image metrics have changed so that it may perform
1409             a layout. This issues became apparent with the new tests on Yosemite and caused some flakyness.
1410
1411         * Modules/modern-media-controls/controls/icon-service.js:
1412         (const.iconService.new.IconService.prototype._fileNameAndPlatformForIconNameAndLayoutTraits):
1413         (const.iconService.new.IconService):
1414
1415             Fix a typo.
1416
1417         * Modules/modern-media-controls/controls/macos-fullscreen-media-controls.css: Added.
1418         (.media-controls.mac.fullscreen > .controls-bar):
1419         (.media-controls.mac.fullscreen .volume.slider):
1420         (.media-controls.mac.fullscreen .buttons-container):
1421         (.media-controls.mac.fullscreen .buttons-container.center):
1422         (.media-controls.mac.fullscreen > .controls-bar button):
1423         (.media-controls.mac.fullscreen button.rewind):
1424         (.media-controls.mac.fullscreen button.play-pause):
1425         (.media-controls.mac.fullscreen button.forward):
1426         (.media-controls.mac.fullscreen .buttons-container.right):
1427         (.media-controls.mac.fullscreen button.airplay):
1428         (.media-controls.mac.fullscreen button.aspect-ratio):
1429         (.media-controls.mac.fullscreen button.pip):
1430         (.media-controls.mac.fullscreen button.tracks):
1431         (.media-controls.mac.fullscreen button.fullscreen):
1432         (.media-controls.mac.fullscreen .time-control):
1433         (.media-controls.mac.fullscreen .time-label):
1434         (.media-controls.mac.fullscreen .scrubber):
1435         * Modules/modern-media-controls/controls/macos-fullscreen-media-controls.js: Added.
1436         (MacOSFullscreenMediaControls.prototype.layout):
1437         (MacOSFullscreenMediaControls):
1438         * Modules/modern-media-controls/controls/macos-media-controls.js:
1439         (MacOSMediaControls):
1440         
1441             Allow the layoutTraits property to be set to something other than just LayoutTraits.macOS
1442             so that MacOSFullscreenMediaControls may set the LayoutTraits.Fullscreen bit.
1443         
1444         * Modules/modern-media-controls/js-files:
1445         
1446             Add a reference to the new macos-fullscreen-media-controls.js file.
1447         
1448         * WebCore.xcodeproj/project.pbxproj:
1449
1450             Add references to the new macos-fullscreen-media-controls.js and
1451             macos-fullscreen-media-controls.css files.
1452
1453 2016-11-09  Chris Dumez  <cdumez@apple.com>
1454
1455         Shave 16 bytes off HTMLInputElement
1456         https://bugs.webkit.org/show_bug.cgi?id=164488
1457
1458         Reviewed by Sam Weinig.
1459
1460         Shave 16 bytes off HTMLInputElement (232 -> 216) by packing data members
1461         better.
1462
1463         * html/HTMLFormControlElement.h:
1464         * html/HTMLTextFormControlElement.cpp:
1465         (WebCore::HTMLTextFormControlElement::HTMLTextFormControlElement):
1466         * html/HTMLTextFormControlElement.h:
1467
1468 2016-11-09  Youenn Fablet  <youenn@apple.com>
1469
1470         [WebRTC] Introduce asynchronous backend for other RTCPeerConnection API
1471         https://bugs.webkit.org/show_bug.cgi?id=164409
1472
1473         Reviewed by Eric Carlson.
1474
1475         Covered by existing tests.
1476
1477         Following on createOffer changes, applying the same changes to createAnswer, setLocalDescription, setRemoteDescription and addIceCandidate.
1478         Also refactored ICE candidate event generation (done at PeerConnectionBackend).
1479         Updated stop implementation to clean any promise that may be stored in PeerConnectionBackend.
1480
1481         The goal of this is to be more aligned with https://www.w3.org/TR/webrtc/.
1482         Implementation of the various functions such as //www.w3.org/TR/webrtc/#set-description would be done in PeerConnectionBackend.
1483         This will require additional code moved from MediaEndpointPeerConnection up to PeerConnectionBackend.
1484
1485         * Modules/mediastream/MediaEndpointPeerConnection.cpp:
1486         (WebCore::MediaEndpointPeerConnection::createOfferTask):
1487         (WebCore::MediaEndpointPeerConnection::doCreateAnswer):
1488         (WebCore::MediaEndpointPeerConnection::createAnswerTask):
1489         (WebCore::MediaEndpointPeerConnection::doSetLocalDescription):
1490         (WebCore::MediaEndpointPeerConnection::setLocalDescriptionTask):
1491         (WebCore::MediaEndpointPeerConnection::doSetRemoteDescription):
1492         (WebCore::MediaEndpointPeerConnection::setRemoteDescriptionTask):
1493         (WebCore::MediaEndpointPeerConnection::doAddIceCandidate):
1494         (WebCore::MediaEndpointPeerConnection::addIceCandidateTask):
1495         (WebCore::MediaEndpointPeerConnection::doStop):
1496         (WebCore::MediaEndpointPeerConnection::gotIceCandidate):
1497         (WebCore::MediaEndpointPeerConnection::doneGatheringCandidates):
1498         (WebCore::MediaEndpointPeerConnection::createAnswer): Deleted.
1499         (WebCore::MediaEndpointPeerConnection::setLocalDescription): Deleted.
1500         (WebCore::MediaEndpointPeerConnection::setRemoteDescription): Deleted.
1501         (WebCore::MediaEndpointPeerConnection::addIceCandidate): Deleted.
1502         (WebCore::MediaEndpointPeerConnection::stop): Deleted.
1503         (WebCore::MediaEndpointPeerConnection::localDescriptionTypeValidForState): Deleted.
1504         (WebCore::MediaEndpointPeerConnection::remoteDescriptionTypeValidForState): Deleted.
1505         * Modules/mediastream/MediaEndpointPeerConnection.h:
1506         * Modules/mediastream/PeerConnectionBackend.cpp:
1507         (WebCore::PeerConnectionBackend::createOffer):
1508         (WebCore::PeerConnectionBackend::createOfferFailed):
1509         (WebCore::PeerConnectionBackend::createAnswer):
1510         (WebCore::PeerConnectionBackend::createAnswerSucceeded):
1511         (WebCore::PeerConnectionBackend::createAnswerFailed):
1512         (WebCore::isLocalDescriptionTypeValidForState):
1513         (WebCore::PeerConnectionBackend::setLocalDescription):
1514         (WebCore::PeerConnectionBackend::setLocalDescriptionSucceeded):
1515         (WebCore::PeerConnectionBackend::setLocalDescriptionFailed):
1516         (WebCore::isRemoteDescriptionTypeValidForState):
1517         (WebCore::PeerConnectionBackend::setRemoteDescription):
1518         (WebCore::PeerConnectionBackend::setRemoteDescriptionSucceeded):
1519         (WebCore::PeerConnectionBackend::setRemoteDescriptionFailed):
1520         (WebCore::PeerConnectionBackend::addIceCandidate):
1521         (WebCore::PeerConnectionBackend::addIceCandidateSucceeded):
1522         (WebCore::PeerConnectionBackend::addIceCandidateFailed):
1523         (WebCore::PeerConnectionBackend::fireICECandidateEvent):
1524         (WebCore::PeerConnectionBackend::doneGatheringCandidates):
1525         (WebCore::PeerConnectionBackend::stop):
1526         * Modules/mediastream/PeerConnectionBackend.h:
1527
1528 2016-11-09  Eric Carlson  <eric.carlson@apple.com>
1529
1530         [MediaStream][Mac] Mark captured video frames as ready for display immediately
1531         https://bugs.webkit.org/show_bug.cgi?id=164482
1532         <rdar://problem/29139073>
1533
1534         Reviewed by Jer Noble.
1535
1536         * platform/cf/CoreMediaSoftLink.cpp: Add new constant.
1537         * platform/cf/CoreMediaSoftLink.h:
1538
1539         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h:
1540         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
1541         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::requestNotificationWhenReadyForMediaData):
1542           New, ask register for a callback when the sample buffer display layer is ready
1543           for more media data.
1544         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::enqueueVideoSampleBuffer): Don't change
1545           the sample timestamps, assume the caller has configured the sample correctly.
1546         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::prepareVideoSampleBufferFromTrack): Don't
1547           drop frames when the display layer isn't ready.
1548         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::destroyLayer): Call stopRequestingMediaData.
1549         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::sampleBufferUpdated):
1550         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::enqueueVideoSampleBufferFromTrack): Deleted.
1551
1552         * platform/mediastream/mac/AVVideoCaptureSource.mm:
1553         (WebCore::AVVideoCaptureSource::setupCaptureSession): Tell the video output to always discard
1554           late video frames, we don't need them.
1555         (WebCore::AVVideoCaptureSource::processNewFrame): Add a kCMSampleAttachmentKey_DisplayImmediately
1556           attachment.
1557
1558 2016-11-09  Joanmarie Diggs  <jdiggs@igalia.com>
1559
1560         AX: [ATK] Wrong selected element at a given index in a list box (redux)
1561         https://bugs.webkit.org/show_bug.cgi?id=164430
1562
1563         Reviewed by Darin Adler.
1564
1565         This essentially undoes the implementation change resulting from r164577.
1566         As stated in the ATK documentation, atk_selection_ref_selection() takes
1567         "a gint specifying the index in the selection set. (e.g. the ith selection
1568         as opposed to the ith child)." r164577 deliberately modified that, causing
1569         atk_selection_ref_selection() to treat the index as if it were the position
1570         with respect to all of the children. There is different API in ATK, namely
1571         atk_object_ref_accessible_child(), when the ith child from the set of all
1572         children is sought.
1573
1574         Tests: accessibility/aria-listbox-no-selection.html
1575                accessibility/native-listbox-no-selection.html
1576
1577         * accessibility/atk/WebKitAccessibleInterfaceSelection.cpp:
1578         (optionFromSelection):
1579
1580 2016-11-09  Gyuyoung Kim  <gyuyoung.kim@webkit.org>
1581
1582         [EFL] Use libgcrypt instead of GnuTLS for CryptoDigest
1583         https://bugs.webkit.org/show_bug.cgi?id=164461
1584
1585         Reviewed by Michael Catanzaro.
1586
1587         As GTK port in r208297, EFL port starts to use libgcrypt instead of GnuTLS as well.
1588
1589         No new tests, no behavior change.
1590
1591         * PlatformEfl.cmake:
1592
1593 2016-11-09  Ryan Haddad  <ryanhaddad@apple.com>
1594
1595         Unreviewed, rolling out r208422.
1596
1597         Roll r208382 back in since it was not responsible for the API
1598         test failures seen on macOS.
1599
1600         Reverted changeset:
1601
1602         "Unreviewed, rolling out r208382."
1603         https://bugs.webkit.org/show_bug.cgi?id=164319
1604         http://trac.webkit.org/changeset/208422
1605
1606 2016-11-09  Csaba Osztrogonác  <ossy@webkit.org>
1607
1608         One more URTBF after r208361.
1609
1610         * PlatformMac.cmake:
1611
1612 2016-11-09  Csaba Osztrogonác  <ossy@webkit.org>
1613
1614         Typo fix after r162782
1615         https://bugs.webkit.org/show_bug.cgi?id=164473
1616
1617         Unreviewed trivial fix.
1618
1619         * platform/ThreadGlobalData.cpp:
1620
1621 2016-11-07  Ryan Haddad  <ryanhaddad@apple.com>
1622
1623         Unreviewed, rolling out r208382.
1624
1625         This change appears to have caused 3
1626         SerializedCryptoKeyWrapTest API tests to fail on macOS.
1627
1628         Reverted changeset:
1629
1630         "[Readable Streams API] Implement ByteStreamController
1631         error()"
1632         https://bugs.webkit.org/show_bug.cgi?id=164319
1633         http://trac.webkit.org/changeset/208382
1634
1635 2016-11-04  Filip Pizlo  <fpizlo@apple.com>
1636
1637         WTF::ParkingLot should stop using std::chrono because std::chrono::duration casts are prone to overflows
1638         https://bugs.webkit.org/show_bug.cgi?id=152045
1639
1640         Reviewed by Andy Estes.
1641
1642         No new layout tests because no new behavior. The new WTF time classes have some unit tests
1643         in TestWebKitAPI.
1644
1645         * fileapi/ThreadableBlobRegistry.cpp:
1646         (WebCore::ThreadableBlobRegistry::blobSize):
1647         * platform/MainThreadSharedTimer.h:
1648         * platform/SharedTimer.h:
1649         * platform/ThreadTimers.cpp:
1650         (WebCore::ThreadTimers::updateSharedTimer):
1651         * platform/cf/MainThreadSharedTimerCF.cpp:
1652         (WebCore::MainThreadSharedTimer::setFireInterval):
1653         * platform/efl/MainThreadSharedTimerEfl.cpp:
1654         (WebCore::MainThreadSharedTimer::setFireInterval):
1655         * platform/glib/MainThreadSharedTimerGLib.cpp:
1656         (WebCore::MainThreadSharedTimer::setFireInterval):
1657         * platform/win/MainThreadSharedTimerWin.cpp:
1658         (WebCore::MainThreadSharedTimer::setFireInterval):
1659         * workers/WorkerRunLoop.cpp:
1660         (WebCore::WorkerRunLoop::runInMode):
1661
1662 2016-11-04  Zalan Bujtas  <zalan@apple.com>
1663
1664         RenderFlowThread state reset cleanup.
1665         https://bugs.webkit.org/show_bug.cgi?id=164426
1666
1667         Reviewed by Simon Fraser.
1668
1669         RenderFlowThread state reset is spread across several functions. This patch groups them
1670         together in RenderObject::resetFlowThreadState().
1671
1672         No change in functionality.
1673
1674         * rendering/RenderBlock.cpp:
1675         (WebCore::RenderBlock::removeLeftoverAnonymousBlock):
1676         (WebCore::RenderBlock::dropAnonymousBoxChild): This is now part of resetFlowThreadState() since resetFlowThreadState
1677         gets called even when NotifyChildren is false.
1678         * rendering/RenderElement.cpp:
1679         (WebCore::RenderElement::insertChildInternal): Initialize the thread state before we notify the child.
1680         (WebCore::RenderElement::removeChildInternal): Reset the state even when NotifyChildren is false.
1681         (WebCore::RenderElement::willBeRemovedFromTree): This code is moved to removeFromRenderFlowThread().
1682         (WebCore::RenderElement::removeFromRenderFlowThread):
1683         * rendering/RenderObject.cpp:
1684         (WebCore::RenderObject::initializeFlowThreadState): This is in transition for webkit.org/b/164428 (RenderFlowThread state initialization cleanup.)
1685         (WebCore::RenderObject::resetFlowThreadState):
1686         (WebCore::RenderObject::setParent): This was seemingly a random place to put flow state initialization. 
1687         (WebCore::RenderObject::willBeRemovedFromTree): resetFlowThreadState() takes care of it now.
1688         * rendering/RenderObject.h:
1689
1690 2016-11-04  Yusuke Suzuki  <utatane.tea@gmail.com>
1691
1692         [DOMJIT] Add DOMJIT::Signature annotation to Document::getElementById
1693         https://bugs.webkit.org/show_bug.cgi?id=164356
1694
1695         Reviewed by Filip Pizlo.
1696
1697         This patch implements DOMJIT::Signature annotation for getElementById.
1698         Since getElementById is also implemented in DocumentFragment, we implement
1699         the branchIfDocumentFragment/branchIfNotDocumentFragment for that.
1700
1701         In dromaeo, we have a test like this.
1702
1703         test( "getElementById", function(){
1704             for ( var i = 0; i < num * 30; i++ ) {
1705                 ret = document.getElementById("testA" + num).nodeType;
1706                 ret = document.getElementById("testB" + num).nodeType;
1707                 ret = document.getElementById("testC" + num).nodeType;
1708                 ret = document.getElementById("testD" + num).nodeType;
1709                 ret = document.getElementById("testE" + num).nodeType;
1710                 ret = document.getElementById("testF" + num).nodeType;
1711             }
1712         });
1713
1714         In the above test, JSC already knows the following things.
1715
1716         1. Since nodeType is now handled as CallDOMGetter, we know that it is pure.
1717         2. getElementById look up becomes PureGetById since document is impure object. But it is kept as PureGetById. So it does not write DOMState.
1718         3. `"testA" + num` will be converted to constant string.
1719         4. CallDOM for getElementById said it just reads(DOMState:DOM). And it saids that it returns the same value as long as DOMState is not clobbered.
1720         5. CheckCell leading CallDOM ensures the inlined getElementById node. (CallDOM node).
1721
1722         The key thing is that no node clobbers DOMState during the loop. So CallDOM & CallDOMGetter can be hoisted.
1723         This improves dom-query significantly. Dromaeo dom-query getElementById becomes 40x faster (247796 v.s. 6197).
1724         Dromaeo dom-query getElementById (not in document) becomes 89x faster (630317.8 v.s. 7066.).
1725
1726         Tests: js/dom/domjit-function-get-element-by-id-changed.html
1727                js/dom/domjit-function-get-element-by-id-licm.html
1728                js/dom/domjit-function-get-element-by-id.html
1729
1730         * dom/NonElementParentNode.idl:
1731         * domjit/DOMJITCheckDOM.h:
1732         (WebCore::DOMJIT::TypeChecker<DocumentFragment>::branchIfFail):
1733         * domjit/DOMJITHelpers.h:
1734         (WebCore::DOMJIT::branchIfDocumentFragment):
1735         (WebCore::DOMJIT::branchIfNotDocumentFragment):
1736
1737 2016-11-04  Simon Fraser  <simon.fraser@apple.com>
1738
1739         Rename unscaledUnobscuredVisibleContentSize and unscaledVisibleContentSizeIncludingObscuredArea for attempted clarity
1740         https://bugs.webkit.org/show_bug.cgi?id=164438
1741
1742         Reviewed by Tim Horton.
1743
1744         unscaledUnobscuredVisibleContentSize() and unscaledVisibleContentSizeIncludingObscuredArea() were an endless source
1745         of confusion.
1746         
1747         Functions with "VisibleContent" in the name are usually expected to return document coordinates (affected by zooming),
1748         so unscaledUnobscuredVisibleContentSize caused cognitive dissonance because of "unscaled" vs "visibleContent", and
1749         "unobscured" vs "visible".
1750         
1751         So rename:
1752             unscaledUnobscuredVisibleContentSize -> sizeForUnobscuredContent
1753             unscaledVisibleContentSizeIncludingObscuredArea -> sizeForVisibleContent
1754         
1755         sizeForUnobscuredContent() can also be private to ScrollView.
1756
1757         * inspector/InspectorOverlay.cpp:
1758         (WebCore::InspectorOverlay::update):
1759         * platform/ScrollView.cpp:
1760         (WebCore::ScrollView::unobscuredContentRectInternal):
1761         (WebCore::ScrollView::sizeForVisibleContent):
1762         (WebCore::ScrollView::sizeForUnobscuredContent): Don't compute unscaledVisibleContentSizeIncludingObscuredArea
1763         before testing whether we have a platform widget.
1764         (WebCore::ScrollView::layoutSize):
1765         (WebCore::ScrollView::unscaledVisibleContentSizeIncludingObscuredArea): Deleted.
1766         (WebCore::ScrollView::unscaledUnobscuredVisibleContentSize): Deleted.
1767         * platform/ScrollView.h:
1768         * rendering/RenderBoxModelObject.cpp:
1769         (WebCore::RenderBoxModelObject::calculateBackgroundImageGeometry):
1770         * rendering/RenderLayerCompositor.cpp:
1771         (WebCore::RenderLayerCompositor::flushPendingLayerChanges):
1772         (WebCore::RenderLayerCompositor::frameViewDidChangeSize):
1773         (WebCore::RenderLayerCompositor::updateRootLayerPosition):
1774         (WebCore::RenderLayerCompositor::ensureRootLayer):
1775
1776 2016-11-04  Simon Fraser  <simon.fraser@apple.com>
1777
1778         Layout viewport wrong with RTL documents
1779         https://bugs.webkit.org/show_bug.cgi?id=164434
1780
1781         Reviewed by Tim Horton.
1782
1783         The layoutViewportRect was computed incorrectly in RTL documents, because 
1784         FrameView::unscaledMaximumScrollPosition() was wrong; it erroneously mapped
1785         what it thought was a scrollOffset to a scrollPosition.
1786
1787         Unscaled scroll positions are in the same coordinate space as unscaledDocumentRect,
1788         so we should not call scrollPositionFromOffset() in FrameView::unscaledMaximumScrollPosition().
1789
1790         Changed FrameView::unscaledMinimumScrollPosition() to also just grab the location of
1791         unscaledDocumentRect, for symmetry.
1792
1793         Finally fixed the tiled scrolling indicator's viewport rect for zoomed RTL documents
1794         by using the unscaled scroll origin.
1795
1796         Tests: fast/visual-viewport/rtl-nonzoomed-rects.html
1797                fast/visual-viewport/rtl-zoomed-rects.html
1798
1799         * page/FrameView.cpp:
1800         (WebCore::FrameView::setLayoutViewportOrigin):
1801         (WebCore::FrameView::unscaledScrollOrigin):
1802         (WebCore::FrameView::unscaledMinimumScrollPosition):
1803         (WebCore::FrameView::unscaledMaximumScrollPosition):
1804         * page/FrameView.h:
1805
1806 2016-11-04  Sam Weinig  <sam@webkit.org>
1807
1808         [WebIDL] Add support for modern callback syntax
1809         https://bugs.webkit.org/show_bug.cgi?id=164435
1810
1811         Reviewed by Chris Dumez.
1812
1813         Support new callback syntax:
1814             callback Function = void (DOMString arg1, long arg2);
1815
1816         This replaces "callback interface" types with a Callback=FunctionOnly
1817         extended attribute.
1818
1819         * Modules/geolocation/PositionCallback.idl:
1820         * Modules/geolocation/PositionErrorCallback.idl:
1821         * Modules/notifications/NotificationPermissionCallback.idl:
1822         * Modules/quota/StorageErrorCallback.idl:
1823         * Modules/quota/StorageQuotaCallback.idl:
1824         * Modules/quota/StorageUsageCallback.idl:
1825         * Modules/webaudio/AudioBufferCallback.idl:
1826         * Modules/webdatabase/DatabaseCallback.idl:
1827         * Modules/webdatabase/SQLStatementCallback.idl:
1828         * Modules/webdatabase/SQLStatementErrorCallback.idl:
1829         * Modules/webdatabase/SQLTransactionCallback.idl:
1830         * Modules/webdatabase/SQLTransactionErrorCallback.idl:
1831         * dom/RequestAnimationFrameCallback.idl:
1832         * dom/StringCallback.idl:
1833         * html/VoidCallback.idl:
1834         * page/IntersectionObserverCallback.idl:
1835         * css/MediaQueryListListener.idl:
1836         Update to new syntax.
1837
1838         * css/MediaQueryListListener.h:
1839         * css/MediaQueryMatcher.cpp:
1840         (WebCore::MediaQueryMatcher::styleResolverChanged):
1841         Switch to using the now required 'handleEvent' name. This is an implementation detail
1842         that we should change.
1843
1844         * bindings/scripts/CodeGenerator.pm:
1845         Update document processing to allow a callback only file. Update callback
1846         type checks to look for a regex that matches in the new format.
1847
1848         * bindings/scripts/CodeGeneratorJS.pm:
1849         (AddToImplIncludesForIDLType):
1850         (AddToIncludesForIDLType):
1851         (AddToImplIncludes):
1852         (AddToIncludes):
1853         Abstract includes functions to allow passing in an include hash.
1854
1855         (GenerateCallbackFunctionHeader):
1856         (GenerateCallbackFunctionImplementation):
1857         (GenerateCallbackInterfaceHeader):
1858         (GenerateCallbackInterfaceImplementation):
1859         (GenerateCallbackHeaderContent):
1860         (GenerateCallbackImplementationContent):
1861         Refactor callback generation code into GenerateCallbackHeaderContent and GenerateCallbackImplementationContent
1862         to allow using it for both the new callbacks as well as the old callback interfaces.
1863
1864         * bindings/scripts/IDLParser.pm:
1865         (Parse):
1866         (applyTypedefs):
1867         (applyTypedefsToOperation):
1868         (parseCallbackRest):
1869         Parse callbacks into the new IDLCallbackFunction type. Ensure that typedefs are applied as well.
1870
1871         * bindings/scripts/IDLAttributes.txt:
1872         Remove support for Callback=FunctionOnly.
1873
1874         * bindings/scripts/test/JS/JSTestCallback.cpp: Removed.
1875         * bindings/scripts/test/JS/JSTestCallback.h: Removed.
1876         * bindings/scripts/test/JS/JSTestCallbackFunction.cpp:
1877         * bindings/scripts/test/JS/JSTestCallbackFunction.h:
1878         * bindings/scripts/test/JS/JSTestCallbackFunctionWithTypedefs.cpp: Added.
1879         * bindings/scripts/test/JS/JSTestCallbackFunctionWithTypedefs.h: Added.
1880         * bindings/scripts/test/JS/JSTestCallbackInterface.cpp: Copied from Source/WebCore/bindings/scripts/test/JS/JSTestCallback.cpp.
1881         * bindings/scripts/test/JS/JSTestCallbackInterface.h: Copied from Source/WebCore/bindings/scripts/test/JS/JSTestCallback.h.
1882         * bindings/scripts/test/JS/JSTestObj.cpp:
1883         * bindings/scripts/test/JS/JSTestTypedefs.cpp:
1884         * bindings/scripts/test/TestCallback.idl: Removed.
1885         * bindings/scripts/test/TestCallbackFunction.idl:
1886         * bindings/scripts/test/TestCallbackFunctionWithTypedefs.idl: Added.
1887         * bindings/scripts/test/TestCallbackInterface.idl: Copied from Source/WebCore/bindings/scripts/test/TestCallback.idl.
1888         * bindings/scripts/test/TestObj.idl:
1889         * bindings/scripts/test/TestTypedefs.idl:
1890         Update existing tests and add new ones to test callback functions specifically.
1891
1892 2016-11-04  Alex Christensen  <achristensen@webkit.org>
1893
1894         Move isDefaultPortForProtocol from URLParser.cpp back to URL.cpp
1895         https://bugs.webkit.org/show_bug.cgi?id=164439
1896
1897         Reviewed by Daniel Bates.
1898
1899         No change in behaviour.
1900
1901         * platform/URL.cpp:
1902         (WebCore::defaultPortForProtocol):
1903         (WebCore::isDefaultPortForProtocol):
1904         * platform/URLParser.cpp:
1905         (WebCore::URLParser::defaultPortForProtocol):
1906         (WebCore::URLParser::parsePort):
1907         (WebCore::defaultPortForProtocol): Deleted.
1908         (WebCore::isDefaultPortForProtocol): Deleted.
1909         * platform/URLParser.h:
1910
1911 2016-11-04  Wenson Hsieh  <wenson_hsieh@apple.com>
1912
1913         Safari does not emit composition end if blurred for dead key / Japanese IME
1914         https://bugs.webkit.org/show_bug.cgi?id=164369
1915         <rdar://problem/29050439>
1916
1917         Reviewed by Ryosuke Niwa.
1918
1919         On Mac, _before_ changing selection, try to finalize the composition by calling Editor::cancelComposition early.
1920         This is because the focused element may have changed after performing the selection change, so we would
1921         otherwise be dispatching the `compositionend` to the new focused element (or no compositionend at all) instead
1922         of the element with the composition.
1923
1924         Doing this allows us to match Chrome and Firefox behavior. After canceling the composition, we then need to also
1925         clear the system IME state. We do this on Mac WK1/WK2 through the cancelComposition() codepath, which ends up
1926         calling into -discardMarkedText, which resets the marked text state. Some minor refactoring was performed to
1927         accomplish this -- currently, discardedComposition sends a CompositionWasCanceled message over to the UI process
1928         that discards the marked text, and then updates the editor state. This patch splits this into two separate
1929         steps -- see the WebKit2 ChangeLog for more details.
1930
1931         Test: fast/events/ime-compositionend-on-selection-change.html
1932
1933         * editing/Editor.cpp:
1934         (WebCore::Editor::selectionWillChange):
1935         * editing/Editor.h:
1936         * editing/FrameSelection.cpp:
1937         (WebCore::FrameSelection::setSelectionWithoutUpdatingAppearance):
1938         * editing/mac/EditorMac.mm:
1939         (WebCore::Editor::selectionWillChange):
1940         * loader/EmptyClients.h:
1941         * page/EditorClient.h:
1942
1943 2016-11-04  Brady Eidson  <beidson@apple.com>
1944
1945         IndexedDB 2.0: Clean up more transaction abort and exception throwing behavior from IDBObjectStore.
1946         https://bugs.webkit.org/show_bug.cgi?id=164424
1947
1948         Reviewed by Alex Christensen.
1949
1950         No new tests (Covered by existing tests).
1951
1952         This patch actually turns a handful of PASS to FAIL in the imported tests, but those are parts of the
1953         spec in flux/under discussion.
1954
1955         We'll update either source or the tests as things are resolved.
1956
1957         * Modules/indexeddb/IDBIndex.cpp:
1958         (WebCore::IDBIndex::rollbackInfoForVersionChangeAbort):
1959
1960         * Modules/indexeddb/IDBObjectStore.cpp:
1961         (WebCore::IDBObjectStore::get):
1962         (WebCore::IDBObjectStore::putOrAdd):
1963         (WebCore::IDBObjectStore::rollbackForVersionChangeAbort):
1964
1965 2016-11-04  Ryosuke Niwa  <rniwa@webkit.org>
1966
1967         Load stylesheets in link elements inside a connected shadow tree
1968         https://bugs.webkit.org/show_bug.cgi?id=160683
1969         <rdar://problem/29040652>
1970
1971         Reviewed by Antti Koivisto.
1972
1973         Allow external stylesheets within a shadow tree by storing the appropriate style scope in HTMLLinkElement
1974         when it's connected to a document instead of always talking to document's style scope.
1975
1976         Tests: fast/shadow-dom/link-element-in-shadow-tree.html
1977                fast/shadow-dom/selected-stylesheet-in-shadow-tree.html
1978
1979        * html/HTMLLinkElement.cpp:
1980        (WebCore::HTMLLinkElement::HTMLLinkElement):
1981        (WebCore::HTMLLinkElement::~HTMLLinkElement):
1982        (WebCore::HTMLLinkElement::setDisabledState): Exit early when the element is not in a document as invoking
1983        didChangeActiveStyleSheetCandidates would require having a valid m_styleScope and process() already exits
1984        early when inDocument() is false.
1985        (WebCore::HTMLLinkElement::parseAttribute):
1986        (WebCore::HTMLLinkElement::process): Removed the early exit for when the element is in a shadow tree.
1987        (WebCore::HTMLLinkElement::insertedInto): Exit early unless this element has just become connected to
1988        a document instead of whenever its self-inclusive ancestor is inserted into a container.
1989        (WebCore::HTMLLinkElement::removedFrom): Ditto for removal. Also call removeStyleSheetCandidateNode after
1990        calling removePendingSheet since the latter depends on m_styleScope being not null.
1991        (WebCore::HTMLLinkElement::addPendingSheet):
1992        (WebCore::HTMLLinkElement::removePendingSheet):
1993        * html/HTMLLinkElement.h:
1994        * html/HTMLStyleElement.cpp:
1995        (WebCore::HTMLStyleElement::insertedInto): Only call inline style owner's insertedIntoDocument if this
1996        element has just become connected to a document.
1997        (WebCore::HTMLStyleElement::removedFrom): Ditto for the removal.
1998        * style/StyleScope.h:
1999        * svg/SVGStyleElement.cpp:
2000        (WebCore::SVGStyleElement::insertedInto): Ditto.
2001        (WebCore::SVGStyleElement::removedFrom): Ditto for the removal.
2002
2003 2016-11-04  Said Abou-Hallawa  <sabouhallawa@apple.com>
2004
2005         Add a setting and preferences to enable/disable async image decoding
2006         https://bugs.webkit.org/show_bug.cgi?id=164417
2007
2008         Reviewed by Simon Fraser.
2009
2010         Add an asyncImageDecodingEnabled setting. This setting controls whether an
2011         image "can" be asynchronously decoded on a separate thread or not. The
2012         function ImageSource::isAsyncDecodingRequired() will be used in conjunction
2013         with this setting to decide whether an image "should" be asynchronously
2014         decoded or not.
2015
2016         * page/Settings.in:
2017
2018 2016-11-04  Tim Horton  <timothy_horton@apple.com>
2019
2020         Apply post-landing review comments for r208347
2021
2022         * dom/Element.cpp:
2023         (WebCore::Element::findAnchorElementForLink):
2024         Use attributeWithoutSynchronization.
2025
2026         * page/PrintContext.cpp:
2027         (WebCore::PrintContext::spoolPage):
2028         (WebCore::PrintContext::spoolRect):
2029         (WebCore::PrintContext::collectLinkedDestinations):
2030         (WebCore::PrintContext::outputLinkedDestinations):
2031         * page/PrintContext.h:
2032         Pass Document by reference instead of Node by pointer,
2033         use ElementTraversal instead of NodeTraversal to avoid
2034         having to locally check the type, and null-check renderers.
2035
2036 2016-11-04  Myles C. Maxfield  <mmaxfield@apple.com>
2037
2038         Implement WebGL2RenderingContext::copyBufferSubData()
2039         https://bugs.webkit.org/show_bug.cgi?id=164008
2040
2041         Reviewed by Dean Jackson.
2042
2043         Similar to previous work regarding WebGL 2 buffers, this method implements
2044         the ability to copy from one buffer to another without the data leaving
2045         the GPU.
2046
2047         Test: fast/canvas/webgl/copyBufferSubData.html
2048
2049         * html/canvas/WebGL2RenderingContext.cpp:
2050         (WebCore::WebGL2RenderingContext::copyBufferSubData):
2051         * html/canvas/WebGLBuffer.cpp:
2052         (WebCore::WebGLBuffer::associateCopyBufferSubData):
2053         * html/canvas/WebGLBuffer.h:
2054         * platform/graphics/GraphicsContext3D.h:
2055         * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
2056         (WebCore::GraphicsContext3D::copyBufferSubData):
2057
2058 2016-11-04  Simon Fraser  <simon.fraser@apple.com>
2059
2060         Rename some ScrollingTree/Node-related functions to reduce the number of uses of "update"
2061         https://bugs.webkit.org/show_bug.cgi?id=164420
2062
2063         Reviewed by Tim Horton.
2064
2065         Rename:
2066             commitNewTreeState -> commitTreeState ("new" was redundant)
2067             updateBeforeChildren -> commitStateBeforeChildren
2068             updateAfterChildren -> commitStateAfterChildren
2069
2070         * page/scrolling/ScrollingTree.cpp:
2071         (WebCore::ScrollingTree::commitTreeState):
2072         (WebCore::ScrollingTree::updateTreeFromStateNode):
2073         (WebCore::ScrollingTree::commitNewTreeState): Deleted.
2074         * page/scrolling/ScrollingTree.h:
2075         * page/scrolling/ScrollingTreeFrameScrollingNode.cpp:
2076         (WebCore::ScrollingTreeFrameScrollingNode::commitStateBeforeChildren):
2077         (WebCore::ScrollingTreeFrameScrollingNode::updateBeforeChildren): Deleted.
2078         * page/scrolling/ScrollingTreeFrameScrollingNode.h:
2079         * page/scrolling/ScrollingTreeNode.h:
2080         (WebCore::ScrollingTreeNode::commitStateAfterChildren):
2081         (WebCore::ScrollingTreeNode::updateAfterChildren): Deleted.
2082         * page/scrolling/ScrollingTreeScrollingNode.cpp:
2083         (WebCore::ScrollingTreeScrollingNode::commitStateBeforeChildren):
2084         (WebCore::ScrollingTreeScrollingNode::commitStateAfterChildren):
2085         (WebCore::ScrollingTreeScrollingNode::updateBeforeChildren): Deleted.
2086         (WebCore::ScrollingTreeScrollingNode::updateAfterChildren): Deleted.
2087         * page/scrolling/ScrollingTreeScrollingNode.h:
2088         * page/scrolling/ThreadedScrollingTree.cpp:
2089         (WebCore::ThreadedScrollingTree::commitTreeState):
2090         (WebCore::ThreadedScrollingTree::commitNewTreeState): Deleted.
2091         * page/scrolling/ThreadedScrollingTree.h:
2092         * page/scrolling/ios/ScrollingTreeFrameScrollingNodeIOS.h:
2093         * page/scrolling/ios/ScrollingTreeFrameScrollingNodeIOS.mm:
2094         (WebCore::ScrollingTreeFrameScrollingNodeIOS::commitStateBeforeChildren):
2095         (WebCore::ScrollingTreeFrameScrollingNodeIOS::commitStateAfterChildren):
2096         (WebCore::ScrollingTreeFrameScrollingNodeIOS::updateBeforeChildren): Deleted.
2097         (WebCore::ScrollingTreeFrameScrollingNodeIOS::updateAfterChildren): Deleted.
2098         * page/scrolling/ios/ScrollingTreeIOS.cpp:
2099         (WebCore::ScrollingTreeIOS::commitNewTreeState): Deleted.
2100         * page/scrolling/ios/ScrollingTreeIOS.h:
2101         * page/scrolling/mac/ScrollingCoordinatorMac.mm:
2102         (WebCore::ScrollingCoordinatorMac::commitTreeState):
2103         * page/scrolling/mac/ScrollingTreeFixedNode.h:
2104         * page/scrolling/mac/ScrollingTreeFixedNode.mm:
2105         (WebCore::ScrollingTreeFixedNode::commitStateBeforeChildren):
2106         (WebCore::ScrollingTreeFixedNode::updateBeforeChildren): Deleted.
2107         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h:
2108         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
2109         (WebCore::ScrollingTreeFrameScrollingNodeMac::commitStateBeforeChildren):
2110         (WebCore::ScrollingTreeFrameScrollingNodeMac::commitStateAfterChildren):
2111         (WebCore::ScrollingTreeFrameScrollingNodeMac::updateBeforeChildren): Deleted.
2112         (WebCore::ScrollingTreeFrameScrollingNodeMac::updateAfterChildren): Deleted.
2113         * page/scrolling/mac/ScrollingTreeStickyNode.h:
2114         * page/scrolling/mac/ScrollingTreeStickyNode.mm:
2115         (WebCore::ScrollingTreeStickyNode::commitStateBeforeChildren):
2116         (WebCore::ScrollingTreeStickyNode::updateBeforeChildren): Deleted.
2117
2118 2016-11-03  Anders Carlsson  <andersca@apple.com>
2119
2120         Add new 'other' Apple Pay button style
2121         https://bugs.webkit.org/show_bug.cgi?id=164384
2122         rdar://problem/28302528
2123
2124         Reviewed by Dean Jackson.
2125
2126         * DerivedSources.make:
2127         * WebCorePrefix.h:
2128         Add extension points.
2129
2130         * css/CSSPrimitiveValueMappings.h:
2131         (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
2132         Add ApplePayButtonType::Other.
2133
2134         (WebCore::CSSPrimitiveValue::operator ApplePayButtonType):
2135         Add CSSValueOther.
2136
2137         * css/CSSValueKeywords.in:
2138         Add other.
2139
2140         * css/parser/CSSParser.cpp:
2141         (WebCore::isValidKeywordPropertyAndValue):
2142         Add CSSValueOther.
2143
2144         * css/parser/CSSParserFastPaths.cpp:
2145         (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
2146         Add CSSValueOther.
2147
2148         * rendering/RenderThemeCocoa.mm:
2149         (WebCore::toPKPaymentButtonType):
2150         Handle ApplePayButtonType::Other.
2151
2152         * rendering/style/RenderStyleConstants.h:
2153         Add ApplePayButtonType::Other.
2154
2155 2016-11-04  Antti Koivisto  <antti@apple.com>
2156
2157         slotted() pseudo does not work with ID selector
2158         https://bugs.webkit.org/show_bug.cgi?id=160538
2159         <rdar://problem/28534529>
2160
2161         Reviewed by Andreas Kling.
2162
2163         When we saw an id selector while addin rules we immediately threw it into the m_idRules
2164         optimization bucket and bailed out. However selectors containing ::slotted must always end
2165         up in m_slottedPseudoElementRules list no matter what else is there.
2166
2167         Fix by treating id like other selectors and only choosing the bucket after analysing all
2168         the selector components.
2169
2170         Test: fast/shadow-dom/css-scoping-slot-with-id.html
2171
2172         * css/RuleSet.cpp:
2173         (WebCore::RuleSet::addRule): Also made this use switch instead of a series of ifs.
2174
2175 2016-11-04  Brady Eidson  <beidson@apple.com>
2176
2177         IndexedDB 2.0: Handle IDBObjectStore rename behavior properly when version change transaction aborts.
2178         https://bugs.webkit.org/show_bug.cgi?id=164416
2179
2180         Reviewed by Beth Dakin.
2181
2182         No new tests (Covered by existing tests).
2183
2184         * Modules/indexeddb/IDBObjectStore.cpp:
2185         (WebCore::IDBObjectStore::rollbackForVersionChangeAbort):
2186
2187 2016-11-04  Keith Rollin  <krollin@apple.com>
2188
2189         NetworkSession: Add NetworkDataTask implementation for blobs
2190         https://bugs.webkit.org/show_bug.cgi?id=163939
2191
2192         Reviewed by Alex Christensen.
2193
2194         * WebCore.xcodeproj/project.pbxproj: Mark HTTPParsers.h and AsyncFileStream.h as private.
2195         * fileapi/AsyncFileStream.h: Add WEBCORE_EXPORT to AsyncFileStream class.
2196         * platform/network/BlobData.h: Add WEBCORE_EXPORT to length().
2197         * platform/network/HTTPParsers.h: Add WEBCORE_EXPORT to parseRange().
2198         * platform/network/ResourceResponseBase.h: Add WEBCORE_EXPORT to setHTTPHeaderField().
2199
2200 2016-11-04  Brady Eidson  <beidson@apple.com>
2201
2202         IndexedDB 2.0: Use IDB-specific exceptions in places where the generic exceptions are currently used.
2203         https://bugs.webkit.org/show_bug.cgi?id=164406
2204
2205         Reviewed by Alex Christensen.
2206
2207         No new tests (Covered by existing tests).
2208
2209         * Modules/indexeddb/IDBIndex.cpp:
2210         (WebCore::IDBIndex::setName):
2211
2212         * Modules/indexeddb/IDBObjectStore.cpp:
2213         (WebCore::IDBObjectStore::setName):
2214
2215 2016-11-04  Joanmarie Diggs  <jdiggs@igalia.com>
2216
2217         AX: [ATK] Attempting to clear selection on ARIA listboxes results in crash
2218         https://bugs.webkit.org/show_bug.cgi?id=164331
2219
2220         Reviewed by Chris Fleizach.
2221
2222         The ATK code is using is<AccessibilityListBox>() to identify native listboxes.
2223         But is<AccessibilityListBox>() returns the value of isListBox() which returns
2224         true both for AccessibilityListBox instances as well as for AccessibilityObject
2225         instances which have an AccessibilityRole value of ListBoxRole. Because only
2226         native listboxes should be AccessibilityListBoxes, add isNativeListBox() so
2227         that we can distinguish native and ARIA listboxes.
2228
2229         Tests: accessibility/aria-listbox-clear-selection-crash.html
2230                accessibility/listbox-clear-selection.html
2231
2232         * accessibility/AccessibilityListBox.h:
2233         * accessibility/AccessibilityObject.h:
2234         (WebCore::AccessibilityObject::isNativeListBox):
2235         (WebCore::AccessibilityObject::isListBox):
2236
2237 2016-11-04  Brady Eidson  <beidson@apple.com>
2238
2239         IndexedDB 2.0: Throw the correct exceptions during IDBObjectStore/IDBIndex renaming.
2240         https://bugs.webkit.org/show_bug.cgi?id=164405
2241
2242         Reviewed by Alex Christensen.
2243
2244         No new tests (Covered by existing tests).
2245
2246         * Modules/indexeddb/IDBIndex.cpp:
2247         (WebCore::IDBIndex::setName):
2248
2249         * Modules/indexeddb/IDBObjectStore.cpp:
2250         (WebCore::IDBObjectStore::setName):
2251
2252 2016-11-04  Romain Bellessort  <romain.bellessort@crf.canon.fr>
2253
2254         [Readable Streams API] Implement ByteStreamController error()
2255         https://bugs.webkit.org/show_bug.cgi?id=164319
2256
2257         Reviewed by Youenn Fablet.
2258
2259         Implemented error() method of ReadableByteStreamController.
2260
2261         Updated test expectations for error() and added IDL-related tests.
2262
2263         * Modules/streams/ReadableByteStreamController.js:
2264         (error): Implemented.
2265         * Modules/streams/ReadableByteStreamInternals.js:
2266         (privateInitializeReadableByteStreamController):
2267         (isReadableByteStreamController): Added.
2268         (readableByteStreamControllerError): Added.
2269         (readableByteStreamControllerClearPendingPullIntos): Added.
2270         * Modules/streams/ReadableStream.js:
2271         (initializeReadableStream): More detailed error message.
2272         * Modules/streams/ReadableStreamDefaultController.js:
2273         (error): Removed unnecessary variable declaration.
2274         * bindings/js/WebCoreBuiltinNames.h: Added totalQueuedBytes.
2275
2276 2016-11-03  Brady Eidson  <beidson@apple.com>
2277
2278         IndexedDB 2.0: Handle IDBIndex rename behavior properly when version change transaction aborts.
2279         https://bugs.webkit.org/show_bug.cgi?id=164403
2280
2281         Reviewed by Alex Christensen.
2282
2283         No new tests (Covered by existing test).
2284
2285         * Modules/indexeddb/IDBIndex.cpp:
2286         (WebCore::IDBIndex::rollbackInfoForVersionChangeAbort): Only rollback the info if this index
2287           already existed before this version change transaction.
2288
2289 2016-11-03  Youenn Fablet  <youenn@apple.com>
2290
2291         [WebRTC] Introduce asynchronous backend createOffer API
2292         https://bugs.webkit.org/show_bug.cgi?id=164365
2293
2294         Reviewed by Sam Weinig.
2295
2296         Covered by existing tests.
2297
2298         Removing PeerEndpointBackendClient as it is only RTCPeerConnection.
2299         This allows removing virtual for some functions.
2300
2301         Moving MediaEndpointPeerClient::m_client to PeerEndpointBackendClient::m_peerConnection and making it a reference.
2302
2303         Implementing createOffer at PeerConnectionBackend by splitting it in four sub-functions:
2304         - main createOffer, implemented at PeerConnectionBackend.
2305         - doCreateOffer implemented by subclasses (MediaEndpointPeerConnection).
2306         - createOfferSucceeded/createOfferFailed implemented by PeerConnectionBackend.
2307
2308         * CMakeLists.txt:
2309         * Modules/mediastream/MediaEndpointPeerConnection.cpp:
2310         (WebCore::createMediaEndpointPeerConnection):
2311         (WebCore::MediaEndpointPeerConnection::MediaEndpointPeerConnection):
2312         (WebCore::MediaEndpointPeerConnection::doCreateOffer):
2313         (WebCore::MediaEndpointPeerConnection::createOfferTask):
2314         (WebCore::MediaEndpointPeerConnection::createAnswerTask):
2315         (WebCore::MediaEndpointPeerConnection::setLocalDescriptionTask):
2316         (WebCore::MediaEndpointPeerConnection::setRemoteDescriptionTask):
2317         (WebCore::MediaEndpointPeerConnection::addIceCandidateTask):
2318         (WebCore::MediaEndpointPeerConnection::createReceiver):
2319         (WebCore::MediaEndpointPeerConnection::replaceTrack):
2320         (WebCore::MediaEndpointPeerConnection::replaceTrackTask):
2321         (WebCore::MediaEndpointPeerConnection::markAsNeedingNegotiation):
2322         (WebCore::MediaEndpointPeerConnection::localDescriptionTypeValidForState):
2323         (WebCore::MediaEndpointPeerConnection::remoteDescriptionTypeValidForState):
2324         (WebCore::MediaEndpointPeerConnection::gotIceCandidate):
2325         (WebCore::MediaEndpointPeerConnection::doneGatheringCandidates):
2326         (WebCore::MediaEndpointPeerConnection::iceTransportStateChanged):
2327         (WebCore::MediaEndpointPeerConnection::createOffer): Deleted.
2328         * Modules/mediastream/MediaEndpointPeerConnection.h:
2329         * Modules/mediastream/PeerConnectionBackend.cpp:
2330         (WebCore::PeerConnectionBackend::createOffer):
2331         (WebCore::PeerConnectionBackend::createOfferSucceeded):
2332         (WebCore::PeerConnectionBackend::createOfferFailed):
2333         (WebCore::createPeerConnectionBackend): Deleted.
2334         * Modules/mediastream/PeerConnectionBackend.h:
2335         (WebCore::PeerConnectionBackend::PeerConnectionBackend):
2336         (WebCore::PeerConnectionBackendClient::~PeerConnectionBackendClient): Deleted.
2337         * Modules/mediastream/RTCPeerConnection.cpp:
2338         (WebCore::RTCPeerConnection::RTCPeerConnection):
2339         * Modules/mediastream/RTCPeerConnection.h:
2340         * WebCore.xcodeproj/project.pbxproj:
2341
2342 2016-11-03  Antti Koivisto  <antti@apple.com>
2343
2344         REGRESSION (r207717): DumpRenderTree crashed in com.apple.WebCore: WebCore::Style::Scope::flushPendingUpdate + 16
2345         https://bugs.webkit.org/show_bug.cgi?id=164397
2346         <rdar://problem/29100135>
2347
2348         Reviewed by Ryosuke Niwa.
2349
2350         The problem here was that we were leaving stale pointers to Document::m_inDocumentShadowRoots set when
2351         using fast-path document teardown.
2352
2353         (Patch and stories mostly by rniwa).
2354
2355         * dom/Document.cpp:
2356         (WebCore::Document::~Document):
2357         (WebCore::Document::didInsertInDocumentShadowRoot):
2358         (WebCore::Document::didRemoveInDocumentShadowRoot):
2359
2360             Improve asserts.
2361
2362         * dom/Element.cpp:
2363         (WebCore::Element::removeShadowRoot):
2364
2365             Remove the superfluous call to notifyChildNodeRemoved in Element::removeShadowRoot to
2366             avoid invoking notifyChildNodeRemoved during a document teardown, which is incorrect. It's sufficient that
2367             ~ShadowRoot calls ContainerNode::removeDetachedChildren(), and in turn removeDetachedChildrenInContainer()
2368             since the latter function tears down nodes via the deletion queue during a document destruction and use
2369             notifyChildNodeRemoved() on nodes that outlive the shadow root.
2370
2371         * dom/ShadowRoot.cpp:
2372         (WebCore::ShadowRoot::~ShadowRoot):
2373
2374             Take care to clean up inDocumentShadowRoots for fast-pathed destruction too.
2375
2376         (WebCore::ShadowRoot::insertedInto):
2377         (WebCore::ShadowRoot::removedFrom):
2378
2379             Improve ShadowRoot's insertedInto and removedFrom so that they only try to add and remove itself from
2380             m_inDocumentShadowRoots when the connected-ness changes.
2381
2382 2016-11-03  Simon Fraser  <simon.fraser@apple.com>
2383
2384         Give all the geometry classes a single-argument scale() function for consistency
2385         https://bugs.webkit.org/show_bug.cgi?id=164400
2386
2387         Reviewed by Zalan Bujtas.
2388
2389         Add single-argument scale() to FloatPoint, FloatQuad, FloatSize and LayoutPoint, as well
2390         as adding one to GraphicsContext. Switch callers who passed the same value for sx and sy
2391         to the new functions.
2392
2393         * dom/Document.cpp:
2394         (WebCore::Document::adjustFloatQuadsForScrollAndAbsoluteZoomAndFrameScale):
2395         * dom/MouseRelatedEvent.cpp:
2396         (WebCore::MouseRelatedEvent::init):
2397         (WebCore::MouseRelatedEvent::computeRelativePosition):
2398         * dom/TreeScope.cpp:
2399         (WebCore::TreeScope::nodeFromPoint):
2400         * page/PrintContext.cpp:
2401         (WebCore::PrintContext::spoolPage):
2402         * platform/cocoa/ThemeCocoa.mm:
2403         (WebCore::fitContextToBox):
2404         * platform/graphics/FloatPoint.h:
2405         (WebCore::FloatPoint::scale):
2406         * platform/graphics/FloatQuad.h:
2407         (WebCore::FloatQuad::scale):
2408         * platform/graphics/FloatSize.h:
2409         (WebCore::FloatSize::scale):
2410         * platform/graphics/GraphicsContext.cpp:
2411         (WebCore::GraphicsContext::applyDeviceScaleFactor):
2412         * platform/graphics/GraphicsContext.h:
2413         (WebCore::GraphicsContext::scale):
2414         * platform/graphics/LayoutPoint.h:
2415         (WebCore::LayoutPoint::scale):
2416         * platform/graphics/ca/TileCoverageMap.cpp:
2417         (WebCore::TileCoverageMap::update):
2418         * platform/graphics/ca/TileGrid.cpp:
2419         (WebCore::TileGrid::platformCALayerPaintContents):
2420         * platform/graphics/cg/ImageBufferCG.cpp:
2421         (WebCore::ImageBuffer::drawConsuming):
2422         (WebCore::ImageBuffer::draw):
2423         (WebCore::ImageBuffer::drawPattern):
2424         * platform/mac/ThemeMac.mm:
2425         (WebCore::paintToggleButton):
2426         (WebCore::paintButton):
2427         (WebCore::paintStepper):
2428         * rendering/RenderImage.cpp:
2429         (WebCore::RenderImage::nodeAtPoint):
2430         * rendering/RenderMediaControls.cpp:
2431         (WebCore::getUnzoomedRectAndAdjustCurrentContext):
2432         * rendering/RenderThemeMac.mm:
2433         (WebCore::RenderThemeMac::paintMenuList):
2434         (WebCore::RenderThemeMac::paintSliderThumb):
2435         (WebCore::RenderThemeMac::paintSearchField):
2436         (WebCore::RenderThemeMac::paintSearchFieldCancelButton):
2437         (WebCore::RenderThemeMac::paintSearchFieldResultsButton):
2438         * rendering/svg/SVGInlineTextBox.cpp:
2439         (WebCore::SVGInlineTextBox::selectionRectForTextFragment):
2440         (WebCore::SVGInlineTextBox::paintDecorationWithStyle):
2441         (WebCore::SVGInlineTextBox::paintTextWithShadows):
2442         * svg/SVGPathBlender.cpp:
2443         (WebCore::SVGPathBlender::blendAnimatedFloatPoint):
2444         (WebCore::SVGPathBlender::blendArcToSegment):
2445         * svg/SVGPathParser.cpp:
2446         (WebCore::SVGPathParser::parseCurveToCubicSmoothSegment):
2447         (WebCore::SVGPathParser::parseCurveToQuadraticSegment):
2448         (WebCore::SVGPathParser::parseCurveToQuadraticSmoothSegment):
2449         (WebCore::SVGPathParser::decomposeArcToCubic):
2450         * svg/SVGSVGElement.cpp:
2451         (WebCore::SVGSVGElement::localCoordinateSpaceTransform):
2452
2453 2016-11-03  Antti Koivisto  <antti@apple.com>
2454
2455         REGRESSION (r207669): Crash under media controls shadow root construction
2456         https://bugs.webkit.org/show_bug.cgi?id=164381
2457         <rdar://problem/28935401>
2458
2459         Reviewed by Simon Fraser.
2460
2461         The problem is that we are running a script for media control UA shadow tree in HTMLMediaElement::insertedInto.
2462         It is not safe to run scripts in insertedInto as the tree is in inconsistent state. Instead finishedInsertingSubtree
2463         callback should be used.
2464
2465         Test: media/media-controls-shadow-construction-crash.html
2466
2467         Seen on https://www.theguardian.com/artanddesign/video/2013/oct/14/banksy-central-park-new-york-video
2468
2469         * html/HTMLMediaElement.cpp:
2470         (WebCore::HTMLMediaElement::insertedInto):
2471         (WebCore::HTMLMediaElement::finishedInsertingSubtree):
2472
2473             Move configureMediaControls() to finishedInsertingSubtree().
2474
2475         * html/HTMLMediaElement.h:
2476         * style/StyleTreeResolver.cpp:
2477         (WebCore::Style::TreeResolver::resolveComposedTree):
2478
2479             Add an assert to make the bad state easier to hit in tests.
2480
2481 2016-11-03  Ryosuke Niwa  <rniwa@webkit.org>
2482
2483         Add an assertion to diagnose stress GC bots test failures
2484         https://bugs.webkit.org/show_bug.cgi?id=164396
2485
2486         Reviewed by Antti Koivisto.
2487
2488         Added an assertion for calling ElementQueue::add while ElementQueue::invokeAll is in progress.
2489         This should never happen as long as all DOM API has an appropriate CEReactions IDL attribute.
2490
2491         * dom/CustomElementReactionQueue.cpp:
2492         (WebCore::CustomElementReactionStack::ElementQueue::add):
2493         (WebCore::CustomElementReactionStack::ElementQueue::invokeAll):
2494         * dom/CustomElementReactionQueue.h:
2495
2496 2016-11-03  Said Abou-Hallawa  <sabouhallawa@apple.com>
2497
2498         Add the asynchronous image decoding mode
2499         https://bugs.webkit.org/show_bug.cgi?id=155546
2500
2501         Reviewed by Simon Fraser.
2502
2503         The asynchronous image decoding feature targets enhancing the rendering
2504         in two scenarios: the animated images and scrolling a page which large
2505         images. Enabling this feature for these two scenarios will be landed
2506         separately. 
2507
2508         The goal of the asynchronous image decoding is to have the decoded image
2509         frame ready before it has to be drawn. Drawing an image does not have to
2510         wait the image frame to be decoded.
2511
2512         * platform/graphics/BitmapImage.cpp:
2513         (WebCore::BitmapImage::frameImageAtIndex): Use the negation of frameHasValidNativeImageAtIndex().
2514         * platform/graphics/BitmapImage.h:
2515         (WebCore::BitmapImage::frameIsBeingDecodedAtIndex): Answers whether a frame is being decoded.
2516         (WebCore::BitmapImage::frameHasValidNativeImageAtIndex): Checks the validity of a frame.
2517         (WebCore::BitmapImage::frameHasInvalidNativeImageAtIndex): Deleted.
2518         * platform/graphics/Image.h:
2519         (WebCore::Image::newFrameNativeImageAvailableAtIndex): Notifies the image with the availability of a frame NativeImage.
2520         * platform/graphics/ImageFrame.h:
2521         (WebCore::ImageFrame::isBeingDecoded): Answers whether the frame is being decoded.
2522         (WebCore::ImageFrame::hasValidNativeImage): Checks the validity of the frame.
2523         (WebCore::ImageFrame::hasInvalidNativeImage): Deleted.
2524         * platform/graphics/ImageFrameCache.cpp:
2525         (WebCore::ImageFrameCache::~ImageFrameCache): Asserts the decoding loop was ended before deleting the ImageFrameCache.
2526         (WebCore::ImageFrameCache::setFrameNativeImageAtIndex): Rename this function to matches the other which take the frame index.
2527         (WebCore::ImageFrameCache::setFrameMetadataAtIndex): Ditto.
2528         (WebCore::ImageFrameCache::replaceFrameNativeImageAtIndex): It setts the ImageFrame's members and updates the decoded size.
2529         (WebCore::ImageFrameCache::cacheFrameNativeImageAtIndex): Replaces the frame NativeImage and notifies the Image with the new frame.
2530         (WebCore::ImageFrameCache::decodingQueue): Ensures the decoding WorkQueue is created and returns it.
2531         (WebCore::ImageFrameCache::startAsyncDecodingQueue): Starts a decoding WorkQueue which loops until m_frameRequestQueue is closed.
2532         (WebCore::ImageFrameCache::requestFrameAsyncDecodingAtIndex): Allows ImageSource to send a request to start asynchronous frame image decoding.
2533         (WebCore::ImageFrameCache::stopAsyncDecodingQueue): Stops the decoding WorkQueue by closing m_frameRequestQueue.
2534         (WebCore::ImageFrameCache::frameAtIndex): Call replaceFrameNativeImageAtIndex().
2535         (WebCore::ImageFrameCache::frameIsBeingDecodedAtIndex): Returns true if a request for the image frame is issued but not finished yet.
2536         (WebCore::ImageFrameCache::frameHasValidNativeImageAtIndex): Checks the validity of a frame.
2537         (WebCore::ImageFrameCache::setFrameNativeImage): Deleted. Was renamed to be setFrameNativeImageAtIndex.
2538         (WebCore::ImageFrameCache::setFrameMetadata): Deleted. Was renamed to be setFrameMetadataAtIndex
2539         (WebCore::ImageFrameCache::frameHasInvalidNativeImageAtIndex): Deleted. Was renamed to be frameHasValidNativeImageAtIndex.
2540         * platform/graphics/ImageFrameCache.h:
2541         (WebCore::ImageFrameCache::create): The decoding queue needs to hold a reference to this class so it can stop decoding safely without blocking.
2542         (WebCore::ImageFrameCache::hasDecodingQueue): Returns true if a decoding queue has started.
2543         * platform/graphics/ImageSource.cpp:
2544         (WebCore::ImageSource::ImageSource): Call ImageFrameCache::create().
2545         (WebCore::ImageSource::clear): Deleting the decoder is unnecessary for asynchronous decoding because ImageFrameCache manages all the memory.
2546         
2547         (WebCore::ImageSource::destroyDecodedData):
2548         (WebCore::ImageSource::destroyDecodedDataIfNecessary):
2549         (WebCore::ImageSource::ensureDecoderAvailable):
2550         (WebCore::ImageSource::dataChanged):
2551         (WebCore::ImageSource::isAllDataReceived):
2552         (WebCore::ImageSource::isAsyncDecodingRequired): Answers the question whether the async image decoding is required for this ImageSource.
2553         (WebCore::ImageSource::frameImageAtIndex):
2554         * platform/graphics/ImageSource.h:
2555         (WebCore::ImageSource::decodedSize):
2556         (WebCore::ImageSource::requestFrameAsyncDecodingAtIndex):
2557         (WebCore::ImageSource::stopAsyncDecodingQueue):
2558         (WebCore::ImageSource::isSizeAvailable):
2559         (WebCore::ImageSource::frameCount):
2560         (WebCore::ImageSource::repetitionCount):
2561         (WebCore::ImageSource::filenameExtension):
2562         (WebCore::ImageSource::hotSpot):
2563         (WebCore::ImageSource::size):
2564         (WebCore::ImageSource::sizeRespectingOrientation):
2565         (WebCore::ImageSource::singlePixelSolidColor):
2566         (WebCore::ImageSource::frameIsBeingDecodedAtIndex):
2567         (WebCore::ImageSource::frameIsCompleteAtIndex):
2568         (WebCore::ImageSource::frameHasAlphaAtIndex):
2569         (WebCore::ImageSource::frameHasImageAtIndex):
2570         (WebCore::ImageSource::frameSubsamplingLevelAtIndex):
2571         (WebCore::ImageSource::frameSizeAtIndex):
2572         (WebCore::ImageSource::frameBytesAtIndex):
2573         (WebCore::ImageSource::frameDurationAtIndex):
2574         (WebCore::ImageSource::frameOrientationAtIndex):
2575          Make m_frameCache a type Ref<ImageFrameCache>. Use '->' instead of '.' when accessing its members.
2576
2577         (WebCore::ImageSource::frameHasValidNativeImageAtIndex): Checks the validity of a frame.
2578         (WebCore::ImageSource::frameHasInvalidNativeImageAtIndex): Deleted. Was renamed to be frameHasValidNativeImageAtIndex.
2579
2580 2016-11-03  Myles C. Maxfield  <mmaxfield@apple.com>
2581
2582         [WebGL2] Implement getBufferSubData()
2583         https://bugs.webkit.org/show_bug.cgi?id=164111
2584
2585         Reviewed by Dean Jackson.
2586
2587         The call exists in OpenGL 3.2 but in order to have parity with
2588         OpenGL ES 3 we back it with glMapBufferRange() instead.
2589
2590         This patch simply adds surface area to GraphicsContext3D
2591         until we can get an ANGLE implementation of it.
2592
2593         When testing this patch I discovered that r207649 incorrectly
2594         interpreted arguments to bufferData() and bufferSubData() as
2595         byte offsets. Instead, they should be element indices. This
2596         patch fixes those functions to work correctly so that
2597         getBufferSubData() can be tested correctly.
2598
2599         Tests: fast/canvas/webgl/webgl2-buffers.html
2600                fast/canvas/webgl/getBufferSubData-webgl1.html
2601
2602         * html/canvas/WebGL2RenderingContext.cpp:
2603         (WebCore::arrayBufferViewElementSize):
2604         (WebCore::WebGL2RenderingContext::bufferData):
2605         (WebCore::WebGL2RenderingContext::bufferSubData):
2606         (WebCore::WebGL2RenderingContext::getBufferSubData):
2607         * html/canvas/WebGL2RenderingContext.h:
2608         * html/canvas/WebGL2RenderingContext.idl:
2609         * platform/graphics/GraphicsContext3D.h:
2610         * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
2611         (WebCore::GraphicsContext3D::getBufferSubData):
2612         (WebCore::GraphicsContext3D::mapBufferRange):
2613         (WebCore::GraphicsContext3D::unmapBuffer):
2614
2615 2016-11-03  Chris Dumez  <cdumez@apple.com>
2616
2617         Unreviewed, mark support for the 'download' attribute as 'Done'.
2618
2619         * features.json:
2620
2621 2016-11-03  Chris Dumez  <cdumez@apple.com>
2622
2623         [WK2][Cocoa] Implement user interface for HTML form validation
2624         https://bugs.webkit.org/show_bug.cgi?id=164143
2625         <rdar://problem/28944652>
2626
2627         Reviewed by Simon Fraser.
2628
2629         Add ValidationBubble class to show HTML form validation messages
2630         using native dialogs. It currently has an implementation for both
2631         Mac and iOS. It is in WebCore under platform/ so that it can be
2632         used by both WebKit1 and WebKit2.
2633
2634         Update ownership of ValidationMessageClient so that is is owned
2635         by the Page using a unique_ptr<>, which seems to be the modern
2636         way of handling lifetime for page clients.
2637
2638         Test: fast/forms/validation-messages.html
2639
2640         * WebCore.xcodeproj/project.pbxproj:
2641         * html/HTMLFormControlElement.cpp:
2642         (WebCore::HTMLFormControlElement::focusAndShowValidationMessage):
2643         * html/ValidationMessage.cpp:
2644         (WebCore::ValidationMessage::updateValidationMessage):
2645         * page/Page.cpp:
2646         (WebCore::Page::Page):
2647         (WebCore::Page::~Page):
2648         * page/Page.h:
2649         (WebCore::Page::validationMessageClient):
2650         * page/PageConfiguration.cpp:
2651         * page/PageConfiguration.h:
2652         * platform/ValidationBubble.h: Copied from Tools/DumpRenderTree/mac/UIScriptControllerMac.mm.
2653         (WebCore::ValidationBubble::message):
2654         * platform/ios/ValidationBubbleIOS.mm: Added.
2655         (-[WebValidationBubbleDelegate adaptivePresentationStyleForPresentationController:traitCollection:]):
2656         (WebCore::ValidationBubble::ValidationBubble):
2657         (WebCore::ValidationBubble::~ValidationBubble):
2658         (WebCore::ValidationBubble::show):
2659         (WebCore::ValidationBubble::setAnchorRect):
2660         * platform/mac/ValidationBubbleMac.mm: Added.
2661         (WebCore::ValidationBubble::ValidationBubble):
2662         (WebCore::ValidationBubble::~ValidationBubble):
2663         (WebCore::ValidationBubble::showRelativeTo):
2664
2665 2016-11-03  Brady Eidson  <beidson@apple.com>
2666
2667         IndexedDB 2.0: Rename IDBKeyRange.contains to IDBKeyRange.includes.
2668         https://bugs.webkit.org/show_bug.cgi?id=164383
2669
2670         Reviewed by Beth Dakin.
2671
2672         No new tests (Updated existing tests).
2673
2674         * Modules/indexeddb/IDBKeyRange.cpp:
2675         (WebCore::IDBKeyRange::includes):
2676         (WebCore::IDBKeyRange::contains): Deleted.
2677         * Modules/indexeddb/IDBKeyRange.h:
2678         * Modules/indexeddb/IDBKeyRange.idl:
2679
2680 2016-11-03  Ryan Haddad  <ryanhaddad@apple.com>
2681
2682         Unreviewed, rolling out r208302.
2683
2684         This change causes LayoutTest crashes under GuardMalloc.
2685
2686         Reverted changeset:
2687
2688         "Load stylesheets in link elements inside a connected shadow
2689         tree"
2690         https://bugs.webkit.org/show_bug.cgi?id=160683
2691         http://trac.webkit.org/changeset/208302
2692
2693 2016-11-03  Chris Dumez  <cdumez@apple.com>
2694
2695         Unreviewed, add HTML5 specification for HTML Interactive Form Validation feature.
2696
2697         * features.json:
2698
2699 2016-11-03  Chris Dumez  <cdumez@apple.com>
2700
2701         Unreviewed, add HTML Interactive Form Validation to features.json
2702
2703         * features.json:
2704
2705 2016-11-03  Yusuke Suzuki  <utatane.tea@gmail.com>
2706
2707         Unreviewed, rolling out due to crash in Amazon web site
2708         https://bugs.webkit.org/show_bug.cgi?id=164380
2709         <rdar://problem/29094221>
2710
2711         * dom/Node.idl:
2712         * domjit/JSNodeDOMJIT.cpp:
2713         (WebCore::NodeOwnerDocumentDOMJIT::checkDOM): Deleted.
2714         (WebCore::NodeOwnerDocumentDOMJIT::callDOMGetter): Deleted.
2715
2716 2016-11-03  Brady Eidson  <beidson@apple.com>
2717
2718         IndexedDB 2.0: Support binary keys.
2719         <rdar://problem/28806927> and https://bugs.webkit.org/show_bug.cgi?id=164359
2720
2721         Reviewed by Alex Christensen.
2722
2723         Tests: storage/indexeddb/modern/binary-keys-1-private.html
2724                storage/indexeddb/modern/binary-keys-1.html
2725                Changes to other existing tests.
2726
2727         * Modules/indexeddb/IDBKey.cpp:
2728         (WebCore::IDBKey::createBinary):
2729         (WebCore::IDBKey::IDBKey):
2730         (WebCore::IDBKey::compare):
2731         * Modules/indexeddb/IDBKey.h:
2732         (WebCore::IDBKey::binary):
2733         (WebCore::compareBinaryKeyData):
2734
2735         * Modules/indexeddb/IDBKeyData.cpp:
2736         (WebCore::IDBKeyData::IDBKeyData):
2737         (WebCore::IDBKeyData::maybeCreateIDBKey):
2738         (WebCore::IDBKeyData::isolatedCopy):
2739         (WebCore::IDBKeyData::encode):
2740         (WebCore::IDBKeyData::decode):
2741         (WebCore::IDBKeyData::compare):
2742         (WebCore::IDBKeyData::loggingString):
2743         (WebCore::IDBKeyData::operator==):
2744         * Modules/indexeddb/IDBKeyData.h:
2745         (WebCore::IDBKeyData::hash):
2746         (WebCore::IDBKeyData::encode):
2747         (WebCore::IDBKeyData::decode):
2748
2749         * Modules/indexeddb/IndexedDB.h: Add new enum for the new key type.
2750
2751         * bindings/js/IDBBindingUtilities.cpp:
2752         (WebCore::toJS):
2753         (WebCore::createIDBKeyFromValue):
2754
2755         * platform/ThreadSafeDataBuffer.h:
2756         (WebCore::ThreadSafeDataBufferImpl::ThreadSafeDataBufferImpl):
2757         (WebCore::ThreadSafeDataBuffer::copyData):
2758         (WebCore::ThreadSafeDataBuffer::size):
2759         (WebCore::ThreadSafeDataBuffer::operator==):
2760         (WebCore::ThreadSafeDataBuffer::ThreadSafeDataBuffer):
2761
2762 2016-11-03  Tim Horton  <timothy_horton@apple.com>
2763
2764         Printing to PDF should produce internal links when HTML has internal links
2765         https://bugs.webkit.org/show_bug.cgi?id=112081
2766         <rdar://problem/5955705>
2767
2768         Reviewed by Simon Fraser.
2769         Patch originally by David Lattimore.
2770
2771         No new tests, as it's unclear how to test PDF output.
2772
2773         * dom/Element.cpp:
2774         (WebCore::Element::findAnchorElementForLink):
2775         * dom/Element.h:
2776         Add findAnchorElementForLink, which looks up the anchor element corresponding
2777         to the current element's href, and also returns the fragment name as an out parameter.
2778
2779         * page/PrintContext.cpp:
2780         (WebCore::PrintContext::PrintContext):
2781         (WebCore::PrintContext::spoolPage):
2782         (WebCore::PrintContext::spoolRect):
2783         (WebCore::PrintContext::end):
2784         (WebCore::PrintContext::collectLinkedDestinations):
2785         (WebCore::PrintContext::outputLinkedDestinations):
2786         * rendering/RenderObject.cpp:
2787         (WebCore::RenderObject::addPDFURLRect):
2788         Plumb internal links (fragment links) through to GraphicsContext, using
2789         the fragment name from the page.
2790
2791         * page/PrintContext.h:
2792         * platform/graphics/GraphicsContext.cpp:
2793         (WebCore::GraphicsContext::supportsInternalLinks):
2794         (WebCore::GraphicsContext::setDestinationForRect):
2795         (WebCore::GraphicsContext::addDestinationAtPoint):
2796         * platform/graphics/GraphicsContext.h:
2797         * platform/graphics/cg/GraphicsContextCG.cpp:
2798         (WebCore::GraphicsContext::supportsInternalLinks):
2799         (WebCore::GraphicsContext::setDestinationForRect):
2800         (WebCore::GraphicsContext::addDestinationAtPoint):
2801         Plumb internal links through to the CGContext. Apply the CTM, because
2802         these functions expect positions in global coordinates.
2803
2804         * platform/graphics/win/GraphicsContextDirect2D.cpp:
2805         (WebCore::GraphicsContext::setURLForRect):
2806         * platform/graphics/cairo/GraphicsContextCairo.cpp:
2807         (WebCore::GraphicsContext::setURLForRect):
2808         Adjust setURLForRect to take a FloatRect, like everything else, and
2809         stop rounding.
2810
2811 2016-11-03  Alex Christensen  <achristensen@webkit.org>
2812
2813         Unreviewed, rolling out r208298.
2814         https://bugs.webkit.org/show_bug.cgi?id=163939
2815
2816         caused asan crashes
2817
2818         Reverted changeset:
2819
2820         "NetworkSession: Add NetworkDataTask implementation for blobs"
2821         https://bugs.webkit.org/show_bug.cgi?id=163939
2822         http://trac.webkit.org/changeset/208298
2823
2824 2016-11-03  Brent Fulgham  <bfulgham@apple.com>
2825
2826         [Win][Direct2D] Native Windows widgets are drawn upside-down
2827         https://bugs.webkit.org/show_bug.cgi?id=164370
2828
2829         Reviewed by Alex Christensen.
2830
2831         When we return from drawing in GDI code, we need to flip the resulting
2832         bitmap so that it draws in the proper orientation in Direct2D.
2833
2834         Tested by existing widget tests.
2835
2836         * platform/graphics/win/GraphicsContextDirect2D.cpp:
2837         (WebCore::GraphicsContext::releaseWindowsContext): Flip before drawing
2838         to our Direct2D context.
2839
2840 2016-11-01  Gavin Barraclough  <barraclough@apple.com>
2841
2842         Remove PageThrottler & all related code
2843         https://bugs.webkit.org/show_bug.cgi?id=164302
2844
2845         Reviewed by Ryosuke Niwa.
2846
2847         All relevant information now available from the ActivityState.
2848
2849         * CMakeLists.txt:
2850         * WebCore.xcodeproj/project.pbxproj:
2851         * html/HTMLMediaElement.cpp:
2852         (WebCore::HTMLMediaElement::setMuted):
2853         (WebCore::HTMLMediaElement::updateVolume):
2854         (WebCore::HTMLMediaElement::updatePlayState):
2855         (WebCore::HTMLMediaElement::updateAudioAssertionState): Deleted.
2856         * html/HTMLMediaElement.h:
2857         * loader/FrameLoader.cpp:
2858         (WebCore::FrameLoader::completed):
2859         (WebCore::FrameLoader::started):
2860         * loader/FrameLoader.h:
2861         * page/ChromeClient.h:
2862         * page/Page.cpp:
2863         (WebCore::Page::Page):
2864         * page/Page.h:
2865         (WebCore::Page::pageActivityStateChanged): Deleted.
2866         (WebCore::Page::pageThrottler): Deleted.
2867         * page/PageThrottler.cpp: Removed.
2868         * page/PageThrottler.h: Removed.
2869
2870 2016-11-03  Dan Bernstein  <mitz@apple.com>
2871
2872         REGRESSION (r206247): Painting milestones can be delayed until the next layer flush
2873         https://bugs.webkit.org/show_bug.cgi?id=164340
2874         <rdar://problem/29074344>
2875
2876         Reviewed by Tim Horton.
2877
2878         To give WebKit a chance to deliver the painting milestones to its client after the commit,
2879         we must tell it about them before or during the commit. To that end, we should not defer
2880         the call to firePaintRelatedMilestonesIfNeeded until after the commit.
2881
2882         * rendering/RenderLayerCompositor.cpp:
2883         (WebCore::RenderLayerCompositor::RenderLayerCompositor): Removed
2884           m_paintRelatedMilestonesTimer initializer.
2885         (WebCore::RenderLayerCompositor::didPaintBacking): Call
2886           FrameView::firePaintRelatedMilestonesIfNeeded directly from here.
2887         (WebCore::RenderLayerCompositor::paintRelatedMilestonesTimerFired): Deleted.
2888         * rendering/RenderLayerCompositor.h:
2889
2890 2016-11-03  Antti Koivisto  <antti@apple.com>
2891
2892         imported/mozilla/svg/paint-order-01.svg and imported/mozilla/svg/paint-order-02.svg are flaky failures
2893         https://bugs.webkit.org/show_bug.cgi?id=164355
2894
2895         Reviewed by Ryosuke Niwa.
2896
2897         Revert one change from https://trac.webkit.org/changeset/207669 to see if it is causing flakiness in
2898         some XML based tests.
2899
2900         * xml/parser/XMLDocumentParser.cpp:
2901         (WebCore::XMLDocumentParser::end):
2902
2903 2016-11-02  Yusuke Suzuki  <utatane.tea@gmail.com>
2904
2905         Unreviewed, fix CLoop build after r208320.
2906         https://bugs.webkit.org/show_bug.cgi?id=162980
2907
2908         Guard with ENABLE(JIT).
2909
2910         * bindings/scripts/CodeGeneratorJS.pm:
2911         (GenerateImplementation):
2912         * bindings/scripts/test/JS/JSTestDOMJIT.cpp:
2913
2914 2016-11-02  Brady Eidson  <beidson@apple.com>
2915
2916         Expand upon IndexedDB status in features.json.
2917         
2918         * features.json:
2919
2920 2016-11-02  Myles C. Maxfield  <mmaxfield@apple.com>
2921
2922         CSS.supports("font-variation-settings", "'wght' 500") erroneously returns false
2923         https://bugs.webkit.org/show_bug.cgi?id=164244
2924
2925         Reviewed by Michael Catanzaro.
2926
2927         Because we weren't passing a Document into CSSParserContext's constructor,
2928         there was no way for our parser to know whether the runtime switch was on
2929         or not. Instead, we can use the CallWith attribute in the IDL file to pass
2930         in a Document.
2931
2932         Test: fast/text/variations/css-supports-runtime-switch.html
2933
2934         * css/DOMCSSNamespace.cpp:
2935         (WebCore::DOMCSSNamespace::supports):
2936         * css/DOMCSSNamespace.h:
2937         * css/DOMCSSNamespace.idl:
2938
2939 2016-11-02  Yusuke Suzuki  <utatane.tea@gmail.com>
2940
2941         [DOMJIT] Add DOMJIT::Signature
2942         https://bugs.webkit.org/show_bug.cgi?id=162980
2943
2944         Reviewed by Saam Barati and Sam Weinig.
2945
2946         We introduce DOMJIT::Signature. This signature object is automatically generated by IDL code generator.
2947         It holds (1) types, (2) pointer to the unsafe function (the function without checks), and (3) the effect
2948         of the function. We use constexpr to initialize DOMJIT::Signature without invoking global constructors.
2949         Thus the content is embedded into the binary as the constant values.
2950
2951         We also clean up the IDL code generator related to DOMJIT part. Instead of switching things inside IDL
2952         code generator, we use C++ template to dispatch things at compile time. This template meta programming
2953         is highly utilized in IDL these days.
2954
2955         To make DOMJIT::Signature constexpr, we also need to define DOMJIT abstract heap things in the build time.
2956         To do so, we introduce a tiny Ruby script to calculate the range of abstract heaps. We can offer the abstract
2957         heap tree as YAML format and the script will produce a C++ header holding the calculated abstract heap ranges
2958
2959         * CMakeLists.txt:
2960         * DerivedSources.make:
2961         * ForwardingHeaders/bytecode/SpeculatedType.h: Renamed from Source/WebCore/domjit/DOMJITAbstractHeapRepository.h.
2962         * ForwardingHeaders/domjit/DOMJITSignature.h: Renamed from Source/WebCore/domjit/DOMJITAbstractHeapRepository.cpp.
2963         * WebCore.xcodeproj/project.pbxproj:
2964         * bindings/js/JSDOMGlobalObject.h:
2965         * bindings/scripts/CodeGeneratorJS.pm:
2966         (GenerateHeader):
2967         (GeneratePropertiesHashTable):
2968         (GetUnsafeArgumentType):
2969         (GetArgumentTypeFilter):
2970         (GetResultTypeFilter):
2971         (GenerateImplementation):
2972         (UnsafeToNative):
2973         (GenerateHashTableValueArray):
2974         (ComputeFunctionSpecial):
2975         * bindings/scripts/IDLAttributes.txt:
2976         * bindings/scripts/test/JS/JSTestDOMJIT.cpp:
2977         (WebCore::BindingCaller<JSTestDOMJIT>::castForOperation):
2978         (WebCore::TestDOMJITAnyAttrDOMJIT::TestDOMJITAnyAttrDOMJIT):
2979         (WebCore::TestDOMJITBooleanAttrDOMJIT::TestDOMJITBooleanAttrDOMJIT):
2980         (WebCore::TestDOMJITByteAttrDOMJIT::TestDOMJITByteAttrDOMJIT):
2981         (WebCore::TestDOMJITOctetAttrDOMJIT::TestDOMJITOctetAttrDOMJIT):
2982         (WebCore::TestDOMJITShortAttrDOMJIT::TestDOMJITShortAttrDOMJIT):
2983         (WebCore::TestDOMJITUnsignedShortAttrDOMJIT::TestDOMJITUnsignedShortAttrDOMJIT):
2984         (WebCore::TestDOMJITLongAttrDOMJIT::TestDOMJITLongAttrDOMJIT):
2985         (WebCore::TestDOMJITUnsignedLongAttrDOMJIT::TestDOMJITUnsignedLongAttrDOMJIT):
2986         (WebCore::TestDOMJITLongLongAttrDOMJIT::TestDOMJITLongLongAttrDOMJIT):
2987         (WebCore::TestDOMJITUnsignedLongLongAttrDOMJIT::TestDOMJITUnsignedLongLongAttrDOMJIT):
2988         (WebCore::TestDOMJITFloatAttrDOMJIT::TestDOMJITFloatAttrDOMJIT):
2989         (WebCore::TestDOMJITUnrestrictedFloatAttrDOMJIT::TestDOMJITUnrestrictedFloatAttrDOMJIT):
2990         (WebCore::TestDOMJITDoubleAttrDOMJIT::TestDOMJITDoubleAttrDOMJIT):
2991         (WebCore::TestDOMJITUnrestrictedDoubleAttrDOMJIT::TestDOMJITUnrestrictedDoubleAttrDOMJIT):
2992         (WebCore::TestDOMJITDomStringAttrDOMJIT::TestDOMJITDomStringAttrDOMJIT):
2993         (WebCore::TestDOMJITByteStringAttrDOMJIT::TestDOMJITByteStringAttrDOMJIT):
2994         (WebCore::TestDOMJITUsvStringAttrDOMJIT::TestDOMJITUsvStringAttrDOMJIT):
2995         (WebCore::TestDOMJITNodeAttrDOMJIT::TestDOMJITNodeAttrDOMJIT):
2996         (WebCore::TestDOMJITBooleanNullableAttrDOMJIT::TestDOMJITBooleanNullableAttrDOMJIT):
2997         (WebCore::TestDOMJITByteNullableAttrDOMJIT::TestDOMJITByteNullableAttrDOMJIT):
2998         (WebCore::TestDOMJITOctetNullableAttrDOMJIT::TestDOMJITOctetNullableAttrDOMJIT):
2999         (WebCore::TestDOMJITShortNullableAttrDOMJIT::TestDOMJITShortNullableAttrDOMJIT):
3000         (WebCore::TestDOMJITUnsignedShortNullableAttrDOMJIT::TestDOMJITUnsignedShortNullableAttrDOMJIT):
3001         (WebCore::TestDOMJITLongNullableAttrDOMJIT::TestDOMJITLongNullableAttrDOMJIT):
3002         (WebCore::TestDOMJITUnsignedLongNullableAttrDOMJIT::TestDOMJITUnsignedLongNullableAttrDOMJIT):
3003         (WebCore::TestDOMJITLongLongNullableAttrDOMJIT::TestDOMJITLongLongNullableAttrDOMJIT):
3004         (WebCore::TestDOMJITUnsignedLongLongNullableAttrDOMJIT::TestDOMJITUnsignedLongLongNullableAttrDOMJIT):
3005         (WebCore::TestDOMJITFloatNullableAttrDOMJIT::TestDOMJITFloatNullableAttrDOMJIT):
3006         (WebCore::TestDOMJITUnrestrictedFloatNullableAttrDOMJIT::TestDOMJITUnrestrictedFloatNullableAttrDOMJIT):
3007         (WebCore::TestDOMJITDoubleNullableAttrDOMJIT::TestDOMJITDoubleNullableAttrDOMJIT):
3008         (WebCore::TestDOMJITUnrestrictedDoubleNullableAttrDOMJIT::TestDOMJITUnrestrictedDoubleNullableAttrDOMJIT):
3009         (WebCore::TestDOMJITDomStringNullableAttrDOMJIT::TestDOMJITDomStringNullableAttrDOMJIT):
3010         (WebCore::TestDOMJITByteStringNullableAttrDOMJIT::TestDOMJITByteStringNullableAttrDOMJIT):
3011         (WebCore::TestDOMJITUsvStringNullableAttrDOMJIT::TestDOMJITUsvStringNullableAttrDOMJIT):
3012         (WebCore::TestDOMJITNodeNullableAttrDOMJIT::TestDOMJITNodeNullableAttrDOMJIT):
3013         (WebCore::jsTestDOMJITPrototypeFunctionGetAttribute):
3014         (WebCore::jsTestDOMJITPrototypeFunctionGetAttributeCaller):
3015         (WebCore::unsafeJsTestDOMJITPrototypeFunctionGetAttribute):
3016         (WebCore::jsTestDOMJITPrototypeFunctionItem):
3017         (WebCore::jsTestDOMJITPrototypeFunctionItemCaller):
3018         (WebCore::unsafeJsTestDOMJITPrototypeFunctionItem):
3019         (WebCore::jsTestDOMJITPrototypeFunctionHasAttribute):
3020         (WebCore::jsTestDOMJITPrototypeFunctionHasAttributeCaller):
3021         (WebCore::unsafeJsTestDOMJITPrototypeFunctionHasAttribute):
3022         (WebCore::jsTestDOMJITPrototypeFunctionGetElementById):
3023         (WebCore::jsTestDOMJITPrototypeFunctionGetElementByIdCaller):
3024         (WebCore::unsafeJsTestDOMJITPrototypeFunctionGetElementById):
3025         (WebCore::jsTestDOMJITPrototypeFunctionGetElementsByName):
3026         (WebCore::jsTestDOMJITPrototypeFunctionGetElementsByNameCaller):
3027         (WebCore::unsafeJsTestDOMJITPrototypeFunctionGetElementsByName):
3028         * bindings/scripts/test/TestDOMJIT.idl:
3029         * dom/Element.idl:
3030         * domjit/DOMJITAbstractHeapRepository.yaml: Added.
3031         * domjit/DOMJITIDLConvert.h: Added.
3032         (WebCore::DOMJIT::DirectConverter<IDLDOMString>::directConvert<StringConversionConfiguration::Normal>):
3033         * domjit/DOMJITIDLType.h: Added.
3034         * domjit/DOMJITIDLTypeFilter.h: Added.
3035         * domjit/JSDocumentDOMJIT.cpp:
3036         (WebCore::DocumentDocumentElementDOMJIT::callDOMGetter):
3037         * domjit/JSNodeDOMJIT.cpp:
3038         (WebCore::NodeFirstChildDOMJIT::callDOMGetter):
3039         (WebCore::NodeLastChildDOMJIT::callDOMGetter):
3040         (WebCore::NodeNextSiblingDOMJIT::callDOMGetter):
3041         (WebCore::NodePreviousSiblingDOMJIT::callDOMGetter):
3042         (WebCore::NodeParentNodeDOMJIT::callDOMGetter):
3043         (WebCore::NodeOwnerDocumentDOMJIT::callDOMGetter):
3044         * domjit/generate-abstract-heap.rb: Added.
3045
3046 2016-11-02  Simon Fraser  <simon.fraser@apple.com>
3047
3048         Followup after r208314.
3049
3050         The style created for reflections contains transforms and a mask, so needs to get explicit
3051         z-index on it. This doesn't change rendering, since this layer has no children.
3052
3053         Fixes assertions in various reflection tests.
3054
3055         * rendering/RenderLayer.cpp:
3056         (WebCore::RenderLayer::calculateClipRects):
3057
3058 2016-11-02  Simon Fraser  <simon.fraser@apple.com>
3059
3060         REGRESSION (r208025) GraphicsContext state stack assertions loading webkit.org
3061         https://bugs.webkit.org/show_bug.cgi?id=164350
3062         rdar://problem/29053414
3063
3064         Reviewed by Dean Jackson.
3065
3066         After r208025 it as possible for KeyframeAnimation::animate() to produce a RenderStyle
3067         with a non-1 opacity, but without the explicit z-index that triggers stacking context.
3068         This confused the RenderLayer paintWithTransparency code, triggering mismsatched GraphicsContext
3069         save/restores.
3070
3071         This occurred when the runningOrFillingForwards state was mis-computed. keyframeAnim->animate()
3072         can spit out a new style when in the StartWaitTimer sometimes, so "!keyframeAnim->waitingToStart() && !keyframeAnim->postActive()"
3073         gave the wrong answser.
3074
3075         Rather than depend on the super-confusing animation state, use a bool out param from animate() to say
3076         when it actually produced a new style, and when true, do the setZIndex(0).
3077
3078         Test: animations/stacking-during-opacity-animation.html
3079
3080         * page/animation/AnimationBase.h:
3081         * page/animation/CSSPropertyAnimation.cpp:
3082         (WebCore::CSSPropertyAnimation::blendProperties): Log after blending so the log shows the blended style.
3083         * page/animation/CompositeAnimation.cpp:
3084         (WebCore::CompositeAnimation::animate):
3085         * page/animation/ImplicitAnimation.cpp:
3086         (WebCore::ImplicitAnimation::animate):
3087         * page/animation/ImplicitAnimation.h:
3088         * page/animation/KeyframeAnimation.cpp:
3089         (WebCore::KeyframeAnimation::animate):
3090         * page/animation/KeyframeAnimation.h:
3091         * platform/graphics/GraphicsContext.cpp:
3092         (WebCore::GraphicsContext::restore):
3093         * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
3094         (PlatformCALayer::drawLayerContents): No functional change, but created scope for the
3095         GraphicsContext so that it didn't outlive the CGContextRestoreGState(context).
3096         * rendering/RenderLayer.cpp:
3097         (WebCore::RenderLayer::beginTransparencyLayers): New assertion that catches the problem earlier.
3098
3099 2016-11-02  Myles C. Maxfield  <mmaxfield@apple.com>
3100
3101         [iOS] [WebGL] Multisample resolve step may operate on stale data
3102         https://bugs.webkit.org/show_bug.cgi?id=164347
3103
3104         Reviewed by Dean Jackson.
3105
3106         When antialiasing is enabled, WebKit internally creates a multisampled FBO
3107         and uses that as the target of all the drawing commands. Then, just before
3108         we actually put the image on the glass, we perform a “resolve” step which
3109         averages all the samples to create the final image. However, it appears
3110         that this resolve step only waits for commands to complete which were
3111         already submitted to the hardware. OpenGL is allowed (indeed, expected) to
3112         batch up drawing commands in main memory so it can submit them to the
3113         hardware in fewer batches, but this means that the hardware may not know
3114         about all the commands that the application submitted. Because of this,
3115         the data the resolve step saw is the result of only some of the previous
3116         draw calls - not all of them.
3117
3118         This doesn’t occur on macOS because we have a different code path there
3119         for performing the resolve step. On iOS 9 and below, WebKit didn’t
3120         implement multisampling in WebGL at all, which explains why this only
3121         occurs on iOS 10. 
3122
3123         Luckily, the OpenGL command glFlush() is exactly designed to submit any
3124         pending commands to the hardware.
3125
3126         Test: fast/canvas/webgl/multisample-resolve-consistency.html
3127
3128         * platform/graphics/opengl/GraphicsContext3DOpenGL.cpp:
3129         (WebCore::GraphicsContext3D::resolveMultisamplingIfNecessary):
3130
3131 2016-11-02  Brady Eidson  <beidson@apple.com>
3132
3133         Give IDBKey(Data) a WTF::Variant overhaul.
3134         https://bugs.webkit.org/show_bug.cgi?id=164332
3135
3136         Reviewed by Alex Christensen and Andy Estes.
3137
3138         No new tests (Refactor, no behavior change).
3139
3140         * Modules/indexeddb/IDBKey.cpp:
3141         (WebCore::IDBKey::IDBKey):
3142         (WebCore::IDBKey::isValid):
3143         (WebCore::IDBKey::compare):
3144         * Modules/indexeddb/IDBKey.h:
3145         (WebCore::IDBKey::array):
3146         (WebCore::IDBKey::string):
3147         (WebCore::IDBKey::date):
3148         (WebCore::IDBKey::number):
3149         (WebCore::IDBKey::IDBKey): Deleted.
3150
3151         * Modules/indexeddb/IDBKeyData.cpp:
3152         (WebCore::IDBKeyData::IDBKeyData):
3153         (WebCore::IDBKeyData::maybeCreateIDBKey):
3154         (WebCore::IDBKeyData::isolatedCopy):
3155         (WebCore::IDBKeyData::encode):
3156         (WebCore::IDBKeyData::decode):
3157         (WebCore::IDBKeyData::compare):
3158         (WebCore::IDBKeyData::loggingString):
3159         (WebCore::IDBKeyData::setArrayValue):
3160         (WebCore::IDBKeyData::setStringValue):
3161         (WebCore::IDBKeyData::setDateValue):
3162         (WebCore::IDBKeyData::setNumberValue):
3163         (WebCore::IDBKeyData::operator==):
3164         * Modules/indexeddb/IDBKeyData.h:
3165         (WebCore::IDBKeyData::hash):
3166         (WebCore::IDBKeyData::string):
3167         (WebCore::IDBKeyData::date):
3168         (WebCore::IDBKeyData::number):
3169         (WebCore::IDBKeyData::array):
3170         (WebCore::IDBKeyData::encode):
3171         (WebCore::IDBKeyData::decode):
3172
3173 2016-11-01  Sam Weinig  <sam@webkit.org>
3174
3175         [WebIDL] Move interfaces and typed arrays over to JSDOMConvert
3176         https://bugs.webkit.org/show_bug.cgi?id=164256
3177
3178         Reviewed by Alex Christensen.
3179
3180         - Add the ability to pass an "exception thrower" functor to the convert functions.
3181           This is only implemented for convert<IDLInterface<T>> and convert<IDLNullable<IDLInterface<T>>>
3182           for now, but can be extended for more types as necessary to improve exception messages.
3183         - Add support for using toJSNewlyCreated in JSDOMConvert.
3184
3185         * bindings/generic/IDLTypes.h:
3186         (WebCore::IDLString::extractValueFromNullable):
3187         Use forwarding to simplify extraction function.
3188
3189         (WebCore::IDLInterface::nullValue):
3190         Update nullValue to work for both RefPtr<T> and T*.
3191
3192         (WebCore::IDLInterface::extractValueFromNullable):
3193         Use forwarding to simplify extraction function.
3194
3195         * bindings/js/JSDOMConvert.h:
3196         (WebCore::DefaultExceptionThrower::operator()):
3197         Add a default "exception thrower" which throws a normal type error.
3198
3199         (WebCore::convert):
3200         Add an overload of convert which takes an "exception thrower".
3201
3202         (WebCore::toJSNewlyCreated):
3203         Add new overloaded function toJSNewlyCreated, matching the toJS overload set,
3204         which will return "newly created" values. This only works for types that implement
3205         a toJSNewlyCreated function for themselves.
3206
3207         (WebCore::Converter<IDLNullable<T>>::convert):
3208         Fix the return type of Converter<IDLNullable<T>> to be specialized when
3209         T is an IDLInterface. In that case, we want to match the return type of
3210         inner converter.
3211         
3212         Also add implementation of convert overload that takes an "exception thrower".
3213
3214         (WebCore::JSConverter<IDLNullable<T>>::convert):
3215         (WebCore::JSConverter<IDLNullable<T>>::convertNewlyCreated):
3216         Reimplement conversion to use forwarding of the value.
3217
3218         (WebCore::Converter<IDLInterface<T>>::convert):
3219         Add support for an "exception thrower".
3220
3221         (WebCore::Detail::getPtrOrRef):
3222         Add helper functions that extract either a pointer or reference, depending on the type,
3223         and const_casts it allowing the value to be used with toJS functions.
3224
3225         (WebCore::JSConverter<IDLInterface<T>>::convert):
3226         Re-implement to support more varied input values.
3227
3228         (WebCore::JSConverter<IDLInterface<T>>::convertNewlyCreated):
3229         Added. Forwards to overloaded toJSNewlyCreated functions.
3230
3231         * bindings/scripts/CodeGeneratorJS.pm:
3232         (AddToImplIncludesForIDLType):
3233         Add support for adding the right includes for SerializedScriptValue and Dictionary.
3234
3235         (GetArgumentExceptionThrower):
3236         (GetAttributeExceptionThrower):
3237         Add helpers to generate "exception thrower" lambdas for wrappers and typed arrays
3238         being passed to setters and functions.
3239
3240         (GenerateParametersCheck):
3241         Move around special cases so it is clear that it's not wrappers and typed arrays that
3242         need specialization here, it is now just EventListener and XPathNSResolver.
3243
3244         (GetIDLInterfaceName):
3245         Add helper to get the InterfaceName for use in IDLInterface template.
3246
3247         (GetBaseIDLType):
3248         Use new GetIDLInterfaceName helper.
3249
3250         (IsValidContextForJSValueToNative):
3251         Remove IDLOperation as a valid context. It is not.
3252
3253         (JSValueToNative):
3254         Move JSDOMConvert based conversion to the bottom, to show that everything above it
3255         is a special case that should be fixed. I have used explicit c-style if-statements
3256         to make it clear what the types of the exceptional cases are.
3257
3258         (NativeToJSValueDOMConvertNeedsState):
3259         (NativeToJSValueDOMConvertNeedsGlobalObject):
3260         Add wrapper types and typed arrays to the list needing state and globalObject.
3261
3262         (NativeToJSValue):
3263         Move JSDOMConvert based conversion to the bottom, to show that everything above it
3264         is a special case that should be fixed. I have used explicit c-style if-statements
3265         to make it clear what the types of the exceptional cases are.
3266
3267         (JSValueToNativeIsHandledByDOMConvert): Deleted.
3268         (NativeToJSValueIsHandledByDOMConvert): Deleted.
3269         Remove predicates protecting use of JSDOMConvert now that it is the default.
3270
3271         * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
3272         * bindings/scripts/test/JS/JSTestCEReactions.cpp:
3273         * bindings/scripts/test/JS/JSTestCallback.cpp:
3274         * bindings/scripts/test/JS/JSTestCallbackFunction.cpp:
3275         * bindings/scripts/test/JS/JSTestDOMJIT.cpp:
3276         * bindings/scripts/test/JS/JSTestEventTarget.cpp:
3277         * bindings/scripts/test/JS/JSTestInterface.cpp:
3278         * bindings/scripts/test/JS/JSTestObj.cpp:
3279         * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
3280         * bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp:
3281         * bindings/scripts/test/JS/JSTestSerialization.cpp:
3282         * bindings/scripts/test/JS/JSTestTypedefs.cpp:
3283         Update test results.
3284
3285 2016-11-02  David Kilzer  <ddkilzer@apple.com>
3286
3287         Bug 164333: Add logging for "WebKit encountered an internal error" messages due to Network process crashes
3288         <https://webkit.org/b/164333>
3289         <rdar://problem/29072727>
3290
3291         Reviewed by Alex Christensen.
3292
3293         * page/DiagnosticLoggingKeys.cpp:
3294         (WebCore::DiagnosticLoggingKeys::networkProcessCrashedKey):
3295         - Add implementation for new key method.
3296         * page/DiagnosticLoggingKeys.h:
3297         (WebCore::DiagnosticLoggingKeys::networkProcessCrashedKey):
3298         - Add declaration for new key method.
3299
3300 2016-11-02  Filip Pizlo  <fpizlo@apple.com>
3301
3302         The GC should be in a thread
3303         https://bugs.webkit.org/show_bug.cgi?id=163562
3304
3305         Reviewed by Geoffrey Garen and Andreas Kling.
3306
3307         No new tests because existing tests cover this.
3308         
3309         We now need to be more careful about using JSLock. This fixes some places that were not
3310         holding it. New assertions in the GC are more likely to catch this than before.
3311
3312         * bindings/js/WorkerScriptController.cpp:
3313         (WebCore::WorkerScriptController::WorkerScriptController):
3314
3315 2016-11-02  Joseph Pecoraro  <pecoraro@apple.com>
3316
3317         Web Inspector: Include DebuggerAgent in Workers - see, pause, and step through scripts
3318         https://bugs.webkit.org/show_bug.cgi?id=164136
3319         <rdar://problem/29028462>
3320
3321         Reviewed by Brian Burg.
3322
3323         Tests: inspector/worker/debugger-pause.html
3324                inspector/worker/debugger-scripts.html
3325
3326         * CMakeLists.txt:
3327         * WebCore.xcodeproj/project.pbxproj:
3328         * inspector/InspectorAllInOne.cpp:
3329         New file.
3330
3331         * inspector/PageDebuggerAgent.h:
3332         * inspector/WorkerDebuggerAgent.cpp: Added.
3333         (WebCore::WorkerDebuggerAgent::WorkerDebuggerAgent):
3334         (WebCore::WorkerDebuggerAgent::~WorkerDebuggerAgent):
3335         (WebCore::WorkerDebuggerAgent::breakpointActionLog):
3336         (WebCore::WorkerDebuggerAgent::injectedScriptForEval):
3337         * inspector/WorkerDebuggerAgent.h: Added.
3338         DebuggerAgent customizations for Workers.
3339
3340         * inspector/WorkerInspectorController.cpp:
3341         (WebCore::WorkerInspectorController::WorkerInspectorController):
3342         Add the new agent.
3343
3344         * inspector/WorkerScriptDebugServer.cpp:
3345         (WebCore::WorkerScriptDebugServer::runEventLoopWhilePaused):
3346         Implement the nested run loop for Workers.
3347
3348 2016-11-02  Simon Fraser  <simon.fraser@apple.com>
3349
3350         Add Battery Status to features.json, marked as "Removed".
3351
3352         * features.json:
3353
3354 2016-11-02  Ryosuke Niwa  <rniwa@webkit.org>
3355
3356         Load stylesheets in link elements inside a connected shadow tree
3357         https://bugs.webkit.org/show_bug.cgi?id=160683
3358         <rdar://problem/29040652>
3359
3360         Reviewed by Antti Koivisto.
3361
3362         Allow external stylesheets within a shadow tree by storing the appropriate style scope in HTMLLinkElement
3363         when it's connected to a document instead of always talking to document's style scope.
3364
3365         Also improve ShadowRoot's insertedInto and removedFrom so that they only try to add and remove itself from
3366         m_inDocumentShadowRoots when the connected-ness changes.
3367
3368         This patch also removes the superfluous call to notifyChildNodeRemoved in Element::removeShadowRoot to
3369         avoid invoking notifyChildNodeRemoved during a document teardown, which is incorrect. It's sufficient that
3370         ~ShadowRoot calls ContainerNode::removeDetachedChildren(), and in turn removeDetachedChildrenInContainer()
3371         since the latter function tears down nodes via the deletion queue during a document destruction and use
3372         notifyChildNodeRemoved() on nodes that outlive the shadow root.
3373
3374         Tests: fast/shadow-dom/link-element-in-shadow-tree.html
3375                fast/shadow-dom/selected-stylesheet-in-shadow-tree.html
3376
3377        * dom/Document.cpp:
3378        (WebCore::Document::didInsertInDocumentShadowRoot): Assert that the shadow root is not in the set.
3379        (WebCore::Document::didRemoveInDocumentShadowRoot): Assert that the shadow root is not in the document as
3380        this function is now called after Node::removedFrom in ShadowRoot::removedFrom.
3381        * dom/Element.cpp:
3382        (WebCore::Element::removeShadowRoot): See the description above.
3383        * dom/ShadowRoot.cpp:
3384        (WebCore::ShadowRoot::insertedInto): Only call didInsertInDocumentShadowRoot when the this shadow root is
3385        newly connected to a document so we can add assertions in didInsertInDocumentShadowRoot.
3386        (WebCore::ShadowRoot::removedFrom): Ditto for the removal.
3387        * html/HTMLLinkElement.cpp:
3388        (WebCore::HTMLLinkElement::HTMLLinkElement):
3389        (WebCore::HTMLLinkElement::~HTMLLinkElement):
3390        (WebCore::HTMLLinkElement::setDisabledState): Exit early when the element is not in a document as invoking
3391        didChangeActiveStyleSheetCandidates would require having a valid m_styleScope and process() already exits
3392        early when inDocument() is false.
3393        (WebCore::HTMLLinkElement::parseAttribute):
3394        (WebCore::HTMLLinkElement::process): Removed the early exit for when the element is in a shadow tree.
3395        (WebCore::HTMLLinkElement::insertedInto): Exit early unless this element has just become connected to
3396        a document instead of whenever its self-inclusive ancestor is inserted into a container.
3397        (WebCore::HTMLLinkElement::removedFrom): Ditto for removal. Also call removeStyleSheetCandidateNode after
3398        calling removePendingSheet since the latter depends on m_styleScope being not null.
3399        (WebCore::HTMLLinkElement::addPendingSheet):
3400        (WebCore::HTMLLinkElement::removePendingSheet):
3401        * html/HTMLLinkElement.h:
3402        * html/HTMLStyleElement.cpp:
3403        (WebCore::HTMLStyleElement::insertedInto): Only call inline style owner's insertedIntoDocument if this
3404        element has just become connected to a document.
3405        (WebCore::HTMLStyleElement::removedFrom): Ditto for the removal.
3406        * style/StyleScope.h:
3407        * svg/SVGStyleElement.cpp:
3408        (WebCore::SVGStyleElement::insertedInto): Ditto.
3409        (WebCore::SVGStyleElement::removedFrom): Ditto for the removal.
3410
3411 2016-11-02  Dave Hyatt  <hyatt@apple.com>
3412
3413         [CSS Parser] Clean up new parser's grid layout ifdefs/runtime checking
3414         https://bugs.webkit.org/show_bug.cgi?id=164341
3415
3416         Reviewed by Dean Jackson.
3417
3418         * css/parser/CSSPropertyParser.cpp:
3419         (WebCore::consumeGridTrackRepeatFunction):
3420         (WebCore::consumeGridTrackList):
3421         (WebCore::CSSPropertyParser::parseSingleValue):
3422
3423 2016-11-02  Alex Christensen  <achristensen@webkit.org>
3424
3425         Remove Battery Status API from the tree
3426         https://bugs.webkit.org/show_bug.cgi?id=164213
3427
3428         Reviewed by Sam Weinig.
3429
3430         * CMakeLists.txt:
3431         * DerivedSources.cpp:
3432         * Modules/battery: Removed.
3433         * Modules/battery/BatteryClient.h: Removed.
3434         * Modules/battery/BatteryController.cpp: Removed.
3435         * Modules/battery/BatteryController.h: Removed.
3436         * Modules/battery/BatteryManager.cpp: Removed.
3437         * Modules/battery/BatteryManager.h: Removed.
3438         * Modules/battery/BatteryManager.idl: Removed.
3439         * Modules/battery/BatteryStatus.cpp: Removed.
3440         * Modules/battery/BatteryStatus.h: Removed.
3441         * Modules/battery/NavigatorBattery.cpp: Removed.
3442         * Modules/battery/NavigatorBattery.h: Removed.
3443         * Modules/battery/NavigatorBattery.idl: Removed.
3444         * PlatformEfl.cmake:
3445         * dom/EventTargetFactory.in:
3446         * platform/efl/BatteryProviderEfl.cpp: Removed.
3447         * platform/efl/BatteryProviderEfl.h: Removed.
3448         * platform/efl/BatteryProviderEflClient.h: Removed.
3449         * platform/glib/BatteryProviderUPower.cpp: Removed.
3450         * platform/glib/BatteryProviderUPower.h: Removed.
3451         * platform/glib/BatteryProviderUPowerClient.h: Removed.
3452         * testing/Internals.cpp:
3453         (WebCore::Internals::setBatteryStatus): Deleted.
3454         * testing/Internals.h:
3455         * testing/Internals.idl:
3456
3457 2016-11-02  Keith Rollin  <krollin@apple.com>
3458
3459         NetworkSession: Add NetworkDataTask implementation for blobs
3460         https://bugs.webkit.org/show_bug.cgi?id=163939
3461
3462         Reviewed by Alex Christensen.
3463
3464         * WebCore.xcodeproj/project.pbxproj: Mark HTTPParsers.h and AsyncFileStream.h as private.
3465         * fileapi/AsyncFileStream.h: Add WEBCORE_EXPORT to AsyncFileStream class.
3466         * platform/network/BlobData.h: Add WEBCORE_EXPORT to length().
3467         * platform/network/HTTPParsers.h: Add WEBCORE_EXPORT to parseRange().
3468         * platform/network/ResourceResponseBase.h: Add WEBCORE_EXPORT to setHTTPHeaderField().
3469
3470 2016-11-02  Olivier Blin  <olivier.blin@softathome.com>
3471
3472         [GTK] Use libgcrypt instead of GnuTLS for CryptoDigest and SubtleCrypto HMAC implementation
3473         https://bugs.webkit.org/show_bug.cgi?id=163125
3474
3475         Reviewed by Michael Catanzaro.
3476
3477         No new tests, already covered by existing SubtleCrypto tests.
3478
3479         * PlatformGTK.cmake: Use libgcrypt instead of gnutls.
3480         * crypto/gcrypt/CryptoAlgorithmHMACGCrypt.cpp: Added. Adapted from the GnuTLS backend.
3481         (WebCore::getGCryptDigestAlgorithm):
3482         (WebCore::calculateSignature):
3483         (WebCore::CryptoAlgorithmHMAC::platformSign):
3484         (WebCore::CryptoAlgorithmHMAC::platformVerify):
3485         * platform/crypto/gcrypt/CryptoDigestGCrypt.cpp: Added. Adapted from the GnuTLS backend.
3486         (WebCore::CryptoDigest::CryptoDigest):
3487         (WebCore::CryptoDigest::~CryptoDigest):
3488         (WebCore::CryptoDigest::create):
3489         (WebCore::CryptoDigest::addBytes):
3490         (WebCore::CryptoDigest::computeHash):
3491
3492 2016-11-02  Brent Fulgham  <bfulgham@apple.com>
3493
3494         REGRESSION(r203289):Assertion in MathOperator::stretchTo() on Wikipedia Page
3495         https://bugs.webkit.org/show_bug.cgi?id=162933
3496         <rdar://problem/28570590>
3497
3498         Reviewed by Dean Jackson.
3499
3500         A debug assertion is triggered when an empty <mo> tag is used with a "stretchy" flag.
3501
3502         We shouldn't be trying to apply stretch operations on an empty MathML element. Create a
3503         helper function (isStretchy) to encapsulate the fact that only non-empty elements with
3504         the 'MathMLOperatorDictionary::Stretchy' operator flag should have stretching applied.
3505
3506         Test: mathml/empty-mo.html
3507
3508         * rendering/mathml/RenderMathMLOperator.cpp:
3509         (WebCore::RenderMathMLOperator::stretchTo): Revise assertion to use new 'isStretchy' predicate.
3510         * rendering/mathml/RenderMathMLOperator.h:
3511         (WebCore::RenderMathMLOperator::isStretchy): Added.
3512         * rendering/mathml/RenderMathMLRow.cpp:
3513         (WebCore::RenderMathMLRow::computeLineVerticalStretch): Use new 'isStretchy' predicate.
3514         (WebCore::RenderMathMLRow::layoutRowItems): Ditto.
3515         * rendering/mathml/RenderMathMLUnderOver.cpp:
3516         (WebCore::RenderMathMLUnderOver::computeOperatorsHorizontalStretch): Ditto.
3517         (WebCore::RenderMathMLUnderOver::verticalParameters): Ditto.
3518
3519 2016-11-01  Dean Jackson  <dino@apple.com>
3520
3521         Filter functions grayscale/invert/opacity/sepia should clamp values over 100%, not fail
3522         https://bugs.webkit.org/show_bug.cgi?id=164310
3523
3524         Reviewed by Sam Weinig.
3525
3526         When bringing up the new CSS parser, I discovered that our old parser was
3527         not conforming to the specification.
3528
3529         Covered by existing tests.
3530
3531         * css/parser/CSSParser.cpp:
3532         (WebCore::CSSParser::parseBuiltinFilterArguments): For these functions, clamp to
3533         100% rather than fail.
3534
3535 2016-11-02  Brent Fulgham  <bfulgham@apple.com>
3536
3537         WebKit nullptr dereference Archive Subframe
3538         https://bugs.webkit.org/show_bug.cgi?id=164281
3539         <rdar://problem/28943006>
3540
3541         Reviewed by Andy Estes.
3542
3543         If the page is torn down during a load, we can attempt to use a deallocated
3544         (and nulled) document loader. Most places that use the "active document loader"
3545         null-check it before using, but there was one place that did not. This patch
3546         fixes that oversight.
3547
3548         Test: fast/dom/crash-with-bad-url.html
3549
3550         * loader/FrameLoader.cpp:
3551         (WebCore::FrameLoader::loadURLIntoChildFrame): Check that the active document
3552         loader is non-null before using.
3553
3554 2016-11-02  Dave Hyatt  <hyatt@apple.com>
3555
3556         [CSS Parser] Support scroll-snap-* properties
3557         https://bugs.webkit.org/show_bug.cgi?id=164321
3558
3559         Reviewed by Simon Fraser.
3560
3561         * css/CSSPrimitiveValue.h:
3562         * css/StyleBuilderConverter.h:
3563         (WebCore::StyleBuilderConverter::convertScrollSnapPoints):
3564         (WebCore::StyleBuilderConverter::convertSnapCoordinatePair):
3565         (WebCore::StyleBuilderConverter::convertScrollSnapCoordinates):
3566         * css/parser/CSSPropertyParser.cpp:
3567         (WebCore::consumePositionLonghand):
3568         (WebCore::consumePositionX):
3569         (WebCore::consumePositionY):
3570         (WebCore::consumePositionList):
3571         (WebCore::consumeScrollSnapDestination):
3572         (WebCore::consumeScrollSnapPoints):
3573         (WebCore::CSSPropertyParser::parseSingleValue):
3574
3575 2016-11-02  David Kilzer  <ddkilzer@apple.com>
3576
3577         Add logging for "WebKit encountered an internal error" messages
3578         <https://webkit.org/b/164272>
3579         <rdar://problem/28546064>
3580
3581         Reviewed by Alex Christensen.
3582
3583         * page/DiagnosticLoggingKeys.cpp:
3584         (WebCore::DiagnosticLoggingKeys::internalErrorKey):
3585         (WebCore::DiagnosticLoggingKeys::invalidSessionIDKey):
3586         (WebCore::DiagnosticLoggingKeys::createSharedBufferFailedKey):
3587         (WebCore::DiagnosticLoggingKeys::synchronousMessageFailedKey):
3588         - Add implementations for new key methods.
3589
3590         * page/DiagnosticLoggingKeys.h:
3591         (WebCore::DiagnosticLoggingKeys::internalErrorKey):
3592         (WebCore::DiagnosticLoggingKeys::invalidSessionIDKey):
3593         (WebCore::DiagnosticLoggingKeys::createSharedBufferFailedKey):
3594         (WebCore::DiagnosticLoggingKeys::synchronousMessageFailedKey):
3595         - Add declarations for new key methods.
3596
3597 2016-11-02  Zalan Bujtas  <zalan@apple.com>
3598
3599         [Tables] Simplified layout skips captions.
3600         https://bugs.webkit.org/show_bug.cgi?id=164284
3601
3602         Reviewed by David Hyatt.
3603
3604         This patch ensures that we take care of simplified normalflow captions during layout.    
3605
3606         Covered by fast/regions/table-caption-as-region.html
3607
3608         * rendering/RenderTable.cpp:
3609         (WebCore::RenderTable::layoutCaption):
3610         (WebCore::RenderTable::layoutCaptions): _caption_side is 2bits, can't use bitmask. 
3611         (WebCore::RenderTable::simplifiedNormalFlowLayout):
3612         (WebCore::RenderTable::layout):
3613         * rendering/RenderTable.h:
3614
3615 2016-11-02  Youenn Fablet  <youenn@apple.com>
3616
3617         REGRESSION(r207753-207755): ASSERTION FAILED: m_parsedStyleSheetCache->isInMemoryCache()
3618         https://bugs.webkit.org/show_bug.cgi?id=163905
3619
3620         Reviewed by Antti Koivisto.
3621
3622         Covered by existing tests and http/tests/security/cached-cross-origin-shared-css-stylesheet.html
3623
3624         Small refactoring to do more member fields initialization in StyleSheetContents header.
3625         Refactored StyleSheetContents::m_isInMemoryCache to be a counter instead of a boolean.
3626         This allows StyleSheetContents to be linked to several CachedCSSStyleSheets.
3627
3628         * css/StyleSheetContents.cpp:
3629         (WebCore::StyleSheetContents::StyleSheetContents):
3630         (WebCore::StyleSheetContents::addedToMemoryCache):
3631         (WebCore::StyleSheetContents::removedFromMemoryCache):
3632         * css/StyleSheetContents.h:
3633         * loader/cache/CachedCSSStyleSheet.cpp:
3634         (WebCore::CachedCSSStyleSheet::setBodyDataFrom): Making reuse of saveParsedStyleSheet to handle update of StyleSheetContents cache count.
3635
3636 2016-11-02  Carlos Garcia Campos  <cgarcia@igalia.com>
3637
3638         [GTK] Remove FileSystem::filenameToString() and use FileSystem::stringFromFileSystemRepresentation() everywhere instead
3639         https://bugs.webkit.org/show_bug.cgi?id=164315
3640
3641         Reviewed by Michael Catanzaro.
3642
3643         * platform/FileSystem.h:
3644         * platform/glib/FileSystemGlib.cpp:
3645         (WebCore::stringFromFileSystemRepresentation):
3646         (WebCore::homeDirectoryPath):
3647         (WebCore::listDirectory):
3648         (WebCore::filenameToString): Deleted.
3649
3650 2016-11-02  Manuel Rego Casasnovas  <rego@igalia.com>
3651
3652         [css-grid] mimax(auto, <flex>) should be serialized as <flex>
3653         https://bugs.webkit.org/show_bug.cgi?id=164316
3654
3655         Reviewed by Sergio Villar Senin.
3656
3657         * css/CSSComputedStyleDeclaration.cpp:
3658         (WebCore::specifiedValueForGridTrackSize): Add a simple if to serialize
3659         properly this case.
3660         * rendering/style/GridLength.h:
3661         (WebCore::GridLength::isAuto): Add new function to check if GridLength
3662         is or not "auto".
3663
3664 2016-11-02  Romain Bellessort  <romain.bellessort@crf.canon.fr>
3665
3666         [Readable Streams API] Enable creation of ReadableByteStreamController
3667         https://bugs.webkit.org/show_bug.cgi?id=164014
3668
3669         Reviewed by Youenn Fablet.
3670
3671         Added support for creating ReadableByteStreamController. IDL is mostly
3672         implemented but methods return TypeError. Tests have been added to ensure
3673         behaviour. This part of Readable Streams API is associated to
3674         a flag (READABLE_BYTE_STREAM_API).
3675
3676         Test: streams/readable-byte-stream-controller.html
3677
3678         * CMakeLists.txt:
3679         * Configurations/FeatureDefines.xcconfig:
3680         * DerivedSources.cpp:
3681         * DerivedSources.make:
3682         * Modules/streams/ReadableByteStreamController.idl: Added.
3683         * Modules/streams/ReadableByteStreamController.js: Added.
3684         (enqueue): Empty method for the moment, throws TypeError.
3685         (error): Empty method for the moment, throws TypeError.
3686         (close): Empty method for the moment, throws TypeError.
3687         (byobRequest): Empty method for the moment, throws TypeError.
3688         (desiredSize): Empty method for the moment, throws TypeError.
3689         * Modules/streams/ReadableByteStreamInternals.js: Added.
3690         (privateInitializeReadableByteStreamController):
3691         * Modules/streams/ReadableStream.js:
3692         (initializeReadableStream):
3693         * WebCore.xcodeproj/project.pbxproj:
3694         * bindings/js/JSDOMGlobalObject.cpp:
3695         (WebCore::JSDOMGlobalObject::addBuiltinGlobals):
3696         * bindings/js/JSReadableStreamPrivateConstructors.cpp:
3697         (WebCore::constructJSReadableByteStreamController):
3698         (WebCore::constructJSReadableStreamDefaultReader):
3699         (WebCore::JSBuiltinReadableByteStreamControllerPrivateConstructor::initializeExecutable):
3700         (WebCore::createReadableByteStreamControllerPrivateConstructor):
3701         * bindings/js/JSReadableStreamPrivateConstructors.h:
3702         * bindings/js/WebCoreBuiltinNames.h:
3703
3704 2016-11-02  Antoine Quint  <graouts@apple.com>
3705
3706         [Modern Media Controls] Media Controller: fullscreen toggle support
3707         https://bugs.webkit.org/show_bug.cgi?id=163728
3708         <rdar://problem/27989486>
3709
3710         Reviewed by Darin Adler.
3711
3712         We introduce the FullscreenSupport class which brings support for entering and
3713         exiting fullscreen by clicking on the fullscreen button in the media controls
3714         and correctly reflecting the media's fullscreen state should it be changed
3715         via the media API.
3716
3717         Tests: media/modern-media-controls/fullscreen-support/fullscreen-support-click.html
3718                media/modern-media-controls/fullscreen-support/fullscreen-support-enabled.html
3719
3720         * Modules/modern-media-controls/js-files:
3721         * Modules/modern-media-controls/media/fullscreen-support.js: Added.
3722         (FullscreenSupport):
3723         (FullscreenSupport.prototype.get control):
3724         (FullscreenSupport.prototype.get mediaEvents):
3725         (FullscreenSupport.prototype.buttonWasClicked):
3726         (FullscreenSupport.prototype.syncControl):
3727         * Modules/modern-media-controls/media/media-controller.js:
3728         (MediaController):
3729         * WebCore.xcodeproj/project.pbxproj:
3730
3731 2016-11-02  Antoine Quint  <graouts@apple.com>
3732
3733         [Modern Media Controls] Media Controller: PiP support
3734         https://bugs.webkit.org/show_bug.cgi?id=163730
3735         <rdar://problem/27989485>
3736
3737         Reviewed by Dean Jackson.
3738
3739         We introduce the PiPSupport class which brings support for entering picture-in-picture
3740         by clicking on the PiP button in the media controls and enabling the button only when
3741         picture-in-picture mode is available.
3742
3743         Tests: media/modern-media-controls/pip-support/pip-support-click.html
3744                media/modern-media-controls/pip-support/pip-support-enabled.html
3745
3746         * Modules/modern-media-controls/js-files:
3747         * Modules/modern-media-controls/media/media-controller.js:
3748         (MediaController):
3749         * Modules/modern-media-controls/media/pip-support.js: Added.
3750         (PiPSupport.prototype.get control):
3751         (PiPSupport.prototype.get mediaEvents):
3752         (PiPSupport.prototype.buttonWasClicked):
3753         (PiPSupport.prototype.syncControl):
3754         (PiPSupport):
3755         * WebCore.xcodeproj/project.pbxproj:
3756
3757 2016-11-01  Dave Hyatt  <hyatt@apple.com>
3758
3759         [CSS Parser] Support the shadow DOM
3760         https://bugs.webkit.org/show_bug.cgi?id=164240
3761
3762         Reviewed by Dean Jackson.
3763
3764         * css/CSSSelector.cpp:
3765         (WebCore::CSSSelector::selectorText):
3766         Remove ShadowDeep, ShadowSlot and ShadowPseudo in favor of our
3767         ShadowDescendant combinator.
3768
3769         * css/CSSSelector.h:
3770         * css/SelectorChecker.cpp:
3771         (WebCore::SelectorChecker::matchRecursively):
3772         Remove ShadowDeep, ShadowSlot and ShadowPseudo in favor of our
3773         ShadowDescendant combinator.
3774
3775         * css/SelectorFilter.cpp:
3776         (WebCore::SelectorFilter::collectIdentifierHashes):
3777         Remove ShadowDeep, ShadowSlot and ShadowPseudo in favor of our
3778         ShadowDescendant combinator.
3779
3780         * css/SelectorPseudoElementTypeMap.in:
3781         Add support for slotted.
3782
3783         * css/parser/CSSParserValues.cpp:
3784         (WebCore::CSSParserSelector::appendTagHistory):
3785         * css/parser/CSSParserValues.h:
3786         (WebCore::CSSParserSelector::needsImplicitShadowCombinatorForMatching):
3787         Remove ShadowDeep, ShadowSlot and ShadowPseudo in favor of our
3788         ShadowDescendant combinator. Take :slotted out of
3789         needsImplicitShadowCombinatorForMatching(), since our code doesn't do
3790         this for :slotted.
3791
3792         * css/parser/CSSSelectorParser.cpp:
3793         (WebCore::isPseudoClassFunction):
3794         :host can be both an id and a function, so don't restrict it.
3795
3796         (WebCore::CSSSelectorParser::consumePseudo):
3797         Put in a hack for :host (inside the hack we already plan on removing
3798         once we turn on).
3799
3800         (WebCore::CSSSelectorParser::consumeCombinator):
3801         Remove deep shadow combinator support, as we don't support matching
3802         on it.
3803
3804         (WebCore::CSSSelectorParser::prependTypeSelectorIfNeeded):
3805         (WebCore::CSSSelectorParser::splitCompoundAtImplicitShadowCrossingCombinator):
3806         Make the split use our combinator, ShadowDescendant, and no longer do anything
3807         special with :slotted.
3808
3809         * cssjit/SelectorCompiler.cpp:
3810         (WebCore::SelectorCompiler::fragmentRelationForSelectorRelation):
3811         Remove ShadowDeep, ShadowSlot and ShadowPseudo in favor of our
3812         ShadowDescendant combinator.
3813
3814 2016-11-01  Wenson Hsieh  <wenson_hsieh@apple.com>
3815
3816         Turn the Input Events runtime flag on by default
3817         https://bugs.webkit.org/show_bug.cgi?id=164297
3818
3819         Reviewed by Ryosuke Niwa.
3820
3821         Set the initial value of inputEventsEnabled in Settings to true.
3822
3823         * page/Settings.in:
3824
3825 2016-11-01  Brady Eidson  <beidson@apple.com>
3826
3827         IndexedDB 2.0: Support IDBIndex getAll/getAllKeys.
3828         <rdar://problem/28806933> and https://bugs.webkit.org/show_bug.cgi?id=164294
3829
3830         Reviewed by Alex Christensen.
3831
3832         Tests: storage/indexeddb/modern/idbindex-getall-1-private.html
3833                storage/indexeddb/modern/idbindex-getall-1.html
3834                storage/indexeddb/modern/idbindex-getallkeys-1-private.html
3835                storage/indexeddb/modern/idbindex-getallkeys-1.html
3836                Existing imported W3C tests.
3837
3838         * Modules/indexeddb/IDBIndex.cpp:
3839         (WebCore::IDBIndex::getAll):
3840         (WebCore::IDBIndex::getAllKeys):
3841         * Modules/indexeddb/IDBIndex.h:
3842         * Modules/indexeddb/IDBIndex.idl:
3843
3844         * Modules/indexeddb/IDBRequest.cpp:
3845         (WebCore::IDBRequest::create):
3846         (WebCore::IDBRequest::createIndexGet):
3847         (WebCore::IDBRequest::createCount): Deleted.
3848         (WebCore::IDBRequest::createGet): Deleted.
3849         * Modules/indexeddb/IDBRequest.h:
3850
3851         * Modules/indexeddb/IDBTransaction.cpp:
3852         (WebCore::IDBTransaction::requestGetAllIndexRecords):
3853         (WebCore::IDBTransaction::requestIndexRecord):
3854         (WebCore::IDBTransaction::requestCount):
3855         * Modules/indexeddb/IDBTransaction.h:
3856
3857         * Modules/indexeddb/server/IndexValueStore.cpp:
3858         (WebCore::IDBServer::IndexValueStore::allValuesForKey):
3859         * Modules/indexeddb/server/IndexValueStore.h:
3860
3861         * Modules/indexeddb/server/MemoryIDBBackingStore.cpp:
3862         (WebCore::IDBServer::MemoryIDBBackingStore::getAllRecords):
3863
3864         * Modules/indexeddb/server/MemoryIndex.cpp:
3865         (WebCore::IDBServer::MemoryIndex::getAllRecords):
3866         * Modules/indexeddb/server/MemoryIndex.h:
3867
3868         * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
3869         (WebCore::IDBServer::SQLiteIDBBackingStore::getAllRecords):
3870         (WebCore::IDBServer::queryForGetAllObjectStoreRecords):
3871         (WebCore::IDBServer::SQLiteIDBBackingStore::getAllObjectStoreRecords):
3872         (WebCore::IDBServer::SQLiteIDBBackingStore::getAllIndexRecords):
3873         (WebCore::IDBServer::queryForGetAllRecords): Deleted.
3874         * Modules/indexeddb/server/SQLiteIDBBackingStore.h:
3875
3876 2016-11-01  Ryosuke Niwa  <rniwa@webkit.org>
3877
3878         Remove CUSTOM_ELEMENTS build flag
3879         https://bugs.webkit.org/show_bug.cgi?id=164267
3880
3881         Reviewed by Antti Koivisto.
3882
3883         Removed the build flag. Also rebaselined the bindings tests.
3884
3885         * Configurations/FeatureDefines.xcconfig:
3886         * DerivedSources.cpp:
3887         * bindings/generic/RuntimeEnabledFeatures.h:
3888         (WebCore::RuntimeEnabledFeatures::customElementsEnabled):
3889         * bindings/js/JSCSSStyleDeclarationCustom.cpp:
3890         (WebCore::JSCSSStyleDeclaration::putDelegate):
3891         * bindings/js/JSCustomElementInterface.cpp:
3892         * bindings/js/JSCustomElementInterface.h:
3893         * bindings/js/JSCustomElementRegistryCustom.cpp:
3894         * bindings/js/JSDOMStringMapCustom.cpp:
3895         (WebCore::JSDOMStringMap::deleteProperty):
3896         (WebCore::JSDOMStringMap::putDelegate):
3897         * bindings/js/JSElementCustom.cpp:
3898         (WebCore::toJSNewlyCreated):
3899         * bindings/js/JSHTMLElementCustom.cpp:
3900         (WebCore::constructJSHTMLElement):
3901         * bindings/js/JSHTMLOptionsCollectionCustom.cpp:
3902         (WebCore::JSHTMLOptionsCollection::setLength):
3903         (WebCore::JSHTMLOptionsCollection::indexSetter):
3904         * bindings/js/JSHTMLSelectElementCustom.cpp:
3905         (WebCore::JSHTMLSelectElement::indexSetter):
3906         * bindings/js/JSMainThreadExecState.h:
3907         * bindings/scripts/CodeGeneratorJS.pm:
3908         (GenerateImplementation):
3909         * bindings/scripts/test/JS/JSTestCEReactions.cpp:
3910         (WebCore::setJSTestCEReactionsAttributeWithCEReactionsFunction):
3911         (WebCore::setJSTestCEReactionsReflectAttributeWithCEReactionsFunction):
3912         (WebCore::setJSTestCEReactionsStringifierAttributeFunction):
3913         (WebCore::jsTestCEReactionsPrototypeFunctionMethodWithCEReactions):
3914         * bindings/scripts/test/JS/JSTestCEReactionsStringifier.cpp:
3915         (WebCore::setJSTestCEReactionsStringifierValueFunction):
3916         * css/CSSSelector.cpp:
3917         (WebCore::CSSSelector::selectorText):
3918         * css/CSSSelector.h:
3919         * css/PropertySetCSSStyleDeclaration.cpp:
3920         * css/SelectorChecker.cpp:
3921         (WebCore::SelectorChecker::checkOne):
3922         * css/SelectorCheckerTestFunctions.h:
3923         (WebCore::isDefinedElement):
3924         * css/SelectorPseudoClassAndCompatibilityElementMap.in:
3925         * cssjit/SelectorCompiler.cpp:
3926         (WebCore::SelectorCompiler::addPseudoClassType):
3927         * dom/CustomElementReactionQueue.cpp:
3928         * dom/CustomElementReactionQueue.h:
3929         * dom/CustomElementRegistry.cpp:
3930         * dom/CustomElementRegistry.h:
3931         * dom/CustomElementRegistry.idl:
3932         * dom/Document.cpp:
3933         (WebCore::createHTMLElementWithNameValidation):
3934         (WebCore::createFallbackHTMLElement):
3935         * dom/Element.cpp:
3936         (WebCore::Element::attributeChanged):
3937         (WebCore::Element::didMoveToNewDocument):
3938         (WebCore::Element::insertedInto):
3939         (WebCore::Element::removedFrom):
3940         * dom/Element.h:
3941         * dom/ElementRareData.cpp:
3942         * dom/ElementRareData.h:
3943         (WebCore::ElementRareData::setCustomElementReactionQueue):
3944         * dom/Node.h:
3945         (WebCore::Node::isFailedCustomElement):
3946         * dom/make_names.pl:
3947         (printWrapperFactoryCppFile):
3948         * html/HTMLElement.idl:
3949         * html/parser/HTMLConstructionSite.cpp:
3950         (WebCore::HTMLConstructionSite::createHTMLElementOrFindCustomElementInterface):
3951         * html/parser/HTMLConstructionSite.h:
3952         * html/parser/HTMLDocumentParser.cpp:
3953         (WebCore::HTMLDocumentParser::runScriptsForPausedTreeBuilder):
3954         * html/parser/HTMLTreeBuilder.cpp:
3955         (WebCore::HTMLTreeBuilder::insertGenericHTMLElement):
3956         (WebCore::HTMLTreeBuilder::didCreateCustomOrCallbackElement):
3957         * html/parser/HTMLTreeBuilder.h:
3958         (WebCore::HTMLTreeBuilder::hasParserBlockingScriptWork):
3959         * page/DOMWindow.cpp:
3960         * page/DOMWindow.h:
3961         * page/DOMWindow.idl:
3962
3963 2016-11-01  Antoine Quint  <graouts@apple.com>
3964
3965         [Modern Media Controls] Media Controller: Airplay support
3966         https://bugs.webkit.org/show_bug.cgi?id=163729
3967         <rdar://problem/27989484>
3968
3969         Reviewed by Dean Jackson.
3970
3971         We introduce the AirplaySupport class which brings support for playing the media
3972         via Airplay by clicking on the Airplay button in the media controls and correctly
3973         reflecting when the media is played through Airplay via the media API. The enabled
3974         state of the Airplay button is also tied to Airplay sources being available.
3975
3976         Test: media/modern-media-controls/airplay-support/airplay-support.html
3977
3978         * Modules/modern-media-controls/controls/airplay-button.js:
3979         (AirplayButton.prototype.get on):
3980         * Modules/modern-media-controls/js-files:
3981         * Modules/modern-media-controls/media/airplay-support.js: Added.
3982         (AirplaySupport.prototype.get control):
3983         (AirplaySupport.prototype.get mediaEvents):
3984         (AirplaySupport.prototype.buttonWasClicked):
3985         (AirplaySupport.prototype.handleEvent):
3986         (AirplaySupport.prototype.syncControl):
3987         (AirplaySupport):
3988         * Modules/modern-media-controls/media/media-controller.js:
3989         (MediaController):
3990         * WebCore.xcodeproj/project.pbxproj:
3991
3992 2016-11-01  Dean Jackson  <dino@apple.com>
3993
3994         Remove WebKitCSSFilterValue to make Hyatt happy
3995         https://bugs.webkit.org/show_bug.cgi?id=164289
3996         <rdar://problems/29050973>
3997
3998         Reviewed by Simon Fraser.
3999
4000         The new CSS parser should not use WebKitCSSFilterValue. It's non-standard,
4001         very likely only used in our tests, doesn't provide much benefit, and will be
4002         covered by the new CSSOM function interface.
4003
4004         Covered by modifying existing tests.
4005
4006         * DerivedSources.make: Remove WebKitCSSFilterValue.idl.
4007