0c65f8f2f2c4d314541d3cd692fded39028416a5
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2017-01-05  Per Arne Vollan  <pvollan@apple.com>
2
3         [Win] Compile error.
4         https://bugs.webkit.org/show_bug.cgi?id=166726
5
6         Reviewed by Alex Christensen.
7
8         Add include folder.
9
10         * CMakeLists.txt:
11
12 2017-01-05  Milan Crha  <mcrha@redhat.com>
13
14         [SOUP] AddressSanitizer: heap-use-after-free under WTF::String::fromUTF8()
15         https://bugs.webkit.org/show_bug.cgi?id=166722
16
17         Reviewed by Alex Christensen.
18
19         * platform/soup/PublicSuffixSoup.cpp:
20         (WebCore::topPrivatelyControlledDomain):
21         Use a variable to hold UTF-8 version of the domain, because
22         the soup_tld_get_base_domain() returns a pointer into the passed-in
23         string, which could be freed due to the temporary object being freed.
24
25 2017-01-05  Andreas Kling  <akling@apple.com>
26
27         Remove some unnecessary page cache checks in render tree code.
28         <https://webkit.org/b/166728>
29
30         Reviewed by Antti Koivisto.
31
32         There is no render tree in the page cache, so we don't need to be checking
33         for it in renderer code.
34
35         * rendering/RenderElement.cpp:
36         (WebCore::shouldRepaintForImageAnimation):
37         (WebCore::RenderElement::newImageAnimationFrameAvailable):
38         * rendering/RenderImage.cpp:
39         (WebCore::RenderImage::imageChanged):
40         * rendering/RenderObject.cpp:
41         (WebCore::printRenderTreeForLiveDocuments):
42         (WebCore::printLayerTreeForLiveDocuments):
43         * rendering/RenderView.cpp:
44         (WebCore::RenderView::lazyRepaintTimerFired):
45
46 2017-01-05  Andreas Kling  <akling@apple.com>
47
48         REGRESSION(r210226): overflow:scroll scroll position not restored on back navigation
49         <https://webkit.org/b/166724>
50
51         Reviewed by Antti Koivisto.
52
53         Before r210226, the render tree being torn down and the document being destroyed
54         were roughly the same thing, since they would always happen together, from the
55         render tree's perspective.
56
57         Changing this caused us to skip over the code that saves the scroll position
58         for an element's RenderLayer when going into the page cache. Navigating back to
59         that page would then scroll the layer to (0,0) instead of the previous position.
60
61         The fix is simply to remove the check for documentBeingDestroyed() in ~RenderLayer().
62         Note that two checks are being removed, there was also a weird "optimization"
63         to avoid nulling out EventHandler's m_resizeLayer if it points to this layer.
64         That pointer would eventually get nulled out in EventHandler::clear() anyway,
65         but it feels better to not let that pointer dangle.
66
67         Test: fast/scrolling/page-cache-back-overflow-scroll-restore.html
68
69         * rendering/RenderLayer.cpp:
70         (WebCore::RenderLayer::~RenderLayer):
71
72 2017-01-05  Wenson Hsieh  <wenson_hsieh@apple.com>
73
74         Disable smooth playhead animation for main content media in the Touch Bar
75         https://bugs.webkit.org/show_bug.cgi?id=166715
76         <rdar://problem/29870673>
77
78         Reviewed by Eric Carlson.
79
80         Passing in a non-zero playback rate to WebPlaybackControlsManager's timing property causes unintended effects
81         further down the stack. Please see the Radar for more details.
82
83         * platform/mac/WebPlaybackSessionInterfaceMac.mm:
84         (WebCore::WebPlaybackSessionInterfaceMac::updatePlaybackControlsManagerTiming):
85
86 2017-01-05  Andreas Kling  <akling@apple.com>
87
88         Fix iOS build due to missing #include's.
89
90         * history/CachedFrame.cpp:
91
92 2017-01-05  Andreas Kling  <akling@apple.com>
93
94         Remove ChromeClient::needTouchEvents().
95         <https://webkit.org/b/166723>
96
97         Rubber-stamped by Antti Koivisto.
98
99         Remove this hook since it's a no-op in every port.
100
101         * dom/Document.cpp:
102         (WebCore::Document::didBecomeCurrentDocumentInFrame):
103         (WebCore::Document::didAddTouchEventHandler):
104         (WebCore::Document::didRemoveTouchEventHandler):
105         * history/CachedFrame.cpp:
106         (WebCore::CachedFrameBase::restore):
107         * loader/EmptyClients.h:
108         * loader/FrameLoader.cpp:
109         (WebCore::FrameLoader::transitionToCommitted):
110         * page/ChromeClient.h:
111
112 2017-01-05  Darin Adler  <darin@apple.com>
113
114         Remove PassRefPtr use from "bindings/scripts", "svg", "testing", and "workers"
115         https://bugs.webkit.org/show_bug.cgi?id=166718
116
117         Reviewed by Alex Christensen.
118
119         * bindings/scripts/test/JS/JSFloat64Array.cpp: Removed. Stale unused test
120         result expectation file.
121         * bindings/scripts/test/JS/JSFloat64Array.h: Ditto.
122
123         * svg/SVGElement.cpp:
124         (WebCore::SVGElement::removeEventListener): Fix comment that incorrectly
125         mentions PassRefPtr.
126
127         * testing/Internals.cpp:
128         (WebCore::Internals::computedStyleIncludingVisitedInfo): Return Ref instead
129         of RefPtr.
130         (WebCore::Internals::serializeObject): Ditto.
131         (WebCore::Internals::deserializeBuffer): Ditto.
132         (WebCore::Internals::observeGC): Streamlined code a bit.
133         * testing/Internals.h: Updated for above changes.
134         * testing/Internals.idl: Marked various function results as nullable.
135
136         * workers/DedicatedWorkerThread.cpp:
137         (WebCore::DedicatedWorkerThread::createWorkerGlobalScope): Take a RefPtr&&
138         instead of a PassRefPtr.
139         * workers/DedicatedWorkerThread.h: Updated for above change.
140
141         * workers/Worker.cpp:
142         (WebCore::Worker::Worker): Passs a reference to WorkerGlobalScopeProxy::create.
143         (WebCore::Worker::~Worker): Updated since m_contentProxy is a reference.
144         (WebCore::Worker::postMessage): Ditto.
145         (WebCore::Worker::terminate): Ditto.
146         (WebCore::Worker::hasPendingActivity): Ditto.
147         (WebCore::Worker::notifyNetworkStateChange): Ditto.
148         (WebCore::Worker::notifyFinished): Ditto.
149         * workers/Worker.h: Made m_contextProxy a reference rather than a pointer.
150
151         * workers/WorkerGlobalScopeProxy.h: Reduced includes. Made destructor
152         protected instead of public since this class destroys itself.
153
154         * workers/WorkerMessagingProxy.cpp:
155         (WebCore::WorkerGlobalScopeProxy::create): Take and return a reference.
156         (WebCore::WorkerMessagingProxy::WorkerMessagingProxy): Moved most initialization
157         to the calass definition. Take a reference instead of a pointer.
158         (WebCore::WorkerMessagingProxy::startWorkerGlobalScope): Use auto.
159         (WebCore::WorkerMessagingProxy::workerThreadCreated): Take a reference
160         rather than a PassRefPtr.
161         * workers/WorkerMessagingProxy.h: Updated for above changes.
162         (WebCore::WorkerMessagingProxy::askedToTerminate): Deleted.
163         (WebCore::WorkerMessagingProxy::workerObject): Deleted.
164
165         * workers/WorkerThread.h: Take a RefPtr&& instead of a PassRefPtr.
166
167 2017-01-04  Carlos Garcia Campos  <cgarcia@igalia.com>
168
169         Unreviewed. Addressing post-review comments after r21005.
170
171         Simplify cairo_glyph_t initialization as suggested by Said.
172
173         * platform/graphics/cairo/FontCairo.cpp:
174         (WebCore::CairoGlyphToPathTranslator::path):
175
176 2017-01-04  Manuel Rego Casasnovas  <rego@igalia.com>
177
178         [css-grid] Fix crash clamping grid lines
179         https://bugs.webkit.org/show_bug.cgi?id=166637
180
181         Reviewed by Darin Adler.
182
183         Avoid issues with very big values for the grid lines clamping them on GridPosition.
184
185         Test: fast/css-grid-layout/grid-position-crash.html
186
187         * rendering/style/GridArea.h: Move kGridMaxTracks definition to GridPosition.
188         * rendering/style/GridPosition.h:
189         (WebCore::GridPosition::setExplicitPosition): Use new setIntegerPosition().
190         (WebCore::GridPosition::setSpanPosition): Ditto.
191         (WebCore::GridPosition::setIntegerPosition): Clamp the position using kGridMaxTracks.
192
193 2017-01-04  Darin Adler  <darin@apple.com>
194
195         Remove PassRefPtr use from the "html" directory, other improvements
196         https://bugs.webkit.org/show_bug.cgi?id=166635
197
198         Reviewed by Alex Christensen.
199
200         * CMakeLists.txt: Removed the duplicate copies of all the WebGL-specific files
201         in the main list of source files; there is no value in listing them twice.
202         Replaced WebGLGetInfo.cpp with WebGLAny.cpp.
203
204         * Modules/mediasource/MediaSource.cpp:
205         (WebCore::MediaSource::removeSourceBuffer): Updates since the tracks functions
206         return references now.
207
208         * Modules/mediasource/SourceBuffer.cpp:
209         (WebCore::SourceBuffer::sourceBufferPrivateFastSeekTimeForMediaTime): Removed
210         unneeded SourceBufferPrivate* argument.
211         (WebCore::SourceBuffer::appendBufferTimerFired): Ditto.
212         (WebCore::SourceBuffer::sourceBufferPrivateAppendComplete): Ditto.
213         (WebCore::SourceBuffer::sourceBufferPrivateDidReceiveRenderingError): Ditto.
214         (WebCore::SourceBuffer::videoTracks): Return a reference rather than a pointer.
215         (WebCore::SourceBuffer::audioTracks): Ditto.
216         (WebCore::SourceBuffer::textTracks): Ditto.
217         (WebCore::SourceBuffer::sourceBufferPrivateDidReceiveInitializationSegment):
218         Removed unneeded SourceBufferPrivate* argument.
219         (WebCore::SourceBuffer::validateInitializationSegment): Updated since tracks
220         functions now return a pointer.
221         (WebCore::SourceBuffer::sourceBufferPrivateDidReceiveSample): Removed unneeded
222         SourceBufferPrivate* argument.
223         (WebCore::SourceBuffer::sourceBufferPrivateHasAudio): Ditto.
224         (WebCore::SourceBuffer::sourceBufferPrivateHasVideo): Ditto.
225         (WebCore::SourceBuffer::videoTrackSelectedChanged): Take a reference rather than
226         a pointer.
227         (WebCore::SourceBuffer::audioTrackEnabledChanged): Ditto.
228         (WebCore::SourceBuffer::textTrackModeChanged): Ditto.
229         (WebCore::SourceBuffer::textTrackAddCue): Ditto.
230         (WebCore::SourceBuffer::textTrackAddCues): Ditto.
231         (WebCore::SourceBuffer::textTrackRemoveCue): Ditto.
232         (WebCore::SourceBuffer::textTrackRemoveCues): Ditto.
233         (WebCore::SourceBuffer::textTrackKindChanged): Ditto.
234         (WebCore::SourceBuffer::sourceBufferPrivateDidBecomeReadyForMoreSamples): Ditto.
235         (WebCore::SourceBuffer::provideMediaData): Ditto.
236         (WebCore::SourceBuffer::reenqueueMediaForTime): Ditto.
237         * Modules/mediasource/SourceBuffer.h: Updated for above changes.
238
239         * WebCore.xcodeproj/project.pbxproj: Replaced WebGLGetInfo with WebGLAny.
240
241         * bindings/js/JSCanvasRenderingContext2DCustom.cpp:
242         (WebCore::toHTMLCanvasStyle): Removed explicit cast to CanvasStyle and unneeded
243         conversion to a pointer since CanvasStyle constructors now take references.
244
245         * bindings/js/JSPluginElementFunctions.cpp:
246         (WebCore::pluginInstance): Updated since bindingsInstance now returns a raw pointer.
247         (WebCore::pluginScriptObject): Ditto.
248
249         * bindings/js/JSWebGL2RenderingContextCustom.cpp:
250         (WebCore::toJS): Moved to WebGLAny.h/cpp.
251         (WebCore::JSWebGL2RenderingContext::getIndexedParameter): Updated since the toJS
252         function in WebGLAny.h takes references, not pointers.
253
254         * bindings/js/JSWebGLRenderingContextBaseCustom.cpp: Removed quite a few unneeded
255         includes and got rid of a lot of unneeded JSC prefixes.
256         (WebCore::toJS): Moved to WebGLAny.h/cpp.
257         (WebCore::toJSNewlyCreated):
258         (WebCore::objectParameter): Renamed from getObjectParameter and also changed to
259         take a pointer to member function so we don't need an enum and a switch statement.
260         (WebCore::toJS): Changed to take references rather than pointers.
261         (WebCore::JSWebGLRenderingContextBase::getAttachedShaders): Use a modern for loop.
262         (WebCore::JSWebGLRenderingContextBase::getBufferParameter): Use objectParameter.
263         (WebCore::JSWebGLRenderingContextBase::getRenderbufferParameter): Ditto.
264         (WebCore::JSWebGLRenderingContextBase::getVertexAttrib): Ditto.
265         (WebCore::toNumberVector): Renamed from toVector, since this is specifically for
266         vectors of numbers. Use uncheckedAppend instead of assignment.
267         (WebCore::functionForUniform): Marked this inline.
268         (WebCore::dataFunctionf): Updated for above changes.
269         (WebCore::dataFunctioni): Ditto.
270         (WebCore::dataFunctionMatrix): Ditto.
271
272         * bindings/js/ScriptModuleLoader.cpp:
273         (WebCore::ScriptModuleLoader::fetch): Moved assertions to the top of the function.
274         Also added a FIXME because it's unclear why these assertions are correct. Updated
275         to use downcastScriptElement instead of toScriptElementIfPossible.
276
277         * dom/Document.h: Sorted list of forward-declared classes. Removed duplicate
278         forward declaration of ScriptModuleLoader.
279
280         * dom/PendingScript.cpp:
281         (WebCore::PendingScript::create): Take a ScriptElement instead of an Element.
282         (WebCore::PendingScript::PendingScript): Ditto.
283         (WebCore::PendingScript::loadableScript): Moved inline to header and made inline.
284         (WebCore::PendingScript::setClient): Take a reference instead of a pointer.
285         * dom/PendingScript.h: UPdated for above changes.
286
287         * dom/ScriptElement.cpp:
288         (WebCore::ScriptElement::prepareScript): Pass a reference instead of a pointer.
289         (WebCore::ScriptElement::ref): Added. Forwards ref/deref to the underlying element
290         so we can use Ref and RefPtr with this class.
291         (WebCore::ScriptElement::deref): Ditto.
292         (WebCore::isScriptElement): Added. Replaces one of the two uses of
293         toScriptElementIfPossible, and is similar in style to is<Element>.
294         (WebCore::downcastScriptElement): Ditto, but for downcast.
295         * dom/ScriptElement.h: Updated for above changes.
296
297         * dom/ScriptRunner.cpp:
298         (WebCore::ScriptRunner::queueScriptForExecution): Take reference rather than
299         pointer, and pass ScriptElement rather than Element.
300         (WebCore::ScriptRunner::notifyFinished): Ditto.
301         (WebCore::ScriptRunner::timerFired): Ditto.
302         * dom/ScriptRunner.h: Updated for above changes.
303
304         * html/FileInputType.cpp:
305         (WebCore::FileInputType::files): Updated since m_fileList is a Ref.
306         (WebCore::FileInputType::createFileList): Updated to return a Ref instead of
307         a PassRefPtr. Also use reserveInitialCapacity/uncheckedAppend.
308         (WebCore::FileInputType::requestIcon): Updated since the updateRendering
309         function is now called iconLoaded. Also use references instead of pointers.
310         (WebCore::FileInputType::setFiles): Take a RefPtr&& insted of a PassRefPtr.
311         Also put some conditional code inside an #if.
312         (WebCore::FileInputType::filesChosen): Updated for function name change.
313         (WebCore::FileInputType::iconLoaded): Renamed from updateRendering.
314         Changed argument to RefPtr&& from PassRefPtr.
315         (WebCore::FileInputType::defaultToolTip): Got rid of unneeded local variable
316         and used the correct type, unsigned, rather than size_t.
317         * html/FileInputType.h: Updated for the above changes, use final instead
318         of override, and use Ref instead of RefPtr.
319
320         * html/HTMLElement.cpp:
321         (WebCore::HTMLElement::form): Renamed from virtualForm.
322         * html/HTMLElement.h: Replaced the form/virtualForm pair of functions with
323         just a form function. The old design dates back before we had "final" for
324         virtual functions, and now we can just use that instead.
325
326         * html/HTMLFormControlElement.cpp:
327         (WebCore::HTMLFormControlElement::virtualForm): Deleted.
328         * html/HTMLFormControlElement.h: Mark the form function final, since it's
329         now both an inline function in this class, and an override of a virtual
330         function inherited from the base class. Deleted the virtualForm function.
331
332         * html/HTMLInputElement.cpp:
333         (WebCore::HTMLInputElement::defaultEventHandler): Removed use of the
334         formForSubmission function, which was just another way to get the same
335         thing as the form function; perhaps they were different in the past.
336         (WebCore::HTMLInputElement::setFiles): Take a RefPtr&& rather than a PassRefPtr.
337         * html/HTMLInputElement.h: Updated for the above.
338
339         * html/HTMLLabelElement.cpp:
340         (WebCore::HTMLLabelElement::control): Made this const.
341         (WebCore::HTMLLabelElement::form): Made this const, so it can be used to
342         override the const form function from the base class.
343         * html/HTMLLabelElement.h: Marked the form function final, since we want it
344         to override the form function inherited from HTMLElement.
345
346         * html/HTMLLegendElement.cpp:
347         (WebCore::HTMLLegendElement::form): Renamed from virtualForm.
348         * html/HTMLLegendElement.h: Override form instead of virtualForm and mark it final
349         This makes things more efficient if someone calls form directly on this class;
350         before it would make an unnecessary virtual function call.
351
352         * html/HTMLMediaElement.cpp:
353         (WebCore::TrackDisplayUpdateScope::TrackDisplayUpdateScope): Take a reference
354         rather than a pointer.
355         (WebCore::TrackDisplayUpdateScope::~TrackDisplayUpdateScope): Ditto.
356         (WebCore::eventTimeCueCompare): Compare the cues the same way the cue list would
357         rather than using cueIndex.
358         (WebCore::HTMLMediaElement::audioTrackEnabledChanged): Take a reference.
359         (WebCore::HTMLMediaElement::textTrackModeChanged): Ditto.
360         (WebCore::HTMLMediaElement::videoTrackSelectedChanged): Ditto.
361         (WebCore::HTMLMediaElement::textTrackKindChanged): Ditto.
362         (WebCore::HTMLMediaElement::textTrackAddCues): Ditto.
363         (WebCore::HTMLMediaElement::textTrackRemoveCues): Ditto.
364         (WebCore::HTMLMediaElement::textTrackAddCue): Ditto.
365         (WebCore::HTMLMediaElement::textTrackRemoveCue): Ditto.
366         (WebCore::HTMLMediaElement::mediaPlayerDidAddAudioTrack): Pass references.
367         (WebCore::HTMLMediaElement::mediaPlayerDidAddTextTrack): Ditto.
368         (WebCore::HTMLMediaElement::mediaPlayerDidAddVideoTrack): Ditto.
369         (WebCore::HTMLMediaElement::removeTextTrack): Ditto.
370         (WebCore::HTMLMediaElement::forgetResourceSpecificTracks): Ditto.
371         (WebCore::HTMLMediaElement::setController): Take a RefPtr&& instead of PassRefPtr.
372         * html/HTMLMediaElement.h: Updated for above changes.
373
374         * html/HTMLObjectElement.cpp:
375         (WebCore::HTMLObjectElement::virtualForm): Deleted.
376         * html/HTMLObjectElement.h: Made the form function inline and final, which
377         achieves the same thing we did before with using, but without requiring the
378         separate virtualForm function, now deleted.
379
380         * html/HTMLOptionElement.cpp:
381         (WebCore::HTMLOptionElement::collectOptionInnerText): Use isScriptElement
382         instead of toScriptElementIfPossible.
383
384         * html/HTMLPlugInElement.cpp:
385         (WebCore::HTMLPlugInElement::bindingsInstance): Renamed from getInstance and
386         changed the return type to a raw pointer.
387         * html/HTMLPlugInElement.h: Updated for the above changes. Also changed the
388         updateSnapshot function to take a raw pointer instead of a PassRefPtr.
389
390         * html/HTMLPlugInImageElement.cpp:
391         (WebCore::HTMLPlugInImageElement::createElementRenderer): Pass a pointer
392         to updateSnapshot.
393         (WebCore::HTMLPlugInImageElement::updateSnapshot): Updated to take a raw
394         pointer instead of a PassRefPtr.
395         * html/HTMLPlugInImageElement.h: Updated for above changes.
396
397         * html/HTMLScriptElement.h: Added using to resolve the ambiguity with the
398         ref/deref from HTMLElement and from ScriptElement.
399
400         * html/HTMLTextFormControlElement.cpp:
401         (WebCore::HTMLTextFormControlElement::selection): Return a RefPtr instead
402         of a PassRefPtr.
403         * html/HTMLTextFormControlElement.h: Updated for above changes.
404
405         * html/HTMLTrackElement.cpp:
406         (WebCore::HTMLTrackElement::textTrackKindChanged): Take a reference.
407         (WebCore::HTMLTrackElement::textTrackModeChanged): Ditto.
408         (WebCore::HTMLTrackElement::textTrackAddCues): Ditto.
409         (WebCore::HTMLTrackElement::textTrackRemoveCues): Ditto.
410         (WebCore::HTMLTrackElement::textTrackAddCue): Ditto.
411         (WebCore::HTMLTrackElement::textTrackRemoveCue): Ditto.
412         * html/HTMLTrackElement.h: Updated for above changes.
413
414         * html/InputType.cpp:
415         (WebCore::InputType::formForSubmission): Deleted.
416         (WebCore::InputType::setFiles): Take a RefPtr&& instead of a PassRefPtr.
417         * html/InputType.h: Updated for above changes.
418
419         * html/PluginDocument.cpp:
420         (WebCore::PluginDocumentParser::createDocumentStructure): Pass a reference.
421         (WebCore::PluginDocument::setPluginElement): Take a reference rather than
422         a PassRefPtr.
423         * html/PluginDocument.h: Updated for above changes.
424
425         * html/canvas/CanvasRenderingContext2D.cpp:
426         (WebCore::CanvasRenderingContext2D::setStrokeStyle): Pass a reference.
427         (WebCore::CanvasRenderingContext2D::setFillStyle): Ditto.
428         (WebCore::CanvasRenderingContext2D::drawTextInternal): Ditto.
429
430         * html/canvas/CanvasStyle.cpp:
431         (WebCore::CanvasStyle::CanvasStyle): Rewrite all constructors to use the
432         m_style variant instead of separate m_type and other data members. Also
433         change from PassRefPtr to a reference.
434         (WebCore::CanvasStyle::createFromString): Update to use the variant.
435         (WebCore::CanvasStyle::createFromStringWithOverrideAlpha): Ditto.
436         (WebCore::CanvasStyle::isEquivalentColor): Ditto.
437         (WebCore::CanvasStyle::isEquivalentRGBA): Ditto.
438         (WebCore::CanvasStyle::isEquivalentCMYKA): Ditto.
439         (WebCore::CanvasStyle::CanvasStyle): Deleted copy constructor; the compiler
440         can now generate a correct copy or move constructor.
441         (WebCore::CanvasStyle::~CanvasStyle): Deleted. Compiler generates this
442         properly now without help from us.
443         (WebCore::CanvasStyle::operator=): Deleted. The compiler can now generate
444         a correct copy of move assignment operator.
445         (WebCore::CanvasStyle::applyStrokeColor): Updated to take a reference and
446         use the variant.
447         (WebCore::CanvasStyle::applyFillColor): Ditto.
448
449         * html/canvas/CanvasStyle.h: Redid this class to use a variant instead of
450         a type enumeration and a union.
451
452         * html/canvas/OESVertexArrayObject.cpp:
453         (WebCore::OESVertexArrayObject::createVertexArrayOES): Updated use of enum
454         since it's now an enum class.
455
456         * html/canvas/WebGL2RenderingContext.cpp:
457         (WebCore::WebGL2RenderingContext::WebGL2RenderingContext): Use Ref&& instead of
458         RefPtr&& for the GraphicsContext3D.
459         (WebCore::WebGL2RenderingContext::initializeVertexArrayObjects): Updated enum
460         and also use references.
461         (WebCore::WebGL2RenderingContext::getInternalformatParameter): Use nullptr to
462         return null rather than the old idiom (default-constructed WebGLGetInfo).
463         (WebCore::WebGL2RenderingContext::texStorage2D): Ditto.
464         (WebCore::WebGL2RenderingContext::getQueryParameter): Ditto.
465         (WebCore::WebGL2RenderingContext::getSamplerParameter): Ditto.
466         (WebCore::WebGL2RenderingContext::getSyncParameter): Ditto.
467         (WebCore::WebGL2RenderingContext::getIndexedParameter): Ditto.
468         (WebCore::WebGL2RenderingContext::getActiveUniformBlockParameter): Ditto.
469         (WebCore::WebGL2RenderingContext::getActiveUniformBlockName): Ditto.
470         (WebCore::WebGL2RenderingContext::createVertexArray): Updated enum and also
471         use reference.
472         (WebCore::WebGL2RenderingContext::getExtension): Rearranged logic in three ways:
473         (1) Moved checks for whether an extension is supported inside the case for that
474         extension, rather than combining the extension name check with the extensions
475         enabled check. (2) Used the new enableSupportedExtension function to simplify
476         many of the checks to avoid repeating the extension name twice. (3) Changed the
477         idiom so we set the pointers to nullptr explicitly, preparing for a future where
478         we might make the extension pointers use std::optional so we can cache a negative
479         for each extension too, not just a positive result.
480         (WebCore::WebGL2RenderingContext::getSupportedExtensions): Use ASCIILiteral.
481         (WebCore::WebGL2RenderingContext::getFramebufferAttachmentParameter): Use nullptr
482         as above. For non-null types, return the object without converting, letting the
483         WebGLAny class handle things, except for enumerations, which we need to explicitly
484         static_cast to an integral type, and things that will be stored in the variant in
485         a RefPtr, where we use makeRefPtr.
486         (WebCore::WebGL2RenderingContext::validateFramebufferFuncParameters):
487         Simplified and clarified the handling of COLOR_ATTACHMENT.
488         (WebCore::WebGL2RenderingContext::getParameter): Return WebGLAny, same idiom as
489         described above for getFramebufferAttachmentParameter.
490         * html/canvas/WebGL2RenderingContext.h: Updated for above changes.
491
492         * html/canvas/WebGLAny.cpp: Added.
493         (WebCore::toJS): Handles conversion to JavaScript types. This function is based
494         on the existing toJS functions from the two classes that were using WebGLGetInfo.
495         Eventually we can probably just get the bindings to automatically generate this,
496         but there is some work to do to get to that point.
497         * html/canvas/WebGLAny.h: Added. This type, a variant, replaces the WebGLGetInfo
498         class. Also includes the toJS function, which is the real point of this type, since
499         it's about returning a variant mapped appropriately to JavaScript types.
500
501         * html/canvas/WebGLContextGroup.cpp:
502         (WebCore::WebGLContextGroup::getAGraphicsContext3D): Changed to return a reference.
503         Droped unnecessary local variable with a long type name.
504         (WebCore::WebGLContextGroup::addContext): Take a reference.
505         (WebCore::WebGLContextGroup::removeContext): Ditto.
506         (WebCore::WebGLContextGroup::removeObject): Ditto.
507         (WebCore::WebGLContextGroup::addObject): Ditto.
508         (WebCore::WebGLContextGroup::detachAndRemoveAllObjects): Dropped unnecessary
509         local variable with a long type name.
510         * html/canvas/WebGLContextGroup.h: Updated for above changes.
511
512         * html/canvas/WebGLContextObject.cpp:
513         (WebCore::WebGLContextObject::~WebGLContextObject): Pass references.
514         (WebCore::WebGLContextObject::detachContext): Ditto.
515
516         * html/canvas/WebGLGetInfo.cpp: Removed.
517         * html/canvas/WebGLGetInfo.h: Removed.
518
519         * html/canvas/WebGLRenderingContext.cpp:
520         (WebCore::WebGLRenderingContext::WebGLRenderingContext): Take a Ref&& instead
521         of as PassRefPtr.
522         (WebCore::WebGLRenderingContext::initializeVertexArrayObjects): Updated enum
523         and also use references.
524         (WebCore::WebGLRenderingContext::getExtension): Rearranged logic in three ways:
525         (1) Moved checks for whether an extension is supported inside the case for that
526         extension, rather than combining the extension name check with the extensions
527         enabled check. (2) Used the new enableSupportedExtension function to simplify
528         many of the checks to avoid repeating the extension name twice. (3) Changed the
529         idiom so we set the pointers to nullptr explicitly, preparing for a future where
530         we might make the extension pointers use std::optional so we can cache a negative
531         for each extension too, not just a positive result.
532         (WebCore::WebGLRenderingContext::getSupportedExtensions): Use ASCIILiteral.
533         (WebCore::WebGLRenderingContext::getFramebufferAttachmentParameter): Use nullptr
534         as above. For non-null types, return the object without converting, letting the
535         WebGLAny class handle things, except for enumerations, which we need to explicitly
536         static_cast to an integral type, and things that will be stored in the variant in
537         a RefPtr, where we use makeRefPtr.
538         (WebCore::WebGLRenderingContext::validateFramebufferFuncParameters):
539         Simplified and clarified the handling of COLOR_ATTACHMENT adding a FIXME about
540         something questionable.
541         (WebCore::WebGLRenderingContext::getParameter): Return WebGLAny, same idiom as
542         described above for getFramebufferAttachmentParameter.
543         * html/canvas/WebGLRenderingContext.h: Updated for above changes.
544
545         * html/canvas/WebGLRenderingContextBase.cpp:
546         (WebCore::WebGLRenderingContextBase::create): Updated to pass references
547         instead of pointers in a couple cases
548         (WebCore::WebGLRenderingContextBase::WebGLRenderingContextBase): Changed graphics
549         context argument type from RefPtr&& to Ref&&. Also moved initialization of scalars
550         from the constructor to the class definition.
551         (WebCore::WebGLRenderingContextBase::~WebGLRenderingContextBase): Pass a reference.
552         (WebCore::WebGLRenderingContextBase::createBuffer): Pass a reference instead of a pointer.
553         (WebCore::WebGLRenderingContextBase::createFramebuffer): Ditto.
554         (WebCore::WebGLRenderingContextBase::createTexture): Ditto.
555         (WebCore::WebGLRenderingContextBase::createProgram): Ditto.
556         (WebCore::WebGLRenderingContextBase::createRenderbuffer): Ditto.
557         (WebCore::WebGLRenderingContextBase::createShader): Ditto.
558         (WebCore::WebGLRenderingContextBase::deleteBuffer): Ditto.
559         (WebCore::WebGLRenderingContextBase::getBufferParameter): Update to use WebGLAny.
560         (WebCore::WebGLRenderingContextBase::getProgramParameter): Ditto.
561         (WebCore::WebGLRenderingContextBase::getRenderbufferParameter): Ditto.
562         (WebCore::WebGLRenderingContextBase::getShaderParameter): Ditto.
563         (WebCore::WebGLRenderingContextBase::getTexParameter): Ditto.
564         (WebCore::WebGLRenderingContextBase::getUniform): Ditto.
565         (WebCore::WebGLRenderingContextBase::getVertexAttrib): Ditto.
566         (WebCore::WebGLRenderingContextBase::getVertexAttribOffset): Removed unnneed
567         type casts.
568         (WebCore::WebGLRenderingContextBase::vertexAttribPointer): Pass a reference.
569         (WebCore::WebGLRenderingContextBase::removeSharedObject): Take a reference.
570         (WebCore::WebGLRenderingContextBase::addSharedObject): Ditto.
571         (WebCore::WebGLRenderingContextBase::removeContextObject): Ditto.
572         (WebCore::WebGLRenderingContextBase::addContextObject): Ditto.
573         (WebCore::WebGLRenderingContextBase::getBooleanParameter): Changed return type;
574         connversion to WebGLAny can happen at the point of use.
575         (WebCore::WebGLRenderingContextBase::getBooleanArrayParameter): Ditto.
576         (WebCore::WebGLRenderingContextBase::getFloatParameter): Ditto.
577         (WebCore::WebGLRenderingContextBase::getIntParameter): Ditto.
578         (WebCore::WebGLRenderingContextBase::getUnsignedIntParameter): Ditto.
579         (WebCore::WebGLRenderingContextBase::getInt64Parameter): Ditto.
580         (WebCore::WebGLRenderingContextBase::getWebGLFloatArrayParameter): Ditto.
581         (WebCore::WebGLRenderingContextBase::getWebGLIntArrayParameter): Ditto.
582         (WebCore::WebGLRenderingContextBase::validateBufferDataParameters): Use
583         optional to simplify logic and get rid of a boolean.
584         (WebCore::WebGLRenderingContextBase::enableSupportedExtension): Added.
585         Helper used by the getExtension functions.
586         * html/canvas/WebGLRenderingContextBase.h: Updated for the above changes.
587         Also changed setBoundVertexArrayObject to take a raw pointer instead of
588         as PassRefPtr.
589
590         * html/canvas/WebGLSharedObject.cpp:
591         (WebCore::WebGLSharedObject::~WebGLSharedObject): Pass a reference.
592         (WebCore::WebGLSharedObject::detachContextGroup): Ditto.
593         (WebCore::WebGLSharedObject::getAGraphicsContext3D): Updated since the
594         underlying getAGraphicsContext3D function now returns a reference.
595
596         * html/canvas/WebGLSharedObject.h: Removed many unused "is" virtual functions.
597         * html/canvas/WebGLTransformFeedback.h: Ditto.
598
599         * html/canvas/WebGLVertexArrayObject.cpp:
600         (WebCore::WebGLVertexArrayObject::create): Updated for new type enumeration.
601         (WebCore::WebGLVertexArrayObject::WebGLVertexArrayObject): Ditto.
602         (WebCore::WebGLVertexArrayObject::deleteObjectImpl): Ditto.
603         * html/canvas/WebGLVertexArrayObject.h: Updated for above changes.
604
605         * html/canvas/WebGLVertexArrayObjectBase.cpp:
606         (WebCore::WebGLVertexArrayObjectBase::WebGLVertexArrayObjectBase): Updated for new
607         type enumeration and moved initialization to class definition.
608         (WebCore::WebGLVertexArrayObjectBase::setElementArrayBuffer): Changed argument to
609         raw pointer instead of PassRefPtr.
610         (WebCore::WebGLVertexArrayObjectBase::setVertexAttribState): Changed argument to
611         reference instead of PassRefPtr.
612         (WebCore::WebGLVertexArrayObjectBase::unbindBuffer): Changed arugment type to
613         reference instead of PassRefPtr.
614         (WebCore::WebGLVertexArrayObjectBase::setVertexAttribDivisor): Removed unneeded
615         local variable.
616         * html/canvas/WebGLVertexArrayObjectBase.h: Updated for above changes.
617         Replaced VAOType with Type. Used class member initialization.
618
619         * html/canvas/WebGLVertexArrayObjectOES.cpp:
620         (WebCore::WebGLVertexArrayObjectOES::create): Updated for new type enumeration.
621         (WebCore::WebGLVertexArrayObjectOES::WebGLVertexArrayObjectOES): Ditto.
622         (WebCore::WebGLVertexArrayObjectOES::~WebGLVertexArrayObjectOES) Ditto.:
623         (WebCore::WebGLVertexArrayObjectOES::deleteObjectImpl): Ditto.
624         * html/canvas/WebGLVertexArrayObjectOES.h: Updated for above changes.
625
626         * html/forms/FileIconLoader.cpp:
627         (WebCore::FileIconLoader::iconLoaded): Renamed from notifyFinished. Also changed
628         the name of the function this calls to iconLoaded. Changed the arguemnt to
629         RefPtr&& instead of PassRefPtr.
630         * html/forms/FileIconLoader.h: Updated for above changes.
631
632         * html/parser/HTMLConstructionSite.cpp:
633         (WebCore::HTMLConstructionSite::attachLater): Use isScriptElement instead of
634         toScriptElementIfPossible.
635         (WebCore::HTMLConstructionSite::insertForeignElement): Ditto.
636
637         * html/parser/HTMLDocumentParser.cpp:
638         (WebCore::HTMLDocumentParser::runScriptsForPausedTreeBuilder): Pass script
639         element as a Ref rather than RefPtr.
640         (WebCore::HTMLDocumentParser::watchForLoad): Pass a reference instead of a pointer.
641
642         * html/parser/HTMLScriptRunner.cpp:
643         (WebCore::HTMLScriptRunner::executeParsingBlockingScript): Deleted. Moved the code
644         into the single call site, execute ParsingBlockingScripts.
645         (WebCore::HTMLScriptRunner::executePendingScriptAndDispatchEvent): Changed argument
646         type to a reference from a RefPtr; this funtion was not taking ownership. Also remove
647         call to toScriptElementIfPossible,
648         since pending scripts now contains script elements already.
649         (WebCore::HTMLScriptRunner::execute): Changed argument type to Ref<ScriptElement>&&
650         from PassRefPtr<Element>.
651         (WebCore::HTMLScriptRunner::executeParsingBlockingScripts): Moved code here from
652         executeParsingBlockingScript. Also pass a reference.
653         (WebCore::HTMLScriptRunner::executeScriptsWaitingForParsing): Pass a reference.
654         (WebCore::requestPendingScript): Changed argument type to ScriptElement& from
655         Element*.
656         (WebCore::HTMLScriptRunner::requestParsingBlockingScript): Ditto.
657         (WebCore::HTMLScriptRunner::requestDeferredScript): Ditto.
658         (WebCore::HTMLScriptRunner::runScript): Ditto.
659         * html/parser/HTMLScriptRunner.h: Updated for above changes.
660
661         * html/parser/HTMLTreeBuilder.cpp:
662         (WebCore::HTMLTreeBuilder::takeScriptToProcess): Changed return type from
663         RefPtr<Element> to RefPtr<ScriptElement>.
664         (WebCore::HTMLTreeBuilder::processEndTag): Downcast the script element to
665         HTMLScriptElement so we can store it as a ScriptElement.
666         (WebCore::HTMLTreeBuilder::processTokenInForeignContent): Downcast the script
667         element to SVGScriptElement so we can store it as a script element.
668         * html/parser/HTMLTreeBuilder.h: Updated for above changes. Changed the type
669         of m_scriptToProcess to RefPtr<ScriptElement>.
670
671         * html/parser/TextDocumentParser.cpp: Added now-needed include.
672
673         * html/parser/XSSAuditorDelegate.cpp:
674         (WebCore::XSSAuditorDelegate::generateViolationReport): Changed return type
675         to Ref from PassRefPtr.
676         * html/parser/XSSAuditorDelegate.h: Updated for above.
677
678         * html/track/AudioTrack.cpp:
679         (WebCore::AudioTrack::AudioTrack): Take references.
680         (WebCore::AudioTrack::setPrivate): Ditto.
681         (WebCore::AudioTrack::setEnabled): Removed redundant code to do what the
682         private setEnabled function is already going to do.
683         (WebCore::AudioTrack::inbandTrackIndex): Removed assertion since m_private
684         is now a Ref rather than RefPtr.
685         (WebCore::AudioTrack::enabledChanged): Added an early exit so we will only
686         call audioTrackEnabledChanged if m_enabled is actually changing. Also removed
687         the unneeded track private argument.
688         (WebCore::AudioTrack::idChanged): Ditto.
689         (WebCore::AudioTrack::labelChanged): Ditto.
690         (WebCore::AudioTrack::languageChanged): Ditto.
691         (WebCore::AudioTrack::willRemove): Ditto.
692         * html/track/AudioTrack.h: Updated for above changes.
693
694         * html/track/InbandDataTextTrack.cpp:
695         (WebCore::InbandDataTextTrack::addDataCue): Removed inband text track private
696         argument. Use contains instead of find/end.
697         (WebCore::InbandDataTextTrack::updateDataCue): Ditto. Use get instead of find/end.
698         (WebCore::InbandDataTextTrack::removeDataCue): Ditto.
699         * html/track/InbandDataTextTrack.h: Updated for above changes.
700
701         * html/track/InbandGenericTextTrack.cpp:
702         (WebCore::InbandGenericTextTrack::InbandGenericTextTrack): Take references.
703         (WebCore::InbandGenericTextTrack::create): Ditto.
704         (WebCore::InbandGenericTextTrack::updateCueFromCueData): Ditto.
705         (WebCore::InbandGenericTextTrack::addGenericCue): Ditto. Also removed unused
706         track private argument.
707         (WebCore::InbandGenericTextTrack::updateGenericCue): Ditto.
708         (WebCore::InbandGenericTextTrack::removeGenericCue): Ditto.
709         (WebCore::InbandGenericTextTrack::parseWebVTTCueData): Ditto.
710         (WebCore::InbandGenericTextTrack::parseWebVTTFileHeader): Ditto.
711         (WebCore::InbandGenericTextTrack::newRegionsParsed): Pass a reference.
712         * html/track/InbandGenericTextTrack.h: Updated for above changes.
713
714         * html/track/InbandTextTrack.cpp:
715         (WebCore::InbandTextTrack::create): Return a Ref instead of a PassRefPtr. Take
716         references.
717         (WebCore::InbandTextTrack::InbandTextTrack): Ditto.
718         (WebCore::InbandTextTrack::setPrivate): Take a reference instead of a PassRefPtr.
719         (WebCore::InbandTextTrack::isClosedCaptions): Removed check for null since m_private
720         is now a Ref and so never null.
721         (WebCore::InbandTextTrack::isSDH): Ditto.
722         (WebCore::InbandTextTrack::containsOnlyForcedSubtitles): Ditto.
723         (WebCore::InbandTextTrack::isMainProgramContent): Ditto.
724         (WebCore::InbandTextTrack::isEasyToRead): Ditto.
725         (WebCore::InbandTextTrack::inbandTrackIndex): Ditto.
726         (WebCore::InbandTextTrack::inBandMetadataTrackDispatchType): Ditto.
727         (WebCore::InbandTextTrack::idChanged): Removed unneeded track private argument.
728         (WebCore::InbandTextTrack::labelChanged): Ditto.
729         (WebCore::InbandTextTrack::languageChanged): Ditto.
730         (WebCore::InbandTextTrack::willRemove): Ditto.
731         (WebCore::InbandTextTrack::updateKindFromPrivate): Improved switch statement
732         by removing default so we get a warning if we forget to handle a kind value.
733         (WebCore::InbandTextTrack::startTimeVariance): Removed check for null.
734         * html/track/InbandTextTrack.h: Updated for above changes. Changed m_private from
735         a RefPtr to a Ref.
736
737         * html/track/InbandWebVTTTextTrack.cpp:
738         (WebCore::InbandWebVTTTextTrack::InbandWebVTTTextTrack): Take references.
739         (WebCore::InbandWebVTTTextTrack::create): Ditto.
740         (WebCore::InbandWebVTTTextTrack::parseWebVTTCueData): Removed unneeded track
741         private arguemnt.
742         (WebCore::InbandWebVTTTextTrack::newRegionsParsed): Pass a reference.
743         * html/track/InbandWebVTTTextTrack.h: Updated for above changes.
744
745         * html/track/LoadableTextTrack.cpp:
746         (WebCore::LoadableTextTrack::newCuesAvailable): Pass references.
747         (WebCore::LoadableTextTrack::newRegionsAvailable): Ditto.
748
749         * html/track/TextTrack.cpp:
750         (WebCore::TextTrack::~TextTrack): Use references.
751         (WebCore::TextTrack::setKind): Ditto.
752         (WebCore::TextTrack::setMode): Ditto.
753         (WebCore::TextTrack::removeAllCues): Ditto.
754         (WebCore::TextTrack::activeCues): Ditto.
755         (WebCore::TextTrack::addCue): Ditto.
756         (WebCore::TextTrack::removeCue): Removed unneeded code to handle a cue
757         that points to a track but is not in that track. Added a call to
758         setIsActive(false) here instead of having the remove function do it.
759         (WebCore::TextTrack::addRegion): Use references.
760         (WebCore::TextTrack::removeRegion): Removed unneeded code to handle a
761         region that points to a track but is not in that track.
762         (WebCore::TextTrack::cueWillChange): Use references.
763         (WebCore::TextTrack::cueDidChange): Ditto.
764         (WebCore::TextTrack::setLanguage): Ditto.
765         * html/track/TextTrack.h: Updated for above changes.
766
767         * html/track/TextTrackCue.cpp:
768         (WebCore::TextTrackCue::TextTrackCue): Initialized the data members
769         in the class definition.
770         (WebCore::TextTrackCue::cueIndex): Deleted.
771         (WebCore::TextTrackCue::invalidateCueIndex): Deleted.
772         * html/track/TextTrackCue.h: Updated for the above. Removed m_cueIndex,
773         because it is not a good design to store these and try to keep them up
774         to date.
775
776         * html/track/TextTrackCueList.cpp:
777         (WebCore::compareCues): Added. Helper for sorting and checking sorting.
778         (WebCore::TextTrackCueList::TextTrackCueList): Deleted. Let the compiler
779         generate this.
780         (WebCore::TextTrackCueList::length): Moved to header.
781         (WebCore::TextTrackCueList::cueIndex): Renamed from getCueIndex.
782         Changed return type to unsigned rather than unsigned long.
783         (WebCore::TextTrackCueList::item): Updated for name change.
784         (WebCore::TextTrackCueList::getCueById): Ditto.
785         (WebCore::TextTrackCueList::activeCues): Build the vector directly
786         rather than wastefully adding with TextTrackCueList::add, which will
787         try to sort.
788         (WebCore::TextTrackCueList::add): Take a Ref&& instead of a PassRefPtr.
789         Also, keep sorted using std::upper_bound instead of the recursive
790         binary search this code was using before. Also remove the
791         invalidateCueIndexes call since there are no cue indices any more.
792         Also remove the boolean return value since no caller was using it.
793         (WebCore::TextTrackCueList::remove): Take a reference instead of a
794         pointer. Also remove the boolean return value since no caller was using it.
795         (WebCore::TextTrackCueList::contains): Deleted. Was unused.
796         (WebCore::TextTrackCueList::updateCueIndex): Reimplemented using the
797         std::upper_bound and std::rotate operations. The old code that used
798         remove and add was inefficient and also could cause a cue to be deallocated
799         if something else wasn't holding a reference to the cue. Also changed to take
800         a reference.
801         (WebCore::TextTrackCueList::clear): Deleted. Was unused.
802         (WebCore::TextTrackCueList::invalidateCueIndexes): Deleted. No longer
803         needed since we don't store cue indices in the cues any more.
804         * html/track/TextTrackCueList.h: Updated for the above changes.
805
806         * html/track/VTTRegionList.cpp:
807         (WebCore::VTTRegionList::VTTRegionList): Deleted. Let the compiler
808         generate this.
809         (WebCore::VTTRegionList::length): Moved to header.
810         (WebCore::VTTRegionList::item): Updated for name and type changes.
811         (WebCore::VTTRegionList::getRegionById): Ditto.
812         (WebCore::VTTRegionList::add): Changed to take a Ref&& instead of a
813         PassRefPtr.
814         (WebCore::VTTRegionList::remove): Updated.
815         (WebCore::VTTRegionList::clear): Deleted. Was unused.
816         * html/track/VTTRegionList.h: Updated for the above changes.
817         * html/track/VTTRegionList.idl: Made return values nullable to reflect
818         the actual semantic of the code.
819
820         * html/track/VideoTrack.cpp:
821         (WebCore::VideoTrack::VideoTrack): Use references.
822         (WebCore::VideoTrack::setPrivate): Ditto.
823         (WebCore::VideoTrack::setSelected): Ditto.
824         (WebCore::VideoTrack::inbandTrackIndex): Removed assertion since m_private
825         is now a Ref instead of a RefPtr.
826         (WebCore::VideoTrack::selectedChanged): Removed unneeded track private argument.
827         (WebCore::VideoTrack::idChanged): Ditto.
828         (WebCore::VideoTrack::labelChanged): Ditto.
829         (WebCore::VideoTrack::languageChanged): Ditto.
830         (WebCore::VideoTrack::willRemove): Ditto.
831         (WebCore::VideoTrack::setKind): Updated to use reference.
832         (WebCore::VideoTrack::setLanguage): Ditto.
833         * html/track/VideoTrack.h: Updated for the above. Changed derivation to private.
834         Removed unneeded defaultKindKeyword.
835
836         * loader/EmptyClients.h: Updated to use reference.
837
838         * loader/PingLoader.cpp:
839         (WebCore::PingLoader::sendViolationReport): Take a Ref&& instead of RefPtr&&.
840         * loader/PingLoader.h: Updated for above change.
841
842         * page/Chrome.cpp:
843         (WebCore::Chrome::loadIconForFiles): Take a reference.
844         * page/Chrome.h: Updated for above change.
845         * page/ChromeClient.h: Ditto.
846
847         * page/csp/ContentSecurityPolicy.cpp:
848         (WebCore::ContentSecurityPolicy::reportViolation): Use auto.
849
850         * platform/cocoa/WebPlaybackSessionModelMediaElement.mm:
851         (WebPlaybackSessionModelMediaElement::selectAudioMediaOption): Simplified
852         algorithm by removing unneeded direct call to audioTrackEnabledChanged,
853         which will be called by setEnabled and doesn't need to be called again here.
854         (WebPlaybackSessionModelMediaElement::selectLegibleMediaOption): Removed
855         unhelpful assertion and unnneded initialization.
856
857         * platform/graphics/AudioTrackPrivate.h: Removed unnneeed track private
858         argument and initialized data members where they are defined.
859
860         * platform/graphics/InbandTextTrackPrivateClient.h: Use Ref instead of
861         PassRefPtr, initialize data members where they are defined, and removed
862         the unneeded track private arguments from the client functions.
863
864         * platform/graphics/SourceBufferPrivate.h: Fixed functions that were taking
865         AtomicString to take a const& instead. Use Ref&& instead of PassRefPtr.
866
867         * platform/graphics/SourceBufferPrivateClient.h: Removed unneded private pointer
868         arguments from client functions.
869
870         * platform/graphics/TrackPrivateBase.h: Removed unneeded private pointers
871         from client functions.
872         * platform/graphics/VideoTrackPrivate: Ditto.
873
874         * platform/graphics/avfoundation/AudioTrackPrivateAVF.h: Use
875         const AtomicString&.
876
877         * platform/graphics/avfoundation/InbandMetadataTextTrackPrivateAVF.cpp:
878         (WebCore::InbandMetadataTextTrackPrivateAVF::addDataCue): Updated for change to arguments.
879         (WebCore::InbandMetadataTextTrackPrivateAVF::updatePendingCueEndTimes): Ditto.
880         (WebCore::InbandMetadataTextTrackPrivateAVF::flushPartialCues): Ditto.
881         * platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp:
882         (WebCore::InbandTextTrackPrivateAVF::processAttributedStrings): Ditto.
883         (WebCore::InbandTextTrackPrivateAVF::resetCueValues): Ditto.
884         (WebCore::InbandTextTrackPrivateAVF::processNativeSamples): Ditto.
885
886         * platform/graphics/avfoundation/objc/AudioTrackPrivateMediaSourceAVFObjC.cpp:
887         (WebCore::AudioTrackPrivateMediaSourceAVFObjC::AudioTrackPrivateMediaSourceAVFObjC):
888         Moved initialization of data memebrs to where they are defined.
889         (WebCore::AudioTrackPrivateMediaSourceAVFObjC::enabled): Deleted. No longer needed.
890         (WebCore::AudioTrackPrivateMediaSourceAVFObjC::setEnabled): Changed to use the enabled
891         flag from the base class instead of a separate m_enabled in this class.
892         * platform/graphics/avfoundation/objc/AudioTrackPrivateMediaSourceAVFObjC.h:
893         Removed the enabled function and the m_enabled data member.
894
895         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.h: Marked functions
896         final instead of override and updated arguemnts.
897         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
898         (WebCore::SourceBufferPrivateAVFObjC::didParseStreamDataAsAsset): Updated for change
899         to arguments.
900         (WebCore::SourceBufferPrivateAVFObjC::processCodedFrame): Ditto.
901         (WebCore::SourceBufferPrivateAVFObjC::appendCompleted): Ditto.
902         (WebCore::SourceBufferPrivateAVFObjC::hasVideo): Ditto.
903         (WebCore::SourceBufferPrivateAVFObjC::hasAudio): Ditto.
904         (WebCore::SourceBufferPrivateAVFObjC::layerDidReceiveError): Ditto.
905         (WebCore::SourceBufferPrivateAVFObjC::flush): Ditto.
906         (WebCore::SourceBufferPrivateAVFObjC::enqueueSample): Ditto.
907         (WebCore::SourceBufferPrivateAVFObjC::isReadyForMoreSamples): Ditto.
908         (WebCore::SourceBufferPrivateAVFObjC::fastSeekTimeForMediaTime): Ditto.
909         (WebCore::SourceBufferPrivateAVFObjC::seekToTime): Ditto.
910         (WebCore::SourceBufferPrivateAVFObjC::didBecomeReadyForMoreSamples): Ditto.
911         (WebCore::SourceBufferPrivateAVFObjC::notifyClientWhenReadyForMoreSamples): Ditto.
912
913         * platform/graphics/gstreamer/InbandMetadataTextTrackPrivateGStreamer.h: Updated for
914         changes to arguments.
915         * platform/graphics/gstreamer/InbandTextTrackPrivateGStreamer.cpp:
916         (WebCore::InbandTextTrackPrivateGStreamer::notifyTrackOfSample): Ditto.
917         * platform/graphics/gstreamer/TrackPrivateBaseGStreamer.cpp:
918         (WebCore::TrackPrivateBaseGStreamer::notifyTrackOfTagsChanged): Ditto.
919         * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
920         (WebCore::AppendPipeline::appsinkNewSample): Ditto.
921         * platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.cpp:
922         (WebCore::SourceBufferPrivateGStreamer::append): Ditto.
923         (WebCore::SourceBufferPrivateGStreamer::flush): Ditto.
924         (WebCore::SourceBufferPrivateGStreamer::enqueueSample): Ditto.
925         (WebCore::SourceBufferPrivateGStreamer::isReadyForMoreSamples): Ditto.
926         (WebCore::SourceBufferPrivateGStreamer::notifyReadyForMoreSamples): Ditto.
927         (WebCore::SourceBufferPrivateGStreamer::stopAskingForMoreSamples): Ditto.
928         (WebCore::SourceBufferPrivateGStreamer::notifyClientWhenReadyForMoreSamples): Ditto.
929         (WebCore::SourceBufferPrivateGStreamer::didReceiveInitializationSegment): Ditto.
930         (WebCore::SourceBufferPrivateGStreamer::didReceiveSample): Ditto.
931         (WebCore::SourceBufferPrivateGStreamer::didReceiveAllPendingSamples): Ditto.
932         * platform/graphics/gstreamer/mse/SourceBufferPrivateGStreamer.h: Ditto.
933         * platform/mock/mediasource/MockSourceBufferPrivate.cpp:
934         (WebCore::MockSourceBufferPrivate::append): Ditto.
935         (WebCore::MockSourceBufferPrivate::didReceiveInitializationSegment): Ditto.
936         (WebCore::MockSourceBufferPrivate::didReceiveSample): Ditto.
937         (WebCore::MockSourceBufferPrivate::enqueuedSamplesForTrackID): Ditto.
938         (WebCore::MockSourceBufferPrivate::enqueueSample): Ditto.
939         (WebCore::MockSourceBufferPrivate::hasVideo): Ditto.
940         (WebCore::MockSourceBufferPrivate::hasAudio): Ditto.
941         (WebCore::MockSourceBufferPrivate::fastSeekTimeForMediaTime): Ditto.
942         (WebCore::MockSourceBufferPrivate::seekToTime): Ditto.
943         * platform/mock/mediasource/MockSourceBufferPrivate.h: Ditto.
944
945         * rendering/RenderSnapshottedPlugIn.cpp:
946         (WebCore::RenderSnapshottedPlugIn::updateSnapshot): Take raw pointer instead
947         of PassRefPtr.
948         * rendering/RenderSnapshottedPlugIn.h: Updated for above change.
949
950         * svg/SVGScriptElement.h: Added using to resolve the ambiguity with the
951         ref/deref from SVGElement and from ScriptElement.
952
953         * xml/parser/XMLDocumentParser.cpp:
954         (WebCore::XMLDocumentParser::notifyFinished): Updated to simplify since
955         the pending script now has a script element.
956
957         * xml/parser/XMLDocumentParserLibxml2.cpp:
958         (WebCore::XMLDocumentParser::startElementNs): Use isSciprtElement instead
959         of toScriptElementIfPossible.
960         (WebCore::XMLDocumentParser::endElementNs): Ditto. Also use downcastScriptElement.
961
962 2017-01-04  Wenson Hsieh  <wenson_hsieh@apple.com>
963
964         Move editing history scripts to WebCore PrivateHeaders
965         https://bugs.webkit.org/show_bug.cgi?id=166709
966         <rdar://problem/29876612>
967
968         Reviewed by Dan Bernstein.
969
970         Move editing history scripts out of InternalScripts and into Scripts, and update the WebCore Copy Script build
971         phase to copy the editing scripts into PrivateHeaders.
972
973         No new tests, because there should be no behavior change.
974
975         * Scripts/DumpEditingHistory.js: Renamed from Source/WebCore/InternalScripts/DumpEditingHistory.js.
976         * Scripts/EditingHistoryUtil.js: Renamed from Source/WebCore/InternalScripts/EditingHistoryUtil.js.
977         * WebCore.xcodeproj/project.pbxproj:
978
979 2017-01-04  Joseph Pecoraro  <pecoraro@apple.com>
980
981         Web Inspector: forced pseudo classes aren't cleared from inspected page when Inspector closes
982         https://bugs.webkit.org/show_bug.cgi?id=108823
983         <rdar://problem/13143550>
984
985         Reviewed by Timothy Hatcher.
986
987         * inspector/InspectorCSSAgent.h:
988         * inspector/InspectorCSSAgent.cpp:
989         (WebCore::InspectorCSSAgent::documentDetached):
990         Clear the document from all of the different Document sets.
991
992         (WebCore::InspectorCSSAgent::didRemoveDocument): Deleted.
993         Use documentDetached, which is more direct.
994
995         (WebCore::InspectorCSSAgent::forcePseudoState):
996         Update the set of Documents with psuedo element changes. So when we
997         reset forced styles we know which documents to refresh styles.
998
999         (WebCore::InspectorCSSAgent::resetPseudoStates):
1000         Use the list of documents we've already computed.
1001
1002         (WebCore::InspectorCSSAgent::didRemoveDOMNode):
1003         (WebCore::InspectorCSSAgent::didModifyDOMAttr):
1004         Change to take a reference and more data to avoid extra work.
1005
1006         * inspector/InspectorDOMAgent.h:
1007         * inspector/InspectorDOMAgent.cpp:
1008         (WebCore::InspectorDOMAgent::unbind):
1009         Eliminated didRemoveDocument.
1010
1011         (WebCore::InspectorDOMAgent::didModifyDOMAttr):
1012         (WebCore::InspectorDOMAgent::didRemoveDOMAttr):
1013         (WebCore::InspectorDOMAgent::styleAttributeInvalidated):
1014         Pass a references to the DOM listener client, these are never null.
1015
1016 2017-01-04  Myles C. Maxfield  <mmaxfield@apple.com>
1017
1018         Remove runtime flag for variation fonts
1019         https://bugs.webkit.org/show_bug.cgi?id=164251
1020
1021         Reviewed by Dean Jackson.
1022
1023         No new tests because there is no behavior change, but updated the following
1024         tests to stop setting the flag:
1025         - animations/font-variations/font-variation-settings-order.html:
1026         - animations/font-variations/font-variation-settings-unlike.html:
1027         - animations/font-variations/font-variation-settings.html:
1028         - fast/text/variations/duplicate.html:
1029         - fast/text/variations/exist.html:
1030         - fast/text/variations/getComputedStyle.html:
1031         - fast/text/variations/inheritance.html:
1032         - fast/text/variations/order.html:
1033         - fast/text/variations/outofbounds.html:
1034
1035         * css/CSSComputedStyleDeclaration.cpp:
1036         (WebCore::ComputedStyleExtractor::propertyValue):
1037         * css/parser/CSSParser.cpp:
1038         (WebCore::CSSParserContext::CSSParserContext):
1039         (WebCore::operator==):
1040         * css/parser/CSSParserMode.h:
1041         (WebCore::CSSParserContext::completeURL):
1042         (WebCore::CSSParserContextHash::hash):
1043         * css/parser/CSSPropertyParser.cpp:
1044         (WebCore::CSSPropertyParser::parseSingleValue):
1045         * page/Settings.in:
1046         * testing/InternalSettings.cpp:
1047         (WebCore::InternalSettings::Backup::Backup):
1048         (WebCore::InternalSettings::Backup::restoreTo):
1049         (WebCore::InternalSettings::variationFontsEnabled): Deleted.
1050         (WebCore::InternalSettings::setVariationFontsEnabled): Deleted.
1051         * testing/InternalSettings.h:
1052         * testing/InternalSettings.idl:
1053
1054 2017-01-04  Andy Estes  <aestes@apple.com>
1055
1056         [Cocoa] Teach SharedBuffer to return an NSArray of data segments to avoid flattening
1057         https://bugs.webkit.org/show_bug.cgi?id=166696
1058
1059         Reviewed by Tim Horton.
1060
1061         Existing methods of extracting NSData from a SharedBuffer require either merging or copying
1062         data segments. Since data segments are stored in CFDataRefs on Cocoa platforms, it should be
1063         possible to retrieve an NSArray of the segments without having to first flatten to a single
1064         buffer.
1065
1066         This patch implements such a method. This will be used in a follow-on patch, where I will
1067         need to pass SharedBuffer data to QuickLook via an NSArray of NSData.
1068
1069         New API test: SharedBufferTest.createNSDataArray.
1070
1071         * platform/SharedBuffer.h: Declared createNSArrayData(), and exported two functions needed
1072         by the API test.
1073         * platform/cocoa/SharedBufferCocoa.mm:
1074         (WebCore::SharedBuffer::createNSDataArray): Added. Returns m_cfData or a copy of m_fileData
1075         if either exist. Otherwise, adds m_buffer (wrapped in a WebCoreSharedBufferData object) and
1076         the objects in m_dataArray to a NSMutableArray and returns it.
1077
1078 2017-01-04  Ryan Haddad  <ryanhaddad@apple.com>
1079
1080         Unreviewed, rolling out r210296.
1081
1082         This change broke macOS builds.
1083
1084         Reverted changeset:
1085
1086         "Check for the existence of
1087         AVSampleBufferDisplayLayer_Private.h in AVFoundationSPI.h"
1088         https://bugs.webkit.org/show_bug.cgi?id=166691
1089         http://trac.webkit.org/changeset/210296
1090
1091 2017-01-04  Ryan Haddad  <ryanhaddad@apple.com>
1092
1093         Unreviewed, rolling out r210287.
1094
1095         This change caused editing test failures on macOS.
1096
1097         Reverted changeset:
1098
1099         "Support File Promise during drag for macOS."
1100         https://bugs.webkit.org/show_bug.cgi?id=165204
1101         http://trac.webkit.org/changeset/210287
1102
1103 2017-01-04  Jer Noble  <jer.noble@apple.com>
1104
1105         Check for the existence of AVSampleBufferDisplayLayer_Private.h in AVFoundationSPI.h
1106         https://bugs.webkit.org/show_bug.cgi?id=166691
1107
1108         Reviewed by Eric Carlson.
1109
1110         Move the declaration of AVSampleBufferDisplayLayer SPI into AVFoundationSPI.h and key off the presence of the _Private.h header.
1111
1112         Drive-by Fix: also check for the presence of AVSampleBufferRenderSynchronizer.h before re-declaring AVSampleBufferRenderSynchronizer.
1113
1114         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
1115         * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:
1116         * platform/spi/mac/AVFoundationSPI.h:
1117
1118 2017-01-04  Nan Wang  <n_wang@apple.com>
1119
1120         Many new HTML5 input types still exposed as generic AXTextfield
1121         https://bugs.webkit.org/show_bug.cgi?id=109017
1122         <rdar://problem/13658955>
1123
1124         Reviewed by Chris Fleizach.
1125
1126         Provided more detailed role description for input types that
1127         are exposed as standard text fields on the mac.
1128
1129         Changes are covered in modified test expectation.
1130
1131         * English.lproj/Localizable.strings:
1132         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
1133         (-[WebAccessibilityObjectWrapper roleDescription]):
1134         * platform/LocalizedStrings.cpp:
1135         (WebCore::AXDateTimeFieldText):
1136         (WebCore::AXMonthFieldText):
1137         (WebCore::AXNumberFieldText):
1138         (WebCore::AXWeekFieldText):
1139         * platform/LocalizedStrings.h:
1140         * platform/efl/LocalizedStringsEfl.cpp:
1141         (WebCore::AXDateTimeFieldText):
1142         (WebCore::AXMonthFieldText):
1143         (WebCore::AXNumberFieldText):
1144         (WebCore::AXWeekFieldText):
1145         * platform/gtk/LocalizedStringsGtk.cpp:
1146         (WebCore::AXDateTimeFieldText):
1147         (WebCore::AXMonthFieldText):
1148         (WebCore::AXNumberFieldText):
1149         (WebCore::AXWeekFieldText):
1150
1151 2017-01-04  Sam Weinig  <sam@webkit.org>
1152
1153         Remove bindings/generic and distribute its contents appropriately
1154         https://bugs.webkit.org/show_bug.cgi?id=166700
1155
1156         Rubber-stamped by Alex Christensen.
1157
1158         * CMakeLists.txt:
1159         * DerivedSources.make:
1160         * PlatformMac.cmake:
1161         * PlatformWin.cmake:
1162         * WebCore.xcodeproj/project.pbxproj:
1163         * bindings/IDLTypes.h: Copied from Source/WebCore/bindings/generic/IDLTypes.h.
1164         * bindings/generic/ActiveDOMCallback.cpp: Removed.
1165         * bindings/generic/ActiveDOMCallback.h: Removed.
1166         * bindings/generic/IDLTypes.h: Removed.
1167         * bindings/generic/RuntimeEnabledFeatures.cpp: Removed.
1168         * bindings/generic/RuntimeEnabledFeatures.h: Removed.
1169         * dom/ActiveDOMCallback.cpp: Copied from Source/WebCore/bindings/generic/ActiveDOMCallback.cpp.
1170         * dom/ActiveDOMCallback.h: Copied from Source/WebCore/bindings/generic/ActiveDOMCallback.h.
1171         * page/RuntimeEnabledFeatures.cpp: Copied from Source/WebCore/bindings/generic/RuntimeEnabledFeatures.cpp.
1172         * page/RuntimeEnabledFeatures.h: Copied from Source/WebCore/bindings/generic/RuntimeEnabledFeatures.h.
1173         Move files around.
1174
1175 2017-01-04  Sam Weinig  <sam@webkit.org>
1176
1177         Add Exception accessor to ExceptionOr to remove unnecessary releases
1178         https://bugs.webkit.org/show_bug.cgi?id=166692
1179
1180         Reviewed by Alex Christensen.
1181
1182         * Modules/webdatabase/DatabaseManager.cpp:
1183         (WebCore::DatabaseManager::openDatabaseBackend):
1184         Use new exception() function.
1185
1186         * dom/ExceptionOr.h:
1187         (WebCore::ExceptionOr<ReturnType>::exception):
1188         (WebCore::ExceptionOr<void>::exception):
1189         Add exception() function which returns the exception without releasing it.
1190
1191 2016-01-04  Brent Fulgham  <bfulgham@apple.com>
1192
1193         Correct DOMWindow handling during FrameLoader::clear
1194         https://bugs.webkit.org/show_bug.cgi?id=166357
1195         <rdar://problem/29741862>
1196
1197         Reviewed by Andy Estes.
1198
1199         Make sure that we always clean up the DOM window when clearing Window properties, even if the document will
1200         remain in the page cache. Since 'clearWindowShell' is only used in FrameLoader, divide it's beahvior into
1201         two steps:
1202         
1203         1. Rename 'clearWindowShell' to 'clearWIndowShellsNotMatchingDOMWindow' to better describe its function.
1204         Switch to a modern C++ loop. Do not switch to the new DOMWindow here, but detach and clear existing
1205         DOMWindow connections.
1206
1207         2. Add a new method 'setDOMWindowForWindowShell'. Complete switch to the new DOMWindow.
1208
1209         This change allows us to disconnect the old DOMWindow, perform the 'setDocument(nullptr)' operation, and then
1210         connect to the new Window without leaving the loader in an inconsistent state.
1211
1212         * loader/bindings/js/ScriptController.cpp:
1213         (WebCore::clearWindowShellsNotMatchingDOMWindow): Renamed from 'clearWindowShell'
1214         (WebCore::setDOMWindowForWindowShell): Added.
1215         * loader/bindings/js/ScriptController.h:
1216         * loader/FrameLoader.cpp:
1217         (WebCore::FrameLoader::clear): Revise to use the new two-step DOMWindow switch logic.
1218
1219 2017-01-04  Enrica Casucci  <enrica@apple.com>
1220
1221         Support File Promise during drag for macOS.
1222         https://bugs.webkit.org/show_bug.cgi?id=165204
1223         rdar://problem/19595567
1224
1225         Reviewed by Tim Horton.
1226
1227         Adds the support for handling File Promise type during
1228         drag. DragData now has the knowledge of the NSFilesPromisePboardType and
1229         checks for the data type during drag.
1230
1231         * page/mac/DragControllerMac.mm:
1232         (WebCore::DragController::dragOperation):
1233         * platform/DragData.h:
1234         (WebCore::DragData::setFileNames):
1235         (WebCore::DragData::fileNames):
1236         * platform/mac/DragDataMac.mm:
1237         (WebCore::DragData::containsFiles):
1238         (WebCore::DragData::numberOfFiles):
1239         (WebCore::DragData::asFilenames):
1240         (WebCore::DragData::containsCompatibleContent):
1241         (WebCore::DragData::containsPromise):
1242         (WebCore::DragData::asURL):
1243
1244 2017-01-04  Chris Dumez  <cdumez@apple.com>
1245
1246         Assertion hit on redfin.com: ASSERTION FAILED: collection->length() > 1
1247         https://bugs.webkit.org/show_bug.cgi?id=166687
1248         <rdar://problem/29865854>
1249
1250         Reviewed by Darin Adler.
1251
1252         We were mistakenly calling Document::addWindowNamedItem() / Document::removeWindowNamedItem()
1253         for elements in Shadow DOMs. As a result, the windowNamedItem DocumentOrderedMap would
1254         contain elements in shadow DOMs. This would cause the assertion to be hit in window's
1255         named property getter because of the length mismatch between the windowNamedItem
1256         DocumentOrderedMap and the WindowNameCollection.
1257
1258         Tests: fast/shadow-dom/document-named-property.html
1259                fast/shadow-dom/window-named-property.html
1260
1261         * dom/Element.cpp:
1262         (WebCore::Element::updateNameForDocument):
1263         (WebCore::Element::updateIdForDocument):
1264         * html/HTMLImageElement.cpp:
1265         (WebCore::HTMLImageElement::parseAttribute):
1266         * html/HTMLObjectElement.cpp:
1267         (WebCore::HTMLObjectElement::updateDocNamedItem):
1268
1269 2017-01-04  John Wilander  <wilander@apple.com>
1270
1271         Validate the BCP47-ness of the language string passed to TrackBase::setLanguage()
1272         https://bugs.webkit.org/show_bug.cgi?id=123926
1273
1274         Reviewed by Jer Noble.
1275
1276         Test: media/media-source/only-bcp47-language-tags-accepted-as-valid.html
1277
1278         * html/HTMLMediaElement.cpp:
1279         (WebCore::HTMLMediaElement::configureTextTrackGroup):
1280             Log message now includes the valid BCP 47 language too.
1281         (WebCore::HTMLMediaElement::setSelectedTextTrack):
1282             Now sets preferred language to the valid BCP 47 language.
1283         * html/track/TextTrack.cpp:
1284         (WebCore::TextTrack::setLanguage):
1285             Removed fixme and aligned comments with new behavior.
1286         * html/track/TrackBase.cpp:
1287         (WebCore::TrackBase::TrackBase):
1288             Initializes m_validBCP47Language with language parameter.
1289         (WebCore::isValidBCP47LanguageTag):
1290             New convenience function.
1291         (WebCore::TrackBase::setLanguage):
1292             Sets m_validBCP47Language if the incoming tag is valid.
1293             Produces a console warning if the tag is invalid.
1294             The member m_language is set to the incoming tag regardless.
1295         (WebCore::TrackBase::validBCP47Language):
1296             New getter for valid language tag. To be used internally.
1297         * html/track/TrackBase.h:
1298             New AtomicString member m_validBCP47Language.
1299         (WebCore::TrackBase::setLanguage): Deleted.
1300         * html/track/VideoTrack.cpp:
1301         (WebCore::VideoTrack::setLanguage):
1302             Removed fixme and aligned comments with new behavior.
1303         * page/CaptionUserPreferences.cpp:
1304         (WebCore::trackDisplayName):
1305             Now uses the getter for BCP 47 language.
1306         (WebCore::CaptionUserPreferences::textTrackLanguageSelectionScore):
1307             Now uses the getter for BCP 47 language.
1308         * page/CaptionUserPreferencesMediaAF.cpp:
1309         (WebCore::buildDisplayStringForTrackBase):
1310             Now uses the getter for BCP 47 language.
1311         (WebCore::CaptionUserPreferencesMediaAF::textTrackSelectionScore):
1312             Now uses the getter for BCP 47 language.
1313         (WebCore::textTrackCompare):
1314             Now uses the getter for BCP 47 language.
1315         (WebCore::CaptionUserPreferencesMediaAF::sortedTrackListForMenu):
1316             Now uses the getter for BCP 47 language.
1317
1318 2017-01-04  Joseph Pecoraro  <pecoraro@apple.com>
1319
1320         Web Inspector: Cross Origin importScripts() scripts lack source URL, causes issues with Inspector showing Resource
1321         https://bugs.webkit.org/show_bug.cgi?id=165569
1322         <rdar://problem/29607569>
1323
1324         Reviewed by Youenn Fablet.
1325
1326         Test: http/tests/inspector/worker/blob-script-with-cross-domain-imported-scripts.html
1327
1328         * Modules/fetch/FetchLoader.cpp:
1329         (WebCore::FetchLoader::start):
1330         * loader/DocumentThreadableLoader.cpp:
1331         (WebCore::DocumentThreadableLoader::didReceiveResponse):
1332         * loader/ThreadableLoader.cpp:
1333         (WebCore::ThreadableLoaderOptions::ThreadableLoaderOptions):
1334         * loader/ThreadableLoader.h:
1335         * loader/WorkerThreadableLoader.cpp:
1336         (WebCore::LoaderTaskOptions::LoaderTaskOptions):
1337         Add a new ThreadableLoader option to avoid filtering the response.
1338
1339         * workers/WorkerScriptLoader.cpp:
1340         (WebCore::WorkerScriptLoader::loadSynchronously):
1341         (WebCore::WorkerScriptLoader::loadAsynchronously):
1342         Disable filtering of the response. This is an internal load, we
1343         don't want to filter data that would be valuable later.
1344
1345 2017-01-03  Sam Weinig  <sam@webkit.org>
1346
1347         Remove final custom binding from IDBRequest
1348         https://bugs.webkit.org/show_bug.cgi?id=166671
1349
1350         Reviewed by Alex Christensen.
1351
1352         * CMakeLists.txt:
1353         * WebCore.xcodeproj/project.pbxproj:
1354         Remove JSIDBRequestCustom.cpp
1355
1356         * bindings/js/JSIDBRequestCustom.cpp: Removed.
1357
1358         * Modules/indexeddb/IDBRequest.cpp:
1359         (WebCore::IDBRequest::IDBRequest):
1360         (WebCore::IDBRequest::~IDBRequest):
1361         (WebCore::IDBRequest::result):
1362         (WebCore::IDBRequest::setSource):
1363         (WebCore::IDBRequest::sourceObjectStoreIdentifier):
1364         (WebCore::IDBRequest::sourceIndexIdentifier):
1365         (WebCore::IDBRequest::requestedIndexRecordType):
1366         (WebCore::IDBRequest::setResult):
1367         (WebCore::IDBRequest::setResultToStructuredClone):
1368         (WebCore::IDBRequest::setResultToUndefined):
1369         (WebCore::IDBRequest::resultCursor):
1370         (WebCore::IDBRequest::willIterateCursor):
1371         (WebCore::IDBRequest::didOpenOrIterateCursor):
1372         (WebCore::IDBRequest::source): Deleted.
1373         (WebCore::IDBRequest::clearResult): Deleted.
1374         * Modules/indexeddb/IDBRequest.h:
1375         (WebCore::IDBRequest::source):
1376         (WebCore::IDBRequest::cursorResult): Deleted.
1377         (WebCore::IDBRequest::databaseResult): Deleted.
1378         (WebCore::IDBRequest::scriptResult): Deleted.
1379         Replace multiple member variables with Variants for source and result. Add a result
1380         member function that properly sets an exception if not "done".
1381
1382         * Modules/indexeddb/IDBRequest.idl:
1383         Remove CustomGetter annotation and add type.
1384
1385         * bindings/generic/IDLTypes.h:
1386         (WebCore::IDLAny::nullValue):
1387         (WebCore::IDLAny::isNullValue):
1388         (WebCore::IDLAny::extractValueFromNullable):
1389         * bindings/js/JSDOMConvert.h:
1390         (WebCore::Converter<IDLAny>::convert):
1391         Flesh out IDLAny to be implemented as a Strong<Unknown> when used in aggregate types,
1392         but still work with JSValue when passing as a parameter.
1393
1394         * inspector/InspectorIndexedDBAgent.cpp:
1395         Update for new return value of IDBRequest::result().
1396
1397 2017-01-04  Tim Horton  <timothy_horton@apple.com>
1398
1399         Provide a setting for clients to always prefer low-power WebGL
1400         https://bugs.webkit.org/show_bug.cgi?id=166675
1401         <rdar://problem/29834093>
1402
1403         Reviewed by Dan Bernstein.
1404
1405         No new tests; as noted in r204664, we don't know how to reliably test
1406         automatic graphics switching. One could use the manual test introduced
1407         in that commit; after this commit, with the setting switched on, on a
1408         dual-GPU machine that is actively using integrated graphics, that test
1409         should return the same result for both contexts.
1410
1411         * page/Settings.in:
1412         Add a setting to prefer low-power WebGL.
1413
1414         * html/canvas/WebGLRenderingContextBase.cpp:
1415         (WebCore::WebGLRenderingContextBase::create):
1416         If said setting is enabled, set preferLowPowerToHighPerformance.
1417
1418 2017-01-03  Ryosuke Niwa  <rniwa@webkit.org>
1419
1420         label element with tabindex >= 0 is not focusable
1421         https://bugs.webkit.org/show_bug.cgi?id=102780
1422         <rdar://problem/29796608>
1423
1424         Reviewed by Darin Adler.
1425
1426         Fixed the bug by removing the override for HTMLLabelElement::isFocusable which always returned false.
1427
1428         This is a behavior from r5532 but it doesn't match the latest HTML specification or that of Chrome
1429         and Firefox.
1430
1431         Also fixed an existing bug in HTMLLabelElement::focus and HTMLLegendElement::focus which focused
1432         the associated form control when there is one even if the element itself is focusable. Without this fix,
1433         traversing from control with shift+tab would break since focusing the label would move the focus back
1434         to the input element inside the label element.
1435
1436         Finally, fixed a bug in HTMLLegendElement::focus that we can call inFocus without updating layout first.
1437
1438         The fix was inspired by https://chromium.googlesource.com/chromium/src/+/085ad8697b1be50c4f93e296797a25a43a79bcfb
1439
1440         Test: fast/events/focus-label-legend-elements-with-tabindex.html
1441
1442         * html/HTMLLabelElement.cpp:
1443         (WebCore::HTMLLabelElement::focus):
1444         (WebCore::HTMLLabelElement::isFocusable): Deleted.
1445         * html/HTMLLabelElement.h:
1446         * html/HTMLLegendElement.cpp:
1447         (WebCore::HTMLLegendElement::focus):
1448
1449 2017-01-03  Tim Horton  <timothy_horton@apple.com>
1450
1451         NSSpellChecker's recordResponse isn't called for unseen automatic corrections
1452         https://bugs.webkit.org/show_bug.cgi?id=166450
1453         <rdar://problem/29447824>
1454
1455         Reviewed by Darin Adler.
1456
1457         Test: editing/mac/spelling/accept-unseen-candidate-records-acceptance.html
1458
1459         * editing/AlternativeTextController.cpp:
1460         (WebCore::AlternativeTextController::recordAutocorrectionResponse):
1461         (WebCore::AlternativeTextController::recordAutocorrectionResponseReversed): Deleted.
1462         * editing/AlternativeTextController.h:
1463         Add recordAutocorrectionResponse, which takes a AutocorrectionResponseType, instead of having
1464         a function specifically for reverted autocorrections. Also, get rid of the unnecessary indirection
1465         of the private overload of recordAutocorrectionResponseReversed, since there's only one caller.
1466
1467         * editing/Editor.cpp:
1468         (WebCore::Editor::markAndReplaceFor):
1469         Call recordAutocorrectionResponse with Accepted when performing an auto-autocorrection.
1470
1471         (WebCore::Editor::changeBackToReplacedString):
1472         Adopt recordAutocorrectionResponse.
1473
1474         * page/AlternativeTextClient.h:
1475         Add an "AutocorrectionAccepted" response type.
1476
1477 2017-01-03  Nan Wang  <n_wang@apple.com>
1478
1479         AX: Focus should jump into modal dialogs when one appears
1480         https://bugs.webkit.org/show_bug.cgi?id=166670
1481
1482         Reviewed by Chris Fleizach.
1483
1484         Added a timer to let focus jump into a modal dialog if the web
1485         author didn't handle the focus movement.
1486
1487         Test: accessibility/mac/aria-modal-auto-focus.html
1488
1489         * accessibility/AXObjectCache.cpp:
1490         (WebCore::AXObjectCache::AXObjectCache):
1491         (WebCore::AXObjectCache::~AXObjectCache):
1492         (WebCore::firstFocusableChild):
1493         (WebCore::AXObjectCache::focusAriaModalNode):
1494         (WebCore::AXObjectCache::focusAriaModalNodeTimerFired):
1495         (WebCore::AXObjectCache::handleAriaModalChange):
1496         * accessibility/AXObjectCache.h:
1497         (WebCore::AXObjectCache::focusAriaModalNode):
1498
1499 2017-01-03  Andy Estes  <aestes@apple.com>
1500
1501         Rename SharedBufferMac.mm to SharedBufferCocoa.mm
1502         https://bugs.webkit.org/show_bug.cgi?id=166666
1503
1504         Reviewed by Tim Horton.
1505
1506         * PlatformMac.cmake:
1507         * WebCore.xcodeproj/project.pbxproj:
1508         * platform/cocoa/SharedBufferCocoa.mm: Renamed from Source/WebCore/platform/mac/SharedBufferMac.mm.
1509
1510 2017-01-03  Sam Weinig  <sam@webkit.org>
1511
1512         Re-implement ExceptionOr on top of WTF::Expected
1513         https://bugs.webkit.org/show_bug.cgi?id=166668
1514
1515         Reviewed by Alex Christensen.
1516
1517         As a first step towards using WTF::Expected instead of ExceptionOr,
1518         use Expected as an implementation detail, rather than Variant/std::optional. 
1519
1520         * crypto/algorithms/CryptoAlgorithmAES_KW.cpp:
1521         * crypto/algorithms/CryptoAlgorithmHMAC.cpp:
1522         * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp:
1523         * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp:
1524         * crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp:
1525         Add missing #include of Variant.h
1526
1527         * dom/ExceptionOr.h:
1528         (WebCore::ExceptionOr<ReturnType>::ExceptionOr):
1529         (WebCore::ExceptionOr<ReturnType>::hasException):
1530         (WebCore::ExceptionOr<ReturnType>::releaseException):
1531         (WebCore::ExceptionOr<ReturnType>::releaseReturnValue):
1532         (WebCore::ExceptionOr<void>::ExceptionOr):
1533         (WebCore::ExceptionOr<void>::hasException):
1534         (WebCore::ExceptionOr<void>::releaseException):
1535         Re-implement on top of Expected.
1536
1537 2017-01-03  Chris Dumez  <cdumez@apple.com>
1538
1539         Make setting Event's cancelBubble to false a no-op
1540         https://bugs.webkit.org/show_bug.cgi?id=166018
1541
1542         Reviewed by Ryosuke Niwa.
1543
1544         Align behavior of Event.cancelBubble with the latest DOM specification:
1545         - https://dom.spec.whatwg.org/#dom-event-cancelbubble
1546
1547         Setting it to true sets the 'stop propagation' flag to true and setting
1548         it to false is now a no-op.
1549
1550         Tests: imported/w3c/web-platform-tests/dom/events/Event-cancelBubble.html
1551                imported/w3c/web-platform-tests/dom/events/Event-dispatch-bubble-canceled.html
1552                imported/w3c/web-platform-tests/dom/events/Event-dispatch-multiple-cancelBubble.html
1553
1554         * Modules/indexeddb/IDBEventDispatcher.cpp:
1555         (WebCore::IDBEventDispatcher::dispatch):
1556         * dom/Event.h:
1557         (WebCore::Event::cancelBubble):
1558         (WebCore::Event::setCancelBubble):
1559         * dom/EventDispatcher.cpp:
1560         (WebCore::dispatchEventInDOM):
1561
1562 2017-01-03  Jer Noble  <jer.noble@apple.com>
1563
1564         Check for the existence of AVSampleBufferAudioRenderer.h before redeclaring AVSampleBufferAudioRenderer
1565         https://bugs.webkit.org/show_bug.cgi?id=166421
1566         <rdar://problem/29782862>
1567
1568         Reviewed by Dan Bernstein.
1569
1570         Follow up after r210099; fix the __has_include directive to include the framework and fix the #import inside #if.
1571
1572         * platform/spi/mac/AVFoundationSPI.h:
1573
1574 2017-01-03  Andreas Kling  <akling@apple.com>
1575
1576         REGRESSION(r210226): fast/history/back-from-page-with-focused-iframe.html crashes under GuardMalloc
1577         <https://webkit.org/b/166657>
1578         <rdar://problem/29848806>
1579
1580         Reviewed by Antti Koivisto.
1581
1582         The problem was that tearDownRenderers() would cause commit Widget hierarchy updates
1583         before returning, which is just before Document clears its m_renderView pointer.
1584         This led to an awkward callback into Page::setActivityState() which ended up trying
1585         to clear the selection inside a partially dead render tree.
1586
1587         Fix this by adding a WidgetHierarchyUpdatesSuspensionScope to Document::destroyRenderTree()
1588         which ensures that Widget updates don't happen until after Document::m_renderView is cleared.
1589
1590         * dom/Document.cpp:
1591         (WebCore::Document::destroyRenderTree):
1592
1593 2017-01-03  Andreas Kling  <akling@apple.com>
1594
1595         Placeholder style mechanism leaks CSSFontSelector for first Document styled.
1596         <https://webkit.org/b/166652>
1597
1598         Reviewed by Antti Koivisto.
1599
1600         The placeholder style is used when we're resolving style for a non-rendered
1601         element, or any element before stylesheets have loaded.
1602
1603         An old optimization had us reusing the same style each time, which meant that
1604         since it was initialized with a font selector the first time, it kept that
1605         font selector alive forever.
1606
1607         As we have to clone the style anyway, fix this by just making a new style
1608         each time, using the current document's font selector.
1609
1610         * style/StyleTreeResolver.cpp:
1611         (WebCore::Style::makePlaceholderStyle):
1612         (WebCore::Style::TreeResolver::TreeResolver):
1613         (WebCore::Style::TreeResolver::styleForElement):
1614         (WebCore::Style::ensurePlaceholderStyle): Deleted.
1615         (WebCore::Style::isPlaceholderStyle): Deleted.
1616         * style/StyleTreeResolver.h:
1617
1618 2017-01-03  Carlos Alberto Lopez Perez  <clopez@igalia.com>
1619
1620         A floating element within <li> overlaps with the marker
1621         https://bugs.webkit.org/show_bug.cgi?id=166528
1622
1623         Reviewed by Zalan Bujtas.
1624
1625         Merged from Blink (patch by trobhogan@gmail.com):
1626         https://crrev.com/c896e79e5ba348d7ed87438cd3a19d0176f3036d
1627         https://crbug.com/548616
1628
1629         Establish a list marker's offset before floats have been added to its line.
1630
1631         Computing the offset for a list marker after the rest of the objects on the line
1632         it is on have been laid out, means it will avoid floats it ought not to.
1633
1634         Instead, compute the offset when laying out the marker and cache it for use later.
1635
1636         Tests: fast/lists/list-marker-before-float-nested-rtl.html
1637                fast/lists/list-marker-before-float-nested.html
1638                fast/lists/list-marker-before-float-rtl.html
1639                fast/lists/list-marker-before-float.html
1640
1641         * rendering/RenderListItem.cpp:
1642         (WebCore::RenderListItem::positionListMarker):
1643         * rendering/RenderListMarker.cpp:
1644         (WebCore::RenderListMarker::RenderListMarker):
1645         (WebCore::RenderListMarker::layout):
1646         * rendering/RenderListMarker.h:
1647
1648 2017-01-03  Per Arne Vollan  <pvollan@apple.com>
1649
1650         [Win] Some xmlhttprequest tests are failing.
1651         https://bugs.webkit.org/show_bug.cgi?id=166638
1652
1653         Reviewed by Darin Adler.
1654
1655         The tests are failing because the request timeout is set to zero.
1656         When the timeout is set to zero, we should use the default timeout.
1657
1658         * platform/network/cf/ResourceRequestCFNet.cpp:
1659         (WebCore::ResourceRequest::doUpdatePlatformRequest):
1660         (WebCore::ResourceRequest::doUpdatePlatformHTTPBody):
1661
1662 2017-01-02  Yusuke Suzuki  <utatane.tea@gmail.com>
1663
1664         Unreviewed, follow-up fix for r210227
1665         https://bugs.webkit.org/show_bug.cgi?id=166586
1666
1667         Suggested in the above bug.
1668
1669         * bindings/scripts/StaticString.pm:
1670         (GenerateStrings):
1671
1672 2017-01-02  Yusuke Suzuki  <utatane.tea@gmail.com>
1673
1674         Use StaticStringImpl instead of StaticASCIILiteral
1675         https://bugs.webkit.org/show_bug.cgi?id=166586
1676
1677         Reviewed by Darin Adler.
1678
1679         * bindings/scripts/StaticString.pm:
1680         (GenerateStrings):
1681
1682 2017-01-02  Andreas Kling  <akling@apple.com>
1683
1684         Drop the render tree for documents in the page cache.
1685         <https://webkit.org/b/121798>
1686
1687         Reviewed by Antti Koivisto.
1688
1689         To save memory and reduce complexity, have documents tear down their render tree
1690         when entering the page cache. I've wanted to do this for a long time and it seems
1691         like we can actually do it now.
1692
1693         This patch will enable a number of clean-ups since it's no longer valid for renderers
1694         to exist while the document is in page cache.
1695
1696         * dom/Document.cpp:
1697         (WebCore::Document::destroyRenderTree): Remove assertion that we're not in the page cache
1698         since we will now be tearing down render trees right as they enter the page cache.
1699
1700         * dom/PageCache.cpp:
1701         (WebCore::destroyRenderTree):
1702         (WebCore::PageCache::addIfCacheable): Tear down the render tree right before setting
1703         the in-cache flag. The render tree is destroyed in bottom-up order to ensure that the
1704         main frame renderers die last.
1705
1706         * history/CachedFrame.cpp:
1707         (WebCore::CachedFrameBase::restore):
1708         * page/FrameView.h:
1709         * page/FrameView.cpp:
1710         (WebCore::FrameView::didRestoreFromPageCache): Update the scollable area set after restoring
1711         a frame from the page cache. This dirties the scrolling tree, which was covered by tests.
1712
1713         * page/animation/AnimationBase.cpp:
1714         (WebCore::AnimationBase::setNeedsStyleRecalc):
1715         * page/animation/AnimationController.cpp:
1716         (WebCore::AnimationController::cancelAnimations): Make these no-ops if called
1717         while the render tree is being torn down. This fixes some assertion failures
1718         on layout tests and avoids pointless style invalidation.
1719
1720 2017-01-02  Andreas Kling  <akling@apple.com>
1721
1722         Discard media controls JS/CSS caches under memory pressure.
1723         <https://webkit.org/b/166639>
1724
1725         Reviewed by Antti Koivisto.
1726
1727         Add a RenderTheme::purgeCaches() virtual and teach the iOS and macOS implementations
1728         to drop their cached media controls JS/CSS strings there. The strings are only cleared
1729         if nothing else is referencing them, which gives us a decent "weak cache" behavior.
1730
1731         This sheds ~300kB memory on iOS with the current media controls.
1732
1733         * page/MemoryRelease.cpp:
1734         (WebCore::releaseNoncriticalMemory):
1735         * rendering/RenderTheme.h:
1736         (WebCore::RenderTheme::purgeCaches):
1737         * rendering/RenderThemeIOS.h:
1738         * rendering/RenderThemeIOS.mm:
1739         (WebCore::RenderThemeIOS::purgeCaches):
1740         * rendering/RenderThemeMac.h:
1741         * rendering/RenderThemeMac.mm:
1742         (WebCore::RenderThemeMac::purgeCaches):
1743
1744 2017-01-02  Carlos Garcia Campos  <cgarcia@igalia.com>
1745
1746         [GTK] Since the memory pressure relief has been activated, my disk has a high usage and the desktop stalls
1747         https://bugs.webkit.org/show_bug.cgi?id=164052
1748
1749         Reviewed by Michael Catanzaro.
1750
1751         Check how much memory is freed by the memory pressure handler and wait for a long time if we didn't free that
1752         much.
1753
1754         * platform/linux/MemoryPressureHandlerLinux.cpp:
1755         (WebCore::MemoryPressureHandler::EventFDPoller::EventFDPoller):
1756
1757 2017-01-02  Chris Fleizach  <cfleizach@apple.com>
1758
1759         AX: Expose block quote level to iOS API
1760         https://bugs.webkit.org/show_bug.cgi?id=166629
1761         <rdar://problem/29834793>
1762
1763         Reviewed by Darin Adler.
1764
1765         Expose the blockquote level to iOS Accessbility API.
1766         Change the return type of blockquote level to unsigned.
1767
1768         Test: accessibility/ios-simulator/blockquote-level.html
1769
1770         * accessibility/AccessibilityObject.cpp:
1771         (WebCore::AccessibilityObject::blockquoteLevel):
1772         * accessibility/AccessibilityObject.h:
1773         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
1774         (-[WebAccessibilityObjectWrapper accessibilityBlockquoteLevel]):
1775         * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
1776         (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
1777
1778 2017-01-01  Jeff Miller  <jeffm@apple.com>
1779
1780         Update user-visible copyright strings to include 2017
1781         https://bugs.webkit.org/show_bug.cgi?id=166278
1782
1783         Reviewed by Dan Bernstein.
1784
1785         * Info.plist:
1786
1787 2017-01-01  Zan Dobersek  <zdobersek@igalia.com>
1788
1789         GraphicsContextCairo: setMiterLimit() is missing the DisplayListRecorder diversion
1790         https://bugs.webkit.org/show_bug.cgi?id=166539
1791
1792         Reviewed by Michael Catanzaro.
1793
1794         * platform/graphics/cairo/GraphicsContextCairo.cpp:
1795         (WebCore::GraphicsContext::setMiterLimit): Call the setMiterLimit() method on the
1796         m_displayListRecorder object when the GraphicsContext object is in recording mode.
1797
1798 2017-01-01  Zan Dobersek  <zdobersek@igalia.com>
1799
1800         Clean up GraphicsContext3D forward declarations, header inclusion
1801         https://bugs.webkit.org/show_bug.cgi?id=166537
1802
1803         Reviewed by Alex Christensen.
1804
1805         Remove two unnecessary GraphicsContext3D forward declarations from the
1806         EmptyClients and ChromeClient header files, and remove the unnecessary
1807         GraphicsContext3D.h header inclusion from RenderLayerBacking.
1808
1809         No changes in behavior.
1810
1811         * loader/EmptyClients.h:
1812         * page/ChromeClient.h:
1813         * rendering/RenderLayerBacking.cpp:
1814
1815 2016-12-31  Michael Catanzaro  <mcatanzaro@igalia.com>
1816
1817         SecurityOrigin::create triplet constructor does not canonicalize port
1818         https://bugs.webkit.org/show_bug.cgi?id=166624
1819
1820         Reviewed by Daniel Bates.
1821
1822         It is currently possible to create two different unequal SecurityOrigin objects that
1823         represent the same security origin. The SecurityOrigin create functions that take URL and
1824         String parameters convert the port to nullopt if it is the default port for the protocol,
1825         but the separate protocol/host/port constructor doesn't. Change it to parallel the other
1826         constructors.
1827
1828         * page/SecurityOrigin.cpp:
1829         (WebCore::SecurityOrigin::create):
1830         * page/SecurityOrigin.h: Export isSameOriginAs for use by tests.
1831
1832 2016-12-25  Darin Adler  <darin@apple.com>
1833
1834         Remove setDOMException and a few custom bindings
1835         https://bugs.webkit.org/show_bug.cgi?id=166002
1836
1837         Reviewed by Sam Weinig.
1838
1839         * CMakeLists.txt: Removed JSFileReaderCustom.cpp.
1840
1841         * WebCore.xcodeproj/project.pbxproj: Removed JSFileReaderCustom.cpp.
1842
1843         * bindings/js/CallbackFunction.cpp:
1844         (WebCore::checkFunctionOnlyCallback): Use throwTypeMismatchError instead
1845         of calling setDOMException with TYPE_MISMATCH_ERR.
1846
1847         * bindings/js/JSBindingsAllInOne.cpp: Removed JSFileReaderCustom.cpp.
1848
1849         * bindings/js/JSCSSStyleDeclarationCustom.cpp:
1850         (WebCore::JSCSSStyleDeclaration::putDelegate): Pass a throw scope in to
1851         propagateException.
1852
1853         * bindings/js/JSCryptoAlgorithmDictionary.cpp:
1854         (WebCore::JSCryptoAlgorithmDictionary::parseAlgorithmIdentifier):
1855         Renamed from getAlgorithmIdentifier. Got rid of bool return value, instead
1856         use a conventional return value and conventional JavaScript exception
1857         handling. Added a ThrowScope argument.
1858         (WebCore::optionalHashAlgorithm): Added. Returns an optional hash algorithm.
1859         Also makes the same changes as above, conventional exception handling and
1860         ThrowScope argument.
1861         (WebCore::requiredHashAlgorithm): Added. Like the above but throws an
1862         exception if the algorithm is omitted.
1863         (WebCore::getHashAlgorithm): Deleted. Replaced by the two functions above.
1864         (WebCore::createAesCbcParams): Updated for above changes.
1865         (WebCore::createHmacParams): Ditto.
1866         (WebCore::createHmacKeyParams): Ditto.
1867         (WebCore::createRsaKeyGenParams): Ditto.
1868         (WebCore::createRsaOaepParams): Ditto.
1869         (WebCore::createRsaSsaParams): Ditto.
1870         (WebCore::JSCryptoAlgorithmDictionary::createParametersForEncrypt): Added
1871         a ThrowScope argument, and changed to use throwNotSupportedError instead
1872         of setDOMException with NOT_SUPPORTED_ERROR.
1873         (WebCore::JSCryptoAlgorithmDictionary::createParametersForDecrypt): Ditto.
1874         (WebCore::JSCryptoAlgorithmDictionary::createParametersForSign): Ditto.
1875         (WebCore::JSCryptoAlgorithmDictionary::createParametersForVerify):
1876         (WebCore::JSCryptoAlgorithmDictionary::createParametersForDigest): Ditto.
1877         (WebCore::JSCryptoAlgorithmDictionary::createParametersForGenerateKey): Ditto.
1878         (WebCore::JSCryptoAlgorithmDictionary::createParametersForDeriveKey): Ditto.
1879         (WebCore::JSCryptoAlgorithmDictionary::createParametersForDeriveBits): Ditto.
1880         (WebCore::JSCryptoAlgorithmDictionary::createParametersForImportKey): Ditto.
1881         (WebCore::JSCryptoAlgorithmDictionary::createParametersForExportKey): Ditto.
1882         * bindings/js/JSCryptoAlgorithmDictionary.h: Updated for the above changes.
1883
1884         * bindings/js/JSCryptoOperationData.cpp:
1885         (WebCore::cryptoOperationDataFromJSValue): Got rid of bool return value and
1886         instead use a conventional return value and conventional JS exception handling.
1887         Added a ThrowScope argument.
1888         * bindings/js/JSCryptoOperationData.h: Updated for the above.
1889
1890         * bindings/js/JSCustomXPathNSResolver.cpp:
1891         (WebCore::JSCustomXPathNSResolver::create): Use ExceptionOr.
1892         (WebCore::JSCustomXPathNSResolver::JSCustomXPathNSResolver): Take a VM&
1893         rather than an ExecState*.
1894         * bindings/js/JSCustomXPathNSResolver.h: Updated for the changes above.
1895         Also marked class final and fixed indentation.
1896
1897         * bindings/js/JSDOMBinding.cpp:
1898         (WebCore::createDOMException): Updated comment.
1899         (WebCore::throwDOMException): Deleted.
1900         (WebCore::propagateException): Deleted non-inline overload that does not take
1901         a throw scope, now that all callers pass a throw scope.
1902         (WebCore::setDOMExceptionSlow): Deleted.
1903         (WebCore::setDOMException): Deleted.
1904         (WebCore::throwNotSupportedError): Added.
1905         (WebCore::throwDOMSyntaxError): Added.
1906         (WebCore::throwDataCloneError): Added.
1907         (WebCore::throwIndexSizeError): Added.
1908         (WebCore::throwTypeMismatchError): Added.
1909         * bindings/js/JSDOMBinding.h: Updated for the additions and removals
1910         above. Also grouped the standard DOM exception throwing functions separately
1911         from the special ones for getters and setters, and sorted them alphabetically.
1912
1913         * bindings/js/JSDataCueCustom.cpp:
1914         (WebCore::createJSDataCue): Added, helper function for the below.
1915         (WebCore::constructJSDataCue): Tightened and tweaked a bit.
1916
1917         * bindings/js/JSFileReaderCustom.cpp: Removed.
1918
1919         * bindings/js/JSHTMLOptionsCollectionCustom.cpp:
1920         (WebCore::JSHTMLOptionsCollection::setLength): Use throwIndexSizeError instead
1921         of setDOMException with INDEX_SIZE_ERR.
1922         * bindings/js/JSHTMLSelectElementCustom.cpp:
1923         (WebCore::selectElementIndexSetter): Use throwTypeMismatchError instead of
1924         setDOMExceptoin with TYPEMISMATCH_ERR.
1925
1926         * bindings/js/JSIDBRequestCustom.cpp:
1927         (WebCore::JSIDBRequest::result): Pass a throw scope in to
1928         propagateException.
1929
1930         * bindings/js/JSSQLResultSetRowListCustom.cpp:
1931         (WebCore::JSSQLResultSetRowList::item): Use throwTypeMismatchError and
1932         throwIndexSizeError instead of setDOMException with TYPE_MISMATCH_ERR and
1933         INDEX_ERR. This required adding a throw scope.
1934
1935         * bindings/js/JSSQLTransactionCustom.cpp:
1936         (WebCore::JSSQLTransaction::executeSql): Use throwDOMSyntaxError and
1937         throwTypeMismatchError instead of setDOMException with SYNTAX_ERR and
1938         TYPE_MISMATCH_ERR.
1939
1940         * bindings/js/JSStorageCustom.cpp:
1941         (WebCore::JSStorage::nameGetter): Pass a throw scope in to
1942         propagateException.
1943
1944         * bindings/js/JSSubtleCryptoCustom.cpp:
1945         (WebCore::normalizeCryptoAlgorithmParameters): Use throwNotSupportedError
1946         instead of setDOMException with NOT_SUPPORTED_ERR.
1947         (WebCore::createAlgorithm): Deleted.
1948         (WebCore::supportExportKeyThrow): Added ThrowScope argument and use
1949         throwNotSupportedError instead of setDOMException with NOT_SUPPORTED_ERR.
1950         (WebCore::jsSubtleCryptoFunctionEncryptPromise): Updated for above changes,
1951         throwing a not supported exception at this level rather than in a helper.
1952         (WebCore::jsSubtleCryptoFunctionDecryptPromise): Ditto.
1953         (WebCore::jsSubtleCryptoFunctionSignPromise): Ditto.
1954         (WebCore::jsSubtleCryptoFunctionVerifyPromise): Ditto.
1955         (WebCore::jsSubtleCryptoFunctionDigestPromise): Ditto.
1956         (WebCore::jsSubtleCryptoFunctionGenerateKeyPromise): Ditto.
1957         (WebCore::jsSubtleCryptoFunctionImportKeyPromise): Ditto.
1958         (WebCore::jsSubtleCryptoFunctionExportKeyPromise): Ditto.
1959         (WebCore::jsSubtleCryptoFunctionWrapKeyPromise): Ditto.
1960         (WebCore::jsSubtleCryptoFunctionUnwrapKeyPromise): Ditto.
1961
1962         * bindings/js/JSWebKitSubtleCryptoCustom.cpp:
1963         (WebCore::createAlgorithmFromJSValue): Got rid of bool return value and
1964         instead use a conventional return value and conventional JS exception handling.
1965         Added a ThrowScope argument.
1966         (WebCore::cryptoKeyFormatFromJSValue): Ditto.
1967         (WebCore::cryptoKeyUsagesFromJSValue): Ditto.
1968         (WebCore::JSWebKitSubtleCrypto::encrypt): Updated for above changes.
1969         (WebCore::JSWebKitSubtleCrypto::decrypt): Ditto.
1970         (WebCore::JSWebKitSubtleCrypto::sign): Ditto.
1971         (WebCore::JSWebKitSubtleCrypto::verify): Ditto.
1972         (WebCore::JSWebKitSubtleCrypto::digest): Ditto.
1973         (WebCore::JSWebKitSubtleCrypto::generateKey): Ditto.
1974         (WebCore::JSWebKitSubtleCrypto::importKey): Ditto.
1975         (WebCore::JSWebKitSubtleCrypto::exportKey): Ditto.
1976         (WebCore::JSWebKitSubtleCrypto::wrapKey): Ditto.
1977         (WebCore::JSWebKitSubtleCrypto::unwrapKey): Ditto.
1978
1979         * bindings/js/JSXMLHttpRequestCustom.cpp:
1980         (WebCore::JSXMLHttpRequest::send): Pass a throw scope in to
1981         propagateException.
1982         (WebCore::JSXMLHttpRequest::responseText): Ditto.
1983
1984         * bindings/js/JSXPathNSResolverCustom.cpp:
1985         (WebCore::JSXPathNSResolver::toWrapped): Updated since
1986         JSCustomXPathNSResolver::create now uses ExceptionOr.
1987
1988         * bindings/js/SerializedScriptValue.cpp:
1989         (WebCore::maybeThrowExceptionIfSerializationFailed): Updated to take
1990         a reference instead of a pointer. Fixed the handling of success to be
1991         simpler; no need to check the code twice. Use throwDataCloneError instead
1992         of setDOMException with DATA_CLONE_ERR.
1993         (WebCore::SerializedScriptValue::create): Updated for above.
1994         (WebCore::SerializedScriptValue::deserialize): Ditto.
1995
1996         * bindings/js/StructuredClone.cpp:
1997         (WebCore::structuredCloneArrayBuffer): Use throwDataCloneError instead of
1998         setDOMException with DATA_CLONE_ERR.
1999         (WebCore::structuredCloneArrayBufferView): Ditto.
2000
2001         * crypto/CryptoAlgorithmParametersDeprecated.h: Removed unneeded empty
2002         constructor.
2003         * crypto/parameters/CryptoAlgorithmHmacKeyParamsDeprecated.h: Ditto,
2004         moving initialization to where the data member is defined.
2005         * crypto/parameters/CryptoAlgorithmRsaKeyGenParamsDeprecated.h: Ditto.
2006         * crypto/parameters/CryptoAlgorithmRsaOaepParamsDeprecated.h: Ditto.
2007
2008         * fileapi/FileReader.cpp:
2009         (WebCore::FileReader::result): Added. Returns a combination of optional
2010         and variant that matches what the ID specifies. Moved the code from the
2011         two following functions in here.
2012         (WebCore::FileReader::arrayBufferResult): Deleted.
2013         (WebCore::FileReader::stringResult): Deleted.
2014         * fileapi/FileReader.h: Updated for the above.
2015         * fileapi/FileReader.idl: Removed [Custom] from the result attribute and
2016         declared it with the type mentioned in the specification, a nullable union.
2017
2018 2016-12-30  Darin Adler  <darin@apple.com>
2019
2020         Remove PassRefPtr use from the "dom" directory, related cleanup
2021         https://bugs.webkit.org/show_bug.cgi?id=166569
2022
2023         Reviewed by Alex Christensen.
2024
2025         * CMakeLists.txt: Removed DocumentMarker.cpp.
2026         * WebCore.xcodeproj/project.pbxproj: Ditto.
2027
2028         * bindings/js/JSPopStateEventCustom.cpp:
2029         (WebCore::JSPopStateEvent::state): Pass ExecState by reference.
2030
2031         * dom/CharacterData.cpp:
2032         (WebCore::CharacterData::dispatchModifiedEvent): Use auto.
2033
2034         * dom/DOMAllInOne.cpp: Removed DocumentMarker.cpp.
2035
2036         * dom/DOMNamedFlowCollection.cpp:
2037         (WebCore::DOMNamedFlowCollection::DOMNamedFlowCollection): Updated to take
2038         ownership of the passed in vector.
2039         (WebCore::DOMNamedFlowCollection::create): Moved here from header.
2040         (WebCore::DOMNamedFlowCollection::~DOMNamedFlowCollection): Moved here so we
2041         don't need to include "WebKitNamedFlow.h" in the header.
2042         (WebCore::DOMNamedFlowCollection::item): Rewrote to use Vector.
2043         (WebCore::DOMNamedFlowCollection::namedItem): Rewrote to use a HashSet that
2044         we build from the Vector. Uses a set of hash functions defined right here.
2045         Note that the privor version of this class had incorrect use of ListHashSet
2046         with safeToCompareToEmptyOrDeleted inaccurately set to true.
2047         (WebCore::DOMNamedFlowCollection::supportedPropertyNames): Added this.
2048         Old version just had an empty placeholder.
2049         * dom/DOMNamedFlowCollection.h: Changed to no longer use ListHashSet, not
2050         the right data structure for this. Removed incorrect use of "long" and
2051         made some other simplifications.
2052         * dom/DOMNamedFlowCollection.idl: Changed return types of item and namedItem
2053         to accurately reflect the fact that they return null when the index or name
2054         not found in the collection.
2055
2056         * dom/DataTransfer.h: Remove indentation. Remove unimplemented
2057         incorrect declarations of items for ENABLE(DATA_TRANSFER_ITEMS).
2058         Will be added back when someone implements that feature, or perhaps
2059         ENABLE(DATA_TRANSFER_ITEMS) should be entirely removed for now?
2060
2061         * dom/DataTransferItem.h: Changed return type for getAsFile to
2062         RefPtr. Again, part of ENABLE(DATA_TRANSFER_ITEMS), so dead code for now.
2063
2064         * dom/Document.cpp:
2065         (WebCore::canonicalizedTitle): Removed incorrect comment claiming we
2066         convert control characters to spaces. Simplified logic, removing two
2067         extra loops. Changed to work on just a String rather than StringWithDirection.
2068         (WebCore::Document::updateTitle): Updated to call the function above.
2069         Also updated since StringWithDirection is now a struct instead of a class.
2070         Call displayBuffer on the encoding directly instead of calling a member
2071         function named displayBufferModifiedByEncoding.
2072         (WebCore::Document::updateTitleFromTitleElement): Updated since
2073         StringWithDirection is now a struct.
2074         (WebCore::Document::setTitle): Removed code that unnecessarily calls
2075         updateTitle twice; once indirectly by calling setTextContent on the
2076         title elmeent and once by directly calling updateTitle.
2077         (WebCore::Document::setWindowAttributeEventListener): Take a RefPtr&&.
2078         (WebCore::Document::statePopped): Take a Ref&&.
2079         (WebCore::Document::displayStringModifiedByEncoding): Deleted unused overload.
2080         (WebCore::Document::displayBufferModifiedByEncodingInternal): Deleted.
2081         (WebCore::Document::requestAnimationFrame): Take a Ref&&.
2082         * dom/Document.h: Updated for changes above. Also changed the title function
2083         to return a const String& to slightly cut down on reference count churn.
2084         (WebCore::Document::displayBufferModifiedByEncoding): Deleted.
2085
2086         * dom/DocumentMarker.cpp: Removed.
2087         * dom/DocumentMarker.h: Reworked the DocumentMarker class to use a variant
2088         instead of a separate reference counted DocumentMarkerDetails object.
2089
2090         * dom/DocumentMarkerController.cpp:
2091         (WebCore::DocumentMarkerController::addMarkerToNode): Changed argument
2092         type to DocumentMarker::Data&&.
2093         (DocumentMarkerController::clearDescriptionOnMarkersIntersectingRange):
2094         clearDetails -> clearData
2095         (DocumentMarkerController::showMarkers): activeMatch -> isActiveMatch
2096         * dom/DocumentMarkerController.h: Updated for the above.
2097
2098         * dom/DocumentParser.h: Fixed incorrect reference to PassRefPtr in a comment.
2099
2100         * dom/Element.cpp:
2101         (WebCore::Element::willModifyAttribute): Use auto.
2102
2103         * dom/Event.cpp:
2104         (WebCore::Event::isDragEvent): Deleted. Unused.
2105         (WebCore::Event::cloneFor): Deleted. Unused function left over from the
2106         start of an implementation of seamless frames.
2107         * dom/Event.h: Updated for the above.
2108
2109         * dom/EventContext.cpp: Tweaked blank lines.
2110         * dom/EventContext.h: Removed unnecessary includes and forward declarations.
2111         Changed setRelatedTarget to take a raw pointer instead of PassRefPtr since
2112         callers aren't passing ownership. Moved TouchEventContext::touchList body
2113         out of the class definition since it's a bit long. Deleted unused
2114         toTouchEventContext functions. FIxed incorrect comment.
2115
2116         * dom/MessageEvent.cpp:
2117         (WebCore::MessageEvent::initMessageEvent): Removed unused overload.
2118         * dom/MessageEvent.h: Updated for above. Also changed the
2119         dataAsSerializedScriptValue function to return a raw pointer instead of
2120         PassRefPtr since it is not passing ownership.
2121
2122         * dom/MouseEvent.cpp:
2123         (WebCore::MouseEvent::create): Use raw pointer instead of PassRefPtr for
2124         data transfer and related target arguments.
2125         (WebCore::MouseEvent::MouseEvent): Ditto. Also use IntPoint instead of
2126         separate ints for the various X/Y pairs.
2127         (WebCore::MouseEvent::initMouseEvent): Take a raw pointer for event target.
2128         (WebCore::MouseEvent::isDragEvent): Reformatted, sorted alphabetically,
2129         added comment about why this function probably needs to go.
2130         (WebCore::adjustedClientX): Deleted.
2131         (WebCore::adjustedClientY): Deleted.
2132         (WebCore::MouseEvent::cloneFor): Deleted.
2133         * dom/MouseEvent.h: Updated for the above. Also made more functions private
2134         and final and initialized more of the data members.
2135
2136         * dom/MutationEvent.cpp:
2137         (WebCore::MutationEvent::MutationEvent): Pass related node as a raw pointer.
2138         (WebCore::MutationEvent::initMutationEvent): Ditto.
2139         * dom/MutationEvent.h: Updated for the above. Fixed indentation. Removed
2140         unnecessary explicit destructor; default generated one is fine. Initialize
2141         m_attrChange in the class definition.
2142
2143         * dom/MutationObserver.cpp:
2144         (WebCore::MutationObserver::observe): Pass reference.
2145         (WebCore::MutationObserver::disconnect): Call unregisterMutationObserver
2146         directly instead of calling unregisterAndDelete.
2147
2148         * dom/MutationObserverInterestGroup.cpp:
2149         (WebCore::MutationObserverInterestGroup::MutationObserverInterestGroup):
2150         Take an rvalue reference to the HashMap and use move.
2151         (WebCore::MutationObserverInterestGroup::createIfNeeded): Updated to call
2152         registeredMutationObservers.
2153         * dom/MutationObserverInterestGroup.h: Updated for the above.
2154
2155         * dom/MutationObserverRegistration.cpp:
2156         (WebCore::MutationObserverRegistration::MutationObserverRegistration):
2157         Take a reference to the observer instead of PassRefPtr. Also take a
2158         refererence to the node rather than a pointer.
2159         (WebCore::MutationObserverRegistration::observedSubtreeNodeWillDetach):
2160         Updated to use references instead of pointers.
2161         (WebCore::MutationObserverRegistration::clearTransientRegistrations): Ditto.
2162         (WebCore::MutationObserverRegistration::unregisterAndDelete): Deleted.
2163         (WebCore::MutationObserverRegistration::shouldReceiveMutationFrom): Ditto.
2164         (WebCore::MutationObserverRegistration::addRegistrationNodesToSet): Ditto.
2165         * dom/MutationObserverRegistration.h: Updated for above changes. Also added
2166         a node member function. Changed m_observer to a Ref and m_node to a reference.
2167         Removed the NodeHashSet typedef.
2168
2169         * dom/NamedFlowCollection.cpp:
2170         (WebCore::NamedFlowCollection::createCSSOMSnapshot): Pass a vector of Ref
2171         instead of a vector of raw pointers and pass it as an rvalue reference so
2172         it can be taken over by the named flow collection wrapper.
2173
2174         * dom/Node.cpp:
2175         (WebCore::Node::mutationObserverRegistry): Use auto and nullptr.
2176         (WebCore::Node::transientMutationObserverRegistry): Ditto.
2177         (WebCore::collectMatchingObserversForMutation): Use references instead of pointers.
2178         (WebCore::Node::registeredMutationObservers): Changed to return a map instead of
2179         filling one in and renamed to remove "get" from name.
2180         (WebCore::Node::registerMutationObserver): Use references instead of pointers.
2181         (WebCore::Node::unregisterMutationObserver): Ditto.
2182         (WebCore::Node::registerTransientMutationObserver): Ditto.
2183         (WebCore::Node::unregisterTransientMutationObserver): Ditto.
2184         (WebCore::Node::notifyMutationObserversNodeWillDetach): Ditto.
2185         * dom/Node.h: Updated for the above.
2186
2187         * dom/PopStateEvent.cpp:
2188         (WebCore::PopStateEvent::PopStateEvent): Use RefPtr&& instead of PassRefPtr.
2189         (WebCore::PopStateEvent::create): Use a raw pointer instead of PassRefPtr.
2190         (WebCore::PopStateEvent::trySerializeState): Take a reference to ExecState.
2191         * dom/PopStateEvent.h: Updated for the above.
2192
2193         * dom/Position.cpp:
2194         (WebCore::Position::Position): Take a raw pointer instead of PassRefPtr.
2195         (WebCore::Position::moveToPosition): Ditto.
2196         * dom/Position.h: Updated for the above, also changed createLegacyEditingPosition
2197         in the same way and got rid of the LegacyEditingPosition class.
2198
2199         * dom/Range.cpp:
2200         (WebCore::Range::Range): Changed startContainer and endContainer to RefPtr<Node>&&.
2201         Later this needs to be changed more, but for now this keeps code changes to a minimum.
2202         (WebCore::Range::create): Changed startContainer and endContainer to Node*.
2203         * dom/Range.h: Updated for the above.
2204
2205         * dom/ScopedEventQueue.cpp:
2206         (WebCore::ScopedEventQueue::dispatchEvent): Removed a comment that talks about
2207         PassRefPtr, and simplified the code since the comment is no longer valid.
2208
2209         * dom/ScriptExecutionContext.cpp:
2210         (WebCore::ScriptExecutionContext::PendingException::PendingException):
2211         Take a RefPtr&& instead of a PassRefPtr.
2212         (WebCore::ScriptExecutionContext::ScriptExecutionContext): Moved initialization
2213         of all the data members up to the class definition.
2214         (WebCore::ScriptExecutionContext::sanitizeScriptError): Use ASCIILiteral.
2215         (WebCore::ScriptExecutionContext::reportException): Use WTFMove when passing
2216         arguments to the PendingException constructor and using a value from the
2217         PendingException just before destroying it.
2218
2219         * dom/ScriptExecutionContext.h: Changed addTimeout to take a reference rather
2220         than a PassRefPtr to the timer. Callers were not passing ownership. Also
2221         initialize all the data members here in the class definition.
2222
2223         * dom/ScriptedAnimationController.cpp:
2224         (WebCore::ScriptedAnimationController::registerCallback): Take a Ref&&.
2225         * dom/ScriptedAnimationController.h: Updated for the above.
2226
2227         * dom/SimulatedClick.cpp:
2228         (WebCore::SimulatedMouseEvent::SimulatedMouseEvent): Updated since MouseEvent
2229         constructor arguments changed to use IntPoint.
2230         * dom/WheelEvent.cpp:
2231         (WebCore::WheelEvent::WheelEvent): Ditto. Also removed some unneeded initializers
2232         now that the header does more.
2233         (WebCore::WheelEvent::initWheelEvent): Tweaed style a bit.
2234         (WebCore::WheelEvent::initWebKitWheelEvent): Deleted. Moved to the header since it's
2235         just an inline that forwards to initWheelEvent.
2236         * dom/WheelEvent.h: Updated for the above.
2237
2238         * dom/make_event_factory.pl:
2239         (generateImplementation): Use RefPtr instead of PassRefPtr. A couple other tweaks.
2240
2241         * editing/AlternativeTextController.cpp:
2242         (WebCore::AlternativeTextController::respondToMarkerAtEndOfWord): Use the data
2243         insetad of details.
2244         (WebCore::AlternativeTextController::removeDictationAlternativesForMarker):
2245         Ditto, also changed to take reference instead of pointer.
2246         (WebCore::AlternativeTextController::dictationAlternativesForMarker): Ditto.
2247         (WebCore::AlternativeTextController::applyDictationAlternative): Ditto.
2248         * editing/AlternativeTextController.h: Updated for the above.
2249
2250         * editing/ApplyBlockElementCommand.cpp:
2251         (WebCore::ApplyBlockElementCommand::rangeForParagraphSplittingTextNodesIfNeeded):
2252         Updated since Position now takes a raw pointer.
2253         * editing/ApplyStyleCommand.cpp:
2254         (WebCore::ApplyStyleCommand::joinChildTextNodes): Ditto.
2255         * editing/CompositeEditCommand.cpp:
2256         (WebCore::CompositeEditCommand::replaceSelectedTextInNode): Ditto.
2257         (WebCore::CompositeEditCommand::rebalanceWhitespaceOnTextSubstring): Ditto.
2258
2259         * editing/DictationCommand.cpp:
2260         (WebCore::DictationMarkerSupplier::addMarkersToTextNode): Updated to use the
2261         DictationData struct.
2262
2263         * editing/Editor.cpp:
2264         (WebCore::Editor::updateMarkersForWordsAffectedByEditing): Pass a reference.
2265         (WebCore::Editor::dictationAlternativesForMarker): Take a reference.
2266         * editing/Editor.h: Updated for the above.
2267
2268         * editing/InsertTextCommand.cpp:
2269         (WebCore::InsertTextCommand::performOverwrite): Updated since Position now takes
2270         a raw pointer.
2271         (WebCore::InsertTextCommand::doApply): Ditto.
2272         (WebCore::InsertTextCommand::insertTab): Ditto.
2273         * editing/ReplaceSelectionCommand.cpp:
2274         (WebCore::ReplaceSelectionCommand::mergeTextNodesAroundPosition): Ditto.
2275
2276         * html/HTMLTitleElement.cpp:
2277         (WebCore::HTMLTitleElement::computedTextWithDirection): Updated since
2278         StringWithDirection is now a struct.
2279
2280         * loader/FrameLoader.cpp:
2281         (WebCore::FrameLoader::submitForm): Use Ref&& for the form submission.
2282         (WebCore::FrameLoader::receivedFirstData): Updated for change to StringWithDirection.
2283         (WebCore::FrameLoader::commitProvisionalLoad):
2284         (WebCore::FrameLoader::didBeginDocument): Pass a reference.
2285         (WebCore::FrameLoader::loadURLIntoChildFrame): Pass a Ref to loadArchive.
2286         (WebCore::FrameLoader::loadArchive): Take a Ref&& for the archive.
2287         (WebCore::FrameLoader::loadInSameDocument): Take a raw pointer for the
2288         serialized script value state object. No one was passing ownership.
2289         But pass it along to statePopped as a Ref since we need to pass ownership
2290         of the null value, at least for now.
2291         (WebCore::FrameLoader::loadFrameRequest): Take a raw pointer for form state.
2292         No one was passing ownership.
2293         (WebCore::FrameLoader::loadURL): Ditto.
2294         (WebCore::FrameLoader::load): Ditto.
2295         (WebCore::FrameLoader::loadWithNavigationAction): Ditto.
2296         (WebCore::FrameLoader::loadWithDocumentLoader): Ditto.
2297         (WebCore::FrameLoader::loadPostRequest): Ditto.
2298         (WebCore::FrameLoader::continueLoadAfterNavigationPolicy): Ditto.
2299         (WebCore::FrameLoader::continueLoadAfterNewWindowPolicy): Ditto.
2300         * loader/FrameLoader.h: Updated for the above and to remove an unneeded forward
2301         declaration of StringWithDirection, which is not used here.
2302
2303         * loader/FrameLoaderClient.h: Updated forward declaration of StringWithDirection.
2304         Also sorted the others and removed unneeded conditionals.
2305
2306         * loader/HistoryController.cpp:
2307         (WebCore::HistoryController::setCurrentItemTitle): Updated to use struct.
2308         (WebCore::HistoryController::initializeItem): Ditto.
2309         * loader/HistoryController.h: Updated forward declaration of StringWithDirection.
2310
2311         * loader/PolicyCallback.cpp:
2312         (WebCore::PolicyCallback::PolicyCallback): Deleted. Default works fine.
2313         (WebCore::PolicyCallback::~PolicyCallback): Ditto.
2314         (WebCore::PolicyCallback::set): Take a raw pointer to form state.
2315         * loader/PolicyCallback.h: Use raw pointer for form state.
2316
2317         * loader/PolicyChecker.cpp:
2318         (WebCore::PolicyChecker::checkNavigationPolicy): Take a raw pointer for form state.
2319         (WebCore::PolicyChecker::checkNewWindowPolicy): Ditto.
2320         * loader/PolicyChecker.h: Updated for the above.
2321
2322         * page/DOMTimer.cpp:
2323         (WebCore::DOMTimer::DOMTimer): Pass reference to addTimeout function.
2324
2325         * page/DOMWindow.cpp:
2326         (WebCore::DOMWindow::requestAnimationFrame): Use Ref&& for callback.
2327         (WebCore::DOMWindow::webkitRequestAnimationFrame): Ditto.
2328         (WebCore::DOMWindow::cancelAnimationFrame): Tweak coding style.
2329         * page/DOMWindow.h: Updated for the above.
2330
2331         * platform/PlatformWheelEvent.h: Use pragma once. Tweaked header indentation.
2332         Simplified constructors by initializing data members.
2333
2334         * platform/text/StringWithDirection.h: Use pragma once. Use struct instead of class.
2335
2336         * rendering/HitTestResult.cpp:
2337         (WebCore::HitTestResult::dictationAlternatives): Pass a reference.
2338
2339         * rendering/InlineTextBox.cpp:
2340         (WebCore::InlineTextBox::paintTextMatchMarker): activeMatch -> isActiveMatch
2341
2342 2016-12-30  Darin Adler  <darin@apple.com>
2343
2344         Remove PassRefPtr use from the "css" directory, related cleanup
2345         https://bugs.webkit.org/show_bug.cgi?id=166628
2346
2347         Reviewed by Alex Christensen.
2348
2349         * css/CSSCalculationValue.cpp:
2350         (WebCore::CSSCalcBinaryOperation::create): Take RefPtr&& instead of PassRefPtr.
2351         Also added some checks for null. Code here is really inconsistent about null;
2352         probably should change from RefPtr to Ref at some point.
2353         (WebCore::CSSCalcBinaryOperation::createSimplified): Ditto.
2354         (WebCore::CSSCalcBinaryOperation::CSSCalcBinaryOperation): Take Ref&& instead
2355         of PassRefPtr.
2356
2357         * css/CSSCrossfadeValue.cpp:
2358         (WebCore::subimageKnownToBeOpaque): Take a reference instead of a pointer.
2359         (WebCore::CSSCrossfadeValue::SubimageObserver::SubimageObserver): Moved here
2360         from the header, and renamed.
2361         (WebCore::CSSCrossfadeValue::SubimageObserver::imageChanged): Ditto.
2362         (WebCore::CSSCrossfadeValue::CSSCrossfadeValue): Moved here from the header.
2363         (WebCore::CSSCrossfadeValue::create): Ditto.
2364         (WebCore::CSSCrossfadeValue::~CSSCrossfadeValue): Updated for data member name change.
2365         (WebCore::CSSCrossfadeValue::fixedSize): Take a reference. Also rewrote size math to
2366         take advantage of FloatSize multiplication and addition operators.
2367         (WebCore::CSSCrossfadeValue::knownToBeOpaque): Take a reference.
2368         (WebCore::CSSCrossfadeValue::loadSubimages): Set m_subimagesAreReady rather than
2369         calling setReady on the subimage observer.
2370         (WebCore::CSSCrossfadeValue::image): Return a raw pointer rather than a RefPtr.
2371         Take a reference instead of a pointer.
2372         (WebCore::CSSCrossfadeValue::crossfadeChanged): Removed unused rect argument.
2373         Rewrote to use modern for loop.
2374         * css/CSSCrossfadeValue.h: Updated for above changes.
2375
2376         * css/CSSGradientValue.cpp:
2377         (WebCore::createGradient): Added. Helper so the function below can use Ref rather
2378         than RefPtr, and it's also nice to factor out this "poor man's virtual function".
2379         (WebCore::CSSGradientValue::image): Take a reference rather than a pointer.
2380         (WebCore::clone): Added. Helper like createGradient above.
2381         (WebCore::CSSGradientValue::gradientWithStylesResolved): Take a reference rather
2382         than a pointer. Simplified by using the helper above.
2383         (WebCore::CSSGradientValue::knownToBeOpaque): Removed unused argument. Rewrote to
2384         use a modern for loop.
2385         * css/CSSGradientValue.h: Updated for above changes.
2386
2387         * css/CSSImageGeneratorValue.cpp: Moved the CachedGeneratedImage class in here
2388         from the header. Also changed it to use const and Ref.
2389         (WebCore::CSSImageGeneratorValue::addClient): Take a reference rather than a pointer.
2390         (WebCore::CSSImageGeneratorValue::removeClient): Ditto.
2391         (WebCore::CSSImageGeneratorValue::cachedImageForSize): Updated since image now returns
2392         a reference rather than a pointer.
2393         (WebCore::CSSImageGeneratorValue::saveCachedImageForSize): Take a reference rather
2394         than PassRefPtr.
2395         (WebCore::CSSImageGeneratorValue::image): Take a reference rather than a pointer.
2396         (WebCore::CSSImageGeneratorValue::fixedSize): Ditto.
2397         (WebCore::CSSImageGeneratorValue::knownToBeOpaque): Ditto.
2398         * css/CSSImageGeneratorValue.h: Updated for above changes.
2399
2400         * css/CSSValuePool.cpp:
2401         (WebCore::CSSValuePool::createFontFaceValue): Return a RefPtr rather than PassRefPtr.
2402         * css/CSSValuePool.h: Updated for the above.
2403
2404         * css/StyleBuilderConverter.h: Change convertStyleImage and convertShapeValue to
2405         return RefPtr instead of PassRefPtr.
2406
2407         * css/StyleBuilderCustom.h:
2408         (WebCore::StyleBuilderCustom::applyValueContent): Since gradientWithStylesResolved
2409         returns a Ref now, no need to dereference it any more. This also removes reference
2410         count churn since we are now passing a Ref temporary to a Ref&&.
2411         * css/StyleResolver.cpp:
2412         (WebCore::StyleResolver::styleImage): Ditto.
2413
2414         * platform/graphics/GradientImage.cpp:
2415         (WebCore::GradientImage::GradientImage): Pass generator as a reference rather than
2416         as a PassRefPtr.
2417         (WebCore::GradientImage::draw): Updated since m_gradient is now a Ref rather than
2418         a RefPtr.
2419         (WebCore::GradientImage::drawPattern): Ditto.
2420         * platform/graphics/GradientImage.h: Updated for the above changes. Make things
2421         private rather than protected since this class is final.
2422
2423         * rendering/style/StyleGeneratedImage.cpp:
2424         (WebCore::StyleGeneratedImage::imageSize): Pass renderer as a reference. Later, we
2425         should change the interface to this function, too.
2426         (WebCore::StyleGeneratedImage::addClient): Ditto.
2427         (WebCore::StyleGeneratedImage::removeClient): Ditto.
2428         (WebCore::StyleGeneratedImage::image): Ditto.
2429         (WebCore::StyleGeneratedImage::knownToBeOpaque): Ditto.
2430
2431 2016-12-30  Olivier Blin  <olivier.blin@softathome.com>
2432
2433         [EFL] fix buffer over-read in RenderThemeEfl::mediaControlsStyleSheet()
2434         https://bugs.webkit.org/show_bug.cgi?id=166622
2435
2436         Reviewed by Gyuyoung Kim.
2437
2438         This has been detected by a charactersAreAllASCII() assert failure.
2439         Initially in WebKitForWayland (WPE), but the code was likely borrowed from EFL.
2440
2441         This is because ASCIILiteral() is wrongly used in mediaControlsStyleSheet().
2442         mediaControlsBaseUserAgentStyleSheet is a char array, not a null-terminated string.
2443         It is thus incorrect to use StringImpl::createFromLiteral() that calls
2444         strlen() to get the string length.
2445
2446         The String::ConstructFromLiteral constructor can not be used, since it
2447         skips the last character.
2448
2449         * rendering/RenderThemeEfl.cpp:
2450         (WebCore::RenderThemeEfl::mediaControlsStyleSheet):
2451         Explicitely pass the size to the String constructor.
2452
2453 2016-12-30  Commit Queue  <commit-queue@webkit.org>
2454
2455         Unreviewed, rolling out r210206.
2456         https://bugs.webkit.org/show_bug.cgi?id=166621
2457
2458         Crashes on macOS PLT (Requested by kling on #webkit).
2459
2460         Reverted changeset:
2461
2462         "Drop the render tree for documents in the page cache."
2463         https://bugs.webkit.org/show_bug.cgi?id=121798
2464         http://trac.webkit.org/changeset/210206
2465
2466 2016-12-28  Sergio Villar Senin  <svillar@igalia.com>
2467
2468         [css-grid] Isolate instrinsic size computation from layout
2469         https://bugs.webkit.org/show_bug.cgi?id=166530
2470
2471         Reviewed by Darin Adler.
2472
2473         This is the last patch of the items placement data refactoring. By using a different Grid
2474         instance in computeIntrinsicLogicalWidths we effectively isolate the intrinsic size
2475         computation from the layout. They are now using different data structures so they don't
2476         interfere each other.
2477
2478         This also means that we no longer reuse the placement of items done in the intrinsic size
2479         computation. That shouldn't be a big issue once we make m_grid persistent on RenderGrid.
2480
2481         Last but not least, this patch finally removes the ugly const_cast's we had in
2482         computeIntrinsicLogicalWidths() as we no longer modify the internal state of RenderGrid.
2483
2484         Tests: fast/css-grid-layout/grid-auto-repeat-intrinsic.html
2485                fast/css-grid-layout/grid-change-intrinsic-size-with-auto-repeat-tracks.html
2486
2487         * rendering/RenderGrid.cpp:
2488         (WebCore::RenderGrid::computeIntrinsicLogicalWidths): Use a new instance of Grid.
2489         (WebCore::RenderGrid::computeEmptyTracksForAutoRepeat): Fixed a missing m_grid -> grid
2490         rename.
2491         (WebCore::RenderGrid::placeItemsOnGrid): Constify it. It nows repositions the items if the
2492         number of auto repeat tracks has changed.
2493         * rendering/RenderGrid.h:
2494
2495 2016-12-30  Michael Catanzaro  <mcatanzaro@igalia.com>
2496
2497         [GTK] Improve user agent construction
2498         https://bugs.webkit.org/show_bug.cgi?id=142074
2499
2500         Reviewed by Carlos Garcia Campos.
2501
2502         Using the macOS quirk rather than the Chrome quirk for Google domains was a mistake: it
2503         broke Hangouts in a different way than the Chrome quirk, and also prevents use of the nice
2504         Earth mode on Google Maps. Google is making it really hard to develop a sane quirk.
2505         Eventually I settled on the combination of two quirks: (1) Firefox browser, and (2) Linux
2506         x86_64 platform. See the bug for full discussion on why these quirks are the best way to
2507         make Google domains work properly in WebKit. This is an extremely sad state of affairs, but
2508         I'm confident it is the best option. Note this effectively includes a rollout of r210168.
2509
2510         Also, fix a bug that caused an extra space to be inserted in the middle of the user agent.
2511
2512         * platform/UserAgentQuirks.cpp:
2513         (WebCore::isGoogle):
2514         (WebCore::urlRequiresFirefoxBrowser):
2515         (WebCore::urlRequiresMacintoshPlatform):
2516         (WebCore::urlRequiresLinuxDesktopPlatform):
2517         (WebCore::UserAgentQuirks::quirksForURL):
2518         (WebCore::UserAgentQuirks::stringForQuirk):
2519         (WebCore::UserAgentQuirks::firefoxRevisionString):
2520         * platform/UserAgentQuirks.h:
2521         * platform/gtk/UserAgentGtk.cpp:
2522         (WebCore::buildUserAgentString):
2523
2524 2016-12-30  Andreas Kling  <akling@apple.com>
2525
2526         Drop the render tree for documents in the page cache.
2527         <https://webkit.org/b/121798>
2528
2529         Reviewed by Darin Adler.
2530
2531         To save memory and reduce complexity, have documents tear down their render tree
2532         when entering the page cache. I've wanted to do this for a long time and it seems
2533         like we can actually do it now.
2534
2535         This patch will enable a number of clean-ups since it's no longer valid for renderers
2536         to exist while the document is in page cache.
2537
2538         * dom/Document.cpp:
2539         (WebCore::Document::destroyRenderTree): Remove assertion that we're not in the page cache
2540         since we will now be tearing down render trees right as they enter the page cache.
2541
2542         (WebCore::Document::setPageCacheState): Tear down the render tree right before setting
2543         the in-cache flag. From now on, there should not exist render objects for documents in
2544         the page cache.
2545
2546         * history/CachedFrame.cpp:
2547         (WebCore::CachedFrameBase::restore):
2548         * page/FrameView.h:
2549         * page/FrameView.cpp:
2550         (WebCore::FrameView::didRestoreFromPageCache): Update the scollable area set after restoring a
2551         frame from the page cache. This dirties the scrolling tree, which was covered by tests.
2552
2553         * page/animation/AnimationBase.cpp:
2554         (WebCore::AnimationBase::setNeedsStyleRecalc): Make this a no-op if the render tree is being
2555         torn down. This fixes assertions firing on animation tests.
2556
2557 2016-12-29  Chris Fleizach  <cfleizach@apple.com>
2558
2559         AX: Need to expose frames to iOS Accessibility
2560         https://bugs.webkit.org/show_bug.cgi?id=166571
2561         <rdar://problem/29823724>
2562
2563         Reviewed by Darin Adler.
2564
2565         To support navigation by frame for VoiceOver on iOS, we need to expose the frame ancestor. 
2566
2567         * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm:
2568         (-[WebAccessibilityObjectWrapper _accessibilityFrameAncestor]):
2569
2570 2016-12-09  Sergio Villar Senin  <svillar@igalia.com>
2571
2572         [css-grid] Move Grid into GridSizingData
2573         https://bugs.webkit.org/show_bug.cgi?id=165654
2574
2575         Reviewed by Darin Adler.
2576
2577         The grid track sizing algorithm has been using the m_grid attribute from RenderGrid to
2578         compute the sizes of the tracks unconditionally. However the goal is to make it work against
2579         a generic instance of the Grid class, so that the intrinsic size computation and the layout
2580         processes could be effectively decoupled.
2581
2582         Instead of passing the Grid as a new argument to all the track sizing algorithm methods we
2583         leverage the existence of GridSizingData which is already passed to all of them. This data
2584         structure holds from now on a reference to the Grid instance so that the track sizing
2585         algorithm could use it.
2586
2587         No new tests as this is a refactoring.
2588
2589         * rendering/RenderGrid.cpp:
2590         (WebCore::RenderGrid::GridSizingData::GridSizingData):
2591         (WebCore::RenderGrid::GridSizingData::grid):
2592         (WebCore::RenderGrid::computeTrackBasedLogicalHeight):
2593         (WebCore::RenderGrid::computeTrackSizesForDirection):
2594         (WebCore::RenderGrid::repeatTracksSizingIfNeeded):
2595         (WebCore::RenderGrid::layoutBlock):
2596         (WebCore::RenderGrid::guttersSize):
2597         (WebCore::RenderGrid::computeIntrinsicLogicalWidths):
2598         (WebCore::RenderGrid::computeIntrinsicLogicalHeight):
2599         (WebCore::RenderGrid::computeUsedBreadthOfGridTracks):
2600         (WebCore::RenderGrid::computeFlexSizedTracksGrowth):
2601         (WebCore::RenderGrid::computeFlexFactorUnitSize):
2602         (WebCore::RenderGrid::findFlexFactorUnitSize):
2603         (WebCore::RenderGrid::rawGridTrackSize):
2604         (WebCore::RenderGrid::gridTrackSize):
2605         (WebCore::RenderGrid::spanningItemCrossesFlexibleSizedTracks):
2606         (WebCore::RenderGrid::resolveContentBasedTrackSizingFunctions):
2607         (WebCore::RenderGrid::resolveContentBasedTrackSizingFunctionsForNonSpanningItems):
2608         (WebCore::RenderGrid::resolveContentBasedTrackSizingFunctionsForItems):
2609         (WebCore::RenderGrid::tracksAreWiderThanMinTrackBreadth):
2610         (WebCore::RenderGrid::trackSizesForComputedStyle):
2611         (WebCore::RenderGrid::applyStretchAlignmentToTracksIfNeeded):
2612         (WebCore::RenderGrid::layoutGridItems):
2613         (WebCore::RenderGrid::offsetAndBreadthForPositionedChild):
2614         (WebCore::RenderGrid::assumedRowsSizeForOrthogonalChild):
2615         (WebCore::RenderGrid::gridAreaBreadthForChild):
2616         (WebCore::RenderGrid::gridAreaBreadthForChildIncludingAlignmentOffsets):
2617         (WebCore::RenderGrid::populateGridPositionsForDirection):
2618         (WebCore::RenderGrid::columnAxisOffsetForChild):
2619         (WebCore::RenderGrid::rowAxisOffsetForChild):
2620         (WebCore::RenderGrid::findChildLogicalPosition):
2621         (WebCore::RenderGrid::numTracks):
2622         (WebCore::RenderGrid::paintChildren):
2623         * rendering/RenderGrid.h:
2624
2625 2016-12-27  Michael Catanzaro  <mcatanzaro@igalia.com>
2626
2627         [GTK] Improve user agent construction
2628         https://bugs.webkit.org/show_bug.cgi?id=142074
2629
2630         Reviewed by Carlos Garcia Campos.
2631
2632         Use the macOS rather than the Chrome quirk for Google domains, to avoid problems with
2633         Google Calendar and Google Maps.
2634
2635         * platform/UserAgentQuirks.cpp:
2636         (WebCore::urlRequiresChromeBrowser):
2637         (WebCore::urlRequiresMacintoshPlatform):
2638
2639 2016-12-26  Zalan Bujtas  <zalan@apple.com>
2640
2641         ASSERTION FAILED: !rect.isEmpty() in WebCore::GraphicsContext::drawRect
2642         https://bugs.webkit.org/show_bug.cgi?id=163461
2643
2644         Reviewed by Darin Adler.
2645
2646         Make sure we don't paint empty rects.
2647
2648         Test: fast/lists/assert-on-empty-list-marker.html
2649
2650         * rendering/RenderListMarker.cpp:
2651         (WebCore::RenderListMarker::paint):
2652
2653 2016-12-25  Chris Fleizach  <cfleizach@apple.com>
2654
2655         AX: Headers of table not read by VoiceOver
2656         https://bugs.webkit.org/show_bug.cgi?id=158693
2657         <rdar://problem/26771065>
2658
2659         Reviewed by Darin Adler.
2660
2661         If a table cell header is hidden, by pushing off screen then the content won't be accessible.
2662         It seems that unless specifically requested (such as using aria-hidden), we should try to return
2663         that table cell header.
2664
2665         Test: accessibility/hidden-th-still-column-header.html
2666
2667         * accessibility/AccessibilityTableColumn.cpp:
2668         (WebCore::AccessibilityTableColumn::headerObjectForSection):
2669
2670 2016-12-25  Yusuke Suzuki  <utatane.tea@gmail.com>
2671
2672         Propagate the source origin as much as possible
2673         https://bugs.webkit.org/show_bug.cgi?id=166348
2674
2675         Reviewed by Darin Adler.
2676
2677         * bindings/js/CachedScriptSourceProvider.h:
2678         (WebCore::CachedScriptSourceProvider::CachedScriptSourceProvider):
2679         * bindings/js/JSLazyEventListener.cpp:
2680         (WebCore::JSLazyEventListener::initializeJSFunction):
2681         * bindings/js/ScriptSourceCode.h:
2682         (WebCore::ScriptSourceCode::ScriptSourceCode):
2683         * bridge/NP_jsobject.cpp:
2684         (_NPN_Evaluate):
2685         * bridge/objc/WebScriptObject.mm:
2686         (-[WebScriptObject evaluateWebScript:]):
2687
2688 2016-12-24  Sam Weinig  <sam@webkit.org>
2689
2690         [WebIDL] Remove (most) custom bindings for the IndexedDB code
2691         https://bugs.webkit.org/show_bug.cgi?id=166451
2692
2693         Reviewed by Darin Adler.
2694
2695         Removes the custom bindings for all but one attribute (IDBRequest.result) in
2696         the IndexedDB code.
2697         - Adds a new WebIDL extension type, IDBKey, to represent the complex key conversion
2698           rules IndexedDB specifies.
2699         - Replaces custom bindings for IDBCursor.source with use of a union.
2700         - Replaces custom enum type checking for IDBCursor.direction with a WebIDL enum.
2701         - Replaces custom code generation for IDBKeyPaths with a union.
2702
2703         * CMakeLists.txt:
2704         * DerivedSources.make:
2705         * WebCore.xcodeproj/project.pbxproj:
2706         Add new files.
2707
2708         * Modules/indexeddb/IDBCursor.cpp:
2709         (WebCore::IDBCursor::source):
2710         (WebCore::IDBCursor::direction):
2711         (WebCore::IDBCursor::directionNext): Deleted.
2712         (WebCore::IDBCursor::directionNextUnique): Deleted.
2713         (WebCore::IDBCursor::directionPrev): Deleted.
2714         (WebCore::IDBCursor::directionPrevUnique): Deleted.
2715         (WebCore::IDBCursor::stringToDirection): Deleted.
2716         (WebCore::IDBCursor::directionToString): Deleted.
2717         * Modules/indexeddb/IDBCursor.h:
2718         (WebCore::IDBCursor::objectStore): Deleted.
2719         (WebCore::IDBCursor::index): Deleted.
2720         Replace custom enum checking with direct use of the enum, letting the generator
2721         handle the checks. Also adds source function which returns a Variant.
2722
2723         * Modules/indexeddb/IDBCursor.idl:
2724         Remove custom annotation and use correct types.
2725
2726         * Modules/indexeddb/IDBCursorDirection.h: Added.
2727         * Modules/indexeddb/IDBCursorDirection.idl: Added.
2728
2729         * Modules/indexeddb/IDBIndex.cpp:
2730         (WebCore::IDBIndex::openCursor):
2731         (WebCore::IDBIndex::openKeyCursor):
2732         * Modules/indexeddb/IDBIndex.h:
2733         * Modules/indexeddb/IDBIndex.idl:
2734         * Modules/indexeddb/IDBObjectStore.cpp:
2735         (WebCore::IDBObjectStore::openCursor):
2736         (WebCore::IDBObjectStore::openKeyCursor):
2737         * Modules/indexeddb/IDBObjectStore.h:
2738         * Modules/indexeddb/IDBObjectStore.idl:
2739         Replace Strings with IDBCursorDirection enums.
2740
2741         * Modules/indexeddb/IDBKeyRange.idl:
2742         Remove annotation and use new IDBKey extension type.
2743
2744         * Modules/indexeddb/IDBOpenDBRequest.cpp:
2745         (WebCore::IDBOpenDBRequest::onSuccess):
2746         (WebCore::IDBOpenDBRequest::onUpgradeNeeded):
2747         (WebCore::IDBOpenDBRequest::onDeleteDatabaseSuccess):
2748         Use ReadyState enum in place of the old m_isDone boolean.
2749
2750         * Modules/indexeddb/IDBRequest.cpp:
2751         (WebCore::IDBRequest::IDBRequest):
2752         (WebCore::IDBRequest::error):
2753         (WebCore::IDBRequest::source):
2754         (WebCore::IDBRequest::dispatchEvent):
2755         (WebCore::IDBRequest::willIterateCursor):
2756         (WebCore::IDBRequest::completeRequestAndDispatchEvent):
2757         (WebCore::IDBRequest::readyState): Deleted.
2758         * Modules/indexeddb/IDBRequest.h:
2759         (WebCore::IDBRequest::readyState):
2760         (WebCore::IDBRequest::isDone):
2761         (WebCore::IDBRequest::objectStoreSource): Deleted.
2762         (WebCore::IDBRequest::indexSource): Deleted.
2763         (WebCore::IDBRequest::cursorSource): Deleted.
2764         * Modules/indexeddb/IDBRequest.idl:
2765         Replace the readyState String with a enum, and the custom source binding with a
2766         source function that returns a Variant.
2767
2768         * Modules/indexeddb/IndexedDB.h:
2769         Add the missing values to CursorDirection to make it comply with the IDL definition.
2770
2771         * bindings/generic/IDLTypes.h:
2772         * bindings/js/JSDOMConvert.h:
2773         (WebCore::JSConverter<IDLIDBKey<T>>::convert):
2774         Add new extension type IDLIDBKey.
2775
2776         * bindings/js/JSIDBCursorCustom.cpp:
2777         (WebCore::JSIDBCursor::source): Deleted.
2778         * bindings/js/JSIDBRequestCustom.cpp:
2779         (WebCore::JSIDBRequest::source): Deleted.
2780         Remove custom bindings.
2781
2782         * bindings/scripts/CodeGenerator.pm:
2783         (IsBuiltinType):
2784         * bindings/scripts/CodeGeneratorJS.pm:
2785         (GetBaseIDLType):
2786         (NativeToJSValueDOMConvertNeedsState):
2787         (NativeToJSValueDOMConvertNeedsGlobalObject):
2788         (NativeToJSValue):
2789         Add support for IDBKey, and remove custom code for IndexedDB in core conversion logic.
2790
2791         * bindings/scripts/IDLAttributes.txt:
2792         Remove now unused ImplementationReturnType attribute.
2793
2794         * inspector/InspectorIndexedDBAgent.cpp:
2795         Update to work with new functions taking enums rather than strings.
2796
2797 2016-12-23  Simon Fraser  <simon.fraser@apple.com>
2798
2799         REGRESSION (r209299): Selection is broken when you zoom in webpage using trackpad
2800         https://bugs.webkit.org/show_bug.cgi?id=166472
2801         rdar://problem/29675551
2802
2803         Reviewed by Tim Horton.
2804
2805         r209299 broke autoscroll in zoomed pages because it changed RenderLayer::scrollRectToVisible()
2806         to shrink viewRect by page scale. This is incorrect for all callers of scrollRectToVisible, since
2807         the "absoluteRect" passed in is actually in zoomed document coordinates for all the callers I tested.
2808
2809         This code is also fixed to account for headers and footers. getRectToExpose() takes rectangles
2810         in "scroll view contents" coordinates (i.e. including header, and zoomed document), so doesn't need
2811         the separate visibleRectRelativeToDocument parameter.
2812
2813         Tests: fast/events/autoscroll-main-document.html
2814                fast/events/autoscroll-when-zoomed.html
2815                fast/events/drag-select-when-zoomed-with-header.html
2816                fast/events/drag-select-when-zoomed.html
2817                fast/scrolling/scroll-to-anchor-zoomed-header.html
2818
2819         * rendering/RenderLayer.cpp:
2820         (WebCore::RenderLayer::scrollRectToVisible):
2821         (WebCore::RenderLayer::getRectToExpose):
2822         * rendering/RenderLayer.h:
2823
2824 2016-12-24  Zalan Bujtas  <zalan@apple.com>
2825
2826         RenderBlockFlow::moveFloatsTo does not move floats.
2827         https://bugs.webkit.org/show_bug.cgi?id=166467
2828
2829         Reviewed by Darin Adler.
2830
2831         RenderBlockFlow::moveFloatsTo name is misleading. Floats are not moved from "this" to
2832         the new RenderBlockFlow parent, but rather they are copied so that overhanging floats
2833         don't get lost.
2834
2835         Covered by existing tests.
2836
2837         * rendering/FloatingObjects.cpp:
2838         (WebCore::FloatingObject::cloneForNewParent):
2839         (WebCore::FloatingObject::unsafeClone): Deleted.
2840         * rendering/FloatingObjects.h:
2841         * rendering/RenderBlockFlow.cpp:
2842         (WebCore::RenderBlockFlow::addFloatsToNewParent):
2843         (WebCore::RenderBlockFlow::moveAllChildrenIncludingFloatsTo):
2844         (WebCore::RenderBlockFlow::moveFloatsTo): Deleted.
2845         * rendering/RenderBlockFlow.h:
2846         * rendering/RenderRubyBase.cpp:
2847         (WebCore::RenderRubyBase::mergeChildrenWithBase):
2848         * rendering/RenderRubyBase.h:
2849         * rendering/RenderRubyRun.cpp:
2850         (WebCore::RenderRubyRun::removeChild):
2851
2852 2016-12-23  Andreas Kling  <akling@apple.com>
2853
2854         REGRESSION(r209865): Crash when navigating back to some pages with compositing layers.
2855         <https://webkit.org/b/166469>
2856         <rdar://problem/29109053>
2857
2858         Reviewed by Darin Adler.
2859
2860         Remove the old WK1-era clear/restoreBackingStores optimization from the page cache.
2861         When enabling it on non-iOS platforms, we started hitting lots of assertions,
2862         and none of our memory tests showed any significant improvement anyway.
2863
2864         Test: compositing/page-cache-back-crash.html
2865
2866         * history/CachedFrame.cpp:
2867         (WebCore::CachedFrameBase::CachedFrameBase):
2868         (WebCore::CachedFrameBase::restore):
2869         (WebCore::CachedFrame::CachedFrame):
2870         * history/CachedFrame.h:
2871         * page/FrameView.cpp:
2872         (WebCore::FrameView::restoreBackingStores): Deleted.
2873         * page/FrameView.h:
2874
2875 2016-12-23  Sam Weinig  <sam@webkit.org>
2876
2877         Add missing std::optional to ApplePayPaymentRequest.lineItems
2878         https://bugs.webkit.org/show_bug.cgi?id=166468
2879
2880         Reviewed by Alexey Proskuryakov.
2881
2882         No functional change, but is more consistent.
2883
2884         * Modules/applepay/ApplePayPaymentRequest.h:
2885         Remove unnecessary #include of <heap/Strong.h>, add std::optional to lineItems.
2886
2887         * Modules/applepay/ApplePaySession.cpp:
2888         (WebCore::convertAndValidate):
2889         Update to deal with optional line items, remove unnecessary comment.
2890
2891         * Modules/applepay/ApplePaySession.h:
2892         Remove unneeded forward declarations.
2893
2894 2016-12-22  Sam Weinig  <sam@webkit.org>
2895
2896         [WebIDL] Remove custom bindings for WebSQL code
2897         https://bugs.webkit.org/show_bug.cgi?id=166441
2898
2899         Reviewed by Darin Adler.
2900
2901         - Replace custom variant type SQLValue with a type alias of a Variant.
2902         - Use the newly representable SQLValue to remove custom bindings for 
2903           SQLResultSetRowList::item and SQLTransaction::executeSql.
2904
2905         * CMakeLists.txt:
2906         * WebCore.xcodeproj/project.pbxproj:
2907         * bindings/js/JSBindingsAllInOne.cpp:
2908         * bindings/js/JSSQLResultSetRowListCustom.cpp: Removed.
2909         * bindings/js/JSSQLTransactionCustom.cpp: Removed.
2910         * platform/sql/SQLValue.cpp: Removed.
2911         Remove files.
2912
2913         * Modules/webdatabase/SQLResultSetRowList.cpp:
2914         (WebCore::SQLResultSetRowList::length):
2915         (WebCore::SQLResultSetRowList::item):
2916         * Modules/webdatabase/SQLResultSetRowList.h:
2917         * Modules/webdatabase/SQLResultSetRowList.idl:
2918         Sink the implementation of item() into the implementation. Use a
2919         record type to bridge to javascript.
2920
2921         * Modules/webdatabase/SQLStatement.cpp:
2922         (WebCore::SQLStatement::SQLStatement):
2923         * Modules/webdatabase/SQLStatement.h:
2924         Update to take arguments by rvalue reference.
2925
2926         * Modules/webdatabase/SQLTransaction.cpp:
2927         (WebCore::SQLTransaction::executeSql):
2928         * Modules/webdatabase/SQLTransaction.h:
2929         * Modules/webdatabase/SQLTransaction.idl:
2930         Remove custom annotation, and update signature to match the IDL.
2931
2932         * Modules/webdatabase/SQLTransactionBackend.cpp:
2933         * Modules/webdatabase/SQLTransactionBackend.h:
2934         Remove unneeded #includes of SQLValue.h
2935
2936         * bindings/js/JSDOMConvert.h:
2937         (WebCore::Converter<IDLNull>::convert):
2938         (WebCore::JSConverter<IDLNull>::convert):
2939         Implement conversion for the null type so it can be used in the SQLValue union.
2940
2941         * inspector/InspectorDatabaseAgent.cpp:
2942         * platform/sql/SQLiteStatement.cpp:
2943         (WebCore::SQLiteStatement::bindValue):
2944         (WebCore::SQLiteStatement::getColumnValue):
2945         * platform/sql/SQLiteStatement.h:
2946         Replace old switch with a WTF::switchOn that operates on the new variant.
2947
2948         * platform/sql/SQLValue.h:
2949         (WebCore::SQLValue::SQLValue): Deleted.
2950         (WebCore::SQLValue::type): Deleted.
2951         Replace implementation with a Variant.
2952
2953 2016-12-22  Michael Catanzaro  <mcatanzaro@igalia.com>
2954
2955         [GTK] GLES build broken since r208997
2956         https://bugs.webkit.org/show_bug.cgi?id=166455
2957
2958         Unreviewed. Fix the preprocessor guards here; this code is incompatible with GLES2.
2959
2960         Looks like it's been broken for a month. Typical!
2961
2962         * platform/graphics/opengl/Extensions3DOpenGLCommon.cpp:
2963         (WebCore::Extensions3DOpenGLCommon::initializeAvailableExtensions):
2964
2965 2016-12-23  Zan Dobersek  <zdobersek@igalia.com>
2966
2967         [EME][GStreamer] Enable various code paths for ENCRYPTED_MEDIA
2968         https://bugs.webkit.org/show_bug.cgi?id=166054
2969
2970         Reviewed by Xabier Rodriguez-Calvar.
2971
2972         Add ENABLE_ENCRYPTED_MEDIA build guards in various places in GStreamer
2973         code to enable decryption-related GStreamer elements and the proper
2974         decryptor handling in AppendPipeline.
2975
2976         * platform/GStreamer.cmake:
2977         * platform/graphics/gstreamer/GStreamerUtilities.cpp:
2978         * platform/graphics/gstreamer/GStreamerUtilities.h:
2979         * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
2980         (WebCore::registerWebKitGStreamerElements):
2981         (WebCore::MediaPlayerPrivateGStreamerBase::handleSyncMessage):
2982         Only call needKey() if LEGACY_ENCRYPTED_MEDIA is enabled, since this is
2983         the way the legacy EME system expects to be notified of key necessity.
2984         It's very likely ENCRYPTED_MEDIA will do this differently.
2985         * platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.cpp:
2986         * platform/graphics/gstreamer/eme/WebKitClearKeyDecryptorGStreamer.h:
2987         * platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.cpp:
2988         * platform/graphics/gstreamer/eme/WebKitCommonEncryptionDecryptorGStreamer.h:
2989         * platform/graphics/gstreamer/mse/AppendPipeline.cpp:
2990         (WebCore::AppendPipeline::parseDemuxerSrcPadCaps):
2991         (WebCore::AppendPipeline::connectDemuxerSrcPadToAppsinkFromAnyThread):
2992         (WebCore::AppendPipeline::disconnectDemuxerSrcPadFromAppsinkFromAnyThread):
2993         * platform/graphics/gstreamer/mse/AppendPipeline.h:
2994
2995 2016-12-23  Ryosuke Niwa  <rniwa@webkit.org>
2996
2997         Eliminate the use of lastChild in TextIterator
2998         https://bugs.webkit.org/show_bug.cgi?id=166456
2999
3000         Reviewed by Antti Koivisto.
3001
3002         Just use the node we just existed in TextIterator::exitNode and in emitting additional new line
3003         to eliminate the use of Node::lastChild.
3004
3005         Also initialize member variables in the declaration instead of the constructor to modernize the code.
3006
3007         * editing/TextIterator.cpp:
3008         (WebCore::TextIterator::TextIterator):
3009         (WebCore::TextIterator::advance):
3010         (WebCore::TextIterator::exitNode):
3011         * editing/TextIterator.h:
3012
3013 2016-12-22  Andy Estes  <aestes@apple.com>
3014
3015         Reduce QuickLook.h include overhead
3016         https://bugs.webkit.org/show_bug.cgi?id=166454
3017
3018         Reviewed by Andreas Kling.
3019
3020         * dom/Document.cpp: Included QuickLook.h for QLPreviewProtocol().
3021         * loader/DocumentLoader.cpp:
3022         (WebCore::DocumentLoader::setQuickLookHandle): Moved from DocumentLoader.h to here.
3023         * loader/DocumentLoader.h: Stopped including QuickLook.h and forward-declared
3024         QuickLookHandle.
3025         (WebCore::DocumentLoader::setQuickLookHandle): Moved definition out-of-line since it
3026         requires QuickLookHandle to be a complete type.
3027         * loader/ios/QuickLook.h: Updated to use #pragma once. Cleaned up includes and forward
3028         declarations.
3029         * platform/network/ResourceHandle.cpp: Included QuickLook.h so that QuickLookHandle is a
3030         complete type in the ResourceHandle constructor.
3031         * platform/network/ResourceHandle.h: Stopped including QuickLook.h and forward-declared
3032         QuickLookHandle.
3033         (WebCore::ResourceHandle::setQuickLookHandle): Moved definition out-of-line since it
3034         requires QuickLookHandle to be a complete type.
3035         * platform/network/mac/ResourceHandleMac.mm:
3036         (WebCore::ResourceHandle::setQuickLookHandle): Moved from ResourceHandle.h to here.
3037         * platform/network/mac/WebCoreResourceHandleAsDelegate.mm: Included QuickLook.h for
3038         QuickLookHandle.
3039
3040 2016-12-22  Andy Estes  <aestes@apple.com>
3041
3042         [iOS] Move QuickLook from WebCore/platform to WebCore/loader
3043         https://bugs.webkit.org/show_bug.cgi?id=166449
3044
3045         Reviewed by Darin Adler.
3046
3047         QuickLook.mm knows about ResourceLoader, so it's a layering violation to have it in
3048         platform/. Move it to loader/ios/.
3049
3050         * WebCore.xcodeproj/project.pbxproj:
3051         * loader/ios/QuickLook.h: Renamed from Source/WebCore/platform/network/ios/QuickLook.h.
3052         * loader/ios/QuickLook.mm: Renamed from Source/WebCore/platform/network/ios/QuickLook.mm.
3053
3054 2016-12-22  Michael Catanzaro  <mcatanzaro@igalia.com>
3055
3056         Unreviewed, fix unused parameter warning in GLES build
3057
3058         Looks like it's been here since 2012. Impressive!
3059
3060         * platform/graphics/opengl/GraphicsContext3DOpenGLES.cpp:
3061         (WebCore::GraphicsContext3D::resolveMultisamplingIfNecessary):
3062
3063 2016-12-22  Alex Christensen  <achristensen@webkit.org>
3064
3065         Move GraphicsContext3DWin to GraphicsContext3DOpenGLES
3066         https://bugs.webkit.org/show_bug.cgi?id=166425
3067
3068         Reviewed by Tim Horton.
3069
3070         Move code which is GLES-specific not Windows-specific to the GLES-specific file
3071         so I can use it on Cocoa, with a temporary PLATFORM macro that I plan to remove once
3072         all platforms use ANGLE's GLES implementation. There is another copy of this code in
3073         GraphicsContext3DCairo, which will also be united with this code here soon.
3074         Also remove the PlatformCALayerWin, which was never used for anything.
3075
3076         * platform/graphics/opengl/GraphicsContext3DOpenGLES.cpp:
3077         (WebCore::GraphicsContext3D::create):
3078         (WebCore::GraphicsContext3D::GraphicsContext3D):
3079         (WebCore::GraphicsContext3D::~GraphicsContext3D):
3080         (WebCore::GraphicsContext3D::setContextLostCallback):
3081         (WebCore::GraphicsContext3D::setErrorMessageCallback):
3082         (WebCore::GraphicsContext3D::makeContextCurrent):
3083         (WebCore::GraphicsContext3D::checkGPUStatusIfNecessary):
3084         (WebCore::GraphicsContext3D::platformGraphicsContext3D):
3085         (WebCore::GraphicsContext3D::platformTexture):
3086         (WebCore::GraphicsContext3D::isGLES2Compliant):
3087         (WebCore::GraphicsContext3D::platformLayer):
3088         * platform/graphics/win/GraphicsContext3DWin.cpp: Removed.
3089         * PlatformMac.cmake:
3090         Include the egl directory.  I'll need this, too, once Mac starts using ANGLE's EGL implementation.
3091
3092 2016-12-22  Brent Fulgham  <bfulgham@apple.com>
3093
3094         Nested calls to setDocument can omit firing 'unload' events
3095         https://bugs.webkit.org/show_bug.cgi?id=166422
3096         <rdar://problem/29763012>
3097
3098         Reviewed by Alex Christensen.
3099
3100         Test: fast/loader/nested-document-handling.html
3101
3102         Only allow a single document change to be taking place during a given runloop cycle.
3103
3104         * bindings/js/ScriptController.cpp:
3105         (WebCore::ScriptController::executeIfJavaScriptURL): Block script changing the document
3106         when we are in the middle of changing the document.
3107         * page/Frame.cpp:
3108         (WebCore::Frame::setDocument): Keep track of document change state.
3109         * page/Frame.h:
3110
3111 2016-12-22  Tim Horton  <timothy_horton@apple.com>
3112
3113         TileGrid creates new cohorts even when not using temporarilyRetainTileCohorts mode
3114         https://bugs.webkit.org/show_bug.cgi?id=166440
3115
3116         Reviewed by Simon Fraser.
3117
3118         No new tests.
3119
3120         * platform/graphics/ca/TileGrid.cpp:
3121         (WebCore::TileGrid::revalidateTiles):
3122         If we are not temporarily retaining unparented tile cohorts (e.g. on
3123         iOS WebKit2), instead immediately removing all tiles that would go into
3124         the new cohort, avoid starting the cohort at all.
3125
3126 2016-12-22  Zalan Bujtas  <zalan@apple.com>
3127
3128         Do not destroy the RenderNamedFlowFragment as leftover anonymous block.
3129         https://bugs.webkit.org/show_bug.cgi?id=166436
3130         rdar://problem/29772233
3131
3132         Reviewed by Simon Fraser.
3133
3134         When as the result of certain style change, the generated anonymous block is not needed anymore, we
3135         move its descendants up to the parent and destroy the generated box. While RenderNamedFlowFragment is a generated
3136         block, the cleanup code should just ignore it the same way we ignore boxes like multicolumn, mathml etc. 
3137
3138         Test: fast/regions/flow-fragment-as-anonymous-block-crash.html
3139
3140         * rendering/RenderObject.h:
3141         (WebCore::RenderObject::isAnonymousBlock):
3142
3143 2016-12-22  Wenson Hsieh  <wenson_hsieh@apple.com>
3144
3145         CSS Scroll Snap does not work if scrollbar is hidden
3146         https://bugs.webkit.org/show_bug.cgi?id=160442
3147         <rdar://problem/23317034>
3148
3149         Reviewed by Simon Fraser.
3150
3151         Currently, the only reason scroll snapping works in overflow scrolling containers without forcing layout is
3152         because we would initialize the scrolling container's ScrollAnimator in the process of updating scrollbars. If
3153         there are no scrollbars to render, we won't bother creating a ScrollAnimator. Without an existing
3154         ScrollAnimator, ScrollableArea::updateScrollSnapState will simply bail instead of setting up the scroll snap
3155         state. Instead, we should take setting a non-empty vector of scroll offsets on the ScrollableArea as a cue that
3156         the ScrollableArea also needs a ScrollAnimator, and initialize it there if necessary.
3157
3158         Test: tiled-drawing/scrolling/scroll-snap/scroll-snap-mandatory-hidden-scrollbars.html
3159
3160         * platform/ScrollableArea.cpp:
3161         (WebCore::ScrollableArea::setHorizontalSnapOffsets):
3162         (WebCore::ScrollableArea::setVerticalSnapOffsets):
3163
3164 2016-12-22  Daniel Bates  <dabates@apple.com>
3165
3166         Bypass pop-up blocker from cross-origin or sandboxed frame
3167         https://bugs.webkit.org/show_bug.cgi?id=166290
3168         <rdar://problem/29742039>
3169
3170         Reviewed by Darin Adler.
3171
3172         Tests: fast/events/popup-blocked-from-sandboxed-frame-via-window-open-named-sibling-frame.html
3173                fast/events/popup-blocked-from-sandboxed-frame-via-window-open-named-sibling-frame2.html
3174                fast/events/popup-blocked-from-unique-frame-via-window-open-named-sibling-frame.html
3175
3176         * page/DOMWindow.cpp:
3177         (WebCore::DOMWindow::open): Use FrameLoader::findFrameForNavigation() to find the
3178         target frame to navigate with respect to the active document just as we do in WebCore::createWindow().
3179
3180 2016-12-22  Andy Estes  <aestes@apple.com>
3181
3182         Make WebCore::EditorInsertAction an enum class
3183         https://bugs.webkit.org/show_bug.cgi?id=166424
3184
3185         Reviewed by Brent Fulgham.
3186
3187         * editing/AlternativeTextController.cpp:
3188         (WebCore::AlternativeTextController::applyDictationAlternative):
3189         * editing/Editor.cpp:
3190         (WebCore::Editor::pasteAsPlainTextWithPasteboard):
3191         (WebCore::Editor::shouldInsertText):
3192         (WebCore::Editor::insertTextWithoutSendingTextEvent):
3193         (WebCore::Editor::insertLineBreak):
3194         (WebCore::Editor::insertParagraphSeparator):
3195         (WebCore::Editor::markMisspellingsAfterTypingToWord):
3196         (WebCore::Editor::markAndReplaceFor):
3197         (WebCore::Editor::changeBackToReplacedString):
3198         (WebCore::Editor::transpose):
3199         (WebCore::Editor::handleAcceptedCandidate):
3200         * editing/EditorInsertAction.h:
3201         (): Deleted.
3202         * editing/gtk/EditorGtk.cpp:
3203         (WebCore::Editor::pasteWithPasteboard):
3204         * editing/ios/EditorIOS.mm:
3205         (WebCore::Editor::pasteWithPasteboard):
3206         (WebCore::Editor::replaceSelectionWithAttributedString):
3207         * editing/mac/EditorMac.mm:
3208         (WebCore::Editor::pasteWithPasteboard):
3209         (WebCore::Editor::replaceNodeFromPasteboard):
3210         (WebCore::Editor::replaceSelectionWithAttributedString):
3211         * editing/win/EditorWin.cpp:
3212         (WebCore::Editor::pasteWithPasteboard):
3213         * page/ContextMenuController.cpp:
3214         (WebCore::insertUnicodeCharacter):
3215         (WebCore::ContextMenuController::contextMenuItemSelected):
3216         * page/DragController.cpp:
3217         (WebCore::DragController::concludeEditDrag):
3218
3219 2016-12-22  Jer Noble  <jer.noble@apple.com>
3220
3221         Only include those parts of AVFoundation.framework which are strictly needed.
3222         https://bugs.webkit.org/show_bug.cgi?id=166423
3223
3224         Reviewed by Eric Carlson.
3225
3226         * Modules/plugins/QuickTimePluginReplacement.mm:
3227         * platform/graphics/avfoundation/objc/CDMSessionAVFoundationObjC.mm:
3228         * platform/graphics/avfoundation/objc/InbandTextTrackPrivateAVFObjC.mm:
3229         * platform/graphics/avfoundation/objc/InbandTextTrackPrivateLegacyAVFObjC.mm:
3230         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
3231         * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
3232         * platform/mac/SerializedPlatformRepresentationMac.mm:
3233         * platform/mac/WebPlaybackSessionInterfaceMac.mm:
3234         * platform/mac/WebVideoFullscreenController.mm:
3235         * platform/mediastream/mac/AVAudioCaptureSource.mm:
3236         * platform/mediastream/mac/AVCaptureDeviceManager.mm:
3237         * platform/mediastream/mac/AVMediaCaptureSource.mm:
3238         * platform/mediastream/mac/AVVideoCaptureSource.mm:
3239
3240 2016-12-22  Jer Noble  <jer.noble@apple.com>
3241
3242         NULL-deref CRASH in WebCore::PlatformMediaSession::mediaType
3243         https://bugs.webkit.org/show_bug.cgi?id=166407
3244
3245         Reviewed by Darin Adler.
3246
3247         In r207688, we added a facility in PlatformMediaSessionManager for safely walking through a
3248         list of PlatformMediaSessions by replacing entries of deleted sessions with nullptr. We now
3249         need to use those new iteration falicities in MediaSessionManageriOS.
3250
3251         In addition to the existing iterators, add one which takes a predicate, and returns the first
3252         session which matches the predicate, or nullptr, if none do.
3253
3254         * platform/audio/PlatformMediaSessionManager.cpp:
3255         (WebCore::PlatformMediaSessionManager::findSession):
3256         (WebCore::PlatformMediaSessionManager::anyOfSessions):
3257         * platform/audio/PlatformMediaSessionManager.h:
3258         (WebCore::PlatformMediaSessionManager::sessions): Deleted.
3259         * platform/audio/ios/MediaSessionManagerIOS.mm:
3260         (WebCore::MediaSessionManageriOS::configureWireLessTargetMonitoring):
3261         (WebCore::MediaSessionManageriOS::nowPlayingEligibleSession):
3262         (WebCore::MediaSessionManageriOS::externalOutputDeviceAvailableDidChange):
3263         (WebCore::MediaSessionManageriOS::applicationDidEnterBackground):
3264         (WebCore::MediaSessionManageriOS::applicationWillEnterForeground):
3265
3266 2016-12-22  Jer Noble  <jer.noble@apple.com>
3267
3268         Muted media element playback should not interrupt other audio playback
3269         https://bugs.webkit.org/show_bug.cgi?id=166347
3270
3271         Reviewed by Eric Carlson.
3272
3273         Test: TestWebKitAPI/WebKit/ios/AudioSessionCategoryIOS.mm
3274
3275         * platform/audio/cocoa/MediaSessionManagerCocoa.cpp:
3276         (PlatformMediaSessionManager::updateSessionState):
3277
3278 2016-12-22  Jer Noble  <jer.noble@apple.com>
3279
3280         Check for the existence of AVSampleBufferAudioRenderer.h before redeclaring AVSampleBufferAudioRenderer
3281         https://bugs.webkit.org/show_bug.cgi?id=166421
3282
3283         Reviewed by Eric Carlson.
3284
3285         * platform/spi/mac/AVFoundationSPI.h:
3286
3287 2016-12-22  Eric Carlson  <eric.carlson@apple.com>
3288
3289         AVPlayerLayer isn't available on every system
3290         https://bugs.webkit.org/show_bug.cgi?id=166399
3291
3292         Reviewed by Jer Noble.
3293
3294         No new tests, prevents a crash that can't be reproduced on a test system.
3295
3296         * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm: Use SOFT_LINK_CLASS_OPTIONAL.
3297
3298 2016-12-21  Tim Horton  <timothy_horton@apple.com>
3299
3300         TileGrid revalidates tiles twice during flush, first with wrong visible rect
3301         https://bugs.webkit.org/show_bug.cgi?id=166406
3302
3303         Reviewed by Simon Fraser.
3304
3305         No new tests; existing tests cover this code, this is just a perf win,
3306         specifically reducing the amount of layer churn during zooming.
3307
3308         * platform/graphics/ca/TileGrid.cpp:
3309         (WebCore::TileGrid::setScale):
3310         Schedule a revalidation, which will happen later in the same flush,
3311         instead of doing it immediately. Doing it immediately is problematic,
3312         because we're currently in the middle of a GraphicsLayer tree flush,
3313         and don't have the complete picture of the new state yet. We're guaranteed
3314         to get the new scale *before* the flush calls revalidateTiles.
3315
3316 2016-12-21  Tim Horton  <timothy_horton@apple.com>
3317
3318         TileGrid creates new tiles when there are recyclable tiles about to be removed
3319         https://bugs.webkit.org/show_bug.cgi?id=166408
3320
3321         Reviewed by Simon Fraser.
3322
3323         No new tests; existing tests cover this code, this is just a perf win,
3324         specifically reducing the amount of layer churn during zooming.
3325
3326         * platform/graphics/ca/TileGrid.cpp:
3327         (WebCore::TileGrid::revalidateTiles):
3328         Remove all the tiles that will be removed first, then add new tiles.
3329         Strictly ordering it this way means that tiles will be removed, go into
3330         the LayerPool, then be pulled back out of the LayerPool to sit in the
3331         newly-covered areas. Previously, we would sometimes make new layers
3332         for newly-covered areas, and then remove unneeded but otherwise recyclable
3333         tiles, which would then just go sit in the LayerPool (and often get
3334         pruned, wastefully).
3335
3336 2016-12-21  Eric Carlson  <eric.carlson@apple.com>
3337
3338         [MediaStream] Update media-stream-event-constructor test
3339         https://bugs.webkit.org/show_bug.cgi?id=166398
3340
3341         Reviewed by Jer Noble.
3342
3343         No new tests, updated existing test.
3344
3345         * Modules/mediastream/MediaStreamEvent.idl: Mark eventInitDict as optional.
3346
3347 2016-12-21  Jiewen Tan  <jiewen_tan@apple.com>
3348
3349         WebKit should set Original URL of a download request correctly
3350         https://bugs.webkit.org/show_bug.cgi?id=166394
3351         <rdar://problem/25391382>
3352
3353         Reviewed by Alex Christensen.
3354
3355         WebKit should set Original URL of a download request correctly if the download
3356         is initiated by clicking on a link with target=_blank.
3357
3358         Manually tested as the requested test infrastructure doesn't exist yet. We need actual
3359         loading process for API test such that we could simulate the real situation which
3360         PolicyDownload is only set when we receive responds. Currently we can only set
3361         PolicyDownload in a NavigationDelegate when the load starts. Hence we cannot simulate
3362         the following process: load starts -> PolicyUse -> creates a new WebView ->
3363         respond receives -> PolicyDownload -> downloads.
3364
3365         * loader/FrameLoader.cpp:
3366         (WebCore::FrameLoader::setOriginalURLForDownloadRequest):
3367
3368 2016-12-21  Sam Weinig  <sam@webkit.org>
3369
3370         [WebIDL] Remove custom binding for ErrorEvent
3371         https://bugs.webkit.org/show_bug.cgi?id=166345
3372
3373         Reviewed by Anders Carlsson.
3374
3375         * CMakeLists.txt:
3376         * WebCore.xcodeproj/project.pbxproj:
3377         * bindings/js/JSBindingsAllInOne.cpp:
3378         * bindings/js/JSErrorEventCustom.cpp: Removed.
3379         Remove JSErrorEventCustom.cpp
3380
3381         * ForwardingHeaders/heap/HandleTypes.h: Added.
3382         Add forwarding header for HandleTypes.h
3383
3384         * bindings/js/JSErrorHandler.cpp:
3385         (WebCore::JSErrorHandler::handleEvent):
3386         Switch to using JSDOMConvert and call the updated name for the error getter.
3387
3388         * bindings/js/ScriptController.h:
3389         * bindings/js/SerializedScriptValue.h:
3390         Remove unnecessary forward declaration of ScriptValue.
3391
3392         * bindings/js/WorkerScriptController.cpp:
3393         (WebCore::WorkerScriptController::evaluate):
3394         * dom/ScriptExecutionContext.cpp:
3395         (WebCore::ScriptExecutionContext::sanitizeScriptError):
3396         (WebCore::ScriptExecutionContext::dispatchErrorEvent):
3397         * dom/ScriptExecutionContext.h:
3398         * workers/WorkerMessagingProxy.cpp:
3399         (WebCore::WorkerMessagingProxy::postExceptionToWorkerObject):
3400         Update type that sanitizeScriptError takes from a ScriptValue to a Strong<Unknown>.
3401
3402         * bindings/scripts/CodeGeneratorJS.pm:
3403         (GenerateCallWith):
3404         * bindings/scripts/IDLAttributes.txt:
3405         Add a new extended attributes option for the CallWith, GlobalObject, that passes the global object.
3406
3407         * dom/ErrorEvent.cpp:
3408         (WebCore::ErrorEvent::ErrorEvent):
3409         (WebCore::ErrorEvent::error):
3410         (WebCore::ErrorEvent::trySerializeError):
3411         (WebCore::ErrorEvent::sanitizedErrorValue): Deleted.
3412         * dom/ErrorEvent.h:
3413         Store a Strong<Unknown> directly, rather than a ScriptValue. Rename sanitizedErrorValue to 
3414         just error to match the IDL.
3415
3416         * dom/ErrorEvent.idl:
3417         Remove CustomGetter.
3418
3419 2016-12-21  Ryosuke Niwa  <rniwa@webkit.org>
3420
3421         Modernize findPlainText
3422         https://bugs.webkit.org/show_bug.cgi?id=166299
3423
3424         Reviewed by Sam Weinig.
3425
3426         Modernized findPlainText by merging the static version of it into it
3427         and extracting the main nested loop out as findPlainTextOffset.
3428
3429         No new tests since there should be no behavioral change.
3430
3431         * editing/TextIterator.cpp:
3432         (WebCore::findPlainTextOffset):
3433         (WebCore::findPlainText):
3434
3435 2016-12-21  John Wilander  <wilander@apple.com>
3436
3437         Switch to a blacklist model for restricted Accept headers in simple CORS requests
3438         https://bugs.webkit.org/show_bug.cgi?id=166363
3439
3440         Reviewed by Alex Christensen.
3441
3442         Updated existing tests.
3443
3444         * platform/network/HTTPParsers.cpp:
3445         (WebCore::isDelimiterCharacter):
3446             Convenience function for checking delimiter characters according to:
3447             https://tools.ietf.org/html/rfc7230#section-3.2.6 
3448         (WebCore::isValidAcceptHeaderValue):
3449             Now uses WebCore::isDelimiterCharacter() to blacklist delimiter characters
3450             instead of a whitelist of accepted non-alphanumeric characters.
3451
3452 2016-12-21  Beth Dakin  <bdakin@apple.com>
3453
3454         Holding down on candidates in the TouchBar should show panel on screen
3455         https://bugs.webkit.org/show_bug.cgi?id=166367
3456         -and corresponding-
3457         <rdar://problem/28479236>
3458
3459         Reviewed by Tim Horton.
3460
3461         Expose the version of setCandidates: that takes a rect.
3462         * platform/spi/cocoa/NSTouchBarSPI.h:
3463
3464 2016-12-21  Michael Catanzaro  <mcatanzaro@igalia.com>
3465
3466         Extensions3DOpenGL[ES] constructor should not be explicit
3467         https://bugs.webkit.org/show_bug.cgi?id=166296
3468
3469         Reviewed by Darin Adler.
3470
3471         These constructors used to only have one parameter. Now they have two and they're both
3472         mandatory.
3473
3474         * platform/graphics/opengl/Extensions3DOpenGL.h:
3475         * platform/graphics/opengl/Extensions3DOpenGLES.h:
3476
3477 2016-12-21  Eric Carlson  <eric.carlson@apple.com>
3478
3479         [MediaStream] MediaPlayerPrivateMediaStreamAVFObjC::ensureLayer can be called before it has a media stream
3480         https://bugs.webkit.org/show_bug.cgi?id=166344
3481         <rdar://problem/29763143>
3482
3483         Reviewed by Jer Noble.
3484
3485         There is a very narrow window during which a MediaStream player can be asked for its layer 
3486         before it has a steam, resulting in a NULL dereference and crash. Don't do that.
3487
3488         Unable to reproduce.
3489
3490         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
3491         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::ensureLayer):
3492
3493 2016-12-21  Nael Ouedraogo  <nael.ouedraogo@crf.canon.fr>
3494
3495         [Readable Streams API] Fix test in readableByteStreamCallPullIfNeeded
3496         https://bugs.webkit.org/show_bug.cgi?id=166312
3497
3498         Reviewed by Youenn Fablet.
3499
3500         Add a new function to evaluate if calling a pull function is
3501         required as per specification.
3502
3503         No new test required.
3504
3505         * Modules/streams/ReadableByteStreamInternals.js:
3506         (readableByteStreamControllerShouldCallPull): Added.
3507         (readableByteStreamControllerCallPullIfNeeded):
3508
3509 2016-12-21  Simon Fraser  <simon.fraser@apple.com>
3510
3511         Fixed bars are positioned incorrectly when there are header and footer banners
3512         https://bugs.webkit.org/show_bug.cgi?id=166302
3513         rdar://problem/29727145
3514
3515         Reviewed by Tim Horton.
3516         
3517         The computation of the visual viewport was wrong in the presence of header and footer
3518         banners. It needs to take into account the fact that "visibleContentRect" applies to the
3519         scroll view contents, which includes header and footer (unscaled), and the potentially scaled
3520         document, and we need to return a rectangle in unscaled document coordinates.
3521         
3522         Make a static method in FrameView to do this computation, and call it from FrameView::visualViewportRect()
3523         and ScrollingTreeFrameScrollingNode::layoutViewportForScrollPosition().
3524         
3525         layoutViewportForScrollPosition() is only called on Mac, so remove the #ifdeffing related to scaling, 
3526         and pass in an unscaled scroll position.
3527
3528         Test: fast/visual-viewport/zoomed-fixed-header-and-footer.html
3529
3530         * page/FrameView.cpp:
3531         (WebCore::FrameView::updateLayoutViewport):
3532         (WebCore::FrameView::maxStableLayoutViewportOrigin):
3533         (WebCore::FrameView::visibleDocumentRect):
3534         (WebCore::FrameView::visualViewportRect):
3535         * page/FrameView.h:
3536         * page/scrolling/ScrollingTreeFrameScrollingNode.cpp:
3537         (WebCore::ScrollingTreeFrameScrollingNode::layoutViewportForScrollPosition):
3538         * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
3539         (WebCore::ScrollingTreeFrameScrollingNodeMac::setScrollPositionWithoutContentEdgeConstraints):
3540
3541 2016-12-21  Carlos Alberto Lopez Perez  <clopez@igalia.com>
3542
3543         [CMake] Remove remaining INDIE_UI related entries.
3544         https://bugs.webkit.org/show_bug.cgi?id=165881
3545
3546         Unreviewed.
3547
3548         * CMakeLists.txt:
3549
3550 2016-12-20  Carlos Garcia Campos  <cgarcia@igalia.com>
3551
3552         [Cairo] Conditional jump or move depends on uninitialised value(s)
3553         https://bugs.webkit.org/show_bug.cgi?id=166058
3554
3555         Reviewed by Michael Catanzaro.
3556
3557         Initialize x and y members of cairo_glyph_t struct before passing it to cairo_glyph_path.
3558
3559         * platform/graphics/cairo/FontCairo.cpp:
3560         (WebCore::CairoGlyphToPathTranslator::path):
3561
3562 2016-12-20  Myles C. Maxfield  <mmaxfield@apple.com>
3563
3564         Skia lighter wght variation looks bolder than regular
3565         https://bugs.webkit.org/show_bug.cgi?id=165948
3566
3567         Reviewed by Antti Koivisto.
3568
3569         Test: fast/text/variations/default-value.html
3570
3571         This patch inspects the font's information regarding variations. It uses this information
3572         to work around a bug in CoreText where default variation values were not getting applied.
3573         This workaround is placed behind a version check and the macro name
3574         "WORKAROUND_CORETEXT_VARIATIONS_DEFAULT_VALUE_BUG" so we know to delete it whenever
3575         possible. It also uses the minimum and maximum supported values for the axis to clamp our
3576         variation values to the closest supported point, which is in line with a recent edit to
3577         the fonts spec:
3578         https://github.com/w3c/csswg-drafts/commit/52b802ac38619286a30662dceb71b8a29fa72f42
3579         This clamping behavior also revealed another bug in CoreText, which was worked around
3580         behind another version check and macro name WORKAROUND_CORETEXT_VARIATIONS_EXTENTS_BUG so
3581         we know to delete it whenever possible.
3582
3583         * platform/graphics/cocoa/FontCacheCoreText.cpp:
3584         (WebCore::defaultVariationValues):
3585         (WebCore::preparePlatformFont):
3586
3587 2016-12-20  Tim Horton  <timothy_horton@apple.com>
3588
3589         Remove a duplicate reference to ScrollingMomentumCalculatorMac.h in the Xcode project
3590
3591         Rubber-stamped by Sam Weinig.
3592
3593         * WebCore.xcodeproj/project.pbxproj:
3594
3595 2016-12-20  Tim Horton  <timothy_horton@apple.com>
3596
3597         Remove a duplicate reference to ScrollingMomentumCalculatorMac.mm in the Xcode project
3598
3599         Rubber-stamped by Sam Weinig.
3600
3601         * WebCore.xcodeproj/project.pbxproj:
3602
3603 2016-12-20  Alex Christensen  <achristensen@webkit.org>
3604
3605         Remove initEvent quirk
3606         https://bugs.webkit.org/show_bug.cgi?id=166284
3607
3608         Reviewed by Dan Bernstein.
3609
3610         We added this quirk in r207908 and expanded it in r209946 and r210034.
3611         Many web compatibility issues have been found, which leads us to believe that many more exist.
3612         This reverts the behavior to match how it was before r203848.
3613         This change was proposed to the spec in https://github.com/whatwg/dom/issues/387
3614
3615         * dom/Event.cpp:
3616         (WebCore::Event::initEventForBindings): Deleted.
3617         * dom/Event.h:
3618         * dom/Event.idl:
3619         * platform/RuntimeApplicationChecks.h:
3620         * platform/RuntimeApplicationChecks.mm:
3621         (WebCore::IOSApplication::isBaiduNuomi): Deleted.
3622         (WebCore::IOSApplication::isAutoNaviAMap): Deleted.
3623         (WebCore::IOSApplication::isFlipboard): Deleted.
3624
3625 2016-12-20  JF Bastien  <jfbastien@apple.com>
3626
3627         INDIE_UI: fix cmake build
3628         https://bugs.webkit.org/show_bug.cgi?id=166288
3629
3630         Reviewed by Mark Lam.
3631
3632         Bug #165881 didn't remove a file from cmake.
3633
3634         * PlatformMac.cmake:
3635
3636 2016-12-20  Alex Christensen  <achristensen@webkit.org>
3637
3638         Fix clean Windows build after r210029
3639         https://bugs.webkit.org/show_bug.cgi?id=165881
3640
3641         * DerivedSources.cpp:
3642
3643 2016-12-20  Brent Fulgham  <bfulgham@apple.com>
3644
3645         Address some style problems found by static analysis
3646         https://bugs.webkit.org/show_bug.cgi?id=165975
3647
3648         Reviewed by Alex Christensen.
3649
3650         Correct the const-correctness of functions that are implemented using stricter
3651         const declarations.
3652
3653         Avoid passing large ANGLE data structures through the ANGLEWebKitBridge methods.
3654
3655         * inspector/InspectorCSSAgent.h: Declare the method overrides properly to match
3656         the stricter const declarations in the implementation files.
3657         * inspector/InspectorDOMAgent.h: Ditto.
3658         * inspector/InspectorPageAgent.h: Ditto.
3659         * inspector/InspectorTimelineAgent.h: Ditto.
3660         * inspector/PageDebuggerAgent.h: Ditto.
3661         * platform/graphics/ANGLEWebKitBridge.cpp:
3662         (WebCore::ANGLEWebKitBridge::setResources): Pass by const reference.
3663         * platform/graphics/ANGLEWebKitBridge.h:
3664         (WebCore::ANGLEWebKitBridge::getResources): Return a const reference.
3665         * platform/mediastream/RealtimeMediaSource.cpp:
3666         (WebCore::RealtimeMediaSource::selectSettings): Use a lambda that takes
3667         a const reference, rather than copying the maps while searching.
3668
3669 2016-12-20  Sam Weinig  <sam@webkit.org>
3670
3671         [WebIDL] Remove custom binding for WorkerGlobalScope::importScripts
3672         https://bugs.webkit.org/show_bug.cgi?id=166243
3673
3674         Reviewed by Alex Christensen.
3675
3676         * bindings/js/JSWorkerGlobalScopeCustom.cpp:
3677         (WebCore::JSWorkerGlobalScope::importScripts): Deleted.
3678         * workers/WorkerGlobalScope.idl:
3679         Import scripts can now be trivially generated.
3680
3681 2016-12-20  Zalan Bujtas  <zalan@apple.com>
3682
3683         SVG elements should inherit the root's flow thread state.
3684         https://bugs.webkit.org/show_bug.cgi?id=166173
3685         rdar://problem/29704862
3686
3687         Reviewed by Simon Fraser.
3688
3689         When the <svg> is not part of the multicolumn context (out of flow positioning), its descendants should not be in the flow either.
3690
3691         Test: fast/multicol/svg-inside-multicolumn.html
3692
3693         * rendering/RenderObject.cpp:
3694         (WebCore::RenderObject::computedFlowThreadState):
3695         * rendering/RenderObject.h:
3696         (WebCore::RenderObject::isProgress):
3697         (WebCore::RenderObject::isRenderSVGBlock):
3698         * rendering/svg/RenderSVGBlock.h:
3699
3700 2016-12-20  Alex Christensen  <achristensen@webkit.org>
3701
3702         Fix yet another app that uses initEvent with fewer than 3 parameters
3703         https://bugs.webkit.org/show_bug.cgi?id=166257
3704         <rdar://problem/29420268>
3705
3706         Reviewed by Sam Weinig.
3707
3708         * dom/Event.cpp:
3709         (WebCore::Event::initEventForBindings):
3710         * platform/RuntimeApplicationChecks.h:
3711         * platform/RuntimeApplicationChecks.mm:
3712         (WebCore::IOSApplication::isAutoNaviAMap):
3713         AutoNavi amap has content that uses initEvent with one parameter. This quirk is needed here, too.
3714
3715 2016-12-20  Dean Jackson  <dino@apple.com>
3716
3717         Remove INDIE_UI
3718         https://bugs.webkit.org/show_bug.cgi?id=165881
3719         <rdar://problem/29672532>
3720
3721         Reviewed by Simon Fraser.
3722
3723         The Indie UI work has been discontinued.
3724
3725         * Configurations/FeatureDefines.xcconfig:
3726         * Modules/indieui/UIRequestEvent.cpp: Removed.
3727         * Modules/indieui/UIRequestEvent.h: Removed.
3728         * Modules/indieui/UIRequestEvent.idl: Removed.
3729         * WebCore.xcodeproj/project.pbxproj:
3730         * dom/Element.cpp:
3731         (WebCore::Element::setUIActions): Deleted.
3732         (WebCore::Element::UIActions): Deleted.
3733         * dom/Element.h:
3734         * dom/Element.idl:
3735         * dom/EventNames.in:
3736         * dom/Node.cpp:
3737         (WebCore::Node::dispatchUIRequestEvent): Deleted.
3738         * dom/Node.h:
3739
3740 2016-12-20  Romain Bellessort  <romain.bellessort@crf.canon.fr>
3741
3742         [Readable Streams API] Implement readableByteStreamControllerCallPullIfNeeded()
3743         https://bugs.webkit.org/show_bug.cgi?id=166022
3744
3745         Reviewed by Youenn Fablet.
3746
3747         Implemented readableByteStreamControllerCallPullIfNeeded(). This function is
3748         in particular called when a new ReadableByteStreamController is created; hence,
3749         ReadableByteStreamController constructor has been updated.
3750
3751         Added 3 tests to check behaviour in case of success/failure of the start and pull functions
3752         associated to the underlyingByteSource.
3753
3754         * Modules/streams/ReadableByteStreamInternals.js:
3755         (privateInitializeReadableByteStreamController): Updated handling of underlyingByteSource
3756         start function (especially with call to readableByteStreamControllerCallPullIfNeeded).
3757         (isReadableStreamBYOBReader): Added.
3758         (readableStreamHasBYOBReader): Added.
3759         (readableStreamHasDefaultReader): Added.
3760         (readableByteStreamControllerCallPullIfNeeded): Added.
3761         * Modules/streams/ReadableStreamInternals.js:
3762         (privateInitializeReadableStreamDefaultController): Added missing asserts.
3763         * bindings/js/WebCoreBuiltinNames.h: Added readIntoRequests.
3764
3765 2016-12-20  Sam Weinig  <sam@webkit.org>
3766
3767         [DataCue] Un-prefix DataCue and remove custom bindings
3768         https://bugs.webkit.org/show_bug.cgi?id=166087
3769
3770         Reviewed by Eric Carlson.
3771
3772         * CMakeLists.txt:
3773         * WebCore.xcodeproj/project.pbxproj:
3774         * bindings/js/JSBindingsAllInOne.cpp:
3775         * bindings/js/JSDataCueCustom.cpp: Removed.
3776         Remove JSDataCueCustom.cpp
3777
3778         * bindings/js/JSTextTrackCueCustom.cpp:
3779         (WebCore::toJSNewlyCreated):
3780         Remove out of date comment.
3781
3782         * bindings/scripts/CodeGeneratorJS.pm:
3783         (GenerateConstructorDefinition):
3784         Update constructor generation code to use JSDOMConvert.
3785
3786         * html/track/DataCue.cpp:
3787         (WebCore::DataCue::DataCue):
3788         (WebCore::DataCue::~DataCue):
3789         (WebCore::DataCue::data):
3790         (WebCore::DataCue::setData):
3791         (WebCore::DataCue::cueContentsMatch):
3792         (WebCore::DataCue::value):
3793         (WebCore::DataCue::setValue):
3794         (WebCore::DataCue::valueOrNull):
3795         * html/track/DataCue.h:
3796         * html/track/DataCue.idl:
3797         * platform/SerializedPlatformRepresentation.h:
3798         Remove DATACUE_VALUE define from web exposed classes, so the interface can
3799         be the same on all platforms. Platforms that don't support DATACUE_VALUE will
3800         just never have any value. Also remove custom annotations.
3801
3802 2016-12-20  Wenson Hsieh  <wenson_hsieh@apple.com>
3803
3804         Implement the updated port/area-based Scroll Snap Module Level 1 Spec
3805         https://bugs.webkit.org/show_bug.cgi?id=165317
3806         <rdar://problem/29490956>
3807
3808         Reviewed by Dean Jackson.
3809
3810         Implements the changes drafted in the latest iteration of the Scroll Snap Module Level 1 spec, which uses a
3811         snap-area and snap-port-based method for determining snap positions in a scroll snapping container.
3812         Additionally, removes the now-obsolete and prefixed implementation of the scroll snap spec and refactors all
3813         affected layout tests to use the new CSS properties. Also adds new layout tests covering some behaviors detailed
3814         in the new version of the spec, such as scroll snapping with transformed child elements.
3815
3816         See below for more detailed descriptions of the changes.
3817
3818         Tests: css3/scroll-snap/scroll-snap-2d-change-axis-type.html
3819                css3/scroll-snap/scroll-snap-2d-offsets-computed-independently.html
3820                css3/scroll-snap/scroll-snap-children-with-scroll-snap-margin.html
3821                css3/scroll-snap/scroll-snap-children-with-transforms.html
3822                css3/scroll-snap/scroll-snap-positions-mainframe.html
3823                css3/scroll-snap/scroll-snap-positions-overflow-resize.html
3824                css3/scroll-snap/scroll-snap-positions.html
3825                css3/scroll-snap/scroll-snap-style-changed-align.html
3826                css3/scroll-snap/scroll-snap-with-scroll-padding.html
3827
3828         * WebCore.xcodeproj/project.pbxproj:
3829         * css/CSSCalculationValue.cpp:
3830         (WebCore::hasDoubleValue):
3831
3832         Removed use of length repeat.
3833
3834         * css/CSSComputedStyleDeclaration.cpp:
3835         (WebCore::valueForScrollSnapType):
3836         (WebCore::valueForScrollSnapAlignment):
3837         (WebCore::ComputedStyleExtractor::propertyValue):
3838         (WebCore::scrollSnapDestination): Deleted.
3839         (WebCore::scrollSnapPoints): Deleted.
3840         (WebCore::scrollSnapCoordinates): Deleted.
3841
3842         Removed helper functions used to create CSS values for scroll snap coordinates and destination, and added
3843         helpers for computed scroll snap type (a combination of axis and strictness values) as well as scroll snap align
3844         (an alignment value per axis).
3845
3846         * css/CSSPrimitiveValue.cpp:
3847         (WebCore::isValidCSSUnitTypeForDoubleConversion):
3848         (WebCore::isStringType):
3849         (WebCore::CSSPrimitiveValue::cleanup):
3850         (WebCore::CSSPrimitiveValue::formatNumberForCustomCSSText):
3851         (WebCore::CSSPrimitiveValue::cloneForCSSOM):
3852         (WebCore::CSSPrimitiveValue::equals):
3853
3854         Removed usages of the length repeat type, since repeat(*) is no longer being used anywhere.
3855
3856         * css/CSSPrimitiveValue.h:
3857         * css/CSSPrimitiveValueMappings.h:
3858         (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
3859         (WebCore::CSSPrimitiveValue::operator ScrollSnapStrictness):
3860         (WebCore::CSSPrimitiveValue::operator ScrollSnapAxis):
3861         (WebCore::CSSPrimitiveValue::operator ScrollSnapAxisAlignType):
3862         (WebCore::CSSPrimitiveValue::operator ScrollSnapType): Deleted.
3863
3864         Added CSSPrimitiveValue mappings to ScrollSnapAxisAlignType, ScrollSnapStrictness, and ScrollSnapAxis. Removed
3865         the old ScrollSnapType mapping.
3866
3867         * css/CSSProperties.json:
3868
3869         Replaced the old scroll snap CSS properties with the new ones. Note that scroll-snap-margin and scroll-padding
3870         have 4 shorthands each, for the individual top/bottom/left/right values.
3871
3872         * css/CSSValueKeywords.in:
3873
3874         Added CSS keywords {x, y}, which are necessary to support the new scroll snapping properties.
3875
3876         * css/LengthRepeat.h: Removed.
3877
3878         Removed LengthRepeat entirely. This represented the `repeat(<length>)` CSS value, which was only used for the
3879         scroll-snap-points-x and scroll-snap-points-y values.
3880
3881         * css/StyleBuilderConverter.h:
3882         (WebCore::StyleBuilderConverter::convertScrollSnapType):
3883         (WebCore::StyleBuilderConverter::convertScrollSnapAlign):
3884         (WebCore::StyleBuilderConverter::parseSnapCoordinate): Deleted.
3885         (WebCore::StyleBuilderConverter::convertScrollSnapPoints): Deleted.
3886         (WebCore::StyleBuilderConverter::convertSnapCoordinatePair): Deleted.
3887         (WebCore::StyleBuilderConverter::convertScrollSnapCoordinates): Deleted.
3888
3889         Added helper functions to convert scroll snap type and scroll snap alignment from parsed CSS values to their
3890         primary representation in WebCore as ScrollSnapType and ScrollSnapAlign. These methods assume that the given
3891         CSS values have successfully cleared the parsing step and are represented as CSSValueLists or length 1 or 2.
3892
3893         * css/StyleBuilderCustom.h:
3894         (WebCore::StyleBuilderCustom::applyInitialWebkitScrollSnapPointsX): Deleted.
3895         (WebCore::StyleBuilderCustom::applyInheritWebkitScrollSnapPointsX): Deleted.
3896         (WebCore::StyleBuilderCustom::applyInitialWebkitScrollSnapPointsY): Deleted.
3897         (WebCore::StyleBuilderCustom::applyInheritWebkitScrollSnapPointsY): Deleted.
3898         * css/StyleProperties.cpp:
3899         (WebCore::StyleProperties::getPropertyValue):
3900         (WebCore::StyleProperties::asText):
3901
3902         Adds support for the scroll-snap-margin and scroll-padding.
3903
3904         * css/parser/CSSParser.cpp:
3905         (WebCore::isValidKeywordPropertyAndValue):
3906         (WebCore::CSSParser::parseValue):
3907         (WebCore::isScrollSnapAxisAlign):
3908         (WebCore::isScrollSnapStrictness):
3909         (WebCore::CSSParser::parseScrollSnapAlign):
3910         (WebCore::CSSParser::parseScrollSnapType):
3911         (WebCore::CSSParser::parseNonElementSnapPoints): Deleted.
3912         (WebCore::CSSParser::parseScrollSnapPositions): Deleted.
3913         (WebCore::CSSParser::parseScrollSnapDestination): Deleted.
3914         (WebCore::CSSParser::parseScrollSnapCoordinate): Deleted.
3915         * css/parser/CSSParser.h:
3916
3917         Removed references to LengthRepeat, and added support for parsing new scroll snapping properties. Scroll snap
3918         margin and scroll padding, along with their shorthands, are parsed using the same helper functions as normal
3919         margin and padding. For type and align, I added new helper functions that build up lists of 1 or 2
3920         CSSPrimitiveValues for each of the properties.
3921
3922         Parsing scroll-snap-align is straightforward -- we either have one or two values in the set {none, start,
3923         center, end}. For scroll-snap-type, we allow a single axis value {x, y, inline, block, both}, or a single
3924         strictness value {none, proximity, mandatory}, or an axis value followed by a non-'none' strictness (i.e. either
3925         proximity or mandatory).
3926
3927         * css/parser/CSSParserFastPaths.cpp:
3928         (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
3929         (WebCore::CSSParserFastPaths::isKeywordPropertyID):
3930         * css/parser/CSSParserValues.cpp:
3931         (WebCore::CSSParserValue::createCSSValue):
3932
3933         Removed references to LengthRepeat.
3934
3935         * css/parser/CSSPropertyParser.cpp:
3936         (WebCore::CSSPropertyParser::parseSingleValue):
3937         (WebCore::CSSPropertyParser::parseShorthand):
3938         (WebCore::consumeSnapPointCoordinateList): Deleted.
3939         (WebCore::consumeScrollSnapCoordinate): Deleted.
3940         (WebCore::consumeScrollSnapDestination): Deleted.
3941   &