6d2f0e9fac32fed02f14a2a1094203dfe688f03b
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2017-09-19  Ryan Haddad  <ryanhaddad@apple.com>
2
3         Unreviewed, rolling out r222217 and r222214.
4         This change introduced two LayoutTest failures.
5         https://bugs.webkit.org/show_bug.cgi?id=177026
6
7         * rendering/RenderBlockFlow.cpp:
8         (WebCore::RenderBlockFlow::computeInlinePreferredLogicalWidths const):
9         * rendering/RenderCombineText.cpp:
10         (WebCore::RenderCombineText::styleDidChange):
11         (WebCore::RenderCombineText::setRenderedText):
12         (WebCore::RenderCombineText::combineText):
13         (WebCore::RenderCombineText::combineTextIfNeeded): Deleted.
14         * rendering/RenderCombineText.h:
15         * rendering/RenderText.cpp:
16         * rendering/RenderText.h:
17         * rendering/line/BreakingContext.h:
18         (WebCore::BreakingContext::handleText):
19         * rendering/line/LineBreaker.cpp:
20         (WebCore::LineBreaker::skipLeadingWhitespace):
21
22 2017-09-19  Zalan Bujtas  <zalan@apple.com>
23
24         Attempt to fix Linux build.
25
26         * rendering/RenderText.cpp:
27
28 2017-09-19  Zalan Bujtas  <zalan@apple.com>
29
30         Do not mutate RenderText content during layout.
31         https://bugs.webkit.org/show_bug.cgi?id=176219
32         <rdar://problem/34205724>
33
34         Reviewed by David Hyatt.
35
36         Update combined text when the style/content change as opposed to lazily, during layout.
37         -content mutation during layout might make the inline tree go out of sync.
38
39         Test: fast/text/international/dynamic-text-combine-crash.html
40
41         * rendering/RenderBlockFlow.cpp:
42         (WebCore::RenderBlockFlow::computeInlinePreferredLogicalWidths const):
43         * rendering/RenderCombineText.cpp:
44         (WebCore::RenderCombineText::styleDidChange):
45         (WebCore::RenderCombineText::setRenderedText):
46         (WebCore::RenderCombineText::combineTextIfNeeded):
47         (WebCore::RenderCombineText::combineText): Deleted.
48         * rendering/RenderCombineText.h:
49         * rendering/RenderText.h:
50         * rendering/line/BreakingContext.h:
51         (WebCore::BreakingContext::handleText):
52         * rendering/line/LineBreaker.cpp:
53         (WebCore::LineBreaker::skipLeadingWhitespace):
54
55 2017-09-19  Nael Ouedraogo  <nael.ouedraogo@crf.canon.fr>
56
57         [GTK] The binding code of Media Source Extension of AudioTrack, VideoTrack and TextTrack is not generated
58         https://bugs.webkit.org/show_bug.cgi?id=174620
59
60         Reviewed by Michael Catanzaro.
61
62         Add AudioTrackMediaSource, VideoTrackMediaSource and TextTrackMediaSource IDL files in CMakeLists. Fix WPT test
63         that checks MSE interfaces. This test failed since webm is not supported for MSE in GTK port. PR already merged
64         in WPT repository.
65
66         Remove skipped test that is now passing in TestExpectation. Modify expected file for GTK (same as mac).
67
68         * CMakeLists.txt:
69
70 2017-09-18  Carlos Garcia Campos  <cgarcia@igalia.com>
71
72         [Harfbuzz] adjustSelectionRectForComplexText() should also pass the character range when shaping
73         https://bugs.webkit.org/show_bug.cgi?id=177049
74
75         Reviewed by Michael Catanzaro.
76
77         Now that the shaper support receiving a range we should use that also in
78         adjustSelectionRectForComplexText(). This will ensure consistent results with
79         getGlyphsAndAdvancesForComplexText().
80
81         * platform/graphics/cairo/FontCairoHarfbuzzNG.cpp:
82         (WebCore::FontCascade::adjustSelectionRectForComplexText const):
83
84 2017-09-19  Dean Jackson  <dino@apple.com>
85
86         [WebGL] VideoTextureCopierCV doesn't correctly restore vertex attribute state
87         https://bugs.webkit.org/show_bug.cgi?id=176771
88         <rdar://problem/34386621>
89
90         Reviewed by Antoine Quint.
91
92         The OpenGL context in VideoTextureCopierCV wasn't being restored to
93         the state it had before rendering a video to a texture. Specifically
94         the vertex attribute values were never recorded by the state saver.
95
96         Update the existing test of VideoTextureCopierCV so that it is
97         explicitly doing something different from the WebCore code, which
98         means that state will have to be correctly restored for the test
99         to pass.
100
101         * platform/graphics/cv/VideoTextureCopierCV.cpp:
102         (WebCore::VideoTextureCopierCV::copyVideoTextureToPlatformTexture): Make sure
103         to record the vertex attribute state once we know the location of the position attribute.
104         (WebCore::VideoTextureCopierCV::GC3DStateSaver::GC3DStateSaver):
105         (WebCore::VideoTextureCopierCV::GC3DStateSaver::~GC3DStateSaver):
106         (WebCore::VideoTextureCopierCV::GC3DStateSaver::saveVertexAttribState): Save all the
107         applicable vertex attribute state information.
108         * platform/graphics/cv/VideoTextureCopierCV.h: GC3DStateSaver can use a reference
109         to the GC3D rather than a pointer.
110
111 2017-09-19  Dean Jackson  <dino@apple.com>
112
113         [WebGL] accelerated texImage2D for video doesn't respect flipY
114         https://bugs.webkit.org/show_bug.cgi?id=176491
115         <rdar://problem/33833511>
116
117         Reviewed by Jer Noble.
118
119         (Take 3 - this was rolled out due to a test failure)
120
121         Previously, if UNPACK_FLIP_Y_WEBGL was set to true, we'd either fall
122         back to software or fail to upload texture data. Fix this by intercepting
123         the texImage2D call, checking the orientation of the video, and running
124         a small shader program to flip it if necessary.
125
126         While there, implement UNPACK_PREMULTIPLY_ALPHA_WEBGL as well, although
127         none of our media decoders support video with alpha, so unfortunately
128         this will have no visible change.
129
130         Tests: fast/canvas/webgl/texImage2D-video-flipY-false.html
131                fast/canvas/webgl/texImage2D-video-flipY-true.html
132
133         * platform/cocoa/CoreVideoSoftLink.cpp: Add link to CVOpenGL(ES)TextureGetCleanTexCoords,
134         which is used to check the orientation of the source video.
135         * platform/cocoa/CoreVideoSoftLink.h:
136
137         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
138         (WebCore::MediaPlayerPrivateAVFoundationObjC::copyVideoTextureToPlatformTexture): We can
139         now handle flipped or premultiplied requests.
140         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
141         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::copyVideoTextureToPlatformTexture): Ditto.
142
143         * platform/graphics/cv/VideoTextureCopierCV.cpp:
144         (WebCore::VideoTextureCopierCV::VideoTextureCopierCV): Rename readFramebuffer to
145         simply framebuffer.
146         (WebCore::VideoTextureCopierCV::~VideoTextureCopierCV): Delete the program and buffer
147         if they were created.
148         (WebCore::VideoTextureCopierCV::initializeContextObjects): Sets up the shader program
149         and the vertex buffer for drawing. Also records the location of the uniforms.
150         (WebCore::VideoTextureCopierCV::copyVideoTextureToPlatformTexture): Create a new
151         framebuffer object, and render the video texture into that framebuffer using a
152         shader that can flip the coordinates.
153         (WebCore::VideoTextureCopierCV::GC3DStateSaver::GC3DStateSaver): Helper to restore
154         the state of the user's GraphicsContext3D while we're intercepting calls.
155         (WebCore::VideoTextureCopierCV::GC3DStateSaver::~GC3DStateSaver):
156         * platform/graphics/cv/VideoTextureCopierCV.h:
157
158         * platform/graphics/GraphicsContext3D.h: Add two new entry points, for direct shader
159         compilation and attribute access. This avoids going through ANGLE.
160         * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
161         (WebCore::GraphicsContext3D::compileShader):
162         (WebCore::GraphicsContext3D::compileShaderDirect):
163         (WebCore::GraphicsContext3D::getAttribLocationDirect):
164
165 2017-09-18  Said Abou-Hallawa  <sabouhallawa@apple.com>
166
167         Make ImageFrame::duration() return Seconds instead of float
168         https://bugs.webkit.org/show_bug.cgi?id=177103
169
170         Reviewed by Simon Fraser.
171
172         ScalableImageDecoder stores milliseconds for the duration of its ImageFrames.
173         But ImageFrameCache store seconds for the duration of its ImageFrames.
174         To fix this issue use Seconds for the ImageFrame duration.
175
176         * platform/graphics/BitmapImage.h:
177         * platform/graphics/ImageDecoder.h:
178         * platform/graphics/ImageFrame.h:
179         (WebCore::ImageFrame::setDuration):
180         (WebCore::ImageFrame::duration const):
181         * platform/graphics/ImageFrameCache.cpp:
182         (WebCore::ImageFrameCache::frameDurationAtIndex):
183         * platform/graphics/ImageFrameCache.h:
184         * platform/graphics/ImageSource.h:
185         (WebCore::ImageSource::frameDurationAtIndex):
186         * platform/graphics/cg/ImageDecoderCG.cpp:
187         (WebCore::ImageDecoderCG::frameDurationAtIndex const):
188         * platform/graphics/cg/ImageDecoderCG.h:
189         * platform/image-decoders/ScalableImageDecoder.cpp:
190         (WebCore::ScalableImageDecoder::frameDurationAtIndex const):
191         * platform/image-decoders/ScalableImageDecoder.h:
192         * platform/image-decoders/gif/GIFImageDecoder.cpp:
193         (WebCore::GIFImageDecoder::frameComplete):
194         * platform/image-decoders/png/PNGImageDecoder.cpp:
195         (WebCore::PNGImageDecoder::readChunks):
196         (WebCore::PNGImageDecoder::frameHeader): Deleted.
197         (WebCore::PNGImageDecoder::init): Deleted.
198         (WebCore::PNGImageDecoder::clearFrameBufferCache): Deleted.
199         (WebCore::PNGImageDecoder::initFrameBuffer): Deleted.
200         (WebCore::PNGImageDecoder::frameComplete): Deleted.
201         (WebCore::PNGImageDecoder::processingStart): Deleted.
202         (WebCore::PNGImageDecoder::processingFinish): Deleted.
203         (WebCore::PNGImageDecoder::fallbackNotAnimated): Deleted.
204
205 2017-09-18  Per Arne Vollan  <pvollan@apple.com>
206
207         [Win] Compile error in InbandTextTrackPrivateAVCF::readNativeSampleBuffer.
208         https://bugs.webkit.org/show_bug.cgi?id=177108
209
210         Reviewed by Brent Fulgham.
211
212         The InbandTextTrackPrivateAVF::m_sampleInputBuffer is private and not accessible in this method.
213  
214         * platform/graphics/avfoundation/InbandTextTrackPrivateAVF.h:
215
216 2017-09-18  Tim Horton  <timothy_horton@apple.com>
217
218         Support min() and max() in calc()
219         https://bugs.webkit.org/show_bug.cgi?id=167000
220         <rdar://problem/30153481>
221
222         Reviewed by David Hyatt.
223         Patch originally by Myles Maxfield.
224
225         Add two new toplevel functions to CSS, min() and max(), which take an
226         arbirary number of arguments and resolve to the minimum and maximum of
227         the resolved value of the arguments, respectively. It is also possible
228         to use min() and max() inside calc(), and to use calc()-like math
229         inside min() and max().
230
231         * css/CSSCalculationValue.cpp:
232         (WebCore::determineCategory):
233         min and max operators don't use determineCategory; we have a specific
234         implementation for them in createMinOrMax.
235
236         (WebCore::resolvedTypeForMinOrMax):
237         The spec says that min() and max() should be marked as invalid if they
238         have values of more than one type, but that percentages should resolve
239         against the destination type before making this determination. So,
240         if the destination type is length, percent turns into percent-length,
241         and similarly for number.
242
243         (WebCore::isIntegerResult):
244         Add an n-way implementation of isIntegerResult.
245
246         (WebCore::isSamePair):
247         (WebCore::CSSCalcOperation::createMinOrMax): Create a min() or max()
248         operation, as long as the types of arguments are all the same. Allow
249         lengths to upgrade the whole operation to percent-length, and numbers
250         to percent-number, which will cause us to use CalculationValue and friends
251         in order to do proper resolution of all of the parameters instead of
252         just comparing their numeric values.
253
254         (WebCore::CSSCalcOperation::createCalcExpression):
255         (WebCore::CSSCalcOperation::doubleValue):
256         (WebCore::CSSCalcOperation::computeLengthPx):
257         (WebCore::CSSCalcOperation::customCSSText):
258         (WebCore::CSSCalcOperation::primitiveType):
259         (WebCore::CSSCalcOperation::CSSCalcOperation):
260         (WebCore::CSSCalcOperation::evaluate):
261         (WebCore::CSSCalcOperation::evaluateOperator):
262         Adapt to child counts greater than two.
263
264         (WebCore::CSSCalcOperation::buildCssText):
265         Add support for min() and max().
266
267         (WebCore::CSSCalcExpressionNodeParser::parseCalc):
268         parseCalc now accepts a CSSValueID parameter indicating which calc function
269         it should parse (calc, webkit-calc, min, or max), and delegates to either
270         parseValueExpression or parseMinMaxExpression.
271
272         (WebCore::CSSCalcExpressionNodeParser::operatorValue):
273         (WebCore::CSSCalcExpressionNodeParser::parseValue):
274         If min() or max() are found while parsing a value (i.e. nested inside
275         either calc or themselves), use parseMinMaxExpression on that subtree.
276
277         (WebCore::CSSCalcExpressionNodeParser::parseValueTerm):
278         (WebCore::CSSCalcExpressionNodeParser::parseValueMultiplicativeExpression):
279         (WebCore::CSSCalcExpressionNodeParser::parseAdditiveValueExpression):
280         Adjust to the CSSCalcBinaryOperation->CSSCalcOperation rename.
281
282         (WebCore::CSSCalcExpressionNodeParser::parseMinMaxExpression):
283         Added. Parse an arbitrary number of comma-and-whitespace-separated children.
284
285         (WebCore::createBlendHalf):
286         Adjust to the CSSCalcBinaryOperation->CSSCalcOperation rename.
287
288         (WebCore::createCSS):
289         Build the CSSCalcOperation for the platform-independent min and max operations.
290
291         (WebCore::CSSCalcValue::create):
292         Pass the function being parsed and the destination calc category for the
293         property being parsed for into create, and then into the parser so that
294         it can know which function it is parsing for, and what kind of result it
295         needs (as previously mentioned above in resolvedTypeForMinOrMax).
296
297         * css/CSSCalculationValue.h:
298         * css/CSSValueKeywords.in:
299         Add min and max functions as CSS keywords.
300
301         * css/StyleBuilderConverter.h:
302         (WebCore::StyleBuilderConverter::convertLength):
303         (WebCore::StyleBuilderConverter::convertTo100PercentMinusLength):
304         * platform/Length.cpp:
305         (WebCore::convertTo100PercentMinusLength):
306         Adapt to the CalcExpressionOperation constructor taking a vector of
307         arguments instead of two.
308
309         * css/parser/CSSPropertyParserHelpers.cpp:
310         (WebCore::CSSPropertyParserHelpers::CalcParser::CalcParser):
311         Store and pass the specific function being parsed down into CSSCalcValue.
312
313         (WebCore::CSSPropertyParserHelpers::consumeInteger):
314         (WebCore::CSSPropertyParserHelpers::consumePositiveIntegerRaw):
315         (WebCore::CSSPropertyParserHelpers::consumeNumberRaw):
316         (WebCore::CSSPropertyParserHelpers::consumeNumber):
317         (WebCore::CSSPropertyParserHelpers::consumeFontWeightNumber):
318         (WebCore::CSSPropertyParserHelpers::consumeLength):
319         (WebCore::CSSPropertyParserHelpers::consumePercent):
320         (WebCore::CSSPropertyParserHelpers::consumeLengthOrPercent):
321         (WebCore::CSSPropertyParserHelpers::consumeAngle):
322         (WebCore::CSSPropertyParserHelpers::consumeTime):
323         Pass the destination type into each calc parser.
324
325         * platform/CalculationValue.cpp:
326         (WebCore::CalcExpressionOperation::evaluate const):
327         (WebCore::CalcExpressionOperation::operator== const):
328         (WebCore::CalcExpressionOperation::dump const):
329         (WebCore::operator<<):
330         (WebCore::CalcExpressionBinaryOperation::evaluate const): Deleted.
331         (WebCore::CalcExpressionBinaryOperation::operator== const): Deleted.
332         (WebCore::CalcExpressionBinaryOperation::dump const): Deleted.
333         * platform/CalculationValue.h:
334         (WebCore::CalcExpressionOperation::CalcExpressionOperation):
335         (WebCore::operator==):
336         (WebCore::toCalcExpressionOperation):
337         (WebCore::CalcExpressionBinaryOperation::CalcExpressionBinaryOperation): Deleted.
338         (WebCore::toCalcExpressionBinaryOperation): Deleted.
339         Adjust to the CSSCalcBinaryOperation->CSSCalcOperation rename.
340         Adjust to having n>2 children.
341         Support min() and max() operators in various places.
342         
343
344 2017-09-18  Basuke Suzuki  <Basuke.Suzuki@sony.com>
345
346         [Curl] Move error generation task into ResourceError
347         https://bugs.webkit.org/show_bug.cgi?id=176963
348
349         Reviewed by Alex Christensen.
350
351         * platform/Curl.cmake:
352         * platform/network/curl/CurlContext.cpp:
353         (WebCore::CurlHandle::errorDescription):
354         (WebCore::CurlHandle::errorDescription const):
355         * platform/network/curl/CurlContext.h:
356         * platform/network/curl/ResourceError.h:
357         (WebCore::ResourceError::setSslErrors):
358         (WebCore::ResourceError::hasSSLConnectError const): Deleted.
359         (WebCore::ResourceError::doPlatformIsolatedCopy): Deleted.
360         * platform/network/curl/ResourceErrorCurl.cpp: Added.
361         (WebCore::ResourceError::httpError):
362         (WebCore::ResourceError::sslError):
363         (WebCore::ResourceError::hasSSLConnectError const):
364         (WebCore::ResourceError::doPlatformIsolatedCopy):
365         (WebCore::ResourceError::platformCompare):
366         * platform/network/curl/ResourceHandleCurlDelegate.cpp:
367         (WebCore::ResourceHandleCurlDelegate::notifyFail):
368         (WebCore::ResourceHandleCurlDelegate::didFail):
369         * platform/network/curl/ResourceHandleCurlDelegate.h:
370
371 2017-09-18  Ryan Haddad  <ryanhaddad@apple.com>
372
373         Unreviewed, rolling out r222170.
374
375         The API test added with this change is failing.
376
377         Reverted changeset:
378
379         "Allow WTF::map to use any class that is iterable and has a
380         size getter"
381         https://bugs.webkit.org/show_bug.cgi?id=177026
382         http://trac.webkit.org/changeset/222170
383
384 2017-09-18  Don Olmstead  <don.olmstead@sony.com>
385
386         [Curl] Forward declare SSL context
387
388         Unreviewed build fix after r222147. OpenSSL's SHA1 declaration conflicts with WTF's.
389
390         No new tests. No change in behavior.
391
392         * platform/network/curl/CurlSSLHandle.h:
393         * platform/network/curl/CurlSSLVerifier.cpp:
394         * platform/network/curl/CurlSSLVerifier.h:
395
396 2017-09-18  Ryosuke Niwa  <rniwa@webkit.org>
397
398         getData('text/plain') doesn't work on iOS 10
399         https://bugs.webkit.org/show_bug.cgi?id=177034
400
401         Reviewed by Wenson Hsieh.
402
403         The bug was caused by the mispatch of UTI between reading & writing plain text.
404         Use kUTTypeText (instead of kUTTypePlainText) to read from UIPasteboard on iOS 10.
405
406         Re-enabled tests were passing on iOS 11 and continues to pass after this code change.
407
408         Tests: editing/pasteboard/clipboard-event.html
409                editing/pasteboard/datatransfer-items-paste-plaintext.html
410                editing/pasteboard/get-data-text-plain-paste.html
411
412         * platform/ios/PasteboardIOS.mm:
413         (WebCore::cocoaTypeFromHTMLClipboardType):
414
415 2017-09-18  Youenn Fablet  <youenn@apple.com>
416
417         Allow WTF::map to use any class that is iterable and has a size getter
418         https://bugs.webkit.org/show_bug.cgi?id=177026
419
420         Reviewed by Darin Adler.
421
422         No change of behavior.
423         Using WTF::map to go from maps to vectors.
424
425         * loader/appcache/ApplicationCacheHost.cpp:
426         (WebCore::ApplicationCacheHost::resourceList):
427         * page/DOMWindow.cpp:
428         (WebCore::DOMWindow::dispatchAllPendingUnloadEvents):
429
430 2017-09-18  Emilio Cobos Ãlvarez  <emilio@crisal.io>
431
432         Always update display: contents styles in RenderTreeUpdater.
433         https://bugs.webkit.org/show_bug.cgi?id=177065
434
435         Reviewed by Antti Koivisto.
436
437         Otherwise we keep an old style around, making following style updates wrong.
438
439         Test: fast/css/display-contents-style-update.html
440
441         * style/RenderTreeUpdater.cpp:
442         (WebCore::RenderTreeUpdater::updateElementRenderer):
443
444 2017-09-18  Antti Koivisto  <antti@apple.com>
445
446         Avoid style resolution when clearing focused element.
447         https://bugs.webkit.org/show_bug.cgi?id=176224
448         <rdar://problem/34206409>
449
450         Reviewed by Zalan Bujtas.
451
452         Test: fast/dom/focus-style-resolution.html
453
454         * dom/Document.cpp:
455         (WebCore::Document::setFocusedElement):
456
457             Don't do synchronous style resolution with FocusRemovalEventsMode::DoNotDispatch.
458             Style resolution may dispatch events.
459
460         * html/HTMLInputElement.cpp:
461         (WebCore::HTMLInputElement::didBlur):
462
463             Move resolveStyleIfNeeded call to setFocusedElement. It is the only client for didBlur.
464
465 2017-09-18  Antti Koivisto  <antti@apple.com>
466
467         Rolling out the previous to land again with a test.
468
469         * dom/Document.cpp:
470         (WebCore::Document::setFocusedElement):
471         * html/HTMLInputElement.cpp:
472         (WebCore::HTMLInputElement::didBlur):
473
474 2017-09-18  Antti Koivisto  <antti@apple.com>
475
476         Avoid style resolution when clearing focused element.
477         https://bugs.webkit.org/show_bug.cgi?id=176224
478         <rdar://problem/34206409>
479
480         Reviewed by Zalan Bujtas.
481
482         Test: fast/dom/focus-style-resolution.html
483
484         * dom/Document.cpp:
485         (WebCore::Document::setFocusedElement):
486
487             Don't do synchronous style resolution with FocusRemovalEventsMode::DoNotDispatch.
488             Style resolution may dispatch events.
489
490         * html/HTMLInputElement.cpp:
491         (WebCore::HTMLInputElement::didBlur):
492
493             Move resolveStyleIfNeeded call to setFocusedElement. It is the only client for didBlur.
494
495 2017-09-18  Per Arne Vollan  <pvollan@apple.com>
496
497         [WK1] Layout Test fast/events/beforeunload-dom-manipulation-crash.html is crashing.
498         https://bugs.webkit.org/show_bug.cgi?id=177071
499
500         Reviewed by Brent Fulgham.
501
502         The Page pointer in the history controller's frame is null. Add a null pointer check before
503         accessing the page. 
504
505         No new tests, covered by exiting tests.
506
507         * loader/HistoryController.cpp:
508         (WebCore::HistoryController::updateForStandardLoad):
509         (WebCore::HistoryController::updateForRedirectWithLockedBackForwardList):
510         (WebCore::HistoryController::updateForClientRedirect):
511
512 2017-09-17  Carlos Garcia Campos  <cgarcia@igalia.com>
513
514         REGRESSION(r221974): [Harfbuzz] Test fast/text/international/hebrew-selection.html is failing since r221974
515         https://bugs.webkit.org/show_bug.cgi?id=177036
516
517         Reviewed by Michael Catanzaro.
518
519         In r221974 I rewrote the characterIndexForXPosition implementation without taking into account that there can be
520         multiple glyphs for the same character, so we can't simply do index++ and index-- to get the next and previous
521         character index.
522
523         * platform/graphics/harfbuzz/HarfBuzzShaper.cpp:
524         (WebCore::HarfBuzzShaper::HarfBuzzRun::characterIndexForXPosition): Always get the character index from
525         m_glyphToCharacterIndexes array.
526
527 2017-09-18  Jer Noble  <jer.noble@apple.com>
528
529         Virtualize ImageDecoder
530         https://bugs.webkit.org/show_bug.cgi?id=176118
531
532         Reviewed by Eric Carlson.
533
534         Add an explicit, abstract base class ImageDecoder, and convert ImageDecoderCG to a true
535         subclass. This will allow multiple ImageDecoder subclasses to exist simultaneously at
536         runtime.
537
538         * CMakeLists.txt:
539         * WebCore.xcodeproj/project.pbxproj:
540         * platform/ImageDecoders.cmake:
541         * platform/graphics/ImageDecoder.cpp: Added.
542         (WebCore::ImageDecoder::create):
543         (WebCore::ImageDecoder::bytesDecodedToDetermineProperties):
544         * platform/graphics/ImageDecoder.h: Added.
545         (WebCore::ImageDecoder::isSizeAvailable):
546         (WebCore::ImageDecoder::isAllDataReceived const):
547         * platform/graphics/cg/ImageDecoderCG.cpp:
548         (WebCore::ImageDecoderCG::ImageDecoderCG):
549         (WebCore::ImageDecoderCG::bytesDecodedToDetermineProperties):
550         (WebCore::ImageDecoderCG::uti const):
551         (WebCore::ImageDecoderCG::filenameExtension const):
552         (WebCore::ImageDecoderCG::encodedDataStatus const):
553         (WebCore::ImageDecoderCG::frameCount const):
554         (WebCore::ImageDecoderCG::repetitionCount const):
555         (WebCore::ImageDecoderCG::hotSpot const):
556         (WebCore::ImageDecoderCG::frameSizeAtIndex const):
557         (WebCore::ImageDecoderCG::frameIsCompleteAtIndex const):
558         (WebCore::ImageDecoderCG::frameOrientationAtIndex const):
559         (WebCore::ImageDecoderCG::frameDurationAtIndex const):
560         (WebCore::ImageDecoderCG::frameAllowSubsamplingAtIndex const):
561         (WebCore::ImageDecoderCG::frameHasAlphaAtIndex const):
562         (WebCore::ImageDecoderCG::frameBytesAtIndex const):
563         (WebCore::ImageDecoderCG::createFrameImageAtIndex const):
564         (WebCore::ImageDecoderCG::setData):
565         (WebCore::ImageDecoder::ImageDecoder): Deleted.
566         (WebCore::ImageDecoder::bytesDecodedToDetermineProperties): Deleted.
567         (WebCore::ImageDecoder::uti const): Deleted.
568         (WebCore::ImageDecoder::filenameExtension const): Deleted.
569         (WebCore::ImageDecoder::encodedDataStatus const): Deleted.
570         (WebCore::ImageDecoder::frameCount const): Deleted.
571         (WebCore::ImageDecoder::repetitionCount const): Deleted.
572         (WebCore::ImageDecoder::hotSpot const): Deleted.
573         (WebCore::ImageDecoder::frameSizeAtIndex const): Deleted.
574         (WebCore::ImageDecoder::frameIsCompleteAtIndex const): Deleted.
575         (WebCore::ImageDecoder::frameOrientationAtIndex const): Deleted.
576         (WebCore::ImageDecoder::frameDurationAtIndex const): Deleted.
577         (WebCore::ImageDecoder::frameAllowSubsamplingAtIndex const): Deleted.
578         (WebCore::ImageDecoder::frameHasAlphaAtIndex const): Deleted.
579         (WebCore::ImageDecoder::frameBytesAtIndex const): Deleted.
580         (WebCore::ImageDecoder::createFrameImageAtIndex const): Deleted.
581         (WebCore::ImageDecoder::setData): Deleted.
582         * platform/graphics/cg/ImageDecoderCG.h:
583         (WebCore::ImageDecoderCG::create):
584         (WebCore::ImageDecoder::create): Deleted.
585         (WebCore::ImageDecoder::isSizeAvailable): Deleted.
586         (WebCore::ImageDecoder::isAllDataReceived const): Deleted.
587         (WebCore::ImageDecoder::clearFrameBufferCache): Deleted.
588         * platform/graphics/win/ImageDecoderDirect2D.cpp:
589         (WebCore::ImageDecoderDirect2D::ImageDecoderDirect2D):
590         (WebCore::ImageDecoderDirect2D::systemImagingFactory):
591         (WebCore::ImageDecoderDirect2D::bytesDecodedToDetermineProperties):
592         (WebCore::ImageDecoderDirect2D::filenameExtension const):
593         (WebCore::ImageDecoderDirect2D::isSizeAvailable const):
594         (WebCore::ImageDecoderDirect2D::encodedDataStatus const):
595         (WebCore::ImageDecoderDirect2D::size const):
596         (WebCore::ImageDecoderDirect2D::frameCount const):
597         (WebCore::ImageDecoderDirect2D::repetitionCount const):
598         (WebCore::ImageDecoderDirect2D::hotSpot const):
599         (WebCore::ImageDecoderDirect2D::frameSizeAtIndex const):
600         (WebCore::ImageDecoderDirect2D::frameIsCompleteAtIndex const):
601         (WebCore::ImageDecoderDirect2D::frameOrientationAtIndex const):
602         (WebCore::ImageDecoderDirect2D::frameDurationAtIndex const):
603         (WebCore::ImageDecoderDirect2D::frameAllowSubsamplingAtIndex const):
604         (WebCore::ImageDecoderDirect2D::frameHasAlphaAtIndex const):
605         (WebCore::ImageDecoderDirect2D::frameBytesAtIndex const):
606         (WebCore::ImageDecoderDirect2D::setTargetContext):
607         (WebCore::ImageDecoderDirect2D::createFrameImageAtIndex const):
608         (WebCore::ImageDecoderDirect2D::setData):
609         * platform/graphics/win/ImageDecoderDirect2D.h:
610         (WebCore::ImageDecoderDirect2D::create):
611         (WebCore::ImageDecoder::create): Deleted.
612         (WebCore::ImageDecoder::isAllDataReceived const): Deleted.
613         (WebCore::ImageDecoder::clearFrameBufferCache): Deleted.
614         * platform/image-decoders/ScalableImageDecoder.cpp: Renamed from Source/WebCore/platform/image-decoders/ImageDecoder.cpp.
615         (WebCore::ScalableImageDecoder::create):
616         (WebCore::ScalableImageDecoder::frameIsCompleteAtIndex const):
617         (WebCore::ScalableImageDecoder::frameHasAlphaAtIndex const):
618         (WebCore::ScalableImageDecoder::frameBytesAtIndex const):
619         (WebCore::ScalableImageDecoder::frameDurationAtIndex const):
620         (WebCore::ScalableImageDecoder::createFrameImageAtIndex):
621         (WebCore::ScalableImageDecoder::prepareScaleDataIfNecessary):
622         (WebCore::ScalableImageDecoder::upperBoundScaledX):
623         (WebCore::ScalableImageDecoder::lowerBoundScaledX):
624         (WebCore::ScalableImageDecoder::upperBoundScaledY):
625         (WebCore::ScalableImageDecoder::lowerBoundScaledY):
626         (WebCore::ScalableImageDecoder::scaledY):
627         * platform/image-decoders/ScalableImageDecoder.h: Renamed from Source/WebCore/platform/image-decoders/ImageDecoder.h.
628         (WebCore::ScalableImageDecoder::ScalableImageDecoder):
629         (WebCore::ScalableImageDecoder::~ScalableImageDecoder):
630         (WebCore::ScalableImageDecoder::premultiplyAlpha const):
631         (WebCore::ScalableImageDecoder::isAllDataReceived const):
632         (WebCore::ScalableImageDecoder::size const):
633         (WebCore::ScalableImageDecoder::scaledSize):
634         (WebCore::ScalableImageDecoder::setSize):
635         (WebCore::ScalableImageDecoder::setIgnoreGammaAndColorProfile):
636         (WebCore::ScalableImageDecoder::ignoresGammaAndColorProfile const):
637         (WebCore::ScalableImageDecoder::rgbColorProfile):
638         (WebCore::ScalableImageDecoder::subsamplingLevelForScale):
639         (WebCore::ScalableImageDecoder::inputDeviceColorProfile):
640         (WebCore::ScalableImageDecoder::setFailed):
641         (WebCore::ScalableImageDecoder::failed const):
642         * platform/image-decoders/bmp/BMPImageDecoder.cpp:
643         (WebCore::BMPImageDecoder::BMPImageDecoder):
644         (WebCore::BMPImageDecoder::setData):
645         (WebCore::BMPImageDecoder::setFailed):
646         * platform/image-decoders/bmp/BMPImageDecoder.h:
647         * platform/image-decoders/bmp/BMPImageReader.h:
648         * platform/image-decoders/gif/GIFImageDecoder.cpp:
649         (WebCore::GIFImageDecoder::GIFImageDecoder):
650         (WebCore::GIFImageDecoder::setData):
651         (WebCore::GIFImageDecoder::setSize):
652         (WebCore::GIFImageDecoder::setFailed):
653         * platform/image-decoders/gif/GIFImageDecoder.h:
654         * platform/image-decoders/ico/ICOImageDecoder.cpp:
655         (WebCore::ICOImageDecoder::ICOImageDecoder):
656         (WebCore::ICOImageDecoder::setData):
657         (WebCore::ICOImageDecoder::size):
658         (WebCore::ICOImageDecoder::setSize):
659         (WebCore::ICOImageDecoder::setFailed):
660         * platform/image-decoders/ico/ICOImageDecoder.h:
661         * platform/image-decoders/jpeg/JPEGImageDecoder.cpp:
662         (WebCore::JPEGImageDecoder::JPEGImageDecoder):
663         (WebCore::JPEGImageDecoder::setSize):
664         (WebCore::JPEGImageDecoder::setFailed):
665         * platform/image-decoders/jpeg/JPEGImageDecoder.h:
666         * platform/image-decoders/png/PNGImageDecoder.cpp:
667         (WebCore::PNGImageReader::decode):
668         (WebCore::PNGImageDecoder::PNGImageDecoder):
669         (WebCore::PNGImageDecoder::setSize):
670         (WebCore::PNGImageDecoder::frameBufferAtIndex):
671         (WebCore::PNGImageDecoder::setFailed):
672         * platform/image-decoders/png/PNGImageDecoder.h:
673         * platform/image-decoders/webp/WEBPImageDecoder.cpp:
674         (WebCore::WEBPImageDecoder::WEBPImageDecoder):
675         (WebCore::WEBPImageDecoder::decode):
676         * platform/image-decoders/webp/WEBPImageDecoder.h:
677
678 2017-09-18  Andy Estes  <aestes@apple.com>
679
680         [Mac] Upstream miscellaneous WebKitSystemInterface functions
681         https://bugs.webkit.org/show_bug.cgi?id=177029
682
683         Reviewed by Alex Christensen.
684
685         * Configurations/WebCore.xcconfig: Used -force_load of libPAL instead of -ObjC. This forces
686         the linker to load both Objective-C and C PAL symbols in WebCore. This change is needed for
687         PAL::popUpMenu(), which is used by WebKit and WebKitLegacy but not WebCore.
688         * platform/cocoa/LocalizedStringsCocoa.mm:
689         (WebCore::contextMenuItemTagSearchWeb):
690         * platform/cocoa/ScrollController.mm:
691         (WebCore::elasticDeltaForTimeDelta):
692         (WebCore::elasticDeltaForReboundDelta):
693         (WebCore::reboundDeltaForElasticDelta):
694         * platform/graphics/ca/GraphicsLayerCA.cpp:
695         (WebCore::GraphicsLayerCA::createTransformAnimationsFromKeyframes):
696         * platform/mac/CursorMac.mm:
697         (WebCore::WKCoreCursor_coreCursorType):
698         (WebCore::createCoreCursorClass):
699         (WebCore::coreCursorClass):
700         (WebCore::cursor):
701         (WebCore::Cursor::ensurePlatformCursor const):
702         * platform/mac/WebCoreSystemInterface.h:
703         * platform/mac/WebCoreSystemInterface.mm:
704         * rendering/RenderThemeMac.mm:
705         (WebCore::RenderThemeMac::paintTextArea):
706
707 2017-09-18  Yoshiaki Jitsukawa  <Yoshiaki.Jitsukawa@sony.com>
708
709         [Win][PAL] Move WebCoreHeaderDetection.h to PAL
710         https://bugs.webkit.org/show_bug.cgi?id=176990
711
712         Reviewed by Alex Christensen.
713
714         * PlatformWin.cmake:
715         Stop generating WebCoreHeaderDetection.h in WebCore.
716
717         * config.h:
718         * platform/graphics/ca/win/PlatformCALayerWin.cpp:
719         * platform/graphics/ca/win/PlatformCALayerWinInternal.cpp:
720         Include PALHeaderDetection.h instead of WebCoreHeaderDetection.h
721
722 2017-09-18  Basuke Suzuki  <Basuke.Suzuki@sony.com>
723
724         [Curl] Create classes dedicated to handle SSL related tasks
725         and separate verifier and certificate management.
726         https://bugs.webkit.org/show_bug.cgi?id=176910
727
728         Reviewed by Alex Christensen.
729
730         * platform/Curl.cmake:
731         * platform/network/curl/CurlContext.cpp:
732         (WebCore::CurlContext::CurlContext):
733         (WebCore::CurlHandle::setCACertPath):
734         (WebCore::certificatePath): Deleted.
735         (WebCore::CurlHandle::enableCAInfoIfExists): Deleted.
736         (WebCore::CurlHandle::setSslErrors): Deleted.
737         (WebCore::CurlHandle::getSslErrors): Deleted.
738         * platform/network/curl/CurlContext.h:
739         (WebCore::CurlContext::sslHandle):
740         (WebCore::CurlContext::getCertificatePath const): Deleted.
741         (WebCore::CurlContext::shouldIgnoreSSLErrors const): Deleted.
742         * platform/network/curl/CurlDownload.cpp:
743         (WebCore::CurlDownload::setupRequest):
744         * platform/network/curl/CurlSSLHandle.cpp: Added.
745         (WebCore::CurlSSLHandle::CurlSSLHandle):
746         (WebCore::CurlSSLHandle::getCACertPathEnv):
747         (WebCore::CurlSSLHandle::setHostAllowsAnyHTTPSCertificate):
748         (WebCore::CurlSSLHandle::isAllowedHTTPSCertificateHost):
749         (WebCore::CurlSSLHandle::canIgnoredHTTPSCertificate):
750         (WebCore::CurlSSLHandle::setClientCertificateInfo):
751         (WebCore::CurlSSLHandle::getSSLClientCertificate):
752         * platform/network/curl/CurlSSLHandle.h: Renamed from Source/WebCore/platform/network/curl/SSLHandle.h.
753         (WebCore::CurlSSLHandle::shouldIgnoreSSLErrors const):
754         (WebCore::CurlSSLHandle::getCACertPath const):
755         * platform/network/curl/CurlSSLVerifier.cpp: Renamed from Source/WebCore/platform/network/curl/SSLHandle.cpp.
756         (WebCore::CurlSSLVerifier::setSslCtx):
757         (WebCore::CurlSSLVerifier::certVerifyCallback):
758         (WebCore::CurlSSLVerifier::getPemDataFromCtx):
759         (WebCore::CurlSSLVerifier::convertToSSLCertificateFlags):
760         * platform/network/curl/CurlSSLVerifier.h: Added.
761         (WebCore::CurlSSLVerifier::setCurlHandle):
762         (WebCore::CurlSSLVerifier::setHostName):
763         (WebCore::CurlSSLVerifier::sslErrors):
764         * platform/network/curl/ResourceHandleCurl.cpp:
765         (WebCore::ResourceHandle::setHostAllowsAnyHTTPSCertificate):
766         (WebCore::ResourceHandle::setClientCertificateInfo):
767         * platform/network/curl/ResourceHandleCurlDelegate.cpp:
768         (WebCore::ResourceHandleCurlDelegate::ResourceHandleCurlDelegate):
769         (WebCore::ResourceHandleCurlDelegate::setupRequest):
770         (WebCore::ResourceHandleCurlDelegate::notifyFail):
771         (WebCore::ResourceHandleCurlDelegate::willSetupSslCtx):
772         (WebCore::ResourceHandleCurlDelegate::willSetupSslCtxCallback):
773         * platform/network/curl/ResourceHandleCurlDelegate.h:
774
775 2017-09-17  Carlos Garcia Campos  <cgarcia@igalia.com>
776
777         REGRESSION(r221974): [Harfbuzz] Test fast/text/international/hebrew-selection.html is failing since r221974
778         https://bugs.webkit.org/show_bug.cgi?id=177036
779
780         Reviewed by Michael Catanzaro.
781
782         In r221974 I rewrote the characterIndexForXPosition implementation without taking into account that there can be
783         multiple glyphs for the same character, so we can't simply do index++ and index-- to get the next and previous
784         character index.
785
786         * platform/graphics/harfbuzz/HarfBuzzShaper.cpp:
787         (WebCore::HarfBuzzShaper::HarfBuzzRun::characterIndexForXPosition): Always get the character index from
788         m_glyphToCharacterIndexes array.
789
790 2017-09-17  Carlos Garcia Campos  <cgarcia@igalia.com>
791
792         [Harfbuzz] Test fast/text/complex-text-selection.html is failing since r222090
793         https://bugs.webkit.org/show_bug.cgi?id=177035
794
795         Reviewed by Michael Catanzaro.
796
797         The problem was not actually introduced in r222090, but revelaed by that change. The bug was added in r222086,
798         when adding the support for shaping a range of characters. We are not correctly filtering the characters in case
799         of rtl in some cases.
800
801         Fixes: fast/text/complex-text-selection.html
802
803         * platform/graphics/harfbuzz/HarfBuzzShaper.cpp:
804         (WebCore::HarfBuzzShaper::fillGlyphBufferFromHarfBuzzRun): When checking if the current character is inside
805         the given range, continue or break the loop depending on whether text is rtl or not.
806
807 2017-09-16  Michael Catanzaro  <mcatanzaro@igalia.com>
808
809         [GTK] Build failure with enchant-2.1.1
810         https://bugs.webkit.org/show_bug.cgi?id=176877
811
812         Unreviewed build fix for enchant 2.1.1.
813
814         enchant_dict_free_suggestions() has been deprecated since at least 2005. Use its
815         replacement, enchant_dict_free_string_list(), instead. That's also been around since at
816         least 2005.
817
818         * platform/text/enchant/TextCheckerEnchant.cpp:
819         (WebCore::TextCheckerEnchant::getGuessesForWord):
820
821 2017-09-16  Antti Koivisto  <antti@apple.com>
822
823         Computing animated style should not require renderers
824         https://bugs.webkit.org/show_bug.cgi?id=171926
825         <rdar://problem/34428035>
826
827         Reviewed by Sam Weinig.
828
829         CSS animation system is now element rather than renderer based. This allows cleaning up
830         style resolution and render tree update code.
831
832         This also fixes bug animation doesn't run if display property is animated from one rendered type
833         to another. Added a test case for this.
834
835         Test: transitions/transition-display-property-2.html
836
837         * page/animation/CSSAnimationController.cpp:
838         (WebCore::CSSAnimationController::updateAnimations):
839
840             Pass in the old style instead of getting it from the renderer.
841             Factor to return the animated style as a return value.
842
843         * page/animation/CSSAnimationController.h:
844         * rendering/RenderElement.cpp:
845         (WebCore::RenderElement::RenderElement):
846         (WebCore::RenderElement::willBeDestroyed):
847
848             Animation are now canceled by RenderTreeUpdater::tearDownRenderers.
849
850         * rendering/RenderElement.h:
851         (WebCore::RenderElement::hasInitialAnimatedStyle const): Deleted.
852         (WebCore::RenderElement::setHasInitialAnimatedStyle): Deleted.
853
854             We no longer need to this concept.
855
856         * style/RenderTreeUpdater.cpp:
857         (WebCore::RenderTreeUpdater::updateElementRenderer):
858         (WebCore::RenderTreeUpdater::createRenderer):
859
860             We now get correct animated style from style resolution in all cases so we don't need to compute
861             it separately for new renderers.
862
863         (WebCore::RenderTreeUpdater::tearDownRenderers):
864
865             Cancel animations when render tree is fully torn down. Keep them when updating style.
866
867         * style/RenderTreeUpdater.h:
868         * style/StyleTreeResolver.cpp:
869         (WebCore::Style::TreeResolver::createAnimatedElementUpdate):
870
871             We can now compute animated style without renderer. Special cases dealing with rendererless case
872             can be removed.
873
874 2017-09-15  Carlos Garcia Campos  <cgarcia@igalia.com>
875
876         [Harbuzz] Test fast/text/international/harfbuzz-runs-with-no-glyph.html is crashing
877         https://bugs.webkit.org/show_bug.cgi?id=177005
878
879         Reviewed by Michael Catanzaro.
880
881         Fixes: fast/text/international/harfbuzz-runs-with-no-glyph.html
882
883         * platform/graphics/harfbuzz/HarfBuzzShaper.cpp:
884         (WebCore::HarfBuzzShaper::HarfBuzzRun::xPositionForOffset): Return early if there aren't glyphs.
885
886 2017-09-15  Said Abou-Hallawa  <sabouhallawa@apple.com>
887
888         Avoid calling String::format() in PlatformCAFilters::setFiltersOnLayer()
889         https://bugs.webkit.org/show_bug.cgi?id=177028
890
891         Reviewed by Tim Horton.
892
893         String::format() is a bigger hammer for what we need to do in this function.
894
895         * platform/graphics/ca/cocoa/PlatformCAFiltersCocoa.mm:
896
897 2017-09-15  Ryosuke Niwa  <rniwa@webkit.org>
898
899         iOS: Use blob URL instead of a WebKit fake URL when pasting an image
900         https://bugs.webkit.org/show_bug.cgi?id=176986
901         <rdar://problem/34455052>
902
903         Reviewed by Wenson Hsieh.
904
905         Fixed the bug that pasting an image on iOS resulted in an img element with src attribute
906         set to a WebKit fake URL so that the Web content could never save it.
907
908         Like r208451 on Mac, use a Blob URL instead.
909
910         This patch also removes createFragmentForImageResourceAndAddResource since it's no longer used.
911
912         Tests: LayoutTests/editing/pasteboard/paste-image-as-blob-url.html
913
914         * editing/cocoa/WebContentReaderCocoa.mm:
915         (WebCore::WebContentReader::readImage): Moved the code here from WebContentReaderMac.mm.
916         * editing/ios/WebContentReaderIOS.mm:
917         (WebCore::WebContentReader::readImage): Deleted. This is the code 
918         * editing/mac/WebContentReaderMac.mm:
919         (WebCore::WebContentReader::readImage): Moved to WebContentReaderCocoa.mm. Note that
920         typeAsFilenameWithExtension was dead code after r208451
921         * editing/markup.cpp:
922         (WebCore::createFragmentForImageResourceAndAddResource): Deleted.
923         * editing/markup.h:
924
925 2017-09-15  Wenson Hsieh  <wenson_hsieh@apple.com>
926
927         Avoid style recomputation when forwarding a focus event to an text field's input type
928         https://bugs.webkit.org/show_bug.cgi?id=176160
929         <rdar://problem/34184820>
930
931         Reviewed by Ryosuke Niwa.
932
933         Currently, TextFieldInputType::forwardEvent synchronously triggers style recomputation, for the purpose of
934         scrolling to the origin upon handling a blur event, and also for updating caps lock state after a blur or focus.
935         In synchronously triggering style recomputation, we may end up running arbitrary JavaScript, which may change
936         the HTMLInputElement's type and cause the current TextFieldInputType to be destroyed.
937
938         To mitigate this, we only update caps lock state when forwarding a focus or blur event to the InputType, and
939         instead scroll blurred text fields to the origin later, in HTMLInputElement::didBlur (invoked from
940         Document::setFocusedElement after blur and focusout events have fired). Instead of having the InputType update
941         style, lift the call to Document::updateStyleIfNeeded up into HTMLInputElement so that we gracefully handle the
942         case where the page destroys and sets a new InputType within the scope of this style update.
943
944         Test: fast/forms/change-input-type-in-focus-handler.html
945
946         * dom/Document.cpp:
947         (WebCore::Document::setFocusedElement):
948         * html/HTMLInputElement.cpp:
949         (WebCore::HTMLInputElement::didBlur):
950         * html/HTMLInputElement.h:
951         * html/InputType.h:
952         (WebCore::InputType::elementDidBlur):
953         * html/TextFieldInputType.cpp:
954         (WebCore::TextFieldInputType::forwardEvent):
955         (WebCore::TextFieldInputType::elementDidBlur):
956         * html/TextFieldInputType.h:
957
958 2017-09-15  JF Bastien  <jfbastien@apple.com>
959
960         WTF: use Forward.h when appropriate instead of Vector.h
961         https://bugs.webkit.org/show_bug.cgi?id=176984
962
963         Reviewed by Saam Barati.
964
965         There's no need to include Vector.h when Forward.h will suffice. All we need is to move the template default parameters from Vector, and then the forward declaration can be used in so many new places: if a header only takes Vector by reference, rvalue reference, pointer, returns any of these, or has them as members then the header doesn't need to see the definition because the declaration will suffice.
966
967         * Modules/entriesapi/FileSystemEntriesCallback.h:
968         * Modules/indexeddb/IDBEventDispatcher.h:
969         * Modules/indexeddb/IDBFactory.h:
970         * Modules/indexeddb/client/IDBConnectionProxy.h:
971         * Modules/indexeddb/server/IDBConnectionToClientDelegate.h:
972         * Modules/webdatabase/DatabaseTask.h:
973         * Modules/websockets/WebSocketChannelClient.h:
974         * contentextensions/CombinedURLFilters.h:
975         * crypto/SerializedCryptoKeyWrap.h:
976         * css/InspectorCSSOMWrappers.h:
977         * css/PageRuleCollector.h:
978         * css/parser/CSSParserTokenRange.h:
979         * dom/DocumentTouch.h:
980         * dom/MutationCallback.h:
981         * editing/EditingStyle.h:
982         * editing/SpellChecker.h:
983         * editing/markup.h:
984         * fileapi/ThreadableBlobRegistry.h:
985         * html/FileListCreator.h:
986         * inspector/WebHeapAgent.h:
987         * loader/ContentFilter.cpp:
988         (WebCore::ContentFilter::ContentFilter):
989         * loader/ContentFilter.h:
990         * loader/CookieJar.h:
991         * loader/FrameLoaderClient.h:
992         * loader/LoaderStrategy.h:
993         * loader/SubframeLoader.h:
994         * page/ChromeClient.h:
995         * page/FrameSnapshotting.h:
996         * page/IntersectionObserverCallback.h:
997         * page/PageSerializer.h:
998         * page/UserContentURLPattern.h:
999         * page/scrolling/AxisScrollSnapOffsets.h:
1000         * page/win/FrameWin.h:
1001         * platform/CookiesStrategy.h:
1002         * platform/KeyedCoding.h:
1003         * platform/PasteboardStrategy.h:
1004         * platform/SSLKeyGenerator.h:
1005         * platform/ScrollableArea.h:
1006         * platform/encryptedmedia/CDMFactory.h:
1007         * platform/gamepad/EmptyGamepadProvider.cpp:
1008         * platform/gamepad/GamepadProvider.h:
1009         * platform/gamepad/GamepadProviderClient.h:
1010         * platform/gamepad/PlatformGamepad.h:
1011         * platform/graphics/GeometryUtilities.cpp:
1012         * platform/graphics/GeometryUtilities.h:
1013         * platform/graphics/Icon.h:
1014         * platform/graphics/LayoutRect.h:
1015         * platform/graphics/Path.h:
1016         * platform/graphics/WOFFFileFormat.h:
1017         * platform/graphics/avfoundation/MediaSampleAVFObjC.h:
1018         * platform/graphics/avfoundation/objc/AVAssetTrackUtilities.h:
1019         * platform/graphics/ca/PlatformCAAnimation.h:
1020         * platform/graphics/ca/win/PlatformCALayerWinInternal.h:
1021         * platform/graphics/opentype/OpenTypeMathData.h:
1022         * platform/image-encoders/JPEGImageEncoder.h:
1023         * platform/image-encoders/PNGImageEncoder.h:
1024         * platform/network/BlobRegistry.h:
1025         * platform/network/HTTPParsers.h:
1026         * platform/network/PlatformCookieJar.h:
1027         * platform/network/cf/DownloadBundle.h:
1028         * platform/network/curl/CurlCacheEntry.h:
1029         * platform/network/curl/DownloadBundle.h:
1030         * platform/text/LineEnding.h:
1031         * platform/text/QuotedPrintable.cpp:
1032         * platform/text/QuotedPrintable.h:
1033         * rendering/FlexibleBoxAlgorithm.h:
1034         * rendering/style/QuotesData.h:
1035         * rendering/svg/SVGSubpathData.h:
1036         * storage/StorageEventDispatcher.h:
1037         * style/StyleInvalidator.h:
1038         * style/StyleRelations.h:
1039         * svg/SVGAltGlyphDefElement.h:
1040         * svg/SVGAltGlyphItemElement.h:
1041
1042 2017-09-15  Youenn Fablet  <youenn@apple.com>
1043
1044         ASSERTION FAILED: writtenAudioDuration >= readAudioDuration in com.apple.WebCore:WebCore::RealtimeOutgoingAudioSource::isReachingBufferedAudioDataHighLimit() + 222
1045         https://bugs.webkit.org/show_bug.cgi?id=175164
1046         <rdar://problem/33712305>
1047
1048         Reviewed by Eric Carlson.
1049
1050         No observable change of behavior.
1051
1052         * platform/mediastream/mac/RealtimeOutgoingAudioSource.cpp:
1053         (WebCore::RealtimeOutgoingAudioSource::hasBufferedEngouhData):
1054         (WebCore::RealtimeOutgoingAudioSource::audioSamplesAvailable): Calling pullData only if there is at least 0.01 seconds of available data.
1055         * platform/mediastream/mac/RealtimeOutgoingAudioSource.h:
1056
1057 2017-09-15  Youenn Fablet  <youenn@apple.com>
1058
1059         Move code using Vector::map to WTF:map
1060         https://bugs.webkit.org/show_bug.cgi?id=176860
1061
1062         Reviewed by Jer Noble.
1063
1064         No change of behavior.
1065
1066         * loader/FormSubmission.cpp:
1067         (WebCore::FormSubmission::create): Moving to WTF::map.
1068         * page/Settings.cpp:
1069         (WebCore::Settings::setMediaContentTypesRequiringHardwareSupport): Using iterator split to not create a temporary vector.
1070         * platform/ContentType.cpp:
1071         (WebCore::ContentType::ContentType):
1072         (WebCore::splitParameters):
1073         (WebCore::ContentType::codecs const): Ditto.
1074         (WebCore::ContentType::profiles const): Ditto.
1075         (WebCore::stripHTMLWhiteSpace): Deleted.
1076         * platform/ContentType.h:
1077         (WebCore::ContentType::create): Deleted.
1078         * platform/graphics/MediaPlayer.cpp:
1079         (WebCore::MediaPlayer::load): Minor count churning change.
1080
1081 2017-09-15  Youenn Fablet  <youenn@apple.com>
1082
1083         MediaPlayerPrivateMediaStreamAVFObjC::requestNotificationWhenReadyForVideoData should enqueue data if still useful
1084         https://bugs.webkit.org/show_bug.cgi?id=177016
1085
1086         Reviewed by Jer Noble.
1087
1088         No change of behavior.
1089
1090         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
1091         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::requestNotificationWhenReadyForVideoData): exciting early in block to prevent enqueueing.
1092
1093 2017-09-15  Ryan Haddad  <ryanhaddad@apple.com>
1094
1095         Unreviewed, rolling out r222040.
1096
1097         The LayoutTest added with this change is a flaky image failure
1098         on mac-wk1 debug bots.
1099
1100         Reverted changeset:
1101
1102         "Computing animated style should not require renderers"
1103         https://bugs.webkit.org/show_bug.cgi?id=171926
1104         http://trac.webkit.org/changeset/222040
1105
1106 2017-09-15  Tim Horton  <timothy_horton@apple.com>
1107
1108         Fix the macOS CMake build
1109         https://bugs.webkit.org/show_bug.cgi?id=177015
1110
1111         Reviewed by Andy Estes.
1112
1113         * CMakeLists.txt:
1114         Add Payment Request files.
1115
1116         * PlatformMac.cmake:
1117         Add the CoreServices umbrella framework to the framework search path.
1118         Add service workers directories to the forwarding headers path.
1119         Add Modules/cache directory to the forwarding headers path.
1120
1121         * rendering/svg/RenderSVGRoot.cpp:
1122         (WebCore::resolveLengthAttributeForSVG): Deleted unused function.
1123
1124 2017-09-15  John Wilander  <wilander@apple.com>
1125
1126         Storage Access API: Deny access to nested iframes
1127         https://bugs.webkit.org/show_bug.cgi?id=176939
1128         <rdar://problem/34439609>
1129
1130         Reviewed by Brent Fulgham.
1131
1132         Test: http/tests/storageAccess/request-and-grant-storage-access-cross-origin-sandboxed-nested-iframe.html
1133
1134         * dom/Document.cpp:
1135         (WebCore::Document::requestStorageAccess):
1136
1137 2017-09-15  Antti Koivisto  <antti@apple.com>
1138
1139         AnimationBase should ref the element
1140         https://bugs.webkit.org/show_bug.cgi?id=176993
1141
1142         Reviewed by Simon Fraser.
1143
1144         We now longer have renderer pointer. Element can be reffed for safety.
1145
1146         This doesn't create reference cycle as the element pointer is cleared when render tree is
1147         torn down. This happens at the latest when the element is removed from the tree.
1148
1149         * page/animation/AnimationBase.cpp:
1150         (WebCore::AnimationBase::~AnimationBase):
1151         (WebCore::AnimationBase::clear):
1152         * page/animation/AnimationBase.h:
1153         (WebCore::AnimationBase::~AnimationBase): Deleted.
1154         (WebCore::AnimationBase::clear): Deleted.
1155         * page/animation/ImplicitAnimation.cpp:
1156         (WebCore::ImplicitAnimation::pauseAnimation):
1157         (WebCore::ImplicitAnimation::sendTransitionEvent):
1158         (WebCore::ImplicitAnimation::reset):
1159         * page/animation/KeyframeAnimation.cpp:
1160         (WebCore::KeyframeAnimation::pauseAnimation):
1161         (WebCore::KeyframeAnimation::endAnimation):
1162         (WebCore::KeyframeAnimation::sendAnimationEvent):
1163         (WebCore::KeyframeAnimation::resolveKeyframeStyles):
1164
1165 2017-09-15  Brent Fulgham  <bfulgham@apple.com>
1166
1167         Make DocumentLoader a FrameDestructionObserver
1168         https://bugs.webkit.org/show_bug.cgi?id=176364
1169         <rdar://problem/34254780>
1170
1171         Reviewed by Alex Christensen.
1172
1173         The DocumentLoader needs to know when its Frame is destroyed so that it can
1174         perform properly cleanup.
1175
1176         Test: fast/events/beforeunload-dom-manipulation-crash.html
1177
1178         * loader/DocumentLoader.cpp:
1179         (WebCore::DocumentLoader::DocumentLoader): Call FrameDestructionObserver constructor.
1180         (WebCore::DocumentLoader::responseReceived): Drive-by fix. Make sure the current
1181         object is valid during the callback.
1182         (WebCore::DocumentLoader::attachToFrame): Use FrameDestructionObserver::observerFrame rather
1183         than setting the m_frame variable directly.
1184         (WebCore::DocumentLoader::detachFromFrame): Ditto.
1185         * loader/DocumentLoader.h:
1186         (WebCore::DocumentLoader::frame const): Deleted, as this is provided by the FrameDestructionObserver.
1187
1188 2017-09-15  Ms2ger  <Ms2ger@igalia.com>
1189
1190         Update some WebGL2 return types to match the specification.
1191         https://bugs.webkit.org/show_bug.cgi?id=176996
1192
1193         Reviewed by Alex Christensen.
1194
1195         This should not change the behavior in any way, but it makes it simpler
1196         to compare our IDL with the specification's.
1197
1198         No new tests because there is no behavior change.
1199
1200         * html/canvas/WebGL2RenderingContext.cpp:
1201         (WebCore::WebGL2RenderingContext::getUniformIndices):
1202         * html/canvas/WebGL2RenderingContext.h:
1203         * html/canvas/WebGL2RenderingContext.idl:
1204
1205 2017-09-15  Antti Koivisto  <antti@apple.com>
1206
1207         Remove FilterOperation::blendingNeedsRendererSize()
1208         https://bugs.webkit.org/show_bug.cgi?id=176994
1209
1210         Reviewed by Simon Fraser.
1211
1212         It is not used.
1213
1214         * page/animation/CSSPropertyAnimation.cpp:
1215         (WebCore::blendFunc):
1216         * platform/graphics/filters/FilterOperation.h:
1217         (WebCore::FilterOperation::blend):
1218         (WebCore::FilterOperation::shouldBeRestrictedBySecurityOrigin const):
1219         (WebCore::FilterOperation::blendingNeedsRendererSize const): Deleted.
1220
1221 2017-09-15  Youenn Fablet  <youenn@apple.com>
1222
1223         Add an URL method to remove both query string and fragment identifier
1224         https://bugs.webkit.org/show_bug.cgi?id=176911
1225
1226         Reviewed by Alex Christensen.
1227
1228         Covered by existing tests and new API tests.
1229
1230         * Modules/cache/DOMCache.cpp:
1231         (WebCore::DOMCache::retrieveRecords): Using new helper method.
1232         * platform/URL.cpp:
1233         (WebCore::URL::removeQueryAndFragmentIdentifier):
1234         * platform/URL.h:
1235
1236 2017-09-15  Andy Estes  <aestes@apple.com>
1237
1238         [Cocoa] Upstream MediaRemote and VideoToolbox WebKitSystemInterface functions
1239         https://bugs.webkit.org/show_bug.cgi?id=176953
1240
1241         Reviewed by Eric Carlson.
1242
1243         * platform/cocoa/VideoToolboxSoftLink.cpp:
1244         * platform/cocoa/VideoToolboxSoftLink.h:
1245         * platform/graphics/avfoundation/CDMPrivateMediaSourceAVFObjC.mm:
1246         (WebCore::queryDecoderAvailability):
1247         (WebCore::CDMPrivateMediaSourceAVFObjC::supportsKeySystem):
1248         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
1249         (WebCore::MediaPlayerPrivateAVFoundationObjC::wirelessPlaybackTargetType const):
1250         (WebCore::exernalDeviceDisplayNameForPlayer):
1251         (WebCore::MediaPlayerPrivateAVFoundationObjC::wirelessPlaybackTargetName const):
1252         * platform/ios/WebCoreSystemInterfaceIOS.mm:
1253         * platform/mac/MediaRemoteSoftLink.cpp:
1254         * platform/mac/MediaRemoteSoftLink.h:
1255         * platform/mac/WebCoreSystemInterface.h:
1256         * platform/mac/WebCoreSystemInterface.mm:
1257
1258 2017-09-15  Eric Carlson  <eric.carlson@apple.com>
1259
1260         Switch text tracks to release logging
1261         https://bugs.webkit.org/show_bug.cgi?id=176809
1262         <rdar://problem/34397605>
1263
1264         Reviewed by Jer Noble.
1265
1266         Make all track objects use the same logger and log identifier as the media element they
1267         "belong" to. Convert all track logging from debug-only to release logging.
1268
1269         * WebCore.xcodeproj/project.pbxproj:
1270         * html/HTMLMediaElement.cpp:
1271         (WebCore::HTMLMediaElement::updateActiveTextTrackCues):
1272         * html/HTMLMediaElement.h:
1273         * html/track/AudioTrack.cpp:
1274         (WebCore::AudioTrack::AudioTrack):
1275         (WebCore::AudioTrack::setPrivate):
1276         (WebCore::AudioTrack::setMediaElement):
1277         * html/track/AudioTrack.h:
1278         * html/track/DataCue.cpp:
1279         (WebCore::DataCue::toString const):
1280         * html/track/DataCue.h:
1281         (PAL::LogArgument<WebCore::DataCue>::toString):
1282         * html/track/InbandDataTextTrack.cpp:
1283         (WebCore::InbandDataTextTrack::addDataCue):
1284         (WebCore::InbandDataTextTrack::updateDataCue):
1285         (WebCore::InbandDataTextTrack::removeDataCue):
1286         * html/track/InbandDataTextTrack.h:
1287         * html/track/InbandGenericTextTrack.cpp:
1288         (WebCore::InbandGenericTextTrack::addGenericCue):
1289         (WebCore::InbandGenericTextTrack::removeGenericCue):
1290         (WebCore::InbandGenericTextTrack::newCuesParsed):
1291         (WebCore::InbandGenericTextTrack::fileFailedToParse):
1292         * html/track/InbandGenericTextTrack.h:
1293         * html/track/InbandTextTrack.cpp:
1294         (WebCore::InbandTextTrack::InbandTextTrack):
1295         (WebCore::InbandTextTrack::setMediaElement):
1296         * html/track/InbandTextTrack.h:
1297         * html/track/InbandWebVTTTextTrack.cpp:
1298         (WebCore::InbandWebVTTTextTrack::newCuesParsed):
1299         (WebCore::InbandWebVTTTextTrack::fileFailedToParse):
1300         * html/track/InbandWebVTTTextTrack.h:
1301         * html/track/LoadableTextTrack.cpp:
1302         (WebCore::LoadableTextTrack::newCuesAvailable):
1303         (WebCore::LoadableTextTrack::cueLoadingCompleted):
1304         * html/track/LoadableTextTrack.h:
1305         * html/track/TextTrack.cpp:
1306         (WebCore::TextTrack::addCue):
1307         (WebCore::TextTrack::removeCue):
1308         (WebCore::TextTrack::setLanguage):
1309         * html/track/TextTrack.h:
1310         * html/track/TextTrackCue.cpp:
1311         (WebCore::TextTrackCue::toString const):
1312         * html/track/TextTrackCue.h:
1313         (PAL::LogArgument<WebCore::TextTrackCue>::toString):
1314         * html/track/TextTrackCueGeneric.cpp:
1315         (WebCore::TextTrackCueGeneric::setFontSize):
1316         (WebCore::TextTrackCueGeneric::toString const):
1317         * html/track/TextTrackCueGeneric.h:
1318         (PAL::LogArgument<WebCore::TextTrackCueGeneric>::toString):
1319         * html/track/TrackBase.cpp:
1320         (WebCore::nextLogIdentifier):
1321         (WebCore::nullLogger):
1322         (WebCore::TrackBase::TrackBase):
1323         (WebCore::TrackBase::setMediaElement):
1324         (WebCore::TrackBase::logChannel const):
1325         (WebCore::TrackBase::~TrackBase): Deleted.
1326         * html/track/TrackBase.h:
1327         (WebCore::TrackBase::setMediaElement): Deleted.
1328         * html/track/VTTCue.cpp:
1329         (WebCore::VTTCue::setFontSize):
1330         (WebCore::VTTCue::toString const):
1331         * html/track/VTTCue.h:
1332         (PAL::LogArgument<WebCore::VTTCue>::toString):
1333         * html/track/VideoTrack.cpp:
1334         (WebCore::VideoTrack::VideoTrack):
1335         (WebCore::VideoTrack::setPrivate):
1336         (WebCore::VideoTrack::setMediaElement):
1337         * html/track/VideoTrack.h:
1338         * platform/graphics/AudioTrackPrivate.h:
1339         * platform/graphics/InbandTextTrackPrivate.h:
1340         (WebCore::InbandTextTrackPrivate::setClient):
1341         * platform/graphics/InbandTextTrackPrivateClient.h:
1342         (WebCore::GenericCueData::toString const):
1343         (PAL::LogArgument<WebCore::GenericCueData>::toString):
1344         * platform/graphics/TrackPrivateBase.cpp: Added.
1345         (WebCore::TrackPrivateBase::setLogger):
1346         (WebCore::TrackPrivateBase::logChannel const):
1347         * platform/graphics/TrackPrivateBase.h:
1348         * platform/graphics/VideoTrackPrivate.h:
1349         * platform/graphics/avfoundation/AVTrackPrivateAVFObjCImpl.mm:
1350         * platform/graphics/avfoundation/InbandMetadataTextTrackPrivateAVF.cpp:
1351         (WebCore::InbandMetadataTextTrackPrivateAVF::updatePendingCueEndTimes):
1352         (WebCore::InbandMetadataTextTrackPrivateAVF::flushPartialCues):
1353         * platform/graphics/avfoundation/InbandMetadataTextTrackPrivateAVF.h:
1354         * platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp:
1355         (WebCore::InbandTextTrackPrivateAVF::processAttributedStrings):
1356         (WebCore::InbandTextTrackPrivateAVF::removeCompletedCues):
1357         (WebCore::InbandTextTrackPrivateAVF::resetCueValues):
1358         (WebCore::InbandTextTrackPrivateAVF::processNativeSamples):
1359         (WebCore::InbandTextTrackPrivateAVF::readNativeSampleBuffer):
1360         * platform/graphics/avfoundation/InbandTextTrackPrivateAVF.h:
1361         * platform/graphics/avfoundation/objc/AudioTrackPrivateAVFObjC.mm:
1362         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
1363         (-[WebCoreAVFMovieObserver observeValueForKeyPath:ofObject:change:context:]):
1364         * platform/mediastream/mac/AudioTrackPrivateMediaStreamCocoa.cpp:
1365         (WebCore::AudioTrackPrivateMediaStreamCocoa::createAudioUnit):
1366         * platform/mediastream/mac/AudioTrackPrivateMediaStreamCocoa.h:
1367
1368 2017-09-15  Carlos Garcia Campos  <cgarcia@igalia.com>
1369
1370         [Harfbuzz] Material icons not rendered correctly when using the web font
1371         https://bugs.webkit.org/show_bug.cgi?id=176995
1372
1373         Reviewed by Michael Catanzaro.
1374
1375         Only a few of them are correctly rendered and some others are wrong. We only render correctly the ones that
1376         don't have an underscore in their name (or that start with a number like 3d_rotation). In the cases where the
1377         name before the underscore is also an icon, we render that icon instead, that's why some of them are wrong. This
1378         is happening because the underscore is causing the HarfbuffShaper to split the text in 3 runs, one for the word
1379         before the underscore, another one for the underscore and another for the word after the underscore. So, we
1380         end up trying to shape the 3 runs independently and we fail when the icon doesn't exist, or when it exists but
1381         it's not the one we are looking for. The cause of this is that the underscore has a different script (Common)
1382         than the rest of characters (Latin) which is a condition in HarfbuffShaper to create a different run. The
1383         unicode spec says that characters with Common script should be handled differently, but we are just ignoring
1384         it. The spec proposes to use an heuristic based on simply inheriting the script of the previous character, which
1385         should work in most of the cases. We could take a more conservative approach and do that only if both characters
1386         are ASCII. We should also consider handling other cases mentioned by the spec like brackets and quotation marks,
1387         but that belongs to a different bug/commit.
1388
1389         * platform/graphics/harfbuzz/HarfBuzzShaper.cpp:
1390         (WebCore::scriptsAreCompatibleForCharacters): Helper function to check if the current and previous scripts are
1391         compatible,
1392         (WebCore::HarfBuzzShaper::collectHarfBuzzRuns): Use scriptsAreCompatibleForCharacters() to decided whether to
1393         finish the current run or not. In case of Common script, inherit also the script from the previous character.
1394
1395 2017-09-15  Carlos Garcia Campos  <cgarcia@igalia.com>
1396
1397         [Harfbuzz] Fix incorrect font rendering when selecting texts in pages which specifies text-rendering: optimizeLegibility
1398         https://bugs.webkit.org/show_bug.cgi?id=148220
1399
1400         Reviewed by Michael Catanzaro.
1401
1402         Add support for shaping a range of characters and return the advance to the first glyph in the range.
1403
1404         Covered by existing tests.
1405
1406         * platform/graphics/cairo/FontCairoHarfbuzzNG.cpp:
1407         (WebCore::FontCascade::getGlyphsAndAdvancesForComplexText const): Pass "from" and "to" parameters to
1408         HarfBuzzShaper::shape and return the x position of the selection rect.
1409         * platform/graphics/harfbuzz/HarfBuzzShaper.cpp:
1410         (WebCore::HarfBuzzShaper::shape): Forward "from" and "to" parameters to fillGlyphBuffer().
1411         (WebCore::HarfBuzzShaper::fillGlyphBufferFromHarfBuzzRun): Only add glyphs for the given character range.
1412         (WebCore::HarfBuzzShaper::fillGlyphBuffer): Only consider runs in the given character range.
1413         * platform/graphics/harfbuzz/HarfBuzzShaper.h:
1414
1415 2017-09-15  Zan Dobersek  <zdobersek@igalia.com>
1416
1417         [EME] ClearKey: list 'persistent-license' sessions as supported
1418         https://bugs.webkit.org/show_bug.cgi?id=176985
1419
1420         Reviewed by Xabier Rodriguez-Calvar.
1421
1422         The ClearKey implementation should support the 'persistent-license'
1423         session type for testing purposes. Methods in the CDMPrivateClearKey
1424         class have been updated to handle that session type as supported:
1425         - supportsSessionTypeWithConfiguration() returns true for the
1426           'persistent-license' session type values,
1427         - supportsConfiguration() allows persistent state as required in
1428           case of the configured session type being 'persistent-license',
1429         - supportsConfigurationWithRestrictions() as well allows persistent
1430         state as required for 'persistent-license' session types.
1431
1432         No new tests -- affected tests have their baselines updated.
1433
1434         * platform/encryptedmedia/clearkey/CDMClearKey.cpp:
1435         (WebCore::CDMPrivateClearKey::supportsConfiguration const):
1436         (WebCore::CDMPrivateClearKey::supportsConfigurationWithRestrictions const):
1437         (WebCore::CDMPrivateClearKey::supportsSessionTypeWithConfiguration const):
1438
1439 2017-09-15  Ms2ger  <Ms2ger@igalia.com>
1440
1441         Disallow passing a null program to getFragDataLocation.
1442         https://bugs.webkit.org/show_bug.cgi?id=176895
1443
1444         Reviewed by Sam Weinig.
1445
1446         This matches the specification as well as Gecko and Chromium.
1447
1448         Test: fast/canvas/webgl/webgl2/bindings.html
1449
1450         * html/canvas/WebGL2RenderingContext.cpp:
1451         (WebCore::WebGL2RenderingContext::getFragDataLocation):
1452         * html/canvas/WebGL2RenderingContext.h:
1453         * html/canvas/WebGL2RenderingContext.idl:
1454
1455 2017-09-14  Carlos Garcia Campos  <cgarcia@igalia.com>
1456
1457         [FreeType] Complex text is enabled too often after r221909
1458         https://bugs.webkit.org/show_bug.cgi?id=176907
1459
1460         Reviewed by Sergio Villar Senin.
1461
1462         In r221909 we enabled complex text by default following the same cocoa ifdefs, but I forgot another ifdef in the
1463         cpp file.
1464
1465         * platform/graphics/FontCascade.cpp:
1466         (WebCore::FontCascade::codePath const):
1467
1468 2017-09-14  Commit Queue  <commit-queue@webkit.org>
1469
1470         Unreviewed, rolling out r221932 and r221933.
1471         https://bugs.webkit.org/show_bug.cgi?id=176969
1472
1473         This change did not fix the webgl test flakiness. (Requested
1474         by ryanhaddad on #webkit).
1475
1476         Reverted changesets:
1477
1478         "[WebGL] accelerated texImage2D for video doesn't respect
1479         flipY"
1480         https://bugs.webkit.org/show_bug.cgi?id=176491
1481         http://trac.webkit.org/changeset/221932
1482
1483         "[WebGL] VideoTextureCopierCV doesn't correctly restore vertex
1484         attribute state"
1485         https://bugs.webkit.org/show_bug.cgi?id=176771
1486         http://trac.webkit.org/changeset/221933
1487
1488 2017-09-14  Basuke Suzuki  <Basuke.Suzuki@sony.com>
1489
1490         [Curl] Replace the implementation with NetworkLoadMetrics
1491         https://bugs.webkit.org/show_bug.cgi?id=176906
1492
1493         Reviewed by Alex Christensen.
1494
1495         * platform/network/curl/CurlContext.cpp:
1496         (WebCore::CurlHandle::getEffectiveURL):
1497         (WebCore::CurlHandle::getPrimaryPort):
1498         (WebCore::CurlHandle::getResponseCode):
1499         (WebCore::CurlHandle::getContentLenghtDownload):
1500         (WebCore::CurlHandle::getHttpAuthAvail):
1501         (WebCore::CurlHandle::getTimes):
1502         (WebCore::CurlHandle::getEffectiveURL const): Deleted.
1503         * platform/network/curl/CurlContext.h:
1504         * platform/network/curl/CurlDownload.cpp:
1505         (WebCore::CurlDownload::didReceiveHeader):
1506         * platform/network/curl/ResourceHandleCurlDelegate.cpp:
1507         (WebCore::ResourceHandleCurlDelegate::dispatchSynchronousJob):
1508         (WebCore::ResourceHandleCurlDelegate::notifyFinish):
1509         (WebCore::ResourceHandleCurlDelegate::getProtectionSpace):
1510         (WebCore::ResourceHandleCurlDelegate::didReceiveAllHeaders):
1511         (WebCore::ResourceHandleCurlDelegate::handleLocalReceiveResponse):
1512         (WebCore::ResourceHandleCurlDelegate::didFinish):
1513         (WebCore::ResourceHandleCurlDelegate::getNetworkLoadMetrics):
1514         (WebCore::ResourceHandleCurlDelegate::didReceiveHeader):
1515         (WebCore::ResourceHandleCurlDelegate::didReceiveData):
1516         (WebCore::ResourceHandleCurlDelegate::setWebTimings): Deleted.
1517         * platform/network/curl/ResourceHandleCurlDelegate.h:
1518         * platform/network/curl/ResourceResponse.h:
1519         (WebCore::ResourceResponse::setDeprecatedNetworkLoadMetrics):
1520
1521 2017-09-14  Daniel Bates  <dabates@apple.com>
1522
1523         [Mac] Spelling, grammar and correction dots are painted upside down
1524         https://bugs.webkit.org/show_bug.cgi?id=176949
1525         <rdar://problem/34441098>
1526
1527         Reviewed by Simon Fraser.
1528
1529         Painting occurs in a vertically flipped context. Vertically flip the context ("unflip" it)
1530         before painting the document markers on macOS so that they are painted right-side. This makes
1531         the appearance of spelling, grammar and correction dots in WebKit match the AppKit appearance
1532         of these dots.
1533
1534         * platform/graphics/cocoa/GraphicsContextCocoa.mm:
1535         (WebCore::GraphicsContext::drawLineForDocumentMarker): Flip the context as described above.
1536         Also make use of RAII object CGContextStateSaver instead of manually saving and restoring
1537         the state of the context.
1538
1539 2017-09-14  Joseph Pecoraro  <pecoraro@apple.com>
1540
1541         Unreviewed rollout r222036.
1542         
1543         The LayoutTests added with this change is flaky.
1544
1545         Reverted changeset
1546         Web Inspector: Timeline should show when events preventDefault() was called on an event or not
1547         https://bugs.webkit.org/show_bug.cgi?id=176824
1548         http://trac.webkit.org/changeset/222036
1549
1550 2017-09-14  Ryosuke Niwa  <rniwa@webkit.org>
1551
1552         WebContentReader::readWebArchive doesn't need to handle image MIME type
1553         https://bugs.webkit.org/show_bug.cgi?id=176884
1554
1555         Reviewed by Sam Weinig.
1556
1557         Remove the code to handle image MIME types in the web archive on macOS since we have a separate code path
1558         to handle images in the pasteboard directly. As far as I can tell, this code is never used in practice.
1559
1560         This allows merging iOS and macOS code to read web archive from the pasteboard. Also merged member functions
1561         for handling RTFD and RTF in iOS and macOS in WebContentReaderCocoa.mm.
1562
1563         * CMakeLists.txt:
1564         * WebCore.xcodeproj/project.pbxproj:
1565         * editing/WebContentReader.cpp: Added.
1566         (WebCore::WebContentReader::addFragment): Moved from WebContentReaderIOS.mm and simplified since appendChild
1567         knows how to add a DocumentFragment.
1568         * editing/WebContentReader.h:
1569         * editing/cocoa/WebContentReaderCocoa.mm:
1570         (WebCore::createFragmentAndAddResources):
1571         (WebCore::WebContentReader::readWebArchive): Merged iOS / macOS code here.
1572         (WebCore::WebContentReader::readRTFD): Ditto.
1573         (WebCore::WebContentReader::readRTF): Ditto.
1574         (WebCore::WebContentReader::readPlainText): Ditto.
1575         * editing/ios/EditorIOS.mm:
1576         (WebCore::Editor::pasteWithPasteboard):
1577         * editing/ios/WebContentReaderIOS.mm:
1578         (WebCore::WebContentReader::readImage):
1579         (WebCore::WebContentReader::readURL):
1580         (WebCore::WebContentReader::readWebArchive): Moved to WebContentReaderCocoa.mm.
1581         (WebCore::WebContentReader::readRTFD): Ditto.
1582         (WebCore::WebContentReader::readRTF): Ditto.
1583         (WebCore::WebContentReader::readPlainText): Ditto.
1584         * editing/mac/WebContentReaderMac.mm:
1585         (WebCore::WebContentReader::readWebArchive): Ditto.
1586         (WebCore::WebContentReader::readRTFD): Ditto.
1587         (WebCore::WebContentReader::readRTF): Ditto.
1588
1589 2017-09-14  Devin Rousso  <webkit@devinrousso.com>
1590
1591         Web Inspector: make recording swizzle async
1592         https://bugs.webkit.org/show_bug.cgi?id=176936
1593
1594         Reviewed by Joseph Pecoraro.
1595
1596         * inspector/InspectorCanvas.cpp:
1597         (WebCore::InspectorCanvas::buildArrayForCanvasPattern):
1598         (WebCore::InspectorCanvas::buildAction):
1599         For objects that are not able to be stringified (e.g. elements), send a deduplicated string
1600         with the name of the object as a placeholder value (e.g. "Element").
1601
1602 2017-09-14  Andy Estes  <aestes@apple.com>
1603
1604         [Mac] Upstream SpeechSynthesis-related WebKitSystemInterface functions
1605         https://bugs.webkit.org/show_bug.cgi?id=176931
1606
1607         Reviewed by Joseph Pecoraro.
1608
1609         * platform/mac/PlatformSpeechSynthesizerMac.mm:
1610         (WebCore::speechSynthesisGetVoiceIdentifiers):
1611         (WebCore::speechSynthesisGetDefaultVoiceIdentifierForLocale):
1612         (WebCore::PlatformSpeechSynthesizer::initializeVoiceList):
1613         * platform/mac/WebCoreSystemInterface.h:
1614         * platform/mac/WebCoreSystemInterface.mm:
1615
1616 2017-09-14  Youenn Fablet  <youenn@apple.com>
1617
1618         RTCDataChannel connectivity issues in Safari 11
1619         https://bugs.webkit.org/show_bug.cgi?id=173052
1620         <rdar://problem/32712143>
1621
1622         Reviewed by Alex Christensen.
1623
1624         Covered by updated test.
1625
1626         Before the patch, when sending an ArrayBufferView, RTCDataChannel was sending the whole ArrayBuffer backing the ArrayBufferView.
1627         With this patch, RTCDataChannel will now send only the bytes the ArrayBufferView is exposing.
1628
1629         * Modules/mediastream/RTCDataChannel.cpp:
1630         (WebCore::RTCDataChannel::send): Correctly handling sending of ArrayBufferView.
1631         (WebCore::RTCDataChannel::sendRawData): Helper routine for raw data sending.
1632         * Modules/mediastream/RTCDataChannel.h:
1633
1634 2017-09-14  Antti Koivisto  <antti@apple.com>
1635
1636         Computing animated style should not require renderers
1637         https://bugs.webkit.org/show_bug.cgi?id=171926
1638         <rdar://problem/34428035>
1639
1640         Reviewed by Sam Weinig.
1641
1642         CSS animation system is now element rather than renderer based. This allows cleaning up
1643         style resolution and render tree update code.
1644
1645         This also fixes bug animation doesn't run if display property is animated from one rendered type
1646         to another. Added a test case for this.
1647
1648         Test: transitions/transition-display-property-2.html
1649
1650         * page/animation/CSSAnimationController.cpp:
1651         (WebCore::CSSAnimationController::updateAnimations):
1652
1653             Pass in the old style instead of getting it from the renderer.
1654             Factor to return the animated style as a return value.
1655
1656         * page/animation/CSSAnimationController.h:
1657         * rendering/RenderElement.cpp:
1658         (WebCore::RenderElement::RenderElement):
1659         (WebCore::RenderElement::willBeDestroyed):
1660
1661             Animation are now canceled by RenderTreeUpdater::tearDownRenderers.
1662
1663         * rendering/RenderElement.h:
1664         (WebCore::RenderElement::hasInitialAnimatedStyle const): Deleted.
1665         (WebCore::RenderElement::setHasInitialAnimatedStyle): Deleted.
1666
1667             We no longer need to this concept.
1668
1669         * style/RenderTreeUpdater.cpp:
1670         (WebCore::RenderTreeUpdater::updateElementRenderer):
1671         (WebCore::RenderTreeUpdater::createRenderer):
1672
1673             We now get correct animated style from style resolution in all cases so we don't need to compute
1674             it separately for new renderers.
1675
1676         (WebCore::RenderTreeUpdater::tearDownRenderers):
1677
1678             Cancel animations when render tree is fully torn down. Keep them when updating style.
1679
1680         * style/RenderTreeUpdater.h:
1681         * style/StyleTreeResolver.cpp:
1682         (WebCore::Style::TreeResolver::createAnimatedElementUpdate):
1683
1684             We can now compute animated style without renderer. Special cases dealing with rendererless case
1685             can be removed.
1686
1687 2017-09-14  Joseph Pecoraro  <pecoraro@apple.com>
1688
1689         Web Inspector: Timeline should show when events preventDefault() was called on an event or not
1690         https://bugs.webkit.org/show_bug.cgi?id=176824
1691         <rdar://problem/34290931>
1692
1693         Reviewed by Devin Rousso.
1694
1695         Test: inspector/timeline/timeline-event-EventDispatch.html
1696
1697         * dom/EventTarget.cpp:
1698         (WebCore::EventTarget::fireEventListeners):
1699         * page/DOMWindow.cpp:
1700         (WebCore::DOMWindow::dispatchEvent):
1701         Include defaultPrevented when notifying inspector.
1702
1703         * inspector/InspectorInstrumentation.cpp:
1704         (WebCore::InspectorInstrumentation::didDispatchEventImpl):
1705         (WebCore::InspectorInstrumentation::didDispatchEventOnWindowImpl):
1706         * inspector/InspectorInstrumentation.h:
1707         (WebCore::InspectorInstrumentation::didDispatchEvent):
1708         (WebCore::InspectorInstrumentation::didDispatchEventOnWindow):
1709         Pass defaultPrevented on to agent.
1710
1711         * inspector/InspectorTimelineAgent.cpp:
1712         (WebCore::InspectorTimelineAgent::didDispatchEvent):
1713         (WebCore::InspectorTimelineAgent::didLayout):
1714         (WebCore::InspectorTimelineAgent::didPaint):
1715         * inspector/InspectorTimelineAgent.h:
1716         * inspector/TimelineRecordFactory.cpp:
1717         (WebCore::TimelineRecordFactory::appendLayoutRoot):
1718         (WebCore::TimelineRecordFactory::appendDidDispatchEventData):
1719         * inspector/TimelineRecordFactory.h:
1720         Append a boolean defaultPrevented property on the EventDispatch timeline record's data.
1721
1722 2017-09-14  Ryan Haddad  <ryanhaddad@apple.com>
1723
1724         Unreviewed, rolling out r222015.
1725
1726         The LayoutTests added with this change are flaky.
1727
1728         Reverted changeset:
1729
1730         "Web Inspector: Timeline should show when events
1731         preventDefault() was called on an event or not"
1732         https://bugs.webkit.org/show_bug.cgi?id=176824
1733         http://trac.webkit.org/changeset/222015
1734
1735 2017-09-14  Ms2ger  <Ms2ger@igalia.com>
1736
1737         Allow passing sequences to various WebGL2 methods.
1738         https://bugs.webkit.org/show_bug.cgi?id=176892
1739
1740         Reviewed by Sam Weinig.
1741
1742         This matches the specification as well as Gecko and Chromium.
1743
1744         Test: fast/canvas/webgl/webgl2/sequences.html
1745
1746         * html/canvas/WebGL2RenderingContext.cpp:
1747         (WebCore::WebGL2RenderingContext::uniform1uiv):
1748         (WebCore::WebGL2RenderingContext::uniform2uiv):
1749         (WebCore::WebGL2RenderingContext::uniform3uiv):
1750         (WebCore::WebGL2RenderingContext::uniform4uiv):
1751         (WebCore::WebGL2RenderingContext::uniformMatrix2x3fv):
1752         (WebCore::WebGL2RenderingContext::uniformMatrix3x2fv):
1753         (WebCore::WebGL2RenderingContext::uniformMatrix2x4fv):
1754         (WebCore::WebGL2RenderingContext::uniformMatrix4x2fv):
1755         (WebCore::WebGL2RenderingContext::uniformMatrix3x4fv):
1756         (WebCore::WebGL2RenderingContext::uniformMatrix4x3fv):
1757         (WebCore::WebGL2RenderingContext::vertexAttribI4iv):
1758         (WebCore::WebGL2RenderingContext::vertexAttribI4uiv):
1759         (WebCore::WebGL2RenderingContext::clearBufferiv):
1760         (WebCore::WebGL2RenderingContext::clearBufferuiv):
1761         (WebCore::WebGL2RenderingContext::clearBufferfv):
1762         * html/canvas/WebGL2RenderingContext.h:
1763         * html/canvas/WebGL2RenderingContext.idl:
1764
1765 2017-09-14  Sam Weinig  <sam@webkit.org>
1766
1767         [Cleanup] Cleanup uses of the FileList class
1768         https://bugs.webkit.org/show_bug.cgi?id=176800
1769
1770         Reviewed by Alex Christensen.
1771
1772         * fileapi/FileList.cpp:
1773         * fileapi/FileList.h:
1774
1775             Store list of files as Refs, rather than RefPtrs.
1776             Add direct accessor to the underlying Vector for faster iteration.
1777             Add file(unsigned) function to allow direct indexing, rather than using
1778             the DOM exposed item function which always does a length check.
1779
1780         * Modules/entriesapi/HTMLInputElementEntriesAPI.cpp:
1781         
1782             Remove unused RuntimeEnabledFeatures.h #include.
1783             Use modern for loop and the new direct file vector access. 
1784         
1785         * bindings/js/SerializedScriptValue.cpp:
1786         (WebCore::CloneSerializer::dumpIfTerminal):
1787         (WebCore::CloneSerializer::write):
1788         (WebCore::CloneDeserializer::readFile):
1789         (WebCore::CloneDeserializer::readTerminal):
1790         
1791             Remove unnecessary #includes, adopt auto, and use modern for-loop
1792             for FileList.
1793         
1794         * dom/DataTransfer.cpp:
1795         (WebCore::DataTransfer::files const):
1796         (WebCore::DataTransfer::hasFileOfType):
1797         
1798             Use auto.
1799         
1800         (WebCore::DataTransfer::createForInputEvent):
1801         
1802             Use initializer list for the typeToStringMap.
1803         
1804         * dom/DataTransferItemList.cpp:
1805         (WebCore::DataTransferItemList::ensureItems const):
1806         
1807             Use auto and modern for-loop for FileList.
1808         
1809         * html/FileInputType.cpp:
1810         (WebCore::FileInputType::filesFromFormControlState):
1811         (WebCore::FileInputType::saveFormControlState const):
1812         (WebCore::FileInputType::appendFormData const):
1813         (WebCore::FileInputType::handleDOMActivateEvent):
1814         (WebCore::FileInputType::getTypeSpecificValue):
1815         (WebCore::FileInputType::disabledAttributeChanged):
1816         (WebCore::FileInputType::multipleAttributeChanged):
1817         (WebCore::FileInputType::setFiles):
1818         (WebCore::FileInputType::receiveDroppedFiles):
1819         (WebCore::FileInputType::defaultToolTip const):
1820
1821             Adopt auto, brace-initialization, and modern for-loops.
1822
1823         * html/FileListCreator.cpp:
1824         (WebCore::appendDirectoryFiles):
1825         (WebCore::FileListCreator::createFileList):
1826         
1827             Update to work in terms of Vector<Ref<File>>.
1828
1829         * html/FormController.h:
1830         (WebCore::FormControlState::FormControlState):
1831         
1832             Re-format existing constructors and add one that takes an r-value
1833             Vector<String> to allow construction from a pre-created list (used 
1834             in FileInputType::saveFormControlState)
1835         
1836         * platform/DragData.h:
1837         * platform/gtk/DragDataGtk.cpp:
1838         (WebCore::DragData::asFilenames const):
1839         * platform/mac/DragDataMac.mm:
1840         (WebCore::DragData::asFilenames const):
1841         * platform/win/DragDataWin.cpp:
1842         (WebCore::DragData::asFilenames const):
1843         
1844             Convert asFilenames to return, rather than take, a Vector<String>.
1845
1846 2017-09-14  Carlos Garcia Campos  <cgarcia@igalia.com>
1847
1848         [Harfbuzz] Wrong offset returned by HarfBuzzShaper::offsetForPosition() when target point is at the middle of a character
1849         https://bugs.webkit.org/show_bug.cgi?id=176897
1850
1851         Reviewed by Michael Catanzaro.
1852
1853         We should include the character when the point is greater than the center of the character.
1854
1855         Fixes: fast/multicol/hit-test-end-of-column-with-line-height.html
1856                fast/multicol/newmulticol/compare-with-old-impl/hit-test-end-of-column-with-line-height.html
1857
1858         * platform/graphics/harfbuzz/HarfBuzzShaper.cpp:
1859         (WebCore::HarfBuzzShaper::HarfBuzzRun::characterIndexForXPosition):
1860
1861 2017-09-14  Yusuke Suzuki  <utatane.tea@gmail.com>
1862
1863         [JSC] Add PrivateSymbolMode::{Include,Exclude} for PropertyNameArray
1864         https://bugs.webkit.org/show_bug.cgi?id=176867
1865
1866         Reviewed by Sam Weinig.
1867
1868         * bindings/js/JSDOMConvertRecord.h:
1869         * bindings/js/SerializedScriptValue.cpp:
1870         (WebCore::CloneSerializer::serialize):
1871         * bridge/NP_jsobject.cpp:
1872         (_NPN_Enumerate):
1873
1874 2017-09-14  Joseph Pecoraro  <pecoraro@apple.com>
1875
1876         Web Inspector: Timeline should show when events preventDefault() was called on an event or not
1877         https://bugs.webkit.org/show_bug.cgi?id=176824
1878         <rdar://problem/34290931>
1879
1880         Reviewed by Devin Rousso.
1881
1882         Tests: inspector/timeline/timeline-event-CancelAnimationFrame.html
1883                inspector/timeline/timeline-event-EventDispatch.html
1884                inspector/timeline/timeline-event-FireAnimationFrame.html
1885                inspector/timeline/timeline-event-RequestAnimationFrame.html
1886                inspector/timeline/timeline-event-TimerFire.html
1887                inspector/timeline/timeline-event-TimerInstall.html
1888                inspector/timeline/timeline-event-TimerRemove.html
1889
1890         * dom/EventTarget.cpp:
1891         (WebCore::EventTarget::fireEventListeners):
1892         * page/DOMWindow.cpp:
1893         (WebCore::DOMWindow::dispatchEvent):
1894         Include defaultPrevented when notifying inspector.
1895
1896         * inspector/InspectorInstrumentation.cpp:
1897         (WebCore::InspectorInstrumentation::didDispatchEventImpl):
1898         (WebCore::InspectorInstrumentation::didDispatchEventOnWindowImpl):
1899         * inspector/InspectorInstrumentation.h:
1900         (WebCore::InspectorInstrumentation::didDispatchEvent):
1901         (WebCore::InspectorInstrumentation::didDispatchEventOnWindow):
1902         Pass defaultPrevented on to agent.
1903
1904         * inspector/InspectorTimelineAgent.cpp:
1905         (WebCore::InspectorTimelineAgent::didDispatchEvent):
1906         (WebCore::InspectorTimelineAgent::didLayout):
1907         (WebCore::InspectorTimelineAgent::didPaint):
1908         * inspector/InspectorTimelineAgent.h:
1909         * inspector/TimelineRecordFactory.cpp:
1910         (WebCore::TimelineRecordFactory::appendLayoutRoot):
1911         (WebCore::TimelineRecordFactory::appendDidDispatchEventData):
1912         * inspector/TimelineRecordFactory.h:
1913         Append a boolean defaultPrevented property on the EventDispatch timeline record's data.
1914
1915 2017-09-14  Maureen Daum  <mdaum@apple.com>
1916
1917         Introduce the option to mark an HTML element as having AutoFill available.
1918         https://bugs.webkit.org/show_bug.cgi?id=176710
1919
1920         Reviewed by Alex Christensen.
1921
1922         Introduce the option to mark an HTML element as having AutoFill available. Accessibility
1923         can use this property when deciding whether to announce that the focused field offers
1924         AutoFill.
1925
1926         * accessibility/AccessibilityObject.cpp:
1927         (WebCore::AccessibilityObject::isValueAutofillAvailable const):
1928         Check if the field is explicitly marked as having AutoFill available.
1929         * html/HTMLInputElement.cpp:
1930         (WebCore::HTMLInputElement::HTMLInputElement):
1931         * html/HTMLInputElement.h:
1932         (WebCore::HTMLInputElement::isAutoFillAvailable const):
1933         (WebCore::HTMLInputElement::setAutoFillAvailable):
1934
1935 2017-09-13  Basuke Suzuki  <Basuke.Suzuki@sony.com>
1936
1937         [Curl] Move response related features into ResourceResponse
1938         https://bugs.webkit.org/show_bug.cgi?id=174654
1939
1940         Reviewed by Alex Christensen.
1941
1942         * platform/Curl.cmake:
1943         * platform/network/curl/ResourceHandleCurlDelegate.cpp:
1944         (WebCore::ResourceHandleCurlDelegate::didReceiveAllHeaders):
1945         (WebCore::ResourceHandleCurlDelegate::didReceiveHeader):
1946         (WebCore::isHttpRedirect): Deleted.
1947         (WebCore::isHttpAuthentication): Deleted.
1948         (WebCore::isHttpNotModified): Deleted.
1949         (WebCore::isAppendableHeader): Deleted.
1950         (WebCore::ResourceHandleCurlDelegate::didReceiveHeaderLine): Deleted.
1951         * platform/network/curl/ResourceHandleCurlDelegate.h:
1952         * platform/network/curl/ResourceResponse.h:
1953         (WebCore::ResourceResponse::platformSuggestedFilename const): Deleted.
1954         * platform/network/curl/ResourceResponseCurl.cpp: Added.
1955         (WebCore::ResourceResponse::isAppendableHeader):
1956         (WebCore::ResourceResponse::appendHTTPHeaderField):
1957         (WebCore::ResourceResponse::setStatusLine):
1958         (WebCore::ResourceResponse::platformSuggestedFilename const):
1959         (WebCore::ResourceResponse::isRedirection const):
1960         (WebCore::ResourceResponse::isNotModified const):
1961         (WebCore::ResourceResponse::isUnauthorized const):
1962
1963 2017-09-13  Zalan Bujtas  <zalan@apple.com>
1964
1965         Switch multicolumn's spanner map from raw over to weak pointers.
1966         https://bugs.webkit.org/show_bug.cgi?id=176367
1967         <rdar://problem/34254896>
1968
1969         Reviewed by Antti Koivisto.
1970
1971         Test: fast/multicol/spanner-crash-when-adding-summary.html
1972
1973         * rendering/RenderMultiColumnFlowThread.cpp:
1974         (WebCore::RenderMultiColumnFlowThread::evacuateAndDestroy):
1975         (WebCore::RenderMultiColumnFlowThread::flowThreadDescendantInserted):
1976         (WebCore::RenderMultiColumnFlowThread::handleSpannerRemoval):
1977         * rendering/RenderMultiColumnFlowThread.h:
1978         * rendering/RenderMultiColumnSet.cpp:
1979         (WebCore::RenderMultiColumnSet::firstRendererInFlowThread const):
1980         (WebCore::RenderMultiColumnSet::lastRendererInFlowThread const):
1981         * rendering/RenderMultiColumnSpannerPlaceholder.cpp:
1982         (WebCore::RenderMultiColumnSpannerPlaceholder::RenderMultiColumnSpannerPlaceholder):
1983         * rendering/RenderMultiColumnSpannerPlaceholder.h:
1984
1985 2017-09-13  John Wilander  <wilander@apple.com>
1986
1987         Introduce Storage Access API (document parts) as an experimental feature
1988         https://bugs.webkit.org/show_bug.cgi?id=175759
1989         <rdar://problem/34414107>
1990
1991         Reviewed by Alex Christensen.
1992
1993         Storage Access API is an experimental feature which allows cross-origin,
1994         sandboxed iframes to request access to their first-party storage (as
1995         opposed to partitioned storage). This might be restricted to cookies or
1996         might cover all stateful mechanisms.
1997
1998         It introduces the following three developer-facing things:
1999         - A new readonly attribute, document.hasStorageAccess.
2000         - A new function, document.requestStorageAccess().
2001         - A new iframe sandbox token, allow-storage-access-by-user-activation.
2002
2003         Tests: http/tests/storageAccess/request-and-deny-storage-access-cross-origin-iframe.html
2004                http/tests/storageAccess/request-and-deny-storage-access-cross-origin-sandboxed-iframe.html
2005                http/tests/storageAccess/request-and-grant-storage-access-cross-origin-iframe.html
2006                http/tests/storageAccess/request-and-grant-storage-access-cross-origin-sandboxed-iframe.html
2007                http/tests/storageAccess/request-storage-access-cross-origin-sandboxed-iframe-with-unique-origin.html
2008                http/tests/storageAccess/request-storage-access-cross-origin-sandboxed-iframe-without-allow-token.html
2009                http/tests/storageAccess/request-storage-access-same-origin-iframe.html
2010                http/tests/storageAccess/request-storage-access-same-origin-sandboxed-iframe-without-allow-token.html
2011                http/tests/storageAccess/request-storage-access-same-origin-sandboxed-iframe.html
2012                http/tests/storageAccess/request-storage-access-top-frame.html
2013
2014         * dom/Document.cpp:
2015         (WebCore::Document::requestStorageAccess):
2016         * dom/Document.h:
2017         (WebCore::Document::hasStorageAccess const):
2018         (WebCore::Document::setUserGrantsStorageAccessOverride):
2019             See comments on WebCore::Internals below.
2020         * dom/Document.idl:
2021         * dom/SecurityContext.cpp:
2022         (WebCore::SecurityContext::isSupportedSandboxPolicy):
2023         (WebCore::SecurityContext::parseSandboxPolicy):
2024             Support for allow-storage-access-by-user-activation.
2025         * dom/SecurityContext.h:
2026         * loader/ResourceLoadObserver.cpp:
2027         (WebCore::ResourceLoadObserver::registerStorageAccess):
2028             Newly granted storage access is reported to 
2029             WebCore::ResourceLoadObserver.
2030         * loader/ResourceLoadObserver.h:
2031         * loader/ResourceLoadStatistics.cpp:
2032         (WebCore::encodeHashSet):
2033         (WebCore::ResourceLoadStatistics::encode const):
2034         (WebCore::decodeHashSet):
2035         (WebCore::ResourceLoadStatistics::decode):
2036         (WebCore::appendHashSet):
2037         (WebCore::ResourceLoadStatistics::toString const):
2038         (WebCore::mergeHashSet):
2039         (WebCore::ResourceLoadStatistics::merge):
2040             Storage of the new type of data.
2041         * loader/ResourceLoadStatistics.h:
2042         * page/Settings.in:
2043         * testing/Internals.cpp:
2044         (WebCore::Internals::resetToConsistentState):
2045         (WebCore::Internals::setUserGrantsStorageAccess):
2046         * testing/Internals.h:
2047         * testing/Internals.idl:
2048             Added setUserGrantsStorageAccess(). It is used to
2049             override the eventSender's keyboard input which
2050             always results in a cancel action on the confirm()
2051             dialog.
2052
2053 2017-09-13  Wenson Hsieh  <wenson_hsieh@apple.com>
2054
2055         Submitting a form can cause HTMLFormElement's associated elements vector to be mutated during iteration
2056         https://bugs.webkit.org/show_bug.cgi?id=176368
2057         <rdar://problem/34254998>
2058
2059         Reviewed by Ryosuke Niwa.
2060
2061         In the process of iterating over form.associatedElements() during form submission in FormSubmission::create, the
2062         page may cause us to clobber the vector of FormAssociatedElements* we're currently iterating over by inserting
2063         new form controls beneath the form element we're in the process of submitting. This happens because
2064         FormSubmission::create calls HTMLTextAreaElement::appendFormData, which requires layout to be up to date, which
2065         in turn makes us updateLayout() and set focus, which fires a `change` event, upon which the page's JavaScript
2066         inserts additonal DOM nodes into the form, modifying the vector of associated elements.
2067
2068         To mitigate this, instead of iterating over HTMLFormElement::associatedElements(), which returns a reference to
2069         the HTMLFormElement's actual m_associatedElements vector, we iterate over a new vector of
2070         Ref<FormAssociatedElement>s created from m_associatedElements.
2071
2072         This patch also removes an event dispatch assertion added in r212026. This assertion was added to catch any
2073         other events dispatched in this scope, since dispatching events there would have had security implications, but
2074         after making iteration over associated elements robust, this NoEventDispatchAssertion is no longer useful.
2075
2076         Test: fast/forms/append-children-during-form-submission.html
2077
2078         * loader/FormSubmission.cpp:
2079         (WebCore::FormSubmission::create):
2080
2081 2017-09-13  Devin Rousso  <webkit@devinrousso.com>
2082
2083         Web Inspector: Event Listeners section does not update when listeners are added/removed
2084         https://bugs.webkit.org/show_bug.cgi?id=170570
2085         <rdar://problem/31501645>
2086
2087         Reviewed by Joseph Pecoraro.
2088
2089         Test: inspector/dom/event-listener-add-remove.html
2090
2091         * dom/EventTarget.cpp:
2092         (WebCore::EventTarget::setAttributeEventListener):
2093         Fire willRemoveEventListener/didAddEventListener events when an attribute event listener is
2094         replaced by another event listener.
2095
2096         * inspector/InspectorDOMAgent.h:
2097         * inspector/InspectorDOMAgent.cpp:
2098         (WebCore::InspectorDOMAgent::didAddEventListener):
2099         (WebCore::InspectorDOMAgent::willRemoveEventListener):
2100         Dispatch an event to the inspector frontend whenever an event listener is added/removed.
2101
2102         * inspector/InspectorInstrumentation.cpp:
2103         (WebCore::InspectorInstrumentation::didAddEventListenerImpl):
2104         (WebCore::InspectorInstrumentation::willRemoveEventListenerImpl):
2105         Tie into existing instrumentation points for adding/removing event listeners.
2106
2107 2017-09-13  Basuke Suzuki  <Basuke.Suzuki@sony.com>
2108
2109         [Curl] Bug fix for synchronous transfer
2110         https://bugs.webkit.org/show_bug.cgi?id=176552
2111
2112         Reviewed by Alex Christensen.
2113
2114         ResourceHandleInternal::m_delegate is null when transfer is synchronous. It should be set ResourceHandleCurlDelegate.
2115         Also the callback functions called when transfer is completed is wrong.
2116
2117         * platform/network/curl/ResourceHandleCurl.cpp:
2118         (WebCore::ResourceHandle::platformLoadResourceSynchronously):
2119         * platform/network/curl/ResourceHandleCurlDelegate.cpp:
2120         (WebCore::ResourceHandleCurlDelegate::dispatchSynchronousJob):
2121         (WebCore::ResourceHandleCurlDelegate::notifyFinish):
2122         (WebCore::ResourceHandleCurlDelegate::notifyFail):
2123         (WebCore::ResourceHandleCurlDelegate::didReceiveHeader):
2124         (WebCore::ResourceHandleCurlDelegate::didReceiveData):
2125         (WebCore::ResourceHandleCurlDelegate::willSendData):
2126
2127 2017-09-13  Matt Lewis  <jlewis3@apple.com>
2128
2129         Unreviewed, rolling out r221976.
2130
2131         The test introduced was flaky from point of addition.
2132
2133         Reverted changeset:
2134
2135         "Introduce Storage Access API (document parts) as an
2136         experimental feature"
2137         https://bugs.webkit.org/show_bug.cgi?id=175759
2138         http://trac.webkit.org/changeset/221976
2139
2140 2017-09-13  Said Abou-Hallawa  <sabouhallawa@apple.com>
2141
2142         Followup (r221805): Address comments and add more tests
2143         https://bugs.webkit.org/show_bug.cgi?id=176732
2144
2145         Reviewed by Darin Adler.
2146
2147         Test: http/tests/images/decode-slow-load-static-image.html
2148
2149         Code clean up and adding a new test to ensure multiple decode() promises
2150         can be resolved or rejected simultaneously without any issues.
2151
2152         * loader/ImageLoader.cpp:
2153         (WebCore::ImageLoader::decode):
2154         (WebCore::ImageLoader::decodeError):
2155         * loader/ImageLoader.h:
2156         * platform/graphics/BitmapImage.cpp:
2157         (WebCore::BitmapImage::decode):
2158         (WebCore::BitmapImage::callDecodingCallbacks):
2159         * platform/graphics/BitmapImage.h:
2160
2161 2017-09-13  Youenn Fablet  <youenn@apple.com>
2162
2163         Internals clearCacheStorageMemoryRepresentation should return a Promise
2164         https://bugs.webkit.org/show_bug.cgi?id=176818
2165
2166         Reviewed by Alex Christensen.
2167
2168         No observable change of behavior.
2169
2170         * Modules/cache/DOMCacheEngine.h:
2171         * testing/Internals.cpp:
2172         (WebCore::Internals::clearCacheStorageMemoryRepresentation): Returning a promise when clearing is completed.
2173         * testing/Internals.h:
2174         * testing/Internals.idl:
2175
2176 2017-09-13  Nikita Vasilyev  <nvasilyev@apple.com>
2177
2178         Web Inspector: Frontend should be made to expect and handle disabled properties
2179         https://bugs.webkit.org/show_bug.cgi?id=166787
2180         <rdar://problem/34379593>
2181
2182         Reviewed by Joseph Pecoraro.
2183
2184         Include disabled (commented out) CSS properties in the payload.
2185
2186         Tests: inspector/css/css-property.html
2187                inspector/css/matched-style-properties.html
2188
2189         * inspector/InspectorStyleSheet.cpp:
2190         (WebCore::InspectorStyle::populateAllProperties const):
2191         (WebCore::InspectorStyle::styleWithProperties const):
2192
2193 2017-09-13  Carlos Alberto Lopez Perez  <clopez@igalia.com>
2194
2195         [GTK] Fails to build because 'Float32Array' has not been declared in AudioContext.h
2196         https://bugs.webkit.org/show_bug.cgi?id=176870
2197
2198         Reviewed by Konstantin Tokarev.
2199
2200         Add missing include of Float32Array.h
2201
2202         No new tests, its a build fix.
2203
2204         * Modules/webaudio/AudioContext.h:
2205
2206 2017-09-13  Andy Estes  <aestes@apple.com>
2207
2208         [CF] Upstream CFNetwork-related WebKitSystemInterface functions
2209         https://bugs.webkit.org/show_bug.cgi?id=176729
2210
2211         Reviewed by Alex Christensen.
2212
2213         * platform/ios/WebCoreSystemInterfaceIOS.mm:
2214         * platform/mac/PublicSuffixMac.mm:
2215         (WebCore::isPublicSuffix):
2216         * platform/mac/WebCoreSystemInterface.h:
2217         * platform/mac/WebCoreSystemInterface.mm:
2218         * platform/network/cf/ResourceRequestCFNet.cpp:
2219         (WebCore::ResourceRequest::doUpdatePlatformRequest):
2220         (WebCore::ResourceRequest::doUpdateResourceRequest):
2221         * platform/network/cf/SocketStreamHandleImplCFNet.cpp:
2222         (WebCore::setCONNECTProxyForStream):
2223         (WebCore::SocketStreamHandleImpl::createStreams):
2224         (WebCore::setCONNECTProxyAuthorizationForStream):
2225         (WebCore::SocketStreamHandleImpl::addCONNECTCredentials):
2226         (WebCore::copyCONNECTProxyResponse):
2227         (WebCore::SocketStreamHandleImpl::readStreamCallback):
2228         (WebCore::SocketStreamHandleImpl::writeStreamCallback):
2229         * platform/network/cocoa/ResourceRequestCocoa.mm:
2230         (WebCore::ResourceRequest::doUpdateResourceRequest):
2231         (WebCore::ResourceRequest::doUpdatePlatformRequest):
2232
2233 2017-09-13  Antti Koivisto  <antti@apple.com>
2234
2235         Make more of the CSS animation system internals element based
2236         https://bugs.webkit.org/show_bug.cgi?id=176832
2237
2238         Reviewed by Zalan Bujtas.
2239
2240         CSS animations animate element style. Continue moving away from renderers in the animation code.
2241
2242         Also do some general modernization.
2243
2244         * css/CSSComputedStyleDeclaration.cpp:
2245         (WebCore::computeRenderStyleForProperty):
2246         * page/animation/AnimationBase.cpp:
2247         (WebCore::AnimationBase::AnimationBase):
2248         * page/animation/AnimationBase.h:
2249         * page/animation/CSSAnimationController.cpp:
2250         (WebCore::CSSAnimationControllerPrivate::ensureCompositeAnimation):
2251         (WebCore::CSSAnimationControllerPrivate::clear):
2252         (WebCore::CSSAnimationControllerPrivate::updateAnimations):
2253         (WebCore::CSSAnimationControllerPrivate::updateAnimationTimerForElement):
2254         (WebCore::CSSAnimationControllerPrivate::isRunningAnimationOnRenderer const):
2255         (WebCore::CSSAnimationControllerPrivate::isRunningAcceleratedAnimationOnRenderer const):
2256         (WebCore::CSSAnimationControllerPrivate::pauseAnimationAtTime):
2257         (WebCore::CSSAnimationControllerPrivate::pauseTransitionAtTime):
2258         (WebCore::CSSAnimationControllerPrivate::animatedStyleForElement):
2259         (WebCore::CSSAnimationControllerPrivate::computeExtentOfAnimation const):
2260         (WebCore::CSSAnimationController::cancelAnimations):
2261         (WebCore::CSSAnimationController::updateAnimations):
2262         (WebCore::CSSAnimationController::animatedStyleForRenderer):
2263         (WebCore::CSSAnimationController::computeExtentOfAnimation const):
2264         (WebCore::CSSAnimationController::pauseAnimationAtTime):
2265         (WebCore::CSSAnimationController::pauseTransitionAtTime):
2266         (WebCore::CSSAnimationControllerPrivate::updateAnimationTimerForRenderer): Deleted.
2267         (WebCore::CSSAnimationControllerPrivate::getAnimatedStyleForRenderer): Deleted.
2268         (WebCore::CSSAnimationController::getAnimatedStyleForRenderer): Deleted.
2269         * page/animation/CSSAnimationController.h:
2270         * page/animation/CSSAnimationControllerPrivate.h:
2271         * page/animation/CompositeAnimation.cpp:
2272         (WebCore::CompositeAnimation::~CompositeAnimation):
2273         (WebCore::CompositeAnimation::clearElement):
2274         (WebCore::CompositeAnimation::updateTransitions):
2275         (WebCore::CompositeAnimation::updateKeyframeAnimations):
2276         (WebCore::CompositeAnimation::animate):
2277         (WebCore::CompositeAnimation::clearRenderer): Deleted.
2278         * page/animation/CompositeAnimation.h:
2279         * page/animation/ImplicitAnimation.cpp:
2280         (WebCore::ImplicitAnimation::ImplicitAnimation):
2281         (WebCore::ImplicitAnimation::animate):
2282         * page/animation/ImplicitAnimation.h:
2283         (WebCore::ImplicitAnimation::create):
2284         * page/animation/KeyframeAnimation.cpp:
2285         (WebCore::KeyframeAnimation::KeyframeAnimation):
2286         (WebCore::KeyframeAnimation::animate):
2287         * page/animation/KeyframeAnimation.h:
2288         * rendering/RenderElement.cpp:
2289         (WebCore::RenderElement::willBeDestroyed):
2290         * rendering/RenderLayer.cpp:
2291         (WebCore::RenderLayer::currentTransform const):
2292         * style/RenderTreeUpdater.cpp:
2293         (WebCore::RenderTreeUpdater::createRenderer):
2294         * style/StyleTreeResolver.cpp:
2295         (WebCore::Style::TreeResolver::createAnimatedElementUpdate):
2296         * testing/Internals.cpp:
2297         (WebCore::Internals::pauseAnimationAtTimeOnElement):
2298         (WebCore::Internals::pauseAnimationAtTimeOnPseudoElement):
2299         (WebCore::Internals::pauseTransitionAtTimeOnElement):
2300         (WebCore::Internals::pauseTransitionAtTimeOnPseudoElement):
2301
2302 2017-09-13  Daniel Bates  <dabates@apple.com>
2303
2304         Make history.pushState()/replaceState() more closely aligned to the HTML standard
2305         https://bugs.webkit.org/show_bug.cgi?id=176730
2306         <rdar://problem/33839265>
2307
2308         Reviewed by Alex Christensen.
2309
2310         Update history.pushState()/replaceState() to more closely align with the algorithm
2311         specified in <https://html.spec.whatwg.org/multipage/history.html#dom-history-pushstate-2> (9 September 2017).
2312
2313         Test: http/tests/security/history-pushState-replaceState-from-sandboxed-iframe.html
2314
2315         * page/History.cpp:
2316         (WebCore::History::stateObjectAdded):
2317         * page/SecurityOrigin.cpp:
2318         (WebCore::SecurityOrigin::extractInnerURL): Use URL constructor that takes a base URL as opposed
2319         to using the special ParsedURLString-variant because the latter can only be used to parse a string
2320         returned from URL::string(). And the extracted inner URL does not meet this criterion. Using the
2321         ParsedURLString-variant of the URL constructor with a string that is not the result of URL::string()
2322         will cause an assertion failure in a debug build.
2323
2324 2017-09-13  John Wilander  <wilander@apple.com>
2325
2326         Introduce Storage Access API (document parts) as an experimental feature
2327         https://bugs.webkit.org/show_bug.cgi?id=175759
2328         <rdar://problem/33666847>
2329
2330         Reviewed by Alex Christensen.
2331
2332         Storage Access API is an experimental feature which allows cross-origin,
2333         sandboxed iframes to request access to their first-party storage (as
2334         opposed to partitioned storage). This might be restricted to cookies or
2335         might cover all stateful mechanisms.
2336
2337         It introduces the following three developer-facing things:
2338         - A new readonly attribute, document.hasStorageAccess.
2339         - A new function, document.requestStorageAccess().
2340         - A new iframe sandbox token, allow-storage-access-by-user-activation.
2341
2342         Tests: http/tests/loading/resourceLoadStatistics/request-and-deny-storage-access-cross-origin-iframe.html
2343                http/tests/loading/resourceLoadStatistics/request-and-deny-storage-access-cross-origin-sandboxed-iframe.html
2344                http/tests/loading/resourceLoadStatistics/request-and-grant-storage-access-cross-origin-iframe.html
2345                http/tests/loading/resourceLoadStatistics/request-and-grant-storage-access-cross-origin-sandboxed-iframe.html
2346                http/tests/loading/resourceLoadStatistics/request-storage-access-cross-origin-sandboxed-iframe-with-unique-origin.html
2347                http/tests/loading/resourceLoadStatistics/request-storage-access-cross-origin-sandboxed-iframe-without-allow-token.html
2348                http/tests/loading/resourceLoadStatistics/request-storage-access-same-origin-iframe.html
2349                http/tests/loading/resourceLoadStatistics/request-storage-access-same-origin-sandboxed-iframe-without-allow-token.html
2350                http/tests/loading/resourceLoadStatistics/request-storage-access-same-origin-sandboxed-iframe.html
2351                http/tests/loading/resourceLoadStatistics/request-storage-access-top-frame.html
2352
2353         * dom/Document.cpp:
2354         (WebCore::Document::requestStorageAccess):
2355         * dom/Document.h:
2356         (WebCore::Document::hasStorageAccess const):
2357         (WebCore::Document::setUserGrantsStorageAccessOverride):
2358             See comments on WebCore::Internals below.
2359         * dom/Document.idl:
2360         * dom/SecurityContext.cpp:
2361         (WebCore::SecurityContext::isSupportedSandboxPolicy):
2362         (WebCore::SecurityContext::parseSandboxPolicy):
2363             Support for allow-storage-access-by-user-activation.
2364         * dom/SecurityContext.h:
2365         * loader/ResourceLoadObserver.cpp:
2366         (WebCore::ResourceLoadObserver::registerStorageAccess):
2367             Newly granted storage access is reported to 
2368             WebCore::ResourceLoadObserver.
2369         * loader/ResourceLoadObserver.h:
2370         * loader/ResourceLoadStatistics.cpp:
2371         (WebCore::encodeHashSet):
2372         (WebCore::ResourceLoadStatistics::encode const):
2373         (WebCore::decodeHashSet):
2374         (WebCore::ResourceLoadStatistics::decode):
2375         (WebCore::appendHashSet):
2376         (WebCore::ResourceLoadStatistics::toString const):
2377         (WebCore::mergeHashSet):
2378         (WebCore::ResourceLoadStatistics::merge):
2379             Storage of the new type of data.
2380         * loader/ResourceLoadStatistics.h:
2381         * page/Settings.in:
2382         * testing/Internals.cpp:
2383         (WebCore::Internals::resetToConsistentState):
2384         (WebCore::Internals::setUserGrantsStorageAccess):
2385         * testing/Internals.h:
2386         * testing/Internals.idl:
2387             Added setUserGrantsStorageAccess(). It is used to
2388             override the eventSender's keyboard input which
2389             always results in a cancel action on the confirm()
2390             dialog.
2391
2392 2017-09-13  Carlos Garcia Campos  <cgarcia@igalia.com>
2393
2394         [HarfBuzz] Wrong offset returned by HarfBuzzShaper::offsetForPosition in some cases
2395         https://bugs.webkit.org/show_bug.cgi?id=176848
2396
2397         Reviewed by Michael Catanzaro.
2398
2399         This patch rewrites HarfBuzzShaper::HarfBuzzRun::characterIndexForXPosition() to make it simpler and ensure we
2400         return the right offset in all the cases, also honoring now the includePartialGlyphs parameter that we were
2401         ignoring in FontCascade::offsetForPositionForComplexText().
2402
2403         Fixes several tests that started to fail after r221909.
2404
2405         * platform/graphics/cairo/FontCairoHarfbuzzNG.cpp:
2406         (WebCore::FontCascade::offsetForPositionForComplexText const):
2407         * platform/graphics/harfbuzz/HarfBuzzShaper.cpp:
2408         (WebCore::HarfBuzzShaper::HarfBuzzRun::characterIndexForXPosition):
2409         (WebCore::HarfBuzzShaper::offsetForPosition):
2410         * platform/graphics/harfbuzz/HarfBuzzShaper.h:
2411
2412 2017-09-13  Per Arne Vollan  <pvollan@apple.com>
2413
2414         Initialize InternalSettings member variable.
2415         https://bugs.webkit.org/show_bug.cgi?id=176838
2416
2417         Reviewed by Brent Fulgham.
2418
2419         Initialize the m_webVREnabled member in the constructor.
2420
2421         * testing/InternalSettings.cpp:
2422         (WebCore::InternalSettings::Backup::Backup):
2423
2424 2017-09-13  Ms2ger  <Ms2ger@igalia.com>
2425
2426         Make WebGLRenderingContextBase::TypedList::data() const-correct.
2427         https://bugs.webkit.org/show_bug.cgi?id=176833
2428
2429         Reviewed by Sam Weinig.
2430
2431         No change of behavior.
2432
2433         * html/canvas/WebGLRenderingContextBase.cpp:
2434         (WebCore::WebGLRenderingContextBase::validateUniformMatrixParameters):
2435         * html/canvas/WebGLRenderingContextBase.h:
2436         (WebCore::WebGLRenderingContextBase::TypedList::data const):
2437         * platform/graphics/GraphicsContext3D.h:
2438         * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
2439         (WebCore::GraphicsContext3D::uniform1fv):
2440         (WebCore::GraphicsContext3D::uniform2fv):
2441         (WebCore::GraphicsContext3D::uniform3fv):
2442         (WebCore::GraphicsContext3D::uniform4fv):
2443         (WebCore::GraphicsContext3D::uniform1iv):
2444         (WebCore::GraphicsContext3D::uniform2iv):
2445         (WebCore::GraphicsContext3D::uniform3iv):
2446         (WebCore::GraphicsContext3D::uniform4iv):
2447         (WebCore::GraphicsContext3D::uniformMatrix2fv):
2448         (WebCore::GraphicsContext3D::uniformMatrix3fv):
2449         (WebCore::GraphicsContext3D::uniformMatrix4fv):
2450         (WebCore::GraphicsContext3D::vertexAttrib1fv):
2451         (WebCore::GraphicsContext3D::vertexAttrib2fv):
2452         (WebCore::GraphicsContext3D::vertexAttrib3fv):
2453         (WebCore::GraphicsContext3D::vertexAttrib4fv):
2454
2455 2017-09-13  Sam Weinig  <sam@webkit.org>
2456
2457         Remove CanvasRenderingContext2D.commit(), it is a no-op and not part the standard
2458         https://bugs.webkit.org/show_bug.cgi?id=176821
2459
2460         Reviewed by Darin Adler.
2461
2462         * html/canvas/CanvasRenderingContext2D.h:
2463         * html/canvas/CanvasRenderingContext2D.idl:
2464         
2465             Remove the commit operation. It is no longer part the standard (it was
2466             moved to OffscreenCanvasRenderingContext2D) and it was a no-op.
2467
2468 2017-09-12  Matt Rajca  <mrajca@apple.com>
2469
2470         Ensure the user interacted with the page before setting m_userHasInteractedWithMediaElement
2471         https://bugs.webkit.org/show_bug.cgi?id=176816
2472
2473         Reviewed by Eric Carlson.
2474
2475         Currently, when the user presses a keyboard shortcut in the client to reload a page, that may
2476         get registered as a user gesture on the reloaded page. Before setting the
2477         m_userHasInteractedWithMediaElement flag, we should check if a user gesture was actually handled
2478         by checking the userDidInteractWithPage flag. In case of key events that aren't handled by the
2479         page, this will be set to false by EventHandler:
2480
2481             // If the key event was not handled, do not treat it as user interaction with the page.
2482             if (topDocument && !wasHandled)
2483                 topDocument->setUserDidInteractWithPage(savedUserDidInteractWithPage);
2484
2485         We need to revisit this in the future in webkit.org/b/176817 and ensure user gesture tokens
2486         don't carry over across reloads of the page.
2487
2488         Tests: I wasn't able to trigger the pathological scenario this aims to fix with a test that calls
2489         window.location.reload() from a synthetic keyDown event.
2490
2491         * dom/Document.cpp:
2492         (WebCore::Document::noteUserInteractionWithMediaElement):
2493
2494 2017-09-13  Ms2ger  <Ms2ger@igalia.com>
2495
2496         Disallow passing null values to various WebGL2 methods.
2497         https://bugs.webkit.org/show_bug.cgi?id=176829
2498
2499         Reviewed by Yusuke Suzuki.
2500
2501         This matches the specification as well as Gecko and Chromium.
2502
2503         Test: fast/canvas/webgl/webgl2/bindings.html
2504
2505         * html/canvas/WebGL2RenderingContext.cpp:
2506         (WebCore::WebGL2RenderingContext::beginQuery):
2507         (WebCore::WebGL2RenderingContext::getQueryParameter):
2508         (WebCore::WebGL2RenderingContext::samplerParameteri):
2509         (WebCore::WebGL2RenderingContext::samplerParameterf):
2510         (WebCore::WebGL2RenderingContext::getSamplerParameter):
2511         (WebCore::WebGL2RenderingContext::clientWaitSync):
2512         (WebCore::WebGL2RenderingContext::waitSync):
2513         (WebCore::WebGL2RenderingContext::getSyncParameter):
2514         (WebCore::WebGL2RenderingContext::transformFeedbackVaryings):
2515         (WebCore::WebGL2RenderingContext::getTransformFeedbackVarying):
2516         (WebCore::WebGL2RenderingContext::getUniformIndices):
2517         (WebCore::WebGL2RenderingContext::getUniformBlockIndex):
2518         (WebCore::WebGL2RenderingContext::getActiveUniformBlockParameter):
2519         (WebCore::WebGL2RenderingContext::getActiveUniformBlockName):
2520         (WebCore::WebGL2RenderingContext::uniformBlockBinding):
2521         * html/canvas/WebGL2RenderingContext.h:
2522         * html/canvas/WebGL2RenderingContext.idl:
2523
2524 2017-09-13  Sergio Villar Senin  <svillar@igalia.com>
2525
2526         [WebVR] Add IDLs and stubs
2527         https://bugs.webkit.org/show_bug.cgi?id=174202
2528
2529         Reviewed by Dean Jackson.
2530
2531         Adding the complete set of IDLs for the WebVR 1.1 spec including the interface stubs which
2532         currently do nothing.
2533
2534         Tests: webvr/webvr-disabled.html
2535                webvr/webvr-enabled.html
2536
2537         * CMakeLists.txt:
2538         * DerivedSources.make:
2539         * Modules/webvr/DOMWindowWebVR.idl: Added.
2540         * Modules/webvr/GamepadWebVR.cpp: Added.
2541         (WebCore::GamepadWebVR::GamepadWebVR):
2542         (WebCore::GamepadWebVR::~GamepadWebVR):
2543         (WebCore::GamepadWebVR::displayId):
2544         * Modules/webvr/GamepadWebVR.h: Added.
2545         * Modules/webvr/GamepadWebVR.idl: Added.
2546         * Modules/webvr/NavigatorWebVR.cpp: Added.
2547         (WebCore::NavigatorWebVR::getVRDisplays):
2548         (WebCore::NavigatorWebVR::activeVRDisplays):
2549         (WebCore::NavigatorWebVR::vrEnabled):
2550         * Modules/webvr/NavigatorWebVR.h: Added.
2551         * Modules/webvr/NavigatorWebVR.idl: Added.
2552         * Modules/webvr/VRDisplay.cpp: Added.
2553         (WebCore::VRDisplay::create):
2554         (WebCore::VRDisplay::VRDisplay):
2555         (WebCore::VRDisplay::isConnected const):
2556         (WebCore::VRDisplay::isPresenting const):
2557         (WebCore::VRDisplay::capabilities const):
2558         (WebCore::VRDisplay::stageParameters const):
2559         (WebCore::VRDisplay::getEyeParameters const):
2560         (WebCore::VRDisplay::displayId const):
2561         (WebCore::VRDisplay::displayName const):
2562         (WebCore::VRDisplay::getFrameData const):
2563         (WebCore::VRDisplay::getPose const):
2564         (WebCore::VRDisplay::resetPose):
2565         (WebCore::VRDisplay::depthNear const):
2566         (WebCore::VRDisplay::setDepthNear):
2567         (WebCore::VRDisplay::depthFar const):
2568         (WebCore::VRDisplay::setDepthFar):
2569         (WebCore::VRDisplay::requestAnimationFrame):
2570         (WebCore::VRDisplay::cancelAnimationFrame):
2571         (WebCore::VRDisplay::requestPresent):
2572         (WebCore::VRDisplay::exitPresent):
2573         (WebCore::VRDisplay::getLayers const):
2574         (WebCore::VRDisplay::submitFrame):
2575         (WebCore::VRDisplay::hasPendingActivity const):
2576         (WebCore::VRDisplay::activeDOMObjectName const):
2577         (WebCore::VRDisplay::canSuspendForDocumentSuspension const):
2578         (WebCore::VRDisplay::stop):
2579         * Modules/webvr/VRDisplay.h: Added.
2580         * Modules/webvr/VRDisplay.idl: Added.
2581         * Modules/webvr/VRDisplayCapabilities.cpp: Added.
2582         (WebCore::VRDisplayCapabilities::hasPosition const):
2583         (WebCore::VRDisplayCapabilities::hasOrientation const):
2584         (WebCore::VRDisplayCapabilities::hasExternalDisplay const):
2585         (WebCore::VRDisplayCapabilities::canPresent const):
2586         (WebCore::VRDisplayCapabilities::maxLayer const):
2587         * Modules/webvr/VRDisplayCapabilities.h: Added.
2588         (WebCore::VRDisplayCapabilities::create):
2589         * Modules/webvr/VRDisplayCapabilities.idl: Added.
2590         * Modules/webvr/VRDisplayEvent.cpp: Added.
2591         (WebCore::VRDisplayEvent::VRDisplayEvent):
2592         (WebCore::VRDisplayEvent::display const):
2593         (WebCore::VRDisplayEvent::reason const):
2594         (WebCore::VRDisplayEvent::eventInterface const):
2595         * Modules/webvr/VRDisplayEvent.h: Added.
2596         * Modules/webvr/VRDisplayEvent.idl: Added.
2597         * Modules/webvr/VRDisplayEventReason.h: Added.
2598         * Modules/webvr/VRDisplayEventReason.idl: Added.
2599         * Modules/webvr/VREye.h: Added.
2600         * Modules/webvr/VREye.idl: Added.
2601         * Modules/webvr/VREyeParameters.cpp: Added.
2602         (WebCore::VREyeParameters::VREyeParameters):
2603         (WebCore::VREyeParameters::offset const):
2604         (WebCore::VREyeParameters::fieldOfView const):
2605         (WebCore::VREyeParameters::renderWidth const):
2606         (WebCore::VREyeParameters::renderHeight const):
2607         * Modules/webvr/VREyeParameters.h: Added.
2608         (WebCore::VREyeParameters::create):
2609         * Modules/webvr/VREyeParameters.idl: Added.
2610         * Modules/webvr/VRFieldOfView.cpp: Added.
2611         (WebCore::VRFieldOfView::upDegrees const):
2612         (WebCore::VRFieldOfView::rightDegrees const):
2613         (WebCore::VRFieldOfView::downDegrees const):
2614         (WebCore::VRFieldOfView::leftDegrees const):
2615         * Modules/webvr/VRFieldOfView.h: Added.
2616         (WebCore::VRFieldOfView::create):
2617         * Modules/webvr/VRFieldOfView.idl: Added.
2618         * Modules/webvr/VRFrameData.cpp: Added.
2619         (WebCore::VRFrameData::VRFrameData):
2620         (WebCore::VRFrameData::timestamp const):
2621         (WebCore::VRFrameData::leftProjectionMatrix const):
2622         (WebCore::VRFrameData::leftViewMatrix const):
2623         (WebCore::VRFrameData::rightProjectionMatrix const):
2624         (WebCore::VRFrameData::rightViewMatrix const):
2625         (WebCore::VRFrameData::pose const):
2626         * Modules/webvr/VRFrameData.h: Added.
2627         (WebCore::VRFrameData::create):
2628         * Modules/webvr/VRFrameData.idl: Added.
2629         * Modules/webvr/VRLayerInit.h: Added.
2630         * Modules/webvr/VRLayerInit.idl: Added.
2631         * Modules/webvr/VRPose.cpp: Added.
2632         (WebCore::VRPose::position const):
2633         (WebCore::VRPose::linearVelocity const):
2634         (WebCore::VRPose::linearAcceleration const):
2635         (WebCore::VRPose::orientation const):
2636         (WebCore::VRPose::angularVelocity const):
2637         (WebCore::VRPose::angularAcceleration const):
2638         * Modules/webvr/VRPose.h: Added.
2639         (WebCore::VRPose::create):
2640         * Modules/webvr/VRPose.idl: Added.
2641         * Modules/webvr/VRStageParameters.cpp: Added.
2642         (WebCore::VRStageParameters::sittingToStandingTransform const):
2643         (WebCore::VRStageParameters::sizeX const):
2644         (WebCore::VRStageParameters::sizeZ const):
2645         * Modules/webvr/VRStageParameters.h: Added.
2646         (WebCore::VRStageParameters::create):
2647         * Modules/webvr/VRStageParameters.idl: Added.
2648         * WebCore.xcodeproj/project.pbxproj:
2649         * bindings/js/WebCoreBuiltinNames.h:
2650         * dom/EventNames.h:
2651         * dom/EventNames.in:
2652         * dom/EventTargetFactory.in:
2653         * features.json:
2654         * page/RuntimeEnabledFeatures.h:
2655         (WebCore::RuntimeEnabledFeatures::setWebVREnabled):
2656         (WebCore::RuntimeEnabledFeatures::webVREnabled const):
2657         * testing/InternalSettings.cpp:
2658         (WebCore::InternalSettings::Backup::restoreTo):
2659         (WebCore::InternalSettings::setWebVREnabled):
2660         * testing/InternalSettings.h:
2661         * testing/InternalSettings.idl:
2662
2663 2017-09-13  Ms2ger  <Ms2ger@igalia.com>
2664
2665         Update the type of the texture argument to framebufferTextureLayer().
2666         https://bugs.webkit.org/show_bug.cgi?id=176785
2667
2668         Reviewed by Yusuke Suzuki.
2669
2670         This matches the specification as well as Gecko and Chromium.
2671
2672         Also move getInternalformatParameter() to the position it has in the
2673         specification, for easier comparison.
2674
2675         Test: fast/canvas/webgl/webgl2/bindings.html
2676
2677         * html/canvas/WebGL2RenderingContext.cpp:
2678         (WebCore::WebGL2RenderingContext::framebufferTextureLayer):
2679         * html/canvas/WebGL2RenderingContext.h:
2680         * html/canvas/WebGL2RenderingContext.idl:
2681
2682 2017-09-13  Zan Dobersek  <zdobersek@igalia.com>
2683
2684         [EME] Implement CDMInstanceClearKey::updateLicense()
2685         https://bugs.webkit.org/show_bug.cgi?id=176791
2686
2687         Reviewed by Xabier Rodriguez-Calvar.
2688
2689         Implement the updateLicense() method for CDMInstanceClearKey.
2690         The response data is parsed as JSON, matching that agains either
2691         'license' or 'license release acknowledgement' formats (depending
2692         on either 'keys' or 'kids' object keys being present). If any
2693         format is recognized, appropriate steps are taken.
2694
2695         In case of the 'license' format, the passed-in keys are matched
2696         against existing ones. If some keys have changed or have been
2697         newly introduced, the key information is sorted by key ID size
2698         and data to enforce order. After that the KeyStatusVector object
2699         is constructed, containing key ID and status information for all
2700         the keys associated with this session. Finally callback is
2701         dispatched, signalling a successful operation and passing the
2702         KeyStatusVector, if any, back to the caller.
2703
2704         In case of the 'license release acknowledgement' format, the
2705         session data for this session ID is removed from the ClearKey state
2706         singleton. The callback is dispatched signalling the session closure
2707         and successfull completion of the operation.
2708
2709         Finally, if no format is deduced, the callback is again dispatched,
2710         but now signalling an operation failure.
2711
2712         No new tests -- expectations for the relevant tests are updated
2713         to reflect the introduced changes.
2714
2715         * platform/encryptedmedia/clearkey/CDMClearKey.cpp:
2716         (WebCore::ClearKeyState::keys):
2717         (WebCore::ClearKeyState::singleton):
2718         (WebCore::parseLicenseFormat):
2719         (WebCore::parseLicenseReleaseAcknowledgementFormat):
2720         (WebCore::CDMInstanceClearKey::updateLicense):
2721
2722 2017-09-13  Ryosuke Niwa  <rniwa@webkit.org>
2723
2724         Refactor WebContentReader out of EditorMac and EditorIOS
2725         https://bugs.webkit.org/show_bug.cgi?id=176770
2726
2727         Reviewed by Sam Weinig.
2728
2729         Extracted WebContentReader.h, WebContentReaderMac.mm, and WebContentIOS.mm from Pasteboard.h,
2730         EditorMac.mm, and EditorIOS.mm respectively.
2731
2732         Also moved createFragmentAndAddResources from EditorCocoa.mm to WebContentReaderCocoa.mm
2733         and createFragmentForImageAndURL and createFragmentForImageResourceAndAddResource to markup.cpp.
2734
2735         * Configurations/WebCore.xcconfig:
2736         * PlatformMac.cmake:
2737         * WebCore.xcodeproj/project.pbxproj:
2738         * editing/Editor.cpp:
2739         (WebCore::Editor::createFragmentForImageAndURL): Deleted.
2740         * editing/Editor.h:
2741         * editing/WebContentReader.h: Added.
2742         * editing/cocoa/EditorCocoa.mm:
2743         (WebCore::Editor::replaceSelectionWithAttributedString):
2744         (WebCore::Editor::createFragment): Deleted.
2745         (WebCore::Editor::createFragmentForImageResourceAndAddResource): Deleted.
2746         (WebCore::Editor::createFragmentAndAddResources): Deleted.
2747         * editing/cocoa/WebContentReaderCocoa.mm: Added.
2748         (WebCore::createFragmentForImageResourceAndAddResource):
2749         (WebCore::createFragment):
2750         (WebCore::createFragmentAndAddResources):
2751         * editing/ios/EditorIOS.mm:
2752         (WebCore::Editor::WebContentReader): Moved to WebContentReaderIOS.mm.
2753         * editing/ios/WebContentReaderIOS.mm: Added.
2754         (WebCore::WebContentReader::addFragment):
2755         (WebCore::WebContentReader::readWebArchive):
2756         (WebCore::WebContentReader::readFilenames):
2757         (WebCore::WebContentReader::readHTML):
2758         (WebCore::WebContentReader::readRTFD):
2759         (WebCore::WebContentReader::readRTF):
2760         (WebCore::WebContentReader::readImage):
2761         (WebCore::WebContentReader::readURL):
2762         (WebCore::WebContentReader::readPlainText):
2763         * editing/mac/EditorMac.mm:
2764         (WebCore::Editor::WebContentReader): Moved to WebContentReaderMac.mm.
2765         * editing/mac/WebContentReaderMac.mm: Added.
2766         (WebCore::WebContentReader::readWebArchive):
2767         (WebCore::WebContentReader::readFilenames):
2768         (WebCore::WebContentReader::readHTML):
2769         (WebCore::WebContentReader::readRTFD):
2770         (WebCore::WebContentReader::readRTF):
2771         (WebCore::WebContentReader::readImage):
2772         (WebCore::WebContentReader::readURL):
2773         (WebCore::WebContentReader::readPlainText):
2774         * editing/markup.cpp:
2775         (WebCore::createFragmentForImageAndURL):
2776         (WebCore::createFragmentForImageResourceAndAddResource):
2777         * editing/markup.h:
2778
2779 2017-09-12  Yusuke Suzuki  <utatane.tea@gmail.com>
2780
2781         [DFG] Optimize WeakMap::get by adding intrinsic and fixup
2782         https://bugs.webkit.org/show_bug.cgi?id=176010
2783
2784         Reviewed by Filip Pizlo.
2785
2786         * platform/network/curl/CurlJobManager.cpp:
2787         (WebCore::CurlJobList::finishJobs):
2788
2789 2017-09-12  Frederic Wang  <fwang@igalia.com>
2790
2791         Rename isRootLayer to isRenderViewLayer
2792         https://bugs.webkit.org/show_bug.cgi?id=176684
2793
2794         Reviewed by Darin Adler.
2795
2796         This patch was generated with the help of do-webcore-rename with some coding style adjustment.
2797
2798         No new tests, behavior unchanged.
2799
2800         * rendering/RenderLayer.cpp:
2801         (WebCore::RenderLayer::RenderLayer):
2802         (WebCore::RenderLayer::enclosingTransformedAncestor const):
2803         (WebCore::RenderLayer::enclosingFilterRepaintLayer const):
2804         (WebCore::RenderLayer::setFilterBackendNeedsRepaintingInRect):
2805         (WebCore::RenderLayer::clippingRootForPainting const):
2806         (WebCore::RenderLayer::beginTransparencyLayers):
2807         (WebCore::shouldSuppressPaintingLayer):
2808         (WebCore::RenderLayer::paintFixedLayersInNamedFlows):
2809         (WebCore::RenderLayer::hitTest):
2810         (WebCore::RenderLayer::hitTestFixedLayersInNamedFlows):
2811         (WebCore::RenderLayer::calculateClipRects const):
2812         * rendering/RenderLayer.h:
2813         * rendering/RenderLayerBacking.cpp:
2814         (WebCore::RenderLayerBacking::RenderLayerBacking):
2815         (WebCore::RenderLayerBacking::updateConfiguration):
2816         (WebCore::RenderLayerBacking::updateAfterDescendants):
2817         (WebCore::RenderLayerBacking::paintsIntoWindow const):
2818         (WebCore::RenderLayerBacking::paintIntoLayer):
2819         * rendering/RenderLayerCompositor.cpp:
2820         (WebCore::RenderLayerCompositor::logLayerInfo):
2821         (WebCore::RenderLayerCompositor::needsCompositingUpdateForStyleChangeOnNonCompositedLayer const):
2822         (WebCore::RenderLayerCompositor::updateBacking):
2823         (WebCore::RenderLayerCompositor::repaintInCompositedAncestor):
2824         (WebCore::RenderLayerCompositor::addToOverlapMap):
2825         (WebCore::RenderLayerCompositor::computeCompositingRequirementsForNamedFlowFixed):
2826         (WebCore::RenderLayerCompositor::computeCompositingRequirements):
2827         (WebCore::RenderLayerCompositor::rebuildCompositingLayerTreeForNamedFlowFixed):
2828         (WebCore::RenderLayerCompositor::rebuildCompositingLayerTree):
2829         (WebCore::RenderLayerCompositor::needsToBeComposited const):
2830         (WebCore::RenderLayerCompositor::requiresOwnBackingStore const): Also move the IOS condition
2831         up to avoid that check-webkit-style complains.
2832         (WebCore::RenderLayerCompositor::reasonsForCompositing const):
2833         (WebCore::RenderLayerCompositor::useCoordinatedScrollingForLayer const):
2834         (WebCore::RenderLayerCompositor::needsFixedRootBackgroundLayer const):
2835         (WebCore::RenderLayerCompositor::updateScrollCoordinatedLayer):
2836
2837 2017-09-12  Wenson Hsieh  <wenson_hsieh@apple.com>
2838
2839         [iOS DnD] Support DataTransfer.getData and DataTransfer.setData when dragging or dropping
2840         https://bugs.webkit.org/show_bug.cgi?id=176672
2841         <rdar://problem/34353723>
2842
2843         Reviewed by Ryosuke Niwa.
2844
2845         Makes several tweaks to support DataTransfer.getData and DataTransfer.setData when dragging and dropping on iOS.
2846         See per-method changes below for more details. This patch also renames some old variable and property names
2847         along the way, so they no longer reference "data interaction", and instead refer to the feature by its post-WWDC
2848         name.
2849
2850         New test: DataInteractionTests.ExternalSourceInlineTextToFileInput
2851         Modified: DataInteractionTests.CanStartDragOnDivWithDraggableAttribute
2852                   DataInteractionTests.SinglePlainTextURLTypeIdentifiers
2853                   DataInteractionTests.SinglePlainTextWordTypeIdentifiers
2854
2855         * platform/ios/AbstractPasteboard.h:
2856         * platform/ios/PasteboardIOS.mm:
2857         (WebCore::cocoaTypeFromHTMLClipboardType):
2858
2859         In cocoaTypeFromHTMLClipboardType, map the "text/plain" MIME type to the "public.plain-text" UTI. Previously,
2860         this corresponded to "public.text", which is incorrect, since "public.text" also includes non-plain-text types
2861         such as "public.html", thereby confusing NSItemProviders. Importantly, this makes it so that plain text strings
2862         written via DataTransfer.setData() can actually be read back as a cocoa value, since "public.plain-text" is one
2863         of the UTIs in +[NSString readableTypeIdentifiersForItemProvider].
2864
2865         (WebCore::Pasteboard::writeString):
2866
2867         Instead of writing { type : data } to the pasteboard, write { cocoaType : data }. It appears that this was
2868         changed unintentionally in r156588 when upstreaming the iOS pasteboard implementation. This is made apparent by
2869         how Pasteboard::readString() requests the cocoa UTI from the platform pasteboard, but Pasteboard::writeString()
2870         sends the MIME type.
2871
2872         * platform/ios/PlatformPasteboardIOS.mm:
2873         (WebCore::PlatformPasteboard::filenamesForDataInteraction):
2874         (WebCore::PlatformPasteboard::write):
2875
2876         When writing plain text or a URL, specify that the item wants inline style representation. This prevents odd and
2877         unexpected behaviors (for instance, being able to drag plain text into the Files app as a file), but it also
2878         makes getData() not bail and return the null string on drop, due to forFileDrag() being true in
2879         DataTransfer::getData().
2880
2881         * platform/ios/WebItemProviderPasteboard.h:
2882         * platform/ios/WebItemProviderPasteboard.mm:
2883         (-[WebItemProviderRegistrationInfoList init]):
2884         (uiPreferredPresentationStyle):
2885         (-[WebItemProviderRegistrationInfoList itemProvider]):
2886
2887         Set the preferred presentation style when generating an item provider from a registration list.
2888
2889         (+[WebItemProviderLoadResult emptyLoadResult]):
2890         (+[WebItemProviderLoadResult loadResultWithFileURLMap:presentationStyle:]):
2891         (-[WebItemProviderLoadResult initWithFileURLMap:presentationStyle:]):
2892         (-[WebItemProviderLoadResult fileURLForType:]):
2893         (-[WebItemProviderLoadResult loadedFileURLs]):
2894         (-[WebItemProviderLoadResult loadedTypeIdentifiers]):
2895
2896         Introduce WebItemProviderLoadResult, an object that encapsulates information needed to represent the contents of
2897         an NSItemProvider dropped in web content. Previously, WebItemProviderPasteboard maintained an array of
2898         dictionaries of UTI => file URL, where each dictionary represents where the dropped data for a given item
2899         provider lives. Now that we additionally need to remember (for each item provider) whether we should consider
2900         its data as a file upload, it's more helpful to have a separate object representing the "load results" of a
2901         dropped item provider.
2902
2903         (-[WebItemProviderPasteboard init]):
2904         (-[WebItemProviderPasteboard pasteboardTypes]):
2905         (-[WebItemProviderPasteboard setItemProviders:]):
2906         (-[WebItemProviderPasteboard _preLoadedDataConformingToType:forItemProviderAtIndex:]):
2907         (-[WebItemProviderPasteboard droppedFileURLs]):
2908
2909         Respect item provider load results that should not be exposed as a file to the page.
2910
2911         (-[WebItemProviderPasteboard numberOfFiles]):
2912
2913         Respect item providers with UIPreferredPresentationStyleInline by not counting them towards the number of files.
2914
2915         (-[WebItemProviderPasteboard doAfterLoadingProvidedContentIntoFileURLs:synchronousTimeout:]):
2916
2917         Adjust for the transition from an array of dictionaries representing loaded item providers to an array of
2918         WebItemProviderLoadResults.
2919
2920         (-[WebItemProviderPasteboard fileURLsForDataInteraction]): Deleted.
2921         * platform/mac/DragDataMac.mm:
2922         (WebCore::DragData::containsFiles const):
2923
2924         DragData::containsFiles previously only considered whether or not particular UTIs appear in the pasteboard. In
2925         the case of Mac, this is NSFilesPromisePboardType and NSFilenamesPboardType, but in the case of iOS, this is a
2926         much broader category (anything conforming to "public.content"), since files are not exposed explicitly as
2927         "promise" or "file" types in the list of registered UTIs. This caused us to always bail in
2928         DataTransfer.getData() on drop on iOS, since we will always believe there's a file on the pasteboard if there's
2929         anything conforming to "public.content" at all.
2930
2931         To fix this and simplify the code at the same time, we simply replace the currently implementation of
2932         DragData::containsFiles to return true iff the number of files is nonzero. On Mac, DragData::numberOfFiles
2933         checks the same UTIs as DragData::containsFiles (NSFilesPromisePboardType and NSFilenamesPboardType), but
2934         additionally counts the number of file URLs corresponding to those UTIs.
2935
2936         On iOS, the implementation of numberOfFiles is new to iOS 11, and relevant only in the drag and drop flow.
2937         Previously, we would consider an item provider to "contain" a file if it had a UTI conforming to one of the UTIs
2938         acceptable for drag and drop (at the time of writing, these are ["public.content", "public.zip",
2939         "public.folder"]). With this patch, anything conforming to these UTIs will continue to be represented as files,
2940         but importantly, if an item provider indicates that it should be represented inline (i.e. a plain text
2941         selection), then we don't consider that item provider as vending a file. This allows us to distinguish between
2942         cases where we are dragging a plain text selection over a file input, and when we are dragging a plain text file.
2943         In both cases, "public.plain-text" is offered as a registered UTI, but in the former, the item provider should
2944         indicate that inline presentation style is preferred. Refer to <rdar://problem/32202542> for more details.
2945
2946 2017-09-12  Joseph Pecoraro  <pecoraro@apple.com>
2947
2948         QualifiedName::init should assume AtomicStrings::init was already called
2949         https://bugs.webkit.org/show_bug.cgi?id=176639
2950
2951         Reviewed by Sam Weinig.
2952
2953         * dom/QualifiedName.cpp:
2954         (WebCore::QualifiedName::init):
2955         All callers of QualifiedName::init precede it with their own call to
2956         AtomicString::init, so QualifiedName doesn't need to do it.
2957
2958 2017-09-12  Myles C. Maxfield  <mmaxfield@apple.com>
2959
2960         Unskip fast/text/system-font-synthetic-italic.html
2961         https://bugs.webkit.org/show_bug.cgi?id=175944
2962         <rdar://problem/32864306>
2963
2964         Reviewed by Jon Lee.
2965
2966         Our buildbots now all have this symbol.
2967
2968         * platform/graphics/cocoa/FontFamilySpecificationCoreText.cpp:
2969         (WebCore::FontFamilySpecificationCoreText::fontRanges const):
2970
2971 2017-09-12  Myles C. Maxfield  <mmaxfield@apple.com>
2972
2973         ASSERTION FAILED: !m_valueOrException under FontFaceSet::completedLoading loading a Serious Eats page
2974         https://bugs.webkit.org/show_bug.cgi?id=175899
2975
2976         Reviewed by Tim Horton.
2977
2978         Slight style update to r221835. Also adds a test.
2979
2980         Test: fast/text/document-fonts-while-loading-crash.html
2981
2982         * css/CSSFontFaceSet.h:
2983         * css/FontFaceSet.cpp:
2984         (WebCore::FontFaceSet::FontFaceSet):
2985
2986 2017-09-12  Myles C. Maxfield  <mmaxfield@apple.com>
2987
2988         Inline ParserUtilities.h
2989         https://bugs.webkit.org/show_bug.cgi?id=176572
2990
2991         Reviewed by Darin Adler.
2992
2993         Its contents are only ever used from SVG files which also include SVGParserUtilities.h.
2994
2995         No new tests because there is no behavior change.
2996
2997         * WebCore.xcodeproj/project.pbxproj:
2998         * platform/text/ParserUtilities.h: Removed.
2999         * svg/SVGParserUtilities.h:
3000         (WebCore::skipString):
3001
3002 2017-09-12  Ryosuke Niwa  <rniwa@webkit.org>
3003
3004         Dragging & dropping a file creates an attachment element even when it's disabled
3005         https://bugs.webkit.org/show_bug.cgi?id=176769
3006
3007         Reviewed by Tim Horton.
3008
3009         The bug that dropping a file always created an attachment element even when it's disabled by settings
3010         was caused by WebContentReader::readFilenames always creating an attachment element. Fixed this by
3011         checking the runtime flag. The fix is tested by drag-files-to-editable-element-as-URLs.html
3012
3013         To fix the bug that HTMLAttachmentElement is always exposed on the global object even when it's disabled
3014         by settings, replaced the setting to enable attachment element by an equivalent runtime enabled flag,
3015         and hid both the interface as well as the element behind it. Fixed various bugs in our code generator
3016         to make this work.
3017
3018         Tests: editing/pasteboard/drag-files-to-editable-element-as-URLs.html
3019                editing/pasteboard/drag-files-to-editable-element-as-attachment.html
3020
3021         * bindings/js/WebCoreBuiltinNames.h: Added symbols used in the generated code.
3022         * dom/make_event_factory.pl:
3023         (defaultItemFactory): Replaced "runtimeConditonal" option by "runtimeEnabled".
3024         (generateImplementation):
3025         * dom/make_names.pl:
3026         (defaultTagPropertyHash):
3027         (printConstructorInterior): Return a HTMLUnknownElement if the element is disabled by a runtime flag.
3028         (printTypeHelpers): Make is<HTMLAttachmentElement>(~) returns false when the feature is disabled by
3029         checking whether the given element is an instance of HTMLUnknownElement.
3030         (printWrapperFunctions): Simplified this code by matching the code for settingsConditional.
3031         * editing/mac/EditorMac.mm:
3032         (WebCore::Editor::WebContentReader::readFilenames): Fixed the bug that this code was always creating
3033         an attachment element even when the feature is disabled.
3034         * html/HTMLAttachmentElement.idl: Hide this behind a runtime flag.
3035         * html/HTMLTagNames.in: 
3036         * page/RuntimeEnabledFeatures.h:
3037         (WebCore::RuntimeEnabledFeatures::setAttachmentElementEnabled): Added.
3038         (WebCore::RuntimeEnabledFeatures::attachmentElementEnabled const): Added.
3039         * page/Settings.in: Removed attachmentElementEnabled.
3040
3041 2017-09-12  Youenn Fablet  <youenn@apple.com>
3042
3043         Introduce a RecordData for Cache to efficiently check whether it matches a corresponding request or not
3044         https://bugs.webkit.org/show_bug.cgi?id=176579
3045
3046         Reviewed by Alex Christensen.
3047
3048         No change of behavior.
3049
3050         Introducing another version of queryCacheMatch used for the NetworkProcess implementation of the Cache.
3051         Exporting the copy of a response body to be used also there.
3052
3053         * Modules/cache/DOMCacheEngine.cpp:
3054         (WebCore::DOMCacheEngine::matchURLs):
3055         (WebCore::DOMCacheEngine::queryCacheMatch):
3056         (WebCore::DOMCacheEngine::copyResponseBody):
3057         * Modules/cache/DOMCacheEngine.h:
3058
3059 2017-09-12  Antti Koivisto  <antti@apple.com>
3060
3061         AnimationBase should point to Element instead of RenderElement
3062         https://bugs.webkit.org/show_bug.cgi?id=176807
3063
3064         Reviewed by Andreas Kling.
3065
3066         This is a step towards making animation system operate on elements and styles instead renderers.
3067
3068         No functional changes.
3069
3070         * page/animation/AnimationBase.cpp:
3071         (WebCore::AnimationBase::AnimationBase):
3072         (WebCore::AnimationBase::renderer const):
3073         (WebCore::AnimationBase::compositedRenderer const):
3074         (WebCore::AnimationBase::updateStateMachine):
3075         (WebCore::AnimationBase::fireAnimationEventsIfNeeded):
3076         (WebCore::AnimationBase::timeToNextService):
3077         (WebCore::AnimationBase::freezeAtTime):
3078         (WebCore::AnimationBase::getElapsedTime const):
3079         * page/animation/AnimationBase.h:
3080         (WebCore::AnimationBase::clear):
3081         (WebCore::AnimationBase::renderer const): Deleted.
3082         * page/animation/ImplicitAnimation.cpp:
3083         (WebCore::ImplicitAnimation::shouldSendEventForListener const):
3084         (WebCore::ImplicitAnimation::computeExtentOfTransformAnimation const):
3085         (WebCore::ImplicitAnimation::startAnimation):
3086         (WebCore::ImplicitAnimation::pauseAnimation):
3087         (WebCore::ImplicitAnimation::endAnimation):
3088         (WebCore::ImplicitAnimation::sendTransitionEvent):
3089         (WebCore::ImplicitAnimation::reset):
3090         * page/animation/KeyframeAnimation.cpp:
3091         (WebCore::KeyframeAnimation::getAnimatedStyle):
3092         (WebCore::KeyframeAnimation::computeExtentOfTransformAnimation const):
3093         (WebCore::KeyframeAnimation::startAnimation):
3094         (WebCore::KeyframeAnimation::pauseAnimation):
3095         (WebCore::KeyframeAnimation::endAnimation):
3096         (WebCore::KeyframeAnimation::shouldSendEventForListener const):
3097         (WebCore::KeyframeAnimation::sendAnimationEvent):
3098         (WebCore::KeyframeAnimation::resolveKeyframeStyles):
3099
3100 2017-09-12  Per Arne Vollan  <pvollan@apple.com>
3101
3102         [Win] Add Modules/fetch to list of forwarding headers folders.
3103         https://bugs.webkit.org/show_bug.cgi?id=176747
3104
3105         Reviewed by Brent Fulgham.
3106
3107         * PlatformWin.cmake:
3108
3109 2017-09-12  Jer Noble  <jer.noble@apple.com>
3110
3111         [MSE] Don't increase the reported totalFrameDelay for non-displayed frames (or frames coming in while paused).
3112         https://bugs.webkit.org/show_bug.cgi?id=175900
3113
3114         Reviewed by Eric Carlson.
3115
3116         When seeking to a specific time, the decompression session necessarily needs to be fed samples from before that
3117         time (i.e., all samples from the previous I-frame forward). These shouldn't contribute to the "total frame
3118         delay" metric. Neither should samples delivered when the video is paused (like, during seeking), as a frame can't
3119         be "late" if time is not moving forward.
3120
3121         * platform/graphics/cocoa/WebCoreDecompressionSession.mm:
3122         (WebCore::WebCoreDecompressionSession::handleDecompressionOutput):
3123         * platform/cf/CoreMediaSoftLink.cpp:
3124         * platform/cf/CoreMediaSoftLink.h:
3125
3126 2017-09-12  Sam Weinig  <sam@webkit.org>
3127
3128         Gtk build fix for "Finish off the FormData implementation" - https://bugs.webkit.org/show_bug.cgi?id=176659
3129
3130         * fileapi/Blob.cpp:
3131         (WebCore::Blob::Blob):
3132         * fileapi/Blob.h:
3133         * fileapi/File.cpp:
3134         (WebCore::File::File):
3135         
3136             Replace copy constructor with a tagged constructor.
3137
3138 2017-09-12  Dean Jackson  <dino@apple.com>
3139
3140         [WebGL] VideoTextureCopierCV doesn't correctly restore vertex attribute state
3141         https://bugs.webkit.org/show_bug.cgi?id=176771
3142         <rdar://problem/34386621>
3143
3144         Reviewed by Antoine Quint.
3145
3146         The OpenGL context in VideoTextureCopierCV wasn't being restored to
3147         the state it had before rendering a video to a texture. Specifically
3148         the vertex attribute values were never recorded by the state saver.
3149
3150         Update the existing test of VideoTextureCopierCV so that it is
3151         explicitly doing something different from the WebCore code, which
3152         means that state will have to be correctly restored for the test
3153         to pass.
3154
3155         * platform/graphics/cv/VideoTextureCopierCV.cpp:
3156         (WebCore::VideoTextureCopierCV::copyVideoTextureToPlatformTexture): Make sure
3157         to record the vertex attribute state once we know the location of the position attribute.
3158         (WebCore::VideoTextureCopierCV::GC3DStateSaver::GC3DStateSaver):
3159         (WebCore::VideoTextureCopierCV::GC3DStateSaver::~GC3DStateSaver):
3160         (WebCore::VideoTextureCopierCV::GC3DStateSaver::saveVertexAttribState): Save all the
3161         applicable vertex attribute state information.
3162         * platform/graphics/cv/VideoTextureCopierCV.h: GC3DStateSaver can use a reference
3163         to the GC3D rather than a pointer.
3164
3165 2017-09-12  Dean Jackson  <dino@apple.com>
3166
3167         [WebGL] accelerated texImage2D for video doesn't respect flipY
3168         https://bugs.webkit.org/show_bug.cgi?id=176491
3169         <rdar://problem/33833511>
3170
3171         Reviewed by Jer Noble.
3172
3173         (Take 2 - this was rolled out due to a test failure, but the following
3174         commit will fix that)
3175
3176         Previously, if UNPACK_FLIP_Y_WEBGL was set to true, we'd either fall
3177         back to software or fail to upload texture data. Fix this by intercepting
3178         the texImage2D call, checking the orientation of the video, and running
3179         a small shader program to flip it if necessary.
3180
3181         While there, implement UNPACK_PREMULTIPLY_ALPHA_WEBGL as well, although
3182         none of our media decoders support video with alpha, so unfortunately
3183         this will have no visible change.
3184
3185         Tests: fast/canvas/webgl/texImage2D-video-flipY-false.html
3186                fast/canvas/webgl/texImage2D-video-flipY-true.html
3187
3188         * platform/cocoa/CoreVideoSoftLink.cpp: Add link to CVOpenGL(ES)TextureGetCleanTexCoords,
3189         which is used to check the orientation of the source video.
3190         * platform/cocoa/CoreVideoSoftLink.h:
3191
3192         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
3193         (WebCore::MediaPlayerPrivateAVFoundationObjC::copyVideoTextureToPlatformTexture): We can
3194         now handle flipped or premultiplied requests.
3195         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
3196         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::copyVideoTextureToPlatformTexture): Ditto.
3197
3198         * platform/graphics/cv/VideoTextureCopierCV.cpp:
3199         (WebCore::VideoTextureCopierCV::VideoTextureCopierCV): Rename readFramebuffer to
3200         simply framebuffer.
3201         (WebCore::VideoTextureCopierCV::~VideoTextureCopierCV): Delete the program and buffer
3202         if they were created.
3203         (WebCore::VideoTextureCopierCV::initializeContextObjects): Sets up the shader program
3204         and the vertex buffer for drawing. Also records the location of the uniforms.
3205         (WebCore::VideoTextureCopierCV::copyVideoTextureToPlatformTexture): Create a new
3206         framebuffer object, and render the video texture into that framebuffer using a
3207         shader that can flip the coordinates.
3208         (WebCore::VideoTextureCopierCV::GC3DStateSaver::GC3DStateSaver): Helper to restore
3209         the state of the user's GraphicsContext3D while we're intercepting calls.
3210         (WebCore::VideoTextureCopierCV::GC3DStateSaver::~GC3DStateSaver):
3211         * platform/graphics/cv/VideoTextureCopierCV.h:
3212
3213         * platform/graphics/GraphicsContext3D.h: Add two new entry points, for direct shader
3214         compilation and attribute access. This avoids going through ANGLE.
3215         * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
3216         (WebCore::GraphicsContext3D::compileShader):
3217         (WebCore::GraphicsContext3D::compileShaderDirect):
3218         (WebCore::GraphicsContext3D::getAttribLocationDirect):
3219
3220 2017-09-12  Manuel Rego Casasnovas  <rego@igalia.com>
3221
3222         [css-grid] Stretching auto tracks should be done as part of the track sizing algorithm
3223         https://bugs.webkit.org/show_bug.cgi?id=176783
3224
3225         Reviewed by Sergio Villar Senin.
3226
3227         CSS WG has agreed to modify the track sizing algorithm to include
3228         a new step: https://drafts.csswg.org/css-grid/#algo-stretch
3229         We used to do the stretch of the "auto" tracks at the end of
3230         the track sizing algorithm, however this change integrates it
3231         into the algorithm itself as the last step.
3232         See: https://github.com/w3c/csswg-drafts/issues/1150
3233
3234         The patch moves the method
3235         RenderGrid::applyStretchAlignmentToTracksIfNeeded() to
3236         GridTrackSizingAlgorithm::stretchAutoTracks().
3237         And then modifies the grid track sizing algorithm to execute
3238         the new step.
3239
3240         This patch uses the WPT test updated to check the new behavior.
3241
3242         * rendering/GridTrackSizingAlgorithm.cpp:
3243         (WebCore::GridTrackSizingAlgorithm::initializeTrackSizes): Initialize
3244         the list of auto tracks.
3245         (WebCore::GridTrackSizingAlgorithm::stretchFlexibleTracks): Add
3246         early return if there are not flexible tracks.
3247         (WebCore::GridTrackSizingAlgorithm::stretchAutoTracks): Code moved from
3248         RenderGrid::applyStretchAlignmentToTracksIfNeeded().
3249         (WebCore::GridTrackSizingAlgorithm::setup): Reset list of auto tracks.
3250         (WebCore::GridTrackSizingAlgorithm::run): Add new step
3251         stretchAutoTracks().
3252         (WebCore::GridTrackSizingAlgorithm::reset): Reset auto tracks.
3253         * rendering/GridTrackSizingAlgorithm.h: Add m_autoSizedTracksIndex.
3254         * rendering/RenderGrid.cpp:
3255         (WebCore::RenderGrid::layoutBlock): Avoid applying stretch here.
3256         (WebCore::RenderGrid::contentAlignmentNormalBehaviorGrid): Make public.
3257         (WebCore::RenderGrid::applyStretchAlignmentToTracksIfNeeded): Moved to
3258         GridTrackSizingAlgorithm::stretchAutoTracks().
3259         * rendering/RenderGrid.h:
3260
3261 2017-09-12  Eric Carlson  <eric.carlson@apple.com>
3262
3263         Switch MediaPlayerPrivateAVFoundation to release logging
3264         https://bugs.webkit.org/show_bug.cgi?id=176621
3265         <rdar://problem/34335311>
3266
3267         Reviewed by Jer Noble.
3268
3269         * html/HTMLMediaElement.h:
3270         * platform/graphics/MediaPlayer.cpp:
3271         (WebCore::nullLogger):
3272         (WebCore::MediaPlayer::mediaPlayerLogger):
3273         * platform/graphics/MediaPlayer.h:
3274         (WebCore::MediaPlayerClient::mediaPlayerLogIdentifier):
3275         (WebCore::MediaPlayerClient::mediaPlayerLogger):
3276         (WebCore::MediaPlayer::mediaPlayerLogIdentifier):
3277         * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp:
3278         (WebCore::MediaPlayerPrivateAVFoundation::MediaPlayerPrivateAVFoundation):
3279         (WebCore::MediaPlayerPrivateAVFoundation::~MediaPlayerPrivateAVFoundation):
3280         (WebCore::MediaPlayerPrivateAVFoundation::setUpVideoRendering):
3281         (WebCore::MediaPlayerPrivateAVFoundation::tearDownVideoRendering):
3282         (WebCore::MediaPlayerPrivateAVFoundation::load):
3283         (WebCore::MediaPlayerPrivateAVFoundation::playabilityKnown):
3284         (WebCore::MediaPlayerPrivateAVFoundation::prepareToPlay):
3285         (WebCore::MediaPlayerPrivateAVFoundation::play):
3286         (WebCore::MediaPlayerPrivateAVFoundation::pause):
3287         (WebCore::MediaPlayerPrivateAVFoundation::durationMediaTime const):
3288         (WebCore::MediaPlayerPrivateAVFoundation::seekWithTolerance):
3289         (WebCore::MediaPlayerPrivateAVFoundation::setNaturalSize):
3290         (WebCore::MediaPlayerPrivateAVFoundation::maxMediaTimeSeekable const):
3291         (WebCore::MediaPlayerPrivateAVFoundation::minMediaTimeSeekable const):
3292         (WebCore::MediaPlayerPrivateAVFoundation::updateStates):
3293         (WebCore::MediaPlayerPrivateAVFoundation::rateChanged):
3294         (WebCore::MediaPlayerPrivateAVFoundation::timeChanged):
3295         (WebCore::MediaPlayerPrivateAVFoundation::seekCompleted):
3296         (WebCore::MediaPlayerPrivateAVFoundation::invalidateCachedDuration):
3297         (WebCore::MediaPlayerPrivateAVFoundation::setPreload):
3298         (WebCore::MediaPlayerPrivateAVFoundation::mainThreadCallback):
3299         (WebCore::MediaPlayerPrivateAVFoundation::scheduleMainThreadNotification):
3300         (WebCore::MediaPlayerPrivateAVFoundation::dispatchNotification):
3301         (WebCore::MediaPlayerPrivateAVFoundation::processNewAndRemovedTextTracks):
3302         (WebCore::MediaPlayerPrivateAVFoundation::logChannel const):
3303         * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h:
3304         (WebCore::MediaPlayerPrivateAVFoundation::logClassName const):
3305         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
3306         * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
3307         (WebCore::MediaPlayerPrivateAVFoundationObjC::clearMediaCache):
3308         (WebCore::MediaPlayerPrivateAVFoundationObjC::clearMediaCacheForOrigins):
3309         (WebCore::MediaPlayerPrivateAVFoundationObjC::cancelLoad):
3310         (WebCore::MediaPlayerPrivateAVFoundationObjC::createImageGenerator):
3311         (WebCore::MediaPlayerPrivateAVFoundationObjC::destroyImageGenerator):
3312         (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayerLayer):
3313         (WebCore::MediaPlayerPrivateAVFoundationObjC::destroyVideoLayer):
3314         (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVAssetForURL):
3315         (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayer):
3316         (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayerItem):
3317         (WebCore::MediaPlayerPrivateAVFoundationObjC::checkPlayability):
3318         (WebCore::MediaPlayerPrivateAVFoundationObjC::beginLoadingMetadata):
3319         (WebCore::MediaPlayerPrivateAVFoundationObjC::platformMedia const):
3320         (WebCore::MediaPlayerPrivateAVFoundationObjC::platformPlay):
3321         (WebCore::MediaPlayerPrivateAVFoundationObjC::platformPause):
3322         (WebCore::MediaPlayerPrivateAVFoundationObjC::platformDuration const):
3323         (WebCore::MediaPlayerPrivateAVFoundationObjC::seekToTime):
3324         (WebCore::MediaPlayerPrivateAVFoundationObjC::setMuted):
3325         (WebCore::MediaPlayerPrivateAVFoundationObjC::setClosedCaptionsVisible):
3326         (WebCore::MediaPlayerPrivateAVFoundationObjC::assetStatus const):
3327         (WebCore::MediaPlayerPrivateAVFoundationObjC::paintWithImageGenerator):
3328         (WebCore::MediaPlayerPrivateAVFoundationObjC::createImageForTimeInRect):
3329         (WebCore::MediaPlayerPrivateAVFoundationObjC::getSupportedTypes):
3330         (WebCore::MediaPlayerPrivateAVFoundationObjC::tracksChanged):
3331         (WebCore::MediaPlayerPrivateAVFoundationObjC::updateAudioTracks):
3332         (WebCore::MediaPlayerPrivateAVFoundationObjC::updateVideoTracks):
3333         (WebCore::MediaPlayerPrivateAVFoundationObjC::createVideoOutput):
3334         (WebCore::MediaPlayerPrivateAVFoundationObjC::destroyVideoOutput):
3335         (WebCore::MediaPlayerPrivateAVFoundationObjC::updateLastImage):
3336         (WebCore::MediaPlayerPrivateAVFoundationObjC::paintWithVideoOutput):
3337         (WebCore::MediaPlayerPrivateAVFoundationObjC::createOpenGLVideoOutput):
3338         (WebCore::MediaPlayerPrivateAVFoundationObjC::destroyOpenGLVideoOutput):
3339         (WebCore::MediaPlayerPrivateAVFoundationObjC::waitForVideoOutputMediaDataWillChange):
3340         (WebCore::MediaPlayerPrivateAVFoundationObjC::processMediaSelectionOptions):
3341         (WebCore::MediaPlayerPrivateAVFoundationObjC::flushCues):
3342         (WebCore::MediaPlayerPrivateAVFoundationObjC::setCurrentTextTrack):
3343         (WebCore::MediaPlayerPrivateAVFoundationObjC::languageOfPrimaryAudioTrack const):
3344         (WebCore::MediaPlayerPrivateAVFoundationObjC::isCurrentPlaybackTargetWireless const):
3345         (WebCore::MediaPlayerPrivateAVFoundationObjC::wirelessPlaybackTargetName const):
3346         (WebCore::MediaPlayerPrivateAVFoundationObjC::wirelessVideoPlaybackDisabled const):
3347         (WebCore::MediaPlayerPrivateAVFoundationObjC::setWirelessVideoPlaybackDisabled):
3348         (WebCore::MediaPlayerPrivateAVFoundationObjC::setWirelessPlaybackTarget):
3349         (WebCore::MediaPlayerPrivateAVFoundationObjC::setShouldPlayToPlaybackTarget):
3350         (WebCore::MediaPlayerPrivateAVFoundationObjC::setShouldBufferData):
3351         (WebCore::MediaPlayerPrivateAVFoundationObjC::metadataDidArrive):
3352         (-[WebCoreAVFMovieObserver observeValueForKeyPath:ofObject:change:context:]):
3353         (WebCore::boolString): Deleted.
3354
3355 2017-09-12  Daniel Bates  <dabates@apple.com>
3356
3357         REGRESSION (r215784): The title of right-to-left pages are empty
3358         https://bugs.webkit.org/show_bug.cgi?id=176746
3359         <rdar://problem/34211419>
3360
3361         Reviewed by Brent Fulgham.
3362
3363         Left truncate a long right-to-left title.
3364
3365         Right-to-left text represents the visual ordering of text. Internally WebKit stores
3366         right-to-left text identically to left-to-right text in memory. So, we can use the
3367         same string operation to truncate right-to-left text as we do to truncate left-to-right
3368         text.
3369
3370         * platform/text/StringWithDirection.h:
3371         (WebCore::truncateFromEnd):
3372
3373 2017-09-12  Chris Fleizach  <cfleizach@apple.com>
3374
3375         AX: On generic container elements, WebKit should distinguish between tooltip (e.g. @title) and label (e.g. @aria-label) attributes
3376         https://bugs.webkit.org/show_bug.cgi?id=170475
3377         <rdar://problem/31439222>
3378
3379         Reviewed by Joanmarie Diggs.
3380
3381         Test: accessibility/title-tag-on-unimportant-elements-is-help-text.html
3382
3383         * accessibility/AccessibilityNodeObject.cpp:
3384         (WebCore::AccessibilityNodeObject::helpText):
3385         (WebCore::AccessibilityNodeObject::accessibilityDescription):
3386         (WebCore::AccessibilityNodeObject::roleIgnoresTitle):
3387         * accessibility/AccessibilityNodeObject.h:
3388
3389 2017-09-12  Brent Fulgham  <bfulgham@apple.com>
3390
3391         Show punycode to user if a URL mixes Armenian Seh or Vo with other scripts
3392         https://bugs.webkit.org/show_bug.cgi?id=176578
3393         <rdar://problem/33906231>
3394
3395         Reviewed by Alex Christensen.
3396
3397         Revise our "lookalike character" logic to include the Armenian Vo and Seh
3398         characters, which can be mistaken for 'n' and 'v' when displayed in
3399         certain fonts.
3400
3401         Tested by new API tests.
3402
3403         * platform/mac/WebCoreNSURLExtras.mm:
3404         (WebCore::isArmenianLookalikeCharacter): Added utility function.
3405         (WebCore::isArmenianScriptCharacter): Ditto.
3406         (WebCore::isLookalikeCharacter): Handle Armenian-lookalike cases.
3407
3408 2017-09-12  Antti Koivisto  <antti@apple.com>
3409
3410         Remove RenderElement::isCSSAnimating boolean
3411         https://bugs.webkit.org/show_bug.cgi?id=176779
3412
3413         Reviewed by Andreas Kling.
3414
3415         This optimization can be replaced with a simple style test that doesn't require keeping
3416         two sources of truth in sync.
3417
3418         * page/animation/CSSAnimationController.cpp:
3419         (WebCore::CSSAnimationControllerPrivate::ensureCompositeAnimation):
3420         (WebCore::CSSAnimationControllerPrivate::clear):
3421
3422             Can't test here as style might have become non-animating and we don't clear animation when that happens.
3423             This is only called on renderer destruction so it is not an important optimization.
3424
3425         (WebCore::CSSAnimationControllerPrivate::isRunningAnimationOnRenderer const):
3426         (WebCore::CSSAnimationControllerPrivate::isRunningAcceleratedAnimationOnRenderer const):
3427         (WebCore::CSSAnimationControllerPrivate::getAnimatedStyleForRenderer):
3428         (WebCore::CSSAnimationControllerPrivate::computeExtentOfAnimation const):
3429         (WebCore::CSSAnimationController::cancelAnimations):
3430         (WebCore::CSSAnimationController::getAnimatedStyleForRenderer):
3431         (WebCore::CSSAnimationController::computeExtentOfAnimation const):
3432         (WebCore::CSSAnimationController::isRunningAnimationOnRenderer const):
3433         (WebCore::CSSAnimationController::isRunningAcceleratedAnimationOnRenderer const):
3434
3435             Test if the style has any animations. This is roughly equivalent of the old test.
3436             (it is actually somewhat better as the boolean was never cleared on style changes)
3437
3438         * rendering/RenderElement.cpp:
3439         (WebCore::RenderElement::RenderElement):
3440         * rendering/RenderElement.h:
3441         (WebCore::RenderElement::isCSSAnimating const): Deleted.
3442         (WebCore::RenderElement::setIsCSSAnimating): Deleted.
3443         * rendering/style/RenderStyle.h:
3444         (WebCore::RenderStyle::hasAnimationsOrTransitions const):
3445
3446 2017-09-12  Ms2ger  <Ms2ger@igalia.com>
3447
3448         Disallow passing null data to uniform1uiv() and friends.
3449         https://bugs.webkit.org/show_bug.cgi?id=176777
3450
3451         Reviewed by Sam Weinig.
3452
3453         This matches the specification as well as Gecko and Chromium.
3454
3455         Test: fast/canvas/webgl/webgl2/bindings.html
3456
3457         * html/canvas/WebGL2RenderingContext.idl:
3458
3459 2017-09-12  Sam Weinig  <sam@webkit.org>
3460
3461         [Cleanup] Follow up cleanup for DOMFormData implementation
3462         https://bugs.webkit.org/show_bug.cgi?id=176740
3463
3464         Reviewed by Alex Christensen.
3465
3466         - Merges FormDataList into DOMFormData.
3467         - Streamline / refactor FormData creation from DOMFormData.
3468
3469         * CMakeLists.txt:
3470         * WebCore.xcodeproj/project.pbxproj:
3471         * html/FormDataList.cpp: Removed.
3472         * html/FormDataList.h: Removed.
3473
3474             Remove FormDataList.
3475
3476         * html/DOMFormData.cpp:
3477         (WebCore::DOMFormData::DOMFormData):
3478         (WebCore::DOMFormData::createFileEntry):
3479         (WebCore::DOMFormData::append):
3480         (WebCore::DOMFormData::set):
3481         (WebCore::DOMFormData::Iterator::next):
3482         * html/DOMFormData.h:
3483         (WebCore::DOMFormData::items const):
3484         (WebCore::DOMFormData::encoding const):
3485
3486             Merge FormDataList into DOMFormData. FormDataList's additional
3487             appendData/appendBlob functions have been removed, and their
3488             functionality inlined into DOMFormData's append functions. 
3489
3490             Adopted makeKeyValuePair in DOMFormData::Iterator::next().
3491
3492         * platform/network/FormData.cpp:
3493         (WebCore::FormData::create):
3494         (WebCore::FormData::createMultiPart):
3495         (WebCore::normalizeStringData):
3496         (WebCore::FormData::appendMultiPartFileValue):
3497         (WebCore::FormData::appendMultiPartStringValue):
3498         (WebCore::FormData::appendMultiPartKeyValuePairItems):
3499         (WebCore::FormData::appendNonMultiPartKeyValuePairItems):
3500         (WebCore::FormData::appendKeyValuePairItems): Deleted.
3501         * platform/network/FormData.h:
3502
3503             Split-up appendKeyValuePairItems into separate multipart and non-multipart
3504             functions, as the two edges of the branch didn't share much in common. Further
3505             split out multipart file and multipart string appending, since they too did not
3506             share that much in common and makes the code easier to follow. 
3507
3508             String value normalization has been moved entirely here (previously it was a member 
3509             function of FormDataList) as FormData is the only user.
3510
3511         * xml/XMLHttpRequest.cpp:
3512         (WebCore::XMLHttpRequest::send):
3513         * loader/FormSubmission.cpp:
3514         (WebCore::FormSubmission::create):
3515         * Modules/fetch/FetchBody.cpp:
3516         (WebCore::FetchBody::extract):
3517         
3518             Update for new FormData create functions which don't need the
3519             encoding passed explicitly, since it is part of the DOMFormData.
3520         
3521         * html/BaseButtonInputType.cpp:
3522         * html/BaseButtonInputType.h:
3523         * html/BaseCheckableInputType.cpp:
3524         * html/BaseCheckableInputType.h:
3525         * html/FileInputType.cpp:
3526         * html/FileInputType.h:
3527         * html/FormAssociatedElement.h:
3528         * html/HTMLButtonElement.cpp:
3529         * html/HTMLButtonElement.h:
3530         * html/HTMLFormControlElement.h:
3531         * html/HTMLInputElement.cpp:
3532         * html/HTMLInputElement.h:
3533         * html/HTMLKeygenElement.cpp:
3534         * html/HTMLKeygenElement.h:
3535         * html/HTMLMeterElement.cpp:
3536         * html/HTMLObjectElement.cpp:
3537         * html/HTMLObjectElement.h:
3538         * html/HTMLSelectElement.cpp:
3539         * html/HTMLSelectElement.h:
3540         * html/HTMLTextAreaElement.cpp:
3541         * html/HTMLTextAreaElement.h:
3542         * html/HiddenInputType.cpp:
3543         * html/HiddenInputType.h:
3544         * html/ImageInputType.cpp:
3545         * html/ImageInputType.h:
3546         * html/InputType.cpp:
3547         * html/InputType.h:
3548         * html/SubmitInputType.cpp:
3549         * html/SubmitInputType.h:
3550         * html/TextFieldInputType.cpp:
3551         * html/TextFieldInputType.h:
3552
3553             Update to use DOMFormData directly, rather than the FormDataList, which 
3554             has been removed.
3555
3556         * page/csp/ContentSecurityPolicy.cpp:
3557
3558             Remove unnecessary #include of unused (and now removed) FormDataList.h
3559
3560 2017-09-12  Zan Dobersek  <zdobersek@igalia.com>
3561
3562         [EME] Implement CDMInstanceClearKey::requestLicense()
3563         https://bugs.webkit.org/show_bug.cgi?id=176773
3564
3565         Reviewed by Xabier Rodriguez-Calvar.
3566
3567         Implement the requestLicense() method for CDMInstanceClearKey. Per
3568         the specification, the session ID must be a 32-bit numerical value.
3569         A session ID value counter is thus kept in a static uint32_ object
3570         and incremented upon each call of requestLicense(). Init data and
3571         the session ID value are then embedded in the asynchronous dispatch
3572         that invokes the callback. That invocation now also passes along the
3573         init data, the session ID in string format, and Succeeded to now
3574         indicate the operation was completed successfully.
3575
3576         No new tests -- expectations for the relevant tests are updated
3577         to reflect the introduced changes.
3578
3579         * platform/encryptedmedia/clearkey/CDMClearKey.cpp:
3580         (WebCore::CDMInstanceClearKey::requestLicense):
3581
3582 2017-09-12  Manuel Rego Casasnovas  <rego@igalia.com>
3583
3584         [css-grid] Use transferred size over content size for automatic minimum size
3585         https://bugs.webkit.org/show_bug.cgi?id=176688
3586
3587         Reviewed by Sergio Villar Senin.
3588
3589         CSS WG has agreed to modify the spec so now the transferred size is used
3590         (if it exists) independently if it's bigger or smaller
3591         than the content size.
3592         See: https://github.com/w3c/csswg-drafts/issues/1149
3593
3594         The spec text (https://drafts.csswg.org/css-grid/#min-size-auto):
3595           "The automatic minimum size for a grid item in a given dimension is
3596            its specified size if it exists, otherwise its transferred size
3597            if that exists, else its content size"
3598
3599         This patch use the WPT tests updated to check the new behavior.
3600
3601         * rendering/GridTrackSizingAlgorithm.cpp:
3602         (WebCore::GridTrackSizingAlgorithmStrategy::minSizeForChild const):
3603         Modified so it always returns the transferred size (if any).
3604
3605 2017-09-12  Fujii Hironori  <Hironori.Fujii@sony.com>
3606
3607         [Freetype] Doesn't support coloured fonts
3608         https://bugs.webkit.org/show_bug.cgi?id=156579
3609
3610         Reviewed by Michael Catanzaro.
3611
3612         Covered by existing tests. This needs a large rebaseline that will be done in follow up commits.
3613
3614         * platform/graphics/FontCascade.h: Enable advance text rendering mode by default.
3615         (WebCore::FontCascade::advancedTextRenderingMode const):
3616         (WebCore::FontCascade::computeRequiresShaping const):
3617         * platform/graphics/freetype/SimpleFontDataFreeType.cpp:
3618         (WebCore::Font::platformInit): Do not get metrics from OS/2 table for non-scalable fonts.
3619         * platform/graphics/harfbuzz/HarfBuzzFaceCairo.cpp:
3620         (WebCore::harfBuzzGetGlyph): Use U8_APPEND_UNSAFE() instead of converting to a String and then encoding it with
3621         UTF8Encoding().
3622
3623 2017-09-12  Frederic Wang  <fwang@igalia.com>
3624
3625         Remove unnecessary virtual keyword from JS test files
3626         https://bugs.webkit.org/show_bug.cgi?id=176683
3627
3628         Reviewed by Simon Fraser.
3629
3630         JS bindings headers do not comply with the WebKit coding style since they use both the
3631         "virtual" and "override" keywords. This patch modifies the generator script to only use
3632         "override" and regenerates the bindings accordingly.
3633
3634         No new tests, behavior unchanged.
3635
3636         * bindings/scripts/CodeGeneratorJS.pm:
3637         * bindings/scripts/test/JS/JSTestCallbackFunction.h:
3638         * bindings/scripts/test/JS/JSTestCallbackFunctionRethrow.h:
3639         * bindings/scripts/test/JS/JSTestCallbackFunctionWithThisObject.h:
3640         * bindings/scripts/test/JS/JSTestCallbackFunctionWithTypedefs.h:
3641         * bindings/scripts/test/JS/JSTestCallbackInterface.h:
3642         * bindings/scripts/test/JS/JSTestVoidCallbackFunction.h:
3643
3644 2017-09-11  Wenson Hsieh  <wenson_hsieh@apple.com>
3645
3646         [iOS DnD] Support DataTransfer.setDragImage when starting a drag on iOS
3647         https://bugs.webkit.org/show_bug.cgi?id=176721
3648         <rdar://problem/34373660>
3649
3650         Reviewed by Tim Horton.
3651
3652         Adds support for setting the drag lift preview frame in the case where DataTransfer.setDragImage is being used
3653         to override the default drag preview. Currently, the frame of the drag preview we supply in this case is the
3654         same as the bounds of the source element in root view coordinates, but this means that any custom drag image
3655         the page supplies will be stretched to fill the frame of the source element. Instead, when handling a DHTML drag,
3656         position the lift and cancel drag previews relative to the event location, respecting any drag offset specified
3657         in setDragImage. The size of this preview matches the size of the drag image source (since this is all in root
3658         view coordinates, this means the drag preview will also enlarge if the user pinches to zoom in). If a
3659         disconnected image source element was provided, then we just fall back to the image size.
3660
3661         Additionally, renames DragItem's elementBounds to dragPreviewFrameInRootViewCoordinates to better reflect the
3662         purpose of this variable. This patch also introduces API test plumbing to grab targeted drag previews from the
3663         drag interaction delegate (i.e. WKContentView), and uses this in a new API test that checks the frame of the
3664         resulting UITargetedDragPreview after initiating a drag in various circumstances (see changes in Tools/ for more
3665         detail).
3666
3667         Test: DataInteractionTests.DragLiftPreviewDataTransferSetDragImage
3668
3669         * dom/DataTransfer.cpp:
3670         (WebCore::DataTransfer::dragImageElement const):
3671         * dom/DataTransfer.h:
3672         * page/DragController.cpp:
3673         (WebCore::dragLocForDHTMLDrag):
3674
3675         The logic to flip the y offset when computing the drag location is only relevant on Mac, but currently, this is
3676         guarded by #if PLATFORM(COCOA), which causes the y offset to shift the drag image in the opposite direction on
3677         iOS. To fix this, simply change the platform define to Mac.
3678
3679         (WebCore::DragController::doSystemDrag):
3680         * platform/DragItem.h:
3681         (WebCore::DragItem::encode const):
3682         (WebCore::DragItem::decode):
3683
3684 2017-09-11  Wenson Hsieh  <wenson_hsieh@apple.com>
3685
3686         [iOS WK2] Support tapping to add items to the current drag session in web content
3687         https://bugs.webkit.org/show_bug.cgi?id=176421
3688         <rdar://problem/31144674>
3689
3690         Reviewed by Tim Horton.
3691
3692         Refactors some drag initiation logic to handle starting a drag when data has already been written to the
3693         pasteboard (in the case of iOS, WebItemProviderPasteboard). See annotated comments below for more detail.
3694
3695         Tests: DataInteractionTests.AdditionalLinkAndImageIntoContentEditable
3696
3697         * page/DragActions.h:
3698         * page/DragController.cpp:
3699         (WebCore::DragController::startDrag):
3700
3701         Add a HasNonDefaultPasteboardData argument here, and replace checks for !dataTransfer.pasteboard().hasData()
3702         with checks for whether the argument is HasNonDefaultPasteboardData::No. These checks for Pasteboard::hasData()
3703         currently prevent us from overwriting custom pasteboard data, in the case that the page has written pasteboard
3704         data using the event's DataTransfer. However, in the case of adding additional drag items to the session, we
3705         will already have pasteboard data, so these checks will prevent us from writing default data to the pasteboard.
3706         See EventHandler::handleDrag for more detail.
3707
3708         * page/DragController.h:
3709         * page/DragState.h:
3710
3711         Remove the draggedContentRange member from DragState. See below.
3712
3713         * page/EventHandler.cpp:
3714         (WebCore::removeDraggedContentDocumentMarkersFromAllFramesInPage):
3715
3716         Simplify the handling of dragged content range markers. Instead of storing the DOM Range being dragged and
3717         removing/repainting the range after dragging ends, just repaint the contentRenderer of the frame being dragged.
3718         When the dragging session has completely ended, remove all dragged content ranges from the page's mainframe and
3719         all of its subframes, and repaint everything.
3720
3721         (WebCore::EventHandler::dragCancelled):
3722         (WebCore::EventHandler::didStartDrag):
3723         (WebCore::EventHandler::dragSourceEndedAt):
3724
3725         Add a MayExtendDragSession argument, indicating whether or not the web process will attempt to continue the drag
3726         session, in which case EventHandler::dragSourceEndedAt should not remove any existing dragged content range
3727         document markers.
3728
3729         (WebCore::EventHandler::dispatchDragStartEvent):
3730
3731         Helper method to dispatch a `dragstart` event, return whether or not to proceed with the drag, and also compute
3732         (as an outparam) whether or not custom pasteboard data was written during the event.
3733
3734         (WebCore::EventHandler::handleDrag):
3735
3736         If custom data was written during `dragstart`, pass along HasNonDefaultPasteboardData::Yes when calling
3737         DragController::startDrag.
3738
3739         (WebCore::repaintContentsOfRange): Deleted.
3740         * page/EventHandler.h:
3741         * page/ios/EventHandlerIOS.mm:
3742         (WebCore::EventHandler::tryToBeginDataInteractionAtPoint):
3743         * platform/Pasteboard.h:
3744         * platform/ios/PasteboardIOS.mm:
3745         (WebCore::Pasteboard::changeCount const):
3746         * platform/ios/WebItemProviderPasteboard.mm:
3747         (-[WebItemProviderPasteboard setItemProviders:]):
3748
3749         Stop clearing out the staged item provider registration list when setting item providers. After refactoring in
3750         r221595, staged registration lists are now automatically cleared out when (1) the drag-and-drop interaction
3751         state is cleared out in the UI process, or (2) when the registration list is taken by WKContentView (see
3752         -takeRegistrationList) when generating an item provider.
3753
3754         * platform/mac/PasteboardMac.mm:
3755         (WebCore::Pasteboard::changeCount const):
3756
3757         Add a changeCount method to Pasteboard on Cocoa platforms (Mac, iOS) which support changeCount natively. In
3758         theory, there's no reason Windows, GTK and WPE ports can't also implement a similar mechanism in
3759         PlatformPasteboard, but this isn't needed for anything yet. Upon dragstart, it is safe to assume that the
3760         pasteboard has been cleared on these platforms, so checking for Pasteboard::hasData (as we do for all platforms
3761         currently) is sufficient.
3762
3763 2017-09-11  Ryan Haddad  <ryanhaddad@apple.com>
3764
3765         Unreviewed, rolling out r221762.
3766
3767         This change caused flakiness in a webgl LayoutTest.
3768
3769         Reverted changeset:
3770
3771         "[WebGL] accelerated texImage2D for video doesn't respect
3772         flipY"
3773         https://bugs.webkit.org/show_bug.cgi?id=176491
3774         http://trac.webkit.org/changeset/221762
3775
3776 2017-09-11  Per Arne Vollan  <pvollan@apple.com>
3777
3778         [Win] Add Modules/cache to list of forwarding headers folders.
3779         https://bugs.webkit.org/show_bug.cgi?id=176737
3780
3781         Reviewed by Alex Christensen.
3782
3783         * PlatformWin.cmake:
3784
3785 2017-09-11  Joanmarie Diggs  <jdiggs@igalia.com>
3786
3787         AX: [ATK] aria-autocomplete not exposed on comboboxes
3788         https://bugs.webkit.org/show_bug.cgi?id=176724
3789
3790         Reviewed by Chris Fleizach.
3791
3792         Add a check to AccessibilityObject::supportsARIAAutoComplete() for
3793         combobox because isARIATextControl() returns false for that role.
3794
3795         Add new combobox test cases to existing aria-autocomplete.html test.
3796
3797         * accessibility/AccessibilityObject.cpp:
3798         (WebCore::AccessibilityObject::supportsARIAAutoComplete const):
3799
3800 2017-09-11  Ryan Haddad  <ryanhaddad@apple.com>
3801
3802         Unreviewed, rolling out r221854.
3803
3804         The test added with this change fails on 32-bit JSC bots.
3805
3806         Reverted changeset:
3807
3808         "[DFG] Optimize WeakMap::get by adding intrinsic and fixup"
3809         https://bugs.webkit.org/show_bug.cgi?id=176010
3810         http://trac.webkit.org/changeset/221854
3811
3812 2017-09-11  Dean Jackson  <dino@apple.com>
3813
3814         [WebGL macOS] No need to multisample when blitting into WebGLLayer
3815         https://bugs.webkit.org/show_bug.cgi?id=176666
3816         <rdar://problem/27774626>
3817
3818         Reviewed by Sam Weinig.
3819
3820         We were seeing performance profiles suggesting WebGL was
3821         doing 8x MSAA, even though we explicitly set it to only
3822         use 4 samples in the GLPixelFormatObj used to create
3823         the WebGL CGLContextObj. However, that same CGLPixelFormatObj
3824         was also used for the WebGLLayer's CGLContextObj, meaning the
3825         blit of the WebGL FBO into the WebGLLayer's backing store was
3826         multisampling as well -- so an extra 4 samples on top of the
3827         original 4, making it look like we were doing 8x.
3828
3829         This was obviously unnecessary, since we already have the
3830         multisampled FBO and just want to copy it, as is, into the layer.
3831
3832         Now, instead of copying the CGLPixelFormatObj, we create
3833         a new one and copy most of the attributes, leaving out
3834         the multisample flags (and the depth buffer, since we're
3835         only doing 2d blits).
3836
3837         Covered by existing WebGL tests, since there should be no
3838         visible change.
3839
3840         * platform/graphics/cocoa/WebGLLayer.mm:
3841         (-[WebGLLayer copyCGLPixelFormatForDisplayMask:]): Create a new
3842         CGLPixelFormatObj that copies most of the values from
3843         the corresponding object on the WebGL's backing CGLContextObj.
3844
3845 2017-09-11  Zan Dobersek  <zdobersek@igalia.com>
3846
3847         [EME] ClearKey: implement CDMInstanceClearKey state modifiers, callback dispatches
3848         https://bugs.webkit.org/show_bug.cgi?id=176687
3849
3850         Reviewed by Xabier Rodriguez-Calvar.
3851
3852         Implement the state modification methods on the CDMInstanceClearKey class.
3853         Initialization method is a no-op, but returns Succeeded. Distinctive
3854         identifier and persistent state setters return Succeeded if the passed-in
3855         value is false. setServerCertificate() still returns Failed due to server
3856         certificates not being supported in this ClearKey implementation.
3857
3858         The license and session operation methods are also implemented, but for
3859         now the implementations simply schedule a main thread dispatch that
3860         invokes the callback with failure-indicating values. This avoids various
3861         tests timing out, instead preferring that the tests for now fail with an
3862         exception (in most cases NotSupportedError).
3863
3864         No new tests -- relevant tests have baselines updated.
3865
3866         * platform/encryptedmedia/clearkey/CDMClearKey.cpp:
3867         (WebCore::CDMInstanceClearKey::CDMInstanceClearKey):
3868         (WebCore::CDMInstanceClearKey::initializeWithConfiguration):
3869         (WebCore::CDMInstanceClearKey::setDistinctiveIdentifiersAllowed):
3870         (WebCore::CDMInstanceClearKey::setPersistentStateAllowed):
3871         (WebCore::CDMInstanceClearKey::setServerCertificate):
3872         (WebCore::CDMInstanceClearKey::requestLicense):
3873         (WebCore::CDMInstanceClearKey::updateLicense):
3874         (WebCore::CDMInstanceClearKey::loadSession):
3875         (WebCore::CDMInstanceClearKey::closeSession):
3876         (WebCore::CDMInstanceClearKey::removeSessionData):
3877         * platform/encryptedmedia/clearkey/CDMClearKey.h:
3878
3879 2017-09-11  Alex Christensen  <achristensen@webkit.org>
3880
3881         Modernize BoxExtent into RectEdges
3882         https://bugs.webkit.org/show_bug.cgi?id=176437
3883
3884         Reviewed by Simon Fraser.
3885
3886         And give it its own header.
3887         No change in behavior.
3888
3889         * WebCore.xcodeproj/project.pbxproj:
3890         * css/CSSProperty.cpp:
3891         (WebCore::resolveToPhysicalProperty):
3892         (WebCore::CSSProperty::resolveDirectionAwareProperty):
3893         * platform/LengthBox.h:
3894         (WebCore::LengthBox::LengthBox):
3895         (WebCore::BoxExtent::BoxExtent): Deleted.
3896         (WebCore::BoxExtent::at): Deleted.
3897         (WebCore::BoxExtent::top): Deleted.
3898         (WebCore::BoxExtent::right): Deleted.
3899         (WebCore::BoxExtent::bottom): Deleted.
3900         (WebCore::BoxExtent::left): Deleted.
3901         (WebCore::BoxExtent::at const): Deleted.
3902         (WebCore::BoxExtent::top const): Deleted.
3903         (WebCore::BoxExtent::right const): Deleted.
3904         (WebCore::BoxExtent::bottom const): Deleted.
3905         (WebCore::BoxExtent::left const): Deleted.
3906         (WebCore::BoxExtent::setAt): Deleted.
3907         (WebCore::BoxExtent::setTop): Deleted.
3908         (WebCore::BoxExtent::setRight): Deleted.
3909         (WebCore::BoxExtent::setBottom): Deleted.
3910         (WebCore::BoxExtent::setLeft): Deleted.
3911         (WebCore::BoxExtent::before): Deleted.
3912         (WebCore::BoxExtent::after): Deleted.
3913         (WebCore::BoxExtent::start): Deleted.
3914         (WebCore::BoxExtent::end): Deleted.
3915         (WebCore::BoxExtent::before const): Deleted.
3916         (WebCore::BoxExtent::after const): Deleted.
3917         (WebCore::BoxExtent::start const): Deleted.
3918         (WebCore::BoxExtent::end const): Deleted.
3919         (WebCore::BoxExtent::setBefore): Deleted.
3920         (WebCore::BoxExtent::setAfter): Deleted.
3921         (WebCore::BoxExtent::setStart): Deleted.
3922         (WebCore::BoxExtent::setEnd): Deleted.
3923         (WebCore::BoxExtent::operator== const): Deleted.
3924         (WebCore::BoxExtent::operator!= const): Deleted.
3925         * platform/RectEdges.h: Added.
3926         (WebCore::RectEdges::RectEdges):
3927         (WebCore::RectEdges::at):
3928         (WebCore::RectEdges::top):
3929         (WebCore::RectEdges::right):
3930         (WebCore::RectEdges::bottom):
3931         (WebCore::RectEdges::left):
3932         (WebCore::RectEdges::at const):
3933         (WebCore::RectEdges::top const):
3934         (WebCore::RectEdges::right const):
3935         (WebCore::RectEdges::bottom const):
3936         (WebCore::RectEdges::left const):
3937         (WebCore::RectEdges::setAt):
3938         (WebCore::RectEdges::setTop):
3939         (WebCore::RectEdges::setRight):
3940         (WebCore::RectEdges::setBottom):
3941         (WebCore::RectEdges::setLeft):
3942         (WebCore::RectEdges::before):
3943         (WebCore::RectEdges::after):
3944         (WebCore::RectEdges::start):
3945         (WebCore::RectEdges::end):
3946         (WebCore::RectEdges::before const):
3947         (WebCore::RectEdges::after const):
3948         (WebCore::RectEdges::start const):
3949         (WebCore::RectEdges::end const):
3950         (WebCore::RectEdges::setBefore):
3951         (WebCore::RectEdges::setAfter):
3952         (WebCore::RectEdges::setStart):
3953         (WebCore::RectEdges::setEnd):
3954         (WebCore::RectEdges::operator== const):
3955         (WebCore::RectEdges::operator!= const):
3956         * platform/graphics/ca/TileController.cpp:
3957         (WebCore::TileController::setHasMargins):
3958         * platform/graphics/ca/TileController.h:
3959         * platform/text/WritingMode.h:
3960         (WebCore::isHorizontalPhysicalSide):
3961         * rendering/style/NinePieceImage.cpp:
3962         (WebCore::NinePieceImage::isEmptyPieceRect):
3963         * rendering/style/NinePieceImage.h:
3964         (WebCore::imagePieceHorizontalSide):
3965         (WebCore::imagePieceVerticalSide):
3966         * rendering/style/RenderStyle.cpp:
3967         (WebCore::RenderStyle::getShadowInsetExtent const):
3968
3969 2017-09-11  Yoshiaki Jitsukawa  <Yoshiaki.Jitsukawa@sony.com>
3970
3971         [WinCairo] Fix the wincairo build after r221839
3972         https://bugs.webkit.org/show_bug.cgi?id=176681
3973
3974         Reviewed by Per Arne Vollan.
3975
3976         * platform/network/curl/ResourceHandleCurlDelegate.cpp:
3977         (WebCore::ResourceHandleCurlDelegate::setupPOST):
3978
3979 2017-09-11  Andy Estes  <aestes@apple.com>
3980
3981         [Mac] Upstream QTKit-related WebKitSystemInterface functions
3982         https://bugs.webkit.org/show_bug.cgi?id=176472
3983
3984         Reviewed by Eric Carlson.
3985
3986         * platform/graphics/mac/Media