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