0e48acb947e74bf0623f69afffea20a281322751
[WebKit-https.git] / Source / WebCore / ChangeLog
1 2016-09-15  Sergio Villar Senin  <svillar@igalia.com>
2
3         [css-grid] Implement fit-content track size
4         https://bugs.webkit.org/show_bug.cgi?id=161379
5
6         Reviewed by Manuel Rego Casasnovas.
7
8         This implements the new <fit-content> track size which is defined as follows: "Represents
9         the formula min(max-content, max(auto, argument)), which is calculated similar to auto
10         (i.e. minmax(auto, max-content)), except that the track size is clamped at argument if it is
11         greater than the auto minimum."
12
13         From the parsing POV fit-content was implemented as a new type of function which only takes
14         one argument. That forced us to refactor some code because minmax() was the only allowed
15         function for <track-size>s so far.
16
17         The implementation key is a new attribute in GridTrack called growthLimitCap which is
18         precisely the single attribute of fit-content(). Some parts of the track sizing algorithm
19         were adapted to this change like for example the sorting of tracks by growth potential (we
20         need to consider the caps).
21
22         Tests: fast/css-grid-layout/fit-content-columns.html
23         fast/css-grid-layout/fit-content-rows.html
24
25         * css/CSSComputedStyleDeclaration.cpp:
26         (WebCore::specifiedValueForGridTrackSize): Added support for fit-content sizes.
27         * css/StyleBuilderConverter.h:
28         (WebCore::StyleBuilderConverter::createGridTrackSize): Added support for fit-content sizes.
29         * css/parser/CSSParser.cpp:
30         (WebCore::isGridTrackFixedSized): Added support for fit-content sizes.
31         (WebCore::CSSParser::parseGridTrackSize): Added support for parsing fit-content() functions.
32         * css/parser/CSSPropertyParser.cpp: Added support for parsing fit-content() functions so
33         it'll be available once we switch to the new parser.
34         * rendering/RenderGrid.cpp:
35         (WebCore::GridTrack::baseSize): Just return a LayoutUnit, the return value optimization will
36         keep it fast in any case.
37         (WebCore::GridTrack::growthLimit): Ditto.
38         (WebCore::GridTrack::setGrowthLimit): Added an ASSERT to check that the growth limit is
39         never higher than the cap.
40         (WebCore::GridTrack::infiniteGrowthPotential):
41         (WebCore::GridTrack::plannedSize): Just return a LayoutUnit, the return value optimization will
42         keep it fast in any case.
43         (WebCore::GridTrack::tempSize): Just return a LayoutUnit, the return value optimization will
44         keep it fast in any case.
45         (WebCore::GridTrack::setTempSize): Added as we no longer return a reference in tempSize().
46         (WebCore::GridTrack::growTempSize): New utility function which increases the tempSize.
47         (WebCore::GridTrack::setInfinitelyGrowable):
48         (WebCore::GridTrack::setGrowthLimitCap): Added.
49         (WebCore::GridTrack::growthLimitCap): Ditto.
50         (WebCore::GridTrack::growthLimitIsInfinite): Made private.
51         (WebCore::RenderGrid::GridSizingData::freeSpace): Renamed from freeSpaceForDirection.
52         (WebCore::RenderGrid::GridSizingData::availableSpace): We now cache the available space as
53         it is used to compute relative (percentage) sizes.
54         (WebCore::RenderGrid::GridSizingData::setAvailableSpace): Ditto.
55         (WebCore::RenderGrid::GridSizingData::setFreeSpace): Renamed from setFreeSpaceForDirection.
56         (WebCore::RenderGrid::computeTrackSizesForDirection): Receives the available space instead
57         of the free space.
58         (WebCore::RenderGrid::computeIntrinsicLogicalWidths): Properly initialize free and available
59         spaces.
60         (WebCore::RenderGrid::computeIntrinsicLogicalHeight): Ditto.
61         (WebCore::RenderGrid::computeUsedBreadthOfGridTracks): Use available space to initialize the
62         track sizes. Also use sizingOperation to decide whether or not sizes are indefinite. Last
63         but not least, added support for fit-content tracks.
64         (WebCore::RenderGrid::computeUsedBreadthOfMinLength): Pass a GridTrackSize instead of a GridLength.
65         (WebCore::RenderGrid::computeUsedBreadthOfMaxLength): Ditto.
66         (WebCore::RenderGrid::gridTrackSize): Added support for fit-content.
67         (WebCore::RenderGrid::resolveContentBasedTrackSizingFunctions): Ditto.
68         (WebCore::RenderGrid::resolveContentBasedTrackSizingFunctionsForNonSpanningItems): Ditto.
69         (WebCore::trackSizeForTrackSizeComputationPhase):
70         (WebCore::sortByGridTrackGrowthPotential): Reworked the function so it properly sorts tracks
71         with growth limit caps to support fit-content().
72         (WebCore::clampGrowthShareIfNeeded): Clamps the given growthShare passed as argument to the
73         track growth limit cap.
74         (WebCore::RenderGrid::distributeSpaceToTracks): Use the new setTempSize() method. Also sort
75         the selected tracks to grow over growth limits in order to respect the track caps eventually
76         set by fit-content (otherwise those tracks could indefinitely grow over the specified value).
77         (WebCore::RenderGrid::tracksAreWiderThanMinTrackBreadth): Use the new defined functions.
78         (WebCore::RenderGrid::applyStretchAlignmentToTracksIfNeeded): Use freeSpace().
79         (WebCore::RenderGrid::populateGridPositionsForDirection): Ditto.
80         (WebCore::GridTrack::infinitelyGrowable): Deleted.
81         (WebCore::RenderGrid::GridSizingData::freeSpaceForDirection): Deleted.
82         (WebCore::RenderGrid::GridSizingData::setFreeSpaceForDirection): Deleted.
83         (WebCore::RenderGrid::trackSizeForTrackSizeComputationPhase): Deleted.
84         * rendering/RenderGrid.h: Changed the signature of some methods. Moved
85         TrackSizeComputationPhase out of the RenderGrid class.
86         * rendering/style/GridTrackSize.h:
87         (WebCore::GridTrackSize::GridTrackSize): Added some extra documentation. Added a new
88         attribute to the constructor to support fit-content GridTrackSizes.
89         (WebCore::GridTrackSize::fitContentTrackBreadth): New method which returns the growth limit
90         cap set by fit-content().
91         (WebCore::GridTrackSize::minTrackBreadth):
92         (WebCore::GridTrackSize::isFitContent): Added.
93         (WebCore::GridTrackSize::length): Deleted.
94         (WebCore::GridTrackSize::isPercentage): Deleted.
95
96 2016-09-15  Sergio Villar Senin  <svillar@igalia.com>
97
98         [css-grid] Fix a dangling reference
99         https://bugs.webkit.org/show_bug.cgi?id=161739
100
101         Reviewed by Alexey Proskuryakov.
102
103         The code was trying to get a reference to a private attribute of a temporary object returned
104         by gridTrackSize().
105
106         * rendering/RenderGrid.cpp:
107         (WebCore::RenderGrid::assumedRowsSizeForOrthogonalChild):
108
109 2016-09-15  Sergio Villar Senin  <svillar@igalia.com>
110
111         Unreviewed, rolling out r205966.
112
113         Triggered some assertions
114
115         Reverted changeset:
116
117         "[css-grid] Implement fit-content track size"
118         https://bugs.webkit.org/show_bug.cgi?id=161379
119         http://trac.webkit.org/changeset/205966
120
121 2016-09-15  Zalan Bujtas  <zalan@apple.com>
122
123         Cleanup RenderLayer::shouldBeNormalFlowOnly
124         https://bugs.webkit.org/show_bug.cgi?id=161981
125
126         Reviewed by Simon Fraser.
127
128         This patch changes the logic of figuring about if a particular layer is normal flow only by simply checking
129         if the layer creates a stacking context. If it does, we assume that it can't be a normal flow layer anymore.
130         This patch slightly changes behaviour by making layers with isolation and reflection to be non normal flow layers anymore.    
131
132         Covered by existing testcases.
133
134         * rendering/RenderLayer.cpp:
135         (WebCore::RenderLayer::calculateClipRects):
136
137 2016-09-07  Sergio Villar Senin  <svillar@igalia.com>
138
139         [css-grid] Implement fit-content track size
140         https://bugs.webkit.org/show_bug.cgi?id=161379
141
142         Reviewed by Manuel Rego Casasnovas.
143
144         This implements the new <fit-content> track size which is defined as follows: "Represents
145         the formula min(max-content, max(auto, argument)), which is calculated similar to auto
146         (i.e. minmax(auto, max-content)), except that the track size is clamped at argument if it is
147         greater than the auto minimum."
148
149         From the parsing POV fit-content was implemented as a new type of function which only takes
150         one argument. That forced us to refactor some code because minmax() was the only allowed
151         function for <track-size>s so far.
152
153         The implementation key is a new attribute in GridTrack called growthLimitCap which is
154         precisely the single attribute of fit-content(). Some parts of the track sizing algorithm
155         were adapted to this change like for example the sorting of tracks by growth potential (we
156         need to consider the caps).
157
158         Tests: fast/css-grid-layout/fit-content-columns.html
159         fast/css-grid-layout/fit-content-rows.html
160
161         * css/CSSComputedStyleDeclaration.cpp:
162         (WebCore::specifiedValueForGridTrackSize): Added support for fit-content sizes.
163         * css/StyleBuilderConverter.h:
164         (WebCore::StyleBuilderConverter::createGridTrackSize): Added support for fit-content sizes.
165         * css/parser/CSSParser.cpp:
166         (WebCore::isGridTrackFixedSized): Added support for fit-content sizes.
167         (WebCore::CSSParser::parseGridTrackSize): Added support for parsing fit-content() functions.
168         * css/parser/CSSPropertyParser.cpp: Added support for parsing fit-content() functions so
169         it'll be available once we switch to the new parser.
170         * rendering/RenderGrid.cpp:
171         (WebCore::GridTrack::baseSize): Just return a LayoutUnit, the return value optimization will
172         keep it fast in any case.
173         (WebCore::GridTrack::growthLimit): Ditto.
174         (WebCore::GridTrack::setGrowthLimit): Added an ASSERT to check that the growth limit is
175         never higher than the cap.
176         (WebCore::GridTrack::infiniteGrowthPotential):
177         (WebCore::GridTrack::plannedSize): Just return a LayoutUnit, the return value optimization will
178         keep it fast in any case.
179         (WebCore::GridTrack::tempSize): Just return a LayoutUnit, the return value optimization will
180         keep it fast in any case.
181         (WebCore::GridTrack::setTempSize): Added as we no longer return a reference in tempSize().
182         (WebCore::GridTrack::growTempSize): New utility function which increases the tempSize.
183         (WebCore::GridTrack::setInfinitelyGrowable):
184         (WebCore::GridTrack::setGrowthLimitCap): Added.
185         (WebCore::GridTrack::growthLimitCap): Ditto.
186         (WebCore::GridTrack::growthLimitIsInfinite): Made private.
187         (WebCore::RenderGrid::GridSizingData::freeSpace): Renamed from freeSpaceForDirection.
188         (WebCore::RenderGrid::GridSizingData::availableSpace): We now cache the available space as
189         it is used to compute relative (percentage) sizes.
190         (WebCore::RenderGrid::GridSizingData::setAvailableSpace): Ditto.
191         (WebCore::RenderGrid::GridSizingData::setFreeSpace): Renamed from setFreeSpaceForDirection.
192         (WebCore::RenderGrid::computeTrackSizesForDirection): Receives the available space instead
193         of the free space.
194         (WebCore::RenderGrid::computeIntrinsicLogicalWidths): Properly initialize free and available
195         spaces.
196         (WebCore::RenderGrid::computeIntrinsicLogicalHeight): Ditto.
197         (WebCore::RenderGrid::computeUsedBreadthOfGridTracks): Use available space to initialize the
198         track sizes. Also use sizingOperation to decide whether or not sizes are indefinite. Last
199         but not least, added support for fit-content tracks.
200         (WebCore::RenderGrid::computeUsedBreadthOfMinLength): Pass a GridTrackSize instead of a GridLength.
201         (WebCore::RenderGrid::computeUsedBreadthOfMaxLength): Ditto.
202         (WebCore::RenderGrid::gridTrackSize): Added support for fit-content.
203         (WebCore::RenderGrid::resolveContentBasedTrackSizingFunctions): Ditto.
204         (WebCore::RenderGrid::resolveContentBasedTrackSizingFunctionsForNonSpanningItems): Ditto.
205         (WebCore::trackSizeForTrackSizeComputationPhase):
206         (WebCore::sortByGridTrackGrowthPotential): Reworked the function so it properly sorts tracks
207         with growth limit caps to support fit-content().
208         (WebCore::clampGrowthShareIfNeeded): Clamps the given growthShare passed as argument to the
209         track growth limit cap.
210         (WebCore::RenderGrid::distributeSpaceToTracks): Use the new setTempSize() method. Also sort
211         the selected tracks to grow over growth limits in order to respect the track caps eventually
212         set by fit-content (otherwise those tracks could indefinitely grow over the specified value).
213         (WebCore::RenderGrid::tracksAreWiderThanMinTrackBreadth): Use the new defined functions.
214         (WebCore::RenderGrid::applyStretchAlignmentToTracksIfNeeded): Use freeSpace().
215         (WebCore::RenderGrid::populateGridPositionsForDirection): Ditto.
216         (WebCore::GridTrack::infinitelyGrowable): Deleted.
217         (WebCore::RenderGrid::GridSizingData::freeSpaceForDirection): Deleted.
218         (WebCore::RenderGrid::GridSizingData::setFreeSpaceForDirection): Deleted.
219         (WebCore::RenderGrid::trackSizeForTrackSizeComputationPhase): Deleted.
220         * rendering/RenderGrid.h: Changed the signature of some methods. Moved
221         TrackSizeComputationPhase out of the RenderGrid class.
222         * rendering/style/GridTrackSize.h:
223         (WebCore::GridTrackSize::GridTrackSize): Added some extra documentation. Added a new
224         attribute to the constructor to support fit-content GridTrackSizes.
225         (WebCore::GridTrackSize::fitContentTrackBreadth): New method which returns the growth limit
226         cap set by fit-content().
227         (WebCore::GridTrackSize::minTrackBreadth):
228         (WebCore::GridTrackSize::isFitContent): Added.
229         (WebCore::GridTrackSize::length): Deleted.
230         (WebCore::GridTrackSize::isPercentage): Deleted.
231
232 2016-09-15  Alejandro G. Castro  <alex@igalia.com>
233
234         Fix build warnings in the mediastream code
235         https://bugs.webkit.org/show_bug.cgi?id=161957
236
237         Reviewed by Philippe Normand.
238
239         * platform/mediastream/MediaConstraints.cpp:
240         (WebCore::MediaConstraint::create): Added assertion and mock return.
241         * platform/mediastream/RealtimeMediaSourceSupportedConstraints.cpp:
242         (WebCore::RealtimeMediaSourceSupportedConstraints::nameForConstraint):
243         Added assertion and mock return.
244         (WebCore::RealtimeMediaSourceSupportedConstraints::supportsConstraint):
245         Added assertion and mock return.
246
247 2016-09-15  Youenn Fablet  <youenn@apple.com>
248
249         Rebase binding tests after r205953
250         https://bugs.webkit.org/show_bug.cgi?id=162012
251
252         Unreviewed.
253
254         * bindings/scripts/test/JS/JSTestNode.cpp:
255         (WebCore::jsTestNodePrototypeFunctionTestWorkerPromise):
256         (WebCore::jsTestNodePrototypeFunctionTestWorkerPromisePromise):
257         * bindings/scripts/test/JS/JSTestObj.cpp:
258         (WebCore::jsTestObjPrototypeFunctionTestPromiseFunction):
259         (WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionPromise):
260         (WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionWithFloatArgument):
261         (WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionWithFloatArgumentPromise):
262         (WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionWithException):
263         (WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionWithExceptionPromise):
264         (WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionWithOptionalIntArgument):
265         (WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionWithOptionalIntArgumentPromise):
266         (WebCore::jsTestObjPrototypeFunctionTestPromiseOverloadedFunction1):
267         (WebCore::jsTestObjPrototypeFunctionTestPromiseOverloadedFunction1Promise):
268         (WebCore::jsTestObjPrototypeFunctionTestPromiseOverloadedFunction2):
269         (WebCore::jsTestObjPrototypeFunctionTestPromiseOverloadedFunction2Promise):
270         (WebCore::jsTestObjConstructorFunctionTestStaticPromiseFunction):
271         (WebCore::jsTestObjConstructorFunctionTestStaticPromiseFunctionPromise):
272         (WebCore::jsTestObjConstructorFunctionTestStaticPromiseFunctionWithException):
273         (WebCore::jsTestObjConstructorFunctionTestStaticPromiseFunctionWithExceptionPromise):
274
275 2016-09-15  Alejandro G. Castro  <alex@igalia.com>
276
277         [WebRTC][OpenWebRTC] crash in maybeHandleChangeMutedState
278         https://bugs.webkit.org/show_bug.cgi?id=161619
279
280         Added OpenWebRTC support to the RealtimeMediaSource mock class.
281
282         Reviewed by Eric Carlson.
283
284         Fixed tests.
285
286         * platform/mediastream/openwebrtc/RealtimeMediaSourceOwr.h:
287         (WebCore::RealtimeMediaSourceOwr::RealtimeMediaSourceOwr): Allowed
288         inheritance of the class, required to use it when creating the
289         mock class. Added a new constructor to create the class with null
290         mediastream.
291         * platform/mock/MockRealtimeMediaSource.cpp:
292         (WebCore::MockRealtimeMediaSource::MockRealtimeMediaSource): Use
293         the new BaseRealtimeMediaSourceClass in the constructor.
294         * platform/mock/MockRealtimeMediaSource.h: Added a new
295         BaseRealtimeMediaSourceClass defined using the
296         RealtimeMediaSourceOwr class for OpenWebRTC platform.
297
298 2016-09-15  Sergio Villar Senin  <svillar@igalia.com>
299
300         [css-grid] Fix intrinsic size computation with flexible sized tracks
301         https://bugs.webkit.org/show_bug.cgi?id=161903
302
303         Reviewed by Manuel Rego Casasnovas.
304
305         This is fixing a regression added in r192154. When computing the min content size of a grid
306         container (min preferred logical width) we should not take into account the fr tracks. As
307         stated in the early versions of the spec that size is the sum of the tracks' base sizes
308         before running the maximize tracks step.
309
310         That regression was causing sizing issues in grids with fr tracks both when under
311         min|max-content constrains and also when used as grid items (in nested grids).
312
313         * rendering/RenderGrid.cpp:
314         (WebCore::RenderGrid::computeUsedBreadthOfGridTracks):
315
316 2016-09-13  Sergio Villar Senin  <svillar@igalia.com>
317
318         [css-grid] Too many gaps with trailing collapsing tracks
319         https://bugs.webkit.org/show_bug.cgi?id=161905
320
321         Reviewed by Darin Adler.
322
323         The total number and size of gaps were incorrectly computed whenever there were trailing
324         collapsed tracks (with collapsed gaps). The problem was that we were trying to optimize too
325         much the amount of hash table queries required to know the gaps between two lines. We were
326         considering that a gap always exist between 2 consecutive tracks if the first one is not
327         empty. That's generally true (for both NOTEMPTY|NOTEMPTY and NOTEMPTY|EMPTY+|NOTEMPTY
328         sequences) but not for all the cases (NOTEMPTY|EMPTY+).
329
330         * rendering/RenderGrid.cpp:
331         (WebCore::RenderGrid::guttersSize):
332
333 2016-09-15  Youenn Fablet  <youenn@apple.com>
334
335         callPromiseFunction should be made usable for custom binding code
336         https://bugs.webkit.org/show_bug.cgi?id=161961
337
338         Reviewed by Darin Adler.
339
340         Covered by updated test.
341
342         * bindings/js/JSDOMBinding.h:
343         (WebCore::castThisValue): Utility function to cast this value to a specific type.
344         * bindings/js/JSDOMPromise.h:
345         (WebCore::callPromiseFunction): Updated to take real promise function as a template parameter
346         for improved efficiency. Added workerMode template parameter.
347         (WebCore::bindingPromiseFunctionAdapter): Function signature adaptor.
348         * bindings/js/JSMediaDevicesCustom.cpp:
349         (WebCore::JSMediaDevicesGetUserMediaPromiseFunction):
350         (WebCore::JSMediaDevices::getUserMedia): Making use of callPromiseFunction to properly handle exceptions.
351         * bindings/scripts/CodeGeneratorJS.pm:
352         (GenerateImplementation): Updated to use template parameter.
353         * bindings/scripts/test/JS/JSTestNode.cpp:
354         (WebCore::jsTestNodePrototypeFunctionTestWorkerPromise):
355         (WebCore::jsTestNodePrototypeFunctionTestWorkerPromisePromise):
356         * bindings/scripts/test/JS/JSTestObj.cpp:
357         (WebCore::jsTestObjPrototypeFunctionTestPromiseFunction):
358         (WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionWithFloatArgument):
359         (WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionWithException):
360         (WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionWithOptionalIntArgument):
361         (WebCore::jsTestObjPrototypeFunctionTestPromiseOverloadedFunction1):
362         (WebCore::jsTestObjPrototypeFunctionTestPromiseOverloadedFunction2):
363         (WebCore::jsTestObjConstructorFunctionTestStaticPromiseFunction):
364         (WebCore::jsTestObjConstructorFunctionTestStaticPromiseFunctionWithException):
365         * bindings/scripts/test/TestNode.idl: Adding Worker promise binding test.
366
367 2016-09-14  Jiewen Tan  <jiewen_tan@apple.com>
368
369         WebCrypto algorithms should be exposed via KeyAlgorithm dictionary
370         https://bugs.webkit.org/show_bug.cgi?id=128748
371         <rdar://problem/27359438>
372
373         Reviewed by Brent Fulgham and Chris Dumez.
374
375         Replace custom CryptoAlgorithmBuilder/buildAlgorithmDescription with KeyAlgorithm dictionary which is
376         defined by the spec: https://www.w3.org/TR/WebCryptoAPI/#key-algorithm-dictionary. Moreover, mark
377         CryptoKey.usages as CachedAttribute.
378
379         Tests: crypto/subtle/crypto-key-algorithm-gc.html
380                crypto/subtle/crypto-key-usages-gc.html
381
382         * PlatformEfl.cmake:
383         * PlatformGTK.cmake:
384         * PlatformMac.cmake:
385         Remove CryptoAlgorithmDescriptionBuilder.cpp.
386         * WebCore.xcodeproj/project.pbxproj:
387         * bindings/js/JSCryptoAlgorithmBuilder.cpp:
388         (WebCore::JSCryptoAlgorithmBuilder::add):
389         (WebCore::JSCryptoAlgorithmBuilder::createEmptyClone): Deleted.
390         * bindings/js/JSCryptoAlgorithmBuilder.h:
391         * bindings/js/JSCryptoKeyCustom.cpp:
392         (WebCore::JSCryptoKey::algorithm):
393         Get rid of dependency on CryptoAlgorithmDescriptionBuilder.
394         * crypto/CryptoAlgorithmDescriptionBuilder.cpp: Removed.
395         * crypto/CryptoAlgorithmDescriptionBuilder.h: Removed.
396         Replace it with KeyAlgorithm.
397         * crypto/CryptoKey.cpp:
398         (WebCore::CryptoKey::CryptoKey):
399         (WebCore::CryptoKey::buildAlgorithmDescription): Deleted.
400         * crypto/CryptoKey.h:
401         (WebCore::KeyAlgorithm::KeyAlgorithm):
402         (WebCore::KeyAlgorithm::~KeyAlgorithm):
403         (WebCore::CryptoKey::algorithmIdentifier):
404         * crypto/CryptoKey.idl:
405         Add KeyAlgorithm dictionary which is returned via CryptoKey.buildAlgorithm() method,
406         and rename m_algorithm to m_algorithmIdentifier to distingush it with newly
407         added KeyAlgorithm dictionary.
408         * crypto/gnutls/CryptoKeyRSAGnuTLS.cpp:
409         (WebCore::buildAlgorithm):
410         (WebCore::CryptoKeyRSA::buildAlgorithmDescription): Deleted.
411         * crypto/keys/CryptoKeyAES.cpp:
412         (WebCore::CryptoKeyAES::buildAlgorithm):
413         (WebCore::CryptoKeyAES::buildAlgorithmDescription): Deleted.
414         * crypto/keys/CryptoKeyAES.h:
415         (WebCore::AesKeyAlgorithm::AesKeyAlgorithm):
416         (WebCore::AesKeyAlgorithm::~AesKeyAlgorithm):
417         * crypto/keys/CryptoKeyHMAC.cpp:
418         (WebCore::CryptoKeyHMAC::buildAlgorithm):
419         (WebCore::CryptoKeyHMAC::buildAlgorithmDescription): Deleted.
420         * crypto/keys/CryptoKeyHMAC.h:
421         (WebCore::HmacKeyAlgorithm::HmacKeyAlgorithm):
422         (WebCore::HmacKeyAlgorithm::~HmacKeyAlgorithm):
423         * crypto/keys/CryptoKeyRSA.h:
424         (WebCore::RsaKeyAlgorithm::RsaKeyAlgorithm):
425         (WebCore::RsaKeyAlgorithm::~RsaKeyAlgorithm):
426         (WebCore::RsaHashedKeyAlgorithm::RsaHashedKeyAlgorithm):
427         (WebCore::RsaHashedKeyAlgorithm::~RsaHashedKeyAlgorithm):
428         * crypto/mac/CryptoKeyRSAMac.cpp:
429         (WebCore::CryptoKeyRSA::buildAlgorithm):
430         (WebCore::CryptoKeyRSA::buildAlgorithmDescription): Deleted.
431
432 2016-09-14  Chris Dumez  <cdumez@apple.com>
433
434         REGRESSION (r205670): ASSERTION FAILED: methodTable(vm)->toThis(this, exec, NotStrictMode) == this
435         https://bugs.webkit.org/show_bug.cgi?id=161982
436
437         Reviewed by Saam Barati.
438
439         We no longer need a custom [[SetPrototypeOf]] anymore as JSProxy::setPrototypeOf()
440         no longer forwards the call to its target.
441
442         No new layout tests because the behavior only changes in the context of the JSC
443         tests (which were updated in this patch).
444
445         * bindings/js/JSDOMWindowCustom.cpp:
446         (WebCore::JSDOMWindow::setPrototype): Deleted.
447         * page/DOMWindow.idl:
448
449 2016-09-14  Wenson Hsieh  <wenson_hsieh@apple.com>
450
451         Media controls behave strangely when changing media sources
452         https://bugs.webkit.org/show_bug.cgi?id=161914
453         <rdar://problem/28227805>
454
455         Reviewed by Tim Horton.
456
457         Addresses media controls flickering while changing the source of a media element. To accomplish this, we make
458         the following changes to the media controls main content heuristic:
459
460         - Prevent elements that are not mostly within the mainframe rect (or elements with empty rects) from showing
461           media controls. Many websites that rely on same document navigation will move videos offscreen when navigating
462           to a section of their site that does not play media. Without this check, we would not know to hide a video
463           element on certain popular websites that use this technique, since the video has been interacted with in the
464           past.
465
466         - Rather than check whether a media element currently has video/audio sources, check whether it has ever had
467           audio. Many websites will use the same media element across different videos and change only the source, and
468           we should not prevent a media element from having media controls on grounds of having no audio or video in
469           this case.
470
471         - Rather than add user gesture and playback behavior restrictions before dispatching an ended event, add only
472           the gesture restriction immediately, and add the playback restriction after waiting for a grace period only if
473           the user has not interacted with the video since ending, and the video is not currently playing or about to
474           play. This gives the user a chance to interact with the controls when a video ends, but also allows the page
475           to load or begin playing a new video with the same media element without thrashing media control state.
476
477         Adds 3 new API tests.
478
479         * html/HTMLMediaElement.cpp:
480         (WebCore::HTMLMediaElement::HTMLMediaElement):
481         (WebCore::HTMLMediaElement::~HTMLMediaElement):
482         (WebCore::HTMLMediaElement::mediaPlayerActiveSourceBuffersChanged):
483         (WebCore::HTMLMediaElement::seekWithTolerance):
484         (WebCore::HTMLMediaElement::beginScrubbing):
485         (WebCore::HTMLMediaElement::addBehaviorRestrictionsOnEndIfNecessary):
486         (WebCore::HTMLMediaElement::mediaPlayerCharacteristicChanged):
487         (WebCore::HTMLMediaElement::playbackControlsManagerBehaviorRestrictionsTimerFired):
488         * html/HTMLMediaElement.h:
489         (WebCore::HTMLMediaElement::hasEverHadAudio):
490         (WebCore::HTMLMediaElement::hasEverHadVideo):
491         * html/MediaElementSession.cpp:
492         (WebCore::MediaElementSession::canShowControlsManager):
493         (WebCore::isElementRectMostlyInMainFrame):
494         * platform/graphics/MediaPlayer.h:
495         (WebCore::MediaPlayerClient::mediaPlayerActiveSourceBuffersChanged):
496         * platform/graphics/MediaPlayerPrivate.h:
497         (WebCore::MediaPlayerPrivateInterface::notifyActiveSourceBuffersChanged):
498         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
499         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
500         (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::notifyActiveSourceBuffersChanged):
501         * platform/graphics/avfoundation/objc/MediaSourcePrivateAVFObjC.mm:
502         (WebCore::MediaSourcePrivateAVFObjC::removeSourceBuffer):
503         (WebCore::MediaSourcePrivateAVFObjC::sourceBufferPrivateDidChangeActiveState):
504
505 2016-09-14  Eric Carlson  <eric.carlson@apple.com>
506
507         [MediaStream] Minor cleanup
508         https://bugs.webkit.org/show_bug.cgi?id=161976
509
510         Reviewed by Youenn Fablet and Dean Jackson.
511
512         No new tests, no behavior change.
513
514         * CMakeLists.txt:
515         * DerivedSources.make:
516         * Modules/mediastream/CaptureDeviceInfo.h: Removed.
517         * Modules/mediastream/CaptureDeviceManager.cpp: Removed.
518         * Modules/mediastream/CaptureDeviceManager.h: Removed.
519         * Modules/mediastream/MediaDevicesRequest.cpp:
520         (WebCore::MediaDevicesRequest::didCompletePermissionCheck):
521         (WebCore::MediaDevicesRequest::didCompleteTrackSourceInfoRequest): Deleted.
522         (WebCore::MediaDevicesRequest::requestOrigin): Deleted.
523         * Modules/mediastream/MediaDevicesRequest.h:
524         * Modules/mediastream/MediaStreamTrackSourcesCallback.h: Removed.
525         * Modules/mediastream/MediaStreamTrackSourcesCallback.idl: Removed.
526         * Modules/mediastream/SourceInfo.cpp: Removed.
527         * Modules/mediastream/SourceInfo.h: Removed.
528         * Modules/mediastream/SourceInfo.idl: Removed.
529         * WebCore.xcodeproj/project.pbxproj:
530         * platform/mediastream/CaptureDevice.h: Copied from Source/WebCore/Modules/mediastream/CaptureDeviceInfo.h.
531         (WebCore::CaptureDevice::CaptureDevice):
532         (WebCore::CaptureDevice::persistentId):
533         (WebCore::CaptureDevice::label):
534         (WebCore::CaptureDevice::groupId):
535         (WebCore::CaptureDevice::kind):
536         (WebCore::CaptureSessionInfo::~CaptureSessionInfo): Deleted.
537         (WebCore::CaptureSessionInfo::supportsVideoSize): Deleted.
538         (WebCore::CaptureSessionInfo::bestSessionPresetForVideoDimensions): Deleted.
539         * platform/mediastream/CaptureDeviceManager.cpp: Copied from Source/WebCore/Modules/mediastream/CaptureDeviceManager.cpp.
540         (CaptureDeviceManager::getSourcesInfo):
541         * platform/mediastream/CaptureDeviceManager.h: Copied from Source/WebCore/Modules/mediastream/CaptureDeviceManager.h.
542         (WebCore::CaptureSessionInfo::~CaptureSessionInfo):
543         (WebCore::CaptureSessionInfo::supportsVideoSize):
544         (WebCore::CaptureSessionInfo::bestSessionPresetForVideoDimensions):
545         * platform/mediastream/MediaStreamTrackSourcesRequestClient.h: Removed.
546         * platform/mediastream/RealtimeMediaSourceCenter.h:
547         * platform/mediastream/mac/AVCaptureDeviceManager.h:
548         * platform/mediastream/mac/AVCaptureDeviceManager.mm:
549         (WebCore::AVCaptureDeviceManager::getSourcesInfo):
550         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.cpp:
551         (WebCore::RealtimeMediaSourceCenterMac::getMediaStreamDevices):
552         (WebCore::RealtimeMediaSourceCenterMac::getMediaStreamTrackSources): Deleted.
553         (WebCore::RealtimeMediaSourceCenterMac::sourceWithUID): Deleted.
554         * platform/mediastream/mac/RealtimeMediaSourceCenterMac.h:
555         * platform/mediastream/openwebrtc/RealtimeMediaSourceCenterOwr.cpp:
556         (WebCore::RealtimeMediaSourceCenterOwr::getMediaStreamDevices):
557         (WebCore::RealtimeMediaSourceCenterOwr::getMediaStreamTrackSources): Deleted.
558         (WebCore::RealtimeMediaSourceCenterOwr::sourceWithUID): Deleted.
559         * platform/mediastream/openwebrtc/RealtimeMediaSourceCenterOwr.h:
560         * platform/mock/MockRealtimeMediaSource.cpp:
561         (WebCore::MockRealtimeMediaSource::audioDeviceInfo):
562         (WebCore::MockRealtimeMediaSource::videoDeviceInfo):
563         (WebCore::MockRealtimeMediaSource::trackSourceWithUID): Deleted.
564         * platform/mock/MockRealtimeMediaSource.h:
565         * platform/mock/MockRealtimeMediaSourceCenter.cpp:
566         (WebCore::MockRealtimeMediaSourceCenter::getMediaStreamDevices):
567         (WebCore::MockRealtimeMediaSourceCenter::getMediaStreamTrackSources): Deleted.
568         (WebCore::MockRealtimeMediaSourceCenter::sourceWithUID): Deleted.
569         * platform/mock/MockRealtimeMediaSourceCenter.h:
570
571 2016-09-14  Antti Koivisto  <antti@apple.com>
572
573         Move more code out from RenderObject
574         https://bugs.webkit.org/show_bug.cgi?id=161980
575
576         Reviewed by Zalan Bujtas.
577
578         Move some functions that are only needed for RenderElement there.
579         Move collapsing anonymous table rows to RenderTableRow.
580
581         * rendering/RenderElement.cpp:
582         (WebCore::RenderElement::hasOutlineAnnotation):
583         (WebCore::RenderElement::hasSelfPaintingLayer):
584         (WebCore::RenderElement::checkForRepaintDuringLayout):
585         * rendering/RenderElement.h:
586         (WebCore::RenderElement::hasOutline):
587         (WebCore::RenderElement::hasHiddenBackface): Deleted.
588         * rendering/RenderLayerCompositor.cpp:
589         (WebCore::RenderLayerCompositor::rootOrBodyStyleChanged):
590         * rendering/RenderObject.cpp:
591         (WebCore::RenderObject::pixelSnappedAbsoluteClippedOverflowRect):
592         (WebCore::RenderObject::destroyAndCleanupAnonymousWrappers):
593         (WebCore::RenderObject::hasSelfPaintingLayer): Deleted.
594         (WebCore::RenderObject::checkForRepaintDuringLayout): Deleted.
595         (WebCore::RenderObject::hasOutlineAnnotation): Deleted.
596         (WebCore::RenderObject::hasEntirelyFixedBackground): Deleted.
597         (WebCore::collapseAnonymousTableRowsIfNeeded): Deleted.
598         * rendering/RenderObject.h:
599         (WebCore::RenderObject::hasLayer):
600         (WebCore::RenderObject::canBeSelectionLeaf):
601         (WebCore::RenderObject::hasOutline): Deleted.
602         (WebCore::RenderObject::hasSelectedChildren): Deleted.
603         * rendering/RenderTableRow.cpp:
604         (WebCore::RenderTableRow::destroyAndCollapseAnonymousSiblingRows):
605         * rendering/RenderTableRow.h:
606         * rendering/RenderView.cpp:
607         (WebCore::RenderView::rootBackgroundIsEntirelyFixed):
608
609 2016-09-14  Daniel Bates  <dabates@apple.com>
610
611         Switch CSSParser to use CSSParserFastPaths::isKeywordPropertyID()
612         https://bugs.webkit.org/show_bug.cgi?id=161983
613
614         Reviewed by David Hyatt.
615
616         Towards switching to the new CSS parser keyword properties validation logic,
617         switch over the old CSS parser logic for determining a keyword property to
618         use the analogous logic in the new CSS parser.
619
620         A side benefit of this change is that it is a step towards unifying CSS- and
621         SVG CSS- keyword properties. The new CSS parser does not make a distinction
622         between these kinds of properties and will allow us to have a shared code path
623         for validating a keyword property.
624
625         No functionality was changed. So, no new tests.
626
627         * css/parser/CSSParser.cpp: Include header CSSParserFastPaths.h.
628         (WebCore::isValidKeywordPropertyAndValue): Validate SVG CSS keyword properties. This
629         logic was moved from CSSParser::parseSVGValue(). In subsequent patches we will switch
630         the old CSS parser from this function to CSSParserFastPaths::isValidKeywordPropertyAndValue().
631         (WebCore::parseKeywordValue): Modified to call CSSParserFastPaths::isKeywordPropertyID().
632         (WebCore::CSSParser::parseValue): Ditto.
633         (WebCore::isKeywordPropertyID): Deleted. Incorporated its functionality into
634         CSSParserFastPaths::isKeywordPropertyID().
635         * css/parser/CSSParserFastPaths.cpp:
636         (WebCore::CSSParserFastPaths::isKeywordPropertyID): Incorporates the functionality
637         of WebCore::isKeywordPropertyID().
638         * css/parser/SVGCSSParser.cpp:
639         (WebCore::CSSParser::parseSVGValue): Move properties that can be processed as
640         keyword properties from here to WebCore::isValidKeywordPropertyAndValue().
641
642 2016-09-13  Dean Jackson  <dino@apple.com>
643
644         Rename parseColorParameters and clean up conditional
645         https://bugs.webkit.org/show_bug.cgi?id=161941
646         <rdar://problem/28292750>
647
648         Reviewed by Dan Bates.
649
650         In preparation for adding color() support, rename the existing
651         parseColorParameters to parseRGBParameters.
652
653         Also clean up the logic in the parseColorFromValue function.
654
655         * css/parser/CSSParser.cpp:
656         (WebCore::CSSParser::parseRGBParameters):
657         (WebCore::CSSParser::parseColorFromValue):
658         (WebCore::CSSParser::parseColorParameters): Deleted.
659         * css/parser/CSSParser.h:
660
661 2016-09-14  Chris Dumez  <cdumez@apple.com>
662
663         Add support hr.color IDL attribute
664         https://bugs.webkit.org/show_bug.cgi?id=161977
665
666         Reviewed by Darin Adler.
667
668         Add support hr.color IDL attribute as per:
669         - https://html.spec.whatwg.org/#HTMLHRElement-partial
670
671         Even though this is a legacy attribute, it is still part of the HTML specification
672         and it is still supported by Firefox and Chrome.
673
674         Also note that even though WebKit does not currently support the 'color' IDL
675         attribute on <hr>, it does support the 'color' content attribute on <hr>.
676         Therefore, we only need to reflect the 'color' content attribute.
677
678         No new tests, rebaselined existing test.
679
680         * html/HTMLHRElement.idl:
681
682 2016-09-14  Alex Christensen  <achristensen@webkit.org>
683
684         URLParser: Add fast path for hosts containing no non-ASCII or percent characters
685         https://bugs.webkit.org/show_bug.cgi?id=161970
686
687         Reviewed by Daniel Bates.
688
689         Covered by existing tests.
690
691         * platform/URLParser.cpp:
692         (WebCore::URLParser::parse):
693         (WebCore::URLParser::parseHost):
694         * platform/URLParser.h:
695         When parsing the host of a URL, if it contains non-ASCII characters or percent-encoded values,
696         we need to do additional encoding.  Many URLs, including all already-parsed URLs, do not have
697         such characters in their host, and therefore do not need the additional encoding.  Skipping
698         the additional encoding significantly speeds up my URL parsing benchmark.
699
700 2016-09-14  Zalan Bujtas  <zalan@apple.com>
701
702         ShowRenderTree should take position offset into account when printing inflow positioned renderers.
703         https://bugs.webkit.org/show_bug.cgi?id=161978
704
705         Reviewed by Simon Fraser.
706
707         Adjust (x, y) with the inflow positioned renderer's offset.  
708
709         Not testable.
710
711         * rendering/RenderObject.cpp:
712         (WebCore::RenderObject::showRenderObject):
713
714 2016-09-14  Alex Christensen  <achristensen@webkit.org>
715
716         URLParser: Add fast path for utf8 encoding queries
717         https://bugs.webkit.org/show_bug.cgi?id=161968
718
719         Reviewed by Daniel Bates.
720
721         No change in behavior.  Covered by existing tests.
722
723         * platform/URLParser.cpp:
724         (WebCore::utf8PercentEncodeQuery):
725         (WebCore::URLParser::parse):
726         If the text encoding is UTF-8 (which is quite common), then we can encode the query
727         as we iterate its code points. This reduces memory allocation and significantly speeds
728         up my URL parsing benchmark.
729
730 2016-09-14  Chris Dumez  <cdumez@apple.com>
731
732         Regression(r152725): generate-bindings.pl --write-dependencies does not work
733         https://bugs.webkit.org/show_bug.cgi?id=161897
734
735         Reviewed by Darin Adler.
736
737         r152725 inadvertently dropped the code generating the JS*.dep files when
738         --write-dependencies is passed to the bindings generator. As a result,
739         our dependency tracking was broken. This patch restores the code that
740         was dropped in r152725.
741
742         * bindings/scripts/CodeGeneratorJS.pm:
743         (new):
744         (GenerateHeader):
745
746 2016-09-14  Chris Dumez  <cdumez@apple.com>
747
748         input.type cannot be set to "file" after being set to another type
749         https://bugs.webkit.org/show_bug.cgi?id=161943
750
751         Reviewed by Daniel Bates.
752
753         input.type cannot be set to "file" after being set to another type.
754         This behavior does not match the HTML specification or the behavior
755         of Firefox and Chrome. This patch drops this restriction and aligns
756         our behavior with other browsers.
757
758         Test: fast/dom/HTMLInputElement/input-type-change-to-file.html
759
760         * html/FileInputType.cpp:
761         (WebCore::FileInputType::canChangeFromAnotherType): Deleted.
762         * html/FileInputType.h:
763         * html/HTMLInputElement.cpp:
764         (WebCore::HTMLInputElement::updateType):
765         * html/InputType.cpp:
766         (WebCore::InputType::canChangeFromAnotherType): Deleted.
767         * html/InputType.h:
768
769 2016-09-14  Carlos Garnacho <carlosg@gnome.org>
770
771         [GTK][Wayland] Implement clipboard support
772         https://bugs.webkit.org/show_bug.cgi?id=146574
773
774         Reviewed by Carlos Garcia Campos.
775
776         Implement PlatformPasteboard in the GTK+ platform, and move Pasteboard
777         to using PasteboardStrategy so clipboard management is left to the
778         UIProcess.
779
780         DataObjectGtk is still used in the Pasteboard GTK implementation, it's
781         now just never backed by a GtkClipboard, this object is instead
782         serialized through PasteboardStrategy, so the UIProcess side can mirror
783         the content in a GtkClipboard-backed DataObjectGtk, which is then
784         exposed to the windowing through PlatformPasteboard/PasteboardHelper.
785
786         When requesting clipboard content, it works similarly, the UIProcess
787         side first updates its DataObjectGtk, which is then mirrored by the
788         WebProcess through the PasteboardStrategy requests.
789
790         * PlatformGTK.cmake: Added PlatformPasteboardGtk.cpp
791         * editing/gtk/EditorGtk.cpp:
792         (WebCore::Editor::writeSelectionToPasteboard): Eliminate usage of
793         PasteboardWebContent callback argument. This is done differently as
794         we have to signal back the WebProcess.
795         * platform/Pasteboard.h: Cleaned up of direct GTK+ dependency.
796         * platform/PasteboardStrategy.h: Added plumbing towards the pasteboard
797         proxy.
798         * platform/PlatformPasteboard.h:
799         * platform/gtk/DataObjectGtk.cpp:
800         (WebCore::DataObjectGtk::clearAllExceptFilenames): Clear the "smart
801         paste" flag if set, now that this is DataObjectGtk data.
802         * platform/gtk/DataObjectGtk.h:
803         (WebCore::DataObjectGtk::canSmartReplace):
804         (WebCore::DataObjectGtk::setCanSmartReplace): Added functions, in order
805         to flag whether a DataObjectGtk has the "smart paste" feature enabled
806         or not.
807         * platform/gtk/PasteboardGtk.cpp:
808         (WebCore::Pasteboard::createForCopyAndPaste):
809         (WebCore::Pasteboard::createForGlobalSelection):
810         (WebCore::Pasteboard::Pasteboard):
811         (WebCore::Pasteboard::writeToClipboard):
812         (WebCore::Pasteboard::readFromClipboard):
813         (WebCore::Pasteboard::writePlainText):
814         (WebCore::Pasteboard::write):
815         (WebCore::Pasteboard::writePasteboard):
816         (WebCore::Pasteboard::clear):
817         (WebCore::Pasteboard::canSmartReplace):
818         (WebCore::Pasteboard::read):
819         (WebCore::Pasteboard::hasData):
820         (WebCore::Pasteboard::types):
821         (WebCore::Pasteboard::readString):
822         (WebCore::Pasteboard::readFilenames): Made to use the
823         PasteboardStrategy instead of PasteboardHelper/GTK+ API.
824         * platform/gtk/PasteboardHelper.cpp:
825         (WebCore::PasteboardHelper::~PasteboardHelper):
826         (WebCore::ClipboardSetData::ClipboardSetData):
827         (WebCore::clearClipboardContentsCallback):
828         (WebCore::PasteboardHelper::writeClipboardContents): Remove the GClosure
829         to notify whether the global selection has been replaced. Use std:function
830         instead. Remove SmartPasteInclusion argument, now figured out through
831         DataObjectGtk canSmartPaste() member.
832         * platform/gtk/PasteboardHelper.h:
833         * platform/gtk/PlatformPasteboardGtk.cpp: Added.
834         (WebCore::PlatformPasteboard::PlatformPasteboard):
835         (WebCore::PlatformPasteboard::writeToClipboard):
836         (WebCore::PlatformPasteboard::readFromClipboard): Implemented
837         PlatformPasteboard using PasteboardHelper/GTK+ API.
838
839 2016-09-13  Dave Hyatt  <hyatt@apple.com>
840
841         [CSS Parser] Enable the new sizes parser by default
842         https://bugs.webkit.org/show_bug.cgi?id=161931
843
844         Reviewed by Zalan Bujtas.
845
846         Added new tests in fast/dom/HTMLImageElement/sizes.
847
848         * CMakeLists.txt:
849         * WebCore.xcodeproj/project.pbxproj:
850         * css/CSSGrammar.y.in:
851         Remove the old code that parsed source size lists.
852
853         * css/MediaQueryEvaluator.cpp:
854         (WebCore::MediaQueryEvaluator::MediaQueryEvaluator):
855         * css/MediaQueryEvaluator.h:
856         Change to take a const Document&, since the Document is not modified.
857
858         * css/SourceSizeList.cpp: Removed.
859         * css/SourceSizeList.h: Removed.
860         * css/parser/CSSParser.cpp:
861         (WebCore::CSSParser::parseSizesAttribute): Deleted.
862         (WebCore::CSSParser::SourceSize::SourceSize): Deleted.
863         (WebCore::CSSParser::sourceSize): Deleted.
864         * css/parser/CSSParser.h:
865         Remove the old sizes processing code.
866
867         * css/parser/MediaQueryParser.cpp:
868         (WebCore::MediaQueryParser::skipUntilComma):
869         (WebCore::MediaQueryParser::parseInternal):
870         Fix a bug I introduced when modifying this code from Blink. The Nones should have been Nots.
871
872         * css/parser/SizesAttributeParser.cpp:
873         (WebCore::SizesAttributeParser::computeLength):
874         (WebCore::SizesAttributeParser::SizesAttributeParser):
875         (WebCore::SizesAttributeParser::calculateLengthInPixels):
876         (WebCore::SizesAttributeParser::mediaConditionMatches):
877         (WebCore::SizesAttributeParser::effectiveSizeDefaultValue):
878         * css/parser/SizesAttributeParser.h:
879         * css/parser/SizesCalcParser.cpp:
880         (WebCore::SizesCalcParser::SizesCalcParser):
881         (WebCore::SizesCalcParser::appendLength):
882         * css/parser/SizesCalcParser.h:
883         Make the sizes parsers take a Document, since having separate style and view arguments made
884         no sense, given that the style used is always the view's.
885
886         * html/HTMLImageElement.cpp:
887         (WebCore::HTMLImageElement::bestFitSourceFromPictureElement):
888         (WebCore::HTMLImageElement::selectImageSource):
889         * html/parser/HTMLPreloadScanner.cpp:
890         (WebCore::TokenPreloadScanner::StartTagScanner::processAttributes):
891         Switch image elements and the preload scanner over to the new code.
892
893 2016-09-13  Chris Dumez  <cdumez@apple.com>
894
895         Unreviewed, rolling out r205887.
896
897         Broke the Windows build
898
899         Reverted changeset:
900
901         "Merge Element::ScrollToOptions and
902         DOMWindow::ScrollToOptions"
903         https://bugs.webkit.org/show_bug.cgi?id=161932
904         http://trac.webkit.org/changeset/205887
905
906 2016-09-13  Dean Jackson  <dino@apple.com>
907
908         Remove a .rej file.
909
910         * animation/DocumentTimeline.h.rej: Removed.
911
912 2016-09-13  Alex Christensen  <achristensen@webkit.org>
913
914         Implement URLSearchParams
915         https://bugs.webkit.org/show_bug.cgi?id=161920
916
917         Reviewed by Chris Dumez.
918
919         Covered by newly passing web platform tests.
920
921         * CMakeLists.txt:
922         * DerivedSources.make:
923         * WebCore.xcodeproj/project.pbxproj:
924         * html/DOMURL.cpp:
925         (WebCore::DOMURL::setQuery):
926         (WebCore::DOMURL::searchParams):
927         * html/DOMURL.h:
928         * html/URLSearchParams.cpp: Added.
929         (WebCore::URLSearchParams::URLSearchParams):
930         (WebCore::URLSearchParams::get):
931         (WebCore::URLSearchParams::has):
932         (WebCore::URLSearchParams::set):
933         (WebCore::URLSearchParams::append):
934         (WebCore::URLSearchParams::getAll):
935         (WebCore::URLSearchParams::remove):
936         (WebCore::URLSearchParams::toString):
937         (WebCore::URLSearchParams::updateURL):
938         (WebCore::URLSearchParams::Iterator::Iterator):
939         * html/URLSearchParams.h: Added.
940         (WebCore::URLSearchParams::create):
941         (WebCore::URLSearchParams::createIterator):
942         * html/URLSearchParams.idl: Added.
943         * html/URLUtils.idl:
944         * platform/URLParser.cpp:
945         (WebCore::percentDecode):
946         (WebCore::URLParser::parseHost):
947         (WebCore::formURLDecode):
948         (WebCore::serializeURLEncodedForm):
949         (WebCore::URLParser::serialize):
950         * platform/URLParser.h:
951
952 2016-09-12  Dean Jackson  <dino@apple.com>
953
954         Replace RGBA32 with Color in member variables
955         https://bugs.webkit.org/show_bug.cgi?id=161856
956         <rdar://problem/28254324>
957
958         Reviewed by Simon Fraser.
959
960         In preparation for the Color class to become more than
961         just a 4-byte RGBA value, I went through a few places
962         that were using the RGBA32 type directly, and replaced
963         them with Color. This will make some objects a little
964         bigger e.g. BorderValue and its friends.
965
966         I mostly looked at the places that were using RGBA32 as
967         a member variable. There is still a lot of RGBA32 use
968         around the project, in particular the CSS parser.
969
970         There should be no behaviour change.
971
972         * html/canvas/CanvasRenderingContext2D.cpp: Shadows now use Color.
973         (WebCore::CanvasRenderingContext2D::setShadow):
974         (WebCore::CanvasRenderingContext2D::shouldDrawShadows):
975         (WebCore::CanvasRenderingContext2D::didDraw):
976         * html/canvas/CanvasRenderingContext2D.h:
977         * html/canvas/CanvasStyle.cpp: Canvas style uses Color for fills and strokes.
978         (WebCore::CanvasStyle::CanvasStyle):
979         (WebCore::CanvasStyle::isEquivalentColor):
980         (WebCore::CanvasStyle::isEquivalentRGBA):
981         (WebCore::CanvasStyle::applyStrokeColor):
982         (WebCore::CanvasStyle::applyFillColor):
983         * html/canvas/CanvasStyle.h:
984         (WebCore::CanvasStyle::CMYKAValues::CMYKAValues):
985         (WebCore::CanvasStyle::color):
986
987         * html/track/TextTrackCueGeneric.h: Foreground, background and
988         highlight colors.
989         * platform/graphics/InbandTextTrackPrivateClient.h:
990         (WebCore::GenericCueData::setForegroundColor):
991         (WebCore::GenericCueData::setBackgroundColor):
992         (WebCore::GenericCueData::setHighlightColor):
993
994         * page/PageOverlay.cpp: Background color.
995         (WebCore::PageOverlay::setBackgroundColor):
996         * page/PageOverlay.h:
997
998         * platform/graphics/mac/ColorMac.h: Random function that returned RGBA32.
999         * platform/graphics/mac/ColorMac.mm:
1000         (WebCore::oldAquaFocusRingColor):
1001
1002         * rendering/RenderTableCell.cpp: Update the size of CollapsedBorderValue.
1003
1004         * rendering/RenderTheme.h: Use a NeverDestroyed Color rather than a static RGBA32.
1005
1006         * rendering/style/BorderValue.h: Use a Color.
1007         (WebCore::BorderValue::BorderValue):
1008         (WebCore::BorderValue::isTransparent):
1009         (WebCore::BorderValue::operator==):
1010         (WebCore::BorderValue::setColor):
1011         (WebCore::BorderValue::color):
1012         * rendering/style/CollapsedBorderValue.h:
1013         (WebCore::CollapsedBorderValue::CollapsedBorderValue):
1014         (WebCore::CollapsedBorderValue::color):
1015         * rendering/style/OutlineValue.h:
1016         (WebCore::OutlineValue::operator==):
1017
1018         * rendering/style/RenderStyle.cpp: Update to match new BorderValue.
1019
1020 2016-09-13  Jer Noble  <jer.noble@apple.com>
1021
1022         [media-source] MediaSource.addSourceBuffer(null) should throw an exception
1023         https://bugs.webkit.org/show_bug.cgi?id=161884
1024
1025         Reviewed by Eric Carlson.
1026
1027         Fixes test: imported/w3c/web-platform-tests/media-source/mediasource-addsourcebuffer.html
1028
1029         * Modules/mediasource/MediaSource.idl: The addSourceBuffer() parameter is not optional
1030             and not nullable.
1031
1032 2016-09-13  Daniel Bates  <dabates@apple.com>
1033
1034         Remove Chrome app-specific CSS property -webkit-app-region
1035         https://bugs.webkit.org/show_bug.cgi?id=161935
1036
1037         Reviewed by Simon Fraser.
1038
1039         * css/parser/CSSParserFastPaths.cpp:
1040
1041 2016-09-13  Daniel Bates  <dabates@apple.com>
1042
1043         Treat some CSS properties as keyword properties
1044         https://bugs.webkit.org/show_bug.cgi?id=161934
1045
1046         Reviewed by Simon Fraser.
1047
1048         Move validation of the following CSS keyword properties from CSSParser::parseValue() to
1049         WebCore::isValidKeywordPropertyAndValue():
1050
1051         CSSPropertyColumnProgression
1052         CSSPropertyFontStretch
1053         CSSPropertyTextAlign
1054         CSSPropertyUnicodeBidi
1055         CSSPropertyWebkitColumnAxis
1056         CSSPropertyWebkitCursorVisibility
1057         CSSPropertyWebkitTextDecorationStyle
1058         CSSPropertyWebkitTextOrientation
1059         CSSPropertyWebkitTextZoom
1060         CSSPropertyWebkitTouchCallout
1061
1062         Among other benefits, this will make it more straightforward to migrate from CSSParser::is{KeywordPropertyID, ValidKeywordPropertyAndValue}()
1063         to CSSParserFastPaths::is{KeywordPropertyID, ValidKeywordPropertyAndValue}(), respectively.
1064
1065         * css/parser/CSSParser.cpp:
1066         (WebCore::isValidKeywordPropertyAndValue):
1067         (WebCore::isKeywordPropertyID):
1068         (WebCore::CSSParser::parseValue):
1069
1070 2016-09-13  Chris Dumez  <cdumez@apple.com>
1071
1072         Merge Element::ScrollToOptions and DOMWindow::ScrollToOptions
1073         https://bugs.webkit.org/show_bug.cgi?id=161932
1074
1075         Reviewed by Simon Fraser.
1076
1077         Merge Element::ScrollToOptions and DOMWindow::ScrollToOptions.
1078         Ideally we would merge them on IDL side as well but this is for
1079         another patch.
1080
1081         * WebCore.xcodeproj/project.pbxproj:
1082         * bindings/scripts/CodeGeneratorJS.pm:
1083         (GenerateDictionaryImplementationContent):
1084         * bindings/scripts/test/JS/JSTestObj.cpp:
1085         (WebCore::convertDictionary<TestObj::Dictionary>):
1086         (WebCore::convertDictionary<TestObj::DictionaryThatShouldNotTolerateNull>):
1087         (WebCore::convertDictionary<TestObj::DictionaryThatShouldTolerateNull>):
1088         (WebCore::convertDictionary<AlternateDictionaryName>):
1089         * dom/Element.h:
1090         * dom/Element.idl:
1091         * dom/ScrollToOptions.h: Added.
1092         * html/HTMLBodyElement.cpp:
1093         (WebCore::HTMLBodyElement::scrollTo):
1094         * page/DOMWindow.h:
1095         * page/DOMWindow.idl:
1096
1097 2016-09-13  Myles C. Maxfield  <mmaxfield@apple.com>
1098
1099         [Cocoa] Unify font's ascent, descent, and x-height between macOS and iOS
1100         https://bugs.webkit.org/show_bug.cgi?id=161877
1101
1102         Reviewed by Simon Fraser.
1103
1104         macOS and iOS have slightly different handling of ascent, descent, and x-height.
1105         This patch migrates them to have the same handling of them.
1106
1107         There are slight behavior changes here because our previous code converted between
1108         floats and doubles in unnecessary places, and does not handle rounding in
1109         consistent ways. The differences are all miniscule, but nevertheless lead to test
1110         results needing to be updated.
1111
1112         Coincidentally, by performing this unification, there are no longer any places
1113         on macOS Sierra which are using the CGFontRef member of PlatformFontData. This
1114         patch removes the member on that operating system for memory savings as well as
1115         clarity.
1116
1117         Covered by existing tests.
1118
1119         * platform/graphics/FontPlatformData.cpp:
1120         * platform/graphics/FontPlatformData.h:
1121         * platform/graphics/cocoa/FontCocoa.mm:
1122         (WebCore::Font::platformInit):
1123         * platform/graphics/cocoa/FontPlatformDataCocoa.mm:
1124         (WebCore::FontPlatformData::FontPlatformData):
1125         (WebCore::FontPlatformData::platformIsEqual):
1126         (WebCore::FontPlatformData::ctFont):
1127
1128 2016-09-13  Brent Fulgham  <bfulgham@apple.com>
1129
1130         [Win] Unreviewed build fix.
1131
1132         Based on a suggestion by Simon Fraser, I have corrected the
1133         headers to avoid including <d2d1.h> directly, relying instead
1134         on forward declarations.
1135
1136         * platform/graphics/FloatPoint.h:
1137         * platform/graphics/FloatRect.h:
1138         * platform/graphics/FloatSize.h:
1139         * platform/graphics/IntPoint.h:
1140         * platform/graphics/IntRect.h:
1141         * platform/graphics/IntSize.h:
1142         * platform/graphics/transforms/AffineTransform.h:
1143         * platform/graphics/transforms/TransformationMatrix.h:
1144
1145 2016-09-13  Said Abou-Hallawa  <sabouhallawa@apple.com>
1146
1147         Get rid of the m_premultiplyAlpha flag of the ImageFrame class
1148         https://bugs.webkit.org/show_bug.cgi?id=159721
1149
1150         Reviewed by Simon Fraser.
1151
1152         This flag was only needed when calling ImageBackingStore::create() in 
1153         ImageFrame::setSize(). Instead we can pass ImageDecoder::m_premultiplyAlpha 
1154         to ImageFrame::setSize(), which is renamed ImageFrame::initializeBackingStore().
1155         The passed premultiplyAlpha can then be passed to ImageBackingStore::create().
1156
1157         * platform/image-decoders/ImageDecoder.cpp:
1158         (WebCore::ImageFrame::ImageFrame):
1159         (WebCore::ImageFrame::operator=):
1160         (WebCore::ImageFrame::initializeBackingStore):
1161         (WebCore::ImageFrame::copyBitmapData): Deleted.
1162         (WebCore::ImageFrame::setSize): Deleted.
1163         * platform/image-decoders/ImageDecoder.h:
1164         (WebCore::ImageFrame::disposalMethod):
1165         (WebCore::ImageFrame::setDisposalMethod):
1166         (WebCore::ImageDecoder::premultiplyAlpha):
1167         (WebCore::ImageFrame::premultiplyAlpha): Deleted.
1168         (WebCore::ImageFrame::setPremultiplyAlpha): Deleted.
1169         * platform/image-decoders/bmp/BMPImageDecoder.cpp:
1170         (WebCore::BMPImageDecoder::frameBufferAtIndex):
1171         * platform/image-decoders/bmp/BMPImageReader.cpp:
1172         (WebCore::BMPImageReader::decodeBMP):
1173         * platform/image-decoders/gif/GIFImageDecoder.cpp:
1174         (WebCore::GIFImageDecoder::decode):
1175         (WebCore::GIFImageDecoder::initFrameBuffer):
1176         * platform/image-decoders/ico/ICOImageDecoder.cpp:
1177         (WebCore::ICOImageDecoder::frameCount):
1178         * platform/image-decoders/jpeg/JPEGImageDecoder.cpp:
1179         (WebCore::JPEGImageDecoder::frameBufferAtIndex):
1180         (WebCore::JPEGImageDecoder::outputScanlines):
1181         * platform/image-decoders/png/PNGImageDecoder.cpp:
1182         (WebCore::PNGImageDecoder::frameBufferAtIndex):
1183         (WebCore::PNGImageDecoder::rowAvailable):
1184         (WebCore::PNGImageDecoder::readChunks):
1185         (WebCore::PNGImageDecoder::initFrameBuffer):
1186         (WebCore::setPixelRGB): Deleted.
1187         (WebCore::setPixelRGBA): Deleted.
1188         (WebCore::setPixelPremultipliedRGBA): Deleted.
1189         * platform/image-decoders/webp/WEBPImageDecoder.cpp:
1190         (WebCore::WEBPImageDecoder::frameBufferAtIndex):
1191         (WebCore::WEBPImageDecoder::decode):
1192
1193 2016-09-12  Brent Fulgham  <bfulgham@apple.com>
1194
1195         [Win][Direct2D] Provide Direct2D-based geometry and transform cast operations
1196         https://bugs.webkit.org/show_bug.cgi?id=161818
1197
1198         Reviewed by Dean Jackson.
1199
1200         Tested by new TestWebKitAPI tests.
1201
1202         Add new casting operators to and from various Direct2D data types.
1203
1204         * PlatformWin.cmake:
1205         * platform/graphics/FloatPoint.h:
1206         (WebCore::FloatPoint::FloatPoint):
1207         * platform/graphics/FloatRect.h:
1208         * platform/graphics/FloatSize.h:
1209         (WebCore::FloatSize::FloatSize):
1210         * platform/graphics/IntPoint.h:
1211         * platform/graphics/IntRect.h:
1212         * platform/graphics/IntSize.h:
1213         * platform/graphics/transforms/AffineTransform.h:
1214         * platform/graphics/transforms/TransformationMatrix.h:
1215         * platform/graphics/win/FloatPointDirect2D.cpp:
1216         * platform/graphics/win/FloatRectDirect2D.cpp:
1217         * platform/graphics/win/FloatSizeDirect2D.cpp:
1218         * platform/graphics/win/IntPointWin.cpp:
1219         (WebCore::IntPoint::IntPoint):
1220         (WebCore::IntPoint::operator D2D1_POINT_2F):
1221         (WebCore::IntPoint::operator D2D1_POINT_2U):
1222         * platform/graphics/win/IntRectWin.cpp:
1223         (WebCore::IntRect::IntRect):
1224         (WebCore::IntRect::operator D2D1_RECT_F):
1225         (WebCore::IntRect::operator D2D1_RECT_U):
1226         * platform/graphics/win/IntSizeWin.cpp:
1227         (WebCore::IntSize::IntSize):
1228         (WebCore::IntSize::operator D2D1_SIZE_U):
1229         (WebCore::IntSize::operator D2D1_SIZE_F):
1230         * platform/graphics/win/TransformationMatrixDirect2D.cpp: Added.
1231         (WebCore::TransformationMatrix::TransformationMatrix):
1232         (WebCore::TransformationMatrix::operator D2D1_MATRIX_3X2_F):
1233         (WebCore::AffineTransform::AffineTransform):
1234         (WebCore::AffineTransform::operator D2D1_MATRIX_3X2_F):
1235
1236 2016-09-13  Tim Horton  <timothy_horton@apple.com>
1237
1238         Undoing a candidate insertion results in the replaced text being selected
1239         https://bugs.webkit.org/show_bug.cgi?id=161894
1240         <rdar://problem/28225774>
1241
1242         Reviewed by Simon Fraser.
1243
1244         Test: editing/mac/spelling/accept-candidate-undo-does-not-select.html
1245
1246         * WebCore.xcodeproj/project.pbxproj:
1247         * editing/ReplaceRangeWithTextCommand.cpp: Added.
1248         (WebCore::ReplaceRangeWithTextCommand::ReplaceRangeWithTextCommand):
1249         (WebCore::ReplaceRangeWithTextCommand::doApply):
1250         * editing/ReplaceRangeWithTextCommand.h: Added.
1251         (WebCore::ReplaceRangeWithTextCommand::create):
1252         Add a editor command that replaces a range with the given text.
1253
1254         * editing/Editor.cpp:
1255         (WebCore::Editor::rangeForTextCheckingResult):
1256         (WebCore::Editor::handleAcceptedCandidate):
1257         (WebCore::Editor::selectTextCheckingResult): Deleted.
1258         * editing/Editor.h:
1259         Make use of the new editor command to do candidate insertion as a single
1260         composite operation, so that it is undone as a unit. Otherwise, undo ends up
1261         undoing the insertion, but not the selection, and we are left with the old
1262         text, selected, which is undesirable.
1263
1264 2016-09-13  Dave Hyatt  <hyatt@apple.com>
1265
1266         [CSS Parser] Add CSS Variable Parsing support
1267         https://bugs.webkit.org/show_bug.cgi?id=161916
1268
1269         Reviewed by Dean Jackson.
1270
1271         This patch not only adds the parser for CSS variables (from Blink), but it also brings in
1272         all of the data structures used to store variables and custom property declarations. We
1273         will be abandoning our old data structures eventually in favor of these new ones. They
1274         are not significantly different other than operating on the CSSParserTokenRanges rather
1275         than the soon-to-be-removed parser value lists.
1276
1277         * CMakeLists.txt:
1278         * WebCore.xcodeproj/project.pbxproj:
1279         * css/CSSCustomIdentValue.cpp: Added.
1280         (WebCore::CSSCustomIdentValue::CSSCustomIdentValue):
1281         (WebCore::CSSCustomIdentValue::customCSSText):
1282         * css/CSSCustomIdentValue.h: Added.
1283         (WebCore::CSSCustomIdentValue::create):
1284         (WebCore::CSSCustomIdentValue::value):
1285         (WebCore::CSSCustomIdentValue::isKnownPropertyID):
1286         (WebCore::CSSCustomIdentValue::valueAsPropertyID):
1287         (WebCore::CSSCustomIdentValue::equals):
1288         * css/CSSCustomPropertyDeclaration.cpp: Added.
1289         (WebCore::CSSCustomPropertyDeclaration::customCSSText):
1290         * css/CSSCustomPropertyDeclaration.h: Added.
1291         (WebCore::CSSCustomPropertyDeclaration::create):
1292         (WebCore::CSSCustomPropertyDeclaration::name):
1293         (WebCore::CSSCustomPropertyDeclaration::value):
1294         (WebCore::CSSCustomPropertyDeclaration::id):
1295         (WebCore::CSSCustomPropertyDeclaration::equals):
1296         (WebCore::CSSCustomPropertyDeclaration::CSSCustomPropertyDeclaration):
1297         * css/CSSCustomPropertyValue.h:
1298         * css/CSSValue.cpp:
1299         (WebCore::CSSValue::cssText):
1300         (WebCore::CSSValue::destroy):
1301         * css/CSSValue.h:
1302         (WebCore::CSSValue::isCustomPropertyDeclaration):
1303         (WebCore::CSSValue::isCustomIdentValue):
1304         (WebCore::CSSValue::isVariableReferenceValue):
1305         * css/CSSValueKeywords.in:
1306         * css/CSSVariableData.cpp: Added.
1307         (WebCore::CSSVariableData::updateTokens):
1308         (WebCore::CSSVariableData::operator==):
1309         (WebCore::CSSVariableData::consumeAndUpdateTokens):
1310         (WebCore::CSSVariableData::CSSVariableData):
1311         * css/CSSVariableData.h: Added.
1312         (WebCore::CSSVariableData::create):
1313         (WebCore::CSSVariableData::createResolved):
1314         (WebCore::CSSVariableData::tokenRange):
1315         (WebCore::CSSVariableData::tokens):
1316         (WebCore::CSSVariableData::needsVariableResolution):
1317         (WebCore::CSSVariableData::CSSVariableData):
1318         * css/CSSVariableDependentValue.h:
1319         * css/CSSVariableReferenceValue.cpp: Added.
1320         (WebCore::CSSVariableReferenceValue::customCSSText):
1321         * css/CSSVariableReferenceValue.h: Added.
1322         (WebCore::CSSVariableReferenceValue::create):
1323         (WebCore::CSSVariableReferenceValue::variableDataValue):
1324         (WebCore::CSSVariableReferenceValue::equals):
1325         (WebCore::CSSVariableReferenceValue::CSSVariableReferenceValue):
1326         * css/CSSVariableValue.h:
1327         * css/parser/CSSParserImpl.cpp:
1328         (WebCore::filterProperties):
1329         (WebCore::CSSParserImpl::consumeDeclaration):
1330         (WebCore::CSSParserImpl::consumeVariableValue):
1331         * css/parser/CSSVariableParser.cpp: Added.
1332         (WebCore::CSSVariableParser::isValidVariableName):
1333         (WebCore::classifyBlock):
1334         (WebCore::isValidVariableReference):
1335         (WebCore::classifyVariableRange):
1336         (WebCore::CSSVariableParser::containsValidVariableReferences):
1337         (WebCore::CSSVariableParser::parseDeclarationValue):
1338         * css/parser/CSSVariableParser.h: Added.
1339
1340 2016-09-13  Daniel Bates  <dabates@apple.com>
1341
1342         Remove CSS keyword properties from CSSParser::parseValue(CSSPropertyID, bool)
1343         https://bugs.webkit.org/show_bug.cgi?id=161918
1344
1345         Reviewed by Simon Fraser.
1346
1347         CSSParser::parseValue(CSSPropertyID, bool) calls ASSERT_NOT_REACHED() when processing a CSS property
1348         that is known to accept only keyword values as a means to guide a person to add such a CSS property
1349         to the switch block in WebCore::isValidKeywordPropertyAndValue(). In theory this sounds good, but
1350         in practice it does not work out and the list of such properties is stale. We should remove the
1351         case statements for such properties and the maintenance burden they required, which was manual and
1352         error prone. We should think about a better way to enforce that all CSS properties are parsed/validated.
1353
1354         The approach of calling ASSERT_NOT_REACHED is not beneficial to catching coding mistakes because
1355         CSSParser::parseValue() has a default case statement to parse/validate SVG CSS properties and hence
1356         does not allow the C++ compiler to validate that the switch block covers all CSSPropertyIDs.
1357
1358         * css/parser/CSSParser.cpp:
1359         (WebCore::CSSParser::parseValue):
1360
1361 2016-09-13  Daniel Bates  <dabates@apple.com>
1362
1363         Organize CSS keyword properties in WebCore::isKeywordPropertyID()
1364         https://bugs.webkit.org/show_bug.cgi?id=161917
1365
1366         Reviewed by Simon Fraser.
1367
1368         Group and sort compile-time feature keywords and move them to the end of the switch block
1369         to avoid the distraction of preprocessor statements scattered throughout the list. Sort
1370         all the other keyword properties to make it straightforward to find a property by name.
1371
1372         * css/parser/CSSParser.cpp:
1373         (WebCore::isKeywordPropertyID):
1374
1375 2016-09-13  Nan Wang  <n_wang@apple.com>
1376
1377         AX: Crash at AccessibilityRenderObject::computeAccessibilityIsIgnored const  + 552
1378         https://bugs.webkit.org/show_bug.cgi?id=161276
1379
1380         Reviewed by Chris Fleizach.
1381
1382         Sometimes when calling JavaScript removeChild or setAttribute on a node, it seems like
1383         the renderer is deallocated during the process of computeAccessibilityIsIgnored. It's 
1384         causing a crash when we are accessing the renderer after that. Since RenderObject is not ref
1385         counted and we cannot hold onto it for the duration of the function, fixed it by adding
1386         more nil checks.
1387
1388         Despite my best efforts, I couldn't make a layout test that destroys the renderer within
1389         the computeAccessibilityIsIgnored function. 
1390
1391         * accessibility/AccessibilityRenderObject.cpp:
1392         (WebCore::AccessibilityRenderObject::computeAccessibilityIsIgnored):
1393
1394 2016-09-12  Jer Noble  <jer.noble@apple.com>
1395
1396         Media-source backed elements block load event; cause web-platform-test flakiness
1397         https://bugs.webkit.org/show_bug.cgi?id=161881
1398
1399         Reviewed by Eric Carlson.
1400
1401         Test: media/media-source/media-source-delaying-load-event.html
1402
1403         The MSE specification has added an explicit step to their "attaching to media element"
1404         algorithm which tells the media element to stop delaying the load event. And indeed,
1405         the HTMLMediaElement blocks the load event when a MediaSource is attached but its data
1406         is never loaded.
1407
1408         * Modules/mediasource/MediaSource.cpp:
1409         (WebCore::MediaSource::setPrivateAndOpen):
1410         * html/HTMLMediaElement.h:
1411
1412 2016-09-12  Zalan Bujtas  <zalan@apple.com>
1413
1414         Input type object and the associated render can go out of sync.
1415         https://bugs.webkit.org/show_bug.cgi?id=161871
1416         <rdar://problem/28178094>
1417
1418         Reviewed by Antti Koivisto.
1419
1420         Bail out when we've got a mismatched renderer.
1421
1422         Test: fast/forms/assert-on-input-type-change.html
1423
1424         * html/ImageInputType.cpp:
1425         (WebCore::ImageInputType::altAttributeChanged):
1426
1427 2016-09-13  Carlos Garcia Campos  <cgarcia@igalia.com>
1428
1429         [GTK] Get rid of DataObjectGtk::forClipboard and cleanup pasteboard code
1430         https://bugs.webkit.org/show_bug.cgi?id=161907
1431
1432         Reviewed by Michael Catanzaro.
1433
1434         We don't really need to keep a DataObjectGtk for every clipboard, we could simply pass the DataObjectGtk to read
1435         and write methods of PasteboardHelper.
1436
1437         * editing/gtk/EditorGtk.cpp:
1438         (WebCore::createFragmentFromPasteboardData): Update for DataObjectGtk API changes.
1439         * platform/Pasteboard.h:
1440         * platform/gtk/DataObjectGtk.cpp: Remove forClipboard() static method.
1441         * platform/gtk/DataObjectGtk.h: Ditto.
1442         * platform/gtk/PasteboardGtk.cpp:
1443         (WebCore::Pasteboard::Pasteboard): Always create a new DataObjectGtk.
1444         (WebCore::Pasteboard::dataObject): Return a const reference instead of a pointer.
1445         (WebCore::Pasteboard::writePlainText): Pass the DataObjectGtk to PasteboardHelper.
1446         (WebCore::Pasteboard::write): Ditto.
1447         (WebCore::Pasteboard::writePasteboard): Ditto.
1448         (WebCore::Pasteboard::clear): Ditto.
1449         (WebCore::Pasteboard::read): Ditto.
1450         (WebCore::Pasteboard::hasData): Ditto.
1451         (WebCore::Pasteboard::types): Ditto.
1452         (WebCore::Pasteboard::readString): Ditto.
1453         (WebCore::Pasteboard::readFilenames): Ditto.
1454         * platform/gtk/PasteboardHelper.cpp:
1455         (WebCore::PasteboardHelper::getClipboardContents): Update the given DataObjectGtk.
1456         (WebCore::PasteboardHelper::fillSelectionData): Use a const reference to DataObjectGtk instead of a pointer.
1457         (WebCore::PasteboardHelper::targetListForDataObject): Ditto.
1458         (WebCore::PasteboardHelper::fillDataObjectFromDropData): Use a reference to DataObjectGtk instead of a pointer.
1459         (WebCore::ClipboardSetData::ClipboardSetData): Helper struct to pass DataObjectGtk and callback to clipboard callbacks.
1460         (WebCore::ClipboardSetData::~ClipboardSetData):
1461         (WebCore::getClipboardContentsCallback): Get the DataObjectGtk from ClipboardSetData struct passed as user data.
1462         (WebCore::clearClipboardContentsCallback): Get the DataObjectGtk and callback from ClipboardSetData struct
1463         passed as user data.
1464         (WebCore::PasteboardHelper::writeClipboardContents): Write the given DataObjectGtk.
1465         * platform/gtk/PasteboardHelper.h:
1466
1467 2016-09-13  Chris Dumez  <cdumez@apple.com>
1468
1469         Drop support for <isindex>
1470         https://bugs.webkit.org/show_bug.cgi?id=7139
1471
1472         Reviewed by Ryosuke Niwa.
1473
1474         Drop support for <isindex> and <input name=isindex>. Those are no longer
1475         in the HTML specification and Chrome / Edge have already dropped their
1476         support. Firefox is also planning on dropping this.
1477
1478         Test: imported/w3c/web-platform-tests/html/semantics/forms/historical.html
1479
1480         * css/StyleResolver.cpp:
1481         (WebCore::elementTypeHasAppearanceFromUAStyle):
1482         * css/html.css:
1483         (input, textarea, keygen, select, button, meter, progress):
1484         (input, textarea, keygen, select, button):
1485         (#if defined(WTF_PLATFORM_IOS) && WTF_PLATFORM_IOS):
1486         (input::placeholder):
1487         (input:focus, textarea:focus, keygen:focus, select:focus):
1488         * dom/Element.cpp:
1489         (WebCore::Element::ieForbidsInsertHTML):
1490         * html/HTMLInputElement.cpp:
1491         (WebCore::HTMLInputElement::HTMLInputElement):
1492         * html/HTMLTagNames.in:
1493         * html/parser/HTMLStackItem.h:
1494         (WebCore::isSpecialNode):
1495         * html/parser/HTMLTreeBuilder.cpp:
1496         (WebCore::HTMLTreeBuilder::processStartTagForInBody):
1497         (WebCore::HTMLTreeBuilder::processCloseWhenNestedTag): Deleted.
1498         (WebCore::createCaseMap): Deleted.
1499         * html/parser/HTMLTreeBuilder.h:
1500         * platform/network/FormData.cpp:
1501         (WebCore::FormData::appendKeyValuePairItems):
1502
1503 2016-09-12  Per Arne Vollan  <pvollan@apple.com>
1504
1505         [Win] Warning fix.
1506         https://bugs.webkit.org/show_bug.cgi?id=161858
1507
1508         Reviewed by Brent Fulgham.
1509
1510         Use exported constants from CoreText.dll, instead of creating copies.
1511
1512         * PlatformAppleWin.cmake:
1513         * platform/spi/win/CoreTextSPIWin.cpp: Removed.
1514         * platform/spi/win/CoreTextSPIWin.h:
1515
1516 2016-09-12  Youenn Fablet  <youenn@apple.com>
1517
1518         ScriptElement should use FetchOptions::mode according its crossOrigin attribute
1519         https://bugs.webkit.org/show_bug.cgi?id=161686
1520
1521         Reviewed by Darin Adler.
1522
1523         Setting ScriptElement fetch mode according its crossOrigin attribute.
1524         Removing LoadableClassicScriptchecking of CORS since this is now done at ResourceLoader/CachedResource level.
1525
1526         Updating CachedResourceLoader to ensure that a resource that matches an on-going resource load but with different fetch mode/origin,
1527         always gets its loading started if the resource state is not Cached.
1528
1529         Tests: fast/dom/script-crossorigin-loads-fail-origin.html
1530                http/tests/security/cross-origin-cached-images-parallel.html
1531                http/tests/security/cross-origin-cached-images.html
1532                http/tests/security/cross-origin-cached-scripts-parallel.html
1533                http/tests/security/cross-origin-cached-scripts.html
1534                http/tests/security/script-crossorigin-loads-correctly-credentials.html
1535                http/tests/security/script-with-dataurl.html
1536
1537         * dom/LoadableClassicScript.cpp:
1538         (WebCore::LoadableClassicScript::create):
1539         (WebCore::LoadableClassicScript::notifyFinished): Checking CORS failures using the resource state.
1540         (WebCore::LoadableClassicScript::~LoadableClassicScript): Deleted.
1541         (WebCore::LoadableClassicScript::isLoaded): Deleted.
1542         * dom/LoadableClassicScript.h:
1543         * dom/ScriptElement.cpp:
1544         (WebCore::ScriptElement::requestClassicScript):
1545         (WebCore::ScriptElement::requestScriptWithCache): Using CachedResourceRequest::setAsPotentiallyCrossOrigin to set fetch mode according crossOrigin attribute.
1546         * dom/ScriptElement.h:
1547         * loader/cache/CachedImage.cpp:
1548         (WebCore::CachedImage::setBodyDataFrom):
1549         * loader/cache/CachedResourceLoader.cpp:
1550         (WebCore::CachedResourceLoader::updateCachedResourceWithCurrentRequest): Adding support for script resources.
1551         (WebCore::CachedResourceLoader::requestResource): Ensuring that 'updated' resources gets actually loaded.
1552         * loader/cache/CachedScript.cpp:
1553         (WebCore::CachedScript::setBodyDataFrom): Implementing specific data copy from another CachedScript.
1554         * loader/cache/CachedScript.h:
1555
1556 2016-09-12  Carlos Garcia Campos  <cgarcia@igalia.com>
1557
1558         [GTK] Scrollbar  too large
1559         https://bugs.webkit.org/show_bug.cgi?id=161735
1560
1561         Reviewed by Michael Catanzaro.
1562
1563         We were not calculating the total scrollbar size correctly when the theme defines a minimum width/height. In
1564         that case we need to take the extra size into account (border, margin, padding), but not adding the minimum
1565         size. We were also adjusting the thumb position when rendering in indicator mode, but we really need to adjust
1566         the whole rectangle. This worked in Adwaita because it uses a transparent track when in indicator mode. We are
1567         also now taking into account the text direction when doing this adjustment for the indicator mode.
1568
1569         * platform/gtk/ScrollbarThemeGtk.cpp:
1570         (WebCore::ScrollbarThemeGtk::paint):
1571         (WebCore::ScrollbarThemeGtk::scrollbarThickness):
1572
1573 2016-09-12  Carlos Garcia Campos  <cgarcia@igalia.com>
1574
1575         [GTK] Crash of WebProcess on the last WebView disconnect (take two)
1576         https://bugs.webkit.org/show_bug.cgi?id=161842
1577
1578         Reviewed by Michael Catanzaro.
1579
1580         The problem is that when PlatformDisplayX11 is destroyed, the sharing GL context is deleted and its destructor
1581         makes a downcast of PlatformDisplay to get the native X11 display. We could simply keep a pointer to the native
1582         X11 display in GLContextGLX, got at construction time from the PlatformDisplay, and ensure the sharing GL
1583         context is deleted before the native X11 display is closed.
1584
1585         * platform/graphics/PlatformDisplay.h: Make m_sharingGLContext protected.
1586         * platform/graphics/glx/GLContextGLX.cpp:
1587         (WebCore::GLContextGLX::GLContextGLX): Initialize m_x11Display.
1588         (WebCore::GLContextGLX::~GLContextGLX): Use m_x11Display and remove confusing comment about possible crash with
1589         nviedia closed drivers.
1590         (WebCore::GLContextGLX::defaultFrameBufferSize): Use m_x11Display.
1591         (WebCore::GLContextGLX::makeContextCurrent): Ditto.
1592         (WebCore::GLContextGLX::swapBuffers): Ditto.
1593         (WebCore::GLContextGLX::swapInterval): Ditto.
1594         (WebCore::GLContextGLX::cairoDevice): Ditto.
1595         * platform/graphics/glx/GLContextGLX.h:
1596         * platform/graphics/x11/PlatformDisplayX11.cpp:
1597         (WebCore::PlatformDisplayX11::~PlatformDisplayX11): Delete the sharing GL context before closing the display.
1598
1599 2016-09-12  Chris Dumez  <cdumez@apple.com>
1600
1601         Fix post-landing review comments after r205787
1602         https://bugs.webkit.org/show_bug.cgi?id=161885
1603
1604         Reviewed by Darin Adler.
1605
1606         Leverage new StringBuilder::append(CFStringRef) overload.
1607
1608         * html/parser/HTMLParserIdioms.cpp:
1609         (WebCore::parseHTTPRefreshInternal):
1610         * page/CaptionUserPreferencesMediaAF.cpp:
1611         (WebCore::CaptionUserPreferencesMediaAF::captionsDefaultFontCSS):
1612         (WebCore::buildDisplayStringForTrackBase):
1613         * platform/network/mac/CookieJarMac.mm:
1614         (WebCore::cookiesForSession):
1615         * rendering/RenderThemeIOS.mm:
1616         (WebCore::RenderThemeIOS::mediaControlsStyleSheet):
1617         (WebCore::RenderThemeIOS::mediaControlsScript):
1618         * rendering/RenderThemeMac.mm:
1619         (WebCore::RenderThemeMac::mediaControlsStyleSheet):
1620         (WebCore::RenderThemeMac::mediaControlsScript):
1621
1622 2016-09-12  Alex Christensen  <achristensen@webkit.org>
1623
1624         URLParser: Correctly ignore spaces before relative URLs with no scheme
1625         https://bugs.webkit.org/show_bug.cgi?id=161889
1626
1627         Reviewed by Daniel Bates.
1628
1629         Covered by new API tests.
1630
1631         * platform/URLParser.cpp:
1632         (WebCore::URLParser::parse):
1633
1634 2016-09-12  Nan Wang  <n_wang@apple.com>
1635
1636         AX: Crash at WebCore::Range::compareBoundaryPoints(WebCore::Range::CompareHow, WebCore::Range const&, int&) const + 23
1637         https://bugs.webkit.org/show_bug.cgi?id=161878
1638
1639         Reviewed by Chris Fleizach.
1640
1641         In function characterOffsetsInOrder(const CharacterOffset&, const CharacterOffset&), we are creating two
1642         ranges based on the nodes that are associated to the passed in CharacterOffsets. When the first node is a doctype
1643         node, the first range will be a nullptr, and dereferencing it leads to a crash. Fixed this by adding a 
1644         NULL check.
1645
1646         Test: accessibility/mac/doctype-node-in-text-marker-crash.html
1647
1648         * accessibility/AXObjectCache.cpp:
1649         (WebCore::characterOffsetsInOrder):
1650         (WebCore::resetNodeAndOffsetForReplacedNode):
1651
1652 2016-09-12  Said Abou-Hallawa  <sabouhallawa@apple.com>
1653
1654         Move the pixel data of ImageFrame to a separate class named ImageBackingStore
1655         https://bugs.webkit.org/show_bug.cgi?id=159679
1656
1657         Reviewed by Simon Fraser.
1658
1659         Move the pixel data manipulation part in ImageFrame into a separate class
1660         and allocate it on demand.
1661
1662         * PlatformEfl.cmake:
1663         * PlatformGTK.cmake:
1664         * PlatformWinCairo.cmake:
1665         * WebCore.xcodeproj/project.pbxproj:
1666         Add ImageBackingStoreCairo.cpp and remove ImageDecoderCairo.cpp from the
1667         WebKit projects.
1668
1669         * platform/graphics/Color.cpp:
1670         (WebCore::premultipliedChannel): channel = channel * alpha / 255.
1671         (WebCore::unpremultipliedChannel): channel = channel * 255 / alpha.
1672         (WebCore::makePremultipliedRGBA): Un-premultiplied channels to premultiplied RGBA32.
1673         (WebCore::makeUnPremultipliedRGBA): Premultiplied channels to un-premultiplied RGBA32.
1674         (WebCore::colorFromPremultipliedARGB): Use makeUnPremultipliedRGBA.
1675         (WebCore::premultipliedARGBFromColor): Use makePremultipliedRGBA.
1676         * platform/graphics/Color.h:
1677         (WebCore::fastMultiplyBy255): x * 255 = x * 256 - x = x << 8 - x.
1678
1679         * platform/graphics/ImageBackingStore.h: Added.
1680         (WebCore::ImageBackingStore::create): Creates a new ImageBackingStore.
1681         (WebCore::ImageBackingStore::setSize): Changes the pixels size.
1682         (WebCore::ImageBackingStore::setFrameRect): This will always just be the entire buffer except for GIF and PNG frames.
1683         (WebCore::ImageBackingStore::size): Returns the pixels size.
1684         (WebCore::ImageBackingStore::frameRect): Returns the pixels frame rectangle.
1685         (WebCore::ImageBackingStore::clear): Clears the entire image.
1686         (WebCore::ImageBackingStore::clearRect): Clears a rectangle in the image.
1687         (WebCore::ImageBackingStore::repeatFirstRow): Repeats the first row in a rectangle in the image.
1688         (WebCore::ImageBackingStore::pixelAt): Returns a pointer to a pixel data.
1689         (WebCore::ImageBackingStore::setPixel): Sets the color of a pixel in the image.
1690         (WebCore::ImageBackingStore::blendPixel): Blend a color with a pixel in the image.
1691         (WebCore::ImageBackingStore::inBounds): Checks if a rectangle is in the bounds of the image.
1692         (WebCore::ImageBackingStore::isOverSize): Checks whether a size could not be allocated for an image.
1693         (WebCore::ImageBackingStore::ImageBackingStore):
1694
1695         * platform/graphics/cg/NativeImageCG.cpp:
1696         (WebCore::nativeImageHasAlpha): Implement this function. See comments in https://bugs.webkit.org/show_bug.cgi?id=158684.
1697
1698         * platform/image-decoders/ImageDecoder.cpp:
1699         (WebCore::ImageFrame::operator=): copyBitmapData() now copies the frameRect of the ImageBackingStore.
1700         (WebCore::ImageFrame::clearPixelData): The pixels data and the pointer to these pixels are now included in the ImageBackingStore.
1701         (WebCore::ImageFrame::zeroFillPixelData): Clearing the image pixels are now in ImageBackingStore::clear().
1702         (WebCore::ImageFrame::zeroFillFrameRect): Clearing the image pixels are now in ImageBackingStore::clearRect().
1703         (WebCore::ImageFrame::copyBitmapData): We either need to create a new ImageBackingStore or nullify the current one.
1704         (WebCore::ImageFrame::setSize): ImageFrame::setSize() is supposed to be called once and to create the ImageBackingStore.
1705         (WebCore::ImageFrame::setOriginalFrameRect): Delegate this call to ImageBackingStore::setFrameRect().
1706         (WebCore::ImageDecoder::frameBytesAtIndex): ImageFrame::PixelData can be replaced by RGBA32.
1707
1708         * platform/image-decoders/ImageDecoder.h:
1709         (WebCore::ImageFrame::copyRowNTimes): The implementation was moved to ImageBackingStore::repeatFirstRow().
1710         (WebCore::ImageFrame::size): Gets the size of an image from its ImageBackingStore.
1711         (WebCore::ImageFrame::asNewNativeImage): Gets a NtaiveImagePtr from the ImageBackingStore.
1712         (WebCore::ImageFrame::backingStore): Returns a raw pointer to the ImageBackingStore.
1713         (WebCore::ImageFrame::hasBackingStore): Returns whether the ImageFrame has an ImageBackingStore.
1714         (WebCore::ImageFrame::originalFrameRect): Returns the frameRect of the image from its ImageBackingStore.
1715         (WebCore::ImageFrame::pixelAt): Delegates the call to the ImageBackingStore.
1716         (WebCore::ImageFrame::setPixel): Delegates the call to the ImageBackingStore.
1717         (WebCore::ImageFrame::blendPixel): Delegates the call to the ImageBackingStore.
1718         
1719         (WebCore::ImageDecoder::setSize): setSize() now takes an IntSize.
1720         (WebCore::ImageFrame::setOriginalFrameRect): Deleted. Moved to ImageDecoder.cpp.
1721         (WebCore::ImageFrame::setRGBA): Deleted. Renamed to ImageFrame::setPixel().
1722         (WebCore::ImageFrame::getAddr): Deleted. Renamed to ImageFrame::pixelAt().
1723         (WebCore::ImageFrame::hasPixelData): Deleted. Renamed to ImageFrame::hasBackingStore().
1724         (WebCore::ImageFrame::fixPointUnsignedMultiply): Deleted.
1725         (WebCore::ImageFrame::divide255): Deleted. Replaced by fastDivideBy255() from Color.h.
1726         (WebCore::ImageFrame::overRGBA): Deleted. Renamed to ImageFrame::blendPixel().
1727         (WebCore::ImageFrame::width): Deleted.
1728         (WebCore::ImageFrame::height): Deleted.
1729         (WebCore::ImageDecoder::isOverSize): Deleted. Moved to ImageBackingStore::isOverSize().
1730
1731         * platform/image-decoders/bmp/BMPImageReader.cpp:
1732         (WebCore::BMPImageReader::decodeBMP):
1733         (WebCore::BMPImageReader::processInfoHeader):
1734         (WebCore::BMPImageReader::processNonRLEData):
1735         * platform/image-decoders/bmp/BMPImageReader.h:
1736         (WebCore::BMPImageReader::setI):
1737         (WebCore::BMPImageReader::setPixel):
1738         (WebCore::BMPImageReader::fillRGBA):
1739         (WebCore::BMPImageReader::setRGBA): Deleted.
1740         * platform/image-decoders/cairo/ImageBackingStoreCairo.cpp: Added.
1741         (WebCore::ImageBackingStore::image):
1742         * platform/image-decoders/cairo/ImageDecoderCairo.cpp: Removed.
1743         * platform/image-decoders/gif/GIFImageDecoder.cpp:
1744         (WebCore::GIFImageDecoder::setSize):
1745         (WebCore::GIFImageDecoder::haveDecodedRow):
1746         (WebCore::GIFImageDecoder::initFrameBuffer):
1747         * platform/image-decoders/gif/GIFImageDecoder.h:
1748         * platform/image-decoders/gif/GIFImageReader.cpp:
1749         (GIFImageReader::parse):
1750         * platform/image-decoders/ico/ICOImageDecoder.cpp:
1751         (WebCore::ICOImageDecoder::setSize):
1752         (WebCore::ICOImageDecoder::processDirectoryEntries):
1753         * platform/image-decoders/ico/ICOImageDecoder.h:
1754         * platform/image-decoders/jpeg/JPEGImageDecoder.cpp:
1755         (WebCore::JPEGImageReader::decode):
1756         (WebCore::JPEGImageDecoder::setSize):
1757         (WebCore::setPixel):
1758         (WebCore::JPEGImageDecoder::outputScanlines):
1759         * platform/image-decoders/jpeg/JPEGImageDecoder.h:
1760         * platform/image-decoders/png/PNGImageDecoder.cpp:
1761         (WebCore::PNGImageDecoder::setSize):
1762         (WebCore::PNGImageDecoder::headerAvailable):
1763         (WebCore::setPixelRGB):
1764         (WebCore::setPixelRGBA):
1765         (WebCore::setPixelPremultipliedRGBA):
1766         (WebCore::PNGImageDecoder::rowAvailable):
1767         (WebCore::PNGImageDecoder::initFrameBuffer):
1768         (WebCore::PNGImageDecoder::frameComplete):
1769         * platform/image-decoders/png/PNGImageDecoder.h:
1770         * platform/image-decoders/webp/WEBPImageDecoder.cpp:
1771         (WebCore::WEBPImageDecoder::decode):
1772         - Send an IntSize to ImageFrame::setSize() and ImageDecoder::setSize().
1773         - Replace ImageFrame::PixelData by RGBA32.
1774         - No need to call ImageFrame::setOriginalFrameRect() if this sets the
1775           frameRect to the entire image rectangle since this is done by default
1776           in ImageBackingStore::setSize().
1777         - ImageBackingStore::image() now replaces ImageFrame::asNewNativeImage().
1778         - ImageFrame::setPixel() now replaces ImageFrame::setRGBA().
1779         - ImageFrame::blendPixel() now replaces ImageFrame::overRGBA().
1780         - ImageFrame::pixelAt() now replaces ImageFrame::getAddr().
1781
1782 2016-09-12  Joseph Pecoraro  <pecoraro@apple.com>
1783
1784         HTMLButtonElement.prototype.click should be HTMLElement.prototype.click
1785         https://bugs.webkit.org/show_bug.cgi?id=161874
1786
1787         Reviewed by Chris Dumez.
1788
1789         Test: fast/dom/HTMLButtonElement/click.html
1790
1791         * html/HTMLButtonElement.idl:
1792         Remove the unnecessary 'click' definition. It already exists in HTMLElement.
1793         If this was needed for ObjC code generation on DOMHTMLButtonElement, then
1794         the extra definition is no longer needed now that ObjC bindings have moved.
1795
1796 2016-09-12  Alex Christensen  <achristensen@webkit.org>
1797
1798         URLParser: Fix relative URLs containing only fragments
1799         https://bugs.webkit.org/show_bug.cgi?id=161882
1800
1801         Reviewed by Brady Eidson.
1802
1803         Covered by new API tests.
1804
1805         * platform/URLParser.cpp:
1806         (WebCore::URLParser::parse):
1807
1808 2016-09-12  Alex Christensen  <achristensen@webkit.org>
1809
1810         URLParser: Correctly handle relative URLs that are just a scheme and a colon
1811         https://bugs.webkit.org/show_bug.cgi?id=161876
1812
1813         Reviewed by Brady Eidson.
1814
1815         Covered by new API tests.
1816
1817         * platform/URLParser.cpp:
1818         (WebCore::URLParser::parse):
1819
1820 2016-09-12  Dean Jackson  <dino@apple.com>
1821
1822         Remove OptionalColor
1823         https://bugs.webkit.org/show_bug.cgi?id=161853
1824         <rdar://problem/28252385>
1825
1826         Reviewed by Alex Christensen.
1827
1828         OptionalColor isn't used. The concept will be implemented
1829         in a different manner.
1830
1831         * platform/graphics/Color.h:
1832
1833 2016-09-12  Simon Fraser  <simon.fraser@apple.com>
1834
1835         Add Intersection Observer to the features.json file.
1836
1837         * features.json:
1838
1839 2016-09-12  Myles C. Maxfield  <mmaxfield@apple.com>
1840
1841         [Cocoa] Reduce uses of CGFonts in favor of CTFonts
1842         https://bugs.webkit.org/show_bug.cgi?id=161809
1843
1844         Reviewed by Daniel Bates.
1845
1846         Eventually, we want to remove the cgFont() member of PlatformFontData for both memory
1847         savings and conceptual clarity. Because there is no performance loss from moving from
1848         CGFontGetGlyphsForUnichars() to CTFontGetGlyphsForCharacters(), making this switch
1849         gets us closer to reducing the uses of cgFont().
1850
1851         No new tests because there is no behavior change.
1852
1853         * platform/graphics/Font.cpp:
1854         (WebCore::createAndFillGlyphPage):
1855         * platform/graphics/GlyphPage.h:
1856         (WebCore::GlyphData::GlyphData):
1857         * platform/graphics/mac/GlyphPageMac.cpp:
1858         (WebCore::shouldFillWithVerticalGlyphs):
1859         (WebCore::GlyphPage::fill):
1860         (WebCore::shouldUseCoreText): Deleted.
1861
1862 2016-09-12  Alex Christensen  <achristensen@webkit.org>
1863
1864         Remove trailing control characters and spaces before parsing a URL
1865         https://bugs.webkit.org/show_bug.cgi?id=161870
1866
1867         Reviewed by Tim Horton.
1868
1869         Covered by new API tests.
1870
1871         * platform/URLParser.cpp:
1872         (WebCore::bufferView):
1873         (WebCore::URLParser::parse):
1874
1875 2016-09-12  Chris Dumez  <cdumez@apple.com>
1876
1877         window.performance object resets script-applied properties
1878         https://bugs.webkit.org/show_bug.cgi?id=137407
1879
1880         Reviewed by Darin Adler.
1881
1882         Make sure the window.performance wrapper stays alive for as long as the
1883         associated frame, similarly to what we do for window.screen.
1884
1885         Test: fast/performance/performance-object-gc.html
1886
1887         * page/Performance.idl:
1888
1889 2016-09-12  Saam Barati  <sbarati@apple.com>
1890
1891         Add WebKit support for an option in Safari's debug menu similar to "Get Bytecode Profile" but for the Sampling Profiler's data
1892         https://bugs.webkit.org/show_bug.cgi?id=161785
1893
1894         Reviewed by Tim Horton.
1895
1896         * ForwardingHeaders/runtime/SamplingProfiler.h: Added.
1897
1898 2016-09-12  Dave Hyatt  <hyatt@apple.com>
1899
1900         [CSS Parser] Add support for the parsing of the HTML sizes attribute
1901         https://bugs.webkit.org/show_bug.cgi?id=161868
1902
1903         Reviewed by Dean Jackson.
1904
1905         This patch adds the parsers for the sizes attribute. This code is heavily modified
1906         from Blink, and it really only makes use of the tokenization/parsing code. What is done
1907         with the results involves the same original code that we used over in SourceSizeList.cpp.
1908
1909         * CMakeLists.txt:
1910         * WebCore.xcodeproj/project.pbxproj:
1911         * css/parser/SizesAttributeParser.cpp: Added.
1912         (WebCore::SizesAttributeParser::computeLength):
1913         (WebCore::SizesAttributeParser::SizesAttributeParser):
1914         (WebCore::SizesAttributeParser::length):
1915         (WebCore::SizesAttributeParser::calculateLengthInPixels):
1916         (WebCore::SizesAttributeParser::mediaConditionMatches):
1917         (WebCore::SizesAttributeParser::parse):
1918         (WebCore::SizesAttributeParser::effectiveSize):
1919         (WebCore::SizesAttributeParser::effectiveSizeDefaultValue):
1920         * css/parser/SizesAttributeParser.h: Added.
1921         * css/parser/SizesCalcParser.cpp: Added.
1922         (WebCore::SizesCalcParser::SizesCalcParser):
1923         (WebCore::SizesCalcParser::result):
1924         (WebCore::operatorPriority):
1925         (WebCore::SizesCalcParser::handleOperator):
1926         (WebCore::SizesCalcParser::appendNumber):
1927         (WebCore::SizesCalcParser::appendLength):
1928         (WebCore::SizesCalcParser::appendOperator):
1929         (WebCore::SizesCalcParser::calcToReversePolishNotation):
1930         (WebCore::operateOnStack):
1931         (WebCore::SizesCalcParser::calculate):
1932         * css/parser/SizesCalcParser.h: Added.
1933         (WebCore::SizesCalcValue::SizesCalcValue):
1934         (WebCore::SizesCalcParser::isValid):
1935
1936 2016-09-12  Jer Noble  <jer.noble@apple.com>
1937
1938         Fix failing mediasource-play.html and mediasource-config-change-mp4-v-bitrate.html tests
1939         https://bugs.webkit.org/show_bug.cgi?id=161819
1940
1941         Reviewed by Eric Carlson.
1942
1943         Fixes tests: imported/w3c/web-platform-tests/media-source/mediasource-play.html
1944                      imported/w3c/web-platform-tests/media-source/mediasource-sourcebuffer-mode.html
1945
1946         The newest revision of the web-platform-test suite for Media Source tests new behavior
1947         added to the MSE specification. Specifically, setting a MediaSource's duration will no
1948         longer implicitly truncate the source's active SourceBuffer objects.
1949
1950         * Modules/mediasource/MediaSource.cpp:
1951         (WebCore::MediaSource::setDuration): Return exception if issued by setDurationInternal.
1952         (WebCore::MediaSource::setDurationInternal): Bring "duration change" algorithm up to spec.
1953         * Modules/mediasource/MediaSource.h:
1954         * Modules/mediasource/SampleMap.h:
1955         (WebCore::PresentationOrderSampleMap::begin): Add const accessor.
1956         (WebCore::PresentationOrderSampleMap::end): Ditto.
1957         (WebCore::PresentationOrderSampleMap::rbegin): Ditto.
1958         (WebCore::PresentationOrderSampleMap::rend): DItto.
1959         (WebCore::DecodeOrderSampleMap::begin): Ditto.
1960         (WebCore::DecodeOrderSampleMap::end): Ditto.
1961         (WebCore::DecodeOrderSampleMap::rbegin): Ditto.
1962         (WebCore::DecodeOrderSampleMap::rend): Ditto.
1963         * Modules/mediasource/SourceBuffer.cpp:
1964         (WebCore::SourceBuffer::highestPresentationTimestamp): Added convenience method.
1965         (WebCore::SourceBuffer::removeCodedFrames): Drive-by fix; use .values() rather than
1966             pulling the value out of each HashMap iterator.
1967         * Modules/mediasource/SourceBuffer.h:
1968
1969 2016-09-12  Chris Dumez  <cdumez@apple.com>
1970
1971         Switch remaining users of Document::inPageCache() to pageCacheState()
1972         https://bugs.webkit.org/show_bug.cgi?id=161865
1973
1974         Reviewed by Darin Adler.
1975
1976         Switch remaining users of Document::inPageCache() to pageCacheState() as
1977         the former one is confusing (given that it returns true while the
1978         pagehide event is being fired).
1979
1980         * dom/Document.cpp:
1981         (WebCore::Document::scheduleStyleRecalc):
1982         (WebCore::Document::fontsNeedUpdate):
1983         (WebCore::Document::removeFocusedNodeOfSubtree):
1984         (WebCore::Document::setFocusedElement):
1985         (WebCore::Document::takeDOMWindowFrom):
1986         (WebCore::Document::topDocument):
1987         (WebCore::Document::webkitWillEnterFullScreenForElement):
1988         (WebCore::Document::webkitDidEnterFullScreenForElement):
1989         (WebCore::Document::webkitWillExitFullScreenForElement):
1990         (WebCore::Document::webkitDidExitFullScreenForElement):
1991         * dom/Document.h:
1992         (WebCore::Document::needsStyleRecalc):
1993         (WebCore::Document::inPageCache): Deleted.
1994         * history/CachedFrame.cpp:
1995         (WebCore::CachedFrame::CachedFrame):
1996         (WebCore::CachedFrame::clear):
1997         (WebCore::CachedFrame::destroy):
1998         * html/HTMLMediaElement.cpp:
1999         (WebCore::mediaElementIsAllowedToAutoplay):
2000         * html/HTMLPlugInImageElement.cpp:
2001         (WebCore::HTMLPlugInImageElement::createElementRenderer):
2002         * loader/DocumentLoader.cpp:
2003         (WebCore::DocumentLoader::addSubresourceLoader):
2004         * loader/HistoryController.cpp:
2005         (WebCore::HistoryController::saveScrollPositionAndViewStateToItem):
2006         * page/DOMWindow.cpp:
2007         (WebCore::DOMWindow::decrementScrollEventListenersCount):
2008         * page/FrameView.cpp:
2009         (WebCore::FrameView::layout):
2010         * page/animation/AnimationBase.cpp:
2011         (WebCore::AnimationBase::setNeedsStyleRecalc):
2012         * page/animation/AnimationController.cpp:
2013         (WebCore::AnimationControllerPrivate::updateAnimations):
2014         (WebCore::AnimationControllerPrivate::addElementChangeToDispatch):
2015         (WebCore::AnimationController::cancelAnimations):
2016         (WebCore::AnimationController::updateAnimations):
2017         * page/animation/ImplicitAnimation.cpp:
2018         (WebCore::ImplicitAnimation::sendTransitionEvent):
2019         * page/animation/KeyframeAnimation.cpp:
2020         (WebCore::KeyframeAnimation::sendAnimationEvent):
2021         * page/scrolling/AsyncScrollingCoordinator.cpp:
2022         (WebCore::AsyncScrollingCoordinator::requestScrollPositionUpdate):
2023         * rendering/RenderElement.cpp:
2024         (WebCore::shouldRepaintForImageAnimation):
2025         (WebCore::RenderElement::newImageAnimationFrameAvailable):
2026         * rendering/RenderImage.cpp:
2027         (WebCore::RenderImage::imageChanged):
2028         * rendering/RenderLayerCompositor.cpp:
2029         (WebCore::RenderLayerCompositor::updateCompositingLayers):
2030         (WebCore::RenderLayerCompositor::willRemoveScrollingLayerWithBacking):
2031         (WebCore::RenderLayerCompositor::didAddScrollingLayer):
2032         * rendering/RenderObject.cpp:
2033         (WebCore::printRenderTreeForLiveDocuments):
2034         (WebCore::printLayerTreeForLiveDocuments):
2035         * rendering/RenderView.cpp:
2036         (WebCore::RenderView::lazyRepaintTimerFired):
2037         * rendering/SimpleLineLayout.cpp:
2038         (WebCore::SimpleLineLayout::collectNonEmptyLeafRenderBlockFlowsForCurrentPage):
2039
2040 2016-09-12  Keith Rollin  <krollin@apple.com>
2041
2042         Enhance Network logging
2043         https://bugs.webkit.org/show_bug.cgi?id=161771
2044
2045         Reviewed by Antti Koivisto.
2046
2047         Modify current logging statements to follow a consistent pattern in
2048         order to enhance readability and parsing.
2049
2050         No new tests -- there are no tests for logging.
2051
2052         * loader/FrameLoader.cpp:
2053         (WebCore::FrameLoader::prepareForLoadStart):
2054         (WebCore::FrameLoader::checkLoadCompleteForThisFrame):
2055
2056 2016-09-12  Brady Eidson  <beidson@apple.com>
2057
2058         Crash in com.apple.WebCore: WebCore::NavigatorGamepad::gamepadFromPlatformGamepad.
2059         <rdar://problem/28018073> and https://bugs.webkit.org/show_bug.cgi?id=161694
2060
2061         Reviewed by Alex Christensen.
2062
2063         No new tests (Caught by existing tests in some configurations).
2064
2065         * Modules/gamepad/GamepadManager.cpp:
2066         (WebCore::GamepadManager::platformGamepadInputActivity): Null check.
2067
2068 2016-09-12  Alex Christensen  <achristensen@webkit.org>
2069
2070         Fix more URLParser quirks
2071         https://bugs.webkit.org/show_bug.cgi?id=161834
2072
2073         Reviewed by Brady Eidson.
2074
2075         Added new API tests.
2076
2077         * platform/URLParser.cpp:
2078         (WebCore::URLParser::parse):
2079         Skip some tabs and newlines.  The spec says to remove them before processing the String,
2080         but to reduce allocations I am skipping them whenever we increment an iterator.
2081         Fix a few other quirks to be more web platform conformant.
2082
2083 2016-09-09  Alex Christensen  <achristensen@webkit.org>
2084
2085         Optimize URLParser performance
2086         https://bugs.webkit.org/show_bug.cgi?id=161837
2087
2088         Reviewed by Brady Eidson.
2089
2090         No change in behavior.  Existing behavior covered by API tests and added a new API test.
2091
2092         * platform/URLParser.cpp:
2093         (WebCore::isDefaultPort):
2094         Use switch statements instead of HashMap lookups.
2095         (WebCore::isSpecialScheme):
2096         Use switch statements instead of repeated String comparisons.
2097         (WebCore::URLParser::parsePort):
2098         Reduce String allocation.
2099
2100 2016-09-12  Simon Fraser  <simon.fraser@apple.com>
2101
2102         Make -webkit-transition-* and -webkit-animation-* properties be pure aliases of the unprefixed ones
2103         https://bugs.webkit.org/show_bug.cgi?id=160478
2104
2105         Reviewed by Dean Jackson.
2106         
2107         Remove the custom -webkit prefixed transition and animation properties, and just make
2108         them aliases of the unprefixed ones, as we do for transforms.
2109         
2110         -webkit-animation-trigger remains as the only prefixed-only animation property.
2111         
2112         This is mostly code deletion.
2113
2114         Test: fast/css/longhand-overrides-shorthand-prefixing.html
2115
2116         * css/CSSComputedStyleDeclaration.cpp:
2117         (WebCore::ComputedStyleExtractor::propertyValue):
2118         * css/CSSProperty.h:
2119         (WebCore::prefixingVariantForPropertyId): Deleted.
2120         * css/CSSPropertyNames.in:
2121         * css/CSSToStyleMap.cpp:
2122         (WebCore::CSSToStyleMap::mapAnimationDelay):
2123         (WebCore::CSSToStyleMap::mapAnimationDirection):
2124         (WebCore::CSSToStyleMap::mapAnimationDuration):
2125         (WebCore::CSSToStyleMap::mapAnimationFillMode):
2126         (WebCore::CSSToStyleMap::mapAnimationIterationCount):
2127         (WebCore::CSSToStyleMap::mapAnimationName):
2128         (WebCore::CSSToStyleMap::mapAnimationPlayState):
2129         (WebCore::CSSToStyleMap::mapAnimationProperty):
2130         (WebCore::CSSToStyleMap::mapAnimationTimingFunction):
2131         * css/PropertySetCSSStyleDeclaration.cpp:
2132         (WebCore::PropertySetCSSStyleDeclaration::getPropertyCSSValueInternal):
2133         (WebCore::PropertySetCSSStyleDeclaration::getPropertyValueInternal):
2134         * css/StyleProperties.cpp:
2135         (WebCore::StyleProperties::getPropertyValue):
2136         (WebCore::MutableStyleProperties::removeShorthandProperty):
2137         (WebCore::StyleProperties::asText):
2138         * css/StylePropertyShorthand.cpp:
2139         (WebCore::animationShorthandForParsing):
2140         * css/StylePropertyShorthand.h:
2141         * css/StyleResolver.cpp:
2142         (WebCore::StyleResolver::styleForKeyframe):
2143         * css/parser/CSSParser.cpp:
2144         (WebCore::CSSParser::parseValue):
2145         (WebCore::CSSParser::parseAnimationShorthand):
2146         (WebCore::CSSParser::parseTransitionShorthand):
2147         (WebCore::CSSParser::parseAnimationProperty):
2148         (WebCore::CSSParser::addPropertyWithPrefixingVariant): Deleted.
2149         * css/parser/CSSParser.h:
2150         * html/shadow/MediaControlElements.cpp:
2151         (WebCore::MediaControlPanelElement::makeOpaque):
2152         (WebCore::MediaControlPanelElement::makeTransparent):
2153
2154 2016-09-12  Per Arne Vollan  <pvollan@apple.com>
2155
2156         Unreviewed build fix after r205090.
2157
2158         * platform/cf/MediaAccessibilitySoftLink.cpp:
2159
2160 2016-09-12  Javier Fernandez  <jfernandez@igalia.com>
2161
2162         [css-align] Initial values are parsed as invalid for some Alignment properties
2163         https://bugs.webkit.org/show_bug.cgi?id=161303
2164
2165         Reviewed by Darin Adler.
2166
2167         Due to the implementation of the new CSS Box Alignment specification,
2168         some properties have now new values allowed, which are not valid
2169         according to the Flexible Box Layout specification.
2170
2171         In r205102 we have get back the keywordID parsing, originally implemented for
2172         the Flexbible Box Layout specification. Even though the new valued would be
2173         parsed as invalid when they are set, the 'initial' values will be assigned
2174         in any case.
2175
2176         This patch verifies that the 'initial' values depend on whether the Grid
2177         Layout is enabled or not and verifying such values are parsed as valid.
2178
2179         Additionally, it gets back as well they keywordID parsing for the Content
2180         Alignment properties (align-content and justify-content). This required to
2181         touch a bit the StyleBuilderConverter logic, since we will have to deal with
2182         either the complex CSSContentDistributionValue complex or the  simpler
2183         CSSPrimitiveValue.
2184
2185         Test: fast/css/ensure-flexbox-compatibility-with-initial-values.html
2186
2187         * css/StyleBuilderConverter.h:
2188         (WebCore::StyleBuilderConverter::convertContentAlignmentData): Handling a primitive value if Grid Layout is not enabled.
2189         * css/parser/CSSParser.cpp:
2190         (WebCore::isValidKeywordPropertyAndValue): Simpler parsing of alignment properties if Grid Layout is not enabled.
2191         (WebCore::isKeywordPropertyID): Alignment properties are defined as keyword if Grid Layout is no enabled.
2192         (WebCore::CSSParser::parseValue): Assert Grid Layout is enabled when using the complex parsing.
2193         * rendering/style/RenderStyle.cpp:
2194         (WebCore::RenderStyle::isCSSGridLayoutEnabled): Checking out the Grid Layout runtime flags.
2195         * rendering/style/RenderStyle.h:
2196         (WebCore::RenderStyle::initialDefaultAlignment): Initial value will depend on whether Grid Layout is enabled or not.
2197         (WebCore::RenderStyle::initialContentAlignment): Initial value will depend on whether Grid Layout is enabled or not.
2198
2199 2016-09-12  Chris Dumez  <cdumez@apple.com>
2200
2201         ol.start may return incorrect value for reversed lists when not explicitly set
2202         https://bugs.webkit.org/show_bug.cgi?id=161713
2203
2204         Reviewed by Ryosuke Niwa.
2205
2206         Fix style nit after r205689.
2207
2208         * html/HTMLOListElement.cpp:
2209         (WebCore::HTMLOListElement::itemCount):
2210         (WebCore::HTMLOListElement::itemCountAfterLayout):
2211         * html/HTMLOListElement.h:
2212
2213 2016-09-12  Chris Dumez  <cdumez@apple.com>
2214
2215         Start using Document::pageCacheState() instead of Document::inPageCache()
2216         https://bugs.webkit.org/show_bug.cgi?id=161851
2217
2218         Reviewed by Ryosuke Niwa.
2219
2220         Start using Document::pageCacheState() instead of Document::inPageCache()
2221         as the latter one is confusing (given that it is true when firing the
2222         pagehide event, when the document is about to enter page cache).
2223
2224         * loader/FrameLoader.cpp:
2225         (WebCore::FrameLoader::closeURL):
2226         (WebCore::FrameLoader::clear):
2227         (WebCore::FrameLoader::dispatchUnloadEvents):
2228         * loader/cache/CachedResource.cpp:
2229         (WebCore::CachedResource::load):
2230         * page/Page.cpp:
2231         (WebCore::incrementFrame): Deleted.
2232         * page/Page.h:
2233
2234 2016-09-11  Chris Dumez  <cdumez@apple.com>
2235
2236         HTMLTrackElement.kind's invalid value default should be the metadata state
2237         https://bugs.webkit.org/show_bug.cgi?id=161840
2238
2239         Reviewed by Eric Carlson.
2240
2241         HTMLTrackElement.kind's invalid value default should be the metadata state,
2242         not the subtitles state:
2243         - https://html.spec.whatwg.org/#attr-track-kind
2244
2245         Chrome agrees with the specification.
2246
2247         No new tests, rebaselined existing tests.
2248
2249         * html/track/TextTrack.cpp:
2250         (WebCore::TextTrack::setKindKeywordIgnoringASCIICase):
2251
2252 2016-09-11  Dave Hyatt  <hyatt@apple.com>
2253
2254         [CSS Parser] Add the main parser implementation
2255         https://bugs.webkit.org/show_bug.cgi?id=161813
2256
2257         Reviewed by Dean Jackson.
2258
2259         This patch adds the main CSSParserImpl that handles stylesheet and rule parsing. All parsing starts with this
2260         class (it will eventually be invoked from the CSSParser). This patch also adds @supports parsing.
2261
2262         * WebCore.xcodeproj/project.pbxproj:
2263         * css/CSSKeyframeRule.cpp:
2264         (WebCore::StyleKeyframe::StyleKeyframe):
2265         * css/CSSKeyframeRule.h:
2266         * css/StyleRule.cpp:
2267         (WebCore::StyleRuleBase::destroy):
2268         (WebCore::StyleRuleBase::copy):
2269         (WebCore::StyleRuleBase::createCSSOMWrapper):
2270         (WebCore::StyleRuleCharset::StyleRuleCharset):
2271         (WebCore::StyleRuleCharset::~StyleRuleCharset):
2272         (WebCore::StyleRuleNamespace::StyleRuleNamespace):
2273         (WebCore::StyleRuleNamespace::~StyleRuleNamespace):
2274         * css/StyleRule.h:
2275         (WebCore::StyleRuleBase::isNamespaceRule):
2276         (isType):
2277         (WebCore::StyleRuleBase::isKeyframesRule): Deleted.
2278         * css/StyleSheetContents.cpp:
2279         (WebCore::traverseSubresourcesInRules):
2280         * css/parser/CSSParserImpl.cpp: Added.
2281         (WebCore::CSSParserImpl::CSSParserImpl):
2282         (WebCore::CSSParserImpl::parseValue):
2283         (WebCore::CSSParserImpl::parseVariableValue):
2284         (WebCore::filterProperties):
2285         (WebCore::createStyleProperties):
2286         (WebCore::CSSParserImpl::parseInlineStyleDeclaration):
2287         (WebCore::CSSParserImpl::parseDeclarationList):
2288         (WebCore::CSSParserImpl::parseRule):
2289         (WebCore::CSSParserImpl::parseStyleSheet):
2290         (WebCore::CSSParserImpl::parsePageSelector):
2291         (WebCore::CSSParserImpl::parseCustomPropertySet):
2292         (WebCore::CSSParserImpl::parseKeyframeKeyList):
2293         (WebCore::CSSParserImpl::supportsDeclaration):
2294         (WebCore::CSSParserImpl::parseDeclarationListForInspector):
2295         (WebCore::CSSParserImpl::parseStyleSheetForInspector):
2296         (WebCore::computeNewAllowedRules):
2297         (WebCore::CSSParserImpl::consumeRuleList):
2298         (WebCore::CSSParserImpl::consumeAtRule):
2299         (WebCore::CSSParserImpl::consumeQualifiedRule):
2300         (WebCore::consumeStringOrURI):
2301         (WebCore::CSSParserImpl::consumeCharsetRule):
2302         (WebCore::CSSParserImpl::consumeImportRule):
2303         (WebCore::CSSParserImpl::consumeNamespaceRule):
2304         (WebCore::CSSParserImpl::consumeMediaRule):
2305         (WebCore::CSSParserImpl::consumeSupportsRule):
2306         (WebCore::CSSParserImpl::consumeViewportRule):
2307         (WebCore::CSSParserImpl::consumeFontFaceRule):
2308         (WebCore::CSSParserImpl::consumeKeyframesRule):
2309         (WebCore::CSSParserImpl::consumePageRule):
2310         (WebCore::CSSParserImpl::consumeKeyframeStyleRule):
2311         (WebCore::observeSelectors):
2312         (WebCore::CSSParserImpl::consumeStyleRule):
2313         (WebCore::CSSParserImpl::consumeDeclarationList):
2314         (WebCore::CSSParserImpl::consumeDeclaration):
2315         (WebCore::CSSParserImpl::consumeVariableValue):
2316         (WebCore::CSSParserImpl::consumeDeclarationValue):
2317         (WebCore::CSSParserImpl::consumeKeyframeKeyList):
2318         * css/parser/CSSParserImpl.h: Added.
2319         * css/parser/CSSParserValues.cpp:
2320         (WebCore::CSSParserSelector::parsePagePseudoSelector):
2321         * css/parser/CSSParserValues.h:
2322         * css/parser/CSSPropertyParser.cpp:
2323         (WebCore::CSSPropertyParser::parseValue):
2324         * css/parser/CSSSupportsParser.cpp: Added.
2325         (WebCore::CSSSupportsParser::supportsCondition):
2326         (WebCore::CSSSupportsParser::consumeCondition):
2327         (WebCore::CSSSupportsParser::consumeNegation):
2328         (WebCore::CSSSupportsParser::consumeConditionInParenthesis):
2329         * css/parser/CSSSupportsParser.h: Added.
2330         (WebCore::CSSSupportsParser::CSSSupportsParser):
2331
2332 2016-09-11  Tim Horton  <timothy_horton@apple.com>
2333
2334         Candidates that don't end in spaces shouldn't have spaces arbitrarily appended to them
2335         https://bugs.webkit.org/show_bug.cgi?id=161846
2336         <rdar://problem/28245097>
2337
2338         Reviewed by Beth Dakin.
2339
2340         Tests: editing/mac/spelling/accept-candidate-without-adding-space.html,
2341                editing/mac/spelling/accept-candidate-allows-autocorrect-on-next-word.html
2342
2343         * editing/Editor.cpp:
2344         (WebCore::Editor::handleAcceptedCandidate):
2345         Stop appending a space just because the candidate doesn't end in a space.
2346         There are languages where that doesn't make sense, and the platform
2347         guarantees that candidates will always have spaces if they need them.
2348
2349         Also, adjust the way we compute the AcceptedCandidate document marker range.
2350         There were two problems with the existing code: it expanded outward from
2351         the post-insertion cursor in *both* directions, instead of just backwards,
2352         and it used the length of the replaced text, not the length of the newly
2353         inserted text (more of the confusion mentioned in r205765).
2354
2355 2016-09-10  Chris Dumez  <cdumez@apple.com>
2356
2357         parseHTMLInteger() should take a StringView in parameter
2358         https://bugs.webkit.org/show_bug.cgi?id=161669
2359
2360         Reviewed by Ryosuke Niwa.
2361
2362         parseHTMLInteger() should take a StringView in parameter instead of a
2363         const String&.
2364
2365         * css/parser/CSSParser.cpp:
2366         (WebCore::CSSParser::parseFontFaceSrcLocal):
2367         * css/parser/CSSParserValues.h:
2368         (WebCore::CSSParserString::toStringView):
2369         Add toStringView() to avoid unnecessarily constructing a String for
2370         calling StringBuilder::append().
2371
2372         * html/parser/HTMLParserIdioms.cpp:
2373         (WebCore::parseHTMLInteger):
2374         (WebCore::parseHTMLNonNegativeInteger):
2375         (WebCore::parseHTTPRefreshInternal):
2376         * html/parser/HTMLParserIdioms.h:
2377         (WebCore::limitToOnlyHTMLNonNegativeNumbersGreaterThanZero):
2378         (WebCore::limitToOnlyHTMLNonNegative):
2379         Take a StringView in parameter instead of a const String&.
2380
2381         * platform/sql/SQLiteStatement.cpp:
2382         (WebCore::SQLiteStatement::isColumnDeclaredAsBlob):
2383         Avoid unnecessarily constructing a String to call equalLettersIgnoringASCIICase()
2384         by leveraging the StringView constructor taking a 'const char*' in parameter.
2385
2386         * rendering/RenderBlock.cpp:
2387         (WebCore::RenderBlock::constructTextRun):
2388         * rendering/RenderBlock.h:
2389         Add constructTextRun() overload taking an AtomicString. It was otherwise ambiguous
2390         because both a String or a StringView could be constructed from an AtomicString.
2391
2392         * page/CaptionUserPreferencesMediaAF.cpp:
2393         (WebCore::CaptionUserPreferencesMediaAF::captionsDefaultFontCSS):
2394         (WebCore::buildDisplayStringForTrackBase):
2395         * rendering/RenderThemeMac.mm:
2396         (WebCore::RenderThemeMac::mediaControlsStyleSheet):
2397         (WebCore::RenderThemeMac::mediaControlsScript):
2398         Explicitly construct a String from NSString / CFStringRef types as such calls are
2399         now ambiguous.
2400
2401 2016-09-10  Chris Dumez  <cdumez@apple.com>
2402
2403         It is possible for Document::m_frame pointer to become stale
2404         https://bugs.webkit.org/show_bug.cgi?id=161812
2405         <rdar://problem/27745023>
2406
2407         Reviewed by Ryosuke Niwa.
2408
2409         Document::m_frame is supposed to get cleared by Document::prepareForDestruction().
2410         The Frame destructor calls Frame::setView(nullptr) which is supposed to call the
2411         prepareForDestruction() on the Frame's associated document. However,
2412         Frame::setView(nullptr) was calling prepareForDestruction() only if
2413         Document::inPageCache() returned true. This is because, we allow Documents to
2414         stay alive in the PageCache even though they don't have a frame.
2415
2416         The issue is that Document::m_inPageCache flag was set to true right before
2417         firing the pagehide event, so technically before really entering PageCache.
2418         Therefore, we can run into problems if a Frame gets destroyed by a pagehide
2419         EventHandler because ~Frame() will not call Document::prepareForDestruction()
2420         due to Document::m_inPageCache being true. After the frame is destroyed,
2421         Document::m_frame becomes stale and any action on the document will likely
2422         lead to crashes (such as the one in the layout test and the radar which
2423         happens when trying to unregister event listeners from the document).
2424
2425         The solution adopted in this patch is to replace the m_inPageCache boolean
2426         with a m_pageCacheState enumeration that has 3 states:
2427         - NotInPageCache
2428         - AboutToEnterPageCache
2429         - InPageCache
2430
2431         Frame::setView() / Frame::setDocument() were then updated to call
2432         Document::prepareForDestruction() on the associated document whenever
2433         the document's pageCacheState is not InPageCache. This means that we
2434         will now call Document::prepareForDestruction() when the document is
2435         being detached from its frame while firing the pagehide event.
2436
2437         Note that I tried to keep this patch minimal. Therefore, I kept
2438         the Document::inPageCache() getter for now. I plan to switch all its
2439         calls sites to the new Document::pageCacheState() getter in a follow-up
2440         patch so that we can finally drop the confusing Document::inPageCache().
2441
2442         Test: fast/history/pagehide-remove-iframe-crash.html
2443
2444         * dom/Document.cpp:
2445         (WebCore::Document::Document):
2446         (WebCore::Document::~Document):
2447         (WebCore::Document::createRenderTree):
2448         (WebCore::Document::destroyRenderTree):
2449         (WebCore::Document::setFocusedElement):
2450         (WebCore::Document::setPageCacheState):
2451         (WebCore::Document::topDocument):
2452         * dom/Document.h:
2453         (WebCore::Document::pageCacheState):
2454         (WebCore::Document::inPageCache):
2455         * history/CachedFrame.cpp:
2456         (WebCore::CachedFrame::destroy):
2457         * history/PageCache.cpp:
2458         (WebCore::setPageCacheState):
2459         (WebCore::PageCache::addIfCacheable):
2460         * loader/FrameLoader.cpp:
2461         (WebCore::FrameLoader::stopAllLoaders):
2462         (WebCore::FrameLoader::open):
2463         * loader/HistoryController.cpp:
2464         (WebCore::HistoryController::invalidateCurrentItemCachedPage):
2465         * page/Frame.cpp:
2466         (WebCore::Frame::setView):
2467
2468 2016-09-10  Wenson Hsieh  <wenson_hsieh@apple.com>
2469
2470         Apple.com keynote does not display media controls
2471         https://bugs.webkit.org/show_bug.cgi?id=161833
2472         <rdar://problem/28230123>
2473
2474         Reviewed by Tim Horton.
2475
2476         Tweaks the main content check so that we can distinguish between main content for the purposes of determining
2477         autoplay policy vs. main content for the purposes of showing media controls. Namely, we make the latter less
2478         restrictive than the former in terms of the maximum aspect ratio a video can have to be considered the right
2479         size for main content.
2480
2481         New unit test in TestWebKitAPI.
2482
2483         * html/HTMLMediaElement.cpp:
2484         (WebCore::mediaElementSessionInfoForSession):
2485         * html/MediaElementSession.cpp:
2486         (WebCore::MediaElementSession::canShowControlsManager):
2487         (WebCore::MediaElementSession::isLargeEnoughForMainContent):
2488         (WebCore::MediaElementSession::wantsToObserveViewportVisibilityForMediaControls):
2489         (WebCore::isMainContentForPurposesOfAutoplay):
2490         (WebCore::isElementLargeEnoughForMainContent):
2491         (WebCore::MediaElementSession::updateIsMainContent):
2492         (WebCore::isMainContent): Deleted.
2493         * html/MediaElementSession.h:
2494
2495 2016-09-09  Alex Christensen  <achristensen@webkit.org>
2496
2497         URLParser: Keep track of cannot-be-a-base-url according to spec
2498         https://bugs.webkit.org/show_bug.cgi?id=161830
2499
2500         Reviewed by Tim Horton.
2501
2502         Covered by new API tests.
2503
2504         * platform/URL.cpp:
2505         (WebCore::URL::invalidate):
2506         * platform/URL.h:
2507         Add a boolean required by the spec.
2508         This will not add to sizeof(URL) because we already have some bit fields.
2509         * platform/URLParser.cpp:
2510         (WebCore::URLParser::parse):
2511         (WebCore::URLParser::allValuesEqual):
2512
2513 2016-09-09  Commit Queue  <commit-queue@webkit.org>
2514
2515         Unreviewed, rolling out r205771.
2516         https://bugs.webkit.org/show_bug.cgi?id=161823
2517
2518         Broke Windows build (Requested by litherum on #webkit).
2519
2520         Reverted changeset:
2521
2522         "Remove unused member of GlyphBuffer"
2523         https://bugs.webkit.org/show_bug.cgi?id=161814
2524         http://trac.webkit.org/changeset/205771
2525
2526 2016-09-09  Alex Christensen  <achristensen@webkit.org>
2527
2528         URLParser should convert ASCII hosts to lowercase
2529         https://bugs.webkit.org/show_bug.cgi?id=161820
2530
2531         Reviewed by Geoffrey Garen.
2532
2533         Covered by new API tests.
2534
2535         * platform/URLParser.cpp:
2536         (WebCore::domainToASCII):
2537         The fast path for domains that are already ASCII and do not need punycode encoding
2538         should convert the domain to lowercase.
2539         This matches behavior in URL::parse if isCanonicalHostnameLowercaseForScheme is true,
2540         and RFC 5890.
2541
2542 2016-09-09  Myles C. Maxfield  <mmaxfield@apple.com>
2543
2544         Remove unused member of GlyphBuffer
2545         https://bugs.webkit.org/show_bug.cgi?id=161814
2546
2547         Reviewed by Simon Fraser.
2548
2549         This m_offsets member never actually affected anything. It just made
2550         FontCascade::drawGlyphBuffer() slower.
2551
2552         No new tests because there is no behavior change.
2553
2554         * platform/graphics/FontCascade.cpp:
2555         (WebCore::FontCascade::drawGlyphBuffer):
2556         * platform/graphics/GlyphBuffer.h:
2557         (WebCore::GlyphBuffer::clear):
2558         (WebCore::GlyphBuffer::advanceAt):
2559         (WebCore::GlyphBuffer::add):
2560         (WebCore::GlyphBuffer::shrink):
2561         (WebCore::GlyphBuffer::swap):
2562         (WebCore::GlyphBuffer::offsetAt): Deleted.
2563         * platform/graphics/win/UniscribeController.cpp:
2564         (WebCore::UniscribeController::shapeAndPlaceItem):
2565
2566 2016-09-09  Tim Horton  <timothy_horton@apple.com>
2567
2568         Text replacement candidates don't always overwrite the entire original string
2569         https://bugs.webkit.org/show_bug.cgi?id=161779
2570         <rdar://problem/28033492>
2571
2572         Reviewed by Simon Fraser.
2573
2574         New test: editing/mac/spelling/accept-candidate-replacing-multiple-words.html.
2575
2576         * editing/Editor.cpp:
2577         (WebCore::Editor::contextRangeForCandidateRequest):
2578         Factor contextRangeForCandidateRequest out of the WebKits, into Editor.
2579         This just expands to paragraph boundaries from the cursor.
2580
2581         (WebCore::Editor::selectTextCheckingResult):
2582         Add selectTextCheckingResult, which, given a TextCheckingResult,
2583         selects the range represented by the result's location and length, which
2584         indicate the portion of the context string that the result refers to.
2585         In the case of accepting a candidate, we want to select that range
2586         so that our insertion will overwrite it.
2587
2588         (WebCore::Editor::handleAcceptedCandidate):
2589         Make use of selectTextCheckingResult instead of just assuming that we want
2590         to replace the word to the left of the insertion point.
2591
2592         (WebCore::Editor::stringForCandidateRequest): Deleted.
2593         * editing/Editor.h:
2594
2595         * testing/Internals.cpp:
2596         (WebCore::Internals::handleAcceptedCandidate):
2597         * testing/Internals.h:
2598         * testing/Internals.idl:
2599         Internals' handleAcceptedCandidate assumed (wrongly) that the length
2600         of a TextCheckerResult was the length of the candidate, when really it is
2601         the length of the text that the candidate would replace. Adjust this,
2602         and expose the replacement range to JavaScript, so we can test this.
2603
2604 2016-09-09  Brady Eidson  <beidson@apple.com>
2605
2606         Soft-link GameController.framework.
2607         <rdar://problem/28219953> and https://bugs.webkit.org/show_bug.cgi?id=161802
2608
2609         Reviewed by Brian Burg.
2610
2611         No new tests (No change in behavior).
2612
2613         * Configurations/WebCore.xcconfig:
2614         * WebCore.xcodeproj/project.pbxproj:
2615         * platform/gamepad/cocoa/GameControllerGamepadProvider.mm:
2616         (WebCore::GameControllerGamepadProvider::startMonitoringGamepads):
2617
2618 2016-09-09  Jiewen Tan  <jiewen_tan@apple.com>
2619
2620         Rename Key to CryptoKey
2621         https://bugs.webkit.org/show_bug.cgi?id=161665
2622         <rdar://problem/28083391>
2623
2624         Reviewed by Brent Fulgham.
2625
2626         A link to the spec: https://www.w3.org/TR/WebCryptoAPI/#cryptokey-interface
2627
2628         * crypto/CryptoKey.idl:
2629         Remove some unnecessary IDL attributes and reorder KeyType enum to match the spec.
2630         * crypto/CryptoKeyType.h:
2631
2632 2016-09-09  Alex Christensen  <achristensen@webkit.org>
2633
2634         URLParser: Fix and optimize parsing file URLs ending with a host but no slash
2635         https://bugs.webkit.org/show_bug.cgi?id=161815
2636
2637         Reviewed by Geoffrey Garen.
2638
2639         Covered by new API tests.
2640
2641         * platform/URLParser.cpp:
2642         (WebCore::bufferView):
2643         (WebCore::URLParser::copyURLPartsUntil):
2644         (WebCore::URLParser::parse):
2645
2646 2016-09-09  Alex Christensen  <achristensen@webkit.org>
2647
2648         URLParser: Handle \ in path according to spec
2649         https://bugs.webkit.org/show_bug.cgi?id=161805
2650
2651         Reviewed by Andy Estes.
2652
2653         Covered by new API tests.
2654
2655         * platform/URLParser.cpp:
2656         (WebCore::URLParser::parse):
2657
2658 2016-09-09  Youenn Fablet  <youenn@apple.com>
2659
2660         TextTrackLoader should use FetchOptions::mode according its crossOrigin attribute
2661         https://bugs.webkit.org/show_bug.cgi?id=161792
2662
2663         Reviewed by Eric Carlson.
2664
2665         Covered by existing and updated tests.
2666
2667         Updating text track loader to use fetch mode according crossOrigin value.
2668
2669         Removed the check done in the case the crossOrigin value is not set.
2670         Previously cross-origin loads were forbidden, now this is authorized.
2671         This change allows aligning with the spec.
2672         Also, this check could be bypassed in the case of a same-origin URL redirecting to a cross-origin one.
2673
2674         * loader/TextTrackLoader.cpp:
2675         (WebCore::TextTrackLoader::notifyFinished): Checking resource error in lieu of doing CORS checks on its own.
2676         (WebCore::TextTrackLoader::load): Using CachedResourceRequest::setAsPotentiallyCrossOrigin
2677         * loader/TextTrackLoader.h:
2678         * loader/cache/CachedResource.cpp:
2679         (WebCore::CachedResource::loadFrom): Setting loading and status values as would be done when load is finished.
2680         (WebCore::CachedResource::setBodyDataFrom): Default implementation is to copy the shared buffer.
2681         * loader/cache/CachedResource.h:
2682         * loader/cache/CachedResourceLoader.cpp:
2683         (WebCore::CachedResourceLoader::updateCachedResourceWithCurrentRequest): Enabling resource update when mode or origin is different for TextTrack resources.
2684
2685 2016-09-09  Alex Christensen  <achristensen@webkit.org>
2686
2687         URLParser should parse URLs with non-special schemes
2688         https://bugs.webkit.org/show_bug.cgi?id=161786
2689
2690         Reviewed by Andy Estes.
2691
2692         Covered by new API tests.
2693
2694         * platform/URLParser.cpp:
2695         (WebCore::URLParser::parse):
2696         There's no reason for a SchemeEndCheckForSlashes state now that we can copy iterators.
2697         It's not in the spec and not needed.
2698         Also, move things around a little so parsing special or non-special schemes
2699         followed by one or two slashes works correctly.
2700
2701 2016-09-09  Chris Dumez  <cdumez@apple.com>
2702
2703         Regression(r186020): Null dereference in getStartDate()
2704         https://bugs.webkit.org/show_bug.cgi?id=161733
2705
2706         Reviewed by Eric Carlson.
2707
2708         Update HTMLMediaElement::getStartDate() to return NaN if m_player is null,
2709         instead of crashing.
2710
2711         Test: fast/media/getStartDate-NaN.html
2712
2713         * bindings/js/IDBBindingUtilities.cpp:
2714         (WebCore::toJS):
2715         Add a FIXME comment as this code is using jsDateOrNull() but should
2716         probably be using jsDate() as per:
2717         - http://w3c.github.io/IndexedDB/#request-convert-a-key-to-a-value
2718
2719         * bindings/js/JSDOMBinding.cpp:
2720         (WebCore::jsDate):
2721         (WebCore::jsDateOrNull):
2722         * bindings/js/JSDOMBinding.h:
2723         - Rename jsDateOrNaN() to jsDate() as this is the default behavior. Also,
2724           return new Date(NaN) instead of NaN if the implementation returns NaN.
2725           The IDL says we should return a Date, not a number.
2726         - Update jsDateOrNull() to only return jsNull() if the native value is
2727           NaN, instead of doing so for every value that is not finite. Our
2728           convention is to use NaN as special value to represent null in JS.
2729
2730         * bindings/scripts/CodeGeneratorJS.pm:
2731         (NativeToJSValue):
2732         When converting a native value (double) into a Date, rely on the fact
2733         that the type is nullable when deciding if we should call jsDate() or
2734         jsDateOrNull() to convert. This way, we no longe need a WebKit specific
2735         [TreatReturnedDateAs=Null|NaN] IDL extended attribute.
2736
2737         * bindings/scripts/IDLAttributes.txt:
2738         * html/HTMLInputElement.idl:
2739         Mark valueAsDate attribute as nullable, as per the specification:
2740         - https://html.spec.whatwg.org/#htmlinputelement
2741
2742         * html/HTMLMediaElement.cpp:
2743         (WebCore::HTMLMediaElement::getStartDate):
2744         Return NaN if m_player is null instead of crashing. The reason I decided
2745         to return NaN is because the specification [1] says to return a new Date
2746         object representing the current timeline offset. The spec of timeline
2747         offset [2] says that the initial timeline offset value is NaN.
2748         [1] https://html.spec.whatwg.org/#dom-media-getstartdate
2749         [2] https://html.spec.whatwg.org/#timeline-offset
2750
2751         * bindings/scripts/IDLAttributes.txt:
2752         * html/HTMLMediaElement.idl:
2753         Drop [TreatReturnedDateAs] attribute as it is no longer supported.
2754
2755 2016-09-09  Youenn Fablet  <youenn@apple.com>
2756
2757         ASSERTION FAILED: promise.inherits(JSPromise::info())
2758         https://bugs.webkit.org/show_bug.cgi?id=161632
2759         <rdar://problem/28184743>
2760
2761         Reviewed by Mark Lam.
2762
2763         Test: fetch/fetch-worker-crash.html
2764
2765         * bindings/js/JSDOMPromise.h:
2766         (WebCore::callPromiseFunction): Returning early if created promise is null.
2767         Passing directly a DeferredWrapper to the generated code.
2768         * bindings/scripts/CodeGeneratorJS.pm: Updated to take a DeferredWrapper.
2769         (GenerateImplementation):
2770         (GenerateReturnParameters):
2771         * bindings/scripts/test/JS/JSTestObj.cpp: Rebasing expectations.
2772         (WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionPromise):
2773         (WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionWithFloatArgumentPromise):
2774         (WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionWithExceptionPromise):
2775         (WebCore::jsTestObjPrototypeFunctionTestPromiseFunctionWithOptionalIntArgumentPromise):
2776         (WebCore::jsTestObjPrototypeFunctionTestPromiseOverloadedFunction1Promise):
2777         (WebCore::jsTestObjPrototypeFunctionTestPromiseOverloadedFunction2Promise):
2778         (WebCore::jsTestObjConstructorFunctionTestStaticPromiseFunctionPromise):
2779         (WebCore::jsTestObjConstructorFunctionTestStaticPromiseFunctionWithExceptionPromise):
2780
2781 2016-09-09  Myles C. Maxfield  <mmaxfield@apple.com>
2782
2783         [Cocoa] Improve performance of glyph advance metrics gathering
2784         https://bugs.webkit.org/show_bug.cgi?id=161119
2785
2786         Reviewed by Simon Fraser.
2787
2788         Most of the glyphs in a GlyphPage are never read from. Therefore, we can get a performance boost
2789         by not populating as many items in the GlyphPage. Because of the performance characteristics of
2790         CTFontGetGlyphsForCharacters(), a better size for a GlyphPage is 16 items. This, coupled with
2791         using CTFontGetUnsummedAdvancesForGlyphsAndStyle(), causes between a 0.01%-0.5% speedup on PLT.
2792
2793         No new tests because there is no behavior change.
2794
2795         * platform/graphics/Font.cpp:
2796         (WebCore::Font::initCharWidths):
2797         (WebCore::Font::platformGlyphInit):
2798         (WebCore::createAndFillGlyphPage):
2799         * platform/graphics/Font.h:
2800         (WebCore::Font::widthForGlyph):
2801         * platform/graphics/GlyphMetricsMap.h:
2802         * platform/graphics/GlyphPage.h:
2803         * platform/graphics/cocoa/FontCocoa.mm:
2804         * platform/spi/cocoa/CoreTextSPI.h:
2805         (WebCore::Font::platformWidthForGlyph):
2806         (WebCore::canUseFastGlyphAdvanceGetter): Deleted.
2807
2808 2016-09-09  Antti Koivisto  <antti@apple.com>
2809
2810         v3: WebContent crash due to RELEASE_ASSERT in WebCore: WebCore::StyleResolver::styleForElement
2811         https://bugs.webkit.org/show_bug.cgi?id=161689
2812
2813         Reviewed by Andreas Kling.
2814
2815         These crashes happen because synchronously triggered resource loads generate callbacks that may end up
2816         deleting the resource loader.
2817
2818         Stop triggering resource loads from StyleResolver. Instead trigger them when applying style to render tree.
2819
2820         * css/StyleResolver.cpp:
2821         (WebCore::StyleResolver::~StyleResolver):
2822
2823             Replace the RELEASE_ASSERT against deletion during resource loads by a general isDeleted assert.
2824
2825         (WebCore::StyleResolver::styleForElement):
2826         (WebCore::StyleResolver::styleForKeyframe):
2827         (WebCore::StyleResolver::pseudoStyleForElement):
2828         (WebCore::StyleResolver::styleForPage):
2829         (WebCore::StyleResolver::applyMatchedProperties):
2830         (WebCore::StyleResolver::loadPendingResources): Deleted.
2831         * css/StyleResolver.h:
2832         * page/animation/KeyframeAnimation.cpp:
2833         (WebCore::KeyframeAnimation::KeyframeAnimation):
2834         (WebCore::KeyframeAnimation::resolveKeyframeStyles):
2835
2836             Ensure resource load for all animation frames.
2837
2838         * page/animation/KeyframeAnimation.h:
2839         * rendering/RenderElement.cpp:
2840         (WebCore::RenderElement::createFor):
2841         (WebCore::RenderElement::initializeStyle):
2842
2843             Load resources when renderer initializes a style.
2844
2845         (WebCore::RenderElement::setStyle):
2846         (WebCore::RenderElement::getUncachedPseudoStyle):
2847
2848             Load resources for pseudo styles.
2849
2850         * rendering/RenderImage.cpp:
2851         (WebCore::RenderImage::RenderImage):
2852         (WebCore::RenderImage::styleWillChange):
2853
2854             Shuffle image resource initialization out from constructor so initializeStyle gets called before.
2855
2856         * rendering/RenderImage.h:
2857         * rendering/style/StyleCachedImage.cpp:
2858         (WebCore::StyleCachedImage::StyleCachedImage):
2859
2860             Track pending status with a bit instead of implicitly by the existence of CachedResource.
2861             This is useful for asserts.
2862
2863         (WebCore::StyleCachedImage::load):
2864         (WebCore::StyleCachedImage::isPending):
2865         (WebCore::StyleCachedImage::addClient):
2866         (WebCore::StyleCachedImage::removeClient):
2867         (WebCore::StyleCachedImage::image):
2868         * rendering/style/StyleCachedImage.h:
2869
2870 2016-09-08  Yusuke Suzuki  <utatane.tea@gmail.com>
2871
2872         ScriptRunner should be driven by PendingScript rather than ScriptElement
2873         https://bugs.webkit.org/show_bug.cgi?id=161726
2874
2875         Reviewed by Ryosuke Niwa.
2876
2877         Tests: js/dom/document-write-in-error-event.html
2878                js/dom/document-write-in-load-event.html
2879
2880         ScriptRunner is driven by ScriptElement::notifyFinished. While ScriptRunner is driven by this,
2881         HTMLScriptRunner does not use it. Instead, HTMLScriptRunner uses PendingScriptClient. As a result,
2882         ScriptElement::notifyFinished is used only when the script is annotated with "defer" or "async"
2883         while all the external script will load the LoadableScript. It is confusing.
2884         This patch removes ScriptElement::notifyFinished and use PendingScript's observability
2885         in ScriptRunner instead.
2886
2887         This patch also fixes the behavior about ignore-destructive-writes counter[1]. When dispatching
2888         the load and error events, this ignore-destructive-writes counter should not be incremeneted by
2889         this execution. The added tests ensure this behavior.
2890
2891         [1]: https://html.spec.whatwg.org/multipage/scripting.html#execute-the-script-block
2892
2893         * dom/ScriptElement.cpp: Drop LoadableScriptClient interface.
2894         (WebCore::ScriptElement::prepareScript): Do not use addClient. ScriptRunner use PendingScript::{setClient,clearClient} instead.
2895         (WebCore::ScriptElement::executeScriptForScriptRunner): IgnoreDestructiveWriteCountIncrementer will be done in ScriptElement::executeScript.
2896         So no need to do it here, that's duplicated.
2897         (WebCore::ScriptElement::~ScriptElement): Deleted. ScriptElement does not use addClient/removeClient.
2898         (WebCore::ScriptElement::stopLoadRequest): Deleted.
2899         (WebCore::ScriptElement::executeScriptForHTMLScriptRunner): Deleted. executeScriptForHTMLScriptRunner and executeScriptForScriptRunner are
2900         merged into executeScriptForRunner.
2901         (WebCore::ScriptElement::notifyFinished): Deleted.
2902         * dom/ScriptElement.h:
2903         (WebCore::ScriptElement::~ScriptElement):
2904         (WebCore::ScriptElement::willExecuteInOrder): Used in ScriptRunner to determine whether the script is async or defer.
2905         (WebCore::ScriptElement::willExecuteWhenDocumentFinishedParsing): Deleted.
2906         * dom/ScriptRunner.cpp:
2907         (WebCore::ScriptRunner::~ScriptRunner): HashSet's iterator will return `const PendingScript&`.
2908         Another option is using HashSet<RefPtr<PendingScript>>. Here, we use a little bit weired const_cast.
2909         (WebCore::ScriptRunner::queueScriptForExecution): Use PendingScript::setClient to wait loading.
2910         (WebCore::ScriptRunner::notifyFinished): Notify the script ready here.
2911         (WebCore::ScriptRunner::timerFired): Use executeScriptForScriptRunner.
2912         (WebCore::ScriptRunner::notifyScriptReady): Deleted.
2913         * dom/ScriptRunner.h:
2914         * html/parser/HTMLScriptRunner.cpp:
2915         (WebCore::HTMLScriptRunner::executePendingScriptAndDispatchEvent): Use executeScriptForScriptRunner.
2916
2917 2016-09-08  Yusuke Suzuki  <utatane.tea@gmail.com>
2918
2919         [WTF] HashTable's rehash is not compatible to Ref<T> and ASan
2920         https://bugs.webkit.org/show_bug.cgi?id=161763
2921
2922         Reviewed by Mark Lam.
2923
2924         Include wtf/text/StringHash.h to avoid linking errors in EFL port.
2925
2926         * loader/ResourceLoadStatistics.h:
2927
2928 2016-09-08  Chris Dumez  <cdumez@apple.com>
2929
2930         HTMLObjectElement.hspace / vspace attributes should be unsigned
2931         https://bugs.webkit.org/show_bug.cgi?id=161766
2932
2933         Reviewed by Ryosuke Niwa.
2934
2935         HTMLObjectElement.hspace / vspace attributes should be unsigned:
2936         - https://html.spec.whatwg.org/#HTMLObjectElement-partial
2937
2938         Firefox agrees with the specification but those were signed in WebKit.
2939
2940         No new tests, rebaselined existing test.
2941
2942         * html/HTMLObjectElement.idl:
2943
2944 2016-09-08  Chris Dumez  <cdumez@apple.com>
2945
2946         HTMLObjectElement.codebase attribute should reflect as a URL
2947         https://bugs.webkit.org/show_bug.cgi?id=161768
2948
2949         Reviewed by Alex Christensen.
2950
2951         HTMLObjectElement.codebase attribute should reflect as a URL:
2952         - https://html.spec.whatwg.org/#dom-applet-codebase
2953
2954         Chrome and Firefox agree with the specification.
2955
2956         No new test, rebaselined existing test.
2957
2958         * html/HTMLObjectElement.idl:
2959
2960 2016-09-08  Chris Dumez  <cdumez@apple.com>
2961
2962         ol.start may return incorrect value for reversed lists when not explicitly set
2963         https://bugs.webkit.org/show_bug.cgi?id=161713
2964
2965         Reviewed by Zalan Bujtas.
2966
2967         ol.start may return incorrect value for reversed lists when not explicitly set.
2968         This is because we're supposed to return the number of rendered <li> child
2969         elements, which relies on layout. However, we did not make sure the layout is
2970         up-to-date before counting the number of li child elements. This patch fixes
2971         the issue.
2972
2973         No new tests, rebaselined existing tests.
2974
2975         * html/HTMLOListElement.h:
2976
2977 2016-09-08  Chris Dumez  <cdumez@apple.com>
2978
2979         Add support for HTMLIframeElement.allowFullscreen attribute
2980         https://bugs.webkit.org/show_bug.cgi?id=161757
2981
2982         Reviewed by Sam Weinig.
2983
2984         Add support for HTMLIframeElement.allowFullscreen attribute:
2985         - https://html.spec.whatwg.org/#dom-iframe-allowfullscreen
2986
2987         Firefox and Chrome already support it, unprefixed.
2988
2989         Note that the HTMLIframeElement.allowFullscreen attribute reflects the
2990         allowfullscreen content attribute which we already support.
2991
2992         Test: fullscreen/full-screen-iframe-allowFullscreen.html
2993
2994         * html/HTMLIFrameElement.idl:
2995
2996 2016-09-08  Chris Dumez  <cdumez@apple.com>
2997
2998         frame.longDesc / iframe.longDesc should reflect as a URL
2999         https://bugs.webkit.org/show_bug.cgi?id=161764
3000
3001         Reviewed by Alex Christensen.
3002
3003         frame.longDesc / iframe.longDesc should reflect as a URL:
3004         - https://html.spec.whatwg.org/#dom-iframe-longdesc
3005         - https://html.spec.whatwg.org/#dom-frame-longdesc
3006
3007         They already do in Chrome and Firefox.
3008
3009         No new tests, rebaselined existing tests.
3010
3011         * html/HTMLFrameElement.idl:
3012         * html/HTMLIFrameElement.idl:
3013
3014 2016-09-08  Alex Christensen  <achristensen@webkit.org>
3015
3016         URLParser: Handle \ in paths of special URLs according to spec
3017         https://bugs.webkit.org/show_bug.cgi?id=161781
3018
3019         Reviewed by Tim Horton.
3020
3021         Covered by new API tests.
3022
3023         * platform/URLParser.cpp:
3024         (WebCore::bufferView):
3025         (WebCore::URLParser::copyURLPartsUntil):
3026         (WebCore::URLParser::parse):
3027         * platform/URLParser.h:
3028
3029 2016-09-08  Said Abou-Hallawa  <sabouhallawa@apple.com>
3030
3031         Move the BitmapImage platform dependent code to a new file named NativeImage[CG|Cairo].cpp
3032         https://bugs.webkit.org/show_bug.cgi?id=158684
3033
3034         Reviewed by Simon Fraser.
3035
3036         This is a refactoring patch. It moves the BitmapImage platform dependent
3037         code from BitmapImage to NativeImage[CG|Cairo].cpp. The new APIs are
3038         responsible of drawing a NativeImagePtr and answering some metadata queries.
3039
3040         No new tests -- Code refactoring, no behavior change.
3041
3042         * PlatformAppleWin.cmake:
3043         * PlatformEfl.cmake:
3044         * PlatformGTK.cmake:
3045         * PlatformMac.cmake:
3046         * PlatformWinCairo.cmake:
3047         * WebCore.xcodeproj/project.pbxproj:
3048         * loader/cache/MemoryCache.h:
3049         * loader/icon/IconDatabaseBase.h:
3050         * page/mac/TextIndicatorWindow.mm:
3051         (-[WebTextIndicatorView initWithFrame:textIndicator:margin:offset:]):
3052         (createContentCrossfadeAnimation):
3053         * platform/graphics/BitmapImage.cpp:
3054         (WebCore::BitmapImage::BitmapImage):
3055         (WebCore::BitmapImage::destroyDecodedData):
3056         (WebCore::BitmapImage::destroyDecodedDataIfNecessary):
3057         (WebCore::BitmapImage::dataChanged):
3058         (WebCore::BitmapImage::ensureFrameAtIndexIsCached):
3059         (WebCore::BitmapImage::frameImageAtIndex):
3060         (WebCore::BitmapImage::nativeImage):
3061         (WebCore::BitmapImage::nativeImageForCurrentFrame):
3062         (WebCore::BitmapImage::nativeImageOfSize):
3063         (WebCore::BitmapImage::framesNativeImages):
3064         (WebCore::BitmapImage::frameIsCompleteAtIndex):
3065         (WebCore::BitmapImage::frameDurationAtIndex):
3066         (WebCore::BitmapImage::frameHasAlphaAtIndex):
3067         (WebCore::BitmapImage::frameOrientationAtIndex):
3068         (WebCore::BitmapImage::singlePixelSolidColor):
3069         (WebCore::BitmapImage::draw):
3070         (WebCore::BitmapImage::drawPattern):
3071         (WebCore::BitmapImage::canAnimate):
3072         (WebCore::BitmapImage::clearTimer):
3073         (WebCore::BitmapImage::startTimer):
3074         (WebCore::BitmapImage::stopAnimation):
3075         (WebCore::BitmapImage::resetAnimation):
3076         (WebCore::BitmapImage::hasSingleSecurityOrigin): Deleted.
3077         (WebCore::BitmapImage::filenameExtension): Deleted.
3078         (WebCore::BitmapImage::ensureFrameIsCached): Deleted.
3079         * platform/graphics/BitmapImage.h:
3080         (WebCore::FrameData::FrameData):
3081         m_hasAlpha can be initialized with false because it is accessed only in
3082         BitmapImage::frameHasAlphaAtIndex() and it is guarded by m_haveMetadata.
3083         Both m_haveMetadata and m_hasAlpha are set in BitmapImage constructor
3084         and in BitmapImage::cacheFrame().
3085         
3086         (WebCore::FrameData::~FrameData):
3087         (WebCore::FrameData::clear):
3088         * platform/graphics/Icon.h:
3089         * platform/graphics/Image.h:
3090         (WebCore::Image::nativeImage):
3091         (WebCore::Image::nativeImageOfSize):
3092         (WebCore::Image::framesNativeImages):
3093         (WebCore::Image::orientationForCurrentFrame): Deleted.
3094         (WebCore::Image::getCGImageRef): Deleted.
3095         (WebCore::Image::getFirstCGImageRefOfSize): Deleted.
3096         (WebCore::Image::getCGImageArray): Deleted.
3097         * platform/graphics/ImageSource.cpp:
3098         (WebCore::ImageSource::calculateMaximumSubsamplingLevel):
3099         (WebCore::ImageSource::size):
3100         (WebCore::ImageSource::sizeRespectingOrientation):
3101         * platform/graphics/ImageSource.h:
3102         * platform/graphics/MediaPlayer.h:
3103         * platform/graphics/NativeImage.h: Added.
3104         * platform/graphics/NativeImagePtr.h: Removed.
3105         * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
3106         (WebCore::MediaPlayerPrivateMediaStreamAVFObjC::updatePausedImage):
3107         * platform/graphics/cairo/BitmapImageCairo.cpp: Removed.
3108         * platform/graphics/cairo/NativeImageCairo.cpp: Added.
3109         (WebCore::nativeImageSize):
3110         (WebCore::nativeImageHasAlpha):
3111         (WebCore::nativeImageSinglePixelSolidColor):
3112         (WebCore::subsamplingScale):
3113         (WebCore::drawNativeImage):
3114         (WebCore::clearNativeImageSubImages):
3115         * platform/graphics/cg/BitmapImageCG.cpp: Removed.
3116         * platform/graphics/cg/ImageDecoderCG.cpp:
3117         (WebCore::ImageDecoder::size):
3118         * platform/graphics/cg/ImageDecoderCG.h:
3119         * platform/graphics/cg/NativeImageCG.cpp: Added.
3120         (WebCore::nativeImageSize):
3121         (WebCore::nativeImageHasAlpha):
3122         (WebCore::nativeImageSinglePixelSolidColor):
3123         (WebCore::subsamplingScale):
3124         (WebCore::drawNativeImage):
3125         (WebCore::clearNativeImageSubImages):
3126         * platform/graphics/cg/PatternCG.cpp:
3127         (WebCore::Pattern::createPlatformPattern):
3128         * platform/graphics/cocoa/TextTrackRepresentationCocoa.mm:
3129         (TextTrackRepresentationCocoa::update):
3130         * platform/graphics/mac/ImageMac.mm:
3131         (WebCore::BitmapImage::getTIFFRepresentation):
3132         * platform/mediastream/mac/MockRealtimeVideoSourceMac.mm:
3133         (WebCore::MockRealtimeVideoSourceMac::updatePlatformLayer):
3134         (WebCore::MockRealtimeVideoSourceMac::updateSampleBuffer):
3135         * platform/win/DragImageCGWin.cpp:
3136         (WebCore::createDragImageFromImage):
3137
3138 2016-09-08  Alex Christensen  <achristensen@webkit.org>
3139
3140         URLParser: Parsing empty URLs with a base URL should return the base URL
3141         https://bugs.webkit.org/show_bug.cgi?id=161777
3142
3143         Reviewed by Tim Horton.
3144
3145         Covered by an API test and progress towards passing all web platform tests when using URLParser.
3146
3147         * platform/URLParser.cpp:
3148         (WebCore::URLParser::parse):
3149
3150 2016-09-08  Alex Christensen  <achristensen@webkit.org>
3151
3152         URLParser failures should preserve the original input string
3153         https://bugs.webkit.org/show_bug.cgi?id=161769
3154
3155         Reviewed by Tim Horton.
3156
3157         No new tests, but covered by updates to API tests.
3158         This also represents many newly passing web platform tests when using URLParser.
3159
3160         * platform/URLParser.cpp:
3161         (WebCore::URLParser::failure):
3162         (WebCore::URLParser::parse):
3163         * platform/URLParser.h:
3164
3165 2016-09-08  Alex Christensen  <achristensen@webkit.org>
3166
3167         URLParser should parse URLs with a user but no password
3168         https://bugs.webkit.org/show_bug.cgi?id=161773
3169
3170         Reviewed by Brady Eidson.
3171
3172         Covered by new API tests.
3173
3174         * platform/URLParser.cpp:
3175         (WebCore::URLParser::parseAuthority):
3176
3177 2016-09-08  Alex Christensen  <achristensen@webkit.org>
3178
3179         Fix URLs after r205669.
3180         https://bugs.webkit.org/show_bug.cgi?id=161731
3181
3182         * platform/URLParser.cpp:
3183         (WebCore::URLParser::enabled):
3184         I accidentally committed enabling the URLParser by default.  Not ready yet.
3185
3186 2016-09-08  Chris Dumez  <cdumez@apple.com>
3187
3188         Align proto getter / setter behavior with other browsers
3189         https://bugs.webkit.org/show_bug.cgi?id=161455
3190
3191         Reviewed by Saam Barati.
3192
3193         Align cross-origin __proto__ getter / setter behavior with other
3194         browsers and the specification:
3195
3196         [[SetPrototypeOf]] should throw a TypeError:
3197         - https://html.spec.whatwg.org/#windowproxy-setprototypeof
3198         - https://html.spec.whatwg.org/#location-setprototypeof
3199         - https://tc39.github.io/ecma262/#sec-object.setprototypeof (step 5)
3200
3201         [[GetPrototypeOf]] should return null cross-origin:
3202         - https://html.spec.whatwg.org/#windowproxy-getprototypeof
3203         - https://html.spec.whatwg.org/#location-getprototypeof
3204
3205         Test: js/dom/setPrototypeOf-location-window.html
3206
3207         * bindings/js/JSDOMWindowBase.cpp:
3208         (WebCore::JSDOMWindowBase::JSDOMWindowBase): Deleted.
3209         * bindings/js/JSDOMWindowCustom.cpp:
3210         (WebCore::JSDOMWindow::setPrototype):
3211         (WebCore::JSDOMWindow::getPrototype):
3212         (WebCore::JSDOMWindow::preventExtensions):
3213         * bindings/js/JSLocationCustom.cpp:
3214         (WebCore::JSLocation::setPrototype):
3215         (WebCore::JSLocation::getPrototype):
3216         * bindings/js/JSWorkerGlobalScopeBase.cpp:
3217         (WebCore::JSWorkerGlobalScopeBase::supportsRichSourceInfo): Deleted.
3218         * bindings/js/JSWorkerGlobalScopeBase.h:
3219         * bindings/scripts/CodeGeneratorJS.pm:
3220         (GenerateHeader):
3221         * bindings/scripts/IDLAttributes.txt:
3222         * page/DOMWindow.idl:
3223         * page/Location.idl:
3224
3225 2016-09-08  Alex Christensen  <achristensen@webkit.org>
3226
3227         URLParser should parse ports after IPv4 and IPv6 hosts
3228         https://bugs.webkit.org/show_bug.cgi?id=161731
3229
3230         Reviewed by Brady Eidson.
3231
3232         Covered by new API tests.
3233
3234         * platform/URLParser.cpp:
3235         (WebCore::URLParser::parsePort):
3236         (WebCore::URLParser::parseHost):
3237
3238 2016-09-08  Alex Christensen  <achristensen@webkit.org>
3239
3240         URLParser should correctly handle \ in path
3241         https://bugs.webkit.org/show_bug.cgi?id=161762
3242
3243         Reviewed by Brady Eidson.
3244
3245         Covered by new API tests.
3246
3247         * platform/URLParser.cpp:
3248         (WebCore::isSpecialScheme):
3249         (WebCore::bufferView):
3250         (WebCore::URLParser::parse):
3251         Treat \ as / in the path of special URLs as described in the spec and tested in web platform tests.
3252         Also a slight performance improvement using StringViews instead of copied Strings.
3253
3254 2016-09-08  Alex Christensen  <achristensen@webkit.org>
3255
3256         URLParser should handle URLs with empty authority
3257         https://bugs.webkit.org/show_bug.cgi?id=161711
3258
3259         Reviewed by Brady Eidson.
3260
3261         Covered by new API tests.
3262
3263         * platform/URLParser.cpp:
3264         (WebCore::URLParser::parse):
3265         (WebCore::URLParser::parseAuthority):
3266
3267 2016-09-08  Chris Dumez  <cdumez@apple.com>
3268
3269         HTMLImageElement.hspace / vspace attributes should be unsigned
3270         https://bugs.webkit.org/show_bug.cgi?id=161754
3271
3272         Reviewed by Alex Christensen.
3273
3274         HTMLImageElement.hspace / vspace attributes should be unsigned:
3275         - https://html.spec.whatwg.org/#HTMLImageElement-partial
3276
3277         Firefox agrees with the specification, however, those were signed in
3278         webKit.
3279
3280         No new tests, rebaselined existing test.
3281
3282         * html/HTMLImageElement.idl:
3283
3284 2016-09-08  Chris Dumez  <cdumez@apple.com>
3285
3286         Update parseHTMLNonNegativeInteger() to return an unsigned value
3287         https://bugs.webkit.org/show_bug.cgi?id=161759
3288
3289         Reviewed by Alex Christensen.
3290
3291         Update parseHTMLNonNegativeInteger() to return an unsigned value instead
3292         of a signed one as the value can never be negative.
3293
3294         * html/HTMLElement.cpp:
3295         (WebCore::HTMLElement::parseBorderWidthAttribute):
3296         * html/HTMLImageElement.cpp:
3297         (WebCore::HTMLImageElement::width):
3298         (WebCore::HTMLImageElement::height):
3299         * html/HTMLInputElement.cpp:
3300         (WebCore::HTMLInputElement::maxLengthAttributeChanged):
3301         (WebCore::HTMLInputElement::minLengthAttributeChanged):
3302         * html/HTMLTextAreaElement.cpp:
3303         (WebCore::HTMLTextAreaElement::maxLengthAttributeChanged):
3304         (WebCore::HTMLTextAreaElement::minLengthAttributeChanged):
3305         * html/ImageInputType.cpp:
3306         (WebCore::ImageInputType::height):
3307         (WebCore::ImageInputType::width):
3308         * html/parser/HTMLParserIdioms.cpp:
3309         (WebCore::parseHTMLNonNegativeInteger):
3310         (WebCore::parseHTTPRefreshInternal):
3311         * html/parser/HTMLParserIdioms.h:
3312
3313 2016-09-08  Said Abou-Hallawa  <sabouhallawa@apple.com>
3314
3315         Get rid of the color profile from ImageFrame and ImageDecoder
3316         https://bugs.webkit.org/show_bug.cgi?id=159699
3317
3318         Reviewed by Simon Fraser.
3319
3320         The color profile is set but it is never used.
3321
3322         * platform/image-decoders/ImageDecoder.cpp:
3323         (WebCore::ImageFrame::setColorProfile): Deleted.
3324         * platform/image-decoders/ImageDecoder.h:
3325         * platform/image-decoders/jpeg/JPEGImageDecoder.cpp:
3326         (WebCore::JPEGImageReader::decode):
3327         (WebCore::JPEGImageDecoder::outputScanlines):
3328         (WebCore::readColorProfile): Deleted.
3329         * platform/image-decoders/jpeg/JPEGImageDecoder.h:
3330         * platform/image-decoders/png/PNGImageDecoder.cpp:
3331         (WebCore::PNGImageDecoder::headerAvailable):
3332         (WebCore::PNGImageDecoder::rowAvailable):
3333         (WebCore::readColorProfile): Deleted.
3334
3335 2016-09-08  Dave Hyatt  <hyatt@apple.com>
3336
3337         [CSS Parser] Add support for new CSS selector parsing
3338         https://bugs.webkit.org/show_bug.cgi?id=161749
3339
3340         Reviewed by Dean Jackson.
3341
3342         * CMakeLists.txt:
3343         * WebCore.xcodeproj/project.pbxproj:
3344         * contentextensions/ContentExtensionParser.cpp:
3345         (WebCore::ContentExtensions::isValidSelector):
3346         * css/CSSDefaultStyleSheets.cpp:
3347         (WebCore::parseUASheet):
3348         * css/CSSFontFaceSet.cpp:
3349         (WebCore::CSSFontFaceSet::matchingFaces):
3350         * css/CSSGrammar.y.in:
3351         * css/CSSSelector.cpp:
3352         (WebCore::CSSSelector::selectorText):
3353         * css/CSSSelector.h:
3354         * css/DOMCSSNamespace.cpp:
3355         (WebCore::DOMCSSNamespace::supports):
3356         * css/FontFace.cpp:
3357         (WebCore::FontFace::parseString):
3358         (WebCore::FontFace::setVariant):
3359         * css/MediaList.cpp:
3360         (WebCore::MediaQuerySet::internalParse):
3361         (WebCore::MediaQuerySet::parse):
3362         * css/SelectorChecker.cpp:
3363         (WebCore::SelectorChecker::matchRecursively):
3364         * css/SelectorFilter.cpp:
3365         (WebCore::SelectorFilter::collectIdentifierHashes):
3366         * css/SelectorPseudoClassAndCompatibilityElementMap.in:
3367         * css/SelectorPseudoTypeMap.h:
3368         * css/SourceSizeList.cpp:
3369         (WebCore::parseSizesAttribute):
3370         * css/StyleProperties.cpp:
3371         (WebCore::MutableStyleProperties::MutableStyleProperties):
3372         * css/StyleProperties.h:
3373         * css/StyleRuleImport.cpp:
3374         (WebCore::StyleRuleImport::setCSSStyleSheet):
3375         * css/StyleSheetContents.cpp:
3376         (WebCore::StyleSheetContents::StyleSheetContents):
3377         (WebCore::StyleSheetContents::parserAddNamespace):
3378         (WebCore::StyleSheetContents::namespaceURIFromPrefix):
3379         (WebCore::StyleSheetContents::determineNamespace): Deleted.
3380         * css/StyleSheetContents.h:
3381         * css/WebKitCSSMatrix.cpp:
3382         (WebCore::WebKitCSSMatrix::setMatrixValue):
3383         * css/makeSelectorPseudoClassAndCompatibilityElementMap.py:
3384         * css/parser/CSSParser.cpp:
3385         (WebCore::strictCSSParserContext):
3386         (WebCore::CSSParserContext::CSSParserContext):
3387         (WebCore::CSSParser::parseColor):
3388         (WebCore::CSSParser::shouldAcceptUnitLessValues):
3389         (WebCore::CSSParser::parseValue):
3390         (WebCore::CSSParser::parseColumnWidth):
3391         (WebCore::CSSParser::parseColumnCount):
3392         (WebCore::CSSParser::parseFontWeight):
3393         (WebCore::CSSParser::parseColorParameters):
3394         (WebCore::CSSParser::parseHSLParameters):
3395         (WebCore::CSSParser::parseShadow):
3396         (WebCore::CSSParser::parseBorderImageSlice):
3397         (WebCore::CSSParser::parseBorderImageQuad):
3398         (WebCore::CSSParser::parseDeprecatedLinearGradient):
3399         (WebCore::CSSParser::parseLinearGradient):
3400         (WebCore::CSSParser::parseTransformValue):
3401         (WebCore::CSSParser::parseBuiltinFilterArguments):
3402         (WebCore::CSSParser::determineNameInNamespace):
3403         * css/parser/CSSParser.h:
3404         (WebCore::CSSParser::inStrictMode):
3405         (WebCore::CSSParser::inQuirksMode):
3406         * css/parser/CSSParserMode.h:
3407         (WebCore::isQuirksModeBehavior):
3408         (WebCore::isUASheetBehavior):
3409         (WebCore::isUnitLessLengthParsingEnabledForMode):
3410         (WebCore::isCSSViewportParsingEnabledForMode):
3411         (WebCore::strictToCSSParserMode):
3412         (WebCore::isStrictParserMode):
3413         * css/parser/CSSParserValues.cpp:
3414         (WebCore::CSSParserSelector::parsePseudoElementSelectorFromStringView):
3415         (WebCore::CSSParserSelector::parsePseudoClassSelectorFromStringView):
3416         (WebCore::CSSParserSelector::setSelectorList):
3417         (WebCore::CSSParserSelector::appendTagHistory):
3418         (WebCore::CSSParserSelector::releaseTagHistory):
3419         (WebCore::CSSParserSelector::isHostPseudoSelector):
3420         * css/parser/CSSParserValues.h:
3421         (WebCore::CSSParserSelector::match):
3422         (WebCore::CSSParserSelector::pseudoElementType):
3423         (WebCore::CSSParserSelector::selectorList):
3424         (WebCore::CSSParserSelector::needsImplicitShadowCombinatorForMatching):
3425         * css/parser/CSSPropertyParser.h:
3426         (WebCore::CSSPropertyParser::inQuirksMode):
3427         * css/parser/CSSSelectorParser.cpp: Added.
3428         (WebCore::CSSSelectorParser::parseSelector):
3429         (WebCore::CSSSelectorParser::CSSSelectorParser):
3430         (WebCore::CSSSelectorParser::consumeComplexSelectorList):
3431         (WebCore::CSSSelectorParser::consumeCompoundSelectorList):
3432         (WebCore::CSSSelectorParser::consumeComplexSelector):
3433         (WebCore::CSSSelectorParser::consumeCompoundSelector):
3434         (WebCore::CSSSelectorParser::consumeSimpleSelector):
3435         (WebCore::CSSSelectorParser::consumeName):
3436         (WebCore::CSSSelectorParser::consumeId):
3437         (WebCore::CSSSelectorParser::consumeClass):
3438         (WebCore::CSSSelectorParser::consumeAttribute):
3439         (WebCore::CSSSelectorParser::consumePseudo):
3440         (WebCore::CSSSelectorParser::consumeCombinator):
3441         (WebCore::CSSSelectorParser::consumeAttributeMatch):
3442         (WebCore::CSSSelectorParser::consumeAttributeFlags):
3443         (WebCore::CSSSelectorParser::consumeANPlusB):
3444         (WebCore::CSSSelectorParser::defaultNamespace):
3445         (WebCore::CSSSelectorParser::determineNamespace):
3446         (WebCore::CSSSelectorParser::prependTypeSelectorIfNeeded):
3447         (WebCore::CSSSelectorParser::addSimpleSelectorToCompound):
3448         (WebCore::CSSSelectorParser::splitCompoundAtImplicitShadowCrossingCombinator):
3449         * css/parser/CSSSelectorParser.h: Added.
3450         (WebCore::CSSSelectorParser::DisallowPseudoElementsScope::DisallowPseudoElementsScope):
3451         (WebCore::CSSSelectorParser::DisallowPseudoElementsScope::~DisallowPseudoElementsScope):
3452         * cssjit/SelectorCompiler.cpp:
3453         (WebCore::SelectorCompiler::fragmentRelationForSelectorRelation):
3454         * dom/StyledElement.cpp:
3455         (WebCore::StyledElement::rebuildPresentationAttributeStyle):
3456         * svg/SVGFontFaceElement.cpp:
3457         (WebCore::SVGFontFaceElement::SVGFontFaceElement):
3458
3459 2016-09-08  Simon Fraser  <simon.fraser@apple.com>
3460
3461         Don't run transitions to or from undefined Lengths
3462         https://bugs.webkit.org/show_bug.cgi?id=161750
3463         rdar://problem/28170460
3464
3465         Reviewed by Zalan Bujtas.
3466
3467         For properties like max-height whose default value is 'none', we would erroneously
3468         attempt to run transitions/animations, and then assert when one of the endpoints
3469         was undefined.
3470
3471         So don't attempt to blend such Length values, just as do when they are auto.
3472
3473         Fixes some transitions on apple.com and developer.apple.com.
3474
3475         Test: transitions/transition-to-from-undefined.html
3476
3477         * page/animation/CSSPropertyAnimation.cpp:
3478         (WebCore::CSSPropertyAnimation::blendProperties):
3479         * platform/Length.cpp:
3480         (WebCore::blend):
3481
3482 2016-09-08  Myles C. Maxfield  <mmaxfield@apple.com>
3483
3484         Support new emoji group candidates
3485         https://bugs.webkit.org/show_bug.cgi?id=161664
3486         <rdar://problem/24802695>
3487         <rdar://problem/27666433>
3488
3489         Reviewed by Simon Fraser.
3490
3491         Support more emoji group candidates. This includes joining groups into a single glyph, as
3492         well as atomic deletions of the entire group when the backspace key is pressed.
3493
3494         Tests: editing/deleting/delete-emoji.html:
3495                fast/text/emoji-num-glyphs.html:
3496
3497         * platform/text/CharacterProperties.h:
3498         (WebCore::isEmojiGroupCandidate):
3499
3500 2016-09-08  Chris Dumez  <cdumez@apple.com>
3501
3502         HTMLImageElement.width / height attributes should be unsigned
3503         https://bugs.webkit.org/show_bug.cgi?id=161730
3504
3505         Reviewed by Alex Christensen.
3506
3507         HTMLImageElement.width / height attributes should be unsigned as per
3508         the HTML specification:
3509         - https://html.spec.whatwg.org/#htmlimageelement
3510
3511         However, they are signed in WebKit. Firefox agrees with the
3512         specification.
3513
3514         No new tests, rebaselined existing test.
3515
3516         * bindings/js/JSImageConstructor.cpp:
3517         (WebCore::JSImageConstructor::construct):
3518         (WebCore::createImageConstructor): Deleted.
3519         * html/HTMLImageElement.cpp:
3520         (WebCore::HTMLImageElement::createForJSConstructor):
3521         (WebCore::HTMLImageElement::width):
3522         (WebCore::HTMLImageElement::height):
3523         (WebCore::HTMLImageElement::setHeight):
3524         (WebCore::HTMLImageElement::setWidth):
3525         * html/HTMLImageElement.h:
3526         * html/HTMLImageElement.idl:
3527         * html/ImageDocument.cpp:
3528         (WebCore::ImageDocument::restoreImageSize):
3529
3530 2016-09-08  Filip Pizlo  <fpizlo@apple.com>
3531
3532         Move JSMap/JSSet over to Auxiliary MarkedSpace
3533         https://bugs.webkit.org/show_bug.cgi?id=161744
3534
3535         Reviewed by Saam Barati.
3536
3537         No new tests because no change in behavior.
3538
3539         * bindings/js/SerializedScriptValue.cpp:
3540
3541 2016-09-08  Commit Queue  <commit-queue@webkit.org>
3542
3543         Unreviewed, rolling out r205652.
3544         https://bugs.webkit.org/show_bug.cgi?id=161748
3545
3546         Crashing under ASan (Requested by yusukesuzuki on #webkit).
3547
3548         Reverted changeset:
3549
3550         "ScriptRunner should be driven by PendingScript rather than
3551         ScriptElement"
3552         https://bugs.webkit.org/show_bug.cgi?id=161726
3553         http://trac.webkit.org/changeset/205652
3554
3555 2016-09-08  Yusuke Suzuki  <utatane.tea@gmail.com>
3556
3557         ScriptRunner should be driven by PendingScript rather than ScriptElement
3558         https://bugs.webkit.org/show_bug.cgi?id=161726
3559
3560         Reviewed by Ryosuke Niwa.
3561
3562         ScriptRunner is driven by ScriptElement::notifyFinished. While ScriptRunner is driven by this,
3563         HTMLScriptRunner does not use it. Instead, HTMLScriptRunner uses PendingScriptClient. As a result,
3564         ScriptElement::notifyFinished is used only when the script is annotated with "defer" or "async"
3565         while all the external script will load the LoadableScript. It is confusing.
3566         This patch removes ScriptElement::notifyFinished and use PendingScript's observability
3567         in ScriptRunner instead.
3568
3569         This patch also fixes the behavior about ignore-destructive-writes counter[1]. When dispatching
3570         the load and error events, this ignore-destructive-writes counter should not be incremeneted by
3571         this execution. The added tests ensure this behavior.
3572
3573         [1]: https://html.spec.whatwg.org/multipage/scripting.html#execute-the-script-block
3574
3575         * dom/ScriptElement.cpp: Drop LoadableScriptClient interface.
3576         (WebCore::ScriptElement::prepareScript): Do not use addClient. ScriptRunner use PendingScript::{setClient,clearClient} instead.
3577         (WebCore::ScriptElement::executeScriptForScriptRunner): IgnoreDestructiveWriteCountIncrementer will be done in ScriptElement::executeScript.
3578         So no need to do it here, that's duplicated.
3579         (WebCore::ScriptElement::~ScriptElement): Deleted. ScriptElement does not use addClient/removeClient.
3580         (WebCore::ScriptElement::stopLoadRequest): Deleted.
3581         (WebCore::ScriptElement::executeScriptForHTMLScriptRunner): Deleted. executeScriptForHTMLScriptRunner and executeScriptForScriptRunner are
3582         merged into executeScriptForRunner.
3583         (WebCore::ScriptElement::notifyFinished): Deleted.
3584         * dom/ScriptElement.h:
3585         (WebCore::ScriptElement::~ScriptElement):
3586         (WebCore::ScriptElement::willExecuteInOrder): Used in ScriptRunner to determine whether the script is async or defer.
3587         (WebCore::ScriptElement::willExecuteWhenDocumentFinishedParsing): Deleted.
3588         * dom/ScriptRunner.cpp:
3589         (WebCore::ScriptRunner::~ScriptRunner): HashSet's iterator will return `const PendingScript&`.
3590         Another option is using HashSet<RefPtr<PendingScript>>. Here, we use a little bit weired const_cast.
3591         (WebCore::ScriptRunner::queueScriptForExecution): Use PendingScript::setClient to wait loading.
3592         (WebCore::ScriptRunner::notifyFinished): Notify the script ready here.
3593         (WebCore::ScriptRunner::timerFired): Use executeScriptForScriptRunner.
3594         (WebCore::ScriptRunner::notifyScriptReady): Deleted.
3595         * dom/ScriptRunner.h:
3596         * html/parser/HTMLScriptRunner.cpp:
3597         (WebCore::HTMLScriptRunner::executePendingScriptAndDispatchEvent): Use executeScriptForScriptRunner.
3598
3599 2016-09-08  Alex Christensen  <achristensen@webkit.org>
3600
3601         Re-land r205580 after r205649 fixed the test failures
3602         https://bugs.webkit.org/show_bug.cgi?id=161668
3603
3604         Re-landing changesets:
3605
3606         "Punycode encode non-ascii hosts in URLParser"
3607         https://bugs.webkit.org/show_bug.cgi?id=161655
3608         http://trac.webkit.org/changeset/205521
3609
3610         "Fix query-only and fragment-only relative URLs when using
3611         URLParser"
3612         https://bugs.webkit.org/show_bug.cgi?id=161657
3613         http://trac.webkit.org/changeset/205526
3614
3615         "URLParser should parse / as a relative URL"
3616         https://bugs.webkit.org/show_bug.cgi?id=161667
3617         http://trac.webkit.org/changeset/205532
3618
3619 2016-09-08  Alex Christensen  <achristensen@webkit.org>
3620
3621         Add range check in URLParser's serializeIPv6
3622         https://bugs.webkit.org/show_bug.cgi?id=161743
3623
3624         Reviewed by David Kilzer.
3625
3626         No new tests, but this fixes API tests in some release builds after
3627         the patch from https://bugs.webkit.org/show_bug.cgi?id=161668 is recommitted.
3628
3629         * platform/URLParser.cpp:
3630         (WebCore::serializeIPv6):
3631         Don't go out of bounds.  Don't assume that the memory immediately after the end of the array will be empty.
3632
3633 2016-09-07  Alex Christensen  <achristensen@webkit.org>
3634
3635         Roll out r205580 and r205582.
3636         https://bugs.webkit.org/show_bug.cgi?id=161668
3637
3638         I need to figure out why this is failing on the bots before landing any more URLParser progress.
3639
3640 2016-09-07  Yusuke Suzuki  <utatane.tea@gmail.com>
3641
3642         Unreviewed, EFL build fix after r205581
3643         https://bugs.webkit.org/show_bug.cgi?id=161674
3644
3645         * dom/LoadableClassicScript.cpp:
3646         (WebCore::LoadableClassicScript::notifyFinished):
3647
3648 2016-09-07  Alex Christensen  <achristensen@webkit.org>
3649
3650         Fix API tests after r205580
3651         https://bugs.webkit.org/show_bug.cgi?id=161668
3652
3653         No new tests, but this fixes API tests on bots.
3654
3655         * platform/URLParser.cpp:
3656         (WebCore::domainToASCII):
3657         This function seems to be appending characters to strings sometimes on some configurations.
3658         This definitely needs further investigation, but this will fix the bots, and nothing else
3659         will be affected because the URLParser is disabled by default.
3660
3661 2016-09-07  Yusuke Suzuki  <utatane.tea@gmail.com>
3662
3663         Introduce abstract class LoadableScript for classic script and module graph
3664         https://bugs.webkit.org/show_bug.cgi?id=161674
3665
3666         Reviewed by Ryosuke Niwa.
3667
3668         To prepare for ScriptModuleGraph, we introduce the abstract class over the classic script
3669         and the module script, LoadableScript.
3670
3671         No behavior change.
3672
3673         * CMakeLists.txt:
3674         * WebCore.xcodeproj/project.pbxproj:
3675         * dom/LoadableClassicScript.cpp: Added. LoadableClassicScript is the derived class from the
3676         LoadableScript. In the module patch, we will introduce LoadableScriptModuleGraph which is also
3677         the derived class from the LoadableScript. It is used for the external classic script.
3678         A CachedResourceHandle used here alone does not prevent the underlying CachedResource from purging its
3679         data buffer. This LoadableClassicScript holds a client until this class is destroyed in order to
3680         guarantee that the data buffer will not be purged.
3681         (WebCore::LoadableClassicScript::create):
3682         (WebCore::LoadableClassicScript::LoadableClassicScript):
3683         (WebCore::LoadableClassicScript::~LoadableClassicScript):
3684         (WebCore::LoadableClassicScript::isLoaded):
3685         (WebCore::LoadableClassicScript::wasErrored): Beyond the boolean value, this can return the detail
3686         of the error. This detailed information will be used to report it to the inspector in the ScriptElement.
3687         (WebCore::LoadableClassicScript::wasCanceled):
3688         (WebCore::LoadableClassicScript::notifyFinished): Nosniff and cross-origin loading errors are handled here,
3689         instead of exposing CachedScript*.
3690         (WebCore::LoadableClassicScript::execute): Execute the cached script by using the given ScriptElement.
3691         * dom/LoadableClassicScript.h: Copied from Source/WebCore/dom/PendingScript.h.
3692         (isType):
3693         * dom/LoadableScript.cpp: Copied from Source/WebCore/dom/ScriptRunner.h. New wrapper for CachedScript
3694         and ScriptModuleGraph. We introduce a new wrapper to handle the above 2 things in the same way.
3695         We take the way to introduce a new wrapper instead of introducing a new interface that is inherited by
3696         CachedScript and ScriptModuleGraph. This is because ScriptModuleGraph is ref-counted while CachedScript
3697         is managed by CachedResourceHandle. While this patch does not contain ScriptModuleGraph part, this
3698         should be added in the module patch and at that time, this should be managed by this LoadableScript's
3699         subclass. And we introduce TypeCasts traits for LoadableScript to allow `is<>` and `downcast<>`.
3700         (WebCore::LoadableScript::addClient):
3701         (WebCore::LoadableScript::removeClient):
3702         (WebCore::LoadableScript::notifyClientFinished):
3703         * dom/LoadableScript.h: Copied from Source/WebCore/dom/ScriptRunner.h.
3704         (WebCore::LoadableScript::~LoadableScript):
3705         (WebCore::LoadableScript::isClassicScript):
3706         (WebCore::LoadableScript::isModuleGraph):
3707         * dom/LoadableScriptClient.h: Copied from Source/WebCore/dom/ScriptRunner.h.
3708         (WebCore::LoadableScriptClient::~LoadableScriptClient):
3709         * dom/PendingScript.cpp: Use LoadableScript instead of CachedScript.
3710         (WebCore::PendingScript::create):
3711         (WebCore::PendingScript::PendingScript):
3712         (WebCore::PendingScript::~PendingScript):
3713         (WebCore::PendingScript::loadableScript):
3714         (WebCore::PendingScript::notifyFinished):
3715         (WebCore::PendingScript::isLoaded):
3716         (WebCore::PendingScript::wasErrored):
3717         (WebCore::PendingScript::cachedScript): Deleted.
3718         * dom/PendingScript.h:
3719         * dom/ScriptElement.cpp:
3720         (WebCore::ScriptElement::ScriptElement):
3721         (WebCore::ScriptElement::handleSourceAttribute): Change sourceUrl to sourceURL to be consistent.
3722         (WebCore::ScriptElement::prepareScript):
3723         (WebCore::ScriptElement::requestClassicScript): requestScript is renamed to requestClassicScript.
3724         (WebCore::ScriptElement::requestScriptWithCache): Extract the code requesting the
3725         CachedScript from requestScript. This will also be used by the module fetcher.
3726         (WebCore::ScriptElement::executeScript): Now inspector error reporting is also done in this function.
3727         When an error occurs, LoadableScript::wasErrored() returns the error which may include the information
3728         to report the error to the inspector. nosniff and cross-origin loading errors are now detected by the
3729         LoadableClassicScript and reported through this wasErrored().
3730         (WebCore::ScriptElement::stopLoadRequest):
3731         (WebCore::ScriptElement::executeScriptAndDispatchEvent):
3732         (WebCore::ScriptElement::executeScriptForScriptRunner): Move the code from ScriptRunner. This function
3733         calls removeClient(*this) because ScriptRunner is driven by the ScriptElement's notification. Only when using
3734         ScriptRunner, we call addClient(*this) for ScriptElement. This is tricky, we should refactor this in the separated
3735         bug (https://bugs.webkit.org/show_bug.cgi?id=161726).
3736         (WebCore::ScriptElement::executeScriptForHTMLScriptRunner): Move the code from HTMLScriptRunner.
3737         (WebCore::ScriptElement::notifyFinished):
3738         (WebCore::ScriptElement::requestScript): Deleted.
3739         (WebCore::ScriptElement::execute): Deleted.
3740         * dom/ScriptElement.h:
3741         (WebCore::ScriptElement::loadableScript):
3742         (WebCore::ScriptElement::cachedScript): Deleted.
3743         * dom/ScriptRunner.cpp:
3744         (WebCore::ScriptRunner::queueScriptForExecution):
3745         (WebCore::ScriptRunner::timerFired): Use ScriptElement::executeScriptForScriptRunner.
3746         * dom/ScriptRunner.h:
3747         * html/parser/HTMLScriptRunner.cpp:
3748         (WebCore::HTMLScriptRunner::executePendingScriptAndDispatchEvent):
3749         (WebCore::requestPendingScript):
3750         (WebCore::HTMLScriptRunner::requestParsingBlockingScript):
3751         (WebCore::HTMLScriptRunner::sourceFromPendingScript): Deleted.
3752         * html/parser/HTMLScriptRunner.h: Use ScriptElement::executeScriptForHTMLScriptRunner.
3753         * xml/parser/XMLDocumentParserLibxml2.cpp: Currently, we do nothing about XMLDocument in this patch.
3754         We should support the module script, but before that, we should refactor this pending script handling.
3755         (WebCore::XMLDocumentParser::endElementNs):
3756
3757 2016-09-07  Alex Christensen  <achristensen@webkit.org>
3758
3759         Unreviewed, revert r205533.
3760         https://bugs.webkit.org/show_bug.cgi?id=161668
3761
3762         Re-landing changesets:
3763
3764         "Punycode encode non-ascii hosts in URLParser"
3765         https://bugs.webkit.org/show_bug.cgi?id=161655
3766         http://trac.webkit.org/changeset/205521
3767
3768         "Fix query-only and fragment-only relative URLs when using
3769         URLParser"
3770         https://bugs.webkit.org/show_bug.cgi?id=161657
3771         http://trac.webkit.org/changeset/205526
3772
3773         "URLParser should parse / as a relative URL"
3774         https://bugs.webkit.org/show_bug.cgi?id=161667
3775         http://trac.webkit.org/changeset/205532
3776
3777 2016-09-07  Simon Fraser  <simon.fraser@apple.com>
3778
3779         Enable the <meter> element on iOS
3780         https://bugs.webkit.org/show_bug.cgi?id=161714
3781         rdar://problem/8978410
3782
3783         Reviewed by Tim Horton.
3784
3785         Define ENABLE_METER_ELEMENT unconditionally now.
3786         
3787         Rendering falls back to html.css rendering, which makes <meter> looks similar between
3788         macOS and iOS.
3789
3790         Tested by enabling existing tests.
3791
3792         * Configurations/FeatureDefines.xcconfig:
3793
3794 2016-09-07  Eric Carlson  <eric.carlson@apple.com>
3795
3796         [MediaStream] applyConstraints pt. 2 - advanced constraints
3797         https://bugs.webkit.org/show_bug.cgi?id=161715
3798         <rdar://problem/28195461>
3799
3800         Reviewed by Dean Jackson.
3801
3802         Test: fast/mediastream/apply-constraints-advanced.html
3803
3804         * platform/mediastream/MediaConstraints.cpp:
3805         (WebCore::MediaConstraint::create): Return Ref<>, not RefPtr<>.
3806         (WebCore::MediaConstraint::copy): New
3807         (WebCore::IntConstraint::copy): Ditto.
3808         (WebCore::DoubleConstraint::copy): Ditto.
3809         (WebCore::BooleanConstraint::copy): Ditto.
3810         (WebCore::StringConstraint::copy): Ditto.
3811         (WebCore::StringConstraint::fitnessDistance): New, compute the fitness distance between the
3812           constraint and the specified value.
3813         (WebCore::StringConstraint::merge): New, merge value into constraint.
3814         (WebCore::FlattenedConstraint::set): New, add or replace a constraint.
3815         (WebCore::FlattenedConstraint::merge): New, merge or add a constraint.
3816         * platform/mediastream/MediaConstraints.h:
3817         (WebCore::MediaConstraint::fitnessDistance):
3818         (WebCore::MediaConstraint::merge):
3819         (WebCore::NumericConstraint::nearlyEqual):
3820         (WebCore::FlattenedConstraint::isEmpty):
3821         (WebCore::FlattenedConstraint::begin):
3822         (WebCore::FlattenedConstraint::end):
3823         (WebCore::MediaConstraint::~MediaConstraint): Deleted.
3824         (WebCore::MediaConstraint::find): Deleted.
3825         (WebCore::MediaConstraint::getIdeal): Deleted.
3826
3827         * platform/mediastream/RealtimeMediaSource.cpp:
3828         (WebCore::RealtimeMediaSource::fitnessDistance): Return the fitness distance between the source
3829           capabilities and a constraint.
3830         (WebCore::applyNumericConstraint): New, apply a numeric constraint.
3831         (WebCore::RealtimeMediaSource::applyConstraint): Use applyNumericConstraint.
3832         (WebCore::RealtimeMediaSource::selectSettings): New, implement the SelectSettings algorithm
3833         (WebCore::RealtimeMediaSource::applyConstraints):
3834         (WebCore::RealtimeMediaSource::supportsConstraint): Deleted.
3835         (WebCore::value): Deleted.
3836         * platform/mediastream/RealtimeMediaSource.h:
3837
3838 2016-09-07  Mark Lam  <mark.lam@apple.com>
3839
3840         Add CatchScope and force all exception checks to be via ThrowScope or CatchScope.
3841         https://bugs.webkit.org/show_bug.cgi?id=161498
3842
3843         Reviewed by Geoffrey Garen.
3844
3845         No new test because there is no behavior change in general except for 1 bug fix.
3846         That bug is already caught by existing tests with the introduction of the CatchScope.
3847
3848         Fixes a bug in JSEventListener::handleEvent() where the exception thrown from
3849         a failed attempt to get the handleEvent callback is not handled.
3850
3851         * ForwardingHeaders/runtime/CatchScope.h: Added.
3852         * Modules/encryptedmedia/CDMSessionClearKey.cpp:
3853         (WebCore::CDMSessionClearKey::update):
3854         * Modules/indexeddb/IDBObjectStore.cpp:
3855         (WebCore::IDBObjectStore::putOrAdd):
3856         * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
3857         (WebCore::IDBServer::UniqueIDBDatabase::performPutOrAdd):
3858         * Modules/mediastream/SDPProcessor.cpp:
3859         (WebCore::SDPProcessor::callScript):
3860         * Modules/plugins/QuickTimePluginReplacement.mm:
3861         (WebCore::QuickTimePluginReplacement::ensureReplacementScriptInjected):
3862         (WebCore::QuickTimePluginReplacement::installReplacement):
3863         * bindings/js/ArrayValue.cpp:
3864         (WebCore::ArrayValue::get):
3865         * bindings/js/Dictionary.cpp:
3866         (WebCore::Dictionary::getOwnPropertiesAsStringHashMap):
3867         * bindings/js/IDBBindingUtilities.cpp:
3868         (WebCore::toJS):
3869         * bindings/js/JSApplePaySessionCustom.cpp:
3870         (WebCore::JSApplePaySession::completeShippingMethodSelection):
3871         (WebCore::JSApplePaySession::completeShippingContactSelection):
3872         (WebCore::JSApplePaySession::completePaymentMethodSelection):
3873         * bindings/js/JSAudioTrackCustom.cpp:
3874         (WebCore::JSAudioTrack::setKind):
3875         (WebCore::JSAudioTrack::setLanguage):
3876         * bindings/js/JSBlobCustom.cpp:
3877         (WebCore::constructJSBlob):
3878         * bindings/js/JSCSSStyleDeclarationCustom.cpp:
3879         (WebCore::JSCSSStyleDeclaration::getPropertyCSSValue):
3880         * bindings/js/JSCommandLineAPIHostCustom.cpp:
3881         (WebCore::getJSListenerFunctions):
3882         * bindings/js/JSCryptoAlgorithmDictionary.cpp:
3883         (WebCore::JSCryptoAlgorithmDictionary::getAlgorithmIdentifier):
3884         (WebCore::getHashAlgorithm):
3885         (WebCore::createAesCbcParams):
3886         (WebCore::createAesKeyGenParams):
3887         (WebCore::createHmacParams):
3888         (WebCore::createHmacKeyParams):
3889         (WebCore::createRsaKeyGenParams):
3890         (WebCore::createRsaOaepParams):
3891         (WebCore::createRsaSsaParams):
3892         * bindings/js/JSCryptoKeySerializationJWK.cpp:
3893         (WebCore::getJSArrayFromJSON):
3894         (WebCore::getStringFromJSON):
3895         (WebCore::getBooleanFromJSON):
3896         (WebCore::JSCryptoKeySerializationJWK::JSCryptoKeySerializationJWK):
3897         (WebCore::JSCryptoKeySerializationJWK::reconcileUsages):
3898         (WebCore::JSCryptoKeySerializationJWK::keyDataOctetSequence):
3899         (WebCore::JSCryptoKeySerializationJWK::keyDataRSAComponents):
3900         (WebCore::JSCryptoKeySerializationJWK::keyData):
3901         (WebCore::buildJSONForRSAComponents):
3902         (WebCore::addUsagesToJSON):
3903         (WebCore::JSCryptoKeySerializationJWK::serialize):
3904         * bindings/js/JSCustomElementInterface.cpp:
3905         (WebCore::JSCustomElementInterface::constructElement):
3906         (WebCore::constructCustomElementSynchronously):
3907         (WebCore::JSCustomElementInterface::upgradeElement):
3908         * bindings/js/JSCustomElementRegistryCustom.cpp:
3909         (WebCore::getCustomElementCallback):
3910         (WebCore::JSCustomElementRegistry::define):
3911         (WebCore::whenDefinedPromise):
3912         (WebCore::JSCustomElementRegistry::whenDefined):
3913         * bindings/js/JSDOMBinding.cpp:
3914         (WebCore::valueToUSVString):
3915         (WebCore::reportException):
3916         (WebCore::reportCurrentException):
3917         (WebCore::setDOMException):
3918         (WebCore::hasIteratorMethod):
3919         (WebCore::toSmallerInt):
3920         (WebCore::toSmallerUInt):
3921         (WebCore::toInt32EnforceRange):
3922         (WebCore::toUInt32EnforceRange):
3923         (WebCore::toInt64EnforceRange):
3924         (WebCore::toUInt64EnforceRange):
3925         (WebCore::throwNotSupportedError):
3926         (WebCore::throwInvalidStateError):
3927         (WebCore::throwSecurityError):
3928         * bindings/js/JSDOMBinding.h:
3929         (WebCore::toJSSequence):
3930         (WebCore::toJS):
3931         (WebCore::jsFrozenArray):
3932         (WebCore::NativeValueTraits<String>::nativeValue):
3933         (WebCore::NativeValueTraits<unsigned>::nativeValue):
3934         (WebCore::NativeValueTraits<float>::nativeValue):
3935         (WebCore::NativeValueTraits<double>::nativeValue):
3936         (WebCore::toNativeArray):
3937         * bindings/js/JSDOMGlobalObject.cpp:
3938         (WebCore::makeThisTypeErrorForBuiltins):
3939         (WebCore::makeGetterTypeErrorForBuiltins):
3940         * bindings/js/JSDOMGlobalObjectTask.cpp:
3941         * bindings/js/JSDOMIterator.h:
3942         (WebCore::iteratorForEach):
3943         * bindings/js/JSDOMPromise.cpp:
3944         (WebCore::rejectPromiseWithExceptionIfAny):
3945         * bindings/js/JSDOMPromise.h:
3946         (WebCore::callPromiseFunction):
3947         * bindings/js/JSDOMStringMapCustom.cpp:
3948         (WebCore::JSDOMStringMap::putDelegate):
3949         * bindings/js/JSDOMWindowBase.cpp:
3950         (WebCore::JSDOMWindowMicrotaskCallback::call):
3951         * bindings/js/JSDOMWindowCustom.cpp:
3952         (WebCore::JSDOMWindow::setLocation):
3953         (WebCore::JSDOMWindow::open):
3954         (WebCore::JSDOMWindow::showModalDialog):
3955         (WebCore::handlePostMessage):
3956         (WebCore::JSDOMWindow::setTimeout):
3957         (WebCore::JSDOMWindow::setInterval):
3958         * bindings/js/JSDataCueCustom.cpp:
3959         (WebCore::constructJSDataCue):
3960         * bindings/js/JSDeviceMotionEventCustom.cpp:
3961         (WebCore::readAccelerationArgument):
3962         (WebCore::readRotationRateArgument):
3963         (WebCore::JSDeviceMotionEvent::initDeviceMotionEvent):
3964         * bindings/js/JSDictionary.cpp:
3965         (WebCore::JSDictionary::tryGetProperty):
3966         (WebCore::JSDictionary::convertValue):
3967         * bindings/js/JSDictionary.h:
3968         (WebCore::JSDictionary::tryGetPropertyAndResult):
3969         * bindings/js/JSDocumentCustom.cpp:
3970         (WebCore::JSDocument::getCSSCanvasContext):
3971         * bindings/js/JSEventListener.cpp:
3972         (WebCore::JSEventListener::handleEvent):
3973         * bindings/js/JSFileCustom.cpp:
3974         (WebCore::constructJSFile):
3975         * bindings/js/JSGeolocationCustom.cpp:
3976         (WebCore::createPositionOptions):
3977         (WebCore::JSGeolocation::getCurrentPosition):
3978         (WebCore::JSGeolocation::watchPosition):
3979         * bindings/js/JSHTMLAllCollectionCustom.cpp:
3980         (WebCore::callHTMLAllCollection):
3981         * bindings/js/JSHTMLCanvasElementCustom.cpp:
3982         (WebCore::get3DContextAttributes):
3983         (WebCore::JSHTMLCanvasElement::getContext):
3984         (WebCore::JSHTMLCanvasElement::probablySupportsContext):
3985         * bindings/js/JSHTMLElementCustom.cpp:
3986         (WebCore::constructJSHTMLElement):
3987         * bindings/js/JSHistoryCustom.cpp:
3988         (WebCore::JSHistory::pushState):
3989         (WebCore::JSHistory::replaceState):
3990         * bindings/js/JSIDBDatabaseCustom.cpp:
3991         (WebCore::JSIDBDatabase::createObjectStore):