Return a Promise from HTMLMediaElement.play()
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2016-05-05  Jer Noble  <jer.noble@apple.com>
2
3         Return a Promise from HTMLMediaElement.play()
4         https://bugs.webkit.org/show_bug.cgi?id=157400
5
6         Reviewed by Eric Carlson.
7
8         Tests: media/media-play-promise-reject-error-notsupported.html
9                media/media-play-promise-reject-load-abort.html
10                media/media-play-promise-reject-pause-abort.html
11                media/media-play-promise-reject-play-notallowed.html
12                media/media-play-promise-reject-play-notsupported.html
13                media/media-play-promise-resolve-when-playing.html
14                media/media-play-promise-resolve.html
15
16         The HTML Living Standard Spec <https://html.spec.whatwg.org/multipage/embedded-content.html>
17         (5 May 2016) adds support for a Promise to be returned by the play() method, to be resolved
18         or rejected at defined points during loading and playback.
19
20         Add utility methods which encapsulate the definitions of the equivalent algorithms from the
21         HTML Spec.  Add a new, overloaded play() method on HTMLMediaElement which takes a DeferredWrapper
22         reference.
23
24         After the change to use scheduleNotifyAboutPlaying() instead of enqueueing the "playing" event
25         directly, we must ensure that the notifyAboutPlaying() task does not get fired before the
26         "play" event preceeding it does. So re-implement GenericEventQueue (which previously used
27         a timer to dispatch events) to use a GenericTaskQueue instead. This ensures that all tasks and
28         events are interleaved in the order in which they were enqueued.
29
30         Additionally, the new pauseAfterDetachedTimerFired() event was firing out of microtask order, which
31         broke some W3C tests after the changes to GenericEventQueue. Move GenericEventQueue and
32         GenericTaskQueue to the same timing source (namely, a WebCore Timer) and interleave Events
33         and Tasks by having GenericEventQueue use GenericTaskQueue to issue its Events. Because
34         Document::postTask() cannot ensure ordering with Timer-based events, switch HTMLMediaElement
35         over to Timer-backed GenericTaskQueues.
36
37         Use a WeakPtr to track the destruction of TaskDispatcher<Timer> objects in pendingDispatchers().
38
39         * dom/GenericEventQueue.cpp:
40         (WebCore::GenericEventQueue::GenericEventQueue):
41         (WebCore::GenericEventQueue::enqueueEvent):
42         (WebCore::GenericEventQueue::close):
43         (WebCore::GenericEventQueue::cancelAllEvents):
44         (WebCore::GenericEventQueue::suspend):
45         (WebCore::GenericEventQueue::resume):
46         (WebCore::GenericEventQueue::sharedTimer): Deleted.
47         (WebCore::GenericEventQueue::sharedTimerFired): Deleted.
48         (WebCore::GenericEventQueue::pendingQueues): Deleted.
49         * dom/GenericEventQueue.h:
50         * platform/GenericTaskQueue.cpp: Added.
51         (WebCore::TaskDispatcher<Timer>::~TaskDispatcher):
52         (WebCore::TaskDispatcher<Timer>::postTask):
53         (WebCore::TaskDispatcher<Timer>::sharedTimer):
54         (WebCore::TaskDispatcher<Timer>::sharedTimerFired):
55         (WebCore::TaskDispatcher<Timer>::pendingDispatchers):
56         (WebCore::TaskDispatcher<Timer>::dispatchOneTask):
57         * platform/GenericTaskQueue.h:
58         (WebCore::TaskDispatcher<Timer>::TaskDispatcher): Deleted.
59         (WebCore::TaskDispatcher<Timer>::postTask): Deleted.
60         (WebCore::TaskDispatcher<Timer>::timerFired): Deleted.
61         * html/HTMLMediaElement.cpp:
62         (WebCore::HTMLMediaElement::HTMLMediaElement):
63         (WebCore::HTMLMediaElement::~HTMLMediaElement):
64         (WebCore::HTMLMediaElement::scheduleResolvePendingPlayPromises):
65         (WebCore::HTMLMediaElement::rejectPendingPlayPromises):
66         (WebCore::HTMLMediaElement::resolvePendingPlayPromises):
67         (WebCore::HTMLMediaElement::scheduleNotifyAboutPlaying):
68         (WebCore::HTMLMediaElement::notifyAboutPlaying):
69         (WebCore::HTMLMediaElement::noneSupported):
70         (WebCore::HTMLMediaElement::cancelPendingEventsAndCallbacks):
71         (WebCore::HTMLMediaElement::setReadyState):
72         (WebCore::HTMLMediaElement::play):
73         (WebCore::HTMLMediaElement::playInternal):
74         (WebCore::HTMLMediaElement::pauseInternal):
75         (WebCore::HTMLMediaElement::contextDestroyed):
76         (WebCore::HTMLMediaElement::stop):
77         (WebCore::HTMLMediaElement::pauseAfterDetachedTask): Renamed from pauseAfterDetachedTimerFired.
78         (WebCore::HTMLMediaElement::removedFrom):
79         (WebCore::HTMLMediaElement::contextDestroyed):
80         * html/HTMLMediaElement.h:
81         * html/HTMLMediaElement.idl:
82         * CMakeLists.txt:
83         * WebCore.xcodeproj/project.pbxproj:
84
85 2016-05-10  Commit Queue  <commit-queue@webkit.org>
86
87         Unreviewed, rolling out r200627.
88         https://bugs.webkit.org/show_bug.cgi?id=157531
89
90         This change has caused crashes in existing LayoutTests
91         (Requested by ryanhaddad on #webkit).
92
93         Reverted changeset:
94
95         "Return a Promise from HTMLMediaElement.play()"
96         https://bugs.webkit.org/show_bug.cgi?id=157400
97         http://trac.webkit.org/changeset/200627
98
99 2016-05-10  Simon Fraser  <simon.fraser@apple.com>
100
101         Fix scrolling tree dumping
102         https://bugs.webkit.org/show_bug.cgi?id=157529
103
104         Reviewed by Tim Horton.
105
106         Scrolling tree dumps cannot contain layerIDs because they are not stable between
107         runs. Fix by adding ScrollingStateTreeAsTextBehavior flags, and not dumping
108         the layerID for tests.
109
110         Sadly RemoteScrollingCoordinatorTransaction has a lot of duplicated code for dumping
111         the scrolling state tree, which should be converted to dumpProperties() at some point.
112         
113         Fix the one test that suffered from this problem, and unskip it.
114
115         Test: fast/scrolling/ios/remove-scrolling-role.html
116
117         * page/scrolling/ScrollingStateFixedNode.cpp:
118         (WebCore::ScrollingStateFixedNode::dumpProperties):
119         * page/scrolling/ScrollingStateFixedNode.h:
120         * page/scrolling/ScrollingStateFrameScrollingNode.cpp:
121         (WebCore::ScrollingStateFrameScrollingNode::dumpProperties):
122         * page/scrolling/ScrollingStateFrameScrollingNode.h:
123         * page/scrolling/ScrollingStateNode.cpp:
124         (WebCore::ScrollingStateNode::dump):
125         (WebCore::ScrollingStateNode::scrollingStateTreeAsText):
126         * page/scrolling/ScrollingStateNode.h:
127         * page/scrolling/ScrollingStateOverflowScrollingNode.cpp:
128         (WebCore::ScrollingStateOverflowScrollingNode::dumpProperties):
129         * page/scrolling/ScrollingStateOverflowScrollingNode.h:
130         * page/scrolling/ScrollingStateScrollingNode.cpp:
131         (WebCore::ScrollingStateScrollingNode::dumpProperties):
132         * page/scrolling/ScrollingStateScrollingNode.h:
133         * page/scrolling/ScrollingStateStickyNode.cpp:
134         (WebCore::ScrollingStateStickyNode::dumpProperties):
135         * page/scrolling/ScrollingStateStickyNode.h:
136
137 2016-05-10  Csaba Osztrogonác  <ossy@webkit.org>
138
139         Fix the !ENABLE(CSS_REGIONS) build after r198990
140         https://bugs.webkit.org/show_bug.cgi?id=157516
141
142         Reviewed by Ryosuke Niwa.
143
144         * style/StyleTreeResolver.cpp:
145         (WebCore::Style::affectsRenderedSubtree):
146
147 2016-05-05  Jer Noble  <jer.noble@apple.com>
148
149         Return a Promise from HTMLMediaElement.play()
150         https://bugs.webkit.org/show_bug.cgi?id=157400
151
152         Reviewed by Eric Carlson.
153
154         Tests: media/media-play-promise-reject-error-notsupported.html
155                media/media-play-promise-reject-load-abort.html
156                media/media-play-promise-reject-pause-abort.html
157                media/media-play-promise-reject-play-notallowed.html
158                media/media-play-promise-reject-play-notsupported.html
159                media/media-play-promise-resolve-when-playing.html
160                media/media-play-promise-resolve.html
161
162         The HTML Living Standard Spec <https://html.spec.whatwg.org/multipage/embedded-content.html>
163         (5 May 2016) adds support for a Promise to be returned by the play() method, to be resolved
164         or rejected at defined points during loading and playback.
165
166         Add utility methods which encapsulate the definitions of the equivalent algorithms from the
167         HTML Spec.  Add a new, overloaded play() method on HTMLMediaElement which takes a DeferredWrapper
168         reference.
169
170         After the change to use scheduleNotifyAboutPlaying() instead of enqueueing the "playing" event
171         directly, we must ensure that the notifyAboutPlaying() task does not get fired before the
172         "play" event preceeding it does. So re-implement GenericEventQueue (which previously used
173         a timer to dispatch events) to use a GenericTaskQueue instead. This ensures that all tasks and
174         events are interleaved in the order in which they were enqueued.
175
176         Additionally, the new pauseAfterDetachedTimerFired() event was firing out of microtask order, which
177         broke some W3C tests after the changes to GenericEventQueue. Move GenericEventQueue and
178         GenericTaskQueue to the same timing source (namely, a WebCore Timer) and interleave Events
179         and Tasks by having GenericEventQueue use GenericTaskQueue to issue its Events. Because
180         Document::postTask() cannot ensure ordering with Timer-based events, switch HTMLMediaElement
181         over to Timer-backed GenericTaskQueues.
182
183         * dom/GenericEventQueue.cpp:
184         (WebCore::GenericEventQueue::GenericEventQueue):
185         (WebCore::GenericEventQueue::enqueueEvent):
186         (WebCore::GenericEventQueue::close):
187         (WebCore::GenericEventQueue::cancelAllEvents):
188         (WebCore::GenericEventQueue::suspend):
189         (WebCore::GenericEventQueue::resume):
190         (WebCore::GenericEventQueue::sharedTimer): Deleted.
191         (WebCore::GenericEventQueue::sharedTimerFired): Deleted.
192         (WebCore::GenericEventQueue::pendingQueues): Deleted.
193         * dom/GenericEventQueue.h:
194         * platform/GenericTaskQueue.cpp: Added.
195         (WebCore::TaskDispatcher<Timer>::~TaskDispatcher):
196         (WebCore::TaskDispatcher<Timer>::postTask):
197         (WebCore::TaskDispatcher<Timer>::sharedTimer):
198         (WebCore::TaskDispatcher<Timer>::sharedTimerFired):
199         (WebCore::TaskDispatcher<Timer>::pendingDispatchers):
200         (WebCore::TaskDispatcher<Timer>::dispatchOneTask):
201         * platform/GenericTaskQueue.h:
202         (WebCore::TaskDispatcher<Timer>::TaskDispatcher): Deleted.
203         (WebCore::TaskDispatcher<Timer>::postTask): Deleted.
204         (WebCore::TaskDispatcher<Timer>::timerFired): Deleted.
205         * html/HTMLMediaElement.cpp:
206         (WebCore::HTMLMediaElement::HTMLMediaElement):
207         (WebCore::HTMLMediaElement::~HTMLMediaElement):
208         (WebCore::HTMLMediaElement::scheduleResolvePendingPlayPromises):
209         (WebCore::HTMLMediaElement::rejectPendingPlayPromises):
210         (WebCore::HTMLMediaElement::resolvePendingPlayPromises):
211         (WebCore::HTMLMediaElement::scheduleNotifyAboutPlaying):
212         (WebCore::HTMLMediaElement::notifyAboutPlaying):
213         (WebCore::HTMLMediaElement::noneSupported):
214         (WebCore::HTMLMediaElement::cancelPendingEventsAndCallbacks):
215         (WebCore::HTMLMediaElement::setReadyState):
216         (WebCore::HTMLMediaElement::play):
217         (WebCore::HTMLMediaElement::playInternal):
218         (WebCore::HTMLMediaElement::pauseInternal):
219         (WebCore::HTMLMediaElement::contextDestroyed):
220         (WebCore::HTMLMediaElement::stop):
221         (WebCore::HTMLMediaElement::pauseAfterDetachedTask): Renamed from pauseAfterDetachedTimerFired.
222         (WebCore::HTMLMediaElement::removedFrom):
223         (WebCore::HTMLMediaElement::contextDestroyed):
224         * html/HTMLMediaElement.h:
225         * html/HTMLMediaElement.idl:
226         * CMakeLists.txt:
227         * WebCore.xcodeproj/project.pbxproj:
228
229 2016-05-10  Chris Dumez  <cdumez@apple.com>
230
231         Get rid of a lot of calls to RefPtr::release()
232         https://bugs.webkit.org/show_bug.cgi?id=157505
233
234         Reviewed by Alex Christensen.
235
236         Get rid of a lot of calls to RefPtr::release() and use WTFMove() instead.
237
238         * Modules/encryptedmedia/MediaKeySession.cpp:
239         (WebCore::MediaKeySession::addKeyTimerFired):
240         (WebCore::MediaKeySession::sendMessage):
241         (WebCore::MediaKeySession::sendError):
242         * Modules/geolocation/Geolocation.cpp:
243         (WebCore::createGeoposition):
244         * Modules/indexeddb/DOMWindowIndexedDatabase.cpp:
245         (WebCore::DOMWindowIndexedDatabase::disconnectFrameForDocumentSuspension):
246         (WebCore::DOMWindowIndexedDatabase::reconnectFrameFromDocumentSuspension):
247         * Modules/indexeddb/IDBKey.h:
248         (WebCore::IDBKey::createMultiEntryArray):
249         * Modules/mediasource/MediaSource.cpp:
250         (WebCore::MediaSource::scheduleEvent):
251         * Modules/mediasource/SourceBuffer.cpp:
252         (WebCore::SourceBuffer::scheduleEvent):
253         * Modules/mediasource/SourceBufferList.cpp:
254         (WebCore::SourceBufferList::scheduleEvent):
255         * Modules/notifications/DOMWindowNotifications.cpp:
256         (WebCore::DOMWindowNotifications::disconnectFrameForDocumentSuspension):
257         (WebCore::DOMWindowNotifications::reconnectFrameFromDocumentSuspension):
258         * Modules/webdatabase/DatabaseManager.cpp:
259         (WebCore::DatabaseManager::openDatabaseBackend):
260         * Modules/webdatabase/DatabaseManager.h:
261         * Modules/webdatabase/SQLCallbackWrapper.h:
262         (WebCore::SQLCallbackWrapper::unwrap):
263         * Modules/websockets/WebSocketChannel.cpp:
264         (WebCore::WebSocketChannel::enqueueTextFrame):
265         (WebCore::WebSocketChannel::enqueueRawFrame):
266         (WebCore::WebSocketChannel::enqueueBlobFrame):
267         (WebCore::WebSocketChannel::processOutgoingFrameQueue):
268         * bindings/js/JSBlobCustom.cpp:
269         (WebCore::constructJSBlob):
270         * bindings/js/JSGeolocationCustom.cpp:
271         (WebCore::createPositionOptions):
272         (WebCore::JSGeolocation::getCurrentPosition):
273         (WebCore::JSGeolocation::watchPosition):
274         * bindings/js/JSMessagePortCustom.cpp:
275         (WebCore::fillMessagePortArray):
276         * bindings/js/JSSQLTransactionCustom.cpp:
277         (WebCore::JSSQLTransaction::executeSql):
278         * bindings/js/ScriptControllerMac.mm:
279         (WebCore::ScriptController::createScriptInstanceForWidget):
280         * bindings/scripts/CodeGeneratorJS.pm:
281         (GenerateCallWith):
282         * crypto/mac/CryptoKeyRSAMac.cpp:
283         (WebCore::CryptoKeyRSA::generatePair):
284         * css/CSSBasicShapes.cpp:
285         (WebCore::buildSerializablePositionOffset):
286         * css/CSSComputedStyleDeclaration.cpp:
287         (WebCore::valueForNinePieceImageRepeat):
288         (WebCore::counterToCSSValue):
289         (WebCore::ComputedStyleExtractor::propertyValue):
290         * css/CSSContentDistributionValue.cpp:
291         (WebCore::CSSContentDistributionValue::customCSSText):
292         * css/CSSFilterImageValue.cpp:
293         (WebCore::CSSFilterImageValue::image):
294         * css/CSSFilterImageValue.h:
295         * css/CSSGrammar.y.in:
296         * css/CSSNamedImageValue.cpp:
297         (WebCore::CSSNamedImageValue::image):
298         * css/CSSNamedImageValue.h:
299         * css/CSSParser.cpp:
300         (WebCore::CSSParser::parseFillProperty):
301         (WebCore::CSSParser::parseAnimationProperty):
302         (WebCore::CSSParser::parseInsetRoundedCorners):
303         (WebCore::ShadowParseContext::commitLength):
304         (WebCore::CSSParser::parseShadow):
305         (WebCore::BorderImageSliceParseContext::commitNumber):
306         (WebCore::BorderImageQuadParseContext::commitNumber):
307         (WebCore::CSSParser::parseBorderRadius):
308         (WebCore::CSSParser::parseCounter):
309         (WebCore::CSSParser::parseDeprecatedGradient):
310         (WebCore::CSSParser::parseDeprecatedLinearGradient):
311         (WebCore::CSSParser::parseDeprecatedRadialGradient):
312         (WebCore::CSSParser::parseLinearGradient):
313         (WebCore::CSSParser::parseRadialGradient):
314         (WebCore::CSSParser::parseTransformValue):
315         (WebCore::CSSParser::parseBuiltinFilterArguments):
316         (WebCore::CSSParser::parseTextIndent):
317         (WebCore::CSSParser::popRuleData):
318         (WebCore::CSSParser::markRuleHeaderStart):
319         (WebCore::CSSParser::createViewportRule):
320         * css/CSSParser.h:
321         * css/CSSParserValues.cpp:
322         (WebCore::CSSParserValue::createCSSValue):
323         * css/CSSParserValues.h:
324         * css/CSSValueList.cpp:
325         (WebCore::CSSValueList::copy):
326         * css/CSSValueList.h:
327         * css/SVGCSSComputedStyleDeclaration.cpp:
328         (WebCore::ComputedStyleExtractor::svgPropertyValue):
329         * css/StyleBuilderConverter.h:
330         (WebCore::StyleBuilderConverter::convertClipPath):
331         (WebCore::StyleBuilderConverter::convertReflection):
332         * css/StyleResolver.cpp:
333         (WebCore::StyleResolver::cachedOrPendingFromValue):
334         (WebCore::StyleResolver::setOrPendingFromValue):
335         (WebCore::StyleResolver::cursorOrPendingFromValue):
336         * css/StyleResolver.h:
337         * css/StyleRule.cpp:
338         (WebCore::StyleRuleBase::createCSSOMWrapper):
339         * css/StyleRule.h:
340         * dom/Attr.cpp:
341         (WebCore::Attr::create):
342         * dom/Attr.h:
343         * dom/ContainerNode.h:
344         (WebCore::ChildNodesLazySnapshot::nextNode):
345         * dom/Document.cpp:
346         (WebCore::Document::setFocusedElement):
347         (WebCore::Document::takeDOMWindowFrom):
348         (WebCore::Document::updateHoverActiveState):
349         * dom/Element.cpp:
350         (WebCore::Element::detachAttribute):
351         (WebCore::Element::setAttributeNodeNS):
352         (WebCore::Element::ensureAttr):
353         * dom/Element.h:
354         * dom/MessagePort.cpp:
355         (WebCore::MessagePort::dispatchMessages):
356         (WebCore::MessagePort::entanglePorts):
357         * dom/NodeIterator.cpp:
358         (WebCore::NodeIterator::nextNode):
359         (WebCore::NodeIterator::previousNode):
360         * dom/Range.cpp:
361         (WebCore::Range::processContentsBetweenOffsets):
362         * dom/StyledElement.cpp:
363         (WebCore::StyledElement::rebuildPresentationAttributeStyle):
364         * editing/ApplyBlockElementCommand.cpp:
365         (WebCore::ApplyBlockElementCommand::createBlockElement):
366         * editing/ApplyBlockElementCommand.h:
367         * editing/ApplyStyleCommand.cpp:
368         (WebCore::ApplyStyleCommand::applyRelativeFontStyleChange):
369         * editing/CompositeEditCommand.cpp:
370         (WebCore::CompositeEditCommand::applyCommandToComposite):
371         (WebCore::CompositeEditCommand::appendBlockPlaceholder):
372         (WebCore::CompositeEditCommand::insertBlockPlaceholder):
373         (WebCore::CompositeEditCommand::addBlockPlaceholderIfNeeded):
374         (WebCore::CompositeEditCommand::insertNewDefaultParagraphElementAt):
375         (WebCore::CompositeEditCommand::moveParagraphContentsToNewBlockIfNecessary):
376         (WebCore::CompositeEditCommand::cloneParagraphUnderNewElement):
377         (WebCore::CompositeEditCommand::moveParagraphs):
378         * editing/CompositeEditCommand.h:
379         * editing/EditingStyle.cpp:
380         (WebCore::EditingStyle::wrappingStyleForSerialization):
381         (WebCore::styleFromMatchedRulesForElement):
382         (WebCore::extractPropertiesNotIn):
383         (WebCore::backgroundColorInEffect):
384         * editing/EditingStyle.h:
385         * editing/Editor.cpp:
386         (WebCore::Editor::increaseSelectionListLevel):
387         (WebCore::Editor::increaseSelectionListLevelOrdered):
388         (WebCore::Editor::increaseSelectionListLevelUnordered):
389         (WebCore::Editor::findStringAndScrollToVisible):
390         (WebCore::Editor::rangeOfString):
391         * editing/Editor.h:
392         * editing/InsertParagraphSeparatorCommand.cpp:
393         (WebCore::InsertParagraphSeparatorCommand::cloneHierarchyUnderNewBlock):
394         * editing/InsertParagraphSeparatorCommand.h:
395         * editing/MergeIdenticalElementsCommand.cpp:
396         (WebCore::MergeIdenticalElementsCommand::doUnapply):
397         * editing/ModifySelectionListLevel.cpp:
398         (WebCore::IncreaseSelectionListLevelCommand::doApply):
399         (WebCore::IncreaseSelectionListLevelCommand::increaseSelectionListLevel):
400         * editing/ModifySelectionListLevel.h:
401         * editing/RemoveNodeCommand.cpp:
402         (WebCore::RemoveNodeCommand::doUnapply):
403         * editing/RemoveNodePreservingChildrenCommand.cpp:
404         (WebCore::RemoveNodePreservingChildrenCommand::doApply):
405         * editing/ReplaceSelectionCommand.cpp:
406         (WebCore::ReplacementFragment::insertFragmentForTestRendering):
407         * editing/SpellingCorrectionCommand.cpp:
408         (WebCore::SpellingCorrectionCommand::doApply):
409         * editing/mac/DictionaryLookup.h:
410         * editing/mac/DictionaryLookup.mm:
411         (WebCore::DictionaryLookup::rangeForSelection):
412         (WebCore::DictionaryLookup::rangeAtHitTestResult):
413         * html/HTMLFormElement.cpp:
414         (WebCore::HTMLFormElement::finishRequestAutocomplete):
415         * html/HTMLMediaElement.cpp:
416         (WebCore::HTMLMediaElement::scheduleEvent):
417         (WebCore::HTMLMediaElement::updateActiveTextTrackCues):
418         (WebCore::HTMLMediaElement::mediaPlayerKeyNeeded):
419         (WebCore::HTMLMediaElement::addTextTrack):
420         (WebCore::HTMLMediaElement::enqueuePlaybackTargetAvailabilityChangedEvent):
421         * html/HTMLMediaElement.h:
422         * html/canvas/OESVertexArrayObject.cpp:
423         (WebCore::OESVertexArrayObject::createVertexArrayOES):
424         * html/canvas/OESVertexArrayObject.h:
425         * html/canvas/WebGLRenderingContextBase.cpp:
426         (WebCore::WebGLRenderingContextBase::getContextAttributes):
427         * html/canvas/WebGLRenderingContextBase.h:
428         * html/track/VTTCue.cpp:
429         (WebCore::VTTCue::getCueAsHTML):
430         (WebCore::VTTCue::createCueRenderingTree):
431         * html/track/VTTCue.h:
432         * html/track/WebVTTElement.cpp:
433         (WebCore::WebVTTElement::createEquivalentHTMLElement):
434         * html/track/WebVTTElement.h:
435         * html/track/WebVTTParser.cpp:
436         (WebCore::WebVTTTreeBuilder::buildFromString):
437         (WebCore::WebVTTParser::createDocumentFragmentFromCueText):
438         * html/track/WebVTTParser.h:
439
440 2016-05-05  Gavin Barraclough  <barraclough@apple.com>
441
442         Allow some leeway after page load before throttling, to allow post load events to complete.
443         https://bugs.webkit.org/show_bug.cgi?id=157499
444
445         Reviewed by Ryosuke Niwa
446
447         * page/PageThrottler.cpp:
448         (WebCore::PageThrottler::PageThrottler):
449             - m_pageLoadActivityCounter now affects activity state indirecty, via m_pageLoadActivityHysteresis.
450         (WebCore::PageThrottler::pageLoadActivityCounterChanged):
451             - counter updates hysteresis object, which in turn will affect activity state.
452         * page/PageThrottler.h:
453             - added m_pageLoadActivityHysteresis, pageLoadActivityCounterChanged.
454
455 2016-05-10  Zalan Bujtas  <zalan@apple.com>
456
457         REGRESSION (r193610): Drop down menu doesn’t expand at allofbach.com
458         https://bugs.webkit.org/show_bug.cgi?id=157445
459
460         Reviewed by Simon Fraser.
461
462         When we don't run transitions (becasuse of to/from 'auto' values) we should also not
463         report the 'from' value and behave as if we finished the transition already.
464
465         Test: fast/animation/height-auto-transition-computed-value.html
466
467         * page/animation/KeyframeAnimation.cpp:
468         (WebCore::KeyframeAnimation::fetchIntervalEndpointsForProperty): This is a revert of
469         looping the 'to' value back to the first keyframe when reverse animation is at the start value (last keyframe).
470
471         * platform/Length.cpp:
472         (WebCore::blend):
473
474 2016-05-09  Dean Jackson  <dino@apple.com>
475
476         [iOS] <select> elements should render right-aligned when in RTL mode
477         https://bugs.webkit.org/show_bug.cgi?id=157501
478         <rdar://problem/26187870>
479
480         Reviewed by Antoine Quint.
481
482         This is the equivalent of http://webkit.org/b/157112 for iOS.
483         Handle <select> elements when we're in RTL mode. This means
484         drawing the button with the drop-down arrow on the left
485         side, and the button text right-aligned.
486
487         Test: fast/forms/select-non-native-rendering-direction.html
488         plus a bunch of other ones that needed rebaselining.
489
490         * rendering/RenderThemeIOS.mm: Rename MenuListButtonPaddingRight to MenuListButtonPaddingAfter.
491         (WebCore::RenderThemeIOS::popupInternalPaddingBox): Handle both directions.
492         (WebCore::adjustInputElementButtonStyle):
493         (WebCore::RenderThemeIOS::paintMenuListButtonDecorations): Handle drawing in
494         RTL mode.
495
496 2016-05-10  Youenn Fablet  <youenn.fablet@crf.canon.fr>
497
498         NodeList should be iterable
499         https://bugs.webkit.org/show_bug.cgi?id=131443
500         <rdar://problem/25731519>
501
502         Reviewed by Darin Adler.
503
504         Test: fast/dom/nodeListIterator.html
505
506         Updating JSKeyValueIterator to support map and set iterators,
507         depending on the signature of the result type of DOMClass::Iterator::next method.
508         Symbol.iterator method is made the same as values method for set iterators.
509
510         Adding support for NodeList.
511         Updating FontFaceSet to take benefit of that. 
512
513         * bindings/js/JSDOMBinding.h:
514         (WebCore::jsPair):.
515         * bindings/js/JSKeyValueIterator.h:
516         (WebCore::IteratorInspector::decltype): IteratorInspector detects whether the iterator is a set or map iterator.
517         (WebCore::IteratorInspector::test):
518         (WebCore::fillForEachArgumentsWithIteratorValue): Specializing according set/map iterator.
519         (WebCore::iteratorValueToJS): Ditto.
520         (WebCore::keyValueIteratorForEach):
521         (WebCore::JSKeyValueIterator<JSWrapper>::next):
522         * bindings/scripts/CodeGeneratorJS.pm:
523         (GenerateImplementationIterableFunctions): Removed the line forbidding set iterators.
524         Making Symbol.iterator function equal to values for set iterators.
525         * bindings/scripts/test/JS/JSTestNode.cpp: Rebasing with set iterator functions.
526         * bindings/scripts/test/JS/JSTestObj.cpp: Rebasing according updated function names.
527         * bindings/scripts/test/TestNode.idl: Making TestNode set iterable.
528         * css/FontFaceSet.cpp:
529         (WebCore::FontFaceSet::Iterator::next): Refactoring to make it a set iterator.
530         * css/FontFaceSet.h:
531         * css/FontFaceSet.idl:
532         * dom/NodeList.h: Making NodeList iterable.
533         (WebCore::NodeList::Iterator::Iterator):
534         (WebCore::NodeList::Iterator::next):
535         (WebCore::NodeList::createIterator):
536         * dom/NodeList.idl:
537
538 2016-05-09  Sergio Villar Senin  <svillar@igalia.com>
539
540         [css-grid] Implement auto-repeat computation
541         https://bugs.webkit.org/show_bug.cgi?id=157473
542
543         Reviewed by Darin Adler.
544
545         We added support for parsing and style for the new auto-repeat syntax. This patch actually
546         implements the feature by computing the number of auto-repeat tracks that will be part of
547         the explicit grid depending on the available size on the corresponding axis.
548
549         Note that we still do not drop the empty tracks, i.e., auto-fit will work exactly as
550         auto-fill until the empty track removal is implemented.
551
552         Some test results are not totally correct yet because we need to add the line names to the
553         computed style. As that requires a rather large piece of code it will be done in a follow up
554         patch. Track sizes are correct though.
555
556         Tests: fast/css-grid-layout/grid-auto-fill-columns.html
557                fast/css-grid-layout/grid-auto-fill-rows.html
558                fast/css-grid-layout/grid-change-auto-repeat-tracks.html
559                fast/css-grid-layout/mozilla/grid-repeat-auto-fill-fit-001.html
560                fast/css-grid-layout/mozilla/grid-repeat-auto-fill-fit-002.html
561                fast/css-grid-layout/mozilla/grid-repeat-auto-fill-fit-003.html
562                fast/css-grid-layout/mozilla/grid-repeat-auto-fill-fit-004.html
563                fast/css-grid-layout/mozilla/grid-repeat-auto-fill-fit-005.html
564
565         * css/CSSParser.cpp:
566         (WebCore::CSSParser::parseGridTrackRepeatFunction): Add the CSSAutoRepeatValue directly
567         instead of adding the track size.
568         * css/StyleBuilderCustom.h: Store the insertion point in style.
569         * rendering/RenderGrid.cpp:
570         (WebCore::RenderGrid::guttersSize): Replaced size_t by unsigned.
571         (WebCore::RenderGrid::rawGridTrackSize): New function which retrieves the track size from
572         either explicit (including auto-repeat tracks) or implicit tracks.
573         (WebCore::RenderGrid::gridTrackSize): Use rawGridTrackSize().
574         (WebCore::RenderGrid::computeAutoRepeatTracksCount): This is the core of the patch. This
575         method computes the number of auto-repeat tracks that fits on the available size for a given
576         axis (or 1 if that's indefinite).
577         * rendering/RenderGrid.h:
578
579 2016-05-09  Alex Christensen  <achristensen@webkit.org>
580
581         Fix GTK build after r200607
582
583         * Modules/notifications/Notification.h:
584         dir and replaceId are used in WebNotificationManager with NOTIFICATIONS and with LEGACY_NOTIFICATIONS
585
586 2016-05-09  Simon Fraser  <simon.fraser@apple.com>
587
588         Fix the Windows build after r200602, and do some minor tidyup.
589
590         * platform/graphics/ca/PlatformCALayer.h:
591         * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
592         (PlatformCALayerCocoa::contentsHidden):
593         * platform/graphics/ca/win/PlatformCALayerWin.cpp:
594         (PlatformCALayerWin::contentsHidden):
595         (PlatformCALayerWin::setContentsHidden):
596         * platform/graphics/ca/win/PlatformCALayerWin.h:
597
598 2016-05-09  Darin Adler  <darin@apple.com>
599
600         Change Notification constructor to take an IDL dictionary instead of a WebCore::Dictionary
601         https://bugs.webkit.org/show_bug.cgi?id=157466
602
603         Reviewed by Alex Christensen.
604
605         * Modules/notifications/Notification.cpp: Got rid of unneeded includes.
606         (WebCore::Notification::Notification): Deleted the unused default constructor. Changed
607         NotificationCenter argument to be reference rather than PassRefPtr. Changed one of the
608         ScriptExecutionContext arguments to be a Document since the code relies on that already.
609         Used the lambda form of timer creation instead of the class member form. Added a FIXME
610         about when m_notificationCenter can be null.
611         (WebCore::Notification::create): Changed NotificationCenter argument to be reference
612         rather than PassRefPtr. Changed options argument to be Options rather than Dictionary.
613         (WebCore::directionString): Added. Helper because the class still wants to store the
614         direction as a string, at least for now.
615         (WebCore::Notification::show): Streamlined the code a bit.
616         (WebCore::Notification::taskTimerFired): Deleted. Not needed now that we use a lambda
617         inside the constructor.
618         (WebCore::Notification::permission): Removed unneeded const from return type.
619         (WebCore::Notification::permissionString): Ditto.
620
621         * Modules/notifications/Notification.h: Used pragma once, updated for changes above.
622         Removed a number of unused functions, including cancel, setIconURL, setLang,
623         stopLoadingIcon, detachPresenter, setBody, startLoadingIcon, finishLoadingIcon, and
624         taskTimerFired.
625
626         * Modules/notifications/Notification.idl: Add NotificationOptions and pass it instead
627         of Dictionary to the constructor. Note that this is only a subset of what is
628         currently specified in the Notifications API document. The latest document specifies
629         a much more complex feature with lots more options.
630
631         * Modules/notifications/NotificationCenter.cpp:
632         (WebCore::NotificationCenter::createNotification): Pass a reference rather than a
633         pointer to this.
634         * Modules/notifications/NotificationClient.h: Use pragma once. Removed unneeded
635         includes and forward declarations. Fixed #if to be easier to read.
636
637         * bindings/js/JSDOMConvert.h: Reworked the convert functions to use Converter and
638         DefaultConverter structs so we can do partial specialization in the future and so
639         we can get custom types for optional values. Used this to make an optional String
640         just be a null String, so it won't try to use Optional<String> instead. Might get
641         more complex latter when we add support for nullable.
642
643         * bindings/scripts/CodeGeneratorJS.pm:
644         (GenerateEnumerationImplementationContent): Generate a blank line to make the output
645         slightly clearer. Tweaked a comment.
646         (GenerateDefaultValue): Added. Converts the default syntax from IDL into the syntax
647         needed in C++ code.
648         (GenerateDefaultValueWithLeadingComma): Added. Helper for use below.
649         (GenerateDictionaryImplementationContent): Use GenerateDefaultValue and
650         GenerateDefaultValueWithLeadingComma to make default values.
651         (GenerateParametersCheck): Use GenerateDefaultValue here in the enumeration code
652         path. This is a step in the direction of being able to make the whole thing more
653         generic in the future.
654
655         * bindings/scripts/test/GObject/WebKitDOMTestObj.cpp:
656         * bindings/scripts/test/GObject/WebKitDOMTestObj.h:
657         * bindings/scripts/test/JS/JSTestObj.cpp:
658         * bindings/scripts/test/ObjC/DOMTestObj.h:
659         * bindings/scripts/test/ObjC/DOMTestObj.mm:
660         Regenerated.
661
662         * bindings/scripts/test/TestObj.idl: Simplified and extended some of the test cases
663         to cover more combinations of the dictionary and enumeration support.
664
665 2016-05-09  Brady Eidson  <beidson@apple.com>
666
667         Modern IDB: Have server database connections remember the OpenDB request that spawned them.
668         https://bugs.webkit.org/show_bug.cgi?id=157498
669
670         Reviewed by Tim Horton.
671
672         No new tests (No testable change in behavior, debug only for now).
673
674         * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
675         (WebCore::IDBServer::UniqueIDBDatabase::performCurrentOpenOperation):
676         
677         * Modules/indexeddb/server/UniqueIDBDatabaseConnection.cpp:
678         (WebCore::IDBServer::UniqueIDBDatabaseConnection::create):
679         (WebCore::IDBServer::UniqueIDBDatabaseConnection::UniqueIDBDatabaseConnection):
680         (WebCore::IDBServer::UniqueIDBDatabaseConnection::connectionClosedFromClient):
681         (WebCore::IDBServer::UniqueIDBDatabaseConnection::didFireVersionChangeEvent):
682         (WebCore::IDBServer::UniqueIDBDatabaseConnection::createVersionChangeTransaction):
683         (WebCore::IDBServer::UniqueIDBDatabaseConnection::establishTransaction):
684         (WebCore::IDBServer::UniqueIDBDatabaseConnection::didAbortTransaction):
685         (WebCore::IDBServer::UniqueIDBDatabaseConnection::didCommitTransaction):
686         * Modules/indexeddb/server/UniqueIDBDatabaseConnection.h:
687         (WebCore::IDBServer::UniqueIDBDatabaseConnection::openRequestIdentifier):
688
689 2016-05-09  Simon Fraser  <simon.fraser@apple.com>
690
691         [iOS] visibility:hidden -webkit-overflow-scrolling: touch divs can interfere with page scrolling
692         https://bugs.webkit.org/show_bug.cgi?id=157496
693
694         Reviewed by Tim Horton.
695
696         UIScrollViews are constructed in the UI process for visibility:hidden scrollable elements
697         with -webkit-overflow-scrolling: touch, and these intercept user events when they should not.
698
699         Fix by propagating a "contentsHidden" flag from the web process which is used to turn off
700         user interaction on these views.
701
702         Test: fast/scrolling/ios/touch-scroll-visibility-hidden.html
703
704         * platform/graphics/ca/GraphicsLayerCA.cpp:
705         (WebCore::GraphicsLayerCA::updateContentsVisibility): We have to tell the scrolling layer
706         if we have visibility:hidden.
707         * platform/graphics/ca/PlatformCALayer.h:
708         * platform/graphics/ca/cocoa/PlatformCALayerCocoa.h:
709         * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
710         (PlatformCALayerCocoa::contentsHidden):
711         (PlatformCALayerCocoa::setContentsHidden):
712         * rendering/RenderLayerBacking.cpp:
713         (WebCore::RenderLayerBacking::updateAfterDescendants):
714
715 2016-05-09  Myles C. Maxfield  <mmaxfield@apple.com>
716
717         Web Font is downloaded even when all the characters in the document are outside its unicode-range
718         https://bugs.webkit.org/show_bug.cgi?id=42154
719         <rdar://problem/17779042>
720
721         Reviewed by Darin Adler.
722
723         Fonts are requested in two stages:
724         - For a given font family, all the relevant @font-face rules are consulted. We build up a
725         mapping of unicode-range -> Font object. This result is cached.
726         - Then, when we have the mapping, we look up the character we are trying to render to
727         find the appropriate Font object.
728
729         However, we are not supposed to create any Font objects (because that causes a download to
730         be triggered) until we consult with the character we're trying to render. Therefore, this
731         patch swaps out the Font objects with a FontAccessor. This FontAccessor is essentially a
732         lazily-created Font. When step 2 starts looking up the appropriate character, the
733         FontAccessor will be asked to start the download.
734
735         Test: fast/text/unicode-range-download.html
736
737         * css/CSSFontFace.cpp:
738         (WebCore::CSSFontFace::removeClient): 
739         as a client from all its CSSFontFaces.
740         * css/CSSFontFaceSet.cpp:
741         (WebCore::CSSFontFaceSet::clear): Clearing the CSSFontFaceSet needs to remove itself as a
742         client from all its CSSFontFaces.
743         * css/CSSSegmentedFontFace.cpp:
744         (WebCore::CSSFontAccessor::create): The lazy Font object.
745         (WebCore::CSSFontAccessor::CSSFontAccessor): Ditto.
746         (WebCore::appendFontWithInvalidUnicodeRangeIfLoading): Appends a FontAccessor.
747         (WebCore::CSSSegmentedFontFace::fontRanges): Create the FontAccessor and use it instead.
748         * platform/graphics/FontCascadeFonts.cpp:
749         (WebCore::FontCascadeFonts::determinePitch): Use the fontForFirstRange() convenience
750         function.
751         (WebCore::glyphPageFromFontRanges): font() may now return nullptr. Update this function to
752         handle that.
753         * platform/graphics/FontRanges.cpp:
754         (WebCore::FontRanges::Range::font): Trigger the lazy initialization.
755         (WebCore::TrivialFontAccessor::create): Used in the case where there is only one font in
756         the Ranges object and it has a full unicode-range.
757         (WebCore::TrivialFontAccessor::TrivialFontAccessor):
758         (WebCore::FontRanges::FontRanges): Use TrivialFontAccessor.
759         (WebCore::FontRanges::glyphDataForCharacter): font() may now return nullptr. Update this
760         function to handle that. This is where the magic happens: this is where we trigger
761         downloads only if the character falls within the unicode-range.
762         (WebCore::FontRanges::fontForFirstRange): Add ASSERT.
763         (WebCore::FontRanges::isLoading): Update to use the new FontAccessor.
764         * platform/graphics/FontRanges.h: Ditto.
765         (WebCore::FontRanges::Range::Range):
766         (WebCore::FontRanges::Range::fontAccessor):
767         (WebCore::FontRanges::appendRange):
768         (WebCore::FontRanges::Range::font): Deleted.
769         * platform/graphics/FontSelector.h: The virtual base class of FontAccessor. This is
770         necessary because it must be shared between platform code and non-platform code.
771         (WebCore::FontAccessor::~FontAccessor):
772
773 2016-05-09  Brady Eidson  <beidson@apple.com>
774
775         Modern IDB: Prevent the same transaction from being commited/aborted twice.
776         https://bugs.webkit.org/show_bug.cgi?id=157494
777
778         Reviewed by Tim Horton.
779
780         When a page navigates or a worker terminates, in rare cases with specific unfortunate timing, the IDBServer
781         might receive a request to commit/abort a transaction that is already in the process of committing/aborting.
782         
783         By moving transactions that are finishing into their own map we can at least detect this situation and
784         return an error. This seems like an improvement over some mysterious ASSERTs/timeouts.
785
786         No new tests:
787         While apparent that this is at least partially to blame for some existing timeouts/ASSERTs, I could not nail 
788         down a reliable way to reproduce this with a dedicated test.
789         
790         * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
791         (WebCore::IDBServer::UniqueIDBDatabase::~UniqueIDBDatabase):
792         (WebCore::IDBServer::UniqueIDBDatabase::performCurrentDeleteOperation):
793         (WebCore::IDBServer::UniqueIDBDatabase::didDeleteBackingStore):
794         (WebCore::IDBServer::UniqueIDBDatabase::prepareToFinishTransaction):
795         (WebCore::IDBServer::UniqueIDBDatabase::commitTransaction):
796         (WebCore::IDBServer::UniqueIDBDatabase::didPerformCommitTransaction):
797         (WebCore::IDBServer::UniqueIDBDatabase::abortTransaction):
798         (WebCore::IDBServer::UniqueIDBDatabase::didPerformAbortTransaction):
799         (WebCore::IDBServer::UniqueIDBDatabase::hasUnfinishedTransactions):
800         (WebCore::IDBServer::UniqueIDBDatabase::operationAndTransactionTimerFired):
801         (WebCore::IDBServer::UniqueIDBDatabase::takeNextRunnableTransaction):
802         (WebCore::IDBServer::UniqueIDBDatabase::transactionCompleted): Renamed from inProgressTransactionCompleted.
803         (WebCore::IDBServer::UniqueIDBDatabase::inProgressTransactionCompleted): Deleted.
804         * Modules/indexeddb/server/UniqueIDBDatabase.h:
805
806 2016-05-09  Tim Horton  <timothy_horton@apple.com>
807
808         Draw border and correct icon for placeholder attachments
809         https://bugs.webkit.org/show_bug.cgi?id=157495
810         rdar://problem/19982510
811
812         Reviewed by Anders Carlsson.
813
814         * Resources/AttachmentPlaceholder.png: Added.
815         * Resources/AttachmentPlaceholder@2x.png: Added.
816         * WebCore.xcodeproj/project.pbxproj:
817         * rendering/RenderThemeMac.mm:
818         (WebCore::attachmentPlaceholderBorderColor):
819         (WebCore::paintAttachmentIconPlaceholder):
820         (WebCore::paintAttachmentProgress):
821         (WebCore::paintAttachmentPlaceholderBorder):
822         (WebCore::RenderThemeMac::paintAttachment):
823         If progress is set, but set to 0, draw a dashed border around the attachment
824         and use the placeholder "download" artwork.
825
826 2016-05-09  Ada Chan  <adachan@apple.com>
827
828         Introduce WebVideoFullscreenInterfaceMac::isPlayingVideoInEnhancedFullscreen() and use it in WebVideoFullscreenManagerProxy::isPlayingVideoInEnhancedFullscreen()
829         https://bugs.webkit.org/show_bug.cgi?id=157493
830
831         Reviewed by Dan Bernstein.
832
833         * platform/mac/WebVideoFullscreenInterfaceMac.h:
834         * platform/mac/WebVideoFullscreenInterfaceMac.mm:
835         (WebCore::WebVideoFullscreenInterfaceMac::isPlayingVideoInEnhancedFullscreen):
836
837 2016-05-09  Simon Fraser  <simon.fraser@apple.com>
838
839         Clean up iOS text autosizing code
840         https://bugs.webkit.org/show_bug.cgi?id=157489
841
842         Reviewed by Zalan Bujtas.
843
844         Change the TraverseNextInclusionFunction and HeightTypeTraverseNextInclusionFunction
845         to take references.
846         
847         Use downcast<> more.
848         
849         Whitespace cleanup.
850
851         * rendering/RenderBlockFlow.cpp:
852         (WebCore::isNonBlocksOrNonFixedHeightListItems):
853         * rendering/RenderElement.cpp:
854         (WebCore::includeNonFixedHeight):
855         * rendering/RenderObject.cpp:
856         (WebCore::RenderObject::traverseNext):
857         * rendering/RenderObject.h:
858         * rendering/TextAutoSizing.cpp:
859         (WebCore::TextAutoSizingValue::adjustNodeSizes):
860         (WebCore::TextAutoSizingValue::reset):
861
862 2016-05-09  Anders Carlsson  <andersca@apple.com>
863
864         Add injected bundle SPI for getting favicon and touch icon URLs
865         https://bugs.webkit.org/show_bug.cgi?id=157435
866
867         Reviewed by Darin Adler.
868
869         * CMakeLists.txt:
870         Add new files.
871
872         * WebCore.xcodeproj/project.pbxproj:
873         Add new files.
874
875         * html/HTMLLinkElement.cpp:
876         (WebCore::HTMLLinkElement::iconType):
877         * html/HTMLLinkElement.h:
878         Rename LinkRelAttribute::IconType to LinkIconType.
879
880         * html/LinkIconCollector.cpp: Added.
881         (WebCore::iconSize):
882         New helper function that returns the icon size for an icon.
883
884         (WebCore::compareIcons):
885         Icon comparison function, to be used by for sorting.
886
887         (LinkIconCollector::iconsOfTypes):
888         Gather the right icons, sort them (descending by size) and return them.
889
890         * html/LinkIconCollector.h:
891         Added.
892
893         * html/LinkIconType.h:
894         Move icon type declarations here and arrange them so we can use them in an OptionSet.
895
896         * html/LinkRelAttribute.cpp:
897         (WebCore::LinkRelAttribute::LinkRelAttribute):
898         * html/LinkRelAttribute.h:
899         * loader/icon/IconController.cpp:
900         (WebCore::iconFromLinkElements):
901         Rename IconType to LinkIconType.
902
903 2016-05-06  Simon Fraser  <simon.fraser@apple.com>
904
905         [iOS WK2] Font size increases on some pages after navigating then going back
906         https://bugs.webkit.org/show_bug.cgi?id=157441
907         rdar://problem/22873240
908
909         Reviewed by Darin Adler.
910
911         Sometimes I want to dump ViewportConfigurations from WebKit2 so export dump().
912
913         Test: fast/text-autosizing/ios/text-autosizing-after-back.html
914
915         * page/ViewportConfiguration.h:
916
917 2016-05-09  Eric Carlson  <eric.carlson@apple.com>
918
919         "Main content" restrictions should not apply to media documents
920         https://bugs.webkit.org/show_bug.cgi?id=157479
921         <rdar://problem/25840861>
922
923         Reviewed by Jer Noble.
924
925         No new tests, this change only applies to media documents in a top level document so it
926         isn't possible to have a layout test.
927
928         * html/HTMLMediaElement.cpp:
929         (WebCore::HTMLMediaElement::HTMLMediaElement): Don't apply restrictions to a media document.
930
931 2016-05-09  Dean Jackson  <dino@apple.com>
932
933         Update Picture-in-picture artwork
934         https://bugs.webkit.org/show_bug.cgi?id=157484
935         <rdar://problem/26177784>
936
937         Reviewed by Eric Carlson.
938
939         We have new artwork for the picture-in-picture presentation mode. I
940         also converted it to use SVG (and moved the button style to a
941         more consistent part of the file).
942
943         * Modules/mediacontrols/mediaControlsApple.css:
944         (video::-webkit-media-controls-panel .picture-in-picture-button):
945         (video::-webkit-media-controls-panel .picture-in-picture-button.return-from-picture-in-picture):
946         (video::-webkit-media-controls-panel .picture-in-picture-button:active):
947         (video::-webkit-media-controls-panel .picture-in-picture-button.return-from-picture-in-picture:active):
948
949 2016-05-09  Chris Dumez  <cdumez@apple.com>
950
951         Optimize [StrictTypeChecking] on IDL operations
952         https://bugs.webkit.org/show_bug.cgi?id=157467
953
954         Reviewed by Darin Adler.
955
956         Optimize [StrictTypeChecking] on IDL operations so that:
957         - Only generate extra code for nullable parameters because for non-nullable
958           parameters, JSXXX::toWrapped() will return null in case of a bad input
959           type. We will then throw a TypeError when null-checking it already.
960         - After the JSValue::isNullOrUndefined() check, avoid calling
961           JSXXX::toWrapped() and set nativeValue to nullptr directly.
962         - Drop the check for JSValue::inherits(JSXXX::info()) and just do a null
963           check on the value returned by JSXXX::toWrapped(). toWrapped() already
964           does a JSValue::inherits(JSXXX::info() check. Since we only call
965           toWrapped() if the JSValue is not null/undefined, a null return value
966           always indicates a bad input type.
967
968         Also update the TypeError message to be more useful when passing null
969         for non-nullable parameters or assigning null to a non-nullable
970         attribute. The message is now consistent with the one used for strict
971         type checking.
972
973         No new tests, rebaselined existing tests.
974
975         * bindings/js/JSDOMBinding.h:
976         * bindings/scripts/CodeGeneratorJS.pm:
977         (GenerateImplementation):
978         (GenerateParametersCheck):
979         * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
980         (WebCore::jsTestActiveDOMObjectPrototypeFunctionExcitingFunction):
981         * bindings/scripts/test/JS/JSTestInterface.cpp:
982         (WebCore::setJSTestInterfaceImplementsNode):
983         (WebCore::setJSTestInterfaceSupplementalNode):
984         (WebCore::jsTestInterfacePrototypeFunctionImplementsMethod2):
985         (WebCore::jsTestInterfacePrototypeFunctionSupplementalMethod2):
986         * bindings/scripts/test/JS/JSTestObj.cpp:
987         (WebCore::setJSTestObjTestObjAttr):
988         (WebCore::setJSTestObjLenientTestObjAttr):
989         (WebCore::setJSTestObjXMLObjAttr):
990         (WebCore::setJSTestObjTypedArrayAttr):
991         (WebCore::setJSTestObjWithScriptExecutionContextAttribute):
992         (WebCore::setJSTestObjWithScriptStateAttributeRaises):
993         (WebCore::setJSTestObjWithScriptExecutionContextAttributeRaises):
994         (WebCore::setJSTestObjWithScriptExecutionContextAndScriptStateAttribute):
995         (WebCore::setJSTestObjWithScriptExecutionContextAndScriptStateAttributeRaises):
996         (WebCore::setJSTestObjWithScriptExecutionContextAndScriptStateWithSpacesAttribute):
997         (WebCore::setJSTestObjWithScriptArgumentsAndCallStackAttribute):
998         (WebCore::jsTestObjPrototypeFunctionVoidMethodWithArgs):
999         (WebCore::jsTestObjPrototypeFunctionByteMethodWithArgs):
1000         (WebCore::jsTestObjPrototypeFunctionOctetMethodWithArgs):
1001         (WebCore::jsTestObjPrototypeFunctionLongMethodWithArgs):
1002         (WebCore::jsTestObjPrototypeFunctionObjMethodWithArgs):
1003         (WebCore::jsTestObjPrototypeFunctionMethodWithXPathNSResolverParameter):
1004         (WebCore::jsTestObjPrototypeFunctionMethodThatRequiresAllArgsAndThrows):
1005         (WebCore::jsTestObjPrototypeFunctionOverloadedMethod8):
1006         (WebCore::jsTestObjPrototypeFunctionDomStringListFunction):
1007         (WebCore::jsTestObjPrototypeFunctionConvert1):
1008         (WebCore::jsTestObjPrototypeFunctionStrictFunctionWithSequence):
1009         (WebCore::jsTestObjPrototypeFunctionStrictFunctionWithArray):
1010         (WebCore::jsTestObjPrototypeFunctionVariadicNodeMethod):
1011         (WebCore::jsTestObjPrototypeFunctionTestPromiseOverloadedFunction2Promise):
1012         * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
1013         (WebCore::constructJSTestOverloadedConstructors1):
1014         (WebCore::constructJSTestOverloadedConstructors2):
1015         (WebCore::constructJSTestOverloadedConstructors3):
1016         * bindings/scripts/test/TestObj.idl:
1017
1018 2016-05-09  Tim Horton  <timothy_horton@apple.com>
1019
1020         Download progress on attachment elements sometimes exceeds element bounds
1021         https://bugs.webkit.org/show_bug.cgi?id=157440
1022         <rdar://problem/25245440>
1023
1024         Reviewed by Darin Adler.
1025
1026         In the case of very large dynamic type sizes, we can overflow the
1027         bounds of the attachment. It turns out that we used to limit to one
1028         line in many cases anyway, so only wrap if we have only a title and/or icon.
1029         This looks better when you have many of the other elements even in
1030         non-large-type modes.
1031
1032         * rendering/RenderThemeIOS.mm:
1033         (WebCore::AttachmentInfo::buildTitleLines):
1034         (WebCore::AttachmentInfo::AttachmentInfo):
1035         Limit the title to a single line if we have anything
1036         other than a title and icon.
1037
1038         (WebCore::attachmentBorderPath):
1039         (WebCore::paintAttachmentBorder):
1040         (WebCore::RenderThemeIOS::paintAttachment):
1041         Clip to the border, so that even if somehow we paint outside of
1042         the bounds, we don't paint over other parts of the page.
1043
1044 2016-05-09  Ryosuke Niwa  <rniwa@webkit.org>
1045
1046         REGRESSION (198056): Unable to use edit buttons on WordPress
1047         https://bugs.webkit.org/show_bug.cgi?id=157475
1048
1049         Reviewed by Antti Koivisto.
1050
1051         Renamed Event.prototype.deepPath() to composedPath() per discussions on
1052         https://github.com/whatwg/dom/issues/242 as the old name was not Web compatible.
1053
1054         Test: fast/shadow-dom/Extensions-to-Event-Interface.html
1055
1056         * dom/Event.cpp:
1057         (WebCore::Event::composedPath): Renamed from deepPath.
1058         * dom/Event.h:
1059         * dom/Event.idl:
1060
1061 2016-05-09  Alex Christensen  <achristensen@webkit.org>
1062
1063         Don't use DiskCache for media resource loads
1064         https://bugs.webkit.org/show_bug.cgi?id=157405
1065
1066         Reviewed by Darin Adler.
1067
1068         http/tests/security/video-cross-origin-caching.html was loading from the disk cache.
1069         This patch adds an assertion that fires in that test without this fix.
1070
1071         * loader/MediaResourceLoader.cpp:
1072         (WebCore::MediaResourceLoader::requestResource):
1073         * platform/graphics/PlatformMediaResourceLoader.h:
1074         * platform/network/ResourceRequestBase.h:
1075         (WebCore::ResourceRequestBase::hiddenFromInspector):
1076         (WebCore::ResourceRequestBase::setHiddenFromInspector):
1077         (WebCore::ResourceRequestBase::requester):
1078         (WebCore::ResourceRequestBase::setRequester):
1079         * platform/network/cocoa/WebCoreNSURLSession.mm:
1080         (-[WebCoreNSURLSessionDataTask _restart]):
1081         (-[WebCoreNSURLSessionDataTask resource:receivedResponse:]):
1082
1083 2016-05-09  Ryosuke Niwa  <rniwa@webkit.org>
1084
1085         Refactor FocusController::findFocusableElementRecursively
1086         https://bugs.webkit.org/show_bug.cgi?id=157415
1087
1088         Reviewed by Darin Adler.
1089
1090         Refactor FocusController::findFocusableElementRecursively and related functions. Extracted two functions:
1091         nextFocusableElementWithinScope and previousFocusableElementWithinScope out of it since they didn't really share
1092         any code other than calling findFocusableElement at the beginning.
1093
1094         Also renamed internal variant of nextFocusableElement and previousFocusableElement to nextFocusableElementOrScopeOwner
1095         and previousFocusableElementOrScopeOwner. It was confusing to have these internal functions in addition to public
1096         member functions that are used in Objective-C DOM API.
1097
1098         No new tests are added since there should be no behavioral change.
1099
1100         * page/FocusController.cpp:
1101         (WebCore::FocusController::findFocusableElementDescendingDownIntoFrameDocument): Added a FIXME.
1102         (WebCore::FocusController::advanceFocusInDocumentOrder): Use findFocusableElementAcrossFocusScope instead of manually
1103         calling findFocusableElementRecursively and findFocusableElementDescendingDownIntoFrameDocument separately.
1104         (WebCore::FocusController::findFocusableElementAcrossFocusScope): Now that findFocusableElementWithinScope calls
1105         findFocusableElementDescendingDownIntoFrameDocument internally, there is no need to keep around "found" local variable.
1106         Introduce a few early exists for a better clarity.
1107         (WebCore::FocusController::findFocusableElementWithinScope): Renamed from findFocusableElementRecursively. Also call
1108         findFocusableElementDescendingDownIntoFrameDocument here instead of findFocusableElementAcrossFocusScope.
1109         (WebCore::FocusController::nextFocusableElementWithinScope): Extracted from findFocusableElementRecursively.
1110         (WebCore::FocusController::previousFocusableElementWithinScope): Ditto.
1111         (WebCore::FocusController::findFocusableElement):
1112         (WebCore::FocusController::nextFocusableElement): Added a FIXME.
1113         (WebCore::FocusController::previousFocusableElement): Ditto.
1114         (WebCore::FocusController::findFocusableElementOrScopeOwner): Renamed from findFocusableElement for clarity.
1115         (WebCore::FocusController::nextFocusableElementOrScopeOwner): Ditto from nextFocusableElement.
1116         (WebCore::FocusController::previousFocusableElementOrScopeOwner): Ditto from nextFocusableElement.
1117         * page/FocusController.h:
1118
1119 2016-05-09  Manuel Rego Casasnovas  <rego@igalia.com>
1120
1121         [css-grid] Fix static position for positioned grid items
1122         https://bugs.webkit.org/show_bug.cgi?id=157417
1123
1124         Reviewed by Darin Adler.
1125
1126         The spec was updated to define properly the static position
1127         for positioned grid items, but we didn't update the implementation yet:
1128         https://drafts.csswg.org/css-grid-1/issues-wd-20150108#issue-1
1129
1130         We were only setting the static position when the start line
1131         was not auto. Otherwise we were using the default one
1132         which includes the padding.
1133         With the spec change we need to set it always,
1134         even if the start line is auto.
1135
1136         * rendering/RenderGrid.cpp:
1137         (WebCore::RenderGrid::layoutPositionedObject):
1138         (WebCore::RenderGrid::offsetAndBreadthForPositionedChild):
1139
1140 2016-05-08  Frederic Wang  <fwang@igalia.com>
1141
1142         RenderMathMLOperator: refactor management of stretchy data and italic correction
1143         https://bugs.webkit.org/show_bug.cgi?id=156913
1144
1145         Reviewed by Darin Adler.
1146
1147         No new tests, behavior is not changed.
1148
1149         The stretchy data uses a shared space to describe horizontal / vertical directions and
1150         unstretched / size variant / glyph assembly. We use a simple struct with some unions to
1151         represent it instead of the current implementation with a class.
1152         We also modify the signature of some functions to retrieve display operator and stretchy
1153         data to use that new structure and prepare the move to a separate MathOperator class.
1154         Finally, we introduce some helper functions to easily set the stretchy data.
1155
1156         * rendering/mathml/RenderMathMLOperator.cpp:
1157         (WebCore::RenderMathMLOperator::computePreferredLogicalWidths): Use the new data members and
1158         function signatures.
1159         (WebCore::RenderMathMLOperator::setSizeVariant): New helper function to set a size variant.
1160         (WebCore::RenderMathMLOperator::setGlyphAssembly): New helper function to set a glyph
1161         assembly.
1162         (WebCore::RenderMathMLOperator::getGlyphAssemblyFallBack): We change the signature to use a
1163         GlyphAssemblyData.
1164         (WebCore::RenderMathMLOperator::findDisplayStyleLargeOperator): We rename the function and
1165         change its signature to remove the return value. We now also set the italic correction when
1166         a display operator is found.
1167         (WebCore::RenderMathMLOperator::findStretchyData): We change the signature to introduce a
1168         target size and remove the return value. This also does the early return when the base glyph
1169         is large enough.
1170         (WebCore::RenderMathMLOperator::updateStyle): We use the new data members and function
1171         signatures. The check for the base glyph size is now done in findStretchyData, so we just
1172         check whether m_stretchType is Unstretched to do an early return.
1173         (WebCore::RenderMathMLOperator::firstLineBaseline): We use m_stretchType.
1174         (WebCore::RenderMathMLOperator::computeLogicalHeight): Ditto.
1175         (WebCore::RenderMathMLOperator::fillWithVerticalExtensionGlyph): Use the new class members.
1176         (WebCore::RenderMathMLOperator::fillWithHorizontalExtensionGlyph): Ditto.
1177         (WebCore::RenderMathMLOperator::paint): Ditto.
1178         (WebCore::RenderMathMLOperator::paintVerticalGlyphAssembly): Ditto.
1179         (WebCore::RenderMathMLOperator::paintHorizontalGlyphAssembly): Ditto.
1180         (WebCore::RenderMathMLOperator::paintChildren): Ditto.
1181         (WebCore::RenderMathMLOperator::trailingSpaceError): Ditto.
1182         (WebCore::RenderMathMLOperator::italicCorrection): Moved to RenderMathMLOperator.h.
1183         (WebCore::RenderMathMLOperator::getDisplayStyleLargeOperator): Deleted.
1184         * rendering/mathml/RenderMathMLOperator.h:
1185         (WebCore::RenderMathMLOperator::italicCorrection): We just return m_italicCorrection.
1186         (WebCore::RenderMathMLOperator::GlyphAssemblyData::GlyphAssemblyData): New class to store an
1187         assembly of GlyphData.
1188         (WebCore::RenderMathMLOperator::StretchyData::mode): Deleted.
1189         (WebCore::RenderMathMLOperator::StretchyData::variant): Deleted.
1190         (WebCore::RenderMathMLOperator::StretchyData::top): Deleted.
1191         (WebCore::RenderMathMLOperator::StretchyData::extension): Deleted.
1192         (WebCore::RenderMathMLOperator::StretchyData::bottom): Deleted.
1193         (WebCore::RenderMathMLOperator::StretchyData::middle): Deleted.
1194         (WebCore::RenderMathMLOperator::StretchyData::left): Deleted.
1195         (WebCore::RenderMathMLOperator::StretchyData::right): Deleted.
1196         (WebCore::RenderMathMLOperator::StretchyData::setNormalMode): Deleted.
1197         (WebCore::RenderMathMLOperator::StretchyData::setSizeVariantMode): Deleted.
1198         (WebCore::RenderMathMLOperator::StretchyData::setGlyphAssemblyMode): Deleted.
1199         (WebCore::RenderMathMLOperator::StretchyData::StretchyData): Deleted.
1200
1201 2016-05-08  Zalan Bujtas  <zalan@apple.com>
1202
1203         iOS selection: Use inflow containing block for positioned <br>.
1204         https://bugs.webkit.org/show_bug.cgi?id=157115
1205         <rdar://problem/25969295>
1206
1207         Reviewed by Ryosuke Niwa.
1208
1209         Similarly to RenderText, we should just use the inflow containing block for
1210         selected <br> even when it is positioned out of flow. This visually matches Mac OS X
1211         behaviour (selection painting does not get extended to the positioned <br>).
1212
1213         Test: fast/text/fixed-positioned-br-crash.html
1214
1215         * rendering/RenderLineBreak.cpp:
1216         (WebCore::RenderLineBreak::collectSelectionRects):
1217
1218 2016-05-08  Myles C. Maxfield  <mmaxfield@apple.com>
1219
1220         [iOS] Build fix after r200563
1221
1222         Unreviewed.
1223
1224         * editing/cocoa/HTMLConverter.mm:
1225         (_font):
1226
1227 2016-05-08  Myles C. Maxfield  <mmaxfield@apple.com>
1228
1229         [OS X] Migrate our Font classes entirely off of NSFont
1230         https://bugs.webkit.org/show_bug.cgi?id=157464
1231
1232         Reviewed by Darin Adler.
1233
1234         Because NSFont and CTFont are toll-free-bridged, we don't need NSFont at all anywhere.
1235
1236         No new tests because there is no behavior change.
1237
1238         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
1239         (accessibilitySearchCriteriaForSearchPredicateParameterizedAttribute):
1240         (textMarkerRangeFromRange):
1241         (visiblePositionForStartOfTextMarkerRange):
1242         (visiblePositionForEndOfTextMarkerRange):
1243         (AXAttributedStringRangeIsValid):
1244         (AXAttributeStringSetFont):
1245         (CreateCGColorIfDifferent):
1246         (AXAttributeStringSetStyle):
1247         (textMarkerRangeFromVisiblePositions):
1248         * bindings/objc/DOM.mm:
1249         (-[DOMElement _font]):
1250         * bindings/objc/DOMPrivate.h:
1251         * editing/cocoa/HTMLConverter.mm:
1252         (_font):
1253         (WebCore::editingAttributedStringFromRange):
1254         * editing/mac/EditorMac.mm:
1255         (WebCore::Editor::fontAttributesForSelectionStart):
1256         * platform/graphics/Font.h:
1257         (WebCore::Font::getCTFont):
1258         (WebCore::Font::getNSFont): Deleted.
1259         * platform/graphics/FontPlatformData.h:
1260         (WebCore::FontPlatformData::nsFont): Deleted.
1261         * platform/graphics/cocoa/FontCocoa.mm:
1262         (WebCore::Font::determinePitch):
1263         (WebCore::advanceForColorBitmapFont):
1264         (WebCore::Font::platformWidthForGlyph):
1265         (WebCore::renderingStyle): Deleted.
1266         * platform/graphics/cocoa/FontPlatformDataCocoa.mm:
1267
1268 2016-05-08  Chris Dumez  <cdumez@apple.com>
1269
1270         [Bindings] Simplify [RequiresExistingAtomicString] IDL extended attribute handling
1271         https://bugs.webkit.org/show_bug.cgi?id=157465
1272
1273         Reviewed by Darin Adler.
1274
1275         Simplify [RequiresExistingAtomicString] IDL extended attribute handling
1276         in the bindings generator.
1277
1278         * bindings/scripts/CodeGeneratorJS.pm:
1279         (GenerateParametersCheck):
1280         Drop code specific to [RequiresExistingAtomicString].
1281
1282         (JSValueToNative):
1283         Deal with [RequiresExistingAtomicString] IDL extended attribute,
1284         similarly to [AtomicString] and [TreatNullAs].
1285
1286         * bindings/scripts/test/JS/JSTestObj.cpp:
1287         * bindings/scripts/test/TestObj.idl:
1288         Add bindings test coverage.
1289
1290         * dom/DocumentFragment.cpp:
1291         (WebCore::DocumentFragment::getElementById):
1292         * svg/SVGSVGElement.cpp:
1293         (WebCore::SVGSVGElement::getElementById):
1294         Add null check for the id parameter. The generated bindings used to do
1295         this null check for us but it is no longer the case (to make the bindings
1296         generator a bit simpler). This extended attribute is not commonly used
1297         and is meant as a micro-optimization for getElementById().
1298
1299 2016-05-08  David Kilzer  <ddkilzer@apple.com>
1300
1301         Roll out: ThreadSanitizer: Data race and thread leak in WebCore::ScrollingThread::createThreadIfNeeded
1302         <https://webkit.org/b/157462>
1303
1304         This reverts commit r200554.
1305
1306         This doesn't fix the data race, and the thread leak is a
1307         separate issue.
1308
1309         * page/scrolling/ScrollingThread.cpp:
1310         (WebCore::ScrollingThread::createThreadIfNeeded): Roll out the
1311         change.
1312
1313 2016-05-08  Darin Adler  <darin@apple.com>
1314
1315         Follow-up to that last patch (missed review comments).
1316
1317         * page/EventSource.cpp:
1318         (WebCore::EventSource::parseEventStream): Pre-increment, not post-increment.
1319         (WebCore::EventSource::dispatchMessageEvent): More elegant form without explicit StringView.
1320
1321 2016-05-08  Darin Adler  <darin@apple.com>
1322
1323         Change EventSource constructor to take an IDL dictionary instead of a WebCore::Dictionary
1324         https://bugs.webkit.org/show_bug.cgi?id=157459
1325
1326         Reviewed by Chris Dumez.
1327
1328         Patch also includes some updating of EventSource class to modern idioms.
1329
1330         * page/EventSource.cpp:
1331         (WebCore::EventSource::EventSource): Initialize based on Init.
1332         (WebCore::EventSource::create): Take/pass Init instead of Dictionary.
1333
1334         * bindings/js/SerializedScriptValue.cpp:
1335         (WebCore::CloneSerializer::serialize): Take a StringView instead of a string
1336         so callers don't have to allocate a String just to use this.
1337         (WebCore::SerializedScriptValue::create): Ditto.
1338         * bindings/js/SerializedScriptValue.h: Ditto.
1339
1340         * page/EventSource.cpp: Changed defaultReconnectDelay to be a uint64_t
1341         instead of an unsigned long long.
1342         (WebCore::EventSource::EventSource): Changed constructor to take a struct
1343         instead of a Dictionary for eventSourceInit. Also moved initialization of
1344         data members to the header and used ASCIILiteral.
1345         (WebCore::EventSource::create): Changed type to Init and streamlined code
1346         a little bit using auto.
1347         (WebCore::EventSource::connect): Used a reference instead of a pointer.
1348         Also added a FIXME since I noticed that m_requestInFlight is probably not
1349         needed, since it's basically the same thing as "is m_loader null".
1350         (WebCore::EventSource::url): Moved to the header and made it inline.
1351         (WebCore::EventSource::networkRequestEnded): Removed unneeded check that
1352         is already done by all callers and turned it into an assertion.
1353         (WebCore::EventSource::withCredentials): Ditto.
1354         (WebCore::EventSource::readyState): Ditto.
1355         (WebCore::EventSource::responseIsValid): Added. Helper function to make
1356         the logic in didReceiveResponse easier to read. Fixed logic to compare
1357         MIME type ignoring ASCII case, since that's how MIME types work.
1358         (WebCore::EventSource::didReceiveResponse): Use the helper above, and also
1359         move the m_eventStreamOrigin set up code into the valid response case,
1360         since there is no point doing it if the response is not valid. Also use
1361         the early return idiom.
1362         (WebCore::EventSource::didReceiveData): Removed the unneeded explicit
1363         conversion to StringView here. Also removed a FIXME that I fixed.
1364         (WebCore::EventSource::didFinishLoading): Added code to flush the decoder
1365         as mentioned in didReceiveData. Added FIXME about peculiar clearing code
1366         that exists only here. Removed check for empty receive buffer and data
1367         that is not needed since parseEventStream does sufficient checking.
1368         (WebCore::EventSource::didFail): Added FIXME because of things that
1369         didFinishLoading does that seem equally valuable here.
1370         (WebCore::EventSource::parseEventStream): Tweaked types and names of local
1371         variables, and changed to use Optional instead of magic number -1. Also
1372         added a FIXME about how the buffer type is probably not right since we
1373         keep moving the characters in the buffer as we consume the start of it.
1374         (WebCore::EventSource::parseEventStreamLine): Refactor and reorganize so
1375         this doesn't do so much string allocation and is easier to read
1376         (WebCore::EventSource::canSuspendForDocumentSuspension): Tweaked comment.
1377         (WebCore::EventSource::dispatchMessageEvent): Renamed this from
1378         createMessageEvent, and moved more code in here. We now don't have to
1379         allocate a temporary string just to pass it to SerializedScriptValue.
1380
1381         * page/EventSource.h: Updated for changes above. Use pragma once.
1382         Define and use EventSource::Init struct. Other small cleanup.
1383
1384         * page/EventSource.idl: Define EventSourceInit dictionary and use it.
1385         Other small cleanup.
1386
1387 2016-05-07  Darin Adler  <darin@apple.com>
1388
1389         Change HTMLSlotElement::assignedNodes to take a IDL dictionary instead of a WebCore::Dictionary
1390         https://bugs.webkit.org/show_bug.cgi?id=157457
1391
1392         Reviewed by Chris Dumez.
1393
1394         * html/HTMLSlotElement.cpp:
1395         (WebCore::HTMLSlotElement::removedFrom): Fixed typo in comment.
1396         (WebCore::HTMLSlotElement::assignedNodes): Renamed assignedNodesForBindings back to this
1397         and changed the argument type to Optional<AssignedNodesOptions> instead of Dictionary.
1398         Also streamlined the logic a bit.
1399         (WebCore::HTMLSlotElement::enqueueSlotChangeEvent): Changed to use a pointer to the
1400         enqueued event instead of a boolean. With only a boolean, we could end up clearing the
1401         flag in cases where we don't really want to.
1402         (WebCore::HTMLSlotElement::dispatchEvent): Ditto.
1403         (WebCore::HTMLSlotElement::assignedNodesForBindings): Deleted.
1404         * html/HTMLSlotElement.h: Use pragma once. Added AssignedNodeOptions. Changed for the
1405         above, including changing the data member.
1406         * html/HTMLSlotElement.idl: Removed use of ImplementedAs. Fixed the type of the options
1407         dictionary.
1408
1409 2016-05-08  Chris Dumez  <cdumez@apple.com>
1410
1411         [Bindings] Add convert<>() template specializations for integer types
1412         https://bugs.webkit.org/show_bug.cgi?id=157458
1413
1414         Reviewed by Darin Adler.
1415
1416         Add convert<>() template specializations for integer types and use them
1417         in the JS bindings. Also, treat non-32bit types the same way as the
1418         32bit ones, allowing the compiler to optimize out branching based on
1419         the IntegerConversionConfiguration.
1420
1421         * bindings/js/JSCryptoAlgorithmDictionary.cpp:
1422
1423         * bindings/js/JSDOMBinding.cpp:
1424         (WebCore::enforceRange):
1425         (WebCore::toSmallerInt):
1426         (WebCore::toSmallerUInt):
1427         (WebCore::toInt8EnforceRange):
1428         (WebCore::toUInt8EnforceRange):
1429         (WebCore::toInt8Clamp):
1430         (WebCore::toUInt8Clamp):
1431         (WebCore::toInt8):
1432         (WebCore::toUInt8):
1433         (WebCore::toInt16EnforceRange):
1434         (WebCore::toUInt16EnforceRange):
1435         (WebCore::toInt16Clamp):
1436         (WebCore::toUInt16Clamp):
1437         (WebCore::toInt16):
1438         (WebCore::toUInt16):
1439         (WebCore::toInt32EnforceRange):
1440         (WebCore::toInt32Clamp):
1441         (WebCore::toUInt32Clamp):
1442         (WebCore::toUInt32EnforceRange):
1443         (WebCore::toInt64EnforceRange):
1444         (WebCore::toUInt64EnforceRange):
1445         (WebCore::toInt64Clamp):
1446         (WebCore::toUInt64Clamp):
1447         (WebCore::toInt64):
1448         (WebCore::toUInt64):
1449         * bindings/js/JSDOMBinding.h:
1450         - Splt some integer conversion functions into 3 Normal / Clamp /
1451           Enforce versions, similarly to what was done for 32bit types already.
1452           This is so that these can be called from the inline functions in
1453           JSDOMConvert.h, allowing the compiler to optimize out the branches.
1454         - Get rid of some unnecessary state.hadException() checks.
1455
1456         * bindings/js/JSDOMConvert.h:
1457         Add convert<> specializations for integer types.
1458
1459         * bindings/js/JSNodeFilterCustom.cpp:
1460         (WebCore::JSNodeFilter::acceptNode):
1461
1462         * bindings/scripts/CodeGenerator.pm:
1463         - Add utility function to distinguish integer types.
1464         - Have IsNumericType() using the integerType / floatingPointType
1465           hashes to avoid duplication.
1466         - Stop int / unsigned int from integer types as those are not
1467           in Web IDL and they are not used.
1468
1469         * bindings/scripts/CodeGeneratorJS.pm:
1470         (GetIntegerConversionType):
1471         (JSValueToNative):
1472         Use convert<>() for converting JSValue to integer types.
1473
1474         * bindings/scripts/IDLParser.pm:
1475         Stop allowing int / unsigned int types as those are not in Web IDL.
1476
1477         * bindings/scripts/test/JS/JSTestEventTarget.cpp:
1478         * bindings/scripts/test/JS/JSTestGlobalObject.cpp:
1479         * bindings/scripts/test/JS/JSTestObj.cpp:
1480         * bindings/scripts/test/JS/JSTestTypedefs.cpp:
1481         Rebaseline bindings tests.
1482
1483 2016-05-08  Darin Adler  <darin@apple.com>
1484
1485         Correct dictionary bindings handling of optional, null, and undefined
1486         https://bugs.webkit.org/show_bug.cgi?id=157463
1487
1488         Reviewed by Chris Dumez.
1489
1490         * bindings/js/JSDOMBinding.cpp:
1491         (WebCore::propertyValue): Deleted.
1492         * bindings/js/JSDOMBinding.h: Deleted propertyValue, not all that helpful for now.
1493
1494         * bindings/scripts/CodeGeneratorJS.pm:
1495         (GenerateDictionaryImplementationContent): Added a new early exit for convert to
1496         a dictionary type when the value is undefined or null and all members are either
1497         optional or have a default value. This returns the default values for everything
1498         without raising an exception. Added checking that requires that the dictionary
1499         argument is an object and not a regular expression, since that's also called for
1500         in the latest draft of the Web IDL specification. This ends up speeding up the
1501         code a bit since we now use JSObject::get for properties instead of JSValue::get.
1502         (GenerateParametersCheck): Renamed some local variables. Taught the code that
1503         optional dictionaries all have a default value; before it was doing that for the
1504         type "Dictionary" but not the real dictionary types (IsDictionaryType).
1505
1506         * bindings/scripts/test/JS/JSTestObj.cpp: Regenerated.
1507
1508         * css/FontFace.cpp:
1509         (WebCore::FontFace::create): Changed argument to be Descriptors instead of
1510         Optional<Descriptors>. It would have compiled the other way, but there is now
1511         no caller that will pass a null. Because the IDL dictionary support was new,
1512         this was the only place that was doing it wrong. Good that we "nipped it in the bud"
1513         before doing this in more places.
1514         * css/FontFace.h: Ditto.
1515
1516 2016-05-08  David Kilzer  <ddkilzer@apple.com>
1517
1518         ThreadSanitizer: Data race and thread leak in WebCore::ScrollingThread::createThreadIfNeeded
1519         <https://webkit.org/b/157462>
1520
1521         Reviewed by Darin Adler.
1522
1523         Reproduced with multiple existing tests.
1524
1525         * page/scrolling/ScrollingThread.cpp:
1526         (WebCore::ScrollingThread::createThreadIfNeeded): Use a
1527         std::once_flag to initialize Scrolling Thread since this may be
1528         called from background threads.
1529
1530 2016-05-08  Darin Adler  <darin@apple.com>
1531
1532         Try to fix build without rolling out that last change.
1533
1534         * bindings/js/JSDOMConvert.h:
1535         (WebCore::convert<Vector<String>>): Make this an inline. Just call toNativeArray.
1536
1537 2016-05-07  Darin Adler  <darin@apple.com>
1538
1539         Change MutationObserver::observe to take an IDL dictionary, rather than WebCore::Dictionary
1540         https://bugs.webkit.org/show_bug.cgi?id=157456
1541
1542         Reviewed by Chris Dumez.
1543
1544         * bindings/js/JSDOMConvert.h:
1545         (WebCore::convertOptional): Use a specific Optional null rather than Nullopt so we
1546         can compile the ternary operator.
1547         (WebCore::convert<bool>): Added.
1548         (WebCore::convert<Vector<String>>): Added. Later we probably need to change convert to use
1549         a member function of a class template rather than a function template so we can make partial
1550         specialization work and do this just once for all Vector<T>.
1551
1552         * bindings/js/JSMutationObserverCustom.cpp:
1553         (WebCore::JSMutationObserverOwner::isReachableFromOpaqueRoots): Streamlined code and removed
1554         some local variables. Changed to call the new observedNodes rather than getObservedNodes.
1555
1556         * bindings/scripts/CodeGeneratorJS.pm:
1557         (GenerateDictionaryImplementationContent): Fixed bug where we tried to call the version of
1558         the convert function with a default value even when there was none.
1559
1560         * bindings/scripts/test/TestObj.idl: Added a test case basically identical to what's needed
1561         in MutationObserver.idl.
1562         * bindings/scripts/test/JS/JSTestObj.cpp: Regenerated.
1563
1564         * dom/MutationObserver.cpp:
1565         (WebCore::MutationObserver::observe): Chagned function to take a MutationObserver::Init
1566         instead of a Dictionary.
1567         (WebCore::MutationObserver::observationStarted): Changed argument type to a reference.
1568         (WebCore::MutationObserver::observationEnded): Ditto.
1569         (WebCore::MutationObserverMicrotask): Removed unneeded explicit constructor and destructor.
1570         (WebCore::queueMutationObserverCompoundMicrotask): Got rid of unnneeded local variable.
1571         (WebCore::MutationObserver::observedNodes): Renamed to remove the "get" prefix.
1572
1573         * dom/MutationObserver.h: Reduced includes. Added MutationObserver::Init struct and
1574         used it for the type of the argument to the observe function. Changed a few argument
1575         types and removed unused forward declarations.
1576
1577         * dom/MutationObserver.idl: Added MutationObserverInit and used it instead of Dictionary.
1578
1579         * dom/MutationObserverRegistration.cpp:
1580         (WebCore::MutationObserverRegistration::MutationObserverRegistration): Pass a reference.
1581         (WebCore::MutationObserverRegistration::~MutationObserverRegistration): Ditto.
1582
1583 2016-05-07  Chris Dumez  <cdumez@apple.com>
1584
1585         Reduce special handling of XPathNSResolver type in the bindings
1586         https://bugs.webkit.org/show_bug.cgi?id=157454
1587
1588         Reviewed by Darin Adler.
1589
1590         Reduce special handling of XPathNSResolver type in the bindings.
1591
1592         * CMakeLists.txt:
1593         * WebCore.xcodeproj/project.pbxproj:
1594         * bindings/js/JSBindingsAllInOne.cpp:
1595         Add new JSXPathNSResolverCustom.cpp file.
1596
1597         * bindings/js/JSDOMStringListCustom.cpp:
1598         (WebCore::JSDOMStringList::toWrapped):
1599         Take the ExecState by reference instead of pointer.
1600
1601         * bindings/js/JSDOMWindowCustom.cpp:
1602         (WebCore::JSDOMWindow::toWrapped):
1603         Update to take an ExecState& parameter. The bindings now pass
1604         an ExecState to all custom toWrapped() methods for consistency
1605         and flexibility.
1606
1607         * bindings/js/JSDictionary.cpp:
1608         (WebCore::JSDictionary::convertValue):
1609         Pass an ExecState now that those toWrapped() methods expect
1610         it.
1611
1612         * bindings/js/JSEventTargetCustom.cpp:
1613         (WebCore::JSEventTarget::toWrapped):
1614         Update to take an ExecState& parameter.
1615
1616         * bindings/js/JSIDBDatabaseCustom.cpp:
1617         (WebCore::JSIDBDatabase::transaction):
1618         Pass ExecState by reference instead of pointer.
1619
1620         * bindings/js/JSMessageEventCustom.cpp:
1621         (WebCore::handleInitMessageEvent):
1622         Pass ExecState to JSDOMWindow::toWrapped().
1623
1624         * bindings/js/JSXPathNSResolverCustom.cpp: Added.
1625         (WebCore::JSXPathNSResolver::toWrapped):
1626         Provide a custom implementation of JSXPathNSResolver::toWrapped()
1627         instead of having the custom code in the bindings generator.
1628
1629         * bindings/scripts/CodeGeneratorJS.pm:
1630         (AddIncludesForType):
1631         Drop special includes for XPathNSResolver as they are no longer needed.
1632
1633         (GenerateHeader):
1634         Drop special casing of certain types for generating the toWrapped()
1635         declaration by:
1636         1. Relying on GetNativeType() for the return value as certain types
1637            return a RefPtr instead of a raw pointer.
1638         2. Adding an extra ExecState parameter when a custom implementation of
1639            toWrapped() is provided, given that some of them need it.
1640
1641         (GenerateParametersCheck):
1642         Drop custom code for XPathNSResolver and use the normal code path for
1643         this type now. The custom code now resides in the custom implementation
1644         of JSXPathNSResolver::toWrapped(), in custom bindings.
1645
1646         (JSValueToNative):
1647         - Drop NodeFilter from the nativeType hash map as it was updated to
1648           be a callback interface a while back.
1649         - Add XPathNSResolver to nativeType hash map so that we now to use
1650           a RefPtr<> instead of a raw pointer in the bindings. We should
1651           probably add an IDL extended attribute for this at some point.
1652         - Drop special casing for DOMStringList which was outdated since there
1653           is no toDOMStringList() function. DOMStringList has a custom
1654           toWrapped() function instead nowadays so we now call this one
1655           instead. We apparently do not have any DOMStringList parameters
1656           outside our bindings tests at the moment, which is why no one
1657           noticed.
1658         - Pass an ExecState to toWrapped() if the interface has the
1659           JSCustomToNativeObject IDL extended attribute.
1660
1661         * bindings/scripts/test/GObject/WebKitDOMTestObj.cpp:
1662         * bindings/scripts/test/GObject/WebKitDOMTestObj.h:
1663         * bindings/scripts/test/JS/JSTestObj.cpp:
1664         * bindings/scripts/test/ObjC/DOMTestObj.h:
1665         * bindings/scripts/test/ObjC/DOMTestObj.mm:
1666         * bindings/scripts/test/TestObj.idl:
1667         Add bindings test coverage for having an operation with an
1668         XPathNSResolver parameter.
1669
1670         * dom/Document.idl:
1671         * xml/XPathEvaluator.idl:
1672         Drop some unnecessary default parameter values.
1673
1674         * xml/XPathNSResolver.idl:
1675         Add JSCustomToNativeObject IDL extended attribute so that we can
1676         provide our own custom implementation of JSXPathNSResolver::toWrapped(),
1677         instead of having the custom code in the bindings generator.
1678
1679         * dom/Document.cpp:
1680         (WebCore::Document::createExpression):
1681         (WebCore::Document::evaluate):
1682         * dom/Document.h:
1683         * inspector/InspectorNodeFinder.cpp:
1684         * xml/XPathEvaluator.cpp:
1685         (WebCore::XPathEvaluator::createExpression):
1686         (WebCore::XPathEvaluator::evaluate):
1687         * xml/XPathEvaluator.h:
1688         * xml/XPathExpression.cpp:
1689         (WebCore::XPathExpression::createExpression):
1690         * xml/XPathExpression.h:
1691         * xml/XPathParser.cpp:
1692         (WebCore::XPath::Parser::Parser):
1693         (WebCore::XPath::Parser::parseStatement):
1694         * xml/XPathParser.h:
1695         Take XPathNSResolver parameter as a Ref<XPathNSResolver>&& as this is
1696         what the generated bindings now provide us, given that this sometimes
1697         have to create a wrapper around a JSObject.
1698
1699 2016-05-07  Darin Adler  <darin@apple.com>
1700
1701         Fix crash introduced by the last patch.
1702
1703         Fix suggested by Chris Dumez.
1704
1705         * css/FontFace.cpp:
1706         (WebCore::FontFace::FontFace): Roll out incorrect change. Things were getting
1707         initialized in the wrong order in a change I had made to the FontFace constructor
1708         that takes a CSSFontSelector.
1709
1710 2016-05-07  Chris Dumez  <cdumez@apple.com>
1711
1712         Unreviewed, rebaseline bindings tests after r200547.
1713
1714         * bindings/scripts/test/JS/JSTestObj.cpp:
1715         (WebCore::convert<TestObj::FontFaceDescriptors>):
1716
1717 2016-05-07  Darin Adler  <darin@apple.com>
1718
1719         Next step on dictionary bindings, along with other bindings refinements
1720         https://bugs.webkit.org/show_bug.cgi?id=157451
1721
1722         Reviewed by Chris Dumez.
1723
1724         Converted one dictionary, the one passed to the constructor in FontFace.
1725
1726         * WebCore.xcodeproj/project.pbxproj: Updated for name change of JSDOMBuild.h to
1727         JSDOMConvert.h and also let Xcode update a file type.
1728
1729         * bindings/js/JSDOMBinding.cpp:
1730         (WebCore::propertyValue): Added.
1731         * bindings/js/JSDOMBinding.h: Use pragma once. Remove unnecessary forward declaration.
1732         Move all declarations to the top of the file, separating them from definitions. This
1733         is a small step toward better overview of what's in this file and paves the way for
1734         future simplifications and improvements we can make after we observe patterns.
1735         Also removed a couple unused functions.
1736
1737         * bindings/js/JSDOMConvert.h: Renamed from JSDOMBuild.h.
1738         Renamed function templates from build to convert. Added convertOptional.
1739
1740         * bindings/js/ReadableStreamController.cpp:
1741         (WebCore::callFunction): Use auto and remove some unneeded namespacing.
1742         (WebCore::ReadableStreamController::invoke): Ditto. Also remove use of helper function
1743         getPropertyFromObject, since this was the only call site and it was not very helpful.
1744         (WebCore::ReadableStreamController::isControlledReadableStreamLocked): Ditto.
1745         (WebCore::createReadableStream): Ditto.
1746         (WebCore::getReadableStreamReader): Ditto.
1747
1748         * bindings/scripts/CodeGeneratorJS.pm:
1749         (GenerateEnumerationImplementationContent): Updated for name change from build to
1750         convert and JSDOMBuild.h to JSDOMConvert.h.
1751         (GenerateDictionaryImplementationContent): Ditto. Also added code to handle optional
1752         and added explicit exception checking, using local variables. Not clear longer term
1753         if the local variable approach is OK since this will unnecessarily change types like
1754         const String& to String.
1755         (GenerateParametersCheck): Removed local variable $optional and use $parameter->isOptional
1756         directly consistently. This is slightly clearer because the old code used a mix of the
1757         two, and also is a better pattern for when we refactor this into smaller functions.
1758         Note that this function name is not good any more--this is a lot more then parameter checks.
1759         (GetNativeType): Return appropriate name for dictionary types.
1760         (JSValueToNative): Updated for name change from build to convert and JSDOMBuild.h to
1761         JSDOMConvert.h.
1762
1763         * bindings/scripts/test/JS/JSTestObj.cpp:
1764         * bindings/scripts/test/JS/JSTestTypedefs.cpp:
1765         Regenerated results.
1766
1767         * bindings/scripts/test/TestObj.idl: Added another dictionary test case, just a copy
1768         of the current state of the one in FontFace.idl.
1769
1770         * css/CSSFontFace.cpp:
1771         (WebCore::CSSFontFace::setUnicodeRange): Update for simplified UnicodeRange struct.
1772         (WebCore::CSSFontFace::setFeatureSettings): Fix to correctly handle being called
1773         with "normal". Also fix so it doesn't call fontPropertyChanged if nothing changed.
1774         Also got rid of return value, which had no real value: it was returning false for
1775         some bad inputs, but others would just lead to assertions, and the real reason this
1776         was OK is that this function is only passed known-valid values.
1777
1778         * css/CSSFontFace.h: Used prama once. Tweaked formatting. Removed return value from
1779         the setFeatureSettings function. Changed UnicodeRange to be struct with public data
1780         members instead a struct with a constructor and getter functions.
1781
1782         * css/CSSFontSelector.cpp:
1783         (WebCore::CSSFontSelector::addFontFaceRule): Updated since setFeatureSettings no
1784         longer has a boolean return value.
1785
1786         * css/CSSSegmentedFontFace.cpp:
1787         (WebCore::appendFontWithInvalidUnicodeRangeIfLoading): Updated for simplified
1788         UnicodeRange struct.
1789
1790         * css/FontFace.cpp:
1791         (WebCore::valueFromDictionary): Deleted.
1792         (WebCore::FontFace::create): Updated to take the descriptors as a struct instead of
1793         a WebCore::Dictionary. Also made that argument optional as specified in the current
1794         specification draft.
1795         (WebCore::FontFace::setFeatureSettings): Updated since setFeatureSettings no longer
1796         has a boolean return value.
1797         (WebCore::FontFace::unicodeRange): Updated for simplified UnicodeRange struct.
1798
1799         * css/FontFace.h: Used pragma once. Removed unneeded includes and forward declarations.
1800         Derived privately from CSSFontFace::Client. Added a FontFace::Descriptors struct and
1801         used it as an argument to the create function as described above.
1802
1803         * css/FontFace.idl: Added FontFaceDescriptors and changed the argument to the
1804         constructor to be an optional FontFaceDescriptors instead of a Dictionary.
1805
1806 2016-05-07  Youenn Fablet  <youenn.fablet@crf.canon.fr>
1807
1808         Rework FontFace promise attribute handling
1809         https://bugs.webkit.org/show_bug.cgi?id=157310
1810
1811         Reviewed by Myles C. Maxfield.
1812
1813         Making promise attributes cached attributes, so that they are created only once.
1814         They are created in the custom binding code and passed to DOM class as needed.
1815
1816         Removed usage of ExecState& from DOM iterators.
1817
1818         No change should be visible from user scripts.
1819
1820         * Modules/fetch/FetchHeaders.cpp:
1821         (WebCore::FetchHeaders::Iterator::next): Removing ExecState parameter.
1822         * Modules/fetch/FetchHeaders.h:
1823         * bindings/js/JSDOMIterator.h:
1824         (WebCore::keyValueIteratorForEach):
1825         (WebCore::JSDOMIterator<JSWrapper>::next): Ditto.
1826         * bindings/js/JSDOMPromise.cpp:
1827         (WebCore::DeferredWrapper::promise): Removed deferred() and added access to promise directly.
1828         * bindings/js/JSDOMPromise.h:
1829         * bindings/js/JSFontFaceCustom.cpp:
1830         (WebCore::JSFontFace::loaded): Using cached attribute to call FontFace::loaded only once.
1831         * bindings/js/JSFontFaceSetCustom.cpp:
1832         (WebCore::JSFontFaceSet::ready): Using cached attribute to call FontFaceSet::ready only once.
1833         * css/CSSFontFace.cpp:
1834         (WebCore::CSSFontFace::wrapper): Removing ExecState parameter.
1835         * css/CSSFontFace.h:
1836         * css/FontFace.cpp:
1837         (WebCore::FontFace::create): Ditto.
1838         (WebCore::FontFace::FontFace): Ditto.
1839         (WebCore::FontFace::fontStateChanged): Updating promise handling.
1840         (WebCore::FontFace::registerLoaded): Resolving/rejecting promise if backing CSSFontFace loading is ended.
1841         (WebCore::FontFace::load): Calling backing load.
1842         * css/FontFace.h:
1843         * css/FontFaceSet.cpp:
1844         (WebCore::FontFaceSet::Iterator::next): Removing ExecState parameter.
1845         (WebCore::FontFaceSet::load): Removing ExecState and ExceptionCode parameter.
1846         (WebCore::FontFaceSet::registerReady): Resolving promise if ready otherwise storing it for resolving it later.
1847         (WebCore::FontFaceSet::completedLoading): Resolving promise if any is stored.
1848         (WebCore::FontFaceSet::create): Deleted.
1849         * css/FontFaceSet.h:
1850         * css/FontFaceSet.idl:
1851
1852 2016-05-07  Jeremy Huddleston Sequoia  <jeremyhu@apple.com>
1853
1854         Fix an incorrect usage of OS(DARWIN) with PLATFORM(COCOA)
1855         https://bugs.webkit.org/show_bug.cgi?id=157167
1856
1857         Reviewed by Myles C. Maxfield.
1858
1859         * platform/graphics/FontPlatformData.h:
1860         (WebCore::FontPlatformData::hash):
1861
1862 2016-05-07  Joanmarie Diggs  <jdiggs@igalia.com>
1863
1864         REGRESSION(r196222): [AX][GTK] accessibility/gtk/caret-offsets.html failing
1865         https://bugs.webkit.org/show_bug.cgi?id=153956
1866
1867         Reviewed by Chris Fleizach.
1868
1869         The reason the test began failing is that it was checking the new caret offset
1870         synchronously. For most of the test cases, this was not a problem. But when the
1871         caret was moved out of a focused link, the focus change (and associated repainting)
1872         delayed the caret-moved event long enough to cause the associated test case to fail.
1873         The test now uses shouldBecomeEqualToString() instead of shouldBeEqualToString().
1874
1875         The test also had a supposedly-correct expectation which was wrong: When moving the
1876         caret to a valid accessible offset, the caret-moved event should be for that offset.
1877         This was not the case for the list item test case because emitTextSelectionChange()
1878         was not adjusting the offset for the RenderListMarker, the text of which is exposed
1879         as part of the ATK_ROLE_LIST_ITEM object. This bug was also fixed and the test case
1880         updated accordingly.
1881
1882         No new tests are needed. The previously-failing test is now passing.
1883
1884         * editing/atk/FrameSelectionAtk.cpp:
1885         (WebCore::emitTextSelectionChange):
1886
1887 2016-05-06  Joseph Pecoraro  <pecoraro@apple.com>
1888
1889         Rename HitTestRequest DisallowShadowContent to DisallowUserAgentShadowContent
1890         https://bugs.webkit.org/show_bug.cgi?id=157447
1891
1892         Reviewed by Ryosuke Niwa.
1893
1894         HitTesting is intended to reach nodes inside shadow content. This property
1895         on the HitTestRequest is intended to avoid hit testing in UserAgent shadow
1896         content. Rename the enum value, and cascading methods for clarity.
1897
1898         * html/MediaElementSession.cpp:
1899         (WebCore::isMainContent):
1900         * page/EventHandler.cpp:
1901         (WebCore::EventHandler::eventMayStartDrag):
1902         (WebCore::EventHandler::updateSelectionForMouseDrag):
1903         (WebCore::EventHandler::hitTestResultAtPoint):
1904         (WebCore::EventHandler::handleMousePressEvent):
1905         (WebCore::EventHandler::handleMouseDoubleClickEvent):
1906         (WebCore::EventHandler::mouseMoved):
1907         (WebCore::EventHandler::handleMouseMoveEvent):
1908         (WebCore::EventHandler::handleMouseReleaseEvent):
1909         (WebCore::EventHandler::handleMouseForceEvent):
1910         (WebCore::EventHandler::updateDragAndDrop):
1911         (WebCore::EventHandler::isInsideScrollbar):
1912         (WebCore::EventHandler::sendContextMenuEvent):
1913         (WebCore::EventHandler::sendContextMenuEventForKey):
1914         (WebCore::EventHandler::hoverTimerFired):
1915         (WebCore::EventHandler::dragSourceEndedAt):
1916         (WebCore::EventHandler::handleDrag):
1917         (WebCore::EventHandler::dispatchSyntheticTouchEventIfEnabled):
1918         * page/EventHandler.h:
1919         * page/FocusController.cpp:
1920         (WebCore::updateFocusCandidateIfNeeded):
1921         * rendering/HitTestRequest.h:
1922         (WebCore::HitTestRequest::HitTestRequest):
1923         (WebCore::HitTestRequest::disallowsUserAgentShadowContent):
1924         (WebCore::HitTestRequest::disallowsShadowContent): Deleted.
1925         * rendering/HitTestResult.cpp:
1926         (WebCore::HitTestResult::setToNonUserAgentShadowAncestor):
1927         (WebCore::HitTestResult::addNodeToRectBasedTestResult):
1928         (WebCore::HitTestResult::setToNonShadowAncestor): Deleted.
1929         * rendering/HitTestResult.h:
1930         * rendering/RenderEmbeddedObject.cpp:
1931         (WebCore::RenderEmbeddedObject::isReplacementObscured):
1932         * rendering/RenderLayer.cpp:
1933         (WebCore::RenderLayer::calculateClipRects):
1934         * rendering/svg/RenderSVGResourceClipper.cpp:
1935         (WebCore::RenderSVGResourceClipper::hitTestClipContent):
1936         * testing/Internals.cpp:
1937         (WebCore::Internals::nodesFromRect):
1938
1939 2016-05-06  Joseph Pecoraro  <pecoraro@apple.com>
1940
1941         Web Inspector: Inspect Element and Element Selection searching should work with Shadow DOM Nodes
1942         https://bugs.webkit.org/show_bug.cgi?id=157446
1943         <rdar://problem/24688447>
1944
1945         Reviewed by Ryosuke Niwa.
1946
1947         * inspector/InspectorDOMAgent.cpp:
1948         (WebCore::InspectorDOMAgent::innerParentNode):
1949         The Inspector backend was informing the frontend that all ShadowRoots
1950         were floating and had no parent. Get the host element for ShadowRoots.
1951
1952         * rendering/HitTestResult.cpp:
1953         (WebCore::moveOutOfUserAgentShadowTree):
1954         (WebCore::HitTestResult::setToNonShadowAncestor):
1955         EventHandler::mouseMoved is calling setToNonShadowAncestor before
1956         notifying Page::chrome / Inspector about the moused over element.
1957         This should be the deepest non-user-agent-shadow node.
1958
1959 2016-05-06  Joseph Pecoraro  <pecoraro@apple.com>
1960
1961         Web Inspector: Misc CommandLineAPI cleanup
1962         https://bugs.webkit.org/show_bug.cgi?id=157450
1963
1964         Reviewed by Ryosuke Niwa.
1965
1966         * inspector/CommandLineAPIModuleSource.js:
1967         (bind):
1968
1969 2016-05-06  Simon Fraser  <simon.fraser@apple.com>
1970
1971         Enable IOS_TEXT_AUTOSIZING on Mac and make it testable
1972         https://bugs.webkit.org/show_bug.cgi?id=157432
1973         rdar://problem/16406720
1974
1975         Reviewed by Dean Jackson.
1976
1977         Enable IOS_TEXT_AUTOSIZING on Mac so it can be tested.
1978
1979         Make the setTextAutosizingEnabled() Setting work, and plumb it through WK1 and WK2
1980         preferences for WTR and DRT. Make textAutosizingWindowSizeOverride() work, for layout tests.
1981         These two settings are shared with TEXT_AUTOSIZING.
1982
1983         Add a TextAutosizing log channel, which is useful for generated -expected.html results.
1984
1985         Move adjustComputedFontSizesOnBlocks() and related code from RenderObject to RenderElement
1986         without changes.
1987
1988         An implication of this set of changes is that the way clients enable text autosizing
1989         has changed. Previously, they set the "MinimumZoomFontSize" preference to 0.
1990         Settings::defaultMinimumZoomFontSize() used to do this in order to enable text autosizing
1991         on iPhone only, not iPad.
1992
1993         Now the preferred technique is to leave minimumZoomFontSize alone, and to use textAutosizingEnabled()
1994         instead. Settings::defaultTextAutosizingEnabled() now does the check for iPhone.
1995
1996         UIWebView calls WebKitGetMinimumZoomFontSize() to setup the default minimum font zoom size,
1997         which will now always return 15, but had no other code that toggled this. So it's safe to just rely
1998         on Settings::defaultTextAutosizingEnabled() doing the right thing for iPhone/iPad.
1999
2000         Test: fast/text-autosizing/ios/autosize-width.html
2001
2002         * Configurations/FeatureDefines.xcconfig:
2003         * dom/Document.cpp:
2004         (WebCore::Document::addAutoSizingNode):
2005         * page/FrameView.cpp:
2006         (WebCore::FrameView::layout):
2007         * page/Settings.cpp:
2008         (WebCore::Settings::Settings): Deleted.
2009         (WebCore::Settings::setTextAutosizingEnabled): Deleted.
2010         (WebCore::Settings::setTextAutosizingWindowSizeOverride): Deleted.
2011         * page/Settings.h:
2012         (WebCore::Settings::textAutosizingEnabled): Deleted.
2013         (WebCore::Settings::textAutosizingWindowSizeOverride): Deleted.
2014         * page/Settings.in:
2015         * page/cocoa/SettingsCocoa.mm:
2016         (WebCore::Settings::defaultMinimumZoomFontSize):
2017         (WebCore::Settings::defaultTextAutosizingEnabled):
2018         * platform/Logging.h:
2019         * rendering/RenderBlockFlow.cpp:
2020         (WebCore::RenderBlockFlow::adjustComputedFontSizes):
2021         * rendering/RenderElement.cpp:
2022         (WebCore::includeNonFixedHeight):
2023         (WebCore::RenderElement::adjustComputedFontSizesOnBlocks):
2024         (WebCore::RenderElement::resetTextAutosizing):
2025         * rendering/RenderElement.h:
2026         * rendering/RenderObject.cpp:
2027         (WebCore::includeNonFixedHeight): Deleted.
2028         (WebCore::RenderObject::adjustComputedFontSizesOnBlocks): Deleted.
2029         (WebCore::RenderObject::resetTextAutosizing): Deleted.
2030         * rendering/RenderObject.h:
2031         * rendering/TextAutoSizing.cpp:
2032         (WebCore::TextAutoSizingValue::adjustNodeSizes):
2033         * testing/InternalSettings.cpp:
2034         (WebCore::InternalSettings::Backup::Backup):
2035         (WebCore::InternalSettings::Backup::restoreTo):
2036         (WebCore::InternalSettings::setTextAutosizingEnabled):
2037         (WebCore::InternalSettings::setTextAutosizingWindowSizeOverride):
2038         * testing/InternalSettings.h:
2039
2040 2016-05-06  Joseph Pecoraro  <pecoraro@apple.com>
2041
2042         Web Inspector: Console: Variables defined with let/const aren't accessible outside of console's scope
2043         https://bugs.webkit.org/show_bug.cgi?id=150752
2044         <rdar://problem/23343385>
2045
2046         Reviewed by Mark Lam.
2047
2048         Test: inspector/runtime/evaluate-CommandLineAPI.html
2049
2050         * inspector/CommandLineAPIModuleSource.js:
2051         (bind):
2052         (this.member.toString):
2053         (CommandLineAPI):
2054         (CommandLineAPIImpl.prototype):
2055         (slice): Deleted.
2056         (bound): Deleted.
2057         (bound.toString): Deleted.
2058         (inScopeVariables): Deleted.
2059         (customToStringMethod): Deleted.
2060         Simplify now that we don't need to do our own variable shadow checking.
2061
2062 2016-05-06  Tim Horton  <timothy_horton@apple.com>
2063
2064         <attachment> element should understand UTIs
2065         https://bugs.webkit.org/show_bug.cgi?id=157425
2066         <rdar://problem/25585401>
2067
2068         Reviewed by Anders Carlsson.
2069
2070         UTIs are often much more specific than MIME types, so we should allow
2071         clients of <attachment> to use them to get more accurate icons.
2072
2073         Test: fast/attachment/attachment-uti.html
2074
2075         * platform/graphics/Icon.h:
2076         * platform/graphics/mac/IconMac.mm:
2077         (WebCore::Icon::createIconForMIMEType): Deleted.
2078         Remove the now-unused createIconForMIMEType.
2079
2080         * platform/network/mac/UTIUtilities.h:
2081         * platform/network/mac/UTIUtilities.mm:
2082         (WebCore::isDeclaredUTI):
2083         Expose UTTypeIsDeclared as isDeclaredUTI.
2084
2085         * rendering/RenderThemeIOS.mm:
2086         (WebCore::iconForAttachment):
2087         * rendering/RenderThemeMac.mm:
2088         (WebCore::iconForAttachment):
2089         If the attachment's type is a UTI, request the icon for it directly.
2090         If it's a MIME type, convert to a UTI before requesting.
2091
2092 2016-05-06  Chris Dumez  <cdumez@apple.com>
2093
2094         Clean up converting from JSValue to float / double in the bindings generator
2095         https://bugs.webkit.org/show_bug.cgi?id=157407
2096
2097         Reviewed by Darin Adler.
2098
2099         Clean up converting from JSValue to float / double in the bindings generator:
2100         - Handle all aspects of converting to float / double inside JSValueToNative()
2101           instead of relying partly on the call sites.
2102         - Add a build<>() template function to JSDOMBuild.h that is now
2103           called from the bindings to convert to float / double and deal with
2104           non-finite values.
2105         - Provide a better message with the TypeError that is thrown for non-finite
2106           values.
2107
2108         No new tests, rebaselined existing tests.
2109
2110         * bindings/js/JSDOMBinding.cpp:
2111         (WebCore::throwSequenceTypeError):
2112         (WebCore::throwNonFiniteTypeError):
2113         * bindings/js/JSDOMBinding.h:
2114         * bindings/js/JSDOMBuild.h:
2115         (WebCore::build):
2116         * bindings/scripts/CodeGenerator.pm:
2117         (IsFloatingPointType):
2118         * bindings/scripts/CodeGeneratorJS.pm:
2119         (JSValueToNative):
2120         (GenerateImplementation): Deleted.
2121         (GenerateParametersCheck): Deleted.
2122         (GenerateReturnParameters): Deleted.
2123         * bindings/scripts/test/JS/JSTestObj.cpp:
2124         (WebCore::setJSTestObjStrictFloat):
2125         (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalDoubleIsNaN):
2126         (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalFloatIsNaN):
2127         (WebCore::jsTestObjPrototypeFunctionStrictFunction):
2128         (WebCore::jsTestObjPrototypeFunctionVariadicDoubleMethod):
2129         (WebCore::jsTestObjPrototypeFunctionAny):
2130         (WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionWithFloatArgumentPromise):
2131         (WebCore::jsTestObjPrototypeFunctionTestPromiseOverloadedFunction1Promise):
2132         * bindings/scripts/test/JS/JSTestTypedefs.cpp:
2133         (WebCore::jsTestTypedefsPrototypeFunctionSetShadow):
2134
2135 2016-05-06  Dean Jackson  <dino@apple.com>
2136
2137         Regions, Shapes and Tracks don't need runtime features
2138         https://bugs.webkit.org/show_bug.cgi?id=157426
2139         <rdar://problem/26146262>
2140
2141         Reviewed by Simon Fraser.
2142
2143         The following RuntimeEnabledFeatures can be removed since
2144         we have no need to disable them (they are stable and have
2145         shipped for a while):
2146         - CSS Regions
2147         - CSS Shapes
2148         - Media tracks
2149
2150         * bindings/generic/RuntimeEnabledFeatures.cpp:
2151         (WebCore::RuntimeEnabledFeatures::RuntimeEnabledFeatures): Deleted.
2152         * bindings/generic/RuntimeEnabledFeatures.h:
2153         (WebCore::RuntimeEnabledFeatures::setCSSShapesEnabled): Deleted.
2154         (WebCore::RuntimeEnabledFeatures::cssShapesEnabled): Deleted.
2155         (WebCore::RuntimeEnabledFeatures::setCSSRegionsEnabled): Deleted.
2156         (WebCore::RuntimeEnabledFeatures::cssRegionsEnabled): Deleted.
2157         (WebCore::RuntimeEnabledFeatures::setCSSCompositingEnabled): Deleted.
2158         (WebCore::RuntimeEnabledFeatures::cssCompositingEnabled): Deleted.
2159         (WebCore::RuntimeEnabledFeatures::webkitVideoTrackEnabled): Deleted.
2160         (WebCore::RuntimeEnabledFeatures::setWebkitVideoTrackEnabled): Deleted.
2161         * css/CSSParser.cpp:
2162         (WebCore::isSimpleLengthPropertyID):
2163         (WebCore::isValidKeywordPropertyAndValue):
2164         (WebCore::CSSParser::parseValue):
2165         (WebCore::CSSParser::parseFillProperty):
2166         (WebCore::CSSParser::createRegionRule):
2167         (WebCore::CSSParserContext::CSSParserContext): Deleted.
2168         (WebCore::operator==): Deleted.
2169         (WebCore::CSSParser::parseShapeProperty): Deleted.
2170         (WebCore::CSSParser::cssRegionsEnabled): Deleted.
2171         (WebCore::CSSParser::cssCompositingEnabled): Deleted.
2172         (WebCore::CSSParser::parseFlowThread): Deleted.
2173         (WebCore::CSSParser::parseRegionThread): Deleted.
2174         * css/CSSParser.h:
2175         * css/CSSParserMode.h:
2176         * dom/Document.cpp:
2177         (WebCore::Document::webkitGetNamedFlows):
2178         (WebCore::Document::cssRegionsEnabled): Deleted.
2179         (WebCore::Document::cssCompositingEnabled): Deleted.
2180         * dom/Document.h:
2181         * dom/Element.cpp:
2182         (WebCore::Element::unregisterNamedFlowContentElement):
2183         (WebCore::Element::webkitRegionOverset):
2184         (WebCore::Element::webkitGetRegionFlowRanges): Deleted.
2185         * html/HTMLMediaElement.cpp:
2186         (WebCore::HTMLMediaElement::scheduleDelayedAction):
2187         (WebCore::HTMLMediaElement::pendingActionTimerFired):
2188         (WebCore::HTMLMediaElement::prepareForLoad):
2189         (WebCore::HTMLMediaElement::loadInternal):
2190         (WebCore::HTMLMediaElement::setReadyState):
2191         (WebCore::HTMLMediaElement::playbackProgressTimerFired):
2192         (WebCore::HTMLMediaElement::mediaPlayerTimeChanged):
2193         (WebCore::HTMLMediaElement::userCancelledLoad):
2194         (WebCore::HTMLMediaElement::setVideoFullscreenLayer):
2195         (WebCore::HTMLMediaElement::hasClosedCaptions):
2196         (WebCore::HTMLMediaElement::setClosedCaptionsVisible):
2197         (WebCore::HTMLMediaElement::configureTextTrackDisplay):
2198         (WebCore::HTMLMediaElement::finishParsingChildren): Deleted.
2199         (WebCore::HTMLMediaElement::audioTrackEnabledChanged): Deleted.
2200         (WebCore::HTMLMediaElement::videoTrackSelectedChanged): Deleted.
2201         (WebCore::HTMLMediaElement::mediaPlayerDidAddAudioTrack): Deleted.
2202         (WebCore::HTMLMediaElement::mediaPlayerDidAddTextTrack): Deleted.
2203         (WebCore::HTMLMediaElement::mediaPlayerDidAddVideoTrack): Deleted.
2204         (WebCore::HTMLMediaElement::addAudioTrack): Deleted.
2205         (WebCore::HTMLMediaElement::addTextTrack): Deleted.
2206         (WebCore::HTMLMediaElement::addVideoTrack): Deleted.
2207         (WebCore::HTMLMediaElement::removeAudioTrack): Deleted.
2208         (WebCore::HTMLMediaElement::removeTextTrack): Deleted.
2209         (WebCore::HTMLMediaElement::removeVideoTrack): Deleted.
2210         (WebCore::HTMLMediaElement::audioTracks): Deleted.
2211         (WebCore::HTMLMediaElement::textTracks): Deleted.
2212         (WebCore::HTMLMediaElement::videoTracks): Deleted.
2213         (WebCore::HTMLMediaElement::didAddTextTrack): Deleted.
2214         (WebCore::HTMLMediaElement::didRemoveTextTrack): Deleted.
2215         * html/HTMLTrackElement.cpp:
2216         (WebCore::HTMLTrackElement::parseAttribute):
2217         (WebCore::HTMLTrackElement::scheduleLoad): Deleted.
2218         (WebCore::HTMLTrackElement::canLoadURL): Deleted.
2219         * rendering/RenderBlockFlow.cpp:
2220         (WebCore::RenderBlockFlow::createRenderNamedFlowFragmentIfNeeded):
2221         * testing/InternalSettings.cpp:
2222         (WebCore::InternalSettings::Backup::Backup):
2223         (WebCore::InternalSettings::Backup::restoreTo): Deleted.
2224         (WebCore::InternalSettings::setCSSShapesEnabled): Deleted.
2225         * testing/InternalSettings.h:
2226         * testing/InternalSettings.idl:
2227
2228 2016-05-06  Brady Eidson  <beidson@apple.com>
2229
2230         Modern IDB (Workers): Start running a lot of the workers tests.
2231         https://bugs.webkit.org/show_bug.cgi?id=157424
2232
2233         Reviewed by Sam Weinig.
2234
2235         No new tests (Covered by enabling a whole bunch of existing tests).
2236
2237         * Modules/indexeddb/IDBDatabase.cpp:
2238         (WebCore::IDBDatabase::stop): Call removeAllEventListeners() to clean up the Worker VM
2239           before it shuts down.
2240
2241         * Modules/indexeddb/IDBRequest.cpp:
2242         (WebCore::IDBRequest::stop): Call removeAllEventListeners()
2243
2244         * Modules/indexeddb/IDBTransaction.cpp:
2245         (WebCore::IDBTransaction::IDBTransaction): Initialize with the correct VM.
2246         (WebCore::IDBTransaction::stop): Call removeAllEventListeners()
2247         (WebCore::IDBTransaction::operationDidComplete):
2248
2249         * Modules/indexeddb/client/IDBConnectionProxy.cpp:
2250         (WebCore::IDBClient::IDBConnectionProxy::takeIDBOpenDBRequest):
2251         (WebCore::IDBClient::IDBConnectionProxy::completeOpenDBRequest): Don't take the request from
2252           the map, but rather let the request take itself from its appropriate thread.
2253         * Modules/indexeddb/client/IDBConnectionProxy.h:
2254
2255         * Modules/indexeddb/client/TransactionOperation.h:
2256         (WebCore::IDBClient::TransactionOperation::completed): Rework clearing out the completion 
2257           handler, as the handler itself might hold the last reference to `this`.
2258
2259         * page/SecurityOrigin.h:
2260         (WebCore::SecurityOrigin::hasUniversalAccess):
2261
2262         * workers/WorkerGlobalScope.cpp:
2263         (WebCore::WorkerGlobalScope::WorkerGlobalScope): If the parent context's SecurityOrigin had
2264           universal access, grant it to this one.
2265
2266 2016-05-06  Ryosuke Niwa  <rniwa@webkit.org>
2267
2268         FKA: No way to get focus from DOM to shadow DOM components (Was: HTML5 media controls not keyboard accessible)
2269         https://bugs.webkit.org/show_bug.cgi?id=117857
2270
2271         Reviewed by Jer Noble.
2272
2273         The bug was caused by hasCustomFocusLogic returning true on media elements.
2274
2275         Fix the bug by removing this function so that FocusController will walk into the shadow tree of media elements
2276         to look for focusable elements. This will allow AT such as Voice Over to iterate through controls.
2277
2278         We don't seem to draw focus rings inside the media elements but that could be tweaked in a separate patch.
2279
2280         Test: media/tab-focus-inside-media-elements.html
2281
2282         * html/HTMLMediaElement.cpp:
2283         (WebCore::HTMLMediaElement::hasCustomFocusLogic): Deleted.
2284         * html/HTMLMediaElement.h:
2285
2286 2016-05-06  Anders Carlsson  <andersca@apple.com>
2287
2288         Tidy up the LinkRelAttribute code
2289         https://bugs.webkit.org/show_bug.cgi?id=157429
2290
2291         Reviewed by Sam Weinig.
2292
2293         Get rid of IconURL.h and move the IconType enumeration inside LinkRelAttribute.
2294         Remove the InvalidIcon enum declaration and use WTF::Optional instead.
2295
2296         * WebCore.xcodeproj/project.pbxproj:
2297         * dom/IconURL.h: Removed.
2298         * html/HTMLLinkElement.cpp:
2299         (WebCore::HTMLLinkElement::iconType):
2300         (WebCore::HTMLLinkElement::addSubresourceAttributeURLs):
2301         * html/HTMLLinkElement.h:
2302         * html/LinkRelAttribute.cpp:
2303         (WebCore::LinkRelAttribute::LinkRelAttribute):
2304         * html/LinkRelAttribute.h:
2305         * html/parser/HTMLPreloadScanner.cpp:
2306         (WebCore::TokenPreloadScanner::StartTagScanner::relAttributeIsStyleSheet):
2307         * loader/FrameLoader.h:
2308         * loader/FrameLoaderClient.h:
2309         * loader/icon/IconController.cpp:
2310         (WebCore::iconFromLinkElements):
2311
2312 2016-05-06  Jer Noble  <jer.noble@apple.com>
2313
2314         Muted media elements should be allowed to autoplay, even if RequireUserGestureForAudioRateChange is set.
2315         https://bugs.webkit.org/show_bug.cgi?id=157404
2316         <rdar://problem/26016802>
2317
2318         Reviewed by Eric Carlson.
2319
2320         Test: media/audio-playback-restriction-play-muted.html
2321
2322         Add element.muted() as a critera of whether playback is permitted when
2323         RequireUserGestureForAudioRateChange is set. Also, make sure to re-evaluate whether the
2324         element should be playing when muted is changed without a user gesture.
2325
2326         * html/HTMLMediaElement.cpp:
2327         (WebCore::HTMLMediaElement::setMuted):
2328         * html/MediaElementSession.cpp:
2329         (WebCore::MediaElementSession::playbackPermitted):
2330
2331 2016-05-06  Brent Fulgham  <bfulgham@apple.com>
2332
2333         Don't use invalidated ResourceLoadStatistics iterators
2334         https://bugs.webkit.org/show_bug.cgi?id=157412
2335         <rdar://problem/26133153>
2336
2337         Reviewed by Chris Dumez.
2338
2339         ResourceLoadObserver::logFrameNavigation was using references bound to the 'value'
2340         member of iterators from the ResourceLoadStatistics HashMap. When new entries were
2341         added, these iterators were invalidated causing the references to refer to invalid
2342         memory.
2343
2344         Renamed 'resourceStatisticsForPrimaryDomain' to 'ensureResourceStatisticsForPrimaryDomain'
2345         to clarify that it may mutate the underlying HashMap, thereby invalidating any
2346         existing iterators.
2347
2348         * loader/ResourceLoadObserver.cpp:
2349         (WebCore::ResourceLoadObserver::logFrameNavigation): Protect against HashMap
2350         elements being copied/moved when new intries are added.
2351         * loader/ResourceLoadStatisticsStore.cpp:
2352         (WebCore::ResourceLoadStatisticsStore::setResourceStatisticsForPrimaryDomain): Added.
2353         * loader/ResourceLoadStatisticsStore.h:
2354
2355 2016-05-06  Manuel Rego Casasnovas  <rego@igalia.com>
2356
2357         [css-grid] Unprefix CSS Grid Layout properties
2358         https://bugs.webkit.org/show_bug.cgi?id=157137
2359
2360         Reviewed by Simon Fraser.
2361
2362         Remove "-webkit" prefix from all the grid layout properties,
2363         including the display value.
2364         Update the source code to remove the prefix where it was used too.
2365
2366         * css/CSSComputedStyleDeclaration.cpp:
2367         (WebCore::isLayoutDependent):
2368         (WebCore::ComputedStyleExtractor::propertyValue):
2369         * css/CSSParser.cpp:
2370         (WebCore::isSimpleLengthPropertyID):
2371         (WebCore::isValidKeywordPropertyAndValue):
2372         (WebCore::CSSParser::parseValue):
2373         (WebCore::CSSParser::parseGridGapShorthand):
2374         (WebCore::CSSParser::parseGridTemplateRowsAndAreasAndColumns):
2375         (WebCore::CSSParser::parseGridTemplateShorthand):
2376         (WebCore::CSSParser::parseGridShorthand):
2377         (WebCore::CSSParser::parseGridAreaShorthand):
2378         * css/CSSPrimitiveValueMappings.h:
2379         (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
2380         * css/CSSPropertyNames.in:
2381         * css/CSSValueKeywords.in:
2382         * css/StyleBuilderCustom.h:
2383         (WebCore::StyleBuilderCustom::applyInitialGridTemplateAreas):
2384         (WebCore::StyleBuilderCustom::applyInheritGridTemplateAreas):
2385         (WebCore::StyleBuilderCustom::applyValueGridTemplateAreas):
2386         (WebCore::StyleBuilderCustom::applyInitialGridTemplateColumns):
2387         (WebCore::StyleBuilderCustom::applyInheritGridTemplateColumns):
2388         (WebCore::StyleBuilderCustom::applyValueGridTemplateColumns):
2389         (WebCore::StyleBuilderCustom::applyInitialGridTemplateRows):
2390         (WebCore::StyleBuilderCustom::applyInheritGridTemplateRows):
2391         (WebCore::StyleBuilderCustom::applyValueGridTemplateRows):
2392         * css/StyleProperties.cpp:
2393         (WebCore::StyleProperties::getPropertyValue):
2394
2395 2016-05-06  Nan Wang  <n_wang@apple.com>
2396
2397         AX: <attachment> element should have a replacement character
2398         https://bugs.webkit.org/show_bug.cgi?id=157406
2399
2400         Reviewed by Chris Fleizach.
2401
2402         Make sure attachment element is considered as a replaced node.
2403
2404         Test: accessibility/mac/attachment-element-replacement-character.html
2405
2406         * editing/TextIterator.cpp:
2407         (WebCore::isRendererReplacedElement):
2408
2409 2016-05-06  Nan Wang  <n_wang@apple.com>
2410
2411         AX: String for document range is empty if end visible position anchors to a ignored replaced node
2412         https://bugs.webkit.org/show_bug.cgi?id=157403
2413
2414         Reviewed by Chris Fleizach.
2415
2416         The CharacterOffset that is converted from VisiblePositon is wrong when the VisiblePostion anchors
2417         to an ignored replaced node. Fixed it by adjusting the offset of the CharacterOffset correctly in 
2418         such case.
2419
2420         Test: accessibility/mac/text-marker-string-for-document-end-replaced-node.html
2421
2422         * accessibility/AXObjectCache.cpp:
2423         (WebCore::characterOffsetsInOrder):
2424         (WebCore::AXObjectCache::characterOffsetFromVisiblePosition):
2425         (WebCore::AXObjectCache::accessibilityObjectForTextMarkerData):
2426
2427 2016-05-05  David Kilzer  <ddkilzer@apple.com>
2428
2429         [iOS] WebCore does not need to link to CoreAudio, GraphicsServices, SystemConfiguration frameworks
2430         <https://webkit.org/b/157413>
2431         <rdar://problem/26104189>
2432
2433         Reviewed by Gavin Barraclough.
2434
2435         * Configurations/WebCore.xcconfig:
2436         (OTHER_LDFLAGS_BASE_ios): Remove "-framework GraphicsServices".
2437         (OTHER_LDFLAGS_PLATFORM[sdk=macosx*]): Add "-framework CoreAudio"
2438         and "-framework SystemConfiguration".
2439         * WebCore.xcodeproj/project.pbxproj: Remove CoreAudio.framework
2440         and SystemConfiguration.framework from the project file.
2441
2442 2016-05-05  Brady Eidson  <beidson@apple.com>
2443
2444         Modern IDB (Workers): Get everything to the right threads.
2445         https://bugs.webkit.org/show_bug.cgi?id=157398
2446
2447         Reviewed by Alex Christensen.
2448
2449         No new tests (No current change in behavior, will be tested as bug 149953 is resolved, enabling IDB in workers).
2450
2451         * dom/ScriptExecutionContext.h:
2452         (WebCore::ScriptExecutionContext::postCrossThreadTask): Add a helper to post a CrossThreadTask to a context.
2453                 
2454         * Modules/indexeddb/client/IDBConnectionProxy.cpp:
2455         (WebCore::IDBClient::performCallbackOnCorrectThread): Helper to perform an IDB callback on either the main thread
2456           or Worker thread as necessary.
2457         (WebCore::IDBClient::IDBConnectionProxy::openDatabase):
2458         (WebCore::IDBClient::IDBConnectionProxy::deleteDatabase):
2459         (WebCore::IDBClient::IDBConnectionProxy::completeOpenDBRequest):
2460         (WebCore::IDBClient::IDBConnectionProxy::createObjectStore):
2461         (WebCore::IDBClient::IDBConnectionProxy::deleteObjectStore):
2462         (WebCore::IDBClient::IDBConnectionProxy::clearObjectStore):
2463         (WebCore::IDBClient::IDBConnectionProxy::createIndex):
2464         (WebCore::IDBClient::IDBConnectionProxy::deleteIndex):
2465         (WebCore::IDBClient::IDBConnectionProxy::putOrAdd):
2466         (WebCore::IDBClient::IDBConnectionProxy::getRecord):
2467         (WebCore::IDBClient::IDBConnectionProxy::getCount):
2468         (WebCore::IDBClient::IDBConnectionProxy::deleteRecord):
2469         (WebCore::IDBClient::IDBConnectionProxy::openCursor):
2470         (WebCore::IDBClient::IDBConnectionProxy::iterateCursor):
2471         (WebCore::IDBClient::IDBConnectionProxy::completeOperation):
2472         (WebCore::IDBClient::IDBConnectionProxy::abortOpenAndUpgradeNeeded):
2473         (WebCore::IDBClient::IDBConnectionProxy::fireVersionChangeEvent):
2474         (WebCore::IDBClient::IDBConnectionProxy::didFireVersionChangeEvent):
2475         (WebCore::IDBClient::IDBConnectionProxy::notifyOpenDBRequestBlocked):
2476         (WebCore::IDBClient::IDBConnectionProxy::establishTransaction):
2477         (WebCore::IDBClient::IDBConnectionProxy::didStartTransaction):
2478         (WebCore::IDBClient::IDBConnectionProxy::commitTransaction):
2479         (WebCore::IDBClient::IDBConnectionProxy::didCommitTransaction):
2480         (WebCore::IDBClient::IDBConnectionProxy::abortTransaction):
2481         (WebCore::IDBClient::IDBConnectionProxy::didAbortTransaction):
2482         (WebCore::IDBClient::IDBConnectionProxy::didFinishHandlingVersionChangeTransaction):
2483         (WebCore::IDBClient::IDBConnectionProxy::databaseConnectionClosed):
2484         (WebCore::IDBClient::IDBConnectionProxy::scheduleMainThreadTasks):
2485         (WebCore::IDBClient::IDBConnectionProxy::handleMainThreadTasks):
2486         * Modules/indexeddb/client/IDBConnectionProxy.h:
2487         (WebCore::IDBClient::IDBConnectionProxy::callConnectionOnMainThread): Helper to marshall IDB operations from the
2488           Worker thread to the main thread.
2489         (WebCore::IDBClient::IDBConnectionProxy::postMainThreadTask):
2490
2491         * Modules/indexeddb/IDBTransaction.cpp:
2492         (WebCore::IDBTransaction::originThreadID):
2493         * Modules/indexeddb/IDBTransaction.h:
2494         
2495         * Modules/indexeddb/client/IDBConnectionToServer.cpp:
2496         (WebCore::IDBClient::IDBConnectionToServer::putOrAdd):
2497         * Modules/indexeddb/client/IDBConnectionToServer.h:
2498
2499         * Modules/indexeddb/client/IDBConnectionToServerDelegate.h:
2500
2501         * Modules/indexeddb/client/TransactionOperation.cpp:
2502         (WebCore::IDBClient::TransactionOperation::scriptExecutionContext):
2503         * Modules/indexeddb/client/TransactionOperation.h:
2504
2505         * Modules/indexeddb/shared/IDBResourceIdentifier.cpp:
2506         (WebCore::nextClientResourceNumber):
2507
2508         * Modules/indexeddb/shared/InProcessIDBServer.cpp:
2509         (WebCore::InProcessIDBServer::putOrAdd):
2510         * Modules/indexeddb/shared/InProcessIDBServer.h:
2511
2512 2016-05-05  Dean Jackson  <dino@apple.com>
2513
2514         4 and 8 digit color attributes should use the crazypants algorithm, not the CSS one.
2515         https://bugs.webkit.org/show_bug.cgi?id=157402
2516         <rdar://problem/26131142>
2517
2518         Reviewed by Simon Fraser.
2519
2520         Noel and Tab from Google alerted me to the fact I broke some legacy
2521         HTML color attributes when I added support for 4 and 8 digit hex colors
2522         in CSS. The fix is to favor the "crazy" parsing unless we know it is a 3 or 6
2523         digit hex value (in which case we try the CSS algorithm first).
2524
2525         Covered by reverting an existing test.
2526
2527         * html/HTMLElement.cpp:
2528         (WebCore::HTMLElement::addHTMLColorToStyle):
2529
2530 2016-05-05  Brady Eidson  <beidson@apple.com>
2531
2532         Modern IDB (Workers): Remove the need for IDBConnectionProxy to expose its IDBConnectionToServer.
2533         https://bugs.webkit.org/show_bug.cgi?id=157394
2534
2535         Reviewed by Alex Christensen.
2536
2537         No new tests (No current change in behavior, will be tested as bug 149953 makes progress).
2538
2539         * Modules/indexeddb/IDBDatabase.cpp:
2540         (WebCore::IDBDatabase::transaction):
2541         (WebCore::IDBDatabase::fireVersionChangeEvent):
2542         (WebCore::IDBDatabase::dispatchEvent):
2543         * Modules/indexeddb/IDBDatabase.h:
2544         (WebCore::IDBDatabase::serverConnection): Deleted.
2545
2546         * Modules/indexeddb/IDBOpenDBRequest.cpp:
2547         (WebCore::IDBOpenDBRequest::requestCompleted):
2548
2549         * Modules/indexeddb/IDBRequest.cpp:
2550         (WebCore::IDBRequest::IDBRequest):
2551
2552         * Modules/indexeddb/IDBTransaction.cpp:
2553         (WebCore::IDBTransaction::connectionProxy):
2554         (WebCore::IDBTransaction::serverConnection): Deleted.
2555         * Modules/indexeddb/IDBTransaction.h:
2556
2557         * Modules/indexeddb/client/IDBConnectionProxy.cpp:
2558         (WebCore::IDBClient::IDBConnectionProxy::abortOpenAndUpgradeNeeded):
2559         (WebCore::IDBClient::IDBConnectionProxy::connectionToServer): Deleted.
2560         * Modules/indexeddb/client/IDBConnectionProxy.h:
2561
2562         * Modules/indexeddb/client/IDBConnectionToServer.cpp:
2563         (WebCore::IDBClient::IDBConnectionToServer::abortOpenAndUpgradeNeeded):
2564
2565         * Modules/indexeddb/client/TransactionOperation.h:
2566         (WebCore::IDBClient::TransactionOperation::TransactionOperation):
2567
2568         * Modules/indexeddb/shared/IDBCursorInfo.cpp:
2569         (WebCore::IDBCursorInfo::IDBCursorInfo):
2570
2571         * Modules/indexeddb/shared/IDBRequestData.cpp:
2572         (WebCore::IDBRequestData::IDBRequestData):
2573
2574         * Modules/indexeddb/shared/IDBResourceIdentifier.cpp:
2575         (WebCore::IDBResourceIdentifier::IDBResourceIdentifier):
2576         * Modules/indexeddb/shared/IDBResourceIdentifier.h:
2577
2578         * Modules/indexeddb/shared/IDBTransactionInfo.cpp:
2579         (WebCore::IDBTransactionInfo::clientTransaction):
2580         * Modules/indexeddb/shared/IDBTransactionInfo.h:
2581
2582 2016-05-05  Commit Queue  <commit-queue@webkit.org>
2583
2584         Unreviewed, rolling out r200479.
2585         https://bugs.webkit.org/show_bug.cgi?id=157397
2586
2587         A LayoutTest added with this change is crashing on Mac WK1
2588         test runs. (Requested by ryanhaddad on #webkit).
2589
2590         Reverted changeset:
2591
2592         "For keyboard users, activating a fragment URL should transfer
2593         focus and caret to the destination"
2594         https://bugs.webkit.org/show_bug.cgi?id=116046
2595         http://trac.webkit.org/changeset/200479
2596
2597 2016-05-05  Chris Dumez  <cdumez@apple.com>
2598
2599         CORS check is sometimes incorrectly failing for media loads
2600         https://bugs.webkit.org/show_bug.cgi?id=157370
2601         <rdar://problem/26071607>
2602
2603         Reviewed by Alex Christensen.
2604
2605         When the media library is issuing a conditional request for a media
2606         element that had the 'crossorigin' attribute, we would fail the CORS
2607         check and log an error if the server were to respond with a "304 Not
2608         Modified" response because the 304 response usually does not have
2609         the necessary "Access-Control-Allow-Origin: *" header (At least for
2610         Apache) and we cannot use the cached headers either since WebKit
2611         does not have them.
2612
2613         To work around the problem in the short term, we now drop the
2614         conditional headers from the request that the media library is
2615         giving us when the media element has the 'crossorigin' attribute
2616         set. As a result, the server will never respond with a 304 and we
2617         will be able to do a CORS check on the full (e.g. 206) response.
2618
2619         In the long term, we need to deal with this better as this means
2620         we may sometimes fail to reuse cached data. For now, this is only
2621         potentially inefficient in the cases that were broken (i.e. no
2622         video would play and we would log an error in the console).
2623
2624         Test: http/tests/security/video-cross-origin-caching.html
2625
2626         * loader/MediaResourceLoader.cpp:
2627         (WebCore::MediaResourceLoader::requestResource):
2628         Make the request unconditional if the media element has the
2629         'crossorigin' attribute set.
2630
2631         * platform/network/ResourceRequestBase.cpp:
2632         (WebCore::ResourceRequestBase::isConditional):
2633         (WebCore::ResourceRequestBase::makeUnconditional):
2634         When fixing the bug above, I noticed that those method do not do
2635         the right thing if the m_httpHeaderFields data member has not
2636         been populated yet. m_httpHeaderFields is lazily initialized so
2637         we need to call updateResourceRequest() before using it.
2638
2639 2016-05-05  Zalan Bujtas  <zalan@apple.com>
2640
2641         Stop traversing at the container block when computing RTL inline static distance.
2642         https://bugs.webkit.org/show_bug.cgi?id=157349
2643         <rdar://problem/25994087>
2644
2645         Reviewed by David Hyatt.
2646
2647         When computing the inline static distance for a child renderer, we start at its enclosing box
2648         and traverse up all the way to the container block.
2649         However when the enclosing box is the ancestor of the container block, we
2650         should just bail out right away since there's no container to use to adjust the position.
2651
2652         Test: fast/multicol/positioned-rtl-column-crash.html
2653
2654         * rendering/RenderBox.cpp:
2655         (WebCore::computeInlineStaticDistance):
2656
2657 2016-05-05  Ada Chan  <adachan@apple.com>
2658
2659         Add WebKitAdditions extension points in media controls related code in RenderThemeMac
2660         https://bugs.webkit.org/show_bug.cgi?id=157390
2661
2662         Reviewed by Anders Carlsson.
2663
2664         * rendering/RenderThemeMac.mm:
2665         (WebCore::RenderThemeMac::mediaControlsStyleSheet):
2666         (WebCore::RenderThemeMac::mediaControlsScript):
2667
2668 2016-05-05  Jer Noble  <jer.noble@apple.com>
2669
2670         [WK2] Media controls don't update if controller is created after the interface is created
2671         https://bugs.webkit.org/show_bug.cgi?id=157376
2672
2673         Reviewed by Beth Dakin.
2674
2675         Add getter methods to WebPlaybackSessionModel so that the model's values can be retrieved
2676         if those values were missed before the equivalent WebPlaybackSessionInterface methods were
2677         called. This necessatates a bunch of changes in HTMLMediaElement and related classes to
2678         change PassRefPtr<TimeRanges> types to Ref<TimeRanges> (and one change in TimeRanges itself).
2679         WebPlaybackSessionModelMediaElement can implement these new getter methods by querying the
2680         values from the HTMLMediaElement, something it was doing already, so most of those changes
2681         are simple refactoring.
2682
2683         There's no reason any longer for WebVideoFullscreenModel to inherit from WebPlaybackSessionModel,
2684         so remove that superclass.
2685
2686         In WebPlaybackSessionInterfaceMac, when a new WebPlaybackControlsManager is set, use the new
2687         getter methods on WebPlaybackSessionModel to update the values in the manager.
2688
2689         * html/HTMLMediaElement.cpp:
2690         (WebCore::HTMLMediaElement::mediaPlayerCharacteristicChanged):
2691         (WebCore::HTMLMediaElement::maxBufferedTime):
2692         (WebCore::HTMLMediaElement::played):
2693         (WebCore::HTMLMediaElement::buffered): Deleted.
2694         (WebCore::HTMLMediaElement::seekable): Deleted.
2695         * html/HTMLMediaElement.h:
2696         * html/MediaController.cpp:
2697         (MediaController::buffered):
2698         (MediaController::seekable):
2699         (MediaController::played):
2700         * html/MediaController.h:
2701         * html/MediaControllerInterface.h:
2702         * html/TimeRanges.cpp:
2703         (WebCore::TimeRanges::copy):
2704         * html/TimeRanges.h:
2705         * platform/cocoa/WebPlaybackSessionModel.h:
2706         * platform/cocoa/WebPlaybackSessionModelMediaElement.h:
2707         * platform/cocoa/WebPlaybackSessionModelMediaElement.mm:
2708         (WebPlaybackSessionModelMediaElement::setWebPlaybackSessionInterface):
2709         (WebPlaybackSessionModelMediaElement::updateForEventName):
2710         (WebPlaybackSessionModelMediaElement::updateLegibleOptions):
2711         (WebPlaybackSessionModelMediaElement::observedEventNames):
2712         (WebPlaybackSessionModelMediaElement::eventNameAll):
2713         (WebPlaybackSessionModelMediaElement::duration):
2714         (WebPlaybackSessionModelMediaElement::currentTime):
2715         (WebPlaybackSessionModelMediaElement::bufferedTime):
2716         (WebPlaybackSessionModelMediaElement::isPlaying):
2717         (WebPlaybackSessionModelMediaElement::playbackRate):
2718         (WebPlaybackSessionModelMediaElement::seekableRanges):
2719         (WebPlaybackSessionModelMediaElement::canPlayFastReverse):
2720         (WebPlaybackSessionModelMediaElement::audioMediaSelectionOptions):
2721         (WebPlaybackSessionModelMediaElement::audioMediaSelectedIndex):
2722         (WebPlaybackSessionModelMediaElement::legibleMediaSelectionOptions):
2723         (WebPlaybackSessionModelMediaElement::legibleMediaSelectedIndex):
2724         (WebPlaybackSessionModelMediaElement::externalPlaybackEnabled):
2725         (WebPlaybackSessionModelMediaElement::wirelessVideoPlaybackDisabled):
2726         * platform/cocoa/WebVideoFullscreenModel.h:
2727         * platform/cocoa/WebVideoFullscreenModelVideoElement.h:
2728         * platform/cocoa/WebVideoFullscreenModelVideoElement.mm:
2729         (WebVideoFullscreenModelVideoElement::requestFullscreenMode): Deleted.
2730         (WebVideoFullscreenModelVideoElement::setVideoLayerFrame): Deleted.
2731         (WebVideoFullscreenModelVideoElement::setVideoLayerGravity): Deleted.
2732         (WebVideoFullscreenModelVideoElement::observedEventNames): Deleted.
2733         (WebVideoFullscreenModelVideoElement::eventNameAll): Deleted.
2734         (WebVideoFullscreenModelVideoElement::fullscreenModeChanged): Deleted.
2735         * platform/ios/WebPlaybackSessionInterfaceAVKit.h:
2736         * platform/ios/WebVideoFullscreenControllerAVKit.mm:
2737         (WebVideoFullscreenControllerContext::play): Deleted.
2738         (WebVideoFullscreenControllerContext::pause): Deleted.
2739         (WebVideoFullscreenControllerContext::togglePlayState): Deleted.
2740         (WebVideoFullscreenControllerContext::beginScrubbing): Deleted.
2741         (WebVideoFullscreenControllerContext::endScrubbing): Deleted.
2742         (WebVideoFullscreenControllerContext::seekToTime): Deleted.
2743         (WebVideoFullscreenControllerContext::fastSeek): Deleted.
2744         (WebVideoFullscreenControllerContext::beginScanningForward): Deleted.
2745         (WebVideoFullscreenControllerContext::beginScanningBackward): Deleted.
2746         (WebVideoFullscreenControllerContext::endScanning): Deleted.
2747         (WebVideoFullscreenControllerContext::selectAudioMediaOption): Deleted.
2748         (WebVideoFullscreenControllerContext::selectLegibleMediaOption): Deleted.
2749         * platform/ios/WebVideoFullscreenInterfaceAVKit.h:
2750         * platform/ios/WebVideoFullscreenInterfaceAVKit.mm:
2751         (WebVideoFullscreenInterfaceAVKit::requestHideAndExitFullscreen):
2752         (WebVideoFullscreenInterfaceAVKit::shouldExitFullscreenWithReason):
2753         * platform/mac/WebPlaybackSessionInterfaceMac.mm:
2754         (WebCore::timeRangesToArray):
2755         (WebCore::WebPlaybackSessionInterfaceMac::setSeekableRanges):
2756         (WebCore::WebPlaybackSessionInterfaceMac::setPlayBackControlsManager):
2757         * platform/mac/WebVideoFullscreenInterfaceMac.h:
2758
2759 2016-05-05  Brady Eidson  <beidson@apple.com>
2760
2761         Modern IDB (Workers): Move TransactionOperation management from IDBConnectionToServer to IDBConnectionProxy.
2762         https://bugs.webkit.org/show_bug.cgi?id=157392
2763
2764         Reviewed by Alex Christensen.
2765
2766         No new tests (No current change in behavior, will be tested as bug 149953 makes progress).
2767
2768         Set up TransactionOperations on the IDBConnectionProxy instead of the IDBConnectionToServer:
2769         * Modules/indexeddb/IDBTransaction.cpp:
2770         (WebCore::IDBTransaction::createObjectStoreOnServer):
2771         (WebCore::IDBTransaction::createIndexOnServer):
2772         (WebCore::IDBTransaction::openCursorOnServer):
2773         (WebCore::IDBTransaction::iterateCursorOnServer):
2774         (WebCore::IDBTransaction::getRecordOnServer):
2775         (WebCore::IDBTransaction::getCountOnServer):
2776         (WebCore::IDBTransaction::deleteRecordOnServer):
2777         (WebCore::IDBTransaction::clearObjectStoreOnServer):
2778         (WebCore::IDBTransaction::putOrAddOnServer):
2779         (WebCore::IDBTransaction::deleteObjectStoreOnServer):
2780         (WebCore::IDBTransaction::deleteIndexOnServer):
2781         
2782         IDBConnectionProxy is now the owner of dispatched TransactionOperations:
2783         * Modules/indexeddb/client/IDBConnectionProxy.cpp:
2784         (WebCore::IDBClient::IDBConnectionProxy::createObjectStore):
2785         (WebCore::IDBClient::IDBConnectionProxy::deleteObjectStore):
2786         (WebCore::IDBClient::IDBConnectionProxy::clearObjectStore):
2787         (WebCore::IDBClient::IDBConnectionProxy::createIndex):
2788         (WebCore::IDBClient::IDBConnectionProxy::deleteIndex):
2789         (WebCore::IDBClient::IDBConnectionProxy::putOrAdd):
2790         (WebCore::IDBClient::IDBConnectionProxy::getRecord):
2791         (WebCore::IDBClient::IDBConnectionProxy::getCount):
2792         (WebCore::IDBClient::IDBConnectionProxy::deleteRecord):
2793         (WebCore::IDBClient::IDBConnectionProxy::openCursor):
2794         (WebCore::IDBClient::IDBConnectionProxy::iterateCursor):
2795         (WebCore::IDBClient::IDBConnectionProxy::saveOperation):
2796         (WebCore::IDBClient::IDBConnectionProxy::completeOperation):
2797         * Modules/indexeddb/client/IDBConnectionProxy.h:
2798         
2799         Proxy this in-and-out calls to the ConnectionProxy:
2800         * Modules/indexeddb/client/IDBConnectionToServer.cpp:
2801         (WebCore::IDBClient::IDBConnectionToServer::createObjectStore):
2802         (WebCore::IDBClient::IDBConnectionToServer::didCreateObjectStore):
2803         (WebCore::IDBClient::IDBConnectionToServer::deleteObjectStore):
2804         (WebCore::IDBClient::IDBConnectionToServer::didDeleteObjectStore):
2805         (WebCore::IDBClient::IDBConnectionToServer::clearObjectStore):
2806         (WebCore::IDBClient::IDBConnectionToServer::didClearObjectStore):
2807         (WebCore::IDBClient::IDBConnectionToServer::createIndex):
2808         (WebCore::IDBClient::IDBConnectionToServer::didCreateIndex):
2809         (WebCore::IDBClient::IDBConnectionToServer::deleteIndex):
2810         (WebCore::IDBClient::IDBConnectionToServer::didDeleteIndex):
2811         (WebCore::IDBClient::IDBConnectionToServer::putOrAdd):
2812         (WebCore::IDBClient::IDBConnectionToServer::didPutOrAdd):
2813         (WebCore::IDBClient::IDBConnectionToServer::getRecord):
2814         (WebCore::IDBClient::IDBConnectionToServer::didGetRecord):
2815         (WebCore::IDBClient::IDBConnectionToServer::getCount):
2816         (WebCore::IDBClient::IDBConnectionToServer::didGetCount):
2817         (WebCore::IDBClient::IDBConnectionToServer::deleteRecord):
2818         (WebCore::IDBClient::IDBConnectionToServer::didDeleteRecord):
2819         (WebCore::IDBClient::IDBConnectionToServer::openCursor):
2820         (WebCore::IDBClient::IDBConnectionToServer::didOpenCursor):
2821         (WebCore::IDBClient::IDBConnectionToServer::iterateCursor):
2822         (WebCore::IDBClient::IDBConnectionToServer::didIterateCursor):
2823         (WebCore::IDBClient::IDBConnectionToServer::saveOperation): Deleted.
2824         (WebCore::IDBClient::IDBConnectionToServer::completeOperation): Deleted.
2825         * Modules/indexeddb/client/IDBConnectionToServer.h:
2826
2827         - Give TransactionOperation a ThreadIdentifier member
2828         - Privatize most public methods from TransactionOperation
2829         - Make IDBRequestData a friend so it can get at the private methods
2830         * Modules/indexeddb/client/TransactionOperation.h:
2831         (WebCore::IDBClient::TransactionOperation::~TransactionOperation):
2832         (WebCore::IDBClient::TransactionOperation::perform):
2833         (WebCore::IDBClient::TransactionOperation::completed):
2834         (WebCore::IDBClient::TransactionOperation::originThreadID):
2835         (WebCore::IDBClient::TransactionOperation::transactionIdentifier):
2836         (WebCore::IDBClient::TransactionOperation::objectStoreIdentifier):
2837         (WebCore::IDBClient::TransactionOperation::indexIdentifier):
2838         (WebCore::IDBClient::TransactionOperation::cursorIdentifier):
2839         (WebCore::IDBClient::TransactionOperation::transaction):
2840         (WebCore::IDBClient::TransactionOperation::indexRecordType):
2841
2842 2016-05-05  Zalan Bujtas  <zalan@apple.com>
2843
2844         Do not attempt to compute min/max width.
2845         https://bugs.webkit.org/show_bug.cgi?id=157320
2846
2847         Reviewed by David Hyatt.
2848
2849         Replaced elements with no intrinsic size (only with ratio) should not call the containing
2850         block to compute the min/max width when the containing block's min/max width
2851         depends on the children's intrinsic size. It could lead to infinite recursion.
2852
2853         Test: fast/replaced/before-content-intrinsic-crash.html
2854
2855         * rendering/RenderBox.cpp:
2856         (WebCore::RenderBox::computeReplacedLogicalWidthRespectingMinMaxWidth): Unrelated code change.
2857         * rendering/RenderImage.cpp: Unrelated code change.
2858         (WebCore::RenderImage::RenderImage): Deleted.
2859         * rendering/RenderImage.h:
2860         * rendering/RenderReplaced.cpp:
2861         (WebCore::RenderReplaced::computeReplacedLogicalWidth):
2862
2863 2016-05-04  Brady Eidson  <beidson@apple.com>
2864
2865         Modern IDB: Move all IDB DOM object management from IDBConnectionToServer to IDBConnectionProxy.
2866         https://bugs.webkit.org/show_bug.cgi?id=157348
2867
2868         Reviewed by Alex Christensen.
2869
2870         No new tests (Refactor, no change in behavior yet).
2871
2872         This is in-progress IDB-in-Workers code that is isolated enough to land right now.
2873         
2874         The goal is to have IDBConnectionToServer be a main-thread-only object, leaving IDBConnectionProxy
2875         as the threading bridge between the worker thread and the main thread.
2876         
2877         As such, IDBConnectionToServer no longer maintains maps of IDB DOM objects, but instead the proxy
2878         does and guards that access with locks.
2879         
2880         No threading changes takes place in this patch but it does scatter some isMainThread() checks and FIXMEs 
2881         accurately representing where threading changes will take place once I can return to this.
2882         
2883         * Modules/indexeddb/IDBDatabase.cpp:
2884         (WebCore::IDBDatabase::IDBDatabase):
2885         (WebCore::IDBDatabase::~IDBDatabase):
2886         (WebCore::IDBDatabase::maybeCloseInServer):
2887
2888         * Modules/indexeddb/IDBOpenDBRequest.cpp:
2889         (WebCore::IDBOpenDBRequest::dispatchEvent):
2890
2891         * Modules/indexeddb/IDBTransaction.cpp:
2892         (WebCore::IDBTransaction::abortOnServerAndCancelRequests):
2893         (WebCore::IDBTransaction::commitOnServer):
2894         (WebCore::IDBTransaction::establishOnServer):
2895
2896         * Modules/indexeddb/client/IDBConnectionProxy.cpp:
2897         (WebCore::IDBClient::IDBConnectionProxy::openDatabase):
2898         (WebCore::IDBClient::IDBConnectionProxy::deleteDatabase):
2899         (WebCore::IDBClient::IDBConnectionProxy::didOpenDatabase):
2900         (WebCore::IDBClient::IDBConnectionProxy::didDeleteDatabase):
2901         (WebCore::IDBClient::IDBConnectionProxy::completeOpenDBRequest):
2902         (WebCore::IDBClient::IDBConnectionProxy::fireVersionChangeEvent):
2903         (WebCore::IDBClient::IDBConnectionProxy::didFireVersionChangeEvent):
2904         (WebCore::IDBClient::IDBConnectionProxy::notifyOpenDBRequestBlocked):
2905         (WebCore::IDBClient::IDBConnectionProxy::establishTransaction):
2906         (WebCore::IDBClient::IDBConnectionProxy::didStartTransaction):
2907         (WebCore::IDBClient::IDBConnectionProxy::commitTransaction):
2908         (WebCore::IDBClient::IDBConnectionProxy::didCommitTransaction):
2909         (WebCore::IDBClient::IDBConnectionProxy::abortTransaction):
2910         (WebCore::IDBClient::IDBConnectionProxy::didAbortTransaction):
2911         (WebCore::IDBClient::IDBConnectionProxy::hasRecordOfTransaction):
2912         (WebCore::IDBClient::IDBConnectionProxy::didFinishHandlingVersionChangeTransaction):
2913         (WebCore::IDBClient::IDBConnectionProxy::databaseConnectionClosed):
2914         (WebCore::IDBClient::IDBConnectionProxy::registerDatabaseConnection):
2915         (WebCore::IDBClient::IDBConnectionProxy::unregisterDatabaseConnection):
2916         * Modules/indexeddb/client/IDBConnectionProxy.h:
2917         
2918         * Modules/indexeddb/client/IDBConnectionToServer.cpp:
2919         (WebCore::IDBClient::IDBConnectionToServer::deleteDatabase):
2920         (WebCore::IDBClient::IDBConnectionToServer::didDeleteDatabase):
2921         (WebCore::IDBClient::IDBConnectionToServer::openDatabase):
2922         (WebCore::IDBClient::IDBConnectionToServer::didOpenDatabase):
2923         (WebCore::IDBClient::IDBConnectionToServer::establishTransaction):
2924         (WebCore::IDBClient::IDBConnectionToServer::commitTransaction):
2925         (WebCore::IDBClient::IDBConnectionToServer::didCommitTransaction):
2926         (WebCore::IDBClient::IDBConnectionToServer::didFinishHandlingVersionChangeTransaction):
2927         (WebCore::IDBClient::IDBConnectionToServer::abortTransaction):
2928         (WebCore::IDBClient::IDBConnectionToServer::didAbortTransaction):
2929         (WebCore::IDBClient::IDBConnectionToServer::fireVersionChangeEvent):
2930         (WebCore::IDBClient::IDBConnectionToServer::didFireVersionChangeEvent):
2931         (WebCore::IDBClient::IDBConnectionToServer::didStartTransaction):
2932         (WebCore::IDBClient::IDBConnectionToServer::notifyOpenDBRequestBlocked):
2933         (WebCore::IDBClient::IDBConnectionToServer::databaseConnectionClosed):
2934         (WebCore::IDBClient::IDBConnectionToServer::registerDatabaseConnection): Deleted.
2935         (WebCore::IDBClient::IDBConnectionToServer::unregisterDatabaseConnection): Deleted.
2936         (WebCore::IDBClient::IDBConnectionToServer::hasRecordOfTransaction): Deleted.
2937         * Modules/indexeddb/client/IDBConnectionToServer.h:
2938         
2939         * Modules/indexeddb/shared/IDBRequestData.cpp:
2940         (WebCore::IDBRequestData::IDBRequestData):
2941         * Modules/indexeddb/shared/IDBRequestData.h:
2942         
2943         * Modules/indexeddb/shared/IDBResourceIdentifier.cpp:
2944         (WebCore::IDBResourceIdentifier::IDBResourceIdentifier):
2945         * Modules/indexeddb/shared/IDBResourceIdentifier.h:
2946
2947 2016-05-04  Brady Eidson  <beidson@apple.com>
2948
2949         Modern IDB: Add isolatedCopy to a few more objects.
2950         https://bugs.webkit.org/show_bug.cgi?id=157330
2951
2952         Reviewed by Alex Christensen.
2953
2954         No new tests (No current change in behavior, will be tested as bug 149953 makes progress).
2955
2956         * Modules/indexeddb/shared/IDBRequestData.cpp:
2957         (WebCore::IDBRequestData::IDBRequestData):
2958         (WebCore::IDBRequestData::isolatedCopy):
2959         * Modules/indexeddb/shared/IDBRequestData.h:
2960
2961         * Modules/indexeddb/shared/IDBResultData.cpp:
2962         (WebCore::IDBResultData::IDBResultData):
2963         (WebCore::IDBResultData::isolatedCopy):
2964         * Modules/indexeddb/shared/IDBResultData.h:
2965
2966 2016-05-04  Brady Eidson  <beidson@apple.com>
2967
2968         Modern IDB: Add thread identifiers and assertions to IDB DOM objects.
2969         https://bugs.webkit.org/show_bug.cgi?id=157329
2970
2971         Reviewed by Alex Christensen.
2972
2973         No new tests (No current change in behavior, will be tested as bug 149953 makes progress).
2974
2975         * Modules/indexeddb/IDBCursor.cpp:
2976         (WebCore::IDBCursor::IDBCursor):
2977         (WebCore::IDBCursor::~IDBCursor):
2978         (WebCore::IDBCursor::sourcesDeleted):
2979         (WebCore::IDBCursor::transaction):
2980         (WebCore::IDBCursor::direction):
2981         (WebCore::IDBCursor::update):
2982         (WebCore::IDBCursor::advance):
2983         (WebCore::IDBCursor::continueFunction):
2984         (WebCore::IDBCursor::uncheckedIterateCursor):
2985         (WebCore::IDBCursor::deleteFunction):
2986         (WebCore::IDBCursor::setGetResult):
2987         
2988         * Modules/indexeddb/IDBDatabase.cpp:
2989         (WebCore::IDBDatabase::~IDBDatabase):
2990         (WebCore::IDBDatabase::hasPendingActivity):
2991         (WebCore::IDBDatabase::name):
2992         (WebCore::IDBDatabase::version):
2993         (WebCore::IDBDatabase::objectStoreNames):
2994         (WebCore::IDBDatabase::createObjectStore):
2995         (WebCore::IDBDatabase::transaction):
2996         (WebCore::IDBDatabase::deleteObjectStore):
2997         (WebCore::IDBDatabase::close):
2998         (WebCore::IDBDatabase::maybeCloseInServer):
2999         (WebCore::IDBDatabase::activeDOMObjectName):
3000         (WebCore::IDBDatabase::canSuspendForDocumentSuspension):
3001         (WebCore::IDBDatabase::stop):
3002         (WebCore::IDBDatabase::startVersionChangeTransaction):
3003         (WebCore::IDBDatabase::didStartTransaction):
3004         (WebCore::IDBDatabase::willCommitTransaction):
3005         (WebCore::IDBDatabase::didCommitTransaction):
3006         (WebCore::IDBDatabase::willAbortTransaction):
3007         (WebCore::IDBDatabase::didAbortTransaction):
3008         (WebCore::IDBDatabase::didCommitOrAbortTransaction):
3009         (WebCore::IDBDatabase::fireVersionChangeEvent):
3010         (WebCore::IDBDatabase::dispatchEvent):
3011         (WebCore::IDBDatabase::didCreateIndexInfo):
3012         (WebCore::IDBDatabase::didDeleteIndexInfo):
3013         * Modules/indexeddb/IDBDatabase.h:
3014         (WebCore::IDBDatabase::originThreadID):
3015         
3016         * Modules/indexeddb/IDBIndex.cpp:
3017         (WebCore::IDBIndex::IDBIndex):
3018         (WebCore::IDBIndex::~IDBIndex):
3019         (WebCore::IDBIndex::name):
3020         (WebCore::IDBIndex::objectStore):
3021         (WebCore::IDBIndex::keyPath):
3022         (WebCore::IDBIndex::unique):
3023         (WebCore::IDBIndex::multiEntry):
3024         (WebCore::IDBIndex::openCursor):
3025         (WebCore::IDBIndex::doCount):
3026         (WebCore::IDBIndex::openKeyCursor):
3027         (WebCore::IDBIndex::doGet):
3028         (WebCore::IDBIndex::doGetKey):
3029         (WebCore::IDBIndex::markAsDeleted):
3030         
3031         * Modules/indexeddb/IDBObjectStore.cpp:
3032         (WebCore::IDBObjectStore::IDBObjectStore):
3033         (WebCore::IDBObjectStore::~IDBObjectStore):
3034         (WebCore::IDBObjectStore::name):
3035         (WebCore::IDBObjectStore::keyPath):
3036         (WebCore::IDBObjectStore::indexNames):
3037         (WebCore::IDBObjectStore::transaction):
3038         (WebCore::IDBObjectStore::autoIncrement):
3039         (WebCore::IDBObjectStore::openCursor):
3040         (WebCore::IDBObjectStore::get):
3041         (WebCore::IDBObjectStore::putOrAdd):
3042         (WebCore::IDBObjectStore::doDelete):
3043         (WebCore::IDBObjectStore::clear):
3044         (WebCore::IDBObjectStore::createIndex):
3045         (WebCore::IDBObjectStore::index):
3046         (WebCore::IDBObjectStore::deleteIndex):
3047         (WebCore::IDBObjectStore::doCount):
3048         (WebCore::IDBObjectStore::markAsDeleted):
3049         (WebCore::IDBObjectStore::rollbackInfoForVersionChangeAbort):
3050         
3051         * Modules/indexeddb/IDBOpenDBRequest.cpp:
3052         (WebCore::IDBOpenDBRequest::~IDBOpenDBRequest):
3053         (WebCore::IDBOpenDBRequest::onError):
3054         (WebCore::IDBOpenDBRequest::versionChangeTransactionDidFinish):
3055         (WebCore::IDBOpenDBRequest::fireSuccessAfterVersionChangeCommit):
3056         (WebCore::IDBOpenDBRequest::fireErrorAfterVersionChangeCompletion):
3057         (WebCore::IDBOpenDBRequest::dispatchEvent):
3058         (WebCore::IDBOpenDBRequest::onSuccess):
3059         (WebCore::IDBOpenDBRequest::onUpgradeNeeded):
3060         (WebCore::IDBOpenDBRequest::onDeleteDatabaseSuccess):
3061         (WebCore::IDBOpenDBRequest::requestCompleted):
3062         (WebCore::IDBOpenDBRequest::requestBlocked):
3063         
3064         * Modules/indexeddb/IDBRequest.cpp:
3065         (WebCore::IDBRequest::~IDBRequest):
3066         (WebCore::IDBRequest::errorCode):
3067         (WebCore::IDBRequest::error):
3068         (WebCore::IDBRequest::setSource):
3069         (WebCore::IDBRequest::setVersionChangeTransaction):
3070         (WebCore::IDBRequest::transaction):
3071         (WebCore::IDBRequest::readyState):
3072         (WebCore::IDBRequest::sourceObjectStoreIdentifier):
3073         (WebCore::IDBRequest::sourceIndexIdentifier):
3074         (WebCore::IDBRequest::requestedIndexRecordType):
3075         (WebCore::IDBRequest::eventTargetInterface):
3076         (WebCore::IDBRequest::activeDOMObjectName):
3077         (WebCore::IDBRequest::canSuspendForDocumentSuspension):
3078         (WebCore::IDBRequest::hasPendingActivity):
3079         (WebCore::IDBRequest::stop):
3080         (WebCore::IDBRequest::enqueueEvent):
3081         (WebCore::IDBRequest::dispatchEvent):
3082         (WebCore::IDBRequest::uncaughtExceptionInEventHandler):
3083         (WebCore::IDBRequest::setResult):
3084         (WebCore::IDBRequest::setResultToStructuredClone):
3085         (WebCore::IDBRequest::clearResult):
3086         (WebCore::IDBRequest::setResultToUndefined):
3087         (WebCore::IDBRequest::resultCursor):
3088         (WebCore::IDBRequest::willIterateCursor):
3089         (WebCore::IDBRequest::didOpenOrIterateCursor):
3090         (WebCore::IDBRequest::requestCompleted):
3091         (WebCore::IDBRequest::onError):
3092         (WebCore::IDBRequest::onSuccess):
3093         * Modules/indexeddb/IDBRequest.h:
3094         (WebCore::IDBRequest::originThreadID):
3095         
3096         * Modules/indexeddb/IDBTransaction.cpp:
3097         (WebCore::IDBTransaction::IDBTransaction):
3098         (WebCore::IDBTransaction::~IDBTransaction):
3099         (WebCore::IDBTransaction::mode):
3100         (WebCore::IDBTransaction::db):
3101         (WebCore::IDBTransaction::serverConnection):
3102         (WebCore::IDBTransaction::error):
3103         (WebCore::IDBTransaction::objectStore):
3104         (WebCore::IDBTransaction::abortDueToFailedRequest):
3105         (WebCore::IDBTransaction::transitionedToFinishing):
3106         (WebCore::IDBTransaction::abort):
3107         (WebCore::IDBTransaction::abortOnServerAndCancelRequests):
3108         (WebCore::IDBTransaction::activeDOMObjectName):
3109         (WebCore::IDBTransaction::canSuspendForDocumentSuspension):
3110         (WebCore::IDBTransaction::hasPendingActivity):
3111         (WebCore::IDBTransaction::stop):
3112         (WebCore::IDBTransaction::isActive):
3113         (WebCore::IDBTransaction::isFinishedOrFinishing):
3114         (WebCore::IDBTransaction::addRequest):
3115         (WebCore::IDBTransaction::removeRequest):
3116         (WebCore::IDBTransaction::scheduleOperation):
3117         (WebCore::IDBTransaction::scheduleOperationTimer):
3118         (WebCore::IDBTransaction::operationTimerFired):
3119         (WebCore::IDBTransaction::commit):
3120         (WebCore::IDBTransaction::commitOnServer):
3121         (WebCore::IDBTransaction::finishAbortOrCommit):
3122         (WebCore::IDBTransaction::didStart):
3123         (WebCore::IDBTransaction::notifyDidAbort):
3124         (WebCore::IDBTransaction::didAbort):
3125         (WebCore::IDBTransaction::didCommit):
3126         (WebCore::IDBTransaction::fireOnComplete):
3127         (WebCore::IDBTransaction::fireOnAbort):
3128         (WebCore::IDBTransaction::enqueueEvent):
3129         (WebCore::IDBTransaction::dispatchEvent):
3130         (WebCore::IDBTransaction::createObjectStore):
3131         (WebCore::IDBTransaction::createObjectStoreOnServer):
3132         (WebCore::IDBTransaction::didCreateObjectStoreOnServer):
3133         (WebCore::IDBTransaction::createIndex):
3134         (WebCore::IDBTransaction::createIndexOnServer):
3135         (WebCore::IDBTransaction::didCreateIndexOnServer):
3136         (WebCore::IDBTransaction::requestOpenCursor):
3137         (WebCore::IDBTransaction::doRequestOpenCursor):
3138         (WebCore::IDBTransaction::openCursorOnServer):
3139         (WebCore::IDBTransaction::didOpenCursorOnServer):
3140         (WebCore::IDBTransaction::iterateCursor):
3141         (WebCore::IDBTransaction::iterateCursorOnServer):
3142         (WebCore::IDBTransaction::didIterateCursorOnServer):
3143         (WebCore::IDBTransaction::requestGetRecord):
3144         (WebCore::IDBTransaction::requestGetValue):
3145         (WebCore::IDBTransaction::requestGetKey):
3146         (WebCore::IDBTransaction::requestIndexRecord):
3147         (WebCore::IDBTransaction::getRecordOnServer):
3148         (WebCore::IDBTransaction::didGetRecordOnServer):
3149         (WebCore::IDBTransaction::requestCount):
3150         (WebCore::IDBTransaction::getCountOnServer):
3151         (WebCore::IDBTransaction::didGetCountOnServer):
3152         (WebCore::IDBTransaction::requestDeleteRecord):
3153         (WebCore::IDBTransaction::deleteRecordOnServer):
3154         (WebCore::IDBTransaction::didDeleteRecordOnServer):
3155         (WebCore::IDBTransaction::requestClearObjectStore):
3156         (WebCore::IDBTransaction::clearObjectStoreOnServer):
3157         (WebCore::IDBTransaction::didClearObjectStoreOnServer):
3158         (WebCore::IDBTransaction::requestPutOrAdd):
3159         (WebCore::IDBTransaction::putOrAddOnServer):
3160         (WebCore::IDBTransaction::didPutOrAddOnServer):
3161         (WebCore::IDBTransaction::deleteObjectStore):
3162         (WebCore::IDBTransaction::deleteObjectStoreOnServer):
3163         (WebCore::IDBTransaction::didDeleteObjectStoreOnServer):
3164         (WebCore::IDBTransaction::deleteIndex):
3165         (WebCore::IDBTransaction::deleteIndexOnServer):
3166         (WebCore::IDBTransaction::didDeleteIndexOnServer):
3167         (WebCore::IDBTransaction::operationDidComplete):
3168         (WebCore::IDBTransaction::establishOnServer):
3169         (WebCore::IDBTransaction::activate):
3170         (WebCore::IDBTransaction::deactivate):
3171
3172 2016-05-05  Nan Wang  <n_wang@apple.com>
3173
3174         For keyboard users, activating a fragment URL should transfer focus and caret to the destination
3175         https://bugs.webkit.org/show_bug.cgi?id=116046
3176
3177         Reviewed by Ryosuke Niwa.
3178
3179         Added a sequential focus navigation starting node to document. When TAB or SHIFT-TAB is pressed
3180         and there is no focused element, we start searching for next focus candidates at the sequential
3181         focus navigation node.
3182
3183         Test: fast/events/sequential-focus-navigation-starting-point.html
3184
3185         * dom/Document.cpp:
3186         (WebCore::Document::removedLastRef):
3187         (WebCore::Document::destroyRenderTree):
3188         (WebCore::Document::removeFocusedNodeOfSubtree):
3189         (WebCore::Document::hoveredElementDidDetach):
3190         (WebCore::Document::setFocusedElement):
3191         (WebCore::isNodeFrameOrDocument):
3192         (WebCore::Document::setFocusNavigationStartingNode):
3193         (WebCore::Document::focusNavigationStartingNode):
3194         (WebCore::Document::setCSSTarget):
3195         (WebCore::Document::nodeChildrenWillBeRemoved):
3196         (WebCore::Document::nodeWillBeRemoved):
3197         (WebCore::fallbackFocusNavigationStartingNodeAfterRemoval):
3198         (WebCore::Document::updateFocusNavigationStartingNodeWithNodeRemoval):
3199         (WebCore::Document::textInserted):
3200         * dom/Document.h:
3201         (WebCore::Document::userActionElements):
3202         * page/EventHandler.cpp:
3203         (WebCore::EventHandler::handleMousePressEvent):
3204         * page/FocusController.cpp:
3205         (WebCore::FocusController::advanceFocusInDocumentOrder):
3206         * page/FrameView.cpp:
3207         (WebCore::FrameView::scrollToAnchor):
3208
3209 2016-05-05  Ryosuke Niwa  <rniwa@webkit.org>
3210
3211         Another iOS debug build fix after r200464.
3212
3213         * dom/EventContext.h:
3214         (WebCore::EventContext::isUnreachableNode):
3215
3216 2016-05-05  Ryosuke Niwa  <rniwa@webkit.org>
3217
3218         iOS debug build fix after r200464.
3219
3220         * dom/EventContext.cpp:
3221         (WebCore::TouchEventContext::checkReachability):
3222
3223 2016-05-05  Simon Fraser  <simon.fraser@apple.com>
3224
3225         Revert r200390, thus putting r199259 and r200161 and back.
3226
3227         * loader/HistoryController.cpp:
3228         (WebCore::HistoryController::saveScrollPositionAndViewStateToItem):
3229         * page/FrameView.cpp:
3230         (WebCore::FrameView::adjustTiledBackingScrollability):
3231         * page/Page.h:
3232         (WebCore::Page::obscuredInset):
3233         (WebCore::Page::setObscuredInset):
3234         (WebCore::Page::enclosedInScrollableAncestorView):
3235         (WebCore::Page::setEnclosedInScrollableAncestorView):
3236         * platform/ScrollView.h:
3237         (WebCore::ScrollView::platformObscuredInset): Deleted.
3238         (WebCore::ScrollView::platformSetObscuredInset): Deleted.
3239
3240 2016-05-05  Sam Weinig  <sam@webkit.org>
3241
3242         Fix the build.
3243
3244         * platform/network/cf/CertificateInfo.h:
3245
3246 2016-05-05  Eric Carlson  <eric.carlson@apple.com>
3247
3248         [iOS] Media information is sometimes not shown in Control Center
3249         https://bugs.webkit.org/show_bug.cgi?id=157377
3250
3251         Reviewed by Jer Noble.
3252
3253         * platform/audio/ios/MediaSessionManagerIOS.h:
3254         * platform/audio/ios/MediaSessionManagerIOS.mm:
3255         (WebCore::MediaSessionManageriOS::updateNowPlayingInfo): Store values passed to MPNowPlayingInfoCenter
3256           individually instead of in a dictionary.
3257
3258 2016-05-04  Simon Fraser  <simon.fraser@apple.com>
3259
3260         Comments on wired.com are blurry
3261         https://bugs.webkit.org/show_bug.cgi?id=148630
3262         rdar://problem/22499655
3263
3264         Reviewed by Tim Horton.
3265
3266         Make sure to set -rasterizationScale on TileGrid container layers to avoid blurry layers
3267         with some configurations of transforms, perspective and clipping.
3268
3269         Test: compositing/contents-scale/rasterization-scale.html
3270
3271         * platform/graphics/ca/TileController.cpp:
3272         (WebCore::TileController::TileController): Initialize m_deviceScaleFactor before m_tileGrid,
3273         because TileGrid's constructor needs to read the device scale.
3274         * platform/graphics/ca/TileController.h:
3275         * platform/graphics/ca/TileGrid.cpp:
3276         (WebCore::TileGrid::TileGrid): Push a contentsScale (which also sets rasterizationScale) onto 
3277         the tile grid container layer on constructions, and in setScale().
3278         (WebCore::TileGrid::setScale):
3279
3280 2016-05-05  Ryosuke Niwa  <rniwa@webkit.org>
3281
3282         event.target shouldn't be retargeted as the event bubbles into a slot
3283         https://bugs.webkit.org/show_bug.cgi?id=157369
3284
3285         Reviewed by Antti Koivisto.
3286
3287         When an event bubbles up from an assigned node to its assigned slot, we shouldn't be adjusting
3288         event.target to point to the slot. Since a shadow tree should have access to nodes outside
3289         the shadow tree, event.target is accessible inside the shadow tree of such a slot.
3290
3291         New behavior matches the behavior of Google Chrome Canary as well as the shadow DOM specification:
3292         http://w3c.github.io/webcomponents/spec/shadow/#dfn-retargeting-algorithm
3293
3294         Test: fast/shadow-dom/event-inside-slotted-node.html
3295
3296         * dom/Event.cpp:
3297         (WebCore::Event::deepPath):
3298         * dom/EventContext.h:
3299         (WebCore::EventContext::isUnreachableNode): Use Node::isUnclosedNode instead of isReachable.
3300         (WebCore::EventContext::isReachable): Deleted.
3301         * dom/EventPath.cpp:
3302         (WebCore::EventPath::EventPath): Don't set the target to the slot when entering a slot. Also moved
3303         the code to adjust the target as we exit a shadow tree to the end of the outer loop for clarity.
3304         (WebCore::isUnclosedNodeOf): Deleted. Renamed to Node::isUnclosedNode.
3305         (WebCore::EventPath::setRelatedTarget):
3306         (WebCore::EventPath::computePathUnclosedToTarget): Renamed from computePathDisclosedToTarget.
3307         (WebCore::moveOutOfAllShadowRoots): Extracted from RelatedNodeRetargeter::RelatedNodeRetargeter.
3308         (WebCore::RelatedNodeRetargeter::RelatedNodeRetargeter): Fixed a bug that we were exiting early
3309         without setting m_hasDifferentTreeRoot true when target and relatedNode are disconnected from
3310         a document.
3311         (WebCore::RelatedNodeRetargeter::currentNode):
3312         (WebCore::RelatedNodeRetargeter::checkConsistency): Updated to match the spec with one exception.
3313         We don't use null as the adjusted related target when the (original) related target and the target
3314         are in two distinct disconnected trees since such a behavior is not Web compatible. This spec bug is
3315         tracked by https://github.com/w3c/webcomponents/issues/494
3316         * dom/EventPath.h:
3317         (WebCore::EventPath::eventTargetRespectingTargetRules): Returns Node* instead of EventTarget* since
3318         we need a Node in RelatedNodeRetargeter::checkConsistency.
3319         * dom/Node.cpp:
3320         (WebCore::Node::isUnclosedNode): Moved from RelatedNodeRetargeter.cpp
3321         * dom/Node.h:
3322
3323 2016-05-02  Sam Weinig  <sam@webkit.org>
3324
3325         On platforms that support it, use a SecTrustRef as the basis of CertificateInfo instead of a chain of SecCertificateRefs.
3326         https://bugs.webkit.org/show_bug.cgi?id=157220
3327
3328         Reviewed by Darin Adler.
3329
3330         * platform/network/cf/CertificateInfo.h:
3331         (WebCore::CertificateInfo::CertificateInfo):
3332         (WebCore::CertificateInfo::trust):
3333         (WebCore::CertificateInfo::isEmpty):
3334         (WebCore::CertificateInfo::setCertificateChain): Deleted.
3335         (WebCore::CertificateInfo::certificateChain): Deleted.
3336         * platform/network/mac/CertificateInfoMac.mm:
3337         (WebCore::CertificateInfo::type):
3338         (WebCore::CertificateInfo::certificateChain):
3339         (WebCore::CertificateInfo::containsNonRootSHA1SignedCertificate):
3340         (WebCore::CertificateInfo::dump):
3341         When supported, allow CertificateInfo to contain a SecTrustRef instead of a certificate chain. We keep
3342         support for holding on to a certificate chain as well, since there is API that depends on this.
3343
3344         * platform/network/cocoa/ResourceResponseCocoa.mm:
3345         (WebCore::ResourceResponse::platformCertificateInfo):
3346         When supported, use the SecTrustRef from the error instead of extracting it's certificate chain.
3347
3348 2016-05-04  Ada Chan  <adachan@apple.com>
3349
3350         When exiting fullscreen, call a JS method immediately to implement the style changes for the presentation mode change right away
3351         https://bugs.webkit.org/show_bug.cgi?id=157359
3352
3353         Reviewed by Eric Carlson.
3354
3355         No new tests as this is done to just mitigate a visual glitch.
3356
3357         * html/HTMLMediaElement.cpp:
3358         (WebCore::HTMLMediaElement::exitFullscreen):
3359         (WebCore::HTMLMediaElement::updateMediaControlsAfterPresentationModeChange):
3360         * html/HTMLMediaElement.h:
3361
3362 2016-05-04  Alex Christensen  <achristensen@webkit.org>
3363
3364         Blocked redirected main resource requests need descriptive errors
3365         https://bugs.webkit.org/show_bug.cgi?id=156828
3366         rdar://problem/25711316
3367
3368         Reviewed by Daniel Bates.
3369
3370         Test: http/tests/contentextensions/main-resource-redirect-error.html
3371
3372         * loader/DocumentLoader.cpp:
3373         (WebCore::DocumentLoader::startLoadingMainResource):
3374         Call cancelMainResourceLoad() so that InjectedBundlePage::didFailProvisionalLoadWithErrorForFrame()